Deterministic Finite Automata
Lecture 3
1
Deterministic Finite Automata Lecture 3 1 CS 374 Tips This - - PowerPoint PPT Presentation
Deterministic Finite Automata Lecture 3 1 CS 374 Tips This course moves pretty fast CS 374 expects you to already be completely comfortable with the basics: formal notation, definition and proofs (including induction) Be prepared to refresh
1
CS 374
CS 374 expects you to already be completely comfortable with the basics: formal notation, definition and proofs (including induction) Be prepared to refresh CS 173 material at home! There will often be more slides posted online than would actually be covered in class (e.g., worked out examples). Do review them. Review the notes posted online (before and/or after the lecture)
2
CS 374
3
CS 374
4
CS 374
next input symbol fed here
for the input so far finite writable memory (state)
next-state look-up table
5
CS 374
finite writable memory (state)
next input symbol fed here
for the input so far store x mod 3 here (initial value “null”).
it is 0.
next-state look-up table
calculate x’ mod 3 from x mod 3 and input bit b, where x’ = 2x + b
6
CS 374
next input symbol fed here
for the input so far store x mod 3 here (initial value 0).
it is 0.
next-state look-up table state (x mod 3)
start
null 1 1 2
7
calculate x’ mod 3 from x mod 3 and input bit b, where x’ = 2x + b input bit current state next state null 1 null 1 1 1 1 2 1 1 2 1 1 2 2
CS 374 state (x mod 3)
start
null 1 1 2 input bit current state next state null 1 null 1 1 1 1 2 1 1 2 1 1 2 2
1 1
1 2 null
1 1
8
CS 374
9
δ*(q,ε) = q δ*(q,au) = δ*(δ(q,a), u)
CS 374
10
1 1
1 2 null
1 1
δ*(q,ε) = q δ*(q,au) = δ*(δ(q,a), u)
CS 374
Theorem: δ*(q,uv) = δ*(δ*(q,u),v)# Proof: By induction on |u| Base case: |u|=0. δ*(q,uv) = δ*(q,v) and δ*(δ*(q,u),v) = δ*(δ*(q,ε),v) = δ*(q,v)# Induction: Let n > 0. Assume that the claim holds for all u, |u| < n (and all v, q). Consider any u, v, q, s.t. |u|=n. Let u=aw, where |w| = n-1 < n.
11
δ*(q,ε) = q δ*(q,au) = δ*(δ(q,a), u)
CS 374
12
CS 374
13
CS 374 Reject state
1 0,1 1 1 2 abbreviation B 1 A 2 B B B A 4 A 3 A B A
A AB ABB ABBA
1 3 1 2 1 1 1
0*11* (A+B)*ABBA
14
CS 374
Atomic expressions (Base cases)
Inductively defined expressions
15
16
CS 374
17
CS 374
18
00 01 10 11 ε 1 1 1 1 1 1 1 1
CS 374
19
01 10 1 1 1 1 ε 1 1
CS 374
1 1 0,1
20
1 ε 01 OK 11 1 1 1
State: longest suffix
valid prefix of pattern
CS 374
21
CS 374
next-state look-up table next-state look-up table
Mb = (Σ,Qb,sb,Fb,δb)
Proof by induction on |w|
22
CS 374
next-state look-up table next-state look-up table
Mb = (Σ,Qb,sb,Fb,δb)
23
CS 374
L(M1) : odd #0 L(M2) : odd #1
00 10 01 11 1 1 1 1 1 1
24
1 1 1 1
CS 374
L(M1) : odd #0 L(M2) : odd #1
00 10 01 11 1 1 1 1 1 1
25
1 1 1 1
L(M12) = L(M1) ∩ L(M2)
CS 374
L(M1) : odd #0 L(M2) : odd #1
00 10 01 11 1 1 1 1 1 1
26
1 1 1 1
L(M12) = L(M1) ∪ L(M2)
CS 374
27