1 / 23

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. THE REGULAR OPERATIONS. Negation:  A = { w | w  A }. Union: A  B = { w | w  A or w  B }. Intersection: A  B = { w | w  A and w  B }. Reverse: A R = { w 1 …w k | w k …w 1  A }.

gerik
Download Presentation

INHERENT LIMITATIONS OF COMPUTER PROGRAMS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS

  2. THE REGULAR OPERATIONS Negation: A = { w | w  A } Union: A  B = { w | w  A or w  B } Intersection: A  B = { w | w  A and w  B } Reverse: AR = { w1 …wk | wk …w1 A } Concatenation: A  B = { vw | v  A and w  B } Star: A* = { w1 …wk | k ≥ 0 and each wi A }

  3. 0,1 1 0 0 0 1 1

  4. NON-DETERMINISM 0,1 1 0 0 0 1 1 An NFA accepts if there is a series of choices that take it to an accept state

  5. Deterministic Computation Non-Deterministic Computation reject accept or reject accept

  6. Theorem: Every NFA has an equivalent DFA Corollary: A language is regular iff it is recognized by an NFA

  7. FROM NFA TO DFA Input: N = (Q, Σ, , Q0, F) Output: M = (Q, Σ, , q0, F) To learn if NFA accepts, we could do the computation in parallel, maintaining the set of states where all threads are reject Idea: Q = 𝒫(Q) accept

  8. FROM NFA TO DFA Input: N = (Q, Σ, , Q0, F) Output: M = (Q, Σ, , q0, F) Q = 𝒫(Q)  : Q Σ→ Q (R,) =  ε( (r,) ) (R,) =  ε( (r,) ) (R,) =  ε( (r,) ) rR q0 = ε(Q0) F = { R  Q | f  R for some f  F }

  9. EXAMPLES: NFA TO DFA 1 a b 0,1 ε 0 3 1 2 1

  10. REGULAR LANGUAGES CLOSED UNDER CONCATENATION Given DFAs M1 and M2, construct NFA by connecting all accept states in M1 to start states in M2 ε L(M1)=A L(M2)=B ε

  11. REGULAR LANGUAGES ARE CLOSED UNDER REGULAR OPERATIONS Union: A  B = { w | w  A or w  B } Intersection: A  B = { w | w  A and w  B } Reverse: AR = { w1 …wk | wk …w1 A } Negation: A = { w | w  A } Concatenation: A  B = { vw | v  A and w  B } Star: A* = { w1 …wk | k ≥ 0 and each wi A }

  12. 1 0 0,1 1 0 0 1 REGULAR LANGUAGES CLOSED UNDER STAR Let L be a regular language and M be a DFA for L We construct an NFA N that recognizes L* ε ε ε

  13. Formally: Input: M = (Q, Σ, , q1, F) Output: N = (Q, Σ, , {q0}, F) Q = Q  {q0} F = F  {q0} {(q,a)} if q  Q and a ≠ ε if q  F and a = ε {q1} if q = q0 and a = ε {q1} (q,a) = if q = q0 and a ≠ ε  else 

  14. L(N) = L* Assume w = w1…wk is in L*, where w1,…,wk L We show N accepts w by induction on k Base Cases: k = 0  k = 1  Inductive Step: Assume N accepts all strings v = v1…vk L*, and let u = u1…ukuk+1  L* Since N accepts u1…uk and M accepts uk+1, N must accept u

  15. Assume w is accepted by N, we show w  L* If w = ε, then w  L* If w ≠ε ε ε accept

  16. REGULAR LANGUAGES ARE CLOSED UNDER REGULAR OPERATIONS Union: A  B = { w | w  A or w  B } Intersection: A  B = { w | w  A and w  B } Reverse: AR = { w1 …wk | wk …w1 A } Negation: A = { w | w  A } Concatenation: A  B = { vw | v  A and w  B } Star: A* = { w1 …wk | k ≥ 0 and each wi A }

  17. REGULAR EXPRESSIONS

  18. REGULAR EXPRESSIONS • is a regular expression representing {} ε is a regular expression representing {ε}  is a regular expression representing  If R1 and R2 are regular expressions representing L1 and L2 then: (R1R2) represents L1L2 (R1  R2) represents L1 L2 (R1)* represents L1*

  19. PRECEDENCE * 

  20. EXAMPLE ( ( R1* ) R2 )  R3 R1*R2 R3 =

  21. { w | w has exactly a single 1 } 0*10*

  22. { w | w has length ≥ 3 and its 3rd symbol is 0 } 000(01)*  010(01)*  100(01)*  110(01)*

  23. { w | every odd position of w is a 1 }

More Related