15
Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections 5.4 and 8.3]

Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Embed Size (px)

Citation preview

Page 1: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Decidability

A decision problem is a problem with a YES/NO answer.

We have seen decision problems for

- regular languages:

- context free languages:

[Sections 5.4 and 8.3]

Page 2: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Decidability

A real-life decision problem (important e.g. for cryptography):

“Given is a number p, is p a prime ?”

How to view this problem as a language ?

Which class of languages describes decidable problems ?

[Section 10.5]

Page 3: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Decidability

Are all decision problems decidable ?

(I.e., is every language recursive ?)

[Section 10.5]

Page 4: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

The Halting Problem

Input: a program P and an input x

Answer: YES if P halts on x, otherwise (i.e. P goes into an infinite loop on x), NO.

Note: the problem is typically phrased for Turing machines, i.e. P is a TM.

[Sections 11.1 and 11.2]

Page 5: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Variants of the Halting Problem

Input: a Turing machine T and an input x

Answer: YES if x 2 L(T), otherwise NO.

[Sections 11.2-3]

Page 6: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Variants of the Halting Problem

Input: a Turing machine T

Answer: YES if T halts on the empty input, otherwise NO.

[Sections 11.2-3]

Page 7: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Variants of the Halting Problem

Input: a Turing machine T, an input x, and a state q

Answer: YES if the computation of T on input x reaches the state q, otherwise NO.

[Sections 11.2-3]

Page 8: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Variants of the Halting Problem

Input: a Turing machine T

Answer: YES if L(T) = ;, otherwise NO.

[Sections 11.2-3]

Page 9: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Variants of the Halting Problem

Input: two Turing machines T1 and T2

Answer: YES if L(T1) = L(T2), otherwise NO.

[Sections 11.2-3]

Page 10: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Rice’s Theorem

Rice’s Thm:

Let R be a property on languages. If R holds for some but not all recursive enumerable languages, then the following problem is undecidable:

Input: a Turing machine T

Answer: YES if L(T) has the property R, otherwise NO.

[Section 11.4]

Page 11: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Post’s Correspondence Problem

Post’s Correspondence Problem (PCP) is a string matching problem:

Input: a collection of k types of dominoes, each domino contains two strings (i is at the top of the i-th domino, i is at the bottom; i=1,…,k).

Output: YES, if it’s possible to find a nonempty sequence of dominoes so that the string at the top matches the string on the bottom. (The domino types in the sequence can repeat.)

An easy example:

[Section 11.5]

1

11

10

0

Page 12: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Post’s Correspondence Problem

Some more examples:

Another example:

[Section 11.5]

1

111

10111

10

10

0

10

101

011

11

101

011

Page 13: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Post’s Correspondence Problem

Thm: The Post’s Correspondence Problem is undecidable.

Is PCP recursively enumerable?

[Section 11.5]

Page 14: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Undecidable Problems for CFL’s

Ambiguity of context-free grammars

Input: a CFG G

Output: YES if G is ambiguous, otherwise NO.

Consider an instance of a PCP: (1,1), (2,2), …, (k,k)

Create the following CFG:

S A | B

A 1 A a1 | 2 A a2 | … | k A ak | 1 a1 | 2 a2 | … | k ak

B 1 B a1 | 2 B a2 | … | k B ak | 1 a1 | 2 a2 | … | k ak

[Section 11.6]

Page 15: Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections

Undecidable Problems for CFL’s

1. Given a CFG G, is G ambiguous ?

2. Given a CFG G, is L(G) = * ?

3. Given two CFG’s G1 and G2, is L(G1) = L(G2) ?

4. Given two CFG’s G1 and G2, is L(G1) Å L(G2) = ; ?

[Section 11.6]