Documente Academic
Documente Profesional
Documente Cultură
Handout Mode
Iftach Haitner.
Tel Aviv University.
Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.
Iftach Haitner (TAU)
1 / 41
Talk Outline
I
Regular operations
2 / 41
Part I
Languages, words and alphabets
3 / 41
Definition 2
A word (i.e., string) over , is a finite sequence of letters from .
The collection of all strings over is denoted by .
For {0, 1}, the binary alphabet, , 1, 0, 000000000, 1111111000 are all
members of .
Definition 3
A language over is a (possibly infinite) subset of .
Iftach Haitner (TAU)
4 / 41
Language Examples
I
Modern English.
Ancient Greek.
B = {0n 1n : n 0}.
Make sure you understand what the above notions stand for...
5 / 41
Part II
Finite Automata
6 / 41
front
pad
rear
pad
door
I
7 / 41
FRONT
closed
FRONT
REAR
BOTH
open
NEITHER
I
States:
I
I
OPEN
CLOSED
Sensor:
I
I
I
I
8 / 41
REAR
BOTH
NEITHER
FRONT
closed
FRONT
REAR
BOTH
open
NEITHER
closed
open
neither
closed
closed
front
open
open
rear
closed
open
both
closed
open
9 / 41
q1
q
2
q3
0,1
States: q1 , q2 , and q3 .
10 / 41
q
2
q1
q3
0,1
On an input string
I
I
11 / 41
q
2
q3
0,1
1101
0010
01100
In general?!
12 / 41
q
2
q3
0,1
All input strings that contain at least one 1, and end with an even
number of 0s
No other strings
Proof: ?
13 / 41
14 / 41
Back to M1
0
q1
q
2
q3
0,1
M1 = (Q, , , q1 , F ) where
I
F = {q2 }.
q1
q2
q3
0
q1
q3
q2
1
q2
q2
q2
15 / 41
Another Example
s
a
q
1
b
r
q
2
r2
16 / 41
I
I
17 / 41
An equivalent definition
Definition 7 (Equivalent definition)
M = (Q, , , q0 , F ) accepts w = w1 w2 . . . wn , if r0 , . . . , rn Q s.t.,
I
r0 = q0 .
rn F .
18 / 41
19 / 41
Example: DFA M2
I
I
Theorem 10
L(M2 ) = {w {0, 1} : #1 (w) is odd}.
w.
I
I
20 / 41
b 1 , ) = q1 =
and (q
/ L(M2 ).
(hence, |y | = j).
= 1 =
1. #1 (x) is odd = x L0
b 1 , x) := ((q
b 1 , y ), ) = (q1 , 1) = q2 = x L(M2 ).
2. (q
= 0 =
1. #1 (x) is even = x
/ L0
b
b
2. (q1 , x) := ((q1 , y ), ) = (q1 , 0) = q1 = x
/ L(M2 ).
I
I
If #1 (y ) is odd...
We proved for x {0, 1}j+1 :
Iftach Haitner (TAU)
x L(M2 ) x L0
21 / 41
The language of M1
0
q
2
q1
q3
0,1
Theorem 11
L(M1 ) = {w102k : k 0, w {0, 1} }
Proof:
Claim 12 (implies the theorem)
b 1 , x) = qi } and let
Let L0i = {x {0, 1} : (q
I
L1 = {0k : k 0}
L2 = {w102k : k 0, w {0, 1} }
L3 = {w102k +1 : k 0, w {0, 1} }
22 / 41
Proving Claim 12
We need to prove that i {1, 2, 3}:
x Li x L0i .
Recall that
b
x L0i (x)
= qi
23 / 41
L1 = {0k : k 0}
Recall x = y {0, 1}j+1 for {0, 1}.
b 1 , x) = q1
Proving: x L1 = (q
( = x L01 ).
x = 0j+1 , y = 0j and = 0.
b 1 , y ) = q1
Since y L1 , by i.h. (q
b 1 , x) = ((q,
b y ), ) = (q1 , 0) = q1 .
Therefore, (q
b 1 , x) = q1 = x L1 .
Proving: (q
I
b 1, y )
Let qy = (q
qy = q1 and = 0. (?)
By i.h. y = 0j .
Hence, x = y = 0j 0 = 0j+1 L1 .
b 1 , x) = (qy , ) = q1 )
(hence, (q
24 / 41
L2 = {w102k : k 0, w {0, 1} }
Recall x = y {0, 1}j+1 for {0, 1}.
b 1 , x) = q2 .
Proving x L2 = (q
I
Assume = 1
I
b 1 , x) = q2 .
Since (qi , 1) = q2 for any i = (q
( = y = w102k 1 and = 0)
Hence, y L3 .
b 1 , y ) = q3
By i.h. (q
b 1 , x) = (q3 , 0) = q2 .
Thus, (q
b 1 , x) = q2 = x L2 .
Proving (q
I
I
Assume = 1 = x L2 . (?)
Assume = 0
I
I
I
b 1 , y ) = q3
qy := (q
By i.h. y = w102k +1 for some k 0
Therefore x = y = w102k +1 0 L2 .
25 / 41
L3 = {w102k +1 : k 0, w {0, 1} }
Recall x = y {0, 1}j+1 for {0, 1}.
b 1 , x) = q3 .
Proving x L3 = (q
I
y L2
b 1 , y ) = q2 .
By i.h. (q
b 1 , x) = (q2 , 0) = q3 .
Therefore, (q
b 1 , x) = q3 = x L3 .
Proving (q
I
b 1, y )
Let qy = (q
By i.h. y = w102k
Therefore, x = y = w102k 0 L3 .
26 / 41
Part III
Regular Operations
27 / 41
28 / 41
29 / 41
30 / 41
31 / 41
M1 = (Q1 , , 1 , q1 , F1 ) accepts L1 ,
M2 = (Q2 , , 2 , q2 , F2 ) accepts L2 .
Q = Q1 Q2 .
is the same.
q0 = (q1 , q2 )
F = {(r1 , r2 ) : r1 F1 or r2 F2 }.
32 / 41
x L(M1 ) = b1 (q1 , x) = r1 F1 .
(similar if x L(M2 ).)
By Claim 15, bM ((q1 , q2 ), x) = (r1 , ) F = x L(M).
x L(M) = bM ((q1 , q2 ), x) = (r1 , r2 ) F .
By Claim 15, (r1 , r2 ) = (b1 (q1 , x), b2 (q2 , x)).
Hence, either r1 F1 or r2 F2 = x L(M1 ) L(M2 ).
Iftach Haitner (TAU)
33 / 41
34 / 41
Part IV
Non-deterministic Finite Automata
35 / 41
q1
0,1
q
2
q3
q
4
May have more than one transition labeled with the same symbol,
36 / 41
Non-deterministic computation
0,1
q1
0,1
q
2
q3
q
4
37 / 41
Computation on 1001
0,1
q1
0,1
q
2
q3
q
4
symbol
1
q1
q1
q1
q1
q
2
q
2
q3
q
4
q1
38 / 41
Why non-determinism?
Theorem 17 (Informal, to be proved soon)
Deterministic and non-deterministic finite automata, accept exactly the
same set of languages.
Q.: So why do we need NFAs?
Design a finite automaton for the language L all binary strings with
a 1 in their third-to-the-last position?
39 / 41
NFA for L
0,1
q1
q
2
0,1
q3
0,1
q
4
40 / 41
DFA for L
I
q
000
q001
0
0
q
100
q101
q
010
q
110
q011
q111
1
41 / 41