1 91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4)...

24
1 91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4) David Martin [email protected] This work is licensed under the Creative Commons Attribution- ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    218
  • download

    0

Transcript of 1 91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4)...

1

91.304 Foundations of (Theoretical) Computer Science

Chapter 1 Lecture Notes (more on Section 1.4)

David [email protected]

This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

2

Simplifying RPP proofs

I find it easier to forget about contradiction proofs and instead prove directly that a language is not in RPP

So we need a direct, formal version of of the statement that L RPP2

3

Unraveling RPP (repeat)

Rephrasing L is a member of RPP if There exists p¸0 such that

For every s2L satisfying |s|¸ p, There exist x,y,z 2 * such that

1. s=xyz2. |y|>03. |xy|· p4. For all i ¸ 0,

x yi z 2 L

(9 p) (8 s) (9 x,y,z) (8 i) !!!Pretty complicated

4

Unraveling non-RPP

Rephrasing L is not in RPP if For every p¸0

There exists some s2L satisfying |s| ¸ p such that For every x,y,z 2 * satisfying 1-3:

1. s=xyz,2. |y|>0, and3. |xy|· p There exists some i ¸ 0 for which

x yi z L

(8 p) (9 s) (8 x,y,z) (9 i) Still complicated — but you don't have

to use contradiction now

2

5

A direct proof of nonregularity Let D={an2 | n¸0 } = {,a1,a4,a9, } ('a' is just

some character). Then D is not regular.Proof idea The pumping lemma says there's a

fixed-size loop in any DFA that accepts long strings. You can repeat the characters in that loop as many times as you want to get longer strings that the machine accepts. Each time you add a repetition you grow the pumped string by a constant length.

But the spacing between strings in D above keeps changing; it's never constant. So D doesn't have the pumping property.

6

A direct proof of nonregularity Let D={an2 | n¸0 } = {,a1,a4,a9, }. Then

D is not in RPP and thus not regular.Proof Let p¸0 and set s=a(p+1)2. Then s2D

and |s|>p (so such an s certainly exists).Now let x,y,z2* be any strings satisfying

1. xyz = s = a(p+1)2 2. |y|>0, and3. |xy|· p

Our goal is to produce some i such that xyiz D2

7

Direct proof continued(We'll actually show that xy0z D)Observe that y=aj for some 1· j · p, so

|xy0z| = |a(p+1)2-j| < (p+1)2

Since j · p we know that -j ¸ -p and thus|xy0z| = (p+1)2 - j

¸ (p+1)2 - p = p2 + p + 1

> p2

In other words, xy0z has > p2 characters and < (p+1)2 characters. So |xy0z| is not a perfect square and thus xy0z D. QED2

2

8

Direct or contradiction proof?

Both work fine... it's your choice But you must clearly state what you

are doing If proof by contradiction, say so If direct proof, say so

9

Game theory formulation

The direct proof technique can be formulated as a two-player game You are the player who wants to

establish that L is not pumpable Your opponent wants to make it difficult

for you to succeed Both of you have to play by the rules

10

Game theory continued

The game has just four steps.1. Your opponent picks p¸02. You pick s2L such that |s|¸ p3. Your opponent chooses x,y,z 2 *

such that s=xyz, |y|>0, and |xy|· p4. You produce some i ¸ 0 such that

xyiz L2

11

Game theory continued If you are able to succeed through step 4,

then you have won only one round of the game Like winning one round of Tic-tac-toe Do example for a member of D

To show that a language is not in RPP you must show that you can always win, regardless of your opponent's legal moves Realize that the opponent is free to choose the

most inconvenient or difficult p and x,y,z imaginable that are consistent with the rules

12

Game theory continued So you have to present a strategy for

always winning — and convincingly argue that it will always win So your choices in steps 2 & 4 have to

depend on the opponent's choices in steps 1 & 3

And you don't know what the opponent will choose

So your choices need to be framed in terms of the variables p, x, y, z

13

Game theory continued

Ultimately it is not very different from the direct proof But it states clearly what choices you

may make and what you may not — a common cause of errors in proofs

Repeat previous proof in this framework

14

A direct proof of nonregularity Let D={an2 | n¸0 } = {,a1,a4,a9, }. Then

D is not in RPP and thus not regular.Proof Let p¸0 and set s=a(p+1)2. Then s2D

and |s|>p (so such an s certainly exists).Now let x,y,z2* be any strings satisfying

1. xyz = s = a(p+1)2 2. |y|>0, and3. |xy|· p

Our goal is to produce some i such that xyiz D2

Step 1, opponent's

choice

Step 2, your choice

and reasoning

Step 3, opponent's

choice

15

Direct proof continued(We'll actually show that xy0z D)Observe that y=aj for some 1· j · p, so

|xy0z| = |a(p+1)2-j| < (p+1)2

Since j · p we know that -j ¸ -p and thus|xy0z| = (p+1)2 - j

¸ (p+1)2 - p = p2 + p + 1

> p2

In other words, xy0z has > p2 characters and < (p+1)2 characters. So |xy0z| is not a perfect square and thus xy0z D. QED2

2

Step 4, your

choice

Step 4, your

reasoning

16

Unraveling RPP (repeat)

Rephrasing L is a member of RPP if There exists p¸0 such that

For every s2L satisfying |s|¸ p, There exist x,y,z 2 * such that

1. s=xyz2. |y|>03. |xy|· p4. For all i ¸ 0,

x yi z 2 L

Theorem REG µ RPP

17

Structural facts about RPP

1. If L 2 RPP(p) (meaning "strings in L with length ¸ p are pumpable") and q>p then L 2 RPP(q)

2. If L RPP(q) and q>p then L RPP(p) (contrapositive of 1)

Thus if you have a proof that establishes L RPP(q) only when q¸5, that's good enough: it follows that L is not regular

Relevant for “C is not regular” problem

2 2

2

18

Structural facts about RPP

3. If L 2 FIN and the longest string in L has length n, then

a) L 2 RPP(n+1)b) L RPP(q) for all q < n+1

Note RPP is a class of languages that's only interesting because of its relation to REG. It is not a reasonable proposal for a computation model!

2

19

Unraveling non-RPP (repeat)

L is not in RPP if For every p¸0 (opponent choice)

There exists some s2L satisfying |s| ¸ p such that (your choice) For every x,y,z 2 * satisfying 1-3:

1. s=xyz,2. |y|>0, and3. |xy|· p There exists some i ¸ 0 for which

x yi z L2

(opponent's)

(yours)

20

Another example Let C = {0m 1n | m n }. Is C regular? Try

to prove it isn't: Set s=0p 12p. If opponent chooses

x=, y=0p, z=12p, then we can set i=2 and win because xy2z=02p 12p C.

What if opponent chooses a shorter y? Looks like it's relatively easy to be a member of

C and hard to not be a member of C Can force opponent to choose y 2 0+

So try to arrange it so that no matter what |y| is, some number of repetitions of it will match the target number of '1's

2

21

Direct proof?

Hmmm

22

Using closure properties Can simplify argument a great dealFact If L is not regular then Lc is not regular

either.Proof If L is not regular but Lc were regular,

then (Lc)c would also be regular because REG is closed under complement. But (Lc)c = L QED

Recall the languagesB = { 0m 1n | m = n } C = { 0m 1n | m n } C is similar to Bc...

23

Using closure properties Start over:

B = { 0m 1n | m = n } (known nonreg)

C = { 0m 1n | m n } (suspected nonreg)

Certainly B µ Cc

If m=n then it's true that (not m n) But B Cc

Find example x 2 Cc - B... On the other hand, B = 0*1* Å Cc

24

Using closure properties

Fact If L1ÅL2 REG and L1 2 REG, then L2 REG

Proof Suppose (a) L1Å L2 REG and L12 REG and (b) L22REG. Since REG is closed under Å we know that L1ÅL2 2 REG, but that contradicts assumption (a). Thus (a) and (b) can't both be true. QED

2

2

2