• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Finite automata
 

Finite automata

on

  • 1,648 views

 

Statistics

Views

Total Views
1,648
Views on SlideShare
1,631
Embed Views
17

Actions

Likes
0
Downloads
41
Comments
0

1 Embed 17

http://kunew.wikispaces.com 17

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Finite automata Finite automata Presentation Transcript

    • Finite Automata .Source: Chapter 1.1 - Introduction to the Theory of Computation by Michael Sipser 1
    • ? :? ? (computational model). finite state machine finite automaton. 2
    • Finite Automata finite automata ? - 3
    • (1) front rear pad pad door2OPEN CLOSED ( ) 4FRONT, REAR, BOTH, NEITHER 4
    • (2) FRONT REAR FRONT BOTH CLOSED OPEN REARNETHER BOTH NETHER NETHER FRONT REAR BOTH CLOSED CLOSED OPEN CLOSED CLOSED OPEN CLOSED OPEN OPEN OPEN 5
    • (3)( ) 6
    • Finite Automata finite automata finite automata 7
    • 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
    • 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
    • Finite Automata 0 1 0 1 q1 q2 q3 0,1 strings M1 ? 1,01,11, and 0101010101. 100, 0100, 110000, and 0101000000. 10
    • Formal Definition state diagrams , (formal definition) formal definition finite automata formal definition (notation) . 11
    • Formal Definition formal definition finite automaton 5 set of state input alphabet rules for moving start state accept states 12
    • Formal DefinitionA finite automaton is a 5-tuple (Q, Σ, δ, q0, F), where1. 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, and5. F ⊆ Q is the set of accept states. 13
    • 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
    • Formal Definition A M , A M L(M) = A M recognizes A M accepts A. , , (empty language ∅) 15
    • 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
    • Extended Transition Function : δ*(q0,w) = q6 a b a q0 …….. q6 w = ab…a 17
    • Extended Transition FunctionDefinition: Let M = (Q, Σ, δ, q0, F) be a DFA. Define the function δ*: Q x Σ* → Qrecursively as follows.When q ∈ Q, w ∈ Σ*, and a ∈ Σ, 1. δ*(q, ε) = q 2. δ*(q, wa) = δ(δ*(q, w), a) 18
    • Extended Transition Function 0 1 0 1 q1 q2 q3 0,1δ*(q1,010) δ*(q1, 010) = δ(δ*(q1,01), 0) δ*(q1, 01) = δ(δ*(q1,0), 1) δ*(q1,0) = δ(δ*(q1,ε), 0) δ*(q1,ε) = q1 19
    • Formal Definition of Computation FA FA 20
    • 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
    • Finite Automata automata automata ☺ automata"reader as automaton" method 22
    • (1)alphabet {0, 1} FA 1 ? 1 23
    • Example (2) qeven qodd 24
    • Example (3) 1 0 25
    • Example (3) 0 1 0 qeven qodd 1 26
    • Example (4) 0 ( ε) 27
    • Example (5) 0 1 0 qeven qodd 1 28
    • The Regular OperationsDefinition 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
    • (alphabet) Σ 26 {a, b,..., z}. A = {good, bad} B = {boy, girl}, thenA ∪ B = {good, bad, boy, girl}A ○ B = {goodboy, goodgirl, badboy, badgirl}A* = {ε, good, bad, goodgood, goodbad,badgood, badbad, goodgoodgood,goodgoodbad, goodbadgood, goodbadbad, ...} 30
    • The Regular Operations (closed) regular languages regular operations 31
    • The Regular OperationsTheorem regular languages union A1 A2 regular languages, A1 ∪ A2 regular languagesProof Idea: A1 A2 regular finite automaton M1 A1 finite automaton M2 A2 finite automaton M A1 ∪ A2 M M1 M2 32
    • The Regular OperationsProof Idea ( ): M M1 M2 M M1 M2 M1 M2 (M1 x M2) M M1 M2 M M1 M2 33 46: Introduction to the Theory of Computation
    • 0 1 1 0M1 M2 1 0 q0 q1 q0 q1 0 1 0 1 M1 ∪ M2 0 1 q0 q0 q1 0 q0 q1 q0 q1 q0 q1 q1 q1 q0 0 0 q01 q00 1 0 q11 1 1 q10 34 1
    • 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
    • The Regular Operations Proof Idea: (cont.) M 2 M1 M2 nondeterminism. 36
    • FAFA FA 0,1 1 M2 0 q1 q3 0 0,1 M1 0,1 1q0 0 q0 q1 q2 0,1 0 1 1 1 q2 q4 q5 M1 M2 37
    • FA : p q FAindistinguishable δ*(p, w) ∈ F implies δ*(q, w) ∈ F δ*(p, w) ∉ F implies δ*(q, w) ∉ F for all w ∈ Σ*. 38
    • FA w ∈ Σ* δ*(p, w) ∈ F δ*(q, w) ∉ F, p qdistinguishable w indistinguishable u p w v w δ*(p, w) ∈ F implies δ*(q, w) ∈ F q 39
    • FAIndistinguishability equivalence relations: 1. p R p 2. if p R q then q R p 3. if p R q then q R r then p R r 40
    • FA FA indistinguishabledistinguishable 41
    • FAProcedure: 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
    • FA mark Q FA (disjointsubsets) :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
    • FAProcedure: reduce FA M = (Q, Σ, δ, q0, F), FA M = (Q, Σ, δ, q0, F)1. mark indistinguishable ( ).2. M indistinguishable q124 {1,2,4}.3. δ (ij..k, a) = lm…n qr ∈ {qi,qj,…,qk} qp ∈ {ql,qm,…,qn} δ (qr, a) = qp.4. q0 M 05. F i qi ∈ F. 44
    • FA q1 1 0 0 0 0,1 1q0 q2 q4 0 1 j 1 q3 q1 q2mark q4 q3 q4 1 1 1 1 1: (q0,q4), (q1,q4), (q2,q4), (q3,q4) q0 q1 q2 q3 i 45
    • FA 0 1 marked q0 q1 q3 (q0,q4) q1 q2 q4 (q1,q4) q1 (q2,q4) 1 q2 q1 q4 0 (q3,q4) 0 0 0,1 q3 q2 q4 1q0 q2 q4 q4 q4 q4 → (q0,q4), (q2,q4) 0 1 j 1 q3 q1 q2 q3 q4 1 1 1 1 q0 q1 q2 q3 i 46
    • FA 0 1 marked q0 q1 q3 (q0,q4) q1 q2 q4 (q1,q4) q1 (q2,q4) 1 q2 q1 q4 0 (q3,q4) 0 0 0,1 q3 q2 q4 1q0 q2 q4 q4 q4 q4 → (q1,q4), (q3,q4) 0 1 j 1 q3 q1 q2 q3 q4 1 1 1 1 2: (q0,q1), (q0,q2), (q0,q3) q0 q1 q2 q3 i 47
    • FA 0 1 marked q0 q1 q3 (q0,q4) q1 q2 q4 (q1,q4) q1 (q2,q4) 1 q2 q1 q4 0 (q3,q4) 0 0 0,1 q3 q2 q4 1q0 q2 q4 q4 q4 q4 → (q0,q1), (q0,q2), (q0,q3), (q0,q4) 0 1 j 1 q3 q1 2 q2 2 q3 2 q4 1 1 1 1 2: (q0,q1), (q0,q2), (q0,q3) q0 q1 q2 q3 i 48
    • FA 0 1 q0 q1 q3 q1 q2 q4 q1 1 q2 q1 q4 0 0 0 0,1 q3 q2 q4 1q0 q2 q4 q4 q4 q4 0 1 1 q3 q1 2 q2 2 x q3 2 x xUnmarked pairs = (q1,q2), (q1,q3), (q2,q3) q4 1 1 1 1 q0 q1 q2 q3 49
    • FAQ = {q0, q1, q2, q3, q4}Unmarked pairs = (q1,q2), (q1,q3), (q2,q3)The disjoint subsets = {q0}, {q1,q2,q3}, {q4} 0 1 0 0,1 q0 q1 q3 q1 q2 q4 0,1 1 q0 q123 q4 q2 q1 q4 q3 q2 q4 q4 q4 q4 50