Lower Bounds on the Timecomplexity of Nonregular Languages
Lower Bounds on the Time-complexity of Non-regular Languages on One-tape Turing Machine Miaohua Xu For Theory of Computation II Professor: Geoffrey S. Smith Florida International University
Single-tape Turing Machine q 1 On each operation the machine l Writes a new symbol on the tape square under the head. l Enters into a new state (not necessarily different than previous state). l Moves the reading head either left or right by one tape square.
Single-tape Turing Machine q 2 On each operation the machine l Writes a new symbol on the tape square under the head. l Enters into a new state (not necessarily different than previous state). l Moves the reading head either left or right by one tape square.
Motivational Example Consider the language L = { 0 k 1 k | k ≥ 0} M 1 = On input string ω : l Scan across the tape and reject if a 0 is found to the right of a 1. l Repeat the following if the both 0’s and 1’s remain. l l Can We do better? Scan across the tape crossing off a single 0 and a single 1. If either 0 or 1 remains, reject. Else accept. TIME(n 2)
Motivational Example Cont’d. M 2 = On input string ω : l Scan across the tape and reject if a 0 is found to the right of a 1. l Repeat the following if the both 0’s and 1’s remain. l Can We do better? l Scan across the tape, checking whether the total number of 0’s and 1’s remaining on the tape is even or odd. If odd, reject. l Scan again across tape, crossing off every other 0 and ever other 1. If either 0 or 1 remains, reject. Else accept. TIME(n log n)
We Can Not Do Any (great) Better Theorem: If language A TIME(f(n)), where f(n) belongs to o(n log n), then A is regular. Outline of the proof l Introduction of crossing sequence. l Illustration of some properties of crossing sequences. l Proving that lengths of crossing sequences must be bounded (Hartmanis 68). l Proving that bounded length crossing sequences language must be regular (Hennie 65).
Crossing Sequence wt ws X Y q 1 q 3 q 7 C (ws. X : Ywt) = (q 1, q 2, …, q 7) Crossing sequence on the boundary between X and Y is the ordered sequence of states s(1), s(2), …, s(n); where s(i) is the state in which machine is in ith crossing of the boundary.
Properties of Crossing Sequences ω1 ω2 ω3 l Machine head will be in ω2 portion iff it has crossed (ω1 : ω2 ) boundary an odd number of times and (ω2 : ω3 ) boundary even number of times. l Running time = sum of the lengths of all crossing sequences. if C (ω1 : ω2ω3) = C (ω1ω2 : ω3) l Machine can not halt in ω2 portion. l It will accept (reject) ω1ω2ω3 iff it accepts (rejects) ω1ω3.
Proof outline again l Introduction of crossing sequence. l Illustration of some properties of crossing sequences. l Proving that lengths of crossing sequences must be bounded if f(n) belongs to o(n log n) l Proving that bounded length crossing sequences language must be regular
Hartmanis 68 l Definition: R(n) = maximum length of a crossing sequence on an input of size n. l Theorem: If the sequence R(n) is not bounded by a constant then running time T(n) = Ω(n log n). Proof: Assume R(n) is not bounded by a constant R(n) There will exist 0 < n 1 < n 2 < … such that R(ni) > R(n), for ni > n si is the string of length ni for which R(ni)-long crossing sequences are generated n
Hartmanis 68 Cont’d. Proposition: On si no crossing sequence can be generated more than twice. Proof: Let si = ω1ω2ω3ω4, ω1 , ω2 , ω3 , ω4 ≠ ø C (ω1 : ω2ω3ω4) = C (ω1ω2 : ω3ω4) = C (ω1ω2ω3 : ω4) l M will generate a crossing sequence of length R(ni) either on s′ = ω1ω2ω4 or on s′′ = ω1ω3ω4. l Both strings s′ and s′′ have length < ni, which leads to the contradiction.
Hartmanis 68 cont’d. l Number of crossing sequences on si ≥ ni (as there at least ni number of boundaries). l no crossing sequence can be generated more than twice. Number of crossing sequences of length at most r = (Q is the number of states) 2 QR(n )i + 1 ≥ i=r Σ Qi ≤ Q r + 1 i=0 ni R(ni) ≥ log ni – 2 (the base of logarithm is Q) If R(n) = o ( log n) then R(n) must be bounded by a constant
If T(n) = o (n log n) then R(n) must be bounded by a constant ? ? ? 1. T(ni) = sum of the lengths of all crossing sequences. 2. If R(ni) is not bound, then R(ni) ≥ log ni - 2 3. no crossing sequence can be generated more than twice Length of crossing sequence Number of crossing sequences of the length 0 2 1 2*|Q| 2 2*|Q|2 3 2*|Q|3 …… … N-1 2*|Q|N-1 N 2*|Q|N
Hartmanis 68 cont’d. T(n) = Ω (n log n) If T(n) = o (n log n) then R(n) must be bounded by a constant
Complete Proof l If T(n) is o(n log n) then lengths of all crossing sequences will be bounded by a constant. Done! l bounded length crossing sequences language must be regular l If lengths of all crossing sequences is ≤ k (for some constant k), the language can be represented as a union of a number of classes of a finite rightinvariance relation. l Any language which can be represented as a union of a number of classes of a finite right-invariance relation, must be regular. (Myhill-Nerode Theorem): A language L is regular iff it can be represented as the union of a number of classes of a finite, right–invariant equivalence relation ≡L.
Right-invariant Definition: The equivalence relation ≡L is right-invariant iff x ≡L y and x L y L x ≡L y for all z, x. z ≡L y. z (Myhill-Nerode Theorem): A language L is regular iff it can be represented as the union of a number of classes of a finite, right –invariant equivalence relation ≡L.
A language can be represented as the union of a number of classes of a finite, right – invariant equivalence relation it’s regular
Hennie 65: Intuitive Idea l Defining the relation ≡L in terms of crossing sequence. l If we know all possible crossing sequences at a boundary then just by knowing the part of string on the right of boundary we can simulate the TM. l x ≡L y if and only the set of crossing sequences which can appear on their right-hand end is same. l Determining whether a given crossing sequence can appear at the right of a given left-end tape segment can not be done by considering all tapes that contain the given left-end segment.
Hennie’s Experiment l l For a given finite left-end tape segment t and finite crossing sequence C = S(1), S(2), …, S(k) do the following experiment. l Begin the experiment by placing machine in the start state and causing it to scan leftmost square of t. l When machine leaves the right-end of t for ith time (i < k) and is in state S(i), put it in state S(i + 1) and send it back to the rightmost square of t. l If the machine halts within t, or gets stuck in some periodic behavior within t, or leaves t in such a way that previous step can not be applied, stop the experiment. If at the end the crossing sequence generated at right end of t is same as C, the segment t is said to support the crossing sequence C. l Transient, accepting, non accepting crossing sequences for t.
Hennie 65 l Number of all crossing sequences of length at most k is finite (≤ Qk + 1). l Number of subsets of these crossing sequences will also be finite. l Every finite left-end tape can be classified according to the crossing sequences of length k or less that it supports at its right end, and according to which of these sequences are transient, which are accepting and which are non accepting. l Define the relation ≡M by x ≡M y if all the four sets of crossing sequences are same for x and y.
Hennie 65 Cont’d. l The relation ≡M is an equivalence relation. l Finiteness: Since the number of 4 -tuples (supported crossing sequences x transient CS x accepting CS x non accepting CS) is finite, the relation ≡M will have finite number of equivalence classes. l Right-invariance: Let t 1 and t 2 are two finite left-end segments, belonging to the same class. Now consider t 1 tx and t 2 tx, where tx is finite. Since t 1 can be replaced by t 2 without changing the crossing sequences in tx portion, t 1 tx and t 2 tx will have same set of supported, transient, accepting and non accepting crossing sequences (i. e. , t 1 tx ≡M t 2 tx). C tx t 2 tx t 1 C’ C C’
More Result Languages Regular Languages Nonregular CFLs Lower bounds Upper bounds O(n) O(nlogn) n 5 -recognizable Particular Nonregular CFLs {0 k 1 k|k>0} {w|w is palindrome} O(nlogn) O(n 2) There is no algorithm to decide whether a nonregular context-free language generated by grammar G can be recognized in time T(n)=nlogn
References l Hennie, F. C. One-tape, offline Turing machine computations, Inf. Contr. 8 (1965), 553 -578. l Hartmanis, J. Computational complexity of one-tape Turing machine computations, JACM, Volume 2, Issue 15 (1968), 325 -339. l Aho, Motwani, Ullman Introduction to automata and language theory. l Ajay Kr. Verma, Amin Shokrollahi Lower Bounds on the Time-complexity of Non-regular Languages on Singletape Turing Machine (slides) l www-cad. eecs. berkeley. edu/~tah/172/7. pdf -Lectue 7: Myhill-Nerode Theorem
Questions? Thank you!
- Slides: 26