Presentation is loading. Please wait.

Presentation is loading. Please wait.

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.

Similar presentations


Presentation on theme: "Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer."— Presentation transcript:

1 Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia

2 Hierarchy: So Far anbn bn abba wwR Regular Languages
Violates Pumping Lemma For CFLs anbn bn Violates Pumping Lemma For RLs abba Described by DFA, NFA, RegExp, wwR Described by CFG, NDPDA Described by DPDA finite Languages Regular Languages Deterministic Context-Free Context-Free Languages

3 Hierarchy: Next step Languages Recognized by any computing machine
Regular Languages Context-Free Languages finite Languages Deterministic Context-Free Problems solvable by humans?

4 PDA Enhancements c b c b $ $ a a b b c c
Theorem: 2-stack PDAs are more powerful than 1-stack PDAs. Hint: Find an example non-CFL accepted by a 2-stack PDA. a, ↓b, ↓c b, ↑b,- c, -,↑c c b ε, ↓$, ↓$ b, ↑b, - c,-,↑c ε, ↑$, ↑$ start a‘s b‘s c‘s end c b $ Input $ a a b b c c Stack 2 Stack 1

5 PDA Enhancements a b b b b a $ $ a b b a b b
Theorem: 2-stack PDAs are more powerful than 1-stack PDAs. Hint: Find an example non-CFL accepted by a 2-stack PDA. a, ↓a,- ε, ↑a, ↓a a a, -, ↑a b b, ↓b,- ε, ↑b, ↓b b, -, ↑b b b ε, ↓$, - ε, -, ↓$ ε, ↑$,- ε, -, ↑$ start w1 flip w2 end b a $ Input $ a b b a b b Stack 2 Stack 1

6 PDA Enhancements a b b $ a $ b b a b b b $ a $ $ b b b a b a $
Is there anything we can’t simulate with a 2-PDA? How about a 3-PDA? To pop from stack 1: Do: σϵ{a,b}, ωϵ{a,b,$} a b ε, ↑b, -, - x y $ b Stack 2 a Stack 1 Stack 3 b $ a $ b b b b x ε, ↑σ, ↓σ ε, ↑$, ↓$ ε, ↑b, - y ε ε, ↓ω, ↑ω $ a b $ b b Move stack 3 Move stack 2 Pop reset a b $ a Stack 1 Stack 2

7 PDA Enhancements a b a b $ $
Is there anything we can’t simulate with a 2-PDA? 2-PDA=Turing Machine $ a b $ b a Current Symbol Stack 1 Stack 2

8 Turing Machine … FSM Infinite tape: Γ*
Tape head: read current square on tape, write into current square, move one square left or right FSM: like PDA, except: transitions also include direction (left/right) final accepting and rejecting states

9 Turing Machine … FSM 7-tuple: (Q, , Γ, δ, q0, qaccept, qreject)
Q: finite set of states : input alphabet (cannot include blank symbol, _) Γ: tape alphabet, includes  and _ (blank) δ: transition function: Q  Γ  Q  Γ  {L, R} (in FSM) q0: start state, q0  Q qaccept: accepting state, qaccept  Q qreject: rejecting state, qreject  Q

10 Turing Machine Configuration
q FSM u v (u, q, v)ϵΓ* × Q × Γ* tape contents left of head head and right current FSM state

11 Initial Configuration
b _ FSM input blanks Configuration: (a, start, bba)

12 Operation … δ*: Γ*  Q  Γ*  Γ*  Q  Γ*
Transition from configuration to configuration FSM u v q The qaccept and qreject states are final (you never leave): δ*(u, qaccept, v)  (u, qaccept, v) δ*(u, qreject, v)  (u, qreject, v)

13 Operation … a c b δ*(ua, q, bv) = (uac, qr, v) if δ(q, b) = (qr, c, R)
FSM q qr b,c,R a c b u v δ*(ua, q, bv) = (uac, qr, v) if δ(q, b) = (qr, c, R) δ*(ua, q, bv) = (u, qr, acv) if δ(q, b) = (qr, c, L)

14 Operation … a c b δ*(ua, q, bv) = (uac, qr, v) if δ(q, b) = (qr, c, R)
FSM q qr b,c,L a c b u v δ*(ua, q, bv) = (uac, qr, v) if δ(q, b) = (qr, c, R) δ*(ua, q, bv) = (u, qr, acv) if δ(q, b) = (qr, c, L)

15 ≡ Church Turing Thesis Read notes Ponder Scribble notes Repeat
Read from tape Change state Write to tape Repeat


Download ppt "Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer."

Similar presentations


Ads by Google