Lecture 2 - Chapter 1 (1.2)
Lecture 2 - Chapter 1 (1.2)
Lecture 2 - Chapter 1 (1.2)
Σ+ =
Given a string w = abc
Prefix of w are l, a, ab, & abc
Suffix of w are l, c, bc, & abc
Proper prefix or suffix is a prefix or suffix other
than the string itself
Proper Prefix of w are l, a, & ab
Proper Suffix of w are l, c, & bc
The concatenation of two strings is obtained by appending the
second string to the right of the first string
Example: -
Given w = a1a2..an & v = a1a2..am then concatenation of w &
v , denoted as wv, is given as wv = a1a2..ana1a2..am
a3.a2.= aaabb
Two strings are equal if they have the same number of symbols
and these symbols match, character for character.
Concatenation operation is associative, and it is not
commutative
The empty string serves as the identity element
for concatenation.
That is, for all strings x, x.l =l.x =x
String Reversal – Let w = a1a2…an be a string,
then the string reversal of w, reverse (w) or wR, is
anan-1…a1
E.g. If w = abc, then reverse(w) = wR =cba
Definition:
A language, L, is a collection of strings over a given
alphabet with some rules known as grammars. It may or
may not be finite.
A language may be thought of as a subset of all possible
strings (L z Σ*)
Storage
Control Unit
Output
BATTERY
input: switch
output: light bulb
Actions (Control Unit): flip switch
States (Storage): on, off
A particular state of the control unit, input file, and
temporary storage is known as configuration.
A move is the transition of the automaton from one
configuration to the next.
One automaton differs from the other in the way in
which the output can be produced and the nature of
the temporary storage.
An automaton can be deterministic or non-
deterministic
A deterministic automaton is the one in which
each move is uniquely determined by the current
configuration.
i.e. if the internal state, the input and the content of
the temporary storage, we can predict the future
behavior of the automaton.
In non-deterministic automaton there may have
several possible moves, so we can only predict a set of
possible actors.
An automaton whose output response is limited to a
simple “yes” or “no” is called an accepter (because it
accepts or rejects)
A more general automaton, capable of producing
strings of symbols as output is called a transducer.
There are four categories of formal grammars in the
Chomsky Hierarchy,
Type 0 - the most general difficult to parse but highly expressive
Type 1
Type 2
Type 3 - the most restrictive easy to parse but less expressive