CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
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
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Section 5.3.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅}Proof. If A is regular, then let C be the DFA that recognizes A. Let
intersect
be the implementation of ∩ and E_DFA
the decider of
EDFA. The following is the decider of XA.
def X_A(D): return not E_DFA(intersect(C, D))
We reduced the problem of checking if XA is decidable in terms of checking if EDFA.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅}Proof (2nd try).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅}Proof (2nd try).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅}Proof (2nd try).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅}Proof (2nd try).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅}Proof (2nd try).
†: Recall that if A decidable, then A decidable (Lesson 21).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If we can establish an equivalence up to some function, then we can reduce a problem into another known problem solved in another language.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
We say that
f:Σ⋆⟶Σ⋆is a computable function if there exists a Turing Machine M that when given w halts and results in f(w) on its tape.
This is a total function (terminates for all inputs) encoded in terms of a Turing Machine.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Language A is mapping reducible to language B, notation A≤mB if there is a computable function f, where for every w,
w∈A⟺f(w)∈BCS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
We show that XA≤mEDFA.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
We show that XA≤mEDFA.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is regular, then XA decidable.
Proof (2nd try).
The test ⟨L1(D)⟩∈EDFA is decidable, and equivalent to testing ⟨D⟩∈XA, so the latter is decidable?
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is decidable, then A is decidable.
Proof in cogumbreiro/turing
.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A regular, then XA={⟨D⟩∣D is a DFA∧L(D)∩A=∅} decidable.
Proof (3rd try).
Lemma R.4 (Lesson 21). If A decidable, then A decidable.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and A is undecidable, then B is undecidable.
Proof.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and A is undecidable, then B is undecidable.
Proof.
(1)
H0: A <=m BH1: ~ Decidable A----------------~ Decidable B
(2)
H0: A <=m BH1: ~ Decidable AH2: Decidable B----------------False
(3)
H0: A <=m BH1: ~ Decidable AH2: Decidable BH3: Decidable A----------------False
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
† Proof in cogumbreiro/turing
.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Show that ATM is recognizable via mapping reducibility.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Show that ATM is recognizable via mapping reducibility.
Proof.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is unrecognizable and A≤mB, then B is unrecognizable.
If A≤mB, then A≤mB.
Show that HALTTM is unrecognizable.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A is unrecognizable and A≤mB, then B is unrecognizable.
If A≤mB, then A≤mB.
Show that HALTTM is unrecognizable.
Proof.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is decidable, then A is decidable.
Proof.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is decidable, then A is decidable.
Proof.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is decidable, then A is decidable.
Proof.
Our goal is show that there exists a Turing machine that decides A, so we must prove that it does recognize A (correctness) and that it decides A (termination).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Proof (Continuation). Show that L(MA)=A.
We do a case analysis on the result of executing MA with input w and show that w is (not) in A:
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Proof (Continuation). Show that L(MA)=A.
We do a case analysis on the result of executing MA with input w and show that w is (not) in A:
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Proof (Continuation). Show that L(MA)=A.
We do a case analysis on the result of executing MA with input w and show that w is (not) in A:
If MA accepts some w we must show that w∈A. From MB, we get that f(w)∈L(B), thus, from Def 5.20, we have w∈A.
If MA rejects some w we must show that w∈/A. If reject, then f(w)∈/L(B), thus, from Def 5.20, we have w∈/A.
TODO: WHY NOT w∈A implies w accepted by MA
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Proof.
Unfold Def 5.20:
⟨M,w⟩∈ATM⟺f(⟨M,w⟩)∈HALTTMCS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Proof.
Unfold Def 5.20:
⟨M,w⟩∈ATM⟺f(⟨M,w⟩)∈HALTTMStep 1: ⟨M,w⟩∈ATM⟹f(⟨M,w⟩)∈HALTTM
Step 2: f(⟨M,w⟩)∈HALTTM⟹⟨M,w⟩∈ATM
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
HALTTM={⟨M,w⟩∣M is a TM and M halts on input w}and that M′ runs M(w) if M reject, then loop, otherwise accept.
Step 1. ⟨M,w⟩∈ATM⟹f(⟨M,w⟩)∈HALTTM.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
HALTTM={⟨M,w⟩∣M is a TM and M halts on input w}and that M′ runs M(w) if M reject, then loop, otherwise accept.
Step 1. ⟨M,w⟩∈ATM⟹f(⟨M,w⟩)∈HALTTM.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
HALTTM={⟨M,w⟩∣M is a TM and M halts on input w}and that M′ runs M(w) if M reject, then loop, otherwise accept.
Step 1. ⟨M,w⟩∈ATM⟹f(⟨M,w⟩)∈HALTTM.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
Step 2. We have f(⟨M,w⟩)=⟨M′,w⟩∈HALTTM and must show ⟨M,w⟩∈ATM.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
Step 2. We have f(⟨M,w⟩)=⟨M′,w⟩∈HALTTM and must show ⟨M,w⟩∈ATM.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
Step 2. We have f(⟨M,w⟩)=⟨M′,w⟩∈HALTTM and must show ⟨M,w⟩∈ATM.
Since f(⟨M,w⟩)∈HALTTM and (1), then M′ halts.
Thus, M′ accepts,
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Recall that:
Step 2. We have f(⟨M,w⟩)=⟨M′,w⟩∈HALTTM and must show ⟨M,w⟩∈ATM.
Since f(⟨M,w⟩)∈HALTTM and (1), then M′ halts.
Thus, M′ accepts, and since M′ only accepts when M accepts w, we conclude our proof.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Detailed proof.
We must show that there exists some MA that recognizes A.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Detailed proof.
We must show that there exists some MA that recognizes A.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Proof (Step 1).
Hypothesis | |
---|---|
H1 | MA accepts w |
H2 | w∈A⟺f(w)∈B |
H3 | MB recognizes B |
H4 | MA(w)=MB(f(w)) |
Goal: show that w∈A
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Proof (Step 1).
Hypothesis | |
---|---|
H1 | MA accepts w |
H2 | w∈A⟺f(w)∈B |
H3 | MB recognizes B |
H4 | MA(w)=MB(f(w)) |
Goal: show that w∈A
Since (H1) MA accept w and H4, we have that MB accepts f(w).
From MB accepts f(w) and H3, we get f(w)∈B.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Proof (Step 1).
Hypothesis | |
---|---|
H1 | MA accepts w |
H2 | w∈A⟺f(w)∈B |
H3 | MB recognizes B |
H4 | MA(w)=MB(f(w)) |
Goal: show that w∈A
Since (H1) MA accept w and H4, we have that MB accepts f(w).
From MB accepts f(w) and H3, we get f(w)∈B.
Since f(w)∈B and H2, then w∈A.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Proof. (Step 2)
Hypothesis | |
---|---|
H0 | w∈A |
H1 | w∈A⟺f(w)∈B |
H2 | MB recognizes B |
H3 | MA(w)=MB(f(w)) |
Goal: show that MA accepts w.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Proof. (Step 2)
Hypothesis | |
---|---|
H0 | w∈A |
H1 | w∈A⟺f(w)∈B |
H2 | MB recognizes B |
H3 | MA(w)=MB(f(w)) |
Goal: show that MA accepts w.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Detailed proof.
We must show that there exists some MA that recognizes A.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
If A≤mB and B is recognizable, then A is recognizable.
Detailed proof.
We must show that there exists some MA that recognizes A.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Use Corollary 5.23.
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.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
The mapping function is given in the book. We separate the construction of M′ 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 ]>.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
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.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
_def
theorem)Lemma A_tm_red_HALT_tm_1: forall w, A_tm w -> HALT_tm (A_tm_to_HALT_tm w).
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
Simplify assumption F(w)∈HALTTM (by inverting with _inv
)
Obtain F(w)=⟨M′,i⟩ for some M′ and i (invert)
Obtain that M′ does not loop with i
Show w∈ATM (construct goal using _def
theorem)
Lemma A_tm_red_HALT_tm_2: forall w, HALT_tm (A_tm_to_HALT_tm w) -> A_tm w.
CS420 ☽ Mapping reducibility ☽ Lecture 26 ☽ Tiago Cogumbreiro
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
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 |