8. Finite Automata
0 1
0
1
q1 q2 q3
0,1
A finite automaton called M1 that has three states
The start state is q1
The accept state is q2
The arrows going from one state to another are
called transitions
The output is either accept or reject.
8
9. Finite Automata
0 1
0
1
q1 q2 q3
0,1
“1101”,
1. Start in state q1.
2. Read 1, follow transition from q1 to q2.
3. Read 1, follow transition from q2 to q2.
4. Read 0, follow transition from q2 to q3.
5. Read 1, follow transition from q3 to q2.
6. Accept because M1 is in an accept state q2 at the end of the input.
9
12. Formal Definition
formal definition finite automaton
5
set of state
input alphabet
rules for moving
start state
accept states
12
13. Formal Definition
A finite automaton is a 5-tuple (Q, Σ, δ, q0, F),
where
1. Q is a finite set called the states,
2. Σ is a finite set called the alphabet,
3. δ : Q x Σ → Q is the transition function,
4. q0 ∈ Q is the start state, and
5. F ⊆ Q is the set of accept states.
13
14. Formal Definition
0 1
0
1
q1 q2 q3
0,1
We can describe M1 formally by writing M1 = (Q, Σ, δ, q1, F), where
Q = { q1, q2, q3 }
Σ = { 0, 1 } 0 1
δ is described as q1 q1 q2 δ(q1,0) = q1 δ(q1,1) = q2
q2 q3 q2 δ(q2,0) = q3 δ(q2,1) = q2
q3 q2 q2 δ(q3,0) = q2 δ(q3,1) = q2
q1 is the start state, and
F = { q2 }.
14
15. Formal Definition
A M
, A M
L(M) = A
M recognizes A M accepts A.
,
,
(empty language ∅)
15
16. Extended Transition Function
δ : Q x Σ → Q is the transition function
δ(q, a) = “the state to which the machine M
goes if it is in state q and receives input symbol
a”
δ*: Q x Σ* → Q is the extended transition function
δ*(q, w) = “the state in which M ends up, if it
begin in state q, and receives the string w of
several symbols”
16
18. Extended Transition Function
Definition: Let M = (Q, Σ, δ, q0, F) be a DFA.
Define the function
δ*: Q x Σ* → Q
recursively as follows.
When q ∈ Q, w ∈ Σ*, and a ∈ Σ,
1. δ*(q, ε) = q
2. δ*(q, wa) = δ(δ*(q, w), a)
18
21. Formal Definition of Computation
Let M = (Q, Σ, δ, q0, F) be a finite automaton
Let w = w1w2…wn be a string where each wi is a
member of the alphabet Σ.
Then M accepts w if δ*(q0, w) ∈ F.
We say that M recognizes language A if
A = {w I M accepts w }.
A language is called a regular language if some
finite automaton recognizes it.
21
29. The Regular Operations
Definition
Let A and B be languages. We define the regular
operations union, concatenation, and star as
follows.
Union: A ∪ B = {x | x ∈ A or x ∈ B}
Concatenation: A○B = {xy | x ∈ A and y ∈ B}
Star: A* = {x1x2…xk | k ≥ 0 and each xi ∈ A}.
29
30. (alphabet) Σ
26 {a, b,..., z}.
A = {good, bad} B = {boy, girl}, then
A ∪ B = {good, bad, boy, girl}
A ○ B = {goodboy, goodgirl, badboy, badgirl}
A* = {ε, good, bad, goodgood, goodbad,
badgood, badbad, goodgoodgood,
goodgoodbad, goodbadgood, goodbadbad, ...}
30
35. The Regular Operations
Theorem
regular languages
concatenation
A1 A2 regular languages A1 ○ A2
regular
Proof Idea:
union
finite automata M1 M2 regular
languages A1 A 2.
35
42. FA
Procedure: mark
1.
2. (p, q) p∈F q∉
F mark (p, q) distinguishable
3. mark
(p, q) a ∈ Σ,
δ(p, a) = pa δ(q, a) = qa
(pa, qa) mark distinguishable
mark (p, q) distinguishable.
42
43. FA
mark Q
FA (disjoint
subsets)
:
Q = {0,1,2,3,4,5,6,7}
unmarked pairs = (1,2), (1,4), (2,4), (3,5),
(3,7), (5,7) ( )
disjoint subsets = {0}, {1,2,4}, {3,5,7}, {6}
43
44. FA
Procedure: reduce
FA M = (Q, Σ, δ, q0, F), FA
M' = (Q', Σ, δ', q'0, F')
1. mark
indistinguishable ( ).
2. M'
indistinguishable
q'124 {1,2,4}.
3. δ' (ij..k, a) = lm…n qr ∈ {qi,qj,…,qk} qp ∈
{ql,qm,…,qn} δ (qr, a) = qp.
4. q'0 M' 0
5. F' i qi ∈ F.
44