Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lengyijun committed Oct 17, 2024
1 parent a095996 commit 5f21bd6
Show file tree
Hide file tree
Showing 7 changed files with 797 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GoldbachTm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import GoldbachTm.Basic
import GoldbachTm.Format
import GoldbachTm.ListBlank
import GoldbachTm.Tm27.TuringMachine27
import GoldbachTm.Tm27.Search0
import GoldbachTm.Tm27.Prime
import GoldbachTm.Tm27.Content
import GoldbachTm.Tm27.Transition
import GoldbachTm.Tm27.Miscellaneous

import GoldbachTm.Tm31.TuringMachine31
import GoldbachTm.Tm31.Search0
import GoldbachTm.Tm31.Content
Expand Down
16 changes: 16 additions & 0 deletions GoldbachTm/Tm27/Content.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import GoldbachTm.Tm27.TuringMachine27
import GoldbachTm.Tm27.Search0
import Mathlib.Data.Nat.Prime.Defs

namespace Tm27

theorem lemma_26 (n : ℕ) (i : ℕ)
(g :
nth_cfg i = some ⟨⟨26, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (List.replicate (n+4) Γ.one), Turing.ListBlank.mk []⟩⟩ )
( hpp : goldbach (n+4)) :
∃ j>i, nth_cfg j = some ⟨⟨26, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (List.replicate (n+4+2) Γ.one), Turing.ListBlank.mk []⟩⟩
:= by
sorry


end Tm27
116 changes: 116 additions & 0 deletions GoldbachTm/Tm27/Miscellaneous.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
-- some lemmas tm31 doesn't contain

import GoldbachTm.Tm27.TuringMachine27
import GoldbachTm.Tm27.Transition

namespace Tm27

theorem lemma7 (k : ℕ): ∀ (i : ℕ) (l r : List Γ),
nth_cfg i = some ⟨⟨7, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ →
nth_cfg (i + k + 1) = some ⟨⟨7, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate (k+1) Γ.zero ++ r)⟩⟩ := by
induction k with (intros i l r h; simp_all)
| zero => forward h h i
rw [← h]
ring_nf
| succ k => forward h h i
rename_i induction_step
apply induction_step at h
ring_nf at *
simp! [h]
rw [List.append_cons]
rw [← List.replicate_succ']
ring_nf

theorem lemma8 (k : ℕ): ∀ (i : ℕ) (l r : List Γ),
nth_cfg i = some ⟨⟨8, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ →
nth_cfg (i + k + 2) = some ⟨⟨9, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (Γ.zero :: l), Turing.ListBlank.mk (List.replicate k Γ.zero ++ r)⟩⟩ := by
induction k with (intros i l r h; simp_all)
| zero => forward h h i
forward h h (1+i)
rw [← h]
ring_nf
| succ k => forward h h i
rename_i induction_step
apply induction_step at h
ring_nf at *
simp! [h]
rw [List.append_cons]
rw [← List.replicate_succ']
ring_nf

theorem lemma5 (k : ℕ): ∀ (i : ℕ) (l r : List Γ),
nth_cfg i = some ⟨⟨5, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate k Γ.one ++ List.cons Γ.zero l), Turing.ListBlank.mk r⟩⟩ →
nth_cfg (i + k + 2) = some ⟨⟨4, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk (Γ.zero :: l), Turing.ListBlank.mk (List.replicate k Γ.zero ++ r)⟩⟩ := by
induction k with (intros i l r h; simp_all)
| zero => forward h h i
forward h h (1+i)
rw [← h]
ring_nf
| succ k => forward h h i
rename_i induction_step
apply induction_step at h
ring_nf at *
simp! [h]
rw [List.append_cons]
rw [← List.replicate_succ']
ring_nf

theorem lemma10 (k : ℕ): ∀ (i : ℕ) (l r : List Γ),
nth_cfg i = some ⟨⟨10, by omega⟩, ⟨Γ.zero, Turing.ListBlank.mk l, Turing.ListBlank.mk (List.replicate k Γ.zero ++ List.cons Γ.one r) ⟩⟩ →
nth_cfg (i + k + 1) = some ⟨⟨10, by omega⟩, ⟨Γ.one, Turing.ListBlank.mk (List.replicate (k+1) Γ.one ++ l), Turing.ListBlank.mk r⟩⟩ := by
induction k with (intros i l r h; simp_all)
| zero => forward h h i
rw [← h]
ring_nf
| 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 lemma_6_to_7 (i : ℕ) (l1: ℕ) (l r : List Γ)
(h :
nth_cfg i = some ⟨⟨6, by omega⟩, ⟨Γ.one,
Turing.ListBlank.mk (List.replicate l1 Γ.one ++ List.cons Γ.zero l),
Turing.ListBlank.mk r,
⟩⟩) :
∃ j>i, nth_cfg j = some ⟨⟨7, by omega⟩, ⟨Γ.zero,
Turing.ListBlank.mk l,
Turing.ListBlank.mk (List.replicate (l1+1) Γ.zero ++ r),
⟩⟩
:= by
forward h h i
cases l1 with
| zero => use (1+i)
simp [h]
| succ l1 => simp! at h
apply lemma7 at h
use (1+i+l1 + 1)
simp [h]
constructor
. omega
. rw [List.append_cons, ← List.replicate_succ']

theorem lemma_9_to_10 (i : ℕ) (r1: ℕ) (l r : List Γ)
(h :
nth_cfg i = some ⟨⟨9, by omega⟩, ⟨Γ.zero,
Turing.ListBlank.mk l,
Turing.ListBlank.mk (List.replicate r1 Γ.zero ++ List.cons Γ.one r),
⟩⟩) :
∃ j>i, nth_cfg j = some ⟨⟨10, by omega⟩, ⟨Γ.one,
Turing.ListBlank.mk (List.replicate r1 Γ.one ++ Γ.zero :: l),
Turing.ListBlank.mk r,
⟩⟩
:= by
forward h h i
cases r1 with simp_all
| zero => use (1+i)
simp [h]
| succ l1 => simp! at h
apply lemma10 at h
use (1+i+l1 + 1)
simp [h]
omega

end Tm27
Loading

0 comments on commit 5f21bd6

Please sign in to comment.