lean/SpectreKnot/Basic.lean
52 lines · 10 declarations, each with its own page · on GitHub ·
Basic types and helpers. No Mathlib: everything here is core Lean.
← SpectreKnot/ProofGrand.leanSpectreKnot/Strands.lean →
All 39 files, and the declarations of this one
1/-
2Basic types and helpers. No Mathlib: everything here is core Lean.
3-/
5namespace SpectreKnot
7/-- The nine kinds of supertile (paper §2.2). -/
9 | Gamma | Delta | Theta | Lambda | Xi | Pi | Sigma | Phi | Psi
10 deriving DecidableEq, Repr
12/-- The eight letters of the edge labels of [SMKGS-spectre, Fig. 4.2], signs ignored (paper §6.1). -/
14 | alpha | beta | gamma | delta | epsilon | zeta | eta | theta
15 deriving DecidableEq, Repr
17/-- `iter f n x = f (f (... (f x)))`, `n` times. (Core Lean has no `f^[n]`.) -/
19 | 0, x => x
22/-- Zero steps leave `x` where it is. -/
25/-- `n + 1` steps are `n` steps, then one more application of `f`. -/
26theorem iter_succ {α : Type} (f : α → α) (n : Nat) (x : α) : iter f (n + 1) x = f (iter f n x) := rfl
28/-- The extra step can also be taken first: `n + 1` steps from `x` are `n` steps from `f x`. -/
29theorem iter_succ' {α : Type} (f : α → α) (n : Nat) (x : α) : iter f (n + 1) x = iter f n (f x) := by
30 induction n with
31 | zero => rfl
34/-- `m + n` steps are `n` steps followed by `m` steps. -/
35theorem iter_add {α : Type} (f : α → α) (m n : Nat) (x : α) : iter f (m + n) x = iter f m (iter f n x) := by
36 induction m with
37 | zero => simp
40/-- Cyclic successor on `0 … E-1`. -/
43/-- Cyclic predecessor on `0 … E-1`. -/
46/-- The Fibonacci numbers, `fib 1 = fib 2 = 1`. -/
48 | 0 => 0
49 | 1 => 1
52end SpectreKnot