Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
e8c772b
add files
BoltonBailey Jan 14, 2026
efa6880
refactor
BoltonBailey Jan 14, 2026
946f4a3
remove listblank content
BoltonBailey Jan 14, 2026
0c3b432
clean up
BoltonBailey Jan 17, 2026
630ce61
claude build/switch to reduces API
BoltonBailey Jan 17, 2026
4587a74
claude: remove sorries
BoltonBailey Jan 17, 2026
35558b8
delete evals junk
BoltonBailey Jan 17, 2026
1ef6182
clean whitespace
BoltonBailey Jan 17, 2026
6a2d234
TM0 -> SingleTapeTM
BoltonBailey Jan 17, 2026
68c6ae4
generalize alphabet
BoltonBailey Jan 17, 2026
6cb8c86
move blowuplemma earlier
BoltonBailey Jan 17, 2026
33d74e8
Stmt API
BoltonBailey Jan 17, 2026
24bd6de
clean up reduction
BoltonBailey Jan 17, 2026
21fe238
More comments
BoltonBailey Jan 22, 2026
9b61c24
Merge branch 'main' of github.com:leanprover/cslib into single-tape-t…
BoltonBailey Jan 23, 2026
ed9474b
rename to `BiTape` and `StackTape`
BoltonBailey Jan 23, 2026
99d9df6
clean up docs
BoltonBailey Jan 23, 2026
e69b48e
Merge branch 'main' of github.com:leanprover/cslib into single-tape-t…
BoltonBailey Jan 23, 2026
6aee1d9
lake exe mk_all --module
BoltonBailey Jan 23, 2026
4b0e241
update StackTape description
BoltonBailey Jan 23, 2026
7092768
clean up bitape file
BoltonBailey Jan 23, 2026
0711013
use relatesInSteps API
BoltonBailey Jan 23, 2026
a6a1c23
revert ReductionSystem/Basic
BoltonBailey Jan 23, 2026
7d8557b
refactor computer
BoltonBailey Jan 23, 2026
b1384f7
improve variable names
BoltonBailey Jan 23, 2026
faca3ff
claude refactor out time from composition functionality
BoltonBailey Jan 23, 2026
435971c
add private to lemmas
BoltonBailey Jan 23, 2026
6426bc5
rename helper lemmas
BoltonBailey Jan 23, 2026
50b6131
Merge branch 'main' into single-tape-turing-machines
BoltonBailey Jan 23, 2026
bacefc5
claude: uniformize the helper lemmas
BoltonBailey Jan 23, 2026
664f62c
Merge branch 'single-tape-turing-machines' of github.com:BoltonBailey…
BoltonBailey Jan 23, 2026
1576498
clean up helpers
BoltonBailey Jan 23, 2026
e348d76
further trim helpers
BoltonBailey Jan 23, 2026
c5231d9
remove vanilla computable
BoltonBailey Jan 23, 2026
b191ee9
rename fields
BoltonBailey Jan 23, 2026
c9ac367
public import Cslib.Init
BoltonBailey Jan 23, 2026
9286128
add note
BoltonBailey Jan 23, 2026
2ab4751
correct cons and provide API
BoltonBailey Jan 25, 2026
ccd4034
clean up tape apis
BoltonBailey Jan 25, 2026
ba47f4f
add docstrings
BoltonBailey Jan 25, 2026
a387696
more doc linter
BoltonBailey Jan 25, 2026
1a77e7c
imrove docs
BoltonBailey Jan 25, 2026
3d639c2
revert whitespace
BoltonBailey Jan 25, 2026
d14d5ee
clean up lines
BoltonBailey Jan 25, 2026
8b06d4a
use variables
BoltonBailey Jan 25, 2026
f7b6bbb
golfs
BoltonBailey Jan 25, 2026
19ebc8c
more golfs
BoltonBailey Jan 26, 2026
1361553
add movement lemmas
BoltonBailey Jan 26, 2026
4335852
golf
BoltonBailey Jan 26, 2026
4da0154
more line golfing
BoltonBailey Jan 26, 2026
f220ae0
clean up docstring
BoltonBailey Jan 26, 2026
aad3692
namespaces
BoltonBailey Jan 26, 2026
36615f3
Update Cslib/Computability/Machines/SingleTapeTuring/Basic.lean
BoltonBailey Jan 30, 2026
90e6ac4
fix typeclass arg names
BoltonBailey Jan 30, 2026
f5b92e7
remove unneeded parens
BoltonBailey Jan 30, 2026
78733a8
use notation
BoltonBailey Jan 30, 2026
d7f384c
more bundled instances
BoltonBailey Jan 30, 2026
f5d0cfe
Update Cslib/Computability/Machines/SingleTapeTuring/Basic.lean
BoltonBailey Jan 30, 2026
b5e035f
golf
BoltonBailey Jan 30, 2026
c3858fe
reorder args
BoltonBailey Jan 30, 2026
e6a2746
move args before :=
BoltonBailey Jan 30, 2026
0746a77
Update Cslib/Computability/Machines/SingleTapeTuring/Basic.lean
BoltonBailey Jan 30, 2026
e356245
reorder proof
BoltonBailey Jan 30, 2026
9a08b4e
Update Cslib/Computability/Machines/SingleTapeTuring/Basic.lean
BoltonBailey Jan 30, 2026
9a2190e
Merge branch 'single-tape-turing-machines' of github.com:BoltonBailey…
BoltonBailey Jan 30, 2026
3329685
Stmt becomes structure
BoltonBailey Jan 30, 2026
76e7c6e
clean up docs
BoltonBailey Jan 30, 2026
f45d40e
add doc
BoltonBailey Jan 30, 2026
1c251fb
add comment
BoltonBailey Jan 30, 2026
82ed427
add documentation on design
BoltonBailey Jan 30, 2026
a03c551
Merge branch 'main' of github.com:leanprover/cslib into single-tape-t…
BoltonBailey Jan 30, 2026
5516a25
ipossilbe instances removed
BoltonBailey Jan 30, 2026
4944e7a
lake exe mk_all
BoltonBailey Jan 30, 2026
97308fa
lake exe mk_all --module
BoltonBailey Jan 30, 2026
7c097a6
grind annotations
BoltonBailey Jan 30, 2026
600e016
some more grind lemmas
BoltonBailey Jan 30, 2026
b4704d1
more grind annotations
BoltonBailey Jan 31, 2026
ee79f80
scoped grind
BoltonBailey Jan 31, 2026
de5ca7d
Multi-tape Turing machine.
crei Feb 2, 2026
f07cb72
define eval
crei Feb 2, 2026
27dd827
relates_eq_some
crei Feb 2, 2026
4fc2c1c
simplify
crei Feb 2, 2026
363a31c
Merge remote-tracking branch 'origin/main' into multi-tape-turing-mac…
crei Feb 2, 2026
9782a33
Finish eval proof
crei Feb 2, 2026
c3226c0
move_right_nth
crei Feb 2, 2026
9840eb6
move_int
crei Feb 2, 2026
be76f0f
move until
crei Feb 2, 2026
e0b12b6
progress
crei Feb 2, 2026
65c4a32
stacktape_ext
crei Feb 2, 2026
df08110
move_int_move_int
crei Feb 3, 2026
a59a09c
sorry proof
crei Feb 3, 2026
dacb2eb
Merge remote-tracking branch 'origin/main' into multi-tape-turing-mac…
crei Feb 20, 2026
0d0d604
Allow warnings.
crei Feb 20, 2026
89fc03e
Fix imports.
crei Feb 20, 2026
269ed49
Addition and multiplication routines
crei Feb 21, 2026
949a0ef
feat: add background and orientation information on how to contribute…
fmontesi Feb 20, 2026
6fc3949
feat: generalize `TimeM` to arbitrary cost types providing `AddZero` …
eric-wieser Feb 21, 2026
e4c2347
Simplify semantics of succ.
crei Feb 24, 2026
d693e99
Always-halting Turing machines.
crei Feb 24, 2026
dce94e8
Multi-tape Turing machine.
crei Mar 2, 2026
f5da60a
Merge branch 'multi-tape-tm' into multi-tape-turing-machine
crei Mar 4, 2026
11fcde8
Fix some files post-merge.
crei Mar 4, 2026
bf81e99
Merge branch 'main' into multi-tape-turing-machine
crei Mar 4, 2026
3728302
Update files.
crei Mar 4, 2026
19e8c12
lint
crei Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ jobs:
with:
script: |
const msg = context.payload.pull_request? context.payload.pull_request.title : context.payload.merge_group.head_commit.message;
console.log(`Message: ${msg}`)
if (!/^(ci|feat|fix|doc|style|refactor|test|chore|perf)(\(.*\))?: .*[^.]($|\n\n)/.test(msg)) {
core.setFailed('PR title does not follow the Commit Convention (https://leanprover.github.io/lean4/doc/dev/commit_convention.html).');
}
19 changes: 19 additions & 0 deletions Cslib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ public import Cslib.Computability.Languages.Language
public import Cslib.Computability.Languages.OmegaLanguage
public import Cslib.Computability.Languages.OmegaRegularLanguage
public import Cslib.Computability.Languages.RegularLanguage
public import Cslib.Computability.Machines.MultiTapeTuring.AddRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.Basic
public import Cslib.Computability.Machines.MultiTapeTuring.CopyRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.EqualRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.GraphReachability
public import Cslib.Computability.Machines.MultiTapeTuring.HeadStats
public import Cslib.Computability.Machines.MultiTapeTuring.IsZeroRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.IteCombinator
public import Cslib.Computability.Machines.MultiTapeTuring.ListEncoding
public import Cslib.Computability.Machines.MultiTapeTuring.LoopCombinator
public import Cslib.Computability.Machines.MultiTapeTuring.MoveRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.MulRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.PopRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.PushRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.SequentialCombinator
public import Cslib.Computability.Machines.MultiTapeTuring.SuccRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.TapeExtension
public import Cslib.Computability.Machines.MultiTapeTuring.WhileCombinator
public import Cslib.Computability.Machines.MultiTapeTuring.WithTapes
public import Cslib.Computability.Machines.SingleTapeTuring.Basic
public import Cslib.Computability.URM.Basic
public import Cslib.Computability.URM.Computable
Expand Down
107 changes: 107 additions & 0 deletions Cslib/Computability/Machines/MultiTapeTuring/AddRoutine.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/-
Copyright (c) 2026 Christian Reitwiessner. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Christian Reitwiessner
-/

module

public import Cslib.Computability.Machines.MultiTapeTuring.Basic
public import Cslib.Computability.Machines.MultiTapeTuring.ListEncoding
public import Cslib.Computability.Machines.MultiTapeTuring.SuccRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.CopyRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.PushRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.PopRoutine
public import Cslib.Computability.Machines.MultiTapeTuring.LoopCombinator
public import Cslib.Computability.Machines.MultiTapeTuring.SequentialCombinator
public import Cslib.Computability.Machines.MultiTapeTuring.WithTapes

namespace Turing

variable {k : ℕ}

namespace Routines

@[simp]
lemma succ_iter {k r : ℕ} {i : Fin k.succ} {tapes : Fin k.succ → List (List OneTwo)} :
(Part.bind · (succ i).eval_list)^[r] (.some tapes) = Part.some (Function.update tapes i (
if r ≠ 0 then
(dya ((dya_inv ((tapes i).headD [])) + r)) :: (tapes i).tail
else
tapes i)) := by
induction r with
| zero => simp
| succ r ih =>
rw [Function.iterate_succ_apply']
simp [ih]
grind

--- Add 0 and 1 and store the result in 2.
--- Assumes zero for an empty tape.
def add₀ : MultiTapeTM 6 (WithSep OneTwo) :=
(copy 1 2) ;ₜ loop 0 (succ 2)

@[simp, grind =]
theorem add₀_eval_list {tapes : Fin 6 → List (List OneTwo)} :
add₀.eval_list tapes = .some
(Function.update tapes 2 ((dya (dya_inv ((tapes 0).headD []) +
dya_inv ((tapes 1).headD [])) :: (tapes 2)))) := by
simp [add₀]
by_cases h : dya_inv ((tapes 0).head?.getD []) = 0
· simp [h]; grind
· grind

/--
A Turing machine that adds the heads of tapes i and j (in dyadic encoding) and pushes the result
to tape l.
Assumes zero for an empty tape. -/
public def add (i j l : Fin (k + 6)) (aux : Fin (k + 6) := ⟨k + 3, by omega⟩)
(h_inj : [i, j, l, aux, aux + 1, aux + 2].get.Injective := by decide) :
MultiTapeTM (k + 6) (WithSep OneTwo) :=
add₀.with_tapes [i, j, l, aux, aux + 1, aux + 2].get h_inj

@[simp, grind =]
public theorem add_eval_list (i j l aux : Fin (k + 6))
{h_inj : [i, j, l, aux, aux + 1, aux + 2].get.Injective}
{tapes : Fin (k + 6) → List (List OneTwo)} :
(add i j l aux h_inj).eval_list tapes =
.some (Function.update tapes l (
(dya (dya_inv ((tapes i).headD []) + dya_inv ((tapes j).headD [])) :: (tapes l)))) := by
simp [add]
grind

-- Add head of 0 to head of 1 (and store it in head of 1).
def add_assign₀ : MultiTapeTM 6 (WithSep OneTwo) :=
add 0 1 2 (h_inj := by decide) ;ₜ pop 1 ;ₜ copy 2 1 ;ₜ pop 2

@[simp]
lemma add_assign₀_eval_list {tapes : Fin 6 → List (List OneTwo)} :
add_assign₀.eval_list tapes = .some
(Function.update tapes 1 ((dya (dya_inv ((tapes 0).headD []) +
dya_inv ((tapes 1).headD [])) :: (tapes 1).tail))) := by
simp [add_assign₀]
grind

/--
A Turing machine that adds the head of tape `i` to the head of tape `j` (and updates the
head of tape `j` with the result). -/
public def add_assign
(i j : Fin (k + 6))
(aux : Fin (k + 6) := ⟨k + 2, by omega⟩)
(h_inj : [i, j, aux, aux + 1, aux + 2, aux + 3].get.Injective := by decide) :
MultiTapeTM (k + 6) (WithSep OneTwo) :=
add_assign₀.with_tapes [i, j, aux, aux + 1, aux + 2, aux + 3].get h_inj

@[simp]
public theorem add_assign_eval_list {i j aux : Fin (k + 6)}
{h_inj : [i, j, aux, aux + 1, aux + 2, aux + 3].get.Injective}
{tapes : Fin (k + 6) → List (List OneTwo)} :
(add_assign i j aux h_inj).eval_list tapes =
.some (Function.update tapes j (
(dya (dya_inv ((tapes i).headD []) +
dya_inv ((tapes j).headD [])) :: (tapes j).tail))) := by
simpa [add_assign] using apply_updates_function_update h_inj

end Routines

end Turing
Loading
Loading