-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import GoldbachTm.Tm27.TuringMachine27 | ||
import GoldbachTm.Tm27.Search0 | ||
import Mathlib.Data.Nat.Prime.Defs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
-- theorem of recursive states | ||
-- all these states' usage is to search 0 | ||
import GoldbachTm.Tm27.TuringMachine27 | ||
|
||
namespace Tm27 | ||
|
||
-- left | ||
theorem rec17 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨17, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨17, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ r)⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) l (List.cons Γ.one r) | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
theorem rec19 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨19, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨19, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ r)⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) l (List.cons Γ.one r) | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
theorem rec21 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨21, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨21, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ r)⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) l (List.cons Γ.one r) | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
theorem rec24 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨24, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨24, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ r)⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) l (List.cons Γ.one r) | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
--right | ||
theorem rec11 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨11, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero r) ⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨11, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ l), Turing.ListBlank.mk r⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) (List.cons Γ.one l) r | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
theorem rec20 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨20, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero r) ⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨20, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ l), Turing.ListBlank.mk r⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) (List.cons Γ.one l) r | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
theorem rec23 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨23, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero r) ⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨23, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ l), Turing.ListBlank.mk r⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) (List.cons Γ.one l) r | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
theorem rec26 (k : ℕ): ∀ (i : ℕ) (l r : List Γ), | ||
nth_cfg i = some ⟨⟨26, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero r) ⟩⟩ → | ||
nth_cfg (i + k + 1) = some ⟨⟨26, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ l), Turing.ListBlank.mk r⟩⟩ := by | ||
induction k with intros i l r h | ||
| zero => simp [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
| succ k => rename_i induction_step | ||
specialize induction_step (i+1) (List.cons Γ.one l) r | ||
have g : i + (k+1) +1 = i + 1 + k + 1 := by omega | ||
rw [g, induction_step] | ||
. simp [List.replicate_succ' (k+1)] | ||
. simp! [nth_cfg, h, step, machine, Turing.Tape.write, Turing.Tape.move] | ||
|
||
end Tm27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters