+ - 0:00:00
Notes for current slide
Notes for next slide

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

CS420

Introduction to the Theory of Computation

Lecture 26: Mapping reducibility

Tiago Cogumbreiro

1 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

How to write a 21st century proof

Leslie Lamport

A method of writing proofs is described that makes it harder to prove things that are not true. The method, based on hierarchical structuring, is simple and practical. The author’s twenty years of experience writing such proofs is discussed.

Source: lamport.azurewebsites.net/pubs/proof.pdf

Why should we read this?

  • Structured proofs are just a method of displaying your proofs in a brief, yet rigorous way
  • I will be doing structured proofs in this lesson, you can use this method of presenting proofs in the test!
2 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Today we will learn…

  • Computable functions
  • Mapping reducible
  • Mapping reducibility and decidability/undecidability
  • Mapping reducibility and Turing recognition/unrecognition

Section 5.3.

3 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \}

Proof. If AA is regular, then let CC be the DFA that recognizes AA. Let intersect be the implementation of \cap and E_DFA the decider of EDFAE_{DFA}. The following is the decider of XAX_A.

def X_A(D):
return not E_DFA(intersect(C, D))

We reduced the problem of checking if XAX_A is decidable in terms of checking if EDFAE_{DFA}.

Can we generalize this process?

4 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \}

Proof (2nd try).

  1. Let L1(D)=L(D)AL_1(D) = L(D) \cap A where DD is a DFA.
5 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \}

Proof (2nd try).

  1. Let L1(D)=L(D)AL_1(D) = L(D) \cap A where DD is a DFA.
  2. For any DD we have that L1(D)L_1(D) is regular. (Proof?)
5 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \}

Proof (2nd try).

  1. Let L1(D)=L(D)AL_1(D) = L(D) \cap A where DD is a DFA.
  2. For any DD we have that L1(D)L_1(D) is regular. (Proof?)
  3. Let DDAD_{DA} be the DFA that recognizes L1(D)L_1(D). (Proof?)
5 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \}

Proof (2nd try).

  1. Let L1(D)=L(D)AL_1(D) = L(D) \cap A where DD is a DFA.
  2. For any DD we have that L1(D)L_1(D) is regular. (Proof?)
  3. Let DDAD_{DA} be the DFA that recognizes L1(D)L_1(D). (Proof?)
  4. DXA\langle D \rangle \in X_A iff L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}} (Proof?) ^\dagger
5 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \}

Proof (2nd try).

  1. Let L1(D)=L(D)AL_1(D) = L(D) \cap A where DD is a DFA.
  2. For any DD we have that L1(D)L_1(D) is regular. (Proof?)
  3. Let DDAD_{DA} be the DFA that recognizes L1(D)L_1(D). (Proof?)
  4. DXA\langle D \rangle \in X_A iff L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}} (Proof?) ^\dagger
  5. The test L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}} is decidable, and equivalent to testing DXA\langle D \rangle \in X_A, so the latter is decidable?

^\dagger: Recall that if AA decidable, then A\overline A decidable (Lesson 21).

5 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Mapping reducibility

Intuition

If we can establish an equivalence up to some function, then we can reduce a problem into another known problem solved in another language.

Example

  1. (Mapping-reducibility): DXA\langle D \rangle \in X_A iff L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}}
  2. (Decidability): The test L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}} is decidable, and equivalent to testing DXA\langle D \rangle \in X_A, so the latter is decidable?

We will now implement a framework on reducibility

6 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Mapping reducibility

7 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Computable function

Definition 5.17

We say that

f:ΣΣf: \Sigma^\star \longrightarrow \Sigma^\star

is a computable function if there exists a Turing Machine MM that when given ww halts and results in f(w)f(w) on its tape.

Intuition

This is a total function (terminates for all inputs) encoded in terms of a Turing Machine.

8 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Mapping reducible

Definition 5.20

Language AA is mapping reducible to language BB, notation AmBA \le_\mathrm{m} B if there is a computable function ff, where for every ww,

wA    f(w)Bw \in A \iff f(w) \in B

What can we do with mapping reducible?

  • Convert membership testing in AA into membership testing in BB
9 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \} EDFA={DD is a DFAL(D)=}E_{\mathrm{DFA}} = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) = \emptyset \}

We show that XAmEDFAX_A \le_\mathrm{m} \overline E_{\mathrm{DFA}}.

  1. Given a DFA DD let L1(D)L_1(D) be the DFA that recognizes L(D)AL(D) \cap A, where AA is regular.
  2. We show that XAmEDFAX_A \le_\mathrm{m} \overline E_{\mathrm{DFA}}
10 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example

XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \} EDFA={DD is a DFAL(D)=}E_{\mathrm{DFA}} = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) = \emptyset \}

We show that XAmEDFAX_A \le_\mathrm{m} \overline E_{\mathrm{DFA}}.

  1. Given a DFA DD let L1(D)L_1(D) be the DFA that recognizes L(D)AL(D) \cap A, where AA is regular.
  2. We show that XAmEDFAX_A \le_\mathrm{m} \overline E_{\mathrm{DFA}}
    • Show: If DXA\langle D \rangle \in X_A, then L1(D)EDFA\langle L_1(D) \rangle \in \overline E_{\mathrm{DFA}}.
      1. L(D)AL(D) \cap A \neq \emptyset (assumption)
      2. L1(D)EDFA\langle L_1(D) \rangle \in \overline E_{\mathrm{DFA}} (by 2.1)
    • Show: If L1(D)EDFA\langle L_1(D) \rangle \in \overline E_{\mathrm{DFA}}, then DXA\langle D \rangle \in X_A.
      1. DXA\langle D\rangle \in X_A by L1(D)L_1(D) \neq \emptyset (assumption)
10 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Ungraded homework exercises

  1. Show that m\le_\mathrm{m} is a reflexive relation.
  2. Show that m\le_\mathrm{m} is a transitive relation.
11 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Motivation

If AA is regular, then XAX_A decidable.

Proof (2nd try).

  1. Let L1(D)=L(D)AL_1(D) = L(D) \cap A where DD is a DFA.
  2. For any DD we have that L1(D)L_1(D) is regular. (Proof?)
  3. Let DD be the DFA that recognizes L1L_1. (Proof?)
  4. XAmEDFA\color{purple} X_A \le_\mathrm{m} \overline E_{\mathrm{DFA}} (Before: DXA\langle D \rangle \in X_A iff L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}} )
  5. The test L1(D)EDFA\langle L_1(D)\rangle \in \overline E_{\mathrm{DFA}} is decidable, and equivalent to testing DXA\langle D \rangle \in X_A, so the latter is decidable?


We will now generalize the (5) step

12 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

If AmBA \le_\mathrm{m} B and BB is decidable, then AA is decidable.

Proof in cogumbreiro/turing.

13 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Completing the running example

If AA regular, then XA={DD is a DFAL(D)A}X_A = \{ \langle D \rangle \mid D \text{ is a DFA} \land L(D) \cap A \neq \emptyset \} decidable.

Proof (3rd try).

  1. For any DD we have that LDA=L(D)AL_{DA} = L(D) \cap A is regular, since:
    • For any DFA DD we have that L(D)AL(D) \cap A is regular, since regular langs are closed for \cap, L(D)L(D) is regular (def of reg langs), and AA is regular (assumption).
  2. XAmEDFAX_A \le_\mathrm{m} \overline E_{\mathrm{DFA}}, by Slide 9
  3. EDFA\overline E_{\mathrm{DFA}} is decidable, by Lemma R.4 and EDFAE_{\mathrm{DFA}} decidable (Theorem 4.4)
  4. XAX_A is decidable, by Theorem 5.22, EDFA\overline E_{\mathrm{DFA}} is decidable, and XAmEDFAX_A \le_\mathrm{m} \overline E_{\mathrm{DFA}} (2)

Lemma R.4 (Lesson 21). If AA decidable, then A\overline A decidable.

14 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Undecidability on membership reducible

Corollary 5.23

If AmBA \le_\mathrm{m} B and AA is undecidable, then BB is undecidable.

Proof.

15 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Undecidability on membership reducible

Corollary 5.23

If AmBA \le_\mathrm{m} B and AA is undecidable, then BB is undecidable.

Proof.

  1. BB is decidable, by contradiction.
  2. AA is decidable, by Theorem 5.22 and AmBA \le_\mathrm{m} B (assumption) and BB decidable (1)
  3. We reach a contradiction: AA is decidable (2) and undecidable (assumption).

(1)

H0: A <=m B
H1: ~ Decidable A
----------------
~ Decidable B

(2)

H0: A <=m B
H1: ~ Decidable A
H2: Decidable B
----------------
False

(3)

H0: A <=m B
H1: ~ Decidable A
H2: Decidable B
H3: Decidable A
----------------
False
15 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24

  • ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM} holds^\dagger.
  • Show that HALTTMHALT_\mathsf{TM} is undecidable.
16 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24

  • ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM} holds^\dagger.
  • Show that HALTTMHALT_\mathsf{TM} is undecidable.
  1. Apply Corollary 5.23 since ATMA_\mathsf{TM} is undecidable (Theorem 4.11) and ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM} (hypothesis).

^\dagger Proof in cogumbreiro/turing.

16 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Exercise

  • ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM}

Show that ATMA_\mathsf{TM} is recognizable via mapping reducibility.

17 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Exercise

  • ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM}

Show that ATMA_\mathsf{TM} is recognizable via mapping reducibility.

Proof.

  1. Give a program that recognizes HALTTMHALT_\mathsf{TM} (homework!)
  2. ATMA_\mathsf{TM}, by Theorem 5.28, ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM}, and (1).
17 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Corollary 5.29

If AA is unrecognizable and AmBA \le_{\mathrm{m}} B, then BB is unrecognizable.

Theorem R.1

If AmBA \le_{\mathrm{m}} B, then AmB\overline A \le_{\mathrm{m}} \overline B.


Exercise

Show that HALTTM\overline{HALT}_\mathsf{TM} is unrecognizable.

18 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Corollary 5.29

If AA is unrecognizable and AmBA \le_{\mathrm{m}} B, then BB is unrecognizable.

Theorem R.1

If AmBA \le_{\mathrm{m}} B, then AmB\overline A \le_{\mathrm{m}} \overline B.


Exercise

Show that HALTTM\overline{HALT}_\mathsf{TM} is unrecognizable.

Proof.

  1. ATMmHALTTM\overline{A}_\mathsf{TM} \le_{\mathrm{m}} \overline{HALT}_\mathsf{TM}, by Theorem R.1 and ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM} (exercise 5.24)
  2. HALTTM\overline{HALT}_\mathsf{TM} is unrecognizable, by Corollary 5.29, ATMmHALTTM\overline{A}_\mathsf{TM} \le_{\mathrm{m}} \overline{HALT}_\mathsf{TM} (1), and ATM\overline{A}_\mathsf{TM} is unrecognizable (Corollary 4.23)
18 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Extra proofs

19 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

If AmBA \le_\mathrm{m} B and BB is decidable, then AA is decidable.

Proof.

20 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

If AmBA \le_\mathrm{m} B and BB is decidable, then AA is decidable.

Proof.

  1. BB is decidable, so let MBM_B be its decider.
  2. Let MAM_A be a turing machine defined as: MA(w)=MB(f(w))M_A(w) = M_B(f(w))
    Run MBM_B with input f(w)f(w). If MBM_B accepts, MAM_A accepts. If MBM_B rejects, MAM_A rejects.
  3. Correctness: Prove that L(MA)=AL(M_A) = A (next slide)
  4. Termination: Prove that MAM_A halts for every input:
20 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

If AmBA \le_\mathrm{m} B and BB is decidable, then AA is decidable.

Proof.

  1. BB is decidable, so let MBM_B be its decider.
  2. Let MAM_A be a turing machine defined as: MA(w)=MB(f(w))M_A(w) = M_B(f(w))
    Run MBM_B with input f(w)f(w). If MBM_B accepts, MAM_A accepts. If MBM_B rejects, MAM_A rejects.
  3. Correctness: Prove that L(MA)=AL(M_A) = A (next slide)
  4. Termination: Prove that MAM_A halts for every input: MAM_A just runs MBM_B, which halts for every input.

Our goal is show that there exists a Turing machine that decides AA, so we must prove that it does recognize AA (correctness) and that it decides AA (termination).

20 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

Proof (Continuation). Show that L(MA)=AL(M_A) = A.

We do a case analysis on the result of executing MAM_A with input ww and show that ww is (not) in AA:

21 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

Proof (Continuation). Show that L(MA)=AL(M_A) = A.

We do a case analysis on the result of executing MAM_A with input ww and show that ww is (not) in AA:

  • If MAM_A accepts some ww we must show that wAw \in A. From MBM_B, we get that f(w)L(B)f(w) \in L(B), thus, from Def 5.20, we have wAw \in A.
21 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Decidability on membership reducible

Theorem 5.22

Proof (Continuation). Show that L(MA)=AL(M_A) = A.

We do a case analysis on the result of executing MAM_A with input ww and show that ww is (not) in AA:

  • If MAM_A accepts some ww we must show that wAw \in A. From MBM_B, we get that f(w)L(B)f(w) \in L(B), thus, from Def 5.20, we have wAw \in A.

  • If MAM_A rejects some ww we must show that wAw \notin A. If reject, then f(w)L(B)f(w) \notin L(B), thus, from Def 5.20, we have wAw \notin A.

21 / 35

TODO: WHY NOT wAw \in A implies ww accepted by MAM_A

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Proof.

  1. We show that ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM} with ff, where f(M,w)=M,wf(\langle M, w \rangle) = \langle M', w \rangle and MM' runs M(w)M(w) if MM rejects, then loop, otherwise accept.
  2. Since ATMA_\mathsf{TM} is undecidable, then HALTTMHALT_\mathsf{TM} is undecidable (Corollary 5.23).

Unfold Def 5.20:

M,wATM    f(M,w)HALTTM\langle M,w\rangle \in A_\mathsf{TM} \iff f(\langle M,w \rangle) \in HALT_\mathsf{TM}
22 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Proof.

  1. We show that ATMmHALTTMA_\mathsf{TM} \le_{\mathrm{m}} HALT_\mathsf{TM} with ff, where f(M,w)=M,wf(\langle M, w \rangle) = \langle M', w \rangle and MM' runs M(w)M(w) if MM rejects, then loop, otherwise accept.
  2. Since ATMA_\mathsf{TM} is undecidable, then HALTTMHALT_\mathsf{TM} is undecidable (Corollary 5.23).

Unfold Def 5.20:

M,wATM    f(M,w)HALTTM\langle M,w\rangle \in A_\mathsf{TM} \iff f(\langle M,w \rangle) \in HALT_\mathsf{TM}

Step 1: M,wATM    f(M,w)HALTTM\langle M,w\rangle \in A_\mathsf{TM} \implies f(\langle M,w \rangle) \in HALT_\mathsf{TM}

Step 2: f(M,w)HALTTM    M,wATMf(\langle M,w \rangle) \in HALT_\mathsf{TM} \implies \langle M,w\rangle \in A_\mathsf{TM}

22 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}

and that MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.


Proof (continuation).

Step 1. M,wATM    f(M,w)HALTTM\langle M,w\rangle \in A_\mathsf{TM} \implies f(\langle M,w \rangle) \in HALT_\mathsf{TM}.

23 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}

and that MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.


Proof (continuation).

Step 1. M,wATM    f(M,w)HALTTM\langle M,w\rangle \in A_\mathsf{TM} \implies f(\langle M,w \rangle) \in HALT_\mathsf{TM}.

  • Since M,wATM\langle M,w\rangle \in A_\mathsf{TM}, then MM accepts ww.
23 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}

and that MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.


Proof (continuation).

Step 1. M,wATM    f(M,w)HALTTM\langle M,w\rangle \in A_\mathsf{TM} \implies f(\langle M,w \rangle) \in HALT_\mathsf{TM}.

  • Since M,wATM\langle M,w\rangle \in A_\mathsf{TM}, then MM accepts ww.
  • Thus, MM' halts, and therefore M,wHALTTM\langle M', w \rangle \in HALT_\mathsf{TM}
23 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

  1. HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}
  2. MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.

Proof (continuation).

Step 2. We have f(M,w)=M,wHALTTMf(\langle M,w \rangle) = \langle M', w \rangle \in HALT_\mathsf{TM} and must show M,wATM\langle M,w\rangle \in A_\mathsf{TM}.

24 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

  1. HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}
  2. MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.

Proof (continuation).

Step 2. We have f(M,w)=M,wHALTTMf(\langle M,w \rangle) = \langle M', w \rangle \in HALT_\mathsf{TM} and must show M,wATM\langle M,w\rangle \in A_\mathsf{TM}.

  • Since f(M,w)HALTTMf(\langle M,w \rangle) \in HALT_\mathsf{TM} and (1), then MM' halts.
24 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

  1. HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}
  2. MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.

Proof (continuation).

Step 2. We have f(M,w)=M,wHALTTMf(\langle M,w \rangle) = \langle M', w \rangle \in HALT_\mathsf{TM} and must show M,wATM\langle M,w\rangle \in A_\mathsf{TM}.

  • Since f(M,w)HALTTMf(\langle M,w \rangle) \in HALT_\mathsf{TM} and (1), then MM' halts.

  • Thus, MM' accepts,

24 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Example 5.24

HALTTMHALT_\mathsf{TM} is undecidable

Recall that:

  1. HALTTM={M,wM is a TM and M halts on input w}HALT_{\mathsf{TM}} = \{ \langle M, w \rangle \mid M \text{ is a TM and } M \text{ halts on input } w \}
  2. MM' runs M(w)M(w) if MM reject, then loop, otherwise accept.

Proof (continuation).

Step 2. We have f(M,w)=M,wHALTTMf(\langle M,w \rangle) = \langle M', w \rangle \in HALT_\mathsf{TM} and must show M,wATM\langle M,w\rangle \in A_\mathsf{TM}.

  • Since f(M,w)HALTTMf(\langle M,w \rangle) \in HALT_\mathsf{TM} and (1), then MM' halts.

  • Thus, MM' accepts, and since MM' only accepts when MM accepts ww, we conclude our proof.

24 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Detailed proof.

We must show that there exists some MAM_A that recognizes AA.

25 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Detailed proof.

We must show that there exists some MAM_A that recognizes AA.

  1. Let MA(w)=MB(f(w))M_A(w) = M_B(f(w)).
    That is, machine MAM_A given ww computes f(w)f(w) and accepts.
  2. Show that L(MA)=AL(M_A)=A.
    • Step 1: If MAM_A accepts ww, then wAw \in A.
    • Step 2: If wAw \in A, then MAM_A accepts ww.
25 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Proof (Step 1).

Hypothesis
H1 MAM_A accepts ww
H2 wA    f(w)Bw \in A \iff f(w) \in B
H3 MBM_B recognizes BB
H4 MA(w)=MB(f(w))M_A(w) = M_B(f(w))

Goal: show that wAw \in A

  1. Since (H1) MAM_A accept ww and H4, we have that MBM_B accepts f(w)f(w).
26 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Proof (Step 1).

Hypothesis
H1 MAM_A accepts ww
H2 wA    f(w)Bw \in A \iff f(w) \in B
H3 MBM_B recognizes BB
H4 MA(w)=MB(f(w))M_A(w) = M_B(f(w))

Goal: show that wAw \in A

  1. Since (H1) MAM_A accept ww and H4, we have that MBM_B accepts f(w)f(w).

  2. From MBM_B accepts f(w)f(w) and H3, we get f(w)Bf(w) \in B.

26 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Proof (Step 1).

Hypothesis
H1 MAM_A accepts ww
H2 wA    f(w)Bw \in A \iff f(w) \in B
H3 MBM_B recognizes BB
H4 MA(w)=MB(f(w))M_A(w) = M_B(f(w))

Goal: show that wAw \in A

  1. Since (H1) MAM_A accept ww and H4, we have that MBM_B accepts f(w)f(w).

  2. From MBM_B accepts f(w)f(w) and H3, we get f(w)Bf(w) \in B.

  3. Since f(w)Bf(w) \in B and H2, then wAw \in A.

26 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Proof. (Step 2)

Hypothesis
H0 wAw \in A
H1 wA    f(w)Bw \in A \iff f(w) \in B
H2 MBM_B recognizes BB
H3 MA(w)=MB(f(w))M_A(w) = M_B(f(w))

Goal: show that MAM_A accepts ww.

27 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Proof. (Step 2)

Hypothesis
H0 wAw \in A
H1 wA    f(w)Bw \in A \iff f(w) \in B
H2 MBM_B recognizes BB
H3 MA(w)=MB(f(w))M_A(w) = M_B(f(w))

Goal: show that MAM_A accepts ww.

  1. From (H1) wAw \in A and H2, we have that f(w)Bf(w) \in B.
  2. From f(w)Bf(w) \in B and H3, we have that MBM_B accepts f(w)f(w)
  3. From MBM_B accepts f(w)f(w) and H4, we have that MAM_A accepts ww.
27 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Detailed proof.

We must show that there exists some MAM_A that recognizes AA.

28 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Theorem 5.28

If AmBA \le_{\mathrm{m}} B and BB is recognizable, then AA is recognizable.

Detailed proof.

We must show that there exists some MAM_A that recognizes AA.

  1. Let MA(w)=MB(f(w))M_A(w) = M_B(f(w)).
    That is, machine MAM_A given ww computes f(w)f(w) and accepts.
  2. Show that L(MA)=AL(M_A)=A.
    • Step 1: If MAM_A accepts ww, then wAw \in A.
    • Step 2: If wAw \in A, then MAM_A accepts ww.
28 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Homework 8

29 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

30 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24 (Proof)

Use Corollary 5.23.

  1. ATMmHALTTMA_{\mathsf{TM}} \le_{\mathrm{m}} HALT_{\mathsf{TM}} (next slide)
  2. ATMA_{\mathsf{TM}} is undecidable by Theorem 4.11 (Lesson 21)
Theorem example_5_24:
~ Decidable HALT_tm.
Proof.
apply reducible_undecidable with (A:=A_tm).
- apply A_tm_red_HALT_tm.
- apply a_tm_undecidable.
Qed.
31 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24 (Proof)

The mapping function is given in the book. We separate the construction of MM' into its own function just so we can prove theorems more simply.

(* Construct the following machine *)
Definition A_tm_looper M := Build (
fun x => (* On input x: *)
mlet r <- Call M x in (* 1. Run M on x *)
if r then ACCEPT (* 2. If M accepts, accept *)
else LOOP). (* 3. If M rejects, enter a loop. *)
Definition A_tm_to_HALT_tm p:=
(* On input <[ M, w ]> *)
let (M, w) := decode_machine_input p in
(* 1. Construct the following machine M' *)
let M' := A_tm_looper M w in
(* 2. Output <[ M', w ]> *)
<[ M', w ]>.
32 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24 (Proof)

  1. Show that if F(w)HALTTMF(w) \in HALT_{TM}, then wATMw \in A_{TM}.
  2. Show that if wATMw \in A_{TM}, then F(w)HALTTMF(w) \in HALT_{TM}.
Theorem A_tm_red_HALT_tm: A_tm <=m HALT_tm.
Proof.
apply reducible_iff with A_tm_to_HALT_tm.
split; intros.
- apply A_tm_red_HALT_tm_1; auto.
- apply A_tm_red_HALT_tm_2; auto.
Qed.
33 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24 (Proof)

Structure of the proof

  1. Simplify assumption wATMw \in A_{TM} (with inversion theorem)
    • We get that w=M,iw = \langle M, i\rangle for some MM and ii
    • We get that MM accepts ii
  2. Show F(M,i)HALTTMF(\langle M, i\rangle) \in HALT_{TM} (with constructor _def theorem)
    • F(M,i)=looper(M),iF(\langle M, i \rangle) = \langle looper(M), i\rangle
    • Show that looper(M)looper(M) does not loop when MM accepts
Lemma A_tm_red_HALT_tm_1:
forall w,
A_tm w ->
HALT_tm (A_tm_to_HALT_tm w).
34 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

Exercise 5.24 (Proof)

  1. Simplify assumption F(w)HALTTMF(w) \in HALT_{TM} (by inverting with _inv)

    • Obtain F(w)=M,iF(w) = \langle M', i\rangle for some MM' and ii (invert)

      • Obtain that w=M,iw = \langle M, i \rangle for some MM
      • Obtain that M=looper(M)M' = looper(M)
    • Obtain that MM' does not loop with ii

      • Thus, MM accepts ii
  2. Show wATMw \in A_{TM} (construct goal using _def theorem)

    • Since MM accepts ii and w=M,iw = \langle M, i\rangle
Lemma A_tm_red_HALT_tm_2:
forall w,
HALT_tm (A_tm_to_HALT_tm w) ->
A_tm w.
35 / 35

CS420  ☽  Mapping reducibility  ☽  Lecture 26  ☽  Tiago Cogumbreiro

How to write a 21st century proof

Leslie Lamport

A method of writing proofs is described that makes it harder to prove things that are not true. The method, based on hierarchical structuring, is simple and practical. The author’s twenty years of experience writing such proofs is discussed.

Source: lamport.azurewebsites.net/pubs/proof.pdf

Why should we read this?

  • Structured proofs are just a method of displaying your proofs in a brief, yet rigorous way
  • I will be doing structured proofs in this lesson, you can use this method of presenting proofs in the test!
2 / 35
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow