Restricted Turing Machines and Language Recognition
Total Page:16
File Type:pdf, Size:1020Kb
Restricted Turing Machines and Language Recognition Giovanni Pighizzini Dipartimento di Informatica Università degli Studi di Milano, Italy LATA 2016 – Prague March 14-18, 2016 General Contents Part I: Fast One-Tape Turing Machines Hennie Machines & C Part II: One-Tape Turing Machines with Rewriting Restrictions Limited Automata & C The Chomsky Hierarchy (One-tape) Turing Machines type 0 Linear Bounded Automata type 1 Pushdown Automata type 2 “Hennie Machines” type 3 Part II: One-Tape TMs with Rewriting Restrictions Outline I Limited automata I Equivalence with CFLs I Determinism vs nondeterminism I Descriptional complexity aspects I 1-limited automata and regular languages I Related models Limited Automata [Hibbard ’67] One-tape Turing machines with restricted rewritings Definition Fixed an integer d ≥ 1, a d-limited automaton is I a one-tape Turing machine I which is allowed to rewrite the content of each tape cell only in the first d visits Computational power I For each d ≥ 2, d-limited automata characterize context-free languages [Hibbard ’67] I 1-limited automata characterize regular languages [Wagner&Wechsung ’86] x( x x( x( x( x x x −!6 6 6 6 6 6 6 6 6 6 yes!− Example: Balanced Parentheses B ( ) ( ( ( ) ) ) C (i) Move to the right to search a closed parenthesis (ii) Rewrite it by x (iii) Move to the left to search an open parenthesis (iv) Rewrite it by x (v) Repeat from the beginning Special cases: (i’) If in (i) the right end of the tape is reached then scan all the tape and accept iff all tape cells contain x (iii’) If in (iii) the left end of the tape is reached then reject Each cell is rewritten only in the first 2 visits! The Chomsky Hierarchy (One-tape) Turing Machines type 0 Linear Bounded Automata type 1 d-Limited Automata (d ≥ 2) type 2 1-Limited Automata type 3 Why Each CFL is Accepted by a 2-LA [P.&Pisoni ’14] Main tool: Theorem ([Chomsky&Schützenberger ’63]) Every context-free language L ⊆ Σ∗ can be expressed as L = h(Dk \ R) where, for Ωk = f(1; )1; (2; )2;:::; (k ; )k g: ∗ I Dk ⊆ Ωk is a Dyck language ∗ I R ⊆ Ωk is a regular language ∗ I h :Ωk ! Σ is an homomorphism Furthermore, it is possible to restrict to non-erasing homomorphisms [Okhotin ’12] Why Each CFL is Accepted by a 2-LA z 2 Dk ? AD @ w z 2 h−1(w) w 2 L? - T ^@ - @ @R A R z 2 R? L context-free language, with L = h(Dk \ R) −1 I T nondeterministic transducer computing h I AD 2-LA accepting the Dyck language Dk I AR finite automaton accepting R Why Each CFL is Accepted by a 2-LA z 2 Dk ? AD @ w z 2 h−1(w) w 2 L? - T ^@ - @ @R A R z 2 R? −1 u1 u2 ··· uk z = σ1σ2 ··· σk 2 h (w) | {z } input of T h(σi ) = ui ####σ1 ##σ2 ··· ###σk Non erasing homomorphism! | {z } (padded) input of AD and AR Not stored into the tape! Each σi is produced “on the fly” Why Each CFL is Accepted by a 2-LA z 2 Dk ? AD @ w z 2 h−1(w) w 2 L? - T ^@ - @ @R A R z 2 R? ······ ui ··· w = ··· ui ··· 6 + + ####σi h(σi ) = ui + + ####γi γi : first rewriting by AD I On the tape, ui is replaced directly by ####γi I One move of AR on input σi is also simulated Why Each CFL is Accepted by a 2-LA z 2 Dk ? AD @ w z 2 h−1(w) w 2 L? - T ^@ - @ @R A R z 2 R? The resulting machine is a 2-LA recognizing the given CFL Problems: I What about the size of the resulting machine? I What about the case of deterministic CFLs? PDAs vs Limited Automata ¨ © m m Simulation of Pushdown Automata by 2-Limited Automata a b c d e f g h i ::: BCX X Y f g h i ::: 6 6 - Z Y X PDA q X 2-LA q; Z Normal form for (D)PDAs: I at each step, the stack height increases at most by 1 I -moves cannot push on the stack Each PDA can be simulated by an equivalent 2-LA I Polynomial size I Determinism is preserved Simulation of 2-Limited Automata by Pushdown Automata Problem What about the converse simulation, namely that of 2-LAs by PDAs? [Hibbard ’67] Original simulation [P.&Pisoni ’15] Reformulation I Exponential cost I Determinism is preserved (extra costs) Transition Tables of 2-LAs I Fixed a 2-limited automaton I Transition table τw w is a “frozen” string τw ⊆ Q × {−1; +1g × Q × {−1; +1g −! − w − w − q q j p j p (q; −1; p; −1) 2 τw j (q; +1; p; −1) 2 τw j 0 00 (q; d ; p; d ) 2 τw iff M on a tape segment containing w has a computation path: entering the segment in q from d0 exiting the segment in p to d00 left = −1, right = +1 nn n n n n Simulation of 2-LAs by PDAs Initial configuration BCa b c d e f g h i ::: a b c d e f g h i ::: 6 6 q q 2-LA 0 PDA 0 - After some steps... BCXAa B b X c Y d ZE e F f g h i ::: a b c d e f g h i ::: 6 6 - τEF Y X q q 2-LA PDA τAB Simulation of 2-LAs by PDAs BCA B X Y E F g h i ::: a b c d e f g h i ::: 6 6 - τEF Y X q q 2-LA PDA τAB δ(q; g) 3 (p; Z; +1) normal mode move to the right push and direct simulation + + BCA B X Y E F Z h i ::: a b c d e f g h i :::- Z n6 6 τ EFn Y X p p 2-LA PDA τAB Simulation of 2-LAs by PDAs A B X Y E F Z h i ::: a b c d e f g h i ::: BC - Z 6 6 τEF Y X p p 2-LA PDA τAB δ(p; h) 3 (r; H; −1) back mode move to the left + + BCA B X Y E F Z H i ::: a b c d e f g h i :::- Z 6 6 n τEF Y X r; τ 2-LA r PDA H τAB n Simulation of 2-LAs by PDAs BCA B X Y E F Z H i ::: a b c d e f g h i :::- Z 6 6 τEF Y X r; τ 2-LA r PDA H τAB δ(r; Z) 3 (q; G; −1) back mode move to the left + + BCA B X Y E F G H i ::: a b c d e f g h i ::: 6 6 - τEF Y X q q; τ 2-LA PDA GH τAB n Simulation of 2-LAs by PDAs BCA B X Y E F G H i ::: a b c d e f g h i ::: 6 6 - τEF Y X q q; τ 2-LA PDA GH τAB (q; +1; s; −1) 2 τ EF back mode exit to the left + + BCA B X Y E F G H i ::: a b c d e f g h i ::: 6 6 - Y X 2-LA s PDA s; τE···H τ ¨ AB © ¨ © Simulation of 2-LAs by PDAs BCA B X Y E F G H i ::: a b c d e f g h i ::: 6 6 - Y X s; τ 2-LA s PDA E···H τAB δ(s; Y ) 3 (p; D; +1) move to the right back mode + + BCA B X D E F G H i ::: a b c d e f g h i ::: XnX6 6 - τD Xn p p; τ 2-LA PDA E···H τAB n n n Simulation of 2-LAs by PDAs BCA B X D E F G H i ::: a b c d e f g h i ::: XX6 6 - τD X p p; τ 2-LA PDA E···H τAB (p; −1; r; +1) 2 τE···H resume normal mode exit to the right move to the right + + BCA B X D E F G H i ::: a b c d e f g h i ::: XX 6 6 - τD···H X ¨ 2-LA r PDA r τAB © Simulation of 2-LAs by PDAs Summing up... Given a 2-LA M with: 4n2 I n states At most 2 many different tables! I m symbol working alphabet Resulting PDA: States I States Normal mode: states of M 4n2 Back mode: (q; τ) 2n(2 + 1) + 1 q state of M, τ transition table I Pushdown symbols Pushdown symbols Tape symbols of M 4n2 Transition tables m + 2 I Each move can increase the stack height at most by 1 2-LAs ! PDAs Exponential cost Optimality: the Witness Languages Kn Given n ≥ 1: a1 a2 ::: an ::: an+1 an+2 ::: a2n b1 b2 ::: bn | {z } | {z } | {z } x1 xk x H ¨ HH ::: ¨¨ At least n of these blocks are equal to the last block x n Kn = fx1x2 ··· xk x j k ≥ 0; x1; x2;:::; xk ; x 2 f0; 1g ; 9i1 < i2 < ··· < in 2 f1;:::; kg; xi1 = xi2 = ··· = xin = x g Example (n = 3): 0 0 1j1 1 0j0 1 1j1 1 0j1 1 0j1 1 1j1 1 0 j j j j j j How to Recognize Kn 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 111 110 (n = 3) 1.