FLAT Unit 1 LM
FLAT Unit 1 LM
IT
UNIT – I
FUNDAMENTALS
Syllabus: Strings, alphabet, language, operations, finite state machine, finite automaton model,
acceptance of strings and languages, deterministic finite automaton and non deterministic finite
automaton, transition diagrams and language recognizers.
Outcomes:
Bloom's
S. No Learning Outcomes Taxonomy
Level
1 Students will be able to define Symbol, Alphabet, String and Languages Remember
2 Students will be able to explain transition diagram, transition table with Understand
example
3 Students will be able to define Kleen closure. Remember
4 Students will be able to explain power of an alphabet Understand
5 Students will be able to write an automaton model Apply
6 Students will be able to define DFA and NFA Remember
7 Students will be able to differentiate the DFA and NFA Understand
8 Students will be able to construct NFAs and DFAs for given regular Apply
languages
Mathematical Notions:
⊂ subset
∉ set non-membership(not belongs to)
⊆ subset or equal to
A subset, A B, means that every element of A is also an element of B:
If x Є A, then x Є B.
empty set (ɸ)(epsilon)
o Set Operations : There are 4 basic set operations: union, intersection, complement, and
difference.
Union:
• A B is the set that contains all the elements in either A or B or both:
A B = {x | x A or x B}.
• For example, if A = { 1, 2, 3} and B ={ 3, 4, 5}, then A B = { 1, 2, 3, 4, 5}
Intersection:
o Symbols: An abstract entity that has no meaning by itself, Letters from various alphabets,
digits and special characters are the most commonly used symbols.
o Alphabet: A finite set of symbols. An alphabet is often denoted by sigma(∑), yet can be
given any name.
Operations on strings:
Concatenation of strings
The concatenation of two strings is the string formed by writing the first, followed
by the second, with no intervening space. Concatenation of strings is denoted by ◦.
That is, if w and x are strings, then wx is the concatenation of these two strings.
Example:
The concatenation of dog and house is doghouse.
Let x=0100101 and y= 1111 then x ◦ y=01001011111
String Reversal
Reversing a string means writing the string backwards.
It is denoted by wR
Example:
Reverse of the string abcd is dcba.
Substring
A substring is a part of a string.
Example:
If abcd is string then possible substrings are ε,a,b,c,d,ab,bc,cd,abc,bcd are proper
substrings for the given string
A prefix of a string is any number of leading symbols of that string.
A suffix of a string is any number of trailing symbols.
Example:
String abc has prefixes ε, a, ab, and abc; its suffixes are ε, c, bc, and abc.
A prefix or suffix of a string, other than the string itself, is called a proper prefix or
suffix.
A language is a set of strings.
o A set of strings all of which are chosen from Σ*, where Σ is a particular alphabet, is called
language.
o Examples:
The language of all strings consisting of n 0’s followed by n 1’s for some n≥0; { ε,
01, 0011, 000111, . . . }.
The set of strings of 0’s and 1’s with an equal number of each : {ε, 01, 10, 0011,
0101, 1001, . . .}
The set of binary values whose value is prime: {10, 11, 101, 111, 1011,. . .}
Σ* is a language for any alphabet Σ.
ɸ the empty language is a language over any alphabet.
{ε} the language consisting of only the empty string, is also a language over
Operations on languages:
Union
If L1 and L2 are two languages over an alphabet ∑.Then the union of L1 and L2
is denoted by L1 U L2.
Example:
L1={0,01,011} and L2={001},then L1 U L2={0,01,011,001}
Intersection
If L1 and L2 are two languages over an alphabet ∑.Then the intersection of L1
and L2 is denoted by L1 ∩ L2.
Example:
L1= {0, 01,011} and L2= {01}, then L1 ∩ L2= {01}
Complementation
L is a language over an alphabet ∑, then the complement of L denoted by L¯ ,is
the language consisting of those strings that are not in L over the alphabet.
Example:
If ∑={a,b} and L={a,b,aa} then L¯= ∑* - L={ ε,a,b,aa,bb,ab.........}-
{a,b,aa}={ε,bb,ab,ba.........}
Concatenation
Concatenation of two languages L1 and L2 is the language L1 o L2 ,each element
of which is a string formed by combining one string of L1 with another string of
L2.
Example:
L1={bc,bcc,cc}andL2={cc,ccc},thenL1oL2={bccc,bcccc,bcccccc,cccc,ccccc}
Reversal
If L is language, then LR is obtained by reversing the corresponding string in L. This
operation is similar to the reversal of a string.
∈ L}
LR ={wR | w
Example:
If L= {0, 011, 0111}, then LR = {0, 110, 1110}
Kleene Closure
The Kleene closure (or just closure) of L, denoted L*, is the set and the positive closure
∞
L * = U Li
i=0
∞
L = U Li
+
i=1
That is, L* denotes words constructed by concatenating any number of words from L.
L+ is the same, but the case of zero words, whose "concatenation" is defined to be ε, is
excluded. Note that L+ contains ε if and only if L does.
Example:
Let L1 = {10, 1}
Then L * = L0 U L1 U L2.................. = {ε, 1, 10, 11, 111, 1111 ,..........}
L + = L1 U L2 U L3...................= {1, 10, 11, 111, 1111...........}
Finite Automata
ε -NFA NFA
In DFA, for each input symbol, one can determine the state to which the machine will move.
Hence, it is called Deterministic Automaton. As it has a finite number of states, the machine is
called Deterministic Finite Machine or Deterministic Finite Automaton.
q0 is the initial state from where any input is processed (q0 ∈ Q).
δ is the transition function where δ: Q × ∑ → Q
In NDFA, for a particular input symbol, the machine can move to any combination of the states
in the machine. In other words, the exact state to which the machine moves cannot be
δ is the transition function where δ: Q × {∑ ∪ ε} → 2Q (Here the power set of Q (2Q) has
∑ is a finite set of symbols called the alphabets.
been taken because in case of NDFA, from a state, transition can occur to any
q0 is the initial state from where any input is processed (q0 ∈ Q).
combination of Q states)
1. Design DFA that accepts all strings which starts with ‘a’ over the alphabet {a,b}
Transition table
Input
State
a b
q0 q2 q1
q1 q1 q1
q1
q2 q2 q2
2. Design DFA that accepts all strings which contains ‘00’ as substring over the alphabet
{0,1}
Tuple Representation:
M(Q, ∑, δ, q0, F) where
S. No NFA DFA
A nondeterministic finite automaton is A deterministic finite automaton can be
a 5-tuple represented by a 5-tuple
1 M= (Q, ∑, δ, qo, F), where M= (Q, ∑, δ, qo, F), where
δ: Q x ∑ into 2Q. δ: Q x ∑ to Q.
For each state not all symbols For each state, transition on all
necessarily have to defined in the possible symbols should be defined
transition functions
Accepts input if one of the last Accepts input if the last state is in F
states is in F
Generally easier than a DFA to Sometimes harder to construct
construct because of the number of states.