inherent limitations of computer programs
DESCRIPTION
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 }. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/1.jpg)
INHERENT LIMITATIONS OF COMPUTER PROGRAMS
CSci 4011
![Page 2: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/2.jpg)
THE REGULAR OPERATIONS
Union: A B = { w | w A or w B }
Intersection: A B = { w | w A and w B }
Negation: A = { w | w A }
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 }
![Page 3: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/3.jpg)
1 0
1
0 1
0,1
0
![Page 4: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/4.jpg)
NON-DETERMINISM1 0
1
0 1
0,1
0
An NFA accepts if there is a series of choices that take it to an accept state
![Page 5: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/5.jpg)
DeterministicComputation
Non-DeterministicComputation
accept or reject accept
reject
![Page 6: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/6.jpg)
Theorem: Every NFA has an equivalent DFA
Corollary: A language is regular iff it is recognized by an NFA
![Page 7: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/7.jpg)
FROM NFA TO DFAInput: N = (Q, Σ, , Q0, F)
Output: M = (Q, Σ, , q0, F)
accept
reject
To learn if NFA accepts, we could do the computation in parallel, maintaining the
set of states where all threads are
Q = 𝒫(Q)
Idea:
![Page 8: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/8.jpg)
(R,) = ε( (r,) )
Q = 𝒫(Q)
: Q Σ → Q
(R,) = ε( (r,) )rR
q0 = ε(Q0)
F = { R Q | f R for some f F }
FROM NFA TO DFAInput: N = (Q, Σ, , Q0, F)
Output: M = (Q, Σ, , q0, F)
(R,) = ε( (r,) )
![Page 9: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/9.jpg)
EXAMPLES: NFA TO DFA
1
0,1
ε 02 31
a b
1
![Page 10: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/10.jpg)
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
![Page 11: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/11.jpg)
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 }
Negation: A = { w | w A }
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 }
![Page 12: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/12.jpg)
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*
00,1
00
1
1
1
ε
ε
ε
![Page 13: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/13.jpg)
Formally:
Input: M = (Q, Σ, , q1, F)
Output: N = (Q, Σ, , {q0}, F)
Q = Q {q0}
F = F {q0}
(q,a) =
{(q,a)}
{q1}
{q1}
if q Q and a ≠ ε
if q F and a = ε
if q = q0 and a = ε
if q = q0 and a ≠ ε
else
![Page 14: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/14.jpg)
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
![Page 15: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/15.jpg)
Assume w is accepted by N, we show w L*
If w = ε, then w L*
If w ≠ ε
accept
ε
ε
![Page 16: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/16.jpg)
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 }
Negation: A = { w | w A }
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 }
![Page 17: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/17.jpg)
REGULAR EXPRESSIONS
![Page 18: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/18.jpg)
REGULAR EXPRESSIONS
s 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 L1L2
(R1 R2) represents L1 L2
(R1)* represents L1*
![Page 19: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/19.jpg)
PRECEDENCE
*
![Page 20: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/20.jpg)
R2R1*(
EXAMPLE
R1*R2 R3 = ( ) ) R3
![Page 21: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/21.jpg)
{ w | w has exactly a single 1 }
0*10*
![Page 22: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/22.jpg)
{ w | w has length ≥ 3 and its 3rd symbol is 0 }
000(01)* 010(01)* 100(01)* 110(01)*
![Page 23: INHERENT LIMITATIONS OF COMPUTER PROGRAMS](https://reader036.vdocuments.net/reader036/viewer/2022062314/568143a7550346895db02d40/html5/thumbnails/23.jpg)
{ w | every odd position of w is a 1 }