lower bounds on the time-complexity of non-regular languages on one-tape turing machine miaohua xu...

26
Lower Bounds on the Time- Lower Bounds on the Time- complexity of Non-regular complexity of Non-regular Languages on One-tape Turing Languages on One-tape Turing Machine Machine Miaohua Xu For Theory of Computation II Professor: Geoffrey S. Smith Florida International University

Upload: walter-cameron

Post on 12-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 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

Lower Bounds on the Time-Lower Bounds on the Time-complexity of Non-regular complexity of Non-regular

Languages on One-tape Turing Languages on One-tape Turing MachineMachine

Miaohua Xu

For Theory of Computation II

Professor: Geoffrey S. Smith

Florida International University

Page 2: 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

Single-tape Turing MachineSingle-tape Turing Machine

On each operation the machine Writes a new symbol on the tape square under the

head.

Enters into a new state (not necessarily different than previous state).

Moves the reading head either left or right by one tape square.

),,(),( 21 Rbqaq

a

q1

Page 3: 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

Single-tape Turing MachineSingle-tape Turing Machine

On each operation the machine Writes a new symbol on the tape square under the

head.

Enters into a new state (not necessarily different than previous state).

Moves the reading head either left or right by one tape square.

b

q2

Page 4: 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

Motivational ExampleMotivational Example

Consider the language L = { 0k1k | k ≥ 0}

Scan across the tape and reject if a 0 is found to the right of a 1.

Repeat the following if the both 0’s and 1’s remain. Scan across the tape crossing off a single 0 and

a single 1.

If either 0 or 1 remains, reject. Else accept.̎

M1 = � On input string ω :

Can Wedo

better?TIME(n2)

Page 5: 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

TIME(n log n)

Motivational Example Cont’d. Motivational Example Cont’d.

M2 = � On input string ω : Scan across the tape and reject if a 0 is

found to the right of a 1.

Repeat the following if the both 0’s and 1’s remain. 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.

Scan again across tape, crossing off every other 0 and ever other 1.

If either 0 or 1 remains, reject. Else accept.̎

Can Wedo

better?

Page 6: 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

We Can Not Do Any (great) BetterWe Can Not Do Any (great) Better

Introduction of crossing sequence.

Illustration of some properties of crossing sequences.

Proving that lengths of crossing sequences must be bounded (Hartmanis68).

Proving that bounded length crossing sequences language must be regular (Hennie65).

Theorem: If language A TIME(f(n)), where f(n) belongs to o(n log n), then A is regular.

Outline of the proof 0log)(

nnnf

nLim

Page 7: 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

Crossing SequenceCrossing Sequence

X Y

q1

q3

q7

C (wsX : Ywt) = (q1, q2, …, q7)

ws wt

Crossing sequence on the boundary between X and Y is theordered 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.

),,(),( 10 Rbqaq

),,(),( 7 Rdqcqi

Page 8: 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

Properties of Crossing SequencesProperties of Crossing Sequences

ω1 ω2 ω3

C (ω1 : ω2ω3) = C (ω1ω2 : ω3)

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.

Running time = sum of the lengths of all crossing sequences.

if

Machine can not halt in ω2 portion.

It will accept (reject) ω1ω2ω3 iff it accepts (rejects) ω1ω3.

Page 9: 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

ω1ω2 ω3

q1

q1

q2

q2

ω1 ω3

q1

q2

If C (ω1 : ω2ω3) = C (ω1ω2 : ω3)

Page 10: 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

Proof outline againProof outline again

Introduction of crossing sequence.

Illustration of some properties of crossing sequences.

Proving that lengths of crossing sequences must be bounded if f(n) belongs to o(n log n)

Proving that bounded length crossing sequences language must be regular

Page 11: 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

Hartmanis68 Hartmanis68

Definition: R(n) = maximum length of a crossing sequence on an input of size n.

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)

n

There will exist 0 < n1 < n2 < …such that R(ni) > R(n), for ni > n

si is the string of length ni forwhich R(ni)-long crossing sequences are generated

Page 12: 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

Hartmanis68 Cont’d.Hartmanis68 Cont’d.

Proposition: On si no crossing sequence can be generated more than twice.

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)

Proof:

M will generate a crossing sequence of length R(ni) either on s′ = ω1ω2ω4 or on s′′ = ω1ω3ω4.

Both strings s′ and s′′ have length < ni, which leads to the contradiction.

Page 13: 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

ω1 ω2 ω3

If C (ω1 : ω2ω3 ω4) = C (ω1ω2 : ω3 ω4)= C (ω1 : ω2ω3: ω4)

ω4

ω1 ω2 ω3 ω4 ω1ω3 ω4

ω1 ω2 ω4

Page 14: 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

Hartmanis68 cont’d.Hartmanis68 cont’d.

Number of crossing sequences on si ≥ ni (as there are at least ni number of boundaries).

no crossing sequence can be generated more than twice.

2QR(n ) + 1 ≥ ni i

R(ni) ≥ log ni – 2(the base of logarithm is Q)

Number of crossing sequences of length at most r = Σ Qi ≤ Qr + 1

(Q is the number of states)i = 0

i = r

Number of crossing sequences of length at most r = Σ Qi ≤ Qr + 1

(Q is the number of states)i = 0

i = r

If R(n) = o ( log n) then R(n) must be bounded by a constant

Page 15: 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

1. T(ni) = sum of the lengths of all crossing sequences.

2. If R(ni) is not bound, then

3. no crossing sequence can be generated more than twice

If T(n) = o (n log n) then R(n) must be bounded by a constant ???

R(ni) ≥ log ni - 2

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

Page 16: 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

Hartmanis68 cont’d.Hartmanis68 cont’d.

T(n) = Ω (n log n)

r

jii

rji QnnrQjQnT

0

3)3(log222)(

r

j

r

ji

jji nQwherejQnT

0 0

2,2)(

If T(n) = o (n log n) then R(n) must be bounded by a constant

Page 17: 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

Complete ProofComplete Proof

If T(n) is o(n log n) then lengths of all crossing sequences will be bounded by a constant. Done!

bounded length crossing sequences language must be regular 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 right-invariance relation.

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.

Page 18: 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

Right-invariant

Definition:The equivalence relation ≡L is right-invariant iff

x ≡L y and x L y L

(Myhill-Nerode Theorem): A language L is regular iff it can be representedas the union of a number of classes of a finite, right –invariant equivalence relation ≡L.

x ≡L y for all z, x.z ≡L y.z

Page 19: 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

A language can be represented as the union of a number of classes of a finite, right –invariant equivalence relation

it’s regular

Page 20: 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

Hennie65: Intuitive IdeaHennie65: Intuitive Idea

Defining the relation ≡L in terms of crossing sequence.

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.

x ≡L y if and only the set of crossing sequences which can appear on their right-hand end is same.

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.

Page 21: 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

Hennie’s ExperimentHennie’s Experiment For a given finite left-end tape segment t and finite crossing

sequence C = S(1), S(2), …, S(k) do the following experiment. Begin the experiment by placing machine in the start

state and causing it to scan leftmost square of t. 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.

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. Transient, accepting, non accepting crossing sequences for t.

Page 22: 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

Hennie65Hennie65 Number of all crossing sequences of length at

most k is finite (≤ Qk + 1).

Number of subsets of these crossing sequences will also be finite.

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.

Define the relation ≡M by x ≡M y if all the four sets of crossing sequences are same for x and y.

Page 23: 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

Hennie65 Cont’d.Hennie65 Cont’d. The relation ≡M is an equivalence relation.

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.

Right-invariance: Let t1 and t2 are two finite left-end segments, belonging to the same class. Now consider t1tx and t2tx, where tx is finite. Since t1 can be replaced by t2 without changing the crossing sequences in tx portion, t1tx and t2tx will have same set of supported, transient, accepting and non accepting crossing sequences (i.e., t1tx ≡M t2tx).

t2tx txt1

CC C’C’

Page 24: 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

More ResultMore Result

Languages Lower bounds Upper boundsRegular Languages

O(n) O(n)

Nonregular CFLs O(nlogn) n5-recognizableParticular Nonregular CFLs{0k1k|k>0} O(nlogn){w|w is palindrome}

O(n2)

There is no algorithm to decide whether a nonregular context-free language generated by grammar G can be recognized in time T(n)=nlogn

Page 25: 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

ReferencesReferences Hennie, F.C. One-tape, offline Turing machine

computations, Inf. Contr. 8 (1965), 553-578.

Hartmanis, J. Computational complexity of one-tape Turing machine computations, JACM, Volume 2, Issue 15 (1968), 325-339.

Aho, Motwani, Ullman Introduction to automata and language theory.

Ajay Kr. Verma, Amin Shokrollahi Lower Bounds on the Time-complexity of Non-regular Languages on Single-tape Turing Machine (slides)

www-cad.eecs.berkeley.edu/~tah/172/7.pdf --Lectue 7: Myhill-Nerode Theorem

Page 26: 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

Questions?Questions?

Thank you!