lec 02 non deterministic finite automata
play

Lec 02. Non-deterministic Finite Automata Eunjung Kim N - PowerPoint PPT Presentation

C OMPUTABILITY AND C OMPLEXITY , 2020 F ALL SEMESTER Lec 02. Non-deterministic Finite Automata Eunjung Kim N ONDETERMINISM Figure 1.27, Sipser 2012. Deterministic FA Nondeterministic FA each state & symbol one leaving arc multiple arcs


  1. C OMPUTABILITY AND C OMPLEXITY , 2020 F ALL SEMESTER Lec 02. Non-deterministic Finite Automata Eunjung Kim

  2. N ONDETERMINISM Figure 1.27, Sipser 2012. Deterministic FA Nondeterministic FA each state & symbol one leaving arc multiple arcs or none labels Σ Σ ∪ { ǫ } computation history single path multiple paths COMPUTABILITY & COMPLEXITY 1 / 15

  3. N ONDETERMINISM : COMPUTATION TREE AND ǫ Figure 1.27, Sipser 2012. COMPUTABILITY & COMPLEXITY 2 / 15

  4. E XAMPLES OF NFA Figure 1.31, Sipser 2012. Figure 1.32, Sipser 2012. COMPUTABILITY & COMPLEXITY 3 / 15

  5. E XAMPLES OF NFA Figure 1.33, Sipser 2012. Figure 1.36, Sipser 2012. COMPUTABILITY & COMPLEXITY 4 / 15

  6. F ORMAL DEFINITION OF NFA N ONDETERMINISTIC FA IS A 5- TUPLE ( Q , Σ , δ , q 0 , F ) Q a finite set called the states, Σ a finite set called the alphabet, δ a function from Q × Σ ǫ to 2 Q called the transition function, q 0 ∈ Q the start state, F ⊆ Q the set of accept states. Write a formal description of this NFA. COMPUTABILITY & COMPLEXITY 5 / 15

  7. L ANGUAGE RECOGNIZED BY NFA NFA N ACCEPTS w IF 1 w can be written as y 1 , . . . , y m with y i ∈ Σ ǫ , 2 there exists a computation path ending in an accept state. Write an accepting computation path for w = baaabaaaa . Is there another one? COMPUTABILITY & COMPLEXITY 6 / 15

  8. C LOSURE UNDER REGULAR OPERATION U NION OPERATION Let A 1 and A 2 be two languages recognized by NFA N 1 and N 2 respectively. Then A 1 ∪ A 2 is recognized by some NFA. COMPUTABILITY & COMPLEXITY 7 / 15

  9. C LOSURE UNDER REGULAR OPERATION C ONCATENATION OPERATION Let A 1 and A 2 be two languages recognized by NFA N 1 and N 2 respectively. Then A 1 ◦ A 2 is recognized by some NFA. COMPUTABILITY & COMPLEXITY 8 / 15

  10. C LOSURE UNDER REGULAR OPERATION K LEENE STAR OPERATION Let A a languages recognized by NFA N . Then A ∗ is recognized by some NFA. COMPUTABILITY & COMPLEXITY 9 / 15

  11. C LOSURE UNDER COMPLEMENTATION C OMPLEMENTATION OPERATION A , that is, Σ ∗ − A is Then ¯ Let A a languages recognized by NFA N . recognized by some NFA. COMPUTABILITY & COMPLEXITY 10 / 15

  12. C LOSURE UNDER INTERSECTION I NTERSECTION OPERATION Let A 1 and A 2 be two languages recognized by NFA N 1 and N 2 respectively. Then A 1 ∩ A 2 is recognized by some NFA. COMPUTABILITY & COMPLEXITY 11 / 15

  13. E QUIVALENCE OF NFA AND DFA NFA AND DFA OWN THE SAME COMPUTATIONAL POWER For every NFA, there exists a deterministic finite automata recognizing the same language. Proof outline. Let N = ( Q , Σ , δ , q 0 , F ) be an NFA. We want to construct a DFA M = ( Q ′ , Σ , δ ′ , q ′ 0 , F ′ ) such that L ( N ) = L ( M ) . Define Q ′ := 2 Q , i.e. the family of all subsets of Q . 0 ∈ 2 Q and F ′ ⊆ 2 Q , We shall define δ ′ , q ′ ...and for any w ∈ L ( N ) with an accepting computation history π in N , we demonstrate an accepting computation history π ′ in M . ... and conversely, for any w with an accepting computation history π ′ in M , we build an accepting computation history π in N . COMPUTABILITY & COMPLEXITY 12 / 15

  14. P ROOF : CONSTRUCTING DFA M Idea: from a state q ∈ Q of NFA N , any other state q ′ that can be reached by reading a string of k ǫ ’s, k ≥ 0,can be aggregated with q as a single state. Define ext ( q ) ⊆ N as the set of all states q ′ of N such that there is a directed path from q to q ′ in (the state diagram of) N each of whose arcs carries the label ǫ . Extend the definition ext ( X ) := � q ∈ X ext ( q ) . transition function δ ′ from 2 Q × Σ to 2 Q : for every R ∈ 2 Q ( R is a subset of Q ) and every symbol a ∈ Σ , � δ ′ ( R , a ) := ext ( δ ( r , a )) r ∈ R 0 := ext ( q 0 ) ∈ 2 Q . Note that q ′ Define q ′ 0 corresponds to a subset of Q . Define F ′ ∈ 2 Q as the family of all subsets of Q containing at least one accept state of N . COMPUTABILITY & COMPLEXITY 13 / 15

  15. P ROOF : L ( N ) ⊆ L ( M ) Let π = ( q 0 , w = w 0 ) , . . . , ( q i , w i ) , . . . , ( q s , w s = ǫ ) be an accepting computation history of N for w , that is q i ∈ δ ( q i − 1 , a i ) for every i ∈ [ s ] and q s ∈ F , where w i = a i ◦ w i − 1 with a i ∈ Σ ∪ { ǫ } for every i ∈ [ s ] . Let 0 ≤ i 0 < · · · < i t − 1 < s be the indices in π such that the leading symbol of w i in ( q i , w i ) is in Σ (not ǫ ). Let i t = s . Let Q 0 = q ′ 0 . Inductively for each i ∈ [ t ] , let Q i = δ ′ ( Q i − 1 , y i ) . Now we have a computation history for w = y 1 · · · y t as follows π ′ = ( Q 0 , w ) , ( Q 1 , y 2 · · · y t ) , · · · ( Q t , ǫ ) . COMPUTABILITY & COMPLEXITY 14 / 15

  16. P ROOF : L ( N ) ⊆ L ( M ) It remains to see Q t is an accept state of M , i.e. the subset Q t ⊆ Q contains at least one accept state of N . It suffices to prove q i j ∈ Q j for each 0 ≤ j ≤ t (this implies the above). By induction. Base case holds because Q 0 = q ′ 0 = ext ( q 0 ) and q i 0 is reachable from q 0 by reading a number of ǫ ’s. From the partition using i 0 , . . . , i t , q i j is reachable from q i j − 1 by reading a single symbol a i j − 1 + 1 ∈ Σ and additional ǫ ’s. Hence q i j ∈ ext ( δ ( q i j − 1 , a i j − 1 + 1 ) ⊆ ext ( δ ( Q j − 1 , a i j − 1 + 1 ) = δ ′ ( Q j − 1 , a i j − 1 + 1 ) = Q j . COMPUTABILITY & COMPLEXITY 15 / 15

  17. P ROOF : L ( M ) ⊆ L ( N ) Let π ′ = ( Q 0 , w = w 0 ) , . . . , ( Q i , w i ) , . . . , ( Q t , w t = ǫ ) be an accepting computation history of M for w . By definition of computation history Q i = δ ′ ( Q i − 1 , x i ) , where x i ∈ Σ is the leading symbol of w i − 1 . We construct an accepting computation history of N by following the sequence π ′ backwardly. Let q f ∈ Q t be an accept state of N . Observe: for each q ∈ Q i ⊆ Q , there exists a state q ′ ∈ Q i − 1 such that from q ′ to q there is a computation history consisting of readying a string consisting of x i followed by ǫ ’s. Now starting from q f , we concatenate computation histories witnessed by the previous observation. COMPUTABILITY & COMPLEXITY 16 / 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend