finite automata intro
DESCRIPTION
TRANSCRIPT
![Page 1: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/1.jpg)
Theory of Automata &
Formal Languages
![Page 2: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/2.jpg)
BOOKS
Theory of computer Science: K.L.P.Mishra & N.Chandrasekharan
Intro to Automata theory, Formal languages and computation: Ullman,Hopcroft
Motwani
Elements of theory of computation Lewis & papadimitrou
![Page 3: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/3.jpg)
Syllabus
Introduction
Deterministic and non deterministic Finite Automata, Regular Expression,Two way finite automata,Finite automata with output,properties of regular sets,pumping lemma, closure properties,Myhill nerode theorem
![Page 4: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/4.jpg)
Context free Grammar: Derivation trees, Simplification forms
Pushdown automata: Def, Relationship between PDA and context free language,Properties, decision algorithms
Turing Machines: Turing machine model,Modification of turing machines,Church’s thesis,Undecidability,Recursive and recursively enumerable languages Post correspondence problems recursive functions
![Page 5: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/5.jpg)
Chomsky Hierarchy: Regular grammars, unrestricted grammar, context sensitive language, relationship among languages
![Page 6: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/6.jpg)
CPU
input memory
output memory
Program memory
temporary memory
![Page 7: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/7.jpg)
CPU
input memory
output memoryProgram memory
temporary memory3)( xxf
compute xx
compute xx 2
2x
42*2 z82*)( zxf
![Page 8: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/8.jpg)
Automaton
CPU
input memory
output memory
Program memory
temporary memory
Automaton
![Page 9: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/9.jpg)
input memory
output memory
temporary memory
Finite
Automaton
![Page 10: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/10.jpg)
Different Kinds of Automata
Automata are distinguished by the temporary memory
• Finite Automata: no temporary memory
• Pushdown Automata: stack
• Turing Machines: random access memory
![Page 11: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/11.jpg)
input memory
output memory
Random Access Memory
Turing
Machine
Turing Machine
Algorithms (highest computing power)
![Page 12: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/12.jpg)
Finite
Automata
Pushdown
Automata
Turing
Machine
Power of Automata
![Page 13: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/13.jpg)
Power sets
A power set is a set of sets
Powerset of S = the set of all the subsets of S
S = { a, b, c }
2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }
Observation: | 2S | = 2|S| ( 8 = 23 )
![Page 14: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/14.jpg)
Cartesian ProductA = { 2, 4 } B = { 2, 3, 5 }
A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 4) }
|A X B| = |A| |B|
Generalizes to more than two sets
A X B X … X Z
![Page 15: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/15.jpg)
RELATIONS R = {(x1, y1), (x2, y2), (x3, y3), …}
xi R yi
e. g. if R = ‘>’: 2 > 1, 3 > 2, 3 > 1
In relations xi can be repeated
![Page 16: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/16.jpg)
Equivalence Relations
• Reflexive: x R x
• Symmetric: x R y y R x
• Transitive: x R Y and y R z x R z
Example: R = ‘=‘
• x = x
• x = y y = x
• x = y and y = z x = z
![Page 17: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/17.jpg)
Equivalence ClassesFor equivalence relation R
equivalence class of x = {y : x R y}
Example:
R = { (1, 1), (2, 2), (1, 2), (2, 1),
(3, 3), (4, 4), (3, 4), (4, 3) }
Equivalence class of 1 = {1, 2}
Equivalence class of 3 = {3, 4}
![Page 18: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/18.jpg)
Example of Equivalence relation
Let Z = set of integers
R be defined on it as:
R= {(x,y)| x Z, y Z and
(x - y)is divisible by 5}
This relation is known as
” congruent modulo 5”
![Page 19: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/19.jpg)
The equivalence classes are
[0]R= {…-10, -5, 0, 5,10,…}
[1]R = {…..,-9, -4, 1, 6, 11, 16….}
[2]R= {….-8, -3,2,7,12,17…..}
[3]R = {….-7, -2, 3, 8 ,13,…}
[4]R = {….-6,-1,4,9,14,19,….}
Z/R ={[0]R, [1]R, [2]R, [3]R, [4]R}
![Page 20: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/20.jpg)
PROOF TECHNIQUES
• Proof by induction
• Proof by contradiction
![Page 21: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/21.jpg)
Induction
We have statements P1, P2, P3, …
If we know
• for some k that P1, P2, …, Pk are true
• for any n >= k that
P1, P2, …, Pn imply Pn+1
Then
Every Pi is true
![Page 22: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/22.jpg)
Treesroot
leaf
parent
child
Trees have no cycles
![Page 23: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/23.jpg)
Proof by Induction• Inductive basis
Find P1, P2, …, Pk which are true
• Inductive hypothesis
Let’s assume P1, P2, …, Pn are true,
for any n >= k
• Inductive step
Show that Pn+1 is true
![Page 24: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/24.jpg)
root
leaf
Level 0
Level 1
Level 2
Level 3
Height 3
![Page 25: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/25.jpg)
Binary Trees
![Page 26: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/26.jpg)
Example
Theorem: A binary tree of height n
has at most 2n leaves.
Proof:
let l(i) be the number of leaves at level i
l(0) = 0
l(3) = 8
![Page 27: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/27.jpg)
Induction Step
hypothesis: l(n) <= 2n
Level
n
n+1
![Page 28: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/28.jpg)
We want to show: l(i) <= 2i
• Inductive basis
l(0) = 1 (the root node)
• Inductive hypothesis
Let’s assume l(i) <= 2i for all i = 0, 1, …, n
• Induction step
we need to show that l(n + 1) <= 2n+1
![Page 29: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/29.jpg)
hypothesis: l(n) <= 2n
Level
n
n+1
l(n+1) <= 2 * l(n) <= 2 * 2n = 2n+1
Induction Step
![Page 30: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/30.jpg)
Proof by Contradiction
We want to prove that a statement P is true
• we assume that P is false
• then we arrive at an incorrect conclusion
• therefore, statement P must be true
![Page 31: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/31.jpg)
Example
Theorem: is not rational
Proof:
Assume by contradiction that it is rational
= n/m
n and m have no common factors
We will show that this is impossible
2
2
![Page 32: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/32.jpg)
= n/m 2 m2 = n2
Therefore, n2 is evenn is even
n = 2 k
2 m2 = 4k2 m2 = 2k2m is even
m = 2 p
Thus, m and n have common factor 2
Contradiction!
2
![Page 33: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/33.jpg)
Basic Terms
Alphabet: A finite non empty set of elements.
={a,b,c,d,…z}
![Page 34: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/34.jpg)
• String: A sequence of letters
– Examples: “cat”, “dog”, “house”, …
– Defined over an alphabet:
zcba ,,,,
Language: It is a set of strings on some alphabet
![Page 35: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/35.jpg)
Alphabets and Strings
• We will use small alphabets:
• Strings
abbaw
bbbaaav
abu
ba,
baaabbbaaba
baba
abba
ab
a
![Page 36: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/36.jpg)
String Operations
m
n
bbbv
aaaw
21
21
bbbaaa
abba
mn bbbaaawv 2121
Concatenation
abbabbbaaa
![Page 37: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/37.jpg)
12aaaw nR
naaaw 21 ababaaabbb
Reverse
bbbaaababa
![Page 38: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/38.jpg)
String Length
• Length:
• Examples:
naaaw 21
nw
1
2
4
a
aa
abba
![Page 39: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/39.jpg)
Recursive Definition of Length
For any letter:
For any string :
Example:
1a
1wwawa
4
1111
111
11
1
a
ab
abbabba
![Page 40: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/40.jpg)
Length of Concatenation
• Example:
vuuv
853
8
5,
3,
vuuv
aababaabuv
vabaabv
uaabu
![Page 41: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/41.jpg)
Proof of Concatenation Length
• Claim:
• Proof: By induction on the length
– Induction basis:– From definition of length:
vuuv v
1v
vuuuv 1
![Page 42: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/42.jpg)
– Inductive hypothesis:
• for
– Inductive step: we will prove–
– for
vuuv
nv ,,2,1
1nv
vuuv
![Page 43: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/43.jpg)
Inductive Step
• Write , where
• From definition of length:
• From inductive hypothesis:
• Thus:
wav 1, anw
1
1
wwa
uwuwauv
wuuw
vuwauwuuv 1
![Page 44: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/44.jpg)
Empty String
• A string with no letters:
• Observations:
abbaabbaabba
www
0
![Page 45: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/45.jpg)
Substring
• Substring of string:
– a subsequence of consecutive characters
• String Substring
bbab
b
abba
ab
abbab
abbab
abbab
abbab
![Page 46: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/46.jpg)
Prefix and Suffix
• Prefixes Suffixesabbab
abbab
abba
abb
ab
a
b
ab
bab
bbab
abbabuvw
prefix
suffix
![Page 47: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/47.jpg)
Another Operation
• Example:
• Definition:–
n
n wwww
abbaabbaabba 2
0w
0abba
![Page 48: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/48.jpg)
The * Operation
• : the set of all possible strings from• alphabet
•
*
,,,,,,,,,*
,
aabaaabbbaabaaba
ba
![Page 49: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/49.jpg)
The + Operation : the set of all possible strings from alphabet except
,,,,,,,,,*
,
aabaaabbbaabaaba
ba
*
,,,,,,,, aabaaabbbaabaaba
![Page 50: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/50.jpg)
Language
• A language is any subset of
• Example:
• Languages:
* ,,,,,,,,*
,
aaabbbaabaaba
ba
},,,,,{
,,
aaaaaaabaababaabba
aabaaa
![Page 51: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/51.jpg)
Another Example
• An infinite language
}0:{ nbaL nn
aaaaabbbbb
aabb
ab
L Labb
![Page 52: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/52.jpg)
Operations on Languages
• The usual set operations
• Complement:
aaaaaabbbaaaaaba
ababbbaaaaaba
aaaabbabaabbbaaaaaba
,,,,
}{,,,
},,,{,,,
LL * ,,,,,,, aaabbabaabbaa
![Page 53: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/53.jpg)
Reverse
• Definition:
• Examples:
}:{ LwwL RR
ababbaabababaaabab R ,,,,
}0:{
}0:{
nabL
nbaL
nnR
nn
![Page 54: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/54.jpg)
Concatenation
• Definition:
• Example:
2121 ,: LyLxxyLL
baaabababaaabbaaaab
aabbaaba
,,,,,
,,,
![Page 55: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/55.jpg)
Another Operation
• Definition:
• Special case:
n
n LLLL
bbbbbababbaaabbabaaabaaa
babababa
,,,,,,,
,,,, 3
0
0
,, aaabbaa
L
![Page 56: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/56.jpg)
More Examples
• }0:{ nbaL nn
}0,:{2 mnbabaL mmnn
2Laabbaaabbb
![Page 57: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/57.jpg)
Star-Closure (Kleene *)
• Definition:
• Example:
•
210* LLLL
,,,,
,,,,
,,
,
*,
abbbbabbaaabbaaa
bbbbbbaabbaa
bbabba
![Page 58: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/58.jpg)
Positive Closure
• Definition:
*
21
L
LLL
,,,,
,,,,
,,
,
abbbbabbaaabbaaa
bbbbbbaabbaa
bba
bba
![Page 59: Finite automata intro](https://reader033.vdocuments.net/reader033/viewer/2022050804/548cad84b4795996718b45d6/html5/thumbnails/59.jpg)
Finite AutomatonInput
String
•
Output
String
FiniteAutomaton