CS 301 Lecture 22 Mapping reductions Stephen Checkoway April 18, - - PowerPoint PPT Presentation

cs 301
SMART_READER_LITE
LIVE PREVIEW

CS 301 Lecture 22 Mapping reductions Stephen Checkoway April 18, - - PowerPoint PPT Presentation

CS 301 Lecture 22 Mapping reductions Stephen Checkoway April 18, 2018 1 / 41 Review of decidable languages Context-free languages (and thus regular) 2 / 41 Review of decidable languages Context-free languages (and thus regular)


slide-1
SLIDE 1

CS 301

Lecture 22 – Mapping reductions Stephen Checkoway April 18, 2018

1 / 41

slide-2
SLIDE 2

Review of decidable languages

  • Context-free languages (and thus regular)

2 / 41

slide-3
SLIDE 3

Review of decidable languages

  • Context-free languages (and thus regular)
  • Acceptance problems
  • ADFA
  • ANFA
  • AREX
  • ACFG

2 / 41

slide-4
SLIDE 4

Review of decidable languages

  • Context-free languages (and thus regular)
  • Acceptance problems
  • ADFA
  • ANFA
  • AREX
  • ACFG
  • Emptiness problems
  • EDFA
  • ECFG

2 / 41

slide-5
SLIDE 5

Review of decidable languages

  • Context-free languages (and thus regular)
  • Acceptance problems
  • ADFA
  • ANFA
  • AREX
  • ACFG
  • Emptiness problems
  • EDFA
  • ECFG
  • Equivalence problems
  • EQDFA

2 / 41

slide-6
SLIDE 6

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}

3 / 41

slide-7
SLIDE 7

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM

3 / 41

slide-8
SLIDE 8

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM
  • HaltTM

3 / 41

slide-9
SLIDE 9

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM
  • HaltTM
  • ETM

3 / 41

slide-10
SLIDE 10

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM
  • HaltTM
  • ETM
  • ALLCFG

3 / 41

slide-11
SLIDE 11

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM
  • HaltTM
  • ETM
  • ALLCFG
  • EQCFG

3 / 41

slide-12
SLIDE 12

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM
  • HaltTM
  • ETM
  • ALLCFG
  • EQCFG
  • EQTM

3 / 41

slide-13
SLIDE 13

Review of undecidable languages

  • The diagonal language Diag = {⟨M⟩ ∣ M is a TM and ⟨M⟩ ∉ L(M)}
  • ATM
  • HaltTM
  • ETM
  • ALLCFG
  • EQCFG
  • EQTM
  • RegularTM

3 / 41

slide-14
SLIDE 14

Turing recognizable (RE) and co-Turing-recognizable (coRE)

Recall, L is decidable iff L is RE and coRE Language RE coRE ADFA

  • EDFA
  • EQDFA
  • ACFG
  • ECFG
  • EQCFG
  • Diag

? ? ATM

  • HaltTM

? ? ETM

  • EQTM

? ? RegularTM ? ?

4 / 41

slide-15
SLIDE 15

Reductions

Recall that A reduces to B (written A ≤ B) means “If B is decidable, then A is decidable”

5 / 41

slide-16
SLIDE 16

Reductions

Recall that A reduces to B (written A ≤ B) means “If B is decidable, then A is decidable” We used reductions to

1 prove that languages are decidable (“good-news reductions”) 2 prove that languages are not decidable (“bad-news reductions”)

5 / 41

slide-17
SLIDE 17

Reductions

Recall that A reduces to B (written A ≤ B) means “If B is decidable, then A is decidable” We used reductions to

1 prove that languages are decidable (“good-news reductions”) 2 prove that languages are not decidable (“bad-news reductions”)

We were able to determine that some languages aren’t RE by showing that they’re coRE but not decidable Similarly, we proved some languages aren’t coRE by showing that they’re RE but not decidable

5 / 41

slide-18
SLIDE 18

Reductions

Recall that A reduces to B (written A ≤ B) means “If B is decidable, then A is decidable” We used reductions to

1 prove that languages are decidable (“good-news reductions”) 2 prove that languages are not decidable (“bad-news reductions”)

We were able to determine that some languages aren’t RE by showing that they’re coRE but not decidable Similarly, we proved some languages aren’t coRE by showing that they’re RE but not decidable Reductions alone were not sufficient; we need a stronger notion of reduction

5 / 41

slide-19
SLIDE 19

Computable functions

A function f ∶ Σ∗ → Σ∗ is a computable function if there is some TM M such that when M is run on w, M halts with f(w) on the tape (and nothing else) This is similar to a decider in that M cannot loop, but there’s no notion of accepting

  • r rejecting a string, M just computes a function

6 / 41

slide-20
SLIDE 20

Examples of computable functions

  • Arithmetic: ⟨k, m, n⟩ ↦ ⟨k ⋅ m − 67n⟩ where k, m, n ∈ Z

The corresponding TM performs the arithmetic and then copies the result to the beginning of the tape and clears the rest

7 / 41

slide-21
SLIDE 21

Examples of computable functions

  • Arithmetic: ⟨k, m, n⟩ ↦ ⟨k ⋅ m − 67n⟩ where k, m, n ∈ Z

The corresponding TM performs the arithmetic and then copies the result to the beginning of the tape and clears the rest

  • Converting a grammar to CNF: ⟨G⟩ ↦ ⟨G′⟩ where L(G) = L(G′) and G′ is in

CNF The corresponding TM performs the conversion to CNF algorithm

7 / 41

slide-22
SLIDE 22

Examples of computable functions

  • Arithmetic: ⟨k, m, n⟩ ↦ ⟨k ⋅ m − 67n⟩ where k, m, n ∈ Z

The corresponding TM performs the arithmetic and then copies the result to the beginning of the tape and clears the rest

  • Converting a grammar to CNF: ⟨G⟩ ↦ ⟨G′⟩ where L(G) = L(G′) and G′ is in

CNF The corresponding TM performs the conversion to CNF algorithm

  • Constructing new TMs: ⟨M, w⟩ ↦ ⟨M′⟩ where M′ is the TM that ignores its

input and runs M on w

7 / 41

slide-23
SLIDE 23

Examples of computable functions

  • Arithmetic: ⟨k, m, n⟩ ↦ ⟨k ⋅ m − 67n⟩ where k, m, n ∈ Z

The corresponding TM performs the arithmetic and then copies the result to the beginning of the tape and clears the rest

  • Converting a grammar to CNF: ⟨G⟩ ↦ ⟨G′⟩ where L(G) = L(G′) and G′ is in

CNF The corresponding TM performs the conversion to CNF algorithm

  • Constructing new TMs: ⟨M, w⟩ ↦ ⟨M′⟩ where M′ is the TM that ignores its

input and runs M on w

  • Constructing multiple TMs: ⟨M⟩ ↦ ⟨M, M′⟩ where M′ is a TM such that

L(M′) = Σ∗

7 / 41

slide-24
SLIDE 24

Examples of computable functions

  • Arithmetic: ⟨k, m, n⟩ ↦ ⟨k ⋅ m − 67n⟩ where k, m, n ∈ Z

The corresponding TM performs the arithmetic and then copies the result to the beginning of the tape and clears the rest

  • Converting a grammar to CNF: ⟨G⟩ ↦ ⟨G′⟩ where L(G) = L(G′) and G′ is in

CNF The corresponding TM performs the conversion to CNF algorithm

  • Constructing new TMs: ⟨M, w⟩ ↦ ⟨M′⟩ where M′ is the TM that ignores its

input and runs M on w

  • Constructing multiple TMs: ⟨M⟩ ↦ ⟨M, M′⟩ where M′ is a TM such that

L(M′) = Σ∗ Anything that a TM can do without looping, including running deciders, is permissible

7 / 41

slide-25
SLIDE 25

Examples of computable functions

  • Arithmetic: ⟨k, m, n⟩ ↦ ⟨k ⋅ m − 67n⟩ where k, m, n ∈ Z

The corresponding TM performs the arithmetic and then copies the result to the beginning of the tape and clears the rest

  • Converting a grammar to CNF: ⟨G⟩ ↦ ⟨G′⟩ where L(G) = L(G′) and G′ is in

CNF The corresponding TM performs the conversion to CNF algorithm

  • Constructing new TMs: ⟨M, w⟩ ↦ ⟨M′⟩ where M′ is the TM that ignores its

input and runs M on w

  • Constructing multiple TMs: ⟨M⟩ ↦ ⟨M, M′⟩ where M′ is a TM such that

L(M′) = Σ∗ Anything that a TM can do without looping, including running deciders, is permissible If the form of the input is wrong (e.g., if the TM is expecting ⟨M, w⟩ but gets something else), then it clears the tape and halts (i.e., outputs ε)

7 / 41

slide-26
SLIDE 26

Mapping reducibility

Language A is mapping reducible to language B, written A ≤m B, if there exists a computable function f ∶ Σ∗ → Σ∗ such that for each w ∈ Σ∗, w ∈ A ⟺ f(w) ∈ B f ∶ Σ∗ → Σ∗ Σ∗ A B f maps elements of A to elements of B f maps elements of A to elements of B

8 / 41

slide-27
SLIDE 27

Mapping instances of problems to instances of other problems

Consider the problems

1 Is the string w recognized by the PDA P? 2 Is the string x generated by the CFG G?

We express both of these as languages, APDA and ACFG, respectively An instance of the first problem is the (representation of the) pair ⟨P, w⟩ and an instance of the second problem is ⟨G, x⟩ A mapping reduction A ≤m B takes an instance of problem A and maps it to an instance of problem B such that the solution to the latter gives the solution to the former E.g., ⟨P, w⟩ ↦ ⟨G, w⟩ where L(G) = L(P) is a computable mapping and ⟨P, w⟩ ∈ APDA ⟺ ⟨G, w⟩ ∈ ACFG so APDA ≤m ACFG

9 / 41

slide-28
SLIDE 28

Question 1

Is ACFG ≤m APDA?

10 / 41

slide-29
SLIDE 29

Question 1

Is ACFG ≤m APDA?

  • Yes. The mapping ⟨G, w⟩ ↦ ⟨P, w⟩ where L(P) = L(G) is computable because the

CFG to PDA conversion is a simple algorithm. As before, ⟨G, w⟩ ∈ ACFG ⟺ ⟨P, w⟩ ∈ APDA

10 / 41

slide-30
SLIDE 30

Question 2

Is ADFA ≤m ACFG?

11 / 41

slide-31
SLIDE 31

Question 2

Is ADFA ≤m ACFG?

  • Yes. We can convert a DFA to an equivalent CFG; i.e., ⟨M, w⟩ ↦ ⟨G, w⟩ where

L(G) = L(M) is computable and clearly ⟨M, w⟩ ∈ ADFA ⟺ ⟨G, w⟩ ∈ ACFG

11 / 41

slide-32
SLIDE 32

Question 3

Is ACFG ≤m ADFA?

12 / 41

slide-33
SLIDE 33

Question 3

Is ACFG ≤m ADFA? Perhaps counterintuitively, yes! Remember, ACFG is decidable so we can use the decider R for it when constructing our mapping T = “On input ⟨G, w⟩,

1 Run R on ⟨G, w⟩ 2 If R accepts, let M be the 1-state DFA such that L(M) = Σ∗ 3 If R rejects, let M be the 1-state DFA such that L(M) = ∅ 4 Output ⟨M, ε⟩”

This won’t loop because R is a decider. If ⟨G, w⟩ ∈ ACFG, then L(M) = Σ∗ so ⟨M, ε⟩ ∈ ADFA If ⟨G, w⟩ ∉ ACFG, then L(M) = ∅ so ⟨M, ε⟩ ∉ ADFA

12 / 41

slide-34
SLIDE 34

Mapping reductions are a stronger form of reduction

What we’ve called a reduction up until now is also called a Turing reduction

Theorem

If A ≤m B, then A ≤ B. In other words, if A ≤m B and B is decidable, then A is decidable How can we prove this?

13 / 41

slide-35
SLIDE 35

Mapping reductions are a stronger form of reduction

What we’ve called a reduction up until now is also called a Turing reduction

Theorem

If A ≤m B, then A ≤ B. In other words, if A ≤m B and B is decidable, then A is decidable How can we prove this?

Proof.

Let R be a decider for B and let f ∶ Σ∗ → Σ∗ be the mapping reduction. D = “On input w,

1 Compute f(w) 2 Run R on f(w) and if R accepts, then accept; otherwise reject”

f is computable and R is a decider so D is a decider. If w ∈ A, then f(w) ∈ B so R and thus D will accept If w ∉ A, then f(w) ∉ B so R and thus D will reject

13 / 41

slide-36
SLIDE 36

Using mapping reductions to show languages are undecidable

Just like with Turing reductions, we have a simple corollary:

Theorem

If A ≤m B and A is undecidable, then B is undecidable We typically use this fact by giving a TM that computes the mapping reduction T = “On input ⟨an instance of problem A⟩,

1 Construct an instance of problem B 2 Output ⟨the instance of problem B⟩”

Rather than accept or reject, the TM T corresponding to the mapping outputs the result

14 / 41

slide-37
SLIDE 37

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this?

15 / 41

slide-38
SLIDE 38

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this? T = “On input ⟨M⟩,

15 / 41

slide-39
SLIDE 39

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this? T = “On input ⟨M⟩,

1 Build TM M′ such that L(M′) = ∅

15 / 41

slide-40
SLIDE 40

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this? T = “On input ⟨M⟩,

1 Build TM M′ such that L(M′) = ∅ 2 Output ⟨M, M′⟩”

15 / 41

slide-41
SLIDE 41

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this? T = “On input ⟨M⟩,

1 Build TM M′ such that L(M′) = ∅ 2 Output ⟨M, M′⟩”

Note that ⟨M⟩ is an instance of ETM and ⟨M, M′⟩ is an instance of EQTM

15 / 41

slide-42
SLIDE 42

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this? T = “On input ⟨M⟩,

1 Build TM M′ such that L(M′) = ∅ 2 Output ⟨M, M′⟩”

Note that ⟨M⟩ is an instance of ETM and ⟨M, M′⟩ is an instance of EQTM We need to show that T doesn’t loop and that ⟨M⟩ ∈ ETM iff ⟨M, M′⟩ ∈ EQTM

15 / 41

slide-43
SLIDE 43

Example: ETM ≤m EQTM

Show that ETM ≤m EQTM by giving a TM T that computes the mapping How do we do this? T = “On input ⟨M⟩,

1 Build TM M′ such that L(M′) = ∅ 2 Output ⟨M, M′⟩”

Note that ⟨M⟩ is an instance of ETM and ⟨M, M′⟩ is an instance of EQTM We need to show that T doesn’t loop and that ⟨M⟩ ∈ ETM iff ⟨M, M′⟩ ∈ EQTM Neither steps 1 nor 2 loop, so T doesn’t loop Next, we have a chain of iff ⟨M⟩ ∈ ETM ⟺ L(M) = ∅ ⟺ L(M) = L(M′) ⟺ ⟨M, M′⟩ ∈ EQTM

15 / 41

slide-44
SLIDE 44

Example: ATM ≤m HaltTM

This one is more tricky: Given ⟨M, w⟩ (an instance of ATM), we need to construct ⟨M′, w⟩ such that M accepts w iff M′ halts on w How can we do this?

16 / 41

slide-45
SLIDE 45

Example: ATM ≤m HaltTM

This one is more tricky: Given ⟨M, w⟩ (an instance of ATM), we need to construct ⟨M′, w⟩ such that M accepts w iff M′ halts on w How can we do this? T = “On input ⟨M, w⟩,

1 Construct a new TM M′ = ‘On input x, 1 Run M on x 2 If M accepts, then accept 3 If M rejects, then loop’ 2 Output ⟨M′, w⟩”

16 / 41

slide-46
SLIDE 46

Example: ATM ≤m HaltTM

This one is more tricky: Given ⟨M, w⟩ (an instance of ATM), we need to construct ⟨M′, w⟩ such that M accepts w iff M′ halts on w How can we do this? T = “On input ⟨M, w⟩,

1 Construct a new TM M′ = ‘On input x, 1 Run M on x 2 If M accepts, then accept 3 If M rejects, then loop’ 2 Output ⟨M′, w⟩”

Constructing the TM M′ can’t loop so T can’t loop If ⟨M, w⟩ ∈ ATM, then M accepts w so M′ accepts and thus halts on w so ⟨M′, w⟩ ∈ HaltTM If ⟨M, w⟩ ∉ ATM, then either M rejects or loops on w and in either case, M′ loops on w [why?] so ⟨M′, w⟩ ∉ HaltTM

16 / 41

slide-47
SLIDE 47

Example: EQCFG ≤m EQTM

How do we show this?

17 / 41

slide-48
SLIDE 48

Example: EQCFG ≤m EQTM

How do we show this? T = “On input ⟨G1, G2⟩,

1 Construct TM M1 s.t. L(M1) = L(G1) (we can use the decider for ACFG to do

this)

2 Construct TM M2 s.t. L(M2) = L(G2) 3 Output ⟨M1, M2⟩”

Now what?

17 / 41

slide-49
SLIDE 49

Example: EQCFG ≤m EQTM

How do we show this? T = “On input ⟨G1, G2⟩,

1 Construct TM M1 s.t. L(M1) = L(G1) (we can use the decider for ACFG to do

this)

2 Construct TM M2 s.t. L(M2) = L(G2) 3 Output ⟨M1, M2⟩”

Now what? T can’t loop because it’s just constructing two TMs Since L(Gi) = L(Mi), ⟨G1, G2⟩ ∈ EQCFG ⟺ L(G1) = L(G2) ⟺ L(M1) = L(M2) ⟺ ⟨M1, M2⟩ ∈ EQTM

17 / 41

slide-50
SLIDE 50

Mapping reductions between RE languages

Theorem

If A ≤m B and B is Turing-recognizable, then A is Turing-recognizable. How do we prove this?

18 / 41

slide-51
SLIDE 51

Mapping reductions between RE languages

Theorem

If A ≤m B and B is Turing-recognizable, then A is Turing-recognizable. How do we prove this? Same construction as for the decidable case.

Proof.

Let R be a TM such that L(R) = B and f ∶ Σ∗ → Σ∗ be the computable mapping. Build TM M to recognize A: M = “On input w,

1 Run R on f(w). If R accepts, then accept; if R rejects, then reject”

Now we just need to show that L(M) = A w ∈ A ⟺ f(w) ∈ B ⟺ R accepts f(w) ⟺ M accepts w.

18 / 41

slide-52
SLIDE 52

Proving that a language is not RE

Theorem

If A ≤m B and A is not Turing-recognizable, then B is not Turing-recognizable Why?

19 / 41

slide-53
SLIDE 53

Proving that a language is not RE

Theorem

If A ≤m B and A is not Turing-recognizable, then B is not Turing-recognizable Why?

Proof.

If B were RE, then by the previous theorem, A would be RE.

19 / 41

slide-54
SLIDE 54

Mapping reduction between complements

Theorem

If A ≤m B, then A ≤m B with the reduction given by the same mapping. We just use the fact that if f is the computable mapping, then w ∈ A ⟺ f(w) ∈ B

20 / 41

slide-55
SLIDE 55

Mapping reduction between complements

Theorem

If A ≤m B, then A ≤m B with the reduction given by the same mapping. We just use the fact that if f is the computable mapping, then w ∈ A ⟺ f(w) ∈ B

Proof.

Let f be the mapping reduction from A to B. Then w ∈ A ⟺ w ∉ A ⟺ f(w) ∉ B ⟺ f(w) ∈ B.

20 / 41

slide-56
SLIDE 56

coRE

Theorem

If A ≤m B and B is co-Turing-recognizable, then A is co-Turing-recognizable. Why?

21 / 41

slide-57
SLIDE 57

coRE

Theorem

If A ≤m B and B is co-Turing-recognizable, then A is co-Turing-recognizable. Why?

Proof.

By the previous theorem, A ≤m B. Since B is coRE, B is RE and thus A is RE. Therefore, A is coRE.

21 / 41

slide-58
SLIDE 58

Not coRE

Theorem

If A ≤m B and A is not co-Turing-recognizable, then B is not co-Turing-recognizable.

Proof.

If B were coRE, then A would be coRE by the previous theorem.

22 / 41

slide-59
SLIDE 59

Recapitulate our results

A and B are languages and A ≤m B.

Good-news reductions

  • If B is decidable, then A is decidable
  • If B is RE, then A is RE
  • If B is coRE, then A is coRE

Bad-news reductions

  • If A is not decidable, then B is not decidable
  • If A is not RE, then B is not RE
  • If A is not coRE, then B is not coRE

23 / 41

slide-60
SLIDE 60

Example

Show ATM ≤m ETM

24 / 41

slide-61
SLIDE 61

Example

Show ATM ≤m ETM We need to give a TM that takes as input an instance of ATM and outputs an instance

  • f ETM

24 / 41

slide-62
SLIDE 62

Example

Show ATM ≤m ETM We need to give a TM that takes as input an instance of ATM and outputs an instance

  • f ETM

T = “On input ⟨M, w⟩,

1 Construct TM Mw = ‘On input x, 1 Ignore x and run M on w. If M accepts, then accept; if M rejects, then reject’ 2 Output ⟨Mw⟩”

This is clearly computable (i.e., T doesn’t loop) Now we just need to show that ⟨M, w⟩ ∈ ATM iff ⟨Mw⟩ ∈ ETM

24 / 41

slide-63
SLIDE 63

Example

Show ATM ≤m ETM We need to give a TM that takes as input an instance of ATM and outputs an instance

  • f ETM

T = “On input ⟨M, w⟩,

1 Construct TM Mw = ‘On input x, 1 Ignore x and run M on w. If M accepts, then accept; if M rejects, then reject’ 2 Output ⟨Mw⟩”

This is clearly computable (i.e., T doesn’t loop) Now we just need to show that ⟨M, w⟩ ∈ ATM iff ⟨Mw⟩ ∈ ETM If ⟨M, w⟩ ∈ ATM, then M accepts w so L(Mw) = Σ∗ and thus ⟨Mw⟩ ∈ ETM If ⟨M, w⟩ ∉ ATM, then M doesn’t accept w so L(Mw) = ∅ and thus ⟨Mw⟩ ∉ ETM

24 / 41

slide-64
SLIDE 64

One missing detail

What happens if the input to our T does not have the form ⟨M, w⟩?

25 / 41

slide-65
SLIDE 65

One missing detail

What happens if the input to our T does not have the form ⟨M, w⟩? We said it outputs ε but that’s actually a problem; why?

25 / 41

slide-66
SLIDE 66

One missing detail

What happens if the input to our T does not have the form ⟨M, w⟩? We said it outputs ε but that’s actually a problem; why? ε ∈ ETM We need to modify T: T = “On input w,

1 If w isn’t of the form ⟨M, w⟩, then output ⟨M′⟩ where L(M′) = ∅ 2 Otherwise, construct Mw = ‘On input x, 1 Run M on w. If M accepts, then accept; if M rejects, then reject’ 3 Output ⟨Mw⟩”

Now strings that don’t have the appropriate form for ATM are mapped to something that’s not in ETM

25 / 41

slide-67
SLIDE 67

Example

We showed that ATM ≤ ETM when we proved that ETM is undecidable; show that ATM / ≤m ETM How do we show this?

26 / 41

slide-68
SLIDE 68

Example

We showed that ATM ≤ ETM when we proved that ETM is undecidable; show that ATM / ≤m ETM How do we show this? By contradiction. Assume that ATM ≤m ETM. We previously showed that ETM is coRE so therefore ATM is coRE. But this is a contradiction because we also proved that ATM is not coRE

26 / 41

slide-69
SLIDE 69

Languages that are neither RE nor coRE

So far, we’ve seen languages like ATM that are RE but not coRE and languages like ETM that are coRE but not RE It’s reasonable to ask if a language must be either RE or coRE. The answer is no

27 / 41

slide-70
SLIDE 70

Languages that are neither RE nor coRE

So far, we’ve seen languages like ATM that are RE but not coRE and languages like ETM that are coRE but not RE It’s reasonable to ask if a language must be either RE or coRE. The answer is no The language EQTM is neither RE nor coRE To prove this, we want to find two languages A and B such that A ≤m EQTM and B ≤m EQTM where A is not RE and B is not coRE

27 / 41

slide-71
SLIDE 71

EQTM is not RE

We already showed ETM ≤m EQTM and ETM is not RE so EQTM is not RE

28 / 41

slide-72
SLIDE 72

EQTM is not coRE

This one is a bit trickier. Let’s mapping reduce ATM to EQTM How do we do this?

29 / 41

slide-73
SLIDE 73

EQTM is not coRE

This one is a bit trickier. Let’s mapping reduce ATM to EQTM How do we do this? T = “On input ⟨M, w⟩,

1 Construct TM M1 = ‘On input x, 1 If x ≠ w, then reject 2 Run M on w. If M accepts, then accept; if M rejects, then reject’ 2 Construct TM M2 = ‘On input x, 1 If x = w, then accept; otherwise reject’ 3 Output ⟨M1, M2⟩”

29 / 41

slide-74
SLIDE 74

EQTM is not coRE

This one is a bit trickier. Let’s mapping reduce ATM to EQTM How do we do this? T = “On input ⟨M, w⟩,

1 Construct TM M1 = ‘On input x, 1 If x ≠ w, then reject 2 Run M on w. If M accepts, then accept; if M rejects, then reject’ 2 Construct TM M2 = ‘On input x, 1 If x = w, then accept; otherwise reject’ 3 Output ⟨M1, M2⟩”

If ⟨M, w⟩ ∈ ATM, then M accepts w so L(M1) = {w}. If ⟨M, w⟩ ∉ ATM, then M does not accept w so L(M1) = ∅ Regardless of M, the language of M2 is L(M2) = {w}. Thus ⟨M, w⟩ ∈ ATM iff ⟨M1, M2⟩ ∈ EQTM

29 / 41

slide-75
SLIDE 75

Question 4

Is there a RE language A such that EQTM ≤m A? Why or why not?

30 / 41

slide-76
SLIDE 76

Question 4

Is there a RE language A such that EQTM ≤m A? Why or why not?

  • No. EQTM is not RE, so any A such that EQTM ≤m A is also not RE

30 / 41

slide-77
SLIDE 77

Question 5

Is there a coRE language B such that B ≤m EQTM? Why or why not?

31 / 41

slide-78
SLIDE 78

Question 5

Is there a coRE language B such that B ≤m EQTM? Why or why not?

  • Yes. We showed ETM ≤m EQTM and ETM is coRE

31 / 41

slide-79
SLIDE 79

Question 6

If C is a language and EQTM ≤m C, what can we conclude about C?

32 / 41

slide-80
SLIDE 80

Question 6

If C is a language and EQTM ≤m C, what can we conclude about C? C is neither RE nor coRE

32 / 41

slide-81
SLIDE 81

Question 7

True or false: If D ≤ E, then D ≤m E.

33 / 41

slide-82
SLIDE 82

Question 7

True or false: If D ≤ E, then D ≤m E.

  • False. ATM ≤ ETM but ATM /

≤m ETM

33 / 41

slide-83
SLIDE 83

Question 8

Tricky! If F ≤m Σ∗, what can we conclude about F?

34 / 41

slide-84
SLIDE 84

Question 8

Tricky! If F ≤m Σ∗, what can we conclude about F? F = Σ∗. Let f be the mapping. Then w ∈ F ⟺ f(w) ∈ Σ∗ For any language other than Σ∗, there’s some string x not in the language but then f(x) / ∈ Σ∗; but every string is in Σ∗

34 / 41

slide-85
SLIDE 85

Question 9

Tricky! If Σ∗ ≤m G, what can we conclude about G?

35 / 41

slide-86
SLIDE 86

Question 9

Tricky! If Σ∗ ≤m G, what can we conclude about G? We know G ≠ ∅. Since every string w ∈ Σ∗ needs to be mapped to an element of G, G cannot be empty

35 / 41

slide-87
SLIDE 87

Updated table

Before today’s lecture Language RE coRE ADFA

  • EDFA
  • EQDFA
  • ACFG
  • ECFG
  • EQCFG
  • Diag

? ? ATM

  • HaltTM

? ? ETM

  • EQTM

? ? RegularTM ? ? Now Language RE coRE ADFA

  • EDFA
  • EQDFA
  • ACFG
  • ECFG
  • EQCFG
  • Diag

? ? ATM

  • HaltTM

?

  • ETM
  • EQTM
  • RegularTM

? ?

36 / 41

slide-88
SLIDE 88

HaltTM is RE

It’s easy to show that HaltTM is RE

1 Construct a TM that recognizes HaltTM

H = “On input ⟨M, w⟩,

1 Run M on w. If M halts, then accept”

37 / 41

slide-89
SLIDE 89

HaltTM is RE

It’s easy to show that HaltTM is RE

1 Construct a TM that recognizes HaltTM

H = “On input ⟨M, w⟩,

1 Run M on w. If M halts, then accept” 2 Mapping reduce HaltTM to ATM

T = “On input ⟨M, w⟩,

1 Construct TM M ′ = ‘On input x, 1 Run M on x. If M halts, then accept’ 2 Output ⟨M ′, w⟩”

37 / 41

slide-90
SLIDE 90

Turning a Turing reduction into a mapping reduction

If the Turing reduction A ≤ B looks like: Let R decide B and construct TM M to decide A: M = “On input w,

1 Construct some instance w′ of B 2 Run R on w′ and if R accepts, then accept; otherwise reject”

38 / 41

slide-91
SLIDE 91

Turning a Turing reduction into a mapping reduction

If the Turing reduction A ≤ B looks like: Let R decide B and construct TM M to decide A: M = “On input w,

1 Construct some instance w′ of B 2 Run R on w′ and if R accepts, then accept; otherwise reject”

then we can turn that into a mapping reduction T = “On input w,

1 Construct some instance w′ of B 2 Output w′”

38 / 41

slide-92
SLIDE 92

Turning a Turing reduction into a mapping reduction

If the Turing reduction A ≤ B looks like: Let R decide B and construct TM M to decide A: M = “On input w,

1 Construct some instance w′ of B 2 Run R on w′ and if R accepts, then accept; otherwise reject”

then we can turn that into a mapping reduction T = “On input w,

1 Construct some instance w′ of B 2 Output w′”

Note that R must be used exactly one time and M accepts iff R accepts

38 / 41

slide-93
SLIDE 93

RegularTM is not coRE

We can turn our reduction ATM ≤ RegularTM into a mapping reduction ATM ≤m RegularTM

39 / 41

slide-94
SLIDE 94

RegularTM is not coRE

We can turn our reduction ATM ≤ RegularTM into a mapping reduction ATM ≤m RegularTM T = “On input ⟨M, w⟩,

1 Construct TM M′ = ‘On input x, 1 If x = 0n1n for some n, then accept 2 Otherwise, run M on w and if M accepts, then accept; if M rejects, then reject’ 2 Output ⟨M′⟩”

39 / 41

slide-95
SLIDE 95

RegularTM is not coRE

We can turn our reduction ATM ≤ RegularTM into a mapping reduction ATM ≤m RegularTM T = “On input ⟨M, w⟩,

1 Construct TM M′ = ‘On input x, 1 If x = 0n1n for some n, then accept 2 Otherwise, run M on w and if M accepts, then accept; if M rejects, then reject’ 2 Output ⟨M′⟩”

⟨M, w⟩ ∈ ATM ⟺ L(M′) = Σ∗ ⟺ L(M′) is regular ⟺ ⟨M′⟩ ∈ RegularTM ATM is not coRE, so RegularTM is not coRE

39 / 41

slide-96
SLIDE 96

RegularTM is not RE

We could reduce from ETM, but it’s simpler to reduce from ATM T = “On input s,

1 If s ≠ ⟨M, w⟩ for some TM M and input w, let M′ be a TM such that

L(M′) = ∅

2 Otherwise, construct TM M′ = ‘On input x, 1 If x ≠ 0n1n for some n, then reject 2 Run M on w and if M accepts, then accept; if M rejects, then reject’ 3 Output ⟨M′⟩”

Three cases

40 / 41

slide-97
SLIDE 97

RegularTM is not RE

We could reduce from ETM, but it’s simpler to reduce from ATM T = “On input s,

1 If s ≠ ⟨M, w⟩ for some TM M and input w, let M′ be a TM such that

L(M′) = ∅

2 Otherwise, construct TM M′ = ‘On input x, 1 If x ≠ 0n1n for some n, then reject 2 Run M on w and if M accepts, then accept; if M rejects, then reject’ 3 Output ⟨M′⟩”

Three cases

1 If s ∈ ATM but s ≠ ⟨M, w⟩, then L(M) = ∅ and ⟨M′⟩ ∈ RegularTM

40 / 41

slide-98
SLIDE 98

RegularTM is not RE

We could reduce from ETM, but it’s simpler to reduce from ATM T = “On input s,

1 If s ≠ ⟨M, w⟩ for some TM M and input w, let M′ be a TM such that

L(M′) = ∅

2 Otherwise, construct TM M′ = ‘On input x, 1 If x ≠ 0n1n for some n, then reject 2 Run M on w and if M accepts, then accept; if M rejects, then reject’ 3 Output ⟨M′⟩”

Three cases

1 If s ∈ ATM but s ≠ ⟨M, w⟩, then L(M) = ∅ and ⟨M′⟩ ∈ RegularTM 2 If s = ⟨M, w⟩ ∈ ATM, then w ∉ L(M) so L(M′) = ∅ and ⟨M′⟩ ∈ RegularTM

40 / 41

slide-99
SLIDE 99

RegularTM is not RE

We could reduce from ETM, but it’s simpler to reduce from ATM T = “On input s,

1 If s ≠ ⟨M, w⟩ for some TM M and input w, let M′ be a TM such that

L(M′) = ∅

2 Otherwise, construct TM M′ = ‘On input x, 1 If x ≠ 0n1n for some n, then reject 2 Run M on w and if M accepts, then accept; if M rejects, then reject’ 3 Output ⟨M′⟩”

Three cases

1 If s ∈ ATM but s ≠ ⟨M, w⟩, then L(M) = ∅ and ⟨M′⟩ ∈ RegularTM 2 If s = ⟨M, w⟩ ∈ ATM, then w ∉ L(M) so L(M′) = ∅ and ⟨M′⟩ ∈ RegularTM 3 If s ∉ ATM, then s = ⟨M, w⟩ and w ∈ L(M). In this case,

L(M′) = {0n1n ∣ n ≥ 0} so ⟨M′⟩ ∉ RegularTM Since ATM is not RE, RegularTM is not RE

40 / 41

slide-100
SLIDE 100

Updated table

Before today’s lecture Language RE coRE ADFA

  • EDFA
  • EQDFA
  • ACFG
  • ECFG
  • EQCFG
  • Diag

? ? ATM

  • HaltTM

? ? ETM

  • EQTM

? ? RegularTM ? ? Now Language RE coRE ADFA

  • EDFA
  • EQDFA
  • ACFG
  • ECFG
  • EQCFG
  • Diag

? ? ATM

  • HaltTM
  • ETM
  • EQTM
  • RegularTM
  • 41 / 41