Loading...

PPT – CSCI 3130: Formal languages and automata theory Tutorial 9 PowerPoint presentation | free to download - id: 7c9eef-Y2JiN

The Adobe Flash plugin is needed to view this content

CSCI 3130 Formal languages and automata

theory Tutorial 9

- Chin

Reminder

- Homework 5 is due at next Tuesday!
- No tutorial next week! D
- This is the last one.

Undecidable problems for CFGs

- ALLCFG ltGgt G is a CFG that generates all

strings - ALLCFG is undecidable
- Reduction
- ATM ltM, wgt M is a TM that does not accept w
- ltM, wgt M rejects or loops on input w
- ATM is unrecognizable ? ATM is undecidable
- If ALLCFG is decidable then ATM is decidable.
- Contradiction.

Undecidable problems for CFGs

- ALLCFG ltGgt G is a CFG that generates all

strings - ALLCFG is undecidable
- Suppose it is decidable, then there exists a

universal TM H - string H(string ltGgt)
- // G is a CFG
- if G generates all strings, return accept
- if G does not generates all strings, return

reject - Consider the following TM U (dependent on ltMgt and

w) - string U(string ltMgt, string w)
- If M does not accept w, return ltGgt that

generates all strings - If M accepts w, return ltGgt that does not

generate all strings - If we can simulate H(U(ltMgt,w)), then U decides

ATM and so ATM is decidable.

Undecidable problems for CFGs

- ALLCFG ltGgt G is a CFG that generates all

strings - ALLCFG is undecidable
- Consider the following TM U (dependent on ltM, wgt)
- string U(string ltMgt, string w)
- If M does not accept w, return ltGgt that

generates all strings - If M accepts w, return ltGgt that does not

generate all strings - We construct U as follows instead
- string U(string ltMgt, string w)
- If M does not accept w, construct ltGgt that

generates all strings - If M accepts w, construct ltGgt that generates

all strings except - the computation history of M(w)
- return H(ltGgt)
- How to construct ltGgt? We need to construct ltGgt so

that even if M loops on w, ltGgt generates all

strings.

Undecidable problems for CFGs

- Computation history
- q0ababxq1bab . . . xxxx?qa
- Each xxxxxx tells you the configuration of the

TM in each step

abq1a

abbqacc

Undecidable problems for CFGs

- Computation history
- Suppose the current configuration is
- xbq1xab
- What does the next configuration look like?
- The head must be one symbol left or one symbol

right - xbq1xab
- Only these 3 symbols can change
- Use this fact to design a PDA that generates the

computation history (see lecture notes). - Convert the PDA to ltGgt.

Undecidable problems for CFGs

- PCP ltTgt T is a collection of tiles

that contains a top-bottom match - PCP is undecidable
- AMB ltGgt G is an ambiguous CFG
- AMB is undecidable
- If AMB is decidable, PCP is decidable.

Contradiction.

Undecidable problems for CFGs

T

G

(CFG)

(collection of tiles)

Terminals

a, b, c, 1, 2, 3

Variables

S, T, B

1

2

3

Productions

bab cc

c ab

a ab

T ? cT2

T ? aT3

T ? babT1

S ? T B

T ? c2

T ? a3

T ? bab1

B ? abB2

B ? abB3

B ? ccB1

B ? ab2

B ? ab3

B ? cc1

Undecidable problems for CFGs

- EQCFG ltG1, G2gt G1 and G2 are two CFGs that

describe the same language - Is it decidable?

Undecidable problems for CFGs

- EQCFG ltG1, G2gt G1 and G2 are two CFGs that

descript the same language - EQCFG is undecidable.
- Same idea as EQTM
- If EQCFG is decidable, ALLCFG is also decidable.
- Let G1 to be a CFG that generates all inputs.

Undecidable problems for CFGs

- EQCFG ltG1, G2gt G1 and G2 are two CFGs that

descript the same language - If EQCFG is decidable, there exists a TM H such

that - string H(string ltG1gt, string ltG2gt)
- if G1 and G2 are equal, return accept
- if G1 and G2 are not equal, return reject
- Let G1 to be a CFG that generates all inputs. We

construct U as follows - string U(string ltGgt)
- G1 a CFG that generates all inputs //

hardcode - return H(G1, G)
- Given a CFG ltGgt, U(ltGgt) returns accept if G

generates all strings, rejects if G does not. - Hence ALLCFG is decidable. Contradiction.

Post Correspondence Problem

- PCP1 PCP over the alphabet S 1.
- The alphabet of a tile is the set of symbols that

appear on the tiles. - Is PCP1 decidable?

Post Correspondence Problem

- PCP1 PCP over the alphabet S 1.
- The alphabet of a tile is the set of symbols that

appear on the tiles. - PCP1 is decidable.
- 3 1 2
- 2 5 -3
- Find x, y such that 2x 3y 0. Easy.
- If exists two tiles like above, accept. Otherwise

reject.

111 1

11 11111

Post Correspondence Problem

- PCP2 PCP over the alphabet S 0, 1.
- The alphabet of a tile is the set of symbols that

appear on the tiles. - Is PCP2 decidable?

Post Correspondence Problem

- PCP2 PCP over the alphabet S 0, 1.
- The alphabet of a tile is the set of symbols that

appear on the tiles. - PCP2 is undecidable.
- If PCP2 is decidable, then PCP is also decidable.
- Represent the alphabet in PCP in binary form.

End

- Questions?