lean_all/found/Ordinal.lean
/-
T124 (a). found/Ordinal — ordinal notations below ε₀ in Cantor normal form:
oadd a n b = ω^a · (n+1) + b.
* a decidable comparison cmp (three-valued, structural), lt x y := cmp x y = lt;
* normal forms NF (exponents strictly decreasing);
* well-foundedness: every normal form is accessible for the order restricted
to normal forms (outer induction on the leading exponent, then on the
coefficient, then on the tail).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Ord
inductive ON where
| zero : ON
| oadd : ON → Nat → ON → ON
inductive C3 where
| lt : C3
| eq : C3
| gt : C3
def cmpN : Nat → Nat → C3
| 0, 0 => .eq
| 0, _ + 1 => .lt
| _ + 1, 0 => .gt
| a + 1, b + 1 => cmpN a b
def cmp : ON → ON → C3
| .zero, .zero => .eq
| .zero, .oadd _ _ _ => .lt
| .oadd _ _ _, .zero => .gt
| .oadd a n b, .oadd a' n' b' => match cmp a a' with
| .lt => .lt
| .gt => .gt
| .eq => match cmpN n n' with
| .lt => .lt
| .gt => .gt
| .eq => cmp b b'
def Lt (x y : ON) : Prop := cmp x y = .lt
theorem cmpN_eq : (a b : Nat) → cmpN a b = .eq → a = b
| 0, 0, _ => rfl
| 0, _ + 1, h => C3.noConfusion h
| _ + 1, 0, h => C3.noConfusion h
| a + 1, b + 1, h => congrArg (· + 1) (cmpN_eq a b h)
theorem cmpN_lt : (a b : Nat) → cmpN a b = .lt → a < b
| 0, 0, h => C3.noConfusion h
| 0, _ + 1, _ => Nat.succ_pos _
| _ + 1, 0, h => C3.noConfusion h
| a + 1, b + 1, h => Nat.succ_lt_succ (cmpN_lt a b h)
theorem cmpN_refl : (a : Nat) → cmpN a a = .eq
| 0 => rfl
| a + 1 => cmpN_refl a
theorem cmp_refl : (x : ON) → cmp x x = .eq
| .zero => rfl
| .oadd a n b => by
show (match cmp a a with
| .lt => .lt | .gt => .gt
| .eq => match cmpN n n with | .lt => .lt | .gt => .gt | .eq => cmp b b) = C3.eq
rw [cmp_refl a, cmpN_refl n, cmp_refl b]
theorem cmp_eq : (x y : ON) → cmp x y = .eq → x = y
| .zero, .zero, _ => rfl
| .zero, .oadd _ _ _, h => C3.noConfusion h
| .oadd _ _ _, .zero, h => C3.noConfusion h
| .oadd a n b, .oadd a' n' b', h => by
revert h
show (match cmp a a' with
| .lt => .lt | .gt => .gt
| .eq => match cmpN n n' with | .lt => .lt | .gt => .gt | .eq => cmp b b') = C3.eq → _
cases ha : cmp a a' with
| lt => exact fun h => C3.noConfusion h
| gt => exact fun h => C3.noConfusion h
| eq =>
cases hn : cmpN n n' with
| lt => exact fun h => C3.noConfusion h
| gt => exact fun h => C3.noConfusion h
| eq =>
intro hb
rw [cmp_eq a a' ha, cmpN_eq n n' hn, cmp_eq b b' hb]
theorem lt_irrefl (x : ON) : ¬ Lt x x := fun h => by
unfold Lt at h
rw [cmp_refl] at h
exact C3.noConfusion h
/-! ## normal forms -/
/-- b is below ω^a -/
def Below (b a : ON) : Prop := match b with
| .zero => True
| .oadd a1 _ _ => Lt a1 a
def NF : ON → Prop
| .zero => True
| .oadd a _ b => NF a ∧ NF b ∧ Below b a
/-- the order restricted to normal forms -/
def R (x y : ON) : Prop := NF x ∧ Lt x y
theorem acc_zero : Acc R .zero := .intro _ (fun y h => by
cases y with
| zero => exact absurd h.2 (lt_irrefl _)
| oadd _ _ _ => exact C3.noConfusion h.2)
theorem lt_oadd_inv {a n b a' n' b'} (h : Lt (.oadd a' n' b') (.oadd a n b)) :
Lt a' a ∨ (a' = a ∧ n' < n) ∨ (a' = a ∧ n' = n ∧ Lt b' b) := by
revert h
show (match cmp a' a with
| .lt => .lt | .gt => .gt
| .eq => match cmpN n' n with | .lt => .lt | .gt => .gt | .eq => cmp b' b) = C3.lt → _
cases ha : cmp a' a with
| lt => exact fun _ => Or.inl ha
| gt => exact fun h => C3.noConfusion h
| eq =>
cases hn : cmpN n' n with
| lt => exact fun _ => Or.inr (Or.inl ⟨cmp_eq _ _ ha, cmpN_lt _ _ hn⟩)
| gt => exact fun h => C3.noConfusion h
| eq => exact fun h => Or.inr (Or.inr ⟨cmp_eq _ _ ha, cmpN_eq _ _ hn, h⟩)
theorem lt_succ_cases {m n : Nat} (h : m < n + 1) : m < n ∨ m = n :=
(Nat.lt_or_ge m n).elim Or.inl (fun hg => Or.inr (Nat.le_antisymm (Nat.le_of_lt_succ h) hg))
/-- the main lemma: an accessible exponent gives accessible terms -/
theorem acc_oadd (a : ON) (ha : Acc R a) : ∀ n b, NF (.oadd a n b) → Acc R (.oadd a n b) := by
induction ha with
| intro a _ ihA =>
-- accessibility of tails below ω^a
have accB : ∀ b, NF b → Below b a → Acc R b := fun b hb hbl => by
cases b with
| zero => exact acc_zero
| oadd a1 n1 b1 => exact ihA a1 ⟨hb.1, hbl⟩ n1 b1 hb
-- strong induction on the coefficient
have S : ∀ n, ∀ m, m < n → ∀ b, NF (.oadd a m b) → Acc R (.oadd a m b) := by
intro n
induction n with
| zero => exact fun m h => absurd h (Nat.not_lt_zero m)
| succ n ihN =>
intro m hm
cases lt_succ_cases hm with
| inl hl => exact ihN m hl
| inr he =>
subst he
intro b hnf
have hab := accB b hnf.2.1 hnf.2.2
induction hab with
| intro b _ ihB =>
refine .intro _ (fun y hy => ?_)
cases y with
| zero => exact acc_zero
| oadd a' n' b' =>
cases lt_oadd_inv hy.2 with
| inl hl => exact ihA a' ⟨hy.1.1, hl⟩ n' b' hy.1
| inr h2 =>
cases h2 with
| inl h3 =>
have e : a' = a := h3.1
subst e
exact ihN n' h3.2 b' hy.1
| inr h3 =>
have e1 : a' = a := h3.1
have e2 : n' = m := h3.2.1
subst e1 e2
exact ihB b' ⟨hy.1.2.1, h3.2.2⟩ hy.1
exact fun n b hnf => S (n + 1) n (Nat.lt_succ_self n) b hnf
/-- well-foundedness below ε₀: every normal form is accessible -/
theorem nf_acc : (x : ON) → NF x → Acc R x
| .zero, _ => acc_zero
| .oadd a n b, h => acc_oadd a (nf_acc a h.1) n b h
def flip : C3 → C3
| .lt => .gt
| .eq => .eq
| .gt => .lt
theorem cmpN_swap : (a b : Nat) → cmpN b a = flip (cmpN a b)
| 0, 0 => rfl
| 0, _ + 1 => rfl
| _ + 1, 0 => rfl
| a + 1, b + 1 => cmpN_swap a b
theorem cmp_swap : (x y : ON) → cmp y x = flip (cmp x y)
| .zero, .zero => rfl
| .zero, .oadd _ _ _ => rfl
| .oadd _ _ _, .zero => rfl
| .oadd a n b, .oadd a' n' b' => by
show (match cmp a' a with
| .lt => .lt | .gt => .gt
| .eq => match cmpN n' n with | .lt => .lt | .gt => .gt | .eq => cmp b' b) =
flip (match cmp a a' with
| .lt => .lt | .gt => .gt
| .eq => match cmpN n n' with | .lt => .lt | .gt => .gt | .eq => cmp b b')
rw [cmp_swap a a', cmpN_swap n n', cmp_swap b b']
cases cmp a a' with
| lt => rfl
| gt => rfl
| eq => cases cmpN n n' with
| lt => rfl
| gt => rfl
| eq => rfl
/-- the order is decidable (computed by cmp) and total on notations -/
theorem trichotomy (x y : ON) : Lt x y ∨ x = y ∨ Lt y x := by
cases h : cmp x y with
| lt => exact Or.inl h
| eq => exact Or.inr (Or.inl (cmp_eq _ _ h))
| gt => exact Or.inr (Or.inr (by unfold Lt; rw [cmp_swap x y, h]; rfl))
/-! examples: ω = oadd 1 0 0, ω^ω, and the tower ω_k approaching ε₀ -/
def one : ON := .oadd .zero 0 .zero
def omega : ON := .oadd one 0 .zero
def tower : Nat → ON
| 0 => one
| k + 1 => .oadd (tower k) 0 .zero
theorem tower_nf : (k : Nat) → NF (tower k)
| 0 => ⟨trivial, trivial, trivial⟩
| k + 1 => ⟨tower_nf k, trivial, trivial⟩
theorem omega_lt_omega_omega : Lt omega (tower 2) := rfl
end Ord
end Found
#print axioms Found.Ord.cmp_eq
#print axioms Found.Ord.lt_oadd_inv
#print axioms Found.Ord.acc_oadd
#print axioms Found.Ord.nf_acc
#print axioms Found.Ord.trichotomy
#print axioms Found.Ord.tower_nf
#print axioms Found.Ord.cmp_swap
lean_all/found/OrtonPitts.lean
/-
T127 (core, first slices OP1–OP2). found/OrtonPitts — the interval and
cofibrations as internal structure of a topos (Orton–Pitts style).
The axioms are fields of a structure (hypotheses), never Lean axioms: the
development is parametric in the topos E (here its internal language is
read in Lean's types with Ω = Prop, T63) and in the interval I.
* OP1: an interval: 0, 1, 0 ≠ 1, connections ∧, ∨ with the endpoint laws,
optional reversal ~ (dropping ~ is the directed corollary (5)).
* OP2: cofibrant propositions Φ ⊆ Ω containing i = 0, i = 1, closed
under ∨, ∧ and ∀ over I.
* Paths A a b := maps I → A with endpoints; reflexivity, reversal (from ~),
the connection squares, maps of types act on paths (ap) — the A = A
chain of T60 seen through I.
* Example: Prop with ∧/∨ is an interval in Ω with 0 ≠ 1 (Lean side);
Cubical Agda's built-in I satisfies the connection laws definitionally
(work/agda/Interval.agda). Composition, fibrations, Glue, universe and
HITs are the next slices (OP3–OP8).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace OP
structure Interval where
I : Type
i0 : I
i1 : I
ne : i0 ≠ i1
meet : I → I → I
join : I → I → I
meet_i0 : ∀ i, meet i i0 = i0
meet_i1 : ∀ i, meet i i1 = i
i0_meet : ∀ i, meet i0 i = i0
i1_meet : ∀ i, meet i1 i = i
join_i0 : ∀ i, join i i0 = i
join_i1 : ∀ i, join i i1 = i1
i0_join : ∀ i, join i0 i = i
i1_join : ∀ i, join i1 i = i1
/-- a reversal (symmetric interval); its absence gives the directed case -/
structure Reversal (J : Interval) where
rev : J.I → J.I
rev_i0 : rev J.i0 = J.i1
rev_i1 : rev J.i1 = J.i0
structure Cof (J : Interval) where
isCof : Prop → Prop
eq0 : ∀ i, isCof (i = J.i0)
eq1 : ∀ i, isCof (i = J.i1)
or : ∀ {p q}, isCof p → isCof q → isCof (p ∨ q)
and : ∀ {p q}, isCof p → isCof q → isCof (p ∧ q)
all : ∀ {φ : J.I → Prop}, (∀ i, isCof (φ i)) → isCof (∀ i, φ i)
section Paths
variable (J : Interval)
structure Path (A : Type) (a b : A) where
p : J.I → A
src : p J.i0 = a
tgt : p J.i1 = b
def refl' {A : Type} (a : A) : Path J A a a := ⟨fun _ => a, rfl, rfl⟩
def revPath (R : Reversal J) {A : Type} {a b : A} (q : Path J A a b) : Path J A b a :=
⟨fun i => q.p (R.rev i), (congrArg q.p R.rev_i0).trans q.tgt, (congrArg q.p R.rev_i1).trans q.src⟩
def apP {A B : Type} (f : A → B) {a b : A} (q : Path J A a b) : Path J B (f a) (f b) :=
⟨fun i => f (q.p i), congrArg f q.src, congrArg f q.tgt⟩
/-- the connection square: q(i ∧ j) is a path from refl a to q -/
def connMeet {A : Type} {a b : A} (q : Path J A a b) (i : J.I) : Path J A a (q.p i) :=
⟨fun j => q.p (J.meet i j), (congrArg q.p (J.meet_i0 i)).trans q.src, congrArg q.p (J.meet_i1 i)⟩
/-- and q(i ∨ j) is a path from q to refl b -/
def connJoin {A : Type} {a b : A} (q : Path J A a b) (i : J.I) : Path J A (q.p i) b :=
⟨fun j => q.p (J.join i j), congrArg q.p (J.join_i0 i), (congrArg q.p (J.join_i1 i)).trans q.tgt⟩
/-- every Lean equality gives a path (the A = A chain is inside the interval paths) -/
def ofEq {A : Type} {a b : A} (e : a = b) : Path J A a b := by
cases e
exact refl' J a
/-- conversely, a path whose underlying map is constant up to `=` is an equality;
in general paths are finer than `=` (that is what the interval adds) -/
theorem eq_of_const {A : Type} {a b : A} (q : Path J A a b) (h : ∀ i, q.p i = q.p J.i0) : a = b :=
q.src.symm.trans ((h J.i1).symm.trans q.tgt)
end Paths
/-! ## Example: Prop as an interval in Ω -/
theorem false_ne_true : (False : Prop) ≠ True := fun e => e ▸ trivial
/-- Prop with ∧, ∨ satisfies the interval laws up to ↔; as equalities they
need propext, so the Lean-side example is stated up to ↔ (the internal
equality of Ω) -/
theorem prop_interval_laws (i : Prop) :
((i ∧ False) ↔ False) ∧ ((i ∧ True) ↔ i) ∧ ((i ∨ False) ↔ i) ∧ ((i ∨ True) ↔ True) :=
⟨⟨fun h => h.2, fun h => h.elim⟩, ⟨fun h => h.1, fun h => ⟨h, trivial⟩⟩,
⟨fun h => h.elim id False.elim, Or.inl⟩, ⟨fun _ => trivial, fun _ => Or.inr trivial⟩⟩
/-- a free interval: the de Morgan-free bounded lattice terms on one variable
collapse to {0, 1, x}; here the two-point interval with i0 ≠ i1 -/
inductive Two where
| o : Two
| l : Two
def Two.meet : Two → Two → Two
| .o, .o => .o
| .o, .l => .o
| .l, .o => .o
| .l, .l => .l
def Two.join : Two → Two → Two
| .o, .o => .o
| .o, .l => .l
| .l, .o => .l
| .l, .l => .l
def two : Interval where
I := Two
i0 := .o
i1 := .l
ne := fun e => Two.noConfusion e
meet := Two.meet
join := Two.join
meet_i0 i := by cases i <;> rfl
meet_i1 i := by cases i <;> rfl
i0_meet i := by cases i <;> rfl
i1_meet i := by cases i <;> rfl
join_i0 i := by cases i <;> rfl
join_i1 i := by cases i <;> rfl
i0_join i := by cases i <;> rfl
i1_join i := by cases i <;> rfl
def twoRev : Reversal two := ⟨fun i => match i with | .o => .l | .l => .o, rfl, rfl⟩
/-- the two-point interval is not connected: it has a non-constant map to Two,
so it cannot carry composition for all fibrations; connectedness is the
OP axiom that rules out discrete intervals (it holds for Cubical Agda's I) -/
theorem two_not_connected : ¬ ∀ f : two.I → Two, f two.i0 = f two.i1 :=
fun h => Two.noConfusion (h (fun i => i))
end OP
end Found
#print axioms Found.OP.revPath
#print axioms Found.OP.apP
#print axioms Found.OP.connMeet
#print axioms Found.OP.connJoin
#print axioms Found.OP.ofEq
#print axioms Found.OP.eq_of_const
#print axioms Found.OP.false_ne_true
#print axioms Found.OP.prop_interval_laws
#print axioms Found.OP.two
#print axioms Found.OP.twoRev
#print axioms Found.OP.two_not_connected
lean_all/found/Owf1.lean
/-
T332 piece 1. found/Owf1 -- one-way functions: the T329 definition is degenerate; a
definition with the success counted from runs; one-way functions make inversion a hard
search problem; with search-to-decision, one-way functions give P /= NP.
RootComp.OneWay (T329) takes the success count succ as a free argument. Choosing
succ = (0, 1) satisfies its hardness clause for every function with polynomially bounded
output, so that definition carries no hardness (t329_degenerate). Here, over the machine
model with output (Pnp3.OM), the success of an inverter inv with budget e on length n is
counted over all 2^n inputs (succN), and
* OneWay2 M f: f is computed within a polynomial e; for every inverter and every
polynomial e, from some length on, succN * (e(n) + 2) <= 2^n (success below 1/(e+2));
* SearchEasy M f: some inverter finds a preimage of f x for every x in polynomial time;
* count_all: a test true on all lists of length n counts 2^n of them;
* owf_not_search: a one-way function has no polynomial-time inverter;
* owf_p_ne_np: if equality of P and NP makes every polynomial-time function invertible
(search-to-decision, the hypothesis S2D: open as a law of a concrete model,
OPEN_LEMMAS_PNP O5), then a one-way function gives an NP language outside P
(in the form: NP is not inside P).
Relativizes (a bridge; PNP_MAP.md). ASCII forms only. CIC dependence: none.
-/
import found.Pnp4
import found.Pnp9
import found.RootComp
namespace Found.Owf1
open Found.Pnp3 (OM PE pe InPo)
open Found.Pnp4 (InNPo)
open Found.Pnp8 (mapC allBits)
open Found.Pnp9 (pow2)
/-! ## The T329 definition is degenerate -/
theorem t329_degenerate (M : Found.RootComp.Machine) (f : List Bool -> List Bool)
(easy : Exists fun c => Exists fun k => forall x, (f x).length <= Found.RootComp.pbound c k x.length) :
Found.RootComp.OneWay M f (fun _ _ => (0, 1)) :=
Found.RootComp.OneWay.mk easy (fun _ c k => Exists.intro 0 (fun n _ => by
show 0 * Found.RootComp.pbound c k n <= 1
rw [Nat.zero_mul]
exact Nat.zero_le 1))
/-- Even the identity is "one-way" in the T329 sense. -/
theorem t329_identity (M : Found.RootComp.Machine) : Found.RootComp.OneWay M (fun x => x) (fun _ _ => (0, 1)) :=
t329_degenerate M _ (Exists.intro 1 (Exists.intro 1 (fun x => by
show x.length <= 1 * (1 * x.length) + 1
rw [Nat.one_mul, Nat.one_mul]
exact Nat.le_succ _)))
/-! ## Success counted from runs -/
def beqL : List Bool -> List Bool -> Bool
| [], [] => true
| [], _ :: _ => false
| _ :: _, [] => false
| a :: l, b :: m => (a == b) && beqL l m
def count (g : List Bool -> Bool) : List (List Bool) -> Nat
| [] => 0
| x :: xs => count g xs + (match g x with | true => 1 | false => 0)
def invOut (f : List Bool -> List Bool) (x : List Bool) : Option (List Bool) -> Bool
| none => false
| some y => beqL (f y) (f x)
/-- inv, run within budget t on f x, returns a preimage of f x. -/
def inverts (M : OM) (f : List Bool -> List Bool) (inv : M.Prog) (t : Nat) (x : List Bool) : Bool :=
invOut f x (M.run inv t (f x))
def succN (M : OM) (f : List Bool -> List Bool) (inv : M.Prog) (e : PE) (n : Nat) : Nat :=
count (inverts M f inv (pe e n)) (allBits n)
structure OneWay2 (M : OM) (f : List Bool -> List Bool) : Prop where
easy : Exists fun pf : M.Prog => Exists fun e : PE => forall x, M.run pf (pe e x.length) x = some (f x)
hard : forall (inv : M.Prog) (e : PE), Exists fun n0 => forall n, n0 <= n ->
succN M f inv e n * (pe e n + 2) <= pow2 n
def SearchEasy (M : OM) (f : List Bool -> List Bool) : Prop :=
Exists fun inv : M.Prog => Exists fun e : PE => forall x, inverts M f inv (pe e x.length) x = true
/-! ## Counting -/
theorem count_app (g : List Bool -> Bool) (ys : List (List Bool)) :
forall xs, count g (xs ++ ys) = count g xs + count g ys := by
intro xs
induction xs with
| nil => exact (Nat.zero_add _).symm
| cons x xs ih =>
show count g (xs ++ ys) + _ = count g xs + _ + count g ys
rw [ih, Nat.add_right_comm]
theorem count_mapC (g : List Bool -> Bool) (b : Bool) :
forall xs, count g (mapC b xs) = count (fun x => g (b :: x)) xs := by
intro xs
induction xs with
| nil => rfl
| cons x xs ih =>
show count g (mapC b xs) + _ = count (fun x => g (b :: x)) xs + _
rw [ih]
theorem count_all : forall n (g : List Bool -> Bool), (forall x, x.length = n -> g x = true) ->
count g (allBits n) = pow2 n := by
intro n
induction n with
| zero =>
intro g h
show 0 + (match g [] with | true => 1 | false => 0) = 1
rw [h [] rfl]
rfl
| succ n ih =>
intro g h
show count g (mapC false (allBits n) ++ mapC true (allBits n)) = pow2 n + pow2 n
rw [count_app, count_mapC, count_mapC]
rw [ih (fun x => g (false :: x)) (fun x hx => h (false :: x) (congrArg Nat.succ hx))]
rw [ih (fun x => g (true :: x)) (fun x hx => h (true :: x) (congrArg Nat.succ hx))]
theorem pow2_pos : forall n, 1 <= pow2 n := by
intro n
induction n with
| zero => exact Nat.le_refl 1
| succ n ih => exact Nat.le_trans ih (Nat.le_add_right _ _)
theorem not_double (P Y : Nat) (hP : 1 <= P) (h : P * (Y + 2) <= P) : False := by
have h1 : P + P <= P * (Y + 2) := Nat.add_le_add_right (Nat.le_add_left P (P * Y)) P
have h2 : P + 1 <= P + P := Nat.add_le_add_left hP P
exact Nat.not_succ_le_self P (Nat.le_trans h2 (Nat.le_trans h1 h))
/-! ## One-way functions against search -/
theorem owf_not_search (M : OM) (f : List Bool -> List Bool) (ho : OneWay2 M f) (hs : SearchEasy M f) : False :=
match hs with
| Exists.intro inv (Exists.intro e he) =>
match ho.hard inv e with
| Exists.intro n0 hn =>
have hc : succN M f inv e n0 = pow2 n0 :=
count_all n0 (inverts M f inv (pe e n0)) (fun x hx => by rw [hx.symm]; exact he x)
have hb := hn n0 (Nat.le_refl n0)
not_double (pow2 n0) (pe e n0) (pow2_pos n0) (by rw [hc] at hb; exact hb)
/-- Search-to-decision as a law: if NP is inside P, every function computed in polynomial
time is polynomial-time invertible (open for a concrete model: OPEN_LEMMAS_PNP O5). -/
def S2D (M : OM) : Prop :=
(forall L, InNPo M L -> InPo M L) ->
forall f : List Bool -> List Bool,
(Exists fun pf : M.Prog => Exists fun e : PE => forall x, M.run pf (pe e x.length) x = some (f x)) ->
SearchEasy M f
theorem owf_p_ne_np (M : OM) (hs : S2D M) (f : List Bool -> List Bool) (ho : OneWay2 M f) :
(forall L, InNPo M L -> InPo M L) -> False :=
fun heq => owf_not_search M f ho (hs heq f ho.easy)
end Found.Owf1
#print axioms Found.Owf1.t329_degenerate
#print axioms Found.Owf1.t329_identity
#print axioms Found.Owf1.count_app
#print axioms Found.Owf1.count_mapC
#print axioms Found.Owf1.count_all
#print axioms Found.Owf1.pow2_pos
#print axioms Found.Owf1.not_double
#print axioms Found.Owf1.owf_not_search
#print axioms Found.Owf1.owf_p_ne_np
lean_all/found/Owf2.lean
/-
T332 piece 2. found/Owf2 -- counting tools for pseudorandom generators: a list of all bit
strings of length n holds each string once, and the strings in an image are counted by
their preimages.
Counts are over the list allBits n (Pnp8) and use Owf1's count and beqL. Proved:
* beqL_refl, beqL_eq: beqL decides equality of bit lists;
* count_mono, count_le_add, count_zero: monotone and subadditive counting;
* count_one, count_le_one: a string of length n occurs exactly once in allBits n, and
any string at most once;
* image_count: if every u counted by g has a preimage s of length n under G, then the
strings of a list holding each string at most once that g counts are at most the
seeds s in allBits n with g (G s): #{u : g u} <= #{s : g (G s)}.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Owf1
namespace Found.Owf2
open Found.Pnp8 (mapC allBits)
open Found.Owf1 (beqL count count_app count_mapC)
def bv (b : Bool) : Nat := match b with | true => 1 | false => 0
theorem beqB_eq (a b : Bool) (h : (a == b) = true) : a = b := by
cases a with
| false => cases b with
| false => rfl
| true => exact Bool.noConfusion h
| true => cases b with
| false => exact Bool.noConfusion h
| true => rfl
theorem beqL_refl : forall x : List Bool, beqL x x = true := by
intro x
induction x with
| nil => rfl
| cons a x ih =>
show ((a == a) && beqL x x) = true
rw [ih]
cases a with
| false => rfl
| true => rfl
theorem and_left {a b : Bool} (h : (a && b) = true) : a = true := by
cases a with
| false => exact Bool.noConfusion h
| true => rfl
theorem and_right {a b : Bool} (h : (a && b) = true) : b = true := by
cases a with
| false => exact Bool.noConfusion h
| true => exact h
theorem beqL_eq : forall x y : List Bool, beqL x y = true -> x = y := by
intro x
induction x with
| nil =>
intro y h
cases y with
| nil => rfl
| cons b y => exact Bool.noConfusion h
| cons a x ih =>
intro y h
cases y with
| nil => exact Bool.noConfusion h
| cons b y =>
have h' : ((a == b) && beqL x y) = true := h
rw [beqB_eq a b (and_left h'), ih y (and_right h')]
/-! ## Counting -/
theorem bv_le (a b : Bool) (h : a = true -> b = true) : bv a <= bv b := by
cases a with
| false => exact Nat.zero_le _
| true => rw [h rfl]; exact Nat.le_refl 1
theorem count_mono (f g : List Bool -> Bool) (h : forall u, f u = true -> g u = true) :
forall A, count f A <= count g A := by
intro A
induction A with
| nil => exact Nat.le_refl 0
| cons u A ih => exact Nat.add_le_add ih (bv_le (f u) (g u) (h u))
theorem count_zero (f : List Bool -> Bool) (h : forall u, f u = false) : forall A, count f A = 0 := by
intro A
induction A with
| nil => rfl
| cons u A ih =>
show count f A + bv (f u) = 0
rw [ih, h u]
rfl
theorem bv_or (a b : Bool) : bv (a || b) <= bv a + bv b := by
cases a with
| false => exact Nat.le_of_eq (Nat.zero_add _).symm
| true => exact Nat.le_add_right 1 _
theorem count_le_add (f f1 f2 : List Bool -> Bool) (h : forall u, bv (f u) <= bv (f1 u) + bv (f2 u)) :
forall A, count f A <= count f1 A + count f2 A := by
intro A
induction A with
| nil => exact Nat.le_refl 0
| cons u A ih =>
show count f A + bv (f u) <= count f1 A + bv (f1 u) + (count f2 A + bv (f2 u))
refine Nat.le_trans (Nat.add_le_add ih (h u)) (Nat.le_of_eq ?_)
rw [Nat.add_assoc, Nat.add_assoc, Nat.add_left_comm (count f2 A) (bv (f1 u)) (bv (f2 u))]
/-! ## Each string once in allBits -/
theorem count_one : forall n (x : List Bool), x.length = n -> count (fun y => beqL y x) (allBits n) = 1 := by
intro n
induction n with
| zero =>
intro x hx
cases x with
| nil => rfl
| cons b x => exact Nat.noConfusion hx
| succ n ih =>
intro x hx
cases x with
| nil => exact Nat.noConfusion hx
| cons b x =>
have hx' : x.length = n := Nat.succ.inj hx
show count (fun y => beqL y (b :: x)) (mapC false (allBits n) ++ mapC true (allBits n)) = 1
rw [count_app, count_mapC, count_mapC]
cases b with
| false =>
show count (fun y => beqL y x) (allBits n) + count (fun _ => false) (allBits n) = 1
rw [ih x hx', count_zero (fun _ => false) (fun _ => rfl)]
| true =>
show count (fun _ => false) (allBits n) + count (fun y => beqL y x) (allBits n) = 1
rw [ih x hx', count_zero (fun _ => false) (fun _ => rfl)]
theorem count_le_one : forall n (x : List Bool), count (fun y => beqL y x) (allBits n) <= 1 := by
intro n
induction n with
| zero =>
intro x
show 0 + bv (beqL [] x) <= 1
rw [Nat.zero_add]
cases beqL [] x with
| false => exact Nat.zero_le 1
| true => exact Nat.le_refl 1
| succ n ih =>
intro x
show count (fun y => beqL y x) (mapC false (allBits n) ++ mapC true (allBits n)) <= 1
rw [count_app, count_mapC, count_mapC]
cases x with
| nil =>
show count (fun _ => false) (allBits n) + count (fun _ => false) (allBits n) <= 1
rw [count_zero (fun _ => false) (fun _ => rfl)]
exact Nat.zero_le 1
| cons b x =>
cases b with
| false =>
show count (fun y => beqL y x) (allBits n) + count (fun _ => false) (allBits n) <= 1
rw [count_zero (fun _ => false) (fun _ => rfl)]
exact ih x
| true =>
show count (fun _ => false) (allBits n) + count (fun y => beqL y x) (allBits n) <= 1
rw [count_zero (fun _ => false) (fun _ => rfl), Nat.zero_add]
exact ih x
/-! ## Images counted by preimages -/
/-- Some seed in B maps to u. -/
def hitc (G : List Bool -> List Bool) (u : List Bool) : List (List Bool) -> Bool
| [] => false
| s :: B => beqL u (G s) || hitc G u B
theorem or_l {a b : Bool} (h : a = true) : (a || b) = true := by rw [h]; rfl
theorem or_r {a b : Bool} (h : b = true) : (a || b) = true := by
cases a with
| false => exact h
| true => rfl
theorem hitc_of (G : List Bool -> List Bool) (u s : List Bool) (hs : G s = u) :
forall B, 1 <= count (fun y => beqL y s) B -> hitc G u B = true := by
intro B
induction B with
| nil => intro h; exact absurd h (Nat.not_succ_le_zero 0)
| cons s' B ih =>
intro h
show (beqL u (G s') || hitc G u B) = true
cases e : beqL s' s with
| true =>
have es : s' = s := beqL_eq s' s e
apply or_l
rw [es, hs]
exact beqL_refl u
| false =>
apply or_r
apply ih
have h' : 1 <= count (fun y => beqL y s) B + bv (beqL s' s) := h
rw [e] at h'
exact h'
theorem image_le (G : List Bool -> List Bool) (g : List Bool -> Bool) (A : List (List Bool))
(hA : forall v, count (fun y => beqL y v) A <= 1) :
forall B, count (fun u => g u && hitc G u B) A <= count (fun s => g (G s)) B := by
intro B
induction B with
| nil =>
show count (fun u => g u && false) A <= 0
rw [count_zero _ (fun u => by cases g u with | false => rfl | true => rfl)]
exact Nat.le_refl 0
| cons s B ih =>
show count (fun u => g u && (beqL u (G s) || hitc G u B)) A <= count (fun s => g (G s)) B + bv (g (G s))
have hsplit := count_le_add (fun u => g u && (beqL u (G s) || hitc G u B))
(fun u => g u && beqL u (G s)) (fun u => g u && hitc G u B)
(fun u => by
cases g u with
| false => exact Nat.zero_le _
| true => exact bv_or _ _) A
have hone : count (fun u => g u && beqL u (G s)) A <= bv (g (G s)) := by
cases eg : g (G s) with
| true =>
exact Nat.le_trans (count_mono _ (fun y => beqL y (G s)) (fun u hu => and_right hu) A) (hA (G s))
| false =>
rw [count_zero _ (fun u => by
cases eu : beqL u (G s) with
| false => cases g u with | false => rfl | true => rfl
| true =>
have e1 : u = G s := beqL_eq u (G s) eu
rw [e1, eg]
rfl)]
exact Nat.zero_le 0
refine Nat.le_trans hsplit ?_
rw [Nat.add_comm (count (fun s => g (G s)) B)]
exact Nat.add_le_add hone ih
theorem image_count (G : List Bool -> List Bool) (g : List Bool -> Bool) (n : Nat) (A : List (List Bool))
(hA : forall v, count (fun y => beqL y v) A <= 1)
(hpre : forall u, g u = true -> Exists fun s => s.length = n /\ G s = u) :
count g A <= count (fun s => g (G s)) (allBits n) := by
refine Nat.le_trans (count_mono g (fun u => g u && hitc G u (allBits n)) ?_ A) (image_le G g A hA (allBits n))
intro u hu
cases hpre u hu with
| intro s hs =>
rw [hu, hitc_of G u s hs.2 (allBits n) (Nat.le_of_eq (count_one n s hs.1).symm)]
rfl
end Found.Owf2
#print axioms Found.Owf2.beqB_eq
#print axioms Found.Owf2.beqL_refl
#print axioms Found.Owf2.beqL_eq
#print axioms Found.Owf2.count_mono
#print axioms Found.Owf2.count_zero
#print axioms Found.Owf2.count_le_add
#print axioms Found.Owf2.count_one
#print axioms Found.Owf2.count_le_one
#print axioms Found.Owf2.hitc_of
#print axioms Found.Owf2.image_le
#print axioms Found.Owf2.image_count
lean_all/found/Owf3.lean
/-
T332 piece 3. found/Owf3 -- a pseudorandom generator is a one-way function (the easy half
of Hastad--Impagliazzo--Levin--Luby 1999, read off the chain).
Over the machine model with output (Pnp3.OM), with counts over all strings (Owf1, Owf2):
* PRG M G: G stretches by one bit, is computed in polynomial time, and every
distinguisher D with budget b has, for every polynomial e and all large n, advantage
(2 cntG - cntU) / 2^(n+1) at most 1 / (e(n) + 2), where cntG counts seeds s of length
n with D (G s) = 1 and cntU counts strings u of length n + 1 with D u = 1;
* DistLaw M G: for an inverter inv and budget e there is a program D that, on u, runs
inv on u and outputs whether G maps the result to u (a law of the model: running one
program, then G, then comparing);
* prg_owf: a PRG (with DistLaw) is a one-way function in the sense of Owf1.OneWay2.
Proof: the inversion distinguisher accepts G s exactly when inv inverts s, so cntG is the
inverter's success S; every u it accepts has a seed of length n (stretch), so cntU <= S
(Owf2.image_count); the advantage bound then gives S (e(n) + 2) <= 2^n.
Relativizes (a bridge; PNP_MAP.md). ASCII forms only. CIC dependence: none.
-/
import found.Owf2
import found.Pnp20
namespace Found.Owf3
open Found.Pnp3 (OM PE pe)
open Found.Pnp8 (mapC allBits)
open Found.Pnp9 (pow2)
open Found.Owf1 (beqL count count_app count_mapC succN inverts invOut OneWay2)
open Found.Owf2 (bv beqL_eq count_le_one image_count)
def bitOut : Option (List Bool) -> Bool
| none => false
| some [] => false
| some (b :: _) => b
def acc (M : OM) (D : M.Prog) (t : Nat) (u : List Bool) : Bool := bitOut (M.run D t u)
def cntG (M : OM) (G : List Bool -> List Bool) (D : M.Prog) (b : PE) (n : Nat) : Nat :=
count (fun s => acc M D (pe b n) (G s)) (allBits n)
def cntU (M : OM) (D : M.Prog) (b : PE) (n : Nat) : Nat :=
count (acc M D (pe b n)) (allBits (n + 1))
structure PRG (M : OM) (G : List Bool -> List Bool) : Prop where
easy : Exists fun pf : M.Prog => Exists fun e : PE => forall x, M.run pf (pe e x.length) x = some (G x)
stretch : forall s, (G s).length = s.length + 1
fool : forall (D : M.Prog) (b e : PE), Exists fun n0 => forall n, n0 <= n ->
(cntG M G D b n + cntG M G D b n) * (pe e n + 2) <= cntU M D b n * (pe e n + 2) + pow2 (n + 1)
/-- Output of the inversion test on u. -/
def outHit (G : List Bool -> List Bool) (u : List Bool) : Option (List Bool) -> Bool
| none => false
| some y => beqL (G y) u
def DistLaw (M : OM) (G : List Bool -> List Bool) : Prop :=
forall (inv : M.Prog) (e : PE), Exists fun D : M.Prog =>
forall n u, acc M D (pe e n) u = outHit G u (M.run inv (pe e n) u)
/-! ## Counting helpers -/
theorem count_ext (f g : List Bool -> Bool) (h : forall x, f x = g x) : forall A, count f A = count g A := by
intro A
induction A with
| nil => rfl
| cons x A ih =>
show count f A + bv (f x) = count g A + bv (g x)
rw [ih, h x]
theorem count_ext_len : forall m (f g : List Bool -> Bool), (forall x, x.length = m -> f x = g x) ->
count f (allBits m) = count g (allBits m) := by
intro m
induction m with
| zero =>
intro f g h
show 0 + bv (f []) = 0 + bv (g [])
rw [h [] rfl]
| succ m ih =>
intro f g h
show count f (mapC false (allBits m) ++ mapC true (allBits m)) =
count g (mapC false (allBits m) ++ mapC true (allBits m))
rw [count_app, count_app, count_mapC, count_mapC, count_mapC, count_mapC]
rw [ih (fun x => f (false :: x)) (fun x => g (false :: x)) (fun x hx => h (false :: x) (congrArg Nat.succ hx))]
rw [ih (fun x => f (true :: x)) (fun x => g (true :: x)) (fun x hx => h (true :: x) (congrArg Nat.succ hx))]
theorem add_cancel_le : forall a b c : Nat, a + b <= a + c -> b <= c := by
intro a
induction a with
| zero => intro b c h; rw [Nat.zero_add, Nat.zero_add] at h; exact h
| succ a ih =>
intro b c h
rw [Nat.succ_add, Nat.succ_add] at h
exact ih b c (Nat.le_of_succ_le_succ h)
theorem half_le : forall a b : Nat, a + a <= b + b -> a <= b := by
intro a
induction a with
| zero => intro b _; exact Nat.zero_le b
| succ a ih =>
intro b h
cases b with
| zero => exact absurd h (Nat.not_succ_le_zero _)
| succ b =>
have h1 : a + 1 + a <= b + 1 + b := Nat.le_of_succ_le_succ h
rw [Nat.succ_add, Nat.succ_add] at h1
exact Nat.succ_le_succ (ih b (Nat.le_of_succ_le_succ h1))
theorem add_mul' (a b : Nat) : forall X, (a + b) * X = a * X + b * X := by
intro X
induction X with
| zero => rfl
| succ X ih =>
show (a + b) * X + (a + b) = (a * X + a) + (b * X + b)
rw [ih, Nat.add_assoc, Nat.add_assoc, Nat.add_left_comm (b * X) a b]
theorem beq_self (n : Nat) : Nat.beq n n = true := Found.Pnp20.beq_refl' n
theorem and_true' (a : Bool) : (a && true) = a := by
cases a with
| false => rfl
| true => rfl
/-! ## PRG => OWF -/
/-- Twice the bound plus two: pe (e2 e) n + 2 = (pe e n + 2) + (pe e n + 2). -/
def e2 (e : PE) : PE := .add (.add e (.c 2)) e
theorem prg_owf (M : OM) (G : List Bool -> List Bool) (hp : PRG M G) (hl : DistLaw M G) : OneWay2 M G := by
refine OneWay2.mk hp.easy ?_
intro inv e
cases hl inv e with
| intro D hD =>
cases hp.fool D e (e2 e) with
| intro n0 hn =>
refine Exists.intro n0 (fun n hn0 => ?_)
have hG : cntG M G D e n = succN M G inv e n := by
refine count_ext _ _ (fun s => ?_) (allBits n)
show acc M D (pe e n) (G s) = invOut G s (M.run inv (pe e n) (G s))
rw [hD n (G s)]
cases M.run inv (pe e n) (G s) with
| none => rfl
| some y => rfl
have hU : cntU M D e n <= succN M G inv e n := by
have h1 : cntU M D e n =
count (fun u => acc M D (pe e n) u && Nat.beq u.length (n + 1)) (allBits (n + 1)) :=
count_ext_len (n + 1) _ _ (fun x hx => by rw [hx, beq_self, and_true'])
have h2 := image_count G (fun u => acc M D (pe e n) u && Nat.beq u.length (n + 1)) n (allBits (n + 1))
(fun v => count_le_one (n + 1) v)
(fun u hu => by
have ha := Found.Owf2.and_left hu
have hlen : u.length = n + 1 := Found.Pnp2.beq_eq _ _ (Found.Owf2.and_right hu)
rw [hD n u] at ha
cases hr : M.run inv (pe e n) u with
| none =>
rw [hr] at ha
exact Bool.noConfusion ha
| some y =>
rw [hr] at ha
have hy : G y = u := beqL_eq (G y) u ha
refine Exists.intro y (And.intro ?_ hy)
have hs := hp.stretch y
rw [hy, hlen] at hs
exact (Nat.succ.inj hs).symm)
have h3 : count (fun s => acc M D (pe e n) (G s) && Nat.beq (G s).length (n + 1)) (allBits n) =
cntG M G D e n :=
count_ext_len n _ _ (fun x hx => by rw [hp.stretch x, hx, beq_self, and_true'])
rw [h1]
exact Nat.le_trans h2 (Nat.le_of_eq (h3.trans hG))
have hb := hn n hn0
rw [hG] at hb
have hb2 : (succN M G inv e n + succN M G inv e n) * (pe (e2 e) n + 2) <=
succN M G inv e n * (pe (e2 e) n + 2) + pow2 (n + 1) :=
Nat.le_trans hb (Nat.add_le_add_right (Nat.mul_le_mul hU (Nat.le_refl _)) _)
rw [add_mul'] at hb2
have hc := add_cancel_le _ _ _ hb2
have hx : succN M G inv e n * (pe (e2 e) n + 2) =
succN M G inv e n * (pe e n + 2) + succN M G inv e n * (pe e n + 2) := by
show succN M G inv e n * ((pe e n + 2) + (pe e n + 2)) = _
rw [Nat.left_distrib]
rw [hx] at hc
exact half_le _ (pow2 n) hc
end Found.Owf3
#print axioms Found.Owf3.count_ext
#print axioms Found.Owf3.count_ext_len
#print axioms Found.Owf3.add_cancel_le
#print axioms Found.Owf3.half_le
#print axioms Found.Owf3.add_mul'
#print axioms Found.Owf3.beq_self
#print axioms Found.Owf3.and_true'
#print axioms Found.Owf3.prg_owf
lean_all/found/Owf4.lean
/-
T332 piece 4. found/Owf4 -- one-way functions on the register machine (Pnp20) as a
concrete model: P, NP, computing a function, inverting, and the bridge.
Conventions: input in register 13 (Pnp59 inpR), output in register 16; a program ends when
its counter reaches its length, staying on its instructions before (Pnp68 Inside).
* resRM I t z: the output of I on z if it has ended after t steps;
* DecRM, InPrm, InNPrm: deciding (first output bit) within a polynomial, P and NP
(certificates through Pnp4.enc);
* CompRM: computing a function within a polynomial;
* OneWayRM, SearchRM: one-way (success counted over all 2^n inputs, as Owf1) and
polynomial-time inversion;
* owf_not_search_rm: a one-way function has no polynomial-time inverter;
* S2DRM, owf_p_ne_np_rm: with search-to-decision on the register machine (open lemma
O5, now a statement about this concrete model), a one-way function gives NP not
inside P.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Owf1
import found.Pnp69
import found.Pnp59
namespace Found.Owf4
open Found.Pnp3 (PE pe)
open Found.Pnp8 (allBits)
open Found.Pnp9 (pow2)
open Found.Pnp20 (Ins Cfg run)
open Found.Pnp21 (Runs)
open Found.Pnp68 (Inside)
open Found.Pnp59 (inpR)
open Found.Owf1 (beqL count count_all pow2_pos not_double)
def outBit : List Bool -> Bool
| [] => false
| b :: _ => b
def selOL : Bool -> Option (List Bool) -> Option (List Bool) -> Option (List Bool)
| true, a, _ => a
| false, _, b => b
/-- The output of I on z if it has ended after t steps. -/
def resRM (I : List Ins) (t : Nat) (z : List Bool) : Option (List Bool) :=
selOL (Nat.beq (run I t (Cfg.mk 0 (inpR z))).pc I.length) (some ((run I t (Cfg.mk 0 (inpR z))).regs 16)) none
def DecRM (D : List Ins) (e : PE) (L : List Bool -> Bool) : Prop :=
forall x, Exists fun N => Exists fun y => N <= pe e x.length /\ Runs D N 0 (inpR x) D.length y /\
Inside D N (Cfg.mk 0 (inpR x)) /\ outBit (y 16) = L x
def InPrm (L : List Bool -> Bool) : Prop := Exists fun D => Exists fun e => DecRM D e L
def InNPrm (L : List Bool -> Bool) : Prop :=
Exists fun V : List Bool -> Bool => Exists fun b : PE => InPrm V /\
forall x, L x = true <-> Exists fun w : List Bool => w.length <= pe b x.length /\ V (Found.Pnp4.enc x w) = true
def CompRM (F : List Ins) (e : PE) (f : List Bool -> List Bool) : Prop :=
forall x, Exists fun N => Exists fun y => N <= pe e x.length /\ Runs F N 0 (inpR x) F.length y /\
Inside F N (Cfg.mk 0 (inpR x)) /\ y 16 = f x
def invOK (f : List Bool -> List Bool) (x : List Bool) : Option (List Bool) -> Bool
| none => false
| some y => beqL (f y) (f x)
def succRM (f : List Bool -> List Bool) (I : List Ins) (e : PE) (n : Nat) : Nat :=
count (fun x => invOK f x (resRM I (pe e n) (f x))) (allBits n)
structure OneWayRM (f : List Bool -> List Bool) : Prop where
easy : Exists fun F => Exists fun e => CompRM F e f
hard : forall (I : List Ins) (e : PE), Exists fun n0 => forall n, n0 <= n ->
succRM f I e n * (pe e n + 2) <= pow2 n
def SearchRM (f : List Bool -> List Bool) : Prop :=
Exists fun I : List Ins => Exists fun e : PE => forall x, invOK f x (resRM I (pe e x.length) (f x)) = true
theorem owf_not_search_rm (f : List Bool -> List Bool) (ho : OneWayRM f) (hs : SearchRM f) : False :=
match hs with
| Exists.intro I (Exists.intro e he) =>
match ho.hard I e with
| Exists.intro n0 hn =>
have hc : succRM f I e n0 = pow2 n0 :=
count_all n0 (fun x => invOK f x (resRM I (pe e n0) (f x))) (fun x hx => by rw [hx.symm]; exact he x)
have hb := hn n0 (Nat.le_refl n0)
not_double (pow2 n0) (pe e n0) (pow2_pos n0) (by rw [hc] at hb; exact hb)
/-- Search-to-decision on the register machine (open lemma O5 for this model). -/
def S2DRM : Prop :=
(forall L, InNPrm L -> InPrm L) ->
forall f : List Bool -> List Bool, (Exists fun F => Exists fun e => CompRM F e f) -> SearchRM f
theorem owf_p_ne_np_rm (hs : S2DRM) (f : List Bool -> List Bool) (ho : OneWayRM f) :
(forall L, InNPrm L -> InPrm L) -> False :=
fun heq => owf_not_search_rm f ho (hs heq f ho.easy)
end Found.Owf4
#print axioms Found.Owf4.owf_not_search_rm
#print axioms Found.Owf4.owf_p_ne_np_rm
lean_all/found/PAEmbed.lean
/-
T124 (b), part 4. found/PAEmbed — embedding Peano arithmetic into Z∞
(found/Zinf), hence PA is consistent, and every PA-provable sequent has
cut-free Z∞-derivations of height below ε₀.
Part A: substitution on terms and formulas, and transport of Z∞
derivations along items related by a meaning-preserving substitution.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Zinf
namespace Found
namespace PAE
open _root_.Found.Ord _root_.Found.Zinf
def subT (σ : Nat → Tm) : Tm → Tm
| .var i => σ i
| .zero => .zero
| .succ t => .succ (subT σ t)
| .add s t => .add (subT σ s) (subT σ t)
| .mul s t => .mul (subT σ s) (subT σ t)
def shiftT (t : Tm) : Tm := subT (fun v => .var (v + 1)) t
def upS (σ : Nat → Tm) : Nat → Tm
| 0 => .var 0
| v + 1 => shiftT (σ v)
def subF (σ : Nat → Tm) : Fm → Fm
| .eq s t => .eq (subT σ s) (subT σ t)
| .ne s t => .ne (subT σ s) (subT σ t)
| .and a b => .and (subF σ a) (subF σ b)
| .or a b => .or (subF σ a) (subF σ b)
| .all a => .all (subF (upS σ) a)
| .ex a => .ex (subF (upS σ) a)
theorem ev_subT (ρ' ρ : Nat → Nat) (σ : Nat → Tm) (h : ∀ v, ev ρ' (σ v) = ρ v) :
(t : Tm) → ev ρ' (subT σ t) = ev ρ t
| .var i => h i
| .zero => rfl
| .succ t => congrArg (· + 1) (ev_subT ρ' ρ σ h t)
| .add s t => by show ev ρ' (subT σ s) + ev ρ' (subT σ t) = _; rw [ev_subT ρ' ρ σ h s, ev_subT ρ' ρ σ h t]; rfl
| .mul s t => by show ev ρ' (subT σ s) * ev ρ' (subT σ t) = _; rw [ev_subT ρ' ρ σ h s, ev_subT ρ' ρ σ h t]; rfl
theorem ev_shift (n : Nat) (ρ : Nat → Nat) (t : Tm) : ev (cons n ρ) (shiftT t) = ev ρ t :=
ev_subT (cons n ρ) ρ _ (fun _ => rfl) t
theorem ev_upS (ρ' ρ : Nat → Nat) (σ : Nat → Tm) (h : ∀ v, ev ρ' (σ v) = ρ v) (n : Nat) :
∀ v, ev (cons n ρ') (upS σ v) = cons n ρ v
| 0 => rfl
| v + 1 => (ev_shift n ρ' (σ v)).trans (h v)
theorem trueAt_sub (σ : Nat → Tm) : (A : Fm) → (ρ' ρ : Nat → Nat) → (∀ v, ev ρ' (σ v) = ρ v) →
(TrueAt (subF σ A) ρ' ↔ TrueAt A ρ)
| .eq s t, ρ', ρ, h => by
show ev ρ' (subT σ s) = ev ρ' (subT σ t) ↔ ev ρ s = ev ρ t
rw [ev_subT ρ' ρ σ h s, ev_subT ρ' ρ σ h t]
| .ne s t, ρ', ρ, h => by
show ev ρ' (subT σ s) ≠ ev ρ' (subT σ t) ↔ ev ρ s ≠ ev ρ t
rw [ev_subT ρ' ρ σ h s, ev_subT ρ' ρ σ h t]
| .and _ _, _, _, _ => Iff.rfl
| .or _ _, _, _, _ => Iff.rfl
| .all _, _, _, _ => Iff.rfl
| .ex _, _, _, _ => Iff.rfl
theorem subT_var : (t : Tm) → subT Tm.var t = t
| .var _ => rfl
| .zero => rfl
| .succ t => congrArg Tm.succ (subT_var t)
| .add s t => by show Tm.add _ _ = _; rw [subT_var s, subT_var t]
| .mul s t => by show Tm.mul _ _ = _; rw [subT_var s, subT_var t]
theorem subT_ext {σ τ : Nat → Tm} (h : ∀ v, σ v = τ v) : (t : Tm) → subT σ t = subT τ t
| .var i => h i
| .zero => rfl
| .succ t => congrArg Tm.succ (subT_ext h t)
| .add s t => by show Tm.add _ _ = _; rw [subT_ext h s, subT_ext h t]; rfl
| .mul s t => by show Tm.mul _ _ = _; rw [subT_ext h s, subT_ext h t]; rfl
theorem upS_ext {σ τ : Nat → Tm} (h : ∀ v, σ v = τ v) : ∀ v, upS σ v = upS τ v
| 0 => rfl
| v + 1 => congrArg shiftT (h v)
theorem subF_ext : (A : Fm) → {σ τ : Nat → Tm} → (∀ v, σ v = τ v) → subF σ A = subF τ A
| .eq s t, _, _, h => by show Fm.eq _ _ = _; rw [subT_ext h s, subT_ext h t]; rfl
| .ne s t, _, _, h => by show Fm.ne _ _ = _; rw [subT_ext h s, subT_ext h t]; rfl
| .and a b, _, _, h => by show Fm.and _ _ = _; rw [subF_ext a h, subF_ext b h]; rfl
| .or a b, _, _, h => by show Fm.or _ _ = _; rw [subF_ext a h, subF_ext b h]; rfl
| .all a, _, _, h => congrArg Fm.all (subF_ext a (upS_ext h))
| .ex a, _, _, h => congrArg Fm.ex (subF_ext a (upS_ext h))
theorem upS_var : ∀ v, upS Tm.var v = Tm.var v
| 0 => rfl
| _ + 1 => rfl
theorem subF_var : (A : Fm) → subF Tm.var A = A
| .eq s t => by show Fm.eq _ _ = _; rw [subT_var s, subT_var t]
| .ne s t => by show Fm.ne _ _ = _; rw [subT_var s, subT_var t]
| .and a b => by show Fm.and _ _ = _; rw [subF_var a, subF_var b]
| .or a b => by show Fm.or _ _ = _; rw [subF_var a, subF_var b]
| .all a => congrArg Fm.all ((subF_ext a upS_var).trans (subF_var a))
| .ex a => congrArg Fm.ex ((subF_ext a upS_var).trans (subF_var a))
/-- two items have the same meaning: same shape, equivalent atoms -/
def Eqv : Fm → (Nat → Nat) → Fm → (Nat → Nat) → Prop
| .eq s t, ρ, .eq s' t', ρ' => (ev ρ s = ev ρ t ↔ ev ρ' s' = ev ρ' t')
| .eq _ _, _, .ne _ _, _ => False
| .eq _ _, _, .and _ _, _ => False
| .eq _ _, _, .or _ _, _ => False
| .eq _ _, _, .all _, _ => False
| .eq _ _, _, .ex _, _ => False
| .ne _ _, _, .eq _ _, _ => False
| .ne s t, ρ, .ne s' t', ρ' => (ev ρ s = ev ρ t ↔ ev ρ' s' = ev ρ' t')
| .ne _ _, _, .and _ _, _ => False
| .ne _ _, _, .or _ _, _ => False
| .ne _ _, _, .all _, _ => False
| .ne _ _, _, .ex _, _ => False
| .and _ _, _, .eq _ _, _ => False
| .and _ _, _, .ne _ _, _ => False
| .and a b, ρ, .and a' b', ρ' => Eqv a ρ a' ρ' ∧ Eqv b ρ b' ρ'
| .and _ _, _, .or _ _, _ => False
| .and _ _, _, .all _, _ => False
| .and _ _, _, .ex _, _ => False
| .or _ _, _, .eq _ _, _ => False
| .or _ _, _, .ne _ _, _ => False
| .or _ _, _, .and _ _, _ => False
| .or a b, ρ, .or a' b', ρ' => Eqv a ρ a' ρ' ∧ Eqv b ρ b' ρ'
| .or _ _, _, .all _, _ => False
| .or _ _, _, .ex _, _ => False
| .all _, _, .eq _ _, _ => False
| .all _, _, .ne _ _, _ => False
| .all _, _, .and _ _, _ => False
| .all _, _, .or _ _, _ => False
| .all a, ρ, .all a', ρ' => ∀ n, Eqv a (cons n ρ) a' (cons n ρ')
| .all _, _, .ex _, _ => False
| .ex _, _, .eq _ _, _ => False
| .ex _, _, .ne _ _, _ => False
| .ex _, _, .and _ _, _ => False
| .ex _, _, .or _ _, _ => False
| .ex _, _, .all _, _ => False
| .ex a, ρ, .ex a', ρ' => ∀ n, Eqv a (cons n ρ) a' (cons n ρ')
theorem eqv_refl : (A : Fm) → (ρ : Nat → Nat) → Eqv A ρ A ρ
| .eq _ _, _ => Iff.rfl
| .ne _ _, _ => Iff.rfl
| .and a b, ρ => ⟨eqv_refl a ρ, eqv_refl b ρ⟩
| .or a b, ρ => ⟨eqv_refl a ρ, eqv_refl b ρ⟩
| .all a, ρ => fun n => eqv_refl a (cons n ρ)
| .ex a, ρ => fun n => eqv_refl a (cons n ρ)
theorem eqv_symm : (A : Fm) → (ρ : Nat → Nat) → (A' : Fm) → (ρ' : Nat → Nat) → Eqv A ρ A' ρ' → Eqv A' ρ' A ρ
| .eq _ _, _, .eq _ _, _, h => h.symm
| .ne _ _, _, .ne _ _, _, h => h.symm
| .and a b, ρ, .and a' b', ρ', h => ⟨eqv_symm a ρ a' ρ' h.1, eqv_symm b ρ b' ρ' h.2⟩
| .or a b, ρ, .or a' b', ρ', h => ⟨eqv_symm a ρ a' ρ' h.1, eqv_symm b ρ b' ρ' h.2⟩
| .all a, _, .all a', _, h => fun n => eqv_symm a _ a' _ (h n)
| .ex a, _, .ex a', _, h => fun n => eqv_symm a _ a' _ (h n)
| .eq _ _, _, .ne _ _, _, h => h.elim
| .eq _ _, _, .and _ _, _, h => h.elim
| .eq _ _, _, .or _ _, _, h => h.elim
| .eq _ _, _, .all _, _, h => h.elim
| .eq _ _, _, .ex _, _, h => h.elim
| .ne _ _, _, .eq _ _, _, h => h.elim
| .ne _ _, _, .and _ _, _, h => h.elim
| .ne _ _, _, .or _ _, _, h => h.elim
| .ne _ _, _, .all _, _, h => h.elim
| .ne _ _, _, .ex _, _, h => h.elim
| .and _ _, _, .eq _ _, _, h => h.elim
| .and _ _, _, .ne _ _, _, h => h.elim
| .and _ _, _, .or _ _, _, h => h.elim
| .and _ _, _, .all _, _, h => h.elim
| .and _ _, _, .ex _, _, h => h.elim
| .or _ _, _, .eq _ _, _, h => h.elim
| .or _ _, _, .ne _ _, _, h => h.elim
| .or _ _, _, .and _ _, _, h => h.elim
| .or _ _, _, .all _, _, h => h.elim
| .or _ _, _, .ex _, _, h => h.elim
| .all _, _, .eq _ _, _, h => h.elim
| .all _, _, .ne _ _, _, h => h.elim
| .all _, _, .and _ _, _, h => h.elim
| .all _, _, .or _ _, _, h => h.elim
| .all _, _, .ex _, _, h => h.elim
| .ex _, _, .eq _ _, _, h => h.elim
| .ex _, _, .ne _ _, _, h => h.elim
| .ex _, _, .and _ _, _, h => h.elim
| .ex _, _, .or _ _, _, h => h.elim
| .ex _, _, .all _, _, h => h.elim
theorem eqv_sub (σ : Nat → Tm) : (A : Fm) → (ρ' ρ : Nat → Nat) → (∀ v, ev ρ' (σ v) = ρ v) →
Eqv (subF σ A) ρ' A ρ
| .eq s t, ρ', ρ, h => by
show ev ρ' (subT σ s) = ev ρ' (subT σ t) ↔ ev ρ s = ev ρ t
rw [ev_subT ρ' ρ σ h s, ev_subT ρ' ρ σ h t]
| .ne s t, ρ', ρ, h => by
show ev ρ' (subT σ s) = ev ρ' (subT σ t) ↔ ev ρ s = ev ρ t
rw [ev_subT ρ' ρ σ h s, ev_subT ρ' ρ σ h t]
| .and a b, ρ', ρ, h => ⟨eqv_sub σ a ρ' ρ h, eqv_sub σ b ρ' ρ h⟩
| .or a b, ρ', ρ, h => ⟨eqv_sub σ a ρ' ρ h, eqv_sub σ b ρ' ρ h⟩
| .all a, ρ', ρ, h => fun n => eqv_sub (upS σ) a (cons n ρ') (cons n ρ) (ev_upS ρ' ρ σ h n)
| .ex a, ρ', ρ, h => fun n => eqv_sub (upS σ) a (cons n ρ') (cons n ρ) (ev_upS ρ' ρ σ h n)
theorem eqv_dual : (A : Fm) → (ρ : Nat → Nat) → (A' : Fm) → (ρ' : Nat → Nat) → Eqv A ρ A' ρ' →
Eqv (dual A) ρ (dual A') ρ'
| .eq _ _, _, .eq _ _, _, h => h
| .ne _ _, _, .ne _ _, _, h => h
| .and a b, ρ, .and a' b', ρ', h => ⟨eqv_dual a ρ a' ρ' h.1, eqv_dual b ρ b' ρ' h.2⟩
| .or a b, ρ, .or a' b', ρ', h => ⟨eqv_dual a ρ a' ρ' h.1, eqv_dual b ρ b' ρ' h.2⟩
| .all a, _, .all a', _, h => fun n => eqv_dual a _ a' _ (h n)
| .ex a, _, .ex a', _, h => fun n => eqv_dual a _ a' _ (h n)
| .eq _ _, _, .ne _ _, _, h => h.elim
| .eq _ _, _, .and _ _, _, h => h.elim
| .eq _ _, _, .or _ _, _, h => h.elim
| .eq _ _, _, .all _, _, h => h.elim
| .eq _ _, _, .ex _, _, h => h.elim
| .ne _ _, _, .eq _ _, _, h => h.elim
| .ne _ _, _, .and _ _, _, h => h.elim
| .ne _ _, _, .or _ _, _, h => h.elim
| .ne _ _, _, .all _, _, h => h.elim
| .ne _ _, _, .ex _, _, h => h.elim
| .and _ _, _, .eq _ _, _, h => h.elim
| .and _ _, _, .ne _ _, _, h => h.elim
| .and _ _, _, .or _ _, _, h => h.elim
| .and _ _, _, .all _, _, h => h.elim
| .and _ _, _, .ex _, _, h => h.elim
| .or _ _, _, .eq _ _, _, h => h.elim
| .or _ _, _, .ne _ _, _, h => h.elim
| .or _ _, _, .and _ _, _, h => h.elim
| .or _ _, _, .all _, _, h => h.elim
| .or _ _, _, .ex _, _, h => h.elim
| .all _, _, .eq _ _, _, h => h.elim
| .all _, _, .ne _ _, _, h => h.elim
| .all _, _, .and _ _, _, h => h.elim
| .all _, _, .or _ _, _, h => h.elim
| .all _, _, .ex _, _, h => h.elim
| .ex _, _, .eq _ _, _, h => h.elim
| .ex _, _, .ne _ _, _, h => h.elim
| .ex _, _, .and _ _, _, h => h.elim
| .ex _, _, .or _ _, _, h => h.elim
| .ex _, _, .all _, _, h => h.elim
theorem eqv_true : (A : Fm) → (ρ : Nat → Nat) → (A' : Fm) → (ρ' : Nat → Nat) → Eqv A ρ A' ρ' →
TrueAt A ρ → TrueAt A' ρ'
| .eq _ _, _, .eq _ _, _, h, t => h.mp t
| .ne _ _, _, .ne _ _, _, h, t => fun e => t (h.mpr e)
| .and _ _, _, _, _, _, t => t.elim
| .or _ _, _, _, _, _, t => t.elim
| .all _, _, _, _, _, t => t.elim
| .ex _, _, _, _, _, t => t.elim
| .eq _ _, _, .ne _ _, _, h, _ => h.elim
| .eq _ _, _, .and _ _, _, h, _ => h.elim
| .eq _ _, _, .or _ _, _, h, _ => h.elim
| .eq _ _, _, .all _, _, h, _ => h.elim
| .eq _ _, _, .ex _, _, h, _ => h.elim
| .ne _ _, _, .eq _ _, _, h, _ => h.elim
| .ne _ _, _, .and _ _, _, h, _ => h.elim
| .ne _ _, _, .or _ _, _, h, _ => h.elim
| .ne _ _, _, .all _, _, h, _ => h.elim
| .ne _ _, _, .ex _, _, h, _ => h.elim
def Covers (Γ Γ' : List Item) : Prop := ∀ x, x ∈ Γ → ∃ x', x' ∈ Γ' ∧ Eqv x.1 x.2 x'.1 x'.2
theorem covers_cons {Γ Γ' : List Item} (h : Covers Γ Γ') (x x' : Item) (he : Eqv x.1 x.2 x'.1 x'.2) :
Covers (x :: Γ) (x' :: Γ') := fun y m =>
(mem_cons' m).elim (fun e => ⟨x', .head _, by rw [e]; exact he⟩) (fun m' => match h y m' with
| ⟨y', hy', hr'⟩ => ⟨y', .tail _ hy', hr'⟩)
theorem mem_of_eq {x : Item} {Γ : List Item} (A : Fm) (ρ : Nat → Nat) (hx : x ∈ Γ) (e : x.1 = A) (e2 : x.2 = ρ) :
(A, ρ) ∈ Γ := by
have : x = (A, ρ) := by
cases x with
| mk f g => cases e; cases e2; rfl
rw [← this]; exact hx
theorem eqv_and_inv (A B : Fm) (ρ ρ' : Nat → Nat) : (F : Fm) → Eqv (.and A B) ρ F ρ' → ∃ A' B', F = .and A' B' ∧ Eqv A ρ A' ρ' ∧ Eqv B ρ B' ρ'
| .eq _ _, h => h.elim
| .ne _ _, h => h.elim
| .and A' B', h => ⟨A', B', rfl, h.1, h.2⟩
| .or _ _, h => h.elim
| .all _, h => h.elim
| .ex _, h => h.elim
theorem eqv_or_inv (A B : Fm) (ρ ρ' : Nat → Nat) : (F : Fm) → Eqv (.or A B) ρ F ρ' → ∃ A' B', F = .or A' B' ∧ Eqv A ρ A' ρ' ∧ Eqv B ρ B' ρ'
| .eq _ _, h => h.elim
| .ne _ _, h => h.elim
| .and _ _, h => h.elim
| .or A' B', h => ⟨A', B', rfl, h.1, h.2⟩
| .all _, h => h.elim
| .ex _, h => h.elim
theorem eqv_all_inv (A : Fm) (ρ ρ' : Nat → Nat) : (F : Fm) → Eqv (.all A) ρ F ρ' → ∃ A', F = .all A' ∧ ∀ n, Eqv A (cons n ρ) A' (cons n ρ')
| .eq _ _, h => h.elim
| .ne _ _, h => h.elim
| .and _ _, h => h.elim
| .or _ _, h => h.elim
| .all A', h => ⟨A', rfl, h⟩
| .ex _, h => h.elim
theorem eqv_ex_inv (A : Fm) (ρ ρ' : Nat → Nat) : (F : Fm) → Eqv (.ex A) ρ F ρ' → ∃ A', F = .ex A' ∧ ∀ n, Eqv A (cons n ρ) A' (cons n ρ')
| .eq _ _, h => h.elim
| .ne _ _, h => h.elim
| .and _ _, h => h.elim
| .or _ _, h => h.elim
| .all _, h => h.elim
| .ex A', h => ⟨A', rfl, h⟩
/-- transport of Z∞ derivations along items with the same meaning -/
theorem transport {α r Γ} (d : Der α r Γ) : ∀ Γ', Covers Γ Γ' → Der α r Γ' := by
induction d with
| ax A ρ m t =>
intro Γ' h
match h _ m with
| ⟨x', hx', he⟩ => exact .ax x'.1 x'.2 hx' (eqv_true A ρ x'.1 x'.2 he t)
| and A B ρ β γ m _ _ h1 h2 ih1 ih2 =>
intro Γ' h
match h _ m with
| ⟨x', hx', he⟩ => match eqv_and_inv A B ρ x'.2 x'.1 he with
| ⟨A', B', eF, eA, eB⟩ =>
exact .and A' B' x'.2 β γ (mem_of_eq _ _ hx' eF rfl)
(ih1 _ (covers_cons h _ (A', x'.2) eA)) (ih2 _ (covers_cons h _ (B', x'.2) eB)) h1 h2
| orL A B ρ β m _ h1 ih =>
intro Γ' h
match h _ m with
| ⟨x', hx', he⟩ => match eqv_or_inv A B ρ x'.2 x'.1 he with
| ⟨A', B', eF, eA, _⟩ =>
exact .orL A' B' x'.2 β (mem_of_eq _ _ hx' eF rfl) (ih _ (covers_cons h _ (A', x'.2) eA)) h1
| orR A B ρ β m _ h1 ih =>
intro Γ' h
match h _ m with
| ⟨x', hx', he⟩ => match eqv_or_inv A B ρ x'.2 x'.1 he with
| ⟨A', B', eF, _, eB⟩ =>
exact .orR A' B' x'.2 β (mem_of_eq _ _ hx' eF rfl) (ih _ (covers_cons h _ (B', x'.2) eB)) h1
| all A ρ β m _ h1 ih =>
intro Γ' h
match h _ m with
| ⟨x', hx', he⟩ => match eqv_all_inv A ρ x'.2 x'.1 he with
| ⟨A', eF, eA⟩ =>
exact .all A' x'.2 β (mem_of_eq _ _ hx' eF rfl)
(fun n => ih n _ (covers_cons h _ (A', cons n x'.2) (eA n))) h1
| ex A ρ n β m _ h1 ih =>
intro Γ' h
match h _ m with
| ⟨x', hx', he⟩ => match eqv_ex_inv A ρ x'.2 x'.1 he with
| ⟨A', eF, eA⟩ =>
exact .ex A' x'.2 n β (mem_of_eq _ _ hx' eF rfl) (ih _ (covers_cons h _ (A', cons n x'.2) (eA n))) h1
| cut C ρ β γ hr _ _ h1 h2 ih1 ih2 =>
intro Γ' h
exact .cut C ρ β γ hr (ih1 _ (covers_cons h _ _ (eqv_refl C ρ)))
(ih2 _ (covers_cons h _ _ (eqv_refl (dual C) ρ))) h1 h2
/-! ## Part B: heights ω·d + n, rank monotonicity -/
def fin : Nat → ON
| 0 => .zero
| m + 1 => .oadd .zero m .zero
def one : ON := .oadd .zero 0 .zero
def om : Nat → Nat → ON
| 0, n => fin n
| d + 1, n => .oadd one d (fin n)
theorem fin_lt : {m n : Nat} → m < n → Lt (fin m) (fin n)
| 0, 0, h => absurd h (Nat.lt_irrefl 0)
| 0, _ + 1, _ => rfl
| _ + 1, 0, h => absurd h (Nat.not_lt_zero _)
| _ + 1, _ + 1, h => lt_of_coef (Nat.lt_of_succ_lt_succ h)
theorem om_lt_n {m n : Nat} (h : m < n) : (D : Nat) → Lt (om D m) (om D n)
| 0 => fin_lt h
| _ + 1 => lt_of_tail (fin_lt h)
theorem om_lt_succ : (d n : Nat) → Lt (om d n) (om (d + 1) 0)
| 0, 0 => rfl
| 0, _ + 1 => lt_of_exp (rfl : cmp ON.zero one = .lt)
| _ + 1, _ => lt_of_coef (Nat.lt_succ_self _)
theorem om_lt_d {d : Nat} (n : Nat) : {D : Nat} → d < D → Lt (om d n) (om D 0)
| 0, h => absurd h (Nat.not_lt_zero _)
| D + 1, h => (Nat.lt_or_ge d D).elim (fun hl => lt_trans _ _ _ (om_lt_d n hl) (om_lt_succ D 0))
(fun hg => by
have e : d = D := Nat.le_antisymm (Nat.le_of_lt_succ h) hg
rw [e]; exact om_lt_succ D n)
theorem raise_om {d D r Γ} (h : d ≤ D) (x : Der (om d 0) r Γ) : Der (om D 0) r Γ :=
(Nat.lt_or_ge d D).elim (fun hl => raise x (om_lt_d 0 hl))
(fun hg => by have e : d = D := Nat.le_antisymm h hg; rw [← e]; exact x)
theorem rank_mono {α r Γ} (d : Der α r Γ) : ∀ {r'}, r ≤ r' → Der α r' Γ := by
induction d with
| ax A ρ m t => exact fun _ => .ax A ρ m t
| and A B ρ β γ m _ _ h1 h2 ih1 ih2 => exact fun h => .and A B ρ β γ m (ih1 h) (ih2 h) h1 h2
| orL A B ρ β m _ h1 ih => exact fun h => .orL A B ρ β m (ih h) h1
| orR A B ρ β m _ h1 ih => exact fun h => .orR A B ρ β m (ih h) h1
| all A ρ β m _ h1 ih => exact fun h => .all A ρ β m (fun n => ih n h) h1
| ex A ρ n β m _ h1 ih => exact fun h => .ex A ρ n β m (ih h) h1
| cut C ρ β γ hr _ _ h1 h2 ih1 ih2 => exact fun h => .cut C ρ β γ (Nat.lt_of_lt_of_le hr h) (ih1 h) (ih2 h) h1 h2
/-! ## Part C: Peano arithmetic (Tait calculus) and its embedding -/
def shσ (v : Nat) : Tm := .var (v + 1)
def c0 (t : Tm) : Nat → Tm
| 0 => t
| v + 1 => .var v
def sσ : Nat → Tm
| 0 => .succ (.var 0)
| v + 1 => .var (v + 1)
def sh : List Fm → List Fm
| [] => []
| A :: Γ => subF shσ A :: sh Γ
def mapI (ρ : Nat → Nat) : List Fm → List Item
| [] => []
| A :: Γ => (A, ρ) :: mapI ρ Γ
theorem mem_mapI (ρ : Nat → Nat) {A : Fm} : (Γ : List Fm) → A ∈ Γ → (A, ρ) ∈ mapI ρ Γ
| [], m => nomatch m
| _ :: Γ, m => by
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (mem_mapI ρ Γ m')
/-- Peano arithmetic: true literal sequents (the quantifier-free axioms), the
logical rules, cut, and induction -/
inductive PD : List Fm → Prop where
| ax {Γ} : (∀ ρ : Nat → Nat, ∃ A, A ∈ Γ ∧ TrueAt A ρ) → PD Γ
| and {Γ A B} : .and A B ∈ Γ → PD (A :: Γ) → PD (B :: Γ) → PD Γ
| orL {Γ A B} : .or A B ∈ Γ → PD (A :: Γ) → PD Γ
| orR {Γ A B} : .or A B ∈ Γ → PD (B :: Γ) → PD Γ
| all {Γ A} : .all A ∈ Γ → PD (A :: sh Γ) → PD Γ
| ex {Γ A} (t : Tm) : .ex A ∈ Γ → PD (subF (c0 t) A :: Γ) → PD Γ
| cut {Γ} (C : Fm) : PD (C :: Γ) → PD (dual C :: Γ) → PD Γ
| ind {Γ A} : .all A ∈ Γ → PD (subF (c0 .zero) A :: Γ) → PD (subF sσ A :: dual A :: sh Γ) → PD Γ
theorem covers_sh (n : Nat) (ρ : Nat → Nat) : (Γ : List Fm) → Covers (mapI (cons n ρ) (sh Γ)) (mapI ρ Γ)
| [] => fun _ m => nomatch m
| A :: Γ => covers_cons (covers_sh n ρ Γ) _ (A, ρ) (eqv_sub shσ A (cons n ρ) ρ (fun _ => rfl))
theorem covers_id (Γ : List Item) : Covers Γ Γ := fun x m => ⟨x, m, eqv_refl x.1 x.2⟩
theorem covers_tail {Γ Γ' : List Item} (y : Item) (h : Covers Γ Γ') : Covers Γ (y :: Γ') := fun x m =>
match h x m with
| ⟨x', hx', he⟩ => ⟨x', .tail _ hx', he⟩
theorem eqv_inst (t : Tm) (A : Fm) (ρ : Nat → Nat) : Eqv (subF (c0 t) A) ρ A (cons (ev ρ t) ρ) :=
eqv_sub (c0 t) A ρ (cons (ev ρ t) ρ) (fun v => match v with | 0 => rfl | _ + 1 => rfl)
theorem eqv_succ (A : Fm) (n : Nat) (ρ : Nat → Nat) : Eqv (subF sσ A) (cons n ρ) A (cons (n + 1) ρ) :=
eqv_sub sσ A (cons n ρ) (cons (n + 1) ρ) (fun v => match v with | 0 => rfl | _ + 1 => rfl)
theorem max_le_l (a b : Nat) : a ≤ a + b := Nat.le_add_right a b
theorem max_le_r (a b : Nat) : b ≤ a + b := Nat.le_add_left b a
/-- the embedding: every PA-derivable sequent has, at every environment, a
Z∞-derivation of height ω·d and cut rank r (uniformly) -/
theorem embed {Γ : List Fm} (p : PD Γ) : ∃ d r, ∀ ρ, Der (om d 0) r (mapI ρ Γ) := by
induction p with
| ax h => exact ⟨0, 0, fun ρ => match h ρ with | ⟨A, m, t⟩ => .ax A ρ (mem_mapI ρ _ m) t⟩
| @and Γ A B m _ _ ih1 ih2 =>
match ih1, ih2 with
| ⟨d1, r1, D1⟩, ⟨d2, r2, D2⟩ =>
exact ⟨Nat.add d1 d2 + 1, Nat.add r1 r2, fun ρ =>
.and A B ρ _ _ (mem_mapI ρ _ m) (rank_mono (D1 ρ) (max_le_l _ _)) (rank_mono (D2 ρ) (max_le_r _ _))
(om_lt_d 0 (Nat.lt_succ_of_le (max_le_l _ _))) (om_lt_d 0 (Nat.lt_succ_of_le (max_le_r _ _)))⟩
| @orL Γ A B m _ ih =>
match ih with
| ⟨d1, r1, D1⟩ => exact ⟨d1 + 1, r1, fun ρ => .orL A B ρ _ (mem_mapI ρ _ m) (D1 ρ) (om_lt_succ d1 0)⟩
| @orR Γ A B m _ ih =>
match ih with
| ⟨d1, r1, D1⟩ => exact ⟨d1 + 1, r1, fun ρ => .orR A B ρ _ (mem_mapI ρ _ m) (D1 ρ) (om_lt_succ d1 0)⟩
| @all Γ A m _ ih =>
match ih with
| ⟨d1, r1, D1⟩ =>
exact ⟨d1 + 1, r1, fun ρ => .all A ρ (fun _ => om d1 0) (mem_mapI ρ _ m)
(fun n => transport (D1 (cons n ρ)) _ (covers_cons (covers_sh n ρ Γ) _ _ (eqv_refl A (cons n ρ))))
(fun _ => om_lt_succ d1 0)⟩
| @ex Γ A t m _ ih =>
match ih with
| ⟨d1, r1, D1⟩ =>
exact ⟨d1 + 1, r1, fun ρ => .ex A ρ (ev ρ t) _ (mem_mapI ρ _ m)
(transport (D1 ρ) _ (covers_cons (covers_id _) _ _ (eqv_inst t A ρ))) (om_lt_succ d1 0)⟩
| @cut Γ C _ _ ih1 ih2 =>
match ih1, ih2 with
| ⟨d1, r1, D1⟩, ⟨d2, r2, D2⟩ =>
exact ⟨Nat.add d1 d2 + 1, Nat.add (Nat.add r1 r2) (rk C + 1), fun ρ =>
.cut C ρ _ _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (max_le_r _ _))
(rank_mono (D1 ρ) (Nat.le_trans (max_le_l _ _) (max_le_l _ _)))
(rank_mono (D2 ρ) (Nat.le_trans (max_le_r _ _) (max_le_l _ _)))
(om_lt_d 0 (Nat.lt_succ_of_le (max_le_l _ _))) (om_lt_d 0 (Nat.lt_succ_of_le (max_le_r _ _)))⟩
| @ind Γ A m _ _ ih0 ihs =>
match ih0, ihs with
| ⟨d0, r0, D0⟩, ⟨ds, rs, DS⟩ =>
refine ⟨Nat.add d0 ds + 1, Nat.add (Nat.add r0 rs) (rk A + 1), fun ρ => ?_⟩
have hR0 : r0 ≤ Nat.add (Nat.add r0 rs) (rk A + 1) := Nat.le_trans (max_le_l _ _) (max_le_l _ _)
have hRs : rs ≤ Nat.add (Nat.add r0 rs) (rk A + 1) := Nat.le_trans (max_le_r _ _) (max_le_l _ _)
have hRA : rk A < Nat.add (Nat.add r0 rs) (rk A + 1) := Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (max_le_r _ _)
-- the chain of cuts: A(n) at height ω·D + n
have chain : ∀ n, Der (om (Nat.add d0 ds) n) (Nat.add (Nat.add r0 rs) (rk A + 1)) ((A, cons n ρ) :: mapI ρ Γ) := by
intro n
induction n with
| zero =>
exact raise_om (max_le_l _ _)
(rank_mono (transport (D0 ρ) _ (covers_cons (covers_id _) _ _ (eqv_inst .zero A ρ))) hR0)
| succ n ihn =>
have left : Der (om (Nat.add d0 ds) n) _ ((A, cons n ρ) :: (A, cons (n + 1) ρ) :: mapI ρ Γ) :=
weaken ihn (fun x mx => (mem_cons' mx).elim (fun e => e ▸ .head _) (fun mx' => .tail _ (.tail _ mx')))
have right : Der (om ds 0) rs ((dual A, cons n ρ) :: (A, cons (n + 1) ρ) :: mapI ρ Γ) :=
transport (DS (cons n ρ)) _ (fun x mx => (mem_cons' mx).elim
(fun e => ⟨(A, cons (n + 1) ρ), .tail _ (.head _), by rw [e]; exact eqv_succ A n ρ⟩)
(fun mx' => (mem_cons' mx').elim
(fun e => ⟨(dual A, cons n ρ), .head _, by rw [e]; exact eqv_refl _ _⟩)
(fun mx'' => match covers_sh n ρ Γ x mx'' with
| ⟨x', hx', he⟩ => ⟨x', .tail _ (.tail _ hx'), he⟩)))
have hlt : Lt (om ds 0) (om (Nat.add d0 ds) (n + 1)) :=
(Nat.lt_or_ge ds (Nat.add d0 ds)).elim
(fun hl => lt_trans _ _ _ (om_lt_d 0 hl) (om_lt_n (Nat.succ_pos n) _))
(fun hg => by
have e : ds = Nat.add d0 ds := Nat.le_antisymm (max_le_r _ _) hg
rw [← e]; exact om_lt_n (Nat.succ_pos n) ds)
exact .cut A (cons n ρ) _ _ hRA left (rank_mono right hRs) (om_lt_n (Nat.lt_succ_self n) _) hlt
exact .all A ρ (fun n => om (Nat.add d0 ds) n) (mem_mapI ρ _ m) chain (fun n => om_lt_succ _ n)
/-- Gentzen: Peano arithmetic is consistent -/
theorem pa_consistent : ¬ PD [.eq .zero (.succ .zero)] := fun p =>
match embed p with
| ⟨d, r, D⟩ => consistent (om d 0) r (fun _ => 0) (D (fun _ => 0))
/-- the ordinal bound: every PA-derivable sequent has cut-free Z∞-derivations
whose heights are the notations tw r (ω·d), below ε₀ -/
theorem pa_cutfree {Γ : List Fm} (p : PD Γ) : ∃ d r, ∀ ρ, Der (tw r (om d 0)) 0 (mapI ρ Γ) :=
match embed p with
| ⟨d, r, D⟩ => ⟨d, r, fun ρ => cut_elim r (D ρ)⟩
theorem nf_om : (d n : Nat) → NF (om d n)
| 0, 0 => trivial
| 0, _ + 1 => ⟨trivial, trivial, trivial⟩
| _ + 1, 0 => ⟨⟨trivial, trivial, trivial⟩, trivial, trivial⟩
| _ + 1, _ + 1 => ⟨⟨trivial, trivial, trivial⟩, ⟨trivial, trivial, trivial⟩, (rfl : cmp ON.zero one = .lt)⟩
theorem nf_tw : (r : Nat) → (α : ON) → NF α → NF (tw r α)
| 0, _, h => h
| r + 1, α, h => nf_tw r (w α) ⟨h, trivial, trivial⟩
end PAE
end Found
#print axioms Found.PAE.transport
#print axioms Found.PAE.embed
#print axioms Found.PAE.pa_consistent
#print axioms Found.PAE.pa_cutfree
#print axioms Found.PAE.nf_tw
lean_all/found/PAHA.lean
/-
T83. found/PAHA — arithmetic theories as conditions on an arithmetic
structure (M, 0, S, +, ·), a free parameter.
* Robinson Q: the seven axioms; PA/HA = Q + induction for all predicates
(HA when read with intuitionistic logic, PA with the classical
condition, T66; the double-negation line PA → HA is T77).
* PRA = primitive recursive functions (T81) with quantifier-free
induction (cited as the finitist point, T200).
* The standard ℕ (the core's NNO, T86) satisfies Q and full induction;
a one-point structure fails Q (0 ≠ S x).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace PA
universe u
structure ArStr where
M : Type u
z : M
s : M → M
add : M → M → M
mul : M → M → M
def Q (A : ArStr.{u}) : Prop :=
(∀ x, A.s x ≠ A.z) ∧ (∀ x y, A.s x = A.s y → x = y) ∧ (∀ x, x = A.z ∨ ∃ y, x = A.s y) ∧
(∀ x, A.add x A.z = x) ∧ (∀ x y, A.add x (A.s y) = A.s (A.add x y)) ∧
(∀ x, A.mul x A.z = A.z) ∧ (∀ x y, A.mul x (A.s y) = A.add (A.mul x y) x)
def Ind (A : ArStr.{u}) : Prop := ∀ P : A.M → Prop, P A.z → (∀ x, P x → P (A.s x)) → ∀ x, P x
def PAStr (A : ArStr.{u}) : Prop := Q A ∧ Ind A
def natStr : ArStr.{0} := ⟨Nat, 0, Nat.succ, Nat.add, Nat.mul⟩
theorem nat_Q : Q natStr :=
⟨fun _ e => Nat.noConfusion e, fun _ _ e => Nat.succ.inj e,
fun (x : Nat) => match x with | 0 => Or.inl rfl | y + 1 => Or.inr ⟨y, rfl⟩,
fun _ => rfl, fun _ _ => rfl, fun _ => rfl, fun _ _ => rfl⟩
theorem nat_Ind : Ind natStr := fun P h0 hs x => by
induction x with
| zero => exact h0
| succ n ih => exact hs n ih
theorem nat_PA : PAStr natStr := ⟨nat_Q, nat_Ind⟩
def oneStr : ArStr.{0} := ⟨Unit, (), fun _ => (), fun _ _ => (), fun _ _ => ()⟩
theorem one_not_Q : ¬ Q oneStr := fun h => h.1 () rfl
/-- in any PA structure, every element is reached from 0 (induction) -/
theorem reach (A : ArStr.{u}) (h : PAStr A) : ∀ x : A.M, x = A.z ∨ ∃ y, x = A.s y :=
h.2 _ (Or.inl rfl) (fun x _ => Or.inr ⟨x, rfl⟩)
end PA
end Found
#print axioms Found.PA.nat_Q
#print axioms Found.PA.nat_Ind
#print axioms Found.PA.nat_PA
#print axioms Found.PA.one_not_Q
#print axioms Found.PA.reach
lean_all/found/PTS.lean
/-
T181. found/PTS — pure type systems as a point: the specification
(sorts S, axioms A ⊆ S×S, rules R ⊆ S×S×S) is the parameter; the λ-cube
is the family of specifications over sorts {*, □} with axiom * : □ and
rules (*,*) plus any subset of {(□,*), (*,□), (□,□)}:
λ→, λ2 (System F), λP (LF), λω, λP2, λPω, λω (Fω), λC (CoC).
* PTS typing over an arbitrary specification (de Bruijn terms; substitution
and conversion are parameters too, so nothing depends on a particular
calculus).
* Cube edges = specification inclusion, and derivability is monotone along
inclusion: every judgment of λ→ holds in λ2, …, all in λC.
Strong normalization of λC (and Gödel's T, T182/HAomega) are cited / T79.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace PTS
inductive Tm (S : Type) where
| sort : S → Tm S
| var : Nat → Tm S
| pi : Tm S → Tm S → Tm S
| lam : Tm S → Tm S → Tm S
| app : Tm S → Tm S → Tm S
structure Spec (S : Type) where
ax : S → S → Prop
rule : S → S → S → Prop
/-- the operations a calculus supplies: lifting/substitution and conversion -/
structure Ops (S : Type) where
lookup : List (Tm S) → Nat → Option (Tm S)
inst : Tm S → Tm S → Tm S -- B[a/0]
conv : Tm S → Tm S → Prop
inductive Der {S : Type} (P : Spec S) (O : Ops S) : List (Tm S) → Tm S → Tm S → Prop where
| ax {Γ s t} : P.ax s t → Der P O Γ (.sort s) (.sort t)
| var {Γ n A} : O.lookup Γ n = some A → Der P O Γ (.var n) A
| pi {Γ A B s₁ s₂ s₃} : P.rule s₁ s₂ s₃ → Der P O Γ A (.sort s₁) → Der P O (A :: Γ) B (.sort s₂) →
Der P O Γ (.pi A B) (.sort s₃)
| lam {Γ A b B s} : Der P O (A :: Γ) b B → Der P O Γ (.pi A B) (.sort s) →
Der P O Γ (.lam A b) (.pi A B)
| app {Γ f a A B} : Der P O Γ f (.pi A B) → Der P O Γ a A → Der P O Γ (.app f a) (O.inst B a)
| conv {Γ a A B s} : Der P O Γ a A → O.conv A B → Der P O Γ B (.sort s) → Der P O Γ a B
def Sub {S : Type} (P Q : Spec S) : Prop :=
(∀ s t, P.ax s t → Q.ax s t) ∧ (∀ a b c, P.rule a b c → Q.rule a b c)
/-- derivability is monotone along specification inclusion -/
theorem mono {S : Type} {P Q : Spec S} (O : Ops S) (h : Sub P Q) {Γ a A} (d : Der P O Γ a A) :
Der Q O Γ a A := by
induction d with
| ax hx => exact .ax (h.1 _ _ hx)
| var e => exact .var e
| pi r _ _ ih1 ih2 => exact .pi (h.2 _ _ _ r) ih1 ih2
| lam _ _ ih1 ih2 => exact .lam ih1 ih2
| app _ _ ih1 ih2 => exact .app ih1 ih2
| conv _ c _ ih1 ih2 => exact .conv ih1 c ih2
/-! ## the λ-cube -/
inductive Srt where
| star : Srt
| box : Srt
/-- a cube vertex: which of (□,*), (*,□), (□,□) are allowed -/
structure Vertex where
poly : Bool -- (□,*) terms depending on types (λ2)
dep : Bool -- (*,□) types depending on terms (λP)
ops : Bool -- (□,□) types depending on types (λω)
def allowed (v : Vertex) : Srt → Srt → Bool
| .star, .star => true
| .box, .star => v.poly
| .star, .box => v.dep
| .box, .box => v.ops
def cube (v : Vertex) : Spec Srt where
ax s t := s = .star ∧ t = .box
rule a b c := allowed v a b = true ∧ c = b
def le (v w : Vertex) : Prop :=
(v.poly = true → w.poly = true) ∧ (v.dep = true → w.dep = true) ∧ (v.ops = true → w.ops = true)
theorem cube_sub (v w : Vertex) (h : le v w) : Sub (cube v) (cube w) :=
⟨fun _ _ x => x, fun a b c ⟨hr, e⟩ => ⟨by
cases a <;> cases b
· exact hr
· exact h.2.1 hr
· exact h.1 hr
· exact h.2.2 hr, e⟩⟩
def lamArrow : Vertex := ⟨false, false, false⟩
def lamC : Vertex := ⟨true, true, true⟩
theorem bottom_le (v : Vertex) : le lamArrow v :=
⟨fun h => Bool.noConfusion h, fun h => Bool.noConfusion h, fun h => Bool.noConfusion h⟩
theorem le_top (v : Vertex) : le v lamC := ⟨fun _ => rfl, fun _ => rfl, fun _ => rfl⟩
/-- every judgment of any cube system holds in the calculus of constructions -/
theorem into_CoC (O : Ops Srt) (v : Vertex) {Γ a A} (d : Der (cube v) O Γ a A) : Der (cube lamC) O Γ a A :=
mono O (cube_sub v lamC (le_top v)) d
/-- and λ→ embeds into every vertex -/
theorem from_arrow (O : Ops Srt) (v : Vertex) {Γ a A} (d : Der (cube lamArrow) O Γ a A) : Der (cube v) O Γ a A :=
mono O (cube_sub lamArrow v (bottom_le v)) d
end PTS
end Found
#print axioms Found.PTS.mono
#print axioms Found.PTS.cube_sub
#print axioms Found.PTS.into_CoC
#print axioms Found.PTS.from_arrow
lean_all/found/Paracons.lean
/-
T70. found/Paracons — paraconsistent logic as a condition.
* Co-Heyting algebras: subtraction a ∖ b with a ∖ b ≤ c ⟺ a ≤ b ∨ c,
negation ∼a := ⊤ ∖ a.
* Condition in the frame: the order dual of any Heyting algebra (in
particular of Ω) is co-Heyting (dual-intuitionistic = paraconsistent
reading of the closed-set side of a topos).
* In every co-Heyting algebra excluded middle holds (⊤ ≤ a ∨ ∼a), while
explosion a ∧ ∼a ≤ b fails in the three-element chain; in every
Heyting algebra explosion holds. So intuitionistic ↔ paraconsistent is
exactly order duality.
* Priest's LP: three values, designated {½, 1}: p, ¬p ⊭ q, ⊨ p ∨ ¬p, and on
two-valued valuations explosion holds (LP = classical + glut value).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Topos
universe u
namespace Found
namespace Para
structure CoHA where
car : Type u
le : car → car → Prop
le_refl : ∀ a, le a a
le_trans : ∀ {a b c}, le a b → le b c → le a c
top : car
bot : car
meet : car → car → car
join : car → car → car
sub : car → car → car
le_top : ∀ a, le a top
bot_le : ∀ a, le bot a
meet_l : ∀ a b, le (meet a b) a
meet_r : ∀ a b, le (meet a b) b
meet_univ : ∀ {a b c}, le c a → le c b → le c (meet a b)
join_l : ∀ a b, le a (join a b)
join_r : ∀ a b, le b (join a b)
join_univ : ∀ {a b c}, le a c → le b c → le (join a b) c
sub_adj : ∀ {a b c}, le (sub a b) c ↔ le a (join b c)
namespace CoHA
variable (K : CoHA)
def neg (a : K.car) : K.car := K.sub K.top a
/-- excluded middle holds in every co-Heyting algebra -/
theorem lem (a : K.car) : K.le K.top (K.join a (K.neg a)) := K.sub_adj.mp (K.le_refl _)
/-- dual non-contradiction fails in general; what holds is ∼∼a ≤ a -/
theorem negneg_le (a : K.car) : K.le (K.neg (K.neg a)) a :=
K.sub_adj.mpr (K.le_trans (K.lem a) (K.join_univ (K.join_r _ _) (K.join_l _ _)))
end CoHA
/-- the order dual of a Heyting algebra is co-Heyting -/
def opHA (H : HA.{u}) : CoHA.{u} where
car := H.car
le a b := H.le b a
le_refl := H.le_refl
le_trans h k := H.le_trans k h
top := H.bot
bot := H.top
meet := H.join
join := H.meet
sub a b := H.imp b a
le_top := H.bot_le
bot_le := H.le_top
meet_l := H.join_l
meet_r := H.join_r
meet_univ h k := H.join_univ h k
join_l := H.meet_l
join_r := H.meet_r
join_univ h k := H.meet_univ h k
sub_adj := ⟨fun h => H.le_trans (H.meet_univ (H.meet_r _ _) (H.meet_l _ _)) (H.imp_adj.mpr h),
fun h => H.imp_adj.mp (H.le_trans (H.meet_univ (H.meet_r _ _) (H.meet_l _ _)) h)⟩
/-- the dual of Ω = (Prop, ↔) is co-Heyting: the paraconsistent side of the frame -/
def omegaOp : CoHA := opHA OmegaHA
/-! ## The three-element chain as a co-Heyting algebra -/
inductive T3 where
| z : T3
| h : T3
| o : T3
namespace T3
def rk : T3 → Nat
| z => 0
| h => 1
| o => 2
def le (a b : T3) : Prop := Nat.ble (rk a) (rk b) = true
def meet : T3 → T3 → T3
| z, z => z
| z, h => z
| z, o => z
| h, z => z
| h, h => h
| h, o => h
| o, z => z
| o, h => h
| o, o => o
def join : T3 → T3 → T3
| z, z => z
| z, h => h
| z, o => o
| h, z => h
| h, h => h
| h, o => o
| o, z => o
| o, h => o
| o, o => o
def sub : T3 → T3 → T3
| z, z => z
| z, h => z
| z, o => z
| h, z => h
| h, h => z
| h, o => z
| o, z => o
| o, h => o
| o, o => z
def C3 : CoHA where
car := T3
le := le
le_refl a := by cases a <;> rfl
le_trans {a b c} := by cases a <;> cases b <;> cases c <;> intro x y <;> first | rfl | exact x | exact y
top := o
bot := z
meet := meet
join := join
sub := sub
le_top a := by cases a <;> rfl
bot_le a := by cases a <;> rfl
meet_l a b := by cases a <;> cases b <;> rfl
meet_r a b := by cases a <;> cases b <;> rfl
meet_univ {a b c} := by cases a <;> cases b <;> cases c <;> intro x y <;> first | rfl | exact x | exact y
join_l a b := by cases a <;> cases b <;> rfl
join_r a b := by cases a <;> cases b <;> rfl
join_univ {a b c} := by cases a <;> cases b <;> cases c <;> intro x y <;> first | rfl | exact x | exact y
sub_adj {a b c} := by cases a <;> cases b <;> cases c <;> exact ⟨fun x => x, fun x => x⟩
end T3
/-- explosion fails in a co-Heyting algebra -/
theorem no_explosion : ¬ ∀ a b : T3.C3.car, T3.C3.le (T3.C3.meet a (T3.C3.neg a)) b :=
fun h => Bool.noConfusion (h T3.h T3.z)
/-- explosion holds in every Heyting algebra -/
theorem explosion_HA (H : HA.{u}) (a b : H.car) : H.le (H.meet a (H.neg a)) b :=
H.le_trans (H.meet_neg a) (H.bot_le b)
/-! ## Priest's LP -/
inductive LF where
| var : Nat → LF
| neg : LF → LF
| and : LF → LF → LF
| or : LF → LF → LF
def lneg : T3 → T3
| .z => .o
| .h => .h
| .o => .z
def lval (v : Nat → T3) : LF → T3
| .var n => v n
| .neg a => lneg (lval v a)
| .and a b => T3.meet (lval v a) (lval v b)
| .or a b => T3.join (lval v a) (lval v b)
def Des (x : T3) : Prop := x ≠ .z
/-- LP entailment: every valuation designating all premises designates the conclusion -/
def Ent (Γ : List LF) (φ : LF) (two : Bool) : Prop :=
∀ v : Nat → T3, (two = true → ∀ n, v n ≠ .h) → (∀ ψ, ψ ∈ Γ → Des (lval v ψ)) → Des (lval v φ)
theorem des_or_neg (x : T3) : Des (T3.join x (lneg x)) := by
cases x <;> exact fun e => T3.noConfusion e
/-- LP validates excluded middle -/
theorem lp_lem (p : LF) : Ent [] (.or p (.neg p)) false := fun v _ _ => des_or_neg (lval v p)
/-- LP is not explosive: p, ¬p ⊭ q -/
theorem lp_no_explosion : ¬ Ent [.var 0, .neg (.var 0)] (.var 1) false :=
fun h => h (fun n => match n with | 0 => .h | _ => .z) (fun e => Bool.noConfusion e)
(fun ψ m => by
cases m with
| head => exact fun e => T3.noConfusion e
| tail _ m' => cases m' with
| head => exact fun e => T3.noConfusion e
| tail _ m'' => cases m'') rfl
/-- on two-valued valuations, explosion holds: LP = classical + a glut value -/
theorem two_valued_explosion (q : LF) : Ent [.var 0, .neg (.var 0)] q true := by
intro v two hyp
have h0 := hyp (.var 0) (List.Mem.head _)
have h1 := hyp (.neg (.var 0)) (List.Mem.tail _ (List.Mem.head _))
have hv := two rfl 0
revert h0 h1 hv
show Des (v 0) → Des (lneg (v 0)) → v 0 ≠ .h → _
cases v 0 with
| z => exact fun a _ _ => (a rfl).elim
| h => exact fun _ _ c => (c rfl).elim
| o => exact fun _ b _ => (b rfl).elim
end Para
end Found
#print axioms Found.Para.CoHA.lem
#print axioms Found.Para.CoHA.negneg_le
#print axioms Found.Para.opHA
#print axioms Found.Para.omegaOp
#print axioms Found.Para.T3.C3
#print axioms Found.Para.no_explosion
#print axioms Found.Para.explosion_HA
#print axioms Found.Para.des_or_neg
#print axioms Found.Para.lp_lem
#print axioms Found.Para.lp_no_explosion
#print axioms Found.Para.two_valued_explosion
lean_all/found/Plural.lean
/-
T215. found/Plural — plural logic (Boolos) as a point of the chart: plural
variables range over inhabited sub-predicates of the domain (the power
operation Ω^D restricted to inhabited values), with "a is one of xx".
* plural comprehension: if something is φ, there are some things that are
exactly the φs;
* Boolos' translation: monadic second-order quantification over an
extensional condition reduces to the empty case or a plural quantifier
(at the classical point, excluded middle as a hypothesis variable) —
the line to second-order logic (T142);
* pluralities are exactly the parts of the mereology of inhabited
predicates, and "one of" is parthood of the singleton — the line to
mereology (T201).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Mereology
namespace Found
namespace Plural
universe u
variable {D : Type u}
/-- some things: an inhabited predicate -/
structure Pl (D : Type u) where
among : D → Prop
ne : ∃ a, among a
/-- a is one of xx -/
def OneOf (a : D) (xx : Pl D) : Prop := xx.among a
/-- plural comprehension -/
theorem compr (φ : D → Prop) (h : ∃ a, φ a) : ∃ xx : Pl D, ∀ a, OneOf a xx ↔ φ a :=
⟨⟨φ, h⟩, fun _ => ⟨id, id⟩⟩
/-- an extensional condition on monadic second-order values -/
def Ext (Φ : (D → Prop) → Prop) : Prop :=
∀ X Y : D → Prop, (∀ a, X a ↔ Y a) → Φ X → Φ Y
/-- Boolos: monadic second-order ∃ = empty case ∨ plural ∃ -/
theorem boolos_ex (lem : ∀ p : Prop, p ∨ ¬ p) (Φ : (D → Prop) → Prop) (hΦ : Ext Φ) :
(∃ X, Φ X) ↔ (Φ (fun _ => False) ∨ ∃ xx : Pl D, Φ xx.among) :=
⟨fun ⟨X, hX⟩ => (lem (∃ a, X a)).elim
(fun hi => .inr ⟨⟨X, hi⟩, hX⟩)
(fun hn => .inl (hΦ X _ (fun a => ⟨fun x => hn ⟨a, x⟩, False.elim⟩) hX)),
fun h => h.elim (fun e => ⟨_, e⟩) (fun ⟨_, e⟩ => ⟨_, e⟩)⟩
/-- Boolos: monadic second-order ∀ = empty case ∧ plural ∀ -/
theorem boolos_all (lem : ∀ p : Prop, p ∨ ¬ p) (Φ : (D → Prop) → Prop) (hΦ : Ext Φ) :
(∀ X, Φ X) ↔ (Φ (fun _ => False) ∧ ∀ xx : Pl D, Φ xx.among) :=
⟨fun h => ⟨h _, fun xx => h xx.among⟩,
fun ⟨e, p⟩ X => (lem (∃ a, X a)).elim
(fun hi => p ⟨X, hi⟩)
(fun hn => hΦ _ X (fun a => ⟨False.elim, fun x => hn ⟨a, x⟩⟩) e)⟩
/-! ## the line to mereology (T201) -/
/-- a plurality is a part of the mereology of inhabited predicates -/
def toPart (xx : Pl D) : (Mereo.setsM D).E := ⟨xx.among, xx.ne⟩
def ofPart (x : (Mereo.setsM D).E) : Pl D := ⟨x.val, x.property⟩
theorem of_to (xx : Pl D) : ofPart (toPart xx) = xx := rfl
theorem to_of (x : (Mereo.setsM D).E) : toPart (ofPart x) = x := rfl
/-- the single thing a -/
def single (a : D) : Pl D := ⟨fun b => a = b, ⟨a, rfl⟩⟩
/-- "a is one of xx" is parthood of the singleton -/
theorem oneOf_iff_part (a : D) (xx : Pl D) :
OneOf a xx ↔ (Mereo.setsM D).P (toPart (single a)) (toPart xx) :=
⟨fun h _ e => e ▸ h, fun h => h a rfl⟩
/-- inclusion of pluralities is parthood -/
theorem sub_iff_part (xx yy : Pl D) :
(∀ a, OneOf a xx → OneOf a yy) ↔ (Mereo.setsM D).P (toPart xx) (toPart yy) :=
⟨id, id⟩
end Plural
end Found
#print axioms Found.Plural.compr
#print axioms Found.Plural.boolos_ex
#print axioms Found.Plural.boolos_all
#print axioms Found.Plural.of_to
#print axioms Found.Plural.to_of
#print axioms Found.Plural.oneOf_iff_part
#print axioms Found.Plural.sub_iff_part
lean_all/found/Pnp1.lean
/-
T330 piece 1. found/Pnp1 -- Boolean formulas: the size side of the P vs NP map.
Tool results only (not used for the main conclusion; barrier status in PNP_MAP.md):
* formulas over variables, constants, not, and, or; evaluation; gate count;
* Shannon expansion: every function of n bits has a formula with exactly
tw n = 3 (2^n - 1) binary gates (upper bound, constructive);
* insensitivity: a formula that does not mention variable i does not depend on it
(the base step of gate elimination);
* hence a formula for a function that depends on variable i mentions i.
Written with ASCII forms only. CIC dependence: none.
-/
namespace Found.Pnp1
inductive Fm where
| var : Nat -> Fm
| cst : Bool -> Fm
| neg : Fm -> Fm
| and : Fm -> Fm -> Fm
| or : Fm -> Fm -> Fm
def ev (a : Nat -> Bool) : Fm -> Bool
| .var i => a i
| .cst b => b
| .neg f => !(ev a f)
| .and f g => ev a f && ev a g
| .or f g => ev a f || ev a g
/-- Number of binary gates. -/
def gates : Fm -> Nat
| .var _ => 0
| .cst _ => 0
| .neg f => gates f
| .and f g => gates f + gates g + 1
| .or f g => gates f + gates g + 1
/-- Whether the formula mentions variable i. -/
def mentions (i : Nat) : Fm -> Bool
| .var j => Nat.beq i j
| .cst _ => false
| .neg f => mentions i f
| .and f g => mentions i f || mentions i g
| .or f g => mentions i f || mentions i g
/-! ## Shannon expansion -/
/-- The values of the variables k, k+1, ..., k+n-1. -/
def read (a : Nat -> Bool) : Nat -> Nat -> List Bool
| _, 0 => []
| k, n + 1 => a k :: read a (k + 1) n
/-- The Shannon formula of f (a function of the next n bits), starting at variable k. -/
def build : Nat -> (List Bool -> Bool) -> Nat -> Fm
| 0, f, _ => .cst (f [])
| n + 1, f, k =>
.or (.and (.var k) (build n (fun xs => f (true :: xs)) (k + 1)))
(.and (.neg (.var k)) (build n (fun xs => f (false :: xs)) (k + 1)))
theorem or_false' (x : Bool) : (x || false) = x := by cases x <;> rfl
/-- The Shannon formula computes f. -/
theorem ev_build (a : Nat -> Bool) : forall (n : Nat) (f : List Bool -> Bool) (k : Nat),
ev a (build n f k) = f (read a k n) := by
intro n
induction n with
| zero => intro f k; rfl
| succ n ih =>
intro f k
show ((a k && ev a (build n (fun xs => f (true :: xs)) (k + 1))) ||
(!(a k) && ev a (build n (fun xs => f (false :: xs)) (k + 1))))
= f (a k :: read a (k + 1) n)
rw [ih, ih]
cases a k with
| true => exact or_false' _
| false => rfl
/-- tw n = 3 (2^n - 1). -/
def tw : Nat -> Nat
| 0 => 0
| n + 1 => tw n + tw n + 3
def pow2 : Nat -> Nat
| 0 => 1
| n + 1 => pow2 n + pow2 n
theorem gate_step (t : Nat) : (0 + t + 1) + (0 + t + 1) + 1 = t + t + 3 := by
rw [Nat.zero_add]
exact congrArg (fun x => Nat.succ (Nat.succ x)) (Nat.succ_add t t)
theorem gates_build : forall (n : Nat) (f : List Bool -> Bool) (k : Nat),
gates (build n f k) = tw n := by
intro n
induction n with
| zero => intro f k; rfl
| succ n ih =>
intro f k
show (0 + gates (build n (fun xs => f (true :: xs)) (k + 1)) + 1) +
(0 + gates (build n (fun xs => f (false :: xs)) (k + 1)) + 1) + 1 = tw n + tw n + 3
rw [ih, ih]
exact gate_step (tw n)
theorem add3 (x : Nat) : (x + x + 3) + 3 = (x + 3) + (x + 3) := by
rw [Nat.add_assoc x x 3, Nat.add_assoc x (x + 3) 3, Nat.add_assoc x 3 (x + 3),
Nat.add_comm 3 (x + 3), Nat.add_assoc x 3 3]
/-- The gate count of the Shannon formula: tw n + 3 = 3 * 2^n. -/
theorem tw_closed : forall n : Nat, tw n + 3 = 3 * pow2 n := by
intro n
induction n with
| zero => rfl
| succ n ih =>
show (tw n + tw n + 3) + 3 = 3 * (pow2 n + pow2 n)
rw [add3, ih, Nat.left_distrib]
/-- Every function of n bits has a formula with tw n gates. -/
theorem shannon_upper (n : Nat) (f : List Bool -> Bool) :
Exists fun F : Fm => gates F = tw n /\ forall a, ev a F = f (read a 0 n) :=
Exists.intro (build n f 0) (And.intro (gates_build n f 0) (fun a => ev_build a n f 0))
/-! ## Insensitivity -/
theorem or_false_l {x y : Bool} (h : (x || y) = false) : x = false := by
cases x with
| false => rfl
| true => exact Bool.noConfusion h
theorem or_false_r {x y : Bool} (h : (x || y) = false) : y = false := by
cases x with
| false => exact h
| true => exact Bool.noConfusion h
/-- A formula that does not mention i gives the same value on assignments that differ
only at i. -/
theorem insensitive (i : Nat) (a b : Nat -> Bool)
(hab : forall j, Nat.beq i j = false -> a j = b j) :
forall F : Fm, mentions i F = false -> ev a F = ev b F := by
intro F
induction F with
| var j => intro h; exact hab j h
| cst c => intro _; rfl
| neg f ih => intro h; exact congrArg (fun x => !x) (ih h)
| and f g ihf ihg =>
intro h
show (ev a f && ev a g) = (ev b f && ev b g)
rw [ihf (or_false_l h), ihg (or_false_r h)]
| or f g ihf ihg =>
intro h
show (ev a f || ev a g) = (ev b f || ev b g)
rw [ihf (or_false_l h), ihg (or_false_r h)]
/-- g depends on variable i. -/
def Depends (i : Nat) (g : (Nat -> Bool) -> Bool) : Prop :=
Exists fun a : Nat -> Bool => Exists fun b : Nat -> Bool =>
(forall j, Nat.beq i j = false -> a j = b j) /\ (g a = g b -> False)
/-- A formula computing a function that depends on i mentions i. -/
theorem mentions_of_depends (i : Nat) (g : (Nat -> Bool) -> Bool) (F : Fm)
(hF : forall a, ev a F = g a) (hd : Depends i g) : mentions i F = true := by
cases hm : mentions i F with
| true => rfl
| false =>
exact Exists.elim hd fun a h1 => Exists.elim h1 fun b h2 =>
False.elim (h2.2 (((hF a).symm.trans (insensitive i a b h2.1 F hm)).trans (hF b)))
/-- Example: x0 xor x1 depends on variable 0. -/
def xor01 (a : Nat -> Bool) : Bool := xor (a 0) (a 1)
theorem xor01_depends : Depends 0 xor01 :=
Exists.intro (fun _ => false) (Exists.intro (fun j => Nat.beq 0 j)
(And.intro (fun _ h => h.symm) (fun h => Bool.noConfusion h)))
end Found.Pnp1
#print axioms Found.Pnp1.or_false'
#print axioms Found.Pnp1.ev_build
#print axioms Found.Pnp1.gate_step
#print axioms Found.Pnp1.gates_build
#print axioms Found.Pnp1.add3
#print axioms Found.Pnp1.tw_closed
#print axioms Found.Pnp1.shannon_upper
#print axioms Found.Pnp1.or_false_l
#print axioms Found.Pnp1.or_false_r
#print axioms Found.Pnp1.insensitive
#print axioms Found.Pnp1.mentions_of_depends
#print axioms Found.Pnp1.xor01_depends
lean_all/found/Pnp10.lean
/-
T330 piece 10. found/Pnp10 -- satisfying assignments of the tableau CNF are exactly the
runs of the width-W machine.
The width-W machine: cells 0..W-1 of k bits, cell W is the boundary (always false, the
left neighbour of cell 0 and the right neighbour of cell W-1), and each step applies the
local rule delta to the 3k neighbourhood bits. Proved:
* an assignment satisfying the step and boundary conditions of Pnp9 equals, at every
t <= T, j <= W, b < k, the run of the machine from its time-0 layer;
* conversely the run from any start with a false boundary satisfies them.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp9
import found.Pnp2
namespace Found.Pnp10
open Found.Pnp1 (read)
open Found.Pnp8
open Found.Pnp9
/-! ## The width-W machine -/
abbrev Conf := Nat -> Nat -> Bool
def nbC (c : Conf) (k W j : Nat) : List Bool :=
read (c (leftIdx W j)) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)
def gate : Bool -> Bool -> Bool
| true, _ => false
| false, x => x
def stepW (delta : List Bool -> Nat -> Bool) (k W : Nat) (c : Conf) : Conf :=
fun j b => gate (Nat.beq j W) (delta (nbC c k W j) b)
def runW (delta : List Bool -> Nat -> Bool) (k W : Nat) : Nat -> Conf -> Conf
| 0, c => c
| t + 1, c => stepW delta k W (runW delta k W t c)
/-- The layer of an assignment at time t. -/
def sl (s : V -> Bool) (t : Nat) : Conf := fun c b => s (t, (c, b))
/-! ## Lemmas -/
theorem beq_refl : forall n : Nat, Nat.beq n n = true := by
intro n
induction n with
| zero => rfl
| succ n ih => exact ih
theorem mapv_append {α : Type} (s : α -> Bool) (B : List α) : forall A : List α,
mapv s (A ++ B) = mapv s A ++ mapv s B := by
intro A
induction A with
| nil => rfl
| cons y A ih =>
show s y :: mapv s (A ++ B) = s y :: (mapv s A ++ mapv s B)
rw [ih]
theorem mapv_readV (s : V -> Bool) (t c : Nat) : forall n b0,
mapv s (readV t c b0 n) = read (fun b => s (t, (c, b))) b0 n := by
intro n
induction n with
| zero => intro b0; rfl
| succ n ih =>
intro b0
show s (t, (c, b0)) :: mapv s (readV t c (b0 + 1) n) = s (t, (c, b0)) :: read (fun b => s (t, (c, b))) (b0 + 1) n
rw [ih (b0 + 1)]
theorem mapv_nbV (s : V -> Bool) (k W t j : Nat) : mapv s (nbV k W t j) = nbC (sl s t) k W j := by
show mapv s (readV t (leftIdx W j) 0 k ++ (readV t j 0 k ++ readV t (j + 1) 0 k)) = _
rw [mapv_append, mapv_append, mapv_readV, mapv_readV, mapv_readV]
rfl
theorem read_ext_lt (f g : Nat -> Bool) : forall n b0,
(forall i, i < b0 + n -> f i = g i) -> read f b0 n = read g b0 n := by
intro n
induction n with
| zero => intro b0 _; rfl
| succ n ih =>
intro b0 h
show f b0 :: read f (b0 + 1) n = g b0 :: read g (b0 + 1) n
have h0 : f b0 = g b0 := h b0 (Nat.lt_succ_of_le (Nat.le_add_right b0 n))
have h1 : read f (b0 + 1) n = read g (b0 + 1) n := ih (b0 + 1) (fun i hi =>
h i ((congrArg (fun m => i < m) (Nat.add_right_comm b0 1 n)).mp hi))
rw [h0, h1]
theorem read_ext_k (f g : Nat -> Bool) (k : Nat) (h : forall i, i < k -> f i = g i) :
read f 0 k = read g 0 k :=
read_ext_lt f g k 0 (fun i hi => h i ((congrArg (fun m => i < m) (Nat.zero_add k)).mp hi))
theorem leftIdx_lt (W : Nat) : forall j, j < W -> leftIdx W j < W + 1
| 0, _ => Nat.lt_succ_self W
| _ + 1, hj => Nat.lt_succ_of_lt (Nat.lt_of_succ_lt hj)
theorem nbC_ext (x y : Conf) (k W j : Nat) (hj : j < W)
(h : forall c, c < W + 1 -> forall b, b < k -> x c b = y c b) : nbC x k W j = nbC y k W j := by
show read (x (leftIdx W j)) 0 k ++ (read (x j) 0 k ++ read (x (j + 1)) 0 k) =
read (y (leftIdx W j)) 0 k ++ (read (y j) 0 k ++ read (y (j + 1)) 0 k)
rw [read_ext_k _ _ k (h _ (leftIdx_lt W j hj)), read_ext_k _ _ k (h j (Nat.lt_succ_of_lt hj)),
read_ext_k _ _ k (h (j + 1) (Nat.succ_lt_succ hj))]
/-! ## Satisfying assignments are runs -/
theorem sat_is_run (s : V -> Bool) (delta : List Bool -> Nat -> Bool) (k W T : Nat)
(hs : Steps s delta k W T) (hb : Bound s k W T) :
forall t, t < T + 1 -> forall j, j < W + 1 -> forall b, b < k ->
s (t, (j, b)) = runW delta k W t (sl s 0) j b := by
intro t
induction t with
| zero => intro _ j _ b _; rfl
| succ t ih =>
intro ht j hj b hbk
have ht' : t < T := Nat.lt_of_succ_lt_succ ht
show s (t + 1, (j, b)) = gate (Nat.beq j W) (delta (nbC (runW delta k W t (sl s 0)) k W j) b)
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => by
rw [Found.Pnp2.beq_false_of_ne j W (Nat.ne_of_lt hjW), hs t ht' j hjW b hbk, mapv_nbV,
nbC_ext (sl s t) (runW delta k W t (sl s 0)) k W j hjW
(fun c hc b' hb' => ih (Nat.lt_succ_of_lt ht') c hc b' hb')]
rfl)
(fun e => by
rw [e, beq_refl W]
exact hb (t + 1) ht b hbk)
/-! ## Runs are satisfying assignments -/
/-- The assignment of a run. -/
def ofRun (delta : List Bool -> Nat -> Bool) (k W : Nat) (c0 : Conf) : V -> Bool :=
fun v => runW delta k W v.1 c0 v.2.1 v.2.2
theorem run_steps (delta : List Bool -> Nat -> Bool) (k W T : Nat) (c0 : Conf) :
Steps (ofRun delta k W c0) delta k W T := by
intro t _ j hj b _
show gate (Nat.beq j W) (delta (nbC (runW delta k W t c0) k W j) b) =
delta (mapv (ofRun delta k W c0) (nbV k W t j)) b
rw [Found.Pnp2.beq_false_of_ne j W (Nat.ne_of_lt hj), mapv_nbV]
rfl
theorem run_bound (delta : List Bool -> Nat -> Bool) (k W T : Nat) (c0 : Conf)
(h0 : forall b, b < k -> c0 W b = false) : Bound (ofRun delta k W c0) k W T := by
intro t _ b hb
cases t with
| zero => exact h0 b hb
| succ t =>
show gate (Nat.beq W W) (delta (nbC (runW delta k W t c0) k W W) b) = false
rw [beq_refl W]
rfl
end Found.Pnp10
#print axioms Found.Pnp10.beq_refl
#print axioms Found.Pnp10.mapv_append
#print axioms Found.Pnp10.mapv_readV
#print axioms Found.Pnp10.mapv_nbV
#print axioms Found.Pnp10.read_ext_lt
#print axioms Found.Pnp10.read_ext_k
#print axioms Found.Pnp10.leftIdx_lt
#print axioms Found.Pnp10.nbC_ext
#print axioms Found.Pnp10.sat_is_run
#print axioms Found.Pnp10.run_steps
#print axioms Found.Pnp10.run_bound
lean_all/found/Pnp100.lean
/-
T330 piece 100. found/Pnp100 -- the size bound for resolution refutations of the
pigeonhole principle, in parametric form (proof complexity ladder, step 1: general
resolution; Haken 1985, in the form of Beame--Pitassi 1996).
dd L removes repeated clauses (beqCl), so (dd (nodes p)).length is the number of distinct
clauses of a proof p. For a refutation p of PHP(n + 1, n), numbers with M = n (n + 1) =
N + L, n + 1 = t + r, 1 <= b < t, and L <= s u whenever s + u = t and s <= b < 2 s:
M ^ r <= (number of distinct clauses of p) * N ^ r.
Proved:
* dd_mem, dd_len: the list of distinct clauses;
* lcnt_pos: a member that passes the test counts;
* fin: every good restriction with t remaining pigeons has a wide alive clause (the
middle clause, Pnp93, with its width, Pnp95);
* haken: the parametric size bound.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp99
namespace Found.Pnp100
open Found.RootComp (Clause)
open Found.Pnp62 (memC beqCl RProof)
open Found.Pnp65 (cntI bv)
open Found.Pnp66 (PHP)
open Found.Pnp93 (nodes cntP mid_pigs memC_head memC_cons_r)
open Found.Pnp94 (freeH remP Good cntP_nil)
open Found.Pnp95 (covCnt nonP width split_rem)
open Found.Pnp97 (lcnt)
open Found.Pnp98 (K wa consIf)
open Found.Pnp99 (iter0)
/-- Distinct clauses. -/
def dd : List Clause -> List Clause
| [] => []
| C :: L => consIf (!(memC C (dd L))) C (dd L)
theorem dd_keep (C D : Clause) (L : List Clause) (h : memC D (dd L) = true) : memC D (dd (C :: L)) = true := by
show memC D (consIf (!(memC C (dd L))) C (dd L)) = true
cases memC C (dd L) with
| true => exact h
| false => exact memC_cons_r D C _ h
theorem dd_mem (D : Clause) : forall L : List Clause, memC D L = true -> memC D (dd L) = true
| [], h => h
| C :: L, h => by
have h' : (beqCl C D || memC D L) = true := h
cases e : beqCl C D with
| false =>
rw [e] at h'
exact dd_keep C D L (dd_mem D L h')
| true =>
have cd : C = D := Found.Pnp62.beqCl_eq C D e
rw [cd.symm]
show memC C (consIf (!(memC C (dd L))) C (dd L)) = true
cases ec : memC C (dd L) with
| true => exact ec
| false => exact memC_head C _
theorem dd_len : forall L : List Clause, (dd L).length <= L.length
| [] => Nat.le_refl 0
| C :: L => by
show (consIf (!(memC C (dd L))) C (dd L)).length <= L.length + 1
cases memC C (dd L) with
| true => exact Nat.le_trans (dd_len L) (Nat.le_succ _)
| false => exact Nat.succ_le_succ (dd_len L)
theorem lcnt_pos (p : Clause -> Bool) (D : Clause) (hp : p D = true) :
forall Ws : List Clause, memC D Ws = true -> 1 <= lcnt p Ws
| [], h => Bool.noConfusion h
| C :: Ws, h => by
show 1 <= bv (p C) + lcnt p Ws
have h' : (beqCl C D || memC D Ws) = true := h
cases e : beqCl C D with
| false =>
rw [e] at h'
exact Nat.le_trans (lcnt_pos p D hp Ws h') (Nat.le_add_left _ _)
| true =>
rw [Found.Pnp62.beqCl_eq C D e, hp]
exact Nat.le_add_right 1 _
/-- Every good restriction with t remaining pigeons has a wide alive clause. -/
theorem fin (n L t b : Nat) (p : RProof (PHP n) []) (Ws : List Clause)
(hWs : forall D, memC D (nodes p) = true -> memC D Ws = true) (hb : 1 <= b) (hbt : b < t)
(hw : forall s u, s + u = t -> s <= b -> b < s + s -> L <= s * u)
(rho : Nat -> Option Nat) (hg : Good n rho) (hR : cntI (remP rho) (n + 1) = t) : 1 <= K n rho L Ws := by
have c0 : cntP n rho [] = t := (cntP_nil n rho hg).trans hR
cases mid_pigs n rho b hb [] p (by rw [c0]; exact hbt) with
| intro D hD =>
have sp : cntP n rho D + cntI (nonP n rho D) (n + 1) = t := (split_rem n rho D).trans hR
have lw : L <= covCnt n rho D := Nat.le_trans (hw _ _ sp hD.2.1 hD.2.2) (width n rho D)
have s1 : 1 <= cntP n rho D := by
cases Nat.lt_or_ge 0 (cntP n rho D) with
| inl l => exact l
| inr r =>
have z := Found.Pnp66.le_zero_eq r
have t2 := hD.2.2
rw [z] at t2
exact absurd t2 (Nat.not_lt_zero b)
have w : wa n rho L D = true := by
show (Nat.ble 1 (cntP n rho D) && Nat.ble L (covCnt n rho D)) = true
rw [Nat.ble_eq_true_of_le s1, Nat.ble_eq_true_of_le lw]
rfl
exact lcnt_pos _ D w Ws (hWs D hD.1)
/-- The parametric size bound. -/
theorem haken (n N L t r b : Nat) (p : RProof (PHP n) []) (hM : N + L = n * (n + 1)) (hL : 1 <= L)
(hb : 1 <= b) (hbt : b < t) (hn : n + 1 = t + r)
(hw : forall s u, s + u = t -> s <= b -> b < s + s -> L <= s * u) :
(n * (n + 1)) ^ r <= (dd (nodes p)).length * N ^ r :=
iter0 n N L t r (dd (nodes p)) hM hL (Nat.lt_of_le_of_lt (Nat.zero_le b) hbt) hn
(fun rho hg _ hR => fin n L t b p (dd (nodes p)) (fun D h => dd_mem D _ h) hb hbt hw rho hg hR)
end Found.Pnp100
#print axioms Found.Pnp100.dd_keep
#print axioms Found.Pnp100.dd_mem
#print axioms Found.Pnp100.dd_len
#print axioms Found.Pnp100.lcnt_pos
#print axioms Found.Pnp100.fin
#print axioms Found.Pnp100.haken
lean_all/found/Pnp101.lean
/-
T330 piece 101. found/Pnp101 -- Haken's theorem with numbers: every resolution refutation of
the pigeonhole principle PHP(6k, 6k - 1) has at least (18/17)^(3k) distinct clauses (proof
complexity ladder, step 1: general resolution).
Statement (haken_num): for k >= 1, n + 1 = 6 k and a resolution refutation p of PHP n,
18 ^ (3 k) <= 17 ^ (3 k) * (number of distinct clauses of p).
It is Pnp100.haken with t = r = 3 k, b = 2 k, L = 2 k^2 and N = n (n + 1) - L; the width
condition is (k + a)(c + k) >= 2 k^2 when a + c = k. Proved:
* two_mul', three_mul', six_mul', add_cancel_l', add_cancel_l_eq, swap4, pow_mul',
pow_le, cancel_r, sq6: arithmetic by hand;
* width_num: the width condition;
* haken_num: the bound.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp100
namespace Found.Pnp101
open Found.Pnp62 (RProof)
open Found.Pnp66 (PHP)
open Found.Pnp93 (nodes)
open Found.Pnp98 (mul_add' add_mul' mul_le_r mul_pos')
open Found.Pnp99 (le_ex add_cancel_r' mul_le_l' mul_assoc' pow_pos')
open Found.Pnp100 (dd haken)
theorem two_mul' (k : Nat) : 2 * k = k + k := by
have e := add_mul' 1 1 k
rw [Nat.one_mul] at e
exact e
theorem three_mul' (k : Nat) : 3 * k = 2 * k + k := by
have e := add_mul' 2 1 k
rw [Nat.one_mul] at e
exact e
theorem six_mul' (k : Nat) : 6 * k = 3 * k + 3 * k := add_mul' 3 3 k
theorem add_cancel_l' {x a b : Nat} (h : x + a <= x + b) : a <= b := by
rw [Nat.add_comm x a, Nat.add_comm x b] at h
exact add_cancel_r' x h
theorem add_cancel_l_eq {x a b : Nat} (h : x + a = x + b) : a = b :=
Nat.le_antisymm (add_cancel_l' (Nat.le_of_eq h)) (add_cancel_l' (Nat.le_of_eq h.symm))
theorem swap4 (x y z w : Nat) : (x * y) * (z * w) = (x * z) * (y * w) :=
calc (x * y) * (z * w) = x * (y * (z * w)) := mul_assoc' x y (z * w)
_ = x * ((y * z) * w) := by rw [mul_assoc' y z w]
_ = x * ((z * y) * w) := by rw [Nat.mul_comm y z]
_ = x * (z * (y * w)) := by rw [mul_assoc' z y w]
_ = (x * z) * (y * w) := (mul_assoc' x z (y * w)).symm
theorem pow_mul' (a b : Nat) : forall r, (a * b) ^ r = a ^ r * b ^ r
| 0 => rfl
| r + 1 => by
show (a * b) ^ r * (a * b) = (a ^ r * a) * (b ^ r * b)
rw [pow_mul' a b r, swap4]
theorem pow_le {a b : Nat} (h : a <= b) : forall r, a ^ r <= b ^ r
| 0 => Nat.le_refl 1
| r + 1 => Nat.le_trans (mul_le_r (pow_le h r) a) (mul_le_l' h (b ^ r))
theorem cancel_r {x y z : Nat} (hz : 1 <= z) (h : x * z <= y * z) : x <= y := by
cases Nat.lt_or_ge y x with
| inr r => exact r
| inl l =>
have a : (y + 1) * z <= y * z := Nat.le_trans (mul_le_r l z) h
rw [add_mul', Nat.one_mul] at a
have b : z <= 0 := add_cancel_l' (Nat.le_trans a (Nat.le_of_eq (Nat.add_zero _).symm))
exact absurd (Nat.le_trans hz b) (Nat.not_succ_le_zero 0)
theorem zpow {m : Nat} (h : 1 <= m) : (0 : Nat) ^ m = 0 := by
cases m with
| zero => exact absurd h (Nat.not_succ_le_zero 0)
| succ m => exact Nat.mul_zero (0 ^ m)
theorem sq6 (k : Nat) : (6 * k) * (6 * k) = 18 * (2 * (k * k)) :=
calc (6 * k) * (6 * k) = (6 * 6) * (k * k) := swap4 6 k 6 k
_ = (18 * 2) * (k * k) := rfl
_ = 18 * (2 * (k * k)) := mul_assoc' 18 2 (k * k)
/-- The width condition for t = 3 k, b = 2 k, L = 2 k^2. -/
theorem width_num (k s u : Nat) (hsu : s + u = 3 * k) (hs : s <= 2 * k) (hb : 2 * k < s + s) :
2 * (k * k) <= s * u := by
rw [three_mul', two_mul'] at hsu
rw [two_mul'] at hs hb
rw [two_mul']
have ks : k <= s := by
cases Nat.lt_or_ge s k with
| inr r => exact r
| inl l => exact absurd (Nat.lt_of_lt_of_le hb (Nat.add_le_add (Nat.le_of_lt l) (Nat.le_of_lt l))) (Nat.lt_irrefl _)
cases le_ex _ _ ks with
| intro a ha =>
rw [ha] at hs hsu
cases le_ex _ _ (add_cancel_l' hs) with
| intro c hc =>
have e1 : (k + a) + (c + k) = k + k + k := by
rw [Nat.add_assoc k a, <- Nat.add_assoc a c k, <- hc, <- Nat.add_assoc]
have hu : u = c + k := add_cancel_l_eq (hsu.trans e1.symm)
rw [ha, hu]
have e2 : k * k = a * k + c * k := by
have t := add_mul' a c k
rw [<- hc] at t
exact t
have lo : k * c + (k * k + a * k) <= (k + a) * (c + k) := by
rw [mul_add']
exact Nat.add_le_add (mul_le_r (Nat.le_add_right k a) c) (Nat.le_of_eq (add_mul' k a k).symm)
have eq : k * k + k * k = k * c + (k * k + a * k) := by
rw [congrArg (fun x => k * k + x) e2, Nat.mul_comm c k, <- Nat.add_assoc, Nat.add_comm]
rw [eq]
exact lo
/-- Haken's theorem with numbers. -/
theorem haken_num (k n : Nat) (hk : 1 <= k) (hn : n + 1 = 6 * k) (p : RProof (PHP n) []) :
18 ^ (3 * k) <= 17 ^ (3 * k) * (dd (nodes p)).length := by
have kk : 1 <= k * k := mul_pos' hk hk
have hL : 1 <= 2 * (k * k) := by rw [two_mul']; exact Nat.le_trans kk (Nat.le_add_right _ _)
have hb : 1 <= 2 * k := by rw [two_mul']; exact Nat.le_trans hk (Nat.le_add_right _ _)
have hbt : 2 * k < 3 * k := by
rw [three_mul']
exact Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.add_le_add_left hk _)
-- n >= 2 k and k <= n + 1
have e6 : 6 * k = 2 * k + 4 * k := add_mul' 2 4 k
have h4 : 1 <= 4 * k := Nat.le_trans (Nat.le_of_ble_eq_true rfl : 1 <= 4) (mul_le_l' hk 4)
have n2 : 2 * k <= n := by
have t : 2 * k + 1 <= n + 1 := by
rw [hn, e6]
exact Nat.add_le_add_left h4 _
exact Nat.le_of_succ_le_succ t
have k1 : k <= n + 1 := by
rw [hn, six_mul', three_mul']
exact Nat.le_trans (Nat.le_add_left k (2 * k)) (Nat.le_add_right _ _)
have LM : 2 * (k * k) <= n * (n + 1) := by
rw [<- mul_assoc' 2 k k]
exact Nat.le_trans (mul_le_l' k1 (2 * k)) (mul_le_r n2 (n + 1))
cases le_ex _ _ LM with
| intro N hN =>
have hM : N + 2 * (k * k) = n * (n + 1) := by rw [hN, Nat.add_comm]
have H := haken n N (2 * (k * k)) (3 * k) (3 * k) (2 * k) p hM hL hb hbt (by rw [hn]; exact six_mul' k)
(fun s u hsu hs hb' => width_num k s u hsu hs hb')
have M1 : 1 <= n * (n + 1) := Nat.le_trans hL LM
-- 18 N <= 17 M
have M18 : n * (n + 1) <= 18 * (2 * (k * k)) := by
rw [<- sq6, <- hn]
exact mul_le_r (Nat.le_succ n) (n + 1)
have e18 : 18 * N + 18 * (2 * (k * k)) = 17 * (n * (n + 1)) + n * (n + 1) := by
rw [<- mul_add', hM, Nat.mul_comm 18, Nat.mul_comm 17]
try rfl
have N17 : 18 * N <= 17 * (n * (n + 1)) := by
have t : 18 * N + 18 * (2 * (k * k)) <= 17 * (n * (n + 1)) + 18 * (2 * (k * k)) := by
rw [e18]; exact Nat.add_le_add_left M18 _
exact add_cancel_r' _ t
cases Nat.lt_or_ge 0 N with
| inr r =>
have z : N = 0 := Found.Pnp66.le_zero_eq r
rw [z, zpow (Nat.le_trans hb (Nat.le_of_lt hbt)), Nat.mul_zero] at H
exact absurd (Nat.le_trans (pow_pos' M1 _) H) (Nat.not_succ_le_zero 0)
| inl l =>
have a : 18 ^ (3 * k) * N ^ (3 * k) <= (17 ^ (3 * k) * (dd (nodes p)).length) * N ^ (3 * k) := by
rw [<- pow_mul' 18 N (3 * k)]
refine Nat.le_trans (pow_le N17 _) ?_
rw [pow_mul' 17 (n * (n + 1)) (3 * k), mul_assoc' (17 ^ (3 * k)) (dd (nodes p)).length (N ^ (3 * k))]
exact mul_le_l' H _
exact cancel_r (pow_pos' l _) a
end Found.Pnp101
#print axioms Found.Pnp101.two_mul'
#print axioms Found.Pnp101.three_mul'
#print axioms Found.Pnp101.six_mul'
#print axioms Found.Pnp101.add_cancel_l'
#print axioms Found.Pnp101.add_cancel_l_eq
#print axioms Found.Pnp101.swap4
#print axioms Found.Pnp101.pow_mul'
#print axioms Found.Pnp101.pow_le
#print axioms Found.Pnp101.cancel_r
#print axioms Found.Pnp101.zpow
#print axioms Found.Pnp101.sq6
#print axioms Found.Pnp101.width_num
#print axioms Found.Pnp101.haken_num
lean_all/found/Pnp102.lean
/-
T330 piece 102. found/Pnp102 -- cutting planes proofs and their soundness (proof complexity
ladder, step 2: cutting planes).
A line is an integer linear inequality over 0/1 variables x_0 .. x_(m-1), kept on two sides
with natural numbers: sum P_i x_i + d >= sum N_i x_i + e (P, N dense coefficient lists), so
the net coefficient of x_i is P_i - N_i and no integer library is needed. Rules:
* axioms of the formula, x_i >= 0, x_i <= 1;
* addition of two lines; multiplication by a natural number;
* division by c >= 1 with rounding: from (P, N, d, e) to (P', N', d', e') when every net
coefficient is c times the new one (P_i + c N'_i = N_i + c P'_i) and the new constant is
at most the rounded quotient (c e' + d + 1 <= c d' + e + c).
A refutation derives 0 >= 1. Proved:
* val_add, val_mul, val_unit_le: values of lines;
* sound: every derived line holds under an assignment satisfying the formula;
* refute_unsat: a formula with a refutation has no satisfying assignment.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp101
namespace Found.Pnp102
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp96 (sumI_le)
open Found.Pnp97 (sumI_add sumI_ext sumI_zero)
open Found.Pnp98 (mul_add' add_mul' mul_le_r)
open Found.Pnp99 (add_cancel_r' mul_le_l' mul_assoc')
open Found.Pnp101 (add_cancel_l')
def nth0 : List Nat -> Nat -> Nat
| [], _ => 0
| a :: _, 0 => a
| _ :: l, i + 1 => nth0 l i
def addL : List Nat -> List Nat -> List Nat
| [], m => m
| a :: l, [] => a :: l
| a :: l, b :: m => (a + b) :: addL l m
def mulL (k : Nat) : List Nat -> List Nat
| [] => []
| a :: l => (k * a) :: mulL k l
/-- The list with 1 at place i and 0 before it. -/
def unitL : Nat -> List Nat
| 0 => [1]
| i + 1 => 0 :: unitL i
structure Line where
P : List Nat
N : List Nat
d : Nat
e : Nat
def val (m : Nat) (l : List Nat) (a : Nat -> Bool) : Nat := sumI (fun i => nth0 l i * bv (a i)) m
/-- The line holds under a. -/
def Holds (m : Nat) (a : Nat -> Bool) (L : Line) : Prop := val m L.N a + L.e <= val m L.P a + L.d
def addLine (A B : Line) : Line := Line.mk (addL A.P B.P) (addL A.N B.N) (A.d + B.d) (A.e + B.e)
def mulLine (k : Nat) (A : Line) : Line := Line.mk (mulL k A.P) (mulL k A.N) (k * A.d) (k * A.e)
/-- Division: B is A divided by c, rounded. -/
structure DivOK (c : Nat) (A B : Line) : Prop where
pos : 1 <= c
coef : forall i, nth0 A.P i + c * nth0 B.N i = nth0 A.N i + c * nth0 B.P i
cst : c * B.e + A.d + 1 <= c * B.d + A.e + c
inductive CPProof (m : Nat) (F : List Line) : Line -> Type where
| ax (L : Line) (h : L ∈ F) : CPProof m F L
| nonneg (i : Nat) : CPProof m F (Line.mk (unitL i) [] 0 0)
| le1 (i : Nat) : CPProof m F (Line.mk [] (unitL i) 1 0)
| add (A B : Line) (p : CPProof m F A) (q : CPProof m F B) : CPProof m F (addLine A B)
| mul (k : Nat) (A : Line) (p : CPProof m F A) : CPProof m F (mulLine k A)
| div (c : Nat) (A B : Line) (p : CPProof m F A) (h : DivOK c A B) : CPProof m F B
def CPProof.size {m : Nat} {F : List Line} : {L : Line} -> CPProof m F L -> Nat
| _, .ax _ _ => 1
| _, .nonneg _ => 1
| _, .le1 _ => 1
| _, .add _ _ p q => p.size + q.size + 1
| _, .mul _ _ p => p.size + 1
| _, .div _ _ _ p _ => p.size + 1
/-- The contradiction 0 >= 1. -/
def falseLine : Line := Line.mk [] [] 0 1
theorem nth0_addL : forall (l m : List Nat) (i : Nat), nth0 (addL l m) i = nth0 l i + nth0 m i
| [], _, _ => (Nat.zero_add _).symm
| _ :: _, [], _ => rfl
| _ :: _, _ :: _, 0 => rfl
| _ :: l, _ :: m, i + 1 => nth0_addL l m i
theorem nth0_mulL (k : Nat) : forall (l : List Nat) (i : Nat), nth0 (mulL k l) i = k * nth0 l i
| [], _ => rfl
| _ :: _, 0 => rfl
| _ :: l, i + 1 => nth0_mulL k l i
theorem mul_sumI (c : Nat) (h : Nat -> Nat) : forall k, c * sumI h k = sumI (fun i => c * h i) k
| 0 => rfl
| k + 1 => by
show c * (sumI h k + h k) = sumI (fun i => c * h i) k + c * h k
rw [mul_add', mul_sumI c h k]
theorem val_add (m : Nat) (l l' : List Nat) (a : Nat -> Bool) : val m (addL l l') a = val m l a + val m l' a := by
show sumI (fun i => nth0 (addL l l') i * bv (a i)) m = sumI _ m + sumI _ m
rw [<- sumI_add]
refine sumI_ext _ _ ?_ m
intro i
show nth0 (addL l l') i * bv (a i) = nth0 l i * bv (a i) + nth0 l' i * bv (a i)
rw [nth0_addL, add_mul']
theorem val_mul (m k : Nat) (l : List Nat) (a : Nat -> Bool) : val m (mulL k l) a = k * val m l a := by
show sumI (fun i => nth0 (mulL k l) i * bv (a i)) m = k * sumI _ m
rw [mul_sumI]
refine sumI_ext _ _ ?_ m
intro i
show nth0 (mulL k l) i * bv (a i) = k * (nth0 l i * bv (a i))
rw [nth0_mulL, mul_assoc']
theorem nth0_unit : forall i j : Nat, nth0 (unitL i) j = bv (Nat.beq j i)
| 0, 0 => rfl
| 0, _ + 1 => rfl
| _ + 1, 0 => rfl
| i + 1, j + 1 => nth0_unit i j
theorem sumI_le_one (h : Nat -> Nat) (i : Nat) (h1 : h i <= 1) (h0 : forall j, Nat.beq j i = false -> h j = 0) :
forall k, sumI h k <= 1
| 0 => Nat.zero_le 1
| k + 1 => by
show sumI h k + h k <= 1
cases e : Nat.beq k i with
| false =>
rw [h0 k e]
exact sumI_le_one h i h1 h0 k
| true =>
have ki : k = i := Found.Pnp2.beq_eq k i e
have z : sumI h k = 0 := by
have t : forall k', k' <= k -> sumI h k' = 0 := by
intro k'
induction k' with
| zero => intro _; rfl
| succ k' ih =>
intro hk
show sumI h k' + h k' = 0
rw [ih (Nat.le_of_succ_le hk), h0 k' (Found.Pnp2.beq_false_of_ne k' i (fun e' => by
rw [e', <- ki] at hk; exact Nat.lt_irrefl k hk))]
exact t k (Nat.le_refl k)
rw [z, Nat.zero_add, ki]
exact h1
theorem val_unit_le (m i : Nat) (a : Nat -> Bool) : val m (unitL i) a <= 1 := by
refine sumI_le_one _ i ?_ ?_ m
· show nth0 (unitL i) i * bv (a i) <= 1
rw [nth0_unit, Found.Pnp62.beq_refl]
show 1 * bv (a i) <= 1
rw [Nat.one_mul]
cases a i <;> first | exact Nat.zero_le 1 | exact Nat.le_refl 1
· intro j hj
show nth0 (unitL i) j * bv (a j) = 0
rw [nth0_unit, hj]
exact Found.Pnp97.zero_mul' _
theorem val_nil (m : Nat) (a : Nat -> Bool) : val m [] a = 0 := by
show sumI (fun i => 0 * bv (a i)) m = 0
rw [sumI_ext _ (fun _ => 0) (fun i => Found.Pnp97.zero_mul' _) m]
exact sumI_zero m
theorem coef_val (m c : Nat) (A B : Line) (a : Nat -> Bool)
(h : forall i, nth0 A.P i + c * nth0 B.N i = nth0 A.N i + c * nth0 B.P i) :
val m A.P a + c * val m B.N a = val m A.N a + c * val m B.P a := by
rw [<- val_mul, <- val_mul, <- val_add, <- val_add]
refine sumI_ext _ _ ?_ m
intro i
show nth0 (addL A.P (mulL c B.N)) i * bv (a i) = nth0 (addL A.N (mulL c B.P)) i * bv (a i)
rw [nth0_addL, nth0_addL, nth0_mulL, nth0_mulL, h i]
theorem div_arith (c X Y U V d e d' e' : Nat) (cv : U + c * Y = V + c * X) (hA : V + e <= U + d)
(cst : c * e' + d + 1 <= c * d' + e + c) : Y + e' <= X + d' := by
cases Nat.lt_or_ge (X + d') (Y + e') with
| inr r => exact r
| inl l =>
have eB1 : c * (X + d' + 1) = c * X + (c * d' + c) := by
rw [mul_add', mul_add', Nat.mul_one, Nat.add_assoc]
have S1 : c * X + (c * d' + c) <= c * Y + c * e' := by
rw [<- eB1, <- mul_add']
exact mul_le_l' l c
have S2 := Nat.add_le_add S1 hA
have perm1 : (c * Y + c * e') + (U + d) = (V + c * X) + (c * e' + d) := by
rw [Found.Pnp93.add4 (c * Y) (c * e') U d, Nat.add_comm (c * Y) U, cv]
have perm2 : (c * X + (c * d' + c)) + (V + e) = (V + c * X) + (c * d' + e + c) := by
rw [Found.Pnp93.add4 (c * X) (c * d' + c) V e, Nat.add_comm (c * X) V, Nat.add_right_comm (c * d') c e]
rw [perm1, perm2] at S2
have S3 : (V + c * X) + (c * e' + d) + 1 <= (V + c * X) + (c * d' + e + c) := Nat.add_le_add_left cst (V + c * X)
exact absurd (Nat.le_trans S3 S2) (Nat.not_succ_le_self _)
theorem div_sound (m c : Nat) (A B : Line) (a : Nat -> Bool) (h : DivOK c A B) (hA : Holds m a A) : Holds m a B :=
div_arith c (val m B.P a) (val m B.N a) (val m A.P a) (val m A.N a) A.d A.e B.d B.e
(coef_val m c A B a h.coef) hA h.cst
theorem sound (m : Nat) (F : List Line) (a : Nat -> Bool) (hF : forall L, L ∈ F -> Holds m a L) :
forall (L : Line), CPProof m F L -> Holds m a L := by
intro L p
induction p with
| ax L h => exact hF L h
| nonneg i =>
show val m [] a + 0 <= val m (unitL i) a + 0
rw [val_nil]; exact Nat.zero_le _
| le1 i =>
show val m (unitL i) a + 0 <= val m [] a + 1
rw [val_nil]; exact val_unit_le m i a
| add A B p q ihp ihq =>
show val m (addL A.N B.N) a + (A.e + B.e) <= val m (addL A.P B.P) a + (A.d + B.d)
rw [val_add, val_add, Found.Pnp93.add4, Found.Pnp93.add4 (val m A.P a)]
exact Nat.add_le_add ihp ihq
| mul k A p ih =>
show val m (mulL k A.N) a + k * A.e <= val m (mulL k A.P) a + k * A.d
rw [val_mul, val_mul, <- mul_add', <- mul_add']
exact mul_le_l' ih k
| div c A B p h ih => exact div_sound m c A B a h ih
theorem refute_unsat (m : Nat) (F : List Line) (p : CPProof m F falseLine) (a : Nat -> Bool)
(hF : forall L, L ∈ F -> Holds m a L) : False := by
have t := sound m F a hF falseLine p
have t' : val m [] a + 1 <= val m [] a + 0 := t
rw [val_nil] at t'
exact Nat.not_succ_le_zero 0 t'
end Found.Pnp102
#print axioms Found.Pnp102.nth0_addL
#print axioms Found.Pnp102.nth0_mulL
#print axioms Found.Pnp102.mul_sumI
#print axioms Found.Pnp102.val_add
#print axioms Found.Pnp102.val_mul
#print axioms Found.Pnp102.nth0_unit
#print axioms Found.Pnp102.sumI_le_one
#print axioms Found.Pnp102.val_unit_le
#print axioms Found.Pnp102.val_nil
#print axioms Found.Pnp102.coef_val
#print axioms Found.Pnp102.div_arith
#print axioms Found.Pnp102.div_sound
#print axioms Found.Pnp102.sound
#print axioms Found.Pnp102.refute_unsat
lean_all/found/Pnp103.lean
/-
T330 piece 103. found/Pnp103 -- clauses as cutting planes lines (proof complexity ladder,
step 2: cutting planes).
A clause l_1 v ... v l_s becomes the line sum_{x positive} x + sum_{x negative} (1 - x) >= 1,
kept on two sides: P has a 1 at every positive variable, N a 1 at every negative variable,
d counts the negative literals and e = 1. Proved:
* val_unit: the value of the unit list at v < m is x_v;
* line_base: every clause line satisfies N <= P + d under any assignment;
* line_holds: a true clause gives a line that holds;
* cnf_refute_unsat: a cutting planes refutation of the lines of a CNF (variables below m)
shows that the CNF has no satisfying assignment.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp102
namespace Found.Pnp103
open Found.RootComp (Lit Clause CNF evalLit evalClause evalCNF)
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp102 (nth0 addL unitL Line val Holds CPProof falseLine val_add val_nil nth0_unit refute_unsat)
def lineOf : Clause -> Line
| [] => Line.mk [] [] 0 1
| (true, v) :: C => Line.mk (addL (unitL v) (lineOf C).P) (lineOf C).N (lineOf C).d (lineOf C).e
| (false, v) :: C => Line.mk (lineOf C).P (addL (unitL v) (lineOf C).N) ((lineOf C).d + 1) (lineOf C).e
def linesOf : CNF -> List Line
| [] => []
| C :: F => lineOf C :: linesOf F
/-- All variables of a clause are below m. -/
def VarsBelow (m : Nat) : Clause -> Prop
| [] => True
| l :: C => l.2 < m /\ VarsBelow m C
theorem val_unit (a : Nat -> Bool) (v : Nat) : forall m, v < m -> val m (unitL v) a = bv (a v)
| 0, h => absurd h (Nat.not_lt_zero v)
| m + 1, h => by
show sumI (fun i => nth0 (unitL v) i * bv (a i)) m + nth0 (unitL v) m * bv (a m) = bv (a v)
rw [nth0_unit]
cases Nat.lt_or_ge v m with
| inl l =>
have ih := val_unit a v m l
have e : Nat.beq m v = false := Found.Pnp2.beq_false_of_ne m v (fun x => by rw [x] at l; exact Nat.lt_irrefl v l)
rw [e]
show val m (unitL v) a + 0 * bv (a m) = bv (a v)
rw [ih, Found.Pnp97.zero_mul']
rfl
| inr r =>
have ev : v = m := Nat.le_antisymm (Nat.le_of_lt_succ h) r
rw [ev, Found.Pnp62.beq_refl]
have z : sumI (fun i => nth0 (unitL m) i * bv (a i)) m = 0 := by
have t : forall k, k <= m -> sumI (fun i => nth0 (unitL m) i * bv (a i)) k = 0 := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro hk
show sumI _ k + nth0 (unitL m) k * bv (a k) = 0
rw [ih (Nat.le_of_succ_le hk), nth0_unit,
Found.Pnp2.beq_false_of_ne k m (fun x => by rw [x] at hk; exact Nat.lt_irrefl m hk)]
show 0 + 0 * bv (a k) = 0
rw [Found.Pnp97.zero_mul']
try rfl
exact t m (Nat.le_refl m)
rw [z]
show 0 + 1 * bv (a m) = bv (a m)
rw [Nat.one_mul, Nat.zero_add]
theorem bv_le1 (b : Bool) : bv b <= 1 := by cases b <;> first | exact Nat.zero_le 1 | exact Nat.le_refl 1
theorem line_base (m : Nat) (a : Nat -> Bool) : forall C : Clause, VarsBelow m C ->
val m (lineOf C).N a <= val m (lineOf C).P a + (lineOf C).d
| [], _ => by show val m [] a <= val m [] a + 0; exact Nat.le_refl _
| (true, v) :: C, h => by
show val m (lineOf C).N a <= val m (addL (unitL v) (lineOf C).P) a + (lineOf C).d
rw [val_add]
refine Nat.le_trans (line_base m a C h.2) ?_
rw [Nat.add_assoc]
exact Nat.le_add_left _ _
| (false, v) :: C, h => by
show val m (addL (unitL v) (lineOf C).N) a <= val m (lineOf C).P a + ((lineOf C).d + 1)
rw [val_add, val_unit a v m h.1, Nat.add_comm (bv (a v)), <- Nat.add_assoc]
exact Nat.add_le_add (line_base m a C h.2) (bv_le1 _)
theorem line_holds (m : Nat) (a : Nat -> Bool) : forall C : Clause, VarsBelow m C -> evalClause a C = true ->
Holds m a (lineOf C)
| [], _, h => Bool.noConfusion h
| (true, v) :: C, hv, h => by
show val m (lineOf C).N a + (lineOf C).e <= val m (addL (unitL v) (lineOf C).P) a + (lineOf C).d
have e1 : (lineOf C).e = 1 := lineOf_e C
rw [e1, val_add, val_unit a v m hv.1]
have h' : (a v || evalClause a C) = true := h
cases ea : a v with
| true =>
show val m (lineOf C).N a + 1 <= 1 + val m (lineOf C).P a + (lineOf C).d
rw [Nat.add_assoc, Nat.add_comm 1]
exact Nat.add_le_add_right (line_base m a C hv.2) 1
| false =>
rw [ea] at h'
have t : Holds m a (lineOf C) := line_holds m a C hv.2 h'
have t' : val m (lineOf C).N a + (lineOf C).e <= val m (lineOf C).P a + (lineOf C).d := t
rw [e1] at t'
show val m (lineOf C).N a + 1 <= 0 + val m (lineOf C).P a + (lineOf C).d
rw [Nat.zero_add]
exact t'
| (false, v) :: C, hv, h => by
show val m (addL (unitL v) (lineOf C).N) a + (lineOf C).e <= val m (lineOf C).P a + ((lineOf C).d + 1)
have e1 : (lineOf C).e = 1 := lineOf_e C
rw [e1, val_add, val_unit a v m hv.1]
have h' : ((!a v) || evalClause a C) = true := h
cases ea : a v with
| false =>
show 0 + val m (lineOf C).N a + 1 <= val m (lineOf C).P a + ((lineOf C).d + 1)
rw [Nat.zero_add, <- Nat.add_assoc]
exact Nat.add_le_add_right (line_base m a C hv.2) 1
| true =>
rw [ea] at h'
have t : Holds m a (lineOf C) := line_holds m a C hv.2 h'
have t' : val m (lineOf C).N a + (lineOf C).e <= val m (lineOf C).P a + (lineOf C).d := t
rw [e1] at t'
show 1 + val m (lineOf C).N a + 1 <= val m (lineOf C).P a + ((lineOf C).d + 1)
rw [Nat.add_comm 1 (val m (lineOf C).N a), <- Nat.add_assoc]
exact Nat.add_le_add_right t' 1
where
lineOf_e : forall C : Clause, (lineOf C).e = 1
| [] => rfl
| (true, _) :: C => lineOf_e C
| (false, _) :: C => lineOf_e C
theorem mem_linesOf : forall (F : CNF) (L : Line), L ∈ linesOf F -> Exists fun C => C ∈ F /\ L = lineOf C
| [], _, h => by cases h
| C :: F, L, h => by
cases h with
| head => exact Exists.intro C (And.intro (List.Mem.head _) rfl)
| tail _ h' =>
cases mem_linesOf F L h' with
| intro D hD => exact Exists.intro D (And.intro (List.Mem.tail _ hD.1) hD.2)
theorem cnf_mem_true (a : Nat -> Bool) : forall (F : CNF) (C : Clause), evalCNF a F = true -> C ∈ F -> evalClause a C = true
| [], _, _, h => by cases h
| D :: F, C, hF, h => by
have hF' : (evalClause a D && evalCNF a F) = true := hF
cases h with
| head => exact Found.Pnp62.and_l hF'
| tail _ h' => exact cnf_mem_true a F C (Found.Pnp62.and_r hF') h'
theorem cnf_refute_unsat (m : Nat) (F : CNF) (hv : forall C, C ∈ F -> VarsBelow m C)
(p : CPProof m (linesOf F) falseLine) (a : Nat -> Bool) (ha : evalCNF a F = true) : False := by
refine refute_unsat m (linesOf F) p a ?_
intro L hL
cases mem_linesOf F L hL with
| intro C hC =>
rw [hC.2]
exact line_holds m a C (hv C hC.1) (cnf_mem_true a F C ha hC.1)
end Found.Pnp103
#print axioms Found.Pnp103.val_unit
#print axioms Found.Pnp103.bv_le1
#print axioms Found.Pnp103.line_base
#print axioms Found.Pnp103.line_holds
#print axioms Found.Pnp103.mem_linesOf
#print axioms Found.Pnp103.cnf_mem_true
#print axioms Found.Pnp103.cnf_refute_unsat
lean_all/found/Pnp104.lean
/-
T330 piece 104. found/Pnp104 -- the clique-colouring formula (proof complexity ladder, step
2: cutting planes; the formula of Pudlak 1997).
For n vertices, clique size k and c colours the variables are
p(i, j) = i n + j (edge from i to j), i, j < n,
q(l, i) = n n + (l n + i) (position l of the clique is i), l < k, i < n,
r(i, a) = n n + k n + (i c + a) (vertex i has colour a), i < n, a < c,
all below m = n n + k n + n c. Clauses:
every position has a vertex; no vertex fills two positions l < l'; two positions l < l'
with vertices i, j force the edge p(i, j); every vertex has a colour; an edge p(i, j)
forbids colour a at both i and j.
The edge variables occur positively in the clique part and negatively in the colouring part.
Proved:
* mem_app_or, mem_upto, mem_bindUp: membership in the generated lists (by hand);
* lin_lt: a < A, b < B -> a B + b < A B;
* pv_lt, qv_lt, rv_lt: every variable is below m;
* cc_vars: every clause of the formula has its variables below m.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp103
namespace Found.Pnp104
open Found.RootComp (Lit Clause CNF)
open Found.Pnp103 (VarsBelow)
open Found.Pnp98 (add_mul' mul_le_r)
def upto {α : Type} (f : Nat -> α) : Nat -> List α
| 0 => []
| k + 1 => f k :: upto f k
def bindUp {α : Type} (g : Nat -> List α) : Nat -> List α
| 0 => []
| k + 1 => g k ++ bindUp g k
def pv (n i j : Nat) : Nat := i * n + j
def qv (n l i : Nat) : Nat := n * n + (l * n + i)
def rv (n k c i a : Nat) : Nat := n * n + k * n + (i * c + a)
def mCC (n k c : Nat) : Nat := n * n + k * n + n * c
/-- Position l has some vertex. -/
def qAll (n l : Nat) : Clause := upto (fun i => (true, qv n l i)) n
/-- Vertex i does not fill both l and l'. -/
def qTwo (n l l' i : Nat) : Clause := [(false, qv n l i), (false, qv n l' i)]
/-- Positions l, l' with vertices i, j force the edge (i, j). -/
def qEdge (n l l' i j : Nat) : Clause := [(false, qv n l i), (false, qv n l' j), (true, pv n i j)]
/-- Vertex i has some colour. -/
def rAll (n k c i : Nat) : Clause := upto (fun a => (true, rv n k c i a)) c
/-- An edge (i, j) forbids colour a at both ends. -/
def rEdge (n k c i j a : Nat) : Clause := [(false, pv n i j), (false, rv n k c i a), (false, rv n k c j a)]
/-- Pairs l < l' below k. -/
def pairsK {α : Type} (k : Nat) (g : Nat -> Nat -> List α) : List α :=
bindUp (fun l' => bindUp (fun l => g l l') l') k
def cliquePart (n k : Nat) : CNF :=
upto (fun l => qAll n l) k ++
pairsK k (fun l l' => upto (fun i => qTwo n l l' i) n) ++
pairsK k (fun l l' => bindUp (fun i => upto (fun j => qEdge n l l' i j) n) n)
def colourPart (n k c : Nat) : CNF :=
upto (fun i => rAll n k c i) n ++
bindUp (fun i => bindUp (fun j => upto (fun a => rEdge n k c i j a) c) n) n
def CC (n k c : Nat) : CNF := cliquePart n k ++ colourPart n k c
theorem mem_app_or {α : Type} (x : α) : forall (A B : List α), x ∈ A ++ B -> x ∈ A \/ x ∈ B
| [], _, h => Or.inr h
| _ :: A, B, h => by
cases h with
| head => exact Or.inl (List.Mem.head _)
| tail _ h' =>
cases mem_app_or x A B h' with
| inl a => exact Or.inl (List.Mem.tail _ a)
| inr b => exact Or.inr b
theorem mem_upto {α : Type} (f : Nat -> α) (x : α) : forall k, x ∈ upto f k -> Exists fun i => i < k /\ x = f i
| 0, h => by cases h
| k + 1, h => by
cases h with
| head => exact Exists.intro k (And.intro (Nat.lt_succ_self k) rfl)
| tail _ h' =>
cases mem_upto f x k h' with
| intro i hi => exact Exists.intro i (And.intro (Nat.lt_succ_of_lt hi.1) hi.2)
theorem mem_bindUp {α : Type} (g : Nat -> List α) (x : α) : forall k, x ∈ bindUp g k -> Exists fun i => i < k /\ x ∈ g i
| 0, h => by cases h
| k + 1, h => by
cases mem_app_or x (g k) (bindUp g k) h with
| inl a => exact Exists.intro k (And.intro (Nat.lt_succ_self k) a)
| inr b =>
cases mem_bindUp g x k b with
| intro i hi => exact Exists.intro i (And.intro (Nat.lt_succ_of_lt hi.1) hi.2)
theorem mem_pairsK {α : Type} (k : Nat) (g : Nat -> Nat -> List α) (x : α) (h : x ∈ pairsK k g) :
Exists fun l => Exists fun l' => l < l' /\ l' < k /\ x ∈ g l l' :=
match mem_bindUp _ x k h with
| Exists.intro l' hl' =>
match mem_bindUp _ x l' hl'.2 with
| Exists.intro l hl => Exists.intro l (Exists.intro l' (And.intro hl.1 (And.intro hl'.1 hl.2)))
theorem lin_lt (a b A B : Nat) (ha : a < A) (hb : b < B) : a * B + b < A * B := by
have t : a * B + b < a * B + B := Nat.add_lt_add_left hb _
have e : (a + 1) * B = a * B + B := by rw [add_mul', Nat.one_mul]
rw [<- e] at t
exact Nat.lt_of_lt_of_le t (mul_le_r ha B)
theorem pv_lt (n k c i j : Nat) (hi : i < n) (hj : j < n) : pv n i j < mCC n k c :=
Nat.lt_of_lt_of_le (lin_lt i j n n hi hj) (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))
theorem qv_lt (n k c l i : Nat) (hl : l < k) (hi : i < n) : qv n l i < mCC n k c := by
show n * n + (l * n + i) < n * n + k * n + n * c
exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left (lin_lt l i k n hl hi) _) (Nat.le_add_right _ _)
theorem rv_lt (n k c i a : Nat) (hi : i < n) (ha : a < c) : rv n k c i a < mCC n k c := by
show n * n + k * n + (i * c + a) < n * n + k * n + n * c
exact Nat.add_lt_add_left (lin_lt i a n c hi ha) _
theorem vars_upto (m : Nat) (f : Nat -> Lit) : forall k, (forall i, i < k -> (f i).2 < m) -> VarsBelow m (upto f k)
| 0, _ => True.intro
| k + 1, h => And.intro (h k (Nat.lt_succ_self k)) (vars_upto m f k (fun i hi => h i (Nat.lt_succ_of_lt hi)))
theorem cc_vars (n k c : Nat) (C : Clause) (hC : C ∈ CC n k c) : VarsBelow (mCC n k c) C := by
cases mem_app_or C _ _ hC with
| inl h1 =>
cases mem_app_or C _ _ h1 with
| inl h2 =>
cases mem_app_or C _ _ h2 with
| inl h3 =>
cases mem_upto _ C k h3 with
| intro l hl =>
rw [hl.2]
exact vars_upto _ _ n (fun i hi => qv_lt n k c l i hl.1 hi)
| inr h3 =>
cases mem_pairsK k _ C h3 with
| intro l hl =>
cases hl with
| intro l' hl' =>
cases mem_upto _ C n hl'.2.2 with
| intro i hi =>
rw [hi.2]
exact And.intro (qv_lt n k c l i (Nat.lt_trans hl'.1 hl'.2.1) hi.1)
(And.intro (qv_lt n k c l' i hl'.2.1 hi.1) True.intro)
| inr h2 =>
cases mem_pairsK k _ C h2 with
| intro l hl =>
cases hl with
| intro l' hl' =>
cases mem_bindUp _ C n hl'.2.2 with
| intro i hi =>
cases mem_upto _ C n hi.2 with
| intro j hj =>
rw [hj.2]
exact And.intro (qv_lt n k c l i (Nat.lt_trans hl'.1 hl'.2.1) hi.1)
(And.intro (qv_lt n k c l' j hl'.2.1 hj.1) (And.intro (pv_lt n k c i j hi.1 hj.1) True.intro))
| inr h1 =>
cases mem_app_or C _ _ h1 with
| inl h2 =>
cases mem_upto _ C n h2 with
| intro i hi =>
rw [hi.2]
exact vars_upto _ _ c (fun a ha => rv_lt n k c i a hi.1 ha)
| inr h2 =>
cases mem_bindUp _ C n h2 with
| intro i hi =>
cases mem_bindUp _ C n hi.2 with
| intro j hj =>
cases mem_upto _ C c hj.2 with
| intro a ha =>
rw [ha.2]
exact And.intro (pv_lt n k c i j hi.1 hj.1)
(And.intro (rv_lt n k c i a hi.1 ha.1) (And.intro (rv_lt n k c j a hj.1 ha.1) True.intro))
end Found.Pnp104
#print axioms Found.Pnp104.mem_app_or
#print axioms Found.Pnp104.mem_upto
#print axioms Found.Pnp104.mem_bindUp
#print axioms Found.Pnp104.mem_pairsK
#print axioms Found.Pnp104.lin_lt
#print axioms Found.Pnp104.pv_lt
#print axioms Found.Pnp104.qv_lt
#print axioms Found.Pnp104.rv_lt
#print axioms Found.Pnp104.vars_upto
#print axioms Found.Pnp104.cc_vars
lean_all/found/Pnp105.lean
/-
T330 piece 105. found/Pnp105 -- integers as pairs and floor division (proof complexity
ladder, step 2: cutting planes; tools for the monotone interpolant of Pudlak 1997).
The interpolant of a cutting planes refutation computes an integer per line. An integer is
a pair (a, b) of natural numbers standing for a - b; (a, b) <= (a', b') when a + b' <= a' + b.
Floor division by c' + 1 of (a, b) is (divN (a + c' b) (c' + 1), b). divN is defined by
structural recursion. Proved:
* divN_spec: (c' + 1) * divN x (c' + 1) <= x < (c' + 1) * (divN x (c' + 1) + 1);
* divN_mono: x <= y -> divN x c <= divN y c;
* quot_unique, divN_shift: the quotient is unique, and shifts by multiples of c;
* zle_refl, zle_trans: the order;
* zdiv_low, zdiv_high: (c' + 1) * floor(v / (c' + 1)) <= v < (c' + 1) * (floor + 1), on pairs;
* zdiv_mono: floor division is monotone.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp104
namespace Found.Pnp105
open Found.Pnp98 (mul_add' add_mul' mul_le_r)
open Found.Pnp99 (add_cancel_r' mul_le_l' mul_assoc')
open Found.Pnp101 (add_cancel_l')
/-- Floor division of x by c (c >= 1), by structural recursion on x. -/
def divN : Nat -> Nat -> Nat
| 0, _ => 0
| x + 1, c => Found.Pnp65.selN (Nat.ble (c * (divN x c + 1)) (x + 1)) (divN x c + 1) (divN x c)
theorem lt_add_succ (n c' : Nat) : n < n + (c' + 1) := Nat.lt_succ_of_le (Nat.le_add_right n c')
theorem divN_spec (c' : Nat) : forall x, (c' + 1) * divN x (c' + 1) <= x /\ x < (c' + 1) * (divN x (c' + 1) + 1)
| 0 => And.intro (Nat.le_refl 0) (by
show 0 < (c' + 1) * (0 + 1)
rw [Nat.zero_add, Nat.mul_one]; exact Nat.succ_pos c')
| x + 1 => by
have ih := divN_spec c' x
show (c' + 1) * Found.Pnp65.selN (Nat.ble ((c' + 1) * (divN x (c' + 1) + 1)) (x + 1)) (divN x (c' + 1) + 1) (divN x (c' + 1)) <= x + 1 /\
x + 1 < (c' + 1) * (Found.Pnp65.selN (Nat.ble ((c' + 1) * (divN x (c' + 1) + 1)) (x + 1)) (divN x (c' + 1) + 1) (divN x (c' + 1)) + 1)
cases e : Nat.ble ((c' + 1) * (divN x (c' + 1) + 1)) (x + 1) with
| true =>
have l := Nat.le_of_ble_eq_true e
refine And.intro l ?_
show x + 1 < (c' + 1) * (divN x (c' + 1) + 1 + 1)
rw [mul_add' (c' + 1) (divN x (c' + 1) + 1) 1, Nat.mul_one]
exact Nat.lt_of_le_of_lt (Nat.succ_le_of_lt ih.2) (lt_add_succ _ c')
| false =>
refine And.intro (Nat.le_trans ih.1 (Nat.le_succ x)) ?_
show x + 1 < (c' + 1) * (divN x (c' + 1) + 1)
cases Nat.lt_or_ge (x + 1) ((c' + 1) * (divN x (c' + 1) + 1)) with
| inl l => exact l
| inr r => rw [Nat.ble_eq_true_of_le r] at e; exact Bool.noConfusion e
/-- Uniqueness of the quotient. -/
theorem quot_unique (c q q' y : Nat) (h1 : c * q <= y) (h2 : y < c * (q + 1)) (h1' : c * q' <= y) (h2' : y < c * (q' + 1)) :
q = q' := by
cases Nat.lt_or_ge q q' with
| inl l => exact absurd (Nat.lt_of_lt_of_le h2 (Nat.le_trans (mul_le_l' l c) h1')) (Nat.lt_irrefl y)
| inr r =>
cases Nat.lt_or_ge q' q with
| inl l => exact absurd (Nat.lt_of_lt_of_le h2' (Nat.le_trans (mul_le_l' l c) h1)) (Nat.lt_irrefl y)
| inr r' => exact Nat.le_antisymm r' r
theorem divN_shift (c' x t : Nat) : divN (x + (c' + 1) * t) (c' + 1) = divN x (c' + 1) + t := by
have s1 := divN_spec c' x
have s2 := divN_spec c' (x + (c' + 1) * t)
refine quot_unique (c' + 1) _ _ (x + (c' + 1) * t) s2.1 s2.2 ?_ ?_
· rw [mul_add']; exact Nat.add_le_add_right s1.1 _
· rw [Nat.add_right_comm, mul_add']; exact Nat.add_lt_add_right s1.2 _
theorem divN_mono (c' x y : Nat) (h : x <= y) : divN x (c' + 1) <= divN y (c' + 1) := by
cases Nat.lt_or_ge (divN y (c' + 1)) (divN x (c' + 1)) with
| inr r => exact r
| inl l =>
have a := (divN_spec c' x).1
have b := (divN_spec c' y).2
exact absurd (Nat.lt_of_lt_of_le b (Nat.le_trans (mul_le_l' l (c' + 1)) (Nat.le_trans a h))) (Nat.lt_irrefl y)
/-- Integers as pairs: (a, b) stands for a - b. -/
def zle (v w : Nat × Nat) : Prop := v.1 + w.2 <= w.1 + v.2
/-- Floor division by c' + 1. -/
def zdiv (c' : Nat) (v : Nat × Nat) : Nat × Nat := (divN (v.1 + c' * v.2) (c' + 1), v.2)
theorem zle_refl (v : Nat × Nat) : zle v v := Nat.le_refl _
theorem zle_trans (u v w : Nat × Nat) (h1 : zle u v) (h2 : zle v w) : zle u w := by
have s := Nat.add_le_add h1 h2
have e1 : (u.1 + v.2) + (v.1 + w.2) = (u.1 + w.2) + (v.2 + v.1) := by
rw [Nat.add_comm v.1 w.2, Found.Pnp93.add4]
have e2 : (v.1 + u.2) + (w.1 + v.2) = (w.1 + u.2) + (v.2 + v.1) := by
rw [Nat.add_comm v.1 u.2, Found.Pnp93.add4, Nat.add_comm u.2 w.1, Nat.add_comm v.2 v.1, Nat.add_comm v.1 v.2]
rw [e1, e2] at s
exact add_cancel_r' _ s
theorem zdiv_low (c' : Nat) (v : Nat × Nat) :
(c' + 1) * (zdiv c' v).1 + v.2 <= v.1 + (c' + 1) * v.2 := by
have s := (divN_spec c' (v.1 + c' * v.2)).1
have e : v.1 + (c' + 1) * v.2 = v.1 + c' * v.2 + v.2 := by rw [add_mul', Nat.one_mul, Nat.add_assoc]
rw [e]
exact Nat.add_le_add_right s _
theorem zdiv_high (c' : Nat) (v : Nat × Nat) :
v.1 + (c' + 1) * v.2 < (c' + 1) * ((zdiv c' v).1 + 1) + v.2 := by
have s := (divN_spec c' (v.1 + c' * v.2)).2
have e : v.1 + (c' + 1) * v.2 = v.1 + c' * v.2 + v.2 := by rw [add_mul', Nat.one_mul, Nat.add_assoc]
rw [e]
exact Nat.add_lt_add_right s _
theorem zdiv_mono (c' : Nat) (v w : Nat × Nat) (h : zle v w) : zle (zdiv c' v) (zdiv c' w) := by
show divN (v.1 + c' * v.2) (c' + 1) + w.2 <= divN (w.1 + c' * w.2) (c' + 1) + v.2
rw [<- divN_shift c' (v.1 + c' * v.2) w.2, <- divN_shift c' (w.1 + c' * w.2) v.2]
apply divN_mono
-- v1 + c' v2 + (c'+1) w2 <= w1 + c' w2 + (c'+1) v2
have e1 : v.1 + c' * v.2 + (c' + 1) * w.2 = (v.1 + w.2) + c' * (v.2 + w.2) := by
rw [add_mul', Nat.one_mul, mul_add', Nat.add_comm (c' * w.2) w.2]
exact Found.Pnp93.add4 _ _ _ _
have e2 : w.1 + c' * w.2 + (c' + 1) * v.2 = (w.1 + v.2) + c' * (v.2 + w.2) := by
rw [add_mul', Nat.one_mul, mul_add', Nat.add_comm (c' * v.2) v.2, Found.Pnp93.add4, Nat.add_comm (c' * w.2) (c' * v.2)]
rw [e1, e2]
exact Nat.add_le_add_right h _
end Found.Pnp105
#print axioms Found.Pnp105.lt_add_succ
#print axioms Found.Pnp105.divN_spec
#print axioms Found.Pnp105.quot_unique
#print axioms Found.Pnp105.divN_shift
#print axioms Found.Pnp105.divN_mono
#print axioms Found.Pnp105.zle_refl
#print axioms Found.Pnp105.zle_trans
#print axioms Found.Pnp105.zdiv_low
#print axioms Found.Pnp105.zdiv_high
#print axioms Found.Pnp105.zdiv_mono
lean_all/found/Pnp106.lean
/-
T330 piece 106. found/Pnp106 -- a checker for rearranged sums (tool for the cutting planes
interpolant; proof complexity ladder, step 2).
The arithmetic of the interpolant adds several inequalities and rearranges sums of up to a
dozen atoms. sL env [i1, ..., ik] is env i1 + (env i2 + ... + env ik), definitionally the
right-nested sum, so a hypothesis written right-nested is already of this form. Two index
lists with the same count of every index have equal sums; the counts are compared by a Bool
function evaluated by rfl on concrete lists. Proved:
* sL_cons, sL_app: the sum of a cons and of an append;
* sumI_point: a bounded sum of an indicator picks one value;
* sL_counts: a sum is the bounded sum of counts times values;
* sL_perm: lists with the same counts (checked by sameC) have the same sum.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp105
namespace Found.Pnp106
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp97 (sumI_add sumI_ext sumI_zero zero_mul')
open Found.Pnp98 (add_mul')
open Found.Pnp90 (allI allI_true)
def sL (env : Nat -> Nat) : List Nat -> Nat
| [] => 0
| [i] => env i
| i :: j :: l => env i + sL env (j :: l)
def cnt (k : Nat) : List Nat -> Nat
| [] => 0
| i :: l => bv (Nat.beq i k) + cnt k l
def allLtB (K : Nat) : List Nat -> Bool
| [] => true
| i :: l => Nat.blt i K && allLtB K l
def sameC (K : Nat) (l1 l2 : List Nat) : Bool := allI (fun k => Nat.beq (cnt k l1) (cnt k l2)) K
theorem sL_cons (env : Nat -> Nat) (i : Nat) : forall l, sL env (i :: l) = env i + sL env l
| [] => rfl
| _ :: _ => rfl
theorem sL_app (env : Nat -> Nat) (l2 : List Nat) : forall l1, sL env (l1 ++ l2) = sL env l1 + sL env l2
| [] => (Nat.zero_add _).symm
| i :: l1 => by
show sL env (i :: (l1 ++ l2)) = sL env (i :: l1) + sL env l2
rw [sL_cons, sL_cons, sL_app env l2 l1, Nat.add_assoc]
theorem sumI_point (f : Nat -> Nat) (i : Nat) : forall K, i < K -> sumI (fun k => bv (Nat.beq i k) * f k) K = f i
| 0, h => absurd h (Nat.not_lt_zero i)
| K + 1, h => by
show sumI (fun k => bv (Nat.beq i k) * f k) K + bv (Nat.beq i K) * f K = f i
cases Nat.lt_or_ge i K with
| inl l =>
rw [sumI_point f i K l, Found.Pnp2.beq_false_of_ne i K (fun e => by rw [e] at l; exact Nat.lt_irrefl K l)]
show f i + 0 * f K = f i
rw [zero_mul']
rfl
| inr r =>
have e : i = K := Nat.le_antisymm (Nat.le_of_lt_succ h) r
rw [e, Found.Pnp62.beq_refl]
have z : sumI (fun k => bv (Nat.beq K k) * f k) K = 0 := by
have t : forall k', k' <= K -> sumI (fun k => bv (Nat.beq K k) * f k) k' = 0 := by
intro k'
induction k' with
| zero => intro _; rfl
| succ k' ih =>
intro hk
show sumI _ k' + bv (Nat.beq K k') * f k' = 0
rw [ih (Nat.le_of_succ_le hk), Found.Pnp2.beq_false_of_ne K k' (fun x => by rw [x] at hk; exact Nat.lt_irrefl k' hk)]
show 0 + 0 * f k' = 0
rw [zero_mul']
exact t K (Nat.le_refl K)
rw [z]
show 0 + 1 * f K = f K
rw [Nat.one_mul, Nat.zero_add]
theorem allLt_head {K i : Nat} {l : List Nat} (h : allLtB K (i :: l) = true) : i < K :=
Found.Pnp90.blt_lt i K (Found.Pnp62.and_l h)
theorem allLt_tail {K i : Nat} {l : List Nat} (h : allLtB K (i :: l) = true) : allLtB K l = true :=
Found.Pnp62.and_r h
theorem sL_counts (env : Nat -> Nat) (K : Nat) : forall l, allLtB K l = true -> sL env l = sumI (fun k => cnt k l * env k) K
| [], _ => by
show 0 = sumI (fun k => 0 * env k) K
rw [sumI_ext _ (fun _ => 0) (fun k => zero_mul' _) K, sumI_zero]
| i :: l, h => by
rw [sL_cons, sL_counts env K l (allLt_tail h)]
show env i + sumI (fun k => cnt k l * env k) K = sumI (fun k => (bv (Nat.beq i k) + cnt k l) * env k) K
rw [sumI_ext _ (fun k => bv (Nat.beq i k) * env k + cnt k l * env k) (fun k => add_mul' _ _ _) K, sumI_add,
sumI_point env i K (allLt_head h)]
theorem sumI_ext_lt (f g : Nat -> Nat) : forall K, (forall k, k < K -> f k = g k) -> sumI f K = sumI g K
| 0, _ => rfl
| K + 1, h => by
show sumI f K + f K = sumI g K + g K
rw [sumI_ext_lt f g K (fun k hk => h k (Nat.lt_succ_of_lt hk)), h K (Nat.lt_succ_self K)]
theorem sL_perm (env : Nat -> Nat) (K : Nat) (l1 l2 : List Nat) (h1 : allLtB K l1 = true) (h2 : allLtB K l2 = true)
(hc : sameC K l1 l2 = true) : sL env l1 = sL env l2 := by
rw [sL_counts env K l1 h1, sL_counts env K l2 h2]
refine sumI_ext_lt _ _ K ?_
intro k hk
show cnt k l1 * env k = cnt k l2 * env k
rw [Found.Pnp2.beq_eq _ _ (allI_true _ K hc k hk)]
/-- A test: x + (y + z) + (u + v) = v + (z + (x + (u + y))). -/
theorem sL_test (x y z u v : Nat) : (x + (y + z)) + (u + v) = v + (z + (x + (u + y))) := by
have e := sL_perm (Found.Pnp102.nth0 [x, y, z, u, v]) 5 ([0, 1, 2] ++ [3, 4]) [4, 2, 0, 3, 1] rfl rfl rfl
rw [sL_app] at e
exact e
end Found.Pnp106
#print axioms Found.Pnp106.sL_cons
#print axioms Found.Pnp106.sL_app
#print axioms Found.Pnp106.sumI_point
#print axioms Found.Pnp106.allLt_head
#print axioms Found.Pnp106.allLt_tail
#print axioms Found.Pnp106.sL_counts
#print axioms Found.Pnp106.sumI_ext_lt
#print axioms Found.Pnp106.sL_perm
#print axioms Found.Pnp106.sL_test
lean_all/found/Pnp107.lean
/-
T330 piece 107. found/Pnp107 -- partial values of lines and the arithmetic of the division
step of the interpolant (proof complexity ladder, step 2: cutting planes; Pudlak 1997).
vS m S l a is the part of the value of the coefficient list l on the variables selected by
S. The interpolant splits each line into the part on the private variables of A (S = Q) and
the rest. Proved:
* vS_add, vS_mul, vS_nil, vS_unit_le, vS_unit_zero, val_split: partial values;
* coef_vS: the coefficient identity of a division step holds on every part;
* coreA, divA: the A-side invariant survives floor division of the interpolant;
* coreB, divB: the B-side invariant survives it, with the rounded constant.
Sums are rearranged with Pnp106.sL_perm. Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp106
namespace Found.Pnp107
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp97 (sumI_add sumI_ext sumI_zero zero_mul')
open Found.Pnp98 (mul_add' add_mul' mul_le_r)
open Found.Pnp99 (add_cancel_r' mul_le_l' mul_assoc')
open Found.Pnp101 (add_cancel_l')
open Found.Pnp102 (nth0 addL mulL unitL val nth0_addL nth0_mulL nth0_unit mul_sumI sumI_le_one)
open Found.Pnp106 (sL sL_app sL_cons sL_perm)
def vS (m : Nat) (S : Nat -> Bool) (l : List Nat) (a : Nat -> Bool) : Nat :=
sumI (fun i => bv (S i) * (nth0 l i * bv (a i))) m
theorem vS_add (m : Nat) (S : Nat -> Bool) (l l' : List Nat) (a : Nat -> Bool) :
vS m S (addL l l') a = vS m S l a + vS m S l' a := by
show sumI _ m = sumI _ m + sumI _ m
rw [<- sumI_add]
refine sumI_ext _ _ ?_ m
intro i
show bv (S i) * (nth0 (addL l l') i * bv (a i)) = bv (S i) * (nth0 l i * bv (a i)) + bv (S i) * (nth0 l' i * bv (a i))
rw [nth0_addL, add_mul', mul_add']
theorem vS_mul (m : Nat) (S : Nat -> Bool) (k : Nat) (l : List Nat) (a : Nat -> Bool) :
vS m S (mulL k l) a = k * vS m S l a := by
show sumI _ m = k * sumI _ m
rw [mul_sumI]
refine sumI_ext _ _ ?_ m
intro i
show bv (S i) * (nth0 (mulL k l) i * bv (a i)) = k * (bv (S i) * (nth0 l i * bv (a i)))
rw [nth0_mulL, mul_assoc', <- mul_assoc', Nat.mul_comm (bv (S i)) k, mul_assoc']
theorem vS_nil (m : Nat) (S : Nat -> Bool) (a : Nat -> Bool) : vS m S [] a = 0 := by
show sumI (fun i => bv (S i) * (0 * bv (a i))) m = 0
rw [sumI_ext _ (fun _ => 0) (fun i => by rw [zero_mul']; rfl) m]
exact sumI_zero m
theorem bv_le1 (b : Bool) : bv b <= 1 := by cases b <;> first | exact Nat.zero_le 1 | exact Nat.le_refl 1
theorem bv_mul_le1 (x y : Bool) : bv x * bv y <= 1 := by
cases x
· show 0 * bv y <= 1
rw [zero_mul']; exact Nat.zero_le 1
· show 1 * bv y <= 1
rw [Nat.one_mul]; exact bv_le1 y
theorem vS_unit_le (m : Nat) (S : Nat -> Bool) (i : Nat) (a : Nat -> Bool) : vS m S (unitL i) a <= 1 := by
refine sumI_le_one _ i ?_ ?_ m
· show bv (S i) * (nth0 (unitL i) i * bv (a i)) <= 1
rw [nth0_unit, Found.Pnp62.beq_refl]
show bv (S i) * (1 * bv (a i)) <= 1
rw [Nat.one_mul]
exact bv_mul_le1 _ _
· intro j hj
show bv (S j) * (nth0 (unitL i) j * bv (a j)) = 0
rw [nth0_unit, hj]
show bv (S j) * (0 * bv (a j)) = 0
rw [zero_mul']
rfl
theorem vS_unit_zero (m : Nat) (S : Nat -> Bool) (i : Nat) (a : Nat -> Bool) (hS : S i = false) :
vS m S (unitL i) a = 0 := by
show sumI _ m = 0
rw [sumI_ext _ (fun _ => 0) ?_ m]
· exact sumI_zero m
· intro j
show bv (S j) * (nth0 (unitL i) j * bv (a j)) = 0
rw [nth0_unit]
cases e : Nat.beq j i with
| false => show bv (S j) * (0 * bv (a j)) = 0; rw [zero_mul']; rfl
| true =>
rw [Found.Pnp2.beq_eq j i e, hS]
exact zero_mul' _
theorem val_split (m : Nat) (S : Nat -> Bool) (l : List Nat) (a : Nat -> Bool) :
val m l a = vS m S l a + vS m (fun i => !(S i)) l a := by
show sumI _ m = sumI _ m + sumI _ m
rw [<- sumI_add]
refine sumI_ext _ _ ?_ m
intro i
show nth0 l i * bv (a i) = bv (S i) * (nth0 l i * bv (a i)) + bv (!(S i)) * (nth0 l i * bv (a i))
cases S i
· show nth0 l i * bv (a i) = 0 * (nth0 l i * bv (a i)) + 1 * (nth0 l i * bv (a i))
rw [zero_mul', Nat.one_mul, Nat.zero_add]
· show nth0 l i * bv (a i) = 1 * (nth0 l i * bv (a i)) + 0 * (nth0 l i * bv (a i))
rw [zero_mul', Nat.one_mul]; rfl
theorem coef_vS (m c : Nat) (S : Nat -> Bool) (AP AN BP BN : List Nat) (a : Nat -> Bool)
(h : forall i, nth0 AP i + c * nth0 BN i = nth0 AN i + c * nth0 BP i) :
vS m S AP a + c * vS m S BN a = vS m S AN a + c * vS m S BP a := by
rw [<- vS_mul, <- vS_mul, <- vS_add, <- vS_add]
refine sumI_ext _ _ ?_ m
intro i
show bv (S i) * (nth0 (addL AP (mulL c BN)) i * bv (a i)) = bv (S i) * (nth0 (addL AN (mulL c BP)) i * bv (a i))
rw [nth0_addL, nth0_addL, nth0_mulL, nth0_mulL, h i]
theorem coreA (x y U V E1 E2 Qc F : Nat) (t1 : x + Qc <= y + F) (ia : V + E2 <= U + E1) (cv : U + y = V + x)
(zh : E1 + F < Qc + E2) : False := by
have s := Nat.add_le_add t1 ia
let env := nth0 [x, Qc, V, E2, y, F, U, E1]
have p1 : sL env ([0, 1] ++ [2, 3]) = sL env ([2, 0] ++ [1, 3]) := sL_perm env 8 _ _ rfl rfl rfl
have p2 : sL env ([4, 5] ++ [6, 7]) = sL env ([6, 4] ++ [7, 5]) := sL_perm env 8 _ _ rfl rfl rfl
rw [sL_app, sL_app] at p1
rw [sL_app, sL_app] at p2
have s2 : (V + x) + (Qc + E2) <= (U + y) + (E1 + F) :=
Nat.le_trans (Nat.le_of_eq p1.symm) (Nat.le_trans s (Nat.le_of_eq p2))
rw [cv] at s2
exact absurd (Nat.lt_of_lt_of_le zh (add_cancel_l' s2)) (Nat.lt_irrefl _)
/-- A side of the division step. -/
theorem divA (c' X Y U V E1 E2 q : Nat) (cv : U + (c' + 1) * Y = V + (c' + 1) * X) (ia : V + E2 <= U + E1)
(zh : E1 + (c' + 1) * E2 < (c' + 1) * (q + 1) + E2) : Y + E2 <= X + q := by
cases Nat.lt_or_ge (X + q) (Y + E2) with
| inr r => exact r
| inl l =>
have t1 : (c' + 1) * X + (c' + 1) * (q + 1) <= (c' + 1) * Y + (c' + 1) * E2 := by
rw [<- mul_add', <- mul_add']
exact mul_le_l' l (c' + 1)
exact (coreA _ _ U V E1 E2 _ _ t1 ia cv zh).elim
theorem coreB (x y D F Q G c U V e d E1 E2 : Nat) (H1 : x + (D + (F + c)) <= y + (G + Q)) (zl : Q + E2 <= E1 + F)
(cst : G + (d + 1) <= D + (e + c)) (ib : V + (e + E1) <= U + (d + E2)) (cv : U + y = V + x) : False := by
have s := Nat.add_le_add (Nat.add_le_add (Nat.add_le_add H1 zl) cst) ib
let env := nth0 [x, y, D, F, Q, G, c, U, V, e, d, E1, E2, 1]
have p1 : sL env ((([0, 2, 3, 6] ++ [4, 12]) ++ [5, 10, 13]) ++ [8, 9, 11]) =
sL env ([8, 0] ++ [13, 2, 3, 6, 4, 12, 5, 10, 9, 11]) := sL_perm env 14 _ _ rfl rfl rfl
have p2 : sL env ((([1, 5, 4] ++ [11, 3]) ++ [2, 9, 6]) ++ [7, 10, 12]) =
sL env ([7, 1] ++ [2, 3, 6, 4, 12, 5, 10, 9, 11]) := sL_perm env 14 _ _ rfl rfl rfl
rw [sL_app, sL_app, sL_app, sL_app] at p1
rw [sL_app, sL_app, sL_app, sL_app] at p2
have s2 : (V + x) + sL env [13, 2, 3, 6, 4, 12, 5, 10, 9, 11] <= (U + y) + sL env [2, 3, 6, 4, 12, 5, 10, 9, 11] :=
Nat.le_trans (Nat.le_of_eq p1.symm) (Nat.le_trans s (Nat.le_of_eq p2))
rw [cv, sL_cons] at s2
have s3 := add_cancel_l' s2
have s4 : sL env [2, 3, 6, 4, 12, 5, 10, 9, 11] + 1 <= sL env [2, 3, 6, 4, 12, 5, 10, 9, 11] + 0 := by
rw [Nat.add_comm _ 1]; exact s3
exact Nat.not_succ_le_self _ s4
/-- B side of the division step. -/
theorem divB (c' X Y U V E1 E2 q d e d' e' : Nat) (cv : U + (c' + 1) * Y = V + (c' + 1) * X)
(ib : V + e + E1 <= U + d + E2) (cst : (c' + 1) * e' + d + 1 <= (c' + 1) * d' + e + (c' + 1))
(zl : (c' + 1) * q + E2 <= E1 + (c' + 1) * E2) : Y + e' + q <= X + d' + E2 := by
cases Nat.lt_or_ge (X + d' + E2) (Y + e' + q) with
| inr r => exact r
| inl l =>
have l' : X + (d' + (E2 + 1)) <= Y + (e' + q) := by
rw [<- Nat.add_assoc, <- Nat.add_assoc, <- Nat.add_assoc]; exact l
have t1 := mul_le_l' l' (c' + 1)
rw [mul_add', mul_add', mul_add', Nat.mul_one, mul_add', mul_add'] at t1
rw [Nat.add_assoc] at ib
rw [Nat.add_assoc] at ib
rw [Nat.add_assoc, Nat.add_assoc] at cst
exact (coreB _ _ _ _ _ _ _ U V e d E1 E2 t1 zl cst ib cv).elim
end Found.Pnp107
#print axioms Found.Pnp107.vS_add
#print axioms Found.Pnp107.vS_mul
#print axioms Found.Pnp107.vS_nil
#print axioms Found.Pnp107.bv_le1
#print axioms Found.Pnp107.bv_mul_le1
#print axioms Found.Pnp107.vS_unit_le
#print axioms Found.Pnp107.vS_unit_zero
#print axioms Found.Pnp107.val_split
#print axioms Found.Pnp107.coef_vS
#print axioms Found.Pnp107.coreA
#print axioms Found.Pnp107.divA
#print axioms Found.Pnp107.coreB
#print axioms Found.Pnp107.divB
lean_all/found/Pnp108.lean
/-
T330 piece 108. found/Pnp108 -- the interpolant of a cutting planes refutation (proof
complexity ladder, step 2: cutting planes; Pudlak 1997).
The axioms are split into A-lines (isA = true; their N side vanishes off the private A
variables Q and their P side vanishes on the private B variables R) and B-lines (both sides
vanish on Q). For a fixed assignment ap of the shared variables, interp p ap is an integer
(a pair) per line of the proof p:
A-axiom: (P part off Q at ap) + d - e; B-axiom, x >= 0: 0; x <= 1: 1 if x in Q, else 0;
sum, multiple: sum, multiple; division by c: floor division by c.
Invariants, for every assignment a that agrees with ap on the shared variables:
IA: if a satisfies A then N_Q(a) + E2 <= P_Q(a) + E1 (the Q part >= -E),
IB: if a satisfies B then N_O(a) + e + E1 <= P_O(a) + d + E2 (the rest >= D + E).
At the final line 0 >= 1 this gives: A satisfiable at ap -> E >= 0, and B satisfiable at
ap -> E < 0. Proved:
* vS_zero, vS_agree: parts with zero coefficients, parts on agreeing assignments;
* interp_inv: both invariants for every line;
* interp_A, interp_B: the two conclusions at the final line.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp107
namespace Found.Pnp108
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp97 (sumI_ext sumI_zero zero_mul')
open Found.Pnp98 (mul_add')
open Found.Pnp99 (mul_le_l')
open Found.Pnp102 (nth0 unitL Line val Holds DivOK CPProof falseLine)
open Found.Pnp105 (zdiv zdiv_low zdiv_high)
open Found.Pnp106 (sL sL_app sL_perm)
open Found.Pnp107 (vS vS_add vS_mul vS_nil vS_unit_le vS_unit_zero val_split coef_vS divA divB)
open Found.Pnp93 (add4)
def selP (b : Bool) (x y : Nat × Nat) : Nat × Nat := match b with | true => x | false => y
def nQ (Q : Nat -> Bool) (i : Nat) : Bool := !(Q i)
/-- The interpolant. -/
def interp (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) (ap : Nat -> Bool) :
{L : Line} -> CPProof m F L -> Nat × Nat
| _, .ax L _ => selP (isA L) (vS m (nQ Q) L.P ap + L.d, L.e) (0, 0)
| _, .nonneg _ => (0, 0)
| _, .le1 i => selP (Q i) (1, 0) (0, 0)
| _, .add _ _ p q => ((interp m F Q isA ap p).1 + (interp m F Q isA ap q).1,
(interp m F Q isA ap p).2 + (interp m F Q isA ap q).2)
| _, .mul k _ p => (k * (interp m F Q isA ap p).1, k * (interp m F Q isA ap p).2)
| _, .div c _ _ p _ => zdiv (c - 1) (interp m F Q isA ap p)
theorem vS_zero (m : Nat) (S : Nat -> Bool) (l : List Nat) (a : Nat -> Bool) (h : forall i, S i = true -> nth0 l i = 0) :
vS m S l a = 0 := by
show sumI _ m = 0
rw [sumI_ext _ (fun _ => 0) ?_ m]
· exact sumI_zero m
· intro i
show bv (S i) * (nth0 l i * bv (a i)) = 0
cases e : S i with
| false => exact zero_mul' _
| true => rw [h i e, zero_mul']; rfl
theorem vS_agree (m : Nat) (S : Nat -> Bool) (l : List Nat) (a a' : Nat -> Bool)
(h : forall i, i < m -> S i = true -> nth0 l i = 0 \/ a i = a' i) : vS m S l a = vS m S l a' := by
refine Found.Pnp106.sumI_ext_lt _ _ m ?_
intro i hi
show bv (S i) * (nth0 l i * bv (a i)) = bv (S i) * (nth0 l i * bv (a' i))
cases e : S i with
| false =>
show 0 * (nth0 l i * bv (a i)) = 0 * (nth0 l i * bv (a' i))
rw [zero_mul', zero_mul']
| true =>
cases h i hi e with
| inl z => rw [z, zero_mul', zero_mul']
| inr q => rw [q]
/-- Conditions on the split of the axioms. -/
structure Split (m : Nat) (F : List Line) (Q R : Nat -> Bool) (isA : Line -> Bool) (SatA SatB : (Nat -> Bool) -> Prop) : Prop where
holdA : forall L, L ∈ F -> isA L = true -> forall a, SatA a -> Holds m a L
nA : forall L, L ∈ F -> isA L = true -> forall i, Q i = false -> nth0 L.N i = 0
pA : forall L, L ∈ F -> isA L = true -> forall i, R i = true -> nth0 L.P i = 0
holdB : forall L, L ∈ F -> isA L = false -> forall a, SatB a -> Holds m a L
qB : forall L, L ∈ F -> isA L = false -> forall i, Q i = true -> nth0 L.P i = 0 /\ nth0 L.N i = 0
/-- a agrees with ap on the shared variables. -/
def Agree (m : Nat) (Q R : Nat -> Bool) (a ap : Nat -> Bool) : Prop :=
forall i, i < m -> Q i = false -> R i = false -> a i = ap i
def IA (m : Nat) (Q : Nat -> Bool) (L : Line) (E : Nat × Nat) (a : Nat -> Bool) : Prop :=
vS m Q L.N a + E.2 <= vS m Q L.P a + E.1
def IB (m : Nat) (Q : Nat -> Bool) (L : Line) (E : Nat × Nat) (a : Nat -> Bool) : Prop :=
vS m (nQ Q) L.N a + L.e + E.1 <= vS m (nQ Q) L.P a + L.d + E.2
theorem pred_succ' : forall c : Nat, 1 <= c -> c - 1 + 1 = c
| 0, h => absurd h (Nat.not_succ_le_zero 0)
| _ + 1, _ => rfl
theorem interp_inv (m : Nat) (F : List Line) (Q R : Nat -> Bool) (isA : Line -> Bool) (SatA SatB : (Nat -> Bool) -> Prop)
(hs : Split m F Q R isA SatA SatB) (ap : Nat -> Bool) (a : Nat -> Bool) (hag : Agree m Q R a ap) :
forall (L : Line) (p : CPProof m F L),
(SatA a -> IA m Q L (interp m F Q isA ap p) a) /\ (SatB a -> IB m Q L (interp m F Q isA ap p) a) := by
intro L p
induction p with
| ax L h =>
cases eA : isA L with
| true =>
have ei : interp m F Q isA ap (CPProof.ax L h) = (vS m (nQ Q) L.P ap + L.d, L.e) := by
show selP (isA L) _ _ = _
rw [eA]; rfl
rw [ei]
have nz : vS m (nQ Q) L.N a = 0 := vS_zero m _ _ a (fun i hi => hs.nA L h eA i (Found.Pnp91.not_true hi))
have pe : vS m (nQ Q) L.P a = vS m (nQ Q) L.P ap := vS_agree m _ _ a ap (fun i him hi => by
cases eR : R i with
| true => exact Or.inl (hs.pA L h eA i eR)
| false => exact Or.inr (hag i him (Found.Pnp91.not_true hi) eR))
refine And.intro ?_ ?_
· intro sa
have ho : val m L.N a + L.e <= val m L.P a + L.d := hs.holdA L h eA a sa
rw [val_split m Q L.N a, val_split m Q L.P a] at ho
have ho' : vS m Q L.N a + vS m (nQ Q) L.N a + L.e <= vS m Q L.P a + vS m (nQ Q) L.P a + L.d := ho
rw [nz, pe, Nat.add_zero] at ho'
show vS m Q L.N a + L.e <= vS m Q L.P a + (vS m (nQ Q) L.P ap + L.d)
rw [<- Nat.add_assoc]
exact ho'
· intro _
show vS m (nQ Q) L.N a + L.e + (vS m (nQ Q) L.P ap + L.d) <= vS m (nQ Q) L.P a + L.d + L.e
rw [nz, pe, Nat.zero_add, Nat.add_comm L.e]
try exact Nat.le_refl _
| false =>
have ei : interp m F Q isA ap (CPProof.ax L h) = (0, 0) := by
show selP (isA L) _ _ = _
rw [eA]; rfl
rw [ei]
have pz : vS m Q L.P a = 0 := vS_zero m _ _ a (fun i hi => (hs.qB L h eA i hi).1)
have nzz : vS m Q L.N a = 0 := vS_zero m _ _ a (fun i hi => (hs.qB L h eA i hi).2)
refine And.intro ?_ ?_
· intro _
show vS m Q L.N a + 0 <= vS m Q L.P a + 0
rw [pz, nzz]; exact Nat.le_refl 0
· intro sb
have ho : val m L.N a + L.e <= val m L.P a + L.d := hs.holdB L h eA a sb
rw [val_split m Q L.N a, val_split m Q L.P a, pz, nzz, Nat.zero_add, Nat.zero_add] at ho
show vS m (nQ Q) L.N a + L.e + 0 <= vS m (nQ Q) L.P a + L.d + 0
exact ho
| nonneg i =>
refine And.intro (fun _ => ?_) (fun _ => ?_)
· show vS m Q [] a + 0 <= vS m Q (unitL i) a + 0
rw [vS_nil]; exact Nat.zero_le _
· show vS m (nQ Q) [] a + 0 + 0 <= vS m (nQ Q) (unitL i) a + 0 + 0
rw [vS_nil]; exact Nat.zero_le _
| le1 i =>
cases eq : Q i with
| true =>
have ei : interp m F Q isA ap (CPProof.le1 i : CPProof m F _) = (1, 0) := by
show selP (Q i) _ _ = _
rw [eq]; rfl
rw [ei]
refine And.intro (fun _ => ?_) (fun _ => ?_)
· show vS m Q (unitL i) a + 0 <= vS m Q [] a + 1
rw [vS_nil]; exact vS_unit_le m Q i a
· show vS m (nQ Q) (unitL i) a + 0 + 1 <= vS m (nQ Q) [] a + 1 + 0
rw [vS_nil, vS_unit_zero m (nQ Q) i a (by show (!(Q i)) = false; rw [eq]; rfl)]
exact Nat.le_refl _
| false =>
have ei : interp m F Q isA ap (CPProof.le1 i : CPProof m F _) = (0, 0) := by
show selP (Q i) _ _ = _
rw [eq]; rfl
rw [ei]
refine And.intro (fun _ => ?_) (fun _ => ?_)
· show vS m Q (unitL i) a + 0 <= vS m Q [] a + 0
rw [vS_nil, vS_unit_zero m Q i a eq]; exact Nat.le_refl _
· show vS m (nQ Q) (unitL i) a + 0 + 0 <= vS m (nQ Q) [] a + 1 + 0
rw [vS_nil]; exact vS_unit_le m (nQ Q) i a
| add A B p q ihp ihq =>
refine And.intro (fun sa => ?_) (fun sb => ?_)
· have h1 := ihp.1 sa
have h2 := ihq.1 sa
show vS m Q (Found.Pnp102.addL A.N B.N) a + ((interp m F Q isA ap p).2 + (interp m F Q isA ap q).2) <=
vS m Q (Found.Pnp102.addL A.P B.P) a + ((interp m F Q isA ap p).1 + (interp m F Q isA ap q).1)
rw [vS_add, vS_add, add4, add4 (vS m Q A.P a)]
exact Nat.add_le_add h1 h2
· have h1 := ihp.2 sb
have h2 := ihq.2 sb
show vS m (nQ Q) (Found.Pnp102.addL A.N B.N) a + (A.e + B.e) + ((interp m F Q isA ap p).1 + (interp m F Q isA ap q).1) <=
vS m (nQ Q) (Found.Pnp102.addL A.P B.P) a + (A.d + B.d) + ((interp m F Q isA ap p).2 + (interp m F Q isA ap q).2)
rw [vS_add, vS_add, add4 (vS m (nQ Q) A.N a), add4 (vS m (nQ Q) A.P a), add4 (vS m (nQ Q) A.N a + A.e),
add4 (vS m (nQ Q) A.P a + A.d)]
exact Nat.add_le_add h1 h2
| mul k A p ih =>
refine And.intro (fun sa => ?_) (fun sb => ?_)
· have h1 := ih.1 sa
show vS m Q (Found.Pnp102.mulL k A.N) a + k * (interp m F Q isA ap p).2 <=
vS m Q (Found.Pnp102.mulL k A.P) a + k * (interp m F Q isA ap p).1
rw [vS_mul, vS_mul, <- mul_add', <- mul_add']
exact mul_le_l' h1 k
· have h1 := ih.2 sb
show vS m (nQ Q) (Found.Pnp102.mulL k A.N) a + k * A.e + k * (interp m F Q isA ap p).1 <=
vS m (nQ Q) (Found.Pnp102.mulL k A.P) a + k * A.d + k * (interp m F Q isA ap p).2
rw [vS_mul, vS_mul, <- mul_add', <- mul_add', <- mul_add', <- mul_add']
exact mul_le_l' h1 k
| div c A B p h ih =>
cases c with
| zero => exact absurd h.pos (Nat.not_succ_le_zero 0)
| succ c' =>
refine And.intro (fun sa => ?_) (fun sb => ?_)
· have h1 := ih.1 sa
show vS m Q B.N a + (interp m F Q isA ap p).2 <= vS m Q B.P a + (zdiv c' (interp m F Q isA ap p)).1
exact divA c' _ _ _ _ _ _ _ (coef_vS m (c' + 1) Q A.P A.N B.P B.N a h.coef) h1
(zdiv_high c' (interp m F Q isA ap p))
· have h1 := ih.2 sb
show vS m (nQ Q) B.N a + B.e + (zdiv c' (interp m F Q isA ap p)).1 <= vS m (nQ Q) B.P a + B.d + (interp m F Q isA ap p).2
exact divB c' _ _ _ _ _ _ _ A.d A.e B.d B.e (coef_vS m (c' + 1) (nQ Q) A.P A.N B.P B.N a h.coef) h1 h.cst
(zdiv_low c' (interp m F Q isA ap p))
/-- A satisfiable at ap: the interpolant of a refutation is >= 0. -/
theorem interp_A (m : Nat) (F : List Line) (Q R : Nat -> Bool) (isA : Line -> Bool) (SatA SatB : (Nat -> Bool) -> Prop)
(hs : Split m F Q R isA SatA SatB) (ap : Nat -> Bool) (p : CPProof m F falseLine)
(a : Nat -> Bool) (hag : Agree m Q R a ap) (sa : SatA a) :
(interp m F Q isA ap p).2 <= (interp m F Q isA ap p).1 := by
have t := (interp_inv m F Q R isA SatA SatB hs ap a hag falseLine p).1 sa
have t' : vS m Q [] a + (interp m F Q isA ap p).2 <= vS m Q [] a + (interp m F Q isA ap p).1 := t
rw [vS_nil, Nat.zero_add, Nat.zero_add] at t'
exact t'
/-- B satisfiable at ap: the interpolant of a refutation is < 0. -/
theorem interp_B (m : Nat) (F : List Line) (Q R : Nat -> Bool) (isA : Line -> Bool) (SatA SatB : (Nat -> Bool) -> Prop)
(hs : Split m F Q R isA SatA SatB) (ap : Nat -> Bool) (p : CPProof m F falseLine)
(a : Nat -> Bool) (hag : Agree m Q R a ap) (sb : SatB a) :
(interp m F Q isA ap p).1 + 1 <= (interp m F Q isA ap p).2 := by
have t := (interp_inv m F Q R isA SatA SatB hs ap a hag falseLine p).2 sb
have t' : vS m (nQ Q) [] a + 1 + (interp m F Q isA ap p).1 <= vS m (nQ Q) [] a + 0 + (interp m F Q isA ap p).2 := t
rw [vS_nil] at t'
have e1 : (0 : Nat) + 1 + (interp m F Q isA ap p).1 = (interp m F Q isA ap p).1 + 1 := by rw [Nat.zero_add, Nat.add_comm]
have e2 : (0 : Nat) + 0 + (interp m F Q isA ap p).2 = (interp m F Q isA ap p).2 := by
rw [Nat.zero_add]; try rw [Nat.zero_add]
exact Nat.le_trans (Nat.le_of_eq e1.symm) (Nat.le_trans t' (Nat.le_of_eq e2))
end Found.Pnp108
#print axioms Found.Pnp108.vS_zero
#print axioms Found.Pnp108.vS_agree
#print axioms Found.Pnp108.pred_succ'
#print axioms Found.Pnp108.interp_inv
#print axioms Found.Pnp108.interp_A
#print axioms Found.Pnp108.interp_B
lean_all/found/Pnp109.lean
/-
T330 piece 109. found/Pnp109 -- the interpolant is monotone (proof complexity ladder, step
2: cutting planes; Pudlak 1997).
If the shared assignment grows (every true variable stays true), the interpolant of every
line does not decrease: the A-axioms give (P part off Q) + d - e, a sum of nonnegative
multiples of shared variables, and sums, multiples and floor division are monotone. So the
output "interp >= 0" is a monotone Boolean function of the shared variables; with
interp_A / interp_B (Pnp108) it is 1 where A is satisfiable and 0 where B is. Proved:
* vS_mono: the value of a part grows with the assignment;
* zadd_mono, zmul_mono: sum and multiple keep the order of pairs;
* interp_mono: the interpolant is monotone;
* out_mono: the output interp >= 0 is monotone.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp108
namespace Found.Pnp109
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp96 (sumI_le)
open Found.Pnp98 (mul_add' mul_le_r)
open Found.Pnp99 (add_cancel_r' mul_le_l')
open Found.Pnp102 (nth0 Line CPProof)
open Found.Pnp105 (zle zdiv zdiv_mono zle_refl)
open Found.Pnp107 (vS)
open Found.Pnp108 (interp selP nQ)
open Found.Pnp93 (add4)
/-- ap' is at least ap. -/
def LeA (ap ap' : Nat -> Bool) : Prop := forall i, ap i = true -> ap' i = true
theorem bv_mono (x y : Bool) (h : x = true -> y = true) : bv x <= bv y := by
cases x with
| false => exact Nat.zero_le _
| true => rw [h rfl]; exact Nat.le_refl _
theorem vS_mono (m : Nat) (S : Nat -> Bool) (l : List Nat) (a a' : Nat -> Bool) (h : LeA a a') :
vS m S l a <= vS m S l a' :=
sumI_le _ _ m (fun i _ => mul_le_l' (mul_le_l' (bv_mono _ _ (h i)) _) _)
theorem zadd_mono (u v u' v' : Nat × Nat) (h1 : zle u u') (h2 : zle v v') :
zle (u.1 + v.1, u.2 + v.2) (u'.1 + v'.1, u'.2 + v'.2) := by
show (u.1 + v.1) + (u'.2 + v'.2) <= (u'.1 + v'.1) + (u.2 + v.2)
rw [add4, add4 u'.1]
exact Nat.add_le_add h1 h2
theorem zmul_mono (k : Nat) (u u' : Nat × Nat) (h : zle u u') : zle (k * u.1, k * u.2) (k * u'.1, k * u'.2) := by
show k * u.1 + k * u'.2 <= k * u'.1 + k * u.2
rw [<- mul_add', <- mul_add']
exact mul_le_l' h k
theorem interp_mono (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) (ap ap' : Nat -> Bool)
(hle : LeA ap ap') : forall (L : Line) (p : CPProof m F L),
zle (interp m F Q isA ap p) (interp m F Q isA ap' p) := by
intro L p
induction p with
| ax L h =>
show zle (selP (isA L) (vS m (nQ Q) L.P ap + L.d, L.e) (0, 0)) (selP (isA L) (vS m (nQ Q) L.P ap' + L.d, L.e) (0, 0))
cases isA L with
| true =>
show vS m (nQ Q) L.P ap + L.d + L.e <= vS m (nQ Q) L.P ap' + L.d + L.e
exact Nat.add_le_add_right (Nat.add_le_add_right (vS_mono m _ _ ap ap' hle) _) _
| false => exact zle_refl _
| nonneg i => exact zle_refl _
| le1 i =>
show zle (selP (Q i) (1, 0) (0, 0)) (selP (Q i) (1, 0) (0, 0))
exact zle_refl _
| add A B p q ihp ihq => exact zadd_mono _ _ _ _ ihp ihq
| mul k A p ih => exact zmul_mono k _ _ ih
| div c A B p h ih =>
cases c with
| zero => exact absurd h.pos (Nat.not_succ_le_zero 0)
| succ c' => exact zdiv_mono c' _ _ ih
/-- The output: interp >= 0. -/
def out (E : Nat × Nat) : Bool := Nat.ble E.2 E.1
theorem out_mono (E E' : Nat × Nat) (h : zle E E') (ho : out E = true) : out E' = true := by
have a : E.2 <= E.1 := Nat.le_of_ble_eq_true ho
have b : E.1 + E'.2 <= E'.1 + E.2 := h
have c : E'.2 + E.1 <= E'.1 + E.1 := by
rw [Nat.add_comm E'.2]
exact Nat.le_trans b (Nat.add_le_add_left a _)
exact Nat.ble_eq_true_of_le (add_cancel_r' _ c)
end Found.Pnp109
#print axioms Found.Pnp109.bv_mono
#print axioms Found.Pnp109.vS_mono
#print axioms Found.Pnp109.zadd_mono
#print axioms Found.Pnp109.zmul_mono
#print axioms Found.Pnp109.interp_mono
#print axioms Found.Pnp109.out_mono
lean_all/found/Pnp11.lean
/-
T330 piece 11. found/Pnp11 -- Cook-Levin for local machines.
The CNF of a width-W, k-bit local machine run for T steps, with some input cells pinned
(unit clauses on the time-0 layer) and acceptance read at bit 0 of cell 0 at time T:
full = tableau (Pnp9) ++ [accept] ++ pins.
Proved: full is satisfiable iff some start (boundary false, pins respected; the other
cells are the certificate) makes the machine accept after T steps. Its size is
T W k 2^(3k) + (T + 1) k + 1 + (number of pins) clauses (Pnp9.tab_count).
Open (PNP_MAP.md): Turing machines (or the machine model OM) as local machines. It
relativizes (a tool). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp10
namespace Found.Pnp11
open Found.Pnp8
open Found.Pnp9
open Found.Pnp10
/-- Pins: (cell, bit, value) on the time-0 layer. -/
def pinCl : List (Nat × (Nat × Bool)) -> List (List (Bool × V))
| [] => []
| (j, (b, v)) :: ps => [(v, (0, (j, b)))] :: pinCl ps
def PinsOK (c0 : Conf) : List (Nat × (Nat × Bool)) -> Prop
| [] => True
| (j, (b, v)) :: ps => c0 j b = v /\ PinsOK c0 ps
def accCl (T : Nat) : List (Bool × V) := [(true, (T, (0, 0)))]
def full (delta : List Bool -> Nat -> Bool) (k W T : Nat) (ps : List (Nat × (Nat × Bool))) :
List (List (Bool × V)) :=
tab delta k W T ++ (accCl T :: pinCl ps)
theorem unit_clause (s : V -> Bool) (v : Bool) (x : V) :
(clv s [(v, x)] = true -> s x = v) /\ (s x = v -> clv s [(v, x)] = true) := by
apply And.intro
· intro h
have h' : (pol v (s x) || false) = true := h
rw [or_false_eq] at h'
exact pol_eq _ _ h'
· intro h
show (pol v (s x) || false) = true
rw [h, pol_self]
rfl
theorem pins_iff (s : V -> Bool) : forall ps : List (Nat × (Nat × Bool)),
(cnfv s (pinCl ps) = true -> PinsOK (sl s 0) ps) /\
(PinsOK (sl s 0) ps -> cnfv s (pinCl ps) = true) := by
intro ps
induction ps with
| nil => exact And.intro (fun _ => True.intro) (fun _ => rfl)
| cons e ps ih =>
cases e with
| mk j bv =>
cases bv with
| mk b v =>
apply And.intro
· intro h
have h' : (clv s [(v, (0, (j, b)))] && cnfv s (pinCl ps)) = true := h
exact And.intro ((unit_clause s v _).1 (and_l h')) (ih.1 (and_r h'))
· intro h
show (clv s [(v, (0, (j, b)))] && cnfv s (pinCl ps)) = true
rw [(unit_clause s v _).2 h.1, ih.2 h.2]
rfl
theorem pins_run (delta : List Bool -> Nat -> Bool) (k W : Nat) (c0 : Conf) :
forall ps, PinsOK c0 ps -> PinsOK (sl (ofRun delta k W c0) 0) ps := by
intro ps h
exact h
/-- Cook-Levin for local machines: the CNF is satisfiable iff some certificate makes the
machine accept. -/
theorem cook_levin_local (delta : List Bool -> Nat -> Bool) (k W T : Nat) (hk : 0 < k)
(ps : List (Nat × (Nat × Bool))) :
((Exists fun s : V -> Bool => cnfv s (full delta k W T ps) = true) ->
Exists fun c0 : Conf => (forall b, b < k -> c0 W b = false) /\ PinsOK c0 ps /\
runW delta k W T c0 0 0 = true) /\
((Exists fun c0 : Conf => (forall b, b < k -> c0 W b = false) /\ PinsOK c0 ps /\
runW delta k W T c0 0 0 = true) ->
Exists fun s : V -> Bool => cnfv s (full delta k W T ps) = true) := by
apply And.intro
· intro h
exact Exists.elim h fun s hs => by
have h1 : (cnfv s (tab delta k W T) && (clv s (accCl T) && cnfv s (pinCl ps))) = true :=
(cnfv_append s _ _).symm.trans hs
have htab := (tab_iff s delta k W T).1 (and_l h1)
have hacc : s (T, (0, 0)) = true := (unit_clause s true _).1 (and_l (and_r h1))
have hpin := (pins_iff s ps).1 (and_r (and_r h1))
exact Exists.intro (sl s 0) (And.intro (fun b hb => htab.2 0 (Nat.zero_lt_succ T) b hb)
(And.intro hpin ((sat_is_run s delta k W T htab.1 htab.2 T (Nat.lt_succ_self T) 0
(Nat.zero_lt_succ W) 0 hk).symm.trans hacc)))
· intro h
exact Exists.elim h fun c0 hc => by
apply Exists.intro (ofRun delta k W c0)
show cnfv (ofRun delta k W c0) (tab delta k W T ++ (accCl T :: pinCl ps)) = true
rw [cnfv_append]
exact and_tt ((tab_iff _ delta k W T).2
(And.intro (run_steps delta k W T c0) (run_bound delta k W T c0 hc.1)))
(and_tt ((unit_clause _ true _).2 hc.2.2) ((pins_iff _ ps).2 hc.2.1))
end Found.Pnp11
#print axioms Found.Pnp11.unit_clause
#print axioms Found.Pnp11.pins_iff
#print axioms Found.Pnp11.pins_run
#print axioms Found.Pnp11.cook_levin_local
lean_all/found/Pnp110.lean
/-
T330 piece 110. found/Pnp110 -- the coefficients of clause lines, and the test that sorts
axiom lines into A-lines and B-lines (proof complexity ladder, step 2: cutting planes).
The coefficient of x_i in the P side of the line of a clause C is the number of literals
(true, i) in C, and in the N side the number of literals (false, i). isAt M Q R L checks below
M that the P side vanishes on R and the N side vanishes off Q. Proved:
* coefP, coefN: the coefficients are the literal counts posC, negC;
* posC_zero, negC_zero: no such literal, coefficient 0;
* posC_pos, negC_pos: a literal present, coefficient >= 1;
* posC_big, negC_big: coefficients vanish at and above the variable bound;
* isAt_P, isAt_N: what isAt = true gives at every index;
* isAt_falseP, isAt_falseN: a witness index makes isAt false.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp109
namespace Found.Pnp110
open Found.RootComp (Lit Clause)
open Found.Pnp65 (bv)
open Found.Pnp90 (allI allI_true)
open Found.Pnp102 (nth0 addL unitL Line nth0_addL nth0_unit)
open Found.Pnp103 (lineOf VarsBelow)
def posC (i : Nat) : Clause -> Nat
| [] => 0
| (true, v) :: C => bv (Nat.beq i v) + posC i C
| (false, _) :: C => posC i C
def negC (i : Nat) : Clause -> Nat
| [] => 0
| (true, _) :: C => negC i C
| (false, v) :: C => bv (Nat.beq i v) + negC i C
theorem coefP (i : Nat) : forall C : Clause, nth0 (lineOf C).P i = posC i C
| [] => rfl
| (true, v) :: C => by
show nth0 (addL (unitL v) (lineOf C).P) i = bv (Nat.beq i v) + posC i C
rw [nth0_addL, nth0_unit, coefP i C]
| (false, _) :: C => coefP i C
theorem coefN (i : Nat) : forall C : Clause, nth0 (lineOf C).N i = negC i C
| [] => rfl
| (true, _) :: C => coefN i C
| (false, v) :: C => by
show nth0 (addL (unitL v) (lineOf C).N) i = bv (Nat.beq i v) + negC i C
rw [nth0_addL, nth0_unit, coefN i C]
theorem posC_zero (i : Nat) : forall C : Clause, (forall l, l ∈ C -> l.1 = true -> Nat.beq i l.2 = false) -> posC i C = 0
| [], _ => rfl
| (true, v) :: C, h => by
show bv (Nat.beq i v) + posC i C = 0
rw [h (true, v) (List.Mem.head _) rfl, posC_zero i C (fun l hl => h l (List.Mem.tail _ hl))]
rfl
| (false, _) :: C, h => posC_zero i C (fun l hl => h l (List.Mem.tail _ hl))
theorem negC_zero (i : Nat) : forall C : Clause, (forall l, l ∈ C -> l.1 = false -> Nat.beq i l.2 = false) -> negC i C = 0
| [], _ => rfl
| (true, _) :: C, h => negC_zero i C (fun l hl => h l (List.Mem.tail _ hl))
| (false, v) :: C, h => by
show bv (Nat.beq i v) + negC i C = 0
rw [h (false, v) (List.Mem.head _) rfl, negC_zero i C (fun l hl => h l (List.Mem.tail _ hl))]
rfl
theorem posC_pos (i : Nat) : forall C : Clause, (true, i) ∈ C -> 1 <= posC i C
| [], h => by cases h
| (true, v) :: C, h => by
show 1 <= bv (Nat.beq i v) + posC i C
cases h with
| head => rw [Found.Pnp62.beq_refl]; exact Nat.le_add_right 1 _
| tail _ h' => exact Nat.le_trans (posC_pos i C h') (Nat.le_add_left _ _)
| (false, v) :: C, h => by
cases h with
| tail _ h' => exact posC_pos i C h'
theorem negC_pos (i : Nat) : forall C : Clause, (false, i) ∈ C -> 1 <= negC i C
| [], h => by cases h
| (false, v) :: C, h => by
show 1 <= bv (Nat.beq i v) + negC i C
cases h with
| head => rw [Found.Pnp62.beq_refl]; exact Nat.le_add_right 1 _
| tail _ h' => exact Nat.le_trans (negC_pos i C h') (Nat.le_add_left _ _)
| (true, v) :: C, h => by
cases h with
| tail _ h' => exact negC_pos i C h'
theorem beq_big {i v m : Nat} (hv : v < m) (hi : m <= i) : Nat.beq i v = false :=
Found.Pnp2.beq_false_of_ne i v (fun e => by rw [e] at hi; exact Nat.lt_irrefl v (Nat.lt_of_lt_of_le hv hi))
theorem posC_big (m i : Nat) (hi : m <= i) : forall C : Clause, VarsBelow m C -> posC i C = 0
| [], _ => rfl
| (true, v) :: C, h => by
show bv (Nat.beq i v) + posC i C = 0
rw [beq_big h.1 hi, posC_big m i hi C h.2]; rfl
| (false, _) :: C, h => posC_big m i hi C h.2
theorem negC_big (m i : Nat) (hi : m <= i) : forall C : Clause, VarsBelow m C -> negC i C = 0
| [], _ => rfl
| (true, _) :: C, h => negC_big m i hi C h.2
| (false, v) :: C, h => by
show bv (Nat.beq i v) + negC i C = 0
rw [beq_big h.1 hi, negC_big m i hi C h.2]; rfl
/-- The A-line test below M. -/
def isAt (M : Nat) (Q R : Nat -> Bool) (L : Line) : Bool :=
allI (fun i => ((!(R i)) || Nat.beq (nth0 L.P i) 0) && (Q i || Nat.beq (nth0 L.N i) 0)) M
theorem isAt_P (M : Nat) (Q R : Nat -> Bool) (L : Line) (h : isAt M Q R L = true) (i : Nat) (hi : i < M)
(hR : R i = true) : nth0 L.P i = 0 := by
have t := Found.Pnp62.and_l (allI_true _ M h i hi)
rw [hR] at t
exact Found.Pnp2.beq_eq _ _ t
theorem isAt_N (M : Nat) (Q R : Nat -> Bool) (L : Line) (h : isAt M Q R L = true) (i : Nat) (hi : i < M)
(hQ : Q i = false) : nth0 L.N i = 0 := by
have t := Found.Pnp62.and_r (allI_true _ M h i hi)
rw [hQ] at t
exact Found.Pnp2.beq_eq _ _ t
theorem allI_false (g : Nat -> Bool) (i : Nat) (hg : g i = false) : forall M, i < M -> allI g M = false
| 0, h => absurd h (Nat.not_lt_zero i)
| M + 1, h => by
show (allI g M && g M) = false
cases Nat.lt_or_ge i M with
| inl l => rw [allI_false g i hg M l]; rfl
| inr r =>
have e : i = M := Nat.le_antisymm (Nat.le_of_lt_succ h) r
rw [<- e, hg]
cases allI g i <;> rfl
theorem pos_ne_zero {x : Nat} (h : 1 <= x) : Nat.beq x 0 = false :=
Found.Pnp2.beq_false_of_ne x 0 (fun e => by rw [e] at h; exact Nat.not_succ_le_zero 0 h)
theorem isAt_falseP (M : Nat) (Q R : Nat -> Bool) (L : Line) (i : Nat) (hi : i < M) (hR : R i = true)
(hp : 1 <= nth0 L.P i) : isAt M Q R L = false := by
refine allI_false _ i ?_ M hi
show (((!(R i)) || Nat.beq (nth0 L.P i) 0) && (Q i || Nat.beq (nth0 L.N i) 0)) = false
rw [hR, pos_ne_zero hp]; rfl
theorem isAt_falseN (M : Nat) (Q R : Nat -> Bool) (L : Line) (i : Nat) (hi : i < M) (hQ : Q i = false)
(hn : 1 <= nth0 L.N i) : isAt M Q R L = false := by
refine allI_false _ i ?_ M hi
show (((!(R i)) || Nat.beq (nth0 L.P i) 0) && (Q i || Nat.beq (nth0 L.N i) 0)) = false
rw [hQ, pos_ne_zero hn]
cases ((!(R i)) || Nat.beq (nth0 L.P i) 0) <;> rfl
end Found.Pnp110
#print axioms Found.Pnp110.coefP
#print axioms Found.Pnp110.coefN
#print axioms Found.Pnp110.posC_zero
#print axioms Found.Pnp110.negC_zero
#print axioms Found.Pnp110.posC_pos
#print axioms Found.Pnp110.negC_pos
#print axioms Found.Pnp110.beq_big
#print axioms Found.Pnp110.posC_big
#print axioms Found.Pnp110.negC_big
#print axioms Found.Pnp110.isAt_P
#print axioms Found.Pnp110.isAt_N
#print axioms Found.Pnp110.allI_false
#print axioms Found.Pnp110.pos_ne_zero
#print axioms Found.Pnp110.isAt_falseP
#print axioms Found.Pnp110.isAt_falseN
lean_all/found/Pnp111.lean
/-
T330 piece 111. found/Pnp111 -- the clique-colouring formula meets the interpolant (proof
complexity ladder, step 2: cutting planes; Pudlak 1997).
Q = the clique position variables q(l, i), R = the colour variables r(i, a), the shared
variables are the edges p(i, j). Every clique clause has its negative literals in Q and its
positive literals off R, so its line passes the A-test; every colour clause avoids Q, and with
c >= 1 colours it fails the A-test (a colour variable with a positive coefficient, or an edge
with a negative one). Proved:
* ble_false_of_lt, blt_false_of_le, and the place of p, q, r against Q and R;
* clique_lits, colour_lits: the literals of each part;
* clique_isA, colour_notA: the A-test on each part;
* cc_split: the split of the lines of CC n k c;
* cc_out_A, cc_out_B: for a cutting planes refutation of CC, the output of the interpolant
at a graph is 1 when the clique part is satisfiable there and 0 when the colour part is.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp110
namespace Found.Pnp111
open Found.RootComp (Lit Clause CNF evalCNF)
open Found.Pnp90 (allI allI_of)
open Found.Pnp102 (nth0 Line CPProof falseLine)
open Found.Pnp103 (lineOf linesOf VarsBelow line_holds mem_linesOf cnf_mem_true)
open Found.Pnp104 (pv qv rv mCC qAll qTwo qEdge rAll rEdge cliquePart colourPart CC mem_app_or mem_upto mem_bindUp
mem_pairsK lin_lt pv_lt qv_lt rv_lt cc_vars)
open Found.Pnp108 (Split Agree interp interp_A interp_B)
open Found.Pnp109 (out)
open Found.Pnp110 (posC negC coefP coefN posC_zero negC_zero posC_pos negC_pos posC_big negC_big isAt isAt_P isAt_N
isAt_falseP isAt_falseN)
def Qc (n k : Nat) (i : Nat) : Bool := Nat.ble (n * n) i && Nat.blt i (n * n + k * n)
def Rc (n k : Nat) (i : Nat) : Bool := Nat.ble (n * n + k * n) i
theorem ble_false_of_lt {a b : Nat} (h : b < a) : Nat.ble a b = false := by
cases e : Nat.ble a b with
| false => rfl
| true => exact absurd (Nat.lt_of_lt_of_le h (Nat.le_of_ble_eq_true e)) (Nat.lt_irrefl b)
theorem blt_false_of_le {a b : Nat} (h : b <= a) : Nat.blt a b = false := ble_false_of_lt (Nat.lt_succ_of_le h)
theorem pv_small (n i j : Nat) (hi : i < n) (hj : j < n) : pv n i j < n * n := lin_lt i j n n hi hj
theorem qv_in (n k l i : Nat) (hl : l < k) (hi : i < n) : qv n l i < n * n + k * n :=
Nat.add_lt_add_left (lin_lt l i k n hl hi) _
theorem Rc_p (n k i j : Nat) (hi : i < n) (hj : j < n) : Rc n k (pv n i j) = false :=
ble_false_of_lt (Nat.lt_of_lt_of_le (pv_small n i j hi hj) (Nat.le_add_right _ _))
theorem Qc_p (n k i j : Nat) (hi : i < n) (hj : j < n) : Qc n k (pv n i j) = false := by
show (Nat.ble (n * n) (pv n i j) && _) = false
rw [ble_false_of_lt (pv_small n i j hi hj)]; rfl
theorem Rc_q (n k l i : Nat) (hl : l < k) (hi : i < n) : Rc n k (qv n l i) = false := ble_false_of_lt (qv_in n k l i hl hi)
theorem Qc_q (n k l i : Nat) (hl : l < k) (hi : i < n) : Qc n k (qv n l i) = true := by
show (Nat.ble (n * n) (n * n + (l * n + i)) && Nat.blt (qv n l i) (n * n + k * n)) = true
rw [Nat.ble_eq_true_of_le (Nat.le_add_right _ _), Found.Pnp90.lt_blt _ _ (qv_in n k l i hl hi)]; rfl
theorem Rc_r (n k c i a : Nat) : Rc n k (rv n k c i a) = true := Nat.ble_eq_true_of_le (Nat.le_add_right _ _)
theorem Qc_r (n k c i a : Nat) : Qc n k (rv n k c i a) = false := by
show (Nat.ble (n * n) (rv n k c i a) && Nat.blt (rv n k c i a) (n * n + k * n)) = false
have h : Nat.blt (rv n k c i a) (n * n + k * n) = false := blt_false_of_le (Nat.le_add_right _ _)
rw [h]
cases Nat.ble (n * n) (rv n k c i a) <;> rfl
/-- The literals of the clique part. -/
theorem clique_lits (n k : Nat) (C : Clause) (hC : C ∈ cliquePart n k) (l : Lit) (hl : l ∈ C) :
(l.1 = true -> Rc n k l.2 = false) /\ (l.1 = false -> Qc n k l.2 = true) := by
cases mem_app_or C _ _ hC with
| inl h2 =>
cases mem_app_or C _ _ h2 with
| inl h3 =>
cases mem_upto _ C k h3 with
| intro l0 hl0 =>
rw [hl0.2] at hl
cases mem_upto _ l n hl with
| intro i hi =>
rw [hi.2]
exact And.intro (fun _ => Rc_q n k l0 i hl0.1 hi.1) (fun h => Bool.noConfusion h)
| inr h3 =>
cases mem_pairsK k _ C h3 with
| intro l0 hl0 =>
cases hl0 with
| intro l1 hl1 =>
cases mem_upto _ C n hl1.2.2 with
| intro i hi =>
rw [hi.2] at hl
cases hl with
| head => exact And.intro (fun h => Bool.noConfusion h) (fun _ => Qc_q n k l0 i (Nat.lt_trans hl1.1 hl1.2.1) hi.1)
| tail _ hl' =>
cases hl' with
| head => exact And.intro (fun h => Bool.noConfusion h) (fun _ => Qc_q n k l1 i hl1.2.1 hi.1)
| tail _ hl'' => cases hl''
| inr h2 =>
cases mem_pairsK k _ C h2 with
| intro l0 hl0 =>
cases hl0 with
| intro l1 hl1 =>
cases mem_bindUp _ C n hl1.2.2 with
| intro i hi =>
cases mem_upto _ C n hi.2 with
| intro j hj =>
rw [hj.2] at hl
cases hl with
| head => exact And.intro (fun h => Bool.noConfusion h) (fun _ => Qc_q n k l0 i (Nat.lt_trans hl1.1 hl1.2.1) hi.1)
| tail _ hl' =>
cases hl' with
| head => exact And.intro (fun h => Bool.noConfusion h) (fun _ => Qc_q n k l1 j hl1.2.1 hj.1)
| tail _ hl'' =>
cases hl'' with
| head => exact And.intro (fun _ => Rc_p n k i j hi.1 hj.1) (fun h => Bool.noConfusion h)
| tail _ h4 => cases h4
/-- The literals of the colour part avoid Q. -/
theorem colour_lits (n k c : Nat) (C : Clause) (hC : C ∈ colourPart n k c) (l : Lit) (hl : l ∈ C) : Qc n k l.2 = false := by
cases mem_app_or C _ _ hC with
| inl h2 =>
cases mem_upto _ C n h2 with
| intro i hi =>
rw [hi.2] at hl
cases mem_upto _ l c hl with
| intro a ha => rw [ha.2]; exact Qc_r n k c i a
| inr h2 =>
cases mem_bindUp _ C n h2 with
| intro i hi =>
cases mem_bindUp _ C n hi.2 with
| intro j hj =>
cases mem_upto _ C c hj.2 with
| intro a ha =>
rw [ha.2] at hl
cases hl with
| head => exact Qc_p n k i j hi.1 hj.1
| tail _ hl' =>
cases hl' with
| head => exact Qc_r n k c i a
| tail _ hl'' =>
cases hl'' with
| head => exact Qc_r n k c j a
| tail _ h4 => cases h4
theorem beq_of_ne_val {f : Nat -> Bool} {i v : Nat} (hi : f i = true) (hv : f v = false) : Nat.beq i v = false :=
Found.Pnp2.beq_false_of_ne i v (fun e => by rw [e, hv] at hi; exact Bool.noConfusion hi)
theorem beq_of_ne_val' {f : Nat -> Bool} {i v : Nat} (hi : f i = false) (hv : f v = true) : Nat.beq i v = false :=
Found.Pnp2.beq_false_of_ne i v (fun e => by rw [e, hv] at hi; exact Bool.noConfusion hi)
theorem clique_isA (n k c : Nat) (C : Clause) (hC : C ∈ cliquePart n k) :
isAt (mCC n k c) (Qc n k) (Rc n k) (lineOf C) = true := by
refine allI_of _ _ ?_
intro i _
have hp : (!(Rc n k i) || Nat.beq (nth0 (lineOf C).P i) 0) = true := by
cases eR : Rc n k i with
| false => rfl
| true =>
rw [coefP, posC_zero i C (fun l hl h1 => beq_of_ne_val eR ((clique_lits n k C hC l hl).1 h1))]
rfl
have hn : (Qc n k i || Nat.beq (nth0 (lineOf C).N i) 0) = true := by
cases eQ : Qc n k i with
| true => rfl
| false =>
rw [coefN, negC_zero i C (fun l hl h1 => beq_of_ne_val' eQ ((clique_lits n k C hC l hl).2 h1))]
rfl
rw [hp, hn]; rfl
theorem colour_notA (n k c : Nat) (hc : 1 <= c) (C : Clause) (hC : C ∈ colourPart n k c) :
isAt (mCC n k c) (Qc n k) (Rc n k) (lineOf C) = false := by
cases mem_app_or C _ _ hC with
| inl h2 =>
cases mem_upto _ C n h2 with
| intro i hi =>
have mem : (true, rv n k c i 0) ∈ C := by
rw [hi.2]
cases c with
| zero => exact absurd hc (Nat.not_succ_le_zero 0)
| succ c' =>
have t : forall c'', (true, rv n k (c' + 1) i 0) ∈ Found.Pnp104.upto (fun a => (true, rv n k (c' + 1) i a)) (c'' + 1) := by
intro c''
induction c'' with
| zero => exact List.Mem.head _
| succ c'' ih => exact List.Mem.tail _ ih
exact t c'
refine isAt_falseP _ _ _ _ (rv n k c i 0) (rv_lt n k c i 0 hi.1 hc) (Rc_r n k c i 0) ?_
rw [coefP]; exact posC_pos _ C mem
| inr h2 =>
cases mem_bindUp _ C n h2 with
| intro i hi =>
cases mem_bindUp _ C n hi.2 with
| intro j hj =>
cases mem_upto _ C c hj.2 with
| intro a ha =>
have mem : (false, pv n i j) ∈ C := by rw [ha.2]; exact List.Mem.head _
refine isAt_falseN _ _ _ _ (pv n i j) (pv_lt n k c i j hi.1 hj.1) (Qc_p n k i j hi.1 hj.1) ?_
rw [coefN]; exact negC_pos _ C mem
def SatA (n k : Nat) (a : Nat -> Bool) : Prop := evalCNF a (cliquePart n k) = true
def SatB (n k c : Nat) (a : Nat -> Bool) : Prop := evalCNF a (colourPart n k c) = true
theorem mem_CC (n k c : Nat) (C : Clause) (h : C ∈ CC n k c) : C ∈ cliquePart n k \/ C ∈ colourPart n k c :=
mem_app_or C _ _ h
theorem cc_split (n k c : Nat) (hc : 1 <= c) :
Split (mCC n k c) (linesOf (CC n k c)) (Qc n k) (Rc n k) (isAt (mCC n k c) (Qc n k) (Rc n k)) (SatA n k) (SatB n k c) := by
have src : forall L, L ∈ linesOf (CC n k c) -> Exists fun C => C ∈ CC n k c /\ L = lineOf C := fun L h => mem_linesOf _ L h
refine Split.mk ?_ ?_ ?_ ?_ ?_
· intro L hL hA a sa
cases src L hL with
| intro C hC =>
rw [hC.2]
cases mem_CC n k c C hC.1 with
| inl h => exact line_holds _ a C (cc_vars n k c C hC.1) (cnf_mem_true a _ C sa h)
| inr h => rw [hC.2, colour_notA n k c hc C h] at hA; exact Bool.noConfusion hA
· intro L hL hA i hQ
cases src L hL with
| intro C hC =>
cases Nat.lt_or_ge i (mCC n k c) with
| inl l => exact isAt_N _ _ _ L hA i l hQ
| inr r => rw [hC.2, coefN]; exact negC_big _ i r C (cc_vars n k c C hC.1)
· intro L hL hA i hR
cases src L hL with
| intro C hC =>
cases Nat.lt_or_ge i (mCC n k c) with
| inl l => exact isAt_P _ _ _ L hA i l hR
| inr r => rw [hC.2, coefP]; exact posC_big _ i r C (cc_vars n k c C hC.1)
· intro L hL hA a sb
cases src L hL with
| intro C hC =>
rw [hC.2]
cases mem_CC n k c C hC.1 with
| inl h => rw [hC.2, clique_isA n k c C h] at hA; exact Bool.noConfusion hA
| inr h => exact line_holds _ a C (cc_vars n k c C hC.1) (cnf_mem_true a _ C sb h)
· intro L hL hA i hQ
cases src L hL with
| intro C hC =>
cases mem_CC n k c C hC.1 with
| inl h => rw [hC.2, clique_isA n k c C h] at hA; exact Bool.noConfusion hA
| inr h =>
rw [hC.2, coefP, coefN]
exact And.intro (posC_zero i C (fun l hl _ => beq_of_ne_val hQ (colour_lits n k c C h l hl)))
(negC_zero i C (fun l hl _ => beq_of_ne_val hQ (colour_lits n k c C h l hl)))
/-- Clique part satisfiable at the graph ap: output 1. -/
theorem cc_out_A (n k c : Nat) (hc : 1 <= c) (p : CPProof (mCC n k c) (linesOf (CC n k c)) falseLine) (ap a : Nat -> Bool)
(hag : Agree (mCC n k c) (Qc n k) (Rc n k) a ap) (sa : SatA n k a) :
out (interp (mCC n k c) _ (Qc n k) (isAt (mCC n k c) (Qc n k) (Rc n k)) ap p) = true :=
Nat.ble_eq_true_of_le (interp_A _ _ _ _ _ _ _ (cc_split n k c hc) ap p a hag sa)
/-- Colour part satisfiable at the graph ap: output 0. -/
theorem cc_out_B (n k c : Nat) (hc : 1 <= c) (p : CPProof (mCC n k c) (linesOf (CC n k c)) falseLine) (ap a : Nat -> Bool)
(hag : Agree (mCC n k c) (Qc n k) (Rc n k) a ap) (sb : SatB n k c a) :
out (interp (mCC n k c) _ (Qc n k) (isAt (mCC n k c) (Qc n k) (Rc n k)) ap p) = false := by
have t := interp_B _ _ _ _ _ _ _ (cc_split n k c hc) ap p a hag sb
exact Found.Pnp111.ble_false_of_lt t
end Found.Pnp111
#print axioms Found.Pnp111.ble_false_of_lt
#print axioms Found.Pnp111.blt_false_of_le
#print axioms Found.Pnp111.pv_small
#print axioms Found.Pnp111.qv_in
#print axioms Found.Pnp111.Rc_p
#print axioms Found.Pnp111.Qc_p
#print axioms Found.Pnp111.Rc_q
#print axioms Found.Pnp111.Qc_q
#print axioms Found.Pnp111.Rc_r
#print axioms Found.Pnp111.Qc_r
#print axioms Found.Pnp111.clique_lits
#print axioms Found.Pnp111.colour_lits
#print axioms Found.Pnp111.beq_of_ne_val
#print axioms Found.Pnp111.beq_of_ne_val'
#print axioms Found.Pnp111.clique_isA
#print axioms Found.Pnp111.colour_notA
#print axioms Found.Pnp111.mem_CC
#print axioms Found.Pnp111.cc_split
#print axioms Found.Pnp111.cc_out_A
#print axioms Found.Pnp111.cc_out_B
lean_all/found/Pnp112.lean
/-
T330 piece 112. found/Pnp112 -- the interpolant separates cliques from colourings (proof
complexity ladder, step 2: cutting planes; Pudlak 1997).
A graph is an assignment ap of the edge variables p(i, j). A k-clique is a map v from
positions l < k to vertices below n, injective, with ap(p(v l, v l')) = true for l < l'.
A c-colouring is a map col from vertices to colours below c with col i <> col j whenever
ap(p(i, j)) = true. From a clique the q variables are set to the clique (cliqA), from a
colouring the r variables to the colours (colB); both agree with ap on the edges. Proved:
* mem_memL, cnf_all: membership and evaluation tools;
* qv_inj, rv_inj: the variable codes are injective;
* cliqA_sat, colB_sat: the clique part, the colour part are satisfied;
* cliqA_agree, colB_agree: the assignments agree with ap on the edges;
* separate_clique, separate_colour: for a cutting planes refutation of CC n k c (c >= 1)
the output of the interpolant is 1 on graphs with a k-clique and 0 on c-colourable
graphs; with Pnp109 it is monotone in the edges.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp111
namespace Found.Pnp112
open Found.RootComp (Lit Clause CNF evalLit evalClause evalCNF)
open Found.Pnp65 (var var_inj anyI anyI_true)
open Found.Pnp62 (memL beqLit_refl of_mem)
open Found.Pnp96 (anyI_ex)
open Found.Pnp102 (CPProof falseLine)
open Found.Pnp103 (linesOf)
open Found.Pnp104 (pv qv rv mCC qAll qTwo qEdge rAll rEdge cliquePart colourPart CC upto bindUp mem_app_or mem_upto
mem_bindUp mem_pairsK)
open Found.Pnp108 (Agree interp)
open Found.Pnp109 (out)
open Found.Pnp111 (Qc Rc SatA SatB cc_out_A cc_out_B Qc_q Qc_p Qc_r Rc_r Rc_p Rc_q qv_in pv_small)
def selB (b x y : Bool) : Bool := match b with | true => x | false => y
theorem mem_memL (l : Lit) : forall C : Clause, l ∈ C -> memL l C = true
| [], h => by cases h
| m :: C, h => by
show (Found.Pnp62.beqLit m l || memL l C) = true
cases h with
| head => rw [beqLit_refl]; rfl
| tail _ h' => exact Found.Pnp62.or_r (mem_memL l C h')
theorem cnf_all (a : Nat -> Bool) : forall F : CNF, (forall C, C ∈ F -> evalClause a C = true) -> evalCNF a F = true
| [], _ => rfl
| C :: F, h => by
show (evalClause a C && evalCNF a F) = true
rw [h C (List.Mem.head _), cnf_all a F (fun D hD => h D (List.Mem.tail _ hD))]
rfl
theorem lit_true (a : Nat -> Bool) (l : Lit) (C : Clause) (hl : l ∈ C) (ht : evalLit a l = true) : evalClause a C = true :=
of_mem a l ht C (mem_memL l C hl)
theorem add_cancel_l_eq' {x a b : Nat} (h : x + a = x + b) : a = b := Found.Pnp101.add_cancel_l_eq h
theorem qv_inj (n l i l' i' : Nat) (hi : i < n) (hi' : i' < n) (h : qv n l i = qv n l' i') : l = l' /\ i = i' :=
var_inj n l l' i i' hi hi' (add_cancel_l_eq' h)
theorem rv_inj (n k c i a i' a' : Nat) (ha : a < c) (ha' : a' < c) (h : rv n k c i a = rv n k c i' a') : i = i' /\ a = a' :=
var_inj c i i' a a' ha ha' (add_cancel_l_eq' h)
/-- The assignment of a clique v: q(l, v l) true, the edges as in ap. -/
def cliqA (n k : Nat) (v : Nat -> Nat) (ap : Nat -> Bool) (x : Nat) : Bool :=
selB (Qc n k x) (anyI (fun l => Nat.beq x (qv n l (v l))) k) (ap x)
/-- The assignment of a colouring col: r(i, col i) true, the edges as in ap. -/
def colB (n k c : Nat) (col : Nat -> Nat) (ap : Nat -> Bool) (x : Nat) : Bool :=
selB (Rc n k x) (anyI (fun i => Nat.beq x (rv n k c i (col i))) n) (ap x)
structure Clique (n k : Nat) (v : Nat -> Nat) (ap : Nat -> Bool) : Prop where
rng : forall l, l < k -> v l < n
inj : forall l l', l < k -> l' < k -> v l = v l' -> l = l'
edge : forall l l', l < l' -> l' < k -> ap (pv n (v l) (v l')) = true
structure Colouring (n c : Nat) (col : Nat -> Nat) (ap : Nat -> Bool) : Prop where
rng : forall i, i < n -> col i < c
prop : forall i j, i < n -> j < n -> ap (pv n i j) = true -> col i = col j -> False
theorem mem_upto_of {α : Type} (f : Nat -> α) (i : Nat) : forall k, i < k -> f i ∈ upto f k
| 0, h => absurd h (Nat.not_lt_zero i)
| k + 1, h => by
cases Nat.lt_or_ge i k with
| inl l => exact List.Mem.tail _ (mem_upto_of f i k l)
| inr r =>
have e : i = k := Nat.le_antisymm (Nat.le_of_lt_succ h) r
rw [e]; exact List.Mem.head _
theorem cliqA_q (n k : Nat) (v : Nat -> Nat) (ap : Nat -> Bool) (hv : Clique n k v ap) (l i : Nat) (hl : l < k) (hi : i < n)
(h : cliqA n k v ap (qv n l i) = true) : i = v l := by
have h' : selB (Qc n k (qv n l i)) (anyI (fun l1 => Nat.beq (qv n l i) (qv n l1 (v l1))) k) (ap (qv n l i)) = true := h
rw [Qc_q n k l i hl hi] at h'
cases anyI_ex _ k h' with
| intro l1 hl1 =>
have e := Found.Pnp2.beq_eq _ _ hl1.2
have t := qv_inj n l i l1 (v l1) hi (hv.rng l1 hl1.1) e
rw [t.2, t.1]
theorem cliqA_p (n k : Nat) (v : Nat -> Nat) (ap : Nat -> Bool) (i j : Nat) (hi : i < n) (hj : j < n) :
cliqA n k v ap (pv n i j) = ap (pv n i j) := by
show selB (Qc n k (pv n i j)) _ _ = _
rw [Qc_p n k i j hi hj]; rfl
theorem cliqA_sat (n k : Nat) (v : Nat -> Nat) (ap : Nat -> Bool) (hv : Clique n k v ap) : SatA n k (cliqA n k v ap) := by
refine cnf_all _ _ ?_
intro C hC
cases mem_app_or C _ _ hC with
| inl h2 =>
cases mem_app_or C _ _ h2 with
| inl h3 =>
cases mem_upto _ C k h3 with
| intro l hl =>
rw [hl.2]
refine lit_true _ (true, qv n l (v l)) _ (mem_upto_of (fun i => (true, qv n l i)) (v l) n (hv.rng l hl.1)) ?_
show selB (Qc n k (qv n l (v l))) _ _ = true
rw [Qc_q n k l (v l) hl.1 (hv.rng l hl.1)]
show anyI (fun l1 => Nat.beq (qv n l (v l)) (qv n l1 (v l1))) k = true
exact anyI_true (fun l1 => Nat.beq (qv n l (v l)) (qv n l1 (v l1))) l (Found.Pnp62.beq_refl _) k hl.1
| inr h3 =>
cases mem_pairsK k _ C h3 with
| intro l0 hl0 =>
cases hl0 with
| intro l1 hl1 =>
cases mem_upto _ C n hl1.2.2 with
| intro i hi =>
rw [hi.2]
have l0k : l0 < k := Nat.lt_trans hl1.1 hl1.2.1
cases e0 : cliqA n k v ap (qv n l0 i) with
| false =>
refine lit_true _ (false, qv n l0 i) _ (List.Mem.head _) ?_
show (!(cliqA n k v ap (qv n l0 i))) = true
rw [e0]; rfl
| true =>
cases e1 : cliqA n k v ap (qv n l1 i) with
| false =>
refine lit_true _ (false, qv n l1 i) _ (List.Mem.tail _ (List.Mem.head _)) ?_
show (!(cliqA n k v ap (qv n l1 i))) = true
rw [e1]; rfl
| true =>
have a0 := cliqA_q n k v ap hv l0 i l0k hi.1 e0
have a1 := cliqA_q n k v ap hv l1 i hl1.2.1 hi.1 e1
have t := hv.inj l0 l1 l0k hl1.2.1 (a0.symm.trans a1)
rw [t] at hl1
exact absurd hl1.1 (Nat.lt_irrefl _)
| inr h2 =>
cases mem_pairsK k _ C h2 with
| intro l0 hl0 =>
cases hl0 with
| intro l1 hl1 =>
cases mem_bindUp _ C n hl1.2.2 with
| intro i hi =>
cases mem_upto _ C n hi.2 with
| intro j hj =>
rw [hj.2]
have l0k : l0 < k := Nat.lt_trans hl1.1 hl1.2.1
cases e0 : cliqA n k v ap (qv n l0 i) with
| false =>
refine lit_true _ (false, qv n l0 i) _ (List.Mem.head _) ?_
show (!(cliqA n k v ap (qv n l0 i))) = true
rw [e0]; rfl
| true =>
cases e1 : cliqA n k v ap (qv n l1 j) with
| false =>
refine lit_true _ (false, qv n l1 j) _ (List.Mem.tail _ (List.Mem.head _)) ?_
show (!(cliqA n k v ap (qv n l1 j))) = true
rw [e1]; rfl
| true =>
have a0 := cliqA_q n k v ap hv l0 i l0k hi.1 e0
have a1 := cliqA_q n k v ap hv l1 j hl1.2.1 hj.1 e1
refine lit_true _ (true, pv n i j) _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.head _))) ?_
show cliqA n k v ap (pv n i j) = true
rw [cliqA_p n k v ap i j hi.1 hj.1, a0, a1]
exact hv.edge l0 l1 hl1.1 hl1.2.1
theorem cliqA_agree (n k c : Nat) (v : Nat -> Nat) (ap : Nat -> Bool) :
Agree (mCC n k c) (Qc n k) (Rc n k) (cliqA n k v ap) ap := by
intro i _ hQ _
show selB (Qc n k i) _ _ = _
rw [hQ]; rfl
theorem colB_r (n k c : Nat) (col : Nat -> Nat) (ap : Nat -> Bool) (hc : Colouring n c col ap) (i a : Nat) (ha : a < c)
(h : colB n k c col ap (rv n k c i a) = true) : a = col i := by
have h' : selB (Rc n k (rv n k c i a)) (anyI (fun i1 => Nat.beq (rv n k c i a) (rv n k c i1 (col i1))) n) (ap (rv n k c i a)) = true := h
rw [Rc_r n k c i a] at h'
cases anyI_ex _ n h' with
| intro i1 hi1 =>
have e := Found.Pnp2.beq_eq _ _ hi1.2
have t := rv_inj n k c i a i1 (col i1) ha (hc.rng i1 hi1.1) e
rw [t.2, t.1]
theorem colB_p (n k c : Nat) (col : Nat -> Nat) (ap : Nat -> Bool) (i j : Nat) (hi : i < n) (hj : j < n) :
colB n k c col ap (pv n i j) = ap (pv n i j) := by
show selB (Rc n k (pv n i j)) _ _ = _
rw [Rc_p n k i j hi hj]; rfl
theorem colB_sat (n k c : Nat) (col : Nat -> Nat) (ap : Nat -> Bool) (hc : Colouring n c col ap) :
SatB n k c (colB n k c col ap) := by
refine cnf_all _ _ ?_
intro C hC
cases mem_app_or C _ _ hC with
| inl h2 =>
cases mem_upto _ C n h2 with
| intro i hi =>
rw [hi.2]
refine lit_true _ (true, rv n k c i (col i)) _ (mem_upto_of (fun a => (true, rv n k c i a)) (col i) c (hc.rng i hi.1)) ?_
show selB (Rc n k (rv n k c i (col i))) _ _ = true
rw [Rc_r n k c i (col i)]
show anyI (fun i1 => Nat.beq (rv n k c i (col i)) (rv n k c i1 (col i1))) n = true
exact anyI_true (fun i1 => Nat.beq (rv n k c i (col i)) (rv n k c i1 (col i1))) i (Found.Pnp62.beq_refl _) n hi.1
| inr h2 =>
cases mem_bindUp _ C n h2 with
| intro i hi =>
cases mem_bindUp _ C n hi.2 with
| intro j hj =>
cases mem_upto _ C c hj.2 with
| intro a ha =>
rw [ha.2]
cases e0 : colB n k c col ap (pv n i j) with
| false =>
refine lit_true _ (false, pv n i j) _ (List.Mem.head _) ?_
show (!(colB n k c col ap (pv n i j))) = true
rw [e0]; rfl
| true =>
cases e1 : colB n k c col ap (rv n k c i a) with
| false =>
refine lit_true _ (false, rv n k c i a) _ (List.Mem.tail _ (List.Mem.head _)) ?_
show (!(colB n k c col ap (rv n k c i a))) = true
rw [e1]; rfl
| true =>
cases e2 : colB n k c col ap (rv n k c j a) with
| false =>
refine lit_true _ (false, rv n k c j a) _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.head _))) ?_
show (!(colB n k c col ap (rv n k c j a))) = true
rw [e2]; rfl
| true =>
have a1 := colB_r n k c col ap hc i a ha.1 e1
have a2 := colB_r n k c col ap hc j a ha.1 e2
rw [colB_p n k c col ap i j hi.1 hj.1] at e0
exact (hc.prop i j hi.1 hj.1 e0 (a1.symm.trans a2)).elim
theorem colB_agree (n k c : Nat) (col : Nat -> Nat) (ap : Nat -> Bool) :
Agree (mCC n k c) (Qc n k) (Rc n k) (colB n k c col ap) ap := by
intro i _ _ hR
show selB (Rc n k i) _ _ = _
rw [hR]; rfl
/-- On a graph with a k-clique the interpolant outputs 1. -/
theorem separate_clique (n k c : Nat) (hc : 1 <= c) (p : CPProof (mCC n k c) (linesOf (CC n k c)) falseLine)
(ap : Nat -> Bool) (v : Nat -> Nat) (hv : Clique n k v ap) :
out (interp (mCC n k c) _ (Qc n k) (Found.Pnp110.isAt (mCC n k c) (Qc n k) (Rc n k)) ap p) = true :=
cc_out_A n k c hc p ap _ (cliqA_agree n k c v ap) (cliqA_sat n k v ap hv)
/-- On a c-colourable graph the interpolant outputs 0. -/
theorem separate_colour (n k c : Nat) (hc : 1 <= c) (p : CPProof (mCC n k c) (linesOf (CC n k c)) falseLine)
(ap : Nat -> Bool) (col : Nat -> Nat) (hcol : Colouring n c col ap) :
out (interp (mCC n k c) _ (Qc n k) (Found.Pnp110.isAt (mCC n k c) (Qc n k) (Rc n k)) ap p) = false :=
cc_out_B n k c hc p ap _ (colB_agree n k c col ap) (colB_sat n k c col ap hcol)
end Found.Pnp112
#print axioms Found.Pnp112.mem_memL
#print axioms Found.Pnp112.cnf_all
#print axioms Found.Pnp112.lit_true
#print axioms Found.Pnp112.qv_inj
#print axioms Found.Pnp112.rv_inj
#print axioms Found.Pnp112.mem_upto_of
#print axioms Found.Pnp112.cliqA_q
#print axioms Found.Pnp112.cliqA_p
#print axioms Found.Pnp112.cliqA_sat
#print axioms Found.Pnp112.cliqA_agree
#print axioms Found.Pnp112.colB_r
#print axioms Found.Pnp112.colB_p
#print axioms Found.Pnp112.colB_sat
#print axioms Found.Pnp112.colB_agree
#print axioms Found.Pnp112.separate_clique
#print axioms Found.Pnp112.separate_colour
lean_all/found/Pnp113.lean
/-
T330 piece 113. found/Pnp113 -- monotone real circuits as straight-line programs (proof
complexity ladder, step 2: cutting planes).
Values are integers as pairs (Pnp105) under the order zle. A gate is an input x_i (value
(x_i, 0)), a constant, or op f j k: a binary function f, nondecreasing in both arguments,
applied to the values of the gates j and k positions back (gates are listed newest first,
so every reference is to an earlier gate). The size of a circuit is its number of gates; its
output is the value of its last gate, read as a Boolean by out (value >= 0). Proved:
* nthV_le: pointwise order of value lists passes to their entries;
* evalR_mono: if the input grows, every gate value does not decrease;
* out_circ_mono: the output of a monotone real circuit is a monotone Boolean function.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp112
namespace Found.Pnp113
open Found.Pnp65 (bv)
open Found.Pnp105 (zle zle_refl)
open Found.Pnp109 (LeA bv_mono out out_mono)
/-- f is nondecreasing in both arguments. -/
def Mono2 (f : Nat × Nat -> Nat × Nat -> Nat × Nat) : Prop :=
forall u u' v v', zle u u' -> zle v v' -> zle (f u v) (f u' v')
inductive Gate where
| inp (i : Nat) : Gate
| cst (v : Nat × Nat) : Gate
| op (f : Nat × Nat -> Nat × Nat -> Nat × Nat) (hf : Mono2 f) (j k : Nat) : Gate
/-- Entry j of a value list (newest first), (0, 0) past the end. -/
def nthV : List (Nat × Nat) -> Nat -> Nat × Nat
| [], _ => (0, 0)
| v :: _, 0 => v
| _ :: l, j + 1 => nthV l j
def gval (x : Nat -> Bool) (vs : List (Nat × Nat)) : Gate -> Nat × Nat
| .inp i => (bv (x i), 0)
| .cst v => v
| .op f _ j k => f (nthV vs j) (nthV vs k)
/-- The values of all gates, newest first. -/
def evalR (x : Nat -> Bool) : List Gate -> List (Nat × Nat)
| [] => []
| g :: gs => gval x (evalR x gs) g :: evalR x gs
/-- The output gate value. -/
def outV (x : Nat -> Bool) (C : List Gate) : Nat × Nat := nthV (evalR x C) 0
/-- Pointwise order of two value lists of the same shape. -/
def LeL : List (Nat × Nat) -> List (Nat × Nat) -> Prop
| [], [] => True
| v :: l, w :: l' => zle v w /\ LeL l l'
| [], _ :: _ => False
| _ :: _, [] => False
theorem nthV_le : forall (l l' : List (Nat × Nat)) (j : Nat), LeL l l' -> zle (nthV l j) (nthV l' j)
| [], [], _, _ => zle_refl _
| _ :: _, _ :: _, 0, h => h.1
| _ :: l, _ :: l', j + 1, h => nthV_le l l' j h.2
| [], _ :: _, _, h => h.elim
| _ :: _, [], _, h => h.elim
theorem evalR_mono (x x' : Nat -> Bool) (hx : LeA x x') : forall C : List Gate, LeL (evalR x C) (evalR x' C)
| [] => True.intro
| g :: gs => by
have ih := evalR_mono x x' hx gs
refine And.intro ?_ ih
cases g with
| inp i =>
show bv (x i) + 0 <= bv (x' i) + 0
exact Nat.add_le_add_right (bv_mono _ _ (hx i)) 0
| cst v => exact zle_refl v
| op f hf j k => exact hf _ _ _ _ (nthV_le _ _ j ih) (nthV_le _ _ k ih)
theorem outV_mono (x x' : Nat -> Bool) (hx : LeA x x') (C : List Gate) : zle (outV x C) (outV x' C) :=
nthV_le _ _ 0 (evalR_mono x x' hx C)
/-- The output of a monotone real circuit is a monotone Boolean function. -/
theorem out_circ_mono (x x' : Nat -> Bool) (hx : LeA x x') (C : List Gate) (h : out (outV x C) = true) :
out (outV x' C) = true :=
out_mono _ _ (outV_mono x x' hx C) h
end Found.Pnp113
#print axioms Found.Pnp113.nthV_le
#print axioms Found.Pnp113.evalR_mono
#print axioms Found.Pnp113.outV_mono
#print axioms Found.Pnp113.out_circ_mono
lean_all/found/Pnp114.lean
/-
T330 piece 114. found/Pnp114 -- the interpolant as a monotone real circuit, with a size
bound (proof complexity ladder, step 2: cutting planes; Pudlak 1997).
compile turns a cutting planes proof p into a straight-line monotone real circuit whose
output at a shared assignment ap is the interpolant interp p ap (Pnp108): an A-axiom becomes
a chain of 2 m + 1 gates computing (d + sum of kappa_i x_i, e) with kappa_i >= 0, other axioms
constants, and sum, multiple, floor division one gate each. Its size is at most
(2 m + 1) * size p. Proved:
* evalR_len, nthV_app_lt, nthV_app_len, evalR_app: evaluation of a concatenation whose
first part only refers to itself (WFc);
* addmul_mono, addf_mono, mulf_mono, divf_mono: the gates are monotone;
* linG_val, linG_wf, linG_len: the linear chain;
* compile_wf, compile_val, compile_len: the circuit, its value, its size.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp113
namespace Found.Pnp114
open Found.Pnp65 (bv)
open Found.Pnp95 (sumI)
open Found.Pnp97 (sumI_ext)
open Found.Pnp98 (mul_add' add_mul' mul_le_r)
open Found.Pnp99 (mul_le_l' mul_assoc')
open Found.Pnp102 (nth0 Line CPProof)
open Found.Pnp105 (zle zdiv zdiv_mono)
open Found.Pnp107 (vS)
open Found.Pnp108 (interp selP nQ)
open Found.Pnp109 (zadd_mono zmul_mono)
open Found.Pnp113 (Mono2 Gate nthV gval evalR outV)
open Found.Pnp93 (add4)
/-- All references of every gate point to later (older) gates of the same list. -/
def refsLt (n : Nat) : Gate -> Prop
| .inp _ => True
| .cst _ => True
| .op _ _ j k => j < n /\ k < n
def WFc : List Gate -> Prop
| [] => True
| g :: gs => refsLt gs.length g /\ WFc gs
theorem evalR_len (x : Nat -> Bool) : forall C : List Gate, (evalR x C).length = C.length
| [] => rfl
| _ :: gs => congrArg (· + 1) (evalR_len x gs)
theorem nthV_app_lt : forall (l1 l2 : List (Nat × Nat)) (j : Nat), j < l1.length -> nthV (l1 ++ l2) j = nthV l1 j
| [], _, j, h => absurd h (Nat.not_lt_zero j)
| _ :: _, _, 0, _ => rfl
| _ :: l1, l2, j + 1, h => nthV_app_lt l1 l2 j (Nat.lt_of_succ_lt_succ h)
theorem nthV_app_len : forall (l1 l2 : List (Nat × Nat)) (j : Nat), nthV (l1 ++ l2) (l1.length + j) = nthV l2 j
| [], l2, j => by
show nthV l2 (0 + j) = nthV l2 j
rw [Nat.zero_add]
| a :: l1, l2, j => by
show nthV (a :: (l1 ++ l2)) (l1.length + 1 + j) = nthV l2 j
rw [Nat.add_right_comm]
exact nthV_app_len l1 l2 j
theorem gval_app (x : Nat -> Bool) (l1 l2 : List (Nat × Nat)) (g : Gate) (h : refsLt l1.length g) :
gval x (l1 ++ l2) g = gval x l1 g := by
cases g with
| inp i => rfl
| cst v => rfl
| op f hf j k =>
show f (nthV (l1 ++ l2) j) (nthV (l1 ++ l2) k) = f (nthV l1 j) (nthV l1 k)
rw [nthV_app_lt l1 l2 j h.1, nthV_app_lt l1 l2 k h.2]
theorem evalR_app (x : Nat -> Bool) (B : List Gate) : forall A : List Gate, WFc A -> evalR x (A ++ B) = evalR x A ++ evalR x B
| [], _ => rfl
| g :: A, h => by
show gval x (evalR x (A ++ B)) g :: evalR x (A ++ B) = gval x (evalR x A) g :: (evalR x A ++ evalR x B)
rw [evalR_app x B A h.2, gval_app x (evalR x A) (evalR x B) g (by rw [evalR_len]; exact h.1)]
/-- Gates. -/
def addmul (c : Nat) (u v : Nat × Nat) : Nat × Nat := (u.1 + c * v.1, u.2 + c * v.2)
def addf (u v : Nat × Nat) : Nat × Nat := (u.1 + v.1, u.2 + v.2)
def mulf (k : Nat) (u _v : Nat × Nat) : Nat × Nat := (k * u.1, k * u.2)
def divf (c' : Nat) (u _v : Nat × Nat) : Nat × Nat := zdiv c' u
theorem addmul_mono (c : Nat) : Mono2 (addmul c) := by
intro u u' v v' h1 h2
show (u.1 + c * v.1) + (u'.2 + c * v'.2) <= (u'.1 + c * v'.1) + (u.2 + c * v.2)
rw [add4, add4 u'.1, <- mul_add', <- mul_add']
exact Nat.add_le_add h1 (mul_le_l' h2 c)
theorem addf_mono : Mono2 addf := fun u u' v v' h1 h2 => zadd_mono u v u' v' h1 h2
theorem mulf_mono (k : Nat) : Mono2 (mulf k) := fun u u' _ _ h1 _ => zmul_mono k u u' h1
theorem divf_mono (c' : Nat) : Mono2 (divf c') := fun u u' _ _ h1 _ => zdiv_mono c' u u' h1
/-- The linear chain: value (d + sum_{t < i} kappa t * x_t, e). -/
def linG (kappa : Nat -> Nat) (d e : Nat) : Nat -> List Gate
| 0 => [Gate.cst (d, e)]
| i + 1 => Gate.op (addmul (kappa i)) (addmul_mono (kappa i)) 1 0 :: Gate.inp i :: linG kappa d e i
theorem linG_len (kappa : Nat -> Nat) (d e : Nat) : forall i, (linG kappa d e i).length = 2 * i + 1
| 0 => rfl
| i + 1 => by
show (linG kappa d e i).length + 1 + 1 = 2 * (i + 1) + 1
rw [linG_len kappa d e i, mul_add']
theorem linG_wf (kappa : Nat -> Nat) (d e : Nat) : forall i, WFc (linG kappa d e i)
| 0 => And.intro True.intro True.intro
| i + 1 => by
refine And.intro ?_ (And.intro True.intro (linG_wf kappa d e i))
show 1 < (linG kappa d e i).length + 1 /\ 0 < (linG kappa d e i).length + 1
rw [linG_len]
exact And.intro (Nat.succ_lt_succ (Nat.succ_pos _)) (Nat.succ_pos _)
theorem linG_val (x : Nat -> Bool) (kappa : Nat -> Nat) (d e : Nat) : forall i,
nthV (evalR x (linG kappa d e i)) 0 = (d + sumI (fun t => kappa t * bv (x t)) i, e)
| 0 => rfl
| i + 1 => by
show addmul (kappa i) (nthV (evalR x (linG kappa d e i)) 0) (bv (x i), 0) = _
rw [linG_val x kappa d e i]
show (d + sumI (fun t => kappa t * bv (x t)) i + kappa i * bv (x i), e + kappa i * 0) =
(d + (sumI (fun t => kappa t * bv (x t)) i + kappa i * bv (x i)), e)
rw [Nat.add_assoc]
rfl
theorem len_app : forall (A B : List Gate), (A ++ B).length = A.length + B.length
| [], B => (Nat.zero_add _).symm
| _ :: A, B => by
show (A ++ B).length + 1 = A.length + 1 + B.length
rw [len_app A B, Nat.add_right_comm]
theorem refsLt_mono {n n' : Nat} (hn : n <= n') : forall g : Gate, refsLt n g -> refsLt n' g
| .inp _, _ => True.intro
| .cst _, _ => True.intro
| .op _ _ _ _, h => And.intro (Nat.lt_of_lt_of_le h.1 hn) (Nat.lt_of_lt_of_le h.2 hn)
theorem wfc_app (B : List Gate) (hB : WFc B) : forall A : List Gate, WFc A -> WFc (A ++ B)
| [], _ => hB
| g :: A, h => by
refine And.intro ?_ (wfc_app B hB A h.2)
refine refsLt_mono ?_ g h.1
exact Nat.le_trans (Nat.le_add_right A.length B.length) (Nat.le_of_eq (len_app A B).symm)
theorem mul_one' (n : Nat) : n * 1 = n := Nat.zero_add n
def selC (b : Bool) (x y : List Gate) : List Gate := match b with | true => x | false => y
/-- Weight of shared variable i in the A-axiom with P side P. -/
def kap (Q : Nat -> Bool) (P : List Nat) (i : Nat) : Nat := bv (nQ Q i) * nth0 P i
/-- The circuit of a cutting planes proof (gates newest first; the output is the head). -/
def compile (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) : {L : Line} -> CPProof m F L -> List Gate
| _, .ax L _ => selC (isA L) (linG (kap Q L.P) L.d L.e m) [Gate.cst (0, 0)]
| _, .nonneg _ => [Gate.cst (0, 0)]
| _, .le1 i => [Gate.cst (selP (Q i) (1, 0) (0, 0))]
| _, .add _ _ p q => Gate.op addf addf_mono 0 (compile m F Q isA p).length :: (compile m F Q isA p ++ compile m F Q isA q)
| _, .mul k _ p => Gate.op (mulf k) (mulf_mono k) 0 0 :: compile m F Q isA p
| _, .div c _ _ p _ => Gate.op (divf (c - 1)) (divf_mono (c - 1)) 0 0 :: compile m F Q isA p
theorem compile_pos (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) :
forall (L : Line) (p : CPProof m F L), 0 < (compile m F Q isA p).length := by
intro L p
cases p with
| ax L h =>
show 0 < (selC (isA L) _ _).length
cases isA L with
| true => show 0 < (linG _ _ _ m).length; rw [linG_len]; exact Nat.succ_pos _
| false => exact Nat.succ_pos 0
| nonneg _ => exact Nat.succ_pos 0
| le1 _ => exact Nat.succ_pos 0
| add _ _ _ _ => exact Nat.succ_pos _
| mul _ _ _ => exact Nat.succ_pos _
| div _ _ _ _ _ => exact Nat.succ_pos _
theorem compile_wf (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) :
forall (L : Line) (p : CPProof m F L), WFc (compile m F Q isA p) := by
intro L p
induction p with
| ax L h =>
show WFc (selC (isA L) _ _)
cases isA L with
| true => exact linG_wf _ _ _ m
| false => exact And.intro True.intro True.intro
| nonneg _ => exact And.intro True.intro True.intro
| le1 _ => exact And.intro True.intro True.intro
| add A B p q ihp ihq =>
refine And.intro ?_ (wfc_app _ ihq _ ihp)
have hp := compile_pos m F Q isA A p
have hq := compile_pos m F Q isA B q
show 0 < (compile m F Q isA p ++ compile m F Q isA q).length /\
(compile m F Q isA p).length < (compile m F Q isA p ++ compile m F Q isA q).length
rw [len_app]
exact And.intro (Nat.lt_of_lt_of_le hp (Nat.le_add_right _ _)) (Nat.add_le_add_left hq _)
| mul k A p ih =>
have hp := compile_pos m F Q isA A p
exact And.intro (And.intro hp hp) ih
| div c A B p h ih =>
have hp := compile_pos m F Q isA A p
exact And.intro (And.intro hp hp) ih
/-- The output of the circuit at the shared assignment ap is the interpolant. -/
theorem compile_val (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) (ap : Nat -> Bool) :
forall (L : Line) (p : CPProof m F L), outV ap (compile m F Q isA p) = interp m F Q isA ap p := by
intro L p
induction p with
| ax L h =>
cases eA : isA L with
| true =>
have ec : compile m F Q isA (CPProof.ax L h) = linG (kap Q L.P) L.d L.e m := by
show selC (isA L) _ _ = _
rw [eA]; rfl
have ei : interp m F Q isA ap (CPProof.ax L h) = (vS m (nQ Q) L.P ap + L.d, L.e) := by
show selP (isA L) _ _ = _
rw [eA]; rfl
have es : sumI (fun t => kap Q L.P t * bv (ap t)) m = vS m (nQ Q) L.P ap :=
sumI_ext _ _ (fun t => mul_assoc' _ _ _) m
show nthV (evalR ap (compile m F Q isA (CPProof.ax L h))) 0 = _
rw [ec, ei, linG_val, es, Nat.add_comm L.d]
| false =>
have ec : compile m F Q isA (CPProof.ax L h) = [Gate.cst (0, 0)] := by
show selC (isA L) _ _ = _
rw [eA]; rfl
have ei : interp m F Q isA ap (CPProof.ax L h) = (0, 0) := by
show selP (isA L) _ _ = _
rw [eA]; rfl
show nthV (evalR ap (compile m F Q isA (CPProof.ax L h))) 0 = _
rw [ec, ei]
rfl
| nonneg _ => rfl
| le1 _ => rfl
| add A B p q ihp ihq =>
have hp := compile_pos m F Q isA A p
have e1 : nthV (evalR ap (compile m F Q isA p) ++ evalR ap (compile m F Q isA q)) 0 =
nthV (evalR ap (compile m F Q isA p)) 0 :=
nthV_app_lt _ _ 0 (by rw [evalR_len]; exact hp)
have e2 : nthV (evalR ap (compile m F Q isA p) ++ evalR ap (compile m F Q isA q)) (compile m F Q isA p).length =
nthV (evalR ap (compile m F Q isA q)) 0 := by
have t := nthV_app_len (evalR ap (compile m F Q isA p)) (evalR ap (compile m F Q isA q)) 0
rw [evalR_len] at t
exact t
show addf (nthV (evalR ap (compile m F Q isA p ++ compile m F Q isA q)) 0)
(nthV (evalR ap (compile m F Q isA p ++ compile m F Q isA q)) (compile m F Q isA p).length) = _
rw [evalR_app ap _ _ (compile_wf m F Q isA A p), e1, e2]
have ihp' : nthV (evalR ap (compile m F Q isA p)) 0 = interp m F Q isA ap p := ihp
have ihq' : nthV (evalR ap (compile m F Q isA q)) 0 = interp m F Q isA ap q := ihq
rw [ihp', ihq']
rfl
| mul k A p ih =>
have ih' : nthV (evalR ap (compile m F Q isA p)) 0 = interp m F Q isA ap p := ih
show mulf k (nthV (evalR ap (compile m F Q isA p)) 0) (nthV (evalR ap (compile m F Q isA p)) 0) = _
rw [ih']
rfl
| div c A B p h ih =>
have ih' : nthV (evalR ap (compile m F Q isA p)) 0 = interp m F Q isA ap p := ih
show divf (c - 1) (nthV (evalR ap (compile m F Q isA p)) 0) (nthV (evalR ap (compile m F Q isA p)) 0) = _
rw [ih']
rfl
theorem one_le_odd (m : Nat) : 1 <= (2 * m + 1) * 1 := by
rw [mul_one']
exact Nat.le_add_left 1 (2 * m)
/-- Size: at most (2 m + 1) gates per proof line. -/
theorem compile_len (m : Nat) (F : List Line) (Q : Nat -> Bool) (isA : Line -> Bool) :
forall (L : Line) (p : CPProof m F L), (compile m F Q isA p).length <= (2 * m + 1) * p.size := by
intro L p
induction p with
| ax L h =>
show (selC (isA L) _ _).length <= (2 * m + 1) * 1
cases isA L with
| true =>
show (linG _ _ _ m).length <= _
rw [linG_len, mul_one']
exact Nat.le_refl _
| false => exact one_le_odd m
| nonneg _ => exact one_le_odd m
| le1 _ => exact one_le_odd m
| add A B p q ihp ihq =>
show (compile m F Q isA p ++ compile m F Q isA q).length + 1 <= (2 * m + 1) * (p.size + q.size + 1)
rw [len_app, mul_add', mul_add']
exact Nat.add_le_add (Nat.add_le_add ihp ihq) (one_le_odd m)
| mul k A p ih =>
show (compile m F Q isA p).length + 1 <= (2 * m + 1) * (p.size + 1)
rw [mul_add']
exact Nat.add_le_add ih (one_le_odd m)
| div c A B p h ih =>
show (compile m F Q isA p).length + 1 <= (2 * m + 1) * (p.size + 1)
rw [mul_add']
exact Nat.add_le_add ih (one_le_odd m)
end Found.Pnp114
#print axioms Found.Pnp114.evalR_len
#print axioms Found.Pnp114.nthV_app_lt
#print axioms Found.Pnp114.nthV_app_len
#print axioms Found.Pnp114.gval_app
#print axioms Found.Pnp114.evalR_app
#print axioms Found.Pnp114.addmul_mono
#print axioms Found.Pnp114.addf_mono
#print axioms Found.Pnp114.mulf_mono
#print axioms Found.Pnp114.divf_mono
#print axioms Found.Pnp114.linG_len
#print axioms Found.Pnp114.linG_wf
#print axioms Found.Pnp114.linG_val
#print axioms Found.Pnp114.len_app
#print axioms Found.Pnp114.refsLt_mono
#print axioms Found.Pnp114.wfc_app
#print axioms Found.Pnp114.mul_one'
#print axioms Found.Pnp114.compile_pos
#print axioms Found.Pnp114.compile_wf
#print axioms Found.Pnp114.compile_val
#print axioms Found.Pnp114.one_le_odd
#print axioms Found.Pnp114.compile_len
lean_all/found/Pnp115.lean
/-
T330 piece 115. found/Pnp115 -- the sunflower lemma (Erdos--Rado), the combinatorial tool of
the approximation method for the monotone real circuit lower bound (proof complexity ladder,
step 2: cutting planes).
Sets are Boolean functions on the ground set {0, ..., m-1}. The lemma is proved for families
above a base set B: every member contains B, the parts outside B are nonempty with at most l
elements, and the members are pairwise different. If such a family has more than Sb q l
members, where Sb q 0 = 0 and Sb q (l+1) = q (l+1) (Sb q l + 1), then q + 1 of its members
form a sunflower: pairwise different, with one common pairwise intersection (the core).
Proof: a greedy pairwise disjoint subfamily (outside B); if it has q + 1 members they form a
sunflower with core B; otherwise its union has at most q (l+1) points, every member meets it,
so one point x lies in more than Sb q l + 1 members, and the family of those members above
B + {x} (at most one of them is exactly B + {x}) gives the sunflower by induction. Proved:
* mem_filt, pw_filt, mem_take, pw_take, len_take, pw_imp: lists;
* grd_mem, grd_keep, grd_pw, grd_cov: the greedy disjoint subfamily;
* swapS, mul_lsum, sumI_mul_r, lsum_const_le, sumI_pos: counting;
* findx: a point with a large count, or a uniform bound;
* card_split, cnt_le_one, fixed_set: the induction step's size and count;
* sunflower: the lemma.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp114
namespace Found.Pnp115
open Found.Pnp65 (bv anyI anyI_true anyI_false or_true_r)
open Found.Pnp95 (sumI)
open Found.Pnp96 (anyI_ex sumI_le)
open Found.Pnp97 (sumI_add sumI_ext sumI_zero zero_mul')
open Found.Pnp98 (mul_add' add_mul' mul_le_r)
open Found.Pnp99 (mul_le_l')
open Found.Pnp106 (sumI_ext_lt)
/-- Pairwise relation along a list (each element with every later one). -/
def Pw {α : Type} (R : α -> α -> Prop) : List α -> Prop
| [] => True
| a :: l => (forall b, b ∈ l -> R a b) /\ Pw R l
def SetEq (m : Nat) (S T : Nat -> Bool) : Prop := forall i, i < m -> S i = T i
def SubB (m : Nat) (B S : Nat -> Bool) : Prop := forall i, i < m -> B i = true -> S i = true
/-- The part of S outside B. -/
def dif (B S : Nat -> Bool) (i : Nat) : Bool := S i && !(B i)
def nonE (m : Nat) (B S : Nat -> Bool) : Bool := anyI (dif B S) m
def card (m : Nat) (S : Nat -> Bool) : Nat := sumI (fun i => bv (S i)) m
/-- S and T meet outside B. -/
def meets (m : Nat) (B S T : Nat -> Bool) : Bool := anyI (fun i => dif B S i && dif B T i) m
def Sunflower (m : Nat) (C : Nat -> Bool) (W : List (Nat -> Bool)) : Prop :=
Pw (fun S T => (forall i, i < m -> (S i && T i) = C i) /\ Not (SetEq m S T)) W
def Sb (q : Nat) : Nat -> Nat
| 0 => 0
| l + 1 => q * (l + 1) * (Sb q l + 1)
/-! Lists. -/
def lsum {α : Type} (h : α -> Nat) : List α -> Nat
| [] => 0
| a :: l => h a + lsum h l
def consB {α : Type} (b : Bool) (a : α) (l : List α) : List α :=
match b with
| true => a :: l
| false => l
def filt {α : Type} (r : α -> Bool) : List α -> List α
| [] => []
| a :: l => consB (r a) a (filt r l)
def takeL {α : Type} : Nat -> List α -> List α
| 0, _ => []
| _ + 1, [] => []
| n + 1, a :: l => a :: takeL n l
def anyL {α : Type} (g : α -> Bool) : List α -> Bool
| [] => false
| a :: l => g a || anyL g l
theorem mem_cons_cases {α : Type} {x a : α} {l : List α} (h : x ∈ a :: l) : x = a \/ x ∈ l := by
cases h with
| head => exact Or.inl rfl
| tail _ h2 => exact Or.inr h2
theorem mem_filt {α : Type} (r : α -> Bool) (x : α) : forall L : List α, x ∈ filt r L -> x ∈ L /\ r x = true
| [], h => nomatch h
| a :: l, h => by
cases e : r a with
| true =>
have t : filt r (a :: l) = a :: filt r l := congrArg (fun b => consB b a (filt r l)) e
rw [t] at h
cases mem_cons_cases h with
| inl q => rw [q]; exact And.intro (List.Mem.head l) e
| inr h2 => exact And.intro (List.Mem.tail a (mem_filt r x l h2).1) (mem_filt r x l h2).2
| false =>
have t : filt r (a :: l) = filt r l := congrArg (fun b => consB b a (filt r l)) e
rw [t] at h
exact And.intro (List.Mem.tail a (mem_filt r x l h).1) (mem_filt r x l h).2
theorem pw_filt {α : Type} (R : α -> α -> Prop) (r : α -> Bool) : forall L : List α, Pw R L -> Pw R (filt r L)
| [], _ => True.intro
| a :: l, h => by
cases e : r a with
| true =>
have t : filt r (a :: l) = a :: filt r l := congrArg (fun b => consB b a (filt r l)) e
rw [t]
exact And.intro (fun b hb => h.1 b (mem_filt r b l hb).1) (pw_filt R r l h.2)
| false =>
have t : filt r (a :: l) = filt r l := congrArg (fun b => consB b a (filt r l)) e
rw [t]
exact pw_filt R r l h.2
theorem mem_take {α : Type} (x : α) : forall (n : Nat) (L : List α), x ∈ takeL n L -> x ∈ L
| 0, _, h => nomatch h
| _ + 1, [], h => nomatch h
| n + 1, a :: l, h => by
cases mem_cons_cases h with
| inl q => rw [q]; exact List.Mem.head l
| inr h2 => exact List.Mem.tail a (mem_take x n l h2)
theorem pw_take {α : Type} (R : α -> α -> Prop) : forall (n : Nat) (L : List α), Pw R L -> Pw R (takeL n L)
| 0, _, _ => True.intro
| _ + 1, [], _ => True.intro
| n + 1, _ :: l, h => And.intro (fun b hb => h.1 b (mem_take b n l hb)) (pw_take R n l h.2)
theorem len_take {α : Type} : forall (n : Nat) (L : List α), n <= L.length -> (takeL n L).length = n
| 0, _, _ => rfl
| _ + 1, [], h => absurd h (Nat.not_succ_le_zero _)
| n + 1, _ :: l, h => congrArg (· + 1) (len_take n l (Nat.le_of_succ_le_succ h))
theorem pw_imp {α : Type} (R R' : α -> α -> Prop) : forall L : List α,
(forall a b, a ∈ L -> b ∈ L -> R a b -> R' a b) -> Pw R L -> Pw R' L
| [], _, _ => True.intro
| a :: l, hi, h => And.intro
(fun b hb => hi a b (List.Mem.head l) (List.Mem.tail a hb) (h.1 b hb))
(pw_imp R R' l (fun x y hx hy => hi x y (List.Mem.tail a hx) (List.Mem.tail a hy)) h.2)
theorem anyL_true {α : Type} (g : α -> Bool) (x : α) (hx : g x = true) : forall L : List α, x ∈ L -> anyL g L = true
| [], h => nomatch h
| a :: l, h => by
cases mem_cons_cases h with
| inl q =>
rw [<- q]
exact congrArg (· || anyL g l) hx
| inr h2 =>
show (g a || anyL g l) = true
rw [anyL_true g x hx l h2]
exact or_true_r _
theorem bv_or_le (a b : Bool) : bv (a || b) <= bv a + bv b := by
cases a <;> cases b <;> first | exact Nat.le_refl _ | exact Nat.zero_le _ | exact Nat.le_succ _
theorem bv_anyL_le {α : Type} (g : α -> Bool) : forall L : List α, bv (anyL g L) <= lsum (fun a => bv (g a)) L
| [] => Nat.le_refl 0
| a :: l => Nat.le_trans (bv_or_le (g a) (anyL g l)) (Nat.add_le_add_left (bv_anyL_le g l) _)
/-! Counting. -/
theorem one_mul' : forall c : Nat, 1 * c = c
| 0 => rfl
| c + 1 => congrArg (· + 1) (one_mul' c)
theorem len_lsum {α : Type} : forall L : List α, L.length = lsum (fun _ => 1) L
| [] => rfl
| _ :: l => by
show l.length + 1 = 1 + lsum (fun _ => 1) l
rw [len_lsum l, Nat.add_comm]
theorem lsum_le {α : Type} (h h' : α -> Nat) : forall L : List α, (forall a, a ∈ L -> h a <= h' a) -> lsum h L <= lsum h' L
| [], _ => Nat.le_refl 0
| a :: l, hl => Nat.add_le_add (hl a (List.Mem.head l)) (lsum_le h h' l (fun b hb => hl b (List.Mem.tail a hb)))
theorem swapS {α : Type} (f : α -> Nat -> Nat) (k : Nat) : forall L : List α,
sumI (fun i => lsum (fun a => f a i) L) k = lsum (fun a => sumI (f a) k) L
| [] => sumI_zero k
| a :: l => by
show sumI (fun i => f a i + lsum (fun a => f a i) l) k = sumI (f a) k + lsum (fun a => sumI (f a) k) l
rw [sumI_add (fun i => f a i) (fun i => lsum (fun a => f a i) l) k, swapS f k l]
theorem mul_lsum {α : Type} (c : Nat) (h : α -> Nat) : forall L : List α, c * lsum h L = lsum (fun a => c * h a) L
| [] => rfl
| a :: l => by
show c * (h a + lsum h l) = c * h a + lsum (fun a => c * h a) l
rw [mul_add', mul_lsum c h l]
theorem sumI_mul_r (h : Nat -> Nat) (M : Nat) : forall k, sumI (fun i => h i * M) k = sumI h k * M
| 0 => (zero_mul' M).symm
| k + 1 => by
show sumI (fun i => h i * M) k + h k * M = (sumI h k + h k) * M
rw [sumI_mul_r h M k, add_mul']
theorem lsum_const_le {α : Type} (h : α -> Nat) (c : Nat) : forall L : List α, (forall a, a ∈ L -> h a <= c) ->
lsum h L <= L.length * c
| [], _ => Nat.zero_le _
| a :: l, hl => by
show h a + lsum h l <= (l.length + 1) * c
rw [add_mul', one_mul', Nat.add_comm (l.length * c)]
exact Nat.add_le_add (hl a (List.Mem.head l)) (lsum_const_le h c l (fun b hb => hl b (List.Mem.tail a hb)))
theorem lt_succ_cases {i k : Nat} (h : i < k + 1) : i < k \/ i = k := by
cases Nat.lt_or_ge i k with
| inl l => exact Or.inl l
| inr g => exact Or.inr (Nat.le_antisymm (Nat.le_of_lt_succ h) g)
theorem sumI_pos (h : Nat -> Nat) (j : Nat) (hj : 1 <= h j) : forall k, j < k -> 1 <= sumI h k
| 0, hk => absurd hk (Nat.not_succ_le_zero j)
| k + 1, hk => by
show 1 <= sumI h k + h k
cases lt_succ_cases hk with
| inl l => exact Nat.le_trans (sumI_pos h j hj k l) (Nat.le_add_right _ _)
| inr e => rw [<- e]; exact Nat.le_trans hj (Nat.le_add_left _ _)
theorem findx (g : Nat -> Bool) (c : Nat -> Nat) (M : Nat) : forall k,
(Exists fun i => i < k /\ g i = true /\ M < c i) \/ (forall i, i < k -> g i = true -> c i <= M)
| 0 => Or.inr (fun i hi _ => absurd hi (Nat.not_succ_le_zero i))
| k + 1 => by
cases findx g c M k with
| inl ex =>
cases ex with
| intro i hi => exact Or.inl (Exists.intro i (And.intro (Nat.lt_succ_of_lt hi.1) hi.2))
| inr al =>
cases eg : g k with
| false =>
refine Or.inr (fun i hi hg => ?_)
cases lt_succ_cases hi with
| inl l => exact al i l hg
| inr e => rw [e, eg] at hg; exact Bool.noConfusion hg
| true =>
cases Nat.lt_or_ge M (c k) with
| inl l => exact Or.inl (Exists.intro k (And.intro (Nat.lt_succ_self k) (And.intro eg l)))
| inr g' =>
refine Or.inr (fun i hi hg => ?_)
cases lt_succ_cases hi with
| inl l => exact al i l hg
| inr e => rw [e]; exact g'
/-! The greedy disjoint subfamily. -/
def allDj (m : Nat) (B S : Nat -> Bool) : List (Nat -> Bool) -> Bool
| [] => true
| T :: K => !(meets m B S T) && allDj m B S K
def cIf (b : Bool) (S : Nat -> Bool) (K : List (Nat -> Bool)) : List (Nat -> Bool) :=
match b with
| true => S :: K
| false => K
def grd (m : Nat) (B : Nat -> Bool) : List (Nat -> Bool) -> List (Nat -> Bool) -> List (Nat -> Bool)
| [], K => K
| S :: L, K => grd m B L (cIf (allDj m B S K) S K)
def Dj (m : Nat) (B : Nat -> Bool) (S T : Nat -> Bool) : Prop := meets m B S T = false
theorem allDj_true (m : Nat) (B S : Nat -> Bool) : forall K : List (Nat -> Bool), allDj m B S K = true ->
forall T, T ∈ K -> meets m B S T = false
| [], _, _, hT => nomatch hT
| T' :: K, h, T, hT => by
have h' : (!(meets m B S T') && allDj m B S K) = true := h
cases e1 : meets m B S T' with
| true => rw [e1] at h'; exact Bool.noConfusion h'
| false =>
rw [e1] at h'
cases mem_cons_cases hT with
| inl q => rw [q]; exact e1
| inr h2 => exact allDj_true m B S K h' T h2
theorem allDj_false (m : Nat) (B S : Nat -> Bool) : forall K : List (Nat -> Bool), allDj m B S K = false ->
Exists fun T => T ∈ K /\ meets m B S T = true
| [], h => Bool.noConfusion h
| T' :: K, h => by
have h' : (!(meets m B S T') && allDj m B S K) = false := h
cases e1 : meets m B S T' with
| true => exact Exists.intro T' (And.intro (List.Mem.head K) e1)
| false =>
rw [e1] at h'
cases allDj_false m B S K h' with
| intro T hT => exact Exists.intro T (And.intro (List.Mem.tail T' hT.1) hT.2)
theorem cIf_keep (b : Bool) (S T : Nat -> Bool) (K : List (Nat -> Bool)) (h : T ∈ K) : T ∈ cIf b S K := by
cases b with
| true => exact List.Mem.tail S h
| false => exact h
theorem grd_keep (m : Nat) (B : Nat -> Bool) : forall (L K : List (Nat -> Bool)) (T : Nat -> Bool), T ∈ K -> T ∈ grd m B L K
| [], _, _, h => h
| S :: L, K, T, h => grd_keep m B L _ T (cIf_keep _ S T K h)
theorem grd_mem (m : Nat) (B : Nat -> Bool) : forall (L K : List (Nat -> Bool)) (T : Nat -> Bool), T ∈ grd m B L K ->
T ∈ L \/ T ∈ K
| [], _, _, h => Or.inr h
| S :: L, K, T, h => by
cases grd_mem m B L _ T h with
| inl l => exact Or.inl (List.Mem.tail S l)
| inr k =>
cases e : allDj m B S K with
| true =>
have t : cIf (allDj m B S K) S K = S :: K := congrArg (fun b => cIf b S K) e
rw [t] at k
cases mem_cons_cases k with
| inl q => rw [q]; exact Or.inl (List.Mem.head L)
| inr k2 => exact Or.inr k2
| false =>
have t : cIf (allDj m B S K) S K = K := congrArg (fun b => cIf b S K) e
rw [t] at k
exact Or.inr k
theorem grd_pw (m : Nat) (B : Nat -> Bool) : forall (L K : List (Nat -> Bool)), Pw (Dj m B) K -> Pw (Dj m B) (grd m B L K)
| [], _, h => h
| S :: L, K, h => by
refine grd_pw m B L _ ?_
cases e : allDj m B S K with
| true => exact And.intro (fun T hT => allDj_true m B S K e T hT) h
| false => exact h
theorem meets_self (m : Nat) (B S : Nat -> Bool) (h : nonE m B S = true) : meets m B S S = true := by
cases anyI_ex (dif B S) m h with
| intro j hj =>
refine anyI_true _ j ?_ m hj.1
exact congrArg (fun b => b && b) hj.2
theorem grd_cov (m : Nat) (B : Nat -> Bool) : forall (L K : List (Nat -> Bool)) (S : Nat -> Bool), S ∈ L ->
nonE m B S = true -> Exists fun T => T ∈ grd m B L K /\ meets m B S T = true
| [], _, _, h, _ => nomatch h
| S' :: L, K, S, h, hn => by
cases mem_cons_cases h with
| inr h2 => exact grd_cov m B L _ S h2 hn
| inl e =>
rw [e] at hn
rw [e]
cases e2 : allDj m B S' K with
| true =>
have t : cIf (allDj m B S' K) S' K = S' :: K := congrArg (fun b => cIf b S' K) e2
refine Exists.intro S' (And.intro ?_ (meets_self m B S' hn))
show S' ∈ grd m B L (cIf (allDj m B S' K) S' K)
rw [t]
exact grd_keep m B L _ S' (List.Mem.head K)
| false =>
cases allDj_false m B S' K e2 with
| intro T hT => exact Exists.intro T (And.intro (grd_keep m B L _ T (cIf_keep _ S' T K hT.1)) hT.2)
/-! Pieces of the main step. -/
theorem core_bool (s t b : Bool) (hs : b = true -> s = true) (ht : b = true -> t = true)
(hd : ((s && !b) && (t && !b)) = false) : (s && t) = b := by
cases s <;> cases t <;> cases b <;>
first | rfl | exact Bool.noConfusion (hs rfl) | exact Bool.noConfusion (ht rfl) | exact Bool.noConfusion hd
theorem and_true_l {a b : Bool} (h : (a && b) = true) : a = true := by
cases a with
| false => exact Bool.noConfusion h
| true => rfl
theorem and_true_r {a b : Bool} (h : (a && b) = true) : b = true := by
cases a with
| false => exact Bool.noConfusion h
| true => exact h
/-- Disjoint (outside B) members above B form a sunflower with core B. -/
theorem dj_sun (m : Nat) (B : Nat -> Bool) (S T : Nat -> Bool) (hS : SubB m B S) (hT : SubB m B T)
(hn : nonE m B S = true) (hd : Dj m B S T) :
(forall i, i < m -> (S i && T i) = B i) /\ Not (SetEq m S T) := by
refine And.intro (fun i hi => ?_) (fun he => ?_)
· exact core_bool (S i) (T i) (B i) (hS i hi) (hT i hi) (anyI_false _ m hd i hi)
· cases anyI_ex (dif B S) m hn with
| intro j hj =>
have hj' : dif B T j = true := by
show (T j && !(B j)) = true
rw [<- he j hj.1]; exact hj.2
have t : meets m B S T = true := by
refine anyI_true _ j ?_ m hj.1
show (dif B S j && dif B T j) = true
rw [hj.2, hj']
try rfl
rw [hd] at t
exact Bool.noConfusion t
theorem beq_eq : forall a b : Nat, Nat.beq a b = true -> a = b
| 0, 0, _ => rfl
| 0, _ + 1, h => Bool.noConfusion h
| _ + 1, 0, h => Bool.noConfusion h
| a + 1, b + 1, h => congrArg (· + 1) (beq_eq a b h)
theorem beq_self : forall a : Nat, Nat.beq a a = true
| 0 => rfl
| a + 1 => beq_self a
/-- The new base B + {x}. -/
def addB (B : Nat -> Bool) (x : Nat) (i : Nat) : Bool := B i || Nat.beq i x
theorem sumI_one_more (f g : Nat -> Nat) (x : Nat) (hf : f x = 1) (hg : g x = 0)
(he : forall i, Nat.beq i x = false -> f i = g i) : forall k, x < k -> sumI f k = sumI g k + 1
| 0, h => absurd h (Nat.not_succ_le_zero x)
| k + 1, h => by
show sumI f k + f k = sumI g k + g k + 1
cases lt_succ_cases h with
| inl l =>
have ek : f k = g k := by
apply he
cases e : Nat.beq k x with
| false => rfl
| true =>
have q := beq_eq k x e
rw [q] at l
exact absurd l (Nat.lt_irrefl x)
rw [sumI_one_more f g x hf hg he k l, ek, Nat.add_right_comm]
| inr e =>
have es : sumI f k = sumI g k := by
refine sumI_ext_lt f g k (fun i hi => he i ?_)
cases eb : Nat.beq i x with
| false => rfl
| true =>
have q := beq_eq i x eb
rw [q, e] at hi
exact absurd hi (Nat.lt_irrefl k)
rw [es, <- e, hf, hg]
try rfl
theorem card_split (m : Nat) (B S : Nat -> Bool) (x : Nat) (hx : x < m) (hS : dif B S x = true) :
card m (dif B S) = card m (dif (addB B x) S) + 1 := by
show sumI (fun i => bv (dif B S i)) m = sumI (fun i => bv (dif (addB B x) S i)) m + 1
refine sumI_one_more _ _ x ?_ ?_ ?_ m hx
· exact congrArg bv hS
· show bv (S x && !(B x || Nat.beq x x)) = 0
rw [beq_self x, or_true_r]
cases S x <;> rfl
· intro i hi
show bv (S i && !(B i)) = bv (S i && !(B i || Nat.beq i x))
rw [hi]
cases B i <;> rfl
theorem lsum_zero_of {α : Type} (h : α -> Nat) : forall L : List α, (forall a, a ∈ L -> h a = 0) -> lsum h L = 0
| [], _ => rfl
| a :: l, hl => by
show h a + lsum h l = 0
rw [hl a (List.Mem.head l), lsum_zero_of h l (fun b hb => hl b (List.Mem.tail a hb))]
/-- At most one member of a family of pairwise different sets satisfies a condition that fixes the set. -/
theorem cnt_le_one (m : Nat) (p : (Nat -> Bool) -> Bool) : forall L : List (Nat -> Bool),
Pw (fun S T => Not (SetEq m S T)) L ->
(forall S T, S ∈ L -> T ∈ L -> p S = true -> p T = true -> SetEq m S T) -> lsum (fun S => bv (p S)) L <= 1
| [], _, _ => Nat.zero_le 1
| S :: L, hd, hp => by
show bv (p S) + lsum (fun S => bv (p S)) L <= 1
cases e : p S with
| false =>
show 0 + _ <= 1
rw [Nat.zero_add]
exact cnt_le_one m p L hd.2 (fun a b ha hb => hp a b (List.Mem.tail S ha) (List.Mem.tail S hb))
| true =>
have z : lsum (fun S => bv (p S)) L = 0 := lsum_zero_of _ L (fun T hT => by
cases eT : p T with
| false => rfl
| true => exact absurd (hp S T (List.Mem.head L) (List.Mem.tail S hT) e eT) (hd.1 T hT))
exact Nat.le_of_eq (congrArg (bv true + ·) z)
theorem lsum_filt {α : Type} (r : α -> Bool) : forall L : List α, (filt r L).length = lsum (fun a => bv (r a)) L
| [] => rfl
| a :: l => by
cases e : r a with
| true =>
have t : filt r (a :: l) = a :: filt r l := congrArg (fun b => consB b a (filt r l)) e
rw [t]
show (filt r l).length + 1 = bv (r a) + lsum (fun a => bv (r a)) l
rw [lsum_filt r l, e]
exact Nat.add_comm _ _
| false =>
have t : filt r (a :: l) = filt r l := congrArg (fun b => consB b a (filt r l)) e
rw [t]
show (filt r l).length = bv (r a) + lsum (fun a => bv (r a)) l
rw [lsum_filt r l, e]
exact (Nat.zero_add _).symm
theorem bv_split (a b : Bool) : bv a = bv (a && b) + bv (a && !b) := by
cases a <;> cases b <;> rfl
theorem lsum_split {α : Type} (p q : α -> Bool) (L : List α) :
lsum (fun a => bv (p a)) L = lsum (fun a => bv (p a && q a)) L + lsum (fun a => bv (p a && !(q a))) L := by
induction L with
| nil => rfl
| cons a l ih =>
show bv (p a) + lsum (fun a => bv (p a)) l =
(bv (p a && q a) + lsum (fun a => bv (p a && q a)) l) + (bv (p a && !(q a)) + lsum (fun a => bv (p a && !(q a))) l)
rw [ih, bv_split (p a) (q a), Found.Pnp93.add4]
/-- A member above B containing x with nothing outside B + {x} is B + {x}. -/
theorem fixed_set (m : Nat) (B S : Nat -> Bool) (x : Nat) (hS : SubB m B S) (hx : S x = true)
(he : nonE m (addB B x) S = false) : forall i, i < m -> S i = addB B x i := by
intro i hi
have z : (S i && !(B i || Nat.beq i x)) = false := anyI_false _ m he i hi
show S i = (B i || Nat.beq i x)
cases eB : B i with
| true => rw [hS i hi eB]; rfl
| false =>
cases eb : Nat.beq i x with
| true => rw [beq_eq i x eb]; exact hx
| false =>
rw [eB, eb] at z
cases eS : S i with
| false => rfl
| true => rw [eS] at z; exact Bool.noConfusion z
/-! The lemma. -/
theorem sunflower (m q : Nat) : forall (l : Nat) (B : Nat -> Bool) (F : List (Nat -> Bool)),
(forall S, S ∈ F -> SubB m B S) -> Pw (fun S T => Not (SetEq m S T)) F ->
(forall S, S ∈ F -> nonE m B S = true /\ card m (dif B S) <= l) -> Sb q l < F.length ->
Exists fun W : List (Nat -> Bool) => Exists fun C : Nat -> Bool =>
Sunflower m C W /\ W.length = q + 1 /\ (forall S, S ∈ W -> S ∈ F)
| 0, B, F, _, _, hsz, hlen => by
cases F with
| nil => exact absurd hlen (Nat.lt_irrefl 0)
| cons S F =>
have h := hsz S (List.Mem.head F)
cases anyI_ex (dif B S) m h.1 with
| intro j hj =>
have p := sumI_pos (fun i => bv (dif B S i)) j (Nat.le_of_eq (congrArg bv hj.2).symm) m hj.1
exact absurd (Nat.le_trans p h.2) (Nat.not_succ_le_zero 0)
| l + 1, B, F, hsub, hdis, hsz, hlen => by
have hK := grd_pw m B F [] True.intro
have inF : forall S, S ∈ grd m B F [] -> S ∈ F := fun S hS => by
cases grd_mem m B F [] S hS with
| inl a => exact a
| inr b => exact nomatch b
cases Nat.lt_or_ge q (grd m B F []).length with
| inl big =>
-- q + 1 pairwise disjoint members: a sunflower with core B
refine Exists.intro (takeL (q + 1) (grd m B F [])) (Exists.intro B (And.intro ?_ (And.intro ?_ ?_)))
· refine pw_imp (Dj m B) _ _ ?_ (pw_take (Dj m B) (q + 1) _ hK)
intro S T hS hT hd
have hS' := inF S (mem_take S _ _ hS)
have hT' := inF T (mem_take T _ _ hT)
exact dj_sun m B S T (hsub S hS') (hsub T hT') (hsz S hS').1 hd
· exact len_take (q + 1) _ big
· intro S hS
exact inF S (mem_take S _ _ hS)
| inr small =>
let K := grd m B F []
let U : Nat -> Bool := fun i => anyL (fun T => dif B T i) K
let cnt : Nat -> Nat := fun i => lsum (fun S => bv (dif B S i)) F
cases findx U cnt (Sb q l + 1) m with
| inr al =>
-- every point of the union is in at most Sb q l + 1 members: too few members
have hA : F.length <= sumI (fun i => bv (U i) * cnt i) m := by
rw [len_lsum F]
have t : lsum (fun _ => 1) F <= lsum (fun S => sumI (fun i => bv (U i) * bv (dif B S i)) m) F := by
refine lsum_le _ _ F (fun S hS => ?_)
cases grd_cov m B F [] S hS (hsz S hS).1 with
| intro T hT =>
cases anyI_ex _ m hT.2 with
| intro j hj =>
refine sumI_pos _ j ?_ m hj.1
have d1 : dif B S j = true := and_true_l hj.2
have d2 : dif B T j = true := and_true_r hj.2
have u : U j = true := anyL_true (fun T => dif B T j) T d2 K hT.1
exact Nat.le_of_eq (congr (congrArg (fun a b => bv a * bv b) u) d1).symm
refine Nat.le_trans t (Nat.le_of_eq (Eq.trans (swapS (fun S i => bv (U i) * bv (dif B S i)) m F).symm ?_))
exact sumI_ext _ _ (fun i => (mul_lsum (bv (U i)) (fun S => bv (dif B S i)) F).symm) m
have hC : sumI (fun i => bv (U i) * cnt i) m <= sumI (fun i => bv (U i)) m * (Sb q l + 1) := by
rw [<- sumI_mul_r]
refine sumI_le _ _ m (fun i hi => ?_)
cases eU : U i with
| false => show 0 * cnt i <= 0 * (Sb q l + 1); rw [zero_mul', zero_mul']; exact Nat.le_refl 0
| true => exact mul_le_l' (al i hi eU) (bv true)
have hB : sumI (fun i => bv (U i)) m <= q * (l + 1) := by
have t1 : sumI (fun i => bv (U i)) m <= sumI (fun i => lsum (fun T => bv (dif B T i)) K) m :=
sumI_le _ _ m (fun i _ => bv_anyL_le (fun T => dif B T i) K)
have t1' := Nat.le_trans t1 (Nat.le_of_eq (swapS (fun T i => bv (dif B T i)) m K))
have t2 : lsum (fun T => sumI (fun i => bv (dif B T i)) m) K <= K.length * (l + 1) :=
lsum_const_le _ _ K (fun T hT => (hsz T (inF T hT)).2)
exact Nat.le_trans t1' (Nat.le_trans t2 (mul_le_r small (l + 1)))
have hall : F.length <= Sb q (l + 1) :=
Nat.le_trans hA (Nat.le_trans hC (mul_le_r hB (Sb q l + 1)))
exact absurd (Nat.lt_of_lt_of_le hlen hall) (Nat.lt_irrefl _)
| inl ex =>
cases ex with
| intro x hx =>
-- the members containing x, above B + {x}
let r : (Nat -> Bool) -> Bool := fun S => dif B S x && nonE m (addB B x) S
have hF' := sunflower m q l (addB B x) (filt r F)
(fun S hS => by
have h := mem_filt r S F hS
intro i hi hb
cases eB : B i with
| true => exact hsub S h.1 i hi eB
| false =>
have hb' : (B i || Nat.beq i x) = true := hb
rw [eB] at hb'
rw [beq_eq i x hb']
exact and_true_l (and_true_l h.2))
(pw_filt _ r F hdis)
(fun S hS => by
have h := mem_filt r S F hS
refine And.intro (and_true_r h.2) ?_
have e := card_split m B S x hx.1 (and_true_l h.2)
have t := (hsz S h.1).2
rw [e] at t
exact Nat.le_of_succ_le_succ t)
(by
show Sb q l < (filt r F).length
rw [lsum_filt r F]
have s := lsum_split (fun S => dif B S x) (fun S => nonE m (addB B x) S) F
have o : lsum (fun S => bv (dif B S x && !(nonE m (addB B x) S))) F <= 1 := by
refine cnt_le_one m (fun S => dif B S x && !(nonE m (addB B x) S)) F hdis ?_
intro S T hS hT hpS hpT
have fS := fixed_set m B S x (hsub S hS) (and_true_l (and_true_l hpS)) (Found.Pnp91.not_true (and_true_r hpS))
have fT := fixed_set m B T x (hsub T hT) (and_true_l (and_true_l hpT)) (Found.Pnp91.not_true (and_true_r hpT))
intro i hi
exact (fS i hi).trans (fT i hi).symm
have h1 : lsum (fun S => bv (dif B S x)) F <= lsum (fun a => bv (r a)) F + 1 :=
Nat.le_trans (Nat.le_of_eq s) (Nat.add_le_add_left o _)
exact Nat.lt_of_succ_lt_succ (Nat.lt_of_lt_of_le hx.2.2 h1))
cases hF' with
| intro W hW =>
cases hW with
| intro C hC =>
exact Exists.intro W (Exists.intro C (And.intro hC.1 (And.intro hC.2.1
(fun S hS => (mem_filt r S F (hC.2.2 S hS)).1))))
end Found.Pnp115
#print axioms Found.Pnp115.mem_cons_cases
#print axioms Found.Pnp115.mem_filt
#print axioms Found.Pnp115.pw_filt
#print axioms Found.Pnp115.mem_take
#print axioms Found.Pnp115.pw_take
#print axioms Found.Pnp115.len_take
#print axioms Found.Pnp115.pw_imp
#print axioms Found.Pnp115.anyL_true
#print axioms Found.Pnp115.bv_or_le
#print axioms Found.Pnp115.bv_anyL_le
#print axioms Found.Pnp115.one_mul'
#print axioms Found.Pnp115.len_lsum
#print axioms Found.Pnp115.lsum_le
#print axioms Found.Pnp115.swapS
#print axioms Found.Pnp115.mul_lsum
#print axioms Found.Pnp115.sumI_mul_r
#print axioms Found.Pnp115.lsum_const_le
#print axioms Found.Pnp115.lt_succ_cases
#print axioms Found.Pnp115.sumI_pos
#print axioms Found.Pnp115.findx
#print axioms Found.Pnp115.allDj_true
#print axioms Found.Pnp115.allDj_false
#print axioms Found.Pnp115.cIf_keep
#print axioms Found.Pnp115.grd_keep
#print axioms Found.Pnp115.grd_mem
#print axioms Found.Pnp115.grd_pw
#print axioms Found.Pnp115.meets_self
#print axioms Found.Pnp115.grd_cov
#print axioms Found.Pnp115.core_bool
#print axioms Found.Pnp115.and_true_l
#print axioms Found.Pnp115.and_true_r
#print axioms Found.Pnp115.dj_sun
#print axioms Found.Pnp115.beq_eq
#print axioms Found.Pnp115.beq_self
#print axioms Found.Pnp115.sumI_one_more
#print axioms Found.Pnp115.card_split
#print axioms Found.Pnp115.lsum_zero_of
#print axioms Found.Pnp115.cnt_le_one
#print axioms Found.Pnp115.lsum_filt
#print axioms Found.Pnp115.bv_split
#print axioms Found.Pnp115.lsum_split
#print axioms Found.Pnp115.fixed_set
#print axioms Found.Pnp115.sunflower
lean_all/found/Pnp116.lean
/-
T330 piece 116. found/Pnp116 -- the transversal tree of the monotone switching lemma
(Jukna, Boolean Function Complexity, Lemma 9.15; proof complexity ladder, step 2).
For a list C of sets (lists of variables), each with at most w elements, and a depth budget
d, the tree tr C d p grows the set p: if p pierces every member of C it is a leaf (first
list); with no budget left it is cut (second list); otherwise it branches on the variables of
the first member of C that p misses. Proved:
* tr_fst_pierce: every leaf pierces every member of C;
* tr_fst_len, tr_snd_len: leaves have fewer than |p| + d elements, cuts exactly |p| + d;
* tr_snd_count: there are at most w ^ d cuts;
* tr_complete: if y covers p and hits every member of C, then y covers some leaf or cut;
* leaf_hits: if y covers a set that pierces q, then y hits q.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp115
namespace Found.Pnp116
open Found.Pnp115 (anyL anyL_true mem_cons_cases and_true_l and_true_r beq_eq beq_self)
open Found.Pnp98 (mul_le_r)
open Found.Pnp65 (or_true_r)
def memN (v : Nat) : List Nat -> Bool
| [] => false
| a :: l => Nat.beq v a || memN v l
def allL (y : Nat -> Bool) : List Nat -> Bool
| [] => true
| a :: l => y a && allL y l
/-- p meets q. -/
def pierce (p q : List Nat) : Bool := anyL (fun v => memN v p) q
def selO (b : Bool) (q : List Nat) (o : Option (List Nat)) : Option (List Nat) :=
match b with
| true => o
| false => some q
/-- The first member of C that p misses. -/
def firstU (p : List Nat) : List (List Nat) -> Option (List Nat)
| [] => none
| q :: C => selO (pierce p q) q (firstU p C)
def app2 (a b : List (List Nat) × List (List Nat)) : List (List Nat) × List (List Nat) :=
(a.1 ++ b.1, a.2 ++ b.2)
def brs (f : Nat -> List (List Nat) × List (List Nat)) : List Nat -> List (List Nat) × List (List Nat)
| [] => ([], [])
| v :: q => app2 (f v) (brs f q)
def selT (o : Option (List Nat)) (p : List Nat) (g : List Nat -> List (List Nat) × List (List Nat)) :
List (List Nat) × List (List Nat) :=
match o with
| none => ([p], [])
| some q => g q
/-- The transversal tree: (leaves, cuts). -/
def tr (C : List (List Nat)) : Nat -> List Nat -> List (List Nat) × List (List Nat)
| 0, p => ([], [p])
| d + 1, p => selT (firstU p C) p (fun q => brs (fun v => tr C d (v :: p)) q)
/-! Lists. -/
theorem mem_app {α : Type} (x : α) : forall (A B : List α), x ∈ A ++ B -> x ∈ A \/ x ∈ B
| [], _, h => Or.inr h
| a :: A, B, h => by
cases mem_cons_cases h with
| inl q => rw [q]; exact Or.inl (List.Mem.head A)
| inr h2 =>
cases mem_app x A B h2 with
| inl l => exact Or.inl (List.Mem.tail a l)
| inr r => exact Or.inr r
theorem mem_app_l {α : Type} (x : α) (B : List α) : forall A : List α, x ∈ A -> x ∈ A ++ B
| [], h => nomatch h
| a :: A, h => by
cases mem_cons_cases h with
| inl q => rw [q]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail a (mem_app_l x B A h2)
theorem mem_app_r {α : Type} (x : α) (B : List α) : forall A : List α, x ∈ B -> x ∈ A ++ B
| [], h => h
| a :: A, h => List.Mem.tail a (mem_app_r x B A h)
theorem len_app {α : Type} : forall (A B : List α), (A ++ B).length = A.length + B.length
| [], B => (Nat.zero_add _).symm
| _ :: A, B => by
show (A ++ B).length + 1 = A.length + 1 + B.length
rw [len_app A B, Nat.add_right_comm]
theorem anyL_ex {α : Type} (g : α -> Bool) : forall L : List α, anyL g L = true -> Exists fun a => a ∈ L /\ g a = true
| [], h => Bool.noConfusion h
| a :: l, h => by
cases e : g a with
| true => exact Exists.intro a (And.intro (List.Mem.head l) e)
| false =>
have h' : (g a || anyL g l) = true := h
rw [e] at h'
cases anyL_ex g l h' with
| intro b hb => exact Exists.intro b (And.intro (List.Mem.tail a hb.1) hb.2)
theorem memN_mem : forall (v : Nat) (l : List Nat), memN v l = true -> v ∈ l
| _, [], h => Bool.noConfusion h
| v, a :: l, h => by
cases e : Nat.beq v a with
| true => rw [beq_eq v a e]; exact List.Mem.head l
| false =>
have h' : (Nat.beq v a || memN v l) = true := h
rw [e] at h'
exact List.Mem.tail a (memN_mem v l h')
theorem allL_mem (y : Nat -> Bool) : forall (l : List Nat) (v : Nat), allL y l = true -> v ∈ l -> y v = true
| [], _, _, h => nomatch h
| a :: l, v, h, hv => by
cases mem_cons_cases hv with
| inl q => rw [q]; exact and_true_l h
| inr h2 => exact allL_mem y l v (and_true_r h) h2
/-! The first missed member. -/
theorem firstU_none (p : List Nat) : forall C : List (List Nat), firstU p C = none -> forall q, q ∈ C -> pierce p q = true
| [], _, _, hq => nomatch hq
| q' :: C, h, q, hq => by
cases e : pierce p q' with
| false =>
have h' : selO (pierce p q') q' (firstU p C) = none := h
rw [e] at h'
cases h'
| true =>
have h' : selO (pierce p q') q' (firstU p C) = none := h
rw [e] at h'
cases mem_cons_cases hq with
| inl r => rw [r]; exact e
| inr h2 => exact firstU_none p C h' q h2
theorem firstU_some (p : List Nat) : forall (C : List (List Nat)) (q : List Nat), firstU p C = some q ->
q ∈ C /\ pierce p q = false
| [], _, h => by cases h
| q' :: C, q, h => by
cases e : pierce p q' with
| false =>
have h' : selO (pierce p q') q' (firstU p C) = some q := h
rw [e] at h'
cases h'
exact And.intro (List.Mem.head C) e
| true =>
have h' : selO (pierce p q') q' (firstU p C) = some q := h
rw [e] at h'
have r := firstU_some p C q h'
exact And.intro (List.Mem.tail q' r.1) r.2
/-! Branching. -/
theorem mem_brs1 (f : Nat -> List (List Nat) × List (List Nat)) (m : List Nat) : forall q : List Nat,
m ∈ (brs f q).1 -> Exists fun v => v ∈ q /\ m ∈ (f v).1
| [], h => nomatch h
| v :: q, h => by
cases mem_app m (f v).1 (brs f q).1 h with
| inl l => exact Exists.intro v (And.intro (List.Mem.head q) l)
| inr r =>
cases mem_brs1 f m q r with
| intro u hu => exact Exists.intro u (And.intro (List.Mem.tail v hu.1) hu.2)
theorem mem_brs2 (f : Nat -> List (List Nat) × List (List Nat)) (m : List Nat) : forall q : List Nat,
m ∈ (brs f q).2 -> Exists fun v => v ∈ q /\ m ∈ (f v).2
| [], h => nomatch h
| v :: q, h => by
cases mem_app m (f v).2 (brs f q).2 h with
| inl l => exact Exists.intro v (And.intro (List.Mem.head q) l)
| inr r =>
cases mem_brs2 f m q r with
| intro u hu => exact Exists.intro u (And.intro (List.Mem.tail v hu.1) hu.2)
theorem brs_of1 (f : Nat -> List (List Nat) × List (List Nat)) (m : List Nat) (v : Nat) (hm : m ∈ (f v).1) :
forall q : List Nat, v ∈ q -> m ∈ (brs f q).1
| [], h => nomatch h
| u :: q, h => by
cases mem_cons_cases h with
| inl e => rw [<- e]; exact mem_app_l m _ _ hm
| inr h2 => exact mem_app_r m _ _ (brs_of1 f m v hm q h2)
theorem brs_of2 (f : Nat -> List (List Nat) × List (List Nat)) (m : List Nat) (v : Nat) (hm : m ∈ (f v).2) :
forall q : List Nat, v ∈ q -> m ∈ (brs f q).2
| [], h => nomatch h
| u :: q, h => by
cases mem_cons_cases h with
| inl e => rw [<- e]; exact mem_app_l m _ _ hm
| inr h2 => exact mem_app_r m _ _ (brs_of2 f m v hm q h2)
theorem brs_count (f : Nat -> List (List Nat) × List (List Nat)) (M : Nat) (hf : forall v, (f v).2.length <= M) :
forall q : List Nat, (brs f q).2.length <= q.length * M
| [] => by show 0 <= 0 * M; exact Nat.zero_le _
| v :: q => by
show ((f v).2 ++ (brs f q).2).length <= (q.length + 1) * M
rw [len_app, Found.Pnp98.add_mul', Found.Pnp115.one_mul', Nat.add_comm (q.length * M)]
exact Nat.add_le_add (hf v) (brs_count f M hf q)
/-! The tree. -/
theorem tr_none (C : List (List Nat)) (d : Nat) (p : List Nat) (e : firstU p C = none) : tr C (d + 1) p = ([p], []) :=
congrArg (fun o => selT o p (fun q => brs (fun v => tr C d (v :: p)) q)) e
theorem tr_some (C : List (List Nat)) (d : Nat) (p q : List Nat) (e : firstU p C = some q) :
tr C (d + 1) p = brs (fun v => tr C d (v :: p)) q :=
congrArg (fun o => selT o p (fun q => brs (fun v => tr C d (v :: p)) q)) e
/-- Every leaf pierces every member of C. -/
theorem tr_fst_pierce (C : List (List Nat)) : forall (d : Nat) (p m : List Nat), m ∈ (tr C d p).1 ->
forall q, q ∈ C -> pierce m q = true
| 0, _, _, h => nomatch h
| d + 1, p, m, h => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e] at h
cases mem_cons_cases h with
| inl r => rw [r]; exact firstU_none p C e
| inr h2 => exact nomatch h2
| some q =>
rw [tr_some C d p q e] at h
cases mem_brs1 _ m q h with
| intro v hv => exact tr_fst_pierce C d (v :: p) m hv.2
/-- Leaves are short. -/
theorem tr_fst_len (C : List (List Nat)) : forall (d : Nat) (p m : List Nat), m ∈ (tr C d p).1 ->
m.length + 1 <= p.length + d
| 0, _, _, h => nomatch h
| d + 1, p, m, h => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e] at h
cases mem_cons_cases h with
| inl r => rw [r]; exact Nat.add_le_add_left (Nat.succ_le_succ (Nat.zero_le d)) _
| inr h2 => exact nomatch h2
| some q =>
rw [tr_some C d p q e] at h
cases mem_brs1 _ m q h with
| intro v hv =>
have t := tr_fst_len C d (v :: p) m hv.2
have t' : m.length + 1 <= p.length + 1 + d := t
rw [Nat.add_right_comm] at t'
exact t'
/-- Cuts have exactly |p| + d elements. -/
theorem tr_snd_len (C : List (List Nat)) : forall (d : Nat) (p m : List Nat), m ∈ (tr C d p).2 ->
m.length = p.length + d
| 0, p, m, h => by
cases mem_cons_cases h with
| inl r => rw [r]; rfl
| inr h2 => exact nomatch h2
| d + 1, p, m, h => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e] at h
exact nomatch h
| some q =>
rw [tr_some C d p q e] at h
cases mem_brs2 _ m q h with
| intro v hv =>
have t := tr_snd_len C d (v :: p) m hv.2
have t' : m.length = p.length + 1 + d := t
rw [Nat.add_right_comm] at t'
exact t'
/-- At most w ^ d cuts. -/
theorem tr_snd_count (C : List (List Nat)) (w : Nat) (hw : forall q, q ∈ C -> q.length <= w) :
forall (d : Nat) (p : List Nat), (tr C d p).2.length <= w ^ d
| 0, _ => Nat.le_refl 1
| d + 1, p => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e]
exact Nat.zero_le _
| some q =>
rw [tr_some C d p q e]
have hq := firstU_some p C q e
have t := brs_count (fun v => tr C d (v :: p)) (w ^ d) (fun v => tr_snd_count C w hw d (v :: p)) q
refine Nat.le_trans t ?_
show q.length * w ^ d <= w ^ d * w
rw [Nat.mul_comm (w ^ d) w]
exact mul_le_r (hw q hq.1) (w ^ d)
/-- If y covers p and hits every member of C, it covers a leaf or a cut. -/
theorem tr_complete (C : List (List Nat)) (y : Nat -> Bool) (hC : forall q, q ∈ C -> anyL y q = true) :
forall (d : Nat) (p : List Nat), allL y p = true ->
Exists fun m => (m ∈ (tr C d p).1 \/ m ∈ (tr C d p).2) /\ allL y m = true
| 0, p, hp => Exists.intro p (And.intro (Or.inr (List.Mem.head [])) hp)
| d + 1, p, hp => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e]
exact Exists.intro p (And.intro (Or.inl (List.Mem.head [])) hp)
| some q =>
rw [tr_some C d p q e]
have hq := firstU_some p C q e
cases anyL_ex y q (hC q hq.1) with
| intro v hv =>
have hp' : allL y (v :: p) = true := by
show (y v && allL y p) = true
rw [hv.2, hp]
try rfl
cases tr_complete C y hC d (v :: p) hp' with
| intro m hm =>
refine Exists.intro m (And.intro ?_ hm.2)
cases hm.1 with
| inl l => exact Or.inl (brs_of1 _ m v l q hv.1)
| inr r => exact Or.inr (brs_of2 _ m v r q hv.1)
/-- If y covers a set that pierces q, then y hits q. -/
theorem leaf_hits (y : Nat -> Bool) (m q : List Nat) (hm : allL y m = true) (hp : pierce m q = true) :
anyL y q = true := by
cases anyL_ex _ q hp with
| intro v hv => exact anyL_true y v (allL_mem y m v hm (memN_mem v m hv.2)) q hv.1
end Found.Pnp116
#print axioms Found.Pnp116.mem_app
#print axioms Found.Pnp116.mem_app_l
#print axioms Found.Pnp116.mem_app_r
#print axioms Found.Pnp116.len_app
#print axioms Found.Pnp116.anyL_ex
#print axioms Found.Pnp116.memN_mem
#print axioms Found.Pnp116.allL_mem
#print axioms Found.Pnp116.firstU_none
#print axioms Found.Pnp116.firstU_some
#print axioms Found.Pnp116.mem_brs1
#print axioms Found.Pnp116.mem_brs2
#print axioms Found.Pnp116.brs_of1
#print axioms Found.Pnp116.brs_of2
#print axioms Found.Pnp116.brs_count
#print axioms Found.Pnp116.tr_none
#print axioms Found.Pnp116.tr_some
#print axioms Found.Pnp116.tr_fst_pierce
#print axioms Found.Pnp116.tr_fst_len
#print axioms Found.Pnp116.tr_snd_len
#print axioms Found.Pnp116.tr_snd_count
#print axioms Found.Pnp116.tr_complete
#print axioms Found.Pnp116.leaf_hits
lean_all/found/Pnp117.lean
/-
T330 piece 117. found/Pnp117 -- the monotone switching lemma in both directions, and cuts of
a prefix (Jukna, Boolean Function Complexity, Lemma 9.15 and Section 9.6; proof complexity
ladder, step 2).
A monotone DNF or CNF is a list of sets of variables. For a DNF D whose monomials have at most
w variables, the leaves of the transversal tree tr D s [] form a CNF L with clauses of fewer
than s variables and the cuts form at most w ^ s sets K of s variables:
D <= L, and if L holds but D fails then x misses some set of K.
Dually for a CNF C, the leaves of tr C r [] form a DNF R with
R <= C, and if C holds but R fails then x covers some set of K.
The cuts of the tree of a prefix P are cuts of the tree of P ++ Q: the cut sets of a family
of nested prefixes are all among those of the longest list. Proved:
* firstU_app, tr_prefix: cuts of a prefix;
* dnf_le_cnf, cnf_cut: DNF to CNF;
* dnf_le_cnf', dnf_cut: CNF to DNF.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp116
namespace Found.Pnp117
open Found.Pnp115 (anyL anyL_true mem_cons_cases and_true_l and_true_r)
open Found.Pnp116 (allL pierce firstU selO tr tr_none tr_some mem_brs2 brs_of2 tr_fst_pierce tr_complete
leaf_hits anyL_ex memN_mem allL_mem)
/-- Every set of the list satisfies g. -/
def allLL (g : List Nat -> Bool) : List (List Nat) -> Bool
| [] => true
| a :: l => g a && allLL g l
def evDNF (x : Nat -> Bool) (D : List (List Nat)) : Bool := anyL (allL x) D
def evCNF (x : Nat -> Bool) (C : List (List Nat)) : Bool := allLL (anyL x) C
def negF (x : Nat -> Bool) (v : Nat) : Bool := !(x v)
theorem allLL_mem (g : List Nat -> Bool) : forall (L : List (List Nat)) (a : List Nat), allLL g L = true -> a ∈ L -> g a = true
| [], _, _, h => nomatch h
| b :: L, a, h, ha => by
cases mem_cons_cases ha with
| inl q => rw [q]; exact and_true_l h
| inr h2 => exact allLL_mem g L a (and_true_r h) h2
theorem allLL_of (g : List Nat -> Bool) : forall L : List (List Nat), (forall a, a ∈ L -> g a = true) -> allLL g L = true
| [], _ => rfl
| b :: L, h => by
show (g b && allLL g L) = true
rw [h b (List.Mem.head L), allLL_of g L (fun a ha => h a (List.Mem.tail b ha))]
try rfl
theorem allLL_false (g : List Nat -> Bool) : forall L : List (List Nat), allLL g L = false -> Exists fun a => a ∈ L /\ g a = false
| [], h => Bool.noConfusion h
| b :: L, h => by
cases e : g b with
| false => exact Exists.intro b (And.intro (List.Mem.head L) e)
| true =>
have h' : (g b && allLL g L) = false := h
rw [e] at h'
cases allLL_false g L h' with
| intro a ha => exact Exists.intro a (And.intro (List.Mem.tail b ha.1) ha.2)
/-- A set not all true under x is hit by the complement of x. -/
theorem allL_false_neg (x : Nat -> Bool) : forall M : List Nat, allL x M = false -> anyL (negF x) M = true
| [], h => Bool.noConfusion h
| v :: M, h => by
cases e : x v with
| false =>
show (negF x v || anyL (negF x) M) = true
show ((!(x v)) || anyL (negF x) M) = true
rw [e]
rfl
| true =>
have h' : (x v && allL x M) = false := h
rw [e] at h'
show (negF x v || anyL (negF x) M) = true
rw [allL_false_neg x M h']
exact Found.Pnp65.or_true_r _
/-- A set not hit by x is all true under the complement of x. -/
theorem anyL_false_neg (x : Nat -> Bool) : forall M : List Nat, anyL x M = false -> allL (negF x) M = true
| [], _ => rfl
| v :: M, h => by
have h' : (x v || anyL x M) = false := h
cases e : x v with
| true => rw [e] at h'; exact Bool.noConfusion h'
| false =>
rw [e] at h'
show ((!(x v)) && allL (negF x) M) = true
rw [e, anyL_false_neg x M h']
rfl
/-- If the complement of x covers M, then x misses M. -/
theorem neg_cover_miss (x : Nat -> Bool) (M : List Nat) (h : allL (negF x) M = true) : anyL x M = false := by
cases e : anyL x M with
| false => rfl
| true =>
cases anyL_ex x M e with
| intro v hv =>
have t : negF x v = true := allL_mem (negF x) M v h hv.1
have t' : (!(x v)) = true := t
rw [hv.2] at t'
exact Bool.noConfusion t'
/-! Cuts of a prefix. -/
theorem firstU_app (p : List Nat) (Q : List (List Nat)) : forall (P : List (List Nat)) (q : List Nat),
firstU p P = some q -> firstU p (P ++ Q) = some q
| [], _, h => by cases h
| q' :: P, q, h => by
show selO (pierce p q') q' (firstU p (P ++ Q)) = some q
have h' : selO (pierce p q') q' (firstU p P) = some q := h
cases e : pierce p q' with
| false => rw [e] at h'; exact h'
| true => rw [e] at h'; exact firstU_app p Q P q h'
theorem tr_prefix (P Q : List (List Nat)) : forall (d : Nat) (p m : List Nat), m ∈ (tr P d p).2 -> m ∈ (tr (P ++ Q) d p).2
| 0, _, _, h => h
| d + 1, p, m, h => by
cases e : firstU p P with
| none =>
rw [tr_none P d p e] at h
exact nomatch h
| some q =>
rw [tr_some P d p q e] at h
rw [tr_some (P ++ Q) d p q (firstU_app p Q P q e)]
cases mem_brs2 _ m q h with
| intro v hv => exact brs_of2 _ m v (tr_prefix P Q d (v :: p) m hv.2) q hv.1
/-! DNF to CNF: leaves as clauses. -/
/-- D <= L. -/
theorem dnf_le_cnf (D : List (List Nat)) (s : Nat) (x : Nat -> Bool) (h : evDNF x D = true) :
evCNF x (tr D s []).1 = true := by
cases anyL_ex (allL x) D h with
| intro M hM =>
refine allLL_of _ _ (fun T hT => ?_)
have hp := tr_fst_pierce D s [] T hT M hM.1
cases anyL_ex _ M hp with
| intro v hv => exact anyL_true x v (allL_mem x M v hM.2 hv.1) T (memN_mem v T hv.2)
/-- If L holds and D fails, x misses some cut. -/
theorem cnf_cut (D : List (List Nat)) (s : Nat) (x : Nat -> Bool) (hL : evCNF x (tr D s []).1 = true)
(hD : evDNF x D = false) : Exists fun T => T ∈ (tr D s []).2 /\ anyL x T = false := by
have hall : forall M, M ∈ D -> anyL (negF x) M = true := by
intro M hM
cases e : allL x M with
| false => exact allL_false_neg x M e
| true =>
have t : evDNF x D = true := anyL_true (allL x) M e D hM
rw [hD] at t
exact Bool.noConfusion t
cases tr_complete D (negF x) hall s [] rfl with
| intro m hm =>
cases hm.1 with
| inl l =>
have t := allLL_mem (anyL x) _ m hL l
rw [neg_cover_miss x m hm.2] at t
exact Bool.noConfusion t
| inr r => exact Exists.intro m (And.intro r (neg_cover_miss x m hm.2))
/-! CNF to DNF: leaves as monomials. -/
/-- R <= C. -/
theorem dnf_le_cnf' (C : List (List Nat)) (r : Nat) (x : Nat -> Bool) (h : evDNF x (tr C r []).1 = true) :
evCNF x C = true := by
cases anyL_ex (allL x) _ h with
| intro M hM =>
exact allLL_of _ C (fun q hq => leaf_hits x M q hM.2 (tr_fst_pierce C r [] M hM.1 q hq))
/-- If C holds and R fails, x covers some cut. -/
theorem dnf_cut (C : List (List Nat)) (r : Nat) (x : Nat -> Bool) (hC : evCNF x C = true)
(hR : evDNF x (tr C r []).1 = false) : Exists fun T => T ∈ (tr C r []).2 /\ allL x T = true := by
cases tr_complete C x (fun q hq => allLL_mem (anyL x) C q hC hq) r [] rfl with
| intro m hm =>
cases hm.1 with
| inl l =>
have t : evDNF x (tr C r []).1 = true := anyL_true (allL x) m hm.2 _ l
rw [hR] at t
exact Bool.noConfusion t
| inr r' => exact Exists.intro m (And.intro r' hm.2)
end Found.Pnp117
#print axioms Found.Pnp117.allLL_mem
#print axioms Found.Pnp117.allLL_of
#print axioms Found.Pnp117.allLL_false
#print axioms Found.Pnp117.allL_false_neg
#print axioms Found.Pnp117.anyL_false_neg
#print axioms Found.Pnp117.neg_cover_miss
#print axioms Found.Pnp117.firstU_app
#print axioms Found.Pnp117.tr_prefix
#print axioms Found.Pnp117.dnf_le_cnf
#print axioms Found.Pnp117.cnf_cut
#print axioms Found.Pnp117.dnf_le_cnf'
#print axioms Found.Pnp117.dnf_cut
lean_all/found/Pnp118.lean
/-
T330 piece 118. found/Pnp118 -- sorting by an integer key, and thresholds as prefixes
(proof complexity ladder, step 2: the threshold chain of a real gate).
Keys are integers as pairs (Pnp105) under zle. isort key L lists L in decreasing key order
(insertion sort). For a list sorted in decreasing order, the elements with key >= a are
exactly its longest prefix tw (key >= a), and the list is that prefix followed by the rest.
So the formulas built from the pairs above each threshold are prefixes of one master list.
Proved:
* ble_le, le_ble, zleB_zle, zle_zleB, zle_total: the comparison;
* mem_ins, mem_ins_of, mem_isort, mem_isort_of: sorting keeps the elements;
* ins_sorted, isort_sorted: sorting sorts;
* tw_dw, mem_tw, tw_complete: the threshold prefix.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp117
namespace Found.Pnp118
open Found.Pnp115 (Pw mem_cons_cases)
open Found.Pnp105 (zle zle_trans zle_refl)
theorem ble_le : forall a b : Nat, Nat.ble a b = true -> a <= b
| 0, _, _ => Nat.zero_le _
| _ + 1, 0, h => Bool.noConfusion h
| a + 1, b + 1, h => Nat.succ_le_succ (ble_le a b h)
theorem le_ble : forall a b : Nat, a <= b -> Nat.ble a b = true
| 0, _, _ => rfl
| _ + 1, 0, h => absurd h (Nat.not_succ_le_zero _)
| a + 1, b + 1, h => le_ble a b (Nat.le_of_succ_le_succ h)
def zleB (v w : Nat × Nat) : Bool := Nat.ble (v.1 + w.2) (w.1 + v.2)
theorem zleB_zle (v w : Nat × Nat) (h : zleB v w = true) : zle v w := ble_le _ _ h
theorem zle_zleB (v w : Nat × Nat) (h : zle v w) : zleB v w = true := le_ble _ _ h
theorem zle_total (v w : Nat × Nat) : zle v w \/ zle w v := by
cases Nat.lt_or_ge (v.1 + w.2) (w.1 + v.2) with
| inl l => exact Or.inl (Nat.le_of_lt l)
| inr g =>
refine Or.inr ?_
show w.1 + v.2 <= v.1 + w.2
exact g
theorem zle_of_not (v w : Nat × Nat) (h : zleB v w = false) : zle w v := by
cases zle_total v w with
| inl l => rw [zle_zleB v w l] at h; exact Bool.noConfusion h
| inr r => exact r
/-! Insertion sort, decreasing. -/
def selL {α : Type} (b : Bool) (l1 l2 : List α) : List α :=
match b with
| true => l1
| false => l2
def ins {α : Type} (key : α -> Nat × Nat) (u : α) : List α -> List α
| [] => [u]
| v :: l => selL (zleB (key v) (key u)) (u :: v :: l) (v :: ins key u l)
def isort {α : Type} (key : α -> Nat × Nat) : List α -> List α
| [] => []
| u :: l => ins key u (isort key l)
def Desc {α : Type} (key : α -> Nat × Nat) (L : List α) : Prop := Pw (fun u v => zle (key v) (key u)) L
theorem ins_true {α : Type} (key : α -> Nat × Nat) (u v : α) (l : List α) (e : zleB (key v) (key u) = true) :
ins key u (v :: l) = u :: v :: l :=
congrArg (fun b => selL b (u :: v :: l) (v :: ins key u l)) e
theorem ins_false {α : Type} (key : α -> Nat × Nat) (u v : α) (l : List α) (e : zleB (key v) (key u) = false) :
ins key u (v :: l) = v :: ins key u l :=
congrArg (fun b => selL b (u :: v :: l) (v :: ins key u l)) e
theorem mem_ins {α : Type} (key : α -> Nat × Nat) (u w : α) : forall l : List α, w ∈ ins key u l -> w = u \/ w ∈ l
| [], h => by
cases mem_cons_cases h with
| inl q => exact Or.inl q
| inr h2 => exact nomatch h2
| v :: l, h => by
cases e : zleB (key v) (key u) with
| true =>
rw [ins_true key u v l e] at h
exact mem_cons_cases h
| false =>
rw [ins_false key u v l e] at h
cases mem_cons_cases h with
| inl q => rw [q]; exact Or.inr (List.Mem.head l)
| inr h2 =>
cases mem_ins key u w l h2 with
| inl q => exact Or.inl q
| inr h3 => exact Or.inr (List.Mem.tail v h3)
theorem mem_ins_of {α : Type} (key : α -> Nat × Nat) (u w : α) : forall l : List α, (w = u \/ w ∈ l) -> w ∈ ins key u l
| [], h => by
cases h with
| inl q => rw [q]; exact List.Mem.head []
| inr h2 => exact nomatch h2
| v :: l, h => by
cases e : zleB (key v) (key u) with
| true =>
rw [ins_true key u v l e]
cases h with
| inl q => rw [q]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail u h2
| false =>
rw [ins_false key u v l e]
cases h with
| inl q => exact List.Mem.tail v (mem_ins_of key u w l (Or.inl q))
| inr h2 =>
cases mem_cons_cases h2 with
| inl q => rw [q]; exact List.Mem.head _
| inr h3 => exact List.Mem.tail v (mem_ins_of key u w l (Or.inr h3))
theorem mem_isort {α : Type} (key : α -> Nat × Nat) (w : α) : forall l : List α, w ∈ isort key l -> w ∈ l
| [], h => nomatch h
| u :: l, h => by
cases mem_ins key u w (isort key l) h with
| inl q => rw [q]; exact List.Mem.head l
| inr h2 => exact List.Mem.tail u (mem_isort key w l h2)
theorem mem_isort_of {α : Type} (key : α -> Nat × Nat) (w : α) : forall l : List α, w ∈ l -> w ∈ isort key l
| [], h => nomatch h
| u :: l, h => by
refine mem_ins_of key u w (isort key l) ?_
cases mem_cons_cases h with
| inl q => exact Or.inl q
| inr h2 => exact Or.inr (mem_isort_of key w l h2)
theorem ins_sorted {α : Type} (key : α -> Nat × Nat) (u : α) : forall l : List α, Desc key l -> Desc key (ins key u l)
| [], _ => And.intro (fun _ h => nomatch h) True.intro
| v :: l, h => by
cases e : zleB (key v) (key u) with
| true =>
rw [ins_true key u v l e]
refine And.intro (fun w hw => ?_) h
cases mem_cons_cases hw with
| inl q => rw [q]; exact zleB_zle _ _ e
| inr h2 => exact zle_trans _ _ _ (h.1 w h2) (zleB_zle _ _ e)
| false =>
rw [ins_false key u v l e]
refine And.intro (fun w hw => ?_) (ins_sorted key u l h.2)
cases mem_ins key u w l hw with
| inl q => rw [q]; exact zle_of_not _ _ e
| inr h2 => exact h.1 w h2
theorem isort_sorted {α : Type} (key : α -> Nat × Nat) : forall l : List α, Desc key (isort key l)
| [] => True.intro
| u :: l => ins_sorted key u (isort key l) (isort_sorted key l)
/-! The threshold prefix. -/
def twSel {α : Type} (b : Bool) (a : α) (rest : List α) : List α :=
match b with
| true => a :: rest
| false => []
def dwSel {α : Type} (b : Bool) (a : α) (l rest : List α) : List α :=
match b with
| true => rest
| false => a :: l
/-- The longest prefix whose elements satisfy g. -/
def tw {α : Type} (g : α -> Bool) : List α -> List α
| [] => []
| a :: l => twSel (g a) a (tw g l)
/-- The rest after that prefix. -/
def dw {α : Type} (g : α -> Bool) : List α -> List α
| [] => []
| a :: l => dwSel (g a) a l (dw g l)
theorem tw_dw {α : Type} (g : α -> Bool) : forall l : List α, tw g l ++ dw g l = l
| [] => rfl
| a :: l => by
cases e : g a with
| true =>
have t1 : tw g (a :: l) = a :: tw g l := congrArg (fun b => twSel b a (tw g l)) e
have t2 : dw g (a :: l) = dw g l := congrArg (fun b => dwSel b a l (dw g l)) e
rw [t1, t2]
exact congrArg (a :: ·) (tw_dw g l)
| false =>
have t1 : tw g (a :: l) = [] := congrArg (fun b => twSel b a (tw g l)) e
have t2 : dw g (a :: l) = a :: l := congrArg (fun b => dwSel b a l (dw g l)) e
rw [t1, t2]
rfl
theorem mem_tw {α : Type} (g : α -> Bool) (u : α) : forall l : List α, u ∈ tw g l -> u ∈ l /\ g u = true
| [], h => nomatch h
| a :: l, h => by
cases e : g a with
| true =>
have t1 : tw g (a :: l) = a :: tw g l := congrArg (fun b => twSel b a (tw g l)) e
rw [t1] at h
cases mem_cons_cases h with
| inl q => rw [q]; exact And.intro (List.Mem.head l) e
| inr h2 => exact And.intro (List.Mem.tail a (mem_tw g u l h2).1) (mem_tw g u l h2).2
| false =>
have t1 : tw g (a :: l) = [] := congrArg (fun b => twSel b a (tw g l)) e
rw [t1] at h
exact nomatch h
/-- In a decreasing list every element with key >= a lies in the prefix of keys >= a. -/
theorem tw_complete {α : Type} (key : α -> Nat × Nat) (a : Nat × Nat) : forall l : List α, Desc key l ->
forall u, u ∈ l -> zle a (key u) -> u ∈ tw (fun w => zleB a (key w)) l
| [], _, _, h, _ => nomatch h
| v :: l, hs, u, hu, ha => by
cases e : zleB a (key v) with
| true =>
have t1 : tw (fun w => zleB a (key w)) (v :: l) = v :: tw (fun w => zleB a (key w)) l :=
congrArg (fun b => twSel b v (tw (fun w => zleB a (key w)) l)) e
rw [t1]
cases mem_cons_cases hu with
| inl q => rw [q]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail v (tw_complete key a l hs.2 u h2 ha)
| false =>
have hv : zle a (key v) := by
cases mem_cons_cases hu with
| inl q => rw [<- q]; exact ha
| inr h2 => exact zle_trans _ _ _ ha (hs.1 u h2)
rw [zle_zleB a (key v) hv] at e
exact Bool.noConfusion e
end Found.Pnp118
#print axioms Found.Pnp118.ble_le
#print axioms Found.Pnp118.le_ble
#print axioms Found.Pnp118.zleB_zle
#print axioms Found.Pnp118.zle_zleB
#print axioms Found.Pnp118.zle_total
#print axioms Found.Pnp118.zle_of_not
#print axioms Found.Pnp118.ins_true
#print axioms Found.Pnp118.ins_false
#print axioms Found.Pnp118.mem_ins
#print axioms Found.Pnp118.mem_ins_of
#print axioms Found.Pnp118.mem_isort
#print axioms Found.Pnp118.mem_isort_of
#print axioms Found.Pnp118.ins_sorted
#print axioms Found.Pnp118.isort_sorted
#print axioms Found.Pnp118.tw_dw
#print axioms Found.Pnp118.mem_tw
#print axioms Found.Pnp118.tw_complete
lean_all/found/Pnp119.lean
/-
T330 piece 119. found/Pnp119 -- one real gate: the threshold approximators and one step of
the error invariants (Wigderson's argument in Jukna, Boolean Function Complexity, Section
9.6, with strict thresholds; proof complexity ladder, step 2).
A gate f = phi(g, h) with phi monotone. For its inputs g, h we are given value lists Vg, Vh
and, for every integer threshold b, a CNF Lg b and a DNF Rg b (likewise for h). The pairs
(b, c) of Vg x Vh are sorted by phi(b, c), decreasing (Md) and increasing (Ma). For a
threshold a:
D_a = OR over pairs with phi(b,c) >= a of Rg b AND Rh c (a prefix of Md),
C_a = AND over pairs with phi(b,c) <= a - 1 of Lg (b+1) OR Lh (c+1) (a prefix of Ma),
Lf a = leaves of the transversal tree of D_a (a CNF), Rf a = leaves of that of C_a (a DNF).
The correction sets KL, KR are the cuts of the trees of the whole master lists: by Pnp117
they contain the cuts for every threshold. For an input x with gx in Vg, hx in Vh:
stepA: if the approximators of g and h are never above the truth at x and x misses no set
of KL entirely, then neither Lf a nor Rf a is above the truth at x;
stepB: if they are never below the truth at x and x covers no set of KR, then neither
Lf a nor Rf a is below the truth at x.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp118
namespace Found.Pnp119
open Found.Pnp115 (anyL anyL_true mem_cons_cases and_true_l and_true_r)
open Found.Pnp116 (allL tr anyL_ex mem_app mem_app_l mem_app_r)
open Found.Pnp117 (allLL allLL_mem allLL_of allLL_false evDNF evCNF tr_prefix dnf_le_cnf cnf_cut
dnf_le_cnf' dnf_cut)
open Found.Pnp118 (zleB zleB_zle zle_zleB le_ble isort isort_sorted mem_isort_of tw dw tw_dw mem_tw tw_complete)
open Found.Pnp105 (zle zle_trans zle_refl)
open Found.Pnp113 (Mono2)
/-! Integers as pairs. -/
def succZ (b : Nat × Nat) : Nat × Nat := (b.1 + 1, b.2)
def predZ (a : Nat × Nat) : Nat × Nat := (a.1, a.2 + 1)
def negZ (v : Nat × Nat) : Nat × Nat := (v.2, v.1)
theorem strict (a v : Nat × Nat) (h : zleB a v = false) : zle v (predZ a) := by
have h' : Nat.ble (a.1 + v.2) (v.1 + a.2) = false := h
cases Nat.lt_or_ge (v.1 + a.2) (a.1 + v.2) with
| inl l => exact l
| inr g => rw [le_ble _ _ g] at h'; exact Bool.noConfusion h'
theorem pred_lt (a v : Nat × Nat) (h1 : zle v (predZ a)) (h2 : zle a v) : False :=
Nat.not_succ_le_self _ (Nat.le_trans h1 h2)
theorem succ_self (v : Nat × Nat) (h : zle (succZ v) v) : False := by
have h' : v.1 + 1 + v.2 <= v.1 + v.2 := h
rw [Nat.add_right_comm] at h'
exact Nat.not_succ_le_self _ h'
theorem not_succ (b v : Nat × Nat) (h : zleB (succZ b) v = false) : zle v b := by
have t : v.1 + (b.2 + 1) <= b.1 + 1 + v.2 := strict (succZ b) v h
rw [Nat.add_right_comm] at t
exact Nat.le_of_succ_le_succ t
theorem negZ_le (v w : Nat × Nat) (h : zle v w) : zle (negZ w) (negZ v) := by
show w.2 + v.1 <= v.2 + w.1
rw [Nat.add_comm w.2, Nat.add_comm v.2]
exact h
theorem negZ_le' (v w : Nat × Nat) (h : zle (negZ w) (negZ v)) : zle v w := by
have h' : w.2 + v.1 <= v.2 + w.1 := h
rw [Nat.add_comm w.2, Nat.add_comm v.2] at h'
exact h'
/-! Concatenated maps and joins. -/
def cm {α β : Type} (f : α -> List β) : List α -> List β
| [] => []
| u :: l => f u ++ cm f l
theorem app_assoc {α : Type} : forall (A B C : List α), (A ++ B) ++ C = A ++ (B ++ C)
| [], _, _ => rfl
| a :: A, B, C => congrArg (a :: ·) (app_assoc A B C)
theorem cm_app {α β : Type} (f : α -> List β) (B : List α) : forall A : List α, cm f (A ++ B) = cm f A ++ cm f B
| [] => rfl
| u :: A => by
show f u ++ cm f (A ++ B) = (f u ++ cm f A) ++ cm f B
rw [cm_app f B A, app_assoc]
theorem mem_cm {α β : Type} (f : α -> List β) (y : β) : forall l : List α, y ∈ cm f l -> Exists fun u => u ∈ l /\ y ∈ f u
| [], h => nomatch h
| u :: l, h => by
cases mem_app y (f u) (cm f l) h with
| inl a => exact Exists.intro u (And.intro (List.Mem.head l) a)
| inr b =>
cases mem_cm f y l b with
| intro w hw => exact Exists.intro w (And.intro (List.Mem.tail u hw.1) hw.2)
theorem mem_cm_of {α β : Type} (f : α -> List β) (y : β) (u : α) (hy : y ∈ f u) : forall l : List α, u ∈ l -> y ∈ cm f l
| [], h => nomatch h
| w :: l, h => by
cases mem_cons_cases h with
| inl q => rw [<- q]; exact mem_app_l y _ _ hy
| inr h2 => exact mem_app_r y _ _ (mem_cm_of f y u hy l h2)
def prodL (A B : List (Nat × Nat)) : List ((Nat × Nat) × (Nat × Nat)) :=
cm (fun b => cm (fun c => [(b, c)]) B) A
theorem mem_prodL (A B : List (Nat × Nat)) (b c : Nat × Nat) (hb : b ∈ A) (hc : c ∈ B) : (b, c) ∈ prodL A B :=
mem_cm_of _ _ b (mem_cm_of _ _ c (List.Mem.head []) B hc) A hb
/-- All unions a ++ b with a from A and b from B (AND of DNFs, OR of CNFs). -/
def joinL (A B : List (List Nat)) : List (List Nat) := cm (fun a => cm (fun b => [a ++ b]) B) A
theorem mem_joinL (A B : List (List Nat)) (m : List Nat) (h : m ∈ joinL A B) :
Exists fun a => a ∈ A /\ Exists fun b => b ∈ B /\ m = a ++ b := by
cases mem_cm _ m A h with
| intro a ha =>
cases mem_cm _ m B ha.2 with
| intro b hb =>
cases mem_cons_cases hb.2 with
| inl q => exact Exists.intro a (And.intro ha.1 (Exists.intro b (And.intro hb.1 q)))
| inr h2 => exact nomatch h2
theorem mem_joinL_of (A B : List (List Nat)) (a b : List Nat) (ha : a ∈ A) (hb : b ∈ B) : a ++ b ∈ joinL A B :=
mem_cm_of _ _ a (mem_cm_of _ _ b (List.Mem.head []) B hb) A ha
theorem allL_app_l (x : Nat -> Bool) : forall (a b : List Nat), allL x (a ++ b) = true -> allL x a = true
| [], _, _ => rfl
| v :: a, b, h => by
show (x v && allL x a) = true
rw [and_true_l h, allL_app_l x a b (and_true_r h)]
try rfl
theorem allL_app_r (x : Nat -> Bool) : forall (a b : List Nat), allL x (a ++ b) = true -> allL x b = true
| [], _, h => h
| _ :: a, b, h => allL_app_r x a b (and_true_r h)
theorem allL_app_of (x : Nat -> Bool) : forall (a b : List Nat), allL x a = true -> allL x b = true -> allL x (a ++ b) = true
| [], _, _, hb => hb
| v :: a, b, ha, hb => by
show (x v && allL x (a ++ b)) = true
rw [and_true_l ha, allL_app_of x a b (and_true_r ha) hb]
try rfl
theorem anyL_app_l (x : Nat -> Bool) (a b : List Nat) (h : anyL x a = true) : anyL x (a ++ b) = true := by
cases anyL_ex x a h with
| intro v hv => exact anyL_true x v hv.2 _ (mem_app_l v b a hv.1)
theorem anyL_app_r (x : Nat -> Bool) (a b : List Nat) (h : anyL x b = true) : anyL x (a ++ b) = true := by
cases anyL_ex x b h with
| intro v hv => exact anyL_true x v hv.2 _ (mem_app_r v b a hv.1)
theorem anyL_app_false (x : Nat -> Bool) (a b : List Nat) (ha : anyL x a = false) (hb : anyL x b = false) :
anyL x (a ++ b) = false := by
cases e : anyL x (a ++ b) with
| false => rfl
| true =>
cases anyL_ex x _ e with
| intro v hv =>
cases mem_app v a b hv.1 with
| inl l => rw [anyL_true x v hv.2 a l] at ha; exact Bool.noConfusion ha
| inr r => rw [anyL_true x v hv.2 b r] at hb; exact Bool.noConfusion hb
/-! Evaluation of joins and concatenated maps. -/
theorem dnf_join_ex (x : Nat -> Bool) (A B : List (List Nat)) (h : evDNF x (joinL A B) = true) :
evDNF x A = true /\ evDNF x B = true := by
cases anyL_ex _ _ h with
| intro m hm =>
cases mem_joinL A B m hm.1 with
| intro a ha =>
cases ha.2 with
| intro b hb =>
have e := hb.2
have hm2 := hm.2
rw [e] at hm2
exact And.intro (anyL_true (allL x) a (allL_app_l x a b hm2) A ha.1)
(anyL_true (allL x) b (allL_app_r x a b hm2) B hb.1)
theorem dnf_join_of (x : Nat -> Bool) (A B : List (List Nat)) (hA : evDNF x A = true) (hB : evDNF x B = true) :
evDNF x (joinL A B) = true := by
cases anyL_ex _ _ hA with
| intro a ha =>
cases anyL_ex _ _ hB with
| intro b hb => exact anyL_true (allL x) (a ++ b) (allL_app_of x a b ha.2 hb.2) _ (mem_joinL_of A B a b ha.1 hb.1)
theorem cnf_join_of (x : Nat -> Bool) (A B : List (List Nat)) (h : evCNF x A = true \/ evCNF x B = true) :
evCNF x (joinL A B) = true := by
refine allLL_of _ _ (fun m hm => ?_)
cases mem_joinL A B m hm with
| intro a ha =>
cases ha.2 with
| intro b hb =>
rw [hb.2]
cases h with
| inl l => exact anyL_app_l x a b (allLL_mem _ A a l ha.1)
| inr r => exact anyL_app_r x a b (allLL_mem _ B b r hb.1)
theorem cnf_join_ex (x : Nat -> Bool) (A B : List (List Nat)) (h : evCNF x (joinL A B) = true) :
evCNF x A = true \/ evCNF x B = true := by
cases e1 : evCNF x A with
| true => exact Or.inl rfl
| false =>
cases e2 : evCNF x B with
| true => exact Or.inr rfl
| false =>
cases allLL_false _ A e1 with
| intro a ha =>
cases allLL_false _ B e2 with
| intro b hb =>
have t := allLL_mem _ _ (a ++ b) h (mem_joinL_of A B a b ha.1 hb.1)
rw [anyL_app_false x a b ha.2 hb.2] at t
exact Bool.noConfusion t
theorem dnf_cm_ex {α : Type} (x : Nat -> Bool) (f : α -> List (List Nat)) (P : List α) (h : evDNF x (cm f P) = true) :
Exists fun u => u ∈ P /\ evDNF x (f u) = true := by
cases anyL_ex _ _ h with
| intro m hm =>
cases mem_cm f m P hm.1 with
| intro u hu => exact Exists.intro u (And.intro hu.1 (anyL_true (allL x) m hm.2 _ hu.2))
theorem dnf_cm_of {α : Type} (x : Nat -> Bool) (f : α -> List (List Nat)) (P : List α) (u : α) (hu : u ∈ P)
(h : evDNF x (f u) = true) : evDNF x (cm f P) = true := by
cases anyL_ex _ _ h with
| intro m hm => exact anyL_true (allL x) m hm.2 _ (mem_cm_of f m u hm.1 P hu)
theorem cnf_cm_all {α : Type} (x : Nat -> Bool) (f : α -> List (List Nat)) (P : List α) (h : evCNF x (cm f P) = true)
(u : α) (hu : u ∈ P) : evCNF x (f u) = true :=
allLL_of _ _ (fun q hq => allLL_mem _ _ q h (mem_cm_of f q u hq P hu))
theorem cnf_cm_of {α : Type} (x : Nat -> Bool) (f : α -> List (List Nat)) (P : List α)
(h : forall u, u ∈ P -> evCNF x (f u) = true) : evCNF x (cm f P) = true := by
refine allLL_of _ _ (fun q hq => ?_)
cases mem_cm f q P hq with
| intro u hu => exact allLL_mem _ _ q (h u hu.1) hu.2
theorem tr_prefix_cm {α : Type} (f : α -> List (List Nat)) (A B : List α) (d : Nat) (p T : List Nat)
(h : T ∈ (tr (cm f A) d p).2) : T ∈ (tr (cm f (A ++ B)) d p).2 := by
rw [cm_app]
exact tr_prefix _ _ d p T h
/-! One gate. -/
structure GD where
phi : Nat × Nat -> Nat × Nat -> Nat × Nat
Vg : List (Nat × Nat)
Vh : List (Nat × Nat)
Lg : Nat × Nat -> List (List Nat)
Rg : Nat × Nat -> List (List Nat)
Lh : Nat × Nat -> List (List Nat)
Rh : Nat × Nat -> List (List Nat)
def key1 (G : GD) (u : (Nat × Nat) × (Nat × Nat)) : Nat × Nat := G.phi u.1 u.2
def key2 (G : GD) (u : (Nat × Nat) × (Nat × Nat)) : Nat × Nat := negZ (G.phi u.1 u.2)
def Md (G : GD) := isort (key1 G) (prodL G.Vg G.Vh)
def Ma (G : GD) := isort (key2 G) (prodL G.Vg G.Vh)
def gD (a : Nat × Nat) (G : GD) (u : (Nat × Nat) × (Nat × Nat)) : Bool := zleB a (key1 G u)
def gC (a : Nat × Nat) (G : GD) (u : (Nat × Nat) × (Nat × Nat)) : Bool := zleB (negZ (predZ a)) (key2 G u)
def fD (G : GD) (u : (Nat × Nat) × (Nat × Nat)) : List (List Nat) := joinL (G.Rg u.1) (G.Rh u.2)
def fC (G : GD) (u : (Nat × Nat) × (Nat × Nat)) : List (List Nat) := joinL (G.Lg (succZ u.1)) (G.Lh (succZ u.2))
/-- The DNF of the threshold a, its CNF approximator, and the correction cuts. -/
def Da (G : GD) (a : Nat × Nat) : List (List Nat) := cm (fD G) (tw (gD a G) (Md G))
def Ca (G : GD) (a : Nat × Nat) : List (List Nat) := cm (fC G) (tw (gC a G) (Ma G))
def Lf (s : Nat) (G : GD) (a : Nat × Nat) : List (List Nat) := (tr (Da G a) s []).1
def Rf (r : Nat) (G : GD) (a : Nat × Nat) : List (List Nat) := (tr (Ca G a) r []).1
def KL (s : Nat) (G : GD) : List (List Nat) := (tr (cm (fD G) (Md G)) s []).2
def KR (r : Nat) (G : GD) : List (List Nat) := (tr (cm (fC G) (Ma G)) r []).2
theorem KL_sub (s : Nat) (G : GD) (a : Nat × Nat) (T : List Nat) (h : T ∈ (tr (Da G a) s []).2) : T ∈ KL s G := by
have h' := tr_prefix_cm (fD G) (tw (gD a G) (Md G)) (dw (gD a G) (Md G)) s [] T h
rw [tw_dw] at h'
exact h'
theorem KR_sub (r : Nat) (G : GD) (a : Nat × Nat) (T : List Nat) (h : T ∈ (tr (Ca G a) r []).2) : T ∈ KR r G := by
have h' := tr_prefix_cm (fC G) (tw (gC a G) (Ma G)) (dw (gC a G) (Ma G)) r [] T h
rw [tw_dw] at h'
exact h'
theorem pair_in_Md (G : GD) (gx hx : Nat × Nat) (hg : gx ∈ G.Vg) (hh : hx ∈ G.Vh) : (gx, hx) ∈ Md G :=
mem_isort_of _ _ _ (mem_prodL _ _ gx hx hg hh)
theorem pair_in_Ma (G : GD) (gx hx : Nat × Nat) (hg : gx ∈ G.Vg) (hh : hx ∈ G.Vh) : (gx, hx) ∈ Ma G :=
mem_isort_of _ _ _ (mem_prodL _ _ gx hx hg hh)
/-- Never above the truth. -/
theorem stepA (s r : Nat) (G : GD) (hphi : Mono2 G.phi) (x : Nat -> Bool) (gx hx : Nat × Nat)
(hg : gx ∈ G.Vg) (hh : hx ∈ G.Vh)
(IgL : forall b, evCNF x (G.Lg b) = true -> zle b gx) (IgR : forall b, evDNF x (G.Rg b) = true -> zle b gx)
(IhL : forall c, evCNF x (G.Lh c) = true -> zle c hx) (IhR : forall c, evDNF x (G.Rh c) = true -> zle c hx)
(hK : forall T, T ∈ KL s G -> anyL x T = true) (a : Nat × Nat) :
(evCNF x (Lf s G a) = true -> zle a (G.phi gx hx)) /\ (evDNF x (Rf r G a) = true -> zle a (G.phi gx hx)) := by
refine And.intro (fun hL => ?_) (fun hR => ?_)
· have hD : evDNF x (Da G a) = true := by
cases e : evDNF x (Da G a) with
| true => rfl
| false =>
cases cnf_cut (Da G a) s x hL e with
| intro T hT =>
have t := hK T (KL_sub s G a T hT.1)
rw [hT.2] at t
exact Bool.noConfusion t
cases dnf_cm_ex x (fD G) _ hD with
| intro u hu =>
have j := dnf_join_ex x _ _ hu.2
have hb := IgR u.1 j.1
have hc := IhR u.2 j.2
have ha : zle a (G.phi u.1 u.2) := zleB_zle _ _ (mem_tw (gD a G) u (Md G) hu.1).2
exact zle_trans _ _ _ ha (hphi _ _ _ _ hb hc)
· have hC : evCNF x (Ca G a) = true := dnf_le_cnf' _ r x hR
cases e : zleB a (G.phi gx hx) with
| true => exact zleB_zle _ _ e
| false =>
have hlt : zle (G.phi gx hx) (predZ a) := strict a _ e
have hu : (gx, hx) ∈ tw (gC a G) (Ma G) :=
tw_complete (key2 G) (negZ (predZ a)) (Ma G) (isort_sorted _ _) (gx, hx) (pair_in_Ma G gx hx hg hh)
(negZ_le _ _ hlt)
cases cnf_join_ex x _ _ (cnf_cm_all x (fC G) _ hC (gx, hx) hu) with
| inl l => exact absurd (IgL _ l) (succ_self gx)
| inr r' => exact absurd (IhL _ r') (succ_self hx)
/-- Never below the truth. -/
theorem stepB (s r : Nat) (G : GD) (hphi : Mono2 G.phi) (x : Nat -> Bool) (gx hx : Nat × Nat)
(hg : gx ∈ G.Vg) (hh : hx ∈ G.Vh)
(IgB : forall b, zle b gx -> evCNF x (G.Lg b) = true /\ evDNF x (G.Rg b) = true)
(IhB : forall c, zle c hx -> evCNF x (G.Lh c) = true /\ evDNF x (G.Rh c) = true)
(hK : forall T, T ∈ KR r G -> allL x T = false) (a : Nat × Nat) (ha : zle a (G.phi gx hx)) :
evCNF x (Lf s G a) = true /\ evDNF x (Rf r G a) = true := by
refine And.intro ?_ ?_
· have hu : (gx, hx) ∈ tw (gD a G) (Md G) :=
tw_complete (key1 G) a (Md G) (isort_sorted _ _) (gx, hx) (pair_in_Md G gx hx hg hh) ha
have hD : evDNF x (Da G a) = true :=
dnf_cm_of x (fD G) _ (gx, hx) hu (dnf_join_of x _ _ (IgB gx (zle_refl gx)).2 (IhB hx (zle_refl hx)).2)
exact dnf_le_cnf _ s x hD
· have hC : evCNF x (Ca G a) = true := by
refine cnf_cm_of x (fC G) _ (fun u hu => ?_)
have hlt : zle (G.phi u.1 u.2) (predZ a) := negZ_le' _ _ (zleB_zle _ _ (mem_tw (gC a G) u (Ma G) hu).2)
cases e1 : zleB (succZ u.1) gx with
| true => exact cnf_join_of x _ _ (Or.inl (IgB _ (zleB_zle _ _ e1)).1)
| false =>
cases e2 : zleB (succZ u.2) hx with
| true => exact cnf_join_of x _ _ (Or.inr (IhB _ (zleB_zle _ _ e2)).1)
| false =>
have m := hphi _ _ _ _ (not_succ u.1 gx e1) (not_succ u.2 hx e2)
exact absurd ha (fun ha' => pred_lt a _ (zle_trans _ _ _ m hlt) ha')
cases e : evDNF x (Rf r G a) with
| true => rfl
| false =>
cases dnf_cut (Ca G a) r x hC e with
| intro T hT =>
have t := hK T (KR_sub r G a T hT.1)
rw [hT.2] at t
exact Bool.noConfusion t
end Found.Pnp119
#print axioms Found.Pnp119.strict
#print axioms Found.Pnp119.pred_lt
#print axioms Found.Pnp119.succ_self
#print axioms Found.Pnp119.not_succ
#print axioms Found.Pnp119.negZ_le
#print axioms Found.Pnp119.negZ_le'
#print axioms Found.Pnp119.app_assoc
#print axioms Found.Pnp119.cm_app
#print axioms Found.Pnp119.mem_cm
#print axioms Found.Pnp119.mem_cm_of
#print axioms Found.Pnp119.mem_prodL
#print axioms Found.Pnp119.mem_joinL
#print axioms Found.Pnp119.mem_joinL_of
#print axioms Found.Pnp119.allL_app_l
#print axioms Found.Pnp119.allL_app_r
#print axioms Found.Pnp119.allL_app_of
#print axioms Found.Pnp119.anyL_app_l
#print axioms Found.Pnp119.anyL_app_r
#print axioms Found.Pnp119.anyL_app_false
#print axioms Found.Pnp119.dnf_join_ex
#print axioms Found.Pnp119.dnf_join_of
#print axioms Found.Pnp119.cnf_join_of
#print axioms Found.Pnp119.cnf_join_ex
#print axioms Found.Pnp119.dnf_cm_ex
#print axioms Found.Pnp119.dnf_cm_of
#print axioms Found.Pnp119.cnf_cm_all
#print axioms Found.Pnp119.cnf_cm_of
#print axioms Found.Pnp119.tr_prefix_cm
#print axioms Found.Pnp119.KL_sub
#print axioms Found.Pnp119.KR_sub
#print axioms Found.Pnp119.pair_in_Md
#print axioms Found.Pnp119.pair_in_Ma
#print axioms Found.Pnp119.stepA
#print axioms Found.Pnp119.stepB
lean_all/found/Pnp12.lean
/-
T330 piece 12. found/Pnp12 -- a Turing machine as a local machine (one step).
A one-tape Turing machine with states as bit lists of length m: from state q reading s
it moves to next q s, writes write q s and moves right iff right q s. A configuration
(tape, pos, q) is laid out on cells of k = m + 2 bits: bit 0 the symbol, bit 1 "the head
is here", bits 2.. the state where the head is (false elsewhere). The local rule reads
the left, own and right cells. Proved: one step of the width-W local machine (Pnp10)
on the layout of a configuration is the layout of the next configuration, at every
cell j <= W, when the head is at a cell p + 1 with p + 2 < W, the boundary cell W holds
false and the state has m bits.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp11
import found.Pnp7
namespace Found.Pnp12
open Found.Pnp1 (read)
open Found.Pnp7 (nthd read_nthd length_read)
open Found.Pnp9 (leftIdx)
open Found.Pnp10 (Conf nbC stepW gate read_ext_k beq_refl)
structure TM where
m : Nat
next : List Bool -> Bool -> List Bool
write : List Bool -> Bool -> Bool
right : List Bool -> Bool -> Bool
def sel : Bool -> Bool -> Bool -> Bool
| true, x, _ => x
| false, _, y => y
def selN : Bool -> Nat -> Nat -> Nat
| true, x, _ => x
| false, _, y => y
variable (M : TM)
/-! ## The local rule -/
def stG (g : Nat -> Bool) : List Bool := read (fun i => g (i + 2)) 0 M.m
def lb (L : List Bool) (i : Nat) : Bool := nthd L i
def cb (L : List Bool) (i : Nat) : Bool := nthd L (M.m + 2 + i)
def rb (L : List Bool) (i : Nat) : Bool := nthd L (M.m + 2 + (M.m + 2 + i))
def rule (L : List Bool) : Nat -> Bool
| 0 => sel (cb M L 1) (M.write (stG M (cb M L)) (cb M L 0)) (cb M L 0)
| 1 => (lb L 1 && M.right (stG M (lb L)) (lb L 0)) ||
(rb M L 1 && !(M.right (stG M (rb M L)) (rb M L 0)))
| i + 2 => ((lb L 1 && M.right (stG M (lb L)) (lb L 0)) && nthd (M.next (stG M (lb L)) (lb L 0)) i) ||
((rb M L 1 && !(M.right (stG M (rb M L)) (rb M L 0))) &&
nthd (M.next (stG M (rb M L)) (rb M L 0)) i)
/-! ## Layout and Turing step -/
def cellBit (s h : Bool) (q : List Bool) : Nat -> Bool
| 0 => s
| 1 => h
| i + 2 => h && nthd q i
def encC (tape : Nat -> Bool) (pos : Nat) (q : List Bool) : Conf :=
fun j b => cellBit (tape j) (Nat.beq j pos) q b
def tapeN (tape : Nat -> Bool) (pos : Nat) (q : List Bool) : Nat -> Bool :=
fun j => sel (Nat.beq j pos) (M.write q (tape pos)) (tape j)
def posN (tape : Nat -> Bool) (pos : Nat) (q : List Bool) : Nat :=
selN (M.right q (tape pos)) (pos + 1) (pos - 1)
def qN (tape : Nat -> Bool) (pos : Nat) (q : List Bool) : List Bool := M.next q (tape pos)
/-! ## List access -/
theorem nthd_app_l : forall (A B : List Bool) (i : Nat), i < A.length -> nthd (A ++ B) i = nthd A i := by
intro A
induction A with
| nil => intro B i h; exact False.elim (Nat.not_lt_zero i h)
| cons a A ih =>
intro B i h
cases i with
| zero => rfl
| succ i => exact ih B i (Nat.lt_of_succ_lt_succ h)
theorem nthd_app_r : forall (A B : List Bool) (i : Nat), nthd (A ++ B) (A.length + i) = nthd B i := by
intro A
induction A with
| nil => intro B i; exact congrArg (nthd B) (Nat.zero_add i)
| cons a A ih =>
intro B i
show nthd (a :: (A ++ B)) (A.length + 1 + i) = nthd B i
rw [Nat.add_right_comm]
exact ih B i
theorem nthd_read (f : Nat -> Bool) : forall (n s i : Nat), i < n -> nthd (read f s n) i = f (s + i) := by
intro n
induction n with
| zero => intro s i h; exact False.elim (Nat.not_lt_zero i h)
| succ n ih =>
intro s i h
cases i with
| zero => rfl
| succ i =>
exact (ih (s + 1) i (Nat.lt_of_succ_lt_succ h)).trans (congrArg f (Nat.succ_add s i))
theorem accL (c : Conf) (k W j i : Nat) (hi : i < k) : nthd (nbC c k W j) i = c (leftIdx W j) i := by
show nthd (read (c (leftIdx W j)) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)) i = _
rw [nthd_app_l _ _ i (by rw [length_read]; exact hi), nthd_read _ k 0 i hi, Nat.zero_add]
theorem accC (c : Conf) (k W j i : Nat) (hi : i < k) : nthd (nbC c k W j) (k + i) = c j i := by
show nthd (read (c (leftIdx W j)) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)) (k + i) = _
have h := nthd_app_r (read (c (leftIdx W j)) 0 k) (read (c j) 0 k ++ read (c (j + 1)) 0 k) i
rw [length_read] at h
rw [h, nthd_app_l _ _ i ((length_read _ k 0).symm ▸ hi), nthd_read _ k 0 i hi, Nat.zero_add]
theorem accR (c : Conf) (k W j i : Nat) (hi : i < k) : nthd (nbC c k W j) (k + (k + i)) = c (j + 1) i := by
show nthd (read (c (leftIdx W j)) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)) (k + (k + i)) = _
have h1 := nthd_app_r (read (c (leftIdx W j)) 0 k) (read (c j) 0 k ++ read (c (j + 1)) 0 k) (k + i)
have h2 := nthd_app_r (read (c j) 0 k) (read (c (j + 1)) 0 k) i
rw [length_read] at h1 h2
rw [h1, h2, nthd_read _ k 0 i hi, Nat.zero_add]
/-! ## The head substitution -/
theorem stq (tape : Nat -> Bool) (pos : Nat) (q : List Bool) (hq : q.length = M.m)
(f : List Bool -> Bool -> Bool) (x : Nat) :
(Nat.beq x pos && f (read (fun i => encC tape pos q x (i + 2)) 0 M.m) (tape x)) =
(Nat.beq x pos && f q (tape pos)) := by
show (Nat.beq x pos && f (read (fun i => Nat.beq x pos && nthd q i) 0 M.m) (tape x)) = _
cases h : Nat.beq x pos with
| false => rfl
| true =>
have e : x = pos := Found.Pnp2.beq_eq x pos h
have r : read (fun i => true && nthd q i) 0 M.m = q := by
rw [← hq]; exact read_nthd q
rw [r, e]
theorem selq (tape : Nat -> Bool) (pos : Nat) (q : List Bool) (hq : q.length = M.m)
(f : List Bool -> Bool -> Bool) (x : Nat) (y : Bool) :
sel (Nat.beq x pos) (f (read (fun i => encC tape pos q x (i + 2)) 0 M.m) (tape x)) y =
sel (Nat.beq x pos) (f q (tape pos)) y := by
show sel (Nat.beq x pos) (f (read (fun i => Nat.beq x pos && nthd q i) 0 M.m) (tape x)) y = _
cases h : Nat.beq x pos with
| false => rfl
| true =>
have e : x = pos := Found.Pnp2.beq_eq x pos h
have r : read (fun i => true && nthd q i) 0 M.m = q := by
rw [← hq]; exact read_nthd q
rw [r, e]
/-! ## Accessors on the layout -/
def nbE (tape : Nat -> Bool) (pos : Nat) (q : List Bool) (W j : Nat) : List Bool :=
nbC (encC tape pos q) (M.m + 2) W j
theorem lt0 : 0 < M.m + 2 := Nat.zero_lt_succ _
theorem lt1 : 1 < M.m + 2 := Nat.succ_lt_succ (Nat.zero_lt_succ _)
theorem ltS (i : Nat) (h : i < M.m) : i + 2 < M.m + 2 := Nat.succ_lt_succ (Nat.succ_lt_succ h)
theorem stL (tape : Nat -> Bool) (pos : Nat) (q : List Bool) (W j : Nat) :
stG M (lb (nbE M tape pos q W j)) = read (fun i => encC tape pos q (leftIdx W j) (i + 2)) 0 M.m :=
read_ext_k _ _ M.m (fun i hi => accL (encC tape pos q) (M.m + 2) W j (i + 2) (ltS M i hi))
theorem stC (tape : Nat -> Bool) (pos : Nat) (q : List Bool) (W j : Nat) :
stG M (cb M (nbE M tape pos q W j)) = read (fun i => encC tape pos q j (i + 2)) 0 M.m :=
read_ext_k _ _ M.m (fun i hi => accC (encC tape pos q) (M.m + 2) W j (i + 2) (ltS M i hi))
theorem stR (tape : Nat -> Bool) (pos : Nat) (q : List Bool) (W j : Nat) :
stG M (rb M (nbE M tape pos q W j)) = read (fun i => encC tape pos q (j + 1) (i + 2)) 0 M.m :=
read_ext_k _ _ M.m (fun i hi => accR (encC tape pos q) (M.m + 2) W j (i + 2) (ltS M i hi))
/-! ## Bool and position facts -/
theorem g1 (a c : Bool) : ((a && true) || (c && !true)) = a := by cases a <;> cases c <;> rfl
theorem g2 (a c : Bool) : ((a && false) || (c && !false)) = c := by cases a <;> cases c <;> rfl
theorem g3 (a c y : Bool) : ((a && (true && y)) || (c && (!true && y))) = (a && y) := by
cases a <;> cases c <;> cases y <;> rfl
theorem g4 (a c y : Bool) : ((a && (false && y)) || (c && (!false && y))) = (c && y) := by
cases a <;> cases c <;> cases y <;> rfl
theorem and_assoc3 (a b c : Bool) : ((a && b) && c) = (a && (b && c)) := by cases a <;> rfl
theorem beqW (W p : Nat) (h : p + 1 < W) : Nat.beq W (p + 1) = false :=
Found.Pnp2.beq_false_of_ne W (p + 1) (fun e => Nat.ne_of_lt h e.symm)
/-- The head bit after a step: it comes from the left cell moving right or the right cell
moving left. -/
theorem head_eq (W p j : Nat) (hW : p + 1 < W) (R : Bool) :
((Nat.beq (leftIdx W j) (p + 1) && R) || (Nat.beq (j + 1) (p + 1) && !R)) =
Nat.beq j (selN R (p + 1 + 1) (p + 1 - 1)) := by
cases R with
| true =>
rw [g1]
cases j with
| zero => exact beqW W p hW
| succ j => rfl
| false => rw [g2]; rfl
theorem head_eq2 (W p j : Nat) (hW : p + 1 < W) (R y : Bool) :
((Nat.beq (leftIdx W j) (p + 1) && (R && y)) || (Nat.beq (j + 1) (p + 1) && (!R && y))) =
(Nat.beq j (selN R (p + 1 + 1) (p + 1 - 1)) && y) := by
cases R with
| true =>
rw [g3]
cases j with
| zero => exact congrArg (fun t => t && y) (beqW W p hW)
| succ j => rfl
| false => rw [g4]; rfl
/-! ## One step -/
theorem step_inside (tape : Nat -> Bool) (p : Nat) (q : List Bool) (hq : q.length = M.m)
(W : Nat) (hW : p + 2 < W) (j : Nat) (hj : j < W) (b : Nat) :
stepW (rule M) (M.m + 2) W (encC tape (p + 1) q) j b =
encC (tapeN M tape (p + 1) q) (posN M tape (p + 1) q) (qN M tape (p + 1) q) j b := by
have hW1 : p + 1 < W := Nat.lt_of_succ_lt hW
show gate (Nat.beq j W) (rule M (nbE M tape (p + 1) q W j) b) = _
rw [Found.Pnp2.beq_false_of_ne j W (Nat.ne_of_lt hj)]
have l0 : lb (nbE M tape (p + 1) q W j) 0 = tape (leftIdx W j) := accL (encC tape (p + 1) q) (M.m + 2) W j 0 (lt0 M)
have l1 : lb (nbE M tape (p + 1) q W j) 1 = Nat.beq (leftIdx W j) (p + 1) := accL (encC tape (p + 1) q) (M.m + 2) W j 1 (lt1 M)
have c0 : cb M (nbE M tape (p + 1) q W j) 0 = tape j := accC (encC tape (p + 1) q) (M.m + 2) W j 0 (lt0 M)
have c1 : cb M (nbE M tape (p + 1) q W j) 1 = Nat.beq j (p + 1) := accC (encC tape (p + 1) q) (M.m + 2) W j 1 (lt1 M)
have r0 : rb M (nbE M tape (p + 1) q W j) 0 = tape (j + 1) := accR (encC tape (p + 1) q) (M.m + 2) W j 0 (lt0 M)
have r1 : rb M (nbE M tape (p + 1) q W j) 1 = Nat.beq (j + 1) (p + 1) := accR (encC tape (p + 1) q) (M.m + 2) W j 1 (lt1 M)
match b with
| 0 =>
show sel (cb M (nbE M tape (p + 1) q W j) 1)
(M.write (stG M (cb M (nbE M tape (p + 1) q W j))) (cb M (nbE M tape (p + 1) q W j) 0))
(cb M (nbE M tape (p + 1) q W j) 0) = sel (Nat.beq j (p + 1)) (M.write q (tape (p + 1))) (tape j)
rw [c1, stC, c0]
exact selq M tape (p + 1) q hq M.write j (tape j)
| 1 =>
show ((lb (nbE M tape (p + 1) q W j) 1 && M.right (stG M (lb (nbE M tape (p + 1) q W j))) (lb (nbE M tape (p + 1) q W j) 0)) ||
(rb M (nbE M tape (p + 1) q W j) 1 && !(M.right (stG M (rb M (nbE M tape (p + 1) q W j))) (rb M (nbE M tape (p + 1) q W j) 0)))) =
Nat.beq j (selN (M.right q (tape (p + 1))) (p + 1 + 1) (p + 1 - 1))
rw [l1, stL, l0, r1, stR, r0]
have hL : (Nat.beq (leftIdx W j) (p + 1) &&
M.right (read (fun i => encC tape (p + 1) q (leftIdx W j) (i + 2)) 0 M.m) (tape (leftIdx W j))) =
(Nat.beq (leftIdx W j) (p + 1) && M.right q (tape (p + 1))) :=
stq M tape (p + 1) q hq M.right (leftIdx W j)
have hR : (Nat.beq (j + 1) (p + 1) &&
!(M.right (read (fun i => encC tape (p + 1) q (j + 1) (i + 2)) 0 M.m) (tape (j + 1)))) =
(Nat.beq (j + 1) (p + 1) && !(M.right q (tape (p + 1)))) :=
stq M tape (p + 1) q hq (fun a s => !(M.right a s)) (j + 1)
rw [hL, hR]
exact head_eq W p j hW1 _
| i + 2 =>
show (((lb (nbE M tape (p + 1) q W j) 1 && M.right (stG M (lb (nbE M tape (p + 1) q W j))) (lb (nbE M tape (p + 1) q W j) 0)) &&
nthd (M.next (stG M (lb (nbE M tape (p + 1) q W j))) (lb (nbE M tape (p + 1) q W j) 0)) i) ||
((rb M (nbE M tape (p + 1) q W j) 1 && !(M.right (stG M (rb M (nbE M tape (p + 1) q W j))) (rb M (nbE M tape (p + 1) q W j) 0))) &&
nthd (M.next (stG M (rb M (nbE M tape (p + 1) q W j))) (rb M (nbE M tape (p + 1) q W j) 0)) i)) =
(Nat.beq j (selN (M.right q (tape (p + 1))) (p + 1 + 1) (p + 1 - 1)) && nthd (M.next q (tape (p + 1))) i)
rw [l1, stL, l0, r1, stR, r0, and_assoc3, and_assoc3]
have hL : (Nat.beq (leftIdx W j) (p + 1) &&
(M.right (read (fun i => encC tape (p + 1) q (leftIdx W j) (i + 2)) 0 M.m) (tape (leftIdx W j)) &&
nthd (M.next (read (fun i => encC tape (p + 1) q (leftIdx W j) (i + 2)) 0 M.m) (tape (leftIdx W j))) i)) =
(Nat.beq (leftIdx W j) (p + 1) && (M.right q (tape (p + 1)) && nthd (M.next q (tape (p + 1))) i)) :=
stq M tape (p + 1) q hq (fun a s => M.right a s && nthd (M.next a s) i) (leftIdx W j)
have hR : (Nat.beq (j + 1) (p + 1) &&
(!(M.right (read (fun i => encC tape (p + 1) q (j + 1) (i + 2)) 0 M.m) (tape (j + 1))) &&
nthd (M.next (read (fun i => encC tape (p + 1) q (j + 1) (i + 2)) 0 M.m) (tape (j + 1))) i)) =
(Nat.beq (j + 1) (p + 1) && (!(M.right q (tape (p + 1))) && nthd (M.next q (tape (p + 1))) i)) :=
stq M tape (p + 1) q hq (fun a s => !(M.right a s) && nthd (M.next a s) i) (j + 1)
rw [hL, hR]
exact head_eq2 W p j hW1 _ _
/-- At the boundary cell W the local machine writes false, and so does the layout of the
next configuration when the head stays inside and the tape is false at W. -/
theorem step_boundary (tape : Nat -> Bool) (p : Nat) (q : List Bool) (W : Nat) (hW : p + 2 < W)
(htW : tape W = false) (b : Nat) :
stepW (rule M) (M.m + 2) W (encC tape (p + 1) q) W b =
encC (tapeN M tape (p + 1) q) (posN M tape (p + 1) q) (qN M tape (p + 1) q) W b := by
have hW1 : p + 1 < W := Nat.lt_of_succ_lt hW
have hpos : Nat.beq W (posN M tape (p + 1) q) = false := by
show Nat.beq W (selN (M.right q (tape (p + 1))) (p + 1 + 1) (p + 1 - 1)) = false
cases M.right q (tape (p + 1)) with
| true => exact Found.Pnp2.beq_false_of_ne W (p + 2) (fun e => Nat.ne_of_lt hW e.symm)
| false => exact Found.Pnp2.beq_false_of_ne W p (fun e => Nat.ne_of_lt (Nat.lt_of_succ_lt hW1) e.symm)
show gate (Nat.beq W W) _ = cellBit (sel (Nat.beq W (p + 1)) (M.write q (tape (p + 1))) (tape W))
(Nat.beq W (posN M tape (p + 1) q)) (qN M tape (p + 1) q) b
rw [beq_refl W, beqW W p hW1, hpos]
match b with
| 0 => exact htW.symm
| 1 => rfl
| _ + 2 => rfl
end Found.Pnp12
#print axioms Found.Pnp12.nthd_app_l
#print axioms Found.Pnp12.nthd_app_r
#print axioms Found.Pnp12.nthd_read
#print axioms Found.Pnp12.accL
#print axioms Found.Pnp12.accC
#print axioms Found.Pnp12.accR
#print axioms Found.Pnp12.stq
#print axioms Found.Pnp12.selq
#print axioms Found.Pnp12.stL
#print axioms Found.Pnp12.stC
#print axioms Found.Pnp12.stR
#print axioms Found.Pnp12.g1
#print axioms Found.Pnp12.g2
#print axioms Found.Pnp12.g3
#print axioms Found.Pnp12.g4
#print axioms Found.Pnp12.and_assoc3
#print axioms Found.Pnp12.beqW
#print axioms Found.Pnp12.head_eq
#print axioms Found.Pnp12.head_eq2
#print axioms Found.Pnp12.step_inside
#print axioms Found.Pnp12.step_boundary
lean_all/found/Pnp120.lean
/-
T330 piece 120. found/Pnp120 -- approximators for a whole monotone real circuit and the two
error invariants (proof complexity ladder, step 2: Wigderson's argument).
For a straight-line monotone real circuit (Pnp113), a list X of test inputs and parameters
s, r, apx builds for every gate a family of threshold approximators: for an input gate x_i
and a constant gate the exact CNF/DNF of the threshold function (no correction sets); for a
gate phi(g, h) the approximators of Pnp119 over the values of g and h on X. allKL, allKR
collect the correction sets of all gates. For a test input x in X:
apx_goodA: if x misses no set of allKL entirely, no approximator is above the truth;
apx_goodB: if x covers no set of allKR, no approximator is below the truth;
out_neg, out_pos: at the output gate and threshold 0, the CNF approximator is false on
such negative test inputs and true on such positive ones.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp119
namespace Found.Pnp120
open Found.Pnp65 (bv)
open Found.Pnp115 (anyL)
open Found.Pnp116 (allL mem_app_l mem_app_r)
open Found.Pnp117 (evDNF evCNF)
open Found.Pnp118 (zleB zleB_zle zle_zleB ble_le le_ble)
open Found.Pnp119 (GD Lf Rf KL KR stepA stepB)
open Found.Pnp105 (zle zle_trans zle_refl)
open Found.Pnp113 (Gate nthV gval evalR outV)
open Found.Pnp109 (out)
structure Apx where
L : Nat × Nat -> List (List Nat)
R : Nat × Nat -> List (List Nat)
KL : List (List Nat)
KR : List (List Nat)
def selF (b : Bool) (u w : List (List Nat)) : List (List Nat) :=
match b with
| true => u
| false => w
/-- Exact approximators of a constant gate. -/
def cstA (v : Nat × Nat) : Apx :=
Apx.mk (fun a => selF (zleB a v) [] [[]]) (fun a => selF (zleB a v) [[]] []) [] []
/-- Exact approximators of an input gate x_i (value (x_i, 0)). -/
def inpA (i : Nat) : Apx :=
Apx.mk (fun a => selF (zleB a (0, 0)) [] (selF (zleB a (1, 0)) [[i]] [[]]))
(fun a => selF (zleB a (0, 0)) [[]] (selF (zleB a (1, 0)) [[i]] [])) [] []
def nthA : List Apx -> Nat -> Apx
| [], _ => cstA (0, 0)
| a :: _, 0 => a
| _ :: l, j + 1 => nthA l j
def mapL {α β : Type} (f : α -> β) : List α -> List β
| [] => []
| a :: l => f a :: mapL f l
theorem mem_mapL {α β : Type} (f : α -> β) (a : α) : forall l : List α, a ∈ l -> f a ∈ mapL f l
| [], h => nomatch h
| b :: l, h => by
cases Found.Pnp115.mem_cons_cases h with
| inl q => rw [q]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail (f b) (mem_mapL f a l h2)
/-- The values of gate j of gs on the test inputs. -/
def vals (X : List (Nat -> Bool)) (gs : List Gate) (j : Nat) : List (Nat × Nat) :=
mapL (fun y => nthV (evalR y gs) j) X
def gdOf (X : List (Nat -> Bool)) (gs : List Gate) (As : List Apx) (f : Nat × Nat -> Nat × Nat -> Nat × Nat)
(j k : Nat) : GD :=
GD.mk f (vals X gs j) (vals X gs k) (nthA As j).L (nthA As j).R (nthA As k).L (nthA As k).R
def apxG (s r : Nat) (X : List (Nat -> Bool)) (gs : List Gate) (As : List Apx) : Gate -> Apx
| .inp i => inpA i
| .cst v => cstA v
| .op f _ j k => Apx.mk (Lf s (gdOf X gs As f j k)) (Rf r (gdOf X gs As f j k))
(KL s (gdOf X gs As f j k)) (KR r (gdOf X gs As f j k))
def apx (s r : Nat) (X : List (Nat -> Bool)) : List Gate -> List Apx
| [] => []
| g :: gs => apxG s r X gs (apx s r X gs) g :: apx s r X gs
def allKL : List Apx -> List (List Nat)
| [] => []
| A :: l => A.KL ++ allKL l
def allKR : List Apx -> List (List Nat)
| [] => []
| A :: l => A.KR ++ allKR l
def GoodA (x : Nat -> Bool) (A : Apx) (v : Nat × Nat) : Prop :=
forall b, (evCNF x (A.L b) = true -> zle b v) /\ (evDNF x (A.R b) = true -> zle b v)
def GoodB (x : Nat -> Bool) (A : Apx) (v : Nat × Nat) : Prop :=
forall b, zle b v -> evCNF x (A.L b) = true /\ evDNF x (A.R b) = true
/-! Exact gates. -/
theorem cst_goodA (x : Nat -> Bool) (v : Nat × Nat) : GoodA x (cstA v) v := by
intro b
show (evCNF x (selF (zleB b v) [] [[]]) = true -> zle b v) /\ (evDNF x (selF (zleB b v) [[]] []) = true -> zle b v)
cases e : zleB b v with
| true => exact And.intro (fun _ => zleB_zle _ _ e) (fun _ => zleB_zle _ _ e)
| false => exact And.intro (fun h => Bool.noConfusion h) (fun h => Bool.noConfusion h)
theorem cst_goodB (x : Nat -> Bool) (v : Nat × Nat) : GoodB x (cstA v) v := by
intro b hb
show evCNF x (selF (zleB b v) [] [[]]) = true /\ evDNF x (selF (zleB b v) [[]] []) = true
rw [zle_zleB b v hb]
exact And.intro rfl rfl
theorem zero_le_inp (c : Bool) : zle (0, 0) (bv c, 0) := Nat.zero_le _
theorem inp_le_one (c : Bool) : zle (bv c, 0) (1, 0) := by
show bv c + 0 <= 1 + 0
exact Found.Pnp107.bv_le1 c
theorem inp_goodA (x : Nat -> Bool) (i : Nat) : GoodA x (inpA i) (bv (x i), 0) := by
intro b
show (evCNF x (selF (zleB b (0, 0)) [] (selF (zleB b (1, 0)) [[i]] [[]])) = true -> zle b (bv (x i), 0)) /\
(evDNF x (selF (zleB b (0, 0)) [[]] (selF (zleB b (1, 0)) [[i]] [])) = true -> zle b (bv (x i), 0))
cases e0 : zleB b (0, 0) with
| true =>
have t := zle_trans _ _ _ (zleB_zle _ _ e0) (zero_le_inp (x i))
exact And.intro (fun _ => t) (fun _ => t)
| false =>
cases e1 : zleB b (1, 0) with
| false => exact And.intro (fun h => Bool.noConfusion h) (fun h => Bool.noConfusion h)
| true =>
cases hx : x i with
| true => exact And.intro (fun _ => zleB_zle _ _ e1) (fun _ => zleB_zle _ _ e1)
| false =>
refine And.intro (fun h => ?_) (fun h => ?_)
· have h' : ((x i || false) && true) = true := h
rw [hx] at h'
exact Bool.noConfusion h'
· have h' : ((x i && true) || false) = true := h
rw [hx] at h'
exact Bool.noConfusion h'
theorem inp_goodB (x : Nat -> Bool) (i : Nat) : GoodB x (inpA i) (bv (x i), 0) := by
intro b hb
show evCNF x (selF (zleB b (0, 0)) [] (selF (zleB b (1, 0)) [[i]] [[]])) = true /\
evDNF x (selF (zleB b (0, 0)) [[]] (selF (zleB b (1, 0)) [[i]] [])) = true
cases e0 : zleB b (0, 0) with
| true => exact And.intro rfl rfl
| false =>
rw [zle_zleB b (1, 0) (zle_trans _ _ _ hb (inp_le_one (x i)))]
cases hx : x i with
| false =>
rw [hx] at hb
rw [zle_zleB b (0, 0) hb] at e0
exact Bool.noConfusion e0
| true =>
refine And.intro ?_ ?_
· show ((x i || false) && true) = true
rw [hx]; rfl
· show ((x i && true) || false) = true
rw [hx]; rfl
theorem nthA_nil_A (x : Nat -> Bool) (j : Nat) : GoodA x (nthA [] j) (nthV [] j) := cst_goodA x (0, 0)
theorem nthA_nil_B (x : Nat -> Bool) (j : Nat) : GoodB x (nthA [] j) (nthV [] j) := cst_goodB x (0, 0)
/-! The invariants. -/
theorem apx_goodA (s r : Nat) (X : List (Nat -> Bool)) (x : Nat -> Bool) (hx : x ∈ X) : forall C : List Gate,
(forall T, T ∈ allKL (apx s r X C) -> anyL x T = true) ->
forall j, GoodA x (nthA (apx s r X C) j) (nthV (evalR x C) j)
| [], _, j => nthA_nil_A x j
| g :: gs, hK, j => by
have hK' : forall T, T ∈ allKL (apx s r X gs) -> anyL x T = true := fun T hT => hK T (mem_app_r T _ _ hT)
have ih := apx_goodA s r X x hx gs hK'
cases j with
| succ j => exact ih j
| zero =>
show GoodA x (apxG s r X gs (apx s r X gs) g) (gval x (evalR x gs) g)
have hK0 : forall T, T ∈ (apxG s r X gs (apx s r X gs) g).KL -> anyL x T = true :=
fun T hT => hK T (mem_app_l T _ _ hT)
cases g with
| inp i => exact inp_goodA x i
| cst v => exact cst_goodA x v
| op f hf j k =>
intro b
exact stepA s r (gdOf X gs (apx s r X gs) f j k) hf x (nthV (evalR x gs) j) (nthV (evalR x gs) k)
(mem_mapL _ x X hx) (mem_mapL _ x X hx)
(fun c h => ((ih j) c).1 h) (fun c h => ((ih j) c).2 h)
(fun c h => ((ih k) c).1 h) (fun c h => ((ih k) c).2 h) hK0 b
theorem apx_goodB (s r : Nat) (X : List (Nat -> Bool)) (x : Nat -> Bool) (hx : x ∈ X) : forall C : List Gate,
(forall T, T ∈ allKR (apx s r X C) -> allL x T = false) ->
forall j, GoodB x (nthA (apx s r X C) j) (nthV (evalR x C) j)
| [], _, j => nthA_nil_B x j
| g :: gs, hK, j => by
have hK' : forall T, T ∈ allKR (apx s r X gs) -> allL x T = false := fun T hT => hK T (mem_app_r T _ _ hT)
have ih := apx_goodB s r X x hx gs hK'
cases j with
| succ j => exact ih j
| zero =>
show GoodB x (apxG s r X gs (apx s r X gs) g) (gval x (evalR x gs) g)
have hK0 : forall T, T ∈ (apxG s r X gs (apx s r X gs) g).KR -> allL x T = false :=
fun T hT => hK T (mem_app_l T _ _ hT)
cases g with
| inp i => exact inp_goodB x i
| cst v => exact cst_goodB x v
| op f hf j k =>
intro b hb
exact stepB s r (gdOf X gs (apx s r X gs) f j k) hf x (nthV (evalR x gs) j) (nthV (evalR x gs) k)
(mem_mapL _ x X hx) (mem_mapL _ x X hx) (ih j) (ih k) hK0 b hb
/-! The output gate at threshold 0. -/
theorem zle_out (E : Nat × Nat) (h : zle (0, 0) E) : out E = true := by
have h' : 0 + E.2 <= E.1 + 0 := h
rw [Nat.zero_add] at h'
exact le_ble _ _ h'
theorem out_zle (E : Nat × Nat) (h : out E = true) : zle (0, 0) E := by
show 0 + E.2 <= E.1 + 0
rw [Nat.zero_add]
exact ble_le _ _ h
/-- On a negative test input that misses no correction set entirely, the output CNF is false. -/
theorem out_neg (s r : Nat) (X : List (Nat -> Bool)) (x : Nat -> Bool) (hx : x ∈ X) (C : List Gate)
(hK : forall T, T ∈ allKL (apx s r X C) -> anyL x T = true) (ho : out (outV x C) = false) :
evCNF x ((nthA (apx s r X C) 0).L (0, 0)) = false := by
cases e : evCNF x ((nthA (apx s r X C) 0).L (0, 0)) with
| false => rfl
| true =>
have t := zle_out _ (((apx_goodA s r X x hx C hK 0) (0, 0)).1 e)
have t' : out (outV x C) = true := t
rw [ho] at t'
exact Bool.noConfusion t'
/-- On a positive test input that covers no correction set, the output CNF is true. -/
theorem out_pos (s r : Nat) (X : List (Nat -> Bool)) (x : Nat -> Bool) (hx : x ∈ X) (C : List Gate)
(hK : forall T, T ∈ allKR (apx s r X C) -> allL x T = false) (ho : out (outV x C) = true) :
evCNF x ((nthA (apx s r X C) 0).L (0, 0)) = true :=
((apx_goodB s r X x hx C hK 0) (0, 0) (out_zle _ ho)).1
end Found.Pnp120
#print axioms Found.Pnp120.mem_mapL
#print axioms Found.Pnp120.cst_goodA
#print axioms Found.Pnp120.cst_goodB
#print axioms Found.Pnp120.zero_le_inp
#print axioms Found.Pnp120.inp_le_one
#print axioms Found.Pnp120.inp_goodA
#print axioms Found.Pnp120.inp_goodB
#print axioms Found.Pnp120.nthA_nil_A
#print axioms Found.Pnp120.nthA_nil_B
#print axioms Found.Pnp120.apx_goodA
#print axioms Found.Pnp120.apx_goodB
#print axioms Found.Pnp120.zle_out
#print axioms Found.Pnp120.out_zle
#print axioms Found.Pnp120.out_neg
#print axioms Found.Pnp120.out_pos
lean_all/found/Pnp121.lean
/-
T330 piece 121. found/Pnp121 -- sizes of the approximators of a monotone real circuit
(proof complexity ladder, step 2).
With 2 <= s and 2 <= r: every clause of every CNF approximator has at most s - 1 variables
and every monomial of every DNF approximator at most r - 1; the correction sets of KL have
exactly s elements and those of KR exactly r; one gate has at most (2r)^s sets in KL and
(2s)^r in KR, so the whole circuit C has at most |C| (2r)^s and |C| (2s)^r. Proved:
* apx_sz: the clause and monomial bound for every gate;
* kl_len, kr_len: lengths of the correction sets;
* kl_count, kr_count: the counts for one gate;
* allKL_count, allKR_count, allKL_len, allKR_len: for the whole circuit.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp120
namespace Found.Pnp121
open Found.Pnp115 (mem_cons_cases)
open Found.Pnp116 (tr tr_fst_len tr_snd_len tr_snd_count mem_app len_app)
open Found.Pnp119 (GD Lf Rf KL KR cm mem_cm joinL mem_joinL fD fC Md Ma)
open Found.Pnp120 (Apx selF cstA inpA nthA apx apxG gdOf allKL allKR)
open Found.Pnp113 (Gate)
/-- Clause and monomial bounds of one gate's approximators. -/
def Sz (s r : Nat) (A : Apx) : Prop :=
(forall b m, m ∈ A.L b -> m.length + 1 <= s) /\ (forall b m, m ∈ A.R b -> m.length + 1 <= r)
theorem mem_selF (b : Bool) (u w : List (List Nat)) (m : List Nat) (h : m ∈ selF b u w) : m ∈ u \/ m ∈ w := by
cases b with
| true => exact Or.inl h
| false => exact Or.inr h
theorem small_one (t : Nat) (ht : 2 <= t) (i : Nat) : forall m, m ∈ ([[i]] : List (List Nat)) -> m.length + 1 <= t := by
intro m hm
cases mem_cons_cases hm with
| inl q => rw [q]; exact ht
| inr h2 => exact nomatch h2
theorem small_nil (t : Nat) (ht : 2 <= t) : forall m, m ∈ ([[]] : List (List Nat)) -> m.length + 1 <= t := by
intro m hm
cases mem_cons_cases hm with
| inl q => rw [q]; exact Nat.le_trans (Nat.le_succ 1) ht
| inr h2 => exact nomatch h2
theorem small_empty (t : Nat) : forall m, m ∈ ([] : List (List Nat)) -> m.length + 1 <= t := fun _ h => nomatch h
theorem cst_sz (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) (v : Nat × Nat) : Sz s r (cstA v) := by
refine And.intro (fun b m hm => ?_) (fun b m hm => ?_)
· cases mem_selF _ _ _ m hm with
| inl l => exact small_empty s m l
| inr q => exact small_nil s hs m q
· cases mem_selF _ _ _ m hm with
| inl l => exact small_nil r hr m l
| inr q => exact small_empty r m q
theorem inp_sz (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) (i : Nat) : Sz s r (inpA i) := by
refine And.intro (fun b m hm => ?_) (fun b m hm => ?_)
· cases mem_selF _ _ _ m hm with
| inl l => exact small_empty s m l
| inr q =>
cases mem_selF _ _ _ m q with
| inl l => exact small_one s hs i m l
| inr q' => exact small_nil s hs m q'
· cases mem_selF _ _ _ m hm with
| inl l => exact small_nil r hr m l
| inr q =>
cases mem_selF _ _ _ m q with
| inl l => exact small_one r hr i m l
| inr q' => exact small_empty r m q'
theorem leaf_sz (C : List (List Nat)) (d : Nat) (m : List Nat) (h : m ∈ (tr C d []).1) : m.length + 1 <= d := by
have t := tr_fst_len C d [] m h
rw [show ([] : List Nat).length + d = d from Nat.zero_add d] at t
exact t
theorem op_sz (s r : Nat) (G : GD) : Sz s r (Apx.mk (Lf s G) (Rf r G) (KL s G) (KR r G)) :=
And.intro (fun _ m hm => leaf_sz _ s m hm) (fun _ m hm => leaf_sz _ r m hm)
theorem nthA_sz (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) : forall (As : List Apx), (forall A, A ∈ As -> Sz s r A) ->
forall j, Sz s r (nthA As j)
| [], _, _ => cst_sz s r hs hr (0, 0)
| A :: _, h, 0 => h A (List.Mem.head _)
| A :: As, h, j + 1 => nthA_sz s r hs hr As (fun B hB => h B (List.Mem.tail A hB)) j
theorem apx_sz (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) (X : List (Nat -> Bool)) : forall (C : List Gate) (A : Apx),
A ∈ apx s r X C -> Sz s r A
| [], _, h => nomatch h
| g :: gs, A, h => by
cases mem_cons_cases h with
| inr h2 => exact apx_sz s r hs hr X gs A h2
| inl q =>
rw [q]
cases g with
| inp i => exact inp_sz s r hs hr i
| cst v => exact cst_sz s r hs hr v
| op f _ j k => exact op_sz s r _
/-! Correction sets. -/
theorem kl_len (s : Nat) (G : GD) (T : List Nat) (h : T ∈ KL s G) : T.length = s := by
have t := tr_snd_len _ s [] T h
rw [show ([] : List Nat).length + s = s from Nat.zero_add s] at t
exact t
theorem kr_len (r : Nat) (G : GD) (T : List Nat) (h : T ∈ KR r G) : T.length = r := by
have t := tr_snd_len _ r [] T h
rw [show ([] : List Nat).length + r = r from Nat.zero_add r] at t
exact t
theorem join_len (A B : List (List Nat)) (w : Nat) (hA : forall m, m ∈ A -> m.length + 1 <= w)
(hB : forall m, m ∈ B -> m.length + 1 <= w) (q : List Nat) (hq : q ∈ joinL A B) : q.length <= 2 * w := by
cases mem_joinL A B q hq with
| intro a ha =>
cases ha.2 with
| intro b hb =>
rw [hb.2, len_app, Nat.two_mul]
exact Nat.add_le_add (Nat.le_of_succ_le (hA a ha.1)) (Nat.le_of_succ_le (hB b hb.1))
theorem kl_count (s r : Nat) (G : GD) (hg : forall b m, m ∈ G.Rg b -> m.length + 1 <= r)
(hh : forall b m, m ∈ G.Rh b -> m.length + 1 <= r) : (KL s G).length <= (2 * r) ^ s := by
refine tr_snd_count _ (2 * r) (fun q hq => ?_) s []
cases mem_cm (fD G) q (Md G) hq with
| intro u hu => exact join_len _ _ r (hg u.1) (hh u.2) q hu.2
theorem kr_count (s r : Nat) (G : GD) (hg : forall b m, m ∈ G.Lg b -> m.length + 1 <= s)
(hh : forall b m, m ∈ G.Lh b -> m.length + 1 <= s) : (KR r G).length <= (2 * s) ^ r := by
refine tr_snd_count _ (2 * s) (fun q hq => ?_) r []
cases mem_cm (fC G) q (Ma G) hq with
| intro u hu => exact join_len _ _ s (hg _) (hh _) q hu.2
/-- One gate: the counts and lengths of its correction sets. -/
def KOK (s r : Nat) (A : Apx) : Prop :=
A.KL.length <= (2 * r) ^ s /\ A.KR.length <= (2 * s) ^ r /\
(forall T, T ∈ A.KL -> T.length = s) /\ (forall T, T ∈ A.KR -> T.length = r)
theorem apx_kok (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) (X : List (Nat -> Bool)) : forall (C : List Gate) (A : Apx),
A ∈ apx s r X C -> KOK s r A
| [], _, h => nomatch h
| g :: gs, A, h => by
cases mem_cons_cases h with
| inr h2 => exact apx_kok s r hs hr X gs A h2
| inl q =>
rw [q]
cases g with
| inp i => exact And.intro (Nat.zero_le _) (And.intro (Nat.zero_le _) (And.intro (fun _ h => nomatch h) (fun _ h => nomatch h)))
| cst v => exact And.intro (Nat.zero_le _) (And.intro (Nat.zero_le _) (And.intro (fun _ h => nomatch h) (fun _ h => nomatch h)))
| op f _ j k =>
have hz := nthA_sz s r hs hr (apx s r X gs) (apx_sz s r hs hr X gs)
exact And.intro (kl_count s r _ (hz j).2 (hz k).2)
(And.intro (kr_count s r _ (hz j).1 (hz k).1)
(And.intro (kl_len s _) (kr_len r _)))
theorem apx_len (s r : Nat) (X : List (Nat -> Bool)) : forall C : List Gate, (apx s r X C).length = C.length
| [] => rfl
| _ :: gs => congrArg (· + 1) (apx_len s r X gs)
theorem allKL_count (s r : Nat) (M : Nat) : forall As : List Apx, (forall A, A ∈ As -> A.KL.length <= M) ->
(allKL As).length <= As.length * M
| [], _ => Nat.zero_le _
| A :: As, h => by
show (A.KL ++ allKL As).length <= (As.length + 1) * M
rw [len_app, Found.Pnp98.add_mul', Found.Pnp115.one_mul', Nat.add_comm (As.length * M)]
exact Nat.add_le_add (h A (List.Mem.head As)) (allKL_count s r M As (fun B hB => h B (List.Mem.tail A hB)))
theorem allKR_count (s r : Nat) (M : Nat) : forall As : List Apx, (forall A, A ∈ As -> A.KR.length <= M) ->
(allKR As).length <= As.length * M
| [], _ => Nat.zero_le _
| A :: As, h => by
show (A.KR ++ allKR As).length <= (As.length + 1) * M
rw [len_app, Found.Pnp98.add_mul', Found.Pnp115.one_mul', Nat.add_comm (As.length * M)]
exact Nat.add_le_add (h A (List.Mem.head As)) (allKR_count s r M As (fun B hB => h B (List.Mem.tail A hB)))
theorem mem_allKL (T : List Nat) : forall As : List Apx, T ∈ allKL As -> Exists fun A => A ∈ As /\ T ∈ A.KL
| [], h => nomatch h
| A :: As, h => by
cases mem_app T A.KL (allKL As) h with
| inl l => exact Exists.intro A (And.intro (List.Mem.head As) l)
| inr r' =>
cases mem_allKL T As r' with
| intro B hB => exact Exists.intro B (And.intro (List.Mem.tail A hB.1) hB.2)
theorem mem_allKR (T : List Nat) : forall As : List Apx, T ∈ allKR As -> Exists fun A => A ∈ As /\ T ∈ A.KR
| [], h => nomatch h
| A :: As, h => by
cases mem_app T A.KR (allKR As) h with
| inl l => exact Exists.intro A (And.intro (List.Mem.head As) l)
| inr r' =>
cases mem_allKR T As r' with
| intro B hB => exact Exists.intro B (And.intro (List.Mem.tail A hB.1) hB.2)
/-- The whole circuit: at most |C| (2r)^s sets of s elements in allKL, |C| (2s)^r sets of r elements in allKR. -/
theorem circuit_sizes (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) (X : List (Nat -> Bool)) (C : List Gate) :
(allKL (apx s r X C)).length <= C.length * (2 * r) ^ s /\
(allKR (apx s r X C)).length <= C.length * (2 * s) ^ r /\
(forall T, T ∈ allKL (apx s r X C) -> T.length = s) /\
(forall T, T ∈ allKR (apx s r X C) -> T.length = r) := by
have hk := apx_kok s r hs hr X C
refine And.intro ?_ (And.intro ?_ (And.intro ?_ ?_))
· have t := allKL_count s r _ (apx s r X C) (fun A hA => (hk A hA).1)
rw [apx_len] at t
exact t
· have t := allKR_count s r _ (apx s r X C) (fun A hA => (hk A hA).2.1)
rw [apx_len] at t
exact t
· intro T hT
cases mem_allKL T _ hT with
| intro A hA => exact (hk A hA.1).2.2.1 T hA.2
· intro T hT
cases mem_allKR T _ hT with
| intro A hA => exact (hk A hA.1).2.2.2 T hA.2
/-- The output CNF approximator has clauses of at most s - 1 variables. -/
theorem out_clauses (s r : Nat) (hs : 2 <= s) (hr : 2 <= r) (X : List (Nat -> Bool)) (C : List Gate) :
forall m, m ∈ (nthA (apx s r X C) 0).L (0, 0) -> m.length + 1 <= s :=
(nthA_sz s r hs hr _ (apx_sz s r hs hr X C) 0).1 (0, 0)
end Found.Pnp121
#print axioms Found.Pnp121.mem_selF
#print axioms Found.Pnp121.small_one
#print axioms Found.Pnp121.small_nil
#print axioms Found.Pnp121.small_empty
#print axioms Found.Pnp121.cst_sz
#print axioms Found.Pnp121.inp_sz
#print axioms Found.Pnp121.leaf_sz
#print axioms Found.Pnp121.op_sz
#print axioms Found.Pnp121.nthA_sz
#print axioms Found.Pnp121.apx_sz
#print axioms Found.Pnp121.kl_len
#print axioms Found.Pnp121.kr_len
#print axioms Found.Pnp121.join_len
#print axioms Found.Pnp121.kl_count
#print axioms Found.Pnp121.kr_count
#print axioms Found.Pnp121.apx_kok
#print axioms Found.Pnp121.apx_len
#print axioms Found.Pnp121.allKL_count
#print axioms Found.Pnp121.allKR_count
#print axioms Found.Pnp121.mem_allKL
#print axioms Found.Pnp121.mem_allKR
#print axioms Found.Pnp121.circuit_sizes
#print axioms Found.Pnp121.out_clauses
lean_all/found/Pnp122.lean
/-
T330 piece 122. found/Pnp122 -- the lower-bound criterion for monotone real circuits on test
inputs (Jukna, Boolean Function Complexity, Theorems 9.17, 9.18, 9.21 in counting form;
proof complexity ladder, step 2).
Let a monotone real circuit C output 1 on every positive test input (list Pos) and 0 on every
negative one (list Neg), and let 2 <= s, r. Then
(I) every negative input misses entirely some set of allKL (at most |C| (2r)^s sets of
s variables), or
(II) there is a set q of at most s - 1 variables such that every positive input hits q or
covers some set of allKR (at most |C| (2s)^r sets of r variables).
In counting form: |Neg| <= sum over T in allKL of #{x in Neg : x misses T}, or
|Pos| <= #{x in Pos : x hits q} + sum over T in allKR of #{x in Pos : x covers T}.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp121
namespace Found.Pnp122
open Found.Pnp65 (bv)
open Found.Pnp115 (anyL anyL_true lsum lsum_le len_lsum mem_cons_cases)
open Found.Pnp116 (allL anyL_ex mem_app_l mem_app_r)
open Found.Pnp117 (allLL allLL_mem allLL_false evCNF)
open Found.Pnp120 (apx nthA allKL allKR out_neg out_pos)
open Found.Pnp113 (Gate outV)
open Found.Pnp109 (out)
theorem anyL_false_all {α : Type} (g : α -> Bool) : forall L : List α, anyL g L = false -> forall a, a ∈ L -> g a = false
| [], _, _, h => nomatch h
| b :: L, h, a, ha => by
have h' : (g b || anyL g L) = false := h
cases e : g b with
| true => rw [e] at h'; exact Bool.noConfusion h'
| false =>
rw [e] at h'
cases mem_cons_cases ha with
| inl q => rw [q]; exact e
| inr h2 => exact anyL_false_all g L h' a h2
/-- The criterion. -/
theorem criterion (s r : Nat) (C : List Gate) (Pos Neg : List (Nat -> Bool))
(hP : forall x, x ∈ Pos -> out (outV x C) = true) (hN : forall x, x ∈ Neg -> out (outV x C) = false) :
(forall x, x ∈ Neg -> Exists fun T => T ∈ allKL (apx s r (Pos ++ Neg) C) /\ anyL x T = false) \/
(Exists fun q : List Nat => q ∈ (nthA (apx s r (Pos ++ Neg) C) 0).L (0, 0) /\
forall x, x ∈ Pos -> anyL x q = true \/ Exists fun T => T ∈ allKR (apx s r (Pos ++ Neg) C) /\ allL x T = true) := by
cases eL : (nthA (apx s r (Pos ++ Neg) C) 0).L (0, 0) with
| nil =>
refine Or.inl (fun x hx => ?_)
cases e : allLL (anyL x) (allKL (apx s r (Pos ++ Neg) C)) with
| false =>
cases allLL_false _ _ e with
| intro T hT => exact Exists.intro T hT
| true =>
have t := out_neg s r (Pos ++ Neg) x (mem_app_r x Neg Pos hx) C
(fun T hT => allLL_mem _ _ T e hT) (hN x hx)
rw [eL] at t
exact Bool.noConfusion t
| cons q rest =>
refine Or.inr (Exists.intro q (And.intro (List.Mem.head rest) (fun x hx => ?_)))
cases e : anyL (allL x) (allKR (apx s r (Pos ++ Neg) C)) with
| true =>
cases anyL_ex _ _ e with
| intro T hT => exact Or.inr (Exists.intro T hT)
| false =>
have t := out_pos s r (Pos ++ Neg) x (mem_app_l x Neg Pos hx) C
(anyL_false_all _ _ e) (hP x hx)
rw [eL] at t
exact Or.inl (allLL_mem _ _ q t (List.Mem.head rest))
/-! Counting. -/
theorem lsum_swap {α β : Type} (f : α -> β -> Nat) (B : List β) : forall A : List α,
lsum (fun a => lsum (fun b => f a b) B) A = lsum (fun b => lsum (fun a => f a b) A) B
| [] => (Found.Pnp115.lsum_zero_of _ B (fun _ _ => rfl)).symm
| a :: A => by
show lsum (fun b => f a b) B + lsum (fun a => lsum (fun b => f a b) B) A =
lsum (fun b => f a b + lsum (fun a => f a b) A) B
rw [lsum_swap f B A]
exact (lsum_add _ _ B).symm
where
lsum_add (g h : β -> Nat) : forall L : List β, lsum (fun b => g b + h b) L = lsum g L + lsum h L
| [] => rfl
| b :: L => by
show g b + h b + lsum (fun b => g b + h b) L = (g b + lsum g L) + (h b + lsum h L)
rw [lsum_add g h L, Found.Pnp93.add4]
theorem one_le_lsum {β : Type} (g : β -> Nat) : forall (L : List β) (b : β), b ∈ L -> 1 <= g b -> 1 <= lsum g L
| [], _, h, _ => nomatch h
| c :: L, b, h, hb => by
show 1 <= g c + lsum g L
cases mem_cons_cases h with
| inl q => rw [<- q]; exact Nat.le_trans hb (Nat.le_add_right _ _)
| inr h2 => exact Nat.le_trans (one_le_lsum g L b h2 hb) (Nat.le_add_left _ _)
/-- Union bound: if every x has a witness T in K with P x T, then |Xs| <= sum over T of #{x : P x T}. -/
theorem union_bound {α β : Type} (P : α -> β -> Bool) (K : List β) (Xs : List α)
(h : forall x, x ∈ Xs -> Exists fun T => T ∈ K /\ P x T = true) :
Xs.length <= lsum (fun T => lsum (fun x => bv (P x T)) Xs) K := by
rw [len_lsum Xs, <- lsum_swap (fun x T => bv (P x T)) K Xs]
refine lsum_le _ _ Xs (fun x hx => ?_)
cases h x hx with
| intro T hT =>
refine one_le_lsum (fun T => bv (P x T)) K T hT.1 ?_
show 1 <= bv (P x T)
rw [hT.2]
exact Nat.le_refl 1
def missB (x : Nat -> Bool) (T : List Nat) : Bool := !(anyL x T)
/-- The criterion in counting form. -/
theorem criterion_count (s r : Nat) (C : List Gate) (Pos Neg : List (Nat -> Bool))
(hP : forall x, x ∈ Pos -> out (outV x C) = true) (hN : forall x, x ∈ Neg -> out (outV x C) = false) :
Neg.length <= lsum (fun T => lsum (fun x => bv (missB x T)) Neg) (allKL (apx s r (Pos ++ Neg) C)) \/
(Exists fun q : List Nat => q ∈ (nthA (apx s r (Pos ++ Neg) C) 0).L (0, 0) /\
Pos.length <= lsum (fun x => bv (anyL x q)) Pos +
lsum (fun T => lsum (fun x => bv (allL x T)) Pos) (allKR (apx s r (Pos ++ Neg) C))) := by
cases criterion s r C Pos Neg hP hN with
| inl hI =>
refine Or.inl (union_bound missB _ Neg (fun x hx => ?_))
cases hI x hx with
| intro T hT =>
refine Exists.intro T (And.intro hT.1 ?_)
show (!(anyL x T)) = true
rw [hT.2]
rfl
| inr hII =>
cases hII with
| intro q hq =>
refine Or.inr (Exists.intro q (And.intro hq.1 ?_))
-- split Pos by whether x hits q
have hs : forall L : List (Nat -> Bool), (forall x, x ∈ L -> anyL x q = true \/
Exists fun T => T ∈ allKR (apx s r (Pos ++ Neg) C) /\ allL x T = true) ->
L.length <= lsum (fun x => bv (anyL x q)) L +
lsum (fun T => lsum (fun x => bv (allL x T)) L) (allKR (apx s r (Pos ++ Neg) C)) := by
intro L hL
let K := allKR (apx s r (Pos ++ Neg) C)
let P' : (Nat -> Bool) -> Option (List Nat) -> Bool := fun x o =>
match o with
| none => anyL x q
| some T => allL x T
have ub := union_bound P' (none :: Found.Pnp120.mapL some K) L (fun x hx => by
cases hL x hx with
| inl a => exact Exists.intro none (And.intro (List.Mem.head _) a)
| inr b =>
cases b with
| intro T hT => exact Exists.intro (some T) (And.intro
(List.Mem.tail none (Found.Pnp120.mem_mapL some T K hT.1)) hT.2))
refine Nat.le_trans ub (Nat.le_of_eq ?_)
show lsum (fun x => bv (anyL x q)) L + lsum (fun o => lsum (fun x => bv (P' x o)) L) (Found.Pnp120.mapL some K) = _
congr 1
exact lsum_map K
exact hs Pos hq.2
where
lsum_map {g : Option (List Nat) -> Nat} : forall K : List (List Nat),
lsum g (Found.Pnp120.mapL some K) = lsum (fun T => g (some T)) K
| [] => rfl
| T :: K => congrArg (g (some T) + ·) (lsum_map K)
end Found.Pnp122
#print axioms Found.Pnp122.anyL_false_all
#print axioms Found.Pnp122.criterion
#print axioms Found.Pnp122.lsum_swap
#print axioms Found.Pnp122.one_le_lsum
#print axioms Found.Pnp122.union_bound
#print axioms Found.Pnp122.criterion_count
lean_all/found/Pnp123.lean
/-
T330 piece 123. found/Pnp123 -- the variables of the approximation, and the circuit restricted
to off-diagonal edge variables (proof complexity ladder, step 2).
The sets produced by the transversal tree use only variables of the starting set and of the
list; the cut sets add a new variable at each step, so their variables are pairwise
different. Hence, if every input gate of a circuit reads a variable with property P, every
clause, monomial and correction set of its approximation uses only such variables, and every
correction set has pairwise different variables. The restriction of a circuit replaces every
input gate whose variable is not an off-diagonal edge variable p(i, j) (i <> j, i, j < n) by
the constant 0; it computes the original circuit on the input masked to those variables.
Proved:
* tr_vars, tr_snd_distinct: variables and distinctness in the tree;
* apx_vars, allKL_distinct, allKR_distinct: for a whole circuit;
* restrict_eval, restrict_inp: the restricted circuit.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp122
namespace Found.Pnp123
open Found.Pnp65 (bv anyI)
open Found.Pnp115 (Pw anyL mem_cons_cases beq_self)
open Found.Pnp116 (memN pierce firstU tr tr_none tr_some mem_brs1 mem_brs2 firstU_some mem_app memN_mem)
open Found.Pnp119 (GD Lf Rf KL KR cm mem_cm joinL mem_joinL fD fC Md Ma Da Ca)
open Found.Pnp120 (Apx selF cstA inpA nthA apx apxG gdOf allKL allKR mapL)
open Found.Pnp121 (mem_selF mem_allKL mem_allKR)
open Found.Pnp122 (anyL_false_all)
open Found.Pnp113 (Gate gval evalR nthV)
open Found.Pnp104 (pv)
/-! Variables in the tree. -/
def VarsOK (P : Nat -> Bool) (F : List (List Nat)) : Prop := forall m, m ∈ F -> forall v, v ∈ m -> P v = true
theorem tr_vars (C : List (List Nat)) : forall (d : Nat) (p m : List Nat), (m ∈ (tr C d p).1 \/ m ∈ (tr C d p).2) ->
forall v, v ∈ m -> v ∈ p \/ Exists fun q => q ∈ C /\ v ∈ q
| 0, p, m, h, v, hv => by
cases h with
| inl l => exact nomatch l
| inr r =>
cases mem_cons_cases r with
| inl q => rw [q] at hv; exact Or.inl hv
| inr h2 => exact nomatch h2
| d + 1, p, m, h, v, hv => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e] at h
cases h with
| inl l =>
cases mem_cons_cases l with
| inl q => rw [q] at hv; exact Or.inl hv
| inr h2 => exact nomatch h2
| inr r => exact nomatch r
| some q0 =>
rw [tr_some C d p q0 e] at h
have hq0 := firstU_some p C q0 e
have step : forall u, u ∈ q0 -> (m ∈ (tr C d (u :: p)).1 \/ m ∈ (tr C d (u :: p)).2) ->
v ∈ p \/ Exists fun q => q ∈ C /\ v ∈ q := by
intro u hu hm
cases tr_vars C d (u :: p) m hm v hv with
| inl l =>
cases mem_cons_cases l with
| inl q => rw [q]; exact Or.inr (Exists.intro q0 (And.intro hq0.1 hu))
| inr h2 => exact Or.inl h2
| inr r => exact Or.inr r
cases h with
| inl l =>
cases mem_brs1 _ m q0 l with
| intro u hu => exact step u hu.1 (Or.inl hu.2)
| inr r =>
cases mem_brs2 _ m q0 r with
| intro u hu => exact step u hu.1 (Or.inr hu.2)
theorem tr_ok (P : Nat -> Bool) (C : List (List Nat)) (hC : VarsOK P C) (d : Nat) :
VarsOK P (tr C d []).1 /\ VarsOK P (tr C d []).2 := by
refine And.intro (fun m hm v hv => ?_) (fun m hm v hv => ?_)
· cases tr_vars C d [] m (Or.inl hm) v hv with
| inl l => exact nomatch l
| inr r => cases r with | intro q hq => exact hC q hq.1 v hq.2
· cases tr_vars C d [] m (Or.inr hm) v hv with
| inl l => exact nomatch l
| inr r => cases r with | intro q hq => exact hC q hq.1 v hq.2
/-! Distinct variables in cut sets. -/
def Dist (m : List Nat) : Prop := Pw (fun a b => Not (a = b)) m
theorem memN_of_mem (v : Nat) : forall l : List Nat, v ∈ l -> memN v l = true
| [], h => nomatch h
| a :: l, h => by
show (Nat.beq v a || memN v l) = true
cases mem_cons_cases h with
| inl q => rw [q, beq_self]; rfl
| inr h2 => rw [memN_of_mem v l h2]; exact Found.Pnp65.or_true_r _
theorem tr_snd_distinct (C : List (List Nat)) : forall (d : Nat) (p m : List Nat), Dist p -> m ∈ (tr C d p).2 -> Dist m
| 0, p, m, hp, h => by
cases mem_cons_cases h with
| inl q => rw [q]; exact hp
| inr h2 => exact nomatch h2
| d + 1, p, m, hp, h => by
cases e : firstU p C with
| none =>
rw [tr_none C d p e] at h
exact nomatch h
| some q0 =>
rw [tr_some C d p q0 e] at h
have hq0 := firstU_some p C q0 e
cases mem_brs2 _ m q0 h with
| intro u hu =>
refine tr_snd_distinct C d (u :: p) m (And.intro (fun w hw ewu => ?_) hp) hu.2
have t : memN u p = false := anyL_false_all (fun v => memN v p) q0 hq0.2 u hu.1
rw [memN_of_mem u p (ewu ▸ hw)] at t
exact Bool.noConfusion t
/-! A whole circuit. -/
def gOK (P : Nat -> Bool) : Gate -> Prop
| .inp i => P i = true
| .cst _ => True
| .op _ _ _ _ => True
def InpOK (P : Nat -> Bool) : List Gate -> Prop
| [] => True
| g :: gs => gOK P g /\ InpOK P gs
def AOK (P : Nat -> Bool) (A : Apx) : Prop :=
(forall b, VarsOK P (A.L b)) /\ (forall b, VarsOK P (A.R b)) /\ VarsOK P A.KL /\ VarsOK P A.KR
theorem ok_selF (P : Nat -> Bool) (b : Bool) (u w : List (List Nat)) (hu : VarsOK P u) (hw : VarsOK P w) :
VarsOK P (selF b u w) := fun m hm => by
cases mem_selF b u w m hm with
| inl l => exact hu m l
| inr r => exact hw m r
theorem ok_nil (P : Nat -> Bool) : VarsOK P [] := fun _ h => nomatch h
theorem ok_nilnil (P : Nat -> Bool) : VarsOK P [[]] := fun m hm v hv => by
cases mem_cons_cases hm with
| inl q => rw [q] at hv; exact nomatch hv
| inr h2 => exact nomatch h2
theorem ok_one (P : Nat -> Bool) (i : Nat) (hi : P i = true) : VarsOK P [[i]] := fun m hm v hv => by
cases mem_cons_cases hm with
| inl q =>
rw [q] at hv
cases mem_cons_cases hv with
| inl q' => rw [q']; exact hi
| inr h2 => exact nomatch h2
| inr h2 => exact nomatch h2
theorem cst_ok (P : Nat -> Bool) (v : Nat × Nat) : AOK P (cstA v) :=
And.intro (fun _ => ok_selF P _ _ _ (ok_nil P) (ok_nilnil P))
(And.intro (fun _ => ok_selF P _ _ _ (ok_nilnil P) (ok_nil P)) (And.intro (ok_nil P) (ok_nil P)))
theorem inp_ok (P : Nat -> Bool) (i : Nat) (hi : P i = true) : AOK P (inpA i) :=
And.intro (fun _ => ok_selF P _ _ _ (ok_nil P) (ok_selF P _ _ _ (ok_one P i hi) (ok_nilnil P)))
(And.intro (fun _ => ok_selF P _ _ _ (ok_nilnil P) (ok_selF P _ _ _ (ok_one P i hi) (ok_nil P)))
(And.intro (ok_nil P) (ok_nil P)))
theorem ok_join (P : Nat -> Bool) (A B : List (List Nat)) (hA : VarsOK P A) (hB : VarsOK P B) : VarsOK P (joinL A B) :=
fun m hm v hv => by
cases mem_joinL A B m hm with
| intro a ha =>
cases ha.2 with
| intro b hb =>
rw [hb.2] at hv
cases mem_app v a b hv with
| inl l => exact hA a ha.1 v l
| inr r => exact hB b hb.1 v r
theorem ok_cm {α : Type} (P : Nat -> Bool) (f : α -> List (List Nat)) (L : List α) (h : forall u, VarsOK P (f u)) :
VarsOK P (cm f L) := fun m hm v hv => by
cases mem_cm f m L hm with
| intro u hu => exact h u m hu.2 v hv
theorem nthA_ok (P : Nat -> Bool) : forall (As : List Apx), (forall A, A ∈ As -> AOK P A) -> forall j, AOK P (nthA As j)
| [], _, _ => cst_ok P (0, 0)
| A :: _, h, 0 => h A (List.Mem.head _)
| A :: As, h, j + 1 => nthA_ok P As (fun B hB => h B (List.Mem.tail A hB)) j
theorem apx_vars (P : Nat -> Bool) (s r : Nat) (X : List (Nat -> Bool)) : forall C : List Gate, InpOK P C ->
forall A, A ∈ apx s r X C -> AOK P A
| [], _, _, h => nomatch h
| g :: gs, hC, A, h => by
cases mem_cons_cases h with
| inr h2 => exact apx_vars P s r X gs hC.2 A h2
| inl q =>
rw [q]
have hch := nthA_ok P (apx s r X gs) (apx_vars P s r X gs hC.2)
cases g with
| inp i => exact inp_ok P i hC.1
| cst v => exact cst_ok P v
| op f _ j k =>
have hfD : forall u, VarsOK P (fD (gdOf X gs (apx s r X gs) f j k) u) :=
fun u => ok_join P _ _ ((hch j).2.1 u.1) ((hch k).2.1 u.2)
have hfC : forall u, VarsOK P (fC (gdOf X gs (apx s r X gs) f j k) u) :=
fun u => ok_join P _ _ ((hch j).1 _) ((hch k).1 _)
exact And.intro (fun a => (tr_ok P _ (ok_cm P _ _ hfD) s).1)
(And.intro (fun a => (tr_ok P _ (ok_cm P _ _ hfC) r).1)
(And.intro (tr_ok P _ (ok_cm P _ _ hfD) s).2 (tr_ok P _ (ok_cm P _ _ hfC) r).2))
theorem allKL_vars (P : Nat -> Bool) (s r : Nat) (X : List (Nat -> Bool)) (C : List Gate) (hC : InpOK P C) :
VarsOK P (allKL (apx s r X C)) := fun T hT v hv => by
cases mem_allKL T _ hT with
| intro A hA => exact (apx_vars P s r X C hC A hA.1).2.2.1 T hA.2 v hv
theorem allKR_vars (P : Nat -> Bool) (s r : Nat) (X : List (Nat -> Bool)) (C : List Gate) (hC : InpOK P C) :
VarsOK P (allKR (apx s r X C)) := fun T hT v hv => by
cases mem_allKR T _ hT with
| intro A hA => exact (apx_vars P s r X C hC A hA.1).2.2.2 T hA.2 v hv
theorem out_vars (P : Nat -> Bool) (s r : Nat) (X : List (Nat -> Bool)) (C : List Gate) (hC : InpOK P C) :
VarsOK P ((nthA (apx s r X C) 0).L (0, 0)) :=
(nthA_ok P _ (apx_vars P s r X C hC) 0).1 (0, 0)
theorem apx_dist (s r : Nat) (X : List (Nat -> Bool)) : forall (C : List Gate) (A : Apx), A ∈ apx s r X C ->
(forall T, T ∈ A.KL -> Dist T) /\ (forall T, T ∈ A.KR -> Dist T)
| [], _, h => nomatch h
| g :: gs, A, h => by
cases mem_cons_cases h with
| inr h2 => exact apx_dist s r X gs A h2
| inl q =>
rw [q]
cases g with
| inp i => exact And.intro (fun _ h => nomatch h) (fun _ h => nomatch h)
| cst v => exact And.intro (fun _ h => nomatch h) (fun _ h => nomatch h)
| op f _ j k =>
exact And.intro (fun T hT => tr_snd_distinct _ s [] T True.intro hT)
(fun T hT => tr_snd_distinct _ r [] T True.intro hT)
theorem allKL_distinct (s r : Nat) (X : List (Nat -> Bool)) (C : List Gate) (T : List Nat)
(hT : T ∈ allKL (apx s r X C)) : Dist T := by
cases mem_allKL T _ hT with
| intro A hA => exact (apx_dist s r X C A hA.1).1 T hA.2
theorem allKR_distinct (s r : Nat) (X : List (Nat -> Bool)) (C : List Gate) (T : List Nat)
(hT : T ∈ allKR (apx s r X C)) : Dist T := by
cases mem_allKR T _ hT with
| intro A hA => exact (apx_dist s r X C A hA.1).2 T hA.2
/-! The restriction to off-diagonal edge variables. -/
/-- v is p(i, j) with i, j < n and i <> j. -/
def offE (n v : Nat) : Bool := Nat.blt v (n * n) && !(anyI (fun i => Nat.beq v (pv n i i)) n)
def selG (b : Bool) (g h : Gate) : Gate := match b with | true => g | false => h
def restrictG (n : Nat) : Gate -> Gate
| .inp i => selG (offE n i) (Gate.inp i) (Gate.cst (0, 0))
| .cst v => Gate.cst v
| .op f hf j k => Gate.op f hf j k
def restrict (n : Nat) (C : List Gate) : List Gate := mapL (restrictG n) C
def maskX (n : Nat) (x : Nat -> Bool) (v : Nat) : Bool := offE n v && x v
theorem restrict_eval (n : Nat) (x : Nat -> Bool) : forall C : List Gate, evalR x (restrict n C) = evalR (maskX n x) C
| [] => rfl
| g :: gs => by
show gval x (evalR x (restrict n gs)) (restrictG n g) :: evalR x (restrict n gs) =
gval (maskX n x) (evalR (maskX n x) gs) g :: evalR (maskX n x) gs
rw [restrict_eval n x gs]
cases g with
| inp i =>
show gval x _ (selG (offE n i) (Gate.inp i) (Gate.cst (0, 0))) :: _ = (bv (offE n i && x i), 0) :: _
cases e : offE n i with
| true => rfl
| false => rfl
| cst v => rfl
| op f hf j k => rfl
theorem restrict_inp (n : Nat) : forall C : List Gate, InpOK (offE n) (restrict n C)
| [] => True.intro
| g :: gs => by
refine And.intro ?_ (restrict_inp n gs)
show gOK (offE n) (restrictG n g)
cases g with
| inp i =>
show gOK (offE n) (selG (offE n i) (Gate.inp i) (Gate.cst (0, 0)))
cases e : offE n i with
| true => exact e
| false => exact True.intro
| cst v => exact True.intro
| op f hf j k => exact True.intro
theorem restrict_len (n : Nat) : forall C : List Gate, (restrict n C).length = C.length
| [] => rfl
| _ :: gs => congrArg (· + 1) (restrict_len n gs)
end Found.Pnp123
#print axioms Found.Pnp123.tr_vars
#print axioms Found.Pnp123.tr_ok
#print axioms Found.Pnp123.memN_of_mem
#print axioms Found.Pnp123.tr_snd_distinct
#print axioms Found.Pnp123.ok_selF
#print axioms Found.Pnp123.ok_nil
#print axioms Found.Pnp123.ok_nilnil
#print axioms Found.Pnp123.ok_one
#print axioms Found.Pnp123.cst_ok
#print axioms Found.Pnp123.inp_ok
#print axioms Found.Pnp123.ok_join
#print axioms Found.Pnp123.ok_cm
#print axioms Found.Pnp123.nthA_ok
#print axioms Found.Pnp123.apx_vars
#print axioms Found.Pnp123.allKL_vars
#print axioms Found.Pnp123.allKR_vars
#print axioms Found.Pnp123.out_vars
#print axioms Found.Pnp123.apx_dist
#print axioms Found.Pnp123.allKL_distinct
#print axioms Found.Pnp123.allKR_distinct
#print axioms Found.Pnp123.restrict_eval
#print axioms Found.Pnp123.restrict_inp
#print axioms Found.Pnp123.restrict_len
lean_all/found/Pnp124.lean
/-
T330 piece 124. found/Pnp124 -- sequences and forced positions (proof complexity ladder,
step 2: counting test inputs).
allSeq c n lists c ^ n sequences f with f i < c for i < n (built position by position with
extF). A test t p f at each position p looks only at f on positions <= p; at a forced
position at most one value passes, whatever came before. Then the sequences passing all
tests below n number at most c ^ (n - F), where F is the number of forced positions below n;
stated without subtraction:
#{f in allSeq c n : all tests pass} * c ^ F <= c ^ n.
Proved:
* allSeq_len, allSeq_rng: the list;
* lsum_cm, lsum_mapL, lsum_mul_r, lsum_const_eq, le_one_unique: counting tools;
* forced_count: the bound.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp123
namespace Found.Pnp124
open Found.Pnp65 (bv selN cntI)
open Found.Pnp90 (allI)
open Found.Pnp115 (Pw lsum lsum_le lsum_const_le mem_cons_cases beq_eq beq_self and_true_l and_true_r one_mul')
open Found.Pnp116 (mem_app len_app)
open Found.Pnp119 (cm mem_cm mem_cm_of)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp123 (Dist)
open Found.Pnp98 (mul_le_r add_mul' mul_add')
open Found.Pnp99 (mul_le_l' mul_assoc')
open Found.Pnp114 (mul_one')
def rng : Nat -> List Nat
| 0 => []
| c + 1 => c :: rng c
theorem mem_rng : forall (c v : Nat), v ∈ rng c -> v < c
| 0, _, h => nomatch h
| c + 1, v, h => by
cases mem_cons_cases h with
| inl q => rw [q]; exact Nat.lt_succ_self c
| inr h2 => exact Nat.lt_succ_of_lt (mem_rng c v h2)
theorem mem_rng_of : forall (c v : Nat), v < c -> v ∈ rng c
| 0, v, h => absurd h (Nat.not_lt_zero v)
| c + 1, v, h => by
cases Found.Pnp115.lt_succ_cases h with
| inl l => exact List.Mem.tail c (mem_rng_of c v l)
| inr e => rw [e]; exact List.Mem.head _
theorem rng_dist : forall c, Dist (rng c)
| 0 => True.intro
| c + 1 => And.intro (fun w hw e => Nat.lt_irrefl c (e ▸ mem_rng c w hw)) (rng_dist c)
theorem len_rng : forall c, (rng c).length = c
| 0 => rfl
| c + 1 => congrArg (· + 1) (len_rng c)
def extF (f : Nat -> Nat) (p v : Nat) (i : Nat) : Nat := selN (Nat.beq i p) v (f i)
theorem beq_lt (i p : Nat) (h : i < p) : Nat.beq i p = false := by
cases e : Nat.beq i p with
| false => rfl
| true => rw [beq_eq i p e] at h; exact absurd h (Nat.lt_irrefl p)
theorem extF_at (f : Nat -> Nat) (p v : Nat) : extF f p v p = v := by
show selN (Nat.beq p p) v (f p) = v
rw [beq_self]
rfl
theorem extF_lt (f : Nat -> Nat) (p v i : Nat) (h : i < p) : extF f p v i = f i := by
show selN (Nat.beq i p) v (f i) = f i
rw [beq_lt i p h]
rfl
def allSeq (c : Nat) : Nat -> List (Nat -> Nat)
| 0 => [fun _ => 0]
| n + 1 => cm (fun f => mapL (fun v => extF f n v) (rng c)) (allSeq c n)
/-! Counting tools. -/
theorem lsum_app {α : Type} (h : α -> Nat) (B : List α) : forall A : List α, lsum h (A ++ B) = lsum h A + lsum h B
| [] => (Nat.zero_add _).symm
| a :: A => by
show h a + lsum h (A ++ B) = h a + lsum h A + lsum h B
rw [lsum_app h B A, Nat.add_assoc]
theorem lsum_cm {α β : Type} (h : β -> Nat) (f : α -> List β) : forall L : List α,
lsum h (cm f L) = lsum (fun u => lsum h (f u)) L
| [] => rfl
| u :: L => by
show lsum h (f u ++ cm f L) = lsum h (f u) + lsum (fun u => lsum h (f u)) L
rw [lsum_app, lsum_cm h f L]
theorem lsum_mapL {α β : Type} (h : β -> Nat) (f : α -> β) : forall L : List α,
lsum h (mapL f L) = lsum (fun u => h (f u)) L
| [] => rfl
| u :: L => congrArg (h (f u) + ·) (lsum_mapL h f L)
theorem lsum_mul_r {α : Type} (h : α -> Nat) (M : Nat) : forall L : List α, lsum (fun u => h u * M) L = lsum h L * M
| [] => (Found.Pnp97.zero_mul' M).symm
| u :: L => by
show h u * M + lsum (fun u => h u * M) L = (h u + lsum h L) * M
rw [lsum_mul_r h M L, add_mul']
theorem lsum_const_eq {α : Type} (c : Nat) : forall L : List α, lsum (fun _ => c) L = L.length * c
| [] => (Found.Pnp97.zero_mul' c).symm
| _ :: L => by
show c + lsum (fun _ => c) L = (L.length + 1) * c
rw [lsum_const_eq c L, add_mul', one_mul', Nat.add_comm]
theorem len_cm {α β : Type} (f : α -> List β) : forall L : List α, (cm f L).length = lsum (fun u => (f u).length) L
| [] => rfl
| u :: L => by
show (f u ++ cm f L).length = (f u).length + lsum (fun u => (f u).length) L
rw [len_app, len_cm f L]
theorem len_mapL {α β : Type} (f : α -> β) : forall L : List α, (mapL f L).length = L.length
| [] => rfl
| _ :: L => congrArg (· + 1) (len_mapL f L)
theorem allSeq_len (c : Nat) : forall n, (allSeq c n).length = c ^ n
| 0 => rfl
| n + 1 => by
show (cm (fun f => mapL (fun v => extF f n v) (rng c)) (allSeq c n)).length = c ^ n * c
rw [len_cm]
have e : lsum (fun f => (mapL (fun v => extF f n v) (rng c)).length) (allSeq c n) = lsum (fun _ => c) (allSeq c n) := by
refine Nat.le_antisymm (lsum_le _ _ _ (fun f _ => ?_)) (lsum_le _ _ _ (fun f _ => ?_))
· rw [len_mapL, len_rng]; exact Nat.le_refl c
· rw [len_mapL, len_rng]; exact Nat.le_refl c
rw [e, lsum_const_eq, allSeq_len c n]
theorem allSeq_rng (c : Nat) : forall (n : Nat) (f : Nat -> Nat), f ∈ allSeq c n -> forall i, i < n -> f i < c
| 0, _, _, i, hi => absurd hi (Nat.not_lt_zero i)
| n + 1, f, h, i, hi => by
cases mem_cm _ f _ h with
| intro g hg =>
have hm : f ∈ mapL (fun v => extF g n v) (rng c) := hg.2
have ex : forall L : List Nat, f ∈ mapL (fun v => extF g n v) L -> Exists fun v => v ∈ L /\ f = extF g n v := by
intro L
induction L with
| nil => intro h'; exact nomatch h'
| cons v L ih =>
intro h'
cases mem_cons_cases h' with
| inl q => exact Exists.intro v (And.intro (List.Mem.head L) q)
| inr h2 =>
cases ih h2 with
| intro w hw => exact Exists.intro w (And.intro (List.Mem.tail v hw.1) hw.2)
cases ex (rng c) hm with
| intro v hv =>
rw [hv.2]
cases Found.Pnp115.lt_succ_cases hi with
| inl l => rw [extF_lt g n v i l]; exact allSeq_rng c n g hg.1 i l
| inr e => rw [e, extF_at]; exact mem_rng c v hv.1
/-- At most one element of a list of distinct numbers satisfies a property with at most one witness. -/
theorem le_one_unique (P : Nat -> Bool) : forall L : List Nat, Dist L ->
(forall v w, v ∈ L -> w ∈ L -> P v = true -> P w = true -> v = w) -> lsum (fun v => bv (P v)) L <= 1
| [], _, _ => Nat.zero_le 1
| v :: L, hd, hu => by
show bv (P v) + lsum (fun v => bv (P v)) L <= 1
cases e : P v with
| false =>
show 0 + _ <= 1
rw [Nat.zero_add]
exact le_one_unique P L hd.2 (fun a b ha hb => hu a b (List.Mem.tail v ha) (List.Mem.tail v hb))
| true =>
have z : lsum (fun v => bv (P v)) L = 0 := Found.Pnp115.lsum_zero_of _ L (fun w hw => by
cases ew : P w with
| false => rfl
| true => exact absurd (hu v w (List.Mem.head L) (List.Mem.tail v hw) e ew) (hd.1 w hw))
exact Nat.le_of_eq (congrArg (bv true + ·) z)
/-! Forced positions. -/
def good (t : Nat -> (Nat -> Nat) -> Bool) (n : Nat) (f : Nat -> Nat) : Bool := allI (fun p => t p f) n
theorem good_ext (t : Nat -> (Nat -> Nat) -> Bool)
(loc : forall p f f', (forall i, i <= p -> f i = f' i) -> t p f = t p f') (f : Nat -> Nat) (n v : Nat) :
forall k, k <= n -> allI (fun p => t p (extF f n v)) k = allI (fun p => t p f) k
| 0, _ => rfl
| k + 1, hk => by
show (allI (fun p => t p (extF f n v)) k && t k (extF f n v)) = (allI (fun p => t p f) k && t k f)
rw [good_ext t loc f n v k (Nat.le_of_succ_le hk),
loc k (extF f n v) f (fun i hi => extF_lt f n v i (Nat.lt_of_le_of_lt hi hk))]
theorem forced_count (c : Nat) (t : Nat -> (Nat -> Nat) -> Bool) (forced : Nat -> Bool)
(loc : forall p f f', (forall i, i <= p -> f i = f' i) -> t p f = t p f')
(uniq : forall p f, forced p = true -> forall v w, t p (extF f p v) = true -> t p (extF f p w) = true -> v = w) :
forall n, lsum (fun f => bv (good t n f)) (allSeq c n) * c ^ (cntI forced n) <= c ^ n
| 0 => by
show (bv true + 0) * 1 <= 1
exact Nat.le_refl 1
| n + 1 => by
have inner : forall f, lsum (fun v => bv (good t (n + 1) (extF f n v))) (rng c) <= bv (good t n f) * selN (forced n) 1 c := by
intro f
have e1 : forall v, good t (n + 1) (extF f n v) = (good t n f && t n (extF f n v)) := by
intro v
show (allI (fun p => t p (extF f n v)) n && t n (extF f n v)) = (good t n f && t n (extF f n v))
rw [good_ext t loc f n v n (Nat.le_refl n)]
rfl
have e2 : lsum (fun v => bv (good t (n + 1) (extF f n v))) (rng c) =
lsum (fun v => bv (good t n f && t n (extF f n v))) (rng c) :=
Nat.le_antisymm (lsum_le _ _ _ (fun v _ => by rw [e1 v]; exact Nat.le_refl _))
(lsum_le _ _ _ (fun v _ => by rw [e1 v]; exact Nat.le_refl _))
rw [e2]
cases eg : good t n f with
| false =>
have z := Found.Pnp115.lsum_zero_of (fun v => bv (false && t n (extF f n v))) (rng c) (fun _ _ => rfl)
rw [z]
exact Nat.zero_le _
| true =>
show lsum (fun v => bv (true && t n (extF f n v))) (rng c) <= 1 * selN (forced n) 1 c
rw [one_mul']
cases ef : forced n with
| true =>
show lsum (fun v => bv (true && t n (extF f n v))) (rng c) <= selN true 1 c
exact le_one_unique (fun v => true && t n (extF f n v)) (rng c) (rng_dist c)
(fun v w _ _ hv hw => uniq n f ef v w hv hw)
| false =>
show lsum (fun v => bv (true && t n (extF f n v))) (rng c) <= selN false 1 c
have t1 := lsum_const_le (fun v => bv (true && t n (extF f n v))) 1 (rng c)
(fun v _ => Found.Pnp107.bv_le1 _)
rw [len_rng, mul_one'] at t1
exact t1
have hstep : lsum (fun f => bv (good t (n + 1) f)) (allSeq c (n + 1)) <=
lsum (fun f => bv (good t n f)) (allSeq c n) * selN (forced n) 1 c := by
show lsum (fun f => bv (good t (n + 1) f)) (cm (fun f => mapL (fun v => extF f n v) (rng c)) (allSeq c n)) <= _
rw [lsum_cm, <- lsum_mul_r]
refine lsum_le _ _ _ (fun f _ => ?_)
rw [lsum_mapL]
exact inner f
have ih := forced_count c t forced loc uniq n
show lsum (fun f => bv (good t (n + 1) f)) (allSeq c (n + 1)) * c ^ (cntI forced n + bv (forced n)) <= c ^ n * c
cases ef : forced n with
| true =>
rw [ef] at hstep
have hstep' := Nat.le_trans hstep (Nat.le_of_eq (mul_one' _))
show lsum (fun f => bv (good t (n + 1) f)) (allSeq c (n + 1)) * (c ^ (cntI forced n) * c) <= c ^ n * c
rw [<- mul_assoc']
exact mul_le_r (Nat.le_trans (mul_le_r hstep' _) ih) c
| false =>
rw [ef] at hstep
have hstep' : lsum (fun f => bv (good t (n + 1) f)) (allSeq c (n + 1)) <=
lsum (fun f => bv (good t n f)) (allSeq c n) * c := hstep
show lsum (fun f => bv (good t (n + 1) f)) (allSeq c (n + 1)) * c ^ (cntI forced n) <= c ^ n * c
refine Nat.le_trans (mul_le_r hstep' _) ?_
rw [mul_assoc', Nat.mul_comm c, <- mul_assoc']
exact mul_le_r ih c
end Found.Pnp124
#print axioms Found.Pnp124.mem_rng
#print axioms Found.Pnp124.mem_rng_of
#print axioms Found.Pnp124.rng_dist
#print axioms Found.Pnp124.len_rng
#print axioms Found.Pnp124.beq_lt
#print axioms Found.Pnp124.extF_at
#print axioms Found.Pnp124.extF_lt
#print axioms Found.Pnp124.lsum_app
#print axioms Found.Pnp124.lsum_cm
#print axioms Found.Pnp124.lsum_mapL
#print axioms Found.Pnp124.lsum_mul_r
#print axioms Found.Pnp124.lsum_const_eq
#print axioms Found.Pnp124.len_cm
#print axioms Found.Pnp124.len_mapL
#print axioms Found.Pnp124.allSeq_len
#print axioms Found.Pnp124.allSeq_rng
#print axioms Found.Pnp124.le_one_unique
#print axioms Found.Pnp124.good_ext
#print axioms Found.Pnp124.forced_count
lean_all/found/Pnp125.lean
/-
T330 piece 125. found/Pnp125 -- merging labels along a list of edges (proof complexity
ladder, step 2: counting colourings that miss a correction set).
For a list E of edges (u, w) with u <> w, labs E gives every vertex a label: start with x
itself, and for each edge relabel the two classes of u and w to the smaller label. Then
labs_le: labs E x <= x;
labs_col: a colouring equal on the two ends of every edge is constant on each class,
col x = col (labs E x);
labs_root: every end point p of an edge has labs E p < p, or labs E p = p and another end
point w has label p.
A vertex is forced if its label is smaller than itself. Mapping every unforced end point
to such a w (found by search) is injective, so
endpoints_le: #end points below n <= 2 * #forced vertices below n.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp124
namespace Found.Pnp125
open Found.Pnp65 (bv selN cntI mn mn_le_l mn_le_r anyI anyI_true cntI_le or_true_r)
open Found.Pnp95 (inj_count)
open Found.Pnp115 (anyL anyL_true mem_cons_cases beq_eq beq_self and_true_l and_true_r)
open Found.Pnp116 (anyL_ex)
open Found.Pnp118 (ble_le le_ble)
def hit (lab : Nat -> Nat) (u w x : Nat) : Bool := Nat.beq (lab x) (lab u) || Nat.beq (lab x) (lab w)
def merge (lab : Nat -> Nat) (u w : Nat) (x : Nat) : Nat := selN (hit lab u w x) (mn (lab u) (lab w)) (lab x)
def labs : List (Nat × Nat) -> Nat -> Nat
| [] => fun x => x
| e :: E => merge (labs E) e.1 e.2
/-- p is an end point of an edge of E. -/
def inE (E : List (Nat × Nat)) (p : Nat) : Bool := anyL (fun e => Nat.beq p e.1 || Nat.beq p e.2) E
def fz (E : List (Nat × Nat)) (p : Nat) : Bool := Nat.blt (labs E p) p
theorem mn_cases (a b : Nat) : mn a b = a \/ mn a b = b := by
show selN (Nat.ble a b) a b = a \/ selN (Nat.ble a b) a b = b
cases Nat.ble a b with
| true => exact Or.inl rfl
| false => exact Or.inr rfl
theorem or_cases {a b : Bool} (h : (a || b) = true) : a = true \/ b = true := by
cases a with
| true => exact Or.inl rfl
| false => exact Or.inr h
theorem merge_hit (lab : Nat -> Nat) (u w x : Nat) (h : hit lab u w x = true) : merge lab u w x = mn (lab u) (lab w) := by
show selN (hit lab u w x) _ _ = _
rw [h]; rfl
theorem merge_miss (lab : Nat -> Nat) (u w x : Nat) (h : hit lab u w x = false) : merge lab u w x = lab x := by
show selN (hit lab u w x) _ _ = _
rw [h]; rfl
theorem hit_u (lab : Nat -> Nat) (u w : Nat) : hit lab u w u = true := by
show (Nat.beq (lab u) (lab u) || _) = true
rw [beq_self]; rfl
theorem hit_w (lab : Nat -> Nat) (u w : Nat) : hit lab u w w = true := by
show (_ || Nat.beq (lab w) (lab w)) = true
rw [beq_self]; exact or_true_r _
theorem labs_le : forall (E : List (Nat × Nat)) (x : Nat), labs E x <= x
| [], x => Nat.le_refl x
| e :: E, x => by
show merge (labs E) e.1 e.2 x <= x
cases eh : hit (labs E) e.1 e.2 x with
| false => rw [merge_miss _ _ _ _ eh]; exact labs_le E x
| true =>
rw [merge_hit _ _ _ _ eh]
cases or_cases eh with
| inl h => exact Nat.le_trans (mn_le_l _ _) (by rw [<- beq_eq _ _ h]; exact labs_le E x)
| inr h => exact Nat.le_trans (mn_le_r _ _) (by rw [<- beq_eq _ _ h]; exact labs_le E x)
theorem labs_col (col : Nat -> Nat) : forall E : List (Nat × Nat), (forall e, e ∈ E -> col e.1 = col e.2) ->
forall x, col x = col (labs E x)
| [], _, x => rfl
| e :: E, hE, x => by
have ih := labs_col col E (fun e' h' => hE e' (List.Mem.tail e h'))
have he := hE e (List.Mem.head E)
show col x = col (merge (labs E) e.1 e.2 x)
cases eh : hit (labs E) e.1 e.2 x with
| false => rw [merge_miss _ _ _ _ eh]; exact ih x
| true =>
rw [merge_hit _ _ _ _ eh]
-- every member of the merged class has the colour of e.1
have cu : col (labs E e.1) = col e.1 := (ih e.1).symm
have cw : col (labs E e.2) = col e.1 := ((ih e.2).symm).trans he.symm
have cm : col (mn (labs E e.1) (labs E e.2)) = col e.1 := by
cases mn_cases (labs E e.1) (labs E e.2) with
| inl q => rw [q]; exact cu
| inr q => rw [q]; exact cw
rw [cm]
cases or_cases eh with
| inl h => rw [ih x, beq_eq _ _ h]; exact cu
| inr h => rw [ih x, beq_eq _ _ h]; exact cw
theorem inE_cons (e : Nat × Nat) (E : List (Nat × Nat)) (p : Nat) :
inE (e :: E) p = ((Nat.beq p e.1 || Nat.beq p e.2) || inE E p) := rfl
theorem labs_root : forall E : List (Nat × Nat), (forall e, e ∈ E -> Not (e.1 = e.2)) ->
forall p, inE E p = true -> labs E p < p \/ (labs E p = p /\ Exists fun w => inE E w = true /\ Not (w = p) /\ labs E w = p)
| [], _, _, h => Bool.noConfusion h
| e :: E, hE, p, hp => by
have ih := labs_root E (fun e' h' => hE e' (List.Mem.tail e h'))
have hne := hE e (List.Mem.head E)
show merge (labs E) e.1 e.2 p < p \/ (merge (labs E) e.1 e.2 p = p /\
Exists fun w => inE (e :: E) w = true /\ Not (w = p) /\ merge (labs E) e.1 e.2 w = p)
cases eh : hit (labs E) e.1 e.2 p with
| true =>
rw [merge_hit _ _ _ _ eh]
cases Nat.lt_or_ge (mn (labs E e.1) (labs E e.2)) p with
| inl l => exact Or.inl l
| inr g =>
have hle : mn (labs E e.1) (labs E e.2) <= p := by
cases or_cases eh with
| inl h => exact Nat.le_trans (mn_le_l _ _) (by rw [<- beq_eq _ _ h]; exact labs_le E p)
| inr h => exact Nat.le_trans (mn_le_r _ _) (by rw [<- beq_eq _ _ h]; exact labs_le E p)
have eqm : mn (labs E e.1) (labs E e.2) = p := Nat.le_antisymm hle g
refine Or.inr (And.intro eqm ?_)
have i1 : inE (e :: E) e.1 = true := by rw [inE_cons, beq_self]; rfl
have i2 : inE (e :: E) e.2 = true := by
rw [inE_cons, beq_self]
show ((Nat.beq e.2 e.1 || true) || inE E e.2) = true
rw [or_true_r]; rfl
cases Nat.decEq e.1 p with
| isFalse ne1 =>
exact Exists.intro e.1 (And.intro i1 (And.intro ne1 (by rw [merge_hit _ _ _ _ (hit_u _ _ _)]; exact eqm)))
| isTrue e1 =>
refine Exists.intro e.2 (And.intro i2 (And.intro (fun q => hne (e1.trans q.symm)) ?_))
rw [merge_hit _ _ _ _ (hit_w _ _ _)]; exact eqm
| false =>
rw [merge_miss _ _ _ _ eh]
have hpE : inE E p = true := by
rw [inE_cons] at hp
cases or_cases hp with
| inr r => exact r
| inl l =>
cases or_cases l with
| inl h1 => rw [beq_eq _ _ h1, hit_u] at eh; exact Bool.noConfusion eh
| inr h2 => rw [beq_eq _ _ h2, hit_w] at eh; exact Bool.noConfusion eh
cases ih p hpE with
| inl l => exact Or.inl l
| inr r =>
refine Or.inr (And.intro r.1 ?_)
cases r.2 with
| intro w hw =>
refine Exists.intro w (And.intro ?_ (And.intro hw.2.1 ?_))
· rw [inE_cons, hw.1, or_true_r]
· have ehw : hit (labs E) e.1 e.2 w = false := by
show (Nat.beq (labs E w) (labs E e.1) || Nat.beq (labs E w) (labs E e.2)) = false
have ehp : (Nat.beq (labs E p) (labs E e.1) || Nat.beq (labs E p) (labs E e.2)) = false := eh
rw [hw.2.2]
rw [r.1] at ehp
exact ehp
rw [merge_miss _ _ _ _ ehw]
exact hw.2.2
/-! Counting end points against forced vertices. -/
def srch (g : Nat -> Bool) : Nat -> Nat
| 0 => 0
| k + 1 => selN (anyI g k) (srch g k) k
theorem srch_spec (g : Nat -> Bool) : forall k, anyI g k = true -> srch g k < k /\ g (srch g k) = true
| 0, h => Bool.noConfusion h
| k + 1, h => by
show selN (anyI g k) (srch g k) k < k + 1 /\ g (selN (anyI g k) (srch g k) k) = true
cases e : anyI g k with
| true =>
have t := srch_spec g k e
exact And.intro (Nat.lt_succ_of_lt t.1) t.2
| false =>
have h' : (anyI g k || g k) = true := h
rw [e] at h'
exact And.intro (Nat.lt_succ_self k) h'
theorem inE_lt (E : List (Nat × Nat)) (n : Nat) (hE : forall e, e ∈ E -> e.1 < n /\ e.2 < n) (p : Nat)
(h : inE E p = true) : p < n := by
cases anyL_ex _ E h with
| intro e he =>
cases or_cases he.2 with
| inl l => rw [beq_eq _ _ l]; exact (hE e he.1).1
| inr r => rw [beq_eq _ _ r]; exact (hE e he.1).2
theorem blt_of_lt (a b : Nat) (h : a < b) : Nat.blt a b = true := le_ble (a + 1) b h
theorem lt_of_blt (a b : Nat) (h : Nat.blt a b = true) : a < b := ble_le (a + 1) b h
theorem cntI_split2 (g h : Nat -> Bool) : forall k, cntI g k = cntI (fun p => g p && h p) k + cntI (fun p => g p && !(h p)) k
| 0 => rfl
| k + 1 => by
show cntI g k + bv (g k) = cntI (fun p => g p && h p) k + bv (g k && h k) + (cntI (fun p => g p && !(h p)) k + bv (g k && !(h k)))
rw [cntI_split2 g h k, Found.Pnp115.bv_split (g k) (h k), Found.Pnp93.add4]
def wg (E : List (Nat × Nat)) (p w : Nat) : Bool := inE E w && !(Nat.beq w p) && Nat.beq (labs E w) p
theorem endpoints_le (E : List (Nat × Nat)) (n : Nat) (hE : forall e, e ∈ E -> Not (e.1 = e.2) /\ e.1 < n /\ e.2 < n) :
cntI (inE E) n <= 2 * cntI (fz E) n := by
rw [cntI_split2 (inE E) (fz E) n, Nat.two_mul]
refine Nat.add_le_add (cntI_le _ _ n (fun j _ h => and_true_r h)) ?_
refine inj_count _ (fun p => srch (wg E p) n) n n (fz E) ?_ ?_
· intro x hx hA
have hin : inE E x = true := and_true_l hA
have hfz : fz E x = false := Found.Pnp91.not_true (and_true_r hA)
have hroot := labs_root E (fun e h => (hE e h).1) x hin
have hlx : labs E x = x := by
cases hroot with
| inl l =>
have hfz' : Nat.blt (labs E x) x = false := hfz
rw [blt_of_lt _ _ l] at hfz'; exact Bool.noConfusion hfz'
| inr r => exact r.1
cases hroot with
| inl l => rw [hlx] at l; exact absurd l (Nat.lt_irrefl x)
| inr r =>
cases r.2 with
| intro w hw =>
have hwn : w < n := inE_lt E n (fun e h => (hE e h).2) w hw.1
have hwg : wg E x w = true := by
show (inE E w && !(Nat.beq w x) && Nat.beq (labs E w) x) = true
rw [hw.1, hw.2.2, beq_self]
cases e : Nat.beq w x with
| true => exact absurd (beq_eq w x e) hw.2.1
| false => rfl
have sp := srch_spec (wg E x) n (anyI_true _ w hwg n hwn)
refine And.intro sp.1 ?_
have w' := sp.2
have l1 : labs E (srch (wg E x) n) = x := beq_eq _ _ (and_true_r w')
have l2 : Not (srch (wg E x) n = x) := by
intro q
have t := and_true_r (and_true_l w')
have t' : (!(Nat.beq (srch (wg E x) n) x)) = true := t
rw [q, beq_self] at t'
exact Bool.noConfusion t'
show Nat.blt (labs E (srch (wg E x) n)) (srch (wg E x) n) = true
rw [l1]
refine blt_of_lt _ _ ?_
have hle := labs_le E (srch (wg E x) n)
rw [l1] at hle
cases Nat.lt_or_ge x (srch (wg E x) n) with
| inl l => exact l
| inr g => exact absurd (Nat.le_antisymm hle g).symm l2
· intro x y hx hy hAx hAy he
have lx : forall z, z < n -> (inE E z && !(fz E z)) = true -> labs E (srch (wg E z) n) = z := by
intro z hz hA
have hin : inE E z = true := and_true_l hA
have hfz : fz E z = false := Found.Pnp91.not_true (and_true_r hA)
cases labs_root E (fun e h => (hE e h).1) z hin with
| inl l =>
have hfz' : Nat.blt (labs E z) z = false := hfz
rw [blt_of_lt _ _ l] at hfz'; exact Bool.noConfusion hfz'
| inr r =>
cases r.2 with
| intro w hw =>
have hwn : w < n := inE_lt E n (fun e h => (hE e h).2) w hw.1
have hwg : wg E z w = true := by
show (inE E w && !(Nat.beq w z) && Nat.beq (labs E w) z) = true
rw [hw.1, hw.2.2, beq_self]
cases e : Nat.beq w z with
| true => exact absurd (beq_eq w z e) hw.2.1
| false => rfl
exact beq_eq _ _ (and_true_r (srch_spec (wg E z) n (anyI_true _ w hwg n hwn)).2)
have ex := lx x hx hAx
have ey := lx y hy hAy
have he' : srch (wg E x) n = srch (wg E y) n := he
rw [he'] at ex
exact ex.symm.trans ey
end Found.Pnp125
#print axioms Found.Pnp125.mn_cases
#print axioms Found.Pnp125.or_cases
#print axioms Found.Pnp125.merge_hit
#print axioms Found.Pnp125.merge_miss
#print axioms Found.Pnp125.hit_u
#print axioms Found.Pnp125.hit_w
#print axioms Found.Pnp125.labs_le
#print axioms Found.Pnp125.labs_col
#print axioms Found.Pnp125.inE_cons
#print axioms Found.Pnp125.labs_root
#print axioms Found.Pnp125.srch_spec
#print axioms Found.Pnp125.inE_lt
#print axioms Found.Pnp125.blt_of_lt
#print axioms Found.Pnp125.lt_of_blt
#print axioms Found.Pnp125.cntI_split2
#print axioms Found.Pnp125.endpoints_le
lean_all/found/Pnp126.lean
/-
T330 piece 126. found/Pnp126 -- pigeonhole for lists of distinct numbers, and counting edge
variables over a vertex set (proof complexity ladder, step 2).
A list of pairwise different numbers below N, all with property P, has at most cntI P N
elements. The edge variables p(i, j) = i n + j with i, j in a vertex set V (i, j < n) number
exactly |V|^2 among the numbers below n * n. Hence a correction set of s different edge
variables with all end points in V has s <= |V|^2. Proved:
* pigeon: the pigeonhole bound;
* cntI_add, cntI_ext_lt, cntI_and_l: counting tools;
* pairB_eval, pairs_count: the edge variables over V.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp125
namespace Found.Pnp126
open Found.Pnp65 (bv cntI anyI anyI_true var var_inj)
open Found.Pnp96 (anyI_ex)
open Found.Pnp97 (cntI_sumI)
open Found.Pnp106 (sumI_ext_lt)
open Found.Pnp115 (Pw lsum filt mem_filt pw_filt lsum_filt lsum_split len_lsum lsum_le beq_eq beq_self and_true_l and_true_r one_mul')
open Found.Pnp123 (Dist)
open Found.Pnp124 (le_one_unique)
open Found.Pnp98 (add_mul')
open Found.Pnp104 (pv)
theorem pigeon (P : Nat -> Bool) : forall (N : Nat) (T : List Nat), Dist T -> (forall v, v ∈ T -> v < N /\ P v = true) ->
T.length <= cntI P N
| 0, [], _, _ => Nat.le_refl 0
| 0, v :: _, _, h => absurd (h v (List.Mem.head _)).1 (Nat.not_lt_zero v)
| N + 1, T, hd, h => by
show T.length <= cntI P N + bv (P N)
have sp : T.length = lsum (fun v => bv (true && !(Nat.beq v N))) T + lsum (fun v => bv (true && !(!(Nat.beq v N)))) T := by
rw [len_lsum T]
exact lsum_split (fun _ => true) (fun v => !(Nat.beq v N)) T
rw [sp]
refine Nat.add_le_add ?_ ?_
· rw [<- lsum_filt (fun v => true && !(Nat.beq v N)) T]
refine pigeon P N _ (pw_filt _ _ T hd) (fun v hv => ?_)
have m := mem_filt _ v T hv
have hvN := h v m.1
refine And.intro ?_ hvN.2
cases Found.Pnp115.lt_succ_cases hvN.1 with
| inl l => exact l
| inr e =>
have t : (true && !(Nat.beq v N)) = true := m.2
rw [e, beq_self] at t
exact Bool.noConfusion t
· cases eP : P N with
| true =>
refine le_one_unique (fun v => true && !(!(Nat.beq v N))) T hd (fun v w _ _ hv hw => ?_)
have hv' : (true && !(!(Nat.beq v N))) = true := hv
have hw' : (true && !(!(Nat.beq w N))) = true := hw
cases ev : Nat.beq v N with
| false => rw [ev] at hv'; exact Bool.noConfusion hv'
| true =>
cases ew : Nat.beq w N with
| false => rw [ew] at hw'; exact Bool.noConfusion hw'
| true => exact (beq_eq v N ev).trans (beq_eq w N ew).symm
| false =>
have z : lsum (fun v => bv (true && !(!(Nat.beq v N)))) T = 0 :=
Found.Pnp115.lsum_zero_of _ T (fun v hv => by
cases ev : Nat.beq v N with
| false => rfl
| true =>
have t := (h v hv).2
rw [beq_eq v N ev, eP] at t
exact Bool.noConfusion t)
rw [z]
exact Nat.le_refl 0
theorem cntI_add (g : Nat -> Bool) (a : Nat) : forall b, cntI g (a + b) = cntI g a + cntI (fun r => g (a + r)) b
| 0 => rfl
| b + 1 => by
show cntI g (a + b) + bv (g (a + b)) = cntI g a + (cntI (fun r => g (a + r)) b + bv (g (a + b)))
rw [cntI_add g a b, Nat.add_assoc]
theorem cntI_ext_lt (g h : Nat -> Bool) (k : Nat) (he : forall j, j < k -> g j = h j) : cntI g k = cntI h k := by
rw [cntI_sumI, cntI_sumI]
exact sumI_ext_lt _ _ k (fun j hj => congrArg bv (he j hj))
theorem cntI_and_l (b : Bool) (h : Nat -> Bool) : forall k, cntI (fun r => b && h r) k = bv b * cntI h k
| 0 => rfl
| k + 1 => by
show cntI (fun r => b && h r) k + bv (b && h k) = bv b * (cntI h k + bv (h k))
rw [cntI_and_l b h k, Found.Pnp98.mul_add']
cases b <;> cases h k <;> rfl
/-- p is an edge variable p(i, j) with both ends in V. -/
def pairB (n : Nat) (V : Nat -> Bool) (v : Nat) : Bool :=
anyI (fun i => anyI (fun j => Nat.beq v (pv n i j) && V i && V j) n) n
theorem pairB_eval (n : Nat) (V : Nat -> Bool) (q r : Nat) (hq : q < n) (hr : r < n) :
pairB n V (pv n q r) = (V q && V r) := by
cases e : (V q && V r) with
| true =>
refine anyI_true _ q ?_ n hq
refine anyI_true _ r ?_ n hr
show (Nat.beq (pv n q r) (pv n q r) && V q && V r) = true
rw [beq_self, Found.Pnp115.and_true_l e, Found.Pnp115.and_true_r e]
rfl
| false =>
cases eb : pairB n V (pv n q r) with
| false => rfl
| true =>
cases anyI_ex _ n eb with
| intro i hi =>
cases anyI_ex _ n hi.2 with
| intro j hj =>
have h3 := hj.2
have hb : Nat.beq (pv n q r) (pv n i j) = true := and_true_l (and_true_l h3)
have vi : V i = true := and_true_r (and_true_l h3)
have vj : V j = true := and_true_r h3
have inj := var_inj n q i r j hr hj.1 (beq_eq _ _ hb)
rw [inj.1, inj.2, vi, vj] at e
exact Bool.noConfusion e
theorem pairs_q (n : Nat) (V : Nat -> Bool) : forall q, q <= n -> cntI (pairB n V) (q * n) = cntI V q * cntI V n
| 0, _ => by
show cntI (pairB n V) (0 * n) = 0 * cntI V n
exact (congrArg (cntI (pairB n V)) (Nat.zero_mul n)).trans (Nat.zero_mul _).symm
| q + 1, hq => by
rw [add_mul', one_mul', cntI_add, pairs_q n V q (Nat.le_of_succ_le hq)]
have inner : cntI (fun r => pairB n V (q * n + r)) n = bv (V q) * cntI V n := by
rw [<- cntI_and_l (V q) V n]
exact cntI_ext_lt _ _ n (fun r hr => pairB_eval n V q r hq hr)
rw [inner]
show cntI V q * cntI V n + bv (V q) * cntI V n = (cntI V q + bv (V q)) * cntI V n
rw [add_mul']
theorem pairs_count (n : Nat) (V : Nat -> Bool) : cntI (pairB n V) (n * n) = cntI V n * cntI V n :=
pairs_q n V n (Nat.le_refl n)
/-- s different edge variables with all end points in V: s <= |V|^2. -/
theorem edges_le_sq (n : Nat) (V : Nat -> Bool) (T : List Nat) (hd : Dist T)
(h : forall v, v ∈ T -> Exists fun i => Exists fun j => i < n /\ j < n /\ v = pv n i j /\ V i = true /\ V j = true) :
T.length <= cntI V n * cntI V n := by
rw [<- pairs_count n V]
refine pigeon _ (n * n) T hd (fun v hv => ?_)
cases h v hv with
| intro i hi =>
cases hi with
| intro j hj =>
rw [hj.2.2.1]
refine And.intro (Found.Pnp104.lin_lt i j n n hj.1 hj.2.1) ?_
rw [pairB_eval n V i j hj.1 hj.2.1, hj.2.2.2.1, hj.2.2.2.2]
rfl
end Found.Pnp126
#print axioms Found.Pnp126.pigeon
#print axioms Found.Pnp126.cntI_add
#print axioms Found.Pnp126.cntI_ext_lt
#print axioms Found.Pnp126.cntI_and_l
#print axioms Found.Pnp126.pairB_eval
#print axioms Found.Pnp126.pairs_q
#print axioms Found.Pnp126.pairs_count
#print axioms Found.Pnp126.edges_le_sq
lean_all/found/Pnp127.lean
/-
T330 piece 127. found/Pnp127 -- colourings that miss a correction set (proof complexity
ladder, step 2: the negative side of the clique-colouring count).
The negative test input of a sequence col (a colouring of the n vertices with c colours) is
the graph xneg n col with the edges p(i, j) between differently coloured vertices. An
off-diagonal edge variable v decodes to its ends (srcV, dstV). For a correction set T of
pairwise different off-diagonal edge variables, let E be its list of edges and F the number
of forced vertices of the merging labels of E (Pnp125). Then
neg_bound: |T| <= (2F)^2 and #{col in allSeq c n : xneg n col misses T} * c^F <= c^n;
neg_colouring: col is a c-colouring of xneg n col (the hypothesis of Pnp112).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp126
namespace Found.Pnp127
open Found.Pnp65 (bv selN cntI anyI anyI_true anyI_false var_inj)
open Found.Pnp90 (allI)
open Found.Pnp96 (anyI_ex)
open Found.Pnp99 (le_ex)
open Found.Pnp115 (anyL anyL_true lsum lsum_le mem_cons_cases beq_eq beq_self and_true_l and_true_r)
open Found.Pnp116 (anyL_ex)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp122 (missB anyL_false_all)
open Found.Pnp123 (Dist offE)
open Found.Pnp124 (allSeq allSeq_rng extF extF_at extF_lt good forced_count)
open Found.Pnp125 (labs inE fz labs_le labs_col endpoints_le srch srch_spec lt_of_blt or_cases inE_cons)
open Found.Pnp126 (edges_le_sq)
open Found.Pnp104 (pv lin_lt)
open Found.Pnp112 (Colouring)
/-! Decoding edge variables. -/
theorem split_lt (n : Nat) : forall (q v : Nat), v < q * n -> Exists fun i => Exists fun j => i < q /\ j < n /\ v = pv n i j
| 0, v, h => by rw [Nat.zero_mul] at h; exact absurd h (Nat.not_lt_zero v)
| q + 1, v, h => by
rw [Found.Pnp98.add_mul', Found.Pnp115.one_mul'] at h
cases Nat.lt_or_ge v (q * n) with
| inl l =>
cases split_lt n q v l with
| intro i hi =>
cases hi with
| intro j hj => exact Exists.intro i (Exists.intro j (And.intro (Nat.lt_succ_of_lt hj.1) hj.2))
| inr g =>
cases le_ex v (q * n) g with
| intro d hd =>
refine Exists.intro q (Exists.intro d (And.intro (Nat.lt_succ_self q) (And.intro ?_ hd)))
rw [hd] at h
exact Nat.lt_of_add_lt_add_left h
def rowB (n v i : Nat) : Bool := anyI (fun j => Nat.beq v (pv n i j)) n
def srcV (n v : Nat) : Nat := srch (rowB n v) n
def dstV (n v : Nat) : Nat := srch (fun j => Nat.beq v (pv n (srcV n v) j)) n
theorem decode (n v : Nat) (h : offE n v = true) :
srcV n v < n /\ dstV n v < n /\ v = pv n (srcV n v) (dstV n v) /\ Not (srcV n v = dstV n v) := by
have hlt : v < n * n := Found.Pnp125.lt_of_blt v (n * n) (and_true_l h)
have hnd : anyI (fun i => Nat.beq v (pv n i i)) n = false := Found.Pnp91.not_true (and_true_r h)
cases split_lt n n v hlt with
| intro i hi =>
cases hi with
| intro j hj =>
have hrow : rowB n v i = true := anyI_true _ j (by rw [hj.2.2, beq_self]) n hj.2.1
have s1 := srch_spec (rowB n v) n (anyI_true _ i hrow n hj.1)
have s2 := srch_spec (fun j => Nat.beq v (pv n (srcV n v) j)) n s1.2
have ev : v = pv n (srcV n v) (dstV n v) := beq_eq _ _ s2.2
refine And.intro s1.1 (And.intro s2.1 (And.intro ev (fun e => ?_)))
have ev' : v = pv n (srcV n v) (srcV n v) := ev.trans (congrArg (pv n (srcV n v)) e.symm)
have t : Nat.beq v (pv n (srcV n v) (srcV n v)) = true := by
rw [<- ev']
exact beq_self v
have t' := anyI_false _ n hnd (srcV n v) s1.1
rw [t] at t'
exact Bool.noConfusion t'
/-! The negative test inputs. -/
def xneg (n : Nat) (col : Nat -> Nat) (v : Nat) : Bool :=
anyI (fun i => anyI (fun j => Nat.beq v (pv n i j) && !(Nat.beq (col i) (col j))) n) n
theorem xneg_false (n : Nat) (col : Nat -> Nat) (i j : Nat) (hi : i < n) (hj : j < n) (h : xneg n col (pv n i j) = false) :
col i = col j := by
have t := anyI_false _ n (anyI_false _ n h i hi) j hj
have t' : (Nat.beq (pv n i j) (pv n i j) && !(Nat.beq (col i) (col j))) = false := t
rw [beq_self] at t'
cases e : Nat.beq (col i) (col j) with
| true => exact beq_eq _ _ e
| false => rw [e] at t'; exact Bool.noConfusion t'
theorem neg_colouring (n c : Nat) (col : Nat -> Nat) (hc : col ∈ allSeq c n) : Colouring n c col (xneg n col) := by
refine Colouring.mk (fun i hi => allSeq_rng c n col hc i hi) (fun i j hi hj he hcol => ?_)
cases anyI_ex _ n he with
| intro i' hi' =>
cases anyI_ex _ n hi'.2 with
| intro j' hj' =>
have inj := var_inj n i i' j j' hj hj'.1 (beq_eq _ _ (and_true_l hj'.2))
have t := and_true_r hj'.2
rw [<- inj.1, <- inj.2, hcol, beq_self] at t
exact Bool.noConfusion t
def edgesOf (n : Nat) (T : List Nat) : List (Nat × Nat) := mapL (fun v => (srcV n v, dstV n v)) T
theorem mem_mapL_inv {α β : Type} (f : α -> β) (b : β) : forall L : List α, b ∈ mapL f L -> Exists fun a => a ∈ L /\ b = f a
| [], h => nomatch h
| a :: L, h => by
cases mem_cons_cases h with
| inl q => exact Exists.intro a (And.intro (List.Mem.head L) q)
| inr h2 =>
cases mem_mapL_inv f b L h2 with
| intro a' ha => exact Exists.intro a' (And.intro (List.Mem.tail a ha.1) ha.2)
theorem allI_of (g : Nat -> Bool) : forall k, (forall p, p < k -> g p = true) -> allI g k = true
| 0, _ => rfl
| k + 1, h => by
show (allI g k && g k) = true
rw [allI_of g k (fun p hp => h p (Nat.lt_succ_of_lt hp)), h k (Nat.lt_succ_self k)]
rfl
def tst (E : List (Nat × Nat)) (p : Nat) (f : Nat -> Nat) : Bool := !(fz E p) || Nat.beq (f p) (f (labs E p))
theorem neg_bound (n c : Nat) (T : List Nat) (hT : forall v, v ∈ T -> offE n v = true) (hd : Dist T) :
Exists fun F => T.length <= (2 * F) * (2 * F) /\
lsum (fun col => bv (missB (xneg n col) T)) (allSeq c n) * c ^ F <= c ^ n := by
let E := edgesOf n T
have hE : forall e, e ∈ E -> Not (e.1 = e.2) /\ e.1 < n /\ e.2 < n := by
intro e he
cases mem_mapL_inv _ e T he with
| intro v hv =>
have dv := decode n v (hT v hv.1)
rw [hv.2]
exact And.intro dv.2.2.2 (And.intro dv.1 dv.2.1)
refine Exists.intro (cntI (fz E) n) (And.intro ?_ ?_)
· have hV := endpoints_le E n hE
refine Nat.le_trans ?_ (Nat.mul_le_mul hV hV)
refine edges_le_sq n (inE E) T hd (fun v hv => ?_)
have dv := decode n v (hT v hv)
have hmem : (srcV n v, dstV n v) ∈ E := mem_mapL _ v T hv
refine Exists.intro (srcV n v) (Exists.intro (dstV n v) (And.intro dv.1 (And.intro dv.2.1 (And.intro dv.2.2.1 ?_))))
refine And.intro ?_ ?_
· refine anyL_true _ (srcV n v, dstV n v) ?_ E hmem
show (Nat.beq (srcV n v) (srcV n v) || Nat.beq (srcV n v) (dstV n v)) = true
rw [beq_self]; rfl
· refine anyL_true _ (srcV n v, dstV n v) ?_ E hmem
show (Nat.beq (dstV n v) (srcV n v) || Nat.beq (dstV n v) (dstV n v)) = true
rw [beq_self]; exact Found.Pnp65.or_true_r _
· have loc : forall p f f', (forall i, i <= p -> f i = f' i) -> tst E p f = tst E p f' := by
intro p f f' hf
show (!(fz E p) || Nat.beq (f p) (f (labs E p))) = (!(fz E p) || Nat.beq (f' p) (f' (labs E p)))
rw [hf p (Nat.le_refl p), hf (labs E p) (labs_le E p)]
have uniq : forall p f, fz E p = true -> forall v w, tst E p (extF f p v) = true -> tst E p (extF f p w) = true -> v = w := by
intro p f hp v w hv hw
have hl : labs E p < p := lt_of_blt _ _ hp
have hv' : (!(fz E p) || Nat.beq (extF f p v p) (extF f p v (labs E p))) = true := hv
have hw' : (!(fz E p) || Nat.beq (extF f p w p) (extF f p w (labs E p))) = true := hw
rw [hp, extF_at, extF_lt f p v _ hl] at hv'
rw [hp, extF_at, extF_lt f p w _ hl] at hw'
exact (beq_eq _ _ hv').trans (beq_eq _ _ hw').symm
have fc := forced_count c (tst E) (fz E) loc uniq n
refine Nat.le_trans (Found.Pnp98.mul_le_r ?_ _) fc
refine lsum_le _ _ _ (fun col _ => Found.Pnp65.bv_le _ _ (fun hm => ?_))
have hmiss : anyL (xneg n col) T = false := Found.Pnp91.not_true hm
have hedge : forall e, e ∈ E -> col e.1 = col e.2 := by
intro e he
cases mem_mapL_inv _ e T he with
| intro v hv =>
have dv := decode n v (hT v hv.1)
have xf := anyL_false_all _ T hmiss v hv.1
rw [dv.2.2.1] at xf
rw [hv.2]
exact xneg_false n col _ _ dv.1 dv.2.1 xf
refine allI_of _ n (fun p _ => ?_)
show (!(fz E p) || Nat.beq (col p) (col (labs E p))) = true
rw [<- labs_col col E hedge p, beq_self]
exact Found.Pnp65.or_true_r _
end Found.Pnp127
#print axioms Found.Pnp127.split_lt
#print axioms Found.Pnp127.decode
#print axioms Found.Pnp127.xneg_false
#print axioms Found.Pnp127.neg_colouring
#print axioms Found.Pnp127.mem_mapL_inv
#print axioms Found.Pnp127.allI_of
#print axioms Found.Pnp127.neg_bound
lean_all/found/Pnp128.lean
/-
T330 piece 128. found/Pnp128 -- transversal cliques that cover a correction set (proof
complexity ladder, step 2: the positive side of the clique-colouring count).
The n = k b vertices form k blocks of b. A sequence sigma in allSeq b k chooses the vertex
l b + sigma l in block l; the positive test input xpos is the clique on the chosen vertices.
For a correction set T of different off-diagonal edge variables, with end point set V (of
size |V| = cntI V n), proved:
* pos_clique: the chosen vertices form a k-clique of xpos (the hypothesis of Pnp112);
* pos_cover: |T| <= |V|^2 and #{sigma : xpos sigma covers T} * b^|V| <= b^k (if two end
points share a block nothing covers T; otherwise every block of an end point is forced);
* pos_one: #{sigma : xpos sigma v = true} * b^2 <= b^k for an off-diagonal v.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp127
namespace Found.Pnp128
open Found.Pnp65 (bv selN cntI anyI anyI_true anyI_false var_inj or_true_r bv_le)
open Found.Pnp90 (allI)
open Found.Pnp95 (inj_count)
open Found.Pnp96 (anyI_ex)
open Found.Pnp115 (anyL anyL_true lsum lsum_le mem_cons_cases beq_eq beq_self and_true_l and_true_r)
open Found.Pnp116 (allL allL_mem anyL_ex)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp123 (Dist offE)
open Found.Pnp124 (allSeq allSeq_rng extF extF_at extF_lt good forced_count)
open Found.Pnp125 (inE srch srch_spec or_cases)
open Found.Pnp126 (edges_le_sq pigeon)
open Found.Pnp127 (decode srcV dstV edgesOf mem_mapL_inv allI_of split_lt)
open Found.Pnp104 (pv lin_lt)
open Found.Pnp112 (Clique)
def xpos (n b k : Nat) (sg : Nat -> Nat) (v : Nat) : Bool :=
anyI (fun l => anyI (fun l' => Nat.beq v (pv n (l * b + sg l) (l' * b + sg l')) && !(Nat.beq l l')) k) k
theorem vtx_lt (b k l w : Nat) (hl : l < k) (hw : w < b) : l * b + w < k * b := lin_lt l w k b hl hw
theorem pos_clique (b k : Nat) (sg : Nat -> Nat) (hs : sg ∈ allSeq b k) :
Clique (k * b) k (fun l => l * b + sg l) (xpos (k * b) b k sg) := by
have rg := allSeq_rng b k sg hs
refine Clique.mk (fun l hl => vtx_lt b k l _ hl (rg l hl)) (fun l l' hl hl' he => (var_inj b l l' _ _ (rg l hl) (rg l' hl') he).1)
(fun l l' hll hl' => ?_)
have hl : l < k := Nat.lt_trans hll hl'
refine anyI_true _ l ?_ k hl
refine anyI_true _ l' ?_ k hl'
show (Nat.beq (pv (k * b) (l * b + sg l) (l' * b + sg l')) (pv (k * b) (l * b + sg l) (l' * b + sg l')) && !(Nat.beq l l')) = true
rw [beq_self]
cases e : Nat.beq l l' with
| true => rw [beq_eq l l' e] at hll; exact absurd hll (Nat.lt_irrefl l')
| false => rfl
/-- If xpos sigma has the edge p(i, j), both ends are chosen vertices. -/
theorem pos_ends (b k : Nat) (sg : Nat -> Nat) (i j : Nat) (_hi : i < k * b) (hj : j < k * b) (hs : sg ∈ allSeq b k)
(h : xpos (k * b) b k sg (pv (k * b) i j) = true) :
(Exists fun l => l < k /\ i = l * b + sg l) /\ (Exists fun l => l < k /\ j = l * b + sg l) := by
have rg := allSeq_rng b k sg hs
cases anyI_ex _ k h with
| intro l hl =>
cases anyI_ex _ k hl.2 with
| intro l' hl' =>
have inj := var_inj (k * b) i _ j _ hj (vtx_lt b k l' _ hl'.1 (rg l' hl'.1)) (beq_eq _ _ (and_true_l hl'.2))
exact And.intro (Exists.intro l (And.intro hl.1 inj.1)) (Exists.intro l' (And.intro hl'.1 inj.2))
/-! Covering a correction set. -/
def tP (b : Nat) (V : Nat -> Bool) (l : Nat) (sg : Nat -> Nat) : Bool :=
allI (fun w => !(V (l * b + w)) || Nat.beq (sg l) w) b
def forcedB (b : Nat) (V : Nat -> Bool) (l : Nat) : Bool := anyI (fun w => V (l * b + w)) b
def twoB (b k : Nat) (V : Nat -> Bool) : Bool :=
anyI (fun l => anyI (fun w => anyI (fun w' => V (l * b + w) && V (l * b + w') && !(Nat.beq w w')) b) b) k
theorem pow_le_exp (b : Nat) (hb : 1 <= b) : forall (a c : Nat), a <= c -> b ^ a <= b ^ c
| a, 0, h => by
cases a with
| zero => exact Nat.le_refl 1
| succ a => exact absurd h (Nat.not_succ_le_zero a)
| a, c + 1, h => by
cases Found.Pnp115.lt_succ_cases (Nat.lt_succ_of_le h) with
| inl l =>
have t := pow_le_exp b hb a c (Nat.le_of_lt_succ l)
show b ^ a <= b ^ c * b
exact Nat.le_trans t (Nat.le_trans (Nat.le_of_eq (Found.Pnp114.mul_one' _).symm) (Found.Pnp99.mul_le_l' hb _))
| inr e => rw [e]; exact Nat.le_refl _
theorem allI_mem (g : Nat -> Bool) : forall k, allI g k = true -> forall p, p < k -> g p = true
| 0, _, p, hp => absurd hp (Nat.not_lt_zero p)
| k + 1, h, p, hp => by
cases Found.Pnp115.lt_succ_cases hp with
| inl l => exact allI_mem g k (and_true_l h) p l
| inr e => rw [e]; exact and_true_r h
/-- The end point set V of T, and the covering count. -/
theorem pos_cover (b k : Nat) (hb : 1 <= b) (T : List Nat) (hT : forall v, v ∈ T -> offE (k * b) v = true) (hd : Dist T) :
T.length <= cntI (inE (edgesOf (k * b) T)) (k * b) * cntI (inE (edgesOf (k * b) T)) (k * b) /\
lsum (fun sg => bv (allL (xpos (k * b) b k sg) T)) (allSeq b k) * b ^ (cntI (inE (edgesOf (k * b) T)) (k * b)) <= b ^ k := by
let n := k * b
let E := edgesOf n T
let V := inE E
refine And.intro ?_ ?_
· refine edges_le_sq n V T hd (fun v hv => ?_)
have dv := decode n v (hT v hv)
have hmem : (srcV n v, dstV n v) ∈ E := mem_mapL _ v T hv
refine Exists.intro (srcV n v) (Exists.intro (dstV n v) (And.intro dv.1 (And.intro dv.2.1 (And.intro dv.2.2.1 (And.intro ?_ ?_)))))
· refine anyL_true _ (srcV n v, dstV n v) ?_ E hmem
show (Nat.beq (srcV n v) (srcV n v) || Nat.beq (srcV n v) (dstV n v)) = true
rw [beq_self]; rfl
· refine anyL_true _ (srcV n v, dstV n v) ?_ E hmem
show (Nat.beq (dstV n v) (srcV n v) || Nat.beq (dstV n v) (dstV n v)) = true
rw [beq_self]; exact or_true_r _
· -- every end point of a covered T is a chosen vertex
have chosen : forall sg, sg ∈ allSeq b k -> allL (xpos n b k sg) T = true -> forall u, V u = true ->
Exists fun l => l < k /\ u = l * b + sg l := by
intro sg hs hc u hu
cases anyL_ex _ E hu with
| intro e he =>
cases mem_mapL_inv _ e T he.1 with
| intro v hv =>
have dv := decode n v (hT v hv.1)
have xv := allL_mem _ T v hc hv.1
rw [dv.2.2.1] at xv
have ends := pos_ends b k sg _ _ dv.1 dv.2.1 hs xv
have he2 := he.2
rw [hv.2] at he2
cases or_cases he2 with
| inl q => rw [beq_eq _ _ q]; exact ends.1
| inr q => rw [beq_eq _ _ q]; exact ends.2
cases etw : twoB b k V with
| true =>
-- two end points in one block: nothing covers T
have z : lsum (fun sg => bv (allL (xpos n b k sg) T)) (allSeq b k) = 0 := by
refine Found.Pnp115.lsum_zero_of _ _ (fun sg hs => ?_)
cases ec : allL (xpos n b k sg) T with
| false => rfl
| true =>
have rg := allSeq_rng b k sg hs
cases anyI_ex _ k etw with
| intro l hl =>
cases anyI_ex _ b hl.2 with
| intro w hw =>
cases anyI_ex _ b hw.2 with
| intro w' hw' =>
have h3 := hw'.2
have c1 := chosen sg hs ec _ (and_true_l (and_true_l h3))
have c2 := chosen sg hs ec _ (and_true_r (and_true_l h3))
cases c1 with
| intro l1 h1 =>
cases c2 with
| intro l2 h2 =>
have i1 := var_inj b l l1 w (sg l1) hw.1 (rg l1 h1.1) h1.2
have i2 := var_inj b l l2 w' (sg l2) hw'.1 (rg l2 h2.1) h2.2
have eww : w = w' := by rw [i1.2, i2.2, <- i1.1, <- i2.1]
have t := and_true_r h3
rw [eww, beq_self] at t
exact Bool.noConfusion t
rw [z, Found.Pnp97.zero_mul']
exact Nat.zero_le _
| false =>
have loc : forall p f f', (forall i, i <= p -> f i = f' i) -> tP b V p f = tP b V p f' := by
intro p f f' hf
show allI (fun w => !(V (p * b + w)) || Nat.beq (f p) w) b = allI (fun w => !(V (p * b + w)) || Nat.beq (f' p) w) b
rw [hf p (Nat.le_refl p)]
have uniq : forall p f, forcedB b V p = true -> forall v w, tP b V p (extF f p v) = true -> tP b V p (extF f p w) = true -> v = w := by
intro p f hp v w hv hw
cases anyI_ex _ b hp with
| intro w0 hw0 =>
have a1 := allI_mem _ b hv w0 hw0.1
have a2 := allI_mem _ b hw w0 hw0.1
have a1' : (!(V (p * b + w0)) || Nat.beq (extF f p v p) w0) = true := a1
have a2' : (!(V (p * b + w0)) || Nat.beq (extF f p w p) w0) = true := a2
rw [hw0.2, extF_at] at a1'
rw [hw0.2, extF_at] at a2'
exact (beq_eq _ _ a1').trans (beq_eq _ _ a2').symm
have fc := forced_count b (tP b V) (forcedB b V) loc uniq k
-- end points inject into forced blocks
have hinj : cntI V n <= cntI (forcedB b V) k := by
let blk : Nat -> Nat := fun u => srch (fun l => anyI (fun w => Nat.beq u (l * b + w)) b) k
have dec : forall u, u < n -> Exists fun w => w < b /\ blk u < k /\ u = blk u * b + w := by
intro u hu
cases split_lt b k u hu with
| intro l hl =>
cases hl with
| intro w hw =>
have hrow : anyI (fun w' => Nat.beq u (l * b + w')) b = true := anyI_true _ w (by rw [hw.2.2]; exact beq_self _) b hw.2.1
have sp := srch_spec (fun l => anyI (fun w => Nat.beq u (l * b + w)) b) k (anyI_true _ l hrow k hw.1)
cases anyI_ex _ b sp.2 with
| intro w' hw' => exact Exists.intro w' (And.intro hw'.1 (And.intro sp.1 (beq_eq _ _ hw'.2)))
refine inj_count V blk k n (forcedB b V) (fun u hu hV => ?_) (fun u u' hu hu' hV hV' he => ?_)
· cases dec u hu with
| intro w hw =>
refine And.intro hw.2.1 (anyI_true _ w ?_ b hw.1)
rw [<- hw.2.2]; exact hV
· cases dec u hu with
| intro w hw =>
cases dec u' hu' with
| intro w' hw' =>
have hu2 := hw.2.2
have hu2' := hw'.2.2
rw [he] at hu2
cases Nat.decEq w w' with
| isTrue q => exact hu2.trans (by rw [q]; exact hu2'.symm)
| isFalse q =>
have t : twoB b k V = true := by
refine anyI_true _ (blk u') ?_ k hw'.2.1
refine anyI_true _ w ?_ b hw.1
refine anyI_true _ w' ?_ b hw'.1
rw [<- hu2, <- hu2', hV, hV']
cases e : Nat.beq w w' with
| true => exact absurd (beq_eq _ _ e) q
| false => rfl
rw [etw] at t
exact Bool.noConfusion t
refine Nat.le_trans (Found.Pnp99.mul_le_l' (pow_le_exp b hb _ _ hinj) _) ?_
refine Nat.le_trans (Found.Pnp98.mul_le_r ?_ _) fc
refine lsum_le _ _ _ (fun sg hs => bv_le _ _ (fun hc => ?_))
have rg := allSeq_rng b k sg hs
refine allI_of _ k (fun l hl => allI_of _ b (fun w hw => ?_))
show (!(V (l * b + w)) || Nat.beq (sg l) w) = true
cases eV : V (l * b + w) with
| false => rfl
| true =>
cases chosen sg hs hc _ eV with
| intro l' hl' =>
have inj := var_inj b l l' w (sg l') hw (rg l' hl'.1) hl'.2
rw [inj.1, inj.2, beq_self]
rfl
/-- One off-diagonal edge variable: at most b^(k-2) transversal cliques contain it. -/
theorem pos_one (b k : Nat) (hb : 1 <= b) (v : Nat) (hv : offE (k * b) v = true) :
lsum (fun sg => bv (xpos (k * b) b k sg v)) (allSeq b k) * (b * b) <= b ^ k := by
have pc := pos_cover b k hb [v] (fun w hw => by
cases mem_cons_cases hw with
| inl q => rw [q]; exact hv
| inr h2 => exact nomatch h2) (And.intro (fun _ h => nomatch h) True.intro)
have dv := decode (k * b) v hv
let V := inE (edgesOf (k * b) [v])
have two : 2 <= cntI V (k * b) := by
have p := pigeon V (k * b) [srcV (k * b) v, dstV (k * b) v]
(And.intro (fun w hw e => ?_) (And.intro (fun _ h => nomatch h) True.intro)) (fun w hw => ?_)
· exact p
· cases mem_cons_cases hw with
| inl q => exact dv.2.2.2 (e.trans q)
| inr h2 => exact nomatch h2
· cases mem_cons_cases hw with
| inl q =>
rw [q]
refine And.intro dv.1 ?_
show anyL (fun e => Nat.beq (srcV (k * b) v) e.1 || Nat.beq (srcV (k * b) v) e.2) [(srcV (k * b) v, dstV (k * b) v)] = true
refine anyL_true _ _ ?_ _ (List.Mem.head _)
show (Nat.beq (srcV (k * b) v) (srcV (k * b) v) || _) = true
rw [beq_self]; rfl
| inr h2 =>
cases mem_cons_cases h2 with
| inl q =>
rw [q]
refine And.intro dv.2.1 ?_
refine anyL_true _ _ ?_ _ (List.Mem.head _)
show (_ || Nat.beq (dstV (k * b) v) (dstV (k * b) v)) = true
rw [beq_self]; exact or_true_r _
| inr h3 => exact nomatch h3
have e1 : lsum (fun sg => bv (xpos (k * b) b k sg v)) (allSeq b k) =
lsum (fun sg => bv (allL (xpos (k * b) b k sg) [v])) (allSeq b k) := by
refine Nat.le_antisymm (lsum_le _ _ _ (fun sg _ => ?_)) (lsum_le _ _ _ (fun sg _ => ?_))
· show bv (xpos (k * b) b k sg v) <= bv (xpos (k * b) b k sg v && true)
cases xpos (k * b) b k sg v <;> exact Nat.le_refl _
· show bv (xpos (k * b) b k sg v && true) <= bv (xpos (k * b) b k sg v)
cases xpos (k * b) b k sg v <;> exact Nat.le_refl _
rw [e1]
refine Nat.le_trans (Found.Pnp99.mul_le_l' ?_ _) pc.2
refine Nat.le_trans (Nat.le_of_eq ?_) (pow_le_exp b hb 2 _ two)
show b * b = 1 * b * b
rw [Found.Pnp115.one_mul' b]
end Found.Pnp128
#print axioms Found.Pnp128.vtx_lt
#print axioms Found.Pnp128.pos_clique
#print axioms Found.Pnp128.pos_ends
#print axioms Found.Pnp128.pow_le_exp
#print axioms Found.Pnp128.allI_mem
#print axioms Found.Pnp128.pos_cover
#print axioms Found.Pnp128.pos_one
lean_all/found/Pnp129.lean
/-
T330 piece 129. found/Pnp129 -- the clique-colouring count plugged into the criterion
(proof complexity ladder, step 2: monotone real circuits on clique-colouring test inputs).
Let n = k b. A monotone real circuit C whose input gates read only off-diagonal edge
variables (InpOK (offE n) C), which outputs 1 on every transversal clique xpos sigma
(sigma in allSeq b k) and 0 on every colouring graph xneg col (col in allSeq c n), satisfies,
for 2 <= s, r and any f, g with s <= (2F)^2 -> f <= F and r <= V^2 -> g <= V:
c^f <= |C| (2r)^s or b^2 b^g <= s b^g + |C| (2s)^r b^2.
Proved:
* hit_le: a set q is hit at most as often as the sum of its single variables;
* combine: the arithmetic of the positive side, with atoms only;
* neg_side, pos_side: the two branches of Pnp122.criterion_count with Pnp127.neg_bound and
Pnp128.pos_cover / pos_one;
* mrc_bound: the bound above.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp128
namespace Found.Pnp129
open Found.Pnp65 (bv)
open Found.Pnp98 (mul_le_r add_mul')
open Found.Pnp99 (mul_le_l' pow_pos' mul_assoc')
open Found.Pnp101 (cancel_r)
open Found.Pnp115 (anyL lsum lsum_le lsum_const_le)
open Found.Pnp116 (allL)
open Found.Pnp120 (mapL apx nthA allKL allKR)
open Found.Pnp121 (circuit_sizes out_clauses)
open Found.Pnp122 (missB criterion_count lsum_swap)
open Found.Pnp123 (InpOK offE allKL_vars allKR_vars out_vars allKL_distinct allKR_distinct)
open Found.Pnp124 (allSeq allSeq_len lsum_mapL lsum_mul_r len_mapL)
open Found.Pnp127 (xneg neg_bound mem_mapL_inv)
open Found.Pnp128 (xpos pos_cover pos_one pow_le_exp)
open Found.Pnp113 (Gate outV)
open Found.Pnp109 (out)
theorem hit_le (x : Nat -> Bool) : forall q : List Nat, bv (anyL x q) <= lsum (fun v => bv (x v)) q
| [] => Nat.le_refl 0
| v :: q => by
show bv (x v || anyL x q) <= bv (x v) + lsum (fun v => bv (x v)) q
cases x v with
| true => exact Nat.le_add_right 1 _
| false => exact Nat.le_trans (hit_le x q) (Nat.le_of_eq (Nat.zero_add _).symm)
theorem swap23 (a x y : Nat) : (a * x) * y = (a * y) * x := by
rw [mul_assoc' a x y, mul_assoc' a y x, Nat.mul_comm x y]
/-- The arithmetic of the positive side. -/
theorem combine (P H S s M bb G : Nat) (hpos : 1 <= P) (hP : P <= H + S) (hH : H * bb <= s * P)
(hS : S * G <= M * P) : bb * G <= s * G + M * bb := by
have e1 : H * (bb * G) <= (s * G) * P :=
calc H * (bb * G) = (H * bb) * G := (mul_assoc' H bb G).symm
_ <= (s * P) * G := mul_le_r hH G
_ = (s * G) * P := swap23 s P G
have e2 : S * (bb * G) <= (M * bb) * P :=
calc S * (bb * G) = S * (G * bb) := congrArg (S * ·) (Nat.mul_comm bb G)
_ = (S * G) * bb := (mul_assoc' S G bb).symm
_ <= (M * P) * bb := mul_le_r hS bb
_ = (M * bb) * P := swap23 M P bb
refine cancel_r hpos ?_
calc (bb * G) * P = P * (bb * G) := Nat.mul_comm _ _
_ <= (H + S) * (bb * G) := mul_le_r hP _
_ = H * (bb * G) + S * (bb * G) := add_mul' _ _ _
_ <= (s * G) * P + (M * bb) * P := Nat.add_le_add e1 e2
_ = (s * G + M * bb) * P := (add_mul' _ _ _).symm
/-- The negative branch: every colouring misses some correction set. -/
theorem neg_side (n c s r f : Nat) (hc : 1 <= c) (hs : 2 <= s) (hr : 2 <= r) (C : List Gate)
(hC : InpOK (offE n) C) (X : List (Nat -> Bool))
(hf : forall F, s <= (2 * F) * (2 * F) -> f <= F)
(h : (mapL (xneg n) (allSeq c n)).length <=
lsum (fun T => lsum (fun x => bv (missB x T)) (mapL (xneg n) (allSeq c n))) (allKL (apx s r X C))) :
c ^ f <= C.length * (2 * r) ^ s := by
have cs := circuit_sizes s r hs hr X C
rw [len_mapL, allSeq_len] at h
have hT : forall T, T ∈ allKL (apx s r X C) ->
lsum (fun x => bv (missB x T)) (mapL (xneg n) (allSeq c n)) * c ^ f <= c ^ n := by
intro T hT
rw [lsum_mapL]
cases neg_bound n c T (allKL_vars (offE n) s r X C hC T hT) (allKL_distinct s r X C T hT) with
| intro F hF =>
have fF : f <= F := hf F (Nat.le_trans (Nat.le_of_eq (cs.2.2.1 T hT).symm) hF.1)
exact Nat.le_trans (mul_le_l' (pow_le_exp c hc f F fF) _) hF.2
have t1 := lsum_const_le (fun T => lsum (fun x => bv (missB x T)) (mapL (xneg n) (allSeq c n)) * c ^ f)
(c ^ n) (allKL (apx s r X C)) hT
have t2 : c ^ n * c ^ f <= (C.length * (2 * r) ^ s) * c ^ n :=
Nat.le_trans (mul_le_r h (c ^ f))
(Nat.le_trans (Nat.le_of_eq (lsum_mul_r (fun T => lsum (fun x => bv (missB x T)) (mapL (xneg n) (allSeq c n)))
(c ^ f) (allKL (apx s r X C))).symm) (Nat.le_trans t1 (mul_le_r cs.1 _)))
rw [Nat.mul_comm] at t2
exact cancel_r (pow_pos' hc n) t2
/-- The positive branch: every transversal clique hits q or covers some correction set. -/
theorem pos_side (b k s r g : Nat) (hb : 1 <= b) (hs : 2 <= s) (hr : 2 <= r) (C : List Gate)
(hC : InpOK (offE (k * b)) C) (X : List (Nat -> Bool))
(hg : forall V, r <= V * V -> g <= V)
(q : List Nat) (hq : q ∈ (nthA (apx s r X C) 0).L (0, 0))
(h : (mapL (xpos (k * b) b k) (allSeq b k)).length <=
lsum (fun x => bv (anyL x q)) (mapL (xpos (k * b) b k) (allSeq b k)) +
lsum (fun T => lsum (fun x => bv (allL x T)) (mapL (xpos (k * b) b k) (allSeq b k))) (allKR (apx s r X C))) :
(b * b) * b ^ g <= s * b ^ g + (C.length * (2 * s) ^ r) * (b * b) := by
have cs := circuit_sizes s r hs hr X C
rw [len_mapL, allSeq_len] at h
have hH : lsum (fun x => bv (anyL x q)) (mapL (xpos (k * b) b k) (allSeq b k)) * (b * b) <= s * b ^ k := by
rw [lsum_mapL]
have a1 : lsum (fun sg => bv (anyL (xpos (k * b) b k sg) q)) (allSeq b k) <=
lsum (fun v => lsum (fun sg => bv (xpos (k * b) b k sg v)) (allSeq b k)) q :=
Nat.le_trans
(lsum_le (fun sg => bv (anyL (xpos (k * b) b k sg) q))
(fun sg => lsum (fun v => bv (xpos (k * b) b k sg v)) q) (allSeq b k)
(fun sg _ => hit_le (xpos (k * b) b k sg) q))
(Nat.le_of_eq (lsum_swap (fun sg v => bv (xpos (k * b) b k sg v)) q (allSeq b k)))
refine Nat.le_trans (mul_le_r a1 (b * b)) ?_
refine Nat.le_trans (Nat.le_of_eq (lsum_mul_r (fun v => lsum (fun sg => bv (xpos (k * b) b k sg v)) (allSeq b k))
(b * b) q).symm) ?_
refine Nat.le_trans (lsum_const_le (fun v => lsum (fun sg => bv (xpos (k * b) b k sg v)) (allSeq b k) * (b * b))
(b ^ k) q (fun v hv => pos_one b k hb v (out_vars (offE (k * b)) s r X C hC q hq v hv))) ?_
exact mul_le_r (Nat.le_trans (Nat.le_succ _) (out_clauses s r hs hr X C q hq)) _
have hS : lsum (fun T => lsum (fun x => bv (allL x T)) (mapL (xpos (k * b) b k) (allSeq b k))) (allKR (apx s r X C)) * b ^ g
<= (C.length * (2 * s) ^ r) * b ^ k := by
refine Nat.le_trans (Nat.le_of_eq (lsum_mul_r (fun T => lsum (fun x => bv (allL x T)) (mapL (xpos (k * b) b k) (allSeq b k)))
(b ^ g) (allKR (apx s r X C))).symm) ?_
refine Nat.le_trans (lsum_const_le (fun T => lsum (fun x => bv (allL x T)) (mapL (xpos (k * b) b k) (allSeq b k)) * b ^ g)
(b ^ k) (allKR (apx s r X C)) (fun T hT => ?_)) (mul_le_r cs.2.1 _)
show lsum (fun x => bv (allL x T)) (mapL (xpos (k * b) b k) (allSeq b k)) * b ^ g <= b ^ k
rw [lsum_mapL]
have pc := pos_cover b k hb T (allKR_vars (offE (k * b)) s r X C hC T hT) (allKR_distinct s r X C T hT)
have gV := hg _ (Nat.le_trans (Nat.le_of_eq (cs.2.2.2 T hT).symm) pc.1)
exact Nat.le_trans (mul_le_l' (pow_le_exp b hb _ _ gV) _) pc.2
exact combine (b ^ k) _ _ s _ (b * b) (b ^ g) (pow_pos' hb k) h hH hS
/-- Monotone real circuits on clique-colouring test inputs. -/
theorem mrc_bound (k b c s r f g : Nat) (hb : 1 <= b) (hc : 1 <= c) (hs : 2 <= s) (hr : 2 <= r)
(C : List Gate) (hC : InpOK (offE (k * b)) C)
(hP : forall sg, sg ∈ allSeq b k -> out (outV (xpos (k * b) b k sg) C) = true)
(hN : forall col, col ∈ allSeq c (k * b) -> out (outV (xneg (k * b) col) C) = false)
(hf : forall F, s <= (2 * F) * (2 * F) -> f <= F)
(hg : forall V, r <= V * V -> g <= V) :
c ^ f <= C.length * (2 * r) ^ s \/
(b * b) * b ^ g <= s * b ^ g + (C.length * (2 * s) ^ r) * (b * b) := by
have hP' : forall x, x ∈ mapL (xpos (k * b) b k) (allSeq b k) -> out (outV x C) = true := by
intro x hx
cases mem_mapL_inv _ x _ hx with
| intro sg hsg => rw [hsg.2]; exact hP sg hsg.1
have hN' : forall x, x ∈ mapL (xneg (k * b)) (allSeq c (k * b)) -> out (outV x C) = false := by
intro x hx
cases mem_mapL_inv _ x _ hx with
| intro col hcol => rw [hcol.2]; exact hN col hcol.1
cases criterion_count s r C _ _ hP' hN' with
| inl h => exact Or.inl (neg_side (k * b) c s r f hc hs hr C hC _ hf h)
| inr h =>
cases h with
| intro q hq => exact Or.inr (pos_side b k s r g hb hs hr C hC _ hg q hq.1 hq.2)
end Found.Pnp129
#print axioms Found.Pnp129.hit_le
#print axioms Found.Pnp129.swap23
#print axioms Found.Pnp129.combine
#print axioms Found.Pnp129.neg_side
#print axioms Found.Pnp129.pos_side
#print axioms Found.Pnp129.mrc_bound
lean_all/found/Pnp13.lean
/-
T330 piece 13. found/Pnp13 -- a Turing machine run as a local machine run (many steps).
Configurations (tape, pos, q) and the Turing run. Proved: if the start has a false
boundary cell W and an m-bit state, next keeps states m bits long, and the head stays
at some cell p + 1 with p + 2 < W at every time before T, then for every t <= T the
width-W local machine (Pnp10, rule of Pnp12) run from the layout of the start is the
layout of the Turing configuration at time t, at every cell j <= W.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp12
namespace Found.Pnp13
open Found.Pnp9 (lt_succ_cases)
open Found.Pnp10 (Conf nbC stepW runW gate beq_refl nbC_ext)
open Found.Pnp12
structure TC where
tape : Nat -> Bool
pos : Nat
q : List Bool
variable (M : TM)
def tmStep (c : TC) : TC := TC.mk (tapeN M c.tape c.pos c.q) (posN M c.tape c.pos c.q) (qN M c.tape c.pos c.q)
def tmRun : Nat -> TC -> TC
| 0, c => c
| t + 1, c => tmStep M (tmRun t c)
def lay (c : TC) : Conf := encC c.tape c.pos c.q
/-- The head stays inside before time T. -/
def Inside (W T : Nat) (c : TC) : Prop :=
forall t, t < T -> Exists fun p => (tmRun M t c).pos = p + 1 /\ p + 2 < W
theorem preserve (W T : Nat) (c : TC) (hin : Inside M W T c) (htW : c.tape W = false)
(hq : c.q.length = M.m) (hnext : forall a s, (M.next a s).length = M.m) :
forall t, t < T + 1 -> (tmRun M t c).tape W = false /\ (tmRun M t c).q.length = M.m := by
intro t
induction t with
| zero => intro _; exact And.intro htW hq
| succ t ih =>
intro ht
have ht' : t < T := Nat.lt_of_succ_lt_succ ht
have ih' := ih (Nat.lt_succ_of_lt ht')
exact Exists.elim (hin t ht') fun p hp => by
apply And.intro
· show sel (Nat.beq W (tmRun M t c).pos) _ ((tmRun M t c).tape W) = false
rw [hp.1, beqW W p (Nat.lt_of_succ_lt hp.2)]
exact ih'.1
· exact hnext _ _
theorem stepW_ext (W : Nat) (x y : Conf) (h : forall c, c < W + 1 -> forall b, b < M.m + 2 -> x c b = y c b) :
forall j, j < W + 1 -> forall b, stepW (rule M) (M.m + 2) W x j b = stepW (rule M) (M.m + 2) W y j b := by
intro j hj b
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => by
show gate (Nat.beq j W) (rule M (nbC x (M.m + 2) W j) b) = gate (Nat.beq j W) (rule M (nbC y (M.m + 2) W j) b)
rw [nbC_ext x y (M.m + 2) W j hjW h])
(fun e => by
rw [e]
show gate (Nat.beq W W) _ = gate (Nat.beq W W) _
rw [beq_refl W]
rfl)
/-- The local machine follows the Turing machine. -/
theorem simulate (W T : Nat) (c : TC) (hin : Inside M W T c) (htW : c.tape W = false)
(hq : c.q.length = M.m) (hnext : forall a s, (M.next a s).length = M.m) :
forall t, t < T + 1 -> forall j, j < W + 1 -> forall b,
runW (rule M) (M.m + 2) W t (lay c) j b = lay (tmRun M t c) j b := by
intro t
induction t with
| zero => intro _ j _ b; rfl
| succ t ih =>
intro ht j hj b
have ht' : t < T := Nat.lt_of_succ_lt_succ ht
have pr := preserve M W T c hin htW hq hnext t (Nat.lt_succ_of_lt ht')
show stepW (rule M) (M.m + 2) W (runW (rule M) (M.m + 2) W t (lay c)) j b = lay (tmStep M (tmRun M t c)) j b
rw [stepW_ext M W _ (lay (tmRun M t c)) (fun c' hc b' _ => ih (Nat.lt_succ_of_lt ht') c' hc b') j hj b]
exact Exists.elim (hin t ht') fun p hp => by
have e : lay (tmRun M t c) = encC (tmRun M t c).tape (p + 1) (tmRun M t c).q := by
show encC (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q = _
rw [hp.1]
show _ = encC (tapeN M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q)
(posN M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q)
(qN M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q) j b
rw [e, hp.1]
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => step_inside M _ p _ pr.2 W hp.2 j hjW b)
(fun ej => by rw [ej]; exact step_boundary M _ p _ W hp.2 pr.1 b)
end Found.Pnp13
#print axioms Found.Pnp13.preserve
#print axioms Found.Pnp13.stepW_ext
#print axioms Found.Pnp13.simulate
lean_all/found/Pnp130.lean
/-
T330 piece 130. found/Pnp130 -- concrete parameters for the monotone real circuit bound
(proof complexity ladder, step 2).
For t >= 1 put s = (2t)^2, D = 2 s, b = c = D^(2(2t) + t), k = b + 1 and n = k b. Then
s <= (2F)^2 forces t <= F, b^t = D^s D^(t t) and D <= b b, so Pnp129.mrc_bound with
r = s and f = g = t gives, for every monotone real circuit C reading only off-diagonal edge
variables that outputs 1 on every transversal k-clique and 0 on every b-colouring graph,
D^(t t) <= 2 |C|.
Since n <= D^(2 (2(2t) + t) + 1), this is |C| >= 2^(Omega((log n)^2 / (log log n)^2)).
Proved: sq_lt, sq_floor, sq_floor1, le_two_mul, pow_add', pow_pow, key_exp, b_pow, branch2, mrc_lower.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp129
namespace Found.Pnp130
open Found.Pnp98 (mul_le_r add_mul' mul_add')
open Found.Pnp99 (mul_le_l' pow_pos' mul_assoc')
open Found.Pnp101 (cancel_r two_mul' add_cancel_l')
open Found.Pnp114 (mul_one')
open Found.Pnp115 (one_mul')
open Found.Pnp123 (InpOK offE)
open Found.Pnp124 (allSeq)
open Found.Pnp127 (xneg)
open Found.Pnp128 (xpos pow_le_exp)
open Found.Pnp113 (Gate outV)
open Found.Pnp109 (out)
theorem sq_lt (u v : Nat) (h : u + 1 <= v) : u * u < v * v := by
have a : u * u <= (u + 1) * u := mul_le_r (Nat.le_succ u) u
have b : (u + 1) * u + 1 <= (u + 1) * (u + 1) :=
(Nat.add_le_add_left (Nat.succ_le_succ (Nat.zero_le u)) _ : (u + 1) * u + 1 <= (u + 1) * u + (u + 1))
have c : (u + 1) * (u + 1) <= v * v := Nat.le_trans (mul_le_r h (u + 1)) (mul_le_l' h v)
exact Nat.lt_of_lt_of_le (Nat.lt_of_le_of_lt a b) c
theorem sq_floor (t F : Nat) (h : (2 * t) * (2 * t) <= (2 * F) * (2 * F)) : t <= F := by
cases Nat.lt_or_ge F t with
| inr r => exact r
| inl l =>
have e : 2 * F + 1 <= 2 * t := Nat.le_trans (Nat.le_succ _) (mul_le_l' l 2)
exact absurd (Nat.lt_of_lt_of_le (sq_lt _ _ e) h) (Nat.lt_irrefl _)
theorem sq_floor1 (u V : Nat) (h : u * u <= V * V) : u <= V := by
cases Nat.lt_or_ge V u with
| inr r => exact r
| inl l => exact absurd (Nat.lt_of_lt_of_le (sq_lt _ _ l) h) (Nat.lt_irrefl _)
theorem le_two_mul (t : Nat) : t <= 2 * t :=
Nat.le_trans (Nat.le_of_eq (one_mul' t).symm) (mul_le_r (Nat.le_succ 1) t)
theorem pow_add' (D a : Nat) : forall m, D ^ (a + m) = D ^ a * D ^ m
| 0 => (mul_one' _).symm
| m + 1 => by
show D ^ (a + m) * D = D ^ a * (D ^ m * D)
rw [pow_add' D a m, mul_assoc']
theorem pow_pow (D a : Nat) : forall t, (D ^ a) ^ t = D ^ (a * t)
| 0 => rfl
| t + 1 => by
show (D ^ a) ^ t * D ^ a = D ^ (a * t + a)
rw [pow_pow D a t, pow_add']
theorem key_exp (t : Nat) : (2 * (2 * t)) * t = (2 * t) * (2 * t) := by
rw [mul_assoc' 2 (2 * t) t, mul_assoc' 2 t (2 * t), Nat.mul_comm (2 * t) t]
theorem b_pow (D t : Nat) : (D ^ (2 * (2 * t) + t)) ^ t = D ^ ((2 * t) * (2 * t)) * D ^ (t * t) := by
rw [pow_pow, add_mul', pow_add', key_exp]
/-- The arithmetic of the positive branch: if 2 s <= bb then bb B <= s B + M bb gives B <= 2 M. -/
theorem branch2 (bb B s M : Nat) (hbb : 1 <= bb) (hD : 2 * s <= bb) (h : bb * B <= s * B + M * bb) :
B <= 2 * M := by
have h2 : bb * B + bb * B <= bb * B + 2 * (M * bb) := by
rw [<- two_mul']
refine Nat.le_trans (mul_le_l' h 2) ?_
rw [mul_add']
refine Nat.add_le_add_right ?_ _
rw [<- mul_assoc']
exact mul_le_r hD B
have h3 : B * bb <= (2 * M) * bb := by
rw [Nat.mul_comm B bb, mul_assoc']
exact add_cancel_l' h2
exact cancel_r hbb h3
def sP (t : Nat) : Nat := (2 * t) * (2 * t)
def DP (t : Nat) : Nat := 2 * sP t
def bP (t : Nat) : Nat := DP t ^ (2 * (2 * t) + t)
theorem one_le_two_t (t : Nat) (ht : 1 <= t) : 1 <= 2 * t :=
Nat.le_trans ht (Nat.le_trans (Nat.le_of_eq (one_mul' t).symm) (mul_le_r (Nat.le_succ 1) t))
theorem two_le_s (t : Nat) (ht : 1 <= t) : 2 <= sP t := by
have u := one_le_two_t t ht
have a : 2 <= 2 * t := Nat.le_trans (Nat.le_of_eq (mul_one' 2).symm) (mul_le_l' ht 2)
exact Nat.le_trans a (Nat.le_trans (Nat.le_of_eq (mul_one' (2 * t)).symm) (mul_le_l' u (2 * t)))
theorem one_le_D (t : Nat) (ht : 1 <= t) : 1 <= DP t :=
Nat.le_trans (Nat.le_succ 1) (Nat.le_trans (two_le_s t ht) (Nat.le_trans (Nat.le_of_eq (one_mul' _).symm)
(mul_le_r (Nat.le_succ 1) (sP t))))
theorem D_le_bb (t : Nat) (ht : 1 <= t) : DP t <= bP t * bP t := by
have hD := one_le_D t ht
have e1 : 1 <= 2 * (2 * t) + t := Nat.le_trans ht (Nat.le_add_left t _)
have a : DP t <= bP t := by
refine Nat.le_trans (Nat.le_of_eq (one_mul' (DP t)).symm) ?_
exact pow_le_exp (DP t) hD 1 _ e1
have hb : 1 <= bP t := pow_pos' hD _
exact Nat.le_trans a (Nat.le_trans (Nat.le_of_eq (mul_one' (bP t)).symm) (mul_le_l' hb (bP t)))
/-- The size lower bound for monotone real circuits on the clique-colouring test inputs. -/
theorem mrc_lower (t : Nat) (ht : 1 <= t) (C : List Gate)
(hC : InpOK (offE ((bP t + 1) * bP t)) C)
(hP : forall sg, sg ∈ allSeq (bP t) (bP t + 1) ->
out (outV (xpos ((bP t + 1) * bP t) (bP t) (bP t + 1) sg) C) = true)
(hN : forall col, col ∈ allSeq (bP t) ((bP t + 1) * bP t) ->
out (outV (xneg ((bP t + 1) * bP t) col) C) = false) :
DP t ^ (t * t) <= 2 * C.length := by
have hD := one_le_D t ht
have hb : 1 <= bP t := pow_pos' hD _
have hs := two_le_s t ht
have bt : bP t ^ t = DP t ^ sP t * DP t ^ (t * t) := b_pow (DP t) t
have hsP : 1 <= DP t ^ sP t := pow_pos' hD _
cases Found.Pnp129.mrc_bound (bP t + 1) (bP t) (bP t) (sP t) (sP t) t t hb hb hs hs C hC hP hN
(fun F h => sq_floor t F h) (fun V h => Nat.le_trans (le_two_mul t) (sq_floor1 (2 * t) V h)) with
| inl h =>
rw [bt] at h
have h' : DP t ^ (t * t) * DP t ^ sP t <= C.length * DP t ^ sP t := by
rw [Nat.mul_comm (DP t ^ (t * t))]
exact h
exact Nat.le_trans (cancel_r hsP h') (Nat.le_trans (Nat.le_of_eq (one_mul' _).symm) (mul_le_r (Nat.le_succ 1) _))
| inr h =>
have hbb : 1 <= bP t * bP t := Nat.le_trans hb (Nat.le_trans (Nat.le_of_eq (mul_one' (bP t)).symm) (mul_le_l' hb (bP t)))
have b2 := branch2 (bP t * bP t) (bP t ^ t) (sP t) (C.length * (2 * sP t) ^ sP t) hbb (D_le_bb t ht) h
rw [bt] at b2
have h' : DP t ^ (t * t) * DP t ^ sP t <= (2 * C.length) * DP t ^ sP t := by
rw [Nat.mul_comm (DP t ^ (t * t)), mul_assoc']
exact b2
exact cancel_r hsP h'
end Found.Pnp130
#print axioms Found.Pnp130.sq_lt
#print axioms Found.Pnp130.sq_floor
#print axioms Found.Pnp130.sq_floor1
#print axioms Found.Pnp130.le_two_mul
#print axioms Found.Pnp130.pow_add'
#print axioms Found.Pnp130.pow_pow
#print axioms Found.Pnp130.key_exp
#print axioms Found.Pnp130.b_pow
#print axioms Found.Pnp130.branch2
#print axioms Found.Pnp130.one_le_two_t
#print axioms Found.Pnp130.two_le_s
#print axioms Found.Pnp130.one_le_D
#print axioms Found.Pnp130.D_le_bb
#print axioms Found.Pnp130.mrc_lower
lean_all/found/Pnp131.lean
/-
T330 piece 131. found/Pnp131 -- a size lower bound for tree-like cutting planes refutations
of the clique-colouring formulas (proof complexity ladder, step 2).
A cutting planes refutation p of CC n k c compiles to a monotone real circuit (Pnp114) whose
output is the interpolant; on graphs with a k-clique it outputs 1 and on c-colourable graphs
0 (Pnp112). Restricting its input gates to off-diagonal edge variables (Pnp123.restrict)
keeps both: a transversal clique only has off-diagonal edges, so masking does not change it,
and masking only lowers a colouring graph (monotonicity, Pnp113.outV_mono). With the
parameters of Pnp130 (n = (b + 1) b, k = b + 1, c = b, b = D^(2(2t) + t), D = 2 (2t)^2):
D^(t t) <= 2 (2 m + 1) size(p), m = mCC n k c (the number of variables).
Proved: anyI_none, offE_pv, xpos_off, circ_pos, circ_neg, cp_lower.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp130
namespace Found.Pnp131
open Found.Pnp65 (anyI var_inj)
open Found.Pnp96 (anyI_ex)
open Found.Pnp99 (mul_le_l' pow_pos')
open Found.Pnp102 (CPProof falseLine)
open Found.Pnp103 (linesOf)
open Found.Pnp104 (pv mCC CC lin_lt)
open Found.Pnp105 (zle zle_trans)
open Found.Pnp109 (out LeA)
open Found.Pnp110 (isAt)
open Found.Pnp111 (Qc Rc)
open Found.Pnp112 (separate_clique separate_colour)
open Found.Pnp113 (Gate outV outV_mono)
open Found.Pnp114 (compile compile_val compile_len)
open Found.Pnp115 (beq_eq and_true_l and_true_r)
open Found.Pnp120 (zle_out out_zle)
open Found.Pnp123 (offE restrict restrict_eval restrict_inp restrict_len maskX)
open Found.Pnp124 (allSeq allSeq_rng)
open Found.Pnp125 (blt_of_lt)
open Found.Pnp127 (xneg neg_colouring)
open Found.Pnp128 (xpos pos_clique vtx_lt)
open Found.Pnp130 (DP bP mrc_lower)
theorem anyI_none (g : Nat -> Bool) : forall k, (forall j, j < k -> g j = false) -> anyI g k = false
| 0, _ => rfl
| k + 1, h => by
have e1 := anyI_none g k (fun j hj => h j (Nat.lt_trans hj (Nat.lt_succ_self k)))
have e2 := h k (Nat.lt_succ_self k)
show (anyI g k || g k) = false
calc (anyI g k || g k) = (false || false) := by rw [e1, e2]
_ = false := rfl
theorem offE_pv (n i j : Nat) (hi : i < n) (hj : j < n) (hij : Not (i = j)) : offE n (pv n i j) = true := by
have a : Nat.blt (pv n i j) (n * n) = true := blt_of_lt _ _ (lin_lt i j n n hi hj)
have b : anyI (fun i' => Nat.beq (pv n i j) (pv n i' i')) n = false := anyI_none _ n (fun i' hi' => by
cases e : Nat.beq (pv n i j) (pv n i' i') with
| false => rfl
| true =>
have w := var_inj n i i' j i' hj hi' (beq_eq _ _ e)
exact absurd (w.1.trans w.2.symm) hij)
show (Nat.blt (pv n i j) (n * n) && !(anyI (fun i' => Nat.beq (pv n i j) (pv n i' i')) n)) = true
calc (Nat.blt (pv n i j) (n * n) && !(anyI (fun i' => Nat.beq (pv n i j) (pv n i' i')) n)) = (true && !false) := by rw [a, b]
_ = true := rfl
/-- Every edge of a transversal clique is off-diagonal, so masking keeps the clique. -/
theorem xpos_off (b k : Nat) (sg : Nat -> Nat) (hs : sg ∈ allSeq b k) :
LeA (xpos (k * b) b k sg) (maskX (k * b) (xpos (k * b) b k sg)) := by
intro v hv
have rg := allSeq_rng b k sg hs
cases anyI_ex _ k hv with
| intro l hl =>
cases anyI_ex _ k hl.2 with
| intro l' hl' =>
have ev : v = pv (k * b) (l * b + sg l) (l' * b + sg l') := beq_eq _ _ (and_true_l hl'.2)
have nl : Not (l = l') := fun e => by
have t := and_true_r hl'.2
rw [e, Found.Pnp115.beq_self] at t
exact Bool.noConfusion t
have off : offE (k * b) v = true := by
rw [ev]
refine offE_pv _ _ _ (vtx_lt b k l _ hl.1 (rg l hl.1)) (vtx_lt b k l' _ hl'.1 (rg l' hl'.1)) (fun e => ?_)
exact nl (var_inj b l l' _ _ (rg l hl.1) (rg l' hl'.1) e).1
show (offE (k * b) v && xpos (k * b) b k sg v) = true
calc (offE (k * b) v && xpos (k * b) b k sg v) = (true && true) := by rw [off, hv]
_ = true := rfl
/-- The restricted interpolant circuit of a refutation. -/
def circ (n k c : Nat) (p : CPProof (mCC n k c) (linesOf (CC n k c)) falseLine) : List Gate :=
restrict n (compile (mCC n k c) (linesOf (CC n k c)) (Qc n k) (isAt (mCC n k c) (Qc n k) (Rc n k)) p)
theorem circ_pos (b k c : Nat) (hc : 1 <= c) (p : CPProof (mCC (k * b) k c) (linesOf (CC (k * b) k c)) falseLine)
(sg : Nat -> Nat) (hs : sg ∈ allSeq b k) : out (outV (xpos (k * b) b k sg) (circ (k * b) k c p)) = true := by
let x := xpos (k * b) b k sg
let C0 := compile (mCC (k * b) k c) (linesOf (CC (k * b) k c)) (Qc (k * b) k)
(isAt (mCC (k * b) k c) (Qc (k * b) k) (Rc (k * b) k)) p
have h1 : out (outV x C0) = true := by
rw [compile_val]
exact separate_clique (k * b) k c hc p x (fun l => l * b + sg l) (pos_clique b k sg hs)
have mono := outV_mono x (maskX (k * b) x) (xpos_off b k sg hs) C0
show out (Found.Pnp113.nthV (Found.Pnp113.evalR x (restrict (k * b) C0)) 0) = true
rw [restrict_eval]
exact zle_out _ (zle_trans _ _ _ (out_zle _ h1) mono)
theorem circ_neg (n k c : Nat) (hc : 1 <= c) (p : CPProof (mCC n k c) (linesOf (CC n k c)) falseLine)
(col : Nat -> Nat) (hcol : col ∈ allSeq c n) : out (outV (xneg n col) (circ n k c p)) = false := by
let x := xneg n col
let C0 := compile (mCC n k c) (linesOf (CC n k c)) (Qc n k) (isAt (mCC n k c) (Qc n k) (Rc n k)) p
have h1 : out (outV x C0) = false := by
rw [compile_val]
exact separate_colour n k c hc p x col (neg_colouring n c col hcol)
have mono := outV_mono (maskX n x) x (fun v hv => and_true_r hv) C0
show out (Found.Pnp113.nthV (Found.Pnp113.evalR x (restrict n C0)) 0) = false
rw [restrict_eval]
cases e : out (Found.Pnp113.nthV (Found.Pnp113.evalR (maskX n x) C0) 0) with
| false => rfl
| true =>
have t := zle_out _ (zle_trans _ _ _ (out_zle _ e) mono)
rw [h1] at t
exact Bool.noConfusion t
/-- Tree-like cutting planes refutations of clique-colouring formulas are large. -/
theorem cp_lower (t : Nat) (ht : 1 <= t)
(p : CPProof (mCC ((bP t + 1) * bP t) (bP t + 1) (bP t)) (linesOf (CC ((bP t + 1) * bP t) (bP t + 1) (bP t))) falseLine) :
DP t ^ (t * t) <= 2 * ((2 * mCC ((bP t + 1) * bP t) (bP t + 1) (bP t) + 1) * p.size) := by
have hc : 1 <= bP t := pow_pos' (Found.Pnp130.one_le_D t ht) _
have lo := mrc_lower t ht (circ ((bP t + 1) * bP t) (bP t + 1) (bP t) p)
(restrict_inp _ _)
(fun sg hs => circ_pos (bP t) (bP t + 1) (bP t) hc p sg hs)
(fun col hcol => circ_neg _ _ (bP t) hc p col hcol)
refine Nat.le_trans lo (mul_le_l' ?_ 2)
show (restrict _ _).length <= _
rw [restrict_len]
exact compile_len _ _ _ _ _ p
end Found.Pnp131
#print axioms Found.Pnp131.anyI_none
#print axioms Found.Pnp131.offE_pv
#print axioms Found.Pnp131.xpos_off
#print axioms Found.Pnp131.circ_pos
#print axioms Found.Pnp131.circ_neg
#print axioms Found.Pnp131.cp_lower
lean_all/found/Pnp132.lean
/-
T330 piece 132. found/Pnp132 -- bounded-depth Frege as a Tait sequent calculus, and its
soundness (proof complexity ladder, step 3: bounded-depth Frege).
Formulas are literals and unbounded fan-in disjunctions and conjunctions of lists; negation
is the dual (de Morgan). A sequent is a list of formulas read as their disjunction. The rules:
initial sequents from a hypothesis list H, excluded middle on a variable, or-introduction,
and-introduction along the list, cut, and weakening. The depth of a proof is the largest
depth of a cut formula or introduced formula (kept as a bound in later pieces). Proved:
* ev_dual: the dual evaluates to the negation;
* sound: every derived sequent has a true formula under any assignment satisfying H;
* refute_unsat: a derivation of the empty sequent shows that H has no satisfying assignment.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp131
namespace Found.Pnp132
open Found.Pnp115 (mem_cons_cases)
inductive Fm : Type where
| lit : Nat -> Bool -> Fm
| orL : List Fm -> Fm
| andL : List Fm -> Fm
mutual
def dual : Fm -> Fm
| .lit v b => .lit v (!b)
| .orL l => .andL (dualL l)
| .andL l => .orL (dualL l)
def dualL : List Fm -> List Fm
| [] => []
| f :: l => dual f :: dualL l
end
def litv (a : Nat -> Bool) (v : Nat) : Bool -> Bool
| true => a v
| false => !(a v)
mutual
def ev (a : Nat -> Bool) : Fm -> Bool
| .lit v b => litv a v b
| .orL l => evOr a l
| .andL l => evAnd a l
def evOr (a : Nat -> Bool) : List Fm -> Bool
| [] => false
| f :: l => ev a f || evOr a l
def evAnd (a : Nat -> Bool) : List Fm -> Bool
| [] => true
| f :: l => ev a f && evAnd a l
end
mutual
def depth : Fm -> Nat
| .lit _ _ => 0
| .orL l => depthL l + 1
| .andL l => depthL l + 1
def depthL : List Fm -> Nat
| [] => 0
| f :: l => Nat.max (depth f) (depthL l)
end
theorem not_not (x : Bool) : (!(!x)) = x := by cases x <;> rfl
theorem and_not (x y : Bool) : ((!x) && (!y)) = !(x || y) := by cases x <;> cases y <;> rfl
theorem or_not (x y : Bool) : ((!x) || (!y)) = !(x && y) := by cases x <;> cases y <;> rfl
mutual
theorem ev_dual (a : Nat -> Bool) : forall f : Fm, ev a (dual f) = !(ev a f)
| .lit _ true => rfl
| .lit v false => (not_not (a v)).symm
| .orL l => evOr_dual a l
| .andL l => evAnd_dual a l
theorem evOr_dual (a : Nat -> Bool) : forall l : List Fm, evAnd a (dualL l) = !(evOr a l)
| [] => rfl
| f :: l => by
show (ev a (dual f) && evAnd a (dualL l)) = !(ev a f || evOr a l)
rw [ev_dual a f, evOr_dual a l]
exact and_not _ _
theorem evAnd_dual (a : Nat -> Bool) : forall l : List Fm, evOr a (dualL l) = !(evAnd a l)
| [] => rfl
| f :: l => by
show (ev a (dual f) || evOr a (dualL l)) = !(ev a f && evAnd a l)
rw [ev_dual a f, evAnd_dual a l]
exact or_not _ _
end
/-- Tait derivations from the hypothesis sequents H. -/
inductive TD (H : List (List Fm)) : List Fm -> Type where
| hyp (G : List Fm) : G ∈ H -> TD H G
| em (G : List Fm) (v : Nat) : Fm.lit v true ∈ G -> Fm.lit v false ∈ G -> TD H G
| orI (G : List Fm) (l : List Fm) (f : Fm) : f ∈ l -> TD H (f :: G) -> TD H (Fm.orL l :: G)
| andNil (G : List Fm) : TD H (Fm.andL [] :: G)
| andCons (G : List Fm) (f : Fm) (l : List Fm) : TD H (f :: G) -> TD H (Fm.andL l :: G) ->
TD H (Fm.andL (f :: l) :: G)
| cut (G : List Fm) (f : Fm) : TD H (f :: G) -> TD H (dual f :: G) -> TD H G
| weak (G G' : List Fm) : (forall x, x ∈ G -> x ∈ G') -> TD H G -> TD H G'
/-- The number of rule applications. -/
def TD.size {H : List (List Fm)} : {G : List Fm} -> TD H G -> Nat
| _, .hyp _ _ => 1
| _, .em _ _ _ _ => 1
| _, .orI _ _ _ _ p => p.size + 1
| _, .andNil _ => 1
| _, .andCons _ _ _ p q => p.size + q.size + 1
| _, .cut _ _ p q => p.size + q.size + 1
| _, .weak _ _ _ p => p.size + 1
def Sat (a : Nat -> Bool) (G : List Fm) : Prop := Exists fun f => f ∈ G /\ ev a f = true
theorem evOr_mem (a : Nat -> Bool) (f : Fm) (hf : ev a f = true) : forall l : List Fm, f ∈ l -> evOr a l = true
| [], h => nomatch h
| g :: l, h => by
show (ev a g || evOr a l) = true
cases mem_cons_cases h with
| inl e => rw [<- e, hf]; try rfl
| inr h2 => rw [evOr_mem a f hf l h2]; cases ev a g <;> rfl
theorem sat_tail (a : Nat -> Bool) (f : Fm) (G : List Fm) (h : Sat a G) : Sat a (f :: G) := by
cases h with
| intro x hx => exact Exists.intro x (And.intro (List.Mem.tail f hx.1) hx.2)
theorem sat_head (a : Nat -> Bool) (f : Fm) (G : List Fm) (h : ev a f = true) : Sat a (f :: G) :=
Exists.intro f (And.intro (List.Mem.head G) h)
/-- Split a satisfied sequent f :: G into "f true" or "G satisfied". -/
theorem sat_cons (a : Nat -> Bool) (f : Fm) (G : List Fm) (h : Sat a (f :: G)) : ev a f = true \/ Sat a G := by
cases h with
| intro x hx =>
cases mem_cons_cases hx.1 with
| inl e => rw [<- e]; exact Or.inl hx.2
| inr h2 => exact Or.inr (Exists.intro x (And.intro h2 hx.2))
/-- Soundness. -/
theorem sound (H : List (List Fm)) (a : Nat -> Bool) (hH : forall G, G ∈ H -> Sat a G) :
forall (G : List Fm), TD H G -> Sat a G := by
intro G d
induction d with
| hyp G h => exact hH G h
| em G v h1 h2 =>
cases e : a v with
| true => exact Exists.intro _ (And.intro h1 (e : litv a v true = true))
| false =>
have t : litv a v false = true := by
show (!(a v)) = true
rw [e]; try rfl
exact Exists.intro _ (And.intro h2 t)
| orI G l f hf _ ih =>
cases sat_cons a f G ih with
| inl t => exact sat_head a _ G (evOr_mem a f t l hf)
| inr t => exact sat_tail a _ G t
| andNil G => exact sat_head a _ G rfl
| andCons G f l _ _ ih1 ih2 =>
cases sat_cons a f G ih1 with
| inr t => exact sat_tail a _ G t
| inl t1 =>
cases sat_cons a (Fm.andL l) G ih2 with
| inr t => exact sat_tail a _ G t
| inl t2 =>
refine sat_head a _ G ?_
show (ev a f && evAnd a l) = true
rw [t1]
exact t2
| cut G f _ _ ih1 ih2 =>
cases sat_cons a f G ih1 with
| inr t => exact t
| inl t1 =>
cases sat_cons a (dual f) G ih2 with
| inr t => exact t
| inl t2 =>
rw [ev_dual, t1] at t2
exact Bool.noConfusion t2
| weak G G' hs _ ih =>
cases ih with
| intro x hx => exact Exists.intro x (And.intro (hs x hx.1) hx.2)
/-- A refutation (derivation of the empty sequent) shows that H is unsatisfiable. -/
theorem refute_unsat (H : List (List Fm)) (p : TD H []) (a : Nat -> Bool) :
Not (forall G, G ∈ H -> Sat a G) := fun hH => by
cases sound H a hH [] p with
| intro x hx => exact nomatch hx.1
end Found.Pnp132
#print axioms Found.Pnp132.not_not
#print axioms Found.Pnp132.and_not
#print axioms Found.Pnp132.or_not
#print axioms Found.Pnp132.ev_dual
#print axioms Found.Pnp132.evOr_mem
#print axioms Found.Pnp132.sat_tail
#print axioms Found.Pnp132.sat_head
#print axioms Found.Pnp132.sat_cons
#print axioms Found.Pnp132.sound
#print axioms Found.Pnp132.refute_unsat
lean_all/found/Pnp133.lean
/-
T330 piece 133. found/Pnp133 -- partial matchings between pigeons and holes (proof complexity
ladder, step 3: bounded-depth Frege and the pigeonhole principle).
A pair (i, j) matches pigeon i with hole j. Two pairs are consistent when they share the
pigeon exactly when they share the hole. A partial matching over pigeon list Pg and hole
list Hl is a list of pairwise consistent pairs in Pg x Hl (repetitions allowed: it is read as
a set); two matchings are compatible when all their pairs are consistent. Proved:
* cons_symm, compat_symm, compat_mono, compat_app, mt_app: compatibility and unions;
* rmv, len_rmv_le, len_rmv_lt, mem_rmv: removing a number from a list;
* free_hole: a list of fewer than |Hl| numbers misses a hole of a duplicate-free Hl;
* free_pair: a matching smaller than |Hl| that does not use pigeon i is compatible with
(i, j) for some hole j in Hl.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp132
namespace Found.Pnp133
open Found.Pnp115 (Pw anyL mem_cons_cases beq_eq beq_self)
open Found.Pnp116 (mem_app mem_app_l mem_app_r len_app)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp123 (Dist)
open Found.Pnp124 (len_mapL)
open Found.Pnp127 (mem_mapL_inv)
def Cons (p q : Nat × Nat) : Prop := (p.1 = q.1 -> p.2 = q.2) /\ (p.2 = q.2 -> p.1 = q.1)
def Compat (s t : List (Nat × Nat)) : Prop := forall p, p ∈ s -> forall q, q ∈ t -> Cons p q
structure Mt (Pg Hl : List Nat) (r : List (Nat × Nat)) : Prop where
rng : forall p, p ∈ r -> p.1 ∈ Pg /\ p.2 ∈ Hl
cons : Compat r r
theorem cons_symm (p q : Nat × Nat) (h : Cons p q) : Cons q p :=
And.intro (fun e => (h.1 e.symm).symm) (fun e => (h.2 e.symm).symm)
theorem compat_symm (s t : List (Nat × Nat)) (h : Compat s t) : Compat t s :=
fun p hp q hq => cons_symm q p (h q hq p hp)
theorem compat_mono (s t s' t' : List (Nat × Nat)) (h : Compat s t)
(hs : forall p, p ∈ s' -> p ∈ s) (ht : forall q, q ∈ t' -> q ∈ t) : Compat s' t' :=
fun p hp q hq => h p (hs p hp) q (ht q hq)
theorem compat_app (s t u : List (Nat × Nat)) (h1 : Compat s u) (h2 : Compat t u) : Compat (s ++ t) u :=
fun p hp q hq => by
cases mem_app p s t hp with
| inl a => exact h1 p a q hq
| inr b => exact h2 p b q hq
theorem compat_app_r (s t u : List (Nat × Nat)) (h1 : Compat s t) (h2 : Compat s u) : Compat s (t ++ u) :=
compat_symm _ _ (compat_app t u s (compat_symm _ _ h1) (compat_symm _ _ h2))
theorem mt_app (Pg Hl : List Nat) (s t : List (Nat × Nat)) (hs : Mt Pg Hl s) (ht : Mt Pg Hl t)
(h : Compat s t) : Mt Pg Hl (s ++ t) := by
refine Mt.mk (fun p hp => ?_) ?_
· cases mem_app p s t hp with
| inl a => exact hs.rng p a
| inr b => exact ht.rng p b
· exact compat_app s t (s ++ t) (compat_app_r s s t hs.cons h)
(compat_app_r t s t (compat_symm _ _ h) ht.cons)
/-! Removing a number from a list. -/
def rmv (h : Nat) : List Nat -> List Nat
| [] => []
| x :: L => match Nat.beq h x with
| true => rmv h L
| false => x :: rmv h L
theorem len_rmv_le (h : Nat) : forall L : List Nat, (rmv h L).length <= L.length
| [] => Nat.le_refl 0
| x :: L => by
cases e : Nat.beq h x with
| true =>
show (match Nat.beq h x with | true => rmv h L | false => x :: rmv h L).length <= L.length + 1
rw [e]
exact Nat.le_trans (len_rmv_le h L) (Nat.le_succ _)
| false =>
show (match Nat.beq h x with | true => rmv h L | false => x :: rmv h L).length <= L.length + 1
rw [e]
exact Nat.succ_le_succ (len_rmv_le h L)
theorem len_rmv_lt (h : Nat) : forall L : List Nat, h ∈ L -> (rmv h L).length + 1 <= L.length
| [], m => nomatch m
| x :: L, m => by
cases e : Nat.beq h x with
| true =>
show (match Nat.beq h x with | true => rmv h L | false => x :: rmv h L).length + 1 <= L.length + 1
rw [e]
exact Nat.succ_le_succ (len_rmv_le h L)
| false =>
show (match Nat.beq h x with | true => rmv h L | false => x :: rmv h L).length + 1 <= L.length + 1
rw [e]
cases mem_cons_cases m with
| inl q =>
rw [q, beq_self] at e
exact Bool.noConfusion e
| inr m2 => exact Nat.succ_le_succ (len_rmv_lt h L m2)
theorem mem_rmv (h y : Nat) (hy : Not (y = h)) : forall L : List Nat, y ∈ L -> y ∈ rmv h L
| [], m => nomatch m
| x :: L, m => by
cases e : Nat.beq h x with
| true =>
show y ∈ (match Nat.beq h x with | true => rmv h L | false => x :: rmv h L)
rw [e]
cases mem_cons_cases m with
| inl q => exact absurd (q.trans (beq_eq h x e).symm) hy
| inr m2 => exact mem_rmv h y hy L m2
| false =>
show y ∈ (match Nat.beq h x with | true => rmv h L | false => x :: rmv h L)
rw [e]
cases mem_cons_cases m with
| inl q => rw [q]; exact List.Mem.head _
| inr m2 => exact List.Mem.tail x (mem_rmv h y hy L m2)
theorem ne_of_beq_false (a b : Nat) (h : Nat.beq a b = false) : Not (a = b) := fun e => by
rw [e, beq_self] at h
exact Bool.noConfusion h
theorem not_mem_of_anyL (h : Nat) : forall L : List Nat, anyL (Nat.beq h) L = false -> h ∈ L -> False
| [], _, m => nomatch m
| x :: L, e, m => by
have e' : (Nat.beq h x || anyL (Nat.beq h) L) = false := e
cases ex : Nat.beq h x with
| true => rw [ex] at e'; exact Bool.noConfusion e'
| false =>
rw [ex] at e'
cases mem_cons_cases m with
| inl q => exact ne_of_beq_false h x ex q
| inr m2 => exact not_mem_of_anyL h L e' m2
theorem mem_of_anyL (h : Nat) : forall L : List Nat, anyL (Nat.beq h) L = true -> h ∈ L
| [], e => Bool.noConfusion e
| x :: L, e => by
have e' : (Nat.beq h x || anyL (Nat.beq h) L) = true := e
cases ex : Nat.beq h x with
| true => rw [beq_eq h x ex]; exact List.Mem.head _
| false =>
rw [ex] at e'
exact List.Mem.tail x (mem_of_anyL h L e')
/-- A list of fewer than |Hl| numbers misses some element of a duplicate-free Hl. -/
theorem free_hole : forall (Hl L : List Nat), Dist Hl -> L.length < Hl.length -> Exists fun j => j ∈ Hl /\ Not (j ∈ L)
| [], L, _, hl => absurd hl (Nat.not_lt_zero _)
| h :: Hl, L, hd, hl => by
cases e : anyL (Nat.beq h) L with
| false => exact Exists.intro h (And.intro (List.Mem.head Hl) (not_mem_of_anyL h L e))
| true =>
have hm := mem_of_anyL h L e
have lt : (rmv h L).length < Hl.length := by
have a := len_rmv_lt h L hm
exact Nat.lt_of_succ_le (Nat.le_of_succ_le_succ (Nat.le_trans (Nat.succ_le_succ a) hl))
cases free_hole Hl (rmv h L) hd.2 lt with
| intro j hj =>
have jh : Not (j = h) := fun q => hd.1 j hj.1 q.symm
exact Exists.intro j (And.intro (List.Mem.tail h hj.1) (fun m => hj.2 (mem_rmv h j jh L m)))
/-- A small matching avoiding pigeon i is compatible with (i, j) for some hole j of Hl. -/
theorem free_pair (Hl : List Nat) (hd : Dist Hl) (r : List (Nat × Nat)) (hr : r.length < Hl.length)
(i : Nat) (hi : forall p, p ∈ r -> Not (p.1 = i)) :
Exists fun j => j ∈ Hl /\ Compat r [(i, j)] := by
have hl : (mapL Prod.snd r).length < Hl.length := by rw [len_mapL]; exact hr
cases free_hole Hl (mapL Prod.snd r) hd hl with
| intro j hj =>
refine Exists.intro j (And.intro hj.1 (fun p hp q hq => ?_))
cases mem_cons_cases hq with
| inr h2 => exact nomatch h2
| inl e =>
rw [e]
refine And.intro (fun a => absurd a (hi p hp)) (fun b => ?_)
have t := mem_mapL Prod.snd p r hp
rw [b] at t
exact absurd t hj.2
end Found.Pnp133
#print axioms Found.Pnp133.cons_symm
#print axioms Found.Pnp133.compat_symm
#print axioms Found.Pnp133.compat_mono
#print axioms Found.Pnp133.compat_app
#print axioms Found.Pnp133.compat_app_r
#print axioms Found.Pnp133.mt_app
#print axioms Found.Pnp133.len_rmv_le
#print axioms Found.Pnp133.len_rmv_lt
#print axioms Found.Pnp133.mem_rmv
#print axioms Found.Pnp133.ne_of_beq_false
#print axioms Found.Pnp133.not_mem_of_anyL
#print axioms Found.Pnp133.mem_of_anyL
#print axioms Found.Pnp133.free_hole
#print axioms Found.Pnp133.free_pair
lean_all/found/Pnp134.lean
/-
T330 piece 134. found/Pnp134 -- k-evaluations and the rules of the Tait calculus (proof
complexity ladder, step 3: bounded-depth Frege; Urquhart--Fu form for sequents).
T assigns to each formula a set of partial matchings (its true branches). For a formula A:
E1: every element of T A is a matching of size <= k;
KC: every element of T (dual A) is a matching of size <= k incompatible with all of T A;
KComp: every matching pi with |pi| + k <= |Hl| is compatible with an element of T A or
of T (dual A);
and for a disjunction orL l:
E3: every element of T (orL l) contains an element of T B for some B in l;
E4: every element of T (dual (orL l)) is incompatible with all of T B for B in l.
A sequent G is true (Tr) when T (dual (orL G)) is empty. With 4k <= |Hl| every rule keeps
truth (Ok collects the conditions used at each node; andL [] needs the empty branch), and the
empty sequent is not true when T (andL []) contains the empty matching, so
a derivation all of whose initial sequents are true and whose nodes are Ok is not a
refutation. Proved: dual_dual, wit, tr_of_ok, false_not_tr, no_refutation.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp133
namespace Found.Pnp134
open Found.Pnp115 (mem_cons_cases)
open Found.Pnp116 (mem_app mem_app_l mem_app_r len_app)
open Found.Pnp132 (Fm dual dualL not_not TD)
open Found.Pnp133 (Compat Mt compat_symm compat_mono compat_app compat_app_r mt_app)
mutual
theorem dual_dual : forall f : Fm, dual (dual f) = f
| .lit v b => by
show Fm.lit v (!(!b)) = Fm.lit v b
rw [not_not]
| .orL l => by
show Fm.orL (dualL (dualL l)) = Fm.orL l
rw [dualL_dual l]
| .andL l => by
show Fm.andL (dualL (dualL l)) = Fm.andL l
rw [dualL_dual l]
theorem dualL_dual : forall l : List Fm, dualL (dualL l) = l
| [] => rfl
| f :: l => by
show dual (dual f) :: dualL (dualL l) = f :: l
rw [dual_dual f, dualL_dual l]
end
def Sub (s t : List (Nat × Nat)) : Prop := forall p, p ∈ s -> p ∈ t
section
variable (Pg Hl : List Nat) (k : Nat) (T : Fm -> List (Nat × Nat) -> Prop)
def E1 (A : Fm) : Prop := forall s, T A s -> Mt Pg Hl s /\ s.length <= k
def KC (A : Fm) : Prop := forall s, T (dual A) s -> Mt Pg Hl s /\ s.length <= k /\ forall t, T A t -> Not (Compat s t)
def KComp (A : Fm) : Prop := forall p, Mt Pg Hl p -> p.length + k <= Hl.length ->
Exists fun s => (T A s \/ T (dual A) s) /\ Compat s p
def E3 (l : List Fm) : Prop := forall s, T (Fm.orL l) s -> Exists fun B => B ∈ l /\ Exists fun t => T B t /\ Sub t s
def E4 (l : List Fm) : Prop := forall r, T (dual (Fm.orL l)) r -> forall B, B ∈ l -> forall t, T B t -> Not (Compat r t)
def Tr (G : List Fm) : Prop := forall r, T (dual (Fm.orL G)) r -> False
def LineOk (G : List Fm) : Prop := KC Pg Hl k T (Fm.orL G) /\ KComp Pg Hl k T (Fm.orL G) /\ E3 T G /\ E4 T G
/-- A true line has, for every small matching, a formula with a compatible true branch. -/
theorem wit (G : List Fm) (hL : LineOk Pg Hl k T G) (ht : Tr T G) (p : List (Nat × Nat)) (hp : Mt Pg Hl p)
(hl : p.length + k <= Hl.length) : Exists fun B => B ∈ G /\ Exists fun t => T B t /\ Compat t p := by
cases hL.2.1 p hp hl with
| intro s hs =>
cases hs.1 with
| inr d => exact absurd d (ht s)
| inl a =>
cases hL.2.2.1 s a with
| intro B hB =>
cases hB.2 with
| intro t ht' => exact Exists.intro B (And.intro hB.1 (Exists.intro t (And.intro ht'.1
(compat_mono s p t p hs.2 ht'.2 (fun q hq => hq)))))
end
theorem sub_l (s t : List (Nat × Nat)) : Sub s (s ++ t) := fun p hp => mem_app_l p t s hp
theorem sub_r (s t : List (Nat × Nat)) : Sub t (s ++ t) := fun p hp => mem_app_r p t s hp
theorem sub_refl (s : List (Nat × Nat)) : Sub s s := fun _ hp => hp
theorem sub_trans (s t u : List (Nat × Nat)) (h1 : Sub s t) (h2 : Sub t u) : Sub s u := fun p hp => h2 p (h1 p hp)
/-- Compatibility with a larger matching gives compatibility with a part. -/
theorem cpart (u p q : List (Nat × Nat)) (h : Compat u p) (hs : Sub q p) : Compat u q :=
compat_mono u p u q h (fun _ hx => hx) hs
theorem len1 (k n a : Nat) (hk : k + k + k + k <= n) (ha : a <= k) : a + k <= n :=
Nat.le_trans (Nat.add_le_add_right ha k)
(Nat.le_trans (Nat.le_add_right (k + k) k) (Nat.le_trans (Nat.le_add_right (k + k + k) k) hk))
theorem len2 (k n a b : Nat) (hk : k + k + k + k <= n) (ha : a <= k) (hb : b <= k) : a + b + k <= n :=
Nat.le_trans (Nat.add_le_add_right (Nat.add_le_add ha hb) k) (Nat.le_trans (Nat.le_add_right (k + k + k) k) hk)
theorem len3 (k n a b c : Nat) (hk : k + k + k + k <= n) (ha : a <= k) (hb : b <= k) (hc : c <= k) :
a + b + c + k <= n :=
Nat.le_trans (Nat.add_le_add_right (Nat.add_le_add (Nat.add_le_add ha hb) hc) k) hk
section
variable {Pg Hl : List Nat} {k : Nat} {T : Fm -> List (Nat × Nat) -> Prop} {H : List (List Fm)}
/-- The conditions used at each node of a derivation. -/
def Ok (Pg Hl : List Nat) (k : Nat) (T : Fm -> List (Nat × Nat) -> Prop) : {G : List Fm} -> TD H G -> Prop
| _, .hyp G _ => Tr T G
| _, .em G v _ _ => LineOk Pg Hl k T G /\ KComp Pg Hl k T (Fm.lit v true)
| _, .orI G l f _ p => Ok Pg Hl k T p /\ LineOk Pg Hl k T (Fm.orL l :: G) /\ LineOk Pg Hl k T (f :: G) /\
KComp Pg Hl k T (Fm.orL l) /\ E4 T l /\ E1 Pg Hl k T f
| _, .andNil G => LineOk Pg Hl k T (Fm.andL [] :: G) /\ T (Fm.andL []) []
| _, .andCons G f l p q => Ok Pg Hl k T p /\ Ok Pg Hl k T q /\ LineOk Pg Hl k T (Fm.andL (f :: l) :: G) /\
LineOk Pg Hl k T (f :: G) /\ LineOk Pg Hl k T (Fm.andL l :: G) /\ E4 T (dualL l) /\
E3 T (dual f :: dualL l) /\ KC Pg Hl k T f /\ KComp Pg Hl k T (Fm.andL (f :: l)) /\
E1 Pg Hl k T f /\ E1 Pg Hl k T (Fm.andL l)
| _, .cut G f p q => Ok Pg Hl k T p /\ Ok Pg Hl k T q /\ LineOk Pg Hl k T G /\ LineOk Pg Hl k T (f :: G) /\
LineOk Pg Hl k T (dual f :: G) /\ KC Pg Hl k T f /\ E1 Pg Hl k T f
| _, .weak G G' _ p => Ok Pg Hl k T p /\ LineOk Pg Hl k T G' /\ LineOk Pg Hl k T G
/-- Every rule keeps truth. -/
theorem tr_of_ok (hk : k + k + k + k <= Hl.length) : forall (G : List Fm) (d : TD H G), Ok Pg Hl k T d -> Tr T G := by
intro G d
induction d with
| hyp G _ => exact fun h => h
| em G v h1 h2 =>
intro h r hr
have rr := h.1.1 r hr
cases h.2 r rr.1 (len1 k _ _ hk rr.2.1) with
| intro u hu =>
cases hu.1 with
| inl a => exact h.1.2.2.2 r hr _ h1 u a (compat_symm _ _ hu.2)
| inr b => exact h.1.2.2.2 r hr _ h2 u b (compat_symm _ _ hu.2)
| orI G l f hf p ih =>
intro h r hr
have hc := h.2.1
have rr := hc.1 r hr
have e4 := hc.2.2.2 r hr
cases wit Pg Hl k T (f :: G) h.2.2.1 (ih h.1) r rr.1 (len1 k _ _ hk rr.2.1) with
| intro B hB =>
cases hB.2 with
| intro t ht =>
cases mem_cons_cases hB.1 with
| inr bG => exact e4 B (List.Mem.tail _ bG) t ht.1 (compat_symm _ _ ht.2)
| inl bf =>
rw [bf] at ht
have tt := h.2.2.2.2.2 t ht.1
have m : Mt Pg Hl (r ++ t) := mt_app Pg Hl r t rr.1 tt.1 (compat_symm _ _ ht.2)
have ml : (r ++ t).length + k <= Hl.length := by
rw [len_app]; exact len2 k _ _ _ hk rr.2.1 tt.2
cases h.2.2.2.1 (r ++ t) m ml with
| intro u hu =>
cases hu.1 with
| inl a => exact e4 _ (List.Mem.head G) u a (compat_symm _ _ (cpart u _ r hu.2 (sub_l r t)))
| inr b => exact h.2.2.2.2.1 u b f hf t ht.1 (cpart u _ t hu.2 (sub_r r t))
| andNil G =>
intro h r hr
exact h.1.2.2.2 r hr _ (List.Mem.head G) [] h.2 (fun _ _ _ hq => nomatch hq)
| andCons G f l p q ihp ihq =>
intro h r hr
have hc := h.2.2.1
have rr := hc.1 r hr
have e4 := hc.2.2.2 r hr
cases wit Pg Hl k T (f :: G) h.2.2.2.1 (ihp h.1) r rr.1 (len1 k _ _ hk rr.2.1) with
| intro B1 hB1 =>
cases hB1.2 with
| intro t1 ht1 =>
cases mem_cons_cases hB1.1 with
| inr bG => exact e4 B1 (List.Mem.tail _ bG) t1 ht1.1 (compat_symm _ _ ht1.2)
| inl bf =>
rw [bf] at ht1
have s1 := h.2.2.2.2.2.2.2.2.2.1 t1 ht1.1
have m1 : Mt Pg Hl (r ++ t1) := mt_app Pg Hl r t1 rr.1 s1.1 (compat_symm _ _ ht1.2)
have l1 : (r ++ t1).length + k <= Hl.length := by
rw [len_app]; exact len2 k _ _ _ hk rr.2.1 s1.2
cases wit Pg Hl k T (Fm.andL l :: G) h.2.2.2.2.1 (ihq h.2.1) (r ++ t1) m1 l1 with
| intro B2 hB2 =>
cases hB2.2 with
| intro t2 ht2 =>
cases mem_cons_cases hB2.1 with
| inr bG => exact e4 B2 (List.Mem.tail _ bG) t2 ht2.1 (compat_symm _ _ (cpart t2 _ r ht2.2 (sub_l r t1)))
| inl ba =>
rw [ba] at ht2
have s2 := h.2.2.2.2.2.2.2.2.2.2 t2 ht2.1
have m2 : Mt Pg Hl ((r ++ t1) ++ t2) := mt_app Pg Hl _ t2 m1 s2.1 (compat_symm _ _ ht2.2)
have l2 : ((r ++ t1) ++ t2).length + k <= Hl.length := by
rw [len_app, len_app]; exact len3 k _ _ _ _ hk rr.2.1 s1.2 s2.2
have sr : Sub r ((r ++ t1) ++ t2) := sub_trans _ _ _ (sub_l r t1) (sub_l _ t2)
have st1 : Sub t1 ((r ++ t1) ++ t2) := sub_trans _ _ _ (sub_r r t1) (sub_l _ t2)
have st2 : Sub t2 ((r ++ t1) ++ t2) := sub_r _ t2
cases h.2.2.2.2.2.2.2.2.1 _ m2 l2 with
| intro u hu =>
cases hu.1 with
| inl a => exact e4 _ (List.Mem.head G) u a (compat_symm _ _ (cpart u _ r hu.2 sr))
| inr b =>
cases h.2.2.2.2.2.2.1 u b with
| intro B3 hB3 =>
cases hB3.2 with
| intro t3 ht3 =>
have c3 : Compat t3 ((r ++ t1) ++ t2) := compat_mono u _ t3 _ hu.2 ht3.2 (fun _ hx => hx)
cases mem_cons_cases hB3.1 with
| inl bd =>
rw [bd] at ht3
exact (h.2.2.2.2.2.2.2.1 t3 ht3.1).2.2 t1 ht1.1 (cpart t3 _ t1 c3 st1)
| inr bl =>
have e : dual (Fm.orL (dualL l)) = Fm.andL l := congrArg Fm.andL (dualL_dual l)
have t2' : T (dual (Fm.orL (dualL l))) t2 := by rw [e]; exact ht2.1
exact h.2.2.2.2.2.1 t2 t2' B3 bl t3 ht3.1 (compat_symm _ _ (cpart t3 _ t2 c3 st2))
| cut G f p q ihp ihq =>
intro h r hr
have hc := h.2.2.1
have rr := hc.1 r hr
have e4 := hc.2.2.2 r hr
cases wit Pg Hl k T (f :: G) h.2.2.2.1 (ihp h.1) r rr.1 (len1 k _ _ hk rr.2.1) with
| intro B1 hB1 =>
cases hB1.2 with
| intro t1 ht1 =>
cases mem_cons_cases hB1.1 with
| inr bG => exact e4 B1 bG t1 ht1.1 (compat_symm _ _ ht1.2)
| inl bf =>
rw [bf] at ht1
have s1 := h.2.2.2.2.2.2 t1 ht1.1
have m1 : Mt Pg Hl (r ++ t1) := mt_app Pg Hl r t1 rr.1 s1.1 (compat_symm _ _ ht1.2)
have l1 : (r ++ t1).length + k <= Hl.length := by
rw [len_app]; exact len2 k _ _ _ hk rr.2.1 s1.2
cases wit Pg Hl k T (dual f :: G) h.2.2.2.2.1 (ihq h.2.1) (r ++ t1) m1 l1 with
| intro B2 hB2 =>
cases hB2.2 with
| intro t2 ht2 =>
cases mem_cons_cases hB2.1 with
| inr bG => exact e4 B2 bG t2 ht2.1 (compat_symm _ _ (cpart t2 _ r ht2.2 (sub_l r t1)))
| inl bd =>
rw [bd] at ht2
exact (h.2.2.2.2.2.1 t2 ht2.1).2.2 t1 ht1.1 (cpart t2 _ t1 ht2.2 (sub_r r t1))
| weak G G' hs p ih =>
intro h r hr
have hc := h.2.1
have rr := hc.1 r hr
cases wit Pg Hl k T G h.2.2 (ih h.1) r rr.1 (len1 k _ _ hk rr.2.1) with
| intro B hB =>
cases hB.2 with
| intro t ht => exact hc.2.2.2 r hr B (hs B hB.1) t ht.1 (compat_symm _ _ ht.2)
/-- The empty sequent is never true when the false formula has the empty branch as a false branch. -/
theorem false_not_tr (h0 : T (dual (Fm.orL [])) []) : Not (Tr T []) := fun ht => ht [] h0
/-- A derivation of the empty sequent whose nodes are Ok does not exist. -/
theorem no_refutation (hk : k + k + k + k <= Hl.length) (d : TD H []) (hd : Ok Pg Hl k T d)
(h0 : T (dual (Fm.orL [])) []) : False :=
false_not_tr h0 (tr_of_ok hk [] d hd)
end
end Found.Pnp134
#print axioms Found.Pnp134.dual_dual
#print axioms Found.Pnp134.dualL_dual
#print axioms Found.Pnp134.wit
#print axioms Found.Pnp134.sub_l
#print axioms Found.Pnp134.sub_r
#print axioms Found.Pnp134.sub_refl
#print axioms Found.Pnp134.sub_trans
#print axioms Found.Pnp134.cpart
#print axioms Found.Pnp134.len1
#print axioms Found.Pnp134.len2
#print axioms Found.Pnp134.len3
#print axioms Found.Pnp134.tr_of_ok
#print axioms Found.Pnp134.false_not_tr
#print axioms Found.Pnp134.no_refutation
lean_all/found/Pnp135.lean
/-
T330 piece 135. found/Pnp135 -- the pigeonhole sequents are true under a k-evaluation of the
restricted literals (proof complexity ladder, step 3: bounded-depth Frege).
With a variable code cd i j for "pigeon i sits in hole j", the pigeon sequent of i is the list
of literals cd i j (j in Hl), and the hole sequent of i, i', j (i different from i') is the
pair of negated literals cd i j, cd i' j; phpH lists all of them. A restriction r0 (a matching
over Pg x Hl) leaves the free pigeons Pg' and free holes Hl'. The literal conditions (LitOk)
are those of the decision trees "ask pigeon i": a literal fixed true by r0 has the empty true
branch, a literal fixed false has the empty false branch, and for free i, j the literal cd i j
has the true branch [(i, j)] and the false branches [(i, j')] for the other free holes j'.
Proved:
* pig_tr: a pigeon sequent is true when k < |Hl'|;
* hole_tr: a hole sequent is true when k + 2 <= |Hl'|;
* mem_phpH, hyp_tr: every sequent of phpH is true.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp134
namespace Found.Pnp135
open Found.Pnp115 (anyL mem_cons_cases beq_eq)
open Found.Pnp116 (anyL_ex mem_app)
open Found.Pnp119 (cm mem_cm)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp122 (anyL_false_all)
open Found.Pnp123 (Dist)
open Found.Pnp124 (len_mapL)
open Found.Pnp127 (mem_mapL_inv)
open Found.Pnp132 (Fm dual)
open Found.Pnp133 (Cons Compat Mt free_pair free_hole ne_of_beq_false)
open Found.Pnp134 (KC LineOk Tr)
def pigS (cd : Nat -> Nat -> Nat) (Hl : List Nat) (i : Nat) : List Fm := mapL (fun j => Fm.lit (cd i j) true) Hl
def holeS (cd : Nat -> Nat -> Nat) (i i' j : Nat) : List Fm := [Fm.lit (cd i j) false, Fm.lit (cd i' j) false]
def selH (b : Bool) (x : List (List Fm)) : List (List Fm) := match b with | true => [] | false => x
def holes1 (cd : Nat -> Nat -> Nat) (Pg : List Nat) (j : Nat) : List (List Fm) :=
cm (fun i => cm (fun i' => selH (Nat.beq i i') [holeS cd i i' j]) Pg) Pg
def phpH (cd : Nat -> Nat -> Nat) (Pg Hl : List Nat) : List (List Fm) := mapL (pigS cd Hl) Pg ++ cm (holes1 cd Pg) Hl
theorem mem_phpH (cd : Nat -> Nat -> Nat) (Pg Hl : List Nat) (G : List Fm) (h : G ∈ phpH cd Pg Hl) :
(Exists fun i => i ∈ Pg /\ G = pigS cd Hl i) \/
(Exists fun j => j ∈ Hl /\ Exists fun i => i ∈ Pg /\ Exists fun i' => i' ∈ Pg /\ Not (i = i') /\ G = holeS cd i i' j) := by
cases mem_app G _ _ h with
| inl a => exact Or.inl (mem_mapL_inv _ G Pg a)
| inr b =>
cases mem_cm _ G Hl b with
| intro j hj =>
cases mem_cm _ G Pg hj.2 with
| intro i hi =>
cases mem_cm _ G Pg hi.2 with
| intro i' hi' =>
have hm : G ∈ selH (Nat.beq i i') [holeS cd i i' j] := hi'.2
cases e : Nat.beq i i' with
| true => rw [e] at hm; exact nomatch hm
| false =>
rw [e] at hm
have hm' : G ∈ [holeS cd i i' j] := hm
cases mem_cons_cases hm' with
| inr h2 => exact nomatch h2
| inl q => exact Or.inr (Exists.intro j (And.intro hj.1 (Exists.intro i (And.intro hi.1
(Exists.intro i' (And.intro hi'.1 (And.intro (ne_of_beq_false i i' e) q)))))))
/-- The free pigeons and holes of a restriction. -/
structure Free (Pg Hl Pg' Hl' : List Nat) (r0 : List (Nat × Nat)) : Prop where
f1 : forall i, i ∈ Pg -> (forall p, p ∈ r0 -> Not (p.1 = i)) -> i ∈ Pg'
f2 : forall j, j ∈ Hl -> (forall p, p ∈ r0 -> Not (p.2 = j)) -> j ∈ Hl'
f3 : forall j, j ∈ Hl' -> j ∈ Hl
mt0 : Mt Pg Hl r0
dist : Dist Hl'
/-- The literal conditions under the restriction r0. -/
structure LitOk (Pg Hl Pg' Hl' : List Nat) (r0 : List (Nat × Nat)) (cd : Nat -> Nat -> Nat)
(T : Fm -> List (Nat × Nat) -> Prop) : Prop where
l1 : forall p, p ∈ r0 -> T (Fm.lit (cd p.1 p.2) true) []
l2 : forall p, p ∈ r0 -> forall j, j ∈ Hl -> Not (j = p.2) -> T (Fm.lit (cd p.1 j) false) []
l3 : forall p, p ∈ r0 -> forall i, i ∈ Pg -> Not (i = p.1) -> T (Fm.lit (cd i p.2) false) []
l4 : forall i, i ∈ Pg' -> forall j, j ∈ Hl' -> T (Fm.lit (cd i j) true) [(i, j)]
l5 : forall i, i ∈ Pg' -> forall j, j ∈ Hl' -> forall j', j' ∈ Hl' -> Not (j' = j) -> T (Fm.lit (cd i j) false) [(i, j')]
theorem compat_nil (r : List (Nat × Nat)) : Compat r [] := fun _ _ _ hq => nomatch hq
theorem compat_pair (Pg Hl : List Nat) (r : List (Nat × Nat)) (hr : Mt Pg Hl r) (p : Nat × Nat) (hp : p ∈ r)
(i : Nat) (pe : p.1 = i) : Compat r [(i, p.2)] := fun q hq x hx => by
cases mem_cons_cases hx with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
have c := hr.cons q hq p hp
exact And.intro (fun a => c.1 (a.trans pe.symm)) (fun b => (c.2 b).trans pe)
theorem none_of_anyL {α : Type} (g : α -> Nat) (i : Nat) (L : List α) (e : anyL (fun p => Nat.beq (g p) i) L = false) :
forall p, p ∈ L -> Not (g p = i) := fun p hp =>
ne_of_beq_false _ _ (anyL_false_all (fun p => Nat.beq (g p) i) L e p hp)
section
variable {Pg Hl Pg' Hl' : List Nat} {r0 : List (Nat × Nat)} {k : Nat} {T : Fm -> List (Nat × Nat) -> Prop}
theorem pig_tr (cd : Nat -> Nat -> Nat) (hF : Free Pg Hl Pg' Hl' r0) (hT : LitOk Pg Hl Pg' Hl' r0 cd T)
(hk : k + 1 <= Hl'.length) (i : Nat) (hi : i ∈ Pg)
(hL : LineOk Pg' Hl' k T (pigS cd Hl i)) : Tr T (pigS cd Hl i) := by
intro r hr
have rr := hL.1 r hr
have e4 := hL.2.2.2 r hr
have key : forall j, j ∈ Hl -> forall t, T (Fm.lit (cd i j) true) t -> Compat r t -> False := fun j hj t ht hc =>
e4 _ (mem_mapL (fun j => Fm.lit (cd i j) true) j Hl hj) t ht hc
cases e : anyL (fun p : Nat × Nat => Nat.beq p.1 i) r0 with
| true =>
cases anyL_ex _ r0 e with
| intro p hp =>
have pe : p.1 = i := beq_eq _ _ hp.2
have t := hT.l1 p hp.1
rw [pe] at t
exact key p.2 (hF.mt0.rng p hp.1).2 [] t (compat_nil r)
| false =>
have iP := hF.f1 i hi (none_of_anyL Prod.fst i r0 e)
cases e2 : anyL (fun p : Nat × Nat => Nat.beq p.1 i) r with
| true =>
cases anyL_ex _ r e2 with
| intro p hp =>
have pe : p.1 = i := beq_eq _ _ hp.2
have h2 := (rr.1.rng p hp.1).2
exact key p.2 (hF.f3 _ h2) _ (hT.l4 i iP p.2 h2) (compat_pair Pg' Hl' r rr.1 p hp.1 i pe)
| false =>
cases free_pair Hl' hF.dist r (Nat.lt_of_le_of_lt rr.2.1 hk) i (none_of_anyL Prod.fst i r e2) with
| intro j hj => exact key j (hF.f3 j hj.1) _ (hT.l4 i iP j hj.1) hj.2
theorem hole_tr (cd : Nat -> Nat -> Nat) (hF : Free Pg Hl Pg' Hl' r0) (hT : LitOk Pg Hl Pg' Hl' r0 cd T)
(hk : k + 2 <= Hl'.length) (i i' j : Nat) (hi : i ∈ Pg) (hi2 : i' ∈ Pg) (hj : j ∈ Hl) (hii : Not (i = i'))
(hL : LineOk Pg' Hl' k T (holeS cd i i' j)) : Tr T (holeS cd i i' j) := by
intro r hr
have rr := hL.1 r hr
have e4 := hL.2.2.2 r hr
have k1 : forall t, T (Fm.lit (cd i j) false) t -> Compat r t -> False := fun t ht hc => e4 _ (List.Mem.head _) t ht hc
have k2 : forall t, T (Fm.lit (cd i' j) false) t -> Compat r t -> False := fun t ht hc =>
e4 _ (List.Mem.tail _ (List.Mem.head _)) t ht hc
have lt1 : r.length < Hl'.length := Nat.lt_of_le_of_lt rr.2.1 (Nat.lt_of_lt_of_le (Nat.lt_succ_self k) (Nat.le_trans (Nat.le_succ _) hk))
cases e : anyL (fun p : Nat × Nat => Nat.beq p.2 j) r0 with
| true =>
cases anyL_ex _ r0 e with
| intro p hp =>
have pj : p.2 = j := beq_eq _ _ hp.2
cases ei : Nat.beq p.1 i with
| true =>
have pi : p.1 = i := beq_eq _ _ ei
have t := hT.l3 p hp.1 i' hi2 (fun q => hii ((q.trans pi).symm))
rw [pj] at t
exact k2 [] t (compat_nil r)
| false =>
have t := hT.l3 p hp.1 i hi (fun q => ne_of_beq_false _ _ ei q.symm)
rw [pj] at t
exact k1 [] t (compat_nil r)
| false =>
have hjf := none_of_anyL Prod.snd j r0 e
have jH := hF.f2 j hj hjf
cases e1 : anyL (fun p : Nat × Nat => Nat.beq p.1 i) r0 with
| true =>
cases anyL_ex _ r0 e1 with
| intro p hp =>
have pi : p.1 = i := beq_eq _ _ hp.2
have t := hT.l2 p hp.1 j hj (fun q => hjf p hp.1 q.symm)
rw [pi] at t
exact k1 [] t (compat_nil r)
| false =>
have iP := hF.f1 i hi (none_of_anyL Prod.fst i r0 e1)
cases e2 : anyL (fun p : Nat × Nat => Nat.beq p.1 i') r0 with
| true =>
cases anyL_ex _ r0 e2 with
| intro p hp =>
have pi : p.1 = i' := beq_eq _ _ hp.2
have t := hT.l2 p hp.1 j hj (fun q => hjf p hp.1 q.symm)
rw [pi] at t
exact k2 [] t (compat_nil r)
| false =>
have iP2 := hF.f1 i' hi2 (none_of_anyL Prod.fst i' r0 e2)
cases e3 : anyL (fun p : Nat × Nat => Nat.beq p.1 i) r with
| true =>
cases anyL_ex _ r e3 with
| intro p hp =>
have pi : p.1 = i := beq_eq _ _ hp.2
have p2H := (rr.1.rng p hp.1).2
cases ej : Nat.beq p.2 j with
| false =>
exact k1 _ (hT.l5 i iP j jH p.2 p2H (ne_of_beq_false _ _ ej)) (compat_pair Pg' Hl' r rr.1 p hp.1 i pi)
| true =>
have pj : p.2 = j := beq_eq _ _ ej
cases e4' : anyL (fun q : Nat × Nat => Nat.beq q.1 i') r with
| true =>
cases anyL_ex _ r e4' with
| intro q hq =>
have qi : q.1 = i' := beq_eq _ _ hq.2
have qne : Not (q.2 = j) := fun qj =>
hii ((pi.symm.trans ((rr.1.cons q hq.1 p hp.1).2 (qj.trans pj.symm)).symm).trans qi)
exact k2 _ (hT.l5 i' iP2 j jH q.2 (rr.1.rng q hq.1).2 qne) (compat_pair Pg' Hl' r rr.1 q hq.1 i' qi)
| false =>
cases free_pair Hl' hF.dist r lt1 i' (none_of_anyL Prod.fst i' r e4') with
| intro j' hj' =>
have jne : Not (j' = j) := fun q =>
hii (pi.symm.trans ((hj'.2 p hp.1 (i', j') (List.Mem.head _)).2 (pj.trans q.symm)))
exact k2 _ (hT.l5 i' iP2 j jH j' hj'.1 jne) hj'.2
| false =>
have hfi := none_of_anyL Prod.fst i r e3
have ll : (j :: mapL Prod.snd r).length < Hl'.length := by
show (mapL Prod.snd r).length + 1 < Hl'.length
rw [len_mapL]
exact Nat.lt_of_lt_of_le (Nat.succ_lt_succ (Nat.lt_of_le_of_lt rr.2.1 (Nat.lt_succ_self k))) hk
cases free_hole Hl' (j :: mapL Prod.snd r) hF.dist ll with
| intro j' hj' =>
have jne : Not (j' = j) := fun q => hj'.2 (q ▸ List.Mem.head _)
refine k1 _ (hT.l5 i iP j jH j' hj'.1 jne) (fun q hq x hx => ?_)
cases mem_cons_cases hx with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
refine And.intro (fun a => absurd a (hfi q hq)) (fun b => ?_)
have t := mem_mapL Prod.snd q r hq
rw [b] at t
exact absurd (List.Mem.tail j t) hj'.2
/-- Every pigeonhole sequent is true under a k-evaluation of the restricted literals. -/
theorem hyp_tr (cd : Nat -> Nat -> Nat) (hF : Free Pg Hl Pg' Hl' r0) (hT : LitOk Pg Hl Pg' Hl' r0 cd T)
(hk : k + 2 <= Hl'.length) (hL : forall G, G ∈ phpH cd Pg Hl -> LineOk Pg' Hl' k T G) :
forall G, G ∈ phpH cd Pg Hl -> Tr T G := by
intro G hG
cases mem_phpH cd Pg Hl G hG with
| inl a =>
cases a with
| intro i hi =>
rw [hi.2]
rw [hi.2] at hG
exact pig_tr cd hF hT (Nat.le_trans (Nat.le_succ _) hk) i hi.1 (hL _ hG)
| inr b =>
cases b with
| intro j hj =>
cases hj.2 with
| intro i hi =>
cases hi.2 with
| intro i' hi' =>
rw [hi'.2.2]
rw [hi'.2.2] at hG
exact hole_tr cd hF hT hk i i' j hi.1 hi'.1 hj.1 hi'.2.1 (hL _ hG)
end
end Found.Pnp135
#print axioms Found.Pnp135.mem_phpH
#print axioms Found.Pnp135.compat_nil
#print axioms Found.Pnp135.compat_pair
#print axioms Found.Pnp135.none_of_anyL
#print axioms Found.Pnp135.pig_tr
#print axioms Found.Pnp135.hole_tr
#print axioms Found.Pnp135.hyp_tr
lean_all/found/Pnp136.lean
/-
T330 piece 136. found/Pnp136 -- matching decision trees (proof complexity ladder, step 3:
bounded-depth Frege and the pigeonhole principle).
A matching decision tree is a leaf labelled true or false, or a query of a pigeon i whose
children are labelled by the answering holes j, or a query of a hole j whose children are
labelled by the answering pigeons i (MT and its child lists MTL, a mutual inductive type).
A branch is the list of pairs met from the root to a leaf, with the label of the leaf. The
height uses the maximum mx given by Nat.ble. Proved:
* mx_l, mx_r, mx_lub: the maximum;
* mem_brsP, mem_brsH: a branch below a query starts with the queried pair of a child;
* inch_ht: a child is not higher than its list;
* br_len: every branch is at most as long as the height.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp135
namespace Found.Pnp136
open Found.Pnp65 (ble_false_le)
open Found.Pnp115 (mem_cons_cases)
open Found.Pnp116 (mem_app mem_app_l mem_app_r)
open Found.Pnp118 (ble_le)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp127 (mem_mapL_inv)
def mx (a b : Nat) : Nat := match Nat.ble a b with
| true => b
| false => a
theorem mx_l (a b : Nat) : a <= mx a b := by
cases e : Nat.ble a b with
| true =>
show a <= (match Nat.ble a b with | true => b | false => a)
rw [e]; exact ble_le a b e
| false =>
show a <= (match Nat.ble a b with | true => b | false => a)
rw [e]; exact Nat.le_refl a
theorem mx_r (a b : Nat) : b <= mx a b := by
cases e : Nat.ble a b with
| true =>
show b <= (match Nat.ble a b with | true => b | false => a)
rw [e]; exact Nat.le_refl b
| false =>
show b <= (match Nat.ble a b with | true => b | false => a)
rw [e]; exact ble_false_le a b e
theorem mx_lub (a b c : Nat) (ha : a <= c) (hb : b <= c) : mx a b <= c := by
cases e : Nat.ble a b with
| true =>
show (match Nat.ble a b with | true => b | false => a) <= c
rw [e]; exact hb
| false =>
show (match Nat.ble a b with | true => b | false => a) <= c
rw [e]; exact ha
mutual
inductive MT : Type where
| leaf : Bool -> MT
| qp : Nat -> MTL -> MT
| qh : Nat -> MTL -> MT
inductive MTL : Type where
| nil : MTL
| cons : Nat -> MT -> MTL -> MTL
end
mutual
def brs : MT -> List (List (Nat × Nat) × Bool)
| .leaf b => [([], b)]
| .qp i ch => brsP i ch
| .qh j ch => brsH j ch
def brsP (i : Nat) : MTL -> List (List (Nat × Nat) × Bool)
| .nil => []
| .cons j t rest => mapL (fun x => ((i, j) :: x.1, x.2)) (brs t) ++ brsP i rest
def brsH (j : Nat) : MTL -> List (List (Nat × Nat) × Bool)
| .nil => []
| .cons i t rest => mapL (fun x => ((i, j) :: x.1, x.2)) (brs t) ++ brsH j rest
end
mutual
def ht : MT -> Nat
| .leaf _ => 0
| .qp _ ch => htL ch + 1
| .qh _ ch => htL ch + 1
def htL : MTL -> Nat
| .nil => 0
| .cons _ t rest => mx (ht t) (htL rest)
end
/-- Child membership. -/
def InCh (a : Nat) (t : MT) : MTL -> Prop
| .nil => False
| .cons b u rest => (a = b /\ t = u) \/ InCh a t rest
theorem inch_ht (a : Nat) (t : MT) : forall ch : MTL, InCh a t ch -> ht t <= htL ch
| .nil, h => nomatch h
| .cons b u rest, h => by
cases h with
| inl e => rw [e.2]; exact mx_l (ht u) (htL rest)
| inr h2 => exact Nat.le_trans (inch_ht a t rest h2) (mx_r (ht u) (htL rest))
theorem mem_brsP (i : Nat) (x : List (Nat × Nat) × Bool) : forall ch : MTL, x ∈ brsP i ch ->
Exists fun j => Exists fun t => InCh j t ch /\ Exists fun y => y ∈ brs t /\ x = ((i, j) :: y.1, y.2)
| .nil, h => nomatch h
| .cons j t rest, h => by
cases mem_app x _ _ h with
| inl a =>
cases mem_mapL_inv _ x _ a with
| intro y hy => exact Exists.intro j (Exists.intro t (And.intro (Or.inl (And.intro rfl rfl))
(Exists.intro y hy)))
| inr b =>
cases mem_brsP i x rest b with
| intro j' hj' =>
cases hj' with
| intro t' ht' => exact Exists.intro j' (Exists.intro t' (And.intro (Or.inr ht'.1) ht'.2))
theorem mem_brsH (j : Nat) (x : List (Nat × Nat) × Bool) : forall ch : MTL, x ∈ brsH j ch ->
Exists fun i => Exists fun t => InCh i t ch /\ Exists fun y => y ∈ brs t /\ x = ((i, j) :: y.1, y.2)
| .nil, h => nomatch h
| .cons i t rest, h => by
cases mem_app x _ _ h with
| inl a =>
cases mem_mapL_inv _ x _ a with
| intro y hy => exact Exists.intro i (Exists.intro t (And.intro (Or.inl (And.intro rfl rfl))
(Exists.intro y hy)))
| inr b =>
cases mem_brsH j x rest b with
| intro i' hi' =>
cases hi' with
| intro t' ht' => exact Exists.intro i' (Exists.intro t' (And.intro (Or.inr ht'.1) ht'.2))
/-- A child's branch extended by the query pair is a branch of the parent. -/
theorem brsP_of (i j : Nat) (t : MT) (y : List (Nat × Nat) × Bool) (hy : y ∈ brs t) :
forall ch : MTL, InCh j t ch -> ((i, j) :: y.1, y.2) ∈ brsP i ch
| .nil, h => nomatch h
| .cons b u rest, h => by
show ((i, j) :: y.1, y.2) ∈ mapL (fun x => ((i, b) :: x.1, x.2)) (brs u) ++ brsP i rest
cases h with
| inl e =>
rw [<- e.1, <- e.2]
exact mem_app_l _ _ _ (mem_mapL (fun x => ((i, j) :: x.1, x.2)) y (brs t) hy)
| inr h2 => exact mem_app_r _ _ _ (brsP_of i j t y hy rest h2)
theorem brsH_of (i j : Nat) (t : MT) (y : List (Nat × Nat) × Bool) (hy : y ∈ brs t) :
forall ch : MTL, InCh i t ch -> ((i, j) :: y.1, y.2) ∈ brsH j ch
| .nil, h => nomatch h
| .cons b u rest, h => by
show ((i, j) :: y.1, y.2) ∈ mapL (fun x => ((b, j) :: x.1, x.2)) (brs u) ++ brsH j rest
cases h with
| inl e =>
rw [<- e.1, <- e.2]
exact mem_app_l _ _ _ (mem_mapL (fun x => ((i, j) :: x.1, x.2)) y (brs t) hy)
| inr h2 => exact mem_app_r _ _ _ (brsH_of i j t y hy rest h2)
mutual
theorem br_len : forall (t : MT) (x : List (Nat × Nat) × Bool), x ∈ brs t -> x.1.length <= ht t
| .leaf b, x, h => by
cases mem_cons_cases h with
| inl e => rw [e]; exact Nat.le_refl 0
| inr h2 => exact nomatch h2
| .qp i ch, x, h => brL_len ch x (Or.inl (Exists.intro i h))
| .qh j ch, x, h => brL_len ch x (Or.inr (Exists.intro j h))
theorem brL_len : forall (ch : MTL) (x : List (Nat × Nat) × Bool),
((Exists fun i => x ∈ brsP i ch) \/ (Exists fun j => x ∈ brsH j ch)) -> x.1.length <= htL ch + 1
| .nil, x, h => by
cases h with
| inl a => cases a with | intro _ hi => exact nomatch hi
| inr b => cases b with | intro _ hj => exact nomatch hj
| .cons a t rest, x, h => by
have step : forall (c : Nat × Nat) (hy : Exists fun y => y ∈ brs t /\ x = (c :: y.1, y.2)),
x.1.length <= mx (ht t) (htL rest) + 1 := by
intro c hy
cases hy with
| intro y hy =>
rw [hy.2]
exact Nat.succ_le_succ (Nat.le_trans (br_len t y hy.1) (mx_l (ht t) (htL rest)))
have hrec : x.1.length <= htL rest + 1 -> x.1.length <= mx (ht t) (htL rest) + 1 := fun q =>
Nat.le_trans q (Nat.succ_le_succ (mx_r (ht t) (htL rest)))
cases h with
| inl hi =>
cases hi with
| intro i hi =>
cases mem_app x _ _ hi with
| inl a1 =>
cases mem_mapL_inv _ x _ a1 with
| intro y hy => exact step (i, a) (Exists.intro y hy)
| inr b1 => exact hrec (brL_len rest x (Or.inl (Exists.intro i b1)))
| inr hj =>
cases hj with
| intro j hj =>
cases mem_app x _ _ hj with
| inl a1 =>
cases mem_mapL_inv _ x _ a1 with
| intro y hy => exact step (a, j) (Exists.intro y hy)
| inr b1 => exact hrec (brL_len rest x (Or.inr (Exists.intro j b1)))
end
end Found.Pnp136
#print axioms Found.Pnp136.mx_l
#print axioms Found.Pnp136.mx_r
#print axioms Found.Pnp136.mx_lub
#print axioms Found.Pnp136.inch_ht
#print axioms Found.Pnp136.mem_brsP
#print axioms Found.Pnp136.mem_brsH
#print axioms Found.Pnp136.brsP_of
#print axioms Found.Pnp136.brsH_of
#print axioms Found.Pnp136.br_len
#print axioms Found.Pnp136.brL_len
lean_all/found/Pnp137.lean
/-
T330 piece 137. found/Pnp137 -- well-formed matching decision trees (proof complexity ladder,
step 3: bounded-depth Frege and the pigeonhole principle).
WF Pg Hl p t says that t is a matching decision tree below the path p over pigeons Pg and
holes Hl: a queried pigeon (hole) is in Pg (Hl) and not used by p, the answers of a query are
in Hl (Pg), not used by p and pairwise different, every unused hole (pigeon) is an answer,
and every child is well formed below the path extended by its pair. Proved:
* wf_ind: induction over well-formed trees (one mutual recursion for all later uses);
* wfp_child, wfh_child: facts about the answer of a child;
* inch_uniqP, inch_uniqH: an answer has only one child;
* mt_cons, mt_sub: extending and shrinking matchings;
* br_mt: every branch together with p is a matching;
* br_inc: branches with different leaf labels are incompatible.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp136
namespace Found.Pnp137
open Found.Pnp115 (mem_cons_cases beq_eq)
open Found.Pnp133 (Cons Compat Mt compat_mono ne_of_beq_false)
open Found.Pnp136 (MT MTL brs brsP brsH InCh mem_brsP mem_brsH)
mutual
def WF (Pg Hl : List Nat) (p : List (Nat × Nat)) : MT -> Prop
| .leaf _ => True
| .qp i ch => i ∈ Pg /\ (forall q, q ∈ p -> Not (q.1 = i)) /\ WFP Pg Hl p i ch /\
(forall j, j ∈ Hl -> (forall q, q ∈ p -> Not (q.2 = j)) -> Exists fun t => InCh j t ch)
| .qh j ch => j ∈ Hl /\ (forall q, q ∈ p -> Not (q.2 = j)) /\ WFH Pg Hl p j ch /\
(forall i, i ∈ Pg -> (forall q, q ∈ p -> Not (q.1 = i)) -> Exists fun t => InCh i t ch)
def WFP (Pg Hl : List Nat) (p : List (Nat × Nat)) (i : Nat) : MTL -> Prop
| .nil => True
| .cons j t rest => j ∈ Hl /\ (forall q, q ∈ p -> Not (q.2 = j)) /\ (forall t', Not (InCh j t' rest)) /\
WF Pg Hl ((i, j) :: p) t /\ WFP Pg Hl p i rest
def WFH (Pg Hl : List Nat) (p : List (Nat × Nat)) (j : Nat) : MTL -> Prop
| .nil => True
| .cons i t rest => i ∈ Pg /\ (forall q, q ∈ p -> Not (q.1 = i)) /\ (forall t', Not (InCh i t' rest)) /\
WF Pg Hl ((i, j) :: p) t /\ WFH Pg Hl p j rest
end
mutual
theorem wf_ind (Pg Hl : List Nat) (Q : List (Nat × Nat) -> MT -> Prop)
(hl : forall p b, Q p (MT.leaf b))
(hp : forall p i ch, WF Pg Hl p (MT.qp i ch) -> (forall j t, InCh j t ch -> Q ((i, j) :: p) t) -> Q p (MT.qp i ch))
(hh : forall p j ch, WF Pg Hl p (MT.qh j ch) -> (forall i t, InCh i t ch -> Q ((i, j) :: p) t) -> Q p (MT.qh j ch)) :
forall (t : MT) (p : List (Nat × Nat)), WF Pg Hl p t -> Q p t
| .leaf b, p, _ => hl p b
| .qp i ch, p, h => hp p i ch h (wf_indP Pg Hl Q hl hp hh ch p i h.2.2.1)
| .qh j ch, p, h => hh p j ch h (wf_indH Pg Hl Q hl hp hh ch p j h.2.2.1)
theorem wf_indP (Pg Hl : List Nat) (Q : List (Nat × Nat) -> MT -> Prop)
(hl : forall p b, Q p (MT.leaf b))
(hp : forall p i ch, WF Pg Hl p (MT.qp i ch) -> (forall j t, InCh j t ch -> Q ((i, j) :: p) t) -> Q p (MT.qp i ch))
(hh : forall p j ch, WF Pg Hl p (MT.qh j ch) -> (forall i t, InCh i t ch -> Q ((i, j) :: p) t) -> Q p (MT.qh j ch)) :
forall (ch : MTL) (p : List (Nat × Nat)) (i : Nat), WFP Pg Hl p i ch ->
forall j t, InCh j t ch -> Q ((i, j) :: p) t
| .nil, _, _, _, _, _, hin => False.elim hin
| .cons j' t' rest, p, i, h, j, t, hin => by
cases hin with
| inl e => rw [e.1, e.2]; exact wf_ind Pg Hl Q hl hp hh t' ((i, j') :: p) h.2.2.2.1
| inr h2 => exact wf_indP Pg Hl Q hl hp hh rest p i h.2.2.2.2 j t h2
theorem wf_indH (Pg Hl : List Nat) (Q : List (Nat × Nat) -> MT -> Prop)
(hl : forall p b, Q p (MT.leaf b))
(hp : forall p i ch, WF Pg Hl p (MT.qp i ch) -> (forall j t, InCh j t ch -> Q ((i, j) :: p) t) -> Q p (MT.qp i ch))
(hh : forall p j ch, WF Pg Hl p (MT.qh j ch) -> (forall i t, InCh i t ch -> Q ((i, j) :: p) t) -> Q p (MT.qh j ch)) :
forall (ch : MTL) (p : List (Nat × Nat)) (j : Nat), WFH Pg Hl p j ch ->
forall i t, InCh i t ch -> Q ((i, j) :: p) t
| .nil, _, _, _, _, _, hin => False.elim hin
| .cons i' t' rest, p, j, h, i, t, hin => by
cases hin with
| inl e => rw [e.1, e.2]; exact wf_ind Pg Hl Q hl hp hh t' ((i', j) :: p) h.2.2.2.1
| inr h2 => exact wf_indH Pg Hl Q hl hp hh rest p j h.2.2.2.2 i t h2
end
theorem wfp_child (Pg Hl : List Nat) (p : List (Nat × Nat)) (i j : Nat) (t : MT) : forall ch : MTL,
WFP Pg Hl p i ch -> InCh j t ch -> j ∈ Hl /\ (forall q, q ∈ p -> Not (q.2 = j))
| .nil, _, hin => False.elim hin
| .cons j' t' rest, h, hin => by
cases hin with
| inl e => rw [e.1]; exact And.intro h.1 h.2.1
| inr h2 => exact wfp_child Pg Hl p i j t rest h.2.2.2.2 h2
theorem wfh_child (Pg Hl : List Nat) (p : List (Nat × Nat)) (i j : Nat) (t : MT) : forall ch : MTL,
WFH Pg Hl p j ch -> InCh i t ch -> i ∈ Pg /\ (forall q, q ∈ p -> Not (q.1 = i))
| .nil, _, hin => False.elim hin
| .cons i' t' rest, h, hin => by
cases hin with
| inl e => rw [e.1]; exact And.intro h.1 h.2.1
| inr h2 => exact wfh_child Pg Hl p i j t rest h.2.2.2.2 h2
theorem inch_uniqP (Pg Hl : List Nat) (p : List (Nat × Nat)) (i j : Nat) (t1 t2 : MT) : forall ch : MTL,
WFP Pg Hl p i ch -> InCh j t1 ch -> InCh j t2 ch -> t1 = t2
| .nil, _, h1, _ => False.elim h1
| .cons j' t' rest, h, h1, h2 => by
cases h1 with
| inl e1 =>
cases h2 with
| inl e2 => exact e1.2.trans e2.2.symm
| inr r2 => rw [e1.1] at r2; exact absurd r2 (h.2.2.1 t2)
| inr r1 =>
cases h2 with
| inl e2 => rw [e2.1] at r1; exact absurd r1 (h.2.2.1 t1)
| inr r2 => exact inch_uniqP Pg Hl p i j t1 t2 rest h.2.2.2.2 r1 r2
theorem inch_uniqH (Pg Hl : List Nat) (p : List (Nat × Nat)) (i j : Nat) (t1 t2 : MT) : forall ch : MTL,
WFH Pg Hl p j ch -> InCh i t1 ch -> InCh i t2 ch -> t1 = t2
| .nil, _, h1, _ => False.elim h1
| .cons i' t' rest, h, h1, h2 => by
cases h1 with
| inl e1 =>
cases h2 with
| inl e2 => exact e1.2.trans e2.2.symm
| inr r2 => rw [e1.1] at r2; exact absurd r2 (h.2.2.1 t2)
| inr r1 =>
cases h2 with
| inl e2 => rw [e2.1] at r1; exact absurd r1 (h.2.2.1 t1)
| inr r2 => exact inch_uniqH Pg Hl p i j t1 t2 rest h.2.2.2.2 r1 r2
theorem mt_sub (Pg Hl : List Nat) (a b : List (Nat × Nat)) (hb : Mt Pg Hl b) (h : forall x, x ∈ a -> x ∈ b) : Mt Pg Hl a :=
Mt.mk (fun x hx => hb.rng x (h x hx)) (fun x hx y hy => hb.cons x (h x hx) y (h y hy))
theorem mt_cons (Pg Hl : List Nat) (p : List (Nat × Nat)) (hp : Mt Pg Hl p) (i j : Nat) (hi : i ∈ Pg) (hj : j ∈ Hl)
(ni : forall q, q ∈ p -> Not (q.1 = i)) (nj : forall q, q ∈ p -> Not (q.2 = j)) : Mt Pg Hl ((i, j) :: p) := by
refine Mt.mk (fun x hx => ?_) (fun x hx y hy => ?_)
· cases mem_cons_cases hx with
| inl e => rw [e]; exact And.intro hi hj
| inr h2 => exact hp.rng x h2
· cases mem_cons_cases hx with
| inl ex =>
cases mem_cons_cases hy with
| inl ey => rw [ex, ey]; exact And.intro (fun _ => rfl) (fun _ => rfl)
| inr hy2 =>
rw [ex]
exact And.intro (fun a => absurd a.symm (ni y hy2)) (fun b => absurd b.symm (nj y hy2))
| inr hx2 =>
cases mem_cons_cases hy with
| inl ey =>
rw [ey]
exact And.intro (fun a => absurd a (ni x hx2)) (fun b => absurd b (nj x hx2))
| inr hy2 => exact hp.cons x hx2 y hy2
/-- Every branch together with the path is a matching. -/
theorem br_mt (Pg Hl : List Nat) : forall (t : MT) (p : List (Nat × Nat)), WF Pg Hl p t ->
Mt Pg Hl p -> forall x, x ∈ brs t -> Mt Pg Hl (x.1 ++ p) := by
refine wf_ind Pg Hl (fun p t => Mt Pg Hl p -> forall x, x ∈ brs t -> Mt Pg Hl (x.1 ++ p)) ?_ ?_ ?_
· intro p b hm x hx
cases mem_cons_cases hx with
| inl e => rw [e]; exact hm
| inr h2 => exact nomatch h2
· intro p i ch h ih hm x hx
cases mem_brsP i x ch hx with
| intro j hj =>
cases hj with
| intro t ht =>
cases ht.2 with
| intro y hy =>
have c := wfp_child Pg Hl p i j t ch h.2.2.1 ht.1
have m := ih j t ht.1 (mt_cons Pg Hl p hm i j h.1 c.1 h.2.1 c.2) y hy.1
rw [hy.2]
refine mt_sub Pg Hl _ _ m (fun z hz => ?_)
cases mem_cons_cases hz with
| inl e => rw [e]; exact Found.Pnp116.mem_app_r _ _ _ (List.Mem.head p)
| inr h2 =>
cases Found.Pnp116.mem_app z _ _ h2 with
| inl a => exact Found.Pnp116.mem_app_l _ _ _ a
| inr b => exact Found.Pnp116.mem_app_r _ _ _ (List.Mem.tail _ b)
· intro p j ch h ih hm x hx
cases mem_brsH j x ch hx with
| intro i hi =>
cases hi with
| intro t ht =>
cases ht.2 with
| intro y hy =>
have c := wfh_child Pg Hl p i j t ch h.2.2.1 ht.1
have m := ih i t ht.1 (mt_cons Pg Hl p hm i j c.1 h.1 c.2 h.2.1) y hy.1
rw [hy.2]
refine mt_sub Pg Hl _ _ m (fun z hz => ?_)
cases mem_cons_cases hz with
| inl e => rw [e]; exact Found.Pnp116.mem_app_r _ _ _ (List.Mem.head p)
| inr h2 =>
cases Found.Pnp116.mem_app z _ _ h2 with
| inl a => exact Found.Pnp116.mem_app_l _ _ _ a
| inr b => exact Found.Pnp116.mem_app_r _ _ _ (List.Mem.tail _ b)
theorem compat_cons (a : Nat × Nat) (s t : List (Nat × Nat)) (h : Compat (a :: s) (a :: t)) : Compat s t :=
compat_mono _ _ _ _ h (fun _ hx => List.Mem.tail a hx) (fun _ hy => List.Mem.tail a hy)
/-- Branches with different leaf labels are incompatible. -/
theorem br_inc (Pg Hl : List Nat) : forall (t : MT) (p : List (Nat × Nat)), WF Pg Hl p t ->
forall x y, x ∈ brs t -> y ∈ brs t -> Not (x.2 = y.2) -> Not (Compat x.1 y.1) := by
refine wf_ind Pg Hl (fun p t => forall x y, x ∈ brs t -> y ∈ brs t -> Not (x.2 = y.2) -> Not (Compat x.1 y.1)) ?_ ?_ ?_
· intro p b x y hx hy hne _
cases mem_cons_cases hx with
| inr h2 => exact nomatch h2
| inl ex =>
cases mem_cons_cases hy with
| inr h2 => exact nomatch h2
| inl ey => rw [ex, ey] at hne; exact hne rfl
· intro p i ch h ih x y hx hy hne hc
cases mem_brsP i x ch hx with
| intro j1 hj1 =>
cases hj1 with
| intro t1 ht1 =>
cases ht1.2 with
| intro x' hx' =>
cases mem_brsP i y ch hy with
| intro j2 hj2 =>
cases hj2 with
| intro t2 ht2 =>
cases ht2.2 with
| intro y' hy' =>
rw [hx'.2, hy'.2] at hc
rw [hx'.2, hy'.2] at hne
cases e : Nat.beq j1 j2 with
| false =>
have c := hc (i, j1) (List.Mem.head _) (i, j2) (List.Mem.head _)
exact ne_of_beq_false _ _ e (c.1 rfl)
| true =>
have q := beq_eq _ _ e
rw [<- q] at ht2 hc
have tq := inch_uniqP Pg Hl p i j1 t1 t2 ch h.2.2.1 ht1.1 ht2.1
rw [<- tq] at hy'
exact ih j1 t1 ht1.1 x' y' hx'.1 hy'.1 hne (compat_cons _ _ _ hc)
· intro p j ch h ih x y hx hy hne hc
cases mem_brsH j x ch hx with
| intro i1 hi1 =>
cases hi1 with
| intro t1 ht1 =>
cases ht1.2 with
| intro x' hx' =>
cases mem_brsH j y ch hy with
| intro i2 hi2 =>
cases hi2 with
| intro t2 ht2 =>
cases ht2.2 with
| intro y' hy' =>
rw [hx'.2, hy'.2] at hc
rw [hx'.2, hy'.2] at hne
cases e : Nat.beq i1 i2 with
| false =>
have c := hc (i1, j) (List.Mem.head _) (i2, j) (List.Mem.head _)
exact ne_of_beq_false _ _ e (c.2 rfl)
| true =>
have q := beq_eq _ _ e
rw [<- q] at ht2 hc
have tq := inch_uniqH Pg Hl p i1 j t1 t2 ch h.2.2.1 ht1.1 ht2.1
rw [<- tq] at hy'
exact ih i1 t1 ht1.1 x' y' hx'.1 hy'.1 hne (compat_cons _ _ _ hc)
end Found.Pnp137
#print axioms Found.Pnp137.wf_ind
#print axioms Found.Pnp137.wf_indP
#print axioms Found.Pnp137.wf_indH
#print axioms Found.Pnp137.wfp_child
#print axioms Found.Pnp137.wfh_child
#print axioms Found.Pnp137.inch_uniqP
#print axioms Found.Pnp137.inch_uniqH
#print axioms Found.Pnp137.mt_sub
#print axioms Found.Pnp137.mt_cons
#print axioms Found.Pnp137.br_mt
#print axioms Found.Pnp137.compat_cons
#print axioms Found.Pnp137.br_inc
lean_all/found/Pnp138.lean
/-
T330 piece 138. found/Pnp138 -- every small matching follows some branch of a well-formed
matching decision tree (proof complexity ladder, step 3: bounded-depth Frege).
Let Pg and Hl be duplicate-free with |Hl| <= |Pg|, t well formed below the path p, and pi a
matching compatible with p with |pi| + (|p| + height t) <= |Hl|. At a pigeon query i, if pi
places i then its hole is an answer, otherwise a hole used neither by pi nor by p is an
answer (free_hole); at a hole query symmetrically with pigeons. So some branch of t is
compatible with pi (br_comp; at the root: tree_comp).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp137
namespace Found.Pnp138
open Found.Pnp115 (anyL mem_cons_cases beq_eq)
open Found.Pnp116 (anyL_ex mem_app mem_app_l mem_app_r len_app)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp123 (Dist)
open Found.Pnp124 (len_mapL)
open Found.Pnp133 (Cons Compat Mt compat_symm compat_app free_hole)
open Found.Pnp135 (none_of_anyL)
open Found.Pnp136 (MT MTL brs ht htL InCh inch_ht brsP_of brsH_of)
open Found.Pnp137 (WF wf_ind)
theorem len_child (a b c d n : Nat) (hc : c <= d) (h : a + (b + (d + 1)) <= n) : a + ((b + 1) + c) <= n :=
Nat.le_trans (Nat.le_trans (Nat.le_of_eq (congrArg (a + ·) (Nat.succ_add b c)))
(Nat.add_le_add_left (Nat.succ_le_succ (Nat.add_le_add_left hc b)) a)) h
theorem len_free (a b d n : Nat) (h : a + (b + (d + 1)) <= n) : a + b < n :=
Nat.lt_of_lt_of_le (Nat.succ_le_succ (Nat.add_le_add_left (Nat.le_add_right b d) a)) h
/-- A matching that places pigeon q.1 in hole q.2 is compatible with the pair (q.1, q.2). -/
theorem compat_q (Pg Hl : List Nat) (r : List (Nat × Nat)) (hr : Mt Pg Hl r) (q : Nat × Nat) (hq : q ∈ r)
(i j : Nat) (hi : q.1 = i) (hj : q.2 = j) : Compat r [(i, j)] := fun a ha x hx => by
cases mem_cons_cases hx with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
have c := hr.cons a ha q hq
exact And.intro (fun e => (c.1 (e.trans hi.symm)).trans hj) (fun e => (c.2 (e.trans hj.symm)).trans hi)
theorem compat_cons_r (r : List (Nat × Nat)) (a : Nat × Nat) (p : List (Nat × Nat)) (h1 : Compat r [a])
(h2 : Compat r p) : Compat r (a :: p) := fun x hx y hy => by
cases mem_cons_cases hy with
| inl e => rw [e]; exact h1 x hx a (List.Mem.head [])
| inr h3 => exact h2 x hx y h3
theorem br_comp (Pg Hl : List Nat) (dP : Dist Pg) (dH : Dist Hl) (hsz : Hl.length <= Pg.length) :
forall (t : MT) (p : List (Nat × Nat)), WF Pg Hl p t ->
forall r, Mt Pg Hl r -> Compat r p -> r.length + (p.length + ht t) <= Hl.length ->
Exists fun x => x ∈ brs t /\ Compat x.1 r := by
refine wf_ind Pg Hl (fun p t => forall r, Mt Pg Hl r -> Compat r p -> r.length + (p.length + ht t) <= Hl.length ->
Exists fun x => x ∈ brs t /\ Compat x.1 r) ?_ ?_ ?_
· intro p b r _ _ _
exact Exists.intro ([], b) (And.intro (List.Mem.head []) (fun _ hx _ _ => nomatch hx))
· intro p i ch h ih r hr hc hl
have finish : forall j t0, InCh j t0 ch -> Compat r [(i, j)] ->
Exists fun x => x ∈ brs (MT.qp i ch) /\ Compat x.1 r := by
intro j t0 hin cj
cases ih j t0 hin r hr (compat_cons_r r (i, j) p cj hc)
(len_child _ _ _ _ _ (inch_ht j t0 ch hin) hl) with
| intro x0 hx0 =>
exact Exists.intro ((i, j) :: x0.1, x0.2) (And.intro (brsP_of i j t0 x0 hx0.1 ch hin)
(compat_app [(i, j)] x0.1 r (compat_symm _ _ cj) hx0.2))
cases e : anyL (fun q : Nat × Nat => Nat.beq q.1 i) r with
| true =>
cases anyL_ex _ r e with
| intro q hq =>
have qi : q.1 = i := beq_eq _ _ hq.2
have hj0 := (hr.rng q hq.1).2
have un : forall z, z ∈ p -> Not (z.2 = q.2) := fun z hz ez =>
h.2.1 z hz ((((hc q hq.1 z hz).2 ez.symm)).symm.trans qi)
cases h.2.2.2 q.2 hj0 un with
| intro t0 ht0 => exact finish q.2 t0 ht0 (compat_q Pg Hl r hr q hq.1 i q.2 qi rfl)
| false =>
have ni := none_of_anyL Prod.fst i r e
have ll : (mapL Prod.snd r ++ mapL Prod.snd p).length < Hl.length := by
rw [len_app, len_mapL, len_mapL]; exact len_free _ _ _ _ hl
cases free_hole Hl _ dH ll with
| intro j hj =>
have un : forall z, z ∈ p -> Not (z.2 = j) := fun z hz ez =>
hj.2 (mem_app_r _ _ _ (ez ▸ mem_mapL Prod.snd z p hz))
cases h.2.2.2 j hj.1 un with
| intro t0 ht0 =>
refine finish j t0 ht0 (fun a ha x hx => ?_)
cases mem_cons_cases hx with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
refine And.intro (fun c => absurd c (ni a ha)) (fun c => ?_)
have t := mem_mapL Prod.snd a r ha
rw [c] at t
exact False.elim (hj.2 (mem_app_l _ _ _ t))
· intro p j ch h ih r hr hc hl
have finish : forall i t0, InCh i t0 ch -> Compat r [(i, j)] ->
Exists fun x => x ∈ brs (MT.qh j ch) /\ Compat x.1 r := by
intro i t0 hin ci
cases ih i t0 hin r hr (compat_cons_r r (i, j) p ci hc)
(len_child _ _ _ _ _ (inch_ht i t0 ch hin) hl) with
| intro x0 hx0 =>
exact Exists.intro ((i, j) :: x0.1, x0.2) (And.intro (brsH_of i j t0 x0 hx0.1 ch hin)
(compat_app [(i, j)] x0.1 r (compat_symm _ _ ci) hx0.2))
cases e : anyL (fun q : Nat × Nat => Nat.beq q.2 j) r with
| true =>
cases anyL_ex _ r e with
| intro q hq =>
have qj : q.2 = j := beq_eq _ _ hq.2
have hi0 := (hr.rng q hq.1).1
have un : forall z, z ∈ p -> Not (z.1 = q.1) := fun z hz ez =>
h.2.1 z hz ((((hc q hq.1 z hz).1 ez.symm)).symm.trans qj)
cases h.2.2.2 q.1 hi0 un with
| intro t0 ht0 => exact finish q.1 t0 ht0 (compat_q Pg Hl r hr q hq.1 q.1 j rfl qj)
| false =>
have nj := none_of_anyL Prod.snd j r e
have ll : (mapL Prod.fst r ++ mapL Prod.fst p).length < Pg.length := by
rw [len_app, len_mapL, len_mapL]; exact Nat.lt_of_lt_of_le (len_free _ _ _ _ hl) hsz
cases free_hole Pg _ dP ll with
| intro i hi =>
have un : forall z, z ∈ p -> Not (z.1 = i) := fun z hz ez =>
hi.2 (mem_app_r _ _ _ (ez ▸ mem_mapL Prod.fst z p hz))
cases h.2.2.2 i hi.1 un with
| intro t0 ht0 =>
refine finish i t0 ht0 (fun a ha x hx => ?_)
cases mem_cons_cases hx with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
refine And.intro (fun c => ?_) (fun c => absurd c (nj a ha))
have t := mem_mapL Prod.fst a r ha
rw [c] at t
exact False.elim (hi.2 (mem_app_l _ _ _ t))
/-- At the root: a matching r with |r| + height t <= |Hl| follows some branch. -/
theorem tree_comp (Pg Hl : List Nat) (dP : Dist Pg) (dH : Dist Hl) (hsz : Hl.length <= Pg.length)
(t : MT) (ht0 : WF Pg Hl [] t) (r : List (Nat × Nat)) (hr : Mt Pg Hl r) (hl : r.length + ht t <= Hl.length) :
Exists fun x => x ∈ brs t /\ Compat x.1 r :=
br_comp Pg Hl dP dH hsz t [] ht0 r hr (fun _ _ _ hy => nomatch hy)
(Nat.le_trans (Nat.le_of_eq (congrArg (r.length + ·) (Nat.zero_add (ht t)))) hl)
end Found.Pnp138
#print axioms Found.Pnp138.len_child
#print axioms Found.Pnp138.len_free
#print axioms Found.Pnp138.compat_q
#print axioms Found.Pnp138.compat_cons_r
#print axioms Found.Pnp138.br_comp
#print axioms Found.Pnp138.tree_comp
lean_all/found/Pnp139.lean
/-
T330 piece 139. found/Pnp139 -- restricting a matching decision tree by a matching (proof
complexity ladder, step 3: bounded-depth Frege).
restr r t answers the queries of t that the matching r answers: a pigeon query i with
(i, j) in r goes to the child labelled j (restrSel), otherwise it stays and keeps only the
children whose hole is not used by r (restrLP); hole queries symmetrically. Proved:
* optCase, bsel: the case splits used, with their equations;
* lookP_some, lookP_none, lookH_some, lookH_none: what the lookups say about r;
* sel_eq: under distinct labels, restrSel finds the restriction of the child with that label;
* inch_restrLP, inch_restrLH, restrLP_inch, restrLH_inch: the kept children;
* ht_restr: restriction does not raise the height.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp138
namespace Found.Pnp139
open Found.Pnp115 (anyL mem_cons_cases beq_eq beq_self)
open Found.Pnp116 (anyL_ex)
open Found.Pnp122 (anyL_false_all)
open Found.Pnp133 (ne_of_beq_false)
open Found.Pnp136 (MT MTL brs ht htL InCh mx mx_l mx_r mx_lub inch_ht)
def optCase (o : Option Nat) (f : Nat -> MT) (d : MT) : MT := match o with
| some j => f j
| none => d
def bsel {α : Type} (b : Bool) (x y : α) : α := match b with
| true => x
| false => y
theorem bsel_true {α : Type} (x y : α) : bsel true x y = x := rfl
theorem bsel_false {α : Type} (x y : α) : bsel false x y = y := rfl
def lookP (i : Nat) : List (Nat × Nat) -> Option Nat
| [] => none
| x :: r => match Nat.beq x.1 i with
| true => some x.2
| false => lookP i r
def lookH (j : Nat) : List (Nat × Nat) -> Option Nat
| [] => none
| x :: r => match Nat.beq x.2 j with
| true => some x.1
| false => lookH j r
def usedP (r : List (Nat × Nat)) (i : Nat) : Bool := anyL (fun x : Nat × Nat => Nat.beq x.1 i) r
def usedH (r : List (Nat × Nat)) (j : Nat) : Bool := anyL (fun x : Nat × Nat => Nat.beq x.2 j) r
mutual
def restr (r : List (Nat × Nat)) : MT -> MT
| .leaf b => .leaf b
| .qp i ch => optCase (lookP i r) (fun j => restrSel r j ch) (.qp i (restrLP r ch))
| .qh j ch => optCase (lookH j r) (fun i => restrSel r i ch) (.qh j (restrLH r ch))
def restrSel (r : List (Nat × Nat)) (a : Nat) : MTL -> MT
| .nil => .leaf false
| .cons b t rest => bsel (Nat.beq b a) (restr r t) (restrSel r a rest)
def restrLP (r : List (Nat × Nat)) : MTL -> MTL
| .nil => .nil
| .cons j t rest => bsel (usedH r j) (restrLP r rest) (.cons j (restr r t) (restrLP r rest))
def restrLH (r : List (Nat × Nat)) : MTL -> MTL
| .nil => .nil
| .cons i t rest => bsel (usedP r i) (restrLH r rest) (.cons i (restr r t) (restrLH r rest))
end
theorem lookP_some (i : Nat) : forall (r : List (Nat × Nat)) (j : Nat), lookP i r = some j -> (i, j) ∈ r
| [], j, h => nomatch h
| x :: r, j, h => by
cases e : Nat.beq x.1 i with
| true =>
have h' : (match Nat.beq x.1 i with | true => some x.2 | false => lookP i r) = some j := h
rw [e] at h'
have hx : x.2 = j := Option.some.inj h'
have ea : x.1 = i := beq_eq _ _ e
have ex : (x.1, x.2) = (i, j) := by rw [ea, hx]
rw [<- ex]
exact List.Mem.head r
| false =>
have h' : (match Nat.beq x.1 i with | true => some x.2 | false => lookP i r) = some j := h
rw [e] at h'
exact List.Mem.tail x (lookP_some i r j h')
theorem lookP_none (i : Nat) : forall (r : List (Nat × Nat)), lookP i r = none -> forall x, x ∈ r -> Not (x.1 = i)
| [], _, _, hx => nomatch hx
| y :: r, h, x, hx => by
cases e : Nat.beq y.1 i with
| true =>
have h' : (match Nat.beq y.1 i with | true => some y.2 | false => lookP i r) = none := h
rw [e] at h'
exact nomatch h'
| false =>
have h' : (match Nat.beq y.1 i with | true => some y.2 | false => lookP i r) = none := h
rw [e] at h'
cases mem_cons_cases hx with
| inl q => rw [q]; exact ne_of_beq_false _ _ e
| inr h2 => exact lookP_none i r h' x h2
theorem lookH_some (j : Nat) : forall (r : List (Nat × Nat)) (i : Nat), lookH j r = some i -> (i, j) ∈ r
| [], i, h => nomatch h
| x :: r, i, h => by
cases e : Nat.beq x.2 j with
| true =>
have h' : (match Nat.beq x.2 j with | true => some x.1 | false => lookH j r) = some i := h
rw [e] at h'
have hx : x.1 = i := Option.some.inj h'
have eb : x.2 = j := beq_eq _ _ e
have ex : (x.1, x.2) = (i, j) := by rw [hx, eb]
rw [<- ex]
exact List.Mem.head r
| false =>
have h' : (match Nat.beq x.2 j with | true => some x.1 | false => lookH j r) = some i := h
rw [e] at h'
exact List.Mem.tail x (lookH_some j r i h')
theorem lookH_none (j : Nat) : forall (r : List (Nat × Nat)), lookH j r = none -> forall x, x ∈ r -> Not (x.2 = j)
| [], _, _, hx => nomatch hx
| y :: r, h, x, hx => by
cases e : Nat.beq y.2 j with
| true =>
have h' : (match Nat.beq y.2 j with | true => some y.1 | false => lookH j r) = none := h
rw [e] at h'
exact nomatch h'
| false =>
have h' : (match Nat.beq y.2 j with | true => some y.1 | false => lookH j r) = none := h
rw [e] at h'
cases mem_cons_cases hx with
| inl q => rw [q]; exact ne_of_beq_false _ _ e
| inr h2 => exact lookH_none j r h' x h2
/-- With distinct labels (no later child with the same label), restrSel finds the child. -/
def Uniq : MTL -> Prop
| .nil => True
| .cons a _ rest => (forall t', Not (InCh a t' rest)) /\ Uniq rest
theorem sel_eq (r : List (Nat × Nat)) (a : Nat) (t : MT) : forall ch : MTL, Uniq ch -> InCh a t ch ->
restrSel r a ch = restr r t
| .nil, _, h => False.elim h
| .cons b u rest, hu, h => by
show bsel (Nat.beq b a) (restr r u) (restrSel r a rest) = restr r t
cases h with
| inl e =>
rw [<- e.1, beq_self, e.2]
try rfl
| inr h2 =>
cases eb : Nat.beq b a with
| true =>
have q : b = a := beq_eq _ _ eb
rw [q] at hu
exact absurd h2 (hu.1 t)
| false => exact sel_eq r a t rest hu.2 h2
theorem inch_restrLP (r : List (Nat × Nat)) (j : Nat) (t : MT) (hj : usedH r j = false) :
forall ch : MTL, InCh j t ch -> InCh j (restr r t) (restrLP r ch)
| .nil, h => False.elim h
| .cons b u rest, h => by
show InCh j (restr r t) (bsel (usedH r b) (restrLP r rest) (.cons b (restr r u) (restrLP r rest)))
cases h with
| inl e =>
rw [<- e.1, hj, <- e.2]
exact Or.inl (And.intro rfl rfl)
| inr h2 =>
cases eb : usedH r b with
| true => exact inch_restrLP r j t hj rest h2
| false => exact Or.inr (inch_restrLP r j t hj rest h2)
theorem inch_restrLH (r : List (Nat × Nat)) (i : Nat) (t : MT) (hi : usedP r i = false) :
forall ch : MTL, InCh i t ch -> InCh i (restr r t) (restrLH r ch)
| .nil, h => False.elim h
| .cons b u rest, h => by
show InCh i (restr r t) (bsel (usedP r b) (restrLH r rest) (.cons b (restr r u) (restrLH r rest)))
cases h with
| inl e =>
rw [<- e.1, hi, <- e.2]
exact Or.inl (And.intro rfl rfl)
| inr h2 =>
cases eb : usedP r b with
| true => exact inch_restrLH r i t hi rest h2
| false => exact Or.inr (inch_restrLH r i t hi rest h2)
theorem restrLP_inch (r : List (Nat × Nat)) (j : Nat) (t' : MT) : forall ch : MTL, InCh j t' (restrLP r ch) ->
Exists fun t => InCh j t ch /\ usedH r j = false /\ t' = restr r t
| .nil, h => False.elim h
| .cons b u rest, h => by
have h' : InCh j t' (bsel (usedH r b) (restrLP r rest) (.cons b (restr r u) (restrLP r rest))) := h
cases eb : usedH r b with
| true =>
rw [eb] at h'
cases restrLP_inch r j t' rest h' with
| intro t ht => exact Exists.intro t (And.intro (Or.inr ht.1) ht.2)
| false =>
rw [eb] at h'
cases h' with
| inl e =>
rw [e.1]
exact Exists.intro u (And.intro (Or.inl (And.intro rfl rfl)) (And.intro eb e.2))
| inr h2 =>
cases restrLP_inch r j t' rest h2 with
| intro t ht => exact Exists.intro t (And.intro (Or.inr ht.1) ht.2)
theorem restrLH_inch (r : List (Nat × Nat)) (i : Nat) (t' : MT) : forall ch : MTL, InCh i t' (restrLH r ch) ->
Exists fun t => InCh i t ch /\ usedP r i = false /\ t' = restr r t
| .nil, h => False.elim h
| .cons b u rest, h => by
have h' : InCh i t' (bsel (usedP r b) (restrLH r rest) (.cons b (restr r u) (restrLH r rest))) := h
cases eb : usedP r b with
| true =>
rw [eb] at h'
cases restrLH_inch r i t' rest h' with
| intro t ht => exact Exists.intro t (And.intro (Or.inr ht.1) ht.2)
| false =>
rw [eb] at h'
cases h' with
| inl e =>
rw [e.1]
exact Exists.intro u (And.intro (Or.inl (And.intro rfl rfl)) (And.intro eb e.2))
| inr h2 =>
cases restrLH_inch r i t' rest h2 with
| intro t ht => exact Exists.intro t (And.intro (Or.inr ht.1) ht.2)
mutual
theorem ht_restr (r : List (Nat × Nat)) : forall t : MT, ht (restr r t) <= ht t
| .leaf _ => Nat.le_refl 0
| .qp i ch => by
show ht (optCase (lookP i r) (fun j => restrSel r j ch) (.qp i (restrLP r ch))) <= htL ch + 1
cases lookP i r with
| some j => exact Nat.le_trans (ht_sel r j ch) (Nat.le_succ _)
| none => exact Nat.succ_le_succ (ht_LP r ch)
| .qh j ch => by
show ht (optCase (lookH j r) (fun i => restrSel r i ch) (.qh j (restrLH r ch))) <= htL ch + 1
cases lookH j r with
| some i => exact Nat.le_trans (ht_sel r i ch) (Nat.le_succ _)
| none => exact Nat.succ_le_succ (ht_LH r ch)
theorem ht_sel (r : List (Nat × Nat)) (a : Nat) : forall ch : MTL, ht (restrSel r a ch) <= htL ch
| .nil => Nat.le_refl 0
| .cons b t rest => by
show ht (bsel (Nat.beq b a) (restr r t) (restrSel r a rest)) <= mx (ht t) (htL rest)
cases Nat.beq b a with
| true => exact Nat.le_trans (ht_restr r t) (mx_l _ _)
| false => exact Nat.le_trans (ht_sel r a rest) (mx_r _ _)
theorem ht_LP (r : List (Nat × Nat)) : forall ch : MTL, htL (restrLP r ch) <= htL ch
| .nil => Nat.le_refl 0
| .cons j t rest => by
show htL (bsel (usedH r j) (restrLP r rest) (.cons j (restr r t) (restrLP r rest))) <= mx (ht t) (htL rest)
cases usedH r j with
| true => exact Nat.le_trans (ht_LP r rest) (mx_r _ _)
| false =>
exact mx_lub _ _ _ (Nat.le_trans (ht_restr r t) (mx_l _ _)) (Nat.le_trans (ht_LP r rest) (mx_r _ _))
theorem ht_LH (r : List (Nat × Nat)) : forall ch : MTL, htL (restrLH r ch) <= htL ch
| .nil => Nat.le_refl 0
| .cons i t rest => by
show htL (bsel (usedP r i) (restrLH r rest) (.cons i (restr r t) (restrLH r rest))) <= mx (ht t) (htL rest)
cases usedP r i with
| true => exact Nat.le_trans (ht_LH r rest) (mx_r _ _)
| false =>
exact mx_lub _ _ _ (Nat.le_trans (ht_restr r t) (mx_l _ _)) (Nat.le_trans (ht_LH r rest) (mx_r _ _))
end
end Found.Pnp139
#print axioms Found.Pnp139.bsel_true
#print axioms Found.Pnp139.bsel_false
#print axioms Found.Pnp139.lookP_some
#print axioms Found.Pnp139.lookP_none
#print axioms Found.Pnp139.lookH_some
#print axioms Found.Pnp139.lookH_none
#print axioms Found.Pnp139.sel_eq
#print axioms Found.Pnp139.inch_restrLP
#print axioms Found.Pnp139.inch_restrLH
#print axioms Found.Pnp139.restrLP_inch
#print axioms Found.Pnp139.restrLH_inch
#print axioms Found.Pnp139.ht_restr
lean_all/found/Pnp14.lean
/-
T330 piece 14. found/Pnp14 -- Cook-Levin for Turing machines.
A one-tape Turing machine (Pnp12) started with its head at cell p0 + 1 in state q0
(m bits). Unit clauses pin the time-0 layer to a Turing layout: on every cell j < W the
head bit is [j = p0 + 1] and the state bits are those of q0 at the head; the input
cells' symbols are pinned to the input; the other symbols are the certificate. With the
tableau CNF of the local rule (Pnp9-Pnp11), proved: the CNF is satisfiable iff some
tape (agreeing with the input, false at W) makes the machine hold true at tape cell 0
after T steps -- for a machine whose head stays inside the width before T on every tape.
Size: the tableau part has T W (m+2) 2^(3(m+2)) + (T+1)(m+2) clauses (Pnp9.tab_count);
the acceptance and pin clauses add 1 + W (m+1) + (input length) by construction.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp13
namespace Found.Pnp14
open Found.Pnp7 (nthd)
open Found.Pnp9 (lt_succ_cases)
open Found.Pnp10 (Conf runW)
open Found.Pnp11 (PinsOK full cook_levin_local)
open Found.Pnp12
open Found.Pnp13
/-! ## Pins of a Turing layout -/
def cellPins (pos0 : Nat) (q0 : List Bool) (j : Nat) : Nat -> List (Nat × (Nat × Bool))
| 0 => [(j, (1, Nat.beq j pos0))]
| i + 1 => cellPins pos0 q0 j i ++ [(j, (i + 2, Nat.beq j pos0 && nthd q0 i))]
def allPins (pos0 : Nat) (q0 : List Bool) (m : Nat) : Nat -> List (Nat × (Nat × Bool))
| 0 => []
| n + 1 => allPins pos0 q0 m n ++ cellPins pos0 q0 n m
def inPins : List (Nat × Bool) -> List (Nat × (Nat × Bool))
| [] => []
| (j, v) :: r => (j, (0, v)) :: inPins r
def InputOK (tape : Nat -> Bool) : List (Nat × Bool) -> Prop
| [] => True
| (j, v) :: r => tape j = v /\ InputOK tape r
theorem pins_app (c : Conf) (B : List (Nat × (Nat × Bool))) : forall A,
(PinsOK c (A ++ B) -> PinsOK c A /\ PinsOK c B) /\ (PinsOK c A /\ PinsOK c B -> PinsOK c (A ++ B)) := by
intro A
induction A with
| nil => exact And.intro (fun h => And.intro True.intro h) (fun h => h.2)
| cons e A ih =>
cases e with
| mk j bv =>
cases bv with
| mk b v =>
exact And.intro
(fun h => And.intro (And.intro h.1 (ih.1 h.2).1) (ih.1 h.2).2)
(fun h => And.intro h.1.1 (ih.2 (And.intro h.1.2 h.2)))
theorem cellPins_iff (c : Conf) (pos0 : Nat) (q0 : List Bool) (j : Nat) : forall n,
(PinsOK c (cellPins pos0 q0 j n) ->
c j 1 = Nat.beq j pos0 /\ forall i, i < n -> c j (i + 2) = (Nat.beq j pos0 && nthd q0 i)) /\
(c j 1 = Nat.beq j pos0 /\ (forall i, i < n -> c j (i + 2) = (Nat.beq j pos0 && nthd q0 i)) ->
PinsOK c (cellPins pos0 q0 j n)) := by
intro n
induction n with
| zero =>
exact And.intro (fun h => And.intro h.1 (fun i hi => False.elim (Nat.not_lt_zero i hi)))
(fun h => And.intro h.1 True.intro)
| succ n ih =>
apply And.intro
· intro h
have hs := (pins_app c _ _).1 h
have h1 := ih.1 hs.1
exact And.intro h1.1 (fun i hi => Or.elim (lt_succ_cases i n hi) (h1.2 i)
(fun e => by rw [e]; exact hs.2.1))
· intro h
exact (pins_app c _ _).2 (And.intro
(ih.2 (And.intro h.1 (fun i hi => h.2 i (Nat.lt_succ_of_lt hi))))
(And.intro (h.2 n (Nat.lt_succ_self n)) True.intro))
theorem allPins_iff (c : Conf) (pos0 : Nat) (q0 : List Bool) (m : Nat) : forall n,
(PinsOK c (allPins pos0 q0 m n) -> forall j, j < n -> PinsOK c (cellPins pos0 q0 j m)) /\
((forall j, j < n -> PinsOK c (cellPins pos0 q0 j m)) -> PinsOK c (allPins pos0 q0 m n)) := by
intro n
induction n with
| zero => exact And.intro (fun _ j hj => False.elim (Nat.not_lt_zero j hj)) (fun _ => True.intro)
| succ n ih =>
apply And.intro
· intro h j hj
have hs := (pins_app c _ _).1 h
exact Or.elim (lt_succ_cases j n hj) (fun hl => ih.1 hs.1 j hl) (fun e => by rw [e]; exact hs.2)
· intro h
exact (pins_app c _ _).2 (And.intro (ih.2 (fun j hj => h j (Nat.lt_succ_of_lt hj)))
(h n (Nat.lt_succ_self n)))
theorem inPins_iff (c : Conf) : forall inp,
(PinsOK c (inPins inp) -> InputOK (fun j => c j 0) inp) /\
(InputOK (fun j => c j 0) inp -> PinsOK c (inPins inp)) := by
intro inp
induction inp with
| nil => exact And.intro (fun _ => True.intro) (fun _ => True.intro)
| cons e r ih =>
cases e with
| mk j v =>
exact And.intro (fun h => And.intro h.1 (ih.1 h.2)) (fun h => And.intro h.1 (ih.2 h.2))
/-! ## Runs depend only on cells <= W and bits < k -/
theorem runW_ext (M : TM) (W : Nat) (x y : Conf)
(h : forall c, c < W + 1 -> forall b, b < M.m + 2 -> x c b = y c b) :
forall t, forall c, c < W + 1 -> forall b, b < M.m + 2 ->
runW (rule M) (M.m + 2) W t x c b = runW (rule M) (M.m + 2) W t y c b := by
intro t
induction t with
| zero => exact h
| succ t ih => intro c hc b _; exact stepW_ext M W _ _ ih c hc b
/-! ## Cook-Levin for Turing machines -/
def pinsTM (M : TM) (W p0 : Nat) (q0 : List Bool) (inp : List (Nat × Bool)) : List (Nat × (Nat × Bool)) :=
allPins (p0 + 1) q0 M.m W ++ inPins inp
theorem cook_levin_tm (M : TM) (W T p0 : Nat) (q0 : List Bool) (hq0 : q0.length = M.m)
(hnext : forall a s, (M.next a s).length = M.m) (hp : p0 + 2 < W) (inp : List (Nat × Bool))
(hin : forall tape : Nat -> Bool, Inside M W T (TC.mk tape (p0 + 1) q0)) :
((Exists fun s => Found.Pnp8.cnfv s (full (rule M) (M.m + 2) W T (pinsTM M W p0 q0 inp)) = true) ->
Exists fun tape : Nat -> Bool => InputOK tape inp /\ tape W = false /\
(tmRun M T (TC.mk tape (p0 + 1) q0)).tape 0 = true) /\
((Exists fun tape : Nat -> Bool => InputOK tape inp /\ tape W = false /\
(tmRun M T (TC.mk tape (p0 + 1) q0)).tape 0 = true) ->
Exists fun s => Found.Pnp8.cnfv s (full (rule M) (M.m + 2) W T (pinsTM M W p0 q0 inp)) = true) := by
have hk : 0 < M.m + 2 := lt0 M
have hW1 : p0 + 1 < W := Nat.lt_of_succ_lt hp
have hbW : Nat.beq W (p0 + 1) = false := beqW W p0 hW1
apply And.intro
· intro h
exact Exists.elim ((cook_levin_local (rule M) (M.m + 2) W T hk _).1 h) fun c0 hc => by
have hpins := (pins_app c0 _ _).1 hc.2.1
let c : TC := TC.mk (fun j => c0 j 0) (p0 + 1) q0
have agree : forall j, j < W + 1 -> forall b, b < M.m + 2 -> c0 j b = lay c j b := by
intro j hj b hb
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => by
have hcell := (cellPins_iff c0 (p0 + 1) q0 j M.m).1 ((allPins_iff c0 (p0 + 1) q0 M.m W).1 hpins.1 j hjW)
match b, hb with
| 0, _ => rfl
| 1, _ => exact hcell.1
| i + 2, hb' => exact hcell.2 i (Nat.lt_of_succ_lt_succ (Nat.lt_of_succ_lt_succ hb')))
(fun e => by
rw [e]
match b, hb with
| 0, _ => rfl
| 1, hb' => exact (hc.1 1 hb').trans hbW.symm
| i + 2, hb' =>
show c0 W (i + 2) = (Nat.beq W (p0 + 1) && nthd q0 i)
rw [hbW]; exact hc.1 (i + 2) hb')
have hrun := runW_ext M W c0 (lay c) agree T 0 (Nat.zero_lt_succ W) 0 hk
have hsim := simulate M W T c (hin _) (hc.1 0 hk) hq0 hnext T (Nat.lt_succ_self T) 0 (Nat.zero_lt_succ W) 0
exact Exists.intro (fun j => c0 j 0) (And.intro ((inPins_iff c0 inp).1 hpins.2)
(And.intro (hc.1 0 hk) ((hsim.symm.trans hrun.symm).trans hc.2.2)))
· intro h
exact Exists.elim h fun tape ht => by
let c : TC := TC.mk tape (p0 + 1) q0
apply (cook_levin_local (rule M) (M.m + 2) W T hk _).2
apply Exists.intro (lay c)
apply And.intro
· intro b hb
match b, hb with
| 0, _ => exact ht.2.1
| 1, _ => exact hbW
| i + 2, _ =>
show (Nat.beq W (p0 + 1) && nthd q0 i) = false
rw [hbW]; rfl
apply And.intro
· exact (pins_app (lay c) _ _).2 (And.intro
((allPins_iff (lay c) (p0 + 1) q0 M.m W).2 (fun j _ =>
(cellPins_iff (lay c) (p0 + 1) q0 j M.m).2 (And.intro rfl (fun i _ => rfl))))
((inPins_iff (lay c) inp).2 ht.1))
· exact (simulate M W T c (hin _) ht.2.1 hq0 hnext T (Nat.lt_succ_self T) 0
(Nat.zero_lt_succ W) 0).trans ht.2.2
end Found.Pnp14
#print axioms Found.Pnp14.pins_app
#print axioms Found.Pnp14.cellPins_iff
#print axioms Found.Pnp14.allPins_iff
#print axioms Found.Pnp14.inPins_iff
#print axioms Found.Pnp14.runW_ext
#print axioms Found.Pnp14.cook_levin_tm
lean_all/found/Pnp140.lean
/-
T330 piece 140. found/Pnp140 -- the restricted tree is well formed and its branches are the
branches compatible with the restriction, minus the restriction (proof complexity ladder,
step 3: bounded-depth Frege).
Let r be a matching over Pg x Hl whose free pigeons and holes are Pg' and Hl' (RFree), and t
well formed below a path q. If q lies in r together with a path p' over Pg' x Hl' contained
in q (Inv), then restr r t is well formed over Pg', Hl' below p', and
* BrBack: every branch y of restr r t comes from a branch x of t with the same label,
x inside r together with y, and y inside x;
* BrFwd: every branch x of t compatible with r gives a branch y of restr r t with the same
label and y inside x.
Proved: anyL_none, usedH_false, usedP_false, wfp_restr, wfh_restr, restr_ok.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp139
namespace Found.Pnp140
open Found.Pnp115 (anyL mem_cons_cases beq_eq)
open Found.Pnp122 (anyL_false_all)
open Found.Pnp133 (Cons Compat Mt ne_of_beq_false compat_mono)
open Found.Pnp135 (none_of_anyL)
open Found.Pnp136 (MT MTL brs brsP brsH InCh mem_brsP mem_brsH brsP_of brsH_of)
open Found.Pnp137 (WF WFP WFH wf_ind inch_uniqP inch_uniqH)
open Found.Pnp139 (restr restrSel restrLP restrLH optCase bsel lookP lookH usedP usedH Uniq sel_eq
lookP_some lookP_none lookH_some lookH_none inch_restrLP inch_restrLH restrLP_inch restrLH_inch)
theorem anyL_none {α : Type} (g : α -> Bool) : forall L : List α, (forall a, a ∈ L -> g a = false) -> anyL g L = false
| [], _ => rfl
| a :: L, h => by
show (g a || anyL g L) = false
rw [h a (List.Mem.head L), anyL_none g L (fun b hb => h b (List.Mem.tail a hb))]
try rfl
theorem beq_ne (a b : Nat) (h : Not (a = b)) : Nat.beq a b = false := by
cases e : Nat.beq a b with
| false => rfl
| true => exact absurd (beq_eq a b e) h
theorem usedH_false (r : List (Nat × Nat)) (j : Nat) (h : forall z, z ∈ r -> Not (z.2 = j)) : usedH r j = false :=
anyL_none _ r (fun z hz => beq_ne _ _ (h z hz))
theorem usedP_false (r : List (Nat × Nat)) (i : Nat) (h : forall z, z ∈ r -> Not (z.1 = i)) : usedP r i = false :=
anyL_none _ r (fun z hz => beq_ne _ _ (h z hz))
structure RFree (Pg Hl Pg' Hl' : List Nat) (r : List (Nat × Nat)) : Prop where
mt : Mt Pg Hl r
p1 : forall i, i ∈ Pg -> (forall z, z ∈ r -> Not (z.1 = i)) -> i ∈ Pg'
h1 : forall j, j ∈ Hl -> (forall z, z ∈ r -> Not (z.2 = j)) -> j ∈ Hl'
p2 : forall i, i ∈ Pg' -> i ∈ Pg /\ forall z, z ∈ r -> Not (z.1 = i)
h2 : forall j, j ∈ Hl' -> j ∈ Hl /\ forall z, z ∈ r -> Not (z.2 = j)
def Inv (Pg' Hl' : List Nat) (r q p' : List (Nat × Nat)) : Prop :=
(forall x, x ∈ q -> x ∈ r \/ x ∈ p') /\ (forall x, x ∈ p' -> x ∈ q) /\ (forall x, x ∈ p' -> x.1 ∈ Pg' /\ x.2 ∈ Hl')
def BrBack (r : List (Nat × Nat)) (t : MT) : Prop :=
forall y, y ∈ brs (restr r t) -> Exists fun x => x ∈ brs t /\ x.2 = y.2 /\
(forall z, z ∈ x.1 -> z ∈ r \/ z ∈ y.1) /\ (forall z, z ∈ y.1 -> z ∈ x.1)
def BrFwd (r : List (Nat × Nat)) (t : MT) : Prop :=
forall x, x ∈ brs t -> Compat x.1 r -> Exists fun y => y ∈ brs (restr r t) /\ y.2 = x.2 /\ (forall z, z ∈ y.1 -> z ∈ x.1)
theorem uniq_of_wfp (Pg Hl : List Nat) (q : List (Nat × Nat)) (i : Nat) : forall ch : MTL, WFP Pg Hl q i ch -> Uniq ch
| .nil, _ => True.intro
| .cons _ _ rest, h => And.intro h.2.2.1 (uniq_of_wfp Pg Hl q i rest h.2.2.2.2)
theorem uniq_of_wfh (Pg Hl : List Nat) (q : List (Nat × Nat)) (j : Nat) : forall ch : MTL, WFH Pg Hl q j ch -> Uniq ch
| .nil, _ => True.intro
| .cons _ _ rest, h => And.intro h.2.2.1 (uniq_of_wfh Pg Hl q j rest h.2.2.2.2)
section
variable {Pg Hl Pg' Hl' : List Nat} {r : List (Nat × Nat)}
theorem wfp_restr (hF : RFree Pg Hl Pg' Hl' r) (i : Nat) (q p' : List (Nat × Nat)) (hpq : forall x, x ∈ p' -> x ∈ q) :
forall ch : MTL, WFP Pg Hl q i ch ->
(forall j t, InCh j t ch -> usedH r j = false -> WF Pg' Hl' ((i, j) :: p') (restr r t)) ->
WFP Pg' Hl' p' i (restrLP r ch)
| .nil, _, _ => True.intro
| .cons j t rest, h, ih => by
show WFP Pg' Hl' p' i (bsel (usedH r j) (restrLP r rest) (.cons j (restr r t) (restrLP r rest)))
have ihr : forall j' t', InCh j' t' rest -> usedH r j' = false -> WF Pg' Hl' ((i, j') :: p') (restr r t') :=
fun j' t' hin hu => ih j' t' (Or.inr hin) hu
cases e : usedH r j with
| true => exact wfp_restr hF i q p' hpq rest h.2.2.2.2 ihr
| false =>
refine And.intro (hF.h1 j h.1 (none_of_anyL Prod.snd j r e)) (And.intro (fun x hx => h.2.1 x (hpq x hx))
(And.intro (fun t' hin => ?_) (And.intro (ih j t (Or.inl (And.intro rfl rfl)) e)
(wfp_restr hF i q p' hpq rest h.2.2.2.2 ihr))))
cases restrLP_inch r j t' rest hin with
| intro u hu => exact h.2.2.1 u hu.1
theorem wfh_restr (hF : RFree Pg Hl Pg' Hl' r) (j : Nat) (q p' : List (Nat × Nat)) (hpq : forall x, x ∈ p' -> x ∈ q) :
forall ch : MTL, WFH Pg Hl q j ch ->
(forall i t, InCh i t ch -> usedP r i = false -> WF Pg' Hl' ((i, j) :: p') (restr r t)) ->
WFH Pg' Hl' p' j (restrLH r ch)
| .nil, _, _ => True.intro
| .cons i t rest, h, ih => by
show WFH Pg' Hl' p' j (bsel (usedP r i) (restrLH r rest) (.cons i (restr r t) (restrLH r rest)))
have ihr : forall i' t', InCh i' t' rest -> usedP r i' = false -> WF Pg' Hl' ((i', j) :: p') (restr r t') :=
fun i' t' hin hu => ih i' t' (Or.inr hin) hu
cases e : usedP r i with
| true => exact wfh_restr hF j q p' hpq rest h.2.2.2.2 ihr
| false =>
refine And.intro (hF.p1 i h.1 (none_of_anyL Prod.fst i r e)) (And.intro (fun x hx => h.2.1 x (hpq x hx))
(And.intro (fun t' hin => ?_) (And.intro (ih i t (Or.inl (And.intro rfl rfl)) e)
(wfh_restr hF j q p' hpq rest h.2.2.2.2 ihr))))
cases restrLH_inch r i t' rest hin with
| intro u hu => exact h.2.2.1 u hu.1
theorem inv_cons (q p' : List (Nat × Nat)) (hI : Inv Pg' Hl' r q p') (a : Nat × Nat) (ha : a.1 ∈ Pg' /\ a.2 ∈ Hl') :
Inv Pg' Hl' r (a :: q) (a :: p') := by
refine And.intro (fun x hx => ?_) (And.intro (fun x hx => ?_) (fun x hx => ?_))
· cases mem_cons_cases hx with
| inl e => exact Or.inr (by rw [e]; exact List.Mem.head p')
| inr h2 =>
cases hI.1 x h2 with
| inl a1 => exact Or.inl a1
| inr b1 => exact Or.inr (List.Mem.tail a b1)
· cases mem_cons_cases hx with
| inl e => rw [e]; exact List.Mem.head q
| inr h2 => exact List.Mem.tail a (hI.2.1 x h2)
· cases mem_cons_cases hx with
| inl e => rw [e]; exact ha
| inr h2 => exact hI.2.2 x h2
theorem inv_r (q p' : List (Nat × Nat)) (hI : Inv Pg' Hl' r q p') (a : Nat × Nat) (ha : a ∈ r) :
Inv Pg' Hl' r (a :: q) p' := by
refine And.intro (fun x hx => ?_) (And.intro (fun x hx => List.Mem.tail a (hI.2.1 x hx)) hI.2.2)
cases mem_cons_cases hx with
| inl e => rw [e]; exact Or.inl ha
| inr h2 => exact hI.1 x h2
/-- The restriction theorem. -/
theorem restr_ok (hF : RFree Pg Hl Pg' Hl' r) : forall (t : MT) (q : List (Nat × Nat)), WF Pg Hl q t ->
forall p', Inv Pg' Hl' r q p' -> WF Pg' Hl' p' (restr r t) /\ BrBack r t /\ BrFwd r t := by
refine wf_ind Pg Hl (fun q t => forall p', Inv Pg' Hl' r q p' -> WF Pg' Hl' p' (restr r t) /\ BrBack r t /\ BrFwd r t)
?_ ?_ ?_
· intro q b p' _
refine And.intro True.intro (And.intro (fun y hy => ?_) (fun x hx _ => ?_))
· exact Exists.intro y (And.intro hy (And.intro rfl (And.intro (fun z hz => Or.inr hz) (fun z hz => hz))))
· exact Exists.intro x (And.intro hx (And.intro rfl (fun z hz => hz)))
· intro q i ch h ih p' hI
have unq : Uniq ch := uniq_of_wfp Pg Hl q i ch h.2.2.1
cases el : lookP i r with
| some j =>
have hij : (i, j) ∈ r := lookP_some i r j el
have hj : j ∈ Hl := (hF.mt.rng _ hij).2
have un : forall x, x ∈ q -> Not (x.2 = j) := fun x hx ex => by
cases hI.1 x hx with
| inl xr => exact h.2.1 x hx ((hF.mt.cons x xr (i, j) hij).2 ex)
| inr xp => exact (hF.h2 _ (hI.2.2 x xp).2).2 (i, j) hij ex.symm
cases h.2.2.2 j hj un with
| intro t0 ht0 =>
have se : restrSel r j ch = restr r t0 := sel_eq r j t0 ch unq ht0
have st : restr r (MT.qp i ch) = restr r t0 := by
show optCase (lookP i r) (fun j => restrSel r j ch) (MT.qp i (restrLP r ch)) = restr r t0
rw [el]; exact se
have c := ih j t0 ht0 p' (inv_r q p' hI (i, j) hij)
rw [st]
refine And.intro c.1 (And.intro (fun y hy => ?_) (fun x hx hc => ?_))
· cases c.2.1 y (by rw [st] at hy; exact hy) with
| intro x0 hx0 =>
refine Exists.intro ((i, j) :: x0.1, x0.2) (And.intro (brsP_of i j t0 x0 hx0.1 ch ht0)
(And.intro hx0.2.1 (And.intro (fun z hz => ?_) (fun z hz => List.Mem.tail _ (hx0.2.2.2 z hz)))))
cases mem_cons_cases hz with
| inl e => rw [e]; exact Or.inl hij
| inr h2 => exact hx0.2.2.1 z h2
· cases mem_brsP i x ch hx with
| intro j1 hj1 =>
cases hj1 with
| intro t1 ht1 =>
cases ht1.2 with
| intro x1 hx1 =>
rw [hx1.2] at hc
have cc := hc (i, j1) (List.Mem.head _) (i, j) hij
have jj : j1 = j := cc.1 rfl
rw [jj] at ht1
have tt : t1 = t0 := inch_uniqP Pg Hl q i j t1 t0 ch h.2.2.1 ht1.1 ht0
rw [tt] at hx1
cases c.2.2 x1 hx1.1 (compat_mono _ _ _ _ hc (fun z hz => List.Mem.tail _ hz) (fun z hz => hz)) with
| intro y hy =>
refine Exists.intro y (And.intro (by rw [st]; exact hy.1) (And.intro ?_ (fun z hz => ?_)))
· rw [hx1.2]; exact hy.2.1
· rw [hx1.2]; exact List.Mem.tail _ (hy.2.2 z hz)
| none =>
have nr := lookP_none i r el
have iP : i ∈ Pg' := hF.p1 i h.1 nr
have st : restr r (MT.qp i ch) = MT.qp i (restrLP r ch) := by
show optCase (lookP i r) (fun j => restrSel r j ch) (MT.qp i (restrLP r ch)) = MT.qp i (restrLP r ch)
rw [el]; rfl
have ihc : forall j t, InCh j t ch -> usedH r j = false ->
WF Pg' Hl' ((i, j) :: p') (restr r t) /\ BrBack r t /\ BrFwd r t := fun j t hin hu => by
have jH := (Found.Pnp137.wfp_child Pg Hl q i j t ch h.2.2.1 hin).1
exact ih j t hin ((i, j) :: p') (inv_cons q p' hI (i, j) (And.intro iP
(hF.h1 j jH (none_of_anyL Prod.snd j r hu))))
rw [st]
refine And.intro ?_ (And.intro (fun y hy => ?_) (fun x hx hc => ?_))
· refine And.intro iP (And.intro (fun x hx => h.2.1 x (hI.2.1 x hx))
(And.intro (wfp_restr hF i q p' hI.2.1 ch h.2.2.1 (fun j t hin hu => (ihc j t hin hu).1)) (fun j hj hu => ?_)))
have jH := hF.h2 j hj
have unq2 : forall x, x ∈ q -> Not (x.2 = j) := fun x hx ex => by
cases hI.1 x hx with
| inl xr => exact jH.2 x xr ex
| inr xp => exact hu x xp ex
cases h.2.2.2 j jH.1 unq2 with
| intro t ht => exact Exists.intro (restr r t) (inch_restrLP r j t (usedH_false r j jH.2) ch ht)
· cases mem_brsP i y (restrLP r ch) (by rw [st] at hy; exact hy) with
| intro j hj =>
cases hj with
| intro t' ht' =>
cases ht'.2 with
| intro y0 hy0 =>
cases restrLP_inch r j t' ch ht'.1 with
| intro t ht =>
rw [ht.2.2] at hy0
cases (ihc j t ht.1 ht.2.1).2.1 y0 hy0.1 with
| intro x0 hx0 =>
refine Exists.intro ((i, j) :: x0.1, x0.2) (And.intro (brsP_of i j t x0 hx0.1 ch ht.1)
(And.intro ?_ (And.intro (fun z hz => ?_) (fun z hz => ?_))))
· rw [hy0.2]; exact hx0.2.1
· cases mem_cons_cases hz with
| inl e => rw [e, hy0.2]; exact Or.inr (List.Mem.head _)
| inr h2 =>
cases hx0.2.2.1 z h2 with
| inl a1 => exact Or.inl a1
| inr b1 => rw [hy0.2]; exact Or.inr (List.Mem.tail _ b1)
· rw [hy0.2] at hz
cases mem_cons_cases hz with
| inl e => rw [e]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail _ (hx0.2.2.2 z h2)
· cases mem_brsP i x ch hx with
| intro j hj =>
cases hj with
| intro t ht =>
cases ht.2 with
| intro x0 hx0 =>
rw [hx0.2] at hc
have hu : usedH r j = false := usedH_false r j (fun z hz ez =>
nr z hz (((hc (i, j) (List.Mem.head _) z hz).2 ez.symm).symm))
cases (ihc j t ht.1 hu).2.2 x0 hx0.1 (compat_mono _ _ _ _ hc (fun z hz => List.Mem.tail _ hz) (fun z hz => hz)) with
| intro y0 hy0 =>
refine Exists.intro ((i, j) :: y0.1, y0.2)
(And.intro (by rw [st]; exact brsP_of i j (restr r t) y0 hy0.1 (restrLP r ch) (inch_restrLP r j t hu ch ht.1))
(And.intro ?_ (fun z hz => ?_)))
· rw [hx0.2]; exact hy0.2.1
· rw [hx0.2]
cases mem_cons_cases hz with
| inl e => rw [e]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail _ (hy0.2.2 z h2)
· intro q j ch h ih p' hI
have unq : Uniq ch := uniq_of_wfh Pg Hl q j ch h.2.2.1
cases el : lookH j r with
| some i =>
have hij : (i, j) ∈ r := lookH_some j r i el
have hi : i ∈ Pg := (hF.mt.rng _ hij).1
have un : forall x, x ∈ q -> Not (x.1 = i) := fun x hx ex => by
cases hI.1 x hx with
| inl xr => exact h.2.1 x hx ((hF.mt.cons x xr (i, j) hij).1 ex)
| inr xp => exact (hF.p2 _ (hI.2.2 x xp).1).2 (i, j) hij ex.symm
cases h.2.2.2 i hi un with
| intro t0 ht0 =>
have se : restrSel r i ch = restr r t0 := sel_eq r i t0 ch unq ht0
have st : restr r (MT.qh j ch) = restr r t0 := by
show optCase (lookH j r) (fun i => restrSel r i ch) (MT.qh j (restrLH r ch)) = restr r t0
rw [el]; exact se
have c := ih i t0 ht0 p' (inv_r q p' hI (i, j) hij)
rw [st]
refine And.intro c.1 (And.intro (fun y hy => ?_) (fun x hx hc => ?_))
· cases c.2.1 y (by rw [st] at hy; exact hy) with
| intro x0 hx0 =>
refine Exists.intro ((i, j) :: x0.1, x0.2) (And.intro (brsH_of i j t0 x0 hx0.1 ch ht0)
(And.intro hx0.2.1 (And.intro (fun z hz => ?_) (fun z hz => List.Mem.tail _ (hx0.2.2.2 z hz)))))
cases mem_cons_cases hz with
| inl e => rw [e]; exact Or.inl hij
| inr h2 => exact hx0.2.2.1 z h2
· cases mem_brsH j x ch hx with
| intro i1 hi1 =>
cases hi1 with
| intro t1 ht1 =>
cases ht1.2 with
| intro x1 hx1 =>
rw [hx1.2] at hc
have cc := hc (i1, j) (List.Mem.head _) (i, j) hij
have ii : i1 = i := cc.2 rfl
rw [ii] at ht1
have tt : t1 = t0 := inch_uniqH Pg Hl q i j t1 t0 ch h.2.2.1 ht1.1 ht0
rw [tt] at hx1
cases c.2.2 x1 hx1.1 (compat_mono _ _ _ _ hc (fun z hz => List.Mem.tail _ hz) (fun z hz => hz)) with
| intro y hy =>
refine Exists.intro y (And.intro (by rw [st]; exact hy.1) (And.intro ?_ (fun z hz => ?_)))
· rw [hx1.2]; exact hy.2.1
· rw [hx1.2]; exact List.Mem.tail _ (hy.2.2 z hz)
| none =>
have nr := lookH_none j r el
have jH : j ∈ Hl' := hF.h1 j h.1 nr
have st : restr r (MT.qh j ch) = MT.qh j (restrLH r ch) := by
show optCase (lookH j r) (fun i => restrSel r i ch) (MT.qh j (restrLH r ch)) = MT.qh j (restrLH r ch)
rw [el]; rfl
have ihc : forall i t, InCh i t ch -> usedP r i = false ->
WF Pg' Hl' ((i, j) :: p') (restr r t) /\ BrBack r t /\ BrFwd r t := fun i t hin hu => by
have iP := (Found.Pnp137.wfh_child Pg Hl q i j t ch h.2.2.1 hin).1
exact ih i t hin ((i, j) :: p') (inv_cons q p' hI (i, j) (And.intro
(hF.p1 i iP (none_of_anyL Prod.fst i r hu)) jH))
rw [st]
refine And.intro ?_ (And.intro (fun y hy => ?_) (fun x hx hc => ?_))
· refine And.intro jH (And.intro (fun x hx => h.2.1 x (hI.2.1 x hx))
(And.intro (wfh_restr hF j q p' hI.2.1 ch h.2.2.1 (fun i t hin hu => (ihc i t hin hu).1)) (fun i hi hu => ?_)))
have iP := hF.p2 i hi
have unq2 : forall x, x ∈ q -> Not (x.1 = i) := fun x hx ex => by
cases hI.1 x hx with
| inl xr => exact iP.2 x xr ex
| inr xp => exact hu x xp ex
cases h.2.2.2 i iP.1 unq2 with
| intro t ht => exact Exists.intro (restr r t) (inch_restrLH r i t (usedP_false r i iP.2) ch ht)
· cases mem_brsH j y (restrLH r ch) (by rw [st] at hy; exact hy) with
| intro i hi =>
cases hi with
| intro t' ht' =>
cases ht'.2 with
| intro y0 hy0 =>
cases restrLH_inch r i t' ch ht'.1 with
| intro t ht =>
rw [ht.2.2] at hy0
cases (ihc i t ht.1 ht.2.1).2.1 y0 hy0.1 with
| intro x0 hx0 =>
refine Exists.intro ((i, j) :: x0.1, x0.2) (And.intro (brsH_of i j t x0 hx0.1 ch ht.1)
(And.intro ?_ (And.intro (fun z hz => ?_) (fun z hz => ?_))))
· rw [hy0.2]; exact hx0.2.1
· cases mem_cons_cases hz with
| inl e => rw [e, hy0.2]; exact Or.inr (List.Mem.head _)
| inr h2 =>
cases hx0.2.2.1 z h2 with
| inl a1 => exact Or.inl a1
| inr b1 => rw [hy0.2]; exact Or.inr (List.Mem.tail _ b1)
· rw [hy0.2] at hz
cases mem_cons_cases hz with
| inl e => rw [e]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail _ (hx0.2.2.2 z h2)
· cases mem_brsH j x ch hx with
| intro i hi =>
cases hi with
| intro t ht =>
cases ht.2 with
| intro x0 hx0 =>
rw [hx0.2] at hc
have hu : usedP r i = false := usedP_false r i (fun z hz ez =>
nr z hz (((hc (i, j) (List.Mem.head _) z hz).1 ez.symm).symm))
cases (ihc i t ht.1 hu).2.2 x0 hx0.1 (compat_mono _ _ _ _ hc (fun z hz => List.Mem.tail _ hz) (fun z hz => hz)) with
| intro y0 hy0 =>
refine Exists.intro ((i, j) :: y0.1, y0.2)
(And.intro (by rw [st]; exact brsH_of i j (restr r t) y0 hy0.1 (restrLH r ch) (inch_restrLH r i t hu ch ht.1))
(And.intro ?_ (fun z hz => ?_)))
· rw [hx0.2]; exact hy0.2.1
· rw [hx0.2]
cases mem_cons_cases hz with
| inl e => rw [e]; exact List.Mem.head _
| inr h2 => exact List.Mem.tail _ (hy0.2.2 z h2)
end
end Found.Pnp140
#print axioms Found.Pnp140.anyL_none
#print axioms Found.Pnp140.beq_ne
#print axioms Found.Pnp140.usedH_false
#print axioms Found.Pnp140.usedP_false
#print axioms Found.Pnp140.uniq_of_wfp
#print axioms Found.Pnp140.uniq_of_wfh
#print axioms Found.Pnp140.wfp_restr
#print axioms Found.Pnp140.wfh_restr
#print axioms Found.Pnp140.inv_cons
#print axioms Found.Pnp140.inv_r
#print axioms Found.Pnp140.restr_ok
lean_all/found/Pnp141.lean
/-
T330 piece 141. found/Pnp141 -- the canonical matching decision tree of a matching DNF
(proof complexity ladder, step 3: bounded-depth Frege).
A matching DNF is a list G of terms (matchings). ct G p processes the terms in order along
the path p: a term inconsistent with p is skipped; for the first consistent term tau the
vertices of tau (its pigeons and holes, vtx tau) not yet matched in p are queried one by one
(qv), each query branching over all free holes (frH) or free pigeons (frP); when all are
answered, the leaf is true if tau lies in the path, otherwise the next terms are processed;
with no terms left the leaf is false. Proved:
* filt, mem_filt, filt_mem, dist_filt: filtering a list;
* mkCh, inch_mkCh, mkCh_inch, wfp_mkCh, wfh_mkCh: child lists from a function;
* mem_vtx_p, mem_vtx_h: the vertices of a term;
* qv_wf, ct_wf: the canonical tree is well formed below every path.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp140
namespace Found.Pnp141
open Found.Pnp115 (anyL mem_cons_cases beq_eq)
open Found.Pnp116 (mem_app)
open Found.Pnp119 (cm mem_cm)
open Found.Pnp123 (Dist)
open Found.Pnp133 (Cons)
open Found.Pnp135 (none_of_anyL)
open Found.Pnp136 (MT MTL InCh)
open Found.Pnp137 (WF WFP WFH)
open Found.Pnp139 (bsel usedP usedH)
open Found.Pnp140 (usedH_false usedP_false)
def filt (p : Nat -> Bool) : List Nat -> List Nat
| [] => []
| a :: l => bsel (p a) (a :: filt p l) (filt p l)
theorem mem_filt (p : Nat -> Bool) (x : Nat) : forall l : List Nat, x ∈ filt p l -> x ∈ l /\ p x = true
| [], h => nomatch h
| a :: l, h => by
have h' : x ∈ bsel (p a) (a :: filt p l) (filt p l) := h
cases e : p a with
| true =>
rw [e] at h'
cases mem_cons_cases h' with
| inl q => rw [q]; exact And.intro (List.Mem.head l) e
| inr h2 =>
have r := mem_filt p x l h2
exact And.intro (List.Mem.tail a r.1) r.2
| false =>
rw [e] at h'
have r := mem_filt p x l h'
exact And.intro (List.Mem.tail a r.1) r.2
theorem filt_mem (p : Nat -> Bool) (x : Nat) (hx : p x = true) : forall l : List Nat, x ∈ l -> x ∈ filt p l
| [], h => nomatch h
| a :: l, h => by
show x ∈ bsel (p a) (a :: filt p l) (filt p l)
cases mem_cons_cases h with
| inl q =>
rw [<- q, hx]
exact List.Mem.head _
| inr h2 =>
cases p a with
| true => exact List.Mem.tail a (filt_mem p x hx l h2)
| false => exact filt_mem p x hx l h2
theorem dist_filt (p : Nat -> Bool) : forall l : List Nat, Dist l -> Dist (filt p l)
| [], _ => True.intro
| a :: l, h => by
show Found.Pnp115.Pw (fun a b => Not (a = b)) (bsel (p a) (a :: filt p l) (filt p l))
cases p a with
| true => exact And.intro (fun b hb => h.1 b (mem_filt p b l hb).1) (dist_filt p l h.2)
| false => exact dist_filt p l h.2
def mkCh (f : Nat -> MT) : List Nat -> MTL
| [] => .nil
| a :: l => .cons a (f a) (mkCh f l)
theorem inch_mkCh (f : Nat -> MT) (a : Nat) : forall l : List Nat, a ∈ l -> InCh a (f a) (mkCh f l)
| [], h => nomatch h
| b :: l, h => by
cases mem_cons_cases h with
| inl q => rw [q]; exact Or.inl (And.intro rfl rfl)
| inr h2 => exact Or.inr (inch_mkCh f a l h2)
theorem mkCh_inch (f : Nat -> MT) (a : Nat) (t : MT) : forall l : List Nat, InCh a t (mkCh f l) -> a ∈ l /\ t = f a
| [], h => False.elim h
| b :: l, h => by
cases h with
| inl e => rw [e.1]; exact And.intro (List.Mem.head l) e.2
| inr h2 =>
have r := mkCh_inch f a t l h2
exact And.intro (List.Mem.tail b r.1) r.2
theorem wfp_mkCh (Pg Hl : List Nat) (p : List (Nat × Nat)) (i : Nat) (f : Nat -> MT) : forall l : List Nat,
Dist l -> (forall j, j ∈ l -> j ∈ Hl /\ (forall q, q ∈ p -> Not (q.2 = j)) /\ WF Pg Hl ((i, j) :: p) (f j)) ->
WFP Pg Hl p i (mkCh f l)
| [], _, _ => True.intro
| a :: l, hd, h => by
have ha := h a (List.Mem.head l)
refine And.intro ha.1 (And.intro ha.2.1 (And.intro (fun t' hin => ?_) (And.intro ha.2.2
(wfp_mkCh Pg Hl p i f l hd.2 (fun j hj => h j (List.Mem.tail a hj))))))
exact hd.1 a (mkCh_inch f a t' l hin).1 rfl
theorem wfh_mkCh (Pg Hl : List Nat) (p : List (Nat × Nat)) (j : Nat) (f : Nat -> MT) : forall l : List Nat,
Dist l -> (forall i, i ∈ l -> i ∈ Pg /\ (forall q, q ∈ p -> Not (q.1 = i)) /\ WF Pg Hl ((i, j) :: p) (f i)) ->
WFH Pg Hl p j (mkCh f l)
| [], _, _ => True.intro
| a :: l, hd, h => by
have ha := h a (List.Mem.head l)
refine And.intro ha.1 (And.intro ha.2.1 (And.intro (fun t' hin => ?_) (And.intro ha.2.2
(wfh_mkCh Pg Hl p j f l hd.2 (fun i hi => h i (List.Mem.tail a hi))))))
exact hd.1 a (mkCh_inch f a t' l hin).1 rfl
/-! The canonical tree. -/
def vtx (tau : List (Nat × Nat)) : List (Bool × Nat) := cm (fun x : Nat × Nat => [(true, x.1), (false, x.2)]) tau
def frH (Hl : List Nat) (p : List (Nat × Nat)) : List Nat := filt (fun j => !(usedH p j)) Hl
def frP (Pg : List Nat) (p : List (Nat × Nat)) : List Nat := filt (fun i => !(usedP p i)) Pg
def allP {α : Type} (g : α -> Bool) : List α -> Bool
| [] => true
| a :: l => g a && allP g l
def eqP (a b : Nat × Nat) : Bool := Nat.beq a.1 b.1 && Nat.beq a.2 b.2
def memP (a : Nat × Nat) (p : List (Nat × Nat)) : Bool := anyL (eqP a) p
def subB (tau p : List (Nat × Nat)) : Bool := allP (fun a => memP a p) tau
def consPB (a b : Nat × Nat) : Bool := match Nat.beq a.1 b.1, Nat.beq a.2 b.2 with
| true, true => true
| false, false => true
| true, false => false
| false, true => false
def consB (p tau : List (Nat × Nat)) : Bool := allP (fun a => allP (fun b => consPB a b) p) tau
def qv (Pg Hl : List Nat) (k : List (Nat × Nat) -> MT) (tau : List (Nat × Nat)) :
List (Bool × Nat) -> List (Nat × Nat) -> MT
| [], p => bsel (subB tau p) (.leaf true) (k p)
| (true, i) :: vs, p => bsel (usedP p i) (qv Pg Hl k tau vs p)
(.qp i (mkCh (fun j => qv Pg Hl k tau vs ((i, j) :: p)) (frH Hl p)))
| (false, j) :: vs, p => bsel (usedH p j) (qv Pg Hl k tau vs p)
(.qh j (mkCh (fun i => qv Pg Hl k tau vs ((i, j) :: p)) (frP Pg p)))
def ct (Pg Hl : List Nat) : List (List (Nat × Nat)) -> List (Nat × Nat) -> MT
| [], _ => .leaf false
| tau :: G, p => bsel (consB p tau) (qv Pg Hl (fun p' => ct Pg Hl G p') tau (vtx tau) p) (ct Pg Hl G p)
theorem mem_vtx_p (tau : List (Nat × Nat)) (i : Nat) (h : (true, i) ∈ vtx tau) : Exists fun a => a ∈ tau /\ a.1 = i := by
cases mem_cm _ _ tau h with
| intro a ha =>
refine Exists.intro a (And.intro ha.1 ?_)
cases mem_cons_cases ha.2 with
| inl e => exact (congrArg Prod.snd e).symm
| inr h2 =>
cases mem_cons_cases h2 with
| inl e => exact Bool.noConfusion (congrArg Prod.fst e)
| inr h3 => exact nomatch h3
theorem mem_vtx_h (tau : List (Nat × Nat)) (j : Nat) (h : (false, j) ∈ vtx tau) : Exists fun a => a ∈ tau /\ a.2 = j := by
cases mem_cm _ _ tau h with
| intro a ha =>
refine Exists.intro a (And.intro ha.1 ?_)
cases mem_cons_cases ha.2 with
| inl e => exact Bool.noConfusion (congrArg Prod.fst e)
| inr h2 =>
cases mem_cons_cases h2 with
| inl e => exact (congrArg Prod.snd e).symm
| inr h3 => exact nomatch h3
theorem not_not_used (b : Bool) (h : (!b) = true) : b = false := by
cases b with
| true => exact Bool.noConfusion h
| false => rfl
/-- The query tree of a term is well formed below every path. -/
theorem qv_wf (Pg Hl : List Nat) (dP : Dist Pg) (dH : Dist Hl) (k : List (Nat × Nat) -> MT)
(hk : forall p', WF Pg Hl p' (k p')) (tau : List (Nat × Nat)) (ht : forall a, a ∈ tau -> a.1 ∈ Pg /\ a.2 ∈ Hl) :
forall vs : List (Bool × Nat), (forall v, v ∈ vs -> v ∈ vtx tau) -> forall p, WF Pg Hl p (qv Pg Hl k tau vs p)
| [], _, p => by
show WF Pg Hl p (bsel (subB tau p) (.leaf true) (k p))
cases subB tau p with
| true => exact True.intro
| false => exact hk p
| (true, i) :: vs, hv, p => by
show WF Pg Hl p (bsel (usedP p i) (qv Pg Hl k tau vs p)
(.qp i (mkCh (fun j => qv Pg Hl k tau vs ((i, j) :: p)) (frH Hl p))))
have hvs : forall v, v ∈ vs -> v ∈ vtx tau := fun v hv' => hv v (List.Mem.tail _ hv')
cases e : usedP p i with
| true => exact qv_wf Pg Hl dP dH k hk tau ht vs hvs p
| false =>
have iP : i ∈ Pg := by
cases mem_vtx_p tau i (hv _ (List.Mem.head _)) with
| intro a ha => rw [<- ha.2]; exact (ht a ha.1).1
refine And.intro iP (And.intro (none_of_anyL Prod.fst i p e) (And.intro ?_ ?_))
· refine wfp_mkCh Pg Hl p i _ (frH Hl p) (dist_filt _ Hl dH) (fun j hj => ?_)
have m := mem_filt _ j Hl hj
exact And.intro m.1 (And.intro (none_of_anyL Prod.snd j p (not_not_used _ m.2))
(qv_wf Pg Hl dP dH k hk tau ht vs hvs ((i, j) :: p)))
· intro j hj hu
exact Exists.intro _ (inch_mkCh _ j (frH Hl p) (filt_mem _ j
(by show (!(usedH p j)) = true; rw [usedH_false p j hu]; try rfl) Hl hj))
| (false, j) :: vs, hv, p => by
show WF Pg Hl p (bsel (usedH p j) (qv Pg Hl k tau vs p)
(.qh j (mkCh (fun i => qv Pg Hl k tau vs ((i, j) :: p)) (frP Pg p))))
have hvs : forall v, v ∈ vs -> v ∈ vtx tau := fun v hv' => hv v (List.Mem.tail _ hv')
cases e : usedH p j with
| true => exact qv_wf Pg Hl dP dH k hk tau ht vs hvs p
| false =>
have jH : j ∈ Hl := by
cases mem_vtx_h tau j (hv _ (List.Mem.head _)) with
| intro a ha => rw [<- ha.2]; exact (ht a ha.1).2
refine And.intro jH (And.intro (none_of_anyL Prod.snd j p e) (And.intro ?_ ?_))
· refine wfh_mkCh Pg Hl p j _ (frP Pg p) (dist_filt _ Pg dP) (fun i hi => ?_)
have m := mem_filt _ i Pg hi
exact And.intro m.1 (And.intro (none_of_anyL Prod.fst i p (not_not_used _ m.2))
(qv_wf Pg Hl dP dH k hk tau ht vs hvs ((i, j) :: p)))
· intro i hi hu
exact Exists.intro _ (inch_mkCh _ i (frP Pg p) (filt_mem _ i
(by show (!(usedP p i)) = true; rw [usedP_false p i hu]; try rfl) Pg hi))
/-- The canonical tree is well formed below every path. -/
theorem ct_wf (Pg Hl : List Nat) (dP : Dist Pg) (dH : Dist Hl) : forall (G : List (List (Nat × Nat))),
(forall tau, tau ∈ G -> forall a, a ∈ tau -> a.1 ∈ Pg /\ a.2 ∈ Hl) -> forall p, WF Pg Hl p (ct Pg Hl G p)
| [], _, _ => True.intro
| tau :: G, hG, p => by
show WF Pg Hl p (bsel (consB p tau) (qv Pg Hl (fun p' => ct Pg Hl G p') tau (vtx tau) p) (ct Pg Hl G p))
have hG' : forall t, t ∈ G -> forall a, a ∈ t -> a.1 ∈ Pg /\ a.2 ∈ Hl := fun t ht => hG t (List.Mem.tail _ ht)
cases consB p tau with
| true =>
exact qv_wf Pg Hl dP dH _ (fun p' => ct_wf Pg Hl dP dH G hG' p') tau (hG tau (List.Mem.head G))
(vtx tau) (fun v hv => hv) p
| false => exact ct_wf Pg Hl dP dH G hG' p
end Found.Pnp141
#print axioms Found.Pnp141.mem_filt
#print axioms Found.Pnp141.filt_mem
#print axioms Found.Pnp141.dist_filt
#print axioms Found.Pnp141.inch_mkCh
#print axioms Found.Pnp141.mkCh_inch
#print axioms Found.Pnp141.wfp_mkCh
#print axioms Found.Pnp141.wfh_mkCh
#print axioms Found.Pnp141.mem_vtx_p
#print axioms Found.Pnp141.mem_vtx_h
#print axioms Found.Pnp141.not_not_used
#print axioms Found.Pnp141.qv_wf
#print axioms Found.Pnp141.ct_wf
lean_all/found/Pnp142.lean
/-
T330 piece 142. found/Pnp142 -- the branches of the canonical tree (proof complexity ladder,
step 3: bounded-depth Frege).
For the canonical tree ct G p of a matching DNF G:
* ct_true: a branch with leaf true, together with p, contains some term of G;
* ct_false: a branch with leaf false, together with p, contradicts every term of G
(each term has a pair inconsistent with some pair of the branch or of p);
* ct_E3, ct_E4: at the root, every true branch contains a term and every false branch is
incompatible with every term.
The query part qv ends on a path p' in which every vertex of the term is matched, so a term
not contained in p' has a pair inconsistent with p' (end_inc). Bool tests are read back by
memP_mem, subB_mem, subB_false, consPB_false, consB_false.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp141
namespace Found.Pnp142
open Found.Pnp115 (anyL mem_cons_cases beq_eq)
open Found.Pnp116 (anyL_ex)
open Found.Pnp122 (anyL_false_all)
open Found.Pnp133 (Cons Compat cons_symm ne_of_beq_false)
open Found.Pnp136 (MT brs mem_brsP mem_brsH)
open Found.Pnp139 (bsel usedP usedH)
open Found.Pnp141 (allP eqP memP subB consPB consB qv ct vtx mkCh mkCh_inch frH frP)
theorem and_l {a b : Bool} (h : (a && b) = true) : a = true := by cases a <;> cases b <;> first | rfl | exact Bool.noConfusion h
theorem and_r {a b : Bool} (h : (a && b) = true) : b = true := by cases a <;> cases b <;> first | rfl | exact Bool.noConfusion h
theorem allP_mem {α : Type} (g : α -> Bool) : forall l : List α, allP g l = true -> forall a, a ∈ l -> g a = true
| [], _, _, h => nomatch h
| b :: l, h, a, ha => by
have h' : (g b && allP g l) = true := h
cases mem_cons_cases ha with
| inl e => rw [e]; exact and_l h'
| inr h2 => exact allP_mem g l (and_r h') a h2
theorem allP_false {α : Type} (g : α -> Bool) : forall l : List α, allP g l = false -> Exists fun a => a ∈ l /\ g a = false
| [], h => Bool.noConfusion h
| b :: l, h => by
have h' : (g b && allP g l) = false := h
cases e : g b with
| false => exact Exists.intro b (And.intro (List.Mem.head l) e)
| true =>
rw [e] at h'
cases allP_false g l h' with
| intro a ha => exact Exists.intro a (And.intro (List.Mem.tail b ha.1) ha.2)
theorem eqP_eq (a b : Nat × Nat) (h : eqP a b = true) : a = b := by
have h1 : a.1 = b.1 := beq_eq _ _ (and_l h)
have h2 : a.2 = b.2 := beq_eq _ _ (and_r h)
show (a.1, a.2) = (b.1, b.2)
rw [h1, h2]
theorem memP_mem (a : Nat × Nat) (p : List (Nat × Nat)) (h : memP a p = true) : a ∈ p := by
cases anyL_ex _ p h with
| intro b hb => rw [eqP_eq a b hb.2]; exact hb.1
theorem memP_false (a : Nat × Nat) (p : List (Nat × Nat)) (h : memP a p = false) : Not (a ∈ p) := fun m => by
have t := anyL_false_all (eqP a) p h a m
have t' : (Nat.beq a.1 a.1 && Nat.beq a.2 a.2) = false := t
rw [Found.Pnp115.beq_self, Found.Pnp115.beq_self] at t'
exact Bool.noConfusion t'
theorem subB_mem (tau p : List (Nat × Nat)) (h : subB tau p = true) : forall a, a ∈ tau -> a ∈ p :=
fun a ha => memP_mem a p (allP_mem _ tau h a ha)
theorem subB_false (tau p : List (Nat × Nat)) (h : subB tau p = false) : Exists fun a => a ∈ tau /\ Not (a ∈ p) := by
cases allP_false _ tau h with
| intro a ha => exact Exists.intro a (And.intro ha.1 (memP_false a p ha.2))
theorem consPB_false (a b : Nat × Nat) (h : consPB a b = false) : Not (Cons a b) := fun c => by
have h' : (match Nat.beq a.1 b.1, Nat.beq a.2 b.2 with
| true, true => true | false, false => true | true, false => false | false, true => false) = false := h
cases e1 : Nat.beq a.1 b.1 with
| true =>
cases e2 : Nat.beq a.2 b.2 with
| true => rw [e1, e2] at h'; exact Bool.noConfusion h'
| false => exact ne_of_beq_false _ _ e2 (c.1 (beq_eq _ _ e1))
| false =>
cases e2 : Nat.beq a.2 b.2 with
| true => exact ne_of_beq_false _ _ e1 (c.2 (beq_eq _ _ e2))
| false => rw [e1, e2] at h'; exact Bool.noConfusion h'
theorem consB_false (p tau : List (Nat × Nat)) (h : consB p tau = false) :
Exists fun a => a ∈ tau /\ Exists fun b => b ∈ p /\ Not (Cons a b) := by
cases allP_false _ tau h with
| intro a ha =>
cases allP_false _ p ha.2 with
| intro b hb => exact Exists.intro a (And.intro ha.1 (Exists.intro b (And.intro hb.1 (consPB_false a b hb.2))))
/-- A vertex is matched in a path. -/
def Mat (v : Bool × Nat) (p : List (Nat × Nat)) : Prop :=
(v.1 = true -> Exists fun b => b ∈ p /\ b.1 = v.2) /\ (v.1 = false -> Exists fun b => b ∈ p /\ b.2 = v.2)
def Inc (tau p : List (Nat × Nat)) : Prop := Exists fun a => a ∈ tau /\ Exists fun b => b ∈ p /\ Not (Cons a b)
theorem mat_cons (v : Bool × Nat) (p : List (Nat × Nat)) (c : Nat × Nat) (h : Mat v p) : Mat v (c :: p) :=
And.intro (fun e => by cases h.1 e with | intro b hb => exact Exists.intro b (And.intro (List.Mem.tail c hb.1) hb.2))
(fun e => by cases h.2 e with | intro b hb => exact Exists.intro b (And.intro (List.Mem.tail c hb.1) hb.2))
theorem end_inc (tau p : List (Nat × Nat)) (hm : forall v, v ∈ vtx tau -> Mat v p) (hs : subB tau p = false) : Inc tau p := by
cases subB_false tau p hs with
| intro a ha =>
have va : (true, a.1) ∈ vtx tau :=
Found.Pnp119.mem_cm_of _ (true, a.1) a (List.Mem.head _) tau ha.1
cases (hm _ va).1 rfl with
| intro b hb =>
refine Exists.intro a (And.intro ha.1 (Exists.intro b (And.intro hb.1 (fun c => ?_))))
have e2 : a.2 = b.2 := c.1 hb.2.symm
have eab : a = b := by
show (a.1, a.2) = (b.1, b.2)
rw [hb.2, e2]
exact ha.2 (eab ▸ hb.1)
/-- The branches of the query part of a term. -/
theorem qv_br (Pg Hl : List Nat) (k : List (Nat × Nat) -> MT) (tau : List (Nat × Nat)) :
forall (vs : List (Bool × Nat)) (p : List (Nat × Nat)), (forall v, v ∈ vtx tau -> v ∈ vs \/ Mat v p) ->
forall x, x ∈ brs (qv Pg Hl k tau vs p) ->
(x.2 = true /\ forall a, a ∈ tau -> a ∈ x.1 \/ a ∈ p) \/
(Exists fun p' => Exists fun y => y ∈ brs (k p') /\ y.2 = x.2 /\ (forall a, a ∈ y.1 -> a ∈ x.1) /\
(forall a, a ∈ p' -> a ∈ x.1 \/ a ∈ p) /\ Inc tau p')
| [], p, hv, x, hx => by
have hx' : x ∈ brs (bsel (subB tau p) (.leaf true) (k p)) := hx
cases e : subB tau p with
| true =>
rw [e] at hx'
cases mem_cons_cases hx' with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
exact Or.inl (And.intro rfl (fun a ha => Or.inr (subB_mem tau p e a ha)))
| false =>
rw [e] at hx'
have hm : forall v, v ∈ vtx tau -> Mat v p := fun v hv' => by
cases hv v hv' with
| inl h1 => exact nomatch h1
| inr h2 => exact h2
exact Or.inr (Exists.intro p (Exists.intro x (And.intro hx' (And.intro rfl (And.intro (fun a ha => ha)
(And.intro (fun a ha => Or.inr ha) (end_inc tau p hm e)))))))
| (true, i) :: vs, p, hv, x, hx => by
have hx' : x ∈ brs (bsel (usedP p i) (qv Pg Hl k tau vs p)
(.qp i (mkCh (fun j => qv Pg Hl k tau vs ((i, j) :: p)) (frH Hl p)))) := hx
cases e : usedP p i with
| true =>
rw [e] at hx'
refine qv_br Pg Hl k tau vs p (fun v hv' => ?_) x hx'
cases hv v hv' with
| inr h2 => exact Or.inr h2
| inl h1 =>
cases mem_cons_cases h1 with
| inr h3 => exact Or.inl h3
| inl q =>
rw [q]
refine Or.inr (And.intro (fun _ => ?_) (fun f => Bool.noConfusion f))
cases anyL_ex _ p e with
| intro b hb => exact Exists.intro b (And.intro hb.1 (beq_eq _ _ hb.2))
| false =>
rw [e] at hx'
cases mem_brsP i x _ hx' with
| intro j hj =>
cases hj with
| intro t ht =>
cases ht.2 with
| intro y0 hy0 =>
have tq := (mkCh_inch _ j t (frH Hl p) ht.1).2
rw [tq] at hy0
have hv2 : forall v, v ∈ vtx tau -> v ∈ vs \/ Mat v ((i, j) :: p) := fun v hv' => by
cases hv v hv' with
| inr h2 => exact Or.inr (mat_cons v p (i, j) h2)
| inl h1 =>
cases mem_cons_cases h1 with
| inr h3 => exact Or.inl h3
| inl q =>
rw [q]
exact Or.inr (And.intro (fun _ => Exists.intro (i, j) (And.intro (List.Mem.head p) rfl))
(fun f => Bool.noConfusion f))
rw [hy0.2]
cases qv_br Pg Hl k tau vs ((i, j) :: p) hv2 y0 hy0.1 with
| inl a1 =>
refine Or.inl (And.intro a1.1 (fun a ha => ?_))
cases a1.2 a ha with
| inl b1 => exact Or.inl (List.Mem.tail _ b1)
| inr b2 =>
cases mem_cons_cases b2 with
| inl q => rw [q]; exact Or.inl (List.Mem.head _)
| inr h3 => exact Or.inr h3
| inr a2 =>
cases a2 with
| intro p' hp' =>
cases hp' with
| intro y hy =>
refine Or.inr (Exists.intro p' (Exists.intro y (And.intro hy.1 (And.intro hy.2.1
(And.intro (fun a ha => List.Mem.tail _ (hy.2.2.1 a ha)) (And.intro (fun a ha => ?_) hy.2.2.2.2))))))
cases hy.2.2.2.1 a ha with
| inl b1 => exact Or.inl (List.Mem.tail _ b1)
| inr b2 =>
cases mem_cons_cases b2 with
| inl q => rw [q]; exact Or.inl (List.Mem.head _)
| inr h3 => exact Or.inr h3
| (false, j) :: vs, p, hv, x, hx => by
have hx' : x ∈ brs (bsel (usedH p j) (qv Pg Hl k tau vs p)
(.qh j (mkCh (fun i => qv Pg Hl k tau vs ((i, j) :: p)) (frP Pg p)))) := hx
cases e : usedH p j with
| true =>
rw [e] at hx'
refine qv_br Pg Hl k tau vs p (fun v hv' => ?_) x hx'
cases hv v hv' with
| inr h2 => exact Or.inr h2
| inl h1 =>
cases mem_cons_cases h1 with
| inr h3 => exact Or.inl h3
| inl q =>
rw [q]
refine Or.inr (And.intro (fun f => Bool.noConfusion f) (fun _ => ?_))
cases anyL_ex _ p e with
| intro b hb => exact Exists.intro b (And.intro hb.1 (beq_eq _ _ hb.2))
| false =>
rw [e] at hx'
cases mem_brsH j x _ hx' with
| intro i hi =>
cases hi with
| intro t ht =>
cases ht.2 with
| intro y0 hy0 =>
have tq := (mkCh_inch _ i t (frP Pg p) ht.1).2
rw [tq] at hy0
have hv2 : forall v, v ∈ vtx tau -> v ∈ vs \/ Mat v ((i, j) :: p) := fun v hv' => by
cases hv v hv' with
| inr h2 => exact Or.inr (mat_cons v p (i, j) h2)
| inl h1 =>
cases mem_cons_cases h1 with
| inr h3 => exact Or.inl h3
| inl q =>
rw [q]
exact Or.inr (And.intro (fun f => Bool.noConfusion f)
(fun _ => Exists.intro (i, j) (And.intro (List.Mem.head p) rfl)))
rw [hy0.2]
cases qv_br Pg Hl k tau vs ((i, j) :: p) hv2 y0 hy0.1 with
| inl a1 =>
refine Or.inl (And.intro a1.1 (fun a ha => ?_))
cases a1.2 a ha with
| inl b1 => exact Or.inl (List.Mem.tail _ b1)
| inr b2 =>
cases mem_cons_cases b2 with
| inl q => rw [q]; exact Or.inl (List.Mem.head _)
| inr h3 => exact Or.inr h3
| inr a2 =>
cases a2 with
| intro p' hp' =>
cases hp' with
| intro y hy =>
refine Or.inr (Exists.intro p' (Exists.intro y (And.intro hy.1 (And.intro hy.2.1
(And.intro (fun a ha => List.Mem.tail _ (hy.2.2.1 a ha)) (And.intro (fun a ha => ?_) hy.2.2.2.2))))))
cases hy.2.2.2.1 a ha with
| inl b1 => exact Or.inl (List.Mem.tail _ b1)
| inr b2 =>
cases mem_cons_cases b2 with
| inl q => rw [q]; exact Or.inl (List.Mem.head _)
| inr h3 => exact Or.inr h3
/-- The branches of the canonical tree. -/
theorem ct_br (Pg Hl : List Nat) : forall (G : List (List (Nat × Nat))) (p : List (Nat × Nat)) (x : List (Nat × Nat) × Bool),
x ∈ brs (ct Pg Hl G p) ->
(x.2 = true -> Exists fun tau => tau ∈ G /\ forall a, a ∈ tau -> a ∈ x.1 \/ a ∈ p) /\
(x.2 = false -> forall tau, tau ∈ G -> Exists fun a => a ∈ tau /\ Exists fun b => (b ∈ x.1 \/ b ∈ p) /\ Not (Cons a b))
| [], p, x, hx => by
have hx' : x ∈ [(([] : List (Nat × Nat)), false)] := hx
cases mem_cons_cases hx' with
| inr h2 => exact nomatch h2
| inl ex =>
rw [ex]
exact And.intro (fun f => Bool.noConfusion f) (fun _ tau ht => nomatch ht)
| tau :: G, p, x, hx => by
have hx' : x ∈ brs (bsel (consB p tau) (qv Pg Hl (fun p' => ct Pg Hl G p') tau (vtx tau) p) (ct Pg Hl G p)) := hx
cases e : consB p tau with
| false =>
rw [e] at hx'
have ih := ct_br Pg Hl G p x hx'
refine And.intro (fun t => ?_) (fun f tau' ht' => ?_)
· cases ih.1 t with
| intro tau' h' => exact Exists.intro tau' (And.intro (List.Mem.tail _ h'.1) h'.2)
· cases mem_cons_cases ht' with
| inr h2 => exact ih.2 f tau' h2
| inl q =>
rw [q]
cases consB_false p tau e with
| intro a ha =>
cases ha.2 with
| intro b hb => exact Exists.intro a (And.intro ha.1 (Exists.intro b (And.intro (Or.inr hb.1) hb.2)))
| true =>
rw [e] at hx'
cases qv_br Pg Hl (fun p' => ct Pg Hl G p') tau (vtx tau) p (fun v hv => Or.inl hv) x hx' with
| inl a1 =>
exact And.intro (fun _ => Exists.intro tau (And.intro (List.Mem.head G) a1.2))
(fun f => absurd (a1.1.symm.trans f) (fun q => Bool.noConfusion q))
| inr a2 =>
cases a2 with
| intro p' hp' =>
cases hp' with
| intro y hy =>
have ih := ct_br Pg Hl G p' y hy.1
refine And.intro (fun t => ?_) (fun f tau' ht' => ?_)
· cases ih.1 (hy.2.1.trans t) with
| intro tau' h' =>
refine Exists.intro tau' (And.intro (List.Mem.tail _ h'.1) (fun a ha => ?_))
cases h'.2 a ha with
| inl b1 => exact Or.inl (hy.2.2.1 a b1)
| inr b2 => exact hy.2.2.2.1 a b2
· cases mem_cons_cases ht' with
| inl q =>
rw [q]
cases hy.2.2.2.2 with
| intro a ha =>
cases ha.2 with
| intro b hb => exact Exists.intro a (And.intro ha.1 (Exists.intro b (And.intro (hy.2.2.2.1 b hb.1) hb.2)))
| inr h2 =>
cases ih.2 (hy.2.1.trans f) tau' h2 with
| intro a ha =>
cases ha.2 with
| intro b hb =>
refine Exists.intro a (And.intro ha.1 (Exists.intro b (And.intro ?_ hb.2)))
cases hb.1 with
| inl b1 => exact Or.inl (hy.2.2.1 b b1)
| inr b2 => exact hy.2.2.2.1 b b2
/-- E3 at the root: a true branch contains a term. -/
theorem ct_E3 (Pg Hl : List Nat) (G : List (List (Nat × Nat))) (x : List (Nat × Nat)) (hx : (x, true) ∈ brs (ct Pg Hl G [])) :
Exists fun tau => tau ∈ G /\ forall a, a ∈ tau -> a ∈ x := by
cases (ct_br Pg Hl G [] (x, true) hx).1 rfl with
| intro tau ht =>
refine Exists.intro tau (And.intro ht.1 (fun a ha => ?_))
cases ht.2 a ha with
| inl b1 => exact b1
| inr b2 => exact nomatch b2
/-- E4 at the root: a false branch is incompatible with every term. -/
theorem ct_E4 (Pg Hl : List Nat) (G : List (List (Nat × Nat))) (x : List (Nat × Nat)) (hx : (x, false) ∈ brs (ct Pg Hl G [])) :
forall tau, tau ∈ G -> Not (Compat x tau) := fun tau ht hc => by
cases (ct_br Pg Hl G [] (x, false) hx).2 rfl tau ht with
| intro a ha =>
cases ha.2 with
| intro b hb =>
cases hb.1 with
| inl b1 => exact hb.2 (cons_symm b a (hc b b1 a ha.1))
| inr b2 => exact nomatch b2
end Found.Pnp142
#print axioms Found.Pnp142.and_l
#print axioms Found.Pnp142.and_r
#print axioms Found.Pnp142.allP_mem
#print axioms Found.Pnp142.allP_false
#print axioms Found.Pnp142.eqP_eq
#print axioms Found.Pnp142.memP_mem
#print axioms Found.Pnp142.memP_false
#print axioms Found.Pnp142.subB_mem
#print axioms Found.Pnp142.subB_false
#print axioms Found.Pnp142.consPB_false
#print axioms Found.Pnp142.consB_false
#print axioms Found.Pnp142.mat_cons
#print axioms Found.Pnp142.end_inc
#print axioms Found.Pnp142.qv_br
#print axioms Found.Pnp142.ct_br
#print axioms Found.Pnp142.ct_E3
#print axioms Found.Pnp142.ct_E4
lean_all/found/Pnp143.lean
/-
T330 piece 143. found/Pnp143 -- restrictions as sequences (proof complexity ladder, step 3:
counting restrictions for the matching switching lemma).
With holes 0..N-1 and pigeons 0..N, a restriction is a sequence rho in allSeq (N+1) (N+1):
pigeon i sits in hole rho i when rho i < N and is free when rho i = N. Its pair list is
tp N rho (N+1). Proved:
* mem_tp, tp_mem: the pairs of a sequence;
* tp_mt: an injective sequence gives a matching over rng (N+1) x rng N;
* agree_le1: at most one sequence of allSeq c n agrees with a given function below n;
* seq_eq_of_pairs: two sequences with the same pairs agree on all pigeons.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp142
namespace Found.Pnp143
open Found.Pnp65 (bv cntI)
open Found.Pnp90 (allI)
open Found.Pnp115 (lsum mem_cons_cases beq_eq lt_succ_cases)
open Found.Pnp124 (allSeq allSeq_rng rng mem_rng mem_rng_of extF extF_at forced_count good)
open Found.Pnp125 (blt_of_lt lt_of_blt)
open Found.Pnp133 (Cons Compat Mt)
open Found.Pnp139 (bsel)
def tp (N : Nat) (rho : Nat -> Nat) : Nat -> List (Nat × Nat)
| 0 => []
| i + 1 => bsel (Nat.blt (rho i) N) ((i, rho i) :: tp N rho i) (tp N rho i)
theorem mem_tp (N : Nat) (rho : Nat -> Nat) (x : Nat × Nat) : forall k, x ∈ tp N rho k ->
x.1 < k /\ rho x.1 < N /\ x.2 = rho x.1
| 0, h => nomatch h
| k + 1, h => by
have h' : x ∈ bsel (Nat.blt (rho k) N) ((k, rho k) :: tp N rho k) (tp N rho k) := h
cases e : Nat.blt (rho k) N with
| true =>
rw [e] at h'
cases mem_cons_cases h' with
| inl q => rw [q]; exact And.intro (Nat.lt_succ_self k) (And.intro (lt_of_blt _ _ e) rfl)
| inr h2 =>
have r := mem_tp N rho x k h2
exact And.intro (Nat.lt_succ_of_lt r.1) r.2
| false =>
rw [e] at h'
have r := mem_tp N rho x k h'
exact And.intro (Nat.lt_succ_of_lt r.1) r.2
theorem tp_mem (N : Nat) (rho : Nat -> Nat) (i : Nat) (hr : rho i < N) : forall k, i < k -> (i, rho i) ∈ tp N rho k
| 0, h => absurd h (Nat.not_lt_zero i)
| k + 1, h => by
show (i, rho i) ∈ bsel (Nat.blt (rho k) N) ((k, rho k) :: tp N rho k) (tp N rho k)
cases lt_succ_cases h with
| inl l =>
cases Nat.blt (rho k) N with
| true => exact List.Mem.tail _ (tp_mem N rho i hr k l)
| false => exact tp_mem N rho i hr k l
| inr e =>
rw [e, blt_of_lt _ _ (e ▸ hr)]
exact List.Mem.head _
/-- Injective on the matched pigeons. -/
def InjR (N : Nat) (rho : Nat -> Nat) : Prop :=
forall i i', i < N + 1 -> i' < N + 1 -> rho i < N -> rho i = rho i' -> i = i'
theorem tp_mt (N : Nat) (rho : Nat -> Nat) (hi : InjR N rho) : Mt (rng (N + 1)) (rng N) (tp N rho (N + 1)) := by
refine Mt.mk (fun x hx => ?_) (fun x hx y hy => ?_)
· have r := mem_tp N rho x (N + 1) hx
exact And.intro (mem_rng_of _ _ r.1) (mem_rng_of _ _ (r.2.2 ▸ r.2.1))
· have rx := mem_tp N rho x (N + 1) hx
have ry := mem_tp N rho y (N + 1) hy
refine And.intro (fun e => ?_) (fun e => ?_)
· rw [rx.2.2, ry.2.2, e]
· have q := hi x.1 y.1 rx.1 ry.1 rx.2.1 (rx.2.2.symm.trans (e.trans ry.2.2))
exact q
theorem cntI_all : forall n, cntI (fun _ => true) n = n
| 0 => rfl
| n + 1 => congrArg (· + 1) (cntI_all n)
/-- At most one sequence agrees with g below n. -/
theorem agree_le1 (c : Nat) (hc : 1 <= c) (g : Nat -> Nat) (n : Nat) :
lsum (fun f => bv (allI (fun i => Nat.beq (f i) (g i)) n)) (allSeq c n) <= 1 := by
have fc := forced_count c (fun p f => Nat.beq (f p) (g p)) (fun _ => true)
(fun p f f' h => by rw [h p (Nat.le_refl p)])
(fun p f _ v w hv hw => by
have a : v = g p := by
have t := beq_eq _ _ hv
rw [extF_at] at t
exact t
have b : w = g p := by
have t := beq_eq _ _ hw
rw [extF_at] at t
exact t
exact a.trans b.symm) n
rw [cntI_all] at fc
refine Found.Pnp101.cancel_r (Found.Pnp99.pow_pos' hc n) ?_
exact Nat.le_trans fc (Nat.le_of_eq (Found.Pnp115.one_mul' _).symm)
/-- Two sequences with the same pairs agree on all pigeons. -/
theorem seq_eq_of_pairs (N : Nat) (r1 r2 : Nat -> Nat) (h1 : r1 ∈ allSeq (N + 1) (N + 1)) (h2 : r2 ∈ allSeq (N + 1) (N + 1))
(hs : forall x, x ∈ tp N r1 (N + 1) -> x ∈ tp N r2 (N + 1))
(hs' : forall x, x ∈ tp N r2 (N + 1) -> x ∈ tp N r1 (N + 1)) :
forall i, i < N + 1 -> r1 i = r2 i := fun i hi => by
cases Nat.lt_or_ge (r1 i) N with
| inl l => exact (mem_tp N r2 _ _ (hs _ (tp_mem N r1 i l (N + 1) hi))).2.2
| inr g1 =>
cases Nat.lt_or_ge (r2 i) N with
| inl l2 => exact ((mem_tp N r1 _ _ (hs' _ (tp_mem N r2 i l2 (N + 1) hi))).2.2).symm
| inr g2 =>
have a := allSeq_rng _ _ r1 h1 i hi
have b := allSeq_rng _ _ r2 h2 i hi
exact (Nat.le_antisymm (Nat.le_of_lt_succ a) g1).trans (Nat.le_antisymm (Nat.le_of_lt_succ b) g2).symm
end Found.Pnp143
#print axioms Found.Pnp143.mem_tp
#print axioms Found.Pnp143.tp_mem
#print axioms Found.Pnp143.tp_mt
#print axioms Found.Pnp143.cntI_all
#print axioms Found.Pnp143.agree_le1
#print axioms Found.Pnp143.seq_eq_of_pairs
lean_all/found/Pnp144.lean
/-
T330 piece 144. found/Pnp144 -- counting the free pigeons and holes of a restriction
(proof complexity ladder, step 3: counting restrictions).
For a sequence rho over pigeons 0..N: mB marks matched pigeons, msz counts them, injB tests
injectivity, freeH marks the holes below N not used, and inR N l rho says rho is an injective
restriction with l pairs. Proved:
* cnt_compl: marked plus unmarked positions;
* allI_ext, anyI_ext, inR_ext: the tests only look below N + 1;
* injB_inj: the Bool test gives InjR;
* len_filt_rng, dist_mapL: list counting;
* free_pig, free_hole_le: with l + m = N, an injective restriction with l pairs has m + 1
free pigeons and at most m free holes;
* exists_agree: every function with values below c agrees below n with a member of allSeq c n;
* cntI_drop: switching one marked position off lowers the count by one.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp143
namespace Found.Pnp144
open Found.Pnp65 (bv cntI anyI anyI_true anyI_false)
open Found.Pnp90 (allI allI_true allI_of)
open Found.Pnp96 (anyI_ex)
open Found.Pnp115 (lsum mem_cons_cases beq_eq beq_self lt_succ_cases)
open Found.Pnp119 (mem_cm_of)
open Found.Pnp120 (mapL mem_mapL)
open Found.Pnp123 (Dist)
open Found.Pnp124 (allSeq rng mem_rng mem_rng_of rng_dist extF extF_at extF_lt len_mapL)
open Found.Pnp125 (blt_of_lt lt_of_blt)
open Found.Pnp126 (pigeon)
open Found.Pnp127 (mem_mapL_inv)
open Found.Pnp133 (ne_of_beq_false)
open Found.Pnp139 (bsel)
open Found.Pnp140 (beq_ne)
open Found.Pnp141 (filt mem_filt filt_mem dist_filt)
open Found.Pnp142 (and_l and_r)
open Found.Pnp143 (InjR)
def mB (N : Nat) (rho : Nat -> Nat) (i : Nat) : Bool := Nat.blt (rho i) N
def msz (N : Nat) (rho : Nat -> Nat) : Nat := cntI (mB N rho) (N + 1)
def injB (N : Nat) (rho : Nat -> Nat) : Bool :=
allI (fun i => allI (fun i' => !(mB N rho i && Nat.beq (rho i) (rho i') && !(Nat.beq i i'))) (N + 1)) (N + 1)
def freeH (N : Nat) (rho : Nat -> Nat) (j : Nat) : Bool := !(anyI (fun i => mB N rho i && Nat.beq (rho i) j) (N + 1))
def inR (N l : Nat) (rho : Nat -> Nat) : Bool := injB N rho && Nat.beq (msz N rho) l
theorem cnt_compl (g : Nat -> Bool) : forall n, cntI g n + cntI (fun i => !(g i)) n = n
| 0 => rfl
| n + 1 => by
show (cntI g n + bv (g n)) + (cntI (fun i => !(g i)) n + bv (!(g n))) = n + 1
have ih := cnt_compl g n
cases g n with
| true =>
show (cntI g n + 1) + (cntI (fun i => !(g i)) n + 0) = n + 1
exact (Nat.add_right_comm _ _ _).trans (congrArg (· + 1) ih)
| false =>
show (cntI g n + 0) + (cntI (fun i => !(g i)) n + 1) = n + 1
exact (Nat.add_assoc _ _ _).symm.trans (congrArg (· + 1) ih)
theorem allI_ext (g g' : Nat -> Bool) : forall k, (forall x, x < k -> g x = g' x) -> allI g k = allI g' k
| 0, _ => rfl
| k + 1, h => by
show (allI g k && g k) = (allI g' k && g' k)
rw [allI_ext g g' k (fun x hx => h x (Nat.lt_succ_of_lt hx)), h k (Nat.lt_succ_self k)]
theorem anyI_ext (g g' : Nat -> Bool) : forall k, (forall x, x < k -> g x = g' x) -> anyI g k = anyI g' k
| 0, _ => rfl
| k + 1, h => by
show (anyI g k || g k) = (anyI g' k || g' k)
rw [anyI_ext g g' k (fun x hx => h x (Nat.lt_succ_of_lt hx)), h k (Nat.lt_succ_self k)]
theorem inR_ext (N l : Nat) (f g : Nat -> Nat) (h : forall x, x < N + 1 -> f x = g x) : inR N l f = inR N l g := by
have e1 : injB N f = injB N g := allI_ext _ _ (N + 1) (fun i hi =>
allI_ext _ _ (N + 1) (fun i' hi' => by
show (!(Nat.blt (f i) N && Nat.beq (f i) (f i') && !(Nat.beq i i'))) =
(!(Nat.blt (g i) N && Nat.beq (g i) (g i') && !(Nat.beq i i')))
rw [h i hi, h i' hi']))
have e2 : msz N f = msz N g := Found.Pnp94.cntI_agree _ _ (N + 1) (fun j hj => by
show Nat.blt (f j) N = Nat.blt (g j) N
rw [h j hj])
show (injB N f && Nat.beq (msz N f) l) = (injB N g && Nat.beq (msz N g) l)
rw [e1, e2]
theorem injB_inj (N : Nat) (rho : Nat -> Nat) (h : injB N rho = true) : InjR N rho := by
intro i i' hi hi' hm he
have t := allI_true _ (N + 1) (allI_true _ (N + 1) h i hi) i' hi'
have t' : (!(Nat.blt (rho i) N && Nat.beq (rho i) (rho i') && !(Nat.beq i i'))) = true := t
rw [blt_of_lt _ _ hm, he, beq_self] at t'
cases e : Nat.beq i i' with
| true => exact beq_eq _ _ e
| false => rw [e] at t'; exact Bool.noConfusion t'
theorem len_filt_rng (g : Nat -> Bool) : forall n, (filt g (rng n)).length = cntI g n
| 0 => rfl
| n + 1 => by
show (bsel (g n) (n :: filt g (rng n)) (filt g (rng n))).length = cntI g n + bv (g n)
cases g n with
| true => exact congrArg (· + 1) (len_filt_rng g n)
| false => exact len_filt_rng g n
theorem dist_mapL (f : Nat -> Nat) : forall L : List Nat, Dist L ->
(forall a b, a ∈ L -> b ∈ L -> f a = f b -> a = b) -> Dist (mapL f L)
| [], _, _ => True.intro
| a :: L, hd, hi => by
refine And.intro (fun y hy e => ?_) (dist_mapL f L hd.2 (fun x y hx hy => hi x y (List.Mem.tail a hx) (List.Mem.tail a hy)))
cases mem_mapL_inv f y L hy with
| intro b hb =>
have q := hi a b (List.Mem.head L) (List.Mem.tail a hb.1) (e.trans hb.2)
rw [q] at hd
exact hd.1 b hb.1 rfl
/-- With l + m = N, an injective restriction with l pairs has m + 1 free pigeons. -/
theorem free_pig (N l m : Nat) (hlm : l + m = N) (rho : Nat -> Nat) (h : inR N l rho = true) :
cntI (fun i => !(mB N rho i)) (N + 1) = m + 1 := by
have hl : msz N rho = l := beq_eq _ _ (and_r h)
have c := cnt_compl (mB N rho) (N + 1)
have c' : l + cntI (fun i => !(mB N rho i)) (N + 1) = l + (m + 1) :=
(congrArg (· + cntI (fun i => !(mB N rho i)) (N + 1)) hl.symm).trans (c.trans (congrArg (· + 1) hlm.symm))
exact Found.Pnp101.add_cancel_l_eq c'
/-- With l + m = N, an injective restriction with l pairs leaves at most m holes free. -/
theorem free_hole_le (N l m : Nat) (hlm : l + m = N) (rho : Nat -> Nat) (h : inR N l rho = true) :
cntI (freeH N rho) N <= m := by
have hl : msz N rho = l := beq_eq _ _ (and_r h)
have hinj := injB_inj N rho (and_l h)
let L := filt (mB N rho) (rng (N + 1))
have dL : Dist L := dist_filt _ _ (rng_dist (N + 1))
have T_len : (mapL rho L).length = l := by rw [len_mapL, len_filt_rng]; exact hl
have T_dist : Dist (mapL rho L) := dist_mapL rho L dL (fun a b ha hb e =>
hinj a b (mem_rng _ _ (mem_filt _ a _ ha).1) (mem_rng _ _ (mem_filt _ b _ hb).1)
(lt_of_blt _ _ (mem_filt _ a _ ha).2) e)
have used : l <= cntI (fun j => !(freeH N rho j)) N := by
rw [<- T_len]
refine pigeon _ N _ T_dist (fun v hv => ?_)
cases mem_mapL_inv rho v L hv with
| intro a ha =>
have fa := mem_filt _ a _ ha.1
have av : rho a < N := lt_of_blt _ _ fa.2
refine And.intro (ha.2 ▸ av) ?_
show (!(!(anyI (fun i => mB N rho i && Nat.beq (rho i) v) (N + 1)))) = true
rw [Found.Pnp132.not_not]
refine anyI_true _ a ?_ (N + 1) (mem_rng _ _ fa.1)
show (mB N rho a && Nat.beq (rho a) v) = true
rw [fa.2, <- ha.2, beq_self]
try rfl
have c := cnt_compl (freeH N rho) N
have c2 : cntI (freeH N rho) N + l <= m + l := by
refine Nat.le_trans (Nat.add_le_add_left used _) (Nat.le_of_eq ?_)
rw [c, <- hlm, Nat.add_comm]
exact Found.Pnp99.add_cancel_r' l c2
/-- Every function with values below c agrees below n with a member of allSeq c n. -/
theorem exists_agree (c : Nat) (g : Nat -> Nat) : forall n, (forall x, x < n -> g x < c) ->
Exists fun f => f ∈ allSeq c n /\ forall x, x < n -> f x = g x
| 0, _ => Exists.intro (fun _ => 0) (And.intro (List.Mem.head []) (fun x hx => absurd hx (Nat.not_lt_zero x)))
| n + 1, h => by
cases exists_agree c g n (fun x hx => h x (Nat.lt_succ_of_lt hx)) with
| intro f hf =>
refine Exists.intro (extF f n (g n)) (And.intro ?_ (fun x hx => ?_))
· exact mem_cm_of _ _ f (mem_mapL (fun v => extF f n v) (g n) (rng c) (mem_rng_of c (g n) (h n (Nat.lt_succ_self n))))
(allSeq c n) hf.1
· cases lt_succ_cases hx with
| inl l => rw [extF_lt f n (g n) x l]; exact hf.2 x l
| inr e => rw [e, extF_at]
/-- Switching one marked position off lowers the count by one. -/
theorem cntI_drop (g g' : Nat -> Bool) (i : Nat) (hg : g i = true) (hg' : g' i = false)
(ho : forall x, Not (x = i) -> g x = g' x) : forall n, i < n -> cntI g n = cntI g' n + 1
| 0, h => absurd h (Nat.not_lt_zero i)
| n + 1, h => by
show cntI g n + bv (g n) = (cntI g' n + bv (g' n)) + 1
cases lt_succ_cases h with
| inl l =>
have ne : Not (n = i) := fun e => Nat.lt_irrefl n (e ▸ l)
rw [cntI_drop g g' i hg hg' ho n l, ho n ne, Nat.add_right_comm]
| inr e =>
rw [e] at hg hg'
rw [hg, hg', Found.Pnp94.cntI_agree g g' n (fun x hx => ho x (fun q => Nat.lt_irrefl n (by rw [q, e] at hx; exact hx)))]
try rfl
end Found.Pnp144
#print axioms Found.Pnp144.cnt_compl
#print axioms Found.Pnp144.allI_ext
#print axioms Found.Pnp144.anyI_ext
#print axioms Found.Pnp144.inR_ext
#print axioms Found.Pnp144.injB_inj
#print axioms Found.Pnp144.len_filt_rng
#print axioms Found.Pnp144.dist_mapL
#print axioms Found.Pnp144.free_pig
#print axioms Found.Pnp144.free_hole_le
#print axioms Found.Pnp144.exists_agree
#print axioms Found.Pnp144.cntI_drop
lean_all/found/Pnp145.lean
/-
T330 piece 145. found/Pnp145 -- the ratio of the numbers of restrictions of consecutive
sizes (proof complexity ladder, step 3: counting restrictions).
cntR N l counts the injective restrictions with l pairs among the sequences of
allSeq (N + 1) (N + 1). With l + m = N:
cntR N (l + 1) * (l + 1) <= cntR N l * ((m + 1) * m).
Each pair (rho', i) with rho' of size l + 1 and pigeon i matched in rho' goes to
(rho, i, j) with rho = rho' with pigeon i freed (a restriction of size l), i free in rho and
j = rho' i a free hole of rho; rho' agrees with rho extended by (i, j), and at most one
sequence agrees with a given one (agree_le1). Proved: extF_ne, lsum_congr, bv_and,
cnt_lsum, injB_of, freed, lift, ratio.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp144
namespace Found.Pnp145
open Found.Pnp65 (bv cntI anyI selN)
open Found.Pnp90 (allI allI_true allI_of)
open Found.Pnp96 (anyI_ex)
open Found.Pnp115 (lsum lsum_le lsum_zero_of beq_eq beq_self lt_succ_cases one_mul')
open Found.Pnp122 (lsum_swap one_le_lsum)
open Found.Pnp124 (allSeq allSeq_rng rng mem_rng mem_rng_of extF extF_at lsum_mul_r)
open Found.Pnp125 (blt_of_lt lt_of_blt)
open Found.Pnp133 (ne_of_beq_false)
open Found.Pnp140 (beq_ne)
open Found.Pnp142 (and_l and_r)
open Found.Pnp143 (agree_le1)
open Found.Pnp144 (mB msz injB freeH inR inR_ext injB_inj free_pig free_hole_le exists_agree cntI_drop)
def cntR (N l : Nat) : Nat := lsum (fun rho => bv (inR N l rho)) (allSeq (N + 1) (N + 1))
def agreeB (N : Nat) (f g : Nat -> Nat) : Bool := allI (fun x => Nat.beq (f x) (g x)) (N + 1)
theorem extF_ne (f : Nat -> Nat) (p v x : Nat) (h : Not (x = p)) : extF f p v x = f x := by
show selN (Nat.beq x p) v (f x) = f x
rw [beq_ne x p h]
rfl
theorem lsum_congr {α : Type} (h h' : α -> Nat) (L : List α) (e : forall a, a ∈ L -> h a = h' a) : lsum h L = lsum h' L :=
Nat.le_antisymm (lsum_le _ _ L (fun a ha => Nat.le_of_eq (e a ha))) (lsum_le _ _ L (fun a ha => Nat.le_of_eq (e a ha).symm))
theorem bv_and (a b : Bool) : bv (a && b) = bv a * bv b := by cases a <;> cases b <;> rfl
theorem cnt_lsum (g : Nat -> Bool) : forall n, cntI g n = lsum (fun i => bv (g i)) (rng n)
| 0 => rfl
| n + 1 => by
show cntI g n + bv (g n) = bv (g n) + lsum (fun i => bv (g i)) (rng n)
rw [cnt_lsum g n, Nat.add_comm]
theorem injB_of (N : Nat) (g : Nat -> Nat)
(h : forall x x', x < N + 1 -> x' < N + 1 -> g x < N -> g x = g x' -> x = x') : injB N g = true :=
allI_of _ (N + 1) (fun x hx => allI_of _ (N + 1) (fun x' hx' => by
show (!(mB N g x && Nat.beq (g x) (g x') && !(Nat.beq x x'))) = true
cases e1 : mB N g x with
| false => rfl
| true =>
cases e2 : Nat.beq (g x) (g x') with
| false => rfl
| true =>
rw [h x x' hx hx' (lt_of_blt _ _ e1) (beq_eq _ _ e2), beq_self]
rfl))
/-- Freeing a matched pigeon of an injective restriction of size l + 1 gives one of size l. -/
theorem freed (N l : Nat) (r : Nat -> Nat) (hr : inR N (l + 1) r = true) (i : Nat) (hi : i < N + 1) (hm : mB N r i = true) :
inR N l (extF r i N) = true := by
have inj := injB_inj N r (and_l hr)
have hs : msz N r = l + 1 := beq_eq _ _ (and_r hr)
have ij : injB N (extF r i N) = true := injB_of N _ (fun x x' hx hx' hlt he => by
cases Nat.decEq x i with
| isTrue q => rw [q, extF_at] at hlt; exact absurd hlt (Nat.lt_irrefl N)
| isFalse q =>
rw [extF_ne r i N x q] at hlt he
cases Nat.decEq x' i with
| isTrue q' => rw [q', extF_at] at he; rw [he] at hlt; exact absurd hlt (Nat.lt_irrefl N)
| isFalse q' => rw [extF_ne r i N x' q'] at he; exact inj x x' hx hx' hlt he)
have d := cntI_drop (mB N r) (mB N (extF r i N)) i hm
(by show Nat.blt (extF r i N i) N = false; rw [extF_at]; exact Found.Pnp111.blt_false_of_le (Nat.le_refl N))
(fun x q => by show Nat.blt (r x) N = Nat.blt (extF r i N x) N; rw [extF_ne r i N x q]) (N + 1) hi
have hs' : msz N (extF r i N) = l := by
have t : msz N (extF r i N) + 1 = l + 1 := d.symm.trans hs
exact Nat.succ.inj t
show (injB N (extF r i N) && Nat.beq (msz N (extF r i N)) l) = true
rw [ij, hs', beq_self]
try rfl
/-- One pair (rho', i) is charged to (rho, i, j). -/
theorem lift (N l : Nat) (r : Nat -> Nat) (hrA : r ∈ allSeq (N + 1) (N + 1)) (i : Nat) (hi : i ∈ rng (N + 1)) :
bv (inR N (l + 1) r && mB N r i) <=
lsum (fun rho => lsum (fun j => bv ((inR N l rho && !(mB N rho i) && freeH N rho j) && agreeB N r (extF rho i j)))
(rng N)) (allSeq (N + 1) (N + 1)) := by
cases e : (inR N (l + 1) r && mB N r i) with
| false => exact Nat.zero_le _
| true =>
have hr := and_l e
have hm := and_r e
have hi' := mem_rng _ _ hi
have inj := injB_inj N r (and_l hr)
have jN : r i < N := lt_of_blt _ _ hm
cases exists_agree (N + 1) (extF r i N) (N + 1) (fun x hx => by
cases Nat.decEq x i with
| isTrue q => rw [q, extF_at]; exact Nat.lt_succ_self N
| isFalse q => rw [extF_ne r i N x q]; exact allSeq_rng _ _ r hrA x hx) with
| intro f hf =>
have fr : inR N l f = true := (inR_ext N l f (extF r i N) hf.2).trans (freed N l r hr i hi' hm)
have fi : f i = N := (hf.2 i hi').trans (extF_at r i N)
have fx : forall x, x < N + 1 -> Not (x = i) -> f x = r x := fun x hx q =>
(hf.2 x hx).trans (extF_ne r i N x q)
have nb : (!(mB N f i)) = true := by
show (!(Nat.blt (f i) N)) = true
rw [fi, Found.Pnp111.blt_false_of_le (Nat.le_refl N)]
rfl
have fh : freeH N f (r i) = true := by
have hz : anyI (fun x => mB N f x && Nat.beq (f x) (r i)) (N + 1) = false :=
Found.Pnp131.anyI_none _ (N + 1) (fun x hx => by
cases Nat.decEq x i with
| isTrue q =>
show (Nat.blt (f x) N && Nat.beq (f x) (r i)) = false
rw [q, fi, Found.Pnp111.blt_false_of_le (Nat.le_refl N)]
rfl
| isFalse q =>
show (Nat.blt (f x) N && Nat.beq (f x) (r i)) = false
rw [fx x hx q]
cases e2 : Nat.beq (r x) (r i) with
| false => cases Nat.blt (r x) N <;> rfl
| true =>
have ex : r x = r i := beq_eq _ _ e2
have lx : r x < N := by rw [ex]; exact jN
exact absurd (inj x i hx hi' lx ex) q)
show (!(anyI (fun x => mB N f x && Nat.beq (f x) (r i)) (N + 1))) = true
rw [hz]
try rfl
have ag : agreeB N r (extF f i (r i)) = true := allI_of _ (N + 1) (fun x hx => by
show Nat.beq (r x) (extF f i (r i) x) = true
cases Nat.decEq x i with
| isTrue q => rw [q, extF_at, beq_self]
| isFalse q => rw [extF_ne f i (r i) x q, fx x hx q, beq_self])
refine one_le_lsum _ _ f hf.1 (one_le_lsum _ _ (r i) (mem_rng_of _ _ jN) ?_)
show 1 <= bv ((inR N l f && !(mB N f i) && freeH N f (r i)) && agreeB N r (extF f i (r i)))
rw [fr, nb, fh, ag]
exact Nat.le_refl 1
/-- The ratio of consecutive restriction counts. -/
theorem ratio (N l m : Nat) (hlm : l + m = N) : cntR N (l + 1) * (l + 1) <= cntR N l * ((m + 1) * m) := by
let A := allSeq (N + 1) (N + 1)
let B : (Nat -> Nat) -> Nat -> Nat -> Bool := fun rho i j => inR N l rho && !(mB N rho i) && freeH N rho j
let T : (Nat -> Nat) -> Nat -> (Nat -> Nat) -> Nat -> Nat := fun r i rho j => bv (B rho i j && agreeB N r (extF rho i j))
have s1 : cntR N (l + 1) * (l + 1) <=
lsum (fun r => lsum (fun i => lsum (fun rho => lsum (fun j => T r i rho j) (rng N)) A) (rng (N + 1))) A := by
refine Nat.le_trans (Nat.le_of_eq (lsum_mul_r _ _ _).symm) (lsum_le _ _ A (fun r hr => ?_))
refine Nat.le_trans ?_ (lsum_le _ _ _ (fun i hi => lift N l r hr i hi))
rw [<- cnt_lsum]
cases e : inR N (l + 1) r with
| false => exact Nat.le_trans (Nat.le_of_eq (Found.Pnp97.zero_mul' (l + 1))) (Nat.zero_le _)
| true =>
have hs : msz N r = l + 1 := beq_eq _ _ (and_r e)
show 1 * (l + 1) <= cntI (fun i => true && mB N r i) (N + 1)
rw [one_mul', <- hs]
exact Nat.le_refl _
have s2 : lsum (fun r => lsum (fun i => lsum (fun rho => lsum (fun j => T r i rho j) (rng N)) A) (rng (N + 1))) A =
lsum (fun rho => lsum (fun i => lsum (fun j => lsum (fun r => T r i rho j) A) (rng N)) (rng (N + 1))) A := by
refine (lsum_swap (fun r i => lsum (fun rho => lsum (fun j => T r i rho j) (rng N)) A) (rng (N + 1)) A).trans ?_
refine (lsum_congr (fun i => lsum (fun r => lsum (fun rho => lsum (fun j => T r i rho j) (rng N)) A) A)
(fun i => lsum (fun rho => lsum (fun j => lsum (fun r => T r i rho j) A) (rng N)) A) (rng (N + 1))
(fun i _ => (lsum_swap (fun r rho => lsum (fun j => T r i rho j) (rng N)) A A).trans
(lsum_congr _ _ A (fun rho _ => lsum_swap (fun r j => T r i rho j) (rng N) A)))).trans ?_
exact lsum_swap (fun i rho => lsum (fun j => lsum (fun r => T r i rho j) A) (rng N)) A (rng (N + 1))
have s3 : lsum (fun rho => lsum (fun i => lsum (fun j => lsum (fun r => T r i rho j) A) (rng N)) (rng (N + 1))) A <=
lsum (fun rho => lsum (fun i => lsum (fun j => bv (B rho i j)) (rng N)) (rng (N + 1))) A :=
lsum_le _ _ A (fun rho _ => lsum_le _ _ _ (fun i _ => lsum_le _ _ _ (fun j _ => by
show lsum (fun r => bv (B rho i j && agreeB N r (extF rho i j))) A <= bv (B rho i j)
cases B rho i j with
| false => exact Nat.le_of_eq (lsum_zero_of _ A (fun _ _ => rfl))
| true => exact agree_le1 (N + 1) (Nat.succ_le_succ (Nat.zero_le N)) (extF rho i j) (N + 1))))
have s4 : lsum (fun rho => lsum (fun i => lsum (fun j => bv (B rho i j)) (rng N)) (rng (N + 1))) A <=
lsum (fun rho => bv (inR N l rho) * ((m + 1) * m)) A := by
refine lsum_le _ _ A (fun rho _ => ?_)
cases e : inR N l rho with
| false =>
refine Nat.le_trans (Nat.le_of_eq (lsum_zero_of (fun i => lsum (fun j => bv (B rho i j)) (rng N)) (rng (N + 1))
(fun i _ => lsum_zero_of (fun j => bv (B rho i j)) (rng N) (fun j _ => ?_)))) (Nat.zero_le _)
show bv (inR N l rho && !(mB N rho i) && freeH N rho j) = 0
rw [e]
try rfl
| true =>
have t : lsum (fun i => lsum (fun j => bv (B rho i j)) (rng N)) (rng (N + 1)) =
lsum (fun i => bv (!(mB N rho i)) * cntI (freeH N rho) N) (rng (N + 1)) :=
lsum_congr _ _ _ (fun i _ => by
rw [cnt_lsum (freeH N rho) N, Found.Pnp115.mul_lsum]
exact lsum_congr _ _ _ (fun j _ => by
show bv (inR N l rho && !(mB N rho i) && freeH N rho j) = bv (!(mB N rho i)) * bv (freeH N rho j)
rw [e, bv_and]
rfl))
rw [t, lsum_mul_r, <- cnt_lsum, free_pig N l m hlm rho e]
show (m + 1) * cntI (freeH N rho) N <= 1 * ((m + 1) * m)
rw [one_mul']
exact Found.Pnp99.mul_le_l' (free_hole_le N l m hlm rho e) (m + 1)
exact Nat.le_trans s1 (Nat.le_trans (Nat.le_of_eq s2) (Nat.le_trans s3 (Nat.le_trans s4
(Nat.le_of_eq (lsum_mul_r _ _ _)))))
end Found.Pnp145
#print axioms Found.Pnp145.extF_ne
#print axioms Found.Pnp145.lsum_congr
#print axioms Found.Pnp145.bv_and
#print axioms Found.Pnp145.cnt_lsum
#print axioms Found.Pnp145.injB_of
#print axioms Found.Pnp145.freed
#print axioms Found.Pnp145.lift
#print axioms Found.Pnp145.ratio
lean_all/found/Pnp146.lean
/-
T330 piece 146. found/Pnp146 -- the restricted DNF and the decoder of the matching switching
lemma (proof complexity ladder, step 3: bounded-depth Frege).
rmap r F keeps the terms of F consistent with the restriction r (as a pair list) and removes
from them the pairs of r. The decoder dec reads a code (one mask per processed term, the
answer indices, a budget of answers) and a hybrid matching H: the processed term is the first
term of F contained in H (firstSub), its mask marks each pair as in r (0), in the path (1) or
new (2); the new pairs are removed from H, and the queries of the restricted term are replayed
(rp): a vertex already matched in the path is skipped, otherwise the next answer index picks
the other end from the candidate list (vertices of the new pairs, then the list FV). At the
end the output is H without the path. Proved here: firstSub_eq (the first contained term),
mem_diffP, diffP_mem, selMask lemmas, rmap membership.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp145
namespace Found.Pnp146
open Found.Pnp115 (anyL mem_cons_cases beq_eq)
open Found.Pnp116 (mem_app mem_app_l mem_app_r)
open Found.Pnp133 (Cons)
open Found.Pnp139 (bsel usedP usedH)
open Found.Pnp141 (vtx memP subB consB allP)
open Found.Pnp142 (memP_mem memP_false subB_mem)
/-- Pairs of a not in b. -/
def diffP (a b : List (Nat × Nat)) : List (Nat × Nat) :=
match a with
| [] => []
| x :: a' => bsel (memP x b) (diffP a' b) (x :: diffP a' b)
theorem mem_diffP (b : List (Nat × Nat)) (x : Nat × Nat) : forall a : List (Nat × Nat), x ∈ diffP a b -> x ∈ a /\ Not (x ∈ b)
| [], h => nomatch h
| y :: a, h => by
have h' : x ∈ bsel (memP y b) (diffP a b) (y :: diffP a b) := h
cases e : memP y b with
| true =>
rw [e] at h'
have r := mem_diffP b x a h'
exact And.intro (List.Mem.tail y r.1) r.2
| false =>
rw [e] at h'
cases mem_cons_cases h' with
| inl q => rw [q]; exact And.intro (List.Mem.head a) (memP_false y b e)
| inr h2 =>
have r := mem_diffP b x a h2
exact And.intro (List.Mem.tail y r.1) r.2
theorem diffP_mem (b : List (Nat × Nat)) (x : Nat × Nat) (hx : Not (x ∈ b)) : forall a : List (Nat × Nat), x ∈ a -> x ∈ diffP a b
| [], h => nomatch h
| y :: a, h => by
show x ∈ bsel (memP y b) (diffP a b) (y :: diffP a b)
cases mem_cons_cases h with
| inl q =>
rw [<- q]
cases e : memP x b with
| true => exact absurd (memP_mem x b e) hx
| false => exact List.Mem.head _
| inr h2 =>
cases memP y b with
| true => exact diffP_mem b x hx a h2
| false => exact List.Mem.tail y (diffP_mem b x hx a h2)
/-- The restricted DNF. -/
def rmap (r : List (Nat × Nat)) : List (List (Nat × Nat)) -> List (List (Nat × Nat))
| [] => []
| t :: F => bsel (consB r t) (diffP t r :: rmap r F) (rmap r F)
/-- The pairs of t marked k. -/
def selMask (k : Nat) : List (Nat × Nat) -> List Nat -> List (Nat × Nat)
| [], _ => []
| _ :: _, [] => []
| x :: t, b :: m => bsel (Nat.beq b k) (x :: selMask k t m) (selMask k t m)
theorem mem_selMask (k : Nat) (x : Nat × Nat) : forall (t : List (Nat × Nat)) (m : List Nat), x ∈ selMask k t m -> x ∈ t
| [], _, h => nomatch h
| _ :: _, [], h => nomatch h
| y :: t, b :: m, h => by
have h' : x ∈ bsel (Nat.beq b k) (y :: selMask k t m) (selMask k t m) := h
cases e : Nat.beq b k with
| true =>
rw [e] at h'
cases mem_cons_cases h' with
| inl q => rw [q]; exact List.Mem.head t
| inr h2 => exact List.Mem.tail y (mem_selMask k x t m h2)
| false =>
rw [e] at h'
exact List.Mem.tail y (mem_selMask k x t m h')
/-- The first term of F contained in H. -/
def firstSub (H : List (Nat × Nat)) : List (List (Nat × Nat)) -> Option (List (Nat × Nat))
| [] => none
| t :: F => bsel (subB t H) (some t) (firstSub H F)
theorem firstSub_eq (H : List (Nat × Nat)) (t : List (Nat × Nat)) (ht : subB t H = true) (F2 : List (List (Nat × Nat))) :
forall F1 : List (List (Nat × Nat)), (forall u, u ∈ F1 -> subB u H = false) -> firstSub H (F1 ++ t :: F2) = some t
| [], _ => by
show bsel (subB t H) (some t) (firstSub H F2) = some t
rw [ht]
rfl
| u :: F1, h => by
show bsel (subB u H) (some u) (firstSub H (F1 ++ t :: F2)) = some t
rw [h u (List.Mem.head F1)]
exact firstSub_eq H t ht F2 F1 (fun v hv => h v (List.Mem.tail u hv))
/-- Get by index with a default. -/
def getD {α : Type} (d : α) : List α -> Nat -> α
| [], _ => d
| a :: _, 0 => a
| _ :: l, n + 1 => getD d l n
/-- The pair formed by a queried vertex v and the answer u (pigeon first). -/
def mkPair (v u : Bool × Nat) : Nat × Nat := bsel v.1 (v.2, u.2) (u.2, v.2)
/-- Vertex v is matched in the path p. -/
def matchedB (v : Bool × Nat) (p : List (Nat × Nat)) : Bool := bsel v.1 (usedP p v.2) (usedH p v.2)
/-- Replay of the queries of a term: returns the new pairs (latest first), the unused answers
and the remaining budget. -/
def rp (C : List (Bool × Nat)) : List (Bool × Nat) -> List (Nat × Nat) -> List (Nat × Nat) -> List Nat -> Nat ->
List (Nat × Nat) × List Nat × Nat
| [], _, nw, ans, b => (nw, ans, b)
| _ :: _, _, nw, ans, 0 => (nw, ans, 0)
| _ :: _, _, nw, [], b + 1 => (nw, [], b + 1)
| v :: vs, p, nw, a :: ans, b + 1 =>
bsel (matchedB v (nw ++ p)) (rp C vs p nw (a :: ans) (b + 1))
(rp C vs p (mkPair v (getD (true, 0) C a) :: nw) ans b)
/-- The decoder. -/
def dec (F : List (List (Nat × Nat))) (FV : List (Bool × Nat)) :
List (List Nat) -> List (Nat × Nat) -> List (Nat × Nat) -> List Nat -> Nat -> List (Nat × Nat)
| [], H, p, _, _ => diffP H p
| mk :: masks, H, p, ans, b =>
match firstSub H F with
| none => []
| some t0 =>
let sg := selMask 2 t0 mk
let tau := diffP t0 (selMask 0 t0 mk)
let res := rp (vtx sg ++ FV) (vtx tau) p [] ans b
dec F FV masks (res.1 ++ diffP H sg) (res.1 ++ p) res.2.1 res.2.2
end Found.Pnp146
#print axioms Found.Pnp146.mem_diffP
#print axioms Found.Pnp146.diffP_mem
#print axioms Found.Pnp146.mem_selMask
#print axioms Found.Pnp146.firstSub_eq
lean_all/found/Pnp15.lean
/-
T330 piece 15. found/Pnp15 -- the machine-model laws alone do not separate P from NP
(a barrier for the abstract chain, in the spirit of relativization).
The laws of a machine model with output (Pnp3.OM: budget monotonicity, output bounded
by budget plus input, sequential composition) hold for the "all-functions" model,
whose programs are arbitrary maps on bit strings that run as soon as the budget covers
the output length. In that model every language is in P, so P = NP there. Hence the
separation O0o cannot follow from the OM laws together with the tool results Pnp3-Pnp4
(which hold for every OM): a proof of P != NP must use properties of a concrete model
(such as the Turing machine of Pnp12-Pnp14) that this model lacks.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp4
namespace Found.Pnp15
open Found.Pnp3
open Found.Pnp4
def runB : Bool -> List Bool -> Option (List Bool)
| true, y => some y
| false, _ => none
def runAll (p : List Bool -> List Bool) (t : Nat) (x : List Bool) : Option (List Bool) :=
runB (Nat.ble (p x).length (t + x.length)) (p x)
theorem runAll_inv (p : List Bool -> List Bool) (t : Nat) (x y : List Bool)
(h : runAll p t x = some y) : y = p x /\ (p x).length <= t + x.length := by
have h' : runB (Nat.ble (p x).length (t + x.length)) (p x) = some y := h
cases hb : Nat.ble (p x).length (t + x.length) with
| false => rw [hb] at h'; cases h'
| true =>
rw [hb] at h'
exact And.intro (Option.some.inj h').symm (Nat.le_of_ble_eq_true hb)
theorem runAll_of (p : List Bool -> List Bool) (t : Nat) (x : List Bool)
(h : (p x).length <= t + x.length) : runAll p t x = some (p x) := by
show runB (Nat.ble (p x).length (t + x.length)) (p x) = some (p x)
rw [Nat.ble_eq_true_of_le h]
rfl
theorem budget_comm (s t n : Nat) : s + (t + n) = t + s + n := by
rw [Nat.add_comm s (t + n), Nat.add_assoc t n s, Nat.add_comm n s, ← Nat.add_assoc]
/-- The all-functions machine model satisfies the OM laws. -/
def OMall : OM where
Prog := List Bool -> List Bool
run := runAll
seq := fun p q x => q (p x)
fuel_mono := fun p t t' x y h ht => by
have hi := runAll_inv p t x y h
rw [hi.1]
exact runAll_of p t' x (Nat.le_trans hi.2 (Nat.add_le_add_right ht x.length))
out_le := fun p t x y h => by
have hi := runAll_inv p t x y h
rw [hi.1]
exact hi.2
seq_run := fun p q t s x y z h1 h2 => by
have i1 := runAll_inv p t x y h1
have i2 := runAll_inv q s y z h2
rw [i2.1, i1.1]
rw [i1.1] at i2
apply runAll_of (fun x => q (p x)) (t + s) x
have hb : (q (p x)).length <= s + (t + x.length) :=
Nat.le_trans i2.2 (Nat.add_le_add_left i1.2 s)
rw [budget_comm] at hb
exact hb
/-- In the all-functions model every language is in P. -/
theorem all_in_P (L : List Bool -> Bool) : InPo OMall L :=
Exists.intro (fun x => [L x]) (Exists.intro (PE.c 1) (fun x =>
runAll_of (fun x => [L x]) 1 x (Nat.le_add_right 1 x.length)))
/-- Hence P = NP in that model: no language separates them. -/
theorem no_separation :
(Exists fun L : List Bool -> Bool => InNPo OMall L /\ (InPo OMall L -> False)) -> False :=
fun h => Exists.elim h fun L hL => hL.2 (all_in_P L)
end Found.Pnp15
#print axioms Found.Pnp15.runAll_inv
#print axioms Found.Pnp15.runAll_of
#print axioms Found.Pnp15.budget_comm
#print axioms Found.Pnp15.all_in_P
#print axioms Found.Pnp15.no_separation
lean_all/found/Pnp16.lean
/-
T330 piece 16. found/Pnp16 -- cut and paste for local machines (the base of crossing
sequence arguments; a tool, not used for the main conclusion).
For the width-W local machine (Pnp10): the cells left of a cut j0 < W evolve from their
own start and the history of the cut cell j0 only. If two runs agree on the cells left of
the cut and on the boundary cell at time 0, and the cut cell has the same bits at every
time before T, then the two runs agree on every cell left of the cut at every time <= T.
Locality is a property that an oracle machine lacks (an oracle query reads the whole
tape in one step), so arguments built on it do not relativize; how far they reach is
recorded in PNP_MAP.md. Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp10
import found.Pnp2
namespace Found.Pnp16
open Found.Pnp1 (read)
open Found.Pnp9 (leftIdx lt_succ_cases)
open Found.Pnp10 (Conf nbC stepW runW gate beq_refl read_ext_k)
theorem run_boundary (delta : List Bool -> Nat -> Bool) (k W t : Nat) (x : Conf) (b : Nat) :
runW delta k W (t + 1) x W b = false := by
show gate (Nat.beq W W) _ = false
rw [beq_refl W]
rfl
theorem nbC_eq (x y : Conf) (k W j : Nat)
(hl : forall b, b < k -> x (leftIdx W j) b = y (leftIdx W j) b)
(hc : forall b, b < k -> x j b = y j b)
(hr : forall b, b < k -> x (j + 1) b = y (j + 1) b) : nbC x k W j = nbC y k W j := by
show read (x (leftIdx W j)) 0 k ++ (read (x j) 0 k ++ read (x (j + 1)) 0 k) =
read (y (leftIdx W j)) 0 k ++ (read (y j) 0 k ++ read (y (j + 1)) 0 k)
rw [read_ext_k _ _ k hl, read_ext_k _ _ k hc, read_ext_k _ _ k hr]
/-- Cut and paste: the left of the cut depends only on its start and the cut's history. -/
theorem cut (delta : List Bool -> Nat -> Bool) (k W T j0 : Nat) (hj0 : j0 < W) (x y : Conf)
(h0 : forall j, j < j0 -> forall b, b < k -> x j b = y j b)
(hW : forall b, b < k -> x W b = y W b)
(hcol : forall t, t < T -> forall b, b < k -> runW delta k W t x j0 b = runW delta k W t y j0 b) :
forall t, t < T + 1 -> forall j, j < j0 -> forall b, b < k ->
runW delta k W t x j b = runW delta k W t y j b := by
intro t
induction t with
| zero => intro _; exact h0
| succ t ih =>
intro ht j hj b _
have ht' : t < T := Nat.lt_of_succ_lt_succ ht
have ih' := ih (Nat.lt_succ_of_lt ht')
have hjW : j < W := Nat.lt_trans hj hj0
-- the left neighbour: the boundary cell W for j = 0, cell j - 1 otherwise
have hl : forall b', b' < k -> runW delta k W t x (leftIdx W j) b' = runW delta k W t y (leftIdx W j) b' := by
intro b' hb'
cases j with
| zero =>
cases t with
| zero => exact hW b' hb'
| succ t => exact (run_boundary delta k W t x b').trans (run_boundary delta k W t y b').symm
| succ j => exact ih' j (Nat.lt_of_succ_lt hj) b' hb'
have hr : forall b', b' < k -> runW delta k W t x (j + 1) b' = runW delta k W t y (j + 1) b' := by
intro b' hb'
exact Or.elim (lt_succ_cases (j + 1) j0 (Nat.succ_lt_succ hj))
(fun h => ih' (j + 1) h b' hb')
(fun e => by rw [e]; exact hcol t ht' b' hb')
show gate (Nat.beq j W) (delta (nbC (runW delta k W t x) k W j) b) =
gate (Nat.beq j W) (delta (nbC (runW delta k W t y) k W j) b)
rw [nbC_eq _ _ k W j hl (ih' j hj) hr]
end Found.Pnp16
#print axioms Found.Pnp16.run_boundary
#print axioms Found.Pnp16.nbC_eq
#print axioms Found.Pnp16.cut
lean_all/found/Pnp17.lean
/-
T330 piece 17. found/Pnp17 -- a missing truth table (the counting step of the
Shannon-Riordan lower bound; exact-size side, a tool only).
Truth tables are bit lists. Proved:
* the 2^m bit lists of length m (Pnp8.allBits) are pairwise different;
* pigeonhole for lists of bit lists: a list of pairwise different tables that all occur
in A is not longer than A (by erasing one occurrence at a time);
* hence any list A of fewer than 2^m tables misses some table of length m, and the
missing table is found by a search (no classical logic).
With an enumeration of the functions computed by small formulas this gives functions
that need large formulas (O2). The property "needs many gates" is large, so by the
natural-proofs barrier this is not used for the main conclusion (PNP_MAP.md).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp9
namespace Found.Pnp17
open Found.Pnp8 (beqB beqB_refl beqB_eq and_l and_r allBits mapC InL allBits_len InL_mapC_inv InL_app_inv)
open Found.Pnp9 (pow2 length_allBits)
def eqL : List Bool -> List Bool -> Bool
| [], [] => true
| [], _ :: _ => false
| _ :: _, [] => false
| a :: as, b :: bs => beqB a b && eqL as bs
theorem eqL_refl : forall p : List Bool, eqL p p = true := by
intro p
induction p with
| nil => rfl
| cons a p ih =>
show (beqB a a && eqL p p) = true
rw [beqB_refl, ih]; rfl
theorem eqL_eq : forall p q : List Bool, eqL p q = true -> p = q := by
intro p
induction p with
| nil => intro q h; cases q with
| nil => rfl
| cons _ _ => exact Bool.noConfusion h
| cons a p ih => intro q h; cases q with
| nil => exact Bool.noConfusion h
| cons b q =>
have h' : (beqB a b && eqL p q) = true := h
rw [beqB_eq a b (and_l h'), ih q (and_r h')]
def memL (p : List Bool) : List (List Bool) -> Bool
| [] => false
| q :: A => eqL p q || memL p A
def pickE : Bool -> List (List Bool) -> List (List Bool) -> List (List Bool)
| true, a, _ => a
| false, _, b => b
def eraseL (x : List Bool) : List (List Bool) -> List (List Bool)
| [] => []
| q :: A => pickE (eqL x q) A (q :: eraseL x A)
theorem or_l {x y : Bool} (h : (x || y) = false) : x = false := by
cases x with
| false => rfl
| true => exact Bool.noConfusion h
theorem erase_len (x : List Bool) : forall A, memL x A = true -> (eraseL x A).length + 1 = A.length := by
intro A
induction A with
| nil => intro h; exact Bool.noConfusion h
| cons q A ih =>
intro h
have h' : (eqL x q || memL x A) = true := h
show (pickE (eqL x q) A (q :: eraseL x A)).length + 1 = A.length + 1
cases hq : eqL x q with
| true => rfl
| false => rw [hq] at h'; exact congrArg (fun t => t + 1) (ih h')
theorem mem_erase (x y : List Bool) (hxy : eqL x y = false) : forall A, memL y A = true -> memL y (eraseL x A) = true := by
intro A
induction A with
| nil => intro h; exact h
| cons q A ih =>
intro h
have h' : (eqL y q || memL y A) = true := h
show memL y (pickE (eqL x q) A (q :: eraseL x A)) = true
cases hq : eqL x q with
| true =>
cases hy : eqL y q with
| true =>
have e : x = y := (eqL_eq x q hq).trans (eqL_eq y q hy).symm
rw [e, eqL_refl] at hxy
exact Bool.noConfusion hxy
| false => rw [hy] at h'; exact h'
| false =>
show (eqL y q || memL y (eraseL x A)) = true
cases hy : eqL y q with
| true => rfl
| false => rw [hy] at h'; exact ih h'
theorem mem_of_InL (p : List Bool) : forall A, InL p A -> memL p A = true := by
intro A
induction A with
| nil => intro h; exact False.elim h
| cons q A ih =>
intro h
exact Or.elim h (fun e => by show (eqL p q || memL p A) = true; rw [e, eqL_refl]; rfl)
(fun h' => by
show (eqL p q || memL p A) = true
rw [ih h']
cases eqL p q <;> rfl)
/-! ## Pairwise different lists and the pigeonhole -/
def Nodup : List (List Bool) -> Prop
| [] => True
| x :: L => (forall y, InL y L -> eqL x y = false) /\ Nodup L
theorem pigeon : forall (L A : List (List Bool)), Nodup L ->
(forall y, InL y L -> memL y A = true) -> L.length <= A.length := by
intro L
induction L with
| nil => intro A _ _; exact Nat.zero_le _
| cons x L ih =>
intro A hn h
have hx : memL x A = true := h x (Or.inl rfl)
have hL : L.length <= (eraseL x A).length :=
ih (eraseL x A) hn.2 (fun y hy => mem_erase x y (hn.1 y hy) A (h y (Or.inr hy)))
have h2 : L.length + 1 <= (eraseL x A).length + 1 := Nat.succ_le_succ hL
rw [erase_len x A hx] at h2
exact h2
theorem nodup_mapC (b : Bool) : forall A, Nodup A -> Nodup (mapC b A) := by
intro A
induction A with
| nil => intro _; exact True.intro
| cons x A ih =>
intro h
apply And.intro
· intro y hy
exact Exists.elim (InL_mapC_inv b y A hy) fun z hz => by
rw [hz.1]
show (beqB b b && eqL x z) = false
rw [beqB_refl]
exact h.1 z hz.2
· exact ih h.2
theorem InL_app_l' (p : List Bool) (B : List (List Bool)) : forall A, InL p A -> InL p (A ++ B) :=
Found.Pnp8.InL_app_l p B
theorem nodup_app (B : List (List Bool)) (hB : Nodup B) : forall A, Nodup A ->
(forall x, InL x A -> forall y, InL y B -> eqL x y = false) -> Nodup (A ++ B) := by
intro A
induction A with
| nil => intro _ _; exact hB
| cons x A ih =>
intro hA hd
apply And.intro
· intro y hy
exact Or.elim (InL_app_inv y B A hy) (hA.1 y) (hd x (Or.inl rfl) y)
· exact ih hA.2 (fun x' hx' y hy => hd x' (Or.inr hx') y hy)
theorem nodup_allBits : forall m, Nodup (allBits m) := by
intro m
induction m with
| zero => exact And.intro (fun _ h => False.elim h) True.intro
| succ m ih =>
show Nodup (mapC false (allBits m) ++ mapC true (allBits m))
apply nodup_app _ (nodup_mapC true _ ih) _ (nodup_mapC false _ ih)
intro x hx y hy
exact Exists.elim (InL_mapC_inv false x _ hx) fun u hu =>
Exists.elim (InL_mapC_inv true y _ hy) fun v hv => by
rw [hu.1, hv.1]; rfl
/-! ## A missing table -/
def pickO : Bool -> Option (List Bool) -> Option (List Bool) -> Option (List Bool)
| true, a, _ => a
| false, _, b => b
def findMiss (A : List (List Bool)) : List (List Bool) -> Option (List Bool)
| [] => none
| p :: ps => pickO (memL p A) (findMiss A ps) (some p)
theorem findMiss_none (A : List (List Bool)) : forall L, findMiss A L = none ->
forall y, InL y L -> memL y A = true := by
intro L
induction L with
| nil => intro _ y hy; exact False.elim hy
| cons p L ih =>
intro h y hy
have h' : pickO (memL p A) (findMiss A L) (some p) = none := h
cases hp : memL p A with
| false => rw [hp] at h'; cases h'
| true =>
rw [hp] at h'
exact Or.elim hy (fun e => by rw [e]; exact hp) (fun hy' => ih h' y hy')
theorem findMiss_some (A : List (List Bool)) (q : List Bool) : forall L, findMiss A L = some q ->
InL q L /\ memL q A = false := by
intro L
induction L with
| nil => intro h; cases h
| cons p L ih =>
intro h
have h' : pickO (memL p A) (findMiss A L) (some p) = some q := h
cases hp : memL p A with
| true =>
rw [hp] at h'
have r := ih h'
exact And.intro (Or.inr r.1) r.2
| false =>
rw [hp] at h'
have e : p = q := Option.some.inj h'
rw [← e]
exact And.intro (Or.inl rfl) hp
/-- Fewer than 2^m tables miss some table of length m. -/
theorem missing (m : Nat) (A : List (List Bool)) (h : A.length < pow2 m) :
Exists fun p : List Bool => p.length = m /\ memL p A = false := by
cases hf : findMiss A (allBits m) with
| none =>
have hle := pigeon (allBits m) A (nodup_allBits m) (findMiss_none A (allBits m) hf)
rw [length_allBits] at hle
exact False.elim (Nat.lt_irrefl _ (Nat.lt_of_lt_of_le h hle))
| some p =>
have r := findMiss_some A p (allBits m) hf
exact Exists.intro p (And.intro (allBits_len m p r.1) r.2)
end Found.Pnp17
#print axioms Found.Pnp17.eqL_refl
#print axioms Found.Pnp17.eqL_eq
#print axioms Found.Pnp17.or_l
#print axioms Found.Pnp17.erase_len
#print axioms Found.Pnp17.mem_erase
#print axioms Found.Pnp17.mem_of_InL
#print axioms Found.Pnp17.pigeon
#print axioms Found.Pnp17.nodup_mapC
#print axioms Found.Pnp17.InL_app_l'
#print axioms Found.Pnp17.nodup_app
#print axioms Found.Pnp17.nodup_allBits
#print axioms Found.Pnp17.findMiss_none
#print axioms Found.Pnp17.findMiss_some
#print axioms Found.Pnp17.missing
lean_all/found/Pnp18.lean
/-
T330 piece 18. found/Pnp18 -- the Cook-Levin reduction map and its size (CL1, CL2).
A language decided by a one-tape Turing machine verifier (Pnp12-14): x is in L iff some
certificate tape, agreeing with the input written at fixed cells and false at the
boundary W(|x|), makes the machine (head at p0 + 1, state q0) hold true at cell 0 after
T(|x|) steps. The reduction map sends x to the tableau CNF with the layout and input
pins (Pnp14). Proved:
* CL1: x is in L iff the CNF of x is satisfiable (from Pnp14.cook_levin_tm);
* CL2: the CNF of x has exactly
T (W (k 2^(3k))) + (T + 1) k + (W (m + 1) + |input| + 1) clauses, k = m + 2,
and when T, W are polynomials of |x| (Pnp3.PE) and the input pins are |x| many, this
is a polynomial of |x| (an explicit PE).
Open (CL3): the map is computed in polynomial time by a Turing machine.
It relativizes (a tool). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp14
import found.Pnp3
namespace Found.Pnp18
open Found.Pnp3 (PE pe)
open Found.Pnp9 (tab tab_count pow2 length_app)
open Found.Pnp11 (full accCl pinCl)
open Found.Pnp12 (TM rule)
open Found.Pnp13 (TC tmRun Inside)
open Found.Pnp14 (allPins cellPins inPins InputOK pinsTM cook_levin_tm)
/-- The reduction map: x to the tableau CNF with layout and input pins. -/
def red (M : TM) (W T p0 : Nat) (q0 : List Bool) (inp : List (Nat × Bool)) :=
full (rule M) (M.m + 2) W T (pinsTM M W p0 q0 inp)
/-- CL1: membership iff satisfiability. -/
theorem cl1 (M : TM) (W T p0 : Nat) (q0 : List Bool) (hq0 : q0.length = M.m)
(hnext : forall a s, (M.next a s).length = M.m) (hp : p0 + 2 < W) (inp : List (Nat × Bool))
(hin : forall tape : Nat -> Bool, Inside M W T (TC.mk tape (p0 + 1) q0))
(Lx : Prop)
(hL : Lx <-> Exists fun tape : Nat -> Bool => InputOK tape inp /\ tape W = false /\
(tmRun M T (TC.mk tape (p0 + 1) q0)).tape 0 = true) :
(Lx -> Exists fun s => Found.Pnp8.cnfv s (red M W T p0 q0 inp) = true) /\
((Exists fun s => Found.Pnp8.cnfv s (red M W T p0 q0 inp) = true) -> Lx) :=
And.intro (fun h => (cook_levin_tm M W T p0 q0 hq0 hnext hp inp hin).2 (hL.mp h))
(fun h => hL.mpr ((cook_levin_tm M W T p0 q0 hq0 hnext hp inp hin).1 h))
/-! ## CL2: size -/
theorem length_cellPins (pos0 : Nat) (q0 : List Bool) (j : Nat) : forall i, (cellPins pos0 q0 j i).length = i + 1 := by
intro i
induction i with
| zero => rfl
| succ i ih =>
show (cellPins pos0 q0 j i ++ _).length = i + 1 + 1
rw [length_app, ih]; rfl
theorem length_allPins (pos0 : Nat) (q0 : List Bool) (m : Nat) : forall n, (allPins pos0 q0 m n).length = n * (m + 1) := by
intro n
induction n with
| zero => exact (Nat.zero_mul _).symm
| succ n ih =>
show (allPins pos0 q0 m n ++ cellPins pos0 q0 n m).length = (n + 1) * (m + 1)
rw [length_app, ih, length_cellPins, Nat.succ_mul]
theorem length_inPins : forall inp : List (Nat × Bool), (inPins inp).length = inp.length := by
intro inp
induction inp with
| nil => rfl
| cons e r ih =>
cases e with
| mk j v => exact congrArg (fun t => t + 1) ih
theorem length_pinCl : forall ps : List (Nat × (Nat × Bool)), (pinCl ps).length = ps.length := by
intro ps
induction ps with
| nil => rfl
| cons e r ih =>
cases e with
| mk j bv => cases bv with
| mk b v => exact congrArg (fun t => t + 1) ih
/-- CL2: the exact clause count of the reduction's CNF. -/
theorem cl2 (M : TM) (W T p0 : Nat) (q0 : List Bool) (inp : List (Nat × Bool)) :
(red M W T p0 q0 inp).length =
T * (W * ((M.m + 2) * pow2 ((M.m + 2) + ((M.m + 2) + (M.m + 2))))) + (T + 1) * (M.m + 2) +
(W * (M.m + 1) + inp.length + 1) := by
show (tab (rule M) (M.m + 2) W T ++ (accCl T :: pinCl (pinsTM M W p0 q0 inp))).length = _
rw [length_app, tab_count]
show _ + ((pinCl (allPins (p0 + 1) q0 M.m W ++ inPins inp)).length + 1) = _
rw [length_pinCl, length_app, length_allPins, length_inPins]
/-- The count as a polynomial of the input length n, when T = eT(n), W = eW(n) and there
are n input pins. -/
def sizePE (M : TM) (eT eW : PE) : PE :=
.add (.add (.mul eT (.mul eW (.c ((M.m + 2) * pow2 ((M.m + 2) + ((M.m + 2) + (M.m + 2)))))))
(.mul (.add eT (.c 1)) (.c (M.m + 2))))
(.add (.add (.mul eW (.c (M.m + 1))) .x) (.c 1))
theorem cl2_poly (M : TM) (eT eW : PE) (p0 : Nat) (q0 : List Bool) (inp : List (Nat × Bool)) (n : Nat)
(hn : inp.length = n) :
(red M (pe eW n) (pe eT n) p0 q0 inp).length = pe (sizePE M eT eW) n := by
rw [cl2, hn]
rfl
end Found.Pnp18
#print axioms Found.Pnp18.cl1
#print axioms Found.Pnp18.length_cellPins
#print axioms Found.Pnp18.length_allPins
#print axioms Found.Pnp18.length_inPins
#print axioms Found.Pnp18.length_pinCl
#print axioms Found.Pnp18.cl2
#print axioms Found.Pnp18.cl2_poly
lean_all/found/Pnp19.lean
/-
T330 piece 19. found/Pnp19 -- bit encoding of CNFs (Cook-Levin CL3a).
A CNF over variables (t, (j, b)) is written as a bit string: numbers in unary
(n ones then a zero), a literal as its polarity bit and its three numbers, a clause as
its literals each after a 1 and a closing 0, a CNF as its clauses each after a 1 and a
closing 0. Proved: decoding inverts encoding (so the encoding is injective), and hence
the bit language SAT = { y : y encodes a satisfiable CNF } contains enc (red x) exactly
when x is in the verifier's language (with Pnp18.cl1). The unary numbers keep the size
polynomial for the reduction (variables are below T, W, k). Written with ASCII forms
only. CIC dependence: none.
-/
import found.Pnp9
namespace Found.Pnp19
open Found.Pnp8 (cnfv)
open Found.Pnp9 (V)
/-! ## Encoding -/
def un : Nat -> List Bool
| 0 => [false]
| n + 1 => true :: un n
def encLit (l : Bool × V) : List Bool := l.1 :: (un l.2.1 ++ (un l.2.2.1 ++ un l.2.2.2))
def encCl : List (Bool × V) -> List Bool
| [] => [false]
| l :: c => true :: (encLit l ++ encCl c)
def encCNF : List (List (Bool × V)) -> List Bool
| [] => [false]
| c :: f => true :: (encCl c ++ encCNF f)
/-! ## Decoding -/
def bindN (o : Option (Nat × List Bool)) : Option (Nat × List Bool) :=
match o with
| some (n, r) => some (n + 1, r)
| none => none
def decUn : List Bool -> Option (Nat × List Bool)
| [] => none
| false :: r => some (0, r)
| true :: r => bindN (decUn r)
theorem app_assoc' {α : Type} (A B C : List α) : (A ++ B) ++ C = A ++ (B ++ C) := by
induction A with
| nil => rfl
| cons a A ih => exact congrArg (fun t => a :: t) ih
theorem decUn_un (r : List Bool) : forall n, decUn (un n ++ r) = some (n, r) := by
intro n
induction n with
| zero => rfl
| succ n ih =>
show bindN (decUn (un n ++ r)) = some (n + 1, r)
rw [ih]; rfl
def decLit (y : List Bool) : Option ((Bool × V) × List Bool) :=
match y with
| [] => none
| p :: r =>
match decUn r with
| none => none
| some (t, r1) =>
match decUn r1 with
| none => none
| some (j, r2) =>
match decUn r2 with
| none => none
| some (b, r3) => some ((p, (t, (j, b))), r3)
theorem decLit_enc (l : Bool × V) (r : List Bool) : decLit (encLit l ++ r) = some (l, r) := by
cases l with
| mk p v =>
cases v with
| mk t jb =>
cases jb with
| mk j b =>
show decLit (p :: ((un t ++ (un j ++ un b)) ++ r)) = some ((p, (t, (j, b))), r)
rw [app_assoc', app_assoc']
show (match decUn (un t ++ (un j ++ (un b ++ r))) with
| none => none
| some (t', r1) =>
match decUn r1 with
| none => none
| some (j', r2) =>
match decUn r2 with
| none => none
| some (b', r3) => some ((p, (t', (j', b'))), r3)) = _
rw [decUn_un]
show (match decUn (un j ++ (un b ++ r)) with
| none => none
| some (j', r2) =>
match decUn r2 with
| none => none
| some (b', r3) => some ((p, (t, (j', b'))), r3)) = _
rw [decUn_un]
show (match decUn (un b ++ r) with
| none => none
| some (b', r3) => some ((p, (t, (j, b'))), r3)) = _
rw [decUn_un]
try rfl
/-- Decoding with fuel (the fuel bounds the number of items; the input length is enough). -/
def decCl : Nat -> List Bool -> Option (List (Bool × V) × List Bool)
| 0, _ => none
| _ + 1, [] => none
| _ + 1, false :: r => some ([], r)
| fuel + 1, true :: r =>
match decLit r with
| none => none
| some (l, r1) =>
match decCl fuel r1 with
| none => none
| some (c, r2) => some (l :: c, r2)
def decCNF : Nat -> List Bool -> Option (List (List (Bool × V)) × List Bool)
| 0, _ => none
| _ + 1, [] => none
| _ + 1, false :: r => some ([], r)
| fuel + 1, true :: r =>
match decCl fuel r with
| none => none
| some (c, r1) =>
match decCNF fuel r1 with
| none => none
| some (f, r2) => some (c :: f, r2)
theorem decCl_enc (r : List Bool) : forall (c : List (Bool × V)) (fuel : Nat), c.length < fuel ->
decCl fuel (encCl c ++ r) = some (c, r) := by
intro c
induction c with
| nil => intro fuel h; cases fuel with
| zero => exact False.elim (Nat.not_lt_zero _ h)
| succ fuel => rfl
| cons l c ih => intro fuel h; cases fuel with
| zero => exact False.elim (Nat.not_lt_zero _ h)
| succ fuel =>
show (match decLit ((encLit l ++ encCl c) ++ r) with
| none => none
| some (l, r1) =>
match decCl fuel r1 with
| none => none
| some (c, r2) => some (l :: c, r2)) = some (l :: c, r)
rw [app_assoc', decLit_enc]
show (match decCl fuel (encCl c ++ r) with
| none => none
| some (c', r2) => some (l :: c', r2)) = some (l :: c, r)
rw [ih fuel (Nat.lt_of_succ_lt_succ h)]
try rfl
theorem len_encCl : forall c : List (Bool × V), c.length < (encCl c).length := by
intro c
induction c with
| nil => exact Nat.zero_lt_succ 0
| cons l c ih =>
show c.length + 1 < (encLit l ++ encCl c).length + 1
apply Nat.succ_lt_succ
rw [Found.Pnp9.length_app]
exact Nat.lt_of_lt_of_le ih (Nat.le_add_left _ _)
theorem decCNF_enc (r : List Bool) : forall (f : List (List (Bool × V))) (fuel : Nat),
(encCNF f).length <= fuel -> decCNF fuel (encCNF f ++ r) = some (f, r) := by
intro f
induction f with
| nil => intro fuel h; cases fuel with
| zero => exact False.elim (Nat.not_succ_le_zero _ h)
| succ fuel => rfl
| cons c f ih => intro fuel h; cases fuel with
| zero => exact False.elim (Nat.not_succ_le_zero _ h)
| succ fuel =>
have h' : (encCl c ++ encCNF f).length <= fuel := Nat.le_of_succ_le_succ h
rw [Found.Pnp9.length_app] at h'
show (match decCl fuel ((encCl c ++ encCNF f) ++ r) with
| none => none
| some (c, r1) =>
match decCNF fuel r1 with
| none => none
| some (f, r2) => some (c :: f, r2)) = some (c :: f, r)
rw [app_assoc', decCl_enc (encCNF f ++ r) c fuel
(Nat.lt_of_lt_of_le (len_encCl c) (Nat.le_trans (Nat.le_add_right _ _) h'))]
show (match decCNF fuel (encCNF f ++ r) with
| none => none
| some (f', r2) => some (c :: f', r2)) = some (c :: f, r)
rw [ih fuel (Nat.le_trans (Nat.le_add_left _ _) h')]
try rfl
/-- Decoding the whole string. -/
def decode (y : List Bool) : Option (List (List (Bool × V)) × List Bool) := decCNF y.length y
theorem app_nil' {α : Type} : forall A : List α, A ++ [] = A := by
intro A
induction A with
| nil => rfl
| cons a A ih => exact congrArg (fun t => a :: t) ih
theorem decode_enc (f : List (List (Bool × V))) : decode (encCNF f) = some (f, []) := by
have h := decCNF_enc [] f (encCNF f).length (Nat.le_refl _)
rw [app_nil'] at h
exact h
/-- The encoding is injective. -/
theorem enc_inj (f g : List (List (Bool × V))) (h : encCNF f = encCNF g) : f = g := by
have hf := decode_enc f
rw [h, decode_enc g] at hf
exact (congrArg Prod.fst (Option.some.inj hf)).symm
/-! ## The bit language SAT -/
def SatB (y : List Bool) : Prop :=
Exists fun f : List (List (Bool × V)) => encCNF f = y /\ Exists fun s : V -> Bool => cnfv s f = true
theorem satB_enc (f : List (List (Bool × V))) :
(SatB (encCNF f) -> Exists fun s : V -> Bool => cnfv s f = true) /\
((Exists fun s : V -> Bool => cnfv s f = true) -> SatB (encCNF f)) :=
And.intro (fun h => Exists.elim h fun g hg => by rw [enc_inj g f hg.1] at hg; exact hg.2)
(fun h => Exists.intro f (And.intro rfl h))
end Found.Pnp19
#print axioms Found.Pnp19.app_assoc'
#print axioms Found.Pnp19.decUn_un
#print axioms Found.Pnp19.decLit_enc
#print axioms Found.Pnp19.decCl_enc
#print axioms Found.Pnp19.len_encCl
#print axioms Found.Pnp19.decCNF_enc
#print axioms Found.Pnp19.app_nil'
#print axioms Found.Pnp19.decode_enc
#print axioms Found.Pnp19.enc_inj
#print axioms Found.Pnp19.satB_enc
lean_all/found/Pnp2.lean
/-
T330 piece 2. found/Pnp2 -- leaves of a formula versus the variables it depends on.
Tool result (exact-size side; not used for the main conclusion):
* the variable list of a formula; mentions i F = memb i (vars F);
* pigeonhole: a list that contains every i < n has length at least n
(by erasing one occurrence of n, structural recursion only);
* leaves = gates + 1, and the variable list is not longer than the leaves;
* hence a formula for a function that depends on every variable i < n has at least
n - 1 binary gates: n <= gates F + 1.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp1
namespace Found.Pnp2
open Found.Pnp1
/-! ## Nat.beq -/
theorem beq_eq : forall a b : Nat, Nat.beq a b = true -> a = b := by
intro a
induction a with
| zero => intro b h; cases b with
| zero => rfl
| succ b => exact Bool.noConfusion h
| succ a ih => intro b h; cases b with
| zero => exact Bool.noConfusion h
| succ b => exact congrArg Nat.succ (ih b h)
theorem beq_false_of_ne (a b : Nat) (hne : a = b -> False) : Nat.beq a b = false := by
cases h : Nat.beq a b with
| false => rfl
| true => exact False.elim (hne (beq_eq a b h))
/-! ## Membership and erasure -/
def memb (i : Nat) : List Nat -> Bool
| [] => false
| j :: l => Nat.beq i j || memb i l
def pick : Bool -> List Nat -> List Nat -> List Nat
| true, a, _ => a
| false, _, b => b
def erase (n : Nat) : List Nat -> List Nat
| [] => []
| j :: l => pick (Nat.beq n j) l (j :: erase n l)
theorem erase_length (n : Nat) : forall L : List Nat, memb n L = true ->
(erase n L).length + 1 = L.length := by
intro L
induction L with
| nil => intro h; exact Bool.noConfusion h
| cons j l ih =>
intro h
have h' : (Nat.beq n j || memb n l) = true := h
show (pick (Nat.beq n j) l (j :: erase n l)).length + 1 = l.length + 1
cases hb : Nat.beq n j with
| true => rfl
| false =>
rw [hb] at h'
exact congrArg (fun t => t + 1) (ih h')
theorem memb_erase (n i : Nat) (hni : Nat.beq n i = false) :
forall L : List Nat, memb i L = true -> memb i (erase n L) = true := by
intro L
induction L with
| nil => intro h; exact h
| cons j l ih =>
intro h
have h' : (Nat.beq i j || memb i l) = true := h
show memb i (pick (Nat.beq n j) l (j :: erase n l)) = true
cases hb : Nat.beq n j with
| true =>
cases hij : Nat.beq i j with
| true =>
have e1 : i = j := beq_eq i j hij
have e3 : Nat.beq n i = true := by rw [e1]; exact hb
exact Bool.noConfusion (hni.symm.trans e3)
| false =>
rw [hij] at h'
exact h'
| false =>
show (Nat.beq i j || memb i (erase n l)) = true
cases hij : Nat.beq i j with
| true => rfl
| false =>
rw [hij] at h'
exact ih h'
/-- Pigeonhole: a list containing every i < n has length at least n. -/
theorem length_ge : forall (n : Nat) (L : List Nat),
(forall i, i < n -> memb i L = true) -> n <= L.length := by
intro n
induction n with
| zero => intro L _; exact Nat.zero_le _
| succ n ih =>
intro L h
have hn : memb n L = true := h n (Nat.lt_succ_self n)
have h2 : forall i, i < n -> memb i (erase n L) = true := fun i hi =>
memb_erase n i (beq_false_of_ne n i (fun e => Nat.ne_of_lt hi e.symm)) L
(h i (Nat.lt_succ_of_lt hi))
have h3 : n + 1 <= (erase n L).length + 1 := Nat.succ_le_succ (ih (erase n L) h2)
rw [erase_length n L hn] at h3
exact h3
/-! ## Variables and leaves of a formula -/
def vars : Fm -> List Nat
| .var i => [i]
| .cst _ => []
| .neg f => vars f
| .and f g => vars f ++ vars g
| .or f g => vars f ++ vars g
def leaves : Fm -> Nat
| .var _ => 1
| .cst _ => 1
| .neg f => leaves f
| .and f g => leaves f + leaves g
| .or f g => leaves f + leaves g
theorem or_assoc' (x y z : Bool) : ((x || y) || z) = (x || (y || z)) := by
cases x <;> rfl
theorem memb_append (i : Nat) (l2 : List Nat) : forall l1 : List Nat,
memb i (l1 ++ l2) = (memb i l1 || memb i l2) := by
intro l1
induction l1 with
| nil => rfl
| cons j l ih =>
show (Nat.beq i j || memb i (l ++ l2)) = ((Nat.beq i j || memb i l) || memb i l2)
rw [ih, or_assoc']
theorem or_false_r' (x : Bool) : (x || false) = x := by cases x <;> rfl
theorem mentions_memb (i : Nat) : forall F : Fm, mentions i F = memb i (vars F) := by
intro F
induction F with
| var j => exact (or_false_r' (Nat.beq i j)).symm
| cst _ => rfl
| neg f ih => exact ih
| and f g ihf ihg =>
show (mentions i f || mentions i g) = memb i (vars f ++ vars g)
rw [memb_append, ihf, ihg]
| or f g ihf ihg =>
show (mentions i f || mentions i g) = memb i (vars f ++ vars g)
rw [memb_append, ihf, ihg]
theorem length_append' (l2 : List Nat) : forall l1 : List Nat,
(l1 ++ l2).length = l1.length + l2.length := by
intro l1
induction l1 with
| nil => exact (Nat.zero_add _).symm
| cons j l ih =>
show (l ++ l2).length + 1 = (l.length + 1) + l2.length
rw [ih]
exact (Nat.succ_add _ _).symm
theorem vars_le_leaves : forall F : Fm, (vars F).length <= leaves F := by
intro F
induction F with
| var _ => exact Nat.le_refl 1
| cst _ => exact Nat.zero_le 1
| neg f ih => exact ih
| and f g ihf ihg =>
show (vars f ++ vars g).length <= leaves f + leaves g
rw [length_append']
exact Nat.add_le_add ihf ihg
| or f g ihf ihg =>
show (vars f ++ vars g).length <= leaves f + leaves g
rw [length_append']
exact Nat.add_le_add ihf ihg
theorem leaf_step (x y : Nat) : (x + 1) + (y + 1) = (x + y + 1) + 1 :=
congrArg Nat.succ (Nat.succ_add x y)
theorem leaves_gates : forall F : Fm, leaves F = gates F + 1 := by
intro F
induction F with
| var _ => rfl
| cst _ => rfl
| neg f ih => exact ih
| and f g ihf ihg =>
show leaves f + leaves g = (gates f + gates g + 1) + 1
rw [ihf, ihg]
exact leaf_step _ _
| or f g ihf ihg =>
show leaves f + leaves g = (gates f + gates g + 1) + 1
rw [ihf, ihg]
exact leaf_step _ _
/-- A formula for a function that depends on every variable i < n has at least n - 1
binary gates. -/
theorem gates_lower (n : Nat) (g : (Nat -> Bool) -> Bool) (F : Fm)
(hF : forall a, ev a F = g a) (hd : forall i, i < n -> Depends i g) :
n <= gates F + 1 := by
have h1 : forall i, i < n -> memb i (vars F) = true := fun i hi =>
(mentions_memb i F).symm.trans (mentions_of_depends i g F hF (hd i hi))
have h2 : n <= (vars F).length := length_ge n (vars F) h1
have h3 : n <= leaves F := Nat.le_trans h2 (vars_le_leaves F)
rw [leaves_gates] at h3
exact h3
end Found.Pnp2
#print axioms Found.Pnp2.beq_eq
#print axioms Found.Pnp2.beq_false_of_ne
#print axioms Found.Pnp2.erase_length
#print axioms Found.Pnp2.memb_erase
#print axioms Found.Pnp2.length_ge
#print axioms Found.Pnp2.or_assoc'
#print axioms Found.Pnp2.memb_append
#print axioms Found.Pnp2.or_false_r'
#print axioms Found.Pnp2.mentions_memb
#print axioms Found.Pnp2.length_append'
#print axioms Found.Pnp2.vars_le_leaves
#print axioms Found.Pnp2.leaf_step
#print axioms Found.Pnp2.leaves_gates
#print axioms Found.Pnp2.gates_lower
lean_all/found/Pnp20.lean
/-
T330 piece 20. found/Pnp20 -- a register machine for computing the reduction (CL3b, 1).
To show that the Cook-Levin map x |-> enc (red x) is computed in polynomial time, it is
first programmed on a machine that is easy to program: registers holding bit lists,
with three instructions -- push a bit on a register, pop a register and jump on what was
there (empty / 0 / 1), and jump. A program halts when the counter leaves the program.
(The register machine is simulated by a Turing machine with polynomial overhead: open,
CL3c.) Proved here:
* register updates and the step function, with extensionality (pointwise registers,
no funext): runs from pointwise equal configurations stay pointwise equal;
* the first program, MOVE r s: moves register r onto s reversed, in exactly
3 |r| + 1 steps, leaving every other register unchanged.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp2
namespace Found.Pnp20
inductive Ins where
| push : Nat -> Bool -> Ins
| pop : Nat -> Nat -> Nat -> Nat -> Ins -- register, target if empty, if 0, if 1
| jmp : Nat -> Ins
structure Cfg where
pc : Nat
regs : Nat -> List Bool
def selR : Bool -> List Bool -> List Bool -> List Bool
| true, v, _ => v
| false, _, w => w
/-- Register r set to v. -/
def upd (regs : Nat -> List Bool) (r : Nat) (v : List Bool) : Nat -> List Bool :=
fun i => selR (Nat.beq i r) v (regs i)
def nthI : List Ins -> Nat -> Option Ins
| [], _ => none
| i :: _, 0 => some i
| _ :: p, n + 1 => nthI p n
def popTo (c : Cfg) (r e z o : Nat) : List Bool -> Cfg
| [] => Cfg.mk e c.regs
| false :: t => Cfg.mk z (upd c.regs r t)
| true :: t => Cfg.mk o (upd c.regs r t)
def exec (c : Cfg) : Option Ins -> Cfg
| none => c
| some (.push r b) => Cfg.mk (c.pc + 1) (upd c.regs r (b :: c.regs r))
| some (.pop r e z o) => popTo c r e z o (c.regs r)
| some (.jmp l) => Cfg.mk l c.regs
def step (p : List Ins) (c : Cfg) : Cfg := exec c (nthI p c.pc)
def run (p : List Ins) : Nat -> Cfg -> Cfg
| 0, c => c
| n + 1, c => run p n (step p c)
/-- Pointwise equal configurations. -/
def Eqv (c d : Cfg) : Prop := c.pc = d.pc /\ forall i, c.regs i = d.regs i
theorem upd_eqv (x y : Nat -> List Bool) (h : forall i, x i = y i) (r : Nat) (v : List Bool) :
forall i, upd x r v i = upd y r v i := by
intro i
show selR (Nat.beq i r) v (x i) = selR (Nat.beq i r) v (y i)
rw [h i]
theorem step_eqv (p : List Ins) (c d : Cfg) (h : Eqv c d) : Eqv (step p c) (step p d) := by
cases c with
| mk pc x =>
cases d with
| mk pd y =>
have e : pc = pd := h.1
subst e
show Eqv (exec (Cfg.mk pc x) (nthI p pc)) (exec (Cfg.mk pc y) (nthI p pc))
cases nthI p pc with
| none => exact h
| some ins =>
cases ins with
| push r b =>
refine And.intro rfl (fun i => ?_)
show upd x r (b :: x r) i = upd y r (b :: y r) i
have hxy : x r = y r := h.2 r
rw [hxy]; exact upd_eqv x y h.2 r _ i
| pop r e z o =>
show Eqv (popTo (Cfg.mk pc x) r e z o (x r)) (popTo (Cfg.mk pc y) r e z o (y r))
have hxy : x r = y r := h.2 r
rw [hxy]
cases y r with
| nil => exact And.intro rfl h.2
| cons b t =>
cases b with
| false => exact And.intro rfl (upd_eqv x y h.2 r t)
| true => exact And.intro rfl (upd_eqv x y h.2 r t)
| jmp l => exact And.intro rfl h.2
theorem run_eqv (p : List Ins) : forall n (c d : Cfg), Eqv c d -> Eqv (run p n c) (run p n d) := by
intro n
induction n with
| zero => intro c d h; exact h
| succ n ih => intro c d h; exact ih _ _ (step_eqv p c d h)
theorem run_add (p : List Ins) : forall m n (c : Cfg), run p (m + n) c = run p n (run p m c) := by
intro m
induction m with
| zero => intro n c; rw [Nat.zero_add]; rfl
| succ m ih =>
intro n c
rw [Nat.add_right_comm m 1 n]
exact ih n (step p c)
/-! ## MOVE r s -/
/-- MOVE r s: pop r; on 0 push 0 on s and loop; on 1 push 1 on s and loop; on empty stop. -/
def move (r s : Nat) : List Ins :=
[.pop r 5 1 3, .push s false, .jmp 0, .push s true, .jmp 0]
def revApp : List Bool -> List Bool -> List Bool
| [], m => m
| b :: l, m => revApp l (b :: m)
theorem beq_refl' : forall n : Nat, Nat.beq n n = true := by
intro n
induction n with
| zero => rfl
| succ n ih => exact ih
theorem upd_same (x : Nat -> List Bool) (r : Nat) (v : List Bool) : upd x r v r = v := by
show selR (Nat.beq r r) v (x r) = v
rw [beq_refl']; rfl
theorem upd_other (x : Nat -> List Bool) (r i : Nat) (v : List Bool) (h : Nat.beq i r = false) : upd x r v i = x i := by
show selR (Nat.beq i r) v (x i) = x i
rw [h]; rfl
/-- MOVE r s from the start, with r holding l and s holding m: after 3 |l| + 1 steps the
counter is 5 (halted), r is empty, s holds the reverse of l in front of m, and every other
register is as it was. -/
theorem move_run (r s : Nat) (hrs : Nat.beq r s = false) : forall (l m : List Bool) (x : Nat -> List Bool),
x r = l -> x s = m ->
(run (move r s) (3 * l.length + 1) (Cfg.mk 0 x)).pc = 5 /\
(run (move r s) (3 * l.length + 1) (Cfg.mk 0 x)).regs r = [] /\
(run (move r s) (3 * l.length + 1) (Cfg.mk 0 x)).regs s = revApp l m /\
(forall i, Nat.beq i r = false -> Nat.beq i s = false ->
(run (move r s) (3 * l.length + 1) (Cfg.mk 0 x)).regs i = x i) := by
have hsr : Nat.beq s r = false :=
Found.Pnp2.beq_false_of_ne s r (fun e => by rw [e, beq_refl'] at hrs; exact Bool.noConfusion hrs)
intro l
induction l with
| nil =>
intro m x hr hs
have e : step (move r s) (Cfg.mk 0 x) = Cfg.mk 5 x := by
show popTo (Cfg.mk 0 x) r 5 1 3 (x r) = Cfg.mk 5 x
rw [hr]; rfl
have e1 : run (move r s) (3 * ([] : List Bool).length + 1) (Cfg.mk 0 x) = Cfg.mk 5 x := by
show run (move r s) 0 (step (move r s) (Cfg.mk 0 x)) = Cfg.mk 5 x
rw [e]; rfl
rw [e1]
exact And.intro rfl (And.intro hr (And.intro hs (fun i _ _ => rfl)))
| cons b l ih =>
intro m x hr hs
-- three steps: pop, push, jump
have e : run (move r s) 3 (Cfg.mk 0 x) = Cfg.mk 0 (upd (upd x r l) s (b :: upd x r l s)) := by
show run (move r s) 2 (popTo (Cfg.mk 0 x) r 5 1 3 (x r)) = _
rw [hr]
cases b with
| false => rfl
| true => rfl
have hlen : 3 * (b :: l).length + 1 = 3 + (3 * l.length + 1) := by
show 3 * (l.length + 1) + 1 = 3 + (3 * l.length + 1)
rw [Nat.left_distrib, Nat.mul_one, Nat.add_comm (3 * l.length) 3, Nat.add_assoc]
have hx2r : upd (upd x r l) s (b :: upd x r l s) r = l := by
rw [upd_other (upd x r l) s r _ hrs]; exact upd_same x r l
have hx2s : upd (upd x r l) s (b :: upd x r l s) s = b :: m := by
rw [upd_same, upd_other x r s l hsr, hs]
have hrec := ih (b :: m) _ hx2r hx2s
rw [hlen, run_add, e]
refine And.intro hrec.1 (And.intro hrec.2.1 (And.intro hrec.2.2.1 (fun i hir his => ?_)))
rw [hrec.2.2.2 i hir his, upd_other (upd x r l) s i _ his]
exact upd_other x r i l hir
end Found.Pnp20
#print axioms Found.Pnp20.upd_eqv
#print axioms Found.Pnp20.step_eqv
#print axioms Found.Pnp20.run_eqv
#print axioms Found.Pnp20.run_add
#print axioms Found.Pnp20.beq_refl'
#print axioms Found.Pnp20.upd_same
#print axioms Found.Pnp20.upd_other
#print axioms Found.Pnp20.move_run
lean_all/found/Pnp21.lean
/-
T330 piece 21. found/Pnp21 -- code fragments: programs placed at an offset inside a
larger program (CL3b, 2).
A fragment P sits at offset o in a program prog when every instruction of P, with its
jump targets moved by o, is in prog at o + i. A fragment theorem then holds in every
program that contains the fragment, and fragments placed one after another compose by
adding their step counts (Pnp20.run_add) -- no "first exit time" is needed. Proved:
* sequencing two fragment runs;
* the MOVE fragment at any offset (3 |l| + 1 steps, from o to o + 5);
* the EMIT fragment (push a fixed bit list, one step per bit).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp20
namespace Found.Pnp21
open Found.Pnp20
def shift (o : Nat) : Ins -> Ins
| .push r b => .push r b
| .pop r e z w => .pop r (o + e) (o + z) (o + w)
| .jmp l => .jmp (o + l)
/-- P sits at offset o in prog. -/
def Frag (prog : List Ins) (o : Nat) (P : List Ins) : Prop :=
forall i ins, nthI P i = some ins -> nthI prog (o + i) = some (shift o ins)
/-- A fragment run: from pc o with registers x, n steps reach pc o' with registers y
(pointwise). -/
def Runs (prog : List Ins) (n o : Nat) (x : Nat -> List Bool) (o' : Nat) (y : Nat -> List Bool) : Prop :=
(run prog n (Cfg.mk o x)).pc = o' /\ forall i, (run prog n (Cfg.mk o x)).regs i = y i
theorem runs_seq (prog : List Ins) (n1 n2 o1 o2 o3 : Nat) (x y z : Nat -> List Bool)
(h1 : Runs prog n1 o1 x o2 y) (h2 : Runs prog n2 o2 y o3 z) : Runs prog (n1 + n2) o1 x o3 z := by
have e : Eqv (run prog n1 (Cfg.mk o1 x)) (Cfg.mk o2 y) := And.intro h1.1 h1.2
have e2 := run_eqv prog n2 _ _ e
show (run prog (n1 + n2) (Cfg.mk o1 x)).pc = o3 /\ forall i, (run prog (n1 + n2) (Cfg.mk o1 x)).regs i = z i
rw [run_add]
exact And.intro (e2.1.trans h2.1) (fun i => (e2.2 i).trans (h2.2 i))
/-- Runs depend on the registers only pointwise. -/
theorem runs_congr (prog : List Ins) (n o o' : Nat) (x x' y : Nat -> List Bool) (hx : forall i, x i = x' i)
(h : Runs prog n o x' o' y) : Runs prog n o x o' y := by
have e := run_eqv prog n (Cfg.mk o x) (Cfg.mk o x') (And.intro rfl hx)
exact And.intro (e.1.trans h.1) (fun i => (e.2 i).trans (h.2 i))
/-! ## MOVE at an offset -/
theorem frag_move_run (prog : List Ins) (o r s : Nat) (hf : Frag prog o (move r s)) (hrs : Nat.beq r s = false) :
forall (l m : List Bool) (x : Nat -> List Bool), x r = l -> x s = m ->
(run prog (3 * l.length + 1) (Cfg.mk o x)).pc = o + 5 /\
(run prog (3 * l.length + 1) (Cfg.mk o x)).regs r = [] /\
(run prog (3 * l.length + 1) (Cfg.mk o x)).regs s = revApp l m /\
(forall i, Nat.beq i r = false -> Nat.beq i s = false ->
(run prog (3 * l.length + 1) (Cfg.mk o x)).regs i = x i) := by
have hsr : Nat.beq s r = false :=
Found.Pnp2.beq_false_of_ne s r (fun e => by rw [e, beq_refl'] at hrs; exact Bool.noConfusion hrs)
have i0 : nthI prog o = some (.pop r (o + 5) (o + 1) (o + 3)) := hf 0 _ rfl
have i1 : nthI prog (o + 1) = some (.push s false) := hf 1 _ rfl
have i2 : nthI prog (o + 2) = some (.jmp (o + 0)) := hf 2 _ rfl
have i3 : nthI prog (o + 3) = some (.push s true) := hf 3 _ rfl
have i4 : nthI prog (o + 4) = some (.jmp (o + 0)) := hf 4 _ rfl
intro l
induction l with
| nil =>
intro m x hr hs
have e1 : run prog (3 * ([] : List Bool).length + 1) (Cfg.mk o x) = Cfg.mk (o + 5) x := by
show run prog 0 (exec (Cfg.mk o x) (nthI prog o)) = _
rw [i0]
show popTo (Cfg.mk o x) r (o + 5) (o + 1) (o + 3) (x r) = _
rw [hr]; rfl
rw [e1]
exact And.intro rfl (And.intro hr (And.intro hs (fun i _ _ => rfl)))
| cons b l ih =>
intro m x hr hs
have e : run prog 3 (Cfg.mk o x) = Cfg.mk o (upd (upd x r l) s (b :: upd x r l s)) := by
show run prog 2 (exec (Cfg.mk o x) (nthI prog o)) = _
rw [i0]
show run prog 2 (popTo (Cfg.mk o x) r (o + 5) (o + 1) (o + 3) (x r)) = _
rw [hr]
cases b with
| false =>
show run prog 1 (exec (Cfg.mk (o + 1) (upd x r l)) (nthI prog (o + 1))) = _
rw [i1]
show run prog 0 (exec (Cfg.mk (o + 1 + 1) (upd (upd x r l) s (false :: upd x r l s))) (nthI prog (o + 2))) = _
rw [i2]; rfl
| true =>
show run prog 1 (exec (Cfg.mk (o + 3) (upd x r l)) (nthI prog (o + 3))) = _
rw [i3]
show run prog 0 (exec (Cfg.mk (o + 3 + 1) (upd (upd x r l) s (true :: upd x r l s))) (nthI prog (o + 4))) = _
rw [i4]; rfl
have hlen : 3 * (b :: l).length + 1 = 3 + (3 * l.length + 1) := by
show 3 * (l.length + 1) + 1 = 3 + (3 * l.length + 1)
rw [Nat.left_distrib, Nat.mul_one, Nat.add_comm (3 * l.length) 3, Nat.add_assoc]
have hx2r : upd (upd x r l) s (b :: upd x r l s) r = l := by
rw [upd_other (upd x r l) s r _ hrs]; exact upd_same x r l
have hx2s : upd (upd x r l) s (b :: upd x r l s) s = b :: m := by
rw [upd_same, upd_other x r s l hsr, hs]
have hrec := ih (b :: m) _ hx2r hx2s
rw [hlen, run_add, e]
refine And.intro hrec.1 (And.intro hrec.2.1 (And.intro hrec.2.2.1 (fun i hir his => ?_)))
rw [hrec.2.2.2 i hir his, upd_other (upd x r l) s i _ his]
exact upd_other x r i l hir
/-! ## EMIT -/
def emit (r : Nat) : List Bool -> List Ins
| [] => []
| b :: w => .push r b :: emit r w
theorem emit_shift (r : Nat) : forall (w : List Bool) (i : Nat) (ins : Ins), nthI (emit r w) i = some ins ->
forall a c, shift a ins = shift c ins := by
intro w
induction w with
| nil => intro i ins h; cases i <;> cases h
| cons b w ih =>
intro i ins h a c
cases i with
| zero => cases h; rfl
| succ i => exact ih i ins h a c
theorem frag_emit_tail (prog : List Ins) (o r : Nat) (b : Bool) (w : List Bool)
(h : Frag prog o (emit r (b :: w))) : nthI prog o = some (.push r b) /\ Frag prog (o + 1) (emit r w) := by
apply And.intro (h 0 _ rfl)
intro i ins hi
have h2 := h (i + 1) ins hi
rw [← Nat.add_assoc] at h2
rw [Nat.add_right_comm o 1 i, h2, emit_shift r w i ins hi o (o + 1)]
/-- Pushing the bits of w onto r, in order. -/
def pushAll (x : Nat -> List Bool) (r : Nat) : List Bool -> Nat -> List Bool
| [], i => x i
| b :: w, i => pushAll (upd x r (b :: x r)) r w i
theorem frag_emit_run (prog : List Ins) (r : Nat) : forall (w : List Bool) (o : Nat) (x : Nat -> List Bool),
Frag prog o (emit r w) -> Runs prog w.length o x (o + w.length) (pushAll x r w) := by
intro w
induction w with
| nil => intro o x _; exact And.intro rfl (fun _ => rfl)
| cons b w ih =>
intro o x hf
have ht := frag_emit_tail prog o r b w hf
have h1 : Runs prog 1 o x (o + 1) (upd x r (b :: x r)) := by
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = o + 1 /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = upd x r (b :: x r) i
rw [ht.1]
exact And.intro rfl (fun _ => rfl)
have h2 := ih (o + 1) (upd x r (b :: x r)) ht.2
have h3 := runs_seq prog 1 w.length o (o + 1) (o + 1 + w.length) x _ _ h1 h2
rw [Nat.add_comm 1 w.length, Nat.add_assoc o 1 w.length, Nat.add_comm 1 w.length] at h3
exact h3
end Found.Pnp21
#print axioms Found.Pnp21.runs_seq
#print axioms Found.Pnp21.runs_congr
#print axioms Found.Pnp21.frag_move_run
#print axioms Found.Pnp21.emit_shift
#print axioms Found.Pnp21.frag_emit_tail
#print axioms Found.Pnp21.frag_emit_run
lean_all/found/Pnp22.lean
/-
T330 piece 22. found/Pnp22 -- the loop fragment (CL3b, 3).
LOOP over a counter register c: at o, pop c (empty: go to the exit; 0 or 1: go to the
body at o + 1); the body occupies o + 1 .. o + bl; at o + 1 + bl, jump back to o. The
body is any code that, from o + 1, runs nb x steps and reaches o + 1 + bl with registers
f x, leaving c unchanged. Proved: from o with c holding l, the loop runs
steps l x steps and exits with registers iter l x (the body applied once per element of
l, after each pop). Nested loops are loops whose body is a loop.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp21
namespace Found.Pnp22
open Found.Pnp20
open Found.Pnp21
variable (c : Nat) (nb : (Nat -> List Bool) -> Nat) (f : (Nat -> List Bool) -> (Nat -> List Bool))
/-- Steps of the loop. -/
def steps : List Bool -> (Nat -> List Bool) -> Nat
| [], _ => 1
| _ :: l, x => ((1 + nb (upd x c l)) + 1) + steps l (f (upd x c l))
/-- Registers after the loop. -/
def iter : List Bool -> (Nat -> List Bool) -> (Nat -> List Bool)
| [], x => x
| _ :: l, x => iter l (f (upd x c l))
theorem loop_run (prog : List Ins) (o bl ex : Nat)
(hpop : nthI prog o = some (.pop c ex (o + 1) (o + 1)))
(hjmp : nthI prog (o + 1 + bl) = some (.jmp o))
(hbody : forall x, Runs prog (nb x) (o + 1) x (o + 1 + bl) (f x))
(hkeep : forall x, f x c = x c) :
forall (l : List Bool) (x : Nat -> List Bool), x c = l ->
Runs prog (steps c nb f l x) o x ex (iter c f l x) := by
intro l
induction l with
| nil =>
intro x hx
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = ex /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = x i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).pc = ex /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).regs i = x i
rw [hx]
exact And.intro rfl (fun _ => rfl)
| cons b l ih =>
intro x hx
have h1 : Runs prog 1 o x (o + 1) (upd x c l) := by
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = o + 1 /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = upd x c l i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).pc = o + 1 /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).regs i = upd x c l i
rw [hx]
cases b with
| false => exact And.intro rfl (fun _ => rfl)
| true => exact And.intro rfl (fun _ => rfl)
have h2 := hbody (upd x c l)
have h3 : Runs prog 1 (o + 1 + bl) (f (upd x c l)) o (f (upd x c l)) := by
show (run prog 0 (exec (Cfg.mk (o + 1 + bl) (f (upd x c l))) (nthI prog (o + 1 + bl)))).pc = o /\
forall i, (run prog 0 (exec (Cfg.mk (o + 1 + bl) (f (upd x c l))) (nthI prog (o + 1 + bl)))).regs i = f (upd x c l) i
rw [hjmp]
exact And.intro rfl (fun _ => rfl)
have hc : f (upd x c l) c = l := (hkeep _).trans (upd_same x c l)
have h4 := ih (f (upd x c l)) hc
exact runs_seq prog _ _ o o ex x _ _
(runs_seq prog _ _ o (o + 1 + bl) o x _ _ (runs_seq prog _ _ o (o + 1) (o + 1 + bl) x _ _ h1 h2) h3) h4
/-- A step bound: bodies of at most B steps give at most |l| (B + 2) + 1 steps. -/
theorem steps_le (B : Nat) (hB : forall x, nb x <= B) :
forall (l : List Bool) (x : Nat -> List Bool), steps c nb f l x <= l.length * (B + 2) + 1 := by
intro l
induction l with
| nil =>
intro x
show 1 <= 0 * (B + 2) + 1
rw [Nat.zero_mul]
exact Nat.le_refl 1
| cons b l ih =>
intro x
show ((1 + nb (upd x c l)) + 1) + steps c nb f l (f (upd x c l)) <= (l.length + 1) * (B + 2) + 1
have h1 : (1 + nb (upd x c l)) + 1 <= B + 2 :=
Nat.le_trans (Nat.add_le_add_right (Nat.add_le_add_left (hB _) 1) 1)
(Nat.le_of_eq ((Nat.add_right_comm 1 B 1).trans (Nat.add_comm (1 + 1) B)))
have h2 := Nat.add_le_add h1 (ih (f (upd x c l)))
have e : (B + 2) + (l.length * (B + 2) + 1) = (l.length + 1) * (B + 2) + 1 := by
show (B + 2) + (l.length * (B + 2) + 1) = Nat.succ l.length * (B + 2) + 1
rw [Nat.succ_mul, Nat.add_comm (B + 2), Nat.add_right_comm]
exact Nat.le_trans h2 (Nat.le_of_eq e)
end Found.Pnp22
#print axioms Found.Pnp22.loop_run
#print axioms Found.Pnp22.steps_le
lean_all/found/Pnp23.lean
/-
T330 piece 23. found/Pnp23 -- emitting a counter in unary (CL3b, 4).
The output of the reduction is built by pushing the bits of enc (red x) in order onto
an output register (which then holds them reversed; one final MOVE turns it around).
Numbers are unary (Pnp19.un n = n ones then a zero), and the loop counters hold n ones.
The fragment UNARY A B out pushes the bits of un n, where A holds n ones, onto out, using
B as scratch, and leaves A as it was:
o : pop A -> exit o+4 / body o+1
o+1 : push out 1; o+2 : push B 1; o+3 : jump o
o+4 : push out 0; o+5 .. o+9 : MOVE B A; exit o+10.
Proved: it runs 3n + 1 + 1 + 3n + 1 steps and leaves out = revApp (un n) out, A = n ones,
B as it was (empty), other registers unchanged. Also: placing a shifted program after
another (Frag of an append), and revApp facts.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp22
import found.Pnp19
namespace Found.Pnp23
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter loop_run)
/-! ## Instruction lists -/
def mapI (g : Ins -> Ins) : List Ins -> List Ins
| [] => []
| i :: p => g i :: mapI g p
def appI : List Ins -> List Ins -> List Ins
| [], q => q
| i :: p, q => i :: appI p q
theorem nthI_app_r : forall (p q : List Ins) (i : Nat), nthI (appI p q) (p.length + i) = nthI q i := by
intro p
induction p with
| nil => intro q i; show nthI q (0 + i) = nthI q i; rw [Nat.zero_add]
| cons a p ih =>
intro q i
show nthI (a :: appI p q) (p.length + 1 + i) = nthI q i
rw [Nat.add_right_comm]
exact ih q i
theorem nthI_app_l : forall (p q : List Ins) (i : Nat) (ins : Ins), nthI p i = some ins -> nthI (appI p q) i = some ins := by
intro p
induction p with
| nil => intro q i ins h; cases i <;> cases h
| cons a p ih =>
intro q i ins h
cases i with
| zero => exact h
| succ i => exact ih q i ins h
theorem nthI_mapI (g : Ins -> Ins) : forall (p : List Ins) (i : Nat) (ins : Ins), nthI p i = some ins -> nthI (mapI g p) i = some (g ins) := by
intro p
induction p with
| nil => intro i ins h; cases i <;> cases h
| cons a p ih =>
intro i ins h
cases i with
| zero => cases h; rfl
| succ i => exact ih i ins h
theorem shift_shift (a b : Nat) (ins : Ins) : shift a (shift b ins) = shift (a + b) ins := by
cases ins with
| push r v => rfl
| pop r e z w =>
show Ins.pop r (a + (b + e)) (a + (b + z)) (a + (b + w)) = Ins.pop r (a + b + e) (a + b + z) (a + b + w)
rw [Nat.add_assoc a b e, Nat.add_assoc a b z, Nat.add_assoc a b w]
| jmp l =>
show Ins.jmp (a + (b + l)) = Ins.jmp (a + b + l)
rw [Nat.add_assoc]
/-- A shifted program placed after p sits after p. -/
theorem frag_app (prog : List Ins) (o : Nat) (p q : List Ins) (h : Frag prog o (appI p (mapI (shift p.length) q))) :
Frag prog (o + p.length) q := by
intro i ins hi
have h1 := h (p.length + i) (shift p.length ins)
((nthI_app_r p _ i).trans (nthI_mapI (shift p.length) q i ins hi))
rw [← Nat.add_assoc, shift_shift] at h1
exact h1
theorem frag_app_l (prog : List Ins) (o : Nat) (p q : List Ins) (h : Frag prog o (appI p q)) : Frag prog o p :=
fun i ins hi => h i ins (nthI_app_l p q i ins hi)
/-! ## Unary lists -/
def tr : Nat -> List Bool
| 0 => []
| n + 1 => true :: tr n
theorem tr_len : forall n : Nat, (tr n).length = n := by
intro n
induction n with
| zero => rfl
| succ n ih => exact congrArg (fun t => t + 1) ih
theorem tr_cons : forall (n : Nat) (m : List Bool), tr n ++ true :: m = true :: (tr n ++ m) := by
intro n
induction n with
| zero => intro m; rfl
| succ n ih => intro m; exact congrArg (fun t => true :: t) (ih m)
theorem revApp_tr : forall (n : Nat) (m : List Bool), revApp (tr n) m = tr n ++ m := by
intro n
induction n with
| zero => intro m; rfl
| succ n ih =>
intro m
show revApp (tr n) (true :: m) = true :: (tr n ++ m)
rw [ih, tr_cons]
theorem revApp_app : forall (A B m : List Bool), revApp (A ++ B) m = revApp B (revApp A m) := by
intro A
induction A with
| nil => intro B m; rfl
| cons a A ih => intro B m; exact ih B (a :: m)
theorem un_tr : forall n : Nat, Found.Pnp19.un n = tr n ++ [false] := by
intro n
induction n with
| zero => rfl
| succ n ih => exact congrArg (fun t => true :: t) ih
theorem revApp_un (n : Nat) (m : List Bool) : revApp (Found.Pnp19.un n) m = false :: (tr n ++ m) := by
rw [un_tr, revApp_app, revApp_tr]
rfl
theorem app_nil'' : forall A : List Bool, A ++ [] = A := by
intro A
induction A with
| nil => rfl
| cons a A ih => exact congrArg (fun t => a :: t) ih
/-! ## The fragment -/
def unary (A B out : Nat) : List Ins :=
appI [.pop A 4 1 1, .push out true, .push B true, .jmp 0, .push out false] (mapI (shift 5) (move B A))
/-- The loop body: push 1 on out and on B. -/
def body (B out : Nat) (x : Nat -> List Bool) : Nat -> List Bool :=
upd (upd x out (true :: x out)) B (true :: upd x out (true :: x out) B)
theorem steps_two (c : Nat) (f : (Nat -> List Bool) -> (Nat -> List Bool)) :
forall (l : List Bool) (x : Nat -> List Bool), steps c (fun _ => 2) f l x = 4 * l.length + 1 := by
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show 4 + steps c (fun _ => 2) f l (f (upd x c l)) = 4 * Nat.succ l.length + 1
rw [ih, Nat.mul_succ, Nat.add_comm 4, Nat.add_right_comm]
/-- What the loop leaves. -/
theorem iter_body (A B out : Nat) (hAB : Nat.beq A B = false) (hAo : Nat.beq A out = false) (hBo : Nat.beq B out = false) :
forall (l : List Bool) (x : Nat -> List Bool), x A = l ->
iter A (body B out) l x A = [] /\
iter A (body B out) l x out = tr l.length ++ x out /\
iter A (body B out) l x B = tr l.length ++ x B /\
(forall i, Nat.beq i A = false -> Nat.beq i B = false -> Nat.beq i out = false ->
iter A (body B out) l x i = x i) := by
have hBA : Nat.beq B A = false := Found.Pnp2.beq_false_of_ne B A (fun e => by rw [e, beq_refl'] at hAB; exact Bool.noConfusion hAB)
have hoA : Nat.beq out A = false := Found.Pnp2.beq_false_of_ne out A (fun e => by rw [e, beq_refl'] at hAo; exact Bool.noConfusion hAo)
have hoB : Nat.beq out B = false := Found.Pnp2.beq_false_of_ne out B (fun e => by rw [e, beq_refl'] at hBo; exact Bool.noConfusion hBo)
intro l
induction l with
| nil => intro x hx; exact And.intro hx (And.intro rfl (And.intro rfl (fun _ _ _ _ => rfl)))
| cons b l ih =>
intro x _
have hy : body B out (upd x A l) A = l := by
show upd (upd (upd x A l) out _) B _ A = l
rw [upd_other _ B A _ hAB, upd_other _ out A _ hAo, upd_same]
have r := ih (body B out (upd x A l)) hy
have yo : body B out (upd x A l) out = true :: x out := by
show upd (upd (upd x A l) out (true :: upd x A l out)) B _ out = _
rw [upd_other _ B out _ hoB, upd_same, upd_other x A out l hoA]
have yB : body B out (upd x A l) B = true :: x B := by
show upd (upd (upd x A l) out _) B (true :: upd (upd x A l) out (true :: upd x A l out) B) B = _
rw [upd_same, upd_other _ out B _ hBo, upd_other x A B l hBA]
refine And.intro r.1 (And.intro ?_ (And.intro ?_ ?_))
· show iter A (body B out) l (body B out (upd x A l)) out = tr (l.length + 1) ++ x out
rw [r.2.1, yo]; exact tr_cons l.length (x out)
· show iter A (body B out) l (body B out (upd x A l)) B = tr (l.length + 1) ++ x B
rw [r.2.2.1, yB]; exact tr_cons l.length (x B)
· intro i hiA hiB hio
show iter A (body B out) l (body B out (upd x A l)) i = x i
rw [r.2.2.2 i hiA hiB hio]
show upd (upd (upd x A l) out _) B _ i = x i
rw [upd_other _ B i _ hiB, upd_other _ out i _ hio, upd_other x A i l hiA]
theorem ne_symm' (a b : Nat) (h : Nat.beq a b = false) : Nat.beq b a = false :=
Found.Pnp2.beq_false_of_ne b a (fun e => by rw [e, beq_refl'] at h; exact Bool.noConfusion h)
/-- UNARY A B out: with A holding n ones and B empty, it pushes the bits of un n onto out,
in 4n + 1 + 1 + (3n + 1) steps, from o to o + 10, and changes no other register. -/
theorem unary_run (prog : List Ins) (o A B out : Nat) (hf : Frag prog o (unary A B out))
(hAB : Nat.beq A B = false) (hAo : Nat.beq A out = false) (hBo : Nat.beq B out = false)
(n : Nat) (x : Nat -> List Bool) (hA : x A = tr n) (hB : x B = []) :
Runs prog (4 * n + 1 + 1 + (3 * n + 1)) o x (o + 10) (upd x out (false :: (tr n ++ x out))) := by
have hBA := ne_symm' A B hAB
have hoA := ne_symm' A out hAo
have hoB := ne_symm' B out hBo
have hfirst := frag_app_l prog o [.pop A 4 1 1, .push out true, .push B true, .jmp 0, .push out false] _ hf
have hmv : Frag prog (o + 5) (move B A) := frag_app prog o [.pop A 4 1 1, .push out true, .push B true, .jmp 0, .push out false] _ hf
have i0 : nthI prog o = some (.pop A (o + 4) (o + 1) (o + 1)) := hfirst 0 _ rfl
have i1 : nthI prog (o + 1) = some (.push out true) := hfirst 1 _ rfl
have i2 : nthI prog (o + 2) = some (.push B true) := hfirst 2 _ rfl
have i3 : nthI prog (o + 1 + 2) = some (.jmp o) := hfirst 3 _ rfl
have i4 : nthI prog (o + 4) = some (.push out false) := hfirst 4 _ rfl
have hbody : forall y, Runs prog 2 (o + 1) y (o + 1 + 2) (body B out y) := by
intro y
show (run prog 1 (exec (Cfg.mk (o + 1) y) (nthI prog (o + 1)))).pc = o + 1 + 2 /\
forall i, (run prog 1 (exec (Cfg.mk (o + 1) y) (nthI prog (o + 1)))).regs i = body B out y i
rw [i1]
show (run prog 0 (exec (Cfg.mk (o + 2) (upd y out (true :: y out))) (nthI prog (o + 2)))).pc = o + 1 + 2 /\
forall i, (run prog 0 (exec (Cfg.mk (o + 2) (upd y out (true :: y out))) (nthI prog (o + 2)))).regs i = body B out y i
rw [i2]
exact And.intro rfl (fun _ => rfl)
have hkeep : forall y, body B out y A = y A := fun y => by
show upd (upd y out _) B _ A = y A
rw [upd_other _ B A _ hAB, upd_other _ out A _ hAo]
have L := loop_run A (fun _ => 2) (body B out) prog o 2 (o + 4) i0 i3 hbody hkeep (tr n) x hA
rw [steps_two, tr_len] at L
have it := iter_body A B out hAB hAo hBo (tr n) x hA
rw [tr_len, hB, app_nil''] at it
-- push 0 on out
have P : Runs prog 1 (o + 4) (iter A (body B out) (tr n) x) (o + 5)
(upd (iter A (body B out) (tr n) x) out (false :: iter A (body B out) (tr n) x out)) := by
show (run prog 0 (exec (Cfg.mk (o + 4) _) (nthI prog (o + 4)))).pc = o + 5 /\
forall i, (run prog 0 (exec (Cfg.mk (o + 4) (iter A (body B out) (tr n) x)) (nthI prog (o + 4)))).regs i = _
rw [i4]
exact And.intro rfl (fun _ => rfl)
-- MOVE B A
let y2 := upd (iter A (body B out) (tr n) x) out (false :: iter A (body B out) (tr n) x out)
have y2B : y2 B = tr n := by
show upd _ out _ B = tr n
rw [upd_other _ out B _ hBo]; exact it.2.2.1
have y2A : y2 A = [] := by
show upd _ out _ A = []
rw [upd_other _ out A _ hAo]; exact it.1
have mv := frag_move_run prog (o + 5) B A hmv hBA (tr n) [] y2 y2B y2A
rw [tr_len] at mv
have M : Runs prog (3 * n + 1) (o + 5) y2 (o + 10) (upd x out (false :: (tr n ++ x out))) := by
refine And.intro mv.1 (fun i => ?_)
cases hiB : Nat.beq i B with
| true =>
rw [Found.Pnp2.beq_eq i B hiB, mv.2.1, upd_other x out B _ hBo, hB]
| false =>
cases hiA : Nat.beq i A with
| true =>
rw [Found.Pnp2.beq_eq i A hiA, mv.2.2.1, revApp_tr, app_nil'', upd_other x out A _ hAo, hA]
| false =>
rw [mv.2.2.2 i hiB hiA]
show upd _ out _ i = upd x out _ i
cases hio : Nat.beq i out with
| true =>
rw [Found.Pnp2.beq_eq i out hio, upd_same, upd_same, it.2.1]
| false =>
rw [upd_other _ out i _ hio, upd_other x out i _ hio]
exact it.2.2.2 i hiA hiB hio
exact runs_seq prog _ _ o (o + 5) (o + 10) x _ _ (runs_seq prog _ _ o (o + 4) (o + 5) x _ _ L P) M
end Found.Pnp23
#print axioms Found.Pnp23.nthI_app_r
#print axioms Found.Pnp23.nthI_app_l
#print axioms Found.Pnp23.nthI_mapI
#print axioms Found.Pnp23.shift_shift
#print axioms Found.Pnp23.frag_app
#print axioms Found.Pnp23.frag_app_l
#print axioms Found.Pnp23.tr_len
#print axioms Found.Pnp23.tr_cons
#print axioms Found.Pnp23.revApp_tr
#print axioms Found.Pnp23.revApp_app
#print axioms Found.Pnp23.un_tr
#print axioms Found.Pnp23.revApp_un
#print axioms Found.Pnp23.app_nil''
#print axioms Found.Pnp23.steps_two
#print axioms Found.Pnp23.iter_body
#print axioms Found.Pnp23.ne_symm'
#print axioms Found.Pnp23.unary_run
lean_all/found/Pnp24.lean
/-
T330 piece 24. found/Pnp24 -- straight-line output blocks (CL3b, 5).
A block is a list of output operations: emit a fixed bit list, or emit the unary code of
the counter held in a register. It compiles to UNARY and EMIT fragments placed one after
another. Proved: a compiled block, with its counters held in registers different from
the scratch register B and the output register, pushes exactly the bits of the block
(fixed lists and unary codes, in order) onto the output, in a step count that is a sum
over the operations, and changes no other register. The window clauses of the tableau
are such blocks (one per time and cell), written next.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp23
namespace Found.Pnp24
open Found.Pnp20
open Found.Pnp21
open Found.Pnp23
inductive Op where
| emit : List Bool -> Op
| un : Nat -> Op
variable (B out : Nat)
def code : Op -> List Ins
| .emit w => emit out w
| .un R => unary R B out
def cmp : List Op -> List Ins
| [] => []
| op :: rest => appI (code B out op) (mapI (shift (code B out op).length) (cmp rest))
/-- The bits of a block, with the counters cnt R. -/
def bits (cnt : Nat -> Nat) : List Op -> List Bool
| [] => []
| .emit w :: rest => w ++ bits cnt rest
| .un R :: rest => Found.Pnp19.un (cnt R) ++ bits cnt rest
/-- The steps of a block. -/
def cost (cnt : Nat -> Nat) : List Op -> Nat
| [] => 0
| .emit w :: rest => w.length + cost cnt rest
| .un R :: rest => (4 * cnt R + 1 + 1 + (3 * cnt R + 1)) + cost cnt rest
/-- Every counter register of the block is different from B and out and holds its count. -/
def Good (x : Nat -> List Bool) (cnt : Nat -> Nat) : List Op -> Prop
| [] => True
| .emit _ :: rest => Good x cnt rest
| .un R :: rest => (Nat.beq R B = false /\ Nat.beq R out = false /\ x R = tr (cnt R)) /\ Good x cnt rest
theorem pushAll_eq (r : Nat) : forall (w : List Bool) (x : Nat -> List Bool) (i : Nat),
pushAll x r w i = upd x r (revApp w (x r)) i := by
intro w
induction w with
| nil =>
intro x i
show x i = selR (Nat.beq i r) (x r) (x i)
cases h : Nat.beq i r with
| false => rfl
| true => rw [Found.Pnp2.beq_eq i r h]; rfl
| cons b w ih =>
intro x i
show pushAll (upd x r (b :: x r)) r w i = _
rw [ih, upd_same]
show selR (Nat.beq i r) _ (upd x r (b :: x r) i) = selR (Nat.beq i r) _ (x i)
cases h : Nat.beq i r with
| true => rfl
| false => rw [upd_other x r i _ h]; rfl
theorem upd_upd (x : Nat -> List Bool) (r : Nat) (a b : List Bool) :
forall i, upd (upd x r a) r b i = upd x r b i := by
intro i
show selR (Nat.beq i r) b (upd x r a i) = selR (Nat.beq i r) b (x i)
cases h : Nat.beq i r with
| true => rfl
| false => rw [upd_other x r i a h]
theorem good_upd (cnt : Nat -> Nat) (x : Nat -> List Bool) (v : List Bool) :
forall ops, Good B out x cnt ops -> Good B out (upd x out v) cnt ops := by
intro ops
induction ops with
| nil => intro _; exact True.intro
| cons op rest ih =>
cases op with
| emit w => intro h; exact ih h
| un R =>
intro h
exact And.intro (And.intro h.1.1 (And.intro h.1.2.1 ((upd_other x out R v h.1.2.1).trans h.1.2.2))) (ih h.2)
theorem frag_cons (prog : List Ins) (o : Nat) (op : Op) (rest : List Op) (h : Frag prog o (cmp B out (op :: rest))) :
Frag prog o (code B out op) /\ Frag prog (o + (code B out op).length) (cmp B out rest) :=
And.intro (frag_app_l prog o _ _ h) (frag_app prog o _ _ h)
theorem len_emit (r : Nat) : forall w : List Bool, (emit r w).length = w.length := by
intro w
induction w with
| nil => rfl
| cons b w ih => exact congrArg (fun t => t + 1) ih
theorem len_appI : forall (p q : List Ins), (appI p q).length = p.length + q.length := by
intro p
induction p with
| nil => intro q; exact (Nat.zero_add _).symm
| cons a p ih =>
intro q
show (appI p q).length + 1 = (p.length + 1) + q.length
rw [ih]; exact (Nat.succ_add _ _).symm
theorem len_mapI (g : Ins -> Ins) : forall p : List Ins, (mapI g p).length = p.length := by
intro p
induction p with
| nil => rfl
| cons a p ih => exact congrArg (fun t => t + 1) ih
/-- A compiled block pushes its bits onto out. -/
theorem block_run (prog : List Ins) (hBo : Nat.beq B out = false) (cnt : Nat -> Nat) :
forall (ops : List Op) (o : Nat) (x : Nat -> List Bool), Frag prog o (cmp B out ops) ->
x B = [] -> Good B out x cnt ops ->
Runs prog (cost cnt ops) o x (o + (cmp B out ops).length) (upd x out (revApp (bits cnt ops) (x out))) := by
intro ops
induction ops with
| nil =>
intro o x _ _ _
exact And.intro rfl (fun i => pushAll_eq out [] x i)
| cons op rest ih =>
intro o x hf hB hg
have fc := frag_cons B out prog o op rest hf
have hlen : (cmp B out (op :: rest)).length = (code B out op).length + (cmp B out rest).length := by
show (appI (code B out op) (mapI (shift (code B out op).length) (cmp B out rest))).length = _
rw [len_appI, len_mapI]
cases op with
| emit w =>
have hcl : (code B out (.emit w)).length = w.length := len_emit out w
have f2 : Frag prog (o + w.length) (cmp B out rest) := by rw [← hcl]; exact fc.2
have r1 : Runs prog w.length o x (o + w.length) (upd x out (revApp w (x out))) := by
have e := frag_emit_run prog out w o x fc.1
exact And.intro e.1 (fun i => (e.2 i).trans (pushAll_eq out w x i))
have hB' : upd x out (revApp w (x out)) B = [] := (upd_other x out B _ hBo).trans hB
have r2 := ih (o + w.length) _ f2 hB' (good_upd B out cnt x _ rest hg)
have r3 := runs_seq prog _ _ _ _ _ x _ _ r1 r2
rw [hlen, hcl, ← Nat.add_assoc]
refine And.intro r3.1 (fun i => (r3.2 i).trans ?_)
rw [upd_upd, upd_same]
show upd x out (revApp (bits cnt rest) (revApp w (x out))) i = upd x out (revApp (w ++ bits cnt rest) (x out)) i
rw [revApp_app]
| un R =>
have hR := hg.1
have hcl : (code B out (.un R)).length = 10 := rfl
have f2 : Frag prog (o + 10) (cmp B out rest) := by rw [← hcl]; exact fc.2
have r1 : Runs prog (4 * cnt R + 1 + 1 + (3 * cnt R + 1)) o x (o + 10)
(upd x out (revApp (Found.Pnp19.un (cnt R)) (x out))) := by
have e := unary_run prog o R B out fc.1 hR.1 hR.2.1 hBo (cnt R) x hR.2.2 hB
refine And.intro e.1 (fun i => (e.2 i).trans ?_)
rw [revApp_un]
have hB' : upd x out (revApp (Found.Pnp19.un (cnt R)) (x out)) B = [] := (upd_other x out B _ hBo).trans hB
have r2 := ih (o + 10) _ f2 hB' (good_upd B out cnt x _ rest hg.2)
have r3 := runs_seq prog _ _ _ _ _ x _ _ r1 r2
rw [hlen, hcl, ← Nat.add_assoc]
refine And.intro r3.1 (fun i => (r3.2 i).trans ?_)
rw [upd_upd, upd_same]
show upd x out (revApp (bits cnt rest) (revApp (Found.Pnp19.un (cnt R)) (x out))) i =
upd x out (revApp (Found.Pnp19.un (cnt R) ++ bits cnt rest) (x out)) i
rw [revApp_app]
end Found.Pnp24
#print axioms Found.Pnp24.pushAll_eq
#print axioms Found.Pnp24.upd_upd
#print axioms Found.Pnp24.good_upd
#print axioms Found.Pnp24.frag_cons
#print axioms Found.Pnp24.len_emit
#print axioms Found.Pnp24.len_appI
#print axioms Found.Pnp24.len_mapI
#print axioms Found.Pnp24.block_run
lean_all/found/Pnp25.lean
/-
T330 piece 25. found/Pnp25 -- the window clauses of one time and cell as a block (CL3b, 6).
For time t and cell j, the window clauses of the tableau (Pnp9: for every bit b < k and
every pattern p of the 3k neighbourhood bits, the clause "neighbourhood differs from p,
or bit b of cell j at time t+1 is d p b") are written by one straight-line block whose
counters are held in registers RT (t), RT1 (t+1), RL (the left cell), RJ (j), RR (j+1).
Proved: with those counts, the bits of the block are exactly the encodings (Pnp19) of
those clauses, each after its CNF marker 1, in the order of the tableau CNF.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp24
namespace Found.Pnp25
open Found.Pnp8 (wc mapCl window allBits)
open Found.Pnp9 (V readV nbV leftIdx forR)
open Found.Pnp19 (un encLit encCl app_assoc')
open Found.Pnp24 (Op bits)
/-! ## Encodings of literal lists and clause lists -/
def encLs : List (Bool × V) -> List Bool
| [] => []
| l :: c => true :: (encLit l ++ encLs c)
def encList : List (List (Bool × V)) -> List Bool
| [] => []
| c :: f => true :: (encCl c ++ encList f)
theorem encCl_app : forall (A B : List (Bool × V)), encCl (A ++ B) = encLs A ++ encCl B := by
intro A
induction A with
| nil => intro B; rfl
| cons l A ih =>
intro B
show true :: (encLit l ++ encCl (A ++ B)) = true :: ((encLit l ++ encLs A) ++ encCl B)
rw [ih, app_assoc']
theorem encList_app : forall (A B : List (List (Bool × V))), encList (A ++ B) = encList A ++ encList B := by
intro A
induction A with
| nil => intro B; rfl
| cons c A ih =>
intro B
show true :: (encCl c ++ encList (A ++ B)) = true :: ((encCl c ++ encList A) ++ encList B)
rw [ih, app_assoc']
theorem wc_app : forall (ys : List V) (p : List Bool) (tl : List (Bool × V)), wc ys p tl = wc ys p [] ++ tl := by
intro ys
induction ys with
| nil => intro p tl; rfl
| cons y ys ih =>
intro p tl
cases p with
| nil => rfl
| cons q p => exact congrArg (fun t => (!q, y) :: t) (ih p tl)
theorem bits_app (cnt : Nat -> Nat) : forall (A B : List Op), bits cnt (A ++ B) = bits cnt A ++ bits cnt B := by
intro A
induction A with
| nil => intro B; rfl
| cons op A ih =>
intro B
cases op with
| emit w =>
show w ++ bits cnt (A ++ B) = (w ++ bits cnt A) ++ bits cnt B
rw [ih, app_assoc']
| un R =>
show un (cnt R) ++ bits cnt (A ++ B) = (un (cnt R) ++ bits cnt A) ++ bits cnt B
rw [ih, app_assoc']
/-! ## Literals read from registers -/
def ysOf (cnt : Nat -> Nat) (t : Nat) : List (Nat × Nat) -> List V
| [] => []
| (R, b) :: ds => (t, (cnt R, b)) :: ysOf cnt t ds
def dR (R : Nat) : Nat -> Nat -> List (Nat × Nat)
| _, 0 => []
| b, n + 1 => (R, b) :: dR R (b + 1) n
theorem ysOf_dR (cnt : Nat -> Nat) (t R : Nat) : forall n b0, ysOf cnt t (dR R b0 n) = readV t (cnt R) b0 n := by
intro n
induction n with
| zero => intro b0; rfl
| succ n ih => intro b0; exact congrArg (fun l => (t, (cnt R, b0)) :: l) (ih (b0 + 1))
theorem ysOf_app (cnt : Nat -> Nat) (t : Nat) : forall (A B : List (Nat × Nat)), ysOf cnt t (A ++ B) = ysOf cnt t A ++ ysOf cnt t B := by
intro A
induction A with
| nil => intro B; rfl
| cons d A ih =>
intro B
cases d with
| mk R b => exact congrArg (fun l => (t, (cnt R, b)) :: l) (ih B)
def litOps (RT : Nat) : List (Nat × Nat) -> List Bool -> List Op
| [], _ => []
| _ :: _, [] => []
| (R, b) :: ds, q :: p => [.emit [true, !q], .un RT, .un R, .emit (un b)] ++ litOps RT ds p
theorem litOps_bits (cnt : Nat -> Nat) (RT t : Nat) (hT : cnt RT = t) :
forall (ds : List (Nat × Nat)) (p : List Bool), bits cnt (litOps RT ds p) = encLs (wc (ysOf cnt t ds) p []) := by
intro ds
induction ds with
| nil => intro p; rfl
| cons d ds ih =>
intro p
cases d with
| mk R b =>
cases p with
| nil => rfl
| cons q p =>
show bits cnt ([.emit [true, !q], .un RT, .un R, .emit (un b)] ++ litOps RT ds p) =
true :: (((!q) :: (un t ++ (un (cnt R) ++ un b))) ++ encLs (wc (ysOf cnt t ds) p []))
rw [bits_app, ih p]
show [true, !q] ++ (un (cnt RT) ++ (un (cnt R) ++ (un b ++ []))) ++ encLs (wc (ysOf cnt t ds) p []) = _
rw [hT, Found.Pnp23.app_nil'' (un b)]
show true :: ((!q) :: (un t ++ (un (cnt R) ++ un b)) ++ _) = _
rfl
/-! ## One clause, one pattern list, all bits -/
def clauseOps (RT RT1 RJ : Nat) (ds : List (Nat × Nat)) (dbit : Bool) (b : Nat) (p : List Bool) : List Op :=
litOps RT ds p ++ [.emit [true, dbit], .un RT1, .un RJ, .emit (un b), .emit [false]]
theorem clause_bits (cnt : Nat -> Nat) (RT RT1 RJ t j : Nat) (hT : cnt RT = t) (hT1 : cnt RT1 = t + 1) (hJ : cnt RJ = j)
(ds : List (Nat × Nat)) (dbit : Bool) (b : Nat) (p : List Bool) :
bits cnt (clauseOps RT RT1 RJ ds dbit b p) = encCl (wc (ysOf cnt t ds) p [(dbit, (t + 1, (j, b)))]) := by
show bits cnt (litOps RT ds p ++ _) = _
rw [bits_app, litOps_bits cnt RT t hT, wc_app (ysOf cnt t ds) p [(dbit, (t + 1, (j, b)))], encCl_app]
show _ ++ ([true, dbit] ++ (un (cnt RT1) ++ (un (cnt RJ) ++ (un b ++ ([false] ++ []))))) = _
rw [hT1, hJ]
show encLs (wc (ysOf cnt t ds) p []) ++ (true :: dbit :: (un (t + 1) ++ (un j ++ (un b ++ [false])))) =
encLs (wc (ysOf cnt t ds) p []) ++ (true :: dbit :: ((un (t + 1) ++ (un j ++ un b)) ++ [false]))
rw [app_assoc', app_assoc']
def patOps (RT RT1 RJ : Nat) (ds : List (Nat × Nat)) (d : List Bool -> Bool) (b : Nat) : List (List Bool) -> List Op
| [] => []
| p :: ps => (.emit [true] :: clauseOps RT RT1 RJ ds (d p) b p) ++ patOps RT RT1 RJ ds d b ps
theorem patOps_bits (cnt : Nat -> Nat) (RT RT1 RJ t j : Nat) (hT : cnt RT = t) (hT1 : cnt RT1 = t + 1) (hJ : cnt RJ = j)
(ds : List (Nat × Nat)) (d : List Bool -> Bool) (b : Nat) :
forall ps, bits cnt (patOps RT RT1 RJ ds d b ps) = encList (mapCl (ysOf cnt t ds) (t + 1, (j, b)) d ps) := by
intro ps
induction ps with
| nil => rfl
| cons p ps ih =>
show bits cnt ((.emit [true] :: clauseOps RT RT1 RJ ds (d p) b p) ++ patOps RT RT1 RJ ds d b ps) =
true :: (encCl (wc (ysOf cnt t ds) p [(d p, (t + 1, (j, b)))]) ++ encList (mapCl (ysOf cnt t ds) (t + 1, (j, b)) d ps))
rw [bits_app, ih]
show ([true] ++ bits cnt (clauseOps RT RT1 RJ ds (d p) b p)) ++ _ = _
rw [clause_bits cnt RT RT1 RJ t j hT hT1 hJ]
rfl
/-- The neighbourhood description: k bits of the left cell, of j, of j + 1. -/
def nbD (RL RJ RR k : Nat) : List (Nat × Nat) := dR RL 0 k ++ (dR RJ 0 k ++ dR RR 0 k)
def bOps (RT RT1 RL RJ RR k : Nat) (delta : List Bool -> Nat -> Bool) : Nat -> List Op
| 0 => []
| b + 1 => bOps RT RT1 RL RJ RR k delta b ++
patOps RT RT1 RJ (nbD RL RJ RR k) (fun p => delta p b) b (allBits (k + (k + k)))
/-- The block of time t and cell j writes the window clauses of (t, j), in tableau order. -/
theorem bOps_bits (cnt : Nat -> Nat) (RT RT1 RL RJ RR k W t j : Nat) (delta : List Bool -> Nat -> Bool)
(hT : cnt RT = t) (hT1 : cnt RT1 = t + 1) (hL : cnt RL = leftIdx W j) (hJ : cnt RJ = j) (hR : cnt RR = j + 1) :
forall n, bits cnt (bOps RT RT1 RL RJ RR k delta n) =
encList (forR n fun b => window (nbV k W t j) (t + 1, (j, b)) (fun p => delta p b) (k + (k + k))) := by
have hys : ysOf cnt t (nbD RL RJ RR k) = nbV k W t j := by
show ysOf cnt t (dR RL 0 k ++ (dR RJ 0 k ++ dR RR 0 k)) = _
rw [ysOf_app, ysOf_app, ysOf_dR, ysOf_dR, ysOf_dR, hL, hJ, hR]
rfl
intro n
induction n with
| zero => rfl
| succ n ih =>
show bits cnt (bOps RT RT1 RL RJ RR k delta n ++ _) = encList (forR n _ ++ _)
rw [bits_app, ih, encList_app, patOps_bits cnt RT RT1 RJ t j hT hT1 hJ, hys]
rfl
end Found.Pnp25
#print axioms Found.Pnp25.encCl_app
#print axioms Found.Pnp25.encList_app
#print axioms Found.Pnp25.wc_app
#print axioms Found.Pnp25.bits_app
#print axioms Found.Pnp25.ysOf_dR
#print axioms Found.Pnp25.ysOf_app
#print axioms Found.Pnp25.litOps_bits
#print axioms Found.Pnp25.clause_bits
#print axioms Found.Pnp25.patOps_bits
#print axioms Found.Pnp25.bOps_bits
lean_all/found/Pnp26.lean
/-
T330 piece 26. found/Pnp26 -- the loop over cells j >= 1 for one time t (CL3b, 7).
Registers (fixed numbers): 0 output, 1 scratch, 2 loop counter, 3 = t ones, 4 = t+1 ones,
5 = j-1 ones (the left cell), 6 = j ones, 7 = j+1 ones. The body writes the window block
of (t, j) (Pnp25) and then pushes a 1 on registers 5, 6, 7 (j becomes j+1). Proved:
* every counter register of the window block is one of 3..7 (so the block's side
conditions hold whenever those registers hold ones);
* the body runs as a fragment;
* after the loop has run over a counter of m bits from j = s + 1, the output holds the
window clauses of (t, s+1), ..., (t, s+m) in order (reversed, as everything is
pushed), and registers 5, 6, 7 hold s+m, s+m+1, s+m+2 ones.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp25
namespace Found.Pnp26
open Found.Pnp8 (window)
open Found.Pnp9 (nbV leftIdx forR)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter loop_run)
open Found.Pnp23 (tr tr_len mapI appI frag_app frag_app_l revApp_app)
open Found.Pnp24 (Op bits cost Good cmp block_run upd_upd)
open Found.Pnp25 (encList litOps patOps clauseOps bOps nbD dR bOps_bits)
/-! ## Counter registers of a block lie in 2..7 -/
def InR (R : Nat) : Prop := 2 <= R /\ R <= 7
def UnIn : List Op -> Prop
| [] => True
| .emit _ :: rest => UnIn rest
| .un R :: rest => InR R /\ UnIn rest
theorem unIn_app : forall (A B : List Op), UnIn A -> UnIn B -> UnIn (A ++ B) := by
intro A
induction A with
| nil => intro B _ hB; exact hB
| cons op A ih =>
intro B hA hB
cases op with
| emit w => exact ih B hA hB
| un R => exact And.intro hA.1 (ih B hA.2 hB)
def DsIn : List (Nat × Nat) -> Prop
| [] => True
| (R, _) :: ds => InR R /\ DsIn ds
theorem dsIn_app : forall (A B : List (Nat × Nat)), DsIn A -> DsIn B -> DsIn (A ++ B) := by
intro A
induction A with
| nil => intro B _ hB; exact hB
| cons d A ih =>
intro B hA hB
cases d with
| mk R b => exact And.intro hA.1 (ih B hA.2 hB)
theorem dsIn_dR (R : Nat) (h : InR R) : forall n b, DsIn (dR R b n) := by
intro n
induction n with
| zero => intro b; exact True.intro
| succ n ih => intro b; exact And.intro h (ih (b + 1))
theorem unIn_litOps (RT : Nat) (hT : InR RT) : forall (ds : List (Nat × Nat)) (p : List Bool), DsIn ds -> UnIn (litOps RT ds p) := by
intro ds
induction ds with
| nil => intro p _; exact True.intro
| cons d ds ih =>
intro p hd
cases d with
| mk R b =>
cases p with
| nil => exact True.intro
| cons q p => exact And.intro hT (And.intro hd.1 (ih p hd.2))
theorem unIn_clause (RT RT1 RJ : Nat) (hT : InR RT) (hT1 : InR RT1) (hJ : InR RJ) (ds : List (Nat × Nat)) (hd : DsIn ds)
(dbit : Bool) (b : Nat) (p : List Bool) : UnIn (clauseOps RT RT1 RJ ds dbit b p) :=
unIn_app _ _ (unIn_litOps RT hT ds p hd) (And.intro hT1 (And.intro hJ True.intro))
theorem unIn_pat (RT RT1 RJ : Nat) (hT : InR RT) (hT1 : InR RT1) (hJ : InR RJ) (ds : List (Nat × Nat)) (hd : DsIn ds)
(d : List Bool -> Bool) (b : Nat) : forall ps, UnIn (patOps RT RT1 RJ ds d b ps) := by
intro ps
induction ps with
| nil => exact True.intro
| cons p ps ih => exact unIn_app _ _ (unIn_clause RT RT1 RJ hT hT1 hJ ds hd (d p) b p) ih
theorem in3 : InR 3 := And.intro (Nat.le_succ 2) (Nat.le_of_ble_eq_true rfl)
theorem in4 : InR 4 := And.intro (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl)
theorem in5 : InR 5 := And.intro (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl)
theorem in6 : InR 6 := And.intro (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl)
theorem in7 : InR 7 := And.intro (Nat.le_of_ble_eq_true rfl) (Nat.le_refl 7)
def ops (k : Nat) (delta : List Bool -> Nat -> Bool) : List Op := bOps 3 4 5 6 7 k delta k
theorem unIn_ops (k : Nat) (delta : List Bool -> Nat -> Bool) : UnIn (ops k delta) := by
have hd : DsIn (nbD 5 6 7 k) :=
dsIn_app _ _ (dsIn_dR 5 in5 k 0) (dsIn_app _ _ (dsIn_dR 6 in6 k 0) (dsIn_dR 7 in7 k 0))
have g : forall n, UnIn (bOps 3 4 5 6 7 k delta n) := by
intro n
induction n with
| zero => exact True.intro
| succ n ih => exact unIn_app _ _ ih (unIn_pat 3 4 6 in3 in4 in6 _ hd _ n _)
exact g k
/-- The count of a register: its length. -/
def cntOf (x : Nat -> List Bool) (R : Nat) : Nat := (x R).length
/-- Registers 2..7 hold ones. -/
def Ones (x : Nat -> List Bool) : Prop := forall R, InR R -> x R = tr (cntOf x R)
theorem ne_lo (R : Nat) (h : InR R) (a : Nat) (ha : a < 2) : Nat.beq R a = false :=
Found.Pnp2.beq_false_of_ne R a (fun e => Nat.lt_irrefl a (Nat.lt_of_lt_of_le ha (e ▸ h.1)))
theorem good_of (x : Nat -> List Bool) (hx : Ones x) : forall o, UnIn o -> Good 1 0 x (cntOf x) o := by
intro o
induction o with
| nil => intro _; exact True.intro
| cons op rest ih =>
intro h
cases op with
| emit w => exact ih h
| un R =>
exact And.intro (And.intro (ne_lo R h.1 1 (Nat.lt_succ_self 1))
(And.intro (ne_lo R h.1 0 (Nat.zero_lt_succ 1)) (hx R h.1))) (ih h.2)
theorem tr_cnt (x : Nat -> List Bool) (R n : Nat) (h : x R = tr n) : x R = tr (cntOf x R) := by
show x R = tr (x R).length
rw [h, tr_len]
theorem ones_of (x : Nat -> List Bool) (a2 a3 a4 a5 a6 a7 : Nat)
(h2 : x 2 = tr a2) (h3 : x 3 = tr a3) (h4 : x 4 = tr a4) (h5 : x 5 = tr a5) (h6 : x 6 = tr a6) (h7 : x 7 = tr a7) :
Ones x := by
intro R hR
match R, hR with
| 0, h => exact False.elim (Nat.not_succ_le_zero 1 h.1)
| 1, h => exact False.elim (Nat.not_succ_le_self 1 h.1)
| 2, _ => exact tr_cnt x 2 a2 h2
| 3, _ => exact tr_cnt x 3 a3 h3
| 4, _ => exact tr_cnt x 4 a4 h4
| 5, _ => exact tr_cnt x 5 a5 h5
| 6, _ => exact tr_cnt x 6 a6 h6
| 7, _ => exact tr_cnt x 7 a7 h7
| n + 8, h => exact False.elim (Nat.not_succ_le_self 7 (Nat.le_trans (Nat.succ_le_succ (Nat.le_add_left 7 n)) h.2))
/-! ## The body: the window block, then j := j + 1 -/
def incs : List Ins := [.push 5 true, .push 6 true, .push 7 true]
def bodyC (k : Nat) (delta : List Bool -> Nat -> Bool) : List Ins :=
appI (cmp 1 0 (ops k delta)) (mapI (shift (cmp 1 0 (ops k delta)).length) incs)
def y0 (k : Nat) (delta : List Bool -> Nat -> Bool) (x : Nat -> List Bool) : Nat -> List Bool :=
upd x 0 (revApp (bits (cntOf x) (ops k delta)) (x 0))
def fB (k : Nat) (delta : List Bool -> Nat -> Bool) (x : Nat -> List Bool) : Nat -> List Bool :=
let a := y0 k delta x
let b := upd a 5 (true :: a 5)
let c := upd b 6 (true :: b 6)
upd c 7 (true :: c 7)
def nbB (k : Nat) (delta : List Bool -> Nat -> Bool) (x : Nat -> List Bool) : Nat := cost (cntOf x) (ops k delta) + 3
theorem body_run (prog : List Ins) (o k : Nat) (delta : List Bool -> Nat -> Bool) (hf : Frag prog o (bodyC k delta))
(x : Nat -> List Bool) (hB : x 1 = []) (hx : Ones x) :
Runs prog (nbB k delta x) o x (o + (cmp 1 0 (ops k delta)).length + 3) (fB k delta x) := by
have f1 := frag_app_l prog o _ _ hf
have f2 : Frag prog (o + (cmp 1 0 (ops k delta)).length) incs := frag_app prog o _ _ hf
have r1 := block_run 1 0 prog rfl (cntOf x) (ops k delta) o x f1 hB (good_of x hx _ (unIn_ops k delta))
have i0 : nthI prog (o + (cmp 1 0 (ops k delta)).length) = some (.push 5 true) := f2 0 _ rfl
have i1 : nthI prog (o + (cmp 1 0 (ops k delta)).length + 1) = some (.push 6 true) := f2 1 _ rfl
have i2 : nthI prog (o + (cmp 1 0 (ops k delta)).length + 2) = some (.push 7 true) := f2 2 _ rfl
have r2 : Runs prog 3 (o + (cmp 1 0 (ops k delta)).length) (y0 k delta x) (o + (cmp 1 0 (ops k delta)).length + 3) (fB k delta x) := by
show (run prog 2 (exec (Cfg.mk (o + (cmp 1 0 (ops k delta)).length) (y0 k delta x)) (nthI prog (o + (cmp 1 0 (ops k delta)).length)))).pc = _ /\
forall i, (run prog 2 (exec (Cfg.mk (o + (cmp 1 0 (ops k delta)).length) (y0 k delta x)) (nthI prog (o + (cmp 1 0 (ops k delta)).length)))).regs i = _
rw [i0]
show (run prog 1 (exec (Cfg.mk (o + (cmp 1 0 (ops k delta)).length + 1) _) (nthI prog (o + (cmp 1 0 (ops k delta)).length + 1)))).pc = _ /\
forall i, (run prog 1 (exec (Cfg.mk (o + (cmp 1 0 (ops k delta)).length + 1) (upd (y0 k delta x) 5 (true :: y0 k delta x 5))) (nthI prog (o + (cmp 1 0 (ops k delta)).length + 1)))).regs i = _
rw [i1]
show (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (ops k delta)).length + 2) _) (nthI prog (o + (cmp 1 0 (ops k delta)).length + 2)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (ops k delta)).length + 2)
(upd (upd (y0 k delta x) 5 (true :: y0 k delta x 5)) 6 (true :: upd (y0 k delta x) 5 (true :: y0 k delta x 5) 6)))
(nthI prog (o + (cmp 1 0 (ops k delta)).length + 2)))).regs i = _
rw [i2]
exact And.intro rfl (fun _ => rfl)
exact runs_seq prog _ _ _ _ _ x _ _ r1 r2
/-! ## A loop with an invariant -/
theorem loop_inv (c : Nat) (nb : (Nat -> List Bool) -> Nat) (f : (Nat -> List Bool) -> (Nat -> List Bool))
(P : (Nat -> List Bool) -> Prop) (prog : List Ins) (o bl ex : Nat)
(hpop : nthI prog o = some (.pop c ex (o + 1) (o + 1)))
(hjmp : nthI prog (o + 1 + bl) = some (.jmp o))
(hbody : forall x, P x -> Runs prog (nb x) (o + 1) x (o + 1 + bl) (f x))
(hkeep : forall x, f x c = x c)
(hP1 : forall x b l, P x -> x c = b :: l -> P (upd x c l))
(hP2 : forall x, P x -> P (f x)) :
forall (l : List Bool) (x : Nat -> List Bool), x c = l -> P x ->
Runs prog (steps c nb f l x) o x ex (iter c f l x) := by
intro l
induction l with
| nil =>
intro x hx _
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = ex /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = x i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).pc = ex /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).regs i = x i
rw [hx]
exact And.intro rfl (fun _ => rfl)
| cons b l ih =>
intro x hx hPx
have h1 : Runs prog 1 o x (o + 1) (upd x c l) := by
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = o + 1 /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = upd x c l i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).pc = o + 1 /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) (o + 1) (x c)).regs i = upd x c l i
rw [hx]
cases b with
| false => exact And.intro rfl (fun _ => rfl)
| true => exact And.intro rfl (fun _ => rfl)
have hP' := hP1 x b l hPx hx
have h2 := hbody (upd x c l) hP'
have h3 : Runs prog 1 (o + 1 + bl) (f (upd x c l)) o (f (upd x c l)) := by
show (run prog 0 (exec (Cfg.mk (o + 1 + bl) (f (upd x c l))) (nthI prog (o + 1 + bl)))).pc = o /\
forall i, (run prog 0 (exec (Cfg.mk (o + 1 + bl) (f (upd x c l))) (nthI prog (o + 1 + bl)))).regs i = f (upd x c l) i
rw [hjmp]
exact And.intro rfl (fun _ => rfl)
have hc : f (upd x c l) c = l := (hkeep _).trans (upd_same x c l)
have h4 := ih (f (upd x c l)) hc (hP2 _ hP')
exact runs_seq prog _ _ o o ex x _ _
(runs_seq prog _ _ o (o + 1 + bl) o x _ _ (runs_seq prog _ _ o (o + 1) (o + 1 + bl) x _ _ h1 h2) h3) h4
/-! ## What the j-loop writes -/
def winJ (k : Nat) (delta : List Bool -> Nat -> Bool) (W t : Nat) : Nat -> Nat -> List Bool
| _, 0 => []
| a, m + 1 => encList (forR k fun b => window (nbV k W t a) (t + 1, (a, b)) (fun p => delta p b) (k + (k + k))) ++
winJ k delta W t (a + 1) m
theorem iter_spec (k : Nat) (delta : List Bool -> Nat -> Bool) (W t : Nat) :
forall (m s : Nat) (x : Nat -> List Bool), x 2 = tr m -> x 3 = tr t -> x 4 = tr (t + 1) ->
x 5 = tr s -> x 6 = tr (s + 1) -> x 7 = tr (s + 2) ->
iter 2 (fB k delta) (tr m) x 0 = revApp (winJ k delta W t (s + 1) m) (x 0) /\
iter 2 (fB k delta) (tr m) x 5 = tr (s + m) /\
iter 2 (fB k delta) (tr m) x 6 = tr (s + 1 + m) /\
iter 2 (fB k delta) (tr m) x 7 = tr (s + 2 + m) /\
iter 2 (fB k delta) (tr m) x 1 = x 1 /\
iter 2 (fB k delta) (tr m) x 3 = tr t /\
iter 2 (fB k delta) (tr m) x 4 = tr (t + 1) := by
intro m
induction m with
| zero => intro s x _ h3 h4 h5 h6 h7; exact And.intro rfl (And.intro h5 (And.intro h6 (And.intro h7 (And.intro rfl (And.intro h3 h4)))))
| succ m ih =>
intro s x _ h3 h4 h5 h6 h7
have c3 : cntOf (upd x 2 (tr m)) 3 = t := by show (x 3).length = t; rw [h3, tr_len]
have c4 : cntOf (upd x 2 (tr m)) 4 = t + 1 := by show (x 4).length = t + 1; rw [h4, tr_len]
have c5 : cntOf (upd x 2 (tr m)) 5 = leftIdx W (s + 1) := by show (x 5).length = s; rw [h5, tr_len]
have c6 : cntOf (upd x 2 (tr m)) 6 = s + 1 := by show (x 6).length = s + 1; rw [h6, tr_len]
have c7 : cntOf (upd x 2 (tr m)) 7 = s + 1 + 1 := by show (x 7).length = s + 2; rw [h7, tr_len]
have hb := bOps_bits (cntOf (upd x 2 (tr m))) 3 4 5 6 7 k W t (s + 1) delta c3 c4 c5 c6 c7 k
have e0 : fB k delta (upd x 2 (tr m)) 0 =
revApp (encList (forR k fun b => window (nbV k W t (s + 1)) (t + 1, (s + 1, b)) (fun p => delta p b) (k + (k + k)))) (x 0) := by
show revApp (bits (cntOf (upd x 2 (tr m))) (bOps 3 4 5 6 7 k delta k)) (x 0) = _
rw [hb]
have r := ih (s + 1) (fB k delta (upd x 2 (tr m))) rfl h3 h4
(congrArg (fun l => true :: l) h5) (congrArg (fun l => true :: l) h6) (congrArg (fun l => true :: l) h7)
refine And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro r.2.2.2.2.1 r.2.2.2.2.2))))
· show iter 2 (fB k delta) (tr m) (fB k delta (upd x 2 (tr m))) 0 = _
rw [r.1, e0, ← revApp_app]
rfl
· show iter 2 (fB k delta) (tr m) (fB k delta (upd x 2 (tr m))) 5 = tr (s + (m + 1))
exact r.2.1.trans (congrArg tr (Nat.add_right_comm s 1 m))
· show iter 2 (fB k delta) (tr m) (fB k delta (upd x 2 (tr m))) 6 = tr (s + 1 + (m + 1))
exact r.2.2.1.trans (congrArg tr (Nat.add_right_comm (s + 1) 1 m))
· show iter 2 (fB k delta) (tr m) (fB k delta (upd x 2 (tr m))) 7 = tr (s + 2 + (m + 1))
exact r.2.2.2.1.trans (congrArg tr (Nat.add_right_comm (s + 2) 1 m))
end Found.Pnp26
#print axioms Found.Pnp26.unIn_app
#print axioms Found.Pnp26.dsIn_app
#print axioms Found.Pnp26.dsIn_dR
#print axioms Found.Pnp26.unIn_litOps
#print axioms Found.Pnp26.unIn_clause
#print axioms Found.Pnp26.unIn_pat
#print axioms Found.Pnp26.in3
#print axioms Found.Pnp26.unIn_ops
#print axioms Found.Pnp26.ne_lo
#print axioms Found.Pnp26.good_of
#print axioms Found.Pnp26.tr_cnt
#print axioms Found.Pnp26.ones_of
#print axioms Found.Pnp26.body_run
#print axioms Found.Pnp26.loop_inv
#print axioms Found.Pnp26.iter_spec
lean_all/found/Pnp27.lean
/-
T330 piece 27. found/Pnp27 -- CLEAR and COPY fragments (CL3b, 8).
CLEAR r: pop r until it is empty (2 |r| + 1 steps).
COPY A B D: with A holding n ones and B empty, put n more ones in front of D, leaving A
as it was (loop: pop A, push 1 on D and on B; then MOVE B A), in 4n + 1 + (3n + 1) steps.
Both change no other register. They reset and copy the cell and time counters between
the rounds of the tableau loops.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp24
namespace Found.Pnp27
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter loop_run)
open Found.Pnp23
open Found.Pnp24 (upd_upd)
/-! ## CLEAR -/
def clear (r : Nat) : List Ins := [.pop r 2 1 1, .jmp 0]
theorem steps_zero (r : Nat) : forall (l : List Bool) (x : Nat -> List Bool),
steps r (fun _ => 0) (fun y => y) l x = 2 * l.length + 1 := by
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show 2 + steps r (fun _ => 0) (fun y => y) l (upd x r l) = 2 * Nat.succ l.length + 1
rw [ih, Nat.mul_succ, Nat.add_comm 2, Nat.add_right_comm]
theorem iter_id (r : Nat) : forall (l : List Bool) (x : Nat -> List Bool), x r = l ->
forall i, iter r (fun y => y) l x i = upd x r [] i := by
intro l
induction l with
| nil =>
intro x hx i
show x i = selR (Nat.beq i r) [] (x i)
cases h : Nat.beq i r with
| false => rfl
| true => rw [Found.Pnp2.beq_eq i r h, hx]; rfl
| cons b l ih =>
intro x _ i
exact (ih (upd x r l) (upd_same x r l) i).trans (upd_upd x r l [] i)
theorem clear_run (prog : List Ins) (o r : Nat) (hf : Frag prog o (clear r)) (l : List Bool) (x : Nat -> List Bool)
(hx : x r = l) : Runs prog (2 * l.length + 1) o x (o + 2) (upd x r []) := by
have i0 : nthI prog o = some (.pop r (o + 2) (o + 1) (o + 1)) := hf 0 _ rfl
have i1 : nthI prog (o + 1 + 0) = some (.jmp o) := hf 1 _ rfl
have L := loop_run r (fun _ => 0) (fun y => y) prog o 0 (o + 2) i0 i1 (fun y => And.intro rfl (fun _ => rfl))
(fun _ => rfl) l x hx
rw [steps_zero] at L
exact And.intro L.1 (fun i => (L.2 i).trans (iter_id r l x hx i))
/-! ## COPY -/
def copyF (A B D : Nat) : List Ins :=
appI [.pop A 4 1 1, .push D true, .push B true, .jmp 0] (mapI (shift 4) (move B A))
theorem copy_run (prog : List Ins) (o A B D : Nat) (hf : Frag prog o (copyF A B D))
(hAB : Nat.beq A B = false) (hAD : Nat.beq A D = false) (hBD : Nat.beq B D = false)
(n : Nat) (x : Nat -> List Bool) (hA : x A = tr n) (hB : x B = []) :
Runs prog (4 * n + 1 + (3 * n + 1)) o x (o + 9) (upd x D (tr n ++ x D)) := by
have hBA := ne_symm' A B hAB
have hDA := ne_symm' A D hAD
have hDB := ne_symm' B D hBD
have hfirst := frag_app_l prog o [.pop A 4 1 1, .push D true, .push B true, .jmp 0] _ hf
have hmv : Frag prog (o + 4) (move B A) := frag_app prog o [.pop A 4 1 1, .push D true, .push B true, .jmp 0] _ hf
have i0 : nthI prog o = some (.pop A (o + 4) (o + 1) (o + 1)) := hfirst 0 _ rfl
have i1 : nthI prog (o + 1) = some (.push D true) := hfirst 1 _ rfl
have i2 : nthI prog (o + 2) = some (.push B true) := hfirst 2 _ rfl
have i3 : nthI prog (o + 1 + 2) = some (.jmp o) := hfirst 3 _ rfl
have hbody : forall y, Runs prog 2 (o + 1) y (o + 1 + 2) (body B D y) := by
intro y
show (run prog 1 (exec (Cfg.mk (o + 1) y) (nthI prog (o + 1)))).pc = o + 1 + 2 /\
forall i, (run prog 1 (exec (Cfg.mk (o + 1) y) (nthI prog (o + 1)))).regs i = body B D y i
rw [i1]
show (run prog 0 (exec (Cfg.mk (o + 2) (upd y D (true :: y D))) (nthI prog (o + 2)))).pc = o + 1 + 2 /\
forall i, (run prog 0 (exec (Cfg.mk (o + 2) (upd y D (true :: y D))) (nthI prog (o + 2)))).regs i = body B D y i
rw [i2]
exact And.intro rfl (fun _ => rfl)
have hkeep : forall y, body B D y A = y A := fun y => by
show upd (upd y D _) B _ A = y A
rw [upd_other _ B A _ hAB, upd_other _ D A _ hAD]
have L := loop_run A (fun _ => 2) (body B D) prog o 2 (o + 4) i0 i3 hbody hkeep (tr n) x hA
rw [steps_two, tr_len] at L
have it := iter_body A B D hAB hAD hBD (tr n) x hA
rw [tr_len, hB, app_nil''] at it
have mv := frag_move_run prog (o + 4) B A hmv hBA (tr n) [] (iter A (body B D) (tr n) x) it.2.2.1 it.1
rw [tr_len] at mv
have M : Runs prog (3 * n + 1) (o + 4) (iter A (body B D) (tr n) x) (o + 9) (upd x D (tr n ++ x D)) := by
refine And.intro mv.1 (fun i => ?_)
cases hiB : Nat.beq i B with
| true =>
rw [Found.Pnp2.beq_eq i B hiB, mv.2.1, upd_other x D B _ hBD, hB]
| false =>
cases hiA : Nat.beq i A with
| true =>
rw [Found.Pnp2.beq_eq i A hiA, mv.2.2.1, revApp_tr, app_nil'', upd_other x D A _ hAD, hA]
| false =>
rw [mv.2.2.2 i hiB hiA]
cases hiD : Nat.beq i D with
| true =>
rw [Found.Pnp2.beq_eq i D hiD, upd_same, it.2.1]
| false =>
rw [upd_other x D i _ hiD]
exact it.2.2.2 i hiA hiB hiD
exact runs_seq prog _ _ o (o + 4) (o + 9) x _ _ L M
end Found.Pnp27
#print axioms Found.Pnp27.steps_zero
#print axioms Found.Pnp27.iter_id
#print axioms Found.Pnp27.clear_run
#print axioms Found.Pnp27.copy_run
lean_all/found/Pnp28.lean
/-
T330 piece 28. found/Pnp28 -- the cell loop as one fragment (CL3b, 9).
Sequencing of code (seqI p q = p followed by q with q's jumps moved past p) and the cell
loop JLOOP = [pop 2 -> exit / body], body (Pnp26), [jump back] as a fragment. Proved:
from registers 3, 4, 5, 6, 7 holding t, t+1, s, s+1, s+2 ones, register 2 holding m ones
and register 1 empty, JLOOP exits with the window clauses of (t, s+1) .. (t, s+m)
pushed on register 0, registers 5, 6, 7 holding s+m, s+m+1, s+m+2 ones, registers 1, 3, 4
as they were, register 2 empty, and every register from 8 on unchanged.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp26
namespace Found.Pnp28
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI frag_app frag_app_l)
open Found.Pnp24 (cmp)
open Found.Pnp26
/-! ## Sequencing -/
def seqI (p q : List Ins) : List Ins := appI p (mapI (shift p.length) q)
theorem frag_seq (prog : List Ins) (o : Nat) (p q : List Ins) (h : Frag prog o (seqI p q)) :
Frag prog o p /\ Frag prog (o + p.length) q :=
And.intro (frag_app_l prog o _ _ h) (frag_app prog o _ _ h)
/-! ## The cell loop -/
def jloop (k : Nat) (delta : List Bool -> Nat -> Bool) : List Ins :=
appI (appI [.pop 2 ((bodyC k delta).length + 2) 1 1] (mapI (shift 1) (bodyC k delta))) [.jmp 0]
/-- The loop invariant: scratch empty, registers 2..7 hold ones. -/
def Inv (x : Nat -> List Bool) : Prop := x 1 = [] /\ Ones x
theorem tr_cons_inv (n : Nat) (b : Bool) (l : List Bool) (h : b :: l = tr n) : l = tr (n - 1) := by
cases n with
| zero => cases h
| succ n => exact (List.cons.inj h).2
theorem inv_pop (x : Nat -> List Bool) (b : Bool) (l : List Bool) (h : Inv x) (hx : x 2 = b :: l) : Inv (upd x 2 l) := by
refine And.intro h.1 (ones_of _ (cntOf x 2 - 1) (cntOf x 3) (cntOf x 4) (cntOf x 5) (cntOf x 6) (cntOf x 7)
?_ (h.2 3 in3) (h.2 4 in4) (h.2 5 in5) (h.2 6 in6) (h.2 7 in7))
show l = tr (cntOf x 2 - 1)
exact tr_cons_inv _ b l (hx.symm.trans (h.2 2 (And.intro (Nat.le_refl 2) (Nat.le_of_ble_eq_true rfl))))
theorem inv_body (k : Nat) (delta : List Bool -> Nat -> Bool) (x : Nat -> List Bool) (h : Inv x) : Inv (fB k delta x) := by
refine And.intro h.1 (ones_of _ (cntOf x 2) (cntOf x 3) (cntOf x 4) (cntOf x 5 + 1) (cntOf x 6 + 1) (cntOf x 7 + 1)
(h.2 2 (And.intro (Nat.le_refl 2) (Nat.le_of_ble_eq_true rfl))) (h.2 3 in3) (h.2 4 in4) ?_ ?_ ?_)
· exact congrArg (fun l => true :: l) (h.2 5 in5)
· exact congrArg (fun l => true :: l) (h.2 6 in6)
· exact congrArg (fun l => true :: l) (h.2 7 in7)
theorem iter_keep (k : Nat) (delta : List Bool -> Nat -> Bool) (i : Nat) (hi : 8 <= i) :
forall (l : List Bool) (x : Nat -> List Bool), iter 2 (fB k delta) l x i = x i := by
have ne : forall a, a + 1 <= 8 -> Nat.beq i a = false := fun a ha =>
Found.Pnp2.beq_false_of_ne i a (fun e => Nat.lt_irrefl a (Nat.lt_of_lt_of_le ha (e ▸ hi)))
have h0 := ne 0 (Nat.le_of_ble_eq_true rfl)
have h2 := ne 2 (Nat.le_of_ble_eq_true rfl)
have h5 := ne 5 (Nat.le_of_ble_eq_true rfl)
have h6 := ne 6 (Nat.le_of_ble_eq_true rfl)
have h7 := ne 7 (Nat.le_of_ble_eq_true rfl)
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show iter 2 (fB k delta) l (fB k delta (upd x 2 l)) i = x i
rw [ih]
show upd (upd (upd (upd (upd x 2 l) 0 _) 5 _) 6 _) 7 _ i = x i
rw [upd_other _ 7 i _ h7, upd_other _ 6 i _ h6, upd_other _ 5 i _ h5, upd_other _ 0 i _ h0, upd_other _ 2 i _ h2]
theorem iter_two (k : Nat) (delta : List Bool -> Nat -> Bool) :
forall (l : List Bool) (x : Nat -> List Bool), x 2 = l -> iter 2 (fB k delta) l x 2 = [] := by
intro l
induction l with
| nil => intro x hx; exact hx
| cons b l ih => intro x _; exact ih _ rfl
/-- JLOOP from o: the window clauses of (t, s+1) .. (t, s+m), then exit. -/
theorem jloop_run (prog : List Ins) (o k : Nat) (delta : List Bool -> Nat -> Bool) (W t m s : Nat)
(hf : Frag prog o (jloop k delta)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h2 : x 2 = tr m) (h3 : x 3 = tr t) (h4 : x 4 = tr (t + 1))
(h5 : x 5 = tr s) (h6 : x 6 = tr (s + 1)) (h7 : x 7 = tr (s + 2)) :
Runs prog (steps 2 (nbB k delta) (fB k delta) (tr m) x) o x (o + ((bodyC k delta).length + 2))
(iter 2 (fB k delta) (tr m) x) /\
iter 2 (fB k delta) (tr m) x 0 = revApp (winJ k delta W t (s + 1) m) (x 0) /\
iter 2 (fB k delta) (tr m) x 1 = [] /\ iter 2 (fB k delta) (tr m) x 2 = [] /\
iter 2 (fB k delta) (tr m) x 3 = tr t /\ iter 2 (fB k delta) (tr m) x 4 = tr (t + 1) /\
iter 2 (fB k delta) (tr m) x 5 = tr (s + m) /\ iter 2 (fB k delta) (tr m) x 6 = tr (s + 1 + m) /\
iter 2 (fB k delta) (tr m) x 7 = tr (s + 2 + m) /\
(forall i, 8 <= i -> iter 2 (fB k delta) (tr m) x i = x i) := by
have fa := frag_app_l prog o _ _ hf
have fb : Frag prog (o + 1) (bodyC k delta) := frag_app prog o [.pop 2 ((bodyC k delta).length + 2) 1 1] _ fa
have i0 : nthI prog o = some (.pop 2 (o + ((bodyC k delta).length + 2)) (o + 1) (o + 1)) := fa 0 _ rfl
have hl : (appI [.pop 2 ((bodyC k delta).length + 2) 1 1] (mapI (shift 1) (bodyC k delta))).length = 1 + (bodyC k delta).length := by
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]; rfl
have i1 : nthI prog (o + 1 + (bodyC k delta).length) = some (.jmp o) := by
have e := hf ((appI [.pop 2 ((bodyC k delta).length + 2) 1 1] (mapI (shift 1) (bodyC k delta))).length + 0) (.jmp 0)
(Found.Pnp23.nthI_app_r _ [.jmp 0] 0)
rw [hl, Nat.add_zero, ← Nat.add_assoc] at e
exact e
have hbody : forall y, Inv y -> Runs prog (nbB k delta y) (o + 1) y (o + 1 + (bodyC k delta).length) (fB k delta y) := by
intro y hy
have r := body_run prog (o + 1) k delta fb y hy.1 hy.2
have e : (bodyC k delta).length = (cmp 1 0 (ops k delta)).length + 3 := by
show (appI (cmp 1 0 (ops k delta)) (mapI _ incs)).length = _
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]
rfl
rw [e, ← Nat.add_assoc]
exact r
have hx : Inv x := And.intro h1 (ones_of x m t (t + 1) s (s + 1) (s + 2) h2 h3 h4 h5 h6 h7)
have L := loop_inv 2 (nbB k delta) (fB k delta) Inv prog o (bodyC k delta).length (o + ((bodyC k delta).length + 2))
i0 i1 hbody (fun _ => rfl) inv_pop (inv_body k delta) (tr m) x h2 hx
have sp := iter_spec k delta W t m s x h2 h3 h4 h5 h6 h7
exact And.intro L (And.intro sp.1 (And.intro (sp.2.2.2.2.1.trans h1) (And.intro (iter_two k delta (tr m) x h2)
(And.intro sp.2.2.2.2.2.1 (And.intro sp.2.2.2.2.2.2 (And.intro sp.2.1 (And.intro sp.2.2.1 (And.intro sp.2.2.2.1
(fun i hi => iter_keep k delta i hi (tr m) x)))))))))
end Found.Pnp28
#print axioms Found.Pnp28.frag_seq
#print axioms Found.Pnp28.tr_cons_inv
#print axioms Found.Pnp28.inv_pop
#print axioms Found.Pnp28.inv_body
#print axioms Found.Pnp28.iter_keep
#print axioms Found.Pnp28.iter_two
#print axioms Found.Pnp28.jloop_run
lean_all/found/Pnp29.lean
/-
T330 piece 29. found/Pnp29 -- one time round of the tableau writer (CL3b, 10).
Round code for time t (registers as in Pnp26; register 9 holds W ones, register 10 holds
W - 1 ones, W = W' + 1):
CLEAR 5; CLEAR 6; CLEAR 7; COPY 9 -> 5 (5 := W, the left cell of j = 0); push 1 on 7;
body (window block of (t, 0), then 5, 6, 7 += 1); CLEAR 5; COPY 10 -> 2 (loop counter
W - 1); JLOOP (cells 1 .. W - 1); push 1 on 3 and on 4 (t := t + 1).
Proved: from registers 1, 2 empty, 3 = t, 4 = t + 1, 9 = W, 10 = W - 1 ones, the round runs
as a fragment and leaves on register 0 the window clauses of (t, 0), (t, 1), ..., (t, W-1)
in order (pushed), registers 3, 4 = t + 1, t + 2, registers 1, 2 empty, 9, 10 kept.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp28
import found.Pnp27
namespace Found.Pnp29
open Found.Pnp8 (window)
open Found.Pnp9 (nbV forR)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_app)
open Found.Pnp24 (cmp bits)
open Found.Pnp25 (encList bOps bOps_bits)
open Found.Pnp26
open Found.Pnp27 (clear copyF clear_run copy_run)
open Found.Pnp28
def rnd (k : Nat) (delta : List Bool -> Nat -> Bool) : List Ins :=
seqI (clear 5) (seqI (clear 6) (seqI (clear 7) (seqI (copyF 9 1 5) (seqI [.push 7 true]
(seqI (bodyC k delta) (seqI (clear 5) (seqI (copyF 10 1 2) (seqI (jloop k delta) [.push 3 true, .push 4 true]))))))))
theorem len_seq (p q : List Ins) : (seqI p q).length = p.length + q.length := by
show (appI p (mapI (shift p.length) q)).length = _
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]
theorem len_body (k : Nat) (delta : List Bool -> Nat -> Bool) :
(bodyC k delta).length = (cmp 1 0 (ops k delta)).length + 3 := by
show (appI (cmp 1 0 (ops k delta)) (mapI _ incs)).length = _
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]
rfl
theorem len_jloop (k : Nat) (delta : List Bool -> Nat -> Bool) : (jloop k delta).length = (bodyC k delta).length + 2 := by
show (appI (appI [_] (mapI (shift 1) (bodyC k delta))) [_]).length = _
rw [Found.Pnp24.len_appI, Found.Pnp24.len_appI, Found.Pnp24.len_mapI]
show 1 + (bodyC k delta).length + 1 = (bodyC k delta).length + 2
rw [Nat.add_comm 1 (bodyC k delta).length]
theorem assoc10 (o a b c d e f g h i j : Nat) :
o + a + b + c + d + e + f + g + h + i + j = o + (a + (b + (c + (d + (e + (f + (g + (h + (i + j))))))))) :=
(Nat.add_assoc (o + a + b + c + d + e + f + g + h) i j).trans
((Nat.add_assoc (o + a + b + c + d + e + f + g) h (i + j)).trans
((Nat.add_assoc (o + a + b + c + d + e + f) g (h + (i + j))).trans
((Nat.add_assoc (o + a + b + c + d + e) f (g + (h + (i + j)))).trans
((Nat.add_assoc (o + a + b + c + d) e (f + (g + (h + (i + j))))).trans
((Nat.add_assoc (o + a + b + c) d (e + (f + (g + (h + (i + j)))))).trans
((Nat.add_assoc (o + a + b) c (d + (e + (f + (g + (h + (i + j))))))).trans
((Nat.add_assoc (o + a) b (c + (d + (e + (f + (g + (h + (i + j)))))))).trans
(Nat.add_assoc o a (b + (c + (d + (e + (f + (g + (h + (i + j))))))))))))))))
theorem len_rnd (k : Nat) (delta : List Bool -> Nat -> Bool) :
(rnd k delta).length = 2 + (2 + (2 + (9 + (1 + ((bodyC k delta).length + (2 + (9 + (((bodyC k delta).length + 2) + 2)))))))) := by
show (seqI (clear 5) _).length = _
rw [len_seq, len_seq, len_seq, len_seq, len_seq, len_seq, len_seq, len_seq, len_seq, len_jloop]
rfl
/-- The window clauses of (t, j). -/
def X (k : Nat) (delta : List Bool -> Nat -> Bool) (W t j : Nat) : List (List (Bool × Found.Pnp9.V)) :=
forR k fun b => window (nbV k W t j) (t + 1, (j, b)) (fun p => delta p b) (k + (k + k))
theorem ne_ge (i a : Nat) (hi : 11 <= i) (ha : a + 1 <= 11) : Nat.beq i a = false :=
Found.Pnp2.beq_false_of_ne i a (fun e => Nat.lt_irrefl a (Nat.lt_of_lt_of_le ha (e ▸ hi)))
/-- The states of the round. -/
def st5 (W' : Nat) (x : Nat -> List Bool) : Nat -> List Bool :=
let x3 := upd (upd (upd x 5 []) 6 []) 7 []
let x4 := upd x3 5 (tr (W' + 1) ++ x3 5)
upd x4 7 (true :: x4 7)
def st8 (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) (x : Nat -> List Bool) : Nat -> List Bool :=
let x7 := upd (fB k delta (st5 W' x)) 5 []
upd x7 2 (tr W' ++ x7 2)
/-- The steps of the round. -/
def rndCost (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) (x : Nat -> List Bool) : Nat :=
2 * (x 5).length + 1 + (2 * (x 6).length + 1) + (2 * (x 7).length + 1) + (4 * (W' + 1) + 1 + (3 * (W' + 1) + 1)) + 1 +
nbB k delta (st5 W' x) + (2 * (fB k delta (st5 W' x) 5).length + 1) + (4 * W' + 1 + (3 * W' + 1)) +
steps 2 (nbB k delta) (fB k delta) (tr W') (st8 k delta W' x) + 2
/-- The registers after the round. -/
def rndF (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) (x : Nat -> List Bool) : Nat -> List Bool :=
let x9 := iter 2 (fB k delta) (tr W') (st8 k delta W' x)
upd (upd x9 3 (true :: x9 3)) 4 (true :: upd x9 3 (true :: x9 3) 4)
theorem rnd_run (prog : List Ins) (o k : Nat) (delta : List Bool -> Nat -> Bool) (W' t : Nat)
(hf : Frag prog o (rnd k delta)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h2 : x 2 = []) (h3 : x 3 = tr t) (h4 : x 4 = tr (t + 1))
(h9 : x 9 = tr (W' + 1)) (h10 : x 10 = tr W') :
Runs prog (rndCost k delta W' x) o x (o + (rnd k delta).length) (rndF k delta W' x) /\
rndF k delta W' x 0 = revApp (encList (X k delta (W' + 1) t 0) ++ winJ k delta (W' + 1) t 1 W') (x 0) /\
rndF k delta W' x 1 = [] /\ rndF k delta W' x 2 = [] /\ rndF k delta W' x 3 = tr (t + 1) /\
rndF k delta W' x 4 = tr (t + 2) /\
(forall i, 9 <= i -> rndF k delta W' x i = x i) := by
-- the pieces of the code
have g0 := frag_seq prog o _ _ hf
have g1 := frag_seq prog _ _ _ g0.2
have g2 := frag_seq prog _ _ _ g1.2
have g3 := frag_seq prog _ _ _ g2.2
have g4 := frag_seq prog _ _ _ g3.2
have g5 := frag_seq prog _ _ _ g4.2
have g6 := frag_seq prog _ _ _ g5.2
have g7 := frag_seq prog _ _ _ g6.2
have g8 := frag_seq prog _ _ _ g7.2
-- the states
let x1 := upd x 5 []
let x2 := upd x1 6 []
let x3 := upd x2 7 []
let x4 := upd x3 5 (tr (W' + 1) ++ x3 5)
let x5 := upd x4 7 (true :: x4 7)
let x6 := fB k delta x5
let x7 := upd x6 5 []
let x8 := upd x7 2 (tr W' ++ x7 2)
let x9 := iter 2 (fB k delta) (tr W') x8
let x10 := upd (upd x9 3 (true :: x9 3)) 4 (true :: upd x9 3 (true :: x9 3) 4)
have R1 := clear_run prog o 5 g0.1 (x 5) x rfl
have R2 := clear_run prog _ 6 g1.1 (x1 6) x1 rfl
have R3 := clear_run prog _ 7 g2.1 (x2 7) x2 rfl
have R4 := copy_run prog _ 9 1 5 g3.1 rfl rfl rfl (W' + 1) x3 h9 h1
have R5 : Runs prog 1 (o + 2 + 2 + 2 + 9) x4 (o + 2 + 2 + 2 + 9 + 1) x5 := by
have i0 : nthI prog (o + 2 + 2 + 2 + 9) = some (.push 7 true) := g4.1 0 _ rfl
show (run prog 0 (exec (Cfg.mk (o + 2 + 2 + 2 + 9) x4) (nthI prog (o + 2 + 2 + 2 + 9)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + 2 + 2 + 2 + 9) x4) (nthI prog (o + 2 + 2 + 2 + 9)))).regs i = x5 i
rw [i0]
exact And.intro rfl (fun _ => rfl)
have o5 : Ones x5 := ones_of x5 0 t (t + 1) (W' + 1) 0 1 h2 h3 h4 (app_nil'' (tr (W' + 1))) rfl rfl
have R6 : Runs prog (nbB k delta x5) (o + 2 + 2 + 2 + 9 + 1) x5 (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length) x6 := by
have r := body_run prog _ k delta g5.1 x5 h1 o5
rw [len_body, ← Nat.add_assoc]
exact r
have R7 := clear_run prog _ 5 g6.1 (x6 5) x6 rfl
have R8 := copy_run prog _ 10 1 2 g7.1 rfl rfl rfl W' x7 h10 h1
have h82 : x8 2 = tr W' := by show tr W' ++ x 2 = tr W'; rw [h2, app_nil'']
have J := jloop_run prog _ k delta (W' + 1) t W' 0 g8.1 x8 h1 h82 h3 h4 rfl rfl rfl
have R10 : Runs prog 2 (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length) x9
(o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 2) x10 := by
have i0 : nthI prog (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 0) =
some (.push 3 true) := g8.2 0 _ rfl
have i1 : nthI prog (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 1) =
some (.push 4 true) := g8.2 1 _ rfl
show (run prog 1 (exec (Cfg.mk _ x9) (nthI prog (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 0)))).pc = _ /\
forall i, (run prog 1 (exec (Cfg.mk _ x9) (nthI prog (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 0)))).regs i = x10 i
rw [i0]
show (run prog 0 (exec (Cfg.mk _ _) (nthI prog (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 1)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk _ (upd x9 3 (true :: x9 3))) (nthI prog (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 1)))).regs i = x10 i
rw [i1]
exact And.intro rfl (fun _ => rfl)
have J1 : Runs prog (steps 2 (nbB k delta) (fB k delta) (tr W') x8) (o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9) x8
(o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length) x9 := by
have r := J.1
rw [← len_jloop] at r
exact r
have all := runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _
(runs_seq prog _ _ _ _ _ x _ _ R1 R2) R3) R4) R5) R6) R7) R8) J1) R10
have ePC : o + 2 + 2 + 2 + 9 + 1 + (bodyC k delta).length + 2 + 9 + (jloop k delta).length + 2 = o + (rnd k delta).length := by
rw [len_rnd, len_jloop]
exact assoc10 o 2 2 2 9 1 (bodyC k delta).length 2 9 ((bodyC k delta).length + 2) 2
rw [ePC] at all
refine And.intro all ?_
-- the register facts
have c3 : cntOf x5 3 = t := by show (x 3).length = t; rw [h3, tr_len]
have c4 : cntOf x5 4 = t + 1 := by show (x 4).length = t + 1; rw [h4, tr_len]
have c5 : cntOf x5 5 = Found.Pnp9.leftIdx (W' + 1) 0 := by show (tr (W' + 1) ++ []).length = W' + 1; rw [app_nil'', tr_len]
have hb := bOps_bits (cntOf x5) 3 4 5 6 7 k (W' + 1) t 0 delta c3 c4 c5 rfl rfl k
refine And.intro ?_ (And.intro J.2.2.1 (And.intro J.2.2.2.1 (And.intro ?_ (And.intro ?_ ?_))))
· show iter 2 (fB k delta) (tr W') x8 0 = _
rw [J.2.1]
show revApp (winJ k delta (W' + 1) t (0 + 1) W') (revApp (bits (cntOf x5) (bOps 3 4 5 6 7 k delta k)) (x 0)) = _
rw [hb, ← revApp_app]
rfl
· show true :: iter 2 (fB k delta) (tr W') x8 3 = tr (t + 1); rw [J.2.2.2.2.1]; rfl
· show true :: iter 2 (fB k delta) (tr W') x8 4 = tr (t + 2); rw [J.2.2.2.2.2.1]; rfl
· intro i hi
have hi8 : 8 <= i := Nat.le_trans (Nat.le_succ 8) hi
show upd (upd x9 3 _) 4 _ i = x i
have n4 : Nat.beq i 4 = false := Found.Pnp2.beq_false_of_ne i 4 (fun e => Nat.lt_irrefl 4 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
have n3 : Nat.beq i 3 = false := Found.Pnp2.beq_false_of_ne i 3 (fun e => Nat.lt_irrefl 3 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
have n2 : Nat.beq i 2 = false := Found.Pnp2.beq_false_of_ne i 2 (fun e => Nat.lt_irrefl 2 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
have n5 : Nat.beq i 5 = false := Found.Pnp2.beq_false_of_ne i 5 (fun e => Nat.lt_irrefl 5 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
have n6 : Nat.beq i 6 = false := Found.Pnp2.beq_false_of_ne i 6 (fun e => Nat.lt_irrefl 6 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
have n7 : Nat.beq i 7 = false := Found.Pnp2.beq_false_of_ne i 7 (fun e => Nat.lt_irrefl 7 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
have n0 : Nat.beq i 0 = false := Found.Pnp2.beq_false_of_ne i 0 (fun e => Nat.lt_irrefl 0 (Nat.lt_of_lt_of_le (Nat.le_of_ble_eq_true rfl) (e ▸ hi)))
rw [upd_other _ 4 i _ n4, upd_other _ 3 i _ n3]
show iter 2 (fB k delta) (tr W') x8 i = x i
rw [J.2.2.2.2.2.2.2.2.2 i hi8]
show upd x7 2 _ i = x i
rw [upd_other _ 2 i _ n2]
show upd x6 5 [] i = x i
rw [upd_other _ 5 i _ n5]
show upd (upd (upd (upd x5 0 _) 5 _) 6 _) 7 _ i = x i
rw [upd_other _ 7 i _ n7, upd_other _ 6 i _ n6, upd_other _ 5 i _ n5, upd_other _ 0 i _ n0]
show upd x4 7 _ i = x i
rw [upd_other _ 7 i _ n7]
show upd x3 5 _ i = x i
rw [upd_other _ 5 i _ n5]
show upd (upd (upd x 5 []) 6 []) 7 [] i = x i
rw [upd_other _ 7 i _ n7, upd_other _ 6 i _ n6, upd_other _ 5 i _ n5]
/-- The round keeps every register from 9 on, whatever the registers hold. -/
theorem rndF_keep (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) (x : Nat -> List Bool) (i : Nat) (hi : 9 <= i) :
rndF k delta W' x i = x i := by
have ne : forall a, a + 1 <= 9 -> Nat.beq i a = false := fun a ha =>
Found.Pnp2.beq_false_of_ne i a (fun e => Nat.lt_irrefl a (Nat.lt_of_lt_of_le ha (e ▸ hi)))
have n0 := ne 0 (Nat.le_of_ble_eq_true rfl)
have n2 := ne 2 (Nat.le_of_ble_eq_true rfl)
have n3 := ne 3 (Nat.le_of_ble_eq_true rfl)
have n4 := ne 4 (Nat.le_of_ble_eq_true rfl)
have n5 := ne 5 (Nat.le_of_ble_eq_true rfl)
have n6 := ne 6 (Nat.le_of_ble_eq_true rfl)
have n7 := ne 7 (Nat.le_of_ble_eq_true rfl)
show upd (upd (iter 2 (fB k delta) (tr W') (st8 k delta W' x)) 3 _) 4 _ i = x i
rw [upd_other _ 4 i _ n4, upd_other _ 3 i _ n3, iter_keep k delta i (Nat.le_trans (Nat.le_succ 8) hi)]
show upd (upd (fB k delta (st5 W' x)) 5 []) 2 _ i = x i
rw [upd_other _ 2 i _ n2, upd_other _ 5 i _ n5]
show upd (upd (upd (upd (st5 W' x) 0 _) 5 _) 6 _) 7 _ i = x i
rw [upd_other _ 7 i _ n7, upd_other _ 6 i _ n6, upd_other _ 5 i _ n5, upd_other _ 0 i _ n0]
show upd (upd (upd (upd (upd x 5 []) 6 []) 7 []) 5 _) 7 _ i = x i
rw [upd_other _ 7 i _ n7, upd_other _ 5 i _ n5, upd_other _ 7 i _ n7, upd_other _ 6 i _ n6, upd_other _ 5 i _ n5]
end Found.Pnp29
#print axioms Found.Pnp29.len_seq
#print axioms Found.Pnp29.len_body
#print axioms Found.Pnp29.len_jloop
#print axioms Found.Pnp29.assoc10
#print axioms Found.Pnp29.len_rnd
#print axioms Found.Pnp29.ne_ge
#print axioms Found.Pnp29.rnd_run
#print axioms Found.Pnp29.rndF_keep
lean_all/found/Pnp3.lean
/-
T330 piece 3. found/Pnp3 -- polynomial-time reductions (structure side).
Tool results (they relativize, so they are tools only; PNP_MAP.md):
* polynomial expressions as trees; evaluation is monotone and closed under
substitution (so polynomial bounds compose without exponent arithmetic);
* a machine model with output (the tool missing in piece 1): runs with a step budget,
monotone in the budget, output no longer than budget plus input, and sequential
composition adding budgets -- any model of the Church-Turing line is one value;
* composition of polynomial-time maps is polynomial-time;
* reductions are transitive, and P is closed under reductions.
Written with ASCII forms only. CIC dependence: none.
-/
namespace Found.Pnp3
/-! ## Polynomial expressions -/
inductive PE where
| x : PE
| c : Nat -> PE
| add : PE -> PE -> PE
| mul : PE -> PE -> PE
def pe : PE -> Nat -> Nat
| .x, n => n
| .c k, _ => k
| .add a b, n => pe a n + pe b n
| .mul a b, n => pe a n * pe b n
/-- Substitute f for the variable. -/
def comp : PE -> PE -> PE
| .x, f => f
| .c k, _ => .c k
| .add a b, f => .add (comp a f) (comp b f)
| .mul a b, f => .mul (comp a f) (comp b f)
theorem pe_comp (f : PE) (n : Nat) : forall e : PE, pe (comp e f) n = pe e (pe f n) := by
intro e
induction e with
| x => rfl
| c k => rfl
| add a b iha ihb =>
show pe (comp a f) n + pe (comp b f) n = pe a (pe f n) + pe b (pe f n)
rw [iha, ihb]
| mul a b iha ihb =>
show pe (comp a f) n * pe (comp b f) n = pe a (pe f n) * pe b (pe f n)
rw [iha, ihb]
theorem pe_mono (m n : Nat) (h : m <= n) : forall e : PE, pe e m <= pe e n := by
intro e
induction e with
| x => exact h
| c k => exact Nat.le_refl k
| add a b iha ihb => exact Nat.add_le_add iha ihb
| mul a b iha ihb => exact Nat.mul_le_mul iha ihb
/-! ## A machine model with output -/
structure OM where
Prog : Type
run : Prog -> Nat -> List Bool -> Option (List Bool)
seq : Prog -> Prog -> Prog
fuel_mono : forall p t t' x y, run p t x = some y -> t <= t' -> run p t' x = some y
out_le : forall p t x y, run p t x = some y -> y.length <= t + x.length
seq_run : forall p q t s x y z, run p t x = some y -> run q s y = some z ->
run (seq p q) (t + s) x = some z
variable (M : OM)
/-- Program p computes f within the polynomial e of the input length. -/
def Computes (p : M.Prog) (e : PE) (f : List Bool -> List Bool) : Prop :=
forall x, M.run p (pe e x.length) x = some (f x)
/-- The bound of a composition: e(n) + e'(e(n) + n). -/
def compBound (e e' : PE) : PE := .add e (comp e' (.add e .x))
theorem comp_computes (p q : M.Prog) (e e' : PE) (f g : List Bool -> List Bool)
(hp : Computes M p e f) (hq : Computes M q e' g) :
Computes M (M.seq p q) (compBound e e') (fun x => g (f x)) := by
intro x
have h1 : M.run p (pe e x.length) x = some (f x) := hp x
have hl : (f x).length <= pe e x.length + x.length := M.out_le p _ x (f x) h1
have h2 : M.run q (pe e' (pe e x.length + x.length)) (f x) = some (g (f x)) :=
M.fuel_mono q _ _ (f x) (g (f x)) (hq (f x)) (pe_mono _ _ hl e')
have h3 := M.seq_run p q _ _ x (f x) (g (f x)) h1 h2
show M.run (M.seq p q) (pe e x.length + pe (comp e' (.add e .x)) x.length) x = some (g (f x))
rw [pe_comp]
exact h3
/-! ## Reductions -/
/-- L reduces to L' in polynomial time. -/
def Red (L L' : List Bool -> Bool) : Prop :=
Exists fun p : M.Prog => Exists fun e : PE => Exists fun r : List Bool -> List Bool =>
Computes M p e r /\ forall x, L x = L' (r x)
/-- L is decided in polynomial time (the output is the one-bit list [L x]). -/
def InPo (L : List Bool -> Bool) : Prop :=
Exists fun p : M.Prog => Exists fun e : PE => Computes M p e (fun x => [L x])
theorem red_trans (L1 L2 L3 : List Bool -> Bool) (h12 : Red M L1 L2) (h23 : Red M L2 L3) :
Red M L1 L3 :=
Exists.elim h12 fun p hp => Exists.elim hp fun e he => Exists.elim he fun r hr =>
Exists.elim h23 fun q hq => Exists.elim hq fun e' he' => Exists.elim he' fun r' hr' =>
Exists.intro (M.seq p q) (Exists.intro (compBound e e') (Exists.intro (fun x => r' (r x))
(And.intro (comp_computes M p q e e' r r' hr.1 hr'.1)
(fun x => (hr.2 x).trans (hr'.2 (r x))))))
theorem red_P (L L' : List Bool -> Bool) (hr : Red M L L') (hP : InPo M L') : InPo M L :=
Exists.elim hr fun p hp => Exists.elim hp fun e he => Exists.elim he fun r hr' =>
Exists.elim hP fun q hq => Exists.elim hq fun e' he' =>
Exists.intro (M.seq p q) (Exists.intro (compBound e e') (fun x =>
Eq.symm (Eq.trans (congrArg (fun b => some [b]) (hr'.2 x))
(comp_computes M p q e e' r (fun y => [L' y]) hr'.1 he' x).symm)))
theorem red_refl (L : List Bool -> Bool) (p : M.Prog) (e : PE)
(hid : Computes M p e (fun x => x)) : Red M L L :=
Exists.intro p (Exists.intro e (Exists.intro (fun x => x) (And.intro hid (fun _ => rfl))))
end Found.Pnp3
#print axioms Found.Pnp3.pe_comp
#print axioms Found.Pnp3.pe_mono
#print axioms Found.Pnp3.comp_computes
#print axioms Found.Pnp3.red_trans
#print axioms Found.Pnp3.red_P
#print axioms Found.Pnp3.red_refl
lean_all/found/Pnp30.lean
/-
T330 piece 30. found/Pnp30 -- the time loop: all window clauses of the tableau (CL3b, 11).
TLOOP: pop register 11 (T ones) -> exit / one time round (Pnp29), jump back. Proved:
* the round invariant (scratch registers empty, 3 = t, 4 = t + 1 for some t, 9 = W,
10 = W - 1) is kept, and the round keeps register 11;
* after the loop has run over T ones from t = 0, register 0 holds (pushed) the
encoding of all window clauses of the tableau, Pnp9.windows, in order: the
encList of windows delta k W T equals the rows written round by round.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp29
namespace Found.Pnp30
open Found.Pnp8 (window)
open Found.Pnp9 (nbV forR windows)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_app)
open Found.Pnp25 (encList encList_app)
open Found.Pnp26 (winJ loop_inv)
open Found.Pnp28 (seqI)
open Found.Pnp29
/-! ## Rows -/
def row (k : Nat) (delta : List Bool -> Nat -> Bool) (W' t : Nat) : List Bool :=
encList (X k delta (W' + 1) t 0) ++ winJ k delta (W' + 1) t 1 W'
def tRows (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) : Nat -> Nat -> List Bool
| _, 0 => []
| t, m + 1 => row k delta W' t ++ tRows k delta W' (t + 1) m
theorem app_assoc3 (A B C : List Bool) : (A ++ B) ++ C = A ++ (B ++ C) := Found.Pnp19.app_assoc' A B C
theorem winJ_snoc (k : Nat) (delta : List Bool -> Nat -> Bool) (W t : Nat) :
forall m a, winJ k delta W t a (m + 1) = winJ k delta W t a m ++ encList (X k delta W t (a + m)) := by
intro m
induction m with
| zero => intro a; show encList (X k delta W t a) ++ [] = [] ++ encList (X k delta W t (a + 0)); rw [app_nil'']; rfl
| succ m ih =>
intro a
show encList (X k delta W t a) ++ winJ k delta W t (a + 1) (m + 1) =
(encList (X k delta W t a) ++ winJ k delta W t (a + 1) m) ++ encList (X k delta W t (a + (m + 1)))
rw [ih (a + 1), app_assoc3, Nat.add_right_comm a 1 m]
rfl
theorem row_eq (k : Nat) (delta : List Bool -> Nat -> Bool) (W' t : Nat) :
forall m, encList (forR (m + 1) fun j => X k delta (W' + 1) t j) =
encList (X k delta (W' + 1) t 0) ++ winJ k delta (W' + 1) t 1 m := by
intro m
induction m with
| zero => show encList ([] ++ X k delta (W' + 1) t 0) = encList (X k delta (W' + 1) t 0) ++ []; rw [app_nil'']; rfl
| succ m ih =>
show encList (forR (m + 1) (fun j => X k delta (W' + 1) t j) ++ X k delta (W' + 1) t (m + 1)) = _
rw [encList_app, ih, winJ_snoc, app_assoc3, Nat.add_comm 1 m]
theorem tRows_snoc (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) :
forall m t, tRows k delta W' t (m + 1) = tRows k delta W' t m ++ row k delta W' (t + m) := by
intro m
induction m with
| zero => intro t; show row k delta W' t ++ [] = [] ++ row k delta W' (t + 0); rw [app_nil'']; rfl
| succ m ih =>
intro t
show row k delta W' t ++ tRows k delta W' (t + 1) (m + 1) = (row k delta W' t ++ tRows k delta W' (t + 1) m) ++ _
rw [ih (t + 1), app_assoc3, Nat.add_right_comm t 1 m]
rfl
/-- The window clauses of the tableau are the rows, in order. -/
theorem windows_rows (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) :
forall T, encList (windows delta k (W' + 1) T) = tRows k delta W' 0 T := by
intro T
induction T with
| zero => rfl
| succ T ih =>
show encList (windows delta k (W' + 1) T ++ forR (W' + 1) (fun j => X k delta (W' + 1) T j)) = _
rw [encList_app, ih, row_eq, tRows_snoc, Nat.zero_add]
rfl
/-! ## The time loop -/
def tloop (k : Nat) (delta : List Bool -> Nat -> Bool) : List Ins :=
appI (appI [.pop 11 ((rnd k delta).length + 2) 1 1] (mapI (shift 1) (rnd k delta))) [.jmp 0]
def Pt (W' : Nat) (x : Nat -> List Bool) : Prop :=
x 1 = [] /\ x 2 = [] /\ (Exists fun t => x 3 = tr t /\ x 4 = tr (t + 1)) /\ x 9 = tr (W' + 1) /\ x 10 = tr W'
/-- What a round does to the registers (no program needed). -/
theorem rnd_facts (k : Nat) (delta : List Bool -> Nat -> Bool) (W' t : Nat) (x : Nat -> List Bool)
(h1 : x 1 = []) (h2 : x 2 = []) (h3 : x 3 = tr t) (h4 : x 4 = tr (t + 1)) :
rndF k delta W' x 0 = revApp (row k delta W' t) (x 0) /\ rndF k delta W' x 1 = [] /\ rndF k delta W' x 2 = [] /\
rndF k delta W' x 3 = tr (t + 1) /\ rndF k delta W' x 4 = tr (t + 2) := by
have h82 : st8 k delta W' x 2 = tr W' := by show tr W' ++ x 2 = tr W'; rw [h2, app_nil'']
have sp := Found.Pnp26.iter_spec k delta (W' + 1) t W' 0 (st8 k delta W' x) h82 h3 h4 rfl rfl rfl
have c3 : Found.Pnp26.cntOf (st5 W' x) 3 = t := by show (x 3).length = t; rw [h3, tr_len]
have c4 : Found.Pnp26.cntOf (st5 W' x) 4 = t + 1 := by show (x 4).length = t + 1; rw [h4, tr_len]
have c5 : Found.Pnp26.cntOf (st5 W' x) 5 = Found.Pnp9.leftIdx (W' + 1) 0 := by
show (tr (W' + 1) ++ []).length = W' + 1; rw [app_nil'', tr_len]
have hb := Found.Pnp25.bOps_bits (Found.Pnp26.cntOf (st5 W' x)) 3 4 5 6 7 k (W' + 1) t 0 delta c3 c4 c5 rfl rfl k
refine And.intro ?_ (And.intro (sp.2.2.2.2.1.trans h1) (And.intro (Found.Pnp28.iter_two k delta _ _ h82) (And.intro ?_ ?_)))
· show iter 2 (Found.Pnp26.fB k delta) (tr W') (st8 k delta W' x) 0 = _
rw [sp.1]
show revApp (winJ k delta (W' + 1) t (0 + 1) W')
(revApp (Found.Pnp24.bits (Found.Pnp26.cntOf (st5 W' x)) (Found.Pnp25.bOps 3 4 5 6 7 k delta k)) (x 0)) = _
rw [hb, ← revApp_app]
rfl
· show true :: iter 2 (Found.Pnp26.fB k delta) (tr W') (st8 k delta W' x) 3 = tr (t + 1)
rw [sp.2.2.2.2.2.1]; rfl
· show true :: iter 2 (Found.Pnp26.fB k delta) (tr W') (st8 k delta W' x) 4 = tr (t + 2)
rw [sp.2.2.2.2.2.2]; rfl
theorem tIter (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) :
forall m t (x : Nat -> List Bool), x 1 = [] -> x 2 = [] -> x 3 = tr t -> x 4 = tr (t + 1) ->
iter 11 (rndF k delta W') (tr m) x 0 = revApp (tRows k delta W' t m) (x 0) := by
intro m
induction m with
| zero => intro t x _ _ _ _; rfl
| succ m ih =>
intro t x h1 h2 h3 h4
have r := rnd_facts k delta W' t (upd x 11 (tr m)) h1 h2 h3 h4
show iter 11 (rndF k delta W') (tr m) (rndF k delta W' (upd x 11 (tr m))) 0 = _
rw [ih (t + 1) _ r.2.1 r.2.2.1 r.2.2.2.1 r.2.2.2.2, r.1, ← revApp_app]
rfl
/-- The time loop from o: from t = 0 with register 11 holding T ones, it pushes the
encoding of all window clauses of the tableau onto register 0. -/
theorem tloop_run (prog : List Ins) (o k : Nat) (delta : List Bool -> Nat -> Bool) (W' T : Nat)
(hf : Frag prog o (tloop k delta)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h2 : x 2 = []) (h3 : x 3 = tr 0) (h4 : x 4 = tr 1)
(h9 : x 9 = tr (W' + 1)) (h10 : x 10 = tr W') (h11 : x 11 = tr T) :
Runs prog (steps 11 (rndCost k delta W') (rndF k delta W') (tr T) x) o x (o + ((rnd k delta).length + 2))
(iter 11 (rndF k delta W') (tr T) x) /\
iter 11 (rndF k delta W') (tr T) x 0 = revApp (encList (windows delta k (W' + 1) T)) (x 0) := by
have fa := Found.Pnp23.frag_app_l prog o _ _ hf
have fb : Frag prog (o + 1) (rnd k delta) := Found.Pnp23.frag_app prog o [.pop 11 ((rnd k delta).length + 2) 1 1] _ fa
have i0 : nthI prog o = some (.pop 11 (o + ((rnd k delta).length + 2)) (o + 1) (o + 1)) := fa 0 _ rfl
have hl : (appI [.pop 11 ((rnd k delta).length + 2) 1 1] (mapI (shift 1) (rnd k delta))).length = 1 + (rnd k delta).length := by
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]; rfl
have i1 : nthI prog (o + 1 + (rnd k delta).length) = some (.jmp o) := by
have e := hf ((appI [.pop 11 ((rnd k delta).length + 2) 1 1] (mapI (shift 1) (rnd k delta))).length + 0) (.jmp 0)
(Found.Pnp23.nthI_app_r _ [.jmp 0] 0)
rw [hl, Nat.add_zero, ← Nat.add_assoc] at e
exact e
have hbody : forall y, Pt W' y -> Runs prog (rndCost k delta W' y) (o + 1) y (o + 1 + (rnd k delta).length) (rndF k delta W' y) := by
intro y hy
exact Exists.elim hy.2.2.1 fun t ht => (rnd_run prog (o + 1) k delta W' t fb y hy.1 hy.2.1 ht.1 ht.2 hy.2.2.2.1 hy.2.2.2.2).1
have hP1 : forall y b l, Pt W' y -> y 11 = b :: l -> Pt W' (upd y 11 l) := fun y _ _ hy _ => hy
have hP2 : forall y, Pt W' y -> Pt W' (rndF k delta W' y) := by
intro y hy
exact Exists.elim hy.2.2.1 fun t ht => by
have r := rnd_facts k delta W' t y hy.1 hy.2.1 ht.1 ht.2
exact And.intro r.2.1 (And.intro r.2.2.1 (And.intro (Exists.intro (t + 1) (And.intro r.2.2.2.1 r.2.2.2.2))
(And.intro ((rndF_keep k delta W' y 9 (Nat.le_refl 9)).trans hy.2.2.2.1)
((rndF_keep k delta W' y 10 (Nat.le_succ 9)).trans hy.2.2.2.2))))
have hx : Pt W' x := And.intro h1 (And.intro h2 (And.intro (Exists.intro 0 (And.intro h3 h4)) (And.intro h9 h10)))
have L := loop_inv 11 (rndCost k delta W') (rndF k delta W') (Pt W') prog o (rnd k delta).length
(o + ((rnd k delta).length + 2)) i0 i1 hbody (fun y => rndF_keep k delta W' y 11 (Nat.le_of_ble_eq_true rfl)) hP1 hP2 (tr T) x h11 hx
refine And.intro L ?_
rw [tIter k delta W' T 0 x h1 h2 h3 h4, windows_rows]
end Found.Pnp30
#print axioms Found.Pnp30.app_assoc3
#print axioms Found.Pnp30.winJ_snoc
#print axioms Found.Pnp30.row_eq
#print axioms Found.Pnp30.tRows_snoc
#print axioms Found.Pnp30.windows_rows
#print axioms Found.Pnp30.rnd_facts
#print axioms Found.Pnp30.tIter
#print axioms Found.Pnp30.tloop_run
lean_all/found/Pnp31.lean
/-
T330 piece 31. found/Pnp31 -- the boundary unit clauses of the tableau (CL3b, 12).
The tableau CNF (Pnp9) ends with the unit clauses [(false, (t, (W, b)))] for t <= T,
b < k. For time t (register 3) and the width W (register 9) the k unit clauses of t are
a straight-line block (Pnp24): per bit b, emit [true, true, false], the unary codes of
registers 3 and 9, the fixed unary code of b, and [false]. BLOOP pops register 12
(T + 1 ones) and runs that block, then pushes a one on register 3. Proved:
* the block of time t writes the encodings of the k unit clauses of t, in order;
* the block body runs as a fragment and keeps the invariant (register 1 empty,
register 3 = t for some t, register 9 = W) and register 12;
* from t = 0 with register 12 holding T + 1 ones, BLOOP pushes onto register 0 the
encoding of all boundary clauses of the tableau, Pnp9.bounds, in order;
* the loop changes no register other than 0, 3 and 12.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp30
namespace Found.Pnp31
open Found.Pnp9 (V forR bounds)
open Found.Pnp19 (un app_assoc')
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_app)
open Found.Pnp24 (Op cmp bits cost Good block_run)
open Found.Pnp25 (encList encList_app bits_app)
open Found.Pnp26 (cntOf loop_inv)
open Found.Pnp28 (seqI frag_seq)
/-! ## The block of one time -/
/-- The unit clauses of time t. -/
def U (k W t : Nat) : List (List (Bool × V)) := forR k fun b => [[(false, (t, (W, b)))]]
def uOps (RT RW b : Nat) : List Op := [.emit [true, true, false], .un RT, .un RW, .emit (un b), .emit [false]]
theorem u_bits (cnt : Nat -> Nat) (RT RW t W b : Nat) (hT : cnt RT = t) (hW : cnt RW = W) :
bits cnt (uOps RT RW b) = encList [[(false, (t, (W, b)))]] := by
show [true, true, false] ++ (un (cnt RT) ++ (un (cnt RW) ++ (un b ++ ([false] ++ [])))) = _
rw [hT, hW]
show true :: true :: false :: (un t ++ (un W ++ (un b ++ [false]))) =
true :: true :: false :: (((un t ++ (un W ++ un b)) ++ [false]) ++ [])
rw [app_nil'', app_assoc', app_assoc']
def bdOps (RT RW : Nat) : Nat -> List Op
| 0 => []
| b + 1 => bdOps RT RW b ++ uOps RT RW b
theorem bd_bits (cnt : Nat -> Nat) (RT RW t W : Nat) (hT : cnt RT = t) (hW : cnt RW = W) :
forall n, bits cnt (bdOps RT RW n) = encList (U n W t) := by
intro n
induction n with
| zero => rfl
| succ n ih =>
show bits cnt (bdOps RT RW n ++ uOps RT RW n) = encList (U n W t ++ [[(false, (t, (W, n)))]])
rw [bits_app, ih, encList_app, u_bits cnt RT RW t W n hT hW]
theorem good_app (x : Nat -> List Bool) (cnt : Nat -> Nat) :
forall (A B : List Op), Good 1 0 x cnt A -> Good 1 0 x cnt B -> Good 1 0 x cnt (A ++ B) := by
intro A
induction A with
| nil => intro B _ hB; exact hB
| cons op A ih =>
intro B hA hB
cases op with
| emit w => exact ih B hA hB
| un R => exact And.intro hA.1 (ih B hA.2 hB)
theorem good_bd (x : Nat -> List Bool) (t W : Nat) (h3 : x 3 = tr t) (h9 : x 9 = tr W) :
forall n, Good 1 0 x (cntOf x) (bdOps 3 9 n) := by
have c3 : x 3 = tr (cntOf x 3) := Found.Pnp26.tr_cnt x 3 t h3
have c9 : x 9 = tr (cntOf x 9) := Found.Pnp26.tr_cnt x 9 W h9
intro n
induction n with
| zero => exact True.intro
| succ n ih =>
exact good_app x (cntOf x) _ _ ih
(And.intro (And.intro rfl (And.intro rfl c3)) (And.intro (And.intro rfl (And.intro rfl c9)) True.intro))
/-! ## The body: the block, then t := t + 1 -/
def bbody (k : Nat) : List Ins := seqI (cmp 1 0 (bdOps 3 9 k)) [.push 3 true]
def fb (k : Nat) (x : Nat -> List Bool) : Nat -> List Bool :=
let y := upd x 0 (revApp (bits (cntOf x) (bdOps 3 9 k)) (x 0))
upd y 3 (true :: y 3)
def nbb (k : Nat) (x : Nat -> List Bool) : Nat := cost (cntOf x) (bdOps 3 9 k) + 1
theorem len_bbody (k : Nat) : (bbody k).length = (cmp 1 0 (bdOps 3 9 k)).length + 1 :=
Found.Pnp29.len_seq _ _
theorem bbody_run (prog : List Ins) (o k t W : Nat) (hf : Frag prog o (bbody k)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h3 : x 3 = tr t) (h9 : x 9 = tr W) :
Runs prog (nbb k x) o x (o + (bbody k).length) (fb k x) := by
have g := frag_seq prog o _ _ hf
have r1 := block_run 1 0 prog rfl (cntOf x) (bdOps 3 9 k) o x g.1 h1 (good_bd x t W h3 h9 k)
have i0 : nthI prog (o + (cmp 1 0 (bdOps 3 9 k)).length) = some (.push 3 true) := g.2 0 _ rfl
have r2 : Runs prog 1 (o + (cmp 1 0 (bdOps 3 9 k)).length) (upd x 0 (revApp (bits (cntOf x) (bdOps 3 9 k)) (x 0)))
(o + (cmp 1 0 (bdOps 3 9 k)).length + 1) (fb k x) := by
show (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (bdOps 3 9 k)).length) _) (nthI prog (o + (cmp 1 0 (bdOps 3 9 k)).length)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (bdOps 3 9 k)).length)
(upd x 0 (revApp (bits (cntOf x) (bdOps 3 9 k)) (x 0)))) (nthI prog (o + (cmp 1 0 (bdOps 3 9 k)).length)))).regs i = _
rw [i0]
exact And.intro rfl (fun _ => rfl)
have r3 := runs_seq prog _ _ _ _ _ x _ _ r1 r2
rw [len_bbody, <- Nat.add_assoc]
exact r3
/-- What the body does to the registers (no program needed). -/
theorem fb_facts (k t W : Nat) (x : Nat -> List Bool) (h1 : x 1 = []) (h3 : x 3 = tr t) (h9 : x 9 = tr W) :
fb k x 0 = revApp (encList (U k W t)) (x 0) /\ fb k x 1 = [] /\ fb k x 3 = tr (t + 1) /\ fb k x 9 = tr W := by
have c3 : cntOf x 3 = t := by show (x 3).length = t; rw [h3, tr_len]
have c9 : cntOf x 9 = W := by show (x 9).length = W; rw [h9, tr_len]
refine And.intro ?_ (And.intro h1 (And.intro ?_ h9))
· show revApp (bits (cntOf x) (bdOps 3 9 k)) (x 0) = _
rw [bd_bits (cntOf x) 3 9 t W c3 c9 k]
· show true :: x 3 = tr (t + 1)
rw [h3]
rfl
/-- The body changes no register other than 0 and 3. -/
theorem fb_keep (k : Nat) (x : Nat -> List Bool) (i : Nat) (h0 : Nat.beq i 0 = false) (h3 : Nat.beq i 3 = false) :
fb k x i = x i :=
(upd_other _ 3 i _ h3).trans (upd_other x 0 i _ h0)
/-! ## The loop -/
def bloop (k : Nat) : List Ins :=
appI (appI [.pop 12 ((bbody k).length + 2) 1 1] (mapI (shift 1) (bbody k))) [.jmp 0]
def bRows (k W : Nat) : Nat -> Nat -> List Bool
| _, 0 => []
| t, m + 1 => encList (U k W t) ++ bRows k W (t + 1) m
theorem bRows_snoc (k W : Nat) :
forall m t, bRows k W t (m + 1) = bRows k W t m ++ encList (U k W (t + m)) := by
intro m
induction m with
| zero => intro t; show encList (U k W t) ++ [] = [] ++ encList (U k W (t + 0)); rw [app_nil'']; rfl
| succ m ih =>
intro t
show encList (U k W t) ++ bRows k W (t + 1) (m + 1) = (encList (U k W t) ++ bRows k W (t + 1) m) ++ _
rw [ih (t + 1), app_assoc', Nat.add_right_comm t 1 m]
rfl
theorem bounds_rows (k W : Nat) : forall n, encList (forR n fun t => U k W t) = bRows k W 0 n := by
intro n
induction n with
| zero => rfl
| succ n ih =>
show encList (forR n (fun t => U k W t) ++ U k W n) = _
rw [encList_app, ih, bRows_snoc, Nat.zero_add]
theorem bIter (k W : Nat) :
forall m t (x : Nat -> List Bool), x 1 = [] -> x 3 = tr t -> x 9 = tr W ->
iter 12 (fb k) (tr m) x 0 = revApp (bRows k W t m) (x 0) := by
intro m
induction m with
| zero => intro t x _ _ _; rfl
| succ m ih =>
intro t x h1 h3 h9
have r := fb_facts k t W (upd x 12 (tr m)) h1 h3 h9
show iter 12 (fb k) (tr m) (fb k (upd x 12 (tr m))) 0 = _
rw [ih (t + 1) _ r.2.1 r.2.2.1 r.2.2.2, r.1, <- revApp_app]
rfl
theorem iter_keep (k : Nat) (i : Nat) (h0 : Nat.beq i 0 = false) (h3 : Nat.beq i 3 = false) (h12 : Nat.beq i 12 = false) :
forall (l : List Bool) (x : Nat -> List Bool), iter 12 (fb k) l x i = x i := by
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show iter 12 (fb k) l (fb k (upd x 12 l)) i = x i
rw [ih, fb_keep k _ i h0 h3]
exact upd_other x 12 i l h12
def Pb (W : Nat) (x : Nat -> List Bool) : Prop :=
x 1 = [] /\ (Exists fun t => x 3 = tr t) /\ x 9 = tr W
/-- The boundary loop from o: from t = 0 with register 12 holding T + 1 ones, it pushes
the encoding of all boundary clauses of the tableau onto register 0. -/
theorem bloop_run (prog : List Ins) (o k W T : Nat) (hf : Frag prog o (bloop k)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h3 : x 3 = tr 0) (h9 : x 9 = tr W) (h12 : x 12 = tr (T + 1)) :
Runs prog (steps 12 (nbb k) (fb k) (tr (T + 1)) x) o x (o + ((bbody k).length + 2)) (iter 12 (fb k) (tr (T + 1)) x) /\
iter 12 (fb k) (tr (T + 1)) x 0 = revApp (encList (bounds k W T)) (x 0) := by
have fa := Found.Pnp23.frag_app_l prog o _ _ hf
have fbd : Frag prog (o + 1) (bbody k) := Found.Pnp23.frag_app prog o [.pop 12 ((bbody k).length + 2) 1 1] _ fa
have i0 : nthI prog o = some (.pop 12 (o + ((bbody k).length + 2)) (o + 1) (o + 1)) := fa 0 _ rfl
have hl : (appI [.pop 12 ((bbody k).length + 2) 1 1] (mapI (shift 1) (bbody k))).length = 1 + (bbody k).length := by
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]; rfl
have i1 : nthI prog (o + 1 + (bbody k).length) = some (.jmp o) := by
have e := hf ((appI [.pop 12 ((bbody k).length + 2) 1 1] (mapI (shift 1) (bbody k))).length + 0) (.jmp 0)
(Found.Pnp23.nthI_app_r _ [.jmp 0] 0)
rw [hl, Nat.add_zero, <- Nat.add_assoc] at e
exact e
have hbody : forall y, Pb W y -> Runs prog (nbb k y) (o + 1) y (o + 1 + (bbody k).length) (fb k y) := by
intro y hy
exact Exists.elim hy.2.1 fun t ht => bbody_run prog (o + 1) k t W fbd y hy.1 ht hy.2.2
have hP1 : forall y b l, Pb W y -> y 12 = b :: l -> Pb W (upd y 12 l) := fun y _ _ hy _ => hy
have hP2 : forall y, Pb W y -> Pb W (fb k y) := by
intro y hy
exact Exists.elim hy.2.1 fun t ht => by
have r := fb_facts k t W y hy.1 ht hy.2.2
exact And.intro r.2.1 (And.intro (Exists.intro (t + 1) r.2.2.1) r.2.2.2)
have hx : Pb W x := And.intro h1 (And.intro (Exists.intro 0 h3) h9)
have L := loop_inv 12 (nbb k) (fb k) (Pb W) prog o (bbody k).length (o + ((bbody k).length + 2)) i0 i1 hbody
(fun y => fb_keep k y 12 rfl rfl) hP1 hP2 (tr (T + 1)) x h12 hx
refine And.intro L ?_
rw [bIter k W (T + 1) 0 x h1 h3 h9]
show revApp (bRows k W 0 (T + 1)) (x 0) = revApp (encList (forR (T + 1) fun t => U k W t)) (x 0)
rw [bounds_rows]
end Found.Pnp31
#print axioms Found.Pnp31.u_bits
#print axioms Found.Pnp31.bd_bits
#print axioms Found.Pnp31.good_app
#print axioms Found.Pnp31.good_bd
#print axioms Found.Pnp31.len_bbody
#print axioms Found.Pnp31.bbody_run
#print axioms Found.Pnp31.fb_facts
#print axioms Found.Pnp31.fb_keep
#print axioms Found.Pnp31.bRows_snoc
#print axioms Found.Pnp31.bounds_rows
#print axioms Found.Pnp31.bIter
#print axioms Found.Pnp31.iter_keep
#print axioms Found.Pnp31.bloop_run
lean_all/found/Pnp32.lean
/-
T330 piece 32. found/Pnp32 -- the input pin clauses (CL3b, 13).
A branching loop: pop the counter register c; empty -> exit, bit 0 -> body 0, bit 1 ->
body 1; each body jumps back. With the input x held in register 13 (one bit per entry)
and the cell of the first input bit in register 14 (ones), body v writes the pin clause
[(v, (0, (j, 0)))] of the current cell j (a block, Pnp24) and pushes a one on 14.
Proved:
* the branching loop with an invariant (general: any two bodies, any registers);
* from register 14 = s, the input loop pushes onto register 0 the encoding of the pin
clauses of the input pins of x placed at cells s, s + 1, ..., in order:
pinCl (inPins (inpOf s x)) (Pnp11, Pnp14);
* it changes no register other than 0, 13 and 14.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp31
import found.Pnp14
namespace Found.Pnp32
open Found.Pnp9 (V)
open Found.Pnp11 (pinCl)
open Found.Pnp14 (inPins)
open Found.Pnp19 (un app_assoc')
open Found.Pnp20
open Found.Pnp21
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_app)
open Found.Pnp24 (Op cmp bits cost Good block_run)
open Found.Pnp25 (encList encList_app)
open Found.Pnp26 (cntOf)
open Found.Pnp28 (seqI frag_seq)
/-! ## The branching loop -/
section
variable (c : Nat) (nb : Bool -> (Nat -> List Bool) -> Nat) (f : Bool -> (Nat -> List Bool) -> (Nat -> List Bool))
def steps2 : List Bool -> (Nat -> List Bool) -> Nat
| [], _ => 1
| b :: l, x => ((1 + nb b (upd x c l)) + 1) + steps2 l (f b (upd x c l))
def iter2 : List Bool -> (Nat -> List Bool) -> (Nat -> List Bool)
| [], x => x
| b :: l, x => iter2 l (f b (upd x c l))
theorem loop2_inv (P : (Nat -> List Bool) -> Prop) (prog : List Ins) (o z1 e0 e1 ex : Nat)
(hpop : nthI prog o = some (.pop c ex (o + 1) z1))
(hj0 : nthI prog e0 = some (.jmp o)) (hj1 : nthI prog e1 = some (.jmp o))
(hb0 : forall x, P x -> Runs prog (nb false x) (o + 1) x e0 (f false x))
(hb1 : forall x, P x -> Runs prog (nb true x) z1 x e1 (f true x))
(hkeep : forall b x, f b x c = x c)
(hP1 : forall x b l, P x -> x c = b :: l -> P (upd x c l))
(hP2 : forall b x, P x -> P (f b x)) :
forall (l : List Bool) (x : Nat -> List Bool), x c = l -> P x ->
Runs prog (steps2 c nb f l x) o x ex (iter2 c f l x) := by
intro l
induction l with
| nil =>
intro x hx _
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = ex /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = x i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) z1 (x c)).pc = ex /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) z1 (x c)).regs i = x i
rw [hx]
exact And.intro rfl (fun _ => rfl)
| cons b l ih =>
intro x hx hPx
have hP' := hP1 x b l hPx hx
have hc : f b (upd x c l) c = l := (hkeep b _).trans (upd_same x c l)
have h4 := ih (f b (upd x c l)) hc (hP2 b _ hP')
cases b with
| false =>
have h1 : Runs prog 1 o x (o + 1) (upd x c l) := by
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = o + 1 /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = upd x c l i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) z1 (x c)).pc = o + 1 /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) z1 (x c)).regs i = upd x c l i
rw [hx]
exact And.intro rfl (fun _ => rfl)
have h2 := hb0 (upd x c l) hP'
have h3 : Runs prog 1 e0 (f false (upd x c l)) o (f false (upd x c l)) := by
show (run prog 0 (exec (Cfg.mk e0 (f false (upd x c l))) (nthI prog e0))).pc = o /\
forall i, (run prog 0 (exec (Cfg.mk e0 (f false (upd x c l))) (nthI prog e0))).regs i = f false (upd x c l) i
rw [hj0]
exact And.intro rfl (fun _ => rfl)
exact runs_seq prog _ _ o o ex x _ _
(runs_seq prog _ _ o e0 o x _ _ (runs_seq prog _ _ o (o + 1) e0 x _ _ h1 h2) h3) h4
| true =>
have h1 : Runs prog 1 o x z1 (upd x c l) := by
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = z1 /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = upd x c l i
rw [hpop]
show (popTo (Cfg.mk o x) c ex (o + 1) z1 (x c)).pc = z1 /\
forall i, (popTo (Cfg.mk o x) c ex (o + 1) z1 (x c)).regs i = upd x c l i
rw [hx]
exact And.intro rfl (fun _ => rfl)
have h2 := hb1 (upd x c l) hP'
have h3 : Runs prog 1 e1 (f true (upd x c l)) o (f true (upd x c l)) := by
show (run prog 0 (exec (Cfg.mk e1 (f true (upd x c l))) (nthI prog e1))).pc = o /\
forall i, (run prog 0 (exec (Cfg.mk e1 (f true (upd x c l))) (nthI prog e1))).regs i = f true (upd x c l) i
rw [hj1]
exact And.intro rfl (fun _ => rfl)
exact runs_seq prog _ _ o o ex x _ _
(runs_seq prog _ _ o e1 o x _ _ (runs_seq prog _ _ o z1 e1 x _ _ h1 h2) h3) h4
end
/-! ## Input pins -/
/-- The input pins of x placed at cells s, s + 1, .... -/
def inpOf : Nat -> List Bool -> List (Nat × Bool)
| _, [] => []
| s, b :: l => (s, b) :: inpOf (s + 1) l
def pOps (v : Bool) : List Op := [.emit [true, true, v, false], .un 14, .emit [false, false]]
theorem p_bits (cnt : Nat -> Nat) (v : Bool) (j : Nat) (h : cnt 14 = j) :
bits cnt (pOps v) = encList [[(v, (0, (j, 0)))]] := by
show [true, true, v, false] ++ (un (cnt 14) ++ ([false, false] ++ [])) = _
rw [h]
show true :: true :: v :: false :: (un j ++ ([false] ++ [false])) =
true :: true :: v :: false :: (((un j ++ [false]) ++ [false]) ++ [])
rw [app_nil'', app_assoc']
def pbody (v : Bool) : List Ins := seqI (cmp 1 0 (pOps v)) [.push 14 true]
def fp (v : Bool) (x : Nat -> List Bool) : Nat -> List Bool :=
let y := upd x 0 (revApp (bits (cntOf x) (pOps v)) (x 0))
upd y 14 (true :: y 14)
def nbp (v : Bool) (x : Nat -> List Bool) : Nat := cost (cntOf x) (pOps v) + 1
theorem pbody_run (prog : List Ins) (o s : Nat) (v : Bool) (hf : Frag prog o (pbody v)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h14 : x 14 = tr s) :
Runs prog (nbp v x) o x (o + 17) (fp v x) := by
have g := frag_seq prog o _ _ hf
have hg : Good 1 0 x (cntOf x) (pOps v) :=
And.intro (And.intro rfl (And.intro rfl (Found.Pnp26.tr_cnt x 14 s h14))) True.intro
have r1 := block_run 1 0 prog rfl (cntOf x) (pOps v) o x g.1 h1 hg
have i0 : nthI prog (o + (cmp 1 0 (pOps v)).length) = some (.push 14 true) := g.2 0 _ rfl
have r2 : Runs prog 1 (o + (cmp 1 0 (pOps v)).length) (upd x 0 (revApp (bits (cntOf x) (pOps v)) (x 0)))
(o + (cmp 1 0 (pOps v)).length + 1) (fp v x) := by
show (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (pOps v)).length) _) (nthI prog (o + (cmp 1 0 (pOps v)).length)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (pOps v)).length)
(upd x 0 (revApp (bits (cntOf x) (pOps v)) (x 0)))) (nthI prog (o + (cmp 1 0 (pOps v)).length)))).regs i = _
rw [i0]
exact And.intro rfl (fun _ => rfl)
exact runs_seq prog _ _ _ _ _ x _ _ r1 r2
theorem fp_facts (v : Bool) (s : Nat) (x : Nat -> List Bool) (h1 : x 1 = []) (h14 : x 14 = tr s) :
fp v x 0 = revApp (encList [[(v, (0, (s, 0)))]]) (x 0) /\ fp v x 1 = [] /\ fp v x 14 = tr (s + 1) := by
have c14 : cntOf x 14 = s := by show (x 14).length = s; rw [h14, tr_len]
refine And.intro ?_ (And.intro h1 ?_)
· show revApp (bits (cntOf x) (pOps v)) (x 0) = _
rw [p_bits (cntOf x) v s c14]
· show true :: x 14 = tr (s + 1)
rw [h14]
rfl
theorem fp_keep (v : Bool) (x : Nat -> List Bool) (i : Nat) (h0 : Nat.beq i 0 = false) (h14 : Nat.beq i 14 = false) :
fp v x i = x i :=
(upd_other _ 14 i _ h14).trans (upd_other x 0 i _ h0)
/-! ## The input loop -/
def inLoop : List Ins :=
appI (appI (appI (appI [.pop 13 37 1 19] (mapI (shift 1) (pbody false))) [.jmp 0]) (mapI (shift 19) (pbody true))) [.jmp 0]
theorem pIter : forall (l : List Bool) (s : Nat) (x : Nat -> List Bool), x 1 = [] -> x 14 = tr s ->
iter2 13 fp l x 0 = revApp (encList (pinCl (inPins (inpOf s l)))) (x 0) := by
intro l
induction l with
| nil => intro s x _ _; rfl
| cons b l ih =>
intro s x h1 h14
have r := fp_facts b s (upd x 13 l) h1 h14
show iter2 13 fp l (fp b (upd x 13 l)) 0 = _
rw [ih (s + 1) _ r.2.1 r.2.2, r.1, <- revApp_app, <- encList_app]
rfl
theorem pIter_keep (i : Nat) (h0 : Nat.beq i 0 = false) (h13 : Nat.beq i 13 = false) (h14 : Nat.beq i 14 = false) :
forall (l : List Bool) (x : Nat -> List Bool), iter2 13 fp l x i = x i := by
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show iter2 13 fp l (fp b (upd x 13 l)) i = x i
rw [ih, fp_keep b _ i h0 h14]
exact upd_other x 13 i l h13
def Pp (x : Nat -> List Bool) : Prop := x 1 = [] /\ Exists fun s => x 14 = tr s
/-- The input loop from o: with the input l in register 13 and register 14 = s, it pushes
the encoding of the pin clauses of the input pins at cells s, s + 1, ... onto register 0. -/
theorem inLoop_run (prog : List Ins) (o s : Nat) (hf : Frag prog o inLoop) (l : List Bool) (x : Nat -> List Bool)
(h1 : x 1 = []) (h13 : x 13 = l) (h14 : x 14 = tr s) :
Runs prog (steps2 13 nbp fp l x) o x (o + 37) (iter2 13 fp l x) /\
iter2 13 fp l x 0 = revApp (encList (pinCl (inPins (inpOf s l)))) (x 0) := by
have f2 := Found.Pnp23.frag_app_l prog o _ _ hf
have f1 := Found.Pnp23.frag_app_l prog o _ _ f2
have f0 := Found.Pnp23.frag_app_l prog o _ _ f1
have fb1 : Frag prog (o + 19) (pbody true) := Found.Pnp23.frag_app prog o _ _ f2
have fb0 : Frag prog (o + 1) (pbody false) := Found.Pnp23.frag_app prog o [.pop 13 37 1 19] _ f0
have i0 : nthI prog o = some (.pop 13 (o + 37) (o + 1) (o + 19)) := hf 0 _ rfl
have i1 : nthI prog (o + 1 + 17) = some (.jmp o) := hf 18 _ rfl
have i2 : nthI prog (o + 19 + 17) = some (.jmp o) := hf 36 _ rfl
have hb0 : forall y, Pp y -> Runs prog (nbp false y) (o + 1) y (o + 1 + 17) (fp false y) := by
intro y hy
exact Exists.elim hy.2 fun t ht => pbody_run prog (o + 1) t false fb0 y hy.1 ht
have hb1 : forall y, Pp y -> Runs prog (nbp true y) (o + 19) y (o + 19 + 17) (fp true y) := by
intro y hy
exact Exists.elim hy.2 fun t ht => pbody_run prog (o + 19) t true fb1 y hy.1 ht
have hP2 : forall b y, Pp y -> Pp (fp b y) := by
intro b y hy
exact Exists.elim hy.2 fun t ht => by
have r := fp_facts b t y hy.1 ht
exact And.intro r.2.1 (Exists.intro (t + 1) r.2.2)
have L := loop2_inv 13 nbp fp Pp prog o (o + 19) (o + 1 + 17) (o + 19 + 17) (o + 37) i0 i1 i2 hb0 hb1
(fun b y => fp_keep b y 13 rfl rfl) (fun y _ _ hy _ => hy) hP2 l x h13 (And.intro h1 (Exists.intro s h14))
exact And.intro L (pIter l s x h1 h14)
end Found.Pnp32
#print axioms Found.Pnp32.loop2_inv
#print axioms Found.Pnp32.p_bits
#print axioms Found.Pnp32.pbody_run
#print axioms Found.Pnp32.fp_facts
#print axioms Found.Pnp32.fp_keep
#print axioms Found.Pnp32.pIter
#print axioms Found.Pnp32.pIter_keep
#print axioms Found.Pnp32.inLoop_run
lean_all/found/Pnp33.lean
/-
T330 piece 33. found/Pnp33 -- the accept clause and the layout pins (CL3b, 14).
After the window and boundary clauses, the tableau CNF of a Turing machine (Pnp11,
Pnp14) has the accept clause [(true, (T, (0, 0)))] and the pin clauses of the layout
pins allPins pos0 q0 m W (cell pos0 holds the head and the start state q0, every other
cell is pinned to "no head"). Here W = pos0 + 1 + r. Proved:
* the accept clause is a block that reads T from any counter register R (not 0, 1);
* the layout pins of cells 0 .. pos0 are fixed by the machine, so they are one fixed
EMIT block;
* for a cell j other than pos0 the layout pins are all false (cell_false), and the
layout pins of W = pos0 + 1 + r cells split into the fixed part and r such cells;
* CLOOP (pop register 12, holding r ones; block for cell j in register 14; push a one
on 14) pushes the pin clauses of cells a, a + 1, ..., a + r - 1, and changes no
register other than 0, 12 and 14.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp32
namespace Found.Pnp33
open Found.Pnp9 (V)
open Found.Pnp11 (pinCl accCl)
open Found.Pnp14 (allPins cellPins)
open Found.Pnp19 (un app_assoc' app_nil')
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_app)
open Found.Pnp24 (Op cmp bits cost Good block_run)
open Found.Pnp25 (encList encList_app bits_app)
open Found.Pnp26 (cntOf loop_inv)
open Found.Pnp28 (seqI frag_seq)
open Found.Pnp31 (good_app)
theorem pinCl_app (B : List (Nat × (Nat × Bool))) : forall A, pinCl (A ++ B) = pinCl A ++ pinCl B := by
intro A
induction A with
| nil => rfl
| cons e A ih =>
cases e with
| mk j bv =>
cases bv with
| mk b v => exact congrArg (fun l => [(v, (0, (j, b)))] :: l) ih
/-! ## The accept clause -/
def accOps (R : Nat) : List Op := [.emit [true, true, true], .un R, .emit [false, false, false]]
theorem acc_bits (cnt : Nat -> Nat) (R T : Nat) (h : cnt R = T) : bits cnt (accOps R) = encList [accCl T] := by
show [true, true, true] ++ (un (cnt R) ++ ([false, false, false] ++ [])) = _
rw [h]
show true :: true :: true :: (un T ++ ([false, false] ++ [false])) =
true :: true :: true :: (((un T ++ [false, false]) ++ [false]) ++ [])
rw [app_nil'', app_assoc']
/-- The accept block, with T in register R. -/
theorem acc_run (prog : List Ins) (o R T : Nat) (hf : Frag prog o (cmp 1 0 (accOps R)))
(h1R : Nat.beq R 1 = false) (h0R : Nat.beq R 0 = false) (x : Nat -> List Bool) (h1 : x 1 = []) (hR : x R = tr T) :
Runs prog (cost (cntOf x) (accOps R)) o x (o + (cmp 1 0 (accOps R)).length)
(upd x 0 (revApp (encList [accCl T]) (x 0))) := by
have hg : Good 1 0 x (cntOf x) (accOps R) :=
And.intro (And.intro h1R (And.intro h0R (Found.Pnp26.tr_cnt x R T hR))) True.intro
have c : cntOf x R = T := by show (x R).length = T; rw [hR, tr_len]
have r := block_run 1 0 prog rfl (cntOf x) (accOps R) o x hf h1 hg
rw [acc_bits (cntOf x) R T c] at r
exact r
/-! ## A fixed block -/
theorem fixed_run (prog : List Ins) (o : Nat) (w : List Bool) (hf : Frag prog o (cmp 1 0 [.emit w]))
(x : Nat -> List Bool) (h1 : x 1 = []) :
Runs prog (cost (cntOf x) [.emit w]) o x (o + (cmp 1 0 [.emit w]).length) (upd x 0 (revApp w (x 0))) := by
have r := block_run 1 0 prog rfl (cntOf x) [.emit w] o x hf h1 True.intro
have e : bits (cntOf x) [.emit w] = w := app_nil'' w
rw [e] at r
exact r
/-! ## Layout pins away from the head cell -/
def fc (j : Nat) : Nat -> List (Nat × (Nat × Bool))
| 0 => [(j, (1, false))]
| i + 1 => fc j i ++ [(j, (i + 2, false))]
theorem cell_false (pos0 : Nat) (q0 : List Bool) (j : Nat) (h : Nat.beq j pos0 = false) :
forall i, cellPins pos0 q0 j i = fc j i := by
intro i
induction i with
| zero => exact congrArg (fun z => [(j, (1, z))]) h
| succ i ih =>
show cellPins pos0 q0 j i ++ [(j, (i + 2, Nat.beq j pos0 && Found.Pnp7.nthd q0 i))] = fc j i ++ [(j, (i + 2, false))]
rw [ih]
exact congrArg (fun z => fc j i ++ [(j, (i + 2, z))]) (congrArg (fun z => z && Found.Pnp7.nthd q0 i) h)
def fcRows (m : Nat) : Nat -> Nat -> List (Nat × (Nat × Bool))
| _, 0 => []
| a, r + 1 => fc a m ++ fcRows m (a + 1) r
theorem fcRows_snoc (m : Nat) : forall r a, fcRows m a (r + 1) = fcRows m a r ++ fc (a + r) m := by
intro r
induction r with
| zero => intro a; show fc a m ++ [] = [] ++ fc (a + 0) m; rw [app_nil']; rfl
| succ r ih =>
intro a
show fc a m ++ fcRows m (a + 1) (r + 1) = (fc a m ++ fcRows m (a + 1) r) ++ _
rw [ih (a + 1), app_assoc', Nat.add_right_comm a 1 r]
rfl
theorem allPins_split (pos0 : Nat) (q0 : List Bool) (m : Nat) :
forall r, allPins pos0 q0 m (pos0 + 1 + r) = allPins pos0 q0 m (pos0 + 1) ++ fcRows m (pos0 + 1) r := by
intro r
induction r with
| zero => show allPins pos0 q0 m (pos0 + 1) = allPins pos0 q0 m (pos0 + 1) ++ []; rw [app_nil']
| succ r ih =>
have hlt : pos0 < pos0 + 1 + r := Nat.lt_of_lt_of_le (Nat.lt_succ_self pos0) (Nat.le_add_right (pos0 + 1) r)
have hne : Nat.beq (pos0 + 1 + r) pos0 = false :=
Found.Pnp2.beq_false_of_ne _ _ (fun e => Nat.lt_irrefl pos0 (Eq.subst (motive := fun z => pos0 < z) e hlt))
show allPins pos0 q0 m (pos0 + 1 + r) ++ cellPins pos0 q0 (pos0 + 1 + r) m = _
rw [ih, cell_false pos0 q0 (pos0 + 1 + r) hne m, fcRows_snoc, app_assoc']
/-! ## The block of one cell -/
def uo (b : Nat) : List Op := [.emit [true, true, false, false], .un 14, .emit (un b ++ [false])]
theorem uo_bits (cnt : Nat -> Nat) (j b : Nat) (h : cnt 14 = j) :
bits cnt (uo b) = encList (pinCl [(j, (b, false))]) := by
show [true, true, false, false] ++ (un (cnt 14) ++ ((un b ++ [false]) ++ [])) = _
rw [h]
show true :: true :: false :: false :: (un j ++ ((un b ++ [false]) ++ [])) =
true :: true :: false :: false :: (((un j ++ un b) ++ [false]) ++ [])
rw [app_nil'', app_nil'', app_assoc']
def fcOps : Nat -> List Op
| 0 => uo 1
| i + 1 => fcOps i ++ uo (i + 2)
theorem fc_bits (cnt : Nat -> Nat) (j : Nat) (h : cnt 14 = j) :
forall i, bits cnt (fcOps i) = encList (pinCl (fc j i)) := by
intro i
induction i with
| zero => exact uo_bits cnt j 1 h
| succ i ih =>
show bits cnt (fcOps i ++ uo (i + 2)) = encList (pinCl (fc j i ++ [(j, (i + 2, false))]))
rw [bits_app, ih, pinCl_app, encList_app, uo_bits cnt j (i + 2) h]
theorem good_fc (x : Nat -> List Bool) (j : Nat) (h14 : x 14 = tr j) : forall i, Good 1 0 x (cntOf x) (fcOps i) := by
have g : forall b, Good 1 0 x (cntOf x) (uo b) := fun _ =>
And.intro (And.intro rfl (And.intro rfl (Found.Pnp26.tr_cnt x 14 j h14))) True.intro
intro i
induction i with
| zero => exact g 1
| succ i ih => exact good_app x (cntOf x) _ _ ih (g (i + 2))
def cbody (m : Nat) : List Ins := seqI (cmp 1 0 (fcOps m)) [.push 14 true]
def fcF (m : Nat) (x : Nat -> List Bool) : Nat -> List Bool :=
let y := upd x 0 (revApp (bits (cntOf x) (fcOps m)) (x 0))
upd y 14 (true :: y 14)
def nbc (m : Nat) (x : Nat -> List Bool) : Nat := cost (cntOf x) (fcOps m) + 1
theorem len_cbody (m : Nat) : (cbody m).length = (cmp 1 0 (fcOps m)).length + 1 := Found.Pnp29.len_seq _ _
theorem cbody_run (prog : List Ins) (o m j : Nat) (hf : Frag prog o (cbody m)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h14 : x 14 = tr j) :
Runs prog (nbc m x) o x (o + (cbody m).length) (fcF m x) := by
have g := frag_seq prog o _ _ hf
have r1 := block_run 1 0 prog rfl (cntOf x) (fcOps m) o x g.1 h1 (good_fc x j h14 m)
have i0 : nthI prog (o + (cmp 1 0 (fcOps m)).length) = some (.push 14 true) := g.2 0 _ rfl
have r2 : Runs prog 1 (o + (cmp 1 0 (fcOps m)).length) (upd x 0 (revApp (bits (cntOf x) (fcOps m)) (x 0)))
(o + (cmp 1 0 (fcOps m)).length + 1) (fcF m x) := by
show (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (fcOps m)).length) _) (nthI prog (o + (cmp 1 0 (fcOps m)).length)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + (cmp 1 0 (fcOps m)).length)
(upd x 0 (revApp (bits (cntOf x) (fcOps m)) (x 0)))) (nthI prog (o + (cmp 1 0 (fcOps m)).length)))).regs i = _
rw [i0]
exact And.intro rfl (fun _ => rfl)
have r3 := runs_seq prog _ _ _ _ _ x _ _ r1 r2
rw [len_cbody, <- Nat.add_assoc]
exact r3
theorem fcF_facts (m j : Nat) (x : Nat -> List Bool) (h1 : x 1 = []) (h14 : x 14 = tr j) :
fcF m x 0 = revApp (encList (pinCl (fc j m))) (x 0) /\ fcF m x 1 = [] /\ fcF m x 14 = tr (j + 1) := by
have c14 : cntOf x 14 = j := by show (x 14).length = j; rw [h14, tr_len]
refine And.intro ?_ (And.intro h1 ?_)
· show revApp (bits (cntOf x) (fcOps m)) (x 0) = _
rw [fc_bits (cntOf x) j c14 m]
· show true :: x 14 = tr (j + 1)
rw [h14]
rfl
theorem fcF_keep (m : Nat) (x : Nat -> List Bool) (i : Nat) (h0 : Nat.beq i 0 = false) (h14 : Nat.beq i 14 = false) :
fcF m x i = x i :=
(upd_other _ 14 i _ h14).trans (upd_other x 0 i _ h0)
/-! ## The cell loop for the layout pins -/
def cloop (m : Nat) : List Ins :=
appI (appI [.pop 12 ((cbody m).length + 2) 1 1] (mapI (shift 1) (cbody m))) [.jmp 0]
theorem cIter (m : Nat) : forall r a (x : Nat -> List Bool), x 1 = [] -> x 14 = tr a ->
iter 12 (fcF m) (tr r) x 0 = revApp (encList (pinCl (fcRows m a r))) (x 0) := by
intro r
induction r with
| zero => intro a x _ _; rfl
| succ r ih =>
intro a x h1 h14
have q := fcF_facts m a (upd x 12 (tr r)) h1 h14
show iter 12 (fcF m) (tr r) (fcF m (upd x 12 (tr r))) 0 = _
rw [ih (a + 1) _ q.2.1 q.2.2, q.1, <- revApp_app, <- encList_app, <- pinCl_app]
rfl
theorem cIter_keep (m i : Nat) (h0 : Nat.beq i 0 = false) (h12 : Nat.beq i 12 = false) (h14 : Nat.beq i 14 = false) :
forall (l : List Bool) (x : Nat -> List Bool), iter 12 (fcF m) l x i = x i := by
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show iter 12 (fcF m) l (fcF m (upd x 12 l)) i = x i
rw [ih, fcF_keep m _ i h0 h14]
exact upd_other x 12 i l h12
def Pc (x : Nat -> List Bool) : Prop := x 1 = [] /\ Exists fun j => x 14 = tr j
theorem cloop_run (prog : List Ins) (o m a r : Nat) (hf : Frag prog o (cloop m)) (x : Nat -> List Bool)
(h1 : x 1 = []) (h14 : x 14 = tr a) (h12 : x 12 = tr r) :
Runs prog (steps 12 (nbc m) (fcF m) (tr r) x) o x (o + ((cbody m).length + 2)) (iter 12 (fcF m) (tr r) x) /\
iter 12 (fcF m) (tr r) x 0 = revApp (encList (pinCl (fcRows m a r))) (x 0) := by
have fa := Found.Pnp23.frag_app_l prog o _ _ hf
have fbd : Frag prog (o + 1) (cbody m) := Found.Pnp23.frag_app prog o [.pop 12 ((cbody m).length + 2) 1 1] _ fa
have i0 : nthI prog o = some (.pop 12 (o + ((cbody m).length + 2)) (o + 1) (o + 1)) := fa 0 _ rfl
have hl : (appI [.pop 12 ((cbody m).length + 2) 1 1] (mapI (shift 1) (cbody m))).length = 1 + (cbody m).length := by
rw [Found.Pnp24.len_appI, Found.Pnp24.len_mapI]; rfl
have i1 : nthI prog (o + 1 + (cbody m).length) = some (.jmp o) := by
have e := hf ((appI [.pop 12 ((cbody m).length + 2) 1 1] (mapI (shift 1) (cbody m))).length + 0) (.jmp 0)
(Found.Pnp23.nthI_app_r _ [.jmp 0] 0)
rw [hl, Nat.add_zero, <- Nat.add_assoc] at e
exact e
have hbody : forall y, Pc y -> Runs prog (nbc m y) (o + 1) y (o + 1 + (cbody m).length) (fcF m y) := by
intro y hy
exact Exists.elim hy.2 fun j hj => cbody_run prog (o + 1) m j fbd y hy.1 hj
have hP2 : forall y, Pc y -> Pc (fcF m y) := by
intro y hy
exact Exists.elim hy.2 fun j hj => by
have q := fcF_facts m j y hy.1 hj
exact And.intro q.2.1 (Exists.intro (j + 1) q.2.2)
have L := loop_inv 12 (nbc m) (fcF m) Pc prog o (cbody m).length (o + ((cbody m).length + 2)) i0 i1 hbody
(fun y => fcF_keep m y 12 rfl rfl) (fun y _ _ hy _ => hy) hP2 (tr r) x h12 (And.intro h1 (Exists.intro a h14))
exact And.intro L (cIter m r a x h1 h14)
/-- The layout pins of W = pos0 + 1 + r cells: the fixed part, then what CLOOP writes from
cell pos0 + 1. -/
theorem allPins_enc (pos0 : Nat) (q0 : List Bool) (m r : Nat) :
encList (pinCl (allPins pos0 q0 m (pos0 + 1 + r))) =
encList (pinCl (allPins pos0 q0 m (pos0 + 1))) ++ encList (pinCl (fcRows m (pos0 + 1) r)) := by
rw [allPins_split, pinCl_app, encList_app]
end Found.Pnp33
#print axioms Found.Pnp33.pinCl_app
#print axioms Found.Pnp33.acc_bits
#print axioms Found.Pnp33.acc_run
#print axioms Found.Pnp33.fixed_run
#print axioms Found.Pnp33.cell_false
#print axioms Found.Pnp33.fcRows_snoc
#print axioms Found.Pnp33.allPins_split
#print axioms Found.Pnp33.uo_bits
#print axioms Found.Pnp33.fc_bits
#print axioms Found.Pnp33.good_fc
#print axioms Found.Pnp33.len_cbody
#print axioms Found.Pnp33.cbody_run
#print axioms Found.Pnp33.fcF_facts
#print axioms Found.Pnp33.fcF_keep
#print axioms Found.Pnp33.cIter
#print axioms Found.Pnp33.cIter_keep
#print axioms Found.Pnp33.cloop_run
#print axioms Found.Pnp33.allPins_enc
lean_all/found/Pnp34.lean
/-
T330 piece 34. found/Pnp34 -- glue for the whole tableau writer (CL3b, 15).
Small facts used when the pieces Pnp30-Pnp33 are put one after another:
* DROP r d: d single pops; from r holding n + d ones it leaves n ones in d steps;
* a loop invariant carries over to the loop's end registers, and a loop's counter is
empty at the end;
* after the time loop from t over m rounds, registers 3, 4 hold t + m, t + m + 1 ones,
and registers from 12 on are unchanged;
* revApp twice is the identity, so a final MOVE of the reversed output gives the bits
in order;
* the CNF encoding of the tableau CNF of a Turing machine (Pnp11.full) is the window
part, the boundary part, the accept clause and the pins, then the closing 0.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp33
namespace Found.Pnp34
open Found.Pnp9 (V windows bounds tab)
open Found.Pnp11 (pinCl accCl full)
open Found.Pnp19 (encCNF encCl app_assoc')
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'')
open Found.Pnp25 (encList encList_app)
open Found.Pnp28 (seqI frag_seq)
/-! ## DROP -/
def dropI (r : Nat) : Nat -> List Ins
| 0 => []
| d + 1 => seqI [.pop r 1 1 1] (dropI r d)
theorem drop_run (prog : List Ins) (r : Nat) :
forall (d o n : Nat) (x : Nat -> List Bool), Frag prog o (dropI r d) -> x r = tr (n + d) ->
Runs prog d o x (o + d) (upd x r (tr n)) := by
intro d
induction d with
| zero =>
intro o n x _ hx
refine And.intro rfl (fun i => ?_)
show x i = selR (Nat.beq i r) (tr n) (x i)
cases h : Nat.beq i r with
| false => rfl
| true =>
have e : i = r := Found.Pnp2.beq_eq i r h
rw [e, hx]
rfl
| succ d ih =>
intro o n x hf hx
have g := frag_seq prog o _ _ hf
have i0 : nthI prog o = some (.pop r (o + 1) (o + 1) (o + 1)) := g.1 0 _ rfl
have r1 : Runs prog 1 o x (o + 1) (upd x r (tr (n + d))) := by
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = o + 1 /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = upd x r (tr (n + d)) i
rw [i0]
show (popTo (Cfg.mk o x) r (o + 1) (o + 1) (o + 1) (x r)).pc = o + 1 /\
forall i, (popTo (Cfg.mk o x) r (o + 1) (o + 1) (o + 1) (x r)).regs i = upd x r (tr (n + d)) i
rw [hx]
exact And.intro rfl (fun _ => rfl)
have r2 := ih (o + 1) n (upd x r (tr (n + d))) g.2 (upd_same x r _)
have r3 := runs_seq prog _ _ _ _ _ x _ _ r1 r2
rw [Nat.add_comm 1 d] at r3
refine And.intro ?_ (fun i => (r3.2 i).trans (Found.Pnp24.upd_upd x r _ _ i))
show (run prog (d + 1) (Cfg.mk o x)).pc = o + (d + 1)
rw [r3.1, Nat.add_assoc, Nat.add_comm 1 d]
/-! ## Loops: invariants and the empty counter at the end -/
theorem iter_inv (c : Nat) (f : (Nat -> List Bool) -> (Nat -> List Bool)) (Q : (Nat -> List Bool) -> Prop)
(h : forall y l, Q y -> Q (f (upd y c l))) : forall l x, Q x -> Q (iter c f l x) := by
intro l
induction l with
| nil => intro x hx; exact hx
| cons b l ih => intro x hx; exact ih _ (h x l hx)
theorem iter_empty (c : Nat) (f : (Nat -> List Bool) -> (Nat -> List Bool)) (hk : forall y, f y c = y c) :
forall l x, x c = l -> iter c f l x c = [] := by
intro l
induction l with
| nil => intro x hx; exact hx
| cons b l ih => intro x _; exact ih _ ((hk _).trans (upd_same x c l))
/-! ## The time loop: the time registers and the registers from 12 on -/
theorem tIter_regs (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) :
forall m t (x : Nat -> List Bool), x 1 = [] -> x 2 = [] -> x 3 = tr t -> x 4 = tr (t + 1) ->
iter 11 (Found.Pnp29.rndF k delta W') (tr m) x 1 = [] /\
iter 11 (Found.Pnp29.rndF k delta W') (tr m) x 3 = tr (t + m) /\
iter 11 (Found.Pnp29.rndF k delta W') (tr m) x 4 = tr (t + m + 1) := by
intro m
induction m with
| zero => intro t x h1 _ h3 h4; exact And.intro h1 (And.intro h3 h4)
| succ m ih =>
intro t x h1 h2 h3 h4
have q := Found.Pnp30.rnd_facts k delta W' t (upd x 11 (tr m)) h1 h2 h3 h4
have r := ih (t + 1) _ q.2.1 q.2.2.1 q.2.2.2.1 q.2.2.2.2
have e : t + 1 + m = t + (m + 1) := Nat.add_right_comm t 1 m
rw [e] at r
exact r
theorem tIter_keep (k : Nat) (delta : List Bool -> Nat -> Bool) (W' i : Nat) (hi : 12 <= i) :
forall (l : List Bool) (x : Nat -> List Bool), iter 11 (Found.Pnp29.rndF k delta W') l x i = x i := by
have h11 : Nat.beq i 11 = false :=
Found.Pnp2.beq_false_of_ne i 11 (fun e => Nat.lt_irrefl 11 (Nat.lt_of_lt_of_le (Nat.lt_succ_self 11) (Eq.subst (motive := fun z => 12 <= z) e hi)))
have h9 : 9 <= i := Nat.le_trans (Nat.le_of_ble_eq_true rfl) hi
intro l
induction l with
| nil => intro x; rfl
| cons b l ih =>
intro x
show iter 11 (Found.Pnp29.rndF k delta W') l (Found.Pnp29.rndF k delta W' (upd x 11 l)) i = x i
rw [ih, Found.Pnp29.rndF_keep k delta W' _ i h9]
exact upd_other x 11 i l h11
/-! ## Reversing twice -/
theorem revApp_revApp : forall (A m n : List Bool), revApp (revApp A m) n = revApp m (A ++ n) := by
intro A
induction A with
| nil => intro m n; rfl
| cons b A ih => intro m n; exact ih (b :: m) n
theorem revApp_twice (A : List Bool) : revApp (revApp A []) [] = A := by
rw [revApp_revApp, app_nil'']
rfl
/-! ## The encoding of the whole CNF -/
theorem encCNF_eq : forall f : List (List (Bool × V)), encCNF f = encList f ++ [false] := by
intro f
induction f with
| nil => rfl
| cons c f ih =>
show true :: (encCl c ++ encCNF f) = true :: ((encCl c ++ encList f) ++ [false])
rw [ih, app_assoc']
theorem full_enc (delta : List Bool -> Nat -> Bool) (k W T : Nat) (ps : List (Nat × (Nat × Bool))) :
encCNF (full delta k W T ps) =
encList (windows delta k W T) ++ (encList (bounds k W T) ++ (encList [accCl T] ++ (encList (pinCl ps) ++ [false]))) := by
show encCNF ((windows delta k W T ++ bounds k W T) ++ ([accCl T] ++ pinCl ps)) = _
rw [encCNF_eq, encList_app, encList_app, encList_app]
show ((encList (windows delta k W T) ++ encList (bounds k W T)) ++ (encList [accCl T] ++ encList (pinCl ps))) ++ [false] = _
rw [app_assoc', app_assoc', app_assoc']
end Found.Pnp34
#print axioms Found.Pnp34.drop_run
#print axioms Found.Pnp34.iter_inv
#print axioms Found.Pnp34.iter_empty
#print axioms Found.Pnp34.tIter_regs
#print axioms Found.Pnp34.tIter_keep
#print axioms Found.Pnp34.revApp_revApp
#print axioms Found.Pnp34.revApp_twice
#print axioms Found.Pnp34.encCNF_eq
#print axioms Found.Pnp34.full_enc
lean_all/found/Pnp35.lean
/-
T330 piece 35. found/Pnp35 -- the whole tableau writer (CL3b, 16).
WRITER = TLOOP (window clauses); COPY 3 -> 15 (T); COPY 4 -> 12 (T + 1); CLEAR 3;
BLOOP (boundary clauses); the accept block (T from 15); the fixed block of the layout
pins of cells 0 .. pos0; EMIT pos0 + 1 ones on 14; COPY 10 -> 12; DROP 12 pos0 (12 = r);
CLOOP (layout pins of cells pos0 + 1 .. W - 1); CLEAR 14; EMIT s ones on 14; the input
loop (pins of the input at cells s, s + 1, ...); push 0 on 0.
Proved: from registers 0 .. 4 = [], [], [], [], 1; 9 = W = pos0 + r + 1; 10 = W - 1;
11 = T; 12, 14, 15 empty; 13 = the input l, the writer runs as one fragment and leaves on
register 0 the reversed CNF encoding (Pnp19.encCNF) of the whole tableau CNF of the
machine with layout and input pins (Pnp11.full, Pnp14.allPins, inPins), and keeps every
register from 16 on.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp34
import found.Pnp41
namespace Found.Pnp35
open Found.Pnp9 (V windows bounds)
open Found.Pnp11 (pinCl accCl full)
open Found.Pnp14 (allPins inPins)
open Found.Pnp19 (encCNF)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_app revApp_tr)
open Found.Pnp24 (cmp pushAll_eq len_appI len_mapI len_emit)
open Found.Pnp25 (encList encList_app)
open Found.Pnp27 (clear copyF clear_run copy_run)
open Found.Pnp28 (seqI frag_seq)
open Found.Pnp29 (len_seq rnd rndF)
open Found.Pnp30 (tloop tloop_run)
open Found.Pnp31 (bloop bbody bloop_run fb)
open Found.Pnp32 (inLoop inLoop_run inpOf iter2 fp)
open Found.Pnp33 (accOps acc_run fixed_run cloop cbody cloop_run fcF fcRows pinCl_app allPins_enc)
open Found.Pnp34 (dropI drop_run iter_inv iter_empty tIter_regs tIter_keep full_enc)
/-! ## Lengths and small runs -/
theorem len_tloop (k : Nat) (delta : List Bool -> Nat -> Bool) : (tloop k delta).length = (rnd k delta).length + 2 := by
show (appI (appI [_] (mapI (shift 1) (rnd k delta))) [_]).length = _
rw [len_appI, len_appI, len_mapI]
show 1 + (rnd k delta).length + 1 = (rnd k delta).length + 2
rw [Nat.add_comm 1 (rnd k delta).length]
theorem len_bloop (k : Nat) : (bloop k).length = (bbody k).length + 2 := by
show (appI (appI [_] (mapI (shift 1) (bbody k))) [_]).length = _
rw [len_appI, len_appI, len_mapI]
show 1 + (bbody k).length + 1 = (bbody k).length + 2
rw [Nat.add_comm 1 (bbody k).length]
theorem len_cloop (m : Nat) : (cloop m).length = (cbody m).length + 2 := by
show (appI (appI [_] (mapI (shift 1) (cbody m))) [_]).length = _
rw [len_appI, len_appI, len_mapI]
show 1 + (cbody m).length + 1 = (cbody m).length + 2
rw [Nat.add_comm 1 (cbody m).length]
theorem len_drop (r : Nat) : forall d, (dropI r d).length = d := by
intro d
induction d with
| zero => rfl
| succ d ih =>
show (seqI [Ins.pop r 1 1 1] (dropI r d)).length = d + 1
rw [len_seq, ih]
exact Nat.add_comm 1 d
theorem runs_len (prog : List Ins) (n o : Nat) (x y : Nat -> List Bool) (a b : Nat) (e : a = b)
(h : Runs prog n o x (o + a) y) : Runs prog n o x (o + b) y :=
Eq.subst (motive := fun z => Runs prog n o x (o + z) y) e h
theorem seq_runs (prog : List Ins) (o : Nat) (p q : List Ins) (n1 n2 : Nat) (x y z : Nat -> List Bool)
(h1 : Runs prog n1 o x (o + p.length) y) (h2 : Runs prog n2 (o + p.length) y (o + p.length + q.length) z) :
Runs prog (n1 + n2) o x (o + (seqI p q).length) z := by
have r := runs_seq prog _ _ _ _ _ x y z h1 h2
rw [len_seq, <- Nat.add_assoc]
exact r
theorem push_run (prog : List Ins) (o r : Nat) (b : Bool) (hf : Frag prog o [.push r b]) (x : Nat -> List Bool) :
Runs prog 1 o x (o + [Ins.push r b].length) (upd x r (b :: x r)) := by
have i0 : nthI prog o = some (.push r b) := hf 0 _ rfl
show (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk o x) (nthI prog o))).regs i = _
rw [i0]
exact And.intro rfl (fun _ => rfl)
theorem ne16 (i a : Nat) (hi : 16 <= i) (ha : a + 1 <= 16) : Nat.beq i a = false :=
Found.Pnp2.beq_false_of_ne i a (fun e => Nat.lt_irrefl a (Nat.lt_of_lt_of_le ha (Eq.subst (motive := fun z => 16 <= z) e hi)))
/-! ## The writer -/
/-- The fixed bits of the layout pins of cells 0 .. pos0. -/
def hw (m pos0 : Nat) (q0 : List Bool) : List Bool := encList (pinCl (allPins pos0 q0 m (pos0 + 1)))
def writer (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) : List Ins :=
seqI (tloop k delta) (seqI (copyF 3 1 15) (seqI (copyF 4 1 12) (seqI (clear 3) (seqI (bloop k)
(seqI (cmp 1 0 (accOps 15)) (seqI (cmp 1 0 [.emit (hw m pos0 q0)]) (seqI (emit 14 (tr (pos0 + 1)))
(seqI (copyF 10 1 12) (seqI (dropI 12 pos0) (seqI (cloop m) (seqI (clear 14) (seqI (emit 14 (tr s))
(seqI inLoop [.push 0 false])))))))))))))
/-- The step bound of the writer (L is the input length). -/
def WB (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s r T L : Nat) : Nat :=
(T * (Found.Pnp40.RB k delta (pos0 + r) T (pos0 + r + 2) + 2) + 1) +
((4 * T + 1 + (3 * T + 1)) +
((4 * (T + 1) + 1 + (3 * (T + 1) + 1)) +
((2 * T + 1) +
(((T + 1) * (Found.Pnp41.Bb k (pos0 + r + 1) T + 2) + 1) +
((Found.Pnp38.esum (accOps 15) + (accOps 15).length * Found.Pnp39.KK T) +
(((hw m pos0 q0).length + 0) +
((pos0 + 1) +
((4 * (pos0 + r) + 1 + (3 * (pos0 + r) + 1)) +
(pos0 +
((r * (Found.Pnp41.Bc m (pos0 + 1) r + 2) + 1) +
((2 * (pos0 + 1 + r) + 1) +
(s +
((L * (Found.Pnp41.Bp s L + 2) + 1) + 1)))))))))))))
theorem writer_run (prog : List Ins) (o k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool)
(s r T : Nat) (l : List Bool) (hf : Frag prog o (writer k delta m pos0 q0 s)) (x : Nat -> List Bool)
(h0 : x 0 = []) (h1 : x 1 = []) (h2 : x 2 = []) (h3 : x 3 = []) (h4 : x 4 = tr 1)
(h5 : x 5 = []) (h6 : x 6 = []) (h7 : x 7 = [])
(h9 : x 9 = tr (pos0 + r + 1)) (h10 : x 10 = tr (pos0 + r)) (h11 : x 11 = tr T) (h12 : x 12 = [])
(h13 : x 13 = l) (h14 : x 14 = []) (h15 : x 15 = []) :
Exists fun N => Exists fun y => Runs prog N o x (o + (writer k delta m pos0 q0 s).length) y /\
y 0 = revApp (encCNF (full delta k (pos0 + r + 1) T (allPins pos0 q0 m (pos0 + r + 1) ++ inPins (inpOf s l)))) [] /\
(forall i, 16 <= i -> y i = x i) /\ N <= WB k delta m pos0 q0 s r T l.length := by
-- the pieces of the code
have g0 := frag_seq prog o _ _ hf
have g1 := frag_seq prog _ _ _ g0.2
have g2 := frag_seq prog _ _ _ g1.2
have g3 := frag_seq prog _ _ _ g2.2
have g4 := frag_seq prog _ _ _ g3.2
have g5 := frag_seq prog _ _ _ g4.2
have g6 := frag_seq prog _ _ _ g5.2
have g7 := frag_seq prog _ _ _ g6.2
have g8 := frag_seq prog _ _ _ g7.2
have g9 := frag_seq prog _ _ _ g8.2
have g10 := frag_seq prog _ _ _ g9.2
have g11 := frag_seq prog _ _ _ g10.2
have g12 := frag_seq prog _ _ _ g11.2
have g13 := frag_seq prog _ _ _ g12.2
-- 1. the time loop
have T1 := tloop_run prog o k delta (pos0 + r) T g0.1 x h1 h2 h3 h4 h9 h10 h11
let x1 := iter 11 (rndF k delta (pos0 + r)) (tr T) x
have R1 := runs_len prog _ _ _ _ _ _ (len_tloop k delta).symm T1.1
have t1 := tIter_regs k delta (pos0 + r) T 0 x h1 h2 h3 h4
have k1 : forall i, 12 <= i -> x1 i = x i := fun i hi => tIter_keep k delta (pos0 + r) i hi (tr T) x
have Q1 := iter_inv 11 (rndF k delta (pos0 + r)) (fun y => y 9 = tr (pos0 + r + 1) /\ y 10 = tr (pos0 + r))
(fun y l' hy => And.intro ((Found.Pnp29.rndF_keep k delta (pos0 + r) (upd y 11 l') 9 (Nat.le_refl 9)).trans hy.1)
((Found.Pnp29.rndF_keep k delta (pos0 + r) (upd y 11 l') 10 (Nat.le_succ 9)).trans hy.2)) (tr T) x (And.intro h9 h10)
have e1_3 : x1 3 = tr T := t1.2.1.trans (congrArg tr (Nat.zero_add T))
have e1_4 : x1 4 = tr (T + 1) := t1.2.2.trans (congrArg (fun z => tr (z + 1)) (Nat.zero_add T))
-- 2. COPY 3 -> 15
let x2 := upd x1 15 (tr T ++ x1 15)
have R2 := runs_len prog _ _ _ _ 9 (copyF 3 1 15).length rfl (copy_run prog _ 3 1 15 g1.1 rfl rfl rfl T x1 e1_3 t1.1)
-- 3. COPY 4 -> 12
let x3 := upd x2 12 (tr (T + 1) ++ x2 12)
have R3 := runs_len prog _ _ _ _ 9 (copyF 4 1 12).length rfl (copy_run prog _ 4 1 12 g2.1 rfl rfl rfl (T + 1) x2 e1_4 t1.1)
-- 4. CLEAR 3
let x4 := upd x3 3 []
have R4 := runs_len prog _ _ _ _ 2 (clear 3).length rfl (clear_run prog _ 3 g3.1 (x3 3) x3 rfl)
-- 5. the boundary loop
have e4_12 : x4 12 = tr (T + 1) := by
show tr (T + 1) ++ x1 12 = tr (T + 1)
rw [k1 12 (Nat.le_refl 12), h12, app_nil'']
have B5 := bloop_run prog _ k (pos0 + r + 1) T g4.1 x4 t1.1 rfl Q1.1 e4_12
let x5 := iter 12 (fb k) (tr (T + 1)) x4
have R5 := runs_len prog _ _ _ _ _ _ (len_bloop k).symm B5.1
have e5_1 : x5 1 = [] := iter_inv 12 (fb k) (fun y => y 1 = []) (fun _ _ hy => hy) (tr (T + 1)) x4 t1.1
have e5_12 : x5 12 = [] := iter_empty 12 (fb k) (fun y => Found.Pnp31.fb_keep k y 12 rfl rfl) (tr (T + 1)) x4 e4_12
have k5 : forall i, Nat.beq i 0 = false -> Nat.beq i 3 = false -> Nat.beq i 12 = false -> x5 i = x4 i :=
fun i a b c => Found.Pnp31.iter_keep k i a b c (tr (T + 1)) x4
have e5_15 : x5 15 = tr T := by
rw [k5 15 rfl rfl rfl]
show tr T ++ x1 15 = tr T
rw [k1 15 (Nat.le_of_ble_eq_true rfl), h15, app_nil'']
-- 6. the accept block
let x6 := upd x5 0 (revApp (encList [accCl T]) (x5 0))
have R6 := acc_run prog _ 15 T g5.1 rfl rfl x5 e5_1 e5_15
-- 7. the fixed layout pins
let x7 := upd x6 0 (revApp (hw m pos0 q0) (x6 0))
have R7 := fixed_run prog _ (hw m pos0 q0) g6.1 x6 e5_1
-- 8. EMIT pos0 + 1 ones on 14
let x8 := pushAll x7 14 (tr (pos0 + 1))
have R8 := runs_len prog _ _ _ _ _ _ (len_emit 14 (tr (pos0 + 1))).symm (frag_emit_run prog 14 (tr (pos0 + 1)) _ x7 g7.1)
have p8 : forall i, x8 i = upd x7 14 (revApp (tr (pos0 + 1)) (x7 14)) i := fun i => pushAll_eq 14 (tr (pos0 + 1)) x7 i
have e8_1 : x8 1 = [] := (p8 1).trans e5_1
have e8_10 : x8 10 = tr (pos0 + r) := by
rw [p8 10]
show x5 10 = _
rw [k5 10 rfl rfl rfl]
exact Q1.2
have e8_12 : x8 12 = [] := (p8 12).trans e5_12
have e8_14 : x8 14 = tr (pos0 + 1) := by
rw [p8 14, upd_same]
show revApp (tr (pos0 + 1)) (x5 14) = _
rw [k5 14 rfl rfl rfl]
show revApp (tr (pos0 + 1)) (x1 14) = _
rw [k1 14 (Nat.le_of_ble_eq_true rfl), h14, revApp_tr, app_nil'']
-- 9. COPY 10 -> 12
let x9 := upd x8 12 (tr (pos0 + r) ++ x8 12)
have R9 := runs_len prog _ _ _ _ 9 (copyF 10 1 12).length rfl (copy_run prog _ 10 1 12 g8.1 rfl rfl rfl (pos0 + r) x8 e8_10 e8_1)
-- 10. DROP 12 pos0
have e9_12 : x9 12 = tr (r + pos0) := by
show tr (pos0 + r) ++ x8 12 = _
rw [e8_12, app_nil'', Nat.add_comm pos0 r]
let x10 := upd x9 12 (tr r)
have R10 := runs_len prog _ _ _ _ _ _ (len_drop 12 pos0).symm (drop_run prog 12 pos0 _ r x9 g9.1 e9_12)
-- 11. the layout pin loop
have C11 := cloop_run prog _ m (pos0 + 1) r g10.1 x10 e8_1 e8_14 (upd_same x9 12 (tr r))
let x11 := iter 12 (fcF m) (tr r) x10
have R11 := runs_len prog _ _ _ _ _ _ (len_cloop m).symm C11.1
have e11_1 : x11 1 = [] := iter_inv 12 (fcF m) (fun y => y 1 = []) (fun _ _ hy => hy) (tr r) x10 e8_1
have k11 : forall i, Nat.beq i 0 = false -> Nat.beq i 12 = false -> Nat.beq i 14 = false -> x11 i = x10 i :=
fun i a b c => Found.Pnp33.cIter_keep m i a b c (tr r) x10
-- 12. CLEAR 14
let x12 := upd x11 14 []
have R12 := runs_len prog _ _ _ _ 2 (clear 14).length rfl (clear_run prog _ 14 g11.1 (x11 14) x11 rfl)
-- 13. EMIT s ones on 14
let x13 := pushAll x12 14 (tr s)
have R13 := runs_len prog _ _ _ _ _ _ (len_emit 14 (tr s)).symm (frag_emit_run prog 14 (tr s) _ x12 g12.1)
have p13 : forall i, x13 i = upd x12 14 (revApp (tr s) (x12 14)) i := fun i => pushAll_eq 14 (tr s) x12 i
have e13_1 : x13 1 = [] := (p13 1).trans e11_1
have e13_14 : x13 14 = tr s := by
rw [p13 14, upd_same]
show revApp (tr s) [] = tr s
rw [revApp_tr, app_nil'']
have e13_13 : x13 13 = l := by
rw [p13 13]
show x11 13 = l
rw [k11 13 rfl rfl rfl]
show x8 13 = l
rw [p8 13]
show x5 13 = l
rw [k5 13 rfl rfl rfl]
show x1 13 = l
rw [k1 13 (Nat.le_of_ble_eq_true rfl), h13]
-- 14. the input loop
have I14 := inLoop_run prog _ s g13.1 l x13 e13_1 e13_13 e13_14
let x14 := iter2 13 fp l x13
-- 15. push 0
let x15 := upd x14 0 (false :: x14 0)
have R15 := push_run prog _ 0 false g13.2 x14
-- the whole run
have RUN := seq_runs prog _ _ _ _ _ _ _ _ R1 (seq_runs prog _ _ _ _ _ _ _ _ R2 (seq_runs prog _ _ _ _ _ _ _ _ R3
(seq_runs prog _ _ _ _ _ _ _ _ R4 (seq_runs prog _ _ _ _ _ _ _ _ R5 (seq_runs prog _ _ _ _ _ _ _ _ R6
(seq_runs prog _ _ _ _ _ _ _ _ R7 (seq_runs prog _ _ _ _ _ _ _ _ R8 (seq_runs prog _ _ _ _ _ _ _ _ R9
(seq_runs prog _ _ _ _ _ _ _ _ R10 (seq_runs prog _ _ _ _ _ _ _ _ R11 (seq_runs prog _ _ _ _ _ _ _ _ R12
(seq_runs prog _ _ _ _ _ _ _ _ R13 (seq_runs prog _ _ _ _ _ _ _ _ (runs_len prog _ _ _ _ 37 inLoop.length rfl I14.1) R15)))))))))))))
-- register 0
have z13 : x13 0 = revApp (encList (pinCl (fcRows m (pos0 + 1) r)))
(revApp (hw m pos0 q0) (revApp (encList [accCl T]) (revApp (encList (bounds k (pos0 + r + 1) T))
(revApp (encList (windows delta k (pos0 + r + 1) T)) [])))) := by
rw [p13 0]
show iter 12 (fcF m) (tr r) x10 0 = _
rw [C11.2]
show revApp _ (x8 0) = _
rw [p8 0]
show revApp _ (revApp (hw m pos0 q0) (revApp (encList [accCl T]) (iter 12 (fb k) (tr (T + 1)) x4 0))) = _
rw [B5.2]
show revApp _ (revApp _ (revApp _ (revApp _ (iter 11 (rndF k delta (pos0 + r)) (tr T) x 0)))) = _
rw [T1.2, h0]
have ea : encList (pinCl (allPins pos0 q0 m (pos0 + r + 1))) =
hw m pos0 q0 ++ encList (pinCl (fcRows m (pos0 + 1) r)) := by
rw [Nat.add_right_comm pos0 r 1, allPins_enc]
rfl
have Z : x15 0 = revApp (encCNF (full delta k (pos0 + r + 1) T (allPins pos0 q0 m (pos0 + r + 1) ++ inPins (inpOf s l)))) [] := by
show revApp [false] (iter2 13 fp l x13 0) = _
rw [I14.2, z13, full_enc, pinCl_app, encList_app, ea]
repeat rw [revApp_app]
-- registers from 16 on
have K : forall i, 16 <= i -> x15 i = x i := by
intro i hi
have n0 := ne16 i 0 hi (Nat.le_of_ble_eq_true rfl)
have n3 := ne16 i 3 hi (Nat.le_of_ble_eq_true rfl)
have n12 := ne16 i 12 hi (Nat.le_of_ble_eq_true rfl)
have n13 := ne16 i 13 hi (Nat.le_of_ble_eq_true rfl)
have n14 := ne16 i 14 hi (Nat.le_of_ble_eq_true rfl)
have n15 := ne16 i 15 hi (Nat.le_refl 16)
have a14 : x14 i = x13 i := Found.Pnp32.pIter_keep i n0 n13 n14 l x13
have a13 : x13 i = x11 i := (p13 i).trans ((upd_other x12 14 i _ n14).trans (upd_other x11 14 i _ n14))
have a11 : x11 i = x8 i := (k11 i n0 n12 n14).trans ((upd_other x9 12 i _ n12).trans (upd_other x8 12 i _ n12))
have a8 : x8 i = x5 i := (p8 i).trans ((upd_other x7 14 i _ n14).trans ((upd_other x6 0 i _ n0).trans (upd_other x5 0 i _ n0)))
have a5 : x5 i = x1 i := (k5 i n0 n3 n12).trans ((upd_other x3 3 i _ n3).trans ((upd_other x2 12 i _ n12).trans (upd_other x1 15 i _ n15)))
have a1 : x1 i = x i := k1 i (Nat.le_trans (Nat.le_of_ble_eq_true rfl) hi)
exact (upd_other x14 0 i _ n0).trans (a14.trans (a13.trans (a11.trans (a8.trans (a5.trans a1)))))
-- the step bound
have b1 := Found.Pnp40.tloop_steps_le k delta (pos0 + r) T x
(And.intro h1 (And.intro h2 (And.intro (Exists.intro 0 (And.intro h3 (And.intro h4
(Nat.le_of_eq ((congrArg (fun z => 0 + z.length) h11).trans ((congrArg (fun z => 0 + z) (tr_len T)).trans (Nat.zero_add T)))))))
(And.intro (Nat.le_trans (Nat.le_of_eq (congrArg List.length h5)) (Nat.zero_le _)) (And.intro (Nat.le_trans (Nat.le_of_eq (congrArg List.length h6)) (Nat.zero_le _)) (Nat.le_trans (Nat.le_of_eq (congrArg List.length h7)) (Nat.zero_le _))))))) h11
have b4 : 2 * (x3 3).length + 1 <= 2 * T + 1 := Nat.le_of_eq (by
show 2 * (x1 3).length + 1 = 2 * T + 1
rw [e1_3, tr_len])
have b5 := Found.Pnp41.bloop_steps_le k (pos0 + r + 1) T x4
(And.intro (Nat.le_of_eq (by show ([] : List Bool).length + (x4 12).length = T + 1; rw [e4_12, tr_len]; exact Nat.zero_add _)) Q1.1) e4_12
have b6 := Found.Pnp38.cost_le (Found.Pnp26.cntOf x5) T (accOps 15)
(And.intro (Nat.le_of_eq ((congrArg List.length e5_15).trans (tr_len T))) True.intro)
have b11 := Found.Pnp41.cloop_steps_le m (pos0 + 1) r x10
(Nat.le_of_eq (by show (x8 14).length + (tr r).length = pos0 + 1 + r; rw [e8_14, tr_len, tr_len])) (upd_same x9 12 (tr r))
have b12 : 2 * (x11 14).length + 1 <= 2 * (pos0 + 1 + r) + 1 := Nat.le_of_eq (by
show 2 * (iter 12 (fcF m) (tr r) x10 14).length + 1 = _
rw [Found.Pnp41.cIter_14 m r (pos0 + 1) x10 e8_14, tr_len])
have b14 := Found.Pnp41.inLoop_steps_le s l x13 (Nat.le_of_eq (by rw [e13_14, e13_13, tr_len])) e13_13
have BND := Nat.add_le_add b1 (Nat.add_le_add (Nat.le_refl (4 * T + 1 + (3 * T + 1)))
(Nat.add_le_add (Nat.le_refl (4 * (T + 1) + 1 + (3 * (T + 1) + 1))) (Nat.add_le_add b4 (Nat.add_le_add b5
(Nat.add_le_add b6 (Nat.add_le_add (Nat.le_refl ((hw m pos0 q0).length + 0))
(Nat.add_le_add (Nat.le_of_eq (tr_len (pos0 + 1))) (Nat.add_le_add (Nat.le_refl (4 * (pos0 + r) + 1 + (3 * (pos0 + r) + 1)))
(Nat.add_le_add (Nat.le_refl pos0) (Nat.add_le_add b11 (Nat.add_le_add b12 (Nat.add_le_add (Nat.le_of_eq (tr_len s))
(Nat.add_le_add b14 (Nat.le_refl 1))))))))))))))
exact Exists.intro _ (Exists.intro x15 (And.intro RUN (And.intro Z (And.intro K BND))))
end Found.Pnp35
#print axioms Found.Pnp35.len_tloop
#print axioms Found.Pnp35.len_bloop
#print axioms Found.Pnp35.len_cloop
#print axioms Found.Pnp35.len_drop
#print axioms Found.Pnp35.runs_len
#print axioms Found.Pnp35.seq_runs
#print axioms Found.Pnp35.push_run
#print axioms Found.Pnp35.ne16
#print axioms Found.Pnp35.writer_run
lean_all/found/Pnp36.lean
/-
T330 piece 36. found/Pnp36 -- a unary evaluator for polynomials (CL3b, 17).
The time bound T and the width W of the tableau are polynomials of the input length n
(Pnp3.PE). EVAL e D f compiles e to register code: with n ones in register N and the
scratch register B empty, it adds pe e n ones in front of register D. Constants are
EMIT blocks, the variable is COPY N -> D, a sum is one code after the other, and a
product a * b computes a into the fresh register f and loops over it, adding b each
time (fresh registers from f + 1 for the inner codes). Proved: if D, B, N lie below f
and are distinct and every register from f on is empty, EVAL e D f runs as a fragment
in exactly ecost e n steps (an explicit function: a sum of n-linear terms and products
of the values of subterms) and changes only register D, which gets pe e n more ones.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp35
import found.Pnp3
namespace Found.Pnp36
open Found.Pnp3 (PE pe)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len mapI appI app_nil'' revApp_tr ne_symm')
open Found.Pnp24 (pushAll_eq len_appI len_mapI len_emit upd_upd)
open Found.Pnp26 (loop_inv)
open Found.Pnp27 (copyF copy_run)
open Found.Pnp28 (seqI frag_seq)
open Found.Pnp35 (seq_runs runs_len)
/-! ## Small facts -/
theorem lt_beq (a b : Nat) (h : a < b) : Nat.beq a b = false :=
Found.Pnp2.beq_false_of_ne a b (fun e => Nat.lt_irrefl b (Eq.subst (motive := fun z => z < b) e h))
theorem gt_beq (a b : Nat) (h : a < b) : Nat.beq b a = false := ne_symm' a b (lt_beq a b h)
theorem upd_self (x : Nat -> List Bool) (r : Nat) (v : List Bool) (h : x r = v) : forall i, upd x r v i = x i := by
intro i
show selR (Nat.beq i r) v (x i) = x i
cases e : Nat.beq i r with
| false => rfl
| true =>
have ei : i = r := Found.Pnp2.beq_eq i r e
rw [ei, h]
rfl
theorem upd_congr (x y : Nat -> List Bool) (h : forall i, x i = y i) (r : Nat) (v : List Bool) :
forall i, upd x r v i = upd y r v i := by
intro i
show selR (Nat.beq i r) v (x i) = selR (Nat.beq i r) v (y i)
rw [h i]
theorem tr_app' (b : Nat) : forall a, tr a ++ tr b = tr (b + a) := by
intro a
induction a with
| zero => rfl
| succ a ih => exact congrArg (fun l => true :: l) ih
theorem runs_post (prog : List Ins) (n o o' : Nat) (x y z : Nat -> List Bool) (h : Runs prog n o x o' y)
(e : forall i, y i = z i) : Runs prog n o x o' z :=
And.intro h.1 (fun i => (h.2 i).trans (e i))
theorem runs_cnt (prog : List Ins) (a b o o' : Nat) (x y : Nat -> List Bool) (e : a = b)
(h : Runs prog a o x o' y) : Runs prog b o x o' y :=
Eq.subst (motive := fun z => Runs prog z o x o' y) e h
theorem steps_const (c C : Nat) (F : (Nat -> List Bool) -> (Nat -> List Bool)) :
forall m (y : Nat -> List Bool), steps c (fun _ => C) F (tr m) y = m * (C + 2) + 1 := by
intro m
induction m with
| zero => intro y; show 1 = 0 * (C + 2) + 1; rw [Nat.zero_mul]
| succ m ih =>
intro y
show ((1 + C) + 1) + steps c (fun _ => C) F (tr m) (F (upd y c (tr m))) = (m + 1) * (C + 2) + 1
rw [ih, Nat.succ_mul, Nat.add_comm 1 C, Nat.add_comm (C + 1 + 1) (m * (C + 2) + 1), Nat.add_right_comm (m * (C + 2)) 1]
/-! ## The evaluator -/
section
variable (B N : Nat)
def comp : PE -> Nat -> Nat -> List Ins
| .x, D, _ => copyF N B D
| .c k, D, _ => emit D (tr k)
| .add a b, D, f => seqI (comp a D f) (comp b D f)
| .mul a b, D, f => seqI (comp a f (f + 1))
(appI (appI [.pop f ((comp b D (f + 1)).length + 2) 1 1] (mapI (shift 1) (comp b D (f + 1)))) [.jmp 0])
def ecost : PE -> Nat -> Nat
| .x, n => 4 * n + 1 + (3 * n + 1)
| .c k, _ => k
| .add a b, n => ecost a n + ecost b n
| .mul a b, n => ecost a n + (pe a n * (ecost b n + 2) + 1)
/-- The preconditions: scratch empty, n in N, every register from f on empty. -/
def Pre (n f : Nat) (x : Nat -> List Bool) : Prop :=
x B = [] /\ x N = tr n /\ forall i, f <= i -> x i = []
theorem pre_upd (n f : Nat) (x : Nat -> List Bool) (h : Pre B N n f x) (D : Nat) (hD : D < f)
(hBD : Nat.beq B D = false) (hND : Nat.beq N D = false) (v : List Bool) : Pre B N n f (upd x D v) :=
And.intro ((upd_other x D B v hBD).trans h.1) (And.intro ((upd_other x D N v hND).trans h.2.1)
(fun i hi => (upd_other x D i v (gt_beq D i (Nat.lt_of_lt_of_le hD hi))).trans (h.2.2 i hi)))
/-- The loop of a product: what it does to the registers. -/
theorem mul_iter (D f pb : Nat) (hDf : Nat.beq D f = false) (hfD : Nat.beq f D = false) :
forall m (z : Nat -> List Bool), z f = tr m ->
forall i, iter f (fun y => upd y D (tr pb ++ y D)) (tr m) z i = upd (upd z f []) D (tr (m * pb) ++ z D) i := by
intro m
induction m with
| zero =>
intro z hz i
show z i = upd (upd z f []) D (tr (0 * pb) ++ z D) i
rw [Nat.zero_mul]
show z i = upd (upd z f []) D ([] ++ z D) i
have a := upd_self z D (z D) rfl i
have b := upd_congr (upd z f []) z (upd_self z f [] hz) D ([] ++ z D) i
exact (b.trans a).symm
| succ m ih =>
intro z hz i
let z' := upd (upd z f (tr m)) D (tr pb ++ upd z f (tr m) D)
have hz' : z' f = tr m := (upd_other _ D f _ hfD).trans (upd_same z f (tr m))
show iter f (fun y => upd y D (tr pb ++ y D)) (tr m) z' i = _
rw [ih z' hz' i]
have eD : z' D = tr pb ++ z D := by
show upd (upd z f (tr m)) D (tr pb ++ upd z f (tr m) D) D = _
rw [upd_same, upd_other z f D _ hDf]
show selR (Nat.beq i D) (tr (m * pb) ++ z' D) (upd z' f [] i) =
selR (Nat.beq i D) (tr ((m + 1) * pb) ++ z D) (upd z f [] i)
rw [eD, <- Found.Pnp19.app_assoc', tr_app', Nat.succ_mul, Nat.add_comm pb (m * pb)]
cases e : Nat.beq i D with
| true => rfl
| false =>
show selR (Nat.beq i f) [] (z' i) = selR (Nat.beq i f) [] (z i)
cases e2 : Nat.beq i f with
| true => rfl
| false =>
show upd (upd z f (tr m)) D _ i = z i
rw [upd_other _ D i _ e, upd_other z f i _ e2]
theorem comp_run (prog : List Ins) (n : Nat) (hBN : Nat.beq B N = false) :
forall (e : PE) (D f o : Nat) (x : Nat -> List Bool), Frag prog o (comp B N e D f) -> Pre B N n f x ->
D < f -> B < f -> N < f -> Nat.beq D B = false -> Nat.beq D N = false ->
Runs prog (ecost e n) o x (o + (comp B N e D f).length) (upd x D (tr (pe e n) ++ x D)) := by
intro e
induction e with
| x =>
intro D f o x hf hp _ _ _ hDB hDN
exact copy_run prog o N B D hf (ne_symm' B N hBN) (ne_symm' D N hDN) (ne_symm' D B hDB) n x hp.2.1 hp.1
| c k =>
intro D f o x hf _ _ _ _ _ _
have r := runs_len prog _ _ _ _ _ _ (len_emit D (tr k)).symm (frag_emit_run prog D (tr k) o x hf)
have r2 := runs_cnt prog _ _ _ _ _ _ (tr_len k) r
exact runs_post prog _ _ _ _ _ _ r2 (fun i => (pushAll_eq D (tr k) x i).trans
(congrArg (fun v => upd x D v i) (revApp_tr k (x D))))
| add a b iha ihb =>
intro D f o x hf hp hD hB hN hDB hDN
have g := frag_seq prog o _ _ hf
have ra := iha D f o x g.1 hp hD hB hN hDB hDN
let xa := upd x D (tr (pe a n) ++ x D)
have hpa : Pre B N n f xa := pre_upd B N n f x hp D hD (ne_symm' D B hDB) (ne_symm' D N hDN) _
have rb := ihb D f _ xa g.2 hpa hD hB hN hDB hDN
have r := seq_runs prog o _ _ _ _ x xa _ ra rb
refine runs_post prog _ _ _ _ _ _ r (fun i => ?_)
rw [upd_upd]
show selR (Nat.beq i D) (tr (pe b n) ++ xa D) (x i) = selR (Nat.beq i D) (tr (pe a n + pe b n) ++ x D) (x i)
have eD : xa D = tr (pe a n) ++ x D := upd_same x D _
rw [eD, <- Found.Pnp19.app_assoc', tr_app']
| mul a b iha ihb =>
intro D f o x hf hp hD hB hN hDB hDN
have g := frag_seq prog o _ _ hf
have hfB : Nat.beq f B = false := gt_beq B f hB
have hfN : Nat.beq f N = false := gt_beq N f hN
have hDf : Nat.beq D f = false := lt_beq D f hD
have hfD : Nat.beq f D = false := gt_beq D f hD
-- a into register f
have hp1 : Pre B N n (f + 1) x := And.intro hp.1 (And.intro hp.2.1 (fun i hi => hp.2.2 i (Nat.le_of_succ_le hi)))
have ra := iha f (f + 1) o x g.1 hp1 (Nat.lt_succ_self f) (Nat.lt_succ_of_lt hB) (Nat.lt_succ_of_lt hN) hfB hfN
have xf : x f = [] := hp.2.2 f (Nat.le_refl f)
let xa := upd x f (tr (pe a n) ++ x f)
-- the loop
let L := (comp B N b D (f + 1)).length
let o' := o + (comp B N a f (f + 1)).length
have gl := g.2
have fa := Found.Pnp23.frag_app_l prog o' _ _ gl
have fbd : Frag prog (o' + 1) (comp B N b D (f + 1)) := Found.Pnp23.frag_app prog o' [.pop f (L + 2) 1 1] _ fa
have i0 : nthI prog o' = some (.pop f (o' + (L + 2)) (o' + 1) (o' + 1)) := fa 0 _ rfl
have hl : (appI [.pop f (L + 2) 1 1] (mapI (shift 1) (comp B N b D (f + 1)))).length = 1 + L := by
rw [len_appI, len_mapI]; rfl
have i1 : nthI prog (o' + 1 + L) = some (.jmp o') := by
have e0 := gl ((appI [.pop f (L + 2) 1 1] (mapI (shift 1) (comp B N b D (f + 1)))).length + 0) (.jmp 0)
(Found.Pnp23.nthI_app_r _ [.jmp 0] 0)
rw [hl] at e0
have e : nthI prog (o' + (1 + L)) = some (.jmp o') := e0
rw [Nat.add_assoc]
exact e
let P : (Nat -> List Bool) -> Prop := fun z => Pre B N n (f + 1) z
have hbody : forall z, P z -> Runs prog (ecost b n) (o' + 1) z (o' + 1 + L) (upd z D (tr (pe b n) ++ z D)) :=
fun z hz => ihb D (f + 1) (o' + 1) z fbd hz (Nat.lt_succ_of_lt hD) (Nat.lt_succ_of_lt hB) (Nat.lt_succ_of_lt hN) hDB hDN
have hkeep : forall z, upd z D (tr (pe b n) ++ z D) f = z f := fun z => upd_other z D f _ hfD
have hP1 : forall z c l, P z -> z f = c :: l -> P (upd z f l) := fun z _ l hz _ =>
pre_upd B N n (f + 1) z hz f (Nat.lt_succ_self f) (ne_symm' f B hfB) (ne_symm' f N hfN) l
have hP2 : forall z, P z -> P (upd z D (tr (pe b n) ++ z D)) := fun z hz =>
pre_upd B N n (f + 1) z hz D (Nat.lt_succ_of_lt hD) (ne_symm' D B hDB) (ne_symm' D N hDN) _
have hxa : xa f = tr (pe a n) := by
show upd x f (tr (pe a n) ++ x f) f = _
rw [upd_same, xf, app_nil'']
have hPa : P xa := pre_upd B N n (f + 1) x hp1 f (Nat.lt_succ_self f) (ne_symm' f B hfB) (ne_symm' f N hfN) _
have LP := loop_inv f (fun _ => ecost b n) (fun z => upd z D (tr (pe b n) ++ z D)) P prog o' L (o' + (L + 2))
i0 i1 hbody hkeep hP1 hP2 (tr (pe a n)) xa hxa hPa
have LP2 := runs_cnt prog _ _ _ _ _ _ (steps_const f (ecost b n) _ (pe a n) xa) LP
have hll : (appI (appI [.pop f (L + 2) 1 1] (mapI (shift 1) (comp B N b D (f + 1)))) [.jmp 0]).length = L + 2 := by
rw [len_appI, hl]
show 1 + L + 1 = L + 2
rw [Nat.add_comm 1 L]
have LP3 := runs_len prog _ _ _ _ _ _ hll.symm LP2
have r := seq_runs prog o _ _ _ _ x xa _ ra LP3
refine runs_post prog _ _ _ _ _ _ r (fun i => ?_)
rw [mul_iter D f (pe b n) hDf hfD (pe a n) xa hxa i]
have exD : xa D = x D := upd_other x f D _ hDf
rw [exD]
show selR (Nat.beq i D) _ (upd xa f [] i) = selR (Nat.beq i D) _ (x i)
rw [upd_upd, upd_self x f [] xf i]
rfl
end
end Found.Pnp36
#print axioms Found.Pnp36.lt_beq
#print axioms Found.Pnp36.gt_beq
#print axioms Found.Pnp36.upd_self
#print axioms Found.Pnp36.upd_congr
#print axioms Found.Pnp36.tr_app'
#print axioms Found.Pnp36.runs_post
#print axioms Found.Pnp36.runs_cnt
#print axioms Found.Pnp36.steps_const
#print axioms Found.Pnp36.pre_upd
#print axioms Found.Pnp36.mul_iter
#print axioms Found.Pnp36.comp_run
lean_all/found/Pnp37.lean
/-
T330 piece 37. found/Pnp37 -- the reduction map as one register program (CL3b, 18).
RED = LEN (count the input bits of register 13 into register 17, keeping a reversed copy
in 2); MOVE 2 -> 13 (the input back in order); EVAL W into 9 (W = pos0 + R(n) + 1 for a
polynomial R); COPY 9 -> 10; DROP 10 1 (W - 1); EVAL T into 11; push 1 on 4; WRITER
(Pnp35); MOVE 0 -> 16. Proved: started with the input l in register 13 and every other
register empty, RED runs as one program fragment and leaves in register 16 exactly the CNF
encoding (Pnp19) of the Cook-Levin tableau CNF of l (Pnp11.full with the layout pins and
the input pins at cells s, s + 1, ...), with T = pe eT |l| and W = pos0 + pe eR |l| + 1;
for a Turing machine verifier this is enc (Pnp18.red M W T p0 q0 (inpOf s l)).
The step count is still an existential here (the polynomial bound is the next piece).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp36
import found.Pnp18
import found.Pnp41
namespace Found.Pnp37
open Found.Pnp3 (PE pe)
open Found.Pnp11 (full)
open Found.Pnp12 (TM rule)
open Found.Pnp14 (allPins inPins pinsTM)
open Found.Pnp19 (encCNF)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp23 (tr tr_len tr_cons app_nil'' ne_symm')
open Found.Pnp27 (copyF copy_run)
open Found.Pnp28 (seqI frag_seq)
open Found.Pnp32 (steps2 iter2 loop2_inv inpOf)
open Found.Pnp34 (dropI drop_run revApp_twice)
open Found.Pnp35 (seq_runs runs_len push_run writer writer_run len_drop)
open Found.Pnp36 (comp ecost Pre comp_run runs_post runs_cnt upd_self)
/-! ## MOVE as a run -/
theorem move_runs (prog : List Ins) (o r s : Nat) (hf : Frag prog o (move r s)) (hrs : Nat.beq r s = false)
(l m : List Bool) (x : Nat -> List Bool) (hr : x r = l) (hs : x s = m) :
Runs prog (3 * l.length + 1) o x (o + 5) (upd (upd x r []) s (revApp l m)) := by
have h := frag_move_run prog o r s hf hrs l m x hr hs
refine And.intro h.1 (fun i => ?_)
show _ = selR (Nat.beq i s) (revApp l m) (selR (Nat.beq i r) [] (x i))
cases e1 : Nat.beq i s with
| true => rw [Found.Pnp2.beq_eq i s e1]; exact h.2.2.1
| false =>
cases e2 : Nat.beq i r with
| true => rw [Found.Pnp2.beq_eq i r e2]; exact h.2.1
| false => exact h.2.2.2 i e2 e1
/-! ## LEN: count the input, keep it -/
def lenL : List Ins := [.pop 13 7 1 4, .push 2 false, .push 17 true, .jmp 0, .push 2 true, .push 17 true, .jmp 0]
def lenF (v : Bool) (z : Nat -> List Bool) : Nat -> List Bool :=
upd (upd z 2 (v :: z 2)) 17 (true :: upd z 2 (v :: z 2) 17)
theorem len_iter : forall (l : List Bool) (z : Nat -> List Bool), z 13 = l ->
iter2 13 lenF l z 2 = revApp l (z 2) /\ iter2 13 lenF l z 17 = tr l.length ++ z 17 /\
iter2 13 lenF l z 13 = [] /\
(forall i, Nat.beq i 2 = false -> Nat.beq i 13 = false -> Nat.beq i 17 = false -> iter2 13 lenF l z i = z i) := by
intro l
induction l with
| nil => intro z hz; exact And.intro rfl (And.intro rfl (And.intro hz (fun _ _ _ _ => rfl)))
| cons b l ih =>
intro z _
have r := ih (lenF b (upd z 13 l)) rfl
refine And.intro r.1 (And.intro ?_ (And.intro r.2.2.1 (fun i a c d => ?_)))
· show iter2 13 lenF l (lenF b (upd z 13 l)) 17 = _
rw [r.2.1]
exact tr_cons l.length (z 17)
· show iter2 13 lenF l (lenF b (upd z 13 l)) i = _
rw [r.2.2.2 i a c d]
exact (upd_other _ 17 i _ d).trans ((upd_other _ 2 i _ a).trans (upd_other z 13 i _ c))
theorem len_steps : forall (l : List Bool) (z : Nat -> List Bool), steps2 13 (fun _ _ => 2) lenF l z = 4 * l.length + 1 := by
intro l
induction l with
| nil => intro z; rfl
| cons b l ih =>
intro z
show 4 + steps2 13 (fun _ _ => 2) lenF l (lenF b (upd z 13 l)) = 4 * l.length + 4 + 1
rw [ih, Nat.add_comm 4 (4 * l.length + 1), Nat.add_right_comm]
theorem lenL_run (prog : List Ins) (o : Nat) (hf : Frag prog o lenL) (l : List Bool) (x : Nat -> List Bool)
(h13 : x 13 = l) :
Runs prog (4 * l.length + 1) o x (o + 7) (iter2 13 lenF l x) := by
have i0 : nthI prog o = some (.pop 13 (o + 7) (o + 1) (o + 4)) := hf 0 _ rfl
have i3 : nthI prog (o + 1 + 2) = some (.jmp o) := hf 3 _ rfl
have i6 : nthI prog (o + 4 + 2) = some (.jmp o) := hf 6 _ rfl
have i1 : nthI prog (o + 1) = some (.push 2 false) := hf 1 _ rfl
have i2 : nthI prog (o + 2) = some (.push 17 true) := hf 2 _ rfl
have i4 : nthI prog (o + 4) = some (.push 2 true) := hf 4 _ rfl
have i5 : nthI prog (o + 5) = some (.push 17 true) := hf 5 _ rfl
have hb0 : forall z, True -> Runs prog 2 (o + 1) z (o + 1 + 2) (lenF false z) := by
intro z _
show (run prog 1 (exec (Cfg.mk (o + 1) z) (nthI prog (o + 1)))).pc = _ /\
forall i, (run prog 1 (exec (Cfg.mk (o + 1) z) (nthI prog (o + 1)))).regs i = _
rw [i1]
show (run prog 0 (exec (Cfg.mk (o + 2) _) (nthI prog (o + 2)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + 2) (upd z 2 (false :: z 2))) (nthI prog (o + 2)))).regs i = _
rw [i2]
exact And.intro rfl (fun _ => rfl)
have hb1 : forall z, True -> Runs prog 2 (o + 4) z (o + 4 + 2) (lenF true z) := by
intro z _
show (run prog 1 (exec (Cfg.mk (o + 4) z) (nthI prog (o + 4)))).pc = _ /\
forall i, (run prog 1 (exec (Cfg.mk (o + 4) z) (nthI prog (o + 4)))).regs i = _
rw [i4]
show (run prog 0 (exec (Cfg.mk (o + 5) _) (nthI prog (o + 5)))).pc = _ /\
forall i, (run prog 0 (exec (Cfg.mk (o + 5) (upd z 2 (true :: z 2))) (nthI prog (o + 5)))).regs i = _
rw [i5]
exact And.intro rfl (fun _ => rfl)
have L := loop2_inv 13 (fun _ _ => 2) lenF (fun _ => True) prog o (o + 4) (o + 1 + 2) (o + 4 + 2) (o + 7)
i0 i3 i6 hb0 hb1 (fun _ _ => rfl) (fun _ _ _ _ _ => True.intro) (fun _ _ _ => True.intro) l x h13 True.intro
exact runs_cnt prog _ _ _ _ _ _ (len_steps l x) L
/-! ## RED -/
theorem ne18 (i a : Nat) (hi : 18 <= i) (ha : a + 1 <= 18) : Nat.beq i a = false :=
Found.Pnp2.beq_false_of_ne i a (fun e => Nat.lt_irrefl a (Nat.lt_of_lt_of_le ha (Eq.subst (motive := fun z => 18 <= z) e hi)))
theorem lt18 (a : Nat) (h : Nat.ble (a + 1) 18 = true) : a < 18 := Nat.le_of_ble_eq_true h
def eW (pos0 : Nat) (eR : PE) : PE := .add (.add (.c pos0) eR) (.c 1)
def redP (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) : List Ins :=
seqI lenL (seqI (move 2 13) (seqI (comp 1 17 (eW pos0 eR) 9 18) (seqI (copyF 9 1 10) (seqI (dropI 10 1)
(seqI (comp 1 17 eT 11 18) (seqI [.push 4 true] (seqI (writer k delta m pos0 q0 s) (move 0 16))))))))
theorem revApp_len : forall (l m : List Bool), (revApp l m).length = l.length + m.length := by
intro l
induction l with
| nil => intro m; exact (Nat.zero_add _).symm
| cons b l ih =>
intro m
show (revApp l (b :: m)).length = l.length + 1 + m.length
rw [ih]
exact (Nat.add_right_comm l.length 1 m.length).symm
/-- The step bound of RED, n the input length. -/
def redB (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) (n : Nat) : Nat :=
(4 * n + 1) + ((3 * n + 1) + (ecost (eW pos0 eR) n + ((4 * (pos0 + pe eR n + 1) + 1 + (3 * (pos0 + pe eR n + 1) + 1)) +
(1 + (ecost eT n + (1 + (Found.Pnp35.WB k delta m pos0 q0 s (pe eR n) (pe eT n) n +
(3 * Found.Pnp35.WB k delta m pos0 q0 s (pe eR n) (pe eT n) n + 1))))))))
theorem redP_run (prog : List Ins) (o k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool)
(s : Nat) (eR eT : PE) (hf : Frag prog o (redP k delta m pos0 q0 s eR eT)) (l : List Bool) (x : Nat -> List Bool)
(h13 : x 13 = l) (hx : forall i, Nat.beq i 13 = false -> x i = []) :
Exists fun N => Exists fun y => Runs prog N o x (o + (redP k delta m pos0 q0 s eR eT).length) y /\
y 16 = encCNF (full delta k (pos0 + pe eR l.length + 1) (pe eT l.length)
(allPins pos0 q0 m (pos0 + pe eR l.length + 1) ++ inPins (inpOf s l))) /\
N <= redB k delta m pos0 q0 s eR eT l.length := by
have g0 := frag_seq prog o _ _ hf
have g1 := frag_seq prog _ _ _ g0.2
have g2 := frag_seq prog _ _ _ g1.2
have g3 := frag_seq prog _ _ _ g2.2
have g4 := frag_seq prog _ _ _ g3.2
have g5 := frag_seq prog _ _ _ g4.2
have g6 := frag_seq prog _ _ _ g5.2
have g7 := frag_seq prog _ _ _ g6.2
-- 1. LEN
have R1 := runs_len prog _ _ _ _ 7 lenL.length rfl (lenL_run prog o g0.1 l x h13)
let x1 := iter2 13 lenF l x
have q1 := len_iter l x h13
-- 2. MOVE 2 -> 13
have e1_2 : x1 2 = revApp l [] := q1.1.trans (congrArg (revApp l) (hx 2 rfl))
have R2 := runs_len prog _ _ _ _ 5 (move 2 13).length rfl (move_runs prog _ 2 13 g1.1 rfl (revApp l []) [] x1 e1_2 q1.2.2.1)
let x2 := upd (upd x1 2 []) 13 (revApp (revApp l []) [])
have k2 : forall i, 18 <= i -> x2 i = [] := by
intro i hi
have a : x2 i = x i := (upd_other _ 13 i _ (ne18 i 13 hi (Nat.le_of_ble_eq_true rfl))).trans
((upd_other x1 2 i _ (ne18 i 2 hi (Nat.le_of_ble_eq_true rfl))).trans
(q1.2.2.2 i (ne18 i 2 hi (Nat.le_of_ble_eq_true rfl)) (ne18 i 13 hi (Nat.le_of_ble_eq_true rfl))
(ne18 i 17 hi (Nat.le_refl 18))))
exact a.trans (hx i (ne18 i 13 hi (Nat.le_of_ble_eq_true rfl)))
have e2_1 : x2 1 = [] := (q1.2.2.2 1 rfl rfl rfl).trans (hx 1 rfl)
have e2_17 : x2 17 = tr l.length := by
show iter2 13 lenF l x 17 = tr l.length
rw [q1.2.1, hx 17 rfl, app_nil'']
have p2 : Pre 1 17 l.length 18 x2 := And.intro e2_1 (And.intro e2_17 k2)
-- 3. EVAL W into 9
have R3 := comp_run 1 17 prog l.length rfl (eW pos0 eR) 9 18 _ x2 g2.1 p2 (lt18 _ rfl)
(lt18 _ rfl) (lt18 _ rfl) rfl rfl
let x3 := upd x2 9 (tr (pe (eW pos0 eR) l.length) ++ x2 9)
have e2_9 : x2 9 = [] := (q1.2.2.2 9 rfl rfl rfl).trans (hx 9 rfl)
have e3_9 : x3 9 = tr (pos0 + pe eR l.length + 1) := by
show tr (pe (eW pos0 eR) l.length) ++ x2 9 = _
rw [e2_9, app_nil'']
rfl
-- 4. COPY 9 -> 10
have R4 := runs_len prog _ _ _ _ 9 (copyF 9 1 10).length rfl
(copy_run prog _ 9 1 10 g3.1 rfl rfl rfl (pos0 + pe eR l.length + 1) x3 e3_9 e2_1)
let x4 := upd x3 10 (tr (pos0 + pe eR l.length + 1) ++ x3 10)
have e4_10 : x4 10 = tr (pos0 + pe eR l.length + 1) := by
show tr (pos0 + pe eR l.length + 1) ++ iter2 13 lenF l x 10 = _
rw [(q1.2.2.2 10 rfl rfl rfl).trans (hx 10 rfl), app_nil'']
-- 5. DROP 10 1
have R5 := runs_len prog _ _ _ _ _ _ (len_drop 10 1).symm (drop_run prog 10 1 _ (pos0 + pe eR l.length) x4 g4.1 e4_10)
let x5 := upd x4 10 (tr (pos0 + pe eR l.length))
have k5 : forall i, 18 <= i -> x5 i = [] := fun i hi =>
(upd_other _ 10 i _ (ne18 i 10 hi (Nat.le_of_ble_eq_true rfl))).trans
((upd_other _ 10 i _ (ne18 i 10 hi (Nat.le_of_ble_eq_true rfl))).trans
((upd_other _ 9 i _ (ne18 i 9 hi (Nat.le_of_ble_eq_true rfl))).trans (k2 i hi)))
have p5 : Pre 1 17 l.length 18 x5 := And.intro e2_1 (And.intro e2_17 k5)
-- 6. EVAL T into 11
have R6 := comp_run 1 17 prog l.length rfl eT 11 18 _ x5 g5.1 p5 (lt18 _ rfl)
(lt18 _ rfl) (lt18 _ rfl) rfl rfl
let x6 := upd x5 11 (tr (pe eT l.length) ++ x5 11)
-- 7. push 1 on 4
have R7 := push_run prog _ 4 true g6.1 x6
let x7 := upd x6 4 (true :: x6 4)
-- 8. WRITER
have z : forall i, Nat.beq i 2 = false -> Nat.beq i 13 = false -> Nat.beq i 17 = false -> x1 i = [] :=
fun i a b c => (q1.2.2.2 i a b c).trans (hx i b)
have w11 : x7 11 = tr (pe eT l.length) := by
show tr (pe eT l.length) ++ x1 11 = _
rw [z 11 rfl rfl rfl, app_nil'']
have w4 : x7 4 = tr 1 := by
show true :: x1 4 = tr 1
rw [z 4 rfl rfl rfl]
rfl
have W8 := writer_run prog _ k delta m pos0 q0 s (pe eR l.length) (pe eT l.length) l g7.1 x7
(z 0 rfl rfl rfl) e2_1 rfl (z 3 rfl rfl rfl) w4 (z 5 rfl rfl rfl) (z 6 rfl rfl rfl) (z 7 rfl rfl rfl) e3_9 rfl w11 (z 12 rfl rfl rfl) (revApp_twice l)
(z 14 rfl rfl rfl) (z 15 rfl rfl rfl)
exact Exists.elim W8 fun N8 hN => Exists.elim hN fun y8 hy => by
have y16 : y8 16 = [] := (hy.2.2.1 16 (Nat.le_refl 16)).trans (z 16 rfl rfl rfl)
have R9 := runs_len prog _ _ _ _ 5 (move 0 16).length rfl
(move_runs prog _ 0 16 g7.2 rfl _ [] y8 hy.2.1 y16)
have RUN := seq_runs prog _ _ _ _ _ _ _ _ R1 (seq_runs prog _ _ _ _ _ _ _ _ R2 (seq_runs prog _ _ _ _ _ _ _ _ R3
(seq_runs prog _ _ _ _ _ _ _ _ R4 (seq_runs prog _ _ _ _ _ _ _ _ R5 (seq_runs prog _ _ _ _ _ _ _ _ R6
(seq_runs prog _ _ _ _ _ _ _ _ R7 (seq_runs prog _ _ _ _ _ _ _ _ hy.1 R9)))))))
have hx70 : (x7 0).length = 0 := congrArg List.length (z 0 rfl rfl rfl)
have o8 : (y8 0).length <= Found.Pnp35.WB k delta m pos0 q0 s (pe eR l.length) (pe eT l.length) l.length :=
Nat.le_trans (Found.Pnp38.runs_len_le prog _ _ _ x7 y8 hy.1 0)
(Nat.le_trans (Nat.le_of_eq ((congrArg (fun z => z + N8) hx70).trans (Nat.zero_add N8))) hy.2.2.2)
have b9 : 3 * (revApp (encCNF (full delta k (pos0 + pe eR l.length + 1) (pe eT l.length)
(allPins pos0 q0 m (pos0 + pe eR l.length + 1) ++ inPins (inpOf s l)))) []).length + 1 <=
3 * Found.Pnp35.WB k delta m pos0 q0 s (pe eR l.length) (pe eT l.length) l.length + 1 :=
Nat.add_le_add_right (Nat.mul_le_mul (Nat.le_refl 3) (Nat.le_trans (Nat.le_of_eq (congrArg List.length hy.2.1).symm) o8)) 1
have b2 : 3 * (revApp l []).length + 1 <= 3 * l.length + 1 := Nat.le_of_eq (by rw [revApp_len]; rfl)
have BND := Nat.add_le_add (Nat.le_refl (4 * l.length + 1)) (Nat.add_le_add b2
(Nat.add_le_add (Nat.le_refl (ecost (eW pos0 eR) l.length))
(Nat.add_le_add (Nat.le_refl (4 * (pos0 + pe eR l.length + 1) + 1 + (3 * (pos0 + pe eR l.length + 1) + 1)))
(Nat.add_le_add (Nat.le_refl 1) (Nat.add_le_add (Nat.le_refl (ecost eT l.length))
(Nat.add_le_add (Nat.le_refl 1) (Nat.add_le_add hy.2.2.2 b9)))))))
refine Exists.intro _ (Exists.intro _ (And.intro RUN (And.intro ?_ BND)))
show selR (Nat.beq 16 16) _ _ = _
exact revApp_twice _
/-- For a Turing machine verifier (Pnp18.red): the register program writes enc (red x). -/
theorem redP_tm (prog : List Ins) (o : Nat) (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE)
(hf : Frag prog o (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)) (l : List Bool) (x : Nat -> List Bool)
(h13 : x 13 = l) (hx : forall i, Nat.beq i 13 = false -> x i = []) :
Exists fun N => Exists fun y => Runs prog N o x (o + (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length) y /\
y 16 = encCNF (Found.Pnp18.red M (p0 + 1 + pe eR l.length + 1) (pe eT l.length) p0 q0 (inpOf s l)) /\
N <= redB (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT l.length :=
redP_run prog o (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT hf l x h13 hx
end Found.Pnp37
#print axioms Found.Pnp37.move_runs
#print axioms Found.Pnp37.len_iter
#print axioms Found.Pnp37.len_steps
#print axioms Found.Pnp37.lenL_run
#print axioms Found.Pnp37.ne18
#print axioms Found.Pnp37.revApp_len
#print axioms Found.Pnp37.lt18
#print axioms Found.Pnp37.redP_run
#print axioms Found.Pnp37.redP_tm
lean_all/found/Pnp38.lean
/-
T330 piece 38. found/Pnp38 -- growth of registers and the cost of blocks (CL3b, 19).
Two tools for the step bound of the reduction program:
* one step of the register machine adds at most one bit to any register, so after n
steps a register is at most n bits longer than before (len_run, runs_len_le); in
particular the output of a program is no longer than its step count;
* a straight-line block (Pnp24) whose counter registers hold at most M ones costs at
most esum ops + |ops| (7M + 3) steps, where esum ops is the total length of its fixed
bit lists (a constant of the block).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp33
namespace Found.Pnp38
open Found.Pnp20
open Found.Pnp21
open Found.Pnp24 (Op cost)
/-! ## A step adds at most one bit to a register -/
theorem len_upd (x : Nat -> List Bool) (r i : Nat) (v : List Bool) (h : v.length <= (x r).length + 1) :
(upd x r v i).length <= (x i).length + 1 := by
show (selR (Nat.beq i r) v (x i)).length <= (x i).length + 1
cases e : Nat.beq i r with
| false => exact Nat.le_succ _
| true =>
have ei : i = r := Found.Pnp2.beq_eq i r e
rw [ei]
exact h
theorem len_step (p : List Ins) (c : Cfg) (i : Nat) : ((step p c).regs i).length <= (c.regs i).length + 1 := by
show ((exec c (nthI p c.pc)).regs i).length <= _
cases nthI p c.pc with
| none => exact Nat.le_succ _
| some ins =>
cases ins with
| push r b => exact len_upd c.regs r i (b :: c.regs r) (Nat.le_refl _)
| jmp l => exact Nat.le_succ _
| pop r e z o =>
show ((popTo c r e z o (c.regs r)).regs i).length <= _
cases h : c.regs r with
| nil => exact Nat.le_succ _
| cons b t =>
cases b with
| false =>
exact len_upd c.regs r i t (by rw [h]; exact Nat.le_trans (Nat.le_succ t.length) (Nat.le_succ _))
| true =>
exact len_upd c.regs r i t (by rw [h]; exact Nat.le_trans (Nat.le_succ t.length) (Nat.le_succ _))
theorem len_run (p : List Ins) (i : Nat) : forall n (c : Cfg), ((run p n c).regs i).length <= (c.regs i).length + n := by
intro n
induction n with
| zero => intro c; exact Nat.le_refl _
| succ n ih =>
intro c
show ((run p n (step p c)).regs i).length <= (c.regs i).length + (n + 1)
have a := ih (step p c)
have b := Nat.add_le_add_right (len_step p c i) n
have e : (c.regs i).length + 1 + n = (c.regs i).length + (n + 1) := by
rw [Nat.add_assoc, Nat.add_comm 1 n]
exact Nat.le_trans a (Nat.le_trans b (Nat.le_of_eq e))
/-- After a fragment run of n steps, every register grew by at most n bits. -/
theorem runs_len_le (prog : List Ins) (n o o' : Nat) (x y : Nat -> List Bool) (h : Runs prog n o x o' y) (i : Nat) :
(y i).length <= (x i).length + n := by
rw [<- h.2 i]
exact len_run prog i n (Cfg.mk o x)
/-! ## The cost of a block -/
/-- The total length of the fixed bit lists of a block. -/
def esum : List Op -> Nat
| [] => 0
| .emit w :: rest => w.length + esum rest
| .un _ :: rest => esum rest
/-- Every counter register of the block holds at most M. -/
def UnBd (cnt : Nat -> Nat) (M : Nat) : List Op -> Prop
| [] => True
| .emit _ :: rest => UnBd cnt M rest
| .un R :: rest => cnt R <= M /\ UnBd cnt M rest
theorem cost_le (cnt : Nat -> Nat) (M : Nat) :
forall ops : List Op, UnBd cnt M ops -> cost cnt ops <= esum ops + ops.length * (4 * M + 1 + 1 + (3 * M + 1)) := by
intro ops
induction ops with
| nil => intro _; exact Nat.zero_le _
| cons op rest ih =>
intro h
have hK : forall a, a * (4 * M + 1 + 1 + (3 * M + 1)) <= (a + 1) * (4 * M + 1 + 1 + (3 * M + 1)) :=
fun a => Nat.mul_le_mul (Nat.le_succ a) (Nat.le_refl _)
cases op with
| emit w =>
show w.length + cost cnt rest <= (w.length + esum rest) + (rest.length + 1) * (4 * M + 1 + 1 + (3 * M + 1))
have a : cost cnt rest <= esum rest + (rest.length + 1) * (4 * M + 1 + 1 + (3 * M + 1)) :=
Nat.le_trans (ih h) (Nat.add_le_add_left (hK rest.length) _)
exact Nat.le_trans (Nat.add_le_add_left a w.length) (Nat.le_of_eq (Nat.add_assoc _ _ _).symm)
| un R =>
show (4 * cnt R + 1 + 1 + (3 * cnt R + 1)) + cost cnt rest <=
esum rest + (rest.length + 1) * (4 * M + 1 + 1 + (3 * M + 1))
have k1 : 4 * cnt R <= 4 * M := Nat.mul_le_mul (Nat.le_refl 4) h.1
have k2 : 3 * cnt R <= 3 * M := Nat.mul_le_mul (Nat.le_refl 3) h.1
have k : 4 * cnt R + 1 + 1 + (3 * cnt R + 1) <= 4 * M + 1 + 1 + (3 * M + 1) :=
Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add_right k1 1) 1) (Nat.add_le_add_right k2 1)
have a := Nat.add_le_add (ih h.2) k
have e : esum rest + rest.length * (4 * M + 1 + 1 + (3 * M + 1)) + (4 * M + 1 + 1 + (3 * M + 1)) =
esum rest + (rest.length + 1) * (4 * M + 1 + 1 + (3 * M + 1)) :=
(Nat.add_assoc _ _ _).trans (congrArg (fun z => esum rest + z) (Nat.succ_mul rest.length _).symm)
exact Nat.le_trans (Nat.le_of_eq (Nat.add_comm _ _)) (Nat.le_trans a (Nat.le_of_eq e))
/-- A block whose counter registers all lie in 2..7 (Pnp26) is bounded when those registers are. -/
theorem unBd_of (cnt : Nat -> Nat) (M : Nat) (h : forall R, Found.Pnp26.InR R -> cnt R <= M) :
forall ops, Found.Pnp26.UnIn ops -> UnBd cnt M ops := by
intro ops
induction ops with
| nil => intro _; exact True.intro
| cons op rest ih =>
intro hu
cases op with
| emit w => exact ih hu
| un R => exact And.intro (h R hu.1) (ih hu.2)
end Found.Pnp38
#print axioms Found.Pnp38.len_upd
#print axioms Found.Pnp38.len_step
#print axioms Found.Pnp38.len_run
#print axioms Found.Pnp38.runs_len_le
#print axioms Found.Pnp38.cost_le
#print axioms Found.Pnp38.unBd_of
lean_all/found/Pnp39.lean
/-
T330 piece 39. found/Pnp39 -- the cost of one time round is bounded (CL3b, 20).
Proved:
* a loop whose body costs at most B on every state of an invariant runs in at most
|l| (B + 2) + 1 steps (steps_le_inv);
* the window block body costs at most BB M = esum ops + |ops| (7M + 3) + 3 when the
registers 2..7 hold at most M ones (a machine constant plus a linear term in M);
* the cell loop keeps "register 2 plus each of 5, 6, 7 is at most C" and "3, 4 at most
T'", so its steps are at most m (BB (C + T') + 2) + 1;
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp38
namespace Found.Pnp39
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len app_nil'')
open Found.Pnp24 (Op cost)
open Found.Pnp26 (InR cntOf fB nbB ops unIn_ops)
open Found.Pnp29 (st5 st8 rndCost)
open Found.Pnp38 (esum UnBd cost_le unBd_of)
/-! ## Loops with a bounded body -/
theorem steps_le_inv (c : Nat) (nb : (Nat -> List Bool) -> Nat) (f : (Nat -> List Bool) -> (Nat -> List Bool))
(P : (Nat -> List Bool) -> Prop) (B : Nat)
(hB : forall y b l, P y -> y c = b :: l -> nb (upd y c l) <= B)
(hP : forall y b l, P y -> y c = b :: l -> P (f (upd y c l)))
(hk : forall y, f y c = y c) :
forall (l : List Bool) (x : Nat -> List Bool), x c = l -> P x -> steps c nb f l x <= l.length * (B + 2) + 1 := by
intro l
induction l with
| nil => intro x _ _; show 1 <= 0 * (B + 2) + 1; rw [Nat.zero_mul]; exact Nat.le_refl 1
| cons b l ih =>
intro x hx hPx
show ((1 + nb (upd x c l)) + 1) + steps c nb f l (f (upd x c l)) <= (l.length + 1) * (B + 2) + 1
have h1 : (1 + nb (upd x c l)) + 1 <= B + 2 :=
Nat.le_trans (Nat.add_le_add_right (Nat.add_le_add_left (hB x b l hPx hx) 1) 1)
(Nat.le_of_eq ((Nat.add_right_comm 1 B 1).trans (Nat.add_comm (1 + 1) B)))
have h2 := Nat.add_le_add h1 (ih (f (upd x c l)) ((hk _).trans (upd_same x c l)) (hP x b l hPx hx))
have e : (B + 2) + (l.length * (B + 2) + 1) = (l.length + 1) * (B + 2) + 1 := by
rw [Nat.succ_mul, Nat.add_comm (B + 2), Nat.add_right_comm]
exact Nat.le_trans h2 (Nat.le_of_eq e)
/-! ## The window block body -/
def KK (M : Nat) : Nat := 4 * M + 1 + 1 + (3 * M + 1)
def BB (k : Nat) (delta : List Bool -> Nat -> Bool) (M : Nat) : Nat := esum (ops k delta) + (ops k delta).length * KK M + 3
theorem inr_cases (R : Nat) (h : InR R) :
R = 2 \/ R = 3 \/ R = 4 \/ R = 5 \/ R = 6 \/ R = 7 := by
match R, h with
| 0, h => exact False.elim (Nat.not_succ_le_zero 1 h.1)
| 1, h => exact False.elim (Nat.not_succ_le_self 1 h.1)
| 2, _ => exact Or.inl rfl
| 3, _ => exact Or.inr (Or.inl rfl)
| 4, _ => exact Or.inr (Or.inr (Or.inl rfl))
| 5, _ => exact Or.inr (Or.inr (Or.inr (Or.inl rfl)))
| 6, _ => exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))
| 7, _ => exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr rfl))))
| n + 8, h => exact False.elim (Nat.not_succ_le_self 7 (Nat.le_trans (Nat.succ_le_succ (Nat.le_add_left 7 n)) h.2))
theorem nbB_le (k : Nat) (delta : List Bool -> Nat -> Bool) (M : Nat) (y : Nat -> List Bool)
(h2 : (y 2).length <= M) (h3 : (y 3).length <= M) (h4 : (y 4).length <= M)
(h5 : (y 5).length <= M) (h6 : (y 6).length <= M) (h7 : (y 7).length <= M) :
nbB k delta y <= BB k delta M := by
have hu : UnBd (cntOf y) M (ops k delta) := unBd_of (cntOf y) M (fun R hR => by
cases inr_cases R hR with
| inl e => rw [e]; exact h2
| inr e => cases e with
| inl e => rw [e]; exact h3
| inr e => cases e with
| inl e => rw [e]; exact h4
| inr e => cases e with
| inl e => rw [e]; exact h5
| inr e => cases e with
| inl e => rw [e]; exact h6
| inr e => rw [e]; exact h7) (ops k delta) (unIn_ops k delta)
exact Nat.add_le_add_right (cost_le (cntOf y) M (ops k delta) hu) 3
/-! ## The cell loop -/
/-- The cell loop invariant: the counter plus each of 5, 6, 7 is at most C; 3, 4 at most T'. -/
def J (C T' : Nat) (y : Nat -> List Bool) : Prop :=
(y 2).length + (y 5).length <= C /\ (y 2).length + (y 6).length <= C /\ (y 2).length + (y 7).length <= C /\
(y 3).length <= T' /\ (y 4).length <= T'
theorem jsteps_le (k : Nat) (delta : List Bool -> Nat -> Bool) (C T' : Nat) :
forall (m : Nat) (y : Nat -> List Bool), y 2 = tr m -> J C T' y ->
steps 2 (nbB k delta) (fB k delta) (tr m) y <= m * (BB k delta (C + T') + 2) + 1 := by
intro m y hy hJ
have L := steps_le_inv 2 (nbB k delta) (fB k delta) (J C T') (BB k delta (C + T'))
(fun z b l hz hz2 => by
have a2 : l.length + 1 = (z 2).length := (congrArg List.length hz2).symm
have b2 : l.length <= C + T' := Nat.le_trans (Nat.le_succ _) (Nat.le_trans (Nat.le_of_eq a2)
(Nat.le_trans (Nat.le_add_right _ _) (Nat.le_trans hz.1 (Nat.le_add_right C T'))))
have b5 : (z 5).length <= C + T' := Nat.le_trans (Nat.le_add_left _ _) (Nat.le_trans hz.1 (Nat.le_add_right C T'))
have b6 : (z 6).length <= C + T' := Nat.le_trans (Nat.le_add_left _ _) (Nat.le_trans hz.2.1 (Nat.le_add_right C T'))
have b7 : (z 7).length <= C + T' := Nat.le_trans (Nat.le_add_left _ _) (Nat.le_trans hz.2.2.1 (Nat.le_add_right C T'))
have b3 : (z 3).length <= C + T' := Nat.le_trans hz.2.2.2.1 (Nat.le_add_left T' C)
have b4 : (z 4).length <= C + T' := Nat.le_trans hz.2.2.2.2 (Nat.le_add_left T' C)
exact nbB_le k delta (C + T') (upd z 2 l) b2 b3 b4 b5 b6 b7)
(fun z b l hz hz2 => by
have a2 : l.length + 1 = (z 2).length := (congrArg List.length hz2).symm
have q : forall R, (l.length + 1) + (z R).length <= C -> (fB k delta (upd z 2 l) 2).length + ((z R).length + 1) <= C :=
fun R h => Nat.le_trans (Nat.le_of_eq ((Nat.add_assoc _ _ _).symm.trans (Nat.add_right_comm _ _ _))) h
refine And.intro (q 5 ?_) (And.intro (q 6 ?_) (And.intro (q 7 ?_) (And.intro hz.2.2.2.1 hz.2.2.2.2)))
· rw [a2]; exact hz.1
· rw [a2]; exact hz.2.1
· rw [a2]; exact hz.2.2.1)
(fun _ => rfl) (tr m) y hy hJ
rw [tr_len] at L
exact L
end Found.Pnp39
#print axioms Found.Pnp39.steps_le_inv
#print axioms Found.Pnp39.inr_cases
#print axioms Found.Pnp39.nbB_le
#print axioms Found.Pnp39.jsteps_le
lean_all/found/Pnp4.lean
/-
T330 piece 4. found/Pnp4 -- NP-hardness over the machine model with output.
Tool results (they relativize; PNP_MAP.md):
* NP over OM: a polynomial-time verifier and polynomially long certificates;
* NP-hardness is inherited along reductions;
* an NP-hard language in P gives P = NP (every NP language is in P);
* contrapositive: if some NP language is outside P, no NP-hard language is in P.
With Cook-Levin (open lemma O3) this makes "P = NP iff SAT is in P".
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp3
namespace Found.Pnp4
open Found.Pnp3
variable (M : OM)
/-- Pairing of an input and a certificate: each input bit b is written as (false, b), then
the separator (true, true), then the certificate. -/
def dbl : List Bool -> List Bool
| [] => []
| b :: l => false :: b :: dbl l
def enc (x w : List Bool) : List Bool := dbl x ++ (true :: true :: w)
/-- L is in NP over M: a polynomial-time verifier V on encoded pairs, and L x holds
exactly when some certificate of polynomial length is accepted. -/
def InNPo (L : List Bool -> Bool) : Prop :=
Exists fun V : List Bool -> Bool => Exists fun b : PE =>
InPo M V /\
forall x, L x = true <-> Exists fun w : List Bool => w.length <= pe b x.length /\ V (enc x w) = true
/-- L is NP-hard: every NP language reduces to it. -/
def Hard (L : List Bool -> Bool) : Prop :=
forall L' : List Bool -> Bool, InNPo M L' -> Red M L' L
theorem hard_trans (L L2 : List Bool -> Bool) (h : Hard M L) (r : Red M L L2) : Hard M L2 :=
fun L' hL' => red_trans M L' L L2 (h L' hL') r
/-- An NP-hard language in P gives P = NP. -/
theorem hard_in_P (L : List Bool -> Bool) (h : Hard M L) (hP : InPo M L) :
forall L' : List Bool -> Bool, InNPo M L' -> InPo M L' :=
fun L' hL' => red_P M L' L (h L' hL') hP
/-- If some NP language is outside P, no NP-hard language is in P. -/
theorem sep_hard (L : List Bool -> Bool) (h : Hard M L)
(sep : Exists fun L' : List Bool -> Bool => InNPo M L' /\ (InPo M L' -> False)) :
InPo M L -> False :=
fun hP => Exists.elim sep fun L' hL' => hL'.2 (hard_in_P M L h hP L' hL'.1)
/-- Two NP-hard languages in NP reduce to each other; P-membership of one is that of the
other. -/
theorem hard_equiv (L1 L2 : List Bool -> Bool) (h1 : Hard M L1) (h2 : Hard M L2)
(n1 : InNPo M L1) (n2 : InNPo M L2) : (InPo M L1 -> InPo M L2) /\ (InPo M L2 -> InPo M L1) :=
And.intro (fun hP => red_P M L2 L1 (h1 L2 n2) hP) (fun hP => red_P M L1 L2 (h2 L1 n1) hP)
end Found.Pnp4
#print axioms Found.Pnp4.hard_trans
#print axioms Found.Pnp4.hard_in_P
#print axioms Found.Pnp4.sep_hard
#print axioms Found.Pnp4.hard_equiv
lean_all/found/Pnp40.lean
/-
T330 piece 40. found/Pnp40 -- the time loop runs in polynomially many steps (CL3b, 21).
Proved:
* after one time round, registers 5, 6, 7 hold W - 1, W, W + 1 ones (rnd_regs);
* one time round from a state with 2 empty, 3 = t, 4 = t + 1, t + 1 <= T and
5, 6, 7 at most C0 ones costs at most RB, an explicit sum of terms linear in W, T,
C0 and of W' (BB (W' + 2 + T) + 2), where BB is the window block bound (Pnp39);
* the time loop over T rounds from t = 0 (5, 6, 7 at most W' + 2 ones) runs in at
most T (RB + 2) + 1 steps.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp39
namespace Found.Pnp40
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len app_nil'')
open Found.Pnp26 (fB nbB)
open Found.Pnp29 (st5 st8 rndCost rndF rndF_keep)
open Found.Pnp39 (BB J steps_le_inv nbB_le jsteps_le)
theorem h82 (k : Nat) (delta : List Bool -> Nat -> Bool) (W' : Nat) (x : Nat -> List Bool) (h2 : x 2 = []) :
st8 k delta W' x 2 = tr W' := by
show tr W' ++ x 2 = tr W'
rw [h2, app_nil'']
theorem rnd_regs (k : Nat) (delta : List Bool -> Nat -> Bool) (W' t : Nat) (x : Nat -> List Bool)
(h2 : x 2 = []) (h3 : x 3 = tr t) (h4 : x 4 = tr (t + 1)) :
(rndF k delta W' x 5).length = W' /\ (rndF k delta W' x 6).length = W' + 1 /\ (rndF k delta W' x 7).length = W' + 2 := by
have sp := Found.Pnp26.iter_spec k delta (W' + 1) t W' 0 (st8 k delta W' x) (h82 k delta W' x h2) h3 h4 rfl rfl rfl
refine And.intro ?_ (And.intro ?_ ?_)
· show (iter 2 (fB k delta) (tr W') (st8 k delta W' x) 5).length = W'
rw [sp.2.1, tr_len, Nat.zero_add]
· show (iter 2 (fB k delta) (tr W') (st8 k delta W' x) 6).length = W' + 1
rw [sp.2.2.1, tr_len, Nat.zero_add, Nat.add_comm 1 W']
· show (iter 2 (fB k delta) (tr W') (st8 k delta W' x) 7).length = W' + 2
rw [sp.2.2.2.1, tr_len, Nat.zero_add, Nat.add_comm 2 W']
/-- The bound of one round. -/
def RB (k : Nat) (delta : List Bool -> Nat -> Bool) (W' T' C0 : Nat) : Nat :=
2 * C0 + 1 + (2 * C0 + 1) + (2 * C0 + 1) + (4 * (W' + 1) + 1 + (3 * (W' + 1) + 1)) + 1 +
BB k delta (W' + 2 + T') + (2 * (W' + 2) + 1) + (4 * W' + 1 + (3 * W' + 1)) +
(W' * (BB k delta (W' + 2 + T') + 2) + 1) + 2
theorem one_le (a b : Nat) : 1 <= a + 1 + b := Nat.le_trans (Nat.succ_le_succ (Nat.zero_le a)) (Nat.le_add_right _ _)
theorem rnd_le (k : Nat) (delta : List Bool -> Nat -> Bool) (W' T' C0 t : Nat) (x : Nat -> List Bool)
(h2 : x 2 = []) (h3 : x 3 = tr t) (h4 : x 4 = tr (t + 1)) (ht : t + 1 <= T')
(h5 : (x 5).length <= C0) (h6 : (x 6).length <= C0) (h7 : (x 7).length <= C0) :
rndCost k delta W' x <= RB k delta W' T' C0 := by
have tT : t <= T' := Nat.le_trans (Nat.le_succ t) ht
have M3 : T' <= W' + 2 + T' := Nat.le_add_left T' (W' + 2)
have t1 := Nat.add_le_add_right (Nat.mul_le_mul (Nat.le_refl 2) h5) 1
have t2 := Nat.add_le_add_right (Nat.mul_le_mul (Nat.le_refl 2) h6) 1
have t3 := Nat.add_le_add_right (Nat.mul_le_mul (Nat.le_refl 2) h7) 1
have t6 : nbB k delta (st5 W' x) <= BB k delta (W' + 2 + T') := by
apply nbB_le
· show (x 2).length <= _
rw [h2]; exact Nat.zero_le _
· show (x 3).length <= _
rw [h3, tr_len]; exact Nat.le_trans tT M3
· show (x 4).length <= _
rw [h4, tr_len]; exact Nat.le_trans ht M3
· show (tr (W' + 1) ++ []).length <= _
rw [app_nil'', tr_len]; exact Nat.le_trans (Nat.le_succ (W' + 1)) (Nat.le_add_right _ _)
· exact Nat.zero_le _
· exact one_le (W' + 1) T'
have t7 : 2 * (fB k delta (st5 W' x) 5).length + 1 <= 2 * (W' + 2) + 1 := Nat.le_of_eq (by
show 2 * (tr (W' + 2) ++ []).length + 1 = 2 * (W' + 2) + 1
rw [app_nil'', tr_len])
have e8 : (tr W' ++ x 2).length = W' := by rw [h2, app_nil'', tr_len]
have hJ : J (W' + 2) T' (st8 k delta W' x) := by
refine And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ ?_)))
· show (tr W' ++ x 2).length + 0 <= W' + 2
exact Nat.le_trans (Nat.le_of_eq (congrArg (fun z => z + 0) e8)) (Nat.le_add_right W' 2)
· show (tr W' ++ x 2).length + 1 <= W' + 2
exact Nat.le_trans (Nat.le_of_eq (congrArg (fun z => z + 1) e8)) (Nat.le_succ (W' + 1))
· show (tr W' ++ x 2).length + 2 <= W' + 2
exact Nat.le_of_eq (congrArg (fun z => z + 2) e8)
· show (x 3).length <= T'
rw [h3, tr_len]; exact tT
· show (x 4).length <= T'
rw [h4, tr_len]; exact ht
have t9 := jsteps_le k delta (W' + 2) T' W' (st8 k delta W' x) (h82 k delta W' x h2) hJ
have a3 := Nat.add_le_add (Nat.add_le_add t1 t2) t3
have a5 := Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add_right a3 (4 * (W' + 1) + 1 + (3 * (W' + 1) + 1))) 1) t6
have a8 := Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add a5 t7) (4 * W' + 1 + (3 * W' + 1))) t9
exact Nat.add_le_add_right a8 2
/-- The time loop invariant used for the step bound. -/
def PT (W' T : Nat) (y : Nat -> List Bool) : Prop :=
y 1 = [] /\ y 2 = [] /\ (Exists fun t => y 3 = tr t /\ y 4 = tr (t + 1) /\ t + (y 11).length <= T) /\
(y 5).length <= W' + 2 /\ (y 6).length <= W' + 2 /\ (y 7).length <= W' + 2
theorem tloop_steps_le (k : Nat) (delta : List Bool -> Nat -> Bool) (W' T : Nat) (x : Nat -> List Bool)
(hx : PT W' T x) (h11 : x 11 = tr T) :
steps 11 (rndCost k delta W') (rndF k delta W') (tr T) x <= T * (RB k delta W' T (W' + 2) + 2) + 1 := by
have L := steps_le_inv 11 (rndCost k delta W') (rndF k delta W') (PT W' T) (RB k delta W' T (W' + 2))
(fun y b l hy hy11 => Exists.elim hy.2.2.1 fun t ht => by
have e : t + (l.length + 1) <= T := by
have q := ht.2.2
rw [hy11] at q
exact q
have ht1 : t + 1 <= T := Nat.le_trans (Nat.add_le_add_left (Nat.le_add_left 1 l.length) t) e
exact rnd_le k delta W' T (W' + 2) t (upd y 11 l) hy.2.1 ht.1 ht.2.1 ht1 hy.2.2.2.1 hy.2.2.2.2.1 hy.2.2.2.2.2)
(fun y b l hy hy11 => Exists.elim hy.2.2.1 fun t ht => by
have e : t + (l.length + 1) <= T := by
have q := ht.2.2
rw [hy11] at q
exact q
have r := Found.Pnp30.rnd_facts k delta W' t (upd y 11 l) hy.1 hy.2.1 ht.1 ht.2.1
have g := rnd_regs k delta W' t (upd y 11 l) hy.2.1 ht.1 ht.2.1
have k11 : rndF k delta W' (upd y 11 l) 11 = l := (rndF_keep k delta W' _ 11 (Nat.le_of_ble_eq_true rfl)).trans (upd_same y 11 l)
refine And.intro r.2.1 (And.intro r.2.2.1 (And.intro (Exists.intro (t + 1) (And.intro r.2.2.2.1 (And.intro r.2.2.2.2 ?_)))
(And.intro ?_ (And.intro ?_ ?_))))
· rw [k11]
exact Nat.le_trans (Nat.le_of_eq (Nat.add_right_comm t 1 l.length)) e
· rw [g.1]; exact Nat.le_add_right W' 2
· rw [g.2.1]; exact Nat.le_succ (W' + 1)
· exact Nat.le_of_eq g.2.2)
(fun y => rndF_keep k delta W' y 11 (Nat.le_of_ble_eq_true rfl)) (tr T) x h11 hx
rw [tr_len] at L
exact L
end Found.Pnp40
#print axioms Found.Pnp40.h82
#print axioms Found.Pnp40.rnd_regs
#print axioms Found.Pnp40.one_le
#print axioms Found.Pnp40.rnd_le
#print axioms Found.Pnp40.tloop_steps_le
lean_all/found/Pnp41.lean
/-
T330 piece 41. found/Pnp41 -- step bounds of the boundary, layout and input loops (CL3b, 22).
Proved:
* a block bound for a concatenation is the pair of bounds (unBd_app);
* the boundary loop from t = 0 over T + 1 rounds, with W in register 9, runs in at most
(T + 1) (Bb + 2) + 1 steps, Bb = esum (bdOps 3 9 k) + |bdOps 3 9 k| KK (W + T) + 1;
* the layout pin loop over r cells from cell a runs in at most r (Bc + 2) + 1 steps,
Bc = esum (fcOps m) + |fcOps m| KK (a + r) + 1, and leaves a + r ones in register 14;
* the branching input loop over the input l from cell s runs in at most
|l| (Bp + 2) + 1 steps, Bp = 6 + 3 KK (s + |l|) + 1.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp40
namespace Found.Pnp41
open Found.Pnp20
open Found.Pnp21
open Found.Pnp22 (steps iter)
open Found.Pnp23 (tr tr_len)
open Found.Pnp24 (Op cost)
open Found.Pnp26 (cntOf)
open Found.Pnp31 (bdOps uOps fb nbb)
open Found.Pnp32 (steps2 pOps fp nbp)
open Found.Pnp33 (fcOps uo fcF nbc)
open Found.Pnp38 (esum UnBd cost_le)
open Found.Pnp39 (KK steps_le_inv)
theorem unBd_app (cnt : Nat -> Nat) (M : Nat) :
forall (A B : List Op), UnBd cnt M A -> UnBd cnt M B -> UnBd cnt M (A ++ B) := by
intro A
induction A with
| nil => intro B _ hB; exact hB
| cons op A ih =>
intro B hA hB
cases op with
| emit w => exact ih B hA hB
| un R => exact And.intro hA.1 (ih B hA.2 hB)
theorem le_of_add_le_l (a b c : Nat) (h : a + b <= c) : a <= c := Nat.le_trans (Nat.le_add_right a b) h
theorem le_of_add_le_r (a b c : Nat) (h : a + b <= c) : b <= c := Nat.le_trans (Nat.le_add_left b a) h
/-- From "a + (l + 1) <= C" (a counter entry) to "a <= C" and its successor form. -/
theorem shift_le (a L C : Nat) (h : a + (L + 1) <= C) : (a + 1) + L <= C :=
Nat.le_trans (Nat.le_of_eq (Nat.add_right_comm a 1 L)) h
/-! ## The boundary loop -/
theorem unBd_bd (cnt : Nat -> Nat) (M : Nat) (h3 : cnt 3 <= M) (h9 : cnt 9 <= M) :
forall n, UnBd cnt M (bdOps 3 9 n) := by
intro n
induction n with
| zero => exact True.intro
| succ n ih => exact unBd_app cnt M _ _ ih (And.intro h3 (And.intro h9 True.intro))
def Bb (k W T : Nat) : Nat := esum (bdOps 3 9 k) + (bdOps 3 9 k).length * KK (W + T) + 1
def PB (W T : Nat) (y : Nat -> List Bool) : Prop := (y 3).length + (y 12).length <= T + 1 /\ y 9 = tr W
theorem bloop_steps_le (k W T : Nat) (x : Nat -> List Bool) (hx : PB W T x) (h12 : x 12 = tr (T + 1)) :
steps 12 (nbb k) (fb k) (tr (T + 1)) x <= (T + 1) * (Bb k W T + 2) + 1 := by
have L := steps_le_inv 12 (nbb k) (fb k) (PB W T) (Bb k W T)
(fun y b l hy hy12 => by
have e : (y 3).length + (l.length + 1) <= T + 1 := by
have q := hy.1
rw [hy12] at q
exact q
have h3 : (y 3).length <= W + T :=
Nat.le_trans (Nat.le_of_succ_le_succ (Nat.le_trans (Nat.add_le_add_left (Nat.le_add_left 1 l.length) _) e))
(Nat.le_add_left T W)
have h9 : cntOf (upd y 12 l) 9 <= W + T := by
show (y 9).length <= W + T
rw [hy.2, tr_len]; exact Nat.le_add_right W T
exact Nat.add_le_add_right (cost_le (cntOf (upd y 12 l)) (W + T) _ (unBd_bd _ _ h3 h9 k)) 1)
(fun y b l hy hy12 => by
have e : (y 3).length + (l.length + 1) <= T + 1 := by
have q := hy.1
rw [hy12] at q
exact q
exact And.intro (shift_le _ _ _ e) hy.2)
(fun y => Found.Pnp31.fb_keep k y 12 rfl rfl) (tr (T + 1)) x h12 hx
rw [tr_len] at L
exact L
/-! ## The layout pin loop -/
theorem unBd_fc (cnt : Nat -> Nat) (M : Nat) (h : cnt 14 <= M) : forall i, UnBd cnt M (fcOps i) := by
intro i
induction i with
| zero => exact And.intro h True.intro
| succ i ih => exact unBd_app cnt M _ _ ih (And.intro h True.intro)
def Bc (m a r : Nat) : Nat := esum (fcOps m) + (fcOps m).length * KK (a + r) + 1
def PC (a r : Nat) (y : Nat -> List Bool) : Prop := (y 14).length + (y 12).length <= a + r
theorem cloop_steps_le (m a r : Nat) (x : Nat -> List Bool) (hx : PC a r x) (h12 : x 12 = tr r) :
steps 12 (nbc m) (fcF m) (tr r) x <= r * (Bc m a r + 2) + 1 := by
have L := steps_le_inv 12 (nbc m) (fcF m) (PC a r) (Bc m a r)
(fun y b l hy hy12 => by
have e : (y 14).length + (l.length + 1) <= a + r := by
have q := hy
unfold PC at q
rw [hy12] at q
exact q
have h14 : cntOf (upd y 12 l) 14 <= a + r := le_of_add_le_l _ _ _ e
exact Nat.add_le_add_right (cost_le (cntOf (upd y 12 l)) (a + r) _ (unBd_fc _ _ h14 m)) 1)
(fun y b l hy hy12 => by
have e : (y 14).length + (l.length + 1) <= a + r := by
have q := hy
unfold PC at q
rw [hy12] at q
exact q
exact shift_le _ _ _ e)
(fun y => Found.Pnp33.fcF_keep m y 12 rfl rfl) (tr r) x h12 hx
rw [tr_len] at L
exact L
theorem cIter_14 (m : Nat) : forall r a (x : Nat -> List Bool), x 14 = tr a -> iter 12 (fcF m) (tr r) x 14 = tr (a + r) := by
intro r
induction r with
| zero => intro a x h; exact h
| succ r ih =>
intro a x h
show iter 12 (fcF m) (tr r) (fcF m (upd x 12 (tr r))) 14 = tr (a + (r + 1))
rw [ih (a + 1) _ (congrArg (fun l => true :: l) h), Nat.add_right_comm a 1 r]
rfl
/-! ## The input loop -/
theorem steps2_le_inv (c : Nat) (nb : Bool -> (Nat -> List Bool) -> Nat) (f : Bool -> (Nat -> List Bool) -> (Nat -> List Bool))
(P : (Nat -> List Bool) -> Prop) (B : Nat)
(hB : forall y b l, P y -> y c = b :: l -> nb b (upd y c l) <= B)
(hP : forall y b l, P y -> y c = b :: l -> P (f b (upd y c l)))
(hk : forall b y, f b y c = y c) :
forall (l : List Bool) (x : Nat -> List Bool), x c = l -> P x -> steps2 c nb f l x <= l.length * (B + 2) + 1 := by
intro l
induction l with
| nil => intro x _ _; show 1 <= 0 * (B + 2) + 1; rw [Nat.zero_mul]; exact Nat.le_refl 1
| cons b l ih =>
intro x hx hPx
show ((1 + nb b (upd x c l)) + 1) + steps2 c nb f l (f b (upd x c l)) <= (l.length + 1) * (B + 2) + 1
have h1 : (1 + nb b (upd x c l)) + 1 <= B + 2 :=
Nat.le_trans (Nat.add_le_add_right (Nat.add_le_add_left (hB x b l hPx hx) 1) 1)
(Nat.le_of_eq ((Nat.add_right_comm 1 B 1).trans (Nat.add_comm (1 + 1) B)))
have hc : f b (upd x c l) c = l := (hk b _).trans (upd_same x c l)
have h2 := Nat.add_le_add h1 (ih (f b (upd x c l)) hc (hP x b l hPx hx))
have e : (B + 2) + (l.length * (B + 2) + 1) = (l.length + 1) * (B + 2) + 1 := by
rw [Nat.succ_mul, Nat.add_comm (B + 2), Nat.add_right_comm]
exact Nat.le_trans h2 (Nat.le_of_eq e)
def Bp (s L : Nat) : Nat := 6 + 3 * KK (s + L) + 1
def PI (s L : Nat) (y : Nat -> List Bool) : Prop := (y 14).length + (y 13).length <= s + L
theorem inLoop_steps_le (s : Nat) (l : List Bool) (x : Nat -> List Bool) (hx : PI s l.length x) (h13 : x 13 = l) :
steps2 13 nbp fp l x <= l.length * (Bp s l.length + 2) + 1 :=
steps2_le_inv 13 nbp fp (PI s l.length) (Bp s l.length)
(fun y b l' hy hy13 => by
have e : (y 14).length + (l'.length + 1) <= s + l.length := by
have q := hy
unfold PI at q
rw [hy13] at q
exact q
have h14 : cntOf (upd y 13 l') 14 <= s + l.length := le_of_add_le_l _ _ _ e
exact Nat.add_le_add_right (cost_le (cntOf (upd y 13 l')) (s + l.length) (pOps b) (And.intro h14 True.intro)) 1)
(fun y b l' hy hy13 => by
have e : (y 14).length + (l'.length + 1) <= s + l.length := by
have q := hy
unfold PI at q
rw [hy13] at q
exact q
exact shift_le _ _ _ e)
(fun b y => Found.Pnp32.fp_keep b y 13 rfl rfl) l x h13 hx
end Found.Pnp41
#print axioms Found.Pnp41.unBd_app
#print axioms Found.Pnp41.le_of_add_le_l
#print axioms Found.Pnp41.le_of_add_le_r
#print axioms Found.Pnp41.shift_le
#print axioms Found.Pnp41.unBd_bd
#print axioms Found.Pnp41.bloop_steps_le
#print axioms Found.Pnp41.unBd_fc
#print axioms Found.Pnp41.cloop_steps_le
#print axioms Found.Pnp41.cIter_14
#print axioms Found.Pnp41.steps2_le_inv
#print axioms Found.Pnp41.inLoop_steps_le
lean_all/found/Pnp42.lean
/-
T330 piece 42. found/Pnp42 -- the reduction program runs in polynomial time (CL3b, 23).
Every step bound of Pnp35-Pnp41 is written again as a polynomial expression (Pnp3.PE)
in the input length, with the machine and the layout as constants: ecP e for the
evaluator cost, KKp, BBp, RBp, Bbp, Bcp, Bpp, WBp, and redPE for the whole program.
Proved: pe (ecP e) n = ecost e n, pe (redPE ...) n = redB ... n, so the register program
RED computes x -> enc (red M W T p0 q0 (inpOf s x)) (Pnp18) in at most pe redPE |x| steps:
CL3b, polynomial time on the register machine, for W = p0 + 1 + R(|x|) + 1 and
T = T(|x|) with R, T polynomials.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp37
namespace Found.Pnp42
open Found.Pnp3 (PE pe)
open Found.Pnp12 (TM rule)
open Found.Pnp19 (encCNF)
open Found.Pnp20
open Found.Pnp21
open Found.Pnp32 (inpOf)
open Found.Pnp36 (ecost)
open Found.Pnp37 (eW redB redP redP_tm)
def a (p q : PE) : PE := .add p q
def mu (p q : PE) : PE := .mul p q
def k_ (c : Nat) : PE := .c c
/-! ## The evaluator cost -/
def ecP : PE -> PE
| .x => a (a (mu (k_ 4) .x) (k_ 1)) (a (mu (k_ 3) .x) (k_ 1))
| .c c => .c c
| .add p q => a (ecP p) (ecP q)
| .mul p q => a (ecP p) (a (mu p (a (ecP q) (k_ 2))) (k_ 1))
theorem ecP_pe (n : Nat) : forall e : PE, pe (ecP e) n = ecost e n := by
intro e
induction e with
| x => rfl
| c c => rfl
| add p q ihp ihq =>
show pe (ecP p) n + pe (ecP q) n = ecost p n + ecost q n
rw [ihp, ihq]
| mul p q ihp ihq =>
show pe (ecP p) n + (pe p n * (pe (ecP q) n + 2) + 1) = ecost p n + (pe p n * (ecost q n + 2) + 1)
rw [ihp, ihq]
/-! ## The bounds as polynomials -/
def KKp (M : PE) : PE := a (a (a (mu (k_ 4) M) (k_ 1)) (k_ 1)) (a (mu (k_ 3) M) (k_ 1))
def BBp (k : Nat) (delta : List Bool -> Nat -> Bool) (M : PE) : PE :=
a (a (k_ (Found.Pnp38.esum (Found.Pnp26.ops k delta))) (mu (k_ (Found.Pnp26.ops k delta).length) (KKp M))) (k_ 3)
def RBp (k : Nat) (delta : List Bool -> Nat -> Bool) (W' T' C0 : PE) : PE :=
a (a (a (a (a (a (a (a (a (a (mu (k_ 2) C0) (k_ 1)) (a (mu (k_ 2) C0) (k_ 1))) (a (mu (k_ 2) C0) (k_ 1)))
(a (a (mu (k_ 4) (a W' (k_ 1))) (k_ 1)) (a (mu (k_ 3) (a W' (k_ 1))) (k_ 1)))) (k_ 1))
(BBp k delta (a (a W' (k_ 2)) T'))) (a (mu (k_ 2) (a W' (k_ 2))) (k_ 1)))
(a (a (mu (k_ 4) W') (k_ 1)) (a (mu (k_ 3) W') (k_ 1))))
(a (mu W' (a (BBp k delta (a (a W' (k_ 2)) T')) (k_ 2))) (k_ 1))) (k_ 2)
def Bbp (k : Nat) (W T : PE) : PE :=
a (a (k_ (Found.Pnp38.esum (Found.Pnp31.bdOps 3 9 k))) (mu (k_ (Found.Pnp31.bdOps 3 9 k).length) (KKp (a W T)))) (k_ 1)
def Bcp (m : Nat) (A R : PE) : PE :=
a (a (k_ (Found.Pnp38.esum (Found.Pnp33.fcOps m))) (mu (k_ (Found.Pnp33.fcOps m).length) (KKp (a A R)))) (k_ 1)
def Bpp (S L : PE) : PE := a (a (k_ 6) (mu (k_ 3) (KKp (a S L)))) (k_ 1)
def WBp (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) (r T L : PE) : PE :=
a (a (mu T (a (RBp k delta (a (k_ pos0) r) T (a (a (k_ pos0) r) (k_ 2))) (k_ 2))) (k_ 1))
(a (a (a (mu (k_ 4) T) (k_ 1)) (a (mu (k_ 3) T) (k_ 1)))
(a (a (a (mu (k_ 4) (a T (k_ 1))) (k_ 1)) (a (mu (k_ 3) (a T (k_ 1))) (k_ 1)))
(a (a (mu (k_ 2) T) (k_ 1))
(a (a (mu (a T (k_ 1)) (a (Bbp k (a (a (k_ pos0) r) (k_ 1)) T) (k_ 2))) (k_ 1))
(a (a (k_ (Found.Pnp38.esum (Found.Pnp33.accOps 15))) (mu (k_ (Found.Pnp33.accOps 15).length) (KKp T)))
(a (a (k_ (Found.Pnp35.hw m pos0 q0).length) (k_ 0))
(a (a (k_ pos0) (k_ 1))
(a (a (a (mu (k_ 4) (a (k_ pos0) r)) (k_ 1)) (a (mu (k_ 3) (a (k_ pos0) r)) (k_ 1)))
(a (k_ pos0)
(a (a (mu r (a (Bcp m (a (k_ pos0) (k_ 1)) r) (k_ 2))) (k_ 1))
(a (a (mu (k_ 2) (a (a (k_ pos0) (k_ 1)) r)) (k_ 1))
(a (k_ s)
(a (a (mu L (a (Bpp (k_ s) L) (k_ 2))) (k_ 1)) (k_ 1))))))))))))))
theorem WBp_pe (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) (r T L : PE) (n : Nat) :
pe (WBp k delta m pos0 q0 s r T L) n = Found.Pnp35.WB k delta m pos0 q0 s (pe r n) (pe T n) (pe L n) := rfl
/-- The step bound of RED as a polynomial of the input length. -/
def redPE (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) : PE :=
a (a (mu (k_ 4) .x) (k_ 1)) (a (a (mu (k_ 3) .x) (k_ 1)) (a (ecP (eW pos0 eR))
(a (a (a (mu (k_ 4) (a (a (k_ pos0) eR) (k_ 1))) (k_ 1)) (a (mu (k_ 3) (a (a (k_ pos0) eR) (k_ 1))) (k_ 1)))
(a (k_ 1) (a (ecP eT) (a (k_ 1) (a (WBp k delta m pos0 q0 s eR eT .x)
(a (mu (k_ 3) (WBp k delta m pos0 q0 s eR eT .x)) (k_ 1)))))))))
theorem redPE_pe (k : Nat) (delta : List Bool -> Nat -> Bool) (m pos0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) (n : Nat) :
pe (redPE k delta m pos0 q0 s eR eT) n = redB k delta m pos0 q0 s eR eT n := by
show (4 * n + 1) + ((3 * n + 1) + (pe (ecP (eW pos0 eR)) n + ((4 * (pos0 + pe eR n + 1) + 1 + (3 * (pos0 + pe eR n + 1) + 1)) +
(1 + (pe (ecP eT) n + (1 + (Found.Pnp35.WB k delta m pos0 q0 s (pe eR n) (pe eT n) n +
(3 * Found.Pnp35.WB k delta m pos0 q0 s (pe eR n) (pe eT n) n + 1)))))))) = _
rw [ecP_pe, ecP_pe]
rfl
/-- CL3b: the reduction map is computed by one register program in polynomially many steps. -/
theorem cl3b (prog : List Ins) (o : Nat) (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE)
(hf : Frag prog o (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)) (l : List Bool) (x : Nat -> List Bool)
(h13 : x 13 = l) (hx : forall i, Nat.beq i 13 = false -> x i = []) :
Exists fun N => Exists fun y => Runs prog N o x (o + (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length) y /\
y 16 = encCNF (Found.Pnp18.red M (p0 + 1 + pe eR l.length + 1) (pe eT l.length) p0 q0 (inpOf s l)) /\
N <= pe (redPE (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) l.length := by
have h := redP_tm prog o M p0 q0 s eR eT hf l x h13 hx
rw [redPE_pe]
exact h
end Found.Pnp42
#print axioms Found.Pnp42.ecP_pe
#print axioms Found.Pnp42.WBp_pe
#print axioms Found.Pnp42.redPE_pe
#print axioms Found.Pnp42.cl3b
lean_all/found/Pnp43.lean
/-
T330 piece 43. found/Pnp43 -- a multi-track Turing machine as a local machine (CL3c, 1).
CL3c simulates the register machine (Pnp20) by a Turing machine. Registers are easiest
on separate tracks, so the one-bit tape of Pnp12 is widened: a tape cell holds k + 1
bits (tracks 0..k), states are bit lists of length m, and from state q reading the
symbol s (the k + 1 bits of the head cell) the machine moves to next q s, writes
write q s and moves right iff right q s. A configuration is laid out on cells of
K = m + 2 + k bits in the shape of Pnp12, so that the pins and the reduction program of
Pnp14-Pnp42 apply unchanged: bit 0 track 0, bit 1 "the head is here", bits 2..m + 1 the
state where the head is (false elsewhere), bits m + 2 + i track i + 1. (k = 0 is the
machine of Pnp12.) Proved: one step of the width-W local machine (Pnp10) with the rule
below, on the layout of a configuration, is the layout of the next configuration at
every cell j <= W and bit b < K, when the head is at a cell p + 1 with p + 2 < W, the
boundary cell W holds false and the state has m bits.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp12
namespace Found.Pnp43
open Found.Pnp1 (read)
open Found.Pnp7 (nthd read_nthd length_read)
open Found.Pnp9 (leftIdx)
open Found.Pnp10 (Conf nbC stepW gate read_ext_k beq_refl)
open Found.Pnp12 (sel selN accL accC accR head_eq head_eq2 beqW and_assoc3)
structure TMk where
m : Nat
k : Nat
next : List Bool -> List Bool -> List Bool
write : List Bool -> List Bool -> List Bool
right : List Bool -> List Bool -> Bool
/-- Tapes: cell j, bit i. -/
abbrev Tape := Nat -> Nat -> Bool
/-- pick m i f g: f i for i < m, g (i - m) otherwise (structural in m). -/
def pick : Nat -> Nat -> (Nat -> Bool) -> (Nat -> Bool) -> Bool
| 0, i, _, g => g i
| _ + 1, 0, f, _ => f 0
| m + 1, i + 1, f, g => pick m i (fun j => f (j + 1)) g
theorem pick_lo : forall m i (f g : Nat -> Bool), i < m -> pick m i f g = f i := by
intro m
induction m with
| zero => intro i f g h; exact False.elim (Nat.not_lt_zero i h)
| succ m ih =>
intro i f g h
cases i with
| zero => rfl
| succ i => exact ih i (fun j => f (j + 1)) g (Nat.lt_of_succ_lt_succ h)
theorem pick_hi : forall m i (f g : Nat -> Bool), pick m (m + i) f g = g i := by
intro m
induction m with
| zero => intro i f g; show g (0 + i) = g i; rw [Nat.zero_add]
| succ m ih =>
intro i f g
show pick (m + 1) (m + 1 + i) f g = g i
rw [Nat.add_right_comm m 1 i]
exact ih i (fun j => f (j + 1)) g
theorem pick_congr : forall m n i (f g f' g' : Nat -> Bool),
(forall i, i < m -> f i = f' i) -> (forall i, i < n -> g i = g' i) -> i < m + n ->
pick m i f g = pick m i f' g' := by
intro m
induction m with
| zero =>
intro n i f g f' g' _ hg hi
exact hg i ((congrArg (fun t => i < t) (Nat.zero_add n)).mp hi)
| succ m ih =>
intro n i f g f' g' hf hg hi
cases i with
| zero => exact hf 0 (Nat.zero_lt_succ m)
| succ i =>
have hi' : i + 1 < m + n + 1 := (congrArg (fun t => i + 1 < t) (Nat.add_right_comm m 1 n)).mp hi
exact ih n i (fun j => f (j + 1)) g (fun j => f' (j + 1)) g'
(fun j hj => hf (j + 1) (Nat.succ_lt_succ hj)) hg (Nat.lt_of_succ_lt_succ hi')
theorem pick_ff : forall m i, pick m i (fun _ => false) (fun _ => false) = false := by
intro m
induction m with
| zero => intro i; rfl
| succ m ih =>
intro i
cases i with
| zero => rfl
| succ i => exact ih i
variable (M : TMk)
/-- Cells have K = m + 2 + k bits; symbols have k + 1 tracks. -/
def K : Nat := M.m + 2 + M.k
/-! ## Layout -/
def cellK (h : Bool) (q : List Bool) (s : Nat -> Bool) : Nat -> Bool
| 0 => s 0
| 1 => h
| i + 2 => pick M.m i (fun i => h && nthd q i) (fun i => s (i + 1))
def encK (tape : Tape) (pos : Nat) (q : List Bool) : Conf :=
fun j b => cellK M (Nat.beq j pos) q (tape j) b
/-! ## The local rule -/
/-- Track i of a cell: bit 0, or bit m + 2 + (i - 1). -/
def trk (g : Nat -> Bool) : Nat -> Bool
| 0 => g 0
| i + 1 => g (M.m + 2 + i)
def stG (g : Nat -> Bool) : List Bool := read (fun i => g (i + 2)) 0 M.m
def syG (g : Nat -> Bool) : List Bool := read (trk M g) 0 (M.k + 1)
def lb (L : List Bool) (i : Nat) : Bool := nthd L i
def cb (L : List Bool) (i : Nat) : Bool := nthd L (K M + i)
def rb (L : List Bool) (i : Nat) : Bool := nthd L (K M + (K M + i))
def Rl (L : List Bool) : Bool := lb L 1 && M.right (stG M (lb L)) (syG M (lb L))
def Rr (L : List Bool) : Bool := rb M L 1 && !(M.right (stG M (rb M L)) (syG M (rb M L)))
def wr (L : List Bool) (i : Nat) : Bool :=
sel (cb M L 1) (nthd (M.write (stG M (cb M L)) (syG M (cb M L))) i) (trk M (cb M L) i)
def rule (L : List Bool) : Nat -> Bool
| 0 => wr M L 0
| 1 => Rl M L || Rr M L
| i + 2 => pick M.m i
(fun i => (Rl M L && nthd (M.next (stG M (lb L)) (syG M (lb L))) i) ||
(Rr M L && nthd (M.next (stG M (rb M L)) (syG M (rb M L))) i))
(fun i => wr M L (i + 1))
/-! ## The Turing step -/
def symAt (tape : Tape) (pos : Nat) : List Bool := read (tape pos) 0 (M.k + 1)
def tapeN (tape : Tape) (pos : Nat) (q : List Bool) : Tape :=
fun j i => sel (Nat.beq j pos) (nthd (M.write q (symAt M tape pos)) i) (tape j i)
def posN (tape : Tape) (pos : Nat) (q : List Bool) : Nat :=
selN (M.right q (symAt M tape pos)) (pos + 1) (pos - 1)
def qN (tape : Tape) (pos : Nat) (q : List Bool) : List Bool := M.next q (symAt M tape pos)
/-! ## Reading the layout -/
theorem trkE (tape : Tape) (pos : Nat) (q : List Bool) (x : Nat) : forall i,
trk M (encK M tape pos q x) i = tape x i
| 0 => rfl
| i + 1 => by
show cellK M (Nat.beq x pos) q (tape x) (M.m + 2 + i) = tape x (i + 1)
rw [Nat.add_right_comm M.m 2 i]
exact pick_hi M.m i _ _
theorem syE (tape : Tape) (pos : Nat) (q : List Bool) (x : Nat) :
syG M (encK M tape pos q x) = symAt M tape x :=
read_ext_k _ _ (M.k + 1) (fun i _ => trkE M tape pos q x i)
theorem stE (tape : Tape) (pos : Nat) (q : List Bool) (hq : q.length = M.m) (x : Nat)
(h : Nat.beq x pos = true) : stG M (encK M tape pos q x) = q := by
have e : read (fun i => encK M tape pos q x (i + 2)) 0 M.m = read (nthd q) 0 M.m :=
read_ext_k _ _ M.m (fun i hi => by
show pick M.m i (fun i => Nat.beq x pos && nthd q i) (fun i => tape x (i + 1)) = nthd q i
rw [pick_lo M.m i _ _ hi, h]; rfl)
show read (fun i => encK M tape pos q x (i + 2)) 0 M.m = q
rw [e, ← hq]
exact read_nthd q
/-- The head substitution: where the head is, the cell's state and symbol are q and the
head symbol. -/
theorem stq (tape : Tape) (pos : Nat) (q : List Bool) (hq : q.length = M.m)
(f : List Bool -> List Bool -> Bool) (x : Nat) :
(Nat.beq x pos && f (stG M (encK M tape pos q x)) (syG M (encK M tape pos q x))) =
(Nat.beq x pos && f q (symAt M tape pos)) := by
cases h : Nat.beq x pos with
| false => rfl
| true =>
have e : x = pos := Found.Pnp2.beq_eq x pos h
rw [stE M tape pos q hq x h, syE, e]
theorem selq (tape : Tape) (pos : Nat) (q : List Bool) (hq : q.length = M.m)
(f : List Bool -> List Bool -> Bool) (x : Nat) (y : Bool) :
sel (Nat.beq x pos) (f (stG M (encK M tape pos q x)) (syG M (encK M tape pos q x))) y =
sel (Nat.beq x pos) (f q (symAt M tape pos)) y := by
cases h : Nat.beq x pos with
| false => rfl
| true =>
have e : x = pos := Found.Pnp2.beq_eq x pos h
rw [stE M tape pos q hq x h, syE, e]
/-! ## Accessors on the neighbourhood -/
def nbE (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) : List Bool :=
nbC (encK M tape pos q) (K M) W j
theorem ltS (i : Nat) (h : i < M.m) : i + 2 < K M :=
Nat.lt_of_lt_of_le (Nat.add_lt_add_right h 2) (Nat.le_add_right _ _)
/-- The bit index of track i. -/
def trkIdx : Nat -> Nat
| 0 => 0
| i + 1 => M.m + 2 + i
theorem ltT : forall i, i < M.k + 1 -> trkIdx M i < K M
| 0, _ => Nat.lt_of_lt_of_le (Nat.zero_lt_succ _) (Nat.le_add_right _ _)
| _ + 1, h => Nat.add_lt_add_left (Nat.lt_of_succ_lt_succ h) _
theorem lt1 : 1 < K M :=
Nat.lt_of_lt_of_le (Nat.succ_lt_succ (Nat.zero_lt_succ M.m)) (Nat.le_add_right _ _)
theorem trk_acc (g h : Nat -> Bool) (hg : forall b, b < K M -> g b = h b) : forall i, i < M.k + 1 ->
trk M g i = trk M h i
| i, hi => by
have e := hg (trkIdx M i) (ltT M i hi)
cases i with
| zero => exact e
| succ i => exact e
theorem stL (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) :
stG M (lb (nbE M tape pos q W j)) = stG M (encK M tape pos q (leftIdx W j)) :=
read_ext_k _ _ M.m (fun i hi => accL (encK M tape pos q) (K M) W j (i + 2) (ltS M i hi))
theorem syL (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) :
syG M (lb (nbE M tape pos q W j)) = syG M (encK M tape pos q (leftIdx W j)) :=
read_ext_k _ _ (M.k + 1) (trk_acc M _ _ (fun b hb => accL (encK M tape pos q) (K M) W j b hb))
theorem stC (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) :
stG M (cb M (nbE M tape pos q W j)) = stG M (encK M tape pos q j) :=
read_ext_k _ _ M.m (fun i hi => accC (encK M tape pos q) (K M) W j (i + 2) (ltS M i hi))
theorem syC (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) :
syG M (cb M (nbE M tape pos q W j)) = syG M (encK M tape pos q j) :=
read_ext_k _ _ (M.k + 1) (trk_acc M _ _ (fun b hb => accC (encK M tape pos q) (K M) W j b hb))
theorem stR (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) :
stG M (rb M (nbE M tape pos q W j)) = stG M (encK M tape pos q (j + 1)) :=
read_ext_k _ _ M.m (fun i hi => accR (encK M tape pos q) (K M) W j (i + 2) (ltS M i hi))
theorem syR (tape : Tape) (pos : Nat) (q : List Bool) (W j : Nat) :
syG M (rb M (nbE M tape pos q W j)) = syG M (encK M tape pos q (j + 1)) :=
read_ext_k _ _ (M.k + 1) (trk_acc M _ _ (fun b hb => accR (encK M tape pos q) (K M) W j b hb))
/-- The two movement signals of the rule, on a layout. -/
theorem rl_eq (tape : Tape) (p : Nat) (q : List Bool) (hq : q.length = M.m) (W j : Nat)
(f : List Bool -> List Bool -> Bool) :
(lb (nbE M tape (p + 1) q W j) 1 && f (stG M (lb (nbE M tape (p + 1) q W j))) (syG M (lb (nbE M tape (p + 1) q W j)))) =
(Nat.beq (leftIdx W j) (p + 1) && f q (symAt M tape (p + 1))) := by
have l0 : lb (nbE M tape (p + 1) q W j) 1 = Nat.beq (leftIdx W j) (p + 1) :=
accL (encK M tape (p + 1) q) (K M) W j 1 (lt1 M)
rw [l0, stL, syL]
exact stq M tape (p + 1) q hq f (leftIdx W j)
theorem rr_eq (tape : Tape) (p : Nat) (q : List Bool) (hq : q.length = M.m) (W j : Nat)
(f : List Bool -> List Bool -> Bool) :
(rb M (nbE M tape (p + 1) q W j) 1 && f (stG M (rb M (nbE M tape (p + 1) q W j))) (syG M (rb M (nbE M tape (p + 1) q W j)))) =
(Nat.beq (j + 1) (p + 1) && f q (symAt M tape (p + 1))) := by
have r0 : rb M (nbE M tape (p + 1) q W j) 1 = Nat.beq (j + 1) (p + 1) :=
accR (encK M tape (p + 1) q) (K M) W j 1 (lt1 M)
rw [r0, stR, syR]
exact stq M tape (p + 1) q hq f (j + 1)
/-- The written track i at cell j. -/
theorem wr_eq (tape : Tape) (p : Nat) (q : List Bool) (hq : q.length = M.m) (W j : Nat) (i : Nat)
(hi : i < M.k + 1) :
wr M (nbE M tape (p + 1) q W j) i = sel (Nat.beq j (p + 1)) (nthd (M.write q (symAt M tape (p + 1))) i) (tape j i) := by
have c1 : cb M (nbE M tape (p + 1) q W j) 1 = Nat.beq j (p + 1) :=
accC (encK M tape (p + 1) q) (K M) W j 1 (lt1 M)
have cy : trk M (cb M (nbE M tape (p + 1) q W j)) i = tape j i :=
(trk_acc M _ _ (fun b hb => accC (encK M tape (p + 1) q) (K M) W j b hb) i hi).trans (trkE M tape (p + 1) q j i)
show sel (cb M (nbE M tape (p + 1) q W j) 1)
(nthd (M.write (stG M (cb M (nbE M tape (p + 1) q W j))) (syG M (cb M (nbE M tape (p + 1) q W j)))) i)
(trk M (cb M (nbE M tape (p + 1) q W j)) i) = _
rw [c1, cy, stC, syC]
exact selq M tape (p + 1) q hq (fun a s => nthd (M.write a s) i) j (tape j i)
/-! ## One step -/
theorem step_inside (tape : Tape) (p : Nat) (q : List Bool) (hq : q.length = M.m)
(W : Nat) (hW : p + 2 < W) (j : Nat) (hj : j < W) (b : Nat) (hb : b < K M) :
stepW (rule M) (K M) W (encK M tape (p + 1) q) j b =
encK M (tapeN M tape (p + 1) q) (posN M tape (p + 1) q) (qN M tape (p + 1) q) j b := by
have hW1 : p + 1 < W := Nat.lt_of_succ_lt hW
show gate (Nat.beq j W) (rule M (nbE M tape (p + 1) q W j) b) = _
rw [Found.Pnp2.beq_false_of_ne j W (Nat.ne_of_lt hj)]
match b, hb with
| 0, _ => exact wr_eq M tape p q hq W j 0 (Nat.zero_lt_succ _)
| 1, _ =>
show ((lb (nbE M tape (p + 1) q W j) 1 && M.right (stG M (lb (nbE M tape (p + 1) q W j))) (syG M (lb (nbE M tape (p + 1) q W j)))) ||
(rb M (nbE M tape (p + 1) q W j) 1 && (fun a s => !(M.right a s)) (stG M (rb M (nbE M tape (p + 1) q W j))) (syG M (rb M (nbE M tape (p + 1) q W j))))) =
Nat.beq j (selN (M.right q (symAt M tape (p + 1))) (p + 1 + 1) (p + 1 - 1))
rw [rl_eq M tape p q hq W j M.right, rr_eq M tape p q hq W j (fun a s => !(M.right a s))]
exact head_eq W p j hW1 _
| i + 2, hb' =>
have hi : i < M.m + M.k :=
Nat.lt_of_add_lt_add_right ((congrArg (fun t => i + 2 < t) (Nat.add_right_comm M.m 2 M.k)).mp hb')
show pick M.m i _ _ = pick M.m i _ _
apply pick_congr M.m M.k i _ _ _ _ _ _ hi
· intro i _
show (((lb (nbE M tape (p + 1) q W j) 1 && M.right (stG M (lb (nbE M tape (p + 1) q W j))) (syG M (lb (nbE M tape (p + 1) q W j)))) &&
nthd (M.next (stG M (lb (nbE M tape (p + 1) q W j))) (syG M (lb (nbE M tape (p + 1) q W j)))) i) ||
((rb M (nbE M tape (p + 1) q W j) 1 && !(M.right (stG M (rb M (nbE M tape (p + 1) q W j))) (syG M (rb M (nbE M tape (p + 1) q W j))))) &&
nthd (M.next (stG M (rb M (nbE M tape (p + 1) q W j))) (syG M (rb M (nbE M tape (p + 1) q W j)))) i)) =
(Nat.beq j (selN (M.right q (symAt M tape (p + 1))) (p + 1 + 1) (p + 1 - 1)) && nthd (M.next q (symAt M tape (p + 1))) i)
rw [and_assoc3, and_assoc3]
rw [rl_eq M tape p q hq W j (fun a s => M.right a s && nthd (M.next a s) i),
rr_eq M tape p q hq W j (fun a s => !(M.right a s) && nthd (M.next a s) i)]
exact head_eq2 W p j hW1 _ _
· intro i hik
exact wr_eq M tape p q hq W j (i + 1) (Nat.succ_lt_succ hik)
/-- At the boundary cell W the local machine writes false, and so does the layout of the
next configuration when the head stays inside and the tape is false at W. -/
theorem step_boundary (tape : Tape) (p : Nat) (q : List Bool) (W : Nat) (hW : p + 2 < W)
(htW : forall i, i < M.k + 1 -> tape W i = false) (b : Nat) (hb : b < K M) :
stepW (rule M) (K M) W (encK M tape (p + 1) q) W b =
encK M (tapeN M tape (p + 1) q) (posN M tape (p + 1) q) (qN M tape (p + 1) q) W b := by
have hW1 : p + 1 < W := Nat.lt_of_succ_lt hW
have hpos : Nat.beq W (posN M tape (p + 1) q) = false := by
show Nat.beq W (selN (M.right q (symAt M tape (p + 1))) (p + 1 + 1) (p + 1 - 1)) = false
cases M.right q (symAt M tape (p + 1)) with
| true => exact Found.Pnp2.beq_false_of_ne W (p + 2) (fun e => Nat.ne_of_lt hW e.symm)
| false => exact Found.Pnp2.beq_false_of_ne W p (fun e => Nat.ne_of_lt (Nat.lt_of_succ_lt hW1) e.symm)
have hT : forall i, i < M.k + 1 -> tapeN M tape (p + 1) q W i = false := fun i hi => by
show sel (Nat.beq W (p + 1)) _ (tape W i) = false
rw [beqW W p hW1]; exact htW i hi
show gate (Nat.beq W W) _ = cellK M (Nat.beq W (posN M tape (p + 1) q)) (qN M tape (p + 1) q)
(tapeN M tape (p + 1) q W) b
rw [beq_refl W, hpos]
match b, hb with
| 0, _ => exact (hT 0 (Nat.zero_lt_succ _)).symm
| 1, _ => rfl
| i + 2, hb' =>
have hi : i < M.m + M.k :=
Nat.lt_of_add_lt_add_right ((congrArg (fun t => i + 2 < t) (Nat.add_right_comm M.m 2 M.k)).mp hb')
show false = pick M.m i (fun i => false && nthd (qN M tape (p + 1) q) i) (fun i => tapeN M tape (p + 1) q W (i + 1))
have e := pick_congr M.m M.k i (fun i => false && nthd (qN M tape (p + 1) q) i)
(fun i => tapeN M tape (p + 1) q W (i + 1)) (fun _ => false) (fun _ => false) (fun _ _ => rfl)
(fun i hik => hT (i + 1) (Nat.succ_lt_succ hik)) hi
rw [e]
exact (pick_ff M.m i).symm
end Found.Pnp43
#print axioms Found.Pnp43.pick_lo
#print axioms Found.Pnp43.pick_hi
#print axioms Found.Pnp43.pick_congr
#print axioms Found.Pnp43.pick_ff
#print axioms Found.Pnp43.trkE
#print axioms Found.Pnp43.syE
#print axioms Found.Pnp43.stE
#print axioms Found.Pnp43.stq
#print axioms Found.Pnp43.selq
#print axioms Found.Pnp43.ltT
#print axioms Found.Pnp43.trk_acc
#print axioms Found.Pnp43.stL
#print axioms Found.Pnp43.syL
#print axioms Found.Pnp43.stC
#print axioms Found.Pnp43.syC
#print axioms Found.Pnp43.stR
#print axioms Found.Pnp43.syR
#print axioms Found.Pnp43.rl_eq
#print axioms Found.Pnp43.rr_eq
#print axioms Found.Pnp43.wr_eq
#print axioms Found.Pnp43.step_inside
#print axioms Found.Pnp43.step_boundary
lean_all/found/Pnp44.lean
/-
T330 piece 44. found/Pnp44 -- Cook-Levin for multi-track Turing machines (CL3c, 2).
Runs of the multi-track machine of Pnp43 (configurations: tape, head position, state)
and the Cook-Levin CNF of their tableau. Proved:
* simulate: if the boundary cell W is false, the state has m bits, next keeps m bits,
and the head stays at some cell p + 1 with p + 2 < W before time T, then the width-W
local machine run from the layout is the layout of the Turing configuration at every
time t <= T, cell j <= W and bit b < K;
* cook_levin_tmk: with the pins of Pnp14 (head at p0 + 1 in state q0 on the layout
bits 1, 2.., input bits on track 0), the CNF full (rule M) K W T pins is satisfiable
iff some tape agreeing with the input on track 0 and false at W makes the machine
hold true at track 0 of cell 0 after T steps -- for a machine whose head stays
inside on every such tape. The pins are those the reduction program of
Pnp37-Pnp42 writes, so that program serves multi-track machines unchanged.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp43
import found.Pnp14
namespace Found.Pnp44
open Found.Pnp7 (nthd)
open Found.Pnp9 (lt_succ_cases leftIdx)
open Found.Pnp10 (Conf nbC stepW runW gate beq_refl nbC_ext)
open Found.Pnp11 (PinsOK full cook_levin_local)
open Found.Pnp12 (sel beqW)
open Found.Pnp14 (pins_app allPins cellPins_iff allPins_iff inPins inPins_iff InputOK)
open Found.Pnp43
structure TCk where
tape : Tape
pos : Nat
q : List Bool
variable (M : TMk)
def tmStep (c : TCk) : TCk := TCk.mk (tapeN M c.tape c.pos c.q) (posN M c.tape c.pos c.q) (qN M c.tape c.pos c.q)
def tmRun : Nat -> TCk -> TCk
| 0, c => c
| t + 1, c => tmStep M (tmRun t c)
def lay (c : TCk) : Conf := encK M c.tape c.pos c.q
/-- The head stays inside before time T. -/
def Inside (W T : Nat) (c : TCk) : Prop :=
forall t, t < T -> Exists fun p => (tmRun M t c).pos = p + 1 /\ p + 2 < W
theorem preserve (W T : Nat) (c : TCk) (hin : Inside M W T c) (htW : forall i, i < M.k + 1 -> c.tape W i = false)
(hq : c.q.length = M.m) (hnext : forall a s, (M.next a s).length = M.m) :
forall t, t < T + 1 -> (forall i, i < M.k + 1 -> (tmRun M t c).tape W i = false) /\ (tmRun M t c).q.length = M.m := by
intro t
induction t with
| zero => intro _; exact And.intro htW hq
| succ t ih =>
intro ht
have ht' : t < T := Nat.lt_of_succ_lt_succ ht
have ih' := ih (Nat.lt_succ_of_lt ht')
exact Exists.elim (hin t ht') fun p hp => by
apply And.intro
· intro i hi
show sel (Nat.beq W (tmRun M t c).pos) _ ((tmRun M t c).tape W i) = false
rw [hp.1, beqW W p (Nat.lt_of_succ_lt hp.2)]
exact ih'.1 i hi
· exact hnext _ _
theorem stepW_ext (W : Nat) (x y : Conf) (h : forall c, c < W + 1 -> forall b, b < K M -> x c b = y c b) :
forall j, j < W + 1 -> forall b, stepW (rule M) (K M) W x j b = stepW (rule M) (K M) W y j b := by
intro j hj b
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => by
show gate (Nat.beq j W) (rule M (nbC x (K M) W j) b) = gate (Nat.beq j W) (rule M (nbC y (K M) W j) b)
rw [nbC_ext x y (K M) W j hjW h])
(fun e => by
rw [e]
show gate (Nat.beq W W) _ = gate (Nat.beq W W) _
rw [beq_refl W]
rfl)
theorem runW_ext (W : Nat) (x y : Conf)
(h : forall c, c < W + 1 -> forall b, b < K M -> x c b = y c b) :
forall t, forall c, c < W + 1 -> forall b, b < K M ->
runW (rule M) (K M) W t x c b = runW (rule M) (K M) W t y c b := by
intro t
induction t with
| zero => exact h
| succ t ih => intro c hc b _; exact stepW_ext M W _ _ ih c hc b
/-- The local machine follows the Turing machine. -/
theorem simulate (W T : Nat) (c : TCk) (hin : Inside M W T c) (htW : forall i, i < M.k + 1 -> c.tape W i = false)
(hq : c.q.length = M.m) (hnext : forall a s, (M.next a s).length = M.m) :
forall t, t < T + 1 -> forall j, j < W + 1 -> forall b, b < K M ->
runW (rule M) (K M) W t (lay M c) j b = lay M (tmRun M t c) j b := by
intro t
induction t with
| zero => intro _ j _ b _; rfl
| succ t ih =>
intro ht j hj b hb
have ht' : t < T := Nat.lt_of_succ_lt_succ ht
have pr := preserve M W T c hin htW hq hnext t (Nat.lt_succ_of_lt ht')
show stepW (rule M) (K M) W (runW (rule M) (K M) W t (lay M c)) j b = lay M (tmStep M (tmRun M t c)) j b
rw [stepW_ext M W _ (lay M (tmRun M t c)) (fun c' hc b' hb' => ih (Nat.lt_succ_of_lt ht') c' hc b' hb') j hj b]
exact Exists.elim (hin t ht') fun p hp => by
have e : lay M (tmRun M t c) = encK M (tmRun M t c).tape (p + 1) (tmRun M t c).q := by
show encK M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q = _
rw [hp.1]
show _ = encK M (tapeN M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q)
(posN M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q)
(qN M (tmRun M t c).tape (tmRun M t c).pos (tmRun M t c).q) j b
rw [e, hp.1]
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => step_inside M _ p _ pr.2 W hp.2 j hjW b hb)
(fun ej => by rw [ej]; exact step_boundary M _ p _ W hp.2 pr.1 b hb)
/-! ## Cook-Levin -/
/-- A function agrees with a pick of itself and g when g lists its values from m on. -/
theorem pick_self (n : Nat) : forall m b (f g : Nat -> Bool), b < m + n ->
(forall r, r < n -> f (m + r) = g r) -> f b = pick m b f g := by
intro m
induction m with
| zero =>
intro b f g hb hg
show f b = g b
exact (congrArg f (Nat.zero_add b).symm).trans (hg b ((congrArg (fun t => b < t) (Nat.zero_add n)).mp hb))
| succ m ih =>
intro b f g hb hg
cases b with
| zero => rfl
| succ b =>
have hb' : b + 1 < m + n + 1 := (congrArg (fun t => b + 1 < t) (Nat.add_right_comm m 1 n)).mp hb
exact ih b (fun j => f (j + 1)) g (Nat.lt_of_succ_lt_succ hb')
(fun r hr => (congrArg f (Nat.add_right_comm m r 1)).trans (hg r hr))
theorem hi2 (i : Nat) (hb : i + 2 < K M) : i < M.m + M.k :=
Nat.lt_of_add_lt_add_right ((congrArg (fun t => i + 2 < t) (Nat.add_right_comm M.m 2 M.k)).mp hb)
/-- A conf that agrees with a layout's shape is that layout of its own tracks. -/
theorem agree_lay (c0 : Conf) (j : Nat) (h : Bool) (q0 : List Bool)
(h1 : c0 j 1 = h) (hs : forall i, i < M.m -> c0 j (i + 2) = (h && nthd q0 i)) :
forall b, b < K M -> c0 j b = cellK M h q0 (trk M (c0 j)) b
| 0, _ => rfl
| 1, _ => h1
| i + 2, hb => by
show c0 j (i + 2) = pick M.m i (fun i => h && nthd q0 i) (fun i => c0 j (M.m + 2 + i))
rw [pick_self M.k M.m i (fun i => c0 j (i + 2)) (fun i => c0 j (M.m + 2 + i)) (hi2 M i hb)
(fun r _ => congrArg (c0 j) (Nat.add_right_comm M.m r 2))]
exact pick_congr M.m M.k i _ _ _ _ hs (fun _ _ => rfl) (hi2 M i hb)
def pinsTMk (W p0 : Nat) (q0 : List Bool) (inp : List (Nat × Bool)) : List (Nat × (Nat × Bool)) :=
allPins (p0 + 1) q0 M.m W ++ inPins inp
/-- Cook-Levin for multi-track Turing machines (pins as for Pnp14: the reduction program
of Pnp37-Pnp42 writes this CNF). -/
theorem cook_levin_tmk (W T p0 : Nat) (q0 : List Bool) (hq0 : q0.length = M.m)
(hnext : forall a s, (M.next a s).length = M.m) (hp : p0 + 2 < W) (inp : List (Nat × Bool))
(hin : forall tape : Tape, InputOK (fun j => tape j 0) inp -> (forall i, i < M.k + 1 -> tape W i = false) ->
Inside M W T (TCk.mk tape (p0 + 1) q0)) :
((Exists fun s => Found.Pnp8.cnfv s (full (rule M) (K M) W T (pinsTMk M W p0 q0 inp)) = true) ->
Exists fun tape : Tape => InputOK (fun j => tape j 0) inp /\ (forall i, i < M.k + 1 -> tape W i = false) /\
(tmRun M T (TCk.mk tape (p0 + 1) q0)).tape 0 0 = true) /\
((Exists fun tape : Tape => InputOK (fun j => tape j 0) inp /\ (forall i, i < M.k + 1 -> tape W i = false) /\
(tmRun M T (TCk.mk tape (p0 + 1) q0)).tape 0 0 = true) ->
Exists fun s => Found.Pnp8.cnfv s (full (rule M) (K M) W T (pinsTMk M W p0 q0 inp)) = true) := by
have hK : 0 < K M := Nat.lt_of_succ_lt (lt1 M)
have hW1 : p0 + 1 < W := Nat.lt_of_succ_lt hp
have hbW : Nat.beq W (p0 + 1) = false := beqW W p0 hW1
apply And.intro
· intro h
exact Exists.elim ((cook_levin_local (rule M) (K M) W T hK _).1 h) fun c0 hc => by
have hpins := (pins_app c0 _ _).1 hc.2.1
let tape : Tape := fun j => trk M (c0 j)
let c : TCk := TCk.mk tape (p0 + 1) q0
have htW : forall i, i < M.k + 1 -> tape W i = false := fun i hi =>
hc.1 (trkIdx M i) (ltT M i hi) ▸ (by cases i <;> rfl)
have agree : forall j, j < W + 1 -> forall b, b < K M -> c0 j b = lay M c j b := by
intro j hj b hb
exact Or.elim (lt_succ_cases j W hj)
(fun hjW => by
have hcell := (cellPins_iff c0 (p0 + 1) q0 j M.m).1 ((allPins_iff c0 (p0 + 1) q0 M.m W).1 hpins.1 j hjW)
exact agree_lay M c0 j _ q0 hcell.1 hcell.2 b hb)
(fun e => by
rw [e]
show c0 W b = cellK M (Nat.beq W (p0 + 1)) q0 (trk M (c0 W)) b
exact agree_lay M c0 W _ q0 ((hc.1 1 (lt1 M)).trans hbW.symm)
(fun i hi => by rw [hbW]; exact hc.1 (i + 2) (ltS M i hi)) b hb)
have hrun := runW_ext M W c0 (lay M c) agree T 0 (Nat.zero_lt_succ W) 0 hK
have hsim := simulate M W T c (hin tape ((inPins_iff c0 inp).1 hpins.2) htW) htW hq0 hnext T
(Nat.lt_succ_self T) 0 (Nat.zero_lt_succ W) 0 hK
exact Exists.intro tape (And.intro ((inPins_iff c0 inp).1 hpins.2) (And.intro htW
((hsim.symm.trans hrun.symm).trans hc.2.2)))
· intro h
exact Exists.elim h fun tape ht => by
let c : TCk := TCk.mk tape (p0 + 1) q0
apply (cook_levin_local (rule M) (K M) W T hK _).2
apply Exists.intro (lay M c)
apply And.intro
· intro b hb
show cellK M (Nat.beq W (p0 + 1)) q0 (tape W) b = false
rw [hbW]
match b, hb with
| 0, _ => exact ht.2.1 0 (Nat.zero_lt_succ _)
| 1, _ => rfl
| i + 2, hb' =>
show pick M.m i (fun i => false && nthd q0 i) (fun i => tape W (i + 1)) = false
exact (pick_congr M.m M.k i (fun i => false && nthd q0 i) (fun i => tape W (i + 1))
(fun _ => false) (fun _ => false) (fun _ _ => rfl)
(fun i hik => ht.2.1 (i + 1) (Nat.succ_lt_succ hik)) (hi2 M i hb')).trans (pick_ff M.m i)
apply And.intro
· exact (pins_app (lay M c) _ _).2 (And.intro
((allPins_iff (lay M c) (p0 + 1) q0 M.m W).2 (fun j _ =>
(cellPins_iff (lay M c) (p0 + 1) q0 j M.m).2 (And.intro rfl
(fun i hi => pick_lo M.m i _ _ hi))))
((inPins_iff (lay M c) inp).2 ht.1))
· exact (simulate M W T c (hin tape ht.1 ht.2.1) ht.2.1 hq0 hnext T (Nat.lt_succ_self T) 0
(Nat.zero_lt_succ W) 0 hK).trans ht.2.2
end Found.Pnp44
#print axioms Found.Pnp44.preserve
#print axioms Found.Pnp44.stepW_ext
#print axioms Found.Pnp44.runW_ext
#print axioms Found.Pnp44.simulate
#print axioms Found.Pnp44.pick_self
#print axioms Found.Pnp44.hi2
#print axioms Found.Pnp44.agree_lay
#print axioms Found.Pnp44.cook_levin_tmk
lean_all/found/Pnp45.lean
/-
T330 piece 45. found/Pnp45 -- sweeps of the multi-track machine (CL3c, 3).
A register instruction is simulated by the multi-track machine of Pnp43/Pnp44 in a
number of steps linear in the register lengths: the head sweeps over a register track
to its end and back. This piece proves the sweep itself, for any machine M:
* tapes agreeing on the tracks 0..k (TEq) have the same symbols and step to tapes
agreeing on the tracks 0..k, with the same head and state;
* sweepR: if for d < n the machine in state q reading the symbol of cell pos + d keeps
the state, writes the symbol back and moves right, then after n steps the head is
at pos + n, the state is q and the tape agrees with the start on every track;
* sweepL: the same moving left over pos + 1 .. pos + n, from pos + n down to pos.
So a sweep over n cells costs exactly n steps. It relativizes (a tool; PNP_MAP.md).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp44
namespace Found.Pnp45
open Found.Pnp1 (read)
open Found.Pnp7 (nthd)
open Found.Pnp10 (read_ext_k)
open Found.Pnp12 (sel selN)
open Found.Pnp43
open Found.Pnp44
variable (M : TMk)
/-- Tapes agreeing on the tracks 0..k. -/
def TEq (t u : Tape) : Prop := forall j i, i < M.k + 1 -> t j i = u j i
theorem nthd_read (f : Nat -> Bool) : forall n k i, i < n -> nthd (read f k n) i = f (k + i) := by
intro n
induction n with
| zero => intro k i h; exact False.elim (Nat.not_lt_zero i h)
| succ n ih =>
intro k i h
cases i with
| zero => rfl
| succ i =>
show nthd (read f (k + 1) n) i = f (k + (i + 1))
rw [ih (k + 1) i (Nat.lt_of_succ_lt_succ h), Nat.add_right_comm k 1 i, Nat.add_assoc k i 1]
theorem symAt_ext (t u : Tape) (h : TEq M t u) (p : Nat) : symAt M t p = symAt M u p :=
read_ext_k (t p) (u p) (M.k + 1) (fun i hi => h p i hi)
/-- Writing back the symbol read leaves every track as it was. -/
theorem tapeN_keep (t : Tape) (p : Nat) (q : List Bool) (hw : M.write q (symAt M t p) = symAt M t p) :
TEq M (tapeN M t p q) t := by
intro j i hi
show sel (Nat.beq j p) (nthd (M.write q (symAt M t p)) i) (t j i) = t j i
cases h : Nat.beq j p with
| false => rfl
| true =>
have e : j = p := Found.Pnp2.beq_eq j p h
rw [e, hw]
show nthd (read (t p) 0 (M.k + 1)) i = t p i
rw [nthd_read (t p) (M.k + 1) 0 i hi, Nat.zero_add]
theorem teq_trans (a b c : Tape) (h1 : TEq M a b) (h2 : TEq M b c) : TEq M a c :=
fun j i hi => (h1 j i hi).trans (h2 j i hi)
/-- One step in a state that keeps itself and writes back. -/
structure Keep (q : List Bool) (s : List Bool) (r : Bool) : Prop where
nx : M.next q s = q
wr : M.write q s = s
rt : M.right q s = r
theorem step_keep (t t0 : Tape) (p : Nat) (q : List Bool) (r : Bool)
(ht : TEq M t t0) (hk : Keep M q (symAt M t0 p) r) :
TEq M (tmStep M (TCk.mk t p q)).tape t0 /\
(tmStep M (TCk.mk t p q)).pos = selN r (p + 1) (p - 1) /\
(tmStep M (TCk.mk t p q)).q = q := by
have es : symAt M t p = symAt M t0 p := symAt_ext M t t0 ht p
refine And.intro ?_ (And.intro ?_ ?_)
· show TEq M (tapeN M t p q) t0
have hw : M.write q (symAt M t p) = symAt M t p := by rw [es]; exact hk.wr
exact teq_trans M _ _ _ (tapeN_keep M t p q hw) ht
· show selN (M.right q (symAt M t p)) (p + 1) (p - 1) = selN r (p + 1) (p - 1)
rw [es, hk.rt]
· show M.next q (symAt M t p) = q
rw [es]; exact hk.nx
/-- Sweep right over n cells: n steps. -/
theorem sweepR (t0 : Tape) (pos : Nat) (q : List Bool) :
forall n, (forall d, d < n -> Keep M q (symAt M t0 (pos + d)) true) ->
TEq M (tmRun M n (TCk.mk t0 pos q)).tape t0 /\
(tmRun M n (TCk.mk t0 pos q)).pos = pos + n /\
(tmRun M n (TCk.mk t0 pos q)).q = q := by
intro n
induction n with
| zero =>
intro _
exact And.intro (fun _ _ _ => rfl) (And.intro rfl rfl)
| succ n ih =>
intro hk
have h := ih (fun d hd => hk d (Nat.lt_succ_of_lt hd))
have e : tmRun M n (TCk.mk t0 pos q) =
TCk.mk (tmRun M n (TCk.mk t0 pos q)).tape (pos + n) q := by
cases c : tmRun M n (TCk.mk t0 pos q) with
| mk tp ps qq =>
rw [c] at h
have e1 : ps = pos + n := h.2.1
have e2 : qq = q := h.2.2
rw [e1, e2]
have s := step_keep M (tmRun M n (TCk.mk t0 pos q)).tape t0 (pos + n) q true h.1
(hk n (Nat.lt_succ_self n))
show TEq M (tmStep M (tmRun M n (TCk.mk t0 pos q))).tape t0 /\
(tmStep M (tmRun M n (TCk.mk t0 pos q))).pos = pos + n + 1 /\
(tmStep M (tmRun M n (TCk.mk t0 pos q))).q = q
rw [e]
exact s
/-- Sweep left over the cells pos + 1 .. pos + n, from pos + n down to pos: n steps. -/
theorem sweepL : forall n (t0 : Tape) (pos : Nat) (q : List Bool),
(forall d, d < n -> Keep M q (symAt M t0 (pos + 1 + d)) false) ->
TEq M (tmRun M n (TCk.mk t0 (pos + n) q)).tape t0 /\
(tmRun M n (TCk.mk t0 (pos + n) q)).pos = pos /\
(tmRun M n (TCk.mk t0 (pos + n) q)).q = q := by
intro n
induction n with
| zero =>
intro t0 pos q _
exact And.intro (fun _ _ _ => rfl) (And.intro rfl rfl)
| succ n ih =>
intro t0 pos q hk
have h := ih t0 (pos + 1) q (fun d hd => by
have e : pos + 1 + 1 + d = pos + 1 + (d + 1) := by rw [Nat.add_assoc (pos + 1) 1 d, Nat.add_comm 1 d]
rw [e]; exact hk (d + 1) (Nat.succ_lt_succ hd))
have e0 : pos + (n + 1) = pos + 1 + n := by
rw [Nat.add_assoc, Nat.add_comm n 1]
rw [e0]
have e : tmRun M n (TCk.mk t0 (pos + 1 + n) q) =
TCk.mk (tmRun M n (TCk.mk t0 (pos + 1 + n) q)).tape (pos + 1) q := by
cases c : tmRun M n (TCk.mk t0 (pos + 1 + n) q) with
| mk tp ps qq =>
rw [c] at h
have e1 : ps = pos + 1 := h.2.1
have e2 : qq = q := h.2.2
rw [e1, e2]
have hlast : Keep M q (symAt M t0 (pos + 1)) false := hk 0 (Nat.zero_lt_succ n)
have s := step_keep M (tmRun M n (TCk.mk t0 (pos + 1 + n) q)).tape t0 (pos + 1) q false h.1 hlast
show TEq M (tmStep M (tmRun M n (TCk.mk t0 (pos + 1 + n) q))).tape t0 /\
(tmStep M (tmRun M n (TCk.mk t0 (pos + 1 + n) q))).pos = pos /\
(tmStep M (tmRun M n (TCk.mk t0 (pos + 1 + n) q))).q = q
rw [e]
exact s
end Found.Pnp45
#print axioms Found.Pnp45.nthd_read
#print axioms Found.Pnp45.symAt_ext
#print axioms Found.Pnp45.tapeN_keep
#print axioms Found.Pnp45.teq_trans
#print axioms Found.Pnp45.step_keep
#print axioms Found.Pnp45.sweepR
#print axioms Found.Pnp45.sweepL
lean_all/found/Pnp46.lean
/-
T330 piece 46. found/Pnp46 -- a sweep followed by one writing step (CL3c, 4).
A push or pop on a register track is a sweep to the end of the register (Pnp45) and one
step that writes the end cell. This piece proves, for any machine M:
* tapeN_ext / step_ext / run_ext: runs from configurations agreeing on the tracks
0..k, with the same head and state, agree on the tracks 0..k, head and state;
* run_add: running a steps and then b steps is running a + b steps;
* sweep_step: after a sweep right over n cells (n steps), one more step does at
cell pos + n exactly what the machine does on the start tape there: the tape agrees
with tapeN of the start tape, the head and the state are posN and qN of it.
So a push or pop of one cell at the end of a register of length n costs n + 1 steps.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp45
namespace Found.Pnp46
open Found.Pnp12 (sel)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
variable (M : TMk)
theorem tapeN_ext (t u : Tape) (h : TEq M t u) (p : Nat) (q : List Bool) :
TEq M (tapeN M t p q) (tapeN M u p q) := by
intro j i hi
have es : symAt M t p = symAt M u p := symAt_ext M t u h p
show sel (Nat.beq j p) (Found.Pnp7.nthd (M.write q (symAt M t p)) i) (t j i) =
sel (Nat.beq j p) (Found.Pnp7.nthd (M.write q (symAt M u p)) i) (u j i)
rw [es]
cases Nat.beq j p with
| true => rfl
| false => exact h j i hi
/-- Agreement of configurations: tracks 0..k, head, state. -/
def CEq (c d : TCk) : Prop := TEq M c.tape d.tape /\ c.pos = d.pos /\ c.q = d.q
theorem step_ext (c d : TCk) (h : CEq M c d) : CEq M (tmStep M c) (tmStep M d) := by
cases c with
| mk t p q =>
cases d with
| mk u p' q' =>
have hp : p = p' := h.2.1
have hq : q = q' := h.2.2
subst hp; subst hq
have es : symAt M t p = symAt M u p := symAt_ext M t u h.1 p
refine And.intro (tapeN_ext M t u h.1 p q) (And.intro ?_ ?_)
· show Found.Pnp12.selN (M.right q (symAt M t p)) (p + 1) (p - 1) =
Found.Pnp12.selN (M.right q (symAt M u p)) (p + 1) (p - 1)
rw [es]
· show M.next q (symAt M t p) = M.next q (symAt M u p)
rw [es]
theorem run_ext (c d : TCk) (h : CEq M c d) : forall n, CEq M (tmRun M n c) (tmRun M n d) := by
intro n
induction n with
| zero => exact h
| succ n ih => exact step_ext M _ _ ih
theorem run_add (a : Nat) (c : TCk) : forall b, tmRun M b (tmRun M a c) = tmRun M (a + b) c := by
intro b
induction b with
| zero => rfl
| succ b ih =>
show tmStep M (tmRun M b (tmRun M a c)) = tmStep M (tmRun M (a + b) c)
rw [ih]
/-- A sweep right over n cells, then one step at cell pos + n: n + 1 steps. -/
theorem sweep_step (t0 : Tape) (pos n : Nat) (q : List Bool)
(hk : forall d, d < n -> Keep M q (symAt M t0 (pos + d)) true) :
CEq M (tmRun M (n + 1) (TCk.mk t0 pos q)) (tmStep M (TCk.mk t0 (pos + n) q)) := by
have h := sweepR M t0 pos q n hk
have hc : CEq M (tmRun M n (TCk.mk t0 pos q)) (TCk.mk t0 (pos + n) q) := h
exact step_ext M _ _ hc
end Found.Pnp46
#print axioms Found.Pnp46.tapeN_ext
#print axioms Found.Pnp46.step_ext
#print axioms Found.Pnp46.run_ext
#print axioms Found.Pnp46.run_add
#print axioms Found.Pnp46.sweep_step
lean_all/found/Pnp47.lean
/-
T330 piece 47. found/Pnp47 -- a register on two tracks and one push (CL3c, 5).
A register of the register machine (Pnp20) is kept on two tracks of the multi-track
machine (Pnp43): a "present" track a and a "value" track v. Lay t a v p xs says that
the cells p, p + 1, .. hold the bits xs on track v with track a true, and track a is
false on every cell from p + |xs| on. Proved, for any machine M:
* lay_present / lay_tail: track a is true on the |xs| cells of the list and false from
p + |xs| on;
* lay_ext / lay_teq: Lay only reads the tracks a and v;
* lay_snoc: writing a present bit and the value b at cell p + |xs| (and nothing else on
the tracks a, v) lays xs ++ [b];
* push_lay: if the machine in state q keeps itself and moves right on every symbol with
track a true, and at the first cell with track a false writes track a true and track
v = b, then after |xs| + 1 steps the tape lays xs ++ [b]: a push costs |xs| + 1 steps.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp46
namespace Found.Pnp47
open Found.Pnp7 (nthd)
open Found.Pnp12 (sel)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
/-- The bits xs on track v from cell p, track a true there and false from p + |xs| on. -/
def Lay (t : Tape) (a v : Nat) : Nat -> List Bool -> Prop
| p, [] => forall j, p <= j -> t j a = false
| p, x :: xs => t p a = true /\ t p v = x /\ Lay t a v (p + 1) xs
theorem shift (p n : Nat) : p + 1 + n = p + (n + 1) := by
rw [Nat.add_assoc, Nat.add_comm 1 n]
theorem lay_present (t : Tape) (a v : Nat) : forall (xs : List Bool) p, Lay t a v p xs ->
forall d, d < xs.length -> t (p + d) a = true := by
intro xs
induction xs with
| nil => intro p _ d hd; exact False.elim (Nat.not_lt_zero d hd)
| cons x xs ih =>
intro p h d hd
cases d with
| zero => exact h.1
| succ d =>
have r := ih (p + 1) h.2.2 d (Nat.lt_of_succ_lt_succ hd)
rw [shift] at r
exact r
theorem lay_tail (t : Tape) (a v : Nat) : forall (xs : List Bool) p, Lay t a v p xs ->
forall j, p + xs.length <= j -> t j a = false := by
intro xs
induction xs with
| nil => intro p h j hj; exact h j hj
| cons x xs ih =>
intro p h j hj
have e : p + (xs.length + 1) = p + 1 + xs.length := (shift p xs.length).symm
have hj' : p + 1 + xs.length <= j := by
have q : p + (x :: xs).length <= j := hj
exact (congrArg (fun m => m <= j) e).mp q
exact ih (p + 1) h.2.2 j hj'
theorem lay_ext (t u : Tape) (a v : Nat) (ha : forall j, u j a = t j a) (hv : forall j, u j v = t j v) :
forall (xs : List Bool) p, Lay t a v p xs -> Lay u a v p xs := by
intro xs
induction xs with
| nil => intro p h j hj; rw [ha j]; exact h j hj
| cons x xs ih =>
intro p h
refine And.intro ?_ (And.intro ?_ ?_)
· rw [ha p]; exact h.1
· rw [hv p]; exact h.2.1
· exact ih (p + 1) h.2.2
theorem lay_teq (M : TMk) (t u : Tape) (a v : Nat) (h : TEq M u t) (ha : a < M.k + 1) (hv : v < M.k + 1)
(xs : List Bool) (p : Nat) (hl : Lay t a v p xs) : Lay u a v p xs :=
lay_ext t u a v (fun j => h j a ha) (fun j => h j v hv) xs p hl
theorem lt_self_succ (p n : Nat) : p < p + (n + 1) :=
Nat.lt_succ_of_le (Nat.le_add_right p n)
theorem ne_of_lt' {a b : Nat} (h : a < b) : a = b -> False := by
intro e
rw [e] at h
exact Nat.lt_irrefl b h
/-- Writing the present bit and b at the end cell lays xs ++ [b]. -/
theorem lay_snoc (t u : Tape) (a v : Nat) (b : Bool) : forall (xs : List Bool) p, Lay t a v p xs ->
(forall j, (j = p + xs.length -> False) -> u j a = t j a /\ u j v = t j v) ->
u (p + xs.length) a = true -> u (p + xs.length) v = b ->
Lay u a v p (xs ++ [b]) := by
intro xs
induction xs with
| nil =>
intro p h hu h1 h2
refine And.intro h1 (And.intro h2 ?_)
intro j hj
have hne : j = p + 0 -> False := fun e => by
have q : p + 1 <= p := by rw [e] at hj; exact hj
exact Nat.not_succ_le_self p q
rw [(hu j hne).1]
exact h j (Nat.le_of_succ_le hj)
| cons x xs ih =>
intro p h hu h1 h2
have e : p + 1 + xs.length = p + (x :: xs).length := shift p xs.length
have hne : p = p + (x :: xs).length -> False := ne_of_lt' (lt_self_succ p xs.length)
refine And.intro ?_ (And.intro ?_ ?_)
· rw [(hu p hne).1]; exact h.1
· rw [(hu p hne).2]; exact h.2.1
· refine ih (p + 1) h.2.2 ?_ ?_ ?_
· intro j hj; rw [e] at hj; exact hu j hj
· rw [e]; exact h1
· rw [e]; exact h2
theorem beq_false_of_ne : forall a b : Nat, (a = b -> False) -> Nat.beq a b = false := by
intro a b h
cases e : Nat.beq a b with
| false => rfl
| true => exact False.elim (h (Found.Pnp2.beq_eq a b e))
theorem nthd_sym (M : TMk) (t : Tape) (j i : Nat) (hi : i < M.k + 1) : nthd (symAt M t j) i = t j i := by
have r := nthd_read (t j) (M.k + 1) 0 i hi
rw [Nat.zero_add] at r
exact r
/-- One push: |xs| + 1 steps. -/
theorem push_lay (M : TMk) (t0 : Tape) (a v p : Nat) (q : List Bool) (b : Bool) (xs : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v p xs)
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (p + xs.length))) a = true)
(hwv : nthd (M.write q (symAt M t0 (p + xs.length))) v = b) :
Lay (tmRun M (xs.length + 1) (TCk.mk t0 p q)).tape a v p (xs ++ [b]) := by
have hk : forall d, d < xs.length -> Keep M q (symAt M t0 (p + d)) true := by
intro d hd
apply hkeep
rw [nthd_sym M t0 (p + d) a ha]
exact lay_present t0 a v xs p hl d hd
have hc := sweep_step M t0 p xs.length q hk
have hu : Lay (tapeN M t0 (p + xs.length) q) a v p (xs ++ [b]) := by
refine lay_snoc t0 (tapeN M t0 (p + xs.length) q) a v b xs p hl ?_ ?_ ?_
· intro j hj
have e : Nat.beq j (p + xs.length) = false := beq_false_of_ne j (p + xs.length) hj
refine And.intro ?_ ?_
· show sel (Nat.beq j (p + xs.length)) _ (t0 j a) = t0 j a
rw [e]; rfl
· show sel (Nat.beq j (p + xs.length)) _ (t0 j v) = t0 j v
rw [e]; rfl
· show sel (Nat.beq (p + xs.length) (p + xs.length)) _ _ = true
rw [Found.Pnp10.beq_refl]; exact hwa
· show sel (Nat.beq (p + xs.length) (p + xs.length)) _ _ = b
rw [Found.Pnp10.beq_refl]; exact hwv
exact lay_teq M _ _ a v hc.1 ha hv (xs ++ [b]) p hu
end Found.Pnp47
#print axioms Found.Pnp47.shift
#print axioms Found.Pnp47.lay_present
#print axioms Found.Pnp47.lay_tail
#print axioms Found.Pnp47.lay_ext
#print axioms Found.Pnp47.lay_teq
#print axioms Found.Pnp47.lt_self_succ
#print axioms Found.Pnp47.ne_of_lt'
#print axioms Found.Pnp47.lay_snoc
#print axioms Found.Pnp47.beq_false_of_ne
#print axioms Found.Pnp47.nthd_sym
#print axioms Found.Pnp47.push_lay
lean_all/found/Pnp48.lean
/-
T330 piece 48. found/Pnp48 -- one pop from a register on two tracks (CL3c, 6).
The register of Pnp47 (Lay t a v p xs) is popped at its end cell: the head sweeps right
over the present cells, turns at the first absent cell, steps back and erases the last
present cell, reading its value. Proved, for any machine M:
* len_snoc: |ys ++ [b]| = |ys| + 1 (by induction, no library lemma);
* lay_last: Lay of ys ++ [b] has track a true and value b at cell p + |ys|;
* lay_unsnoc: erasing track a at the end cell of ys ++ [b] (nothing else changed on the
tracks a, v) lays ys;
* ceq_trans: agreement of configurations is transitive;
* pop_lay: if the machine in state q keeps itself and moves right on present cells,
turns left into state q1 at the first absent cell (writing it back), and in state q1
erases track a, then after |ys| + 3 steps the tape lays ys, the head is at the end cell
and the state is the next state of q1 on a symbol whose value bit is b.
So a pop costs |ys| + 3 steps. It relativizes (a tool; PNP_MAP.md).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp47
namespace Found.Pnp48
open Found.Pnp7 (nthd)
open Found.Pnp12 (sel selN)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
open Found.Pnp47
theorem len_snoc (b : Bool) : forall ys : List Bool, (ys ++ [b]).length = ys.length + 1 := by
intro ys
induction ys with
| nil => rfl
| cons y ys ih =>
show (ys ++ [b]).length + 1 = ys.length + 1 + 1
rw [ih]
theorem lay_last (t : Tape) (a v : Nat) (b : Bool) : forall (ys : List Bool) p,
Lay t a v p (ys ++ [b]) -> t (p + ys.length) a = true /\ t (p + ys.length) v = b := by
intro ys
induction ys with
| nil => intro p h; exact And.intro h.1 h.2.1
| cons y ys ih =>
intro p h
have r := ih (p + 1) h.2.2
have e : p + 1 + ys.length = p + (y :: ys).length := shift p ys.length
rw [e] at r
exact r
/-- p <= j and j different from p give p + 1 <= j (by cases on <=). -/
theorem succ_le_of_le_ne {p j : Nat} (h : p <= j) (hn : j = p -> False) : p + 1 <= j := by
cases h with
| refl => exact False.elim (hn rfl)
| step h' => exact Nat.succ_le_succ h'
/-- Erasing track a at the end cell of ys ++ [b] lays ys. -/
theorem lay_unsnoc (t u : Tape) (a v : Nat) (b : Bool) : forall (ys : List Bool) p,
Lay t a v p (ys ++ [b]) ->
(forall j, (j = p + ys.length -> False) -> u j a = t j a /\ u j v = t j v) ->
u (p + ys.length) a = false -> Lay u a v p ys := by
intro ys
induction ys with
| nil =>
intro p h hu h0 j hj
cases ej : Nat.beq j p with
| true =>
have e : j = p := Found.Pnp2.beq_eq j p ej
rw [e]; exact h0
| false =>
have hn : j = p -> False := fun e => by
rw [e, Found.Pnp10.beq_refl] at ej; exact Bool.noConfusion ej
have hn0 : j = p + 0 -> False := hn
rw [(hu j hn0).1]
exact h.2.2 j (succ_le_of_le_ne hj hn)
| cons y ys ih =>
intro p h hu h0
have e : p + 1 + ys.length = p + (y :: ys).length := shift p ys.length
have hne : p = p + (y :: ys).length -> False := ne_of_lt' (lt_self_succ p ys.length)
refine And.intro ?_ (And.intro ?_ ?_)
· rw [(hu p hne).1]; exact h.1
· rw [(hu p hne).2]; exact h.2.1
· refine ih (p + 1) h.2.2 ?_ ?_
· intro j hj; rw [e] at hj; exact hu j hj
· rw [e]; exact h0
theorem ceq_trans (M : TMk) (c d e : TCk) (h1 : CEq M c d) (h2 : CEq M d e) : CEq M c e :=
And.intro (teq_trans M _ _ _ h1.1 h2.1) (And.intro (h1.2.1.trans h2.2.1) (h1.2.2.trans h2.2.2))
/-- Turning left into q1, writing the cell back. -/
structure Turn (M : TMk) (q q1 : List Bool) (s : List Bool) : Prop where
nx : M.next q s = q1
wr : M.write q s = s
rt : M.right q s = false
/-- One pop: |ys| + 3 steps. -/
theorem pop_lay (M : TMk) (t0 : Tape) (a v p : Nat) (q q1 : List Bool) (b : Bool) (ys : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v p (ys ++ [b]))
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (p + (ys ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (p + ys.length))) a = false) :
Lay (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 p q)).tape a v p ys /\
(tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 p q)).pos =
selN (M.right q1 (symAt M t0 (p + ys.length))) (p + ys.length + 1) (p + ys.length - 1) /\
(tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 p q)).q = M.next q1 (symAt M t0 (p + ys.length)) /\
nthd (symAt M t0 (p + ys.length)) v = b := by
have hk : forall d, d < (ys ++ [b]).length -> Keep M q (symAt M t0 (p + d)) true := by
intro d hd
apply hkeep
rw [nthd_sym M t0 (p + d) a ha]
exact lay_present t0 a v (ys ++ [b]) p hl d hd
have h1 := sweep_step M t0 p (ys ++ [b]).length q hk
-- the turning step: back at cell p + |ys| in state q1, tape as at the start
have h2 : CEq M (tmStep M (TCk.mk t0 (p + (ys ++ [b]).length) q)) (TCk.mk t0 (p + ys.length) q1) := by
refine And.intro ?_ (And.intro ?_ ?_)
· exact tapeN_keep M t0 (p + (ys ++ [b]).length) q hturn.wr
· show selN (M.right q (symAt M t0 (p + (ys ++ [b]).length))) _ _ = p + ys.length
rw [hturn.rt]
show p + (ys ++ [b]).length - 1 = p + ys.length
rw [len_snoc b ys]
rfl
· exact hturn.nx
have h3 := step_ext M _ _ (ceq_trans M _ _ _ h1 h2)
have hu : Lay (tapeN M t0 (p + ys.length) q1) a v p ys := by
refine lay_unsnoc t0 (tapeN M t0 (p + ys.length) q1) a v b ys p hl ?_ ?_
· intro j hj
have e : Nat.beq j (p + ys.length) = false := beq_false_of_ne j (p + ys.length) hj
refine And.intro ?_ ?_
· show sel (Nat.beq j (p + ys.length)) _ (t0 j a) = t0 j a
rw [e]; rfl
· show sel (Nat.beq j (p + ys.length)) _ (t0 j v) = t0 j v
rw [e]; rfl
· show sel (Nat.beq (p + ys.length) (p + ys.length)) _ _ = false
rw [Found.Pnp10.beq_refl]; exact herase
refine And.intro (lay_teq M _ _ a v h3.1 ha hv ys p hu) (And.intro h3.2.1 (And.intro h3.2.2 ?_))
rw [nthd_sym M t0 (p + ys.length) v hv]
exact (lay_last t0 a v b ys p hl).2
end Found.Pnp48
#print axioms Found.Pnp48.len_snoc
#print axioms Found.Pnp48.lay_last
#print axioms Found.Pnp48.succ_le_of_le_ne
#print axioms Found.Pnp48.lay_unsnoc
#print axioms Found.Pnp48.ceq_trans
#print axioms Found.Pnp48.pop_lay
lean_all/found/Pnp49.lean
/-
T330 piece 49. found/Pnp49 -- a push that returns the head (CL3c, 7).
The register of Pnp47 starts at cell pos + 1, so the head can come back to cell pos after
an instruction. Proved, for any machine M:
* ret: in a state r that keeps itself and moves left on present cells, a head at
pos + n over n present cells pos + 1 .. pos + n comes back to pos in n steps, the
tape agreeing with the start;
* push_ret: a push as in Pnp47 whose writing step moves left into r, followed by the
return: after 2 |xs| + 1 steps the tape lays xs ++ [b] from pos + 1, the head is at
pos and the state is r.
So one push instruction, head back home, costs 2 |xs| + 1 steps.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp48
namespace Found.Pnp49
open Found.Pnp7 (nthd)
open Found.Pnp12 (selN)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
open Found.Pnp47
open Found.Pnp48
/-- The return: n steps left over n present cells. -/
theorem ret (M : TMk) (t : Tape) (a pos n : Nat) (r : List Bool) (ha : a < M.k + 1)
(hp : forall d, d < n -> t (pos + 1 + d) a = true)
(hkr : forall s, nthd s a = true -> Keep M r s false) :
CEq M (tmRun M n (TCk.mk t (pos + n) r)) (TCk.mk t pos r) := by
have h := sweepL M n t pos r (fun d hd => by
apply hkr
rw [nthd_sym M t (pos + 1 + d) a ha]
exact hp d hd)
exact h
/-- A push with the head back at pos: 2 |xs| + 1 steps. -/
theorem push_ret (M : TMk) (t0 : Tape) (a v pos : Nat) (q r : List Bool) (b : Bool) (xs : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v (pos + 1) xs)
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) a = true)
(hwv : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) v = b)
(hrt : M.right q (symAt M t0 (pos + 1 + xs.length)) = false)
(hnx : M.next q (symAt M t0 (pos + 1 + xs.length)) = r)
(hkr : forall s, nthd s a = true -> Keep M r s false) :
Lay (tmRun M (xs.length + 1 + xs.length) (TCk.mk t0 (pos + 1) q)).tape a v (pos + 1) (xs ++ [b]) /\
(tmRun M (xs.length + 1 + xs.length) (TCk.mk t0 (pos + 1) q)).pos = pos /\
(tmRun M (xs.length + 1 + xs.length) (TCk.mk t0 (pos + 1) q)).q = r := by
have hl1 := push_lay M t0 a v (pos + 1) q b xs ha hv hl hkeep hwa hwv
have hk : forall d, d < xs.length -> Keep M q (symAt M t0 (pos + 1 + d)) true := by
intro d hd
apply hkeep
rw [nthd_sym M t0 (pos + 1 + d) a ha]
exact lay_present t0 a v xs (pos + 1) hl d hd
have hc := sweep_step M t0 (pos + 1) xs.length q hk
-- d1: the configuration after the push
have hpos : (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).pos = pos + xs.length := by
rw [hc.2.1]
show selN (M.right q (symAt M t0 (pos + 1 + xs.length))) _ _ = pos + xs.length
rw [hrt]
show pos + 1 + xs.length - 1 = pos + xs.length
rw [Nat.add_right_comm pos 1 xs.length]
rfl
have hq : (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).q = r := by
rw [hc.2.2]; exact hnx
have hd1 : CEq M (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q))
(TCk.mk (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + xs.length) r) :=
And.intro (fun _ _ _ => rfl) (And.intro hpos hq)
have hp : forall d, d < xs.length ->
(tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + 1 + d) a = true := by
intro d hd
have hd' : d < (xs ++ [b]).length := by
rw [len_snoc b xs]; exact Nat.lt_succ_of_lt hd
exact lay_present _ a v (xs ++ [b]) (pos + 1) hl1 d hd'
have h2 := ret M (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).tape a pos xs.length r ha hp hkr
have h3 := ceq_trans M _ _ _ (run_ext M _ _ hd1 xs.length) h2
rw [(run_add M (xs.length + 1) (TCk.mk t0 (pos + 1) q) xs.length).symm]
refine And.intro ?_ (And.intro h3.2.1 h3.2.2)
exact lay_teq M _ _ a v h3.1 ha hv (xs ++ [b]) (pos + 1) hl1
end Found.Pnp49
#print axioms Found.Pnp49.ret
#print axioms Found.Pnp49.push_ret
lean_all/found/Pnp5.lean
/-
T330 piece 5. found/Pnp5 -- Tseitin translation: formula satisfiability reduces to CNF
satisfiability (the circuit-to-CNF step of Cook-Levin; structure side, a tool).
Variables are inputs (inl i) or subformulas (inr G): the gate variable of G is G itself,
so equal subformulas share one variable and no freshness argument is needed. Every node
gives at most three clauses of at most three literals, so the CNF is linear in the
formula. Proved:
* soundness: an assignment satisfying F extends (gate G := its value) to one
satisfying the CNF;
* completeness: any assignment satisfying the gate clauses gives each gate variable
the value of its subformula on the inputs;
* F is satisfiable iff its Tseitin CNF is.
It relativizes (a tool only; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp1
namespace Found.Pnp5
open Found.Pnp1
abbrev V := Sum Nat Fm
abbrev Lit := Bool × V
abbrev Clause := List Lit
abbrev CNF := List Clause
def evalLit (b : V -> Bool) (l : Lit) : Bool :=
match l.1 with
| true => b l.2
| false => !(b l.2)
def evalC (b : V -> Bool) : Clause -> Bool
| [] => false
| l :: c => evalLit b l || evalC b c
def evalF (b : V -> Bool) : CNF -> Bool
| [] => true
| c :: f => evalC b c && evalF b f
/-- The clauses of one node: the gate variable equals the operation on the children. -/
def loc : Fm -> CNF
| .var i => [[(false, .inr (.var i)), (true, .inl i)], [(true, .inr (.var i)), (false, .inl i)]]
| .cst true => [[(true, .inr (.cst true))]]
| .cst false => [[(false, .inr (.cst false))]]
| .neg f => [[(false, .inr (.neg f)), (false, .inr f)], [(true, .inr (.neg f)), (true, .inr f)]]
| .and f h => [[(false, .inr (.and f h)), (true, .inr f)], [(false, .inr (.and f h)), (true, .inr h)],
[(true, .inr (.and f h)), (false, .inr f), (false, .inr h)]]
| .or f h => [[(true, .inr (.or f h)), (false, .inr f)], [(true, .inr (.or f h)), (false, .inr h)],
[(false, .inr (.or f h)), (true, .inr f), (true, .inr h)]]
/-- The Tseitin clauses of all nodes. -/
def tse : Fm -> CNF
| .var i => loc (.var i)
| .cst c => loc (.cst c)
| .neg f => loc (.neg f) ++ tse f
| .and f h => loc (.and f h) ++ (tse f ++ tse h)
| .or f h => loc (.or f h) ++ (tse f ++ tse h)
/-- The Tseitin CNF of F: the output gate is true, and all gate clauses hold. -/
def full (F : Fm) : CNF := [[(true, .inr F)]] ++ tse F
/-! ## Bool facts -/
theorem and_assoc' (x y z : Bool) : ((x && y) && z) = (x && (y && z)) := by
cases x <;> rfl
theorem and_l {x y : Bool} (h : (x && y) = true) : x = true := by
cases x with
| true => rfl
| false => exact Bool.noConfusion h
theorem and_r {x y : Bool} (h : (x && y) = true) : y = true := by
cases x with
| true => exact h
| false => exact Bool.noConfusion h
theorem and_tt {x y : Bool} (hx : x = true) (hy : y = true) : (x && y) = true := by
subst hx; subst hy; rfl
theorem evalF_append (b : V -> Bool) (B : CNF) : forall A : CNF,
evalF b (A ++ B) = (evalF b A && evalF b B) := by
intro A
induction A with
| nil => rfl
| cons c A ih =>
show (evalC b c && evalF b (A ++ B)) = ((evalC b c && evalF b A) && evalF b B)
rw [ih, and_assoc']
/-! ## Local clauses as Bool functions -/
def locEq (g x : Bool) : Bool := (!g || (x || false)) && ((g || (!x || false)) && true)
def locT (g : Bool) : Bool := (g || false) && true
def locF (g : Bool) : Bool := (!g || false) && true
def locNeg (g x : Bool) : Bool := (!g || (!x || false)) && ((g || (x || false)) && true)
def locAnd (g x y : Bool) : Bool :=
(!g || (x || false)) && ((!g || (y || false)) && ((g || (!x || (!y || false))) && true))
def locOr (g x y : Bool) : Bool :=
(g || (!x || false)) && ((g || (!y || false)) && ((!g || (x || (y || false))) && true))
theorem locEq_ok (x : Bool) : locEq x x = true := by cases x <;> rfl
theorem locNeg_ok (x : Bool) : locNeg (!x) x = true := by cases x <;> rfl
theorem locAnd_ok (x y : Bool) : locAnd (x && y) x y = true := by cases x <;> cases y <;> rfl
theorem locOr_ok (x y : Bool) : locOr (x || y) x y = true := by cases x <;> cases y <;> rfl
theorem locEq_inv (g x : Bool) (h : locEq g x = true) : g = x := by
cases g <;> cases x <;> first | rfl | exact Bool.noConfusion h
theorem locT_inv (g : Bool) (h : locT g = true) : g = true := by
cases g <;> first | rfl | exact Bool.noConfusion h
theorem locF_inv (g : Bool) (h : locF g = true) : g = false := by
cases g <;> first | rfl | exact Bool.noConfusion h
theorem locNeg_inv (g x : Bool) (h : locNeg g x = true) : g = !x := by
cases g <;> cases x <;> first | rfl | exact Bool.noConfusion h
theorem locAnd_inv (g x y : Bool) (h : locAnd g x y = true) : g = (x && y) := by
cases g <;> cases x <;> cases y <;> first | rfl | exact Bool.noConfusion h
theorem locOr_inv (g x y : Bool) (h : locOr g x y = true) : g = (x || y) := by
cases g <;> cases x <;> cases y <;> first | rfl | exact Bool.noConfusion h
/-! ## Soundness -/
/-- The extended assignment: inputs from a, each gate its value. -/
def ext (a : Nat -> Bool) : V -> Bool
| .inl i => a i
| .inr G => ev a G
theorem sound (a : Nat -> Bool) : forall G : Fm, evalF (ext a) (tse G) = true := by
intro G
induction G with
| var i => exact locEq_ok (a i)
| cst c => cases c with
| true => rfl
| false => rfl
| neg f ih =>
show evalF (ext a) (loc (.neg f) ++ tse f) = true
rw [evalF_append]
exact and_tt (locNeg_ok (ev a f)) ih
| and f h ihf ihh =>
show evalF (ext a) (loc (.and f h) ++ (tse f ++ tse h)) = true
rw [evalF_append, evalF_append]
exact and_tt (locAnd_ok (ev a f) (ev a h)) (and_tt ihf ihh)
| or f h ihf ihh =>
show evalF (ext a) (loc (.or f h) ++ (tse f ++ tse h)) = true
rw [evalF_append, evalF_append]
exact and_tt (locOr_ok (ev a f) (ev a h)) (and_tt ihf ihh)
/-! ## Completeness -/
theorem complete (b : V -> Bool) : forall G : Fm, evalF b (tse G) = true ->
b (.inr G) = ev (fun i => b (.inl i)) G := by
intro G
induction G with
| var i => intro h; exact locEq_inv _ _ h
| cst c => cases c with
| true => intro h; exact locT_inv _ h
| false => intro h; exact locF_inv _ h
| neg f ih =>
intro h
have h' : (evalF b (loc (.neg f)) && evalF b (tse f)) = true :=
(evalF_append b (tse f) (loc (.neg f))).symm.trans h
have e : b (.inr (.neg f)) = !(b (.inr f)) := locNeg_inv _ _ (and_l h')
rw [ih (and_r h')] at e
exact e
| and f g ihf ihg =>
intro h
have h1 : (evalF b (loc (.and f g)) && evalF b (tse f ++ tse g)) = true :=
(evalF_append b (tse f ++ tse g) (loc (.and f g))).symm.trans h
have h2 : (evalF b (tse f) && evalF b (tse g)) = true :=
(evalF_append b (tse g) (tse f)).symm.trans (and_r h1)
have e : b (.inr (.and f g)) = (b (.inr f) && b (.inr g)) := locAnd_inv _ _ _ (and_l h1)
rw [ihf (and_l h2), ihg (and_r h2)] at e
exact e
| or f g ihf ihg =>
intro h
have h1 : (evalF b (loc (.or f g)) && evalF b (tse f ++ tse g)) = true :=
(evalF_append b (tse f ++ tse g) (loc (.or f g))).symm.trans h
have h2 : (evalF b (tse f) && evalF b (tse g)) = true :=
(evalF_append b (tse g) (tse f)).symm.trans (and_r h1)
have e : b (.inr (.or f g)) = (b (.inr f) || b (.inr g)) := locOr_inv _ _ _ (and_l h1)
rw [ihf (and_l h2), ihg (and_r h2)] at e
exact e
/-! ## The reduction -/
theorem tseitin (F : Fm) :
((Exists fun a : Nat -> Bool => ev a F = true) ->
Exists fun b : V -> Bool => evalF b (full F) = true) /\
((Exists fun b : V -> Bool => evalF b (full F) = true) ->
Exists fun a : Nat -> Bool => ev a F = true) := by
apply And.intro
· intro h
exact Exists.elim h fun a ha => Exists.intro (ext a) (by
show ((ext a (.inr F) || false) && evalF (ext a) (tse F)) = true
exact and_tt ((or_false' (ev a F)).trans ha) (sound a F))
· intro h
exact Exists.elim h fun b hb => by
have hb' : ((b (.inr F) || false) && evalF b (tse F)) = true := hb
have h2 : b (.inr F) = true := (or_false' (b (.inr F))).symm.trans (and_l hb')
exact Exists.intro (fun i => b (.inl i)) ((complete b F (and_r hb')).symm.trans h2)
end Found.Pnp5
#print axioms Found.Pnp5.and_assoc'
#print axioms Found.Pnp5.and_l
#print axioms Found.Pnp5.and_r
#print axioms Found.Pnp5.and_tt
#print axioms Found.Pnp5.evalF_append
#print axioms Found.Pnp5.locEq_ok
#print axioms Found.Pnp5.locNeg_ok
#print axioms Found.Pnp5.locAnd_ok
#print axioms Found.Pnp5.locOr_ok
#print axioms Found.Pnp5.locEq_inv
#print axioms Found.Pnp5.locT_inv
#print axioms Found.Pnp5.locF_inv
#print axioms Found.Pnp5.locNeg_inv
#print axioms Found.Pnp5.locAnd_inv
#print axioms Found.Pnp5.locOr_inv
#print axioms Found.Pnp5.sound
#print axioms Found.Pnp5.complete
#print axioms Found.Pnp5.tseitin
lean_all/found/Pnp50.lean
/-
T330 piece 50. found/Pnp50 -- pops that return the head (CL3c, 8).
The pop instruction of the register machine (Pnp20) jumps on what it finds: empty, 0 or
1. On the two-track register of Pnp47 starting at cell pos + 1, for any machine M:
* pop_empty: if the register is empty, one step that turns left from cell pos + 1 into
a state e (writing the cell back) leaves the head at pos in state e, the register
still empty: 1 step;
* pop_ret: if the register holds ys ++ [b], the pop of Pnp48 whose erasing step moves
left, followed by the return of Pnp49 in the state r1 the erasing step chose (which
may depend on b): after |ys ++ [b]| + 2 + |ys| steps the tape lays ys from pos + 1,
the head is at pos, the state is r1, and b is the value read.
So one pop instruction, head back home, costs at most 2 |ys| + 3 steps.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp49
namespace Found.Pnp50
open Found.Pnp7 (nthd)
open Found.Pnp12 (selN)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
open Found.Pnp47
open Found.Pnp48
open Found.Pnp49
/-- Pop on an empty register: 1 step. -/
theorem pop_empty (M : TMk) (t0 : Tape) (a v pos : Nat) (q e : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v (pos + 1) [])
(hturn : Turn M q e (symAt M t0 (pos + 1))) :
Lay (tmRun M 1 (TCk.mk t0 (pos + 1) q)).tape a v (pos + 1) [] /\
(tmRun M 1 (TCk.mk t0 (pos + 1) q)).pos = pos /\
(tmRun M 1 (TCk.mk t0 (pos + 1) q)).q = e := by
have h : CEq M (tmStep M (TCk.mk t0 (pos + 1) q)) (TCk.mk t0 pos e) := by
refine And.intro ?_ (And.intro ?_ ?_)
· exact tapeN_keep M t0 (pos + 1) q hturn.wr
· show selN (M.right q (symAt M t0 (pos + 1))) _ _ = pos
rw [hturn.rt]
rfl
· exact hturn.nx
exact And.intro (lay_teq M _ _ a v h.1 ha hv [] (pos + 1) hl) (And.intro h.2.1 h.2.2)
/-- Pop of ys ++ [b] with the head back at pos. -/
theorem pop_ret (M : TMk) (t0 : Tape) (a v pos : Nat) (q q1 : List Bool) (b : Bool) (ys : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v (pos + 1) (ys ++ [b]))
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (pos + 1 + (ys ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (pos + 1 + ys.length))) a = false)
(hrt : M.right q1 (symAt M t0 (pos + 1 + ys.length)) = false)
(hkr : forall s, nthd s a = true -> Keep M (M.next q1 (symAt M t0 (pos + 1 + ys.length))) s false) :
Lay (tmRun M ((ys ++ [b]).length + 1 + 1 + ys.length) (TCk.mk t0 (pos + 1) q)).tape a v (pos + 1) ys /\
(tmRun M ((ys ++ [b]).length + 1 + 1 + ys.length) (TCk.mk t0 (pos + 1) q)).pos = pos /\
(tmRun M ((ys ++ [b]).length + 1 + 1 + ys.length) (TCk.mk t0 (pos + 1) q)).q =
M.next q1 (symAt M t0 (pos + 1 + ys.length)) /\
nthd (symAt M t0 (pos + 1 + ys.length)) v = b := by
have h := pop_lay M t0 a v (pos + 1) q q1 b ys ha hv hl hkeep hturn herase
have hpos : (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q)).pos = pos + ys.length := by
rw [h.2.1, hrt]
show pos + 1 + ys.length - 1 = pos + ys.length
rw [Nat.add_right_comm pos 1 ys.length]
rfl
have hd1 : CEq M (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q))
(TCk.mk (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + ys.length)
(M.next q1 (symAt M t0 (pos + 1 + ys.length)))) :=
And.intro (fun _ _ _ => rfl) (And.intro hpos h.2.2.1)
have hp : forall d, d < ys.length ->
(tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + 1 + d) a = true :=
fun d hd => lay_present _ a v ys (pos + 1) h.1 d hd
have h2 := ret M _ a pos ys.length _ ha hp hkr
have h3 := ceq_trans M _ _ _ (run_ext M _ _ hd1 ys.length) h2
rw [(run_add M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q) ys.length).symm]
exact And.intro (lay_teq M _ _ a v h3.1 ha hv ys (pos + 1) h.1)
(And.intro h3.2.1 (And.intro h3.2.2 h.2.2.2))
end Found.Pnp50
#print axioms Found.Pnp50.pop_empty
#print axioms Found.Pnp50.pop_ret
lean_all/found/Pnp51.lean
/-
T330 piece 51. found/Pnp51 -- push and pop leave the other registers alone (CL3c, 9).
The sweeps of a push or pop write every cell back; only one step writes. So the whole
instruction changes the tape exactly as that one step does. Proved, for any machine M:
* push_tape: after the push of Pnp49 (2 |xs| + 1 steps) the tape agrees on all tracks
with tapeN of the start tape at the end cell pos + 1 + |xs| in state q;
* pop_tape: after the pop of Pnp50 the tape agrees on all tracks with tapeN of the
start tape at the cell pos + 1 + |ys| in state q1;
* lay_other: a register on tracks a', v' is kept by tapeN at a cell where the writing
leaves the bits a', v' of the symbol as they were;
* push_other / pop_other: hence a register on other tracks is kept by a whole push or
pop instruction, when the one writing step leaves its two bits alone.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp50
namespace Found.Pnp51
open Found.Pnp7 (nthd)
open Found.Pnp12 (sel selN)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
open Found.Pnp47
open Found.Pnp48
open Found.Pnp49
/-- tapeN keeps a track at every cell when the write keeps that bit of the symbol. -/
theorem tapeN_track (M : TMk) (t : Tape) (c : Nat) (q : List Bool) (i : Nat) (hi : i < M.k + 1)
(hw : nthd (M.write q (symAt M t c)) i = nthd (symAt M t c) i) :
forall j, tapeN M t c q j i = t j i := by
intro j
show sel (Nat.beq j c) (nthd (M.write q (symAt M t c)) i) (t j i) = t j i
cases e : Nat.beq j c with
| false => rfl
| true =>
have ej : j = c := Found.Pnp2.beq_eq j c e
rw [ej]
show nthd (M.write q (symAt M t c)) i = t c i
rw [hw]
exact nthd_sym M t c i hi
theorem lay_other (M : TMk) (t : Tape) (c : Nat) (q : List Bool) (a v p : Nat) (zs : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t a v p zs)
(hwa : nthd (M.write q (symAt M t c)) a = nthd (symAt M t c) a)
(hwv : nthd (M.write q (symAt M t c)) v = nthd (symAt M t c) v) :
Lay (tapeN M t c q) a v p zs :=
lay_ext t (tapeN M t c q) a v (tapeN_track M t c q a ha hwa) (tapeN_track M t c q v hv hwv) zs p hl
theorem push_tape (M : TMk) (t0 : Tape) (a v pos : Nat) (q r : List Bool) (xs : List Bool)
(ha : a < M.k + 1) (hl : Lay t0 a v (pos + 1) xs) (b : Bool) (hv : v < M.k + 1)
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) a = true)
(hwv : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) v = b)
(hrt : M.right q (symAt M t0 (pos + 1 + xs.length)) = false)
(hnx : M.next q (symAt M t0 (pos + 1 + xs.length)) = r)
(hkr : forall s, nthd s a = true -> Keep M r s false) :
TEq M (tmRun M (xs.length + 1 + xs.length) (TCk.mk t0 (pos + 1) q)).tape
(tapeN M t0 (pos + 1 + xs.length) q) := by
have hl1 := push_lay M t0 a v (pos + 1) q b xs ha hv hl hkeep hwa hwv
have hk : forall d, d < xs.length -> Keep M q (symAt M t0 (pos + 1 + d)) true := by
intro d hd
apply hkeep
rw [nthd_sym M t0 (pos + 1 + d) a ha]
exact lay_present t0 a v xs (pos + 1) hl d hd
have hc := sweep_step M t0 (pos + 1) xs.length q hk
have hpos : (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).pos = pos + xs.length := by
rw [hc.2.1]
show selN (M.right q (symAt M t0 (pos + 1 + xs.length))) _ _ = pos + xs.length
rw [hrt]
show pos + 1 + xs.length - 1 = pos + xs.length
rw [Nat.add_right_comm pos 1 xs.length]
rfl
have hq : (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).q = r := by
rw [hc.2.2]; exact hnx
have hd1 : CEq M (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q))
(TCk.mk (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + xs.length) r) :=
And.intro (fun _ _ _ => rfl) (And.intro hpos hq)
have hp : forall d, d < xs.length ->
(tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + 1 + d) a = true := by
intro d hd
have hd' : d < (xs ++ [b]).length := by
rw [len_snoc b xs]; exact Nat.lt_succ_of_lt hd
exact lay_present _ a v (xs ++ [b]) (pos + 1) hl1 d hd'
have h2 := ret M (tmRun M (xs.length + 1) (TCk.mk t0 (pos + 1) q)).tape a pos xs.length r ha hp hkr
have h3 := ceq_trans M _ _ _ (run_ext M _ _ hd1 xs.length) h2
rw [(run_add M (xs.length + 1) (TCk.mk t0 (pos + 1) q) xs.length).symm]
exact teq_trans M _ _ _ h3.1 hc.1
theorem pop_tape (M : TMk) (t0 : Tape) (a v pos : Nat) (q q1 : List Bool) (b : Bool) (ys : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v (pos + 1) (ys ++ [b]))
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (pos + 1 + (ys ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (pos + 1 + ys.length))) a = false)
(hrt : M.right q1 (symAt M t0 (pos + 1 + ys.length)) = false)
(hkr : forall s, nthd s a = true -> Keep M (M.next q1 (symAt M t0 (pos + 1 + ys.length))) s false) :
TEq M (tmRun M ((ys ++ [b]).length + 1 + 1 + ys.length) (TCk.mk t0 (pos + 1) q)).tape
(tapeN M t0 (pos + 1 + ys.length) q1) := by
have h := pop_lay M t0 a v (pos + 1) q q1 b ys ha hv hl hkeep hturn herase
have hk : forall d, d < (ys ++ [b]).length -> Keep M q (symAt M t0 (pos + 1 + d)) true := by
intro d hd
apply hkeep
rw [nthd_sym M t0 (pos + 1 + d) a ha]
exact lay_present t0 a v (ys ++ [b]) (pos + 1) hl d hd
have h1 := sweep_step M t0 (pos + 1) (ys ++ [b]).length q hk
have h2 : CEq M (tmStep M (TCk.mk t0 (pos + 1 + (ys ++ [b]).length) q)) (TCk.mk t0 (pos + 1 + ys.length) q1) := by
refine And.intro ?_ (And.intro ?_ ?_)
· exact tapeN_keep M t0 (pos + 1 + (ys ++ [b]).length) q hturn.wr
· show selN (M.right q (symAt M t0 (pos + 1 + (ys ++ [b]).length))) _ _ = pos + 1 + ys.length
rw [hturn.rt]
show pos + 1 + (ys ++ [b]).length - 1 = pos + 1 + ys.length
rw [len_snoc b ys]
rfl
· exact hturn.nx
have h3 := step_ext M _ _ (ceq_trans M _ _ _ h1 h2)
have hpos : (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q)).pos = pos + ys.length := by
rw [h.2.1, hrt]
show pos + 1 + ys.length - 1 = pos + ys.length
rw [Nat.add_right_comm pos 1 ys.length]
rfl
have hd1 : CEq M (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q))
(TCk.mk (tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + ys.length)
(M.next q1 (symAt M t0 (pos + 1 + ys.length)))) :=
And.intro (fun _ _ _ => rfl) (And.intro hpos h.2.2.1)
have hp : forall d, d < ys.length ->
(tmRun M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q)).tape (pos + 1 + d) a = true :=
fun d hd => lay_present _ a v ys (pos + 1) h.1 d hd
have h4 := ret M _ a pos ys.length _ ha hp hkr
have h5 := ceq_trans M _ _ _ (run_ext M _ _ hd1 ys.length) h4
rw [(run_add M ((ys ++ [b]).length + 1 + 1) (TCk.mk t0 (pos + 1) q) ys.length).symm]
exact teq_trans M _ _ _ h5.1 h3.1
theorem push_other (M : TMk) (t0 : Tape) (a v pos : Nat) (q r : List Bool) (xs : List Bool)
(ha : a < M.k + 1) (hl : Lay t0 a v (pos + 1) xs) (b : Bool) (hv : v < M.k + 1)
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) a = true)
(hwv : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) v = b)
(hrt : M.right q (symAt M t0 (pos + 1 + xs.length)) = false)
(hnx : M.next q (symAt M t0 (pos + 1 + xs.length)) = r)
(hkr : forall s, nthd s a = true -> Keep M r s false)
(a' v' p' : Nat) (zs : List Bool) (ha' : a' < M.k + 1) (hv' : v' < M.k + 1) (hz : Lay t0 a' v' p' zs)
(hwa' : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) a' = nthd (symAt M t0 (pos + 1 + xs.length)) a')
(hwv' : nthd (M.write q (symAt M t0 (pos + 1 + xs.length))) v' = nthd (symAt M t0 (pos + 1 + xs.length)) v') :
Lay (tmRun M (xs.length + 1 + xs.length) (TCk.mk t0 (pos + 1) q)).tape a' v' p' zs :=
lay_teq M _ _ a' v' (push_tape M t0 a v pos q r xs ha hl b hv hkeep hwa hwv hrt hnx hkr) ha' hv' zs p'
(lay_other M t0 _ q a' v' p' zs ha' hv' hz hwa' hwv')
theorem pop_other (M : TMk) (t0 : Tape) (a v pos : Nat) (q q1 : List Bool) (b : Bool) (ys : List Bool)
(ha : a < M.k + 1) (hv : v < M.k + 1) (hl : Lay t0 a v (pos + 1) (ys ++ [b]))
(hkeep : forall s, nthd s a = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (pos + 1 + (ys ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (pos + 1 + ys.length))) a = false)
(hrt : M.right q1 (symAt M t0 (pos + 1 + ys.length)) = false)
(hkr : forall s, nthd s a = true -> Keep M (M.next q1 (symAt M t0 (pos + 1 + ys.length))) s false)
(a' v' p' : Nat) (zs : List Bool) (ha' : a' < M.k + 1) (hv' : v' < M.k + 1) (hz : Lay t0 a' v' p' zs)
(hwa' : nthd (M.write q1 (symAt M t0 (pos + 1 + ys.length))) a' = nthd (symAt M t0 (pos + 1 + ys.length)) a')
(hwv' : nthd (M.write q1 (symAt M t0 (pos + 1 + ys.length))) v' = nthd (symAt M t0 (pos + 1 + ys.length)) v') :
Lay (tmRun M ((ys ++ [b]).length + 1 + 1 + ys.length) (TCk.mk t0 (pos + 1) q)).tape a' v' p' zs :=
lay_teq M _ _ a' v' (pop_tape M t0 a v pos q q1 b ys ha hv hl hkeep hturn herase hrt hkr) ha' hv' zs p'
(lay_other M t0 _ q1 a' v' p' zs ha' hv' hz hwa' hwv')
end Found.Pnp51
#print axioms Found.Pnp51.tapeN_track
#print axioms Found.Pnp51.lay_other
#print axioms Found.Pnp51.push_tape
#print axioms Found.Pnp51.pop_tape
#print axioms Found.Pnp51.push_other
#print axioms Found.Pnp51.pop_other
lean_all/found/Pnp52.lean
/-
T330 piece 52. found/Pnp52 -- register machine instructions on the track machine (CL3c, 10).
The registers of the register machine (Pnp20) are kept on the tracks of the multi-track
machine (Pnp43): register i on the tracks A i (present) and V i (value), from cell 1,
stored reversed (rv), so that the top of the register is the last laid cell. The head is
at home cell 0 between instructions. Proved, for any machine M and track maps A, V:
* rv_len: the stored list has the length of the register;
* push_sim: a push of b on register rr (the push of Pnp49, 2 |x rr| + 1 steps) lays
every register i < R as rv of the register after Pnp20's push instruction;
* pop_empty_sim: a pop on an empty register (1 step) keeps every register, as Pnp20's
pop does on an empty register;
* pop_cons_sim: a pop on a register holding b :: tl (the pop of Pnp50) lays every
register as rv of the register after Pnp20's pop, and the bit read is b.
The other registers are kept when the one writing step of the instruction leaves their
two tracks alone (Pnp51).
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp51
import found.Pnp20
namespace Found.Pnp52
open Found.Pnp7 (nthd)
open Found.Pnp20 (upd upd_same upd_other)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
open Found.Pnp47
open Found.Pnp48
open Found.Pnp49
open Found.Pnp50
open Found.Pnp51
/-- Reverse, by structural recursion: the top of a register is the last cell. -/
def rv : List Bool -> List Bool
| [] => []
| b :: l => rv l ++ [b]
theorem rv_len : forall l : List Bool, (rv l).length = l.length := by
intro l
induction l with
| nil => rfl
| cons b l ih =>
show (rv l ++ [b]).length = l.length + 1
rw [len_snoc b (rv l), ih]
/-- All registers below R laid on their tracks from cell 1. -/
def Regs (t : Tape) (A V : Nat -> Nat) (R : Nat) (x : Nat -> List Bool) : Prop :=
forall i, i < R -> Lay t (A i) (V i) (0 + 1) (rv (x i))
/-- Push of b on register rr. -/
theorem push_sim (M : TMk) (A V : Nat -> Nat) (R : Nat) (x : Nat -> List Bool) (t0 : Tape)
(q r : List Bool) (rr : Nat) (b : Bool) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : Regs t0 A V R x)
(hkeep : forall s, nthd s (A rr) = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (0 + 1 + (rv (x rr)).length))) (A rr) = true)
(hwv : nthd (M.write q (symAt M t0 (0 + 1 + (rv (x rr)).length))) (V rr) = b)
(hrt : M.right q (symAt M t0 (0 + 1 + (rv (x rr)).length)) = false)
(hnx : M.next q (symAt M t0 (0 + 1 + (rv (x rr)).length)) = r)
(hkr : forall s, nthd s (A rr) = true -> Keep M r s false)
(hoth : forall i, i < R -> Nat.beq i rr = false ->
nthd (M.write q (symAt M t0 (0 + 1 + (rv (x rr)).length))) (A i) =
nthd (symAt M t0 (0 + 1 + (rv (x rr)).length)) (A i) /\
nthd (M.write q (symAt M t0 (0 + 1 + (rv (x rr)).length))) (V i) =
nthd (symAt M t0 (0 + 1 + (rv (x rr)).length)) (V i)) :
Regs (tmRun M ((rv (x rr)).length + 1 + (rv (x rr)).length) (TCk.mk t0 (0 + 1) q)).tape A V R
(upd x rr (b :: x rr)) /\
(tmRun M ((rv (x rr)).length + 1 + (rv (x rr)).length) (TCk.mk t0 (0 + 1) q)).pos = 0 /\
(tmRun M ((rv (x rr)).length + 1 + (rv (x rr)).length) (TCk.mk t0 (0 + 1) q)).q = r := by
have hp := push_ret M t0 (A rr) (V rr) 0 q r b (rv (x rr)) (hAV rr hR).1 (hAV rr hR).2 (hl rr hR)
hkeep hwa hwv hrt hnx hkr
refine And.intro ?_ (And.intro hp.2.1 hp.2.2)
intro i hi
cases e : Nat.beq i rr with
| true =>
have ei : i = rr := Found.Pnp2.beq_eq i rr e
rw [ei, upd_same]
exact hp.1
| false =>
rw [upd_other x rr i _ e]
exact push_other M t0 (A rr) (V rr) 0 q r (rv (x rr)) (hAV rr hR).1 (hl rr hR) b (hAV rr hR).2
hkeep hwa hwv hrt hnx hkr (A i) (V i) (0 + 1) (rv (x i)) (hAV i hi).1 (hAV i hi).2 (hl i hi)
(hoth i hi e).1 (hoth i hi e).2
/-- Pop on an empty register rr: every register kept, 1 step. -/
theorem pop_empty_sim (M : TMk) (A V : Nat -> Nat) (R : Nat) (x : Nat -> List Bool) (t0 : Tape)
(q e : List Bool) (rr : Nat) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : Regs t0 A V R x) (hx : x rr = [])
(hturn : Turn M q e (symAt M t0 (0 + 1))) :
Regs (tmRun M 1 (TCk.mk t0 (0 + 1) q)).tape A V R x /\
(tmRun M 1 (TCk.mk t0 (0 + 1) q)).pos = 0 /\
(tmRun M 1 (TCk.mk t0 (0 + 1) q)).q = e := by
have hrr : Lay t0 (A rr) (V rr) (0 + 1) [] := by
have h := hl rr hR
rw [hx] at h
exact h
have hp := pop_empty M t0 (A rr) (V rr) 0 q e (hAV rr hR).1 (hAV rr hR).2 hrr hturn
have hT : TEq M (tmRun M 1 (TCk.mk t0 (0 + 1) q)).tape t0 := tapeN_keep M t0 (0 + 1) q hturn.wr
refine And.intro ?_ (And.intro hp.2.1 hp.2.2)
intro i hi
exact lay_teq M _ _ (A i) (V i) hT (hAV i hi).1 (hAV i hi).2 (rv (x i)) (0 + 1) (hl i hi)
/-- Pop on register rr holding b :: tl: the register becomes tl, the others are kept, b is read. -/
theorem pop_cons_sim (M : TMk) (A V : Nat -> Nat) (R : Nat) (x : Nat -> List Bool) (t0 : Tape)
(q q1 : List Bool) (rr : Nat) (b : Bool) (tl : List Bool) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : Regs t0 A V R x) (hx : x rr = b :: tl)
(hkeep : forall s, nthd s (A rr) = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (0 + 1 + (rv tl ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (0 + 1 + (rv tl).length))) (A rr) = false)
(hrt : M.right q1 (symAt M t0 (0 + 1 + (rv tl).length)) = false)
(hkr : forall s, nthd s (A rr) = true -> Keep M (M.next q1 (symAt M t0 (0 + 1 + (rv tl).length))) s false)
(hoth : forall i, i < R -> Nat.beq i rr = false ->
nthd (M.write q1 (symAt M t0 (0 + 1 + (rv tl).length))) (A i) =
nthd (symAt M t0 (0 + 1 + (rv tl).length)) (A i) /\
nthd (M.write q1 (symAt M t0 (0 + 1 + (rv tl).length))) (V i) =
nthd (symAt M t0 (0 + 1 + (rv tl).length)) (V i)) :
Regs (tmRun M ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) (TCk.mk t0 (0 + 1) q)).tape A V R
(upd x rr tl) /\
(tmRun M ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) (TCk.mk t0 (0 + 1) q)).pos = 0 /\
(tmRun M ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) (TCk.mk t0 (0 + 1) q)).q =
M.next q1 (symAt M t0 (0 + 1 + (rv tl).length)) /\
nthd (symAt M t0 (0 + 1 + (rv tl).length)) (V rr) = b := by
have hrr : Lay t0 (A rr) (V rr) (0 + 1) (rv tl ++ [b]) := by
have h := hl rr hR
rw [hx] at h
exact h
have hp := pop_ret M t0 (A rr) (V rr) 0 q q1 b (rv tl) (hAV rr hR).1 (hAV rr hR).2 hrr
hkeep hturn herase hrt hkr
refine And.intro ?_ (And.intro hp.2.1 (And.intro hp.2.2.1 hp.2.2.2))
intro i hi
cases e : Nat.beq i rr with
| true =>
have ei : i = rr := Found.Pnp2.beq_eq i rr e
rw [ei, upd_same]
exact hp.1
| false =>
rw [upd_other x rr i _ e]
exact pop_other M t0 (A rr) (V rr) 0 q q1 b (rv tl) (hAV rr hR).1 (hAV rr hR).2 hrr
hkeep hturn herase hrt hkr (A i) (V i) (0 + 1) (rv (x i)) (hAV i hi).1 (hAV i hi).2 (hl i hi)
(hoth i hi e).1 (hoth i hi e).2
end Found.Pnp52
#print axioms Found.Pnp52.rv_len
#print axioms Found.Pnp52.push_sim
#print axioms Found.Pnp52.pop_empty_sim
#print axioms Found.Pnp52.pop_cons_sim
lean_all/found/Pnp53.lean
/-
T330 piece 53. found/Pnp53 -- one whole register machine step on the track machine (CL3c, 11).
The head waits at a home cell h between instructions; register i is laid on the tracks
A i, V i from cell h + 1, reversed (Pnp52's rv). The state at home is code pc. One step of
the register machine (Pnp20) is: one step right off home into the instruction state
(Fwd), then the push or pop of Pnp49/Pnp50 back to home, or for a jump one step back.
Proved, for any machine M, track maps A, V, home h and state code:
* enter, after_enter: the step off home keeps the tape and puts the head on h + 1;
* push_simH, pop_empty_simH, pop_cons_simH: Pnp52 with the home cell h in place of 0;
* sim_push, sim_pop_empty, sim_pop_cons, sim_jmp: from a configuration related (Sim) to
a register configuration whose instruction is push / pop / jump, the track machine
reaches, after 1 + (2 n + 1), 1 + 1, 1 + (2 n + 3) (n the length of the popped
register's tail) and 2 steps, a configuration related to Pnp20's step.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp52
namespace Found.Pnp53
open Found.Pnp7 (nthd)
open Found.Pnp12 (selN)
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI step exec popTo)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45
open Found.Pnp46
open Found.Pnp47
open Found.Pnp48
open Found.Pnp49
open Found.Pnp50
open Found.Pnp51
open Found.Pnp52 (rv)
/-- All registers below R laid on their tracks from cell h + 1. -/
def RegsAt (t : Tape) (A V : Nat -> Nat) (R h : Nat) (x : Nat -> List Bool) : Prop :=
forall i, i < R -> Lay t (A i) (V i) (h + 1) (rv (x i))
/-- Head at home, state = code of the counter, registers laid. -/
def Sim (_M : TMk) (A V : Nat -> Nat) (R h : Nat) (code : Nat -> List Bool) (c : TCk) (d : Cfg) : Prop :=
c.pos = h /\ c.q = code d.pc /\ RegsAt c.tape A V R h d.regs
/-- Moving right into q1, writing the cell back. -/
structure Fwd (M : TMk) (q q1 : List Bool) (s : List Bool) : Prop where
nx : M.next q s = q1
wr : M.write q s = s
rt : M.right q s = true
theorem enter (M : TMk) (t0 : Tape) (h : Nat) (q q1 : List Bool) (hf : Fwd M q q1 (symAt M t0 h)) :
CEq M (tmRun M 1 (TCk.mk t0 h q)) (TCk.mk t0 (h + 1) q1) := by
refine And.intro ?_ (And.intro ?_ ?_)
· exact tapeN_keep M t0 h q hf.wr
· show selN (M.right q (symAt M t0 h)) (h + 1) (h - 1) = h + 1
rw [hf.rt]
rfl
· exact hf.nx
theorem after_enter (M : TMk) (t0 : Tape) (h : Nat) (q q1 : List Bool) (hf : Fwd M q q1 (symAt M t0 h))
(n : Nat) : CEq M (tmRun M (1 + n) (TCk.mk t0 h q)) (tmRun M n (TCk.mk t0 (h + 1) q1)) := by
rw [(run_add M 1 (TCk.mk t0 h q) n).symm]
exact run_ext M _ _ (enter M t0 h q q1 hf) n
/-- Turning left off cell h + 1 back home. -/
theorem back (M : TMk) (t0 : Tape) (h : Nat) (q q1 : List Bool) (ht : Turn M q q1 (symAt M t0 (h + 1))) :
CEq M (tmRun M 1 (TCk.mk t0 (h + 1) q)) (TCk.mk t0 h q1) := by
refine And.intro ?_ (And.intro ?_ ?_)
· exact tapeN_keep M t0 (h + 1) q ht.wr
· show selN (M.right q (symAt M t0 (h + 1))) (h + 1 + 1) (h + 1 - 1) = h
rw [ht.rt]
rfl
· exact ht.nx
/-- A configuration agreeing with one at home with laid registers is related. -/
theorem sim_of (M : TMk) (A V : Nat -> Nat) (R h : Nat) (code : Nat -> List Bool) (c d : TCk)
(hc : CEq M c d) (hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(pc : Nat) (x : Nat -> List Bool)
(hpos : d.pos = h) (hq : d.q = code pc) (hr : RegsAt d.tape A V R h x) :
Sim M A V R h code c (Cfg.mk pc x) := by
refine And.intro (hc.2.1.trans hpos) (And.intro (hc.2.2.trans hq) ?_)
intro i hi
exact lay_teq M d.tape c.tape (A i) (V i) hc.1 (hAV i hi).1 (hAV i hi).2 (rv (x i)) (h + 1) (hr i hi)
/-! ## Pnp52 at home cell h -/
theorem push_simH (M : TMk) (A V : Nat -> Nat) (R h : Nat) (x : Nat -> List Bool) (t0 : Tape)
(q r : List Bool) (rr : Nat) (b : Bool) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x)
(hkeep : forall s, nthd s (A rr) = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (A rr) = true)
(hwv : nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (V rr) = b)
(hrt : M.right q (symAt M t0 (h + 1 + (rv (x rr)).length)) = false)
(hnx : M.next q (symAt M t0 (h + 1 + (rv (x rr)).length)) = r)
(hkr : forall s, nthd s (A rr) = true -> Keep M r s false)
(hoth : forall i, i < R -> Nat.beq i rr = false ->
nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (A i) =
nthd (symAt M t0 (h + 1 + (rv (x rr)).length)) (A i) /\
nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (V i) =
nthd (symAt M t0 (h + 1 + (rv (x rr)).length)) (V i)) :
RegsAt (tmRun M ((rv (x rr)).length + 1 + (rv (x rr)).length) (TCk.mk t0 (h + 1) q)).tape A V R h
(upd x rr (b :: x rr)) /\
(tmRun M ((rv (x rr)).length + 1 + (rv (x rr)).length) (TCk.mk t0 (h + 1) q)).pos = h /\
(tmRun M ((rv (x rr)).length + 1 + (rv (x rr)).length) (TCk.mk t0 (h + 1) q)).q = r := by
have hp := push_ret M t0 (A rr) (V rr) h q r b (rv (x rr)) (hAV rr hR).1 (hAV rr hR).2 (hl rr hR)
hkeep hwa hwv hrt hnx hkr
refine And.intro ?_ (And.intro hp.2.1 hp.2.2)
intro i hi
cases e : Nat.beq i rr with
| true =>
have ei : i = rr := Found.Pnp2.beq_eq i rr e
rw [ei, upd_same]
exact hp.1
| false =>
rw [upd_other x rr i _ e]
exact push_other M t0 (A rr) (V rr) h q r (rv (x rr)) (hAV rr hR).1 (hl rr hR) b (hAV rr hR).2
hkeep hwa hwv hrt hnx hkr (A i) (V i) (h + 1) (rv (x i)) (hAV i hi).1 (hAV i hi).2 (hl i hi)
(hoth i hi e).1 (hoth i hi e).2
theorem pop_empty_simH (M : TMk) (A V : Nat -> Nat) (R h : Nat) (x : Nat -> List Bool) (t0 : Tape)
(q e : List Bool) (rr : Nat) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x) (hx : x rr = [])
(hturn : Turn M q e (symAt M t0 (h + 1))) :
RegsAt (tmRun M 1 (TCk.mk t0 (h + 1) q)).tape A V R h x /\
(tmRun M 1 (TCk.mk t0 (h + 1) q)).pos = h /\
(tmRun M 1 (TCk.mk t0 (h + 1) q)).q = e := by
have hrr : Lay t0 (A rr) (V rr) (h + 1) [] := by
have h' := hl rr hR
rw [hx] at h'
exact h'
have hp := pop_empty M t0 (A rr) (V rr) h q e (hAV rr hR).1 (hAV rr hR).2 hrr hturn
have hT : TEq M (tmRun M 1 (TCk.mk t0 (h + 1) q)).tape t0 := tapeN_keep M t0 (h + 1) q hturn.wr
refine And.intro ?_ (And.intro hp.2.1 hp.2.2)
intro i hi
exact lay_teq M _ _ (A i) (V i) hT (hAV i hi).1 (hAV i hi).2 (rv (x i)) (h + 1) (hl i hi)
theorem pop_cons_simH (M : TMk) (A V : Nat -> Nat) (R h : Nat) (x : Nat -> List Bool) (t0 : Tape)
(q q1 : List Bool) (rr : Nat) (b : Bool) (tl : List Bool) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x) (hx : x rr = b :: tl)
(hkeep : forall s, nthd s (A rr) = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (h + 1 + (rv tl ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (h + 1 + (rv tl).length))) (A rr) = false)
(hrt : M.right q1 (symAt M t0 (h + 1 + (rv tl).length)) = false)
(hkr : forall s, nthd s (A rr) = true -> Keep M (M.next q1 (symAt M t0 (h + 1 + (rv tl).length))) s false)
(hoth : forall i, i < R -> Nat.beq i rr = false ->
nthd (M.write q1 (symAt M t0 (h + 1 + (rv tl).length))) (A i) =
nthd (symAt M t0 (h + 1 + (rv tl).length)) (A i) /\
nthd (M.write q1 (symAt M t0 (h + 1 + (rv tl).length))) (V i) =
nthd (symAt M t0 (h + 1 + (rv tl).length)) (V i)) :
RegsAt (tmRun M ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) (TCk.mk t0 (h + 1) q)).tape A V R h
(upd x rr tl) /\
(tmRun M ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) (TCk.mk t0 (h + 1) q)).pos = h /\
(tmRun M ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) (TCk.mk t0 (h + 1) q)).q =
M.next q1 (symAt M t0 (h + 1 + (rv tl).length)) /\
nthd (symAt M t0 (h + 1 + (rv tl).length)) (V rr) = b := by
have hrr : Lay t0 (A rr) (V rr) (h + 1) (rv tl ++ [b]) := by
have h' := hl rr hR
rw [hx] at h'
exact h'
have hp := pop_ret M t0 (A rr) (V rr) h q q1 b (rv tl) (hAV rr hR).1 (hAV rr hR).2 hrr
hkeep hturn herase hrt hkr
refine And.intro ?_ (And.intro hp.2.1 (And.intro hp.2.2.1 hp.2.2.2))
intro i hi
cases e : Nat.beq i rr with
| true =>
have ei : i = rr := Found.Pnp2.beq_eq i rr e
rw [ei, upd_same]
exact hp.1
| false =>
rw [upd_other x rr i _ e]
exact pop_other M t0 (A rr) (V rr) h q q1 b (rv tl) (hAV rr hR).1 (hAV rr hR).2 hrr
hkeep hturn herase hrt hkr (A i) (V i) (h + 1) (rv (x i)) (hAV i hi).1 (hAV i hi).2 (hl i hi)
(hoth i hi e).1 (hoth i hi e).2
/-! ## One whole register machine step -/
/-- The jump target of a pop on a nonempty register: o on 1, z on 0. -/
def bsel : Bool -> Nat -> Nat -> Nat
| true, o, _ => o
| false, _, z => z
theorem pop_step_cons (p : List Ins) (pc : Nat) (x : Nat -> List Bool) (rr e z o : Nat) (b : Bool)
(tl : List Bool) (hins : nthI p pc = some (Ins.pop rr e z o)) (hx : x rr = b :: tl) :
step p (Cfg.mk pc x) = Cfg.mk (bsel b o z) (upd x rr tl) := by
show exec (Cfg.mk pc x) (nthI p pc) = _
rw [hins]
show popTo (Cfg.mk pc x) rr e z o (x rr) = _
rw [hx]
cases b with
| false => rfl
| true => rfl
theorem sim_push (M : TMk) (A V : Nat -> Nat) (R h : Nat) (code : Nat -> List Bool) (p : List Ins)
(pc : Nat) (x : Nat -> List Bool) (t0 : Tape) (q : List Bool) (rr : Nat) (b : Bool)
(hins : nthI p pc = some (Ins.push rr b)) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x)
(hf : Fwd M (code pc) q (symAt M t0 h))
(hkeep : forall s, nthd s (A rr) = true -> Keep M q s true)
(hwa : nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (A rr) = true)
(hwv : nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (V rr) = b)
(hrt : M.right q (symAt M t0 (h + 1 + (rv (x rr)).length)) = false)
(hnx : M.next q (symAt M t0 (h + 1 + (rv (x rr)).length)) = code (pc + 1))
(hkr : forall s, nthd s (A rr) = true -> Keep M (code (pc + 1)) s false)
(hoth : forall i, i < R -> Nat.beq i rr = false ->
nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (A i) =
nthd (symAt M t0 (h + 1 + (rv (x rr)).length)) (A i) /\
nthd (M.write q (symAt M t0 (h + 1 + (rv (x rr)).length))) (V i) =
nthd (symAt M t0 (h + 1 + (rv (x rr)).length)) (V i)) :
Sim M A V R h code
(tmRun M (1 + ((rv (x rr)).length + 1 + (rv (x rr)).length)) (TCk.mk t0 h (code pc)))
(step p (Cfg.mk pc x)) := by
have hs := push_simH M A V R h x t0 q (code (pc + 1)) rr b hR hAV hl hkeep hwa hwv hrt hnx hkr hoth
have hc := after_enter M t0 h (code pc) q hf ((rv (x rr)).length + 1 + (rv (x rr)).length)
have e : step p (Cfg.mk pc x) = Cfg.mk (pc + 1) (upd x rr (b :: x rr)) := by
show exec (Cfg.mk pc x) (nthI p pc) = _
rw [hins]
rfl
rw [e]
exact sim_of M A V R h code _ _ hc hAV (pc + 1) _ hs.2.1 hs.2.2 hs.1
theorem sim_pop_empty (M : TMk) (A V : Nat -> Nat) (R h : Nat) (code : Nat -> List Bool) (p : List Ins)
(pc : Nat) (x : Nat -> List Bool) (t0 : Tape) (q : List Bool) (rr e z o : Nat)
(hins : nthI p pc = some (Ins.pop rr e z o)) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x) (hx : x rr = [])
(hf : Fwd M (code pc) q (symAt M t0 h))
(hturn : Turn M q (code e) (symAt M t0 (h + 1))) :
Sim M A V R h code (tmRun M (1 + 1) (TCk.mk t0 h (code pc))) (step p (Cfg.mk pc x)) := by
have hs := pop_empty_simH M A V R h x t0 q (code e) rr hR hAV hl hx hturn
have hc := after_enter M t0 h (code pc) q hf 1
have es : step p (Cfg.mk pc x) = Cfg.mk e x := by
show exec (Cfg.mk pc x) (nthI p pc) = _
rw [hins]
show popTo (Cfg.mk pc x) rr e z o (x rr) = _
rw [hx]
rfl
rw [es]
exact sim_of M A V R h code _ _ hc hAV e x hs.2.1 hs.2.2 hs.1
theorem sim_pop_cons (M : TMk) (A V : Nat -> Nat) (R h : Nat) (code : Nat -> List Bool) (p : List Ins)
(pc : Nat) (x : Nat -> List Bool) (t0 : Tape) (q q1 : List Bool) (rr e z o : Nat) (b : Bool)
(tl : List Bool)
(hins : nthI p pc = some (Ins.pop rr e z o)) (hR : rr < R)
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x) (hx : x rr = b :: tl)
(hf : Fwd M (code pc) q (symAt M t0 h))
(hkeep : forall s, nthd s (A rr) = true -> Keep M q s true)
(hturn : Turn M q q1 (symAt M t0 (h + 1 + (rv tl ++ [b]).length)))
(herase : nthd (M.write q1 (symAt M t0 (h + 1 + (rv tl).length))) (A rr) = false)
(hrt : M.right q1 (symAt M t0 (h + 1 + (rv tl).length)) = false)
(hnx : M.next q1 (symAt M t0 (h + 1 + (rv tl).length)) = code (bsel b o z))
(hkr : forall s, nthd s (A rr) = true -> Keep M (code (bsel b o z)) s false)
(hoth : forall i, i < R -> Nat.beq i rr = false ->
nthd (M.write q1 (symAt M t0 (h + 1 + (rv tl).length))) (A i) =
nthd (symAt M t0 (h + 1 + (rv tl).length)) (A i) /\
nthd (M.write q1 (symAt M t0 (h + 1 + (rv tl).length))) (V i) =
nthd (symAt M t0 (h + 1 + (rv tl).length)) (V i)) :
Sim M A V R h code
(tmRun M (1 + ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length)) (TCk.mk t0 h (code pc)))
(step p (Cfg.mk pc x)) := by
have hkr' : forall s, nthd s (A rr) = true -> Keep M (M.next q1 (symAt M t0 (h + 1 + (rv tl).length))) s false := by
rw [hnx]; exact hkr
have hs := pop_cons_simH M A V R h x t0 q q1 rr b tl hR hAV hl hx hkeep hturn herase hrt hkr' hoth
have hc := after_enter M t0 h (code pc) q hf ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length)
rw [pop_step_cons p pc x rr e z o b tl hins hx]
exact sim_of M A V R h code _ _ hc hAV (bsel b o z) _ hs.2.1 (hs.2.2.1.trans hnx) hs.1
theorem sim_jmp (M : TMk) (A V : Nat -> Nat) (R h : Nat) (code : Nat -> List Bool) (p : List Ins)
(pc : Nat) (x : Nat -> List Bool) (t0 : Tape) (q : List Bool) (l : Nat)
(hins : nthI p pc = some (Ins.jmp l))
(hAV : forall i, i < R -> A i < M.k + 1 /\ V i < M.k + 1)
(hl : RegsAt t0 A V R h x)
(hf : Fwd M (code pc) q (symAt M t0 h))
(hturn : Turn M q (code l) (symAt M t0 (h + 1))) :
Sim M A V R h code (tmRun M (1 + 1) (TCk.mk t0 h (code pc))) (step p (Cfg.mk pc x)) := by
have hc := ceq_trans M _ _ _ (after_enter M t0 h (code pc) q hf 1) (back M t0 h q (code l) hturn)
have es : step p (Cfg.mk pc x) = Cfg.mk l x := by
show exec (Cfg.mk pc x) (nthI p pc) = _
rw [hins]
rfl
rw [es]
exact sim_of M A V R h code _ (TCk.mk t0 h (code l)) hc hAV l x rfl rfl hl
end Found.Pnp53
#print axioms Found.Pnp53.enter
#print axioms Found.Pnp53.after_enter
#print axioms Found.Pnp53.back
#print axioms Found.Pnp53.sim_of
#print axioms Found.Pnp53.push_simH
#print axioms Found.Pnp53.pop_empty_simH
#print axioms Found.Pnp53.pop_cons_simH
#print axioms Found.Pnp53.pop_step_cons
#print axioms Found.Pnp53.sim_push
#print axioms Found.Pnp53.sim_pop_empty
#print axioms Found.Pnp53.sim_pop_cons
#print axioms Found.Pnp53.sim_jmp
lean_all/found/Pnp54.lean
/-
T330 piece 54. found/Pnp54 -- whole register machine runs on the track machine, with a
polynomial step count (CL3c, 12).
Pnp53 simulates one register machine step from a related configuration. Here the steps are
chained. The size of a register configuration is the total length of the registers below
R (regSz); one step of Pnp20 adds at most one to it. Proved, for any track machine M, any
relation S between track configurations and register configurations, any program p, any
size measure f and any step bound given as a polynomial expression e (Pnp3.PE):
* regSz_upd_le, len_le_regSz, step_sz, run_sz: one register step grows the size by at
most one, so n steps by at most n; each register below R is at most the size;
* run_sim: if every related pair (c, d) reaches a pair related to (., step p d) within
pe e (f d) machine steps, and f grows by at most one per step, then n register steps
are simulated within n * pe e (f d + n) machine steps -- a polynomial in n and f d;
* halt_ex: a halted register configuration is simulated in zero steps;
* push_cost, popc_cost, short_cost: the step counts of Pnp53 (sim_push, sim_pop_cons,
sim_pop_empty, sim_jmp) are at most pe stepE (regSz x R), stepE = 1 + (s + 1 + 1 + s).
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp53
import found.Pnp3
namespace Found.Pnp54
open Found.Pnp3 (PE pe pe_mono)
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI step exec popTo run)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp52 (rv rv_len)
/-! ## Size of the registers below R -/
def regSz (x : Nat -> List Bool) : Nat -> Nat
| 0 => 0
| R + 1 => regSz x R + (x R).length
theorem regSz_upd_far (x : Nat -> List Bool) (r : Nat) (v : List Bool) :
forall R, R <= r -> regSz (upd x r v) R = regSz x R := by
intro R
induction R with
| zero => intro _; rfl
| succ R ih =>
intro hR
have hne : Nat.beq R r = false :=
Found.Pnp2.beq_false_of_ne R r (fun e => Nat.not_succ_le_self r (e ▸ hR))
show regSz (upd x r v) R + (upd x r v R).length = regSz x R + (x R).length
rw [ih (Nat.le_of_succ_le hR), upd_other x r R v hne]
theorem regSz_upd_le (x : Nat -> List Bool) (r : Nat) (v : List Bool)
(hv : v.length <= (x r).length + 1) :
forall R, regSz (upd x r v) R <= regSz x R + 1 := by
intro R
induction R with
| zero => exact Nat.zero_le _
| succ R ih =>
show regSz (upd x r v) R + (upd x r v R).length <= regSz x R + (x R).length + 1
cases e : Nat.beq R r with
| true =>
have eR : R = r := Found.Pnp2.beq_eq R r e
subst eR
rw [regSz_upd_far x R v R (Nat.le_refl R), upd_same, Nat.add_assoc]
exact Nat.add_le_add_left hv _
| false =>
rw [upd_other x r R v e, Nat.add_right_comm (regSz x R) (x R).length 1]
exact Nat.add_le_add_right ih _
theorem len_le_regSz (x : Nat -> List Bool) (r : Nat) :
forall R, r < R -> (x r).length <= regSz x R := by
intro R
induction R with
| zero => intro h; exact absurd h (Nat.not_succ_le_zero r)
| succ R ih =>
intro h
show (x r).length <= regSz x R + (x R).length
have hle : r <= R := Nat.le_of_lt_succ h
cases hle with
| refl => exact Nat.le_add_left _ _
| step hm => exact Nat.le_trans (ih (Nat.succ_le_succ hm)) (Nat.le_add_right _ _)
theorem step_sz (p : List Ins) (R : Nat) (d : Cfg) :
regSz (step p d).regs R <= regSz d.regs R + 1 := by
cases d with
| mk pc x =>
show regSz (exec (Cfg.mk pc x) (nthI p pc)).regs R <= regSz x R + 1
cases nthI p pc with
| none => exact Nat.le_succ _
| some ins =>
cases ins with
| push r b =>
exact regSz_upd_le x r (b :: x r) (Nat.le_refl _) R
| pop r e z o =>
show regSz (popTo (Cfg.mk pc x) r e z o (x r)).regs R <= regSz x R + 1
cases hx : x r with
| nil => exact Nat.le_succ _
| cons b t =>
have ht : t.length <= (x r).length + 1 := by
rw [hx]
exact Nat.le_trans (Nat.le_succ t.length) (Nat.le_succ (t.length + 1))
cases b with
| false => exact regSz_upd_le x r t ht R
| true => exact regSz_upd_le x r t ht R
| jmp l => exact Nat.le_succ _
theorem run_sz (p : List Ins) (R : Nat) :
forall n d, regSz (run p n d).regs R <= regSz d.regs R + n := by
intro n
induction n with
| zero => intro d; exact Nat.le_refl _
| succ n ih =>
intro d
show regSz (run p n (step p d)).regs R <= regSz d.regs R + (n + 1)
refine Nat.le_trans (ih (step p d)) ?_
refine Nat.le_trans (Nat.add_le_add_right (step_sz p R d) n) (Nat.le_of_eq ?_)
rw [Nat.add_assoc, Nat.add_comm 1 n]
/-! ## Chaining simulated steps -/
theorem run_sim (M : TMk) (S : TCk -> Cfg -> Prop) (p : List Ins) (f : Cfg -> Nat) (e : PE)
(hsz : forall d, f (step p d) <= f d + 1)
(hst : forall c d, S c d -> Exists (fun k => k <= pe e (f d) /\ S (tmRun M k c) (step p d))) :
forall n c d, S c d ->
Exists (fun K => K <= n * pe e (f d + n) /\ S (tmRun M K c) (run p n d)) := by
intro n
induction n with
| zero => intro c d h; exact Exists.intro 0 (And.intro (Nat.zero_le _) h)
| succ n ih =>
intro c d h
cases hst c d h with
| intro k hk =>
cases ih (tmRun M k c) (step p d) hk.2 with
| intro K hK =>
refine Exists.intro (k + K) (And.intro ?_ ?_)
· have hX : f (step p d) + n <= f d + (n + 1) := by
refine Nat.le_trans (Nat.add_le_add_right (hsz d) n) (Nat.le_of_eq ?_)
rw [Nat.add_assoc, Nat.add_comm 1 n]
have h1 : k <= pe e (f d + (n + 1)) :=
Nat.le_trans hk.1 (pe_mono _ _ (Nat.le_add_right _ _) e)
have h2 : K <= n * pe e (f d + (n + 1)) :=
Nat.le_trans hK.1 (Nat.mul_le_mul (Nat.le_refl n) (pe_mono _ _ hX e))
refine Nat.le_trans (Nat.add_le_add h1 h2) (Nat.le_of_eq ?_)
rw [Nat.succ_mul, Nat.add_comm]
· rw [(Found.Pnp46.run_add M k c K).symm]
exact hK.2
theorem halt_ex (M : TMk) (S : TCk -> Cfg -> Prop) (p : List Ins) (B : Nat) (d : Cfg)
(tc : TCk) (h : S tc d) (hn : nthI p d.pc = none) :
Exists (fun k => k <= B /\ S (tmRun M k tc) (step p d)) := by
refine Exists.intro 0 (And.intro (Nat.zero_le B) ?_)
have e : step p d = d := by
cases d with
| mk pc x =>
show exec (Cfg.mk pc x) (nthI p pc) = Cfg.mk pc x
have hn' : nthI p pc = none := hn
rw [hn']
rfl
rw [e]
exact h
/-! ## The step counts of Pnp53 -/
/-- The bound for one register step: 1 + (s + 1 + 1 + s). -/
def stepE : PE := .add (.c 1) (.add (.add (.add .x (.c 1)) (.c 1)) .x)
theorem push_cost (x : Nat -> List Bool) (R rr : Nat) (hR : rr < R) :
1 + ((rv (x rr)).length + 1 + (rv (x rr)).length) <= pe stepE (regSz x R) := by
have hL : (rv (x rr)).length <= regSz x R := by
rw [rv_len]; exact len_le_regSz x rr R hR
show 1 + ((rv (x rr)).length + 1 + (rv (x rr)).length) <= 1 + (regSz x R + 1 + 1 + regSz x R)
refine Nat.add_le_add_left (Nat.add_le_add ?_ hL) 1
exact Nat.le_trans (Nat.add_le_add_right hL 1) (Nat.le_succ _)
theorem popc_cost (x : Nat -> List Bool) (R rr : Nat) (hR : rr < R) (b : Bool) (tl : List Bool)
(hx : x rr = b :: tl) :
1 + ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) <= pe stepE (regSz x R) := by
have hL : tl.length + 1 <= regSz x R := by
have h := len_le_regSz x rr R hR
rw [hx] at h
exact h
have h1 : (rv tl ++ [b]).length <= regSz x R := by
show (rv (b :: tl)).length <= regSz x R
rw [rv_len]; exact hL
have h2 : (rv tl).length <= regSz x R := by
rw [rv_len]; exact Nat.le_trans (Nat.le_succ _) hL
show 1 + ((rv tl ++ [b]).length + 1 + 1 + (rv tl).length) <= 1 + (regSz x R + 1 + 1 + regSz x R)
exact Nat.add_le_add_left (Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add_right h1 1) 1) h2) 1
theorem short_cost (s : Nat) : 1 + 1 <= pe stepE s := by
show 1 + 1 <= 1 + (s + 1 + 1 + s)
refine Nat.add_le_add_left ?_ 1
exact Nat.le_trans (Nat.le_add_left 1 s) (Nat.le_trans (Nat.le_succ _) (Nat.le_add_right _ s))
end Found.Pnp54
#print axioms Found.Pnp54.regSz_upd_far
#print axioms Found.Pnp54.regSz_upd_le
#print axioms Found.Pnp54.len_le_regSz
#print axioms Found.Pnp54.step_sz
#print axioms Found.Pnp54.run_sz
#print axioms Found.Pnp54.run_sim
#print axioms Found.Pnp54.halt_ex
#print axioms Found.Pnp54.push_cost
#print axioms Found.Pnp54.popc_cost
#print axioms Found.Pnp54.short_cost
lean_all/found/Pnp55.lean
/-
T330 piece 55. found/Pnp55 -- tools for building the track machine of a register program
(CL3c, 13).
The track machine that runs a register program (Pnp56) writes single bits of a cell and
tests whether any register track is set. It also needs two facts about whole runs: marker
tracks that no write touches stay as they are, and a cell carrying a marker bit on which
every write is the identity keeps all its bits. Proved, for any machine M:
* setd, nthd_setd_same, nthd_setd_other: setting bit i of a symbol changes bit i only;
* anyT, anyT_true, anyT_false: the test "some track A i, i < R, is set";
* run_bit: if no write changes bit a, bit a of every cell is constant along a run;
* run_marked: if no write changes bit mk, and every write on a symbol with bit mk set
leaves bit a, then bit a of every cell marked mk is constant along a run.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp53
namespace Found.Pnp55
open Found.Pnp7 (nthd)
open Found.Pnp43
open Found.Pnp44
/-! ## Setting one bit of a symbol -/
def setd : List Bool -> Nat -> Bool -> List Bool
| [], 0, b => [b]
| [], i + 1, b => false :: setd [] i b
| _ :: L, 0, b => b :: L
| x :: L, i + 1, b => x :: setd L i b
theorem nthd_setd_same : forall (L : List Bool) (i : Nat) (b : Bool), nthd (setd L i b) i = b := by
intro L
induction L with
| nil =>
intro i
induction i with
| zero => intro b; rfl
| succ i ih => intro b; exact ih b
| cons x L ih =>
intro i b
cases i with
| zero => rfl
| succ i => exact ih i b
theorem nthd_nil_setd : forall (i j : Nat) (b : Bool), Nat.beq j i = false -> nthd (setd [] i b) j = false := by
intro i
induction i with
| zero =>
intro j b h
cases j with
| zero => exact Bool.noConfusion h
| succ j => rfl
| succ i ih =>
intro j b h
cases j with
| zero => rfl
| succ j => exact ih j b h
theorem nthd_setd_other : forall (L : List Bool) (i j : Nat) (b : Bool), Nat.beq j i = false ->
nthd (setd L i b) j = nthd L j := by
intro L
induction L with
| nil => intro i j b h; exact nthd_nil_setd i j b h
| cons x L ih =>
intro i j b h
cases i with
| zero =>
cases j with
| zero => exact Bool.noConfusion h
| succ j => rfl
| succ i =>
cases j with
| zero => rfl
| succ j => exact ih i j b h
/-! ## Some register track set -/
def anyT (s : List Bool) (A : Nat -> Nat) : Nat -> Bool
| 0 => false
| R + 1 => anyT s A R || nthd s (A R)
theorem or_true_r (a : Bool) : (a || true) = true := by
cases a with
| false => rfl
| true => rfl
theorem anyT_true (s : List Bool) (A : Nat -> Nat) (rr : Nat) (hs : nthd s (A rr) = true) :
forall R, rr < R -> anyT s A R = true := by
intro R
induction R with
| zero => intro h; exact absurd h (Nat.not_succ_le_zero rr)
| succ R ih =>
intro h
show (anyT s A R || nthd s (A R)) = true
have hle : rr <= R := Nat.le_of_lt_succ h
cases hle with
| refl => rw [hs]; exact or_true_r _
| step hm => rw [ih (Nat.succ_le_succ hm)]; rfl
theorem anyT_false (s : List Bool) (A : Nat -> Nat) :
forall R, (forall i, i < R -> nthd s (A i) = false) -> anyT s A R = false := by
intro R
induction R with
| zero => intro _; rfl
| succ R ih =>
intro h
show (anyT s A R || nthd s (A R)) = false
rw [ih (fun i hi => h i (Nat.le_trans hi (Nat.le_succ R))), h R (Nat.le_refl _)]
rfl
/-! ## Bits kept along runs -/
theorem step_bit (M : TMk) (a : Nat) (ha : a < M.k + 1)
(hw : forall q s, nthd (M.write q s) a = nthd s a) (c : TCk) (j : Nat) :
(tmStep M c).tape j a = c.tape j a := by
show Found.Pnp12.sel (Nat.beq j c.pos) (nthd (M.write c.q (symAt M c.tape c.pos)) a) (c.tape j a) = c.tape j a
cases e : Nat.beq j c.pos with
| true =>
have ej : j = c.pos := Found.Pnp2.beq_eq j c.pos e
rw [ej, hw, Found.Pnp47.nthd_sym M c.tape c.pos a ha]
rfl
| false => rfl
theorem run_bit (M : TMk) (a : Nat) (ha : a < M.k + 1)
(hw : forall q s, nthd (M.write q s) a = nthd s a) :
forall n c j, (tmRun M n c).tape j a = c.tape j a := by
intro n
induction n with
| zero => intro c j; rfl
| succ n ih =>
intro c j
show (tmStep M (tmRun M n c)).tape j a = c.tape j a
rw [step_bit M a ha hw]
exact ih c j
theorem run_marked (M : TMk) (mk a : Nat) (hmk : mk < M.k + 1) (ha : a < M.k + 1)
(hwm : forall q s, nthd (M.write q s) mk = nthd s mk)
(hw : forall q s, nthd s mk = true -> nthd (M.write q s) a = nthd s a) :
forall n c j, c.tape j mk = true -> (tmRun M n c).tape j a = c.tape j a := by
intro n
induction n with
| zero => intro c j _; rfl
| succ n ih =>
intro c j hj
show Found.Pnp12.sel (Nat.beq j (tmRun M n c).pos)
(nthd (M.write (tmRun M n c).q (symAt M (tmRun M n c).tape (tmRun M n c).pos)) a)
((tmRun M n c).tape j a) = c.tape j a
cases e : Nat.beq j (tmRun M n c).pos with
| true =>
have ej : j = (tmRun M n c).pos := Found.Pnp2.beq_eq j _ e
have hm : nthd (symAt M (tmRun M n c).tape (tmRun M n c).pos) mk = true := by
rw [Found.Pnp47.nthd_sym M _ _ mk hmk, ej.symm, run_bit M mk hmk hwm n c j]
exact hj
rw [hw _ _ hm, Found.Pnp47.nthd_sym M _ _ a ha, ej.symm]
exact ih c j hj
| false => exact ih c j hj
end Found.Pnp55
#print axioms Found.Pnp55.nthd_setd_same
#print axioms Found.Pnp55.nthd_nil_setd
#print axioms Found.Pnp55.nthd_setd_other
#print axioms Found.Pnp55.or_true_r
#print axioms Found.Pnp55.anyT_true
#print axioms Found.Pnp55.anyT_false
#print axioms Found.Pnp55.step_bit
#print axioms Found.Pnp55.run_bit
#print axioms Found.Pnp55.run_marked
lean_all/found/Pnp56.lean
/-
T330 piece 56. found/Pnp56 -- the track machine of a register program (CL3c, 14).
From a register program p (Pnp20), a register count R and a counter width W, a concrete
track machine mach p R W is built. Tracks: 0 marks the home cell, 1 marks the first
register cell, register i lies on tracks trA i = i + 2 (present) and trV R i = i + R + 2
(value). States are two tag bits and the counter in thermometer code thm W pc (fixed width
W, so every state has W + 2 bits):
* code pc (tags 0 0): at home and on the way back; any present bit set: stay, go left;
none set: go right into ist pc;
* ist pc (tags 1 0): the instruction pc. push r b: run right over present cells, write
the first absent cell (present, value b), go left in code (pc + 1). pop r e z o: run
right over present cells; on the first absent cell turn left, into code e if it is
the first register cell (empty register), into qst pc otherwise. jmp l: turn left into
code l;
* qst pc (tags 0 1): pop's second phase: clear the present bit, go left into code o or
code z by the value bit.
On a cell with the home mark every write is the identity. Proved: the behaviour of each
state on symbols, in the forms used by Pnp53 (Fwd, Keep, Turn, the bits written), and
that writes never change the two mark tracks (marks_kept, home_fixed).
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp55
import found.Pnp54
namespace Found.Pnp56
open Found.Pnp7 (nthd)
open Found.Pnp20 (Ins Cfg selR nthI)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp45 (Keep)
open Found.Pnp48 (Turn)
open Found.Pnp53 (Fwd bsel)
open Found.Pnp55 (setd nthd_setd_same nthd_setd_other anyT anyT_true anyT_false)
/-! ## Counter code -/
def thm : Nat -> Nat -> List Bool
| 0, _ => []
| W + 1, 0 => false :: thm W 0
| W + 1, n + 1 => true :: thm W n
def cnt : List Bool -> Nat
| [] => 0
| false :: _ => 0
| true :: l => cnt l + 1
theorem cnt_thm : forall W n, n <= W -> cnt (thm W n) = n := by
intro W
induction W with
| zero =>
intro n h
cases n with
| zero => rfl
| succ n => exact absurd h (Nat.not_succ_le_zero n)
| succ W ih =>
intro n h
cases n with
| zero => rfl
| succ n =>
show cnt (thm W n) + 1 = n + 1
rw [ih n (Nat.le_of_succ_le_succ h)]
theorem thm_len : forall W n, (thm W n).length = W := by
intro W
induction W with
| zero => intro n; rfl
| succ W ih =>
intro n
cases n with
| zero => show (thm W 0).length + 1 = W + 1; rw [ih 0]
| succ n => show (thm W n).length + 1 = W + 1; rw [ih n]
theorem nthI_lt : forall (p : List Ins) (n : Nat) (i : Ins), nthI p n = some i -> n < p.length := by
intro p
induction p with
| nil =>
intro n i h
have h' : (none : Option Ins) = some i := h
cases h'
| cons a p ih =>
intro n i h
cases n with
| zero => exact Nat.succ_le_succ (Nat.zero_le _)
| succ n => exact Nat.succ_le_succ (ih n i h)
/-! ## Tracks and states -/
def trA (i : Nat) : Nat := i + 2
def trV (R i : Nat) : Nat := i + R + 2
def code (W pc : Nat) : List Bool := false :: false :: thm W pc
def ist (W pc : Nat) : List Bool := true :: false :: thm W pc
def qst (W pc : Nat) : List Bool := false :: true :: thm W pc
def iNext (W : Nat) (c s : List Bool) : Option Ins -> List Bool
| none => true :: false :: c
| some (.push rr _) => selR (nthd s (trA rr)) (true :: false :: c) (code W (cnt c + 1))
| some (.pop rr e _ _) =>
selR (nthd s (trA rr)) (true :: false :: c) (selR (nthd s 1) (code W e) (false :: true :: c))
| some (.jmp l) => code W l
def qNext (R W : Nat) (c s : List Bool) : Option Ins -> List Bool
| none => false :: true :: c
| some (.push _ _) => false :: true :: c
| some (.pop rr _ z o) => code W (bsel (nthd s (trV R rr)) o z)
| some (.jmp _) => false :: true :: c
def nxt (p : List Ins) (R W : Nat) : List Bool -> List Bool -> List Bool
| [], _ => []
| [x], _ => [x]
| false :: false :: c, s => selR (anyT s trA R) (false :: false :: c) (true :: false :: c)
| true :: false :: c, s => iNext W c s (nthI p (cnt c))
| false :: true :: c, s => qNext R W c s (nthI p (cnt c))
| true :: true :: c, _ => true :: true :: c
def iWr (R : Nat) (s : List Bool) : Option Ins -> List Bool
| none => s
| some (.push rr b) => selR (nthd s (trA rr)) s (setd (setd s (trA rr) true) (trV R rr) b)
| some (.pop _ _ _ _) => s
| some (.jmp _) => s
def qWr (s : List Bool) : Option Ins -> List Bool
| none => s
| some (.push _ _) => s
| some (.pop rr _ _ _) => setd s (trA rr) false
| some (.jmp _) => s
def wr0 (p : List Ins) (R : Nat) : List Bool -> List Bool -> List Bool
| [], s => s
| [_], s => s
| false :: false :: _, s => s
| true :: false :: c, s => iWr R s (nthI p (cnt c))
| false :: true :: c, s => qWr s (nthI p (cnt c))
| true :: true :: _, s => s
def wrt (p : List Ins) (R : Nat) (q s : List Bool) : List Bool := selR (nthd s 0) s (wr0 p R q s)
def iRt (s : List Bool) : Option Ins -> Bool
| none => false
| some (.push rr _) => nthd s (trA rr)
| some (.pop rr _ _ _) => nthd s (trA rr)
| some (.jmp _) => false
def rt (p : List Ins) (R : Nat) : List Bool -> List Bool -> Bool
| [], _ => false
| [_], _ => false
| false :: false :: _, s => !(anyT s trA R)
| true :: false :: c, s => iRt s (nthI p (cnt c))
| false :: true :: _, _ => false
| true :: true :: _, _ => false
def mach (p : List Ins) (R W : Nat) : TMk :=
TMk.mk (W + 2) (R + R + 1) (nxt p R W) (wrt p R) (rt p R)
/-! ## Small facts -/
theorem selR_same (b : Bool) (v : List Bool) : selR b v v = v := by
cases b with
| false => rfl
| true => rfl
theorem beq_add_r (i j : Nat) : forall R, Nat.beq (i + R) (j + R) = Nat.beq i j := by
intro R
induction R with
| zero => rfl
| succ R ih => exact ih
theorem beq_lt (a b : Nat) (h : a < b) : Nat.beq a b = false :=
Found.Pnp2.beq_false_of_ne a b (fun e => Nat.not_succ_le_self b (e ▸ h))
theorem beq_gt (a b : Nat) (h : b < a) : Nat.beq a b = false :=
Found.Pnp2.beq_false_of_ne a b (fun e => Nat.not_succ_le_self a (e.symm ▸ h))
theorem lt_addR (i R : Nat) (rr : Nat) (h : i < R) : i < rr + R :=
Nat.lt_of_lt_of_le h (Nat.le_add_left R rr)
/-- Tracks of different registers, or present and value tracks, differ. -/
theorem bAV (R i rr : Nat) (hi : i < R) : Nat.beq (trA i) (trV R rr) = false :=
beq_lt i (rr + R) (lt_addR i R rr hi)
theorem bVA (R i rr : Nat) (hr : rr < R) : Nat.beq (trV R i) (trA rr) = false :=
beq_gt (i + R) rr (lt_addR rr R i hr)
theorem bAA (i rr : Nat) (h : Nat.beq i rr = false) : Nat.beq (trA i) (trA rr) = false := h
theorem bVV (R i rr : Nat) (h : Nat.beq i rr = false) : Nat.beq (trV R i) (trV R rr) = false := by
show Nat.beq (i + R) (rr + R) = false
rw [beq_add_r]
exact h
theorem trA_lt (R i : Nat) (hi : i < R) : trA i < (mach [] R 0).k + 1 :=
Nat.succ_le_succ (Nat.succ_le_succ (Nat.le_trans hi (Nat.le_add_left R R)))
theorem trV_lt (R i : Nat) (hi : i < R) : trV R i < (mach [] R 0).k + 1 :=
Nat.succ_le_succ (Nat.succ_le_succ
(Nat.le_trans (Nat.le_of_eq (Nat.add_right_comm i R 1)) (Nat.add_le_add_right hi R)))
theorem k_eq (p : List Ins) (R W : Nat) : (mach p R W).k = R + R + 1 := rfl
/-! ## Writes and marks -/
theorem wr0_keep (p : List Ins) (R : Nat) (j : Nat) (hA : forall r, Nat.beq j (trA r) = false)
(hV : forall r, Nat.beq j (trV R r) = false) :
forall q s, nthd (wr0 p R q s) j = nthd s j := by
intro q s
match q with
| [] => rfl
| [_] => rfl
| false :: false :: _ => rfl
| true :: true :: _ => rfl
| true :: false :: c =>
show nthd (iWr R s (nthI p (cnt c))) j = nthd s j
cases nthI p (cnt c) with
| none => rfl
| some ins =>
cases ins with
| push rr b =>
show nthd (selR (nthd s (trA rr)) s (setd (setd s (trA rr) true) (trV R rr) b)) j = nthd s j
cases nthd s (trA rr) with
| true => rfl
| false =>
show nthd (setd (setd s (trA rr) true) (trV R rr) b) j = nthd s j
rw [nthd_setd_other _ _ _ _ (hV rr), nthd_setd_other _ _ _ _ (hA rr)]
| pop rr e z o => rfl
| jmp l => rfl
| false :: true :: c =>
show nthd (qWr s (nthI p (cnt c))) j = nthd s j
cases nthI p (cnt c) with
| none => rfl
| some ins =>
cases ins with
| push rr b => rfl
| pop rr e z o =>
show nthd (setd s (trA rr) false) j = nthd s j
exact nthd_setd_other _ _ _ _ (hA rr)
| jmp l => rfl
theorem wrt_bit (p : List Ins) (R : Nat) (j : Nat) (hA : forall r, Nat.beq j (trA r) = false)
(hV : forall r, Nat.beq j (trV R r) = false) (q s : List Bool) :
nthd (wrt p R q s) j = nthd s j := by
show nthd (selR (nthd s 0) s (wr0 p R q s)) j = nthd s j
cases nthd s 0 with
| true => rfl
| false => exact wr0_keep p R j hA hV q s
/-- The two mark tracks are never written. -/
theorem marks_kept (p : List Ins) (R W : Nat) (q s : List Bool) :
nthd ((mach p R W).write q s) 0 = nthd s 0 /\ nthd ((mach p R W).write q s) 1 = nthd s 1 :=
And.intro (wrt_bit p R 0 (fun _ => rfl) (fun _ => rfl) q s)
(wrt_bit p R 1 (fun _ => rfl) (fun _ => rfl) q s)
/-- On a home-marked symbol every write is the identity. -/
theorem home_fixed (p : List Ins) (R W : Nat) (q s : List Bool) (h : nthd s 0 = true) :
(mach p R W).write q s = s := by
show selR (nthd s 0) s (wr0 p R q s) = s
rw [h]
rfl
theorem wrt_id_of (p : List Ins) (R : Nat) (q s : List Bool) (h : wr0 p R q s = s) :
wrt p R q s = s := by
show selR (nthd s 0) s (wr0 p R q s) = s
rw [h]
exact selR_same _ s
/-! ## The home and return state -/
theorem fwd_code (p : List Ins) (R W pc : Nat) (s : List Bool) (h : anyT s trA R = false) :
Fwd (mach p R W) (code W pc) (ist W pc) s := by
refine Fwd.mk ?_ (wrt_id_of p R _ s rfl) ?_
· show selR (anyT s trA R) (code W pc) (ist W pc) = ist W pc
rw [h]; rfl
· show (!(anyT s trA R)) = true
rw [h]; rfl
theorem keep_code (p : List Ins) (R W pc rr : Nat) (hr : rr < R) (s : List Bool)
(hs : nthd s (trA rr) = true) : Keep (mach p R W) (code W pc) s false := by
have ha : anyT s trA R = true := anyT_true s trA rr hs R hr
refine Keep.mk ?_ (wrt_id_of p R _ s rfl) ?_
· show selR (anyT s trA R) (code W pc) (ist W pc) = code W pc
rw [ha]; rfl
· show (!(anyT s trA R)) = false
rw [ha]; rfl
/-! ## The instruction state -/
theorem ist_look (p : List Ins) (W pc : Nat) (i : Ins) (hp : p.length <= W) (hi : nthI p pc = some i) :
nthI p (cnt (thm W pc)) = some i := by
rw [cnt_thm W pc (Nat.le_trans (Nat.le_of_lt (nthI_lt p pc i hi)) hp)]
exact hi
theorem keep_ist (p : List Ins) (R W pc rr : Nat) (i : Ins) (hp : p.length <= W)
(hi : nthI p pc = some i) (hrr : forall s, iRt s (some i) = nthd s (trA rr))
(hnx : forall s, nthd s (trA rr) = true -> iNext W (thm W pc) s (some i) = ist W pc)
(hwr : forall s, nthd s (trA rr) = true -> iWr R s (some i) = s)
(s : List Bool) (hs : nthd s (trA rr) = true) : Keep (mach p R W) (ist W pc) s true := by
have hl := ist_look p W pc i hp hi
refine Keep.mk ?_ ?_ ?_
· show iNext W (thm W pc) s (nthI p (cnt (thm W pc))) = ist W pc
rw [hl]; exact hnx s hs
· apply wrt_id_of
show iWr R s (nthI p (cnt (thm W pc))) = s
rw [hl]; exact hwr s hs
· show iRt s (nthI p (cnt (thm W pc))) = true
rw [hl, hrr s]; exact hs
theorem keep_push (p : List Ins) (R W pc rr : Nat) (b : Bool) (hp : p.length <= W)
(hi : nthI p pc = some (Ins.push rr b)) (s : List Bool) (hs : nthd s (trA rr) = true) :
Keep (mach p R W) (ist W pc) s true :=
keep_ist p R W pc rr _ hp hi (fun _ => rfl)
(fun s hs => by show selR (nthd s (trA rr)) _ _ = _; rw [hs]; rfl)
(fun s hs => by show selR (nthd s (trA rr)) _ _ = _; rw [hs]; rfl) s hs
theorem keep_pop (p : List Ins) (R W pc rr e z o : Nat) (hp : p.length <= W)
(hi : nthI p pc = some (Ins.pop rr e z o)) (s : List Bool) (hs : nthd s (trA rr) = true) :
Keep (mach p R W) (ist W pc) s true :=
keep_ist p R W pc rr _ hp hi (fun _ => rfl)
(fun s hs => by show selR (nthd s (trA rr)) _ _ = _; rw [hs]; rfl)
(fun _ _ => rfl) s hs
/-- push at the first absent cell (not home): the bits written, the turn, the next state. -/
theorem push_write (p : List Ins) (R W pc rr : Nat) (b : Bool) (hp : p.length <= W) (hR : rr < R)
(hi : nthI p pc = some (Ins.push rr b)) (s : List Bool) (hs : nthd s (trA rr) = false)
(h0 : nthd s 0 = false) :
(mach p R W).write (ist W pc) s = setd (setd s (trA rr) true) (trV R rr) b /\
(mach p R W).right (ist W pc) s = false /\
(mach p R W).next (ist W pc) s = code W (pc + 1) /\
nthd (setd (setd s (trA rr) true) (trV R rr) b) (trA rr) = true /\
nthd (setd (setd s (trA rr) true) (trV R rr) b) (trV R rr) = b /\
(forall i, i < R -> Nat.beq i rr = false ->
nthd (setd (setd s (trA rr) true) (trV R rr) b) (trA i) = nthd s (trA i) /\
nthd (setd (setd s (trA rr) true) (trV R rr) b) (trV R i) = nthd s (trV R i)) := by
have hl := ist_look p W pc _ hp hi
have hpc : pc <= W := Nat.le_trans (Nat.le_of_lt (nthI_lt p pc _ hi)) hp
refine And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ ?_))))
· show selR (nthd s 0) s (wr0 p R (ist W pc) s) = _
rw [h0]
show iWr R s (nthI p (cnt (thm W pc))) = _
rw [hl]
show selR (nthd s (trA rr)) s _ = _
rw [hs]; rfl
· show iRt s (nthI p (cnt (thm W pc))) = false
rw [hl]; exact hs
· show iNext W (thm W pc) s (nthI p (cnt (thm W pc))) = code W (pc + 1)
rw [hl]
show selR (nthd s (trA rr)) _ (code W (cnt (thm W pc) + 1)) = _
rw [hs, cnt_thm W pc hpc]; rfl
· rw [nthd_setd_other _ _ _ _ (bAV R rr rr hR)]
exact nthd_setd_same _ _ _
· exact nthd_setd_same _ _ _
· intro i hiR hne
refine And.intro ?_ ?_
· rw [nthd_setd_other _ _ _ _ (bAV R i rr hiR), nthd_setd_other _ _ _ _ (bAA i rr hne)]
· rw [nthd_setd_other _ _ _ _ (bVV R i rr hne), nthd_setd_other _ _ _ _ (bVA R i rr hR)]
/-- pop on the first absent cell: the turn into code e (first cell) or qst pc (later cell). -/
theorem pop_turn_empty (p : List Ins) (R W pc rr e z o : Nat) (hp : p.length <= W)
(hi : nthI p pc = some (Ins.pop rr e z o)) (s : List Bool) (hs : nthd s (trA rr) = false)
(hf : nthd s 1 = true) : Turn (mach p R W) (ist W pc) (code W e) s := by
have hl := ist_look p W pc _ hp hi
refine Turn.mk ?_ ?_ ?_
· show iNext W (thm W pc) s (nthI p (cnt (thm W pc))) = code W e
rw [hl]
show selR (nthd s (trA rr)) _ (selR (nthd s 1) (code W e) _) = _
rw [hs, hf]; rfl
· apply wrt_id_of
show iWr R s (nthI p (cnt (thm W pc))) = s
rw [hl]; rfl
· show iRt s (nthI p (cnt (thm W pc))) = false
rw [hl]; exact hs
theorem pop_turn_cons (p : List Ins) (R W pc rr e z o : Nat) (hp : p.length <= W)
(hi : nthI p pc = some (Ins.pop rr e z o)) (s : List Bool) (hs : nthd s (trA rr) = false)
(hf : nthd s 1 = false) : Turn (mach p R W) (ist W pc) (qst W pc) s := by
have hl := ist_look p W pc _ hp hi
refine Turn.mk ?_ ?_ ?_
· show iNext W (thm W pc) s (nthI p (cnt (thm W pc))) = qst W pc
rw [hl]
show selR (nthd s (trA rr)) _ (selR (nthd s 1) (code W e) _) = _
rw [hs, hf]; rfl
· apply wrt_id_of
show iWr R s (nthI p (cnt (thm W pc))) = s
rw [hl]; rfl
· show iRt s (nthI p (cnt (thm W pc))) = false
rw [hl]; exact hs
/-- pop's second state on the last present cell (not home). -/
theorem pop_erase (p : List Ins) (R W pc rr e z o : Nat) (hp : p.length <= W) (hR : rr < R)
(hi : nthI p pc = some (Ins.pop rr e z o)) (s : List Bool) (h0 : nthd s 0 = false) :
(mach p R W).write (qst W pc) s = setd s (trA rr) false /\
(mach p R W).right (qst W pc) s = false /\
(mach p R W).next (qst W pc) s = code W (bsel (nthd s (trV R rr)) o z) /\
nthd (setd s (trA rr) false) (trA rr) = false /\
(forall i, i < R -> Nat.beq i rr = false ->
nthd (setd s (trA rr) false) (trA i) = nthd s (trA i) /\
nthd (setd s (trA rr) false) (trV R i) = nthd s (trV R i)) := by
have hl := ist_look p W pc _ hp hi
refine And.intro ?_ (And.intro rfl (And.intro ?_ (And.intro (nthd_setd_same _ _ _) ?_)))
· show selR (nthd s 0) s (wr0 p R (qst W pc) s) = _
rw [h0]
show qWr s (nthI p (cnt (thm W pc))) = _
rw [hl]; rfl
· show qNext R W (thm W pc) s (nthI p (cnt (thm W pc))) = _
rw [hl]; rfl
· intro i _ hne
exact And.intro (nthd_setd_other _ _ _ _ (bAA i rr hne)) (nthd_setd_other _ _ _ _ (bVA R i rr hR))
theorem jmp_turn (p : List Ins) (R W pc l : Nat) (hp : p.length <= W)
(hi : nthI p pc = some (Ins.jmp l)) (s : List Bool) : Turn (mach p R W) (ist W pc) (code W l) s := by
have hl := ist_look p W pc _ hp hi
refine Turn.mk ?_ ?_ ?_
· show iNext W (thm W pc) s (nthI p (cnt (thm W pc))) = code W l
rw [hl]; rfl
· apply wrt_id_of
show iWr R s (nthI p (cnt (thm W pc))) = s
rw [hl]; rfl
· show iRt s (nthI p (cnt (thm W pc))) = false
rw [hl]; rfl
/-- Every state of the machine has W + 2 bits. -/
theorem code_len (W pc : Nat) : (code W pc).length = W + 2 := by
show (thm W pc).length + 1 + 1 = W + 2
rw [thm_len]
end Found.Pnp56
#print axioms Found.Pnp56.cnt_thm
#print axioms Found.Pnp56.thm_len
#print axioms Found.Pnp56.nthI_lt
#print axioms Found.Pnp56.selR_same
#print axioms Found.Pnp56.beq_add_r
#print axioms Found.Pnp56.beq_lt
#print axioms Found.Pnp56.beq_gt
#print axioms Found.Pnp56.bAV
#print axioms Found.Pnp56.bVA
#print axioms Found.Pnp56.bVV
#print axioms Found.Pnp56.trA_lt
#print axioms Found.Pnp56.trV_lt
#print axioms Found.Pnp56.wr0_keep
#print axioms Found.Pnp56.wrt_bit
#print axioms Found.Pnp56.marks_kept
#print axioms Found.Pnp56.home_fixed
#print axioms Found.Pnp56.fwd_code
#print axioms Found.Pnp56.keep_code
#print axioms Found.Pnp56.keep_push
#print axioms Found.Pnp56.keep_pop
#print axioms Found.Pnp56.push_write
#print axioms Found.Pnp56.pop_turn_empty
#print axioms Found.Pnp56.pop_turn_cons
#print axioms Found.Pnp56.pop_erase
#print axioms Found.Pnp56.jmp_turn
#print axioms Found.Pnp56.code_len
lean_all/found/Pnp57.lean
/-
T330 piece 57. found/Pnp57 -- a register program runs on its track machine in polynomially
many steps (CL3c, 15).
The track machine mach p R W of Pnp56 is related to the register machine of Pnp20 by S2:
Pnp53's Sim (head at home h, state code pc, registers laid from h + 1) together with Inv
(the home mark on h only, the first-cell mark on h + 1 only, no present bit at home).
Proved, for any program p whose registers are below R (ProgOK) and W >= length p:
* inv_run: Inv is kept along every run (Pnp55 run_bit, run_marked);
* step_ex: from an S2-related pair the machine reaches a pair S2-related to Pnp20's step
within pe stepE (regSz x R) steps (Pnp53 sim_push, sim_pop_empty, sim_pop_cons,
sim_jmp with the hypotheses discharged by Pnp56; zero steps once halted);
* rm_on_tm: n register machine steps take at most n * pe stepE (regSz x R + n) steps of
the track machine (Pnp54 run_sim): a polynomial in n and the register size.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp56
namespace Found.Pnp57
open Found.Pnp7 (nthd)
open Found.Pnp20 (Ins Cfg nthI step exec run)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp47 (nthd_sym lay_tail)
open Found.Pnp52 (rv)
open Found.Pnp53 (Sim RegsAt sim_push sim_pop_empty sim_pop_cons sim_jmp bsel)
open Found.Pnp54 (regSz stepE push_cost popc_cost short_cost run_sim step_sz)
open Found.Pnp55 (anyT anyT_false run_bit run_marked)
open Found.Pnp3 (pe)
open Found.Pnp47 (Lay)
open Found.Pnp56
/-- The marks and the empty home cell. -/
def Inv (t : Tape) (R h : Nat) : Prop :=
t h 0 = true /\ (forall j, h + 1 <= j -> t j 0 = false) /\ t (h + 1) 1 = true /\
(forall j, h + 1 + 1 <= j -> t j 1 = false) /\ (forall i, i < R -> t h (trA i) = false)
def S2 (p : List Ins) (R W h : Nat) (c : TCk) (d : Cfg) : Prop :=
Sim (mach p R W) trA (trV R) R h (code W) c d /\ Inv c.tape R h
/-- All registers named by the program are below R. -/
def ProgOK (p : List Ins) (R : Nat) : Prop :=
(forall pc rr b, nthI p pc = some (Ins.push rr b) -> rr < R) /\
(forall pc rr e z o, nthI p pc = some (Ins.pop rr e z o) -> rr < R)
theorem lt0 (R : Nat) : 0 < R + R + 1 + 1 := Nat.succ_le_succ (Nat.zero_le _)
theorem lt1 (R : Nat) : 1 < R + R + 1 + 1 := Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _))
theorem inv_run (p : List Ins) (R W h : Nat) :
forall n c, Inv c.tape R h -> Inv (tmRun (mach p R W) n c).tape R h := by
intro n c hi
have b0 : forall j, (tmRun (mach p R W) n c).tape j 0 = c.tape j 0 :=
run_bit (mach p R W) 0 (lt0 R) (fun q s => (marks_kept p R W q s).1) n c
have b1 : forall j, (tmRun (mach p R W) n c).tape j 1 = c.tape j 1 :=
run_bit (mach p R W) 1 (lt1 R) (fun q s => (marks_kept p R W q s).2) n c
refine And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ ?_)))
· rw [b0]; exact hi.1
· intro j hj; rw [b0]; exact hi.2.1 j hj
· rw [b1]; exact hi.2.2.1
· intro j hj; rw [b1]; exact hi.2.2.2.1 j hj
· intro i hiR
have r := run_marked (mach p R W) 0 (trA i) (lt0 R) (trA_lt R i hiR)
(fun q s => (marks_kept p R W q s).1)
(fun q s hs => by rw [home_fixed p R W q s hs]) n c h hi.1
rw [r]
exact hi.2.2.2.2 i hiR
theorem step_ex (p : List Ins) (R W h : Nat) (hp : p.length <= W) (hok : ProgOK p R)
(c : TCk) (d : Cfg) (hS : S2 p R W h c d) :
Exists (fun k => k <= pe stepE (regSz d.regs R) /\
S2 p R W h (tmRun (mach p R W) k c) (step p d)) := by
cases c with
| mk t0 pos q =>
cases d with
| mk pc x =>
have e1 : pos = h := hS.1.1
have e2 : q = code W pc := hS.1.2.1
have hl : RegsAt t0 trA (trV R) R h x := hS.1.2.2
have hinv : Inv t0 R h := hS.2
have hAV : forall i, i < R -> trA i < (mach p R W).k + 1 /\ trV R i < (mach p R W).k + 1 :=
fun i hi => And.intro (trA_lt R i hi) (trV_lt R i hi)
have hhome : anyT (symAt (mach p R W) t0 h) trA R = false :=
anyT_false _ _ R (fun i hi => by
rw [nthd_sym (mach p R W) t0 h (trA i) (trA_lt R i hi)]
exact hinv.2.2.2.2 i hi)
have hf := fwd_code p R W pc (symAt (mach p R W) t0 h) hhome
have ec : TCk.mk t0 pos q = TCk.mk t0 h (code W pc) := by rw [e1, e2]
cases hI : nthI p pc with
| none =>
refine Exists.intro 0 (And.intro (Nat.zero_le _) ?_)
show S2 p R W h (TCk.mk t0 pos q) (exec (Cfg.mk pc x) (nthI p pc))
rw [hI]
exact hS
| some ins =>
rw [ec]
cases ins with
| push rr b =>
have hR : rr < R := hok.1 pc rr b hI
have hA0 : nthd (symAt (mach p R W) t0 (h + 1 + (rv (x rr)).length)) (trA rr) = false := by
rw [nthd_sym (mach p R W) _ _ _ (trA_lt R rr hR)]
exact lay_tail t0 (trA rr) (trV R rr) (rv (x rr)) (h + 1) (hl rr hR) _ (Nat.le_refl _)
have h00 : nthd (symAt (mach p R W) t0 (h + 1 + (rv (x rr)).length)) 0 = false := by
rw [nthd_sym (mach p R W) _ _ _ (lt0 R)]
exact hinv.2.1 _ (Nat.le_add_right _ _)
have pw := push_write p R W pc rr b hp hR hI _ hA0 h00
have hs := sim_push (mach p R W) trA (trV R) R h (code W) p pc x t0 (ist W pc) rr b hI hR hAV hl hf
(keep_push p R W pc rr b hp hI)
(by rw [pw.1]; exact pw.2.2.2.1) (by rw [pw.1]; exact pw.2.2.2.2.1) pw.2.1 pw.2.2.1
(keep_code p R W (pc + 1) rr hR)
(fun i hi hne => by rw [pw.1]; exact pw.2.2.2.2.2 i hi hne)
exact Exists.intro _ (And.intro (push_cost x R rr hR)
(And.intro hs (inv_run p R W h _ (TCk.mk t0 h (code W pc)) hinv)))
| pop rr e z o =>
have hR : rr < R := hok.2 pc rr e z o hI
cases hx : x rr with
| nil =>
have hlr : Lay t0 (trA rr) (trV R rr) (h + 1) [] := by
have h' := hl rr hR
rw [hx] at h'
exact h'
have hA : nthd (symAt (mach p R W) t0 (h + 1)) (trA rr) = false := by
rw [nthd_sym (mach p R W) _ _ _ (trA_lt R rr hR)]
exact hlr (h + 1) (Nat.le_refl _)
have hF : nthd (symAt (mach p R W) t0 (h + 1)) 1 = true := by
rw [nthd_sym (mach p R W) _ _ _ (lt1 R)]
exact hinv.2.2.1
have hs := sim_pop_empty (mach p R W) trA (trV R) R h (code W) p pc x t0 (ist W pc) rr e z o
hI hR hAV hl hx hf (pop_turn_empty p R W pc rr e z o hp hI _ hA hF)
exact Exists.intro _ (And.intro (short_cost _)
(And.intro hs (inv_run p R W h _ (TCk.mk t0 h (code W pc)) hinv)))
| cons b tl =>
have hlr : Lay t0 (trA rr) (trV R rr) (h + 1) (rv tl ++ [b]) := by
have h' := hl rr hR
rw [hx] at h'
exact h'
have hA : nthd (symAt (mach p R W) t0 (h + 1 + (rv tl ++ [b]).length)) (trA rr) = false := by
rw [nthd_sym (mach p R W) _ _ _ (trA_lt R rr hR)]
exact lay_tail t0 (trA rr) (trV R rr) _ (h + 1) hlr _ (Nat.le_refl _)
have hF : nthd (symAt (mach p R W) t0 (h + 1 + (rv tl ++ [b]).length)) 1 = false := by
rw [nthd_sym (mach p R W) _ _ _ (lt1 R)]
refine hinv.2.2.2.1 _ ?_
rw [Found.Pnp48.len_snoc]
exact Nat.add_le_add_left (Nat.succ_le_succ (Nat.zero_le _)) (h + 1)
have hturn := pop_turn_cons p R W pc rr e z o hp hI _ hA hF
have h02 : nthd (symAt (mach p R W) t0 (h + 1 + (rv tl).length)) 0 = false := by
rw [nthd_sym (mach p R W) _ _ _ (lt0 R)]
exact hinv.2.1 _ (Nat.le_add_right _ _)
have pe2 := pop_erase p R W pc rr e z o hp hR hI _ h02
have hvb : nthd (symAt (mach p R W) t0 (h + 1 + (rv tl).length)) (trV R rr) = b := by
rw [nthd_sym (mach p R W) _ _ _ (trV_lt R rr hR)]
exact (Found.Pnp48.lay_last t0 (trA rr) (trV R rr) b (rv tl) (h + 1) hlr).2
have hnx : (mach p R W).next (qst W pc) (symAt (mach p R W) t0 (h + 1 + (rv tl).length)) =
code W (bsel b o z) := by
rw [pe2.2.2.1, hvb]
have hs := sim_pop_cons (mach p R W) trA (trV R) R h (code W) p pc x t0 (ist W pc) (qst W pc)
rr e z o b tl hI hR hAV hl hx hf (keep_pop p R W pc rr e z o hp hI) hturn
(by rw [pe2.1]; exact pe2.2.2.2.1) pe2.2.1 hnx (keep_code p R W (bsel b o z) rr hR)
(fun i hi hne => by rw [pe2.1]; exact pe2.2.2.2.2 i hi hne)
exact Exists.intro _ (And.intro (popc_cost x R rr hR b tl hx)
(And.intro hs (inv_run p R W h _ (TCk.mk t0 h (code W pc)) hinv)))
| jmp l =>
have hs := sim_jmp (mach p R W) trA (trV R) R h (code W) p pc x t0 (ist W pc) l hI hAV hl hf
(jmp_turn p R W pc l hp hI _)
exact Exists.intro _ (And.intro (short_cost _)
(And.intro hs (inv_run p R W h _ (TCk.mk t0 h (code W pc)) hinv)))
theorem rm_on_tm (p : List Ins) (R W h : Nat) (hp : p.length <= W) (hok : ProgOK p R) :
forall n c d, S2 p R W h c d ->
Exists (fun K => K <= n * pe stepE (regSz d.regs R + n) /\
S2 p R W h (tmRun (mach p R W) K c) (run p n d)) :=
run_sim (mach p R W) (S2 p R W h) p (fun d => regSz d.regs R) stepE (fun d => step_sz p R d)
(fun c d hS => step_ex p R W h hp hok c d hS)
end Found.Pnp57
#print axioms Found.Pnp57.lt0
#print axioms Found.Pnp57.lt1
#print axioms Found.Pnp57.inv_run
#print axioms Found.Pnp57.step_ex
#print axioms Found.Pnp57.rm_on_tm
lean_all/found/Pnp58.lean
/-
T330 piece 58. found/Pnp58 -- the start tape and whole program runs on the track machine
(CL3c, 16).
The start tape of the track machine for registers x has the home mark on cell 0, the
first-cell mark on cell 1, and register r laid (reversed) from cell 1 on its present and
value tracks. Proved, for any program p with registers below R and W >= length p:
* le_ex: m <= n gives n = m + d (by induction on <=; no subtraction);
* layOf: a tape whose cells off + 1 + d carry (has L d, nthd L d) lays L from off + 1;
* start_inv, start_regs, start_S2: the start tape with head at 0 in state code o is
S2-related to the register configuration (o, x);
* tm_runs: if the program, started at o on x, reaches pc o' with registers y in N steps
(Pnp21 Runs), the track machine reaches, within N * pe stepE (regSz x R + N) steps,
head 0, state code o', and every register y i (i < R) laid from cell 1.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp57
import found.Pnp21
namespace Found.Pnp58
open Found.Pnp7 (nthd)
open Found.Pnp12 (sel)
open Found.Pnp20 (Ins Cfg nthI step run)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp47 (Lay shift)
open Found.Pnp52 (rv)
open Found.Pnp53 (Sim RegsAt)
open Found.Pnp54 (regSz stepE)
open Found.Pnp3 (pe)
open Found.Pnp56
open Found.Pnp57
/-! ## Laying a list -/
def has : List Bool -> Nat -> Bool
| [], _ => false
| _ :: _, 0 => true
| _ :: l, d + 1 => has l d
theorem le_ex (m : Nat) : forall n, m <= n -> Exists (fun d => n = m + d) := by
intro n h
induction h with
| refl => exact Exists.intro 0 rfl
| step _ ih =>
cases ih with
| intro d hd => exact Exists.intro (d + 1) (congrArg Nat.succ hd)
theorem layOf (t : Tape) (a v : Nat) : forall (L : List Bool) (off : Nat),
(forall d, t (off + 1 + d) a = has L d) -> (forall d, t (off + 1 + d) v = nthd L d) ->
Lay t a v (off + 1) L := by
intro L
induction L with
| nil =>
intro off ha _ j hj
cases le_ex (off + 1) j hj with
| intro d hd => rw [hd]; exact ha d
| cons y L ih =>
intro off ha hv
refine And.intro (ha 0) (And.intro (hv 0) ?_)
refine ih (off + 1) (fun d => ?_) (fun d => ?_)
· rw [shift (off + 1) d]; exact ha (d + 1)
· rw [shift (off + 1) d]; exact hv (d + 1)
/-! ## The start tape -/
/-- m minus R, by structural recursion (no core subtraction lemmas). -/
def dropR : Nat -> Nat -> Nat
| m, 0 => m
| 0, _ + 1 => 0
| m + 1, R + 1 => dropR m R
theorem dropR_add (r : Nat) : forall R, dropR (r + R) R = r := by
intro R
induction R with
| zero => cases r with
| zero => rfl
| succ r => rfl
| succ R ih => exact ih
theorem blt_add (r : Nat) : forall R, Nat.blt (r + R) R = false := by
intro R
induction R with
| zero => cases r with
| zero => rfl
| succ r => rfl
| succ R ih => exact ih
theorem blt_lt : forall (r R : Nat), r < R -> Nat.blt r R = true := by
intro r
induction r with
| zero =>
intro R h
cases R with
| zero => exact absurd h (Nat.not_succ_le_zero 0)
| succ R => rfl
| succ r ih =>
intro R h
cases R with
| zero => exact absurd h (Nat.not_succ_le_zero _)
| succ R => exact ih R (Nat.le_of_succ_le_succ h)
def stB (R : Nat) (x : Nat -> List Bool) : Nat -> Nat -> Bool
| j, 0 => Nat.beq j 0
| j, 1 => Nat.beq j 1
| 0, _ + 2 => false
| d + 1, m + 2 => sel (Nat.blt m R) (has (rv (x m)) d) (nthd (rv (x (dropR m R))) d)
def startT (R : Nat) (x : Nat -> List Bool) : Tape := fun j i => stB R x j i
theorem one_add (d : Nat) : 0 + 1 + d = d + 1 := by
rw [Nat.zero_add, Nat.add_comm]
theorem start_inv (R : Nat) (x : Nat -> List Bool) : Inv (startT R x) R 0 := by
refine And.intro rfl (And.intro ?_ (And.intro rfl (And.intro ?_ (fun _ _ => rfl))))
· intro j hj
cases j with
| zero => exact absurd hj (Nat.not_succ_le_zero 0)
| succ j => rfl
· intro j hj
cases j with
| zero => exact absurd hj (Nat.not_succ_le_zero _)
| succ j =>
cases j with
| zero => exact absurd hj (Nat.not_succ_le_self 1)
| succ j => rfl
theorem start_regs (R : Nat) (x : Nat -> List Bool) : RegsAt (startT R x) trA (trV R) R 0 x := by
intro i hi
refine layOf (startT R x) (trA i) (trV R i) (rv (x i)) 0 (fun d => ?_) (fun d => ?_)
· rw [one_add]
show sel (Nat.blt i R) (has (rv (x i)) d) _ = has (rv (x i)) d
rw [blt_lt i R hi]
rfl
· rw [one_add]
show sel (Nat.blt (i + R) R) _ (nthd (rv (x (dropR (i + R) R))) d) = nthd (rv (x i)) d
rw [blt_add, dropR_add]
rfl
theorem start_S2 (p : List Ins) (R W o : Nat) (x : Nat -> List Bool) :
S2 p R W 0 (TCk.mk (startT R x) 0 (code W o)) (Cfg.mk o x) :=
And.intro (And.intro rfl (And.intro rfl (start_regs R x))) (start_inv R x)
/-! ## Whole runs -/
theorem regs_ext (t : Tape) (R h : Nat) (x y : Nat -> List Bool) (hxy : forall i, x i = y i)
(hx : RegsAt t trA (trV R) R h x) : RegsAt t trA (trV R) R h y := by
intro i hi
rw [(hxy i).symm]
exact hx i hi
theorem tm_runs (p : List Ins) (R W : Nat) (hp : p.length <= W) (hok : ProgOK p R)
(N o o' : Nat) (x y : Nat -> List Bool) (hr : Found.Pnp21.Runs p N o x o' y) :
Exists (fun K => K <= N * pe stepE (regSz x R + N) /\
(tmRun (mach p R W) K (TCk.mk (startT R x) 0 (code W o))).pos = 0 /\
(tmRun (mach p R W) K (TCk.mk (startT R x) 0 (code W o))).q = code W o' /\
RegsAt (tmRun (mach p R W) K (TCk.mk (startT R x) 0 (code W o))).tape trA (trV R) R 0 y) := by
cases rm_on_tm p R W 0 hp hok N _ (Cfg.mk o x) (start_S2 p R W o x) with
| intro K hK =>
refine Exists.intro K (And.intro hK.1 (And.intro hK.2.1.1 (And.intro ?_ ?_)))
· rw [hK.2.1.2.1, hr.1]
· exact regs_ext _ R 0 _ y hr.2 hK.2.1.2.2
end Found.Pnp58
#print axioms Found.Pnp58.le_ex
#print axioms Found.Pnp58.layOf
#print axioms Found.Pnp58.dropR_add
#print axioms Found.Pnp58.blt_add
#print axioms Found.Pnp58.blt_lt
#print axioms Found.Pnp58.one_add
#print axioms Found.Pnp58.start_inv
#print axioms Found.Pnp58.start_regs
#print axioms Found.Pnp58.start_S2
#print axioms Found.Pnp58.regs_ext
#print axioms Found.Pnp58.tm_runs
lean_all/found/Pnp59.lean
/-
T330 piece 59. found/Pnp59 -- the Cook-Levin reduction computed by a concrete track
machine in polynomially many steps (CL3c, 17).
Pnp42.cl3b runs the register program RED = redP ... on input l (register 13) and leaves
enc (red ...) in register 16 within pe redPE |l| steps. With Pnp58 the program runs on its
own track machine mach RED R W, W = length RED, R = 14 + (sumR RED + 3) (sumR bounds every
register the program names). Proved:
* sumR, insReg_lt, progOK_sum: every program's registers lie below sumR p, so
ProgOK p (14 + (sumR p + 3)) holds for every program p;
* frag_self: a program is a fragment of itself at offset 0;
* inpR, regSz_low, regSz_inp: the input configuration (l in register 13, all else
empty) has size exactly |l| below any R = 14 + d;
* red_tm: for every Turing machine M and its parameters, the track machine of RED,
started on the start tape of l, reaches within pe tmE |l| steps -- one polynomial
expression tmE, independent of l -- a configuration with head 0, the halting state
code W |RED|, and enc (red ...) laid (reversed) from cell 1 on the tracks of register 16.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp58
import found.Pnp42
namespace Found.Pnp59
open Found.Pnp3 (PE pe pe_mono pe_comp)
open Found.Pnp12 (TM rule)
open Found.Pnp19 (encCNF)
open Found.Pnp20 (Ins Cfg nthI selR beq_refl')
open Found.Pnp21 (Frag Runs shift)
open Found.Pnp32 (inpOf)
open Found.Pnp37 (redP)
open Found.Pnp42 (redPE cl3b)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp47 (Lay)
open Found.Pnp52 (rv)
open Found.Pnp54 (regSz stepE)
open Found.Pnp56
open Found.Pnp57
open Found.Pnp58
/-! ## A register bound for every program -/
def insReg : Ins -> Nat
| .push r _ => r
| .pop r _ _ _ => r
| .jmp _ => 0
def sumR : List Ins -> Nat
| [] => 0
| i :: p => insReg i + 1 + sumR p
theorem insReg_lt : forall (p : List Ins) (n : Nat) (i : Ins), nthI p n = some i -> insReg i < sumR p := by
intro p
induction p with
| nil =>
intro n i h
have h' : (none : Option Ins) = some i := h
cases h'
| cons a p ih =>
intro n i h
cases n with
| zero =>
have e : some a = some i := h
cases e
exact Nat.le_add_right (insReg a + 1) (sumR p)
| succ n =>
exact Nat.lt_of_lt_of_le (ih n i h) (Nat.le_add_left _ _)
theorem lt_big (a s : Nat) (h : a < s) : a < 14 + (s + 3) :=
Nat.lt_of_lt_of_le h (Nat.le_trans (Nat.le_add_right s 3) (Nat.le_add_left _ 14))
theorem progOK_sum (p : List Ins) : ProgOK p (14 + (sumR p + 3)) :=
And.intro
(fun pc _ _ h => lt_big _ _ (insReg_lt p pc _ h))
(fun pc _ _ _ _ h => lt_big _ _ (insReg_lt p pc _ h))
theorem shift_zero (ins : Ins) : shift 0 ins = ins := by
cases ins with
| push r b => rfl
| pop r e z w =>
show Ins.pop r (0 + e) (0 + z) (0 + w) = Ins.pop r e z w
rw [Nat.zero_add, Nat.zero_add, Nat.zero_add]
| jmp l =>
show Ins.jmp (0 + l) = Ins.jmp l
rw [Nat.zero_add]
theorem frag_self (p : List Ins) : Frag p 0 p := by
intro i ins h
rw [Nat.zero_add, shift_zero]
exact h
/-! ## The input configuration -/
def inpR (l : List Bool) : Nat -> List Bool := fun i => selR (Nat.beq i 13) l []
theorem inpR_13 (l : List Bool) : inpR l 13 = l := by
show selR (Nat.beq 13 13) l [] = l
rw [beq_refl']
rfl
theorem inpR_other (l : List Bool) (i : Nat) (h : Nat.beq i 13 = false) : inpR l i = [] := by
show selR (Nat.beq i 13) l [] = []
rw [h]
rfl
theorem regSz_low (l : List Bool) : forall R, R <= 13 -> regSz (inpR l) R = 0 := by
intro R
induction R with
| zero => intro _; rfl
| succ R ih =>
intro h
show regSz (inpR l) R + (inpR l R).length = 0
rw [ih (Nat.le_of_succ_le h), inpR_other l R (beq_lt R 13 h)]
rfl
theorem regSz_inp (l : List Bool) : forall d, regSz (inpR l) (14 + d) = l.length := by
intro d
induction d with
| zero =>
show regSz (inpR l) 13 + (inpR l 13).length = l.length
rw [regSz_low l 13 (Nat.le_refl _), inpR_13, Nat.zero_add]
| succ d ih =>
show regSz (inpR l) (14 + d) + (inpR l (14 + d)).length = l.length
rw [ih, inpR_other l (14 + d) (beq_gt (14 + d) 13 (Nat.le_add_right 14 d))]
rfl
/-! ## RED on its track machine -/
/-- The step bound: N * stepE (|l| + N) with N = redPE. -/
def tmE (e : PE) : PE := .mul e (Found.Pnp3.comp stepE (.add .x e))
theorem red_tm (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) (l : List Bool) :
Exists (fun K =>
K <= pe (tmE (redPE (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)) l.length /\
(tmRun (mach (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)
(14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3))
(redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length) K
(TCk.mk (startT (14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3)) (inpR l)) 0
(code (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length 0))).pos = 0 /\
(tmRun (mach (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)
(14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3))
(redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length) K
(TCk.mk (startT (14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3)) (inpR l)) 0
(code (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length 0))).q =
code (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length
(redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length /\
Lay (tmRun (mach (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)
(14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3))
(redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length) K
(TCk.mk (startT (14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3)) (inpR l)) 0
(code (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length 0))).tape
(trA 16) (trV (14 + (sumR (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) + 3)) 16) (0 + 1)
(rv (encCNF (Found.Pnp18.red M (p0 + 1 + pe eR l.length + 1) (pe eT l.length) p0 q0 (inpOf s l))))) := by
cases cl3b (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) 0 M p0 q0 s eR eT (frag_self _) l (inpR l)
(inpR_13 l) (inpR_other l) with
| intro N hN =>
cases hN with
| intro y hy =>
have hr : Runs (redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) N 0 (inpR l)
(redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT).length y := by
have r := hy.1
rw [Nat.zero_add] at r
exact r
cases tm_runs _ _ _ (Nat.le_refl _) (progOK_sum _) N 0 _ (inpR l) y hr with
| intro K hK =>
refine Exists.intro K (And.intro ?_ (And.intro hK.2.1 (And.intro hK.2.2.1 ?_)))
· refine Nat.le_trans hK.1 ?_
rw [regSz_inp l]
show N * pe stepE (l.length + N) <=
pe (redPE (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT) l.length *
pe (Found.Pnp3.comp stepE (.add .x (redPE (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT))) l.length
rw [pe_comp]
exact Nat.mul_le_mul hy.2.2 (pe_mono _ _ (Nat.add_le_add_left hy.2.2 _) stepE)
· have h16 := hK.2.2.2 16 (Nat.lt_of_lt_of_le (Nat.lt_succ_self 16)
(Nat.add_le_add_left (Nat.le_add_left 3 _) 14))
rw [hy.2.1] at h16
exact h16
end Found.Pnp59
#print axioms Found.Pnp59.insReg_lt
#print axioms Found.Pnp59.lt_big
#print axioms Found.Pnp59.progOK_sum
#print axioms Found.Pnp59.shift_zero
#print axioms Found.Pnp59.frag_self
#print axioms Found.Pnp59.inpR_13
#print axioms Found.Pnp59.inpR_other
#print axioms Found.Pnp59.regSz_low
#print axioms Found.Pnp59.regSz_inp
#print axioms Found.Pnp59.red_tm
lean_all/found/Pnp6.lean
/-
T330 piece 6. found/Pnp6 -- the tableau step of Cook-Levin for a local machine.
A one-bit cellular automaton on the cells 0, 1, 2, ... (the cell left of 0 reads false)
with a local rule given as a formula over the variables 0 (left), 1 (self), 2 (right).
* substitution of formulas for variables, and its evaluation law;
* the tableau formula of cell j at time t: evaluating it on the initial cells gives the
cell after t steps;
* pinning input cells to constants: acceptance with some certificate in the free cells
is satisfiability of the pinned tableau formula (with Pnp5: of a CNF).
Open (PNP_MAP.md): multi-bit cells (Turing machines as automata), and the size count
with shared subformulas. It relativizes (a tool). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp1
namespace Found.Pnp6
open Found.Pnp1
/-! ## Substitution -/
def subst (s : Nat -> Fm) : Fm -> Fm
| .var i => s i
| .cst b => .cst b
| .neg f => .neg (subst s f)
| .and f g => .and (subst s f) (subst s g)
| .or f g => .or (subst s f) (subst s g)
theorem ev_subst (a : Nat -> Bool) (s : Nat -> Fm) :
forall F : Fm, ev a (subst s F) = ev (fun i => ev a (s i)) F := by
intro F
induction F with
| var i => rfl
| cst b => rfl
| neg f ih => exact congrArg (fun t => !t) ih
| and f g ihf ihg =>
show (ev a (subst s f) && ev a (subst s g)) = _
rw [ihf, ihg]; rfl
| or f g ihf ihg =>
show (ev a (subst s f) || ev a (subst s g)) = _
rw [ihf, ihg]; rfl
/-! ## The automaton -/
def left (c : Nat -> Bool) : Nat -> Bool
| 0 => false
| j + 1 => c j
/-- The neighbourhood of cell j as an assignment of the variables 0, 1, 2. -/
def nbr (c : Nat -> Bool) (j : Nat) : Nat -> Bool
| 0 => left c j
| 1 => c j
| 2 => c (j + 1)
| _ + 3 => false
def step (r : Fm) (c : Nat -> Bool) : Nat -> Bool := fun j => ev (nbr c j) r
def run (r : Fm) : Nat -> (Nat -> Bool) -> Nat -> Bool
| 0, c => c
| t + 1, c => step r (run r t c)
/-! ## The tableau -/
def leftF (prev : Nat -> Fm) : Nat -> Fm
| 0 => .cst false
| j + 1 => prev j
def nbrF (prev : Nat -> Fm) (j : Nat) : Nat -> Fm
| 0 => leftF prev j
| 1 => prev j
| 2 => prev (j + 1)
| _ + 3 => .cst false
/-- The formula of cell j at time t, over the initial cells. -/
def cellF (r : Fm) : Nat -> Nat -> Fm
| 0, j => .var j
| t + 1, j => subst (nbrF (cellF r t) j) r
/-- Evaluation depends only on the values of the variables (pointwise; no funext). -/
theorem ev_ext (a b : Nat -> Bool) (h : forall i, a i = b i) : forall F : Fm, ev a F = ev b F := by
intro F
induction F with
| var i => exact h i
| cst _ => rfl
| neg f ih => exact congrArg (fun t => !t) ih
| and f g ihf ihg =>
show (ev a f && ev a g) = (ev b f && ev b g)
rw [ihf, ihg]
| or f g ihf ihg =>
show (ev a f || ev a g) = (ev b f || ev b g)
rw [ihf, ihg]
theorem ev_nbrF (a : Nat -> Bool) (prev : Nat -> Fm) (c : Nat -> Bool)
(h : forall j, ev a (prev j) = c j) (j : Nat) :
forall i, ev a (nbrF prev j i) = nbr c j i := by
intro i
match i with
| 0 =>
match j with
| 0 => rfl
| j + 1 => exact h j
| 1 => exact h j
| 2 => exact h (j + 1)
| _ + 3 => rfl
/-- The tableau is correct: its formula of cell j at time t gives the cell after t steps. -/
theorem tableau (r : Fm) (a : Nat -> Bool) : forall (t j : Nat), ev a (cellF r t j) = run r t a j := by
intro t
induction t with
| zero => intro j; rfl
| succ t ih =>
intro j
show ev a (subst (nbrF (cellF r t) j) r) = ev (nbr (run r t a) j) r
rw [ev_subst]
exact ev_ext _ _ (ev_nbrF a (cellF r t) (run r t a) ih j) r
/-! ## Pinning input cells -/
def pinO : Option Bool -> Nat -> Fm
| some b, _ => .cst b
| none, i => .var i
def mergeO : Option Bool -> Bool -> Bool
| some b, _ => b
| none, x => x
theorem ev_pinO (a : Nat -> Bool) (i : Nat) : forall o : Option Bool, ev a (pinO o i) = mergeO o (a i)
| some _ => rfl
| none => rfl
def pinS (pin : Nat -> Option Bool) (i : Nat) : Fm := pinO (pin i) i
def merge (pin : Nat -> Option Bool) (a : Nat -> Bool) (i : Nat) : Bool := mergeO (pin i) (a i)
theorem ev_pin (pin : Nat -> Option Bool) (a : Nat -> Bool) (F : Fm) :
ev a (subst (pinS pin) F) = ev (merge pin a) F :=
(ev_subst a (pinS pin) F).trans (ev_ext _ _ (fun i => ev_pinO a i (pin i)) F)
/-- Acceptance with some certificate in the free cells is satisfiability of the pinned
tableau formula. -/
theorem accept_iff_sat (r : Fm) (pin : Nat -> Option Bool) (T j : Nat) :
((Exists fun a : Nat -> Bool => run r T (merge pin a) j = true) ->
Exists fun a : Nat -> Bool => ev a (subst (pinS pin) (cellF r T j)) = true) /\
((Exists fun a : Nat -> Bool => ev a (subst (pinS pin) (cellF r T j)) = true) ->
Exists fun a : Nat -> Bool => run r T (merge pin a) j = true) :=
And.intro
(fun h => Exists.elim h fun a ha => Exists.intro a
(((ev_pin pin a _).trans (tableau r (merge pin a) T j)).trans ha))
(fun h => Exists.elim h fun a ha => Exists.intro a
(((ev_pin pin a _).trans (tableau r (merge pin a) T j)).symm.trans ha))
end Found.Pnp6
#print axioms Found.Pnp6.ev_subst
#print axioms Found.Pnp6.ev_ext
#print axioms Found.Pnp6.ev_nbrF
#print axioms Found.Pnp6.tableau
#print axioms Found.Pnp6.ev_pinO
#print axioms Found.Pnp6.ev_pin
#print axioms Found.Pnp6.accept_iff_sat
lean_all/found/Pnp60.lean
/-
T330 piece 60. found/Pnp60 -- the Cook-Levin theorem with the reduction computed by a
concrete machine in polynomial time (CL3c, 18; closes O3 in the form of Pnp18).
For a language L verified by a one-tape Turing machine M (Pnp12-14) with polynomial
bounds W(n) = p0 + 1 + eR(n) + 1, T(n) = eT(n) (the assumptions of Pnp18.cl1, for every
input), the reduction x |-> red x (the tableau CNF) is computed by one fixed concrete
track machine TMred = mach RED R |RED| (Pnp56) from the start tape of x (Pnp58), and:
* cook_levin: for every input l there is K <= pe (tmE redPE) |l| such that after K steps
TMred has its head at 0, is in the halting state of RED, and carries enc (red l) laid
on the output tracks (register 16); and L l holds iff red l is satisfiable;
* out_unique: the laid output determines the CNF (Lay determines the list; Pnp19 enc_inj).
The bound pe (tmE redPE) is one polynomial expression of |l| (Pnp3.PE), fixed by M and the
bounds. Relativizes (a tool; PNP_MAP.md). ASCII forms only. CIC dependence: none.
-/
import found.Pnp59
import found.Pnp18
namespace Found.Pnp60
open Found.Pnp3 (PE pe)
open Found.Pnp7 (nthd)
open Found.Pnp12 (TM rule)
open Found.Pnp13 (TC Inside)
open Found.Pnp14 (InputOK)
open Found.Pnp19 (encCNF)
open Found.Pnp32 (inpOf)
open Found.Pnp37 (redP)
open Found.Pnp42 (redPE)
open Found.Pnp43
open Found.Pnp44
open Found.Pnp47 (Lay)
open Found.Pnp52 (rv)
open Found.Pnp56
open Found.Pnp58
open Found.Pnp59
/-- The register program of the reduction, its register bound and its track machine. -/
def RED (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) : List Found.Pnp20.Ins :=
redP (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT
def RR (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) : Nat :=
14 + (sumR (RED M p0 q0 s eR eT) + 3)
def TMred (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) : TMk :=
mach (RED M p0 q0 s eR eT) (RR M p0 q0 s eR eT) (RED M p0 q0 s eR eT).length
def startRed (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) (l : List Bool) : TCk :=
TCk.mk (startT (RR M p0 q0 s eR eT) (inpR l)) 0 (code (RED M p0 q0 s eR eT).length 0)
/-- The verifier bounds of Pnp18.cl1 at input l. -/
def Wn (p0 : Nat) (eR : PE) (l : List Bool) : Nat := p0 + 1 + pe eR l.length + 1
def Tn (eT : PE) (l : List Bool) : Nat := pe eT l.length
def Verifies (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE) (L : List Bool -> Prop) : Prop :=
forall l, p0 + 2 < Wn p0 eR l /\
(forall tape : Nat -> Bool, Inside M (Wn p0 eR l) (Tn eT l) (TC.mk tape (p0 + 1) q0)) /\
(L l <-> Exists fun tape : Nat -> Bool => InputOK tape (inpOf s l) /\ tape (Wn p0 eR l) = false /\
(Found.Pnp13.tmRun M (Tn eT l) (TC.mk tape (p0 + 1) q0)).tape 0 = true)
theorem cook_levin (M : TM) (p0 : Nat) (q0 : List Bool) (s : Nat) (eR eT : PE)
(hq0 : q0.length = M.m) (hnext : forall a b, (M.next a b).length = M.m)
(L : List Bool -> Prop) (hv : Verifies M p0 q0 s eR eT L) (l : List Bool) :
Exists (fun K =>
K <= pe (tmE (redPE (M.m + 2) (rule M) M.m (p0 + 1) q0 s eR eT)) l.length /\
(tmRun (TMred M p0 q0 s eR eT) K (startRed M p0 q0 s eR eT l)).pos = 0 /\
(tmRun (TMred M p0 q0 s eR eT) K (startRed M p0 q0 s eR eT l)).q =
code (RED M p0 q0 s eR eT).length (RED M p0 q0 s eR eT).length /\
Lay (tmRun (TMred M p0 q0 s eR eT) K (startRed M p0 q0 s eR eT l)).tape
(trA 16) (trV (RR M p0 q0 s eR eT) 16) (0 + 1)
(rv (encCNF (Found.Pnp18.red M (Wn p0 eR l) (Tn eT l) p0 q0 (inpOf s l))))) /\
(L l <-> Exists fun v => Found.Pnp8.cnfv v (Found.Pnp18.red M (Wn p0 eR l) (Tn eT l) p0 q0 (inpOf s l)) = true) := by
refine And.intro (red_tm M p0 q0 s eR eT l) ?_
have h := hv l
have c := Found.Pnp18.cl1 M (Wn p0 eR l) (Tn eT l) p0 q0 hq0 hnext h.1 (inpOf s l) h.2.1 (L l) h.2.2
exact Iff.intro c.1 c.2
/-! ## The output determines the CNF -/
theorem lay_unique (t : Tape) (a v : Nat) : forall (xs ys : List Bool) p,
Lay t a v p xs -> Lay t a v p ys -> xs = ys := by
intro xs
induction xs with
| nil =>
intro ys p hx hy
cases ys with
| nil => rfl
| cons y ys =>
have e1 : t p a = true := hy.1
have e2 : t p a = false := hx p (Nat.le_refl p)
rw [e1] at e2
exact Bool.noConfusion e2
| cons x xs ih =>
intro ys p hx hy
cases ys with
| nil =>
have e1 : t p a = true := hx.1
have e2 : t p a = false := hy p (Nat.le_refl p)
rw [e1] at e2
exact Bool.noConfusion e2
| cons y ys =>
have ex : x = y := hx.2.1.symm.trans hy.2.1
rw [ex, ih ys (p + 1) hx.2.2 hy.2.2]
theorem rv_inj : forall (a b : List Bool), rv a = rv b -> a = b := by
intro a b h
have ra : Found.Pnp52.rv (Found.Pnp52.rv a) = a := rv_rv a
have rb : Found.Pnp52.rv (Found.Pnp52.rv b) = b := rv_rv b
rw [ra.symm, rb.symm, h]
where
rv_app : forall (l : List Bool) (b : Bool), rv (l ++ [b]) = b :: rv l := by
intro l
induction l with
| nil => intro b; rfl
| cons c l ih =>
intro b
show rv (l ++ [b]) ++ [c] = b :: (rv l ++ [c])
rw [ih b]
rfl
rv_rv : forall (l : List Bool), rv (rv l) = l := by
intro l
induction l with
| nil => rfl
| cons c l ih =>
show rv (rv l ++ [c]) = c :: l
rw [rv_app (rv l) c, ih]
theorem out_unique (t : Tape) (a v p : Nat) (f g : List (List (Bool × Found.Pnp9.V)))
(hf : Lay t a v p (rv (encCNF f))) (hg : Lay t a v p (rv (encCNF g))) : f = g :=
Found.Pnp19.enc_inj f g (rv_inj _ _ (lay_unique t a v _ _ p hf hg))
end Found.Pnp60
#print axioms Found.Pnp60.cook_levin
#print axioms Found.Pnp60.lay_unique
#print axioms Found.Pnp60.rv_inj
#print axioms Found.Pnp60.out_unique
lean_all/found/Pnp61.lean
/-
T330 piece 61. found/Pnp61 -- the proof complexity bridge: NP different from coNP gives
P different from NP (the easy direction of Cook's program).
Over a machine model of RootComp (T329) with two laws -- P is closed under complement, and
P is inside NP -- equality of P and NP makes NP closed under complement. Hence a language in
NP whose complement is not in NP (NP /= coNP, the statement that no propositional proof
system is polynomially bounded; Cook--Reckhow 1979) is a language in NP outside P.
Proved:
* np_closed_of_eq: if NP is inside P then every NP language has its complement in NP;
* p_ne_np_of_np_ne_conp: a language in NP with complement outside NP is not in P.
The laws are hypotheses (fields of a structure), so the bridge holds in every model with
them. Relativizes (a bridge; PNP_MAP.md). ASCII forms only. CIC dependence: none.
-/
import found.RootComp
namespace Found.Pnp61
open Found.RootComp (Machine InP InNP)
/-- The complement of a language. -/
def compl (L : List Bool -> Bool) : List Bool -> Bool := fun x => !(L x)
/-- coNP: the complement is in NP. -/
def InCoNP (M : Machine) (L : List Bool -> Bool) : Prop := InNP M (compl L)
/-- Two laws of a machine model. -/
structure Laws (M : Machine) : Prop where
p_compl : forall L, InP M L -> InP M (compl L)
p_np : forall L, InP M L -> InNP M L
theorem np_closed_of_eq (M : Machine) (hl : Laws M) (heq : forall L, InNP M L -> InP M L)
(L : List Bool -> Bool) (hL : InNP M L) : InCoNP M L :=
hl.p_np (compl L) (hl.p_compl L (heq L hL))
theorem p_ne_np_of_np_ne_conp (M : Machine) (hl : Laws M) (L : List Bool -> Bool)
(_hL : InNP M L) (hc : InCoNP M L -> False) : InP M L -> False :=
fun hP => hc (hl.p_np (compl L) (hl.p_compl L hP))
/-- The same in global form: NP /= coNP (some NP language with complement outside NP)
gives a language in NP outside P. -/
theorem sep_of_conp (M : Machine) (hl : Laws M)
(h : Exists fun L : List Bool -> Bool => InNP M L /\ (InCoNP M L -> False)) :
Exists fun L : List Bool -> Bool => InNP M L /\ (InP M L -> False) :=
match h with
| Exists.intro L hL => Exists.intro L (And.intro hL.1 (p_ne_np_of_np_ne_conp M hl L hL.1 hL.2))
end Found.Pnp61
#print axioms Found.Pnp61.np_closed_of_eq
#print axioms Found.Pnp61.p_ne_np_of_np_ne_conp
#print axioms Found.Pnp61.sep_of_conp
lean_all/found/Pnp62.lean
/-
T330 piece 62. found/Pnp62 -- the resolution proof system on the CNFs of RootComp, with its
soundness (the first system of the proof complexity candidate; PNP_MAP.md).
A resolution proof of a clause from a CNF F is a tree: leaves are clauses of F, and an
inner node resolves two clauses on a variable v (one has the literal (true, v), the other
(false, v)); the resolvent contains all other literals of both (weakening allowed). The
size is the number of nodes. Proved:
* beqLit_eq, beqCl_eq: literal and clause comparison decide equality;
* mem_true, of_mem: a clause is true iff one of its literals is;
* res_sound: an assignment satisfying both premises satisfies the resolvent;
* sound: every clause with a resolution proof from F is true under every assignment
satisfying F;
* refute_unsat: a resolution refutation (a proof of the empty clause) shows F
unsatisfiable.
Written with ASCII forms only. CIC dependence: none.
-/
import found.RootComp
import found.Pnp2
namespace Found.Pnp62
open Found.RootComp (Lit Clause CNF evalLit evalClause evalCNF Sat)
def beqB (a b : Bool) : Bool :=
match a, b with
| true, true => true
| false, false => true
| true, false => false
| false, true => false
def beqLit (l m : Lit) : Bool := beqB l.1 m.1 && Nat.beq l.2 m.2
def memL (l : Lit) : Clause -> Bool
| [] => false
| m :: c => beqLit m l || memL l c
def beqCl : Clause -> Clause -> Bool
| [], [] => true
| [], _ :: _ => false
| _ :: _, [] => false
| l :: c, m :: d => beqLit l m && beqCl c d
def memC (C : Clause) : CNF -> Bool
| [] => false
| D :: F => beqCl D C || memC C F
theorem beqB_eq (a b : Bool) (h : beqB a b = true) : a = b := by
cases a with
| false => cases b with
| false => rfl
| true => exact Bool.noConfusion h
| true => cases b with
| false => exact Bool.noConfusion h
| true => rfl
theorem and_l {a b : Bool} (h : (a && b) = true) : a = true := by
cases a with
| false => exact Bool.noConfusion h
| true => rfl
theorem and_r {a b : Bool} (h : (a && b) = true) : b = true := by
cases a with
| false => exact Bool.noConfusion h
| true => exact h
theorem or_l {a b : Bool} (h : a = true) : (a || b) = true := by rw [h]; rfl
theorem or_r {a b : Bool} (h : b = true) : (a || b) = true := by
cases a with
| false => exact h
| true => rfl
theorem beqLit_eq (l m : Lit) (h : beqLit l m = true) : l = m := by
cases l with
| mk a i =>
cases m with
| mk b j =>
have h1 : a = b := beqB_eq a b (and_l h)
have h2 : i = j := Found.Pnp2.beq_eq i j (and_r h)
rw [h1, h2]
theorem beqB_refl (a : Bool) : beqB a a = true := by
cases a with
| false => rfl
| true => rfl
theorem beq_refl (n : Nat) : Nat.beq n n = true := by
induction n with
| zero => rfl
| succ n ih => exact ih
theorem beqLit_refl (l : Lit) : beqLit l l = true := by
show (beqB l.1 l.1 && Nat.beq l.2 l.2) = true
rw [beqB_refl, beq_refl]
rfl
theorem beqCl_eq : forall C D : Clause, beqCl C D = true -> C = D := by
intro C
induction C with
| nil =>
intro D h
cases D with
| nil => rfl
| cons m D => exact Bool.noConfusion h
| cons l C ih =>
intro D h
cases D with
| nil => exact Bool.noConfusion h
| cons m D =>
have h' : (beqLit l m && beqCl C D) = true := h
rw [beqLit_eq l m (and_l h'), ih D (and_r h')]
/-! ## Truth of clauses through literals -/
theorem mem_true (a : Nat -> Bool) : forall C : Clause, evalClause a C = true ->
Exists fun l => memL l C = true /\ evalLit a l = true := by
intro C
induction C with
| nil => intro h; exact Bool.noConfusion h
| cons m C ih =>
intro h
have h' : (evalLit a m || evalClause a C) = true := h
cases e : evalLit a m with
| true => exact Exists.intro m (And.intro (or_l (beqLit_refl m)) e)
| false =>
rw [e] at h'
cases ih h' with
| intro l hl => exact Exists.intro l (And.intro (or_r hl.1) hl.2)
theorem of_mem (a : Nat -> Bool) (l : Lit) (hl : evalLit a l = true) :
forall R : Clause, memL l R = true -> evalClause a R = true := by
intro R
induction R with
| nil => intro h; exact Bool.noConfusion h
| cons m R ih =>
intro h
show (evalLit a m || evalClause a R) = true
have h' : (beqLit m l || memL l R) = true := h
cases e : beqLit m l with
| true =>
rw [beqLit_eq m l e]
exact or_l hl
| false =>
rw [e] at h'
exact or_r (ih h')
theorem cnf_mem (a : Nat -> Bool) (C : Clause) : forall F : CNF, evalCNF a F = true -> memC C F = true ->
evalClause a C = true := by
intro F
induction F with
| nil => intro _ h; exact Bool.noConfusion h
| cons D F ih =>
intro hF h
have hF' : (evalClause a D && evalCNF a F) = true := hF
have h' : (beqCl D C || memC C F) = true := h
cases e : beqCl D C with
| true =>
rw [(beqCl_eq D C e).symm]
exact and_l hF'
| false =>
rw [e] at h'
exact ih (and_r hF') h'
/-! ## Resolution -/
/-- R is a resolvent of C1 (holding (true, v)) and C2 (holding (false, v)), with weakening. -/
structure ResOK (C1 C2 : Clause) (v : Nat) (R : Clause) : Prop where
pos : memL (true, v) C1 = true
neg : memL (false, v) C2 = true
keep1 : forall l, memL l C1 = true -> beqLit l (true, v) = false -> memL l R = true
keep2 : forall l, memL l C2 = true -> beqLit l (false, v) = false -> memL l R = true
theorem res_sound (a : Nat -> Bool) (C1 C2 R : Clause) (v : Nat) (h : ResOK C1 C2 v R)
(h1 : evalClause a C1 = true) (h2 : evalClause a C2 = true) : evalClause a R = true := by
cases mem_true a C1 h1 with
| intro l1 hl1 =>
cases e1 : beqLit l1 (true, v) with
| false => exact of_mem a l1 hl1.2 R (h.keep1 l1 hl1.1 e1)
| true =>
have hv : a v = true := by
have t := hl1.2
rw [beqLit_eq l1 (true, v) e1] at t
exact t
cases mem_true a C2 h2 with
| intro l2 hl2 =>
cases e2 : beqLit l2 (false, v) with
| false => exact of_mem a l2 hl2.2 R (h.keep2 l2 hl2.1 e2)
| true =>
have t := hl2.2
rw [beqLit_eq l2 (false, v) e2] at t
have t' : (!(a v)) = true := t
rw [hv] at t'
exact Bool.noConfusion t'
/-- Resolution proofs (trees) of a clause from F. -/
inductive RProof (F : CNF) : Clause -> Type where
| ax (C : Clause) (h : memC C F = true) : RProof F C
| res (C1 C2 R : Clause) (v : Nat) (p1 : RProof F C1) (p2 : RProof F C2) (h : ResOK C1 C2 v R) : RProof F R
def RProof.size {F : CNF} : {C : Clause} -> RProof F C -> Nat
| _, .ax _ _ => 1
| _, .res _ _ _ _ p1 p2 _ => p1.size + p2.size + 1
theorem sound (F : CNF) (a : Nat -> Bool) (hF : evalCNF a F = true) :
forall (C : Clause), RProof F C -> evalClause a C = true := by
intro C p
induction p with
| ax C h => exact cnf_mem a C F hF h
| res C1 C2 R v _ _ h ih1 ih2 => exact res_sound a C1 C2 R v h ih1 ih2
theorem refute_unsat (F : CNF) (p : RProof F []) : Sat F -> False := by
intro hs
cases hs with
| intro a ha =>
have t := sound F a ha [] p
exact Bool.noConfusion t
end Found.Pnp62
#print axioms Found.Pnp62.beqB_eq
#print axioms Found.Pnp62.beqLit_eq
#print axioms Found.Pnp62.beqLit_refl
#print axioms Found.Pnp62.beqCl_eq
#print axioms Found.Pnp62.mem_true
#print axioms Found.Pnp62.of_mem
#print axioms Found.Pnp62.cnf_mem
#print axioms Found.Pnp62.res_sound
#print axioms Found.Pnp62.sound
#print axioms Found.Pnp62.refute_unsat
lean_all/found/Pnp63.lean
/-
T330 piece 63. found/Pnp63 -- Cook--Reckhow proof systems and the bridge to P /= NP.
A proof system for a language L over a machine model of RootComp (Cook--Reckhow 1979) is a
program that checks proofs w of members x in polynomial time: L x holds iff some w is
accepted. It is polynomially bounded when every member has an accepted proof of
polynomial length. Proved:
* pb_np, np_pb: polynomially bounded proof systems for L are exactly NP certificates for
L (both directions, by the definitions);
* cr_bridge: for L in NP, if the complement of L has no polynomially bounded proof
system, then L is not in P (with Pnp61's laws). For L = SAT, the complement is the
unsatisfiable CNFs (resolution, Pnp62, is one proof system for it); lower bounds for
every proof system are the proof complexity route to P /= NP.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp61
namespace Found.Pnp63
open Found.RootComp (Machine InP InNP pbound)
open Found.Pnp61 (compl InCoNP Laws p_ne_np_of_np_ne_conp)
/-- A proof system for L checked by program p within the bound c n^k + c. -/
def ProofSystem (M : Machine) (L : List Bool -> Bool) (p : M.Prog) (c k : Nat) : Prop :=
forall x, L x = true <->
Exists fun w : List Bool => M.run p (pbound c k (x.length + w.length)) (x ++ w) = some true
/-- Polynomially bounded: every member has an accepted proof of polynomial length. -/
def PolyBounded (M : Machine) (L : List Bool -> Bool) : Prop :=
Exists fun p : M.Prog => Exists fun c => Exists fun k =>
forall x, L x = true <->
Exists fun w : List Bool => w.length <= pbound c k x.length /\
M.run p (pbound c k (x.length + w.length)) (x ++ w) = some true
theorem pb_np (M : Machine) (L : List Bool -> Bool) (h : PolyBounded M L) : InNP M L := h
theorem np_pb (M : Machine) (L : List Bool -> Bool) (h : InNP M L) : PolyBounded M L := h
theorem cr_bridge (M : Machine) (hl : Laws M) (L : List Bool -> Bool) (hL : InNP M L)
(hpb : PolyBounded M (compl L) -> False) : InP M L -> False :=
p_ne_np_of_np_ne_conp M hl L hL (fun hc => hpb (np_pb M (compl L) hc))
end Found.Pnp63
#print axioms Found.Pnp63.pb_np
#print axioms Found.Pnp63.np_pb
#print axioms Found.Pnp63.cr_bridge
lean_all/found/Pnp64.lean
/-
T330 piece 64. found/Pnp64 -- the Prover--Delayer lower bound for tree resolution
(Pudlak--Impagliazzo 2000), in general form.
A Delayer is a set S of partial assignments with a potential phi (the points the Delayer is
still sure to score). If (D1) a state in S falsifying a clause of F has potential 0, and
(D2) at every state and unassigned variable the Delayer either fixes the variable without
losing potential or offers both values losing at most one point, then every tree
resolution proof (Pnp62) of a clause falsified by a state rho in S has at least
2^(phi rho) nodes. Proved:
* fals_ext: extending a partial assignment at an unassigned variable keeps every
falsified clause falsified;
* side_true, side_false: if rho falsifies the resolvent and sets v, it falsifies the
premise whose literal on v is false;
* pd_bound: size >= 2^(phi rho);
* pd_refute: every tree resolution refutation of F has at least 2^(phi rho0) nodes for
every rho0 in S.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp62
import found.Pnp9
namespace Found.Pnp64
open Found.RootComp (Lit Clause CNF)
open Found.Pnp62 (beqLit beqLit_eq memL memC ResOK RProof)
open Found.Pnp9 (pow2)
abbrev PA := Nat -> Option Bool
/-- rho falsifies C: every literal of C is set to its false value. -/
def Fals (rho : PA) (C : Clause) : Prop := forall l, memL l C = true -> rho l.2 = some (!l.1)
def selO : Bool -> Option Bool -> Option Bool -> Option Bool
| true, x, _ => x
| false, _, y => y
def ext (rho : PA) (v : Nat) (b : Bool) : PA := fun w => selO (Nat.beq w v) (some b) (rho w)
theorem pow2_mono : forall m n, m <= n -> pow2 m <= pow2 n := by
intro m n h
induction h with
| refl => exact Nat.le_refl _
| step _ ih => exact Nat.le_trans ih (Nat.le_add_right _ _)
theorem ext_same (rho : PA) (v : Nat) (b : Bool) : ext rho v b v = some b := by
show selO (Nat.beq v v) (some b) (rho v) = some b
rw [Found.Pnp62.beq_refl v]
rfl
theorem fals_ext (rho : PA) (v : Nat) (b : Bool) (hv : rho v = none) (C : Clause) (h : Fals rho C) :
Fals (ext rho v b) C := by
intro l hl
show selO (Nat.beq l.2 v) (some b) (rho l.2) = some (!l.1)
cases e : Nat.beq l.2 v with
| false => exact h l hl
| true =>
have ev : l.2 = v := Found.Pnp2.beq_eq _ _ e
have t := h l hl
rw [ev, hv] at t
cases t
theorem side_true (rho : PA) (C1 C2 R : Clause) (v : Nat) (hr : ResOK C1 C2 v R) (hR : Fals rho R)
(hv : rho v = some true) : Fals rho C2 := by
intro l hl
cases e : beqLit l (false, v) with
| false => exact hR l (hr.keep2 l hl e)
| true =>
rw [beqLit_eq l (false, v) e]
exact hv
theorem side_false (rho : PA) (C1 C2 R : Clause) (v : Nat) (hr : ResOK C1 C2 v R) (hR : Fals rho R)
(hv : rho v = some false) : Fals rho C1 := by
intro l hl
cases e : beqLit l (true, v) with
| false => exact hR l (hr.keep1 l hl e)
| true =>
rw [beqLit_eq l (true, v) e]
exact hv
/-- The Delayer's two rules. -/
structure Delayer (F : CNF) (S : PA -> Prop) (phi : PA -> Nat) : Prop where
lose : forall rho, S rho -> forall C, memC C F = true -> Fals rho C -> phi rho = 0
move : forall rho v, S rho -> rho v = none ->
Or (Exists fun b => S (ext rho v b) /\ phi rho <= phi (ext rho v b))
(S (ext rho v false) /\ S (ext rho v true) /\
phi rho <= phi (ext rho v false) + 1 /\ phi rho <= phi (ext rho v true) + 1)
theorem both_le (k a b : Nat) (ha : pow2 k <= a) (hb : pow2 k <= b) : pow2 (k + 1) <= a + b + 1 :=
Nat.le_trans (Nat.add_le_add ha hb) (Nat.le_add_right _ 1)
theorem pd_bound (F : CNF) (S : PA -> Prop) (phi : PA -> Nat) (hd : Delayer F S phi) :
forall (C : Clause) (p : RProof F C) (rho : PA), S rho -> Fals rho C -> pow2 (phi rho) <= p.size := by
intro C p
induction p with
| ax C h =>
intro rho hs hf
rw [hd.lose rho hs C h hf]
exact Nat.le_refl 1
| res C1 C2 R v p1 p2 hr ih1 ih2 =>
intro rho hs hf
show pow2 (phi rho) <= p1.size + p2.size + 1
have up1 : p1.size <= p1.size + p2.size + 1 :=
Nat.le_trans (Nat.le_add_right p1.size p2.size) (Nat.le_add_right _ 1)
have up2 : p2.size <= p1.size + p2.size + 1 :=
Nat.le_trans (Nat.le_add_left p2.size p1.size) (Nat.le_add_right _ 1)
-- a state that sets v and falsifies R
have setv : forall rho', S rho' -> Fals rho' R -> forall b, rho' v = some b ->
pow2 (phi rho') <= p1.size + p2.size + 1 := by
intro rho' hs' hf' b hb
cases b with
| true => exact Nat.le_trans (ih2 rho' hs' (side_true rho' C1 C2 R v hr hf' hb)) up2
| false => exact Nat.le_trans (ih1 rho' hs' (side_false rho' C1 C2 R v hr hf' hb)) up1
cases ev : rho v with
| some b => exact setv rho hs hf b ev
| none =>
cases hd.move rho v hs ev with
| inl hf1 =>
cases hf1 with
| intro b hb =>
exact Nat.le_trans (pow2_mono _ _ hb.2)
(setv (ext rho v b) hb.1 (fals_ext rho v b ev R hf) b (ext_same rho v b))
| inr h2 =>
have a0 := ih1 (ext rho v false) h2.1
(side_false _ C1 C2 R v hr (fals_ext rho v false ev R hf) (ext_same rho v false))
have a1 := ih2 (ext rho v true) h2.2.1
(side_true _ C1 C2 R v hr (fals_ext rho v true ev R hf) (ext_same rho v true))
cases ep : phi rho with
| zero => exact Nat.le_add_left 1 _
| succ k =>
have k0 : k <= phi (ext rho v false) := by
have t := h2.2.2.1
rw [ep] at t
exact Nat.le_of_succ_le_succ t
have k1 : k <= phi (ext rho v true) := by
have t := h2.2.2.2
rw [ep] at t
exact Nat.le_of_succ_le_succ t
exact both_le k _ _ (Nat.le_trans (pow2_mono _ _ k0) a0) (Nat.le_trans (pow2_mono _ _ k1) a1)
theorem pd_refute (F : CNF) (S : PA -> Prop) (phi : PA -> Nat) (hd : Delayer F S phi)
(p : RProof F []) (rho0 : PA) (h0 : S rho0) : pow2 (phi rho0) <= p.size :=
pd_bound F S phi hd [] p rho0 h0 (fun _ hl => Bool.noConfusion hl)
end Found.Pnp64
#print axioms Found.Pnp64.pow2_mono
#print axioms Found.Pnp64.ext_same
#print axioms Found.Pnp64.fals_ext
#print axioms Found.Pnp64.side_true
#print axioms Found.Pnp64.side_false
#print axioms Found.Pnp64.both_le
#print axioms Found.Pnp64.pd_bound
#print axioms Found.Pnp64.pd_refute
lean_all/found/Pnp65.lean
/-
T330 piece 65. found/Pnp65 -- tools for the pigeonhole Delayer: the variable code
x(i, j) = i n + j, bounded or, bounded counts and bounded minima, with monotonicity.
Proved:
* add_cancel_r, var_inj: i n + j = i' n + j' with j, j' < n gives i = i', j = j';
* anyI_true, anyI_false, anyI_congr: bounded or;
* cntI_le, cntI_le_one, cntI_zero: bounded counts; one exceptional index costs at most 1;
* ble_false_le, mn_le_l, mn_le_r: minimum of two numbers;
* minU_le, minU_mono: the minimum of av i over unmarked i < k (default n) is at most each
such av i, and decreases by at most d when every index unmarked after a change was
unmarked before and lost at most d.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp64
namespace Found.Pnp65
def selN : Bool -> Nat -> Nat -> Nat
| true, x, _ => x
| false, _, y => y
def bv (b : Bool) : Nat := match b with | true => 1 | false => 0
/-! ## The variable code -/
def var (n i j : Nat) : Nat := i * n + j
theorem add_cancel_r : forall n a b : Nat, a + n = b + n -> a = b := by
intro n
induction n with
| zero => intro a b h; exact h
| succ n ih => intro a b h; exact ih a b (Nat.succ.inj h)
theorem not_lt_ge {j n : Nat} (hj : j < n) (h : n <= j) : False :=
Nat.not_succ_le_self j (Nat.le_trans hj h)
theorem var_inj (n : Nat) : forall i i' j j', j < n -> j' < n -> var n i j = var n i' j' -> i = i' /\ j = j' := by
intro i
induction i with
| zero =>
intro i' j j' hj hj' h
cases i' with
| zero =>
have e : j = j' := by
have h' : 0 * n + j = 0 * n + j' := h
rw [Nat.zero_mul, Nat.zero_add, Nat.zero_add] at h'
exact h'
exact And.intro rfl e
| succ k =>
have h' : 0 * n + j = (k + 1) * n + j' := h
rw [Nat.zero_mul, Nat.zero_add, Nat.succ_mul] at h'
exact absurd (Nat.le_trans (Nat.le_trans (Nat.le_add_left n (k * n)) (Nat.le_add_right _ j'))
(Nat.le_of_eq h'.symm)) (fun hh => not_lt_ge hj hh)
| succ k ih =>
intro i' j j' hj hj' h
cases i' with
| zero =>
have h' : (k + 1) * n + j = 0 * n + j' := h
rw [Nat.zero_mul, Nat.zero_add, Nat.succ_mul] at h'
exact absurd (Nat.le_trans (Nat.le_trans (Nat.le_add_left n (k * n)) (Nat.le_add_right _ j))
(Nat.le_of_eq h')) (fun hh => not_lt_ge hj' hh)
| succ k' =>
have h' : (k + 1) * n + j = (k' + 1) * n + j' := h
rw [Nat.succ_mul, Nat.succ_mul, Nat.add_right_comm (k * n) n j, Nat.add_right_comm (k' * n) n j'] at h'
have r := ih k' j j' hj hj' (add_cancel_r n _ _ h')
exact And.intro (congrArg Nat.succ r.1) r.2
/-! ## Bounded or -/
def anyI (g : Nat -> Bool) : Nat -> Bool
| 0 => false
| k + 1 => anyI g k || g k
theorem or_true_r (a : Bool) : (a || true) = true := by
cases a with
| false => rfl
| true => rfl
theorem anyI_true (g : Nat -> Bool) (j : Nat) (hg : g j = true) : forall k, j < k -> anyI g k = true := by
intro k
induction k with
| zero => intro h; exact absurd h (Nat.not_succ_le_zero j)
| succ k ih =>
intro h
show (anyI g k || g k) = true
have hle : j <= k := Nat.le_of_lt_succ h
cases hle with
| refl => rw [hg]; exact or_true_r _
| step hm => rw [ih (Nat.succ_le_succ hm)]; rfl
theorem anyI_false (g : Nat -> Bool) : forall k, anyI g k = false -> forall j, j < k -> g j = false := by
intro k
induction k with
| zero => intro _ j h; exact absurd h (Nat.not_succ_le_zero j)
| succ k ih =>
intro h j hj
have h' : (anyI g k || g k) = false := h
cases e1 : anyI g k with
| true => rw [e1] at h'; exact Bool.noConfusion h'
| false =>
rw [e1] at h'
have hle : j <= k := Nat.le_of_lt_succ hj
cases hle with
| refl => exact h'
| step hm => exact ih e1 j (Nat.succ_le_succ hm)
theorem anyI_congr (g g' : Nat -> Bool) : forall k, (forall j, j < k -> g j = g' j) -> anyI g k = anyI g' k := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro h
show (anyI g k || g k) = (anyI g' k || g' k)
rw [ih (fun j hj => h j (Nat.le_trans hj (Nat.le_succ k))), h k (Nat.le_refl _)]
/-! ## Bounded counts -/
def cntI (g : Nat -> Bool) : Nat -> Nat
| 0 => 0
| k + 1 => cntI g k + bv (g k)
theorem bv_le (a b : Bool) (h : a = true -> b = true) : bv a <= bv b := by
cases a with
| false => exact Nat.zero_le _
| true => rw [h rfl]; exact Nat.le_refl 1
theorem cntI_le (g g' : Nat -> Bool) : forall k, (forall j, j < k -> g j = true -> g' j = true) ->
cntI g k <= cntI g' k := by
intro k
induction k with
| zero => intro _; exact Nat.le_refl 0
| succ k ih =>
intro h
exact Nat.add_le_add (ih (fun j hj => h j (Nat.le_trans hj (Nat.le_succ k))))
(bv_le _ _ (h k (Nat.le_refl _)))
theorem cntI_zero (g : Nat -> Bool) : forall k, (forall j, j < k -> g j = false) -> cntI g k = 0 := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro h
show cntI g k + bv (g k) = 0
rw [ih (fun j hj => h j (Nat.le_trans hj (Nat.le_succ k))), h k (Nat.le_refl _)]
rfl
/-- One exceptional index j0 costs at most one. -/
theorem cntI_le_one (g g' : Nat -> Bool) (j0 : Nat) : forall k,
(forall j, j < k -> g j = true -> Nat.beq j j0 = false -> g' j = true) ->
cntI g k <= cntI g' k + 1 := by
intro k
induction k with
| zero => intro _; exact Nat.zero_le 1
| succ k ih =>
intro h
show cntI g k + bv (g k) <= cntI g' k + bv (g' k) + 1
cases e : Nat.beq k j0 with
| false =>
have a := ih (fun j hj => h j (Nat.le_trans hj (Nat.le_succ k)))
have b := bv_le (g k) (g' k) (fun hg => h k (Nat.le_refl _) hg e)
refine Nat.le_trans (Nat.add_le_add a b) (Nat.le_of_eq ?_)
rw [Nat.add_right_comm]
| true =>
have ek : k = j0 := Found.Pnp2.beq_eq k j0 e
have a : cntI g k <= cntI g' k := cntI_le g g' k (fun j hj hg => h j (Nat.le_trans hj (Nat.le_succ k)) hg
(Found.Pnp2.beq_false_of_ne j j0 (fun ej => not_lt_ge hj (Nat.le_of_eq (ek.trans ej.symm)))))
have b : bv (g k) <= 1 := by
cases g k with
| false => exact Nat.zero_le 1
| true => exact Nat.le_refl 1
exact Nat.le_trans (Nat.add_le_add a b) (Nat.add_le_add_right (Nat.le_add_right _ _) 1)
/-! ## Minima -/
def mn (a b : Nat) : Nat := selN (Nat.ble a b) a b
theorem ble_false_le : forall a b : Nat, Nat.ble a b = false -> b <= a := by
intro a
induction a with
| zero => intro b h; exact Bool.noConfusion h
| succ a ih =>
intro b h
cases b with
| zero => exact Nat.zero_le _
| succ b => exact Nat.succ_le_succ (ih b h)
theorem mn_le_l (a b : Nat) : mn a b <= a := by
show selN (Nat.ble a b) a b <= a
cases e : Nat.ble a b with
| true => exact Nat.le_refl a
| false => exact ble_false_le a b e
theorem mn_le_r (a b : Nat) : mn a b <= b := by
show selN (Nat.ble a b) a b <= b
cases e : Nat.ble a b with
| true => exact Nat.le_of_ble_eq_true e
| false => exact Nat.le_refl b
theorem mn_mono (a b a' b' d : Nat) (ha : a <= a' + d) (hb : b <= b' + d) : mn a b <= mn a' b' + d := by
show mn a b <= selN (Nat.ble a' b') a' b' + d
cases Nat.ble a' b' with
| true => exact Nat.le_trans (mn_le_l a b) ha
| false => exact Nat.le_trans (mn_le_r a b) hb
/-- The minimum of av i over the indices i < k with mt i = false; n if there are none. -/
def minU (n : Nat) (mt : Nat -> Bool) (av : Nat -> Nat) : Nat -> Nat
| 0 => n
| i + 1 => selN (mt i) (minU n mt av i) (mn (minU n mt av i) (av i))
theorem minU_step_le (n : Nat) (mt : Nat -> Bool) (av : Nat -> Nat) (i : Nat) :
minU n mt av (i + 1) <= minU n mt av i := by
show selN (mt i) (minU n mt av i) (mn (minU n mt av i) (av i)) <= minU n mt av i
cases mt i with
| true => exact Nat.le_refl _
| false => exact mn_le_l _ _
theorem minU_le (n : Nat) (mt : Nat -> Bool) (av : Nat -> Nat) (i : Nat) (hm : mt i = false) :
forall k, i < k -> minU n mt av k <= av i := by
intro k
induction k with
| zero => intro h; exact absurd h (Nat.not_succ_le_zero i)
| succ k ih =>
intro h
have hle : i <= k := Nat.le_of_lt_succ h
cases hle with
| refl =>
show selN (mt i) (minU n mt av i) (mn (minU n mt av i) (av i)) <= av i
rw [hm]
exact mn_le_r _ _
| step hm' => exact Nat.le_trans (minU_step_le n mt av _) (ih (Nat.succ_le_succ hm'))
theorem minU_mono (n d : Nat) (mt mt' : Nat -> Bool) (av av' : Nat -> Nat) : forall k,
(forall i, i < k -> mt' i = false -> mt i = false /\ av i <= av' i + d) ->
minU n mt av k <= minU n mt' av' k + d := by
intro k
induction k with
| zero => intro _; exact Nat.le_add_right n d
| succ k ih =>
intro h
have ih' := ih (fun i hi => h i (Nat.le_trans hi (Nat.le_succ k)))
show minU n mt av (k + 1) <= selN (mt' k) (minU n mt' av' k) (mn (minU n mt' av' k) (av' k)) + d
cases e' : mt' k with
| true => exact Nat.le_trans (minU_step_le n mt av k) ih'
| false =>
have hk := h k (Nat.le_refl _) e'
show selN (mt k) (minU n mt av k) (mn (minU n mt av k) (av k)) <= mn (minU n mt' av' k) (av' k) + d
rw [hk.1]
exact mn_mono _ _ _ _ d ih' hk.2
end Found.Pnp65
#print axioms Found.Pnp65.add_cancel_r
#print axioms Found.Pnp65.var_inj
#print axioms Found.Pnp65.anyI_true
#print axioms Found.Pnp65.anyI_false
#print axioms Found.Pnp65.anyI_congr
#print axioms Found.Pnp65.cntI_le
#print axioms Found.Pnp65.cntI_zero
#print axioms Found.Pnp65.cntI_le_one
#print axioms Found.Pnp65.ble_false_le
#print axioms Found.Pnp65.mn_le_l
#print axioms Found.Pnp65.mn_le_r
#print axioms Found.Pnp65.mn_mono
#print axioms Found.Pnp65.minU_step_le
#print axioms Found.Pnp65.minU_le
#print axioms Found.Pnp65.minU_mono
lean_all/found/Pnp66.lean
/-
T330 piece 66. found/Pnp66 -- tree resolution refutations of the pigeonhole principle
PHP(n+1, n) have at least 2^n nodes (a Prover--Delayer bound, Pnp64).
Variables x(i, j) = var n i j (pigeon i < n + 1 in hole j < n). Clauses: for each pigeon,
x(i, 0) or ... or x(i, n-1); for each hole j and pigeons i' < i, not x(i', j) or not
x(i, j). The Delayer keeps the true values a partial matching (S). Available holes of
pigeon i: unset x(i, j) with hole j not taken (av); potential phi = the least av over
unmatched pigeons (n at the start). Queried x(i, j): if pigeon i is matched or hole j
taken, answer false (phi kept); otherwise offer both (false: pigeon i loses one hole;
true: pigeon i leaves the minimum and other pigeons lose hole j); other variables: false.
Proved:
* lose: a state of S falsifying a clause of PHP has phi = 0;
* move: the Delayer's two rules;
* php_tree_lb: every tree resolution refutation of PHP(n+1, n) has >= 2^n nodes.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp65
namespace Found.Pnp66
open Found.RootComp (Lit Clause CNF)
open Found.Pnp62 (beqLit beqLit_refl memL memC beqCl beqCl_eq RProof or_l or_r)
open Found.Pnp64 (PA Fals ext selO ext_same Delayer pd_refute pow2_mono)
open Found.Pnp65
open Found.Pnp9 (pow2)
/-! ## The formula -/
def pcl (n i : Nat) : Nat -> Clause
| 0 => []
| j + 1 => (true, var n i j) :: pcl n i j
def pigeons (n : Nat) : Nat -> CNF
| 0 => []
| i + 1 => pcl n i n :: pigeons n i
def hcl (n j i : Nat) : Nat -> CNF
| 0 => []
| i' + 1 => [(false, var n i' j), (false, var n i j)] :: hcl n j i i'
def holesJ (n j : Nat) : Nat -> CNF
| 0 => []
| i + 1 => hcl n j i i ++ holesJ n j i
def holes (n : Nat) : Nat -> CNF
| 0 => []
| j + 1 => holesJ n j (n + 1) ++ holes n j
def PHP (n : Nat) : CNF := pigeons n (n + 1) ++ holes n n
/-! ## Membership -/
theorem beqCl_refl : forall C : Clause, beqCl C C = true := by
intro C
induction C with
| nil => rfl
| cons l C ih =>
show (beqLit l l && beqCl C C) = true
rw [beqLit_refl, ih]
rfl
theorem memC_cons (C D : Clause) (F : CNF) (h : memC C (D :: F) = true) : C = D \/ memC C F = true := by
have h' : (beqCl D C || memC C F) = true := h
cases e : beqCl D C with
| true => exact Or.inl (beqCl_eq D C e).symm
| false => rw [e] at h'; exact Or.inr h'
theorem memC_app (C : Clause) (B : CNF) : forall A : CNF, memC C (A ++ B) = true -> memC C A = true \/ memC C B = true := by
intro A
induction A with
| nil => intro h; exact Or.inr h
| cons D A ih =>
intro h
cases memC_cons C D (A ++ B) h with
| inl e => exact Or.inl (by rw [e]; exact or_l (beqCl_refl D))
| inr h2 =>
cases ih h2 with
| inl h3 => exact Or.inl (or_r h3)
| inr h3 => exact Or.inr h3
theorem pigeons_mem (n : Nat) (C : Clause) : forall k, memC C (pigeons n k) = true ->
Exists fun i => i < k /\ C = pcl n i n := by
intro k
induction k with
| zero => intro h; exact Bool.noConfusion h
| succ k ih =>
intro h
cases memC_cons C _ _ h with
| inl e => exact Exists.intro k (And.intro (Nat.le_refl _) e)
| inr h2 =>
cases ih h2 with
| intro i hi => exact Exists.intro i (And.intro (Nat.le_trans hi.1 (Nat.le_succ k)) hi.2)
theorem hcl_mem (n j i : Nat) (C : Clause) : forall k, memC C (hcl n j i k) = true ->
Exists fun i' => i' < k /\ C = [(false, var n i' j), (false, var n i j)] := by
intro k
induction k with
| zero => intro h; exact Bool.noConfusion h
| succ k ih =>
intro h
cases memC_cons C _ _ h with
| inl e => exact Exists.intro k (And.intro (Nat.le_refl _) e)
| inr h2 =>
cases ih h2 with
| intro i' hi => exact Exists.intro i' (And.intro (Nat.le_trans hi.1 (Nat.le_succ k)) hi.2)
theorem holesJ_mem (n j : Nat) (C : Clause) : forall k, memC C (holesJ n j k) = true ->
Exists fun i => Exists fun i' => i < k /\ i' < i /\ C = [(false, var n i' j), (false, var n i j)] := by
intro k
induction k with
| zero => intro h; exact Bool.noConfusion h
| succ k ih =>
intro h
cases memC_app C _ _ h with
| inl h1 =>
cases hcl_mem n j k C k h1 with
| intro i' hi => exact Exists.intro k (Exists.intro i' (And.intro (Nat.le_refl _) hi))
| inr h2 =>
cases ih h2 with
| intro i hi =>
cases hi with
| intro i' hh => exact Exists.intro i (Exists.intro i' (And.intro (Nat.le_trans hh.1 (Nat.le_succ k)) hh.2))
theorem holes_mem (n : Nat) (C : Clause) : forall k, memC C (holes n k) = true ->
Exists fun j => Exists fun i => Exists fun i' => j < k /\ i < n + 1 /\ i' < i /\
C = [(false, var n i' j), (false, var n i j)] := by
intro k
induction k with
| zero => intro h; exact Bool.noConfusion h
| succ k ih =>
intro h
cases memC_app C _ _ h with
| inl h1 =>
cases holesJ_mem n k C (n + 1) h1 with
| intro i hi =>
cases hi with
| intro i' hh => exact Exists.intro k (Exists.intro i (Exists.intro i' (And.intro (Nat.le_refl _) hh)))
| inr h2 =>
cases ih h2 with
| intro j hj =>
cases hj with
| intro i hi =>
cases hi with
| intro i' hh =>
exact Exists.intro j (Exists.intro i (Exists.intro i'
(And.intro (Nat.le_trans hh.1 (Nat.le_succ k)) hh.2)))
theorem mem_pcl (n i : Nat) : forall k j, j < k -> memL (true, var n i j) (pcl n i k) = true := by
intro k
induction k with
| zero => intro j h; exact absurd h (Nat.not_succ_le_zero j)
| succ k ih =>
intro j h
show (beqLit (true, var n i k) (true, var n i j) || memL (true, var n i j) (pcl n i k)) = true
have hle : j <= k := Nat.le_of_lt_succ h
cases hle with
| refl => exact or_l (beqLit_refl _)
| step hm => exact or_r (ih j (Nat.succ_le_succ hm))
/-! ## The Delayer -/
def isT : Option Bool -> Bool
| none => false
| some false => false
| some true => true
def isN : Option Bool -> Bool
| none => true
| some _ => false
def taken (n : Nat) (rho : PA) (j : Nat) : Bool := anyI (fun i => isT (rho (var n i j))) (n + 1)
def mtd (n : Nat) (rho : PA) (i : Nat) : Bool := anyI (fun j => isT (rho (var n i j))) n
def avg (n : Nat) (rho : PA) (i : Nat) (j : Nat) : Bool := isN (rho (var n i j)) && !(taken n rho j)
def av (n : Nat) (rho : PA) (i : Nat) : Nat := cntI (avg n rho i) n
def phi (n : Nat) (rho : PA) : Nat := minU n (mtd n rho) (av n rho) (n + 1)
def S (n : Nat) (rho : PA) : Prop :=
forall i i' j, i < n + 1 -> i' < n + 1 -> j < n ->
rho (var n i j) = some true -> rho (var n i' j) = some true -> i = i'
theorem le_zero_eq {a : Nat} (h : a <= 0) : a = 0 := by
cases h with
| refl => rfl
theorem anyI_none (g : Nat -> Bool) : forall k, (forall j, j < k -> g j = false) -> anyI g k = false := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro h
show (anyI g k || g k) = false
rw [ih (fun j hj => h j (Nat.le_trans hj (Nat.le_succ k))), h k (Nat.le_refl _)]
rfl
theorem lose (n : Nat) (rho : PA) (hs : S n rho) (C : Clause) (hm : memC C (PHP n) = true)
(hf : Fals rho C) : phi n rho = 0 := by
cases memC_app C _ _ hm with
| inl h1 =>
cases pigeons_mem n C (n + 1) h1 with
| intro i hi =>
have hz : forall j, j < n -> rho (var n i j) = some false := by
intro j hj
have t := hf (true, var n i j) (by rw [hi.2]; exact mem_pcl n i n j hj)
exact t
have hmt : mtd n rho i = false :=
anyI_none _ n (fun j hj => by show isT (rho (var n i j)) = false; rw [hz j hj]; rfl)
have hav : av n rho i = 0 :=
cntI_zero _ n (fun j hj => by show (isN (rho (var n i j)) && _) = false; rw [hz j hj]; rfl)
have t := minU_le n (mtd n rho) (av n rho) i hmt (n + 1) hi.1
rw [hav] at t
exact le_zero_eq t
| inr h2 =>
cases holes_mem n C n h2 with
| intro j hj =>
cases hj with
| intro i hi =>
cases hi with
| intro i' hh =>
have a1 : rho (var n i' j) = some true :=
hf (false, var n i' j) (by rw [hh.2.2.2]; exact or_l (beqLit_refl _))
have a2 : rho (var n i j) = some true :=
hf (false, var n i j) (by rw [hh.2.2.2]; exact or_r (or_l (beqLit_refl _)))
have e := hs i' i j (Nat.le_trans hh.2.2.1 (Nat.le_of_lt hh.2.1))
hh.2.1 hh.1 a1 a2
exact absurd hh.2.2.1 (fun hl => Nat.not_succ_le_self i (by rw [e] at hl; exact hl))
/-! ## Extensions -/
theorem ext_other (rho : PA) (v : Nat) (b : Bool) (w : Nat) (h : Nat.beq w v = false) : ext rho v b w = rho w := by
show selO (Nat.beq w v) (some b) (rho w) = rho w
rw [h]
rfl
theorem ext_eq (rho : PA) (v : Nat) (b : Bool) (w : Nat) (h : Nat.beq w v = true) : ext rho v b w = some b := by
show selO (Nat.beq w v) (some b) (rho w) = some b
rw [h]
rfl
theorem isT_zero (rho : PA) (v : Nat) (hv : rho v = none) (w : Nat) : isT (ext rho v false w) = isT (rho w) := by
cases e : Nat.beq w v with
| false => rw [ext_other rho v false w e]
| true =>
rw [ext_eq rho v false w e, Found.Pnp2.beq_eq w v e, hv]
rfl
theorem true_zero (rho : PA) (v : Nat) (w : Nat) (h : ext rho v false w = some true) : rho w = some true := by
cases e : Nat.beq w v with
| false => rw [ext_other rho v false w e] at h; exact h
| true => rw [ext_eq rho v false w e] at h; cases h
theorem mtd_zero (n : Nat) (rho : PA) (v : Nat) (hv : rho v = none) (i : Nat) :
mtd n (ext rho v false) i = mtd n rho i :=
anyI_congr _ _ n (fun _ _ => isT_zero rho v hv _)
theorem taken_zero (n : Nat) (rho : PA) (v : Nat) (hv : rho v = none) (j : Nat) :
taken n (ext rho v false) j = taken n rho j :=
anyI_congr _ _ (n + 1) (fun _ _ => isT_zero rho v hv _)
theorem avg_zero (n : Nat) (rho : PA) (v : Nat) (hv : rho v = none) (i j : Nat)
(hg : avg n rho i j = true) (hb : Nat.beq (var n i j) v = false) : avg n (ext rho v false) i j = true := by
show (isN (ext rho v false (var n i j)) && !(taken n (ext rho v false) j)) = true
rw [ext_other rho v false _ hb, taken_zero n rho v hv j]
exact hg
theorem S_zero (n : Nat) (rho : PA) (v : Nat) (hs : S n rho) : S n (ext rho v false) :=
fun i i' j hi hi' hj a1 a2 => hs i i' j hi hi' hj (true_zero rho v _ a1) (true_zero rho v _ a2)
/-- A forced false answer: phi drops by at most d when every unmatched pigeon loses at most d. -/
theorem zero_ok (n d : Nat) (rho : PA) (v : Nat) (hv : rho v = none)
(hav : forall i, i < n + 1 -> mtd n rho i = false -> av n rho i <= av n (ext rho v false) i + d) :
phi n rho <= phi n (ext rho v false) + d :=
minU_mono n d (mtd n rho) (mtd n (ext rho v false)) (av n rho) (av n (ext rho v false)) (n + 1)
(fun i hi hm => by
rw [mtd_zero n rho v hv i] at hm
exact And.intro hm (hav i hi hm))
/-! ## Finding a pigeonhole variable -/
def optOr {a : Type} : Option a -> Option a -> Option a
| some r, _ => some r
| none, o => o
def selOn (b : Bool) (j : Nat) : Option Nat := match b with | true => some j | false => none
def findJ (n v i : Nat) : Nat -> Option Nat
| 0 => none
| j + 1 => optOr (findJ n v i j) (selOn (Nat.beq (var n i j) v) j)
def mapJ (i : Nat) : Option Nat -> Option (Nat × Nat)
| none => none
| some j => some (i, j)
def findIJ (n v : Nat) : Nat -> Option (Nat × Nat)
| 0 => none
| i + 1 => optOr (findIJ n v i) (mapJ i (findJ n v i n))
theorem findJ_some (n v i : Nat) : forall k j, findJ n v i k = some j -> j < k /\ var n i j = v := by
intro k
induction k with
| zero => intro j h; cases h
| succ k ih =>
intro j h
have h' : optOr (findJ n v i k) (selOn (Nat.beq (var n i k) v) k) = some j := h
cases e : findJ n v i k with
| some r =>
rw [e] at h'
have er : r = j := Option.some.inj h'
rw [er] at e
have t := ih j e
exact And.intro (Nat.le_trans t.1 (Nat.le_succ k)) t.2
| none =>
rw [e] at h'
cases eb : Nat.beq (var n i k) v with
| false => rw [eb] at h'; cases h'
| true =>
rw [eb] at h'
have ek : k = j := Option.some.inj h'
rw [ek.symm]
exact And.intro (Nat.le_refl _) (Found.Pnp2.beq_eq _ _ eb)
theorem findJ_none (n v i : Nat) : forall k, findJ n v i k = none -> forall j, j < k -> Nat.beq (var n i j) v = false := by
intro k
induction k with
| zero => intro _ j h; exact absurd h (Nat.not_succ_le_zero j)
| succ k ih =>
intro h j hj
have h' : optOr (findJ n v i k) (selOn (Nat.beq (var n i k) v) k) = none := h
cases e : findJ n v i k with
| some r => rw [e] at h'; cases h'
| none =>
rw [e] at h'
have hle : j <= k := Nat.le_of_lt_succ hj
cases hle with
| refl =>
cases eb : Nat.beq (var n i k) v with
| false => rfl
| true => rw [eb] at h'; cases h'
| step hm => exact ih e j (Nat.succ_le_succ hm)
theorem findIJ_some (n v : Nat) : forall k i j, findIJ n v k = some (i, j) -> i < k /\ j < n /\ var n i j = v := by
intro k
induction k with
| zero => intro i j h; cases h
| succ k ih =>
intro i j h
have h' : optOr (findIJ n v k) (mapJ k (findJ n v k n)) = some (i, j) := h
cases e : findIJ n v k with
| some r =>
rw [e] at h'
have er : r = (i, j) := Option.some.inj h'
rw [er] at e
have t := ih i j e
exact And.intro (Nat.le_trans t.1 (Nat.le_succ k)) t.2
| none =>
rw [e] at h'
cases ej : findJ n v k n with
| none => rw [ej] at h'; cases h'
| some j' =>
rw [ej] at h'
have ep : (k, j') = (i, j) := Option.some.inj h'
cases ep
have t := findJ_some n v k n _ ej
exact And.intro (Nat.le_refl _) t
theorem findIJ_none (n v : Nat) : forall k, findIJ n v k = none -> forall i j, i < k -> j < n ->
Nat.beq (var n i j) v = false := by
intro k
induction k with
| zero => intro _ i j h; exact absurd h (Nat.not_succ_le_zero i)
| succ k ih =>
intro h i j hi hj
have h' : optOr (findIJ n v k) (mapJ k (findJ n v k n)) = none := h
cases e : findIJ n v k with
| some r => rw [e] at h'; cases h'
| none =>
rw [e] at h'
have hle : i <= k := Nat.le_of_lt_succ hi
cases hle with
| refl =>
cases ej : findJ n v k n with
| some j' => rw [ej] at h'; cases h'
| none => exact findJ_none n v k n ej j hj
| step hm => exact ih e i j (Nat.succ_le_succ hm) hj
/-! ## Offering true -/
theorem true_split (rho : PA) (v w : Nat) (h : ext rho v true w = some true) :
Nat.beq w v = true \/ rho w = some true := by
cases e : Nat.beq w v with
| true => exact Or.inl rfl
| false => rw [ext_other rho v true w e] at h; exact Or.inr h
theorem one_ok (n : Nat) (rho : PA) (i0 j0 : Nat) (_hi0 : i0 < n + 1) (hj0 : j0 < n) (hs : S n rho)
(_hm : mtd n rho i0 = false) (ht : taken n rho j0 = false) :
S n (ext rho (var n i0 j0) true) /\ phi n rho <= phi n (ext rho (var n i0 j0) true) + 1 := by
have notT : forall i, i < n + 1 -> rho (var n i j0) = some true -> False := by
intro i hi h
have t := anyI_false _ (n + 1) ht i hi
have t' : isT (rho (var n i j0)) = false := t
rw [h] at t'
exact Bool.noConfusion t'
have newv : forall i j, j < n -> Nat.beq (var n i j) (var n i0 j0) = true -> i = i0 /\ j = j0 :=
fun i j hj e => var_inj n i i0 j j0 hj hj0 (Found.Pnp2.beq_eq _ _ e)
refine And.intro ?_ ?_
· intro i i' j hi hi' hj a1 a2
cases true_split rho _ _ a1 with
| inl e1 =>
have p1 := newv i j hj e1
cases true_split rho _ _ a2 with
| inl e2 => exact (p1.1.trans (newv i' j hj e2).1.symm)
| inr o2 => rw [p1.2] at o2; exact absurd o2 (notT i' hi')
| inr o1 =>
cases true_split rho _ _ a2 with
| inl e2 =>
have p2 := newv i' j hj e2
rw [p2.2] at o1
exact absurd o1 (notT i hi)
| inr o2 => exact hs i i' j hi hi' hj o1 o2
· refine minU_mono n 1 (mtd n rho) (mtd n (ext rho (var n i0 j0) true)) (av n rho)
(av n (ext rho (var n i0 j0) true)) (n + 1) ?_
have m0 : mtd n (ext rho (var n i0 j0) true) i0 = true :=
anyI_true _ j0 (by show isT (ext rho (var n i0 j0) true (var n i0 j0)) = true; rw [ext_same]; rfl) n hj0
intro i _ hmi
have hne : forall j, j < n -> Nat.beq (var n i j) (var n i0 j0) = false := by
intro j hj
cases e : Nat.beq (var n i j) (var n i0 j0) with
| false => rfl
| true =>
have ei : i = i0 := (newv i j hj e).1
rw [ei, m0] at hmi
exact Bool.noConfusion hmi
have mt_eq : mtd n (ext rho (var n i0 j0) true) i = mtd n rho i :=
anyI_congr _ _ n (fun j hj => by
show isT (ext rho (var n i0 j0) true (var n i j)) = isT (rho (var n i j))
rw [ext_other _ _ _ _ (hne j hj)])
refine And.intro (by rw [mt_eq] at hmi; exact hmi) ?_
refine cntI_le_one (avg n rho i) (avg n (ext rho (var n i0 j0) true) i) j0 n (fun j hj hg hjj => ?_)
have tk : taken n (ext rho (var n i0 j0) true) j = taken n rho j :=
anyI_congr _ _ (n + 1) (fun i2 _ => by
cases e : Nat.beq (var n i2 j) (var n i0 j0) with
| false =>
show isT (ext rho (var n i0 j0) true (var n i2 j)) = isT (rho (var n i2 j))
rw [ext_other _ _ _ _ e]
| true =>
have ej : j = j0 := (newv i2 j hj e).2
rw [ej, Found.Pnp62.beq_refl] at hjj
exact Bool.noConfusion hjj)
show (isN (ext rho (var n i0 j0) true (var n i j)) && !(taken n (ext rho (var n i0 j0) true) j)) = true
rw [ext_other _ _ _ _ (hne j hj), tk]
exact hg
/-! ## The Delayer's rules and the bound -/
theorem andnot_true (a : Bool) : (a && !true) = false := by
cases a with
| false => rfl
| true => rfl
theorem move (n : Nat) (rho : PA) (v : Nat) (hs : S n rho) (hv : rho v = none) :
Or (Exists fun b => S n (ext rho v b) /\ phi n rho <= phi n (ext rho v b))
(S n (ext rho v false) /\ S n (ext rho v true) /\
phi n rho <= phi n (ext rho v false) + 1 /\ phi n rho <= phi n (ext rho v true) + 1) := by
have forced : (forall i, i < n + 1 -> mtd n rho i = false -> av n rho i <= av n (ext rho v false) i) ->
Or (Exists fun b => S n (ext rho v b) /\ phi n rho <= phi n (ext rho v b))
(S n (ext rho v false) /\ S n (ext rho v true) /\
phi n rho <= phi n (ext rho v false) + 1 /\ phi n rho <= phi n (ext rho v true) + 1) :=
fun h => Or.inl (Exists.intro false (And.intro (S_zero n rho v hs)
(zero_ok n 0 rho v hv (fun i hi hm => h i hi hm))))
have avle : forall i, (forall j, j < n -> avg n rho i j = true -> Nat.beq (var n i j) v = false) ->
av n rho i <= av n (ext rho v false) i :=
fun i h => cntI_le _ _ n (fun j hj hg => avg_zero n rho v hv i j hg (h j hj hg))
cases ef : findIJ n v (n + 1) with
| none => exact forced (fun i hi _ => avle i (fun j hj _ => findIJ_none n v (n + 1) ef i j hi hj))
| some pr =>
cases pr with
| mk i0 j0 =>
have hf := findIJ_some n v (n + 1) i0 j0 ef
have samej : forall i j, j < n -> Nat.beq (var n i j) v = true -> i = i0 /\ j = j0 := by
intro i j hj e
exact var_inj n i i0 j j0 hj hf.2.1 ((Found.Pnp2.beq_eq _ _ e).trans hf.2.2.symm)
cases em : mtd n rho i0 with
| true =>
exact forced (fun i _ hm => avle i (fun j hj _ => by
cases e : Nat.beq (var n i j) v with
| false => rfl
| true =>
rw [(samej i j hj e).1, em] at hm
exact Bool.noConfusion hm))
| false =>
cases et : taken n rho j0 with
| true =>
exact forced (fun i _ _ => avle i (fun j hj hg => by
cases e : Nat.beq (var n i j) v with
| false => rfl
| true =>
have hg' : (isN (rho (var n i j)) && !(taken n rho j)) = true := hg
rw [(samej i j hj e).2, et, andnot_true] at hg'
exact Bool.noConfusion hg'))
| false =>
have ev : v = var n i0 j0 := hf.2.2.symm
have one := one_ok n rho i0 j0 hf.1 hf.2.1 hs em et
rw [ev.symm] at one
refine Or.inr (And.intro (S_zero n rho v hs) (And.intro one.1 (And.intro ?_ one.2)))
refine zero_ok n 1 rho v hv (fun i _ _ => ?_)
refine cntI_le_one (avg n rho i) (avg n (ext rho v false) i) j0 n (fun j hj hg hjj => ?_)
refine avg_zero n rho v hv i j hg ?_
cases e : Nat.beq (var n i j) v with
| false => rfl
| true =>
rw [(samej i j hj e).2, Found.Pnp62.beq_refl] at hjj
exact Bool.noConfusion hjj
theorem delayer (n : Nat) : Delayer (PHP n) (S n) (phi n) :=
Delayer.mk (fun rho hs C hm hf => lose n rho hs C hm hf) (fun rho v hs hv => move n rho v hs hv)
theorem cntI_all (g : Nat -> Bool) : forall k, (forall j, j < k -> g j = true) -> cntI g k = k := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro h
show cntI g k + bv (g k) = k + 1
rw [ih (fun j hj => h j (Nat.le_trans hj (Nat.le_succ k))), h k (Nat.le_refl _)]
rfl
theorem minU_ge (n : Nat) (mt : Nat -> Bool) (av' : Nat -> Nat) : forall k,
(forall i, i < k -> mt i = false -> n <= av' i) -> n <= minU n mt av' k := by
intro k
induction k with
| zero => intro _; exact Nat.le_refl n
| succ k ih =>
intro h
have ih' := ih (fun i hi => h i (Nat.le_trans hi (Nat.le_succ k)))
show n <= selN (mt k) (minU n mt av' k) (mn (minU n mt av' k) (av' k))
cases e : mt k with
| true => exact ih'
| false =>
show n <= selN (Nat.ble (minU n mt av' k) (av' k)) (minU n mt av' k) (av' k)
cases Nat.ble (minU n mt av' k) (av' k) with
| true => exact ih'
| false => exact h k (Nat.le_refl _) e
def rho0 : PA := fun _ => none
theorem S0 (n : Nat) : S n rho0 := fun _ _ _ _ _ _ a _ => by cases a
theorem phi0 (n : Nat) : n <= phi n rho0 :=
minU_ge n _ _ (n + 1) (fun i _ _ => Nat.le_of_eq (cntI_all _ n (fun j _ => by
show (isN (rho0 (var n i j)) && !(anyI (fun i2 => isT (rho0 (var n i2 j))) (n + 1))) = true
rw [anyI_none (fun i2 => isT (rho0 (var n i2 j))) (n + 1) (fun _ _ => rfl)]
rfl)).symm)
/-- Tree resolution refutations of PHP(n+1, n) have at least 2^n nodes. -/
theorem php_tree_lb (n : Nat) (p : RProof (PHP n) []) : pow2 n <= p.size :=
Nat.le_trans (pow2_mono _ _ (phi0 n)) (pd_refute (PHP n) (S n) (phi n) (delayer n) p rho0 (S0 n))
end Found.Pnp66
#print axioms Found.Pnp66.beqCl_refl
#print axioms Found.Pnp66.memC_app
#print axioms Found.Pnp66.pigeons_mem
#print axioms Found.Pnp66.holes_mem
#print axioms Found.Pnp66.mem_pcl
#print axioms Found.Pnp66.lose
#print axioms Found.Pnp66.zero_ok
#print axioms Found.Pnp66.findIJ_some
#print axioms Found.Pnp66.findIJ_none
#print axioms Found.Pnp66.one_ok
#print axioms Found.Pnp66.move
#print axioms Found.Pnp66.delayer
#print axioms Found.Pnp66.phi0
#print axioms Found.Pnp66.php_tree_lb
lean_all/found/Pnp67.lean
/-
T330 piece 67. found/Pnp67 -- relocating the registers of a register program (a tool for
calling one program inside another; toward search-to-decision, open lemma O5).
relocP k p adds k to every register a program names. Proved, for every program p:
* nthI_reloc: the instruction at pc of relocP k p is the relocated instruction of p;
* step_reloc, run_reloc: if registers i + k of y hold the registers i of x, then the
relocated program on y keeps the same counter as p on x, keeps this correspondence,
and leaves the registers below k unchanged, for any number of steps.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp20
import found.Pnp56
namespace Found.Pnp67
open Found.Pnp20 (Ins Cfg selR upd nthI step exec popTo run)
def relocI (k : Nat) : Ins -> Ins
| .push r b => .push (r + k) b
| .pop r e z o => .pop (r + k) e z o
| .jmp l => .jmp l
def relocP (k : Nat) : List Ins -> List Ins
| [] => []
| i :: p => relocI k i :: relocP k p
def optMap (k : Nat) : Option Ins -> Option Ins
| none => none
| some i => some (relocI k i)
theorem nthI_reloc (k : Nat) : forall (p : List Ins) (n : Nat), nthI (relocP k p) n = optMap k (nthI p n) := by
intro p
induction p with
| nil => intro n; rfl
| cons i p ih =>
intro n
cases n with
| zero => rfl
| succ n => exact ih n
/-- y holds x from register k on, and agrees with y0 below k. -/
def Rel (k : Nat) (x y y0 : Nat -> List Bool) : Prop :=
(forall i, y (i + k) = x i) /\ (forall i, i < k -> y i = y0 i)
theorem upd_rel (k : Nat) (x y y0 : Nat -> List Bool) (h : Rel k x y y0) (r : Nat) (v : List Bool) :
Rel k (upd x r v) (upd y (r + k) v) y0 := by
refine And.intro (fun i => ?_) (fun i hi => ?_)
· show selR (Nat.beq (i + k) (r + k)) v (y (i + k)) = selR (Nat.beq i r) v (x i)
rw [Found.Pnp56.beq_add_r, h.1 i]
· show selR (Nat.beq i (r + k)) v (y i) = y0 i
rw [Found.Pnp56.beq_lt i (r + k) (Nat.lt_of_lt_of_le hi (Nat.le_add_left k r))]
exact h.2 i hi
theorem step_reloc (k : Nat) (p : List Ins) (pc : Nat) (x y y0 : Nat -> List Bool) (h : Rel k x y y0) :
(step (relocP k p) (Cfg.mk pc y)).pc = (step p (Cfg.mk pc x)).pc /\
Rel k (step p (Cfg.mk pc x)).regs (step (relocP k p) (Cfg.mk pc y)).regs y0 := by
show (exec (Cfg.mk pc y) (nthI (relocP k p) pc)).pc = (exec (Cfg.mk pc x) (nthI p pc)).pc /\
Rel k (exec (Cfg.mk pc x) (nthI p pc)).regs (exec (Cfg.mk pc y) (nthI (relocP k p) pc)).regs y0
rw [nthI_reloc]
cases nthI p pc with
| none => exact And.intro rfl h
| some ins =>
cases ins with
| push r b =>
refine And.intro rfl ?_
show Rel k (upd x r (b :: x r)) (upd y (r + k) (b :: y (r + k))) y0
rw [h.1 r]
exact upd_rel k x y y0 h r _
| pop r e z o =>
show (popTo (Cfg.mk pc y) (r + k) e z o (y (r + k))).pc = (popTo (Cfg.mk pc x) r e z o (x r)).pc /\
Rel k (popTo (Cfg.mk pc x) r e z o (x r)).regs (popTo (Cfg.mk pc y) (r + k) e z o (y (r + k))).regs y0
rw [h.1 r]
cases x r with
| nil => exact And.intro rfl h
| cons b t =>
cases b with
| false => exact And.intro rfl (upd_rel k x y y0 h r t)
| true => exact And.intro rfl (upd_rel k x y y0 h r t)
| jmp l => exact And.intro rfl h
theorem run_reloc (k : Nat) (p : List Ins) : forall n (c d : Cfg) (y0 : Nat -> List Bool),
d.pc = c.pc -> Rel k c.regs d.regs y0 ->
(run (relocP k p) n d).pc = (run p n c).pc /\ Rel k (run p n c).regs (run (relocP k p) n d).regs y0 := by
intro n
induction n with
| zero => intro c d y0 hp h; exact And.intro hp h
| succ n ih =>
intro c d y0 hp h
cases c with
| mk pc x =>
cases d with
| mk pd y =>
have e : pd = pc := hp
subst e
have s := step_reloc k p pd x y y0 h
exact ih (step p (Cfg.mk pd x)) (step (relocP k p) (Cfg.mk pd y)) y0 s.1 s.2
end Found.Pnp67
#print axioms Found.Pnp67.nthI_reloc
#print axioms Found.Pnp67.upd_rel
#print axioms Found.Pnp67.step_reloc
#print axioms Found.Pnp67.run_reloc
lean_all/found/Pnp68.lean
/-
T330 piece 68. found/Pnp68 -- a program placed as a fragment runs as it runs alone
(toward search-to-decision, open lemma O5).
If P sits at offset o in prog (Pnp21 Frag), every step of P from an instruction of P is a
step of prog with the counter shifted by o. Proved:
* frag_step: one step;
* frag_run: n steps, as long as the run of P stays on instructions of P before step n;
* frag_runs: in Runs form: a run of P from 0 to its end (pc = |P|) that stays inside is
a run of prog from o to o + |P| with the same registers.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp21
namespace Found.Pnp68
open Found.Pnp20 (Ins Cfg nthI step exec popTo run)
open Found.Pnp21 (shift Frag Runs)
theorem frag_step (prog : List Ins) (o : Nat) (P : List Ins) (hf : Frag prog o P) (pc : Nat)
(x : Nat -> List Bool) (ins : Ins) (hi : nthI P pc = some ins) :
(step prog (Cfg.mk (o + pc) x)).pc = o + (step P (Cfg.mk pc x)).pc /\
(step prog (Cfg.mk (o + pc) x)).regs = (step P (Cfg.mk pc x)).regs := by
have hp : nthI prog (o + pc) = some (shift o ins) := hf pc ins hi
show (exec (Cfg.mk (o + pc) x) (nthI prog (o + pc))).pc = o + (exec (Cfg.mk pc x) (nthI P pc)).pc /\
(exec (Cfg.mk (o + pc) x) (nthI prog (o + pc))).regs = (exec (Cfg.mk pc x) (nthI P pc)).regs
rw [hp, hi]
cases ins with
| push r b => exact And.intro (Nat.add_assoc o pc 1) rfl
| pop r e z w =>
show (popTo (Cfg.mk (o + pc) x) r (o + e) (o + z) (o + w) (x r)).pc = o + (popTo (Cfg.mk pc x) r e z w (x r)).pc /\
(popTo (Cfg.mk (o + pc) x) r (o + e) (o + z) (o + w) (x r)).regs = (popTo (Cfg.mk pc x) r e z w (x r)).regs
cases x r with
| nil => exact And.intro rfl rfl
| cons b t =>
cases b with
| false => exact And.intro rfl rfl
| true => exact And.intro rfl rfl
| jmp l => exact And.intro rfl rfl
/-- The run of P stays on its instructions before step n. -/
def Inside (P : List Ins) (n : Nat) (c : Cfg) : Prop :=
forall m, m < n -> Exists fun ins => nthI P (run P m c).pc = some ins
theorem frag_run (prog : List Ins) (o : Nat) (P : List Ins) (hf : Frag prog o P) :
forall n pc (x : Nat -> List Bool), Inside P n (Cfg.mk pc x) ->
(run prog n (Cfg.mk (o + pc) x)).pc = o + (run P n (Cfg.mk pc x)).pc /\
(run prog n (Cfg.mk (o + pc) x)).regs = (run P n (Cfg.mk pc x)).regs := by
intro n
induction n with
| zero => intro pc x _; exact And.intro rfl rfl
| succ n ih =>
intro pc x hin
cases hin 0 (Nat.succ_le_succ (Nat.zero_le n)) with
| intro ins hi =>
have s := frag_step prog o P hf pc x ins hi
have e : step prog (Cfg.mk (o + pc) x) =
Cfg.mk (o + (step P (Cfg.mk pc x)).pc) (step P (Cfg.mk pc x)).regs := by
rw [(s.1).symm, (s.2).symm]
have hin' : Inside P n (Cfg.mk (step P (Cfg.mk pc x)).pc (step P (Cfg.mk pc x)).regs) :=
fun m hm => hin (m + 1) (Nat.succ_le_succ hm)
show (run prog n (step prog (Cfg.mk (o + pc) x))).pc = o + (run P n (step P (Cfg.mk pc x))).pc /\
(run prog n (step prog (Cfg.mk (o + pc) x))).regs = (run P n (step P (Cfg.mk pc x))).regs
rw [e]
exact ih _ _ hin'
theorem frag_runs (prog : List Ins) (o : Nat) (P : List Ins) (hf : Frag prog o P) (n : Nat)
(x y : Nat -> List Bool) (hr : Runs P n 0 x P.length y) (hin : Inside P n (Cfg.mk 0 x)) :
Runs prog n o x (o + P.length) y := by
have r := frag_run prog o P hf n 0 x hin
refine And.intro ?_ (fun i => ?_)
· show (run prog n (Cfg.mk (o + 0) x)).pc = o + P.length
rw [r.1, hr.1]
· show (run prog n (Cfg.mk (o + 0) x)).regs i = y i
rw [r.2]
exact hr.2 i
end Found.Pnp68
#print axioms Found.Pnp68.frag_step
#print axioms Found.Pnp68.frag_run
#print axioms Found.Pnp68.frag_runs
lean_all/found/Pnp69.lean
/-
T330 piece 69. found/Pnp69 -- calling a program inside another (toward search-to-decision,
open lemma O5).
A program D, relocated by k registers (Pnp67) and placed at offset o in prog (Pnp21 Frag),
is a subroutine: if D alone runs from 0 on registers x to its end |D| with registers xf,
staying on its instructions (Pnp68 Inside), then prog runs from o on any registers y that
hold x from register k on, to o + |D|, with registers that hold xf from k on and keep the
registers below k. Proved:
* relocP_len: relocation keeps the length;
* inside_reloc: the relocated run stays inside when the original does;
* call_run: the subroutine call.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp67
import found.Pnp68
namespace Found.Pnp69
open Found.Pnp20 (Ins Cfg nthI run)
open Found.Pnp21 (Frag Runs)
open Found.Pnp67 (relocI relocP optMap nthI_reloc Rel run_reloc)
open Found.Pnp68 (Inside frag_runs)
theorem relocP_len (k : Nat) : forall p : List Ins, (relocP k p).length = p.length := by
intro p
induction p with
| nil => rfl
| cons i p ih => exact congrArg Nat.succ ih
theorem inside_reloc (k : Nat) (D : List Ins) (n : Nat) (x y y0 : Nat -> List Bool) (h : Rel k x y y0)
(hin : Inside D n (Cfg.mk 0 x)) : Inside (relocP k D) n (Cfg.mk 0 y) := by
intro m hm
have r := run_reloc k D m (Cfg.mk 0 x) (Cfg.mk 0 y) y0 rfl h
cases hin m hm with
| intro ins hi =>
refine Exists.intro (relocI k ins) ?_
rw [r.1, nthI_reloc, hi]
rfl
theorem call_run (prog : List Ins) (o k : Nat) (D : List Ins) (hf : Frag prog o (relocP k D)) (n : Nat)
(x xf y y0 : Nat -> List Bool) (h : Rel k x y y0) (hr : Runs D n 0 x D.length xf)
(hin : Inside D n (Cfg.mk 0 x)) :
Exists fun z => Runs prog n o y (o + D.length) z /\ (forall i, z (i + k) = xf i) /\
(forall i, i < k -> z i = y0 i) := by
have r := run_reloc k D n (Cfg.mk 0 x) (Cfg.mk 0 y) y0 rfl h
have hr' : Runs (relocP k D) n 0 y (relocP k D).length (run (relocP k D) n (Cfg.mk 0 y)).regs := by
refine And.intro ?_ (fun _ => rfl)
rw [r.1, hr.1, relocP_len]
have fr := frag_runs prog o (relocP k D) hf n y _ hr' (inside_reloc k D n x y y0 h hin)
rw [relocP_len] at fr
refine Exists.intro _ (And.intro fr (And.intro (fun i => ?_) r.2.2))
rw [r.2.1 i]
exact hr.2 i
end Found.Pnp69
#print axioms Found.Pnp69.relocP_len
#print axioms Found.Pnp69.inside_reloc
#print axioms Found.Pnp69.call_run
lean_all/found/Pnp7.lean
/-
T330 piece 7. found/Pnp7 -- the Cook-Levin tableau for multi-bit cells and an arbitrary
local rule.
Cells hold k bits; the local rule is any function delta of the 3k neighbourhood bits
(left, self, right; the cell left of 0 reads all false) giving each new bit. Each output
bit of delta becomes a formula by Shannon expansion (Pnp1.build), so any finite local
rule -- in particular the transition table of a Turing machine written on cells holding
(symbol, head, state) bits -- has a tableau. Proved: the tableau formula of bit b of
cell j at time t evaluates, on the initial bits a (enc j b), to that bit after t steps.
The initial layout enc is any map (no injectivity is needed for correctness).
Open (PNP_MAP.md): the Turing machine encoding itself, and the size count with shared
subformulas. It relativizes (a tool). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp6
namespace Found.Pnp7
open Found.Pnp1
open Found.Pnp6 (subst ev_subst)
/-! ## Lists -/
def nthd : List Bool -> Nat -> Bool
| [], _ => false
| x :: _, 0 => x
| _ :: L, i + 1 => nthd L i
def nthF : List Fm -> Nat -> Fm
| [], _ => .cst false
| f :: _, 0 => f
| _ :: L, i + 1 => nthF L i
def mapEv (a : Nat -> Bool) : List Fm -> List Bool
| [] => []
| f :: L => ev a f :: mapEv a L
def readF (g : Nat -> Fm) : Nat -> Nat -> List Fm
| _, 0 => []
| k, n + 1 => g k :: readF g (k + 1) n
theorem read_ext (f g : Nat -> Bool) (h : forall i, f i = g i) :
forall n k, read f k n = read g k n := by
intro n
induction n with
| zero => intro k; rfl
| succ n ih =>
intro k
show f k :: read f (k + 1) n = g k :: read g (k + 1) n
rw [h k, ih (k + 1)]
theorem read_shift (f : Nat -> Bool) : forall n k, read (fun i => f (i + 1)) k n = read f (k + 1) n := by
intro n
induction n with
| zero => intro k; rfl
| succ n ih =>
intro k
show f (k + 1) :: read (fun i => f (i + 1)) (k + 1) n = f (k + 1) :: read f (k + 1 + 1) n
rw [ih (k + 1)]
theorem read_nthd : forall L : List Bool, read (nthd L) 0 L.length = L := by
intro L
induction L with
| nil => rfl
| cons x L ih =>
show x :: read (nthd (x :: L)) (0 + 1) L.length = x :: L
rw [← read_shift (nthd (x :: L)) L.length 0]
exact congrArg (fun t => x :: t) ih
theorem ev_nthF (a : Nat -> Bool) : forall (Ls : List Fm) (i : Nat),
ev a (nthF Ls i) = nthd (mapEv a Ls) i := by
intro Ls
induction Ls with
| nil => intro i; cases i <;> rfl
| cons f L ih =>
intro i
cases i with
| zero => rfl
| succ i => exact ih i
theorem mapEv_append (a : Nat -> Bool) (B : List Fm) : forall A : List Fm,
mapEv a (A ++ B) = mapEv a A ++ mapEv a B := by
intro A
induction A with
| nil => rfl
| cons f A ih =>
show ev a f :: mapEv a (A ++ B) = ev a f :: (mapEv a A ++ mapEv a B)
rw [ih]
theorem mapEv_readF (a : Nat -> Bool) (g : Nat -> Fm) :
forall n k, mapEv a (readF g k n) = read (fun i => ev a (g i)) k n := by
intro n
induction n with
| zero => intro k; rfl
| succ n ih =>
intro k
show ev a (g k) :: mapEv a (readF g (k + 1) n) = ev a (g k) :: read (fun i => ev a (g i)) (k + 1) n
rw [ih (k + 1)]
theorem length_read (f : Nat -> Bool) : forall n k, (read f k n).length = n := by
intro n
induction n with
| zero => intro k; rfl
| succ n ih => intro k; exact congrArg (fun t => t + 1) (ih (k + 1))
theorem length_appendB (B : List Bool) : forall A : List Bool,
(A ++ B).length = A.length + B.length := by
intro A
induction A with
| nil => exact (Nat.zero_add _).symm
| cons x A ih =>
show (A ++ B).length + 1 = (A.length + 1) + B.length
rw [ih]
exact (Nat.succ_add _ _).symm
/-! ## The automaton with k-bit cells -/
abbrev Conf := Nat -> Nat -> Bool
def leftC (c : Conf) : Nat -> Nat -> Bool
| 0 => fun _ => false
| j + 1 => c j
/-- The 3k neighbourhood bits of cell j. -/
def nlist (c : Conf) (k j : Nat) : List Bool :=
read (leftC c j) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)
def stepK (delta : List Bool -> Nat -> Bool) (k : Nat) (c : Conf) : Conf :=
fun j b => delta (nlist c k j) b
def runK (delta : List Bool -> Nat -> Bool) (k : Nat) : Nat -> Conf -> Conf
| 0, c => c
| t + 1, c => stepK delta k (runK delta k t c)
theorem length_nlist (c : Conf) (k j : Nat) : (nlist c k j).length = k + (k + k) := by
show (read (leftC c j) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)).length = k + (k + k)
rw [length_appendB, length_appendB, length_read, length_read, length_read]
/-! ## The tableau -/
def leftFF (cf : Nat -> Nat -> Fm) : Nat -> Nat -> Fm
| 0 => fun _ => .cst false
| j + 1 => cf j
def nlistF (cf : Nat -> Nat -> Fm) (k j : Nat) : List Fm :=
readF (leftFF cf j) 0 k ++ (readF (cf j) 0 k ++ readF (cf (j + 1)) 0 k)
/-- The formula of output bit b of the rule, over the 3k neighbourhood variables. -/
def ruleF (delta : List Bool -> Nat -> Bool) (k b : Nat) : Fm :=
build (k + (k + k)) (fun xs => delta xs b) 0
def cellK (delta : List Bool -> Nat -> Bool) (k : Nat) (enc : Nat -> Nat -> Nat) :
Nat -> Nat -> Nat -> Fm
| 0, j, b => .var (enc j b)
| t + 1, j, b => subst (nthF (nlistF (cellK delta k enc t) k j)) (ruleF delta k b)
theorem mapEv_nlistF (a : Nat -> Bool) (cf : Nat -> Nat -> Fm) (c : Conf)
(h : forall j b, ev a (cf j b) = c j b) (k j : Nat) :
mapEv a (nlistF cf k j) = nlist c k j := by
show mapEv a (readF (leftFF cf j) 0 k ++ (readF (cf j) 0 k ++ readF (cf (j + 1)) 0 k)) =
read (leftC c j) 0 k ++ (read (c j) 0 k ++ read (c (j + 1)) 0 k)
rw [mapEv_append, mapEv_append, mapEv_readF, mapEv_readF, mapEv_readF,
read_ext _ _ (h j) k 0, read_ext _ _ (h (j + 1)) k 0]
have hl : forall i, ev a (leftFF cf j i) = leftC c j i := by
intro i
cases j with
| zero => rfl
| succ j => exact h j i
rw [read_ext _ _ hl k 0]
/-- The tableau is correct for k-bit cells and any local rule. -/
theorem tableauK (delta : List Bool -> Nat -> Bool) (k : Nat) (enc : Nat -> Nat -> Nat)
(a : Nat -> Bool) : forall t j b,
ev a (cellK delta k enc t j b) = runK delta k t (fun j b => a (enc j b)) j b := by
intro t
induction t with
| zero => intro j b; rfl
| succ t ih =>
intro j b
have hN := mapEv_nlistF a (cellK delta k enc t) _ ih k j
show ev a (subst (nthF (nlistF (cellK delta k enc t) k j)) (ruleF delta k b)) =
delta (nlist (runK delta k t (fun j b => a (enc j b))) k j) b
rw [ev_subst]
show ev (fun i => ev a (nthF (nlistF (cellK delta k enc t) k j) i))
(build (k + (k + k)) (fun xs => delta xs b) 0) = _
rw [ev_build, read_ext _ _ (ev_nthF a _) (k + (k + k)) 0, hN,
← length_nlist (runK delta k t (fun j b => a (enc j b))) k j, read_nthd]
end Found.Pnp7
#print axioms Found.Pnp7.read_ext
#print axioms Found.Pnp7.read_shift
#print axioms Found.Pnp7.read_nthd
#print axioms Found.Pnp7.ev_nthF
#print axioms Found.Pnp7.mapEv_append
#print axioms Found.Pnp7.mapEv_readF
#print axioms Found.Pnp7.length_read
#print axioms Found.Pnp7.length_appendB
#print axioms Found.Pnp7.length_nlist
#print axioms Found.Pnp7.mapEv_nlistF
#print axioms Found.Pnp7.tableauK
lean_all/found/Pnp70.lean
/-
T330 piece 70. found/Pnp70 -- one-step facts and the EQ fragment: comparing two registers
(toward search-to-decision on the register machine, open lemma O5rm).
EQ A B O pops A and B together; it pushes true on O if they were equal, false otherwise.
The layout (offsets from o):
0: pop A (empty -> 3, 0 -> 1, 1 -> 2) 1: pop B (-> 6, 0 -> 0, 1 -> 6)
2: pop B (-> 6, 0 -> 6, 1 -> 0) 3: pop B (empty -> 4, else -> 6)
4: push O true 5: jmp 7 6: push O false (end at 7).
Proved:
* run1_push, run1_jmp, run1_pop_nil, run1_pop_cons: one step of each instruction;
* eq_run: from o with A = a and B = b, EQ ends at o + 7 within 2 |a| + 4 steps, O holds
(beqL a b) :: O, and every register other than A, B, O is unchanged.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Owf2
import found.Pnp21
namespace Found.Pnp70
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI step exec popTo run)
open Found.Pnp21 (shift Frag Runs runs_seq)
open Found.Owf1 (beqL)
/-! ## One step -/
theorem run1_push (prog : List Ins) (o r : Nat) (b : Bool) (h : nthI prog o = some (.push r b))
(x : Nat -> List Bool) : Runs prog 1 o x (o + 1) (upd x r (b :: x r)) := by
show (exec (Cfg.mk o x) (nthI prog o)).pc = o + 1 /\ forall i, (exec (Cfg.mk o x) (nthI prog o)).regs i = _
rw [h]
exact And.intro rfl (fun _ => rfl)
theorem run1_jmp (prog : List Ins) (o l : Nat) (h : nthI prog o = some (.jmp l)) (x : Nat -> List Bool) :
Runs prog 1 o x l x := by
show (exec (Cfg.mk o x) (nthI prog o)).pc = l /\ forall i, (exec (Cfg.mk o x) (nthI prog o)).regs i = x i
rw [h]
exact And.intro rfl (fun _ => rfl)
theorem run1_pop_nil (prog : List Ins) (o r e z w : Nat) (h : nthI prog o = some (.pop r e z w))
(x : Nat -> List Bool) (hx : x r = []) : Runs prog 1 o x e x := by
show (exec (Cfg.mk o x) (nthI prog o)).pc = e /\ forall i, (exec (Cfg.mk o x) (nthI prog o)).regs i = x i
rw [h]
show (popTo (Cfg.mk o x) r e z w (x r)).pc = e /\ forall i, (popTo (Cfg.mk o x) r e z w (x r)).regs i = x i
rw [hx]
exact And.intro rfl (fun _ => rfl)
def bsel (b : Bool) (w z : Nat) : Nat := match b with | true => w | false => z
theorem run1_pop_cons (prog : List Ins) (o r e z w : Nat) (h : nthI prog o = some (.pop r e z w))
(x : Nat -> List Bool) (b : Bool) (t : List Bool) (hx : x r = b :: t) :
Runs prog 1 o x (bsel b w z) (upd x r t) := by
show (exec (Cfg.mk o x) (nthI prog o)).pc = _ /\ forall i, (exec (Cfg.mk o x) (nthI prog o)).regs i = _
rw [h]
show (popTo (Cfg.mk o x) r e z w (x r)).pc = _ /\ forall i, (popTo (Cfg.mk o x) r e z w (x r)).regs i = _
rw [hx]
cases b with
| false => exact And.intro rfl (fun _ => rfl)
| true => exact And.intro rfl (fun _ => rfl)
theorem nsym (a b : Nat) (h : Nat.beq a b = false) : Nat.beq b a = false := by
cases e : Nat.beq b a with
| false => rfl
| true =>
rw [Found.Pnp2.beq_eq b a e, Found.Pnp20.beq_refl'] at h
exact Bool.noConfusion h
theorem twoS (a : Nat) : (a + 1) + (a + 1) = (a + a) + 2 := by
rw [Nat.succ_add]
rfl
/-! ## EQ -/
def eqP (A B O : Nat) : List Ins :=
[.pop A 3 1 2, .pop B 6 0 6, .pop B 6 6 0, .pop B 4 6 6, .push O true, .jmp 7, .push O false]
/-- The instructions of EQ at offset o. -/
structure EqAt (prog : List Ins) (o A B O : Nat) : Prop where
i0 : nthI prog o = some (.pop A (o + 3) (o + 1) (o + 2))
i1 : nthI prog (o + 1) = some (.pop B (o + 6) o (o + 6))
i2 : nthI prog (o + 2) = some (.pop B (o + 6) (o + 6) o)
i3 : nthI prog (o + 3) = some (.pop B (o + 4) (o + 6) (o + 6))
i4 : nthI prog (o + 4) = some (.push O true)
i5 : nthI prog (o + 5) = some (.jmp (o + 7))
i6 : nthI prog (o + 6) = some (.push O false)
theorem eqAt_of_frag (prog : List Ins) (o A B O : Nat) (hf : Frag prog o (eqP A B O)) : EqAt prog o A B O :=
EqAt.mk (hf 0 _ rfl) (hf 1 _ rfl) (hf 2 _ rfl) (hf 3 _ rfl) (hf 4 _ rfl) (hf 5 _ rfl) (hf 6 _ rfl)
/-- The result of EQ: O gets the bit; A, B, O aside, registers are kept. -/
def EqOut (A B O : Nat) (x y : Nat -> List Bool) (bit : Bool) : Prop :=
y O = bit :: x O /\ forall i, Nat.beq i A = false -> Nat.beq i B = false -> Nat.beq i O = false -> y i = x i
theorem beqB_self (a : Bool) : (a == a) = true := by
cases a with
| false => rfl
| true => rfl
theorem beqB_ne (a b : Bool) (h : (a == b) = false) : (a == b) = false := h
theorem eq_out_push (A B O : Nat) (hAO : Nat.beq A O = false) (hBO : Nat.beq B O = false)
(x x1 : Nat -> List Bool) (bit : Bool)
(h1 : forall i, Nat.beq i A = false -> Nat.beq i B = false -> x1 i = x i) :
EqOut A B O x (upd x1 O (bit :: x1 O)) bit := by
have hO : x1 O = x O := h1 O (nsym A O hAO) (nsym B O hBO)
refine And.intro ?_ (fun i ha hb ho => ?_)
· rw [upd_same, hO]
· rw [upd_other x1 O i _ ho]
exact h1 i ha hb
theorem eq_run (prog : List Ins) (o A B O : Nat) (he : EqAt prog o A B O)
(hAB : Nat.beq A B = false) (hAO : Nat.beq A O = false) (hBO : Nat.beq B O = false) :
forall (a b : List Bool) (x : Nat -> List Bool), x A = a -> x B = b ->
Exists fun N => Exists fun y => N <= a.length + a.length + 4 /\ Runs prog N o x (o + 7) y /\
EqOut A B O x y (beqL a b) := by
intro a
induction a with
| nil =>
intro b x ha hb
have s0 := run1_pop_nil prog o A (o + 3) (o + 1) (o + 2) he.i0 x ha
cases b with
| nil =>
have s1 := run1_pop_nil prog (o + 3) B (o + 4) (o + 6) (o + 6) he.i3 x hb
have s2 := run1_push prog (o + 4) O true he.i4 x
have s3 := run1_jmp prog (o + 5) (o + 7) he.i5 (upd x O (true :: x O))
refine Exists.intro 4 (Exists.intro _ (And.intro (Nat.le_refl 4) (And.intro
(runs_seq prog 3 1 o (o + 5) (o + 7) x _ _
(runs_seq prog 2 1 o (o + 4) (o + 5) x x _ (runs_seq prog 1 1 o (o + 3) (o + 4) x x x s0 s1) s2) s3)
(eq_out_push A B O hAO hBO x x true (fun _ _ _ => rfl)))))
| cons c t =>
have s1 := run1_pop_cons prog (o + 3) B (o + 4) (o + 6) (o + 6) he.i3 x c t hb
have e6 : bsel c (o + 6) (o + 6) = o + 6 := by cases c with | false => rfl | true => rfl
rw [e6] at s1
have s2 := run1_push prog (o + 6) O false he.i6 (upd x B t)
refine Exists.intro 3 (Exists.intro _ (And.intro (Nat.le_succ 3) (And.intro
(runs_seq prog 2 1 o (o + 6) (o + 7) x _ _ (runs_seq prog 1 1 o (o + 3) (o + 6) x x _ s0 s1) s2)
(eq_out_push A B O hAO hBO x (upd x B t) false (fun i _ hb' => upd_other x B i t hb')))))
| cons a0 a ih =>
intro b x ha hb
have s0 := run1_pop_cons prog o A (o + 3) (o + 1) (o + 2) he.i0 x a0 a ha
have hb1 : upd x A a B = b := by rw [upd_other x A B a (nsym A B hAB)]; exact hb
-- the second pop, from o + 1 (a0 = false) or o + 2 (a0 = true)
cases b with
| nil =>
have s1 : Runs prog 1 (bsel a0 (o + 2) (o + 1)) (upd x A a) (o + 6) (upd x A a) := by
cases a0 with
| false => exact run1_pop_nil prog (o + 1) B (o + 6) o (o + 6) he.i1 _ hb1
| true => exact run1_pop_nil prog (o + 2) B (o + 6) (o + 6) o he.i2 _ hb1
have s2 := run1_push prog (o + 6) O false he.i6 (upd x A a)
refine Exists.intro 3 (Exists.intro _ (And.intro ?_ (And.intro
(runs_seq prog 2 1 o (o + 6) (o + 7) x _ _ (runs_seq prog 1 1 o _ (o + 6) x _ _ s0 s1) s2)
?_)))
· exact Nat.le_trans (Nat.le_succ 3) (Nat.le_add_left 4 _)
· have bf : beqL (a0 :: a) [] = false := rfl
rw [bf]
exact eq_out_push A B O hAO hBO x (upd x A a) false (fun i ha' _ => upd_other x A i a ha')
| cons c t =>
cases ec : (a0 == c) with
| false =>
have s1 : Runs prog 1 (bsel a0 (o + 2) (o + 1)) (upd x A a) (o + 6) (upd (upd x A a) B t) := by
cases a0 with
| false =>
cases c with
| false => exact Bool.noConfusion ec
| true => exact run1_pop_cons prog (o + 1) B (o + 6) o (o + 6) he.i1 _ true t hb1
| true =>
cases c with
| false => exact run1_pop_cons prog (o + 2) B (o + 6) (o + 6) o he.i2 _ false t hb1
| true => exact Bool.noConfusion ec
have s2 := run1_push prog (o + 6) O false he.i6 (upd (upd x A a) B t)
refine Exists.intro 3 (Exists.intro _ (And.intro ?_ (And.intro
(runs_seq prog 2 1 o (o + 6) (o + 7) x _ _ (runs_seq prog 1 1 o _ (o + 6) x _ _ s0 s1) s2) ?_)))
· exact Nat.le_trans (Nat.le_succ 3) (Nat.le_add_left 4 _)
· have bf : beqL (a0 :: a) (c :: t) = false := by
show ((a0 == c) && beqL a t) = false
rw [ec]
rfl
rw [bf]
exact eq_out_push A B O hAO hBO x _ false (fun i ha' hb' => by
rw [upd_other _ B i t hb', upd_other x A i a ha'])
| true =>
have s1 : Runs prog 1 (bsel a0 (o + 2) (o + 1)) (upd x A a) o (upd (upd x A a) B t) := by
cases a0 with
| false =>
cases c with
| false => exact run1_pop_cons prog (o + 1) B (o + 6) o (o + 6) he.i1 _ false t hb1
| true => exact Bool.noConfusion ec
| true =>
cases c with
| false => exact Bool.noConfusion ec
| true => exact run1_pop_cons prog (o + 2) B (o + 6) (o + 6) o he.i2 _ true t hb1
have hA2 : upd (upd x A a) B t A = a := by
rw [upd_other _ B A t hAB, upd_same]
have hB2 : upd (upd x A a) B t B = t := upd_same _ B t
cases ih t (upd (upd x A a) B t) hA2 hB2 with
| intro N hN =>
cases hN with
| intro y hy =>
refine Exists.intro (2 + N) (Exists.intro y (And.intro ?_ (And.intro
(runs_seq prog 2 N o o (o + 7) x _ y (runs_seq prog 1 1 o _ o x _ _ s0 s1) hy.2.1) ?_)))
· show 2 + N <= a.length + 1 + (a.length + 1) + 4
rw [twoS, Nat.add_comm 2 N]
refine Nat.le_trans (Nat.add_le_add_right hy.1 2) (Nat.le_of_eq ?_)
rw [Nat.add_right_comm]
· have bt : beqL (a0 :: a) (c :: t) = beqL a t := by
show ((a0 == c) && beqL a t) = beqL a t
rw [ec]
rfl
rw [bt]
refine And.intro ?_ (fun i ha' hb' ho' => ?_)
· rw [hy.2.2.1, upd_other _ B O t (nsym B O hBO),
upd_other x A O a (nsym A O hAO)]
· rw [hy.2.2.2 i ha' hb' ho', upd_other _ B i t hb', upd_other x A i a ha']
end Found.Pnp70
#print axioms Found.Pnp70.run1_push
#print axioms Found.Pnp70.run1_jmp
#print axioms Found.Pnp70.run1_pop_nil
#print axioms Found.Pnp70.run1_pop_cons
#print axioms Found.Pnp70.eqAt_of_frag
#print axioms Found.Pnp70.eq_out_push
#print axioms Found.Pnp70.eq_run
lean_all/found/Pnp71.lean
/-
T330 piece 71. found/Pnp71 -- the UNENC fragment: splitting an encoded pair (toward
search-to-decision on the register machine, open lemma O5rm).
Register S holds enc x w = dbl x ++ [true, true] ++ w (Pnp4): every bit b of x as
(false, b), then the separator (true, true). UNENC S X pops S two bits at a time, pushes
the data bits on X and stops after the separator. Layout (offsets from o):
0: pop S (-> 7, 0 -> 1, 1 -> 6) 1: pop S (-> 7, 0 -> 2, 1 -> 4)
2: push X false 3: jmp 0 4: push X true 5: jmp 0 6: pop S (all -> 7) end 7.
Proved:
* unenc_run: from o with S = enc x w, UNENC ends at o + 7 after 4 |x| + 2 steps with
S = w and X = revApp x X (x reversed on top of X); other registers unchanged.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp70
import found.Pnp4
namespace Found.Pnp71
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI revApp)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp70 (run1_push run1_jmp run1_pop_cons nsym)
open Found.Pnp4 (dbl enc)
def unencP (S X : Nat) : List Ins :=
[.pop S 7 1 6, .pop S 7 2 4, .push X false, .jmp 0, .push X true, .jmp 0, .pop S 7 7 7]
structure UnAt (prog : List Ins) (o S X : Nat) : Prop where
i0 : nthI prog o = some (.pop S (o + 7) (o + 1) (o + 6))
i1 : nthI prog (o + 1) = some (.pop S (o + 7) (o + 2) (o + 4))
i2 : nthI prog (o + 2) = some (.push X false)
i3 : nthI prog (o + 3) = some (.jmp o)
i4 : nthI prog (o + 4) = some (.push X true)
i5 : nthI prog (o + 5) = some (.jmp o)
i6 : nthI prog (o + 6) = some (.pop S (o + 7) (o + 7) (o + 7))
theorem unAt_of_frag (prog : List Ins) (o S X : Nat) (hf : Frag prog o (unencP S X)) : UnAt prog o S X :=
UnAt.mk (hf 0 _ rfl) (hf 1 _ rfl) (hf 2 _ rfl) (hf 3 _ rfl) (hf 4 _ rfl) (hf 5 _ rfl) (hf 6 _ rfl)
/-- The final registers. -/
def unOut (S X : Nat) (r : Nat -> List Bool) (x w : List Bool) : Nat -> List Bool :=
upd (upd r S w) X (revApp x (r X))
theorem unenc_run (prog : List Ins) (o S X : Nat) (hu : UnAt prog o S X) (hSX : Nat.beq S X = false)
(w : List Bool) : forall (x : List Bool) (r : Nat -> List Bool), r S = enc x w ->
Runs prog (4 * x.length + 2) o r (o + 7) (unOut S X r x w) := by
have hXS := nsym S X hSX
intro x
induction x with
| nil =>
intro r hr
have s0 := run1_pop_cons prog o S (o + 7) (o + 1) (o + 6) hu.i0 r true (true :: w) hr
have s1 := run1_pop_cons prog (o + 6) S (o + 7) (o + 7) (o + 7) hu.i6 (upd r S (true :: w)) true w
(upd_same r S _)
have s := runs_seq prog 1 1 o (o + 6) (o + 7) r _ _ s0 s1
refine And.intro s.1 (fun i => ?_)
refine (s.2 i).trans ?_
show upd (upd r S (true :: w)) S w i = upd (upd r S w) X (r X) i
cases ex : Nat.beq i X with
| true =>
have e := Found.Pnp2.beq_eq i X ex
rw [e, upd_same, upd_other _ S X w hXS, upd_other r S X _ hXS]
| false =>
rw [upd_other _ X i _ ex]
cases es : Nat.beq i S with
| true => rw [Found.Pnp2.beq_eq i S es, upd_same, upd_same]
| false => rw [upd_other _ S i w es, upd_other _ S i w es, upd_other r S i _ es]
| cons b x ih =>
intro r hr
have hr' : r S = false :: b :: (dbl x ++ (true :: true :: w)) := hr
have s0 := run1_pop_cons prog o S (o + 7) (o + 1) (o + 6) hu.i0 r false _ hr'
have r1 : upd r S (b :: (dbl x ++ (true :: true :: w))) S = b :: (dbl x ++ (true :: true :: w)) :=
upd_same r S _
have s1 := run1_pop_cons prog (o + 1) S (o + 7) (o + 2) (o + 4) hu.i1 _ b _ r1
-- r2: registers after the pair
have hstep : Runs prog 4 o r o (upd (upd r S (dbl x ++ (true :: true :: w))) X (b :: r X)) := by
cases b with
| false =>
have s2 := run1_push prog (o + 2) X false hu.i2 (upd (upd r S (false :: (dbl x ++ (true :: true :: w)))) S
(dbl x ++ (true :: true :: w)))
have s := runs_seq prog 3 1 o (o + 3) o r _ _
(runs_seq prog 2 1 o (o + 2) (o + 3) r _ _ (runs_seq prog 1 1 o (o + 1) (o + 2) r _ _ s0 s1) s2) (run1_jmp prog (o + 3) o hu.i3 _)
refine And.intro s.1 (fun i => ?_)
refine (s.2 i).trans ?_
show upd (upd (upd r S (false :: (dbl x ++ (true :: true :: w)))) S (dbl x ++ (true :: true :: w))) X
(false :: upd (upd r S (false :: (dbl x ++ (true :: true :: w)))) S (dbl x ++ (true :: true :: w)) X) i =
upd (upd r S (dbl x ++ (true :: true :: w))) X (false :: r X) i
rw [upd_other _ S X _ hXS, upd_other r S X _ hXS]
cases ex : Nat.beq i X with
| true => rw [Found.Pnp2.beq_eq i X ex, upd_same, upd_same]
| false =>
rw [upd_other _ X i _ ex, upd_other _ X i _ ex]
cases es : Nat.beq i S with
| true => rw [Found.Pnp2.beq_eq i S es, upd_same, upd_same]
| false => rw [upd_other _ S i _ es, upd_other _ S i _ es, upd_other r S i _ es]
| true =>
have s2 := run1_push prog (o + 4) X true hu.i4 (upd (upd r S (true :: (dbl x ++ (true :: true :: w)))) S
(dbl x ++ (true :: true :: w)))
have s := runs_seq prog 3 1 o (o + 5) o r _ _
(runs_seq prog 2 1 o (o + 4) (o + 5) r _ _ (runs_seq prog 1 1 o (o + 1) (o + 4) r _ _ s0 s1) s2) (run1_jmp prog (o + 5) o hu.i5 _)
refine And.intro s.1 (fun i => ?_)
refine (s.2 i).trans ?_
show upd (upd (upd r S (true :: (dbl x ++ (true :: true :: w)))) S (dbl x ++ (true :: true :: w))) X
(true :: upd (upd r S (true :: (dbl x ++ (true :: true :: w)))) S (dbl x ++ (true :: true :: w)) X) i =
upd (upd r S (dbl x ++ (true :: true :: w))) X (true :: r X) i
rw [upd_other _ S X _ hXS, upd_other r S X _ hXS]
cases ex : Nat.beq i X with
| true => rw [Found.Pnp2.beq_eq i X ex, upd_same, upd_same]
| false =>
rw [upd_other _ X i _ ex, upd_other _ X i _ ex]
cases es : Nat.beq i S with
| true => rw [Found.Pnp2.beq_eq i S es, upd_same, upd_same]
| false => rw [upd_other _ S i _ es, upd_other _ S i _ es, upd_other r S i _ es]
have hS2 : upd (upd r S (dbl x ++ (true :: true :: w))) X (b :: r X) S = enc x w := by
rw [upd_other _ X S _ hSX, upd_same]
rfl
have rest := ih _ hS2
have s := runs_seq prog 4 (4 * x.length + 2) o o (o + 7) r _ _ hstep rest
have en : 4 + (4 * x.length + 2) = 4 * (b :: x).length + 2 := by
show 4 + (4 * x.length + 2) = 4 * (x.length + 1) + 2
rw [Nat.left_distrib, Nat.mul_one, Nat.add_comm 4 (4 * x.length + 2), Nat.add_right_comm]
rw [en] at s
refine And.intro s.1 (fun i => ?_)
refine (s.2 i).trans ?_
show upd (upd (upd (upd r S (dbl x ++ (true :: true :: w))) X (b :: r X)) S w) X
(revApp x (upd (upd r S (dbl x ++ (true :: true :: w))) X (b :: r X) X)) i =
upd (upd r S w) X (revApp x (b :: r X)) i
rw [upd_same]
cases ex : Nat.beq i X with
| true => rw [Found.Pnp2.beq_eq i X ex, upd_same, upd_same]
| false =>
rw [upd_other _ X i _ ex, upd_other _ X i _ ex]
cases es : Nat.beq i S with
| true => rw [Found.Pnp2.beq_eq i S es, upd_same, upd_same]
| false => rw [upd_other _ S i _ es, upd_other _ S i _ es, upd_other _ X i _ ex, upd_other r S i _ es]
end Found.Pnp71
#print axioms Found.Pnp71.unAt_of_frag
#print axioms Found.Pnp71.unenc_run
lean_all/found/Pnp72.lean
/-
T330 piece 72. found/Pnp72 -- the UNENC fragment on every input, and runs that end at the
end of the program (toward search-to-decision on the register machine, open lemma O5rm).
A verifier must run in polynomial time on every input, not only on well-formed encodings.
unG S a is what UNENC (Pnp71) does to register S holding S and register X holding a, on
any S; unN S is its number of steps. Proved:
* unenc_gen: from o, UNENC ends at o + 7 after unN S steps with S = (unG S a).2 and
X = (unG S a).1, other registers unchanged;
* unN_le: unN S <= |S| + |S| + 2;
* unG_enc, unN_enc: on enc x w these are (revApp x a, w) and 4 |x| + 2 (Pnp71);
* run_halt, first_end: a run that reaches the end of a program after N steps reaches it
after some N' <= N steps while staying on its instructions before (Pnp68 Inside).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp71
import found.Pnp68
namespace Found.Pnp72
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI step exec run revApp)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp68 (Inside)
open Found.Pnp70 (run1_push run1_jmp run1_pop_nil run1_pop_cons nsym)
open Found.Pnp71 (UnAt)
open Found.Pnp4 (dbl enc)
/-- UNENC on any input: (bits pushed on X, what is left in S). -/
def unG : List Bool -> List Bool -> List Bool × List Bool
| [], a => (a, [])
| false :: [], a => (a, [])
| false :: b :: r, a => unG r (b :: a)
| true :: [], a => (a, [])
| true :: _ :: r, a => (a, r)
def unN : List Bool -> Nat
| [] => 1
| false :: [] => 2
| false :: _ :: r => 4 + unN r
| true :: [] => 2
| true :: _ :: _ => 2
theorem a4 (a : Nat) : a + a + 2 + 4 = (a + 1 + 1) + (a + 1 + 1) + 2 := by
have e : a + 2 + a = a + a + 2 := Nat.add_right_comm a 2 a
show a + a + 2 + 4 = (a + 2 + a) + 2 + 2
rw [e]
theorem unN_le : forall S : List Bool, unN S <= S.length + S.length + 2
| [] => Nat.le_succ 1
| false :: [] => Nat.le_add_left 2 2
| false :: _ :: r => by
have h := unN_le r
show 4 + unN r <= (r.length + 1 + 1) + (r.length + 1 + 1) + 2
refine Nat.le_trans (Nat.add_le_add_left h 4) (Nat.le_of_eq ?_)
rw [Nat.add_comm 4 (r.length + r.length + 2)]
exact a4 r.length
| true :: [] => Nat.le_add_left 2 2
| true :: _ :: _ => Nat.le_add_left 2 _
theorem unG_enc : forall (x w a : List Bool), unG (enc x w) a = (revApp x a, w)
| [], _, _ => rfl
| b :: x, w, a => unG_enc x w (b :: a)
theorem unN_enc : forall (x w : List Bool), unN (enc x w) = 4 * x.length + 2
| [], _ => rfl
| _ :: x, w => by
show 4 + unN (enc x w) = 4 * (x.length + 1) + 2
rw [unN_enc x w, Nat.left_distrib, Nat.mul_one, Nat.add_comm 4 (4 * x.length + 2), Nat.add_right_comm]
/-! ## pointwise register facts -/
theorem upd_over (x : Nat -> List Bool) (r : Nat) (v w : List Bool) :
forall i, upd (upd x r v) r w i = upd x r w i := by
intro i
cases e : Nat.beq i r with
| true => rw [Found.Pnp2.beq_eq i r e, upd_same, upd_same]
| false => rw [upd_other _ r i w e, upd_other _ r i v e, upd_other _ r i w e]
theorem upd_id (x : Nat -> List Bool) (r : Nat) (v : List Bool) (h : x r = v) :
forall i, upd x r v i = x i := by
intro i
cases e : Nat.beq i r with
| true => rw [Found.Pnp2.beq_eq i r e, upd_same, h]
| false => rw [upd_other _ r i v e]
/-- The shape of the final registers: S set, then X set. -/
def fin (r : Nat -> List Bool) (S X : Nat) (p : List Bool × List Bool) : Nat -> List Bool :=
upd (upd r S p.2) X p.1
theorem fin_cong (S X : Nat) (r r' : Nat -> List Bool) (h : forall i, r i = r' i) (p : List Bool × List Bool) :
forall i, fin r S X p i = fin r' S X p i :=
Found.Pnp20.upd_eqv _ _ (Found.Pnp20.upd_eqv r r' h S p.2) X p.1
/-- Setting S and X twice is setting them once. -/
theorem fin_fin (S X : Nat) (_hSX : Nat.beq S X = false) (r : Nat -> List Bool) (p q : List Bool × List Bool) :
forall i, fin (fin r S X p) S X q i = fin r S X q i := by
intro i
show upd (upd (upd (upd r S p.2) X p.1) S q.2) X q.1 i = upd (upd r S q.2) X q.1 i
cases ex : Nat.beq i X with
| true => rw [Found.Pnp2.beq_eq i X ex, upd_same, upd_same]
| false =>
rw [upd_other _ X i _ ex, upd_other _ X i _ ex]
cases es : Nat.beq i S with
| true => rw [Found.Pnp2.beq_eq i S es, upd_same, upd_same]
| false => rw [upd_other _ S i _ es, upd_other _ S i _ es, upd_other _ X i _ ex, upd_other r S i _ es]
/-! ## UNENC on every input -/
theorem unenc_gen (prog : List Ins) (o S X : Nat) (hu : UnAt prog o S X) (hSX : Nat.beq S X = false) :
forall (s : List Bool) (r : Nat -> List Bool), r S = s ->
Runs prog (unN s) o r (o + 7) (fin r S X (unG s (r X)))
| [], r, hr => by
have s0 := run1_pop_nil prog o S (o + 7) (o + 1) (o + 6) hu.i0 r hr
refine And.intro s0.1 (fun i => (s0.2 i).trans ?_)
show r i = upd (upd r S []) X (r X) i
have h1 : upd r S [] X = r X := upd_other r S X [] (nsym S X hSX)
rw [(upd_id (upd r S []) X (r X) h1 i), upd_id r S [] hr i]
| false :: [], r, hr => by
have s0 := run1_pop_cons prog o S (o + 7) (o + 1) (o + 6) hu.i0 r false [] hr
have s1 := run1_pop_nil prog (o + 1) S (o + 7) (o + 2) (o + 4) hu.i1 (upd r S []) (upd_same r S [])
have s := runs_seq prog 1 1 o (o + 1) (o + 7) r _ _ s0 s1
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show upd r S [] i = upd (upd r S []) X (r X) i
have h1 : upd r S [] X = r X := upd_other r S X [] (nsym S X hSX)
rw [upd_id (upd r S []) X (r X) h1 i]
| true :: [], r, hr => by
have s0 := run1_pop_cons prog o S (o + 7) (o + 1) (o + 6) hu.i0 r true [] hr
have s1 := run1_pop_nil prog (o + 6) S (o + 7) (o + 7) (o + 7) hu.i6 (upd r S []) (upd_same r S [])
have s := runs_seq prog 1 1 o (o + 6) (o + 7) r _ _ s0 s1
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show upd r S [] i = upd (upd r S []) X (r X) i
have h1 : upd r S [] X = r X := upd_other r S X [] (nsym S X hSX)
rw [upd_id (upd r S []) X (r X) h1 i]
| true :: c :: t, r, hr => by
have s0 := run1_pop_cons prog o S (o + 7) (o + 1) (o + 6) hu.i0 r true (c :: t) hr
have s1 := run1_pop_cons prog (o + 6) S (o + 7) (o + 7) (o + 7) hu.i6 (upd r S (c :: t)) c t
(upd_same r S _)
have e7 : Found.Pnp70.bsel c (o + 7) (o + 7) = o + 7 := by cases c with | false => rfl | true => rfl
rw [e7] at s1
have s := runs_seq prog 1 1 o (o + 6) (o + 7) r _ _ s0 s1
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show upd (upd r S (c :: t)) S t i = upd (upd r S t) X (r X) i
have h1 : upd r S t X = r X := upd_other r S X t (nsym S X hSX)
rw [upd_over r S (c :: t) t i, upd_id (upd r S t) X (r X) h1 i]
| false :: b :: t, r, hr => by
have s0 := run1_pop_cons prog o S (o + 7) (o + 1) (o + 6) hu.i0 r false (b :: t) hr
have s1 := run1_pop_cons prog (o + 1) S (o + 7) (o + 2) (o + 4) hu.i1 (upd r S (b :: t)) b t
(upd_same r S _)
-- after the pair: S = t, X = b :: r X
have hstep : Runs prog 4 o r o (fin r S X (b :: r X, t)) := by
have hX : upd (upd r S (b :: t)) S t X = r X := by
rw [upd_other _ S X t (nsym S X hSX), upd_other r S X _ (nsym S X hSX)]
cases b with
| false =>
have s2 := run1_push prog (o + 2) X false hu.i2 (upd (upd r S (false :: t)) S t)
have s := runs_seq prog 3 1 o (o + 3) o r _ _
(runs_seq prog 2 1 o (o + 2) (o + 3) r _ _ (runs_seq prog 1 1 o (o + 1) (o + 2) r _ _ s0 s1) s2)
(run1_jmp prog (o + 3) o hu.i3 _)
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show upd (upd (upd r S (false :: t)) S t) X (false :: upd (upd r S (false :: t)) S t X) i =
upd (upd r S t) X (false :: r X) i
rw [hX]
exact Found.Pnp20.upd_eqv _ _ (upd_over r S _ t) X _ i
| true =>
have s2 := run1_push prog (o + 4) X true hu.i4 (upd (upd r S (true :: t)) S t)
have s := runs_seq prog 3 1 o (o + 5) o r _ _
(runs_seq prog 2 1 o (o + 4) (o + 5) r _ _ (runs_seq prog 1 1 o (o + 1) (o + 4) r _ _ s0 s1) s2)
(run1_jmp prog (o + 5) o hu.i5 _)
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show upd (upd (upd r S (true :: t)) S t) X (true :: upd (upd r S (true :: t)) S t X) i =
upd (upd r S t) X (true :: r X) i
rw [hX]
exact Found.Pnp20.upd_eqv _ _ (upd_over r S _ t) X _ i
have hS2 : fin r S X (b :: r X, t) S = t := by
show upd (upd r S t) X (b :: r X) S = t
rw [upd_other _ X S _ hSX, upd_same]
have hX2 : fin r S X (b :: r X, t) X = b :: r X := upd_same _ X _
have rest := unenc_gen prog o S X hu hSX t _ hS2
rw [hX2] at rest
have s := runs_seq prog 4 (unN t) o o (o + 7) r _ _ hstep rest
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
exact fin_fin S X hSX r _ _ i
/-! ## the first time a run reaches the end -/
theorem run_halt (p : List Ins) (c : Cfg) (h : nthI p c.pc = none) : forall n, run p n c = c := by
intro n
induction n with
| zero => rfl
| succ n ih =>
have e : step p c = c := by
show exec c (nthI p c.pc) = c
rw [h]
rfl
show run p n (step p c) = c
rw [e]
exact ih
theorem first_end (p : List Ins) : forall (N : Nat) (c : Cfg),
Exists fun N' => N' <= N /\ run p N' c = run p N c /\ Inside p N' c := by
intro N
induction N with
| zero => intro c; exact Exists.intro 0 (And.intro (Nat.le_refl 0) (And.intro rfl (fun _ hm => absurd hm (Nat.not_lt_zero _))))
| succ N ih =>
intro c
cases hc : nthI p c.pc with
| none =>
refine Exists.intro 0 (And.intro (Nat.zero_le _) (And.intro ?_ (fun _ hm => absurd hm (Nat.not_lt_zero _))))
exact (run_halt p c hc (N + 1)).symm
| some ins =>
cases ih (step p c) with
| intro N' h =>
refine Exists.intro (N' + 1) (And.intro (Nat.succ_le_succ h.1) (And.intro h.2.1 ?_))
intro m hm
cases m with
| zero => exact Exists.intro ins hc
| succ m => exact h.2.2 m (Nat.lt_of_succ_lt_succ hm)
/-- A run that is at the end of p after N steps is there after N' <= N steps, inside before. -/
theorem runs_first (p : List Ins) (N : Nat) (x y : Nat -> List Bool) (h : Runs p N 0 x p.length y) :
Exists fun N' => N' <= N /\ Runs p N' 0 x p.length y /\ Inside p N' (Cfg.mk 0 x) :=
match first_end p N (Cfg.mk 0 x) with
| Exists.intro N' hN =>
Exists.intro N' (And.intro hN.1 (And.intro
(by
refine And.intro ?_ (fun i => ?_)
· rw [hN.2.1]; exact h.1
· rw [hN.2.1]; exact h.2 i)
hN.2.2))
end Found.Pnp72
#print axioms Found.Pnp72.a4
#print axioms Found.Pnp72.unN_le
#print axioms Found.Pnp72.unG_enc
#print axioms Found.Pnp72.unN_enc
#print axioms Found.Pnp72.upd_over
#print axioms Found.Pnp72.upd_id
#print axioms Found.Pnp72.fin_cong
#print axioms Found.Pnp72.fin_fin
#print axioms Found.Pnp72.unenc_gen
#print axioms Found.Pnp72.run_halt
#print axioms Found.Pnp72.first_end
#print axioms Found.Pnp72.runs_first
lean_all/found/Pnp73.lean
/-
T330 piece 73. found/Pnp73 -- the LCHK fragment: a length check in unary (toward
search-to-decision on the register machine, open lemma O5rm).
LCHK T U D fl moves register T onto D (reversed), popping one bit of U for every bit of T;
if U runs out first it leaves through the failure exit fl. Layout (offsets from o):
0: pop T (empty -> 7, 0 -> 1, 1 -> 4) 1: pop U (empty -> fl, else -> 2)
2: push D false 3: jmp 0 4: pop U (empty -> fl, else -> 5) 5: push D true 6: jmp 0
with the success exit 7. lc t u d = (ok, T, U, D) is the result on any contents, lcN its
number of steps. Proved:
* lchk_run: from o with T = t, U = u, LCHK runs lcN t u steps to o + 7 (ok) or o + fl
(not ok) with T, U, D as lc says and every other register unchanged;
* lcN_le: lcN t u <= 4 |t| + 1;
* lc_le: if |t| <= |u| then ok and D = revApp t d; lc_gt: if |u| < |t| then not ok.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp72
namespace Found.Pnp73
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI revApp)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp70 (run1_push run1_jmp run1_pop_nil run1_pop_cons nsym bsel)
def lchkP (T U D fl : Nat) : List Ins :=
[.pop T 7 1 4, .pop U fl 2 2, .push D false, .jmp 0, .pop U fl 5 5, .push D true, .jmp 0]
structure LcAt (prog : List Ins) (o T U D fl : Nat) : Prop where
i0 : nthI prog o = some (.pop T (o + 7) (o + 1) (o + 4))
i1 : nthI prog (o + 1) = some (.pop U (o + fl) (o + 2) (o + 2))
i2 : nthI prog (o + 2) = some (.push D false)
i3 : nthI prog (o + 3) = some (.jmp o)
i4 : nthI prog (o + 4) = some (.pop U (o + fl) (o + 5) (o + 5))
i5 : nthI prog (o + 5) = some (.push D true)
i6 : nthI prog (o + 6) = some (.jmp o)
theorem lcAt_of_frag (prog : List Ins) (o T U D fl : Nat) (hf : Frag prog o (lchkP T U D fl)) :
LcAt prog o T U D fl :=
LcAt.mk (hf 0 _ rfl) (hf 1 _ rfl) (hf 2 _ rfl) (hf 3 _ rfl) (hf 4 _ rfl) (hf 5 _ rfl) (hf 6 _ rfl)
/-- (ok, T, U, D) after LCHK. -/
def lc : List Bool -> List Bool -> List Bool -> Bool × List Bool × List Bool × List Bool
| [], u, d => (true, [], u, d)
| _ :: t, [], d => (false, t, [], d)
| b :: t, _ :: u, d => lc t u (b :: d)
def lcN : List Bool -> List Bool -> Nat
| [], _ => 1
| _ :: _, [] => 2
| _ :: t, _ :: u => 4 + lcN t u
/-- Registers T, U, D set. -/
def fin3 (r : Nat -> List Bool) (T U D : Nat) (q : Bool × List Bool × List Bool × List Bool) : Nat -> List Bool :=
upd (upd (upd r T q.2.1) U q.2.2.1) D q.2.2.2
/-- Two register functions that agree off T, U, D give the same fin3. -/
theorem fin3_absorb (T U D : Nat) (r y : Nat -> List Bool)
(h : forall i, Nat.beq i T = false -> Nat.beq i U = false -> Nat.beq i D = false -> y i = r i)
(q : Bool × List Bool × List Bool × List Bool) : forall i, fin3 y T U D q i = fin3 r T U D q i := by
intro i
show upd (upd (upd y T q.2.1) U q.2.2.1) D q.2.2.2 i = upd (upd (upd r T q.2.1) U q.2.2.1) D q.2.2.2 i
cases eD : Nat.beq i D with
| true => rw [Found.Pnp2.beq_eq i D eD, upd_same, upd_same]
| false =>
rw [upd_other _ D i _ eD, upd_other _ D i _ eD]
cases eU : Nat.beq i U with
| true => rw [Found.Pnp2.beq_eq i U eU, upd_same, upd_same]
| false =>
rw [upd_other _ U i _ eU, upd_other _ U i _ eU]
cases eT : Nat.beq i T with
| true => rw [Found.Pnp2.beq_eq i T eT, upd_same, upd_same]
| false => rw [upd_other _ T i _ eT, upd_other _ T i _ eT]; exact h i eT eU eD
/-- A register function with the right T, U, D that agrees with r elsewhere is fin3 r. -/
theorem fin3_ext (T U D : Nat) (r y : Nat -> List Bool) (q : Bool × List Bool × List Bool × List Bool)
(hT : y T = q.2.1) (hU : y U = q.2.2.1) (hD : y D = q.2.2.2)
(h : forall i, Nat.beq i T = false -> Nat.beq i U = false -> Nat.beq i D = false -> y i = r i) :
forall i, y i = fin3 r T U D q i := by
intro i
show y i = upd (upd (upd r T q.2.1) U q.2.2.1) D q.2.2.2 i
cases eD : Nat.beq i D with
| true => rw [Found.Pnp2.beq_eq i D eD, upd_same, hD]
| false =>
rw [upd_other _ D i _ eD]
cases eU : Nat.beq i U with
| true => rw [Found.Pnp2.beq_eq i U eU, upd_same, hU]
| false =>
rw [upd_other _ U i _ eU]
cases eT : Nat.beq i T with
| true => rw [Found.Pnp2.beq_eq i T eT, upd_same, hT]
| false => rw [upd_other _ T i _ eT]; exact h i eT eU eD
theorem lchk_run (prog : List Ins) (o T U D fl : Nat) (hl : LcAt prog o T U D fl)
(hTU : Nat.beq T U = false) (hTD : Nat.beq T D = false) (hUD : Nat.beq U D = false) :
forall (t u : List Bool) (r : Nat -> List Bool), r T = t -> r U = u ->
Runs prog (lcN t u) o r (bsel (lc t u (r D)).1 (o + 7) (o + fl)) (fin3 r T U D (lc t u (r D)))
| [], u, r, ht, hu => by
have s0 := run1_pop_nil prog o T (o + 7) (o + 1) (o + 4) hl.i0 r ht
exact And.intro s0.1 (fun i => (s0.2 i).trans (fin3_ext T U D r r _ ht hu rfl (fun _ _ _ _ => rfl) i))
| b :: t, [], r, ht, hu => by
have s0 := run1_pop_cons prog o T (o + 7) (o + 1) (o + 4) hl.i0 r b t ht
have hu1 : upd r T t U = [] := by rw [upd_other r T U t (nsym T U hTU)]; exact hu
have s1 : Runs prog 1 (bsel b (o + 4) (o + 1)) (upd r T t) (o + fl) (upd r T t) := by
cases b with
| false => exact run1_pop_nil prog (o + 1) U (o + fl) (o + 2) (o + 2) hl.i1 _ hu1
| true => exact run1_pop_nil prog (o + 4) U (o + fl) (o + 5) (o + 5) hl.i4 _ hu1
have s := runs_seq prog 1 1 o _ (o + fl) r _ _ s0 s1
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
exact fin3_ext T U D r (upd r T t) _ (upd_same r T t) hu1 (upd_other r T D t (nsym T D hTD))
(fun j hj _ _ => upd_other r T j t hj) i
| b :: t, c :: u, r, ht, hu => by
have s0 := run1_pop_cons prog o T (o + 7) (o + 1) (o + 4) hl.i0 r b t ht
have hu1 : upd r T t U = c :: u := by rw [upd_other r T U t (nsym T U hTU)]; exact hu
-- y1: T = t, U = u, D = b :: r D
have hD1 : upd (upd r T t) U u D = r D := by
rw [upd_other _ U D u (nsym U D hUD), upd_other r T D t (nsym T D hTD)]
have hstep : Runs prog 4 o r o (upd (upd (upd r T t) U u) D (b :: r D)) := by
cases b with
| false =>
have s1 := run1_pop_cons prog (o + 1) U (o + fl) (o + 2) (o + 2) hl.i1 _ c u hu1
have e2 : bsel c (o + 2) (o + 2) = o + 2 := by cases c with | false => rfl | true => rfl
rw [e2] at s1
have s2 := run1_push prog (o + 2) D false hl.i2 (upd (upd r T t) U u)
have s := runs_seq prog 3 1 o (o + 3) o r _ _
(runs_seq prog 2 1 o (o + 2) (o + 3) r _ _ (runs_seq prog 1 1 o (o + 1) (o + 2) r _ _ s0 s1) s2)
(run1_jmp prog (o + 3) o hl.i3 _)
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
rw [hD1]
| true =>
have s1 := run1_pop_cons prog (o + 4) U (o + fl) (o + 5) (o + 5) hl.i4 _ c u hu1
have e5 : bsel c (o + 5) (o + 5) = o + 5 := by cases c with | false => rfl | true => rfl
rw [e5] at s1
have s2 := run1_push prog (o + 5) D true hl.i5 (upd (upd r T t) U u)
have s := runs_seq prog 3 1 o (o + 6) o r _ _
(runs_seq prog 2 1 o (o + 5) (o + 6) r _ _ (runs_seq prog 1 1 o (o + 4) (o + 5) r _ _ s0 s1) s2)
(run1_jmp prog (o + 6) o hl.i6 _)
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
rw [hD1]
have hT2 : upd (upd (upd r T t) U u) D (b :: r D) T = t := by
rw [upd_other _ D T _ hTD, upd_other _ U T u hTU, upd_same]
have hU2 : upd (upd (upd r T t) U u) D (b :: r D) U = u := by
rw [upd_other _ D U _ hUD, upd_same]
have hD2 : upd (upd (upd r T t) U u) D (b :: r D) D = b :: r D := upd_same _ D _
have rest := lchk_run prog o T U D fl hl hTU hTD hUD t u _ hT2 hU2
rw [hD2] at rest
have s := runs_seq prog 4 (lcN t u) o o _ r _ _ hstep rest
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
refine fin3_absorb T U D r _ (fun j hj hu' hd => ?_) _ i
rw [upd_other _ D j _ hd, upd_other _ U j u hu', upd_other r T j t hj]
theorem lcN_le : forall t u : List Bool, lcN t u <= 4 * t.length + 1
| [], _ => Nat.le_refl 1
| _ :: t, [] => by
show 2 <= 4 * (t.length + 1) + 1
rw [Nat.left_distrib, Nat.mul_one]
exact Nat.le_trans (Nat.le_add_left 2 3) (Nat.le_add_left 5 (4 * t.length))
| _ :: t, _ :: u => by
show 4 + lcN t u <= 4 * (t.length + 1) + 1
rw [Nat.left_distrib, Nat.mul_one, Nat.add_right_comm, Nat.add_comm (4 * t.length + 1) 4]
exact Nat.add_le_add_left (lcN_le t u) 4
theorem lc_le : forall (t u d : List Bool), t.length <= u.length ->
(lc t u d).1 = true /\ (lc t u d).2.2.2 = revApp t d
| [], _, _, _ => And.intro rfl rfl
| _ :: t, [], _, h => absurd h (Nat.not_succ_le_zero t.length)
| b :: t, _ :: u, d, h => lc_le t u (b :: d) (Nat.le_of_succ_le_succ h)
theorem lc_gt : forall (t u d : List Bool), u.length < t.length -> (lc t u d).1 = false
| [], _, _, h => absurd h (Nat.not_lt_zero _)
| _ :: _, [], _, _ => rfl
| b :: t, _ :: u, d, h => lc_gt t u (b :: d) (Nat.lt_of_succ_lt_succ h)
end Found.Pnp73
#print axioms Found.Pnp73.lcAt_of_frag
#print axioms Found.Pnp73.fin3_absorb
#print axioms Found.Pnp73.fin3_ext
#print axioms Found.Pnp73.lchk_run
#print axioms Found.Pnp73.lcN_le
#print axioms Found.Pnp73.lc_le
#print axioms Found.Pnp73.lc_gt
lean_all/found/Pnp74.lean
/-
T330 piece 74. found/Pnp74 -- the verifier program V_f on the register machine (toward
search-to-decision on the register machine, open lemma O5rm).
For a program F computing f, vP F reads enc t s from register 13, with t meant to be
enc z (enc p u), and accepts when |s| <= |u| and f (p ++ s) = z. Layout (registers):
UNENC 13 -> 17; MOVE 17 -> 18; UNENC 18 -> 19 (z reversed); UNENC 18 -> 20 (p reversed,
18 = u); MOVE 13 -> 21; LCHK 21 18 45 (fail -> end handler); MOVE 20 -> 45 (45 = p ++ s);
F relocated by 32 (input 45, output 48); MOVE 19 -> 22 (z); EQ 22 48 16; jmp end;
fail handler: push 16 false.
vF f a is the bit it leaves, defined on every input. Proved:
* spec forms of UNENC, MOVE, LCHK with frame conditions;
* v_run: on every input a, vP F ends at its end within
10 (4 |a| + 4) + pe eF |a| steps with outBit of register 16 = vF f a.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp73
import found.Owf4
namespace Found.Pnp74
open Found.Pnp3 (PE pe pe_mono)
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI run revApp move)
open Found.Pnp21 (Frag Runs runs_seq shift frag_move_run)
open Found.Pnp23 (appI mapI frag_app frag_app_l)
open Found.Pnp59 (inpR inpR_13 inpR_other frag_self)
open Found.Pnp67 (relocP)
open Found.Pnp69 (relocP_len call_run)
open Found.Pnp70 (run1_push run1_jmp nsym bsel eqP eqAt_of_frag eq_run EqOut)
open Found.Pnp71 (unencP unAt_of_frag UnAt)
open Found.Pnp72 (unG unN unN_le unenc_gen fin)
open Found.Pnp73 (lchkP lcAt_of_frag LcAt lc lcN lcN_le lchk_run fin3)
open Found.Owf1 (beqL)
open Found.Owf4 (outBit CompRM)
/-! ## the program -/
def seqI (p q : List Ins) : List Ins := appI p (mapI (shift p.length) q)
theorem fragHT (prog : List Ins) (o : Nat) (p q : List Ins) (h : Frag prog o (seqI p q)) :
Frag prog o p /\ Frag prog (o + p.length) q :=
And.intro (frag_app_l prog o p _ h) (frag_app prog o p q h)
def t11 : List Ins := seqI [.jmp 2] [.push 16 false]
def t10 : List Ins := seqI (eqP 22 48 16) t11
def t9 : List Ins := seqI (move 19 22) t10
def t8 (F : List Ins) : List Ins := seqI (relocP 32 F) t9
def t7 (F : List Ins) : List Ins := seqI (move 20 45) (t8 F)
def t6 (F : List Ins) : List Ins := seqI (lchkP 21 18 45 (25 + F.length)) (t7 F)
def t5 (F : List Ins) : List Ins := seqI (move 13 21) (t6 F)
def t4 (F : List Ins) : List Ins := seqI (unencP 18 20) (t5 F)
def t3 (F : List Ins) : List Ins := seqI (unencP 18 19) (t4 F)
def t2 (F : List Ins) : List Ins := seqI (move 17 18) (t3 F)
def vP (F : List Ins) : List Ins := seqI (unencP 13 17) (t2 F)
theorem appI_len : forall p q : List Ins, (appI p q).length = p.length + q.length
| [], q => (Nat.zero_add q.length).symm
| _ :: p, q => by
show (appI p q).length + 1 = p.length + 1 + q.length
rw [appI_len p q, Nat.add_right_comm]
theorem mapI_len (g : Ins -> Ins) : forall p : List Ins, (mapI g p).length = p.length
| [] => rfl
| _ :: p => congrArg Nat.succ (mapI_len g p)
theorem seqI_len (p q : List Ins) : (seqI p q).length = p.length + q.length := by
show (appI p (mapI (shift p.length) q)).length = _
rw [appI_len, mapI_len]
theorem vP_len (F : List Ins) : (vP F).length = 43 + F.length + 5 + 7 + 2 := by
show (seqI (unencP 13 17) (t2 F)).length = _
rw [seqI_len]; show 7 + (seqI (move 17 18) (t3 F)).length = _
rw [seqI_len]; show 7 + (5 + (seqI (unencP 18 19) (t4 F)).length) = _
rw [seqI_len]; show 7 + (5 + (7 + (seqI (unencP 18 20) (t5 F)).length)) = _
rw [seqI_len]; show 7 + (5 + (7 + (7 + (seqI (move 13 21) (t6 F)).length))) = _
rw [seqI_len]; show 7 + (5 + (7 + (7 + (5 + (seqI (lchkP 21 18 45 (25 + F.length)) (t7 F)).length)))) = _
rw [seqI_len]; show 7 + (5 + (7 + (7 + (5 + (7 + (seqI (move 20 45) (t8 F)).length))))) = _
rw [seqI_len]; show 7 + (5 + (7 + (7 + (5 + (7 + (5 + (seqI (relocP 32 F) t9).length)))))) = _
rw [seqI_len, relocP_len]; show 7 + (5 + (7 + (7 + (5 + (7 + (5 + (F.length + (seqI (move 19 22) t10).length))))))) = _
rw [seqI_len]; show 7 + (5 + (7 + (7 + (5 + (7 + (5 + (F.length + (5 + (seqI (eqP 22 48 16) t11).length)))))))) = _
rw [seqI_len]; show 7 + (5 + (7 + (7 + (5 + (7 + (5 + (F.length + (5 + (7 + (seqI [.jmp 2] [.push 16 false]).length))))))))) = _
rw [seqI_len]
show 7 + (5 + (7 + (7 + (5 + (7 + (5 + (F.length + 14))))))) = 43 + F.length + 14
repeat rw [← Nat.add_assoc]
theorem ar1 (n : Nat) : 31 + (25 + n) = 43 + n + 5 + 7 + 1 := by
rw [← Nat.add_assoc, Nat.add_comm 43 n, Nat.add_comm (31 + 25) n]
/-! ## the function computed -/
def selB : Bool -> Bool -> Bool -> Bool
| true, a, _ => a
| false, _, b => b
def vF (f : List Bool -> List Bool) (a : List Bool) : Bool :=
selB (lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).1
(beqL (revApp (unG (revApp (unG a []).1 []) []).1 [])
(f (revApp (unG (unG (revApp (unG a []).1 []) []).2 []).1
(lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).2.2.2)))
false
/-! ## spec forms -/
theorem unenc_spec (prog : List Ins) (o S X : Nat) (hu : UnAt prog o S X) (hSX : Nat.beq S X = false)
(s acc : List Bool) (x : Nat -> List Bool) (hs : x S = s) (hx : x X = acc) :
Exists fun y => Runs prog (unN s) o x (o + 7) y /\ y S = (unG s acc).2 /\ y X = (unG s acc).1 /\
(forall i, Nat.beq i S = false -> Nat.beq i X = false -> y i = x i) := by
have r := unenc_gen prog o S X hu hSX s x hs
rw [hx] at r
refine Exists.intro _ (And.intro r (And.intro ?_ (And.intro (upd_same _ X _) ?_)))
· show upd (upd x S (unG s acc).2) X (unG s acc).1 S = _
rw [upd_other _ X S _ hSX, upd_same]
· intro i hi1 hi2
show upd (upd x S (unG s acc).2) X (unG s acc).1 i = x i
rw [upd_other _ X i _ hi2, upd_other _ S i _ hi1]
theorem move_spec (prog : List Ins) (o r s : Nat) (hf : Frag prog o (move r s)) (hrs : Nat.beq r s = false)
(l m : List Bool) (x : Nat -> List Bool) (hl : x r = l) (hm : x s = m) :
Exists fun y => Runs prog (3 * l.length + 1) o x (o + 5) y /\ y r = [] /\ y s = revApp l m /\
(forall i, Nat.beq i r = false -> Nat.beq i s = false -> y i = x i) := by
have h := frag_move_run prog o r s hf hrs l m x hl hm
exact Exists.intro _ (And.intro (And.intro h.1 (fun _ => rfl)) h.2)
theorem lchk_spec (prog : List Ins) (o T U D fl : Nat) (hl : LcAt prog o T U D fl)
(hTU : Nat.beq T U = false) (hTD : Nat.beq T D = false) (hUD : Nat.beq U D = false)
(t u d : List Bool) (x : Nat -> List Bool) (ht : x T = t) (hu : x U = u) (hd : x D = d) :
Exists fun y => Runs prog (lcN t u) o x (bsel (lc t u d).1 (o + 7) (o + fl)) y /\
y D = (lc t u d).2.2.2 /\
(forall i, Nat.beq i T = false -> Nat.beq i U = false -> Nat.beq i D = false -> y i = x i) := by
have r := lchk_run prog o T U D fl hl hTU hTD hUD t u x ht hu
rw [hd] at r
refine Exists.intro _ (And.intro r (And.intro (upd_same _ D _) ?_))
intro i h1 h2 h3
show upd (upd (upd x T _) U _) D _ i = x i
rw [upd_other _ D i _ h3, upd_other _ U i _ h2, upd_other _ T i _ h1]
/-! ## the high registers (the block of F) -/
def Hi (y : Nat -> List Bool) (w : List Bool) : Prop := forall i, y (i + 32) = inpR w i
theorem lt32 (a : Nat) (h : Nat.ble (a + 1) 32 = true) : a < 32 := Nat.le_of_ble_eq_true h
theorem hi_lt (A i : Nat) (hA : A < 32) : Nat.beq (i + 32) A = false :=
Found.Pnp56.beq_gt (i + 32) A (Nat.lt_of_lt_of_le hA (Nat.le_add_left 32 i))
theorem inpR_nil (i : Nat) : inpR [] i = [] := by
show Found.Pnp20.selR (Nat.beq i 13) [] [] = []
cases Nat.beq i 13 with
| false => rfl
| true => rfl
theorem hi_init (a : List Bool) : Hi (inpR a) [] := by
intro i
rw [inpR_nil, inpR_other a (i + 32) (hi_lt 13 i (lt32 13 rfl))]
theorem hi_keep (x y : Nat -> List Bool) (w : List Bool) (A B : Nat) (hA : A < 32) (hB : B < 32)
(fr : forall i, Nat.beq i A = false -> Nat.beq i B = false -> y i = x i) (h : Hi x w) : Hi y w :=
fun i => (fr (i + 32) (hi_lt A i hA) (hi_lt B i hB)).trans (h i)
theorem hi_set (x y : Nat -> List Bool) (w d : List Bool)
(fr : forall i, Nat.beq i 13 = false -> y (i + 32) = x (i + 32)) (hd : y 45 = d) (h : Hi x w) : Hi y d := by
intro i
cases e : Nat.beq i 13 with
| true =>
have e' := Found.Pnp2.beq_eq i 13 e
rw [e', inpR_13]
exact hd
| false =>
rw [fr i e, h i, inpR_other w i e, inpR_other d i e]
theorem e45 (i : Nat) (e : Nat.beq i 13 = false) : Nat.beq (i + 32) 45 = false :=
(Found.Pnp56.beq_add_r i 13 32).trans e
/-! ## arithmetic for the bound -/
def Bn (n : Nat) : Nat := n + n + n + n + 4
theorem q4 (m n : Nat) (h : m <= n) : m + m + m + m + 4 <= Bn n :=
Nat.add_le_add_right (Nat.add_le_add (Nat.add_le_add (Nat.add_le_add h h) h) h) 4
theorem bA (m n : Nat) (h : m <= n) : m + m + 2 <= Bn n :=
Nat.le_trans (Nat.add_le_add (Nat.le_trans (Nat.le_add_right (m + m) m) (Nat.le_add_right (m + m + m) m))
(Nat.le_add_left 2 2)) (q4 m n h)
theorem three (m : Nat) : 3 * m = m + m + m := by
rw [Nat.mul_comm]
show 0 + m + m + m = m + m + m
rw [Nat.zero_add]
theorem four (m : Nat) : 4 * m = m + m + m + m := by
rw [Nat.mul_comm]
show 0 + m + m + m + m = m + m + m + m
rw [Nat.zero_add]
theorem bB (m n : Nat) (h : m <= n) : 3 * m + 1 <= Bn n := by
rw [three]
exact Nat.le_trans (Nat.add_le_add (Nat.le_add_right (m + m + m) m) (Nat.le_add_left 1 3)) (q4 m n h)
theorem bC (m n : Nat) (h : m <= n) : 4 * m + 1 <= Bn n := by
rw [four]
exact Nat.le_trans (Nat.add_le_add_left (Nat.le_add_left 1 3) _) (q4 m n h)
theorem bD (m n : Nat) (h : m <= n) : m + m + 4 <= Bn n :=
Nat.le_trans (Nat.add_le_add_right (Nat.le_trans (Nat.le_add_right (m + m) m) (Nat.le_add_right (m + m + m) m)) 4)
(q4 m n h)
theorem bE (n : Nat) : 1 <= Bn n := Nat.le_trans (Nat.le_add_left 1 3) (Nat.le_add_left 4 _)
theorem acc (x y k B C : Nat) (h1 : x <= k * B + C) (h2 : y <= B) : x + y <= (k + 1) * B + C := by
rw [Nat.succ_mul, Nat.add_right_comm]
exact Nat.add_le_add h1 h2
theorem acc1 (y B : Nat) (h : y <= B) : y <= 1 * B + 0 := by
rw [Nat.one_mul]; exact h
/-! ## lengths -/
theorem revApp_len : forall (l m : List Bool), (revApp l m).length = l.length + m.length
| [], m => (Nat.zero_add m.length).symm
| b :: l, m => by
show (revApp l (b :: m)).length = l.length + 1 + m.length
rw [revApp_len l (b :: m), Nat.add_right_comm]
rfl
theorem unG_len : forall (S acc : List Bool), (unG S acc).1.length + (unG S acc).2.length <= S.length + acc.length
| [], acc => Nat.le_of_eq (Nat.add_comm acc.length 0)
| false :: [], acc => Nat.le_trans (Nat.le_of_eq (Nat.add_comm acc.length 0)) (Nat.add_le_add_right (Nat.zero_le 1) _)
| false :: b :: r, acc => by
have h := unG_len r (b :: acc)
refine Nat.le_trans h ?_
show r.length + (acc.length + 1) <= r.length + 1 + 1 + acc.length
rw [Nat.add_comm acc.length 1, ← Nat.add_assoc, Nat.add_right_comm r.length 1 1, Nat.add_assoc (r.length + 1) 1 acc.length]
exact Nat.add_le_add_left (Nat.le_add_left acc.length 1) (r.length + 1)
| true :: [], acc => Nat.le_trans (Nat.le_of_eq (Nat.add_comm acc.length 0)) (Nat.add_le_add_right (Nat.zero_le 1) _)
| true :: _ :: r, acc => by
show acc.length + r.length <= r.length + 1 + 1 + acc.length
rw [Nat.add_comm acc.length r.length]
exact Nat.add_le_add_right (Nat.le_trans (Nat.le_add_right r.length 1) (Nat.le_add_right _ 1)) _
theorem lc_okD : forall (t u d : List Bool), (lc t u d).1 = true -> (lc t u d).2.2.2 = revApp t d
| [], _, _, _ => rfl
| _ :: _, [], _, h => Bool.noConfusion h
| b :: t, _ :: u, d, h => lc_okD t u (b :: d) h
theorem le_l (a b c : Nat) (h : a + b <= c) : a <= c := Nat.le_trans (Nat.le_add_right a b) h
theorem le_r (a b c : Nat) (h : a + b <= c) : b <= c := Nat.le_trans (Nat.le_add_left b a) h
/-! ## the run -/
def vE (eF : PE) : PE :=
.add (.mul (.c 10) (.add (.add (.add (.add .x .x) .x) .x) (.c 4))) eF
theorem v_run (F : List Ins) (eF : PE) (f : List Bool -> List Bool) (hF : CompRM F eF f) (a : List Bool) :
Exists fun N => Exists fun y => N <= pe (vE eF) a.length /\ Runs (vP F) N 0 (inpR a) (vP F).length y /\
outBit (y 16) = vF f a := by
have hf0 := frag_self (vP F)
have g1 := fragHT (vP F) 0 (unencP 13 17) (t2 F) hf0
have g2 := fragHT (vP F) 7 (move 17 18) (t3 F) g1.2
have g3 := fragHT (vP F) 12 (unencP 18 19) (t4 F) g2.2
have g4 := fragHT (vP F) 19 (unencP 18 20) (t5 F) g3.2
have g5 := fragHT (vP F) 26 (move 13 21) (t6 F) g4.2
have g6 := fragHT (vP F) 31 (lchkP 21 18 45 (25 + F.length)) (t7 F) g5.2
have g7 := fragHT (vP F) 38 (move 20 45) (t8 F) g6.2
have g8 := fragHT (vP F) 43 (relocP 32 F) t9 g7.2
have g8' : Frag (vP F) (43 + F.length) t9 := by
have e := g8.2
rw [relocP_len] at e
exact e
have g9 := fragHT (vP F) (43 + F.length) (move 19 22) t10 g8'
have g10 := fragHT (vP F) (43 + F.length + 5) (eqP 22 48 16) t11 g9.2
have g11 := fragHT (vP F) (43 + F.length + 5 + 7) [.jmp 2] [.push 16 false] g10.2
have hlen := vP_len F
-- A: UNENC 13 -> 17
cases unenc_spec (vP F) 0 13 17 (unAt_of_frag _ _ _ _ g1.1) rfl a [] (inpR a) (inpR_13 a) rfl with
| intro yA hA =>
-- B: MOVE 17 -> 18
cases move_spec (vP F) 7 17 18 g2.1 rfl (unG a []).1 [] yA hA.2.2.1 (hA.2.2.2 18 rfl rfl) with
| intro yB hB =>
-- C: UNENC 18 -> 19
cases unenc_spec (vP F) 12 18 19 (unAt_of_frag _ _ _ _ g3.1) rfl (revApp (unG a []).1 []) [] yB hB.2.2.1
((hB.2.2.2 19 rfl rfl).trans (hA.2.2.2 19 rfl rfl)) with
| intro yC hC =>
-- D: UNENC 18 -> 20
cases unenc_spec (vP F) 19 18 20 (unAt_of_frag _ _ _ _ g4.1) rfl (unG (revApp (unG a []).1 []) []).2 [] yC hC.2.1
((hC.2.2.2 20 rfl rfl).trans ((hB.2.2.2 20 rfl rfl).trans (hA.2.2.2 20 rfl rfl))) with
| intro yD hD =>
-- E: MOVE 13 -> 21
cases move_spec (vP F) 26 13 21 g5.1 rfl (unG a []).2 [] yD
((hD.2.2.2 13 rfl rfl).trans ((hC.2.2.2 13 rfl rfl).trans ((hB.2.2.2 13 rfl rfl).trans hA.2.1)))
((hD.2.2.2 21 rfl rfl).trans ((hC.2.2.2 21 rfl rfl).trans ((hB.2.2.2 21 rfl rfl).trans (hA.2.2.2 21 rfl rfl)))) with
| intro yE hE =>
-- F': LCHK 21 18 45
cases lchk_spec (vP F) 31 21 18 45 (25 + F.length) (lcAt_of_frag _ _ _ _ _ _ g6.1) rfl rfl rfl
(revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 [] yE
(hE.2.2.1)
((hE.2.2.2 18 rfl rfl).trans hD.2.1)
((hE.2.2.2 45 rfl rfl).trans ((hD.2.2.2 45 rfl rfl).trans ((hC.2.2.2 45 rfl rfl).trans
((hB.2.2.2 45 rfl rfl).trans (hA.2.2.2 45 rfl rfl))))) with
| intro yL hL =>
-- the lengths
have l1 := unG_len a []
have l2 := unG_len (revApp (unG a []).1 []) []
have l3 := unG_len (unG (revApp (unG a []).1 []) []).2 []
have ly : (revApp (unG a []).1 []).length = (unG a []).1.length := revApp_len _ []
have lt : (revApp (unG a []).2 []).length = (unG a []).2.length := revApp_len _ []
have m1 : (unG a []).1.length <= a.length := le_l _ _ _ l1
have m2 : (unG a []).2.length <= a.length := le_r _ _ _ l1
have myv : (revApp (unG a []).1 []).length <= a.length := by rw [ly]; exact m1
have m3 : (unG (revApp (unG a []).1 []) []).2.length <= a.length := Nat.le_trans (le_r _ _ _ l2) myv
have m4 : (unG (revApp (unG a []).1 []) []).1.length <= a.length := Nat.le_trans (le_l _ _ _ l2) myv
have m5 : (unG (unG (revApp (unG a []).1 []) []).2 []).1.length <= a.length := Nat.le_trans (le_l _ _ _ l3) m3
have mt : (revApp (unG a []).2 []).length <= a.length := by rw [lt]; exact m2
-- the steps before the check
have p5 : unN a + (3 * (unG a []).1.length + 1) + unN (revApp (unG a []).1 []) +
unN (unG (revApp (unG a []).1 []) []).2 + (3 * (unG a []).2.length + 1) +
lcN (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 <= 6 * Bn a.length + 0 :=
acc _ _ 5 _ 0 (acc _ _ 4 _ 0 (acc _ _ 3 _ 0 (acc _ _ 2 _ 0 (acc _ _ 1 _ 0
(acc1 _ _ (Nat.le_trans (unN_le a) (bA a.length a.length (Nat.le_refl _))))
(bB _ _ m1))
(Nat.le_trans (unN_le _) (bA _ _ myv)))
(Nat.le_trans (unN_le _) (bA _ _ m3)))
(bB _ _ m2))
(Nat.le_trans (lcN_le _ _) (bC _ _ mt))
have s5 := runs_seq (vP F) _ _ 0 26 31 (inpR a) yD yE
(runs_seq (vP F) _ _ 0 19 26 (inpR a) yC yD
(runs_seq (vP F) _ _ 0 12 19 (inpR a) yB yC
(runs_seq (vP F) _ _ 0 7 12 (inpR a) yA yB hA.1 hB.1) hC.1) hD.1) hE.1
have hlr := hL.1
-- the bit of the check
cases hok : (lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).1 with
| false =>
rw [hok] at hlr
have hlr' : Runs (vP F) (lcN (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2) 31 yE (43 + F.length + 5 + 7 + 1) yL := by
rw [(ar1 F.length).symm]; exact hlr
have sp := run1_push (vP F) (43 + F.length + 5 + 7 + 1) 16 false (g11.2 0 _ rfl) yL
have s := runs_seq (vP F) _ 1 0 _ (43 + F.length + 5 + 7 + 2) (inpR a) yL _
(runs_seq (vP F) _ _ 0 31 _ (inpR a) yE yL s5 hlr') sp
rw [hlen.symm] at s
refine Exists.intro _ (Exists.intro _ (And.intro ?_ (And.intro s ?_)))
· refine Nat.le_trans (acc _ _ 6 _ 0 p5 (bE a.length)) ?_
show 7 * Bn a.length + 0 <= 10 * Bn a.length + pe eF a.length
exact Nat.le_trans (Nat.mul_le_mul_right _ (Nat.le_add_left 7 3)) (Nat.le_add_right _ _)
· show outBit (upd yL 16 (false :: yL 16) 16) = vF f a
rw [upd_same]
show false = selB _ _ false
rw [hok]
rfl
| true =>
rw [hok] at hlr
have hd := lc_okD _ _ _ hok
-- G: MOVE 20 -> 45
cases move_spec (vP F) 38 20 45 g7.1 rfl (unG (unG (revApp (unG a []).1 []) []).2 []).1
(lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).2.2.2 yL
((hL.2.2 20 rfl rfl rfl).trans ((hE.2.2.2 20 rfl rfl).trans hD.2.2.1)) hL.2.1 with
| intro yG hG =>
-- the high block
have hiE : Hi yE [] :=
hi_keep yD yE [] 13 21 (lt32 13 rfl) (lt32 21 rfl) hE.2.2.2
(hi_keep yC yD [] 18 20 (lt32 18 rfl) (lt32 20 rfl) hD.2.2.2
(hi_keep yB yC [] 18 19 (lt32 18 rfl) (lt32 19 rfl) hC.2.2.2
(hi_keep yA yB [] 17 18 (lt32 17 rfl) (lt32 18 rfl) hB.2.2.2
(hi_keep (inpR a) yA [] 13 17 (lt32 13 rfl) (lt32 17 rfl) hA.2.2.2 (hi_init a)))))
have hiL : Hi yL _ :=
hi_set yE yL [] _ (fun i e => hL.2.2 (i + 32) (hi_lt 21 i (lt32 21 rfl)) (hi_lt 18 i (lt32 18 rfl)) (e45 i e))
hL.2.1 hiE
have hiG : Hi yG _ :=
hi_set yL yG _ _ (fun i e => hG.2.2.2 (i + 32) (hi_lt 20 i (lt32 20 rfl)) (e45 i e)) hG.2.2.1 hiL
-- H: call F
cases hF (revApp (unG (unG (revApp (unG a []).1 []) []).2 []).1
(lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).2.2.2) with
| intro NF hNF =>
cases hNF with
| intro yF hyF =>
cases call_run (vP F) 43 32 F g8.1 NF _ yF yG yG (And.intro hiG (fun _ _ => rfl)) hyF.2.1 hyF.2.2.1 with
| intro z hz =>
-- I: MOVE 19 -> 22
have z19 : z 19 = (unG (revApp (unG a []).1 []) []).1 :=
(hz.2.2 19 (lt32 19 rfl)).trans ((hG.2.2.2 19 rfl rfl).trans ((hL.2.2 19 rfl rfl rfl).trans
((hE.2.2.2 19 rfl rfl).trans ((hD.2.2.2 19 rfl rfl).trans hC.2.2.1))))
have z22 : z 22 = [] :=
(hz.2.2 22 (lt32 22 rfl)).trans ((hG.2.2.2 22 rfl rfl).trans ((hL.2.2 22 rfl rfl rfl).trans
((hE.2.2.2 22 rfl rfl).trans ((hD.2.2.2 22 rfl rfl).trans ((hC.2.2.2 22 rfl rfl).trans
((hB.2.2.2 22 rfl rfl).trans (hA.2.2.2 22 rfl rfl)))))))
have z16 : z 16 = [] :=
(hz.2.2 16 (lt32 16 rfl)).trans ((hG.2.2.2 16 rfl rfl).trans ((hL.2.2 16 rfl rfl rfl).trans
((hE.2.2.2 16 rfl rfl).trans ((hD.2.2.2 16 rfl rfl).trans ((hC.2.2.2 16 rfl rfl).trans
((hB.2.2.2 16 rfl rfl).trans (hA.2.2.2 16 rfl rfl)))))))
cases move_spec (vP F) (43 + F.length) 19 22 g9.1 rfl _ [] z z19 z22 with
| intro yI hI =>
-- J: EQ 22 48 16
have i48 : yI 48 = f (revApp (unG (unG (revApp (unG a []).1 []) []).2 []).1
(lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).2.2.2) :=
(hI.2.2.2 48 rfl rfl).trans ((hz.2.1 16).trans hyF.2.2.2)
cases eq_run (vP F) (43 + F.length + 5) 22 48 16 (eqAt_of_frag _ _ _ _ _ g10.1) rfl rfl rfl _ _ yI hI.2.2.1 i48 with
| intro Ne hNe =>
cases hNe with
| intro yJ hJ =>
have sj := run1_jmp (vP F) (43 + F.length + 5 + 7) (43 + F.length + 5 + 7 + 2) (g11.1 0 _ rfl) yJ
have hcall : Runs (vP F) NF 43 yG (43 + F.length) z := hz.1
have s := runs_seq (vP F) _ 1 0 _ (43 + F.length + 5 + 7 + 2) (inpR a) yJ yJ
(runs_seq (vP F) _ Ne 0 _ (43 + F.length + 5 + 7) (inpR a) yI yJ
(runs_seq (vP F) _ _ 0 _ (43 + F.length + 5) (inpR a) z yI
(runs_seq (vP F) _ NF 0 43 (43 + F.length) (inpR a) yG z
(runs_seq (vP F) _ _ 0 38 43 (inpR a) yL yG
(runs_seq (vP F) _ _ 0 31 38 (inpR a) yE yL s5 hlr) hG.1) hcall) hI.1) hJ.2.1) sj
-- the length of the input of F
have mw : (revApp (unG (unG (revApp (unG a []).1 []) []).2 []).1
(lc (revApp (unG a []).2 []) (unG (unG (revApp (unG a []).1 []) []).2 []).2 []).2.2.2).length <= a.length := by
rw [revApp_len, hd, revApp_len, lt]
show (unG (unG (revApp (unG a []).1 []) []).2 []).1.length + ((unG a []).2.length + 0) <= a.length
refine Nat.le_trans (Nat.add_le_add_right (Nat.le_trans (le_l _ _ _ l3) (Nat.le_trans (le_r _ _ _ l2) (Nat.le_of_eq ly))) _) ?_
exact l1
rw [hlen.symm] at s
refine Exists.intro _ (Exists.intro _ (And.intro ?_ (And.intro s ?_)))
· refine acc _ _ 9 _ _ (acc _ _ 8 _ _ (acc _ _ 7 _ _ ?_ (bB _ _ m4)) ?_) (bE a.length)
· exact Nat.add_le_add (acc _ _ 6 _ 0 p5 (bB _ _ m5)) (Nat.le_trans hyF.1 (pe_mono _ _ mw eF))
· have hr : (revApp (unG (revApp (unG a []).1 []) []).1 []).length <= a.length := by
rw [revApp_len]; exact m4
exact Nat.le_trans hJ.1 (bD _ _ hr)
· rw [hJ.2.2.1, hI.2.2.2 16 rfl rfl, z16]
show beqL (revApp (unG (revApp (unG a []).1 []) []).1 []) _ = selB _ _ false
rw [hok]
rfl
end Found.Pnp74
#print axioms Found.Pnp74.fragHT
#print axioms Found.Pnp74.appI_len
#print axioms Found.Pnp74.mapI_len
#print axioms Found.Pnp74.seqI_len
#print axioms Found.Pnp74.vP_len
#print axioms Found.Pnp74.ar1
#print axioms Found.Pnp74.unenc_spec
#print axioms Found.Pnp74.move_spec
#print axioms Found.Pnp74.lchk_spec
#print axioms Found.Pnp74.lt32
#print axioms Found.Pnp74.hi_lt
#print axioms Found.Pnp74.inpR_nil
#print axioms Found.Pnp74.hi_init
#print axioms Found.Pnp74.hi_keep
#print axioms Found.Pnp74.hi_set
#print axioms Found.Pnp74.e45
#print axioms Found.Pnp74.q4
#print axioms Found.Pnp74.bA
#print axioms Found.Pnp74.three
#print axioms Found.Pnp74.four
#print axioms Found.Pnp74.bB
#print axioms Found.Pnp74.bC
#print axioms Found.Pnp74.bD
#print axioms Found.Pnp74.bE
#print axioms Found.Pnp74.acc
#print axioms Found.Pnp74.acc1
#print axioms Found.Pnp74.revApp_len
#print axioms Found.Pnp74.unG_len
#print axioms Found.Pnp74.lc_okD
#print axioms Found.Pnp74.le_l
#print axioms Found.Pnp74.le_r
#print axioms Found.Pnp74.v_run
lean_all/found/Pnp75.lean
/-
T330 piece 75. found/Pnp75 -- what the verifier V_f decides, and that it is in P on the
register machine (toward search-to-decision on the register machine, open lemma O5rm).
On a well-formed input enc (enc z (enc p (tr k))) s (tr k: k ones, Pnp23), vF f (Pnp74)
accepts exactly when |s| <= k and f (p ++ s) = z. Proved:
* revApp_rr, revApp_nil2: reversing twice;
* vF_yes: if |s| <= k then vF f (enc (enc z (enc p (tr k))) s) = beqL z (f (p ++ s));
* vF_no: if k < |s| then it is false;
* v_inP: for every F computing f in polynomial time, vF f is in P_RM (Owf4.InPrm),
with Inside from Pnp72.runs_first.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp74
namespace Found.Pnp75
open Found.Pnp3 (PE pe)
open Found.Pnp20 (Ins revApp)
open Found.Pnp4 (enc)
open Found.Pnp23 (tr tr_len app_nil'')
open Found.Pnp72 (unG unG_enc runs_first)
open Found.Pnp73 (lc lc_le lc_gt)
open Found.Pnp74 (vP vF vE v_run selB revApp_len)
open Found.Owf1 (beqL)
open Found.Owf4 (CompRM DecRM InPrm)
theorem revApp_rr : forall (l m n : List Bool), revApp (revApp l m) n = revApp m (l ++ n)
| [], _, _ => rfl
| b :: l, m, n => revApp_rr l (b :: m) n
theorem revApp_nil2 (l : List Bool) : revApp (revApp l []) [] = l := by
rw [revApp_rr]
exact app_nil'' l
theorem unG1 (x w : List Bool) : (unG (enc x w) []).1 = revApp x [] := by rw [unG_enc]
theorem unG2 (x w : List Bool) : (unG (enc x w) []).2 = w := by rw [unG_enc]
theorem lenT (s : List Bool) (k : Nat) :
(revApp s []).length <= (tr k).length <-> s.length <= k := by
rw [revApp_len, tr_len]
exact Iff.intro (fun h => h) (fun h => h)
theorem vF_yes (f : List Bool -> List Bool) (z p s : List Bool) (k : Nat) (h : s.length <= k) :
vF f (enc (enc z (enc p (tr k))) s) = beqL z (f (p ++ s)) := by
have hl : (revApp s []).length <= (tr k).length := (lenT s k).2 h
have c := lc_le (revApp s []) (tr k) [] hl
unfold vF
rw [unG1, unG2, revApp_nil2, unG1, unG2, unG1, unG2, c.1, c.2, revApp_nil2, revApp_nil2, revApp_rr]
rfl
theorem vF_no (f : List Bool -> List Bool) (z p s : List Bool) (k : Nat) (h : k < s.length) :
vF f (enc (enc z (enc p (tr k))) s) = false := by
have hl : (tr k).length < (revApp s []).length := by
rw [revApp_len, tr_len]; exact h
have c := lc_gt (revApp s []) (tr k) [] hl
unfold vF
rw [unG1, unG2, revApp_nil2, unG1, unG2, unG1, unG2, c]
rfl
theorem v_inP (F : List Ins) (eF : PE) (f : List Bool -> List Bool) (hF : CompRM F eF f) : InPrm (vF f) := by
refine Exists.intro (vP F) (Exists.intro (vE eF) (fun a => ?_))
cases v_run F eF f hF a with
| intro N hN =>
cases hN with
| intro y hy =>
cases runs_first (vP F) N (Found.Pnp59.inpR a) y hy.2.1 with
| intro N' h' =>
exact Exists.intro N' (Exists.intro y (And.intro (Nat.le_trans h'.1 hy.1)
(And.intro h'.2.1 (And.intro h'.2.2 hy.2.2))))
end Found.Pnp75
#print axioms Found.Pnp75.revApp_rr
#print axioms Found.Pnp75.revApp_nil2
#print axioms Found.Pnp75.unG1
#print axioms Found.Pnp75.unG2
#print axioms Found.Pnp75.lenT
#print axioms Found.Pnp75.vF_yes
#print axioms Found.Pnp75.vF_no
#print axioms Found.Pnp75.v_inP
lean_all/found/Pnp76.lean
/-
T330 piece 76. found/Pnp76 -- the search language L_f is in NP on the register machine
(toward search-to-decision on the register machine, open lemma O5rm).
L_f t holds when some certificate w with |w| <= |t| makes the verifier vF f (Pnp74) accept
enc t w; it is written as a Bool function that runs through all bit lists up to |t|
(Pnp8 allBits). Proved:
* anyL_true, anyL_of: a Bool search through a list of lists;
* upTo_true, upTo_of: the search through all lists of length at most n;
* lf_inNP: for every F computing f in polynomial time, L_f is in NP_RM (Owf4.InNPrm),
with certificate bound |w| <= |t| and verifier vF f (Pnp75 v_inP);
* lf_yes, lf_sound: on enc z (enc p (tr k)), L_f holds exactly when some s with |s| <= k
gives f (p ++ s) = z (the certificate bound is met because |s| <= k <= |t|).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp75
namespace Found.Pnp76
open Found.Pnp3 (PE pe)
open Found.Pnp4 (enc dbl)
open Found.Pnp8 (allBits InL allBits_complete allBits_len)
open Found.Pnp20 (Ins)
open Found.Pnp23 (tr tr_len)
open Found.Pnp74 (vF)
open Found.Pnp75 (vF_yes vF_no v_inP)
open Found.Owf1 (beqL)
open Found.Owf4 (CompRM InPrm InNPrm)
def anyL (g : List Bool -> Bool) : List (List Bool) -> Bool
| [] => false
| w :: ws => g w || anyL g ws
def upTo (g : List Bool -> Bool) : Nat -> Bool
| 0 => anyL g (allBits 0)
| n + 1 => upTo g n || anyL g (allBits (n + 1))
theorem or_true_cases (a b : Bool) (h : (a || b) = true) : a = true \/ b = true := by
cases a with
| true => exact Or.inl rfl
| false => exact Or.inr h
theorem or_true_l (a b : Bool) (h : a = true) : (a || b) = true := by rw [h]; rfl
theorem or_true_r (a b : Bool) (h : b = true) : (a || b) = true := by
rw [h]; cases a with
| true => rfl
| false => rfl
theorem anyL_true (g : List Bool -> Bool) : forall ws, anyL g ws = true ->
Exists fun w => InL w ws /\ g w = true
| [], h => Bool.noConfusion h
| w :: ws, h =>
Or.elim (or_true_cases _ _ h) (fun hw => Exists.intro w (And.intro (Or.inl rfl) hw))
(fun hr => match anyL_true g ws hr with
| Exists.intro v hv => Exists.intro v (And.intro (Or.inr hv.1) hv.2))
theorem anyL_of (g : List Bool -> Bool) (w : List Bool) (hw : g w = true) : forall ws, InL w ws -> anyL g ws = true
| [], h => False.elim h
| v :: ws, h =>
Or.elim h (fun e => or_true_l _ _ (by rw [e.symm]; exact hw))
(fun h' => or_true_r _ _ (anyL_of g w hw ws h'))
theorem upTo_true (g : List Bool -> Bool) : forall n, upTo g n = true ->
Exists fun w => w.length <= n /\ g w = true
| 0, h =>
match anyL_true g (allBits 0) h with
| Exists.intro w hw => Exists.intro w (And.intro (Nat.le_of_eq (allBits_len 0 w hw.1)) hw.2)
| n + 1, h =>
Or.elim (or_true_cases _ _ h)
(fun h1 => match upTo_true g n h1 with
| Exists.intro w hw => Exists.intro w (And.intro (Nat.le_succ_of_le hw.1) hw.2))
(fun h2 => match anyL_true g (allBits (n + 1)) h2 with
| Exists.intro w hw => Exists.intro w (And.intro (Nat.le_of_eq (allBits_len (n + 1) w hw.1)) hw.2))
theorem le_zero_eq : forall m : Nat, m <= 0 -> m = 0
| 0, _ => rfl
| _ + 1, h => absurd h (Nat.not_succ_le_zero _)
theorem le_succ_cases : forall (m n : Nat), m <= n + 1 -> m <= n \/ m = n + 1
| 0, _, _ => Or.inl (Nat.zero_le _)
| m + 1, 0, h => Or.inr (congrArg Nat.succ (le_zero_eq m (Nat.le_of_succ_le_succ h)))
| m + 1, n + 1, h =>
Or.elim (le_succ_cases m n (Nat.le_of_succ_le_succ h))
(fun h1 => Or.inl (Nat.succ_le_succ h1)) (fun h2 => Or.inr (congrArg Nat.succ h2))
theorem upTo_of (g : List Bool -> Bool) (w : List Bool) (hw : g w = true) :
forall n, w.length <= n -> upTo g n = true
| 0, h => by
have hc := allBits_complete w
rw [le_zero_eq _ h] at hc
exact anyL_of g w hw _ hc
| n + 1, h =>
Or.elim (le_succ_cases _ _ h)
(fun h1 => or_true_l _ _ (upTo_of g w hw n h1))
(fun h2 => or_true_r _ _ (by
have hc := allBits_complete w
rw [h2] at hc
exact anyL_of g w hw _ hc))
/-- The search language. -/
def Lf (f : List Bool -> List Bool) (t : List Bool) : Bool := upTo (fun w => vF f (enc t w)) t.length
theorem lf_inNP (F : List Ins) (eF : PE) (f : List Bool -> List Bool) (hF : CompRM F eF f) : InNPrm (Lf f) :=
Exists.intro (vF f) (Exists.intro PE.x (And.intro (v_inP F eF f hF) (fun t =>
Iff.intro (fun h => upTo_true _ t.length h)
(fun h => match h with
| Exists.intro w hw => upTo_of _ w hw.2 t.length hw.1))))
theorem app_len : forall (A B : List Bool), (A ++ B).length = A.length + B.length
| [], B => (Nat.zero_add B.length).symm
| _ :: A, B => by
show (A ++ B).length + 1 = A.length + 1 + B.length
rw [app_len A B, Nat.add_right_comm]
theorem len_enc_r (x w : List Bool) : w.length <= (enc x w).length := by
show w.length <= (dbl x ++ (true :: true :: w)).length
rw [app_len]
exact Nat.le_trans (Nat.le_add_right w.length 2) (Nat.le_add_left _ _)
theorem lt_or_le' : forall (k m : Nat), k < m \/ m <= k
| _, 0 => Or.inr (Nat.zero_le _)
| 0, _ + 1 => Or.inl (Nat.succ_le_succ (Nat.zero_le _))
| k + 1, m + 1 =>
Or.elim (lt_or_le' k m) (fun h => Or.inl (Nat.succ_le_succ h)) (fun h => Or.inr (Nat.succ_le_succ h))
/-- Completeness: a short extension s of p with f (p ++ s) = z puts the query in L_f. -/
theorem lf_yes (f : List Bool -> List Bool) (z p s : List Bool) (k : Nat) (hk : s.length <= k)
(he : beqL z (f (p ++ s)) = true) : Lf f (enc z (enc p (tr k))) = true := by
have hl : s.length <= (enc z (enc p (tr k))).length := by
refine Nat.le_trans hk (Nat.le_trans ?_ (len_enc_r z _))
refine Nat.le_trans (Nat.le_of_eq (tr_len k).symm) (len_enc_r p (tr k))
exact upTo_of _ s ((vF_yes f z p s k hk).trans he) _ hl
/-- Soundness: a query in L_f has such an extension. -/
theorem lf_sound (f : List Bool -> List Bool) (z p : List Bool) (k : Nat)
(h : Lf f (enc z (enc p (tr k))) = true) :
Exists fun s => s.length <= k /\ beqL z (f (p ++ s)) = true :=
match upTo_true _ _ h with
| Exists.intro w hw =>
Or.elim (lt_or_le' k w.length)
(fun hlt => by
have e := (vF_no f z p w k hlt).symm.trans hw.2
exact Bool.noConfusion e)
(fun hle => Exists.intro w (And.intro hle ((vF_yes f z p w k hle).symm.trans hw.2)))
end Found.Pnp76
#print axioms Found.Pnp76.or_true_cases
#print axioms Found.Pnp76.or_true_l
#print axioms Found.Pnp76.or_true_r
#print axioms Found.Pnp76.anyL_true
#print axioms Found.Pnp76.anyL_of
#print axioms Found.Pnp76.upTo_true
#print axioms Found.Pnp76.le_zero_eq
#print axioms Found.Pnp76.le_succ_cases
#print axioms Found.Pnp76.upTo_of
#print axioms Found.Pnp76.lf_inNP
#print axioms Found.Pnp76.app_len
#print axioms Found.Pnp76.len_enc_r
#print axioms Found.Pnp76.lt_or_le'
#print axioms Found.Pnp76.lf_yes
#print axioms Found.Pnp76.lf_sound
lean_all/found/Pnp77.lean
/-
T330 piece 77. found/Pnp77 -- registers a program does not name, register growth, and
the CLEAR fragments (toward search-to-decision on the register machine, open lemma O5rm).
To call a decider again and again in one block of registers, the block must be emptied
after every call. Proved:
* run_hi: a run of p keeps every register i >= sumR p (Pnp59: all named registers are
below sumR p);
* len_run: in n steps a register grows by at most n bits;
* clr_run: CLEAR r = [pop r (-> 1, else -> 0)] empties r in |r| + 1 steps;
* clrAll_run: clrAll b n empties registers b .. b + n - 1 within n (M + 1) steps when
each holds at most M bits, ending at o + n and keeping every register outside.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp74
namespace Found.Pnp77
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI step exec popTo run selR)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp59 (insReg sumR insReg_lt)
open Found.Pnp70 (run1_pop_nil run1_pop_cons bsel)
open Found.Pnp74 (seqI fragHT)
/-! ## registers not named -/
theorem step_hi (p : List Ins) (c : Cfg) (i : Nat) (hi : sumR p <= i) : (step p c).regs i = c.regs i := by
show (exec c (nthI p c.pc)).regs i = c.regs i
cases h : nthI p c.pc with
| none => rfl
| some ins =>
have hr := insReg_lt p c.pc ins h
cases ins with
| push r b =>
exact upd_other c.regs r i _ (Found.Pnp56.beq_gt i r (Nat.lt_of_lt_of_le hr hi))
| pop r e z o =>
have hne := Found.Pnp56.beq_gt i r (Nat.lt_of_lt_of_le hr hi)
show (popTo c r e z o (c.regs r)).regs i = c.regs i
cases c.regs r with
| nil => rfl
| cons b t =>
cases b with
| false => exact upd_other c.regs r i t hne
| true => exact upd_other c.regs r i t hne
| jmp l => rfl
theorem run_hi (p : List Ins) (i : Nat) (hi : sumR p <= i) : forall n (c : Cfg), (run p n c).regs i = c.regs i := by
intro n
induction n with
| zero => intro c; rfl
| succ n ih => intro c; exact (ih (step p c)).trans (step_hi p c i hi)
/-! ## growth -/
theorem len_upd_le (x : Nat -> List Bool) (r i : Nat) (v : List Bool) (h : v.length <= (x r).length + 1) :
(upd x r v i).length <= (x i).length + 1 := by
cases e : Nat.beq i r with
| true =>
have e' := Found.Pnp2.beq_eq i r e
rw [e', upd_same]
exact h
| false => rw [upd_other x r i v e]; exact Nat.le_succ _
theorem len_step (p : List Ins) (c : Cfg) (i : Nat) : ((step p c).regs i).length <= (c.regs i).length + 1 := by
show ((exec c (nthI p c.pc)).regs i).length <= _
cases nthI p c.pc with
| none => exact Nat.le_succ _
| some ins =>
cases ins with
| push r b => exact len_upd_le c.regs r i _ (Nat.le_refl _)
| pop r e z o =>
show ((popTo c r e z o (c.regs r)).regs i).length <= _
have hr : forall t : List Bool, c.regs r = t -> forall b : Bool, forall t', t = b :: t' ->
t'.length <= (c.regs r).length + 1 := fun t ht b t' e => by
rw [ht, e]; exact Nat.le_succ_of_le (Nat.le_succ _)
cases h : c.regs r with
| nil => exact Nat.le_succ _
| cons b t =>
cases b with
| false => exact len_upd_le c.regs r i t (hr _ h false t rfl)
| true => exact len_upd_le c.regs r i t (hr _ h true t rfl)
| jmp l => exact Nat.le_succ _
theorem len_run (p : List Ins) (i : Nat) : forall n (c : Cfg), ((run p n c).regs i).length <= (c.regs i).length + n := by
intro n
induction n with
| zero => intro c; exact Nat.le_refl _
| succ n ih =>
intro c
refine Nat.le_trans (ih (step p c)) ?_
rw [Nat.add_comm n 1, ← Nat.add_assoc]
exact Nat.add_le_add_right (len_step p c i) n
/-! ## CLEAR -/
def clr (r : Nat) : List Ins := [.pop r 1 0 0]
theorem clr_run (prog : List Ins) (o r : Nat) (hf : Frag prog o (clr r)) :
forall (l : List Bool) (x : Nat -> List Bool), x r = l -> Runs prog (l.length + 1) o x (o + 1) (upd x r [])
| [], x, h => by
have s := run1_pop_nil prog o r (o + 1) o o (hf 0 _ rfl) x h
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
exact (Found.Pnp72.upd_id x r [] h i).symm
| b :: t, x, h => by
have s0 := run1_pop_cons prog o r (o + 1) o o (hf 0 _ rfl) x b t h
have e : bsel b o o = o := by cases b with | false => rfl | true => rfl
rw [e] at s0
have s1 := clr_run prog o r hf t (upd x r t) (upd_same x r t)
have s := runs_seq prog 1 (t.length + 1) o o (o + 1) x _ _ s0 s1
rw [Nat.add_comm 1 (t.length + 1)] at s
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
exact Found.Pnp72.upd_over x r t [] i
def clrAll (b : Nat) : Nat -> List Ins
| 0 => []
| n + 1 => seqI (clr b) (clrAll (b + 1) n)
theorem idx (b j : Nat) : b + 1 + j = b + (j + 1) := by
rw [Nat.add_assoc, Nat.add_comm 1 j]
theorem clrAll_run (prog : List Ins) (M : Nat) : forall (n b o : Nat) (x : Nat -> List Bool),
Frag prog o (clrAll b n) -> (forall j, j < n -> (x (b + j)).length <= M) ->
Exists fun N => Exists fun y => N <= n * (M + 1) /\ Runs prog N o x (o + n) y /\
(forall j, j < n -> y (b + j) = []) /\ (forall i, (i < b \/ b + n <= i) -> y i = x i) := by
intro n
induction n with
| zero =>
intro b o x _ _
refine Exists.intro 0 (Exists.intro x (And.intro (Nat.zero_le _) (And.intro (And.intro rfl (fun _ => rfl))
(And.intro (fun j hj => absurd hj (Nat.not_lt_zero j)) (fun _ _ => rfl)))))
| succ n ih =>
intro b o x hf hM
have g := fragHT prog o (clr b) (clrAll (b + 1) n) hf
have s0 := clr_run prog o b g.1 (x b) x rfl
have hM' : forall j, j < n -> (upd x b [] (b + 1 + j)).length <= M := by
intro j hj
have hne : Nat.beq (b + 1 + j) b = false :=
Found.Pnp56.beq_gt _ b (Nat.lt_of_lt_of_le (Nat.lt_succ_self b) (Nat.le_add_right _ j))
rw [upd_other x b _ [] hne, idx]
exact hM (j + 1) (Nat.succ_lt_succ hj)
cases ih (b + 1) (o + 1) (upd x b []) g.2 hM' with
| intro N hN =>
cases hN with
| intro y hy =>
have s := runs_seq prog _ N o (o + 1) (o + 1 + n) x _ y s0 hy.2.1
have eo : o + 1 + n = o + (n + 1) := idx o n
rw [eo] at s
refine Exists.intro _ (Exists.intro y (And.intro ?_ (And.intro s (And.intro ?_ ?_))))
· rw [Nat.succ_mul, Nat.add_comm (n * (M + 1)) (M + 1)]
exact Nat.add_le_add (Nat.succ_le_succ (hM 0 (Nat.zero_lt_succ n))) hy.1
· intro j hj
cases j with
| zero =>
refine (hy.2.2.2 b (Or.inl (Nat.lt_succ_self b))).trans ?_
exact upd_same x b []
| succ j =>
rw [(idx b j).symm]
exact hy.2.2.1 j (Nat.lt_of_succ_lt_succ hj)
· intro i hi
have hne : Nat.beq i b = false := by
cases hi with
| inl h => exact Found.Pnp56.beq_lt i b h
| inr h => exact Found.Pnp56.beq_gt i b (Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le (Nat.lt_succ_self b)
(Nat.le_add_right (b + 1) n)) (Nat.le_trans (Nat.le_of_eq (idx b n)) h))
have hi' : i < b + 1 \/ b + 1 + n <= i := by
cases hi with
| inl h => exact Or.inl (Nat.lt_succ_of_lt h)
| inr h => exact Or.inr (Nat.le_trans (Nat.le_of_eq (idx b n)) h)
rw [hy.2.2.2 i hi']
exact upd_other x b i [] hne
end Found.Pnp77
#print axioms Found.Pnp77.step_hi
#print axioms Found.Pnp77.run_hi
#print axioms Found.Pnp77.len_upd_le
#print axioms Found.Pnp77.len_step
#print axioms Found.Pnp77.len_run
#print axioms Found.Pnp77.clr_run
#print axioms Found.Pnp77.idx
#print axioms Found.Pnp77.clrAll_run
lean_all/found/Pnp78.lean
/-
T332 piece (T330 file series) 78. found/Pnp78 -- the COPY and DCOPY fragments: copying a
register onto another while keeping it (toward search-to-decision on the register
machine, open lemma O5rm).
COPY A Q T pops A, pushing every bit on Q and on T (T is moved back to A afterwards by
MOVE). DCOPY A Q T does the same but pushes b and then false on Q, so that copying the
reverse of p puts dbl p (Pnp4) in front of Q. Layouts (offsets from o):
COPY: 0: pop A (empty -> 7, 0 -> 1, 1 -> 4) 1: push Q false 2: push T false 3: jmp 0
4: push Q true 5: push T true 6: jmp 0 end 7
DCOPY: 0: pop A (empty -> 9, 0 -> 1, 1 -> 5) 1: push Q false 2: push Q false
3: push T false 4: jmp 0 5: push Q true 6: push Q false 7: push T true
8: jmp 0 end 9
Proved:
* copy_run: 4 |a| + 1 steps; A = [], Q = revApp a q, T = revApp a t, others kept;
* dcopy_run: 5 |a| + 1 steps; A = [], Q = dblRev a q, T = revApp a t, others kept;
* dblRev_rev: dblRev (revApp p []) q = dbl p ++ q.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp77
namespace Found.Pnp78
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI revApp)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp70 (run1_push run1_jmp run1_pop_nil run1_pop_cons nsym bsel)
open Found.Pnp4 (dbl)
def copyP (A Q T : Nat) : List Ins :=
[.pop A 7 1 4, .push Q false, .push T false, .jmp 0, .push Q true, .push T true, .jmp 0]
def dcopyP (A Q T : Nat) : List Ins :=
[.pop A 9 1 5, .push Q false, .push Q false, .push T false, .jmp 0,
.push Q true, .push Q false, .push T true, .jmp 0]
def dblRev : List Bool -> List Bool -> List Bool
| [], q => q
| b :: a, q => dblRev a (false :: b :: q)
theorem dblRev_rev : forall (p q : List Bool), dblRev (revApp p []) q = dbl p ++ q := by
have gen : forall (p m q : List Bool), dblRev (revApp p m) q = dblRev m (dbl p ++ q) := by
intro p
induction p with
| nil => intro m q; rfl
| cons b p ih => intro m q; exact ih (b :: m) q
intro p q
exact gen p [] q
/-- Three registers set: A, Q, T. -/
def set3 (x : Nat -> List Bool) (A Q T : Nat) (a q t : List Bool) : Nat -> List Bool :=
upd (upd (upd x A a) Q q) T t
theorem set3_read (x : Nat -> List Bool) (A Q T : Nat) (a q t : List Bool)
(hAQ : Nat.beq A Q = false) (hAT : Nat.beq A T = false) (hQT : Nat.beq Q T = false) :
set3 x A Q T a q t A = a /\ set3 x A Q T a q t Q = q /\ set3 x A Q T a q t T = t /\
(forall i, Nat.beq i A = false -> Nat.beq i Q = false -> Nat.beq i T = false -> set3 x A Q T a q t i = x i) := by
refine And.intro ?_ (And.intro ?_ (And.intro (upd_same _ T t) ?_))
· show upd (upd (upd x A a) Q q) T t A = a
rw [upd_other _ T A t hAT, upd_other _ Q A q hAQ, upd_same]
· show upd (upd (upd x A a) Q q) T t Q = q
rw [upd_other _ T Q t hQT, upd_same]
· intro i h1 h2 h3
show upd (upd (upd x A a) Q q) T t i = x i
rw [upd_other _ T i t h3, upd_other _ Q i q h2, upd_other _ A i a h1]
theorem four_step (n : Nat) : 4 + (4 * n + 1) = 4 * (n + 1) + 1 := by
rw [Nat.left_distrib, Nat.mul_one, Nat.add_comm 4 (4 * n + 1), Nat.add_right_comm]
theorem five_step (n : Nat) : 5 + (5 * n + 1) = 5 * (n + 1) + 1 := by
rw [Nat.left_distrib, Nat.mul_one, Nat.add_comm 5 (5 * n + 1), Nat.add_right_comm]
theorem copy_run (prog : List Ins) (o A Q T : Nat) (hf : Frag prog o (copyP A Q T))
(hAQ : Nat.beq A Q = false) (hAT : Nat.beq A T = false) (hQT : Nat.beq Q T = false) :
forall (a q t : List Bool) (x : Nat -> List Bool), x A = a -> x Q = q -> x T = t ->
Exists fun y => Runs prog (4 * a.length + 1) o x (o + 7) y /\ y A = [] /\ y Q = revApp a q /\
y T = revApp a t /\
(forall i, Nat.beq i A = false -> Nat.beq i Q = false -> Nat.beq i T = false -> y i = x i)
| [], q, t, x, ha, hq, ht => by
have s := run1_pop_nil prog o A (o + 7) (o + 1) (o + 4) (hf 0 _ rfl) x ha
exact Exists.intro x (And.intro s (And.intro ha (And.intro hq (And.intro ht (fun _ _ _ _ => rfl)))))
| b :: a, q, t, x, ha, hq, ht => by
have s0 := run1_pop_cons prog o A (o + 7) (o + 1) (o + 4) (hf 0 _ rfl) x b a ha
have hq1 : upd x A a Q = q := by rw [upd_other x A Q a (nsym A Q hAQ)]; exact hq
have hstep : Runs prog 4 o x o (set3 x A Q T a (b :: q) (b :: t)) := by
have ht2 : upd (upd x A a) Q (b :: q) T = t := by
rw [upd_other _ Q T _ (nsym Q T hQT), upd_other x A T a (nsym A T hAT)]; exact ht
cases b with
| false =>
have s1 := run1_push prog (o + 1) Q false (hf 1 _ rfl) (upd x A a)
rw [hq1] at s1
have s2 := run1_push prog (o + 2) T false (hf 2 _ rfl) (upd (upd x A a) Q (false :: q))
rw [ht2] at s2
have s := runs_seq prog 3 1 o (o + 3) o x _ _
(runs_seq prog 2 1 o (o + 2) (o + 3) x _ _ (runs_seq prog 1 1 o (o + 1) (o + 2) x _ _ s0 s1) s2)
(run1_jmp prog (o + 3) o (hf 3 _ rfl) _)
exact s
| true =>
have s1 := run1_push prog (o + 4) Q true (hf 4 _ rfl) (upd x A a)
rw [hq1] at s1
have s2 := run1_push prog (o + 5) T true (hf 5 _ rfl) (upd (upd x A a) Q (true :: q))
rw [ht2] at s2
have s := runs_seq prog 3 1 o (o + 6) o x _ _
(runs_seq prog 2 1 o (o + 5) (o + 6) x _ _ (runs_seq prog 1 1 o (o + 4) (o + 5) x _ _ s0 s1) s2)
(run1_jmp prog (o + 6) o (hf 6 _ rfl) _)
exact s
have rd := set3_read x A Q T a (b :: q) (b :: t) hAQ hAT hQT
cases copy_run prog o A Q T hf hAQ hAT hQT a (b :: q) (b :: t) _ rd.1 rd.2.1 rd.2.2.1 with
| intro y hy =>
have s := runs_seq prog 4 (4 * a.length + 1) o o (o + 7) x _ y hstep hy.1
rw [four_step] at s
exact Exists.intro y (And.intro s (And.intro hy.2.1 (And.intro hy.2.2.1 (And.intro hy.2.2.2.1
(fun i h1 h2 h3 => (hy.2.2.2.2 i h1 h2 h3).trans (rd.2.2.2 i h1 h2 h3))))))
theorem dcopy_run (prog : List Ins) (o A Q T : Nat) (hf : Frag prog o (dcopyP A Q T))
(hAQ : Nat.beq A Q = false) (hAT : Nat.beq A T = false) (hQT : Nat.beq Q T = false) :
forall (a q t : List Bool) (x : Nat -> List Bool), x A = a -> x Q = q -> x T = t ->
Exists fun y => Runs prog (5 * a.length + 1) o x (o + 9) y /\ y A = [] /\ y Q = dblRev a q /\
y T = revApp a t /\
(forall i, Nat.beq i A = false -> Nat.beq i Q = false -> Nat.beq i T = false -> y i = x i)
| [], q, t, x, ha, hq, ht => by
have s := run1_pop_nil prog o A (o + 9) (o + 1) (o + 5) (hf 0 _ rfl) x ha
exact Exists.intro x (And.intro s (And.intro ha (And.intro hq (And.intro ht (fun _ _ _ _ => rfl)))))
| b :: a, q, t, x, ha, hq, ht => by
have s0 := run1_pop_cons prog o A (o + 9) (o + 1) (o + 5) (hf 0 _ rfl) x b a ha
have hq1 : upd x A a Q = q := by rw [upd_other x A Q a (nsym A Q hAQ)]; exact hq
have hstep : Runs prog 5 o x o (set3 x A Q T a (false :: b :: q) (b :: t)) := by
have ht3 : forall v : List Bool, upd (upd x A a) Q v T = t := fun v => by
rw [upd_other _ Q T _ (nsym Q T hQT), upd_other x A T a (nsym A T hAT)]; exact ht
cases b with
| false =>
have s1 := run1_push prog (o + 1) Q false (hf 1 _ rfl) (upd x A a)
rw [hq1] at s1
have s2 := run1_push prog (o + 2) Q false (hf 2 _ rfl) (upd (upd x A a) Q (false :: q))
rw [upd_same] at s2
have s3 := run1_push prog (o + 3) T false (hf 3 _ rfl) (upd (upd (upd x A a) Q (false :: q)) Q (false :: false :: q))
have e3 : upd (upd (upd x A a) Q (false :: q)) Q (false :: false :: q) T = t := by
rw [upd_other _ Q T _ (nsym Q T hQT)]; exact ht3 _
rw [e3] at s3
have s := runs_seq prog 4 1 o (o + 4) o x _ _
(runs_seq prog 3 1 o (o + 3) (o + 4) x _ _
(runs_seq prog 2 1 o (o + 2) (o + 3) x _ _ (runs_seq prog 1 1 o (o + 1) (o + 2) x _ _ s0 s1) s2) s3)
(run1_jmp prog (o + 4) o (hf 4 _ rfl) _)
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show _ = upd (upd (upd x A a) Q (false :: false :: q)) T (false :: t) i
exact Found.Pnp20.upd_eqv _ _ (Found.Pnp72.upd_over (upd x A a) Q _ _) T _ i
| true =>
have s1 := run1_push prog (o + 5) Q true (hf 5 _ rfl) (upd x A a)
rw [hq1] at s1
have s2 := run1_push prog (o + 6) Q false (hf 6 _ rfl) (upd (upd x A a) Q (true :: q))
rw [upd_same] at s2
have s3 := run1_push prog (o + 7) T true (hf 7 _ rfl) (upd (upd (upd x A a) Q (true :: q)) Q (false :: true :: q))
have e3 : upd (upd (upd x A a) Q (true :: q)) Q (false :: true :: q) T = t := by
rw [upd_other _ Q T _ (nsym Q T hQT)]; exact ht3 _
rw [e3] at s3
have s := runs_seq prog 4 1 o (o + 8) o x _ _
(runs_seq prog 3 1 o (o + 7) (o + 8) x _ _
(runs_seq prog 2 1 o (o + 6) (o + 7) x _ _ (runs_seq prog 1 1 o (o + 5) (o + 6) x _ _ s0 s1) s2) s3)
(run1_jmp prog (o + 8) o (hf 8 _ rfl) _)
refine And.intro s.1 (fun i => (s.2 i).trans ?_)
show _ = upd (upd (upd x A a) Q (false :: true :: q)) T (true :: t) i
exact Found.Pnp20.upd_eqv _ _ (Found.Pnp72.upd_over (upd x A a) Q _ _) T _ i
have rd := set3_read x A Q T a (false :: b :: q) (b :: t) hAQ hAT hQT
cases dcopy_run prog o A Q T hf hAQ hAT hQT a (false :: b :: q) (b :: t) _ rd.1 rd.2.1 rd.2.2.1 with
| intro y hy =>
have s := runs_seq prog 5 (5 * a.length + 1) o o (o + 9) x _ y hstep hy.1
rw [five_step] at s
exact Exists.intro y (And.intro s (And.intro hy.2.1 (And.intro hy.2.2.1 (And.intro hy.2.2.2.1
(fun i h1 h2 h3 => (hy.2.2.2.2 i h1 h2 h3).trans (rd.2.2.2 i h1 h2 h3))))))
end Found.Pnp78
#print axioms Found.Pnp78.dblRev_rev
#print axioms Found.Pnp78.set3_read
#print axioms Found.Pnp78.four_step
#print axioms Found.Pnp78.five_step
#print axioms Found.Pnp78.copy_run
#print axioms Found.Pnp78.dcopy_run
lean_all/found/Pnp79.lean
/-
T332 piece (T330 file series) 79. found/Pnp79 -- building a query for the decider of L_f
(toward search-to-decision on the register machine, open lemma O5rm).
Inverter registers: 17 = k in unary (tr k), 18 = p reversed, 19 = z reversed, 21 = scratch,
45 = the input register of the decider block (13 + 32). bldP builds the query
enc z (enc p (tr k)) (Pnp76 lf_yes, lf_sound) in register 45 and gives 17, 18, 19 back:
COPY 17 45 21; MOVE 21 17; push 45 true (twice); DCOPY 18 45 21; MOVE 21 18;
push 45 true (twice); DCOPY 19 45 21; MOVE 21 19.
Proved:
* bld_run: from o with 17 = tr k, 18 = revApp p [], 19 = revApp z [], 21 = [], 45 = [],
bldP ends at o + 44 within 8 (4 (2 S) + 4) steps (S = k + |p| + |z|) with
45 = enc z (enc p (tr k)), 17, 18, 19, 21 as they were, other registers kept.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp78
import found.Pnp75
namespace Found.Pnp79
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI revApp move)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp23 (tr tr_len revApp_tr app_nil'')
open Found.Pnp4 (dbl enc)
open Found.Pnp70 (run1_push)
open Found.Pnp74 (seqI fragHT move_spec Bn bB bC acc acc1 four revApp_len)
open Found.Pnp75 (revApp_nil2)
open Found.Pnp78 (copyP dcopyP dblRev dblRev_rev copy_run dcopy_run)
def two45 : List Ins := [.push 45 true, .push 45 true]
def bldP : List Ins :=
seqI (copyP 17 45 21) (seqI (move 21 17) (seqI two45 (seqI (dcopyP 18 45 21) (seqI (move 21 18)
(seqI two45 (seqI (dcopyP 19 45 21) (move 21 19)))))))
theorem two_run (prog : List Ins) (o : Nat) (hf : Frag prog o two45) (x : Nat -> List Bool) (q : List Bool)
(hq : x 45 = q) : Exists fun y => Runs prog 2 o x (o + 2) y /\ y 45 = true :: true :: q /\
(forall i, Nat.beq i 45 = false -> y i = x i) := by
have s1 := run1_push prog o 45 true (hf 0 _ rfl) x
have s2 := run1_push prog (o + 1) 45 true (hf 1 _ rfl) (upd x 45 (true :: x 45))
have s := runs_seq prog 1 1 o (o + 1) (o + 2) x _ _ s1 s2
refine Exists.intro _ (And.intro s (And.intro ?_ ?_))
· rw [upd_same, upd_same, hq]
· intro i hi
rw [upd_other _ 45 i _ hi, upd_other _ 45 i _ hi]
theorem five_le (m : Nat) : 5 * m <= 4 * (m + m) := by
rw [Nat.succ_mul 4 m, Nat.left_distrib]
exact Nat.add_le_add_left (by rw [four]; exact Nat.le_add_left m _) _
theorem bF (m S : Nat) (h : m <= S) : 5 * m + 1 <= Bn (S + S) :=
Nat.le_trans (Nat.add_le_add_right (five_le m) 1) (bC (m + m) (S + S) (Nat.add_le_add h h))
theorem b2 (n : Nat) : 2 <= Bn n := Nat.le_trans (Nat.le_add_left 2 2) (Nat.le_add_left 4 _)
theorem leSS (m S : Nat) (h : m <= S) : m <= S + S := Nat.le_trans h (Nat.le_add_right S S)
theorem bld_run (prog : List Ins) (o : Nat) (hf : Frag prog o bldP) (k : Nat) (p z : List Bool)
(x : Nat -> List Bool) (h17 : x 17 = tr k) (h18 : x 18 = revApp p []) (h19 : x 19 = revApp z [])
(h21 : x 21 = []) (h45 : x 45 = []) :
Exists fun N => Exists fun y => N <= 8 * Bn ((k + p.length + z.length) + (k + p.length + z.length)) + 0 /\
Runs prog N o x (o + 44) y /\ y 45 = enc z (enc p (tr k)) /\ y 17 = tr k /\ y 18 = revApp p [] /\
y 19 = revApp z [] /\ y 21 = [] /\
(forall i, Nat.beq i 17 = false -> Nat.beq i 18 = false -> Nat.beq i 19 = false ->
Nat.beq i 21 = false -> Nat.beq i 45 = false -> y i = x i) := by
have g1 := fragHT prog o (copyP 17 45 21) _ hf
have g2 := fragHT prog (o + 7) (move 21 17) _ g1.2
have g3 := fragHT prog (o + 12) two45 _ g2.2
have g4 := fragHT prog (o + 14) (dcopyP 18 45 21) _ g3.2
have g5 := fragHT prog (o + 23) (move 21 18) _ g4.2
have g6 := fragHT prog (o + 28) two45 _ g5.2
have g7 := fragHT prog (o + 30) (dcopyP 19 45 21) (move 21 19) g6.2
-- COPY 17 45 21
cases copy_run prog o 17 45 21 g1.1 rfl rfl rfl (tr k) [] [] x h17 h45 h21 with
| intro y1 h1 =>
-- MOVE 21 17
cases move_spec prog (o + 7) 21 17 g2.1 rfl _ [] y1 h1.2.2.2.1 h1.2.1 with
| intro y2 h2 =>
-- push twice
cases two_run prog (o + 12) g3.1 y2 _ ((h2.2.2.2 45 rfl rfl).trans h1.2.2.1) with
| intro y3 h3 =>
-- DCOPY 18 45 21
have r18 : y3 18 = revApp p [] :=
(h3.2.2 18 rfl).trans ((h2.2.2.2 18 rfl rfl).trans ((h1.2.2.2.2 18 rfl rfl rfl).trans h18))
have r21 : y3 21 = [] := (h3.2.2 21 rfl).trans h2.2.1
cases dcopy_run prog (o + 14) 18 45 21 g4.1 rfl rfl rfl _ _ [] y3 r18 h3.2.1 r21 with
| intro y4 h4 =>
-- MOVE 21 18
cases move_spec prog (o + 23) 21 18 g5.1 rfl _ [] y4 h4.2.2.2.1 h4.2.1 with
| intro y5 h5 =>
cases two_run prog (o + 28) g6.1 y5 _ ((h5.2.2.2 45 rfl rfl).trans h4.2.2.1) with
| intro y6 h6 =>
have r19 : y6 19 = revApp z [] :=
(h6.2.2 19 rfl).trans ((h5.2.2.2 19 rfl rfl).trans ((h4.2.2.2.2 19 rfl rfl rfl).trans ((h3.2.2 19 rfl).trans
((h2.2.2.2 19 rfl rfl).trans ((h1.2.2.2.2 19 rfl rfl rfl).trans h19)))))
have r21' : y6 21 = [] := (h6.2.2 21 rfl).trans h5.2.1
cases dcopy_run prog (o + 30) 19 45 21 g7.1 rfl rfl rfl _ _ [] y6 r19 h6.2.1 r21' with
| intro y7 h7 =>
cases move_spec prog (o + 39) 21 19 g7.2 rfl _ [] y7 h7.2.2.2.1 h7.2.1 with
| intro y8 h8 =>
have s := runs_seq prog _ _ o (o + 39) (o + 44) x y7 y8
(runs_seq prog _ _ o (o + 30) (o + 39) x y6 y7
(runs_seq prog _ _ o (o + 28) (o + 30) x y5 y6
(runs_seq prog _ _ o (o + 23) (o + 28) x y4 y5
(runs_seq prog _ _ o (o + 14) (o + 23) x y3 y4
(runs_seq prog _ _ o (o + 12) (o + 14) x y2 y3
(runs_seq prog _ _ o (o + 7) (o + 12) x y1 y2 h1.1 h2.1) h3.1) h4.1) h5.1) h6.1) h7.1) h8.1
have mk : k <= k + p.length + z.length := Nat.le_trans (Nat.le_add_right k p.length) (Nat.le_add_right _ _)
have mp : p.length <= k + p.length + z.length := Nat.le_trans (Nat.le_add_left p.length k) (Nat.le_add_right _ _)
have mz : z.length <= k + p.length + z.length := Nat.le_add_left _ _
have lk : (revApp (tr k) []).length = k := by rw [revApp_len, tr_len]; rfl
have lp : (revApp (revApp p []) []).length = p.length := by rw [revApp_nil2]
have lz : (revApp (revApp z []) []).length = z.length := by rw [revApp_nil2]
have lpr : (revApp p []).length = p.length := by rw [revApp_len]; rfl
have lzr : (revApp z []).length = z.length := by rw [revApp_len]; rfl
refine Exists.intro _ (Exists.intro y8 (And.intro ?_ (And.intro s ?_)))
· refine acc _ _ 7 _ 0 (acc _ _ 6 _ 0 (acc _ _ 5 _ 0 (acc _ _ 4 _ 0 (acc _ _ 3 _ 0 (acc _ _ 2 _ 0 (acc _ _ 1 _ 0
(acc1 _ _ ?_) ?_) (b2 _)) ?_) ?_) (b2 _)) ?_) ?_
· rw [tr_len]; exact Nat.le_trans (bC k _ (leSS _ _ mk)) (Nat.le_refl _)
· rw [lk]; exact bB k _ (leSS _ _ mk)
· rw [lpr]; exact bF _ _ mp
· rw [lp]; exact bB _ _ (leSS _ _ mp)
· rw [lzr]; exact bF _ _ mz
· rw [lz]; exact bB _ _ (leSS _ _ mz)
· have e45 : y8 45 = enc z (enc p (tr k)) := by
show y8 45 = dbl z ++ true :: true :: (dbl p ++ true :: true :: tr k)
rw [h8.2.2.2 45 rfl rfl, h7.2.2.1, dblRev_rev, dblRev_rev, revApp_tr, app_nil'']
refine And.intro e45 (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro h8.2.1 ?_))))
· rw [h8.2.2.2 17 rfl rfl, h7.2.2.2.2 17 rfl rfl rfl, h6.2.2 17 rfl, h5.2.2.2 17 rfl rfl,
h4.2.2.2.2 17 rfl rfl rfl, h3.2.2 17 rfl, h2.2.2.1, revApp_nil2]
· rw [h8.2.2.2 18 rfl rfl, h7.2.2.2.2 18 rfl rfl rfl, h6.2.2 18 rfl, h5.2.2.1, revApp_nil2]
· rw [h8.2.2.1, revApp_nil2]
· intro i a b c d e
rw [h8.2.2.2 i d c, h7.2.2.2.2 i c e d, h6.2.2 i e, h5.2.2.2 i d b, h4.2.2.2.2 i b e d, h3.2.2 i e,
h2.2.2.2 i d a, h1.2.2.2.2 i a e d]
end Found.Pnp79
#print axioms Found.Pnp79.two_run
#print axioms Found.Pnp79.five_le
#print axioms Found.Pnp79.bF
#print axioms Found.Pnp79.b2
#print axioms Found.Pnp79.leSS
#print axioms Found.Pnp79.bld_run
lean_all/found/Pnp8.lean
/-
T330 piece 8. found/Pnp8 -- the Cook-Levin window clauses, directly in CNF.
For a cell bit x and its neighbourhood bits ys (n of them), and a local rule d giving
the new bit from the neighbourhood pattern, the window CNF has one clause per pattern
p of n bits: "ys differs from p, or x = d p". With n fixed by the machine, this is
2^n clauses of n + 1 literals -- a constant per cell, so the whole tableau CNF has
size linear in (time x width), with no formula blow-up and no Tseitin step.
Proved: an assignment satisfies the window CNF iff it gives x the value d (ys).
Variables are of any type (time, cell, bit). It relativizes (a tool; PNP_MAP.md).
Written with ASCII forms only. CIC dependence: none.
-/
namespace Found.Pnp8
universe u
variable {α : Type u}
/-! ## CNF over any variable type -/
def pol : Bool -> Bool -> Bool
| true, v => v
| false, v => !v
def litv (s : α -> Bool) (l : Bool × α) : Bool := pol l.1 (s l.2)
def clv (s : α -> Bool) : List (Bool × α) -> Bool
| [] => false
| l :: c => litv s l || clv s c
def cnfv (s : α -> Bool) : List (List (Bool × α)) -> Bool
| [] => true
| c :: f => clv s c && cnfv s f
def beqB : Bool -> Bool -> Bool
| true, true => true
| false, false => true
| true, false => false
| false, true => false
/-- Equality on the common prefix. -/
def eqP : List Bool -> List Bool -> Bool
| [], _ => true
| _ :: _, [] => true
| a :: as, b :: bs => beqB a b && eqP as bs
def mapv (s : α -> Bool) : List α -> List Bool
| [] => []
| y :: ys => s y :: mapv s ys
/-- The literals "ys differs from p", then the tail. -/
def wc : List α -> List Bool -> List (Bool × α) -> List (Bool × α)
| [], _, tl => tl
| _ :: _, [], tl => tl
| y :: ys, q :: p, tl => (!q, y) :: wc ys p tl
/-! ## Bool facts -/
theorem pol_neq (q v : Bool) : pol (!q) v = !(beqB v q) := by
cases q <;> cases v <;> rfl
theorem not_and_or (a b c : Bool) : (!a || (!b || c)) = (!(a && b) || c) := by
cases a <;> rfl
theorem beqB_refl (a : Bool) : beqB a a = true := by cases a <;> rfl
theorem beqB_eq (a b : Bool) (h : beqB a b = true) : a = b := by
cases a <;> cases b <;> first | rfl | exact Bool.noConfusion h
theorem pol_self (c : Bool) : pol c c = true := by cases c <;> rfl
theorem pol_eq (c v : Bool) (h : pol c v = true) : v = c := by
cases c <;> cases v <;> first | rfl | exact Bool.noConfusion h
theorem and_l {x y : Bool} (h : (x && y) = true) : x = true := by
cases x with
| true => rfl
| false => exact Bool.noConfusion h
theorem and_r {x y : Bool} (h : (x && y) = true) : y = true := by
cases x with
| true => exact h
| false => exact Bool.noConfusion h
theorem or_false_eq (x : Bool) : (x || false) = x := by cases x <;> rfl
/-! ## The clause value -/
theorem clv_wc (s : α -> Bool) (tl : List (Bool × α)) : forall (ys : List α) (p : List Bool),
clv s (wc ys p tl) = (!(eqP (mapv s ys) p) || clv s tl) := by
intro ys
induction ys with
| nil => intro p; rfl
| cons y ys ih =>
intro p
cases p with
| nil => rfl
| cons q p =>
show (pol (!q) (s y) || clv s (wc ys p tl)) = (!(beqB (s y) q && eqP (mapv s ys) p) || clv s tl)
rw [ih p, pol_neq]
exact not_and_or _ _ _
theorem eqP_refl : forall L : List Bool, eqP L L = true := by
intro L
induction L with
| nil => rfl
| cons a L ih =>
show (beqB a a && eqP L L) = true
rw [beqB_refl, ih]; rfl
theorem eqP_eq : forall (L p : List Bool), eqP L p = true -> L.length = p.length -> L = p := by
intro L
induction L with
| nil => intro p _ hl; cases p with
| nil => rfl
| cons _ _ => exact Nat.noConfusion hl
| cons a L ih => intro p h hl; cases p with
| nil => exact Nat.noConfusion hl
| cons q p =>
have h' : (beqB a q && eqP L p) = true := h
have e1 : a = q := beqB_eq a q (and_l h')
have e2 : L = p := ih p (and_r h') (Nat.succ.inj hl)
rw [e1, e2]
theorem length_mapv (s : α -> Bool) : forall ys : List α, (mapv s ys).length = ys.length := by
intro ys
induction ys with
| nil => rfl
| cons y ys ih => exact congrArg (fun t => t + 1) ih
/-! ## All patterns -/
def mapC (b : Bool) : List (List Bool) -> List (List Bool)
| [] => []
| p :: ps => (b :: p) :: mapC b ps
def allBits : Nat -> List (List Bool)
| 0 => [[]]
| n + 1 => mapC false (allBits n) ++ mapC true (allBits n)
def InL (p : List Bool) : List (List Bool) -> Prop
| [] => False
| q :: qs => p = q \/ InL p qs
theorem InL_app_l (p : List Bool) (B : List (List Bool)) : forall A, InL p A -> InL p (A ++ B) := by
intro A
induction A with
| nil => intro h; exact False.elim h
| cons q A ih => intro h; exact Or.elim h (fun e => Or.inl e) (fun h' => Or.inr (ih h'))
theorem InL_app_r (p : List Bool) (B : List (List Bool)) : forall A, InL p B -> InL p (A ++ B) := by
intro A
induction A with
| nil => intro h; exact h
| cons q A ih => intro h; exact Or.inr (ih h)
theorem InL_app_inv (p : List Bool) (B : List (List Bool)) : forall A, InL p (A ++ B) -> InL p A \/ InL p B := by
intro A
induction A with
| nil => intro h; exact Or.inr h
| cons q A ih =>
intro h
exact Or.elim h (fun e => Or.inl (Or.inl e))
(fun h' => Or.elim (ih h') (fun a => Or.inl (Or.inr a)) (fun b => Or.inr b))
theorem InL_mapC (b : Bool) (p : List Bool) : forall A, InL p A -> InL (b :: p) (mapC b A) := by
intro A
induction A with
| nil => intro h; exact False.elim h
| cons q A ih =>
intro h
exact Or.elim h (fun e => Or.inl (congrArg (fun t => b :: t) e)) (fun h' => Or.inr (ih h'))
theorem InL_mapC_inv (b : Bool) (p : List Bool) : forall A, InL p (mapC b A) ->
Exists fun q => p = b :: q /\ InL q A := by
intro A
induction A with
| nil => intro h; exact False.elim h
| cons q A ih =>
intro h
exact Or.elim h (fun e => Exists.intro q (And.intro e (Or.inl rfl)))
(fun h' => Exists.elim (ih h') fun r hr => Exists.intro r (And.intro hr.1 (Or.inr hr.2)))
theorem allBits_complete : forall L : List Bool, InL L (allBits L.length) := by
intro L
induction L with
| nil => exact Or.inl rfl
| cons a L ih =>
cases a with
| false => exact InL_app_l _ _ _ (InL_mapC false L _ ih)
| true => exact InL_app_r _ _ _ (InL_mapC true L _ ih)
theorem allBits_len : forall (n : Nat) (p : List Bool), InL p (allBits n) -> p.length = n := by
intro n
induction n with
| zero => intro p h; exact Or.elim h (fun e => by rw [e]; rfl) (fun f => False.elim f)
| succ n ih =>
intro p h
have hm : forall b, InL p (mapC b (allBits n)) -> p.length = n + 1 := fun b hb =>
Exists.elim (InL_mapC_inv b p _ hb) fun q hq => by
rw [hq.1]; exact congrArg (fun t => t + 1) (ih q hq.2)
exact Or.elim (InL_app_inv p _ _ h) (hm false) (hm true)
/-! ## The window CNF of one cell bit -/
def mapCl (ys : List α) (x : α) (d : List Bool -> Bool) : List (List Bool) -> List (List (Bool × α))
| [] => []
| p :: ps => wc ys p [(d p, x)] :: mapCl ys x d ps
def window (ys : List α) (x : α) (d : List Bool -> Bool) (n : Nat) : List (List (Bool × α)) :=
mapCl ys x d (allBits n)
theorem clv_one (s : α -> Bool) (ys : List α) (x : α) (d : List Bool -> Bool) (p : List Bool) :
clv s (wc ys p [(d p, x)]) = (!(eqP (mapv s ys) p) || (pol (d p) (s x) || false)) :=
clv_wc s _ ys p
theorem mapCl_mem (s : α -> Bool) (ys : List α) (x : α) (d : List Bool -> Bool) :
forall ps, cnfv s (mapCl ys x d ps) = true -> forall p, InL p ps -> clv s (wc ys p [(d p, x)]) = true := by
intro ps
induction ps with
| nil => intro _ p hp; exact False.elim hp
| cons q ps ih =>
intro h p hp
have h' : (clv s (wc ys q [(d q, x)]) && cnfv s (mapCl ys x d ps)) = true := h
exact Or.elim hp (fun e => by rw [e]; exact and_l h') (fun hp' => ih (and_r h') p hp')
theorem mapCl_all (s : α -> Bool) (ys : List α) (x : α) (d : List Bool -> Bool) :
forall ps, (forall p, InL p ps -> clv s (wc ys p [(d p, x)]) = true) -> cnfv s (mapCl ys x d ps) = true := by
intro ps
induction ps with
| nil => intro _; rfl
| cons q ps ih =>
intro h
show (clv s (wc ys q [(d q, x)]) && cnfv s (mapCl ys x d ps)) = true
rw [h q (Or.inl rfl), ih (fun p hp => h p (Or.inr hp))]
rfl
/-- The window CNF holds iff the cell bit is the rule applied to its neighbourhood. -/
theorem window_iff (s : α -> Bool) (ys : List α) (x : α) (d : List Bool -> Bool) (n : Nat)
(hn : ys.length = n) :
(cnfv s (window ys x d n) = true -> s x = d (mapv s ys)) /\
(s x = d (mapv s ys) -> cnfv s (window ys x d n) = true) := by
have hL : (mapv s ys).length = n := (length_mapv s ys).trans hn
apply And.intro
· intro h
have hin : InL (mapv s ys) (allBits n) := by
rw [← hL]; exact allBits_complete _
have hc := mapCl_mem s ys x d (allBits n) h (mapv s ys) hin
rw [clv_one, eqP_refl] at hc
have hc' : (pol (d (mapv s ys)) (s x) || false) = true := hc
rw [or_false_eq] at hc'
exact pol_eq _ _ hc'
· intro hx
apply mapCl_all
intro p hp
rw [clv_one]
cases he : eqP (mapv s ys) p with
| false => rfl
| true =>
have e : mapv s ys = p := eqP_eq _ _ he (hL.trans (allBits_len n p hp).symm)
rw [← e, hx, pol_self]
rfl
end Found.Pnp8
#print axioms Found.Pnp8.pol_neq
#print axioms Found.Pnp8.not_and_or
#print axioms Found.Pnp8.beqB_refl
#print axioms Found.Pnp8.beqB_eq
#print axioms Found.Pnp8.pol_self
#print axioms Found.Pnp8.pol_eq
#print axioms Found.Pnp8.and_l
#print axioms Found.Pnp8.and_r
#print axioms Found.Pnp8.or_false_eq
#print axioms Found.Pnp8.clv_wc
#print axioms Found.Pnp8.eqP_refl
#print axioms Found.Pnp8.eqP_eq
#print axioms Found.Pnp8.length_mapv
#print axioms Found.Pnp8.InL_app_l
#print axioms Found.Pnp8.InL_app_r
#print axioms Found.Pnp8.InL_app_inv
#print axioms Found.Pnp8.InL_mapC
#print axioms Found.Pnp8.InL_mapC_inv
#print axioms Found.Pnp8.allBits_complete
#print axioms Found.Pnp8.allBits_len
#print axioms Found.Pnp8.clv_one
#print axioms Found.Pnp8.mapCl_mem
#print axioms Found.Pnp8.mapCl_all
#print axioms Found.Pnp8.window_iff
lean_all/found/Pnp80.lean
/-
T332 piece (T330 file series) 80. found/Pnp80 -- calling a decider on a built query and
emptying its block again (toward search-to-decision on the register machine, open lemma
O5rm).
callP D: bldP (Pnp79) builds q = enc z (enc p (tr k)) in register 45; D relocated by 32
(Pnp69) decides q; RD pushes the first bit of D's output (register 48) on register 22;
clrAll 32 (sumR D + 17) (Pnp77) empties the block of D. Proved:
* rd_run: RD = [pop 48 (empty -> 3, 0 -> 3, 1 -> 1), push 22 true, jmp 4, push 22 false];
* calld_run: if D decides L within pe eD steps (Owf4.DecRM) and every register >= 32 is
empty, then callP D ends with 22 = L q :: 22, registers 17, 18, 19, 21 as they were,
every register >= 32 empty again and every other register below 32 kept, within
8 Bn (2 S) + pe eD |q| + 3 + n (|q| + pe eD |q| + 1) steps (n = sumR D + 17).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp79
import found.Pnp76
namespace Found.Pnp80
open Found.Pnp3 (PE pe)
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI revApp run selR)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp23 (tr)
open Found.Pnp4 (enc)
open Found.Pnp59 (inpR inpR_13 inpR_other sumR)
open Found.Pnp67 (relocP)
open Found.Pnp69 (relocP_len call_run)
open Found.Pnp70 (run1_push run1_jmp run1_pop_nil run1_pop_cons bsel)
open Found.Pnp74 (seqI fragHT Bn hi_lt e45 lt32)
open Found.Pnp77 (run_hi len_run clrAll clrAll_run)
open Found.Pnp79 (bldP bld_run)
open Found.Owf4 (DecRM outBit)
def rdP : List Ins := [.pop 48 3 3 1, .push 22 true, .jmp 4, .push 22 false]
def tl : List Bool -> List Bool
| [] => []
| _ :: t => t
theorem rd_run (prog : List Ins) (o : Nat) (hf : Frag prog o rdP) (x : Nat -> List Bool) :
Exists fun N => Exists fun y => N <= 3 /\ Runs prog N o x (o + 4) y /\ y 22 = outBit (x 48) :: x 22 /\
y 48 = tl (x 48) /\ (forall i, Nat.beq i 22 = false -> Nat.beq i 48 = false -> y i = x i) := by
cases h : x 48 with
| nil =>
have s0 := run1_pop_nil prog o 48 (o + 3) (o + 3) (o + 1) (hf 0 _ rfl) x h
have s1 := run1_push prog (o + 3) 22 false (hf 3 _ rfl) x
refine Exists.intro 2 (Exists.intro _ (And.intro (Nat.le_succ 2) (And.intro
(runs_seq prog 1 1 o (o + 3) (o + 4) x x _ s0 s1) (And.intro (upd_same _ _ _) (And.intro ?_ ?_)))))
· rw [upd_other x 22 48 _ rfl, h]; rfl
· intro i hi _; exact upd_other x 22 i _ hi
| cons b t =>
cases b with
| false =>
have s0 := run1_pop_cons prog o 48 (o + 3) (o + 3) (o + 1) (hf 0 _ rfl) x false t h
have s1 := run1_push prog (o + 3) 22 false (hf 3 _ rfl) (upd x 48 t)
refine Exists.intro 2 (Exists.intro _ (And.intro (Nat.le_succ 2) (And.intro
(runs_seq prog 1 1 o (o + 3) (o + 4) x _ _ s0 s1) (And.intro ?_ (And.intro ?_ ?_)))))
· rw [upd_same, upd_other x 48 22 t rfl]; rfl
· rw [upd_other _ 22 48 _ rfl, upd_same]; rfl
· intro i h1 h2; rw [upd_other _ 22 i _ h1, upd_other x 48 i t h2]
| true =>
have s0 := run1_pop_cons prog o 48 (o + 3) (o + 3) (o + 1) (hf 0 _ rfl) x true t h
have s1 := run1_push prog (o + 1) 22 true (hf 1 _ rfl) (upd x 48 t)
have s2 := run1_jmp prog (o + 2) (o + 4) (hf 2 _ rfl) (upd (upd x 48 t) 22 (true :: upd x 48 t 22))
refine Exists.intro 3 (Exists.intro _ (And.intro (Nat.le_refl 3) (And.intro
(runs_seq prog 2 1 o (o + 2) (o + 4) x _ _ (runs_seq prog 1 1 o (o + 1) (o + 2) x _ _ s0 s1) s2)
(And.intro ?_ (And.intro ?_ ?_)))))
· rw [upd_same, upd_other x 48 22 t rfl]; rfl
· rw [upd_other _ 22 48 _ rfl, upd_same]; rfl
· intro i h1 h2; rw [upd_other _ 22 i _ h1, upd_other x 48 i t h2]
theorem tl_len (l : List Bool) : (tl l).length <= l.length := by
cases l with
| nil => exact Nat.le_refl 0
| cons b t => exact Nat.le_succ _
def nB (D : List Ins) : Nat := sumR D + 17
def callP (D : List Ins) : List Ins := seqI bldP (seqI (relocP 32 D) (seqI rdP (clrAll 32 (nB D))))
theorem inpR_len (q : List Bool) (j : Nat) : (inpR q j).length <= q.length := by
show (selR (Nat.beq j 13) q []).length <= q.length
cases Nat.beq j 13 with
| true => exact Nat.le_refl _
| false => exact Nat.zero_le _
theorem lt_of_ble' (a b : Nat) (h : Nat.ble (a + 1) b = true) : a < b := Nat.le_of_ble_eq_true h
theorem calld_run (prog : List Ins) (o : Nat) (D : List Ins) (eD : PE) (L : List Bool -> Bool)
(hD : DecRM D eD L) (hf : Frag prog o (callP D)) (k : Nat) (p z : List Bool) (x : Nat -> List Bool)
(h17 : x 17 = tr k) (h18 : x 18 = revApp p []) (h19 : x 19 = revApp z []) (h21 : x 21 = [])
(hblk : forall i, x (i + 32) = []) :
Exists fun N => Exists fun y =>
N <= 8 * Bn ((k + p.length + z.length) + (k + p.length + z.length)) + 0 +
pe eD (enc z (enc p (tr k))).length + 3 +
nB D * ((enc z (enc p (tr k))).length + pe eD (enc z (enc p (tr k))).length + 1) /\
Runs prog N o x (o + 44 + D.length + 4 + nB D) y /\
y 22 = L (enc z (enc p (tr k))) :: x 22 /\ y 17 = tr k /\ y 18 = revApp p [] /\ y 19 = revApp z [] /\
y 21 = [] /\ (forall i, y (i + 32) = []) /\
(forall i, i < 32 -> Nat.beq i 17 = false -> Nat.beq i 18 = false -> Nat.beq i 19 = false ->
Nat.beq i 21 = false -> Nat.beq i 22 = false -> y i = x i) := by
have g1 := fragHT prog o bldP _ hf
have g2 := fragHT prog (o + 44) (relocP 32 D) _ g1.2
have g2' : Frag prog (o + 44 + D.length) (seqI rdP (clrAll 32 (nB D))) := by
have e := g2.2; rw [relocP_len] at e; exact e
have g3 := fragHT prog (o + 44 + D.length) rdP _ g2'
cases bld_run prog o g1.1 k p z x h17 h18 h19 h21 (hblk 13) with
| intro Nb hb =>
cases hb with
| intro y1 h1 =>
-- the block holds the query only
have hi1 : forall i, y1 (i + 32) = inpR (enc z (enc p (tr k))) i := by
intro i
cases e : Nat.beq i 13 with
| true =>
rw [Found.Pnp2.beq_eq i 13 e, inpR_13]
exact h1.2.2.1
| false =>
rw [inpR_other _ i e]
rw [h1.2.2.2.2.2.2.2 (i + 32) (hi_lt 17 i (lt32 17 rfl)) (hi_lt 18 i (lt32 18 rfl))
(hi_lt 19 i (lt32 19 rfl)) (hi_lt 21 i (lt32 21 rfl)) (e45 i e)]
exact hblk i
cases hD (enc z (enc p (tr k))) with
| intro ND hND =>
cases hND with
| intro yD hyD =>
cases call_run prog (o + 44) 32 D g2.1 ND _ yD y1 y1 (And.intro hi1 (fun _ _ => rfl)) hyD.2.1 hyD.2.2.1 with
| intro zz hz =>
cases rd_run prog (o + 44 + D.length) g3.1 zz with
| intro Nr hr =>
cases hr with
| intro w hw =>
-- the block after the call: bounded, and empty beyond n
have hzD : forall j, zz (j + 32) = (run D ND (Cfg.mk 0 (inpR (enc z (enc p (tr k)))))).regs j :=
fun j => (hz.2.1 j).trans (hyD.2.1.2 j).symm
have hM : forall j, j < nB D -> (w (32 + j)).length <=
(enc z (enc p (tr k))).length + pe eD (enc z (enc p (tr k))).length := by
intro j _
have b0 : (zz (32 + j)).length <= (enc z (enc p (tr k))).length + pe eD (enc z (enc p (tr k))).length := by
rw [Nat.add_comm 32 j, hzD j]
exact Nat.le_trans (len_run D j ND _) (Nat.add_le_add (inpR_len _ j) hyD.1)
cases e48 : Nat.beq (32 + j) 48 with
| true =>
rw [Found.Pnp2.beq_eq _ 48 e48, hw.2.2.2.1]
rw [Found.Pnp2.beq_eq _ 48 e48] at b0
exact Nat.le_trans (tl_len _) b0
| false =>
rw [hw.2.2.2.2 (32 + j) (Found.Pnp56.beq_gt _ 22 (Nat.lt_of_lt_of_le (lt32 22 rfl) (Nat.le_add_right 32 j))) e48]
exact b0
cases clrAll_run prog ((enc z (enc p (tr k))).length + pe eD (enc z (enc p (tr k))).length)
(nB D) 32 (o + 44 + D.length + 4) w g3.2 hM with
| intro Nc hc =>
cases hc with
| intro y hy =>
have s := runs_seq prog _ Nc o (o + 44 + D.length + 4) (o + 44 + D.length + 4 + nB D) x w y
(runs_seq prog _ Nr o (o + 44 + D.length) (o + 44 + D.length + 4) x zz w
(runs_seq prog Nb ND o (o + 44) (o + 44 + D.length) x y1 zz h1.2.1 hz.1) hw.2.1) hy.2.1
-- registers below 32
have low : forall i, i < 32 -> Nat.beq i 22 = false -> y i = zz i := by
intro i hi h22
rw [hy.2.2.2 i (Or.inl hi)]
exact hw.2.2.2.2 i h22 (Found.Pnp56.beq_lt i 48 (Nat.lt_trans hi (lt_of_ble' 32 48 rfl)))
have low1 : forall i, i < 32 -> Nat.beq i 22 = false -> y i = y1 i :=
fun i hi h22 => (low i hi h22).trans (hz.2.2 i hi)
refine Exists.intro _ (Exists.intro y (And.intro ?_ (And.intro s ?_)))
· exact Nat.add_le_add (Nat.add_le_add (Nat.add_le_add h1.1 hyD.1) hw.1) hy.1
· refine And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ ?_)))))
· rw [hy.2.2.2 22 (Or.inl (lt32 22 rfl)), hw.2.2.1, hz.2.2 22 (lt32 22 rfl), hz.2.1 16, hyD.2.2.2,
h1.2.2.2.2.2.2.2 22 rfl rfl rfl rfl rfl]
· exact (low1 17 (lt32 17 rfl) rfl).trans h1.2.2.2.1
· exact (low1 18 (lt32 18 rfl) rfl).trans h1.2.2.2.2.1
· exact (low1 19 (lt32 19 rfl) rfl).trans h1.2.2.2.2.2.1
· exact (low1 21 (lt32 21 rfl) rfl).trans h1.2.2.2.2.2.2.1
· intro i
rw [Nat.add_comm i 32]
cases Found.Pnp76.lt_or_le' i (nB D) with
| inl h => exact hy.2.2.1 i h
| inr h =>
have h17 : 17 <= i := Nat.le_trans (Nat.le_add_left 17 (sumR D)) h
rw [hy.2.2.2 (32 + i) (Or.inr (Nat.add_le_add_left h 32))]
have n22 : Nat.beq (32 + i) 22 = false :=
Found.Pnp56.beq_gt _ 22 (Nat.lt_of_lt_of_le (lt32 22 rfl) (Nat.le_add_right 32 i))
have n48 : Nat.beq (32 + i) 48 = false := by
rw [Nat.add_comm 32 i]
exact (Found.Pnp56.beq_add_r i 16 32).trans (Found.Pnp56.beq_gt i 16 (Nat.lt_of_lt_of_le (Nat.lt_succ_self 16) h17))
rw [hw.2.2.2.2 (32 + i) n22 n48, Nat.add_comm 32 i, hzD i,
run_hi D i (Nat.le_trans (Nat.le_add_right (sumR D) 17) h) ND _]
exact inpR_other _ i (Found.Pnp56.beq_gt i 13 (Nat.lt_of_lt_of_le (lt_of_ble' 13 17 rfl) h17))
· intro i hi a b c d e
rw [low1 i hi e]
exact h1.2.2.2.2.2.2.2 i a b c d (Found.Pnp56.beq_lt i 45 (Nat.lt_trans hi (lt_of_ble' 32 45 rfl)))
end Found.Pnp80
#print axioms Found.Pnp80.rd_run
#print axioms Found.Pnp80.tl_len
#print axioms Found.Pnp80.inpR_len
#print axioms Found.Pnp80.lt_of_ble'
#print axioms Found.Pnp80.calld_run
lean_all/found/Pnp81.lean
/-
T332 piece (T330 file series) 81. found/Pnp81 -- placing fragments inside a loop, and a
monotone bound for one decider call (toward search-to-decision on the register machine,
open lemma O5rm).
A loop jumps back to its own start, so its glue instructions carry targets relative to the
loop start, while the fragments inside it are shifted to their places (mapI (shift off)).
FragAbs prog o base R: the instructions of R stand at base + i, shifted by o. Proved:
* fa_frag, fa_app_l, fa_app_r, fa_map, fa_ins: reading fragments and glue instructions
of appI chains;
* callP_len: |callP D| = 44 + |D| + 4 + nB D;
* dbl_len, q_len_le: |enc z (enc p (tr k))| <= Bn (S + S) when k + |p| + |z| <= S;
* calld_bnd: the steps of one decider call (Pnp80) are at most callB D eD S.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp80
namespace Found.Pnp81
open Found.Pnp3 (PE pe pe_mono)
open Found.Pnp20 (Ins nthI revApp move)
open Found.Pnp21 (Frag shift)
open Found.Pnp23 (appI mapI nthI_app_r nthI_app_l nthI_mapI shift_shift tr tr_len)
open Found.Pnp4 (dbl enc)
open Found.Pnp67 (relocP)
open Found.Pnp69 (relocP_len)
open Found.Pnp74 (seqI seqI_len Bn)
open Found.Pnp77 (clrAll)
open Found.Pnp79 (bldP)
open Found.Pnp80 (callP rdP nB)
def FragAbs (prog : List Ins) (o base : Nat) (R : List Ins) : Prop :=
forall i ins, nthI R i = some ins -> nthI prog (base + i) = some (shift o ins)
theorem fa_frag (prog : List Ins) (o : Nat) (R : List Ins) (h : Frag prog o R) : FragAbs prog o o R := h
theorem fa_app_l (prog : List Ins) (o base : Nat) (A B : List Ins) (h : FragAbs prog o base (appI A B)) :
FragAbs prog o base A :=
fun i ins hi => h i ins (nthI_app_l A B i ins hi)
theorem fa_app_r (prog : List Ins) (o base : Nat) (A B : List Ins) (h : FragAbs prog o base (appI A B)) :
FragAbs prog o (base + A.length) B := by
intro i ins hi
have e := h (A.length + i) ins ((nthI_app_r A B i).trans hi)
rw [← Nat.add_assoc] at e
exact e
theorem fa_map (prog : List Ins) (o base off : Nat) (P : List Ins) (h : FragAbs prog o base (mapI (shift off) P))
(hb : base = o + off) : Frag prog (o + off) P := by
intro i ins hi
have e := h i (shift off ins) (nthI_mapI (shift off) P i ins hi)
rw [shift_shift, hb] at e
exact e
theorem fa_ins (prog : List Ins) (o base : Nat) (R : List Ins) (h : FragAbs prog o base R) (i : Nat) (ins : Ins)
(hi : nthI R i = some ins) : nthI prog (base + i) = some (shift o ins) := h i ins hi
theorem callP_len (D : List Ins) : (callP D).length = 44 + D.length + 4 + nB D := by
show (seqI bldP (seqI (relocP 32 D) (seqI rdP (clrAll 32 (nB D))))).length = _
rw [seqI_len, seqI_len, seqI_len, relocP_len]
have cl : forall n b, (clrAll b n).length = n := by
intro n
induction n with
| zero => intro b; rfl
| succ n ih =>
intro b
show (seqI (Found.Pnp77.clr b) (clrAll (b + 1) n)).length = n + 1
rw [seqI_len, ih]
exact Nat.add_comm 1 n
rw [cl]
show 44 + (D.length + (4 + nB D)) = 44 + D.length + 4 + nB D
rw [Nat.add_assoc 44 D.length 4, Nat.add_assoc 44 (D.length + 4) (nB D), Nat.add_assoc D.length 4 (nB D)]
theorem dbl_len : forall x : List Bool, (dbl x).length = x.length + x.length
| [] => rfl
| _ :: x => by
show (dbl x).length + 1 + 1 = x.length + 1 + (x.length + 1)
rw [dbl_len x]
rw [Nat.add_assoc x.length 1 (x.length + 1), Nat.add_comm 1 (x.length + 1)]
rfl
theorem enc_len (x w : List Bool) : (enc x w).length = (x.length + x.length) + (w.length + 2) := by
show (dbl x ++ (true :: true :: w)).length = _
rw [Found.Pnp76.app_len, dbl_len]
rfl
theorem q_len_le (k : Nat) (p z : List Bool) (S : Nat) (hS : k + p.length + z.length <= S) :
(enc z (enc p (tr k))).length <= Bn (S + S) := by
have hk : k <= S := Nat.le_trans (Nat.le_trans (Nat.le_add_right k p.length) (Nat.le_add_right _ _)) hS
have hp : p.length <= S := Nat.le_trans (Nat.le_trans (Nat.le_add_left p.length k) (Nat.le_add_right _ _)) hS
have hz : z.length <= S := Nat.le_trans (Nat.le_add_left _ _) hS
rw [enc_len, enc_len, tr_len]
have b : (z.length + z.length) + ((p.length + p.length) + (k + 2) + 2) <= (S + S) + ((S + S) + (S + 2) + 2) :=
Nat.add_le_add (Nat.add_le_add hz hz)
(Nat.add_le_add_right (Nat.add_le_add (Nat.add_le_add hp hp) (Nat.add_le_add_right hk 2)) 2)
refine Nat.le_trans b ?_
show (S + S) + ((S + S) + S) + 4 <= (S + S) + (S + S) + (S + S) + (S + S) + 4
refine Nat.add_le_add_right ?_ 4
rw [← Nat.add_assoc]
exact Nat.le_trans (Nat.add_le_add_left (Nat.le_add_right S S) _) (Nat.le_add_right _ _)
/-- A bound for one call, monotone in S. -/
def callB (D : List Ins) (eD : PE) (S : Nat) : Nat :=
8 * Bn (S + S) + 0 + pe eD (Bn (S + S)) + 3 + nB D * (Bn (S + S) + pe eD (Bn (S + S)) + 1)
theorem Bn_mono (m n : Nat) (h : m <= n) : Bn m <= Bn n :=
Nat.add_le_add_right (Nat.add_le_add (Nat.add_le_add (Nat.add_le_add h h) h) h) 4
theorem calld_bnd (D : List Ins) (eD : PE) (k : Nat) (p z : List Bool) (S : Nat) (hS : k + p.length + z.length <= S)
(N : Nat) (hN : N <= 8 * Bn ((k + p.length + z.length) + (k + p.length + z.length)) + 0 +
pe eD (enc z (enc p (tr k))).length + 3 +
nB D * ((enc z (enc p (tr k))).length + pe eD (enc z (enc p (tr k))).length + 1)) :
N <= callB D eD S := by
have hq := q_len_le k p z S hS
have hpe := pe_mono _ _ hq eD
refine Nat.le_trans hN ?_
refine Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add (Nat.add_le_add_right
(Nat.mul_le_mul_left 8 (Bn_mono _ _ (Nat.add_le_add hS hS))) 0) hpe) 3) ?_
exact Nat.mul_le_mul_left _ (Nat.add_le_add_right (Nat.add_le_add hq hpe) 1)
theorem callB_mono (D : List Ins) (eD : PE) (m n : Nat) (h : m <= n) : callB D eD m <= callB D eD n := by
have h2 : Bn (m + m) <= Bn (n + n) := Bn_mono _ _ (Nat.add_le_add h h)
have hpe := pe_mono _ _ h2 eD
exact Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add (Nat.add_le_add_right
(Nat.mul_le_mul_left 8 h2) 0) hpe) 3) (Nat.mul_le_mul_left _ (Nat.add_le_add_right (Nat.add_le_add h2 hpe) 1))
end Found.Pnp81
#print axioms Found.Pnp81.fa_frag
#print axioms Found.Pnp81.fa_app_l
#print axioms Found.Pnp81.fa_app_r
#print axioms Found.Pnp81.fa_map
#print axioms Found.Pnp81.fa_ins
#print axioms Found.Pnp81.callP_len
#print axioms Found.Pnp81.dbl_len
#print axioms Found.Pnp81.enc_len
#print axioms Found.Pnp81.q_len_le
#print axioms Found.Pnp81.Bn_mono
#print axioms Found.Pnp81.calld_bnd
#print axioms Found.Pnp81.callB_mono
lean_all/found/Pnp82.lean
/-
T332 piece (T330 file series) 82. found/Pnp82 -- the first search loop: the least length
bound (toward search-to-decision on the register machine, open lemma O5rm).
loop1P D = callP D followed by the glue
C: pop 22 (empty -> C + 3, 0 -> C + 1, 1 -> C + 3) C + 1: push 17 true C + 2: jmp 0
(C = |callP D|; targets relative to the loop start). With p = [] in register 18 it asks the
decider about q k = enc z (enc [] (tr k)) for k, k + 1, ... and leaves at the first k with a
yes. Proved:
* loop1_run: if D decides L, L (q n) holds and the loop starts at k with k + d = n, then
it leaves at o + (C + 3) with register 17 = tr k*, k <= k* <= n, L (q k*), the block
>= 32 empty, registers 18, 19, 21, 22 as at the start and the other registers below 32
kept, within (d + 1) (callB D eD S + 3) steps whenever n + |z| <= S.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp81
namespace Found.Pnp82
open Found.Pnp3 (PE pe)
open Found.Pnp20 (Ins upd upd_same upd_other nthI revApp)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp23 (appI tr)
open Found.Pnp4 (enc)
open Found.Pnp70 (run1_push run1_jmp run1_pop_cons)
open Found.Pnp74 (lt32)
open Found.Pnp80 (callP nB calld_run)
open Found.Pnp81 (FragAbs fa_frag fa_app_l fa_app_r fa_ins callP_len callB calld_bnd)
open Found.Owf4 (DecRM)
def glue1 (C : Nat) : List Ins := [.pop 22 (C + 3) (C + 1) (C + 3), .push 17 true, .jmp 0]
def loop1P (D : List Ins) : List Ins := appI (callP D) (glue1 (callP D).length)
/-- The loop state at k. -/
structure St1 (x : Nat -> List Bool) (k : Nat) (z : List Bool) : Prop where
r17 : x 17 = tr k
r18 : x 18 = revApp [] []
r19 : x 19 = revApp z []
r21 : x 21 = []
r22 : x 22 = []
blk : forall i, x (i + 32) = []
theorem exit_eq (o : Nat) (D : List Ins) : o + 44 + D.length + 4 + nB D = o + (callP D).length := by
rw [callP_len, ← Nat.add_assoc o (44 + D.length + 4) (nB D), ← Nat.add_assoc o (44 + D.length) 4,
← Nat.add_assoc o 44 D.length]
theorem le_mulS (d X : Nat) : X <= (d + 1) * X := by
rw [Nat.succ_mul]; exact Nat.le_add_left X _
theorem loop1_run (prog : List Ins) (o : Nat) (D : List Ins) (eD : PE) (L : List Bool -> Bool)
(hD : DecRM D eD L) (hf : Frag prog o (loop1P D)) (z : List Bool) (n S : Nat) (hS : n + z.length <= S)
(hn : L (enc z (enc [] (tr n))) = true) :
forall d k (x : Nat -> List Bool), k + d = n -> St1 x k z ->
Exists fun N => Exists fun y => Exists fun ks =>
k <= ks /\ ks <= n /\ L (enc z (enc [] (tr ks))) = true /\ St1 y ks z /\
N <= (d + 1) * (callB D eD S + 3) /\ Runs prog N o x (o + ((callP D).length + 3)) y /\
(forall i, i < 32 -> Nat.beq i 17 = false -> Nat.beq i 18 = false -> Nat.beq i 19 = false ->
Nat.beq i 21 = false -> Nat.beq i 22 = false -> y i = x i) := by
have fa := fa_frag prog o _ hf
have fc : Frag prog o (callP D) := fa_app_l prog o o _ _ fa
have fg := fa_app_r prog o o _ _ fa
have i0 : nthI prog (o + (callP D).length) =
some (.pop 22 (o + ((callP D).length + 3)) (o + ((callP D).length + 1)) (o + ((callP D).length + 3))) :=
fa_ins prog o _ _ fg 0 _ rfl
have i1 : nthI prog (o + (callP D).length + 1) = some (.push 17 true) := fa_ins prog o _ _ fg 1 _ rfl
have i2 : nthI prog (o + (callP D).length + 2) = some (.jmp o) := fa_ins prog o _ _ fg 2 _ rfl
intro d
induction d with
| zero =>
intro k x hk st
have ek : k = n := hk
cases calld_run prog o D eD L hD fc k [] z x st.r17 st.r18 st.r19 st.r21 st.blk with
| intro Nc hc =>
cases hc with
| intro y1 h1 =>
have hb := calld_bnd D eD k [] z S (by rw [ek]; exact hS) Nc h1.1
have r22 : y1 22 = true :: [] := by rw [h1.2.2.1, st.r22, ek, hn]
have s1 := run1_pop_cons prog (o + (callP D).length) 22 _ _ _ i0 y1 true [] r22
have s := runs_seq prog Nc 1 o (o + (callP D).length) _ x y1 _ (by rw [(exit_eq o D).symm]; exact h1.2.1) s1
refine Exists.intro _ (Exists.intro _ (Exists.intro k (And.intro (Nat.le_refl k) (And.intro (Nat.le_of_eq ek)
(And.intro (by rw [ek]; exact hn) (And.intro ?_ (And.intro ?_ (And.intro s ?_))))))))
· exact St1.mk ((upd_other y1 22 17 [] rfl).trans h1.2.2.2.1) ((upd_other y1 22 18 [] rfl).trans h1.2.2.2.2.1)
((upd_other y1 22 19 [] rfl).trans h1.2.2.2.2.2.1) ((upd_other y1 22 21 [] rfl).trans h1.2.2.2.2.2.2.1)
(upd_same y1 22 []) (fun i => (upd_other y1 22 (i + 32) [] (Found.Pnp74.hi_lt 22 i (lt32 22 rfl))).trans
(h1.2.2.2.2.2.2.2.1 i))
· exact Nat.le_trans (Nat.add_le_add hb (Nat.le_add_left 1 2)) (le_mulS 0 _)
· intro i hi a b c e g
rw [upd_other y1 22 i [] g]
exact h1.2.2.2.2.2.2.2.2 i hi a b c e g
| succ d ih =>
intro k x hk st
have hkS : k + ([] : List Bool).length + z.length <= S :=
Nat.le_trans (Nat.add_le_add_right (Nat.le_trans (Nat.le_add_right k (d + 1)) (Nat.le_of_eq hk)) _) hS
cases calld_run prog o D eD L hD fc k [] z x st.r17 st.r18 st.r19 st.r21 st.blk with
| intro Nc hc =>
cases hc with
| intro y1 h1 =>
have hb := calld_bnd D eD k [] z S hkS Nc h1.1
have sc : Runs prog Nc o x (o + (callP D).length) y1 := by rw [(exit_eq o D).symm]; exact h1.2.1
cases hq : L (enc z (enc [] (tr k))) with
| true =>
have r22 : y1 22 = true :: [] := by rw [h1.2.2.1, st.r22, hq]
have s1 := run1_pop_cons prog (o + (callP D).length) 22 _ _ _ i0 y1 true [] r22
have s := runs_seq prog Nc 1 o (o + (callP D).length) _ x y1 _ sc s1
refine Exists.intro _ (Exists.intro _ (Exists.intro k (And.intro (Nat.le_refl k)
(And.intro (Nat.le_trans (Nat.le_add_right k (d + 1)) (Nat.le_of_eq hk))
(And.intro hq (And.intro ?_ (And.intro ?_ (And.intro s ?_))))))))
· exact St1.mk ((upd_other y1 22 17 [] rfl).trans h1.2.2.2.1) ((upd_other y1 22 18 [] rfl).trans h1.2.2.2.2.1)
((upd_other y1 22 19 [] rfl).trans h1.2.2.2.2.2.1) ((upd_other y1 22 21 [] rfl).trans h1.2.2.2.2.2.2.1)
(upd_same y1 22 []) (fun i => (upd_other y1 22 (i + 32) [] (Found.Pnp74.hi_lt 22 i (lt32 22 rfl))).trans
(h1.2.2.2.2.2.2.2.1 i))
· exact Nat.le_trans (Nat.add_le_add hb (Nat.le_add_left 1 2)) (le_mulS (d + 1) _)
· intro i hi a b c e g
rw [upd_other y1 22 i [] g]
exact h1.2.2.2.2.2.2.2.2 i hi a b c e g
| false =>
have r22 : y1 22 = false :: [] := by rw [h1.2.2.1, st.r22, hq]
have s1 := run1_pop_cons prog (o + (callP D).length) 22 _ _ _ i0 y1 false [] r22
have s2 := run1_push prog (o + (callP D).length + 1) 17 true i1 (upd y1 22 [])
have s3 := run1_jmp prog (o + (callP D).length + 2) o i2 (upd (upd y1 22 []) 17 (true :: upd y1 22 [] 17))
have s := runs_seq prog (Nc + 1 + 1) 1 o _ o x _ _
(runs_seq prog (Nc + 1) 1 o (o + (callP D).length + 1) _ x _ _
(runs_seq prog Nc 1 o (o + (callP D).length) _ x y1 _ sc s1) s2) s3
have st2 : St1 (upd (upd y1 22 []) 17 (true :: upd y1 22 [] 17)) (k + 1) z := by
refine St1.mk ?_ ?_ ?_ ?_ ?_ ?_
· rw [upd_same, upd_other y1 22 17 [] rfl, h1.2.2.2.1]; rfl
· rw [upd_other _ 17 18 _ rfl, upd_other y1 22 18 [] rfl]; exact h1.2.2.2.2.1
· rw [upd_other _ 17 19 _ rfl, upd_other y1 22 19 [] rfl]; exact h1.2.2.2.2.2.1
· rw [upd_other _ 17 21 _ rfl, upd_other y1 22 21 [] rfl]; exact h1.2.2.2.2.2.2.1
· rw [upd_other _ 17 22 _ rfl, upd_same]
· intro i
rw [upd_other _ 17 (i + 32) _ (Found.Pnp74.hi_lt 17 i (lt32 17 rfl)),
upd_other y1 22 (i + 32) [] (Found.Pnp74.hi_lt 22 i (lt32 22 rfl))]
exact h1.2.2.2.2.2.2.2.1 i
have hk' : k + 1 + d = n := by rw [Nat.add_right_comm, Nat.add_assoc]; exact hk
cases ih (k + 1) _ hk' st2 with
| intro N hN =>
cases hN with
| intro y hy =>
cases hy with
| intro ks hks =>
have s' := runs_seq prog _ N o o _ x _ y s hks.2.2.2.2.2.1
refine Exists.intro _ (Exists.intro y (Exists.intro ks (And.intro (Nat.le_of_succ_le hks.1)
(And.intro hks.2.1 (And.intro hks.2.2.1 (And.intro hks.2.2.2.1 (And.intro ?_ (And.intro s' ?_))))))))
· rw [Nat.succ_mul (d + 1), Nat.add_comm ((d + 1) * (callB D eD S + 3)) (callB D eD S + 3)]
exact Nat.add_le_add (Nat.add_le_add_right hb 3) hks.2.2.2.2.1
· intro i hi a b c e g
rw [hks.2.2.2.2.2.2 i hi a b c e g, upd_other _ 17 i _ a, upd_other y1 22 i [] g]
exact h1.2.2.2.2.2.2.2.2 i hi a b c e g
end Found.Pnp82
#print axioms Found.Pnp82.exit_eq
#print axioms Found.Pnp82.le_mulS
#print axioms Found.Pnp82.loop1_run
lean_all/found/Pnp83.lean
/-
T332 piece (T330 file series) 83. found/Pnp83 -- the second search loop: its layout and
its first half (toward search-to-decision on the register machine, open lemma O5rm).
With C = |callP D|, loop2P D is (offsets from the loop start):
0: MOVE 17 23 (5) 5: callP D C + 5: MOVE 23 17 (5)
C + 10: pop 22 (empty -> E, 0 -> C + 11, 1 -> E) C + 11: pop 17 (empty -> E, else C + 12)
C + 12: push 18 false C + 13: callP D
C + C + 13: pop 22 (empty -> 0, 0 -> C + C + 14, 1 -> 0) C + C + 14: pop 18 (-> C + C + 15)
C + C + 15: push 18 true C + C + 16: jmp 0 exit E = C + C + 17.
Register 17 holds k, 18 holds p reversed, 23 is a save register for k. The first half asks
the decider about (p, 0) with k saved in 23. Proved:
* lp_frags: where the fragments and glue instructions of loop2P stand;
* revApp_snoc: revApp (p ++ [b]) [] = b :: revApp p [];
* head_run: from the loop state St2 at (k, p), the first half ends at o + (C + 10) with
22 = [L (q p 0)], 17 = tr k again, the rest of the state kept, within
(3 k + 1) + callB S + (3 k + 1) steps (|p| + |z| <= S).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp82
namespace Found.Pnp83
open Found.Pnp3 (PE pe)
open Found.Pnp20 (Ins upd upd_same upd_other nthI revApp move)
open Found.Pnp21 (Frag Runs runs_seq shift)
open Found.Pnp23 (appI mapI tr tr_len revApp_tr app_nil'')
open Found.Pnp4 (enc)
open Found.Pnp74 (move_spec lt32 hi_lt mapI_len revApp_len)
open Found.Pnp75 (revApp_nil2)
open Found.Pnp80 (callP nB calld_run)
open Found.Pnp81 (FragAbs fa_frag fa_app_l fa_app_r fa_map fa_ins callB calld_bnd)
open Found.Pnp82 (exit_eq)
open Found.Owf4 (DecRM)
def glueA (C : Nat) : List Ins :=
[.pop 22 (C + C + 17) (C + 11) (C + C + 17), .pop 17 (C + C + 17) (C + 12) (C + 12), .push 18 false]
def glueB (C : Nat) : List Ins :=
[.pop 22 0 (C + C + 14) 0, .pop 18 (C + C + 15) (C + C + 15) (C + C + 15), .push 18 true, .jmp 0]
def loop2P (D : List Ins) : List Ins :=
appI (move 17 23) (appI (mapI (shift 5) (callP D)) (appI (mapI (shift ((callP D).length + 5)) (move 23 17))
(appI (glueA (callP D).length) (appI (mapI (shift ((callP D).length + 13)) (callP D)) (glueB (callP D).length)))))
/-- Where everything stands, C = |callP D|. -/
structure LpAt (prog : List Ins) (o : Nat) (D : List Ins) : Prop where
m1 : Frag prog o (move 17 23)
c1 : Frag prog (o + 5) (callP D)
m2 : Frag prog (o + ((callP D).length + 5)) (move 23 17)
a0 : nthI prog (o + ((callP D).length + 10)) =
some (.pop 22 (o + ((callP D).length + (callP D).length + 17)) (o + ((callP D).length + 11))
(o + ((callP D).length + (callP D).length + 17)))
a1 : nthI prog (o + ((callP D).length + 11)) =
some (.pop 17 (o + ((callP D).length + (callP D).length + 17)) (o + ((callP D).length + 12))
(o + ((callP D).length + 12)))
a2 : nthI prog (o + ((callP D).length + 12)) = some (.push 18 false)
c2 : Frag prog (o + ((callP D).length + 13)) (callP D)
b0 : nthI prog (o + ((callP D).length + (callP D).length + 13)) =
some (.pop 22 (o + 0) (o + ((callP D).length + (callP D).length + 14)) (o + 0))
b1 : nthI prog (o + ((callP D).length + (callP D).length + 14)) =
some (.pop 18 (o + ((callP D).length + (callP D).length + 15)) (o + ((callP D).length + (callP D).length + 15))
(o + ((callP D).length + (callP D).length + 15)))
b2 : nthI prog (o + ((callP D).length + (callP D).length + 15)) = some (.push 18 true)
b3 : nthI prog (o + ((callP D).length + (callP D).length + 16)) = some (.jmp (o + 0))
theorem fa_base (prog : List Ins) (o b b' : Nat) (R : List Ins) (h : FragAbs prog o b R) (e : b = b') :
FragAbs prog o b' R := by
rw [e.symm]; exact h
theorem lp_frags (prog : List Ins) (o : Nat) (D : List Ins) (hf : Frag prog o (loop2P D)) : LpAt prog o D := by
have fa := fa_frag prog o _ hf
have r1 := fa_app_r prog o o _ _ fa
have r2 := fa_app_r prog o _ _ _ r1
have r2' := fa_base prog o _ (o + ((callP D).length + 5)) _ r2 (by
show o + 5 + (mapI (shift 5) (callP D)).length = o + ((callP D).length + 5)
rw [mapI_len, Nat.add_assoc, Nat.add_comm 5 (callP D).length])
have r3 := fa_app_r prog o _ _ _ r2'
have r4 := fa_app_r prog o _ _ _ r3
have r5 := fa_app_r prog o _ _ _ r4
have r5' := fa_base prog o _ (o + ((callP D).length + (callP D).length + 13)) _ r5 (by
show o + ((callP D).length + 13) + (mapI (shift ((callP D).length + 13)) (callP D)).length =
o + ((callP D).length + (callP D).length + 13)
rw [mapI_len, Nat.add_assoc, Nat.add_right_comm (callP D).length 13 (callP D).length])
have ga := fa_app_l prog o _ _ _ r4
exact LpAt.mk
(fa_app_l prog o o _ _ fa)
(fa_map prog o (o + 5) 5 _ (fa_app_l prog o _ _ _ r1) rfl)
(fa_map prog o _ _ _ (fa_app_l prog o _ _ _ r2') rfl)
(fa_ins prog o _ _ (fa_app_l prog o _ _ _ r3) 0 _ rfl)
(fa_ins prog o _ _ (fa_app_l prog o _ _ _ r3) 1 _ rfl)
(fa_ins prog o _ _ (fa_app_l prog o _ _ _ r3) 2 _ rfl)
(fa_map prog o _ _ _ ga rfl)
(fa_ins prog o _ _ r5' 0 _ rfl)
(fa_ins prog o _ _ r5' 1 _ rfl)
(fa_ins prog o _ _ r5' 2 _ rfl)
(fa_ins prog o _ _ r5' 3 _ rfl)
theorem revApp_snoc : forall (p : List Bool) (b : Bool) (m : List Bool), revApp (p ++ [b]) m = b :: revApp p m
| [], _, _ => rfl
| c :: p, b, m => revApp_snoc p b (c :: m)
/-- The state of the second loop at (k, p). -/
structure St2 (x : Nat -> List Bool) (k : Nat) (p z : List Bool) : Prop where
r17 : x 17 = tr k
r18 : x 18 = revApp p []
r19 : x 19 = revApp z []
r21 : x 21 = []
r22 : x 22 = []
r23 : x 23 = []
blk : forall i, x (i + 32) = []
/-- The frame: registers below 32 other than 17, 18, 19, 21, 22, 23. -/
def Fr (y x : Nat -> List Bool) : Prop :=
forall i, i < 32 -> Nat.beq i 17 = false -> Nat.beq i 18 = false -> Nat.beq i 19 = false ->
Nat.beq i 21 = false -> Nat.beq i 22 = false -> Nat.beq i 23 = false -> y i = x i
theorem head_run (prog : List Ins) (o : Nat) (D : List Ins) (eD : PE) (L : List Bool -> Bool)
(hD : DecRM D eD L) (lp : LpAt prog o D) (z : List Bool) (S : Nat) (k : Nat) (p : List Bool)
(hS : p.length + z.length <= S) (x : Nat -> List Bool) (st : St2 x k p z) :
Exists fun N => Exists fun y => N <= (3 * k + 1) + callB D eD S + (3 * k + 1) /\
Runs prog N o x (o + ((callP D).length + 10)) y /\ y 22 = L (enc z (enc p (tr 0))) :: [] /\
y 17 = tr k /\ y 18 = revApp p [] /\ y 19 = revApp z [] /\ y 21 = [] /\ y 23 = [] /\
(forall i, y (i + 32) = []) /\ Fr y x := by
cases move_spec prog o 17 23 lp.m1 rfl (tr k) [] x st.r17 st.r23 with
| intro y1 h1 =>
have q17 : y1 17 = tr 0 := h1.2.1
have q18 : y1 18 = revApp p [] := (h1.2.2.2 18 rfl rfl).trans st.r18
have q19 : y1 19 = revApp z [] := (h1.2.2.2 19 rfl rfl).trans st.r19
have q21 : y1 21 = [] := (h1.2.2.2 21 rfl rfl).trans st.r21
have qb : forall i, y1 (i + 32) = [] := fun i =>
(h1.2.2.2 (i + 32) (hi_lt 17 i (lt32 17 rfl)) (hi_lt 23 i (lt32 23 rfl))).trans (st.blk i)
cases calld_run prog (o + 5) D eD L hD lp.c1 0 p z y1 q17 q18 q19 q21 qb with
| intro Nc hc =>
cases hc with
| intro y2 h2 =>
have sc : Runs prog Nc (o + 5) y1 (o + ((callP D).length + 5)) y2 := by
have e := h2.2.1
rw [exit_eq, Nat.add_assoc, Nat.add_comm 5 (callP D).length] at e
exact e
have q23 : y2 23 = revApp (tr k) [] := (h2.2.2.2.2.2.2.2.2 23 (lt32 23 rfl) rfl rfl rfl rfl rfl).trans h1.2.2.1
cases move_spec prog (o + ((callP D).length + 5)) 23 17 lp.m2 rfl _ _ y2 q23 h2.2.2.2.1 with
| intro y3 h3 =>
have s := runs_seq prog _ _ o (o + ((callP D).length + 5)) (o + ((callP D).length + 10)) x y2 y3
(runs_seq prog _ Nc o (o + 5) _ x y1 y2 h1.1 sc) h3.1
have hb := calld_bnd D eD 0 p z S (by rw [Nat.zero_add]; exact hS) Nc h2.1
refine Exists.intro _ (Exists.intro y3 (And.intro ?_ (And.intro s ?_)))
· have l1 : (revApp (tr k) []).length = k := by rw [revApp_len, tr_len]; rfl
rw [tr_len, l1]
exact Nat.add_le_add (Nat.add_le_add_left hb _) (Nat.le_refl _)
· refine And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro ?_ (And.intro h3.2.1 (And.intro ?_ ?_))))))
· rw [h3.2.2.2 22 rfl rfl, h2.2.2.1, (h1.2.2.2 22 rfl rfl).trans st.r22]
· rw [h3.2.2.1]; exact revApp_nil2 (tr k)
· rw [h3.2.2.2 18 rfl rfl]; exact h2.2.2.2.2.1
· rw [h3.2.2.2 19 rfl rfl]; exact h2.2.2.2.2.2.1
· rw [h3.2.2.2 21 rfl rfl]; exact h2.2.2.2.2.2.2.1
· intro i
rw [h3.2.2.2 (i + 32) (hi_lt 23 i (lt32 23 rfl)) (hi_lt 17 i (lt32 17 rfl))]
exact h2.2.2.2.2.2.2.2.1 i
· intro i hi a b c d e g
rw [h3.2.2.2 i g a, h2.2.2.2.2.2.2.2.2 i hi a b c d e, h1.2.2.2 i a g]
end Found.Pnp83
#print axioms Found.Pnp83.fa_base
#print axioms Found.Pnp83.lp_frags
#print axioms Found.Pnp83.revApp_snoc
#print axioms Found.Pnp83.head_run
lean_all/found/Pnp84.lean
/-
T332 piece (T330 file series) 84. found/Pnp84 -- the second search loop: extending the
prefix one bit at a time (toward search-to-decision on the register machine, open lemma
O5rm).
G p k: some s with |s| <= k has f (p ++ s) = z. When the decider answers L (q p k) = G p k
(Pnp76 lf_yes, lf_sound), loop2P (Pnp83) keeps G as an invariant: if (p, 0) is a yes, p is
a preimage and the loop leaves; otherwise k > 0 and the bit b of p ++ [b] is chosen by
asking (p ++ [false], k - 1). Proved:
* app_snoc_assoc, len_snoc, it_le, it_le1: list and step arithmetic;
* loop2_run: from St2 at (k, p) with |p| + k <= m and G p k, the loop leaves at
o + (C + C + 17) with register 18 = revApp p' [] for some p' with f p' = z (beqL),
|p'| <= m, register 19 kept, the block >= 32 empty and the frame kept, within
(k + 1) It steps, It = (3 m + 1) + callB S + (3 m + 1) + (callB S + 8), m + |z| <= S.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp83
namespace Found.Pnp84
open Found.Pnp3 (PE pe)
open Found.Pnp20 (Ins upd upd_same upd_other nthI revApp)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp23 (tr app_nil'')
open Found.Pnp4 (enc)
open Found.Pnp70 (run1_push run1_jmp run1_pop_cons)
open Found.Pnp74 (lt32 hi_lt)
open Found.Pnp76 (app_len)
open Found.Pnp80 (callP calld_run)
open Found.Pnp81 (callB calld_bnd)
open Found.Pnp82 (exit_eq)
open Found.Pnp83 (LpAt St2 Fr head_run revApp_snoc)
open Found.Owf1 (beqL)
open Found.Owf4 (DecRM)
theorem app_snoc_assoc : forall (p : List Bool) (b : Bool) (s : List Bool), (p ++ [b]) ++ s = p ++ (b :: s)
| [], _, _ => rfl
| c :: p, b, s => congrArg (fun t => c :: t) (app_snoc_assoc p b s)
theorem len_snoc (p : List Bool) (b : Bool) : (p ++ [b]).length = p.length + 1 := by
rw [app_len]; rfl
def It (D : List Ins) (eD : PE) (m S : Nat) : Nat :=
(3 * m + 1) + callB D eD S + (3 * m + 1) + (callB D eD S + 8)
theorem it_le (A B H CB : Nat) (hA : A <= H) (hB : B <= CB) : A + 1 + 1 + 1 + B + 1 + 1 + 1 + 1 <= H + (CB + 8) := by
show (A + 3 + B) + 4 <= (H + CB) + 8
rw [Nat.add_right_comm A 3 B]
exact Nat.le_succ_of_le (Nat.add_le_add_right (Nat.add_le_add_right (Nat.add_le_add hA hB) 3) 4)
theorem it_le1 (A B H CB : Nat) (hA : A <= H) (hB : B <= CB) : A + 1 + 1 + 1 + B + 1 <= H + (CB + 8) :=
Nat.le_trans (Nat.add_le_add_right (Nat.le_add_right _ 3) _) (it_le A B H CB hA hB)
theorem it_le0 (A H CB : Nat) (hA : A <= H) : A + 1 <= H + (CB + 8) :=
Nat.add_le_add hA (Nat.le_trans (Nat.le_add_left 1 7) (Nat.le_add_left 8 CB))
theorem k_le (m k : Nat) (p : List Bool) (h : p.length + k <= m) : k <= m := Nat.le_trans (Nat.le_add_left k _) h
theorem head_le (D : List Ins) (eD : PE) (m S k : Nat) (hk : k <= m) :
(3 * k + 1) + callB D eD S + (3 * k + 1) <= (3 * m + 1) + callB D eD S + (3 * m + 1) :=
Nat.add_le_add (Nat.add_le_add_right (Nat.add_le_add_right (Nat.mul_le_mul_left 3 hk) 1) _)
(Nat.add_le_add_right (Nat.mul_le_mul_left 3 hk) 1)
theorem loop2_run (prog : List Ins) (o : Nat) (D : List Ins) (eD : PE) (L : List Bool -> Bool)
(hD : DecRM D eD L) (lp : LpAt prog o D) (f : List Bool -> List Bool) (z : List Bool) (m S : Nat)
(hS : m + z.length <= S)
(hL1 : forall p k, (Exists fun s => s.length <= k /\ beqL z (f (p ++ s)) = true) ->
L (enc z (enc p (tr k))) = true)
(hL2 : forall p k, L (enc z (enc p (tr k))) = true ->
Exists fun s => s.length <= k /\ beqL z (f (p ++ s)) = true) :
forall k (p : List Bool) (x : Nat -> List Bool), p.length + k <= m -> St2 x k p z ->
(Exists fun s => s.length <= k /\ beqL z (f (p ++ s)) = true) ->
Exists fun N => Exists fun y => Exists fun p' : List Bool =>
N <= (k + 1) * It D eD m S /\ Runs prog N o x (o + ((callP D).length + (callP D).length + 17)) y /\
beqL z (f p') = true /\ y 18 = revApp p' [] /\ p'.length <= m /\ y 19 = revApp z [] /\
(forall i, y (i + 32) = []) /\ Fr y x := by
intro k
induction k with
| zero =>
intro p x hm st hG
have hpS : p.length + z.length <= S := Nat.le_trans (Nat.add_le_add_right hm _) hS
cases head_run prog o D eD L hD lp z S 0 p hpS x st with
| intro Nh hh =>
cases hh with
| intro y3 h3 =>
have hyes : L (enc z (enc p (tr 0))) = true := hL1 p 0 hG
rw [hyes] at h3
have s1 := run1_pop_cons prog _ 22 _ _ _ lp.a0 y3 true [] h3.2.2.1
have s := runs_seq prog Nh 1 o _ _ x y3 _ h3.2.1 s1
cases hG with
| intro s0 hs0 =>
have e0 : s0 = [] := by
cases s0 with
| nil => rfl
| cons b t => exact absurd hs0.1 (Nat.not_succ_le_zero _)
rw [e0, app_nil''] at hs0
refine Exists.intro _ (Exists.intro _ (Exists.intro p (And.intro ?_ (And.intro s (And.intro hs0.2
(And.intro ?_ (And.intro (Nat.le_trans (Nat.le_add_right _ 0) hm) (And.intro ?_ (And.intro ?_ ?_)))))))))
· rw [Nat.zero_add, Nat.one_mul]
exact it_le0 _ _ _ (head_le D eD m S 0 (Nat.zero_le m) |> Nat.le_trans h3.1)
· rw [upd_other y3 22 18 [] rfl]; exact h3.2.2.2.2.1
· rw [upd_other y3 22 19 [] rfl]; exact h3.2.2.2.2.2.1
· intro i; rw [upd_other y3 22 (i + 32) [] (hi_lt 22 i (lt32 22 rfl))]; exact h3.2.2.2.2.2.2.2.2.1 i
· intro i hi a b c d e g; rw [upd_other y3 22 i [] e]; exact h3.2.2.2.2.2.2.2.2.2 i hi a b c d e g
| succ k ih =>
intro p x hm st hG
have hk : k + 1 <= m := k_le m (k + 1) p hm
have hpS : p.length + z.length <= S :=
Nat.le_trans (Nat.add_le_add_right (Nat.le_trans (Nat.le_add_right _ _) hm) _) hS
cases head_run prog o D eD L hD lp z S (k + 1) p hpS x st with
| intro Nh hh =>
cases hh with
| intro y3 h3 =>
have hNh := Nat.le_trans h3.1 (head_le D eD m S (k + 1) hk)
cases hq0 : L (enc z (enc p (tr 0))) with
| true =>
rw [hq0] at h3
have s1 := run1_pop_cons prog _ 22 _ _ _ lp.a0 y3 true [] h3.2.2.1
have s := runs_seq prog Nh 1 o _ _ x y3 _ h3.2.1 s1
cases hL2 p 0 hq0 with
| intro s0 hs0 =>
have e0 : s0 = [] := by
cases s0 with
| nil => rfl
| cons b t => exact absurd hs0.1 (Nat.not_succ_le_zero _)
rw [e0, app_nil''] at hs0
refine Exists.intro _ (Exists.intro _ (Exists.intro p (And.intro ?_ (And.intro s (And.intro hs0.2
(And.intro ?_ (And.intro (Nat.le_trans (Nat.le_add_right _ _) hm) (And.intro ?_ (And.intro ?_ ?_)))))))))
· exact Nat.le_trans (it_le0 _ _ _ hNh) (Found.Pnp82.le_mulS (k + 1) _)
· rw [upd_other y3 22 18 [] rfl]; exact h3.2.2.2.2.1
· rw [upd_other y3 22 19 [] rfl]; exact h3.2.2.2.2.2.1
· intro i; rw [upd_other y3 22 (i + 32) [] (hi_lt 22 i (lt32 22 rfl))]; exact h3.2.2.2.2.2.2.2.2.1 i
· intro i hi a b c d e g; rw [upd_other y3 22 i [] e]; exact h3.2.2.2.2.2.2.2.2.2 i hi a b c d e g
| false =>
rw [hq0] at h3
-- pop 22, pop 17, push 18 false
have s1 := run1_pop_cons prog _ 22 _ _ _ lp.a0 y3 false [] h3.2.2.1
have w17 : upd y3 22 [] 17 = true :: tr k := by rw [upd_other y3 22 17 [] rfl]; exact h3.2.2.2.1
have s2 := run1_pop_cons prog _ 17 _ _ _ lp.a1 (upd y3 22 []) true (tr k) w17
have s3 := run1_push prog _ 18 false lp.a2 (upd (upd y3 22 []) 17 (tr k))
-- the state before the second call
have v17 : upd (upd (upd y3 22 []) 17 (tr k)) 18 (false :: upd (upd y3 22 []) 17 (tr k) 18) 17 = tr k := by
rw [upd_other _ 18 17 _ rfl, upd_same]
have v18 : upd (upd (upd y3 22 []) 17 (tr k)) 18 (false :: upd (upd y3 22 []) 17 (tr k) 18) 18 =
revApp (p ++ [false]) [] := by
rw [upd_same, upd_other _ 17 18 _ rfl, upd_other y3 22 18 [] rfl, h3.2.2.2.2.1, revApp_snoc]
have v19 : upd (upd (upd y3 22 []) 17 (tr k)) 18 (false :: upd (upd y3 22 []) 17 (tr k) 18) 19 = revApp z [] := by
rw [upd_other _ 18 19 _ rfl, upd_other _ 17 19 _ rfl, upd_other y3 22 19 [] rfl]; exact h3.2.2.2.2.2.1
have v21 : upd (upd (upd y3 22 []) 17 (tr k)) 18 (false :: upd (upd y3 22 []) 17 (tr k) 18) 21 = [] := by
rw [upd_other _ 18 21 _ rfl, upd_other _ 17 21 _ rfl, upd_other y3 22 21 [] rfl]; exact h3.2.2.2.2.2.2.1
have vb : forall i, upd (upd (upd y3 22 []) 17 (tr k)) 18 (false :: upd (upd y3 22 []) 17 (tr k) 18) (i + 32) = [] := by
intro i
rw [upd_other _ 18 _ _ (hi_lt 18 i (lt32 18 rfl)), upd_other _ 17 _ _ (hi_lt 17 i (lt32 17 rfl)),
upd_other y3 22 _ [] (hi_lt 22 i (lt32 22 rfl))]
exact h3.2.2.2.2.2.2.2.2.1 i
cases calld_run prog _ D eD L hD lp.c2 k (p ++ [false]) z _ v17 v18 v19 v21 vb with
| intro Nc hc =>
cases hc with
| intro y4 h4 =>
have hmS : k + (p ++ [false]).length + z.length <= S := by
rw [len_snoc]
refine Nat.le_trans (Nat.add_le_add_right (Nat.le_of_eq ?_) _) (Nat.le_trans (Nat.add_le_add_right hm _) hS)
rw [Nat.add_comm k, Nat.add_assoc, Nat.add_comm 1 k]
have hNc := calld_bnd D eD k (p ++ [false]) z S hmS Nc h4.1
have sc : Runs prog Nc (o + ((callP D).length + 13))
(upd (upd (upd y3 22 []) 17 (tr k)) 18 (false :: upd (upd y3 22 []) 17 (tr k) 18)) (o + ((callP D).length + (callP D).length + 13)) y4 := by
have e := h4.2.1
rw [exit_eq, Nat.add_assoc, Nat.add_right_comm (callP D).length 13 (callP D).length] at e
exact e
have s4 := runs_seq prog (Nh + 1 + 1 + 1) Nc o _ _ x _ y4
(runs_seq prog (Nh + 1 + 1) 1 o _ _ x _ _ (runs_seq prog (Nh + 1) 1 o _ _ x _ _
(runs_seq prog Nh 1 o _ _ x y3 _ h3.2.1 s1) s2) s3) sc
have q22 : y4 22 = L (enc z (enc (p ++ [false]) (tr k))) :: [] := by
rw [h4.2.2.1, upd_other _ 18 22 _ rfl, upd_other _ 17 22 _ rfl, upd_same]
-- registers of y4 that the next round needs
have y23 : y4 23 = [] := by
rw [h4.2.2.2.2.2.2.2.2 23 (lt32 23 rfl) rfl rfl rfl rfl rfl, upd_other _ 18 23 _ rfl,
upd_other _ 17 23 _ rfl, upd_other y3 22 23 [] rfl]
exact h3.2.2.2.2.2.2.2.1
have frY4 : Fr y4 x := by
intro i hi a b c d e g
rw [h4.2.2.2.2.2.2.2.2 i hi a b c d e, upd_other _ 18 i _ b, upd_other _ 17 i _ a, upd_other y3 22 i [] e]
exact h3.2.2.2.2.2.2.2.2.2 i hi a b c d e g
-- the invariant gives a nonempty extension
cases hG with
| intro s0 hs0 =>
cases s0 with
| nil =>
rw [app_nil''] at hs0
have hy : L (enc z (enc p (tr 0))) = true :=
hL1 p 0 (Exists.intro [] (And.intro (Nat.le_refl 0) (by rw [app_nil'']; exact hs0.2)))
rw [hq0] at hy
exact Bool.noConfusion hy
| cons b s' =>
have hs' : s'.length <= k := Nat.le_of_succ_le_succ hs0.1
have hlen : (p ++ [false]).length + k <= m := by
rw [len_snoc, Nat.add_assoc, Nat.add_comm 1 k]; exact hm
have hlen' : (p ++ [true]).length + k <= m := by
rw [len_snoc, Nat.add_assoc, Nat.add_comm 1 k]; exact hm
cases hq1 : L (enc z (enc (p ++ [false]) (tr k))) with
| true =>
rw [hq1] at q22
have s5 := run1_pop_cons prog _ 22 _ _ _ lp.b0 y4 true [] q22
have s := runs_seq prog _ 1 o _ (o + 0) x y4 _ s4 s5
have st' : St2 (upd y4 22 []) k (p ++ [false]) z := by
refine St2.mk ?_ ?_ ?_ ?_ (upd_same y4 22 []) ?_ ?_
· rw [upd_other y4 22 17 [] rfl]; exact h4.2.2.2.1
· rw [upd_other y4 22 18 [] rfl]; exact h4.2.2.2.2.1
· rw [upd_other y4 22 19 [] rfl]; exact h4.2.2.2.2.2.1
· rw [upd_other y4 22 21 [] rfl]; exact h4.2.2.2.2.2.2.1
· rw [upd_other y4 22 23 [] rfl]; exact y23
· intro i; rw [upd_other y4 22 (i + 32) [] (hi_lt 22 i (lt32 22 rfl))]; exact h4.2.2.2.2.2.2.2.1 i
cases ih (p ++ [false]) (upd y4 22 []) hlen st' (hL2 _ _ hq1) with
| intro N hN =>
cases hN with
| intro y hy =>
cases hy with
| intro p' hp' =>
have s' := runs_seq prog _ N o o _ x _ y s hp'.2.1
refine Exists.intro _ (Exists.intro y (Exists.intro p' (And.intro ?_ (And.intro s' (And.intro hp'.2.2.1
(And.intro hp'.2.2.2.1 (And.intro hp'.2.2.2.2.1 (And.intro hp'.2.2.2.2.2.1 (And.intro hp'.2.2.2.2.2.2.1 ?_)))))))))
· rw [Nat.succ_mul (k + 1), Nat.add_comm ((k + 1) * It D eD m S) (It D eD m S)]
exact Nat.add_le_add (it_le1 _ _ _ _ hNh hNc) hp'.1
· intro i hi a b c d e g
rw [hp'.2.2.2.2.2.2.2 i hi a b c d e g, upd_other y4 22 i [] e]
exact frY4 i hi a b c d e g
| false =>
rw [hq1] at q22
have s5 := run1_pop_cons prog _ 22 _ _ _ lp.b0 y4 false [] q22
have r18 : upd y4 22 [] 18 = false :: revApp p [] := by
rw [upd_other y4 22 18 [] rfl, h4.2.2.2.2.1, revApp_snoc]
have s6 := run1_pop_cons prog _ 18 _ _ _ lp.b1 (upd y4 22 []) false (revApp p []) r18
have s7 := run1_push prog _ 18 true lp.b2 (upd (upd y4 22 []) 18 (revApp p []))
have s8 := run1_jmp prog _ (o + 0) lp.b3
(upd (upd (upd y4 22 []) 18 (revApp p [])) 18 (true :: upd (upd y4 22 []) 18 (revApp p []) 18))
have s := runs_seq prog _ 1 o _ (o + 0) x _ _ (runs_seq prog _ 1 o _ _ x _ _
(runs_seq prog _ 1 o _ _ x _ _ (runs_seq prog _ 1 o _ _ x y4 _ s4 s5) s6) s7) s8
-- the bit is true
have hb : b = true := by
cases b with
| true => rfl
| false =>
have hy := hL1 (p ++ [false]) k (Exists.intro s' (And.intro hs' (by rw [app_snoc_assoc]; exact hs0.2)))
rw [hq1] at hy
exact Bool.noConfusion hy
rw [hb] at hs0
have w : forall i, Nat.beq i 18 = false -> Nat.beq i 22 = false ->
upd (upd (upd y4 22 []) 18 (revApp p [])) 18 (true :: upd (upd y4 22 []) 18 (revApp p []) 18) i = y4 i := by
intro i a e
rw [upd_other _ 18 i _ a, upd_other _ 18 i _ a, upd_other y4 22 i [] e]
have st' : St2 (upd (upd (upd y4 22 []) 18 (revApp p [])) 18 (true :: upd (upd y4 22 []) 18 (revApp p []) 18))
k (p ++ [true]) z := by
refine St2.mk ?_ ?_ ?_ ?_ ?_ ?_ ?_
· rw [w 17 rfl rfl]; exact h4.2.2.2.1
· rw [upd_same, upd_same, revApp_snoc]
· rw [w 19 rfl rfl]; exact h4.2.2.2.2.2.1
· rw [w 21 rfl rfl]; exact h4.2.2.2.2.2.2.1
· rw [upd_other _ 18 22 _ rfl, upd_other _ 18 22 _ rfl, upd_same]
· rw [w 23 rfl rfl]; exact y23
· intro i
rw [w (i + 32) (hi_lt 18 i (lt32 18 rfl)) (hi_lt 22 i (lt32 22 rfl))]
exact h4.2.2.2.2.2.2.2.1 i
cases ih (p ++ [true]) _ hlen' st'
(Exists.intro s' (And.intro hs' (by rw [app_snoc_assoc]; exact hs0.2))) with
| intro N hN =>
cases hN with
| intro y hy =>
cases hy with
| intro p' hp' =>
have s' := runs_seq prog _ N o o _ x _ y s hp'.2.1
refine Exists.intro _ (Exists.intro y (Exists.intro p' (And.intro ?_ (And.intro s' (And.intro hp'.2.2.1
(And.intro hp'.2.2.2.1 (And.intro hp'.2.2.2.2.1 (And.intro hp'.2.2.2.2.2.1 (And.intro hp'.2.2.2.2.2.2.1 ?_)))))))))
· rw [Nat.succ_mul (k + 1), Nat.add_comm ((k + 1) * It D eD m S) (It D eD m S)]
exact Nat.add_le_add (it_le _ _ _ _ hNh hNc) hp'.1
· intro i hi a b c d e g
rw [hp'.2.2.2.2.2.2.2 i hi a b c d e g, w i b e]
exact frY4 i hi a b c d e g
end Found.Pnp84
#print axioms Found.Pnp84.app_snoc_assoc
#print axioms Found.Pnp84.len_snoc
#print axioms Found.Pnp84.it_le
#print axioms Found.Pnp84.it_le1
#print axioms Found.Pnp84.it_le0
#print axioms Found.Pnp84.k_le
#print axioms Found.Pnp84.head_le
#print axioms Found.Pnp84.loop2_run
lean_all/found/Pnp85.lean
/-
T332 piece (T330 file series) 85. found/Pnp85 -- the inverter program and its run
(toward search-to-decision on the register machine, open lemma O5rm).
invP D = MOVE 13 19; loop1P D (Pnp82); loop2P D (Pnp83, 84); MOVE 18 16.
On input z = f x it finds a least-ish length bound k* <= |x| with a preimage of length at
most k*, then extends a prefix to a preimage p' with f p' = z, and writes p' on register 16.
Proved:
* loop1_len, loop2_len: |loop1P D| = C + 3, |loop2P D| = C + C + 17;
* le_dest, nthI_len, run_stay: a run that has reached the end stays there;
* out_len: |f x| <= pe eF |x| when F computes f (Owf4.CompRM);
* inv_run: if D decides L_f (Pnp76) and F computes f, then for every x the inverter
reaches its end from inpR (f x) within an explicit bound in |x| and pe eF |x|, with
register 16 holding some p' with f p' = f x.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp84
namespace Found.Pnp85
open Found.Pnp3 (PE pe pe_mono)
open Found.Pnp20 (Ins Cfg upd upd_same upd_other nthI revApp move run)
open Found.Pnp21 (Frag Runs runs_seq)
open Found.Pnp23 (appI mapI tr app_nil'')
open Found.Pnp4 (enc)
open Found.Pnp59 (inpR inpR_13 inpR_other frag_self)
open Found.Pnp74 (seqI seqI_len fragHT move_spec lt32 hi_lt appI_len mapI_len revApp_len inpR_nil)
open Found.Pnp75 (revApp_nil2)
open Found.Pnp76 (Lf lf_yes lf_sound)
open Found.Pnp80 (callP)
open Found.Pnp81 (callB)
open Found.Pnp82 (loop1P glue1 St1 loop1_run)
open Found.Pnp83 (loop2P glueA glueB St2 Fr lp_frags)
open Found.Pnp84 (It loop2_run)
open Found.Owf1 (beqL)
open Found.Owf2 (beqL_refl beqL_eq)
open Found.Owf4 (DecRM CompRM)
def invP (D : List Ins) : List Ins := seqI (move 13 19) (seqI (loop1P D) (seqI (loop2P D) (move 18 16)))
theorem loop1_len (D : List Ins) : (loop1P D).length = (callP D).length + 3 := by
show (appI (callP D) (glue1 (callP D).length)).length = _
rw [appI_len]; rfl
theorem ar2 (n : Nat) : 5 + (n + (5 + (3 + (n + 4)))) = n + n + 17 := by
have h1 : 3 + (n + 4) = n + 7 := Nat.add_comm 3 (n + 4)
rw [h1]
have h2 : 5 + (n + 7) = n + 12 := Nat.add_comm 5 (n + 7)
rw [h2, Nat.add_comm 5 (n + (n + 12))]
rfl
theorem loop2_len (D : List Ins) : (loop2P D).length = (callP D).length + (callP D).length + 17 := by
unfold loop2P
rw [appI_len, appI_len, appI_len, appI_len, appI_len, mapI_len, mapI_len, mapI_len]
exact ar2 (callP D).length
theorem le_dest {n m : Nat} (h : n <= m) : Exists fun d => n + d = m := by
induction h with
| refl => exact Exists.intro 0 rfl
| step _ ih => cases ih with | intro d hd => exact Exists.intro (d + 1) (congrArg Nat.succ hd)
theorem nthI_len : forall p : List Ins, nthI p p.length = none
| [] => rfl
| _ :: p => nthI_len p
theorem run_stay (I : List Ins) (N t : Nat) (h : N <= t) (x y : Nat -> List Bool) (hr : Runs I N 0 x I.length y) :
(run I t (Cfg.mk 0 x)).pc = I.length /\ forall i, (run I t (Cfg.mk 0 x)).regs i = y i := by
cases le_dest h with
| intro d hd =>
rw [hd.symm, Found.Pnp20.run_add]
have e : nthI I (run I N (Cfg.mk 0 x)).pc = none := by rw [hr.1]; exact nthI_len I
rw [Found.Pnp72.run_halt I _ e d]
exact hr
theorem out_len (F : List Ins) (eF : PE) (f : List Bool -> List Bool) (hF : CompRM F eF f) (x : List Bool) :
(f x).length <= pe eF x.length := by
cases hF x with
| intro N hN =>
cases hN with
| intro y hy =>
have e : (run F N (Cfg.mk 0 (inpR x))).regs 16 = f x := (hy.2.1.2 16).trans hy.2.2.2
rw [e.symm]
exact Nat.le_trans (Found.Pnp77.len_run F 16 N _)
(Nat.le_trans (Nat.add_le_add_right (Nat.le_of_eq (congrArg List.length (inpR_other x 16 rfl))) N)
(Nat.le_trans (Nat.le_of_eq (Nat.zero_add N)) hy.1))
/-- The bound, with n = |x| and Z = pe eF |x|. -/
def invB (D : List Ins) (eD : PE) (n Z : Nat) : Nat :=
(3 * Z + 1) + (n + 1) * (callB D eD (n + Z) + 3) + (n + 1) * It D eD n (n + Z) + (3 * n + 1)
theorem inv_run (D : List Ins) (eD : PE) (F : List Ins) (eF : PE) (f : List Bool -> List Bool)
(hD : DecRM D eD (Lf f)) (hF : CompRM F eF f) (x : List Bool) :
Exists fun N => Exists fun y => Exists fun p' : List Bool =>
N <= invB D eD x.length (pe eF x.length) /\ Runs (invP D) N 0 (inpR (f x)) (invP D).length y /\
y 16 = p' /\ beqL (f x) (f p') = true := by
have hf0 := frag_self (invP D)
have g1 := fragHT (invP D) 0 (move 13 19) _ hf0
have g2 := fragHT (invP D) 5 (loop1P D) _ g1.2
have g3 := fragHT (invP D) (5 + (loop1P D).length) (loop2P D) _ g2.2
have hz := out_len F eF f hF x
-- MOVE 13 19
cases move_spec (invP D) 0 13 19 g1.1 rfl (f x) [] (inpR (f x)) (inpR_13 (f x)) rfl with
| intro y0 h0 =>
have st1 : St1 y0 0 (f x) := by
refine St1.mk ((h0.2.2.2 17 rfl rfl)) ((h0.2.2.2 18 rfl rfl)) h0.2.2.1 ((h0.2.2.2 21 rfl rfl))
((h0.2.2.2 22 rfl rfl)) ?_
intro i
rw [h0.2.2.2 (i + 32) (hi_lt 13 i (lt32 13 rfl)) (hi_lt 19 i (lt32 19 rfl))]
exact inpR_other _ _ (hi_lt 13 i (lt32 13 rfl))
have hn : Lf f (enc (f x) (enc [] (tr x.length))) = true :=
lf_yes f (f x) [] x x.length (Nat.le_refl _) (beqL_refl (f x))
have hS : x.length + (f x).length <= x.length + pe eF x.length := Nat.add_le_add_left hz _
cases loop1_run (invP D) 5 D eD (Lf f) hD g2.1 (f x) x.length _ hS hn x.length 0 y0 (Nat.zero_add _) st1 with
| intro N1 h1 =>
cases h1 with
| intro y1 h1 =>
cases h1 with
| intro ks hk =>
-- the second loop
have st2 : St2 y1 ks [] (f x) := by
refine St2.mk hk.2.2.2.1.r17 hk.2.2.2.1.r18 hk.2.2.2.1.r19 hk.2.2.2.1.r21 hk.2.2.2.1.r22 ?_ hk.2.2.2.1.blk
rw [hk.2.2.2.2.2.2 23 (lt32 23 rfl) rfl rfl rfl rfl rfl, h0.2.2.2 23 rfl rfl]
rfl
have lp := lp_frags (invP D) (5 + (loop1P D).length) D g3.1
have hG := lf_sound f (f x) [] ks hk.2.2.1
cases loop2_run (invP D) (5 + (loop1P D).length) D eD (Lf f) hD lp f (f x) x.length _ hS
(fun p k h => match h with
| Exists.intro s hs => lf_yes f (f x) p s k hs.1 hs.2)
(fun p k h => lf_sound f (f x) p k h) ks [] y1 (Nat.le_trans (Nat.le_of_eq (Nat.zero_add ks)) hk.2.1) st2 hG with
| intro N2 h2 =>
cases h2 with
| intro y2 h2 =>
cases h2 with
| intro p' hp =>
-- MOVE 18 16
have o4 : 5 + (loop1P D).length + (loop2P D).length = 5 + (loop1P D).length + ((callP D).length + (callP D).length + 17) := by
rw [loop2_len]
have g4 := g3.2
rw [o4] at g4
have y16 : y2 16 = [] := by
rw [hp.2.2.2.2.2.2.2 16 (lt32 16 rfl) rfl rfl rfl rfl rfl rfl,
hk.2.2.2.2.2.2 16 (lt32 16 rfl) rfl rfl rfl rfl rfl, h0.2.2.2 16 rfl rfl]
rfl
cases move_spec (invP D) _ 18 16 g4 rfl _ _ y2 hp.2.2.2.1 y16 with
| intro y3 h3 =>
have s1 : Runs (invP D) N1 5 y0 (5 + (loop1P D).length) y1 := by
rw [loop1_len]; exact hk.2.2.2.2.2.1
have s := runs_seq (invP D) _ _ 0 _ _ (inpR (f x)) y2 y3
(runs_seq (invP D) _ N2 0 _ _ (inpR (f x)) y1 y2
(runs_seq (invP D) _ N1 0 5 _ (inpR (f x)) y0 y1 h0.1 s1) hp.2.1) h3.1
have hlen : (invP D).length = 5 + (loop1P D).length + ((callP D).length + (callP D).length + 17) + 5 := by
show (seqI (move 13 19) (seqI (loop1P D) (seqI (loop2P D) (move 18 16)))).length = _
rw [seqI_len, seqI_len, seqI_len, loop2_len]
show 5 + ((loop1P D).length + ((callP D).length + (callP D).length + 17 + 5)) = _
rw [Nat.add_assoc 5 (loop1P D).length]
rfl
rw [hlen.symm] at s
refine Exists.intro _ (Exists.intro y3 (Exists.intro p' (And.intro ?_ (And.intro s (And.intro ?_ ?_)))))
· have m2 : N2 <= (x.length + 1) * It D eD x.length (x.length + pe eF x.length) :=
Nat.le_trans hp.1 (Nat.mul_le_mul_right _ (Nat.succ_le_succ hk.2.1))
have m4 : 3 * (revApp p' []).length + 1 <= 3 * x.length + 1 := by
rw [revApp_len]
exact Nat.add_le_add_right (Nat.mul_le_mul_left 3 hp.2.2.2.2.1) 1
exact Nat.add_le_add (Nat.add_le_add (Nat.add_le_add (Nat.add_le_add_right (Nat.mul_le_mul_left 3 hz) 1)
(hk.2.2.2.2.1)) m2) m4
· rw [h3.2.2.1]; exact revApp_nil2 p'
· have e := beqL_eq _ _ hp.2.2.1
rw [e]
exact beqL_refl _
end Found.Pnp85
#print axioms Found.Pnp85.loop1_len
#print axioms Found.Pnp85.ar2
#print axioms Found.Pnp85.loop2_len
#print axioms Found.Pnp85.le_dest
#print axioms Found.Pnp85.nthI_len
#print axioms Found.Pnp85.run_stay
#print axioms Found.Pnp85.out_len
#print axioms Found.Pnp85.inv_run
lean_all/found/Pnp86.lean
/-
T332 piece (T330 file series) 86. found/Pnp86 -- search-to-decision on the register
machine, and one-way functions give NP not inside P there (closes open lemma O5rm).
The bound of the inverter (Pnp85 invB) is a polynomial expression in |x| (Pnp3 PE, with
pe_comp for the decider's bound). Proved:
* callBE_eq, invBE_eq: the bounds as PE values;
* search_rm: if L_f (Pnp76) is decided in polynomial time and f is computed in polynomial
time, the inverter invP inverts f on every input within pe (invBE ..) |x| steps
(Owf4.SearchRM);
* s2drm: Owf4.S2DRM holds (O5rm);
* owf_p_ne_np: for every register-machine one-way function f (Owf4.OneWayRM),
NP_RM is not inside P_RM -- the hypothesis S2DRM of Owf4.owf_p_ne_np_rm is removed.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp85
namespace Found.Pnp86
open Found.Pnp3 (PE pe pe_comp comp)
open Found.Pnp20 (Ins Cfg run)
open Found.Pnp59 (inpR)
open Found.Pnp76 (Lf lf_inNP)
open Found.Pnp80 (nB)
open Found.Pnp81 (callB)
open Found.Pnp84 (It)
open Found.Pnp85 (invP invB inv_run run_stay)
open Found.Owf1 (beqL)
open Found.Owf2 (beqL_refl beqL_eq)
open Found.Owf4 (DecRM CompRM InPrm InNPrm SearchRM S2DRM OneWayRM resRM invOK owf_p_ne_np_rm)
def BnE (s : PE) : PE := .add (.add (.add (.add s s) s) s) (.c 4)
def B2 (eF : PE) : PE := BnE (.add (.add .x eF) (.add .x eF))
def callBE (D : List Ins) (eD eF : PE) : PE :=
.add (.add (.add (.add (.mul (.c 8) (B2 eF)) (.c 0)) (comp eD (B2 eF))) (.c 3))
(.mul (.c (nB D)) (.add (.add (B2 eF) (comp eD (B2 eF))) (.c 1)))
def invBE (D : List Ins) (eD eF : PE) : PE :=
.add (.add (.add (.add (.mul (.c 3) eF) (.c 1)) (.mul (.add .x (.c 1)) (.add (callBE D eD eF) (.c 3))))
(.mul (.add .x (.c 1)) (.add (.add (.add (.add (.mul (.c 3) .x) (.c 1)) (callBE D eD eF))
(.add (.mul (.c 3) .x) (.c 1))) (.add (callBE D eD eF) (.c 8)))))
(.add (.mul (.c 3) .x) (.c 1))
theorem callBE_eq (D : List Ins) (eD eF : PE) (n : Nat) :
pe (callBE D eD eF) n = callB D eD (n + pe eF n) := by
show 8 * pe (B2 eF) n + 0 + pe (comp eD (B2 eF)) n + 3 + nB D * (pe (B2 eF) n + pe (comp eD (B2 eF)) n + 1) = _
rw [pe_comp]
rfl
theorem invBE_eq (D : List Ins) (eD eF : PE) (n : Nat) :
pe (invBE D eD eF) n = invB D eD n (pe eF n) := by
show (3 * pe eF n + 1) + (n + 1) * (pe (callBE D eD eF) n + 3) +
(n + 1) * ((3 * n + 1) + pe (callBE D eD eF) n + (3 * n + 1) + (pe (callBE D eD eF) n + 8)) + (3 * n + 1) = _
rw [callBE_eq]
rfl
theorem search_rm (F : List Ins) (eF : PE) (f : List Bool -> List Bool) (hF : CompRM F eF f)
(D : List Ins) (eD : PE) (hD : DecRM D eD (Lf f)) : SearchRM f := by
refine Exists.intro (invP D) (Exists.intro (invBE D eD eF) (fun x => ?_))
cases inv_run D eD F eF f hD hF x with
| intro N hN =>
cases hN with
| intro y hy =>
cases hy with
| intro p' hp =>
have hle : N <= pe (invBE D eD eF) x.length := by rw [invBE_eq]; exact hp.1
have st := run_stay (invP D) N _ hle _ y hp.2.1
show invOK f x (Found.Owf4.selOL (Nat.beq (run (invP D) (pe (invBE D eD eF) x.length) (Cfg.mk 0 (inpR (f x)))).pc
(invP D).length) (some ((run (invP D) (pe (invBE D eD eF) x.length) (Cfg.mk 0 (inpR (f x)))).regs 16)) none) = true
rw [st.1, Found.Pnp20.beq_refl', st.2 16, hp.2.2.1]
show beqL (f p') (f x) = true
rw [beqL_eq _ _ hp.2.2.2]
exact beqL_refl _
/-- Search-to-decision on the register machine (open lemma O5rm). -/
theorem s2drm : S2DRM :=
fun hnp f hc =>
match hc with
| Exists.intro F (Exists.intro eF hF) =>
match hnp (Lf f) (lf_inNP F eF f hF) with
| Exists.intro D (Exists.intro eD hD) => search_rm F eF f hF D eD hD
/-- A register-machine one-way function gives NP_RM not inside P_RM. -/
theorem owf_p_ne_np (f : List Bool -> List Bool) (ho : OneWayRM f) :
(forall L, InNPrm L -> InPrm L) -> False :=
owf_p_ne_np_rm s2drm f ho
end Found.Pnp86
#print axioms Found.Pnp86.callBE_eq
#print axioms Found.Pnp86.invBE_eq
#print axioms Found.Pnp86.search_rm
#print axioms Found.Pnp86.s2drm
#print axioms Found.Pnp86.owf_p_ne_np
lean_all/found/Pnp87.lean
/-
T330 piece 87. found/Pnp87 -- assignments from pigeon maps, and the pigeonhole formula
under them (proof complexity ladder, step 1: general resolution; PNP_MAP.md).
A pigeon map g sends a pigeon i to some hole or to none; asgP n g gives x(i, j) = true
exactly when g i = some j (Pnp66 findIJ decodes a variable; other variables are false).
These are the assignments of the Haken / Beame--Pitassi argument (critical assignments are
the maps that are injective and send all pigeons but one). Proved:
* asg_var: asgP n g (var n i j) = optEq (g i) j for i < n + 1, j < n;
* evalCNF_app: evaluation of an appended CNF;
* pcl_true, pcl_false: the clause of pigeon i holds iff g i is some hole below n;
* holes_true: an injective map satisfies every hole clause of PHP(n + 1, n).
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp66
namespace Found.Pnp87
open Found.RootComp (Lit Clause CNF evalLit evalClause evalCNF)
open Found.Pnp65 (var var_inj)
open Found.Pnp66 (pcl pigeons hcl holesJ holes PHP findIJ findIJ_some findIJ_none)
def optEq : Option Nat -> Nat -> Bool
| none, _ => false
| some a, j => Nat.beq a j
def decA (g : Nat -> Option Nat) : Option (Nat × Nat) -> Bool
| none => false
| some p => optEq (g p.1) p.2
def asgP (n : Nat) (g : Nat -> Option Nat) (v : Nat) : Bool := decA g (findIJ n v (n + 1))
theorem asg_var (n : Nat) (g : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) (hj : j < n) :
asgP n g (var n i j) = optEq (g i) j := by
show decA g (findIJ n (var n i j) (n + 1)) = optEq (g i) j
cases e : findIJ n (var n i j) (n + 1) with
| none =>
have t := findIJ_none n _ (n + 1) e i j hi hj
rw [Found.Pnp62.beq_refl] at t
exact Bool.noConfusion t
| some p =>
cases p with
| mk i' j' =>
have t := findIJ_some n _ (n + 1) i' j' e
have u := var_inj n i' i j' j t.2.1 hj t.2.2
show optEq (g i') j' = optEq (g i) j
rw [u.1, u.2]
theorem optEq_some (a j : Nat) (h : optEq (some a) j = true) : a = j := Found.Pnp2.beq_eq a j h
theorem optEq_of (o : Option Nat) (j : Nat) (h : o = some j) : optEq o j = true := by
rw [h]; exact Found.Pnp62.beq_refl j
theorem evalCNF_app (a : Nat -> Bool) : forall F G : CNF, evalCNF a (F ++ G) = (evalCNF a F && evalCNF a G)
| [], _ => rfl
| C :: F, G => by
show (evalClause a C && evalCNF a (F ++ G)) = ((evalClause a C && evalCNF a F) && evalCNF a G)
rw [evalCNF_app a F G]
cases evalClause a C with
| false => rfl
| true => rfl
theorem and_true' {a b : Bool} (ha : a = true) (hb : b = true) : (a && b) = true := by rw [ha, hb]; rfl
theorem pcl_true (n : Nat) (g : Nat -> Option Nat) (i : Nat) (hi : i < n + 1) (j : Nat) (hgi : g i = some j) :
forall k, j < k -> k <= n -> evalClause (asgP n g) (pcl n i k) = true := by
intro k
induction k with
| zero => intro h; exact absurd h (Nat.not_lt_zero j)
| succ k ih =>
intro hjk hkn
show (evalLit (asgP n g) (true, var n i k) || evalClause (asgP n g) (pcl n i k)) = true
cases Nat.lt_or_ge j k with
| inl h => exact Found.Pnp62.or_r (ih h (Nat.le_of_succ_le hkn))
| inr h =>
have ejk : j = k := Nat.le_antisymm (Nat.le_of_lt_succ hjk) h
apply Found.Pnp62.or_l
show asgP n g (var n i k) = true
rw [asg_var n g i k hi hkn, ← ejk]
exact optEq_of _ j hgi
theorem pcl_false (n : Nat) (g : Nat -> Option Nat) (i : Nat) (hi : i < n + 1) (hgi : g i = none) :
forall k, k <= n -> evalClause (asgP n g) (pcl n i k) = false := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro hkn
show (evalLit (asgP n g) (true, var n i k) || evalClause (asgP n g) (pcl n i k)) = false
have e : evalLit (asgP n g) (true, var n i k) = false := by
show asgP n g (var n i k) = false
rw [asg_var n g i k hi hkn, hgi]
rfl
rw [e, ih (Nat.le_of_succ_le hkn)]
rfl
/-- g is injective on pigeons below n + 1. -/
def Inj (n : Nat) (g : Nat -> Option Nat) : Prop :=
forall i i' j, i < n + 1 -> i' < n + 1 -> g i = some j -> g i' = some j -> i = i'
theorem not_both (n : Nat) (g : Nat -> Option Nat) (hg : Inj n g) (i' i j : Nat) (hi' : i' < i) (hi : i < n + 1)
(hj : j < n) : ((!asgP n g (var n i' j)) || (!asgP n g (var n i j))) = true := by
rw [asg_var n g i' j (Nat.lt_trans hi' hi) hj, asg_var n g i j hi hj]
cases e1 : optEq (g i') j with
| false => rfl
| true =>
cases e2 : optEq (g i) j with
| false => rfl
| true =>
have s1 : g i' = some j := by
cases h : g i' with
| none => rw [h] at e1; exact Bool.noConfusion e1
| some a => rw [h] at e1; rw [optEq_some a j e1]
have s2 : g i = some j := by
cases h : g i with
| none => rw [h] at e2; exact Bool.noConfusion e2
| some a => rw [h] at e2; rw [optEq_some a j e2]
have ee := hg i' i j (Nat.lt_trans hi' hi) hi s1 s2
rw [ee] at hi'
exact absurd hi' (Nat.lt_irrefl i)
theorem hcl_true (n : Nat) (g : Nat -> Option Nat) (hg : Inj n g) (j i : Nat) (hi : i < n + 1) (hj : j < n) :
forall i', i' <= i -> evalCNF (asgP n g) (hcl n j i i') = true := by
intro i'
induction i' with
| zero => intro _; rfl
| succ i' ih =>
intro h
show (evalClause (asgP n g) [(false, var n i' j), (false, var n i j)] && evalCNF (asgP n g) (hcl n j i i')) = true
refine and_true' ?_ (ih (Nat.le_of_succ_le h))
show ((!asgP n g (var n i' j)) || ((!asgP n g (var n i j)) || false)) = true
have t := not_both n g hg i' i j h hi hj
cases e : (!asgP n g (var n i j)) with
| true => rw [e] at t; cases (!asgP n g (var n i' j)) <;> rfl
| false =>
rw [e] at t
revert t
cases (!asgP n g (var n i' j)) <;> intro t <;> first | rfl | exact t
theorem holesJ_true (n : Nat) (g : Nat -> Option Nat) (hg : Inj n g) (j : Nat) (hj : j < n) :
forall i, i <= n + 1 -> evalCNF (asgP n g) (holesJ n j i) = true := by
intro i
induction i with
| zero => intro _; rfl
| succ i ih =>
intro h
show evalCNF (asgP n g) (hcl n j i i ++ holesJ n j i) = true
rw [evalCNF_app]
exact and_true' (hcl_true n g hg j i h hj i (Nat.le_refl i)) (ih (Nat.le_of_succ_le h))
theorem holes_true (n : Nat) (g : Nat -> Option Nat) (hg : Inj n g) :
forall k, k <= n -> evalCNF (asgP n g) (holes n k) = true := by
intro k
induction k with
| zero => intro _; rfl
| succ k ih =>
intro h
show evalCNF (asgP n g) (holesJ n k (n + 1) ++ holes n k) = true
rw [evalCNF_app]
exact and_true' (holesJ_true n g hg k h (n + 1) (Nat.le_refl _)) (ih (Nat.le_of_succ_le h))
end Found.Pnp87
#print axioms Found.Pnp87.asg_var
#print axioms Found.Pnp87.optEq_some
#print axioms Found.Pnp87.optEq_of
#print axioms Found.Pnp87.evalCNF_app
#print axioms Found.Pnp87.and_true'
#print axioms Found.Pnp87.pcl_true
#print axioms Found.Pnp87.pcl_false
#print axioms Found.Pnp87.not_both
#print axioms Found.Pnp87.hcl_true
#print axioms Found.Pnp87.holesJ_true
#print axioms Found.Pnp87.holes_true
lean_all/found/Pnp88.lean
/-
T330 piece 88. found/Pnp88 -- the swap step of the Beame--Pitassi argument: a clause that
flips from false to true when a hole passes from one pigeon to another names that pair
(proof complexity ladder, step 1: general resolution).
swapM g i i' j: pigeon i takes hole j from pigeon i' (who then has none). If g i = none and
g i' = some j, the assignments of g and of swapM g i i' j differ only on x(i, j) and
x(i', j). Proved:
* asg_diff: where asgP n g and asgP n (swapM ..) differ, the variable is x(i, j) or
x(i', j);
* swap_cov: if C is false under g and true under the swap, then C holds (true, x(i, j))
or (false, x(i', j)) -- the monotone width of C covers (i, j);
* lit_false_all: every literal of a false clause is false.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp87
namespace Found.Pnp88
open Found.RootComp (Lit Clause CNF evalLit evalClause evalCNF)
open Found.Pnp62 (memL beqLit beqLit_eq mem_true of_mem)
open Found.Pnp65 (var)
open Found.Pnp66 (findIJ findIJ_some)
open Found.Pnp87 (optEq decA asgP asg_var optEq_of optEq_some)
def selOpt (b : Bool) (x y : Option Nat) : Option Nat := match b with | true => x | false => y
/-- Pigeon i takes hole j; pigeon i' gets none. -/
def swapM (g : Nat -> Option Nat) (i i' j : Nat) : Nat -> Option Nat :=
fun a => selOpt (Nat.beq a i) (some j) (selOpt (Nat.beq a i') none (g a))
theorem lit_false_all (a : Nat -> Bool) : forall C : Clause, evalClause a C = false ->
forall l, memL l C = true -> evalLit a l = false := by
intro C
induction C with
| nil => intro _ l h; exact Bool.noConfusion h
| cons m C ih =>
intro h l hl
have h' : (evalLit a m || evalClause a C) = false := h
have hm : evalLit a m = false := by
cases e : evalLit a m with
| false => rfl
| true => rw [e] at h'; exact Bool.noConfusion h'
rw [hm] at h'
have hl' : (beqLit m l || memL l C) = true := hl
cases e : beqLit m l with
| true => rw [(beqLit_eq m l e).symm]; exact hm
| false => rw [e] at hl'; exact ih h' l hl'
theorem asg_diff (n : Nat) (g : Nat -> Option Nat) (i i' j : Nat)
(hgi : g i = none) (hgi' : g i' = some j) (v : Nat) (hd : asgP n (swapM g i i' j) v = true -> asgP n g v = true -> False)
(hd2 : asgP n (swapM g i i' j) v = false -> asgP n g v = false -> False) :
(v = var n i j /\ asgP n (swapM g i i' j) v = true) \/ (v = var n i' j /\ asgP n g v = true) := by
cases e : findIJ n v (n + 1) with
| none =>
have a1 : asgP n (swapM g i i' j) v = false := by show decA _ (findIJ n v (n + 1)) = false; rw [e]; rfl
have a2 : asgP n g v = false := by show decA _ (findIJ n v (n + 1)) = false; rw [e]; rfl
exact absurd a2 (hd2 a1)
| some p =>
cases p with
| mk a b =>
have t := findIJ_some n v (n + 1) a b e
have r1 : asgP n (swapM g i i' j) v = optEq (swapM g i i' j a) b := by
show decA _ (findIJ n v (n + 1)) = _; rw [e]; rfl
have r2 : asgP n g v = optEq (g a) b := by
show decA _ (findIJ n v (n + 1)) = _; rw [e]; rfl
cases ea : Nat.beq a i with
| true =>
have ai : a = i := Found.Pnp2.beq_eq a i ea
have s1 : swapM g i i' j a = some j := by show selOpt (Nat.beq a i) _ _ = _; rw [ea]; rfl
rw [r1, s1] at hd hd2
rw [r2, ai, hgi] at hd hd2
cases eb : Nat.beq j b with
| false =>
have x1 : optEq (some j) b = false := eb
exact absurd rfl (hd2 x1)
| true =>
have jb : j = b := Found.Pnp2.beq_eq j b eb
refine Or.inl (And.intro ?_ ?_)
· rw [t.2.2.symm, ai, jb]
· rw [r1, s1]; exact eb
| false =>
cases ea' : Nat.beq a i' with
| true =>
have ai : a = i' := Found.Pnp2.beq_eq a i' ea'
have s1 : swapM g i i' j a = none := by
show selOpt (Nat.beq a i) _ (selOpt (Nat.beq a i') none (g a)) = none; rw [ea, ea']; rfl
rw [r1, s1] at hd hd2
rw [r2] at hd hd2
cases eg : optEq (g a) b with
| false => exact absurd eg (hd2 rfl)
| true =>
refine Or.inr (And.intro ?_ ?_)
· have hjb : j = b := by
rw [ai, hgi'] at eg
exact optEq_some j b eg
rw [t.2.2.symm, ai, hjb]
· rw [r2]; exact eg
| false =>
have s1 : swapM g i i' j a = g a := by
show selOpt (Nat.beq a i) _ (selOpt (Nat.beq a i') none (g a)) = g a; rw [ea, ea']; rfl
rw [r1, s1, r2] at hd hd2
cases eg : optEq (g a) b with
| false => exact absurd eg (hd2 eg)
| true => exact absurd eg (hd eg)
/-- The swap step: a clause false under g and true under the swap names (i, j). -/
theorem swap_cov (n : Nat) (g : Nat -> Option Nat) (i i' j : Nat) (hgi : g i = none) (hgi' : g i' = some j)
(C : Clause) (h0 : evalClause (asgP n g) C = false) (h1 : evalClause (asgP n (swapM g i i' j)) C = true) :
memL (true, var n i j) C = true \/ memL (false, var n i' j) C = true := by
cases mem_true _ C h1 with
| intro l hl =>
have hf := lit_false_all _ C h0 l hl.1
cases l with
| mk pol v =>
cases pol with
| true =>
have a1 : asgP n (swapM g i i' j) v = true := hl.2
have a2 : asgP n g v = false := hf
cases asg_diff n g i i' j hgi hgi' v (fun _ h => by rw [a2] at h; exact Bool.noConfusion h)
(fun h _ => by rw [a1] at h; exact Bool.noConfusion h) with
| inl r => rw [r.1.symm]; exact Or.inl hl.1
| inr r => rw [a2] at r; exact Bool.noConfusion r.2
| false =>
have a1 : asgP n (swapM g i i' j) v = false := by
have t : (!asgP n (swapM g i i' j) v) = true := hl.2
cases e : asgP n (swapM g i i' j) v with
| false => rfl
| true => rw [e] at t; exact Bool.noConfusion t
have a2 : asgP n g v = true := by
have t : (!asgP n g v) = false := hf
cases e : asgP n g v with
| true => rfl
| false => rw [e] at t; exact Bool.noConfusion t
cases asg_diff n g i i' j hgi hgi' v (fun h _ => by rw [a1] at h; exact Bool.noConfusion h)
(fun _ h => by rw [a2] at h; exact Bool.noConfusion h) with
| inl r => rw [a1] at r; exact Bool.noConfusion r.2
| inr r => rw [r.1.symm]; exact Or.inr hl.1
end Found.Pnp88
#print axioms Found.Pnp88.lit_false_all
#print axioms Found.Pnp88.asg_diff
#print axioms Found.Pnp88.swap_cov
lean_all/found/Pnp89.lean
/-
T330 piece 89. found/Pnp89 -- all pigeon maps as a finite list (proof complexity ladder,
step 1: general resolution).
To count the pigeons that a clause can "lose" without classical logic, the critical
assignments are searched in a finite list. A pigeon map is a list of entries none or
some j (j < n); allMaps n k lists all of length k. Proved:
* nthO, the map of a list; opts_mem: every entry none / some j (j < n) is an option;
* allMaps_complete: every list of length k with entries in range is in allMaps n k;
* anyM_true, anyM_of: a Bool search through a list of maps.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp88
import found.Pnp76
namespace Found.Pnp89
def nthO : List (Option Nat) -> Nat -> Option Nat
| [], _ => none
| o :: _, 0 => o
| _ :: l, k + 1 => nthO l k
def someUp : Nat -> List (Option Nat)
| 0 => []
| j + 1 => some j :: someUp j
def opts (n : Nat) : List (Option Nat) := none :: someUp n
def consAll (o : Option Nat) : List (List (Option Nat)) -> List (List (Option Nat))
| [] => []
| l :: ls => (o :: l) :: consAll o ls
def bindO : List (Option Nat) -> List (List (Option Nat)) -> List (List (Option Nat))
| [], _ => []
| o :: os, ls => consAll o ls ++ bindO os ls
def allMaps (n : Nat) : Nat -> List (List (Option Nat))
| 0 => [[]]
| k + 1 => bindO (opts n) (allMaps n k)
def InO (o : Option Nat) : List (Option Nat) -> Prop
| [] => False
| p :: ps => o = p \/ InO o ps
def InM (l : List (Option Nat)) : List (List (Option Nat)) -> Prop
| [] => False
| m :: ms => l = m \/ InM l ms
def okE (n : Nat) : Option Nat -> Prop
| none => True
| some j => j < n
def allOk (n : Nat) : List (Option Nat) -> Prop
| [] => True
| o :: l => okE n o /\ allOk n l
theorem someUp_mem (j : Nat) : forall n, j < n -> InO (some j) (someUp n)
| 0, h => absurd h (Nat.not_lt_zero j)
| n + 1, h =>
Or.elim (Nat.lt_or_ge j n) (fun h' => Or.inr (someUp_mem j n h'))
(fun h' => Or.inl (congrArg some (Nat.le_antisymm (Nat.le_of_lt_succ h) h')))
theorem opts_mem (n : Nat) : forall o, okE n o -> InO o (opts n)
| none, _ => Or.inl rfl
| some j, h => Or.inr (someUp_mem j n h)
theorem InM_app_l (l : List (Option Nat)) (B : List (List (Option Nat))) : forall A, InM l A -> InM l (A ++ B)
| [], h => False.elim h
| _ :: A, h => Or.elim h (fun e => Or.inl e) (fun h' => Or.inr (InM_app_l l B A h'))
theorem InM_app_r (l : List (Option Nat)) (B : List (List (Option Nat))) : forall A, InM l B -> InM l (A ++ B)
| [], h => h
| _ :: A, h => Or.inr (InM_app_r l B A h)
theorem consAll_mem (o : Option Nat) (l : List (Option Nat)) : forall ls, InM l ls -> InM (o :: l) (consAll o ls)
| [], h => False.elim h
| _ :: ms, h => Or.elim h (fun e => Or.inl (congrArg (fun t => o :: t) e)) (fun h' => Or.inr (consAll_mem o l ms h'))
theorem bindO_mem (o : Option Nat) (l : List (Option Nat)) (ls : List (List (Option Nat))) (hl : InM l ls) :
forall os, InO o os -> InM (o :: l) (bindO os ls)
| [], h => False.elim h
| p :: os, h =>
Or.elim h (fun e => by rw [e]; exact InM_app_l _ _ _ (consAll_mem p l ls hl))
(fun h' => InM_app_r _ _ _ (bindO_mem o l ls hl os h'))
theorem allMaps_complete (n : Nat) : forall l : List (Option Nat), allOk n l -> InM l (allMaps n l.length)
| [], _ => Or.inl rfl
| o :: l, h => bindO_mem o l _ (allMaps_complete n l h.2) (opts n) (opts_mem n o h.1)
def anyM (g : List (Option Nat) -> Bool) : List (List (Option Nat)) -> Bool
| [] => false
| l :: ls => g l || anyM g ls
theorem anyM_true (g : List (Option Nat) -> Bool) : forall ls, anyM g ls = true ->
Exists fun l => InM l ls /\ g l = true
| [], h => Bool.noConfusion h
| l :: ls, h =>
Or.elim (Found.Pnp76.or_true_cases _ _ h) (fun h1 => Exists.intro l (And.intro (Or.inl rfl) h1))
(fun h2 => match anyM_true g ls h2 with
| Exists.intro m hm => Exists.intro m (And.intro (Or.inr hm.1) hm.2))
theorem anyM_of (g : List (Option Nat) -> Bool) (l : List (Option Nat)) (hg : g l = true) :
forall ls, InM l ls -> anyM g ls = true
| [], h => False.elim h
| m :: ms, h =>
Or.elim h (fun e => Found.Pnp76.or_true_l _ _ (by rw [e.symm]; exact hg))
(fun h' => Found.Pnp76.or_true_r _ _ (anyM_of g l hg ms h'))
end Found.Pnp89
#print axioms Found.Pnp89.someUp_mem
#print axioms Found.Pnp89.opts_mem
#print axioms Found.Pnp89.InM_app_l
#print axioms Found.Pnp89.InM_app_r
#print axioms Found.Pnp89.consAll_mem
#print axioms Found.Pnp89.bindO_mem
#print axioms Found.Pnp89.allMaps_complete
#print axioms Found.Pnp89.anyM_true
#print axioms Found.Pnp89.anyM_of
lean_all/found/Pnp9.lean
/-
T330 piece 9. found/Pnp9 -- the whole tableau CNF of a width-W, k-bit local machine,
with its exact clause count.
Variables (t, j, b): bit b of cell j at time t. Cell W is the boundary cell: it is the
left neighbour of cell 0 and the right neighbour of cell W-1, and unit clauses force it
false at every time. The CNF is the window CNF (Pnp8) of every (t < T, j < W, b < k)
plus the boundary units. Proved:
* an assignment satisfies it iff every step obeys the rule and the boundary is false;
* it has exactly T * (W * (k * 2^(3k))) + (T + 1) * k clauses (each window clause has
3k + 1 literals) -- polynomial in T and W for a fixed machine.
It relativizes (a tool; PNP_MAP.md). Written with ASCII forms only.
CIC dependence: none.
-/
import found.Pnp8
namespace Found.Pnp9
open Found.Pnp8
abbrev V := Nat × (Nat × Nat)
/-! ## Generic facts -/
theorem cnfv_append {α : Type} (s : α -> Bool) (B : List (List (Bool × α))) :
forall A, cnfv s (A ++ B) = (cnfv s A && cnfv s B) := by
intro A
induction A with
| nil => rfl
| cons c A ih =>
show (clv s c && cnfv s (A ++ B)) = ((clv s c && cnfv s A) && cnfv s B)
rw [ih]
cases clv s c <;> rfl
theorem and_tt {x y : Bool} (hx : x = true) (hy : y = true) : (x && y) = true := by
subst hx; subst hy; rfl
theorem length_app {β : Type} (B : List β) : forall A : List β, (A ++ B).length = A.length + B.length := by
intro A
induction A with
| nil => exact (Nat.zero_add _).symm
| cons x A ih =>
show (A ++ B).length + 1 = (A.length + 1) + B.length
rw [ih]
exact (Nat.succ_add _ _).symm
theorem lt_succ_cases (i n : Nat) (h : i < n + 1) : i < n \/ i = n := by
cases Nat.le_of_lt_succ h with
| refl => exact Or.inr rfl
| step h' => exact Or.inl (Nat.lt_succ_of_le h')
/-- Concatenation over i < n. -/
def forR {β : Type} : Nat -> (Nat -> List β) -> List β
| 0, _ => []
| n + 1, g => forR n g ++ g n
theorem forR_all {α : Type} (s : α -> Bool) (g : Nat -> List (List (Bool × α))) :
forall n, (cnfv s (forR n g) = true -> forall i, i < n -> cnfv s (g i) = true) /\
((forall i, i < n -> cnfv s (g i) = true) -> cnfv s (forR n g) = true) := by
intro n
induction n with
| zero => exact And.intro (fun _ i hi => False.elim (Nat.not_lt_zero i hi)) (fun _ => rfl)
| succ n ih =>
apply And.intro
· intro h i hi
have h' : (cnfv s (forR n g) && cnfv s (g n)) = true :=
(cnfv_append s (g n) (forR n g)).symm.trans h
exact Or.elim (lt_succ_cases i n hi) (fun hl => ih.1 (and_l h') i hl)
(fun e => by rw [e]; exact and_r h')
· intro h
show cnfv s (forR n g ++ g n) = true
rw [cnfv_append]
exact and_tt (ih.2 (fun i hi => h i (Nat.lt_succ_of_lt hi))) (h n (Nat.lt_succ_self n))
theorem forR_length {β : Type} (g : Nat -> List β) (m : Nat) (hg : forall i, (g i).length = m) :
forall n, (forR n g).length = n * m := by
intro n
induction n with
| zero => exact (Nat.zero_mul m).symm
| succ n ih =>
show (forR n g ++ g n).length = (n + 1) * m
rw [length_app, ih, hg n, Nat.succ_mul]
/-! ## Pattern count -/
def pow2 : Nat -> Nat
| 0 => 1
| n + 1 => pow2 n + pow2 n
theorem length_mapC (b : Bool) : forall A : List (List Bool), (mapC b A).length = A.length := by
intro A
induction A with
| nil => rfl
| cons p A ih => exact congrArg (fun t => t + 1) ih
theorem length_allBits : forall n, (allBits n).length = pow2 n := by
intro n
induction n with
| zero => rfl
| succ n ih =>
show (mapC false (allBits n) ++ mapC true (allBits n)).length = pow2 n + pow2 n
rw [length_app, length_mapC, length_mapC, ih]
theorem length_mapCl {α : Type} (ys : List α) (x : α) (d : List Bool -> Bool) :
forall ps : List (List Bool), (mapCl ys x d ps).length = ps.length := by
intro ps
induction ps with
| nil => rfl
| cons p ps ih => exact congrArg (fun t => t + 1) ih
theorem length_window {α : Type} (ys : List α) (x : α) (d : List Bool -> Bool) (n : Nat) :
(window ys x d n).length = pow2 n :=
(length_mapCl ys x d (allBits n)).trans (length_allBits n)
/-! ## The tableau CNF -/
/-- Bits b0, ..., b0+k-1 of cell c at time t. -/
def readV (t c : Nat) : Nat -> Nat -> List V
| _, 0 => []
| b, k + 1 => (t, (c, b)) :: readV t c (b + 1) k
def leftIdx (W : Nat) : Nat -> Nat
| 0 => W
| j + 1 => j
def nbV (k W t j : Nat) : List V :=
readV t (leftIdx W j) 0 k ++ (readV t j 0 k ++ readV t (j + 1) 0 k)
theorem length_readV (t c : Nat) : forall k b, (readV t c b k).length = k := by
intro k
induction k with
| zero => intro b; rfl
| succ k ih => intro b; exact congrArg (fun x => x + 1) (ih (b + 1))
theorem length_nbV (k W t j : Nat) : (nbV k W t j).length = k + (k + k) := by
show (readV t (leftIdx W j) 0 k ++ (readV t j 0 k ++ readV t (j + 1) 0 k)).length = k + (k + k)
rw [length_app, length_app, length_readV, length_readV, length_readV]
def windows (delta : List Bool -> Nat -> Bool) (k W T : Nat) : List (List (Bool × V)) :=
forR T fun t => forR W fun j => forR k fun b =>
window (nbV k W t j) (t + 1, (j, b)) (fun p => delta p b) (k + (k + k))
def bounds (k W T : Nat) : List (List (Bool × V)) :=
forR (T + 1) fun t => forR k fun b => [[(false, (t, (W, b)))]]
def tab (delta : List Bool -> Nat -> Bool) (k W T : Nat) : List (List (Bool × V)) :=
windows delta k W T ++ bounds k W T
/-- The step condition. -/
def Steps (s : V -> Bool) (delta : List Bool -> Nat -> Bool) (k W T : Nat) : Prop :=
forall t, t < T -> forall j, j < W -> forall b, b < k ->
s (t + 1, (j, b)) = delta (mapv s (nbV k W t j)) b
/-- The boundary condition. -/
def Bound (s : V -> Bool) (k W T : Nat) : Prop :=
forall t, t < T + 1 -> forall b, b < k -> s (t, (W, b)) = false
theorem unit_iff (s : V -> Bool) (v : V) : (cnfv s [[(false, v)]] = true -> s v = false) /\
(s v = false -> cnfv s [[(false, v)]] = true) := by
apply And.intro
· intro h
have h' : ((!(s v) || false) && true) = true := h
cases hv : s v with
| false => rfl
| true => rw [hv] at h'; exact Bool.noConfusion h'
· intro h
show ((!(s v) || false) && true) = true
rw [h]; rfl
theorem windows_iff (s : V -> Bool) (delta : List Bool -> Nat -> Bool) (k W T : Nat) :
(cnfv s (windows delta k W T) = true -> Steps s delta k W T) /\
(Steps s delta k W T -> cnfv s (windows delta k W T) = true) := by
apply And.intro
· intro h t ht j hj b hb
have h1 := (forR_all s _ T).1 h t ht
have h2 := (forR_all s _ W).1 h1 j hj
have h3 := (forR_all s _ k).1 h2 b hb
exact (window_iff s (nbV k W t j) (t + 1, (j, b)) (fun p => delta p b) _ (length_nbV k W t j)).1 h3
· intro h
exact (forR_all s _ T).2 fun t ht => (forR_all s _ W).2 fun j hj => (forR_all s _ k).2 fun b hb =>
(window_iff s (nbV k W t j) (t + 1, (j, b)) (fun p => delta p b) _ (length_nbV k W t j)).2
(h t ht j hj b hb)
theorem bounds_iff (s : V -> Bool) (k W T : Nat) :
(cnfv s (bounds k W T) = true -> Bound s k W T) /\
(Bound s k W T -> cnfv s (bounds k W T) = true) := by
apply And.intro
· intro h t ht b hb
exact (unit_iff s _).1 ((forR_all s _ k).1 ((forR_all s _ (T + 1)).1 h t ht) b hb)
· intro h
exact (forR_all s _ (T + 1)).2 fun t ht => (forR_all s _ k).2 fun b hb =>
(unit_iff s _).2 (h t ht b hb)
/-- The tableau CNF holds iff every step obeys the rule and the boundary cell is false. -/
theorem tab_iff (s : V -> Bool) (delta : List Bool -> Nat -> Bool) (k W T : Nat) :
(cnfv s (tab delta k W T) = true -> Steps s delta k W T /\ Bound s k W T) /\
(Steps s delta k W T /\ Bound s k W T -> cnfv s (tab delta k W T) = true) := by
apply And.intro
· intro h
have h' : (cnfv s (windows delta k W T) && cnfv s (bounds k W T)) = true :=
(cnfv_append s _ _).symm.trans h
exact And.intro ((windows_iff s delta k W T).1 (and_l h')) ((bounds_iff s k W T).1 (and_r h'))
· intro h
show cnfv s (windows delta k W T ++ bounds k W T) = true
rw [cnfv_append]
exact and_tt ((windows_iff s delta k W T).2 h.1) ((bounds_iff s k W T).2 h.2)
/-- The exact clause count. -/
theorem tab_count (delta : List Bool -> Nat -> Bool) (k W T : Nat) :
(tab delta k W T).length = T * (W * (k * pow2 (k + (k + k)))) + (T + 1) * k := by
show (windows delta k W T ++ bounds k W T).length = _
rw [length_app]
have hw : (windows delta k W T).length = T * (W * (k * pow2 (k + (k + k)))) :=
forR_length _ _ (fun t => forR_length _ _ (fun j => forR_length _ _
(fun b => length_window _ _ _ _) k) W) T
have hb : (bounds k W T).length = (T + 1) * k :=
forR_length _ _ (fun t => (forR_length _ 1 (fun b => rfl) k).trans (Nat.mul_one k)) (T + 1)
rw [hw, hb]
end Found.Pnp9
#print axioms Found.Pnp9.cnfv_append
#print axioms Found.Pnp9.and_tt
#print axioms Found.Pnp9.length_app
#print axioms Found.Pnp9.lt_succ_cases
#print axioms Found.Pnp9.forR_all
#print axioms Found.Pnp9.forR_length
#print axioms Found.Pnp9.length_mapC
#print axioms Found.Pnp9.length_allBits
#print axioms Found.Pnp9.length_mapCl
#print axioms Found.Pnp9.length_window
#print axioms Found.Pnp9.length_readV
#print axioms Found.Pnp9.length_nbV
#print axioms Found.Pnp9.unit_iff
#print axioms Found.Pnp9.windows_iff
#print axioms Found.Pnp9.bounds_iff
#print axioms Found.Pnp9.tab_iff
#print axioms Found.Pnp9.tab_count
lean_all/found/Pnp90.lean
/-
T330 piece 90. found/Pnp90 -- critical pigeon maps as a Bool check (proof complexity
ladder, step 1: general resolution).
A restriction rho fixes some pigeons in holes (rho a = some j) and leaves the others
(rho a = none). A critical map for a remaining pigeon i: i has no hole, every other
remaining pigeon has one, the fixed pigeons keep theirs, holes are below n and no two
pigeons share a hole. Crit is the Prop form on functions, critB the Bool form on lists.
Proved:
* allI_true, allI_of: bounded Bool conjunction;
* listOf, nthO_listOf: the list of a function;
* critB_sound: critB n rho i l = true -> Crit n rho i (nthO l);
* critB_complete: Crit n rho i g -> critB n rho i (listOf g (n + 1)) = true;
* listOf_ok, listOf_len: the list of a critical map is in allMaps.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp89
namespace Found.Pnp90
open Found.Pnp87 (Inj optEq optEq_some optEq_of)
open Found.Pnp89 (nthO allOk okE)
open Found.Pnp76 (or_true_cases or_true_l or_true_r)
def allI (g : Nat -> Bool) : Nat -> Bool
| 0 => true
| k + 1 => allI g k && g k
theorem allI_true (g : Nat -> Bool) : forall k, allI g k = true -> forall x, x < k -> g x = true
| 0, _, x, hx => absurd hx (Nat.not_lt_zero x)
| k + 1, h, x, hx => by
have h' : (allI g k && g k) = true := h
cases Nat.lt_or_ge x k with
| inl l => exact allI_true g k (Found.Pnp62.and_l h') x l
| inr r =>
have e : x = k := Nat.le_antisymm (Nat.le_of_lt_succ hx) r
rw [e]; exact Found.Pnp62.and_r h'
theorem allI_of (g : Nat -> Bool) : forall k, (forall x, x < k -> g x = true) -> allI g k = true
| 0, _ => rfl
| k + 1, h => Found.Pnp87.and_true' (allI_of g k (fun x hx => h x (Nat.lt_succ_of_lt hx))) (h k (Nat.lt_succ_self k))
def isNone : Option Nat -> Bool
| none => true
| some _ => false
def isSomeLt (n : Nat) : Option Nat -> Bool
| none => false
| some j => Nat.blt j n
/-- Entry a of a critical map for i, given rho a. -/
def entryB (n : Nat) (r : Option Nat) (o : Option Nat) : Bool :=
match r with
| none => isSomeLt n o
| some j => optEq o j && Nat.blt j n
def sameSome : Option Nat -> Option Nat -> Bool
| some a, some b => Nat.beq a b
| none, _ => false
| some _, none => false
def injB (n : Nat) (g : Nat -> Option Nat) : Bool :=
allI (fun a => allI (fun b => Nat.beq a b || !sameSome (g a) (g b)) (n + 1)) (n + 1)
def critF (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g : Nat -> Option Nat) : Bool :=
isNone (g i) && isNone (rho i) && Nat.blt i (n + 1) &&
allI (fun a => Nat.beq a i || entryB n (rho a) (g a)) (n + 1) && injB n g
def critB (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (l : List (Option Nat)) : Bool := critF n rho i (nthO l)
/-- The Prop form. -/
structure Crit (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g : Nat -> Option Nat) : Prop where
gi : g i = none
ri : rho i = none
il : i < n + 1
free : forall a, a < n + 1 -> Nat.beq a i = false -> rho a = none -> Exists fun j => g a = some j /\ j < n
fixed : forall a j, a < n + 1 -> Nat.beq a i = false -> rho a = some j -> g a = some j
inj : Inj n g
rng : forall a j, a < n + 1 -> g a = some j -> j < n
theorem blt_lt (a b : Nat) (h : Nat.blt a b = true) : a < b := Nat.le_of_ble_eq_true h
theorem lt_blt (a b : Nat) (h : a < b) : Nat.blt a b = true := Nat.ble_eq_true_of_le h
theorem isNone_eq (o : Option Nat) (h : isNone o = true) : o = none := by
cases o with
| none => rfl
| some _ => exact Bool.noConfusion h
theorem sameSome_of (a b : Option Nat) (j : Nat) (ha : a = some j) (hb : b = some j) : sameSome a b = true := by
rw [ha, hb]; exact Found.Pnp62.beq_refl j
theorem critF_sound (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g : Nat -> Option Nat)
(h : critF n rho i g = true) : Crit n rho i g := by
have h5 := Found.Pnp62.and_r h
have h4 := Found.Pnp62.and_r (Found.Pnp62.and_l h)
have h3 := Found.Pnp62.and_r (Found.Pnp62.and_l (Found.Pnp62.and_l h))
have h2 := Found.Pnp62.and_r (Found.Pnp62.and_l (Found.Pnp62.and_l (Found.Pnp62.and_l h)))
have h1 := Found.Pnp62.and_l (Found.Pnp62.and_l (Found.Pnp62.and_l (Found.Pnp62.and_l h)))
have ent : forall a, a < n + 1 -> Nat.beq a i = false -> entryB n (rho a) (g a) = true := by
intro a ha hai
have t := allI_true _ (n + 1) h4 a ha
rw [hai] at t
exact t
have injP : forall a b, a < n + 1 -> b < n + 1 -> (Nat.beq a b || !sameSome (g a) (g b)) = true :=
fun a b ha hb => allI_true _ (n + 1) (allI_true _ (n + 1) h5 a ha) b hb
refine Crit.mk (isNone_eq _ h1) (isNone_eq _ h2) (blt_lt _ _ h3) ?_ ?_ ?_ ?_
· intro a ha hai hr
have t := ent a ha hai
rw [hr] at t
have t' : isSomeLt n (g a) = true := t
cases e : g a with
| none => rw [e] at t'; exact Bool.noConfusion t'
| some j => rw [e] at t'; exact Exists.intro j (And.intro rfl (blt_lt j n t'))
· intro a j ha hai hr
have t := ent a ha hai
rw [hr] at t
have t' : (optEq (g a) j && Nat.blt j n) = true := t
have t1 := Found.Pnp62.and_l t'
cases e : g a with
| none => rw [e] at t1; exact Bool.noConfusion t1
| some c => rw [e] at t1; rw [optEq_some c j t1]
· intro a b j ha hb hga hgb
have t := injP a b ha hb
rw [sameSome_of _ _ j hga hgb] at t
cases e : Nat.beq a b with
| true => exact Found.Pnp2.beq_eq a b e
| false => rw [e] at t; exact Bool.noConfusion t
· intro a j ha hga
cases eai : Nat.beq a i with
| true =>
rw [Found.Pnp2.beq_eq a i eai, isNone_eq _ h1] at hga
cases hga
| false =>
have t := ent a ha eai
cases er : rho a with
| none =>
rw [er] at t
have t' : isSomeLt n (g a) = true := t
rw [hga] at t'
exact blt_lt j n t'
| some c =>
rw [er] at t
have t' : (optEq (g a) c && Nat.blt c n) = true := t
rw [hga] at t'
rw [optEq_some j c (Found.Pnp62.and_l t')]
exact blt_lt c n (Found.Pnp62.and_r t')
theorem critF_complete (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g : Nat -> Option Nat)
(h : Crit n rho i g) : critF n rho i g = true := by
have e1 : isNone (g i) = true := by rw [h.gi]; rfl
have e2 : isNone (rho i) = true := by rw [h.ri]; rfl
have e4 : allI (fun a => Nat.beq a i || entryB n (rho a) (g a)) (n + 1) = true := by
refine allI_of _ (n + 1) (fun a ha => ?_)
cases eai : Nat.beq a i with
| true => rfl
| false =>
show entryB n (rho a) (g a) = true
cases er : rho a with
| none =>
cases h.free a ha eai er with
| intro j hj =>
show isSomeLt n (g a) = true
rw [hj.1]; exact lt_blt j n hj.2
| some c =>
have hg := h.fixed a c ha eai er
show (optEq (g a) c && Nat.blt c n) = true
rw [hg]
exact Found.Pnp87.and_true' (Found.Pnp62.beq_refl c) (lt_blt c n (h.rng a c ha hg))
have e5 : injB n g = true := by
refine allI_of _ (n + 1) (fun a ha => allI_of _ (n + 1) (fun b hb => ?_))
cases eab : Nat.beq a b with
| true => rfl
| false =>
show (!sameSome (g a) (g b)) = true
cases ga : g a with
| none => rfl
| some x =>
cases gb : g b with
| none => rfl
| some y =>
cases exy : Nat.beq x y with
| false => show (!Nat.beq x y) = true; rw [exy]; rfl
| true =>
have ey := Found.Pnp2.beq_eq x y exy
rw [ey] at ga
have eq := h.inj a b y ha hb ga gb
rw [eq, Found.Pnp62.beq_refl] at eab
exact Bool.noConfusion eab
show (isNone (g i) && isNone (rho i) && Nat.blt i (n + 1) &&
allI (fun a => Nat.beq a i || entryB n (rho a) (g a)) (n + 1) && injB n g) = true
rw [e1, e2, lt_blt i (n + 1) h.il, e4, e5]
rfl
/-! ## lists of functions -/
def listFrom (g : Nat -> Option Nat) (s : Nat) : Nat -> List (Option Nat)
| 0 => []
| k + 1 => g s :: listFrom g (s + 1) k
theorem nthO_listFrom (g : Nat -> Option Nat) : forall k s a, a < k -> nthO (listFrom g s k) a = g (s + a)
| 0, _, a, h => absurd h (Nat.not_lt_zero a)
| k + 1, s, 0, _ => rfl
| k + 1, s, a + 1, h => by
show nthO (listFrom g (s + 1) k) a = g (s + (a + 1))
rw [nthO_listFrom g k (s + 1) a (Nat.lt_of_succ_lt_succ h), Nat.add_right_comm s 1 a, Nat.add_assoc]
theorem listFrom_len (g : Nat -> Option Nat) : forall k s, (listFrom g s k).length = k
| 0, _ => rfl
| k + 1, s => congrArg Nat.succ (listFrom_len g k (s + 1))
theorem listFrom_ok (n : Nat) (g : Nat -> Option Nat) : forall k s,
(forall a, a < k -> okE n (g (s + a))) -> allOk n (listFrom g s k)
| 0, _, _ => True.intro
| k + 1, s, h => And.intro (h 0 (Nat.zero_lt_succ k))
(listFrom_ok n g k (s + 1) (fun a ha => by
have t := h (a + 1) (Nat.succ_lt_succ ha)
rw [Nat.add_assoc, Nat.add_comm 1 a]
exact t))
/-- Crit depends on g only below n + 1. -/
theorem crit_congr (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g g' : Nat -> Option Nat)
(he : forall a, a < n + 1 -> g a = g' a) (h : Crit n rho i g) : Crit n rho i g' := by
refine Crit.mk ((he i h.il).symm.trans h.gi) h.ri h.il ?_ ?_ ?_ ?_
· intro a ha hai hr
cases h.free a ha hai hr with
| intro j hj => exact Exists.intro j (And.intro ((he a ha).symm.trans hj.1) hj.2)
· intro a j ha hai hr; exact (he a ha).symm.trans (h.fixed a j ha hai hr)
· intro a b j ha hb h1 h2; exact h.inj a b j ha hb ((he a ha).trans h1) ((he b hb).trans h2)
· intro a j ha h1; exact h.rng a j ha ((he a ha).trans h1)
theorem crit_list (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g : Nat -> Option Nat) (h : Crit n rho i g) :
critB n rho i (listFrom g 0 (n + 1)) = true /\ allOk n (listFrom g 0 (n + 1)) /\
(listFrom g 0 (n + 1)).length = n + 1 /\ forall a, a < n + 1 -> nthO (listFrom g 0 (n + 1)) a = g a := by
have hn : forall a, a < n + 1 -> nthO (listFrom g 0 (n + 1)) a = g a := fun a ha => by
rw [nthO_listFrom g (n + 1) 0 a ha, Nat.zero_add]
refine And.intro ?_ (And.intro ?_ (And.intro (listFrom_len g (n + 1) 0) hn))
· exact critF_complete n rho i _ (crit_congr n rho i g _ (fun a ha => (hn a ha).symm) h)
· refine listFrom_ok n g (n + 1) 0 (fun a ha => ?_)
rw [Nat.zero_add]
cases e : g a with
| none => exact True.intro
| some j => exact h.rng a j ha e
end Found.Pnp90
#print axioms Found.Pnp90.allI_true
#print axioms Found.Pnp90.allI_of
#print axioms Found.Pnp90.blt_lt
#print axioms Found.Pnp90.lt_blt
#print axioms Found.Pnp90.isNone_eq
#print axioms Found.Pnp90.sameSome_of
#print axioms Found.Pnp90.critF_sound
#print axioms Found.Pnp90.critF_complete
#print axioms Found.Pnp90.nthO_listFrom
#print axioms Found.Pnp90.listFrom_len
#print axioms Found.Pnp90.listFrom_ok
#print axioms Found.Pnp90.crit_congr
#print axioms Found.Pnp90.crit_list
lean_all/found/Pnp91.lean
/-
T330 piece 91. found/Pnp91 -- the pigeons a clause can lose, as a Bool search (proof
complexity ladder, step 1: general resolution).
pigsB n rho C i: some critical map for i (relative to the restriction rho) falsifies C.
It is computed by searching allMaps (Pnp89), so no classical logic is needed. Proved:
* asg_congr: asgP n g depends on g only below n + 1;
* pigs_sound, pigs_complete: pigsB is true exactly when some critical map falsifies C;
* pigs_res: a resolvent can lose only pigeons one of its premises can lose;
* pigs_axiom: a clause of PHP(n + 1, n) can lose at most one pigeon.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp90
namespace Found.Pnp91
open Found.RootComp (Lit Clause CNF evalLit evalClause evalCNF)
open Found.Pnp62 (memL memC ResOK res_sound cnf_mem)
open Found.Pnp65 (var)
open Found.Pnp66 (pcl PHP findIJ findIJ_some memC_app pigeons_mem holes_mem)
open Found.Pnp87 (decA asgP Inj pcl_true holes_true)
open Found.Pnp89 (nthO allMaps anyM anyM_true anyM_of allMaps_complete)
open Found.Pnp90 (critB critF Crit critF_sound crit_list)
def pigsB (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (i : Nat) : Bool :=
anyM (fun l => critB n rho i l && !evalClause (asgP n (nthO l)) C) (allMaps n (n + 1))
theorem asg_congr (n : Nat) (g g' : Nat -> Option Nat) (he : forall a, a < n + 1 -> g a = g' a) (v : Nat) :
asgP n g v = asgP n g' v := by
show decA g (findIJ n v (n + 1)) = decA g' (findIJ n v (n + 1))
cases e : findIJ n v (n + 1) with
| none => rfl
| some p =>
cases p with
| mk a b =>
have t := findIJ_some n v (n + 1) a b e
show Found.Pnp87.optEq (g a) b = Found.Pnp87.optEq (g' a) b
rw [he a t.1]
theorem eval_congr (a a' : Nat -> Bool) (he : forall v, a v = a' v) : forall C : Clause, evalClause a C = evalClause a' C
| [] => rfl
| l :: C => by
show (evalLit a l || evalClause a C) = (evalLit a' l || evalClause a' C)
rw [eval_congr a a' he C]
show ((match l.1 with | true => a l.2 | false => !(a l.2)) || _) = ((match l.1 with | true => a' l.2 | false => !(a' l.2)) || _)
rw [he l.2]
theorem not_true {b : Bool} (h : (!b) = true) : b = false := by
cases b with
| false => rfl
| true => exact Bool.noConfusion h
theorem pigs_sound (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (i : Nat) (h : pigsB n rho C i = true) :
Exists fun g => Crit n rho i g /\ evalClause (asgP n g) C = false :=
match anyM_true _ _ h with
| Exists.intro l hl =>
Exists.intro (nthO l) (And.intro (critF_sound n rho i _ (Found.Pnp62.and_l hl.2))
(not_true (Found.Pnp62.and_r hl.2)))
theorem pigs_complete (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (i : Nat) (g : Nat -> Option Nat)
(hc : Crit n rho i g) (hf : evalClause (asgP n g) C = false) : pigsB n rho C i = true := by
have cl := crit_list n rho i g hc
have mem := allMaps_complete n _ cl.2.1
rw [cl.2.2.1] at mem
refine anyM_of _ _ ?_ _ mem
have ev : evalClause (asgP n (nthO (Found.Pnp90.listFrom g 0 (n + 1)))) C = false := by
rw [eval_congr _ (asgP n g) (fun v => asg_congr n _ g cl.2.2.2 v) C]
exact hf
rw [cl.1, ev]
rfl
theorem pigs_res (n : Nat) (rho : Nat -> Option Nat) (C1 C2 R : Clause) (v : Nat) (hr : ResOK C1 C2 v R)
(i : Nat) (h : pigsB n rho R i = true) : pigsB n rho C1 i = true \/ pigsB n rho C2 i = true := by
cases pigs_sound n rho R i h with
| intro g hg =>
cases e1 : evalClause (asgP n g) C1 with
| false => exact Or.inl (pigs_complete n rho C1 i g hg.1 e1)
| true =>
cases e2 : evalClause (asgP n g) C2 with
| false => exact Or.inr (pigs_complete n rho C2 i g hg.1 e2)
| true =>
have t := res_sound (asgP n g) C1 C2 R v hr e1 e2
rw [hg.2] at t
exact Bool.noConfusion t
/-- Under a critical map every hole clause holds and every pigeon clause but that of i. -/
theorem crit_pcl (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (g : Nat -> Option Nat) (hc : Crit n rho i g)
(i0 : Nat) (hi0 : i0 < n + 1) (hne : Nat.beq i0 i = false) : evalClause (asgP n g) (pcl n i0 n) = true := by
cases er : rho i0 with
| none =>
cases hc.free i0 hi0 hne er with
| intro j hj => exact pcl_true n g i0 hi0 j hj.1 n hj.2 (Nat.le_refl n)
| some j =>
have hg := hc.fixed i0 j hi0 hne er
exact pcl_true n g i0 hi0 j hg n (hc.rng i0 j hi0 hg) (Nat.le_refl n)
theorem pigs_axiom (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (hm : memC C (PHP n) = true)
(i i' : Nat) (h : pigsB n rho C i = true) (h' : pigsB n rho C i' = true) : i = i' := by
cases memC_app C _ _ hm with
| inl hp =>
cases pigeons_mem n C (n + 1) hp with
| intro i0 hi0 =>
have one : forall k, pigsB n rho C k = true -> k = i0 := by
intro k hk
cases pigs_sound n rho C k hk with
| intro g hg =>
cases e : Nat.beq i0 k with
| true => exact (Found.Pnp2.beq_eq i0 k e).symm
| false =>
have t := crit_pcl n rho k g hg.1 i0 hi0.1 e
rw [hi0.2] at hg
rw [hg.2] at t
exact Bool.noConfusion t
rw [one i h, one i' h']
| inr hh =>
cases pigs_sound n rho C i h with
| intro g hg =>
have t := cnf_mem (asgP n g) C _ (holes_true n g hg.1.inj n (Nat.le_refl n)) hh
rw [hg.2] at t
exact Bool.noConfusion t
end Found.Pnp91
#print axioms Found.Pnp91.asg_congr
#print axioms Found.Pnp91.eval_congr
#print axioms Found.Pnp91.not_true
#print axioms Found.Pnp91.pigs_sound
#print axioms Found.Pnp91.pigs_complete
#print axioms Found.Pnp91.pigs_res
#print axioms Found.Pnp91.crit_pcl
#print axioms Found.Pnp91.pigs_axiom
lean_all/found/Pnp92.lean
/-
T330 piece 92. found/Pnp92 -- the swap keeps maps critical, and a clause that loses pigeon i
but not pigeon i' covers the pair (i, hole of i') (proof complexity ladder, step 1:
general resolution).
Proved:
* swap_crit: if g is critical for i and i' is a remaining pigeon (i' <> i) with hole j,
then swapM g i i' j is critical for i';
* cov_of_pigs: if g is critical for i and falsifies C, and C cannot lose i', then C holds
(true, x(i, j)) or (false, x(i', j)) where j is the hole of i' under g.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp91
namespace Found.Pnp92
open Found.RootComp (Clause evalClause)
open Found.Pnp62 (memL)
open Found.Pnp65 (var)
open Found.Pnp87 (asgP Inj)
open Found.Pnp88 (swapM selOpt swap_cov)
open Found.Pnp90 (Crit)
open Found.Pnp91 (pigsB pigs_complete)
theorem sw_i (g : Nat -> Option Nat) (i i' j : Nat) : swapM g i i' j i = some j := by
show selOpt (Nat.beq i i) (some j) _ = some j
rw [Found.Pnp62.beq_refl]; rfl
theorem sw_i' (g : Nat -> Option Nat) (i i' j : Nat) (h : Nat.beq i' i = false) : swapM g i i' j i' = none := by
show selOpt (Nat.beq i' i) (some j) (selOpt (Nat.beq i' i') none (g i')) = none
rw [h, Found.Pnp62.beq_refl]; rfl
theorem sw_other (g : Nat -> Option Nat) (i i' j a : Nat) (h1 : Nat.beq a i = false) (h2 : Nat.beq a i' = false) :
swapM g i i' j a = g a := by
show selOpt (Nat.beq a i) (some j) (selOpt (Nat.beq a i') none (g a)) = g a
rw [h1, h2]; rfl
theorem swap_crit (n : Nat) (rho : Nat -> Option Nat) (i i' j : Nat) (g : Nat -> Option Nat) (hc : Crit n rho i g)
(hi' : i' < n + 1) (hne : Nat.beq i' i = false) (hr : rho i' = none) (hj : g i' = some j) :
Crit n rho i' (swapM g i i' j) := by
have jn : j < n := hc.rng i' j hi' hj
have hne' : Nat.beq i i' = false := Found.Pnp70.nsym i' i hne
refine Crit.mk (sw_i' g i i' j hne) hr hi' ?_ ?_ ?_ ?_
· intro a ha hai hra
cases e : Nat.beq a i with
| true =>
rw [Found.Pnp2.beq_eq a i e, sw_i]
exact Exists.intro j (And.intro rfl jn)
| false =>
rw [sw_other g i i' j a e hai]
exact hc.free a ha e hra
· intro a c ha hai hra
cases e : Nat.beq a i with
| true =>
rw [Found.Pnp2.beq_eq a i e, hc.ri] at hra
cases hra
| false =>
rw [sw_other g i i' j a e hai]
exact hc.fixed a c ha e hra
· intro a b c ha hb h1 h2
-- values: i -> j, i' -> none, others -> g
have val : forall x, x < n + 1 -> swapM g i i' j x = some c ->
(x = i /\ c = j) \/ (Nat.beq x i = false /\ Nat.beq x i' = false /\ g x = some c) := by
intro x hx hxc
cases ex : Nat.beq x i with
| true =>
rw [Found.Pnp2.beq_eq x i ex, sw_i] at hxc
exact Or.inl (And.intro (Found.Pnp2.beq_eq x i ex) (Option.some.inj hxc).symm)
| false =>
cases ex' : Nat.beq x i' with
| true =>
rw [Found.Pnp2.beq_eq x i' ex', sw_i' g i i' j hne] at hxc
cases hxc
| false =>
rw [sw_other g i i' j x ex ex'] at hxc
exact Or.inr (And.intro rfl (And.intro rfl hxc))
cases val a ha h1 with
| inl va =>
cases val b hb h2 with
| inl vb => rw [va.1, vb.1]
| inr vb =>
rw [va.2] at vb
have e := hc.inj b i' j hb hi' vb.2.2 hj
rw [e, Found.Pnp62.beq_refl] at vb
exact Bool.noConfusion vb.2.1
| inr va =>
cases val b hb h2 with
| inl vb =>
rw [vb.2] at va
have e := hc.inj a i' j ha hi' va.2.2 hj
rw [e, Found.Pnp62.beq_refl] at va
exact Bool.noConfusion va.2.1
| inr vb => exact hc.inj a b c ha hb va.2.2 vb.2.2
· intro a c ha hac
cases e : Nat.beq a i with
| true =>
rw [Found.Pnp2.beq_eq a i e, sw_i] at hac
rw [(Option.some.inj hac).symm]
exact jn
| false =>
cases e' : Nat.beq a i' with
| true =>
rw [Found.Pnp2.beq_eq a i' e', sw_i' g i i' j hne] at hac
cases hac
| false =>
rw [sw_other g i i' j a e e'] at hac
exact hc.rng a c ha hac
theorem cov_of_pigs (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (i i' j : Nat) (g : Nat -> Option Nat)
(hc : Crit n rho i g) (hf : evalClause (asgP n g) C = false)
(hi' : i' < n + 1) (hne : Nat.beq i' i = false) (hr : rho i' = none) (hj : g i' = some j)
(hnot : pigsB n rho C i' = false) :
memL (true, var n i j) C = true \/ memL (false, var n i' j) C = true := by
cases e : evalClause (asgP n (swapM g i i' j)) C with
| false =>
have t := pigs_complete n rho C i' _ (swap_crit n rho i i' j g hc hi' hne hr hj) e
rw [hnot] at t
exact Bool.noConfusion t
| true => exact swap_cov n g i i' j hc.gi hj C hf e
end Found.Pnp92
#print axioms Found.Pnp92.sw_i
#print axioms Found.Pnp92.sw_i'
#print axioms Found.Pnp92.sw_other
#print axioms Found.Pnp92.swap_crit
#print axioms Found.Pnp92.cov_of_pigs
lean_all/found/Pnp93.lean
/-
T330 piece 93. found/Pnp93 -- the middle clause of a resolution proof (proof complexity
ladder, step 1: general resolution; Beame--Pitassi form of Haken's argument).
nodes p lists the clauses of a resolution proof p. For a measure f on clauses that is at
most one on axioms and subadditive along resolution steps, a proof of a clause with
f > b (b >= 1) contains a clause D with f D <= b < 2 f D. With f = the number of pigeons a
clause can lose under a restriction (Pnp91) this is the middle clause of the argument.
Proved:
* cntI_sub: a count is at most the sum of two counts that cover it;
* cntI_le_one': a predicate true at no two places counts at most one;
* root_mem: the proved clause is a node;
* mid: the middle clause for any such measure;
* cntP_ax, cntP_res, mid_pigs: the middle clause for the pigeon count.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp92
namespace Found.Pnp93
open Found.RootComp (Lit Clause CNF evalClause)
open Found.Pnp62 (memC beqCl ResOK RProof)
open Found.Pnp65 (cntI bv cntI_zero)
open Found.Pnp66 (PHP beqCl_refl)
open Found.Pnp91 (pigsB pigs_res pigs_axiom)
/-- The clauses of a resolution proof (with repetition). -/
def nodes {F : CNF} : {C : Clause} -> RProof F C -> List Clause
| _, .ax C _ => [C]
| R, .res _ _ _ _ p1 p2 _ => R :: (nodes p1 ++ nodes p2)
theorem memC_cons_r (D C : Clause) (L : List Clause) (h : memC D L = true) : memC D (C :: L) = true :=
Found.Pnp62.or_r h
theorem memC_head (C : Clause) (L : List Clause) : memC C (C :: L) = true :=
Found.Pnp62.or_l (beqCl_refl C)
theorem memC_app_l (D : Clause) (B : List Clause) : forall A : List Clause, memC D A = true -> memC D (A ++ B) = true
| [], h => Bool.noConfusion h
| C :: A, h => by
have h' : (beqCl C D || memC D A) = true := h
show (beqCl C D || memC D (A ++ B)) = true
cases e : beqCl C D with
| true => rfl
| false => rw [e] at h'; exact memC_app_l D B A h'
theorem memC_app_r (D : Clause) (B : List Clause) : forall A : List Clause, memC D B = true -> memC D (A ++ B) = true
| [], h => h
| _ :: A, h => Found.Pnp62.or_r (memC_app_r D B A h)
theorem root_mem {F : CNF} : forall {C : Clause} (p : RProof F C), memC C (nodes p) = true
| _, .ax C _ => memC_head C []
| R, .res _ _ _ _ _ _ _ => memC_head R _
theorem bv_or (a b c : Bool) (h : a = true -> b = true \/ c = true) : bv a <= bv b + bv c := by
cases a with
| false => exact Nat.zero_le _
| true =>
cases h rfl with
| inl hb => rw [hb]; exact Nat.le_add_right 1 _
| inr hc => rw [hc]; exact Nat.le_add_left 1 _
theorem add4 (a b c d : Nat) : (a + b) + (c + d) = (a + c) + (b + d) := by
rw [Nat.add_assoc, Nat.add_assoc, Nat.add_left_comm b c d]
theorem cntI_sub (h f g : Nat -> Bool) : forall k, (forall j, j < k -> h j = true -> f j = true \/ g j = true) ->
cntI h k <= cntI f k + cntI g k
| 0, _ => Nat.le_refl 0
| k + 1, hh => by
show cntI h k + bv (h k) <= (cntI f k + bv (f k)) + (cntI g k + bv (g k))
rw [add4]
exact Nat.add_le_add (cntI_sub h f g k (fun j hj => hh j (Nat.lt_succ_of_lt hj)))
(bv_or _ _ _ (hh k (Nat.lt_succ_self k)))
theorem cntI_le_one' (g : Nat -> Bool) (hu : forall i i', g i = true -> g i' = true -> i = i') :
forall k, cntI g k <= 1
| 0 => Nat.zero_le 1
| k + 1 => by
show cntI g k + bv (g k) <= 1
cases e : g k with
| false => exact cntI_le_one' g hu k
| true =>
have z : cntI g k = 0 := cntI_zero g k (fun j hj => by
cases ej : g j with
| false => rfl
| true =>
have t := hu j k ej e
rw [t] at hj
exact absurd hj (Nat.lt_irrefl k))
rw [z]
exact Nat.le_refl 1
theorem le_of_lt_le {a b c : Nat} (h1 : b < a) (h2 : a <= c) (h3 : c <= b) : False :=
Nat.lt_irrefl b (Nat.lt_of_lt_of_le h1 (Nat.le_trans h2 h3))
/-- The middle clause, for any measure that is at most one on axioms and subadditive. -/
theorem mid (F : CNF) (f : Clause -> Nat) (hax : forall C, memC C F = true -> f C <= 1)
(hres : forall C1 C2 R v, ResOK C1 C2 v R -> f R <= f C1 + f C2) (b : Nat) (hb : 1 <= b) :
forall (C : Clause) (p : RProof F C), b < f C ->
Exists fun D => memC D (nodes p) = true /\ f D <= b /\ b < f D + f D := by
intro C p
induction p with
| ax C h => intro hc; exact absurd (hax C h) (fun t => le_of_lt_le hc t hb)
| res C1 C2 R v p1 p2 h ih1 ih2 =>
intro hc
have up : forall D, (memC D (nodes p1) = true \/ memC D (nodes p2) = true) ->
memC D (nodes (RProof.res C1 C2 R v p1 p2 h)) = true := by
intro D hD
apply memC_cons_r
cases hD with
| inl a => exact memC_app_l D _ _ a
| inr a => exact memC_app_r D _ _ a
cases Nat.lt_or_ge b (f C1) with
| inl l1 =>
cases ih1 l1 with
| intro D hD => exact Exists.intro D (And.intro (up D (Or.inl hD.1)) hD.2)
| inr g1 =>
cases Nat.lt_or_ge b (f C2) with
| inl l2 =>
cases ih2 l2 with
| intro D hD => exact Exists.intro D (And.intro (up D (Or.inr hD.1)) hD.2)
| inr g2 =>
have s := Nat.lt_of_lt_of_le hc (hres C1 C2 R v h)
cases Nat.lt_or_ge (f C1) (f C2) with
| inl l =>
refine Exists.intro C2 (And.intro (up C2 (Or.inr (root_mem p2))) (And.intro g2 ?_))
exact Nat.lt_of_lt_of_le s (Nat.add_le_add_right (Nat.le_of_lt l) _)
| inr l =>
refine Exists.intro C1 (And.intro (up C1 (Or.inl (root_mem p1))) (And.intro g1 ?_))
exact Nat.lt_of_lt_of_le s (Nat.add_le_add_left l _)
/-- The number of pigeons a clause can lose under rho. -/
def cntP (n : Nat) (rho : Nat -> Option Nat) (C : Clause) : Nat := cntI (pigsB n rho C) (n + 1)
theorem cntP_ax (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (hm : memC C (PHP n) = true) :
cntP n rho C <= 1 :=
cntI_le_one' _ (fun i i' h h' => pigs_axiom n rho C hm i i' h h') (n + 1)
theorem cntP_res (n : Nat) (rho : Nat -> Option Nat) (C1 C2 R : Clause) (v : Nat) (hr : ResOK C1 C2 v R) :
cntP n rho R <= cntP n rho C1 + cntP n rho C2 :=
cntI_sub _ _ _ (n + 1) (fun i _ h => pigs_res n rho C1 C2 R v hr i h)
theorem mid_pigs (n : Nat) (rho : Nat -> Option Nat) (b : Nat) (hb : 1 <= b) (C : Clause)
(p : RProof (PHP n) C) (hc : b < cntP n rho C) :
Exists fun D => memC D (nodes p) = true /\ cntP n rho D <= b /\ b < cntP n rho D + cntP n rho D :=
mid (PHP n) (cntP n rho) (cntP_ax n rho) (cntP_res n rho) b hb C p hc
end Found.Pnp93
#print axioms Found.Pnp93.memC_cons_r
#print axioms Found.Pnp93.memC_head
#print axioms Found.Pnp93.memC_app_l
#print axioms Found.Pnp93.memC_app_r
#print axioms Found.Pnp93.root_mem
#print axioms Found.Pnp93.bv_or
#print axioms Found.Pnp93.add4
#print axioms Found.Pnp93.cntI_sub
#print axioms Found.Pnp93.cntI_le_one'
#print axioms Found.Pnp93.le_of_lt_le
#print axioms Found.Pnp93.mid
#print axioms Found.Pnp93.cntP_ax
#print axioms Found.Pnp93.cntP_res
#print axioms Found.Pnp93.mid_pigs
lean_all/found/Pnp94.lean
/-
T330 piece 94. found/Pnp94 -- critical maps exist, so the empty clause loses every
remaining pigeon (proof complexity ladder, step 1: general resolution).
A restriction rho is good when its holes are below n, no two pigeons share a hole, and the
remaining pigeons are at most one more than the free holes. For a good rho and a remaining
pigeon i, cmap sends the k-th remaining pigeon other than i to the k-th free hole (a bounded
search, no choice). Proved:
* rank_ex: below cntI P m every rank k is reached by some j with cntI P j = k;
* search_some, search_of: bounded search;
* cntI_agree, cntI_mono, cntI_off, rank_lt: count tools;
* crit_exists: cmap n rho i is critical for i;
* cntP_nil: the empty clause loses exactly the remaining pigeons.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp93
namespace Found.Pnp94
open Found.RootComp (Clause evalClause)
open Found.Pnp65 (cntI bv anyI anyI_false anyI_true)
open Found.Pnp87 (optEq optEq_of optEq_some asgP)
open Found.Pnp88 (selOpt)
open Found.Pnp90 (Crit isNone isNone_eq)
open Found.Pnp91 (pigsB pigs_sound pigs_complete not_true)
open Found.Pnp93 (cntP)
def fillO (r x : Option Nat) : Option Nat :=
match r with
| some j => some j
| none => x
def search (q : Nat -> Bool) : Nat -> Option Nat
| 0 => none
| m + 1 => fillO (search q m) (selOpt (q m) (some m) none)
theorem search_some (q : Nat -> Bool) : forall m j, search q m = some j -> q j = true /\ j < m
| 0, _, h => by cases h
| m + 1, j, h => by
have h' : fillO (search q m) (selOpt (q m) (some m) none) = some j := h
cases e : search q m with
| some j0 =>
rw [e] at h'
have h2 : some j0 = some j := h'
have t := search_some q m j0 e
rw [(Option.some.inj h2).symm]
exact And.intro t.1 (Nat.lt_succ_of_lt t.2)
| none =>
rw [e] at h'
cases eq : q m with
| false => rw [eq] at h'; cases h'
| true =>
rw [eq] at h'
have h2 : some m = some j := h'
rw [(Option.some.inj h2).symm]
exact And.intro eq (Nat.lt_succ_self m)
theorem search_of (q : Nat -> Bool) (j : Nat) (hq : q j = true) : forall m, j < m -> Exists fun j' => search q m = some j'
| 0, h => absurd h (Nat.not_lt_zero j)
| m + 1, h => by
cases e : search q m with
| some j0 =>
refine Exists.intro j0 ?_
show fillO (search q m) _ = some j0
rw [e]; rfl
| none =>
cases Nat.lt_or_ge j m with
| inl l =>
cases search_of q j hq m l with
| intro j' hj' => rw [e] at hj'; cases hj'
| inr r =>
have ejm : j = m := Nat.le_antisymm (Nat.le_of_lt_succ h) r
rw [ejm] at hq
refine Exists.intro m ?_
show fillO (search q m) (selOpt (q m) (some m) none) = some m
rw [e, hq]; rfl
theorem rank_ex (P : Nat -> Bool) : forall m k, k < cntI P m -> Exists fun j => j < m /\ P j = true /\ cntI P j = k
| 0, k, h => absurd h (Nat.not_lt_zero k)
| m + 1, k, h => by
cases Nat.lt_or_ge k (cntI P m) with
| inl l =>
cases rank_ex P m k l with
| intro j hj => exact Exists.intro j (And.intro (Nat.lt_succ_of_lt hj.1) hj.2)
| inr r =>
have h' : k < cntI P m + bv (P m) := h
cases e : P m with
| false =>
rw [e] at h'
exact absurd (Nat.lt_of_lt_of_le (h' : k < cntI P m) r) (Nat.lt_irrefl k)
| true =>
rw [e] at h'
have ek : k = cntI P m := Nat.le_antisymm (Nat.le_of_lt_succ h') r
exact Exists.intro m (And.intro (Nat.lt_succ_self m) (And.intro e ek.symm))
theorem cntI_agree (g g' : Nat -> Bool) : forall k, (forall j, j < k -> g j = g' j) -> cntI g k = cntI g' k
| 0, _ => rfl
| k + 1, h => by
show cntI g k + bv (g k) = cntI g' k + bv (g' k)
rw [cntI_agree g g' k (fun j hj => h j (Nat.lt_succ_of_lt hj)), h k (Nat.lt_succ_self k)]
theorem cntI_mono (g : Nat -> Bool) : forall m' m, m <= m' -> cntI g m <= cntI g m'
| 0, m, h => by
have e : m = 0 := Found.Pnp66.le_zero_eq h
rw [e]; exact Nat.le_refl _
| m' + 1, m, h => by
cases Nat.lt_or_ge m' m with
| inl l =>
have e : m = m' + 1 := Nat.le_antisymm h l
rw [e]; exact Nat.le_refl _
| inr r => exact Nat.le_trans (cntI_mono g m' m r) (Nat.le_add_right _ _)
theorem cntI_off (g g' : Nat -> Bool) (p : Nat) (hp : g p = true) (hp' : g' p = false)
(he : forall j, Nat.beq j p = false -> g j = g' j) : forall k, p < k -> cntI g k = cntI g' k + 1
| 0, h => absurd h (Nat.not_lt_zero p)
| k + 1, h => by
show cntI g k + bv (g k) = cntI g' k + bv (g' k) + 1
cases Nat.lt_or_ge p k with
| inl l =>
rw [cntI_off g g' p hp hp' he k l, he k (Found.Pnp2.beq_false_of_ne k p (Nat.ne_of_lt l).symm)]
exact Nat.add_right_comm _ _ _
| inr r =>
have ek : k = p := Nat.le_antisymm r (Nat.le_of_lt_succ h)
rw [ek, hp, hp', cntI_agree g g' p (fun j hj => he j (Found.Pnp2.beq_false_of_ne j p (Nat.ne_of_lt hj)))]
rfl
theorem rank_lt (P : Nat -> Bool) (a b : Nat) (ha : P a = true) (hab : a < b) : cntI P a < cntI P b := by
have t : cntI P (a + 1) <= cntI P b := cntI_mono P b (a + 1) hab
have u : cntI P (a + 1) = cntI P a + 1 := by
show cntI P a + bv (P a) = cntI P a + 1
rw [ha]; rfl
rw [u] at t
exact t
/-- Free holes, remaining pigeons, remaining pigeons other than i. -/
def freeH (n : Nat) (rho : Nat -> Option Nat) (j : Nat) : Bool := !(anyI (fun a => optEq (rho a) j) (n + 1))
def remP (rho : Nat -> Option Nat) (a : Nat) : Bool := isNone (rho a)
def remX (rho : Nat -> Option Nat) (i a : Nat) : Bool := isNone (rho a) && !(Nat.beq a i)
def holeQ (n : Nat) (rho : Nat -> Option Nat) (i a : Nat) (j : Nat) : Bool :=
freeH n rho j && Nat.beq (cntI (freeH n rho) j) (cntI (remX rho i) a)
/-- The k-th remaining pigeon other than i goes to the k-th free hole. -/
def cmap (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (a : Nat) : Option Nat :=
selOpt (Nat.beq a i) none (fillO (rho a) (search (holeQ n rho i a) n))
/-- rho is good: holes below n, injective, remaining at most free holes plus one. -/
structure Good (n : Nat) (rho : Nat -> Option Nat) : Prop where
rng : forall a j, a < n + 1 -> rho a = some j -> j < n
inj : forall a a' j, a < n + 1 -> a' < n + 1 -> rho a = some j -> rho a' = some j -> a = a'
cnt : cntI (remP rho) (n + 1) <= cntI (freeH n rho) n + 1
theorem freeH_not (n : Nat) (rho : Nat -> Option Nat) (j : Nat) (h : freeH n rho j = true) (a : Nat) (ha : a < n + 1)
(hr : rho a = some j) : False := by
have t := anyI_false _ (n + 1) (not_true h) a ha
rw [optEq_of (rho a) j hr] at t
exact Bool.noConfusion t
theorem cmap_val (n : Nat) (rho : Nat -> Option Nat) (i a c : Nat) (hai : Nat.beq a i = false)
(h : cmap n rho i a = some c) :
rho a = some c \/ (rho a = none /\ freeH n rho c = true /\ cntI (freeH n rho) c = cntI (remX rho i) a /\ c < n) := by
have h' : selOpt (Nat.beq a i) none (fillO (rho a) (search (holeQ n rho i a) n)) = some c := h
rw [hai] at h'
have h2 : fillO (rho a) (search (holeQ n rho i a) n) = some c := h'
cases er : rho a with
| some j =>
rw [er] at h2
have h3 : some j = some c := h2
rw [Option.some.inj h3]
exact Or.inl rfl
| none =>
rw [er] at h2
have t := search_some _ n c h2
exact Or.inr (And.intro rfl (And.intro (Found.Pnp62.and_l t.1)
(And.intro (Found.Pnp2.beq_eq _ _ (Found.Pnp62.and_r t.1)) t.2)))
theorem remX_true (rho : Nat -> Option Nat) (i a : Nat) (hai : Nat.beq a i = false) (hr : rho a = none) :
remX rho i a = true := by
show (isNone (rho a) && !(Nat.beq a i)) = true
rw [hr, hai]; rfl
theorem rem_count (n : Nat) (rho : Nat -> Option Nat) (i : Nat) (hi : i < n + 1) (hr : rho i = none) :
cntI (remP rho) (n + 1) = cntI (remX rho i) (n + 1) + 1 := by
refine cntI_off _ _ i ?_ ?_ ?_ (n + 1) hi
· show isNone (rho i) = true
rw [hr]; rfl
· show (isNone (rho i) && !(Nat.beq i i)) = false
rw [Found.Pnp62.beq_refl]
cases isNone (rho i) <;> rfl
· intro j hj
show isNone (rho j) = (isNone (rho j) && !(Nat.beq j i))
rw [hj]
cases isNone (rho j) <;> rfl
theorem crit_exists (n : Nat) (rho : Nat -> Option Nat) (hg : Good n rho) (i : Nat) (hi : i < n + 1)
(hr : rho i = none) : Crit n rho i (cmap n rho i) := by
have gi : cmap n rho i i = none := by
show selOpt (Nat.beq i i) none _ = none
rw [Found.Pnp62.beq_refl]; rfl
have other : forall a, Nat.beq a i = false -> cmap n rho i a = fillO (rho a) (search (holeQ n rho i a) n) := by
intro a hai
show selOpt (Nat.beq a i) none _ = _
rw [hai]; rfl
refine Crit.mk gi hr hi ?_ ?_ ?_ ?_
· intro a ha hai hra
have rx := remX_true rho i a hai hra
have k1 : cntI (remX rho i) a < cntI (remX rho i) (n + 1) := rank_lt _ a (n + 1) rx ha
have k2 : cntI (remX rho i) (n + 1) <= cntI (freeH n rho) n := by
have c := hg.cnt
rw [rem_count n rho i hi hr] at c
exact Nat.le_of_succ_le_succ c
cases rank_ex (freeH n rho) n _ (Nat.lt_of_lt_of_le k1 k2) with
| intro j0 hj0 =>
have q0 : holeQ n rho i a j0 = true := by
show (freeH n rho j0 && Nat.beq (cntI (freeH n rho) j0) (cntI (remX rho i) a)) = true
rw [hj0.2.1, hj0.2.2, Found.Pnp62.beq_refl]; rfl
cases search_of _ j0 q0 n hj0.1 with
| intro j' hj' =>
refine Exists.intro j' (And.intro ?_ (search_some _ n j' hj').2)
rw [other a hai, hra]
exact hj'
· intro a j ha hai hra
rw [other a hai, hra]; rfl
· intro a b c ha hb h1 h2
cases ea : Nat.beq a i with
| true => rw [Found.Pnp2.beq_eq a i ea, gi] at h1; cases h1
| false =>
cases eb : Nat.beq b i with
| true => rw [Found.Pnp2.beq_eq b i eb, gi] at h2; cases h2
| false =>
cases cmap_val n rho i a c ea h1 with
| inl va =>
cases cmap_val n rho i b c eb h2 with
| inl vb => exact hg.inj a b c ha hb va vb
| inr vb => exact absurd (freeH_not n rho c vb.2.1 a ha va) (fun x => x)
| inr va =>
cases cmap_val n rho i b c eb h2 with
| inl vb => exact absurd (freeH_not n rho c va.2.1 b hb vb) (fun x => x)
| inr vb =>
have ek : cntI (remX rho i) a = cntI (remX rho i) b := va.2.2.1.symm.trans vb.2.2.1
cases Nat.lt_or_ge a b with
| inl l =>
have t := rank_lt _ a b (remX_true rho i a ea va.1) l
rw [ek] at t
exact absurd t (Nat.lt_irrefl _)
| inr r =>
cases Nat.lt_or_ge b a with
| inl l =>
have t := rank_lt _ b a (remX_true rho i b eb vb.1) l
rw [ek] at t
exact absurd t (Nat.lt_irrefl _)
| inr r' => exact Nat.le_antisymm r' r
· intro a c ha hac
cases ea : Nat.beq a i with
| true => rw [Found.Pnp2.beq_eq a i ea, gi] at hac; cases hac
| false =>
cases cmap_val n rho i a c ea hac with
| inl va => exact hg.rng a c ha va
| inr va => exact va.2.2.2
/-- The empty clause loses exactly the remaining pigeons. -/
theorem cntP_nil (n : Nat) (rho : Nat -> Option Nat) (hg : Good n rho) :
cntP n rho [] = cntI (remP rho) (n + 1) := by
apply Nat.le_antisymm
· refine Found.Pnp65.cntI_le _ _ (n + 1) ?_
intro j _ h
cases pigs_sound n rho [] j h with
| intro g hg' =>
show isNone (rho j) = true
rw [hg'.1.ri]; rfl
· refine Found.Pnp65.cntI_le _ _ (n + 1) ?_
intro j hj h
have hr : rho j = none := isNone_eq _ h
exact pigs_complete n rho [] j _ (crit_exists n rho hg j hj hr) rfl
end Found.Pnp94
#print axioms Found.Pnp94.search_some
#print axioms Found.Pnp94.search_of
#print axioms Found.Pnp94.rank_ex
#print axioms Found.Pnp94.cntI_agree
#print axioms Found.Pnp94.cntI_mono
#print axioms Found.Pnp94.cntI_off
#print axioms Found.Pnp94.rank_lt
#print axioms Found.Pnp94.freeH_not
#print axioms Found.Pnp94.cmap_val
#print axioms Found.Pnp94.remX_true
#print axioms Found.Pnp94.rem_count
#print axioms Found.Pnp94.crit_exists
#print axioms Found.Pnp94.cntP_nil
lean_all/found/Pnp95.lean
/-
T330 piece 95. found/Pnp95 -- a clause that loses s pigeons and keeps u remaining pigeons
covers at least s * u (pigeon, free hole) pairs (proof complexity ladder, step 1: general
resolution; the width step of Beame--Pitassi).
covB n C i j: C holds x(i, j), or holds not x(a, j) for some pigeon a other than i (the
monotone form of C names the pair (i, j)). covCnt n rho C counts the pairs with i remaining
and j a free hole. Proved:
* inj_count: an injective map from a counted set into another counts at most the second;
* cntI_split: a count splits along any Bool test;
* sumI_ge: a sum of rows each at least m over a set of size c is at least m * c;
* row_ge: a pigeon the clause loses has a row of at least u covered free holes;
* width: cntP C * u <= covCnt C, where u counts the remaining pigeons C keeps;
* split_rem: cntP C + u = the number of remaining pigeons.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp94
namespace Found.Pnp95
open Found.RootComp (Clause evalClause)
open Found.Pnp62 (memL)
open Found.Pnp65 (var cntI bv anyI anyI_true)
open Found.Pnp87 (optEq asgP)
open Found.Pnp90 (Crit isNone isNone_eq)
open Found.Pnp91 (pigsB pigs_sound)
open Found.Pnp92 (cov_of_pigs)
open Found.Pnp93 (cntP add4)
open Found.Pnp94 (freeH remP Good cntI_off cntI_agree)
def covB (n : Nat) (C : Clause) (i j : Nat) : Bool :=
memL (true, var n i j) C || anyI (fun a => !(Nat.beq a i) && memL (false, var n a j) C) (n + 1)
def sumI (h : Nat -> Nat) : Nat -> Nat
| 0 => 0
| k + 1 => sumI h k + h k
def rowC (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (i : Nat) : Nat :=
cntI (fun j => remP rho i && freeH n rho j && covB n C i j) n
def covCnt (n : Nat) (rho : Nat -> Option Nat) (C : Clause) : Nat := sumI (rowC n rho C) (n + 1)
/-- Remaining pigeons the clause keeps. -/
def nonP (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (a : Nat) : Bool := remP rho a && !(pigsB n rho C a)
def optGet : Option Nat -> Nat
| none => 0
| some j => j
theorem inj_count (A : Nat -> Bool) (f : Nat -> Nat) (M : Nat) :
forall N (B : Nat -> Bool), (forall x, x < N -> A x = true -> f x < M /\ B (f x) = true) ->
(forall x y, x < N -> y < N -> A x = true -> A y = true -> f x = f y -> x = y) ->
cntI A N <= cntI B M
| 0, _, _, _ => Nat.zero_le _
| N + 1, B, hm, hi => by
show cntI A N + bv (A N) <= cntI B M
cases eN : A N with
| false =>
exact inj_count A f M N B (fun x hx => hm x (Nat.lt_succ_of_lt hx))
(fun x y hx hy => hi x y (Nat.lt_succ_of_lt hx) (Nat.lt_succ_of_lt hy))
| true =>
have pN := hm N (Nat.lt_succ_self N) eN
let B' : Nat -> Bool := fun y => B y && !(Nat.beq y (f N))
have ih : cntI A N <= cntI B' M := by
refine inj_count A f M N B' ?_ (fun x y hx hy => hi x y (Nat.lt_succ_of_lt hx) (Nat.lt_succ_of_lt hy))
intro x hx hA
have px := hm x (Nat.lt_succ_of_lt hx) hA
refine And.intro px.1 ?_
show (B (f x) && !(Nat.beq (f x) (f N))) = true
have ne : Nat.beq (f x) (f N) = false := Found.Pnp2.beq_false_of_ne _ _ (fun e => by
have t := hi x N (Nat.lt_succ_of_lt hx) (Nat.lt_succ_self N) hA eN e
rw [t] at hx
exact Nat.lt_irrefl N hx)
rw [px.2, ne]; rfl
have off : cntI B M = cntI B' M + 1 := by
refine cntI_off B B' (f N) pN.2 ?_ ?_ M pN.1
· show (B (f N) && !(Nat.beq (f N) (f N))) = false
rw [Found.Pnp62.beq_refl]
cases B (f N) <;> rfl
· intro j hj
show B j = (B j && !(Nat.beq j (f N)))
rw [hj]
cases B j <;> rfl
rw [off]
exact Nat.succ_le_succ ih
theorem cntI_split (g h : Nat -> Bool) : forall k,
cntI g k = cntI (fun j => g j && h j) k + cntI (fun j => g j && !(h j)) k
| 0 => rfl
| k + 1 => by
show cntI g k + bv (g k) = (cntI (fun j => g j && h j) k + bv (g k && h k)) + (cntI (fun j => g j && !(h j)) k + bv (g k && !(h k)))
rw [cntI_split g h k, add4 (cntI _ k) (bv _) (cntI _ k) (bv _)]
cases g k <;> cases h k <;> rfl
theorem sumI_ge (h : Nat -> Nat) (P : Nat -> Bool) (m : Nat) : forall k,
(forall i, i < k -> P i = true -> m <= h i) -> m * cntI P k <= sumI h k
| 0, _ => Nat.le_refl 0
| k + 1, hh => by
have ih := sumI_ge h P m k (fun i hi => hh i (Nat.lt_succ_of_lt hi))
show m * (cntI P k + bv (P k)) <= sumI h k + h k
cases e : P k with
| false => exact Nat.le_trans ih (Nat.le_add_right _ _)
| true => exact Nat.add_le_add ih (hh k (Nat.lt_succ_self k) e)
theorem free_of_crit (n : Nat) (rho : Nat -> Option Nat) (i a j : Nat) (g : Nat -> Option Nat) (hc : Crit n rho i g)
(ha : a < n + 1) (hr : rho a = none) (hj : g a = some j) : freeH n rho j = true := by
have hz : anyI (fun b => optEq (rho b) j) (n + 1) = false := by
refine Found.Pnp66.anyI_none _ (n + 1) ?_
intro b hb
cases eb : rho b with
| none => rfl
| some c =>
show Nat.beq c j = false
cases ec : Nat.beq c j with
| false => rfl
| true =>
have cj : c = j := Found.Pnp2.beq_eq c j ec
rw [cj] at eb
have bi : Nat.beq b i = false := Found.Pnp2.beq_false_of_ne b i (fun e => by
rw [e, hc.ri] at eb; cases eb)
have gb := hc.fixed b j hb bi eb
have t := hc.inj b a j hb ha gb hj
rw [t, hr] at eb
cases eb
show (!(anyI (fun b => optEq (rho b) j) (n + 1))) = true
rw [hz]; rfl
theorem row_ge (n : Nat) (rho : Nat -> Option Nat) (C : Clause) (i : Nat) (hp : pigsB n rho C i = true) :
cntI (nonP n rho C) (n + 1) <= rowC n rho C i := by
cases pigs_sound n rho C i hp with
| intro g hg =>
have hc := hg.1
have gsome : forall a, a < n + 1 -> nonP n rho C a = true ->
rho a = none /\ pigsB n rho C a = false /\ Nat.beq a i = false /\ Exists fun j => g a = some j /\ j < n := by
intro a ha hA
have r : rho a = none := isNone_eq _ (Found.Pnp62.and_l hA)
have np : pigsB n rho C a = false := Found.Pnp91.not_true (Found.Pnp62.and_r hA)
have ai : Nat.beq a i = false := Found.Pnp2.beq_false_of_ne a i (fun e => by
rw [e, hp] at np; cases np)
exact And.intro r (And.intro np (And.intro ai (hc.free a ha ai r)))
refine inj_count _ (fun a => optGet (g a)) n (n + 1) _ ?_ ?_
· intro a ha hA
have s := gsome a ha hA
cases s.2.2.2 with
| intro j hj =>
show optGet (g a) < n /\ (remP rho i && freeH n rho (optGet (g a)) && covB n C i (optGet (g a))) = true
rw [hj.1]
refine And.intro hj.2 ?_
have ri : remP rho i = true := by show isNone (rho i) = true; rw [hc.ri]; rfl
have fr := free_of_crit n rho i a j g hc ha s.1 hj.1
have cv : covB n C i j = true := by
cases cov_of_pigs n rho C i a j g hc hg.2 ha s.2.2.1 s.1 hj.1 s.2.1 with
| inl h1 => exact Found.Pnp62.or_l h1
| inr h2 =>
apply Found.Pnp62.or_r
refine anyI_true _ a ?_ (n + 1) ha
show (!(Nat.beq a i) && memL (false, var n a j) C) = true
rw [s.2.2.1, h2]; rfl
show (remP rho i && freeH n rho j && covB n C i j) = true
rw [ri, fr, cv]; rfl
· intro x y hx hy hAx hAy e
cases (gsome x hx hAx).2.2.2 with
| intro jx hjx =>
cases (gsome y hy hAy).2.2.2 with
| intro jy hjy =>
have e' : optGet (g x) = optGet (g y) := e
rw [hjx.1, hjy.1] at e'
have e2 : jx = jy := e'
rw [e2] at hjx
exact hc.inj x y jy hx hy hjx.1 hjy.1
theorem width (n : Nat) (rho : Nat -> Option Nat) (C : Clause) :
cntP n rho C * cntI (nonP n rho C) (n + 1) <= covCnt n rho C := by
have t := sumI_ge (rowC n rho C) (pigsB n rho C) (cntI (nonP n rho C) (n + 1)) (n + 1)
(fun i _ hp => row_ge n rho C i hp)
rw [Nat.mul_comm]
exact t
theorem split_rem (n : Nat) (rho : Nat -> Option Nat) (C : Clause) :
cntP n rho C + cntI (nonP n rho C) (n + 1) = cntI (remP rho) (n + 1) := by
rw [cntI_split (remP rho) (pigsB n rho C) (n + 1)]
have e : cntI (fun j => remP rho j && pigsB n rho C j) (n + 1) = cntP n rho C := by
refine cntI_agree _ _ (n + 1) ?_
intro j _
cases ep : pigsB n rho C j with
| false => show (remP rho j && false) = false; cases remP rho j <;> rfl
| true =>
cases pigs_sound n rho C j ep with
| intro g hg =>
show (isNone (rho j) && true) = true
rw [hg.1.ri]; rfl
rw [e]
rfl
end Found.Pnp95
#print axioms Found.Pnp95.inj_count
#print axioms Found.Pnp95.cntI_split
#print axioms Found.Pnp95.sumI_ge
#print axioms Found.Pnp95.free_of_crit
#print axioms Found.Pnp95.row_ge
#print axioms Found.Pnp95.width
#print axioms Found.Pnp95.split_rem
lean_all/found/Pnp96.lean
/-
T330 piece 96. found/Pnp96 -- extending a restriction by one pigeon-hole pair (proof
complexity ladder, step 1: general resolution; the restriction step of Beame--Pitassi).
ext rho i j fixes the remaining pigeon i in the free hole j. Proved:
* anyI_ex: a true bounded disjunction has a witness;
* good_ext, rem_ext, free_ext: ext keeps rho good and removes one remaining pigeon and
one free hole;
* crit_back, pigs_back, cntP_back: a map critical for ext rho i j is critical for rho, so
a clause loses no new pigeon;
* kill: a clause covering (i, j) loses no pigeon under ext rho i j;
* covCnt_back: the covered pair count does not grow.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp95
namespace Found.Pnp96
open Found.RootComp (Clause evalClause evalLit)
open Found.Pnp62 (memL of_mem)
open Found.Pnp65 (var cntI bv anyI anyI_true anyI_false anyI_congr cntI_le cntI_zero)
open Found.Pnp87 (optEq optEq_of optEq_some asgP asg_var)
open Found.Pnp88 (selOpt)
open Found.Pnp90 (Crit isNone isNone_eq)
open Found.Pnp91 (pigsB pigs_sound pigs_complete not_true)
open Found.Pnp93 (cntP)
open Found.Pnp94 (freeH remP Good cntI_off cntI_agree freeH_not)
open Found.Pnp95 (covB sumI rowC covCnt)
def ext (rho : Nat -> Option Nat) (i j : Nat) : Nat -> Option Nat :=
fun a => selOpt (Nat.beq a i) (some j) (rho a)
theorem ext_i (rho : Nat -> Option Nat) (i j : Nat) : ext rho i j i = some j := by
show selOpt (Nat.beq i i) (some j) (rho i) = some j
rw [Found.Pnp62.beq_refl]; rfl
theorem ext_o (rho : Nat -> Option Nat) (i j a : Nat) (h : Nat.beq a i = false) : ext rho i j a = rho a := by
show selOpt (Nat.beq a i) (some j) (rho a) = rho a
rw [h]; rfl
theorem anyI_ex (g : Nat -> Bool) : forall k, anyI g k = true -> Exists fun j => j < k /\ g j = true
| 0, h => Bool.noConfusion h
| k + 1, h => by
have h' : (anyI g k || g k) = true := h
cases e : anyI g k with
| true =>
cases anyI_ex g k e with
| intro j hj => exact Exists.intro j (And.intro (Nat.lt_succ_of_lt hj.1) hj.2)
| false =>
rw [e] at h'
exact Exists.intro k (And.intro (Nat.lt_succ_self k) h')
theorem ne_of_rho (rho : Nat -> Option Nat) (i a c : Nat) (hr : rho i = none) (ha : rho a = some c) :
Nat.beq a i = false :=
Found.Pnp2.beq_false_of_ne a i (fun e => by rw [e, hr] at ha; cases ha)
/-- Free holes under ext: all those of rho but j. -/
theorem freeH_ext (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hr : rho i = none) (j' : Nat)
(hj : Nat.beq j' j = false) : freeH n (ext rho i j) j' = freeH n rho j' := by
have t : anyI (fun a => optEq (ext rho i j a) j') (n + 1) = anyI (fun a => optEq (rho a) j') (n + 1) := by
refine anyI_congr _ _ (n + 1) ?_
intro a _
show optEq (ext rho i j a) j' = optEq (rho a) j'
cases ea : Nat.beq a i with
| false => rw [ext_o rho i j a ea]
| true =>
rw [Found.Pnp2.beq_eq a i ea, ext_i, hr]
exact Found.Pnp70.nsym j' j hj
show (!(anyI (fun a => optEq (ext rho i j a) j') (n + 1))) = (!(anyI (fun a => optEq (rho a) j') (n + 1)))
rw [t]
theorem freeH_ext_j (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) :
freeH n (ext rho i j) j = false := by
have t : anyI (fun a => optEq (ext rho i j a) j) (n + 1) = true := by
refine anyI_true _ i ?_ (n + 1) hi
show optEq (ext rho i j i) j = true
rw [ext_i]; exact optEq_of _ j rfl
show (!(anyI (fun a => optEq (ext rho i j a) j) (n + 1))) = false
rw [t]; rfl
theorem rem_ext (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) (hr : rho i = none) :
cntI (remP rho) (n + 1) = cntI (remP (ext rho i j)) (n + 1) + 1 := by
refine cntI_off _ _ i ?_ ?_ ?_ (n + 1) hi
· show isNone (rho i) = true
rw [hr]; rfl
· show isNone (ext rho i j i) = false
rw [ext_i]; rfl
· intro a ha
show isNone (rho a) = isNone (ext rho i j a)
rw [ext_o rho i j a ha]
theorem free_ext (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) (hr : rho i = none) (hj : j < n)
(hf : freeH n rho j = true) : cntI (freeH n rho) n = cntI (freeH n (ext rho i j)) n + 1 :=
cntI_off _ _ j hf (freeH_ext_j n rho i j hi) (fun j' h => (freeH_ext n rho i j hr j' h).symm) n hj
theorem good_ext (n : Nat) (rho : Nat -> Option Nat) (hg : Good n rho) (i j : Nat) (hi : i < n + 1)
(hr : rho i = none) (hj : j < n) (hf : freeH n rho j = true) : Good n (ext rho i j) := by
refine Good.mk ?_ ?_ ?_
· intro a c ha h
cases ea : Nat.beq a i with
| true =>
rw [Found.Pnp2.beq_eq a i ea, ext_i] at h
rw [(Option.some.inj h).symm]; exact hj
| false =>
rw [ext_o rho i j a ea] at h
exact hg.rng a c ha h
· intro a a' c ha ha' h h'
cases ea : Nat.beq a i with
| true =>
cases ea' : Nat.beq a' i with
| true => rw [Found.Pnp2.beq_eq a i ea, Found.Pnp2.beq_eq a' i ea']
| false =>
rw [Found.Pnp2.beq_eq a i ea, ext_i] at h
rw [ext_o rho i j a' ea', (Option.some.inj h).symm] at h'
exact absurd (freeH_not n rho j hf a' ha' h') (fun x => x)
| false =>
cases ea' : Nat.beq a' i with
| true =>
rw [Found.Pnp2.beq_eq a' i ea', ext_i] at h'
rw [ext_o rho i j a ea, (Option.some.inj h').symm] at h
exact absurd (freeH_not n rho j hf a ha h) (fun x => x)
| false =>
rw [ext_o rho i j a ea] at h
rw [ext_o rho i j a' ea'] at h'
exact hg.inj a a' c ha ha' h h'
· have c := hg.cnt
rw [rem_ext n rho i j hi hr, free_ext n rho i j hi hr hj hf] at c
exact Nat.le_of_succ_le_succ c
theorem crit_back (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hr : rho i = none) (a : Nat)
(g : Nat -> Option Nat) (hc : Crit n (ext rho i j) a g) : Crit n rho a g := by
have ai : Nat.beq a i = false := by
cases ea : Nat.beq a i with
| false => rfl
| true =>
have t := hc.ri
rw [Found.Pnp2.beq_eq a i ea, ext_i] at t
cases t
refine Crit.mk hc.gi ?_ hc.il ?_ ?_ hc.inj hc.rng
· have t := hc.ri
rw [ext_o rho i j a ai] at t
exact t
· intro b hb hba hrb
cases eb : Nat.beq b i with
| true =>
have bi := Found.Pnp2.beq_eq b i eb
have gb := hc.fixed b j hb hba (by rw [bi]; exact ext_i rho i j)
exact Exists.intro j (And.intro gb (hc.rng b j hb gb))
| false =>
exact hc.free b hb hba (by rw [ext_o rho i j b eb]; exact hrb)
· intro b c hb hba hrb
exact hc.fixed b c hb hba (by rw [ext_o rho i j b (ne_of_rho rho i b c hr hrb)]; exact hrb)
theorem pigs_back (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hr : rho i = none) (C : Clause) (a : Nat)
(h : pigsB n (ext rho i j) C a = true) : pigsB n rho C a = true :=
match pigs_sound n (ext rho i j) C a h with
| Exists.intro g hg => pigs_complete n rho C a g (crit_back n rho i j hr a g hg.1) hg.2
theorem cntP_back (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hr : rho i = none) (C : Clause) :
cntP n (ext rho i j) C <= cntP n rho C :=
cntI_le _ _ (n + 1) (fun a _ h => pigs_back n rho i j hr C a h)
theorem kill (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) (hj : j < n) (C : Clause)
(hcov : covB n C i j = true) (a : Nat) : pigsB n (ext rho i j) C a = false := by
cases e : pigsB n (ext rho i j) C a with
| false => rfl
| true =>
cases pigs_sound n (ext rho i j) C a e with
| intro g hg =>
have hc := hg.1
have ai : Nat.beq a i = false := by
cases ea : Nat.beq a i with
| false => rfl
| true =>
have t := hc.ri
rw [Found.Pnp2.beq_eq a i ea, ext_i] at t
cases t
have gi : g i = some j := hc.fixed i j hi (Found.Pnp70.nsym a i ai) (ext_i rho i j)
have tr : evalClause (asgP n g) C = true := by
cases e1 : memL (true, var n i j) C with
| true =>
refine of_mem _ (true, var n i j) ?_ C e1
show asgP n g (var n i j) = true
rw [asg_var n g i j hi hj, gi]
exact optEq_of _ j rfl
| false =>
have h2 : (memL (true, var n i j) C || anyI (fun b => !(Nat.beq b i) && memL (false, var n b j) C) (n + 1)) = true := hcov
rw [e1] at h2
have h3 : anyI (fun b => !(Nat.beq b i) && memL (false, var n b j) C) (n + 1) = true := h2
cases anyI_ex _ (n + 1) h3 with
| intro a' ha' =>
have nb : Nat.beq a' i = false := not_true (Found.Pnp62.and_l ha'.2)
refine of_mem _ (false, var n a' j) ?_ C (Found.Pnp62.and_r ha'.2)
show (!(asgP n g (var n a' j))) = true
rw [asg_var n g a' j ha'.1 hj]
have o : optEq (g a') j = false := by
cases eg : g a' with
| none => rfl
| some c =>
show Nat.beq c j = false
cases ec : Nat.beq c j with
| false => rfl
| true =>
rw [Found.Pnp2.beq_eq c j ec] at eg
have t := hc.inj a' i j ha'.1 hi eg gi
rw [t, Found.Pnp62.beq_refl] at nb
exact Bool.noConfusion nb
rw [o]; rfl
rw [hg.2] at tr
exact Bool.noConfusion tr
theorem cntP_kill (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) (hj : j < n) (C : Clause)
(hcov : covB n C i j = true) : cntP n (ext rho i j) C = 0 :=
cntI_zero _ (n + 1) (fun a _ => kill n rho i j hi hj C hcov a)
theorem sumI_le (h h' : Nat -> Nat) : forall k, (forall x, x < k -> h x <= h' x) -> sumI h k <= sumI h' k
| 0, _ => Nat.le_refl 0
| k + 1, hh => Nat.add_le_add (sumI_le h h' k (fun x hx => hh x (Nat.lt_succ_of_lt hx))) (hh k (Nat.lt_succ_self k))
theorem covCnt_back (n : Nat) (rho : Nat -> Option Nat) (i j : Nat) (hi : i < n + 1) (hr : rho i = none) (C : Clause) :
covCnt n (ext rho i j) C <= covCnt n rho C := by
refine sumI_le _ _ (n + 1) ?_
intro a _
refine cntI_le _ _ n ?_
intro j' _ h
have h1 := Found.Pnp62.and_l h
have rm : remP (ext rho i j) a = true := Found.Pnp62.and_l h1
have fr : freeH n (ext rho i j) j' = true := Found.Pnp62.and_r h1
have cv : covB n C a j' = true := Found.Pnp62.and_r h
have ea : ext rho i j a = none := isNone_eq _ rm
have ai : Nat.beq a i = false := by
cases e : Nat.beq a i with
| false => rfl
| true => rw [Found.Pnp2.beq_eq a i e, ext_i] at ea; cases ea
have rm' : remP rho a = true := by
show isNone (rho a) = true
rw [(ext_o rho i j a ai).symm, ea]; rfl
have jj : Nat.beq j' j = false := by
cases e : Nat.beq j' j with
| false => rfl
| true =>
rw [Found.Pnp2.beq_eq j' j e, freeH_ext_j n rho i j hi] at fr
exact Bool.noConfusion fr
have fr' : freeH n rho j' = true := by rw [(freeH_ext n rho i j hr j' jj).symm]; exact fr
show (remP rho a && freeH n rho j' && covB n C a j') = true
rw [rm', fr', cv]; rfl
end Found.Pnp96
#print axioms Found.Pnp96.ext_i
#print axioms Found.Pnp96.ext_o
#print axioms Found.Pnp96.anyI_ex
#print axioms Found.Pnp96.ne_of_rho
#print axioms Found.Pnp96.freeH_ext
#print axioms Found.Pnp96.freeH_ext_j
#print axioms Found.Pnp96.rem_ext
#print axioms Found.Pnp96.free_ext
#print axioms Found.Pnp96.good_ext
#print axioms Found.Pnp96.crit_back
#print axioms Found.Pnp96.pigs_back
#print axioms Found.Pnp96.cntP_back
#print axioms Found.Pnp96.kill
#print axioms Found.Pnp96.cntP_kill
#print axioms Found.Pnp96.sumI_le
#print axioms Found.Pnp96.covCnt_back
lean_all/found/Pnp97.lean
/-
T330 piece 97. found/Pnp97 -- averaging: some free pair is covered by many clauses of a
list (proof complexity ladder, step 1: general resolution; the averaging step of
Beame--Pitassi).
For a list Ws of clauses with total covered pair count T = sum of covCnt over Ws, if T > 0
there is a remaining pigeon i and a free hole j such that
T <= (number of clauses of Ws covering (i, j)) * (free holes) * (remaining pigeons).
The pair is found by a computed arg-max (no choice). Proved:
* sumI_zero, sumI_add, sumI_ext, cntI_sumI: sum tools;
* swap: a list sum of bounded sums is the bounded sum of list sums;
* amax_ge, amax_succ_lt: the computed arg-max;
* sum_le: a sum is at most its maximum times the size of its support;
* avg: the averaging step.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp96
namespace Found.Pnp97
open Found.RootComp (Clause)
open Found.Pnp65 (cntI bv selN)
open Found.Pnp93 (add4)
open Found.Pnp94 (freeH remP)
open Found.Pnp95 (covB sumI rowC covCnt)
open Found.Pnp96 (sumI_le)
def lsum (h : Clause -> Nat) : List Clause -> Nat
| [] => 0
| D :: L => h D + lsum h L
def lcnt (p : Clause -> Bool) (L : List Clause) : Nat := lsum (fun D => bv (p D)) L
theorem sumI_zero : forall k, sumI (fun _ => 0) k = 0
| 0 => rfl
| k + 1 => sumI_zero k
theorem sumI_add (a b : Nat -> Nat) : forall k, sumI (fun x => a x + b x) k = sumI a k + sumI b k
| 0 => rfl
| k + 1 => by
show sumI (fun x => a x + b x) k + (a k + b k) = (sumI a k + a k) + (sumI b k + b k)
rw [sumI_add a b k]
exact add4 _ _ _ _
theorem sumI_ext (h h' : Nat -> Nat) (he : forall x, h x = h' x) : forall k, sumI h k = sumI h' k
| 0 => rfl
| k + 1 => by
show sumI h k + h k = sumI h' k + h' k
rw [sumI_ext h h' he k, he k]
theorem lsum_ext (h h' : Clause -> Nat) (he : forall D, h D = h' D) : forall L, lsum h L = lsum h' L
| [] => rfl
| D :: L => by
show h D + lsum h L = h' D + lsum h' L
rw [he D, lsum_ext h h' he L]
theorem lsum_zero (h : Clause -> Nat) (hz : forall D, h D = 0) : forall L, lsum h L = 0
| [] => rfl
| D :: L => by
show h D + lsum h L = 0
rw [hz D, lsum_zero h hz L]
theorem cntI_sumI (g : Nat -> Bool) : forall k, cntI g k = sumI (fun j => bv (g j)) k
| 0 => rfl
| k + 1 => by
show cntI g k + bv (g k) = sumI (fun j => bv (g j)) k + bv (g k)
rw [cntI_sumI g k]
theorem swap (f : Clause -> Nat -> Nat) (k : Nat) : forall L,
lsum (fun D => sumI (f D) k) L = sumI (fun i => lsum (fun D => f D i) L) k
| [] => (sumI_zero k).symm
| D :: L => by
show sumI (f D) k + lsum (fun D => sumI (f D) k) L = sumI (fun i => f D i + lsum (fun D => f D i) L) k
rw [swap f k L]
exact (sumI_add _ _ k).symm
theorem zero_mul' : forall m : Nat, 0 * m = 0
| 0 => rfl
| m + 1 => zero_mul' m
def amax (h : Nat -> Nat) : Nat -> Nat
| 0 => 0
| k + 1 => selN (Nat.blt (h (amax h k)) (h k)) k (amax h k)
theorem amax_le (h : Nat -> Nat) : forall k, amax h k <= k
| 0 => Nat.le_refl 0
| k + 1 => by
show selN (Nat.blt (h (amax h k)) (h k)) k (amax h k) <= k + 1
cases Nat.blt (h (amax h k)) (h k) with
| true => exact Nat.le_succ k
| false => exact Nat.le_trans (amax_le h k) (Nat.le_succ k)
theorem amax_succ_lt (h : Nat -> Nat) (k : Nat) : amax h (k + 1) < k + 1 := by
show selN (Nat.blt (h (amax h k)) (h k)) k (amax h k) < k + 1
cases Nat.blt (h (amax h k)) (h k) with
| true => exact Nat.lt_succ_self k
| false => exact Nat.lt_succ_of_le (amax_le h k)
theorem amax_ge (h : Nat -> Nat) : forall k x, x < k -> h x <= h (amax h k)
| 0, x, hx => absurd hx (Nat.not_lt_zero x)
| k + 1, x, hx => by
show h x <= h (selN (Nat.blt (h (amax h k)) (h k)) k (amax h k))
cases e : Nat.blt (h (amax h k)) (h k) with
| true =>
have l := Found.Pnp90.blt_lt _ _ e
show h x <= h k
cases Nat.lt_or_ge x k with
| inl lx => exact Nat.le_trans (amax_ge h k x lx) (Nat.le_of_lt l)
| inr rx =>
have ex : x = k := Nat.le_antisymm (Nat.le_of_lt_succ hx) rx
rw [ex]; exact Nat.le_refl _
| false =>
show h x <= h (amax h k)
cases Nat.lt_or_ge x k with
| inl lx => exact amax_ge h k x lx
| inr rx =>
have ex : x = k := Nat.le_antisymm (Nat.le_of_lt_succ hx) rx
rw [ex]
cases Nat.lt_or_ge (h (amax h k)) (h k) with
| inl l => rw [Found.Pnp90.lt_blt _ _ l] at e; exact Bool.noConfusion e
| inr r => exact r
theorem sum_le (h : Nat -> Nat) (P : Nat -> Bool) (M : Nat) : forall k,
(forall x, x < k -> P x = false -> h x = 0) -> (forall x, x < k -> h x <= M) -> sumI h k <= M * cntI P k
| 0, _, _ => Nat.le_refl 0
| k + 1, hz, hM => by
have ih := sum_le h P M k (fun x hx => hz x (Nat.lt_succ_of_lt hx)) (fun x hx => hM x (Nat.lt_succ_of_lt hx))
show sumI h k + h k <= M * (cntI P k + bv (P k))
cases e : P k with
| false =>
rw [hz k (Nat.lt_succ_self k) e]
exact ih
| true => exact Nat.add_le_add ih (hM k (Nat.lt_succ_self k))
theorem and_false' (b : Bool) : (b && false) = false := by cases b <;> rfl
/-- The averaging step. -/
theorem avg (n : Nat) (rho : Nat -> Option Nat) (Ws : List Clause) (hT : 0 < lsum (covCnt n rho) Ws) :
Exists fun i => Exists fun j => i < n + 1 /\ j < n /\ remP rho i = true /\ freeH n rho j = true /\
lsum (covCnt n rho) Ws <= (lcnt (fun D => covB n D i j) Ws * cntI (freeH n rho) n) * cntI (remP rho) (n + 1) := by
let H : Nat -> Nat -> Nat := fun i j => lsum (fun D => bv (remP rho i && freeH n rho j && covB n D i j)) Ws
let F := cntI (freeH n rho) n
let R := cntI (remP rho) (n + 1)
let js : Nat -> Nat := fun i => amax (H i) n
let G : Nat -> Nat := fun i => H i (js i) * F
have eT : lsum (covCnt n rho) Ws = sumI (fun i => sumI (fun j => H i j) n) (n + 1) := by
show lsum (fun D => sumI (rowC n rho D) (n + 1)) Ws = _
rw [swap (fun D i => rowC n rho D i) (n + 1) Ws]
refine sumI_ext _ _ ?_ (n + 1)
intro i
show lsum (fun D => cntI (fun j => remP rho i && freeH n rho j && covB n D i j) n) Ws = _
rw [lsum_ext _ (fun D => sumI (fun j => bv (remP rho i && freeH n rho j && covB n D i j)) n)
(fun D => cntI_sumI _ n) Ws]
exact swap (fun D j => bv (remP rho i && freeH n rho j && covB n D i j)) n Ws
have Hz : forall i j, (remP rho i && freeH n rho j) = false -> H i j = 0 := by
intro i j e
refine lsum_zero _ ?_ Ws
intro D
show bv (remP rho i && freeH n rho j && covB n D i j) = 0
rw [e]; try rfl
have s1 : forall i, sumI (H i) n <= G i := by
intro i
refine sum_le (H i) (freeH n rho) (H i (js i)) n ?_ ?_
· intro j _ e
exact Hz i j (by rw [e]; exact and_false' _)
· intro j hj
exact amax_ge (H i) n j hj
have s2 : lsum (covCnt n rho) Ws <= sumI G (n + 1) := by
rw [eT]
exact sumI_le _ _ (n + 1) (fun i _ => s1 i)
let is := amax G (n + 1)
have s3 : sumI G (n + 1) <= G is * R := by
refine sum_le G (remP rho) (G is) (n + 1) ?_ ?_
· intro i _ e
show H i (js i) * F = 0
rw [Hz i (js i) (by rw [e]; try rfl)]
exact zero_mul' F
· intro i hi
exact amax_ge G (n + 1) i hi
have s4 := Nat.le_trans s2 s3
have isl : is < n + 1 := amax_succ_lt G n
cases n with
| zero =>
have f0 : G is = 0 := rfl
rw [f0, zero_mul'] at s4
exact absurd (Nat.lt_of_lt_of_le hT s4) (Nat.lt_irrefl 0)
| succ m =>
have jsl : js is < m + 1 := amax_succ_lt (H is) m
cases e : (remP rho is && freeH (m + 1) rho (js is)) with
| false =>
have g0 : G is = 0 := by
show H is (js is) * F = 0
rw [Hz is (js is) e]
exact zero_mul' F
rw [g0, zero_mul'] at s4
exact absurd (Nat.lt_of_lt_of_le hT s4) (Nat.lt_irrefl 0)
| true =>
refine Exists.intro is (Exists.intro (js is) (And.intro isl (And.intro jsl
(And.intro (Found.Pnp62.and_l e) (And.intro (Found.Pnp62.and_r e) ?_)))))
have eH : H is (js is) = lcnt (fun D => covB (m + 1) D is (js is)) Ws := by
refine lsum_ext _ _ ?_ Ws
intro D
show bv (remP rho is && freeH (m + 1) rho (js is) && covB (m + 1) D is (js is)) = bv (covB (m + 1) D is (js is))
rw [e]; try rfl
have s5 : lsum (covCnt (m + 1) rho) Ws <= (H is (js is) * F) * R := s4
rw [eH] at s5
exact s5
end Found.Pnp97
#print axioms Found.Pnp97.sumI_zero
#print axioms Found.Pnp97.sumI_add
#print axioms Found.Pnp97.sumI_ext
#print axioms Found.Pnp97.lsum_ext
#print axioms Found.Pnp97.lsum_zero
#print axioms Found.Pnp97.cntI_sumI
#print axioms Found.Pnp97.swap
#print axioms Found.Pnp97.zero_mul'
#print axioms Found.Pnp97.amax_le
#print axioms Found.Pnp97.amax_succ_lt
#print axioms Found.Pnp97.amax_ge
#print axioms Found.Pnp97.sum_le
#print axioms Found.Pnp97.and_false'
#print axioms Found.Pnp97.avg
lean_all/found/Pnp98.lean
/-
T330 piece 98. found/Pnp98 -- one round of the restriction game (proof complexity ladder,
step 1: general resolution; Beame--Pitassi).
For a list Ws of clauses and a threshold L, a clause is wide and alive under rho when it
can lose at least one pigeon and covers at least L free pairs; K rho counts such clauses of
Ws. If K rho >= 1 and L >= 1 there is a remaining pigeon i and a free hole j with
(K (ext rho i j) * F) * R + K rho * L <= (K rho * F) * R,
F the free holes and R the remaining pigeons of rho. Proved:
* mul_add', add_mul', mul_le_r: arithmetic by hand;
* lcnt_filt, lsum_filt_ge, lcnt_split, lcnt_le: list counts;
* wa_back: wide and alive under ext rho i j means wide and alive under rho and not
covering (i, j);
* step: one round.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp97
namespace Found.Pnp98
open Found.RootComp (Clause)
open Found.Pnp65 (cntI bv)
open Found.Pnp90 (isNone_eq)
open Found.Pnp93 (cntP add4)
open Found.Pnp94 (freeH remP Good)
open Found.Pnp95 (covB covCnt)
open Found.Pnp96 (ext cntP_back cntP_kill covCnt_back)
open Found.Pnp97 (lsum lcnt avg)
theorem mul_add' (a b : Nat) : forall c, a * (b + c) = a * b + a * c
| 0 => rfl
| c + 1 => by
show a * (b + c) + a = a * b + (a * c + a)
rw [mul_add' a b c, Nat.add_assoc]
theorem add_mul' (a b c : Nat) : (a + b) * c = a * c + b * c := by
rw [Nat.mul_comm, mul_add', Nat.mul_comm c a, Nat.mul_comm c b]
theorem mul_le_r {a b : Nat} (h : a <= b) : forall c, a * c <= b * c
| 0 => Nat.le_refl 0
| c + 1 => Nat.add_le_add (mul_le_r h c) h
theorem mul_pos' {a b : Nat} (ha : 1 <= a) (hb : 1 <= b) : 1 <= a * b := by
cases b with
| zero => exact absurd hb (Nat.not_succ_le_zero 0)
| succ b => exact Nat.le_trans ha (Nat.le_add_left a (a * b))
def consIf (b : Bool) (D : Clause) (L : List Clause) : List Clause :=
match b with
| true => D :: L
| false => L
def filt (p : Clause -> Bool) : List Clause -> List Clause
| [] => []
| D :: L => consIf (p D) D (filt p L)
theorem lcnt_filt (p q : Clause -> Bool) : forall L, lcnt q (filt p L) = lcnt (fun D => p D && q D) L
| [] => rfl
| D :: L => by
show lcnt q (consIf (p D) D (filt p L)) = bv (p D && q D) + lcnt (fun D => p D && q D) L
cases e : p D with
| true =>
show bv (q D) + lcnt q (filt p L) = bv (true && q D) + _
rw [lcnt_filt p q L]; try rfl
| false =>
show lcnt q (filt p L) = bv (false && q D) + _
rw [lcnt_filt p q L]
exact (Nat.zero_add _).symm
theorem lsum_filt_ge (p : Clause -> Bool) (h : Clause -> Nat) (M : Nat) (hp : forall D, p D = true -> M <= h D) :
forall L, M * lcnt p L <= lsum h (filt p L)
| [] => Nat.le_refl 0
| D :: L => by
have ih := lsum_filt_ge p h M hp L
show M * (bv (p D) + lcnt p L) <= lsum h (consIf (p D) D (filt p L))
rw [mul_add']
cases e : p D with
| true =>
show M * 1 + M * lcnt p L <= h D + lsum h (filt p L)
rw [Nat.mul_one]
exact Nat.add_le_add (hp D e) ih
| false =>
show M * 0 + M * lcnt p L <= lsum h (filt p L)
rw [Nat.mul_zero, Nat.zero_add]
exact ih
theorem lcnt_split (p q : Clause -> Bool) : forall L,
lcnt p L = lcnt (fun D => p D && q D) L + lcnt (fun D => p D && !(q D)) L
| [] => rfl
| D :: L => by
show bv (p D) + lcnt p L = (bv (p D && q D) + lcnt _ L) + (bv (p D && !(q D)) + lcnt _ L)
rw [lcnt_split p q L, add4]
cases p D <;> cases q D <;> rfl
theorem lcnt_le (p q : Clause -> Bool) (h : forall D, p D = true -> q D = true) : forall L, lcnt p L <= lcnt q L
| [] => Nat.le_refl 0
| D :: L => by
show bv (p D) + lcnt p L <= bv (q D) + lcnt q L
refine Nat.add_le_add ?_ (lcnt_le p q h L)
cases e : p D with
| false => exact Nat.zero_le _
| true => rw [h D e]; exact Nat.le_refl _
/-- Wide and alive. -/
def wa (n : Nat) (rho : Nat -> Option Nat) (L : Nat) (D : Clause) : Bool :=
Nat.ble 1 (cntP n rho D) && Nat.ble L (covCnt n rho D)
def K (n : Nat) (rho : Nat -> Option Nat) (L : Nat) (Ws : List Clause) : Nat := lcnt (wa n rho L) Ws
theorem wa_back (n : Nat) (rho : Nat -> Option Nat) (L : Nat) (i j : Nat) (hi : i < n + 1) (hr : rho i = none)
(hj : j < n) (D : Clause) (h : wa n (ext rho i j) L D = true) :
(wa n rho L D && !(covB n D i j)) = true := by
have a1 : 1 <= cntP n (ext rho i j) D := Nat.le_of_ble_eq_true (Found.Pnp62.and_l h)
have a2 : L <= covCnt n (ext rho i j) D := Nat.le_of_ble_eq_true (Found.Pnp62.and_r h)
have b1 : Nat.ble 1 (cntP n rho D) = true := Nat.ble_eq_true_of_le (Nat.le_trans a1 (cntP_back n rho i j hr D))
have b2 : Nat.ble L (covCnt n rho D) = true := Nat.ble_eq_true_of_le (Nat.le_trans a2 (covCnt_back n rho i j hi hr D))
have c : covB n D i j = false := by
cases e : covB n D i j with
| false => rfl
| true =>
rw [cntP_kill n rho i j hi hj D e] at a1
exact absurd a1 (Nat.not_succ_le_zero 0)
show (Nat.ble 1 (cntP n rho D) && Nat.ble L (covCnt n rho D) && !(covB n D i j)) = true
rw [b1, b2, c]; rfl
/-- One round of the restriction game. -/
theorem step (n : Nat) (rho : Nat -> Option Nat) (L : Nat) (Ws : List Clause) (hK : 1 <= K n rho L Ws) (hL : 1 <= L) :
Exists fun i => Exists fun j => i < n + 1 /\ j < n /\ rho i = none /\ freeH n rho j = true /\
(K n (ext rho i j) L Ws * cntI (freeH n rho) n) * cntI (remP rho) (n + 1) + K n rho L Ws * L <=
(K n rho L Ws * cntI (freeH n rho) n) * cntI (remP rho) (n + 1) := by
let Wl := filt (wa n rho L) Ws
have t1 : L * K n rho L Ws <= lsum (covCnt n rho) Wl :=
lsum_filt_ge (wa n rho L) (covCnt n rho) L (fun D h => Nat.le_of_ble_eq_true (Found.Pnp62.and_r h)) Ws
have t0 : 0 < lsum (covCnt n rho) Wl := Nat.lt_of_lt_of_le (mul_pos' hL hK) t1
cases avg n rho Wl t0 with
| intro i hi =>
cases hi with
| intro j hj =>
have hr : rho i = none := isNone_eq _ hj.2.2.1
refine Exists.intro i (Exists.intro j (And.intro hj.1 (And.intro hj.2.1 (And.intro hr (And.intro hj.2.2.2.1 ?_)))))
let F := cntI (freeH n rho) n
let R := cntI (remP rho) (n + 1)
let c := lcnt (fun D => covB n D i j) Wl
let K2 := lcnt (fun D => wa n rho L D && !(covB n D i j)) Ws
have ec : c = lcnt (fun D => wa n rho L D && covB n D i j) Ws := lcnt_filt _ _ Ws
have eK : K n rho L Ws = c + K2 := by
rw [ec]; exact lcnt_split (wa n rho L) (fun D => covB n D i j) Ws
have k' : K n (ext rho i j) L Ws <= K2 :=
lcnt_le _ _ (fun D h => wa_back n rho L i j hj.1 hr hj.2.1 D h) Ws
have tT : K n rho L Ws * L <= (c * F) * R :=
Nat.le_trans (Nat.le_of_eq (Nat.mul_comm _ _)) (Nat.le_trans t1 hj.2.2.2.2)
have s : (K n (ext rho i j) L Ws * F) * R + K n rho L Ws * L <= (K2 * F) * R + (c * F) * R :=
Nat.add_le_add (mul_le_r (mul_le_r k' F) R) tT
have e2 : (K n rho L Ws * F) * R = (K2 * F) * R + (c * F) * R := by
rw [eK, add_mul', add_mul', Nat.add_comm]
rw [e2]
exact s
end Found.Pnp98
#print axioms Found.Pnp98.mul_add'
#print axioms Found.Pnp98.add_mul'
#print axioms Found.Pnp98.mul_le_r
#print axioms Found.Pnp98.mul_pos'
#print axioms Found.Pnp98.lcnt_filt
#print axioms Found.Pnp98.lsum_filt_ge
#print axioms Found.Pnp98.lcnt_split
#print axioms Found.Pnp98.lcnt_le
#print axioms Found.Pnp98.wa_back
#print axioms Found.Pnp98.step
lean_all/found/Pnp99.lean
/-
T330 piece 99. found/Pnp99 -- r rounds of the restriction game (proof complexity ladder,
step 1: general resolution; Beame--Pitassi).
Let M = n * (n + 1) and M = N + L. If every good restriction with t remaining pigeons has
a wide alive clause in Ws (K >= 1), then for a good restriction with t + r remaining
pigeons (and one fewer free hole)
M ^ r <= K rho * N ^ r,
and for the empty restriction (n + 1 = t + r)
M ^ r <= (length of Ws) * N ^ r.
Proved:
* cntI_le_k, le_ex, add_cancel_r', mul_le_l', mul_assoc', pow_pos': arithmetic;
* K_mono: K does not grow under ext;
* round: one round in the form K' * M <= K * N;
* iter: r rounds;
* rho0_good, rem0, free0, lcnt_len, iter0: from the empty restriction.
Written with ASCII forms only. CIC dependence: none.
-/
import found.Pnp98
namespace Found.Pnp99
open Found.RootComp (Clause)
open Found.Pnp65 (cntI bv anyI)
open Found.Pnp87 (optEq)
open Found.Pnp90 (isNone)
open Found.Pnp94 (freeH remP Good rank_ex)
open Found.Pnp96 (ext good_ext rem_ext free_ext)
open Found.Pnp97 (lcnt)
open Found.Pnp98 (K wa wa_back step mul_add' mul_le_r mul_pos' lcnt_le)
theorem cntI_le_k (g : Nat -> Bool) : forall k, cntI g k <= k
| 0 => Nat.le_refl 0
| k + 1 => by
show cntI g k + bv (g k) <= k + 1
refine Nat.add_le_add (cntI_le_k g k) ?_
cases g k <;> first | exact Nat.zero_le 1 | exact Nat.le_refl 1
theorem le_ex : forall b a : Nat, a <= b -> Exists fun d => b = a + d
| 0, a, h => Exists.intro 0 (Found.Pnp66.le_zero_eq h).symm
| b + 1, a, h => by
cases Nat.lt_or_ge b a with
| inl l =>
have e : a = b + 1 := Nat.le_antisymm h l
exact Exists.intro 0 e.symm
| inr r =>
cases le_ex b a r with
| intro d hd => exact Exists.intro (d + 1) (by rw [hd]; rfl)
theorem add_cancel_r' {a b : Nat} : forall c, a + c <= b + c -> a <= b
| 0, h => h
| c + 1, h => add_cancel_r' c (Nat.le_of_succ_le_succ h)
theorem mul_le_l' {a b : Nat} (h : a <= b) (c : Nat) : c * a <= c * b := by
rw [Nat.mul_comm c a, Nat.mul_comm c b]
exact mul_le_r h c
theorem mul_assoc' (a b : Nat) : forall c, (a * b) * c = a * (b * c)
| 0 => rfl
| c + 1 => by
show (a * b) * c + a * b = a * (b * c + b)
rw [mul_assoc' a b c, mul_add']
theorem pow_pos' {M : Nat} (h : 1 <= M) : forall r, 1 <= M ^ r
| 0 => Nat.le_refl 1
| r + 1 => mul_pos' (pow_pos' h r) h
theorem K_mono (n : Nat) (rho : Nat -> Option Nat) (L : Nat) (Ws : List Clause) (i j : Nat) (hi : i < n + 1)
(hr : rho i = none) (hj : j < n) : K n (ext rho i j) L Ws <= K n rho L Ws :=
lcnt_le _ _ (fun D h => Found.Pnp62.and_l (wa_back n rho L i j hi hr hj D h)) Ws
/-- One round in multiplicative form. -/
theorem round (n N L K0 K1 F R : Nat) (hM : N + L = n * (n + 1)) (hF : F <= n) (hR : R <= n + 1)
(hK : K1 <= K0) (hs : (K1 * F) * R + K0 * L <= (K0 * F) * R) : K1 * (n * (n + 1)) <= K0 * N := by
have hQ : F * R <= n * (n + 1) := Nat.le_trans (mul_le_r hF R) (mul_le_l' hR n)
cases le_ex _ _ hQ with
| intro d hd =>
rw [mul_assoc', mul_assoc'] at hs
have a : K1 * (n * (n + 1)) + K0 * L <= K0 * (n * (n + 1)) := by
rw [hd, mul_add', mul_add', Nat.add_right_comm]
exact Nat.add_le_add hs (mul_le_r hK d)
have e : K0 * (n * (n + 1)) = K0 * N + K0 * L := by rw [<- hM, mul_add']
exact add_cancel_r' _ (Nat.le_trans a (Nat.le_of_eq e))
theorem rearr (a e b c d : Nat) (h : a * b <= c * d) : (a * e) * b <= c * (e * d) :=
calc (a * e) * b = a * (e * b) := mul_assoc' a e b
_ = a * (b * e) := by rw [Nat.mul_comm e b]
_ = (a * b) * e := (mul_assoc' a b e).symm
_ <= (c * d) * e := mul_le_r h e
_ = c * (d * e) := mul_assoc' c d e
_ = c * (e * d) := by rw [Nat.mul_comm d e]
theorem succ_inj' {a b : Nat} (h : a + 1 = b + 1) : a = b :=
Nat.le_antisymm (Nat.le_of_succ_le_succ (Nat.le_of_eq h)) (Nat.le_of_succ_le_succ (Nat.le_of_eq h.symm))
/-- r rounds. -/
theorem iter (n N L t : Nat) (Ws : List Clause) (hM : N + L = n * (n + 1)) (hL : 1 <= L) (ht : 1 <= t)
(hfin : forall rho, Good n rho -> cntI (freeH n rho) n + 1 = cntI (remP rho) (n + 1) ->
cntI (remP rho) (n + 1) = t -> 1 <= K n rho L Ws) :
forall r rho, Good n rho -> cntI (freeH n rho) n + 1 = cntI (remP rho) (n + 1) ->
cntI (remP rho) (n + 1) = t + r -> (n * (n + 1)) ^ r <= K n rho L Ws * N ^ r
| 0, rho, hg, hF, hR => by
show 1 <= K n rho L Ws * 1
rw [Nat.mul_one]
exact hfin rho hg hF hR
| r + 1, rho, hg, hF, hR => by
have M1 : 1 <= n * (n + 1) := by rw [hM.symm]; exact Nat.le_trans hL (Nat.le_add_left L N)
have next : forall i j, i < n + 1 -> j < n -> rho i = none -> freeH n rho j = true ->
Good n (ext rho i j) /\ cntI (freeH n (ext rho i j)) n + 1 = cntI (remP (ext rho i j)) (n + 1) /\
cntI (remP (ext rho i j)) (n + 1) = t + r := by
intro i j hi hj hr hf
have e1 := rem_ext n rho i j hi hr
have e2 := free_ext n rho i j hi hr hj hf
refine And.intro (good_ext n rho hg i j hi hr hj hf) (And.intro ?_ ?_)
· rw [e1, e2] at hF; exact succ_inj' hF
· rw [e1] at hR; exact succ_inj' hR
cases Nat.lt_or_ge 0 (K n rho L Ws) with
| inl kp =>
cases step n rho L Ws kp hL with
| intro i hi =>
cases hi with
| intro j hj =>
have nx := next i j hj.1 hj.2.1 hj.2.2.1 hj.2.2.2.1
have ih := iter n N L t Ws hM hL ht hfin r (ext rho i j) nx.1 nx.2.1 nx.2.2
have rd := round n N L (K n rho L Ws) (K n (ext rho i j) L Ws) (cntI (freeH n rho) n) (cntI (remP rho) (n + 1))
hM (cntI_le_k _ n) (cntI_le_k _ (n + 1)) (K_mono n rho L Ws i j hj.1 hj.2.2.1 hj.2.1) hj.2.2.2.2
show (n * (n + 1)) ^ r * (n * (n + 1)) <= K n rho L Ws * (N ^ r * N)
refine Nat.le_trans (mul_le_r ih _) ?_
exact rearr _ _ _ _ _ rd
| inr k0 =>
have z : K n rho L Ws = 0 := Found.Pnp66.le_zero_eq k0
have Rp : 0 < cntI (remP rho) (n + 1) := by rw [hR]; exact Nat.succ_pos _
have Fp : 0 < cntI (freeH n rho) n := by
have e : cntI (freeH n rho) n + 1 = t + r + 1 := hF.trans hR
have e' := succ_inj' e
rw [e']
exact Nat.lt_of_lt_of_le ht (Nat.le_add_right t r)
cases rank_ex _ _ 0 Rp with
| intro i hi =>
cases rank_ex _ _ 0 Fp with
| intro j hj =>
have hr : rho i = none := Found.Pnp90.isNone_eq _ hi.2.1
have nx := next i j hi.1 hj.1 hr hj.2.1
have ih := iter n N L t Ws hM hL ht hfin r (ext rho i j) nx.1 nx.2.1 nx.2.2
have km := K_mono n rho L Ws i j hi.1 hr hj.1
rw [z] at km
have z' : K n (ext rho i j) L Ws = 0 := Found.Pnp66.le_zero_eq km
rw [z', Found.Pnp97.zero_mul'] at ih
exact absurd (Nat.lt_of_lt_of_le (pow_pos' M1 r) ih) (Nat.lt_irrefl 0)
def rho0 : Nat -> Option Nat := fun _ => none
theorem cntI_all (g : Nat -> Bool) : forall k, (forall j, j < k -> g j = true) -> cntI g k = k
| 0, _ => rfl
| k + 1, h => by
show cntI g k + bv (g k) = k + 1
rw [cntI_all g k (fun j hj => h j (Nat.lt_succ_of_lt hj)), h k (Nat.lt_succ_self k)]
rfl
theorem rem0 (n : Nat) : cntI (remP rho0) (n + 1) = n + 1 := cntI_all _ (n + 1) (fun _ _ => rfl)
theorem free0 (n : Nat) : cntI (freeH n rho0) n = n := by
refine cntI_all _ n ?_
intro j _
show (!(anyI (fun a => optEq (rho0 a) j) (n + 1))) = true
have z : anyI (fun a => optEq (rho0 a) j) (n + 1) = false := Found.Pnp66.anyI_none _ (n + 1) (fun _ _ => rfl)
rw [z]
rfl
theorem rho0_good (n : Nat) : Good n rho0 := by
refine Good.mk (fun _ _ _ h => by cases h) (fun _ _ _ _ _ h => by cases h) ?_
rw [rem0, free0]
exact Nat.le_refl _
theorem lcnt_len (p : Clause -> Bool) : forall L : List Clause, lcnt p L <= L.length
| [] => Nat.le_refl 0
| D :: L => by
show bv (p D) + lcnt p L <= L.length + 1
rw [Nat.add_comm]
refine Nat.add_le_add (lcnt_len p L) ?_
cases p D <;> first | exact Nat.zero_le 1 | exact Nat.le_refl 1
/-- From the empty restriction. -/
theorem iter0 (n N L t r : Nat) (Ws : List Clause) (hM : N + L = n * (n + 1)) (hL : 1 <= L) (ht : 1 <= t)
(hn : n + 1 = t + r)
(hfin : forall rho, Good n rho -> cntI (freeH n rho) n + 1 = cntI (remP rho) (n + 1) ->
cntI (remP rho) (n + 1) = t -> 1 <= K n rho L Ws) :
(n * (n + 1)) ^ r <= Ws.length * N ^ r := by
have h := iter n N L t Ws hM hL ht hfin r rho0 (rho0_good n) (by rw [rem0, free0]) (by rw [rem0]; exact hn)
exact Nat.le_trans h (mul_le_r (lcnt_len _ Ws) _)
end Found.Pnp99
#print axioms Found.Pnp99.cntI_le_k
#print axioms Found.Pnp99.le_ex
#print axioms Found.Pnp99.add_cancel_r'
#print axioms Found.Pnp99.mul_le_l'
#print axioms Found.Pnp99.mul_assoc'
#print axioms Found.Pnp99.pow_pos'
#print axioms Found.Pnp99.K_mono
#print axioms Found.Pnp99.round
#print axioms Found.Pnp99.rearr
#print axioms Found.Pnp99.succ_inj'
#print axioms Found.Pnp99.iter
#print axioms Found.Pnp99.cntI_all
#print axioms Found.Pnp99.rem0
#print axioms Found.Pnp99.free0
#print axioms Found.Pnp99.rho0_good
#print axioms Found.Pnp99.lcnt_len
#print axioms Found.Pnp99.iter0
lean_all/found/Predicative.lean
/-
T199. found/Predicative — predicativism (Weyl, Feferman) as a point: the
comprehension coordinate restricted to formulas quantifying only over
numbers (arithmetical, ACA₀-style), with impredicative definitions
replaced by inductive generation.
* Arithmetical formulas over decidable atoms; their extensions are closed
under ∧, ∨, ¬ and number quantifiers (structural).
* Weyl's example: the impredicative definition of ℕ ("in every set
containing 0 and closed under successor", quantifying over all sets) is
equivalent to the predicative one ("reached by finitely many
successors"): the impredicative ∀X can be eliminated here.
Feferman's predicative ordinal Γ₀ is the ordinal-analysis line (T124, cited).
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: imp_nat is stated with impredicative Prop (used only by one instantiation).
-/
namespace Found
namespace Pred
inductive AF where
| atom : (Nat → Nat → Bool) → AF -- decidable relation of (bound var, parameter)
| neg : AF → AF
| and : AF → AF → AF
| or : AF → AF → AF
| ex : AF → AF -- ∃k, with k becoming the new parameter
| all : AF → AF
def sat : AF → Nat → Nat → Prop
| .atom r, x, p => r x p = true
| .neg a, x, p => ¬ sat a x p
| .and a b, x, p => sat a x p ∧ sat b x p
| .or a b, x, p => sat a x p ∨ sat b x p
| .ex a, x, _ => ∃ k, sat a x k
| .all a, x, _ => ∀ k, sat a x k
/-- the extension of a predicative formula: a set of numbers -/
def ext (a : AF) (p : Nat) : Nat → Prop := fun x => sat a x p
theorem ext_and (a b : AF) (p x : Nat) : ext (.and a b) p x ↔ ext a p x ∧ ext b p x := Iff.rfl
theorem ext_neg (a : AF) (p x : Nat) : ext (.neg a) p x ↔ ¬ ext a p x := Iff.rfl
theorem ext_ex (a : AF) (p x : Nat) : ext (.ex a) p x ↔ ∃ k, ext a k x := Iff.rfl
/-! Weyl: impredicative ℕ vs predicative ℕ -/
def imp_nat (n : Nat) : Prop := ∀ X : Nat → Prop, X 0 → (∀ k, X k → X (k + 1)) → X n
def iter : Nat → Nat
| 0 => 0
| k + 1 => iter k + 1
def pred_nat (n : Nat) : Prop := ∃ k, iter k = n
theorem iter_id : (k : Nat) → iter k = k
| 0 => rfl
| k + 1 => congrArg (· + 1) (iter_id k)
theorem imp_to_pred (n : Nat) (h : imp_nat n) : pred_nat n :=
h pred_nat ⟨0, rfl⟩ (fun _ ⟨j, e⟩ => ⟨j + 1, congrArg (· + 1) e⟩)
theorem pred_to_imp (n : Nat) (h : pred_nat n) : imp_nat n :=
match h with
| ⟨k, e⟩ => fun X h0 hs => e ▸ go X h0 hs k
where
go (X : Nat → Prop) (h0 : X 0) (hs : ∀ k, X k → X (k + 1)) : (k : Nat) → X (iter k)
| 0 => h0
| k + 1 => hs _ (go X h0 hs k)
theorem weyl (n : Nat) : imp_nat n ↔ pred_nat n := ⟨imp_to_pred n, pred_to_imp n⟩
theorem all_pred (n : Nat) : pred_nat n := ⟨n, iter_id n⟩
end Pred
end Found
#print axioms Found.Pred.ext_and
#print axioms Found.Pred.ext_neg
#print axioms Found.Pred.ext_ex
#print axioms Found.Pred.weyl
#print axioms Found.Pred.all_pred
lean_all/found/Presburger.lean
/-
T186. found/Presburger — weak arithmetics as points: the arithmetic
language (T85a) restricted to + only (Presburger), · only (Skolem), or to
bounded quantifiers (Δ₀, the base of IΔ₀ and Buss's S¹₂).
* Fragments: predicates on terms (mul-free / add-free), closed under the
arithmetic language's evaluation (reused).
* Δ₀ truth in ℕ is decidable, constructively, by bounded search
(structural recursion) — the reason bounded arithmetic is "feasible".
Decidability of Presburger (quantifier elimination) is cited.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.ArithBridge
namespace Found
namespace Weak
open Arith
def mulFree : Tm → Prop
| .var _ => True
| .zero => True
| .succ t => mulFree t
| .add a b => mulFree a ∧ mulFree b
| .mul _ _ => False
def addFree : Tm → Prop
| .var _ => True
| .zero => True
| .succ t => addFree t
| .add _ _ => False
| .mul a b => addFree a ∧ addFree b
inductive D0 where
| eq : Tm → Tm → D0
| neg : D0 → D0
| and : D0 → D0 → D0
| or : D0 → D0 → D0
| ball : Tm → D0 → D0 -- ∀x < t (x = variable 0 inside)
| bex : Tm → D0 → D0 -- ∃x < t
def sat : (Nat → Nat) → D0 → Prop
| ρ, .eq a b => eval ρ a = eval ρ b
| ρ, .neg φ => ¬ sat ρ φ
| ρ, .and φ ψ => sat ρ φ ∧ sat ρ ψ
| ρ, .or φ ψ => sat ρ φ ∨ sat ρ ψ
| ρ, .ball t φ => ∀ x, x < eval ρ t → sat (cons x ρ) φ
| ρ, .bex t φ => ∃ x, x < eval ρ t ∧ sat (cons x ρ) φ
def Dec (p : Prop) : Prop := p ∨ ¬ p
theorem nat_dec_eq : (a b : Nat) → Dec (a = b)
| 0, 0 => Or.inl rfl
| 0, _ + 1 => Or.inr (fun e => Nat.noConfusion e)
| _ + 1, 0 => Or.inr (fun e => Nat.noConfusion e)
| a + 1, b + 1 => (nat_dec_eq a b).elim (fun e => Or.inl (congrArg Nat.succ e))
(fun n => Or.inr (fun e => n (Nat.succ.inj e)))
theorem lt_succ_cases {x n : Nat} (h : x < n + 1) : x < n ∨ x = n :=
match Nat.lt_or_ge x n with
| Or.inl l => Or.inl l
| Or.inr g => Or.inr (Nat.le_antisymm (Nat.le_of_lt_succ h) g)
theorem bounded_all (P : Nat → Prop) (hP : ∀ x, Dec (P x)) : ∀ n, Dec (∀ x, x < n → P x)
| 0 => Or.inl (fun _ h => (Nat.not_lt_zero _ h).elim)
| n + 1 => (bounded_all P hP n).elim
(fun h => (hP n).elim
(fun pn => Or.inl (fun x hx => (lt_succ_cases hx).elim (h x) (fun e => e ▸ pn)))
(fun npn => Or.inr (fun k => npn (k n (Nat.lt_succ_self n)))))
(fun nh => Or.inr (fun k => nh (fun x hx => k x (Nat.lt_succ_of_lt hx))))
theorem bounded_ex (P : Nat → Prop) (hP : ∀ x, Dec (P x)) : ∀ n, Dec (∃ x, x < n ∧ P x)
| 0 => Or.inr (fun ⟨_, h, _⟩ => Nat.not_lt_zero _ h)
| n + 1 => (bounded_ex P hP n).elim
(fun ⟨x, hx, px⟩ => Or.inl ⟨x, Nat.lt_succ_of_lt hx, px⟩)
(fun nh => (hP n).elim (fun pn => Or.inl ⟨n, Nat.lt_succ_self n, pn⟩)
(fun npn => Or.inr (fun ⟨x, hx, px⟩ => (lt_succ_cases hx).elim
(fun l => nh ⟨x, l, px⟩) (fun e => npn (e ▸ px)))))
/-- Δ₀ truth in ℕ is decidable -/
theorem d0_decidable : (φ : D0) → ∀ ρ, Dec (sat ρ φ)
| .eq _ _, _ => nat_dec_eq _ _
| .neg φ, ρ => (d0_decidable φ ρ).elim (fun h => Or.inr (fun n => n h)) (fun n => Or.inl n)
| .and φ ψ, ρ => (d0_decidable φ ρ).elim
(fun h => (d0_decidable ψ ρ).elim (fun k => Or.inl ⟨h, k⟩) (fun nk => Or.inr (fun p => nk p.2)))
(fun nh => Or.inr (fun p => nh p.1))
| .or φ ψ, ρ => (d0_decidable φ ρ).elim (fun h => Or.inl (Or.inl h))
(fun nh => (d0_decidable ψ ρ).elim (fun k => Or.inl (Or.inr k))
(fun nk => Or.inr (fun p => p.elim nh nk)))
| .ball _ φ, ρ => bounded_all _ (fun x => d0_decidable φ (cons x ρ)) _
| .bex _ φ, ρ => bounded_ex _ (fun x => d0_decidable φ (cons x ρ)) _
end Weak
end Found
#print axioms Found.Weak.nat_dec_eq
#print axioms Found.Weak.lt_succ_cases
#print axioms Found.Weak.bounded_all
#print axioms Found.Weak.bounded_ex
#print axioms Found.Weak.d0_decidable
lean_all/found/Presentable.lean
/-
T154. found/Presentable — locally presentable categories and Bousfield
localization as a point, in the order-enriched case of the category
parameter:
* Presentability: in the power set of a type, every subset is the
(directed) union of its finite subsets (lists) — the compact objects
generate under filtered colimits (ℵ₀-presentable / algebraic lattice).
* Bousfield (reflective) localization: a closure operator L
(monotone, inflationary, idempotent); local objects are the fixed
points, and L x is the reflection: L x ≤ y ⟺ x ≤ y for local y.
Left exactness corresponds to L preserving meets (nuclei, T110).
Combinatorial model categories and Dugger/Smith presentation theorems
are cited.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Pres
universe u
/-! ## presentability: unions of finite subsets -/
def finSub {X : Type u} (A : X → Prop) (l : List X) : Prop := ∀ x, x ∈ l → A x
theorem union_of_finite {X : Type u} (A : X → Prop) (x : X) :
A x ↔ ∃ l : List X, finSub A l ∧ x ∈ l :=
⟨fun h => ⟨[x], ⟨(fun y (m : y ∈ [x]) => by
cases m with
| head => exact h
| tail _ m' => exact nomatch m'), List.Mem.head _⟩⟩,
fun ⟨_, hl, m⟩ => hl x m⟩
theorem mem_app_inv {X : Type u} {x : X} : (l k : List X) → x ∈ l ++ k → x ∈ l ∨ x ∈ k
| [], _, m => Or.inr m
| _ :: l, k, m => by
cases m with
| head => exact Or.inl (.head _)
| tail _ m' => exact (mem_app_inv l k m').elim (fun h => Or.inl (.tail _ h)) Or.inr
theorem mem_app_l {X : Type u} {x : X} : (l k : List X) → x ∈ l → x ∈ l ++ k
| _ :: _, _, .head _ => .head _
| _ :: l, k, .tail _ m => .tail _ (mem_app_l l k m)
theorem mem_app_r {X : Type u} {x : X} : (l k : List X) → x ∈ k → x ∈ l ++ k
| [], _, m => m
| _ :: l, k, m => .tail _ (mem_app_r l k m)
/-- the system of finite subsets is directed -/
theorem directed {X : Type u} (A : X → Prop) (l k : List X) (hl : finSub A l) (hk : finSub A k) :
finSub A (l ++ k) ∧ (∀ x, x ∈ l → x ∈ l ++ k) ∧ (∀ x, x ∈ k → x ∈ l ++ k) :=
⟨fun x m => (mem_app_inv l k m).elim (hl x) (hk x),
fun _ m => mem_app_l l k m, fun _ m => mem_app_r l k m⟩
/-! ## Bousfield localization as a reflection -/
structure Closure (P : Type u) (le : P → P → Prop) where
L : P → P
mono : ∀ {a b}, le a b → le (L a) (L b)
infl : ∀ a, le a (L a)
idem : ∀ a, le (L (L a)) (L a)
variable {P : Type u} {le : P → P → Prop} (trans : ∀ {a b c}, le a b → le b c → le a c)
def Local (C : Closure P le) (y : P) : Prop := le (C.L y) y
include trans in
theorem reflection (C : Closure P le) (x y : P) (hy : Local C y) : le (C.L x) y ↔ le x y :=
⟨fun h => trans (C.infl x) h, fun h => trans (C.mono h) hy⟩
theorem L_local (C : Closure P le) (x : P) : Local C (C.L x) := C.idem x
end Pres
end Found
#print axioms Found.Pres.union_of_finite
#print axioms Found.Pres.mem_app_inv
#print axioms Found.Pres.directed
#print axioms Found.Pres.reflection
#print axioms Found.Pres.L_local
lean_all/found/PrimeFilter.lean
/-
T93 line, part 1. found/PrimeFilter — the prime filter theorem for
Heyting algebras, in the classical point: if the filter generated by B
does not contain b, some prime filter contains B and not b. Built by
transfinite recursion along the Zermelo well-order (found/Cardinal):
an element is chosen when adding it to the earlier choices still avoids b.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Cardinal
import found.Topos
import found.FOCompleteness
namespace Found
namespace PF
open CP WO Card
variable (K : Classical') (H : HA.{0})
def mL : List H.car → H.car
| [] => H.top
| x :: l => H.meet x (mL l)
/-- c lies in the filter generated by S -/
def Gen (S : H.car → Prop) (c : H.car) : Prop := ∃ l : List H.car, (∀ x, x ∈ l → S x) ∧ H.le (mL H l) c
theorem gen_of {S : H.car → Prop} {x : H.car} (h : S x) : Gen H S x :=
⟨[x], ⟨(fun y (m : y ∈ [x]) => by
cases m with
| head => exact h
| tail _ m' => exact nomatch m'), H.meet_l _ _⟩⟩
theorem gen_up {S : H.car → Prop} {c d : H.car} (h : Gen H S c) (hcd : H.le c d) : Gen H S d :=
match h with | ⟨l, hl, hc⟩ => ⟨l, hl, H.le_trans hc hcd⟩
theorem gen_mono {S S' : H.car → Prop} (hs : ∀ x, S x → S' x) {c : H.car} (h : Gen H S c) : Gen H S' c :=
match h with | ⟨l, hl, hc⟩ => ⟨l, fun x m => hs x (hl x m), hc⟩
theorem mL_app : (l k : List H.car) → H.le (mL H (l ++ k)) (H.meet (mL H l) (mL H k))
| [], _ => H.meet_univ (H.le_top _) (H.le_refl _)
| _ :: l, k => H.meet_univ (H.meet_univ (H.meet_l _ _) (H.le_trans (H.meet_r _ _) (H.meet_l _ _ |> fun h => H.le_trans (mL_app l k) h)))
(H.le_trans (H.meet_r _ _) (H.le_trans (mL_app l k) (H.meet_r _ _)))
theorem mem_app_inv {a : H.car} : (l k : List H.car) → a ∈ l ++ k → a ∈ l ∨ a ∈ k
| [], _, m => Or.inr m
| _ :: l, k, m => by
cases m with
| head => exact Or.inl (.head _)
| tail _ m' => exact (mem_app_inv l k m').elim (fun h => Or.inl (.tail _ h)) Or.inr
theorem gen_meet {S : H.car → Prop} {c d : H.car} (h1 : Gen H S c) (h2 : Gen H S d) : Gen H S (H.meet c d) :=
match h1, h2 with
| ⟨l, hl, hc⟩, ⟨k, hk, hd⟩ => ⟨l ++ k, fun x m => (mem_app_inv H l k m).elim (hl x) (hk x),
H.le_trans (mL_app H l k) (H.meet_univ (H.le_trans (H.meet_l _ _) hc) (H.le_trans (H.meet_r _ _) hd))⟩
theorem nil_sub (S : H.car → Prop) : ∀ x, x ∈ ([] : List H.car) → S x := fun _ m => nomatch m
theorem gen_top (S : H.car → Prop) : Gen H S H.top := ⟨[], ⟨nil_sub H S, H.le_refl _⟩⟩
/-- deduction: generating with one extra element x reaches c iff the rest reaches x → c -/
theorem ded {S : H.car → Prop} {x : H.car} : (l : List H.car) → (∀ z, z ∈ l → S z ∨ z = x) →
∃ l', (∀ z, z ∈ l' → S z) ∧ H.le (H.meet (mL H l') x) (mL H l)
| [], _ => ⟨[], ⟨nil_sub H S, H.le_top _⟩⟩
| z :: l, h => match ded l (fun w m => h w (.tail _ m)) with
| ⟨l', hl', hle⟩ => (h z (.head _)).elim
(fun hz => ⟨z :: l', fun w m => by
cases m with
| head => exact hz
| tail _ m' => exact hl' w m',
H.meet_univ (H.le_trans (H.meet_l _ _) (H.meet_l _ _))
(H.le_trans (H.meet_univ (H.le_trans (H.meet_l _ _) (H.meet_r _ _)) (H.meet_r _ _)) hle)⟩)
(fun e => ⟨l', hl', H.meet_univ (by rw [e]; exact H.meet_r _ _) hle⟩)
theorem gen_ded {S : H.car → Prop} {x c : H.car} (h : Gen H (fun y => S y ∨ y = x) c) : Gen H S (H.imp x c) :=
match h with
| ⟨l, hl, hc⟩ => match ded H l hl with
| ⟨l', hl', hle⟩ => ⟨l', hl', H.imp_adj.mp (H.le_trans hle hc)⟩
variable (B : H.car → Prop) (b : H.car)
/-- the choices: x is chosen when adding it to B and the earlier choices still avoids b -/
def Cs : H.car → Prop :=
(wf K H.car).fix (fun x rec => ¬ Gen H (fun y => B y ∨ (∃ h : Lt' K y x, rec y h) ∨ y = x) b)
theorem Cs_eq (x : H.car) : Cs K H B b x ↔ ¬ Gen H (fun y => B y ∨ (Lt' K y x ∧ Cs K H B b y) ∨ y = x) b := by
have e : Cs K H B b x = ¬ Gen H (fun y => B y ∨ (∃ h : Lt' K y x, Cs K H B b y) ∨ y = x) b :=
(wf K H.car).fix_eq _ x
rw [e]
exact ⟨fun n g => n (gen_mono H (fun y hy => hy.elim Or.inl (fun h => Or.inr (h.elim
(fun ⟨a, c⟩ => Or.inl ⟨a, c⟩) Or.inr))) g),
fun n g => n (gen_mono H (fun y hy => hy.elim Or.inl (fun h => Or.inr (h.elim
(fun ⟨a, c⟩ => Or.inl ⟨a, c⟩) Or.inr))) g)⟩
theorem le_refl' (x : H.car) : Le K x x := fun _ h => h
/-- the largest chosen element of a finite list -/
theorem split (R : H.car → Prop) : (l : List H.car) → (∀ y, y ∈ l → B y ∨ (R y ∧ Cs K H B b y)) →
(∀ y, y ∈ l → B y) ∨ ∃ m, R m ∧ Cs K H B b m ∧ ∀ y, y ∈ l → B y ∨ (Le K y m ∧ Cs K H B b y)
| [], _ => Or.inl (fun _ m => nomatch m)
| z :: l, h => by
have ih := split R l (fun y m => h y (.tail _ m))
rcases h z (.head _) with hz | ⟨hR, hC⟩
· rcases ih with hall | ⟨m, hRm, hCm, hm⟩
· exact Or.inl (fun y my => by cases my with | head => exact hz | tail _ m' => exact hall y m')
· exact Or.inr ⟨m, hRm, hCm, fun y my => by cases my with | head => exact Or.inl hz | tail _ m' => exact hm y m'⟩
· rcases ih with hall | ⟨m, hRm, hCm, hm⟩
· exact Or.inr ⟨z, hR, hC, fun y my => by
cases my with
| head => exact Or.inr ⟨le_refl' K H z, hC⟩
| tail _ m' => exact Or.inl (hall y m')⟩
· cases le_total K z m with
| inl hzm => exact Or.inr ⟨m, hRm, hCm, fun y my => by
cases my with
| head => exact Or.inr ⟨hzm, hC⟩
| tail _ m' => exact hm y m'⟩
| inr hmz => exact Or.inr ⟨z, hR, hC, fun y my => by
cases my with
| head => exact Or.inr ⟨le_refl' K H z, hC⟩
| tail _ m' => exact (hm y m').elim Or.inl (fun ⟨hy, hc⟩ => Or.inr ⟨WO.le_trans K hy hmz, hc⟩)⟩
variable (hB : ¬ Gen H B b)
include hB in
theorem P_all : ∀ x, ¬ Gen H (fun y => B y ∨ (Le K y x ∧ Cs K H B b y)) b := by
intro x
induction x using (wf K H.car).induction with
| _ x ih =>
intro ⟨l, hl, hle⟩
rcases split K H B b (fun y => Le K y x) l hl with hall | ⟨m, hmx, hCm, hm⟩
· exact hB ⟨l, hall, hle⟩
· rcases K.lem (Le K x m) with hxm | hnxm
· have e : m = x := le_antisymm K m x hmx hxm
subst e
refine (Cs_eq K H B b m).mp hCm ⟨l, fun y my => ?_, hle⟩
rcases hm y my with hy | ⟨hym, hCy⟩
· exact Or.inl hy
· rcases K.lem (y = m) with e | ne
· exact Or.inr (Or.inr e)
· exact Or.inr (Or.inl ⟨⟨hym, fun hmy => ne (le_antisymm K y m hym hmy)⟩, hCy⟩)
· exact ih m ⟨hmx, hnxm⟩ ⟨l, hm, hle⟩
/-- the prime filter -/
def F (c : H.car) : Prop := Gen H (fun y => B y ∨ Cs K H B b y) c
include hB in
theorem F_avoids : ¬ F K H B b b := fun ⟨l, hl, hle⟩ => by
rcases split K H B b (fun _ => True) l (fun y my => (hl y my).elim Or.inl (fun h => Or.inr ⟨trivial, h⟩)) with
hall | ⟨m, _, _, hm⟩
· exact hB ⟨l, hall, hle⟩
· exact P_all K H B b hB m ⟨l, hm, hle⟩
include hB in
theorem F_prime (x y : H.car) (h : F K H B b (H.join x y)) : F K H B b x ∨ F K H B b y := by
rcases K.lem (F K H B b x) with hx | hx
· exact Or.inl hx
· rcases K.lem (F K H B b y) with hy | hy
· exact Or.inr hy
· exfalso
have nCx : ¬ Cs K H B b x := fun c => hx (gen_of H (Or.inr c))
have nCy : ¬ Cs K H B b y := fun c => hy (gen_of H (Or.inr c))
have hx0 : Gen H (fun z => B z ∨ (Lt' K z x ∧ Cs K H B b z) ∨ z = x) b :=
dne K _ (fun n => nCx ((Cs_eq K H B b x).mpr n))
have hy0 : Gen H (fun z => B z ∨ (Lt' K z y ∧ Cs K H B b z) ∨ z = y) b :=
dne K _ (fun n => nCy ((Cs_eq K H B b y).mpr n))
have gx := gen_ded H (S := fun z => B z ∨ (Lt' K z x ∧ Cs K H B b z)) (gen_mono H (fun z hz => hz.elim
(fun h => Or.inl (Or.inl h)) (fun h => h.elim (fun h => Or.inl (Or.inr h)) Or.inr)) hx0)
have gy := gen_ded H (S := fun z => B z ∨ (Lt' K z y ∧ Cs K H B b z)) (gen_mono H (fun z hz => hz.elim
(fun h => Or.inl (Or.inl h)) (fun h => h.elim (fun h => Or.inl (Or.inr h)) Or.inr)) hy0)
have gx' : F K H B b (H.imp x b) := gen_mono H (fun z hz => hz.elim Or.inl (fun ⟨_, c⟩ => Or.inr c)) gx
have gy' : F K H B b (H.imp y b) := gen_mono H (fun z hz => hz.elim Or.inl (fun ⟨_, c⟩ => Or.inr c)) gy
have g := gen_meet H h (gen_meet H gx' gy')
refine F_avoids K H B b hB (gen_up H g ?_)
refine H.le_trans (H.meet_univ (H.meet_r _ _) (H.meet_l _ _)) (H.le_trans (FO.distrib H _ x y) ?_)
have e1 : H.le (H.meet (H.meet (H.imp x b) (H.imp y b)) x) b :=
H.le_trans (H.meet_univ (H.le_trans (H.meet_l _ _) (H.meet_l _ _)) (H.meet_r _ _)) (HA.mp H x b)
have e2 : H.le (H.meet (H.meet (H.imp x b) (H.imp y b)) y) b :=
H.le_trans (H.meet_univ (H.le_trans (H.meet_l _ _) (H.meet_r _ _)) (H.meet_r _ _)) (HA.mp H y b)
exact H.join_univ e1 e2
end PF
end Found
#print axioms Found.PF.gen_meet
#print axioms Found.PF.F_avoids
#print axioms Found.PF.F_prime
lean_all/found/ProbLogic.lean
/-
T174. found/ProbLogic — probability logic as a point: a finite outcome
space (a list, a parameter), events = Boolean predicates (the classical
truth values on decidable events), the counting measure (numerator over
the length of the list).
* Inclusion–exclusion: μ(A ∨ B) + μ(A ∧ B) = μ(A) + μ(B).
* Complement: μ(A) + μ(¬A) = |Ω|. Monotonicity: A ⊆ B ⇒ μ(A) ≤ μ(B).
Real-valued and σ-additive probability (Kolmogorov) and probabilistic
logics with ℝ are lines to Bishop's analysis (T118, cited).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Prob
universe u
variable {Ω : Type u}
def ind (b : Bool) : Nat := match b with | true => 1 | false => 0
def mu (A : Ω → Bool) : List Ω → Nat
| [] => 0
| w :: l => ind (A w) + mu A l
theorem rearr (c x d y : Nat) : (c + x) + (d + y) = (c + d) + (x + y) := by
rw [Nat.add_assoc, Nat.add_left_comm x d y, ← Nat.add_assoc]
theorem incl_excl (A B : Ω → Bool) : (l : List Ω) →
mu (fun w => A w || B w) l + mu (fun w => A w && B w) l = mu A l + mu B l
| [] => rfl
| w :: l => by
have ih := incl_excl A B l
show (ind (A w || B w) + mu (fun w => A w || B w) l) + (ind (A w && B w) + mu (fun w => A w && B w) l) =
(ind (A w) + mu A l) + (ind (B w) + mu B l)
rw [rearr (ind (A w || B w)) _ (ind (A w && B w)) _, rearr (ind (A w)) _ (ind (B w)) _, ih]
cases A w <;> cases B w <;> rfl
theorem complement (A : Ω → Bool) : (l : List Ω) → mu A l + mu (fun w => !A w) l = l.length
| [] => rfl
| w :: l => by
have ih := complement A l
show (ind (A w) + mu A l) + (ind (!A w) + mu (fun w => !A w) l) = l.length + 1
rw [rearr (ind (A w)) _ (ind (!A w)) _, ih]
cases A w
· show 0 + 1 + l.length = l.length + 1
rw [Nat.add_comm]
· show 1 + 0 + l.length = l.length + 1
rw [Nat.add_comm]
theorem monotone (A B : Ω → Bool) (h : ∀ w, A w = true → B w = true) : (l : List Ω) → mu A l ≤ mu B l
| [] => Nat.le_refl 0
| w :: l => by
have ih := monotone A B h l
show ind (A w) + mu A l ≤ ind (B w) + mu B l
cases ha : A w with
| true => rw [h w ha]; exact Nat.add_le_add (Nat.le_refl 1) ih
| false => exact Nat.add_le_add (Nat.zero_le _) ih
end Prob
end Found
#print axioms Found.Prob.rearr
#print axioms Found.Prob.incl_excl
#print axioms Found.Prob.complement
#print axioms Found.Prob.monotone
lean_all/found/Process.lean
/-
T183. found/Process — process calculi (CCS, CSP, π) as a point: labelled
transition systems on the relation coordinate; processes are states up
to strong bisimilarity (the same coinductive quotient as T105, labelled).
* Bisimilarity is an equivalence.
* Hennessy–Milner (invariance): bisimilar states satisfy the same
Hennessy–Milner formulas — the line processes ↔ multimodal K.
The concrete calculi are syntaxes whose operational semantics is an LTS
(recorded as lines; not re-proved).
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: bisimilarity ∃ S (impredicative Prop).
-/
namespace Found
namespace Proc
universe u v
variable {L : Type u} {S : Type v} (T : S → L → S → Prop)
def Bisim (B : S → S → Prop) : Prop :=
∀ p q, B p q → (∀ a p', T p a p' → ∃ q', T q a q' ∧ B p' q') ∧ (∀ a q', T q a q' → ∃ p', T p a p' ∧ B p' q')
def Bisimilar (p q : S) : Prop := ∃ B, Bisim T B ∧ B p q
theorem bis_refl (p : S) : Bisimilar T p p :=
⟨fun a b => a = b, fun a b e => by
cases e
exact ⟨fun c a' h => ⟨a', h, rfl⟩, fun c a' h => ⟨a', h, rfl⟩⟩, rfl⟩
theorem bis_symm {p q : S} (h : Bisimilar T p q) : Bisimilar T q p :=
match h with
| ⟨B, hB, b⟩ => ⟨fun x y => B y x, fun x y bxy =>
⟨fun a x' t => match (hB y x bxy).2 a x' t with | ⟨y', t', b'⟩ => ⟨y', t', b'⟩,
fun a y' t => match (hB y x bxy).1 a y' t with | ⟨x', t', b'⟩ => ⟨x', t', b'⟩⟩, b⟩
theorem bis_trans {p q r : S} (h : Bisimilar T p q) (k : Bisimilar T q r) : Bisimilar T p r :=
match h, k with
| ⟨B, hB, b⟩, ⟨C, hC, c⟩ =>
⟨fun x z => ∃ y, B x y ∧ C y z, fun x z ⟨y, bxy, cyz⟩ =>
⟨fun a x' t => match (hB x y bxy).1 a x' t with
| ⟨y', t', b'⟩ => match (hC y z cyz).1 a y' t' with
| ⟨z', t'', c'⟩ => ⟨z', t'', y', b', c'⟩,
fun a z' t => match (hC y z cyz).2 a z' t with
| ⟨y', t', c'⟩ => match (hB x y bxy).2 a y' t' with
| ⟨x', t'', b'⟩ => ⟨x', t'', y', b', c'⟩⟩, ⟨q, b, c⟩⟩
/-- Hennessy–Milner formulas -/
inductive HML (L : Type u) where
| tt : HML L
| neg : HML L → HML L
| and : HML L → HML L → HML L
| dia : L → HML L → HML L
def sat : S → HML L → Prop
| _, .tt => True
| p, .neg φ => ¬ sat p φ
| p, .and φ ψ => sat p φ ∧ sat p ψ
| p, .dia a φ => ∃ p', T p a p' ∧ sat p' φ
/-- invariance: bisimilar states satisfy the same HML formulas -/
theorem hm_invariance (B : S → S → Prop) (hB : Bisim T B) :
(φ : HML L) → ∀ p q, B p q → (sat T p φ ↔ sat T q φ)
| .tt, _, _, _ => Iff.rfl
| .neg φ, p, q, b => ⟨fun h hq => h ((hm_invariance B hB φ p q b).mpr hq),
fun h hp => h ((hm_invariance B hB φ p q b).mp hp)⟩
| .and φ ψ, p, q, b => ⟨fun h => ⟨(hm_invariance B hB φ p q b).mp h.1, (hm_invariance B hB ψ p q b).mp h.2⟩,
fun h => ⟨(hm_invariance B hB φ p q b).mpr h.1, (hm_invariance B hB ψ p q b).mpr h.2⟩⟩
| .dia a φ, p, q, b =>
⟨fun ⟨p', t, h⟩ => match (hB p q b).1 a p' t with
| ⟨q', t', b'⟩ => ⟨q', t', (hm_invariance B hB φ p' q' b').mp h⟩,
fun ⟨q', t, h⟩ => match (hB p q b).2 a q' t with
| ⟨p', t', b'⟩ => ⟨p', t', (hm_invariance B hB φ p' q' b').mpr h⟩⟩
end Proc
end Found
#print axioms Found.Proc.bis_refl
#print axioms Found.Proc.bis_symm
#print axioms Found.Proc.bis_trans
#print axioms Found.Proc.hm_invariance
lean_all/found/ProofNets.lean
/-
T179. found/ProofNets — proof nets as a point (multiplicative linear
logic, MLL, the linear coordinate T68): formulas, involutive linear
negation, one-sided sequent derivations (ax, ⊗, ⅋, exchange).
* The proof-net count invariant (Euler characteristic of a correct net):
for every derivable ⊢ Γ, #atoms(Γ) = 2·(#⊗(Γ) + 1), i.e. a net with
k axiom links has exactly k − 1 tensors — the numerical shadow of the
Danos–Regnier criterion (switching graphs are trees).
Full sequentialization, deep inference and the geometry of interaction
are cited.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace PN
inductive F where
| pos : Nat → F
| neg : Nat → F
| tensor : F → F → F
| par : F → F → F
def dual : F → F
| .pos n => .neg n
| .neg n => .pos n
| .tensor a b => .par (dual a) (dual b)
| .par a b => .tensor (dual a) (dual b)
theorem dual_dual : (a : F) → dual (dual a) = a
| .pos _ => rfl
| .neg _ => rfl
| .tensor a b => by show F.tensor (dual (dual a)) (dual (dual b)) = _; rw [dual_dual a, dual_dual b]
| .par a b => by show F.par (dual (dual a)) (dual (dual b)) = _; rw [dual_dual a, dual_dual b]
def atc : F → Nat
| .pos _ => 1
| .neg _ => 1
| .tensor a b => atc a + atc b
| .par a b => atc a + atc b
def tc : F → Nat
| .pos _ => 0
| .neg _ => 0
| .tensor a b => tc a + tc b + 1
| .par a b => tc a + tc b
def sumL (m : F → Nat) : List F → Nat
| [] => 0
| a :: l => m a + sumL m l
theorem sumL_app (m : F → Nat) : (l k : List F) → sumL m (l ++ k) = sumL m l + sumL m k
| [], k => (Nat.zero_add _).symm
| a :: l, k => by
show m a + sumL m (l ++ k) = m a + sumL m l + sumL m k
rw [sumL_app m l k, Nat.add_assoc]
inductive D : List F → Type where
| ax (n : Nat) : D [.pos n, .neg n]
| tensor {Γ Δ : List F} {a b : F} : D (Γ ++ [a]) → D (Δ ++ [b]) → D (Γ ++ Δ ++ [.tensor a b])
| par {Γ : List F} {a b : F} : D (Γ ++ [a, b]) → D (Γ ++ [.par a b])
| exch {Γ Δ : List F} {a b : F} : D (Γ ++ [a, b] ++ Δ) → D (Γ ++ [b, a] ++ Δ)
theorem dbl (X : Nat) : (Y : Nat) → X + X + 1 + 1 + (Y + Y + 1 + 1) = X + Y + 1 + (X + Y + 1) + 1 + 1
| 0 => by
show X + X + 1 + 1 + 1 + 1 = X + 1 + X + 1 + 1 + 1
rw [Nat.add_right_comm X 1 X]
| Y + 1 => by
show X + X + 1 + 1 + (Y + 1 + Y + 1 + 1 + 1) = X + Y + 1 + 1 + (X + Y + 1) + 1 + 1 + 1
rw [Nat.add_right_comm Y 1 Y, Nat.add_right_comm (X + Y + 1) 1 (X + Y + 1)]
show X + X + 1 + 1 + (Y + Y + 1 + 1) + 1 + 1 = X + Y + 1 + (X + Y + 1) + 1 + 1 + 1 + 1
rw [dbl X Y]
theorem ten_arith (g d A B tg td TA TB : Nat)
(h1 : g + A = tg + TA + (tg + TA) + 1 + 1) (h2 : d + B = td + TB + (td + TB) + 1 + 1) :
g + d + (A + B) = tg + td + (TA + TB + 1) + (tg + td + (TA + TB + 1)) + 1 + 1 := by
rw [Nat.add_add_add_comm g d A B, h1, h2]
show _ = tg + td + (TA + TB) + 1 + (tg + td + (TA + TB) + 1) + 1 + 1
rw [Nat.add_add_add_comm tg td TA TB]
exact dbl _ _
theorem sumL_swap (m : F → Nat) (Γ Δ : List F) (a b : F) :
sumL m (Γ ++ [a, b] ++ Δ) = sumL m (Γ ++ [b, a] ++ Δ) := by
rw [sumL_app, sumL_app, sumL_app, sumL_app]
show sumL m Γ + (m a + (m b + 0)) + sumL m Δ = sumL m Γ + (m b + (m a + 0)) + sumL m Δ
rw [Nat.add_zero, Nat.add_zero, Nat.add_comm (m a)]
/-- Euler-characteristic invariant of MLL proofs: atoms = 2·(tensors + 1) -/
theorem euler {Γ : List F} (d : D Γ) : sumL atc Γ = sumL tc Γ + sumL tc Γ + 1 + 1 := by
induction d with
| ax _ => rfl
| @tensor Γ Δ a b _ _ ih1 ih2 =>
rw [sumL_app, sumL_app] at ih1 ih2
rw [sumL_app, sumL_app, sumL_app, sumL_app]
show sumL atc Γ + sumL atc Δ + (atc a + atc b + 0) =
sumL tc Γ + sumL tc Δ + (tc a + tc b + 1 + 0) + (sumL tc Γ + sumL tc Δ + (tc a + tc b + 1 + 0)) + 1 + 1
have h1 : sumL atc Γ + (atc a + 0) = _ := ih1
have h2 : sumL atc Δ + (atc b + 0) = _ := ih2
rw [Nat.add_zero] at h1 h2 ⊢
rw [Nat.add_zero]
exact ten_arith _ _ _ _ _ _ _ _ h1 h2
| @par Γ a b _ ih =>
rw [sumL_app, sumL_app] at ih
rw [sumL_app, sumL_app]
show sumL atc Γ + (atc a + atc b + 0) = sumL tc Γ + (tc a + tc b + 0) + (sumL tc Γ + (tc a + tc b + 0)) + 1 + 1
have h : sumL atc Γ + (atc a + (atc b + 0)) = sumL tc Γ + (tc a + (tc b + 0)) + (sumL tc Γ + (tc a + (tc b + 0))) + 1 + 1 := ih
rw [Nat.add_zero] at h ⊢
exact h
| @exch Γ Δ a b _ ih =>
rw [sumL_swap atc Γ Δ b a, sumL_swap tc Γ Δ b a]
exact ih
end PN
end Found
#print axioms Found.PN.dual_dual
#print axioms Found.PN.dbl
#print axioms Found.PN.ten_arith
#print axioms Found.PN.sumL_swap
#print axioms Found.PN.euler
lean_all/found/Quantum.lean
/-
T111. found/Quantum — quantum logic as a point: the ortholattice
coordinate (orthocomplemented lattice, preorder form).
* Orthomodularity and distributivity as two conditions on the coordinate.
* General: a distributive ortholattice is a Boolean Heyting algebra
(a → b := a' ∨ b) — classical logic (T66) is the distributive value;
the line quantum → classical is "add distributivity".
* Instance MO2 (0 < a, a', b, b' < 1): orthomodular and not distributive —
the quantum point.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Classical
namespace Found
namespace Quantum
universe u
structure OL where
car : Type u
le : car → car → Prop
le_refl : ∀ a, le a a
le_trans : ∀ {a b c}, le a b → le b c → le a c
top : car
bot : car
meet : car → car → car
join : car → car → car
comp : car → car
le_top : ∀ a, le a top
bot_le : ∀ a, le bot a
meet_l : ∀ a b, le (meet a b) a
meet_r : ∀ a b, le (meet a b) b
meet_univ : ∀ {a b c}, le c a → le c b → le c (meet a b)
join_l : ∀ a b, le a (join a b)
join_r : ∀ a b, le b (join a b)
join_univ : ∀ {a b c}, le a c → le b c → le (join a b) c
comp_anti : ∀ {a b}, le a b → le (comp b) (comp a)
comp_inv1 : ∀ a, le a (comp (comp a))
comp_inv2 : ∀ a, le (comp (comp a)) a
comp_meet : ∀ a, le (meet a (comp a)) bot
comp_join : ∀ a, le top (join a (comp a))
def Orthomodular (L : OL.{u}) : Prop := ∀ a b, L.le a b → L.le b (L.join a (L.meet b (L.comp a)))
def Distributive (L : OL.{u}) : Prop :=
∀ a b c, L.le (L.meet a (L.join b c)) (L.join (L.meet a b) (L.meet a c))
/-- a distributive ortholattice is a Heyting algebra with a → b := a' ∨ b -/
def toHA (L : OL.{u}) (hd : Distributive L) : HA.{u} where
car := L.car
le := L.le
le_refl := L.le_refl
le_trans := L.le_trans
top := L.top
bot := L.bot
meet := L.meet
join := L.join
imp a b := L.join (L.comp a) b
le_top := L.le_top
bot_le := L.bot_le
meet_l := L.meet_l
meet_r := L.meet_r
meet_univ := L.meet_univ
join_l := L.join_l
join_r := L.join_r
join_univ := L.join_univ
imp_adj {a b c} :=
⟨fun h => L.le_trans (L.meet_univ (L.le_refl c) (L.le_trans (L.le_top c) (L.comp_join a)))
(L.le_trans (hd c a (L.comp a))
(L.join_univ (L.le_trans h (L.join_r _ _)) (L.le_trans (L.meet_r _ _) (L.join_l _ _)))),
fun h => L.le_trans (L.meet_univ (L.le_trans (L.meet_l _ _) h) (L.meet_r _ _))
(L.le_trans (L.le_trans (L.meet_univ (L.meet_r _ _) (L.meet_l _ _)) (hd a (L.comp a) b))
(L.join_univ (L.le_trans (L.comp_meet a) (L.bot_le b)) (L.meet_r _ _)))⟩
/-- and it is Boolean: the classical value -/
theorem toHA_boolean (L : OL.{u}) (hd : Distributive L) : Prp.Boolean (toHA L hd) :=
fun a => L.join_univ
(L.le_trans (L.comp_anti (L.join_l (L.comp a) L.bot)) (L.comp_inv2 a))
(L.bot_le a)
/-! ## MO2: orthomodular, not distributive -/
inductive MO where
| z : MO
| a : MO
| na : MO
| b : MO
| nb : MO
| o : MO
namespace MO
def le : MO → MO → Prop
| z, z => True
| z, a => True
| z, na => True
| z, b => True
| z, nb => True
| z, o => True
| a, z => False
| a, a => True
| a, na => False
| a, b => False
| a, nb => False
| a, o => True
| na, z => False
| na, a => False
| na, na => True
| na, b => False
| na, nb => False
| na, o => True
| b, z => False
| b, a => False
| b, na => False
| b, b => True
| b, nb => False
| b, o => True
| nb, z => False
| nb, a => False
| nb, na => False
| nb, b => False
| nb, nb => True
| nb, o => True
| o, z => False
| o, a => False
| o, na => False
| o, b => False
| o, nb => False
| o, o => True
def meet : MO → MO → MO
| z, z => z
| z, a => z
| z, na => z
| z, b => z
| z, nb => z
| z, o => z
| a, z => z
| a, a => a
| a, na => z
| a, b => z
| a, nb => z
| a, o => a
| na, z => z
| na, a => z
| na, na => na
| na, b => z
| na, nb => z
| na, o => na
| b, z => z
| b, a => z
| b, na => z
| b, b => b
| b, nb => z
| b, o => b
| nb, z => z
| nb, a => z
| nb, na => z
| nb, b => z
| nb, nb => nb
| nb, o => nb
| o, z => z
| o, a => a
| o, na => na
| o, b => b
| o, nb => nb
| o, o => o
def join : MO → MO → MO
| z, z => z
| z, a => a
| z, na => na
| z, b => b
| z, nb => nb
| z, o => o
| a, z => a
| a, a => a
| a, na => o
| a, b => o
| a, nb => o
| a, o => o
| na, z => na
| na, a => o
| na, na => na
| na, b => o
| na, nb => o
| na, o => o
| b, z => b
| b, a => o
| b, na => o
| b, b => b
| b, nb => o
| b, o => o
| nb, z => nb
| nb, a => o
| nb, na => o
| nb, b => o
| nb, nb => nb
| nb, o => o
| o, z => o
| o, a => o
| o, na => o
| o, b => o
| o, nb => o
| o, o => o
def comp : MO → MO
| z => o
| a => na
| na => a
| b => nb
| nb => b
| o => z
def L : OL.{0} where
car := MO
le := le
le_refl x := by cases x <;> exact trivial
le_trans {x y w} := by
cases x <;> cases y <;> cases w <;> intro p q <;> first | exact trivial | exact p.elim | exact q.elim
top := o
bot := z
meet := meet
join := join
comp := comp
le_top x := by cases x <;> exact trivial
bot_le x := by cases x <;> exact trivial
meet_l x y := by cases x <;> cases y <;> exact trivial
meet_r x y := by cases x <;> cases y <;> exact trivial
meet_univ {x y w} := by
cases x <;> cases y <;> cases w <;> intro p q <;> first | exact trivial | exact p.elim | exact q.elim
join_l x y := by cases x <;> cases y <;> exact trivial
join_r x y := by cases x <;> cases y <;> exact trivial
join_univ {x y w} := by
cases x <;> cases y <;> cases w <;> intro p q <;> first | exact trivial | exact p.elim | exact q.elim
comp_anti {x y} := by cases x <;> cases y <;> intro p <;> first | exact trivial | exact p.elim
comp_inv1 x := by cases x <;> exact trivial
comp_inv2 x := by cases x <;> exact trivial
comp_meet x := by cases x <;> exact trivial
comp_join x := by cases x <;> exact trivial
theorem orthomodular : Orthomodular L := fun x y => by
cases x <;> cases y <;> intro p <;> first | exact trivial | exact p.elim
theorem not_distributive : ¬ Distributive L := fun h => h a b nb
end MO
end Quantum
end Found
#print axioms Found.Quantum.toHA
#print axioms Found.Quantum.toHA_boolean
#print axioms Found.Quantum.MO.L
#print axioms Found.Quantum.MO.orthomodular
#print axioms Found.Quantum.MO.not_distributive
lean_all/found/QuantumCirc.lean
/-
T184. found/QuantumCirc — quantum circuits as a point (known range):
* Computational-basis (reversible) gates on bit tuples: NOT, CNOT, Toffoli;
CNOT is an involution, and CNOT₁₂ ∘ CNOT₂₁ ∘ CNOT₁₂ = SWAP.
* Single-qubit gates as 2×2 integer matrices (unnormalized):
H² = 2·I, X² = I, Z² = I, XZ = −ZX (the Pauli anticommutation).
ZX-calculus rewriting is the diagrammatic line (cited); amplitudes over ℂ
need the analysis point (T118).
Lean 4 core only, concrete computations by rfl, no axioms.
-/
namespace Found
namespace QC
def cnot12 : Bool × Bool → Bool × Bool
| (a, b) => (a, xor a b)
def cnot21 : Bool × Bool → Bool × Bool
| (a, b) => (xor a b, b)
def swap : Bool × Bool → Bool × Bool
| (a, b) => (b, a)
theorem cnot_involution (x : Bool × Bool) : cnot12 (cnot12 x) = x := by
cases x with
| mk a b => cases a <;> cases b <;> rfl
theorem three_cnots (x : Bool × Bool) : cnot12 (cnot21 (cnot12 x)) = swap x := by
cases x with
| mk a b => cases a <;> cases b <;> rfl
def toffoli : Bool × Bool × Bool → Bool × Bool × Bool
| (a, b, c) => (a, b, xor (a && b) c)
theorem toffoli_involution (x : Bool × Bool × Bool) : toffoli (toffoli x) = x := by
cases x with
| mk a bc => cases bc with
| mk b c => cases a <;> cases b <;> cases c <;> rfl
structure M2 where
a : Int
b : Int
c : Int
d : Int
def mul (x y : M2) : M2 :=
⟨x.a * y.a + x.b * y.c, x.a * y.b + x.b * y.d, x.c * y.a + x.d * y.c, x.c * y.b + x.d * y.d⟩
def H : M2 := ⟨1, 1, 1, -1⟩
def X : M2 := ⟨0, 1, 1, 0⟩
def Z : M2 := ⟨1, 0, 0, -1⟩
theorem H_sq : mul H H = ⟨2, 0, 0, 2⟩ := rfl
theorem X_sq : mul X X = ⟨1, 0, 0, 1⟩ := rfl
theorem Z_sq : mul Z Z = ⟨1, 0, 0, 1⟩ := rfl
theorem XZ_anti : mul X Z = ⟨0, -1, 1, 0⟩ ∧ mul Z X = ⟨0, 1, -1, 0⟩ := ⟨rfl, rfl⟩
theorem HXH : mul (mul H X) H = ⟨2, 0, 0, -2⟩ := rfl
end QC
end Found
#print axioms Found.QC.cnot_involution
#print axioms Found.QC.three_cnots
#print axioms Found.QC.toffoli_involution
#print axioms Found.QC.H_sq
#print axioms Found.QC.XZ_anti
#print axioms Found.QC.HXH
lean_all/found/Ramified.lean
/-
T212. found/Ramified — Russell's ramified type theory (Principia) as a
point of the chart: simple types built by the power operation (Ω^(-)),
and orders on top of them.
* Syntax: ramified types (individuals; predicates of a given order over a
list of argument types, the order exceeding the orders of the
arguments); erasure of orders gives simple types (the HOL point, T205).
* Semantics over a domain D: a cumulative hierarchy of predicate levels
Pr n ⊆ (D → Prop), each level closed under the predicative comprehension
of the next (formulas quantifying only over lower levels).
* Axiom of Reducibility: every predicate of any order is coextensive with
one of order 0. Under it, quantifying over any order is the same as
quantifying over order 0: the hierarchy collapses to the simple theory.
* Without it the hierarchy can be strict: over Bool, with order 0 the
constant predicates and order 1 all predicates, reducibility fails.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Ramified
/-! ## syntax -/
/-- simple types: individuals and predicates over lists of types -/
inductive STy where
| ind : STy
| pred : List STy → STy
/-- ramified types: predicates carry an order -/
inductive RTy where
| ind : RTy
| pred : Nat → List RTy → RTy
/-- order of a ramified type -/
def ord : RTy → Nat
| .ind => 0
| .pred n _ => n
-- well-formed: each predicate's order exceeds the orders of its arguments
mutual
def WF : RTy → Prop
| .ind => True
| .pred n ts => WFL n ts
def WFL (n : Nat) : List RTy → Prop
| [] => True
| t :: ts => WF t ∧ ord t < n ∧ WFL n ts
end
/-- a well-formed predicate of order 1 over individuals -/
theorem wf_example : WF (.pred 1 [.ind, .ind]) := ⟨trivial, Nat.zero_lt_one, trivial, Nat.zero_lt_one, trivial⟩
mutual
/-- erasing orders: the simple type underneath -/
def erase : RTy → STy
| .ind => .ind
| .pred _ ts => .pred (eraseL ts)
def eraseL : List RTy → List STy
| [] => []
| t :: ts => erase t :: eraseL ts
end
/-- erasure forgets the order: predicates of different orders over the same arguments
have the same simple type -/
theorem erase_order (n m : Nat) (ts : List RTy) : erase (.pred n ts) = erase (.pred m ts) := rfl
/-! ## semantics: a hierarchy of predicate levels -/
/-- a ramified hierarchy of unary predicates on D -/
structure Hier (D : Type) where
Pr : Nat → (D → Prop) → Prop
cum : ∀ n F, Pr n F → Pr (n + 1) F
/-- predicative comprehension: quantifying over level n gives a predicate of level n + 1 -/
compAll : ∀ n (R : (D → Prop) → D → Prop), Pr (n + 1) (fun x => ∀ F, Pr n F → R F x)
compEx : ∀ n (R : (D → Prop) → D → Prop), Pr (n + 1) (fun x => ∃ F, Pr n F ∧ R F x)
/-- coextensive predicates -/
def Coext {D : Type} (F G : D → Prop) : Prop := ∀ x, F x ↔ G x
/-- the Axiom of Reducibility -/
def Reducibility {D : Type} (H : Hier D) : Prop := ∀ n F, H.Pr n F → ∃ G, H.Pr 0 G ∧ Coext F G
/-- predicates respecting coextension (extensional properties of predicates) -/
def Ext {D : Type} (P : (D → Prop) → Prop) : Prop := ∀ F G, Coext F G → P F → P G
/-- under reducibility, quantifying over any order is quantifying over order 0 -/
theorem collapse_all {D : Type} (H : Hier D) (hR : Reducibility H) (P : (D → Prop) → Prop) (hP : Ext P) (n : Nat) :
(∀ F, H.Pr n F → P F) ↔ (∀ G, H.Pr 0 G → P G) :=
⟨fun h G hG => h G (lift0 n G hG),
fun h F hF => match hR n F hF with
| ⟨G, hG, hc⟩ => hP G F (fun x => (hc x).symm) (h G hG)⟩
where
lift0 : ∀ n (G : D → Prop), H.Pr 0 G → H.Pr n G
| 0, _, hG => hG
| n + 1, G, hG => H.cum n G (lift0 n G hG)
theorem collapse_ex {D : Type} (H : Hier D) (hR : Reducibility H) (P : (D → Prop) → Prop) (hP : Ext P) (n : Nat) :
(∃ F, H.Pr n F ∧ P F) ↔ (∃ G, H.Pr 0 G ∧ P G) :=
⟨fun ⟨F, hF, p⟩ => match hR n F hF with
| ⟨G, hG, hc⟩ => ⟨G, hG, hP F G hc p⟩,
fun ⟨G, hG, p⟩ => ⟨G, collapse_all.lift0 H n G hG, p⟩⟩
/-! ## a strict hierarchy: reducibility can fail -/
/-- order 0: the constant predicates on Bool; higher orders: all predicates -/
def boolHier : Hier Bool where
Pr n F := match n with
| 0 => Coext F (fun _ => True) ∨ Coext F (fun _ => False)
| _ + 1 => True
cum n _ _ := match n with
| 0 => trivial
| _ + 1 => trivial
compAll _ _ := trivial
compEx _ _ := trivial
theorem bool_not_reducible : ¬ Reducibility boolHier :=
fun h => match h 1 (fun b => b = true) trivial with
| ⟨_, .inl hT, hc⟩ => Bool.noConfusion ((hc false).2 ((hT false).2 trivial))
| ⟨_, .inr hF, hc⟩ => (hF true).1 ((hc true).1 rfl)
end Ramified
end Found
#print axioms Found.Ramified.erase_order
#print axioms Found.Ramified.wf_example
#print axioms Found.Ramified.collapse_all
#print axioms Found.Ramified.collapse_ex
#print axioms Found.Ramified.boolHier
#print axioms Found.Ramified.bool_not_reducible
lean_all/found/Realz1.lean
/-
T178, realization, part 1. found/Realz1 — classical S4 and its cut-free
sequent calculus:
* modal formulas (atoms, ⊥, →, □) and the Hilbert system S4 (K, S, double
negation, K□, T, 4, modus ponens, necessitation);
* a Kleene-style sequent calculus G (principal formulas kept, contexts as
lists read as sets): atomic axioms, ⊥L, →L, →R, □L, □R with premise
□Γ ⇒ A;
* weakening, identity, and cut admissibility (by induction on the cut
formula and the two derivations);
* every S4 theorem has a cut-free derivation.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace RZ
inductive MF where
| atom : Nat → MF
| bot : MF
| imp : MF → MF → MF
| box : MF → MF
/-- classical S4 -/
inductive HS4 : MF → Prop where
| k (a b : MF) : HS4 (.imp a (.imp b a))
| s (a b c : MF) : HS4 (.imp (.imp a (.imp b c)) (.imp (.imp a b) (.imp a c)))
| dne (a : MF) : HS4 (.imp (.imp (.imp a .bot) .bot) a)
| kb (a b : MF) : HS4 (.imp (.box (.imp a b)) (.imp (.box a) (.box b)))
| t (a : MF) : HS4 (.imp (.box a) a)
| four (a : MF) : HS4 (.imp (.box a) (.box (.box a)))
| mp {a b : MF} : HS4 (.imp a b) → HS4 a → HS4 b
| nec {a : MF} : HS4 a → HS4 (.box a)
/-- the boxed formulas of a context -/
def bx : List MF → List MF
| [] => []
| .atom _ :: l => bx l
| .bot :: l => bx l
| .imp _ _ :: l => bx l
| .box a :: l => .box a :: bx l
/-- the cut-free sequent calculus -/
inductive G : List MF → List MF → Prop where
| ax {Γ Δ : List MF} {n : Nat} : .atom n ∈ Γ → .atom n ∈ Δ → G Γ Δ
| botL {Γ Δ : List MF} : .bot ∈ Γ → G Γ Δ
| impL {Γ Δ : List MF} {a b : MF} : .imp a b ∈ Γ → G Γ (a :: Δ) → G (b :: Γ) Δ → G Γ Δ
| impR {Γ Δ : List MF} {a b : MF} : .imp a b ∈ Δ → G (a :: Γ) (b :: Δ) → G Γ Δ
| boxL {Γ Δ : List MF} {a : MF} : .box a ∈ Γ → G (a :: Γ) Δ → G Γ Δ
| boxR {Γ Δ : List MF} {a : MF} : .box a ∈ Δ → G (bx Γ) [a] → G Γ Δ
def Sub (A B : List MF) : Prop := ∀ x, x ∈ A → x ∈ B
theorem sub_refl (A : List MF) : Sub A A := fun _ m => m
theorem sub_cons (x : MF) {A B : List MF} (h : Sub A B) : Sub (x :: A) (x :: B) := fun _ m => by
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (h _ m')
theorem sub_tl (x : MF) (A : List MF) : Sub A (x :: A) := fun _ m => .tail _ m
theorem sub_trans {A B C : List MF} (h1 : Sub A B) (h2 : Sub B C) : Sub A C := fun _ m => h2 _ (h1 _ m)
theorem sub_cons_of {x : MF} {A B : List MF} (hx : x ∈ B) (h : Sub A B) : Sub (x :: A) B := fun _ m => by
cases m with
| head => exact hx
| tail _ m' => exact h _ m'
theorem mem_bx : (Γ : List MF) → {a : MF} → .box a ∈ Γ → .box a ∈ bx Γ
| [], _, m => nomatch m
| .atom _ :: l, _, m => by cases m with | tail _ m' => exact mem_bx l m'
| .bot :: l, _, m => by cases m with | tail _ m' => exact mem_bx l m'
| .imp _ _ :: l, _, m => by cases m with | tail _ m' => exact mem_bx l m'
| .box b :: l, _, m => by
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (mem_bx l m')
/-- members of bx Γ are boxed members of Γ -/
theorem bx_mem : (Γ : List MF) → {x : MF} → x ∈ bx Γ → x ∈ Γ ∧ ∃ a, x = .box a
| [], _, m => nomatch m
| .atom _ :: l, _, m => match bx_mem l m with | ⟨h1, h2⟩ => ⟨.tail _ h1, h2⟩
| .bot :: l, _, m => match bx_mem l m with | ⟨h1, h2⟩ => ⟨.tail _ h1, h2⟩
| .imp _ _ :: l, _, m => match bx_mem l m with | ⟨h1, h2⟩ => ⟨.tail _ h1, h2⟩
| .box b :: l, _, m => by
cases m with
| head => exact ⟨.head _, b, rfl⟩
| tail _ m' => exact match bx_mem l m' with | ⟨h1, h2⟩ => ⟨.tail _ h1, h2⟩
theorem sub_bx {Γ Γ' : List MF} (h : Sub Γ Γ') : Sub (bx Γ) (bx Γ') := fun _ m =>
match bx_mem Γ m with
| ⟨h1, a, e⟩ => by subst e; exact mem_bx Γ' (h _ h1)
theorem bx_sub (Γ : List MF) : Sub (bx Γ) Γ := fun _ m => (bx_mem Γ m).1
theorem bx_bx (Γ : List MF) : Sub (bx Γ) (bx (bx Γ)) := fun _ m =>
match bx_mem Γ m with
| ⟨_, a, e⟩ => by subst e; exact mem_bx (bx Γ) m
/-- weakening -/
theorem weak {Γ Δ : List MF} (d : G Γ Δ) : ∀ {Γ' Δ' : List MF}, Sub Γ Γ' → Sub Δ Δ' → G Γ' Δ' := by
induction d with
| ax h1 h2 => exact fun s1 s2 => .ax (s1 _ h1) (s2 _ h2)
| botL h => exact fun s1 _ => .botL (s1 _ h)
| impL h _ _ ih1 ih2 => exact fun s1 s2 => .impL (s1 _ h) (ih1 s1 (sub_cons _ s2)) (ih2 (sub_cons _ s1) s2)
| impR h _ ih => exact fun s1 s2 => .impR (s2 _ h) (ih (sub_cons _ s1) (sub_cons _ s2))
| boxL h _ ih => exact fun s1 s2 => .boxL (s1 _ h) (ih (sub_cons _ s1) s2)
| boxR h _ ih => exact fun s1 s2 => .boxR (s2 _ h) (ih (sub_bx s1) (sub_refl _))
theorem sub_nil (A : List MF) : Sub [] A := fun _ m => nomatch m
theorem mem_inv {x y : MF} {l : List MF} (h : x ∈ y :: l) : x = y ∨ x ∈ l := by
cases h with
| head => exact .inl rfl
| tail _ m => exact .inr m
/-- identity for every formula -/
theorem idt : (a : MF) → ∀ Γ Δ : List MF, G (a :: Γ) (a :: Δ)
| .atom _, _, _ => .ax (.head _) (.head _)
| .bot, _, _ => .botL (.head _)
| .imp a b, _, _ => .impR (.head _) (.impL (.tail _ (.head _)) (idt a _ _) (idt b _ _))
| .box a, Γ, _ => .boxR (.head _) (.boxL (.head _) (idt a (.box a :: bx Γ) []))
theorem idm {a : MF} {Γ Δ : List MF} (h1 : a ∈ Γ) (h2 : a ∈ Δ) : G Γ Δ :=
weak (idt a [] []) (sub_cons_of h1 (sub_nil _)) (sub_cons_of h2 (sub_nil _))
/-! ## cut admissibility -/
def CutF (A : MF) : Prop := ∀ {Γ Δ : List MF}, G Γ (A :: Δ) → G (A :: Γ) Δ → G Γ Δ
theorem Rimp {a b : MF} (ca : CutF a) (cb : CutF b) {Γ'' Δ1 : List MF} (d : G Γ'' Δ1) :
∀ {Γ1 : List MF}, Sub Γ'' (.imp a b :: Γ1) → G (a :: Γ1) (b :: Δ1) → G Γ1 Δ1 := by
induction d with
| ax h1 h2 => exact fun s _ => match mem_inv (s _ h1) with
| .inl e => MF.noConfusion e
| .inr m => .ax m h2
| botL h => exact fun s _ => match mem_inv (s _ h) with
| .inl e => MF.noConfusion e
| .inr m => .botL m
| @impL Γ'' Δ1 c d' h _ _ ih1 ih2 =>
intro Γ1 s f
have r1 : G Γ1 (c :: Δ1) := ih1 s (weak f (sub_refl _) (sub_cons _ (sub_tl _ _)))
have r2 : G (d' :: Γ1) Δ1 := ih2 (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak f (sub_cons _ (sub_tl _ _)) (sub_refl _))
exact match mem_inv (s _ h) with
| .inl e => by
injection e with e1 e2
subst e1; subst e2
exact ca r1 (cb (weak f (sub_refl _) (sub_cons _ (sub_refl _)))
(weak r2 (sub_cons _ (sub_tl _ _)) (sub_refl _)))
| .inr m => .impL m r1 r2
| @impR Γ'' Δ1 c d' h _ ih =>
intro Γ1 s f
exact .impR h (ih (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak f (sub_cons _ (sub_tl _ _)) (sub_cons _ (sub_tl _ _))))
| @boxL Γ'' Δ1 c h _ ih =>
intro Γ1 s f
exact match mem_inv (s _ h) with
| .inl e => MF.noConfusion e
| .inr m => .boxL m (ih (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak f (sub_cons _ (sub_tl _ _)) (sub_refl _)))
| boxR h d' _ =>
intro Γ1 s _
have q : Sub (bx _) (bx (MF.imp a b :: Γ1)) := sub_bx s
exact .boxR h (weak d' q (sub_refl _))
theorem Rbox {a : MF} (ca : CutF a) {Γ'' Δ1 : List MF} (d : G Γ'' Δ1) :
∀ {Γ1 : List MF}, Sub Γ'' (.box a :: Γ1) → G (bx Γ1) [a] → G Γ1 Δ1 := by
induction d with
| ax h1 h2 => exact fun s _ => match mem_inv (s _ h1) with
| .inl e => MF.noConfusion e
| .inr m => .ax m h2
| botL h => exact fun s _ => match mem_inv (s _ h) with
| .inl e => MF.noConfusion e
| .inr m => .botL m
| @impL Γ'' Δ1 c d' h _ _ ih1 ih2 =>
intro Γ1 s f
exact match mem_inv (s _ h) with
| .inl e => MF.noConfusion e
| .inr m => .impL m (ih1 s f) (ih2 (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak f (sub_bx (sub_tl _ _)) (sub_refl _)))
| @impR Γ'' Δ1 c d' h _ ih =>
intro Γ1 s f
exact .impR h (ih (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak f (sub_bx (sub_tl _ _)) (sub_refl _)))
| @boxL Γ'' Δ1 c h _ ih =>
intro Γ1 s f
have r : G (c :: Γ1) Δ1 := ih (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak f (sub_bx (sub_tl _ _)) (sub_refl _))
exact match mem_inv (s _ h) with
| .inl e => by
injection e with e1
subst e1
exact ca (weak f (bx_sub Γ1) (sub_cons_of (.head _) (sub_nil _))) r
| .inr m => .boxL m r
| boxR h _ ih =>
intro Γ1 s f
exact .boxR h (ih (sub_bx s) (weak f (bx_bx Γ1) (sub_refl _)))
theorem L1 {A : MF}
(hI : ∀ c d : MF, MF.imp c d = A → ∀ {Γ Δ : List MF}, G (c :: Γ) (d :: Δ) → G (A :: Γ) Δ → G Γ Δ)
(hB : ∀ c : MF, MF.box c = A → ∀ {Γ Δ : List MF}, G (bx Γ) [c] → G (A :: Γ) Δ → G Γ Δ)
{Γ Δ' : List MF} (d : G Γ Δ') : ∀ {Δ : List MF}, Sub Δ' (A :: Δ) → G (A :: Γ) Δ → G Γ Δ := by
induction d with
| ax h1 h2 => exact fun s r => match mem_inv (s _ h2) with
| .inl e => by subst e; exact weak r (sub_cons_of h1 (sub_refl _)) (sub_refl _)
| .inr m => .ax h1 m
| botL h => exact fun _ _ => .botL h
| impL h _ _ ih1 ih2 =>
exact fun s r => .impL h (ih1 (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak r (sub_refl _) (sub_tl _ _)))
(ih2 s (weak r (sub_cons _ (sub_tl _ _)) (sub_refl _)))
| @impR Γ Δ' c d' h _ ih =>
intro Δ s r
have p : G (c :: Γ) (d' :: Δ) := ih (sub_cons_of (.tail _ (.head _)) (sub_trans s (sub_cons _ (sub_tl _ _))))
(weak r (sub_cons _ (sub_tl _ _)) (sub_tl _ _))
exact match mem_inv (s _ h) with
| .inl e => hI c d' e p r
| .inr m => .impR m p
| boxL h _ ih => exact fun s r => .boxL h (ih s (weak r (sub_cons _ (sub_tl _ _)) (sub_refl _)))
| @boxR Γ Δ' c h d' _ =>
intro Δ s r
exact match mem_inv (s _ h) with
| .inl e => hB c e d' r
| .inr m => .boxR m d'
/-- cut is admissible -/
theorem cut : (A : MF) → CutF A
| .atom _ => fun d1 d2 => L1 (fun _ _ e => MF.noConfusion e) (fun _ e => MF.noConfusion e) d1 (sub_refl _) d2
| .bot => fun d1 d2 => L1 (fun _ _ e => MF.noConfusion e) (fun _ e => MF.noConfusion e) d1 (sub_refl _) d2
| .imp a b => fun d1 d2 => L1
(fun c d e _ _ p r => by
cases e
exact Rimp (cut a) (cut b) r (sub_refl _) p)
(fun _ e => MF.noConfusion e) d1 (sub_refl _) d2
| .box a => fun d1 d2 => L1 (fun _ _ e => MF.noConfusion e)
(fun c e _ _ p r => by
cases e
exact Rbox (cut a) r (sub_refl _) p) d1 (sub_refl _) d2
/-! ## S4 theorems have cut-free derivations -/
theorem hs4_g {A : MF} (h : HS4 A) : G [] [A] := by
induction h with
| k a b => exact .impR (.head _) (.impR (.head _) (idm (.tail _ (.head _)) (.head _)))
| s a b c =>
exact .impR (.head _) (.impR (.head _) (.impR (.head _)
(.impL (.tail _ (.tail _ (.head _))) (idm (.head _) (.head _))
(.impL (.head _)
(.impL (.tail _ (.tail _ (.head _))) (idm (.tail _ (.head _)) (.head _))
(idm (.head _) (.head _)))
(idm (.head _) (.head _))))))
| dne a =>
exact .impR (.head _) (.impL (.head _) (.impR (.head _) (idm (.head _) (.tail _ (.tail _ (.head _)))))
(.botL (.head _)))
| kb a b =>
exact .impR (.head _) (.impR (.head _) (.boxR (.head _)
(.boxL (.tail _ (.head _)) (.boxL (.tail _ (.head _))
(.impL (.tail _ (.head _)) (idm (.head _) (.head _)) (idm (.head _) (.head _)))))))
| t a => exact .impR (.head _) (.boxL (.head _) (idm (.head _) (.head _)))
| four a => exact .impR (.head _) (.boxR (.head _) (.boxR (.head _) (.boxL (.head _) (idm (.head _) (.head _)))))
| @mp a b _ _ ih1 ih2 =>
have i1 : G [a] [b] := cut (.imp a b) (weak ih1 (sub_nil _) (sub_cons _ (sub_nil _)))
(.impL (.head _) (idm (.tail _ (.head _)) (.head _)) (idm (.head _) (.head _)))
exact cut a (weak ih2 (sub_refl _) (sub_cons _ (sub_nil _))) i1
| nec _ ih => exact .boxR (.head _) ih
end RZ
end Found
#print axioms Found.RZ.weak
#print axioms Found.RZ.idt
#print axioms Found.RZ.Rimp
#print axioms Found.RZ.Rbox
#print axioms Found.RZ.L1
#print axioms Found.RZ.cut
#print axioms Found.RZ.hs4_g
lean_all/found/Realz2.lean
/-
T178, realization, part 2. found/Realz2 — Artemov's logic of proofs LP:
* proof polynomials (variables, constants, application ·, sum +, proof
checker !) and formulas with t : A;
* the Hilbert system with hypotheses: classical propositional axioms,
t:(A→B) → s:A → (t·s):B, t:A → (t+s):A, s:A → (t+s):A, t:A → A,
t:A → !t:(t:A), and axiom necessitation c : A for every constant c and
axiom A (total constant specification);
* weakening, the deduction theorem, double negation;
* substitution of a proof polynomial for the variable u keeps derivations;
* lifting: from hypotheses x:C₁, …, x:Cₙ ⊢ B there is a u-free
polynomial t with x:C₁, …, x:Cₙ ⊢ t:B;
* summands: t:A → s:A whenever t is a summand of s.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Realz1
namespace Found
namespace RZ
inductive JT where
| var : Nat → JT
| cst : Nat → JT
| app : JT → JT → JT
| sum : JT → JT → JT
| bang : JT → JT
inductive JF where
| atom : Nat → JF
| bot : JF
| imp : JF → JF → JF
| pf : JT → JF → JF
def jneg (a : JF) : JF := .imp a .bot
/-- the axioms of LP -/
inductive LAx : JF → Prop where
| k (a b : JF) : LAx (.imp a (.imp b a))
| s (a b c : JF) : LAx (.imp (.imp a (.imp b c)) (.imp (.imp a b) (.imp a c)))
| dne (a : JF) : LAx (.imp (jneg (jneg a)) a)
| app (t s : JT) (a b : JF) : LAx (.imp (.pf t (.imp a b)) (.imp (.pf s a) (.pf (.app t s) b)))
| sumL (t s : JT) (a : JF) : LAx (.imp (.pf t a) (.pf (.sum t s) a))
| sumR (t s : JT) (a : JF) : LAx (.imp (.pf s a) (.pf (.sum t s) a))
| refl (t : JT) (a : JF) : LAx (.imp (.pf t a) a)
| chk (t : JT) (a : JF) : LAx (.imp (.pf t a) (.pf (.bang t) (.pf t a)))
/-- derivability from hypotheses -/
inductive Der (H : List JF) : JF → Prop where
| hyp {a : JF} : a ∈ H → Der H a
| ax {a : JF} : LAx a → Der H a
| cn (c : Nat) {a : JF} : LAx a → Der H (.pf (.cst c) a)
| mp {a b : JF} : Der H (.imp a b) → Der H a → Der H b
def JSub (A B : List JF) : Prop := ∀ x, x ∈ A → x ∈ B
theorem jsub_cons (x : JF) {A B : List JF} (h : JSub A B) : JSub (x :: A) (x :: B) := fun _ m => by
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (h _ m')
theorem der_weak {H : List JF} {a : JF} (d : Der H a) {H' : List JF} (s : JSub H H') : Der H' a := by
induction d with
| hyp m => exact .hyp (s _ m)
| ax h => exact .ax h
| cn c h => exact .cn c h
| mp _ _ ih1 ih2 => exact .mp ih1 ih2
theorem der_id (H : List JF) (a : JF) : Der H (.imp a a) :=
.mp (.mp (.ax (.s a (.imp a a) a)) (.ax (.k a (.imp a a)))) (.ax (.k a a))
/-- the deduction theorem -/
theorem deduction {H : List JF} {a b : JF} (d : Der (a :: H) b) : Der H (.imp a b) := by
induction d with
| hyp m =>
cases m with
| head => exact der_id H _
| tail _ m' => exact .mp (.ax (.k _ a)) (.hyp m')
| ax h => exact .mp (.ax (.k _ a)) (.ax h)
| cn c h => exact .mp (.ax (.k _ a)) (.cn c h)
| mp _ _ ih1 ih2 => exact .mp (.mp (.ax (.s _ _ _)) ih1) ih2
/-- from H, ¬a ⊢ ⊥ infer H ⊢ a -/
theorem by_contra {H : List JF} {a : JF} (d : Der (jneg a :: H) .bot) : Der H a :=
.mp (.ax (.dne a)) (deduction d)
/-! ## substitution for the variable u = var 1 -/
def tsub (s : JT) : JT → JT
| .var 1 => s
| .var 0 => .var 0
| .var (n + 2) => .var (n + 2)
| .cst c => .cst c
| .app a b => .app (tsub s a) (tsub s b)
| .sum a b => .sum (tsub s a) (tsub s b)
| .bang a => .bang (tsub s a)
def fsub (s : JT) : JF → JF
| .atom n => .atom n
| .bot => .bot
| .imp a b => .imp (fsub s a) (fsub s b)
| .pf t a => .pf (tsub s t) (fsub s a)
def mapF (s : JT) : List JF → List JF
| [] => []
| a :: l => fsub s a :: mapF s l
theorem mem_mapF (s : JT) {a : JF} : {H : List JF} → a ∈ H → fsub s a ∈ mapF s H
| _ :: _, .head _ => .head _
| _ :: _, .tail _ m => .tail _ (mem_mapF s m)
theorem lax_sub (s : JT) {a : JF} (h : LAx a) : LAx (fsub s a) := by
cases h with
| k => exact .k _ _
| s => exact .s _ _ _
| dne => exact .dne _
| app => exact .app _ _ _ _
| sumL => exact .sumL _ _ _
| sumR => exact .sumR _ _ _
| refl => exact .refl _ _
| chk => exact .chk _ _
theorem der_sub (s : JT) {H : List JF} {a : JF} (d : Der H a) : Der (mapF s H) (fsub s a) := by
induction d with
| hyp m => exact .hyp (mem_mapF s m)
| ax h => exact .ax (lax_sub s h)
| cn c h => exact .cn c (lax_sub s h)
| mp _ _ ih1 ih2 => exact .mp ih1 ih2
/-- composition of substitutions -/
theorem tsub_tsub (a b : JT) : (c : JT) → tsub a (tsub b c) = tsub (tsub a b) c
| .var 1 => rfl
| .var 0 => rfl
| .var (_ + 2) => rfl
| .cst _ => rfl
| .app c d => by show JT.app _ _ = JT.app _ _; rw [tsub_tsub a b c, tsub_tsub a b d]
| .sum c d => by show JT.sum _ _ = JT.sum _ _; rw [tsub_tsub a b c, tsub_tsub a b d]
| .bang c => by show JT.bang _ = JT.bang _; rw [tsub_tsub a b c]
/-- terms without u -/
def UFree : JT → Prop
| .var 1 => False
| .var 0 => True
| .var (_ + 2) => True
| .cst _ => True
| .app a b => UFree a ∧ UFree b
| .sum a b => UFree a ∧ UFree b
| .bang a => UFree a
theorem tsub_ufree (s : JT) : (t : JT) → UFree t → tsub s t = t
| .var 1, h => h.elim
| .var 0, _ => rfl
| .var (_ + 2), _ => rfl
| .cst _, _ => rfl
| .app a b, h => by show JT.app _ _ = _; rw [tsub_ufree s a h.1, tsub_ufree s b h.2]
| .sum a b, h => by show JT.sum _ _ = _; rw [tsub_ufree s a h.1, tsub_ufree s b h.2]
| .bang a, h => by show JT.bang _ = _; rw [tsub_ufree s a h]
/-! ## lifting -/
/-- the hypotheses are justified by the variable x = var 0 -/
def XHyp (H : List JF) : Prop := ∀ h, h ∈ H → ∃ c, h = .pf (.var 0) c
theorem lifting {H : List JF} (hx : XHyp H) {b : JF} (d : Der H b) : ∃ t, UFree t ∧ Der H (.pf t b) := by
induction d with
| hyp m => exact match hx _ m with
| ⟨c, e⟩ => ⟨.bang (.var 0), trivial, by rw [e]; exact .mp (.ax (.chk _ _)) (.hyp (e ▸ m))⟩
| ax h => exact ⟨.cst 0, trivial, .cn 0 h⟩
| cn c h => exact ⟨.bang (.cst c), trivial, .mp (.ax (.chk _ _)) (.cn c h)⟩
| mp _ _ ih1 ih2 => exact match ih1, ih2 with
| ⟨t1, u1, d1⟩, ⟨t2, u2, d2⟩ => ⟨.app t1 t2, ⟨u1, u2⟩, .mp (.mp (.ax (.app _ _ _ _)) d1) d2⟩
/-! ## summands -/
inductive Smd (t : JT) : JT → Prop where
| self : Smd t t
| l {a : JT} (b : JT) : Smd t a → Smd t (.sum a b)
| r (a : JT) {b : JT} : Smd t b → Smd t (.sum a b)
theorem smd_trans {t a b : JT} (h1 : Smd t a) (h2 : Smd a b) : Smd t b := by
induction h2 with
| self => exact h1
| l c _ ih => exact .l c ih
| r c _ ih => exact .r c ih
theorem smd_sub (s : JT) {t a : JT} (h : Smd t a) : Smd (tsub s t) (tsub s a) := by
induction h with
| self => exact .self
| l b _ ih => exact .l _ ih
| r a _ ih => exact .r _ ih
theorem smd_der {t a : JT} (h : Smd t a) (H : List JF) (c : JF) : Der H (.imp (.pf t c) (.pf a c)) := by
induction h with
| self => exact der_id H _
| l b _ ih => exact .mp (.mp (.ax (.s _ _ _)) (.mp (.ax (.k _ _)) (.ax (.sumL _ b c)))) ih
| r a _ ih => exact .mp (.mp (.ax (.s _ _ _)) (.mp (.ax (.k _ _)) (.ax (.sumR a _ c)))) ih
end RZ
end Found
#print axioms Found.RZ.der_weak
#print axioms Found.RZ.deduction
#print axioms Found.RZ.by_contra
#print axioms Found.RZ.der_sub
#print axioms Found.RZ.tsub_tsub
#print axioms Found.RZ.tsub_ufree
#print axioms Found.RZ.lifting
#print axioms Found.RZ.smd_trans
#print axioms Found.RZ.smd_sub
#print axioms Found.RZ.smd_der
lean_all/found/Realz3.lean
/-
T178, realization, part 3. found/Realz3 — Artemov's realization theorem
S4 → LP and the forgetful projection LP → S4:
* the realization with parameter P: every negative □ becomes x:· (one
variable x), every positive □ becomes P:· ;
* a cut-free S4 sequent Γ ⇒ Δ is realized when LP derives ⊥ from the
realized Γ and the negations of the realized Δ;
* by induction on cut-free derivations, with a provisional variable u
inside P: at each □R the premise is lifted to a u-free polynomial t, and
u is replaced by t + u (substitution keeps all derivations), so the
positive term keeps every lifted t as a summand;
* realization theorem: every S4 theorem A has a realization A^r provable
in LP; forgetful projection: every LP theorem forgets to an S4 theorem;
hence S4 ⊢ A iff some realization of A is an LP theorem.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Realz2
namespace Found
namespace RZ
/-! ## the realization -/
mutual
def rp (P : JT) : MF → JF
| .atom n => .atom n
| .bot => .bot
| .imp a b => .imp (rn P a) (rp P b)
| .box a => .pf P (rp P a)
def rn (P : JT) : MF → JF
| .atom n => .atom n
| .bot => .bot
| .imp a b => .imp (rp P a) (rn P b)
| .box a => .pf (.var 0) (rn P a)
end
theorem sub_r (s P : JT) : (A : MF) → fsub s (rp P A) = rp (tsub s P) A ∧ fsub s (rn P A) = rn (tsub s P) A
| .atom _ => ⟨rfl, rfl⟩
| .bot => ⟨rfl, rfl⟩
| .imp a b => by
refine ⟨?_, ?_⟩
· show JF.imp (fsub s (rn P a)) (fsub s (rp P b)) = JF.imp (rn (tsub s P) a) (rp (tsub s P) b)
rw [(sub_r s P a).2, (sub_r s P b).1]
· show JF.imp (fsub s (rp P a)) (fsub s (rn P b)) = JF.imp (rp (tsub s P) a) (rn (tsub s P) b)
rw [(sub_r s P a).1, (sub_r s P b).2]
| .box a => by
refine ⟨?_, ?_⟩
· show JF.pf (tsub s P) (fsub s (rp P a)) = JF.pf (tsub s P) (rp (tsub s P) a)
rw [(sub_r s P a).1]
· show JF.pf (.var 0) (fsub s (rn P a)) = JF.pf (.var 0) (rn (tsub s P) a)
rw [(sub_r s P a).2]
def RN (P : JT) : List MF → List JF
| [] => []
| a :: l => rn P a :: RN P l
def NP (P : JT) : List MF → List JF
| [] => []
| a :: l => jneg (rp P a) :: NP P l
def japp : List JF → List JF → List JF
| [], k => k
| a :: l, k => a :: japp l k
/-- the hypotheses realizing a sequent -/
def hl (P : JT) (Γ Δ : List MF) : List JF := japp (RN P Γ) (NP P Δ)
theorem mem_japp_l {x : JF} : {l : List JF} → (k : List JF) → x ∈ l → x ∈ japp l k
| _ :: _, _, .head _ => .head _
| _ :: _, k, .tail _ m => .tail _ (mem_japp_l k m)
theorem mem_japp_r {x : JF} : (l : List JF) → {k : List JF} → x ∈ k → x ∈ japp l k
| [], _, m => m
| _ :: l, _, m => .tail _ (mem_japp_r l m)
theorem mem_japp_inv {x : JF} : (l : List JF) → {k : List JF} → x ∈ japp l k → x ∈ l ∨ x ∈ k
| [], _, m => .inr m
| _ :: l, _, m => by
cases m with
| head => exact .inl (.head _)
| tail _ m' => exact (mem_japp_inv l m').elim (fun h => .inl (.tail _ h)) .inr
theorem mem_RN (P : JT) {a : MF} : {Γ : List MF} → a ∈ Γ → rn P a ∈ RN P Γ
| _ :: _, .head _ => .head _
| _ :: _, .tail _ m => .tail _ (mem_RN P m)
theorem mem_NP (P : JT) {a : MF} : {Δ : List MF} → a ∈ Δ → jneg (rp P a) ∈ NP P Δ
| _ :: _, .head _ => .head _
| _ :: _, .tail _ m => .tail _ (mem_NP P m)
theorem RN_inv (P : JT) {x : JF} : (Γ : List MF) → x ∈ RN P Γ → ∃ a, a ∈ Γ ∧ x = rn P a
| [], m => nomatch m
| b :: l, m => by
cases m with
| head => exact ⟨b, .head _, rfl⟩
| tail _ m' => exact match RN_inv P l m' with | ⟨a, h, e⟩ => ⟨a, .tail _ h, e⟩
theorem mapF_japp (s : JT) : (l k : List JF) → mapF s (japp l k) = japp (mapF s l) (mapF s k)
| [], _ => rfl
| _ :: l, k => congrArg (List.cons _) (mapF_japp s l k)
theorem mapF_RN (s P : JT) : (Γ : List MF) → mapF s (RN P Γ) = RN (tsub s P) Γ
| [] => rfl
| a :: l => by
show fsub s (rn P a) :: mapF s (RN P l) = rn (tsub s P) a :: RN (tsub s P) l
rw [(sub_r s P a).2, mapF_RN s P l]
theorem mapF_NP (s P : JT) : (Δ : List MF) → mapF s (NP P Δ) = NP (tsub s P) Δ
| [] => rfl
| a :: l => by
show JF.imp (fsub s (rp P a)) .bot :: mapF s (NP P l) = JF.imp (rp (tsub s P) a) .bot :: NP (tsub s P) l
rw [(sub_r s P a).1, mapF_NP s P l]
theorem mapF_hl (s P : JT) (Γ Δ : List MF) : mapF s (hl P Γ Δ) = hl (tsub s P) Γ Δ := by
unfold hl
rw [mapF_japp, mapF_RN, mapF_NP]
theorem hl_sub {P : JT} {Γ Γ' Δ Δ' : List MF} (s1 : Sub Γ Γ') (s2 : Sub Δ Δ') : JSub (hl P Γ Δ) (hl P Γ' Δ') :=
fun x m => (mem_japp_inv _ m).elim
(fun h => match RN_inv P _ h with
| ⟨a, ha, e⟩ => e ▸ mem_japp_l _ (mem_RN P (s1 _ ha)))
(fun h => mem_japp_r _ (nps _ h s2))
where
nps {x : JF} : (Δ0 : List MF) → x ∈ NP P Δ0 → Sub Δ0 Δ' → x ∈ NP P Δ'
| [], m, _ => nomatch m
| _ :: l, m, s => by
cases m with
| head => exact mem_NP P (s _ (.head _))
| tail _ m' => exact nps l m' (fun y my => s y (.tail _ my))
def U : JT := .var 1
theorem tsub_U (t : JT) : tsub t U = t := rfl
theorem tsub_by_U : (t : JT) → tsub U t = t
| .var 1 => rfl
| .var 0 => rfl
| .var (_ + 2) => rfl
| .cst _ => rfl
| .app a b => by show JT.app _ _ = _; rw [tsub_by_U a, tsub_by_U b]
| .sum a b => by show JT.sum _ _ = _; rw [tsub_by_U a, tsub_by_U b]
| .bang a => by show JT.bang _ = _; rw [tsub_by_U a]
/-- realized by the positive term P' -/
def Rz (P' : JT) (Γ Δ : List MF) : Prop := Der (hl P' Γ Δ) .bot
theorem rz_sub (s : JT) {P' : JT} {Γ Δ : List MF} (h : Rz P' Γ Δ) : Rz (tsub s P') Γ Δ := by
have := der_sub s h
rw [mapF_hl] at this
exact this
theorem xhyp_bx (P : JT) (Γ : List MF) : XHyp (RN P (bx Γ)) := fun h m =>
match RN_inv P _ m with
| ⟨a, ha, e⟩ => match bx_mem Γ ha with
| ⟨_, c, ec⟩ => by subst ec; exact ⟨rn P c, e⟩
/-- the realization of cut-free derivations -/
theorem realize {Γ Δ : List MF} (d : G Γ Δ) : ∀ P : JT, Smd U P → ∃ Q, Smd U Q ∧ Rz (tsub Q P) Γ Δ := by
induction d with
| @ax Γ Δ n h1 h2 =>
intro P _
exact ⟨U, .self, .mp (.hyp (mem_japp_r _ (mem_NP _ h2))) (.hyp (mem_japp_l _ (mem_RN _ h1)))⟩
| botL h =>
intro P _
exact ⟨U, .self, .hyp (mem_japp_l _ (mem_RN _ h))⟩
| @impL Γ Δ a b h _ _ ih1 ih2 =>
intro P hP
match ih1 P hP with
| ⟨Q1, hQ1, r1⟩ =>
match ih2 (tsub Q1 P) (smd_trans hQ1 (smd_sub Q1 hP)) with
| ⟨Q2, hQ2, r2⟩ =>
refine ⟨tsub Q2 Q1, smd_trans hQ2 (smd_sub Q2 hQ1), ?_⟩
rw [← tsub_tsub]
have r1' := rz_sub Q2 r1
-- H ⊢ rp a, from H, ¬ rp a ⊢ ⊥
have da : Der (hl (tsub Q2 (tsub Q1 P)) Γ Δ) (rp (tsub Q2 (tsub Q1 P)) a) :=
by_contra (der_weak r1' (fun x (m : x ∈ hl (tsub Q2 (tsub Q1 P)) Γ (a :: Δ)) => (mem_japp_inv _ m).elim
(fun h => .tail _ (mem_japp_l _ h))
(fun h => by
cases h with
| head => exact .head _
| tail _ m' => exact .tail _ (mem_japp_r _ m'))))
have db : Der (hl (tsub Q2 (tsub Q1 P)) Γ Δ) (.imp (rn (tsub Q2 (tsub Q1 P)) b) .bot) := deduction r2
exact .mp db (.mp (.hyp (mem_japp_l _ (mem_RN _ h))) da)
| @impR Γ Δ a b h _ ih =>
intro P hP
match ih P hP with
| ⟨Q, hQ, r⟩ =>
refine ⟨Q, hQ, ?_⟩
have js : JSub (hl (tsub Q P) (a :: Γ) (b :: Δ))
(jneg (rp (tsub Q P) b) :: rn (tsub Q P) a :: hl (tsub Q P) Γ Δ) := by
intro x m
cases m with
| head => exact .tail _ (.head _)
| tail _ m' =>
cases mem_japp_inv _ m' with
| inl h1 => exact .tail _ (.tail _ (mem_japp_l _ h1))
| inr h2 =>
cases h2 with
| head => exact .head _
| tail _ m'' => exact .tail _ (.tail _ (mem_japp_r _ m''))
have d1 : Der (rn (tsub Q P) a :: hl (tsub Q P) Γ Δ) (rp (tsub Q P) b) := by_contra (der_weak r js)
exact .mp (.hyp (mem_japp_r _ (mem_NP _ h))) (deduction d1)
| @boxL Γ Δ a h _ ih =>
intro P hP
match ih P hP with
| ⟨Q, hQ, r⟩ =>
refine ⟨Q, hQ, ?_⟩
have hb : JF.pf (.var 0) (rn (tsub Q P) a) ∈ hl (tsub Q P) Γ Δ := mem_japp_l _ (mem_RN _ h)
exact .mp (deduction r) (.mp (.ax (.refl _ _)) (.hyp hb))
| @boxR Γ Δ a h _ ih =>
intro P hP
match ih P hP with
| ⟨Q', hQ', r⟩ =>
-- RN (bx Γ) ⊢ rp a
have d0 : Der (RN (tsub Q' P) (bx Γ)) (rp (tsub Q' P) a) :=
by_contra (der_weak r (fun x (m : x ∈ hl (tsub Q' P) (bx Γ) [a]) => (mem_japp_inv _ m).elim
(fun h => .tail _ h)
(fun h => by
cases h with
| head => exact .head _
| tail _ m' => exact nomatch m')))
match lifting (xhyp_bx _ Γ) d0 with
| ⟨t, ht, dt⟩ =>
let s : JT := .sum t U
have hPs : Smd t (tsub s (tsub Q' P)) :=
smd_trans (.l U .self) (smd_sub s (smd_trans hQ' (smd_sub Q' hP)))
refine ⟨tsub s Q', smd_trans (.r t .self) (smd_sub s hQ'), ?_⟩
rw [← tsub_tsub]
have dt' := der_sub s dt
rw [mapF_RN] at dt'
have e : fsub s (JF.pf t (rp (tsub Q' P) a)) = JF.pf t (rp (tsub s (tsub Q' P)) a) := by
show JF.pf (tsub s t) (fsub s (rp (tsub Q' P) a)) = _
rw [tsub_ufree s t ht, (sub_r s _ a).1]
rw [e] at dt'
have dP := Der.mp (smd_der hPs _ _) dt'
exact .mp (.hyp (mem_japp_r _ (mem_NP _ h)))
(der_weak dP (fun x m => match RN_inv _ _ m with
| ⟨c, hc, ec⟩ => ec ▸ mem_japp_l _ (mem_RN _ (bx_sub Γ _ hc))))
/-! ## the realization theorem and the forgetful projection -/
/-- Artemov's realization theorem: every S4 theorem has a realization that is an LP theorem
(negative boxes realized by the variable x, positive boxes by one polynomial) -/
theorem realization {A : MF} (h : HS4 A) : ∃ P, Der [] (rp P A) :=
match realize (hs4_g h) U .self with
| ⟨Q, _, r⟩ => ⟨tsub Q U, by_contra r⟩
def forget : JF → MF
| .atom n => .atom n
| .bot => .bot
| .imp a b => .imp (forget a) (forget b)
| .pf _ a => .box (forget a)
theorem forget_r (P : JT) : (A : MF) → forget (rp P A) = A ∧ forget (rn P A) = A
| .atom _ => ⟨rfl, rfl⟩
| .bot => ⟨rfl, rfl⟩
| .imp a b => by
refine ⟨?_, ?_⟩
· show MF.imp (forget (rn P a)) (forget (rp P b)) = _
rw [(forget_r P a).2, (forget_r P b).1]
· show MF.imp (forget (rp P a)) (forget (rn P b)) = _
rw [(forget_r P a).1, (forget_r P b).2]
| .box a => by
refine ⟨?_, ?_⟩
· show MF.box (forget (rp P a)) = _
rw [(forget_r P a).1]
· show MF.box (forget (rn P a)) = _
rw [(forget_r P a).2]
theorem hs4_id (a : MF) : HS4 (.imp a a) := .mp (.mp (.s a (.imp a a) a) (.k a (.imp a a))) (.k a a)
theorem lax_forget {φ : JF} (h : LAx φ) : HS4 (forget φ) := by
cases h with
| k => exact .k _ _
| s => exact .s _ _ _
| dne => exact .dne _
| app => exact .kb _ _
| sumL => exact hs4_id _
| sumR => exact hs4_id _
| refl => exact .t _
| chk => exact .four _
/-- the forgetful projection: LP theorems forget to S4 theorems -/
theorem der_forget {φ : JF} (d : Der [] φ) : HS4 (forget φ) := by
induction d with
| hyp m => exact nomatch m
| ax h => exact lax_forget h
| cn _ h => exact .nec (lax_forget h)
| mp _ _ ih1 ih2 => exact .mp ih1 ih2
/-- S4 is the forgetful projection of LP -/
theorem s4_iff_lp (A : MF) : HS4 A ↔ ∃ P, Der [] (rp P A) :=
⟨realization, fun ⟨P, d⟩ => (forget_r P A).1 ▸ der_forget d⟩
end RZ
end Found
#print axioms Found.RZ.sub_r
#print axioms Found.RZ.hl_sub
#print axioms Found.RZ.mapF_hl
#print axioms Found.RZ.rz_sub
#print axioms Found.RZ.realize
#print axioms Found.RZ.realization
#print axioms Found.RZ.forget_r
#print axioms Found.RZ.der_forget
#print axioms Found.RZ.s4_iff_lp
lean_all/found/Recursive.lean
/-
T81. found/Recursive — recursive functions as a point: primitive
recursion is the core's induction (T59 fold on ℕ), μ is unbounded search.
* PR terms on argument lists; evaluation by structural recursion
(so every primitive recursive function is total).
* Example: addition is primitive recursive and evaluates to +.
* μ-recursion as a graph relation: the least zero; the graph is
deterministic.
Turing / register machines and the equivalences (T82, T145) are lines.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Rec
inductive PR where
| zero : PR
| succ : PR
| proj : Nat → PR
| comp : PR → List PR → PR
| prec : PR → PR → PR
def nth : List Nat → Nat → Nat
| [], _ => 0
| a :: _, 0 => a
| _ :: l, n + 1 => nth l n
def precIter (F G : List Nat → Nat) : Nat → List Nat → Nat
| 0, rest => F rest
| n + 1, rest => G (n :: precIter F G n rest :: rest)
mutual
def eval : PR → List Nat → Nat
| .zero, _ => 0
| .succ, args => nth args 0 + 1
| .proj i, args => nth args i
| .comp f gs, args => eval f (evalList gs args)
| .prec f g, args => match args with
| [] => eval f []
| n :: rest => precIter (eval f) (eval g) n rest
def evalList : List PR → List Nat → List Nat
| [], _ => []
| g :: gs, args => eval g args :: evalList gs args
end
/-- addition: add(0, y) = y, add(n+1, y) = succ(add(n, y)) -/
def addPR : PR := .prec (.proj 0) (.comp .succ [.proj 1])
theorem add_correct (y : Nat) : ∀ n, eval addPR [n, y] = n + y
| 0 => (Nat.zero_add y).symm
| n + 1 => by
show precIter (eval (.proj 0)) (eval (.comp .succ [.proj 1])) (n + 1) [y] = n + 1 + y
show precIter (eval (.proj 0)) (eval (.comp .succ [.proj 1])) n [y] + 1 = _
have ih : precIter (eval (.proj 0)) (eval (.comp .succ [.proj 1])) n [y] = n + y := add_correct y n
rw [ih, Nat.succ_add]
/-- μ: the least n with f(n :: args) = 0 -/
def MuGraph (f : PR) (args : List Nat) (n : Nat) : Prop :=
eval f (n :: args) = 0 ∧ ∀ m, m < n → eval f (m :: args) ≠ 0
theorem lt_or_ge' : (a b : Nat) → a < b ∨ b ≤ a
| 0, 0 => Or.inr (Nat.le_refl 0)
| 0, _ + 1 => Or.inl (Nat.succ_pos _)
| _ + 1, 0 => Or.inr (Nat.zero_le _)
| a + 1, b + 1 => (lt_or_ge' a b).elim (fun h => Or.inl (Nat.succ_lt_succ h)) (fun h => Or.inr (Nat.succ_le_succ h))
theorem le_antisymm' {a b : Nat} (h : a ≤ b) (k : b ≤ a) : a = b := Nat.le_antisymm h k
/-- the μ-graph is deterministic -/
theorem mu_det (f : PR) (args : List Nat) (n n' : Nat) (h : MuGraph f args n) (h' : MuGraph f args n') : n = n' :=
(lt_or_ge' n n').elim (fun lt => (h'.2 n lt h.1).elim)
(fun ge => (lt_or_ge' n' n).elim (fun lt => (h.2 n' lt h'.1).elim) (fun ge' => le_antisymm' ge' ge))
end Rec
end Found
#print axioms Found.Rec.eval
#print axioms Found.Rec.add_correct
#print axioms Found.Rec.lt_or_ge'
#print axioms Found.Rec.mu_det
lean_all/found/Refl1.lean
/-
Shared tool R1 (reflection), meta point. found/Refl1 — the cumulative
hierarchy on Aczel's trees V (found/Mostowski), indexed by trees used as
ordinals (only their rank matters):
* Vlev (sup I f) = ⋃ᵢ P(Vlev (f i));
* membership in a level: x ∈ Vlev (sup I f) iff x ⊆ Vlev (f i) for some i;
* every level is transitive, levels of children are included in the level
of the parent, every set is included in its own level, and every set is
a member of the level of its singleton.
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: impredicative Prop (power sets of trees).
-/
import found.IZF
namespace Found
namespace RF
open WF
universe u
/-- x ⊆ y -/
def Subs (x y : V.{u}) : Prop := ∀ z, Mem z x → Mem z y
/-- the cumulative hierarchy -/
def Vlev : V.{u} → V.{u}
| .sup I f => IZF.union (.sup I (fun i => IZF.power (Vlev (f i))))
theorem mem_Vlev (I : Type u) (f : I → V.{u}) (x : V.{u}) :
Mem x (Vlev (.sup I f)) ↔ ∃ i, Subs x (Vlev (f i)) :=
⟨fun h => match (IZF.union_spec _ x).1 h with
| ⟨_, ⟨i, e⟩, hx⟩ => ⟨i, (IZF.power_spec _ x).1 (mem_resp_right hx e)⟩,
fun ⟨i, hs⟩ => (IZF.union_spec _ x).2 ⟨IZF.power (Vlev (f i)), ⟨i, eq_refl _⟩, (IZF.power_spec _ x).2 hs⟩⟩
theorem subs_resp {x x' y : V.{u}} (e : Eq' x x') (h : Subs x y) : Subs x' y := fun z m =>
h z (mem_resp_right m (eq_symm _ _ e))
/-- every level is transitive -/
theorem trans_Vlev : (b : V.{u}) → ∀ x y, Mem y x → Mem x (Vlev b) → Mem y (Vlev b)
| .sup I f, x, y, hy, hx => match (mem_Vlev I f x).1 hx with
| ⟨i, hs⟩ =>
have hyi : Mem y (Vlev (f i)) := hs y hy
(mem_Vlev I f y).2 ⟨i, fun z hz => trans_Vlev (f i) y z hz hyi⟩
/-- the level of a child is included in the level of the parent -/
theorem child_sub (I : Type u) (f : I → V.{u}) (i : I) : Subs (Vlev (f i)) (Vlev (.sup I f)) := fun y hy =>
(mem_Vlev I f y).2 ⟨i, fun z hz => trans_Vlev (f i) y z hz hy⟩
/-- every set is included in its level -/
theorem sub_Vlev : (x : V.{u}) → Subs x (Vlev x)
| .sup I f => fun z ⟨i, e⟩ => (mem_Vlev I f z).2 ⟨i, subs_resp (eq_symm _ _ e) (sub_Vlev (f i))⟩
/-- the singleton tree {y} -/
def sgl (y : V.{u}) : V.{u} := .sup PUnit (fun _ => y)
theorem mem_sgl_lev (y : V.{u}) : Mem y (Vlev (sgl y)) := (mem_Vlev PUnit _ y).2 ⟨⟨⟩, sub_Vlev y⟩
/-- membership in a level is invariant under bisimilarity of the member -/
theorem lev_resp {x x' b : V.{u}} (e : Eq' x x') (h : Mem x (Vlev b)) : Mem x' (Vlev b) := mem_resp_left e h
end RF
end Found
#print axioms Found.RF.mem_Vlev
#print axioms Found.RF.trans_Vlev
#print axioms Found.RF.child_sub
#print axioms Found.RF.sub_Vlev
#print axioms Found.RF.mem_sgl_lev
lean_all/found/Refl2.lean
/-
Shared tool R2 (reflection), meta point. found/Refl2 — the Lévy–Montague
reflection theorem for Aczel's universe V = V.{0} (the sets of the
universe-hierarchy point), in the classical point with choice at the
level of V:
* V as a structure for the language ∈ (membership atoms);
* relativised satisfaction to a class C, and the Tarski–Vaught criterion:
if C has witnesses for the quantified subformulas, relativised and
absolute truth agree on C;
* the closure construction: α₀ = β, αₙ₊₁ collects α_n and a chosen witness
(a singleton tree) for every quantified subformula and every tuple of
parameters from V_{αₙ} (tuples are indexed by the small index types of the
levels), α = sup αₙ;
* reflection: for every finite list of L0 formulas there is α (above any
given β) with V_α ≺ V for these formulas.
Lean 4 core only, hand-written proofs, no axioms.
Classical point: excluded middle and choice on Type (K) and choice on
Type 1 (K1), as parameters.
CIC dependence: impredicative Prop (power sets in the levels).
-/
import found.Refl1
import found.NbgZ4
namespace Found
namespace RF
open WF FO FOCT NBGc
/-- choice at the level of V.{0} -/
structure Classical1 where
ch1 : ∀ {α : Type 1} (P : α → Prop), (∃ x, P x) → α
ch1_spec : ∀ {α : Type 1} (P : α → Prop) (h : ∃ x, P x), P (ch1 P h)
ch1_ext : ∀ {α : Type 1} (P Q : α → Prop) (h : ∃ x, P x) (h' : ∃ x, Q x), (∀ x, P x ↔ Q x) → ch1 P h = ch1 Q h'
/-- V as a structure for ∈ -/
def RV : Nat → List V.{0} → Prop
| 0, [] => False
| 0, [_] => False
| 0, [a, b] => Mem a b
| 0, _ :: _ :: _ :: _ => False
| _ + 1, _ => False
/-! ## invariance and agreement for V -/
theorem ext_eq {v w : Nat → V.{0}} (h : ∀ n, Eq' (v n) (w n)) (d : V.{0}) : ∀ n, Eq' (ext v d n) (ext w d n)
| 0 => eq_refl d
| n + 1 => h n
theorem sat_eqV : (φ : Fm) → L0 φ → {v w : Nat → V.{0}} → (∀ n, Eq' (v n) (w n)) → Sat RV φ v → Sat RV φ w
| .atom _ _, hl, v, w, h, s => match hl with
| ⟨e0, a, b, e⟩ => by
subst e0; subst e
exact mem_resp_right (mem_resp_left (h a) s) (h b)
| .bot, _, _, _, _, s => s
| .conj a b, hl, _, _, h, s => ⟨sat_eqV a hl.1 h s.1, sat_eqV b hl.2 h s.2⟩
| .disj a b, hl, _, _, h, s => s.elim (fun x => Or.inl (sat_eqV a hl.1 h x)) (fun y => Or.inr (sat_eqV b hl.2 h y))
| .imp a b, hl, _, _, h, s => fun x => sat_eqV b hl.2 h (s (sat_eqV a hl.1 (fun n => eq_symm _ _ (h n)) x))
| .all a, hl, _, _, h, s => fun d => sat_eqV a hl (ext_eq h d) (s d)
| .ex a, hl, _, _, h, s => match s with
| ⟨d, x⟩ => ⟨d, sat_eqV a hl (ext_eq h d) x⟩
theorem mapD_agreeU {D : Type _} {k : Nat} {v w : Nat → D} (h : ∀ n, n < k → v n = w n) :
(l : List Nat) → AllLt k l → mapD v l = mapD w l
| [], _ => rfl
| a :: l, hl => by
show v a :: mapD v l = w a :: mapD w l
rw [h a hl.1, mapD_agreeU h l hl.2]
theorem ext_agreeU {D : Type _} {k : Nat} {v w : Nat → D} (h : ∀ n, n < k → v n = w n) (d : D) :
∀ n, n < k + 1 → ext v d n = ext w d n
| 0, _ => rfl
| n + 1, hn => h n (Nat.lt_of_succ_lt_succ hn)
theorem sat_agreeU {D : Type _} (R : Nat → List D → Prop) : (φ : Fm) → (k : Nat) → FV k φ →
{v w : Nat → D} → (∀ n, n < k → v n = w n) → Sat R φ v → Sat R φ w
| .atom r l, _, hf, _, _, h, s => by
show R r (mapD _ l)
rw [← mapD_agreeU h l hf]
exact s
| .bot, _, _, _, _, _, s => s
| .conj a b, k, hf, _, _, h, s => ⟨sat_agreeU R a k hf.1 h s.1, sat_agreeU R b k hf.2 h s.2⟩
| .disj a b, k, hf, _, _, h, s => s.elim (fun x => Or.inl (sat_agreeU R a k hf.1 h x))
(fun y => Or.inr (sat_agreeU R b k hf.2 h y))
| .imp a b, k, hf, _, _, h, s => fun x =>
sat_agreeU R b k hf.2 h (s (sat_agreeU R a k hf.1 (fun n hn => (h n hn).symm) x))
| .all a, k, hf, _, _, h, s => fun d => sat_agreeU R a (k + 1) hf (ext_agreeU h d) (s d)
| .ex a, k, hf, _, _, h, s => match s with
| ⟨d, x⟩ => ⟨d, sat_agreeU R a (k + 1) hf (ext_agreeU h d) x⟩
/-! ## free-variable bound -/
theorem allLt_of {k : Nat} : (l : List Nat) → (∀ a, a ∈ l → a < k) → AllLt k l
| [], _ => trivial
| a :: l, h => ⟨h a (.head _), allLt_of l (fun b m => h b (.tail _ m))⟩
theorem allLt_mono {k k' : Nat} (hk : k ≤ k') : (l : List Nat) → AllLt k l → AllLt k' l
| [], _ => trivial
| _ :: l, h => ⟨Nat.lt_of_lt_of_le h.1 hk, allLt_mono hk l h.2⟩
theorem fv_mono : (φ : Fm) → {k k' : Nat} → k ≤ k' → FV k φ → FV k' φ
| .atom _ l, _, _, hk, h => allLt_mono hk l h
| .bot, _, _, _, _ => trivial
| .conj a b, _, _, hk, h => ⟨fv_mono a hk h.1, fv_mono b hk h.2⟩
| .disj a b, _, _, hk, h => ⟨fv_mono a hk h.1, fv_mono b hk h.2⟩
| .imp a b, _, _, hk, h => ⟨fv_mono a hk h.1, fv_mono b hk h.2⟩
| .all a, _, _, hk, h => fv_mono a (Nat.succ_le_succ hk) h
| .ex a, _, _, hk, h => fv_mono a (Nat.succ_le_succ hk) h
theorem fv_bound : (φ : Fm) → FV (bound φ) φ
| .atom _ l => allLt_of l (fun _ m => Nat.lt_succ_of_le (le_sumN l m))
| .bot => trivial
| .conj a b => ⟨fv_mono a (Nat.le_add_right _ _) (fv_bound a), fv_mono b (Nat.le_add_left _ _) (fv_bound b)⟩
| .disj a b => ⟨fv_mono a (Nat.le_add_right _ _) (fv_bound a), fv_mono b (Nat.le_add_left _ _) (fv_bound b)⟩
| .imp a b => ⟨fv_mono a (Nat.le_add_right _ _) (fv_bound a), fv_mono b (Nat.le_add_left _ _) (fv_bound b)⟩
| .all a => fv_mono a (Nat.le_succ _) (fv_bound a)
| .ex a => fv_mono a (Nat.le_succ _) (fv_bound a)
/-! ## relativised satisfaction and Tarski–Vaught -/
def SatC (C : V.{0} → Prop) : Fm → (Nat → V.{0}) → Prop
| .atom r l, v => RV r (mapD v l)
| .bot, _ => False
| .conj a b, v => SatC C a v ∧ SatC C b v
| .disj a b, v => SatC C a v ∨ SatC C b v
| .imp a b, v => SatC C a v → SatC C b v
| .all a, v => ∀ d, C d → SatC C a (ext v d)
| .ex a, v => ∃ d, C d ∧ SatC C a (ext v d)
/-- witnesses in C for the quantified subformulas -/
def HasW (C : V.{0} → Prop) (b : Fm) : Prop :=
∀ v : Nat → V.{0}, (∀ n, C (v n)) → (∃ d, Sat RV b (ext v d)) → ∃ d, C d ∧ Sat RV b (ext v d)
def Wit (C : V.{0} → Prop) : Fm → Prop
| .atom _ _ => True
| .bot => True
| .conj a b => Wit C a ∧ Wit C b
| .disj a b => Wit C a ∧ Wit C b
| .imp a b => Wit C a ∧ Wit C b
| .all a => Wit C a ∧ HasW C (neg a)
| .ex a => Wit C a ∧ HasW C a
theorem C_ext {C : V.{0} → Prop} {v : Nat → V.{0}} (h : ∀ n, C (v n)) {d : V.{0}} (hd : C d) : ∀ n, C (ext v d n)
| 0 => hd
| n + 1 => h n
/-- the Tarski–Vaught criterion -/
theorem tv (K : CP.Classical') (C : V.{0} → Prop) : (φ : Fm) → Wit C φ → ∀ v, (∀ n, C (v n)) →
(SatC C φ v ↔ Sat RV φ v)
| .atom _ _, _, _, _ => Iff.rfl
| .bot, _, _, _ => Iff.rfl
| .conj a b, w, v, h => ⟨fun s => ⟨(tv K C a w.1 v h).1 s.1, (tv K C b w.2 v h).1 s.2⟩,
fun s => ⟨(tv K C a w.1 v h).2 s.1, (tv K C b w.2 v h).2 s.2⟩⟩
| .disj a b, w, v, h => ⟨fun s => s.elim (fun x => Or.inl ((tv K C a w.1 v h).1 x)) (fun y => Or.inr ((tv K C b w.2 v h).1 y)),
fun s => s.elim (fun x => Or.inl ((tv K C a w.1 v h).2 x)) (fun y => Or.inr ((tv K C b w.2 v h).2 y))⟩
| .imp a b, w, v, h => ⟨fun s x => (tv K C b w.2 v h).1 (s ((tv K C a w.1 v h).2 x)),
fun s x => (tv K C b w.2 v h).2 (s ((tv K C a w.1 v h).1 x))⟩
| .all a, w, v, h =>
⟨fun s d => CP.dne K _ (fun hn => match w.2 v h ⟨d, hn⟩ with
| ⟨d', hd', hn'⟩ => hn' ((tv K C a w.1 (ext v d') (C_ext h hd')).1 (s d' hd'))),
fun s d hd => (tv K C a w.1 (ext v d) (C_ext h hd)).2 (s d)⟩
| .ex a, w, v, h =>
⟨fun ⟨d, hd, s⟩ => ⟨d, (tv K C a w.1 (ext v d) (C_ext h hd)).1 s⟩,
fun s => match w.2 v h s with
| ⟨d, hd, s'⟩ => ⟨d, hd, (tv K C a w.1 (ext v d) (C_ext h hd)).2 s'⟩⟩
end RF
end Found
#print axioms Found.RF.sat_eqV
#print axioms Found.RF.sat_agreeU
#print axioms Found.RF.fv_bound
#print axioms Found.RF.tv
lean_all/found/Refl3.lean
/-
Shared tool R2 (reflection), meta point, part 2. found/Refl3 — the closure
construction and the reflection theorem for Aczel's universe V.{0}:
* tuples of indices of a level, valuations read from them;
* the stage αₙ₊₁ = sup of αₙ and of a chosen witness for every listed
formula and every tuple of parameters from V_{αₙ};
* α = sup αₙ; V_α has witnesses for every listed formula;
* reflection: for every finite list of L0 formulas and every β there is
α with V_β ⊆ V_α such that, for parameters in V_α, each formula holds
relativised to V_α iff it holds in V.
Lean 4 core only, hand-written proofs, no axioms.
Classical point: K (Type) and K1 (choice on Type 1), as parameters.
CIC dependence: impredicative Prop (power sets in the levels).
-/
import found.Refl2
namespace Found
namespace RF
open WF FO FOCT NBGc
def Tup (I : Type) : Nat → Type
| 0 => PUnit
| k + 1 => I × Tup I k
def tvv {I : Type} (g : I → V.{0}) (d0 : V.{0}) : (k : Nat) → Tup I k → Nat → V.{0}
| 0, _, _ => d0
| _ + 1, t, 0 => g t.1
| k + 1, t, n + 1 => tvv g d0 k t.2 n
def mkTup {I : Type} (K : CP.Classical') : (k : Nat) → (P : Nat → I → Prop) → (∀ n, n < k → ∃ i, P n i) → Tup I k
| 0, _, _ => ⟨⟩
| k + 1, P, h => (K.ch (P 0) (h 0 (Nat.zero_lt_succ k)),
mkTup K k (fun n i => P (n + 1) i) (fun n hn => h (n + 1) (Nat.succ_lt_succ hn)))
theorem mkTup_spec {I : Type} (K : CP.Classical') (g : I → V.{0}) (d0 : V.{0}) : (k : Nat) → (v : Nat → V.{0}) →
(h : ∀ n, n < k → ∃ i, Eq' (v n) (g i)) →
∀ n, n < k → Eq' (v n) (tvv g d0 k (mkTup K k (fun n i => Eq' (v n) (g i)) h) n)
| 0, _, _, n, hn => absurd hn (Nat.not_lt_zero n)
| k + 1, v, h, 0, _ => K.ch_spec (fun i => Eq' (v 0) (g i)) (h 0 (Nat.zero_lt_succ k))
| k + 1, v, h, n + 1, hn =>
mkTup_spec K g d0 k (fun n => v (n + 1)) (fun n hn => h (n + 1) (Nat.succ_lt_succ hn)) n
(Nat.lt_of_succ_lt_succ hn)
def nthF : List Fm → Nat → Fm
| [], _ => .bot
| a :: _, 0 => a
| _ :: l, j + 1 => nthF l j
theorem nthF_of : {Ψ : List Fm} → {ψ : Fm} → ψ ∈ Ψ → ∃ j, nthF Ψ j = ψ
| _ :: _, _, .head _ => ⟨0, rfl⟩
| _ :: _, _, .tail _ m => match nthF_of m with | ⟨j, e⟩ => ⟨j + 1, e⟩
def vEmpty : V.{0} := .sup PEmpty (fun e => nomatch e)
def witP (ψ : Fm) (w : Nat → V.{0}) (y : V.{0}) : Prop := (∃ y', Sat RV ψ (ext w y')) → Sat RV ψ (ext w y)
theorem witP_ex (K : CP.Classical') (ψ : Fm) (w : Nat → V.{0}) : ∃ y, witP ψ w y :=
(K.lem (∃ y', Sat RV ψ (ext w y'))).elim (fun ⟨y', h⟩ => ⟨y', fun _ => h⟩)
(fun hn => ⟨vEmpty, fun h => (hn h).elim⟩)
section C
variable (K : CP.Classical') (K1 : Classical1) (Ψ : List Fm)
/-- the next stage -/
def next (β : V.{0}) : V.{0} :=
.sup (Option ((j : Nat) × Tup (Vlev β).I (bound (nthF Ψ j))))
(fun o => match o with
| none => β
| some ⟨j, t⟩ => sgl (K1.ch1 (witP (nthF Ψ j) (tvv (Vlev β).f β _ t)) (witP_ex K _ _)))
def stages (β0 : V.{0}) : Nat → V.{0}
| 0 => β0
| n + 1 => next K K1 Ψ (stages β0 n)
def top (β0 : V.{0}) : V.{0} := .sup Nat (fun n => stages K K1 Ψ β0 n)
variable (β0 : V.{0})
theorem stage_up (n : Nat) {x : V.{0}} (h : Subs x (Vlev (stages K K1 Ψ β0 n))) :
Mem x (Vlev (stages K K1 Ψ β0 (n + 1))) := (mem_Vlev _ _ x).2 ⟨none, h⟩
theorem stage_sub (n : Nat) : Subs (Vlev (stages K K1 Ψ β0 n)) (Vlev (stages K K1 Ψ β0 (n + 1))) :=
fun z h => stage_up K K1 Ψ β0 n (fun w hw => trans_Vlev _ z w hw h)
theorem stage_mono (n : Nat) : (m : Nat) → Subs (Vlev (stages K K1 Ψ β0 n)) (Vlev (stages K K1 Ψ β0 (n + m)))
| 0 => fun _ h => h
| m + 1 => fun z h => stage_sub K K1 Ψ β0 (n + m) z (stage_mono n m z h)
theorem to_top (n : Nat) : Subs (Vlev (stages K K1 Ψ β0 n)) (Vlev (top K K1 Ψ β0)) := child_sub Nat _ n
/-- finitely many members of V_α lie in a common stage -/
theorem common (v : Nat → V.{0}) (h : ∀ n, Mem (v n) (Vlev (top K K1 Ψ β0))) :
(k : Nat) → ∃ M, ∀ n, n < k → Mem (v n) (Vlev (stages K K1 Ψ β0 M))
| 0 => ⟨0, fun n hn => absurd hn (Nat.not_lt_zero n)⟩
| k + 1 => match common v h k, (mem_Vlev _ _ (v k)).1 (h k) with
| ⟨M, hM⟩, ⟨m, hm⟩ =>
⟨M + (m + 1), fun n hn => (Nat.lt_or_ge n k).elim
(fun hlt => stage_mono K K1 Ψ β0 M (m + 1) _ (hM n hlt))
(fun hge => by
have e : n = k := Nat.le_antisymm (Nat.le_of_lt_succ hn) hge
rw [e, Nat.add_comm M (m + 1)]
exact stage_mono K K1 Ψ β0 (m + 1) M _ (stage_up K K1 Ψ β0 m hm))⟩
theorem ext_agree_lt {D : Type _} {k : Nat} {v w : Nat → D} (h : ∀ n, n < k → v n = w n) (d : D) :
∀ n, n < k → ext v d n = ext w d n :=
fun n hn => ext_agreeU h d n (Nat.lt_succ_of_lt hn)
/-- the top stage has witnesses for every listed L0 formula -/
theorem top_wit {ψ : Fm} (hψ : ψ ∈ Ψ) (hl : L0 ψ) : HasW (fun x => Mem x (Vlev (top K K1 Ψ β0))) ψ := by
intro v hv hd
match nthF_of hψ with
| ⟨j, e⟩ =>
subst e
match common K K1 Ψ β0 v hv (bound (nthF Ψ j)), hd with
| ⟨M, hM⟩, ⟨d, hdv⟩ =>
let β := stages K K1 Ψ β0 M
let k := bound (nthF Ψ j)
let t := mkTup K k (fun n i => Eq' (v n) ((Vlev β).f i)) hM
let tv := tvv (Vlev β).f β k t
have hspec := mkTup_spec K (Vlev β).f β k v hM
let v' : Nat → V.{0} := fun n => match Nat.decLt n k with
| isTrue _ => tv n
| isFalse _ => v n
have hEq : ∀ n, Eq' (v n) (v' n) := fun n => by
show Eq' (v n) (match Nat.decLt n k with
| isTrue _ => tv n
| isFalse _ => v n)
match Nat.decLt n k with
| isTrue hn => exact hspec n hn
| isFalse _ => exact eq_refl _
have hAg : ∀ n, n < k → v' n = tv n := fun n hn => by
show (match Nat.decLt n k with
| isTrue _ => tv n
| isFalse _ => v n) = tv n
match Nat.decLt n k with
| isTrue _ => rfl
| isFalse h' => exact absurd hn h'
have hfv := fv_bound (nthF Ψ j)
have s1 : Sat RV (nthF Ψ j) (ext tv d) :=
sat_agreeU RV _ k hfv (ext_agree_lt hAg d) (sat_eqV _ hl (ext_eq hEq d) hdv)
let y := K1.ch1 (witP (nthF Ψ j) tv) (witP_ex K _ _)
have hy : Sat RV (nthF Ψ j) (ext tv y) := K1.ch1_spec (witP (nthF Ψ j) tv) (witP_ex K _ _) ⟨d, s1⟩
have s2 : Sat RV (nthF Ψ j) (ext v y) :=
sat_eqV _ hl (ext_eq (fun n => eq_symm _ _ (hEq n)) y)
(sat_agreeU RV _ k hfv (fun n hn => (ext_agree_lt hAg y n hn).symm) hy)
have hyM : Mem y (Vlev (stages K K1 Ψ β0 (M + 1))) :=
child_sub _ _ (some ⟨j, t⟩) y (mem_sgl_lev y)
exact ⟨y, to_top K K1 Ψ β0 (M + 1) y hyM, s2⟩
end C
/-! ## the reflection theorem -/
def lapp : List Fm → List Fm → List Fm
| [], k => k
| a :: l, k => a :: lapp l k
theorem mem_lapp_l {x : Fm} : {l : List Fm} → (k : List Fm) → x ∈ l → x ∈ lapp l k
| _ :: _, _, .head _ => .head _
| _ :: _, k, .tail _ m => .tail _ (mem_lapp_l k m)
theorem mem_lapp_r {x : Fm} : (l : List Fm) → {k : List Fm} → x ∈ k → x ∈ lapp l k
| [], _, m => m
| _ :: l, _, m => .tail _ (mem_lapp_r l m)
/-- the quantifier bodies (and negated bodies) of a formula -/
def qb : Fm → List Fm
| .atom _ _ => []
| .bot => []
| .conj a b => lapp (qb a) (qb b)
| .disj a b => lapp (qb a) (qb b)
| .imp a b => lapp (qb a) (qb b)
| .all a => neg a :: qb a
| .ex a => a :: qb a
def qbL : List Fm → List Fm
| [] => []
| φ :: l => lapp (qb φ) (qbL l)
theorem wit_of (C : V.{0} → Prop) : (φ : Fm) → (∀ ψ, ψ ∈ qb φ → HasW C ψ) → Wit C φ
| .atom _ _, _ => trivial
| .bot, _ => trivial
| .conj a b, h => ⟨wit_of C a (fun ψ m => h ψ (mem_lapp_l _ m)), wit_of C b (fun ψ m => h ψ (mem_lapp_r _ m))⟩
| .disj a b, h => ⟨wit_of C a (fun ψ m => h ψ (mem_lapp_l _ m)), wit_of C b (fun ψ m => h ψ (mem_lapp_r _ m))⟩
| .imp a b, h => ⟨wit_of C a (fun ψ m => h ψ (mem_lapp_l _ m)), wit_of C b (fun ψ m => h ψ (mem_lapp_r _ m))⟩
| .all a, h => ⟨wit_of C a (fun ψ m => h ψ (.tail _ m)), h _ (.head _)⟩
| .ex a, h => ⟨wit_of C a (fun ψ m => h ψ (.tail _ m)), h _ (.head _)⟩
theorem qb_l0 : (φ : Fm) → L0 φ → ∀ ψ, ψ ∈ qb φ → L0 ψ
| .atom _ _, _, _, m => nomatch m
| .bot, _, _, m => nomatch m
| .conj a b, h, ψ, m => lapp_cases (qb a) m (qb_l0 a h.1 ψ) (qb_l0 b h.2 ψ)
| .disj a b, h, ψ, m => lapp_cases (qb a) m (qb_l0 a h.1 ψ) (qb_l0 b h.2 ψ)
| .imp a b, h, ψ, m => lapp_cases (qb a) m (qb_l0 a h.1 ψ) (qb_l0 b h.2 ψ)
| .all a, h, ψ, m => by
cases m with
| head => exact ⟨h, trivial⟩
| tail _ m' => exact qb_l0 a h ψ m'
| .ex a, h, ψ, m => by
cases m with
| head => exact h
| tail _ m' => exact qb_l0 a h ψ m'
where
lapp_cases {x : Fm} {P : Prop} : (l : List Fm) → {k : List Fm} → x ∈ lapp l k → (x ∈ l → P) → (x ∈ k → P) → P
| [], _, m, _, g => g m
| _ :: l, _, m, f, g => by
cases m with
| head => exact f (.head _)
| tail _ m' => exact lapp_cases l m' (fun h => f (.tail _ h)) g
theorem mem_qbL {φ ψ : Fm} : {Φ : List Fm} → φ ∈ Φ → ψ ∈ qb φ → ψ ∈ qbL Φ
| _ :: _, .head _, m => mem_lapp_l _ m
| _ :: _, .tail _ m', m => mem_lapp_r _ (mem_qbL m' m)
/-- the Lévy–Montague reflection theorem for V.{0} -/
theorem reflection (K : CP.Classical') (K1 : Classical1) (Φ : List Fm) (hΦ : ∀ φ, φ ∈ Φ → L0 φ) (β0 : V.{0}) :
∃ α : V.{0}, Subs (Vlev β0) (Vlev α) ∧ ∀ φ, φ ∈ Φ → ∀ v : Nat → V.{0}, (∀ n, Mem (v n) (Vlev α)) →
(SatC (fun x => Mem x (Vlev α)) φ v ↔ Sat RV φ v) :=
⟨top K K1 (qbL Φ) β0, to_top K K1 (qbL Φ) β0 0, fun φ hφ v hv =>
tv K _ φ (wit_of _ φ (fun ψ m => top_wit K K1 (qbL Φ) β0 (mem_qbL hφ m) (qb_l0 φ (hΦ φ hφ) ψ m))) v hv⟩
end RF
end Found
#print axioms Found.RF.mkTup_spec
#print axioms Found.RF.common
#print axioms Found.RF.top_wit
#print axioms Found.RF.wit_of
#print axioms Found.RF.qb_l0
#print axioms Found.RF.reflection
lean_all/found/RegComp1.lean
/-
T207/T145 line μ-recursive → register machines, part 1. found/RegComp1 —
register (counter) machines in structured form: increment, decrement,
sequencing, and loops `while r ≠ 0 do p`, with big-step semantics on
stores ℕ → ℕ. Gadgets with their specifications and frame conditions:
clearing a register, and copying one register to another through a
scratch register (the source restored).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace RC
def bq : Nat → Nat → Bool
| 0, 0 => true
| 0, _ + 1 => false
| _ + 1, 0 => false
| a + 1, b + 1 => bq a b
theorem bq_self : (a : Nat) → bq a a = true
| 0 => rfl
| a + 1 => bq_self a
theorem bq_true : (a b : Nat) → bq a b = true → a = b
| 0, 0, _ => rfl
| 0, _ + 1, h => Bool.noConfusion h
| _ + 1, 0, h => Bool.noConfusion h
| a + 1, b + 1, h => congrArg (· + 1) (bq_true a b h)
theorem bq_ne (a b : Nat) (h : a ≠ b) : bq a b = false := by
cases e : bq a b with
| true => exact (h (bq_true a b e)).elim
| false => rfl
abbrev Store := Nat → Nat
def upd (s : Store) (r v : Nat) : Store := fun q => cond (bq q r) v (s q)
theorem upd_eq (s : Store) (r v : Nat) : upd s r v r = v := by
show cond (bq r r) v (s r) = v
rw [bq_self]
rfl
theorem upd_ne (s : Store) (r v q : Nat) (h : q ≠ r) : upd s r v q = s q := by
show cond (bq q r) v (s q) = s q
rw [bq_ne q r h]
rfl
inductive Prog where
| inc : Nat → Prog
| dec : Nat → Prog
| seq : Prog → Prog → Prog
| loop : Nat → Prog → Prog
inductive Run : Prog → Store → Store → Prop where
| inc {r s} : Run (.inc r) s (upd s r (s r + 1))
| dec {r s} : Run (.dec r) s (upd s r (s r - 1))
| seq {p q s t u} : Run p s t → Run q t u → Run (.seq p q) s u
| loopZ {r p s} : s r = 0 → Run (.loop r p) s s
| loopS {r p s t u} : s r ≠ 0 → Run p s t → Run (.loop r p) t u → Run (.loop r p) s u
/-! ## clearing -/
def clear (r : Nat) : Prog := .loop r (.dec r)
theorem clear_spec (r : Nat) : (n : Nat) → (s : Store) → s r = n →
∃ s', Run (clear r) s s' ∧ s' r = 0 ∧ ∀ q, q ≠ r → s' q = s q
| 0, s, h => ⟨s, .loopZ h, h, fun _ _ => rfl⟩
| n + 1, s, h =>
match clear_spec r n (upd s r (s r - 1)) (by rw [upd_eq, h]; rfl) with
| ⟨s', hr, h0, hf⟩ => ⟨s', .loopS (fun e => Nat.noConfusion (h.symm.trans e)) .dec hr, h0,
fun q hq => (hf q hq).trans (upd_ne s r _ q hq)⟩
theorem clear_ex (r : Nat) (s : Store) : ∃ s', Run (clear r) s s' ∧ s' r = 0 ∧ ∀ q, q ≠ r → s' q = s q :=
clear_spec r (s r) s rfl
/-! ## copying x to y through t -/
def mv3 (x y t : Nat) : Prog := .loop x (.seq (.dec x) (.seq (.inc y) (.inc t)))
def mvBack (x t : Nat) : Prog := .loop t (.seq (.dec t) (.inc x))
/-- the store after one round of mv3 -/
def S3 (s : Store) (x y t : Nat) : Store :=
upd (upd (upd s x (s x - 1)) y (upd s x (s x - 1) y + 1)) t (upd (upd s x (s x - 1)) y (upd s x (s x - 1) y + 1) t + 1)
theorem S3_x (s : Store) (x y t : Nat) (hxy : x ≠ y) (hxt : x ≠ t) : S3 s x y t x = s x - 1 := by
unfold S3; rw [upd_ne _ _ _ _ hxt, upd_ne _ _ _ _ hxy, upd_eq]
theorem S3_y (s : Store) (x y t : Nat) (hxy : x ≠ y) (hyt : y ≠ t) : S3 s x y t y = s y + 1 := by
unfold S3; rw [upd_ne _ _ _ _ hyt, upd_eq, upd_ne _ _ _ _ (fun e => hxy e.symm)]
theorem S3_t (s : Store) (x y t : Nat) (hxt : x ≠ t) (hyt : y ≠ t) : S3 s x y t t = s t + 1 := by
unfold S3; rw [upd_eq, upd_ne _ _ _ _ (fun e => hyt e.symm), upd_ne _ _ _ _ (fun e => hxt e.symm)]
theorem S3_o (s : Store) (x y t q : Nat) (qx : q ≠ x) (qy : q ≠ y) (qt : q ≠ t) : S3 s x y t q = s q := by
unfold S3; rw [upd_ne _ _ _ _ qt, upd_ne _ _ _ _ qy, upd_ne _ _ _ _ qx]
theorem mv3_spec (x y t : Nat) (hxy : x ≠ y) (hxt : x ≠ t) (hyt : y ≠ t) : (n : Nat) → (s : Store) → s x = n →
∃ s', Run (mv3 x y t) s s' ∧ s' x = 0 ∧ s' y = s y + n ∧ s' t = s t + n ∧
∀ q, q ≠ x → q ≠ y → q ≠ t → s' q = s q
| 0, s, h => ⟨s, .loopZ h, h, rfl, rfl, fun _ _ _ _ => rfl⟩
| n + 1, s, h => by
have r1 : Run (.seq (.dec x) (.seq (.inc y) (.inc t))) s (S3 s x y t) := .seq .dec (.seq .inc .inc)
have e3x : S3 s x y t x = n := by rw [S3_x s x y t hxy hxt, h]; rfl
match mv3_spec x y t hxy hxt hyt n (S3 s x y t) e3x with
| ⟨s', hr, h0, hy, ht, hf⟩ =>
refine ⟨s', .loopS (fun e => Nat.noConfusion (h.symm.trans e)) r1 hr, h0, ?_, ?_, ?_⟩
· rw [hy, S3_y s x y t hxy hyt, Nat.add_assoc, Nat.add_comm 1 n]
· rw [ht, S3_t s x y t hxt hyt, Nat.add_assoc, Nat.add_comm 1 n]
· intro q qx qy qt
rw [hf q qx qy qt, S3_o s x y t q qx qy qt]
def S2 (s : Store) (x t : Nat) : Store := upd (upd s t (s t - 1)) x (upd s t (s t - 1) x + 1)
theorem S2_t (s : Store) (x t : Nat) (hxt : x ≠ t) : S2 s x t t = s t - 1 := by
unfold S2; rw [upd_ne _ _ _ _ (fun e => hxt e.symm), upd_eq]
theorem S2_x (s : Store) (x t : Nat) (hxt : x ≠ t) : S2 s x t x = s x + 1 := by
unfold S2; rw [upd_eq, upd_ne _ _ _ _ hxt]
theorem S2_o (s : Store) (x t q : Nat) (qx : q ≠ x) (qt : q ≠ t) : S2 s x t q = s q := by
unfold S2; rw [upd_ne _ _ _ _ qx, upd_ne _ _ _ _ qt]
theorem mvBack_spec (x t : Nat) (hxt : x ≠ t) : (n : Nat) → (s : Store) → s t = n →
∃ s', Run (mvBack x t) s s' ∧ s' t = 0 ∧ s' x = s x + n ∧ ∀ q, q ≠ x → q ≠ t → s' q = s q
| 0, s, h => ⟨s, .loopZ h, h, rfl, fun _ _ _ => rfl⟩
| n + 1, s, h => by
have r1 : Run (.seq (.dec t) (.inc x)) s (S2 s x t) := .seq .dec .inc
have e2t : S2 s x t t = n := by rw [S2_t s x t hxt, h]; rfl
match mvBack_spec x t hxt n (S2 s x t) e2t with
| ⟨s', hr, h0, hx, hf⟩ =>
refine ⟨s', .loopS (fun e => Nat.noConfusion (h.symm.trans e)) r1 hr, h0, ?_, ?_⟩
· rw [hx, S2_x s x t hxt, Nat.add_assoc, Nat.add_comm 1 n]
· intro q qx qt
rw [hf q qx qt, S2_o s x t q qx qt]
/-- copy x into y using the scratch register t -/
def copy (x y t : Nat) : Prog := .seq (clear y) (.seq (clear t) (.seq (mv3 x y t) (mvBack x t)))
theorem copy_spec (x y t : Nat) (hxy : x ≠ y) (hxt : x ≠ t) (hyt : y ≠ t) (s : Store) :
∃ s', Run (copy x y t) s s' ∧ s' y = s x ∧ s' x = s x ∧ s' t = 0 ∧
∀ q, q ≠ y → q ≠ t → s' q = s q := by
match clear_ex y s with
| ⟨s1, r1, h1y, f1⟩ => match clear_ex t s1 with
| ⟨s2, r2, h2t, f2⟩ =>
have e2x : s2 x = s x := (f2 x hxt).trans (f1 x hxy)
have e2y : s2 y = 0 := (f2 y hyt).trans h1y
match mv3_spec x y t hxy hxt hyt (s2 x) s2 rfl with
| ⟨s3, r3, h3x, h3y, h3t, f3⟩ => match mvBack_spec x t hxt (s3 t) s3 rfl with
| ⟨s4, r4, h4t, h4x, f4⟩ =>
refine ⟨s4, .seq r1 (.seq r2 (.seq r3 r4)), ?_, ?_, h4t, ?_⟩
· rw [f4 y (fun e => hxy e.symm) hyt, h3y, e2y, Nat.zero_add, e2x]
· rw [h4x, h3x, h3t, h2t, Nat.zero_add, Nat.zero_add, e2x]
· intro q qy qt
cases Nat.decEq q x with
| isTrue e =>
subst e
rw [h4x, h3x, h3t, h2t, Nat.zero_add, Nat.zero_add, e2x]
| isFalse qx =>
rw [f4 q qx qt, f3 q qx qy qt, f2 q qt, f1 q qy]
end RC
end Found
#print axioms Found.RC.clear_spec
#print axioms Found.RC.mv3_spec
#print axioms Found.RC.mvBack_spec
#print axioms Found.RC.copy_spec
lean_all/found/RegComp2.lean
/-
T207/T145 line μ-recursive → register machines, part 2. found/RegComp2 —
compilation of μ-recursive functions (found/ChurchTuring3) into
structured register machines (found/RegComp1): inputs in given
registers, output in a given register, scratch registers above a base;
composition computes the inner functions into fresh registers, primitive
recursion runs a counting loop (accumulator, counter, remaining count),
minimisation searches upward until the value is zero. Correctness: every
terminating μ-recursive evaluation is carried out by the compiled
program, leaving all registers below the base (except the output)
unchanged.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.RegComp1
import found.EffectiveK1
namespace Found
namespace RC
open CT3 Rec K1
def rd (s : Store) : List Nat → List Nat
| [] => []
| x :: l => s x :: rd s l
def Low (l : List Nat) (b : Nat) : Prop := ∀ x, x ∈ l → x < b
def nthR : List Nat → Nat → Option Nat
| [], _ => none
| x :: _, 0 => some x
| _ :: l, k + 1 => nthR l k
def outsFrom : Nat → Nat → List Nat
| _, 0 => []
| k, m + 1 => k :: outsFrom (k + 1) m
def cp (ins : List Nat) (i o t : Nat) : Prog := match nthR ins i with
| some x => copy x o t
| none => clear o
def precBody (pg : Prog) (fr : Nat) : Prog :=
.seq pg (.seq (copy (fr + 3) fr (fr + 4)) (.seq (.inc (fr + 1)) (.dec (fr + 2))))
def precProg (pf pg : Prog) (x o fr : Nat) : Prog :=
.seq pf (.seq (clear (fr + 1)) (.seq (copy x (fr + 2) (fr + 3)) (.seq (.loop (fr + 2) (precBody pg fr)) (copy fr o (fr + 4)))))
def muProg (pf : Prog) (o fr : Nat) : Prog :=
.seq (clear fr) (.seq pf (.seq (.loop (fr + 1) (.seq (.inc fr) pf)) (copy fr o (fr + 2))))
mutual
def comp : MR → List Nat → Nat → Nat → Prog
| .zero, _, o, _ => clear o
| .succ, ins, o, fr => .seq (cp ins 0 o fr) (.inc o)
| .proj i, ins, o, fr => cp ins i o fr
| .comp f gs, ins, o, fr => .seq (compL gs ins fr (fr + gs.length)) (comp f (outsFrom fr gs.length) o (fr + gs.length))
| .prec f _, [], o, fr => comp f [] o fr
| .prec f g, x :: rest, o, fr =>
precProg (comp f rest fr (fr + 4)) (comp g ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4)) x o fr
| .mu f, ins, o, fr => muProg (comp f (fr :: ins) (fr + 1) (fr + 2)) o fr
def compL : List MR → List Nat → Nat → Nat → Prog
| [], _, _, b => clear b
| g :: gs, ins, k, b => .seq (comp g ins k b) (compL gs ins (k + 1) b)
end
/-! ## helpers -/
theorem rd_frame (l : List Nat) (b : Nat) (hl : Low l b) (s t : Store) (h : ∀ q, q < b → t q = s q) :
rd t l = rd s l := by
induction l with
| nil => rfl
| cons x l ih =>
show t x :: rd t l = s x :: rd s l
rw [h x (hl x (.head _)), ih (fun y m => hl y (.tail _ m))]
theorem low_mono {l : List Nat} {a b : Nat} (h : Low l a) (hab : a ≤ b) : Low l b :=
fun x m => Nat.lt_of_lt_of_le (h x m) hab
theorem low_cons {x : Nat} {l : List Nat} {b : Nat} (hx : x < b) (h : Low l b) : Low (x :: l) b := fun y m => by
cases m with
| head => exact hx
| tail _ m' => exact h y m'
theorem not_mem_low {l : List Nat} {b : Nat} (h : Low l b) (o : Nat) (ho : b ≤ o) : o ∉ l :=
fun m => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (h o m) ho)
theorem nthR_spec (s : Store) : (l : List Nat) → (i : Nat) →
(∀ x, nthR l i = some x → x ∈ l ∧ nth (rd s l) i = s x) ∧ (nthR l i = none → nth (rd s l) i = 0)
| [], _ => ⟨(fun _ h => nomatch h), fun _ => rfl⟩
| y :: l, 0 => ⟨fun x h => by
have e : y = x := Option.some.inj h
subst e
exact ⟨.head _, rfl⟩, (fun h => nomatch h)⟩
| y :: l, k + 1 => ⟨fun x h => match (nthR_spec s l k).1 x h with
| ⟨m, e⟩ => ⟨.tail _ m, e⟩, fun h => (nthR_spec s l k).2 h⟩
theorem cp_spec (ins : List Nat) (i o t : Nat) (s : Store) (hl : Low ins t) (ho : o < t) (hn : o ∉ ins) :
∃ s', Run (cp ins i o t) s s' ∧ s' o = nth (rd s ins) i ∧ ∀ q, q < t → q ≠ o → s' q = s q := by
unfold cp
match h : nthR ins i with
| some x =>
have hx := (nthR_spec s ins i).1 x h
have hxo : x ≠ o := fun e => hn (e ▸ hx.1)
have hxt : x ≠ t := fun e => Nat.lt_irrefl _ (e ▸ hl x hx.1)
have hot : o ≠ t := fun e => Nat.lt_irrefl _ (e ▸ ho)
match copy_spec x o t hxo hxt hot s with
| ⟨s', r, h1, _, _, hf⟩ => exact ⟨s', r, h1.trans hx.2.symm, fun q hq qo => hf q qo (fun e => Nat.lt_irrefl _ (e ▸ hq))⟩
| none =>
match clear_ex o s with
| ⟨s', r, h1, hf⟩ => exact ⟨s', r, h1.trans ((nthR_spec s ins i).2 h).symm, fun q _ qo => hf q qo⟩
theorem lt_ne {q fr : Nat} (h : q < fr) (i : Nat) : q ≠ fr + i := fun e => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le h (e ▸ Nat.le_add_right fr i))
theorem add_cancel' : (k : Nat) → {i j : Nat} → k + i = k + j → i = j
| 0, _, _, h => by rw [Nat.zero_add, Nat.zero_add] at h; exact h
| k + 1, _, _, h => add_cancel' k (Nat.succ.inj (by rw [Nat.succ_add, Nat.succ_add] at h; exact h))
theorem ne_off (fr : Nat) {i j : Nat} (h : i ≠ j) : fr + i ≠ fr + j := fun e => h (add_cancel' fr e)
theorem low_outs : (k m : Nat) → Low (outsFrom k m) (k + m)
| _, 0 => fun _ m => nomatch m
| k, m + 1 => low_cons (Nat.lt_of_lt_of_le (Nat.lt_succ_self k) (by rw [Nat.add_succ]; exact Nat.succ_le_succ (Nat.le_add_right k m)))
(fun x hx => by
have := low_outs (k + 1) m x hx
rw [Nat.succ_add] at this
exact this)
theorem outs_ge : (k m : Nat) → ∀ x, x ∈ outsFrom k m → k ≤ x
| _, 0 => fun _ h => nomatch h
| k, m + 1 => fun x h => by
cases h with
| head => exact Nat.le_refl _
| tail _ h' => exact Nat.le_of_succ_le (outs_ge (k + 1) m x h')
theorem prec_down {f g : MR} {rest : List Nat} : (d j v : Nat) → Ev (.prec f g) ((j + d) :: rest) v →
∃ w, Ev (.prec f g) (j :: rest) w
| 0, _, v, h => ⟨v, h⟩
| d + 1, j, _, h => match inv_prec h rfl with
| Or.inl ⟨e, _⟩ => nomatch e
| Or.inr (Or.inl ⟨_, e, _⟩) => Nat.noConfusion (List.cons.inj e).1
| Or.inr (Or.inr ⟨k, rest', v0, e, p, _⟩) => by
have e1 := Nat.succ.inj (List.cons.inj e).1
have e2 := (List.cons.inj e).2
subst e2
rw [← e1] at p
exact prec_down d j v0 p
theorem prec_step {f g : MR} {rest : List Nat} {c w : Nat} (h : Ev (.prec f g) ((c + 1) :: rest) w) :
∃ w', Ev (.prec f g) (c :: rest) w' ∧ Ev g (c :: w' :: rest) w :=
match inv_prec h rfl with
| Or.inl ⟨e, _⟩ => nomatch e
| Or.inr (Or.inl ⟨_, e, _⟩) => Nat.noConfusion (List.cons.inj e).1
| Or.inr (Or.inr ⟨k, rest', v0, e, p, q⟩) => by
have e1 := Nat.succ.inj (List.cons.inj e).1
have e2 := (List.cons.inj e).2
subst e1 e2
exact ⟨v0, p, q⟩
theorem prec_base {f g : MR} {rest : List Nat} {w : Nat} (h : Ev (.prec f g) (0 :: rest) w) : Ev f rest w :=
match inv_prec h rfl with
| Or.inl ⟨e, _⟩ => nomatch e
| Or.inr (Or.inl ⟨_, e, p⟩) => by
have e2 := (List.cons.inj e).2
subst e2
exact p
| Or.inr (Or.inr ⟨_, _, _, e, _, _⟩) => Nat.noConfusion (List.cons.inj e).1
theorem mu_head {f : MR} {args : List Nat} {j n : Nat} : MuS f args j n → ∃ v, Ev f (j :: args) v
| .stop e => ⟨0, e⟩
| .next e _ => ⟨_, e⟩
/-- the specification of a compiled program -/
def Spec (h : MR) : Prop := ∀ (ins : List Nat) (o fr : Nat) (s : Store) (n : Nat), Ev h (rd s ins) n →
Low ins fr → o < fr → o ∉ ins → ∃ s', Run (comp h ins o fr) s s' ∧ s' o = n ∧ ∀ q, q < fr → q ≠ o → s' q = s q
theorem mem_cons' {a b : Nat} {l : List Nat} (h : a ∈ b :: l) : a = b ∨ a ∈ l := by
cases h with
| head => exact Or.inl rfl
| tail _ h => exact Or.inr h
theorem nelit (i j : Nat) (h : bq i j = false) : i ≠ j := fun e => by
rw [e, bq_self] at h
exact Bool.noConfusion h
theorem ltlit (i j : Nat) (h : Nat.ble (i + 1) j = true) : i < j := Nat.le_of_ble_eq_true h
theorem offlt (fr : Nat) {i j : Nat} (h : i < j) : fr + i < fr + j := Nat.add_lt_add_left h fr
/-- the primitive recursion loop -/
theorem prec_loop (f g : MR) (IHg : Spec g) (rest : List Nat) (fr : Nat) (hr : Low rest fr) (s : Store) (n K : Nat)
(d : Ev (.prec f g) (K :: rd s rest) n) : (m : Nat) → (t : Store) → t (fr + 2) = m → t (fr + 1) + m = K →
Ev (.prec f g) (t (fr + 1) :: rd s rest) (t fr) → (∀ q, q < fr → t q = s q) →
∃ t', Run (.loop (fr + 2) (precBody (comp g ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4)) fr)) t t' ∧
t' fr = n ∧ ∀ q, q < fr → t' q = s q
| 0, t, hD, hCK, hev, hfr => by
have e : t (fr + 1) = K := hCK
rw [e] at hev
exact ⟨t, .loopZ hD, ev_det hev d, hfr⟩
| m + 1, t, hD, hCK, hev, hfr => by
have hK : (t (fr + 1) + 1) + m = K := by rw [Nat.add_assoc, Nat.add_comm 1 m]; exact hCK
have d' : Ev (.prec f g) ((t (fr + 1) + 1 + m) :: rd s rest) n := by rw [hK]; exact d
match prec_down m (t (fr + 1) + 1) n d' with
| ⟨w', hw'⟩ => match prec_step hw' with
| ⟨w'', p, q⟩ =>
have ew : w'' = t fr := ev_det p hev
have hrd : rd t rest = rd s rest := rd_frame rest fr hr s t hfr
have q' : Ev g (rd t ((fr + 1) :: fr :: rest)) w' := by
show Ev g (t (fr + 1) :: t fr :: rd t rest) w'
rw [hrd, ← ew]; exact q
have hl : Low ((fr + 1) :: fr :: rest) (fr + 4) :=
low_cons (offlt fr (ltlit 1 4 rfl)) (low_cons (offlt fr (ltlit 0 4 rfl))
(low_mono hr (Nat.le_add_right fr 4)))
have hTn : fr + 3 ∉ ((fr + 1) :: fr :: rest) := fun mm =>
(mem_cons' mm).elim (fun e => ne_off fr (nelit 3 1 rfl) e)
(fun mm => (mem_cons' mm).elim (fun e => ne_off fr (nelit 3 0 rfl) e)
(fun mm => not_mem_low hr (fr + 3) (Nat.le_add_right fr 3) mm))
match IHg ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4) t w' q' hl (offlt fr (ltlit 3 4 rfl)) hTn with
| ⟨t1, r1, h1T, f1⟩ =>
match copy_spec (fr + 3) fr (fr + 4) (ne_off fr (nelit 3 0 rfl)) (ne_off fr (nelit 3 4 rfl))
(ne_off fr (nelit 0 4 rfl)) t1 with
| ⟨t2, r2, h2A, _, _, f2⟩ =>
let t3 := upd t2 (fr + 1) (t2 (fr + 1) + 1)
let t4 := upd t3 (fr + 2) (t3 (fr + 2) - 1)
have rb : Run (precBody (comp g ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4)) fr) t t4 :=
.seq r1 (.seq r2 (.seq .inc .dec))
have c2 : t2 (fr + 1) = t (fr + 1) := (f2 _ (ne_off fr (nelit 1 0 rfl)) (ne_off fr (nelit 1 4 rfl))).trans
(f1 _ (offlt fr (ltlit 1 4 rfl)) (ne_off fr (nelit 1 3 rfl)))
have d2 : t2 (fr + 2) = t (fr + 2) := (f2 _ (ne_off fr (nelit 2 0 rfl)) (ne_off fr (nelit 2 4 rfl))).trans
(f1 _ (offlt fr (ltlit 2 4 rfl)) (ne_off fr (nelit 2 3 rfl)))
have c4 : t4 (fr + 1) = t (fr + 1) + 1 := by
show upd t3 (fr + 2) _ (fr + 1) = _
rw [upd_ne _ _ _ _ (ne_off fr (nelit 1 2 rfl))]
show upd t2 (fr + 1) (t2 (fr + 1) + 1) (fr + 1) = _
rw [upd_eq, c2]
have dd4 : t4 (fr + 2) = m := by
show upd t3 (fr + 2) (t3 (fr + 2) - 1) (fr + 2) = m
rw [upd_eq]
show upd t2 (fr + 1) _ (fr + 2) - 1 = m
rw [upd_ne _ _ _ _ (ne_off fr (nelit 2 1 rfl)), d2, hD]
rfl
have a4 : t4 fr = w' := by
show upd t3 (fr + 2) _ fr = w'
rw [upd_ne _ _ _ _ (fun e => ne_off fr (nelit 0 2 rfl) (by rw [Nat.add_zero]; exact e))]
show upd t2 (fr + 1) _ fr = w'
rw [upd_ne _ _ _ _ (fun e => ne_off fr (nelit 0 1 rfl) (by rw [Nat.add_zero]; exact e))]
rw [h2A, h1T]
have fr4 : ∀ q, q < fr → t4 q = s q := fun q hq => by
show upd t3 (fr + 2) _ q = s q
rw [upd_ne _ _ _ _ (lt_ne hq 2)]
show upd t2 (fr + 1) _ q = s q
rw [upd_ne _ _ _ _ (lt_ne hq 1), f2 q (fun e => Nat.lt_irrefl _ (e ▸ hq)) (lt_ne hq 4),
f1 q (Nat.lt_of_lt_of_le hq (Nat.le_add_right fr 4)) (lt_ne hq 3), hfr q hq]
have inv4 : Ev (.prec f g) (t4 (fr + 1) :: rd s rest) (t4 fr) := by rw [c4, a4]; exact hw'
have ck4 : t4 (fr + 1) + m = K := by rw [c4]; exact hK
match prec_loop f g IHg rest fr hr s n K d m t4 dd4 ck4 inv4 fr4 with
| ⟨t', r', h', f'⟩ =>
exact ⟨t', .loopS (fun e => Nat.noConfusion (hD.symm.trans e)) rb r', h', f'⟩
theorem evL_nil {a bs : List Nat} : EvL [] a bs → bs = []
| .nil _ => rfl
theorem lt4 (fr : Nat) (i : Nat) (h : Nat.ble (i + 1) 4 = true) : fr + i < fr + 4 := offlt fr (ltlit i 4 h)
/-- primitive recursion is compiled correctly -/
theorem prec_cor (f g : MR) (IHf : Spec f) (IHg : Spec g) (x : Nat) (rest : List Nat) (o fr : Nat) (s : Store) (n : Nat)
(d : Ev (.prec f g) (rd s (x :: rest)) n) (hl : Low (x :: rest) fr) (ho : o < fr) (_ : o ∉ x :: rest) :
∃ s', Run (comp (.prec f g) (x :: rest) o fr) s s' ∧ s' o = n ∧ ∀ q, q < fr → q ≠ o → s' q = s q := by
have hx : x < fr := hl x (.head _)
have hr : Low rest fr := fun y m => hl y (.tail _ m)
have d0 : Ev (.prec f g) ((0 + s x) :: rd s rest) n := by rw [Nat.zero_add]; exact d
match prec_down (s x) 0 n d0 with
| ⟨w0, hw0⟩ =>
match IHf rest fr (fr + 4) s w0 (prec_base hw0) (low_mono hr (Nat.le_add_right fr 4))
(by have := lt4 fr 0 rfl; rw [Nat.add_zero] at this; exact this)
(not_mem_low hr fr (Nat.le_refl fr)) with
| ⟨s1, r1, h1, f1⟩ =>
match clear_ex (fr + 1) s1 with
| ⟨s2, r2, h2, f2⟩ =>
have hx1 : x ≠ fr + 1 := lt_ne hx 1
match copy_spec x (fr + 2) (fr + 3) (lt_ne hx 2) (lt_ne hx 3) (ne_off fr (nelit 2 3 rfl)) s2 with
| ⟨s3, r3, h3, _, _, f3⟩ =>
have e2x : s2 x = s x := (f2 x hx1).trans (f1 x (Nat.lt_of_lt_of_le hx (Nat.le_add_right fr 4))
(fun e => Nat.lt_irrefl _ (e ▸ hx)))
have e3C : s3 (fr + 1) = 0 := (f3 _ (ne_off fr (nelit 1 2 rfl)) (ne_off fr (nelit 1 3 rfl))).trans h2
have e3A : s3 fr = w0 := by
have a := f3 fr (fun e => ne_off fr (nelit 0 2 rfl) (by rw [Nat.add_zero]; exact e))
(fun e => ne_off fr (nelit 0 3 rfl) (by rw [Nat.add_zero]; exact e))
have b := f2 fr (fun e => ne_off fr (nelit 0 1 rfl) (by rw [Nat.add_zero]; exact e))
rw [a, b, h1]
have f3s : ∀ q, q < fr → s3 q = s q := fun q hq => by
rw [f3 q (lt_ne hq 2) (lt_ne hq 3), f2 q (lt_ne hq 1),
f1 q (Nat.lt_of_lt_of_le hq (Nat.le_add_right fr 4)) (fun e => Nat.lt_irrefl _ (e ▸ hq))]
have hev : Ev (.prec f g) (s3 (fr + 1) :: rd s rest) (s3 fr) := by rw [e3C, e3A]; exact hw0
have hCK : s3 (fr + 1) + s x = s x := by rw [e3C, Nat.zero_add]
match prec_loop f g IHg rest fr hr s n (s x) d (s x) s3 (h3.trans e2x) hCK hev f3s with
| ⟨s4, r4, h4, f4⟩ =>
match copy_spec fr o (fr + 4) (fun e => Nat.lt_irrefl _ (e ▸ ho))
(fun e => ne_off fr (nelit 0 4 rfl) (by rw [Nat.add_zero]; exact e))
(fun e => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le ho (e ▸ Nat.le_add_right fr 4))) s4 with
| ⟨s5, r5, h5, _, _, f5⟩ =>
exact ⟨s5, .seq r1 (.seq r2 (.seq r3 (.seq r4 r5))), h5.trans h4,
fun q hq qo => (f5 q qo (lt_ne hq 4)).trans (f4 q hq)⟩
/-- the minimisation loop -/
theorem mu_loop (f : MR) (IHf : Spec f) (ins : List Nat) (fr : Nat) (hl : Low ins fr) (s : Store)
(args : List Nat) (ha : rd s ins = args) :
{j n : Nat} → MuS f args j n → (t : Store) → t fr = j → (∃ v, Ev f (j :: args) v ∧ t (fr + 1) = v) →
(∀ q, q < fr → t q = s q) →
∃ t', Run (.loop (fr + 1) (.seq (.inc fr) (comp f (fr :: ins) (fr + 1) (fr + 2)))) t t' ∧ t' fr = n ∧
∀ q, q < fr → t' q = s q
| _, _, .stop e, t, hJ, ⟨v, ev, hv⟩, hfr => by
have v0 : v = 0 := ev_det ev e
exact ⟨t, .loopZ (hv.trans v0), hJ, hfr⟩
| j, _, .next e m, t, hJ, ⟨v, ev, hv⟩, hfr => by
have vi := ev_det ev e
let t1 := upd t fr (t fr + 1)
have t1J : t1 fr = j + 1 := by show upd t fr _ fr = _; rw [upd_eq, hJ]
have t1s : ∀ q, q < fr → t1 q = s q := fun q hq => by
show upd t fr _ q = s q
rw [upd_ne _ _ _ _ (fun e => Nat.lt_irrefl _ (e ▸ hq)), hfr q hq]
match mu_head m with
| ⟨v', ev'⟩ =>
have hrd : rd t1 (fr :: ins) = (j + 1) :: args := by
show t1 fr :: rd t1 ins = _
rw [t1J, rd_frame ins fr hl s t1 t1s, ha]
have hl2 : Low (fr :: ins) (fr + 2) :=
low_cons (by have := offlt fr (ltlit 0 2 rfl); rw [Nat.add_zero] at this; exact this)
(low_mono hl (Nat.le_add_right fr 2))
have hn2 : fr + 1 ∉ fr :: ins := fun mm => (mem_cons' mm).elim
(fun e => ne_off fr (nelit 1 0 rfl) (by rw [Nat.add_zero]; exact e))
(fun mm => not_mem_low hl (fr + 1) (Nat.le_add_right fr 1) mm)
match IHf (fr :: ins) (fr + 1) (fr + 2) t1 v' (by rw [hrd]; exact ev') hl2 (offlt fr (ltlit 1 2 rfl)) hn2 with
| ⟨t2, r2, h2, f2⟩ =>
have t2J : t2 fr = j + 1 := by
rw [f2 fr (by have := offlt fr (ltlit 0 2 rfl); rw [Nat.add_zero] at this; exact this)
(fun e => ne_off fr (nelit 0 1 rfl) (by rw [Nat.add_zero]; exact e)), t1J]
have t2s : ∀ q, q < fr → t2 q = s q := fun q hq => by
rw [f2 q (Nat.lt_of_lt_of_le hq (Nat.le_add_right fr 2)) (lt_ne hq 1), t1s q hq]
match mu_loop f IHf ins fr hl s args ha m t2 t2J ⟨v', ev', h2⟩ t2s with
| ⟨t', r', h', f'⟩ =>
exact ⟨t', .loopS (fun e => Nat.noConfusion (vi.symm.trans (hv.symm.trans e))) (.seq .inc r2) r', h', f'⟩
/-- minimisation is compiled correctly -/
theorem mu_cor (f : MR) (IHf : Spec f) (ins : List Nat) (o fr : Nat) (s : Store) (n : Nat)
(d : Ev (.mu f) (rd s ins) n) (hl : Low ins fr) (ho : o < fr) (_ : o ∉ ins) :
∃ s', Run (comp (.mu f) ins o fr) s s' ∧ s' o = n ∧ ∀ q, q < fr → q ≠ o → s' q = s q := by
have ms := inv_mu d rfl
match clear_ex fr s with
| ⟨s1, r1, h1, f1⟩ =>
have s1s : ∀ q, q < fr → s1 q = s q := fun q hq => f1 q (fun e => Nat.lt_irrefl _ (e ▸ hq))
match mu_head ms with
| ⟨v0, ev0⟩ =>
have hrd : rd s1 (fr :: ins) = 0 :: rd s ins := by
show s1 fr :: rd s1 ins = _
rw [h1, rd_frame ins fr hl s s1 s1s]
have hl2 : Low (fr :: ins) (fr + 2) :=
low_cons (by have := offlt fr (ltlit 0 2 rfl); rw [Nat.add_zero] at this; exact this)
(low_mono hl (Nat.le_add_right fr 2))
have hn2 : fr + 1 ∉ fr :: ins := fun mm => (mem_cons' mm).elim
(fun e => ne_off fr (nelit 1 0 rfl) (by rw [Nat.add_zero]; exact e))
(fun mm => not_mem_low hl (fr + 1) (Nat.le_add_right fr 1) mm)
match IHf (fr :: ins) (fr + 1) (fr + 2) s1 v0 (by rw [hrd]; exact ev0) hl2 (offlt fr (ltlit 1 2 rfl)) hn2 with
| ⟨s2, r2, h2, f2⟩ =>
have s2J : s2 fr = 0 := by
rw [f2 fr (by have := offlt fr (ltlit 0 2 rfl); rw [Nat.add_zero] at this; exact this)
(fun e => ne_off fr (nelit 0 1 rfl) (by rw [Nat.add_zero]; exact e)), h1]
have s2s : ∀ q, q < fr → s2 q = s q := fun q hq => by
rw [f2 q (Nat.lt_of_lt_of_le hq (Nat.le_add_right fr 2)) (lt_ne hq 1), s1s q hq]
match mu_loop f IHf ins fr hl s (rd s ins) rfl ms s2 s2J ⟨v0, ev0, h2⟩ s2s with
| ⟨s3, r3, h3, f3⟩ =>
match copy_spec fr o (fr + 2) (fun e => Nat.lt_irrefl _ (e ▸ ho))
(fun e => ne_off fr (nelit 0 2 rfl) (by rw [Nat.add_zero]; exact e))
(fun e => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le ho (e ▸ Nat.le_add_right fr 2))) s3 with
| ⟨s4, r4, h4, _, _, f4⟩ =>
exact ⟨s4, .seq r1 (.seq r2 (.seq r3 r4)), h4.trans h3,
fun q hq qo => (f4 q qo (lt_ne hq 2)).trans (f3 q hq)⟩
mutual
/-- correctness of the compiler -/
theorem cor : (h : MR) → Spec h
| .zero => fun ins o fr s n d _ _ _ => match clear_ex o s with
| ⟨s', r, h0, hf⟩ => ⟨s', r, h0.trans (inv_zero d rfl).symm, fun q _ qo => hf q qo⟩
| .succ => fun ins o fr s n d hl ho hn => match cp_spec ins 0 o fr s hl ho hn with
| ⟨s1, r1, h1, f1⟩ => ⟨upd s1 o (s1 o + 1), .seq r1 .inc, by rw [upd_eq, h1, inv_succ d rfl],
fun q hq qo => by rw [upd_ne _ _ _ _ qo, f1 q hq qo]⟩
| .proj i => fun ins o fr s n d hl ho hn => match cp_spec ins i o fr s hl ho hn with
| ⟨s1, r1, h1, f1⟩ => ⟨s1, r1, h1.trans (inv_proj d rfl).symm, f1⟩
| .comp f gs => fun ins o fr s n d hl ho _ => match inv_comp d rfl with
| ⟨bs, l, e⟩ => match corL gs ins fr (fr + gs.length) s bs l hl (Nat.le_refl _) with
| ⟨s1, r1, h1, f1⟩ =>
match cor f (outsFrom fr gs.length) o (fr + gs.length) s1 n (by rw [h1]; exact e) (low_outs fr gs.length)
(Nat.lt_of_lt_of_le ho (Nat.le_add_right fr _))
(fun m => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le ho (outs_ge fr _ o m))) with
| ⟨s2, r2, h2, f2⟩ => ⟨s2, .seq r1 r2, h2, fun q hq qo =>
(f2 q (Nat.lt_of_lt_of_le hq (Nat.le_add_right fr _)) qo).trans (f1 q hq)⟩
| .prec f g => fun ins => match ins with
| [] => fun o fr s n d hl ho hn => match inv_prec d rfl with
| Or.inl ⟨_, e⟩ => cor f [] o fr s n e hl ho hn
| Or.inr (Or.inl ⟨_, e, _⟩) => nomatch e
| Or.inr (Or.inr ⟨_, _, _, e, _, _⟩) => nomatch e
| x :: rest => fun o fr s n d hl ho hn => prec_cor f g (cor f) (cor g) x rest o fr s n d hl ho hn
| .mu f => fun ins o fr s n d hl ho hn => mu_cor f (cor f) ins o fr s n d hl ho hn
theorem corL : (gs : List MR) → ∀ (ins : List Nat) (k b : Nat) (s : Store) (bs : List Nat),
EvL gs (rd s ins) bs → Low ins k → k + gs.length ≤ b →
∃ s', Run (compL gs ins k b) s s' ∧ rd s' (outsFrom k gs.length) = bs ∧ ∀ q, q < k → s' q = s q
| [] => fun _ k b s bs l _ hb => match clear_ex b s with
| ⟨s', r, _, hf⟩ => ⟨s', r, (evL_nil l).symm, fun q hq => hf q (fun e' => Nat.lt_irrefl _
(Nat.lt_of_lt_of_le hq (e' ▸ (show k ≤ b from hb))))⟩
| g :: gs => fun ins k b s bs l hl hb => match invL l with
| Or.inl ⟨e, _⟩ => nomatch e
| Or.inr ⟨b0, bs', e, ev, l'⟩ =>
have hkb : k < b := Nat.lt_of_lt_of_le (Nat.lt_succ_of_le (Nat.le_add_right k gs.length)) hb
match cor g ins k b s b0 ev (low_mono hl (Nat.le_of_lt hkb)) hkb (not_mem_low hl k (Nat.le_refl k)) with
| ⟨s1, r1, h1, f1⟩ =>
have hrd : rd s1 ins = rd s ins := rd_frame ins k hl s s1 (fun q hq =>
f1 q (Nat.lt_trans hq hkb) (fun e => Nat.lt_irrefl _ (e ▸ hq)))
match corL gs ins (k + 1) b s1 bs' (by rw [hrd]; exact l') (low_mono hl (Nat.le_succ k))
(by rw [Nat.succ_add]; exact hb) with
| ⟨s2, r2, h2, f2⟩ => ⟨s2, .seq r1 r2, by
show s2 k :: rd s2 (outsFrom (k + 1) gs.length) = bs
rw [h2, f2 k (Nat.lt_succ_self k), h1, e],
fun q hq => (f2 q (Nat.lt_trans hq (Nat.lt_succ_self k))).trans
(f1 q (Nat.lt_trans hq hkb) (fun e => Nat.lt_irrefl _ (e ▸ hq)))⟩
end
/-- every μ-recursive function of arity k is computed by a register machine: inputs in registers
0, …, k-1, output in register k, scratch above -/
theorem mu_to_register (h : MR) (k : Nat) (s : Store) (n : Nat) (d : Ev h (rd s (outsFrom 0 k)) n) :
∃ s', Run (comp h (outsFrom 0 k) k (k + 1)) s s' ∧ s' k = n ∧ ∀ q, q < k → s' q = s q :=
have hl : Low (outsFrom 0 k) (k + 1) := low_mono (by have := low_outs 0 k; rw [Nat.zero_add] at this; exact this)
(Nat.le_succ k)
have hn : k ∉ outsFrom 0 k := not_mem_low (by have := low_outs 0 k; rw [Nat.zero_add] at this; exact this) k
(Nat.le_refl k)
match cor h (outsFrom 0 k) k (k + 1) s n d hl (Nat.lt_succ_self k) hn with
| ⟨s', r, h1, f1⟩ => ⟨s', r, h1, fun q hq => f1 q (Nat.lt_trans hq (Nat.lt_succ_self k))
(fun e => Nat.lt_irrefl _ (e ▸ hq))⟩
end RC
end Found
#print axioms Found.RC.cp_spec
#print axioms Found.RC.prec_down
#print axioms Found.RC.prec_step
#print axioms Found.RC.prec_base
#print axioms Found.RC.prec_loop
#print axioms Found.RC.ne_off
#print axioms Found.RC.prec_cor
#print axioms Found.RC.mu_loop
#print axioms Found.RC.mu_cor
#print axioms Found.RC.cor
#print axioms Found.RC.corL
#print axioms Found.RC.mu_to_register
lean_all/found/RegIf.lean
/-
Line Turing machines ↔ register machines, part 1. found/RegIf —
conditionals in the structured register language (found/RegComp1):
`if r ≠ 0 then P` runs P once when r is non-zero (a copy of r is used
as a one-shot loop guard), with the specification transported from P;
frame conditions are preserved.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.RegComp2
namespace Found
namespace RC
/-- if r ≠ 0 then P (scratch t, which P must not touch) -/
def ifNZ (r t : Nat) (P : Prog) : Prog := .seq (copy r t (t + 1)) (.loop t (.seq (clear t) P))
/-- the one-shot loop: if the guard is non-zero, P runs once -/
theorem once_spec (t : Nat) (P : Prog) (s : Store) (Q : Store → Prop)
(hP : ∀ s0, s0 t = 0 → (∀ q, q ≠ t → s0 q = s q) → ∃ s1, Run P s0 s1 ∧ s1 t = 0 ∧ Q s1) (ht : s t ≠ 0) :
∃ s', Run (.loop t (.seq (clear t) P)) s s' ∧ Q s' :=
match clear_ex t s with
| ⟨s0, r0, h0, f0⟩ => match hP s0 h0 f0 with
| ⟨s1, r1, h1, q1⟩ => ⟨s1, .loopS ht (.seq r0 r1) (.loopZ h1), q1⟩
theorem once_skip (t : Nat) (P : Prog) (s : Store) (ht : s t = 0) : Run (.loop t (.seq (clear t) P)) s s := .loopZ ht
/-- the body of the halving loop on registers r (input), h (quotient), b (bit), f, t (scratch) -/
def halveBody (r h b f t : Nat) : Prog :=
.seq (.dec r) (.seq (clear f) (.seq (.inc f)
(.seq (ifNZ b t (.seq (.dec f) (.seq (clear b) (.inc h)))) (ifNZ f t (.inc b)))))
/-- a general frame-preserving specification for ifNZ: if r ≠ 0 the effect of P, otherwise nothing,
with the scratch registers t, t+1 changed -/
theorem ifNZ_spec (r t : Nat) (P : Prog) (hrt : r ≠ t) (hrt1 : r ≠ t + 1) (s : Store) (Q : Store → Prop)
(hP : s r ≠ 0 → ∀ s0, s0 t = 0 → (∀ q, q ≠ t → q ≠ t + 1 → s0 q = s q) → s0 (t + 1) = 0 →
∃ s1, Run P s0 s1 ∧ s1 t = 0 ∧ Q s1)
(hskip : ∀ s0, s r = 0 → (∀ q, q ≠ t → q ≠ t + 1 → s0 q = s q) → Q s0) :
∃ s', Run (ifNZ r t P) s s' ∧ Q s' := by
match copy_spec r t (t + 1) hrt hrt1 (fun e => Nat.succ_ne_self t e.symm) s with
| ⟨s1, r1, h1t, _, h1t1, f1⟩ =>
match Nat.decEq (s r) 0 with
| isTrue hz => exact ⟨s1, .seq r1 (once_skip t P s1 (h1t.trans hz)), hskip s1 hz f1⟩
| isFalse hnz =>
match once_spec t P s1 Q (fun s0 h0 f0 => hP hnz s0 h0 (fun q qt qt1 => (f0 q qt).trans (f1 q qt qt1))
((f0 (t + 1) (Nat.succ_ne_self t)).trans h1t1)) (fun e => hnz (h1t.symm.trans e)) with
| ⟨s', r', q'⟩ => exact ⟨s', .seq r1 r', q'⟩
/-- registers outside [B, B+6) -/
def Out (B q : Nat) : Prop := q < B ∨ B + 6 ≤ q
theorem out_ne {B q : Nat} (h : Out B q) (i : Nat) (hi : i < 6) : q ≠ B + i := fun e => by
cases h with
| inl h => exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le h (e ▸ Nat.le_add_right B i))
| inr h => exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (e ▸ Nat.add_lt_add_left hi B) h)
/-- one round of halving: r −1, and (2h + b) +1 with b ∈ {0,1} -/
theorem halveBody_spec (B : Nat) (s : Store) (_ : s B ≠ 0) (hb : s (B + 2) = 0 ∨ s (B + 2) = 1) :
∃ s', Run (halveBody B (B + 1) (B + 2) (B + 3) (B + 4)) s s' ∧ s' B = s B - 1 ∧
2 * s' (B + 1) + s' (B + 2) = 2 * s (B + 1) + s (B + 2) + 1 ∧ (s' (B + 2) = 0 ∨ s' (B + 2) = 1) ∧
∀ q, Out B q → s' q = s q := by
let s1 := upd s B (s B - 1)
match clear_ex (B + 3) s1 with
| ⟨s2, r2, h2, f2⟩ =>
let s3 := upd s2 (B + 3) (s2 (B + 3) + 1)
have n02 : B ≠ B + 2 := fun e => ne_off B (nelit 0 2 rfl) (by rw [Nat.add_zero]; exact e)
have n03 : B ≠ B + 3 := fun e => ne_off B (nelit 0 3 rfl) (by rw [Nat.add_zero]; exact e)
have n01 : B ≠ B + 1 := fun e => ne_off B (nelit 0 1 rfl) (by rw [Nat.add_zero]; exact e)
have v3B : s3 B = s B - 1 := by
show upd s2 (B + 3) _ B = _
rw [upd_ne _ _ _ _ n03, f2 B n03]; exact upd_eq s B _
have v3h : s3 (B + 1) = s (B + 1) := by
show upd s2 (B + 3) _ (B + 1) = _
rw [upd_ne _ _ _ _ (ne_off B (nelit 1 3 rfl)), f2 _ (ne_off B (nelit 1 3 rfl))]
exact upd_ne s B _ (B + 1) (fun e => n01 e.symm)
have v3b : s3 (B + 2) = s (B + 2) := by
show upd s2 (B + 3) _ (B + 2) = _
rw [upd_ne _ _ _ _ (ne_off B (nelit 2 3 rfl)), f2 _ (ne_off B (nelit 2 3 rfl))]
exact upd_ne s B _ (B + 2) (fun e => n02 e.symm)
have v3f : s3 (B + 3) = 1 := by
show upd s2 (B + 3) (s2 (B + 3) + 1) (B + 3) = 1
rw [upd_eq, h2]
have v3o : ∀ q, Out B q → s3 q = s q := fun q hq => by
show upd s2 (B + 3) _ q = _
rw [upd_ne _ _ _ _ (out_ne hq 3 (ltlit 3 6 rfl)), f2 q (out_ne hq 3 (ltlit 3 6 rfl))]
exact upd_ne s B _ q (by have := out_ne hq 0 (ltlit 0 6 rfl); rw [Nat.add_zero] at this; exact this)
have r3 : Run (.seq (.dec B) (.seq (clear (B + 3)) (.inc (B + 3)))) s s3 := .seq .dec (.seq r2 .inc)
have n4 : ∀ i, i < 4 → B + i ≠ B + 4 := fun i hi e => by
have h' := add_cancel' B e
rw [h'] at hi
exact Nat.lt_irrefl _ hi
have n5 : ∀ i, i < 4 → B + i ≠ B + 4 + 1 := fun i hi e => by
have h' := add_cancel' B (show B + i = B + 5 from e)
rw [h'] at hi
exact Nat.lt_irrefl _ (Nat.lt_trans hi (ltlit 4 5 rfl))
cases hb with
| inl b0 =>
-- the bit is 0: the first conditional is skipped, the second sets the bit
match ifNZ_spec (B + 2) (B + 4) (.seq (.dec (B + 3)) (.seq (clear (B + 2)) (.inc (B + 1))))
(n4 2 (ltlit 2 4 rfl)) (n5 2 (ltlit 2 4 rfl)) s3 (fun s4 => ∀ q, q ≠ B + 4 → q ≠ B + 4 + 1 → s4 q = s3 q)
(fun hnz => absurd (v3b.trans b0) hnz) (fun s0 _ f0 => f0) with
| ⟨s4, r4, f4⟩ =>
match ifNZ_spec (B + 3) (B + 4) (.inc (B + 2)) (n4 3 (ltlit 3 4 rfl)) (n5 3 (ltlit 3 4 rfl)) s4
(fun s5 => s5 (B + 2) = 1 ∧ ∀ q, q ≠ B + 2 → q ≠ B + 4 → q ≠ B + 4 + 1 → s5 q = s4 q)
(fun _ s0 h0 f0 _ => ⟨upd s0 (B + 2) (s0 (B + 2) + 1), .inc,
by rw [upd_ne _ _ _ _ (fun e => n4 2 (ltlit 2 4 rfl) e.symm)]; exact h0,
by rw [upd_eq, f0 _ (n4 2 (ltlit 2 4 rfl)) (n5 2 (ltlit 2 4 rfl)), f4 _ (n4 2 (ltlit 2 4 rfl)) (n5 2 (ltlit 2 4 rfl)), v3b, b0],
fun q q2 q4 q5 => by rw [upd_ne _ _ _ _ q2, f0 q q4 q5]⟩)
(fun _ hz _ => absurd ((f4 _ (n4 3 (ltlit 3 4 rfl)) (n5 3 (ltlit 3 4 rfl))).symm.trans hz) (fun e => Nat.noConfusion (v3f.symm.trans e))) with
| ⟨s5, r5, b5, f5⟩ =>
have g : ∀ q, q ≠ B + 2 → q ≠ B + 4 → q ≠ B + 4 + 1 → s5 q = s3 q := fun q a c d => (f5 q a c d).trans (f4 q c d)
refine ⟨s5, .seq (.dec) (.seq r2 (.seq .inc (.seq r4 r5))), ?_, ?_, Or.inr b5, ?_⟩
· rw [g B n02 (n4 0 (ltlit 0 4 rfl)) (n5 0 (ltlit 0 4 rfl)), v3B]
· rw [g (B + 1) (ne_off B (nelit 1 2 rfl)) (n4 1 (ltlit 1 4 rfl)) (n5 1 (ltlit 1 4 rfl)), v3h, b5, b0]
· intro q hq
rw [g q (out_ne hq 2 (ltlit 2 6 rfl)) (out_ne hq 4 (ltlit 4 6 rfl)) (out_ne hq 5 (ltlit 5 6 rfl)), v3o q hq]
| inr b1 =>
-- the bit is 1: the first conditional clears it and increments the quotient, the second is skipped
match ifNZ_spec (B + 2) (B + 4) (.seq (.dec (B + 3)) (.seq (clear (B + 2)) (.inc (B + 1))))
(n4 2 (ltlit 2 4 rfl)) (n5 2 (ltlit 2 4 rfl)) s3
(fun s4 => s4 (B + 3) = 0 ∧ s4 (B + 2) = 0 ∧ s4 (B + 1) = s3 (B + 1) + 1 ∧
∀ q, q ≠ B + 1 → q ≠ B + 2 → q ≠ B + 3 → q ≠ B + 4 → q ≠ B + 4 + 1 → s4 q = s3 q)
(fun _ s0 h0 f0 _ => by
let u1 := upd s0 (B + 3) (s0 (B + 3) - 1)
match clear_ex (B + 2) u1 with
| ⟨u2, ru2, hu2, fu2⟩ =>
refine ⟨upd u2 (B + 1) (u2 (B + 1) + 1), .seq .dec (.seq ru2 .inc), ?_, ?_, ?_, ?_, ?_⟩
· rw [upd_ne _ _ _ _ (fun e => n4 1 (ltlit 1 4 rfl) e.symm), fu2 _ (fun e => n4 2 (ltlit 2 4 rfl) e.symm)]
exact (upd_ne s0 (B + 3) _ (B + 4) (fun e => n4 3 (ltlit 3 4 rfl) e.symm)).trans h0
· rw [upd_ne _ _ _ _ (ne_off B (nelit 3 1 rfl)), fu2 _ (ne_off B (nelit 3 2 rfl))]
show upd s0 (B + 3) (s0 (B + 3) - 1) (B + 3) = 0
rw [upd_eq, f0 _ (n4 3 (ltlit 3 4 rfl)) (n5 3 (ltlit 3 4 rfl)), v3f]
· rw [upd_ne _ _ _ _ (ne_off B (nelit 2 1 rfl)), hu2]
· rw [upd_eq, fu2 _ (ne_off B (nelit 1 2 rfl))]
show upd s0 (B + 3) _ (B + 1) + 1 = _
rw [upd_ne _ _ _ _ (ne_off B (nelit 1 3 rfl)), f0 _ (n4 1 (ltlit 1 4 rfl)) (n5 1 (ltlit 1 4 rfl))]
· intro q q1 q2 q3 q4 q5
rw [upd_ne _ _ _ _ q1, fu2 q q2]
show upd s0 (B + 3) _ q = _
rw [upd_ne _ _ _ _ q3, f0 q q4 q5])
(fun _ hz _ => absurd (v3b.symm.trans hz) (fun e => Nat.noConfusion (b1.symm.trans e))) with
| ⟨s4, r4, h4f, h4b, h4h, f4⟩ =>
match ifNZ_spec (B + 3) (B + 4) (.inc (B + 2)) (n4 3 (ltlit 3 4 rfl)) (n5 3 (ltlit 3 4 rfl)) s4
(fun s5 => ∀ q, q ≠ B + 4 → q ≠ B + 4 + 1 → s5 q = s4 q)
(fun hnz => absurd h4f hnz) (fun _ _ f0 => f0) with
| ⟨s5, r5, f5⟩ =>
have g : ∀ q, q ≠ B + 4 → q ≠ B + 4 + 1 → s5 q = s4 q := f5
refine ⟨s5, .seq (.dec) (.seq r2 (.seq .inc (.seq r4 r5))), ?_, ?_, ?_, ?_⟩
· rw [g B (n4 0 (ltlit 0 4 rfl)) (n5 0 (ltlit 0 4 rfl)),
f4 B n01 n02 n03 (n4 0 (ltlit 0 4 rfl)) (n5 0 (ltlit 0 4 rfl)), v3B]
· rw [g (B + 1) (n4 1 (ltlit 1 4 rfl)) (n5 1 (ltlit 1 4 rfl)), g (B + 2) (n4 2 (ltlit 2 4 rfl)) (n5 2 (ltlit 2 4 rfl)),
h4h, h4b, v3h, b1]
show 2 * (s (B + 1) + 1) + 0 = 2 * s (B + 1) + 1 + 1
rw [Nat.mul_succ, Nat.add_zero]
· exact Or.inl ((g (B + 2) (n4 2 (ltlit 2 4 rfl)) (n5 2 (ltlit 2 4 rfl))).trans h4b)
· intro q hq
rw [g q (out_ne hq 4 (ltlit 4 6 rfl)) (out_ne hq 5 (ltlit 5 6 rfl)),
f4 q (out_ne hq 1 (ltlit 1 6 rfl)) (out_ne hq 2 (ltlit 2 6 rfl)) (out_ne hq 3 (ltlit 3 6 rfl))
(out_ne hq 4 (ltlit 4 6 rfl)) (out_ne hq 5 (ltlit 5 6 rfl)), v3o q hq]
/-- the halving loop: 2h + b grows by the input, which is consumed -/
theorem halve_loop (B : Nat) : (n : Nat) → (s : Store) → s B = n → (s (B + 2) = 0 ∨ s (B + 2) = 1) →
∃ s', Run (.loop B (halveBody B (B + 1) (B + 2) (B + 3) (B + 4))) s s' ∧ s' B = 0 ∧
2 * s' (B + 1) + s' (B + 2) = 2 * s (B + 1) + s (B + 2) + n ∧ (s' (B + 2) = 0 ∨ s' (B + 2) = 1) ∧
∀ q, Out B q → s' q = s q
| 0, s, h, hb => ⟨s, .loopZ h, h, rfl, hb, fun _ _ => rfl⟩
| n + 1, s, h, hb =>
match halveBody_spec B s (fun e => Nat.noConfusion (h.symm.trans e)) hb with
| ⟨s1, r1, h1B, h1s, h1b, f1⟩ =>
match halve_loop B n s1 (by rw [h1B, h]; rfl) h1b with
| ⟨s', r', h'B, h's, h'b, f'⟩ => ⟨s', .loopS (fun e => Nat.noConfusion (h.symm.trans e)) r1 r', h'B,
by rw [h's, h1s, Nat.add_assoc (2 * s (B + 1) + s (B + 2)) 1 n, Nat.add_comm 1 n], h'b,
fun q hq => (f' q hq).trans (f1 q hq)⟩
/-- the store after one round of the doubling loop -/
def SD (s : Store) (x t : Nat) : Store :=
upd (upd (upd s t (s t - 1)) x (upd s t (s t - 1) x + 1)) x (upd (upd s t (s t - 1)) x (upd s t (s t - 1) x + 1) x + 1)
theorem SD_t (s : Store) (x t : Nat) (h : x ≠ t) : SD s x t t = s t - 1 := by
unfold SD
rw [upd_ne _ _ _ _ (fun e => h e.symm), upd_ne _ _ _ _ (fun e => h e.symm), upd_eq]
theorem SD_x (s : Store) (x t : Nat) (h : x ≠ t) : SD s x t x = s x + 2 := by
unfold SD
rw [upd_eq, upd_eq, upd_ne _ _ _ _ h]
theorem SD_o (s : Store) (x t q : Nat) (qx : q ≠ x) (qt : q ≠ t) : SD s x t q = s q := by
unfold SD
rw [upd_ne _ _ _ _ qx, upd_ne _ _ _ _ qx, upd_ne _ _ _ _ qt]
/-- the loop t: (t −1, x +2) -/
theorem dbl_loop (x t : Nat) (h : x ≠ t) : (n : Nat) → (s : Store) → s t = n →
∃ s', Run (.loop t (.seq (.dec t) (.seq (.inc x) (.inc x)))) s s' ∧ s' t = 0 ∧ s' x = s x + 2 * n ∧
∀ q, q ≠ x → q ≠ t → s' q = s q
| 0, s, hs => ⟨s, .loopZ hs, hs, rfl, fun _ _ _ => rfl⟩
| n + 1, s, hs => by
have r1 : Run (.seq (.dec t) (.seq (.inc x) (.inc x))) s (SD s x t) := .seq .dec (.seq .inc .inc)
match dbl_loop x t h n (SD s x t) (by rw [SD_t s x t h, hs]; rfl) with
| ⟨s', r', h't, h'x, f'⟩ =>
refine ⟨s', .loopS (fun e => Nat.noConfusion (hs.symm.trans e)) r1 r', h't, ?_, fun q qx qt => ?_⟩
· rw [h'x, SD_x s x t h, Nat.mul_succ, Nat.add_assoc, Nat.add_comm 2]
· rw [f' q qx qt, SD_o s x t q qx qt]
/-- doubling: x := 2x, through the scratch register t -/
def dbl (x t : Nat) : Prog := .seq (clear t) (.seq (mvBack t x) (.loop t (.seq (.dec t) (.seq (.inc x) (.inc x)))))
theorem dbl_spec (x t : Nat) (h : x ≠ t) (s : Store) :
∃ s', Run (dbl x t) s s' ∧ s' x = 2 * s x ∧ s' t = 0 ∧ ∀ q, q ≠ x → q ≠ t → s' q = s q :=
match clear_ex t s with
| ⟨s1, r1, h1, f1⟩ => match mvBack_spec t x (fun e => h e.symm) (s1 x) s1 rfl with
| ⟨s2, r2, h2x, h2t, f2⟩ => match dbl_loop x t h (s2 t) s2 rfl with
| ⟨s3, r3, h3t, h3x, f3⟩ => ⟨s3, .seq r1 (.seq r2 r3), by
rw [h3x, h2x, h2t, h1, Nat.zero_add, f1 x h, Nat.zero_add], h3t,
fun q qx qt => by rw [f3 q qx qt, f2 q qt qx, f1 q qt]⟩
end RC
end Found
#print axioms Found.RC.once_spec
#print axioms Found.RC.once_skip
#print axioms Found.RC.ifNZ_spec
#print axioms Found.RC.halveBody_spec
#print axioms Found.RC.halve_loop
#print axioms Found.RC.dbl_loop
#print axioms Found.RC.dbl_spec
lean_all/found/RegToMu.lean
/-
T207 (L1, Church–Turing line), part 4. found/RegToMu — register machines
compute μ-recursive functions.
Part A: primitive recursive terms (T81) embed into μ-recursive programs with
the same values (emb_ev); a small library of primitive recursive functions
with their values: constants, predecessor, truncated subtraction, case
distinction, addition, triangular numbers, and Cantor pairing with its
inverse.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.ChurchTuring3
namespace Found
namespace RM
open Rec CT3
mutual
def emb : PR → MR
| .zero => .zero
| .succ => .succ
| .proj i => .proj i
| .comp f gs => .comp (emb f) (embL gs)
| .prec f g => .prec (emb f) (emb g)
def embL : List PR → List MR
| [] => []
| g :: gs => emb g :: embL gs
end
theorem prec_ev (f g : PR) (hf : ∀ a, Ev (emb f) a (eval f a)) (hg : ∀ a, Ev (emb g) a (eval g a))
(rest : List Nat) : ∀ k, Ev (.prec (emb f) (emb g)) (k :: rest) (precIter (eval f) (eval g) k rest)
| 0 => .prec0 (hf rest)
| k + 1 => .precS (prec_ev f g hf hg rest k) (hg _)
mutual
theorem emb_ev : (f : PR) → (a : List Nat) → Ev (emb f) a (eval f a)
| .zero, a => .zero a
| .succ, a => .succ a
| .proj i, a => .proj i a
| .comp f gs, a => .comp (embL_ev gs a) (emb_ev f _)
| .prec f _, [] => .precNil (emb_ev f [])
| .prec f g, k :: rest => prec_ev f g (emb_ev f) (emb_ev g) rest k
theorem embL_ev : (gs : List PR) → (a : List Nat) → EvL (embL gs) a (evalList gs a)
| [], a => .nil a
| g :: gs, a => .cons (emb_ev g a) (embL_ev gs a)
end
/-! ## a library of primitive recursive functions -/
def cst : Nat → PR
| 0 => .zero
| c + 1 => .comp .succ [cst c]
theorem cst_eval (a : List Nat) : (c : Nat) → eval (cst c) a = c
| 0 => rfl
| c + 1 => congrArg (· + 1) (cst_eval a c)
/-- predecessor, at [n] -/
def predP : PR := .prec .zero (.proj 0)
theorem predP_eval : (n : Nat) → eval predP [n] = n - 1
| 0 => rfl
| _ + 1 => rfl
/-- truncated subtraction, at [y, x]: x - y -/
def subRev : PR := .prec (.proj 0) (.comp predP [.proj 1])
theorem subRev_eval (x : Nat) : (y : Nat) → eval subRev [y, x] = x - y
| 0 => rfl
| y + 1 => by
show eval predP [precIter (eval (.proj 0)) (eval (.comp predP [.proj 1])) y [x]] = x - (y + 1)
show eval predP [eval subRev [y, x]] = _
rw [subRev_eval x y, predP_eval]
rfl
/-- x - y, at [x, y] -/
def subP : PR := .comp subRev [.proj 1, .proj 0]
theorem subP_eval (x y : Nat) : eval subP [x, y] = x - y := subRev_eval x y
/-- case distinction, at [c, a, b]: a if c = 0, else b -/
def condP : PR := .prec (.proj 0) (.proj 3)
theorem condP_zero (a b : Nat) : eval condP [0, a, b] = a := rfl
theorem condP_succ (k a b : Nat) : eval condP [k + 1, a, b] = b := rfl
/-- addition, at [x, y] (T81) -/
theorem addP_eval (x y : Nat) : eval addPR [x, y] = x + y := add_correct y x
/-- triangular numbers, at [s]: T(0) = 0, T(s+1) = T(s) + s + 1 -/
def tri : Nat → Nat
| 0 => 0
| s + 1 => tri s + (s + 1)
def triP : PR := .prec .zero (.comp addPR [.proj 1, .comp .succ [.proj 0]])
theorem triP_eval : (s : Nat) → eval triP [s] = tri s
| 0 => rfl
| s + 1 => by
show eval addPR [eval triP [s], s + 1] = tri s + (s + 1)
rw [addP_eval, triP_eval s]
/-! ## Cantor pairing ⟨a, b⟩ = T(a+b) + b and its inverse -/
def leb (x y : Nat) : Nat := match x - y with
| 0 => 1
| _ + 1 => 0
/-- 1 if x ≤ y, else 0; at [x, y] -/
def leP : PR := .comp condP [subP, cst 1, cst 0]
theorem leP_eval (x y : Nat) : eval leP [x, y] = leb x y := by
show eval condP [eval subP [x, y], eval (cst 1) [x, y], eval (cst 0) [x, y]] = leb x y
rw [subP_eval, cst_eval, cst_eval]
unfold leb
cases x - y with
| zero => rfl
| succ _ => rfl
theorem sub_ne_zero : (x y : Nat) → y < x → x - y ≠ 0
| 0, _, h => absurd h (Nat.not_lt_zero _)
| x + 1, 0, _ => fun e => Nat.noConfusion e
| x + 1, y + 1, h => by
rw [Nat.succ_sub_succ]
exact sub_ne_zero x y (Nat.lt_of_succ_lt_succ h)
theorem leb_lt {x y : Nat} (h : y < x) : leb x y = 0 := by
unfold leb
have := sub_ne_zero x y h
cases e : x - y with
| zero => exact absurd e this
| succ _ => rfl
theorem leb_self (x : Nat) : leb x x = 1 := by
unfold leb
rw [Nat.sub_self]
def sfun : Nat → Nat
| 0 => 0
| z + 1 => sfun z + leb (tri (sfun z + 1)) (z + 1)
theorem tri_succ (s : Nat) : tri (s + 1) = tri s + (s + 1) := rfl
theorem sfun_inv : (z : Nat) → tri (sfun z) ≤ z ∧ z < tri (sfun z + 1)
| 0 => ⟨Nat.le_refl 0, Nat.lt_succ_self 0⟩
| z + 1 => by
have ih := sfun_inv z
show tri (sfun z + leb (tri (sfun z + 1)) (z + 1)) ≤ z + 1 ∧
z + 1 < tri (sfun z + leb (tri (sfun z + 1)) (z + 1) + 1)
cases Nat.lt_or_ge (z + 1) (tri (sfun z + 1)) with
| inl hlt =>
rw [leb_lt hlt]
exact ⟨Nat.le_succ_of_le ih.1, hlt⟩
| inr hge =>
have heq : tri (sfun z + 1) = z + 1 := Nat.le_antisymm hge (Nat.succ_le_of_lt ih.2)
rw [heq, leb_self]
refine ⟨Nat.le_of_eq heq, ?_⟩
rw [tri_succ, heq]
exact Nat.lt_add_of_pos_right (Nat.succ_pos _)
theorem tri_mono : {a b : Nat} → a ≤ b → tri a ≤ tri b
| _, _, .refl => Nat.le_refl _
| _, _, .step h => Nat.le_trans (tri_mono h) (Nat.le_add_right _ _)
theorem tri_unique {s s' z : Nat} (h : tri s ≤ z ∧ z < tri (s + 1)) (h' : tri s' ≤ z ∧ z < tri (s' + 1)) :
s = s' := by
cases Nat.lt_or_ge s s' with
| inl hl => exact absurd (Nat.lt_of_lt_of_le h.2 (Nat.le_trans (tri_mono hl) h'.1)) (Nat.lt_irrefl _)
| inr hg =>
cases Nat.lt_or_ge s' s with
| inl hl => exact absurd (Nat.lt_of_lt_of_le h'.2 (Nat.le_trans (tri_mono hl) h.1)) (Nat.lt_irrefl _)
| inr hg' => exact Nat.le_antisymm hg' hg
def pair (a b : Nat) : Nat := tri (a + b) + b
theorem sfun_pair (a b : Nat) : sfun (pair a b) = a + b :=
tri_unique (sfun_inv _) ⟨Nat.le_add_right _ _, by
show tri (a + b) + b < tri (a + b) + (a + b + 1)
exact Nat.add_lt_add_left (Nat.lt_succ_of_le (Nat.le_add_left b a)) _⟩
theorem add_sub_left' : (x y : Nat) → (x + y) - x = y
| 0, y => by rw [Nat.zero_add]; rfl
| x + 1, y => by rw [Nat.succ_add, Nat.succ_sub_succ]; exact add_sub_left' x y
theorem add_sub_right' (a : Nat) : (b : Nat) → (a + b) - b = a
| 0 => rfl
| b + 1 => by rw [Nat.add_succ, Nat.succ_sub_succ]; exact add_sub_right' a b
def sndU (z : Nat) : Nat := z - tri (sfun z)
def fstU (z : Nat) : Nat := sfun z - sndU z
theorem sndU_pair (a b : Nat) : sndU (pair a b) = b := by
unfold sndU
rw [sfun_pair]
exact add_sub_left' _ _
theorem fstU_pair (a b : Nat) : fstU (pair a b) = a := by
unfold fstU
rw [sndU_pair, sfun_pair]
exact add_sub_right' a b
/-! primitive recursive versions -/
def sP : PR := .prec .zero (.comp addPR [.proj 1, .comp leP [.comp triP [.comp .succ [.proj 1]], .comp .succ [.proj 0]]])
theorem sP_eval : (z : Nat) → eval sP [z] = sfun z
| 0 => rfl
| z + 1 => by
show eval addPR [eval sP [z], eval leP [eval triP [eval sP [z] + 1], z + 1]] = _
rw [sP_eval z, triP_eval, leP_eval, addP_eval]
rfl
def sndP : PR := .comp subP [.proj 0, .comp triP [sP]]
def fstP : PR := .comp subP [sP, sndP]
def pairP : PR := .comp addPR [.comp triP [addPR], .proj 1]
theorem sndP_eval (z : Nat) : eval sndP [z] = sndU z := by
show eval subP [z, eval triP [eval sP [z]]] = _
rw [sP_eval, triP_eval, subP_eval]
rfl
theorem fstP_eval (z : Nat) : eval fstP [z] = fstU z := by
show eval subP [eval sP [z], eval sndP [z]] = _
rw [sP_eval, sndP_eval, subP_eval]
rfl
theorem pairP_eval (a b : Nat) : eval pairP [a, b] = pair a b := by
show eval addPR [eval triP [eval addPR [a, b]], b] = _
rw [addP_eval, triP_eval, addP_eval]
rfl
/-! ## Part B: two-counter machines and their μ-recursive simulation -/
inductive Ins where
| inc0 : Nat → Ins
| inc1 : Nat → Ins
| dec0 : Nat → Nat → Ins -- if r0 = 0 goto a else (r0 -= 1, goto b)
| dec1 : Nat → Nat → Ins
| halt : Ins
structure Cf where
pc : Nat
r0 : Nat
r1 : Nat
def fetch : List Ins → Nat → Ins
| [], _ => .halt
| i :: _, 0 => i
| _ :: is, k + 1 => fetch is k
def exec : Ins → Cf → Cf
| .inc0 g, c => ⟨g, c.r0 + 1, c.r1⟩
| .inc1 g, c => ⟨g, c.r0, c.r1 + 1⟩
| .dec0 a b, c => match c.r0 with
| 0 => ⟨a, 0, c.r1⟩
| k + 1 => ⟨b, k, c.r1⟩
| .dec1 a b, c => match c.r1 with
| 0 => ⟨a, c.r0, 0⟩
| k + 1 => ⟨b, c.r0, k⟩
| .halt, c => c
def step (prog : List Ins) (c : Cf) : Cf := exec (fetch prog c.pc) c
def run (prog : List Ins) (c : Cf) : Nat → Cf
| 0 => c
| t + 1 => step prog (run prog c t)
def haltNum : Ins → Nat
| .halt => 0
| .inc0 _ => 1
| .inc1 _ => 1
| .dec0 _ _ => 1
| .dec1 _ _ => 1
def code (c : Cf) : Nat := pair c.pc (pair c.r0 c.r1)
def r0P : PR := .comp fstP [sndP]
def r1P : PR := .comp sndP [sndP]
theorem fst_code (c : Cf) : eval fstP [code c] = c.pc := by rw [fstP_eval]; exact fstU_pair _ _
theorem r0_code (c : Cf) : eval r0P [code c] = c.r0 := by
show eval fstP [eval sndP [code c]] = _
rw [sndP_eval]; unfold code; rw [sndU_pair, fstP_eval, fstU_pair]
theorem r1_code (c : Cf) : eval r1P [code c] = c.r1 := by
show eval sndP [eval sndP [code c]] = _
rw [sndP_eval, sndP_eval]; unfold code; rw [sndU_pair, sndU_pair]
def codeP (pcT r0T r1T : PR) : PR := .comp pairP [pcT, .comp pairP [r0T, r1T]]
theorem codeP_eval (pcT r0T r1T : PR) (a : List Nat) :
eval (codeP pcT r0T r1T) a = code ⟨eval pcT a, eval r0T a, eval r1T a⟩ := by
show eval pairP [eval pcT a, eval pairP [eval r0T a, eval r1T a]] = _
rw [pairP_eval, pairP_eval]
rfl
def effect : Ins → PR
| .inc0 g => codeP (cst g) (.comp .succ [r0P]) r1P
| .inc1 g => codeP (cst g) r0P (.comp .succ [r1P])
| .dec0 a b => .comp condP [r0P, codeP (cst a) r0P r1P, codeP (cst b) (.comp predP [r0P]) r1P]
| .dec1 a b => .comp condP [r1P, codeP (cst a) r0P r1P, codeP (cst b) r0P (.comp predP [r1P])]
| .halt => .proj 0
theorem effect_eval (i : Ins) (c : Cf) : eval (effect i) [code c] = code (exec i c) := by
cases i with
| inc0 g =>
show eval (codeP (cst g) (.comp .succ [r0P]) r1P) [code c] = _
rw [codeP_eval, cst_eval]
show code ⟨g, eval r0P [code c] + 1, eval r1P [code c]⟩ = _
rw [r0_code, r1_code]; rfl
| inc1 g =>
show eval (codeP (cst g) r0P (.comp .succ [r1P])) [code c] = _
rw [codeP_eval, cst_eval]
show code ⟨g, eval r0P [code c], eval r1P [code c] + 1⟩ = _
rw [r0_code, r1_code]; rfl
| dec0 a b =>
show eval condP [eval r0P [code c], eval (codeP (cst a) r0P r1P) [code c],
eval (codeP (cst b) (.comp predP [r0P]) r1P) [code c]] = _
rw [codeP_eval, codeP_eval, cst_eval, cst_eval]
show eval condP [eval r0P [code c], code ⟨a, eval r0P [code c], eval r1P [code c]⟩,
code ⟨b, eval predP [eval r0P [code c]], eval r1P [code c]⟩] = _
rw [r0_code, r1_code, predP_eval]
cases c with
| mk pc r0 r1 => cases r0 with
| zero => rfl
| succ k => rfl
| dec1 a b =>
show eval condP [eval r1P [code c], eval (codeP (cst a) r0P r1P) [code c],
eval (codeP (cst b) r0P (.comp predP [r1P])) [code c]] = _
rw [codeP_eval, codeP_eval, cst_eval, cst_eval]
show eval condP [eval r1P [code c], code ⟨a, eval r0P [code c], eval r1P [code c]⟩,
code ⟨b, eval r0P [code c], eval predP [eval r1P [code c]]⟩] = _
rw [r0_code, r1_code, predP_eval]
cases c with
| mk pc r0 r1 => cases r1 with
| zero => rfl
| succ k => rfl
| halt => rfl
/-- dispatch on the program counter -/
def table : List Ins → PR → PR
| [], _ => .proj 0
| i :: is, pcT => .comp condP [pcT, effect i, table is (.comp predP [pcT])]
theorem table_eval (c : Cf) : (is : List Ins) → (pcT : PR) → (n : Nat) → eval pcT [code c] = n →
eval (table is pcT) [code c] = code (exec (fetch is n) c)
| [], _, _, _ => rfl
| i :: is, pcT, n, h => by
show eval condP [eval pcT [code c], eval (effect i) [code c], eval (table is (.comp predP [pcT])) [code c]] = _
rw [h]
cases n with
| zero => rw [effect_eval]; rfl
| succ k =>
have hk : eval (.comp predP [pcT]) [code c] = k := by
show eval predP [eval pcT [code c]] = k
rw [h, predP_eval]; rfl
rw [table_eval c is _ k hk]
rfl
def stepP (prog : List Ins) : PR := table prog fstP
theorem stepP_eval (prog : List Ins) (c : Cf) : eval (stepP prog) [code c] = code (step prog c) :=
table_eval c prog fstP c.pc (fst_code c)
def htable : List Ins → PR → PR
| [], _ => cst 0
| i :: is, pcT => .comp condP [pcT, cst (haltNum i), htable is (.comp predP [pcT])]
theorem htable_eval (c : Cf) : (is : List Ins) → (pcT : PR) → (n : Nat) → eval pcT [code c] = n →
eval (htable is pcT) [code c] = haltNum (fetch is n)
| [], _, _, _ => rfl
| i :: is, pcT, n, h => by
show eval condP [eval pcT [code c], eval (cst (haltNum i)) [code c], eval (htable is (.comp predP [pcT])) [code c]] = _
rw [h, cst_eval]
cases n with
| zero => rfl
| succ k =>
have hk : eval (.comp predP [pcT]) [code c] = k := by
show eval predP [eval pcT [code c]] = k
rw [h, predP_eval]; rfl
rw [htable_eval c is _ k hk]
rfl
def haltP (prog : List Ins) : PR := htable prog fstP
theorem haltP_eval (prog : List Ins) (c : Cf) : eval (haltP prog) [code c] = haltNum (fetch prog c.pc) :=
htable_eval c prog fstP c.pc (fst_code c)
/-- run, at [t, x, y], from the start configuration ⟨0, x, y⟩ -/
def runP (prog : List Ins) : PR :=
.prec (codeP (cst 0) (.proj 0) (.proj 1)) (.comp (stepP prog) [.proj 1])
theorem runP_eval (prog : List Ins) (x y : Nat) : (t : Nat) →
eval (runP prog) [t, x, y] = code (run prog ⟨0, x, y⟩ t)
| 0 => by
show eval (codeP (cst 0) (.proj 0) (.proj 1)) [x, y] = _
rw [codeP_eval, cst_eval]; rfl
| t + 1 => by
show eval (stepP prog) [eval (runP prog) [t, x, y]] = _
rw [runP_eval prog x y t, stepP_eval]
rfl
/-! ## Part C: the halting time by μ, and the main theorem -/
def hv (prog : List Ins) (x y t : Nat) : Nat := haltNum (fetch prog (run prog ⟨0, x, y⟩ t).pc)
def fM (prog : List Ins) : MR := .comp (emb (haltP prog)) [emb (runP prog)]
theorem ev_f (prog : List Ins) (x y t : Nat) : Ev (fM prog) (t :: [x, y]) (hv prog x y t) := by
have e : eval (haltP prog) [eval (runP prog) [t, x, y]] = hv prog x y t := by
rw [runP_eval, haltP_eval]; rfl
rw [← e]
exact .comp (.cons (emb_ev (runP prog) [t, x, y]) (.nil _)) (emb_ev (haltP prog) _)
def lsearch (prog : List Ins) (x y : Nat) (j : Nat) : Nat → Nat
| 0 => j
| k + 1 => match hv prog x y j with
| 0 => j
| _ + 1 => lsearch prog x y (j + 1) k
theorem search_spec (prog : List Ins) (x y : Nat) : (k j : Nat) → hv prog x y (j + k) = 0 →
MuS (fM prog) [x, y] j (lsearch prog x y j k) ∧ hv prog x y (lsearch prog x y j k) = 0 ∧
∀ i, j ≤ i → i < lsearch prog x y j k → hv prog x y i ≠ 0
| 0, j, h => by
have h0 : hv prog x y j = 0 := h
have ef := ev_f prog x y j
rw [h0] at ef
exact ⟨.stop ef, h0, fun i hi hl => absurd (Nat.lt_of_le_of_lt hi hl) (Nat.lt_irrefl _)⟩
| k + 1, j, h => by
have ef := ev_f prog x y j
cases hj : hv prog x y j with
| zero =>
rw [hj] at ef
show MuS (fM prog) [x, y] j (match hv prog x y j with | 0 => j | _ + 1 => lsearch prog x y (j + 1) k) ∧
hv prog x y (match hv prog x y j with | 0 => j | _ + 1 => lsearch prog x y (j + 1) k) = 0 ∧
∀ i, j ≤ i → i < (match hv prog x y j with | 0 => j | _ + 1 => lsearch prog x y (j + 1) k) → hv prog x y i ≠ 0
rw [hj]
exact ⟨.stop ef, hj, fun i hi hl => absurd (Nat.lt_of_le_of_lt hi hl) (Nat.lt_irrefl _)⟩
| succ n =>
rw [hj] at ef
have h' : hv prog x y (j + 1 + k) = 0 := by rw [Nat.add_right_comm, Nat.add_assoc]; exact h
have ih := search_spec prog x y k (j + 1) h'
show MuS (fM prog) [x, y] j (match hv prog x y j with | 0 => j | _ + 1 => lsearch prog x y (j + 1) k) ∧
hv prog x y (match hv prog x y j with | 0 => j | _ + 1 => lsearch prog x y (j + 1) k) = 0 ∧
∀ i, j ≤ i → i < (match hv prog x y j with | 0 => j | _ + 1 => lsearch prog x y (j + 1) k) → hv prog x y i ≠ 0
rw [hj]
refine ⟨.next ef ih.1, ih.2.1, fun i hi hl => ?_⟩
cases Nat.lt_or_ge i (j + 1) with
| inl hlt =>
have hij : i = j := Nat.le_antisymm (Nat.le_of_lt_succ hlt) hi
rw [hij, hj]
exact fun e => Nat.noConfusion e
| inr hge => exact ih.2.2 i hge hl
/-- the μ-recursive program computing a two-counter machine's output -/
def F (prog : List Ins) : MR :=
.comp (emb r0P) [.comp (emb (runP prog)) [.mu (fM prog), .proj 0, .proj 1]]
/-- register machines → μ-recursive: if the machine halts from ⟨0, x, y⟩ at some
time t0, then F prog evaluates on [x, y] to r0 at the first halting time -/
theorem reg_to_mu (prog : List Ins) (x y t0 : Nat) (h : hv prog x y t0 = 0) :
Ev (F prog) [x, y] (run prog ⟨0, x, y⟩ (lsearch prog x y 0 t0)).r0 ∧
hv prog x y (lsearch prog x y 0 t0) = 0 ∧ ∀ i, i < lsearch prog x y 0 t0 → hv prog x y i ≠ 0 := by
have hs := search_spec prog x y t0 0 (by rw [Nat.zero_add]; exact h)
refine ⟨?_, hs.2.1, fun i hl => hs.2.2 i (Nat.zero_le i) hl⟩
generalize lsearch prog x y 0 t0 = m at hs
have er : eval r0P [eval (runP prog) [m, x, y]] = (run prog ⟨0, x, y⟩ m).r0 := by
rw [runP_eval, r0_code]
rw [← er]
exact .comp (.cons (.comp (.cons (.mu hs.1) (.cons (.proj 0 [x, y]) (.cons (.proj 1 [x, y]) (.nil _))))
(emb_ev (runP prog) [m, x, y])) (.nil _)) (emb_ev r0P _)
end RM
end Found
#print axioms Found.RM.emb_ev
#print axioms Found.RM.subP_eval
#print axioms Found.RM.triP_eval
#print axioms Found.RM.fstU_pair
#print axioms Found.RM.sndU_pair
#print axioms Found.RM.fstP_eval
#print axioms Found.RM.pairP_eval
#print axioms Found.RM.effect_eval
#print axioms Found.RM.stepP_eval
#print axioms Found.RM.runP_eval
#print axioms Found.RM.search_spec
#print axioms Found.RM.reg_to_mu
lean_all/found/Register.lean
/-
T145. found/Register — register machines as a point: two-counter Minsky
machines (universal, Minsky, cited) with small-step semantics on the
relation coordinate.
* Instructions: inc r, decjz r j (decrement, or jump to j if zero), halt.
* An addition program: from (pc 0, x, y) it reaches halt with r₀ = x + y
(by induction on y) — the line to μ-recursive addition (T81).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Reg
inductive Ins where
| inc0 : Nat → Ins -- r0 += 1, goto
| dec1 : Nat → Nat → Ins -- if r1 = 0 goto a else (r1 -= 1, goto b)
| halt : Ins
structure Conf where
pc : Nat
r0 : Nat
r1 : Nat
def fetch : List Ins → Nat → Ins
| [], _ => .halt
| i :: _, 0 => i
| _ :: is, k + 1 => fetch is k
inductive Step (prog : List Ins) : Conf → Conf → Prop where
| inc {c : Conf} {g : Nat} : fetch prog c.pc = .inc0 g → Step prog c ⟨g, c.r0 + 1, c.r1⟩
| zero {c : Conf} {a b : Nat} : fetch prog c.pc = .dec1 a b → c.r1 = 0 → Step prog c ⟨a, c.r0, c.r1⟩
| dec {c : Conf} {a b : Nat} {k : Nat} : fetch prog c.pc = .dec1 a b → c.r1 = k + 1 → Step prog c ⟨b, c.r0, k⟩
inductive Steps (prog : List Ins) : Conf → Conf → Prop where
| refl (c : Conf) : Steps prog c c
| step {a b c : Conf} : Step prog a b → Steps prog b c → Steps prog a c
theorem steps_trans {prog : List Ins} {a b c : Conf} (h : Steps prog a b) (k : Steps prog b c) : Steps prog a c := by
induction h with
| refl => exact k
| step s _ ih => exact .step s (ih k)
/-- 0: if r1 = 0 goto 2 else (r1 -= 1, goto 1); 1: r0 += 1, goto 0; 2: halt -/
def addProg : List Ins := [.dec1 2 1, .inc0 0, .halt]
theorem add_runs (x : Nat) : ∀ y, Steps addProg ⟨0, x, y⟩ ⟨2, x + y, 0⟩
| 0 => .step (.zero (a := 2) (b := 1) rfl rfl) (.refl _)
| y + 1 => by
have h1 : Step addProg ⟨0, x, y + 1⟩ ⟨1, x, y⟩ := .dec (a := 2) (b := 1) rfl rfl
have h2 : Step addProg ⟨1, x, y⟩ ⟨0, x + 1, y⟩ := .inc (g := 0) rfl
have ih := add_runs (x + 1) y
rw [Nat.add_assoc, Nat.add_comm 1 y] at ih
exact .step h1 (.step h2 ih)
theorem halts_at (x y : Nat) : fetch addProg (⟨2, x + y, 0⟩ : Conf).pc = .halt := rfl
end Reg
end Found
#print axioms Found.Reg.steps_trans
#print axioms Found.Reg.add_runs
#print axioms Found.Reg.halts_at
lean_all/found/Relevant.lean
/-
T69. found/Relevant — substructural logics as two conditions on the same
models (commutative residuated lattices with !, T68).
* Weakening W : a ⊗ b ≤ a (affine)
* Contraction C : a ≤ a ⊗ a (relevant)
linear = neither, affine = W, relevant = C, intuitionistic = W + C (T68 toHA).
* Sugihara RM3 (−1 < 0 < 1) satisfies C but not W; Łukasiewicz Ł3 satisfies
W but not C. Hence linear logic proves neither p ⊸ (q ⊸ p) nor p ⊸ p ⊗ p,
the relevant models validate contraction, the affine ones weakening.
* Relevant and affine models with both conditions are Heyting algebras, so
each corner of the square erases into intuitionistic logic.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Linear
universe u
namespace Found
namespace Lin
def Weakening (M : CRL) : Prop := ∀ a b, M.le (M.tens a b) a
def Contraction (M : CRL) : Prop := ∀ a, M.le a (M.tens a a)
/-! ## Sugihara RM3 -/
inductive RM where
| n : RM
| e : RM
| p : RM
namespace RM
def rk : RM → Nat
| n => 0
| e => 1
| p => 2
def le (a b : RM) : Prop := Nat.ble (rk a) (rk b) = true
def tens : RM → RM → RM
| n, n => n
| n, e => n
| n, p => n
| e, n => n
| e, e => e
| e, p => p
| p, n => n
| p, e => p
| p, p => p
def lolli : RM → RM → RM
| n, n => p
| n, e => p
| n, p => p
| e, n => n
| e, e => e
| e, p => p
| p, n => n
| p, e => n
| p, p => p
def wth : RM → RM → RM
| n, n => n
| n, e => n
| n, p => n
| e, n => n
| e, e => e
| e, p => e
| p, n => n
| p, e => e
| p, p => p
def pls : RM → RM → RM
| n, n => n
| n, e => e
| n, p => p
| e, n => e
| e, e => e
| e, p => p
| p, n => p
| p, e => p
| p, p => p
def bang : RM → RM
| n => n
| e => e
| p => e
def M : CRL where
car := RM
le := le
le_refl a := by cases a <;> rfl
le_trans {a b c} := by cases a <;> cases b <;> cases c <;> intro x y <;> first | rfl | exact x | exact y
one := e
tens := tens
lolli := lolli
wth := wth
pls := pls
zero := n
bang := bang
tens_mono {a a' b b'} := by
cases a <;> cases a' <;> cases b <;> cases b' <;> intro x y <;> first | rfl | exact x | exact y
tens_comm a b := by cases a <;> cases b <;> rfl
assoc1 a b c := by cases a <;> cases b <;> cases c <;> rfl
assoc2 a b c := by cases a <;> cases b <;> cases c <;> rfl
unit1 a := by cases a <;> rfl
unit2 a := by cases a <;> rfl
adj {a b c} := by cases a <;> cases b <;> cases c <;> exact ⟨fun x => x, fun x => x⟩
wth_l a b := by cases a <;> cases b <;> rfl
wth_r a b := by cases a <;> cases b <;> rfl
wth_univ {a b c} := by cases a <;> cases b <;> cases c <;> intro x y <;> first | rfl | exact x | exact y
pls_l a b := by cases a <;> cases b <;> rfl
pls_r a b := by cases a <;> cases b <;> rfl
pls_univ {a b c} := by cases a <;> cases b <;> cases c <;> intro x y <;> first | rfl | exact x | exact y
zero_le a := by cases a <;> rfl
bang_le a := by cases a <;> rfl
bang_unit a := by cases a <;> rfl
bang_dup a := by cases a <;> rfl
theorem tens_n (c : RM) : tens n c = n := by cases c <;> rfl
theorem tens_e (c : RM) : tens e c = c := by cases c <;> rfl
theorem ctx_bang : (l : List RM) → M.ctx (l.map bang) = e ∨ M.ctx (l.map bang) = n
| [] => Or.inl rfl
| n :: _ => Or.inr (tens_n _)
| e :: l => match ctx_bang l with
| Or.inl q => Or.inl ((tens_e _).trans q)
| Or.inr q => Or.inr ((tens_e _).trans q)
| p :: l => match ctx_bang l with
| Or.inl q => Or.inl ((tens_e _).trans q)
| Or.inr q => Or.inr ((tens_e _).trans q)
theorem key : (c a : RM) → (c = e ∨ c = n) → le c a → le c (bang a)
| e, n, _, k => k
| e, e, _, _ => rfl
| e, p, _, _ => rfl
| n, _, _, _ => rfl
| p, _, q, _ => q.elim (fun r => RM.noConfusion r) (fun r => RM.noConfusion r)
theorem prom : M.PromOK := fun l a k => key _ a (ctx_bang l) k
theorem contraction : Contraction M := fun a => by cases a <;> rfl
theorem not_weakening : ¬ Weakening M := fun h => Bool.noConfusion (h e p)
end RM
/-! ## The square -/
theorem L3_weakening : Weakening L3.M3 := fun a b => by cases a <;> cases b <;> rfl
theorem L3_not_contraction : ¬ Contraction L3.M3 := fun h => Bool.noConfusion (h L3.h)
/-- linear logic does not prove weakening p ⊸ (q ⊸ p) -/
theorem no_weakening : ¬ LD [] (.lolli (.var 0) (.lolli (.var 1) (.var 0))) :=
fun d => Bool.noConfusion
(soundness RM.M (fun k => match k with | 0 => RM.e | _ => RM.p) RM.prom d)
/-- every Heyting algebra (as a model) has both weakening and contraction -/
theorem ofHA_weakening (H : HA.{u}) : Weakening (ofHA H) := fun a b => H.meet_l a b
theorem ofHA_contraction (H : HA.{u}) : Contraction (ofHA H) :=
fun a => H.meet_univ (H.le_refl a) (H.le_refl a)
/-- relevant + affine = intuitionistic: both conditions give a Heyting algebra -/
def relAffToHA (M : CRL.{u}) (w : Weakening M) (c : Contraction M) : HA.{u} := toHA M w c
end Lin
end Found
#print axioms Found.Lin.RM.M
#print axioms Found.Lin.RM.prom
#print axioms Found.Lin.RM.contraction
#print axioms Found.Lin.RM.not_weakening
#print axioms Found.Lin.L3_weakening
#print axioms Found.Lin.L3_not_contraction
#print axioms Found.Lin.no_weakening
#print axioms Found.Lin.ofHA_weakening
#print axioms Found.Lin.ofHA_contraction
#print axioms Found.Lin.relAffToHA
lean_all/found/RootAnomaly.lean
/-
T324. found/RootAnomaly -- one generation's hypercharges are fixed by anomaly
cancellation (a finite algebraic computation, carried to the end).
One generation, all fields left-handed (T322: right-handed fields enter as conjugates),
with hypercharges in units of 1/6 and the normalisation y_Q = 1:
Q (3, 2) y_Q = 1 u^c (3bar, 1) y_u d^c (3bar, 1) y_d
L (1, 2) y_L e^c (1, 1) y_e
The anomalies that must vanish (gauge group SU(3) x SU(2) x U(1), already in the chain):
SU(3)^2 U(1): 2 y_Q + y_u + y_d = 0
SU(2)^2 U(1): 3 y_Q + y_L = 0
gravity^2 U(1): 6 y_Q + 3 y_u + 3 y_d + 2 y_L + y_e = 0
U(1)^3: 6 y_Q^3 + 3 y_u^3 + 3 y_d^3 + 2 y_L^3 + y_e^3 = 0
Theorem: over the integers these force y_L = -3, y_e = 6 and (y_u, y_d) = (-4, 2) or
(2, -4) -- the Standard Model, up to the names of u and d. Ring identities by the shared
library's normaliser (lib_int, no axioms); integers without zero divisors (int_noZD).
Written with ASCII forms only. CIC dependence: none.
-/
import lib.IntRing
namespace Found.RootAnomaly
open LibInt
/-- The Standard Model values satisfy the four conditions. -/
theorem sm_cancels :
2 * 1 + (-4) + 2 = (0 : Int) /\ 3 * 1 + (-3) = (0 : Int) /\
6 * 1 + 3 * (-4) + 3 * 2 + 2 * (-3) + 6 = (0 : Int) /\
6 * 1 + 3 * ((-4) * (-4) * (-4)) + 3 * (2 * 2 * 2) + 2 * ((-3) * (-3) * (-3)) + 6 * 6 * 6 = (0 : Int) :=
And.intro rfl (And.intro rfl (And.intro rfl rfl))
/-- Anomaly cancellation fixes the hypercharges of one generation. -/
theorem hypercharges (yu yd yL ye : Int)
(h3 : 2 * 1 + yu + yd = 0)
(h2 : 3 * 1 + yL = 0)
(hg : 6 * 1 + 3 * yu + 3 * yd + 2 * yL + ye = 0)
(hc : 6 * 1 + 3 * (yu * yu * yu) + 3 * (yd * yd * yd) + 2 * (yL * yL * yL) + ye * ye * ye = 0) :
yL = -3 /\ ye = 6 /\ ((yu = -4 /\ yd = 2) \/ (yu = 2 /\ yd = -4)) := by
have hL : yL = -3 := by
calc yL = (3 * 1 + yL) + -3 := by lib_int
_ = 0 + -3 := by rw [h2]
_ = -3 := by lib_int
have hd : yd = -2 + -yu := by
calc yd = (2 * 1 + yu + yd) + (-2 + -yu) := by lib_int
_ = 0 + (-2 + -yu) := by rw [h3]
_ = -2 + -yu := by lib_int
have he : ye = 6 := by
rw [hd, hL] at hg
calc ye = (6 * 1 + 3 * yu + 3 * (-2 + -yu) + 2 * -3 + ye) + 6 := by lib_int
_ = 0 + 6 := by rw [hg]
_ = 6 := by lib_int
rw [hd, hL, he] at hc
have key : (-18) * ((yu + 4) * (yu + -2)) = 0 := by
calc (-18) * ((yu + 4) * (yu + -2))
= 6 * 1 + 3 * (yu * yu * yu) + 3 * ((-2 + -yu) * (-2 + -yu) * (-2 + -yu))
+ 2 * (-3 * -3 * -3) + 6 * 6 * 6 := by lib_int
_ = 0 := hc
have hz : (yu + 4) * (yu + -2) = 0 := by
cases int_noZD (-18) ((yu + 4) * (yu + -2)) key with
| inl h => exact absurd h (fun e => Int.noConfusion e)
| inr h => exact h
refine And.intro hL (And.intro he ?_)
cases int_noZD (yu + 4) (yu + -2) hz with
| inl h =>
have h0 : yu + 4 = 0 := h
have hu : yu = -4 := by
calc yu = (yu + 4) + -4 := by lib_int
_ = 0 + -4 := by rw [h0]
_ = -4 := by lib_int
refine Or.inl (And.intro hu ?_)
rw [hd, hu]
rfl
| inr h =>
have h0 : yu + -2 = 0 := h
have hu : yu = 2 := by
calc yu = (yu + -2) + 2 := by lib_int
_ = 0 + 2 := by rw [h0]
_ = 2 := by lib_int
refine Or.inr (And.intro hu ?_)
rw [hd, hu]
rfl
end Found.RootAnomaly
#print axioms Found.RootAnomaly.sm_cancels
#print axioms Found.RootAnomaly.hypercharges
lean_all/found/RootBloch.lean
/-
T327. found/RootBloch -- condensed matter, a branch: the discrete translation group and
Bloch's theorem.
Wave functions on the integer lattice with values in the chain's complex numbers
(OneMove link 26, Gaussian integers). The translation T psi(x) = psi(x + 1) generates
the discrete translation group (the shifts of T326).
* the tight-binding Hamiltonian H psi(x) = psi(x + 1) + psi(x - 1) commutes with T;
* Bloch's theorem: if psi is an eigenfunction of T, T psi = lambda psi, then
psi(x + n) = lambda^n psi(x) for every n -- the wave function is a plane wave
lambda^x times its value in one cell.
Written with ASCII forms only. CIC dependence: none.
-/
import found.user.OneMove
import lib.IntRing
namespace Found.RootBloch
open OneMove LibInt
theorem pair_eq {A B : Type} {u v : Pair A B} (h1 : p1 u = p1 v) (h2 : p2 u = p2 v) : u = v := by
cases u
cases v
cases h1
cases h2
rfl
/-- Multiplication of the chain's complex numbers is associative. -/
theorem cmul_assoc (a b c : Cx) : cmul a (cmul b c) = cmul (cmul a b) c := by
apply pair_eq
· show p1 a * (p1 b * p1 c - p2 c * p2 b) - (p2 c * p1 b + p2 b * p1 c) * p2 a
= (p1 a * p1 b - p2 b * p2 a) * p1 c - p2 c * (p2 b * p1 a + p2 a * p1 b)
lib_int
· show (p2 c * p1 b + p2 b * p1 c) * p1 a + p2 a * (p1 b * p1 c - p2 c * p2 b)
= p2 c * (p1 a * p1 b - p2 b * p2 a) + (p2 b * p1 a + p2 a * p1 b) * p1 c
lib_int
/-- Translation by one cell. -/
def T (psi : Int -> Cx) : Int -> Cx := fun x => psi (x + 1)
/-- The tight-binding Hamiltonian. -/
def H (psi : Int -> Cx) : Int -> Cx := fun x => cadd (psi (x + 1)) (psi (x + -1))
/-- H commutes with the translations. -/
theorem H_T (psi : Int -> Cx) (x : Int) : T (H psi) x = H (T psi) x := by
show cadd (psi (x + 1 + 1)) (psi (x + 1 + -1)) = cadd (psi (x + 1 + 1)) (psi (x + -1 + 1))
have e : x + 1 + -1 = x + -1 + 1 := by lib_int
rw [e]
def cpow (l : Cx) : Nat -> Cx
| 0 => c1
| n + 1 => cmul l (cpow l n)
/-- Bloch's theorem: an eigenfunction of the translation is a plane wave. -/
theorem bloch (psi : Int -> Cx) (l : Cx) (eig : forall x, psi (x + 1) = cmul l (psi x)) (x : Int) :
forall n : Nat, psi (x + Int.ofNat n) = cmul (cpow l n) (psi x)
| 0 => by
show psi (x + 0) = cmul c1 (psi x)
have e : x + 0 = x := by lib_int
rw [e]
apply pair_eq
· show p1 (psi x) = 1 * p1 (psi x) - p2 (psi x) * 0
lib_int
· show p2 (psi x) = p2 (psi x) * 1 + 0 * p1 (psi x)
lib_int
| n + 1 => by
have e : x + Int.ofNat (n + 1) = (x + Int.ofNat n) + 1 := by
show x + (Int.ofNat n + 1) = x + Int.ofNat n + 1
lib_int
rw [e, eig, bloch psi l eig x n, cmul_assoc]
rfl
end Found.RootBloch
#print axioms Found.RootBloch.pair_eq
#print axioms Found.RootBloch.cmul_assoc
#print axioms Found.RootBloch.H_T
#print axioms Found.RootBloch.bloch
lean_all/found/RootBundle.lean
/-
T321. found/RootBundle -- the group of the chain, the Lie algebra sl(2) and the
exponential map, principal bundles, connections, curvature and the non-abelian
Bianchi identity, as a root of the chain.
The group is not derived anew; it is what the one-source chain (OneMove) already has:
* composition: maps in a row (links 9-12, comp_assoc by rfl);
* identity: id (link 1), carried as the pair diag id (link 4);
* inverse: a pair (f, g) of maps flipped by the swap sw (links 1-8);
* inverse laws: the two triangle equalities of the pair, g (f x) = x and f (g x) = x.
`group_from_chain` collects the four. Nothing is assumed beyond them.
Then: integers (link 23) -> 2x2 integer matrices -> the Lie algebra sl(2) with the
commutator bracket and the exponential of a nilpotent element; the principal bundle
(site, group element) with the group acting on the right; connections (a pair per
edge), gauge change and curvature (the Yang-Mills case: F' = k^-1 F k); and the
Bianchi identity, non-abelian: on a cube with arbitrary invertible transports on its
twelve edges, the six face holonomies carried to one corner multiply to the identity.
With the frame group it is the second Bianchi identity of general relativity; with
U(1) it is dF = 0.
Written with ASCII forms only (the paper's listing font).
CIC dependence: the unit laws hold by rfl through definitional eta (functions and
structures).
-/
import found.user.OneMove
namespace Found.RootBundle
open OneMove
/-! ## The group of the chain -/
variable {X : Type}
/-- The two triangle equalities of a pair of maps (f, g): g after f and f after g are id. -/
def Inv (p : Pair (X -> X) (X -> X)) : Prop :=
(forall x, p2 p (p1 p x) = x) /\ (forall x, p1 p (p2 p x) = x)
/-- Composition (first p, then q), on both members of the pairs. -/
def gcomp (p q : Pair (X -> X) (X -> X)) : Pair (X -> X) (X -> X) :=
Pair.mk (fun x => p1 q (p1 p x)) (fun x => p2 p (p2 q x))
/-- The group of the chain: associativity and the unit laws by rfl, the inverse laws from the
triangle equalities of the pair, and composition keeps the triangle equalities. -/
theorem group_from_chain (p q r : Pair (X -> X) (X -> X)) :
gcomp (gcomp p q) r = gcomp p (gcomp q r) /\
gcomp (diag idf) p = p /\ gcomp p (diag idf) = p /\
(Inv p -> (forall x, p1 (gcomp p (sw p)) x = x) /\ (forall x, p1 (gcomp (sw p) p) x = x)) /\
(Inv p -> Inv q -> Inv (gcomp p q)) :=
And.intro rfl (And.intro rfl (And.intro rfl (And.intro
(fun h => And.intro h.1 h.2)
(fun hp hq => And.intro
(fun x => Eq.trans (congrArg (p2 p) (hq.1 (p1 p x))) (hp.1 x))
(fun x => Eq.trans (congrArg (p1 q) (hp.2 (p2 q x))) (hq.2 x))))))
/-! ## Lie algebra sl(2) and the exponential map, on 2x2 integer matrices -/
structure M2 where
a : Int
b : Int
c : Int
d : Int
def mmul (x y : M2) : M2 :=
M2.mk (x.a * y.a + x.b * y.c) (x.a * y.b + x.b * y.d) (x.c * y.a + x.d * y.c) (x.c * y.b + x.d * y.d)
def msub (x y : M2) : M2 := M2.mk (x.a - y.a) (x.b - y.b) (x.c - y.c) (x.d - y.d)
def msmul (k : Int) (x : M2) : M2 := M2.mk (k * x.a) (k * x.b) (k * x.c) (k * x.d)
/-- The commutator bracket. -/
def br (x y : M2) : M2 := msub (mmul x y) (mmul y x)
def he : M2 := M2.mk 0 1 0 0
def hf : M2 := M2.mk 0 0 1 0
def hh : M2 := M2.mk 1 0 0 (-1)
theorem sl2_he : br hh he = msmul 2 he := rfl
theorem sl2_hf : br hh hf = msmul (-2) hf := rfl
theorem sl2_ef : br he hf = hh := rfl
/-- The exponential of the nilpotent `t e` (its square is zero): `1 + t e`. -/
def expE (t : Int) : M2 := M2.mk 1 t 0 1
theorem he_sq : mmul he he = M2.mk 0 0 0 0 := rfl
/-! Four facts of integer multiplication, by cases on the integer. -/
theorem i_mul_zero (s : Int) : s * 0 = 0 := by cases s <;> rfl
theorem i_zero_mul (t : Int) : 0 * t = 0 := by
cases t with
| ofNat m => exact congrArg Int.ofNat (Nat.zero_mul m)
| negSucc m => exact congrArg Int.negOfNat (Nat.zero_mul (Nat.succ m))
theorem i_one_mul (t : Int) : 1 * t = t := by
cases t with
| ofNat m => exact congrArg Int.ofNat (Nat.one_mul m)
| negSucc m => exact congrArg Int.negOfNat (Nat.one_mul (Nat.succ m))
theorem i_mul_one (s : Int) : s * 1 = s := by
cases s with
| ofNat n => exact congrArg Int.ofNat (Nat.mul_one n)
| negSucc n => exact congrArg Int.negOfNat (Nat.mul_one (Nat.succ n))
/-- One-parameter group law: exp(s e) exp(t e) = exp((t + s) e). -/
theorem expE_add (s t : Int) : mmul (expE s) (expE t) = expE (t + s) := by
show M2.mk (1 * 1 + s * 0) (1 * t + s * 1) (0 * 1 + 1 * 0) (0 * t + 1 * 1) = M2.mk 1 (t + s) 0 1
rw [i_mul_zero s, i_one_mul t, i_mul_one s, i_zero_mul t]
rfl
/-! ## Principal bundle and connection -/
/-- The right action on the principal bundle over the sites `S`: (site, group element). -/
def act {S : Type} (p : Pair S (Pair (X -> X) (X -> X))) (h : Pair (X -> X) (X -> X)) :
Pair S (Pair (X -> X) (X -> X)) := Pair.mk (p1 p) (gcomp (p2 p) h)
theorem act_fibre {S : Type} (p : Pair S (Pair (X -> X) (X -> X))) (h : Pair (X -> X) (X -> X)) :
p1 (act p h) = p1 p := rfl
/-- The action is free: if h moves no point of the fibre, h acts as the identity. -/
theorem act_free {S : Type} (p : Pair S (Pair (X -> X) (X -> X))) (h : Pair (X -> X) (X -> X))
(hp : Inv (p2 p)) (e : forall x, p1 (p2 (act p h)) x = p1 (p2 p) x) :
forall y, p1 h y = y := by
intro y
have t2 : p1 h (p1 (p2 p) (p2 (p2 p) y)) = p1 (p2 p) (p2 (p2 p) y) := e (p2 (p2 p) y)
have r : p1 (p2 p) (p2 (p2 p) y) = y := hp.2 y
rw [r] at t2
exact t2
/-- Gauge change by k at every site: first k(x)^-1, then U(x,y), then k(y). -/
def gauge {S : Type} (k : S -> Pair (X -> X) (X -> X)) (U : S -> S -> Pair (X -> X) (X -> X)) :
S -> S -> Pair (X -> X) (X -> X) :=
fun x y => gcomp (gcomp (sw (k x)) (U x y)) (k y)
/-- Curvature on the plaquette x1 x2 x3 x4: the holonomy around it. -/
def curv {S : Type} (U : S -> S -> Pair (X -> X) (X -> X)) (x1 x2 x3 x4 : S) : Pair (X -> X) (X -> X) :=
gcomp (gcomp (gcomp (U x1 x2) (U x2 x3)) (U x3 x4)) (U x4 x1)
/-- Curvature changes covariantly: F' = k(x1)^-1 F k(x1) (the Yang-Mills case). -/
theorem curv_gauge {S : Type} (k : S -> Pair (X -> X) (X -> X)) (hk : forall s, Inv (k s))
(U : S -> S -> Pair (X -> X) (X -> X)) (x1 x2 x3 x4 : S) (v : X) :
p1 (curv (gauge k U) x1 x2 x3 x4) v = p1 (gcomp (gcomp (sw (k x1)) (curv U x1 x2 x3 x4)) (k x1)) v := by
show p1 (k x1) (p1 (U x4 x1) (p2 (k x4) (p1 (k x4) (p1 (U x3 x4) (p2 (k x3) (p1 (k x3) (p1 (U x2 x3) (p2 (k x2) (p1 (k x2) (p1 (U x1 x2) (p2 (k x1) (v)))))))))))) = p1 (k x1) (p1 (U x4 x1) (p1 (U x3 x4) (p1 (U x2 x3) (p1 (U x1 x2) (p2 (k x1) v)))))
rw [(hk x2).1, (hk x3).1, (hk x4).1]
/-! ## The Bianchi identity (non-abelian) -/
/-- The cube 0..7 (0 = (0,0,0), 1 = (1,0,0), 2 = (0,1,0), 3 = (1,1,0), 4 = (0,0,1), ...) with
transports on its twelve edges: x-edges ua 0->1, ub 2->3, uc 4->5, ud 6->7; y-edges ue 0->2,
uf 1->3, ug 4->6, uh 5->7; z-edges ui 0->4, uj 1->5, uk 2->6, ul 3->7 (each a pair with its
triangle equalities; p1 walks the edge forwards, p2 backwards). Faces as loops: bottom 0-1-3-2,
front 0-1-5-4 at 0, right 1-3-7-5 at 1, back 3-2-6-7 at 3, left 2-0-4-6 at 2, top 4-5-7-6 at 4.
Bianchi: the bottom holonomy equals the product of the other five, each carried to the corner 0
along the paths p1 = 0-4-5-1, p3 = p1 1-5-7-3, p2 = p3 3-7-6-2, and 0-4 for the top:
bottom = front * p1 right p1^-1 * p3 back p3^-1 * p2 left p2^-1 * (0-4) top (0-4)^-1.
As one walk -- bottom^-1, then the right side -- it is the word
e b F A a j C I i c J f l H J j h L B k d L l D K E i g K k G I
(capital = edge walked backwards), and it acts as the identity on every point. -/
theorem bianchi (ua ub uc ud ue uf ug uh ui uj uk ul : Pair (X -> X) (X -> X))
(ha : Inv ua) (hb : Inv ub) (hc : Inv uc) (hd : Inv ud) (he : Inv ue) (hf : Inv uf) (hg : Inv ug) (hh : Inv uh) (hi : Inv ui) (hj : Inv uj) (hk : Inv uk) (hl : Inv ul) (x : X) :
p2 ui (p2 ug (p1 uk (p2 uk (p1 ug (p1 ui (p2 ue (p2 uk (p2 ud (p1 ul (p2 ul (p1 ud (p1 uk (p2 ub (p2 ul (p1 uh (p1 uj (p2 uj (p2 uh (p1 ul (p1 uf (p2 uj (p1 uc (p1 ui (p2 ui (p2 uc (p1 uj (p1 ua (p2 ua (p2 uf (p1 ub (p1 ue (x)))))))))))))))))))))))))))))))) = x := by
repeat (first | rw [ha.1] | rw [ha.2] | rw [hb.1] | rw [hb.2] | rw [hc.1] | rw [hc.2] | rw [hd.1] | rw [hd.2] | rw [he.1] | rw [he.2] | rw [hf.1] | rw [hf.2] | rw [hg.1] | rw [hg.2] | rw [hh.1] | rw [hh.2] | rw [hi.1] | rw [hi.2] | rw [hj.1] | rw [hj.2] | rw [hk.1] | rw [hk.2] | rw [hl.1] | rw [hl.2])
end Found.RootBundle
#print axioms Found.RootBundle.group_from_chain
#print axioms Found.RootBundle.sl2_he
#print axioms Found.RootBundle.sl2_hf
#print axioms Found.RootBundle.sl2_ef
#print axioms Found.RootBundle.he_sq
#print axioms Found.RootBundle.i_mul_zero
#print axioms Found.RootBundle.i_zero_mul
#print axioms Found.RootBundle.i_one_mul
#print axioms Found.RootBundle.i_mul_one
#print axioms Found.RootBundle.expE_add
#print axioms Found.RootBundle.act_fibre
#print axioms Found.RootBundle.act_free
#print axioms Found.RootBundle.curv_gauge
#print axioms Found.RootBundle.bianchi
lean_all/found/RootComp.lean
/-
T329. found/RootComp -- computation: computability, undecidability of halting,
P and NP, SAT, one-way functions.
From the chain: the lambda link (37) and its translations -- mu-recursive programs,
lambda terms, register and Turing machines are equivalent (the Church-Turing line,
T207: ChurchTuring2/3, TMSim, Minsky1-3, LamMu1-4). The halting problem is
undecidable: no mu-recursive program decides it (T96b, Found.K1.no_halting_realizer),
restated here.
* P and NP, relative to a machine model with fuel-bounded runs (any model of the
Church-Turing line);
* SAT: CNF formulas and their evaluation; the certificate check costs exactly the size
of the formula (linear time), so SAT has polynomial-time verification;
* one-way functions: the definition (easy to compute, hard to invert on average).
Cook-Levin (SAT is NP-complete; Cook 1971, Levin 1973) is a proved theorem, not yet
formalized here. Cryptography (lattices, LWE) is a branch, linked only.
Written with ASCII forms only. CIC dependence: none.
-/
import found.EffectiveK1
namespace Found.RootComp
/-- Halting is undecidable (the chain's diagonal argument, T96b). -/
theorem halting_undecidable : Not (Exists fun d : Found.CT3.MR => Found.K1.RealizesDec d Found.K1.Halts) :=
Found.K1.no_halting_realizer
/-! ## P and NP relative to a machine model -/
/-- A machine model: programs, and a run with a step budget (none = not finished). -/
structure Machine where
Prog : Type
run : Prog -> Nat -> List Bool -> Option Bool
/-- A polynomial bound c * n^k + c. -/
def pbound (c k n : Nat) : Nat := c * n ^ k + c
/-- L is in P: one program decides it within a polynomial number of steps. -/
def InP (M : Machine) (L : List Bool -> Bool) : Prop :=
Exists fun p : M.Prog => Exists fun c => Exists fun k =>
forall x, M.run p (pbound c k x.length) x = some (L x)
/-- L is in NP: one program checks certificates of polynomial length in polynomial time. -/
def InNP (M : Machine) (L : List Bool -> Bool) : Prop :=
Exists fun p : M.Prog => Exists fun c => Exists fun k =>
forall x, L x = true <->
Exists fun w : List Bool => w.length <= pbound c k x.length /\
M.run p (pbound c k (x.length + w.length)) (x ++ w) = some true
/-! ## SAT -/
/-- A literal: (polarity, variable); a clause: a list of literals; a CNF: a list of clauses. -/
abbrev Lit := Bool × Nat
abbrev Clause := List Lit
abbrev CNF := List Clause
def evalLit (a : Nat -> Bool) (l : Lit) : Bool :=
match l.1 with
| true => a l.2
| false => !(a l.2)
def evalClause (a : Nat -> Bool) : Clause -> Bool
| [] => false
| l :: c => evalLit a l || evalClause a c
def evalCNF (a : Nat -> Bool) : CNF -> Bool
| [] => true
| c :: f => evalClause a c && evalCNF a f
def Sat (f : CNF) : Prop := Exists fun a : Nat -> Bool => evalCNF a f = true
/-- The size of a formula: its number of literals. -/
def csize : Clause -> Nat
| [] => 0
| _ :: c => csize c + 1
def size : CNF -> Nat
| [] => 0
| c :: f => size f + csize c
/-- The cost of the check: one step per literal read (all literals are read). -/
def costClause : Clause -> Nat
| [] => 0
| _ :: c => costClause c + 1
def cost : CNF -> Nat
| [] => 0
| c :: f => cost f + costClause c
theorem costClause_eq : forall c : Clause, costClause c = csize c
| [] => rfl
| _ :: c => congrArg (fun t => t + 1) (costClause_eq c)
/-- The certificate check costs exactly the size of the formula: linear time. -/
theorem cost_eq_size : forall f : CNF, cost f = size f
| [] => rfl
| c :: f => by
show cost f + costClause c = size f + csize c
rw [cost_eq_size f, costClause_eq c]
/-- SAT has certificates: an assignment, checked by evaluation. -/
theorem sat_certificate (f : CNF) (a : Nat -> Bool) (h : evalCNF a f = true) : Sat f :=
Exists.intro a h
/-- An example: (x0 or not x1) and (x1) is satisfied by x0 = x1 = true. -/
theorem sat_example : evalCNF (fun _ => true) [[(true, 0), (false, 1)], [(true, 1)]] = true := rfl
/-! ## One-way functions -/
/-- A one-way function (definition): computable within a polynomial bound, and every
inverter within a polynomial bound succeeds on at most a fraction `eps n` of the inputs of
length n, where eps is smaller than every inverse polynomial from some length on. -/
structure OneWay (M : Machine) (f : List Bool -> List Bool) (succ : M.Prog -> Nat -> Nat × Nat) : Prop where
easy : Exists fun c => Exists fun k => forall x, (f x).length <= pbound c k x.length
hard : forall inv : M.Prog, forall c k : Nat, Exists fun n0 => forall n, n0 <= n ->
(succ inv n).1 * pbound c k n <= (succ inv n).2
end Found.RootComp
#print axioms Found.RootComp.halting_undecidable
#print axioms Found.RootComp.costClause_eq
#print axioms Found.RootComp.cost_eq_size
#print axioms Found.RootComp.sat_certificate
#print axioms Found.RootComp.sat_example
lean_all/found/RootEM.lean
/-
T326. found/RootEM -- electromagnetism, a branch of T321: the U(1) connection.
* U(1) on the integers: the shift x -> x + a with its inverse x -> x - a (a pair of the
chain with its two triangle equalities).
* dF = 0: the U(1) case of the non-abelian Bianchi identity of T321 (found/RootBundle),
and in flux form F_bottom = F_front + F_right + F_back + F_left + F_top on a cube.
* d*F = J: the current is the divergence of the field; summed over a region it is the
flux through its ends (Gauss), FundAll's telescoping sum.
Written with ASCII forms only. CIC dependence: none.
-/
import found.RootBundle
import lib.IntRing
namespace Found.RootEM
open OneMove LibInt Found.RootBundle
/-- U(1) acting on the integers by shifts: the pair (x -> x + a, x -> x - a). -/
def shift (a : Int) : Pair (Int -> Int) (Int -> Int) := Pair.mk (fun x => x + a) (fun x => x + -a)
theorem shift_inv (a : Int) : Inv (shift a) :=
And.intro (fun x => by show x + a + -a = x; lib_int) (fun x => by show x + -a + a = x; lib_int)
/-- dF = 0 as the U(1) case of the Bianchi identity of T321. -/
theorem dF_zero (a b c d e f g h i j k l x : Int) : p2 (shift i) (p2 (shift g) (p1 (shift k) (p2 (shift k) (p1 (shift g) (p1 (shift i) (p2 (shift e) (p2 (shift k) (p2 (shift d) (p1 (shift l) (p2 (shift l) (p1 (shift d) (p1 (shift k) (p2 (shift b) (p2 (shift l) (p1 (shift h) (p1 (shift j) (p2 (shift j) (p2 (shift h) (p1 (shift l) (p1 (shift f) (p2 (shift j) (p1 (shift c) (p1 (shift i) (p2 (shift i) -- (+140 chars; full line in the Zenodo source)
bianchi (shift a) (shift b) (shift c) (shift d) (shift e) (shift f) (shift g) (shift h) (shift i) (shift j) (shift k) (shift l) (shift_inv a) (shift_inv b) (shift_inv c) (shift_inv d) (shift_inv e) (shift_inv f) (shift_inv g) (shift_inv h) (shift_inv i) (shift_inv j) (shift_inv k) (shift_inv l) x
/-- The same in flux form: the bottom flux is the sum of the other five (outward orientation:
the total signed flux through the closed surface is zero). -/
theorem flux_form (a b c d e f g h i j k l : Int) :
a + f + -b + -e = (a + j + -c + -i) + (f + l + -h + -j) + (-b + k + d + -l) + (-e + i + g + -k) + (c + h + -d + -g) := by
lib_int
/-! ## d*F = J and Gauss -/
/-- Running sum on the integers (FundAll's Sigma). -/
def isum (f : Nat -> Int) : Nat -> Int
| 0 => 0
| n + 1 => isum f n + f n
/-- The current as the divergence of the field E along a line: J(x) = E(x+1) - E(x). -/
def current (E : Nat -> Int) (x : Nat) : Int := E (x + 1) + -E x
/-- Gauss: the charge in 0 .. N-1 is the flux through the ends. -/
theorem gauss (E : Nat -> Int) : forall N, isum (current E) N = E N + -E 0
| 0 => by show (0 : Int) = E 0 + -E 0; lib_int
| N + 1 => by
show isum (current E) N + (E (N + 1) + -E N) = E (N + 1) + -E 0
rw [gauss E N]
lib_int
end Found.RootEM
#print axioms Found.RootEM.shift_inv
#print axioms Found.RootEM.dF_zero
#print axioms Found.RootEM.flux_form
#print axioms Found.RootEM.gauss
lean_all/found/RootHiggs.lean
/-
T325. found/RootHiggs -- the Higgs mechanism, one case: SU(2) x U(1) -> U(1).
The Higgs doublet is a pair of complex numbers (z1, z2) (OneMove link 26, Gaussian
integers), read as the real four-vector (Re z1, Im z1, Re z2, Im z2). The vacuum is
v = (0, 1). The generators of su(2) + u(1), doubled to stay in the integers, are
i sigma_1, i sigma_2, i sigma_3 and i (hypercharge). A generator is unbroken when it
leaves v fixed (moves it by zero).
* the four generators move v to (0,1,0,0), (1,0,0,0), (0,0,0,-1), (0,0,0,1);
* the linear map c -> sum_a c_a T_a v is c -> (c2, c1, 0, c4 - c3);
* its kernel is exactly the line c1 = c2 = 0, c3 = c4: the charge Q = T3 + Y, one
unbroken generator (the photon, massless);
* so dim G - dim H = 4 - 1 = 3 generators are broken: three massive gauge fields
(W+, W-, Z), and the rank of the map is 3.
Written with ASCII forms only. CIC dependence: none.
-/
import found.user.OneMove
import lib.IntRing
namespace Found.RootHiggs
open OneMove LibInt
/-- A doublet: two complex numbers. -/
abbrev Dbl := Pair Cx Cx
def dmulc (k : Cx) (z : Dbl) : Dbl := Pair.mk (cmul k (p1 z)) (cmul k (p2 z))
def vac : Dbl := Pair.mk c0 c1
/-- i sigma_1, i sigma_2, i sigma_3, i * 1 acting on a doublet. -/
def gen1 (z : Dbl) : Dbl := dmulc ci (Pair.mk (p2 z) (p1 z))
def gen2 (z : Dbl) : Dbl := dmulc ci (Pair.mk (cmul (cneg ci) (p2 z)) (cmul ci (p1 z)))
def gen3 (z : Dbl) : Dbl := dmulc ci (Pair.mk (p1 z) (cneg (p2 z)))
def genY (z : Dbl) : Dbl := dmulc ci z
/-- The real four-vector of a doublet. -/
def real4 (z : Dbl) : Int × Int × Int × Int := (p1 (p1 z), p2 (p1 z), p1 (p2 z), p2 (p2 z))
theorem col1 : real4 (gen1 vac) = (0, 1, 0, 0) := rfl
theorem col2 : real4 (gen2 vac) = (1, 0, 0, 0) := rfl
theorem col3 : real4 (gen3 vac) = (0, 0, 0, -1) := rfl
theorem colY : real4 (genY vac) = (0, 0, 0, 1) := rfl
/-- The map from generator coefficients to the motion of the vacuum. -/
def L (c1 c2 c3 c4 : Int) : Int × Int × Int × Int :=
(c1 * 0 + c2 * 1 + c3 * 0 + c4 * 0, c1 * 1 + c2 * 0 + c3 * 0 + c4 * 0,
c1 * 0 + c2 * 0 + c3 * 0 + c4 * 0, c1 * 0 + c2 * 0 + c3 * -1 + c4 * 1)
/-- In closed form: (c2, c1, 0, c4 - c3). -/
theorem L_form (c1 c2 c3 c4 : Int) : L c1 c2 c3 c4 = (c2, c1, 0, c4 + -c3) := by
have a : c1 * 0 + c2 * 1 + c3 * 0 + c4 * 0 = c2 := by lib_int
have b : c1 * 1 + c2 * 0 + c3 * 0 + c4 * 0 = c1 := by lib_int
have c : c1 * 0 + c2 * 0 + c3 * 0 + c4 * 0 = 0 := by lib_int
have d : c1 * 0 + c2 * 0 + c3 * -1 + c4 * 1 = c4 + -c3 := by lib_int
show (c1 * 0 + c2 * 1 + c3 * 0 + c4 * 0, c1 * 1 + c2 * 0 + c3 * 0 + c4 * 0,
c1 * 0 + c2 * 0 + c3 * 0 + c4 * 0, c1 * 0 + c2 * 0 + c3 * -1 + c4 * 1) = _
rw [a, b, c, d]
/-- The unbroken generators: exactly the line c1 = c2 = 0, c3 = c4 (Q = T3 + Y). -/
theorem unbroken (c1 c2 c3 c4 : Int) :
L c1 c2 c3 c4 = (0, 0, 0, 0) -> c1 = 0 /\ c2 = 0 /\ c3 = c4 := by
intro h
rw [L_form] at h
have h2 : c2 = 0 := congrArg Prod.fst h
have h1 : c1 = 0 := congrArg (fun t => t.2.1) h
have h4 : c4 + -c3 = 0 := congrArg (fun t => t.2.2.2) h
refine And.intro h1 (And.intro h2 ?_)
calc c3 = c4 + -(c4 + -c3) := by lib_int
_ = c4 + -0 := by rw [h4]
_ = c4 := by lib_int
theorem charge_unbroken : L 0 0 1 1 = (0, 0, 0, 0) := rfl
/-- Three broken directions are independent: they move v to three different axes. -/
theorem broken_independent :
L 1 0 0 0 = (0, 1, 0, 0) /\ L 0 1 0 0 = (1, 0, 0, 0) /\ L 0 0 1 0 = (0, 0, 0, -1) :=
And.intro rfl (And.intro rfl rfl)
/-- The count: dim G - dim H = 4 - 1 = 3 massive gauge fields, 1 massless. -/
theorem count : 4 - 1 = 3 := rfl
end Found.RootHiggs
#print axioms Found.RootHiggs.col1
#print axioms Found.RootHiggs.col2
#print axioms Found.RootHiggs.col3
#print axioms Found.RootHiggs.colY
#print axioms Found.RootHiggs.L_form
#print axioms Found.RootHiggs.unbroken
#print axioms Found.RootHiggs.charge_unbroken
#print axioms Found.RootHiggs.broken_independent
#print axioms Found.RootHiggs.count
lean_all/found/RootMeasure.lean
/-
T320. found/RootMeasure — measure and probability as a root of the chain.
From the chain: subsets are maps into the truth values (Omega, link 19);
the decidable ones are maps into the two-valued point (FundAll, Part D);
sums are FundAll's running sum `runsum` (the "do it n times" addition of
OneMove link 21-22), restated here for Nat. Nothing is imported.
* sigma-algebra: a family of predicates closed under complement and
countable union (stated on Prop-valued sets);
* measure: a weight per point, mu(A) = running sum of the weights on A
(on a finite horizon N), with finite additivity;
* integral: running sum of weight * value;
* monotone convergence: if f_k increases to g pointwise, the integrals
of f_k reach the integral of g;
* probability space: total weight T > 0, P(A) = mu(A) / T as the pair
(mu A, T); P(everything) = 1 and P(A) + P(not A) = 1.
The link to the entropy chain (Ent.v) is the probability vector: a
probability space here gives the weights the entropy chain reads.
CIC dependence: none.
-/
namespace Found.RootMeasure
/-- FundAll's running sum, for Nat. -/
def runsum (f : Nat → Nat) : Nat → Nat
| 0 => 0
| n + 1 => runsum f n + f n
theorem runsum_congr (f g : Nat → Nat) (h : forall n, f n = g n) :
forall N, runsum f N = runsum g N
| 0 => rfl
| N + 1 => by
show runsum f N + f N = runsum g N + g N
rw [runsum_congr f g h N, h N]
theorem runsum_add (f g : Nat → Nat) :
forall N, runsum (fun n => f n + g n) N = runsum f N + runsum g N
| 0 => rfl
| N + 1 => by
show runsum (fun n => f n + g n) N + (f N + g N) = (runsum f N + f N) + (runsum g N + g N)
rw [runsum_add f g N, Nat.add_assoc, Nat.add_assoc, Nat.add_left_comm (f N) (runsum g N) (g N)]
/-! ## Sigma-algebras (on the truth values) -/
/-- A sigma-algebra on `X`: a family of sets containing everything, closed under
complement and countable union. -/
structure SigmaAlg (X : Type) where
mem : (X → Prop) → Prop
univ : mem (fun _ => True)
compl : forall A, mem A → mem (fun x => A x → False)
union : forall A : Nat → X → Prop, (forall k, mem (A k)) → mem (fun x => Exists fun k => A k x)
/-- Every set: the largest sigma-algebra. -/
def powerSet (X : Type) : SigmaAlg X where
mem := fun _ => True
univ := True.intro
compl := fun _ _ => True.intro
union := fun _ _ => True.intro
/-! ## Measure and integral (decidable sets, finite horizon) -/
/-- A decidable set: a map into the two-valued point. -/
abbrev BSet := Nat → Bool
def ind (A : BSet) (n : Nat) : Nat :=
match A n with
| true => 1
| false => 0
/-- The measure with weights `w`, on the points below `N`. -/
def meas (w : Nat → Nat) (N : Nat) (A : BSet) : Nat :=
runsum (fun n => w n * ind A n) N
/-- The integral of `f` with weights `w`, on the points below `N`. -/
def integral (w f : Nat → Nat) (N : Nat) : Nat :=
runsum (fun n => w n * f n) N
def bunion (A B : BSet) : BSet := fun n => A n || B n
def binter (A B : BSet) : BSet := fun n => A n && B n
def bcompl (A : BSet) : BSet := fun n => !(A n)
def buniv : BSet := fun _ => true
def bempty : BSet := fun _ => false
theorem meas_empty (w : Nat → Nat) (N : Nat) : meas w N bempty = 0 := by
have h : forall n, w n * ind bempty n = 0 := fun n => Nat.mul_zero (w n)
show runsum (fun n => w n * ind bempty n) N = 0
rw [runsum_congr _ (fun _ => 0) h N]
induction N with
| zero => rfl
| succ k ih => show runsum (fun _ => 0) k + 0 = 0; rw [Nat.add_zero, ih]
/-- Pointwise: one point counted in union and intersection as in A and B. -/
theorem ind_union_inter (A B : BSet) (n : Nat) :
ind (bunion A B) n + ind (binter A B) n = ind A n + ind B n := by
unfold ind bunion binter
cases A n <;> cases B n <;> rfl
/-- Finite additivity: mu(A union B) + mu(A inter B) = mu(A) + mu(B). -/
theorem meas_union_inter (w : Nat → Nat) (N : Nat) (A B : BSet) :
meas w N (bunion A B) + meas w N (binter A B) = meas w N A + meas w N B := by
unfold meas
rw [← runsum_add, ← runsum_add]
apply runsum_congr
intro n
show w n * ind (bunion A B) n + w n * ind (binter A B) n = w n * ind A n + w n * ind B n
rw [← Nat.mul_add, ← Nat.mul_add, ind_union_inter]
/-- The measure of a set is the integral of its indicator. -/
theorem meas_integral (w : Nat → Nat) (N : Nat) (A : BSet) :
meas w N A = integral w (ind A) N := rfl
/-! ## Monotone convergence -/
/-- If `f k n` agrees with `g n` from some stage on, at every point, the integrals agree
from some stage on (finite horizon). -/
theorem integral_eventually (w g : Nat → Nat) (f : Nat → Nat → Nat)
(conv : forall n, Exists fun K => forall k, K <= k → f k n = g n) :
forall N, Exists fun K => forall k, K <= k → integral w (f k) N = integral w g N
| 0 => Exists.intro 0 (fun _ _ => rfl)
| N + 1 =>
match integral_eventually w g f conv N, conv N with
| Exists.intro K1 h1, Exists.intro K2 h2 =>
Exists.intro (K1 + K2) (fun k hk => by
show integral w (f k) N + w N * f k N = integral w g N + w N * g N
rw [h1 k (Nat.le_trans (Nat.le_add_right K1 K2) hk),
h2 k (Nat.le_trans (Nat.le_add_left K2 K1) hk)])
/-- Antisymmetry of the order, by hand (every case written out). -/
theorem le_antisymm' : forall (a b : Nat), a <= b → b <= a → a = b
| 0, 0, _, _ => rfl
| 0, b + 1, _, h => absurd h (Nat.not_succ_le_zero b)
| a + 1, 0, h, _ => absurd h (Nat.not_succ_le_zero a)
| a + 1, b + 1, h1, h2 =>
congrArg Nat.succ (le_antisymm' a b (Nat.le_of_succ_le_succ h1) (Nat.le_of_succ_le_succ h2))
/-- Monotone convergence: `f k` increases with `k`, stays below `g`, and reaches `g`
at every point; then the integrals of `f k` reach the integral of `g`. -/
theorem monotone_convergence (w g : Nat → Nat) (f : Nat → Nat → Nat)
(mono : forall k n, f k n <= f (k + 1) n)
(below : forall k n, f k n <= g n)
(reach : forall n, Exists fun k => f k n = g n) :
forall N, Exists fun K => forall k, K <= k → integral w (f k) N = integral w g N := by
apply integral_eventually
intro n
match reach n with
| Exists.intro k0 hk0 =>
refine Exists.intro k0 (fun k hk => ?_)
have up : f k0 n <= f k n := by
induction hk with
| refl => exact Nat.le_refl _
| step _ ih => exact Nat.le_trans ih (mono _ n)
have ge : g n <= f k n := Eq.subst (motive := fun x => x <= f k n) hk0 up
exact le_antisymm' (f k n) (g n) (below k n) ge
/-! ## Probability spaces -/
/-- A probability space on the points below `N`: weights with positive total. -/
structure ProbSpace where
w : Nat → Nat
N : Nat
pos : 0 < meas w N buniv
/-- P(A), as the pair (mu A, total). -/
def prob (P : ProbSpace) (A : BSet) : Nat × Nat := (meas P.w P.N A, meas P.w P.N buniv)
/-- P(everything) = 1: numerator equals denominator. -/
theorem prob_univ (P : ProbSpace) : (prob P buniv).1 = (prob P buniv).2 := rfl
theorem ind_compl (A : BSet) (n : Nat) : ind A n + ind (bcompl A) n = ind buniv n := by
unfold ind bcompl buniv
cases A n <;> rfl
/-- P(A) + P(not A) = 1. -/
theorem prob_compl (P : ProbSpace) (A : BSet) :
(prob P A).1 + (prob P (bcompl A)).1 = (prob P A).2 := by
show meas P.w P.N A + meas P.w P.N (bcompl A) = meas P.w P.N buniv
unfold meas
rw [← runsum_add]
apply runsum_congr
intro n
show P.w n * ind A n + P.w n * ind (bcompl A) n = P.w n * ind buniv n
rw [← Nat.mul_add, ind_compl]
/-- A fair coin on the points 0, 1. -/
def coin : ProbSpace := ProbSpace.mk (fun _ => 1) 2 (Nat.zero_lt_succ 1)
theorem coin_half : prob coin (fun n => n == 0) = (1, 2) := rfl
end Found.RootMeasure
#print axioms Found.RootMeasure.runsum_add
#print axioms Found.RootMeasure.meas_empty
#print axioms Found.RootMeasure.meas_union_inter
#print axioms Found.RootMeasure.meas_integral
#print axioms Found.RootMeasure.integral_eventually
#print axioms Found.RootMeasure.le_antisymm'
#print axioms Found.RootMeasure.monotone_convergence
#print axioms Found.RootMeasure.prob_univ
#print axioms Found.RootMeasure.prob_compl
#print axioms Found.RootMeasure.coin_half
lean_all/found/RootPDE.lean
/-
T328. found/RootPDE -- partial differential equations, a branch: the classification of
second-order operators.
Functions on the lattice are the function space of T320; the derivatives are the
commuting difference operators of T321. A second-order operator in two variables,
a d_xx + 2 b d_xy + c d_yy, is elliptic, parabolic or hyperbolic as its discriminant
b^2 - a c is negative, zero or positive.
* under the linear change of variables (x, y) -> (p x + q y, r x + s y) the
coefficients become a', b', c' and the discriminant becomes
(p s - q r)^2 (b^2 - a c): the type does not depend on the coordinates;
* Laplace (1, 0, 1) is elliptic, heat (1, 0, 0) parabolic, wave (1, 0, -1) hyperbolic;
* the second difference u(x+1) - 2 u(x) + u(x-1) is the lattice d_xx.
Navier-Stokes is not repeated; it is linked from the section text.
Written with ASCII forms only. CIC dependence: none.
-/
import lib.IntRing
namespace Found.RootPDE
open LibInt
/-- The discriminant b^2 - a c of a d_xx + 2 b d_xy + c d_yy. -/
def disc (a b c : Int) : Int := b * b - a * c
/-- The coefficients after the change of variables (x, y) -> (p x + q y, r x + s y). -/
def a' (a b c p q : Int) : Int := a * p * p + 2 * b * p * q + c * q * q
def b' (a b c p q r s : Int) : Int := a * p * r + b * (p * s + q * r) + c * q * s
def c' (a b c r s : Int) : Int := a * r * r + 2 * b * r * s + c * s * s
/-- The discriminant changes by the square of the Jacobian determinant. -/
theorem disc_change (a b c p q r s : Int) :
disc (a' a b c p q) (b' a b c p q r s) (c' a b c r s) = (p * s - q * r) * (p * s - q * r) * disc a b c := by
unfold disc a' b' c'
lib_int
/-- The type: 0 elliptic, 1 parabolic, 2 hyperbolic, read from the sign of the discriminant. -/
def kind (a b c : Int) : Nat :=
match disc a b c with
| Int.ofNat 0 => 1
| Int.ofNat (_ + 1) => 2
| Int.negSucc _ => 0
theorem laplace_elliptic : kind 1 0 1 = 0 := rfl
theorem heat_parabolic : kind 1 0 0 = 1 := rfl
theorem wave_hyperbolic : kind 1 0 (-1) = 2 := rfl
/-- The lattice d_xx: the second difference. -/
def d2 (u : Int -> Int) (x : Int) : Int := u (x + 1) + -2 * u x + u (x + -1)
/-- It vanishes on straight lines, as d_xx does. -/
theorem d2_linear (m k x : Int) : d2 (fun t => m * t + k) x = 0 := by
show m * (x + 1) + k + -2 * (m * x + k) + (m * (x + -1) + k) = 0
lib_int
end Found.RootPDE
#print axioms Found.RootPDE.disc_change
#print axioms Found.RootPDE.laplace_elliptic
#print axioms Found.RootPDE.heat_parabolic
#print axioms Found.RootPDE.wave_hyperbolic
#print axioms Found.RootPDE.d2_linear
lean_all/found/RootQuant.lean
/-
T323. found/RootQuant -- quantization: the frame of the Euclidean lattice path integral,
on the measure of T320 (found/RootMeasure).
* configurations: the field on a finite lattice, numbered 0 .. M-1;
* weight: a positive number per configuration (the discrete exp(-S));
* partition function Z: the measure of all configurations; expectation <O>: the pair
(integral of O, Z), i.e. integral of O divided by Z;
* <1> = 1 and <O1 + O2> = <O1> + <O2> (from the running sum);
* an instance: Z2 lattice gauge theory on one plaquette (four links, 16
configurations; weight 2 if the plaquette product is +1, else 1): Z = 24, and a
gauge transformation at a site (flipping its two links) changes neither the weight
of any configuration nor Z.
The Yang-Mills ladder of the third window (continuum limit, mass gap) is not repeated
here; it is linked from the section text.
Written with ASCII forms only. CIC dependence: none.
-/
import found.RootMeasure
namespace Found.RootQuant
open Found.RootMeasure
/-- The partition function: the measure of all configurations 0 .. M-1. -/
def Z (w : Nat -> Nat) (M : Nat) : Nat := integral w (fun _ => 1) M
/-- The expectation of an observable, as (integral of O, Z). -/
def expect (w : Nat -> Nat) (M : Nat) (O : Nat -> Nat) : Nat × Nat := (integral w O M, Z w M)
/-- <1> = 1. -/
theorem expect_one (w : Nat -> Nat) (M : Nat) : (expect w M (fun _ => 1)).1 = (expect w M (fun _ => 1)).2 := rfl
/-- Linearity: <O1 + O2> = <O1> + <O2> (same denominator Z). -/
theorem expect_add (w : Nat -> Nat) (M : Nat) (O1 O2 : Nat -> Nat) :
(expect w M (fun c => O1 c + O2 c)).1 = (expect w M O1).1 + (expect w M O2).1 := by
show runsum (fun n => w n * (O1 n + O2 n)) M = runsum (fun n => w n * O1 n) M + runsum (fun n => w n * O2 n) M
rw [(runsum_add (fun n => w n * O1 n) (fun n => w n * O2 n) M).symm]
apply runsum_congr
intro n
exact Nat.mul_add (w n) (O1 n) (O2 n)
/-! ## Z2 gauge theory on one plaquette -/
/-- Link k (0..3) of configuration c: its k-th binary digit. -/
def link (c k : Nat) : Nat := (c / 2 ^ k) % 2
/-- The plaquette product, as a parity: 0 for +1, 1 for -1. -/
def plaq (c : Nat) : Nat := (link c 0 + link c 1 + link c 2 + link c 3) % 2
/-- Weight 2 for plaquette +1, weight 1 for -1. -/
def wZ2 (c : Nat) : Nat := 2 - plaq c
/-- All configurations below n pass the test p. -/
def allBelow (p : Nat -> Bool) : Nat -> Bool
| 0 => true
| n + 1 => p n && allBelow p n
/-- A gauge transformation at the site shared by links 0 and 3: flip both links. -/
def flip03 (c : Nat) : Nat :=
(1 - link c 0) + 2 * link c 1 + 4 * link c 2 + 8 * (1 - link c 3)
theorem Z_plaquette : Z wZ2 16 = 24 := rfl
/-- The gauge transformation keeps every configuration's weight. -/
theorem weight_gauge_invariant : allBelow (fun c => wZ2 (flip03 c) == wZ2 c) 16 = true := rfl
/-- ... and the partition function. -/
theorem Z_gauge_invariant : Z (fun c => wZ2 (flip03 c)) 16 = Z wZ2 16 := rfl
/-- <plaquette sign is +1> = 16 / 24 = 2/3. -/
theorem expect_plaq_plus : expect wZ2 16 (fun c => 1 - plaq c) = (16, 24) := rfl
end Found.RootQuant
#print axioms Found.RootQuant.expect_one
#print axioms Found.RootQuant.expect_add
#print axioms Found.RootQuant.Z_plaquette
#print axioms Found.RootQuant.weight_gauge_invariant
#print axioms Found.RootQuant.Z_gauge_invariant
#print axioms Found.RootQuant.expect_plaq_plus
lean_all/found/RootSpinor.lean
/-
T322. found/RootSpinor -- spinors and chirality, as a root of the chain.
From the chain's division algebras (OneMove link 26: complex numbers and quaternions,
computed on the core integers): a Dirac spinor in four Euclidean dimensions is a pair of
quaternions (left, right); the Clifford generators are the 2x2 quaternion matrices
gamma_mu = [[0, s_mu], [sb_mu, 0]] with s = (1, i, j, k) and sb = (1, -i, -j, -k).
* Clifford algebra: gamma_mu^2 = 1 and gamma_mu gamma_nu = - gamma_nu gamma_mu (mu, nu
different), i.e. gamma_mu gamma_nu + gamma_nu gamma_mu = 2 delta_mu_nu;
* chirality: gamma_5 = gamma_1 gamma_2 gamma_3 gamma_4 = diag(-1, 1), gamma_5^2 = 1,
gamma_5 anticommutes with every gamma_mu; with pL = 1 - gamma_5 and pR = 1 + gamma_5
(twice the projectors, to stay in the integers): pL pR = 0, pL + pR = 2, pL^2 = 2 pL;
each gamma_mu carries left spinors to right ones (gamma_mu pL = pR gamma_mu);
* spin group: even products of gammas are block diagonal (Spin(4) = SU(2)_L x SU(2)_R,
left and right Weyl spinors transform separately); the rotation x -> q x q^-1 is the
same for q and -q, while the spinor q psi is not (the double cover).
All facts are closed computations (rfl). Written with ASCII forms only.
CIC dependence: none.
-/
import found.user.OneMove
namespace Found.RootSpinor
open OneMove
def hadd (x y : Hq) : Hq := Pair.mk (cadd (p1 x) (p1 y)) (cadd (p2 x) (p2 y))
def h0 : Hq := Pair.mk c0 c0
def h1 : Hq := Pair.mk c1 c0
def h2 : Hq := Pair.mk (Pair.mk 2 0) c0
def hconj (x : Hq) : Hq := Pair.mk (cconj (p1 x)) (cneg (p2 x))
/-- A 2x2 matrix of quaternions, acting on Dirac spinors (left, right). -/
structure QM where
a : Hq
b : Hq
c : Hq
d : Hq
def qmul (x y : QM) : QM :=
QM.mk (hadd (hmul x.a y.a) (hmul x.b y.c)) (hadd (hmul x.a y.b) (hmul x.b y.d))
(hadd (hmul x.c y.a) (hmul x.d y.c)) (hadd (hmul x.c y.b) (hmul x.d y.d))
def qadd (x y : QM) : QM := QM.mk (hadd x.a y.a) (hadd x.b y.b) (hadd x.c y.c) (hadd x.d y.d)
def qsub (x y : QM) : QM := QM.mk (hadd x.a (hneg y.a)) (hadd x.b (hneg y.b)) (hadd x.c (hneg y.c)) (hadd x.d (hneg y.d))
def qzero : QM := QM.mk h0 h0 h0 h0
def qone : QM := QM.mk h1 h0 h0 h1
def qtwo : QM := QM.mk h2 h0 h0 h2
def gam (s sb : Hq) : QM := QM.mk h0 s sb h0
def g1 : QM := gam h1 h1
def g2 : QM := gam hi (hneg hi)
def g3 : QM := gam hj (hneg hj)
def g4 : QM := gam hk (hneg hk)
/-! ## Clifford algebra -/
theorem sq1 : qmul g1 g1 = qone := rfl
theorem sq2 : qmul g2 g2 = qone := rfl
theorem sq3 : qmul g3 g3 = qone := rfl
theorem sq4 : qmul g4 g4 = qone := rfl
theorem anti12 : qadd (qmul g1 g2) (qmul g2 g1) = qzero := rfl
theorem anti13 : qadd (qmul g1 g3) (qmul g3 g1) = qzero := rfl
theorem anti14 : qadd (qmul g1 g4) (qmul g4 g1) = qzero := rfl
theorem anti23 : qadd (qmul g2 g3) (qmul g3 g2) = qzero := rfl
theorem anti24 : qadd (qmul g2 g4) (qmul g4 g2) = qzero := rfl
theorem anti34 : qadd (qmul g3 g4) (qmul g4 g3) = qzero := rfl
/-! ## Chirality -/
def g5 : QM := qmul (qmul (qmul g1 g2) g3) g4
theorem g5_val : g5 = QM.mk (hneg h1) h0 h0 h1 := rfl
theorem g5_sq : qmul g5 g5 = qone := rfl
theorem g5_anti1 : qadd (qmul g5 g1) (qmul g1 g5) = qzero := rfl
theorem g5_anti2 : qadd (qmul g5 g2) (qmul g2 g5) = qzero := rfl
theorem g5_anti3 : qadd (qmul g5 g3) (qmul g3 g5) = qzero := rfl
theorem g5_anti4 : qadd (qmul g5 g4) (qmul g4 g5) = qzero := rfl
def pL : QM := qsub qone g5
def pR : QM := qadd qone g5
theorem pL_pR : qmul pL pR = qzero := rfl
theorem pR_pL : qmul pR pL = qzero := rfl
theorem pL_add_pR : qadd pL pR = qtwo := rfl
theorem pL_sq : qmul pL pL = qadd pL pL := rfl
theorem pR_sq : qmul pR pR = qadd pR pR := rfl
theorem flip1 : qmul g1 pL = qmul pR g1 := rfl
theorem flip2 : qmul g2 pL = qmul pR g2 := rfl
theorem flip3 : qmul g3 pL = qmul pR g3 := rfl
theorem flip4 : qmul g4 pL = qmul pR g4 := rfl
/-! ## The spin group -/
/-- An even product is block diagonal: left and right spinors transform separately. -/
theorem g12_block : qmul g1 g2 = QM.mk (hneg hi) h0 h0 hi := rfl
/-- The rotation x -> q x conj(q) of the vectors (quaternions) is the same for q and -q. -/
theorem rot_double : hmul (hmul (hneg hi) hj) (hconj (hneg hi)) = hmul (hmul hi hj) (hconj hi) := rfl
/-- The spinor q psi is not: q = i and q = -i act differently on psi = 1. -/
theorem spin_sign : hmul hi h1 = hneg (hmul (hneg hi) h1) := rfl
end Found.RootSpinor
#print axioms Found.RootSpinor.anti12
#print axioms Found.RootSpinor.anti13
#print axioms Found.RootSpinor.anti14
#print axioms Found.RootSpinor.anti23
#print axioms Found.RootSpinor.anti24
#print axioms Found.RootSpinor.anti34
#print axioms Found.RootSpinor.sq1
#print axioms Found.RootSpinor.sq2
#print axioms Found.RootSpinor.sq3
#print axioms Found.RootSpinor.sq4
#print axioms Found.RootSpinor.g5_val
#print axioms Found.RootSpinor.g5_sq
#print axioms Found.RootSpinor.g5_anti1
#print axioms Found.RootSpinor.g5_anti2
#print axioms Found.RootSpinor.g5_anti3
#print axioms Found.RootSpinor.g5_anti4
#print axioms Found.RootSpinor.pL_pR
#print axioms Found.RootSpinor.pR_pL
#print axioms Found.RootSpinor.pL_add_pR
#print axioms Found.RootSpinor.pL_sq
#print axioms Found.RootSpinor.pR_sq
#print axioms Found.RootSpinor.flip1
#print axioms Found.RootSpinor.flip2
#print axioms Found.RootSpinor.flip3
#print axioms Found.RootSpinor.flip4
#print axioms Found.RootSpinor.g12_block
#print axioms Found.RootSpinor.rot_double
#print axioms Found.RootSpinor.spin_sign
lean_all/found/SDG.lean
/-
T119. found/SDG — synthetic differential geometry as a point: a ring
coordinate R with the Kock–Lawvere condition on D = {d | d² = 0}.
* Minimal ring conditions (only those used): 0, 1, +, ·, x + 0 = x,
0·x = 0, x·0 = 0, 1·x = x, associativity of ·.
* Kock–Lawvere (uniqueness half): maps D → R have at most one slope.
* KL ⇒ not every infinitesimal is 0 (unless 0 = 1).
* Kock's field condition (x ≠ 0 ⇒ x invertible) ⇒ every infinitesimal is
not-not 0; with excluded middle on D this gives d = 0, hence 0 = 1:
SDG's point lies off the classical condition — the known incompatibility
of KL with LEM, as a condition clash on the truth-value coordinate.
Lean 4 core only, hand-written proofs, no axioms (all conditions are hypotheses).
-/
namespace Found
namespace SDG
universe u
structure Ring where
R : Type u
zero : R
one : R
add : R → R → R
mul : R → R → R
add_zero : ∀ x, add x zero = x
zero_mul : ∀ x, mul zero x = zero
mul_zero : ∀ x, mul x zero = zero
one_mul : ∀ x, mul one x = x
mul_assoc : ∀ x y z, mul (mul x y) z = mul x (mul y z)
variable (K : Ring.{u})
def D : Type u := {d : K.R // K.mul d d = K.zero}
def d0 : D K := ⟨K.zero, K.zero_mul _⟩
/-- Kock–Lawvere, uniqueness of slopes -/
def KLuniq : Prop :=
∀ (g : D K → K.R) (b b' : K.R), (∀ d : D K, g d = K.add (g (d0 K)) (K.mul b d.val)) →
(∀ d : D K, g d = K.add (g (d0 K)) (K.mul b' d.val)) → b = b'
/-- KL ⇒ not all infinitesimals vanish, unless 0 = 1 -/
theorem kl_not_all_zero (kl : KLuniq K) (h : ∀ d : D K, d.val = K.zero) : K.zero = K.one :=
kl (fun _ => K.zero) K.zero K.one
(fun d => by
show K.zero = K.add K.zero (K.mul K.zero d.val)
rw [K.zero_mul, K.add_zero])
(fun d => by
show K.zero = K.add K.zero (K.mul K.one d.val)
rw [h d, K.mul_zero, K.add_zero])
/-- Kock's field condition -/
def FieldCond : Prop := ∀ x : K.R, ¬ x = K.zero → ∃ e, K.mul e x = K.one
/-- field condition ⇒ every infinitesimal is not-not zero -/
theorem nn_zero (hf : FieldCond K) (d : D K) : ¬ ¬ d.val = K.zero :=
fun hne => match hf d.val hne with
| ⟨e, he⟩ => hne (by
have : d.val = K.mul (K.mul e d.val) d.val := by rw [he, K.one_mul]
rw [this, K.mul_assoc, d.property, K.mul_zero])
/-- the clash: KL + field condition + excluded middle on D ⇒ 0 = 1 -/
theorem kl_lem_clash (kl : KLuniq K) (hf : FieldCond K)
(lem : ∀ d : D K, d.val = K.zero ∨ ¬ d.val = K.zero) : K.zero = K.one :=
kl_not_all_zero K kl (fun d => (lem d).elim id (fun n => (nn_zero K hf d n).elim))
end SDG
end Found
#print axioms Found.SDG.kl_not_all_zero
#print axioms Found.SDG.nn_zero
#print axioms Found.SDG.kl_lem_clash
lean_all/found/SEAR.lean
/-
T147. found/SEAR — Shulman's SEAR (sets, elements, relations) as a point:
sets = setoids of the core, relations = ≈-respecting binary predicates.
* Relational comprehension: every respecting predicate on X × Y is a
relation.
* Tabulation: every relation is tabulated by a set (the subobject of the
product, core op 3) with two projections that are jointly monic.
* Power sets: relations from X to 1 ↔ points of the core's power X ⇒ Ω.
SEAR ↔ ETCS ↔ ZFC (bounded) are the known equivalences (lines T107, T209).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Core
namespace Found
namespace SEAR
open Core
universe u
structure Rel (X Y : Setd.{u}) where
R : X.car → Y.car → Prop
resp : ∀ {x x' y y'}, X.eqv x x' → Y.eqv y y' → R x y → R x' y'
/-- tabulation: the set of related pairs -/
def tab {X Y : Setd.{u}} (r : Rel X Y) : Setd.{u} := Core.subU (prodS X Y) (fun p => r.R p.1 p.2)
def p1 {X Y : Setd.{u}} (r : Rel X Y) : SHom (tab r) X := ⟨fun p => p.val.1, fun h => h.1⟩
def p2 {X Y : Setd.{u}} (r : Rel X Y) : SHom (tab r) Y := ⟨fun p => p.val.2, fun h => h.2⟩
theorem tab_spec {X Y : Setd.{u}} (r : Rel X Y) (x : X.car) (y : Y.car) :
r.R x y ↔ ∃ t : (tab r).car, X.eqv ((p1 r).fn t) x ∧ Y.eqv ((p2 r).fn t) y :=
⟨fun h => ⟨⟨(x, y), h⟩, X.refl x, Y.refl y⟩,
fun ⟨t, e1, e2⟩ => r.resp e1 e2 t.property⟩
/-- the projections are jointly monic -/
theorem jointly_monic {X Y : Setd.{u}} (r : Rel X Y) (s t : (tab r).car)
(h1 : X.eqv ((p1 r).fn s) ((p1 r).fn t)) (h2 : Y.eqv ((p2 r).fn s) ((p2 r).fn t)) :
(tab r).eqv s t := ⟨h1, h2⟩
/-- relations to the one-point set are points of the power set -/
def toPower {X : Setd.{u}} (r : Rel X (unitS.{u})) : (power X).car :=
⟨fun x => ⟨r.R x PUnit.unit⟩, fun e => ⟨r.resp e trivial, r.resp (X.symm e) trivial⟩⟩
theorem toPower_spec {X : Setd.{u}} (r : Rel X (unitS.{u})) (x : X.car) :
((toPower r).fn x).down ↔ r.R x PUnit.unit := Iff.rfl
end SEAR
end Found
#print axioms Found.SEAR.tab_spec
#print axioms Found.SEAR.jointly_monic
#print axioms Found.SEAR.toPower_spec
lean_all/found/SK.lean
/-
T80. found/SK — SK combinators as a point and the line SK ↔ λ.
* CL terms with weak reduction (K x y ▷ x, S x y z ▷ x z (y z), congruences).
* Translation into the untyped λ-calculus (T78): K ↦ λxy.x,
S ↦ λxyz.xz(yz); every weak step becomes β-reduction (simulation).
* The converse direction, λ → SK by bracket abstraction with
(λe)·x = e[x], is the combinatory completeness of T96 (lam_beta), reused.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.ChurchNum
namespace Found
namespace UL
theorem sub_single_ren {Γ : List Unit} (u : T Γ) (t : T Γ) : sub (single u) (ren V.s t) = t :=
(sub_ren t _ V.s).trans ((sub_ext t (τ := T.var) (fun _ => rfl)).trans (sub_var t))
theorem sub_liftS_ren {Γ Δ : List Unit} (σ : V Γ → T Δ) (w : T Γ) :
sub (liftS σ) (ren V.s w) = ren V.s (sub σ w) :=
(sub_ren w (liftS σ) V.s).trans (ren_sub w V.s σ).symm
def Kt {Γ : List Unit} : T Γ := .lam (.lam (.var (.s .z)))
def St {Γ : List Unit} : T Γ := .lam (.lam (.lam (.app (.app (.var (.s (.s .z))) (.var .z)) (.app (.var (.s .z)) (.var .z)))))
theorem K_beta {Γ : List Unit} (x y : T Γ) : Star Beta (.app (.app Kt x) y) x := by
have s1 : Beta (.app (Kt (Γ := Γ)) x) (.lam (ren V.s x)) := .beta _ _
have s2 : Beta (.app (.lam (ren V.s x)) y) x := by
have b := Beta.beta (ren V.s x) y
have e : inst (ren V.s x) y = x := sub_single_ren y x
rw [e] at b
exact b
exact .step (.appL y s1) (.one s2)
theorem S_beta {Γ : List Unit} (x y z : T Γ) :
Star Beta (.app (.app (.app St x) y) z) (.app (.app x z) (.app y z)) := by
have s1 : Beta (.app (St (Γ := Γ)) x)
(.lam (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z))))) := .beta _ _
have s2 : Beta (.app (.lam (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z))))) y)
(.lam (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z)))) := by
have b := Beta.beta (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z)))) y
have e : inst (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z)))) y =
.lam (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z))) := by
show T.lam (T.app (T.app (sub (liftS (single y)) (ren V.s (ren V.s x))) (T.var V.z))
(T.app (ren V.s y) (T.var V.z))) = _
rw [sub_liftS_ren, sub_single_ren]
rw [e] at b
exact b
have s3 : Beta (.app (.lam (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z)))) z)
(.app (.app x z) (.app y z)) := by
have b := Beta.beta (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z))) z
have e : inst (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z))) z = .app (.app x z) (.app y z) := by
show T.app (T.app (sub (single z) (ren V.s x)) z) (T.app (sub (single z) (ren V.s y)) z) = _
rw [sub_single_ren, sub_single_ren]
rw [e] at b
exact b
exact .step (.appL z (.appL y s1)) (.step (.appL z s2) (.one s3))
end UL
namespace CL
inductive C where
| K : C
| S : C
| app : C → C → C
inductive W : C → C → Prop where
| k (x y : C) : W (.app (.app .K x) y) x
| s (x y z : C) : W (.app (.app (.app .S x) y) z) (.app (.app x z) (.app y z))
| appL {x x'} (y : C) : W x x' → W (.app x y) (.app x' y)
| appR (x : C) {y y'} : W y y' → W (.app x y) (.app x y')
def tr {Γ : List Unit} : C → UL.T Γ
| .K => UL.Kt
| .S => UL.St
| .app a b => .app (tr a) (tr b)
/-- weak reduction is simulated by β-reduction -/
theorem simulate {Γ : List Unit} {a b : C} (h : W a b) : UL.Star UL.Beta (tr (Γ := Γ) a) (tr b) := by
induction h with
| k x y => exact UL.K_beta _ _
| s x y z => exact UL.S_beta _ _ _
| appL y _ ih => exact UL.star_appL _ ih
| appR x _ ih => exact UL.star_appR _ ih
end CL
end Found
#print axioms Found.UL.sub_single_ren
#print axioms Found.UL.sub_liftS_ren
#print axioms Found.UL.K_beta
#print axioms Found.UL.S_beta
#print axioms Found.CL.simulate
lean_all/found/SKLambda.lean
/-
T82/T207 line SK <-> λ. found/SKLambda — the complete translation between
combinatory logic with variables and the untyped λ-calculus (found/Lambda,
found/SK):
* CL terms over a context of variables, weak reduction with congruences;
* bracket abstraction [x]M (I = SKK) and combinatory completeness:
([x]M) N ▷w* M[x := N];
* CL → λ (K, S ↦ Kt, St) simulates weak reduction by β-reduction;
* λ → CL (variables, application, λ ↦ bracket abstraction), and the round
trip λ → CL → λ β-reduces to the original term;
* the round trip CL → λ → CL sends K and S to combinators satisfying the
K and S laws (so they agree applicatively with K and S).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.SK
import found.ChurchTuring2
namespace Found
namespace SKL
open UL CT
/-! ## CL with variables -/
inductive CV : List Unit → Type where
| var {n} : V n → CV n
| K {n} : CV n
| S {n} : CV n
| app {n} : CV n → CV n → CV n
inductive W : {n : List Unit} → CV n → CV n → Prop where
| k {n} (x y : CV n) : W (.app (.app .K x) y) x
| s {n} (x y z : CV n) : W (.app (.app (.app .S x) y) z) (.app (.app x z) (.app y z))
| appL {n} {x x' : CV n} (y : CV n) : W x x' → W (.app x y) (.app x' y)
| appR {n} (x : CV n) {y y' : CV n} : W y y' → W (.app x y) (.app x y')
theorem wstar_appL {n : List Unit} {x x' : CV n} (y : CV n) (h : Star W x x') : Star W (.app x y) (.app x' y) :=
Star.map (fun a => CV.app a y) (fun r => W.appL y r) h
theorem wstar_appR {n : List Unit} (x : CV n) {y y' : CV n} (h : Star W y y') : Star W (.app x y) (.app x y') :=
Star.map (fun b => CV.app x b) (fun r => W.appR x r) h
theorem wstar_app {n : List Unit} {x x' y y' : CV n} (h : Star W x x') (k : Star W y y') :
Star W (.app x y) (.app x' y') :=
Star.trans' (wstar_appL y h) (wstar_appR x' k)
def I {n : List Unit} : CV n := .app (.app .S .K) .K
theorem I_red {n : List Unit} (x : CV n) : Star W (.app I x) x :=
.step (.s _ _ _) (.one (.k _ _))
/-- bracket abstraction -/
def abs {n : List Unit} : CV (() :: n) → CV n
| .var .z => I
| .var (.s v) => .app .K (.var v)
| .K => .app .K .K
| .S => .app .K .S
| .app a b => .app (.app .S (abs a)) (abs b)
/-- substitution of the first variable -/
def csub0 {n : List Unit} (N : CV n) : CV (() :: n) → CV n
| .var .z => N
| .var (.s v) => .var v
| .K => .K
| .S => .S
| .app a b => .app (csub0 N a) (csub0 N b)
/-- combinatory completeness: ([x]M) N ▷w* M[x := N] -/
theorem abs_beta {n : List Unit} (N : CV n) : (M : CV (() :: n)) → Star W (.app (abs M) N) (csub0 N M)
| .var .z => I_red N
| .var (.s _) => .one (.k _ _)
| .K => .one (.k _ _)
| .S => .one (.k _ _)
| .app a b => .step (.s _ _ _) (wstar_app (abs_beta N a) (abs_beta N b))
/-! ## translations -/
def toL {n : List Unit} : CV n → T n
| .var v => .var v
| .K => Kt
| .S => St
| .app a b => .app (toL a) (toL b)
def toC {n : List Unit} : T n → CV n
| .var v => .var v
| .app a b => .app (toC a) (toC b)
| .lam t => abs (toC t)
/-- CL → λ simulates weak reduction -/
theorem simulate {n : List Unit} {a b : CV n} (h : W a b) : Star Beta (toL a) (toL b) := by
induction h with
| k x y => exact K_beta _ _
| s x y z => exact S_beta _ _ _
| appL y _ ih => exact star_appL _ ih
| appR x _ ih => exact star_appR _ ih
theorem single_lift {n : List Unit} (t : T (() :: n)) : sub (single (.var .z)) (ren (lift V.s) t) = t := by
have e : ∀ v : V (() :: n), single (T.var V.z) (lift V.s v) = T.var v := fun v => match v with
| .z => rfl
| .s _ => rfl
exact (sub_ren t _ _).trans ((sub_ext t e).trans (sub_var t))
/-- an η-free step: (λ t)↑ applied to the fresh variable β-reduces to t -/
theorem shift_lam_z {n : List Unit} (t : T (() :: n)) :
Star Beta (.app (ren V.s (.lam t)) (.var .z)) t := by
have b := Beta.beta (ren (lift V.s) t) (T.var V.z)
have e : inst (ren (lift V.s) t) (T.var V.z) = t := single_lift t
rw [e] at b
exact .one b
theorem St_open {n : List Unit} (x y : T n) :
Star Beta (.app (.app St x) y) (.lam (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z)))) := by
have s1 : Beta (.app (St (Γ := n)) x)
(.lam (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z))))) := .beta _ _
have s2 : Beta (.app (.lam (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z))))) y)
(.lam (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z)))) := by
have b := Beta.beta (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z)))) y
have e : inst (.lam (.app (.app (ren V.s (ren V.s x)) (.var .z)) (.app (.var (.s .z)) (.var .z)))) y =
.lam (.app (.app (ren V.s x) (.var .z)) (.app (ren V.s y) (.var .z))) := by
show T.lam (T.app (T.app (sub (liftS (single y)) (ren V.s (ren V.s x))) (T.var V.z))
(T.app (ren V.s y) (T.var V.z))) = _
rw [sub_liftS_ren, sub_single_ren]
rw [e] at b
exact b
exact .step (.appL y s1) (.one s2)
/-- bracket abstraction is λ-abstraction up to β -/
theorem abs_lam {n : List Unit} : (M : CV (() :: n)) → Star Beta (toL (abs M)) (.lam (toL M))
| .var .z => by
show Star Beta (.app (.app St Kt) Kt) (.lam (.var .z))
refine Star.trans' (St_open _ _) (star_lam ?_)
exact K_beta _ _
| .var (.s v) => .one (.beta _ _)
| .K => .one (.beta _ _)
| .S => .one (.beta _ _)
| .app a b => by
show Star Beta (.app (.app St (toL (abs a))) (toL (abs b))) (.lam (.app (toL a) (toL b)))
refine Star.trans' (star_app (star_appR _ (abs_lam a)) (abs_lam b)) (Star.trans' (St_open _ _) (star_lam ?_))
exact star_app (shift_lam_z _) (shift_lam_z _)
/-- the round trip λ → CL → λ β-reduces to the original term -/
theorem roundtrip {n : List Unit} : (t : T n) → Star Beta (toL (toC t)) t
| .var _ => .refl _
| .app a b => star_app (roundtrip a) (roundtrip b)
| .lam t => Star.trans' (abs_lam (toC t)) (star_lam (roundtrip t))
/-- the round trip CL → λ → CL: the images of K and S satisfy the K and S laws -/
theorem K_back {n : List Unit} (x y : CV n) : Star W (.app (.app (toC (toL (CV.K (n := n)))) x) y) x := by
show Star W (.app (.app (abs (abs (.var (.s .z)))) x) y) x
refine Star.trans' (wstar_appL y (abs_beta x _)) ?_
exact .one (.k _ _)
end SKL
end Found
#print axioms Found.SKL.abs_beta
#print axioms Found.SKL.simulate
#print axioms Found.SKL.abs_lam
#print axioms Found.SKL.roundtrip
#print axioms Found.SKL.K_back
lean_all/found/SN.lean
/-
T79 line, part 1. found/SN — strong normalization of the simply typed
λ-calculus (Tait), on the scoped de Bruijn terms of found/Lambda.
Part 1: inversion of β-steps (through projection functions, no `cases`
on constructor-indexed steps), β under renaming and its reflection, and
strong normalizability (Acc of the converse step relation) under renaming.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Lambda
namespace Found
namespace SN
open UL
def tagT {n : List Unit} : T n → Nat
| .var _ => 0
| .app _ _ => 1
| .lam _ => 2
def appFn {n : List Unit} : T n → T n
| .var x => .var x
| .app a _ => a
| .lam t => .lam t
def appArg {n : List Unit} : T n → T n
| .var x => .var x
| .app _ b => b
| .lam t => .lam t
def lamBody {n : List Unit} : T n → T (() :: n)
| .var x => .var (.s x)
| .app a b => ren V.s (.app a b)
| .lam t => t
theorem beqN_refl : (n : Nat) → Nat.beq n n = true
| 0 => rfl
| n + 1 => beqN_refl n
theorem tag_ne {n : List Unit} {s t : T n} (e : s = t) (h : Nat.beq (tagT s) (tagT t) = false) : False :=
Bool.noConfusion (h.symm.trans ((congrArg (fun x => Nat.beq (tagT x) (tagT t)) e).trans (beqN_refl _)))
/-- inversion of a step from an application -/
theorem beta_app_inv {n : List Unit} {s v : T n} (h : Beta s v) : ∀ a b, s = .app a b →
(∃ a', Beta a a' ∧ v = .app a' b) ∨ (∃ b', Beta b b' ∧ v = .app a b') ∨ (∃ t, a = .lam t ∧ v = inst t b) := by
induction h with
| beta t u =>
intro a b e
have ea : T.lam t = a := congrArg appFn e
have eb : u = b := congrArg appArg e
subst ea eb
exact Or.inr (Or.inr ⟨t, rfl, rfl⟩)
| appL b0 hstep _ =>
intro a b e
have ea := congrArg appFn e
have eb := congrArg appArg e
subst ea eb
exact Or.inl ⟨_, hstep, rfl⟩
| appR a0 hstep _ =>
intro a b e
have ea := congrArg appFn e
have eb := congrArg appArg e
subst ea eb
exact Or.inr (Or.inl ⟨_, hstep, rfl⟩)
| lam _ _ => intro a b e; exact (tag_ne e rfl).elim
/-- inversion of a step from an abstraction -/
theorem beta_lam_inv {n : List Unit} {s v : T n} (h : Beta s v) : ∀ t, s = .lam t → ∃ t', Beta t t' ∧ v = .lam t' := by
induction h with
| beta _ _ => intro t e; exact (tag_ne e rfl).elim
| appL _ _ _ => intro t e; exact (tag_ne e rfl).elim
| appR _ _ _ => intro t e; exact (tag_ne e rfl).elim
| lam hstep _ =>
intro t e
have et := congrArg lamBody e
subst et
exact ⟨_, hstep, rfl⟩
theorem beta_var {n : List Unit} {s v : T n} (h : Beta s v) : ∀ x, s ≠ .var x := by
induction h with
| beta _ _ => exact fun x e => tag_ne e rfl
| appL _ _ _ => exact fun x e => tag_ne e rfl
| appR _ _ _ => exact fun x e => tag_ne e rfl
| lam _ _ => exact fun x e => tag_ne e rfl
/-- β is preserved by renaming -/
theorem beta_ren {m : List Unit} {t t' : T m} (h : Beta t t') : ∀ {n : List Unit} (r : V m → V n), Beta (ren r t) (ren r t') := by
induction h with
| beta t u => exact fun r => by rw [ren_inst]; exact .beta _ _
| appL b _ ih => exact fun r => .appL _ (ih r)
| appR a _ ih => exact fun r => .appR _ (ih r)
| lam _ ih => exact fun r => .lam (ih (lift r))
/-- and reflected by renaming -/
theorem ren_reflect {m : List Unit} : (t : T m) → ∀ {n : List Unit} (r : V m → V n) (v : T n),
Beta (ren r t) v → ∃ t', Beta t t' ∧ v = ren r t'
| .var x, _, r, v, h => (beta_var h (r x) rfl).elim
| .app a b, _, r, v, h => by
rcases beta_app_inv h (ren r a) (ren r b) rfl with ⟨a', ha, e⟩ | ⟨b', hb, e⟩ | ⟨t0, ea, e⟩
· match ren_reflect a r a' ha with
| ⟨a1, h1, e1⟩ => exact ⟨.app a1 b, .appL _ h1, by rw [e, e1]; rfl⟩
· match ren_reflect b r b' hb with
| ⟨b1, h1, e1⟩ => exact ⟨.app a b1, .appR _ h1, by rw [e, e1]; rfl⟩
· cases a with
| var x => exact (tag_ne ea rfl).elim
| app _ _ => exact (tag_ne ea rfl).elim
| lam a1 =>
have et : ren (lift r) a1 = t0 := congrArg lamBody ea
exact ⟨inst a1 b, .beta _ _, by rw [e, ← et, ← ren_inst]⟩
| .lam t, _, r, v, h => by
match beta_lam_inv h (ren (lift r) t) rfl with
| ⟨t'', h1, e⟩ => match ren_reflect t (lift r) t'' h1 with
| ⟨t1, h2, e2⟩ => exact ⟨.lam t1, .lam h2, by rw [e, e2]; rfl⟩
/-- strong normalizability -/
def SNt {n : List Unit} (t : T n) : Prop := Acc (fun x y : T n => Beta y x) t
theorem sn_ren {m : List Unit} {t : T m} (h : SNt t) : ∀ {n : List Unit} (r : V m → V n), SNt (ren r t) := by
induction h with
| intro t _ ih =>
exact fun r => .intro _ (fun v hv => match ren_reflect t r v hv with
| ⟨t', h1, e⟩ => e ▸ ih t' h1 r)
/-- strong normalizability pulls back along any step-preserving map -/
theorem sn_back {m n : List Unit} (f : T m → T n) (hf : ∀ {x y}, Beta x y → Beta (f x) (f y)) :
∀ y, SNt y → ∀ x, f x = y → SNt x := by
intro y hy
induction hy with
| intro y _ ih =>
intro x e
exact .intro _ (fun x' hx' => ih (f x') (e ▸ hf hx') x' rfl)
theorem sn_appL {n : List Unit} {a b : T n} (h : SNt (.app a b)) : SNt a :=
sn_back (fun x => T.app x b) (fun hs => .appL _ hs) _ h a rfl
theorem sn_unren {m n : List Unit} (r : V m → V n) {t : T m} (h : SNt (ren r t)) : SNt t :=
sn_back (ren r) (fun hs => beta_ren hs r) _ h t rfl
/-! ## Part 2: substitution and steps -/
theorem tag_ren {m n : List Unit} (r : V m → V n) : (t : T m) → tagT (ren r t) = tagT t
| .var _ => rfl
| .app _ _ => rfl
| .lam _ => rfl
theorem ren_id : {m : List Unit} → (t : T m) → ren (fun v => v) t = t
| _, .var _ => rfl
| _, .app a b => by show T.app _ _ = _; rw [ren_id a, ren_id b]
| _, .lam t => by
show T.lam (ren (lift fun v => v) t) = _
rw [ren_ext t (r' := fun v => v) (fun v => match v with | .z => rfl | .s _ => rfl), ren_id t]
theorem beta_sub {m : List Unit} {t t' : T m} (h : Beta t t') :
∀ {n : List Unit} (σ : V m → T n), Beta (sub σ t) (sub σ t') := by
induction h with
| beta t u => exact fun σ => by rw [← sub_inst]; exact .beta _ _
| appL b _ ih => exact fun σ => .appL _ (ih σ)
| appR a _ ih => exact fun σ => .appR _ (ih σ)
| lam _ ih => exact fun σ => .lam (ih (liftS σ))
theorem star_tr {n : List Unit} {a b c : T n} (h : Star Beta a b) (k : Star Beta b c) : Star Beta a c := h.trans' k
theorem star_ren' {m n : List Unit} (r : V m → V n) {a b : T m} (h : Star Beta a b) : Star Beta (ren r a) (ren r b) :=
Star.map (ren r) (fun hs => beta_ren hs r) h
theorem star_sub' : {m : List Unit} → (t : T m) → ∀ {n : List Unit} {σ τ : V m → T n},
(∀ v, Star Beta (σ v) (τ v)) → Star Beta (sub σ t) (sub τ t)
| _, .var v, _, _, _, h => h v
| _, .app a b, _, _, _, h => star_tr (Star.map (fun x => T.app x _) (fun hs => .appL _ hs) (star_sub' a h))
(Star.map (T.app _) (fun hs => .appR _ hs) (star_sub' b h))
| _, .lam t, _, _, _, h => Star.map T.lam (fun hs => .lam hs) (star_sub' t (fun v => match v with
| .z => .refl _
| .s w => star_ren' V.s (h w)))
/-! ## Part 3: types, reducibility, the CR properties -/
inductive Ty where
| base : Ty
| arr : Ty → Ty → Ty
def consT {n : List Unit} (A : Ty) (Γ : V n → Ty) : V (() :: n) → Ty
| .z => A
| .s x => Γ x
inductive Typed : {n : List Unit} → (V n → Ty) → T n → Ty → Prop where
| var {n} {Γ : V n → Ty} (x : V n) : Typed Γ (.var x) (Γ x)
| app {n} {Γ : V n → Ty} {f a : T n} {A B : Ty} : Typed Γ f (.arr A B) → Typed Γ a A → Typed Γ (.app f a) B
| lam {n} {Γ : V n → Ty} {b : T (() :: n)} {A B : Ty} : Typed (consT A Γ) b B → Typed Γ (.lam b) (.arr A B)
/-- Tait's reducibility, Kripke-style along renamings -/
def Red : Ty → {n : List Unit} → T n → Prop
| .base, _, t => SNt t
| .arr A B, n, t => ∀ {m : List Unit} (r : V n → V m) (u : T m), Red A u → Red B (.app (ren r t) u)
def Ne {n : List Unit} (t : T n) : Prop := tagT t ≠ 2
theorem ne_app {n : List Unit} (a b : T n) : Ne (.app a b) := fun e =>
Nat.noConfusion (Nat.succ.inj (e : (1 : Nat) = 2))
theorem ne_var {n : List Unit} (x : V n) : Ne (.var x) := fun e => Nat.noConfusion (e : (0 : Nat) = 2)
structure CR (A : Ty) : Prop where
cr1 : ∀ {n} (t : T n), Red A t → SNt t
cr2 : ∀ {n} (t t' : T n), Red A t → Beta t t' → Red A t'
cr3 : ∀ {n} (t : T n), Ne t → (∀ t', Beta t t' → Red A t') → Red A t
mono : ∀ {n m} (r : V n → V m) (t : T n), Red A t → Red A (ren r t)
theorem var_red {A : Ty} (h : CR A) {n : List Unit} (x : V n) : Red A (.var x) :=
h.cr3 _ (ne_var x) (fun _ st => (beta_var st x rfl).elim)
theorem cr : (A : Ty) → CR A
| .base => ⟨fun _ h => h, fun t t' h st => match h with | .intro _ k => k t' st,
fun t _ h => .intro _ h, fun r t h => sn_ren h r⟩
| .arr A B =>
have hA := cr A
have hB := cr B
{ cr1 := fun t h => by
have h1 := hB.cr1 _ (h V.s (.var .z) (var_red hA .z))
exact sn_unren V.s (sn_appL h1)
cr2 := fun t t' h st => fun r u hu => hB.cr2 _ _ (h r u hu) (.appL _ (beta_ren st r))
cr3 := fun t hne h => fun r u hu => by
have hsn := hA.cr1 u hu
induction hsn with
| intro u _ ih =>
refine hB.cr3 _ (ne_app _ _) (fun v st => ?_)
rcases beta_app_inv st (ren r t) u rfl with ⟨a', ha, e⟩ | ⟨b', hb, e⟩ | ⟨t0, ea, _⟩
· match ren_reflect t r a' ha with
| ⟨t1, h1, e1⟩ => rw [e, e1]; exact h t1 h1 r u hu
· rw [e]; exact ih b' hb (hA.cr2 _ _ hu hb)
· exact (hne (by rw [← tag_ren r t, ea]; rfl)).elim
mono := fun r t h => fun r' u hu => by
rw [ren_ren]
exact h (fun v => r' (r v)) u hu }
/-! ## Part 4: head expansion, the fundamental lemma, strong normalization -/
theorem red_star {B : Ty} (hB : CR B) {n : List Unit} {t t' : T n} (h : Star Beta t t') (r : Red B t) : Red B t' := by
induction h with
| refl => exact r
| step st _ ih => exact ih (hB.cr2 _ _ r st)
theorem head_exp {B : Ty} (hB : CR B) {n : List Unit} (b : T (() :: n)) (hb : SNt b) :
∀ u, SNt u → Red B (inst b u) → Red B (.app (.lam b) u) := by
induction hb with
| intro b _ ihb =>
intro u hu
induction hu with
| intro u hacc ihu =>
intro hr
refine hB.cr3 _ (ne_app _ _) (fun v st => ?_)
rcases beta_app_inv st (.lam b) u rfl with ⟨a', ha, e⟩ | ⟨u', hu', e⟩ | ⟨t0, ea, e⟩
· match beta_lam_inv ha b rfl with
| ⟨b', hb', e'⟩ =>
rw [e, e']
exact ihb b' hb' u (.intro u hacc) (hB.cr2 _ _ hr (beta_sub hb' (single u)))
· rw [e]
exact ihu u' hu' (red_star hB (star_sub' b (σ := single u) (τ := single u') (fun v => match v with
| .z => .one hu'
| .s _ => .refl _)) hr)
· have et : b = t0 := congrArg lamBody ea
rw [e, ← et]
exact hr
theorem sub_var_ren {m n : List Unit} (r : V m → V n) (t : T m) : sub (fun v => T.var (r v)) t = ren r t := by
rw [← sub_ren t T.var r, sub_var]
/-- the fundamental lemma: typed terms are reducible under reducible substitutions -/
theorem fund {n : List Unit} {Γ : V n → Ty} {t : T n} {A : Ty} (d : Typed Γ t A) :
∀ {m : List Unit} (σ : V n → T m), (∀ x, Red (Γ x) (σ x)) → Red A (sub σ t) := by
induction d with
| var x => exact fun σ h => h x
| @app n Γ f a A B _ _ ih1 ih2 =>
intro m σ h
have := ih1 σ h (fun v => v) (sub σ a) (ih2 σ h)
rw [ren_id] at this
exact this
| @lam n Γ b A B _ ih =>
intro m σ h m' r u hu
show Red B (T.app (T.lam (ren (lift r) (sub (liftS σ) b))) u)
-- the substitution after instantiating u
let τ : V (() :: n) → T m' := fun x => match x with
| .z => u
| .s y => ren r (σ y)
have hτ : ∀ x, Red (consT A Γ x) (τ x) := fun x => match x with
| .z => hu
| .s y => (cr _).mono r (σ y) (h y)
have e1 : inst (ren (lift r) (sub (liftS σ) b)) u = sub τ b := by
show sub (single u) (ren (lift r) (sub (liftS σ) b)) = _
rw [sub_ren, sub_sub]
refine sub_ext b (fun x => ?_)
match x with
| .z => rfl
| .s y =>
show sub (fun w => single u (lift r w)) (ren V.s (σ y)) = ren r (σ y)
rw [sub_ren]
exact sub_var_ren r (σ y)
-- the body is strongly normalizing
let σ0 : V (() :: n) → T (() :: m') := fun x => ren (lift r) (liftS σ x)
have hσ0 : ∀ x, Red (consT A Γ x) (σ0 x) := fun x => match x with
| .z => var_red (cr A) .z
| .s y => (cr _).mono (lift r) _ ((cr _).mono V.s (σ y) (h y))
have e2 : ren (lift r) (sub (liftS σ) b) = sub σ0 b := ren_sub b (lift r) (liftS σ)
have hsnb : SNt (ren (lift r) (sub (liftS σ) b)) := by
rw [e2]; exact (cr B).cr1 _ (ih σ0 hσ0)
exact head_exp (cr B) _ hsnb u ((cr A).cr1 u hu) (by rw [e1]; exact ih τ hτ)
/-- strong normalization of the simply typed λ-calculus -/
theorem strong_normalization {n : List Unit} {Γ : V n → Ty} {t : T n} {A : Ty} (d : Typed Γ t A) : SNt t := by
have h := fund d T.var (fun x => var_red (cr _) x)
rw [sub_var] at h
exact (cr A).cr1 t h
end SN
end Found
#print axioms Found.SN.beta_app_inv
#print axioms Found.SN.ren_reflect
#print axioms Found.SN.sn_ren
#print axioms Found.SN.sn_unren
#print axioms Found.SN.cr
#print axioms Found.SN.head_exp
#print axioms Found.SN.fund
#print axioms Found.SN.strong_normalization
lean_all/found/SNF.lean
/-
T79 line, System F. found/SNF — strong normalization of System F (Curry
style, on the untyped scoped terms of found/Lambda) by Girard's
reducibility candidates.
Part A: candidates (predicates on terms of every scope satisfying CR1–CR3
and closed under renaming); the strongly normalizing terms form one;
candidates are closed under the arrow construction and under arbitrary
intersections (impredicatively).
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: impredicative Prop (∀ over candidates).
-/
import found.SN
namespace Found
namespace SNF
open UL SN
structure Cand where
P : {n : List Unit} → T n → Prop
cr1 : ∀ {n} (t : T n), P t → SNt t
cr2 : ∀ {n} (t t' : T n), P t → Beta t t' → P t'
cr3 : ∀ {n} (t : T n), Ne t → (∀ t', Beta t t' → P t') → P t
mono : ∀ {n m} (r : V n → V m) (t : T n), P t → P (ren r t)
def snC : Cand where
P t := SNt t
cr1 _ h := h
cr2 _ t' h st := match h with | .intro _ k => k t' st
cr3 _ _ h := .intro _ h
mono r _ h := sn_ren h r
theorem var_in (C : Cand) {n : List Unit} (x : V n) : C.P (.var x) :=
C.cr3 _ (ne_var x) (fun _ st => (beta_var st x rfl).elim)
def arrC (A B : Cand) : Cand where
P t := ∀ {m : List Unit} (r : _ → V m) (u : T m), A.P u → B.P (.app (ren r t) u)
cr1 t h := sn_unren V.s (sn_appL (B.cr1 _ (h V.s (.var .z) (var_in A .z))))
cr2 t t' h st := fun r u hu => B.cr2 _ _ (h r u hu) (.appL _ (beta_ren st r))
cr3 t hne h := fun r u hu => by
have hsn := A.cr1 u hu
induction hsn with
| intro u _ ih =>
refine B.cr3 _ (ne_app _ _) (fun v st => ?_)
rcases beta_app_inv st (ren r t) u rfl with ⟨a', ha, e⟩ | ⟨b', hb, e⟩ | ⟨t0, ea, _⟩
· match ren_reflect t r a' ha with
| ⟨t1, h1, e1⟩ => rw [e, e1]; exact h t1 h1 r u hu
· rw [e]; exact ih b' hb (A.cr2 _ _ hu hb)
· exact (hne (by rw [← tag_ren r t, ea]; rfl)).elim
mono r t h := fun r' u hu => by
rw [ren_ren]
exact h (fun v => r' (r v)) u hu
/-- intersection of all candidates F C -/
def allC (F : Cand → Cand) : Cand where
P t := ∀ C : Cand, (F C).P t
cr1 t h := (F snC).cr1 t (h snC)
cr2 t t' h st := fun C => (F C).cr2 t t' (h C) st
cr3 t hne h := fun C => (F C).cr3 t hne (fun t' st => h t' st C)
mono r t h := fun C => (F C).mono r t (h C)
/-! ## Part B: types, interpretation, substitution lemma -/
inductive Ty where
| var : Nat → Ty
| arr : Ty → Ty → Ty
| all : Ty → Ty
def upN (f : Nat → Nat) : Nat → Nat
| 0 => 0
| i + 1 => f i + 1
def tren (f : Nat → Nat) : Ty → Ty
| .var i => .var (f i)
| .arr A B => .arr (tren f A) (tren f B)
| .all A => .all (tren (upN f) A)
def upT (σ : Nat → Ty) : Nat → Ty
| 0 => .var 0
| i + 1 => tren Nat.succ (σ i)
def tsub (σ : Nat → Ty) : Ty → Ty
| .var i => σ i
| .arr A B => .arr (tsub σ A) (tsub σ B)
| .all A => .all (tsub (upT σ) A)
def consC (C : Cand) (ρ : Nat → Cand) : Nat → Cand
| 0 => C
| i + 1 => ρ i
def interp : Ty → (Nat → Cand) → Cand
| .var i, ρ => ρ i
| .arr A B, ρ => arrC (interp A ρ) (interp B ρ)
| .all A, ρ => allC (fun C => interp A (consC C ρ))
def CEq (C D : Cand) : Prop := ∀ {n : List Unit} (t : T n), C.P t ↔ D.P t
theorem interp_ext : (A : Ty) → {ρ ρ' : Nat → Cand} → (∀ i, CEq (ρ i) (ρ' i)) → CEq (interp A ρ) (interp A ρ')
| .var i, _, _, h => h i
| .arr A B, _, _, h => fun _ =>
⟨fun k {_} r u hu => (interp_ext B h _).mp (k r u ((interp_ext A h u).mpr hu)),
fun k {_} r u hu => (interp_ext B h _).mpr (k r u ((interp_ext A h u).mp hu))⟩
| .all A, ρ, ρ', h => fun t =>
have hc : ∀ C, ∀ i, CEq (consC C ρ i) (consC C ρ' i) := fun _ i => match i with
| 0 => fun _ => Iff.rfl
| i + 1 => h i
⟨fun k C => (interp_ext A (hc C) t).mp (k C), fun k C => (interp_ext A (hc C) t).mpr (k C)⟩
theorem interp_ren : (A : Ty) → (f : Nat → Nat) → (ρ : Nat → Cand) →
CEq (interp (tren f A) ρ) (interp A (fun i => ρ (f i)))
| .var _, _, _ => fun _ => Iff.rfl
| .arr A B, f, ρ => fun _ =>
⟨fun k {_} r u hu => (interp_ren B f ρ _).mp (k r u ((interp_ren A f ρ u).mpr hu)),
fun k {_} r u hu => (interp_ren B f ρ _).mpr (k r u ((interp_ren A f ρ u).mp hu))⟩
| .all A, f, ρ => fun t =>
have hc : ∀ C, CEq (interp (tren (upN f) A) (consC C ρ)) (interp A (consC C (fun i => ρ (f i)))) := fun C =>
fun t => (interp_ren A (upN f) (consC C ρ) t).trans
(interp_ext A (ρ := fun i => consC C ρ (upN f i)) (ρ' := consC C (fun i => ρ (f i)))
(fun i => match i with | 0 => fun _ => Iff.rfl | _ + 1 => fun _ => Iff.rfl) t)
⟨fun k C => (hc C t).mp (k C), fun k C => (hc C t).mpr (k C)⟩
theorem interp_sub : (A : Ty) → (σ : Nat → Ty) → (ρ : Nat → Cand) →
CEq (interp (tsub σ A) ρ) (interp A (fun i => interp (σ i) ρ))
| .var _, _, _ => fun _ => Iff.rfl
| .arr A B, σ, ρ => fun _ =>
⟨fun k {_} r u hu => (interp_sub B σ ρ _).mp (k r u ((interp_sub A σ ρ u).mpr hu)),
fun k {_} r u hu => (interp_sub B σ ρ _).mpr (k r u ((interp_sub A σ ρ u).mp hu))⟩
| .all A, σ, ρ => fun t =>
have hc : ∀ C, CEq (interp (tsub (upT σ) A) (consC C ρ)) (interp A (consC C (fun i => interp (σ i) ρ))) :=
fun C {_} t => (interp_sub A (upT σ) (consC C ρ) t).trans (interp_ext A
(ρ := fun i => interp (upT σ i) (consC C ρ)) (ρ' := consC C (fun i => interp (σ i) ρ)) (fun i => match i with
| 0 => fun _ => Iff.rfl
| i + 1 => fun t' => interp_ren (σ i) Nat.succ (consC C ρ) t') t)
⟨fun k C => (hc C t).mp (k C), fun k C => (hc C t).mpr (k C)⟩
def single0 (B : Ty) : Nat → Ty
| 0 => B
| i + 1 => .var i
theorem interp_inst (A B : Ty) (ρ : Nat → Cand) : CEq (interp (tsub (single0 B) A) ρ) (interp A (consC (interp B ρ) ρ)) :=
fun t => (interp_sub A (single0 B) ρ t).trans
(interp_ext A (ρ := fun i => interp (single0 B i) ρ) (ρ' := consC (interp B ρ) ρ)
(fun i => match i with | 0 => fun _ => Iff.rfl | _ + 1 => fun _ => Iff.rfl) t)
/-! ## Part C: typing, the fundamental lemma, strong normalization -/
def consTy {n : List Unit} (A : Ty) (Γ : V n → Ty) : V (() :: n) → Ty
| .z => A
| .s x => Γ x
/-- Curry-style System F -/
inductive TypedF : {n : List Unit} → (V n → Ty) → T n → Ty → Prop where
| var {n} {Γ : V n → Ty} (x : V n) : TypedF Γ (.var x) (Γ x)
| app {n} {Γ : V n → Ty} {f a : T n} {A B : Ty} : TypedF Γ f (.arr A B) → TypedF Γ a A → TypedF Γ (.app f a) B
| lam {n} {Γ : V n → Ty} {b : T (() :: n)} {A B : Ty} : TypedF (consTy A Γ) b B → TypedF Γ (.lam b) (.arr A B)
| tabs {n} {Γ : V n → Ty} {t : T n} {A : Ty} : TypedF (fun x => tren Nat.succ (Γ x)) t A → TypedF Γ t (.all A)
| tapp {n} {Γ : V n → Ty} {t : T n} {A : Ty} (B : Ty) : TypedF Γ t (.all A) → TypedF Γ t (tsub (single0 B) A)
theorem cand_star (B : Cand) {n : List Unit} {t t' : T n} (h : Star Beta t t') (r : B.P t) : B.P t' := by
induction h with
| refl => exact r
| step st _ ih => exact ih (B.cr2 _ _ r st)
theorem head_expC (B : Cand) {n : List Unit} (b : T (() :: n)) (hb : SNt b) :
∀ u, SNt u → B.P (inst b u) → B.P (.app (.lam b) u) := by
induction hb with
| intro b _ ihb =>
intro u hu
induction hu with
| intro u hacc ihu =>
intro hr
refine B.cr3 _ (ne_app _ _) (fun v st => ?_)
rcases beta_app_inv st (.lam b) u rfl with ⟨a', ha, e⟩ | ⟨u', hu', e⟩ | ⟨t0, ea, e⟩
· match beta_lam_inv ha b rfl with
| ⟨b', hb', e'⟩ =>
rw [e, e']
exact ihb b' hb' u (.intro u hacc) (B.cr2 _ _ hr (beta_sub hb' (single u)))
· rw [e]
exact ihu u' hu' (cand_star B (star_sub' b (σ := single u) (τ := single u') (fun v => match v with
| .z => .one hu'
| .s _ => .refl _)) hr)
· have et : b = t0 := congrArg lamBody ea
rw [e, ← et]
exact hr
theorem fundF {n : List Unit} {Γ : V n → Ty} {t : T n} {A : Ty} (d : TypedF Γ t A) :
∀ (ρ : Nat → Cand) {m : List Unit} (σ : V n → T m), (∀ x, (interp (Γ x) ρ).P (σ x)) → (interp A ρ).P (sub σ t) := by
induction d with
| var x => exact fun _ {_} _ h => h x
| @app n Γ f a A B _ _ ih1 ih2 =>
intro ρ m σ h
have := ih1 ρ σ h (fun v => v) (sub σ a) (ih2 ρ σ h)
rw [ren_id] at this
exact this
| @lam n Γ b A B _ ih =>
intro ρ m σ h m' r u hu
show (interp B ρ).P (T.app (T.lam (ren (lift r) (sub (liftS σ) b))) u)
let τ : V (() :: n) → T m' := fun x => match x with
| .z => u
| .s y => ren r (σ y)
have hτ : ∀ x, (interp (consTy A Γ x) ρ).P (τ x) := fun x => match x with
| .z => hu
| .s y => (interp _ ρ).mono r (σ y) (h y)
have e1 : inst (ren (lift r) (sub (liftS σ) b)) u = sub τ b := by
show sub (single u) (ren (lift r) (sub (liftS σ) b)) = _
rw [sub_ren, sub_sub]
refine sub_ext b (fun x => ?_)
match x with
| .z => rfl
| .s y =>
show sub (fun w => single u (lift r w)) (ren V.s (σ y)) = ren r (σ y)
rw [sub_ren]
exact sub_var_ren r (σ y)
let σ0 : V (() :: n) → T (() :: m') := fun x => ren (lift r) (liftS σ x)
have hσ0 : ∀ x, (interp (consTy A Γ x) ρ).P (σ0 x) := fun x => match x with
| .z => var_in (interp A ρ) .z
| .s y => (interp _ ρ).mono (lift r) _ ((interp _ ρ).mono V.s (σ y) (h y))
have e2 : ren (lift r) (sub (liftS σ) b) = sub σ0 b := ren_sub b (lift r) (liftS σ)
have hsnb : SNt (ren (lift r) (sub (liftS σ) b)) := by
rw [e2]; exact (interp B ρ).cr1 _ (ih ρ σ0 hσ0)
exact head_expC (interp B ρ) _ hsnb u ((interp A ρ).cr1 u hu) (by rw [e1]; exact ih ρ τ hτ)
| @tabs n Γ t A _ ih =>
intro ρ m σ h C
exact ih (consC C ρ) σ (fun x => (interp_ren (Γ x) Nat.succ (consC C ρ) (σ x)).mpr (h x))
| @tapp n Γ t A B _ ih =>
intro ρ m σ h
exact (interp_inst A B ρ _).mpr (ih ρ σ h (interp B ρ))
/-- strong normalization of System F -/
theorem strong_normalization_F {n : List Unit} {Γ : V n → Ty} {t : T n} {A : Ty} (d : TypedF Γ t A) : SNt t := by
have h := fundF d (fun _ => snC) T.var (fun x => var_in _ x)
rw [sub_var] at h
exact (interp A _).cr1 t h
end SNF
end Found
#print axioms Found.SNF.arrC
#print axioms Found.SNF.allC
#print axioms Found.SNF.interp_sub
#print axioms Found.SNF.interp_inst
#print axioms Found.SNF.fundF
#print axioms Found.SNF.strong_normalization_F
lean_all/found/STLC_F.lean
/-
T79. found/STLC_F — normalization for the simply typed λ-calculus as a
point (the λ coordinate with a type parameter):
* intrinsically typed terms over contexts (List Ty), a semantic domain by
structural recursion on types (Sem ι = neutral-code generators,
Sem (A→B) = Sem A → Sem B), evaluation, and reify/reflect with de Bruijn
levels: normalization by evaluation, total by construction.
* Tait-style logical predicate (Good): reflect sends neutrals to Good
values, reify sends Good values to β-normal forms; every closed term's
output is in normal form (IsNf).
Strong normalization by Tait reducibility and System F (Girard's
candidates, impredicative) are cited — OPEN_LEMMAS T79a.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace NbE
inductive Ty where
| base : Ty
| arr : Ty → Ty → Ty
inductive Var : List Ty → Ty → Type where
| zero {Γ A} : Var (A :: Γ) A
| succ {Γ A B} : Var Γ A → Var (B :: Γ) A
inductive Tm : List Ty → Ty → Type where
| var {Γ A} : Var Γ A → Tm Γ A
| lam {Γ A B} : Tm (A :: Γ) B → Tm Γ (.arr A B)
| app {Γ A B} : Tm Γ (.arr A B) → Tm Γ A → Tm Γ B
inductive Raw where
| var : Nat → Raw
| lam : Raw → Raw
| app : Raw → Raw → Raw
mutual
inductive IsNf : Raw → Prop where
| lam {b} : IsNf b → IsNf (.lam b)
| ne {t} : IsNe t → IsNf t
inductive IsNe : Raw → Prop where
| var (n) : IsNe (.var n)
| app {f a} : IsNe f → IsNf a → IsNe (.app f a)
end
def Sem : Ty → Type
| .base => Nat → Raw
| .arr A B => Sem A → Sem B
/-- reflect (neutral generator → value) and reify (value → normal code), at depth -/
def rr : (A : Ty) → ((Nat → Raw) → Sem A) × (Sem A → Nat → Raw)
| .base => (fun ne => ne, fun f n => f n)
| .arr A B => (fun ne a => (rr B).1 (fun n => .app (ne n) ((rr A).2 a n)),
fun f n => .lam ((rr B).2 (f ((rr A).1 (fun m => .var (m - n - 1)))) (n + 1)))
def Good : (A : Ty) → Sem A → Prop
| .base, f => ∀ n, IsNe (f n)
| .arr A B, g => ∀ a, Good A a → Good B (g a)
theorem rr_good : (A : Ty) →
(∀ ne : Nat → Raw, (∀ n, IsNe (ne n)) → Good A ((rr A).1 ne)) ∧
(∀ a : Sem A, Good A a → ∀ n, IsNf ((rr A).2 a n))
| .base => ⟨fun _ h => h, fun _ h n => .ne (h n)⟩
| .arr A B =>
⟨fun _ h a ga => (rr_good B).1 _ (fun n => .app (h n) ((rr_good A).2 a ga n)),
fun _ gf n => .lam ((rr_good B).2 _ (gf _ ((rr_good A).1 _ (fun _ => .var _))) (n + 1))⟩
inductive Env : List Ty → Type where
| nil : Env []
| cons {Γ A} : Sem A → Env Γ → Env (A :: Γ)
def lookup : {Γ : List Ty} → {A : Ty} → Var Γ A → Env Γ → Sem A
| _, _, .zero, .cons a _ => a
| _, _, .succ x, .cons _ ρ => lookup x ρ
def eval : {Γ : List Ty} → {A : Ty} → Tm Γ A → Env Γ → Sem A
| _, _, .var x, ρ => lookup x ρ
| _, _, .lam b, ρ => fun a => eval b (.cons a ρ)
| _, _, .app f a, ρ => eval f ρ (eval a ρ)
def GoodEnv : {Γ : List Ty} → Env Γ → Prop
| _, .nil => True
| _, .cons (A := A) a ρ => Good A a ∧ GoodEnv ρ
theorem lookup_good : {Γ : List Ty} → {A : Ty} → (x : Var Γ A) → (ρ : Env Γ) → GoodEnv ρ → Good A (lookup x ρ)
| _, _, .zero, .cons _ _, h => h.1
| _, _, .succ x, .cons _ ρ, h => lookup_good x ρ h.2
theorem eval_good : {Γ : List Ty} → {A : Ty} → (t : Tm Γ A) → (ρ : Env Γ) → GoodEnv ρ → Good A (eval t ρ)
| _, _, .var x, ρ, h => lookup_good x ρ h
| _, _, .lam b, ρ, h => fun a ga => eval_good b (.cons a ρ) ⟨ga, h⟩
| _, _, .app f a, ρ, h => eval_good f ρ h _ (eval_good a ρ h)
def nf {A : Ty} (t : Tm [] A) : Raw := (rr A).2 (eval t .nil) 0
/-- every closed simply typed term normalizes to a β-normal form -/
theorem nf_normal {A : Ty} (t : Tm [] A) : IsNf (nf t) :=
(rr_good A).2 _ (eval_good t .nil trivial) 0
/-- example: (λx.x) (λy.y) at ι→ι normalizes to λ 0 -/
def idI : Tm [] (.arr .base .base) := .lam (.var .zero)
theorem ex_nf : nf (.app (.lam (B := .arr .base .base) (.var .zero)) idI) = .lam (.var 0) := rfl
end NbE
end Found
#print axioms Found.NbE.rr_good
#print axioms Found.NbE.eval_good
#print axioms Found.NbE.nf_normal
#print axioms Found.NbE.ex_nf
lean_all/found/Schanuel.lean
/-
T210 slice L4a. found/Schanuel — the line nominal sets ↔ Schanuel topos.
A nominal set X gives the support functor on finite sets of atoms
(lists S, inclusions): X_S := {x | S supports x}.
* Monotone: S ⊆ T ⇒ X_S ⊆ X_T (functorial on inclusions).
* Covering: X nominal ⟺ every x lies in some X_S (X = colim X_S).
* Equivariance: if S supports x then π[S] supports π·x (action on the
functor along the injection π) — given the action respects composition.
(The sheaf condition for the atomic topology and the converse functor →
nominal set are the next slices.)
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Nominal
namespace Found
namespace Nom
def Sub' (S T : List Nat) : Prop := ∀ a, a ∈ S → a ∈ T
def XS (N : NSet) (S : List Nat) : N.X → Prop := Supports N S
theorem XS_mono (N : NSet) {S T : List Nat} (h : Sub' S T) (x : N.X) : XS N S x → XS N T x :=
fun hs π hT => hs π (fun a m => hT a (h a m))
theorem nominal_iff_cover (N : NSet) : Nominal N ↔ ∀ x, ∃ S, XS N S x := Iff.rfl
/-- composition and inverse of permutations -/
def comp (π σ : Perm) : Perm := ⟨fun a => π.f (σ.f a), fun a => σ.g (π.g a),
fun a => (congrArg π.f (σ.fg (π.g a))).trans (π.fg a),
fun a => (congrArg σ.g (π.gf (σ.f a))).trans (σ.gf a)⟩
def inv (π : Perm) : Perm := ⟨π.g, π.f, π.gf, π.fg⟩
/-- an action respecting composition -/
def ActComp (N : NSet) : Prop := ∀ π σ x, N.act (comp π σ) x = N.act π (N.act σ x)
def image (π : Perm) : List Nat → List Nat
| [] => []
| a :: S => π.f a :: image π S
theorem mem_image (π : Perm) {a : Nat} : (S : List Nat) → a ∈ S → π.f a ∈ image π S
| [], h => nomatch h
| b :: S, h => by
cases h with
| head => exact .head _
| tail _ h' => exact .tail _ (mem_image π S h')
/-- equivariance: π[S] supports π·x when S supports x -/
theorem equivariant (N : NSet) (hc : ActComp N) (π : Perm) (S : List Nat) (x : N.X) (hs : XS N S x) :
XS N (image π S) (N.act π x) := by
intro σ hσ
-- σ fixes π[S], so π⁻¹ σ π fixes S
have hfix : Fixes (comp (inv π) (comp σ π)) S := fun a m => by
show π.g (σ.f (π.f a)) = a
rw [hσ (π.f a) (mem_image π S m)]
exact π.gf a
have h1 : N.act (comp (inv π) (comp σ π)) x = x := hs _ hfix
have h2 : N.act σ (N.act π x) = N.act π (N.act (comp (inv π) (comp σ π)) x) := by
rw [← hc π, ← hc σ π]
exact N.resp _ _ (fun a => by
show σ.f (π.f a) = π.f (π.g (σ.f (π.f a)))
rw [π.fg]) x
rw [h2, h1]
end Nom
end Found
#print axioms Found.Nom.XS_mono
#print axioms Found.Nom.nominal_iff_cover
#print axioms Found.Nom.mem_image
#print axioms Found.Nom.equivariant
lean_all/found/Schanuel2.lean
/-
T210 slice L4b. found/Schanuel2 — the gluing (sheaf) condition of the
atomic topology for the support presheaf S ↦ X_S of a nominal set:
X_S ∩ X_T = X_{S ∩ T}.
Supports are taken in the swapping form (Gabbay–Pitts): S supports x when
every transposition (a b) with a, b ∉ S fixes x; a permutation-support is
a swap-support (perm_to_swap), and swap-supports are closed under
intersection (swap_inter), using the identity (a b) = (a c)(b c)(a c) for a
fresh c.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Schanuel
namespace Found
namespace Nom
/-! ## decidable equality and membership by hand -/
def beq : Nat → Nat → Bool
| 0, 0 => true
| 0, _ + 1 => false
| _ + 1, 0 => false
| a + 1, b + 1 => beq a b
theorem beq_true : (a b : Nat) → beq a b = true → a = b
| 0, 0, _ => rfl
| 0, _ + 1, h => Bool.noConfusion h
| _ + 1, 0, h => Bool.noConfusion h
| a + 1, b + 1, h => congrArg (· + 1) (beq_true a b h)
theorem beq_false : (a b : Nat) → beq a b = false → a ≠ b
| 0, 0, h => Bool.noConfusion h
| 0, _ + 1, _ => fun e => Nat.noConfusion e
| _ + 1, 0, _ => fun e => Nat.noConfusion e
| a + 1, b + 1, h => fun e => beq_false a b h (Nat.succ.inj e)
theorem beq_refl : (a : Nat) → beq a a = true
| 0 => rfl
| a + 1 => beq_refl a
/-- transposition (a b) -/
def swf (a b x : Nat) : Nat :=
match beq x a with
| true => b
| false => match beq x b with
| true => a
| false => x
theorem swf_a (a b : Nat) : swf a b a = b := by
unfold swf
rw [beq_refl]
theorem swf_b (a b : Nat) : swf a b b = a := by
unfold swf
cases h : beq b a with
| true => exact beq_true _ _ h
| false =>
show (match beq b b with | true => a | false => b) = a
rw [beq_refl]
theorem swf_other (a b x : Nat) (ha : x ≠ a) (hb : x ≠ b) : swf a b x = x := by
unfold swf
cases h1 : beq x a with
| true => exact absurd (beq_true _ _ h1) ha
| false =>
cases h2 : beq x b with
| true => exact absurd (beq_true _ _ h2) hb
| false => rfl
theorem swf_invol (a b x : Nat) : swf a b (swf a b x) = x := by
cases h1 : beq x a with
| true => rw [beq_true _ _ h1, swf_a, swf_b]
| false =>
cases h2 : beq x b with
| true => rw [beq_true _ _ h2, swf_b, swf_a]
| false => rw [swf_other a b x (beq_false _ _ h1) (beq_false _ _ h2),
swf_other a b x (beq_false _ _ h1) (beq_false _ _ h2)]
def swap (a b : Nat) : Perm := ⟨swf a b, swf a b, swf_invol a b, swf_invol a b⟩
def SwapSupp (N : NSet) (S : List Nat) (x : N.X) : Prop :=
∀ a b, ¬ a ∈ S → ¬ b ∈ S → N.act (swap a b) x = x
theorem perm_to_swap (N : NSet) (S : List Nat) (x : N.X) (h : Supports N S x) : SwapSupp N S x :=
fun a b ha hb => h _ (fun c m => swf_other a b c (fun e => ha (e ▸ m)) (fun e => hb (e ▸ m)))
def memb (a : Nat) : List Nat → Bool
| [] => false
| b :: L => match beq a b with
| true => true
| false => memb a L
theorem memb_true (a : Nat) : (L : List Nat) → memb a L = true → a ∈ L
| [], h => Bool.noConfusion h
| b :: L, h => by
unfold memb at h
cases e : beq a b with
| true => rw [beq_true _ _ e]; exact .head _
| false => rw [e] at h; exact .tail _ (memb_true a L h)
theorem memb_false (a : Nat) : (L : List Nat) → memb a L = false → ¬ a ∈ L
| [], _ => fun m => nomatch m
| b :: L, h => by
unfold memb at h
cases e : beq a b with
| true => rw [e] at h; exact Bool.noConfusion h
| false =>
rw [e] at h
intro m
cases m with
| head => exact beq_false _ _ e rfl
| tail _ m' => exact memb_false a L h m'
def inter (T : List Nat) : List Nat → List Nat
| [] => []
| a :: S => match memb a T with
| true => a :: inter T S
| false => inter T S
theorem mem_inter (T : List Nat) {a : Nat} (hT : a ∈ T) : (S : List Nat) → a ∈ S → a ∈ inter T S
| [], m => nomatch m
| b :: S, m => by
unfold inter
cases e : memb b T with
| true =>
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (mem_inter T hT S m')
| false =>
cases m with
| head => exact absurd hT (memb_false _ _ e)
| tail _ m' => exact mem_inter T hT S m'
def sumL : List Nat → Nat
| [] => 0
| a :: L => a + sumL L
theorem le_sumL : (L : List Nat) → {a : Nat} → a ∈ L → a ≤ sumL L
| [], _, m => nomatch m
| b :: L, _, m => by
cases m with
| head => exact Nat.le_add_right _ _
| tail _ m' => exact Nat.le_trans (le_sumL L m') (Nat.le_add_left _ _)
theorem fresh_not (L : List Nat) : ¬ (sumL L + 1) ∈ L :=
fun m => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (le_sumL L m))
/-- (a b) = (a c)(b c)(a c) pointwise, for distinct a, b, c -/
theorem three_swaps (a b c : Nat) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) (x : Nat) :
swf a b x = swf a c (swf b c (swf a c x)) := by
cases h1 : beq x a with
| true =>
rw [beq_true _ _ h1, swf_a, swf_a, swf_b, swf_other a c b (fun e => hab e.symm) hbc]
| false =>
cases h2 : beq x b with
| true =>
rw [beq_true _ _ h2, swf_b, swf_other a c b (fun e => hab e.symm) hbc, swf_a, swf_b]
| false =>
cases h3 : beq x c with
| true =>
rw [beq_true _ _ h3, swf_b, swf_other b c a hab hac, swf_a,
swf_other a b c (fun e => hac e.symm) (fun e => hbc e.symm)]
| false =>
have n1 := beq_false _ _ h1
have n2 := beq_false _ _ h2
have n3 := beq_false _ _ h3
rw [swf_other a b x n1 n2, swf_other a c x n1 n3, swf_other b c x n2 n3, swf_other a c x n1 n3]
theorem swap_comm (a b x : Nat) : swf a b x = swf b a x := by
cases h1 : beq x a with
| true => rw [beq_true _ _ h1, swf_a, swf_b]
| false =>
cases h2 : beq x b with
| true => rw [beq_true _ _ h2, swf_b, swf_a]
| false => rw [swf_other a b x (beq_false _ _ h1) (beq_false _ _ h2),
swf_other b a x (beq_false _ _ h2) (beq_false _ _ h1)]
/-- the mixed case: p ∈ S∖T, q ∉ S -/
theorem mixed (N : NSet) (hc : ActComp N) (S T : List Nat) (x : N.X)
(hS : SwapSupp N S x) (hT : SwapSupp N T x) (p q : Nat) (hpS : p ∈ S) (hpT : ¬ p ∈ T) (hqS : ¬ q ∈ S) :
N.act (swap p q) x = x := by
have hpq : p ≠ q := fun e => hqS (e ▸ hpS)
have hcL := fresh_not (p :: q :: (S ++ T))
generalize sumL (p :: q :: (S ++ T)) + 1 = c at hcL
have hpc : p ≠ c := fun e => hcL (e ▸ .head _)
have hqc : q ≠ c := fun e => hcL (e ▸ .tail _ (.head _))
have hcS : ¬ c ∈ S := fun m => hcL (.tail _ (.tail _ (Prp.mem_app_l m)))
have hcT : ¬ c ∈ T := fun m => hcL (.tail _ (.tail _ (Prp.mem_app_r S m)))
have e1 : N.act (swap p q) x = N.act (comp (swap p c) (comp (swap q c) (swap p c))) x :=
N.resp _ _ (fun y => three_swaps p q c hpq hpc hqc y) x
rw [e1, hc, hc, hT p c hpT hcT, hS q c hqS hcS, hT p c hpT hcT]
theorem swap_inter (N : NSet) (hc : ActComp N) (S T : List Nat) (x : N.X)
(hS : SwapSupp N S x) (hT : SwapSupp N T x) : SwapSupp N (inter T S) x := by
intro a b ha hb
cases haS : memb a S with
| false =>
cases hbS : memb b S with
| false => exact hS a b (memb_false _ _ haS) (memb_false _ _ hbS)
| true =>
have hbT : ¬ b ∈ T := fun m => hb (mem_inter T m S (memb_true _ _ hbS))
cases haT : memb a T with
| false => exact hT a b (memb_false _ _ haT) hbT
| true =>
rw [N.resp _ (swap b a) (fun y => swap_comm a b y) x]
exact mixed N hc S T x hS hT b a (memb_true _ _ hbS) hbT (memb_false _ _ haS)
| true =>
have haT : ¬ a ∈ T := fun m => ha (mem_inter T m S (memb_true _ _ haS))
cases hbT : memb b T with
| false => exact hT a b haT (memb_false _ _ hbT)
| true =>
cases hbS : memb b S with
| true => exact absurd (mem_inter T (memb_true _ _ hbT) S (memb_true _ _ hbS)) hb
| false => exact mixed N hc S T x hS hT a b (memb_true _ _ haS) haT (memb_false _ _ hbS)
/-- gluing: X_S ∩ X_T ⊆ X_{S∩T} (and ⊇ by monotonicity) -/
theorem glue_inter (N : NSet) (hc : ActComp N) (S T : List Nat) (x : N.X)
(hS : Supports N S x) (hT : Supports N T x) : SwapSupp N (inter T S) x :=
swap_inter N hc S T x (perm_to_swap N S x hS) (perm_to_swap N T x hT)
theorem inter_sub (T : List Nat) {a : Nat} : (S : List Nat) → a ∈ inter T S → a ∈ S ∧ a ∈ T
| [], m => nomatch m
| b :: S, m => by
unfold inter at m
cases e : memb b T with
| true =>
rw [e] at m
cases m with
| head => exact ⟨.head _, memb_true _ _ e⟩
| tail _ m' => exact (fun h => ⟨.tail _ h.1, h.2⟩) (inter_sub T S m')
| false =>
rw [e] at m
exact (fun h => ⟨.tail _ h.1, h.2⟩) (inter_sub T S m)
/-- monotonicity: a swap-support of x inside S ∩ T is one of S and of T -/
theorem swap_mono (N : NSet) (S T : List Nat) (x : N.X) (h : SwapSupp N (inter T S) x) :
SwapSupp N S x ∧ SwapSupp N T x :=
⟨fun a b ha hb => h a b (fun m => ha (inter_sub T S m).1) (fun m => hb (inter_sub T S m).1),
fun a b ha hb => h a b (fun m => ha (inter_sub T S m).2) (fun m => hb (inter_sub T S m).2)⟩
end Nom
end Found
#print axioms Found.Nom.swf_invol
#print axioms Found.Nom.perm_to_swap
#print axioms Found.Nom.three_swaps
#print axioms Found.Nom.mixed
#print axioms Found.Nom.swap_inter
#print axioms Found.Nom.glue_inter
#print axioms Found.Nom.swap_mono
lean_all/found/Schanuel3.lean
/-
T210 slice L4c. found/Schanuel3 — the converse line, sheaves → nominal
sets: a functor on finite atom sets with extensions along inclusions and
a permutation action that is local (depends only on π restricted to S)
is glued, as a colimit setoid (no quotient), into a nominal set; and for
a nominal set with chosen supports the presheaf S ↦ X_S glues back to the
original set (setoid iso, compatible with the action).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Schanuel
import found.Core
namespace Found
namespace Nom
theorem sub_refl (S : List Nat) : Sub' S S := fun _ m => m
theorem sub_trans {S T U : List Nat} (h1 : Sub' S T) (h2 : Sub' T U) : Sub' S U := fun a m => h2 a (h1 a m)
theorem mem_image_inv (π : Perm) {a : Nat} : (S : List Nat) → a ∈ image π S → ∃ b, b ∈ S ∧ a = π.f b
| [], m => nomatch m
| b :: S, m => by
cases m with
| head => exact ⟨b, .head _, rfl⟩
| tail _ m' => exact match mem_image_inv π S m' with | ⟨c, hc, e⟩ => ⟨c, .tail _ hc, e⟩
theorem image_mono (π : Perm) {S T : List Nat} (h : Sub' S T) : Sub' (image π S) (image π T) := fun _ m =>
match mem_image_inv π S m with
| ⟨b, hb, e⟩ => e ▸ mem_image π T (h b hb)
theorem image_fixed {π : Perm} {S : List Nat} (hf : Fixes π S) : Sub' (image π S) S := fun _ m =>
match mem_image_inv π S m with
| ⟨b, hb, e⟩ => by rw [e, hf b hb]; exact hb
/-- a presheaf on finite atom sets with a local permutation action -/
structure Fam where
F : List Nat → Type
ext : {S T : List Nat} → Sub' S T → F S → F T
ext_id : ∀ {S} (h : Sub' S S) x, ext h x = x
ext_comp : ∀ {S T U} (h1 : Sub' S T) (h2 : Sub' T U) x, ext h2 (ext h1 x) = ext (sub_trans h1 h2) x
act : (π : Perm) → (S : List Nat) → F S → F (image π S)
act_ext : ∀ π {S T} (h : Sub' S T) x, act π T (ext h x) = ext (image_mono π h) (act π S x)
loc : ∀ π S x (hf : Fixes π S), ext (image_fixed hf) (act π S x) = x
/-- gluing: the colimit setoid Σ S, F S -/
def glue (A : Fam) : Setd.{0} where
car := (S : List Nat) × A.F S
eqv p q := ∃ U, ∃ (h1 : Sub' p.1 U) (h2 : Sub' q.1 U), A.ext h1 p.2 = A.ext h2 q.2
refl p := ⟨p.1, sub_refl _, sub_refl _, rfl⟩
symm := fun ⟨U, h1, h2, e⟩ => ⟨U, h2, h1, e.symm⟩
trans := fun {p q r} ⟨U, h1, h2, e⟩ ⟨U', k1, k2, e'⟩ => by
refine ⟨U ++ U', sub_trans h1 (fun a m => Prp.mem_app_l m), sub_trans k2 (fun a m => Prp.mem_app_r U m), ?_⟩
have l1 : Sub' U (U ++ U') := fun a m => Prp.mem_app_l m
have l2 : Sub' U' (U ++ U') := fun a m => Prp.mem_app_r U m
calc A.ext _ p.2 = A.ext l1 (A.ext h1 p.2) := (A.ext_comp h1 l1 p.2).symm
_ = A.ext l1 (A.ext h2 q.2) := by rw [e]
_ = A.ext (sub_trans h2 l1) q.2 := A.ext_comp h2 l1 q.2
_ = A.ext (sub_trans k1 l2) q.2 := rfl
_ = A.ext l2 (A.ext k1 q.2) := (A.ext_comp k1 l2 q.2).symm
_ = A.ext l2 (A.ext k2 r.2) := by rw [e']
_ = A.ext _ r.2 := A.ext_comp k2 l2 r.2
def gact (A : Fam) (π : Perm) (p : (glue A).car) : (glue A).car := ⟨image π p.1, A.act π p.1 p.2⟩
/-- the action respects gluing -/
theorem gact_resp (A : Fam) (π : Perm) {p q : (glue A).car} (h : (glue A).eqv p q) :
(glue A).eqv (gact A π p) (gact A π q) :=
match h with
| ⟨U, h1, h2, e⟩ => ⟨image π U, image_mono π h1, image_mono π h2, by
show A.ext _ (A.act π p.1 p.2) = A.ext _ (A.act π q.1 q.2)
rw [← A.act_ext π h1, ← A.act_ext π h2, e]⟩
/-- every glued element is supported by its stage: the colimit is nominal -/
theorem glue_nominal (A : Fam) (p : (glue A).car) (π : Perm) (hf : Fixes π p.1) :
(glue A).eqv (gact A π p) p :=
⟨p.1, image_fixed hf, sub_refl _, by
show A.ext _ (A.act π p.1 p.2) = A.ext _ p.2
rw [A.loc π p.1 p.2 hf, A.ext_id]⟩
/-! ## round trip: nominal set → presheaf S ↦ X_S → glue ≅ the set -/
theorem subtype_eq {α : Type} {P : α → Prop} {a b : {x : α // P x}} (h : a.val = b.val) : a = b := by
cases a with
| mk v hv => cases b with
| mk w hw =>
cases h
rfl
def ofNSet (N : NSet) (hc : ActComp N) : Fam where
F S := {x : N.X // XS N S x}
ext h x := ⟨x.val, XS_mono N h x.val x.property⟩
ext_id _ _ := rfl
ext_comp _ _ _ := rfl
act π S x := ⟨N.act π x.val, equivariant N hc π S x.val x.property⟩
act_ext := fun _ {_ _} _ _ => rfl
loc π _ x hf := subtype_eq (x.property π hf)
def discS (X : Type) : Setd.{0} := ⟨X, Eq, fun _ => rfl, fun h => h.symm, fun h k => h.trans k⟩
/-- the round trip: with chosen supports, gluing X_S gives back X (as setoids),
and the identification commutes with the action -/
theorem roundtrip (N : NSet) (hc : ActComp N) (supp : ∀ x : N.X, {S : List Nat // XS N S x}) :
Core.Iso' (glue (ofNSet N hc)) (discS N.X) ∧
∀ π (p : (glue (ofNSet N hc)).car), (gact (ofNSet N hc) π p).2.val = N.act π p.2.val :=
⟨⟨⟨fun p => p.2.val, fun {p q} h => match h with
| ⟨_, _, _, e⟩ => congrArg Subtype.val e⟩,
⟨fun x => ⟨(supp x).val, ⟨x, (supp x).property⟩⟩, fun {x y} e => by cases e; exact (glue _).refl _⟩,
fun p => ⟨(supp p.2.val).val ++ p.1, fun _ m => Prp.mem_app_l m, fun _ m => Prp.mem_app_r _ m,
subtype_eq rfl⟩,
fun _ => rfl⟩,
fun _ _ => rfl⟩
end Nom
end Found
#print axioms Found.Nom.glue
#print axioms Found.Nom.gact_resp
#print axioms Found.Nom.glue_nominal
#print axioms Found.Nom.roundtrip
lean_all/found/Schanuel4.lean
/-
T210 slice L4d. found/Schanuel4 — the other round trip, sheaves →
nominal sets → sheaves: for a presheaf with local action (found/Schanuel3)
satisfying the atomic sheaf condition
* mono: the extension maps F S → F T are injective;
* descent: an element of F T whose glued class is fixed by every
permutation fixing S ⊆ T comes from F S;
the value F S is isomorphic (as setoids, compatibly with the action) to
the elements of the glued nominal set supported by S. The presheaves
S ↦ X_S of nominal sets satisfy both conditions, so the two round trips
close the line nominal sets = Schanuel topos.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Schanuel3
namespace Found
namespace Nom
/-- the atomic sheaf condition (descent given as data) -/
structure Sheaf (A : Fam) where
mono : ∀ {S T} (h : Sub' S T) (x y : A.F S), A.ext h x = A.ext h y → x = y
desc : ∀ {S T} (_ : Sub' S T) (z : A.F T),
(∀ π, Fixes π S → (glue A).eqv (gact A π ⟨T, z⟩) ⟨T, z⟩) → {x : A.F S // (glue A).eqv ⟨S, x⟩ ⟨T, z⟩}
/-- glued elements supported by S -/
def SuppG (A : Fam) (S : List Nat) (p : (glue A).car) : Prop :=
∀ π, Fixes π S → (glue A).eqv (gact A π p) p
def suppSet (A : Fam) (S : List Nat) : Setd.{0} where
car := {p : (glue A).car // SuppG A S p}
eqv p q := (glue A).eqv p.val q.val
refl p := (glue A).refl p.val
symm h := (glue A).symm h
trans h k := (glue A).trans h k
def discF (A : Fam) (S : List Nat) : Setd.{0} := ⟨A.F S, Eq, fun _ => rfl, fun h => h.symm, fun h k => h.trans k⟩
theorem stage_supp (A : Fam) (S : List Nat) (x : A.F S) : SuppG A S ⟨S, x⟩ := fun π hf => glue_nominal A ⟨S, x⟩ π hf
/-- injectivity of F S → glue, from mono -/
theorem glue_inj (A : Fam) (hs : Sheaf A) (S : List Nat) (x y : A.F S) (h : (glue A).eqv ⟨S, x⟩ ⟨S, y⟩) : x = y :=
match h with
| ⟨_, h1, _, e⟩ => hs.mono h1 x y e
/-- an element supported by S, moved to the stage S ++ T, is still supported by S -/
theorem supp_move (A : Fam) (S : List Nat) (p : (glue A).car) (hp : SuppG A S p) :
let h : Sub' p.1 (S ++ p.1) := fun _ m => Prp.mem_app_r S m
SuppG A S ⟨S ++ p.1, A.ext h p.2⟩ ∧ (glue A).eqv ⟨S ++ p.1, A.ext h p.2⟩ p := by
intro h
have e : (glue A).eqv ⟨S ++ p.1, A.ext h p.2⟩ p :=
⟨S ++ p.1, sub_refl _, h, by rw [A.ext_id]⟩
exact ⟨fun π hf => (glue A).trans (gact_resp A π e) ((glue A).trans (hp π hf) ((glue A).symm e)), e⟩
/-- descent of a supported glued element to the stage S -/
def descend (A : Fam) (hs : Sheaf A) (S : List Nat) (p : (suppSet A S).car) : A.F S :=
(hs.desc (fun _ m => Prp.mem_app_l m) _ (supp_move A S p.val p.property).1).val
theorem descend_spec (A : Fam) (hs : Sheaf A) (S : List Nat) (p : (suppSet A S).car) :
(glue A).eqv ⟨S, descend A hs S p⟩ p.val :=
(glue A).trans (hs.desc (fun _ m => Prp.mem_app_l m) _ (supp_move A S p.val p.property).1).property
(supp_move A S p.val p.property).2
/-- the round trip sheaf → nominal set → sheaf: F S ≅ (elements of the glue supported by S),
compatibly with the action -/
theorem roundtrip2 (A : Fam) (hs : Sheaf A) (S : List Nat) :
Core.Iso' (discF A S) (suppSet A S) ∧
∀ π (x : A.F S), (gact A π ⟨S, x⟩) = ⟨image π S, A.act π S x⟩ :=
⟨⟨⟨fun x => ⟨⟨S, x⟩, stage_supp A S x⟩, fun {x y} e => by cases e; exact (glue A).refl _⟩,
⟨descend A hs S, fun {p q} e => glue_inj A hs S _ _
((glue A).trans (descend_spec A hs S p) ((glue A).trans e ((glue A).symm (descend_spec A hs S q))))⟩,
fun x => glue_inj A hs S _ _ (descend_spec A hs S ⟨⟨S, x⟩, stage_supp A S x⟩),
fun p => descend_spec A hs S p⟩,
fun _ _ => rfl⟩
/-- the presheaves S ↦ X_S of nominal sets are sheaves -/
def ofNSet_sheaf (N : NSet) (hc : ActComp N) : Sheaf (ofNSet N hc) where
mono _ x y e := subtype_eq (by have e' := congrArg Subtype.val e; exact e')
desc {S T} _ z hz := ⟨⟨z.val, fun π hf => match hz π hf with
| ⟨_, _, _, e⟩ => congrArg Subtype.val e⟩, ⟨S ++ T, fun _ m => Prp.mem_app_l m, fun _ m => Prp.mem_app_r S m, subtype_eq rfl⟩⟩
end Nom
end Found
#print axioms Found.Nom.stage_supp
#print axioms Found.Nom.glue_inj
#print axioms Found.Nom.supp_move
#print axioms Found.Nom.descend_spec
#print axioms Found.Nom.roundtrip2
#print axioms Found.Nom.ofNSet_sheaf
lean_all/found/SecondOrder.lean
/-
T84. found/SecondOrder — second-order arithmetic and reverse mathematics
as points: ω-models (ℕ, D) with D ⊆ P(ℕ) (the power operation of the core
restricted by a parameter), comprehension for a class of predicates.
* Classes: decidable (Δ⁰₀/recursive, RCA₀'s base), Σ⁰₁ (∃ over decidable,
the ACA₀ direction), all predicates (Z₂).
* Comprehension is monotone in the class: Z₂ ⇒ Σ⁰₁ ⇒ decidable — the
inclusion chain RCA₀ ⊆ ACA₀ ⊆ … ⊆ Z₂ as conditions on D.
* The full ω-model D = P(ℕ) satisfies all; the empty D fails even
decidable comprehension. WKL₀, ATR₀, Π¹₁-CA₀ are further class values
(cited).
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: D ⊆ (ℕ → Prop) (Prop-valued predicates).
-/
namespace Found
namespace RM
def DecP (P : Nat → Prop) : Prop := ∀ n, P n ∨ ¬ P n
def Sigma1 (P : Nat → Prop) : Prop := ∃ Q : Nat → Nat → Prop, (∀ n m, Q n m ∨ ¬ Q n m) ∧ ∀ n, P n ↔ ∃ m, Q n m
def Comp (C : (Nat → Prop) → Prop) (D : (Nat → Prop) → Prop) : Prop :=
∀ P, C P → ∃ X, D X ∧ ∀ n, X n ↔ P n
theorem comp_mono {C C' : (Nat → Prop) → Prop} (h : ∀ P, C P → C' P) (D : (Nat → Prop) → Prop) :
Comp C' D → Comp C D := fun k P hP => k P (h P hP)
theorem dec_sigma1 (P : Nat → Prop) (h : DecP P) : Sigma1 P :=
⟨fun n _ => P n, fun n _ => h n, fun _ => ⟨fun p => ⟨0, p⟩, fun ⟨_, p⟩ => p⟩⟩
/-- the chain: Z₂-comprehension ⇒ Σ⁰₁ ⇒ decidable -/
theorem chain (D : (Nat → Prop) → Prop) (h : Comp (fun _ => True) D) :
Comp Sigma1 D ∧ Comp DecP D :=
⟨comp_mono (fun _ _ => trivial) D h, comp_mono (fun _ _ => trivial) D h⟩
theorem full_model : Comp (fun _ => True) (fun _ => True) := fun P _ => ⟨P, trivial, fun _ => Iff.rfl⟩
theorem empty_fails : ¬ Comp DecP (fun _ => False) :=
fun h => match h (fun _ => True) (fun _ => Or.inl trivial) with
| ⟨_, f, _⟩ => f
end RM
end Found
#print axioms Found.RM.comp_mono
#print axioms Found.RM.dec_sigma1
#print axioms Found.RM.chain
#print axioms Found.RM.full_model
#print axioms Found.RM.empty_fails
lean_all/found/SecondOrder2.lean
/-
T142. found/SecondOrder2 — second-order logic as a point: the second-order
quantifier ranges over a parameter D₂ ⊆ (A → Prop) (power operation of
the core, or a sub-family of it).
* Standard semantics: D₂ = all predicates; Henkin semantics: any D₂.
* Henkin-valid ⇒ standard-valid (the standard model is one Henkin model).
* Comprehension holds in the standard semantics and can fail in a Henkin
model (D₂ = {∅}) — the line second-order (standard) ↔ many-sorted
first-order (Henkin), cited for completeness.
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: the ∀ P : A → Prop of standard semantics (impredicative Prop).
-/
namespace Found
namespace SO
universe u
inductive Fm where
| app : Nat → Nat → Fm -- P_i(x_j)
| eq : Nat → Nat → Fm
| neg : Fm → Fm
| and : Fm → Fm → Fm
| all1 : Fm → Fm -- ∀x (de Bruijn on individual variables)
| all2 : Fm → Fm -- ∀P (de Bruijn on predicate variables)
variable {A : Type u}
def cons {α : Sort _} (x : α) (ρ : Nat → α) : Nat → α
| 0 => x
| n + 1 => ρ n
def sat (D2 : (A → Prop) → Prop) : (Nat → A) → (Nat → A → Prop) → Fm → Prop
| ρ, σ, .app i j => σ i (ρ j)
| ρ, _, .eq i j => ρ i = ρ j
| ρ, σ, .neg φ => ¬ sat D2 ρ σ φ
| ρ, σ, .and φ ψ => sat D2 ρ σ φ ∧ sat D2 ρ σ ψ
| ρ, σ, .all1 φ => ∀ x, sat D2 (cons x ρ) σ φ
| ρ, σ, .all2 φ => ∀ P, D2 P → sat D2 ρ (cons P σ) φ
def full : (A → Prop) → Prop := fun _ => True
/-- Henkin-valid ⇒ standard-valid -/
theorem henkin_to_standard (φ : Fm) (h : ∀ D2 : (A → Prop) → Prop, ∀ ρ σ, sat D2 ρ σ φ) (ρ : Nat → A)
(σ : Nat → A → Prop) : sat full ρ σ φ := h full ρ σ
/-- comprehension instance ∃P ∀x (P x ↔ x = x), written ¬∀P ¬∀x (P x ↔ x = x) with ↔ as two ∧'d ¬(·∧¬·) -/
def compr : Fm :=
.neg (.all2 (.neg (.all1 (.and (.neg (.and (.app 0 0) (.neg (.eq 0 0))))
(.neg (.and (.eq 0 0) (.neg (.app 0 0))))))))
theorem compr_standard (ρ : Nat → A) (σ : Nat → A → Prop) : sat full ρ σ compr :=
fun h => h (fun _ => True) trivial (fun _ => ⟨fun k => k.2 rfl, fun k => k.2 trivial⟩)
/-- in the Henkin model D₂ = {∅} on an inhabited domain, comprehension fails -/
theorem compr_henkin_fails (a : A) (ρ : Nat → A) (σ : Nat → A → Prop) :
¬ sat (fun P => ∀ x, ¬ P x) ρ σ compr :=
fun h => h (fun _ hP hall => (hall a).2 ⟨rfl, fun p => hP a p⟩)
end SO
end Found
#print axioms Found.SO.henkin_to_standard
#print axioms Found.SO.compr_standard
#print axioms Found.SO.compr_henkin_fails
lean_all/found/Seq1.lean
/-
T179, sequentialization, part 1. found/Seq1 — MLL proof structures as
numbered graphs and their switchings:
* a net: vertices 0 … n−1, each an atom, a ⊗ or a ⅋ with two children,
atoms paired by axiom links, every vertex labelled by its formula;
* a switching chooses one premise of each ⅋; the switching graph has the
axiom edges, both ⊗ edges and the chosen ⅋ edge;
* correctness (Danos–Regnier, as in found/DRSound): every switching graph
is connected and has n − 1 edges (the weight w counts the edges below
each vertex, an axiom edge at its smaller end);
* sums over 0 … n−1 with indicator functions of finite lists, and the exit
lemma: a path from inside a set to outside crosses an edge leaving it.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.ProofNets
namespace Found
namespace SQ
open PN
inductive Kd where
| atm : Kd
| ten : Kd
| par : Kd
structure Net where
n : Nat
kd : Nat → Kd
lc : Nat → Nat
rc : Nat → Nat
ax : Nat → Nat
lab : Nat → F
variable (N : Net)
/-- c is a premise of the link with conclusion u -/
def Child (c u : Nat) : Prop := u < N.n ∧ (N.kd u = .ten ∨ N.kd u = .par) ∧ (c = N.lc u ∨ c = N.rc u)
structure WF : Prop where
ch : ∀ v, v < N.n → (N.kd v = .ten ∨ N.kd v = .par) →
N.lc v < N.n ∧ N.rc v < N.n ∧ N.lc v ≠ N.rc v
labT : ∀ v, v < N.n → N.kd v = .ten → N.lab v = .tensor (N.lab (N.lc v)) (N.lab (N.rc v))
labP : ∀ v, v < N.n → N.kd v = .par → N.lab v = .par (N.lab (N.lc v)) (N.lab (N.rc v))
axw : ∀ v, v < N.n → N.kd v = .atm →
N.ax v < N.n ∧ N.ax v ≠ v ∧ N.ax (N.ax v) = v ∧ N.kd (N.ax v) = .atm ∧ N.lab (N.ax v) = dual (N.lab v)
atl : ∀ v, v < N.n → N.kd v = .atm → ∃ k, N.lab v = .pos k ∨ N.lab v = .neg k
par1 : ∀ c u u', Child N c u → Child N c u' → u = u'
/-! ## switching graphs -/
def sel (s : Nat → Bool) (y : Nat) : Nat := cond (s y) (N.lc y) (N.rc y)
def Edge (s : Nat → Bool) (x y : Nat) : Prop :=
(Child N x y ∧ (N.kd y = .ten ∨ (N.kd y = .par ∧ x = sel N s y))) ∨ (x < N.n ∧ N.kd x = .atm ∧ y = N.ax x)
inductive Conn (s : Nat → Bool) : Nat → Nat → Prop where
| refl (x : Nat) : Conn s x x
| step {x y z : Nat} : (Edge N s x y ∨ Edge N s y x) → Conn s y z → Conn s x z
theorem conn_trans {s : Nat → Bool} {x y z : Nat} (h1 : Conn N s x y) (h2 : Conn N s y z) : Conn N s x z := by
induction h1 with
| refl => exact h2
| step e _ ih => exact .step e (ih h2)
theorem conn_symm {s : Nat → Bool} {x y : Nat} (h : Conn N s x y) : Conn N s y x := by
induction h with
| refl => exact .refl _
| step e _ ih => exact conn_trans N ih (.step (e.elim Or.inr Or.inl) (.refl _))
/-- a path from p to ¬p crosses an edge -/
theorem exit (s : Nat → Bool) (p : Nat → Bool) {x y : Nat} (h : Conn N s x y) (hx : p x = true) (hy : p y = false) :
∃ a b, p a = true ∧ p b = false ∧ (Edge N s a b ∨ Edge N s b a) := by
induction h with
| refl => exact absurd (hx.symm.trans hy) (fun e => Bool.noConfusion e)
| @step x' y' _ e _ ih =>
match hp : p y' with
| true => exact ih hp hy
| false => exact ⟨x', y', hx, hp, e⟩
/-! ## weights and correctness -/
def w (v : Nat) : Nat :=
match N.kd v with
| .atm => match Nat.decLt v (N.ax v) with
| isTrue _ => 1
| isFalse _ => 0
| .ten => 2
| .par => 1
def sumR (f : Nat → Nat) : Nat → Nat
| 0 => 0
| k + 1 => sumR f k + f k
structure Correct : Prop where
conn : ∀ s x y, x < N.n → y < N.n → Conn N s x y
count : sumR (w N) N.n + 1 = N.n
/-! ## sums -/
theorem sumR_congr {f g : Nat → Nat} : (n : Nat) → (∀ v, v < n → f v = g v) → sumR f n = sumR g n
| 0, _ => rfl
| k + 1, h => by
show sumR f k + f k = sumR g k + g k
rw [sumR_congr k (fun v hv => h v (Nat.lt_succ_of_lt hv)), h k (Nat.lt_succ_self k)]
theorem sumR_add (f g : Nat → Nat) : (n : Nat) → sumR (fun v => f v + g v) n = sumR f n + sumR g n
| 0 => rfl
| k + 1 => by
show sumR (fun v => f v + g v) k + (f k + g k) = sumR f k + f k + (sumR g k + g k)
rw [sumR_add f g k, Nat.add_add_add_comm]
theorem sumR_zero : (n : Nat) → sumR (fun _ => 0) n = 0
| 0 => rfl
| k + 1 => by show sumR (fun _ => 0) k + 0 = 0; rw [sumR_zero k]
def eqB (v x : Nat) : Bool :=
match Nat.decEq v x with
| isTrue _ => true
| isFalse _ => false
theorem eqB_self (x : Nat) : eqB x x = true := by
unfold eqB
match Nat.decEq x x with
| isTrue _ => rfl
| isFalse h => exact absurd rfl h
theorem eqB_ne {v x : Nat} (h : v ≠ x) : eqB v x = false := by
unfold eqB
match Nat.decEq v x with
| isTrue e => exact absurd e h
| isFalse _ => rfl
theorem eqB_eq {v x : Nat} (h : eqB v x = true) : v = x := by
unfold eqB at h
match Nat.decEq v x, h with
| isTrue e, _ => exact e
theorem sumR_single (f : Nat → Nat) (x : Nat) : (n : Nat) → x < n → sumR (fun v => cond (eqB v x) (f v) 0) n = f x
| 0, h => absurd h (Nat.not_lt_zero x)
| k + 1, h => by
show sumR (fun v => cond (eqB v x) (f v) 0) k + cond (eqB k x) (f k) 0 = f x
cases Nat.lt_or_ge x k with
| inl hl =>
rw [sumR_single f x k hl, eqB_ne (Nat.ne_of_gt hl)]
rfl
| inr hg =>
have e : x = k := Nat.le_antisymm (Nat.le_of_lt_succ h) hg
have hz : ∀ v, v < k → cond (eqB v x) (f v) 0 = 0 := fun v hv => by
have hne : v ≠ x := fun e' => Nat.lt_irrefl k (by rw [e', e] at hv; exact hv)
rw [eqB_ne hne]; rfl
rw [sumR_congr k hz, sumR_zero, e, eqB_self]
exact Nat.zero_add _
/-! ## lists of vertices -/
def inl (x : Nat) : List Nat → Bool
| [] => false
| a :: l => cond (eqB x a) true (inl x l)
theorem inl_of_mem {x : Nat} : {l : List Nat} → x ∈ l → inl x l = true
| _ :: _, .head _ => by show cond (eqB x x) true _ = true; rw [eqB_self]; rfl
| a :: _, .tail _ m => by
show cond (eqB x a) true _ = true
cases eqB x a with
| true => rfl
| false => exact inl_of_mem m
theorem mem_of_inl {x : Nat} : {l : List Nat} → inl x l = true → x ∈ l
| [], h => Bool.noConfusion h
| a :: l, h => by
match he : eqB x a with
| true => rw [eqB_eq he]; exact .head _
| false =>
have h' : inl x l = true := by
have : cond (eqB x a) true (inl x l) = true := h
rw [he] at this; exact this
exact .tail _ (mem_of_inl h')
theorem inl_false {x : Nat} {l : List Nat} (h : ¬ x ∈ l) : inl x l = false := by
match he : inl x l with
| true => exact absurd (mem_of_inl he) h
| false => rfl
def Nd : List Nat → Prop
| [] => True
| a :: l => ¬ a ∈ l ∧ Nd l
def sumL (f : Nat → Nat) : List Nat → Nat
| [] => 0
| a :: l => f a + sumL f l
def AllLt (n : Nat) (l : List Nat) : Prop := ∀ x, x ∈ l → x < n
theorem sumR_mem (f : Nat → Nat) (n : Nat) : (B : List Nat) → Nd B → AllLt n B →
sumR (fun v => cond (inl v B) (f v) 0) n = sumL f B
| [], _, _ => sumR_zero n
| x :: B, hd, hl => by
have e : ∀ v, v < n → cond (inl v (x :: B)) (f v) 0 = cond (eqB v x) (f v) 0 + cond (inl v B) (f v) 0 :=
fun v _ => by
show cond (cond (eqB v x) true (inl v B)) (f v) 0 = _
match hv : eqB v x with
| true =>
rw [eqB_eq hv, inl_false hd.1]
rfl
| false => show cond (inl v B) (f v) 0 = 0 + cond (inl v B) (f v) 0; rw [Nat.zero_add]
rw [sumR_congr n e, sumR_add, sumR_single f x n (hl x (.head _)),
sumR_mem f n B hd.2 (fun y m => hl y (.tail _ m))]
rfl
end SQ
end Found
#print axioms Found.SQ.conn_symm
#print axioms Found.SQ.exit
#print axioms Found.SQ.sumR_add
#print axioms Found.SQ.sumR_single
#print axioms Found.SQ.sumR_mem
lean_all/found/Seq2.lean
/-
T179, sequentialization, part 2. found/Seq2 — realizations: derivations
built from the links of a net N. Rz B Γ is a derivation whose vertices
are the list B and whose conclusions are the vertices Γ (in this order);
its rules use N's own axiom, ⊗ and ⅋ links, and exchange. Every
realization gives an MLL derivation of the labels (toD), and a
conclusion can be moved to the end by exchanges.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Seq1
namespace Found
namespace SQ
open PN
variable (N : Net)
inductive Rz : List Nat → List Nat → Type where
| ax (u v k : Nat) (hu : N.kd u = .atm) (huv : N.ax u = v) (lu : N.lab u = .pos k) (lv : N.lab v = .neg k) :
Rz [u, v] [u, v]
| ten (T : Nat) {B1 B2 Γ Δ : List Nat} (hT : N.kd T = .ten)
(hl : N.lab T = .tensor (N.lab (N.lc T)) (N.lab (N.rc T)))
(r1 : Rz B1 (Γ ++ [N.lc T])) (r2 : Rz B2 (Δ ++ [N.rc T])) : Rz (T :: (B1 ++ B2)) (Γ ++ Δ ++ [T])
| par (P : Nat) {B Γ : List Nat} (hP : N.kd P = .par)
(hl : N.lab P = .par (N.lab (N.lc P)) (N.lab (N.rc P)))
(r : Rz B (Γ ++ [N.lc P, N.rc P])) : Rz (P :: B) (Γ ++ [P])
| exch {B : List Nat} (Γ Δ : List Nat) (a b : Nat) (r : Rz B (Γ ++ [a, b] ++ Δ)) : Rz B (Γ ++ [b, a] ++ Δ)
/-! ## list lemmas -/
theorem app_assocN {α : Type} : (a b c : List α) → (a ++ b) ++ c = a ++ (b ++ c)
| [], _, _ => rfl
| x :: a, b, c => congrArg (List.cons x) (app_assocN a b c)
theorem app_nilN {α : Type} : (a : List α) → a ++ [] = a
| [] => rfl
| x :: a => congrArg (List.cons x) (app_nilN a)
def mapF (f : Nat → F) : List Nat → List F
| [] => []
| a :: l => f a :: mapF f l
theorem mapF_app (f : Nat → F) : (a b : List Nat) → mapF f (a ++ b) = mapF f a ++ mapF f b
| [], _ => rfl
| x :: a, b => congrArg (List.cons (f x)) (mapF_app f a b)
def castD {Γ Γ' : List F} (e : Γ = Γ') (d : D Γ) : D Γ' := e ▸ d
/-- every realization is an MLL derivation of the labels -/
def toD : {B Γ : List Nat} → Rz N B Γ → D (mapF N.lab Γ)
| _, _, .ax u v k _ _ lu lv => castD (by show [F.pos k, F.neg k] = [N.lab u, N.lab v]; rw [lu, lv]) (D.ax k)
| _, _, @Rz.ten _ T _ _ Γ Δ _ hl r1 r2 =>
castD (by rw [mapF_app, mapF_app]; show _ = _ ++ [N.lab T]; rw [hl])
(D.tensor (castD (mapF_app N.lab Γ [N.lc T]) (toD r1)) (castD (mapF_app N.lab Δ [N.rc T]) (toD r2)))
| _, _, @Rz.par _ P _ Γ _ hl r =>
castD (by rw [mapF_app]; show _ = _ ++ [N.lab P]; rw [hl]) (D.par (castD (mapF_app N.lab Γ [N.lc P, N.rc P]) (toD r)))
| _, _, .exch Γ Δ a b r =>
castD (by rw [mapF_app, mapF_app]; rfl)
(D.exch (castD (by rw [mapF_app, mapF_app]; rfl : mapF N.lab (Γ ++ [a, b] ++ Δ) = mapF N.lab Γ ++ [N.lab a, N.lab b] ++ mapF N.lab Δ) (toD r)))
/-! ## moving a conclusion to the end -/
def castR {B Γ Γ' : List Nat} (e : Γ = Γ') (r : Rz N B Γ) : Rz N B Γ' := e ▸ r
def toEnd {B : List Nat} (Γ : List Nat) (x : Nat) : (Δ : List Nat) → Rz N B (Γ ++ [x] ++ Δ) → Rz N B (Γ ++ Δ ++ [x])
| [], r => castR N (by rw [app_nilN, app_nilN]) r
| y :: Δ, r =>
castR N (by rw [app_assocN Γ [y] Δ]; rfl)
(toEnd (Γ ++ [y]) x Δ (castR N (by rw [app_assocN Γ [y] [x]]; rfl)
(Rz.exch Γ Δ x y (castR N (by rw [app_assocN Γ [x] (y :: Δ), app_assocN Γ [x, y] Δ]; rfl) r))))
theorem split_mem {x : Nat} : {l : List Nat} → x ∈ l → ∃ a b, l = a ++ [x] ++ b
| _ :: l, .head _ => ⟨[], l, rfl⟩
| y :: _, .tail _ m => match split_mem m with
| ⟨a, b, e⟩ => ⟨y :: a, b, by rw [e]; rfl⟩
theorem mem_app_iff {x : Nat} : (a b : List Nat) → (x ∈ a ++ b ↔ x ∈ a ∨ x ∈ b)
| [], _ => ⟨fun m => .inr m, fun h => h.elim (fun m => nomatch m) id⟩
| y :: a, b => ⟨fun m => match m with
| .head _ => .inl (.head _)
| .tail _ m' => ((mem_app_iff a b).1 m').elim (fun h => .inl (.tail _ h)) .inr,
fun h => h.elim (fun m => match m with
| .head _ => .head _
| .tail _ m' => .tail _ ((mem_app_iff a b).2 (.inl m')))
(fun m => .tail _ ((mem_app_iff a b).2 (.inr m)))⟩
/-- a conclusion can be moved to the end -/
theorem move_end {B Γ : List Nat} (r : Rz N B Γ) {x : Nat} (hx : x ∈ Γ) :
∃ Γ', (∀ y, y ∈ Γ' ++ [x] ↔ y ∈ Γ) ∧ Nonempty (Rz N B (Γ' ++ [x])) :=
match split_mem hx with
| ⟨a, b, e⟩ => ⟨a ++ b,
fun y =>
have L : y ∈ (a ++ b) ++ [x] ↔ (y ∈ a ∨ y ∈ b) ∨ y ∈ [x] :=
(mem_app_iff _ _).trans ⟨fun h => h.elim (fun m => .inl ((mem_app_iff a b).1 m)) .inr,
fun h => h.elim (fun m => .inl ((mem_app_iff a b).2 m)) .inr⟩
have R : y ∈ Γ ↔ (y ∈ a ∨ y ∈ [x]) ∨ y ∈ b := by
rw [e]
exact (mem_app_iff _ _).trans ⟨fun h => h.elim (fun m => .inl ((mem_app_iff a [x]).1 m)) .inr,
fun h => h.elim (fun m => .inl ((mem_app_iff a [x]).2 m)) .inr⟩
L.trans (Iff.trans ⟨fun h => h.elim (fun h' => h'.elim (fun m => .inl (.inl m)) (fun m => .inr m)) (fun m => .inl (.inr m)),
fun h => h.elim (fun h' => h'.elim (fun m => .inl (.inl m)) (fun m => .inr m)) (fun m => .inl (.inr m))⟩ R.symm),
⟨toEnd N a x b (castR N e r)⟩⟩
end SQ
end Found
#print axioms Found.SQ.toD
#print axioms Found.SQ.toEnd
#print axioms Found.SQ.move_end
lean_all/found/Seq3.lean
/-
T179, sequentialization, part 3. found/Seq3 — the parsing state: a list
of blocks, each realized by a derivation from N's links (vertex list,
door list), pairwise disjoint, closed under premises and axiom links,
doors = vertices whose link below is outside, each block with one edge
fewer than vertices (weights). Unprocessed vertices are the compound
vertices outside all blocks. Counting: for a correct net,
#(unprocessed ⊗) + 1 = #blocks.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Seq2
namespace Found
namespace SQ
open PN
variable (N : Net)
structure Blk (N : Net) where
vs : List Nat
ds : List Nat
def inAny (v : Nat) : List (Blk N) → Bool
| [] => false
| B :: Bs => inl v B.vs || inAny v Bs
def Disj : List (Blk N) → Prop
| [] => True
| B :: Bs => (∀ x, x ∈ B.vs → inAny N x Bs = false) ∧ Disj Bs
def Door (B : List Nat) (x : Nat) : Prop := x ∈ B ∧ ∀ u, Child N x u → ¬ u ∈ B
structure BInv (B : Blk N) : Prop where
rz : Nonempty (Rz N B.vs B.ds)
nd : Nd B.vs
dnd : Nd B.ds
lt : AllLt N.n B.vs
clc : ∀ v, v ∈ B.vs → (N.kd v = .ten ∨ N.kd v = .par) → N.lc v ∈ B.vs ∧ N.rc v ∈ B.vs
cax : ∀ v, v ∈ B.vs → N.kd v = .atm → N.ax v ∈ B.vs
door : ∀ x, x ∈ B.ds ↔ Door N B.vs x
cnt : sumL (w N) B.vs + 1 = sumL (fun _ => 1) B.vs
structure Inv (Bs : List (Blk N)) : Prop where
blk : ∀ B, B ∈ Bs → BInv N B
disj : Disj N Bs
atoms : ∀ v, v < N.n → N.kd v = .atm → inAny N v Bs = true
def isTen (v : Nat) : Bool :=
match N.kd v with
| .ten => true
| .atm => false
| .par => false
def sumB (f : Blk N → Nat) : List (Blk N) → Nat
| [] => 0
| B :: Bs => f B + sumB f Bs
/-! ## the counting identity -/
theorem cond_or (a b : Bool) (k : Nat) (h : a = true → b = false) : cond (a || b) k 0 = cond a k 0 + cond b k 0 := by
match a, b with
| true, true => exact absurd (h rfl) (fun e => Bool.noConfusion e)
| true, false => rfl
| false, true => exact (Nat.zero_add k).symm
| false, false => rfl
theorem sum_blocks (f : Nat → Nat) : (Bs : List (Blk N)) → (∀ B, B ∈ Bs → Nd B.vs ∧ AllLt N.n B.vs) → Disj N Bs →
sumR (fun v => cond (inAny N v Bs) (f v) 0) N.n = sumB N (fun B => sumL f B.vs) Bs
| [], _, _ => sumR_zero N.n
| B :: Bs, h, hd => by
have e : ∀ v, v < N.n → cond (inAny N v (B :: Bs)) (f v) 0 = cond (inl v B.vs) (f v) 0 + cond (inAny N v Bs) (f v) 0 :=
fun v _ => cond_or _ _ _ (fun hv => hd.1 v (mem_of_inl hv))
rw [sumR_congr N.n e, sumR_add, sumR_mem f N.n B.vs (h B (.head _)).1 (h B (.head _)).2,
sum_blocks f Bs (fun C m => h C (.tail _ m)) hd.2]
rfl
theorem sumR_split (p : Nat → Bool) (f : Nat → Nat) (n : Nat) :
sumR f n = sumR (fun v => cond (p v) (f v) 0) n + sumR (fun v => cond (!p v) (f v) 0) n := by
rw [← sumR_add]
exact sumR_congr n (fun v _ => by
match p v with
| true => exact (Nat.add_zero _).symm
| false => exact (Nat.zero_add _).symm)
theorem ar1 (a b c : Nat) : a + b + (c + 1) = a + 1 + (b + c) := by
rw [Nat.add_assoc a 1 (b + c), Nat.add_comm 1 (b + c), Nat.add_assoc a b (c + 1), ← Nat.add_assoc b c 1]
theorem addLC : (a : Nat) → {b c : Nat} → a + b = a + c → b = c
| 0, _, _, h => by rw [Nat.zero_add, Nat.zero_add] at h; exact h
| a + 1, _, _, h => addLC a (Nat.succ.inj (by rw [← Nat.succ_add, ← Nat.succ_add]; exact h))
theorem ar2 (Wb U T n Lb k : Nat) (h1 : Wb + (U + T) + 1 = n) (h2 : n = Lb + U) (h3 : Wb + k = Lb) : T + 1 = k := by
rw [h2, ← h3] at h1
have e : Wb + (U + (T + 1)) = Wb + (U + k) := by
rw [← Nat.add_assoc U T 1, ← Nat.add_assoc Wb (U + T) 1, h1, Nat.add_assoc Wb k U, Nat.add_comm k U]
exact addLC U (addLC Wb e)
theorem sumB_cnt : (Bs : List (Blk N)) → (∀ B, B ∈ Bs → BInv N B) →
sumB N (fun B => sumL (w N) B.vs) Bs + Bs.length = sumB N (fun B => sumL (fun _ => 1) B.vs) Bs
| [], _ => rfl
| B :: Bs, h => by
show sumL (w N) B.vs + sumB N _ Bs + (Bs.length + 1) = sumL (fun _ => 1) B.vs + sumB N _ Bs
rw [← (h B (.head _)).cnt, ← sumB_cnt Bs (fun C m => h C (.tail _ m))]
exact ar1 _ _ _
/-- the counting identity -/
theorem count_ten (hc : Correct N) {Bs : List (Blk N)} (hi : Inv N Bs) :
sumR (fun v => cond (!inAny N v Bs) (cond (isTen N v) 1 0) 0) N.n + 1 = Bs.length := by
have hb : ∀ B, B ∈ Bs → Nd B.vs ∧ AllLt N.n B.vs := fun B m => ⟨(hi.blk B m).nd, (hi.blk B m).lt⟩
-- weights outside the blocks
have hU : sumR (fun v => cond (!inAny N v Bs) (w N v) 0) N.n =
sumR (fun v => cond (!inAny N v Bs) 1 0) N.n + sumR (fun v => cond (!inAny N v Bs) (cond (isTen N v) 1 0) 0) N.n := by
rw [← sumR_add]
exact sumR_congr N.n (fun v hv => by
match hp : inAny N v Bs with
| true => rfl
| false =>
show w N v = 1 + cond (isTen N v) 1 0
unfold w isTen
match hk : N.kd v with
| .atm => exact absurd (hi.atoms v hv hk) (by rw [hp]; exact fun e => Bool.noConfusion e)
| .ten => rfl
| .par => rfl)
have h1 := sumR_split (fun v => inAny N v Bs) (w N) N.n
have h2 := sumR_split (fun v => inAny N v Bs) (fun _ => 1) N.n
rw [sum_blocks N (w N) Bs hb hi.disj] at h1
rw [sum_blocks N (fun _ => 1) Bs hb hi.disj] at h2
have hn : sumR (fun _ => 1) N.n = N.n := by
have : ∀ k, sumR (fun _ => 1) k = k := fun k => by
induction k with
| zero => rfl
| succ k ih => show sumR (fun _ => 1) k + 1 = k + 1; rw [ih]
exact this N.n
have hcount := hc.count
have hbc := sumB_cnt N Bs hi.blk
rw [h1, hU] at hcount
rw [hn] at h2
exact ar2 _ _ _ _ _ _ hcount h2 hbc
end SQ
end Found
#print axioms Found.SQ.sum_blocks
#print axioms Found.SQ.count_ten
lean_all/found/Seq4.lean
/-
T179, sequentialization, part 4. found/Seq4 — progress: in a correct net,
a parsing state with two or more blocks, or with an unprocessed vertex,
has a ready link: a ⊗ whose premises lie in different blocks, or a ⅋
whose premises lie in one block.
* one block: a lowest unprocessed vertex has processed premises; a ⊗ is
impossible since #(unprocessed ⊗) + 1 = #blocks;
* several blocks: if nothing is ready, every block B meets an unprocessed
⊗ (switch every ⅋ away from B; the switching graph is connected, so an
edge leaves B), different blocks meet different ⊗, hence
#(unprocessed ⊗) ≥ #blocks — impossible.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Seq3
import found.ClassicalPoint
namespace Found
namespace SQ
open PN
variable (N : Net)
/-! ## blocks and membership -/
theorem inAny_mem {x : Nat} : {Bs : List (Blk N)} → inAny N x Bs = true → ∃ B, B ∈ Bs ∧ x ∈ B.vs
| [], h => Bool.noConfusion h
| B :: Bs, h => by
match hb : inl x B.vs with
| true => exact ⟨B, .head _, mem_of_inl hb⟩
| false =>
have h' : inAny N x Bs = true := by
have : (inl x B.vs || inAny N x Bs) = true := h
rw [hb] at this; exact this
match inAny_mem h' with
| ⟨C, hC, hx⟩ => exact ⟨C, .tail _ hC, hx⟩
theorem mem_inAny {x : Nat} : {Bs : List (Blk N)} → {B : Blk N} → B ∈ Bs → x ∈ B.vs → inAny N x Bs = true
| _ :: _, _, .head _, hx => by show (inl x _ || _) = true; rw [inl_of_mem hx]; rfl
| C :: _, _, .tail _ m, hx => by
show (inl x C.vs || _) = true
rw [mem_inAny m hx]
cases inl x C.vs <;> rfl
theorem disj_same {x : Nat} : {Bs : List (Blk N)} → Disj N Bs → {B C : Blk N} → B ∈ Bs → C ∈ Bs →
x ∈ B.vs → x ∈ C.vs → B = C
| _ :: _, _, _, _, .head _, .head _, _, _ => rfl
| _ :: _, hd, _, _, .head _, .tail _ mC, hB, hC => absurd (mem_inAny N mC hC) (by rw [hd.1 _ hB]; exact fun e => Bool.noConfusion e)
| _ :: _, hd, _, _, .tail _ mB, .head _, hB, hC => absurd (mem_inAny N mB hB) (by rw [hd.1 _ hC]; exact fun e => Bool.noConfusion e)
| _ :: _, hd, _, _, .tail _ mB, .tail _ mC, hB, hC => disj_same hd.2 mB mC hB hC
/-! ## sums -/
theorem sumR_mono {f g : Nat → Nat} : (n : Nat) → (∀ v, v < n → f v ≤ g v) → sumR f n ≤ sumR g n
| 0, _ => Nat.le_refl 0
| k + 1, h => Nat.add_le_add (sumR_mono k (fun v hv => h v (Nat.lt_succ_of_lt hv))) (h k (Nat.lt_succ_self k))
theorem sumL_const (L : List Nat) : sumL (fun _ => 1) L = L.length := by
induction L with
| nil => rfl
| cons a L ih => show 1 + sumL _ L = L.length + 1; rw [ih, Nat.add_comm]
/-- a list without repetitions inside {v | g v = 1} is at most Σ g -/
theorem nd_le (g : Nat → Nat) (n : Nat) (L : List Nat) (hd : Nd L) (hl : AllLt n L)
(h1 : ∀ x, x ∈ L → g x = 1) : L.length ≤ sumR g n := by
have e1 : sumR (fun v => cond (inl v L) (g v) 0) n = L.length := by
rw [sumR_mem g n L hd hl, ← sumL_const L]
induction L with
| nil => rfl
| cons a L ih =>
show g a + sumL g L = 1 + sumL _ L
rw [h1 a (.head _), ih hd.2 (fun x m => hl x (.tail _ m)) (fun x m => h1 x (.tail _ m))]
rw [← e1]
exact sumR_mono n (fun v _ => by
cases inl v L with
| true => exact Nat.le_refl _
| false => exact Nat.zero_le _)
theorem single_le (g : Nat → Nat) {x : Nat} : (n : Nat) → x < n → g x ≤ sumR g n
| 0, h => absurd h (Nat.not_lt_zero x)
| k + 1, h => by
show g x ≤ sumR g k + g k
cases Nat.lt_or_ge x k with
| inl hl => exact Nat.le_trans (single_le g k hl) (Nat.le_add_right _ _)
| inr hg =>
have e : x = k := Nat.le_antisymm (Nat.le_of_lt_succ h) hg
rw [e]; exact Nat.le_add_left _ _
/-! ## ready links -/
def ReadyT (Bs : List (Blk N)) (T : Nat) : Prop :=
T < N.n ∧ inAny N T Bs = false ∧ N.kd T = .ten ∧ inAny N (N.lc T) Bs = true ∧ inAny N (N.rc T) Bs = true ∧
¬ ∃ B, B ∈ Bs ∧ N.lc T ∈ B.vs ∧ N.rc T ∈ B.vs
def ReadyP (Bs : List (Blk N)) (P : Nat) : Prop :=
P < N.n ∧ inAny N P Bs = false ∧ N.kd P = .par ∧ ∃ B, B ∈ Bs ∧ N.lc P ∈ B.vs ∧ N.rc P ∈ B.vs
def fsz : F → Nat
| .pos _ => 0
| .neg _ => 0
| .tensor a b => fsz a + fsz b + 1
| .par a b => fsz a + fsz b + 1
theorem unproc_comp {Bs : List (Blk N)} (hi : Inv N Bs) {v : Nat} (hv : v < N.n)
(hu : inAny N v Bs = false) : N.kd v = .ten ∨ N.kd v = .par := by
match hk : N.kd v with
| .atm => exact absurd (hi.atoms v hv hk) (by rw [hu]; exact fun e => Bool.noConfusion e)
| .ten => exact .inl rfl
| .par => exact .inr rfl
/-- a lowest unprocessed vertex -/
theorem frontier (hw : WF N) {Bs : List (Blk N)} (hi : Inv N Bs) : (m : Nat) → ∀ v, v < N.n → inAny N v Bs = false →
fsz (N.lab v) ≤ m → ∃ u, u < N.n ∧ inAny N u Bs = false ∧ inAny N (N.lc u) Bs = true ∧ inAny N (N.rc u) Bs = true
| m, v, hv, hu, hm => by
have hc := unproc_comp N hi hv hu
have hch := hw.ch v hv hc
have hsz : fsz (N.lab (N.lc v)) < fsz (N.lab v) ∧ fsz (N.lab (N.rc v)) < fsz (N.lab v) := by
cases hc with
| inl ht =>
rw [hw.labT v hv ht]
exact ⟨Nat.lt_succ_of_le (Nat.le_add_right _ _), Nat.lt_succ_of_le (Nat.le_add_left _ _)⟩
| inr hp =>
rw [hw.labP v hv hp]
exact ⟨Nat.lt_succ_of_le (Nat.le_add_right _ _), Nat.lt_succ_of_le (Nat.le_add_left _ _)⟩
match m with
| 0 => exact absurd (Nat.lt_of_lt_of_le hsz.1 hm) (Nat.not_lt_zero _)
| m + 1 =>
match hl : inAny N (N.lc v) Bs with
| false => exact frontier hw hi m (N.lc v) hch.1 hl (Nat.le_of_lt_succ (Nat.lt_of_lt_of_le hsz.1 hm))
| true =>
match hr : inAny N (N.rc v) Bs with
| false => exact frontier hw hi m (N.rc v) hch.2.1 hr (Nat.le_of_lt_succ (Nat.lt_of_lt_of_le hsz.2 hm))
| true => exact ⟨v, hv, hu, hl, hr⟩
/-! ## pigeonhole over blocks -/
def NEB (Bs : List (Blk N)) : Prop := ∀ B, B ∈ Bs → ∃ x, x ∈ B.vs
theorem pig (R : Blk N → Nat → Prop) (Q : Nat → Prop) (hQ : ∀ B t, R B t → Q t) : (Bs : List (Blk N)) →
Disj N Bs → NEB N Bs → (∀ B, B ∈ Bs → ∃ t, R B t) →
(∀ B C t, B ∈ Bs → C ∈ Bs → R B t → R C t → B = C) →
∃ L : List Nat, Nd L ∧ L.length = Bs.length ∧ ∀ x, x ∈ L → Q x ∧ ∃ C, C ∈ Bs ∧ R C x
| [], _, _, _, _ => ⟨[], trivial, rfl, fun _ m => nomatch m⟩
| B :: Bs, hd, hn, ex, inj =>
match pig R Q hQ Bs hd.2 (fun C m => hn C (.tail _ m)) (fun C m => ex C (.tail _ m))
(fun C D t mC mD => inj C D t (.tail _ mC) (.tail _ mD)) with
| ⟨L, hL, hlen, hx⟩ => match ex B (.head _) with
| ⟨t, ht⟩ => ⟨t :: L, ⟨fun m => match hx t m with
| ⟨_, C, hC, hCt⟩ =>
have e : B = C := inj B C t (.head _) (.tail _ hC) ht hCt
match hn B (.head _) with
| ⟨y, hy⟩ => absurd (mem_inAny N hC (e ▸ hy)) (by rw [hd.1 y hy]; exact fun e => Bool.noConfusion e), hL⟩,
by show L.length + 1 = Bs.length + 1; rw [hlen],
fun x m => match m with
| .head _ => ⟨hQ B _ ht, B, .head _, ht⟩
| .tail _ m' => match hx x m' with
| ⟨q, C, hC, hCx⟩ => ⟨q, C, .tail _ hC, hCx⟩⟩
theorem other_vertex : {Bs : List (Blk N)} → Disj N Bs → NEB N Bs → 2 ≤ Bs.length → {B : Blk N} → B ∈ Bs →
∃ y, inAny N y Bs = true ∧ inl y B.vs = false
| B1 :: B2 :: rest, hd, hn, _, _, .head _ => match hn B2 (.tail _ (.head _)) with
| ⟨y, hy⟩ => ⟨y, mem_inAny N (.tail _ (.head _)) hy, inl_false (fun hyB => absurd (mem_inAny N (.head _) hy)
(by rw [hd.1 y hyB]; exact fun e => Bool.noConfusion e))⟩
| B1 :: _ :: _, hd, hn, _, _, .tail _ m => match hn B1 (.head _) with
| ⟨y, hy⟩ => ⟨y, mem_inAny N (.head _) hy, inl_false (fun hyB => absurd (mem_inAny N m hyB)
(by rw [hd.1 y hy]; exact fun e => Bool.noConfusion e))⟩
| [], _, _, h, _, _ => absurd h (by exact Nat.not_succ_le_zero 1)
| [_], _, _, h, _, _ => absurd h (by exact Nat.not_succ_le_self 1)
theorem neb_of {Bs : List (Blk N)} (hi : Inv N Bs) : NEB N Bs := fun B m => by
have hc := (hi.blk B m).cnt
match hv : B.vs with
| [] => rw [hv] at hc; exact absurd hc (fun e => Nat.noConfusion e)
| x :: _ => exact ⟨x, .head _⟩
theorem one_block {α : Type} : {Bs : List α} → Bs.length < 2 → {a b : α} → a ∈ Bs → b ∈ Bs → a = b
| [_], _, _, _, .head _, .head _ => rfl
| [_], _, _, _, .head _, .tail _ m => nomatch m
| [_], _, _, _, .tail _ m, _ => nomatch m
| _ :: _ :: _, h, _, _, _, _ => absurd h (Nat.not_lt_of_le (Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _))))
/-! ## progress -/
def Adj (T : Nat) (B : Blk N) (Bs : List (Blk N)) : Prop :=
T < N.n ∧ inAny N T Bs = false ∧ N.kd T = .ten ∧ (N.lc T ∈ B.vs ∨ N.rc T ∈ B.vs)
def swB (B : Blk N) (y : Nat) : Bool := !inl (N.lc y) B.vs
theorem progress (K : CP.Classical') (hw : WF N) (hc : Correct N) {Bs : List (Blk N)} (hi : Inv N Bs)
(hne : 2 ≤ Bs.length ∨ ∃ v, v < N.n ∧ inAny N v Bs = false) :
(∃ T, ReadyT N Bs T) ∨ (∃ P, ReadyP N Bs P) :=
(K.lem (∃ T, ReadyT N Bs T)).elim .inl (fun nT => (K.lem (∃ P, ReadyP N Bs P)).elim .inr (fun nP => by
have hcnt := count_ten N hc hi
have hn := neb_of N hi
let ind : Nat → Nat := fun v => cond (!inAny N v Bs) (cond (isTen N v) 1 0) 0
have ind1 : ∀ v, inAny N v Bs = false → N.kd v = .ten → ind v = 1 := fun v hu ht => by
show cond (!inAny N v Bs) (cond (isTen N v) 1 0) 0 = 1
rw [hu]; unfold isTen; rw [ht]; rfl
cases Nat.lt_or_ge Bs.length 2 with
| inl hk =>
-- at most one block: a lowest unprocessed vertex is ready
have hv : ∃ v, v < N.n ∧ inAny N v Bs = false := hne.elim (fun h => absurd h (Nat.not_le_of_gt hk)) id
match hv with
| ⟨v, hvn, hvu⟩ =>
match frontier N hw hi (fsz (N.lab v)) v hvn hvu (Nat.le_refl _) with
| ⟨u, hun, huu, hl, hr⟩ =>
match inAny_mem N hl, inAny_mem N hr with
| ⟨B1, hB1, hlB⟩, ⟨B2, hB2, hrB⟩ =>
have e12 : B1 = B2 := one_block hk hB1 hB2
cases unproc_comp N hi hun huu with
| inl ht =>
have h1 : 1 ≤ sumR ind N.n := by
have := single_le ind N.n hun
rw [ind1 u huu ht] at this; exact this
exact absurd (hcnt ▸ Nat.succ_le_succ h1 : 2 ≤ Bs.length) (Nat.not_le_of_gt hk)
| inr hp => exact (nP ⟨u, hun, huu, hp, B1, hB1, hlB, e12 ▸ hrB⟩).elim
| inr hk =>
-- several blocks: each meets its own unprocessed ⊗
have adj : ∀ B, B ∈ Bs → ∃ T, Adj N T B Bs := fun B hB => by
match hn B hB, other_vertex N hi.disj hn hk hB with
| ⟨x, hx⟩, ⟨y, hy, hyB⟩ =>
match inAny_mem N hy with
| ⟨C, hC, hyC⟩ =>
have hxn : x < N.n := (hi.blk B hB).lt x hx
have hyn : y < N.n := (hi.blk C hC).lt y hyC
match exit N (swB N B) (fun v => inl v B.vs) (hc.conn (swB N B) x y hxn hyn) (inl_of_mem hx) hyB with
| ⟨a, b, ha, hb, e⟩ =>
have haB : a ∈ B.vs := mem_of_inl ha
have hbB : ¬ b ∈ B.vs := fun m => absurd (inl_of_mem m) (by rw [hb]; exact fun e => Bool.noConfusion e)
cases e with
| inl e =>
cases e with
| inl e =>
have hbu : inAny N b Bs = false := by
match hbp : inAny N b Bs with
| false => rfl
| true =>
match inAny_mem N hbp with
| ⟨D, hD, hbD⟩ =>
have hcl := (hi.blk D hD).clc b hbD e.1.2.1
have haD : a ∈ D.vs := e.1.2.2.elim (fun h => h ▸ hcl.1) (fun h => h ▸ hcl.2)
exact absurd (disj_same N hi.disj hB hD haB haD ▸ hbD) hbB
cases e.2 with
| inl ht => exact ⟨b, e.1.1, hbu, ht, e.1.2.2.elim (fun h => .inl (h ▸ haB)) (fun h => .inr (h ▸ haB))⟩
| inr hp =>
have hsel : a = cond (!inl (N.lc b) B.vs) (N.lc b) (N.rc b) := hp.2
match hlb : inl (N.lc b) B.vs with
| true =>
rw [hlb] at hsel
have hsel' : a = N.rc b := hsel
exact absurd ⟨b, e.1.1, hbu, hp.1, B, hB, mem_of_inl hlb, hsel' ▸ haB⟩ nP
| false =>
rw [hlb] at hsel
have hsel' : a = N.lc b := hsel
exact absurd (hlb.symm.trans (inl_of_mem (hsel' ▸ haB))) (fun e => Bool.noConfusion e)
| inr e => exact absurd (e.2.2 ▸ (hi.blk B hB).cax a haB e.2.1) hbB
| inr e =>
cases e with
| inl e =>
have hcl := (hi.blk B hB).clc a haB e.1.2.1
exact absurd (e.1.2.2.elim (fun h => h ▸ hcl.1) (fun h => h ▸ hcl.2)) hbB
| inr e =>
match inAny_mem N (hi.atoms b e.1 e.2.1) with
| ⟨D, hD, hbD⟩ =>
have haD : a ∈ D.vs := e.2.2 ▸ (hi.blk D hD).cax b hbD e.2.1
exact absurd (disj_same N hi.disj hD hB haD haB ▸ hbD) hbB
have uniq : ∀ B C T, B ∈ Bs → C ∈ Bs → Adj N T B Bs → Adj N T C Bs → B = C := fun B C T hB hC h1 h2 => by
have two : ∀ X Y, X ∈ Bs → Y ∈ Bs → N.lc T ∈ X.vs → N.rc T ∈ Y.vs → X = Y := fun X Y hX hY hl hr =>
match K.lem (∃ D, D ∈ Bs ∧ N.lc T ∈ D.vs ∧ N.rc T ∈ D.vs) with
| .inl ⟨D, hD, hlD, hrD⟩ => (disj_same N hi.disj hX hD hl hlD).trans (disj_same N hi.disj hD hY hrD hr)
| .inr hno => absurd ⟨T, h1.1, h1.2.1, h1.2.2.1, mem_inAny N hX hl, mem_inAny N hY hr, hno⟩ nT
cases h1.2.2.2 with
| inl hl => cases h2.2.2.2 with
| inl hl' => exact disj_same N hi.disj hB hC hl hl'
| inr hr' => exact two B C hB hC hl hr'
| inr hr => cases h2.2.2.2 with
| inl hl' => exact (two C B hC hB hl' hr).symm
| inr hr' => exact disj_same N hi.disj hB hC hr hr'
match pig N (fun B T => Adj N T B Bs) (fun t => t < N.n ∧ ind t = 1)
(fun _ t h => ⟨h.1, ind1 t h.2.1 h.2.2.1⟩) Bs hi.disj hn adj uniq with
| ⟨L, hL, hlen, hx⟩ =>
have hle := nd_le ind N.n L hL (fun x m => (hx x m).1.1) (fun x m => (hx x m).1.2)
rw [hlen] at hle
exact absurd (hcnt ▸ hle) (Nat.not_succ_le_self _)))
end SQ
end Found
#print axioms Found.SQ.disj_same
#print axioms Found.SQ.nd_le
#print axioms Found.SQ.frontier
#print axioms Found.SQ.pig
#print axioms Found.SQ.progress
lean_all/found/Seq5.lean
/-
T179, sequentialization, part 5. found/Seq5 — list tools for the parsing
state (picking a block out of the list, disjointness, lists without
repetition) and the initial state: one block per axiom link.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Seq4
namespace Found
namespace SQ
open PN
variable (N : Net)
/-! ## lists without repetition -/
theorem nd_app_l : (a b : List Nat) → Nd (a ++ b) → Nd a
| [], _, _ => trivial
| _ :: a, b, h => ⟨fun m => h.1 ((mem_app_iff a b).2 (.inl m)), nd_app_l a b h.2⟩
theorem nd_app_r : (a b : List Nat) → Nd (a ++ b) → Nd b
| [], _, h => h
| _ :: a, b, h => nd_app_r a b h.2
theorem nd_app_disj : (a b : List Nat) → Nd (a ++ b) → ∀ x, x ∈ a → ¬ x ∈ b
| _ :: a, b, h, _, .head _ => fun m => h.1 ((mem_app_iff a b).2 (.inr m))
| _ :: a, b, h, x, .tail _ m => nd_app_disj a b h.2 x m
theorem nd_app : (a b : List Nat) → Nd a → Nd b → (∀ x, x ∈ a → ¬ x ∈ b) → Nd (a ++ b)
| [], _, _, hb, _ => hb
| y :: a, b, ha, hb, hd => ⟨fun m => ((mem_app_iff a b).1 m).elim ha.1 (hd y (.head _)),
nd_app a b ha.2 hb (fun x m => hd x (.tail _ m))⟩
theorem nd_single (x : Nat) : Nd [x] := ⟨(fun m => nomatch m), trivial⟩
/-! ## picking a block -/
theorem split_blk {B : Blk N} : {Bs : List (Blk N)} → B ∈ Bs → ∃ A C, Bs = A ++ B :: C
| _ :: C, .head _ => ⟨[], C, rfl⟩
| D :: _, .tail _ m => match split_blk m with
| ⟨A, C, e⟩ => ⟨D :: A, C, by rw [e]; rfl⟩
theorem inAny_app (x : Nat) : (A C : List (Blk N)) → inAny N x (A ++ C) = (inAny N x A || inAny N x C)
| [], _ => rfl
| D :: A, C => by
show (inl x D.vs || inAny N x (A ++ C)) = ((inl x D.vs || inAny N x A) || inAny N x C)
rw [inAny_app x A C]
cases inl x D.vs <;> rfl
theorem inAny_pick (x : Nat) (A C : List (Blk N)) (B : Blk N) :
inAny N x (A ++ B :: C) = (inl x B.vs || inAny N x (A ++ C)) := by
rw [inAny_app, inAny_app]
show (inAny N x A || (inl x B.vs || inAny N x C)) = (inl x B.vs || (inAny N x A || inAny N x C))
cases inAny N x A <;> cases inl x B.vs <;> rfl
theorem or_false_l {a b : Bool} (h : (a || b) = false) : a = false := by
cases a with
| false => rfl
| true => exact absurd h (fun e => Bool.noConfusion e)
theorem or_false_r {a b : Bool} (h : (a || b) = false) : b = false := by
cases a with
| false => exact h
| true => exact absurd h (fun e => Bool.noConfusion e)
theorem disj_pick (B : Blk N) : (A C : List (Blk N)) → Disj N (A ++ B :: C) →
(∀ x, x ∈ B.vs → inAny N x (A ++ C) = false) ∧ Disj N (A ++ C)
| [], _, h => h
| D :: A, C, h =>
have ih := disj_pick B A C h.2
⟨fun x hx => by
show (inl x D.vs || inAny N x (A ++ C)) = false
rw [ih.1 x hx]
match hd : inl x D.vs with
| false => rfl
| true =>
have this : inAny N x (A ++ B :: C) = false := h.1 x (mem_of_inl hd)
rw [inAny_pick, inl_of_mem hx] at this
exact absurd this (fun e => Bool.noConfusion e),
fun x hx => by
have this : inAny N x (A ++ B :: C) = false := h.1 x hx
rw [inAny_pick] at this
exact or_false_r this, ih.2⟩
theorem mem_pick {B D : Blk N} : (A C : List (Blk N)) → D ∈ A ++ B :: C → D = B ∨ D ∈ A ++ C
| [], C, m => match (show D ∈ B :: C from m) with
| .head _ => .inl rfl
| .tail _ m' => .inr m'
| E :: A, C, m => match (show D ∈ E :: (A ++ B :: C) from m) with
| .head _ => .inr (.head _)
| .tail _ m' => (mem_pick A C m').elim .inl (fun m'' => .inr (.tail _ m''))
theorem mem_of_pick {B D : Blk N} : (A C : List (Blk N)) → D ∈ A ++ C → D ∈ A ++ B :: C
| [], _, m => .tail _ m
| E :: A, C, m => match (show D ∈ E :: (A ++ C) from m) with
| .head _ => .head _
| .tail _ m' => .tail _ (mem_of_pick A C m')
theorem len_pick (B : Blk N) : (A C : List (Blk N)) → (A ++ B :: C).length = (A ++ C).length + 1
| [], _ => rfl
| _ :: A, C => by
show (A ++ B :: C).length + 1 = (A ++ C).length + 1 + 1
rw [len_pick B A C]
/-! ## the initial state: one block per axiom link -/
theorem lab_ax (hw : WF N) {u k : Nat} (hu : u < N.n) (hk : N.kd u = .atm) (hl : N.lab u = .pos k) :
N.lab (N.ax u) = .neg k := by
rw [(hw.axw u hu hk).2.2.2.2, hl]; rfl
def isPosAt (m : Nat) : Bool :=
match Nat.decLt m N.n with
| isFalse _ => false
| isTrue _ =>
match N.kd m with
| .ten => false
| .par => false
| .atm =>
match N.lab m with
| .pos _ => true
| .neg _ => false
| .tensor _ _ => false
| .par _ _ => false
theorem isPosAt_true {m : Nat} (h : isPosAt N m = true) : m < N.n ∧ N.kd m = .atm ∧ ∃ k, N.lab m = .pos k := by
revert h
unfold isPosAt
match Nat.decLt m N.n with
| isFalse _ => exact fun h => Bool.noConfusion h
| isTrue hm =>
match hk : N.kd m with
| .ten => exact fun h => Bool.noConfusion h
| .par => exact fun h => Bool.noConfusion h
| .atm =>
match hl : N.lab m with
| .pos k => exact fun _ => ⟨hm, rfl, k, rfl⟩
| .neg _ => exact fun h => Bool.noConfusion h
| .tensor _ _ => exact fun h => Bool.noConfusion h
| .par _ _ => exact fun h => Bool.noConfusion h
theorem isPosAt_false {m k : Nat} (h : isPosAt N m = false) (hm : m < N.n) (hk : N.kd m = .atm) (hl : N.lab m = .pos k) :
False := by
revert h
unfold isPosAt
match Nat.decLt m N.n with
| isFalse h' => exact absurd hm h'
| isTrue _ =>
rw [hk]
show (match N.lab m with
| .pos _ => true
| .neg _ => false
| .tensor _ _ => false
| .par _ _ => false) = false → False
rw [hl]
exact fun h => Bool.noConfusion h
def initB : Nat → List (Blk N)
| 0 => []
| m + 1 =>
match isPosAt N m with
| true => ⟨[m, N.ax m], [m, N.ax m]⟩ :: initB m
| false => initB m
theorem initB_t {m : Nat} (h : isPosAt N m = true) : initB N (m + 1) = ⟨[m, N.ax m], [m, N.ax m]⟩ :: initB N m := by
show (match isPosAt N m with
| true => (⟨[m, N.ax m], [m, N.ax m]⟩ : Blk N) :: initB N m
| false => initB N m) = _
rw [h]
theorem initB_f {m : Nat} (h : isPosAt N m = false) : initB N (m + 1) = initB N m := by
show (match isPosAt N m with
| true => (⟨[m, N.ax m], [m, N.ax m]⟩ : Blk N) :: initB N m
| false => initB N m) = _
rw [h]
theorem mem2 {x a b : Nat} (h : x ∈ [a, b]) : x = a ∨ x = b :=
match h with
| .head _ => .inl rfl
| .tail _ (.head _) => .inr rfl
| .tail _ (.tail _ m) => nomatch m
def ISpec (m : Nat) : Prop :=
(∀ B, B ∈ initB N m → ∃ u k, u < m ∧ u < N.n ∧ N.kd u = .atm ∧ N.lab u = .pos k ∧ B.vs = [u, N.ax u] ∧
B.ds = [u, N.ax u]) ∧ Disj N (initB N m) ∧
(∀ v k, v < N.n → N.kd v = .atm → ((N.lab v = .pos k ∧ v < m) ∨ (N.lab v = .neg k ∧ N.ax v < m)) →
inAny N v (initB N m) = true)
theorem keep {m : Nat} (ih : ISpec N m) (L : List (Blk N)) (e : L = initB N m)
(hno : ∀ v k, v < N.n → N.kd v = .atm → ¬ ((N.lab v = .pos k ∧ v = m) ∨ (N.lab v = .neg k ∧ N.ax v = m))) :
(∀ B, B ∈ L → ∃ u k, u < m + 1 ∧ u < N.n ∧ N.kd u = .atm ∧ N.lab u = .pos k ∧ B.vs = [u, N.ax u] ∧
B.ds = [u, N.ax u]) ∧ Disj N L ∧
(∀ v k, v < N.n → N.kd v = .atm → ((N.lab v = .pos k ∧ v < m + 1) ∨ (N.lab v = .neg k ∧ N.ax v < m + 1)) →
inAny N v L = true) := by
rw [e]
refine ⟨fun B hB => match ih.1 B hB with
| ⟨u, k, h1, h2⟩ => ⟨u, k, Nat.lt_succ_of_lt h1, h2⟩, ih.2.1, fun v k hv hk h => ih.2.2 v k hv hk ?_⟩
cases h with
| inl h' => cases Nat.lt_or_ge v m with
| inl hl => exact .inl ⟨h'.1, hl⟩
| inr hg => exact absurd (.inl ⟨h'.1, Nat.le_antisymm (Nat.le_of_lt_succ h'.2) hg⟩) (hno v k hv hk)
| inr h' => cases Nat.lt_or_ge (N.ax v) m with
| inl hl => exact .inr ⟨h'.1, hl⟩
| inr hg => exact absurd (.inr ⟨h'.1, Nat.le_antisymm (Nat.le_of_lt_succ h'.2) hg⟩) (hno v k hv hk)
theorem fresh (hw : WF N) {m k : Nat} (ih : ISpec N m) (hm : m < N.n) (hk : N.kd m = .atm) (hl : N.lab m = .pos k)
(x : Nat) (hx : x ∈ [m, N.ax m]) : inAny N x (initB N m) = false := by
match hb : inAny N x (initB N m) with
| false => rfl
| true =>
match inAny_mem N hb with
| ⟨B, hB, hxB⟩ =>
match ih.1 B hB with
| ⟨u, j, hum, hun, huk, hul, hvs, _⟩ =>
rw [hvs] at hxB
have hlax := lab_ax N hw hm hk hl
have hulax := lab_ax N hw hun huk hul
exact (mem2 hx).elim
(fun ex => (mem2 hxB).elim
(fun eu => by have e : u = m := eu.symm.trans ex; rw [e] at hum; exact absurd hum (Nat.lt_irrefl m))
(fun eu => by rw [ex] at eu; rw [eu, hulax] at hl; exact F.noConfusion hl))
(fun ex => (mem2 hxB).elim
(fun eu => by rw [ex] at eu; rw [← eu, hlax] at hul; exact F.noConfusion hul)
(fun eu => by
rw [ex] at eu
have e2 : m = u := by
rw [← (hw.axw m hm hk).2.2.1, eu, (hw.axw u hun huk).2.2.1]
exact absurd (e2 ▸ hum) (Nat.lt_irrefl m)))
theorem initB_spec (hw : WF N) : (m : Nat) → ISpec N m
| 0 => ⟨(fun _ m => nomatch m), trivial, fun _ _ _ _ h => h.elim (fun h' => absurd h'.2 (Nat.not_lt_zero _))
(fun h' => absurd h'.2 (Nat.not_lt_zero _))⟩
| m + 1 => by
have ih := initB_spec hw m
unfold ISpec
match hp : isPosAt N m with
| false =>
rw [initB_f N hp]
exact keep N ih _ rfl (fun v k hv hkv h => h.elim
(fun h' => isPosAt_false N hp (h'.2 ▸ hv) (h'.2 ▸ hkv) (h'.2 ▸ h'.1))
(fun h' => by
have hax := hw.axw v hv hkv
have hl2 : N.lab (N.ax v) = .pos k := by rw [hax.2.2.2.2, h'.1]; rfl
exact isPosAt_false N hp (h'.2 ▸ hax.1) (h'.2 ▸ hax.2.2.2.1) (h'.2 ▸ hl2)))
| true =>
rw [initB_t N hp]
match isPosAt_true N hp with
| ⟨hm, hk, k, hl⟩ =>
refine ⟨fun B hB => ?_, ⟨fresh N hw ih hm hk hl, ih.2.1⟩, fun v j hv hkv h => ?_⟩
· cases hB with
| head => exact ⟨m, k, Nat.lt_succ_self m, hm, hk, hl, rfl, rfl⟩
| tail _ m' => match ih.1 B m' with
| ⟨u, k', h1, h2⟩ => exact ⟨u, k', Nat.lt_succ_of_lt h1, h2⟩
· show (inl v [m, N.ax m] || inAny N v (initB N m)) = true
cases h with
| inl h' => cases Nat.lt_or_ge v m with
| inl hlt => rw [ih.2.2 v j hv hkv (.inl ⟨h'.1, hlt⟩)]; cases inl v [m, N.ax m] <;> rfl
| inr hg =>
have e : v = m := Nat.le_antisymm (Nat.le_of_lt_succ h'.2) hg
rw [inl_of_mem (show v ∈ [m, N.ax m] from e ▸ .head _)]; rfl
| inr h' => cases Nat.lt_or_ge (N.ax v) m with
| inl hlt => rw [ih.2.2 v j hv hkv (.inr ⟨h'.1, hlt⟩)]; cases inl v [m, N.ax m] <;> rfl
| inr hg =>
have e : N.ax v = m := Nat.le_antisymm (Nat.le_of_lt_succ h'.2) hg
have e' : v = N.ax m := by rw [← e, (hw.axw v hv hkv).2.2.1]
rw [inl_of_mem (show v ∈ [m, N.ax m] from e' ▸ .tail _ (.head _))]; rfl
theorem w_atm {v : Nat} (hk : N.kd v = .atm) (h : v < N.ax v) : w N v = 1 := by
unfold w; rw [hk]
show (match Nat.decLt v (N.ax v) with
| isTrue _ => 1
| isFalse _ => 0) = 1
match Nat.decLt v (N.ax v) with
| isTrue _ => rfl
| isFalse h' => exact absurd h h'
theorem w_atm0 {v : Nat} (hk : N.kd v = .atm) (h : ¬ v < N.ax v) : w N v = 0 := by
unfold w; rw [hk]
show (match Nat.decLt v (N.ax v) with
| isTrue _ => 1
| isFalse _ => 0) = 0
match Nat.decLt v (N.ax v) with
| isTrue h' => exact absurd h' h
| isFalse _ => rfl
theorem mem_one {x a : Nat} (h : x ∈ [a]) : x = a :=
match h with
| .head _ => rfl
theorem axblk_inv (hw : WF N) {u k : Nat} (hu : u < N.n) (hk : N.kd u = .atm) (hl : N.lab u = .pos k) :
BInv N ⟨[u, N.ax u], [u, N.ax u]⟩ :=
have hax := hw.axw u hu hk
have notc : ∀ v, v ∈ [u, N.ax u] → ¬ (N.kd v = .ten ∨ N.kd v = .par) := fun v hv hc => (mem2 hv).elim
(fun e => by rw [e, hk] at hc; exact hc.elim (fun e' => Kd.noConfusion e') (fun e' => Kd.noConfusion e'))
(fun e => by rw [e, hax.2.2.2.1] at hc; exact hc.elim (fun e' => Kd.noConfusion e') (fun e' => Kd.noConfusion e'))
have ndp : Nd [u, N.ax u] := ⟨fun m => hax.2.1 (mem_one m).symm, (fun m => nomatch m), trivial⟩
{ rz := ⟨Rz.ax u (N.ax u) k hk rfl hl (lab_ax N hw hu hk hl)⟩
nd := ndp
dnd := ndp
lt := fun x hx => (mem2 hx).elim (fun e => e ▸ hu) (fun e => e ▸ hax.1)
clc := fun v hv hc => absurd hc (notc v hv)
cax := fun v hv _ => (mem2 hv).elim (fun e => by rw [e]; exact .tail _ (.head _))
(fun e => by rw [e, hax.2.2.1]; exact .head _)
door := fun x => ⟨fun hx => ⟨hx, fun p hp hpm => notc p hpm hp.2.1⟩, fun h => h.1⟩
cnt := by
show w N u + (w N (N.ax u) + 0) + 1 = 1 + (1 + 0)
cases Nat.lt_or_ge u (N.ax u) with
| inl hlt =>
rw [w_atm N hk hlt, w_atm0 N hax.2.2.2.1 (by rw [hax.2.2.1]; exact Nat.not_lt_of_gt hlt)]
| inr hge =>
have hgt : N.ax u < u := Nat.lt_of_le_of_ne hge hax.2.1
rw [w_atm0 N hk (Nat.not_lt_of_gt hgt), w_atm N hax.2.2.2.1 (by rw [hax.2.2.1]; exact hgt)] }
theorem init_inv (hw : WF N) : Inv N (initB N N.n) :=
have sp := initB_spec N hw N.n
{ blk := fun B hB => match sp.1 B hB with
| ⟨u, k, _, hu, hk, hl, hvs, hds⟩ => by
have e : B = ⟨[u, N.ax u], [u, N.ax u]⟩ := by
match B, hvs, hds with
| ⟨_, _⟩, rfl, rfl => rfl
rw [e]; exact axblk_inv N hw hu hk hl
disj := sp.2.1
atoms := fun v hv hk => match hw.atl v hv hk with
| ⟨k, .inl hl⟩ => sp.2.2 v k hv hk (.inl ⟨hl, hv⟩)
| ⟨k, .inr hl⟩ => sp.2.2 v k hv hk (.inr ⟨hl, (hw.axw v hv hk).1⟩) }
end SQ
end Found
#print axioms Found.SQ.nd_app
#print axioms Found.SQ.inAny_pick
#print axioms Found.SQ.disj_pick
#print axioms Found.SQ.mem_pick
#print axioms Found.SQ.initB_spec
#print axioms Found.SQ.init_inv
lean_all/found/Seq6.lean
/-
T179, sequentialization, part 6. found/Seq6 — the parsing steps and
Danos–Regnier sequentialization: every correct MLL proof structure is the
proof net of a derivation. A ready ⅋ joins its block; a ready ⊗ merges
the two blocks of its premises; by the progress lemma (found/Seq4) the
parse goes on until one block holds every vertex; its realization is a
derivation built from exactly the links of the net, whose conclusions
are the vertices with no link below.
Lean 4 core only, hand-written proofs, no axioms.
Classical point: K (case distinctions of the progress lemma), as a parameter.
-/
import found.Seq5
namespace Found
namespace SQ
open PN
variable (N : Net)
/-! ## list tools -/
theorem sumL_app (f : Nat → Nat) : (a b : List Nat) → sumL f (a ++ b) = sumL f a + sumL f b
| [], b => (Nat.zero_add _).symm
| x :: a, b => by
show f x + sumL f (a ++ b) = f x + sumL f a + sumL f b
rw [sumL_app f a b, Nat.add_assoc]
theorem mem_swap_end (a b : List Nat) (x z : Nat) : z ∈ a ++ b ++ [x] ↔ z ∈ a ++ [x] ++ b :=
⟨fun h => ((mem_app_iff _ _).1 h).elim
(fun h' => ((mem_app_iff a b).1 h').elim (fun m => (mem_app_iff _ _).2 (.inl ((mem_app_iff _ _).2 (.inl m))))
(fun m => (mem_app_iff _ _).2 (.inr m)))
(fun m => (mem_app_iff _ _).2 (.inl ((mem_app_iff _ _).2 (.inr m)))),
fun h => ((mem_app_iff _ _).1 h).elim
(fun h' => ((mem_app_iff a [x]).1 h').elim (fun m => (mem_app_iff _ _).2 (.inl ((mem_app_iff _ _).2 (.inl m))))
(fun m => (mem_app_iff _ _).2 (.inr m)))
(fun m => (mem_app_iff _ _).2 (.inl ((mem_app_iff _ _).2 (.inr m))))⟩
theorem nd_toEnd (x : Nat) : (a b : List Nat) → Nd (a ++ [x] ++ b) → Nd (a ++ b ++ [x])
| [], b, h => nd_app b [x] h.2 (nd_single x) (fun _ hy hyx => h.1 ((mem_one hyx) ▸ hy))
| y :: a, b, h => ⟨fun m => h.1 ((mem_swap_end a b x y).1 m), nd_toEnd x a b h.2⟩
/-- move one conclusion to the end, keeping track of membership and repetition -/
theorem mv {B ds : List Nat} (r : Nonempty (Rz N B ds)) {x : Nat} (hx : x ∈ ds) (hnd : Nd ds) :
∃ Γ, (∀ y, y ∈ Γ ++ [x] ↔ y ∈ ds) ∧ Nd (Γ ++ [x]) ∧ Nonempty (Rz N B (Γ ++ [x])) :=
match split_mem hx, r with
| ⟨a, b, e⟩, ⟨r'⟩ => ⟨a ++ b, fun y => (mem_swap_end a b x y).trans (by rw [e]),
nd_toEnd x a b (e ▸ hnd), ⟨toEnd N a x b (castR N e r')⟩⟩
/-- move two conclusions to the end, in this order -/
theorem mv2 {B ds : List Nat} (r : Nonempty (Rz N B ds)) {x y : Nat} (hx : x ∈ ds) (hy : y ∈ ds) (hxy : x ≠ y)
(hnd : Nd ds) : ∃ Γ, (∀ z, z ∈ Γ ++ [x, y] ↔ z ∈ ds) ∧ Nd (Γ ++ [x, y]) ∧ Nonempty (Rz N B (Γ ++ [x, y])) :=
match mv N r hx hnd with
| ⟨Γ1, hm1, hn1, ⟨r1⟩⟩ =>
have hy1 : y ∈ Γ1 := ((mem_app_iff Γ1 [x]).1 ((hm1 y).2 hy)).elim id (fun m => absurd (mem_one m).symm hxy)
match split_mem hy1 with
| ⟨a, b, e⟩ =>
have e2 : Γ1 ++ [x] = a ++ [y] ++ (b ++ [x]) := by rw [e, app_assocN (a ++ [y]) b [x]]
have e3 : a ++ (b ++ [x]) ++ [y] = (a ++ b) ++ [x, y] := by
rw [app_assocN a (b ++ [x]) [y], app_assocN a b [x, y], app_assocN b [x] [y]]; rfl
⟨a ++ b, fun z => by
rw [← e3]
exact (mem_swap_end a (b ++ [x]) y z).trans (by rw [← e2]; exact hm1 z),
by rw [← e3]; exact nd_toEnd y a (b ++ [x]) (e2 ▸ hn1),
⟨castR N e3 (toEnd N a y (b ++ [x]) (castR N e2 r1))⟩⟩
/-! ## the count of unprocessed vertices -/
def UC (Bs : List (Blk N)) : Nat := sumR (fun v => cond (!inAny N v Bs) 1 0) N.n
theorem uc_step {Bs Bs' : List (Blk N)} {P : Nat} (hP : P < N.n) (hu : inAny N P Bs = false)
(h : ∀ v, inAny N v Bs' = (inAny N v Bs || eqB v P)) : UC N Bs = UC N Bs' + 1 := by
have e : sumR (fun v => cond (!inAny N v Bs) 1 0) N.n =
sumR (fun v => cond (!inAny N v Bs') 1 0 + cond (eqB v P) 1 0) N.n :=
sumR_congr N.n (fun v _ => by
rw [h v]
match he : eqB v P with
| true => rw [eqB_eq he, hu]; rfl
| false => cases inAny N v Bs <;> rfl)
unfold UC
rw [e, sumR_add, sumR_single (fun _ => 1) P N.n hP]
theorem mem_cons' {x a : Nat} {l : List Nat} (h : x ∈ a :: l) : x = a ∨ x ∈ l :=
match h with
| .head _ => .inl rfl
| .tail _ m => .inr m
theorem memB {D E : Blk N} {l : List (Blk N)} (h : D ∈ E :: l) : D = E ∨ D ∈ l :=
match h with
| .head _ => .inl rfl
| .tail _ m => .inr m
theorem cond_tt (b c : Bool) : cond b true c = (b || c) := by cases b <;> rfl
/-! ## a ready ⅋ joins its block -/
theorem step_par (hw : WF N) {Bs : List (Blk N)} (hi : Inv N Bs) {P : Nat} (hr : ReadyP N Bs P) :
∃ Bs', Inv N Bs' ∧ UC N Bs = UC N Bs' + 1 := by
match hr with
| ⟨hPn, hPu, hPk, B, hB, hlB, hrB⟩ =>
match split_blk N hB with
| ⟨A, C, eBs⟩ =>
have bi := hi.blk B hB
have hPB : ¬ P ∈ B.vs := fun m => absurd (mem_inAny N hB m) (by rw [hPu]; exact fun e => Bool.noConfusion e)
have chP : ∀ c, (c = N.lc P ∨ c = N.rc P) → Child N c P := fun c hc => ⟨hPn, .inr hPk, hc⟩
have pdoor : ∀ c, (c = N.lc P ∨ c = N.rc P) → c ∈ B.vs → c ∈ B.ds := fun c hc hcB =>
(bi.door c).2 ⟨hcB, fun u hu huB => hPB ((hw.par1 c u P hu (chP c hc)) ▸ huB)⟩
have hne : N.lc P ≠ N.rc P := (hw.ch P hPn (.inr hPk)).2.2
match mv2 N bi.rz (pdoor _ (.inl rfl) hlB) (pdoor _ (.inr rfl) hrB) hne bi.dnd with
| ⟨Γ, hmΓ, hnΓ, ⟨r⟩⟩ =>
have inΓ : ∀ x, x ∈ Γ → x ∈ B.ds ∧ x ≠ N.lc P ∧ x ≠ N.rc P := fun x hx =>
⟨(hmΓ x).1 ((mem_app_iff _ _).2 (.inl hx)),
fun e => nd_app_disj Γ [N.lc P, N.rc P] hnΓ x hx (e ▸ .head _),
fun e => nd_app_disj Γ [N.lc P, N.rc P] hnΓ x hx (e ▸ .tail _ (.head _))⟩
have parentP : ∀ u, Child N P u → ¬ u ∈ P :: B.vs := fun u hu hm => match hm with
| .head _ => hPB (hu.2.2.elim (fun e => by rw [e]; exact hlB) (fun e => by rw [e]; exact hrB))
| .tail _ m => hPB (hu.2.2.elim (fun e => by rw [e]; exact (bi.clc u m hu.2.1).1)
(fun e => by rw [e]; exact (bi.clc u m hu.2.1).2))
have bi' : BInv N ⟨P :: B.vs, Γ ++ [P]⟩ :=
{ rz := ⟨Rz.par P hPk (hw.labP P hPn hPk) r⟩
nd := ⟨hPB, bi.nd⟩
dnd := nd_app Γ [P] (nd_app_l Γ _ hnΓ) (nd_single P) (fun x hx hxP => hPB ((mem_one hxP) ▸ (bi.door x).1 (inΓ x hx).1 |>.1))
lt := fun x (hx : x ∈ P :: B.vs) => match hx with
| .head _ => hPn
| .tail _ m => bi.lt x m
clc := fun v (hv : v ∈ P :: B.vs) hc => match hv with
| .head _ => ⟨.tail _ hlB, .tail _ hrB⟩
| .tail _ m => ⟨.tail _ (bi.clc v m hc).1, .tail _ (bi.clc v m hc).2⟩
cax := fun v (hv : v ∈ P :: B.vs) hk => match hv with
| .head _ => absurd (hPk.symm.trans hk) (fun e => Kd.noConfusion e)
| .tail _ m => .tail _ (bi.cax v m hk)
door := fun x => ⟨fun (hx : x ∈ Γ ++ [P]) => ((mem_app_iff Γ [P]).1 hx).elim
(fun hxΓ =>
have hd := (bi.door x).1 (inΓ x hxΓ).1
⟨.tail _ hd.1, fun u hu (hm : u ∈ P :: B.vs) => match hm with
| .head _ => hu.2.2.elim (inΓ x hxΓ).2.1 (inΓ x hxΓ).2.2
| .tail _ m => hd.2 u hu m⟩)
(fun hxP => by rw [mem_one hxP]; exact ⟨.head _, parentP⟩),
fun ⟨(hm : x ∈ P :: B.vs), hpar⟩ => (mem_cons' hm).elim
(fun e => by rw [e]; exact (mem_app_iff Γ [P]).2 (.inr (.head _)))
(fun m =>
have hd : x ∈ B.ds := (bi.door x).2 ⟨m, fun u hu huB => hpar u hu (.tail _ huB)⟩
((mem_app_iff Γ [N.lc P, N.rc P]).1 ((hmΓ x).2 hd)).elim (fun h => (mem_app_iff Γ [P]).2 (.inl h))
(fun h => absurd (.head _) (hpar P (chP x ((mem2 h).elim .inl .inr)))))⟩
cnt := by
show w N P + sumL (w N) B.vs + 1 = 1 + sumL (fun _ => 1) B.vs
have hwP : w N P = 1 := by unfold w; rw [hPk]
rw [hwP, ← bi.cnt, Nat.add_assoc] }
have dp := disj_pick N B A C (eBs ▸ hi.disj)
have hPAC : inAny N P (A ++ C) = false := by
have := hPu; rw [eBs, inAny_pick] at this; exact or_false_r this
refine ⟨⟨P :: B.vs, Γ ++ [P]⟩ :: (A ++ C), ⟨fun D hD => (memB N hD).elim (fun e => by rw [e]; exact bi')
(fun m => hi.blk D (eBs ▸ mem_of_pick N A C m)),
⟨fun x (hx : x ∈ P :: B.vs) => match hx with
| .head _ => hPAC
| .tail _ m => dp.1 x m, dp.2⟩,
fun v hv hk => by
have h0 := hi.atoms v hv hk
rw [eBs, inAny_pick] at h0
show (cond (eqB v P) true (inl v B.vs) || inAny N v (A ++ C)) = true
rw [cond_tt]
cases hb : inl v B.vs with
| true => cases eqB v P <;> rfl
| false =>
rw [hb] at h0
have h0' : inAny N v (A ++ C) = true := h0
rw [h0']; cases eqB v P <;> rfl⟩, ?_⟩
exact uc_step N hPn hPu (fun v => by
show (cond (eqB v P) true (inl v B.vs) || inAny N v (A ++ C)) = (inAny N v Bs || eqB v P)
rw [eBs, inAny_pick, cond_tt]
cases eqB v P <;> cases inl v B.vs <;> cases inAny N v (A ++ C) <;> rfl)
/-! ## a ready ⊗ merges two blocks -/
theorem inl_app (v : Nat) : (a b : List Nat) → inl v (a ++ b) = (inl v a || inl v b)
| [], _ => rfl
| x :: a, b => by
show cond (eqB v x) true (inl v (a ++ b)) = (cond (eqB v x) true (inl v a) || inl v b)
rw [inl_app v a b]
cases eqB v x <;> rfl
theorem ar3 (s1 s2 l1 l2 : Nat) (h1 : s1 + 1 = l1) (h2 : s2 + 1 = l2) : 2 + (s1 + s2) + 1 = 1 + (l1 + l2) := by
rw [← h1, ← h2, Nat.add_comm 2, Nat.add_assoc, Nat.add_comm 1 (s1 + 1 + (s2 + 1)), Nat.add_assoc (s1 + 1),
Nat.add_assoc s1 1, Nat.add_comm 1 (s2 + 1 + 1), Nat.add_assoc s2 1 1, Nat.add_assoc s1 s2]
theorem step_ten (hw : WF N) {Bs : List (Blk N)} (hi : Inv N Bs) {T : Nat} (hr : ReadyT N Bs T) :
∃ Bs', Inv N Bs' ∧ UC N Bs = UC N Bs' + 1 := by
match hr with
| ⟨hTn, hTu, hTk, hl, hr', hno⟩ =>
match inAny_mem N hl, inAny_mem N hr' with
| ⟨B1, hB1, hlB1⟩, ⟨B2, hB2, hrB2⟩ =>
match split_blk N hB1 with
| ⟨A, C, eBs⟩ =>
have hB2AC : B2 ∈ A ++ C := (mem_pick N A C (eBs ▸ hB2)).elim
(fun e => absurd ⟨B1, hB1, hlB1, by rw [← e]; exact hrB2⟩ hno) id
match split_blk N hB2AC with
| ⟨A', C', e2⟩ =>
have bi1 := hi.blk B1 hB1
have bi2 := hi.blk B2 hB2
have dp1 := disj_pick N B1 A C (eBs ▸ hi.disj)
have dp2 := disj_pick N B2 A' C' (e2 ▸ dp1.2)
have d12 : ∀ x, x ∈ B1.vs → ¬ x ∈ B2.vs := fun x h1 h2 =>
absurd (mem_inAny N hB2AC h2) (by rw [dp1.1 x h1]; exact fun e => Bool.noConfusion e)
have sub' : ∀ x, inAny N x (A' ++ C') = true → inAny N x (A ++ C) = true := fun x h => by
rw [e2, inAny_pick, h]; cases inl x B2.vs <;> rfl
have hTB1 : ¬ T ∈ B1.vs := fun m => absurd (mem_inAny N hB1 m) (by rw [hTu]; exact fun e => Bool.noConfusion e)
have hTB2 : ¬ T ∈ B2.vs := fun m => absurd (mem_inAny N hB2 m) (by rw [hTu]; exact fun e => Bool.noConfusion e)
have chT : ∀ c, (c = N.lc T ∨ c = N.rc T) → Child N c T := fun c hc => ⟨hTn, .inl hTk, hc⟩
have ld : N.lc T ∈ B1.ds := (bi1.door _).2 ⟨hlB1, fun u hu huB => hTB1 ((hw.par1 _ u T hu (chT _ (.inl rfl))) ▸ huB)⟩
have rd : N.rc T ∈ B2.ds := (bi2.door _).2 ⟨hrB2, fun u hu huB => hTB2 ((hw.par1 _ u T hu (chT _ (.inr rfl))) ▸ huB)⟩
match mv N bi1.rz ld bi1.dnd, mv N bi2.rz rd bi2.dnd with
| ⟨Γ, hm1, hn1, ⟨r1⟩⟩, ⟨Δ, hm2, hn2, ⟨r2⟩⟩ =>
have inΓ : ∀ x, x ∈ Γ → x ∈ B1.ds ∧ x ≠ N.lc T := fun x hx =>
⟨(hm1 x).1 ((mem_app_iff _ _).2 (.inl hx)), fun e => nd_app_disj Γ [N.lc T] hn1 x hx (e ▸ .head _)⟩
have inΔ : ∀ x, x ∈ Δ → x ∈ B2.ds ∧ x ≠ N.rc T := fun x hx =>
⟨(hm2 x).1 ((mem_app_iff _ _).2 (.inl hx)), fun e => nd_app_disj Δ [N.rc T] hn2 x hx (e ▸ .head _)⟩
have inV : ∀ x, x ∈ T :: (B1.vs ++ B2.vs) → x = T ∨ x ∈ B1.vs ∨ x ∈ B2.vs := fun x hx =>
(mem_cons' hx).elim .inl (fun m => .inr ((mem_app_iff _ _).1 m))
have parentT : ∀ u, Child N T u → ¬ u ∈ T :: (B1.vs ++ B2.vs) := fun u hu hm =>
(inV u hm).elim
(fun e => by
rw [e] at hu
exact hu.2.2.elim (fun e' => hTB1 (by rw [e']; exact hlB1)) (fun e' => hTB2 (by rw [e']; exact hrB2)))
(fun h => h.elim
(fun m => hTB1 (hu.2.2.elim (fun e => by rw [e]; exact (bi1.clc u m hu.2.1).1)
(fun e => by rw [e]; exact (bi1.clc u m hu.2.1).2)))
(fun m => hTB2 (hu.2.2.elim (fun e => by rw [e]; exact (bi2.clc u m hu.2.1).1)
(fun e => by rw [e]; exact (bi2.clc u m hu.2.1).2))))
have bi' : BInv N ⟨T :: (B1.vs ++ B2.vs), Γ ++ Δ ++ [T]⟩ :=
{ rz := ⟨Rz.ten T hTk (hw.labT T hTn hTk) r1 r2⟩
nd := ⟨fun m => ((mem_app_iff _ _).1 m).elim hTB1 hTB2, nd_app _ _ bi1.nd bi2.nd d12⟩
dnd := nd_app (Γ ++ Δ) [T]
(nd_app Γ Δ (nd_app_l Γ _ hn1) (nd_app_l Δ _ hn2)
(fun x hx hxD => d12 x ((bi1.door x).1 (inΓ x hx).1).1 ((bi2.door x).1 (inΔ x hxD).1).1))
(nd_single T)
(fun x hx hxT => ((mem_app_iff Γ Δ).1 hx).elim
(fun h => hTB1 ((mem_one hxT) ▸ ((bi1.door x).1 (inΓ x h).1).1))
(fun h => hTB2 ((mem_one hxT) ▸ ((bi2.door x).1 (inΔ x h).1).1)))
lt := fun x (hx : x ∈ T :: (B1.vs ++ B2.vs)) => (inV x hx).elim (fun e => e ▸ hTn)
(fun h => h.elim (bi1.lt x) (bi2.lt x))
clc := fun v (hv : v ∈ T :: (B1.vs ++ B2.vs)) hc => (inV v hv).elim
(fun e => by
rw [e]
exact ⟨.tail _ ((mem_app_iff _ _).2 (.inl hlB1)), .tail _ ((mem_app_iff _ _).2 (.inr hrB2))⟩)
(fun h => h.elim
(fun m => ⟨.tail _ ((mem_app_iff _ _).2 (.inl (bi1.clc v m hc).1)),
.tail _ ((mem_app_iff _ _).2 (.inl (bi1.clc v m hc).2))⟩)
(fun m => ⟨.tail _ ((mem_app_iff _ _).2 (.inr (bi2.clc v m hc).1)),
.tail _ ((mem_app_iff _ _).2 (.inr (bi2.clc v m hc).2))⟩))
cax := fun v (hv : v ∈ T :: (B1.vs ++ B2.vs)) hk => (inV v hv).elim
(fun e => absurd (hTk.symm.trans (e ▸ hk)) (fun e' => Kd.noConfusion e'))
(fun h => h.elim (fun m => .tail _ ((mem_app_iff _ _).2 (.inl (bi1.cax v m hk))))
(fun m => .tail _ ((mem_app_iff _ _).2 (.inr (bi2.cax v m hk)))))
door := fun x => ⟨fun (hx : x ∈ Γ ++ Δ ++ [T]) => ((mem_app_iff (Γ ++ Δ) [T]).1 hx).elim
(fun h => ((mem_app_iff Γ Δ).1 h).elim
(fun hxΓ =>
have hd := (bi1.door x).1 (inΓ x hxΓ).1
⟨.tail _ ((mem_app_iff _ _).2 (.inl hd.1)), fun u hu (hm : u ∈ T :: (B1.vs ++ B2.vs)) =>
(inV u hm).elim
(fun e => (e ▸ hu).2.2.elim (inΓ x hxΓ).2 (fun e' => d12 x hd.1 (by rw [e']; exact hrB2)))
(fun h' => h'.elim (hd.2 u hu)
(fun m => d12 x hd.1 (hu.2.2.elim (fun e => by rw [e]; exact (bi2.clc u m hu.2.1).1)
(fun e => by rw [e]; exact (bi2.clc u m hu.2.1).2))))⟩)
(fun hxΔ =>
have hd := (bi2.door x).1 (inΔ x hxΔ).1
⟨.tail _ ((mem_app_iff _ _).2 (.inr hd.1)), fun u hu (hm : u ∈ T :: (B1.vs ++ B2.vs)) =>
(inV u hm).elim
(fun e => (e ▸ hu).2.2.elim (fun e' => d12 x (by rw [e']; exact hlB1) hd.1) (inΔ x hxΔ).2)
(fun h' => h'.elim
(fun m => d12 x (hu.2.2.elim (fun e => by rw [e]; exact (bi1.clc u m hu.2.1).1)
(fun e => by rw [e]; exact (bi1.clc u m hu.2.1).2)) hd.1)
(hd.2 u hu))⟩))
(fun hxT => by rw [mem_one hxT]; exact ⟨.head _, parentT⟩),
fun ⟨(hm : x ∈ T :: (B1.vs ++ B2.vs)), hpar⟩ => (inV x hm).elim
(fun e => by rw [e]; exact (mem_app_iff _ _).2 (.inr (.head _)))
(fun h => h.elim
(fun m =>
have hd : x ∈ B1.ds := (bi1.door x).2 ⟨m, fun u hu huB => hpar u hu (.tail _ ((mem_app_iff _ _).2 (.inl huB)))⟩
((mem_app_iff Γ [N.lc T]).1 ((hm1 x).2 hd)).elim
(fun h' => (mem_app_iff _ _).2 (.inl ((mem_app_iff _ _).2 (.inl h'))))
(fun h' => absurd (.head _) (hpar T (chT x (.inl (mem_one h'))))))
(fun m =>
have hd : x ∈ B2.ds := (bi2.door x).2 ⟨m, fun u hu huB => hpar u hu (.tail _ ((mem_app_iff _ _).2 (.inr huB)))⟩
((mem_app_iff Δ [N.rc T]).1 ((hm2 x).2 hd)).elim
(fun h' => (mem_app_iff _ _).2 (.inl ((mem_app_iff _ _).2 (.inr h'))))
(fun h' => absurd (.head _) (hpar T (chT x (.inr (mem_one h')))))))⟩
cnt := by
show w N T + sumL (w N) (B1.vs ++ B2.vs) + 1 = 1 + sumL (fun _ => 1) (B1.vs ++ B2.vs)
have hwT : w N T = 2 := by unfold w; rw [hTk]
rw [hwT, sumL_app, sumL_app]
exact ar3 _ _ _ _ bi1.cnt bi2.cnt }
have hTAC : inAny N T (A' ++ C') = false := by
match h : inAny N T (A' ++ C') with
| false => rfl
| true =>
have h1 := sub' T h
have h2 := hTu
rw [eBs, inAny_pick, h1] at h2
revert h2
cases inl T B1.vs <;> exact fun e => Bool.noConfusion e
have nB1 : ∀ x, x ∈ B1.vs → inAny N x (A' ++ C') = false := fun x hx => by
match h : inAny N x (A' ++ C') with
| false => rfl
| true => exact absurd (sub' x h) (by rw [dp1.1 x hx]; exact fun e => Bool.noConfusion e)
refine ⟨⟨T :: (B1.vs ++ B2.vs), Γ ++ Δ ++ [T]⟩ :: (A' ++ C'), ⟨fun D hD => (memB N hD).elim
(fun e => by rw [e]; exact bi')
(fun m => hi.blk D (eBs ▸ mem_of_pick N A C (e2 ▸ mem_of_pick N A' C' m))),
⟨fun x (hx : x ∈ T :: (B1.vs ++ B2.vs)) => (inV x hx).elim (fun e => e ▸ hTAC)
(fun h => h.elim (nB1 x) (dp2.1 x)), dp2.2⟩,
fun v hv hk => by
have h0 := hi.atoms v hv hk
rw [eBs, inAny_pick, e2, inAny_pick] at h0
show (cond (eqB v T) true (inl v (B1.vs ++ B2.vs)) || inAny N v (A' ++ C')) = true
rw [cond_tt, inl_app]
revert h0
cases eqB v T <;> cases inl v B1.vs <;> cases inl v B2.vs <;> cases inAny N v (A' ++ C') <;>
(intro h; first | rfl | exact h)⟩, ?_⟩
exact uc_step N hTn hTu (fun v => by
show (cond (eqB v T) true (inl v (B1.vs ++ B2.vs)) || inAny N v (A' ++ C')) = (inAny N v Bs || eqB v T)
rw [eBs, inAny_pick, e2, inAny_pick, cond_tt, inl_app]
cases eqB v T <;> cases inl v B1.vs <;> cases inl v B2.vs <;> cases inAny N v (A' ++ C') <;> rfl)
/-! ## the parse and sequentialization -/
theorem fin_state (hc : Correct N) {Bs : List (Blk N)} (hi : Inv N Bs)
(hno : ¬ (2 ≤ Bs.length ∨ ∃ v, v < N.n ∧ inAny N v Bs = false)) :
∃ B, BInv N B ∧ ∀ v, v < N.n → v ∈ B.vs := by
have hall : ∀ v, v < N.n → inAny N v Bs = true := fun v hv => by
match h : inAny N v Bs with
| true => rfl
| false => exact absurd (.inr ⟨v, hv, h⟩) hno
have hn : 0 < N.n := by
have hcnt := hc.count
match hN : N.n with
| 0 => rw [hN] at hcnt; exact absurd hcnt (fun e => Nat.noConfusion e)
| k + 1 => exact Nat.zero_lt_succ k
have hlen : Bs.length < 2 := Nat.lt_of_not_le (fun h => hno (.inl h))
match inAny_mem N (hall 0 hn) with
| ⟨B, hB, _⟩ => exact ⟨B, hi.blk B hB, fun v hv => match inAny_mem N (hall v hv) with
| ⟨D, hD, hvD⟩ => (one_block hlen hD hB) ▸ hvD⟩
theorem run (K : CP.Classical') (hw : WF N) (hc : Correct N) : (m : Nat) → ∀ Bs : List (Blk N), Inv N Bs →
UC N Bs ≤ m → ∃ B, BInv N B ∧ ∀ v, v < N.n → v ∈ B.vs
| m, Bs, hi, hm => (K.lem (2 ≤ Bs.length ∨ ∃ v, v < N.n ∧ inAny N v Bs = false)).elim
(fun hne =>
have next : ∀ Bs', Inv N Bs' → UC N Bs = UC N Bs' + 1 → ∃ B, BInv N B ∧ ∀ v, v < N.n → v ∈ B.vs :=
fun Bs' hi' he => match m, hm with
| 0, hm => absurd (by rw [he] at hm; exact hm) (Nat.not_succ_le_zero _)
| m' + 1, hm => run K hw hc m' Bs' hi' (Nat.le_of_succ_le_succ (by rw [he] at hm; exact hm))
match progress N K hw hc hi hne with
| .inl ⟨_, hT⟩ => match step_ten N hw hi hT with
| ⟨Bs', hi', he⟩ => next Bs' hi' he
| .inr ⟨_, hP⟩ => match step_par N hw hi hP with
| ⟨Bs', hi', he⟩ => next Bs' hi' he)
(fun hno => fin_state N hc hi hno)
theorem uc_le (Bs : List (Blk N)) : UC N Bs ≤ N.n := by
have h : sumR (fun _ => 1) N.n = N.n := by
have : ∀ k, sumR (fun _ => 1) k = k := fun k => by
induction k with
| zero => rfl
| succ k ih => show sumR (fun _ => 1) k + 1 = k + 1; rw [ih]
exact this N.n
have e := sumR_mono (f := fun v => cond (!inAny N v Bs) 1 0) (g := fun _ => 1) N.n (fun v _ => by
cases inAny N v Bs with
| true => exact Nat.zero_le _
| false => exact Nat.le_refl _)
rw [h] at e
exact e
/-- Danos–Regnier sequentialization: a correct proof structure is realized by a derivation built from
exactly its links, with the vertices without a link below as conclusions -/
theorem sequentialization (K : CP.Classical') (hw : WF N) (hc : Correct N) :
∃ vs ds : List Nat, (∀ v, v ∈ vs ↔ v < N.n) ∧ (∀ x, x ∈ ds ↔ x < N.n ∧ ∀ u, ¬ Child N x u) ∧
Nonempty (Rz N vs ds) :=
match run N K hw hc N.n (initB N N.n) (init_inv N hw) (uc_le N _) with
| ⟨B, bi, hall⟩ => ⟨B.vs, B.ds, fun v => ⟨bi.lt v, hall v⟩,
fun x => (bi.door x).trans ⟨fun ⟨hx, hp⟩ => ⟨bi.lt x hx, fun u hu => hp u hu (hall u hu.1)⟩,
fun ⟨hx, hp⟩ => ⟨hall x hx, fun u hu _ => hp u hu⟩⟩, bi.rz⟩
/-- in particular the conclusions are derivable in MLL -/
theorem derivable (K : CP.Classical') (hw : WF N) (hc : Correct N) :
∃ ds : List Nat, (∀ x, x ∈ ds ↔ x < N.n ∧ ∀ u, ¬ Child N x u) ∧ Nonempty (D (mapF N.lab ds)) :=
match sequentialization N K hw hc with
| ⟨_, ds, _, hd, ⟨r⟩⟩ => ⟨ds, hd, ⟨toD N r⟩⟩
end SQ
end Found
#print axioms Found.SQ.mv2
#print axioms Found.SQ.uc_step
#print axioms Found.SQ.step_par
#print axioms Found.SQ.step_ten
#print axioms Found.SQ.run
#print axioms Found.SQ.sequentialization
#print axioms Found.SQ.derivable
lean_all/found/Sequent.lean
/-
T75. found/Sequent — the sequent calculus LJ (→, ∧) and cut elimination.
* `LJ c Γ A`: sequents with left rules acting on a hypothesis; the cut
rule is available only when `c = true`.
* LJ → ND: every sequent derivation (with cuts) is a natural deduction
term (cut and left rules become β-redexes).
* ND normal forms → cut-free LJ: Nf/Ne translate into cut-free sequent
derivations (eliminations on a hypothesis become left rules).
* Cut elimination: LJ with cut → ND → normalize (T74) → cut-free LJ.
Hence ND, LJ and cut-free LJ prove the same sequents; no cut-free (so no)
derivation of an atom from no hypotheses.
Lean 4 core only, hand-written, structural recursion, no axioms.
-/
import found.ND
namespace Found
namespace ND
inductive LJ (c : Bool) : List Ty → Ty → Type where
| ax {Γ A} : Var Γ A → LJ c Γ A
| impR {Γ A B} : LJ c (A :: Γ) B → LJ c Γ (.arr A B)
| impL {Γ A B C} : Var Γ (.arr A B) → LJ c Γ A → LJ c (B :: Γ) C → LJ c Γ C
| andR {Γ A B} : LJ c Γ A → LJ c Γ B → LJ c Γ (.prod A B)
| andL {Γ A B C} : Var Γ (.prod A B) → LJ c (A :: B :: Γ) C → LJ c Γ C
| cut {Γ A C} : c = true → LJ c Γ A → LJ c (A :: Γ) C → LJ c Γ C
/-! ## LJ → ND -/
def toTm {c : Bool} {Γ : List Ty} {A : Ty} : LJ c Γ A → Tm Γ A
| .ax v => .var v
| .impR d => .lam (toTm d)
| .impL v d e => .app (.lam (toTm e)) (.app (.var v) (toTm d))
| .andR d e => .pair (toTm d) (toTm e)
| .andL v e => .app (.app (.lam (.lam (toTm e))) (.snd (.var v))) (.fst (.var v))
| .cut _ d e => .app (.lam (toTm e)) (toTm d)
/-! ## renaming of sequent derivations -/
def Ren (Γ Δ : List Ty) : Type := (X : Ty) → Var Γ X → Var Δ X
def Ren.lift {Γ Δ : List Ty} {A : Ty} (r : Ren Γ Δ) : Ren (A :: Γ) (A :: Δ) :=
fun _ v => match v with
| .z => .z
| .s v => .s (r _ v)
def renLJ {c : Bool} {Γ Δ : List Ty} {C : Ty} (r : Ren Γ Δ) : LJ c Γ C → LJ c Δ C
| .ax v => .ax (r _ v)
| .impR d => .impR (renLJ r.lift d)
| .impL v d e => .impL (r _ v) (renLJ r d) (renLJ r.lift e)
| .andR d e => .andR (renLJ r d) (renLJ r e)
| .andL v e => .andL (r _ v) (renLJ r.lift.lift e)
| .cut h d e => .cut h (renLJ r d) (renLJ r.lift e)
def wk1 {Γ : List Ty} {B : Ty} : Ren Γ (B :: Γ) := fun _ v => .s v
/-- use an existing hypothesis for the first one -/
def contractTo {Γ : List Ty} {A : Ty} (v : Var Γ A) : Ren (A :: Γ) Γ :=
fun _ u => match u with
| .z => v
| .s u => u
def renFst {Γ : List Ty} {A B : Ty} : Ren (A :: Γ) (A :: B :: Ty.prod A B :: Γ) :=
fun _ u => match u with
| .z => .z
| .s u => .s (.s (.s u))
def renSnd {Γ : List Ty} {A B : Ty} : Ren (B :: Γ) (A :: B :: Ty.prod A B :: Γ) :=
fun _ u => match u with
| .z => .s .z
| .s u => .s (.s (.s u))
/-! ## normal forms → cut-free LJ -/
mutual
def nfLJ {Γ : List Ty} {A : Ty} : Nf Γ A → LJ false Γ A
| .ne n => neLJ n _ (.ax .z)
| .lam m => .impR (nfLJ m)
| .pair a b => .andR (nfLJ a) (nfLJ b)
def neLJ {Γ : List Ty} {A : Ty} : Ne Γ A → (C : Ty) → LJ false (A :: Γ) C → LJ false Γ C
| .var v, _, k => renLJ (contractTo v) k
| .app n m, _, k => neLJ n _ (.impL .z (renLJ wk1 (nfLJ m)) (renLJ wk1.lift k))
| .fst n, _, k => neLJ n _ (.andL .z (renLJ renFst k))
| .snd n, _, k => neLJ n _ (.andL .z (renLJ renSnd k))
end
/-- cut elimination -/
def cutElim {Γ : List Ty} {A : Ty} (d : LJ true Γ A) : LJ false Γ A := nfLJ (nf (toTm d))
/-- cut-free derivations are derivations -/
def withCut {Γ : List Ty} {A : Ty} : LJ false Γ A → LJ true Γ A
| .ax v => .ax v
| .impR d => .impR (withCut d)
| .impL v d e => .impL v (withCut d) (withCut e)
| .andR d e => .andR (withCut d) (withCut e)
| .andL v e => .andL v (withCut e)
| .cut h _ _ => Bool.noConfusion h
/-- ND → cut-free LJ (so ND, LJ, cut-free LJ prove the same sequents) -/
def ndToLJ {Γ : List Ty} {A : Ty} (t : Tm Γ A) : LJ false Γ A := nfLJ (nf t)
/-- no cut-free derivation of an atom from no hypotheses (subformula argument) -/
theorem cutfree_no_atom (n : Nat) (d : LJ false [] (.base n)) : False :=
match d with
| .ax v => nomatch v
| .impL v _ _ => nomatch v
| .andL v _ => nomatch v
| .cut h _ _ => Bool.noConfusion h
/-- hence none with cuts either -/
theorem lj_no_atom (n : Nat) (d : LJ true [] (.base n)) : False := cutfree_no_atom n (cutElim d)
end ND
end Found
#print axioms Found.ND.toTm
#print axioms Found.ND.renLJ
#print axioms Found.ND.nfLJ
#print axioms Found.ND.neLJ
#print axioms Found.ND.cutElim
#print axioms Found.ND.withCut
#print axioms Found.ND.ndToLJ
#print axioms Found.ND.cutfree_no_atom
#print axioms Found.ND.lj_no_atom
lean_all/found/SetTopos.lean
/-
T92. found/SetTopos — sets ↔ toposes: the setoid stem is an elementary
topos with a natural numbers object, assembled from the core:
* finite limits: terminal and products (T62), equalizers (here, a
subobject from the core);
* exponentials (T62's setdCCC); subobject classifier (T97, unique);
* NNO (T86).
With the classical condition and choice this is the ETCS point (T107);
the other direction (a well-pointed topos with NNO and choice gives a
model of bounded Zermelo, Mac Lane) is the line T209.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Classifier
import found.NNO
namespace Found
namespace SetTopos
open Core
/-- equalizers in setoids -/
def eqz {X Y : Setd.{0}} (f g : SHom X Y) : Setd.{0} := Core.subU X (fun x => Y.eqv (f.fn x) (g.fn x))
def eqzMap {X Y : Setd.{0}} (f g : SHom X Y) : SHom (eqz f g) X := ⟨fun x => x.val, fun h => h⟩
theorem eqz_comm {X Y : Setd.{0}} (f g : SHom X Y) :
SetdCat.heq (SetdCat.comp (eqzMap f g) f) (SetdCat.comp (eqzMap f g) g) := fun x => x.property
def eqzLift {X Y Z : Setd.{0}} (f g : SHom X Y) (h : SHom Z X)
(hh : SetdCat.heq (SetdCat.comp h f) (SetdCat.comp h g)) : SHom Z (eqz f g) :=
⟨fun z => ⟨h.fn z, hh z⟩, fun e => h.resp e⟩
theorem eqzLift_comm {X Y Z : Setd.{0}} (f g : SHom X Y) (h : SHom Z X)
(hh : SetdCat.heq (SetdCat.comp h f) (SetdCat.comp h g)) :
SetdCat.heq (SetdCat.comp (eqzLift f g h hh) (eqzMap f g)) h := fun z => X.refl (h.fn z)
theorem eqzLift_uniq {X Y Z : Setd.{0}} (f g : SHom X Y) (h : SHom Z X)
(hh : SetdCat.heq (SetdCat.comp h f) (SetdCat.comp h g)) (k : SHom Z (eqz f g))
(hk : SetdCat.heq (SetdCat.comp k (eqzMap f g)) h) : SetdCat.heq k (eqzLift f g h hh) := hk
/-- the topos data, assembled -/
structure ToposNNO where
term : Terminal SetdCat.{0}
prod : ∀ X Y : Setd.{0}, Product SetdCat.{0} X Y
ccc : CCC SetdCat.{0}
omega : Classif.Classifier.{0}
nno : NNOs.NNO SetdCat.{0} setdTerminal
def setoids : ToposNNO := ⟨setdTerminal, setdProduct, setdCCC, Classif.coreOmega, NNOs.natNNO⟩
end SetTopos
end Found
#print axioms Found.SetTopos.eqz_comm
#print axioms Found.SetTopos.eqzLift_comm
#print axioms Found.SetTopos.eqzLift_uniq
#print axioms Found.SetTopos.setoids
lean_all/found/Setoid.lean
/-
T87. found/Setoid — the setoid model as the frame's set theory.
* Quotients without Quot.sound: the quotient of a setoid by a coarser
equivalence is the same carrier with the new relation; it has the
universal property of the quotient (maps respecting R factor uniquely).
* Function extensionality holds in the setoid exponential by construction
(equality of maps is pointwise), unlike for plain types (T62).
* Choice as a condition: the axiom of choice for setoids (every surjection
has a section) implies excluded middle (Diaconescu–Goodman–Myhill), so
choice is exactly what separates the setoid model from a Boolean one.
* Type-theoretic choice (Σ form) holds outright.
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: Σ-choice without large elimination of Subtype; Diaconescu only through Bool decidability.
-/
import found.CCC
namespace Found
namespace SetoidModel
/-! ## Quotients as setoids -/
structure Coarser (X : Setd.{0}) where
R : X.car → X.car → Prop
refl : ∀ a, R a a
symm : ∀ {a b}, R a b → R b a
trans : ∀ {a b c}, R a b → R b c → R a c
coarser : ∀ {a b}, X.eqv a b → R a b
def quot {X : Setd.{0}} (C : Coarser X) : Setd.{0} := ⟨X.car, C.R, C.refl, C.symm, C.trans⟩
def proj {X : Setd.{0}} (C : Coarser X) : SHom X (quot C) := ⟨fun x => x, fun h => C.coarser h⟩
/-- the projection identifies exactly the R-related elements -/
theorem proj_eqv {X : Setd.{0}} (C : Coarser X) (a b : X.car) :
(quot C).eqv ((proj C).fn a) ((proj C).fn b) ↔ C.R a b := Iff.rfl
/-- universal property: a map respecting R factors through the quotient -/
def lift {X Y : Setd.{0}} (C : Coarser X) (f : SHom X Y) (hf : ∀ {a b}, C.R a b → Y.eqv (f.fn a) (f.fn b)) :
SHom (quot C) Y := ⟨f.fn, hf⟩
theorem lift_comm {X Y : Setd.{0}} (C : Coarser X) (f : SHom X Y)
(hf : ∀ {a b}, C.R a b → Y.eqv (f.fn a) (f.fn b)) :
SetdCat.heq (SetdCat.comp (proj C) (lift C f hf)) f := fun x => Y.refl (f.fn x)
theorem lift_unique {X Y : Setd.{0}} (C : Coarser X) (f : SHom X Y)
(hf : ∀ {a b}, C.R a b → Y.eqv (f.fn a) (f.fn b)) (g : SHom (quot C) Y)
(hg : SetdCat.heq (SetdCat.comp (proj C) g) f) : SetdCat.heq g (lift C f hf) := hg
/-! ## Function extensionality in the setoid model -/
theorem setoid_funext {X Y : Setd.{0}} (f g : SHom X Y) (h : ∀ x, Y.eqv (f.fn x) (g.fn x)) :
(expS X Y).eqv f g := h
/-! ## Choice ⇒ excluded middle -/
def Surj {X Y : Setd.{0}} (f : SHom X Y) : Prop := ∀ y, ∃ x, Y.eqv (f.fn x) y
def SetoidAC : Prop :=
∀ (X Y : Setd.{0}) (f : SHom X Y), Surj f → ∃ s : SHom Y X, ∀ y, Y.eqv (f.fn (s.fn y)) y
def boolEq : Setd.{0} := ⟨Bool, Eq, fun _ => rfl, fun h => h.symm, fun h k => h.trans k⟩
def boolP (P : Prop) : Setd.{0} where
car := Bool
eqv a b := a = b ∨ P
refl _ := Or.inl rfl
symm h := h.elim (fun e => Or.inl e.symm) Or.inr
trans h k := h.elim (fun e => k.elim (fun e' => Or.inl (e.trans e')) Or.inr) Or.inr
/-- Diaconescu–Goodman–Myhill in the setoid model -/
theorem ac_lem (hAC : SetoidAC) (P : Prop) : P ∨ ¬ P :=
match hAC boolEq (boolP P) ⟨fun b => b, fun e => Or.inl e⟩ (fun y => ⟨y, Or.inl rfl⟩) with
| ⟨s, hs⟩ =>
match hs true, hs false with
| Or.inr p, _ => Or.inl p
| _, Or.inr p => Or.inl p
| Or.inl e1, Or.inl e2 =>
Or.inr fun p =>
have k : s.fn true = s.fn false := s.resp (Or.inr p)
Bool.noConfusion (e1.symm.trans (k.trans e2))
/-- type-theoretic choice (Σ form) holds outright -/
theorem sigma_choice {A B : Type} (R : A → B → Prop) (h : ∀ a, {b // R a b}) :
∃ f : A → B, ∀ a, R a (f a) := ⟨fun a => (h a).val, fun a => (h a).property⟩
end SetoidModel
end Found
#print axioms Found.SetoidModel.proj_eqv
#print axioms Found.SetoidModel.lift
#print axioms Found.SetoidModel.lift_comm
#print axioms Found.SetoidModel.lift_unique
#print axioms Found.SetoidModel.setoid_funext
#print axioms Found.SetoidModel.ac_lem
#print axioms Found.SetoidModel.sigma_choice
lean_all/found/Sheaf.lean
/-
T95. found/Sheaf — presheaf toposes and sheaf truth values.
* For a small E-category C, sieves on c (sets of arrows into c closed
under precomposition, respecting ≈) form a Heyting algebra.
* Ω is a setoid-valued presheaf (pullback of sieves), and it classifies
subpresheaves: for a stable predicate P on a presheaf Q there is a
natural χ_P : Q → Ω with P x ⟺ id ∈ χ_P(x), and any natural map with
this property agrees with χ_P (uniqueness). So Psh(C) is a topos in
the frame, with no size condition on C beyond being an E-category.
* Grothendieck topologies as nuclei on sieves (T108): the truth values of
the sheaf subtopos are the fixed sieves, again a Heyting algebra; the
dense (¬¬) topology is one example. Sheafification is OPEN (L95a).
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: sieves = Prop-valued predicates (impredicative Prop).
-/
import found.Forcing
import found.Cat
namespace Found
namespace Sh
variable {C : ECat.{0, 0}}
structure Sieve (C : ECat.{0, 0}) (c : C.Ob) where
S : {d : C.Ob} → C.Hom d c → Prop
resp : ∀ {d} {f g : C.Hom d c}, C.heq f g → S f → S g
stable : ∀ {d e} {f : C.Hom d c}, S f → ∀ (g : C.Hom e d), S (C.comp g f)
def SieveHA (C : ECat.{0, 0}) (c : C.Ob) : HA.{0} where
car := Sieve C c
le A B := ∀ d (f : C.Hom d c), A.S f → B.S f
le_refl _ _ _ h := h
le_trans h k d f x := k d f (h d f x)
top := ⟨fun _ => True, fun _ _ => trivial, fun _ _ => trivial⟩
bot := ⟨fun _ => False, fun _ h => h, fun h _ => h⟩
meet A B := ⟨fun f => A.S f ∧ B.S f, fun e h => ⟨A.resp e h.1, B.resp e h.2⟩,
fun h g => ⟨A.stable h.1 g, B.stable h.2 g⟩⟩
join A B := ⟨fun f => A.S f ∨ B.S f,
fun e h => h.elim (fun x => Or.inl (A.resp e x)) (fun y => Or.inr (B.resp e y)),
fun h g => h.elim (fun x => Or.inl (A.stable x g)) (fun y => Or.inr (B.stable y g))⟩
imp A B := ⟨fun {d} f => ∀ e (g : C.Hom e d), A.S (C.comp g f) → B.S (C.comp g f),
fun {_} {_ _} e h x g a => B.resp (C.rcong g e) (h x g (A.resp (C.rcong g (C.hsymm e)) a)),
fun {_ _} {f} h k x g a =>
B.resp (C.assoc g k f) (h x (C.comp g k) (A.resp (C.hsymm (C.assoc g k f)) a))⟩
le_top _ _ _ _ := trivial
bot_le _ _ _ h := h.elim
meet_l _ _ _ _ h := h.1
meet_r _ _ _ _ h := h.2
meet_univ h k d f x := ⟨h d f x, k d f x⟩
join_l _ _ _ _ h := Or.inl h
join_r _ _ _ _ h := Or.inr h
join_univ h k d f x := x.elim (h d f) (k d f)
imp_adj {A B R} := ⟨fun h _ f r e g a => h e (C.comp g f) ⟨R.stable r g, a⟩,
fun h d f x => B.resp (C.id_comp f)
(h d f x.1 d (C.id d) (A.resp (C.hsymm (C.id_comp f)) x.2))⟩
/-- Ω as a setoid-valued presheaf: sieves, acted on by pullback -/
def OmegaP (C : ECat.{0, 0}) : Psh.{0, 0, 0} C where
obj c := ⟨Sieve C c, fun A B => ∀ d (f : C.Hom d c), A.S f ↔ B.S f,
fun _ _ _ => Iff.rfl, fun h d f => (h d f).symm, fun h k d f => (h d f).trans (k d f)⟩
map f A := ⟨fun g => A.S (C.comp g f), fun e h => A.resp (C.lcong e f) h,
fun h g => A.resp (C.hsymm (C.assoc _ _ _)) (A.stable h g)⟩
map_eqv f := fun {_ _} h _ g => h _ (C.comp g f)
map_resp A e _ g := ⟨A.resp (C.rcong g e), A.resp (C.rcong g (C.hsymm e))⟩
map_id _ A _ g := ⟨A.resp (C.comp_id g), A.resp (C.hsymm (C.comp_id g))⟩
map_comp f g A _ h := ⟨A.resp (C.hsymm (C.assoc h f g)), A.resp (C.assoc h f g)⟩
/-! ## Ω classifies subpresheaves -/
section Classify
variable (Q : Psh.{0, 0, 0} C)
structure SubP where
P : {c : C.Ob} → (Q.obj c).car → Prop
resp : ∀ {c} {x y : (Q.obj c).car}, (Q.obj c).eqv x y → P x → P y
stable : ∀ {c d} (f : C.Hom d c) {x : (Q.obj c).car}, P x → P (Q.map f x)
variable {Q}
def chi (P : SubP Q) : PNat Q (OmegaP C) where
app _ x := ⟨fun f => P.P (Q.map f x),
fun e h => P.resp (Q.map_resp x e) h,
fun {_ _ f} h g => P.resp ((Q.obj _).symm (Q.map_comp g f x)) (P.stable g h)⟩
app_eqv _ := fun {_ _} h _ f => ⟨P.resp (Q.map_eqv f h), P.resp (Q.map_eqv f ((Q.obj _).symm h))⟩
nat f x _ g := ⟨P.resp ((Q.obj _).symm (Q.map_comp g f x)), P.resp (Q.map_comp g f x)⟩
/-- P x ⟺ the identity is in χ_P(x) -/
theorem chi_id (P : SubP Q) {c : C.Ob} (x : (Q.obj c).car) :
P.P x ↔ ((chi P).app c x).S (C.id c) :=
⟨fun h => P.resp ((Q.obj c).symm (Q.map_id c x)) h, fun h => P.resp (Q.map_id c x) h⟩
/-- uniqueness: a natural map to Ω classifying P is χ_P -/
theorem chi_unique (P : SubP Q) (χ' : PNat Q (OmegaP C))
(h : ∀ c (x : (Q.obj c).car), P.P x ↔ (χ'.app c x).S (C.id c)) :
∀ c (x : (Q.obj c).car) d (f : C.Hom d c), (χ'.app c x).S f ↔ ((chi P).app c x).S f :=
fun c x d f =>
have n := χ'.nat f x d (C.id d)
⟨fun k => (h d (Q.map f x)).mpr (n.mpr ((χ'.app c x).resp (C.hsymm (C.id_comp f)) k)),
fun k => (χ'.app c x).resp (C.id_comp f) (n.mp ((h d (Q.map f x)).mp k))⟩
end Classify
/-! ## Sheaf truth values -/
/-- a Grothendieck topology given as a nucleus on the sieves of each object -/
def Topology (C : ECat.{0, 0}) : Type := (c : C.Ob) → Forcing.Nucleus (SieveHA C c)
/-- the truth values of the sheaf subtopos at c: the closed sieves -/
def SheafOmega (J : Topology C) (c : C.Ob) : HA.{0} := (J c).fixHA
/-- the dense (double negation) topology -/
def dense (C : ECat.{0, 0}) : Topology C := fun c => Forcing.negneg (SieveHA C c)
/-- in the dense topology, sheaf truth values are Boolean -/
theorem dense_boolean (c : C.Ob) (A : (SheafOmega (dense C) c).car) :
(SieveHA C c).le ((SieveHA C c).neg ((SieveHA C c).neg A.val)) A.val :=
Forcing.negneg_boolean (SieveHA C c) A
end Sh
end Found
#print axioms Found.Sh.SieveHA
#print axioms Found.Sh.OmegaP
#print axioms Found.Sh.chi
#print axioms Found.Sh.chi_id
#print axioms Found.Sh.chi_unique
#print axioms Found.Sh.SheafOmega
#print axioms Found.Sh.dense
#print axioms Found.Sh.dense_boolean
lean_all/found/ShulmanCor.lean
/-
T136. found/ShulmanCor — Shulman (2019) as a corollary of the Orton–Pitts
core (T127, OP1–OP7) at the value E = a Grothendieck infinity-topos (T153)
over the classical point (excluded middle and choice as hypothesis
variables, CP.Classical').
A cubical type-theoretic model is the data the Orton–Pitts core takes (an
interval with cofibrations, gluing on disjunctions, strictification, a
universe closed under Glue codes, composition in every decoded type,
regular on the empty face). A presentation of an infinity-category Y by
such a model sends codes to objects of Y, every object being equivalent
to one in the image. The existence of a presentation for every
Grothendieck infinity-topos (Shulman's model-categorical theorem: type-
theoretic model topoi) is an internal theorem of the point (out of scope).
Inserting the value gives Shulman's conclusion:
* Y is presentable and its defining localization is a quasi-category
(at the classical point, T153);
* every object of Y is, up to equivalence, a type El a of the universe;
* the universe is univalent: every isomorphism e : El a ≅ El b gives a
path a ~> b in U along which transport is e (OP7).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.OP7
import found.IC51
namespace Found
namespace ShulmanCor
open OP IC
/-- a cubical type-theoretic model: the data of the Orton–Pitts core -/
structure TTModel (J : Interval) (C : Cof J) where
O : OrRec
O1 : OrRec1
S : Strict J C
V : Univ J C S
compEl : ∀ b : V.U, Comp J C (fun _ => V.El b)
regEl : ∀ b : V.U, Reg (compEl b)
universe w
/-- a presentation of an infinity-category Y by a model -/
structure Presents {J : Interval} {C : Cof J} (Y : SSet.{w}) (M : TTModel J C) where
ob : M.V.U → (V Y).car
ess : ∀ y : (V Y).car, ∃ a : M.V.U, ∃ f : Mor (X := Y) (ob a) y, EquivE f
variable {J : Interval} {C : Cof J}
/-- univalence of the universe of a model, with transport -/
theorem univalent (M : TTModel J C) {a b : M.V.U} (e : TIso (M.V.El a) (M.V.El b)) :
∃ p : Path J M.V.U a b, ∃ Fp : Comp J C (fun i => M.V.El (p.p i)),
∀ x, OP.castT (congrArg M.V.El p.tgt) (transp J C Fp (OP.castT (congrArg M.V.El p.src).symm x)) = e.to x :=
⟨uaPath M.O M.V e, compUaU M.O M.V e (M.compEl b),
fun x => uaU_beta M.O M.V e (M.compEl b) (M.regEl b) _ x _⟩
/-- Shulman's conclusion, from the Orton–Pitts core at a Grothendieck infinity-topos over the classical point -/
theorem shulman (Kw : ClW.{w}) (Kw' : ClW.{w + 1}) (Kc : CP.Classical')
{κ : SSet.{w + 1} → Prop} {Y : SSet.{w + 1}} (hY : GrothTopos.{w} κ Y)
(M : TTModel J C) (P : Presents Y M) :
Presentable.{w} κ Y ∧
(∃ (C' : SSet.{w + 1}) (Lc : Loc (PshS.{w} C')), κ C' ∧ LeftExact Lc.L ∧ CatEquiv Y (LocSub Lc) ∧
Quasi (LocSub Lc)) ∧
(∀ y : (V Y).car, ∃ a : M.V.U, ∃ f : Mor (X := Y) (P.ob a) y, EquivE f) ∧
(∀ (a b : M.V.U) (e : TIso (M.V.El a) (M.V.El b)),
∃ p : Path J M.V.U a b, ∃ Fp : Comp J C (fun i => M.V.El (p.p i)),
∀ x, OP.castT (congrArg M.V.El p.tgt) (transp J C Fp (OP.castT (congrArg M.V.El p.src).symm x)) = e.to x) :=
⟨topos_presentable hY,
match hY with
| ⟨C', hC, Lc, _, hl, he⟩ => ⟨C', Lc, hC, hl, he, locSub_psh_quasi Kw Kw' Kc Lc⟩,
P.ess,
fun _ _ e => univalent M e⟩
end ShulmanCor
end Found
#print axioms Found.ShulmanCor.univalent
#print axioms Found.ShulmanCor.shulman
lean_all/found/ShulmanPath.lean
/-
T136. found/ShulmanPath — one arrow of the map, as a composite of proved
stages (each stage is an existing point; only the last step is cited):
ZFC + universes (T104: U closed under pairing, union, power)
→ classical logic via double negation (T66: Glivenko)
→ model categories (T133: every E-category, e.g. setoids, carries the
trivial model structure; Ho = C on objects, T135)
→ HoTT model with an interval (T127/OrtonPitts: paths over an interval
value, e.g. the two-point interval)
→ Shulman 2019 (every ∞-topos models HoTT with univalent universes): cited.
The theorem below packages the four proved stages into one statement.
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: universe hierarchy, impredicative Prop (the T104 stage).
-/
import found.Grothendieck
import found.DNTrans
import found.Homotopy
import found.OrtonPitts
namespace Found
namespace Shulman
open WF
theorem path :
-- stage 1: universe closure in V
(∀ x y : V.{1}, Mem x Groth.U → Mem y Groth.U → Mem (IZF.pair x y) Groth.U) ∧
-- stage 2: classical provability = intuitionistic provability of ¬¬
(∀ φ : Prp.Form, Prp.CD (fun _ => False) φ ↔ Prp.PD true (fun _ => False) (Prp.N φ)) ∧
-- stage 3: model structure on setoids, weak equivalences = isomorphisms
(∃ M : Model.ModelStr SetdCat.{0}, ∀ {a b : SetdCat.{0}.Ob} (f : SetdCat.Hom a b), M.W f ↔ Model.IsIso f) ∧
-- stage 4: interval paths exist and are reflexive (HoTT side, an interval value)
(∀ (A : Type) (a : A), (OP.refl' OP.two a).p OP.two.i0 = a) :=
⟨Groth.U_pair, Prp.glivenko0, ⟨Model.trivialModel _, fun _ => Iff.rfl⟩, fun _ _ => rfl⟩
end Shulman
end Found
#print axioms Found.Shulman.path
lean_all/found/Simplicial.lean
/-
T134. found/Simplicial — simplicial sets as a point: the simplex category
Δ is a value of the category parameter, simplicial sets are setoid
presheaves on Δ (T61's Psh), representables Δ[n] = yo Δ n.
* Δ: objects n ↦ [n] = {0,…,n}; maps = monotone, bounded functions,
compared pointwise on [n].
* The nerve of a preorder: n-simplices = chains c₀ ≤ … ≤ cₙ.
* Inner horn Λ²₁ fills in every nerve (composition = transitivity): the
quasi-category condition in dimension 2. Kan complexes and higher horns
are the known continuation (cited).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Cat
namespace Found
namespace Simp
structure DHom (n m : Nat) where
f : Nat → Nat
mono : ∀ i, i < n → f i ≤ f (i + 1)
bound : ∀ i, i ≤ n → f i ≤ m
def Delta : ECat.{0, 0} where
Ob := Nat
Hom := DHom
heq {n _} g h := ∀ i, i ≤ n → g.f i = h.f i
hrefl _ _ _ := rfl
hsymm h i hi := (h i hi).symm
htrans h k i hi := (h i hi).trans (k i hi)
id n := ⟨fun i => i, fun _ _ => Nat.le_succ _, fun _ h => h⟩
comp g h := ⟨fun i => h.f (g.f i),
fun i hi => mono_of_succ h (g.mono i hi) (g.bound (i + 1) hi),
fun i hi => h.bound _ (g.bound i hi)⟩
comp_resp {_ _ _ g g' h h'} e e' i hi := by
show h.f (g.f i) = h'.f (g'.f i)
rw [e i hi]
exact e' _ (g'.bound i hi)
id_comp _ _ _ := rfl
comp_id _ _ _ := rfl
assoc _ _ _ _ _ := rfl
where
mono_of_succ {n m : Nat} (h : DHom n m) {a b : Nat} (hab : a ≤ b) (hb : b ≤ n) : h.f a ≤ h.f b := by
induction hab with
| refl => exact Nat.le_refl _
| step hle ih =>
exact Nat.le_trans (ih (Nat.le_trans (Nat.le_succ _) hb)) (h.mono _ (Nat.lt_of_succ_le hb))
/-! ## the nerve of a preorder -/
structure Preorder' where
P : Type
le : P → P → Prop
refl : ∀ a, le a a
trans : ∀ {a b c}, le a b → le b c → le a c
structure Chain (Q : Preorder') (n : Nat) where
c : Nat → Q.P
mono : ∀ i, i < n → Q.le (c i) (c (i + 1))
theorem chain_le {Q : Preorder'} {n : Nat} (x : Chain Q n) {a b : Nat} (hab : a ≤ b) (hb : b ≤ n) :
Q.le (x.c a) (x.c b) := by
induction hab with
| refl => exact Q.refl _
| step hle ih => exact Q.trans (ih (Nat.le_trans (Nat.le_succ _) hb)) (x.mono _ (Nat.lt_of_succ_le hb))
def nerve (Q : Preorder') : Psh.{0, 0, 0} Delta where
obj := fun (n : Nat) => ⟨Chain Q n, fun x y => ∀ i : Nat, i ≤ n → x.c i = y.c i, fun _ _ _ => rfl,
fun h i hi => (h i hi).symm, fun h k i hi => (h i hi).trans (k i hi)⟩
map {n m} g x := ⟨fun i => x.c (g.f i), fun i hi =>
chain_le x (g.mono i hi) (g.bound (i + 1) hi)⟩
map_eqv g := fun {_ _} h i hi => h _ (g.bound i hi)
map_resp {n m g g'} x e i hi := by
show x.c (g.f i) = x.c (g'.f i)
rw [e i hi]
map_id _ _ _ _ := rfl
map_comp _ _ _ _ _ := rfl
/-! ## inner horn Λ²₁ -/
theorem lt_two {i : Nat} (h : i < 2) : i = 0 ∨ i = 1 := by
cases i with
| zero => exact Or.inl rfl
| succ k => cases k with
| zero => exact Or.inr rfl
| succ k => exact absurd (Nat.lt_of_succ_lt_succ (Nat.lt_of_succ_lt_succ h)) (Nat.not_lt_zero k)
/-- given 1-simplices a = (a₀ ≤ a₁), b = (b₀ ≤ b₁) with a₁ = b₀, a 2-simplex filling the horn -/
def fill {Q : Preorder'} (a b : Chain Q 1) (e : a.c 1 = b.c 0) : Chain Q 2 :=
⟨fun i => match i with
| 0 => a.c 0
| 1 => a.c 1
| _ + 2 => b.c 1,
fun i hi => (lt_two hi).elim (fun h0 => by
cases h0
exact a.mono 0 (Nat.lt_succ_self 0))
(fun h1 => by
cases h1
show Q.le (a.c 1) (b.c 1)
rw [e]
exact b.mono 0 (Nat.lt_succ_self 0))⟩
theorem fill_d2 {Q : Preorder'} (a b : Chain Q 1) (e : a.c 1 = b.c 0) :
(fill a b e).c 0 = a.c 0 ∧ (fill a b e).c 1 = a.c 1 := ⟨rfl, rfl⟩
theorem fill_d0 {Q : Preorder'} (a b : Chain Q 1) (e : a.c 1 = b.c 0) :
(fill a b e).c 1 = b.c 0 ∧ (fill a b e).c 2 = b.c 1 := ⟨e, rfl⟩
end Simp
end Found
#print axioms Found.Simp.Delta
#print axioms Found.Simp.chain_le
#print axioms Found.Simp.nerve
#print axioms Found.Simp.fill
#print axioms Found.Simp.fill_d2
#print axioms Found.Simp.fill_d0
lean_all/found/Stone.lean
/-
T191 line. found/Stone — Stone's representation theorem, in the classical
point: every Heyting algebra H maps into the subsets of its prime filters,
a ↦ {P | a ∈ P}, preserving ⊤, ⊥, ∧, ∨, reflecting ≤ (hence injective);
for a Boolean algebra the map also sends ¬a to the complement. The prime
filters come from found/PrimeFilter.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.PrimeFilter
namespace Found
namespace Stone
open CP PF
variable (K : Classical') (H : HA.{0})
structure PFilt (P : H.car → Prop) : Prop where
up : ∀ a b, H.le a b → P a → P b
meet : ∀ a b, P a → P b → P (H.meet a b)
top : P H.top
nobot : ¬ P H.bot
prime : ∀ a b, P (H.join a b) → P a ∨ P b
/-- the representation: the set of prime filters containing a -/
def rep (a : H.car) : {P : H.car → Prop // PFilt H P} → Prop := fun P => P.val a
theorem rep_top (P : {P : H.car → Prop // PFilt H P}) : rep H H.top P := P.property.top
theorem rep_bot (P : {P : H.car → Prop // PFilt H P}) : ¬ rep H H.bot P := P.property.nobot
theorem rep_meet (a b : H.car) (P : {P : H.car → Prop // PFilt H P}) :
rep H (H.meet a b) P ↔ rep H a P ∧ rep H b P :=
⟨fun h => ⟨P.property.up _ _ (H.meet_l a b) h, P.property.up _ _ (H.meet_r a b) h⟩,
fun ⟨x, y⟩ => P.property.meet _ _ x y⟩
theorem rep_join (a b : H.car) (P : {P : H.car → Prop // PFilt H P}) :
rep H (H.join a b) P ↔ rep H a P ∨ rep H b P :=
⟨P.property.prime a b, fun h => h.elim (fun x => P.property.up _ _ (H.join_l a b) x)
(fun y => P.property.up _ _ (H.join_r a b) y)⟩
include K in
/-- the representation reflects the order: a ≰ b is witnessed by a prime filter -/
theorem rep_reflects (a b : H.car) (h : ∀ P, rep H a P → rep H b P) : H.le a b := by
refine dne K _ (fun hn => ?_)
have hB : ¬ Gen H (fun x => x = a) b := fun ⟨l, hl, hle⟩ => hn (H.le_trans (ones l hl) hle)
let P : H.car → Prop := F K H (fun x => x = a) b
have hP : PFilt H P := ⟨fun _ _ hle h => gen_up H h hle, fun _ _ h1 h2 => gen_meet H h1 h2, gen_top H _,
fun hb => F_avoids K H _ b hB (gen_up H hb (H.bot_le b)), fun x y hj => F_prime K H _ b hB x y hj⟩
exact F_avoids K H _ b hB (h ⟨P, hP⟩ (gen_of H (Or.inl rfl)))
where
ones : (l : List H.car) → (∀ x, x ∈ l → x = a) → H.le a (mL H l)
| [], _ => H.le_top a
| x :: l, h => H.meet_univ (by rw [h x (.head _)]; exact H.le_refl _) (ones l (fun y m => h y (.tail _ m)))
include K in
/-- injectivity up to the order: equal representations give equal-up-to-≤ elements -/
theorem rep_inj (a b : H.car) (h : ∀ P, rep H a P ↔ rep H b P) : H.le a b ∧ H.le b a :=
⟨rep_reflects K H a b (fun P => (h P).mp), rep_reflects K H b a (fun P => (h P).mpr)⟩
/-- for a Boolean algebra, ¬a is represented by the complement -/
theorem rep_neg (hbool : ∀ a, H.le H.top (H.join a (HA.neg H a))) (a : H.car)
(P : {P : H.car → Prop // PFilt H P}) : rep H (HA.neg H a) P ↔ ¬ rep H a P :=
⟨fun hn ha => P.property.nobot (P.property.up _ _ (HA.meet_neg H a) (P.property.meet _ _ ha hn)),
fun hna => (P.property.prime a (HA.neg H a) (P.property.up _ _ (hbool a) P.property.top)).elim
(fun ha => (hna ha).elim) id⟩
end Stone
end Found
#print axioms Found.Stone.rep_reflects
#print axioms Found.Stone.rep_inj
#print axioms Found.Stone.rep_neg
lean_all/found/StoneDual.lean
/-
T191 line. found/StoneDual — Stone duality, algebra side, in the classical
point. For a Boolean algebra B, Spec B = prime filters with the basic
opens rep a (found/Stone).
* compactness: every cover of Spec B by basic opens has a finite subcover;
* Hausdorff: distinct prime filters are separated by some rep a / rep ¬a;
* B ≅ Clopen(Spec B): every clopen set is rep a for some a (and rep is
injective up to ≤, Stone.rep_inj);
* space side: a Stone space X, given by a Boolean algebra of clopens
val : B → (X → Prop) (a lattice map that reflects ⊥), separating points
and compact in the finite-intersection form, is homeomorphic on points
to Spec B: x ↦ {a | x ∈ val a} is a prime filter, injective up to
pointwise equality, and every prime filter arises;
* functor: a lattice map f : B → B' gives Spec B' → Spec B (preimage),
continuous: the preimage of rep a is rep (f a).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Stone
namespace Found
namespace StoneD
open CP PF Stone
variable (K : Classical') (H : HA.{0}) (hbool : ∀ a, H.le H.top (H.join a (HA.neg H a)))
abbrev Spec : Type := {P : H.car → Prop // PFilt H P}
theorem mL_mem (P : Spec H) : (l : List H.car) → (∀ x, x ∈ l → P.val x) → P.val (mL H l)
| [], _ => P.property.top
| x :: l, h => P.property.meet _ _ (h x (.head _)) (mL_mem P l (fun y m => h y (.tail _ m)))
theorem mL_mem' (P : Spec H) (l : List H.car) (h : ∀ x, x ∈ l → P.val x) : P.val (mL H l) :=
mL_mem H P l h
/-- choose, for each element of a list of negations of covers, the cover -/
theorem pick (C : H.car → Prop) : (l : List H.car) → (∀ x, x ∈ l → ∃ c, C c ∧ x = HA.neg H c) →
∃ cs : List H.car, (∀ c, c ∈ cs → C c) ∧ ∀ x, x ∈ l → ∃ c, c ∈ cs ∧ x = HA.neg H c
| [], _ => ⟨[], ⟨fun _ m => (by cases m), fun _ m => (by cases m)⟩⟩
| x :: l, h => match h x (.head _), pick C l (fun y m => h y (.tail _ m)) with
| ⟨c, hc, ex⟩, ⟨cs, hcs, hl⟩ => ⟨c :: cs, fun d m => by
cases m with
| head => exact hc
| tail _ m => exact hcs d m,
fun y m => by
cases m with
| head => exact ⟨c, .head _, ex⟩
| tail _ m => match hl y m with
| ⟨d, hd, ed⟩ => exact ⟨d, .tail _ hd, ed⟩⟩
include K hbool in
/-- compactness of Spec B -/
theorem compact (C : H.car → Prop) (cover : ∀ P : Spec H, ∃ c, C c ∧ rep H c P) :
∃ cs : List H.car, (∀ c, c ∈ cs → C c) ∧ ∀ P : Spec H, ∃ c, c ∈ cs ∧ rep H c P := by
let N : H.car → Prop := fun x => ∃ c, C c ∧ x = HA.neg H c
have hG : Gen H N H.bot := dne K _ (fun hB => by
let P : H.car → Prop := F K H N H.bot
have hP : PFilt H P := ⟨fun _ _ hle h => gen_up H h hle, fun _ _ h1 h2 => gen_meet H h1 h2, gen_top H _,
fun hb => F_avoids K H _ _ hB hb, fun x y hj => F_prime K H _ _ hB x y hj⟩
match cover ⟨P, hP⟩ with
| ⟨c, hc, hr⟩ =>
have hn : P (HA.neg H c) := gen_of H (Or.inl ⟨c, hc, rfl⟩)
exact F_avoids K H _ _ hB (gen_up H (gen_meet H hr hn) (HA.meet_neg H c)))
match hG with
| ⟨l, hl, hle⟩ => match pick H C l hl with
| ⟨cs, hcs, hx⟩ => exact ⟨cs, hcs, fun P => dne K _ (fun hn => by
have all : ∀ x, x ∈ l → P.val x := fun x m => match hx x m with
| ⟨c, mc, ex⟩ => ex ▸ (rep_neg H hbool c P).mpr (fun hr => hn ⟨c, mc, hr⟩)
exact P.property.nobot (P.property.up _ _ hle (mL_mem H P l all)))⟩
include K hbool in
/-- Hausdorff: distinct prime filters are separated by a basic clopen -/
theorem separated (P Q : Spec H) (h : ¬ ∀ a, P.val a ↔ Q.val a) :
∃ a, rep H a P ∧ rep H (HA.neg H a) Q := by
refine dne K _ (fun hn => h (fun a => ⟨fun hp => dne K _ (fun hq => hn ⟨a, hp, (rep_neg H hbool a Q).mpr hq⟩),
fun hq => dne K _ (fun hp => hn ⟨HA.neg H a, (rep_neg H hbool a P).mpr hp, ?_⟩)⟩))
exact (rep_neg H hbool _ Q).mpr (fun hnq => (rep_neg H hbool a Q).mp hnq hq)
def Open (U : Spec H → Prop) : Prop := ∀ P, U P → ∃ c, rep H c P ∧ ∀ Q, rep H c Q → U Q
/-- the join of the members of a list on the U side -/
def jU (U : Spec H → Prop) : List H.car → H.car
| [] => H.bot
| c :: cs => match CP.dec K (∀ Q, rep H c Q → U Q) with
| true => H.join c (jU U cs)
| false => jU U cs
theorem jU_sound (U : Spec H → Prop) (P : Spec H) : (cs : List H.car) → rep H (jU K H U cs) P → U P
| [], h => (rep_bot H P h).elim
| c :: cs, h => by
unfold jU at h
cases hd : CP.dec K (∀ Q, rep H c Q → U Q) with
| true =>
rw [hd] at h
exact ((rep_join H _ _ P).mp h).elim (fun hc => (CP.dec_spec K _).mp hd P hc) (jU_sound U P cs)
| false =>
rw [hd] at h
exact jU_sound U P cs h
theorem jU_complete (U : Spec H → Prop) (P : Spec H) (hP : U P) : (cs : List H.car) →
(∀ c, c ∈ cs → (∀ Q, rep H c Q → U Q) ∨ (∀ Q, rep H c Q → ¬ U Q)) →
(∃ c, c ∈ cs ∧ rep H c P) → rep H (jU K H U cs) P
| [], _, ⟨_, m, _⟩ => nomatch m
| c :: cs, hc, ⟨d, md, hd⟩ => by
unfold jU
cases hdc : CP.dec K (∀ Q, rep H c Q → U Q) with
| true =>
show rep H (H.join c (jU K H U cs)) P
cases md with
| head => exact (rep_join H _ _ P).mpr (Or.inl hd)
| tail _ m => exact (rep_join H _ _ P).mpr (Or.inr (jU_complete U P hP cs (fun e me => hc e (.tail _ me)) ⟨d, m, hd⟩))
| false =>
show rep H (jU K H U cs) P
cases md with
| head =>
exact ((hc c (.head _)).elim (fun hu => absurd ((CP.dec_spec K _).mpr hu) (fun e => Bool.noConfusion (e.symm.trans hdc)))
(fun hnu => (hnu P hd hP).elim))
| tail _ m => exact jU_complete U P hP cs (fun e me => hc e (.tail _ me)) ⟨d, m, hd⟩
include K hbool in
/-- every clopen subset of Spec B is a basic clopen rep a -/
theorem clopen_rep (U : Spec H → Prop) (ho : Open H U) (hc : Open H (fun P => ¬ U P)) :
∃ a, ∀ P, rep H a P ↔ U P := by
let C : H.car → Prop := fun c => (∀ Q, rep H c Q → U Q) ∨ (∀ Q, rep H c Q → ¬ U Q)
have cover : ∀ P : Spec H, ∃ c, C c ∧ rep H c P := fun P => (K.lem (U P)).elim
(fun hu => match ho P hu with | ⟨c, hr, hs⟩ => ⟨c, Or.inl hs, hr⟩)
(fun hu => match hc P hu with | ⟨c, hr, hs⟩ => ⟨c, Or.inr hs, hr⟩)
match compact K H hbool C cover with
| ⟨cs, hcs, hall⟩ => exact ⟨jU K H U cs, fun P => ⟨jU_sound K H U P cs,
fun hP => jU_complete K H U P hP cs hcs (hall P)⟩⟩
/-! ## space side -/
structure StoneSp (X : Type) where
val : H.car → X → Prop
v_top : ∀ x, val H.top x
v_bot : ∀ x, ¬ val H.bot x
v_meet : ∀ a b x, val (H.meet a b) x ↔ val a x ∧ val b x
v_join : ∀ a b x, val (H.join a b) x ↔ val a x ∨ val b x
v_mono : ∀ a b x, H.le a b → val a x → val b x
v_reflect : ∀ a, (∀ x, ¬ val a x) → H.le a H.bot
separate : ∀ x y, (∀ a, val a x ↔ val a y) → x = y
compact : ∀ P : H.car → Prop, (∀ l : List H.car, (∀ a, a ∈ l → P a) → ∃ x, val (mL H l) x) →
∃ x, ∀ a, P a → val a x
variable {H}
def pt {X : Type} (S : StoneSp H X) (x : X) : Spec H :=
⟨fun a => S.val a x, ⟨fun a b h hx => S.v_mono a b x h hx, fun a b ha hb => (S.v_meet a b x).mpr ⟨ha, hb⟩,
S.v_top x, S.v_bot x, fun a b h => (S.v_join a b x).mp h⟩⟩
theorem pt_inj {X : Type} (S : StoneSp H X) (x y : X) (h : ∀ a, (pt S x).val a ↔ (pt S y).val a) : x = y :=
S.separate x y h
theorem v_mL {X : Type} (S : StoneSp H X) (x : X) : (l : List H.car) → (∀ a, a ∈ l → S.val a x) → S.val (mL H l) x
| [], _ => S.v_top x
| a :: l, h => (S.v_meet _ _ x).mpr ⟨h a (.head _), v_mL S x l (fun b m => h b (.tail _ m))⟩
include K hbool in
/-- every prime filter is the filter of some point -/
theorem pt_surj {X : Type} (S : StoneSp H X) (P : Spec H) : ∃ x, ∀ a, (pt S x).val a ↔ P.val a := by
have fip : ∀ l : List H.car, (∀ a, a ∈ l → P.val a) → ∃ x, S.val (mL H l) x := fun l hl =>
dne K _ (fun hn => P.property.nobot (P.property.up _ _
(S.v_reflect _ (fun x hx => hn ⟨x, hx⟩)) (mL_mem H P l hl)))
match S.compact P.val fip with
| ⟨x, hx⟩ => exact ⟨x, fun a => ⟨fun hv => dne K _ (fun hna => by
have hneg : P.val (HA.neg H a) := (rep_neg H hbool a P).mpr hna
have := (S.v_meet _ _ x).mpr ⟨hv, hx _ hneg⟩
exact S.v_bot x (S.v_mono _ _ x (HA.meet_neg H a) this)), hx a⟩⟩
/-! ## morphisms -/
structure LatHom (H' : HA.{0}) where
f : H.car → H'.car
f_mono : ∀ a b, H.le a b → H'.le (f a) (f b)
f_top : H'.le H'.top (f H.top)
f_bot : H'.le (f H.bot) H'.bot
f_meet : ∀ a b, H'.le (H'.meet (f a) (f b)) (f (H.meet a b))
f_join : ∀ a b, H'.le (f (H.join a b)) (H'.join (f a) (f b))
def spec_map {H' : HA.{0}} (φ : LatHom (H := H) H') (P : Spec H') : Spec H :=
⟨fun a => P.val (φ.f a), ⟨fun a b h hp => P.property.up _ _ (φ.f_mono a b h) hp,
fun a b ha hb => P.property.up _ _ (φ.f_meet a b) (P.property.meet _ _ ha hb),
P.property.up _ _ φ.f_top P.property.top,
fun hb => P.property.nobot (P.property.up _ _ φ.f_bot hb),
fun a b h => P.property.prime _ _ (P.property.up _ _ (φ.f_join a b) h)⟩⟩
theorem spec_map_cont {H' : HA.{0}} (φ : LatHom (H := H) H') (a : H.car) (P : Spec H') :
rep H a (spec_map φ P) ↔ rep H' (φ.f a) P := Iff.rfl
end StoneD
end Found
#print axioms Found.StoneD.compact
#print axioms Found.StoneD.separated
#print axioms Found.StoneD.jU_sound
#print axioms Found.StoneD.jU_complete
#print axioms Found.StoneD.clopen_rep
#print axioms Found.StoneD.pt_inj
#print axioms Found.StoneD.pt_surj
#print axioms Found.StoneD.spec_map
#print axioms Found.StoneD.spec_map_cont
lean_all/found/StrDiag1.lean
/-
T193, string diagrams, part 1. found/StrDiag1 — the combinatorial
Joyal–Street theorem, soundness half:
* a monoidal signature (generators with lists of input and output wires);
terms of the free strict monoidal category (identities, generators,
composition, tensor) with their typing and the equational theory ≈
(category laws, strict associativity and unit of ⊗, id ⊗ id = id,
interchange);
* string diagrams: lists of layers (wires on the left, one box, wires on
the right), typed by their wires; the interchange move swaps two
adjacent boxes lying side by side, and diagram equivalence is generated
by these moves (the combinatorial form of planar deformation);
* the diagram of a term; equal terms have equivalent diagrams.
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace SD
abbrev Ob := List Nat
theorem app_assoc : (a b c : Ob) → (a ++ b) ++ c = a ++ (b ++ c)
| [], _, _ => rfl
| x :: a, b, c => congrArg (List.cons x) (app_assoc a b c)
theorem eqL (C L d R : Ob) : C ++ ((L ++ d) ++ R) = ((C ++ L) ++ d) ++ R := by
rw [app_assoc (C ++ L) d R, app_assoc C L, app_assoc L d R]
theorem app_nil : (a : Ob) → a ++ [] = a
| [] => rfl
| x :: a => congrArg (List.cons x) (app_nil a)
structure Sig where
G : Type
dom : G → Ob
cod : G → Ob
variable {S : Sig}
inductive Tm (S : Sig) where
| id : Ob → Tm S
| gen : S.G → Tm S
| comp : Tm S → Tm S → Tm S
| tens : Tm S → Tm S → Tm S
inductive Ty : Tm S → Ob → Ob → Prop where
| id (A : Ob) : Ty (.id A) A A
| gen (g : S.G) : Ty (.gen g) (S.dom g) (S.cod g)
| comp {f g : Tm S} {A B C : Ob} : Ty f A B → Ty g B C → Ty (.comp f g) A C
| tens {f g : Tm S} {A B C D : Ob} : Ty f A B → Ty g C D → Ty (.tens f g) (A ++ C) (B ++ D)
/-- the equational theory of free strict monoidal categories -/
inductive Eqv : Tm S → Tm S → Prop where
| refl (t : Tm S) : Eqv t t
| symm {t u : Tm S} : Eqv t u → Eqv u t
| trans {t u v : Tm S} : Eqv t u → Eqv u v → Eqv t v
| compC {f f' g g' : Tm S} : Eqv f f' → Eqv g g' → Eqv (.comp f g) (.comp f' g')
| tensC {f f' g g' : Tm S} : Eqv f f' → Eqv g g' → Eqv (.tens f g) (.tens f' g')
| idL {f : Tm S} {A B : Ob} : Ty f A B → Eqv (.comp (.id A) f) f
| idR {f : Tm S} {A B : Ob} : Ty f A B → Eqv (.comp f (.id B)) f
| assoc (f g h : Tm S) : Eqv (.comp (.comp f g) h) (.comp f (.comp g h))
| tassoc (f g h : Tm S) : Eqv (.tens (.tens f g) h) (.tens f (.tens g h))
| tunitL (f : Tm S) : Eqv (.tens (.id []) f) f
| tunitR (f : Tm S) : Eqv (.tens f (.id [])) f
| tid (A B : Ob) : Eqv (.tens (.id A) (.id B)) (.id (A ++ B))
| inter {f f' g g' : Tm S} {A B C D E F : Ob} : Ty f A B → Ty f' B C → Ty g D E → Ty g' E F →
Eqv (.comp (.tens f g) (.tens f' g')) (.tens (.comp f f') (.comp g g'))
def dom : Tm S → Ob
| .id A => A
| .gen g => S.dom g
| .comp f _ => dom f
| .tens f g => dom f ++ dom g
def cod : Tm S → Ob
| .id A => A
| .gen g => S.cod g
| .comp _ g => cod g
| .tens f g => cod f ++ cod g
theorem ty_dc {t : Tm S} {A B : Ob} (h : Ty t A B) : dom t = A ∧ cod t = B := by
induction h with
| id => exact ⟨rfl, rfl⟩
| gen => exact ⟨rfl, rfl⟩
| comp _ _ ih1 ih2 => exact ⟨ih1.1, ih2.2⟩
| tens _ _ ih1 ih2 =>
show dom _ ++ dom _ = _ ∧ cod _ ++ cod _ = _
rw [ih1.1, ih1.2, ih2.1, ih2.2]
exact ⟨rfl, rfl⟩
theorem eqv_dc {t u : Tm S} (h : Eqv t u) : dom t = dom u ∧ cod t = cod u := by
induction h with
| refl => exact ⟨rfl, rfl⟩
| symm _ ih => exact ⟨ih.1.symm, ih.2.symm⟩
| trans _ _ ih1 ih2 => exact ⟨ih1.1.trans ih2.1, ih1.2.trans ih2.2⟩
| compC _ _ ih1 ih2 => exact ⟨ih1.1, ih2.2⟩
| tensC _ _ ih1 ih2 =>
show dom _ ++ dom _ = dom _ ++ dom _ ∧ cod _ ++ cod _ = cod _ ++ cod _
rw [ih1.1, ih1.2, ih2.1, ih2.2]
exact ⟨rfl, rfl⟩
| idL h => exact ⟨(ty_dc h).1.symm, rfl⟩
| idR h => exact ⟨rfl, (ty_dc h).2.symm⟩
| assoc => exact ⟨rfl, rfl⟩
| tassoc f g h => exact ⟨app_assoc _ _ _, app_assoc _ _ _⟩
| tunitL => exact ⟨rfl, rfl⟩
| tunitR f => exact ⟨app_nil _, app_nil _⟩
| tid => exact ⟨rfl, rfl⟩
| inter => exact ⟨rfl, rfl⟩
/-! ## string diagrams -/
/-- a layer: wires L, one box g, wires R -/
structure Ly (S : Sig) where
L : Ob
g : S.G
R : Ob
/-- typing of diagrams by their wires -/
inductive DTy : List (Ly S) → Ob → Ob → Prop where
| nil (A : Ob) : DTy [] A A
| cons {L R : Ob} {g : S.G} {D : List (Ly S)} {A B : Ob} :
A = L ++ S.dom g ++ R → DTy D (L ++ S.cod g ++ R) B → DTy (⟨L, g, R⟩ :: D) A B
/-- the interchange move: two boxes side by side (left box first) swap -/
inductive IStep : List (Ly S) → List (Ly S) → Prop where
| here {X M Y R1 L2 L2' R1' : Ob} {g1 g2 : S.G} {Q : List (Ly S)}
(e1 : R1 = M ++ S.dom g2 ++ Y) (e2 : L2 = X ++ S.cod g1 ++ M)
(e3 : L2' = X ++ S.dom g1 ++ M) (e4 : R1' = M ++ S.cod g2 ++ Y) :
IStep (⟨X, g1, R1⟩ :: ⟨L2, g2, Y⟩ :: Q) (⟨L2', g2, Y⟩ :: ⟨X, g1, R1'⟩ :: Q)
| cons (l : Ly S) {D D' : List (Ly S)} : IStep D D' → IStep (l :: D) (l :: D')
/-- diagram equivalence: generated by interchange moves -/
inductive DEq : List (Ly S) → List (Ly S) → Prop where
| refl (D : List (Ly S)) : DEq D D
| step {D D' : List (Ly S)} : IStep D D' → DEq D D'
| symm {D D' : List (Ly S)} : DEq D D' → DEq D' D
| trans {D D' D'' : List (Ly S)} : DEq D D' → DEq D' D'' → DEq D D''
theorem deq_of_eq {D D' : List (Ly S)} (e : D = D') : DEq D D' := e ▸ .refl D
def wR (C : Ob) : List (Ly S) → List (Ly S)
| [] => []
| l :: D => ⟨l.L, l.g, l.R ++ C⟩ :: wR C D
def wL (B : Ob) : List (Ly S) → List (Ly S)
| [] => []
| l :: D => ⟨B ++ l.L, l.g, l.R⟩ :: wL B D
/-- the diagram of a term -/
def diag : Tm S → List (Ly S)
| .id _ => []
| .gen g => [⟨[], g, []⟩]
| .comp f g => diag f ++ diag g
| .tens f g => wR (dom g) (diag f) ++ wL (cod f) (diag g)
/-! ## list facts -/
theorem lapp_assoc : (a b c : List (Ly S)) → (a ++ b) ++ c = a ++ (b ++ c)
| [], _, _ => rfl
| x :: a, b, c => congrArg (List.cons x) (lapp_assoc a b c)
theorem lapp_nil : (a : List (Ly S)) → a ++ [] = a
| [] => rfl
| x :: a => congrArg (List.cons x) (lapp_nil a)
theorem wR_app (C : Ob) : (D E : List (Ly S)) → wR C (D ++ E) = wR C D ++ wR C E
| [], _ => rfl
| _ :: D, E => congrArg (List.cons _) (wR_app C D E)
theorem wL_app (B : Ob) : (D E : List (Ly S)) → wL B (D ++ E) = wL B D ++ wL B E
| [], _ => rfl
| _ :: D, E => congrArg (List.cons _) (wL_app B D E)
theorem wR_wR (C C' : Ob) : (D : List (Ly S)) → wR C (wR C' D) = wR (C' ++ C) D
| [] => rfl
| l :: D => by
show (⟨l.L, l.g, (l.R ++ C') ++ C⟩ : Ly S) :: wR C (wR C' D) = ⟨l.L, l.g, l.R ++ (C' ++ C)⟩ :: wR (C' ++ C) D
rw [app_assoc, wR_wR C C' D]
theorem wL_wL (B B' : Ob) : (D : List (Ly S)) → wL B (wL B' D) = wL (B ++ B') D
| [] => rfl
| l :: D => by
show (⟨B ++ (B' ++ l.L), l.g, l.R⟩ : Ly S) :: wL B (wL B' D) = ⟨(B ++ B') ++ l.L, l.g, l.R⟩ :: wL (B ++ B') D
rw [app_assoc, wL_wL B B' D]
theorem wR_wL (B C : Ob) : (D : List (Ly S)) → wR C (wL B D) = wL B (wR C D)
| [] => rfl
| _ :: D => congrArg (List.cons _) (wR_wL B C D)
theorem wR_nil : (D : List (Ly S)) → wR [] D = D
| [] => rfl
| l :: D => by
show (⟨l.L, l.g, l.R ++ []⟩ : Ly S) :: wR [] D = l :: D
rw [app_nil, wR_nil D]
theorem wL_nil : (D : List (Ly S)) → wL [] D = D
| [] => rfl
| l :: D => congrArg (List.cons l) (wL_nil D)
/-! ## congruences of diagram equivalence -/
theorem istep_appR (E : List (Ly S)) {D D' : List (Ly S)} (h : IStep D D') : IStep (D ++ E) (D' ++ E) := by
induction h with
| here e1 e2 e3 e4 => exact .here e1 e2 e3 e4
| cons l _ ih => exact .cons l ih
theorem deq_appR (E : List (Ly S)) {D D' : List (Ly S)} (h : DEq D D') : DEq (D ++ E) (D' ++ E) := by
induction h with
| refl => exact .refl _
| step s => exact .step (istep_appR E s)
| symm _ ih => exact .symm ih
| trans _ _ ih1 ih2 => exact .trans ih1 ih2
theorem deq_cons (l : Ly S) {D D' : List (Ly S)} (h : DEq D D') : DEq (l :: D) (l :: D') := by
induction h with
| refl => exact .refl _
| step s => exact .step (.cons l s)
| symm _ ih => exact .symm ih
| trans _ _ ih1 ih2 => exact .trans ih1 ih2
theorem deq_appL : (P : List (Ly S)) → {D D' : List (Ly S)} → DEq D D' → DEq (P ++ D) (P ++ D')
| [], _, _, h => h
| l :: P, _, _, h => deq_cons l (deq_appL P h)
theorem deq_app {D D' E E' : List (Ly S)} (h1 : DEq D D') (h2 : DEq E E') : DEq (D ++ E) (D' ++ E') :=
.trans (deq_appR E h1) (deq_appL D' h2)
theorem istep_wR (C : Ob) {D D' : List (Ly S)} (h : IStep D D') : IStep (wR C D) (wR C D') := by
induction h with
| here e1 e2 e3 e4 =>
exact .here (by rw [e1]; exact app_assoc _ _ _) e2 e3 (by rw [e4]; exact app_assoc _ _ _)
| cons l _ ih => exact .cons _ ih
theorem istep_wL (B : Ob) {D D' : List (Ly S)} (h : IStep D D') : IStep (wL B D) (wL B D') := by
induction h with
| here e1 e2 e3 e4 =>
exact .here (X := B ++ _) e1 (by rw [e2]; exact eqL _ _ _ _) (by rw [e3]; exact eqL _ _ _ _) e4
| cons l _ ih => exact .cons _ ih
theorem deq_wR (C : Ob) {D D' : List (Ly S)} (h : DEq D D') : DEq (wR C D) (wR C D') := by
induction h with
| refl => exact .refl _
| step s => exact .step (istep_wR C s)
| symm _ ih => exact .symm ih
| trans _ _ ih1 ih2 => exact .trans ih1 ih2
theorem deq_wL (B : Ob) {D D' : List (Ly S)} (h : DEq D D') : DEq (wL B D) (wL B D') := by
induction h with
| refl => exact .refl _
| step s => exact .step (istep_wL B s)
| symm _ ih => exact .symm ih
| trans _ _ ih1 ih2 => exact .trans ih1 ih2
/-! ## blocks side by side commute -/
/-- one left box moves before a block of right boxes -/
theorem one_left {X R' : Ob} (k : S.G) : {Dg : List (Ly S)} → {D E : Ob} → DTy Dg D E →
DEq (wL (X ++ S.dom k ++ R') Dg ++ [⟨X, k, R' ++ E⟩]) ([⟨X, k, R' ++ D⟩] ++ wL (X ++ S.cod k ++ R') Dg)
| _, _, _, .nil _ => .refl _
| _, _, _, @DTy.cons _ L R h Dg' D E eD hrest =>
have ih := one_left k hrest
.trans (deq_cons ⟨(X ++ S.dom k ++ R') ++ L, h, R⟩ ih)
(.symm (.step (.here (X := X) (M := R' ++ L) (Y := R)
(by rw [eD]; exact eqL R' L _ R)
(app_assoc (X ++ S.cod k) R' L)
(app_assoc (X ++ S.dom k) R' L)
(eqL R' L _ R))))
theorem block {Dg : List (Ly S)} {D E : Ob} (hg : DTy Dg D E) : {Dp : List (Ly S)} → {B C : Ob} → DTy Dp B C →
DEq (wL B Dg ++ wR E Dp) (wR D Dp ++ wL C Dg)
| _, _, _, .nil B => deq_of_eq (lapp_nil _)
| _, _, _, @DTy.cons _ X R' k Dp' B C eB hrest => by
subst eB
have ih := block hg hrest
show DEq (wL (X ++ S.dom k ++ R') Dg ++ (⟨X, k, R' ++ E⟩ :: wR E Dp'))
(⟨X, k, R' ++ D⟩ :: (wR D Dp' ++ wL C Dg))
have s1 : wL (X ++ S.dom k ++ R') Dg ++ (⟨X, k, R' ++ E⟩ :: wR E Dp') =
(wL (X ++ S.dom k ++ R') Dg ++ [⟨X, k, R' ++ E⟩]) ++ wR E Dp' :=
(lapp_assoc (wL (X ++ S.dom k ++ R') Dg) [⟨X, k, R' ++ E⟩] (wR E Dp')).symm
rw [s1]
exact .trans (deq_appR _ (one_left k hg)) (deq_cons _ ih)
/-! ## soundness: equal terms have equivalent diagrams -/
theorem diag_ty {t : Tm S} {A B : Ob} (h : Ty t A B) : DTy (diag t) A B := by
induction h with
| id A => exact .nil A
| gen g => exact .cons (app_nil _).symm (by rw [app_nil]; exact .nil _)
| comp _ _ ih1 ih2 => exact dty_app ih1 ih2
| tens hf hg ih1 ih2 =>
show DTy (wR (dom _) _ ++ wL (cod _) _) _ _
rw [(ty_dc hg).1, (ty_dc hf).2]
exact dty_app (dty_wR _ ih1) (dty_wL _ ih2)
where
dty_app {D E : List (Ly S)} {A B C : Ob} (h1 : DTy D A B) (h2 : DTy E B C) : DTy (D ++ E) A C := by
induction h1 with
| nil => exact h2
| cons e _ ih => exact .cons e (ih h2)
dty_wR (C : Ob) : {D : List (Ly S)} → {A B : Ob} → DTy D A B → DTy (wR C D) (A ++ C) (B ++ C)
| _, _, _, .nil _ => .nil _
| _, _, _, @DTy.cons _ L R g _ _ _ e h => .cons (by rw [e]; exact app_assoc _ _ _) (by
have ih := dty_wR C h
rw [app_assoc (L ++ S.cod g) R C] at ih
exact ih)
dty_wL (C : Ob) : {D : List (Ly S)} → {A B : Ob} → DTy D A B → DTy (wL C D) (C ++ A) (C ++ B)
| _, _, _, .nil _ => .nil _
| _, _, _, @DTy.cons _ L R g _ _ _ e h => .cons (by rw [e]; exact eqL C L _ R) (by
have ih := dty_wL C h
rw [eqL C L (S.cod g) R] at ih
exact ih)
theorem sound {t u : Tm S} (h : Eqv t u) : DEq (diag t) (diag u) := by
induction h with
| refl => exact .refl _
| symm _ ih => exact .symm ih
| trans _ _ ih1 ih2 => exact .trans ih1 ih2
| compC _ _ ih1 ih2 => exact deq_app ih1 ih2
| @tensC f f' g g' e1 e2 ih1 ih2 =>
show DEq (wR (dom g) (diag f) ++ wL (cod f) (diag g)) (wR (dom g') (diag f') ++ wL (cod f') (diag g'))
rw [(eqv_dc e2).1, (eqv_dc e1).2]
exact deq_app (deq_wR _ ih1) (deq_wL _ ih2)
| idL _ => exact .refl _
| idR _ => exact deq_of_eq (lapp_nil _)
| assoc f g h => exact deq_of_eq (lapp_assoc _ _ _)
| tassoc f g h =>
show DEq (wR (dom h) (wR (dom g) (diag f) ++ wL (cod f) (diag g)) ++ wL (cod f ++ cod g) (diag h))
(wR (dom g ++ dom h) (diag f) ++ wL (cod f) (wR (dom h) (diag g) ++ wL (cod g) (diag h)))
rw [wR_app, wR_wR, wR_wL, wL_app, wL_wL, lapp_assoc]
exact .refl _
| tunitL f =>
show DEq ([] ++ wL [] (diag f)) (diag f)
exact deq_of_eq (wL_nil _)
| tunitR f =>
show DEq (wR [] (diag f) ++ []) (diag f)
rw [lapp_nil, wR_nil]
exact .refl _
| tid => exact .refl _
| @inter f f' g g' A B C D E F hf hf' hg hg' =>
show DEq ((wR (dom g) (diag f) ++ wL (cod f) (diag g)) ++ (wR (dom g') (diag f') ++ wL (cod f') (diag g')))
(wR (dom g) (diag f ++ diag f') ++ wL (cod f') (diag g ++ diag g'))
rw [(ty_dc hg).1, (ty_dc hf).2, (ty_dc hg').1, (ty_dc hf').2, wR_app, wL_app]
rw [lapp_assoc, lapp_assoc]
refine deq_appL _ ?_
rw [← lapp_assoc, ← lapp_assoc (wR D (diag f')) (wL C (diag g)) _]
exact deq_appR _ (block (diag_ty hg) (diag_ty hf'))
end SD
end Found
#print axioms Found.SD.app_assoc
#print axioms Found.SD.ty_dc
#print axioms Found.SD.eqv_dc
#print axioms Found.SD.deq_app
#print axioms Found.SD.deq_wR
#print axioms Found.SD.deq_wL
#print axioms Found.SD.one_left
#print axioms Found.SD.block
#print axioms Found.SD.diag_ty
#print axioms Found.SD.sound
lean_all/found/StrDiag2.lean
/-
T193, string diagrams, part 2. found/StrDiag2 — the combinatorial
Joyal–Street theorem, completeness half and the equivalence:
* reading a diagram back as a term (each layer = id ⊗ box ⊗ id, layers
composed); every term is equal to the reading of its diagram;
* an interchange move does not change the reading (up to ≈), and keeps
the typing;
* theorem (joyal_street): two terms of the same type are equal in the
free strict monoidal category iff their string diagrams are related by
interchange moves — string diagrams modulo deformation (in its
combinatorial form) are the free strict monoidal category.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.StrDiag1
namespace Found
namespace SD
variable {S : Sig}
def wh (l : Ly S) : Tm S := .tens (.tens (.id l.L) (.gen l.g)) (.id l.R)
def read (A : Ob) : List (Ly S) → Tm S
| [] => .id A
| l :: D => .comp (wh l) (read (l.L ++ S.cod l.g ++ l.R) D)
theorem ty_wh (L R : Ob) (g : S.G) : Ty (wh ⟨L, g, R⟩) (L ++ S.dom g ++ R) (L ++ S.cod g ++ R) :=
.tens (.tens (.id L) (.gen g)) (.id R)
theorem read_ty : {D : List (Ly S)} → {A B : Ob} → DTy D A B → Ty (read A D) A B
| _, _, _, .nil A => .id A
| _, _, _, @DTy.cons _ L R g _ _ _ e h => by
subst e
exact .comp (ty_wh L R g) (read_ty h)
theorem E_trans {t u v : Tm S} (h1 : Eqv t u) (h2 : Eqv u v) : Eqv t v := .trans h1 h2
/-! ## reading and the operations on diagrams -/
theorem read_app : {D : List (Ly S)} → {A B : Ob} → DTy D A B → {E : List (Ly S)} → {C : Ob} → DTy E B C →
Eqv (read A (D ++ E)) (.comp (read A D) (read B E))
| _, _, _, .nil _, _, _, hE => .symm (.idL (read_ty hE))
| _, _, _, @DTy.cons _ L R g _ _ _ _ h, _, _, hE =>
E_trans (.compC (.refl _) (read_app h hE)) (.symm (.assoc _ _ _))
theorem read_wR (C : Ob) : {D : List (Ly S)} → {A B : Ob} → DTy D A B →
Eqv (read (A ++ C) (wR C D)) (.tens (read A D) (.id C))
| _, _, _, .nil A => .symm (.tid A C)
| _, _, _, @DTy.cons _ L R g D _ _ e h => by
subst e
have ih := read_wR C h
rw [app_assoc (L ++ S.cod g) R C] at ih
show Eqv (.comp (wh ⟨L, g, R ++ C⟩) (read (L ++ S.cod g ++ (R ++ C)) (wR C D))) _
have hw : Eqv (wh (⟨L, g, R ++ C⟩ : Ly S)) (.tens (wh ⟨L, g, R⟩) (.id C)) :=
E_trans (.tensC (.refl _) (.symm (.tid R C))) (.symm (.tassoc _ _ _))
exact E_trans (.compC hw ih) (E_trans (.inter (ty_wh L R g) (read_ty h) (.id C) (.id C))
(.tensC (.refl _) (.idL (.id C))))
theorem read_wL (C : Ob) : {D : List (Ly S)} → {A B : Ob} → DTy D A B →
Eqv (read (C ++ A) (wL C D)) (.tens (.id C) (read A D))
| _, _, _, .nil A => .symm (.tid C A)
| _, _, _, @DTy.cons _ L R g D _ _ e h => by
subst e
have ih := read_wL C h
rw [eqL C L (S.cod g) R] at ih
show Eqv (.comp (wh ⟨C ++ L, g, R⟩) (read ((C ++ L) ++ S.cod g ++ R) (wL C D))) _
have hw : Eqv (wh (⟨C ++ L, g, R⟩ : Ly S)) (.tens (.id C) (wh ⟨L, g, R⟩)) :=
E_trans (.tensC (.tensC (.symm (.tid C L)) (.refl _)) (.refl _))
(E_trans (.tensC (.tassoc _ _ _) (.refl _)) (.tassoc _ _ _))
exact E_trans (.compC hw ih) (E_trans (.inter (.id C) (.id C) (ty_wh L R g) (read_ty h))
(.tensC (.idL (.id C)) (.refl _)))
/-- every term equals the reading of its diagram -/
theorem term_read {t : Tm S} {A B : Ob} (h : Ty t A B) : Eqv t (read A (diag t)) := by
induction h with
| id A => exact .refl _
| gen g =>
show Eqv (.gen g) (.comp (wh ⟨[], g, []⟩) (.id ([] ++ S.cod g ++ [])))
exact .symm (E_trans (.idR (ty_wh [] [] g)) (E_trans (.tunitR _) (.tunitL _)))
| comp hf hg ih1 ih2 =>
exact E_trans (.compC ih1 ih2) (.symm (read_app (diag_ty hf) (diag_ty hg)))
| @tens f g A B C D hf hg ih1 ih2 =>
show Eqv _ (read (A ++ C) (wR (dom g) (diag f) ++ wL (cod f) (diag g)))
rw [(ty_dc hg).1, (ty_dc hf).2]
have a1 := read_app (diag_ty.dty_wR C (diag_ty hf)) (diag_ty.dty_wL B (diag_ty hg))
have a2 : Eqv (Tm.comp (read (A ++ C) (wR C (diag f))) (read (B ++ C) (wL B (diag g))))
(.tens (read A (diag f)) (read C (diag g))) :=
E_trans (.compC (read_wR C (diag_ty hf)) (read_wL B (diag_ty hg)))
(E_trans (.inter (read_ty (diag_ty hf)) (.id B) (.id C) (read_ty (diag_ty hg)))
(.tensC (.idR (read_ty (diag_ty hf))) (.idL (read_ty (diag_ty hg)))))
exact E_trans (.tensC ih1 ih2) (.symm (E_trans a1 a2))
/-! ## interchange moves -/
theorem k1 (X d M e Y : Ob) : X ++ d ++ (M ++ e ++ Y) = X ++ d ++ M ++ e ++ Y := by
rw [app_assoc M e Y, app_assoc (X ++ d ++ M) e Y, app_assoc (X ++ d) M, app_assoc X d]
/-- the interchange of two boxes side by side, on terms -/
theorem swap_eqv (X M Y : Ob) (g1 g2 : S.G) :
Eqv (Tm.comp (wh ⟨X, g1, M ++ S.dom g2 ++ Y⟩) (wh ⟨X ++ S.cod g1 ++ M, g2, Y⟩))
(.comp (wh ⟨X ++ S.dom g1 ++ M, g2, Y⟩) (wh ⟨X, g1, M ++ S.cod g2 ++ Y⟩)) :=
let P : Tm S := .tens (.id X) (.gen g1)
let Q : Tm S := .tens (.tens (.id M) (.gen g2)) (.id Y)
have hP : Ty P (X ++ S.dom g1) (X ++ S.cod g1) := .tens (.id X) (.gen g1)
have hQ : Ty Q (M ++ S.dom g2 ++ Y) (M ++ S.cod g2 ++ Y) := ty_wh M Y g2
have side : ∀ Z : Ob, Eqv (wh (⟨Z ++ M, g2, Y⟩ : Ly S)) (.tens (.id Z) Q) := fun Z =>
E_trans (.tensC (.tensC (.symm (.tid Z M)) (.refl _)) (.refl _))
(E_trans (.tensC (.tassoc _ _ _) (.refl _)) (.tassoc _ _ _))
have l1 : Eqv (Tm.comp (wh ⟨X, g1, M ++ S.dom g2 ++ Y⟩) (wh ⟨X ++ S.cod g1 ++ M, g2, Y⟩)) (.tens P Q) :=
E_trans (.compC (.refl _) (side (X ++ S.cod g1)))
(E_trans (.inter hP (.id _) (.id _) hQ) (.tensC (.idR hP) (.idL hQ)))
have l2 : Eqv (Tm.comp (wh ⟨X ++ S.dom g1 ++ M, g2, Y⟩) (wh ⟨X, g1, M ++ S.cod g2 ++ Y⟩)) (.tens P Q) :=
E_trans (.compC (side (X ++ S.dom g1)) (.refl _))
(E_trans (.inter (.id _) hP hQ (.id _)) (.tensC (.idL hP) (.idR hQ)))
E_trans l1 (.symm l2)
/-- an interchange move keeps the typing and the reading -/
theorem istep_read {D D' : List (Ly S)} (s : IStep D D') :
∀ {A B : Ob}, (DTy D A B ↔ DTy D' A B) ∧ (DTy D A B → Eqv (read A D) (read A D')) := by
induction s with
| @here X M Y R1 L2 L2' R1' g1 g2 Q e1 e2 e3 e4 =>
subst e1; subst e2; subst e3; subst e4
intro A B
have mid : X ++ S.cod g1 ++ M ++ S.cod g2 ++ Y = X ++ S.cod g1 ++ (M ++ S.cod g2 ++ Y) :=
(k1 X (S.cod g1) M (S.cod g2) Y).symm
refine ⟨⟨fun h => ?_, fun h => ?_⟩, fun h => ?_⟩
· match h with
| .cons ea (.cons _ hq) =>
exact .cons (ea.trans (k1 X _ M _ Y)) (.cons (k1 X (S.dom g1) M (S.cod g2) Y).symm (by rw [← mid]; exact hq))
· match h with
| .cons ea (.cons _ hq) =>
refine .cons (ea.trans (k1 X _ M _ Y).symm) (.cons (k1 X (S.cod g1) M (S.dom g2) Y) ?_)
rw [mid]
exact hq
· show Eqv (.comp (wh ⟨X, g1, M ++ S.dom g2 ++ Y⟩) (.comp (wh ⟨X ++ S.cod g1 ++ M, g2, Y⟩)
(read (X ++ S.cod g1 ++ M ++ S.cod g2 ++ Y) Q)))
(.comp (wh ⟨X ++ S.dom g1 ++ M, g2, Y⟩) (.comp (wh ⟨X, g1, M ++ S.cod g2 ++ Y⟩)
(read (X ++ S.cod g1 ++ (M ++ S.cod g2 ++ Y)) Q)))
rw [← mid]
exact E_trans (.symm (.assoc _ _ _)) (E_trans (.compC (swap_eqv X M Y g1 g2) (.refl _)) (.assoc _ _ _))
| cons l _ ih =>
intro A B
refine ⟨⟨fun h => ?_, fun h => ?_⟩, fun h => ?_⟩
· match h with
| .cons e hq => exact .cons e ((ih).1.1 hq)
· match h with
| .cons e hq => exact .cons e ((ih).1.2 hq)
· match h with
| .cons _ hq => exact .compC (.refl _) ((ih).2 hq)
theorem deq_read {D D' : List (Ly S)} (h : DEq D D') :
∀ {A B : Ob}, (DTy D A B ↔ DTy D' A B) ∧ (DTy D A B → Eqv (read A D) (read A D')) := by
induction h with
| refl => exact fun {_ _} => ⟨Iff.rfl, fun _ => .refl _⟩
| step s => exact istep_read s
| symm _ ih => exact fun {_ _} => ⟨ih.1.symm, fun h => .symm (ih.2 (ih.1.2 h))⟩
| trans _ _ ih1 ih2 => exact fun {_ _} => ⟨ih1.1.trans ih2.1, fun h => E_trans (ih1.2 h) (ih2.2 (ih1.1.1 h))⟩
/-- the combinatorial Joyal–Street theorem: string diagrams modulo interchange
are the free strict monoidal category -/
theorem joyal_street {t u : Tm S} {A B : Ob} (ht : Ty t A B) (hu : Ty u A B) :
Eqv t u ↔ DEq (diag t) (diag u) :=
⟨sound, fun h => E_trans (term_read ht) (E_trans ((deq_read h).2 (diag_ty ht)) (.symm (term_read hu)))⟩
end SD
end Found
#print axioms Found.SD.read_ty
#print axioms Found.SD.read_app
#print axioms Found.SD.read_wR
#print axioms Found.SD.read_wL
#print axioms Found.SD.term_read
#print axioms Found.SD.k1
#print axioms Found.SD.swap_eqv
#print axioms Found.SD.istep_read
#print axioms Found.SD.deq_read
#print axioms Found.SD.joyal_street
lean_all/found/TMMu.lean
/-
Line Turing machines → μ-recursive functions. found/TMMu — the register
program simulating a Turing machine (found/TMSim) uses only registers
below 20 + 2·(number of states), so Minsky's compilation (found/Minsky3)
applies: every halting run of a well-formed Turing machine c ⟶ c' is
computed by the μ-recursive program F (two-counter program of the
simulation), from the code E s K of any store encoding c to the code of a
store encoding c' (tm_to_mu).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.TMSim
import found.Minsky3
namespace Found
namespace TMMu
open RC TMR TMS Mk RM Rec CT3
section
variable {K : Nat}
theorem u_clear {r : Nat} (h : r < K) : Uses K (clear r) := (⟨h, h⟩ : r < K ∧ r < K)
theorem u_mvBack {x t : Nat} (hx : x < K) (ht : t < K) : Uses K (mvBack x t) :=
(⟨ht, ht, hx⟩ : t < K ∧ t < K ∧ x < K)
theorem u_mv3 {x y t : Nat} (hx : x < K) (hy : y < K) (ht : t < K) : Uses K (mv3 x y t) :=
(⟨hx, hx, hy, ht⟩ : x < K ∧ x < K ∧ y < K ∧ t < K)
theorem u_copy {x y t : Nat} (hx : x < K) (hy : y < K) (ht : t < K) : Uses K (copy x y t) :=
(⟨u_clear hy, u_clear ht, u_mv3 hx hy ht, u_mvBack hx ht⟩ :
Uses K (clear y) ∧ Uses K (clear t) ∧ Uses K (mv3 x y t) ∧ Uses K (mvBack x t))
theorem u_ifNZ {r t : Nat} {p : Prog} (hr : r < K) (ht : t < K) (ht1 : t + 1 < K) (hp : Uses K p) :
Uses K (ifNZ r t p) :=
(⟨u_copy hr ht ht1, ht, u_clear ht, hp⟩ : Uses K (copy r t (t + 1)) ∧ t < K ∧ Uses K (clear t) ∧ Uses K p)
theorem u_mv {x t : Nat} (hx : x < K) (ht : t < K) : Uses K (mv x t) :=
(⟨u_clear hx, u_mvBack hx ht⟩ : Uses K (clear x) ∧ Uses K (mvBack x t))
theorem u_dbl {x t : Nat} (hx : x < K) (ht : t < K) : Uses K (dbl x t) :=
(⟨u_clear ht, u_mvBack ht hx, ht, ht, hx, hx⟩ :
Uses K (clear t) ∧ Uses K (mvBack t x) ∧ t < K ∧ t < K ∧ x < K ∧ x < K)
theorem u_push {x t : Nat} (w : Bool) (hx : x < K) (ht : t < K) : Uses K (push x t w) := by
cases w with
| true => exact (⟨u_dbl hx ht, hx⟩ : Uses K (dbl x t) ∧ x < K)
| false => exact u_dbl hx ht
end
theorem lk {K : Nat} (hK : 20 ≤ K) (n : Nat) (h : Nat.ble (n + 1) 20 = true) : n < K :=
Nat.lt_of_lt_of_le (ltlit n 20 h) hK
theorem u_pop {K : Nat} (hK : 20 ≤ K) (x : Nat) (hx : x < 7) :
Uses K (pop x 5 7) :=
have l := lk hK
have hxK : x < K := Nat.lt_trans hx (l 7 rfl)
(⟨u_mv (l 7 rfl) hxK, u_clear (l 8 rfl), u_clear (l 9 rfl), ⟨l 7 rfl,
(⟨l 7 rfl, u_clear (l 10 rfl), l 10 rfl,
u_ifNZ (l 9 rfl) (l 11 rfl) (l 12 rfl) (⟨l 10 rfl, u_clear (l 9 rfl), l 8 rfl⟩ : 10 < K ∧ Uses K (clear 9) ∧ 8 < K),
u_ifNZ (l 10 rfl) (l 11 rfl) (l 12 rfl) (l 9 rfl)⟩ :
7 < K ∧ Uses K (clear 10) ∧ 10 < K ∧ Uses K (ifNZ 9 11 (.seq (.dec 10) (.seq (clear 9) (.inc 8)))) ∧
Uses K (ifNZ 10 11 (.inc 9)))⟩,
u_mv hxK (l 8 rfl), u_mv (l 5 rfl) (l 9 rfl)⟩ :
Uses K (mv 7 x) ∧ Uses K (clear 8) ∧ Uses K (clear 9) ∧ (7 < K ∧
Uses K (halveBody 7 8 9 10 11)) ∧ Uses K (mv x 8) ∧ Uses K (mv 5 9))
theorem two_lt {q n : Nat} (h : q < n) : 2 * q + 1 < 2 * n :=
Nat.lt_of_lt_of_le (Nat.lt_succ_self (2 * q + 1)) (Nat.mul_le_mul_left 2 (Nat.succ_le_of_lt h))
theorem sr_lt {q n : Nat} (h : q < n) : Sr q < 20 + 2 * n :=
Nat.add_lt_add_left (Nat.lt_trans (Nat.lt_succ_self _) (two_lt h)) 20
theorem nr_lt {q n : Nat} (h : q < n) : Nr q < 20 + 2 * n := Nat.add_lt_add_left (two_lt h) 20
section
variable (M : TM)
theorem kge : 20 ≤ 20 + 2 * M.nq := Nat.le_add_right 20 _
theorem u_body (q' : Nat) (w d : Bool) (hq : q' < M.nq) : Uses (20 + 2 * M.nq) (body q' w d) :=
have l := lk (kge M)
(⟨u_push w (Nat.lt_trans (xd_lt d) (l 7 rfl)) (l 13 rfl), u_pop (kge M) (yd d) (yd_lt d), nr_lt hq, l 4 rfl⟩ :
Uses _ (push (xd d) 13 w) ∧ Uses _ (pop (yd d) 5 7) ∧ Nr q' < _ ∧ 4 < _)
theorem u_entry (wf : WF M) (q : Nat) (h : Bool) (hq : q < M.nq) : Uses (20 + 2 * M.nq) (entry M q h) := by
have l := lk (kge M)
match hd : M.δ q h with
| none => rw [entry_none M q h hd]; exact u_clear (l 7 rfl)
| some (q', w, d) =>
rw [entry_some M q h q' w d hd]
exact u_ifNZ (sr_lt hq) (l 14 rfl) (l 15 rfl)
(u_ifNZ (Nat.lt_trans (hr_lt h) (l 7 rfl)) (l 16 rfl) (l 17 rfl) (u_body M q' w d (wf _ _ _ _ _ hd)))
theorem u_disp (wf : WF M) : (n : Nat) → n ≤ M.nq → Uses (20 + 2 * M.nq) (disp M n)
| 0, _ => u_clear (lk (kge M) 7 rfl)
| n + 1, h => (⟨u_disp wf n (Nat.le_of_succ_le h), u_entry M wf n false h, u_entry M wf n true h⟩ :
Uses _ (disp M n) ∧ Uses _ (entry M n false) ∧ Uses _ (entry M n true))
theorem u_tailS : (n : Nat) → n ≤ M.nq → Uses (20 + 2 * M.nq) (tailS n)
| 0, _ => u_clear (lk (kge M) 7 rfl)
| n + 1, h => (⟨u_tailS n (Nat.le_of_succ_le h), u_mv (sr_lt h) (nr_lt h)⟩ :
Uses _ (tailS n) ∧ Uses _ (mv (Sr n) (Nr n)))
theorem u_prog (wf : WF M) : Uses (20 + 2 * M.nq) (TMS.prog M) :=
have l := lk (kge M)
have ut : Uses (20 + 2 * M.nq) (tail M) :=
(⟨u_tailS M M.nq (Nat.le_refl _), u_mv (l 2 rfl) (l 5 rfl), u_clear (l 3 rfl), l 3 rfl,
u_ifNZ (l 2 rfl) (l 16 rfl) (l 17 rfl) (l 3 rfl)⟩ :
Uses _ (tailS M.nq) ∧ Uses _ (mv 2 5) ∧ Uses _ (clear 3) ∧ 3 < _ ∧ Uses _ (ifNZ 2 16 (.dec 3)))
(⟨l 4 rfl, l 4 rfl, u_clear (l 4 rfl), u_disp M wf M.nq (Nat.le_refl _),
u_ifNZ (l 4 rfl) (l 14 rfl) (l 15 rfl) ut⟩ :
4 < _ ∧ 4 < _ ∧ Uses _ (clear 4) ∧ Uses _ (disp M M.nq) ∧ Uses _ (ifNZ 4 14 (tail M)))
/-- Turing machines → μ-recursive functions -/
theorem tm_to_mu (wf : WF M) {c c' : Cfg} (hr : Reach M c c') (hh : Halted M c') (s : Store) (e : Enc M c s) :
∃ s', Enc M c' s' ∧ Ev (F (Mk.prog (TMS.prog M))) [E s (20 + 2 * M.nq), 0] (E s' (20 + 2 * M.nq)) :=
match tm_to_register M wf hr hh s e with
| ⟨s', r, e'⟩ => ⟨s', e', register_to_mu _ _ (u_prog M wf) r⟩
end
end TMMu
end Found
#print axioms Found.TMMu.u_pop
#print axioms Found.TMMu.u_entry
#print axioms Found.TMMu.u_prog
#print axioms Found.TMMu.tm_to_mu
lean_all/found/TMReg.lean
/-
Line Turing machines → register machines, part 3. found/TMReg — Turing
machines on a binary tape, each tape half stored as a binary number
(the cell next to the head is the least significant bit): a finite rule
table δ(q, h) = (q', w, move right?), halting when there is no rule.
One step (relational, the halves split as 2·rest + bit). Register
gadgets for the tape: moving a register, writing a bit onto a half
(L := 2L + w), reading the head from a half (L = 2L' + h).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.RegIf
namespace Found
namespace TMR
open RC
def bit (b : Bool) : Nat := cond b 1 0
structure TM where
nq : Nat
δ : Nat → Bool → Option (Nat × Bool × Bool)
structure Cfg where
q : Nat
L : Nat
h : Bool
R : Nat
/-- one step: write w, move; the half moved from is split as 2·rest + bit -/
inductive Step (M : TM) : Cfg → Cfg → Prop where
| right {c : Cfg} {q' : Nat} {w : Bool} {h' : Bool} {R' : Nat} :
M.δ c.q c.h = some (q', w, true) → c.R = 2 * R' + bit h' →
Step M c ⟨q', 2 * c.L + bit w, h', R'⟩
| left {c : Cfg} {q' : Nat} {w : Bool} {h' : Bool} {L' : Nat} :
M.δ c.q c.h = some (q', w, false) → c.L = 2 * L' + bit h' →
Step M c ⟨q', L', h', 2 * c.R + bit w⟩
inductive Reach (M : TM) : Cfg → Cfg → Prop where
| refl (c : Cfg) : Reach M c c
| step {a b c : Cfg} : Step M a b → Reach M b c → Reach M a c
def Halted (M : TM) (c : Cfg) : Prop := M.δ c.q c.h = none
/-! ## moving a register -/
/-- x := t, t := 0 -/
def mv (x t : Nat) : Prog := .seq (clear x) (mvBack x t)
theorem mv_spec (x t : Nat) (h : x ≠ t) (s : Store) :
∃ s', Run (mv x t) s s' ∧ s' x = s t ∧ s' t = 0 ∧ ∀ q, q ≠ x → q ≠ t → s' q = s q :=
match clear_ex x s with
| ⟨s1, r1, h1, f1⟩ => match mvBack_spec x t h (s1 t) s1 rfl with
| ⟨s2, r2, h2t, h2x, f2⟩ => ⟨s2, .seq r1 r2, by rw [h2x, h1, Nat.zero_add, f1 t (fun e => h e.symm)], h2t,
fun q qx qt => by rw [f2 q qx qt, f1 q qx]⟩
/-- writing a bit onto a half: x := 2x + w (scratch t) -/
def push (x t : Nat) (w : Bool) : Prog := cond w (.seq (dbl x t) (.inc x)) (dbl x t)
theorem push_spec (x t : Nat) (w : Bool) (h : x ≠ t) (s : Store) :
∃ s', Run (push x t w) s s' ∧ s' x = 2 * s x + bit w ∧ ∀ q, q ≠ x → q ≠ t → s' q = s q :=
match dbl_spec x t h s with
| ⟨s1, r1, h1, _, f1⟩ => by
cases w with
| false => exact ⟨s1, r1, h1, f1⟩
| true => exact ⟨upd s1 x (s1 x + 1), .seq r1 .inc, by rw [upd_eq, h1]; rfl,
fun q qx qt => by rw [upd_ne _ _ _ _ qx, f1 q qx qt]⟩
/-- reading the head from a half: x = 2x' + h (halving block at B, x, y < B) -/
def pop (x y B : Nat) : Prog :=
.seq (mv B x) (.seq (clear (B + 1)) (.seq (clear (B + 2))
(.seq (.loop B (halveBody B (B + 1) (B + 2) (B + 3) (B + 4))) (.seq (mv x (B + 1)) (mv y (B + 2))))))
theorem bit_of (v : Nat) (h : v = 0 ∨ v = 1) : ∃ b, v = bit b :=
h.elim (fun e => ⟨false, e⟩) (fun e => ⟨true, e⟩)
theorem pop_spec (x y B : Nat) (hx : x < B) (hy : y < B) (hxy : x ≠ y) (s : Store) :
∃ s', Run (pop x y B) s s' ∧ (∃ b, s' y = bit b ∧ s x = 2 * s' x + bit b) ∧
∀ q, q ≠ x → q ≠ y → Out B q → s' q = s q := by
have nB : ∀ {z}, z < B → ∀ i, z ≠ B + i := fun hz i e => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le hz (e ▸ Nat.le_add_right B i))
have nB0 : ∀ {z}, z < B → z ≠ B := fun hz e => Nat.lt_irrefl _ (e ▸ hz)
match mv_spec B x (fun e => nB0 hx e.symm) s with
| ⟨s1, r1, h1B, h1x, f1⟩ => match clear_ex (B + 1) s1 with
| ⟨s2, r2, h2, f2⟩ => match clear_ex (B + 2) s2 with
| ⟨s3, r3, h3, f3⟩ =>
have e3B : s3 B = s x := by
rw [f3 B (fun e => ne_off B (nelit 0 2 rfl) (by rw [Nat.add_zero]; exact e)),
f2 B (fun e => ne_off B (nelit 0 1 rfl) (by rw [Nat.add_zero]; exact e)), h1B]
match halve_loop B (s3 B) s3 rfl (Or.inl h3) with
| ⟨s4, r4, _, h4s, h4b, f4⟩ =>
match mv_spec x (B + 1) (nB hx 1) s4 with
| ⟨s5, r5, h5x, h51, f5⟩ =>
match mv_spec y (B + 2) (nB hy 2) s5 with
| ⟨s6, r6, h6y, _, f6⟩ =>
match bit_of (s4 (B + 2)) h4b with
| ⟨b, hb⟩ =>
have e1 : s3 (B + 1) = 0 := (f3 _ (ne_off B (nelit 1 2 rfl))).trans h2
refine ⟨s6, .seq r1 (.seq r2 (.seq r3 (.seq r4 (.seq r5 r6)))), ⟨b, ?_, ?_⟩, ?_⟩
· rw [h6y, f5 (B + 2) (nB hx 2).symm (ne_off B (nelit 2 1 rfl)), hb]
· rw [f6 x hxy (nB hx 2), h5x, ← e3B, ← hb]
rw [e1, h3] at h4s
rw [h4s, Nat.mul_zero, Nat.add_zero, Nat.zero_add]
· intro q qx qy hq
rw [f6 q qy (out_ne hq 2 (ltlit 2 6 rfl)), f5 q qx (out_ne hq 1 (ltlit 1 6 rfl)), f4 q hq,
f3 q (out_ne hq 2 (ltlit 2 6 rfl)), f2 q (out_ne hq 1 (ltlit 1 6 rfl)),
f1 q (by have := out_ne hq 0 (ltlit 0 6 rfl); rw [Nat.add_zero] at this; exact this) qx]
end TMR
end Found
#print axioms Found.TMR.mv_spec
#print axioms Found.TMR.push_spec
#print axioms Found.TMR.pop_spec
lean_all/found/TMSim.lean
/-
Line Turing machines → register machines, part 4. found/TMSim — a
register program simulating a Turing machine (found/TMReg):
registers 0 = left half, 1 = right half, 2 = head bit, 3 = its negation,
4 = "a rule fired", 5 = next head bit; scratch 7–19; the state is one-hot
in S_q = 20 + 2q, the next state in N_q = 21 + 2q. One step: clear the
flag, dispatch over all (q, h) with a rule (guarded by S_q and the head
register; the body writes and moves the tape and records the next state),
then, if a rule fired, move N into S and the next head bit into place.
Each step of the machine is simulated by one step program, a halted
machine leaves the encoding unchanged with the flag 0, and so a halting
run is simulated by `while flag (step)`.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.TMReg
namespace Found
namespace TMS
open RC TMR
/-! ## arithmetic on the layout -/
theorem lelit (a b : Nat) (h : Nat.ble a b = true) : a ≤ b := Nat.le_of_ble_eq_true h
theorem ne_lt {a b : Nat} (h : a < b) : a ≠ b := fun e => by
rw [e] at h
exact Nat.lt_irrefl _ h
theorem ne_gt {a b : Nat} (h : a < b) : b ≠ a := fun e => ne_lt h e.symm
theorem two_inj : (a b : Nat) → 2 * a = 2 * b → a = b
| 0, 0, _ => rfl
| 0, _ + 1, h => Nat.noConfusion h
| _ + 1, 0, h => Nat.noConfusion h
| a + 1, b + 1, h => congrArg (· + 1) (two_inj a b (Nat.succ.inj (Nat.succ.inj (show 2 * a + 1 + 1 = 2 * b + 1 + 1 from h))))
theorem odd_ne : (a b : Nat) → 2 * a + 1 ≠ 2 * b
| 0, 0, h => Nat.noConfusion h
| _ + 1, 0, h => Nat.noConfusion h
| 0, b + 1, h => Nat.noConfusion (Nat.succ.inj (show 0 + 1 = 2 * b + 1 + 1 from h))
| a + 1, b + 1, h => odd_ne a b (Nat.succ.inj (Nat.succ.inj (show 2 * a + 1 + 1 + 1 = 2 * b + 1 + 1 from h)))
/-- the halves are determined by 2·rest + bit -/
theorem half_det (a b : Nat) (x y : Bool) (h : 2 * a + bit x = 2 * b + bit y) : a = b ∧ x = y := by
cases x with
| false => cases y with
| false => exact ⟨two_inj a b h, rfl⟩
| true => exact absurd h.symm (odd_ne b a)
| true => cases y with
| false => exact absurd h (odd_ne a b)
| true => exact ⟨two_inj a b (Nat.succ.inj h), rfl⟩
def Sr (q : Nat) : Nat := 20 + 2 * q
def Nr (q : Nat) : Nat := 20 + (2 * q + 1)
def Hr (h : Bool) : Nat := cond h 2 3
def xd (d : Bool) : Nat := cond d 0 1
def yd (d : Bool) : Nat := cond d 1 0
/-- registers outside the scratch area 7–19 -/
def NS (q : Nat) : Prop := q < 7 ∨ 20 ≤ q
theorem sr_ne {k : Nat} (h : k < 20) (q : Nat) : k ≠ Sr q := lt_ne h _
theorem nr_ne {k : Nat} (h : k < 20) (q : Nat) : k ≠ Nr q := lt_ne h _
theorem sr_inj {a b : Nat} (h : Sr a = Sr b) : a = b := two_inj a b (add_cancel' 20 h)
theorem nr_inj {a b : Nat} (h : Nr a = Nr b) : a = b := two_inj a b (Nat.succ.inj (add_cancel' 20 h))
theorem sr_nr (a b : Nat) : Sr a ≠ Nr b := fun e => odd_ne b a (add_cancel' 20 e).symm
theorem sr_NS (q : Nat) : NS (Sr q) := Or.inr (Nat.le_add_right 20 _)
theorem nr_NS (q : Nat) : NS (Nr q) := Or.inr (Nat.le_add_right 20 _)
theorem ns_ne {q : Nat} (h : NS q) {k : Nat} (h1 : 7 ≤ k) (h2 : k < 20) : q ≠ k := fun e => by
cases h with
| inl h => rw [e] at h; exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le h h1)
| inr h => rw [e] at h; exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le h2 h)
theorem ns_out {q : Nat} (h : NS q) : Out 7 q := by
cases h with
| inl h => exact Or.inl h
| inr h => exact Or.inr (Nat.le_trans (lelit (7 + 6) 20 rfl) h)
theorem out_big (q : Nat) (h : 20 ≤ q) : Out 7 q := Or.inr (Nat.le_trans (lelit (7 + 6) 20 rfl) h)
/-! ## the encoding of a configuration -/
structure Enc (M : TM) (c : Cfg) (s : Store) : Prop where
lq : c.q < M.nq
eL : s 0 = c.L
eR : s 1 = c.R
h1 : s 2 = bit c.h
h0 : s 3 = bit (!c.h)
sq : s (Sr c.q) = 1
so : ∀ q, q ≠ c.q → s (Sr q) = 0
n0 : ∀ q, s (Nr q) = 0
theorem hr_on (s : Store) (ch : Bool) (h1 : s 2 = bit ch) (h0 : s 3 = bit (!ch)) : s (Hr ch) ≠ 0 := by
cases ch with
| true => exact fun e => Nat.noConfusion (h1.symm.trans e)
| false => exact fun e => Nat.noConfusion (h0.symm.trans e)
theorem hr_off (s : Store) (ch h : Bool) (h1 : s 2 = bit ch) (h0 : s 3 = bit (!ch)) (ne : h ≠ ch) : s (Hr h) = 0 :=
match h, ch, h1, h0, ne with
| true, true, _, _, ne => absurd rfl ne
| true, false, h1, _, _ => h1
| false, true, _, h0, _ => h0
| false, false, _, _, ne => absurd rfl ne
theorem hr_lt (h : Bool) : Hr h < 7 := by
cases h with
| true => exact ltlit 2 7 rfl
| false => exact ltlit 3 7 rfl
/-- a Turing machine whose rules stay among its states -/
def WF (M : TM) : Prop := ∀ q h q' w d, M.δ q h = some (q', w, d) → q' < M.nq
/-! ## the body of a rule -/
theorem body_gen (x y q' : Nat) (hx7 : x < 7) (hy7 : y < 7) (hxy : x ≠ y) (hx5 : x ≠ 5) (hy5 : y ≠ 5)
(hx4 : x ≠ 4) (hy4 : y ≠ 4) (w : Bool) (s : Store) :
∃ t, Run (.seq (push x 13 w) (.seq (pop y 5 7) (.seq (.inc (Nr q')) (.inc 4)))) s t ∧
t x = 2 * s x + bit w ∧ (∃ b, t 5 = bit b ∧ s y = 2 * t y + bit b) ∧
t (Nr q') = s (Nr q') + 1 ∧ t 4 = s 4 + 1 ∧
(∀ r, NS r → r ≠ x → r ≠ y → r ≠ 4 → r ≠ 5 → r ≠ Nr q' → t r = s r) ∧
(∀ r, 14 ≤ r → r < 20 → t r = s r) :=
match push_spec x 13 w (ne_lt (Nat.lt_trans hx7 (ltlit 7 13 rfl))) s with
| ⟨s1, r1, h1x, f1⟩ =>
match pop_spec y 5 7 hy7 (ltlit 5 7 rfl) hy5 s1 with
| ⟨s2, r2, ⟨b, hb5, hby⟩, f2⟩ => by
have n4N : (4 : Nat) ≠ Nr q' := nr_ne (ltlit 4 20 rfl) q'
have xN : x ≠ Nr q' := nr_ne (Nat.lt_trans hx7 (ltlit 7 20 rfl)) q'
have yN : y ≠ Nr q' := nr_ne (Nat.lt_trans hy7 (ltlit 7 20 rfl)) q'
refine ⟨upd (upd s2 (Nr q') (s2 (Nr q') + 1)) 4 (upd s2 (Nr q') (s2 (Nr q') + 1) 4 + 1),
.seq r1 (.seq r2 (.seq .inc .inc)), ?_, ⟨b, ?_, ?_⟩, ?_, ?_, ?_, ?_⟩
· rw [upd_ne _ _ _ _ hx4, upd_ne _ _ _ _ xN, f2 x hxy hx5 (Or.inl hx7), h1x]
· rw [upd_ne _ _ _ _ (nelit 5 4 rfl), upd_ne _ _ _ _ (nr_ne (ltlit 5 20 rfl) q')]
exact hb5
· rw [upd_ne _ _ _ _ hy4, upd_ne _ _ _ _ yN,
← f1 y (fun e => hxy e.symm) (ne_lt (Nat.lt_trans hy7 (ltlit 7 13 rfl)))]
exact hby
· rw [upd_ne _ _ _ _ (fun e => n4N e.symm), upd_eq,
f2 _ (fun e => yN e.symm) (fun e => nr_ne (ltlit 5 20 rfl) q' e.symm) (out_big _ (Nat.le_add_right 20 _)),
f1 _ (fun e => xN e.symm) (fun e => nr_ne (ltlit 13 20 rfl) q' e.symm)]
· rw [upd_eq, upd_ne _ _ _ _ n4N, f2 4 (fun e => hy4 e.symm) (nelit 4 5 rfl) (Or.inl (ltlit 4 7 rfl)),
f1 4 (fun e => hx4 e.symm) (nelit 4 13 rfl)]
· intro r hr rx ry r4 r5 rN
rw [upd_ne _ _ _ _ r4, upd_ne _ _ _ _ rN, f2 r ry r5 (ns_out hr),
f1 r rx (ns_ne hr (lelit 7 13 rfl) (ltlit 13 20 rfl))]
· intro r h1 h2
have rN : r ≠ Nr q' := nr_ne h2 q'
have r4 : r ≠ 4 := ne_gt (Nat.lt_of_lt_of_le (ltlit 4 14 rfl) h1)
rw [upd_ne _ _ _ _ r4, upd_ne _ _ _ _ rN,
f2 r (ne_gt (Nat.lt_of_lt_of_le (Nat.lt_trans hy7 (ltlit 7 14 rfl)) h1))
(ne_gt (Nat.lt_of_lt_of_le (ltlit 5 14 rfl) h1)) (Or.inr (Nat.le_trans (lelit (7 + 6) 14 rfl) h1)),
f1 r (ne_gt (Nat.lt_of_lt_of_le (Nat.lt_trans hx7 (ltlit 7 14 rfl)) h1))
(ne_gt (Nat.lt_of_lt_of_le (ltlit 13 14 rfl) h1))]
def body (q' : Nat) (w d : Bool) : Prog :=
.seq (push (xd d) 13 w) (.seq (pop (yd d) 5 7) (.seq (.inc (Nr q')) (.inc 4)))
/-- the effect of a fired rule (q', w, d) -/
def Fired (q' : Nat) (w d : Bool) (s t : Store) : Prop :=
t (xd d) = 2 * s (xd d) + bit w ∧ (∃ b, t 5 = bit b ∧ s (yd d) = 2 * t (yd d) + bit b) ∧
t (Nr q') = s (Nr q') + 1 ∧ t 4 = s 4 + 1 ∧
∀ r, NS r → r ≠ 0 → r ≠ 1 → r ≠ 4 → r ≠ 5 → r ≠ Nr q' → t r = s r
theorem body_spec (q' : Nat) (w d : Bool) (s : Store) :
∃ t, Run (body q' w d) s t ∧ Fired q' w d s t ∧ ∀ r, 14 ≤ r → r < 20 → t r = s r := by
cases d with
| true =>
match body_gen 0 1 q' (ltlit 0 7 rfl) (ltlit 1 7 rfl) (nelit 0 1 rfl) (nelit 0 5 rfl) (nelit 1 5 rfl)
(nelit 0 4 rfl) (nelit 1 4 rfl) w s with
| ⟨t, r, a, b, c, e, f, g⟩ => exact ⟨t, r, ⟨a, b, c, e, fun r' hr r0 r1 => f r' hr r0 r1⟩, g⟩
| false =>
match body_gen 1 0 q' (ltlit 1 7 rfl) (ltlit 0 7 rfl) (nelit 1 0 rfl) (nelit 1 5 rfl) (nelit 0 5 rfl)
(nelit 1 4 rfl) (nelit 0 4 rfl) w s with
| ⟨t, r, a, b, c, e, f, g⟩ => exact ⟨t, r, ⟨a, b, c, e, fun r' hr r0 r1 => f r' hr r1 r0⟩, g⟩
/-! ## stores agreeing outside the scratch area -/
def Agree (s t : Store) : Prop := ∀ r, NS r → t r = s r
theorem agree_trans {s t u : Store} (h1 : Agree s t) (h2 : Agree t u) : Agree s u :=
fun r hr => (h2 r hr).trans (h1 r hr)
theorem agree_off (t0 : Nat) (h0 : 7 ≤ t0) (h1 : t0 + 1 < 20) {s s' : Store}
(f : ∀ q, q ≠ t0 → q ≠ t0 + 1 → s' q = s q) : Agree s s' :=
fun r hr => f r (ns_ne hr h0 (Nat.lt_trans (Nat.lt_succ_self t0) h1)) (ns_ne hr (Nat.le_trans h0 (Nat.le_succ t0)) h1)
theorem xd_lt (d : Bool) : xd d < 7 := by
cases d with
| true => exact ltlit 0 7 rfl
| false => exact ltlit 1 7 rfl
theorem yd_lt (d : Bool) : yd d < 7 := by
cases d with
| true => exact ltlit 1 7 rfl
| false => exact ltlit 0 7 rfl
theorem fired_pre {q' : Nat} {w d : Bool} {s s' t : Store} (ag : Agree s s') (F : Fired q' w d s' t) :
Fired q' w d s t :=
match F with
| ⟨a, ⟨b, hb, hy⟩, n, g, f⟩ =>
⟨by rw [a, ag _ (Or.inl (xd_lt d))], ⟨b, hb, by rw [← ag _ (Or.inl (yd_lt d))]; exact hy⟩,
by rw [n, ag _ (nr_NS q')], by rw [g, ag 4 (Or.inl (ltlit 4 7 rfl))],
fun r hr r0 r1 r4 r5 rN => (f r hr r0 r1 r4 r5 rN).trans (ag r hr)⟩
theorem fired_post {q' : Nat} {w d : Bool} {s t t' : Store} (F : Fired q' w d s t) (ag : Agree t t') :
Fired q' w d s t' :=
match F with
| ⟨a, ⟨b, hb, hy⟩, n, g, f⟩ =>
⟨by rw [ag _ (Or.inl (xd_lt d)), a], ⟨b, by rw [ag 5 (Or.inl (ltlit 5 7 rfl)), hb],
by rw [ag _ (Or.inl (yd_lt d))]; exact hy⟩,
by rw [ag _ (nr_NS q'), n], by rw [ag 4 (Or.inl (ltlit 4 7 rfl)), g],
fun r hr r0 r1 r4 r5 rN => (ag r hr).trans (f r hr r0 r1 r4 r5 rN)⟩
/-- a fired rule keeps the state and head registers -/
theorem keep_fired {q' : Nat} {w d : Bool} {s t : Store} (F : Fired q' w d s t) :
(∀ k, t (Sr k) = s (Sr k)) ∧ t 2 = s 2 ∧ t 3 = s 3 :=
⟨fun k => F.2.2.2.2 (Sr k) (sr_NS k) (fun e => sr_ne (ltlit 0 20 rfl) k e.symm)
(fun e => sr_ne (ltlit 1 20 rfl) k e.symm) (fun e => sr_ne (ltlit 4 20 rfl) k e.symm)
(fun e => sr_ne (ltlit 5 20 rfl) k e.symm) (sr_nr k q'),
F.2.2.2.2 2 (Or.inl (ltlit 2 7 rfl)) (nelit 2 0 rfl) (nelit 2 1 rfl) (nelit 2 4 rfl) (nelit 2 5 rfl)
(nr_ne (ltlit 2 20 rfl) q'),
F.2.2.2.2 3 (Or.inl (ltlit 3 7 rfl)) (nelit 3 0 rfl) (nelit 3 1 rfl) (nelit 3 4 rfl) (nelit 3 5 rfl)
(nr_ne (ltlit 3 20 rfl) q')⟩
/-! ## the guarded rules -/
def entry (M : TM) (q : Nat) (h : Bool) : Prog :=
match M.δ q h with
| none => clear 7
| some (q', w, d) => ifNZ (Sr q) 14 (ifNZ (Hr h) 16 (body q' w d))
theorem entry_none (M : TM) (q : Nat) (h : Bool) (hd : M.δ q h = none) : entry M q h = clear 7 := by
unfold entry
rw [hd]
theorem entry_some (M : TM) (q : Nat) (h : Bool) (q' : Nat) (w d : Bool) (hd : M.δ q h = some (q', w, d)) :
entry M q h = ifNZ (Sr q) 14 (ifNZ (Hr h) 16 (body q' w d)) := by
unfold entry
rw [hd]
theorem sr14 (q : Nat) : Sr q ≠ 14 := fun e => sr_ne (ltlit 14 20 rfl) q e.symm
theorem sr15 (q : Nat) : Sr q ≠ 14 + 1 := fun e => sr_ne (ltlit 15 20 rfl) q e.symm
theorem hr16 (h : Bool) : Hr h ≠ 16 := ne_lt (Nat.lt_trans (hr_lt h) (ltlit 7 16 rfl))
theorem hr17 (h : Bool) : Hr h ≠ 16 + 1 := ne_lt (Nat.lt_trans (hr_lt h) (ltlit 7 17 rfl))
theorem hr14 (h : Bool) : Hr h ≠ 14 := ne_lt (Nat.lt_trans (hr_lt h) (ltlit 7 14 rfl))
theorem hr15 (h : Bool) : Hr h ≠ 14 + 1 := ne_lt (Nat.lt_trans (hr_lt h) (ltlit 7 15 rfl))
theorem ag14 {s s' : Store} (f : ∀ q, q ≠ 14 → q ≠ 14 + 1 → s' q = s q) : Agree s s' :=
agree_off 14 (lelit 7 14 rfl) (ltlit (14 + 1) 20 rfl) f
theorem ag16 {s s' : Store} (f : ∀ q, q ≠ 16 → q ≠ 16 + 1 → s' q = s q) : Agree s s' :=
agree_off 16 (lelit 7 16 rfl) (ltlit (16 + 1) 20 rfl) f
theorem entry_skip (M : TM) (q : Nat) (h : Bool) (t : Store)
(hz : M.δ q h = none ∨ t (Sr q) = 0 ∨ t (Hr h) = 0) : ∃ t', Run (entry M q h) t t' ∧ Agree t t' := by
match hd : M.δ q h with
| none =>
rw [entry_none M q h hd]
match clear_ex 7 t with
| ⟨t', r, _, f⟩ => exact ⟨t', r, fun r' hr => f r' (ns_ne hr (lelit 7 7 rfl) (ltlit 7 20 rfl))⟩
| some (q', w, d) =>
rw [entry_some M q h q' w d hd]
have hz' : t (Sr q) = 0 ∨ t (Hr h) = 0 := hz.elim (fun e => nomatch hd.symm.trans e) id
cases hz' with
| inl hz0 =>
exact ifNZ_spec (Sr q) 14 _ (sr14 q) (sr15 q) t (Agree t) (fun hnz => absurd hz0 hnz)
(fun _ _ f0 => ag14 f0)
| inr hz0 =>
exact ifNZ_spec (Sr q) 14 _ (sr14 q) (sr15 q) t (Agree t)
(fun _ s0 h0 f0 _ =>
match ifNZ_spec (Hr h) 16 (body q' w d) (hr16 h) (hr17 h) s0 (fun s1 => s1 14 = 0 ∧ Agree t s1)
(fun hnz => absurd ((f0 (Hr h) (hr14 h) (hr15 h)).trans hz0) hnz)
(fun _ _ f1 => ⟨(f1 14 (nelit 14 16 rfl) (nelit 14 17 rfl)).trans h0, agree_trans (ag14 f0) (ag16 f1)⟩) with
| ⟨s1, r1, h14, ag⟩ => ⟨s1, r1, h14, ag⟩)
(fun _ _ f0 => ag14 f0)
theorem entry_fire (M : TM) (q : Nat) (h : Bool) (q' : Nat) (w d : Bool) (hd : M.δ q h = some (q', w, d))
(t : Store) (hs : t (Sr q) ≠ 0) (hh : t (Hr h) ≠ 0) : ∃ t', Run (entry M q h) t t' ∧ Fired q' w d t t' := by
rw [entry_some M q h q' w d hd]
exact ifNZ_spec (Sr q) 14 _ (sr14 q) (sr15 q) t (Fired q' w d t)
(fun _ s0 h0 f0 _ =>
match ifNZ_spec (Hr h) 16 (body q' w d) (hr16 h) (hr17 h) s0 (fun s1 => s1 14 = 0 ∧ Fired q' w d t s1)
(fun _ s0' h0' f0' _ => match body_spec q' w d s0' with
| ⟨s1, r1, F, rg⟩ => ⟨s1, r1, (rg 16 (lelit 14 16 rfl) (ltlit 16 20 rfl)).trans h0',
(rg 14 (lelit 14 14 rfl) (ltlit 14 20 rfl)).trans ((f0' 14 (nelit 14 16 rfl) (nelit 14 17 rfl)).trans h0),
fired_pre (agree_trans (ag14 f0) (ag16 f0')) F⟩)
(fun _ hz _ => absurd ((f0 (Hr h) (hr14 h) (hr15 h)).symm.trans hz) hh) with
| ⟨s1, r1, h14, F⟩ => ⟨s1, r1, h14, F⟩)
(fun _ hz _ => absurd hz hs)
/-! ## the dispatch over all rules -/
/-- the outcome of the dispatch for the current configuration -/
def Res (M : TM) (c : Cfg) (s t : Store) : Prop :=
match M.δ c.q c.h with
| none => Agree s t
| some (q', w, d) => Fired q' w d s t
theorem res_none {M : TM} {c : Cfg} {s t : Store} (hd : M.δ c.q c.h = none) (h : Agree s t) : Res M c s t := by
unfold Res
rw [hd]
exact h
theorem res_some {M : TM} {c : Cfg} {s t : Store} {q' : Nat} {w d : Bool} (hd : M.δ c.q c.h = some (q', w, d))
(h : Fired q' w d s t) : Res M c s t := by
unfold Res
rw [hd]
exact h
theorem none_res {M : TM} {c : Cfg} {s t : Store} (hd : M.δ c.q c.h = none) (h : Res M c s t) : Agree s t := by
unfold Res at h
rw [hd] at h
exact h
theorem some_res {M : TM} {c : Cfg} {s t : Store} {q' : Nat} {w d : Bool} (hd : M.δ c.q c.h = some (q', w, d))
(h : Res M c s t) : Fired q' w d s t := by
unfold Res at h
rw [hd] at h
exact h
theorem res_post {M : TM} {c : Cfg} {s t t' : Store} (h : Res M c s t) (ag : Agree t t') : Res M c s t' :=
match hd : M.δ c.q c.h with
| none => res_none hd (agree_trans (none_res hd h) ag)
| some (_, _, _) => res_some hd (fired_post (some_res hd h) ag)
theorem keep_res {M : TM} {c : Cfg} {s t : Store} (h : Res M c s t) :
(∀ k, t (Sr k) = s (Sr k)) ∧ t 2 = s 2 ∧ t 3 = s 3 :=
match hd : M.δ c.q c.h with
| none => have A := none_res hd h
⟨fun k => A _ (sr_NS k), A 2 (Or.inl (ltlit 2 7 rfl)), A 3 (Or.inl (ltlit 3 7 rfl))⟩
| some (_, _, _) => keep_fired (some_res hd h)
theorem pair_skip (M : TM) (n : Nat) (t : Store) (hz : ∀ h, M.δ n h = none ∨ t (Sr n) = 0 ∨ t (Hr h) = 0) :
∃ t', Run (.seq (entry M n false) (entry M n true)) t t' ∧ Agree t t' :=
match entry_skip M n false t (hz false) with
| ⟨t1, r1, a1⟩ =>
match entry_skip M n true t1 ((hz true).elim Or.inl (fun h => Or.inr (h.elim
(fun e => Or.inl ((a1 _ (sr_NS n)).trans e)) (fun e => Or.inr ((a1 _ (Or.inl (hr_lt true))).trans e))))) with
| ⟨t2, r2, a2⟩ => ⟨t2, .seq r1 r2, agree_trans a1 a2⟩
theorem pair_fire (M : TM) (n : Nat) (ch : Bool) (q' : Nat) (w d : Bool) (hd : M.δ n ch = some (q', w, d))
(t : Store) (hs : t (Sr n) ≠ 0) (hh : t (Hr ch) ≠ 0) (hoff : t (Hr (!ch)) = 0) :
∃ t', Run (.seq (entry M n false) (entry M n true)) t t' ∧ Fired q' w d t t' := by
cases ch with
| false =>
match entry_fire M n false q' w d hd t hs hh with
| ⟨t1, r1, F⟩ =>
match entry_skip M n true t1 (Or.inr (Or.inr ((keep_fired F).2.1.trans hoff))) with
| ⟨t2, r2, a2⟩ => exact ⟨t2, .seq r1 r2, fired_post F a2⟩
| true =>
match entry_skip M n false t (Or.inr (Or.inr hoff)) with
| ⟨t1, r1, a1⟩ =>
match entry_fire M n true q' w d hd t1 (fun e => hs ((a1 _ (sr_NS n)).symm.trans e))
(fun e => hh ((a1 _ (Or.inl (hr_lt true))).symm.trans e)) with
| ⟨t2, r2, F⟩ => exact ⟨t2, .seq r1 r2, fired_pre a1 F⟩
def disp (M : TM) : Nat → Prog
| 0 => clear 7
| n + 1 => .seq (disp M n) (.seq (entry M n false) (entry M n true))
theorem bool_cases : (a b : Bool) → a = b ∨ a ≠ b
| true, true => Or.inl rfl
| true, false => Or.inr (fun e => Bool.noConfusion e)
| false, true => Or.inr (fun e => Bool.noConfusion e)
| false, false => Or.inl rfl
theorem not_ne : (b : Bool) → (!b) ≠ b
| true => fun e => Bool.noConfusion e
| false => fun e => Bool.noConfusion e
theorem le_cases {n m : Nat} (h : n ≤ m) : n = m ∨ n < m := by
induction h with
| refl => exact Or.inl rfl
| step h _ => exact Or.inr (Nat.lt_succ_of_le h)
theorem disp_spec (M : TM) (c : Cfg) (s : Store) (e : Enc M c s) : (n : Nat) →
∃ t, Run (disp M n) s t ∧ (n ≤ c.q → Agree s t) ∧ (c.q < n → Res M c s t)
| 0 => match clear_ex 7 s with
| ⟨t, r, _, f⟩ => ⟨t, r, fun _ r' hr => f r' (ns_ne hr (lelit 7 7 rfl) (ltlit 7 20 rfl)),
fun h => absurd h (Nat.not_lt_zero _)⟩
| n + 1 => match disp_spec M c s e n with
| ⟨t, r, hA, hR⟩ => (Nat.lt_or_ge c.q n).elim
(fun hlt =>
have R := hR hlt
match pair_skip M n t (fun _ => Or.inr (Or.inl (((keep_res R).1 n).trans (e.so n (ne_gt hlt))))) with
| ⟨t2, r2, a2⟩ => ⟨t2, .seq r r2,
fun hle => absurd (Nat.lt_of_lt_of_le (Nat.lt_trans hlt (Nat.lt_succ_self n)) hle) (Nat.lt_irrefl _),
fun _ => res_post R a2⟩)
(fun hge =>
have A := hA hge
(le_cases hge).elim
(fun heq => by
refine match hd : M.δ c.q c.h with
| none => ?_
| some (q', w, d) => ?_
· match pair_skip M n t (fun h => (bool_cases h c.h).elim
(fun eh => Or.inl (by rw [heq, eh]; exact hd))
(fun ne => Or.inr (Or.inr ((A (Hr h) (Or.inl (hr_lt h))).trans (hr_off s c.h h e.h1 e.h0 ne))))) with
| ⟨t2, r2, a2⟩ =>
exact ⟨t2, .seq r r2, fun hle => absurd (heq ▸ hle) (Nat.not_succ_le_self c.q),
fun _ => res_none hd (agree_trans A a2)⟩
· have hd' : M.δ n c.h = some (q', w, d) := by rw [heq]; exact hd
have hs : t (Sr n) ≠ 0 := by
rw [heq, A _ (sr_NS c.q), e.sq]
exact fun e => Nat.noConfusion e
match pair_fire M n c.h q' w d hd' t hs
(fun z => hr_on s c.h e.h1 e.h0 ((A (Hr c.h) (Or.inl (hr_lt c.h))).symm.trans z))
((A (Hr (!c.h)) (Or.inl (hr_lt _))).trans (hr_off s c.h (!c.h) e.h1 e.h0 (not_ne c.h))) with
| ⟨t2, r2, F⟩ =>
exact ⟨t2, .seq r r2, fun hle => absurd (heq ▸ hle) (Nat.not_succ_le_self c.q),
fun _ => res_some hd (fired_pre A F)⟩)
(fun hlt =>
match pair_skip M n t (fun _ => Or.inr (Or.inl ((A _ (sr_NS n)).trans (e.so n (ne_lt hlt))))) with
| ⟨t2, r2, a2⟩ => ⟨t2, .seq r r2, fun _ => agree_trans A a2,
fun h => absurd hlt (Nat.not_lt_of_le (Nat.le_of_lt_succ h))⟩))
/-! ## moving the next state and head into place -/
def tailS : Nat → Prog
| 0 => clear 7
| n + 1 => .seq (tailS n) (mv (Sr n) (Nr n))
theorem tailS_spec : (n : Nat) → (s : Store) → ∃ t, Run (tailS n) s t ∧
(∀ k, k < n → t (Sr k) = s (Nr k) ∧ t (Nr k) = 0) ∧
(∀ r, r ≠ 7 → (∀ k, k < n → r ≠ Sr k ∧ r ≠ Nr k) → t r = s r)
| 0, s => match clear_ex 7 s with
| ⟨t, r, _, f⟩ => ⟨t, r, fun _ h => absurd h (Nat.not_lt_zero _), fun r' h7 _ => f r' h7⟩
| n + 1, s => match tailS_spec n s with
| ⟨t, r, hv, hf⟩ => match mv_spec (Sr n) (Nr n) (sr_nr n n) t with
| ⟨t', r', h1, h2, f'⟩ =>
have n7 : Nr n ≠ 7 := fun e => nr_ne (ltlit 7 20 rfl) n e.symm
⟨t', .seq r r', fun k hk => (le_cases (Nat.le_of_lt_succ hk)).elim
(fun e => by
subst e
exact ⟨h1.trans (hf _ n7 (fun j hj => ⟨fun e => sr_nr j k e.symm, fun e => ne_gt hj (nr_inj e)⟩)), h2⟩)
(fun hlt =>
have kn : k ≠ n := ne_lt hlt
⟨(f' _ (fun e => kn (sr_inj e)) (sr_nr k n)).trans (hv k hlt).1,
(f' _ (fun e => sr_nr n k e.symm) (fun e => kn (nr_inj e))).trans (hv k hlt).2⟩),
fun r0 h7 hn => (f' r0 (hn n (Nat.lt_succ_self n)).1 (hn n (Nat.lt_succ_self n)).2).trans
(hf r0 h7 (fun k hk => hn k (Nat.lt_trans hk (Nat.lt_succ_self n))))⟩
def tail (M : TM) : Prog :=
.seq (tailS M.nq) (.seq (mv 2 5) (.seq (clear 3) (.seq (.inc 3) (ifNZ 2 16 (.dec 3)))))
theorem bit_pos : (b : Bool) → bit b ≠ 0 → bit (!b) = 0
| true, _ => rfl
| false, h => absurd rfl h
theorem bit_zero : (b : Bool) → bit b = 0 → bit (!b) = 1
| true, h => Nat.noConfusion h
| false, _ => rfl
theorem tail_spec (M : TM) (s0 : Store) (q' : Nat) (b : Bool) (hq : q' < M.nq) (hN1 : s0 (Nr q') = 1)
(hN0 : ∀ k, k ≠ q' → s0 (Nr k) = 0) (hS0 : ∀ k, M.nq ≤ k → s0 (Sr k) = 0) (h5 : s0 5 = bit b) :
∃ s2, Run (tail M) s0 s2 ∧ Enc M ⟨q', s0 0, b, s0 1⟩ s2 ∧ s2 4 = s0 4 ∧ s2 14 = s0 14 :=
match tailS_spec M.nq s0 with
| ⟨t1, r1, hv, hf⟩ => match mv_spec 2 5 (nelit 2 5 rfl) t1 with
| ⟨t2, r2, h22, _, f2⟩ => match clear_ex 3 t2 with
| ⟨t3, r3, h33, f3⟩ =>
have v2 : upd t3 3 (t3 3 + 1) 2 = bit b := by
rw [upd_ne _ _ _ _ (nelit 2 3 rfl), f3 2 (nelit 2 3 rfl), h22,
hf 5 (nelit 5 7 rfl) (fun k _ => ⟨sr_ne (ltlit 5 20 rfl) k, nr_ne (ltlit 5 20 rfl) k⟩), h5]
have v3 : upd t3 3 (t3 3 + 1) 3 = 1 := by rw [upd_eq, h33]
match ifNZ_spec 2 16 (.dec 3) (nelit 2 16 rfl) (nelit 2 17 rfl) (upd t3 3 (t3 3 + 1))
(fun u => u 3 = bit (!b) ∧ ∀ q, q ≠ 3 → q ≠ 16 → q ≠ 16 + 1 → u q = upd t3 3 (t3 3 + 1) q)
(fun hnz s0' h0 f0 _ => ⟨upd s0' 3 (s0' 3 - 1), .dec,
by rw [upd_ne _ _ _ _ (nelit 16 3 rfl)]; exact h0,
by rw [upd_eq, f0 3 (nelit 3 16 rfl) (nelit 3 17 rfl), v3, bit_pos b (fun z => hnz (v2.trans z))],
fun q q3 q16 q17 => by rw [upd_ne _ _ _ _ q3, f0 q q16 q17]⟩)
(fun s0' hz f0 => ⟨by rw [f0 3 (nelit 3 16 rfl) (nelit 3 17 rfl), v3, bit_zero b (v2.symm.trans hz)],
fun q _ q16 q17 => f0 q q16 q17⟩) with
| ⟨u, ru, hu3, fu⟩ => by
have fr' : ∀ r, r ≠ 2 → r ≠ 3 → r ≠ 5 → r ≠ 16 → r ≠ 17 → u r = t1 r := fun r r2 r3 r5 r16 r17 => by
rw [fu r r3 r16 r17, upd_ne _ _ _ _ r3, f3 r r3, f2 r r2 r5]
have big : ∀ k, (Sr k ≠ 2 ∧ Sr k ≠ 3 ∧ Sr k ≠ 5 ∧ Sr k ≠ 16 ∧ Sr k ≠ 17) ∧
(Nr k ≠ 2 ∧ Nr k ≠ 3 ∧ Nr k ≠ 5 ∧ Nr k ≠ 16 ∧ Nr k ≠ 17) := fun k =>
⟨⟨fun e => sr_ne (ltlit 2 20 rfl) k e.symm, fun e => sr_ne (ltlit 3 20 rfl) k e.symm,
fun e => sr_ne (ltlit 5 20 rfl) k e.symm, fun e => sr_ne (ltlit 16 20 rfl) k e.symm,
fun e => sr_ne (ltlit 17 20 rfl) k e.symm⟩,
⟨fun e => nr_ne (ltlit 2 20 rfl) k e.symm, fun e => nr_ne (ltlit 3 20 rfl) k e.symm,
fun e => nr_ne (ltlit 5 20 rfl) k e.symm, fun e => nr_ne (ltlit 16 20 rfl) k e.symm,
fun e => nr_ne (ltlit 17 20 rfl) k e.symm⟩⟩
have uS : ∀ k, u (Sr k) = t1 (Sr k) := fun k =>
fr' _ (big k).1.1 (big k).1.2.1 (big k).1.2.2.1 (big k).1.2.2.2.1 (big k).1.2.2.2.2
have uN : ∀ k, u (Nr k) = t1 (Nr k) := fun k =>
fr' _ (big k).2.1 (big k).2.2.1 (big k).2.2.2.1 (big k).2.2.2.2.1 (big k).2.2.2.2.2
have low : ∀ r, r < 20 → r ≠ 7 → r ≠ 2 → r ≠ 3 → r ≠ 5 → r ≠ 16 → r ≠ 17 → u r = s0 r :=
fun r h20 r7 r2 r3 r5 r16 r17 => (fr' r r2 r3 r5 r16 r17).trans
(hf r r7 (fun k _ => ⟨sr_ne h20 k, nr_ne h20 k⟩))
refine ⟨u, .seq r1 (.seq r2 (.seq r3 (.seq .inc ru))), ⟨hq, ?_, ?_, ?_, hu3, ?_, ?_, ?_⟩, ?_, ?_⟩
· exact low 0 (ltlit 0 20 rfl) (nelit 0 7 rfl) (nelit 0 2 rfl) (nelit 0 3 rfl) (nelit 0 5 rfl)
(nelit 0 16 rfl) (nelit 0 17 rfl)
· exact low 1 (ltlit 1 20 rfl) (nelit 1 7 rfl) (nelit 1 2 rfl) (nelit 1 3 rfl) (nelit 1 5 rfl)
(nelit 1 16 rfl) (nelit 1 17 rfl)
· rw [fu 2 (nelit 2 3 rfl) (nelit 2 16 rfl) (nelit 2 17 rfl)]
exact v2
· show u (Sr q') = 1
rw [uS, (hv q' hq).1, hN1]
· intro k hk
rw [uS]
exact (Nat.lt_or_ge k M.nq).elim (fun hlt => (hv k hlt).1.trans (hN0 k hk))
(fun hge => (hf _ (fun e => sr_ne (ltlit 7 20 rfl) k e.symm)
(fun j hj => ⟨fun e => ne_gt (Nat.lt_of_lt_of_le hj hge) (sr_inj e), sr_nr k j⟩)).trans (hS0 k hge))
· intro k
rw [uN]
exact (Nat.lt_or_ge k M.nq).elim (fun hlt => (hv k hlt).2)
(fun hge => (hf _ (fun e => nr_ne (ltlit 7 20 rfl) k e.symm)
(fun j _ => ⟨fun e => sr_nr j k e.symm, fun e => ne_gt (Nat.lt_of_lt_of_le ‹j < M.nq› hge) (nr_inj e)⟩)).trans
(hN0 k (fun e => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (e ▸ hq) hge))))
· exact low 4 (ltlit 4 20 rfl) (nelit 4 7 rfl) (nelit 4 2 rfl) (nelit 4 3 rfl) (nelit 4 5 rfl)
(nelit 4 16 rfl) (nelit 4 17 rfl)
· exact low 14 (ltlit 14 20 rfl) (nelit 14 7 rfl) (nelit 14 2 rfl) (nelit 14 3 rfl) (nelit 14 5 rfl)
(nelit 14 16 rfl) (nelit 14 17 rfl)
/-! ## one step and the run -/
def step (M : TM) : Prog := .seq (clear 4) (.seq (disp M M.nq) (ifNZ 4 14 (tail M)))
theorem enc_frame {M : TM} {c : Cfg} {s t : Store} (e : Enc M c s) (f : ∀ r, NS r → r ≠ 4 → r ≠ 5 → t r = s r) :
Enc M c t :=
⟨e.lq,
(f 0 (Or.inl (ltlit 0 7 rfl)) (nelit 0 4 rfl) (nelit 0 5 rfl)).trans e.eL,
(f 1 (Or.inl (ltlit 1 7 rfl)) (nelit 1 4 rfl) (nelit 1 5 rfl)).trans e.eR,
(f 2 (Or.inl (ltlit 2 7 rfl)) (nelit 2 4 rfl) (nelit 2 5 rfl)).trans e.h1,
(f 3 (Or.inl (ltlit 3 7 rfl)) (nelit 3 4 rfl) (nelit 3 5 rfl)).trans e.h0,
(f _ (sr_NS _) (fun z => sr_ne (ltlit 4 20 rfl) _ z.symm) (fun z => sr_ne (ltlit 5 20 rfl) _ z.symm)).trans e.sq,
fun q hq => (f _ (sr_NS q) (fun z => sr_ne (ltlit 4 20 rfl) _ z.symm) (fun z => sr_ne (ltlit 5 20 rfl) _ z.symm)).trans (e.so q hq),
fun q => (f _ (nr_NS q) (fun z => nr_ne (ltlit 4 20 rfl) _ z.symm) (fun z => nr_ne (ltlit 5 20 rfl) _ z.symm)).trans (e.n0 q)⟩
/-- a halted machine: the step program leaves the encoding and lowers the flag -/
theorem step_halt (M : TM) (c : Cfg) (s : Store) (e : Enc M c s) (hd : M.δ c.q c.h = none) :
∃ s', Run (step M) s s' ∧ Enc M c s' ∧ s' 4 = 0 :=
match clear_ex 4 s with
| ⟨s1, r1, h14, f1⟩ =>
have e1 : Enc M c s1 := enc_frame e (fun r _ r4 _ => f1 r r4)
match disp_spec M c s1 e1 M.nq with
| ⟨t, rt, _, hR⟩ =>
have A := none_res hd (hR e1.lq)
have t4 : t 4 = 0 := (A 4 (Or.inl (ltlit 4 7 rfl))).trans h14
match ifNZ_spec 4 14 (tail M) (nelit 4 14 rfl) (nelit 4 15 rfl) t (fun u => Agree t u)
(fun hnz => absurd t4 hnz) (fun _ _ f => ag14 f) with
| ⟨u, ru, au⟩ => ⟨u, .seq r1 (.seq rt ru),
enc_frame e1 (fun r hr _ _ => (au r hr).trans (A r hr)),
(au 4 (Or.inl (ltlit 4 7 rfl))).trans t4⟩
theorem cond_x (t : Store) (d : Bool) : t (xd d) = cond d (t 0) (t 1) := by
cases d with
| true => rfl
| false => rfl
/-- the tape relation of a fired rule is a machine step -/
theorem step_of {M : TM} {c : Cfg} {q' : Nat} {w d : Bool} (hd : M.δ c.q c.h = some (q', w, d))
(s1 t : Store) (b : Bool) (eL : s1 0 = c.L) (eR : s1 1 = c.R)
(hx : t (xd d) = 2 * s1 (xd d) + bit w) (hy : s1 (yd d) = 2 * t (yd d) + bit b) :
Step M c ⟨q', t 0, b, t 1⟩ := by
cases d with
| true =>
have hx' : t 0 = 2 * c.L + bit w := by rw [← eL]; exact hx
have hy' : c.R = 2 * t 1 + bit b := by rw [← eR]; exact hy
rw [hx']
exact Step.right hd hy'
| false =>
have hx' : t 1 = 2 * c.R + bit w := by rw [← eR]; exact hx
have hy' : c.L = 2 * t 0 + bit b := by rw [← eL]; exact hy
rw [hx']
exact Step.left hd hy'
/-- a rule fires: the step program simulates the machine step -/
theorem step_fire (M : TM) (wf : WF M) (c : Cfg) (s : Store) (e : Enc M c s) (q' : Nat) (w d : Bool)
(hd : M.δ c.q c.h = some (q', w, d)) :
∃ c', Step M c c' ∧ ∃ s', Run (step M) s s' ∧ Enc M c' s' ∧ s' 4 ≠ 0 :=
match clear_ex 4 s with
| ⟨s1, r1, h14, f1⟩ =>
have e1 : Enc M c s1 := enc_frame e (fun r _ r4 _ => f1 r r4)
match disp_spec M c s1 e1 M.nq with
| ⟨t, rt, _, hR⟩ =>
have F := some_res hd (hR e1.lq)
match F with
| ⟨hx, ⟨b, hb5, hy⟩, hn, h4, fF⟩ =>
have t4 : t 4 ≠ 0 := fun z => Nat.noConfusion (h4.symm.trans z)
have kp := keep_fired F
match ifNZ_spec 4 14 (tail M) (nelit 4 14 rfl) (nelit 4 15 rfl) t
(fun u => Enc M ⟨q', t 0, b, t 1⟩ u ∧ u 4 ≠ 0)
(fun _ s0 h0 f0 _ =>
have ag : Agree t s0 := ag14 f0
match tail_spec M s0 q' b (wf _ _ _ _ _ hd)
(by rw [ag _ (nr_NS q'), hn, e1.n0 q'])
(fun k hk => by
rw [ag _ (nr_NS k), fF _ (nr_NS k) (fun z => nr_ne (ltlit 0 20 rfl) k z.symm)
(fun z => nr_ne (ltlit 1 20 rfl) k z.symm) (fun z => nr_ne (ltlit 4 20 rfl) k z.symm)
(fun z => nr_ne (ltlit 5 20 rfl) k z.symm) (fun z => hk (nr_inj z)), e1.n0 k])
(fun k hk => by
rw [ag _ (sr_NS k), kp.1 k]
exact e1.so k (fun z => Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (z ▸ e1.lq) hk)))
(by rw [ag 5 (Or.inl (ltlit 5 7 rfl)), hb5]) with
| ⟨s2, r2, E, h24, h214⟩ => by
rw [ag 0 (Or.inl (ltlit 0 7 rfl)), ag 1 (Or.inl (ltlit 1 7 rfl))] at E
exact ⟨s2, r2, h214.trans h0, E, by rw [h24, ag 4 (Or.inl (ltlit 4 7 rfl))]; exact t4⟩)
(fun _ hz _ => absurd hz t4) with
| ⟨u, ru, E, hu4⟩ => ⟨⟨q', t 0, b, t 1⟩, step_of hd s1 t b e1.eL e1.eR hx hy, u, .seq r1 (.seq rt ru), E, hu4⟩
theorem step_det {M : TM} {c c1 c2 : Cfg} (h1 : Step M c c1) (h2 : Step M c c2) : c1 = c2 := by
cases h1 with
| @right q1 w1 b1 R1 hd1 hr1 => cases h2 with
| @right q2 w2 b2 R2 hd2 hr2 =>
have e := Option.some.inj (hd1.symm.trans hd2)
have eq : q1 = q2 := congrArg Prod.fst e
have ew : w1 = w2 := congrArg (fun p => p.2.1) e
have hh := half_det R1 R2 b1 b2 (hr1.symm.trans hr2)
rw [eq, ew, hh.1, hh.2]
| @left q2 w2 b2 L2 hd2 _ =>
exact Bool.noConfusion (congrArg (fun p => p.2.2) (Option.some.inj (hd1.symm.trans hd2)))
| @left q1 w1 b1 L1 hd1 hl1 => cases h2 with
| @right q2 w2 b2 R2 hd2 _ =>
exact Bool.noConfusion (congrArg (fun p => p.2.2) (Option.some.inj (hd1.symm.trans hd2)))
| @left q2 w2 b2 L2 hd2 hl2 =>
have e := Option.some.inj (hd1.symm.trans hd2)
have eq : q1 = q2 := congrArg Prod.fst e
have ew : w1 = w2 := congrArg (fun p => p.2.1) e
have hh := half_det L1 L2 b1 b2 (hl1.symm.trans hl2)
rw [eq, ew, hh.1, hh.2]
theorem step_rule {M : TM} {a b : Cfg} (h : Step M a b) : ∃ q' w d, M.δ a.q a.h = some (q', w, d) := by
cases h with
| right hd _ => exact ⟨_, _, _, hd⟩
| left hd _ => exact ⟨_, _, _, hd⟩
/-- a halting run of the machine is simulated by `while flag (step)` -/
theorem run_sim (M : TM) (wf : WF M) {c c' : Cfg} (hr : Reach M c c') (hh : Halted M c') :
∀ s, Enc M c s → s 4 ≠ 0 → ∃ s', Run (.loop 4 (step M)) s s' ∧ Enc M c' s' := by
induction hr with
| refl c =>
intro s e h4
match step_halt M c s e hh with
| ⟨s1, r1, e1, z⟩ => exact ⟨s1, .loopS h4 r1 (.loopZ z), e1⟩
| @step a b _ hab _ ih =>
intro s e h4
match step_rule hab with
| ⟨q', w, d, hd⟩ =>
match step_fire M wf a s e q' w d hd with
| ⟨c'', hs, s1, r1, e1, h41⟩ =>
have eb : c'' = b := step_det hs hab
rw [eb] at e1
match ih hh s1 e1 h41 with
| ⟨s', r', e'⟩ => exact ⟨s', .loopS h4 r1 r', e'⟩
/-- the simulating register program -/
def prog (M : TM) : Prog := .seq (.inc 4) (.loop 4 (step M))
/-- Turing machines → register machines: every halting run of a (well-formed) Turing machine is
simulated by the register program, from any store encoding the start configuration to a store
encoding the halting configuration -/
theorem tm_to_register (M : TM) (wf : WF M) {c c' : Cfg} (hr : Reach M c c') (hh : Halted M c')
(s : Store) (e : Enc M c s) : ∃ s', Run (prog M) s s' ∧ Enc M c' s' :=
match run_sim M wf hr hh (upd s 4 (s 4 + 1)) (enc_frame e (fun r _ r4 _ => upd_ne s 4 _ r r4))
(by rw [upd_eq]; exact fun z => Nat.noConfusion z) with
| ⟨s', r', e'⟩ => ⟨s', .seq .inc r', e'⟩
end TMS
end Found
#print axioms Found.TMS.half_det
#print axioms Found.TMS.sr_inj
#print axioms Found.TMS.nr_inj
#print axioms Found.TMS.sr_nr
#print axioms Found.TMS.hr_on
#print axioms Found.TMS.hr_off
#print axioms Found.TMS.body_gen
#print axioms Found.TMS.body_spec
#print axioms Found.TMS.fired_pre
#print axioms Found.TMS.fired_post
#print axioms Found.TMS.keep_fired
#print axioms Found.TMS.entry_skip
#print axioms Found.TMS.entry_fire
#print axioms Found.TMS.res_post
#print axioms Found.TMS.keep_res
#print axioms Found.TMS.pair_skip
#print axioms Found.TMS.pair_fire
#print axioms Found.TMS.le_cases
#print axioms Found.TMS.disp_spec
#print axioms Found.TMS.tailS_spec
#print axioms Found.TMS.tail_spec
#print axioms Found.TMS.enc_frame
#print axioms Found.TMS.step_halt
#print axioms Found.TMS.step_of
#print axioms Found.TMS.step_fire
#print axioms Found.TMS.step_det
#print axioms Found.TMS.step_rule
#print axioms Found.TMS.run_sim
#print axioms Found.TMS.tm_to_register
lean_all/found/TemporalEpistemic.lean
/-
T72. found/TemporalEpistemic — tense and epistemic logic as operators on
the predicate lattice Ω^W of a frame.
* Tense: G ψ (always in the future), H ψ (always in the past), F, P their
duals. Condition: they come in Galois adjunctions P ⊣ G and F ⊣ H
(the same adjunction ∃_f ⊣ f* ⊣ ∀_f pattern as quantifiers, for the
relation R); hence φ → G P φ, φ → H F φ, and monotonicity.
* Epistemic S5_n: knowledge K_i on equivalence frames satisfies T, 4, 5;
everybody-knows E, and common knowledge C φ is the greatest fixed point
of ψ ↦ E (φ ∧ ψ) (post-fixed, and above every post-fixed point).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Modal
namespace Found
namespace Tense
variable {W : Type} (R : W → W → Prop)
def G (ψ : W → Prop) : W → Prop := fun w => ∀ v, R w v → ψ v
def H (ψ : W → Prop) : W → Prop := fun w => ∀ v, R v w → ψ v
def F (φ : W → Prop) : W → Prop := fun w => ∃ v, R w v ∧ φ v
def P (φ : W → Prop) : W → Prop := fun w => ∃ v, R v w ∧ φ v
def Le (φ ψ : W → Prop) : Prop := ∀ w, φ w → ψ w
/-- P ⊣ G -/
theorem P_adj_G (φ ψ : W → Prop) : Le (P R φ) ψ ↔ Le φ (G R ψ) :=
⟨fun h w x v r => h v ⟨w, r, x⟩, fun h w ⟨v, r, x⟩ => h v x w r⟩
/-- F ⊣ H -/
theorem F_adj_H (φ ψ : W → Prop) : Le (F R φ) ψ ↔ Le φ (H R ψ) :=
⟨fun h w x v r => h v ⟨w, r, x⟩, fun h w ⟨v, r, x⟩ => h v x w r⟩
/-- tense axiom φ → G P φ (unit of P ⊣ G) -/
theorem unit_GP (φ : W → Prop) : Le φ (G R (P R φ)) := (P_adj_G R φ (P R φ)).mp (fun _ x => x)
/-- tense axiom φ → H F φ (unit of F ⊣ H) -/
theorem unit_HF (φ : W → Prop) : Le φ (H R (F R φ)) := (F_adj_H R φ (F R φ)).mp (fun _ x => x)
/-- counits: P G ψ → ψ and F H ψ → ψ -/
theorem counit_PG (ψ : W → Prop) : Le (P R (G R ψ)) ψ := (P_adj_G R (G R ψ) ψ).mpr (fun _ x => x)
theorem counit_FH (ψ : W → Prop) : Le (F R (H R ψ)) ψ := (F_adj_H R (H R ψ) ψ).mpr (fun _ x => x)
theorem G_mono {φ ψ : W → Prop} (h : Le φ ψ) : Le (G R φ) (G R ψ) := fun _ x v r => h v (x v r)
/-- G preserves meets (axiom K) -/
theorem G_and (φ ψ : W → Prop) : Le (fun w => G R φ w ∧ G R ψ w) (G R (fun w => φ w ∧ ψ w)) :=
fun _ x v r => ⟨x.1 v r, x.2 v r⟩
end Tense
namespace Epist
variable {W A : Type} (R : A → W → W → Prop)
def K (i : A) (φ : W → Prop) : W → Prop := fun w => ∀ v, R i w v → φ v
def E (φ : W → Prop) : W → Prop := fun w => ∀ i v, R i w v → φ v
inductive Reach : W → W → Prop where
| one {i w v} : R i w v → Reach w v
| step {i w u v} : R i w u → Reach u v → Reach w v
def C (φ : W → Prop) : W → Prop := fun w => ∀ v, Reach R w v → φ v
/-- knowledge on equivalence frames: T, 4, 5 -/
theorem K_T (i : A) (hr : Modal.Refl (R i)) (φ : W → Prop) (w : W) : K R i φ w → φ w :=
fun h => h w (hr w)
theorem K_4 (i : A) (ht : Modal.Trans (R i)) (φ : W → Prop) (w : W) : K R i φ w → K R i (K R i φ) w :=
fun h v r u r' => h u (ht w v u r r')
theorem K_5 (i : A) (he : Modal.Eucl (R i)) (φ : W → Prop) (w : W) :
(∃ v, R i w v ∧ φ v) → K R i (fun u => ∃ v, R i u v ∧ φ v) w :=
fun ⟨v, r, x⟩ u r' => ⟨v, he w u v r' r, x⟩
/-- common knowledge is a post-fixed point of ψ ↦ E (φ ∧ ψ) -/
theorem C_fix (φ : W → Prop) (w : W) : C R φ w → E R (fun v => φ v ∧ C R φ v) w :=
fun h _ v r => ⟨h v (.one r), fun u k => h u (.step r k)⟩
/-- and it is the greatest one (induction rule) -/
theorem C_greatest (φ ψ : W → Prop) (hψ : ∀ w, ψ w → E R (fun v => φ v ∧ ψ v) w) :
∀ w, ψ w → C R φ w := by
intro w x v k
induction k with
| one r => exact (hψ _ x _ _ r).1
| step r _ ih => exact ih (hψ _ x _ _ r).2
/-- C φ implies everybody knows φ -/
theorem C_E (φ : W → Prop) (w : W) : C R φ w → E R φ w := fun h _ v r => h v (.one r)
end Epist
end Found
#print axioms Found.Tense.P_adj_G
#print axioms Found.Tense.F_adj_H
#print axioms Found.Tense.unit_GP
#print axioms Found.Tense.unit_HF
#print axioms Found.Tense.counit_PG
#print axioms Found.Tense.counit_FH
#print axioms Found.Tense.G_mono
#print axioms Found.Tense.G_and
#print axioms Found.Epist.K_T
#print axioms Found.Epist.K_4
#print axioms Found.Epist.K_5
#print axioms Found.Epist.C_fix
#print axioms Found.Epist.C_greatest
#print axioms Found.Epist.C_E
lean_all/found/Top1.lean
/-
T193 (topological), part 1. found/Top1 — ordered fields (a commutative
ring with inverses of nonzero elements and a strict total order compatible
with + and ·), and the one-variable facts the plane geometry needs:
* order lemmas (differences, negation, products, inverses);
* the intermediate value theorem for affine functions
t ↦ a + t·(b − a): a sign change on [0, 1] has a zero t* = −a/(b − a);
* an affine function without zero on [0, 1] keeps its sign;
* convex combinations of strictly ordered pairs stay strictly ordered.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import lib.RingTac
namespace Found
namespace TP
open DetChain LibRing
structure OF where
K : Type
R : CRing K
lt : K → K → Prop
inv : K → K
mul_inv : ∀ a, a ≠ R.zero → R.mul a (inv a) = R.one
irr : ∀ a, ¬ lt a a
trans : ∀ a b c, lt a b → lt b c → lt a c
tri : ∀ a b, lt a b ∨ a = b ∨ lt b a
add_lt : ∀ a b c, lt a b → lt (R.add a c) (R.add b c)
mul_pos : ∀ a b, lt R.zero a → lt R.zero b → lt R.zero (R.mul a b)
zero_lt_one : lt R.zero R.one
variable (F : OF)
def le (a b : F.K) : Prop := F.lt a b ∨ a = b
/-- the affine function through a (at 0) and b (at 1) -/
def lin (a b t : F.K) : F.K := F.R.add a (F.R.mul t (sub F.R b a))
theorem lt_asymm {a b : F.K} (h : F.lt a b) : ¬ F.lt b a := fun h' => F.irr a (F.trans a b a h h')
theorem lt_ne {a b : F.K} (h : F.lt a b) : a ≠ b := fun e => F.irr a (by rw [← e] at h; exact h)
theorem sub_pos {a b : F.K} (h : F.lt a b) : F.lt F.R.zero (sub F.R b a) := by
have := F.add_lt a b (F.R.neg a) h
rw [show F.R.add a (F.R.neg a) = F.R.zero by lib_ring] at this
exact this
theorem pos_sub {a b : F.K} (h : F.lt F.R.zero (sub F.R b a)) : F.lt a b := by
have := F.add_lt _ _ a h
rw [show F.R.add F.R.zero a = a by lib_ring, show F.R.add (sub F.R b a) a = b by lib_ring] at this
exact this
theorem neg_pos {a : F.K} (h : F.lt a F.R.zero) : F.lt F.R.zero (F.R.neg a) := by
have := sub_pos F h
rw [show sub F.R F.R.zero a = F.R.neg a by lib_ring] at this
exact this
theorem mul_lt_pos {a b c : F.K} (hc : F.lt F.R.zero c) (h : F.lt a b) : F.lt (F.R.mul a c) (F.R.mul b c) := by
apply pos_sub F
rw [show sub F.R (F.R.mul b c) (F.R.mul a c) = F.R.mul (sub F.R b a) c by lib_ring]
exact F.mul_pos _ _ (sub_pos F h) hc
theorem zero_ne_one : F.R.zero ≠ F.R.one := lt_ne F F.zero_lt_one
theorem inv_pos {a : F.K} (h : F.lt F.R.zero a) : F.lt F.R.zero (F.inv a) := by
have ha : a ≠ F.R.zero := fun e => F.irr _ (by rw [e] at h; exact h)
have hm := F.mul_inv a ha
match F.tri F.R.zero (F.inv a) with
| .inl hp => exact hp
| .inr (.inl e) =>
rw [← e, show F.R.mul a F.R.zero = F.R.zero by lib_ring] at hm
exact absurd hm (zero_ne_one F)
| .inr (.inr hn) =>
have h2 := F.mul_pos _ _ h (neg_pos F hn)
rw [show F.R.mul a (F.R.neg (F.inv a)) = F.R.neg (F.R.mul a (F.inv a)) by lib_ring, hm] at h2
have h3 := F.add_lt _ _ F.R.one h2
rw [show F.R.add F.R.zero F.R.one = F.R.one by lib_ring,
show F.R.add (F.R.neg F.R.one) F.R.one = F.R.zero by lib_ring] at h3
exact absurd F.zero_lt_one (lt_asymm F h3)
theorem lt_of_le_of_lt {a b c : F.K} (h1 : le F a b) (h2 : F.lt b c) : F.lt a c :=
h1.elim (fun h => F.trans a b c h h2) (fun e => e ▸ h2)
theorem lt_of_lt_of_le {a b c : F.K} (h1 : F.lt a b) (h2 : le F b c) : F.lt a c :=
h2.elim (fun h => F.trans a b c h1 h) (fun e => e ▸ h1)
theorem add_pos {a b : F.K} (ha : F.lt F.R.zero a) (hb : F.lt F.R.zero b) : F.lt F.R.zero (F.R.add a b) := by
have h := F.add_lt _ _ b ha
rw [show F.R.add F.R.zero b = b by lib_ring] at h
exact F.trans _ _ _ hb h
theorem add_nn_pos {a b : F.K} (ha : le F F.R.zero a) (hb : F.lt F.R.zero b) : F.lt F.R.zero (F.R.add a b) :=
ha.elim (fun h => add_pos F h hb) (fun e => by rw [← e, show F.R.add F.R.zero b = b by lib_ring]; exact hb)
theorem mul_nn {a b : F.K} (ha : le F F.R.zero a) (hb : le F F.R.zero b) : le F F.R.zero (F.R.mul a b) :=
ha.elim (fun h => hb.elim (fun h' => .inl (F.mul_pos _ _ h h'))
(fun e => .inr (by rw [← e, show F.R.mul a F.R.zero = F.R.zero by lib_ring])))
(fun e => .inr (by rw [← e, show F.R.mul F.R.zero b = F.R.zero by lib_ring]))
/-! ## affine functions on [0, 1] -/
theorem ivt_lin {a b : F.K} (ha : F.lt a F.R.zero) (hb : F.lt F.R.zero b) :
∃ t, F.lt F.R.zero t ∧ F.lt t F.R.one ∧ lin F a b t = F.R.zero := by
have hd : F.lt F.R.zero (sub F.R b a) := sub_pos F (F.trans _ _ _ ha hb)
have hdne : sub F.R b a ≠ F.R.zero := fun e => F.irr _ (by rw [e] at hd; exact hd)
have hi := F.mul_inv _ hdne
refine ⟨F.R.mul (F.R.neg a) (F.inv (sub F.R b a)), F.mul_pos _ _ (neg_pos F ha) (inv_pos F hd), ?_, ?_⟩
· apply pos_sub F
have e : sub F.R F.R.one (F.R.mul (F.R.neg a) (F.inv (sub F.R b a))) = F.R.mul b (F.inv (sub F.R b a)) := by
calc sub F.R F.R.one (F.R.mul (F.R.neg a) (F.inv (sub F.R b a)))
= sub F.R (F.R.mul (sub F.R b a) (F.inv (sub F.R b a))) (F.R.mul (F.R.neg a) (F.inv (sub F.R b a))) := by rw [hi]
_ = F.R.mul b (F.inv (sub F.R b a)) := by lib_ring
rw [e]
exact F.mul_pos _ _ hb (inv_pos F hd)
· unfold lin
calc F.R.add a (F.R.mul (F.R.mul (F.R.neg a) (F.inv (sub F.R b a))) (sub F.R b a))
= F.R.add a (F.R.mul (F.R.neg a) (F.R.mul (sub F.R b a) (F.inv (sub F.R b a)))) := by lib_ring
_ = F.R.zero := by rw [hi]; lib_ring
def In01 (t : F.K) : Prop := le F F.R.zero t ∧ le F t F.R.one
theorem lin_zero (a b : F.K) : lin F a b F.R.zero = a := by unfold lin; lib_ring
theorem lin_one (a b : F.K) : lin F a b F.R.one = b := by unfold lin; lib_ring
/-- an affine function without zero on [0, 1] keeps its sign -/
theorem keep_neg {a b : F.K} (hz : ∀ t, In01 F t → lin F a b t ≠ F.R.zero) (ha : F.lt a F.R.zero) : F.lt b F.R.zero :=
match F.tri b F.R.zero with
| .inl h => h
| .inr (.inl e) => absurd (by rw [lin_one, e]) (hz F.R.one ⟨.inl F.zero_lt_one, .inr rfl⟩)
| .inr (.inr h) => match ivt_lin F ha h with
| ⟨t, h0, h1, e⟩ => absurd e (hz t ⟨.inl h0, .inl h1⟩)
theorem neg_lin (a b t : F.K) : lin F (F.R.neg a) (F.R.neg b) t = F.R.neg (lin F a b t) := by unfold lin; lib_ring
theorem keep_pos {a b : F.K} (hz : ∀ t, In01 F t → lin F a b t ≠ F.R.zero) (ha : F.lt F.R.zero a) : F.lt F.R.zero b := by
have hn : F.lt (F.R.neg a) F.R.zero := by
have := F.add_lt _ _ (F.R.neg a) ha
rw [show F.R.add F.R.zero (F.R.neg a) = F.R.neg a by lib_ring, show F.R.add a (F.R.neg a) = F.R.zero by lib_ring] at this
exact this
have h := keep_neg F (a := F.R.neg a) (b := F.R.neg b) (fun t ht e => hz t ht (by
rw [neg_lin] at e
calc lin F a b t = F.R.neg (F.R.neg (lin F a b t)) := by lib_ring
_ = F.R.zero := by rw [e]; lib_ring)) hn
have := neg_pos F h
rw [show F.R.neg (F.R.neg b) = b by lib_ring] at this
exact this
/-- convex combinations keep a strict order -/
theorem lin_lt {a b c d t : F.K} (h1 : F.lt a c) (h2 : F.lt b d) (ht : In01 F t) :
F.lt (lin F a b t) (lin F c d t) := by
apply pos_sub F
have e : sub F.R (lin F c d t) (lin F a b t) =
F.R.add (F.R.mul (sub F.R F.R.one t) (sub F.R c a)) (F.R.mul t (sub F.R d b)) := by unfold lin; lib_ring
rw [e]
have h1t : le F F.R.zero (sub F.R F.R.one t) := ht.2.elim (fun h => .inl (sub_pos F h))
(fun e => .inr (by rw [e]; lib_ring))
match ht.1 with
| .inl hp => exact add_nn_pos F (mul_nn F h1t (.inl (sub_pos F h1))) (F.mul_pos _ _ hp (sub_pos F h2))
| .inr e =>
rw [← e, show F.R.add (F.R.mul (sub F.R F.R.one F.R.zero) (sub F.R c a)) (F.R.mul F.R.zero (sub F.R d b))
= sub F.R c a by lib_ring]
exact sub_pos F h1
end TP
end Found
#print axioms Found.TP.inv_pos
#print axioms Found.TP.ivt_lin
#print axioms Found.TP.keep_neg
#print axioms Found.TP.keep_pos
#print axioms Found.TP.lin_lt
lean_all/found/Top10.lean
/-
T193 (topological), part 10. found/Top10 — the layers of the swapping
boxes P (below, its bar left of Q's bar at the meeting time) and Q, before and after:
the passing segments split by their position at the meeting time into
X (left of P), M (between), Y (right of Q); then
before: P sees X | M, inputs of Q, Y; Q sees X, outputs of P, M | Y;
after: Q sees X, inputs of P, M | Y; P sees X | M, outputs of Q, Y.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top9
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- the x of a segment at the meeting -/
def vst (G0 G1 : Drw F S) (P : Nat) (ts : F.K) (e : Nat × Nat) : F.K := lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts
/-- the classes of passing segments by their position at the meeting -/
def CX (G0 G1 : Drw F S) (P Q : Nat) (ts : F.K) (e : Nat × Nat) : Prop :=
Pass G0 P Q e ∧ F.lt (vst G0 G1 P ts e) (G0.px P)
def CM (G0 G1 : Drw F S) (P Q : Nat) (ts : F.K) (e : Nat × Nat) : Prop :=
Pass G0 P Q e ∧ F.lt (xr G0 P) (vst G0 G1 P ts e) ∧ F.lt (vst G0 G1 P ts e) (G0.px Q)
def CY (G0 G1 : Drw F S) (P Q : Nat) (ts : F.K) (e : Nat × Nat) : Prop :=
Pass G0 P Q e ∧ F.lt (xr G0 Q) (vst G0 G1 P ts e)
section W
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q) {ts : F.K}
include sw
theorem vst_Q (hmt : (Fm ts).py P = (Fm ts).py Q) {e : Nat × Nat} (he : Seg G0 e) : lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts = vst G0 G1 P ts e :=
(meet_X sw e he hmt).symm
theorem sP0 (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) {e : Nat × Nat} (hp : Pass G0 P Q e) :
(F.lt (X G0 e (G0.py P)) (G0.px P) ↔ F.lt (vst G0 G1 P ts e) (G0.px P)) ∧
(F.lt (xr G0 P) (X G0 e (G0.py P)) ↔ F.lt (xr G0 P) (vst G0 G1 P ts e)) :=
⟨(same_side (pass_sides sw hp).1.1 ts (in_open t0 t1)).1, (same_side (pass_sides sw hp).1.2 ts (in_open t0 t1)).2⟩
theorem sQ0 (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q) {e : Nat × Nat} (hp : Pass G0 P Q e) :
(F.lt (X G0 e (G0.py Q)) (G0.px Q) ↔ F.lt (vst G0 G1 P ts e) (G0.px Q)) ∧
(F.lt (xr G0 Q) (X G0 e (G0.py Q)) ↔ F.lt (xr G0 Q) (vst G0 G1 P ts e)) := by
have a := (same_side (pass_sides sw hp).2.1 ts (in_open t0 t1)).1
have b := (same_side (pass_sides sw hp).2.2 ts (in_open t0 t1)).2
rw [vst_Q sw hmt hp.1] at a b; exact ⟨a, b⟩
theorem sP1 (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) {e : Nat × Nat} (hp : Pass G0 P Q e) :
(F.lt (X G1 e (G1.py P)) (G0.px P) ↔ F.lt (vst G0 G1 P ts e) (G0.px P)) ∧
(F.lt (xr G0 P) (X G1 e (G1.py P)) ↔ F.lt (xr G0 P) (vst G0 G1 P ts e)) := by
have a1 := (same_side (pass_sides sw hp).1.1 ts (in_open t0 t1)).1
have b1 := (same_side (pass_sides sw hp).1.1 F.R.one in1).1
have a2 := (same_side (pass_sides sw hp).1.2 ts (in_open t0 t1)).2
have b2 := (same_side (pass_sides sw hp).1.2 F.R.one in1).2
rw [lin1] at b1 b2
exact ⟨b1.symm.trans a1, b2.symm.trans a2⟩
theorem sQ1 (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q) {e : Nat × Nat} (hp : Pass G0 P Q e) :
(F.lt (X G1 e (G1.py Q)) (G0.px Q) ↔ F.lt (vst G0 G1 P ts e) (G0.px Q)) ∧
(F.lt (xr G0 Q) (X G1 e (G1.py Q)) ↔ F.lt (xr G0 Q) (vst G0 G1 P ts e)) := by
have a1 := (same_side (pass_sides sw hp).2.1 ts (in_open t0 t1)).1
have b1 := (same_side (pass_sides sw hp).2.1 F.R.one in1).1
have a2 := (same_side (pass_sides sw hp).2.2 ts (in_open t0 t1)).2
have b2 := (same_side (pass_sides sw hp).2.2 F.R.one in1).2
rw [lin1] at b1 b2
rw [vst_Q sw hmt hp.1] at a1 a2
exact ⟨b1.symm.trans a1, b2.symm.trans a2⟩
/-- passing segments are ordered alike at both heights, before and after -/
theorem pord (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q) {e e' : Nat × Nat} (hp : Pass G0 P Q e) (hp' : Pass G0 P Q e') (hne : e ≠ e') :
(F.lt (X G0 e (G0.py P)) (X G0 e' (G0.py P)) ↔ F.lt (vst G0 G1 P ts e) (vst G0 G1 P ts e')) ∧
(F.lt (X G0 e (G0.py Q)) (X G0 e' (G0.py Q)) ↔ F.lt (vst G0 G1 P ts e) (vst G0 G1 P ts e')) ∧
(F.lt (X G1 e (G1.py P)) (X G1 e' (G1.py P)) ↔ F.lt (vst G0 G1 P ts e) (vst G0 G1 P ts e')) ∧
(F.lt (X G1 e (G1.py Q)) (X G1 e' (G1.py Q)) ↔ F.lt (vst G0 G1 P ts e) (vst G0 G1 P ts e')) := by
have o := pass_orders sw hp hp' hne
have aP := same_order o.1 ts (in_open t0 t1)
have bP := same_order o.1 F.R.one in1
have aQ := same_order o.2 ts (in_open t0 t1)
have bQ := same_order o.2 F.R.one in1
rw [lin1, lin1] at bP bQ
rw [vst_Q sw hmt hp.1, vst_Q sw hmt hp'.1] at aQ
exact ⟨aP, aQ, bP.symm.trans aP, bQ.symm.trans aQ⟩
/-- at the meeting a passing segment is off both bars -/
theorem vst_out (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q) {e : Nat × Nat} (hp : Pass G0 P Q e) :
(F.lt (vst G0 G1 P ts e) (G0.px P) ∨ F.lt (xr G0 P) (vst G0 G1 P ts e)) ∧
(F.lt (vst G0 G1 P ts e) (G0.px Q) ∨ F.lt (xr G0 Q) (vst G0 G1 P ts e)) := by
have ht := in_open t0 t1
refine ⟨nodesF sw ht hp.1 sw.hP (pass_open sw hp ts ht).1, ?_⟩
have := nodesF sw ht hp.1 sw.hQ (pass_open sw hp ts ht).2
rw [vst_Q sw hmt hp.1] at this; exact this
omit sw in
theorem lt_le_lt {a b c d : F.K} (h1 : F.lt a b) (h2 : le F b c) (h3 : F.lt c d) : F.lt a d :=
F.trans _ _ _ (lt_of_lt_of_le F h1 h2) h3
/-! ## the eight sides -/
section A
variable (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q) (hA : F.lt (xr G0 P) (G0.px Q))
include t0 t1 hmt hA
theorem L0P (e : Nat × Nat) : Lft G0 P e ↔ CX G0 G1 P Q ts e :=
⟨fun ⟨hs, ho, hl⟩ => ((atP0 sw e).1 ⟨hs, ho⟩).elim
(fun hq => by
have h := (inQ_side sw t0 t1 hmt hq).1.1 hl
have vin := xt_in0 sw.fam hq.1; rw [hq.2] at vin
exact absurd (lt_of_le_of_lt F vin.1 h) (lt_asymm F (lt_of_le_of_lt F (pxleP sw) hA)))
(fun hp => ⟨hp, (sP0 sw t0 t1 hp).1.1 hl⟩),
fun ⟨hp, hv⟩ => ⟨hp.1, ((atP0 sw e).2 (.inr hp)).2, (sP0 sw t0 t1 hp).1.2 hv⟩⟩
theorem R0P (e : Nat × Nat) : Rgt G0 P e ↔ (CM G0 G1 P Q ts e ∨ InN G0 Q e ∨ CY G0 G1 P Q ts e) :=
⟨fun ⟨hs, ho, hl⟩ => ((atP0 sw e).1 ⟨hs, ho⟩).elim (fun hq => .inr (.inl hq))
(fun hp =>
have hv := (sP0 sw t0 t1 hp).2.1 hl
match F.tri (vst G0 G1 P ts e) (G0.px Q) with
| .inl h => .inl ⟨hp, hv, h⟩
| .inr h => ((vst_out sw t0 t1 hmt hp).2).elim (fun h' => (h.elim (fun e' => lt_ne F h' e')
(fun h'' => lt_asymm F h' h'')).elim) (fun h' => .inr (.inr ⟨hp, h'⟩))),
fun h => match h with
| .inl ⟨hp, hv, _⟩ => ⟨hp.1, ((atP0 sw e).2 (.inr hp)).2, (sP0 sw t0 t1 hp).2.2 hv⟩
| .inr (.inl hq) => ⟨hq.1, ((atP0 sw e).2 (.inl hq)).2, (inQ_side sw t0 t1 hmt hq).2.2 (by
have vin := xt_in0 sw.fam hq.1; rw [hq.2] at vin
exact lt_of_lt_of_le F hA vin.1)⟩
| .inr (.inr ⟨hp, hv⟩) => ⟨hp.1, ((atP0 sw e).2 (.inr hp)).2, (sP0 sw t0 t1 hp).2.2 (lt_le_lt hA (pxleQ sw) hv)⟩⟩
theorem L0Q (e : Nat × Nat) : Lft G0 Q e ↔ (CX G0 G1 P Q ts e ∨ OutN G0 P e ∨ CM G0 G1 P Q ts e) :=
⟨fun ⟨hs, ho, hl⟩ => ((atQ0 sw e).1 ⟨hs, ho⟩).elim (fun ho' => .inr (.inl ho'))
(fun hp =>
have hv := (sQ0 sw t0 t1 hmt hp).1.1 hl
match F.tri (vst G0 G1 P ts e) (G0.px P) with
| .inl h => .inl ⟨hp, h⟩
| .inr h => ((vst_out sw t0 t1 hmt hp).1).elim (fun h' => (h.elim (fun e' => lt_ne F h' e')
(fun h'' => lt_asymm F h' h'')).elim) (fun h' => .inr (.inr ⟨hp, h', hv⟩))),
fun h => match h with
| .inl ⟨hp, hv⟩ => ⟨hp.1, ((atQ0 sw e).2 (.inr hp)).2, (sQ0 sw t0 t1 hmt hp).1.2 (lt_le_lt hv (pxleP sw) hA)⟩
| .inr (.inl ho) => ⟨ho.1, ((atQ0 sw e).2 (.inl ho)).2, (outP_side sw t0 t1 hmt ho).1.2 (by
have vin := xs_in0 sw.fam ho.1; rw [ho.2] at vin
exact lt_of_le_of_lt F vin.2 hA)⟩
| .inr (.inr ⟨hp, _, hv⟩) => ⟨hp.1, ((atQ0 sw e).2 (.inr hp)).2, (sQ0 sw t0 t1 hmt hp).1.2 hv⟩⟩
theorem R0Q (e : Nat × Nat) : Rgt G0 Q e ↔ CY G0 G1 P Q ts e :=
⟨fun ⟨hs, ho, hl⟩ => ((atQ0 sw e).1 ⟨hs, ho⟩).elim
(fun ho' => by
have h := (outP_side sw t0 t1 hmt ho').2.1 hl
have vin := xs_in0 sw.fam ho'.1; rw [ho'.2] at vin
exact absurd (lt_of_lt_of_le F h vin.2) (lt_asymm F (lt_of_lt_of_le F hA (pxleQ sw))))
(fun hp => ⟨hp, (sQ0 sw t0 t1 hmt hp).2.1 hl⟩),
fun ⟨hp, hv⟩ => ⟨hp.1, ((atQ0 sw e).2 (.inr hp)).2, (sQ0 sw t0 t1 hmt hp).2.2 hv⟩⟩
theorem L1Q (e : Nat × Nat) : Lft G1 Q e ↔ (CX G0 G1 P Q ts e ∨ InN G1 P e ∨ CM G0 G1 P Q ts e) :=
⟨fun ⟨hs, ho, hl⟩ => ((atQ1 sw e).1 ⟨hs, ho⟩).elim (fun hi => .inr (.inl hi))
(fun hp =>
have hl' : F.lt (X G1 e (G1.py Q)) (G0.px Q) := by rw [sw.fam.px1] at hl; exact hl
have hv := (sQ1 sw t0 t1 hmt hp).1.1 hl'
match F.tri (vst G0 G1 P ts e) (G0.px P) with
| .inl h => .inl ⟨hp, h⟩
| .inr h => ((vst_out sw t0 t1 hmt hp).1).elim (fun h' => (h.elim (fun e' => lt_ne F h' e')
(fun h'' => lt_asymm F h' h'')).elim) (fun h' => .inr (.inr ⟨hp, h', hv⟩))),
fun h => by
rw [Lft, sw.fam.px1]
exact match h with
| .inl ⟨hp, hv⟩ => ⟨(seg1' sw e).2 hp.1, ((atQ1 sw e).2 (.inr hp)).2, (sQ1 sw t0 t1 hmt hp).1.2 (lt_le_lt hv (pxleP sw) hA)⟩
| .inr (.inl hi) => ⟨hi.1, ((atQ1 sw e).2 (.inl hi)).2, (inP_side1 sw t0 t1 hmt hi).1.2 (by
have hs := (seg1' sw e).1 hi.1
have vin := xt_in0 sw.fam hs; rw [← hiN1 sw, hi.2] at vin
exact lt_of_le_of_lt F vin.2 hA)⟩
| .inr (.inr ⟨hp, _, hv⟩) => ⟨(seg1' sw e).2 hp.1, ((atQ1 sw e).2 (.inr hp)).2, (sQ1 sw t0 t1 hmt hp).1.2 hv⟩⟩
theorem R1Q (e : Nat × Nat) : Rgt G1 Q e ↔ CY G0 G1 P Q ts e :=
⟨fun ⟨hs, ho, hl⟩ =>
have hl' : F.lt (xr G0 Q) (X G1 e (G1.py Q)) := by rw [xr1F sw.fam] at hl; exact hl
((atQ1 sw e).1 ⟨hs, ho⟩).elim
(fun hi => by
have h := (inP_side1 sw t0 t1 hmt hi).2.1 hl'
have hs0 := (seg1' sw e).1 hi.1
have vin := xt_in0 sw.fam hs0; rw [← hiN1 sw, hi.2] at vin
exact absurd (lt_of_lt_of_le F h vin.2) (lt_asymm F (lt_of_lt_of_le F hA (pxleQ sw))))
(fun hp => ⟨hp, (sQ1 sw t0 t1 hmt hp).2.1 hl'⟩),
fun ⟨hp, hv⟩ => by
rw [Rgt, xr1F sw.fam]
exact ⟨(seg1' sw e).2 hp.1, ((atQ1 sw e).2 (.inr hp)).2, (sQ1 sw t0 t1 hmt hp).2.2 hv⟩⟩
theorem L1P (e : Nat × Nat) : Lft G1 P e ↔ CX G0 G1 P Q ts e :=
⟨fun ⟨hs, ho, hl⟩ =>
have hl' : F.lt (X G1 e (G1.py P)) (G0.px P) := by rw [sw.fam.px1] at hl; exact hl
((atP1 sw e).1 ⟨hs, ho⟩).elim
(fun ho' => by
have h := (outQ_side1 sw t0 t1 hmt ho').1.1 hl'
have vin := xs_in0 sw.fam ((seg1' sw e).1 ho'.1); rw [ho'.2] at vin
exact absurd (lt_of_le_of_lt F vin.1 h) (lt_asymm F (lt_of_le_of_lt F (pxleP sw) hA)))
(fun hp => ⟨hp, (sP1 sw t0 t1 hp).1.1 hl'⟩),
fun ⟨hp, hv⟩ => by
rw [Lft, sw.fam.px1]
exact ⟨(seg1' sw e).2 hp.1, ((atP1 sw e).2 (.inr hp)).2, (sP1 sw t0 t1 hp).1.2 hv⟩⟩
theorem R1P (e : Nat × Nat) : Rgt G1 P e ↔ (CM G0 G1 P Q ts e ∨ OutN G1 Q e ∨ CY G0 G1 P Q ts e) :=
⟨fun ⟨hs, ho, hl⟩ =>
have hl' : F.lt (xr G0 P) (X G1 e (G1.py P)) := by rw [xr1F sw.fam] at hl; exact hl
((atP1 sw e).1 ⟨hs, ho⟩).elim (fun ho' => .inr (.inl ho'))
(fun hp =>
have hv := (sP1 sw t0 t1 hp).2.1 hl'
match F.tri (vst G0 G1 P ts e) (G0.px Q) with
| .inl h => .inl ⟨hp, hv, h⟩
| .inr h => ((vst_out sw t0 t1 hmt hp).2).elim (fun h' => (h.elim (fun e' => lt_ne F h' e')
(fun h'' => lt_asymm F h' h'')).elim) (fun h' => .inr (.inr ⟨hp, h'⟩))),
fun h => by
rw [Rgt, xr1F sw.fam]
exact match h with
| .inl ⟨hp, hv, _⟩ => ⟨(seg1' sw e).2 hp.1, ((atP1 sw e).2 (.inr hp)).2, (sP1 sw t0 t1 hp).2.2 hv⟩
| .inr (.inl ho) => ⟨ho.1, ((atP1 sw e).2 (.inl ho)).2, (outQ_side1 sw t0 t1 hmt ho).2.2 (by
have vin := xs_in0 sw.fam ((seg1' sw e).1 ho.1); rw [ho.2] at vin
exact lt_of_lt_of_le F hA vin.1)⟩
| .inr (.inr ⟨hp, hv⟩) => ⟨(seg1' sw e).2 hp.1, ((atP1 sw e).2 (.inr hp)).2, (sP1 sw t0 t1 hp).2.2 (lt_le_lt hA (pxleQ sw) hv)⟩⟩
end A
end W
end TP
end Found
#print axioms Found.TP.pord
#print axioms Found.TP.vst_out
#print axioms Found.TP.L0P
#print axioms Found.TP.R0P
#print axioms Found.TP.L0Q
#print axioms Found.TP.R0Q
#print axioms Found.TP.L1Q
#print axioms Found.TP.R1Q
#print axioms Found.TP.L1P
#print axioms Found.TP.R1P
lean_all/found/Top11.lean
/-
T193 (topological), part 11. found/Top11 — list tools for the swap:
* the inputs (outputs) of a node in port order, with their labels the
domain (codomain) of its generator, are a sorted enumeration of the
segments into (out of) it at any height where they all cross;
* a sorted enumeration of A ∪ B with A before B splits into a sorted
enumeration of A followed by one of B; sorted lists concatenate; a list
sorted for one key is sorted for another key ordering its members alike.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top10
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## ranges and port lists -/
def rng : Nat → Nat → List Nat
| _, 0 => []
| a, n + 1 => a :: rng (a + 1) n
theorem mem_rng : (a n i : Nat) → (i ∈ rng a n ↔ a ≤ i ∧ i < a + n)
| a, 0, i => ⟨(fun m => nomatch m), fun ⟨h1, h2⟩ => absurd (Nat.lt_of_le_of_lt h1 h2) (Nat.lt_irrefl a)⟩
| a, n + 1, i => ⟨fun m => match m with
| .head _ => ⟨Nat.le_refl _, Nat.lt_succ_of_le (Nat.le_add_right _ _)⟩
| .tail _ m' => match (mem_rng (a + 1) n i).1 m' with
| ⟨h1, h2⟩ => ⟨Nat.le_of_succ_le h1, by rw [Nat.add_right_comm] at h2; exact h2⟩,
fun ⟨h1, h2⟩ => match Nat.decEq i a with
| isTrue e => e ▸ .head _
| isFalse ne => .tail _ ((mem_rng (a + 1) n i).2 ⟨Nat.lt_of_le_of_ne h1 (fun e => ne e.symm),
by rw [Nat.add_right_comm]; exact h2⟩)⟩
theorem getD_rng (l : List Nat) : (rng 0 l.length).map (getD l) = l := by
have shift : ∀ (a n : Nat) (x : Nat) (l : List Nat), (rng (a + 1) n).map (getD (x :: l)) = (rng a n).map (getD l) := by
intro a n
induction n generalizing a with
| zero => intro _ _; rfl
| succ n ih =>
intro x l
show getD (x :: l) (a + 1) :: (rng (a + 1 + 1) n).map (getD (x :: l)) = getD l a :: (rng (a + 1) n).map (getD l)
rw [ih (a + 1) x l]; rfl
induction l with
| nil => rfl
| cons x l ih =>
show getD (x :: l) 0 :: (rng 1 l.length).map (getD (x :: l)) = x :: l
rw [shift 0 l.length x l, ih]; rfl
def inList (G : Drw F S) (m : Nat) : List (Nat × Nat) := (rng 0 (nIn (G.kind m))).map (fun q => G.src (m, q))
def outList (G : Drw F S) (m : Nat) : List (Nat × Nat) := (rng 0 (nOut (G.kind m))).map (fun p => (m, p))
/-! ## sorted lists -/
section L
variable {α : Type} (key : α → F.K)
theorem incr_cons {a : α} {l : List α} (hl : Incr F key l) (h : ∀ x, x ∈ l → F.lt (key a) (key x)) : Incr F key (a :: l) :=
match l, hl, h with
| [], _, _ => trivial
| b :: _, hl, h => ⟨h b (.head _), hl⟩
theorem incr_app : (l1 l2 : List α) → Incr F key l1 → Incr F key l2 → (∀ a b, a ∈ l1 → b ∈ l2 → F.lt (key a) (key b)) →
Incr F key (l1 ++ l2)
| [], _, _, h2, _ => h2
| a :: l1, l2, h1, h2, h => incr_cons key (incr_app l1 l2 (incr_tail F key h1) h2 (fun x y mx my => h x y (.tail _ mx) my))
(fun x m => ((mem_app_gen l1 l2).1 m).elim (fun mx => incr_head F key h1 x mx) (fun my => h a x (.head _) my))
where
mem_app_gen : (l1 l2 : List α) → ∀ {x : α}, (x ∈ l1 ++ l2 ↔ x ∈ l1 ∨ x ∈ l2)
| [], _, _ => ⟨fun m => .inr m, fun h => h.elim (fun m => nomatch m) id⟩
| _ :: l1, l2, _ => ⟨fun m => match m with
| .head _ => .inl (.head _)
| .tail _ m' => ((mem_app_gen l1 l2).1 m').elim (fun h => .inl (.tail _ h)) .inr,
fun h => h.elim (fun m => match m with
| .head _ => .head _
| .tail _ m' => .tail _ ((mem_app_gen l1 l2).2 (.inl m')))
(fun m => .tail _ ((mem_app_gen l1 l2).2 (.inr m)))⟩
theorem mem_appG {l1 l2 : List α} {x : α} : x ∈ l1 ++ l2 ↔ x ∈ l1 ∨ x ∈ l2 := incr_app.mem_app_gen l1 l2
theorem incr_transfer (key2 : α → F.K) : (l : List α) → (∀ a b, a ∈ l → b ∈ l → F.lt (key a) (key b) → F.lt (key2 a) (key2 b)) →
Incr F key l → Incr F key2 l
| [], _, _ => trivial
| [_], _, _ => trivial
| a :: b :: l, h, hi => ⟨h a b (.head _) (.tail _ (.head _)) hi.1,
incr_transfer key2 (b :: l) (fun x y mx my => h x y (.tail _ mx) (.tail _ my)) hi.2⟩
/-- a sorted enumeration of A ∪ B with A before B splits -/
theorem blocks2 : (l : List α) → ∀ {A B : α → Prop}, (∀ a b, A a → B b → F.lt (key a) (key b)) →
Enum (fun e => A e ∨ B e) l → Incr F key l →
∃ la lb, l = la ++ lb ∧ Enum A la ∧ Incr F key la ∧ Enum B lb ∧ Incr F key lb
| [], A, B, _, hE, _ => ⟨[], [], rfl,
⟨trivial, fun x => ⟨(fun m => nomatch m), fun h => absurd ((hE.2 x).2 (.inl h)) (fun m => nomatch m)⟩⟩, trivial,
⟨trivial, fun x => ⟨(fun m => nomatch m), fun h => absurd ((hE.2 x).2 (.inr h)) (fun m => nomatch m)⟩⟩, trivial⟩
| h :: t, A, B, hAB, hE, hI =>
have hnt : ¬ h ∈ t := hE.1.1
have notboth : ∀ x, A x → B x → False := fun x a b => F.irr _ (hAB x x a b)
match (hE.2 h).1 (.head _) with
| .inl ha =>
have hE' : Enum (fun e => (A e ∧ e ≠ h) ∨ B e) t := ⟨hE.1.2, fun x =>
⟨fun m => ((hE.2 x).1 (.tail _ m)).elim (fun a => .inl ⟨a, fun e => hnt (e ▸ m)⟩) .inr,
fun hx => hx.elim
(fun ⟨a, ne⟩ => match (hE.2 x).2 (.inl a) with
| .head _ => absurd rfl ne
| .tail _ m => m)
(fun b => match (hE.2 x).2 (.inr b) with
| .head _ => (notboth _ ha b).elim
| .tail _ m => m)⟩⟩
match blocks2 t (A := fun e => A e ∧ e ≠ h) (B := B) (fun a b ha' hb => hAB a b ha'.1 hb) hE' (incr_tail F key hI) with
| ⟨la, lb, e, hla, ila, hlb, ilb⟩ =>
have sub : ∀ x, x ∈ la → x ∈ t := fun x m => by rw [e]; exact mem_appG.2 (.inl m)
⟨h :: la, lb, by rw [e]; rfl,
⟨⟨fun m => hnt (sub h m), hla.1⟩, fun x => ⟨fun m => match m with
| .head _ => ha
| .tail _ m' => ((hla.2 x).1 m').1,
fun a => match (hE.2 x).2 (.inl a) with
| .head _ => .head _
| .tail _ m => .tail _ ((hla.2 x).2 ⟨a, fun ex => hnt (ex ▸ m)⟩)⟩⟩,
incr_cons key ila (fun x m => incr_head F key hI x (sub x m)), hlb, ilb⟩
| .inr hb =>
have noA : ∀ x, A x → False := fun x a => match (hE.2 x).2 (.inl a) with
| .head _ => notboth _ a hb
| .tail _ m => lt_asymm F (incr_head F key hI x m) (hAB x h a hb)
⟨[], h :: t, rfl, ⟨trivial, fun x => ⟨(fun m => nomatch m), fun a => (noA x a).elim⟩⟩, trivial,
⟨hE.1, fun x => ⟨fun m => ((hE.2 x).1 m).elim (fun a => (noA x a).elim) id, fun b => (hE.2 x).2 (.inr b)⟩⟩, hI⟩
end L
/-! ## port lists -/
theorem memC {α : Type} {x b : α} {l : List α} (h : x ∈ b :: l) : x = b ∨ x ∈ l :=
match h with
| .head _ => .inl rfl
| .tail _ m => .inr m
theorem mem_mapG {α β : Type} (f : α → β) {y : β} : (l : List α) → (y ∈ l.map f ↔ ∃ x, x ∈ l ∧ f x = y)
| [] => ⟨(fun m => nomatch m), (fun ⟨_, m, _⟩ => nomatch m)⟩
| a :: l => ⟨fun m => (memC (show y ∈ f a :: l.map f from m)).elim (fun e => ⟨a, .head _, e.symm⟩)
(fun m' => match (mem_mapG f l).1 m' with
| ⟨x, hx, e⟩ => ⟨x, .tail _ hx, e⟩),
fun ⟨x, hx, e⟩ => show y ∈ f a :: l.map f from match hx with
| .head _ => e ▸ .head _
| .tail _ m => .tail _ ((mem_mapG f l).2 ⟨x, m, e⟩)⟩
theorem nd_map_rng {β : Type} (f : Nat → β) : (a n : Nat) → (∀ q q', a ≤ q → q < a + n → a ≤ q' → q' < a + n → f q = f q' → q = q') →
NdG ((rng a n).map f)
| _, 0, _ => trivial
| a, n + 1, hinj => ⟨fun m => match (mem_mapG f _).1 m with
| ⟨q, hq, e⟩ =>
have hq' := (mem_rng (a + 1) n q).1 hq
have := hinj a q (Nat.le_refl a) (Nat.lt_succ_of_le (Nat.le_add_right a n)) (Nat.le_of_succ_le hq'.1)
(by rw [Nat.add_right_comm] at hq'; exact hq'.2) e.symm
absurd hq'.1 (by rw [← this]; exact Nat.lt_irrefl a),
nd_map_rng f (a + 1) n (fun q q' h1 h2 h3 h4 e => hinj q q' (Nat.le_of_succ_le h1)
(by rw [Nat.add_right_comm] at h2; exact h2) (Nat.le_of_succ_le h3) (by rw [Nat.add_right_comm] at h4; exact h4) e)⟩
theorem map_map' {α β γ : Type} (f : α → β) (g : β → γ) : (l : List α) → (l.map f).map g = l.map (fun x => g (f x))
| [] => rfl
| a :: l => congrArg (List.cons (g (f a))) (map_map' f g l)
theorem map_congr' {α β : Type} {f g : α → β} : (l : List α) → (∀ x, x ∈ l → f x = g x) → l.map f = l.map g
| [], _ => rfl
| a :: l, h => by
show f a :: l.map f = g a :: l.map g
rw [h a (.head _), map_congr' l (fun x m => h x (.tail _ m))]
section P
variable {G : Drw F S} (hv : Valid G)
include hv
theorem enum_in {m : Nat} (hm : m < G.nn) : Enum (InN G m) (inList G m) := by
refine ⟨nd_map_rng _ 0 _ (fun q q' _ h2 _ h4 e => ?_), fun e => ⟨fun me => ?_, fun ⟨hs, hh⟩ => ?_⟩⟩
· have a := (hv.srcOk m q hm (by rw [Nat.zero_add] at h2; exact h2)).2
have b := (hv.srcOk m q' hm (by rw [Nat.zero_add] at h4; exact h4)).2
rw [e] at a; rw [a] at b; exact (Prod.mk.inj b).2
· match (mem_mapG _ _).1 me with
| ⟨q, hq, eq⟩ =>
have hq' := (mem_rng 0 _ q).1 hq
have so := hv.srcOk m q hm (by rw [Nat.zero_add] at hq'; exact hq'.2)
rw [← eq]
exact ⟨so.1, by unfold hiN; rw [so.2]⟩
· have to := hv.tgtOk e hs
unfold hiN at hh
have et : G.tgt e = (m, (G.tgt e).2) := by rw [← hh]
refine (mem_mapG _ _).2 ⟨(G.tgt e).2, (mem_rng 0 _ _).2 ⟨Nat.zero_le _, by rw [Nat.zero_add, ← hh]; exact to.2.1⟩, ?_⟩
rw [← et]; exact to.2.2.2
theorem incr_in {m : Nat} (hm : m < G.nn) (y : F.K) (ho : ∀ q, q < nIn (G.kind m) → Open G (G.src (m, q)) y) :
Incr F (fun e => X G e y) (inList G m) := by
have gen : ∀ a n, a + n ≤ nIn (G.kind m) → Incr F (fun e => X G e y) ((rng a n).map (fun q => G.src (m, q))) := by
intro a n
induction n generalizing a with
| zero => intro _; trivial
| succ n ih =>
intro h
match n, ih with
| 0, _ => exact trivial
| n + 1, ih' =>
have h1 : a + 1 < nIn (G.kind m) := Nat.lt_of_lt_of_le (by
rw [Nat.add_succ, Nat.add_succ]; exact Nat.succ_lt_succ (Nat.lt_succ_of_le (Nat.le_add_right _ _))) h
exact ⟨hv.inOrd m a (a + 1) y hm (Nat.lt_succ_self a) h1 (ho a (Nat.lt_trans (Nat.lt_succ_self a) h1)) (ho _ h1),
ih' (a + 1) (by rw [Nat.add_right_comm]; exact h)⟩
exact gen 0 _ (by rw [Nat.zero_add]; exact Nat.le_refl _)
theorem incr_out {m : Nat} (hm : m < G.nn) (y : F.K) (ho : ∀ p, p < nOut (G.kind m) → Open G (m, p) y) :
Incr F (fun e => X G e y) (outList G m) := by
have gen : ∀ a n, a + n ≤ nOut (G.kind m) → Incr F (fun e => X G e y) ((rng a n).map (fun p => (m, p))) := by
intro a n
induction n generalizing a with
| zero => intro _; trivial
| succ n ih =>
intro h
match n, ih with
| 0, _ => exact trivial
| n + 1, ih' =>
have h1 : a + 1 < nOut (G.kind m) := Nat.lt_of_lt_of_le (by
rw [Nat.add_succ, Nat.add_succ]; exact Nat.succ_lt_succ (Nat.lt_succ_of_le (Nat.le_add_right _ _))) h
exact ⟨hv.outOrd m a (a + 1) y hm (Nat.lt_succ_self a) h1 (ho a (Nat.lt_trans (Nat.lt_succ_self a) h1)) (ho _ h1),
ih' (a + 1) (by rw [Nat.add_right_comm]; exact h)⟩
exact gen 0 _ (by rw [Nat.zero_add]; exact Nat.le_refl _)
theorem labs_in {m : Nat} (hm : m < G.nn) {g : S.G} (hk : G.kind m = .box g) : labs G (inList G m) = S.dom g := by
unfold labs inList
rw [map_map']
have e : ∀ q, q ∈ rng 0 (nIn (G.kind m)) → lab G (G.src (m, q)) = getD (S.dom g) q := fun q hq => by
have hq' := (mem_rng 0 _ q).1 hq
have so := hv.srcOk m q hm (by rw [Nat.zero_add] at hq'; exact hq'.2)
have to := (hv.tgtOk _ so.1).2.2.1
rw [so.2] at to
rw [← to]; show inLab (G.kind m) q = _; rw [hk]; rfl
rw [map_congr' _ e, hk]
exact getD_rng _
end P
theorem enum_out {G : Drw F S} {m : Nat} (hm : m < G.nn) : Enum (OutN G m) (outList G m) := by
refine ⟨nd_map_rng _ 0 _ (fun _ _ _ _ _ _ e => (Prod.mk.inj e).2), fun e => ⟨fun me => ?_, fun ⟨hs, hh⟩ => ?_⟩⟩
· match (mem_mapG _ _).1 me with
| ⟨p, hp, eq⟩ =>
have hp' := (mem_rng 0 _ p).1 hp
rw [← eq]
exact ⟨⟨hm, by rw [Nat.zero_add] at hp'; exact hp'.2⟩, rfl⟩
· refine (mem_mapG _ _).2 ⟨e.2, (mem_rng 0 _ _).2 ⟨Nat.zero_le _, by rw [Nat.zero_add, ← hh]; exact hs.2⟩, ?_⟩
rw [← hh]
theorem labs_out {G : Drw F S} {m : Nat} {g : S.G} (hk : G.kind m = .box g) : labs G (outList G m) = S.cod g := by
unfold labs outList
rw [map_map']
have e : ∀ p, p ∈ rng 0 (nOut (G.kind m)) → lab G (m, p) = getD (S.cod g) p := fun p _ => by
show outLab (G.kind m) p = _; rw [hk]; rfl
rw [map_congr' _ e, hk]
exact getD_rng _
end TP
end Found
#print axioms Found.TP.getD_rng
#print axioms Found.TP.incr_app
#print axioms Found.TP.blocks2
#print axioms Found.TP.enum_in
#print axioms Found.TP.enum_out
#print axioms Found.TP.incr_in
#print axioms Found.TP.incr_out
#print axioms Found.TP.labs_in
#print axioms Found.TP.labs_out
lean_all/found/Top12.lean
/-
T193 (topological), part 12. found/Top12 — the orders across the blocks
of the swapping boxes' layers (case: P below and on the left at the
meeting), at a fixed time along the slab of heights between P and Q:
before, at P's height M < inputs of Q < Y, at Q's height
X < outputs of P < M; after, at Q's height X < inputs of P < M, at P's
height M < outputs of Q < Y.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top11
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
section X
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q) {ts : F.K}
(t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q)
include sw t0 t1 hmt
omit t0 t1 hmt in
theorem xhi0 {e : Nat × Nat} (hs : Seg G0 e) : X G0 e (G0.py (hiN G0 e)) = xt G0 e :=
X_hi G0 e (fun h => F.irr _ (by have := prog0 sw e hs; rw [h] at this; exact this))
omit t0 t1 hmt in
theorem xt1 (e : Nat × Nat) : xt G1 e = xt G0 e := by unfold xt hiN; rw [sw.fam.px1, sw.fam.ix1, sw.fam.tgt1]
omit t0 t1 hmt in
theorem xs1 (e : Nat × Nat) : xs G1 e = xs G0 e := by unfold xs; rw [sw.fam.px1, sw.fam.ox1]
omit t0 t1 hmt in
theorem xhi1 {e : Nat × Nat} (hs : Seg G0 e) : X G1 e (G1.py (hiN G1 e)) = xt G0 e := by
rw [← xt1 sw]
exact X_hi G1 e (fun h => F.irr _ (by have := prog1 sw e hs; rw [h] at this; exact this))
theorem c1 {m q : Nat × Nat} (hm : CM G0 G1 P Q ts m) (hq : InN G0 Q q) :
F.lt (X G0 m (G0.py P)) (X G0 q (G0.py P)) := by
have hp := hm.1
have hqo := ((atP0 sw q).2 (.inl hq)).2
have hne : m ≠ q := fun e => hp.2.2.2.2.1 (by rw [e]; exact hq.2)
refine slab_lt (b := G0.py Q) (fun u h0 h1 => segs0 sw hp.1 hq.1 hne ?_ ?_) ?_
· have li := lin_in sw.lo0 h0 h1
exact ⟨lt_of_lt_of_le F hp.2.2.2.2.2.1 li.1, F.trans _ _ _ li.2 hp.2.2.2.2.2.2⟩
· have li := lin_in sw.lo0 h0 h1
exact ⟨lt_of_lt_of_le F hqo.1 li.1, by rw [hq.2]; exact li.2⟩
· have e1 := xhi0 sw hq.1
rw [hq.2] at e1
rw [e1]
have vin := xt_in0 sw.fam hq.1; rw [hq.2] at vin
exact lt_of_lt_of_le F ((sQ0 sw t0 t1 hmt hp).1.2 hm.2.2) vin.1
theorem c2 {q y : Nat × Nat} (hq : InN G0 Q q) (hy : CY G0 G1 P Q ts y) :
F.lt (X G0 q (G0.py P)) (X G0 y (G0.py P)) := by
have hp := hy.1
have hqo := ((atP0 sw q).2 (.inl hq)).2
have hne : q ≠ y := fun e => hp.2.2.2.2.1 (by rw [← e]; exact hq.2)
refine slab_lt (b := G0.py Q) (fun u h0 h1 => segs0 sw hq.1 hp.1 hne ?_ ?_) ?_
· have li := lin_in sw.lo0 h0 h1
exact ⟨lt_of_lt_of_le F hqo.1 li.1, by rw [hq.2]; exact li.2⟩
· have li := lin_in sw.lo0 h0 h1
exact ⟨lt_of_lt_of_le F hp.2.2.2.2.2.1 li.1, F.trans _ _ _ li.2 hp.2.2.2.2.2.2⟩
· have e1 := xhi0 sw hq.1
rw [hq.2] at e1
rw [e1]
have vin := xt_in0 sw.fam hq.1; rw [hq.2] at vin
exact lt_of_le_of_lt F vin.2 ((sQ0 sw t0 t1 hmt hp).2.2 hy.2)
omit hmt in
theorem c3 {x o : Nat × Nat} (hx : CX G0 G1 P Q ts x) (ho : OutN G0 P o) :
F.lt (X G0 x (G0.py Q)) (X G0 o (G0.py Q)) := by
have hp := hx.1
have hoo := ((atQ0 sw o).2 (.inl ho)).2
have hne : x ≠ o := fun e => hp.2.1 (by rw [e]; exact ho.2)
refine slab_lt (b := G0.py P) (fun u h0 h1 => segs0 sw hp.1 ho.1 hne ?_ ?_) ?_
· have li := lin_in' sw.lo0 h0 h1
exact ⟨F.trans _ _ _ hp.2.2.2.2.2.1 li.1, lt_of_le_of_lt F li.2 hp.2.2.2.2.2.2⟩
· have li := lin_in' sw.lo0 h0 h1
exact ⟨by rw [ho.2]; exact li.1, lt_of_le_of_lt F li.2 hoo.2⟩
· have e1 := X_lo G0 o
rw [ho.2] at e1
rw [e1]
have vin := xs_in0 sw.fam ho.1; rw [ho.2] at vin
exact lt_of_lt_of_le F ((sP0 sw t0 t1 hp).1.2 hx.2) vin.1
omit hmt in
theorem c4 {o m : Nat × Nat} (ho : OutN G0 P o) (hm : CM G0 G1 P Q ts m) :
F.lt (X G0 o (G0.py Q)) (X G0 m (G0.py Q)) := by
have hp := hm.1
have hoo := ((atQ0 sw o).2 (.inl ho)).2
have hne : o ≠ m := fun e => hp.2.1 (by rw [← e]; exact ho.2)
refine slab_lt (b := G0.py P) (fun u h0 h1 => segs0 sw ho.1 hp.1 hne ?_ ?_) ?_
· have li := lin_in' sw.lo0 h0 h1
exact ⟨by rw [ho.2]; exact li.1, lt_of_le_of_lt F li.2 hoo.2⟩
· have li := lin_in' sw.lo0 h0 h1
exact ⟨F.trans _ _ _ hp.2.2.2.2.2.1 li.1, lt_of_le_of_lt F li.2 hp.2.2.2.2.2.2⟩
· have e1 := X_lo G0 o
rw [ho.2] at e1
rw [e1]
have vin := xs_in0 sw.fam ho.1; rw [ho.2] at vin
exact lt_of_le_of_lt F vin.2 ((sP0 sw t0 t1 hp).2.2 hm.2.1)
omit hmt in
theorem c5 {x i : Nat × Nat} (hx : CX G0 G1 P Q ts x) (hi : InN G1 P i) :
F.lt (X G1 x (G1.py Q)) (X G1 i (G1.py Q)) := by
have hp := hx.1
have hio := ((atQ1 sw i).2 (.inl hi)).2
have hs := (seg1' sw i).1 hi.1
have hne : x ≠ i := fun e => hp.2.2.2.1 (by rw [e, ← hiN1 sw]; exact hi.2)
have pa := pass1 sw hp
refine slab_lt (b := G1.py P) (fun u h0 h1 => segs1 sw hp.1 hs hne ?_ ?_) ?_
· have li := lin_in sw.hi1 h0 h1
exact ⟨lt_of_lt_of_le F pa.1 li.1, F.trans _ _ _ li.2 pa.2⟩
· have li := lin_in sw.hi1 h0 h1
exact ⟨lt_of_lt_of_le F hio.1 li.1, by rw [hi.2]; exact li.2⟩
· have e1 := xhi1 sw hs
rw [hi.2] at e1
rw [e1]
have vin := xt_in0 sw.fam hs; rw [← hiN1 sw, hi.2] at vin
exact lt_of_lt_of_le F ((sP1 sw t0 t1 hp).1.2 hx.2) vin.1
omit hmt in
theorem c6 {i m : Nat × Nat} (hi : InN G1 P i) (hm : CM G0 G1 P Q ts m) :
F.lt (X G1 i (G1.py Q)) (X G1 m (G1.py Q)) := by
have hp := hm.1
have hio := ((atQ1 sw i).2 (.inl hi)).2
have hs := (seg1' sw i).1 hi.1
have hne : i ≠ m := fun e => hp.2.2.2.1 (by rw [← e, ← hiN1 sw]; exact hi.2)
have pa := pass1 sw hp
refine slab_lt (b := G1.py P) (fun u h0 h1 => segs1 sw hs hp.1 hne ?_ ?_) ?_
· have li := lin_in sw.hi1 h0 h1
exact ⟨lt_of_lt_of_le F hio.1 li.1, by rw [hi.2]; exact li.2⟩
· have li := lin_in sw.hi1 h0 h1
exact ⟨lt_of_lt_of_le F pa.1 li.1, F.trans _ _ _ li.2 pa.2⟩
· have e1 := xhi1 sw hs
rw [hi.2] at e1
rw [e1]
have vin := xt_in0 sw.fam hs; rw [← hiN1 sw, hi.2] at vin
exact lt_of_le_of_lt F vin.2 ((sP1 sw t0 t1 hp).2.2 hm.2.1)
theorem c7 {m o : Nat × Nat} (hm : CM G0 G1 P Q ts m) (ho : OutN G1 Q o) :
F.lt (X G1 m (G1.py P)) (X G1 o (G1.py P)) := by
have hp := hm.1
have hoo := ((atP1 sw o).2 (.inl ho)).2
have hs := (seg1' sw o).1 ho.1
have hne : m ≠ o := fun e => hp.2.2.1 (by rw [e]; exact ho.2)
have pa := pass1 sw hp
refine slab_lt (b := G1.py Q) (fun u h0 h1 => segs1 sw hp.1 hs hne ?_ ?_) ?_
· have li := lin_in' sw.hi1 h0 h1
exact ⟨F.trans _ _ _ pa.1 li.1, lt_of_le_of_lt F li.2 pa.2⟩
· have li := lin_in' sw.hi1 h0 h1
exact ⟨by rw [ho.2]; exact li.1, lt_of_le_of_lt F li.2 hoo.2⟩
· have e1 := X_lo G1 o
rw [ho.2, xs1 sw] at e1
rw [e1]
have vin := xs_in0 sw.fam hs; rw [ho.2] at vin
exact lt_of_lt_of_le F ((sQ1 sw t0 t1 hmt hp).1.2 hm.2.2) vin.1
theorem c8 {o y : Nat × Nat} (ho : OutN G1 Q o) (hy : CY G0 G1 P Q ts y) :
F.lt (X G1 o (G1.py P)) (X G1 y (G1.py P)) := by
have hp := hy.1
have hoo := ((atP1 sw o).2 (.inl ho)).2
have hs := (seg1' sw o).1 ho.1
have hne : o ≠ y := fun e => hp.2.2.1 (by rw [← e]; exact ho.2)
have pa := pass1 sw hp
refine slab_lt (b := G1.py Q) (fun u h0 h1 => segs1 sw hs hp.1 hne ?_ ?_) ?_
· have li := lin_in' sw.hi1 h0 h1
exact ⟨by rw [ho.2]; exact li.1, lt_of_le_of_lt F li.2 hoo.2⟩
· have li := lin_in' sw.hi1 h0 h1
exact ⟨F.trans _ _ _ pa.1 li.1, lt_of_le_of_lt F li.2 pa.2⟩
· have e1 := X_lo G1 o
rw [ho.2, xs1 sw] at e1
rw [e1]
have vin := xs_in0 sw.fam hs; rw [ho.2] at vin
exact lt_of_le_of_lt F vin.2 ((sQ1 sw t0 t1 hmt hp).2.2 hy.2)
end X
end TP
end Found
#print axioms Found.TP.c1
#print axioms Found.TP.c2
#print axioms Found.TP.c3
#print axioms Found.TP.c4
#print axioms Found.TP.c5
#print axioms Found.TP.c6
#print axioms Found.TP.c7
#print axioms Found.TP.c8
lean_all/found/Top13.lean
/-
T193 (topological), part 13. found/Top13 — the swap of two boxes is an
interchange (case: the lower box P is on the left at the meeting time):
the layers of P and Q before the swap are
⟨X, gP, M ++ dom gQ ++ Y⟩ and ⟨X ++ cod gP ++ M, gQ, Y⟩,
and after the swap Q and P read
⟨X ++ dom gP ++ M, gQ, Y⟩ and ⟨X, gP, M ++ cod gQ ++ Y⟩,
where X, M, Y are the passing wires left of P, between, right of Q.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top12
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
theorem ndG_app {α : Type} : (a b : List α) → NdG a → NdG b → (∀ x, x ∈ a → ¬ x ∈ b) → NdG (a ++ b)
| [], _, _, hb, _ => hb
| y :: a, b, ha, hb, hd => ⟨fun m => (mem_appG.1 m).elim ha.1 (hd y (.head _)),
ndG_app a b ha.2 hb (fun x m => hd x (.tail _ m))⟩
theorem map_app' {α β : Type} (f : α → β) : (a b : List α) → (a ++ b).map f = a.map f ++ b.map f
| [], _ => rfl
| x :: a, b => congrArg (List.cons (f x)) (map_app' f a b)
theorem labs_eq {G G' : Drw F S} (h : G'.kind = G.kind) (l : List (Nat × Nat)) : labs G' l = labs G l := by
unfold labs lab; rw [h]
section Y
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q) {ts : F.K}
(t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q)
(hA : F.lt (xr G0 P) (G0.px Q)) (hv0 : Valid G0) (hv1 : Valid G1)
include sw t0 t1 hmt hA hv0 hv1
/-- the swap of the two boxes is an interchange -/
theorem swap_layers {lyP lyQ : Ly S} (hP0 : LayerOf G0 P lyP) (hQ0 : LayerOf G0 Q lyQ) :
∃ lyQ' lyP', LayerOf G1 Q lyQ' ∧ LayerOf G1 P lyP' ∧
∀ tl : List (Ly S), IStep (lyP :: lyQ :: tl) (lyQ' :: lyP' :: tl) := by
match hP0, hQ0 with
| ⟨gP, LsP, RsP, hkP, eLP, iLP, eRP, iRP, eP⟩, ⟨gQ, LsQ, RsQ, hkQ, eLQ, iLQ, eRQ, iRQ, eQ⟩ =>
-- classes
have pass_ne : ∀ a b : Nat × Nat, F.lt (vst G0 G1 P ts a) (vst G0 G1 P ts b) → a ≠ b :=
fun a b h e => F.irr _ (by rw [e] at h; exact h)
have tr : ∀ (l : List (Nat × Nat)), (∀ e, e ∈ l → Pass G0 P Q e) → ∀ (k1 k2 : Nat × Nat → F.K),
(∀ a b, Pass G0 P Q a → Pass G0 P Q b → a ≠ b → (F.lt (k1 a) (k1 b) ↔ F.lt (vst G0 G1 P ts a) (vst G0 G1 P ts b))) →
(∀ a b, Pass G0 P Q a → Pass G0 P Q b → a ≠ b → (F.lt (k2 a) (k2 b) ↔ F.lt (vst G0 G1 P ts a) (vst G0 G1 P ts b))) →
Incr F k1 l → Incr F k2 l := fun l hl k1 k2 h1 h2 hi =>
incr_transfer k1 k2 l (fun a b ma mb hab =>
have hne : a ≠ b := fun e => F.irr _ (by rw [e] at hab; exact hab)
(h2 a b (hl a ma) (hl b mb) hne).2 ((h1 a b (hl a ma) (hl b mb) hne).1 hab)) hi
have kP0 := fun a b (ha : Pass G0 P Q a) (hb : Pass G0 P Q b) (hne : a ≠ b) => (pord sw t0 t1 hmt ha hb hne).1
have kQ0 := fun a b (ha : Pass G0 P Q a) (hb : Pass G0 P Q b) (hne : a ≠ b) => (pord sw t0 t1 hmt ha hb hne).2.1
have kP1 := fun a b (ha : Pass G0 P Q a) (hb : Pass G0 P Q b) (hne : a ≠ b) => (pord sw t0 t1 hmt ha hb hne).2.2.1
have kQ1 := fun a b (ha : Pass G0 P Q a) (hb : Pass G0 P Q b) (hne : a ≠ b) => (pord sw t0 t1 hmt ha hb hne).2.2.2
-- P's left list is X
have eX : Enum (CX G0 G1 P Q ts) LsP := ⟨eLP.1, fun x => (eLP.2 x).trans (L0P sw t0 t1 hmt hA x)⟩
-- split P's right list
have eR : Enum (fun e => CM G0 G1 P Q ts e ∨ (InN G0 Q e ∨ CY G0 G1 P Q ts e)) RsP :=
⟨eRP.1, fun x => (eRP.2 x).trans (R0P sw t0 t1 hmt hA x)⟩
match blocks2 (fun e => X G0 e (G0.py P)) RsP
(fun a b ha hb => hb.elim (fun hq => c1 sw t0 t1 hmt ha hq)
(fun hy => (kP0 a b ha.1 hy.1 (pass_ne a b (lt_le_lt ha.2.2 (pxleQ sw) hy.2))).2 (lt_le_lt ha.2.2 (pxleQ sw) hy.2))) eR iRP with
| ⟨Ms, Rest, eR1, eMs, iMs, eRest, iRest⟩ =>
match blocks2 (fun e => X G0 e (G0.py P)) Rest (fun a b ha hb => c2 sw t0 t1 hmt ha hb) eRest iRest with
| ⟨Is, Ys, eR2, eIs, iIs, eYs, iYs⟩ =>
-- the inputs of Q in port order
have hIs : Is = inList G0 Q := enum_uniq F (fun e => X G0 e (G0.py P)) Is (inList G0 Q) _ eIs iIs (enum_in hv0 sw.hQ)
(incr_in hv0 sw.hQ _ (fun q hq => ((atP0 sw _).2 (.inl ((enum_in hv0 sw.hQ).2 _ |>.1
((mem_mapG _ _).2 ⟨q, (mem_rng 0 _ q).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact hq⟩, rfl⟩)))).2))
-- split Q's left list
have eL : Enum (fun e => CX G0 G1 P Q ts e ∨ (OutN G0 P e ∨ CM G0 G1 P Q ts e)) LsQ :=
⟨eLQ.1, fun x => (eLQ.2 x).trans (L0Q sw t0 t1 hmt hA x)⟩
match blocks2 (fun e => X G0 e (G0.py Q)) LsQ
(fun a b ha hb => hb.elim (fun ho => c3 sw t0 t1 ha ho)
(fun hm => (kQ0 a b ha.1 hm.1 (pass_ne a b (lt_le_lt ha.2 (pxleP sw) hm.2.1))).2 (lt_le_lt ha.2 (pxleP sw) hm.2.1))) eL iLQ with
| ⟨Xs', Rest', eL1, eXs', iXs', eRest', iRest'⟩ =>
match blocks2 (fun e => X G0 e (G0.py Q)) Rest' (fun a b ha hb => c4 sw t0 t1 ha hb) eRest' iRest' with
| ⟨Os, Ms', eL2, eOs, iOs, eMs', iMs'⟩ =>
have hOs : Os = outList G0 P := enum_uniq F (fun e => X G0 e (G0.py Q)) Os (outList G0 P) _ eOs iOs (enum_out sw.hP)
(incr_out hv0 sw.hP _ (fun p hp => ((atQ0 sw _).2 (.inl ⟨⟨sw.hP, hp⟩, rfl⟩)).2))
have pX : ∀ e, e ∈ LsP → Pass G0 P Q e := fun e m => ((eX.2 e).1 m).1
have pM : ∀ e, e ∈ Ms → Pass G0 P Q e := fun e m => ((eMs.2 e).1 m).1
have pY : ∀ e, e ∈ Ys → Pass G0 P Q e := fun e m => ((eYs.2 e).1 m).1
have hXs' : Xs' = LsP := enum_uniq F (fun e => X G0 e (G0.py Q)) Xs' LsP _ eXs' iXs' eX
(tr LsP pX _ _ kP0 kQ0 iLP)
have hMs' : Ms' = Ms := enum_uniq F (fun e => X G0 e (G0.py Q)) Ms' Ms _ eMs' iMs' eMs (tr Ms pM _ _ kP0 kQ0 iMs)
have hYs : RsQ = Ys := enum_uniq F (fun e => X G0 e (G0.py Q)) RsQ Ys _
⟨eRQ.1, fun x => (eRQ.2 x).trans (R0Q sw t0 t1 hmt hA x)⟩ iRQ eYs (tr Ys pY _ _ kP0 kQ0 iYs)
-- the new lists after the swap
have hkQ1 : G1.kind Q = .box gQ := by rw [sw.fam.kind1]; exact hkQ
have hkP1 : G1.kind P = .box gP := by rw [sw.fam.kind1]; exact hkP
have hP1 : P < G1.nn := by rw [sw.fam.nn1]; exact sw.hP
have hQ1 : Q < G1.nn := by rw [sw.fam.nn1]; exact sw.hQ
have eI := enum_in hv1 hP1
have eO := enum_out (G := G1) hQ1
have inI : ∀ e, e ∈ inList G1 P → hiN G0 e = P := fun e m => by rw [← hiN1 sw]; exact ((eI.2 e).1 m).2
have inO : ∀ e, e ∈ outList G1 Q → e.1 = Q := fun e m => ((eO.2 e).1 m).2
-- Q's left list after the swap
have nd1 : NdG (LsP ++ (inList G1 P ++ Ms)) :=
ndG_app _ _ eX.1 (ndG_app _ _ eI.1 eMs.1 (fun x hx hm => (pM x hm).2.2.2.1 (inI x hx)))
(fun x hx hm => (mem_appG.1 hm).elim (fun hi => (pX x hx).2.2.2.1 (inI x hi))
(fun hm' => lt_asymm F ((eX.2 x).1 hx).2 (lt_of_le_of_lt F (pxleP sw) ((eMs.2 x).1 hm').2.1)))
have lQ' : LayerOf G1 Q ⟨labs G1 (LsP ++ (inList G1 P ++ Ms)), gQ, labs G1 Ys⟩ :=
⟨gQ, LsP ++ (inList G1 P ++ Ms), Ys, hkQ1,
⟨nd1, fun x => Iff.trans (by
exact ⟨fun m => (mem_appG.1 m).elim (fun h => .inl ((eX.2 x).1 h))
(fun h => (mem_appG.1 h).elim (fun h' => .inr (.inl ((eI.2 x).1 h'))) (fun h' => .inr (.inr ((eMs.2 x).1 h')))),
fun h => h.elim (fun h' => mem_appG.2 (.inl ((eX.2 x).2 h')))
(fun h' => h'.elim (fun h'' => mem_appG.2 (.inr (mem_appG.2 (.inl ((eI.2 x).2 h'')))))
(fun h'' => mem_appG.2 (.inr (mem_appG.2 (.inr ((eMs.2 x).2 h''))))))⟩) (L1Q sw t0 t1 hmt hA x).symm⟩,
incr_app _ _ _ (tr LsP pX _ _ kP0 kQ1 iLP)
(incr_app _ _ _ (incr_in hv1 hP1 _ (fun q hq => ((atQ1 sw _).2 (.inl ((eI.2 _).1
((mem_mapG _ _).2 ⟨q, (mem_rng 0 _ q).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact hq⟩, rfl⟩)))).2))
(tr Ms pM _ _ kP0 kQ1 iMs)
(fun a b ma mb => c6 sw t0 t1 ((eI.2 a).1 ma) ((eMs.2 b).1 mb)))
(fun a b ma mb => (mem_appG.1 mb).elim (fun hi => c5 sw t0 t1 ((eX.2 a).1 ma) ((eI.2 b).1 hi))
(fun hm => (kQ1 a b (pX a ma) (pM b hm) (pass_ne a b (lt_le_lt ((eX.2 a).1 ma).2 (pxleP sw) ((eMs.2 b).1 hm).2.1))).2
(lt_le_lt ((eX.2 a).1 ma).2 (pxleP sw) ((eMs.2 b).1 hm).2.1))),
⟨eYs.1, fun x => (eYs.2 x).trans (R1Q sw t0 t1 hmt hA x).symm⟩,
tr Ys pY _ _ kP0 kQ1 iYs, rfl⟩
-- P's lists after the swap
have nd2 : NdG (Ms ++ (outList G1 Q ++ Ys)) :=
ndG_app _ _ eMs.1 (ndG_app _ _ eO.1 eYs.1 (fun x hx hy => (pY x hy).2.2.1 (inO x hx)))
(fun x hm hr => (mem_appG.1 hr).elim (fun ho => (pM x hm).2.2.1 (inO x ho))
(fun hy => lt_asymm F ((eMs.2 x).1 hm).2.2 (lt_of_le_of_lt F (pxleQ sw) ((eYs.2 x).1 hy).2)))
have lP' : LayerOf G1 P ⟨labs G1 LsP, gP, labs G1 (Ms ++ (outList G1 Q ++ Ys))⟩ :=
⟨gP, LsP, Ms ++ (outList G1 Q ++ Ys), hkP1,
⟨eX.1, fun x => (eX.2 x).trans (L1P sw t0 t1 hmt hA x).symm⟩, tr LsP pX _ _ kP0 kP1 iLP,
⟨nd2, fun x => Iff.trans (by
exact ⟨fun m => (mem_appG.1 m).elim (fun h => .inl ((eMs.2 x).1 h))
(fun h => (mem_appG.1 h).elim (fun h' => .inr (.inl ((eO.2 x).1 h'))) (fun h' => .inr (.inr ((eYs.2 x).1 h')))),
fun h => h.elim (fun h' => mem_appG.2 (.inl ((eMs.2 x).2 h')))
(fun h' => h'.elim (fun h'' => mem_appG.2 (.inr (mem_appG.2 (.inl ((eO.2 x).2 h'')))))
(fun h'' => mem_appG.2 (.inr (mem_appG.2 (.inr ((eYs.2 x).2 h''))))))⟩) (R1P sw t0 t1 hmt hA x).symm⟩,
incr_app _ _ _ (tr Ms pM _ _ kP0 kP1 iMs)
(incr_app _ _ _ (incr_out hv1 hQ1 _ (fun p hp => ((atP1 sw _).2 (.inl ⟨⟨hQ1, hp⟩, rfl⟩)).2))
(tr Ys pY _ _ kP0 kP1 iYs)
(fun a b ma mb => c8 sw t0 t1 hmt ((eO.2 a).1 ma) ((eYs.2 b).1 mb)))
(fun a b ma mb => (mem_appG.1 mb).elim (fun ho => c7 sw t0 t1 hmt ((eMs.2 a).1 ma) ((eO.2 b).1 ho))
(fun hy => (kP1 a b (pM a ma) (pY b hy) (pass_ne a b (lt_le_lt ((eMs.2 a).1 ma).2.2 (pxleQ sw) ((eYs.2 b).1 hy).2))).2
(lt_le_lt ((eMs.2 a).1 ma).2.2 (pxleQ sw) ((eYs.2 b).1 hy).2))),
rfl⟩
refine ⟨_, _, lQ', lP', fun tl => ?_⟩
rw [eP, eQ, eR1, eR2, hIs, eL1, eL2, hXs', hMs', hOs, hYs]
have hlab : lab G1 = lab G0 := by unfold lab; rw [sw.fam.kind1]
have d1 := labs_in hv0 sw.hQ hkQ
have c1' := labs_out (G := G0) hkP
have d2 := labs_in hv1 hP1 hkP1
have c2' := labs_out (G := G1) hkQ1
unfold labs at d1 c1' d2 c2' ⊢
rw [hlab] at d2 c2' ⊢
rw [map_app', map_app', map_app', map_app', map_app', map_app', map_app', map_app', d1, c1', d2, c2']
exact .here (app_assoc _ _ _).symm (app_assoc _ _ _).symm (app_assoc _ _ _).symm (app_assoc _ _ _).symm
end Y
end TP
end Found
#print axioms Found.TP.swap_layers
lean_all/found/Top14.lean
/-
T193 (topological), part 14. found/Top14 — the reading after two boxes
swap heights (lower box on the left at the meeting): the two boxes are
adjacent in the height order, every other box keeps its layer, the two
layers are replaced by an interchange; so the readings differ by one
interchange move.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top13
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## lists -/
theorem fa2_app {α β : Type} {R : α → β → Prop} : (a : List α) → {l : List α} → {m : List β} → Fa2 R (a ++ l) m →
∃ ma mb, m = ma ++ mb ∧ Fa2 R a ma ∧ Fa2 R l mb
| [], _, m, h => ⟨[], m, rfl, .nil, h⟩
| _ :: a, _, _, .cons h t => match fa2_app a t with
| ⟨ma, mb, e, ha, hb⟩ => ⟨_ :: ma, mb, by rw [e]; rfl, .cons h ha, hb⟩
theorem fa2_join {α β : Type} {R : α → β → Prop} : {a : List α} → {ma : List β} → Fa2 R a ma → {l : List α} → {mb : List β} →
Fa2 R l mb → Fa2 R (a ++ l) (ma ++ mb)
| _, _, .nil, _, _, h => h
| _, _, .cons h t, _, _, h' => .cons h (fa2_join t h')
theorem istep_pre (DA : List (Ly S)) {D D' : List (Ly S)} (h : IStep D D') : IStep (DA ++ D) (DA ++ D') := by
induction DA with
| nil => exact h
| cons l DA ih => exact .cons l ih
theorem split_nat {x : Nat} : {l : List Nat} → x ∈ l → ∃ a b, l = a ++ x :: b
| _ :: b, .head _ => ⟨[], b, rfl⟩
| y :: _, .tail _ m => match split_nat m with
| ⟨a, b, e⟩ => ⟨y :: a, b, by rw [e]; rfl⟩
theorem incr_app_inv {α : Type} (k : α → F.K) : (a : List α) → {b : List α} → Incr F k (a ++ b) →
Incr F k a ∧ Incr F k b ∧ ∀ x y, x ∈ a → y ∈ b → F.lt (k x) (k y)
| [], _, h => ⟨trivial, h, fun _ _ m => nomatch m⟩
| x :: a, _, h =>
have ih := incr_app_inv k a (incr_tail F k h)
⟨incr_cons k ih.1 (fun z m => incr_head F k h z (mem_appG.2 (.inl m))), ih.2.1,
fun u v mu mv => match mu with
| .head _ => incr_head F k h v (mem_appG.2 (.inr mv))
| .tail _ m => ih.2.2 u v m mv⟩
/-- two keys adjacent in a sorted list -/
theorem adjacent {k : Nat → F.K} {l : List Nat} (hi : Incr F k l) {p q : Nat} (hp : p ∈ l) (hq : q ∈ l)
(hpq : F.lt (k p) (k q)) (gap : ∀ x, x ∈ l → F.lt (k p) (k x) → F.lt (k x) (k q) → False) :
∃ a b, l = a ++ p :: q :: b := by
match split_nat hp with
| ⟨a, c, e⟩ =>
rw [e] at hi hq
have hi' := incr_app_inv k a hi
match c, hi', hq with
| [], _, hq' => exact match mem_appG.1 hq' with
| .inl m => absurd (hi'.2.2 q p m (.head _)) (lt_asymm F hpq)
| .inr m => match m with
| .head _ => absurd hpq (F.irr _)
| .tail _ m' => nomatch m'
| c0 :: c, hi'', hq' =>
have hc0 : F.lt (k p) (k c0) := incr_head F k hi''.2.1 c0 (.head _)
refine ⟨a, c, ?_⟩
rw [e]
match mem_appG.1 hq' with
| .inl m => exact absurd (hi''.2.2 q p m (.head _)) (lt_asymm F hpq)
| .inr m =>
match m with
| .head _ => exact absurd hpq (F.irr _)
| .tail _ m' =>
match m' with
| .head _ => rfl
| .tail _ m'' =>
exact (gap c0 (by rw [e]; exact mem_appG.2 (.inr (.tail _ (.head _)))) hc0
(incr_head F k (incr_tail F k hi''.2.1) q m'')).elim
theorem fa2_mono {α β : Type} {R R' : α → β → Prop} : {l : List α} → {m : List β} → (∀ x y, x ∈ l → R x y → R' x y) →
Fa2 R l m → Fa2 R' l m
| _, _, _, .nil => .nil
| _, _, h, .cons r t => .cons (h _ _ (.head _) r) (fa2_mono (fun x y m r => h x y (.tail _ m) r) t)
theorem nd_swap {α : Type} {p q : α} : (a : List α) → {b : List α} → NdG (a ++ p :: q :: b) → NdG (a ++ q :: p :: b)
| [], _, h => ⟨fun m => match m with
| .head _ => h.1 (.head _)
| .tail _ m' => h.2.1 m', ⟨fun m => h.1 (.tail _ m), h.2.2⟩⟩
| _ :: a, _, h => ⟨fun m => h.1 (mem_appG.2 ((mem_appG.1 m).elim .inl (fun m' => .inr (match m' with
| .head _ => .tail _ (.head _)
| .tail _ (.head _) => .head _
| .tail _ (.tail _ m'') => .tail _ (.tail _ m''))))), nd_swap a h.2⟩
theorem mem_swap {α : Type} {p q x : α} (a b : List α) : x ∈ a ++ q :: p :: b ↔ x ∈ a ++ p :: q :: b :=
⟨fun m => mem_appG.2 ((mem_appG.1 m).elim .inl (fun m' => .inr (match m' with
| .head _ => .tail _ (.head _)
| .tail _ (.head _) => .head _
| .tail _ (.tail _ m'') => .tail _ (.tail _ m'')))),
fun m => mem_appG.2 ((mem_appG.1 m).elim .inl (fun m' => .inr (match m' with
| .head _ => .tail _ (.head _)
| .tail _ (.head _) => .head _
| .tail _ (.tail _ m'') => .tail _ (.tail _ m''))))⟩
theorem nd_notin {α : Type} {p : α} : (a : List α) → {b : List α} → NdG (a ++ p :: b) → (¬ p ∈ a) ∧ ¬ p ∈ b
| [], _, h => ⟨(fun m => nomatch m), h.1⟩
| _ :: a, _, h => ⟨fun m => match m with
| .head _ => h.1 (mem_appG.2 (.inr (.head _)))
| .tail _ m' => (nd_notin a h.2).1 m', (nd_notin a h.2).2⟩
theorem nd_notin2 {α : Type} {p q : α} : (a : List α) → {b : List α} → NdG (a ++ p :: q :: b) → (¬ q ∈ a) ∧ ¬ q ∈ b
| [], _, h => ⟨(fun m => nomatch m), h.2.1⟩
| _ :: a, _, h => ⟨fun m => match m with
| .head _ => h.1 (mem_appG.2 (.inr (.tail _ (.head _))))
| .tail _ m' => (nd_notin2 a h.2).1 m', (nd_notin2 a h.2).2⟩
section Z
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q)
include sw
/-- the reading after the swap (lower box on the left at the meeting) -/
theorem swapA_reads {ts : F.K} (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q)
(hA : F.lt (xr G0 P) (G0.px Q)) (hv0 : Valid G0) (hv1 : Valid G1)
(hgen : ∀ R, R < G0.nn → IsBox (G0.kind R) → R ≠ P → R ≠ Q → BoxGen Fm G0.nn R)
{D : List (Ly S)} (h : Reads G0 D) : ∃ D', Reads G1 D' ∧ IStep D D' := by
match h with
| ⟨bl, he, hi, hf⟩ =>
have hPb : P ∈ bl := (he.2 P).2 ⟨sw.hP, sw.bP⟩
have hQb : Q ∈ bl := (he.2 Q).2 ⟨sw.hQ, sw.bQ⟩
match adjacent hi hPb hQb sw.lo0 (fun x m a b =>
have hx := (he.2 x).1 m
gap0 sw hx.1 (fun e => F.irr _ (by rw [e] at a; exact a)) (fun e => F.irr _ (by rw [e] at b; exact b)) a b) with
| ⟨a, b, ebl⟩ =>
rw [ebl] at hf he hi
match fa2_app a hf with
| ⟨ma, mb, eD, ha, hb⟩ =>
match hb with
| .cons (b := lyP) hlP (.cons (b := lyQ) hlQ (m := mb') hb') =>
match swap_layers sw t0 t1 hmt hA hv0 hv1 hlP hlQ with
| ⟨lyQ', lyP', LQ', LP', ist⟩ =>
have nd := he.1
have nP := nd_notin a nd
have nQ := nd_notin2 a nd
have inbl : ∀ x, x ∈ a ∨ x ∈ b → x < G0.nn ∧ IsBox (G0.kind x) := fun x h' => (he.2 x).1 (h'.elim
(fun m => mem_appG.2 (.inl m)) (fun m => mem_appG.2 (.inr (.tail _ (.tail _ m)))))
have neP : ∀ x, x ∈ a ∨ x ∈ b → x ≠ P := fun x h' e => h'.elim (fun m => nP.1 (e ▸ m)) (fun m => nP.2 (e ▸ (.tail _ m)))
have neQ : ∀ x, x ∈ a ∨ x ∈ b → x ≠ Q := fun x h' e => h'.elim (fun m => nQ.1 (e ▸ m)) (fun m => nQ.2 (e ▸ m))
-- heights of other boxes keep their order with everything
have up : ∀ x y, x ∈ a ∨ x ∈ b → y < G0.nn → x ≠ y → F.lt (G0.py x) (G0.py y) → F.lt (G1.py x) (G1.py y) :=
fun x y hx hy hne h' => by
have := (hh_keepF sw.fam (hgen x (inbl x hx).1 (inbl x hx).2 (neP x hx) (neQ x hx)) hy hne).2 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this; exact this
have upP : ∀ y, y ∈ b → F.lt (G0.py P) (G0.py y) → F.lt (G1.py P) (G1.py y) := fun y hy h' => by
have := (keepP sw (inbl y (.inr hy)).1 (neP y (.inr hy)) (neQ y (.inr hy))).2 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this; exact this
have upQ : ∀ y, y ∈ b → F.lt (G0.py Q) (G0.py y) → F.lt (G1.py Q) (G1.py y) := fun y hy h' => by
have := (keepQ sw (inbl y (.inr hy)).1 (neP y (.inr hy)) (neQ y (.inr hy))).2 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this; exact this
have hiA := incr_app_inv G0.py a hi
have hiB : Incr F G0.py (Q :: b) := incr_tail F _ hiA.2.1
have incrA : Incr F G1.py a := incr_transfer G0.py G1.py a (fun x y mx my h' =>
up x y (.inl mx) (inbl y (.inl my)).1 (fun e => F.irr _ (by rw [e] at h'; exact h')) h') hiA.1
have incrB : Incr F G1.py b := incr_transfer G0.py G1.py b (fun x y mx my h' =>
up x y (.inr mx) (inbl y (.inr my)).1 (fun e => F.irr _ (by rw [e] at h'; exact h')) h') (incr_tail F _ hiB)
have incrQPb : Incr F G1.py (Q :: P :: b) :=
incr_cons _ (incr_cons _ incrB (fun y m => upP y m (incr_head F _ hiA.2.1 y (.tail _ m))))
(fun y m => match m with
| .head _ => sw.hi1
| .tail _ m' => upQ y m' (incr_head F _ hiB y m'))
have cross : ∀ x y, x ∈ a → y ∈ Q :: P :: b → F.lt (G1.py x) (G1.py y) := fun x y mx my =>
have h0 := hiA.2.2 x y mx (match my with
| .head _ => .tail _ (.head _)
| .tail _ (.head _) => .head _
| .tail _ (.tail _ m) => .tail _ (.tail _ m))
have hy : y < G0.nn := (he.2 y).1 (mem_appG.2 (.inr (match my with
| .head _ => .tail _ (.head _)
| .tail _ (.head _) => .head _
| .tail _ (.tail _ m) => .tail _ (.tail _ m)))) |>.1
up x y (.inl mx) hy (fun e => F.irr _ (by rw [e] at h0; exact h0)) h0
refine ⟨ma ++ lyQ' :: lyP' :: mb', ⟨a ++ Q :: P :: b,
⟨nd_swap a nd, fun x => (mem_swap a b).trans ((he.2 x).trans (by rw [sw.fam.nn1, sw.fam.kind1]))⟩,
incr_app _ a _ incrA incrQPb cross,
fa2_join (fa2_mono (fun x y m r => layer_keep sw.fam (inbl x (.inl m)).1
(hgen x (inbl x (.inl m)).1 (inbl x (.inl m)).2 (neP x (.inl m)) (neQ x (.inl m))) r) ha)
(.cons LQ' (.cons LP' (fa2_mono (fun x y m r => layer_keep sw.fam (inbl x (.inr m)).1
(hgen x (inbl x (.inr m)).1 (inbl x (.inr m)).2 (neP x (.inr m)) (neQ x (.inr m))) r) hb')))⟩,
by rw [eD]; exact istep_pre ma (ist mb')⟩
end Z
end TP
end Found
#print axioms Found.TP.fa2_app
#print axioms Found.TP.adjacent
#print axioms Found.TP.swapA_reads
lean_all/found/Top15.lean
/-
T193 (topological), part 15. found/Top15 — every valid generic drawing
has a reading (filter and sort, in the classical point K); time reversal
of linear families; so a swap of two boxes changes the reading by an
interchange whichever box is on the left at the meeting.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
Classical point: K (filtering by a property), as a parameter.
-/
import found.Top14
import found.ClassicalPoint
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## filtering and sorting -/
theorem filt (K : CP.Classical') {α : Type} (P : α → Prop) : (l : List α) → NdG l →
∃ l', NdG l' ∧ ∀ x, x ∈ l' ↔ x ∈ l ∧ P x
| [], _ => ⟨[], trivial, fun _ => ⟨(fun m => nomatch m), (fun ⟨m, _⟩ => nomatch m)⟩⟩
| a :: l, hd => match filt K P l hd.2 with
| ⟨l', hn, hm⟩ => (K.lem (P a)).elim
(fun hp => ⟨a :: l', ⟨fun m => hd.1 ((hm a).1 m).1, hn⟩, fun x => ⟨fun m => match m with
| .head _ => ⟨.head _, hp⟩
| .tail _ m' => ⟨.tail _ ((hm x).1 m').1, ((hm x).1 m').2⟩,
fun ⟨m, px⟩ => match m with
| .head _ => .head _
| .tail _ m' => .tail _ ((hm x).2 ⟨m', px⟩)⟩⟩)
(fun hn' => ⟨l', hn, fun x => ⟨fun m => ⟨.tail _ ((hm x).1 m).1, ((hm x).1 m).2⟩,
fun ⟨m, px⟩ => match m with
| .head _ => absurd px hn'
| .tail _ m' => (hm x).2 ⟨m', px⟩⟩⟩)
theorem ins_sorted {α : Type} (k : α → F.K) (a : α) : (l : List α) → Incr F k l → (∀ x, x ∈ l → k x ≠ k a) →
∃ l', (∀ x, x ∈ l' ↔ x = a ∨ x ∈ l) ∧ Incr F k l' ∧ l'.length = l.length + 1
| [], _, _ => ⟨[a], fun x => ⟨fun m => match m with
| .head _ => .inl rfl, fun h => h.elim (fun e => e ▸ .head _) (fun m => nomatch m)⟩, trivial, rfl⟩
| b :: l, hi, hne => match F.tri (k a) (k b) with
| .inl h => ⟨a :: b :: l, fun x => ⟨fun m => match m with
| .head _ => .inl rfl
| .tail _ m' => .inr m', fun h' => h'.elim (fun e => e ▸ .head _) (fun m => .tail _ m)⟩,
incr_cons k hi (fun x m => match m with
| .head _ => h
| .tail _ m' => F.trans _ _ _ h (incr_head F k hi x m')), rfl⟩
| .inr (.inl e) => absurd e.symm (hne b (.head _))
| .inr (.inr h) => match ins_sorted k a l (incr_tail F k hi) (fun x m => hne x (.tail _ m)) with
| ⟨l', hm, hi', hl⟩ => ⟨b :: l', fun x => ⟨fun m => match m with
| .head _ => .inr (.head _)
| .tail _ m' => ((hm x).1 m').elim .inl (fun m'' => .inr (.tail _ m'')),
fun h' => h'.elim (fun e => .tail _ ((hm x).2 (.inl e))) (fun m => match m with
| .head _ => .head _
| .tail _ m' => .tail _ ((hm x).2 (.inr m')))⟩,
incr_cons k hi' (fun x m => ((hm x).1 m).elim (fun e => e ▸ h) (fun m' => incr_head F k hi x m')),
by show l'.length + 1 = l.length + 1 + 1; rw [hl]⟩
theorem nd_of_incr {α : Type} (k : α → F.K) : (l : List α) → Incr F k l → NdG l
| [], _ => trivial
| a :: l, hi => ⟨fun m => F.irr _ (by have := incr_head F k hi a m; exact this), nd_of_incr k l (incr_tail F k hi)⟩
theorem sort_ex {α : Type} (k : α → F.K) : (l : List α) → NdG l → (∀ x y, x ∈ l → y ∈ l → x ≠ y → k x ≠ k y) →
∃ l', Enum (fun x => x ∈ l) l' ∧ Incr F k l'
| [], _, _ => ⟨[], ⟨trivial, fun _ => Iff.rfl⟩, trivial⟩
| a :: l, hd, hk => match sort_ex k l hd.2 (fun x y mx my => hk x y (.tail _ mx) (.tail _ my)) with
| ⟨l', he, hi⟩ => match ins_sorted k a l' hi (fun x m e => hk x a (.tail _ ((he.2 x).1 m)) (.head _)
(fun ex => hd.1 (ex ▸ (he.2 x).1 m)) e) with
| ⟨l'', hm, hi', _⟩ => ⟨l'', ⟨nd_of_incr k l'' hi', fun x => (hm x).trans ⟨fun h => h.elim (fun e => e ▸ .head _)
(fun m => .tail _ ((he.2 x).1 m)), fun m => match m with
| .head _ => .inl rfl
| .tail _ m' => .inr ((he.2 x).2 m')⟩⟩, hi'⟩
theorem nd_rng : (a n : Nat) → NdG (rng a n)
| _, 0 => trivial
| a, n + 1 => ⟨fun m => absurd ((mem_rng (a + 1) n a).1 m).1 (Nat.not_succ_le_self a), nd_rng (a + 1) n⟩
/-! ## all segments -/
def segsFrom (G : Drw F S) : List Nat → List (Nat × Nat)
| [] => []
| n :: l => (rng 0 (nOut (G.kind n))).map (fun p => (n, p)) ++ segsFrom G l
theorem mem_segsFrom (G : Drw F S) (e : Nat × Nat) : (l : List Nat) → (e ∈ segsFrom G l ↔ e.1 ∈ l ∧ e.2 < nOut (G.kind e.1))
| [] => ⟨(fun m => nomatch m), (fun ⟨m, _⟩ => nomatch m)⟩
| n :: l => ⟨fun m => (mem_appG.1 m).elim
(fun m' => match (mem_mapG _ _).1 m' with
| ⟨p, hp, ep⟩ => by
rw [← ep]
have := (mem_rng 0 _ p).1 hp
exact ⟨.head _, by rw [Nat.zero_add] at this; exact this.2⟩)
(fun m' => ⟨.tail _ ((mem_segsFrom G e l).1 m').1, ((mem_segsFrom G e l).1 m').2⟩),
fun ⟨m, hp⟩ => match m with
| .head _ => mem_appG.2 (.inl ((mem_mapG _ _).2 ⟨e.2, (mem_rng 0 _ _).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact hp⟩, rfl⟩))
| .tail _ m' => mem_appG.2 (.inr ((mem_segsFrom G e l).2 ⟨m', hp⟩))⟩
theorem nd_segsFrom (G : Drw F S) : (l : List Nat) → NdG l → NdG (segsFrom G l)
| [], _ => trivial
| n :: l, hd => ndG_app _ _ (nd_map_rng _ 0 _ (fun _ _ _ _ _ _ e => (Prod.mk.inj e).2)) (nd_segsFrom G l hd.2)
(fun x hx hy => match (mem_mapG _ _).1 hx with
| ⟨_, _, ex⟩ => hd.1 (by have := ((mem_segsFrom G x l).1 hy).1; rw [← ex] at this; exact this))
theorem seg_all (G : Drw F S) (e : Nat × Nat) : Seg G e ↔ e ∈ segsFrom G (rng 0 G.nn) :=
⟨fun ⟨h1, h2⟩ => (mem_segsFrom G e _).2 ⟨(mem_rng 0 _ _).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact h1⟩, h2⟩,
fun m => match (mem_segsFrom G e _).1 m with
| ⟨h1, h2⟩ => ⟨by have := ((mem_rng 0 _ _).1 h1).2; rw [Nat.zero_add] at this; exact this, h2⟩⟩
/-- every valid generic drawing has a reading -/
theorem reads_ex (K : CP.Classical') {G : Drw F S} (hv : Valid G) (hg : Generic G) : ∃ D, Reads G D := by
have allS := nd_segsFrom G (rng 0 G.nn) (nd_rng 0 _)
-- a sorted list of segments with property P at height y
have side : ∀ (j : Nat), j < G.nn → ∀ (P : Nat × Nat → Prop), (∀ e, P e → Seg G e ∧ Open G e (G.py j)) →
∃ l, Enum P l ∧ Incr F (fun e => X G e (G.py j)) l := fun j _ P hP =>
match filt K P _ allS with
| ⟨l0, hn, hm⟩ => match sort_ex (fun e => X G e (G.py j)) l0 hn (fun x y mx my hne =>
have px := ((hm x).1 mx).2
have py := ((hm y).1 my).2
hv.segs x y (hP x px).1 (hP y py).1 hne _ (hP x px).2 (hP y py).2) with
| ⟨l, he, hi⟩ => ⟨l, ⟨he.1, fun x => (he.2 x).trans ((hm x).trans ⟨fun h => h.2, fun h => ⟨(seg_all G x).1 (hP x h).1, h⟩⟩)⟩, hi⟩
have lay : ∀ j, j < G.nn → IsBox (G.kind j) → ∃ ly, LayerOf G j ly := fun j hj hb => by
match hk : G.kind j with
| .box g =>
match side j hj (Lft G j) (fun e h => ⟨h.1, h.2.1⟩), side j hj (Rgt G j) (fun e h => ⟨h.1, h.2.1⟩) with
| ⟨Ls, hL, iL⟩, ⟨Rs, hR, iR⟩ => exact ⟨_, g, Ls, Rs, hk, hL, iL, hR, iR, rfl⟩
| .bend _ => rw [hk] at hb; exact hb.elim
| .src _ => rw [hk] at hb; exact hb.elim
| .snk _ => rw [hk] at hb; exact hb.elim
match filt K (fun j => IsBox (G.kind j)) (rng 0 G.nn) (nd_rng 0 _) with
| ⟨b0, hn, hm⟩ =>
have inb : ∀ j, j ∈ b0 ↔ j < G.nn ∧ IsBox (G.kind j) := fun j => (hm j).trans
⟨fun ⟨m, h⟩ => ⟨by have := ((mem_rng 0 _ _).1 m).2; rw [Nat.zero_add] at this; exact this, h⟩,
fun ⟨h1, h⟩ => ⟨(mem_rng 0 _ _).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact h1⟩, h⟩⟩
match sort_ex G.py b0 hn (fun x y mx my hne => hg x y ((inb x).1 mx).1 ((inb y).1 my).1 ((inb x).1 mx).2 hne) with
| ⟨bl, he, hi⟩ =>
have hbl : ∀ j, j ∈ bl → j < G.nn ∧ IsBox (G.kind j) := fun j m => (inb j).1 ((he.2 j).1 m)
have go : ∀ (l : List Nat), (∀ j, j ∈ l → j < G.nn ∧ IsBox (G.kind j)) → ∃ D, Fa2 (LayerOf G) l D := by
intro l
induction l with
| nil => exact fun _ => ⟨[], .nil⟩
| cons j l ih =>
intro h'
match lay j (h' j (.head _)).1 (h' j (.head _)).2, ih (fun x m => h' x (.tail _ m)) with
| ⟨ly, hly⟩, ⟨D, hD⟩ => exact ⟨ly :: D, .cons hly hD⟩
match go bl hbl with
| ⟨D, hD⟩ => exact ⟨D, bl, ⟨he.1, fun j => (he.2 j).trans (inb j)⟩, hi, hD⟩
/-! ## time reversal -/
def revF (Fm : F.K → Drw F S) (t : F.K) : Drw F S := Fm (sub F.R F.R.one t)
theorem rev_in {t : F.K} (ht : In01 F t) : In01 F (sub F.R F.R.one t) :=
⟨ht.2.elim (fun h => .inl (sub_pos F h)) (fun e => .inr (by rw [e]; lib_ring)),
ht.1.elim (fun h => .inl (pos_sub F (by rw [show sub F.R F.R.one (sub F.R F.R.one t) = t by lib_ring]; exact h)))
(fun e => .inr (by rw [← e]; lib_ring))⟩
theorem lin_rev (a b t : F.K) : lin F a b (sub F.R F.R.one t) = lin F b a t := by unfold lin; lib_ring
theorem fam_rev {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) : LinFam G1 G0 (revF Fm) where
nn t := (h.nn _).trans h.nn1.symm
kind t := (h.kind _).trans h.kind1.symm
px t := (h.px _).trans h.px1.symm
tgt t := (h.tgt _).trans h.tgt1.symm
wd t := (h.wd _).trans h.wd1.symm
ox t := (h.ox _).trans h.ox1.symm
ix t := (h.ix _).trans h.ix1.symm
nn1 := h.nn1.symm
kind1 := h.kind1.symm
px1 := h.px1.symm
tgt1 := h.tgt1.symm
wd1 := h.wd1.symm
ox1 := h.ox1.symm
ix1 := h.ix1.symm
py t k := by unfold revF; rw [h.py, lin_rev]
X t e Q he := by
unfold revF
have he0 : Seg G0 e := (seg1 h e).1 he
rw [h.X _ e Q he0, lin_rev]
valid t ht := h.valid _ (rev_in ht)
theorem swap_rev {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q) :
Swap G1 G0 (revF Fm) Q P where
fam := fam_rev sw.fam
hP := by rw [sw.fam.nn1]; exact sw.hQ
hQ := by rw [sw.fam.nn1]; exact sw.hP
bP := by rw [sw.fam.kind1]; exact sw.bQ
bQ := by rw [sw.fam.kind1]; exact sw.bP
ne := fun e => sw.ne e.symm
gP t ht k hk h1 h2 := sw.gQ _ (rev_in ht) k (by rw [← sw.fam.nn1]; exact hk) h2 h1
gQ t ht k hk h1 h2 := sw.gP _ (rev_in ht) k (by rw [← sw.fam.nn1]; exact hk) h2 h1
lo0 := sw.hi1
hi1 := sw.lo0
/-! ## the reading across a swap -/
/-- two boxes passing each other's height change the reading by an interchange -/
theorem swap_reads (K : CP.Classical') {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q)
(hv0 : Valid G0) (hv1 : Valid G1) (hg1 : Generic G1)
(hgen : ∀ R, R < G0.nn → IsBox (G0.kind R) → R ≠ P → R ≠ Q → BoxGen Fm G0.nn R)
{D : List (Ly S)} (h : Reads G0 D) : ∃ D', Reads G1 D' ∧ DEq D D' :=
match tstar sw with
| ⟨ts, t0, t1, hmt⟩ => match bars sw t0 t1 hmt with
| .inl hA => match swapA_reads sw t0 t1 hmt hA hv0 hv1 hgen h with
| ⟨D', h', st⟩ => ⟨D', h', .step st⟩
| .inr hB =>
have sr := swap_rev sw
have t0' : F.lt F.R.zero (sub F.R F.R.one ts) := sub_pos F t1
have t1' : F.lt (sub F.R F.R.one ts) F.R.one := pos_sub F (by
rw [show sub F.R F.R.one (sub F.R F.R.one ts) = ts by lib_ring]; exact t0)
have hmt' : (revF Fm (sub F.R F.R.one ts)).py Q = (revF Fm (sub F.R F.R.one ts)).py P := by
unfold revF; rw [show sub F.R F.R.one (sub F.R F.R.one ts) = ts by lib_ring]; exact hmt.symm
have hA' : F.lt (xr G1 Q) (G1.px P) := by rw [xr1F sw.fam, sw.fam.px1]; exact hB
have hgen' : ∀ R, R < G1.nn → IsBox (G1.kind R) → R ≠ Q → R ≠ P → BoxGen (revF Fm) G1.nn R :=
fun R hR hb h1 h2 t ht k hk hne => by
rw [sw.fam.nn1] at hR hk; rw [sw.fam.kind1] at hb
exact hgen R hR hb h2 h1 _ (rev_in ht) k hk hne
match reads_ex K hv1 hg1 with
| ⟨D1, hD1⟩ => match swapA_reads sr t0' t1' hmt' hA' hv1 hv0 hgen' hD1 with
| ⟨D0, hD0, st⟩ => ⟨D1, hD1, by rw [reads_uniq G0 h hD0]; exact .symm (.step st)⟩
/-- a linear family in which no box height meets another node keeps the reading -/
theorem fam_reads0 {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm)
(hgen : ∀ R, R < G0.nn → IsBox (G0.kind R) → BoxGen Fm G0.nn R) {D : List (Ly S)} (hr : Reads G0 D) : Reads G1 D :=
match hr with
| ⟨bl, he, hi, hf⟩ =>
have hbl : ∀ j, j ∈ bl → j < G0.nn ∧ IsBox (G0.kind j) := fun j m => (he.2 j).1 m
⟨bl, ⟨he.1, fun j => (he.2 j).trans (by rw [h.nn1, h.kind1])⟩,
incr_transfer G0.py G1.py bl (fun x y mx my hxy => by
have := (hh_keepF h (hgen x (hbl x mx).1 (hbl x mx).2) (hbl y my).1
(fun e => F.irr _ (by rw [e] at hxy; exact hxy))).2 hxy F.R.one in1
rw [pyF1 h, pyF1 h] at this; exact this) hi,
fa2_mono (fun x y m r => layer_keep h (hbl x m).1 (hgen x (hbl x m).1 (hbl x m).2) r) hf⟩
end TP
end Found
#print axioms Found.TP.filt
#print axioms Found.TP.sort_ex
#print axioms Found.TP.reads_ex
#print axioms Found.TP.fam_rev
#print axioms Found.TP.swap_reads
#print axioms Found.TP.fam_reads0
lean_all/found/Top16.lean
/-
T193 (topological), part 16. found/Top16 — renumbering the nodes of a
drawing (σ, τ mutually inverse on the node indices, every datum carried
along pointwise) keeps validity, genericity and the reading. With σ = τ =
id this also says that pointwise equal drawings are interchangeable.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top15
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- G' is G with node n renamed σ n -/
structure IsRn (σ τ : Nat → Nat) (G G' : Drw F S) : Prop where
nn : G'.nn = G.nn
st : ∀ n, n < G.nn → σ n < G.nn ∧ τ (σ n) = n
ts : ∀ n, n < G.nn → τ n < G.nn ∧ σ (τ n) = n
kind : ∀ n, n < G.nn → G'.kind (σ n) = G.kind n
px : ∀ n, n < G.nn → G'.px (σ n) = G.px n
py : ∀ n, n < G.nn → G'.py (σ n) = G.py n
wd : ∀ n, n < G.nn → G'.wd (σ n) = G.wd n
ox : ∀ n p, n < G.nn → p < nOut (G.kind n) → G'.ox (σ n) p = G.ox n p
ix : ∀ n q, n < G.nn → q < nIn (G.kind n) → G'.ix (σ n) q = G.ix n q
tgt : ∀ e, Seg G e → G'.tgt (σ e.1, e.2) = (σ (G.tgt e).1, (G.tgt e).2)
src : ∀ m q, m < G.nn → q < nIn (G.kind m) → G'.src (σ m, q) = (σ (G.src (m, q)).1, (G.src (m, q)).2)
def sg (σ : Nat → Nat) (e : Nat × Nat) : Nat × Nat := (σ e.1, e.2)
/-! ## list tools -/
theorem nd_map_inj {α β : Type} (f : α → β) : (l : List α) → (∀ x y, x ∈ l → y ∈ l → f x = f y → x = y) →
NdG l → NdG (l.map f)
| [], _, _ => trivial
| a :: l, hi, hn => ⟨fun m => match (mem_mapG f l).1 m with
| ⟨x, hx, e⟩ => hn.1 (by rw [← hi x a (.tail _ hx) (.head _) e]; exact hx),
nd_map_inj f l (fun x y mx my e => hi x y (.tail _ mx) (.tail _ my) e) hn.2⟩
theorem incr_map {α β : Type} (k : β → F.K) (f : α → β) : (l : List α) → Incr F (fun x => k (f x)) l → Incr F k (l.map f)
| [], _ => trivial
| [_], _ => trivial
| _ :: b :: l, h => ⟨h.1, incr_map k f (b :: l) h.2⟩
theorem incr_eqk {α : Type} {k k' : α → F.K} : (l : List α) → (∀ x, x ∈ l → k x = k' x) → Incr F k l → Incr F k' l
| [], _, _ => trivial
| [_], _, _ => trivial
| a :: b :: l, he, h => ⟨by rw [← he a (.head _), ← he b (.tail _ (.head _))]; exact h.1,
incr_eqk (b :: l) (fun x m => he x (.tail _ m)) h.2⟩
theorem fa2_map {α β : Type} {R R' : α → β → Prop} (f : α → α) : {l : List α} → {m : List β} →
(∀ x y, x ∈ l → R x y → R' (f x) y) → Fa2 R l m → Fa2 R' (l.map f) m
| _, _, _, .nil => .nil
| _, _, h, .cons r t => .cons (h _ _ (.head _) r) (fa2_map f (fun x y m r => h x y (.tail _ m) r) t)
section R
variable {σ τ : Nat → Nat} {G G' : Drw F S} (h : IsRn σ τ G G') (hv : Valid G)
include h
theorem seg_rn {e : Nat × Nat} (he : Seg G e) : Seg G' (sg σ e) :=
⟨by rw [h.nn]; exact (h.st e.1 he.1).1, by show e.2 < nOut (G'.kind (σ e.1)); rw [h.kind e.1 he.1]; exact he.2⟩
theorem seg_back {e : Nat × Nat} (he : Seg G' e) : Seg G (τ e.1, e.2) ∧ sg σ (τ e.1, e.2) = e := by
have hn : e.1 < G.nn := by rw [← h.nn]; exact he.1
have k := h.ts e.1 hn
refine ⟨⟨k.1, ?_⟩, by unfold sg; rw [k.2]⟩
have := he.2; rw [← k.2, h.kind _ k.1] at this; exact this
theorem node_back {k : Nat} (hk : k < G'.nn) : τ k < G.nn ∧ σ (τ k) = k := h.ts k (by rw [← h.nn]; exact hk)
include hv
omit hv in
theorem hi_rn {e : Nat × Nat} (he : Seg G e) : hiN G' (sg σ e) = σ (hiN G e) := by
unfold hiN sg; rw [h.tgt e he]
theorem X_rn {e : Nat × Nat} (he : Seg G e) (y : F.K) : X G' (sg σ e) y = X G e y := by
have hi := (hv.tgtOk e he).1
rw [X_eq, X_eq]
show Xf (G'.px (σ e.1)) (G'.ox (σ e.1) e.2) (G'.px (G'.tgt (σ e.1, e.2)).1) (G'.ix (G'.tgt (σ e.1, e.2)).1 (G'.tgt (σ e.1, e.2)).2)
(G'.py (σ e.1)) (G'.py (G'.tgt (σ e.1, e.2)).1) y = _
rw [h.tgt e he]
show Xf (G'.px (σ e.1)) (G'.ox (σ e.1) e.2) (G'.px (σ (G.tgt e).1)) (G'.ix (σ (G.tgt e).1) (G.tgt e).2)
(G'.py (σ e.1)) (G'.py (σ (G.tgt e).1)) y = _
rw [h.px _ he.1, h.ox _ _ he.1 he.2, h.px _ hi, h.ix _ _ hi (hv.tgtOk e he).2.1, h.py _ he.1, h.py _ hi]
theorem open_rn {e : Nat × Nat} (he : Seg G e) (y : F.K) : Open G' (sg σ e) y ↔ Open G e y := by
unfold Open
have e2 := h.py (hiN G e) (hv.tgtOk e he).1
rw [hi_rn h he, show (sg σ e).1 = σ e.1 from rfl, h.py _ he.1, e2]
omit hv in
theorem xr_rn {n : Nat} (hn : n < G.nn) : xr G' (σ n) = xr G n := by unfold xr; rw [h.px n hn, h.wd n hn]
omit hv in
theorem lab_rn {e : Nat × Nat} (he : Seg G e) : lab G' (sg σ e) = lab G e := by
unfold lab sg; rw [h.kind _ he.1]
theorem valid_rn : Valid G' where
tgtOk e he := by
have b := seg_back h he
have hs := b.1
rw [← b.2]
have t := hv.tgtOk _ hs
rw [show sg σ (τ e.1, e.2) = (σ (τ e.1, e.2).1, (τ e.1, e.2).2) from rfl, h.tgt _ hs]
refine ⟨by rw [h.nn]; exact (h.st _ t.1).1, ?_, ?_, ?_⟩
· show _ < nIn (G'.kind (σ _)); rw [h.kind _ t.1]; exact t.2.1
· show inLab (G'.kind (σ _)) _ = lab G' (sg σ (τ e.1, e.2)); rw [h.kind _ t.1, lab_rn h hs]; exact t.2.2.1
· show G'.src (σ (G.tgt (τ e.1, e.2)).1, (G.tgt (τ e.1, e.2)).2) = sg σ (τ e.1, e.2)
rw [h.src _ _ t.1 t.2.1, t.2.2.2]; rfl
srcOk m q hm hq := by
have b := node_back h hm
rw [← b.2] at hq ⊢
rw [h.kind _ b.1] at hq
have s := hv.srcOk _ q b.1 hq
rw [h.src _ _ b.1 hq]
refine ⟨seg_rn h s.1, ?_⟩
show G'.tgt (sg σ (G.src (τ m, q))) = _
unfold sg; rw [h.tgt _ s.1, s.2]
prog e he := by
have b := seg_back h he
rw [← b.2, hi_rn h b.1]
have e2 := h.py (hiN G _) (hv.tgtOk _ b.1).1
show F.lt (G'.py (σ (τ e.1))) _
rw [h.py _ b.1.1, e2]; exact hv.prog _ b.1
segs e e' he he' hne y ho ho' := by
have b := seg_back h he
have b' := seg_back h he'
rw [← b.2] at ho; rw [← b'.2] at ho'; rw [← b.2, ← b'.2]
rw [X_rn h hv b.1, X_rn h hv b'.1]
exact hv.segs _ _ b.1 b'.1 (fun e2 => hne (by rw [← b.2, ← b'.2, e2])) y
((open_rn h hv b.1 y).1 ho) ((open_rn h hv b'.1 y).1 ho')
nodes e k he hk ho := by
have b := seg_back h he
have bk := node_back h hk
rw [← b.2, ← bk.2] at ho ⊢
rw [X_rn h hv b.1, h.py _ bk.1, h.px _ bk.1, xr_rn h bk.1]
rw [h.py _ bk.1] at ho
exact hv.nodes _ _ b.1 bk.1 ((open_rn h hv b.1 _).1 ho)
outOrd n p p' y hn hpp hp' ho ho' := by
have bn := node_back h hn
rw [← bn.2] at ho ho' hp' ⊢
rw [h.kind _ bn.1] at hp'
have s1 : Seg G (τ n, p) := ⟨bn.1, Nat.lt_trans hpp hp'⟩
have s2 : Seg G (τ n, p') := ⟨bn.1, hp'⟩
have e1 := X_rn h hv s1 y
have e2 := X_rn h hv s2 y
unfold sg at e1 e2
rw [e1, e2]
have o1 := (open_rn h hv s1 y).1 ho
have o2 := (open_rn h hv s2 y).1 ho'
exact hv.outOrd _ p p' y bn.1 hpp hp' o1 o2
inOrd m q q' y hm hqq hq' ho ho' := by
have bm := node_back h hm
rw [← bm.2] at ho ho' hq' ⊢
rw [h.kind _ bm.1] at hq'
have hq : q < nIn (G.kind (τ m)) := Nat.lt_trans hqq hq'
rw [h.src _ _ bm.1 hq] at ho ⊢
rw [h.src _ _ bm.1 hq'] at ho' ⊢
have s1 := (hv.srcOk _ q bm.1 hq).1
have s2 := (hv.srcOk _ q' bm.1 hq').1
have e1 := X_rn h hv s1 y
have e2 := X_rn h hv s2 y
unfold sg at e1 e2
rw [e1, e2]
exact hv.inOrd _ q q' y bm.1 hqq hq' ((open_rn h hv s1 y).1 ho) ((open_rn h hv s2 y).1 ho')
pts k k' hk hk' hne he := by
have b := node_back h hk
have b' := node_back h hk'
rw [← b.2, ← b'.2] at he ⊢
rw [h.py _ b.1, h.py _ b'.1] at he
rw [xr_rn h b.1, xr_rn h b'.1, h.px _ b.1, h.px _ b'.1]
exact hv.pts _ _ b.1 b'.1 (fun e => hne (by rw [← b.2, ← b'.2, e])) he
wd0 k hk := by
have b := node_back h hk
rw [← b.2, h.wd _ b.1]; exact hv.wd0 _ b.1
oxIn n p hn hp := by
have b := node_back h hn
rw [← b.2] at hp ⊢
rw [h.kind _ b.1] at hp
rw [h.ox _ _ b.1 hp, h.wd _ b.1]; exact hv.oxIn _ _ b.1 hp
ixIn m q hm hq := by
have b := node_back h hm
rw [← b.2] at hq ⊢
rw [h.kind _ b.1] at hq
rw [h.ix _ _ b.1 hq, h.wd _ b.1]; exact hv.ixIn _ _ b.1 hq
omit hv in
theorem generic_rn (hg : Generic G) : Generic G' := fun j k hj hk hb hne => by
have b := node_back h hj
have b' := node_back h hk
rw [← b.2] at hb; rw [← b.2, ← b'.2]
rw [h.kind _ b.1] at hb
rw [h.py _ b.1, h.py _ b'.1]
exact hg _ _ b.1 b'.1 hb (fun e => hne (by rw [← b.2, ← b'.2, e]))
theorem lft_rn {j : Nat} (hj : j < G.nn) (e : Nat × Nat) (he : Seg G e) : Lft G' (σ j) (sg σ e) ↔ Lft G j e := by
unfold Lft
rw [h.py _ hj, h.px _ hj, X_rn h hv he]
exact ⟨fun ⟨_, o, l⟩ => ⟨he, (open_rn h hv he _).1 o, l⟩, fun ⟨_, o, l⟩ => ⟨seg_rn h he, (open_rn h hv he _).2 o, l⟩⟩
theorem rgt_rn {j : Nat} (hj : j < G.nn) (e : Nat × Nat) (he : Seg G e) : Rgt G' (σ j) (sg σ e) ↔ Rgt G j e := by
unfold Rgt
rw [h.py _ hj, xr_rn h hj, X_rn h hv he]
exact ⟨fun ⟨_, o, l⟩ => ⟨he, (open_rn h hv he _).1 o, l⟩, fun ⟨_, o, l⟩ => ⟨seg_rn h he, (open_rn h hv he _).2 o, l⟩⟩
omit hv in
theorem sg_inj {e e' : Nat × Nat} (he : Seg G e) (he' : Seg G e') (q : sg σ e = sg σ e') : e = e' := by
have a0 := congrArg Prod.fst q
have b0 := congrArg Prod.snd q
have a : σ e.1 = σ e'.1 := a0
have b : e.2 = e'.2 := b0
have c : e.1 = e'.1 := by rw [← (h.st _ he.1).2, a, (h.st _ he'.1).2]
revert c b
cases e with
| mk a1 b1 => cases e' with
| mk a2 b2 =>
intro b c
have c' : a1 = a2 := c
have b' : b1 = b2 := b
rw [c', b']
omit hv in
theorem enum_side {P : Nat × Nat → Prop} {P' : Nat × Nat → Prop} (hP : ∀ e, P e → Seg G e)
(hP' : ∀ e, P' e → Seg G' e) (hiff : ∀ e, Seg G e → (P' (sg σ e) ↔ P e)) {l : List (Nat × Nat)} (hl : Enum P l) :
Enum P' (l.map (sg σ)) :=
⟨nd_map_inj _ l (fun x y mx my q => sg_inj h (hP x ((hl.2 x).1 mx)) (hP y ((hl.2 y).1 my)) q) hl.1,
fun x => ⟨fun m => match (mem_mapG _ l).1 m with
| ⟨y, hy, e⟩ => by rw [← e]; exact (hiff y (hP y ((hl.2 y).1 hy))).2 ((hl.2 y).1 hy),
fun hx => by
have b := seg_back h (hP' x hx)
rw [← b.2] at hx ⊢
exact (mem_mapG _ l).2 ⟨_, (hl.2 _).2 ((hiff _ b.1).1 hx), rfl⟩⟩⟩
theorem layer_rn {j : Nat} (hj : j < G.nn) {ly : Ly S} (hl : LayerOf G j ly) : LayerOf G' (σ j) ly :=
match hl with
| ⟨g, Ls, Rs, hk, eL, iL, eR, iR, e⟩ =>
have sL : ∀ x, x ∈ Ls → Seg G x := fun x m => ((eL.2 x).1 m).1
have sR : ∀ x, x ∈ Rs → Seg G x := fun x m => ((eR.2 x).1 m).1
⟨g, Ls.map (sg σ), Rs.map (sg σ), by rw [h.kind _ hj]; exact hk,
enum_side h (fun e he => he.1) (fun e he => he.1) (fun e he => lft_rn h hv hj e he) eL,
incr_map _ _ Ls (incr_eqk Ls (fun x m => by
show X G x (G.py j) = X G' (sg σ x) (G'.py (σ j)); rw [h.py _ hj, X_rn h hv (sL x m)]) iL),
enum_side h (fun e he => he.1) (fun e he => he.1) (fun e he => rgt_rn h hv hj e he) eR,
incr_map _ _ Rs (incr_eqk Rs (fun x m => by
show X G x (G.py j) = X G' (sg σ x) (G'.py (σ j)); rw [h.py _ hj, X_rn h hv (sR x m)]) iR),
by
rw [e]
unfold labs
rw [map_map', map_map', map_congr' Ls (fun x m => (lab_rn h (sL x m)).symm),
map_congr' Rs (fun x m => (lab_rn h (sR x m)).symm)]⟩
/-- renumbering keeps the reading -/
theorem reads_rn {D : List (Ly S)} (hr : Reads G D) : Reads G' D :=
match hr with
| ⟨bl, he, hi, hf⟩ =>
have hbl : ∀ j, j ∈ bl → j < G.nn ∧ IsBox (G.kind j) := fun j m => (he.2 j).1 m
⟨bl.map σ,
⟨nd_map_inj σ bl (fun x y mx my q => by
rw [← (h.st x (hbl x mx).1).2, q, (h.st y (hbl y my).1).2]) he.1,
fun j => ⟨fun m => match (mem_mapG σ bl).1 m with
| ⟨x, hx, e⟩ => by
rw [← e]
show σ x < G'.nn ∧ IsBox (G'.kind (σ x))
rw [h.nn, h.kind _ (hbl x hx).1]; exact ⟨(h.st x (hbl x hx).1).1, (hbl x hx).2⟩,
fun ⟨hj, hb⟩ => by
have b := node_back h hj
rw [← b.2] at hb ⊢
rw [h.kind _ b.1] at hb
exact (mem_mapG σ bl).2 ⟨_, (he.2 _).2 ⟨b.1, hb⟩, rfl⟩⟩⟩,
incr_map _ _ bl (incr_eqk bl (fun x m => (h.py x (hbl x m).1).symm) hi),
fa2_map σ (fun x y m r => layer_rn h hv (hbl x m).1 r) hf⟩
end R
end TP
end Found
#print axioms Found.TP.nd_map_inj
#print axioms Found.TP.valid_rn
#print axioms Found.TP.generic_rn
#print axioms Found.TP.reads_rn
lean_all/found/Top17.lean
/-
T193 (topological), part 17. found/Top17 — the wires of a layer list,
level by level: the object at level k (lev), the wire at position p of
level k as the output port that starts it (bw, traced backwards), the
input port where the wire at position p of level k ends (fw, traced
forwards); bw is one-to-one at each level, the end of bw k p is fw k p,
and the start of fw k p is bw k p.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top16
namespace Found
namespace TP
open DetChain LibRing SD
variable {S : Sig}
/-! ## arithmetic without the propext-carrying library lemmas -/
theorem asub : (a r : Nat) → (a + r) - a = r
| 0, r => Nat.zero_add r
| a + 1, r => by rw [Nat.succ_add, Nat.succ_sub_succ]; exact asub a r
theorem subD : (x p : Nat) → x ≤ p → x + (p - x) = p
| 0, p, _ => Nat.zero_add p
| x + 1, 0, h => absurd h (Nat.not_succ_le_zero x)
| x + 1, p + 1, h => by
rw [Nat.succ_sub_succ, Nat.succ_add]
exact congrArg Nat.succ (subD x p (Nat.le_of_succ_le_succ h))
theorem lenA {α : Type} : (a b : List α) → (a ++ b).length = a.length + b.length
| [], b => (Nat.zero_add _).symm
| _ :: a, b => by
show (a ++ b).length + 1 = a.length + 1 + b.length
rw [lenA a b, Nat.add_right_comm]
theorem getD_l : (a b : List Nat) → (p : Nat) → p < a.length → getD (a ++ b) p = getD a p
| [], _, _, h => absurd h (Nat.not_lt_zero _)
| _ :: _, _, 0, _ => rfl
| _ :: a, b, p + 1, h => getD_l a b p (Nat.lt_of_succ_lt_succ h)
theorem getD_r : (a b : List Nat) → (q : Nat) → getD (a ++ b) (a.length + q) = getD b q
| [], b, q => by show getD b (0 + q) = _; rw [Nat.zero_add]
| c :: a, b, q => by
show getD (c :: (a ++ b)) (a.length + 1 + q) = _
rw [Nat.add_right_comm]; exact getD_r a b q
/-! ## layers -/
def lget : List (Ly S) → Nat → Option (Ly S)
| [], _ => none
| l :: _, 0 => some l
| _ :: D, k + 1 => lget D k
def ldropN : Nat → List (Ly S) → List (Ly S)
| 0, D => D
| _ + 1, [] => []
| k + 1, _ :: D => ldropN k D
def ldrop (D : List (Ly S)) (k : Nat) : List (Ly S) := ldropN k D
theorem lget_nil {k : Nat} {l : Ly S} (h : lget ([] : List (Ly S)) k = some l) : False := by
cases k <;> cases h
theorem lget_lt : (D : List (Ly S)) → (k : Nat) → k < D.length → ∃ l, lget D k = some l
| [], _, h => absurd h (Nat.not_lt_zero _)
| l :: _, 0, _ => ⟨l, rfl⟩
| _ :: D, k + 1, h => lget_lt D k (Nat.lt_of_succ_lt_succ h)
theorem lget_ge : (D : List (Ly S)) → (k : Nat) → D.length ≤ k → lget D k = none
| [], _, _ => by unfold lget; rfl
| _ :: _, 0, h => absurd h (Nat.not_succ_le_zero _)
| _ :: D, k + 1, h => lget_ge D k (Nat.le_of_succ_le_succ h)
theorem lget_some_lt : (D : List (Ly S)) → (k : Nat) → {l : Ly S} → lget D k = some l → k < D.length
| [], _, _, h => (lget_nil h).elim
| _ :: _, 0, _, _ => Nat.zero_lt_succ _
| _ :: D, k + 1, _, h => Nat.succ_lt_succ (lget_some_lt D k h)
theorem ldrop_some : (D : List (Ly S)) → (k : Nat) → {l : Ly S} → lget D k = some l → ldrop D k = l :: ldrop D (k + 1)
| [], _, _, h => (lget_nil h).elim
| _ :: _, 0, _, h => by cases h; rfl
| _ :: D, k + 1, _, h => ldrop_some D k h
theorem ldrop_len : (D : List (Ly S)) → ldrop D D.length = []
| [] => rfl
| _ :: D => ldrop_len D
/-- the object at level k -/
def lev (A : Ob) (D : List (Ly S)) : Nat → Ob
| 0 => A
| k + 1 => match lget D k with
| some l => l.L ++ S.cod l.g ++ l.R
| none => lev A D k
theorem lev_cons (A : Ob) (l : Ly S) (D : List (Ly S)) : (k : Nat) →
lev A (l :: D) (k + 1) = lev (l.L ++ S.cod l.g ++ l.R) D k
| 0 => rfl
| k + 1 => by
show (match lget D k with
| some l' => l'.L ++ S.cod l'.g ++ l'.R
| none => lev A (l :: D) (k + 1)) = (match lget D k with
| some l' => l'.L ++ S.cod l'.g ++ l'.R
| none => lev (l.L ++ S.cod l.g ++ l.R) D k)
rw [lev_cons A l D k]
/-- the level before a layer is its input -/
theorem lev_in : {D : List (Ly S)} → {A B : Ob} → DTy D A B → (k : Nat) → {l : Ly S} → lget D k = some l →
lev A D k = l.L ++ S.dom l.g ++ l.R
| _, _, _, .nil _, _, _, h => (lget_nil h).elim
| _, _, _, .cons e _, 0, _, h => by cases h; exact e
| _, _, _, .cons _ hD, k + 1, _, h => by rw [lev_cons]; exact lev_in hD k h
theorem lev_end : {D : List (Ly S)} → {A B : Ob} → DTy D A B → lev A D D.length = B
| _, _, _, .nil _ => rfl
| _, _, _, .cons _ hD => by
show lev _ _ (_ + 1) = _
rw [lev_cons]; exact lev_end hD
theorem lev_out (A : Ob) (D : List (Ly S)) (k : Nat) {l : Ly S} (h : lget D k = some l) :
lev A D (k + 1) = l.L ++ S.cod l.g ++ l.R := by
show (match lget D k with
| some l => l.L ++ S.cod l.g ++ l.R
| none => lev A D k) = _
rw [h]
/-! ## the wire at a position, traced backwards to the port that starts it -/
def bwStep (A : Ob) (k : Nat) (l : Ly S) (prev : Nat → Nat × Nat) (p : Nat) : Nat × Nat :=
match Nat.decLt p l.L.length with
| isTrue _ => prev p
| isFalse _ => match Nat.decLt p (l.L.length + (S.cod l.g).length) with
| isTrue _ => (A.length + k, p - l.L.length)
| isFalse _ => prev (p - (l.L.length + (S.cod l.g).length) + (l.L.length + (S.dom l.g).length))
def bw (A : Ob) (D : List (Ly S)) : Nat → Nat → Nat × Nat
| 0, p => (p, 0)
| k + 1, p => match lget D k with
| none => bw A D k p
| some l => bwStep A k l (bw A D k) p
section B
variable (A : Ob) (D : List (Ly S)) {k : Nat} {l : Ly S} (hl : lget D k = some l)
include hl
theorem bw_some (p : Nat) : bw A D (k + 1) p = bwStep A k l (bw A D k) p := by
show (match lget D k with
| none => bw A D k p
| some l => bwStep A k l (bw A D k) p) = _
rw [hl]
theorem bw_L {p : Nat} (hp : p < l.L.length) : bw A D (k + 1) p = bw A D k p := by
rw [bw_some A D hl]
unfold bwStep
match Nat.decLt p l.L.length with
| isTrue _ => rfl
| isFalse h => exact absurd hp h
theorem bw_O {q : Nat} (hq : q < (S.cod l.g).length) : bw A D (k + 1) (l.L.length + q) = (A.length + k, q) := by
rw [bw_some A D hl]
unfold bwStep
match Nat.decLt (l.L.length + q) l.L.length with
| isTrue h => exact absurd h (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ =>
match Nat.decLt (l.L.length + q) (l.L.length + (S.cod l.g).length) with
| isTrue _ => show (A.length + k, (l.L.length + q) - l.L.length) = _; rw [asub]
| isFalse h => exact absurd (Nat.add_lt_add_left hq _) h
theorem bw_R (r : Nat) : bw A D (k + 1) (l.L.length + (S.cod l.g).length + r) =
bw A D k (l.L.length + (S.dom l.g).length + r) := by
have h1 : ¬ l.L.length + (S.cod l.g).length + r < l.L.length :=
Nat.not_lt_of_le (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))
have h2 : ¬ l.L.length + (S.cod l.g).length + r < l.L.length + (S.cod l.g).length :=
Nat.not_lt_of_le (Nat.le_add_right _ _)
rw [bw_some A D hl]
unfold bwStep
match Nat.decLt (l.L.length + (S.cod l.g).length + r) l.L.length with
| isTrue h => exact absurd h h1
| isFalse _ =>
match Nat.decLt (l.L.length + (S.cod l.g).length + r) (l.L.length + (S.cod l.g).length) with
| isTrue h => exact absurd h h2
| isFalse _ =>
show bw A D k (l.L.length + (S.cod l.g).length + r - (l.L.length + (S.cod l.g).length) +
(l.L.length + (S.dom l.g).length)) = _
rw [asub, Nat.add_comm r]
end B
/-! ## the port where a wire ends, traced forwards -/
def fwS (nA N : Nat) : List (Ly S) → Nat → Nat → Nat × Nat
| [], _, p => (nA + N + p, 0)
| l :: Ds, k, p => match Nat.decLt p l.L.length with
| isTrue _ => fwS nA N Ds (k + 1) p
| isFalse _ => match Nat.decLt p (l.L.length + (S.dom l.g).length) with
| isTrue _ => (nA + k, p - l.L.length)
| isFalse _ => fwS nA N Ds (k + 1) (p - (l.L.length + (S.dom l.g).length) + (l.L.length + (S.cod l.g).length))
def fw (A : Ob) (D : List (Ly S)) (k p : Nat) : Nat × Nat := fwS A.length D.length (ldrop D k) k p
theorem fw_end (A : Ob) (D : List (Ly S)) (p : Nat) : fw A D D.length p = (A.length + D.length + p, 0) := by
unfold fw ldrop; rw [show ldropN D.length D = [] from ldrop_len D]; rfl
section W
variable (A : Ob) (D : List (Ly S)) {k : Nat} {l : Ly S} (hl : lget D k = some l)
include hl
theorem fw_some (p : Nat) : fw A D k p = (match Nat.decLt p l.L.length with
| isTrue _ => fw A D (k + 1) p
| isFalse _ => match Nat.decLt p (l.L.length + (S.dom l.g).length) with
| isTrue _ => (A.length + k, p - l.L.length)
| isFalse _ => fw A D (k + 1) (p - (l.L.length + (S.dom l.g).length) + (l.L.length + (S.cod l.g).length))) := by
unfold fw
rw [show ldrop D k = l :: ldrop D (k + 1) from ldrop_some D k hl]
rfl
theorem fw_L {p : Nat} (hp : p < l.L.length) : fw A D k p = fw A D (k + 1) p := by
rw [fw_some A D hl]
match Nat.decLt p l.L.length with
| isTrue _ => rfl
| isFalse h => exact absurd hp h
theorem fw_D {q : Nat} (hq : q < (S.dom l.g).length) : fw A D k (l.L.length + q) = (A.length + k, q) := by
rw [fw_some A D hl]
match Nat.decLt (l.L.length + q) l.L.length with
| isTrue h => exact absurd h (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ =>
match Nat.decLt (l.L.length + q) (l.L.length + (S.dom l.g).length) with
| isTrue _ => show (A.length + k, (l.L.length + q) - l.L.length) = _; rw [asub]
| isFalse h => exact absurd (Nat.add_lt_add_left hq _) h
theorem fw_R (r : Nat) : fw A D k (l.L.length + (S.dom l.g).length + r) =
fw A D (k + 1) (l.L.length + (S.cod l.g).length + r) := by
have h1 : ¬ l.L.length + (S.dom l.g).length + r < l.L.length :=
Nat.not_lt_of_le (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))
have h2 : ¬ l.L.length + (S.dom l.g).length + r < l.L.length + (S.dom l.g).length :=
Nat.not_lt_of_le (Nat.le_add_right _ _)
rw [fw_some A D hl]
match Nat.decLt (l.L.length + (S.dom l.g).length + r) l.L.length with
| isTrue h => exact absurd h h1
| isFalse _ =>
match Nat.decLt (l.L.length + (S.dom l.g).length + r) (l.L.length + (S.dom l.g).length) with
| isTrue h => exact absurd h h2
| isFalse _ =>
show fw A D (k + 1) (l.L.length + (S.dom l.g).length + r - (l.L.length + (S.dom l.g).length) +
(l.L.length + (S.cod l.g).length)) = _
rw [asub, Nat.add_comm r]
end W
/-! ## node kinds -/
def ckind (A : Ob) (D : List (Ly S)) (n : Nat) : NK S :=
match Nat.decLt n A.length with
| isTrue _ => .src (getD A n)
| isFalse _ => match lget D (n - A.length) with
| some l => .box l.g
| none => .snk (getD (lev A D D.length) (n - A.length - D.length))
theorem ckind_src (A : Ob) (D : List (Ly S)) {n : Nat} (h : n < A.length) : ckind A D n = .src (getD A n) := by
unfold ckind
match Nat.decLt n A.length with
| isTrue _ => rfl
| isFalse h' => exact absurd h h'
theorem ckind_box (A : Ob) (D : List (Ly S)) {j : Nat} {l : Ly S} (h : lget D j = some l) :
ckind A D (A.length + j) = .box l.g := by
unfold ckind
match Nat.decLt (A.length + j) A.length with
| isTrue h' => exact absurd h' (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ => show (match lget D (A.length + j - A.length) with
| some l => NK.box l.g
| none => _) = _
rw [asub, h]
theorem ckind_snk (A : Ob) (D : List (Ly S)) (s : Nat) :
ckind A D (A.length + D.length + s) = .snk (getD (lev A D D.length) s) := by
unfold ckind
match Nat.decLt (A.length + D.length + s) A.length with
| isTrue h' => exact absurd h' (Nat.not_lt_of_le (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)))
| isFalse _ =>
show (match lget D (A.length + D.length + s - A.length) with
| some l => NK.box l.g
| none => .snk (getD (lev A D D.length) (A.length + D.length + s - A.length - D.length))) = _
rw [Nat.add_assoc, asub, lget_ge D _ (Nat.le_add_right _ _), asub]
end TP
end Found
#print axioms Found.TP.subD
#print axioms Found.TP.lev_in
#print axioms Found.TP.bw_L
#print axioms Found.TP.bw_O
#print axioms Found.TP.bw_R
#print axioms Found.TP.fw_L
#print axioms Found.TP.fw_D
#print axioms Found.TP.fw_R
#print axioms Found.TP.ckind_snk
lean_all/found/Top18.lean
/-
T193 (topological), part 18. found/Top18 — facts about the wires of a
typed layer list, level by level:
* the wire at a position of level k is an output port, started before
level k; positions at one level are different wires; labels match;
* the wire at a position of level k ends at the input port fw k p (a box
at a later level, or an output point), whose incoming wire is again the
wire at that position;
* a wire is present at every level between its start and its end.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top17
namespace Found
namespace TP
open DetChain LibRing SD
variable {S : Sig}
theorem split3 (p a d : Nat) : p < a ∨ (∃ q, q < d ∧ p = a + q) ∨ (∃ r, p = a + d + r) :=
match Nat.lt_or_ge p a with
| .inl h => .inl h
| .inr h => match Nat.lt_or_ge p (a + d) with
| .inl h2 => .inr (.inl ⟨p - a, Nat.lt_of_add_lt_add_left (by rw [subD a p h]; exact h2), (subD a p h).symm⟩)
| .inr h2 => .inr (.inr ⟨p - (a + d), (subD _ p h2).symm⟩)
theorem lt3 {p a d r : Nat} (h : p < a) : p < a + d + r :=
Nat.lt_of_lt_of_le h (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))
theorem nlt3 {a d r : Nat} : ¬ a + d + r < a :=
Nat.not_lt_of_le (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))
theorem addLC2 : (a : Nat) → {b c : Nat} → a + b = a + c → b = c
| 0, _, _, h => by rw [Nat.zero_add, Nat.zero_add] at h; exact h
| a + 1, _, _, h => addLC2 a (Nat.succ.inj (by rw [← Nat.succ_add, ← Nat.succ_add]; exact h))
/-- output ports of the column drawing of A, D -/
def OP (A : Ob) (D : List (Ly S)) (e : Nat × Nat) : Prop :=
(e.1 < A.length ∧ e.2 = 0) ∨ ∃ j l, lget D j = some l ∧ e.1 = A.length + j ∧ e.2 < (S.cod l.g).length
section L
variable {A B : Ob} {D : List (Ly S)} (hD : DTy D A B)
include hD
theorem len_in {k : Nat} {l : Ly S} (hl : lget D k = some l) :
(lev A D k).length = l.L.length + (S.dom l.g).length + l.R.length := by
rw [lev_in hD k hl, lenA, lenA]
omit hD in
theorem len_out {k : Nat} {l : Ly S} (hl : lget D k = some l) :
(lev A D (k + 1)).length = l.L.length + (S.cod l.g).length + l.R.length := by
rw [lev_out A D k hl, lenA, lenA]
omit hD in
theorem lt_R {a d r R : Nat} (h : a + d + r < a + d + R) : r < R := Nat.lt_of_add_lt_add_left h
theorem bw_op : (k : Nat) → k ≤ D.length → (p : Nat) → p < (lev A D k).length →
OP A D (bw A D k p) ∧ (bw A D k p).1 < A.length + k
| 0, _, p, hp => ⟨.inl ⟨hp, rfl⟩, hp⟩
| k + 1, hk, p, hp =>
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [len_out hl] at hp
match split3 p l.L.length (S.cod l.g).length with
| .inl h =>
rw [bw_L A D hl h]
have ih := bw_op k (Nat.le_of_lt hk) p (by rw [len_in hD hl]; exact lt3 h)
exact ⟨ih.1, Nat.lt_succ_of_lt ih.2⟩
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e, bw_O A D hl hq]
exact ⟨.inr ⟨k, l, hl, rfl, hq⟩, Nat.lt_succ_self _⟩
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
rw [bw_R A D hl r]
have ih := bw_op k (Nat.le_of_lt hk) _ (by rw [len_in hD hl]; exact Nat.add_lt_add_left (lt_R hp) _)
exact ⟨ih.1, Nat.lt_succ_of_lt ih.2⟩
theorem ne_L_O {k : Nat} {p q : Nat} (hk : k ≤ D.length) (hp : p < (lev A D k).length) :
bw A D k p ≠ (A.length + k, q) := fun e => by
have := (bw_op hD k hk p hp).2
rw [e] at this; exact Nat.lt_irrefl _ this
/-- different positions of one level carry different wires -/
theorem bw_inj : (k : Nat) → k ≤ D.length → (p p' : Nat) → p < (lev A D k).length → p' < (lev A D k).length →
bw A D k p = bw A D k p' → p = p'
| 0, _, _, _, _, _, e => congrArg Prod.fst e
| k + 1, hk, p, p', hp, hp', e =>
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [len_out hl] at hp hp'
have hlk := len_in hD hl
have bnd : ∀ x, x < l.L.length → x < (lev A D k).length := fun x h => by
rw [hlk]; exact lt3 h
have bndR : ∀ r, l.L.length + (S.cod l.g).length + r < l.L.length + (S.cod l.g).length + l.R.length →
l.L.length + (S.dom l.g).length + r < (lev A D k).length := fun r h => by
rw [hlk]; exact Nat.add_lt_add_left (lt_R h) _
have kk := Nat.le_of_lt hk
match split3 p l.L.length (S.cod l.g).length, split3 p' l.L.length (S.cod l.g).length with
| .inl h, .inl h' =>
rw [bw_L A D hl h, bw_L A D hl h'] at e
exact bw_inj k kk p p' (bnd p h) (bnd p' h') e
| .inl h, .inr (.inl ⟨q, _, e'⟩) =>
rw [bw_L A D hl h, e', bw_O A D hl ‹_›] at e
exact absurd e (ne_L_O hD kk (bnd p h))
| .inl h, .inr (.inr ⟨r, e'⟩) =>
rw [e'] at hp'
rw [bw_L A D hl h, e', bw_R A D hl r] at e
have := bw_inj k kk _ _ (bnd p h) (bndR r hp') e
exact absurd h (by rw [this]; exact nlt3)
| .inr (.inl ⟨q, _, e1⟩), .inl h' =>
rw [bw_L A D hl h', e1, bw_O A D hl ‹_›] at e
exact absurd e.symm (ne_L_O hD kk (bnd p' h'))
| .inr (.inl ⟨q, hq, e1⟩), .inr (.inl ⟨q', hq', e2⟩) =>
rw [e1, e2, bw_O A D hl hq, bw_O A D hl hq'] at e
rw [e1, e2, show q = q' from congrArg Prod.snd e]
| .inr (.inl ⟨q, hq, e1⟩), .inr (.inr ⟨r, e2⟩) =>
rw [e2] at hp'
rw [e1, e2, bw_O A D hl hq, bw_R A D hl r] at e
exact absurd e.symm (ne_L_O hD kk (bndR r hp'))
| .inr (.inr ⟨r, e1⟩), .inl h' =>
rw [e1] at hp
rw [e1, bw_L A D hl h', bw_R A D hl r] at e
have := bw_inj k kk _ _ (bndR r hp) (bnd p' h') e
exact absurd h' (by rw [← this]; exact nlt3)
| .inr (.inr ⟨r, e1⟩), .inr (.inl ⟨q, hq, e2⟩) =>
rw [e1] at hp
rw [e1, e2, bw_O A D hl hq, bw_R A D hl r] at e
exact absurd e (ne_L_O hD kk (bndR r hp))
| .inr (.inr ⟨r, e1⟩), .inr (.inr ⟨r', e2⟩) =>
rw [e1] at hp; rw [e2] at hp'
rw [e1, e2, bw_R A D hl r, bw_R A D hl r'] at e
have := bw_inj k kk _ _ (bndR r hp) (bndR r' hp') e
rw [e1, e2, addLC2 _ this]
/-- the label of the wire at a position is the letter of the level there -/
theorem bw_lab : (k : Nat) → k ≤ D.length → (p : Nat) → p < (lev A D k).length →
outLab (ckind A D (bw A D k p).1) (bw A D k p).2 = getD (lev A D k) p
| 0, _, p, hp => by
show outLab (ckind A D p) 0 = getD A p
rw [ckind_src A D hp]; rfl
| k + 1, hk, p, hp =>
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [len_out hl] at hp
rw [lev_out A D k hl]
have kk := Nat.le_of_lt hk
have hlk := len_in hD hl
match split3 p l.L.length (S.cod l.g).length with
| .inl h =>
rw [bw_L A D hl h, bw_lab k kk p (by rw [hlk]; exact lt3 h), lev_in hD k hl,
getD_l (l.L ++ S.dom l.g) l.R p (by rw [lenA]; exact Nat.lt_of_lt_of_le h (Nat.le_add_right _ _)),
getD_l (l.L ++ S.cod l.g) l.R p (by rw [lenA]; exact Nat.lt_of_lt_of_le h (Nat.le_add_right _ _)),
getD_l l.L (S.dom l.g) p h, getD_l l.L (S.cod l.g) p h]
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e, bw_O A D hl hq, ckind_box A D hl]
show getD (S.cod l.g) q = _
rw [getD_l _ _ _ (by rw [lenA]; exact Nat.add_lt_add_left hq _), getD_r]
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
rw [bw_R A D hl r, bw_lab k kk _ (by rw [hlk]; exact Nat.add_lt_add_left (lt_R hp) _), lev_in hD k hl]
rw [show l.L.length + (S.dom l.g).length = (l.L ++ S.dom l.g).length from (lenA _ _).symm,
show l.L.length + (S.cod l.g).length = (l.L ++ S.cod l.g).length from (lenA _ _).symm, getD_r, getD_r]
end L
end TP
end Found
#print axioms Found.TP.split3
#print axioms Found.TP.bw_op
#print axioms Found.TP.bw_inj
#print axioms Found.TP.bw_lab
lean_all/found/Top19.lean
/-
T193 (topological), part 19. found/Top19 — where the wires of a typed
layer list end:
* fw k p is an input of a box at level ≥ k, or an output point, and the
wire coming into it is the wire at position p of level k;
* the end of the port starting a wire (tgtW) is fw at any level where
the wire is present;
* every output port starts the wire at a definite position of its birth
level, and a wire stays present, level by level, until its end.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top18
namespace Found
namespace TP
open DetChain LibRing SD
variable {S : Sig}
/-- the end of the wire started by the output port e -/
def tgtW (A : Ob) (D : List (Ly S)) (e : Nat × Nat) : Nat × Nat :=
match Nat.decLt e.1 A.length with
| isTrue _ => fw A D 0 e.1
| isFalse _ => match lget D (e.1 - A.length) with
| some l => fw A D (e.1 - A.length + 1) (l.L.length + e.2)
| none => (0, 0)
theorem tgtW_src (A : Ob) (D : List (Ly S)) {n p : Nat} (h : n < A.length) : tgtW A D (n, p) = fw A D 0 n := by
unfold tgtW
match Nat.decLt n A.length with
| isTrue _ => rfl
| isFalse h' => exact absurd h h'
theorem tgtW_box (A : Ob) (D : List (Ly S)) {j : Nat} {l : Ly S} (hl : lget D j = some l) (q : Nat) :
tgtW A D (A.length + j, q) = fw A D (j + 1) (l.L.length + q) := by
unfold tgtW
match Nat.decLt (A.length + j) A.length with
| isTrue h => exact absurd h (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ =>
show (match lget D (A.length + j - A.length) with
| some l => fw A D (A.length + j - A.length + 1) (l.L.length + q)
| none => (0, 0)) = _
rw [asub, hl]
section F
variable {A B : Ob} {D : List (Ly S)} (hD : DTy D A B)
include hD
/-- where the wire at a position ends -/
def FWres (A : Ob) (D : List (Ly S)) (k p : Nat) : Prop :=
(∃ j l q, lget D j = some l ∧ k ≤ j ∧ q < (S.dom l.g).length ∧ fw A D k p = (A.length + j, q) ∧
bw A D j (l.L.length + q) = bw A D k p) ∨
(∃ s, s < (lev A D D.length).length ∧ fw A D k p = (A.length + D.length + s, 0) ∧ bw A D D.length s = bw A D k p)
theorem fw_res : (m k : Nat) → k + m = D.length → (p : Nat) → p < (lev A D k).length → FWres A D k p
| 0, k, hk, p, hp => by
rw [Nat.add_zero] at hk
subst hk
exact .inr ⟨p, hp, fw_end A D p, rfl⟩
| m + 1, k, hk, p, hp =>
have hkN : k < D.length := by rw [← hk]; exact Nat.lt_add_of_pos_right (Nat.succ_pos m)
have hk1 : k + 1 + m = D.length := by rw [Nat.add_right_comm]; exact hk
match lget_lt D k hkN with
| ⟨l, hl⟩ => by
rw [len_in hD hl] at hp
match split3 p l.L.length (S.dom l.g).length with
| .inl h =>
have ih := fw_res m (k + 1) hk1 p (by rw [len_out hl]; exact lt3 h)
unfold FWres at ih ⊢
rw [fw_L A D hl h]
rw [bw_L A D hl h] at ih
exact ih.elim (fun ⟨j, l', q, a, b, c, d, e⟩ => .inl ⟨j, l', q, a, Nat.le_of_succ_le b, c, d, e⟩) .inr
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e]
unfold FWres
exact .inl ⟨k, l, q, hl, Nat.le_refl k, hq, fw_D A D hl hq, rfl⟩
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
have ih := fw_res m (k + 1) hk1 _ (by rw [len_out hl]; exact Nat.add_lt_add_left (lt_R hp) _)
unfold FWres at ih ⊢
rw [fw_R A D hl r]
rw [bw_R A D hl r] at ih
exact ih.elim (fun ⟨j, l', q, a, b, c, d, e⟩ => .inl ⟨j, l', q, a, Nat.le_of_succ_le b, c, d, e⟩) .inr
theorem fw_res' {k : Nat} (hk : k ≤ D.length) {p : Nat} (hp : p < (lev A D k).length) : FWres A D k p :=
fw_res hD (D.length - k) k (subD k _ hk) p hp
/-- the end of a wire is fw at any level where it is present -/
theorem tgtW_bw : (k : Nat) → k ≤ D.length → (p : Nat) → p < (lev A D k).length → tgtW A D (bw A D k p) = fw A D k p
| 0, _, p, hp => tgtW_src A D hp
| k + 1, hk, p, hp =>
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [len_out hl] at hp
have kk := Nat.le_of_lt hk
match split3 p l.L.length (S.cod l.g).length with
| .inl h =>
rw [bw_L A D hl h, tgtW_bw k kk p (by rw [len_in hD hl]; exact lt3 h), fw_L A D hl h]
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e, bw_O A D hl hq, tgtW_box A D hl]
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
rw [bw_R A D hl r, tgtW_bw k kk _ (by rw [len_in hD hl]; exact Nat.add_lt_add_left (lt_R hp) _), fw_R A D hl r]
omit hD in
/-- every output port starts the wire at its position of its birth level -/
theorem birth {e : Nat × Nat} (he : OP A D e) :
(e.1 < A.length ∧ e.2 = 0 ∧ bw A D 0 e.1 = e ∧ e.1 < (lev A D 0).length) ∨
(∃ j l, lget D j = some l ∧ e.1 = A.length + j ∧ e.2 < (S.cod l.g).length ∧
bw A D (j + 1) (l.L.length + e.2) = e ∧ l.L.length + e.2 < (lev A D (j + 1)).length) :=
match e, he with
| (n, p), .inl ⟨h, h2⟩ =>
have h2' : p = 0 := h2
.inl ⟨h, h2, by show (n, 0) = (n, p); rw [h2'], h⟩
| (n, p), .inr ⟨j, l, hl, e1, hq⟩ =>
have e1' : n = A.length + j := e1
.inr ⟨j, l, hl, e1, hq, by
show bw A D (j + 1) (l.L.length + p) = (n, p); rw [bw_O A D hl hq, e1'],
by rw [len_out hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _)⟩
/-- a wire not ending at level k is still present at level k + 1 -/
theorem stay {k : Nat} (hk : k < D.length) {p : Nat} (hp : p < (lev A D k).length)
(hne : ∀ q, fw A D k p ≠ (A.length + k, q)) :
∃ p', p' < (lev A D (k + 1)).length ∧ bw A D (k + 1) p' = bw A D k p ∧ fw A D (k + 1) p' = fw A D k p :=
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [len_in hD hl] at hp
match split3 p l.L.length (S.dom l.g).length with
| .inl h => exact ⟨p, by rw [len_out hl]; exact lt3 h, bw_L A D hl h, (fw_L A D hl h).symm⟩
| .inr (.inl ⟨q, hq, e⟩) => rw [e] at hne; exact absurd (fw_D A D hl hq) (hne q)
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
exact ⟨_, by rw [len_out hl]; exact Nat.add_lt_add_left (lt_R hp) _, bw_R A D hl r, (fw_R A D hl r).symm⟩
theorem stays : (m k : Nat) → k + m ≤ D.length → (p : Nat) → p < (lev A D k).length →
(∀ i q, k ≤ i → i < k + m → fw A D k p ≠ (A.length + i, q)) →
∃ p', p' < (lev A D (k + m)).length ∧ bw A D (k + m) p' = bw A D k p ∧ fw A D (k + m) p' = fw A D k p
| 0, _, _, p, hp, _ => ⟨p, hp, rfl, rfl⟩
| m + 1, k, hkm, p, hp, hne =>
match stays m k (Nat.le_of_succ_le hkm) p hp (fun i q a b => hne i q a (Nat.lt_succ_of_lt b)) with
| ⟨p1, h1, b1, f1⟩ =>
match stay hD (Nat.lt_of_succ_le hkm) h1 (fun q e => hne (k + m) q (Nat.le_add_right _ _)
(Nat.lt_succ_self _) (by rw [← f1]; exact e)) with
| ⟨p2, h2, b2, f2⟩ => ⟨p2, h2, b2.trans b1, f2.trans f1⟩
end F
end TP
end Found
#print axioms Found.TP.fw_res
#print axioms Found.TP.tgtW_bw
#print axioms Found.TP.birth
#print axioms Found.TP.stays
lean_all/found/Top2.lean
/-
T193 (topological), part 2. found/Top2 — progressive plane drawings over
an ordered field and their reading:
* nodes (boxes labelled by generators, bends, input and output points):
a node is a horizontal bar from (x, y) to (x + w, y) (w ≥ 0; a point when
w = 0), each port at its own offset on the bar; every output port
starts one straight segment ending at an input port (tgt/src inverse);
x of a segment at height y by interpolation;
* validity: progressive (segments go up), planar (two segments, or a
segment and a node bar, never meet at a height strictly inside the
segments; distinct nodes at one height have disjoint bars), ports in
left-to-right order, port offsets on the bar;
* reading: boxes listed by height, each box read as the layer
⟨wires on its left, g, wires on its right⟩, the wires at its height
listed by x — a relation; it is unique (sorted enumerations are unique).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top1
import found.StrDiag2
namespace Found
namespace TP
open DetChain LibRing SD
/-! ## sorted enumerations -/
section E
variable {α : Type} (F : OF)
def NdG : List α → Prop
| [] => True
| a :: l => ¬ a ∈ l ∧ NdG l
def Enum (P : α → Prop) (l : List α) : Prop := NdG l ∧ ∀ e, e ∈ l ↔ P e
def Incr (k : α → F.K) : List α → Prop
| [] => True
| [_] => True
| a :: b :: l => F.lt (k a) (k b) ∧ Incr k (b :: l)
theorem incr_head (k : α → F.K) : {a : α} → {l : List α} → Incr F k (a :: l) → ∀ x, x ∈ l → F.lt (k a) (k x)
| _, _ :: _, h, _, .head _ => h.1
| _, _ :: _, h, x, .tail _ m => F.trans _ _ _ h.1 (incr_head k h.2 x m)
theorem incr_tail (k : α → F.K) {a : α} : {l : List α} → Incr F k (a :: l) → Incr F k l
| [], _ => trivial
| _ :: _, h => h.2
/-- sorted enumerations of the same set are equal -/
theorem enum_uniq (k : α → F.K) : (l l' : List α) → (P : α → Prop) → Enum P l → Incr F k l → Enum P l' → Incr F k l' → l = l'
| [], [], _, _, _, _, _ => rfl
| [], a :: _, _, h, _, h', _ => absurd ((h.2 a).2 ((h'.2 a).1 (.head _))) (fun m => nomatch m)
| a :: _, [], _, h, _, h', _ => absurd ((h'.2 a).2 ((h.2 a).1 (.head _))) (fun m => nomatch m)
| a :: l, a' :: l', P, h, hi, h', hi' => by
have ha'l : a' ∈ a :: l := (h.2 a').2 ((h'.2 a').1 (.head _))
have hal' : a ∈ a' :: l' := (h'.2 a).2 ((h.2 a).1 (.head _))
have e : a = a' := by
cases ha'l with
| head => rfl
| tail _ m1 =>
cases hal' with
| head => rfl
| tail _ m2 => exact absurd (incr_head F k hi' a m2) (lt_asymm F (incr_head F k hi a' m1))
subst e
have ih := enum_uniq k l l' (fun x => P x ∧ x ≠ a)
⟨h.1.2, fun x => ⟨fun m => ⟨(h.2 x).1 (.tail _ m), fun ex => h.1.1 (ex ▸ m)⟩,
fun ⟨hp, hne⟩ => match (h.2 x).2 hp with
| .head _ => absurd rfl hne
| .tail _ m => m⟩⟩ (incr_tail F k hi)
⟨h'.1.2, fun x => ⟨fun m => ⟨(h'.2 x).1 (.tail _ m), fun ex => h'.1.1 (ex ▸ m)⟩,
fun ⟨hp, hne⟩ => match (h'.2 x).2 hp with
| .head _ => absurd rfl hne
| .tail _ m => m⟩⟩ (incr_tail F k hi')
rw [ih]
end E
/-! ## drawings -/
variable (F : OF) (S : Sig)
inductive NK where
| box (g : S.G) : NK
| bend (o : Nat) : NK
| src (o : Nat) : NK
| snk (o : Nat) : NK
variable {S}
def getD : List Nat → Nat → Nat
| [], _ => 0
| a :: _, 0 => a
| _ :: l, i + 1 => getD l i
def nOut : NK S → Nat
| .box g => (S.cod g).length
| .bend _ => 1
| .src _ => 1
| .snk _ => 0
def nIn : NK S → Nat
| .box g => (S.dom g).length
| .bend _ => 1
| .src _ => 0
| .snk _ => 1
def outLab : NK S → Nat → Nat
| .box g, p => getD (S.cod g) p
| .bend o, _ => o
| .src o, _ => o
| .snk _, _ => 0
def inLab : NK S → Nat → Nat
| .box g, q => getD (S.dom g) q
| .bend o, _ => o
| .src _, _ => 0
| .snk o, _ => o
def IsBox : NK S → Prop
| .box _ => True
| .bend _ => False
| .src _ => False
| .snk _ => False
variable (S)
structure Drw where
nn : Nat
kind : Nat → NK S
px : Nat → F.K
py : Nat → F.K
tgt : Nat × Nat → Nat × Nat
src : Nat × Nat → Nat × Nat
wd : Nat → F.K
ox : Nat → Nat → F.K
ix : Nat → Nat → F.K
variable {F S} (G : Drw F S)
/-- e = (node, output port) is a segment -/
def Seg (e : Nat × Nat) : Prop := e.1 < G.nn ∧ e.2 < nOut (G.kind e.1)
def hiN (e : Nat × Nat) : Nat := (G.tgt e).1
/-- height strictly inside the segment -/
def Open (e : Nat × Nat) (y : F.K) : Prop := F.lt (G.py e.1) y ∧ F.lt y (G.py (hiN G e))
/-- the right end of a node's bar -/
def xr (k : Nat) : F.K := F.R.add (G.px k) (G.wd k)
/-- x of the start and end points of a segment -/
def xs (e : Nat × Nat) : F.K := F.R.add (G.px e.1) (G.ox e.1 e.2)
def xt (e : Nat × Nat) : F.K := F.R.add (G.px (hiN G e)) (G.ix (hiN G e) (G.tgt e).2)
/-- x of the segment at height y -/
def X (e : Nat × Nat) (y : F.K) : F.K :=
F.R.add (xs G e) (F.R.mul (F.R.mul (sub F.R y (G.py e.1)) (sub F.R (xt G e) (xs G e)))
(F.inv (sub F.R (G.py (hiN G e)) (G.py e.1))))
def lab (e : Nat × Nat) : Nat := outLab (G.kind e.1) e.2
structure Valid : Prop where
tgtOk : ∀ e, Seg G e → (G.tgt e).1 < G.nn ∧ (G.tgt e).2 < nIn (G.kind (G.tgt e).1) ∧
inLab (G.kind (G.tgt e).1) (G.tgt e).2 = lab G e ∧ G.src (G.tgt e) = e
srcOk : ∀ m q, m < G.nn → q < nIn (G.kind m) → Seg G (G.src (m, q)) ∧ G.tgt (G.src (m, q)) = (m, q)
prog : ∀ e, Seg G e → F.lt (G.py e.1) (G.py (hiN G e))
segs : ∀ e e', Seg G e → Seg G e' → e ≠ e' → ∀ y, Open G e y → Open G e' y → X G e y ≠ X G e' y
nodes : ∀ e k, Seg G e → k < G.nn → Open G e (G.py k) → F.lt (X G e (G.py k)) (G.px k) ∨ F.lt (xr G k) (X G e (G.py k))
outOrd : ∀ n p p' y, n < G.nn → p < p' → p' < nOut (G.kind n) → Open G (n, p) y → Open G (n, p') y →
F.lt (X G (n, p) y) (X G (n, p') y)
inOrd : ∀ m q q' y, m < G.nn → q < q' → q' < nIn (G.kind m) → Open G (G.src (m, q)) y → Open G (G.src (m, q')) y →
F.lt (X G (G.src (m, q)) y) (X G (G.src (m, q')) y)
pts : ∀ k k', k < G.nn → k' < G.nn → k ≠ k' → G.py k = G.py k' → F.lt (xr G k) (G.px k') ∨ F.lt (xr G k') (G.px k)
wd0 : ∀ k, k < G.nn → le F F.R.zero (G.wd k)
oxIn : ∀ n p, n < G.nn → p < nOut (G.kind n) → le F F.R.zero (G.ox n p) ∧ le F (G.ox n p) (G.wd n)
ixIn : ∀ m q, m < G.nn → q < nIn (G.kind m) → le F F.R.zero (G.ix m q) ∧ le F (G.ix m q) (G.wd m)
/-- box heights differ from the heights of all other nodes -/
def Generic : Prop := ∀ j k, j < G.nn → k < G.nn → IsBox (G.kind j) → j ≠ k → G.py j ≠ G.py k
/-! ## reading -/
def Lft (j : Nat) (e : Nat × Nat) : Prop := Seg G e ∧ Open G e (G.py j) ∧ F.lt (X G e (G.py j)) (G.px j)
def Rgt (j : Nat) (e : Nat × Nat) : Prop := Seg G e ∧ Open G e (G.py j) ∧ F.lt (xr G j) (X G e (G.py j))
def labs (l : List (Nat × Nat)) : List Nat := l.map (lab G)
def LayerOf (j : Nat) (ly : Ly S) : Prop :=
∃ g Ls Rs, G.kind j = .box g ∧ Enum (Lft G j) Ls ∧ Incr F (fun e => X G e (G.py j)) Ls ∧
Enum (Rgt G j) Rs ∧ Incr F (fun e => X G e (G.py j)) Rs ∧ ly = ⟨labs G Ls, g, labs G Rs⟩
inductive Fa2 {α β : Type} (R : α → β → Prop) : List α → List β → Prop where
| nil : Fa2 R [] []
| cons {a : α} {b : β} {l : List α} {m : List β} : R a b → Fa2 R l m → Fa2 R (a :: l) (b :: m)
def Reads (D : List (Ly S)) : Prop :=
∃ bl : List Nat, Enum (fun j => j < G.nn ∧ IsBox (G.kind j)) bl ∧ Incr F G.py bl ∧ Fa2 (LayerOf G) bl D
theorem box_inj {g g' : S.G} (h : (NK.box g : NK S) = .box g') : g = g' := by
cases h; rfl
theorem layer_uniq {j : Nat} {ly ly' : Ly S} (h : LayerOf G j ly) (h' : LayerOf G j ly') : ly = ly' :=
match h, h' with
| ⟨g, Ls, Rs, hk, hL, iL, hR, iR, e⟩, ⟨g', Ls', Rs', hk', hL', iL', hR', iR', e'⟩ => by
rw [e, e', enum_uniq F _ Ls Ls' _ hL iL hL' iL', enum_uniq F _ Rs Rs' _ hR iR hR' iR',
box_inj (hk.symm.trans hk')]
theorem fa2_uniq {α β : Type} {R : α → β → Prop} (hR : ∀ a b b', R a b → R a b' → b = b') :
{l : List α} → {m m' : List β} → Fa2 R l m → Fa2 R l m' → m = m'
| _, _, _, .nil, .nil => rfl
| _, _, _, .cons h1 t1, .cons h2 t2 => by rw [hR _ _ _ h1 h2, fa2_uniq hR t1 t2]
/-- the reading is unique -/
theorem reads_uniq {D D' : List (Ly S)} (h : Reads G D) (h' : Reads G D') : D = D' :=
match h, h' with
| ⟨bl, he, hi, hf⟩, ⟨bl', he', hi', hf'⟩ => by
have e : bl = bl' := enum_uniq F G.py bl bl' _ he hi he' hi'
subst e
exact fa2_uniq (R := LayerOf G) (fun _ _ _ h1 h2 => layer_uniq G h1 h2) hf hf'
/-! ## bars -/
theorem px_le_xr {G : Drw F S} (hv : Valid G) {k : Nat} (hk : k < G.nn) : le F (G.px k) (xr G k) := by
match hv.wd0 k hk with
| .inl h => exact .inl (by have := F.add_lt _ _ (G.px k) h; unfold xr; rw [F.R.add_comm (G.px k)]
rw [show F.R.add F.R.zero (G.px k) = G.px k by lib_ring] at this; exact this)
| .inr e => exact .inr (by unfold xr; rw [← e]; lib_ring)
theorem node_ne_px {G : Drw F S} (hv : Valid G) {e : Nat × Nat} {k : Nat} (he : Seg G e) (hk : k < G.nn)
(ho : Open G e (G.py k)) : X G e (G.py k) ≠ G.px k := fun h =>
(hv.nodes e k he hk ho).elim (fun h' => F.irr _ (by rw [h] at h'; exact h'))
(fun h' => (px_le_xr hv hk).elim (fun h'' => F.irr _ (F.trans _ _ _ (by rw [h] at h'; exact h') h''))
(fun e' => F.irr _ (by rw [h, e'] at h'; exact h')))
theorem node_ne_xr {G : Drw F S} (hv : Valid G) {e : Nat × Nat} {k : Nat} (he : Seg G e) (hk : k < G.nn)
(ho : Open G e (G.py k)) : X G e (G.py k) ≠ xr G k := fun h =>
(hv.nodes e k he hk ho).elim
(fun h' => (px_le_xr hv hk).elim (fun h'' => F.irr _ (F.trans _ _ _ h'' (by rw [h] at h'; exact h')))
(fun e' => F.irr _ (by rw [h, ← e'] at h'; exact h')))
(fun h' => F.irr _ (by rw [h] at h'; exact h'))
theorem le_trans' {a b c : F.K} (h1 : le F a b) (h2 : le F b c) : le F a c :=
h1.elim (fun l => .inl (lt_of_lt_of_le F l h2)) (fun e => by rw [e]; exact h2)
theorem le_add_l {a b : F.K} (c : F.K) (h : le F a b) : le F (F.R.add c a) (F.R.add c b) :=
h.elim (fun l => .inl (by
have := F.add_lt _ _ c l
rw [F.R.add_comm a, F.R.add_comm b] at this; exact this))
(fun e => .inr (by rw [e]))
theorem le_self_add {b a : F.K} (h : le F F.R.zero a) : le F b (F.R.add b a) := by
have := le_add_l b h
rw [show F.R.add b F.R.zero = b by lib_ring] at this; exact this
/-- a port offset lies on the bar -/
theorem on_bar {G : Drw F S} {k : Nat} {o : F.K} (h : le F F.R.zero o ∧ le F o (G.wd k)) :
le F (G.px k) (F.R.add (G.px k) o) ∧ le F (F.R.add (G.px k) o) (xr G k) :=
⟨le_self_add h.1, le_add_l (G.px k) h.2⟩
theorem xs_in {G : Drw F S} (hv : Valid G) {e : Nat × Nat} (he : Seg G e) :
le F (G.px e.1) (xs G e) ∧ le F (xs G e) (xr G e.1) := on_bar (hv.oxIn e.1 e.2 he.1 he.2)
theorem xt_in {G : Drw F S} (hv : Valid G) {e : Nat × Nat} (he : Seg G e) :
le F (G.px (hiN G e)) (xt G e) ∧ le F (xt G e) (xr G (hiN G e)) :=
on_bar (hv.ixIn _ _ (hv.tgtOk e he).1 (hv.tgtOk e he).2.1)
/-- a point of one bar is off a disjoint bar -/
theorem off_bar {G : Drw F S} {P Q : Nat} {v : F.K}
(h1 : le F (G.px Q) v) (h2 : le F v (xr G Q))
(hd : F.lt (xr G P) (G.px Q) ∨ F.lt (xr G Q) (G.px P)) : F.lt v (G.px P) ∨ F.lt (xr G P) v :=
hd.elim (fun h => .inr (lt_of_lt_of_le F h h1)) (fun h => .inl (lt_of_le_of_lt F h2 h))
theorem out_ne {a b v : F.K} (hab : le F a b) (h : F.lt v a ∨ F.lt b v) : v ≠ a ∧ v ≠ b :=
h.elim (fun l => ⟨lt_ne F l, fun e => F.irr _ (by rw [e] at l; exact lt_of_lt_of_le F l hab)⟩)
(fun l => ⟨fun e => F.irr _ (by rw [e] at l; exact lt_of_le_of_lt F hab l), fun e => F.irr _ (by rw [e] at l; exact l)⟩)
end TP
end Found
#print axioms Found.TP.enum_uniq
#print axioms Found.TP.layer_uniq
#print axioms Found.TP.reads_uniq
lean_all/found/Top20.lean
/-
T193 (topological), part 20. found/Top20 — the column drawing of a layer
list D from A: output points of A at height s0, the box of layer j at
height h j (a bar from lo j to hi j), input points of the final object at
height s1; every wire is one vertical segment at x = ξ(the port starting
it). Here: the node cases, the segments are exactly the output ports, the
segment ends are tgtW / the wire of a position, and x of every segment is
ξ at every height.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top19
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- the three kinds of nodes -/
def ncase {α : Type} (A : Ob) (D : List (Ly S)) (n : Nat) (fs : Nat → α) (fb : Nat → Ly S → α) (fk : Nat → α) : α :=
match Nat.decLt n A.length with
| isTrue _ => fs n
| isFalse _ => match lget D (n - A.length) with
| some l => fb (n - A.length) l
| none => fk (n - A.length - D.length)
section N
variable {α : Type} (A : Ob) (D : List (Ly S)) (fs : Nat → α) (fb : Nat → Ly S → α) (fk : Nat → α)
theorem nc_src {n : Nat} (h : n < A.length) : ncase A D n fs fb fk = fs n := by
unfold ncase
match Nat.decLt n A.length with
| isTrue _ => rfl
| isFalse h' => exact absurd h h'
theorem nc_box {j : Nat} {l : Ly S} (h : lget D j = some l) : ncase A D (A.length + j) fs fb fk = fb j l := by
unfold ncase
match Nat.decLt (A.length + j) A.length with
| isTrue h' => exact absurd h' (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ =>
show (match lget D (A.length + j - A.length) with
| some l => fb (A.length + j - A.length) l
| none => _) = _
rw [asub, h]
theorem nc_snk (s : Nat) : ncase A D (A.length + D.length + s) fs fb fk = fk s := by
unfold ncase
match Nat.decLt (A.length + D.length + s) A.length with
| isTrue h' => exact absurd h' nlt3
| isFalse _ =>
show (match lget D (A.length + D.length + s - A.length) with
| some l => _
| none => fk (A.length + D.length + s - A.length - D.length)) = _
rw [Nat.add_assoc, asub, lget_ge D _ (Nat.le_add_right _ _), asub]
end N
theorem ncases (A : Ob) (D : List (Ly S)) (n : Nat) :
n < A.length ∨ (∃ j l, lget D j = some l ∧ n = A.length + j) ∨ (∃ s, n = A.length + D.length + s) :=
match Nat.lt_or_ge n A.length with
| .inl h => .inl h
| .inr h =>
match Nat.lt_or_ge (n - A.length) D.length with
| .inl h2 => match lget_lt D _ h2 with
| ⟨l, hl⟩ => .inr (.inl ⟨_, l, hl, (subD _ _ h).symm⟩)
| .inr h2 => .inr (.inr ⟨n - A.length - D.length, by rw [Nat.add_assoc, subD _ _ h2, subD _ _ h]⟩)
/-- the column drawing -/
def col (A : Ob) (D : List (Ly S)) (s0 s1 : F.K) (h : Nat → F.K) (ξ : Nat × Nat → F.K) (lo hi : Nat → F.K) : Drw F S where
nn := A.length + D.length + (lev A D D.length).length
kind := ckind A D
px n := ncase A D n (fun n => ξ (n, 0)) (fun j _ => lo j) (fun s => ξ (bw A D D.length s))
py n := ncase A D n (fun _ => s0) (fun j _ => h j) (fun _ => s1)
tgt e := tgtW A D e
src e := ncase A D e.1 (fun _ => (0, 0)) (fun j l => bw A D j (l.L.length + e.2)) (fun s => bw A D D.length s)
wd n := ncase A D n (fun _ => F.R.zero) (fun j _ => sub F.R (hi j) (lo j)) (fun _ => F.R.zero)
ox n p := ncase A D n (fun _ => F.R.zero) (fun j _ => sub F.R (ξ (n, p)) (lo j)) (fun _ => F.R.zero)
ix n q := ncase A D n (fun _ => F.R.zero) (fun j l => sub F.R (ξ (bw A D j (l.L.length + q))) (lo j)) (fun _ => F.R.zero)
section C
variable (A : Ob) (D : List (Ly S)) (s0 s1 : F.K) (h : Nat → F.K) (ξ : Nat × Nat → F.K) (lo hi : Nat → F.K)
theorem px_src {n : Nat} (h1 : n < A.length) : (col A D s0 s1 h ξ lo hi).px n = ξ (n, 0) :=
nc_src A D (fun n => ξ (n, 0)) (fun j _ => lo j) (fun s => ξ (bw A D D.length s)) h1
theorem px_box {j : Nat} {l : Ly S} (hl : lget D j = some l) : (col A D s0 s1 h ξ lo hi).px (A.length + j) = lo j :=
nc_box A D (fun n => ξ (n, 0)) (fun j _ => lo j) (fun s => ξ (bw A D D.length s)) hl
theorem px_snk (s : Nat) : (col A D s0 s1 h ξ lo hi).px (A.length + D.length + s) = ξ (bw A D D.length s) :=
nc_snk A D (fun n => ξ (n, 0)) (fun j _ => lo j) (fun s => ξ (bw A D D.length s)) s
theorem py_src {n : Nat} (h1 : n < A.length) : (col A D s0 s1 h ξ lo hi).py n = s0 :=
nc_src A D (fun _ => s0) (fun j _ => h j) (fun _ => s1) h1
theorem py_box {j : Nat} {l : Ly S} (hl : lget D j = some l) : (col A D s0 s1 h ξ lo hi).py (A.length + j) = h j :=
nc_box A D (fun _ => s0) (fun j _ => h j) (fun _ => s1) hl
theorem py_snk (s : Nat) : (col A D s0 s1 h ξ lo hi).py (A.length + D.length + s) = s1 :=
nc_snk A D (fun _ => s0) (fun j _ => h j) (fun _ => s1) s
theorem wd_src {n : Nat} (h1 : n < A.length) : (col A D s0 s1 h ξ lo hi).wd n = F.R.zero :=
nc_src A D (fun _ => F.R.zero) (fun j _ => sub F.R (hi j) (lo j)) (fun _ => F.R.zero) h1
theorem wd_box {j : Nat} {l : Ly S} (hl : lget D j = some l) : (col A D s0 s1 h ξ lo hi).wd (A.length + j) = sub F.R (hi j) (lo j) :=
nc_box A D (fun _ => F.R.zero) (fun j _ => sub F.R (hi j) (lo j)) (fun _ => F.R.zero) hl
theorem wd_snk (s : Nat) : (col A D s0 s1 h ξ lo hi).wd (A.length + D.length + s) = F.R.zero :=
nc_snk A D (fun _ => F.R.zero) (fun j _ => sub F.R (hi j) (lo j)) (fun _ => F.R.zero) s
theorem ox_src {n : Nat} (p : Nat) (h1 : n < A.length) : (col A D s0 s1 h ξ lo hi).ox n p = F.R.zero :=
nc_src A D (fun _ => F.R.zero) (fun j _ => sub F.R (ξ (n, p)) (lo j)) (fun _ => F.R.zero) h1
theorem ox_box {j : Nat} {l : Ly S} (p : Nat) (hl : lget D j = some l) :
(col A D s0 s1 h ξ lo hi).ox (A.length + j) p = sub F.R (ξ (A.length + j, p)) (lo j) :=
nc_box A D (fun _ => F.R.zero) (fun j' _ => sub F.R (ξ (A.length + j, p)) (lo j')) (fun _ => F.R.zero) hl
theorem ix_box {j : Nat} {l : Ly S} (q : Nat) (hl : lget D j = some l) :
(col A D s0 s1 h ξ lo hi).ix (A.length + j) q = sub F.R (ξ (bw A D j (l.L.length + q))) (lo j) :=
nc_box A D (fun _ => F.R.zero) (fun j l => sub F.R (ξ (bw A D j (l.L.length + q))) (lo j)) (fun _ => F.R.zero) hl
theorem ix_snk (s q : Nat) : (col A D s0 s1 h ξ lo hi).ix (A.length + D.length + s) q = F.R.zero :=
nc_snk A D (fun _ => F.R.zero) (fun j l => sub F.R (ξ (bw A D j (l.L.length + q))) (lo j)) (fun _ => F.R.zero) s
theorem src_box {j : Nat} {l : Ly S} (q : Nat) (hl : lget D j = some l) :
(col A D s0 s1 h ξ lo hi).src (A.length + j, q) = bw A D j (l.L.length + q) :=
nc_box A D (fun _ => (0, 0)) (fun j l => bw A D j (l.L.length + q)) (fun s => bw A D D.length s) hl
theorem src_snk (s q : Nat) : (col A D s0 s1 h ξ lo hi).src (A.length + D.length + s, q) = bw A D D.length s :=
nc_snk A D (fun _ => (0, 0)) (fun j l => bw A D j (l.L.length + q)) (fun s => bw A D D.length s) s
theorem seg_col (e : Nat × Nat) : Seg (col A D s0 s1 h ξ lo hi) e ↔ OP A D e := by
constructor
· intro ⟨hn, hp⟩
match ncases A D e.1 with
| .inl h1 =>
have hk : (col A D s0 s1 h ξ lo hi).kind e.1 = .src (getD A e.1) := ckind_src A D h1
have hp' := hp
rw [hk] at hp'
exact .inl ⟨h1, Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ hp')⟩
| .inr (.inl ⟨j, l, hl, e1⟩) =>
have hk : (col A D s0 s1 h ξ lo hi).kind e.1 = .box l.g := by show ckind A D e.1 = _; rw [e1, ckind_box A D hl]
exact .inr ⟨j, l, hl, e1, by have := hp; rw [hk] at this; exact this⟩
| .inr (.inr ⟨s, e1⟩) =>
have hk : (col A D s0 s1 h ξ lo hi).kind e.1 = .snk (getD (lev A D D.length) s) := by
show ckind A D e.1 = _; rw [e1, ckind_snk]
have := hp; rw [hk] at this; exact absurd this (Nat.not_lt_zero _)
· intro hop
match hop with
| .inl ⟨h1, h2⟩ =>
refine ⟨Nat.lt_of_lt_of_le h1 (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)), ?_⟩
show e.2 < nOut (ckind A D e.1); rw [ckind_src A D h1, h2]; exact Nat.zero_lt_one
| .inr ⟨j, l, hl, e1, hq⟩ =>
refine ⟨?_, ?_⟩
· show e.1 < A.length + D.length + _
rw [e1, Nat.add_assoc]
exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le (lget_some_lt D j hl) (Nat.le_add_right _ _)) _
· show e.2 < nOut (ckind A D e.1); rw [e1, ckind_box A D hl]; exact hq
theorem xs_col {e : Nat × Nat} (he : OP A D e) : xs (col A D s0 s1 h ξ lo hi) e = ξ e := by
unfold xs
match he with
| .inl ⟨h1, h2⟩ =>
rw [px_src A D s0 s1 h ξ lo hi h1, ox_src A D s0 s1 h ξ lo hi _ h1]
match e, h2 with
| (n, p), h2 => have h2' : p = 0 := h2; rw [h2']; show F.R.add (ξ (n, 0)) F.R.zero = ξ (n, 0); lib_ring
| .inr ⟨j, l, hl, e1, _⟩ =>
match e, e1 with
| (n, p), e1 =>
have e1' : n = A.length + j := e1
show F.R.add ((col A D s0 s1 h ξ lo hi).px n) ((col A D s0 s1 h ξ lo hi).ox n p) = ξ (n, p)
rw [e1', px_box A D s0 s1 h ξ lo hi hl, ox_box A D s0 s1 h ξ lo hi _ hl]; lib_ring
theorem xt_col {B : Ob} (hD : DTy D A B) {k p : Nat} (hk : k ≤ D.length) (hp : p < (lev A D k).length) :
xt (col A D s0 s1 h ξ lo hi) (bw A D k p) = ξ (bw A D k p) := by
unfold xt hiN
show F.R.add ((col A D s0 s1 h ξ lo hi).px (tgtW A D (bw A D k p)).1) ((col A D s0 s1 h ξ lo hi).ix (tgtW A D (bw A D k p)).1 (tgtW A D (bw A D k p)).2) = _
rw [tgtW_bw hD k hk p hp]
match fw_res' hD hk hp with
| .inl ⟨j, l, q, hl, _, _, ef, eb⟩ =>
rw [ef]
show F.R.add ((col A D s0 s1 h ξ lo hi).px (A.length + j)) ((col A D s0 s1 h ξ lo hi).ix (A.length + j) q) = _
rw [px_box A D s0 s1 h ξ lo hi hl, ix_box A D s0 s1 h ξ lo hi _ hl, eb]; lib_ring
| .inr ⟨s, _, ef, eb⟩ =>
rw [ef]
show F.R.add ((col A D s0 s1 h ξ lo hi).px (A.length + D.length + s)) ((col A D s0 s1 h ξ lo hi).ix (A.length + D.length + s) 0) = _
rw [px_snk, ix_snk, eb]; lib_ring
/-- every segment is vertical at x = ξ -/
theorem X_col {B : Ob} (hD : DTy D A B) {k p : Nat} (hk : k ≤ D.length) (hp : p < (lev A D k).length) (y : F.K) :
X (col A D s0 s1 h ξ lo hi) (bw A D k p) y = ξ (bw A D k p) := by
have e1 := xs_col A D s0 s1 h ξ lo hi (bw_op hD k hk p hp).1
have e2 := xt_col A D s0 s1 h ξ lo hi hD hk hp
unfold X
rw [e1, e2]; lib_ring
end C
end TP
end Found
#print axioms Found.TP.nc_snk
#print axioms Found.TP.ncases
#print axioms Found.TP.seg_col
#print axioms Found.TP.xs_col
#print axioms Found.TP.xt_col
#print axioms Found.TP.X_col
lean_all/found/Top21.lean
/-
T193 (topological), part 21. found/Top21 — heights and lives of the wires
of a column drawing: with s0 below every box height, s1 above, the box
heights increasing, a wire born at level b and ending at level t
(s0 / h (b - 1) and h t / s1) is present at every level between, and the
comparisons of heights with levels are the comparisons of the levels.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top20
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- heights: s0 < boxes (increasing) < s1 -/
structure HH (N : Nat) (s0 s1 : F.K) (h : Nat → F.K) : Prop where
s01 : F.lt s0 s1
lo : ∀ j, j < N → F.lt s0 (h j)
hi : ∀ j, j < N → F.lt (h j) s1
mono : ∀ i j, i < j → j < N → F.lt (h i) (h j)
/-- the height where wires of level b start, and where wires of level t end -/
def Hlo (s0 : F.K) (h : Nat → F.K) : Nat → F.K
| 0 => s0
| b + 1 => h b
def Hhi (N : Nat) (s1 : F.K) (h : Nat → F.K) (t : Nat) : F.K :=
match Nat.decLt t N with
| isTrue _ => h t
| isFalse _ => s1
section H
variable {N : Nat} {s0 s1 : F.K} {h : Nat → F.K} (hh : HH N s0 s1 h)
include hh
omit hh in
theorem Hhi_lt {t : Nat} (ht : t < N) : Hhi N s1 h t = h t := by
unfold Hhi
match Nat.decLt t N with
| isTrue _ => rfl
| isFalse h' => exact absurd ht h'
omit hh in
theorem Hhi_N : Hhi N s1 h N = s1 := by
unfold Hhi
match Nat.decLt N N with
| isTrue h' => exact absurd h' (Nat.lt_irrefl _)
| isFalse _ => rfl
theorem mono_le {i j : Nat} (hij : i ≤ j) (hj : j < N) : le F (h i) (h j) :=
match Nat.lt_or_ge i j with
| .inl l => .inl (hh.mono i j l hj)
| .inr g => .inr (by rw [Nat.le_antisymm hij g])
/-- a box height above the start of level b means b is at most that box -/
theorem lo_box {b j : Nat} (hb : b ≤ N) (h1 : F.lt (Hlo s0 h b) (h j)) : b ≤ j :=
match b, hb, h1 with
| 0, _, _ => Nat.zero_le _
| b + 1, hb, h1 => match Nat.lt_or_ge b j with
| .inl l => Nat.succ_le_of_lt l
| .inr g => absurd (lt_of_le_of_lt F (mono_le hh g (Nat.lt_of_succ_le hb)) h1) (F.irr _)
theorem box_hi {j t : Nat} (ht : t ≤ N) (hj : j < N) (h1 : F.lt (h j) (Hhi N s1 h t)) : j < t :=
match Nat.lt_or_ge t N with
| .inl tl => by
rw [Hhi_lt tl] at h1
exact match Nat.lt_or_ge j t with
| .inl l => l
| .inr g => absurd (lt_of_le_of_lt F (mono_le hh g hj) h1) (F.irr _)
| .inr tg => by rw [Nat.le_antisymm ht tg]; exact hj
theorem lo_hi {b t : Nat} (hb : b ≤ N) (ht : t ≤ N) (h1 : F.lt (Hlo s0 h b) (Hhi N s1 h t)) : b ≤ t :=
match b, hb, h1 with
| 0, _, _ => Nat.zero_le _
| _ + 1, hb, h1 => Nat.succ_le_of_lt (box_hi hh ht (Nat.lt_of_succ_le hb) h1)
theorem box_lo {b j : Nat} (hj : j < N) (hbj : b ≤ j) : F.lt (Hlo s0 h b) (h j) :=
match b, hbj with
| 0, _ => hh.lo j hj
| b + 1, hbj => hh.mono b j (Nat.lt_of_succ_le hbj) hj
theorem hi_box {j t : Nat} (ht : t ≤ N) (hjt : j < t) : F.lt (h j) (Hhi N s1 h t) :=
match Nat.lt_or_ge t N with
| .inl tl => by rw [Hhi_lt tl]; exact hh.mono j t hjt tl
| .inr tg => by
rw [Nat.le_antisymm ht tg, Hhi_N]
exact hh.hi j (by rw [← Nat.le_antisymm ht tg]; exact hjt)
theorem lo_lt_hi {b t : Nat} (ht : t ≤ N) (hbt : b ≤ t) : F.lt (Hlo s0 h b) (Hhi N s1 h t) :=
match b, hbt with
| 0, _ => match Nat.lt_or_ge t N with
| .inl tl => by rw [Hhi_lt tl]; exact hh.lo t tl
| .inr tg => by rw [Nat.le_antisymm ht tg, Hhi_N]; exact hh.s01
| b + 1, hbt => hi_box hh ht (Nat.lt_of_succ_le hbt)
theorem s0_le {b : Nat} (hb : b ≤ N) : le F s0 (Hlo s0 h b) :=
match b, hb with
| 0, _ => .inr rfl
| b + 1, hb => .inl (hh.lo b (Nat.lt_of_succ_le hb))
theorem le_s1 {t : Nat} (ht : t ≤ N) : le F (Hhi N s1 h t) s1 :=
match Nat.lt_or_ge t N with
| .inl tl => by rw [Hhi_lt tl]; exact .inl (hh.hi t tl)
| .inr tg => by rw [Nat.le_antisymm ht tg, Hhi_N]; exact .inr rfl
end H
/-! ## lives of wires -/
/-- the wire e is born at level b and ends at level t -/
structure Life (A : Ob) (D : List (Ly S)) (s0 s1 : F.K) (h : Nat → F.K) (ξ : Nat × Nat → F.K) (lo hi : Nat → F.K)
(e : Nat × Nat) (b t : Nat) : Prop where
bt : b ≤ t
tN : t ≤ D.length
pyl : (col A D s0 s1 h ξ lo hi).py e.1 = Hlo s0 h b
pyh : (col A D s0 s1 h ξ lo hi).py (hiN (col A D s0 s1 h ξ lo hi) e) = Hhi D.length s1 h t
pres : ∀ k, b ≤ k → k ≤ t → ∃ p, p < (lev A D k).length ∧ bw A D k p = e ∧ fw A D k p = tgtW A D e
endk : ∀ k q, k < t → tgtW A D e ≠ (A.length + k, q)
theorem op_bw {A : Ob} {D : List (Ly S)} {e : Nat × Nat} (he : OP A D e) :
∃ b p, b ≤ D.length ∧ p < (lev A D b).length ∧ bw A D b p = e :=
match birth he with
| .inl ⟨_, _, e1, hp⟩ => ⟨0, e.1, Nat.zero_le _, hp, e1⟩
| .inr ⟨j, _, hl, _, _, e1, hp⟩ => ⟨j + 1, _, Nat.succ_le_of_lt (lget_some_lt D j hl), hp, e1⟩
theorem life {A B : Ob} {D : List (Ly S)} (hD : DTy D A B) (s0 s1 : F.K) (h : Nat → F.K) (ξ : Nat × Nat → F.K)
(lo hi : Nat → F.K) {e : Nat × Nat} (he : OP A D e) : ∃ b t, Life A D s0 s1 h ξ lo hi e b t := by
have hb : ∃ b p, b ≤ D.length ∧ p < (lev A D b).length ∧ bw A D b p = e ∧
(col A D s0 s1 h ξ lo hi).py e.1 = Hlo s0 h b :=
match birth he with
| .inl ⟨h1, _, e1, hp⟩ => ⟨0, e.1, Nat.zero_le _, hp, e1, py_src A D s0 s1 h ξ lo hi h1⟩
| .inr ⟨j, l, hl, e2, _, e1, hp⟩ => ⟨j + 1, _, Nat.succ_le_of_lt (lget_some_lt D j hl), hp, e1, by
rw [e2, py_box A D s0 s1 h ξ lo hi hl]; rfl⟩
match hb with
| ⟨b, p, hbN, hp, eb, pyl⟩ =>
have tw : tgtW A D e = fw A D b p := by rw [← eb]; exact tgtW_bw hD b hbN p hp
have hiE : hiN (col A D s0 s1 h ξ lo hi) e = (fw A D b p).1 := by
show (tgtW A D e).1 = _; rw [tw]
match fw_res' hD hbN hp with
| .inl ⟨j, l, q, hl, hbj, _, ef, _⟩ =>
have hjN := lget_some_lt D j hl
have notk : ∀ k q', k < j → tgtW A D e ≠ (A.length + k, q') := fun k q' hk e2 => by
rw [tw, ef] at e2
exact Nat.lt_irrefl _ (by
have := congrArg Prod.fst e2
have a2 : A.length + j = A.length + k := this
rw [addLC2 _ a2] at hk; exact hk)
exact ⟨b, j, ⟨hbj, Nat.le_of_lt hjN, pyl, by rw [hiE, ef, py_box A D s0 s1 h ξ lo hi hl, Hhi_lt hjN],
fun k hk1 hk2 => by
have st := stays hD (k - b) b (by rw [subD b k hk1]; exact Nat.le_trans hk2 (Nat.le_of_lt hjN)) p hp
(fun i q' a c => by rw [← tw]; exact notk i q' (Nat.lt_of_lt_of_le (by rw [subD b k hk1] at c; exact c) hk2))
rw [subD b k hk1] at st
match st with
| ⟨p', h1, h2, h3⟩ => exact ⟨p', h1, by rw [h2, eb], by rw [h3, tw]⟩,
notk⟩⟩
| .inr ⟨s, _, ef, _⟩ =>
have notk : ∀ k q', k < D.length → tgtW A D e ≠ (A.length + k, q') := fun k q' hk e2 => by
rw [tw, ef] at e2
have a2 : A.length + D.length + s = A.length + k := congrArg Prod.fst e2
rw [Nat.add_assoc] at a2
have := addLC2 _ a2
rw [← this] at hk
exact Nat.lt_irrefl _ (Nat.lt_of_le_of_lt (Nat.le_add_right _ _) hk)
exact ⟨b, D.length, ⟨hbN, Nat.le_refl _, pyl, by rw [hiE, ef, py_snk, Hhi_N],
fun k hk1 hk2 => by
have st := stays hD (k - b) b (by rw [subD b k hk1]; exact hk2) p hp
(fun i q' a c => by rw [← tw]; exact notk i q' (Nat.lt_of_lt_of_le (by rw [subD b k hk1] at c; exact c) hk2))
rw [subD b k hk1] at st
match st with
| ⟨p', h1, h2, h3⟩ => exact ⟨p', h1, by rw [h2, eb], by rw [h3, tw]⟩,
notk⟩⟩
end TP
end Found
#print axioms Found.TP.lo_box
#print axioms Found.TP.lo_hi
#print axioms Found.TP.lo_lt_hi
#print axioms Found.TP.life
lean_all/found/Top22.lean
/-
T193 (topological), part 22. found/Top22 — when the column drawing is
valid: heights as in HH, and x-data "good" for D:
* at every level the wires are strictly increasing in x;
* the bar of the box of layer j lies strictly between the wires on its
left and those on its right, and contains its ports.
Then the column drawing is valid and generic.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top21
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- good x-data for the column drawing of D from A -/
structure Good (A : Ob) (D : List (Ly S)) (ξ : Nat × Nat → F.K) (lo hi : Nat → F.K) : Prop where
inc : ∀ k p p', k ≤ D.length → p < p' → p' < (lev A D k).length → F.lt (ξ (bw A D k p)) (ξ (bw A D k p'))
L : ∀ j l p, lget D j = some l → p < l.L.length → F.lt (ξ (bw A D j p)) (lo j)
R : ∀ j l r, lget D j = some l → r < l.R.length →
F.lt (hi j) (ξ (bw A D j (l.L.length + (S.dom l.g).length + r)))
inB : ∀ j l q, lget D j = some l → q < (S.dom l.g).length →
le F (lo j) (ξ (bw A D j (l.L.length + q))) ∧ le F (ξ (bw A D j (l.L.length + q))) (hi j)
outB : ∀ j l q, lget D j = some l → q < (S.cod l.g).length →
le F (lo j) (ξ (A.length + j, q)) ∧ le F (ξ (A.length + j, q)) (hi j)
lh : ∀ j l, lget D j = some l → le F (lo j) (hi j)
theorem le_sub0 {a b : F.K} (h : le F a b) : le F F.R.zero (sub F.R b a) :=
h.elim (fun l => .inl (sub_pos F l)) (fun e => .inr (by rw [e]; lib_ring))
theorem le_subs {a b c : F.K} (h : le F b c) : le F (sub F.R b a) (sub F.R c a) :=
h.elim (fun l => .inl (by
have := F.add_lt _ _ (F.R.neg a) l
rw [show F.R.add b (F.R.neg a) = sub F.R b a by lib_ring, show F.R.add c (F.R.neg a) = sub F.R c a by lib_ring] at this
exact this))
(fun e => .inr (by rw [e]))
theorem ne_of_inc {x y : F.K} (h : F.lt x y ∨ F.lt y x) : x ≠ y :=
h.elim (lt_ne F) (fun l e => lt_ne F l e.symm)
section V
variable {A B : Ob} {D : List (Ly S)} (hD : DTy D A B) {s0 s1 : F.K} {h : Nat → F.K} (hh : HH D.length s0 s1 h)
{ξ : Nat × Nat → F.K} {lo hi : Nat → F.K} (hg : Good A D ξ lo hi)
include hD
theorem X_op {e : Nat × Nat} (he : OP A D e) (y : F.K) : X (col A D s0 s1 h ξ lo hi) e y = ξ e :=
match op_bw he with
| ⟨_, _, hb, hp, eb⟩ => by rw [← eb]; exact X_col A D s0 s1 h ξ lo hi hD hb hp y
omit hD in
include hg in
theorem inc_ne {k p p' : Nat} (hk : k ≤ D.length) (hp : p < (lev A D k).length) (hp' : p' < (lev A D k).length)
(hne : p ≠ p') : ξ (bw A D k p) ≠ ξ (bw A D k p') :=
match Nat.lt_or_ge p p' with
| .inl l => lt_ne F (hg.inc k p p' hk l hp')
| .inr g => fun e => lt_ne F (hg.inc k p' p hk (Nat.lt_of_le_of_ne g (fun e' => hne e'.symm)) hp) e.symm
omit hD in
theorem xr_box {j : Nat} {l : Ly S} (hl : lget D j = some l) : xr (col A D s0 s1 h ξ lo hi) (A.length + j) = hi j := by
unfold xr; rw [px_box A D s0 s1 h ξ lo hi hl, wd_box A D s0 s1 h ξ lo hi hl]; lib_ring
include hh hg
theorem valid_col : Valid (col A D s0 s1 h ξ lo hi) where
tgtOk e he := by
have hop := (seg_col A D s0 s1 h ξ lo hi e).1 he
match op_bw hop with
| ⟨b, p, hb, hp, eb⟩ =>
subst eb
have hl0 := bw_lab hD b hb p hp
have et0 : (col A D s0 s1 h ξ lo hi).tgt (bw A D b p) = fw A D b p := tgtW_bw hD b hb p hp
rw [et0]
match fw_res' hD hb hp with
| .inl ⟨j, l, q, hl, _, hq, ef, ebw⟩ =>
rw [ef]
have hjN := lget_some_lt D j hl
refine ⟨?_, ?_, ?_, ?_⟩
· show A.length + j < A.length + D.length + _
rw [Nat.add_assoc]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le hjN (Nat.le_add_right _ _)) _
· show q < nIn (ckind A D (A.length + j)); rw [ckind_box A D hl]; exact hq
· show inLab (ckind A D (A.length + j)) q = outLab (ckind A D (bw A D b p).1) (bw A D b p).2
rw [ckind_box A D hl, hl0]
have hj := bw_lab hD j (Nat.le_of_lt hjN) (l.L.length + q) (by
rw [len_in hD hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _))
rw [ebw, hl0, lev_in hD j hl, getD_l _ _ _ (by rw [lenA]; exact Nat.add_lt_add_left hq _), getD_r] at hj
exact hj.symm
· show (col A D s0 s1 h ξ lo hi).src (A.length + j, q) = _
rw [src_box A D s0 s1 h ξ lo hi q hl, ebw]
| .inr ⟨s, hs, ef, ebw⟩ =>
rw [ef]
refine ⟨?_, ?_, ?_, ?_⟩
· show A.length + D.length + s < A.length + D.length + _
exact Nat.add_lt_add_left hs _
· show 0 < nIn (ckind A D (A.length + D.length + s)); rw [ckind_snk]; exact Nat.zero_lt_one
· show inLab (ckind A D (A.length + D.length + s)) 0 = outLab (ckind A D (bw A D b p).1) (bw A D b p).2
rw [ckind_snk, hl0]
have hj := bw_lab hD D.length (Nat.le_refl _) s hs
rw [ebw, hl0] at hj
exact hj.symm
· show (col A D s0 s1 h ξ lo hi).src (A.length + D.length + s, 0) = _
rw [src_snk, ebw]
srcOk m q hm hq := by
match ncases A D m with
| .inl h1 =>
have : nIn ((col A D s0 s1 h ξ lo hi).kind m) = 0 := by show nIn (ckind A D m) = 0; rw [ckind_src A D h1]; rfl
rw [this] at hq; exact absurd hq (Nat.not_lt_zero _)
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hq' : q < (S.dom l.g).length := by have this : q < nIn (ckind A D _) := hq; rw [ckind_box A D hl] at this; exact this
have hjN := lget_some_lt D j hl
have hpos : l.L.length + q < (lev A D j).length := by
rw [len_in hD hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq' _) (Nat.le_add_right _ _)
rw [src_box A D s0 s1 h ξ lo hi q hl]
refine ⟨(seg_col A D s0 s1 h ξ lo hi _).2 (bw_op hD j (Nat.le_of_lt hjN) _ hpos).1, ?_⟩
show tgtW A D _ = _
rw [tgtW_bw hD j (Nat.le_of_lt hjN) _ hpos, fw_D A D hl hq']
| .inr (.inr ⟨s, e1⟩) =>
subst e1
have hs : s < (lev A D D.length).length := Nat.lt_of_add_lt_add_left hm
have hq0 : q = 0 := by
have this : q < nIn (ckind A D _) := hq; rw [ckind_snk] at this
exact Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ this)
subst hq0
rw [src_snk]
refine ⟨(seg_col A D s0 s1 h ξ lo hi _).2 (bw_op hD D.length (Nat.le_refl _) s hs).1, ?_⟩
show tgtW A D _ = _
rw [tgtW_bw hD D.length (Nat.le_refl _) s hs, fw_end]
prog e he := by
match life hD s0 s1 h ξ lo hi ((seg_col A D s0 s1 h ξ lo hi e).1 he) with
| ⟨b, t, L⟩ => rw [L.pyl, L.pyh]; exact lo_lt_hi hh L.tN L.bt
segs e e' he he' hne y ho ho' := by
have op := (seg_col A D s0 s1 h ξ lo hi e).1 he
have op' := (seg_col A D s0 s1 h ξ lo hi e').1 he'
rw [X_op hD op, X_op hD op']
match life hD s0 s1 h ξ lo hi op, life hD s0 s1 h ξ lo hi op' with
| ⟨b, t, L⟩, ⟨b', t', L'⟩ =>
have o1 := ho.1; have o2 := ho.2; have o1' := ho'.1; have o2' := ho'.2
rw [L.pyl] at o1; rw [L.pyh] at o2; rw [L'.pyl] at o1'; rw [L'.pyh] at o2'
have bt' : b ≤ t' := lo_hi hh (Nat.le_trans L.bt L.tN) L'.tN (F.trans _ _ _ o1 o2')
have b't : b' ≤ t := lo_hi hh (Nat.le_trans L'.bt L'.tN) L.tN (F.trans _ _ _ o1' o2)
have common : ∀ k, b ≤ k → k ≤ t → b' ≤ k → k ≤ t' → ξ e ≠ ξ e' := fun k a1 a2 a3 a4 =>
match L.pres k a1 a2, L'.pres k a3 a4 with
| ⟨p, hp, ep, _⟩, ⟨p', hp', ep', _⟩ => by
rw [← ep, ← ep']
exact inc_ne hg (Nat.le_trans a2 L.tN) hp hp' (fun e2 => hne (by rw [← ep, ← ep', e2]))
exact match Nat.lt_or_ge b b' with
| .inl l => common b' (Nat.le_of_lt l) b't (Nat.le_refl _) L'.bt
| .inr g => common b (Nat.le_refl _) L.bt g bt'
nodes e k he hk ho := by
have op := (seg_col A D s0 s1 h ξ lo hi e).1 he
rw [X_op hD op]
match life hD s0 s1 h ξ lo hi op with
| ⟨b, t, L⟩ =>
have o1 := ho.1; have o2 := ho.2
rw [L.pyl] at o1; rw [L.pyh] at o2
match ncases A D k with
| .inl h1 =>
rw [py_src A D s0 s1 h ξ lo hi h1] at o1
exact absurd o1 (fun l => (s0_le hh (Nat.le_trans L.bt L.tN)).elim (fun l2 => lt_asymm F l l2)
(fun e2 => F.irr _ (by rw [← e2] at l; exact l)))
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
rw [py_box A D s0 s1 h ξ lo hi hl] at o1 o2
have hjN := lget_some_lt D j hl
have bj := lo_box hh (Nat.le_trans L.bt L.tN) o1
have jt := box_hi hh L.tN hjN o2
match L.pres j bj (Nat.le_of_lt jt) with
| ⟨p, hp, ep, ef⟩ =>
rw [← ep, px_box A D s0 s1 h ξ lo hi hl, xr_box hl]
rw [len_in hD hl] at hp
match split3 p l.L.length (S.dom l.g).length with
| .inl h2 => exact .inl (hg.L j l p hl h2)
| .inr (.inl ⟨q, hq, e2⟩) =>
rw [e2, fw_D A D hl hq] at ef
exact absurd ef.symm (L.endk j q jt)
| .inr (.inr ⟨r, e2⟩) =>
rw [e2] at hp ⊢
exact .inr (hg.R j l r hl (lt_R hp))
| .inr (.inr ⟨s, e1⟩) =>
subst e1
rw [py_snk] at o2
exact absurd o2 (fun l => (le_s1 hh L.tN).elim (fun l2 => lt_asymm F l l2) (fun e2 => F.irr _ (by rw [e2] at l; exact l)))
outOrd n p p' y hn hpp hp' _ _ := by
match ncases A D n with
| .inl h1 =>
have : nOut ((col A D s0 s1 h ξ lo hi).kind n) = 1 := by show nOut (ckind A D n) = 1; rw [ckind_src A D h1]; rfl
rw [this] at hp'
exact absurd (Nat.lt_of_lt_of_le hpp (Nat.le_of_lt_succ hp')) (Nat.not_lt_zero _)
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hc : p' < (S.cod l.g).length := by have this : p' < nOut (ckind A D _) := hp'; rw [ckind_box A D hl] at this; exact this
have hjN := lget_some_lt D j hl
have o1 : OP A D (A.length + j, p) := .inr ⟨j, l, hl, rfl, Nat.lt_trans hpp hc⟩
have o2 : OP A D (A.length + j, p') := .inr ⟨j, l, hl, rfl, hc⟩
rw [X_op hD o1, X_op hD o2, ← bw_O A D hl (Nat.lt_trans hpp hc), ← bw_O A D hl hc]
exact hg.inc (j + 1) _ _ (Nat.succ_le_of_lt hjN) (Nat.add_lt_add_left hpp _)
(by rw [len_out hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hc _) (Nat.le_add_right _ _))
| .inr (.inr ⟨s, e1⟩) =>
subst e1
have this : p' < nOut (ckind A D _) := hp'; rw [ckind_snk] at this
exact absurd this (Nat.not_lt_zero _)
inOrd m q q' y hm hqq hq' _ _ := by
match ncases A D m with
| .inl h1 =>
have this : q' < nIn (ckind A D m) := hq'; rw [ckind_src A D h1] at this
exact absurd this (Nat.not_lt_zero _)
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hd : q' < (S.dom l.g).length := by have this : q' < nIn (ckind A D _) := hq'; rw [ckind_box A D hl] at this; exact this
have hjN := lget_some_lt D j hl
have hp1 : l.L.length + q' < (lev A D j).length := by
rw [len_in hD hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hd _) (Nat.le_add_right _ _)
have hp0 : l.L.length + q < (lev A D j).length := Nat.lt_trans (Nat.add_lt_add_left hqq _) hp1
rw [src_box A D s0 s1 h ξ lo hi q hl, src_box A D s0 s1 h ξ lo hi q' hl,
X_col A D s0 s1 h ξ lo hi hD (Nat.le_of_lt hjN) hp0, X_col A D s0 s1 h ξ lo hi hD (Nat.le_of_lt hjN) hp1]
exact hg.inc j _ _ (Nat.le_of_lt hjN) (Nat.add_lt_add_left hqq _) hp1
| .inr (.inr ⟨s, e1⟩) =>
subst e1
have this : q' < nIn (ckind A D _) := hq'; rw [ckind_snk] at this
exact absurd (Nat.lt_of_lt_of_le hqq (Nat.le_of_lt_succ this)) (Nat.not_lt_zero _)
pts k k' hk hk' hne he := by
have xs0 : ∀ n, n < A.length → xr (col A D s0 s1 h ξ lo hi) n = ξ (bw A D 0 n) := fun n h1 => by
unfold xr; rw [px_src A D s0 s1 h ξ lo hi h1, wd_src A D s0 s1 h ξ lo hi h1]; show _ = ξ (n, 0); lib_ring
have xsN : ∀ s, xr (col A D s0 s1 h ξ lo hi) (A.length + D.length + s) = ξ (bw A D D.length s) := fun s => by
unfold xr; rw [px_snk, wd_snk]; lib_ring
have tri : ∀ {x y : F.K}, x ≠ y → F.lt x y ∨ F.lt y x := fun {x y} ne => match F.tri x y with
| .inl l => .inl l
| .inr (.inl e) => absurd e ne
| .inr (.inr l) => .inr l
match ncases A D k, ncases A D k' with
| .inl h1, .inl h2 =>
rw [xs0 k h1, xs0 k' h2, px_src A D s0 s1 h ξ lo hi h1, px_src A D s0 s1 h ξ lo hi h2]
exact tri (inc_ne hg (Nat.zero_le _) h1 h2 hne)
| .inl h1, .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1; rw [py_src A D s0 s1 h ξ lo hi h1, py_box A D s0 s1 h ξ lo hi hl] at he
exact absurd he (lt_ne F (hh.lo j (lget_some_lt D j hl)))
| .inl h1, .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [py_src A D s0 s1 h ξ lo hi h1, py_snk] at he
exact absurd he (lt_ne F hh.s01)
| .inr (.inl ⟨j, l, hl, e1⟩), .inl h2 =>
subst e1; rw [py_src A D s0 s1 h ξ lo hi h2, py_box A D s0 s1 h ξ lo hi hl] at he
exact absurd he.symm (lt_ne F (hh.lo j (lget_some_lt D j hl)))
| .inr (.inl ⟨j, l, hl, e1⟩), .inr (.inl ⟨j', l', hl', e2⟩) =>
subst e1; subst e2
rw [py_box A D s0 s1 h ξ lo hi hl, py_box A D s0 s1 h ξ lo hi hl'] at he
have hjj : j ≠ j' := fun e => hne (by rw [e])
exact absurd he (match Nat.lt_or_ge j j' with
| .inl l2 => lt_ne F (hh.mono j j' l2 (lget_some_lt D j' hl'))
| .inr g => fun e => lt_ne F (hh.mono j' j (Nat.lt_of_le_of_ne g (fun e' => hjj e'.symm)) (lget_some_lt D j hl)) e.symm)
| .inr (.inl ⟨j, l, hl, e1⟩), .inr (.inr ⟨s, e2⟩) =>
subst e1; subst e2; rw [py_box A D s0 s1 h ξ lo hi hl, py_snk] at he
exact absurd he (lt_ne F (hh.hi j (lget_some_lt D j hl)))
| .inr (.inr ⟨s, e1⟩), .inl h2 =>
subst e1; rw [py_src A D s0 s1 h ξ lo hi h2, py_snk] at he
exact absurd he.symm (lt_ne F hh.s01)
| .inr (.inr ⟨s, e1⟩), .inr (.inl ⟨j, l, hl, e2⟩) =>
subst e1; subst e2; rw [py_box A D s0 s1 h ξ lo hi hl, py_snk] at he
exact absurd he.symm (lt_ne F (hh.hi j (lget_some_lt D j hl)))
| .inr (.inr ⟨s, e1⟩), .inr (.inr ⟨s', e2⟩) =>
subst e1; subst e2
rw [xsN, xsN, px_snk, px_snk]
exact tri (inc_ne hg (Nat.le_refl _) (Nat.lt_of_add_lt_add_left hk) (Nat.lt_of_add_lt_add_left hk')
(fun e => hne (by rw [e])))
wd0 k hk := by
match ncases A D k with
| .inl h1 => rw [wd_src A D s0 s1 h ξ lo hi h1]; exact .inr rfl
| .inr (.inl ⟨j, l, hl, e1⟩) => subst e1; rw [wd_box A D s0 s1 h ξ lo hi hl]; exact le_sub0 (hg.lh j l hl)
| .inr (.inr ⟨s, e1⟩) => subst e1; rw [wd_snk]; exact .inr rfl
oxIn n p hn hp := by
match ncases A D n with
| .inl h1 => rw [ox_src A D s0 s1 h ξ lo hi p h1, wd_src A D s0 s1 h ξ lo hi h1]; exact ⟨.inr rfl, .inr rfl⟩
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hc : p < (S.cod l.g).length := by have this : p < nOut (ckind A D _) := hp; rw [ckind_box A D hl] at this; exact this
rw [ox_box A D s0 s1 h ξ lo hi p hl, wd_box A D s0 s1 h ξ lo hi hl]
have ob := hg.outB j l p hl hc
exact ⟨le_sub0 ob.1, le_subs ob.2⟩
| .inr (.inr ⟨s, e1⟩) =>
subst e1
have this : p < nOut (ckind A D _) := hp; rw [ckind_snk] at this
exact absurd this (Nat.not_lt_zero _)
ixIn m q hm hq := by
match ncases A D m with
| .inl h1 =>
have this : q < nIn (ckind A D m) := hq; rw [ckind_src A D h1] at this
exact absurd this (Nat.not_lt_zero _)
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hd : q < (S.dom l.g).length := by have this : q < nIn (ckind A D _) := hq; rw [ckind_box A D hl] at this; exact this
rw [ix_box A D s0 s1 h ξ lo hi q hl, wd_box A D s0 s1 h ξ lo hi hl]
have ib := hg.inB j l q hl hd
exact ⟨le_sub0 ib.1, le_subs ib.2⟩
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [ix_snk, wd_snk]; exact ⟨.inr rfl, .inr rfl⟩
omit hD hg in
theorem generic_col : Generic (col A D s0 s1 h ξ lo hi) := fun j k _ _ hb hne he => by
match ncases A D j with
| .inl h1 =>
have this : IsBox (ckind A D j) := hb; rw [ckind_src A D h1] at this; exact this
| .inr (.inr ⟨s, e1⟩) =>
subst e1; have this : IsBox (ckind A D _) := hb; rw [ckind_snk] at this; exact this
| .inr (.inl ⟨i, l, hl, e1⟩) =>
subst e1
rw [py_box A D s0 s1 h ξ lo hi hl] at he
have hiN := lget_some_lt D i hl
match ncases A D k with
| .inl h2 => rw [py_src A D s0 s1 h ξ lo hi h2] at he; exact lt_ne F (hh.lo i hiN) he.symm
| .inr (.inr ⟨s, e2⟩) => subst e2; rw [py_snk] at he; exact lt_ne F (hh.hi i hiN) he
| .inr (.inl ⟨i', l', hl', e2⟩) =>
subst e2
rw [py_box A D s0 s1 h ξ lo hi hl'] at he
have hii : i ≠ i' := fun e => hne (by rw [e])
exact match Nat.lt_or_ge i i' with
| .inl l2 => lt_ne F (hh.mono i i' l2 (lget_some_lt D i' hl')) he
| .inr g => lt_ne F (hh.mono i' i (Nat.lt_of_le_of_ne g (fun e' => hii e'.symm)) hiN) he.symm
end V
end TP
end Found
#print axioms Found.TP.valid_col
#print axioms Found.TP.generic_col
lean_all/found/Top23.lean
/-
T193 (topological), part 23. found/Top23 — the reading of a valid column
drawing of D is D: the boxes in the order of their heights, and at the box
of layer ⟨L, g, R⟩ the wires on its left are the first |L| wires of its
level (labels L) and those on its right the last |R| (labels R).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top22
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
theorem incr_rng (k : Nat → F.K) : (a n : Nat) → (∀ i i', a ≤ i → i < i' → i' < a + n → F.lt (k i) (k i')) →
Incr F k (rng a n)
| _, 0, _ => trivial
| _, 1, _ => trivial
| a, n + 2, h => ⟨h a (a + 1) (Nat.le_refl _) (Nat.lt_succ_self _) (Nat.add_lt_add_left (Nat.succ_lt_succ (Nat.zero_lt_succ _)) _),
incr_rng k (a + 1) (n + 1) (fun i i' hi hii hi' => h i i' (Nat.le_of_succ_le hi) hii (by
rw [Nat.succ_add] at hi'; exact hi'))⟩
theorem fa2_rng {R : Nat → Ly S → Prop} : (D : List (Ly S)) → (a : Nat) →
(∀ j l, lget D j = some l → R (a + j) l) → Fa2 R (rng a D.length) D
| [], _, _ => .nil
| l :: D, a, h => .cons (h 0 l rfl) (fa2_rng D (a + 1) (fun j l' hl => by
have := h (j + 1) l' hl
rw [← Nat.add_assoc, Nat.add_right_comm] at this; exact this))
section Rd
variable {A B : Ob} {D : List (Ly S)} (hD : DTy D A B) {s0 s1 : F.K} {h : Nat → F.K} (hh : HH D.length s0 s1 h)
{ξ : Nat × Nat → F.K} {lo hi : Nat → F.K} (hg : Good A D ξ lo hi)
include hD hh hg
omit hg in
/-- the wires at a box height are the wires of its level outside its inputs -/
theorem at_box {j : Nat} {l : Ly S} (hl : lget D j = some l) (x : Nat × Nat) :
(Seg (col A D s0 s1 h ξ lo hi) x ∧ Open (col A D s0 s1 h ξ lo hi) x (h j)) ↔
((∃ p, p < l.L.length ∧ bw A D j p = x) ∨ (∃ r, r < l.R.length ∧ bw A D j (l.L.length + (S.dom l.g).length + r) = x)) := by
have hjN := lget_some_lt D j hl
constructor
· intro ⟨hs, ho⟩
have op := (seg_col A D s0 s1 h ξ lo hi x).1 hs
match life hD s0 s1 h ξ lo hi op with
| ⟨b, t, L⟩ =>
have o1 := ho.1; have o2 := ho.2
rw [L.pyl] at o1; rw [L.pyh] at o2
have bj := lo_box hh (Nat.le_trans L.bt L.tN) o1
have jt := box_hi hh L.tN hjN o2
match L.pres j bj (Nat.le_of_lt jt) with
| ⟨p, hp, ep, ef⟩ =>
rw [len_in hD hl] at hp
match split3 p l.L.length (S.dom l.g).length with
| .inl h2 => exact .inl ⟨p, h2, ep⟩
| .inr (.inl ⟨q, hq, e2⟩) =>
rw [e2, fw_D A D hl hq] at ef
exact absurd ef.symm (L.endk j q jt)
| .inr (.inr ⟨r, e2⟩) =>
rw [e2] at hp ep
exact .inr ⟨r, lt_R hp, ep⟩
· intro hx
have pos : ∃ p, p < (lev A D j).length ∧ bw A D j p = x ∧ (p < l.L.length ∨ ∃ r, p = l.L.length + (S.dom l.g).length + r) :=
match hx with
| .inl ⟨p, hp, e⟩ => ⟨p, by rw [len_in hD hl]; exact lt3 hp, e, .inl hp⟩
| .inr ⟨r, hr, e⟩ => ⟨_, by rw [len_in hD hl]; exact Nat.add_lt_add_left hr _, e, .inr ⟨r, rfl⟩⟩
match pos with
| ⟨p, hp, ep, hpos⟩ =>
subst ep
have op := (bw_op hD j (Nat.le_of_lt hjN) p hp)
refine ⟨(seg_col A D s0 s1 h ξ lo hi _).2 op.1, ?_, ?_⟩
· -- the start is below h j
match ncases A D (bw A D j p).1 with
| .inl h1 => rw [py_src A D s0 s1 h ξ lo hi h1]; exact hh.lo j hjN
| .inr (.inl ⟨i, l', hl', e1⟩) =>
rw [e1, py_box A D s0 s1 h ξ lo hi hl']
have := op.2; rw [e1] at this
exact hh.mono i j (Nat.lt_of_add_lt_add_left this) hjN
| .inr (.inr ⟨s, e1⟩) =>
have := op.2; rw [e1, Nat.add_assoc] at this
exact absurd (Nat.lt_of_add_lt_add_left this) (Nat.not_lt_of_le (Nat.le_trans (Nat.le_of_lt hjN) (Nat.le_add_right _ _)))
· -- the end is above h j
show F.lt (h j) ((col A D s0 s1 h ξ lo hi).py (tgtW A D (bw A D j p)).1)
rw [tgtW_bw hD j (Nat.le_of_lt hjN) p hp]
have hnext : ∃ p', p' < (lev A D (j + 1)).length ∧ fw A D j p = fw A D (j + 1) p' :=
match hpos with
| .inl h2 => ⟨p, by rw [len_out hl]; exact lt3 h2, fw_L A D hl h2⟩
| .inr ⟨r, e2⟩ => ⟨l.L.length + (S.cod l.g).length + r, by
rw [len_out hl]; rw [e2, len_in hD hl] at hp; exact Nat.add_lt_add_left (lt_R hp) _, by rw [e2, fw_R A D hl r]⟩
match hnext with
| ⟨p', hp', ef⟩ =>
rw [ef]
match fw_res' hD (Nat.succ_le_of_lt hjN) hp' with
| .inl ⟨j', l', q, hl', hjj, _, ef', _⟩ =>
rw [ef', py_box A D s0 s1 h ξ lo hi hl']
exact hh.mono j j' (Nat.lt_of_succ_le hjj) (lget_some_lt D j' hl')
| .inr ⟨s, _, ef', _⟩ =>
rw [ef', py_snk]; exact hh.hi j hjN
theorem layer_col {j : Nat} {l : Ly S} (hl : lget D j = some l) :
LayerOf (col A D s0 s1 h ξ lo hi) (A.length + j) l := by
have hjN := lget_some_lt D j hl
have hjj := Nat.le_of_lt hjN
have hlen := len_in hD hl
have posL : ∀ p, p < l.L.length → p < (lev A D j).length := fun p hp => by rw [hlen]; exact lt3 hp
have posR : ∀ r, r < l.R.length → l.L.length + (S.dom l.g).length + r < (lev A D j).length := fun r hr => by
rw [hlen]; exact Nat.add_lt_add_left hr _
have Xb : ∀ p, p < (lev A D j).length → X (col A D s0 s1 h ξ lo hi) (bw A D j p) ((col A D s0 s1 h ξ lo hi).py (A.length + j)) =
ξ (bw A D j p) := fun p hp => X_col A D s0 s1 h ξ lo hi hD hjj hp _
have pyj : (col A D s0 s1 h ξ lo hi).py (A.length + j) = h j := py_box A D s0 s1 h ξ lo hi hl
refine ⟨l.g, (rng 0 l.L.length).map (bw A D j), (rng 0 l.R.length).map (fun r => bw A D j (l.L.length + (S.dom l.g).length + r)),
ckind_box A D hl, ⟨?_, fun x => ?_⟩, ?_, ⟨?_, fun x => ?_⟩, ?_, ?_⟩
· exact nd_map_rng _ 0 _ (fun q q' _ h1 _ h2 e => bw_inj hD j hjj q q' (posL q (by rw [Nat.zero_add] at h1; exact h1))
(posL q' (by rw [Nat.zero_add] at h2; exact h2)) e)
· constructor
· intro m
match (mem_mapG _ _).1 m with
| ⟨p, hp, e⟩ =>
have hp' : p < l.L.length := by have := ((mem_rng 0 _ p).1 hp).2; rw [Nat.zero_add] at this; exact this
have so := (at_box hD hh (ξ := ξ) (lo := lo) (hi := hi) hl x).2 (.inl ⟨p, hp', e⟩)
refine ⟨so.1, by rw [pyj]; exact so.2, ?_⟩
rw [pyj, ← e, X_col A D s0 s1 h ξ lo hi hD hjj (posL p hp'), px_box A D s0 s1 h ξ lo hi hl]
exact hg.L j l p hl hp'
· intro ⟨hs, ho, hx⟩
rw [pyj] at ho hx
match (at_box hD hh (ξ := ξ) (lo := lo) (hi := hi) hl x).1 ⟨hs, ho⟩ with
| .inl ⟨p, hp, e⟩ => exact (mem_mapG _ _).2 ⟨p, (mem_rng 0 _ p).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact hp⟩, e⟩
| .inr ⟨r, hr, e⟩ =>
rw [← e, X_col A D s0 s1 h ξ lo hi hD hjj (posR r hr), px_box A D s0 s1 h ξ lo hi hl] at hx
exact absurd (lt_of_le_of_lt F (hg.lh j l hl) (hg.R j l r hl hr)) (lt_asymm F hx)
· apply incr_map
refine incr_eqk _ (fun p m => (Xb p (posL p (by have := ((mem_rng 0 _ p).1 m).2; rw [Nat.zero_add] at this; exact this))).symm) ?_
exact incr_rng _ 0 _ (fun i i' _ hii hi' => hg.inc j i i' hjj hii (posL i' (by rw [Nat.zero_add] at hi'; exact hi')))
· exact nd_map_rng _ 0 _ (fun q q' _ h1 _ h2 e => addLC2 _ (bw_inj hD j hjj _ _ (posR q (by rw [Nat.zero_add] at h1; exact h1))
(posR q' (by rw [Nat.zero_add] at h2; exact h2)) e))
· constructor
· intro m
match (mem_mapG _ _).1 m with
| ⟨r, hr, e⟩ =>
have hr' : r < l.R.length := by have := ((mem_rng 0 _ r).1 hr).2; rw [Nat.zero_add] at this; exact this
have so := (at_box hD hh (ξ := ξ) (lo := lo) (hi := hi) hl x).2 (.inr ⟨r, hr', e⟩)
refine ⟨so.1, by rw [pyj]; exact so.2, ?_⟩
rw [pyj, ← e, X_col A D s0 s1 h ξ lo hi hD hjj (posR r hr'), xr_box hl]
exact hg.R j l r hl hr'
· intro ⟨hs, ho, hx⟩
rw [pyj] at ho hx
match (at_box hD hh (ξ := ξ) (lo := lo) (hi := hi) hl x).1 ⟨hs, ho⟩ with
| .inl ⟨p, hp, e⟩ =>
rw [← e, X_col A D s0 s1 h ξ lo hi hD hjj (posL p hp), xr_box hl] at hx
exact absurd (lt_of_lt_of_le F (hg.L j l p hl hp) (hg.lh j l hl)) (lt_asymm F hx)
| .inr ⟨r, hr, e⟩ => exact (mem_mapG _ _).2 ⟨r, (mem_rng 0 _ r).2 ⟨Nat.zero_le _, by rw [Nat.zero_add]; exact hr⟩, e⟩
· apply incr_map
refine incr_eqk _ (fun r m => (Xb _ (posR r (by have := ((mem_rng 0 _ r).1 m).2; rw [Nat.zero_add] at this; exact this))).symm) ?_
exact incr_rng _ 0 _ (fun i i' _ hii hi' => hg.inc j _ _ hjj (Nat.add_lt_add_left hii _) (posR i' (by rw [Nat.zero_add] at hi'; exact hi')))
· have labL : labs (col A D s0 s1 h ξ lo hi) ((rng 0 l.L.length).map (bw A D j)) = l.L := by
unfold labs
rw [map_map']
rw [map_congr' _ (fun p m => show lab (col A D s0 s1 h ξ lo hi) (bw A D j p) = getD l.L p by
have hp : p < l.L.length := by have := ((mem_rng 0 _ p).1 m).2; rw [Nat.zero_add] at this; exact this
show outLab (ckind A D (bw A D j p).1) (bw A D j p).2 = _
rw [bw_lab hD j hjj p (posL p hp), lev_in hD j hl,
getD_l (l.L ++ S.dom l.g) l.R p (by rw [lenA]; exact Nat.lt_of_lt_of_le hp (Nat.le_add_right _ _)),
getD_l l.L (S.dom l.g) p hp])]
exact getD_rng l.L
have labR : labs (col A D s0 s1 h ξ lo hi) ((rng 0 l.R.length).map (fun r => bw A D j (l.L.length + (S.dom l.g).length + r))) = l.R := by
unfold labs
rw [map_map']
rw [map_congr' _ (fun r m => show lab (col A D s0 s1 h ξ lo hi) (bw A D j (l.L.length + (S.dom l.g).length + r)) = getD l.R r by
have hr : r < l.R.length := by have := ((mem_rng 0 _ r).1 m).2; rw [Nat.zero_add] at this; exact this
show outLab (ckind A D (bw A D j _).1) (bw A D j _).2 = _
rw [bw_lab hD j hjj _ (posR r hr), lev_in hD j hl,
show l.L.length + (S.dom l.g).length = (l.L ++ S.dom l.g).length from (lenA _ _).symm, getD_r])]
exact getD_rng l.R
rw [labL, labR]
/-- a valid column drawing of D reads D -/
theorem reads_col : Reads (col A D s0 s1 h ξ lo hi) D := by
refine ⟨rng A.length D.length, ⟨nd_rng _ _, fun j => ?_⟩, ?_, fa2_rng D A.length (fun j l hl => layer_col hD hh hg hl)⟩
· constructor
· intro m
have hr := (mem_rng _ _ j).1 m
have e := (subD _ _ hr.1).symm
have hjN : j - A.length < D.length := Nat.lt_of_add_lt_add_left (by rw [← e]; exact hr.2)
match lget_lt D _ hjN with
| ⟨l, hl⟩ =>
refine ⟨Nat.lt_of_lt_of_le hr.2 (Nat.le_add_right _ _), ?_⟩
show IsBox (ckind A D j)
rw [e, ckind_box A D hl]; trivial
· intro ⟨hj, hb⟩
match ncases A D j with
| .inl h1 => have hb' : IsBox (ckind A D j) := hb; rw [ckind_src A D h1] at hb'; exact hb'.elim
| .inr (.inr ⟨s, e1⟩) => have hb' : IsBox (ckind A D j) := hb; rw [e1, ckind_snk] at hb'; exact hb'.elim
| .inr (.inl ⟨i, l, hl, e1⟩) =>
rw [e1]
exact (mem_rng _ _ _).2 ⟨Nat.le_add_right _ _, Nat.add_lt_add_left (lget_some_lt D i hl) _⟩
· apply incr_rng
intro i i' hai hii hi'
have e := (subD _ _ hai).symm
have e' := (subD _ _ (Nat.le_trans hai (Nat.le_of_lt hii))).symm
have hN' : i' - A.length < D.length := Nat.lt_of_add_lt_add_left (by rw [← e']; exact hi')
match lget_lt D _ hN', lget_lt D (i - A.length) (Nat.lt_trans (Nat.lt_of_add_lt_add_left (by rw [← e, ← e']; exact hii)) hN') with
| ⟨l', hl'⟩, ⟨l, hl⟩ =>
rw [e, e', py_box A D s0 s1 h ξ lo hi hl, py_box A D s0 s1 h ξ lo hi hl']
exact hh.mono _ _ (Nat.lt_of_add_lt_add_left (by rw [← e, ← e']; exact hii)) hN'
end Rd
end TP
end Found
#print axioms Found.TP.incr_rng
#print axioms Found.TP.fa2_rng
#print axioms Found.TP.at_box
#print axioms Found.TP.layer_col
#print axioms Found.TP.reads_col
lean_all/found/Top24.lean
/-
T193 (topological), part 24. found/Top24 — midpoints and the one-layer
step of the canonical x-data: given strictly increasing x-values f in
(0, 1) on the positions of a level a + d + r (wires left of a box, its
inputs, wires right of it), the next level a + c + r keeps the left and
right values and places the c outputs by repeated midpoints between
b (the last input, or the last left wire / a given value when there are
no inputs) and the first right wire (or 1). The box bar runs from the
first input (or the first midpoint) to the last output (or the last
input). Everything stays strictly increasing in (0, 1), and the bar lies
strictly between the left and right wires and contains the ports.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top23
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF}
def two (F : OF) : F.K := F.R.add F.R.one F.R.one
theorem two_pos : F.lt F.R.zero (two F) := add_pos F F.zero_lt_one F.zero_lt_one
def mid (a b : F.K) : F.K := F.R.mul (F.R.add a b) (F.inv (two F))
theorem half_l (a b I : F.K) (h : F.R.mul (two F) I = F.R.one) :
sub F.R (F.R.mul (F.R.add a b) I) a = F.R.mul (sub F.R b a) I :=
calc sub F.R (F.R.mul (F.R.add a b) I) a = sub F.R (F.R.mul (F.R.add a b) I) (F.R.mul a (F.R.mul (two F) I)) := by
rw [h]; lib_ring
_ = F.R.mul (sub F.R b a) I := by unfold two; lib_ring
theorem half_r (a b I : F.K) (h : F.R.mul (two F) I = F.R.one) :
sub F.R b (F.R.mul (F.R.add a b) I) = F.R.mul (sub F.R b a) I :=
calc sub F.R b (F.R.mul (F.R.add a b) I) = sub F.R (F.R.mul b (F.R.mul (two F) I)) (F.R.mul (F.R.add a b) I) := by
rw [h]; lib_ring
_ = F.R.mul (sub F.R b a) I := by unfold two; lib_ring
theorem mid_in {a b : F.K} (h : F.lt a b) : F.lt a (mid a b) ∧ F.lt (mid a b) b := by
have hi : F.R.mul (two F) (F.inv (two F)) = F.R.one := F.mul_inv _ (fun e => lt_ne F two_pos e.symm)
have ip := inv_pos F two_pos
have d := sub_pos F h
exact ⟨pos_sub F (by unfold mid; rw [half_l a b _ hi]; exact F.mul_pos _ _ d ip),
pos_sub F (by unfold mid; rw [half_r a b _ hi]; exact F.mul_pos _ _ d ip)⟩
/-- repeated midpoints from x towards y -/
def chain (x y : F.K) : Nat → F.K
| 0 => mid x y
| q + 1 => mid (chain x y q) y
theorem chain_in {x y : F.K} (h : F.lt x y) : (q : Nat) → F.lt x (chain x y q) ∧ F.lt (chain x y q) y
| 0 => mid_in h
| q + 1 => have ih := chain_in h q
⟨F.trans _ _ _ ih.1 (mid_in ih.2).1, (mid_in ih.2).2⟩
theorem chain_step {x y : F.K} (h : F.lt x y) (q : Nat) : F.lt (chain x y q) (chain x y (q + 1)) :=
(mid_in (chain_in h q).2).1
theorem chain_mono {x y : F.K} (h : F.lt x y) : (q q' : Nat) → q < q' → F.lt (chain x y q) (chain x y q')
| _, 0, h' => absurd h' (Nat.not_lt_zero _)
| q, q' + 1, h' => match Nat.lt_or_ge q q' with
| .inl l => F.trans _ _ _ (chain_mono h q q' l) (chain_step h q')
| .inr g => by rw [Nat.le_antisymm (Nat.le_of_lt_succ h') g]; exact chain_step h q'
theorem chain_le {x y : F.K} (h : F.lt x y) {q q' : Nat} (hq : q ≤ q') : le F (chain x y q) (chain x y q') :=
match Nat.lt_or_ge q q' with
| .inl l => .inl (chain_mono h q q' l)
| .inr g => .inr (by rw [Nat.le_antisymm hq g])
/-! ## the one-layer step -/
def lvF (f : Nat → F.K) : Nat → F.K
| 0 => F.R.zero
| a + 1 => f a
def rvF (f : Nat → F.K) (a d : Nat) : Nat → F.K
| 0 => F.R.one
| _ + 1 => f (a + d)
def bvF (f : Nat → F.K) (o : Option F.K) (a : Nat) : Nat → F.K
| 0 => match o with
| some v => v
| none => lvF f a
| d + 1 => f (a + d)
def loB (f : Nat → F.K) (o : Option F.K) (a d r : Nat) : F.K :=
match d with
| 0 => mid (bvF f o a 0) (rvF f a 0 r)
| _ + 1 => f a
def hiB (f : Nat → F.K) (o : Option F.K) (a d c r : Nat) : F.K :=
match c with
| 0 => match d with
| 0 => mid (bvF f o a 0) (rvF f a 0 r)
| _ + 1 => bvF f o a d
| c + 1 => chain (bvF f o a d) (rvF f a d r) c
def nextF (f : Nat → F.K) (o : Option F.K) (a d c r : Nat) (p : Nat) : F.K :=
match Nat.decLt p a with
| isTrue _ => f p
| isFalse _ => match Nat.decLt p (a + c) with
| isTrue _ => chain (bvF f o a d) (rvF f a d r) (p - a)
| isFalse _ => f (p - (a + c) + (a + d))
/-- strictly increasing in (0, 1) on the first n positions -/
structure Inc (f : Nat → F.K) (n : Nat) : Prop where
mono : ∀ p p', p < p' → p' < n → F.lt (f p) (f p')
pos : ∀ p, p < n → F.lt F.R.zero (f p)
lt1 : ∀ p, p < n → F.lt (f p) F.R.one
/-- the condition on a given value for a box without inputs -/
def OvOK (f : Nat → F.K) (o : Option F.K) (a d r : Nat) : Prop :=
d = 0 → ∀ v, o = some v → le F (lvF f a) v ∧ F.lt v (rvF f a d r)
section S
variable {f : Nat → F.K} {o : Option F.K} {a d c r : Nat} (hf : Inc f (a + d + r)) (ho : OvOK f o a d r)
include hf
omit hf in
theorem nextF_L {p : Nat} (hp : p < a) : nextF f o a d c r p = f p := by
unfold nextF
match Nat.decLt p a with
| isTrue _ => rfl
| isFalse h => exact absurd hp h
omit hf in
theorem nextF_O {q : Nat} (hq : q < c) : nextF f o a d c r (a + q) = chain (bvF f o a d) (rvF f a d r) q := by
unfold nextF
match Nat.decLt (a + q) a with
| isTrue h => exact absurd h (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ =>
match Nat.decLt (a + q) (a + c) with
| isTrue _ => show chain _ _ (a + q - a) = _; rw [asub]
| isFalse h => exact absurd (Nat.add_lt_add_left hq _) h
omit hf in
theorem nextF_R (r' : Nat) : nextF f o a d c r (a + c + r') = f (a + d + r') := by
unfold nextF
match Nat.decLt (a + c + r') a with
| isTrue h => exact absurd h nlt3
| isFalse _ =>
match Nat.decLt (a + c + r') (a + c) with
| isTrue h => exact absurd h (Nat.not_lt_of_le (Nat.le_add_right _ _))
| isFalse _ => show f (a + c + r' - (a + c) + (a + d)) = _; rw [asub, Nat.add_comm r']
theorem le_of_mono {p p' : Nat} (hpp : p ≤ p') (hp' : p' < a + d + r) : le F (f p) (f p') :=
match Nat.lt_or_ge p p' with
| .inl l => .inl (hf.mono p p' l hp')
| .inr g => .inr (by rw [Nat.le_antisymm hpp g])
/-- the left wires are at most lv -/
theorem lv_ge {p : Nat} (hp : p < a) : le F (f p) (lvF f a) :=
match a, hp, hf with
| a + 1, hp, hf => le_of_mono hf (Nat.le_of_lt_succ hp) (lt3 (Nat.lt_succ_self a))
theorem lv_nn : le F F.R.zero (lvF f a) :=
match a, hf with
| 0, _ => .inr rfl
| a + 1, hf => .inl (hf.pos a (lt3 (Nat.lt_succ_self a)))
/-- the right wires are at least rv -/
theorem rv_le {r' : Nat} (hr : r' < r) : le F (rvF f a d r) (f (a + d + r')) :=
match r, hr, hf with
| _ + 1, _, hf => le_of_mono hf (Nat.le_add_right _ _) (Nat.add_lt_add_left ‹_› _)
theorem rv_le1 : le F (rvF f a d r) F.R.one :=
match r, hf with
| 0, _ => .inr rfl
| _ + 1, hf => .inl (hf.lt1 _ (Nat.add_lt_add_left (Nat.zero_lt_succ _) _))
/-- the inputs are at most bv -/
theorem bv_ge {q : Nat} (hq : q < d) : le F (f (a + q)) (bvF f o a d) :=
match d, hq, hf with
| d + 1, hq, hf => le_of_mono hf (Nat.add_le_add_left (Nat.le_of_lt_succ hq) _)
(Nat.lt_of_lt_of_le (Nat.add_lt_add_left (Nat.lt_succ_self d) _) (Nat.le_add_right _ _))
include ho
theorem lv_le_bv : le F (lvF f a) (bvF f o a d) :=
match d, ho, hf with
| 0, ho, _ => match o, ho with
| some v, ho => (ho rfl v rfl).1
| none, _ => .inr rfl
| d + 1, _, hf => match a, hf with
| 0, hf => .inl (hf.pos _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.le_add_right _ _)))
| a + 1, hf => .inl (hf.mono _ _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self a) (Nat.le_add_right _ _))
(Nat.lt_of_lt_of_le (Nat.add_lt_add_left (Nat.lt_succ_self d) _) (Nat.le_add_right _ _)))
theorem bv_lt_rv : F.lt (bvF f o a d) (rvF f a d r) :=
match d, ho, hf with
| 0, ho, hf => match o, ho with
| some v, ho => (ho rfl v rfl).2
| none, _ => match a, r, hf with
| 0, 0, _ => F.zero_lt_one
| 0, _ + 1, hf => hf.pos _ (Nat.add_lt_add_left (Nat.zero_lt_succ _) _)
| _ + 1, 0, hf => hf.lt1 _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.le_add_right _ _))
| a + 1, _ + 1, hf => hf.mono _ _ (Nat.lt_succ_self a) (Nat.add_lt_add_left (Nat.zero_lt_succ _) _)
| d + 1, _, hf => match r, hf with
| 0, hf => hf.lt1 _ (by rw [Nat.add_zero]; exact Nat.add_lt_add_left (Nat.lt_succ_self d) _)
| _ + 1, hf => hf.mono _ _ (Nat.add_lt_add_left (Nat.lt_succ_self d) _) (Nat.add_lt_add_left (Nat.zero_lt_succ _) _)
theorem bv_nn : le F F.R.zero (bvF f o a d) := le_trans' (lv_nn hf) (lv_le_bv hf ho)
/-- the next level is again strictly increasing in (0, 1) -/
theorem next_inc : Inc (nextF f o a d c r) (a + c + r) := by
have blt := bv_lt_rv hf ho
have ch := chain_in blt
have lvb := lv_le_bv hf ho
have r1 := rv_le1 hf
have b0 := bv_nn hf ho
have val : ∀ p, p < a + c + r → (p < a ∧ nextF f o a d c r p = f p) ∨
(∃ q, q < c ∧ p = a + q ∧ nextF f o a d c r p = chain (bvF f o a d) (rvF f a d r) q) ∨
(∃ r', r' < r ∧ p = a + c + r' ∧ nextF f o a d c r p = f (a + d + r')) := fun p hp =>
match split3 p a c with
| .inl h => .inl ⟨h, nextF_L h⟩
| .inr (.inl ⟨q, hq, e⟩) => .inr (.inl ⟨q, hq, e, by rw [e]; exact nextF_O hq⟩)
| .inr (.inr ⟨r', e⟩) => .inr (.inr ⟨r', lt_R (by rw [← e]; exact hp), e, by rw [e]; exact nextF_R r'⟩)
refine ⟨fun p p' hpp hp' => ?_, fun p hp => ?_, fun p hp => ?_⟩
· match val p (Nat.lt_trans hpp hp'), val p' hp' with
| .inl ⟨h1, e1⟩, .inl ⟨h2, e2⟩ => rw [e1, e2]; exact hf.mono p p' hpp (lt3 h2)
| .inl ⟨h1, e1⟩, .inr (.inl ⟨q, _, _, e2⟩) =>
rw [e1, e2]; exact lt_of_le_of_lt F (le_trans' (lv_ge hf h1) lvb) (ch q).1
| .inl ⟨h1, e1⟩, .inr (.inr ⟨r', hr, _, e2⟩) =>
rw [e1, e2]; exact hf.mono _ _ (Nat.lt_of_lt_of_le h1 (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)))
(Nat.add_lt_add_left hr _)
| .inr (.inl ⟨q, _, e, _⟩), .inl ⟨h2, _⟩ =>
rw [e] at hpp; exact absurd (Nat.lt_trans (Nat.lt_of_le_of_lt (Nat.le_add_right _ _) hpp) h2) (Nat.lt_irrefl _)
| .inr (.inl ⟨q, _, e1, f1⟩), .inr (.inl ⟨q', _, e2, f2⟩) =>
rw [f1, f2]; rw [e1, e2] at hpp; exact chain_mono blt q q' (Nat.lt_of_add_lt_add_left hpp)
| .inr (.inl ⟨q, _, _, f1⟩), .inr (.inr ⟨r', hr, _, f2⟩) =>
rw [f1, f2]; exact lt_of_lt_of_le F (ch q).2 (rv_le hf hr)
| .inr (.inr ⟨r', _, e, _⟩), .inl ⟨h2, _⟩ =>
rw [e] at hpp; exact absurd (Nat.lt_trans (Nat.lt_of_le_of_lt (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)) hpp) h2) (Nat.lt_irrefl _)
| .inr (.inr ⟨r', _, e, _⟩), .inr (.inl ⟨q, hq, e2, _⟩) =>
rw [e, e2] at hpp
exact absurd (Nat.lt_of_le_of_lt (Nat.le_add_right _ _) (Nat.lt_of_lt_of_le hpp (Nat.le_of_lt (Nat.add_lt_add_left hq _)))) (Nat.lt_irrefl _)
| .inr (.inr ⟨r', _, e1, f1⟩), .inr (.inr ⟨r'', hr'', e2, f2⟩) =>
rw [f1, f2]; rw [e1, e2] at hpp; exact hf.mono _ _ (Nat.add_lt_add_left (Nat.lt_of_add_lt_add_left hpp) _) (Nat.add_lt_add_left hr'' _)
· match val p hp with
| .inl ⟨h1, e1⟩ => rw [e1]; exact hf.pos p (lt3 h1)
| .inr (.inl ⟨q, _, _, e1⟩) => rw [e1]; exact lt_of_le_of_lt F b0 (ch q).1
| .inr (.inr ⟨r', hr, _, e1⟩) => rw [e1]; exact hf.pos _ (Nat.add_lt_add_left hr _)
· match val p hp with
| .inl ⟨h1, e1⟩ => rw [e1]; exact hf.lt1 p (lt3 h1)
| .inr (.inl ⟨q, _, _, e1⟩) => rw [e1]; exact lt_of_lt_of_le F (ch q).2 r1
| .inr (.inr ⟨r', hr, _, e1⟩) => rw [e1]; exact hf.lt1 _ (Nat.add_lt_add_left hr _)
/-! ## the bar -/
theorem bar_L {p : Nat} (hp : p < a) : F.lt (f p) (loB f o a d r) := by
have blt := bv_lt_rv hf ho
unfold loB
match d, hf, blt with
| 0, hf, blt => exact lt_of_le_of_lt F (le_trans' (lv_ge hf hp) (lv_le_bv hf ho)) (mid_in blt).1
| _ + 1, hf, _ => exact hf.mono _ _ hp (Nat.lt_of_lt_of_le (Nat.lt_add_of_pos_right (Nat.succ_pos _)) (Nat.le_add_right _ _))
theorem bar_R {r' : Nat} (hr : r' < r) : F.lt (hiB f o a d c r) (f (a + d + r')) := by
have blt := bv_lt_rv hf ho
have rl := rv_le hf hr
unfold hiB
match c with
| 0 => match d, hf, blt, rl with
| 0, _, blt, rl => exact lt_of_lt_of_le F (mid_in blt).2 rl
| _ + 1, _, blt, rl => exact lt_of_lt_of_le F blt rl
| c + 1 => exact lt_of_lt_of_le F (chain_in blt c).2 rl
theorem bar_in {q : Nat} (hq : q < d) : le F (loB f o a d r) (f (a + q)) ∧ le F (f (a + q)) (hiB f o a d c r) := by
have blt := bv_lt_rv hf ho
have bg := bv_ge (o := o) hf hq
refine ⟨?_, ?_⟩
· unfold loB
match d, hq, hf with
| _ + 1, hq, hf =>
show le F (f a) (f (a + q))
exact le_of_mono hf (Nat.le_add_right _ _) (Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _))
· unfold hiB
match c with
| 0 => match d, hq, bg with
| _ + 1, _, bg => exact bg
| c + 1 => exact le_trans' bg (.inl (chain_in blt c).1)
theorem bar_out {q : Nat} (hq : q < c) :
le F (loB f o a d r) (chain (bvF f o a d) (rvF f a d r) q) ∧ le F (chain (bvF f o a d) (rvF f a d r) q) (hiB f o a d c r) := by
have blt := bv_lt_rv hf ho
refine ⟨?_, ?_⟩
· unfold loB
match d, hf, blt with
| 0, _, blt => exact chain_le blt (Nat.zero_le q)
| _ + 1, hf, blt =>
exact .inl (lt_of_le_of_lt F (bv_ge (o := o) hf (Nat.zero_lt_succ _) |> fun h => by rw [Nat.add_zero] at h; exact h) (chain_in blt q).1)
· unfold hiB
match c, hq with
| c + 1, hq => exact chain_le blt (Nat.le_of_lt_succ hq)
theorem bar_lh : le F (loB f o a d r) (hiB f o a d c r) := by
have blt := bv_lt_rv hf ho
unfold loB hiB
match d, c, hf, blt with
| 0, 0, _, _ => exact .inr rfl
| 0, c + 1, _, blt => exact chain_le blt (Nat.zero_le c)
| d + 1, 0, hf, _ =>
have := bv_ge (o := o) hf (Nat.zero_lt_succ d); rw [Nat.add_zero] at this; exact this
| d + 1, c + 1, hf, blt =>
have := bv_ge (o := o) hf (Nat.zero_lt_succ d); rw [Nat.add_zero] at this
exact le_trans' this (.inl (chain_in blt c).1)
end S
end TP
end Found
#print axioms Found.TP.mid_in
#print axioms Found.TP.chain_mono
#print axioms Found.TP.next_inc
#print axioms Found.TP.bar_L
#print axioms Found.TP.bar_R
#print axioms Found.TP.bar_in
#print axioms Found.TP.bar_out
#print axioms Found.TP.bar_lh
lean_all/found/Top25.lean
/-
T193 (topological), part 25. found/Top25 — the canonical x-data of a
typed layer list (level 0 at repeated midpoints of (0, 1), then level by
level by the one-layer step, with an optional given value for boxes
without inputs): the x of the wire at a position of a level is the value
of that level there, and the data are good for D.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top24
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- the x-values of the levels -/
def xv (A : Ob) (D : List (Ly S)) (ov : Nat → Option F.K) : Nat → Nat → F.K
| 0 => chain F.R.zero F.R.one
| k + 1 => match lget D k with
| none => xv A D ov k
| some l => nextF (xv A D ov k) (ov k) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length
/-- the wire x-values, and the bars -/
def xic (A : Ob) (D : List (Ly S)) (ov : Nat → Option F.K) (e : Nat × Nat) : F.K :=
ncase A D e.1 (fun n => xv A D ov 0 n)
(fun j l => chain (bvF (xv A D ov j) (ov j) l.L.length (S.dom l.g).length)
(rvF (xv A D ov j) l.L.length (S.dom l.g).length l.R.length) e.2) (fun _ => F.R.zero)
def loc (A : Ob) (D : List (Ly S)) (ov : Nat → Option F.K) (j : Nat) : F.K :=
match lget D j with
| some l => loB (xv A D ov j) (ov j) l.L.length (S.dom l.g).length l.R.length
| none => F.R.zero
def hic (A : Ob) (D : List (Ly S)) (ov : Nat → Option F.K) (j : Nat) : F.K :=
match lget D j with
| some l => hiB (xv A D ov j) (ov j) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length
| none => F.R.zero
section X
variable (A : Ob) (D : List (Ly S)) (ov : Nat → Option F.K)
theorem xv_some {k : Nat} {l : Ly S} (hl : lget D k = some l) :
xv A D ov (k + 1) = nextF (xv A D ov k) (ov k) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length := by
show (match lget D k with
| none => xv A D ov k
| some l => nextF (xv A D ov k) (ov k) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length) = _
rw [hl]
theorem loc_some {j : Nat} {l : Ly S} (hl : lget D j = some l) :
loc A D ov j = loB (xv A D ov j) (ov j) l.L.length (S.dom l.g).length l.R.length := by
unfold loc; rw [hl]
theorem hic_some {j : Nat} {l : Ly S} (hl : lget D j = some l) :
hic A D ov j = hiB (xv A D ov j) (ov j) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length := by
unfold hic; rw [hl]
theorem xic_box {j : Nat} {l : Ly S} (hl : lget D j = some l) (q : Nat) :
xic A D ov (A.length + j, q) = chain (bvF (xv A D ov j) (ov j) l.L.length (S.dom l.g).length)
(rvF (xv A D ov j) l.L.length (S.dom l.g).length l.R.length) q :=
nc_box A D (fun n => xv A D ov 0 n)
(fun j l => chain (bvF (xv A D ov j) (ov j) l.L.length (S.dom l.g).length)
(rvF (xv A D ov j) l.L.length (S.dom l.g).length l.R.length) q) (fun _ => F.R.zero) hl
variable {A D} {B : Ob} (hD : DTy D A B)
include hD
/-- the x of the wire at a position is the level value there -/
theorem xic_bw : (k : Nat) → k ≤ D.length → (p : Nat) → p < (lev A D k).length → xic A D ov (bw A D k p) = xv A D ov k p
| 0, _, p, hp => nc_src A D (fun n => xv A D ov 0 n) _ (fun _ => F.R.zero) hp
| k + 1, hk, p, hp =>
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [len_out hl] at hp
rw [xv_some A D ov hl]
have kk := Nat.le_of_lt hk
match split3 p l.L.length (S.cod l.g).length with
| .inl h =>
rw [bw_L A D hl h, nextF_L h, xic_bw k kk p (by rw [len_in hD hl]; exact lt3 h)]
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e, bw_O A D hl hq, nextF_O hq, xic_box A D ov hl]
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
rw [bw_R A D hl r, nextF_R r, xic_bw k kk _ (by rw [len_in hD hl]; exact Nat.add_lt_add_left (lt_R hp) _)]
/-- the given values are admissible -/
def OvAll (A : Ob) (D : List (Ly S)) (ov : Nat → Option F.K) : Prop :=
∀ k l, lget D k = some l → OvOK (xv A D ov k) (ov k) l.L.length (S.dom l.g).length l.R.length
theorem xv_inc (hov : OvAll A D ov) : (k : Nat) → k ≤ D.length → Inc (xv A D ov k) (lev A D k).length
| 0, _ => ⟨fun p p' hpp _ => chain_mono F.zero_lt_one p p' hpp,
fun p _ => (chain_in F.zero_lt_one p).1, fun p _ => (chain_in F.zero_lt_one p).2⟩
| k + 1, hk =>
match lget_lt D k hk with
| ⟨l, hl⟩ => by
rw [xv_some A D ov hl, len_out hl]
have ih := xv_inc hov k (Nat.le_of_lt hk)
rw [len_in hD hl] at ih
exact next_inc ih (hov k l hl)
/-- the canonical data are good -/
theorem good_c (hov : OvAll A D ov) : Good A D (xic A D ov) (loc A D ov) (hic A D ov) where
inc k p p' hk hpp hp' := by
rw [xic_bw ov hD k hk p (Nat.lt_trans hpp hp'), xic_bw ov hD k hk p' hp']
exact (xv_inc ov hD hov k hk).mono p p' hpp hp'
L j l p hl hp := by
have hjN := Nat.le_of_lt (lget_some_lt D j hl)
have ih := xv_inc ov hD hov j hjN
rw [len_in hD hl] at ih
rw [xic_bw ov hD j hjN p (by rw [len_in hD hl]; exact lt3 hp), loc_some A D ov hl]
exact bar_L ih (hov j l hl) hp
R j l r hl hr := by
have hjN := Nat.le_of_lt (lget_some_lt D j hl)
have ih := xv_inc ov hD hov j hjN
rw [len_in hD hl] at ih
rw [xic_bw ov hD j hjN _ (by rw [len_in hD hl]; exact Nat.add_lt_add_left hr _), hic_some A D ov hl]
exact bar_R ih (hov j l hl) hr
inB j l q hl hq := by
have hjN := Nat.le_of_lt (lget_some_lt D j hl)
have ih := xv_inc ov hD hov j hjN
rw [len_in hD hl] at ih
rw [xic_bw ov hD j hjN _ (by rw [len_in hD hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _)),
loc_some A D ov hl, hic_some A D ov hl]
exact bar_in ih (hov j l hl) hq
outB j l q hl hq := by
have hjN := Nat.le_of_lt (lget_some_lt D j hl)
have ih := xv_inc ov hD hov j hjN
rw [len_in hD hl] at ih
rw [xic_box A D ov hl, loc_some A D ov hl, hic_some A D ov hl]
exact bar_out ih (hov j l hl) hq
lh j l hl := by
have hjN := Nat.le_of_lt (lget_some_lt D j hl)
have ih := xv_inc ov hD hov j hjN
rw [len_in hD hl] at ih
rw [loc_some A D ov hl, hic_some A D ov hl]
exact bar_lh ih (hov j l hl)
omit hD in
theorem ov_none : OvAll A D (fun _ => (none : Option F.K)) := fun _ _ _ _ _ e => by cases e
end X
end TP
end Found
#print axioms Found.TP.xic_bw
#print axioms Found.TP.xv_inc
#print axioms Found.TP.good_c
#print axioms Found.TP.ov_none
lean_all/found/Top26.lean
/-
T193 (topological), part 26. found/Top26 — the standard column drawing
real A D (heights 0 < 1 < … < N + 1 for sources, boxes, sinks; canonical
x-data), and horizontal motions between column drawings: two column
drawings of D with the same heights and good x-data are joined by the
straight horizontal motion (every intermediate drawing is the column
drawing of the interpolated data, which are again good).
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top25
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## heights -/
def natF (F : OF) : Nat → F.K
| 0 => F.R.zero
| n + 1 => F.R.add (natF F n) F.R.one
theorem natF_step (n : Nat) : F.lt (natF F n) (natF F (n + 1)) := by
have := F.add_lt _ _ (natF F n) F.zero_lt_one
rw [show F.R.add F.R.zero (natF F n) = natF F n by lib_ring, F.R.add_comm] at this
exact this
theorem natF_lt : (i j : Nat) → i < j → F.lt (natF F i) (natF F j)
| _, 0, h => absurd h (Nat.not_lt_zero _)
| i, j + 1, h => match Nat.lt_or_ge i j with
| .inl l => F.trans _ _ _ (natF_lt i j l) (natF_step j)
| .inr g => by rw [Nat.le_antisymm (Nat.le_of_lt_succ h) g]; exact natF_step j
/-- the standard heights -/
theorem hh_std (N : Nat) : HH N (natF F 0) (natF F (N + 1)) (fun j => natF F (j + 1)) :=
⟨natF_lt _ _ (Nat.zero_lt_succ _), fun _ _ => natF_lt _ _ (Nat.zero_lt_succ _),
fun _ hj => natF_lt _ _ (Nat.succ_lt_succ hj), fun _ _ hij _ => natF_lt _ _ (Nat.succ_lt_succ hij)⟩
/-- the standard column drawing of D -/
def real (F : OF) (A : Ob) (D : List (Ly S)) : Drw F S :=
col A D (natF F 0) (natF F (D.length + 1)) (fun j => natF F (j + 1))
(xic A D (fun _ => none)) (loc A D (fun _ => none)) (hic A D (fun _ => none))
theorem real_ok {A B : Ob} {D : List (Ly S)} (hD : DTy D A B) :
Valid (real F A D) ∧ Generic (real F A D) ∧ Reads (real F A D) D :=
⟨valid_col hD (hh_std D.length) (good_c _ hD ov_none), generic_col (hh_std D.length),
reads_col hD (hh_std D.length) (good_c _ hD ov_none)⟩
/-! ## interpolating x-data -/
theorem le_of_sub0 {x y : F.K} (h : le F F.R.zero (sub F.R y x)) : le F x y :=
h.elim (fun l => .inl (pos_sub F l)) (fun e => .inr (by
calc x = F.R.add x F.R.zero := by lib_ring
_ = F.R.add x (sub F.R y x) := by rw [e]
_ = y := by lib_ring))
theorem add_nn {x y : F.K} (hx : le F F.R.zero x) (hy : le F F.R.zero y) : le F F.R.zero (F.R.add x y) :=
hx.elim (fun l => .inl (add_nn_pos F hy l |> fun h => by rw [F.R.add_comm]; exact h))
(fun e => by rw [← e, show F.R.add F.R.zero y = y by lib_ring]; exact hy)
theorem lin_le {a b c d t : F.K} (h1 : le F a c) (h2 : le F b d) (ht : In01 F t) : le F (lin F a b t) (lin F c d t) := by
apply le_of_sub0
have e : sub F.R (lin F c d t) (lin F a b t) =
F.R.add (F.R.mul (sub F.R F.R.one t) (sub F.R c a)) (F.R.mul t (sub F.R d b)) := by unfold lin; lib_ring
rw [e]
exact add_nn (mul_nn F (le_sub0 ht.2) (le_sub0 h1)) (mul_nn F ht.1 (le_sub0 h2))
theorem lin_lt_le {a b c d t : F.K} (h1 : F.lt a c) (h2 : F.lt b d) (ht : In01 F t) : F.lt (lin F a b t) (lin F c d t) :=
lin_lt F h1 h2 ht
section G
variable {A : Ob} {D : List (Ly S)} {ξ0 ξ1 : Nat × Nat → F.K} {lo0 lo1 hi0 hi1 : Nat → F.K}
theorem good_lin (g0 : Good A D ξ0 lo0 hi0) (g1 : Good A D ξ1 lo1 hi1) {t : F.K} (ht : In01 F t) :
Good A D (fun e => lin F (ξ0 e) (ξ1 e) t) (fun j => lin F (lo0 j) (lo1 j) t) (fun j => lin F (hi0 j) (hi1 j) t) where
inc k p p' hk hpp hp' := lin_lt F (g0.inc k p p' hk hpp hp') (g1.inc k p p' hk hpp hp') ht
L j l p hl hp := lin_lt F (g0.L j l p hl hp) (g1.L j l p hl hp) ht
R j l r hl hr := lin_lt F (g0.R j l r hl hr) (g1.R j l r hl hr) ht
inB j l q hl hq := ⟨lin_le (g0.inB j l q hl hq).1 (g1.inB j l q hl hq).1 ht,
lin_le (g0.inB j l q hl hq).2 (g1.inB j l q hl hq).2 ht⟩
outB j l q hl hq := ⟨lin_le (g0.outB j l q hl hq).1 (g1.outB j l q hl hq).1 ht,
lin_le (g0.outB j l q hl hq).2 (g1.outB j l q hl hq).2 ht⟩
lh j l hl := lin_le (g0.lh j l hl) (g1.lh j l hl) ht
end G
theorem ncase_lin (A : Ob) (D : List (Ly S)) (n : Nat) (t : F.K)
(fs0 fs1 : Nat → F.K) (fb0 fb1 : Nat → Ly S → F.K) (fk0 fk1 : Nat → F.K) :
lin F (ncase A D n fs0 fb0 fk0) (ncase A D n fs1 fb1 fk1) t =
ncase A D n (fun n => lin F (fs0 n) (fs1 n) t) (fun j l => lin F (fb0 j l) (fb1 j l) t) (fun s => lin F (fk0 s) (fk1 s) t) := by
unfold ncase
match Nat.decLt n A.length with
| isTrue _ => rfl
| isFalse _ =>
match lget D (n - A.length) with
| some _ => rfl
| none => rfl
theorem ncase_congr {α : Type} (A : Ob) (D : List (Ly S)) (n : Nat) {fs gs : Nat → α} {fb gb : Nat → Ly S → α} {fk gk : Nat → α}
(hs : ∀ n, fs n = gs n) (hb : ∀ j l, fb j l = gb j l) (hk : ∀ s, fk s = gk s) :
ncase A D n fs fb fk = ncase A D n gs gb gk := by
unfold ncase
match Nat.decLt n A.length with
| isTrue _ => exact hs n
| isFalse _ =>
match lget D (n - A.length) with
| some l => exact hb _ l
| none => exact hk _
section M
variable (A : Ob) (D : List (Ly S)) (s0 s1 : F.K) (h : Nat → F.K) (ξ0 ξ1 : Nat × Nat → F.K) (lo0 lo1 hi0 hi1 : Nat → F.K) (t : F.K)
theorem ix_src {ξ : Nat × Nat → F.K} {lo hi : Nat → F.K} {n : Nat} (q : Nat) (h1 : n < A.length) :
(col A D s0 s1 h ξ lo hi).ix n q = F.R.zero :=
nc_src A D (fun _ => F.R.zero) (fun j l => sub F.R (ξ (bw A D j (l.L.length + q))) (lo j)) (fun _ => F.R.zero) h1
theorem ox_snk {ξ : Nat × Nat → F.K} {lo hi : Nat → F.K} (s p : Nat) :
(col A D s0 s1 h ξ lo hi).ox (A.length + D.length + s) p = F.R.zero :=
nc_snk A D (fun _ => F.R.zero) (fun j' _ => sub F.R (ξ (A.length + D.length + s, p)) (lo j')) (fun _ => F.R.zero) s
theorem mix_px (n : Nat) : lin F ((col A D s0 s1 h ξ0 lo0 hi0).px n) ((col A D s0 s1 h ξ1 lo1 hi1).px n) t =
(col A D s0 s1 h (fun e => lin F (ξ0 e) (ξ1 e) t) (fun j => lin F (lo0 j) (lo1 j) t) (fun j => lin F (hi0 j) (hi1 j) t)).px n := by
match ncases A D n with
| .inl h1 => rw [px_src A D s0 s1 h ξ0 lo0 hi0 h1, px_src A D s0 s1 h ξ1 lo1 hi1 h1, px_src A D s0 s1 h _ _ _ h1]
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1; rw [px_box A D s0 s1 h ξ0 lo0 hi0 hl, px_box A D s0 s1 h ξ1 lo1 hi1 hl, px_box A D s0 s1 h _ _ _ hl]
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [px_snk A D s0 s1 h ξ0 lo0 hi0, px_snk A D s0 s1 h ξ1 lo1 hi1, px_snk A D s0 s1 h _ _ _]
theorem mix_wd (n : Nat) : lin F ((col A D s0 s1 h ξ0 lo0 hi0).wd n) ((col A D s0 s1 h ξ1 lo1 hi1).wd n) t =
(col A D s0 s1 h (fun e => lin F (ξ0 e) (ξ1 e) t) (fun j => lin F (lo0 j) (lo1 j) t) (fun j => lin F (hi0 j) (hi1 j) t)).wd n := by
match ncases A D n with
| .inl h1 => rw [wd_src A D s0 s1 h ξ0 lo0 hi0 h1, wd_src A D s0 s1 h ξ1 lo1 hi1 h1, wd_src A D s0 s1 h _ _ _ h1]; unfold lin; lib_ring
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1; rw [wd_box A D s0 s1 h ξ0 lo0 hi0 hl, wd_box A D s0 s1 h ξ1 lo1 hi1 hl, wd_box A D s0 s1 h _ _ _ hl]
unfold lin; lib_ring
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [wd_snk A D s0 s1 h ξ0 lo0 hi0, wd_snk A D s0 s1 h ξ1 lo1 hi1, wd_snk A D s0 s1 h _ _ _]; unfold lin; lib_ring
theorem mix_ox (n p : Nat) : lin F ((col A D s0 s1 h ξ0 lo0 hi0).ox n p) ((col A D s0 s1 h ξ1 lo1 hi1).ox n p) t =
(col A D s0 s1 h (fun e => lin F (ξ0 e) (ξ1 e) t) (fun j => lin F (lo0 j) (lo1 j) t) (fun j => lin F (hi0 j) (hi1 j) t)).ox n p := by
match ncases A D n with
| .inl h1 => rw [ox_src A D s0 s1 h ξ0 lo0 hi0 p h1, ox_src A D s0 s1 h ξ1 lo1 hi1 p h1, ox_src A D s0 s1 h _ _ _ p h1]; unfold lin; lib_ring
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1; rw [ox_box A D s0 s1 h ξ0 lo0 hi0 p hl, ox_box A D s0 s1 h ξ1 lo1 hi1 p hl, ox_box A D s0 s1 h _ _ _ p hl]
unfold lin; lib_ring
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [ox_snk A D s0 s1 h s p, ox_snk A D s0 s1 h s p, ox_snk A D s0 s1 h s p]; unfold lin; lib_ring
theorem mix_ix (n q : Nat) : lin F ((col A D s0 s1 h ξ0 lo0 hi0).ix n q) ((col A D s0 s1 h ξ1 lo1 hi1).ix n q) t =
(col A D s0 s1 h (fun e => lin F (ξ0 e) (ξ1 e) t) (fun j => lin F (lo0 j) (lo1 j) t) (fun j => lin F (hi0 j) (hi1 j) t)).ix n q := by
match ncases A D n with
| .inl h1 => rw [ix_src A D s0 s1 h q h1, ix_src A D s0 s1 h q h1, ix_src A D s0 s1 h q h1]; unfold lin; lib_ring
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1; rw [ix_box A D s0 s1 h ξ0 lo0 hi0 q hl, ix_box A D s0 s1 h ξ1 lo1 hi1 q hl, ix_box A D s0 s1 h _ _ _ q hl]
unfold lin; lib_ring
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [ix_snk A D s0 s1 h ξ0 lo0 hi0, ix_snk A D s0 s1 h ξ1 lo1 hi1, ix_snk A D s0 s1 h _ _ _]; unfold lin; lib_ring
end M
/-- column drawings of D with the same heights and good data are joined by a horizontal motion -/
theorem hmove_col {A B : Ob} {D : List (Ly S)} (hD : DTy D A B) {s0 s1 : F.K} {h : Nat → F.K} (hh : HH D.length s0 s1 h)
{ξ0 ξ1 : Nat × Nat → F.K} {lo0 lo1 hi0 hi1 : Nat → F.K} (g0 : Good A D ξ0 lo0 hi0) (g1 : Good A D ξ1 lo1 hi1) :
HMove (col A D s0 s1 h ξ0 lo0 hi0) (col A D s0 s1 h ξ1 lo1 hi1) := by
refine ⟨⟨rfl, rfl, rfl, rfl, rfl⟩, fun t ht => ?_⟩
have hv := valid_col hD hh (good_lin g0 g1 ht)
exact valid_rn (σ := id) (τ := id) (G := col A D s0 s1 h (fun e => lin F (ξ0 e) (ξ1 e) t)
(fun j => lin F (lo0 j) (lo1 j) t) (fun j => lin F (hi0 j) (hi1 j) t))
(G' := mixX (col A D s0 s1 h ξ0 lo0 hi0) (col A D s0 s1 h ξ1 lo1 hi1) t) ⟨rfl, fun n hn => ⟨hn, rfl⟩, fun n hn => ⟨hn, rfl⟩, fun _ _ => rfl,
fun n _ => mix_px A D s0 s1 h ξ0 ξ1 lo0 lo1 hi0 hi1 t n, fun _ _ => rfl,
fun n _ => mix_wd A D s0 s1 h ξ0 ξ1 lo0 lo1 hi0 hi1 t n, fun n p _ _ => mix_ox A D s0 s1 h ξ0 ξ1 lo0 lo1 hi0 hi1 t n p,
fun n q _ _ => mix_ix A D s0 s1 h ξ0 ξ1 lo0 lo1 hi0 hi1 t n q, fun _ _ => rfl, fun _ _ _ _ => rfl⟩ hv
end TP
end Found
#print axioms Found.TP.natF_lt
#print axioms Found.TP.real_ok
#print axioms Found.TP.good_lin
#print axioms Found.TP.hmove_col
lean_all/found/Top27.lean
/-
T193 (topological), part 27. found/Top27 — moving one node Q straight
down in a drawing whose segments are all vertical. If the drawings at
both ends are valid, every node passed on the way (strictly between the
two heights) has its bar apart from Q's bar, and no segment away from Q
lies with both ends inside the swept heights, then every intermediate
drawing is valid: a segment's open heights only grow or only shrink
along the way, so whatever meets at an intermediate time already meets
at one of the ends.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top26
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- the drawing at time t of the vertical motion from G0 to G1 -/
def vfam (G0 G1 : Drw F S) (t : F.K) : Drw F S :=
{ G0 with py := fun k => lin F (G0.py k) (G1.py k) t }
structure VM1 (G0 G1 : Drw F S) (Q : Nat) : Prop where
nn : G1.nn = G0.nn
kind : G1.kind = G0.kind
px : G1.px = G0.px
tgt : G1.tgt = G0.tgt
src : G1.src = G0.src
wd : G1.wd = G0.wd
ox : G1.ox = G0.ox
ix : G1.ix = G0.ix
pyo : ∀ k, k ≠ Q → G1.py k = G0.py k
down : F.lt (G1.py Q) (G0.py Q)
vert : ∀ e, Seg G0 e → xs G0 e = xt G0 e
v0 : Valid G0
v1 : Valid G1
trap : ∀ e, Seg G0 e → e.1 ≠ Q → hiN G0 e ≠ Q → le F (G1.py Q) (G0.py e.1) → le F (G0.py (hiN G0 e)) (G0.py Q) → False
pts : ∀ k, k < G0.nn → k ≠ Q → F.lt (G1.py Q) (G0.py k) → F.lt (G0.py k) (G0.py Q) →
F.lt (xr G0 Q) (G0.px k) ∨ F.lt (xr G0 k) (G0.px Q)
theorem X_vert {G : Drw F S} {e : Nat × Nat} (hv : xs G e = xt G e) (y : F.K) : X G e y = xs G e := by
unfold X; rw [← hv]; lib_ring
theorem lin_between {a b t : F.K} (hab : F.lt b a) (ht : In01 F t) : le F b (lin F a b t) ∧ le F (lin F a b t) a := by
have li := lin_in' hab ht.1
match ht.2 with
| .inl t1 => exact ⟨.inl (li t1).1, (li t1).2⟩
| .inr e => rw [e, lin1]; exact ⟨.inr rfl, .inl hab⟩
section V
variable {G0 G1 : Drw F S} {Q : Nat} (h : VM1 G0 G1 Q) {t : F.K} (ht : In01 F t)
include h
theorem xsV (e : Nat × Nat) : xs G1 e = xs G0 e := by unfold xs; rw [h.px, h.ox]
theorem xtV (e : Nat × Nat) : xt G1 e = xt G0 e := by unfold xt hiN; rw [h.px, h.ix, h.tgt]
theorem xrV (k : Nat) : xr G1 k = xr G0 k := by unfold xr; rw [h.px, h.wd]
theorem segV (e : Nat × Nat) : Seg G1 e ↔ Seg G0 e := by unfold Seg; rw [h.nn, h.kind]
theorem hiV (e : Nat × Nat) : hiN G1 e = hiN G0 e := by unfold hiN; rw [h.tgt]
theorem Xt {e : Nat × Nat} (he : Seg G0 e) (y : F.K) : X (vfam G0 G1 t) e y = xs G0 e :=
X_vert (G := vfam G0 G1 t) (h.vert e he) y
theorem X1 {e : Nat × Nat} (he : Seg G0 e) (y : F.K) : X G1 e y = xs G0 e := by
rw [X_vert (by rw [xsV h, xtV h]; exact h.vert e he), xsV h]
theorem X0 {e : Nat × Nat} (he : Seg G0 e) (y : F.K) : X G0 e y = xs G0 e := X_vert (h.vert e he) y
theorem pyt_ne {k : Nat} (hk : k ≠ Q) : (vfam G0 G1 t).py k = G0.py k := by
show lin F _ _ t = _; rw [h.pyo k hk]; unfold lin; lib_ring
omit h in
theorem pyt_Q : (vfam G0 G1 t).py Q = lin F (G0.py Q) (G1.py Q) t := rfl
include ht
theorem HQ : le F (G1.py Q) (lin F (G0.py Q) (G1.py Q) t) ∧ le F (lin F (G0.py Q) (G1.py Q) t) (G0.py Q) :=
lin_between h.down ht
omit ht in
theorem no_loop {e : Nat × Nat} (he : Seg G0 e) : e.1 ≠ hiN G0 e := fun e2 => by
have := h.v0.prog e he; rw [← e2] at this; exact F.irr _ this
/-- open heights at time t are open at time 0 or time 1, consistently for two segments -/
theorem open_end {e : Nat × Nat} (he : Seg G0 e) {y : F.K} (ho : Open (vfam G0 G1 t) e y) :
(e.1 = Q ∧ Open G1 e y) ∨ (e.1 ≠ Q ∧ Open G0 e y ∧ (hiN G0 e ≠ Q → Open G1 e y)) := by
have HQ' := HQ h ht
have o1 := ho.1; have o2 := ho.2
match Nat.decEq e.1 Q with
| isTrue eq =>
have hn : hiN G0 e ≠ Q := fun e2 => no_loop h he (by rw [eq, e2])
rw [eq, pyt_Q] at o1
have o2' : F.lt y (G0.py (hiN G0 e)) := by
have : (vfam G0 G1 t).py (hiN (vfam G0 G1 t) e) = G0.py (hiN G0 e) := pyt_ne h hn
rw [this] at o2; exact o2
refine .inl ⟨eq, by rw [eq]; exact lt_of_le_of_lt F HQ'.1 o1, ?_⟩
rw [hiV h, h.pyo _ hn]; exact o2'
| isFalse ne =>
rw [pyt_ne h ne] at o1
have hiE : hiN (vfam G0 G1 t) e = hiN G0 e := rfl
rw [hiE] at o2
refine .inr ⟨ne, ⟨o1, ?_⟩, fun hn => ⟨by rw [h.pyo _ ne]; exact o1, ?_⟩⟩
· match Nat.decEq (hiN G0 e) Q with
| isTrue e2 => rw [e2, pyt_Q] at o2; rw [e2]; exact lt_of_lt_of_le F o2 HQ'.2
| isFalse n2 => rw [pyt_ne h n2] at o2; exact o2
· rw [hiV h, h.pyo _ hn]; rw [pyt_ne h hn] at o2; exact o2
theorem co_open {e e' : Nat × Nat} (he : Seg G0 e) (he' : Seg G0 e') {y : F.K}
(ho : Open (vfam G0 G1 t) e y) (ho' : Open (vfam G0 G1 t) e' y) :
(Open G0 e y ∧ Open G0 e' y) ∨ (Open G1 e y ∧ Open G1 e' y) := by
have HQ' := HQ h ht
have inQ : ∀ {x : Nat × Nat}, Open (vfam G0 G1 t) x y → hiN G0 x = Q → F.lt y (lin F (G0.py Q) (G1.py Q) t) := fun {x} o e2 => by
have o2 := o.2; have hiE : hiN (vfam G0 G1 t) x = hiN G0 x := rfl
rw [hiE, e2] at o2; exact o2
have outQ : ∀ {x : Nat × Nat}, Open (vfam G0 G1 t) x y → x.1 = Q → F.lt (lin F (G0.py Q) (G1.py Q) t) y := fun {x} o e2 => by
have o1 := o.1; rw [e2] at o1; exact o1
match open_end h ht he ho, open_end h ht he' ho' with
| .inl ⟨q1, a1⟩, .inl ⟨_, a2⟩ => exact .inr ⟨a1, a2⟩
| .inl ⟨q1, a1⟩, .inr ⟨n2, _, b2⟩ =>
match Nat.decEq (hiN G0 e') Q with
| isTrue e2 => exact absurd (inQ ho' e2) (lt_asymm F (outQ ho q1))
| isFalse n2' => exact .inr ⟨a1, b2 n2'⟩
| .inr ⟨n1, a1, b1⟩, .inl ⟨q2, a2⟩ =>
match Nat.decEq (hiN G0 e) Q with
| isTrue e2 => exact absurd (inQ ho e2) (lt_asymm F (outQ ho' q2))
| isFalse n1' => exact .inr ⟨b1 n1', a2⟩
| .inr ⟨_, a1, _⟩, .inr ⟨_, a2, _⟩ => exact .inl ⟨a1, a2⟩
theorem vm1_valid : Valid (vfam G0 G1 t) where
tgtOk e he := h.v0.tgtOk e he
srcOk m q hm hq := h.v0.srcOk m q hm hq
prog e he := by
have HQ' := HQ h ht
have hiE : hiN (vfam G0 G1 t) e = hiN G0 e := rfl
rw [hiE]
match Nat.decEq e.1 Q, Nat.decEq (hiN G0 e) Q with
| isTrue e1, isTrue e2 => exact absurd (e1.trans e2.symm) (no_loop h he)
| isTrue e1, isFalse n2 =>
show F.lt ((vfam G0 G1 t).py e.1) _
rw [e1, pyt_Q, pyt_ne h n2]
have := h.v0.prog e he; rw [e1] at this
exact lt_of_le_of_lt F HQ'.2 this
| isFalse n1, isTrue e2 =>
rw [pyt_ne h n1, e2, pyt_Q]
have := h.v1.prog e ((segV h e).2 he); rw [hiV h, e2, h.pyo _ n1] at this
exact lt_of_lt_of_le F this HQ'.1
| isFalse n1, isFalse n2 => rw [pyt_ne h n1, pyt_ne h n2]; exact h.v0.prog e he
segs e e' he he' hne y ho ho' := by
rw [Xt h he, Xt h he']
match co_open h ht he he' ho ho' with
| .inl ⟨a, b⟩ => have := h.v0.segs e e' he he' hne y a b; rw [X0 h he, X0 h he'] at this; exact this
| .inr ⟨a, b⟩ =>
have := h.v1.segs e e' ((segV h e).2 he) ((segV h e').2 he') hne y a b
rw [X1 h he, X1 h he'] at this; exact this
nodes e k he hk ho := by
have HQ' := HQ h ht
rw [Xt h he]
have pxE : (vfam G0 G1 t).px k = G0.px k := rfl
have xrE : xr (vfam G0 G1 t) k = xr G0 k := rfl
rw [pxE, xrE]
match Nat.decEq k Q with
| isFalse nk =>
rw [pyt_ne h nk] at ho
match open_end h ht he ho with
| .inl ⟨_, a⟩ =>
have := h.v1.nodes e k ((segV h e).2 he) (by rw [h.nn]; exact hk) (by rw [h.pyo _ nk]; exact a)
rw [X1 h he, h.px, xrV h] at this; exact this
| .inr ⟨_, a, _⟩ => have := h.v0.nodes e k he hk a; rw [X0 h he] at this; exact this
| isTrue ek =>
subst ek
rw [pyt_Q] at ho
have hiE : hiN (vfam G0 G1 t) e = hiN G0 e := rfl
have o1 := ho.1; have o2 := ho.2
rw [hiE] at o2
have n1 : e.1 ≠ k := fun e1 => by rw [e1, pyt_Q] at o1; exact F.irr _ o1
have n2 : hiN G0 e ≠ k := fun e2 => by rw [e2, pyt_Q] at o2; exact F.irr _ o2
rw [pyt_ne h n1] at o1; rw [pyt_ne h n2] at o2
match F.tri (G0.py k) (G0.py (hiN G0 e)) with
| .inl l =>
have := h.v0.nodes e k he hk ⟨lt_of_lt_of_le F o1 HQ'.2, l⟩
rw [X0 h he] at this; exact this
| .inr hge =>
have hle : le F (G0.py (hiN G0 e)) (G0.py k) := hge.elim (fun e2 => .inr e2.symm) .inl
match F.tri (G0.py e.1) (G1.py k) with
| .inl l =>
have := h.v1.nodes e k ((segV h e).2 he) (by rw [h.nn]; exact hk)
⟨by rw [h.pyo _ n1]; exact l, by rw [hiV h, h.pyo _ n2]; exact lt_of_le_of_lt F HQ'.1 o2⟩
rw [X1 h he, h.px, xrV h] at this; exact this
| .inr hge2 =>
exact (h.trap e he n1 n2 (hge2.elim (fun e2 => .inr e2.symm) .inl) hle).elim
outOrd n p p' y hn hpp hp' ho ho' := by
have s1 : Seg G0 (n, p) := ⟨hn, Nat.lt_trans hpp hp'⟩
have s2 : Seg G0 (n, p') := ⟨hn, hp'⟩
rw [Xt h s1, Xt h s2]
match co_open h ht s1 s2 ho ho' with
| .inl ⟨a, b⟩ => have := h.v0.outOrd n p p' y hn hpp hp' a b; rw [X0 h s1, X0 h s2] at this; exact this
| .inr ⟨a, b⟩ =>
have := h.v1.outOrd n p p' y (by rw [h.nn]; exact hn) hpp (by rw [h.kind]; exact hp') a b
rw [X1 h s1, X1 h s2] at this; exact this
inOrd m q q' y hm hqq hq' ho ho' := by
have s1 := (h.v0.srcOk m q hm (Nat.lt_trans hqq hq')).1
have s2 := (h.v0.srcOk m q' hm hq').1
have e1 : (vfam G0 G1 t).src (m, q) = G0.src (m, q) := rfl
have e2 : (vfam G0 G1 t).src (m, q') = G0.src (m, q') := rfl
rw [e1] at ho ⊢; rw [e2] at ho' ⊢
rw [Xt h s1, Xt h s2]
match co_open h ht s1 s2 ho ho' with
| .inl ⟨a, b⟩ => have := h.v0.inOrd m q q' y hm hqq hq' a b; rw [X0 h s1, X0 h s2] at this; exact this
| .inr ⟨a, b⟩ =>
have := h.v1.inOrd m q q' y (by rw [h.nn]; exact hm) hqq (by rw [h.kind]; exact hq') (by rw [h.src]; exact a) (by rw [h.src]; exact b)
rw [h.src, X1 h s1, X1 h s2] at this; exact this
pts k k' hk hk' hne he := by
have HQ' := HQ h ht
have xrE : ∀ k, xr (vfam G0 G1 t) k = xr G0 k := fun _ => rfl
have pxE : ∀ k, (vfam G0 G1 t).px k = G0.px k := fun _ => rfl
rw [xrE, xrE, pxE, pxE]
match Nat.decEq k Q, Nat.decEq k' Q with
| isTrue e1, isTrue e2 => exact absurd (e1.trans e2.symm) hne
| isFalse n1, isFalse n2 =>
rw [pyt_ne h n1, pyt_ne h n2] at he; exact h.v0.pts k k' hk hk' hne he
| isTrue e1, isFalse n2 =>
subst e1
rw [pyt_Q, pyt_ne h n2] at he
match HQ'.2 with
| .inr e0 => rw [e0] at he; exact h.v0.pts _ k' hk hk' hne he
| .inl lt0 =>
match HQ'.1 with
| .inr e1 =>
rw [← e1] at he
have := h.v1.pts _ k' (by rw [h.nn]; exact hk) (by rw [h.nn]; exact hk') hne (by rw [h.pyo _ n2]; exact he)
rw [xrV h, xrV h, h.px] at this; exact this
| .inl lt1 =>
match h.pts k' hk' n2 (by rw [← he]; exact lt1) (by rw [← he]; exact lt0) with
| .inl a => exact .inl a
| .inr a => exact .inr a
| isFalse n1, isTrue e2 =>
subst e2
rw [pyt_ne h n1, pyt_Q] at he
match HQ'.2 with
| .inr e0 => rw [e0] at he; exact h.v0.pts k _ hk hk' hne he
| .inl lt0 =>
match HQ'.1 with
| .inr e1 =>
rw [← e1] at he
have := h.v1.pts k _ (by rw [h.nn]; exact hk) (by rw [h.nn]; exact hk') hne (by rw [h.pyo _ n1]; exact he)
rw [xrV h, xrV h, h.px] at this; exact this
| .inl lt1 =>
match h.pts k hk n1 (by rw [he]; exact lt1) (by rw [he]; exact lt0) with
| .inl a => exact .inr a
| .inr a => exact .inl a
wd0 k hk := h.v0.wd0 k hk
oxIn n p hn hp := h.v0.oxIn n p hn hp
ixIn m q hm hq := h.v0.ixIn m q hm hq
omit ht in
/-- the vertical motion is a linear family -/
theorem vm1_fam : LinFam G0 G1 (vfam G0 G1) where
nn _ := rfl
kind _ := rfl
px _ := rfl
tgt _ := rfl
wd _ := rfl
ox _ := rfl
ix _ := rfl
nn1 := h.nn
kind1 := h.kind
px1 := h.px
tgt1 := h.tgt
wd1 := h.wd
ox1 := h.ox
ix1 := h.ix
py _ _ := rfl
X t e Q' he := by rw [Xt h he, X0 h he, X1 h he]; unfold lin; lib_ring
valid t ht := vm1_valid h ht
end V
end TP
end Found
#print axioms Found.TP.co_open
#print axioms Found.TP.vm1_valid
#print axioms Found.TP.vm1_fam
lean_all/found/Top28.lean
/-
T193 (topological), part 28. found/Top28 — an interchange step in
explicit form (a prefix, the two swapped layers, a suffix), the
transposition of two neighbouring numbers, and agreement of the level
data of two layer lists below a level where their layers agree, and above
a level from which their layers agree.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top27
namespace Found
namespace TP
open DetChain LibRing SD
variable {S : Sig}
/-- the two layers before and after an interchange -/
def ly1 (X M Y : Ob) (g1 g2 : S.G) : Ly S := ⟨X, g1, M ++ S.dom g2 ++ Y⟩
def ly2 (X M Y : Ob) (g1 g2 : S.G) : Ly S := ⟨X ++ S.cod g1 ++ M, g2, Y⟩
def ly2' (X M Y : Ob) (g1 g2 : S.G) : Ly S := ⟨X ++ S.dom g1 ++ M, g2, Y⟩
def ly1' (X M Y : Ob) (g1 g2 : S.G) : Ly S := ⟨X, g1, M ++ S.cod g2 ++ Y⟩
theorem istep_form {D D' : List (Ly S)} (h : IStep D D') : ∃ (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S)),
D = P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T ∧ D' = P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T := by
induction h with
| @here X M Y R1 L2 L2' R1' g1 g2 Q e1 e2 e3 e4 =>
subst e1; subst e2; subst e3; subst e4
exact ⟨[], X, M, Y, g1, g2, Q, rfl, rfl⟩
| cons l _ ih =>
match ih with
| ⟨P, X, M, Y, g1, g2, T, a, b⟩ => exact ⟨l :: P, X, M, Y, g1, g2, T, by rw [a]; rfl, by rw [b]; rfl⟩
/-! ## lists with a prefix -/
theorem lget_pre : (P L : List (Ly S)) → (k : Nat) → k < P.length → lget (P ++ L) k = lget P k
| [], _, _, h => absurd h (Nat.not_lt_zero _)
| _ :: _, _, 0, _ => rfl
| _ :: P, L, k + 1, h => lget_pre P L k (Nat.lt_of_succ_lt_succ h)
theorem lget_post : (P L : List (Ly S)) → (j : Nat) → lget (P ++ L) (P.length + j) = lget L j
| [], L, j => by show lget L (0 + j) = _; rw [Nat.zero_add]
| a :: P, L, j => by
show lget (a :: (P ++ L)) (P.length + 1 + j) = _
rw [Nat.add_right_comm]; exact lget_post P L j
theorem ldrop_post : (P L : List (Ly S)) → (j : Nat) → ldrop (P ++ L) (P.length + j) = ldrop L j
| [], L, j => by show ldrop L (0 + j) = _; rw [Nat.zero_add]
| a :: P, L, j => by
show ldropN (P.length + 1 + j) (a :: (P ++ L)) = _
rw [Nat.add_right_comm]; exact ldrop_post P L j
theorem len_app {α : Type} (a b : List α) : (a ++ b).length = a.length + b.length := lenA a b
/-! ## agreement below a level -/
theorem bwStep_congr (A : Ob) (k : Nat) (l : Ly S) {prev prev' : Nat → Nat × Nat} (h : ∀ p, prev p = prev' p) (p : Nat) :
bwStep A k l prev p = bwStep A k l prev' p := by
unfold bwStep
match Nat.decLt p l.L.length with
| isTrue _ => exact h p
| isFalse _ =>
match Nat.decLt p (l.L.length + (S.cod l.g).length) with
| isTrue _ => rfl
| isFalse _ => exact h _
theorem bw_agree (A : Ob) {D D' : List (Ly S)} {m : Nat} (hl : ∀ k, k < m → lget D k = lget D' k) :
(k : Nat) → k ≤ m → ∀ p, bw A D k p = bw A D' k p
| 0, _, _ => rfl
| k + 1, hk, p => by
have ih := bw_agree A hl k (Nat.le_of_succ_le hk)
have e := hl k (Nat.lt_of_succ_le hk)
show (match lget D k with
| none => bw A D k p
| some l => bwStep A k l (bw A D k) p) = (match lget D' k with
| none => bw A D' k p
| some l => bwStep A k l (bw A D' k) p)
rw [e]
match lget D' k with
| none => exact ih p
| some l => exact bwStep_congr A k l ih p
theorem lev_agree (A : Ob) {D D' : List (Ly S)} {m : Nat} (hl : ∀ k, k < m → lget D k = lget D' k) :
(k : Nat) → k ≤ m → lev A D k = lev A D' k
| 0, _ => rfl
| k + 1, hk => by
have ih := lev_agree A hl k (Nat.le_of_succ_le hk)
show (match lget D k with
| some l => l.L ++ S.cod l.g ++ l.R
| none => lev A D k) = (match lget D' k with
| some l => l.L ++ S.cod l.g ++ l.R
| none => lev A D' k)
rw [hl k (Nat.lt_of_succ_le hk)]
match lget D' k with
| none => exact ih
| some _ => rfl
/-! ## the transposition of s and s + 1 -/
def tau (s n : Nat) : Nat :=
match Nat.decEq n s with
| isTrue _ => s + 1
| isFalse _ => match Nat.decEq n (s + 1) with
| isTrue _ => s
| isFalse _ => n
theorem tau_s (s : Nat) : tau s s = s + 1 := by
unfold tau
match Nat.decEq s s with
| isTrue _ => rfl
| isFalse h => exact absurd rfl h
theorem tau_s1 (s : Nat) : tau s (s + 1) = s := by
unfold tau
match Nat.decEq (s + 1) s with
| isTrue h => exact absurd h (Nat.succ_ne_self s)
| isFalse _ =>
match Nat.decEq (s + 1) (s + 1) with
| isTrue _ => rfl
| isFalse h => exact absurd rfl h
theorem tau_o {s n : Nat} (h1 : n ≠ s) (h2 : n ≠ s + 1) : tau s n = n := by
unfold tau
match Nat.decEq n s with
| isTrue h => exact absurd h h1
| isFalse _ =>
match Nat.decEq n (s + 1) with
| isTrue h => exact absurd h h2
| isFalse _ => rfl
theorem tau_lt {s n : Nat} (h : n < s) : tau s n = n :=
tau_o (Nat.ne_of_lt h) (Nat.ne_of_lt (Nat.lt_succ_of_lt h))
theorem tau_gt {s n : Nat} (h : s + 1 < n) : tau s n = n :=
tau_o (fun e => by rw [e] at h; exact Nat.lt_irrefl _ (Nat.lt_trans (Nat.lt_succ_self _) h))
(fun e => by rw [e] at h; exact Nat.lt_irrefl _ h)
theorem tau_tau (s n : Nat) : tau s (tau s n) = n :=
match Nat.decEq n s with
| isTrue e => by rw [e, tau_s, tau_s1]
| isFalse n1 => match Nat.decEq n (s + 1) with
| isTrue e => by rw [e, tau_s1, tau_s]
| isFalse n2 => by rw [tau_o n1 n2, tau_o n1 n2]
def tw (s : Nat) (e : Nat × Nat) : Nat × Nat := (tau s e.1, e.2)
end TP
end Found
#print axioms Found.TP.istep_form
#print axioms Found.TP.lget_post
#print axioms Found.TP.bw_agree
#print axioms Found.TP.lev_agree
#print axioms Found.TP.tau_tau
lean_all/found/Top29.lean
/-
T193 (topological), part 29. found/Top29 — the wires of the two layer
lists of an interchange step D = P ++ [l1, l2] ++ T and
D' = P ++ [l2', l1'] ++ T (i = |P|): up to level i they agree, from level
i + 2 on they agree after exchanging the numbers of the two boxes
(s = |A| + i and s + 1), and so do the ends of the wires (fw) from levels
≤ i and ≥ i + 2.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top28
namespace Found
namespace TP
open DetChain LibRing SD
variable {S : Sig}
theorem istep_of_form (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S)) :
(P : List (Ly S)) → IStep (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) (P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T)
| [] => .here rfl rfl rfl rfl
| l :: P => .cons l (istep_of_form X M Y g1 g2 T P)
theorem len3 {α : Type} (a b c : List α) : (a ++ b ++ c).length = a.length + b.length + c.length := by
rw [lenA, lenA]
section I
variable {A B : Ob} (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S))
(hD : DTy (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) A B)
local notation "DL" => P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T
local notation "DR" => P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T
local notation "SS" => A.length + P.length
include hD in
theorem hDR : DTy DR A B := (istep_read (istep_of_form X M Y g1 g2 T P)).1.1 hD
theorem gL1 : lget DL P.length = some (ly1 X M Y g1 g2) := by
have := lget_post P (ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) 0; rw [Nat.add_zero] at this; exact this
theorem gL2 : lget DL (P.length + 1) = some (ly2 X M Y g1 g2) :=
lget_post P (ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) 1
theorem gR2 : lget DR P.length = some (ly2' X M Y g1 g2) := by
have := lget_post P (ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T) 0; rw [Nat.add_zero] at this; exact this
theorem gR1 : lget DR (P.length + 1) = some (ly1' X M Y g1 g2) :=
lget_post P (ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T) 1
theorem g_lo (k : Nat) (hk : k < P.length) : lget DL k = lget DR k := by
rw [lget_pre _ _ k hk, lget_pre _ _ k hk]
theorem g_hi (j : Nat) : lget DL (P.length + 2 + j) = lget DR (P.length + 2 + j) := by
rw [Nat.add_assoc, lget_post, lget_post, Nat.add_comm 2 j]; rfl
theorem d_hi (j : Nat) : ldrop DL (P.length + 2 + j) = ldrop DR (P.length + 2 + j) := by
rw [Nat.add_assoc, ldrop_post, ldrop_post, Nat.add_comm 2 j]; rfl
theorem lenLR : (DL).length = (DR).length := by rw [lenA, lenA]; rfl
/-- below the swapped layers the wires agree -/
theorem bw_lo (k : Nat) (hk : k ≤ P.length) (p : Nat) : bw A DL k p = bw A DR k p :=
bw_agree A (fun k hk => g_lo P X M Y g1 g2 T k hk) k hk p
theorem lev_lo (k : Nat) (hk : k ≤ P.length) : lev A DL k = lev A DR k :=
lev_agree A (fun k hk => g_lo P X M Y g1 g2 T k hk) k hk
theorem lev_i2 : lev A DL (P.length + 2) = lev A DR (P.length + 2) := by
rw [lev_out A _ _ (gL2 P X M Y g1 g2 T), lev_out A _ _ (gR1 P X M Y g1 g2 T)]
show X ++ S.cod g1 ++ M ++ S.cod g2 ++ Y = X ++ S.cod g1 ++ (M ++ S.cod g2 ++ Y)
exact k1 X (S.cod g1) M (S.cod g2) Y |>.symm
theorem lev_hi : (j : Nat) → lev A DL (P.length + 2 + j) = lev A DR (P.length + 2 + j)
| 0 => lev_i2 P X M Y g1 g2 T
| j + 1 => by
show (match lget DL (P.length + 2 + j) with
| some l => l.L ++ S.cod l.g ++ l.R
| none => lev A DL (P.length + 2 + j)) = (match lget DR (P.length + 2 + j) with
| some l => l.L ++ S.cod l.g ++ l.R
| none => lev A DR (P.length + 2 + j))
rw [g_hi P X M Y g1 g2 T j]
match lget DR (P.length + 2 + j) with
| none => exact lev_hi j
| some _ => rfl
include hD
/-- at level i + 2 the wires agree after exchanging the two box numbers -/
theorem bw_i2 (p : Nat) (hp : p < (lev A DL (P.length + 2)).length) :
bw A DL (P.length + 2) p = tw SS (bw A DR (P.length + 2) p) := by
have l1 := gL1 P X M Y g1 g2 T
have l2 := gL2 P X M Y g1 g2 T
have r2 := gR2 P X M Y g1 g2 T
have r1 := gR1 P X M Y g1 g2 T
have i0 : P.length ≤ (DL).length := by rw [lenA]; exact Nat.le_add_right _ _
have bound : ∀ p', p' < (lev A DL P.length).length → tw SS (bw A DL P.length p') = bw A DL P.length p' := fun p' h' =>
by unfold tw; rw [tau_lt (bw_op hD _ i0 p' h').2]
have liL : (lev A DL P.length).length = X.length + (S.dom g1).length + (M.length + (S.dom g2).length + Y.length) := by
rw [len_in hD l1]; show X.length + (S.dom g1).length + (M ++ S.dom g2 ++ Y).length = _; rw [len3]
rw [len_out l2] at hp
have hp' : p < (X ++ S.cod g1 ++ M).length + (S.cod g2).length + Y.length := hp
match split3 p (X ++ S.cod g1 ++ M).length (S.cod g2).length with
| .inl h =>
have hx : p < X.length + (S.cod g1).length + M.length := by rw [← len3]; exact h
rw [bw_L A _ l2 h]
match split3 p X.length (S.cod g1).length with
| .inl h1 =>
rw [bw_L A _ l1 h1, show bw A DR (P.length + 1 + 1) p = bw A DR (P.length + 1) p from bw_L A _ r1 h1,
bw_L A _ r2 (show p < (X ++ S.dom g1 ++ M).length by rw [len3]; exact lt3 h1),
← bw_lo P X M Y g1 g2 T _ (Nat.le_refl _) p]
exact (bound p (by rw [liL]; exact lt3 h1)).symm
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e]
have a := bw_O A _ l1 hq
have b := bw_O A _ r1 hq
show bw A DL (P.length + 1) (X.length + q) = tw SS (bw A DR (P.length + 1 + 1) (X.length + q))
rw [show X.length + q = (ly1 X M Y g1 g2).L.length + q from rfl, a, show (ly1 X M Y g1 g2).L.length + q = (ly1' X M Y g1 g2).L.length + q from rfl, b]
unfold tw; show (SS, q) = (tau SS (SS + 1), q); rw [tau_s1]
| .inr (.inr ⟨r, e⟩) =>
have hr : r < M.length := by rw [e] at hx; exact Nat.lt_of_add_lt_add_left hx
rw [e]
have a := bw_R A _ l1 r
have b := bw_R A _ r1 r
show bw A DL (P.length + 1) ((ly1 X M Y g1 g2).L.length + (S.cod (ly1 X M Y g1 g2).g).length + r) =
tw SS (bw A DR (P.length + 1 + 1) ((ly1' X M Y g1 g2).L.length + (S.cod (ly1' X M Y g1 g2).g).length + r))
rw [a, b]
show bw A DL P.length (X.length + (S.dom g1).length + r) = tw SS (bw A DR (P.length + 1) (X.length + (S.dom g1).length + r))
rw [bw_L A _ r2 (show X.length + (S.dom g1).length + r < (X ++ S.dom g1 ++ M).length by
rw [len3]; exact Nat.add_lt_add_left hr _), ← bw_lo P X M Y g1 g2 T _ (Nat.le_refl _)]
exact (bound _ (by rw [liL]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le hr (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))) _)).symm
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e]
have a := bw_O A _ l2 hq
rw [show (X ++ S.cod g1 ++ M).length + q = (ly2 X M Y g1 g2).L.length + q from rfl, a]
have e2 : (ly2 X M Y g1 g2).L.length + q = (ly1' X M Y g1 g2).L.length + (S.cod (ly1' X M Y g1 g2).g).length + (M.length + q) := by
show (X ++ S.cod g1 ++ M).length + q = X.length + (S.cod g1).length + (M.length + q)
rw [len3, Nat.add_assoc]
rw [e2, show P.length + 2 = P.length + 1 + 1 from rfl, bw_R A _ r1]
have e3 : (ly1' X M Y g1 g2).L.length + (S.dom (ly1' X M Y g1 g2).g).length + (M.length + q) = (ly2' X M Y g1 g2).L.length + q := by
show X.length + (S.dom g1).length + (M.length + q) = (X ++ S.dom g1 ++ M).length + q
rw [len3]; exact (Nat.add_assoc _ _ _).symm
rw [e3, bw_O A _ r2 hq]
unfold tw; show (A.length + (P.length + 1), q) = (tau SS SS, q); rw [tau_s]; rfl
| .inr (.inr ⟨r, e⟩) =>
have hr : r < Y.length := by rw [e] at hp'; exact lt_R hp'
have re : ∀ (a b c : Nat), a + b + c + r = a + b + (c + r) := fun a b c => Nat.add_assoc _ _ _
have re2 : ∀ (a b c d : Nat), a + b + c + d + r = a + b + (c + d + r) := fun a b c d => by
rw [Nat.add_assoc (a + b + c), Nat.add_assoc (a + b), Nat.add_assoc c]
have dl : bw A DL (P.length + 2) p = bw A DL P.length (X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r)) := by
rw [e]
have a := bw_R A _ l2 r
have e1 : (ly2 X M Y g1 g2).L.length + (S.dom (ly2 X M Y g1 g2).g).length + r =
(ly1 X M Y g1 g2).L.length + (S.cod (ly1 X M Y g1 g2).g).length + (M.length + (S.dom g2).length + r) := by
show (X ++ S.cod g1 ++ M).length + (S.dom g2).length + r = X.length + (S.cod g1).length + (M.length + (S.dom g2).length + r)
rw [len3]; exact re2 _ _ _ _
rw [show (X ++ S.cod g1 ++ M).length + (S.cod g2).length + r =
(ly2 X M Y g1 g2).L.length + (S.cod (ly2 X M Y g1 g2).g).length + r from rfl, a, e1, bw_R A _ l1]
rfl
have dr : bw A DR (P.length + 2) p = bw A DR P.length (X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r)) := by
rw [e]
have e2 : (X ++ S.cod g1 ++ M).length + (S.cod g2).length + r =
(ly1' X M Y g1 g2).L.length + (S.cod (ly1' X M Y g1 g2).g).length + (M.length + (S.cod g2).length + r) := by
show (X ++ S.cod g1 ++ M).length + (S.cod g2).length + r = X.length + (S.cod g1).length + (M.length + (S.cod g2).length + r)
rw [len3]; exact re2 _ _ _ _
rw [e2, show P.length + 2 = P.length + 1 + 1 from rfl, bw_R A _ r1]
have e3 : (ly1' X M Y g1 g2).L.length + (S.dom (ly1' X M Y g1 g2).g).length + (M.length + (S.cod g2).length + r) =
(ly2' X M Y g1 g2).L.length + (S.cod (ly2' X M Y g1 g2).g).length + r := by
show X.length + (S.dom g1).length + (M.length + (S.cod g2).length + r) = (X ++ S.dom g1 ++ M).length + (S.cod g2).length + r
rw [len3]; exact (re2 _ _ _ _).symm
rw [e3, bw_R A _ r2]
have e4 : (ly2' X M Y g1 g2).L.length + (S.dom (ly2' X M Y g1 g2).g).length + r =
X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r) := by
show (X ++ S.dom g1 ++ M).length + (S.dom g2).length + r = _
rw [len3]; exact re2 _ _ _ _
rw [e4]
rw [dl, dr, ← bw_lo P X M Y g1 g2 T _ (Nat.le_refl _)]
exact (bound _ (by
rw [liL]
exact Nat.add_lt_add_left (Nat.add_lt_add_left hr _) _)).symm
end I
end TP
end Found
#print axioms Found.TP.istep_of_form
#print axioms Found.TP.lev_hi
#print axioms Found.TP.bw_i2
lean_all/found/Top3.lean
/-
T193 (topological), part 3. found/Top3 — horizontal motions: two drawings
with the same nodes, heights and segments, joined by moving every
x-coordinate (bar positions, widths and port offsets) linearly, the
drawing valid for all t ∈ [0, 1]. At a fixed height every x is then affine
in t, so by the intermediate value theorem no comparison can change sign:
the reading is the same at both ends.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top2
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- the drawing at time t of the horizontal motion from G0 to G1 -/
def mixX (G0 G1 : Drw F S) (t : F.K) : Drw F S :=
⟨G0.nn, G0.kind, fun k => lin F (G0.px k) (G1.px k) t, G0.py, G0.tgt, G0.src,
fun k => lin F (G0.wd k) (G1.wd k) t, fun n p => lin F (G0.ox n p) (G1.ox n p) t,
fun n p => lin F (G0.ix n p) (G1.ix n p) t⟩
structure SameShape (G0 G1 : Drw F S) : Prop where
nn : G1.nn = G0.nn
kind : G1.kind = G0.kind
py : G1.py = G0.py
tgt : G1.tgt = G0.tgt
src : G1.src = G0.src
def HMove (G0 G1 : Drw F S) : Prop := SameShape G0 G1 ∧ ∀ t, In01 F t → Valid (mixX G0 G1 t)
/-- a strict comparison of affine functions without crossing persists -/
theorem lt_keep {a0 a1 b0 b1 : F.K} (h : ∀ t, In01 F t → lin F a0 a1 t ≠ lin F b0 b1 t) (h0 : F.lt a0 b0) :
F.lt a1 b1 := by
have hz : ∀ t, In01 F t → lin F (sub F.R b0 a0) (sub F.R b1 a1) t ≠ F.R.zero := fun t ht e => h t ht (by
have e2 : lin F (sub F.R b0 a0) (sub F.R b1 a1) t = sub F.R (lin F b0 b1 t) (lin F a0 a1 t) := by unfold lin; lib_ring
rw [e2] at e
calc lin F a0 a1 t = F.R.add (lin F a0 a1 t) (sub F.R (lin F b0 b1 t) (lin F a0 a1 t)) := by rw [e]; lib_ring
_ = lin F b0 b1 t := by lib_ring)
exact pos_sub F (keep_pos F hz (sub_pos F h0))
/-- x of a segment from its end data -/
def Xf (a b c d ylo yhi y : F.K) : F.K :=
F.R.add (F.R.add a b) (F.R.mul (F.R.mul (sub F.R y ylo) (sub F.R (F.R.add c d) (F.R.add a b))) (F.inv (sub F.R yhi ylo)))
theorem X_eq (G : Drw F S) (e : Nat × Nat) (y : F.K) :
X G e y = Xf (G.px e.1) (G.ox e.1 e.2) (G.px (G.tgt e).1) (G.ix (G.tgt e).1 (G.tgt e).2) (G.py e.1) (G.py (G.tgt e).1) y := rfl
theorem X_mix (G0 G1 : Drw F S) (hs : SameShape G0 G1) (t : F.K) (e : Nat × Nat) (y : F.K) :
X (mixX G0 G1 t) e y = lin F (X G0 e y) (X G1 e y) t := by
rw [X_eq, X_eq, X_eq, hs.py, hs.tgt]
show Xf (lin F (G0.px e.1) (G1.px e.1) t) (lin F (G0.ox e.1 e.2) (G1.ox e.1 e.2) t)
(lin F (G0.px (G0.tgt e).1) (G1.px (G0.tgt e).1) t) (lin F (G0.ix (G0.tgt e).1 (G0.tgt e).2) (G1.ix (G0.tgt e).1 (G0.tgt e).2) t)
(G0.py e.1) (G0.py (G0.tgt e).1) y = _
unfold Xf lin; lib_ring
theorem xr_mix (G0 G1 : Drw F S) (t : F.K) (k : Nat) : xr (mixX G0 G1 t) k = lin F (xr G0 k) (xr G1 k) t := by
show F.R.add (lin F (G0.px k) (G1.px k) t) (lin F (G0.wd k) (G1.wd k) t) = _
unfold xr lin; lib_ring
theorem lin0 (a b : F.K) : lin F a b F.R.zero = a := lin_zero F a b
theorem lin1 (a b : F.K) : lin F a b F.R.one = b := lin_one F a b
theorem in0 : In01 F F.R.zero := ⟨.inr rfl, .inl F.zero_lt_one⟩
theorem in1 : In01 F F.R.one := ⟨.inl F.zero_lt_one, .inr rfl⟩
section H
variable {G0 G1 : Drw F S} (hm : HMove G0 G1)
include hm
theorem seg_eq (e : Nat × Nat) : Seg G1 e ↔ Seg G0 e := by
unfold Seg; rw [hm.1.nn, hm.1.kind]
theorem open_eq (e : Nat × Nat) (y : F.K) : Open G1 e y ↔ Open G0 e y := by
unfold Open hiN; rw [hm.1.py, hm.1.tgt]
/-- x-comparisons at a fixed height persist along the motion -/
theorem xx_keep {e e' : Nat × Nat} {y : F.K} (he : Seg G0 e) (he' : Seg G0 e') (hne : e ≠ e')
(ho : Open G0 e y) (ho' : Open G0 e' y) (h0 : F.lt (X G0 e y) (X G0 e' y)) : F.lt (X G1 e y) (X G1 e' y) :=
lt_keep (fun t ht => by
rw [← X_mix G0 G1 hm.1 t e y, ← X_mix G0 G1 hm.1 t e' y]
exact (hm.2 t ht).segs e e' he he' hne y ho ho') h0
theorem xn_keep {e : Nat × Nat} {k : Nat} (he : Seg G0 e) (hk : k < G0.nn) (ho : Open G0 e (G0.py k)) :
(F.lt (X G0 e (G0.py k)) (G0.px k) → F.lt (X G1 e (G0.py k)) (G1.px k)) ∧
(F.lt (xr G0 k) (X G0 e (G0.py k)) → F.lt (xr G1 k) (X G1 e (G0.py k))) :=
⟨lt_keep (fun t ht => by
rw [← X_mix G0 G1 hm.1 t e]
exact node_ne_px (hm.2 t ht) he hk ho),
lt_keep (fun t ht e' => by
rw [← X_mix G0 G1 hm.1 t e, ← xr_mix] at e'
exact node_ne_xr (hm.2 t ht) he hk ho e'.symm)⟩
theorem lft_eq (hv0 : Valid G0) (hv1 : Valid G1) {j : Nat} (hj : j < G0.nn) (e : Nat × Nat) :
Lft G1 j e ↔ Lft G0 j e := by
constructor
· intro ⟨hs, ho, hl⟩
rw [hm.1.py] at ho hl
have hs0 := (seg_eq hm e).1 hs
have ho0 := (open_eq hm e _).1 ho
refine ⟨hs0, ho0, ?_⟩
match hv0.nodes e j hs0 hj ho0 with
| .inl h => exact h
| .inr h =>
exact absurd ((xn_keep hm hs0 hj ho0).2 h) (lt_asymm F (lt_of_lt_of_le F hl (px_le_xr hv1 (by rw [hm.1.nn]; exact hj))))
· intro ⟨hs, ho, hl⟩
have h1 := (xn_keep hm hs hj ho).1 hl
refine ⟨(seg_eq hm e).2 hs, ?_, ?_⟩
· rw [hm.1.py]; exact (open_eq hm e _).2 ho
· rw [hm.1.py]; exact h1
theorem rgt_eq (hv0 : Valid G0) (hv1 : Valid G1) {j : Nat} (hj : j < G0.nn) (e : Nat × Nat) :
Rgt G1 j e ↔ Rgt G0 j e := by
constructor
· intro ⟨hs, ho, hl⟩
rw [hm.1.py] at ho hl
have hs0 := (seg_eq hm e).1 hs
have ho0 := (open_eq hm e _).1 ho
refine ⟨hs0, ho0, ?_⟩
match hv0.nodes e j hs0 hj ho0 with
| .inl h =>
exact absurd ((xn_keep hm hs0 hj ho0).1 h) (lt_asymm F (lt_of_le_of_lt F (px_le_xr hv1 (by rw [hm.1.nn]; exact hj)) hl))
| .inr h => exact h
· intro ⟨hs, ho, hl⟩
have h1 := (xn_keep hm hs hj ho).2 hl
refine ⟨(seg_eq hm e).2 hs, ?_, ?_⟩
· rw [hm.1.py]; exact (open_eq hm e _).2 ho
· rw [hm.1.py]; exact h1
theorem incr_keep {y : F.K} {P : Nat × Nat → Prop} (hP : ∀ e, P e → Seg G0 e ∧ Open G0 e y) :
(l : List (Nat × Nat)) → (∀ e, e ∈ l → P e) → Incr F (fun e => X G0 e y) l → Incr F (fun e => X G1 e y) l
| [], _, _ => trivial
| [_], _, _ => trivial
| a :: b :: l, hl, h =>
have ha := hP a (hl a (.head _))
have hb := hP b (hl b (.tail _ (.head _)))
⟨xx_keep hm ha.1 hb.1 (fun e => lt_ne F h.1 (by rw [e])) ha.2 hb.2 h.1,
incr_keep hP (b :: l) (fun e m => hl e (.tail _ m)) h.2⟩
end H
end TP
end Found
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- horizontal motions do not change the reading -/
theorem hmove_reads {G0 G1 : Drw F S} (hm : HMove G0 G1) (hv0 : Valid G0) (hv1 : Valid G1)
{D : List (Ly S)} (h : Reads G0 D) : Reads G1 D := by
match h with
| ⟨bl, he, hi, hf⟩ =>
refine ⟨bl, ⟨he.1, fun j => (he.2 j).trans (by rw [hm.1.nn, hm.1.kind])⟩, by rw [hm.1.py]; exact hi, ?_⟩
have hlay : ∀ j ly, j < G0.nn → LayerOf G0 j ly → LayerOf G1 j ly := fun j ly hj ⟨g, Ls, Rs, hk, hL, iL, hR, iR, e⟩ =>
⟨g, Ls, Rs, by rw [hm.1.kind]; exact hk,
⟨hL.1, fun x => (hL.2 x).trans (lft_eq hm hv0 hv1 hj x).symm⟩,
by rw [hm.1.py]; exact incr_keep hm (P := Lft G0 j) (fun e h => ⟨h.1, h.2.1⟩) Ls (fun e m => (hL.2 e).1 m) iL,
⟨hR.1, fun x => (hR.2 x).trans (rgt_eq hm hv0 hv1 hj x).symm⟩,
by rw [hm.1.py]; exact incr_keep hm (P := Rgt G0 j) (fun e h => ⟨h.1, h.2.1⟩) Rs (fun e m => (hR.2 e).1 m) iR,
by rw [e]; unfold labs lab; rw [hm.1.kind]⟩
have go : ∀ (l : List Nat) (D : List (Ly S)), (∀ j, j ∈ l → j < G0.nn) → Fa2 (LayerOf G0) l D → Fa2 (LayerOf G1) l D :=
fun l D hl hf => by
induction hf with
| nil => exact .nil
| cons h _ ih => exact .cons (hlay _ _ (hl _ (.head _)) h) (ih (fun j m => hl j (.tail _ m)))
exact go bl D (fun j m => ((he.2 j).1 m).1) hf
end TP
end Found
#print axioms Found.TP.lt_keep
#print axioms Found.TP.X_mix
#print axioms Found.TP.hmove_reads
lean_all/found/Top30.lean
/-
T193 (topological), part 30. found/Top30 — the interchange step, levels
above i + 2 and the ends of wires: above level i + 2 the wires agree after
exchanging the two box numbers; the ends traced from levels ≥ i + 2 agree
(and are not the exchanged boxes), and the ends traced from levels ≤ i
agree after the exchange.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top29
namespace Found
namespace TP
open DetChain LibRing SD
variable {S : Sig}
section I
variable {A B : Ob} (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S))
(hD : DTy (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) A B)
local notation "DL" => P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T
local notation "DR" => P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T
local notation "SS" => A.length + P.length
include hD
theorem bw_hi : (j : Nat) → P.length + 2 + j ≤ (DL).length → (p : Nat) → p < (lev A DL (P.length + 2 + j)).length →
bw A DL (P.length + 2 + j) p = tw SS (bw A DR (P.length + 2 + j) p)
| 0, _, p, hp => bw_i2 P X M Y g1 g2 T hD p hp
| j + 1, hj, p, hp =>
match lget_lt (DL) (P.length + 2 + j) hj with
| ⟨l, hl⟩ => by
have hl' : lget DR (P.length + 2 + j) = some l := by rw [← g_hi P X M Y g1 g2 T j]; exact hl
have ihj := Nat.le_of_succ_le hj
show bw A DL (P.length + 2 + j + 1) p = tw SS (bw A DR (P.length + 2 + j + 1) p)
have hp' : p < (lev A DL (P.length + 2 + j + 1)).length := hp
rw [len_out hl] at hp'
match split3 p l.L.length (S.cod l.g).length with
| .inl h =>
rw [bw_L A _ hl h, bw_L A _ hl' h]
exact bw_hi j ihj p (by rw [len_in hD hl]; exact lt3 h)
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e, bw_O A _ hl hq, bw_O A _ hl' hq]
unfold tw
have h3 : A.length + P.length + 1 < A.length + (P.length + 2 + j) :=
Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (by rw [← Nat.add_assoc]; exact Nat.le_add_right _ _)
rw [tau_gt h3]
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp' ⊢
rw [bw_R A _ hl r, bw_R A _ hl' r]
exact bw_hi j ihj _ (by rw [len_in hD hl]; exact Nat.add_lt_add_left (lt_R hp') _)
omit hD in
theorem fw_hi (j p : Nat) : fw A DL (P.length + 2 + j) p = fw A DR (P.length + 2 + j) p := by
unfold fw; rw [d_hi P X M Y g1 g2 T j, lenLR P X M Y g1 g2 T]
/-- ends traced from above level i + 1 are not the exchanged boxes -/
theorem fw_fix (j : Nat) (hj : P.length + 2 + j ≤ (DL).length) (p : Nat) (hp : p < (lev A DL (P.length + 2 + j)).length) :
tw SS (fw A DR (P.length + 2 + j) p) = fw A DR (P.length + 2 + j) p := by
rw [← fw_hi P X M Y g1 g2 T j p]
unfold tw
match fw_res' hD hj hp with
| .inl ⟨j', l, q, hl, hjj, _, ef, _⟩ =>
rw [ef]
show (tau SS (A.length + j'), q) = (A.length + j', q)
rw [tau_gt (show A.length + P.length + 1 < A.length + j' by
rw [Nat.add_assoc]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le (Nat.succ_lt_succ (Nat.lt_succ_self _))
(Nat.le_trans (Nat.le_add_right _ _) hjj)) _)]
| .inr ⟨s, _, ef, _⟩ =>
rw [ef]
show (tau SS (A.length + (DL).length + s), 0) = (A.length + (DL).length + s, 0)
have h2 : P.length + 2 ≤ (DL).length := Nat.le_trans (Nat.le_add_right _ _) hj
have h3 : A.length + P.length + 1 < A.length + (DL).length + s :=
Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.le_trans (Nat.add_le_add_left h2 A.length) (Nat.le_add_right _ _))
rw [tau_gt h3]
/-- ends traced from level i agree after the exchange -/
theorem fw_i (p : Nat) (hp : p < (lev A DL P.length).length) :
fw A DL P.length p = tw SS (fw A DR P.length p) := by
have l1 := gL1 P X M Y g1 g2 T
have l2 := gL2 P X M Y g1 g2 T
have r2 := gR2 P X M Y g1 g2 T
have r1 := gR1 P X M Y g1 g2 T
have hN : P.length + 2 + 0 ≤ (DL).length := by rw [lenA]; exact Nat.add_le_add_left (Nat.le_add_left 2 T.length) P.length
have len2 : (lev A DL (P.length + 2 + 0)).length = X.length + (S.cod g1).length + (M.length + (S.cod g2).length + Y.length) := by
show (lev A DL (P.length + 1 + 1)).length = _
rw [len_out l2]; show (X ++ S.cod g1 ++ M).length + (S.cod g2).length + Y.length = _
rw [len3]
exact (Nat.add_assoc _ _ _).trans ((Nat.add_assoc _ _ _).trans (congrArg _ (Nat.add_assoc _ _ _).symm))
have fin : ∀ p', p' < (lev A DL (P.length + 2 + 0)).length →
fw A DL (P.length + 1 + 1) p' = tw SS (fw A DR (P.length + 1 + 1) p') := fun p' h' => by
have a := fw_hi (A := A) P X M Y g1 g2 T 0 p'
have b := fw_fix P X M Y g1 g2 T hD 0 hN p' h'
show fw A DL (P.length + 2 + 0) p' = tw SS (fw A DR (P.length + 2 + 0) p')
rw [a, b]
rw [len_in hD l1] at hp
have hp' : p < X.length + (S.dom g1).length + (M ++ S.dom g2 ++ Y).length := hp
match split3 p X.length (S.dom g1).length with
| .inl h =>
rw [fw_L A _ l1 h, fw_L A _ r2 (show p < (X ++ S.dom g1 ++ M).length by rw [len3]; exact lt3 h),
fw_L A _ l2 (show p < (X ++ S.cod g1 ++ M).length by rw [len3]; exact lt3 h), fw_L A _ r1 h]
exact fin p (by rw [len2]; exact lt3 h)
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e]
have a := fw_D A _ l1 hq
rw [show X.length + q = (ly1 X M Y g1 g2).L.length + q from rfl, a]
rw [show (ly1 X M Y g1 g2).L.length + q = X.length + q from rfl,
fw_L A _ r2 (show X.length + q < (X ++ S.dom g1 ++ M).length by
rw [len3]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _))]
rw [show X.length + q = (ly1' X M Y g1 g2).L.length + q from rfl, fw_D A _ r1 hq]
unfold tw; show (SS, q) = (tau SS (SS + 1), q); rw [tau_s1]
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp' ⊢
have hr : r < M.length + (S.dom g2).length + Y.length := by rw [← len3]; exact lt_R hp'
match split3 r M.length (S.dom g2).length with
| .inl h =>
have a := fw_R A _ l1 r
rw [show X.length + (S.dom g1).length + r = (ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + r from rfl, a,
fw_L A _ l2 (show (ly1 X M Y g1 g2).L.length + (S.cod (ly1 X M Y g1 g2).g).length + r < (X ++ S.cod g1 ++ M).length by
rw [len3]; exact Nat.add_lt_add_left h _)]
rw [show (ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + r = X.length + (S.dom g1).length + r from rfl,
fw_L A _ r2 (show X.length + (S.dom g1).length + r < (X ++ S.dom g1 ++ M).length by
rw [len3]; exact Nat.add_lt_add_left h _)]
rw [show X.length + (S.dom g1).length + r = (ly1' X M Y g1 g2).L.length + (S.dom (ly1' X M Y g1 g2).g).length + r from rfl,
fw_R A _ r1 r]
exact fin _ (by rw [len2]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le h (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))) _)
| .inr (.inl ⟨q, hq, e2⟩) =>
rw [e2]
have a := fw_R A _ l1 (M.length + q)
rw [show X.length + (S.dom g1).length + (M.length + q) =
(ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + (M.length + q) from rfl, a]
have e3 : (ly1 X M Y g1 g2).L.length + (S.cod (ly1 X M Y g1 g2).g).length + (M.length + q) = (ly2 X M Y g1 g2).L.length + q := by
show X.length + (S.cod g1).length + (M.length + q) = (X ++ S.cod g1 ++ M).length + q
rw [len3]; exact (Nat.add_assoc _ _ _).symm
rw [e3, fw_D A _ l2 hq]
have e4 : (ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + (M.length + q) = (ly2' X M Y g1 g2).L.length + q := by
show X.length + (S.dom g1).length + (M.length + q) = (X ++ S.dom g1 ++ M).length + q
rw [len3]; exact (Nat.add_assoc _ _ _).symm
rw [e4, fw_D A _ r2 hq]
unfold tw; show (A.length + (P.length + 1), q) = (tau SS SS, q); rw [tau_s]; rfl
| .inr (.inr ⟨y, e2⟩) =>
rw [e2]
have hy : y < Y.length := by rw [e2] at hr; exact lt_R hr
have re2 : ∀ (a b c d : Nat), a + b + c + d + y = a + b + (c + d + y) := fun a b c d => by
rw [Nat.add_assoc (a + b + c), Nat.add_assoc (a + b), Nat.add_assoc c]
have a := fw_R A _ l1 (M.length + (S.dom g2).length + y)
rw [show X.length + (S.dom g1).length + (M.length + (S.dom g2).length + y) =
(ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + (M.length + (S.dom g2).length + y) from rfl, a]
have e3 : (ly1 X M Y g1 g2).L.length + (S.cod (ly1 X M Y g1 g2).g).length + (M.length + (S.dom g2).length + y) =
(ly2 X M Y g1 g2).L.length + (S.dom (ly2 X M Y g1 g2).g).length + y := by
show X.length + (S.cod g1).length + (M.length + (S.dom g2).length + y) = (X ++ S.cod g1 ++ M).length + (S.dom g2).length + y
rw [len3]; exact (re2 _ _ _ _).symm
rw [e3, fw_R A _ l2 y]
have e4 : (ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + (M.length + (S.dom g2).length + y) =
(ly2' X M Y g1 g2).L.length + (S.dom (ly2' X M Y g1 g2).g).length + y := by
show X.length + (S.dom g1).length + (M.length + (S.dom g2).length + y) = (X ++ S.dom g1 ++ M).length + (S.dom g2).length + y
rw [len3]; exact (re2 _ _ _ _).symm
rw [e4, fw_R A _ r2 y]
have e5 : (ly2' X M Y g1 g2).L.length + (S.cod (ly2' X M Y g1 g2).g).length + y =
(ly1' X M Y g1 g2).L.length + (S.dom (ly1' X M Y g1 g2).g).length + (M.length + (S.cod g2).length + y) := by
show (X ++ S.dom g1 ++ M).length + (S.cod g2).length + y = X.length + (S.dom g1).length + (M.length + (S.cod g2).length + y)
rw [len3]; exact re2 _ _ _ _
rw [e5, fw_R A _ r1]
have e6 : (ly2 X M Y g1 g2).L.length + (S.cod (ly2 X M Y g1 g2).g).length + y =
(ly1' X M Y g1 g2).L.length + (S.cod (ly1' X M Y g1 g2).g).length + (M.length + (S.cod g2).length + y) := by
show (X ++ S.cod g1 ++ M).length + (S.cod g2).length + y = X.length + (S.cod g1).length + (M.length + (S.cod g2).length + y)
rw [len3]; exact re2 _ _ _ _
rw [e6]
exact fin _ (by rw [len2]; exact Nat.add_lt_add_left (Nat.add_lt_add_left hy _) _)
/-- ends traced from levels ≤ i agree after the exchange -/
theorem fw_lo : (m k : Nat) → k + m = P.length → (p : Nat) → p < (lev A DL k).length →
fw A DL k p = tw SS (fw A DR k p)
| 0, k, hk, p, hp => by rw [Nat.add_zero] at hk; subst hk; exact fw_i P X M Y g1 g2 T hD p hp
| m + 1, k, hk, p, hp => by
have hkP : k < P.length := by rw [← hk]; exact Nat.lt_add_of_pos_right (Nat.succ_pos m)
have hk1 : k + 1 + m = P.length := by rw [Nat.add_right_comm]; exact hk
match lget_lt (DL) k (Nat.lt_of_lt_of_le hkP (by rw [lenA]; exact Nat.le_add_right _ _)) with
| ⟨l, hl⟩ =>
have hl' : lget DR k = some l := by rw [← g_lo P X M Y g1 g2 T k hkP]; exact hl
rw [len_in hD hl] at hp
match split3 p l.L.length (S.dom l.g).length with
| .inl h =>
rw [fw_L A _ hl h, fw_L A _ hl' h]
exact fw_lo m (k + 1) hk1 p (by rw [len_out hl]; exact lt3 h)
| .inr (.inl ⟨q, hq, e⟩) =>
rw [e, fw_D A _ hl hq, fw_D A _ hl' hq]
unfold tw; rw [tau_lt (Nat.add_lt_add_left hkP _)]
| .inr (.inr ⟨r, e⟩) =>
rw [e] at hp ⊢
rw [fw_R A _ hl r, fw_R A _ hl' r]
exact fw_lo m (k + 1) hk1 _ (by rw [len_out hl]; exact Nat.add_lt_add_left (lt_R hp) _)
end I
end TP
end Found
#print axioms Found.TP.bw_hi
#print axioms Found.TP.fw_fix
#print axioms Found.TP.fw_i
#print axioms Found.TP.fw_lo
lean_all/found/Top31.lean
/-
T193 (topological), part 31. found/Top31 — the column drawing of the
interchanged list D' is the column drawing of D with the numbers of the
two boxes exchanged (as a renumbering), when the heights, bars and wire
x-values are carried along: h' = h ∘ τ, lo' = lo ∘ τ, hi' = hi ∘ τ on
layers and ξ' = ξ ∘ τ on wires.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top30
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
theorem tau_add (a i j : Nat) : tau (a + i) (a + j) = a + tau i j :=
match Nat.decEq j i with
| isTrue e => by rw [e, tau_s, tau_s]; rfl
| isFalse n1 => match Nat.decEq j (i + 1) with
| isTrue e => by rw [e, tau_s1]; exact tau_s1 (a + i)
| isFalse n2 => by
rw [tau_o n1 n2, tau_o (fun e => n1 (addLC2 _ e)) (fun e => n2 (addLC2 _ (by rw [e]; rfl)))]
section I
variable {A B : Ob} (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S))
(hD : DTy (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) A B)
local notation "DL" => P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T
local notation "DR" => P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T
local notation "SS" => A.length + P.length
theorem lev_ge {j : Nat} (h : P.length + 2 ≤ j) : lev A DL j = lev A DR j := by
rw [← subD _ _ h]; exact lev_hi P X M Y g1 g2 T _
include hD
omit hD in
theorem lenN : P.length + 2 ≤ (DL).length := by rw [lenA]; exact Nat.add_le_add_left (Nat.le_add_left 2 T.length) P.length
theorem levN : lev A DL (DL).length = lev A DR (DR).length := by
rw [lev_end hD, lev_end (hDR P X M Y g1 g2 T hD)]
omit hD in
/-- the boxes of D' sit at the exchanged layers of D, with the same generators -/
theorem lay_rel {j : Nat} {l : Ly S} (hl : lget DR j = some l) : ∃ l0, lget DL (tau P.length j) = some l0 ∧ l0.g = l.g := by
match Nat.decEq j P.length with
| isTrue e =>
subst e; rw [gR2 P X M Y g1 g2 T] at hl; cases hl
exact ⟨ly2 X M Y g1 g2, by rw [tau_s]; exact gL2 P X M Y g1 g2 T, rfl⟩
| isFalse n1 => match Nat.decEq j (P.length + 1) with
| isTrue e =>
subst e; rw [gR1 P X M Y g1 g2 T] at hl; cases hl
exact ⟨ly1 X M Y g1 g2, by rw [tau_s1]; exact gL1 P X M Y g1 g2 T, rfl⟩
| isFalse n2 =>
rw [tau_o n1 n2]
match Nat.lt_or_ge j P.length with
| .inl lt => exact ⟨l, by rw [g_lo P X M Y g1 g2 T j lt]; exact hl, rfl⟩
| .inr ge =>
have g2' : P.length + 2 ≤ j := Nat.succ_le_of_lt (Nat.lt_of_le_of_ne (Nat.succ_le_of_lt
(Nat.lt_of_le_of_ne ge (fun e => n1 e.symm))) (fun e => n2 e.symm))
have e := subD _ _ g2'
exact ⟨l, by rw [← e, g_hi P X M Y g1 g2 T, e]; exact hl, rfl⟩
/-- the wire into an input of a box of D' corresponds to the wire into the same input in D -/
theorem src_rel {j : Nat} {l : Ly S} (hl : lget DR j = some l) {q : Nat} (hq : q < (S.dom l.g).length) :
∃ l0, lget DL (tau P.length j) = some l0 ∧
bw A DL (tau P.length j) (l0.L.length + q) = tw SS (bw A DR j (l.L.length + q)) := by
have hDr := hDR P X M Y g1 g2 T hD
have hjN : j < (DR).length := lget_some_lt _ j hl
have posR : l.L.length + q < (lev A DR j).length := by
rw [len_in hDr hl]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _)
match Nat.decEq j P.length with
| isTrue e =>
subst e; rw [gR2 P X M Y g1 g2 T] at hl; cases hl
refine ⟨_, by rw [tau_s]; exact gL2 P X M Y g1 g2 T, ?_⟩
rw [tau_s]
have a := bw_R A _ (gL1 P X M Y g1 g2 T) (M.length + q)
have e1 : (ly2 X M Y g1 g2).L.length + q = (ly1 X M Y g1 g2).L.length + (S.cod (ly1 X M Y g1 g2).g).length + (M.length + q) := by
show (X ++ S.cod g1 ++ M).length + q = X.length + (S.cod g1).length + (M.length + q); rw [len3]; exact Nat.add_assoc _ _ _
have e2 : (ly1 X M Y g1 g2).L.length + (S.dom (ly1 X M Y g1 g2).g).length + (M.length + q) = (ly2' X M Y g1 g2).L.length + q := by
show X.length + (S.dom g1).length + (M.length + q) = (X ++ S.dom g1 ++ M).length + q; rw [len3]; exact (Nat.add_assoc _ _ _).symm
rw [e1, a, e2, bw_lo P X M Y g1 g2 T _ (Nat.le_refl _)]
unfold tw
rw [tau_lt (bw_op hDr _ (Nat.le_of_lt hjN) _ posR).2]
| isFalse n1 => match Nat.decEq j (P.length + 1) with
| isTrue e =>
subst e; rw [gR1 P X M Y g1 g2 T] at hl; cases hl
refine ⟨_, by rw [tau_s1]; exact gL1 P X M Y g1 g2 T, ?_⟩
rw [tau_s1]
have b := bw_L A _ (gR2 P X M Y g1 g2 T) (show X.length + q < (ly2' X M Y g1 g2).L.length by
show X.length + q < (X ++ S.dom g1 ++ M).length
rw [len3]; exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _))
show bw A DL P.length (X.length + q) = tw SS (bw A DR (P.length + 1) (X.length + q))
rw [b, ← bw_lo P X M Y g1 g2 T _ (Nat.le_refl _)]
unfold tw
rw [tau_lt (bw_op hD _ (Nat.le_trans (Nat.le_add_right _ _) (lenN P X M Y g1 g2 T)) (X.length + q) (by
rw [len_in hD (gL1 P X M Y g1 g2 T)]
exact Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _))).2]
| isFalse n2 =>
rw [tau_o n1 n2]
match Nat.lt_or_ge j P.length with
| .inl lt =>
refine ⟨l, by rw [g_lo P X M Y g1 g2 T j lt]; exact hl, ?_⟩
rw [bw_lo P X M Y g1 g2 T j (Nat.le_of_lt lt)]
unfold tw
rw [tau_lt (Nat.lt_of_lt_of_le (bw_op hDr _ (Nat.le_of_lt hjN) _ posR).2 (Nat.add_le_add_left (Nat.le_of_lt lt) _))]
| .inr ge =>
have g2' : P.length + 2 ≤ j := Nat.succ_le_of_lt (Nat.lt_of_le_of_ne (Nat.succ_le_of_lt
(Nat.lt_of_le_of_ne ge (fun e => n1 e.symm))) (fun e => n2 e.symm))
have e := subD _ _ g2'
refine ⟨l, by rw [← e, g_hi P X M Y g1 g2 T, e]; exact hl, ?_⟩
rw [← e]
exact bw_hi P X M Y g1 g2 T hD _ (by rw [e]; exact Nat.le_of_lt (by rw [lenLR P X M Y g1 g2 T]; exact hjN))
_ (by rw [e, lev_ge P X M Y g1 g2 T g2']; exact posR)
/-- the ends of corresponding wires correspond -/
theorem tgt_rel {e : Nat × Nat} (he : OP A DR e) : tgtW A DL (tw SS e) = tw SS (tgtW A DR e) := by
have hDr := hDR P X M Y g1 g2 T hD
have hN := lenN P X M Y g1 g2 T
have hNR : P.length + 2 ≤ (DR).length := by rw [← lenLR P X M Y g1 g2 T]; exact hN
-- a wire of D' present at a level ≥ i + 2
have hi_case : ∀ b p, P.length + 2 ≤ b → b ≤ (DR).length → p < (lev A DR b).length → bw A DR b p = e →
tgtW A DL (tw SS e) = tw SS (tgtW A DR e) := fun b p hb hbN hp eb => by
have eb' := subD _ _ hb
have hpL : p < (lev A DL b).length := by rw [lev_ge P X M Y g1 g2 T hb]; exact hp
have hbL : b ≤ (DL).length := by rw [lenLR P X M Y g1 g2 T]; exact hbN
have b1 : bw A DL b p = tw SS e := by
rw [← eb, ← eb']; rw [← eb'] at hbL hpL
exact bw_hi P X M Y g1 g2 T hD _ hbL p hpL
rw [← b1, tgtW_bw hD b hbL p hpL, ← eb, tgtW_bw hDr b hbN p hp, ← eb']
rw [← eb'] at hbL hpL
rw [fw_hi P X M Y g1 g2 T, fw_fix P X M Y g1 g2 T hD _ hbL p hpL]
-- a wire of D' present at a level ≤ i
have lo_case : ∀ b p, b ≤ P.length → p < (lev A DR b).length → bw A DR b p = e →
tgtW A DL (tw SS e) = tw SS (tgtW A DR e) := fun b p hb hp eb => by
have hbN : b ≤ (DR).length := Nat.le_trans hb (Nat.le_trans (Nat.le_add_right _ 2) hNR)
have hpL : p < (lev A DL b).length := by rw [lev_lo P X M Y g1 g2 T b hb]; exact hp
have fix : tw SS e = e := by
unfold tw; rw [tau_lt (Nat.lt_of_lt_of_le (by rw [← eb]; exact (bw_op hDr b hbN p hp).2) (Nat.add_le_add_left hb _))]
have b1 : bw A DL b p = e := by rw [bw_lo P X M Y g1 g2 T b hb, eb]
rw [fix, ← b1, tgtW_bw hD b (Nat.le_trans hbN (by rw [lenLR P X M Y g1 g2 T]; exact Nat.le_refl _)) p hpL, b1, ← eb,
tgtW_bw hDr b hbN p hp]
exact fw_lo P X M Y g1 g2 T hD (P.length - b) b (subD _ _ hb) p hpL
match birth he with
| .inl ⟨_, _, e1, hp⟩ => exact lo_case 0 e.1 (Nat.zero_le _) hp e1
| .inr ⟨j, l, hl, _, _, e1, hp⟩ =>
match Nat.lt_or_ge j P.length with
| .inl lt => exact lo_case (j + 1) _ (Nat.succ_le_of_lt lt) hp e1
| .inr ge =>
match Nat.decEq j P.length with
| isFalse ne =>
exact hi_case (j + 1) _ (Nat.succ_le_succ (Nat.lt_of_le_of_ne ge (fun e' => ne e'.symm)))
(Nat.succ_le_of_lt (lget_some_lt _ j hl)) hp e1
| isTrue eq =>
subst eq
rw [gR2 P X M Y g1 g2 T] at hl
cases hl
-- the outputs of the second box of D' are present at level i + 2
have hq : e.2 < (S.cod g2).length := ‹_›
have pos : (ly1' X M Y g1 g2).L.length + (S.cod (ly1' X M Y g1 g2).g).length + (M.length + e.2) <
(lev A DR (P.length + 2)).length := by
show _ < (lev A DR (P.length + 1 + 1)).length
rw [len_out (gR1 P X M Y g1 g2 T)]
show X.length + (S.cod g1).length + (M.length + e.2) < X.length + (S.cod g1).length + (M ++ S.cod g2 ++ Y).length
rw [len3]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le (Nat.add_lt_add_left hq _) (Nat.le_add_right _ _)) _
refine hi_case (P.length + 2) _ (Nat.le_refl _) hNR pos ?_
show bw A DR (P.length + 1 + 1) _ = e
rw [bw_R A _ (gR1 P X M Y g1 g2 T)]
have e3 : (ly1' X M Y g1 g2).L.length + (S.dom (ly1' X M Y g1 g2).g).length + (M.length + e.2) = (ly2' X M Y g1 g2).L.length + e.2 := by
show X.length + (S.dom g1).length + (M.length + e.2) = (X ++ S.dom g1 ++ M).length + e.2
rw [len3]; exact (Nat.add_assoc _ _ _).symm
rw [e3, bw_O A _ (gR2 P X M Y g1 g2 T) hq]
rw [← e1, bw_O A _ (gR2 P X M Y g1 g2 T) hq]
/-- the column drawing of D' is a renumbering of the column drawing of D -/
theorem rn_istep (s0 s1 : F.K) (h : Nat → F.K) (ξ : Nat × Nat → F.K) (lo hi : Nat → F.K) :
IsRn (tau SS) (tau SS)
(col A DR s0 s1 (fun j => h (tau P.length j)) (fun e => ξ (tw SS e)) (fun j => lo (tau P.length j)) (fun j => hi (tau P.length j)))
(col A DL s0 s1 h ξ lo hi) := by
have hDr := hDR P X M Y g1 g2 T hD
have hN := lenN P X M Y g1 g2 T
have eN := lenLR P X M Y g1 g2 T
have eL := levN P X M Y g1 g2 T hD
have hNR : P.length + 2 ≤ (DR).length := by rw [← eN]; exact hN
have nnE : A.length + (DL).length + (lev A DL (DL).length).length = A.length + (DR).length + (lev A DR (DR).length).length := by
rw [eL, eN]
have ssR : SS + 1 < A.length + (DR).length := Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.add_le_add_left hNR _)
have sink_fix : ∀ s, tau SS (A.length + (DR).length + s) = A.length + (DR).length + s := fun s =>
tau_gt (Nat.lt_of_lt_of_le ssR (Nat.le_add_right _ _))
have bwN : ∀ s, s < (lev A DR (DR).length).length → bw A DL (DL).length s = tw SS (bw A DR (DR).length s) := fun s hs => by
have e' := subD _ _ hN
have hs' : s < (lev A DL (P.length + 2 + ((DL).length - (P.length + 2)))).length := by rw [e', eL]; exact hs
have hb := bw_hi P X M Y g1 g2 T hD ((DL).length - (P.length + 2)) (by rw [e']; exact Nat.le_refl _) s hs'
rw [e'] at hb
rw [← eN]; exact hb
have nnR : ∀ n, n < A.length + (DR).length + (lev A DR (DR).length).length →
tau SS n < A.length + (DR).length + (lev A DR (DR).length).length := fun n hn =>
match Nat.decEq n SS with
| isTrue e => by subst e; rw [tau_s]; exact Nat.lt_of_lt_of_le ssR (Nat.le_add_right _ _)
| isFalse n1 => match Nat.decEq n (SS + 1) with
| isTrue e => by subst e; rw [tau_s1]; exact Nat.lt_trans (Nat.lt_succ_self _) hn
| isFalse n2 => by rw [tau_o n1 n2]; exact hn
have srcfix : ∀ n, n < A.length → tau SS n = n := fun n h1 => tau_lt (Nat.lt_of_lt_of_le h1 (Nat.le_add_right _ _))
have snkL : ∀ s, A.length + (DR).length + s = A.length + (DL).length + s := fun s => by rw [eN]
refine ⟨nnE, fun n hn => ⟨nnR n hn, tau_tau _ _⟩, fun n hn => ⟨nnR n hn, tau_tau _ _⟩, fun n hn => ?_, fun n hn => ?_,
fun n hn => ?_, fun n hn => ?_, fun n p hn hp => ?_, fun n q hn hq => ?_, fun e he => ?_, fun m q hm hq => ?_⟩
· -- kind
show ckind A DL (tau SS n) = ckind A DR n
match ncases A DR n with
| .inl h1 => rw [srcfix n h1, ckind_src A DL h1, ckind_src A DR h1]
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, eg⟩ => rw [tau_add, ckind_box A DL hl0, ckind_box A DR hl, eg]
| .inr (.inr ⟨s, e1⟩) =>
subst e1
rw [sink_fix, snkL s, ckind_snk, ← snkL s, ckind_snk, eL]
· -- px
match ncases A DR n with
| .inl h1 =>
rw [srcfix n h1, px_src A DL s0 s1 h ξ lo hi h1, px_src A DR s0 s1 _ _ _ _ h1]
show ξ (n, 0) = ξ (tau SS n, 0); rw [srcfix n h1]
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, _⟩ => rw [tau_add, px_box A DL s0 s1 h ξ lo hi hl0, px_box A DR s0 s1 _ _ _ _ hl]
| .inr (.inr ⟨s, e1⟩) =>
subst e1
have hs : s < (lev A DR (DR).length).length := Nat.lt_of_add_lt_add_left hn
rw [sink_fix, snkL s, px_snk A DL s0 s1 h ξ lo hi, ← snkL s, px_snk A DR s0 s1 _ _ _ _, bwN s hs]
· -- py
match ncases A DR n with
| .inl h1 => rw [srcfix n h1, py_src A DL s0 s1 h ξ lo hi h1, py_src A DR s0 s1 _ _ _ _ h1]
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, _⟩ => rw [tau_add, py_box A DL s0 s1 h ξ lo hi hl0, py_box A DR s0 s1 _ _ _ _ hl]
| .inr (.inr ⟨s, e1⟩) =>
subst e1
rw [sink_fix, snkL s, py_snk A DL s0 s1 h ξ lo hi, ← snkL s, py_snk A DR s0 s1 _ _ _ _]
· -- wd
match ncases A DR n with
| .inl h1 => rw [srcfix n h1, wd_src A DL s0 s1 h ξ lo hi h1, wd_src A DR s0 s1 _ _ _ _ h1]
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, _⟩ => rw [tau_add, wd_box A DL s0 s1 h ξ lo hi hl0, wd_box A DR s0 s1 _ _ _ _ hl]
| .inr (.inr ⟨s, e1⟩) =>
subst e1
rw [sink_fix, snkL s, wd_snk A DL s0 s1 h ξ lo hi, ← snkL s, wd_snk A DR s0 s1 _ _ _ _]
· -- ox
match ncases A DR n with
| .inl h1 => rw [srcfix n h1, ox_src A DL s0 s1 h ξ lo hi p h1, ox_src A DR s0 s1 _ _ _ _ p h1]
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, _⟩ =>
rw [tau_add, ox_box A DL s0 s1 h ξ lo hi p hl0, ox_box A DR s0 s1 _ _ _ _ p hl]
show sub F.R (ξ (A.length + tau P.length j, p)) _ = sub F.R (ξ (tau SS (A.length + j), p)) _
rw [tau_add]
| .inr (.inr ⟨s, e1⟩) =>
subst e1
rw [sink_fix, snkL s, ox_snk A DL s0 s1 h s p, ← snkL s, ox_snk A DR s0 s1 (fun j => h (tau P.length j)) s p]
· -- ix
match ncases A DR n with
| .inl h1 =>
have : nIn (ckind A DR n) = 0 := by rw [ckind_src A DR h1]; rfl
exact absurd hq (by show ¬ q < nIn (ckind A DR n); rw [this]; exact Nat.not_lt_zero _)
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hq' : q < (S.dom l.g).length := by
have : q < nIn (ckind A DR (A.length + j)) := hq
rw [ckind_box A DR hl] at this; exact this
match src_rel P X M Y g1 g2 T hD hl hq' with
| ⟨l0, hl0, eb⟩ =>
rw [tau_add, ix_box A DL s0 s1 h ξ lo hi q hl0, ix_box A DR s0 s1 _ _ _ _ q hl]
show sub F.R (ξ (bw A DL (tau P.length j) (l0.L.length + q))) _ = sub F.R (ξ (tw SS (bw A DR j (l.L.length + q)))) _
rw [eb]
| .inr (.inr ⟨s, e1⟩) =>
subst e1
rw [sink_fix, snkL s, ix_snk A DL s0 s1 h ξ lo hi, ← snkL s, ix_snk A DR s0 s1 _ _ _ _]
· -- tgt
exact tgt_rel P X M Y g1 g2 T hD ((seg_col A DR s0 s1 _ _ _ _ e).1 he)
· -- src
match ncases A DR m with
| .inl h1 =>
have : nIn (ckind A DR m) = 0 := by rw [ckind_src A DR h1]; rfl
exact absurd hq (by show ¬ q < nIn (ckind A DR m); rw [this]; exact Nat.not_lt_zero _)
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hq' : q < (S.dom l.g).length := by
have : q < nIn (ckind A DR (A.length + j)) := hq
rw [ckind_box A DR hl] at this; exact this
match src_rel P X M Y g1 g2 T hD hl hq' with
| ⟨l0, hl0, eb⟩ =>
rw [tau_add, src_box A DL s0 s1 h ξ lo hi q hl0, src_box A DR s0 s1 _ _ _ _ q hl, eb]; rfl
| .inr (.inr ⟨s, e1⟩) =>
subst e1
have hs : s < (lev A DR (DR).length).length := Nat.lt_of_add_lt_add_left hm
rw [sink_fix, snkL s, src_snk A DL s0 s1 h ξ lo hi, ← snkL s, src_snk A DR s0 s1 _ _ _ _, bwN s hs]; rfl
end I
end TP
end Found
#print axioms Found.TP.tau_add
#print axioms Found.TP.lay_rel
#print axioms Found.TP.src_rel
#print axioms Found.TP.tgt_rel
#print axioms Found.TP.rn_istep
lean_all/found/Top32.lean
/-
T193 (topological), part 32. found/Top32 — if x-data are good for D and
the bar of the first box of the interchange ends left of where the bar of
the second begins, the carried x-data are good for the interchanged D'.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Top31
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
theorem ltR {p a b : Nat} (h : p < a) : p < a + b := Nat.lt_of_lt_of_le h (Nat.le_add_right _ _)
theorem ltM {a q b c : Nat} (h : q < b) : a + q < a + b + c := ltR (Nat.add_lt_add_left h a)
theorem ass3 (a b c d : Nat) : a + b + c + d = a + b + (c + d) := Nat.add_assoc _ _ _
theorem ass4 (a b c d e : Nat) : a + b + c + d + e = a + b + (c + d + e) := by
rw [Nat.add_assoc (a + b + c), Nat.add_assoc (a + b), Nat.add_assoc c]
section I
variable {A B : Ob} (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S))
(hD : DTy (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) A B)
local notation "DL" => P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T
local notation "DR" => P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T
local notation "SS" => A.length + P.length
include hD
theorem lv_i : (lev A DL P.length).length = X.length + (S.dom g1).length + (M.length + (S.dom g2).length + Y.length) := by
rw [len_in hD (gL1 P X M Y g1 g2 T)]; show X.length + (S.dom g1).length + (M ++ S.dom g2 ++ Y).length = _; rw [len3]
omit hD in
theorem lv_i2 : (lev A DL (P.length + 2)).length = X.length + (S.cod g1).length + M.length + (S.cod g2).length + Y.length := by
show (lev A DL (P.length + 1 + 1)).length = _
rw [len_out (gL2 P X M Y g1 g2 T)]; show (X ++ S.cod g1 ++ M).length + _ + _ = _; rw [len3]; rfl
omit hD in
theorem lvR_i1 : (lev A DR (P.length + 1)).length = X.length + (S.dom g1).length + M.length + (S.cod g2).length + Y.length := by
rw [len_out (gR2 P X M Y g1 g2 T)]; show (X ++ S.dom g1 ++ M).length + _ + _ = _; rw [len3]; rfl
omit hD in
theorem iN : P.length ≤ (DL).length := Nat.le_trans (Nat.le_add_right _ 2) (lenN P X M Y g1 g2 T)
/-- level-i wires of D are not the exchanged boxes -/
theorem fix_i (p : Nat) (hp : p < (lev A DL P.length).length) : tw SS (bw A DL P.length p) = bw A DL P.length p := by
unfold tw; rw [tau_lt (bw_op hD _ (iN P X M Y g1 g2 T) p hp).2]
omit hD in
theorem KX {p : Nat} (hp : p < X.length) : bw A DL (P.length + 2) p = bw A DL P.length p := by
show bw A DL (P.length + 1 + 1) p = _
rw [bw_L A _ (gL2 P X M Y g1 g2 T) (show p < (X ++ S.cod g1 ++ M).length by rw [len3]; exact ltR (ltR hp)),
bw_L A _ (gL1 P X M Y g1 g2 T) hp]
omit hD in
theorem KM1 (m' : Nat) : bw A DL (P.length + 1) (X.length + (S.cod g1).length + m') = bw A DL P.length (X.length + (S.dom g1).length + m') :=
bw_R A _ (gL1 P X M Y g1 g2 T) m'
omit hD in
theorem KM {m' : Nat} (hm : m' < M.length) :
bw A DL (P.length + 2) (X.length + (S.cod g1).length + m') = bw A DL P.length (X.length + (S.dom g1).length + m') := by
show bw A DL (P.length + 1 + 1) _ = _
rw [bw_L A _ (gL2 P X M Y g1 g2 T) (show X.length + (S.cod g1).length + m' < (X ++ S.cod g1 ++ M).length by
rw [len3]; exact Nat.add_lt_add_left hm _), KM1]
omit hD in
theorem KO {q : Nat} (hq : q < (S.cod g2).length) :
bw A DL (P.length + 2) (X.length + (S.cod g1).length + M.length + q) = (SS + 1, q) := by
show bw A DL (P.length + 1 + 1) _ = _
rw [show X.length + (S.cod g1).length + M.length + q = (ly2 X M Y g1 g2).L.length + q by
show _ = (X ++ S.cod g1 ++ M).length + q; rw [len3]]
exact bw_O A _ (gL2 P X M Y g1 g2 T) hq
omit hD in
theorem KY1 (r : Nat) : bw A DL (P.length + 1) (X.length + (S.cod g1).length + M.length + (S.dom g2).length + r) =
bw A DL P.length (X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r)) := by
rw [ass4]; exact KM1 P X M Y g1 g2 T _
omit hD in
theorem VL {p : Nat} (hp : p < X.length + (S.dom g1).length + M.length) : bw A DR (P.length + 1) p = bw A DL P.length p := by
rw [bw_L A _ (gR2 P X M Y g1 g2 T) (show p < (X ++ S.dom g1 ++ M).length by rw [len3]; exact hp),
← bw_lo P X M Y g1 g2 T _ (Nat.le_refl _)]
omit hD in
theorem VO {q : Nat} (hq : q < (S.cod g2).length) : bw A DR (P.length + 1) (X.length + (S.dom g1).length + M.length + q) = (SS, q) := by
rw [show X.length + (S.dom g1).length + M.length + q = (ly2' X M Y g1 g2).L.length + q by
show _ = (X ++ S.dom g1 ++ M).length + q; rw [len3]]
exact bw_O A _ (gR2 P X M Y g1 g2 T) hq
omit hD in
theorem VR (r : Nat) : bw A DR (P.length + 1) (X.length + (S.dom g1).length + M.length + (S.cod g2).length + r) =
bw A DL P.length (X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r)) := by
rw [show X.length + (S.dom g1).length + M.length + (S.cod g2).length + r =
(ly2' X M Y g1 g2).L.length + (S.cod (ly2' X M Y g1 g2).g).length + r by
show _ = (X ++ S.dom g1 ++ M).length + _ + r; rw [len3]; rfl, bw_R A _ (gR2 P X M Y g1 g2 T),
← bw_lo P X M Y g1 g2 T _ (Nat.le_refl _)]
show bw A DL P.length ((X ++ S.dom g1 ++ M).length + (S.dom g2).length + r) = _
rw [len3, ass4]
section G
variable {ξ : Nat × Nat → F.K} {lo hi : Nat → F.K} (g : Good A (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) ξ lo hi)
(sep : F.lt (hi P.length) (lo (P.length + 1)))
include g sep
/-- the order at level i + 1 of D' -/
theorem inc_i1 {p p' : Nat} (hpp : p < p') (hp' : p' < (lev A DR (P.length + 1)).length) :
F.lt (ξ (tw SS (bw A DR (P.length + 1) p))) (ξ (tw SS (bw A DR (P.length + 1) p'))) := by
have l1 := gL1 P X M Y g1 g2 T
have l2 := gL2 P X M Y g1 g2 T
have hi2 : P.length + 2 ≤ (DL).length := lenN P X M Y g1 g2 T
have iN' := iN P X M Y g1 g2 T
have liL := lv_i P X M Y g1 g2 T hD
have li2 := lv_i2 (A := A) P X M Y g1 g2 T
rw [lvR_i1] at hp'
have posL : ∀ p, p < X.length + (S.dom g1).length + M.length → p < (lev A DL P.length).length := fun p h => by
rw [liL]; exact Nat.lt_of_lt_of_le h (Nat.add_le_add_left (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)) _)
have posR : ∀ r, r < Y.length → X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r) < (lev A DL P.length).length :=
fun r hr => by rw [liL]; exact Nat.add_lt_add_left (Nat.add_lt_add_left hr _) _
have pos2 : ∀ q, q < (S.cod g2).length → X.length + (S.cod g1).length + M.length + q < (lev A DL (P.length + 2)).length :=
fun q hq => by rw [li2]; exact ltR (Nat.add_lt_add_left hq _)
have bL : ∀ p, p < X.length + (S.dom g1).length + M.length → tw SS (bw A DR (P.length + 1) p) = bw A DL P.length p := fun p h => by
rw [VL P X M Y g1 g2 T h, fix_i P X M Y g1 g2 T hD p (posL p h)]
have bO : ∀ q, q < (S.cod g2).length → tw SS (bw A DR (P.length + 1) (X.length + (S.dom g1).length + M.length + q)) = (SS + 1, q) :=
fun q hq => by rw [VO P X M Y g1 g2 T hq]; unfold tw; show (tau SS SS, q) = _; rw [tau_s]
have bR : ∀ r, r < Y.length → tw SS (bw A DR (P.length + 1) (X.length + (S.dom g1).length + M.length + (S.cod g2).length + r)) =
bw A DL P.length (X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r)) := fun r hr => by
rw [VR P X M Y g1 g2 T r, fix_i P X M Y g1 g2 T hD _ (posR r hr)]
-- the outputs of the second box are left of the wires right of it
have OR : ∀ q r, q < (S.cod g2).length → r < Y.length →
F.lt (ξ (SS + 1, q)) (ξ (bw A DL P.length (X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r)))) := fun q r hq hr => by
have hR := g.R (P.length + 1) (ly2 X M Y g1 g2) r l2 hr
have epos : (ly2 X M Y g1 g2).L.length + (S.dom (ly2 X M Y g1 g2).g).length + r =
X.length + (S.cod g1).length + M.length + (S.dom g2).length + r := by
show (X ++ S.cod g1 ++ M).length + _ + _ = _; rw [len3]; rfl
rw [epos, KY1] at hR
exact lt_of_le_of_lt F (g.outB (P.length + 1) (ly2 X M Y g1 g2) q l2 hq).2 hR
match split3 p (X.length + (S.dom g1).length + M.length) (S.cod g2).length,
split3 p' (X.length + (S.dom g1).length + M.length) (S.cod g2).length with
| .inl h, .inl h' =>
rw [bL p h, bL p' h']; exact g.inc _ p p' iN' hpp (posL p' h')
| .inl h, .inr (.inl ⟨q', hq', e'⟩) =>
rw [bL p h, e', bO q' hq']
match split3 p X.length (S.dom g1).length with
| .inl h1 =>
rw [← KX P X M Y g1 g2 T h1, ← KO P X M Y g1 g2 T hq']
exact g.inc _ _ _ hi2 (ltR (ltR (ltR h1))) (pos2 q' hq')
| .inr (.inl ⟨q1, hq1, e1⟩) =>
rw [e1]
exact lt_of_le_of_lt F (g.inB _ (ly1 X M Y g1 g2) q1 l1 hq1).2 (lt_of_lt_of_le F sep (g.outB _ (ly2 X M Y g1 g2) q' l2 hq').1)
| .inr (.inr ⟨m', e1⟩) =>
have hm : m' < M.length := by rw [e1] at h; exact Nat.lt_of_add_lt_add_left h
rw [e1, ← KM P X M Y g1 g2 T hm, ← KO P X M Y g1 g2 T hq']
exact g.inc _ _ _ hi2 (ltR (Nat.add_lt_add_left hm _)) (pos2 q' hq')
| .inl h, .inr (.inr ⟨r', e'⟩) =>
have hr' : r' < Y.length := by rw [e'] at hp'; exact lt_R hp'
rw [bL p h, e', bR r' hr']
exact g.inc _ _ _ iN' (Nat.lt_of_lt_of_le h (Nat.add_le_add_left (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)) _)) (posR r' hr')
| .inr (.inl ⟨q, _, e⟩), .inl h' =>
rw [e] at hpp; exact absurd (Nat.lt_of_le_of_lt (Nat.le_add_right _ _) (Nat.lt_trans hpp h')) (Nat.lt_irrefl _)
| .inr (.inl ⟨q, hq, e⟩), .inr (.inl ⟨q', hq', e'⟩) =>
rw [e, e', bO q hq, bO q' hq', ← KO P X M Y g1 g2 T hq, ← KO P X M Y g1 g2 T hq']
rw [e, e'] at hpp
exact g.inc _ _ _ hi2 (Nat.add_lt_add_left (Nat.lt_of_add_lt_add_left hpp) _) (pos2 q' hq')
| .inr (.inl ⟨q, hq, e⟩), .inr (.inr ⟨r', e'⟩) =>
have hr' : r' < Y.length := by rw [e'] at hp'; exact lt_R hp'
rw [e, e', bO q hq, bR r' hr']
exact OR q r' hq hr'
| .inr (.inr ⟨r, e⟩), .inl h' =>
rw [e] at hpp; exact absurd (Nat.lt_of_le_of_lt (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)) (Nat.lt_trans hpp h')) (Nat.lt_irrefl _)
| .inr (.inr ⟨r, e⟩), .inr (.inl ⟨q', hq', e'⟩) =>
rw [e, e'] at hpp
exact absurd (Nat.lt_of_le_of_lt (Nat.le_add_right _ _) (Nat.lt_trans hpp (Nat.add_lt_add_left hq' _))) (Nat.lt_irrefl _)
| .inr (.inr ⟨r, e⟩), .inr (.inr ⟨r', e'⟩) =>
have hr' : r' < Y.length := by rw [e'] at hp'; exact lt_R hp'
have hrr : r < r' := by rw [e, e'] at hpp; exact Nat.lt_of_add_lt_add_left hpp
rw [e, e', bR r (Nat.lt_trans hrr hr'), bR r' hr']
exact g.inc _ _ _ iN' (Nat.add_lt_add_left (Nat.add_lt_add_left hrr _) _) (posR r' hr')
theorem good_istep : Good A DR (fun e => ξ (tw SS e)) (fun j => lo (tau P.length j)) (fun j => hi (tau P.length j)) := by
have hDr := hDR P X M Y g1 g2 T hD
have hN := lenN P X M Y g1 g2 T
have eN := lenLR P X M Y g1 g2 T
have l1 := gL1 P X M Y g1 g2 T
have l2 := gL2 P X M Y g1 g2 T
have r2 := gR2 P X M Y g1 g2 T
have r1 := gR1 P X M Y g1 g2 T
have iN' := iN P X M Y g1 g2 T
have liL := lv_i P X M Y g1 g2 T hD
have lowW : ∀ k p, k ≤ P.length → p < (lev A DR k).length → tw SS (bw A DR k p) = bw A DL k p := fun k p hk hp => by
have hpL : p < (lev A DL k).length := by rw [lev_lo P X M Y g1 g2 T k hk]; exact hp
rw [← bw_lo P X M Y g1 g2 T k hk]
unfold tw
rw [tau_lt (Nat.lt_of_lt_of_le (bw_op hD k (Nat.le_trans hk iN') p hpL).2 (Nat.add_le_add_left hk _))]
have highW : ∀ k p, P.length + 2 ≤ k → k ≤ (DR).length → p < (lev A DR k).length → tw SS (bw A DR k p) = bw A DL k p :=
fun k p hk hkN hp => by
have e' := subD _ _ hk
have hpL : p < (lev A DL k).length := by rw [lev_ge P X M Y g1 g2 T hk]; exact hp
rw [← e'] at hkN hpL ⊢
exact (bw_hi P X M Y g1 g2 T hD _ (by rw [eN]; exact hkN) p hpL).symm
have rel : ∀ j l, lget DR j = some l → j ≠ P.length → j ≠ P.length + 1 →
tau P.length j = j ∧ lget DL j = some l ∧ ∀ p, p < (lev A DR j).length → tw SS (bw A DR j p) = bw A DL j p := fun j l hl n1 n2 => by
refine ⟨tau_o n1 n2, ?_, ?_⟩
· match Nat.lt_or_ge j P.length with
| .inl lt => rw [g_lo P X M Y g1 g2 T j lt]; exact hl
| .inr ge =>
have g2' : P.length + 2 ≤ j := Nat.succ_le_of_lt (Nat.lt_of_le_of_ne (Nat.succ_le_of_lt
(Nat.lt_of_le_of_ne ge (fun e => n1 e.symm))) (fun e => n2 e.symm))
rw [← subD _ _ g2', g_hi P X M Y g1 g2 T, subD _ _ g2']; exact hl
· intro p hp
match Nat.lt_or_ge j P.length with
| .inl lt => exact lowW j p (Nat.le_of_lt lt) hp
| .inr ge =>
have g2' : P.length + 2 ≤ j := Nat.succ_le_of_lt (Nat.lt_of_le_of_ne (Nat.succ_le_of_lt
(Nat.lt_of_le_of_ne ge (fun e => n1 e.symm))) (fun e => n2 e.symm))
exact highW j p g2' (Nat.le_of_lt (lget_some_lt _ j hl)) hp
have lenLev : ∀ j, j ≠ P.length + 1 → (lev A DR j).length = (lev A DL j).length := fun j n2 => by
match Nat.lt_or_ge j (P.length + 1) with
| .inl lt => rw [lev_lo P X M Y g1 g2 T j (Nat.le_of_lt_succ lt)]
| .inr ge => rw [lev_ge P X M Y g1 g2 T (Nat.succ_le_of_lt (Nat.lt_of_le_of_ne ge (fun e => n2 e.symm)))]
refine ⟨fun k p p' hk hpp hp' => ?_, fun j l p hl hp => ?_, fun j l r hl hr => ?_, fun j l q hl hq => ?_,
fun j l q hl hq => ?_, fun j l hl => ?_⟩
· -- inc
match Nat.decEq k (P.length + 1) with
| isTrue e => subst e; exact inc_i1 P X M Y g1 g2 T hD g sep hpp hp'
| isFalse ne =>
match Nat.lt_or_ge k (P.length + 1) with
| .inl lt =>
rw [lowW k p (Nat.le_of_lt_succ lt) (Nat.lt_trans hpp hp'), lowW k p' (Nat.le_of_lt_succ lt) hp']
exact g.inc k p p' (by rw [eN]; exact hk) hpp (by rw [← lenLev k ne]; exact hp')
| .inr ge =>
have g2' : P.length + 2 ≤ k := Nat.succ_le_of_lt (Nat.lt_of_le_of_ne ge (fun e => ne e.symm))
rw [highW k p g2' hk (Nat.lt_trans hpp hp'), highW k p' g2' hk hp']
exact g.inc k p p' (by rw [eN]; exact hk) hpp (by rw [← lenLev k ne]; exact hp')
· -- L
show F.lt (ξ (tw SS (bw A DR j p))) (lo (tau P.length j))
match Nat.decEq j P.length, Nat.decEq j (P.length + 1) with
| isTrue e, _ =>
subst e; rw [r2] at hl; cases hl
rw [tau_s]
have hp' : p < X.length + (S.dom g1).length + M.length := by
have : p < (X ++ S.dom g1 ++ M).length := hp
rw [len3] at this; exact this
have hpL : p < (lev A DR P.length).length := by
rw [← lev_lo P X M Y g1 g2 T _ (Nat.le_refl _), liL]
exact Nat.lt_of_lt_of_le hp' (Nat.add_le_add_left (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)) _)
rw [lowW _ p (Nat.le_refl _) hpL]
match split3 p X.length (S.dom g1).length with
| .inl h1 =>
rw [← bw_L A _ l1 h1]
exact g.L _ (ly2 X M Y g1 g2) p l2 (show p < (X ++ S.cod g1 ++ M).length by rw [len3]; exact ltR (ltR h1))
| .inr (.inl ⟨q1, hq1, e1⟩) =>
rw [e1]; exact lt_of_le_of_lt F (g.inB _ (ly1 X M Y g1 g2) q1 l1 hq1).2 sep
| .inr (.inr ⟨m', e1⟩) =>
have hm : m' < M.length := by rw [e1] at hp'; exact Nat.lt_of_add_lt_add_left hp'
rw [e1, ← KM1 P X M Y g1 g2 T]
exact g.L _ (ly2 X M Y g1 g2) _ l2 (show _ < (X ++ S.cod g1 ++ M).length by rw [len3]; exact Nat.add_lt_add_left hm _)
| isFalse _, isTrue e =>
subst e; rw [r1] at hl; cases hl
rw [tau_s1]
have hp' : p < X.length := hp
rw [VL P X M Y g1 g2 T (ltR (ltR hp')), fix_i P X M Y g1 g2 T hD p (by rw [liL]; exact lt3 hp')]
exact g.L _ (ly1 X M Y g1 g2) p l1 hp'
| isFalse n1, isFalse n2 =>
match rel j l hl n1 n2 with
| ⟨et, hlL, hw⟩ =>
rw [et, hw p (by rw [len_in hDr hl]; exact lt3 hp)]
exact g.L j l p hlL hp
· -- R
show F.lt (hi (tau P.length j)) (ξ (tw SS (bw A DR j (l.L.length + (S.dom l.g).length + r))))
match Nat.decEq j P.length, Nat.decEq j (P.length + 1) with
| isTrue e, _ =>
subst e; rw [r2] at hl; cases hl
rw [tau_s]
have hr' : r < Y.length := hr
have epos : (ly2' X M Y g1 g2).L.length + (S.dom (ly2' X M Y g1 g2).g).length + r =
X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r) := by
show (X ++ S.dom g1 ++ M).length + _ + r = _; rw [len3, ass4]; rfl
have hpL : X.length + (S.dom g1).length + (M.length + (S.dom g2).length + r) < (lev A DR P.length).length := by
rw [← lev_lo P X M Y g1 g2 T _ (Nat.le_refl _), liL]
exact Nat.add_lt_add_left (Nat.add_lt_add_left hr' _) _
rw [epos, lowW _ _ (Nat.le_refl _) hpL]
have hR := g.R (P.length + 1) (ly2 X M Y g1 g2) r l2 hr'
have epos2 : (ly2 X M Y g1 g2).L.length + (S.dom (ly2 X M Y g1 g2).g).length + r =
X.length + (S.cod g1).length + M.length + (S.dom g2).length + r := by
show (X ++ S.cod g1 ++ M).length + _ + _ = _; rw [len3]; rfl
rw [epos2, KY1] at hR
exact hR
| isFalse _, isTrue e =>
subst e; rw [r1] at hl; cases hl
rw [tau_s1]
have hr' : r < M.length + (S.cod g2).length + Y.length := by
have : r < (M ++ S.cod g2 ++ Y).length := hr
rw [len3] at this; exact this
show F.lt (hi P.length) (ξ (tw SS (bw A DR (P.length + 1) (X.length + (S.dom g1).length + r))))
match split3 r M.length (S.cod g2).length with
| .inl h1 =>
rw [VL P X M Y g1 g2 T (Nat.add_lt_add_left h1 _), fix_i P X M Y g1 g2 T hD _ (by
rw [liL]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le h1 (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _))) _)]
exact g.R _ (ly1 X M Y g1 g2) r l1 (show r < (M ++ S.dom g2 ++ Y).length by
rw [len3]; exact Nat.lt_of_lt_of_le h1 (Nat.le_trans (Nat.le_add_right _ _) (Nat.le_add_right _ _)))
| .inr (.inl ⟨q, hq, e1⟩) =>
rw [e1, ← Nat.add_assoc, VO P X M Y g1 g2 T hq]
unfold tw; show F.lt _ (ξ (tau SS SS, q)); rw [tau_s]
exact lt_of_lt_of_le F sep (g.outB _ (ly2 X M Y g1 g2) q l2 hq).1
| .inr (.inr ⟨y', e1⟩) =>
have hy : y' < Y.length := by rw [e1] at hr'; exact lt_R hr'
rw [e1, show X.length + (S.dom g1).length + (M.length + (S.cod g2).length + y') =
X.length + (S.dom g1).length + M.length + (S.cod g2).length + y' from (ass4 _ _ _ _ _).symm, VR,
fix_i P X M Y g1 g2 T hD _ (by rw [liL]; exact Nat.add_lt_add_left (Nat.add_lt_add_left hy _) _)]
exact g.R _ (ly1 X M Y g1 g2) _ l1 (show M.length + (S.dom g2).length + y' < (M ++ S.dom g2 ++ Y).length by
rw [len3]; exact Nat.add_lt_add_left hy _)
| isFalse n1, isFalse n2 =>
match rel j l hl n1 n2 with
| ⟨et, hlL, hw⟩ =>
rw [et, hw _ (by rw [len_in hDr hl]; exact Nat.add_lt_add_left hr _)]
exact g.R j l r hlL hr
· -- inB
match src_rel P X M Y g1 g2 T hD hl hq, lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, eb⟩, ⟨l0', hl0', eg⟩ =>
rw [hl0] at hl0'; cases hl0'
show le F (lo (tau P.length j)) (ξ (tw SS (bw A DR j (l.L.length + q)))) ∧ le F (ξ (tw SS (bw A DR j (l.L.length + q)))) (hi (tau P.length j))
rw [← eb]
exact g.inB _ l0 q hl0 (by rw [eg]; exact hq)
· -- outB
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, eg⟩ =>
show le F (lo (tau P.length j)) (ξ (tw SS (A.length + j, q))) ∧ le F (ξ (tw SS (A.length + j, q))) (hi (tau P.length j))
unfold tw
show le F _ (ξ (tau (A.length + P.length) (A.length + j), q)) ∧ le F (ξ (tau (A.length + P.length) (A.length + j), q)) _
rw [tau_add]
exact g.outB _ l0 q hl0 (by rw [eg]; exact hq)
· -- lh
match lay_rel P X M Y g1 g2 T hl with
| ⟨l0, hl0, _⟩ => exact g.lh _ l0 hl0
end G
end I
end TP
end Found
#print axioms Found.TP.KO
#print axioms Found.TP.VR
#print axioms Found.TP.inc_i1
#print axioms Found.TP.good_istep
lean_all/found/Top33.lean
/-
T193 (topological), part 33. found/Top33 — separated x-data for an
interchange step: the canonical data, except that when nothing lies
between the two boxes the outputs of an input-less second box start at
the end of the first box's bar. These data are good for D, and the first
box's bar ends strictly left of where the second box's bar begins.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top32
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## more on the one-layer step -/
section S
variable {f : Nat → F.K} {o : Option F.K} {a d c r : Nat} (hf : Inc f (a + d + r)) (ho : OvOK f o a d r)
include hf ho
theorem hiB_lt_rv : F.lt (hiB f o a d c r) (rvF f a d r) := by
have blt := bv_lt_rv hf ho
unfold hiB
match c with
| 0 => match d, blt with
| 0, blt => exact (mid_in blt).2
| _ + 1, blt => exact blt
| c + 1 => exact (chain_in blt c).2
theorem bv_le_hiB : le F (bvF f o a d) (hiB f o a d c r) := by
have blt := bv_lt_rv hf ho
unfold hiB
match c with
| 0 => match d, blt with
| 0, blt => exact .inl (mid_in blt).1
| _ + 1, _ => exact .inr rfl
| c + 1 => exact .inl (chain_in blt c).1
end S
theorem nextF_congr {f f' : Nat → F.K} (h : ∀ p, f p = f' p) (o : Option F.K) (a d c r p : Nat) :
nextF f o a d c r p = nextF f' o a d c r p := by
have hb : bvF f o a d = bvF f' o a d := by
unfold bvF
match d with
| 0 => match o with
| some _ => rfl
| none => unfold lvF; match a with
| 0 => rfl
| a + 1 => exact h a
| d + 1 => exact h _
have hr : rvF f a d r = rvF f' a d r := by
unfold rvF; match r with
| 0 => rfl
| _ + 1 => exact h _
unfold nextF
rw [hb, hr]
match Nat.decLt p a with
| isTrue _ => exact h p
| isFalse _ =>
match Nat.decLt p (a + c) with
| isTrue _ => rfl
| isFalse _ => exact h _
theorem xv_agree (A : Ob) (D : List (Ly S)) {ov ov' : Nat → Option F.K} :
(k : Nat) → (∀ j, j < k → ov j = ov' j) → ∀ p, xv A D ov k p = xv A D ov' k p
| 0, _, _ => rfl
| k + 1, h, p => by
have ih := xv_agree A D k (fun j hj => h j (Nat.lt_succ_of_lt hj))
show (match lget D k with
| none => xv A D ov k
| some l => nextF (xv A D ov k) (ov k) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length) p =
(match lget D k with
| none => xv A D ov' k
| some l => nextF (xv A D ov' k) (ov' k) l.L.length (S.dom l.g).length (S.cod l.g).length l.R.length) p
match lget D k with
| none => exact ih p
| some l => rw [h k (Nat.lt_succ_self k)]; exact nextF_congr ih _ _ _ _ _ p
/-- a single given value at layer s -/
def ovAt (s : Nat) (v : F.K) (j : Nat) : Option F.K :=
match Nat.decEq j s with
| isTrue _ => some v
| isFalse _ => none
theorem ovAt_ne {s j : Nat} {v : F.K} (h : j ≠ s) : ovAt s v j = none := by
unfold ovAt
match Nat.decEq j s with
| isTrue e => exact absurd e h
| isFalse _ => rfl
theorem ovAt_eq (s : Nat) (v : F.K) : ovAt s v s = some v := by
unfold ovAt
match Nat.decEq s s with
| isTrue _ => rfl
| isFalse h => exact absurd rfl h
section Cg
variable {f f' : Nat → F.K} (h : ∀ p, f p = f' p)
include h
theorem lvF_congr (a : Nat) : lvF f a = lvF f' a := by
unfold lvF; match a with
| 0 => rfl
| a + 1 => exact h a
theorem rvF_congr (a d r : Nat) : rvF f a d r = rvF f' a d r := by
unfold rvF; match r with
| 0 => rfl
| _ + 1 => exact h _
theorem bvF_congr (o : Option F.K) (a d : Nat) : bvF f o a d = bvF f' o a d := by
unfold bvF; match d with
| 0 => match o with
| some _ => rfl
| none => exact lvF_congr h a
| d + 1 => exact h _
theorem loB_congr (o : Option F.K) (a d r : Nat) : loB f o a d r = loB f' o a d r := by
unfold loB; match d with
| 0 => rw [bvF_congr h, rvF_congr h]
| _ + 1 => exact h a
theorem hiB_congr (o : Option F.K) (a d c r : Nat) : hiB f o a d c r = hiB f' o a d c r := by
cases c with
| zero =>
cases d with
| zero =>
show mid (bvF f o a 0) (rvF f a 0 r) = mid (bvF f' o a 0) (rvF f' a 0 r)
rw [bvF_congr h, rvF_congr h]
| succ d => show bvF f o a (d + 1) = bvF f' o a (d + 1); exact bvF_congr h o a _
| succ c =>
show chain (bvF f o a d) (rvF f a d r) c = chain (bvF f' o a d) (rvF f' a d r) c
rw [bvF_congr h, rvF_congr h]
end Cg
/-! ## separation in numbers -/
theorem ok_none {f : Nat → F.K} {a d r : Nat} : OvOK f none a d r := fun _ _ e => by cases e
/-- with inputs to the second box, the canonical data separate -/
theorem sep_inputs {f : Nat → F.K} {x d1 c1 m d y : Nat} (hf : Inc f (x + d1 + (m + (d + 1) + y))) (o : Option F.K) :
F.lt (hiB f none x d1 c1 (m + (d + 1) + y)) (loB (nextF f none x d1 c1 (m + (d + 1) + y)) o (x + c1 + m) (d + 1) y) := by
have hlt := hiB_lt_rv (c := c1) hf ok_none
have rvE : rvF f x d1 (m + (d + 1) + y) = f (x + d1) := by
rw [show m + (d + 1) + y = (m + d + y) + 1 by rw [← Nat.add_assoc, Nat.add_right_comm]]; rfl
rw [rvE] at hlt
show F.lt _ (nextF f none x d1 c1 (m + (d + 1) + y) (x + c1 + m))
rw [nextF_R m]
exact lt_of_lt_of_le F hlt (le_of_mono hf (Nat.le_add_right _ _)
(Nat.add_lt_add_left (Nat.lt_of_lt_of_le (Nat.lt_add_of_pos_right (Nat.succ_pos d)) (Nat.le_add_right _ _)) _))
/-- with something between the boxes, the canonical data separate -/
theorem sep_between {f : Nat → F.K} {x d1 c1 m y : Nat} (hf : Inc f (x + d1 + (m + 1 + 0 + y))) :
F.lt (hiB f none x d1 c1 (m + 1 + 0 + y)) (loB (nextF f none x d1 c1 (m + 1 + 0 + y)) none (x + c1 + (m + 1)) 0 y) := by
have hlt := hiB_lt_rv (c := c1) hf ok_none
have inc1 : Inc (nextF f none x d1 c1 (m + 1 + 0 + y)) (x + c1 + (m + 1) + 0 + y) := by
have := next_inc (c := c1) hf ok_none
rw [show x + c1 + (m + 1 + 0 + y) = x + c1 + (m + 1) + 0 + y by rw [ass4]] at this; exact this
have blt := bv_lt_rv (o := none) inc1 ok_none
have lv : lvF (nextF f none x d1 c1 (m + 1 + 0 + y)) (x + c1 + (m + 1)) = f (x + d1 + m) := by
show nextF f none x d1 c1 (m + 1 + 0 + y) (x + c1 + m) = _; exact nextF_R m
have rvE : rvF f x d1 (m + 1 + 0 + y) = f (x + d1) := by
rw [show m + 1 + 0 + y = (m + y) + 1 by rw [Nat.add_zero, Nat.add_right_comm]]; rfl
rw [rvE] at hlt
have l2 : le F (f (x + d1)) (f (x + d1 + m)) := le_of_mono hf (Nat.le_add_right _ _)
(Nat.add_lt_add_left (Nat.lt_of_lt_of_le (Nat.lt_succ_self m) (Nat.le_trans (Nat.le_add_right _ 0) (Nat.le_add_right _ _))) _)
have blt' : F.lt (f (x + d1 + m)) (rvF (nextF f none x d1 c1 (m + 1 + 0 + y)) (x + c1 + (m + 1)) 0 y) := by
rw [← lv]; exact blt
have e : bvF (nextF f none x d1 c1 (m + 1 + 0 + y)) none (x + c1 + (m + 1)) 0 = f (x + d1 + m) := lv
exact F.trans _ _ _ (lt_of_lt_of_le F hlt l2) (by rw [← e]; exact (mid_in blt).1)
/-- with nothing between and no inputs to the second box, the first bar end is an admissible given value and separates -/
theorem sep_given {f : Nat → F.K} {x d1 c1 y : Nat} (hf : Inc f (x + d1 + (0 + 0 + y))) :
OvOK (nextF f none x d1 c1 (0 + 0 + y)) (some (hiB f none x d1 c1 (0 + 0 + y))) (x + c1 + 0) 0 y ∧
F.lt (hiB f none x d1 c1 (0 + 0 + y)) (loB (nextF f none x d1 c1 (0 + 0 + y)) (some (hiB f none x d1 c1 (0 + 0 + y))) (x + c1 + 0) 0 y) := by
have hlt := hiB_lt_rv (c := c1) hf ok_none
have vr : F.lt (hiB f none x d1 c1 (0 + 0 + y)) (rvF (nextF f none x d1 c1 (0 + 0 + y)) (x + c1 + 0) 0 y) := by
match y, hf, hlt with
| 0, _, hlt => exact hlt
| y' + 1, hf, hlt =>
show F.lt _ (nextF f none x d1 c1 (0 + 0 + (y' + 1)) (x + c1 + 0 + 0))
rw [show x + c1 + 0 + 0 = x + c1 + 0 from rfl, nextF_R 0]
exact hlt
have lvv : le F (lvF (nextF f none x d1 c1 (0 + 0 + y)) (x + c1 + 0)) (hiB f none x d1 c1 (0 + 0 + y)) := by
match c1 with
| c + 1 =>
show le F (nextF f none x d1 (c + 1) (0 + 0 + y) (x + c)) _
rw [nextF_O (Nat.lt_succ_self c)]; exact .inr rfl
| 0 =>
match x, hf with
| 0, hf => exact le_trans' (bv_nn hf ok_none) (bv_le_hiB hf ok_none)
| x' + 1, hf =>
show le F (nextF f none (x' + 1) d1 0 (0 + 0 + y) x') _
rw [nextF_L (Nat.lt_succ_self x')]
exact .inl (lt_of_lt_of_le F (bar_L hf ok_none (Nat.lt_succ_self x')) (bar_lh (c := 0) hf ok_none))
refine ⟨fun _ v e => by cases e; exact ⟨lvv, vr⟩, ?_⟩
show F.lt _ (mid _ _)
exact (mid_in vr).1
/-! ## separated data for an interchange -/
/-- the given value: when nothing lies between the boxes, the second box's outputs start at the first box's bar end -/
def ovI (A : Ob) (D : List (Ly S)) (i : Nat) (M : Ob) : Nat → Option F.K :=
match M with
| [] => ovAt (i + 1) (hic A D (fun _ => none) i)
| _ :: _ => fun _ => none
theorem ovI_ne (A : Ob) (D : List (Ly S)) (i : Nat) (M : Ob) {j : Nat} (h : j ≠ i + 1) : ovI (F := F) A D i M j = none := by
unfold ovI
match M with
| [] => exact ovAt_ne h
| _ :: _ => rfl
theorem ovI_cases (A : Ob) (D : List (Ly S)) (i : Nat) (M : Ob) :
(M.length = 0 ∧ ovI (F := F) A D i M (i + 1) = some (hic A D (fun _ => none) i)) ∨
(∃ m', M.length = m' + 1 ∧ ovI (F := F) A D i M (i + 1) = none) :=
match M with
| [] => .inl ⟨rfl, ovAt_eq _ _⟩
| _ :: M' => .inr ⟨M'.length, rfl, rfl⟩
section I
variable {A B : Ob} (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S))
(hD : DTy (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) A B)
local notation "DL" => P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T
theorem xvI (k : Nat) (hk : k ≤ P.length + 1) (p : Nat) :
xv A DL (ovI (F := F) A DL P.length M) k p = xv A DL (fun _ => none) k p :=
xv_agree A _ k (fun _ hj => ovI_ne A _ _ M (Nat.ne_of_lt (Nat.lt_of_lt_of_le hj hk))) p
include hD
theorem sep_data : OvAll A DL (ovI (F := F) A DL P.length M) ∧
F.lt (hic A DL (ovI A DL P.length M) P.length) (loc A DL (ovI A DL P.length M) (P.length + 1)) := by
have l1 := gL1 P X M Y g1 g2 T
have l2 := gL2 P X M Y g1 g2 T
have hN := lenN P X M Y g1 g2 T
have iN' := iN P X M Y g1 g2 T
have inc0 : Inc (xv A DL (fun _ => (none : Option F.K)) P.length) (X.length + (S.dom g1).length + (M ++ S.dom g2 ++ Y).length) := by
have := xv_inc (F := F) (fun _ => none) hD ov_none P.length iN'
rw [len_in hD l1] at this; exact this
have ok0 : OvOK (xv A DL (fun _ => (none : Option F.K)) P.length) none X.length (S.dom g1).length (M ++ S.dom g2 ++ Y).length :=
fun _ _ e => by cases e
-- the level i + 1 values (with or without the given value: they agree there)
have fE : ∀ p, xv A DL (ovI A DL P.length M) (P.length + 1) p =
nextF (xv A DL (fun _ => (none : Option F.K)) P.length) none X.length (S.dom g1).length (S.cod g1).length (M ++ S.dom g2 ++ Y).length p :=
fun p => by rw [xvI P X M Y g1 g2 T _ (Nat.le_refl _), xv_some A DL _ l1]; rfl
have inc1 : Inc (nextF (xv A DL (fun _ => (none : Option F.K)) P.length) none X.length (S.dom g1).length (S.cod g1).length
(M ++ S.dom g2 ++ Y).length) (X.length + (S.cod g1).length + (M ++ S.dom g2 ++ Y).length) := next_inc inc0 ok0
-- the bar end of the first box
have hiE : hic A DL (ovI A DL P.length M) P.length =
hiB (xv A DL (fun _ => (none : Option F.K)) P.length) none X.length (S.dom g1).length (S.cod g1).length (M ++ S.dom g2 ++ Y).length := by
rw [hic_some A DL _ l1, ovI_ne A _ _ M (Nat.ne_of_lt (Nat.lt_succ_self _))]
exact hiB_congr (fun p => xvI P X M Y g1 g2 T P.length (Nat.le_succ _) p) _ _ _ _ _
have hlt := hiB_lt_rv (c := (S.cod g1).length) inc0 ok0
have hiv : hic A DL (fun _ => (none : Option F.K)) P.length =
hiB (xv A DL (fun _ => (none : Option F.K)) P.length) none X.length (S.dom g1).length (S.cod g1).length (M ++ S.dom g2 ++ Y).length :=
hic_some A DL _ l1
-- the first right wire of the first box
have rvE : ∀ m, (M ++ S.dom g2 ++ Y).length = m + 1 →
rvF (xv A DL (fun _ => (none : Option F.K)) P.length) X.length (S.dom g1).length (M ++ S.dom g2 ++ Y).length =
xv A DL (fun _ => (none : Option F.K)) P.length (X.length + (S.dom g1).length) := fun m e => by
rw [e]; rfl
have e1 : (M ++ S.dom g2 ++ Y).length = M.length + (S.dom g2).length + Y.length := len3 _ _ _
have e2 : (ly2 X M Y g1 g2).L.length = X.length + (S.cod g1).length + M.length := len3 _ _ _
rw [e1] at inc0 fE hiE hiv
have hlo : loc A DL (ovI A DL P.length M) (P.length + 1) =
loB (nextF (xv A DL (fun _ => (none : Option F.K)) P.length) none X.length (S.dom g1).length (S.cod g1).length
(M.length + (S.dom g2).length + Y.length)) (ovI A DL P.length M (P.length + 1))
(X.length + (S.cod g1).length + M.length) (S.dom g2).length Y.length := by
rw [loc_some A DL _ l2, loB_congr fE, e2]; rfl
refine ⟨fun k l hl => ?_, ?_⟩
· match Nat.decEq k (P.length + 1) with
| isFalse hk => exact fun _ v e => by rw [ovI_ne A _ _ M hk] at e; cases e
| isTrue hk =>
subst hk
rw [l2] at hl; cases hl
intro hd v e
match ovI_cases (F := F) A DL P.length M with
| .inr ⟨_, _, hov⟩ => rw [hov] at e; cases e
| .inl ⟨hM0, hov⟩ =>
rw [hov] at e; cases e
have hd' : (S.dom g2).length = 0 := hd
rw [hd', hM0] at inc0 fE hiv
have sg := (sep_given (c1 := (S.cod g1).length) inc0).1 rfl _ rfl
rw [hiv]
show le F (lvF _ (X ++ S.cod g1 ++ M).length) _ ∧ F.lt _ (rvF _ (X ++ S.cod g1 ++ M).length (S.dom g2).length Y.length)
rw [lvF_congr fE, rvF_congr fE, hd', len3, hM0]
exact sg
· rw [hiE, hlo]
match hd : (S.dom g2).length with
| d + 1 =>
rw [hd] at inc0
exact sep_inputs inc0 _
| 0 =>
rw [hd] at inc0
match ovI_cases (F := F) A DL P.length M with
| .inl ⟨hM0, hov⟩ =>
rw [hM0] at inc0 ⊢
rw [hd, hM0] at hiv
have sg := (sep_given (c1 := (S.cod g1).length) inc0).2
rw [hov, hiv]; exact sg
| .inr ⟨m', hm, hov⟩ =>
rw [hm] at inc0 ⊢
rw [hov]
exact sep_between (m := m') inc0
end I
end TP
end Found
#print axioms Found.TP.hiB_lt_rv
#print axioms Found.TP.xv_agree
#print axioms Found.TP.sep_given
#print axioms Found.TP.sep_data
lean_all/found/Top34.lean
/-
T193 (topological), part 34. found/Top34 — planar isotopy of drawings:
the equivalence relation generated by horizontal motions, vertical linear
families in which no box height meets another node, two boxes passing
each other's height (the other boxes meeting nothing), and renumbering
of nodes, all between valid generic drawings. It changes the reading
only by interchange moves.
Lean 4 core only, hand-written proofs, no axioms (classical logic only as
the parameter K of the soundness theorem).
-/
import found.Top33
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
def VG (G : Drw F S) : Prop := Valid G ∧ Generic G
/-- planar isotopy -/
inductive Iso : Drw F S → Drw F S → Prop where
| hmove {G0 G1 : Drw F S} : HMove G0 G1 → VG G0 → VG G1 → Iso G0 G1
| fam {G0 G1 : Drw F S} {Fm : F.K → Drw F S} : LinFam G0 G1 Fm →
(∀ R, R < G0.nn → IsBox (G0.kind R) → BoxGen Fm G0.nn R) → VG G0 → VG G1 → Iso G0 G1
| swap {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} : Swap G0 G1 Fm P Q →
(∀ R, R < G0.nn → IsBox (G0.kind R) → R ≠ P → R ≠ Q → BoxGen Fm G0.nn R) → VG G0 → VG G1 → Iso G0 G1
| rn {G0 G1 : Drw F S} {σ τ : Nat → Nat} : IsRn σ τ G0 G1 → VG G0 → Iso G0 G1
| symm {G0 G1 : Drw F S} : Iso G0 G1 → Iso G1 G0
| trans {G0 G1 G2 : Drw F S} : Iso G0 G1 → Iso G1 G2 → Iso G0 G2
theorem iso_vg {G0 G1 : Drw F S} (h : Iso G0 G1) : VG G0 ∧ VG G1 := by
induction h with
| hmove _ a b => exact ⟨a, b⟩
| fam _ _ a b => exact ⟨a, b⟩
| swap _ _ a b => exact ⟨a, b⟩
| rn hr a => exact ⟨a, valid_rn hr a.1, generic_rn hr a.2⟩
| symm _ ih => exact ⟨ih.2, ih.1⟩
| trans _ _ ih1 ih2 => exact ⟨ih1.1, ih2.2⟩
theorem iso_refl {G : Drw F S} (h : VG G) : Iso G G :=
.rn (σ := id) (τ := id) ⟨rfl, fun _ hn => ⟨hn, rfl⟩, fun _ hn => ⟨hn, rfl⟩, fun _ _ => rfl, fun _ _ => rfl, fun _ _ => rfl,
fun _ _ => rfl, fun _ _ _ _ => rfl, fun _ _ _ _ => rfl, fun _ _ => rfl, fun _ _ _ _ => rfl⟩ h
/-- isotopy changes the reading only by interchange moves -/
theorem iso_reads (K : CP.Classical') {G0 G1 : Drw F S} (h : Iso G0 G1) :
∀ D, Reads G0 D → ∃ D', Reads G1 D' ∧ DEq D D' := by
induction h with
| hmove hm a b => exact fun D hr => ⟨D, hmove_reads hm a.1 b.1 hr, .refl D⟩
| fam hf hgen _ _ => exact fun D hr => ⟨D, fam_reads0 hf hgen hr, .refl D⟩
| swap sw hgen a b => exact fun D hr => swap_reads K sw a.1 b.1 b.2 hgen hr
| rn hr a => exact fun D h => ⟨D, reads_rn hr a.1 h, .refl D⟩
| @symm G0 G1 h' ih =>
intro D hr
have vg := iso_vg h'
match reads_ex K vg.1.1 vg.1.2 with
| ⟨D0, h0⟩ => match ih D0 h0 with
| ⟨D1, h1, e⟩ => exact ⟨D0, h0, by rw [reads_uniq G1 hr h1]; exact .symm e⟩
| trans _ _ ih1 ih2 =>
intro D hr
match ih1 D hr with
| ⟨D1, h1, e1⟩ => match ih2 D1 h1 with
| ⟨D2, h2, e2⟩ => exact ⟨D2, h2, .trans e1 e2⟩
end TP
end Found
#print axioms Found.TP.iso_vg
#print axioms Found.TP.iso_refl
#print axioms Found.TP.iso_reads
lean_all/found/Top35.lean
/-
T193 (topological), part 35. found/Top35 — heights for realizing an
interchange step: interpolated heights stay admissible; in the standard
column drawing every node sits at the height of its level number; the
heights with the second box lowered to just above the previous layer are
admissible for the interchanged list.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top34
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
theorem lin_const' (c t : F.K) : lin F c c t = c := by unfold lin; lib_ring
/-- interpolated admissible heights are admissible -/
theorem hh_lin {N : Nat} {s0 s1 : F.K} {h h2 : Nat → F.K} (a : HH N s0 s1 h) (b : HH N s0 s1 h2) {t : F.K} (ht : In01 F t) :
HH N s0 s1 (fun j => lin F (h j) (h2 j) t) :=
⟨a.s01, fun j hj => by have := lin_lt F (a.lo j hj) (b.lo j hj) ht; rw [lin_const'] at this; exact this,
fun j hj => by have := lin_lt F (a.hi j hj) (b.hi j hj) ht; rw [lin_const'] at this; exact this,
fun i j hij hj => lin_lt F (a.mono i j hij hj) (b.mono i j hij hj) ht⟩
theorem natF_le {i j : Nat} (h : i ≤ j) : le F (natF F i) (natF F j) :=
match Nat.lt_or_ge i j with
| .inl l => .inl (natF_lt i j l)
| .inr g => .inr (by rw [Nat.le_antisymm h g])
/-- comparisons of the heights natF are comparisons of numbers -/
theorem natF_lt_inv {i j : Nat} (h : F.lt (natF F i) (natF F j)) : i < j :=
match Nat.lt_or_ge i j with
| .inl l => l
| .inr g => absurd h (fun l => (natF_le (F := F) g).elim (fun l2 => lt_asymm F l l2) (fun e => F.irr _ (by rw [e] at l; exact l)))
theorem natF_inj {i j : Nat} (h : natF F i = natF F j) : i = j :=
match Nat.lt_or_ge i j with
| .inl l => absurd h (lt_ne F (natF_lt i j l))
| .inr g => match Nat.lt_or_ge j i with
| .inl l => absurd h.symm (lt_ne F (natF_lt j i l))
| .inr g2 => Nat.le_antisymm g2 g
/-- the level number of a node of a column drawing -/
def lvl (A : Ob) (D : List (Ly S)) (k : Nat) : Nat := ncase A D k (fun _ => 0) (fun j _ => j + 1) (fun _ => D.length + 1)
theorem py_std (A : Ob) (D : List (Ly S)) (ξ : Nat × Nat → F.K) (lo hi : Nat → F.K) (k : Nat) :
(col A D (natF F 0) (natF F (D.length + 1)) (fun j => natF F (j + 1)) ξ lo hi).py k = natF F (lvl A D k) := by
unfold lvl
match ncases A D k with
| .inl h1 => rw [py_src A D _ _ _ ξ lo hi h1, nc_src A D _ _ _ h1]
| .inr (.inl ⟨j, l, hl, e1⟩) => subst e1; rw [py_box A D _ _ _ ξ lo hi hl, nc_box A D _ _ _ hl]
| .inr (.inr ⟨s, e1⟩) => subst e1; rw [py_snk A D _ _ _ ξ lo hi, nc_snk A D]
/-- a node at level j + 1 ≤ the number of layers is the box of layer j -/
theorem lvl_box (A : Ob) (D : List (Ly S)) {k j : Nat} (hj : j < D.length) (h : lvl A D k = j + 1) : k = A.length + j := by
unfold lvl at h
match ncases A D k with
| .inl h1 => rw [nc_src A D _ _ _ h1] at h; exact absurd h (fun e => Nat.noConfusion e)
| .inr (.inl ⟨j', l, hl, e1⟩) =>
subst e1; rw [nc_box A D _ _ _ hl] at h
rw [Nat.succ.inj h]
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [nc_snk A D] at h
exact absurd (Nat.succ.inj h) (fun e => Nat.lt_irrefl _ (by rw [e] at hj; exact hj))
theorem lvl_le (A : Ob) (D : List (Ly S)) (k : Nat) : lvl A D k ≤ D.length + 1 := by
unfold lvl
match ncases A D k with
| .inl h1 => rw [nc_src A D _ _ _ h1]; exact Nat.zero_le _
| .inr (.inl ⟨j, l, hl, e1⟩) => subst e1; rw [nc_box A D _ _ _ hl]; exact Nat.succ_le_succ (Nat.le_of_lt (lget_some_lt D j hl))
| .inr (.inr ⟨s, e1⟩) => subst e1; rw [nc_snk A D]; exact Nat.le_refl _
theorem lvl_boxv (A : Ob) (D : List (Ly S)) (j : Nat) {l : Ly S} (hl : lget D j = some l) : lvl A D (A.length + j) = j + 1 := by
unfold lvl; rw [nc_box A D _ _ _ hl]
/-! ## the lowered heights -/
/-- the height just above level i (between i and i + 1) -/
def vlow (F : OF) (i : Nat) : F.K := mid (natF F i) (natF F (i + 1))
theorem vlow_in (i : Nat) : F.lt (natF F i) (vlow F i) ∧ F.lt (vlow F i) (natF F (i + 1)) := mid_in (natF_step i)
/-- standard heights except layer i + 1 lowered to just above level i -/
def hlow (F : OF) (i : Nat) (j : Nat) : F.K :=
match Nat.decEq j (i + 1) with
| isTrue _ => vlow F i
| isFalse _ => natF F (j + 1)
theorem hlow_ne {i j : Nat} (h : j ≠ i + 1) : hlow F i j = natF F (j + 1) := by
unfold hlow
match Nat.decEq j (i + 1) with
| isTrue e => exact absurd e h
| isFalse _ => rfl
theorem hlow_eq (i : Nat) : hlow F i (i + 1) = vlow F i := by
unfold hlow
match Nat.decEq (i + 1) (i + 1) with
| isTrue _ => rfl
| isFalse h => exact absurd rfl h
/-- after the exchange, the lowered box comes first: admissible heights for the interchanged list -/
theorem hh_low {N i : Nat} : HH N (natF F 0) (natF F (N + 1)) (fun j => hlow F i (tau i j)) := by
have val : ∀ j, (j = i ∧ hlow F i (tau i j) = vlow F i) ∨ (j = i + 1 ∧ hlow F i (tau i j) = natF F (i + 1)) ∨
(j ≠ i ∧ j ≠ i + 1 ∧ hlow F i (tau i j) = natF F (j + 1)) := fun j =>
match Nat.decEq j i with
| isTrue e => .inl ⟨e, by rw [e, tau_s, hlow_eq]⟩
| isFalse n1 => match Nat.decEq j (i + 1) with
| isTrue e => .inr (.inl ⟨e, by rw [e, tau_s1, hlow_ne (Nat.ne_of_lt (Nat.lt_succ_self i))]⟩)
| isFalse n2 => .inr (.inr ⟨n1, n2, by rw [tau_o n1 n2, hlow_ne n2]⟩)
have vb := vlow_in (F := F) i
have top : ∀ j, j < N → F.lt (natF F (j + 1)) (natF F (N + 1)) := fun j hj => natF_lt _ _ (Nat.succ_lt_succ hj)
refine ⟨natF_lt _ _ (Nat.zero_lt_succ _), fun j _ => ?_, fun j hj => ?_, fun a b hab hb => ?_⟩
· match val j with
| .inl ⟨_, e⟩ => rw [e]; exact lt_of_le_of_lt F (natF_le (Nat.zero_le _)) vb.1
| .inr (.inl ⟨_, e⟩) => rw [e]; exact natF_lt _ _ (Nat.zero_lt_succ _)
| .inr (.inr ⟨_, _, e⟩) => rw [e]; exact natF_lt _ _ (Nat.zero_lt_succ _)
· match val j with
| .inl ⟨e0, e⟩ => rw [e]; rw [e0] at hj; exact F.trans _ _ _ vb.2 (top i hj)
| .inr (.inl ⟨e0, e⟩) => rw [e]; rw [e0] at hj; exact top i (Nat.lt_trans (Nat.lt_succ_self i) hj)
| .inr (.inr ⟨_, _, e⟩) => rw [e]; exact top j hj
· match val a, val b with
| .inl ⟨ea, e1⟩, .inl ⟨eb, _⟩ => rw [ea, eb] at hab; exact absurd hab (Nat.lt_irrefl _)
| .inl ⟨_, e1⟩, .inr (.inl ⟨_, e2⟩) => rw [e1, e2]; exact vb.2
| .inl ⟨ea, e1⟩, .inr (.inr ⟨n1, n2, e2⟩) =>
rw [e1, e2]; rw [ea] at hab
exact F.trans _ _ _ vb.2 (natF_lt _ _ (Nat.succ_lt_succ hab))
| .inr (.inl ⟨ea, _⟩), .inl ⟨eb, _⟩ => rw [ea, eb] at hab; exact absurd (Nat.lt_trans (Nat.lt_succ_self i) hab) (Nat.lt_irrefl _)
| .inr (.inl ⟨ea, _⟩), .inr (.inl ⟨eb, _⟩) => rw [ea, eb] at hab; exact absurd hab (Nat.lt_irrefl _)
| .inr (.inl ⟨ea, e1⟩), .inr (.inr ⟨_, _, e2⟩) =>
rw [e1, e2]; rw [ea] at hab; exact natF_lt _ _ (Nat.lt_trans (Nat.lt_succ_self _) (Nat.succ_lt_succ hab))
| .inr (.inr ⟨na, _, e1⟩), .inl ⟨eb, e2⟩ =>
rw [e1, e2]; rw [eb] at hab
exact lt_of_le_of_lt F (natF_le (Nat.succ_le_of_lt hab)) vb.1
| .inr (.inr ⟨na, _, e1⟩), .inr (.inl ⟨eb, e2⟩) =>
rw [e1, e2]; rw [eb] at hab
exact natF_lt _ _ (Nat.succ_lt_succ (Nat.lt_of_le_of_ne (Nat.le_of_lt_succ hab) na))
| .inr (.inr ⟨_, _, e1⟩), .inr (.inr ⟨_, _, e2⟩) => rw [e1, e2]; exact natF_lt _ _ (Nat.succ_lt_succ hab)
end TP
end Found
#print axioms Found.TP.hh_lin
#print axioms Found.TP.py_std
#print axioms Found.TP.lvl_box
#print axioms Found.TP.hh_low
lean_all/found/Top36.lean
/-
T193 (topological), part 36. found/Top36 — every interchange step is
realized by a planar isotopy of the standard column drawings:
standard drawing of D —(horizontal motion)→ separated data —(the second
box moves down past the first)→ a drawing which is a renumbering of a
column drawing of D' —(vertical family, no events)→ standard heights
—(horizontal motion)→ standard drawing of D'.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top35
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- the drawing with separated data, and with the second box lowered -/
def G0s (F : OF) (A : Ob) (D : List (Ly S)) (i : Nat) (M : Ob) : Drw F S :=
col A D (natF F 0) (natF F (D.length + 1)) (fun j => natF F (j + 1)) (xic A D (ovI A D i M)) (loc A D (ovI A D i M)) (hic A D (ovI A D i M))
def G1s (F : OF) (A : Ob) (D : List (Ly S)) (i : Nat) (M : Ob) : Drw F S :=
col A D (natF F 0) (natF F (D.length + 1)) (hlow F i) (xic A D (ovI A D i M)) (loc A D (ovI A D i M)) (hic A D (ovI A D i M))
section I
variable {A B : Ob} (P : List (Ly S)) (X M Y : Ob) (g1 g2 : S.G) (T : List (Ly S))
(hD : DTy (P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T) A B)
local notation "DL" => P ++ ly1 X M Y g1 g2 :: ly2 X M Y g1 g2 :: T
local notation "DR" => P ++ ly2' X M Y g1 g2 :: ly1' X M Y g1 g2 :: T
local notation "SS" => A.length + P.length
local notation "OV" => ovI (F := F) A DL P.length M
local notation "XS" => xic A DL OV
local notation "LS" => loc A DL OV
local notation "HS" => hic A DL OV
local notation "N1" => natF F (List.length (DL) + 1)
include hD
theorem goodS : Good A DL XS LS HS := good_c _ hD (sep_data P X M Y g1 g2 T hD).1
theorem goodR : Good A DR (fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j)) :=
good_istep P X M Y g1 g2 T hD (goodS P X M Y g1 g2 T hD) (sep_data P X M Y g1 g2 T hD).2
omit hD in
theorem hhR : HH (DR).length (natF F 0) N1 (fun j => hlow F P.length (tau P.length j)) := by
rw [lenLR P X M Y g1 g2 T]; exact hh_low
theorem vgR1 : VG (col A DR (natF F 0) N1 (fun j => hlow F P.length (tau P.length j))
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j))) :=
⟨valid_col (hDR P X M Y g1 g2 T hD) (hhR P X M Y g1 g2 T) (goodR P X M Y g1 g2 T hD), generic_col (hhR P X M Y g1 g2 T)⟩
theorem rnS : IsRn (tau SS) (tau SS)
(col A DR (natF F 0) N1 (fun j => hlow F P.length (tau P.length j))
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j)))
(G1s F A DL P.length M) :=
rn_istep P X M Y g1 g2 T hD (natF F 0) N1 (hlow F P.length) XS LS HS
theorem vg0 : VG (G0s F A DL P.length M) :=
⟨valid_col hD (hh_std _) (goodS P X M Y g1 g2 T hD), generic_col (hh_std _)⟩
theorem vg1 : VG (G1s F A DL P.length M) :=
⟨valid_rn (rnS P X M Y g1 g2 T hD) (vgR1 P X M Y g1 g2 T hD).1, generic_rn (rnS P X M Y g1 g2 T hD) (vgR1 P X M Y g1 g2 T hD).2⟩
omit hD in
theorem pyG0 (k : Nat) : (G0s F A DL P.length M).py k = natF F (lvl A DL k) := py_std A DL _ _ _ k
omit hD in
theorem pyG1 {k : Nat} (hk : k ≠ A.length + (P.length + 1)) : (G1s F A DL P.length M).py k = (G0s F A DL P.length M).py k := by
match ncases A DL k with
| .inl h1 => exact (py_src A DL _ _ _ _ _ _ h1).trans (py_src A DL _ _ _ _ _ _ h1).symm
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1
have hj : j ≠ P.length + 1 := fun e => hk (by rw [e])
show (col A DL _ _ (hlow F P.length) _ _ _).py _ = (col A DL _ _ (fun j => natF F (j + 1)) _ _ _).py _
rw [py_box A DL _ _ _ _ _ _ hl, py_box A DL _ _ _ _ _ _ hl, hlow_ne hj]
| .inr (.inr ⟨s, e1⟩) =>
subst e1; exact (py_snk A DL _ _ _ _ _ _ s).trans (py_snk A DL _ _ _ _ _ _ s).symm
omit hD in
theorem pyG1Q : (G1s F A DL P.length M).py (A.length + (P.length + 1)) = vlow F P.length := by
show (col A DL _ _ (hlow F P.length) _ _ _).py _ = _
rw [py_box A DL _ _ _ _ _ _ (gL2 P X M Y g1 g2 T), hlow_eq]
omit hD in
theorem lvl_P : lvl A DL (A.length + P.length) = P.length + 1 := lvl_boxv A DL _ (gL1 P X M Y g1 g2 T)
omit hD in
theorem lvl_Q : lvl A DL (A.length + (P.length + 1)) = P.length + 2 := lvl_boxv A DL _ (gL2 P X M Y g1 g2 T)
omit hD in
/-- nodes other than the two boxes are below level i + 1 or above level i + 2 -/
theorem lvl_other {k : Nat} (h1 : k ≠ A.length + P.length) (h2 : k ≠ A.length + (P.length + 1)) :
lvl A DL k ≤ P.length ∨ P.length + 3 ≤ lvl A DL k := by
have hN := lenN P X M Y g1 g2 T
match Nat.lt_or_ge (lvl A DL k) (P.length + 1) with
| .inl l => exact .inl (Nat.le_of_lt_succ l)
| .inr g =>
match Nat.decEq (lvl A DL k) (P.length + 1) with
| isTrue e => exact absurd (lvl_box A DL (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.le_trans (Nat.le_succ _) hN)) e) h1
| isFalse n1 =>
match Nat.decEq (lvl A DL k) (P.length + 2) with
| isTrue e => exact absurd (lvl_box A DL (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hN) e) h2
| isFalse n2 =>
exact .inr (Nat.succ_le_of_lt (Nat.lt_of_le_of_ne (Nat.succ_le_of_lt (Nat.lt_of_le_of_ne g (fun e => n1 e.symm)))
(fun e => n2 e.symm)))
omit hD in
/-- the lowered box never meets the height of another node on its way -/
theorem path_off {k : Nat} (h1 : k ≠ A.length + P.length) (h2 : k ≠ A.length + (P.length + 1))
{H : F.K} (hH1 : le F (vlow F P.length) H) (hH2 : le F H (natF F (P.length + 2))) : H ≠ (G0s F A DL P.length M).py k := by
rw [pyG0 P X M Y g1 g2 T]
intro e
rw [e] at hH1 hH2
match lvl_other P X M Y g1 g2 T h1 h2 with
| .inl l => exact absurd (lt_of_lt_of_le F (lt_of_le_of_lt F (natF_le l) (vlow_in P.length).1) hH1) (F.irr _)
| .inr g => exact absurd (lt_of_le_of_lt F hH2 (natF_lt _ _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) g))) (F.irr _)
theorem vm : VM1 (G0s F A DL P.length M) (G1s F A DL P.length M) (A.length + (P.length + 1)) where
nn := rfl
kind := rfl
px := rfl
tgt := rfl
src := rfl
wd := rfl
ox := rfl
ix := rfl
pyo k hk := pyG1 P X M Y g1 g2 T hk
down := by
rw [pyG1Q P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T, lvl_Q P X M Y g1 g2 T]
exact F.trans _ _ _ (vlow_in P.length).2 (natF_step _)
vert e he := by
have op := (seg_col A DL _ _ _ _ _ _ e).1 he
match op_bw op with
| ⟨b, p, hb, hp, eb⟩ =>
subst eb
unfold G0s
rw [xs_col A DL _ _ _ _ _ _ op, xt_col A DL _ _ _ _ _ _ hD hb hp]
v0 := (vg0 P X M Y g1 g2 T hD).1
v1 := (vg1 P X M Y g1 g2 T hD).1
trap e he h1 h2 hle1 hle2 := by
have hN := lenN P X M Y g1 g2 T
rw [pyG1Q P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T] at hle1
rw [pyG0 P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T, lvl_Q P X M Y g1 g2 T] at hle2
have pr := (vg0 P X M Y g1 g2 T hD).1.prog e he
rw [pyG0 P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T] at pr
have ab := natF_lt_inv pr
have a1 : P.length + 1 ≤ lvl A DL e.1 := match Nat.lt_or_ge (lvl A DL e.1) (P.length + 1) with
| .inl l => absurd (lt_of_le_of_lt F (natF_le (Nat.le_of_lt_succ l)) (vlow_in P.length).1) (fun h' =>
(hle1.elim (fun l2 => lt_asymm F l2 h') (fun e2 => F.irr _ (by rw [e2] at h'; exact h'))))
| .inr g => g
have b1 : lvl A DL (hiN (G0s F A DL P.length M) e) ≤ P.length + 2 := match Nat.lt_or_ge (P.length + 2) (lvl A DL (hiN (G0s F A DL P.length M) e)) with
| .inl l => absurd (natF_lt (F := F) _ _ l) (fun h' => hle2.elim (fun l2 => lt_asymm F l2 h') (fun e2 => F.irr _ (by rw [e2] at h'; exact h')))
| .inr g => g
have b2 : lvl A DL (hiN (G0s F A DL P.length M) e) ≠ P.length + 2 := fun e2 =>
h2 (lvl_box A DL (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hN) e2)
exact absurd (Nat.lt_of_le_of_lt a1 (Nat.lt_of_lt_of_le ab (Nat.le_of_lt_succ (Nat.lt_of_le_of_ne b1 b2)))) (Nat.lt_irrefl _)
pts k hk hkQ hlt1 hlt2 := by
have hN := lenN P X M Y g1 g2 T
rw [pyG1Q P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T] at hlt1
rw [pyG0 P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T, lvl_Q P X M Y g1 g2 T] at hlt2
have l1 : P.length + 1 ≤ lvl A DL k := match Nat.lt_or_ge (lvl A DL k) (P.length + 1) with
| .inl l => absurd (lt_of_le_of_lt F (natF_le (Nat.le_of_lt_succ l)) (vlow_in P.length).1) (lt_asymm F hlt1)
| .inr g => g
have l2 := natF_lt_inv hlt2
have e := Nat.le_antisymm (Nat.le_of_lt_succ l2) l1
have hkP := lvl_box A DL (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.le_trans (Nat.le_succ _) hN)) e
subst hkP
refine .inr ?_
show F.lt (xr (col A DL _ _ _ _ _ _) _) ((col A DL _ _ _ _ _ _).px _)
rw [xr_box (gL1 P X M Y g1 g2 T), px_box A DL _ _ _ _ _ _ (gL2 P X M Y g1 g2 T)]
exact (sep_data P X M Y g1 g2 T hD).2
theorem swapS : Swap (G0s F A DL P.length M) (G1s F A DL P.length M) (vfam (G0s F A DL P.length M) (G1s F A DL P.length M))
(A.length + P.length) (A.length + (P.length + 1)) := by
have hN := lenN P X M Y g1 g2 T
have v := vm (F := F) P X M Y g1 g2 T hD
have g0 := (vg0 (F := F) P X M Y g1 g2 T hD).2
have nnB : ∀ j, j < (DL).length → A.length + j < (G0s F A DL P.length M).nn := fun j hj => by
show A.length + j < A.length + (DL).length + _
rw [Nat.add_assoc]; exact Nat.add_lt_add_left (Nat.lt_of_lt_of_le hj (Nat.le_add_right _ _)) _
have hPn := nnB P.length (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) (Nat.le_trans (Nat.le_succ _) hN))
have hQn := nnB (P.length + 1) (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hN)
have PQ : A.length + P.length ≠ A.length + (P.length + 1) := fun e => Nat.succ_ne_self _ (addLC2 _ e).symm
have bP : IsBox ((G0s F A DL P.length M).kind (A.length + P.length)) := by
show IsBox (ckind A DL _); rw [ckind_box A DL (gL1 P X M Y g1 g2 T)]; trivial
exact {
fam := vm1_fam v
hP := hPn
hQ := hQn
bP := bP
bQ := by show IsBox (ckind A DL _); rw [ckind_box A DL (gL2 P X M Y g1 g2 T)]; trivial
ne := PQ
gP := fun t ht k hk h1 h2 => by
rw [pyt_ne v PQ, pyt_ne v h2]
exact g0 _ k hPn hk bP (fun e => h1 e.symm)
gQ := fun t ht k hk h1 h2 => by
rw [pyt_ne v h2, pyt_Q]
have hq := HQ v ht
rw [pyG1Q P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T (A.length + (P.length + 1)), lvl_Q P X M Y g1 g2 T] at hq
have := path_off P X M Y g1 g2 T h1 h2 hq.1 hq.2
rw [pyG0 P X M Y g1 g2 T (A.length + (P.length + 1)), lvl_Q P X M Y g1 g2 T]
rw [pyG1Q P X M Y g1 g2 T]
exact this
lo0 := by
rw [pyG0 P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T, lvl_P P X M Y g1 g2 T, lvl_Q P X M Y g1 g2 T]; exact natF_step _
hi1 := by
rw [pyG1Q P X M Y g1 g2 T, pyG1 P X M Y g1 g2 T PQ, pyG0 P X M Y g1 g2 T, lvl_P P X M Y g1 g2 T]
exact (vlow_in P.length).2 }
theorem hgenS : ∀ R, R < (G0s F A DL P.length M).nn → IsBox ((G0s F A DL P.length M).kind R) → R ≠ A.length + P.length →
R ≠ A.length + (P.length + 1) → BoxGen (vfam (G0s F A DL P.length M) (G1s F A DL P.length M)) (G0s F A DL P.length M).nn R := by
have v := vm (F := F) P X M Y g1 g2 T hD
have g0 := (vg0 (F := F) P X M Y g1 g2 T hD).2
intro R hR hb h1 h2 t ht k hk hne
rw [pyt_ne v h2]
match Nat.decEq k (A.length + (P.length + 1)) with
| isTrue e =>
subst e
rw [pyt_Q]
have hq := HQ v ht
rw [pyG1Q P X M Y g1 g2 T, pyG0 P X M Y g1 g2 T (A.length + (P.length + 1)), lvl_Q P X M Y g1 g2 T] at hq
have := path_off P X M Y g1 g2 T h1 h2 hq.1 hq.2
rw [pyG0 P X M Y g1 g2 T (A.length + (P.length + 1)), lvl_Q P X M Y g1 g2 T, pyG1Q P X M Y g1 g2 T]
exact fun e => this e.symm
| isFalse nk => rw [pyt_ne v nk]; exact g0 R k hR hk hb (fun e => hne e.symm)
/-- the second box passes the first -/
theorem iso_sw : Iso (G0s F A DL P.length M) (G1s F A DL P.length M) :=
.swap (swapS P X M Y g1 g2 T hD) (hgenS P X M Y g1 g2 T hD) (vg0 P X M Y g1 g2 T hD) (vg1 P X M Y g1 g2 T hD)
/-- the standard drawing to the separated data -/
theorem iso_a : Iso (real F A DL) (G0s F A DL P.length M) :=
.hmove (hmove_col hD (hh_std _) (good_c _ hD ov_none) (goodS P X M Y g1 g2 T hD))
⟨(real_ok hD).1, (real_ok hD).2.1⟩ (vg0 P X M Y g1 g2 T hD)
omit hD in
theorem hhS : HH (DR).length (natF F 0) N1 (fun j => natF F (j + 1)) := by
rw [lenLR P X M Y g1 g2 T]; exact hh_std _
/-- the heights of D' brought back to standard, no events -/
theorem iso_d : Iso (col A DR (natF F 0) N1 (fun j => hlow F P.length (tau P.length j))
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j)))
(col A DR (natF F 0) N1 (fun j => natF F (j + 1))
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j))) := by
have hDr := hDR P X M Y g1 g2 T hD
have gR := goodR (F := F) P X M Y g1 g2 T hD
have hR := hhR (F := F) P X M Y g1 g2 T
have hS := hhS (F := F) P X M Y g1 g2 T
have vgS : VG (col A DR (natF F 0) N1 (fun j => natF F (j + 1))
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j))) :=
⟨valid_col hDr hS gR, generic_col hS⟩
refine .fam (Fm := fun t => col A DR (natF F 0) N1 (fun j => lin F (hlow F P.length (tau P.length j)) (natF F (j + 1)) t)
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j)))
⟨fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl,
rfl, rfl, rfl, rfl, rfl, rfl, rfl, fun t k => ?_, fun t e Q he => ?_, fun t ht => valid_col hDr (hh_lin hR hS ht) gR⟩
(fun R _ hb t ht k hk hne => generic_col (hh_lin hR hS ht) R k (by exact ‹R < _›) hk hb (fun e => hne e.symm))
(vgR1 P X M Y g1 g2 T hD) vgS
· match ncases A DR k with
| .inl h1 =>
rw [py_src A DR _ _ _ _ _ _ h1, py_src A DR _ _ _ _ _ _ h1, py_src A DR _ _ _ _ _ _ h1, lin_const']
| .inr (.inl ⟨j, l, hl, e1⟩) =>
subst e1; rw [py_box A DR _ _ _ _ _ _ hl, py_box A DR _ _ _ _ _ _ hl, py_box A DR _ _ _ _ _ _ hl]
| .inr (.inr ⟨s, e1⟩) =>
subst e1; rw [py_snk A DR _ _ _ _ _ _ s, py_snk A DR _ _ _ _ _ _ s, py_snk A DR _ _ _ _ _ _ s, lin_const']
· have op := (seg_col A DR _ _ _ _ _ _ e).1 he
rw [X_op hDr op, X_op hDr op, X_op hDr op, lin_const']
/-- every interchange step in explicit form is realized by an isotopy -/
theorem iso_form : Iso (real F A DL) (real F A DR) := by
have hDr := hDR P X M Y g1 g2 T hD
have gR := goodR (F := F) P X M Y g1 g2 T hD
have e : Iso (col A DR (natF F 0) N1 (fun j => natF F (j + 1))
(fun e => XS (tw SS e)) (fun j => LS (tau P.length j)) (fun j => HS (tau P.length j)))
(col A DR (natF F 0) N1 (fun j => natF F (j + 1))
(xic A DR (fun _ => none)) (loc A DR (fun _ => none)) (hic A DR (fun _ => none))) :=
.hmove (hmove_col hDr (hhS P X M Y g1 g2 T) gR (good_c _ hDr ov_none))
⟨valid_col hDr (hhS P X M Y g1 g2 T) gR, generic_col (hhS P X M Y g1 g2 T)⟩
⟨valid_col hDr (hhS P X M Y g1 g2 T) (good_c _ hDr ov_none), generic_col (hhS P X M Y g1 g2 T)⟩
have chain := Iso.trans (iso_a P X M Y g1 g2 T hD) (Iso.trans (iso_sw P X M Y g1 g2 T hD)
(Iso.trans (Iso.symm (Iso.rn (rnS P X M Y g1 g2 T hD) (vgR1 P X M Y g1 g2 T hD)))
(Iso.trans (iso_d P X M Y g1 g2 T hD) e)))
unfold real
rw [← lenLR P X M Y g1 g2 T]
exact chain
end I
end TP
end Found
#print axioms Found.TP.vg0
#print axioms Found.TP.vg1
#print axioms Found.TP.iso_sw
#print axioms Found.TP.iso_d
#print axioms Found.TP.iso_form
lean_all/found/Top37.lean
/-
T193 (topological), part 37. found/Top37 — the topological Joyal–Street
theorem (piecewise-linear, over any ordered field F): two terms of the
same type are equal in the free strict monoidal category iff the standard
plane drawings of their string diagrams are planar isotopic (generated by
horizontal motions, vertical linear families meeting nothing, two boxes
passing each other's height, and renumbering, through valid generic
drawings). With found/StrDiag2 (combinatorial version): planar isotopy of
drawings = interchange moves of diagrams = equality of terms.
Lean 4 core only, hand-written proofs, no axioms (classical logic only as
the parameter K, used for "isotopic ⇒ equal").
-/
import found.Top36
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-- every interchange step of a typed diagram is realized by an isotopy -/
theorem iso_istep {D D' : List (Ly S)} (h : IStep D D') {A B : Ob} (hD : DTy D A B) : Iso (real F A D) (real F A D') :=
match istep_form h with
| ⟨P, X, M, Y, g1, g2, T, e1, e2⟩ => by subst e1; subst e2; exact iso_form P X M Y g1 g2 T hD
/-- diagrams related by interchange moves have isotopic standard drawings -/
theorem iso_deq {D D' : List (Ly S)} (h : DEq D D') : ∀ {A B : Ob}, DTy D A B → Iso (real F A D) (real F A D') := by
induction h with
| refl D => exact fun hD => iso_refl ⟨(real_ok hD).1, (real_ok hD).2.1⟩
| step s => exact fun hD => iso_istep s hD
| symm h ih => exact fun hD => Iso.symm (ih ((deq_read h).1.2 hD))
| trans h1 _ ih1 ih2 => exact fun hD => Iso.trans (ih1 hD) (ih2 ((deq_read h1).1.1 hD))
/-- the topological Joyal–Street theorem -/
theorem topo_joyal_street (K : CP.Classical') {t u : Tm S} {A B : Ob} (ht : Ty t A B) (hu : Ty u A B) :
Eqv t u ↔ Iso (real F A (diag t)) (real F A (diag u)) :=
⟨fun h => iso_deq ((joyal_street ht hu).1 h) (diag_ty ht),
fun h => (joyal_street ht hu).2 (match iso_reads K h (diag t) (real_ok (diag_ty ht)).2.2 with
| ⟨D', hr, e⟩ => by rw [reads_uniq _ hr (real_ok (diag_ty hu)).2.2] at e; exact e)⟩
end TP
end Found
#print axioms Found.TP.iso_istep
#print axioms Found.TP.iso_deq
#print axioms Found.TP.topo_joyal_street
lean_all/found/Top4.lean
/-
T193 (topological), part 4. found/Top4 — vertical translation of a
cluster: a set C of nodes moves up or down rigidly (y_t = y + t·Δ on C),
every segment leaving C is vertical, the drawing is valid for all
t ∈ [0, 1]. Then at the height of any node, the x of any segment is
affine in t (inside C the segment translates, across the boundary it is
vertical, outside it is fixed), and so is every height. If moreover the
drawing stays generic, no comparison of the reading changes sign (the
reading is kept: found/Top15 fam_reads0 via found/Top5 vmove_fam).
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top3
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
def mv (G0 : Drw F S) (C : Nat → Bool) (Δ t : F.K) : Drw F S :=
⟨G0.nn, G0.kind, G0.px, fun k => cond (C k) (F.R.add (G0.py k) (F.R.mul t Δ)) (G0.py k), G0.tgt, G0.src,
G0.wd, G0.ox, G0.ix⟩
structure VMove (G0 G1 : Drw F S) (C : Nat → Bool) (Δ : F.K) : Prop where
nn : G1.nn = G0.nn
kind : G1.kind = G0.kind
px : G1.px = G0.px
tgt : G1.tgt = G0.tgt
src : G1.src = G0.src
wd : G1.wd = G0.wd
ox : G1.ox = G0.ox
ix : G1.ix = G0.ix
py : ∀ k, G1.py k = cond (C k) (F.R.add (G0.py k) Δ) (G0.py k)
vert : ∀ e, Seg G0 e → C e.1 ≠ C (hiN G0 e) → xs G0 e = xt G0 e
valid : ∀ t, In01 F t → Valid (mv G0 C Δ t)
gen : ∀ t, In01 F t → Generic (mv G0 C Δ t)
section V
variable {G0 G1 : Drw F S} {C : Nat → Bool} {Δ : F.K} (hm : VMove G0 G1 C Δ)
include hm
theorem py_lin (t : F.K) (k : Nat) : (mv G0 C Δ t).py k = lin F (G0.py k) (G1.py k) t := by
show cond (C k) _ _ = _
rw [hm.py k]
cases C k with
| true => show F.R.add (G0.py k) (F.R.mul t Δ) = lin F (G0.py k) (F.R.add (G0.py k) Δ) t; unfold lin; lib_ring
| false => show G0.py k = lin F (G0.py k) (G0.py k) t; unfold lin; lib_ring
theorem X_lin (t : F.K) (e : Nat × Nat) (he : Seg G0 e) (Q : Nat) :
X (mv G0 C Δ t) e ((mv G0 C Δ t).py Q) = lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) t := by
rw [X_eq, X_eq, X_eq, hm.px, hm.ox, hm.ix, hm.tgt, hm.py, hm.py, hm.py]
show Xf (G0.px e.1) (G0.ox e.1 e.2) (G0.px (G0.tgt e).1) (G0.ix (G0.tgt e).1 (G0.tgt e).2)
(cond (C e.1) (F.R.add (G0.py e.1) (F.R.mul t Δ)) (G0.py e.1))
(cond (C (G0.tgt e).1) (F.R.add (G0.py (G0.tgt e).1) (F.R.mul t Δ)) (G0.py (G0.tgt e).1))
(cond (C Q) (F.R.add (G0.py Q) (F.R.mul t Δ)) (G0.py Q)) = _
match hQ : C Q, ha : C e.1, hb : C (G0.tgt e).1 with
| true, true, true =>
show Xf _ _ _ _ (F.R.add (G0.py e.1) (F.R.mul t Δ)) (F.R.add (G0.py (G0.tgt e).1) (F.R.mul t Δ)) (F.R.add (G0.py Q) (F.R.mul t Δ)) =
lin F (Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (G0.py Q))
(Xf _ _ _ _ (F.R.add (G0.py e.1) Δ) (F.R.add (G0.py (G0.tgt e).1) Δ) (F.R.add (G0.py Q) Δ)) t
unfold Xf
rw [show sub F.R (F.R.add (G0.py (G0.tgt e).1) (F.R.mul t Δ)) (F.R.add (G0.py e.1) (F.R.mul t Δ)) =
sub F.R (G0.py (G0.tgt e).1) (G0.py e.1) by lib_ring,
show sub F.R (F.R.add (G0.py (G0.tgt e).1) Δ) (F.R.add (G0.py e.1) Δ) = sub F.R (G0.py (G0.tgt e).1) (G0.py e.1) by lib_ring]
unfold lin; lib_ring
| false, true, true =>
show Xf _ _ _ _ (F.R.add (G0.py e.1) (F.R.mul t Δ)) (F.R.add (G0.py (G0.tgt e).1) (F.R.mul t Δ)) (G0.py Q) =
lin F (Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (G0.py Q))
(Xf _ _ _ _ (F.R.add (G0.py e.1) Δ) (F.R.add (G0.py (G0.tgt e).1) Δ) (G0.py Q)) t
unfold Xf
rw [show sub F.R (F.R.add (G0.py (G0.tgt e).1) (F.R.mul t Δ)) (F.R.add (G0.py e.1) (F.R.mul t Δ)) =
sub F.R (G0.py (G0.tgt e).1) (G0.py e.1) by lib_ring,
show sub F.R (F.R.add (G0.py (G0.tgt e).1) Δ) (F.R.add (G0.py e.1) Δ) = sub F.R (G0.py (G0.tgt e).1) (G0.py e.1) by lib_ring]
unfold lin; lib_ring
| true, false, false =>
show Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (F.R.add (G0.py Q) (F.R.mul t Δ)) =
lin F (Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (G0.py Q)) (Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (F.R.add (G0.py Q) Δ)) t
unfold Xf lin; lib_ring
| false, false, false =>
show Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (G0.py Q) =
lin F (Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (G0.py Q)) (Xf _ _ _ _ (G0.py e.1) (G0.py (G0.tgt e).1) (G0.py Q)) t
unfold Xf lin; lib_ring
| _, true, false =>
have hv := hm.vert e he (by unfold hiN; rw [ha, hb]; exact fun e' => Bool.noConfusion e')
unfold xs xt hiN at hv
unfold Xf
rw [← hv]
cases C Q <;> (unfold lin; lib_ring)
| _, false, true =>
have hv := hm.vert e he (by unfold hiN; rw [ha, hb]; exact fun e' => Bool.noConfusion e')
unfold xs xt hiN at hv
unfold Xf
rw [← hv]
cases C Q <;> (unfold lin; lib_ring)
end V
/-! ## persistence along the whole interval -/
theorem lin_const (c t : F.K) : lin F c c t = c := by unfold lin; lib_ring
theorem lin_comp (a b u t : F.K) : lin F a b (F.R.mul u t) = lin F a (lin F a b t) u := by unfold lin; lib_ring
theorem le_mul_le {u t : F.K} (hu : In01 F u) (ht : In01 F t) : In01 F (F.R.mul u t) :=
⟨mul_nn F hu.1 ht.1, by
have h1 : le F F.R.zero (F.R.mul (sub F.R F.R.one u) t) := mul_nn F (hu.2.elim (fun h => .inl (sub_pos F h))
(fun e => .inr (by rw [e]; lib_ring))) ht.1
have e : F.R.mul u t = sub F.R t (F.R.mul (sub F.R F.R.one u) t) := by lib_ring
rw [e]
match h1, ht.2 with
| .inl h, h2 => exact .inl (lt_of_lt_of_le F (by
have := F.add_lt _ _ (sub F.R t (F.R.mul (sub F.R F.R.one u) t)) h
rw [show F.R.add F.R.zero (sub F.R t (F.R.mul (sub F.R F.R.one u) t)) = sub F.R t (F.R.mul (sub F.R F.R.one u) t) by lib_ring,
show F.R.add (F.R.mul (sub F.R F.R.one u) t) (sub F.R t (F.R.mul (sub F.R F.R.one u) t)) = t by lib_ring] at this
exact this) h2)
| .inr e', h2 =>
rw [← e', show sub F.R t F.R.zero = t by lib_ring]
exact h2⟩
/-- a strict comparison of affine functions without crossing holds on the whole interval -/
theorem lt_keep_at {a0 a1 b0 b1 : F.K} (h : ∀ t, In01 F t → lin F a0 a1 t ≠ lin F b0 b1 t) (h0 : F.lt a0 b0)
(t : F.K) (ht : In01 F t) : F.lt (lin F a0 a1 t) (lin F b0 b1 t) := by
have h' : ∀ u, In01 F u → lin F a0 (lin F a0 a1 t) u ≠ lin F b0 (lin F b0 b1 t) u := fun u hu e => by
rw [← lin_comp, ← lin_comp] at e
exact h _ (le_mul_le hu ht) e
exact lt_keep h' h0
end TP
end Found
#print axioms Found.TP.py_lin
#print axioms Found.TP.X_lin
#print axioms Found.TP.lt_keep_at
lean_all/found/Top5.lean
/-
T193 (topological), part 5. found/Top5 — linear families of drawings: a
family G_t (t ∈ [0, 1]) with fixed nodes and segments, heights affine in
t, and at every node height the x of every segment affine in t, valid for
all t (horizontal motions and cluster translations are such families, and
so is any restriction to a subinterval). A box whose height never meets
another node's height keeps its layer (same lists of wires left and right,
in the same order).
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top4
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
structure LinFam (G0 G1 : Drw F S) (Fm : F.K → Drw F S) : Prop where
nn : ∀ t, (Fm t).nn = G0.nn
kind : ∀ t, (Fm t).kind = G0.kind
px : ∀ t, (Fm t).px = G0.px
tgt : ∀ t, (Fm t).tgt = G0.tgt
wd : ∀ t, (Fm t).wd = G0.wd
ox : ∀ t, (Fm t).ox = G0.ox
ix : ∀ t, (Fm t).ix = G0.ix
nn1 : G1.nn = G0.nn
kind1 : G1.kind = G0.kind
px1 : G1.px = G0.px
tgt1 : G1.tgt = G0.tgt
wd1 : G1.wd = G0.wd
ox1 : G1.ox = G0.ox
ix1 : G1.ix = G0.ix
py : ∀ t k, (Fm t).py k = lin F (G0.py k) (G1.py k) t
X : ∀ t e Q, Seg G0 e → X (Fm t) e ((Fm t).py Q) = lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) t
valid : ∀ t, In01 F t → Valid (Fm t)
/-- the box j never shares its height with another node -/
def BoxGen (Fm : F.K → Drw F S) (n j : Nat) : Prop :=
∀ t, In01 F t → ∀ k, k < n → k ≠ j → (Fm t).py j ≠ (Fm t).py k
/-- cluster translations are linear families -/
theorem vmove_fam {G0 G1 : Drw F S} {C : Nat → Bool} {Δ : F.K} (hm : VMove G0 G1 C Δ) :
LinFam G0 G1 (mv G0 C Δ) :=
⟨fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl,
hm.nn, hm.kind, hm.px, hm.tgt, hm.wd, hm.ox, hm.ix,
py_lin hm, fun t e Q he => X_lin hm t e he Q, hm.valid⟩
/-! ## restriction to a subinterval -/
def subT (a b u : F.K) : F.K := F.R.add a (F.R.mul u (sub F.R b a))
theorem lin_sub (p q a b u : F.K) : lin F p q (subT a b u) = lin F (lin F p q a) (lin F p q b) u := by
unfold lin subT; lib_ring
theorem sub_in {a b u : F.K} (ha : In01 F a) (hb : In01 F b) (hu : In01 F u) : In01 F (subT a b u) := by
have e : subT a b u = lin F a b u := by unfold subT lin; lib_ring
rw [e]
have key : ∀ c, le F c a → le F c b → le F c (lin F a b u) := fun c hca hcb => by
have e2 : sub F.R (lin F a b u) c = F.R.add (F.R.mul (sub F.R F.R.one u) (sub F.R a c)) (F.R.mul u (sub F.R b c)) := by
unfold lin; lib_ring
have n1 : le F F.R.zero (sub F.R a c) := hca.elim (fun h => .inl (sub_pos F h)) (fun h => .inr (by rw [h]; lib_ring))
have n2 : le F F.R.zero (sub F.R b c) := hcb.elim (fun h => .inl (sub_pos F h)) (fun h => .inr (by rw [h]; lib_ring))
have n0 : le F F.R.zero (sub F.R F.R.one u) := hu.2.elim (fun h => .inl (sub_pos F h)) (fun h => .inr (by rw [h]; lib_ring))
have hs : le F F.R.zero (F.R.add (F.R.mul (sub F.R F.R.one u) (sub F.R a c)) (F.R.mul u (sub F.R b c))) :=
match mul_nn F n0 n1, mul_nn F hu.1 n2 with
| .inl p1, h2 => .inl (by rw [F.R.add_comm]; exact add_nn_pos F h2 p1)
| .inr z1, .inl p2 => .inl (add_nn_pos F (.inr z1) p2)
| .inr z1, .inr z2 => .inr (by rw [← z1, ← z2]; lib_ring)
rw [← e2] at hs
exact hs.elim (fun h => .inl (pos_sub F h)) (fun h => .inr (by
calc c = F.R.add c F.R.zero := by lib_ring
_ = F.R.add c (sub F.R (lin F a b u) c) := by rw [h]
_ = lin F a b u := by lib_ring))
have key2 : ∀ c, le F a c → le F b c → le F (lin F a b u) c := fun c hac hbc => by
have e2 : sub F.R c (lin F a b u) = F.R.add (F.R.mul (sub F.R F.R.one u) (sub F.R c a)) (F.R.mul u (sub F.R c b)) := by
unfold lin; lib_ring
have n1 : le F F.R.zero (sub F.R c a) := hac.elim (fun h => .inl (sub_pos F h)) (fun h => .inr (by rw [h]; lib_ring))
have n2 : le F F.R.zero (sub F.R c b) := hbc.elim (fun h => .inl (sub_pos F h)) (fun h => .inr (by rw [h]; lib_ring))
have n0 : le F F.R.zero (sub F.R F.R.one u) := hu.2.elim (fun h => .inl (sub_pos F h)) (fun h => .inr (by rw [h]; lib_ring))
have hs : le F F.R.zero (F.R.add (F.R.mul (sub F.R F.R.one u) (sub F.R c a)) (F.R.mul u (sub F.R c b))) :=
match mul_nn F n0 n1, mul_nn F hu.1 n2 with
| .inl p1, h2 => .inl (by rw [F.R.add_comm]; exact add_nn_pos F h2 p1)
| .inr z1, .inl p2 => .inl (add_nn_pos F (.inr z1) p2)
| .inr z1, .inr z2 => .inr (by rw [← z1, ← z2]; lib_ring)
rw [← e2] at hs
exact hs.elim (fun h => .inl (pos_sub F h)) (fun h => .inr (by
calc lin F a b u = F.R.add (lin F a b u) F.R.zero := by lib_ring
_ = F.R.add (lin F a b u) (sub F.R c (lin F a b u)) := by rw [h]
_ = c := by lib_ring))
exact ⟨key _ ha.1 hb.1, key2 _ ha.2 hb.2⟩
/-- a linear family restricted to [a, b] is a linear family from G_a to G_b -/
theorem fam_sub {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) {a b : F.K} (ha : In01 F a) (hb : In01 F b) :
LinFam (Fm a) (Fm b) (fun u => Fm (subT a b u)) where
nn t := (h.nn _).trans (h.nn a).symm
kind t := (h.kind _).trans (h.kind a).symm
px t := (h.px _).trans (h.px a).symm
tgt t := (h.tgt _).trans (h.tgt a).symm
wd t := (h.wd _).trans (h.wd a).symm
ox t := (h.ox _).trans (h.ox a).symm
ix t := (h.ix _).trans (h.ix a).symm
nn1 := (h.nn b).trans (h.nn a).symm
kind1 := (h.kind b).trans (h.kind a).symm
px1 := (h.px b).trans (h.px a).symm
tgt1 := (h.tgt b).trans (h.tgt a).symm
wd1 := (h.wd b).trans (h.wd a).symm
ox1 := (h.ox b).trans (h.ox a).symm
ix1 := (h.ix b).trans (h.ix a).symm
py u k := by rw [h.py, h.py, h.py, lin_sub]
X u e Q he := by
have he0 : Seg G0 e := by unfold Seg at he ⊢; rw [h.nn, h.kind] at he; exact he
rw [h.X _ e Q he0, h.X a e Q he0, h.X b e Q he0, lin_sub]
valid u hu := h.valid _ (sub_in ha hb hu)
/-! ## a box that meets no other node keeps its layer -/
section K
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm)
include h
theorem segF (t : F.K) (e : Nat × Nat) : Seg (Fm t) e ↔ Seg G0 e := by unfold Seg; rw [h.nn, h.kind]
theorem seg1 (e : Nat × Nat) : Seg G1 e ↔ Seg G0 e := by unfold Seg; rw [h.nn1, h.kind1]
theorem pyF0 (k : Nat) : (Fm F.R.zero).py k = G0.py k := by rw [h.py]; exact lin0 _ _
theorem pyF1 (k : Nat) : (Fm F.R.one).py k = G1.py k := by rw [h.py]; exact lin1 _ _
theorem hh_keepF {j k : Nat} (hg : BoxGen Fm G0.nn j) (hk : k < G0.nn) (hne : j ≠ k) :
(F.lt (G0.py k) (G0.py j) → ∀ t, In01 F t → F.lt ((Fm t).py k) ((Fm t).py j)) ∧
(F.lt (G0.py j) (G0.py k) → ∀ t, In01 F t → F.lt ((Fm t).py j) ((Fm t).py k)) :=
have hz : ∀ t, In01 F t → lin F (G0.py k) (G1.py k) t ≠ lin F (G0.py j) (G1.py j) t := fun t ht e =>
hg t ht k hk (fun h' => hne h'.symm) (by rw [h.py, h.py]; exact e.symm)
⟨fun h0 t ht => by rw [h.py, h.py]; exact lt_keep_at hz h0 t ht,
fun h0 t ht => by rw [h.py, h.py]; exact lt_keep_at (fun t ht e => hz t ht e.symm) h0 t ht⟩
theorem open_keepF {j : Nat} (hg : BoxGen Fm G0.nn j) {e : Nat × Nat} (he : Seg G0 e)
(ho : Open G0 e (G0.py j)) (t : F.K) (ht : In01 F t) : Open (Fm t) e ((Fm t).py j) := by
have hlo : e.1 ≠ j := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact this)
have hhi : hiN G0 e ≠ j := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact this)
have hv := (h.valid F.R.zero in0).tgtOk e ((segF h _ e).2 he)
rw [h.nn, h.tgt] at hv
refine ⟨(hh_keepF h hg he.1 (fun h' => hlo h'.symm)).1 ho.1 t ht, ?_⟩
show F.lt ((Fm t).py j) ((Fm t).py ((Fm t).tgt e).1)
rw [h.tgt]
exact (hh_keepF h hg hv.1 (fun h' => hhi h'.symm)).2 ho.2 t ht
theorem X_famPair (t : F.K) (ht : In01 F t) {j : Nat} (hg : BoxGen Fm G0.nn j) {e e' : Nat × Nat}
(he : Seg G0 e) (he' : Seg G0 e') (hne : e ≠ e') (ho : Open G0 e (G0.py j)) (ho' : Open G0 e' (G0.py j)) :
lin F (X G0 e (G0.py j)) (X G1 e (G1.py j)) t ≠ lin F (X G0 e' (G0.py j)) (X G1 e' (G1.py j)) t := by
rw [← h.X t e j he, ← h.X t e' j he']
exact (h.valid t ht).segs e e' ((segF h t e).2 he) ((segF h t e').2 he') hne _
(open_keepF h hg he ho t ht) (open_keepF h hg he' ho' t ht)
theorem X_famNode (t : F.K) (ht : In01 F t) {j : Nat} (hj : j < G0.nn) (hg : BoxGen Fm G0.nn j) {e : Nat × Nat}
(he : Seg G0 e) (ho : Open G0 e (G0.py j)) :
lin F (X G0 e (G0.py j)) (X G1 e (G1.py j)) t ≠ lin F (G0.px j) (G0.px j) t := by
rw [← h.X t e j he, lin_const]
have := node_ne_px (h.valid t ht) ((segF h t e).2 he) (by rw [h.nn]; exact hj) (open_keepF h hg he ho t ht)
rw [h.px] at this
exact this
theorem xrF (t : F.K) (k : Nat) : xr (Fm t) k = xr G0 k := by unfold xr; rw [h.px, h.wd]
theorem xr1F (k : Nat) : xr G1 k = xr G0 k := by unfold xr; rw [h.px1, h.wd1]
theorem X_famNodeR (t : F.K) (ht : In01 F t) {j : Nat} (hj : j < G0.nn) (hg : BoxGen Fm G0.nn j) {e : Nat × Nat}
(he : Seg G0 e) (ho : Open G0 e (G0.py j)) :
lin F (X G0 e (G0.py j)) (X G1 e (G1.py j)) t ≠ lin F (xr G0 j) (xr G0 j) t := by
rw [← h.X t e j he, lin_const]
have := node_ne_xr (h.valid t ht) ((segF h t e).2 he) (by rw [h.nn]; exact hj) (open_keepF h hg he ho t ht)
rw [xrF h] at this
exact this
theorem pxle (k : Nat) (hk : k < G0.nn) : le F (G0.px k) (xr G0 k) := by
have := px_le_xr (h.valid F.R.zero in0) (k := k) (by rw [h.nn]; exact hk)
rw [h.px, xrF h] at this; exact this
theorem nodes0 {j : Nat} (hj : j < G0.nn) (hg : BoxGen Fm G0.nn j) {e : Nat × Nat} (he : Seg G0 e)
(ho : Open G0 e (G0.py j)) : F.lt (X G0 e (G0.py j)) (G0.px j) ∨ F.lt (xr G0 j) (X G0 e (G0.py j)) := by
have := (h.valid F.R.zero in0).nodes e j ((segF h _ e).2 he) (by rw [h.nn]; exact hj) (open_keepF h hg he ho _ in0)
rw [h.X _ e j he, lin0, h.px, xrF h] at this; exact this
theorem side_eqF {j : Nat} (hj : j < G0.nn) (hg : BoxGen Fm G0.nn j) (e : Nat × Nat) :
(Lft G1 j e ↔ Lft G0 j e) ∧ (Rgt G1 j e ↔ Rgt G0 j e) := by
have openB : Seg G0 e → Open G1 e (G1.py j) → Open G0 e (G0.py j) := fun hs ho1 => by
have hv := (h.valid F.R.zero in0).tgtOk e ((segF h _ e).2 hs)
rw [h.nn, h.tgt] at hv
have hlo : e.1 ≠ j := fun h' => F.irr _ (by have := ho1.1; rw [h'] at this; exact this)
have hhi : hiN G0 e ≠ j := fun h' => F.irr _ (by
have := ho1.2; unfold hiN at this; rw [h.tgt1] at this; unfold hiN at h'; rw [h'] at this; exact this)
refine ⟨?_, ?_⟩
· match F.tri (G0.py e.1) (G0.py j) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd (by rw [pyF0 h, pyF0 h]; exact h'.symm) (hg _ in0 e.1 hs.1 (fun h'' => hlo h''))
| .inr (.inr h') =>
have := (hh_keepF h hg hs.1 (fun h'' => hlo h''.symm)).2 h' F.R.one in1
rw [pyF1 h, pyF1 h] at this
exact absurd ho1.1 (lt_asymm F this)
· match F.tri (G0.py j) (G0.py (hiN G0 e)) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd (by rw [pyF0 h, pyF0 h]; exact h') (hg _ in0 _ hv.1 (fun h'' => hhi h''))
| .inr (.inr h') =>
have := (hh_keepF h hg hv.1 (fun h'' => hhi h''.symm)).1 h' F.R.one in1
rw [pyF1 h, pyF1 h] at this
have h2 := ho1.2; unfold hiN at h2; rw [h.tgt1] at h2
exact absurd h2 (lt_asymm F this)
have fwd : Seg G0 e → Open G0 e (G0.py j) → Open G1 e (G1.py j) := fun hs ho => by
have h1 := open_keepF h hg hs ho F.R.one in1
have h1a := h1.1; have h1b := h1.2
unfold hiN at h1b; rw [h.tgt] at h1b
rw [pyF1 h, pyF1 h] at h1a h1b
exact ⟨h1a, by unfold hiN; rw [h.tgt1]; exact h1b⟩
have xl : Seg G0 e → Open G0 e (G0.py j) → F.lt (X G0 e (G0.py j)) (G0.px j) → F.lt (X G1 e (G1.py j)) (G1.px j) :=
fun hs ho h' => by rw [h.px1]; exact lt_keep (X_famNode h · · hj hg hs ho) h'
have xr' : Seg G0 e → Open G0 e (G0.py j) → F.lt (xr G0 j) (X G0 e (G0.py j)) → F.lt (xr G1 j) (X G1 e (G1.py j)) :=
fun hs ho h' => by rw [xr1F h]; exact lt_keep (fun t ht e' => X_famNodeR h t ht hj hg hs ho e'.symm) h'
have le1 : le F (G1.px j) (xr G1 j) := by rw [h.px1, xr1F h]; exact pxle h j hj
refine ⟨⟨fun ⟨hs, ho, hl⟩ => ?_, fun ⟨hs, ho, hl⟩ => ⟨(seg1 h e).2 hs, fwd hs ho, xl hs ho hl⟩⟩,
⟨fun ⟨hs, ho, hl⟩ => ?_, fun ⟨hs, ho, hl⟩ => ⟨(seg1 h e).2 hs, fwd hs ho, xr' hs ho hl⟩⟩⟩
· have hs0 := (seg1 h e).1 hs
have ho0 := openB hs0 ho
refine ⟨hs0, ho0, ?_⟩
match nodes0 h hj hg hs0 ho0 with
| .inl h' => exact h'
| .inr h' => exact absurd (xr' hs0 ho0 h') (lt_asymm F (lt_of_lt_of_le F hl le1))
· have hs0 := (seg1 h e).1 hs
have ho0 := openB hs0 ho
refine ⟨hs0, ho0, ?_⟩
match nodes0 h hj hg hs0 ho0 with
| .inl h' => exact absurd (xl hs0 ho0 h') (lt_asymm F (lt_of_le_of_lt F le1 hl))
| .inr h' => exact h'
theorem incr_F {j : Nat} (hg : BoxGen Fm G0.nn j) {P : Nat × Nat → Prop}
(hP : ∀ e, P e → Seg G0 e ∧ Open G0 e (G0.py j)) :
(l : List (Nat × Nat)) → (∀ e, e ∈ l → P e) → Incr F (fun e => X G0 e (G0.py j)) l → Incr F (fun e => X G1 e (G1.py j)) l
| [], _, _ => trivial
| [_], _, _ => trivial
| a :: b :: l, hl, h' =>
have ha := hP a (hl a (.head _))
have hb := hP b (hl b (.tail _ (.head _)))
⟨lt_keep (X_famPair h · · hg ha.1 hb.1 (fun e => lt_ne F h'.1 (by rw [e])) ha.2 hb.2) h'.1,
incr_F hg hP (b :: l) (fun e m => hl e (.tail _ m)) h'.2⟩
/-- the layer of a box that meets no other node is kept -/
theorem layer_keep {j : Nat} (hj : j < G0.nn) (hg : BoxGen Fm G0.nn j) {ly : Ly S} (hl : LayerOf G0 j ly) :
LayerOf G1 j ly :=
match hl with
| ⟨g, Ls, Rs, hk, hL, iL, hR, iR, e⟩ =>
⟨g, Ls, Rs, by rw [h.kind1]; exact hk,
⟨hL.1, fun x => (hL.2 x).trans (side_eqF h hj hg x).1.symm⟩,
incr_F h hg (P := Lft G0 j) (fun e h' => ⟨h'.1, h'.2.1⟩) Ls (fun e m => (hL.2 e).1 m) iL,
⟨hR.1, fun x => (hR.2 x).trans (side_eqF h hj hg x).2.symm⟩,
incr_F h hg (P := Rgt G0 j) (fun e h' => ⟨h'.1, h'.2.1⟩) Rs (fun e m => (hR.2 e).1 m) iR,
by rw [e]; unfold labs lab; rw [h.kind1]⟩
end K
end TP
end Found
#print axioms Found.TP.vmove_fam
#print axioms Found.TP.sub_in
#print axioms Found.TP.fam_sub
#print axioms Found.TP.side_eqF
#print axioms Found.TP.layer_keep
lean_all/found/Top6.lean
/-
T193 (topological), part 6. found/Top6 — tools for the event where two
boxes pass each other's height:
* an affine function nonzero on [0, 1) and positive at 1 is positive at
0 (and the mirror image);
* x of a segment is affine in the height, and equals the end points' x
at the end heights;
* for a linear family in which boxes P and Q swap heights (and meet no
other node), the meeting time t* ∈ (0, 1); at t = 0 and t = 1 no node
height lies between them, and no segment joins them.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top5
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## affine sign lemmas -/
theorem pos_from_end {a b : F.K} (hz : ∀ u, le F F.R.zero u → F.lt u F.R.one → lin F a b u ≠ F.R.zero)
(hb : F.lt F.R.zero b) : F.lt F.R.zero a :=
match F.tri F.R.zero a with
| .inl h => h
| .inr (.inl e) => absurd (by rw [lin0]; exact e.symm) (hz F.R.zero (.inr rfl) F.zero_lt_one)
| .inr (.inr h) => match ivt_lin F h hb with
| ⟨u, h0, h1, e⟩ => absurd e (hz u (.inl h0) h1)
theorem neg_from_end {a b : F.K} (hz : ∀ u, le F F.R.zero u → F.lt u F.R.one → lin F a b u ≠ F.R.zero)
(hb : F.lt b F.R.zero) : F.lt a F.R.zero := by
have hn : F.lt F.R.zero (F.R.neg b) := neg_pos F hb
have := pos_from_end (a := F.R.neg a) (b := F.R.neg b) (fun u hu hu1 e => hz u hu hu1 (by
rw [neg_lin] at e
calc lin F a b u = F.R.neg (F.R.neg (lin F a b u)) := by lib_ring
_ = F.R.zero := by rw [e]; lib_ring)) hn
exact pos_sub F (by rw [show sub F.R F.R.zero a = F.R.neg a by lib_ring]; exact this)
/-- comparison at the start from the comparison at the end, without crossing in between -/
theorem lt_from_end {a0 a1 b0 b1 : F.K} (hz : ∀ u, le F F.R.zero u → F.lt u F.R.one → lin F a0 a1 u ≠ lin F b0 b1 u)
(h1 : F.lt a1 b1) : F.lt a0 b0 := by
have hz' : ∀ u, le F F.R.zero u → F.lt u F.R.one → lin F (sub F.R b0 a0) (sub F.R b1 a1) u ≠ F.R.zero :=
fun u hu hu1 e => hz u hu hu1 (by
have e2 : lin F (sub F.R b0 a0) (sub F.R b1 a1) u = sub F.R (lin F b0 b1 u) (lin F a0 a1 u) := by unfold lin; lib_ring
rw [e2] at e
calc lin F a0 a1 u = F.R.add (lin F a0 a1 u) (sub F.R (lin F b0 b1 u) (lin F a0 a1 u)) := by rw [e]; lib_ring
_ = lin F b0 b1 u := by lib_ring)
exact pos_sub F (pos_from_end hz' (sub_pos F h1))
/-! ## x along a segment -/
theorem X_aff (G : Drw F S) (e : Nat × Nat) (y0 y1 u : F.K) :
X G e (lin F y0 y1 u) = lin F (X G e y0) (X G e y1) u := by unfold X lin; lib_ring
theorem X_lo (G : Drw F S) (e : Nat × Nat) : X G e (G.py e.1) = xs G e := by unfold X; lib_ring
theorem X_hi (G : Drw F S) (e : Nat × Nat) (h : G.py (hiN G e) ≠ G.py e.1) : X G e (G.py (hiN G e)) = xt G e := by
have hd : sub F.R (G.py (hiN G e)) (G.py e.1) ≠ F.R.zero := fun e' => h (by
calc G.py (hiN G e) = F.R.add (sub F.R (G.py (hiN G e)) (G.py e.1)) (G.py e.1) := by lib_ring
_ = G.py e.1 := by rw [e']; lib_ring)
have hi := F.mul_inv _ hd
unfold X
calc F.R.add (xs G e) (F.R.mul (F.R.mul (sub F.R (G.py (hiN G e)) (G.py e.1)) (sub F.R (xt G e) (xs G e)))
(F.inv (sub F.R (G.py (hiN G e)) (G.py e.1))))
= F.R.add (xs G e) (F.R.mul (F.R.mul (sub F.R (G.py (hiN G e)) (G.py e.1)) (F.inv (sub F.R (G.py (hiN G e)) (G.py e.1))))
(sub F.R (xt G e) (xs G e))) := by lib_ring
_ = xt G e := by rw [hi]; lib_ring
/-- the order of two segments over a slab of heights without crossing -/
theorem slab_lt {G : Drw F S} {e e' : Nat × Nat} {a b : F.K}
(hz : ∀ u, le F F.R.zero u → F.lt u F.R.one → X G e (lin F a b u) ≠ X G e' (lin F a b u))
(h1 : F.lt (X G e b) (X G e' b)) : F.lt (X G e a) (X G e' a) :=
lt_from_end (fun u hu hu1 e2 => hz u hu hu1 (by rw [X_aff, X_aff]; exact e2)) h1
/-! ## two boxes passing each other's height -/
theorem in_open {t : F.K} (h0 : F.lt F.R.zero t) (h1 : F.lt t F.R.one) : In01 F t := ⟨.inl h0, .inl h1⟩
structure Swap (G0 G1 : Drw F S) (Fm : F.K → Drw F S) (P Q : Nat) : Prop where
fam : LinFam G0 G1 Fm
hP : P < G0.nn
hQ : Q < G0.nn
bP : IsBox (G0.kind P)
bQ : IsBox (G0.kind Q)
ne : P ≠ Q
gP : ∀ t, In01 F t → ∀ k, k < G0.nn → k ≠ P → k ≠ Q → (Fm t).py P ≠ (Fm t).py k
gQ : ∀ t, In01 F t → ∀ k, k < G0.nn → k ≠ P → k ≠ Q → (Fm t).py Q ≠ (Fm t).py k
lo0 : F.lt (G0.py P) (G0.py Q)
hi1 : F.lt (G1.py Q) (G1.py P)
section Sw
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q)
include sw
theorem tstar : ∃ t, F.lt F.R.zero t ∧ F.lt t F.R.one ∧ (Fm t).py P = (Fm t).py Q := by
have ha : F.lt (sub F.R (G0.py P) (G0.py Q)) F.R.zero := by
have := sub_pos F sw.lo0
have h2 := F.add_lt _ _ (sub F.R (G0.py P) (G0.py Q)) this
rw [show F.R.add F.R.zero (sub F.R (G0.py P) (G0.py Q)) = sub F.R (G0.py P) (G0.py Q) by lib_ring,
show F.R.add (sub F.R (G0.py Q) (G0.py P)) (sub F.R (G0.py P) (G0.py Q)) = F.R.zero by lib_ring] at h2
exact h2
match ivt_lin F ha (sub_pos F sw.hi1) with
| ⟨u, h0, h1, e⟩ => exact ⟨u, h0, h1, by
rw [sw.fam.py, sw.fam.py]
have e2 : sub F.R (lin F (G0.py P) (G1.py P) u) (lin F (G0.py Q) (G1.py Q) u) =
lin F (sub F.R (G0.py P) (G0.py Q)) (sub F.R (G1.py P) (G1.py Q)) u := by unfold lin; lib_ring
rw [← e2] at e
calc lin F (G0.py P) (G1.py P) u
= F.R.add (sub F.R (lin F (G0.py P) (G1.py P) u) (lin F (G0.py Q) (G1.py Q) u)) (lin F (G0.py Q) (G1.py Q) u) := by lib_ring
_ = lin F (G0.py Q) (G1.py Q) u := by rw [e]; lib_ring⟩
/-- other nodes keep their height order with P and with Q -/
theorem keepP {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) :
(F.lt (G0.py k) (G0.py P) → ∀ t, In01 F t → F.lt ((Fm t).py k) ((Fm t).py P)) ∧
(F.lt (G0.py P) (G0.py k) → ∀ t, In01 F t → F.lt ((Fm t).py P) ((Fm t).py k)) :=
have hz : ∀ t, In01 F t → lin F (G0.py k) (G1.py k) t ≠ lin F (G0.py P) (G1.py P) t := fun t ht e =>
sw.gP t ht k hk h1 h2 (by rw [sw.fam.py, sw.fam.py]; exact e.symm)
⟨fun h0 t ht => by rw [sw.fam.py, sw.fam.py]; exact lt_keep_at hz h0 t ht,
fun h0 t ht => by rw [sw.fam.py, sw.fam.py]; exact lt_keep_at (fun t ht e => hz t ht e.symm) h0 t ht⟩
theorem keepQ {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) :
(F.lt (G0.py k) (G0.py Q) → ∀ t, In01 F t → F.lt ((Fm t).py k) ((Fm t).py Q)) ∧
(F.lt (G0.py Q) (G0.py k) → ∀ t, In01 F t → F.lt ((Fm t).py Q) ((Fm t).py k)) :=
have hz : ∀ t, In01 F t → lin F (G0.py k) (G1.py k) t ≠ lin F (G0.py Q) (G1.py Q) t := fun t ht e =>
sw.gQ t ht k hk h1 h2 (by rw [sw.fam.py, sw.fam.py]; exact e.symm)
⟨fun h0 t ht => by rw [sw.fam.py, sw.fam.py]; exact lt_keep_at hz h0 t ht,
fun h0 t ht => by rw [sw.fam.py, sw.fam.py]; exact lt_keep_at (fun t ht e => hz t ht e.symm) h0 t ht⟩
/-- no node height lies strictly between P and Q at the start -/
theorem gap0 {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) (a : F.lt (G0.py P) (G0.py k))
(b : F.lt (G0.py k) (G0.py Q)) : False :=
match tstar sw with
| ⟨t, t0, t1, e⟩ =>
have x := (keepP sw hk h1 h2).2 a t (in_open t0 t1)
have y := (keepQ sw hk h1 h2).1 b t (in_open t0 t1)
by rw [e] at x; exact lt_asymm F x y
theorem keepP1 {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) :
(F.lt (G1.py k) (G1.py P) → F.lt (G0.py k) (G0.py P)) ∧ (F.lt (G1.py P) (G1.py k) → F.lt (G0.py P) (G0.py k)) := by
have g0 := sw.gP F.R.zero in0 k hk h1 h2
rw [pyF0 sw.fam, pyF0 sw.fam] at g0
refine ⟨fun h => ?_, fun h => ?_⟩
· match F.tri (G0.py k) (G0.py P) with
| .inl h' => exact h'
| .inr (.inl e) => exact absurd e.symm g0
| .inr (.inr h') =>
have := (keepP sw hk h1 h2).2 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this
exact absurd h (lt_asymm F this)
· match F.tri (G0.py P) (G0.py k) with
| .inl h' => exact h'
| .inr (.inl e) => exact absurd e g0
| .inr (.inr h') =>
have := (keepP sw hk h1 h2).1 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this
exact absurd h (lt_asymm F this)
theorem keepQ1 {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) :
(F.lt (G1.py k) (G1.py Q) → F.lt (G0.py k) (G0.py Q)) ∧ (F.lt (G1.py Q) (G1.py k) → F.lt (G0.py Q) (G0.py k)) := by
have g0 := sw.gQ F.R.zero in0 k hk h1 h2
rw [pyF0 sw.fam, pyF0 sw.fam] at g0
refine ⟨fun h => ?_, fun h => ?_⟩
· match F.tri (G0.py k) (G0.py Q) with
| .inl h' => exact h'
| .inr (.inl e) => exact absurd e.symm g0
| .inr (.inr h') =>
have := (keepQ sw hk h1 h2).2 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this
exact absurd h (lt_asymm F this)
· match F.tri (G0.py Q) (G0.py k) with
| .inl h' => exact h'
| .inr (.inl e) => exact absurd e g0
| .inr (.inr h') =>
have := (keepQ sw hk h1 h2).1 h' F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this
exact absurd h (lt_asymm F this)
/-- no node height lies strictly between Q and P at the end -/
theorem gap1 {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) (a : F.lt (G1.py Q) (G1.py k))
(b : F.lt (G1.py k) (G1.py P)) : False :=
lt_asymm F sw.lo0 (F.trans _ _ _ ((keepQ1 sw hk h1 h2).2 a) ((keepP1 sw hk h1 h2).1 b))
/-- no segment joins P and Q -/
theorem no_PQ {e : Nat × Nat} (he : Seg G0 e) : ¬ (e.1 = P ∧ hiN G0 e = Q) ∧ ¬ (e.1 = Q ∧ hiN G0 e = P) :=
match tstar sw with
| ⟨t, t0, t1, eq⟩ =>
have hv := (sw.fam.valid t (in_open t0 t1)).prog e ((segF sw.fam t e).2 he)
have hv' : F.lt ((Fm t).py e.1) ((Fm t).py (hiN G0 e)) := by unfold hiN at hv ⊢; rw [sw.fam.tgt] at hv; exact hv
⟨fun ⟨a, b⟩ => by rw [a, b, eq] at hv'; exact F.irr _ hv',
fun ⟨a, b⟩ => by rw [a, b, eq] at hv'; exact F.irr _ hv'⟩
end Sw
end TP
end Found
#print axioms Found.TP.lt_from_end
#print axioms Found.TP.X_hi
#print axioms Found.TP.slab_lt
#print axioms Found.TP.tstar
#print axioms Found.TP.gap0
#print axioms Found.TP.gap1
#print axioms Found.TP.no_PQ
lean_all/found/Top7.lean
/-
T193 (topological), part 7. found/Top7 — the segments at the heights of
two boxes P, Q that swap heights (P below Q at the start):
* at P's height: the inputs of Q and the segments passing both heights;
at Q's height: the outputs of P and the passing segments; after the
swap symmetrically (the passing segments are the same);
* the side of a passing segment with respect to P (or Q) is its side at
the meeting time t*; the inputs of Q lie on the side of Q's position,
the outputs of P on the side of P's position.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top6
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
def InN (G : Drw F S) (n : Nat) (e : Nat × Nat) : Prop := Seg G e ∧ hiN G e = n
def OutN (G : Drw F S) (n : Nat) (e : Nat × Nat) : Prop := Seg G e ∧ e.1 = n
/-- segments passing both heights -/
def Pass (G0 : Drw F S) (P Q : Nat) (e : Nat × Nat) : Prop :=
Seg G0 e ∧ e.1 ≠ P ∧ e.1 ≠ Q ∧ hiN G0 e ≠ P ∧ hiN G0 e ≠ Q ∧ F.lt (G0.py e.1) (G0.py P) ∧ F.lt (G0.py Q) (G0.py (hiN G0 e))
section T
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q)
include sw
theorem g0P {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) : G0.py P ≠ G0.py k := by
have := sw.gP F.R.zero in0 k hk h1 h2; rw [pyF0 sw.fam, pyF0 sw.fam] at this; exact this
theorem g0Q {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) : G0.py Q ≠ G0.py k := by
have := sw.gQ F.R.zero in0 k hk h1 h2; rw [pyF0 sw.fam, pyF0 sw.fam] at this; exact this
theorem hi_lt (e : Nat × Nat) (he : Seg G0 e) : hiN G0 e < G0.nn := by
have := (sw.fam.valid F.R.zero in0).tgtOk e ((segF sw.fam _ e).2 he)
rw [sw.fam.nn, sw.fam.tgt] at this; exact this.1
theorem prog0 (e : Nat × Nat) (he : Seg G0 e) : F.lt (G0.py e.1) (G0.py (hiN G0 e)) := by
have := (sw.fam.valid F.R.zero in0).prog e ((segF sw.fam _ e).2 he)
unfold hiN at this ⊢; rw [sw.fam.tgt, pyF0 sw.fam, pyF0 sw.fam] at this; exact this
/-- the segments at P's height at the start -/
theorem atP0 (e : Nat × Nat) : (Seg G0 e ∧ Open G0 e (G0.py P)) ↔ (InN G0 Q e ∨ Pass G0 P Q e) := by
refine ⟨fun ⟨hs, ho⟩ => ?_, fun h => ?_⟩
· have hhi := hi_lt sw e hs
match Nat.decEq (hiN G0 e) Q with
| isTrue hq => exact .inl ⟨hs, hq⟩
| isFalse hq =>
have hp : hiN G0 e ≠ P := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact this)
have lp : e.1 ≠ P := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact this)
have lq : e.1 ≠ Q := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact F.trans _ _ _ this sw.lo0)
refine .inr ⟨hs, lp, lq, hp, hq, ho.1, ?_⟩
match F.tri (G0.py Q) (G0.py (hiN G0 e)) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h' (g0Q sw hhi hp hq)
| .inr (.inr h') => exact (gap0 sw hhi hp hq ho.2 h').elim
· match h with
| .inl ⟨hs, hq⟩ =>
have pr := prog0 sw e hs
have lQ : e.1 ≠ Q := fun h' => F.irr _ (by rw [hq, h'] at pr; exact pr)
have lP : e.1 ≠ P := fun h' => (no_PQ sw hs).1 ⟨h', hq⟩
refine ⟨hs, ?_, by rw [hq]; exact sw.lo0⟩
match F.tri (G0.py e.1) (G0.py P) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h'.symm (g0P sw hs.1 lP lQ)
| .inr (.inr h') => exact (gap0 sw hs.1 lP lQ h' (by rw [hq] at pr; exact pr)).elim
| .inr ⟨hs, _, _, _, _, a, b⟩ => exact ⟨hs, a, F.trans _ _ _ sw.lo0 b⟩
/-- the segments at Q's height at the start -/
theorem atQ0 (e : Nat × Nat) : (Seg G0 e ∧ Open G0 e (G0.py Q)) ↔ (OutN G0 P e ∨ Pass G0 P Q e) := by
refine ⟨fun ⟨hs, ho⟩ => ?_, fun h => ?_⟩
· have hhi := hi_lt sw e hs
match Nat.decEq e.1 P with
| isTrue hp => exact .inl ⟨hs, hp⟩
| isFalse hp =>
have hq' : hiN G0 e ≠ Q := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact this)
have hp' : hiN G0 e ≠ P := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact F.trans _ _ _ this sw.lo0)
have lq : e.1 ≠ Q := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact this)
refine .inr ⟨hs, hp, lq, hp', hq', ?_, ho.2⟩
match F.tri (G0.py e.1) (G0.py P) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h'.symm (g0P sw hs.1 hp lq)
| .inr (.inr h') => exact (gap0 sw hs.1 hp lq h' ho.1).elim
· match h with
| .inl ⟨hs, hp⟩ =>
have pr := prog0 sw e hs
have hhi := hi_lt sw e hs
have hP' : hiN G0 e ≠ P := fun h' => F.irr _ (by rw [hp, h'] at pr; exact pr)
have hQ' : hiN G0 e ≠ Q := fun h' => (no_PQ sw hs).1 ⟨hp, h'⟩
refine ⟨hs, by rw [hp]; exact sw.lo0, ?_⟩
match F.tri (G0.py Q) (G0.py (hiN G0 e)) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h' (g0Q sw hhi hP' hQ')
| .inr (.inr h') => exact (gap0 sw hhi hP' hQ' (by rw [hp] at pr; exact pr) h').elim
| .inr ⟨hs, _, _, _, _, a, b⟩ => exact ⟨hs, F.trans _ _ _ a sw.lo0, b⟩
theorem hi_lt1 (e : Nat × Nat) (he : Seg G0 e) : hiN G1 e < G0.nn := by
unfold hiN; rw [sw.fam.tgt1]; exact hi_lt sw e he
theorem prog1 (e : Nat × Nat) (he : Seg G0 e) : F.lt (G1.py e.1) (G1.py (hiN G1 e)) := by
have := (sw.fam.valid F.R.one in1).prog e ((segF sw.fam _ e).2 he)
unfold hiN at this ⊢; rw [sw.fam.tgt, pyF1 sw.fam, pyF1 sw.fam] at this; rw [sw.fam.tgt1]; exact this
theorem g1P {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) : G1.py P ≠ G1.py k := by
have := sw.gP F.R.one in1 k hk h1 h2; rw [pyF1 sw.fam, pyF1 sw.fam] at this; exact this
theorem g1Q {k : Nat} (hk : k < G0.nn) (h1 : k ≠ P) (h2 : k ≠ Q) : G1.py Q ≠ G1.py k := by
have := sw.gQ F.R.one in1 k hk h1 h2; rw [pyF1 sw.fam, pyF1 sw.fam] at this; exact this
theorem hiN1 (e : Nat × Nat) : hiN G1 e = hiN G0 e := by unfold hiN; rw [sw.fam.tgt1]
theorem seg1' (e : Nat × Nat) : Seg G1 e ↔ Seg G0 e := seg1 sw.fam e
/-- passing segments stay below P and above Q at the end -/
theorem pass1 {e : Nat × Nat} (hp : Pass G0 P Q e) : F.lt (G1.py e.1) (G1.py Q) ∧ F.lt (G1.py P) (G1.py (hiN G1 e)) := by
match hp with
| ⟨hs, lP, lQ, hP', hQ', a, b⟩ =>
have hh := hi_lt sw e hs
refine ⟨?_, ?_⟩
· have := (keepQ sw hs.1 lP lQ).1 (F.trans _ _ _ a sw.lo0) F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam] at this; exact this
· have := (keepP sw hh hP' hQ').2 (F.trans _ _ _ sw.lo0 b) F.R.one in1
rw [pyF1 sw.fam, pyF1 sw.fam, ← hiN1 sw] at this; exact this
/-- the segments at Q's height at the end -/
theorem atQ1 (e : Nat × Nat) : (Seg G1 e ∧ Open G1 e (G1.py Q)) ↔ (InN G1 P e ∨ Pass G0 P Q e) := by
refine ⟨fun ⟨hs1, ho⟩ => ?_, fun h => ?_⟩
· have hs := (seg1' sw e).1 hs1
have hhi := hi_lt1 sw e hs
match Nat.decEq (hiN G1 e) P with
| isTrue hp => exact .inl ⟨hs1, hp⟩
| isFalse hp =>
have hq : hiN G1 e ≠ Q := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact this)
have lQ : e.1 ≠ Q := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact this)
have lP : e.1 ≠ P := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact F.trans _ _ _ this sw.hi1)
have hiP : F.lt (G1.py P) (G1.py (hiN G1 e)) := by
match F.tri (G1.py P) (G1.py (hiN G1 e)) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h' (g1P sw hhi hp hq)
| .inr (.inr h') => exact (gap1 sw hhi hp hq ho.2 h').elim
rw [hiN1 sw] at hp hq hiP
refine .inr ⟨hs, lP, lQ, hp, hq, (keepP1 sw hs.1 lP lQ).1 (F.trans _ _ _ ho.1 sw.hi1), ?_⟩
exact (keepQ1 sw (hi_lt sw e hs) hp hq).2 (F.trans _ _ _ sw.hi1 hiP)
· match h with
| .inl ⟨hs1, hp⟩ =>
have hs := (seg1' sw e).1 hs1
have pr := prog1 sw e hs
have lP : e.1 ≠ P := fun h' => F.irr _ (by rw [hp, h'] at pr; exact pr)
have lQ : e.1 ≠ Q := fun h' => (no_PQ sw hs).2 ⟨h', by rw [← hiN1 sw]; exact hp⟩
refine ⟨hs1, ?_, by rw [hp]; exact sw.hi1⟩
match F.tri (G1.py e.1) (G1.py Q) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h'.symm (g1Q sw hs.1 lP lQ)
| .inr (.inr h') => exact (gap1 sw hs.1 lP lQ h' (by rw [hp] at pr; exact pr)).elim
| .inr hp => exact ⟨(seg1' sw e).2 hp.1, (pass1 sw hp).1, F.trans _ _ _ sw.hi1 (pass1 sw hp).2⟩
/-- the segments at P's height at the end -/
theorem atP1 (e : Nat × Nat) : (Seg G1 e ∧ Open G1 e (G1.py P)) ↔ (OutN G1 Q e ∨ Pass G0 P Q e) := by
refine ⟨fun ⟨hs1, ho⟩ => ?_, fun h => ?_⟩
· have hs := (seg1' sw e).1 hs1
have hhi := hi_lt1 sw e hs
match Nat.decEq e.1 Q with
| isTrue hq => exact .inl ⟨hs1, hq⟩
| isFalse hq =>
have hP' : hiN G1 e ≠ P := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact this)
have hQ' : hiN G1 e ≠ Q := fun h' => F.irr _ (by have := ho.2; rw [h'] at this; exact F.trans _ _ _ this sw.hi1)
have lP : e.1 ≠ P := fun h' => F.irr _ (by have := ho.1; rw [h'] at this; exact this)
have loQ : F.lt (G1.py e.1) (G1.py Q) := by
match F.tri (G1.py e.1) (G1.py Q) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h'.symm (g1Q sw hs.1 lP hq)
| .inr (.inr h') => exact (gap1 sw hs.1 lP hq h' ho.1).elim
rw [hiN1 sw] at hP' hQ'
have ho2 := ho.2; rw [hiN1 sw] at ho2
exact .inr ⟨hs, lP, hq, hP', hQ', (keepP1 sw hs.1 lP hq).1 (F.trans _ _ _ loQ sw.hi1),
(keepQ1 sw (hi_lt sw e hs) hP' hQ').2 (F.trans _ _ _ sw.hi1 ho2)⟩
· match h with
| .inl ⟨hs1, hq⟩ =>
have hs := (seg1' sw e).1 hs1
have pr := prog1 sw e hs
have hhi := hi_lt1 sw e hs
have hQ' : hiN G1 e ≠ Q := fun h' => F.irr _ (by rw [hq, h'] at pr; exact pr)
have hP' : hiN G1 e ≠ P := fun h' => (no_PQ sw hs).2 ⟨hq, by rw [← hiN1 sw]; exact h'⟩
refine ⟨hs1, by rw [hq]; exact sw.hi1, ?_⟩
match F.tri (G1.py P) (G1.py (hiN G1 e)) with
| .inl h' => exact h'
| .inr (.inl h') => exact absurd h' (g1P sw hhi hP' hQ')
| .inr (.inr h') => exact (gap1 sw hhi hP' hQ' (by rw [hq] at pr; exact pr) h').elim
| .inr hp => exact ⟨(seg1' sw e).2 hp.1, F.trans _ _ _ (pass1 sw hp).1 sw.hi1, (pass1 sw hp).2⟩
end T
end TP
end Found
#print axioms Found.TP.atP0
#print axioms Found.TP.atQ0
#print axioms Found.TP.atQ1
#print axioms Found.TP.atP1
lean_all/found/Top8.lean
/-
T193 (topological), part 8. found/Top8 — sides during the swap of two
boxes P (below at the start) and Q:
* a passing segment keeps its side of P and of Q for all t, and two
passing segments keep their order at both heights; at the meeting time
the two heights coincide;
* the inputs of Q at P's height lie on the side of Q's position, the
outputs of P at Q's height on the side of P's position (at the start),
and symmetrically at the end.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top7
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
/-! ## generic -/
theorem same_side {a b c : F.K} (hz : ∀ t, In01 F t → lin F a b t ≠ c) (t : F.K) (ht : In01 F t) :
(F.lt a c ↔ F.lt (lin F a b t) c) ∧ (F.lt c a ↔ F.lt c (lin F a b t)) := by
have hz' : ∀ t, In01 F t → lin F a b t ≠ lin F c c t := fun t ht e => hz t ht (by rw [lin_const] at e; exact e)
refine ⟨⟨fun h => by have := lt_keep_at hz' h t ht; rw [lin_const] at this; exact this, fun h => ?_⟩,
⟨fun h => by
have := lt_keep_at (fun t ht e => hz' t ht e.symm) h t ht; rw [lin_const] at this; exact this, fun h => ?_⟩⟩
· match F.tri a c with
| .inl h' => exact h'
| .inr (.inl e) => exact absurd (by rw [lin0]; exact e) (hz F.R.zero in0)
| .inr (.inr h') =>
have := lt_keep_at (fun t ht e => hz' t ht e.symm) h' t ht; rw [lin_const] at this
exact absurd h (lt_asymm F this)
· match F.tri c a with
| .inl h' => exact h'
| .inr (.inl e) => exact absurd (by rw [lin0]; exact e.symm) (hz F.R.zero in0)
| .inr (.inr h') =>
have := lt_keep_at hz' h' t ht; rw [lin_const] at this
exact absurd h (lt_asymm F this)
theorem same_order {a b c d : F.K} (hz : ∀ t, In01 F t → lin F a b t ≠ lin F c d t) (t : F.K) (ht : In01 F t) :
F.lt a c ↔ F.lt (lin F a b t) (lin F c d t) :=
⟨fun h => lt_keep_at hz h t ht, fun h => match F.tri a c with
| .inl h' => h'
| .inr (.inl e) => absurd (by rw [lin0, lin0]; exact e) (hz F.R.zero in0)
| .inr (.inr h') => absurd h (lt_asymm F (lt_keep_at (fun t ht e => hz t ht e.symm) h' t ht))⟩
/-! ## time parameters -/
theorem mul_in {ts u : F.K} (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (h0 : le F F.R.zero u) (h1 : F.lt u F.R.one) :
In01 F (F.R.mul u ts) :=
le_mul_le ⟨h0, .inl h1⟩ (in_open t0 t1)
theorem after_in {ts u : F.K} (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (h0 : F.lt F.R.zero u) (h1 : le F u F.R.one) :
In01 F (subT ts F.R.one u) :=
sub_in (in_open t0 t1) in1 ⟨.inl h0, h1⟩
section U
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q)
include sw
theorem openFt {e : Nat × Nat} {y : F.K} (t : F.K) (h1 : F.lt ((Fm t).py e.1) y) (h2 : F.lt y ((Fm t).py (hiN G0 e))) :
Open (Fm t) e y := ⟨h1, by unfold hiN at h2 ⊢; rw [sw.fam.tgt]; exact h2⟩
theorem pass_open {e : Nat × Nat} (hp : Pass G0 P Q e) (t : F.K) (ht : In01 F t) :
Open (Fm t) e ((Fm t).py P) ∧ Open (Fm t) e ((Fm t).py Q) := by
match hp with
| ⟨hs, lP, lQ, hP', hQ', a, b⟩ =>
have hh := hi_lt sw e hs
exact ⟨openFt sw t ((keepP sw hs.1 lP lQ).1 a t ht) ((keepP sw hh hP' hQ').2 (F.trans _ _ _ sw.lo0 b) t ht),
openFt sw t ((keepQ sw hs.1 lP lQ).1 (F.trans _ _ _ a sw.lo0) t ht) ((keepQ sw hh hP' hQ').2 b t ht)⟩
/-- a passing segment never meets the bars of P or Q at their heights -/
theorem pass_sides {e : Nat × Nat} (hp : Pass G0 P Q e) :
((∀ t, In01 F t → lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) t ≠ G0.px P) ∧
(∀ t, In01 F t → lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) t ≠ xr G0 P)) ∧
((∀ t, In01 F t → lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) t ≠ G0.px Q) ∧
(∀ t, In01 F t → lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) t ≠ xr G0 Q)) :=
⟨⟨fun t ht h => by
rw [← sw.fam.X t e P hp.1] at h
have := node_ne_px (sw.fam.valid t ht) ((segF sw.fam t e).2 hp.1) (by rw [sw.fam.nn]; exact sw.hP) (pass_open sw hp t ht).1
rw [sw.fam.px] at this; exact this h,
fun t ht h => by
rw [← sw.fam.X t e P hp.1] at h
have := node_ne_xr (sw.fam.valid t ht) ((segF sw.fam t e).2 hp.1) (by rw [sw.fam.nn]; exact sw.hP) (pass_open sw hp t ht).1
rw [xrF sw.fam] at this; exact this h⟩,
⟨fun t ht h => by
rw [← sw.fam.X t e Q hp.1] at h
have := node_ne_px (sw.fam.valid t ht) ((segF sw.fam t e).2 hp.1) (by rw [sw.fam.nn]; exact sw.hQ) (pass_open sw hp t ht).2
rw [sw.fam.px] at this; exact this h,
fun t ht h => by
rw [← sw.fam.X t e Q hp.1] at h
have := node_ne_xr (sw.fam.valid t ht) ((segF sw.fam t e).2 hp.1) (by rw [sw.fam.nn]; exact sw.hQ) (pass_open sw hp t ht).2
rw [xrF sw.fam] at this; exact this h⟩⟩
theorem pass_orders {e e' : Nat × Nat} (hp : Pass G0 P Q e) (hp' : Pass G0 P Q e') (hne : e ≠ e') :
(∀ t, In01 F t → lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) t ≠ lin F (X G0 e' (G0.py P)) (X G1 e' (G1.py P)) t) ∧
(∀ t, In01 F t → lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) t ≠ lin F (X G0 e' (G0.py Q)) (X G1 e' (G1.py Q)) t) :=
⟨fun t ht h => by
rw [← sw.fam.X t e P hp.1, ← sw.fam.X t e' P hp'.1] at h
exact (sw.fam.valid t ht).segs e e' ((segF sw.fam t e).2 hp.1) ((segF sw.fam t e').2 hp'.1) hne _
(pass_open sw hp t ht).1 (pass_open sw hp' t ht).1 h,
fun t ht h => by
rw [← sw.fam.X t e Q hp.1, ← sw.fam.X t e' Q hp'.1] at h
exact (sw.fam.valid t ht).segs e e' ((segF sw.fam t e).2 hp.1) ((segF sw.fam t e').2 hp'.1) hne _
(pass_open sw hp t ht).2 (pass_open sw hp' t ht).2 h⟩
/-- at the meeting time both heights give the same x -/
theorem meet_X {t : F.K} (e : Nat × Nat) (he : Seg G0 e) (hm : (Fm t).py P = (Fm t).py Q) :
lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) t = lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) t := by
rw [← sw.fam.X t e P he, ← sw.fam.X t e Q he, hm]
/-! ## validity at the two ends -/
theorem XF0 (e : Nat × Nat) (y : F.K) : X (Fm F.R.zero) e y = X G0 e y := by
rw [X_eq, X_eq, sw.fam.px, sw.fam.ox, sw.fam.ix, sw.fam.tgt, pyF0 sw.fam, pyF0 sw.fam]
theorem XF1 (e : Nat × Nat) (y : F.K) : X (Fm F.R.one) e y = X G1 e y := by
rw [X_eq, X_eq, sw.fam.px, sw.fam.ox, sw.fam.ix, sw.fam.tgt, pyF1 sw.fam, pyF1 sw.fam, sw.fam.px1, sw.fam.ox1,
sw.fam.ix1, sw.fam.tgt1]
theorem openF0 {e : Nat × Nat} {y : F.K} (h : Open G0 e y) : Open (Fm F.R.zero) e y := by
refine ⟨by rw [pyF0 sw.fam]; exact h.1, ?_⟩
have h2 := h.2; unfold hiN at h2 ⊢; rw [sw.fam.tgt, pyF0 sw.fam]; exact h2
theorem openF1 {e : Nat × Nat} {y : F.K} (h : Open G1 e y) : Open (Fm F.R.one) e y := by
refine ⟨by rw [pyF1 sw.fam]; exact h.1, ?_⟩
have h2 := h.2; unfold hiN at h2 ⊢; rw [sw.fam.tgt, pyF1 sw.fam, ← sw.fam.tgt1]; exact h2
theorem segs0 {e e' : Nat × Nat} (he : Seg G0 e) (he' : Seg G0 e') (hne : e ≠ e') {y : F.K}
(ho : Open G0 e y) (ho' : Open G0 e' y) : X G0 e y ≠ X G0 e' y := by
rw [← XF0 sw, ← XF0 sw]
exact (sw.fam.valid _ in0).segs e e' ((segF sw.fam _ e).2 he) ((segF sw.fam _ e').2 he') hne y (openF0 sw ho) (openF0 sw ho')
theorem segs1 {e e' : Nat × Nat} (he : Seg G0 e) (he' : Seg G0 e') (hne : e ≠ e') {y : F.K}
(ho : Open G1 e y) (ho' : Open G1 e' y) : X G1 e y ≠ X G1 e' y := by
rw [← XF1 sw, ← XF1 sw]
exact (sw.fam.valid _ in1).segs e e' ((segF sw.fam _ e).2 he) ((segF sw.fam _ e').2 he') hne y (openF1 sw ho) (openF1 sw ho')
/-! ## before and after the meeting -/
theorem pq_before {ts u : F.K} (hmt : (Fm ts).py P = (Fm ts).py Q) (h1 : F.lt u F.R.one) :
F.lt ((Fm (F.R.mul u ts)).py P) ((Fm (F.R.mul u ts)).py Q) := by
rw [sw.fam.py, sw.fam.py, lin_comp, lin_comp]
have hm : lin F (G0.py P) (G1.py P) ts = lin F (G0.py Q) (G1.py Q) ts := by rw [← sw.fam.py, ← sw.fam.py]; exact hmt
rw [hm]
apply pos_sub F
rw [show sub F.R (lin F (G0.py Q) (lin F (G0.py Q) (G1.py Q) ts) u) (lin F (G0.py P) (lin F (G0.py Q) (G1.py Q) ts) u) =
F.R.mul (sub F.R F.R.one u) (sub F.R (G0.py Q) (G0.py P)) by unfold lin; lib_ring]
exact F.mul_pos _ _ (sub_pos F h1) (sub_pos F sw.lo0)
theorem qp_after {ts u : F.K} (hmt : (Fm ts).py P = (Fm ts).py Q) (h0 : F.lt F.R.zero u) :
F.lt ((Fm (subT ts F.R.one u)).py Q) ((Fm (subT ts F.R.one u)).py P) := by
rw [sw.fam.py, sw.fam.py, lin_sub, lin_sub, lin1, lin1]
have hm : lin F (G0.py P) (G1.py P) ts = lin F (G0.py Q) (G1.py Q) ts := by rw [← sw.fam.py, ← sw.fam.py]; exact hmt
rw [hm]
apply pos_sub F
rw [show sub F.R (lin F (lin F (G0.py Q) (G1.py Q) ts) (G1.py P) u) (lin F (lin F (G0.py Q) (G1.py Q) ts) (G1.py Q) u) =
F.R.mul u (sub F.R (G1.py P) (G1.py Q)) by unfold lin; lib_ring]
exact F.mul_pos _ _ h0 (sub_pos F sw.hi1)
theorem xpq {ts : F.K} (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q) :
F.lt (xr G0 P) (G0.px Q) ∨ F.lt (xr G0 Q) (G0.px P) := by
have := (sw.fam.valid ts (in_open t0 t1)).pts P Q (by rw [sw.fam.nn]; exact sw.hP) (by rw [sw.fam.nn]; exact sw.hQ) sw.ne hmt
rw [sw.fam.px, xrF sw.fam, xrF sw.fam] at this; exact this
end U
end TP
end Found
#print axioms Found.TP.same_side
#print axioms Found.TP.same_order
#print axioms Found.TP.pass_sides
#print axioms Found.TP.pass_orders
#print axioms Found.TP.pq_before
#print axioms Found.TP.qp_after
#print axioms Found.TP.xpq
lean_all/found/Top9.lean
/-
T193 (topological), part 9. found/Top9 — the inputs and outputs of the
swapping boxes: at the start the inputs of Q lie on the side of Q's
position at P's height and the outputs of P on the side of P's position
at Q's height (they reach those positions at the meeting time without
ever touching the other box); symmetrically at the end. Orders along a
slab of heights at a fixed time.
Lean 4 core only, hand-written proofs (lib_ring for ring identities), no axioms.
-/
import found.Top8
namespace Found
namespace TP
open DetChain LibRing SD
variable {F : OF} {S : Sig}
theorem lin_in {a b u : F.K} (hab : F.lt a b) (h0 : le F F.R.zero u) (h1 : F.lt u F.R.one) :
le F a (lin F a b u) ∧ F.lt (lin F a b u) b := by
have d := sub_pos F hab
refine ⟨h0.elim (fun hp => .inl (pos_sub F (by
rw [show sub F.R (lin F a b u) a = F.R.mul u (sub F.R b a) by unfold lin; lib_ring]
exact F.mul_pos _ _ hp d))) (fun e => .inr (by rw [← e]; unfold lin; lib_ring)), pos_sub F ?_⟩
rw [show sub F.R b (lin F a b u) = F.R.mul (sub F.R F.R.one u) (sub F.R b a) by unfold lin; lib_ring]
exact F.mul_pos _ _ (sub_pos F h1) d
theorem lin_in' {a b u : F.K} (hab : F.lt b a) (h0 : le F F.R.zero u) (h1 : F.lt u F.R.one) :
F.lt b (lin F a b u) ∧ le F (lin F a b u) a := by
have d := sub_pos F hab
refine ⟨pos_sub F ?_, h0.elim (fun hp => .inl (pos_sub F (by
rw [show sub F.R a (lin F a b u) = F.R.mul u (sub F.R a b) by unfold lin; lib_ring]
exact F.mul_pos _ _ hp d))) (fun e => .inr (by rw [← e]; unfold lin; lib_ring))⟩
rw [show sub F.R (lin F a b u) b = F.R.mul (sub F.R F.R.one u) (sub F.R a b) by unfold lin; lib_ring]
exact F.mul_pos _ _ (sub_pos F h1) d
theorem hiF {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) (t : F.K) (e : Nat × Nat) :
hiN (Fm t) e = hiN G0 e := by unfold hiN; rw [h.tgt]
theorem xsF {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) (t : F.K) (e : Nat × Nat) :
xs (Fm t) e = xs G0 e := by unfold xs; rw [h.px, h.ox]
theorem xtF {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) (t : F.K) (e : Nat × Nat) :
xt (Fm t) e = xt G0 e := by unfold xt hiN; rw [h.px, h.ix, h.tgt]
theorem xs_in0 {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) {e : Nat × Nat} (he : Seg G0 e) :
le F (G0.px e.1) (xs G0 e) ∧ le F (xs G0 e) (xr G0 e.1) := by
have := xs_in (h.valid F.R.zero in0) ((segF h _ e).2 he)
rw [xsF h, h.px, xrF h] at this; exact this
theorem xt_in0 {G0 G1 : Drw F S} {Fm : F.K → Drw F S} (h : LinFam G0 G1 Fm) {e : Nat × Nat} (he : Seg G0 e) :
le F (G0.px (hiN G0 e)) (xt G0 e) ∧ le F (xt G0 e) (xr G0 (hiN G0 e)) := by
have := xt_in (h.valid F.R.zero in0) ((segF h _ e).2 he)
rw [xtF h, h.px, xrF h, hiF h] at this; exact this
/-- the two sides with respect to a bar persist when the bar is never met -/
theorem bar_side {a b c d : F.K} (hz : ∀ u, In01 F u → F.lt (lin F a b u) c ∨ F.lt d (lin F a b u)) (hcd : le F c d) :
(F.lt a c ↔ F.lt b c) ∧ (F.lt d a ↔ F.lt d b) := by
have s1 := same_side (fun u hu => (out_ne hcd (hz u hu)).1) F.R.one in1
have s2 := same_side (fun u hu => (out_ne hcd (hz u hu)).2) F.R.one in1
rw [lin1] at s1 s2
exact ⟨s1.1, s2.2⟩
section V
variable {G0 G1 : Drw F S} {Fm : F.K → Drw F S} {P Q : Nat} (sw : Swap G0 G1 Fm P Q)
{ts : F.K} (t0 : F.lt F.R.zero ts) (t1 : F.lt ts F.R.one) (hmt : (Fm ts).py P = (Fm ts).py Q)
include sw t0 t1 hmt
theorem bars : F.lt (xr G0 P) (G0.px Q) ∨ F.lt (xr G0 Q) (G0.px P) := xpq sw t0 t1 hmt
theorem bars' : F.lt (xr G0 Q) (G0.px P) ∨ F.lt (xr G0 P) (G0.px Q) := (xpq sw t0 t1 hmt).symm
omit t0 t1 hmt in
theorem nodesF {t : F.K} (ht : In01 F t) {e : Nat × Nat} (hs : Seg G0 e) {k : Nat} (hk : k < G0.nn)
(ho : Open (Fm t) e ((Fm t).py k)) :
F.lt (lin F (X G0 e (G0.py k)) (X G1 e (G1.py k)) t) (G0.px k) ∨ F.lt (xr G0 k) (lin F (X G0 e (G0.py k)) (X G1 e (G1.py k)) t) := by
have := (sw.fam.valid t ht).nodes e k ((segF sw.fam t e).2 hs) (by rw [sw.fam.nn]; exact hk) ho
rw [sw.fam.X t e k hs, sw.fam.px, xrF sw.fam] at this; exact this
omit t0 t1 hmt in
theorem pxleP : le F (G0.px P) (xr G0 P) := pxle sw.fam P sw.hP
omit t0 t1 hmt in
theorem pxleQ : le F (G0.px Q) (xr G0 Q) := pxle sw.fam Q sw.hQ
/-- inputs of Q at P's height, at the start -/
theorem inQ_side {e : Nat × Nat} (he : InN G0 Q e) :
(F.lt (X G0 e (G0.py P)) (G0.px P) ↔ F.lt (xt G0 e) (G0.px P)) ∧
(F.lt (xr G0 P) (X G0 e (G0.py P)) ↔ F.lt (xr G0 P) (xt G0 e)) := by
have hs := he.1
have hlo : F.lt (G0.py e.1) (G0.py P) := ((atP0 sw e).2 (.inl he)).2.1
have pr := prog0 sw e hs
have lQ : e.1 ≠ Q := fun h' => F.irr _ (by rw [he.2, h'] at pr; exact pr)
have lP : e.1 ≠ P := fun h' => (no_PQ sw hs).1 ⟨h', he.2⟩
have vstar : lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts = xt G0 e := by
rw [← sw.fam.X ts e P hs, hmt]
have hne : (Fm ts).py (hiN (Fm ts) e) ≠ (Fm ts).py e.1 := by
have := (sw.fam.valid ts (in_open t0 t1)).prog e ((segF sw.fam ts e).2 hs)
exact fun h' => F.irr _ (by rw [h'] at this; exact this)
have := X_hi (Fm ts) e hne
rw [hiF sw.fam, he.2, xtF sw.fam] at this
exact this
have vin := xt_in0 sw.fam hs
rw [he.2] at vin
have hz : ∀ u, In01 F u → F.lt (lin F (X G0 e (G0.py P)) (lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts) u) (G0.px P) ∨
F.lt (xr G0 P) (lin F (X G0 e (G0.py P)) (lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts) u) := by
intro u hu
match hu.2 with
| .inr e1 => rw [vstar, e1, lin1]; exact off_bar vin.1 vin.2 (bars sw t0 t1 hmt)
| .inl u1 =>
rw [← lin_comp]
have ht := mul_in t0 t1 hu.1 u1
exact nodesF sw ht hs sw.hP (openFt sw _ ((keepP sw hs.1 lP lQ).1 hlo _ ht) (by rw [he.2]; exact pq_before sw hmt u1))
have ss := bar_side hz (pxleP sw)
rw [vstar] at ss
exact ss
/-- outputs of P at Q's height, at the start -/
theorem outP_side {e : Nat × Nat} (he : OutN G0 P e) :
(F.lt (X G0 e (G0.py Q)) (G0.px Q) ↔ F.lt (xs G0 e) (G0.px Q)) ∧
(F.lt (xr G0 Q) (X G0 e (G0.py Q)) ↔ F.lt (xr G0 Q) (xs G0 e)) := by
have hs := he.1
have hhi : F.lt (G0.py Q) (G0.py (hiN G0 e)) := ((atQ0 sw e).2 (.inl he)).2.2
have hh := hi_lt sw e hs
have pr := prog0 sw e hs
have hP' : hiN G0 e ≠ P := fun h' => F.irr _ (by rw [he.2, h'] at pr; exact pr)
have hQ' : hiN G0 e ≠ Q := fun h' => (no_PQ sw hs).1 ⟨he.2, h'⟩
have vstar : lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts = xs G0 e := by
rw [← sw.fam.X ts e Q hs, ← hmt, ← he.2, X_lo, xsF sw.fam]
have vin := xs_in0 sw.fam hs
rw [he.2] at vin
have hz : ∀ u, In01 F u → F.lt (lin F (X G0 e (G0.py Q)) (lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts) u) (G0.px Q) ∨
F.lt (xr G0 Q) (lin F (X G0 e (G0.py Q)) (lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts) u) := by
intro u hu
match hu.2 with
| .inr e1 => rw [vstar, e1, lin1]; exact off_bar vin.1 vin.2 (bars' sw t0 t1 hmt)
| .inl u1 =>
rw [← lin_comp]
have ht := mul_in t0 t1 hu.1 u1
exact nodesF sw ht hs sw.hQ (openFt sw _ (by rw [he.2]; exact pq_before sw hmt u1) ((keepQ sw hh hP' hQ').2 hhi _ ht))
have ss := bar_side hz (pxleQ sw)
rw [vstar] at ss
exact ss
/-- inputs of P at Q's height, at the end -/
theorem inP_side1 {e : Nat × Nat} (he : InN G1 P e) :
(F.lt (X G1 e (G1.py Q)) (G0.px Q) ↔ F.lt (xt G0 e) (G0.px Q)) ∧
(F.lt (xr G0 Q) (X G1 e (G1.py Q)) ↔ F.lt (xr G0 Q) (xt G0 e)) := by
have hs := (seg1' sw e).1 he.1
have hP0 : hiN G0 e = P := by rw [← hiN1 sw]; exact he.2
have hlo1 : F.lt (G1.py e.1) (G1.py Q) := ((atQ1 sw e).2 (.inl he)).2.1
have pr := prog0 sw e hs
have lP : e.1 ≠ P := fun h' => F.irr _ (by rw [hP0, h'] at pr; exact pr)
have lQ : e.1 ≠ Q := fun h' => (no_PQ sw hs).2 ⟨h', hP0⟩
have hlo : F.lt (G0.py e.1) (G0.py Q) := (keepQ1 sw hs.1 lP lQ).1 hlo1
have vstar : lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts = xt G0 e := by
rw [← sw.fam.X ts e Q hs, ← hmt]
have hne : (Fm ts).py (hiN (Fm ts) e) ≠ (Fm ts).py e.1 := by
have := (sw.fam.valid ts (in_open t0 t1)).prog e ((segF sw.fam ts e).2 hs)
exact fun h' => F.irr _ (by rw [h'] at this; exact this)
have := X_hi (Fm ts) e hne
rw [hiF sw.fam, hP0, xtF sw.fam] at this
exact this
have vin := xt_in0 sw.fam hs
rw [hP0] at vin
have hz : ∀ u, In01 F u → F.lt (lin F (lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts) (X G1 e (G1.py Q)) u) (G0.px Q) ∨
F.lt (xr G0 Q) (lin F (lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts) (X G1 e (G1.py Q)) u) := by
intro u hu
match hu.1 with
| .inr e0 => rw [vstar, ← e0, lin0]; exact off_bar vin.1 vin.2 (bars' sw t0 t1 hmt)
| .inl u0 =>
have eq : lin F (lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) ts) (X G1 e (G1.py Q)) u =
lin F (X G0 e (G0.py Q)) (X G1 e (G1.py Q)) (subT ts F.R.one u) := by rw [lin_sub, lin1]
rw [eq]
have ht := after_in t0 t1 u0 hu.2
exact nodesF sw ht hs sw.hQ (openFt sw _ ((keepQ sw hs.1 lP lQ).1 hlo _ ht) (by rw [hP0]; exact qp_after sw hmt u0))
have ss := bar_side hz (pxleQ sw)
rw [vstar] at ss
exact ⟨ss.1.symm, ss.2.symm⟩
/-- outputs of Q at P's height, at the end -/
theorem outQ_side1 {e : Nat × Nat} (he : OutN G1 Q e) :
(F.lt (X G1 e (G1.py P)) (G0.px P) ↔ F.lt (xs G0 e) (G0.px P)) ∧
(F.lt (xr G0 P) (X G1 e (G1.py P)) ↔ F.lt (xr G0 P) (xs G0 e)) := by
have hs := (seg1' sw e).1 he.1
have hhi1 : F.lt (G1.py P) (G1.py (hiN G1 e)) := ((atP1 sw e).2 (.inl he)).2.2
have hh := hi_lt sw e hs
have pr := prog0 sw e hs
have hQ' : hiN G0 e ≠ Q := fun h' => F.irr _ (by rw [he.2, h'] at pr; exact pr)
have hP' : hiN G0 e ≠ P := fun h' => (no_PQ sw hs).2 ⟨he.2, h'⟩
rw [hiN1 sw] at hhi1
have hhi : F.lt (G0.py P) (G0.py (hiN G0 e)) := (keepP1 sw hh hP' hQ').2 hhi1
have vstar : lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts = xs G0 e := by
rw [← sw.fam.X ts e P hs, hmt, ← he.2, X_lo, xsF sw.fam]
have vin := xs_in0 sw.fam hs
rw [he.2] at vin
have hz : ∀ u, In01 F u → F.lt (lin F (lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts) (X G1 e (G1.py P)) u) (G0.px P) ∨
F.lt (xr G0 P) (lin F (lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts) (X G1 e (G1.py P)) u) := by
intro u hu
match hu.1 with
| .inr e0 => rw [vstar, ← e0, lin0]; exact off_bar vin.1 vin.2 (bars sw t0 t1 hmt)
| .inl u0 =>
have eq : lin F (lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) ts) (X G1 e (G1.py P)) u =
lin F (X G0 e (G0.py P)) (X G1 e (G1.py P)) (subT ts F.R.one u) := by rw [lin_sub, lin1]
rw [eq]
have ht := after_in t0 t1 u0 hu.2
exact nodesF sw ht hs sw.hP (openFt sw _ (by rw [he.2]; exact qp_after sw hmt u0) ((keepP sw hh hP' hQ').2 hhi _ ht))
have ss := bar_side hz (pxleP sw)
rw [vstar] at ss
exact ⟨ss.1.symm, ss.2.symm⟩
end V
end TP
end Found
#print axioms Found.TP.lin_in
#print axioms Found.TP.bar_side
#print axioms Found.TP.inQ_side
#print axioms Found.TP.outP_side
#print axioms Found.TP.inP_side1
#print axioms Found.TP.outQ_side1
lean_all/found/Topos.lean
/-
T63. found/Topos — the subobject classifier and its Heyting algebra.
* Heyting algebras (preorder form, equality = two-way ≤, no propext).
* Ω = (Prop, ↔) is a setoid and a Heyting algebra; ∧, ∨, → are maps of setoids.
* Sub(X) = respecting predicates on a setoid X: a Heyting algebra.
* Ω classifies: the subsetoid {x | φ x} is the pullback of `true` along χ_φ
(universal property, unique factorisation), χ is unique (two predicates
with isomorphic subsetoids over X are equivalent), every mono m has a
characteristic map χ_m whose pullback receives m by a map that is mono and
surjective on classes; with a choice of preimages it is an isomorphism.
* Power objects P X = X ⇒ Ω from the CCC of setoids.
So setoids with Ω = (Prop, ↔) are a topos up to the unique-choice step for
monos; for subobjects given by predicates no choice is needed.
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: Ω = Prop (impredicative Prop, proof irrelevance), subtypes {x // φ x}.
-/
import found.CCC
namespace Found
universe u
/-! ## Heyting algebras -/
structure HA where
car : Type u
le : car → car → Prop
le_refl : ∀ a, le a a
le_trans : ∀ {a b c}, le a b → le b c → le a c
top : car
bot : car
meet : car → car → car
join : car → car → car
imp : car → car → car
le_top : ∀ a, le a top
bot_le : ∀ a, le bot a
meet_l : ∀ a b, le (meet a b) a
meet_r : ∀ a b, le (meet a b) b
meet_univ : ∀ {a b c}, le c a → le c b → le c (meet a b)
join_l : ∀ a b, le a (join a b)
join_r : ∀ a b, le b (join a b)
join_univ : ∀ {a b c}, le a c → le b c → le (join a b) c
imp_adj : ∀ {a b c}, le (meet c a) b ↔ le c (imp a b)
namespace HA
variable (H : HA.{u})
def neg (a : H.car) : H.car := H.imp a H.bot
theorem mp (a b : H.car) : H.le (H.meet (H.imp a b) a) b :=
H.imp_adj.mpr (H.le_refl _)
theorem meet_neg (a : H.car) : H.le (H.meet a (H.neg a)) H.bot :=
H.le_trans (H.meet_univ (H.meet_r _ _) (H.meet_l _ _)) (H.mp a H.bot)
theorem le_negneg (a : H.car) : H.le a (H.neg (H.neg a)) :=
H.imp_adj.mp (H.meet_neg a)
theorem neg_antitone {a b : H.car} (h : H.le a b) : H.le (H.neg b) (H.neg a) :=
H.imp_adj.mp (H.le_trans (H.meet_univ (H.meet_l _ _) (H.le_trans (H.meet_r _ _) h))
(H.mp b H.bot))
theorem negnegneg (a : H.car) : H.le (H.neg (H.neg (H.neg a))) (H.neg a) :=
H.neg_antitone (H.le_negneg a)
/-- modus ponens for ≤ : `a ≤ b ⇒ c` and `a ≤ b` give `a ≤ c` -/
theorem imp_elim {a b c : H.car} (h1 : H.le a (H.imp b c)) (h2 : H.le a b) : H.le a c :=
H.le_trans (H.meet_univ h1 h2) (H.mp b c)
end HA
/-! ## Ω = (Prop, ↔) -/
def OmegaS : Setd.{0} := ⟨Prop, Iff, Iff.refl, Iff.symm, Iff.trans⟩
def OmegaHA : HA.{0} where
car := Prop
le p q := p → q
le_refl _ h := h
le_trans h k x := k (h x)
top := True
bot := False
meet := And
join := Or
imp p q := p → q
le_top _ _ := trivial
bot_le _ h := h.elim
meet_l _ _ h := h.1
meet_r _ _ h := h.2
meet_univ h k x := ⟨h x, k x⟩
join_l _ _ h := Or.inl h
join_r _ _ h := Or.inr h
join_univ h k x := x.elim h k
imp_adj := ⟨fun h c a => h ⟨c, a⟩, fun h x => h x.1 x.2⟩
def trueS : SHom (unitS.{0}) OmegaS := ⟨fun _ => True, fun _ => Iff.rfl⟩
def andS : SHom (prodS OmegaS OmegaS) OmegaS :=
⟨fun p => p.1 ∧ p.2, fun h => ⟨fun x => ⟨h.1.mp x.1, h.2.mp x.2⟩, fun x => ⟨h.1.mpr x.1, h.2.mpr x.2⟩⟩⟩
def orS : SHom (prodS OmegaS OmegaS) OmegaS :=
⟨fun p => p.1 ∨ p.2, fun h =>
⟨fun x => x.elim (fun a => Or.inl (h.1.mp a)) (fun b => Or.inr (h.2.mp b)),
fun x => x.elim (fun a => Or.inl (h.1.mpr a)) (fun b => Or.inr (h.2.mpr b))⟩⟩
def impS : SHom (prodS OmegaS OmegaS) OmegaS :=
⟨fun p => p.1 → p.2, fun h => ⟨fun f a => h.2.mp (f (h.1.mpr a)), fun f a => h.2.mpr (f (h.1.mp a))⟩⟩
/-! ## Sub(X): respecting predicates -/
def Resp (X : Setd.{0}) (φ : X.car → Prop) : Prop := ∀ {x y}, X.eqv x y → φ x → φ y
structure Pred (X : Setd.{0}) where
p : X.car → Prop
resp : Resp X p
def SubHA (X : Setd.{0}) : HA.{0} where
car := Pred X
le φ ψ := ∀ x, φ.p x → ψ.p x
le_refl _ _ h := h
le_trans h k x a := k x (h x a)
top := ⟨fun _ => True, fun _ _ => trivial⟩
bot := ⟨fun _ => False, fun _ h => h⟩
meet φ ψ := ⟨fun x => φ.p x ∧ ψ.p x, fun e h => ⟨φ.resp e h.1, ψ.resp e h.2⟩⟩
join φ ψ := ⟨fun x => φ.p x ∨ ψ.p x,
fun e h => h.elim (fun a => Or.inl (φ.resp e a)) (fun b => Or.inr (ψ.resp e b))⟩
imp φ ψ := ⟨fun x => φ.p x → ψ.p x,
fun e f a => ψ.resp e (f (φ.resp (X.symm e) a))⟩
le_top _ _ _ := trivial
bot_le _ _ h := h.elim
meet_l _ _ _ h := h.1
meet_r _ _ _ h := h.2
meet_univ h k x a := ⟨h x a, k x a⟩
join_l _ _ _ h := Or.inl h
join_r _ _ _ h := Or.inr h
join_univ h k x a := a.elim (h x) (k x)
imp_adj := ⟨fun h x c a => h x ⟨c, a⟩, fun h x a => h x a.1 a.2⟩
/-! ## Ω classifies subsetoids -/
section Classify
variable {X : Setd.{0}}
def subS (X : Setd.{0}) (φ : X.car → Prop) : Setd.{0} where
car := {x // φ x}
eqv a b := X.eqv a.val b.val
refl a := X.refl a.val
symm h := X.symm h
trans h k := X.trans h k
def incl (φ : X.car → Prop) : SHom (subS X φ) X := ⟨Subtype.val, fun h => h⟩
/-- the characteristic map of a respecting predicate -/
def chi (φ : Pred X) : SHom X OmegaS := ⟨φ.p, fun e => ⟨φ.resp e, φ.resp (X.symm e)⟩⟩
/-- the square commutes: χ ∘ incl = true ∘ ! -/
theorem chi_square (φ : Pred X) :
SetdCat.heq (SetdCat.comp (incl φ.p) (chi φ))
(SetdCat.comp (setdTerminal.bang (subS X φ.p)) trueS) :=
fun a => ⟨fun _ => trivial, fun _ => a.property⟩
/-- the pullback: every map landing in φ factors through the subsetoid -/
def factor (φ : Pred X) {Z : Setd.{0}} (f : SHom Z X) (hf : ∀ z, φ.p (f.fn z)) :
SHom Z (subS X φ.p) := ⟨fun z => ⟨f.fn z, hf z⟩, fun h => f.resp h⟩
theorem factor_comm (φ : Pred X) {Z : Setd.{0}} (f : SHom Z X) (hf : ∀ z, φ.p (f.fn z)) :
SetdCat.heq (SetdCat.comp (factor φ f hf) (incl φ.p)) f := fun z => X.refl (f.fn z)
theorem factor_uniq (φ : Pred X) {Z : Setd.{0}} (f : SHom Z X) (hf : ∀ z, φ.p (f.fn z))
(g : SHom Z (subS X φ.p)) (hg : SetdCat.heq (SetdCat.comp g (incl φ.p)) f) :
SetdCat.heq g (factor φ f hf) := hg
/-- a map whose χ-image is true lands in φ (the pullback condition in Ω) -/
theorem lands_of_chi (φ : Pred X) {Z : Setd.{0}} (f : SHom Z X)
(h : SetdCat.heq (SetdCat.comp f (chi φ)) (SetdCat.comp (setdTerminal.bang Z) trueS)) :
∀ z, φ.p (f.fn z) := fun z => (h z).mpr trivial
/-- uniqueness of χ: predicates with isomorphic subsetoids over X agree -/
theorem chi_unique (φ ψ : Pred X)
(u : SHom (subS X φ.p) (subS X ψ.p))
(hu : SetdCat.heq (SetdCat.comp u (incl ψ.p)) (incl φ.p))
(w : SHom (subS X ψ.p) (subS X φ.p))
(hw : SetdCat.heq (SetdCat.comp w (incl φ.p)) (incl ψ.p)) :
∀ x, φ.p x ↔ ψ.p x :=
fun x => ⟨fun a => ψ.resp (hu ⟨x, a⟩) (u.fn ⟨x, a⟩).property,
fun b => φ.resp (hw ⟨x, b⟩) (w.fn ⟨x, b⟩).property⟩
/-! ### monos -/
def Mono {A : Setd.{0}} (m : SHom A X) : Prop := ∀ a a', X.eqv (m.fn a) (m.fn a') → A.eqv a a'
/-- the image predicate of any map -/
def imageP {A : Setd.{0}} (m : SHom A X) : Pred X :=
⟨fun x => ∃ a, X.eqv (m.fn a) x, fun e ⟨a, h⟩ => ⟨a, X.trans h e⟩⟩
def compare {A : Setd.{0}} (m : SHom A X) : SHom A (subS X (imageP m).p) :=
factor (imageP m) m (fun a => ⟨a, X.refl _⟩)
theorem compare_mono {A : Setd.{0}} (m : SHom A X) (hm : Mono m) :
∀ a a', (subS X (imageP m).p).eqv ((compare m).fn a) ((compare m).fn a') → A.eqv a a' :=
fun a a' h => hm a a' h
theorem compare_surj {A : Setd.{0}} (m : SHom A X) :
∀ y : (subS X (imageP m).p).car, ∃ a, (subS X (imageP m).p).eqv ((compare m).fn a) y :=
fun ⟨_, a, h⟩ => ⟨a, h⟩
/-- with a choice of preimages, the comparison of a mono is an isomorphism -/
theorem compare_iso {A : Setd.{0}} (m : SHom A X) (hm : Mono m)
(s : (x : X.car) → (∃ a, X.eqv (m.fn a) x) → A.car)
(hs : ∀ x h, X.eqv (m.fn (s x h)) x) :
∃ inv : SHom (subS X (imageP m).p) A,
SetdCat.heq (SetdCat.comp (compare m) inv) (SetdCat.id A) ∧
SetdCat.heq (SetdCat.comp inv (compare m)) (SetdCat.id _) :=
⟨⟨fun y => s y.val y.property,
fun {y y'} e => hm _ _ (X.trans (hs y.val y.property) (X.trans e (X.symm (hs y'.val y'.property))))⟩,
fun a => hm _ _ (hs (m.fn a) _),
fun y => hs y.val y.property⟩
end Classify
/-! ## Power objects from the CCC: P X = X ⇒ Ω -/
def powerS (X : Setd.{0}) : Setd.{0} := expS X OmegaS
def memS (X : Setd.{0}) : SHom (prodS (powerS X) X) OmegaS := setdCCC.ev X OmegaS
/-- every relation `R ⊆ Z × X` (as a map to Ω) is named by a unique `Z → P X` -/
theorem power_beta {Z X : Setd.{0}} (R : SHom (prodS Z X) OmegaS) :
SetdCat.heq (SetdCat.comp (setdCCC.times X (setdCCC.curry R)) (memS X)) R :=
setdCCC.beta R
theorem power_uniq {Z X : Setd.{0}} (R : SHom (prodS Z X) OmegaS) (k : SHom Z (powerS X))
(h : SetdCat.heq (SetdCat.comp (setdCCC.times X k) (memS X)) R) :
SetdCat.heq k (setdCCC.curry R) := setdCCC.curry_uniq k R h
end Found
#print axioms Found.HA.mp
#print axioms Found.HA.meet_neg
#print axioms Found.HA.le_negneg
#print axioms Found.HA.neg_antitone
#print axioms Found.HA.negnegneg
#print axioms Found.HA.imp_elim
#print axioms Found.OmegaHA
#print axioms Found.andS
#print axioms Found.orS
#print axioms Found.impS
#print axioms Found.SubHA
#print axioms Found.chi_square
#print axioms Found.factor_comm
#print axioms Found.factor_uniq
#print axioms Found.lands_of_chi
#print axioms Found.chi_unique
#print axioms Found.compare_mono
#print axioms Found.compare_surj
#print axioms Found.compare_iso
#print axioms Found.power_beta
#print axioms Found.power_uniq
lean_all/found/Truth.lean
/-
T192. found/Truth — theories of truth as a point, via Lawvere's
fixed-point theorem on the function-space operation (T59, op 2).
* Lawvere: if e : A → (A → B) is point-surjective (every g : A → B is
e a up to pointwise ≈), then every f : B → B has a fixed point up to ≈.
* Corollaries: Cantor (no point-surjection A → (A → Prop) up to ↔),
and Tarski-style undefinability: no "truth predicate" T on codes with
T(code φ) ↔ φ for all predicates φ obtained by diagonalisation; liar.
* Kripke's partial truth (fixed points of the Kleene jump, T140) is the
line to three-valued logic (cited).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Truth
universe u v
/-- Lawvere's fixed-point theorem, with an arbitrary equivalence on B -/
theorem lawvere {A : Type u} {B : Type v} (R : B → B → Prop)
(e : A → A → B) (surj : ∀ g : A → B, ∃ a, ∀ x, R (e a x) (g x)) (f : B → B) :
∃ b, R b (f b) :=
match surj (fun x => f (e x x)) with
| ⟨a, h⟩ => ⟨e a a, h a⟩
/-- Cantor: no point-surjection A → (A → Prop) up to ↔ -/
theorem cantor {A : Type u} (e : A → A → Prop) : ¬ ∀ g : A → Prop, ∃ a, ∀ x, (e a x ↔ g x) :=
fun surj => match lawvere (fun p q : Prop => p ↔ q) e surj Not with
| ⟨b, h⟩ => have n : ¬ b := fun hb => h.mp hb hb
n (h.mpr n)
/-- Tarski-style undefinability: a "truth predicate" T on codes A with a
diagonal substitution sub (sub a x codes "e a applied to x") cannot satisfy
T (sub a x) ↔ e a x for every a, x, when every predicate on A is some e a -/
theorem undefinable {A : Type u} (e : A → A → Prop) (T : A → Prop) (sub : A → A → A)
(hT : ∀ a x, T (sub a x) ↔ e a x)
(hrep : ∀ g : A → Prop, ∃ a, ∀ x, (e a x ↔ g x)) : False :=
match hrep (fun x => ¬ T (sub x x)) with
| ⟨a, h⟩ =>
have k : T (sub a a) ↔ ¬ T (sub a a) := (hT a a).trans (h a)
have n : ¬ T (sub a a) := fun t => k.mp t t
n (k.mpr n)
end Truth
end Found
#print axioms Found.Truth.lawvere
#print axioms Found.Truth.cantor
#print axioms Found.Truth.undefinable
lean_all/found/TwoLevel.lean
/-
T122. found/TwoLevel — two-level type theory as a point: an outer strict
equality (Lean's Eq, with UIP — T99) and an inner path equality given by
an interval parameter (T127 OP1).
* Strict equality gives inner paths (ofEq), compatible with composition
by Eq: the outer level controls the inner one.
* Inner paths need not be strict: on the two-point interval a non-constant
map gives a path between distinct points (the outer/inner split).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.OrtonPitts
namespace Found
namespace TwoL
open OP
/-- outer equality ⇒ inner path -/
def outerToInner (J : Interval) {A : Type} {a b : A} (e : a = b) : Path J A a b := ofEq J e
/-- a path that is strictly constant comes from an outer equality -/
theorem innerConstToOuter (J : Interval) {A : Type} {a b : A} (q : Path J A a b)
(h : ∀ i, q.p i = q.p J.i0) : a = b := eq_of_const J q h
/-- on the two-point interval, the identity map is an inner path between the distinct
endpoints — inner paths are finer than outer equality -/
def nonstrict : Path two Two Two.o Two.l := ⟨fun i => i, rfl, rfl⟩
theorem nonstrict_distinct : (Two.o : Two) ≠ Two.l := fun e => Two.noConfusion e
end TwoL
end Found
#print axioms Found.TwoL.outerToInner
#print axioms Found.TwoL.innerConstToOuter
#print axioms Found.TwoL.nonstrict
#print axioms Found.TwoL.nonstrict_distinct
lean_all/found/TwoTM1.lean
/-
Line two-counter machines → Turing machines, part 1. found/TwoTM1 — the
tape encodes the counters in unary around the head: x ones to the left,
the head on a 0 separator, y ones to the right (onesOn n z = z with n ones
pushed). Walking over a block of ones in either direction; the Turing
machine of a two-counter program (eight states per instruction, state
8·pc + j), given by a rule table read off the program (rule lookup go_at).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.TMReg
import found.Minsky3
namespace Found
namespace TT
open TMR RM
theorem rtrans {M : TM} {a b c : Cfg} (h1 : TMR.Reach M a b) (h2 : TMR.Reach M b c) : TMR.Reach M a c := by
induction h1 with
| refl => exact h2
| step s _ ih => exact .step s (ih h2)
theorem sR {M : TM} {q L R q' R' : Nat} {h w h' : Bool} (hd : M.δ q h = some (q', w, true))
(e : R = 2 * R' + bit h') : TMR.Reach M ⟨q, L, h, R⟩ ⟨q', 2 * L + bit w, h', R'⟩ :=
.step (Step.right (c := ⟨q, L, h, R⟩) hd e) (.refl _)
theorem sL {M : TM} {q L R q' L' : Nat} {h w h' : Bool} (hd : M.δ q h = some (q', w, false))
(e : L = 2 * L' + bit h') : TMR.Reach M ⟨q, L, h, R⟩ ⟨q', L', h', 2 * R + bit w⟩ :=
.step (Step.left (c := ⟨q, L, h, R⟩) hd e) (.refl _)
theorem rcast {M : TM} {a : Cfg} {q L R L' R' : Nat} {hb : Bool} (r : TMR.Reach M a ⟨q, L, hb, R⟩)
(e1 : L = L') (e2 : R = R') : TMR.Reach M a ⟨q, L', hb, R'⟩ := by
rw [← e1, ← e2]; exact r
/-! ## blocks of ones -/
def onesOn : Nat → Nat → Nat
| 0, z => z
| n + 1, z => 2 * onesOn n z + 1
def ones (n : Nat) : Nat := onesOn n 0
theorem onesOn_succ : (n z : Nat) → onesOn n (2 * z + 1) = onesOn (n + 1) z
| 0, _ => rfl
| n + 1, z => by show 2 * onesOn n (2 * z + 1) + 1 = 2 * onesOn (n + 1) z + 1; rw [onesOn_succ n z]
theorem ones_one (n : Nat) : onesOn n 1 = ones (n + 1) := onesOn_succ n 0
/-- walking right over n+1 ones (head on the first), stopping on the 0 after them -/
theorem walkR {M : TM} {W : Nat} (hW : M.δ W true = some (W, true, true)) :
(n L z : Nat) → TMR.Reach M ⟨W, L, true, onesOn n (2 * z)⟩ ⟨W, onesOn (n + 1) L, false, z⟩
| 0, _, _ => sR hW rfl
| n + 1, L, z => rtrans (sR (h' := true) hW rfl)
(rcast (walkR hW n (2 * L + 1) z) (onesOn_succ (n + 1) L) rfl)
/-- walking left over n+1 ones -/
theorem walkL {M : TM} {W : Nat} (hW : M.δ W true = some (W, true, false)) :
(n R z : Nat) → TMR.Reach M ⟨W, onesOn n (2 * z), true, R⟩ ⟨W, z, false, onesOn (n + 1) R⟩
| 0, _, _ => sL hW rfl
| n + 1, R, z => rtrans (sL (h' := true) hW rfl)
(rcast (walkL hW n (2 * R + 1) z) rfl (onesOn_succ (n + 1) R))
/-! ## the rule table -/
abbrev Rule := Option (Nat × Bool × Bool)
def inc0R (g B : Nat) : Nat → Bool → Rule
| 0, h => cond h none (some (B + 1, true, true))
| 1, h => cond h (some (B + 3, false, true)) (some (B + 2, false, true))
| 2, h => some (8 * g, h, false)
| 3, h => cond h (some (B + 3, true, true)) (some (B + 4, true, false))
| 4, h => cond h (some (B + 4, true, false)) (some (B + 2, false, true))
| _ + 5, _ => none
def inc1R (g B : Nat) : Nat → Bool → Rule
| 0, h => cond h none (some (B + 1, true, false))
| 1, h => cond h (some (B + 3, false, false)) (some (B + 2, false, false))
| 2, h => some (8 * g, h, true)
| 3, h => cond h (some (B + 3, true, false)) (some (B + 4, true, true))
| 4, h => cond h (some (B + 4, true, true)) (some (B + 2, false, false))
| _ + 5, _ => none
def dec0R (a b B : Nat) : Nat → Bool → Rule
| 0, h => cond h none (some (B + 1, false, false))
| 1, h => cond h (some (B + 3, false, true)) (some (8 * a, false, true))
| 2, _ => none
| 3, h => cond h none (some (B + 4, true, true))
| 4, h => cond h (some (B + 4, true, true)) (some (B + 5, false, false))
| 5, h => cond h (some (B + 6, false, false)) none
| 6, h => cond h (some (B + 6, true, false)) (some (B + 7, false, true))
| 7, h => some (8 * b, h, false)
| _ + 8, _ => none
def dec1R (a b B : Nat) : Nat → Bool → Rule
| 0, h => cond h none (some (B + 1, false, true))
| 1, h => cond h (some (B + 3, false, false)) (some (8 * a, false, false))
| 2, _ => none
| 3, h => cond h none (some (B + 4, true, false))
| 4, h => cond h (some (B + 4, true, false)) (some (B + 5, false, true))
| 5, h => cond h (some (B + 6, false, true)) none
| 6, h => cond h (some (B + 6, true, true)) (some (B + 7, false, false))
| 7, h => some (8 * b, h, true)
| _ + 8, _ => none
def rl : Ins → Nat → Nat → Bool → Rule
| .inc0 g, B, j, h => inc0R g B j h
| .inc1 g, B, j, h => inc1R g B j h
| .dec0 a b, B, j, h => dec0R a b B j h
| .dec1 a b, B, j, h => dec1R a b B j h
| .halt, _, _, _ => none
def go : List Ins → Nat → Nat → Bool → Rule
| [], _, _, _ => none
| i :: rest, off, q, h => match q with
| 0 => rl i off 0 h
| 1 => rl i off 1 h
| 2 => rl i off 2 h
| 3 => rl i off 3 h
| 4 => rl i off 4 h
| 5 => rl i off 5 h
| 6 => rl i off 6 h
| 7 => rl i off 7 h
| k + 8 => go rest (off + 8) k h
theorem go_at : (prog : List Ins) → (off pc j : Nat) → (h : Bool) → j < 8 →
go prog off (8 * pc + j) h = rl (fetch prog pc) (off + 8 * pc) j h
| [], _, 0, _, _, _ => rfl
| [], _, _ + 1, _, _, _ => rfl
| _ :: _, _, 0, j, _, hj => match j, hj with
| 0, _ => rfl
| 1, _ => rfl
| 2, _ => rfl
| 3, _ => rfl
| 4, _ => rfl
| 5, _ => rfl
| 6, _ => rfl
| 7, _ => rfl
| k + 8, hk => absurd hk (Nat.not_lt_of_le (Nat.le_add_left 8 k))
| i :: rest, off, pc + 1, j, h, hj => by
rw [show 8 * (pc + 1) + j = 8 * pc + j + 8 by lib_nat]
show go rest (off + 8) (8 * pc + j) h = rl (fetch rest pc) (off + 8 * (pc + 1)) j h
rw [show off + 8 * (pc + 1) = off + 8 + 8 * pc by lib_nat]
exact go_at rest (off + 8) pc j h hj
/-- the Turing machine of a two-counter program -/
def tmOf (prog : List Ins) : TM := ⟨0, go prog 0⟩
theorem dl (prog : List Ins) (pc j : Nat) (h : Bool) (hj : j < 8) :
(tmOf prog).δ (8 * pc + j) h = rl (fetch prog pc) (8 * pc) j h := by
show go prog 0 (8 * pc + j) h = _
rw [go_at prog 0 pc j h hj, Nat.zero_add]
end TT
end Found
#print axioms Found.TT.rtrans
#print axioms Found.TT.onesOn_succ
#print axioms Found.TT.walkR
#print axioms Found.TT.walkL
#print axioms Found.TT.go_at
#print axioms Found.TT.dl
lean_all/found/TwoTM2.lean
/-
Line two-counter machines → Turing machines, part 2. found/TwoTM2 — the
four instruction gadgets of the Turing machine tmOf prog (found/TwoTM1),
from the home state 8·pc with the tape (x ones | 0 | y ones):
* inc0: write 1 on the separator and step right; if the y-block starts
there, mark the new separator, walk to its end, append a 1 and walk back;
* inc1: the mirror image;
* dec0: look at the cell left of the separator; if 0 (x = 0) return to a;
otherwise it becomes the new separator, the y-block is shifted left by
one (old separator := 1, last 1 erased) and the machine walks back to b;
* dec1: the mirror image.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.TwoTM1
namespace Found
namespace TT
open TMR RM
theorem rule {prog : List Ins} {pc : Nat} {i : Ins} (hf : fetch prog pc = i) (j : Nat) (h : Bool) (hj : j < 8) :
(tmOf prog).δ (8 * pc + j) h = rl i (8 * pc) j h :=
(dl prog pc j h hj).trans (congrArg (fun i => rl i (8 * pc) j h) hf)
theorem ltlit8 (j : Nat) (h : Nat.ble (j + 1) 8 = true) : j < 8 := Nat.le_of_ble_eq_true h
/-- the encoding of a two-counter configuration -/
def enc (c : Cf) : Cfg := ⟨8 * c.pc, ones c.r0, false, ones c.r1⟩
theorem g_inc0 (prog : List Ins) (pc g : Nat) (hf : fetch prog pc = .inc0 g) (x y : Nat) :
TMR.Reach (tmOf prog) ⟨8 * pc, ones x, false, ones y⟩ ⟨8 * g, ones (x + 1), false, ones y⟩ := by
have r0 : (tmOf prog).δ (8 * pc + 0) false = some (8 * pc + 1, true, true) := rule hf 0 false (ltlit8 0 rfl)
have r1f : (tmOf prog).δ (8 * pc + 1) false = some (8 * pc + 2, false, true) := rule hf 1 false (ltlit8 1 rfl)
have r1t : (tmOf prog).δ (8 * pc + 1) true = some (8 * pc + 3, false, true) := rule hf 1 true (ltlit8 1 rfl)
have r2 : ∀ b, (tmOf prog).δ (8 * pc + 2) b = some (8 * g, b, false) := fun b => rule hf 2 b (ltlit8 2 rfl)
have r3t : (tmOf prog).δ (8 * pc + 3) true = some (8 * pc + 3, true, true) := rule hf 3 true (ltlit8 3 rfl)
have r3f : (tmOf prog).δ (8 * pc + 3) false = some (8 * pc + 4, true, false) := rule hf 3 false (ltlit8 3 rfl)
have r4t : (tmOf prog).δ (8 * pc + 4) true = some (8 * pc + 4, true, false) := rule hf 4 true (ltlit8 4 rfl)
have r4f : (tmOf prog).δ (8 * pc + 4) false = some (8 * pc + 2, false, true) := rule hf 4 false (ltlit8 4 rfl)
cases y with
| zero =>
exact rtrans (sR r0 (R' := 0) (h' := false) rfl) (rtrans (sR r1f (R' := 0) (h' := false) rfl)
(sL (r2 false) (L' := 2 * ones x + bit true) (h' := false) rfl))
| succ y' =>
refine rtrans (sR r0 (R' := ones y') (h' := true) rfl) ?_
cases y' with
| zero =>
exact rtrans (sR r1t (R' := 0) (h' := false) rfl)
(rtrans (sL r3f (L' := 2 * ones x + bit true) (h' := false) rfl)
(rtrans (sR r4f (R' := 0) (h' := true) rfl)
(sL (r2 true) (L' := 2 * ones x + bit true) (h' := false) rfl)))
| succ y'' =>
refine rtrans (sR r1t (R' := ones y'') (h' := true) rfl) ?_
refine rtrans (walkR r3t y'' (2 * (2 * ones x + bit true) + bit false) 0) ?_
refine rtrans (sL r3f (L' := onesOn y'' (2 * (2 * ones x + bit true) + bit false)) (h' := true) rfl) ?_
refine rtrans (walkL r4t y'' (2 * 0 + bit true) (2 * ones x + bit true)) ?_
refine rtrans (sR r4f (R' := onesOn y'' (2 * 0 + bit true)) (h' := true) rfl) ?_
exact rcast (sL (r2 true) (L' := 2 * ones x + bit true) (h' := false) rfl) rfl
(by show 2 * onesOn y'' 1 + 1 = 2 * ones (y'' + 1) + 1; rw [ones_one])
theorem g_inc1 (prog : List Ins) (pc g : Nat) (hf : fetch prog pc = .inc1 g) (x y : Nat) :
TMR.Reach (tmOf prog) ⟨8 * pc, ones x, false, ones y⟩ ⟨8 * g, ones x, false, ones (y + 1)⟩ := by
have r0 : (tmOf prog).δ (8 * pc + 0) false = some (8 * pc + 1, true, false) := rule hf 0 false (ltlit8 0 rfl)
have r1f : (tmOf prog).δ (8 * pc + 1) false = some (8 * pc + 2, false, false) := rule hf 1 false (ltlit8 1 rfl)
have r1t : (tmOf prog).δ (8 * pc + 1) true = some (8 * pc + 3, false, false) := rule hf 1 true (ltlit8 1 rfl)
have r2 : ∀ b, (tmOf prog).δ (8 * pc + 2) b = some (8 * g, b, true) := fun b => rule hf 2 b (ltlit8 2 rfl)
have r3t : (tmOf prog).δ (8 * pc + 3) true = some (8 * pc + 3, true, false) := rule hf 3 true (ltlit8 3 rfl)
have r3f : (tmOf prog).δ (8 * pc + 3) false = some (8 * pc + 4, true, true) := rule hf 3 false (ltlit8 3 rfl)
have r4t : (tmOf prog).δ (8 * pc + 4) true = some (8 * pc + 4, true, true) := rule hf 4 true (ltlit8 4 rfl)
have r4f : (tmOf prog).δ (8 * pc + 4) false = some (8 * pc + 2, false, false) := rule hf 4 false (ltlit8 4 rfl)
cases x with
| zero =>
exact rtrans (sL r0 (L' := 0) (h' := false) rfl) (rtrans (sL r1f (L' := 0) (h' := false) rfl)
(sR (r2 false) (R' := 2 * ones y + bit true) (h' := false) rfl))
| succ x' =>
refine rtrans (sL r0 (L' := ones x') (h' := true) rfl) ?_
cases x' with
| zero =>
exact rtrans (sL r1t (L' := 0) (h' := false) rfl)
(rtrans (sR r3f (R' := 2 * ones y + bit true) (h' := false) rfl)
(rtrans (sL r4f (L' := 0) (h' := true) rfl)
(sR (r2 true) (R' := 2 * ones y + bit true) (h' := false) rfl)))
| succ x'' =>
refine rtrans (sL r1t (L' := ones x'') (h' := true) rfl) ?_
refine rtrans (walkL r3t x'' (2 * (2 * ones y + bit true) + bit false) 0) ?_
refine rtrans (sR r3f (R' := onesOn x'' (2 * (2 * ones y + bit true) + bit false)) (h' := true) rfl) ?_
refine rtrans (walkR r4t x'' (2 * 0 + bit true) (2 * ones y + bit true)) ?_
refine rtrans (sL r4f (L' := onesOn x'' (2 * 0 + bit true)) (h' := true) rfl) ?_
exact rcast (sR (r2 true) (R' := 2 * ones y + bit true) (h' := false) rfl)
(by show 2 * onesOn x'' 1 + 1 = 2 * ones (x'' + 1) + 1; rw [ones_one]) rfl
theorem g_dec0 (prog : List Ins) (pc a b : Nat) (hf : fetch prog pc = .dec0 a b) (y : Nat) :
TMR.Reach (tmOf prog) ⟨8 * pc, ones 0, false, ones y⟩ ⟨8 * a, ones 0, false, ones y⟩ ∧
∀ x', TMR.Reach (tmOf prog) ⟨8 * pc, ones (x' + 1), false, ones y⟩ ⟨8 * b, ones x', false, ones y⟩ := by
have r0 : (tmOf prog).δ (8 * pc + 0) false = some (8 * pc + 1, false, false) := rule hf 0 false (ltlit8 0 rfl)
have r1f : (tmOf prog).δ (8 * pc + 1) false = some (8 * a, false, true) := rule hf 1 false (ltlit8 1 rfl)
have r1t : (tmOf prog).δ (8 * pc + 1) true = some (8 * pc + 3, false, true) := rule hf 1 true (ltlit8 1 rfl)
have r3f : (tmOf prog).δ (8 * pc + 3) false = some (8 * pc + 4, true, true) := rule hf 3 false (ltlit8 3 rfl)
have r4t : (tmOf prog).δ (8 * pc + 4) true = some (8 * pc + 4, true, true) := rule hf 4 true (ltlit8 4 rfl)
have r4f : (tmOf prog).δ (8 * pc + 4) false = some (8 * pc + 5, false, false) := rule hf 4 false (ltlit8 4 rfl)
have r5t : (tmOf prog).δ (8 * pc + 5) true = some (8 * pc + 6, false, false) := rule hf 5 true (ltlit8 5 rfl)
have r6t : (tmOf prog).δ (8 * pc + 6) true = some (8 * pc + 6, true, false) := rule hf 6 true (ltlit8 6 rfl)
have r6f : (tmOf prog).δ (8 * pc + 6) false = some (8 * pc + 7, false, true) := rule hf 6 false (ltlit8 6 rfl)
have r7 : ∀ c, (tmOf prog).δ (8 * pc + 7) c = some (8 * b, c, false) := fun c => rule hf 7 c (ltlit8 7 rfl)
refine ⟨rtrans (sL r0 (L' := 0) (h' := false) rfl) (sR r1f (R' := ones y) (h' := false) rfl), fun x' => ?_⟩
refine rtrans (sL r0 (L' := ones x') (h' := true) rfl) ?_
refine rtrans (sR r1t (R' := ones y) (h' := false) rfl) ?_
cases y with
| zero =>
exact rtrans (sR r3f (R' := 0) (h' := false) rfl)
(rtrans (sL r4f (L' := 2 * ones x' + bit false) (h' := true) rfl)
(rtrans (sL r5t (L' := ones x') (h' := false) rfl)
(rtrans (sR r6f (R' := 0) (h' := false) rfl)
(sL (r7 false) (L' := ones x') (h' := false) rfl))))
| succ y' =>
refine rtrans (sR r3f (R' := ones y') (h' := true) rfl) ?_
refine rtrans (walkR r4t y' (2 * (2 * ones x' + bit false) + bit true) 0) ?_
refine rtrans (sL r4f (L' := onesOn y' (2 * (2 * ones x' + bit false) + bit true)) (h' := true) rfl) ?_
cases y' with
| zero =>
refine rtrans (sL r5t (L' := 2 * ones x' + bit false) (h' := true) rfl) ?_
refine rtrans (walkL r6t 0 (2 * (2 * 0 + bit false) + bit false) (ones x')) ?_
refine rtrans (sR r6f (R' := 2 * (2 * 0 + bit false) + bit false) (h' := true) rfl) ?_
exact sL (r7 true) (L' := ones x') (h' := false) rfl
| succ y'' =>
have s5 := sL (M := tmOf prog) (R := 2 * 0 + bit false) r5t
(L' := onesOn y'' (2 * (2 * ones x' + bit false) + bit true)) (h' := true) rfl
refine rtrans (rcast s5 (onesOn_succ y'' (2 * ones x' + bit false)) rfl) ?_
refine rtrans (walkL r6t (y'' + 1) (2 * (2 * 0 + bit false) + bit false) (ones x')) ?_
refine rtrans (sR r6f (R' := onesOn (y'' + 1) (2 * (2 * 0 + bit false) + bit false)) (h' := true) rfl) ?_
exact sL (r7 true) (L' := ones x') (h' := false) rfl
theorem g_dec1 (prog : List Ins) (pc a b : Nat) (hf : fetch prog pc = .dec1 a b) (x : Nat) :
TMR.Reach (tmOf prog) ⟨8 * pc, ones x, false, ones 0⟩ ⟨8 * a, ones x, false, ones 0⟩ ∧
∀ y', TMR.Reach (tmOf prog) ⟨8 * pc, ones x, false, ones (y' + 1)⟩ ⟨8 * b, ones x, false, ones y'⟩ := by
have r0 : (tmOf prog).δ (8 * pc + 0) false = some (8 * pc + 1, false, true) := rule hf 0 false (ltlit8 0 rfl)
have r1f : (tmOf prog).δ (8 * pc + 1) false = some (8 * a, false, false) := rule hf 1 false (ltlit8 1 rfl)
have r1t : (tmOf prog).δ (8 * pc + 1) true = some (8 * pc + 3, false, false) := rule hf 1 true (ltlit8 1 rfl)
have r3f : (tmOf prog).δ (8 * pc + 3) false = some (8 * pc + 4, true, false) := rule hf 3 false (ltlit8 3 rfl)
have r4t : (tmOf prog).δ (8 * pc + 4) true = some (8 * pc + 4, true, false) := rule hf 4 true (ltlit8 4 rfl)
have r4f : (tmOf prog).δ (8 * pc + 4) false = some (8 * pc + 5, false, true) := rule hf 4 false (ltlit8 4 rfl)
have r5t : (tmOf prog).δ (8 * pc + 5) true = some (8 * pc + 6, false, true) := rule hf 5 true (ltlit8 5 rfl)
have r6t : (tmOf prog).δ (8 * pc + 6) true = some (8 * pc + 6, true, true) := rule hf 6 true (ltlit8 6 rfl)
have r6f : (tmOf prog).δ (8 * pc + 6) false = some (8 * pc + 7, false, false) := rule hf 6 false (ltlit8 6 rfl)
have r7 : ∀ c, (tmOf prog).δ (8 * pc + 7) c = some (8 * b, c, true) := fun c => rule hf 7 c (ltlit8 7 rfl)
refine ⟨rtrans (sR r0 (R' := 0) (h' := false) rfl) (sL r1f (L' := ones x) (h' := false) rfl), fun y' => ?_⟩
refine rtrans (sR r0 (R' := ones y') (h' := true) rfl) ?_
refine rtrans (sL r1t (L' := ones x) (h' := false) rfl) ?_
cases x with
| zero =>
exact rtrans (sL r3f (L' := 0) (h' := false) rfl)
(rtrans (sR r4f (R' := 2 * ones y' + bit false) (h' := true) rfl)
(rtrans (sR r5t (R' := ones y') (h' := false) rfl)
(rtrans (sL r6f (L' := 0) (h' := false) rfl)
(sR (r7 false) (R' := ones y') (h' := false) rfl))))
| succ x' =>
refine rtrans (sL r3f (L' := ones x') (h' := true) rfl) ?_
refine rtrans (walkL r4t x' (2 * (2 * ones y' + bit false) + bit true) 0) ?_
refine rtrans (sR r4f (R' := onesOn x' (2 * (2 * ones y' + bit false) + bit true)) (h' := true) rfl) ?_
cases x' with
| zero =>
refine rtrans (sR r5t (R' := 2 * ones y' + bit false) (h' := true) rfl) ?_
refine rtrans (walkR r6t 0 (2 * (2 * 0 + bit false) + bit false) (ones y')) ?_
refine rtrans (sL r6f (L' := 2 * (2 * 0 + bit false) + bit false) (h' := true) rfl) ?_
exact sR (r7 true) (R' := ones y') (h' := false) rfl
| succ x'' =>
have s5 := sR (M := tmOf prog) (L := 2 * 0 + bit false) r5t
(R' := onesOn x'' (2 * (2 * ones y' + bit false) + bit true)) (h' := true) rfl
refine rtrans (rcast s5 rfl (onesOn_succ x'' (2 * ones y' + bit false))) ?_
refine rtrans (walkR r6t (x'' + 1) (2 * (2 * 0 + bit false) + bit false) (ones y')) ?_
refine rtrans (sL r6f (L' := onesOn (x'' + 1) (2 * (2 * 0 + bit false) + bit false)) (h' := true) rfl) ?_
exact sR (r7 true) (R' := ones y') (h' := false) rfl
end TT
end Found
#print axioms Found.TT.g_inc0
#print axioms Found.TT.g_inc1
#print axioms Found.TT.g_dec0
#print axioms Found.TT.g_dec1
lean_all/found/TwoTM3.lean
/-
Line two-counter machines → Turing machines, part 3, and μ → Turing.
found/TwoTM3 — every step of a two-counter program is simulated by its
Turing machine on the unary tape (step_sim), so every run is (run_sim), and
a halted program is a halted machine (two_to_tm). The compiled register
program of a μ-recursive term (found/RegComp2) uses only registers below
k + 1 + sz h (u_comp), so with Minsky (found/Minsky3): for every μ-recursive
evaluation Ev h args n there is a Turing machine run from the tape of the
code E s K to a halted tape of the code E s' K with s' k = n (mu_to_tm).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.TwoTM2
import found.TMMu
namespace Found
namespace TT
open TMR RM RC Mk CT3 Rec
/-! ## the run -/
theorem step_sim (prog : List Ins) (pc x y : Nat) (hn : fetch prog pc ≠ .halt) :
TMR.Reach (tmOf prog) (enc ⟨pc, x, y⟩) (enc (step prog ⟨pc, x, y⟩)) := by
show TMR.Reach _ _ (enc (exec (fetch prog pc) ⟨pc, x, y⟩))
match hi : fetch prog pc with
| .inc0 g => exact g_inc0 prog pc g hi x y
| .inc1 g => exact g_inc1 prog pc g hi x y
| .dec0 a b =>
cases x with
| zero => exact (g_dec0 prog pc a b hi y).1
| succ x' => exact (g_dec0 prog pc a b hi y).2 x'
| .dec1 a b =>
cases y with
| zero => exact (g_dec1 prog pc a b hi x).1
| succ y' => exact (g_dec1 prog pc a b hi x).2 y'
| .halt => exact absurd hi hn
theorem run_sim (prog : List Ins) (c : Cf) : (t : Nat) → TMR.Reach (tmOf prog) (enc c) (enc (run prog c t))
| 0 => .refl _
| t + 1 => by
show TMR.Reach _ _ (enc (step prog (run prog c t)))
match hr : run prog c t with
| ⟨pc, x, y⟩ =>
have ih := run_sim prog c t
rw [hr] at ih
have go : ∀ i, fetch prog pc = i → TMR.Reach (tmOf prog) (enc c) (enc (exec (fetch prog pc) ⟨pc, x, y⟩)) := by
intro i hi
match i, hi with
| .halt, hi => rw [hi]; exact ih
| .inc0 _, hi => exact rtrans ih (step_sim prog pc x y (fun e => nomatch hi.symm.trans e))
| .inc1 _, hi => exact rtrans ih (step_sim prog pc x y (fun e => nomatch hi.symm.trans e))
| .dec0 _ _, hi => exact rtrans ih (step_sim prog pc x y (fun e => nomatch hi.symm.trans e))
| .dec1 _ _, hi => exact rtrans ih (step_sim prog pc x y (fun e => nomatch hi.symm.trans e))
exact go _ rfl
theorem halted_of (prog : List Ins) (c : Cf) (hh : fetch prog c.pc = .halt) : Halted (tmOf prog) (enc c) :=
(dl prog c.pc 0 false (ltlit8 0 rfl)).trans (by rw [hh]; rfl)
/-- two-counter machines → Turing machines -/
theorem two_to_tm (prog : List Ins) (x y : Nat) (c' : Cf) (h : Mk.Reach prog ⟨0, x, y⟩ c')
(hh : fetch prog c'.pc = .halt) :
TMR.Reach (tmOf prog) ⟨0, ones x, false, ones y⟩ (enc c') ∧ Halted (tmOf prog) (enc c') :=
match h with
| ⟨t, ht⟩ => ⟨ht ▸ run_sim prog ⟨0, x, y⟩ t, halted_of prog c' hh⟩
/-! ## registers used by compiled μ-recursive terms -/
mutual
def sz : MR → Nat
| .zero => 1
| .succ => 1
| .proj _ => 1
| .comp f gs => gs.length + szL gs + sz f
| .prec f g => 5 + sz f + sz g
| .mu f => 3 + sz f
def szL : List MR → Nat
| [] => 1
| g :: gs => sz g + szL gs
end
theorem le_split {a b K : Nat} (h : a + b ≤ K) : a ≤ K := Nat.le_trans (Nat.le_add_right a b) h
theorem lt_split {a b K : Nat} (h : a + (b + 1) ≤ K) : a < K :=
Nat.lt_of_lt_of_le (Nat.lt_add_of_pos_right (Nat.succ_pos b)) h
theorem le_re {a b c K : Nat} (e : a + b = c) (h : c ≤ K) : a ≤ K := le_split (e ▸ h)
theorem nthR_low {K : Nat} : (ins : List Nat) → (i x : Nat) → Low ins K → nthR ins i = some x → x < K
| [], _, _, _, h => nomatch h
| y :: _, 0, x, hl, h => by
have e : y = x := Option.some.inj h
rw [← e]
exact hl y (List.Mem.head _)
| _ :: l, k + 1, x, hl, h => nthR_low l k x (fun z m => hl z (List.Mem.tail _ m)) h
theorem u_cp {K : Nat} (ins : List Nat) (i o t : Nat) (hl : Low ins K) (ho : o < K) (ht : t < K) :
Uses K (cp ins i o t) := by
unfold cp
match hn : nthR ins i with
| some x => exact TMMu.u_copy (nthR_low ins i x hl hn) ho ht
| none => exact TMMu.u_clear ho
theorem low_tail {K x : Nat} {l : List Nat} (h : Low (x :: l) K) : Low l K := fun z m => h z (List.Mem.tail _ m)
mutual
theorem u_comp {K : Nat} : (h : MR) → (ins : List Nat) → (o fr : Nat) → Low ins K → o < K → fr + sz h ≤ K →
Uses K (comp h ins o fr)
| .zero, _, _, _, _, ho, _ => TMMu.u_clear ho
| .succ, ins, o, fr, hl, ho, hf =>
(⟨u_cp ins 0 o fr hl ho (lt_split (b := 0) hf), ho⟩ : Uses K (cp ins 0 o fr) ∧ o < K)
| .proj i, ins, o, fr, hl, ho, hf => u_cp ins i o fr hl ho (lt_split (b := 0) hf)
| .comp f gs, ins, o, fr, hl, ho, hf =>
(⟨u_compL gs ins fr (fr + gs.length) hl (le_re (b := szL gs + sz f) (by show fr + gs.length + (szL gs + sz f) = fr + (gs.length + szL gs + sz f); lib_nat) hf)
(le_re (b := sz f) (by show fr + gs.length + szL gs + sz f = fr + (gs.length + szL gs + sz f); lib_nat) hf),
u_comp f (outsFrom fr gs.length) o (fr + gs.length) (low_mono (low_outs fr gs.length)
(le_re (b := szL gs + sz f) (by show fr + gs.length + (szL gs + sz f) = fr + (gs.length + szL gs + sz f); lib_nat) hf)) ho
(le_re (b := szL gs) (by show fr + gs.length + sz f + szL gs = fr + (gs.length + szL gs + sz f); lib_nat) hf)⟩ :
Uses K (compL gs ins fr (fr + gs.length)) ∧ Uses K (comp f (outsFrom fr gs.length) o (fr + gs.length)))
| .prec f g, [], o, fr, hl, ho, hf =>
u_comp f [] o fr hl ho (le_re (b := 5 + sz g) (by show fr + sz f + (5 + sz g) = fr + (5 + sz f + sz g); lib_nat) hf)
| .prec f g, x :: rest, o, fr, hl, ho, hf => by
have l4 : fr + 4 < K := lt_split (b := sz f + sz g) (by rw [show fr + 4 + (sz f + sz g + 1) = fr + (5 + sz f + sz g) by lib_nat]; exact hf)
have l3 : fr + 3 < K := Nat.lt_trans (Nat.lt_succ_self _) l4
have l2 : fr + 2 < K := Nat.lt_trans (Nat.lt_succ_self _) l3
have l1 : fr + 1 < K := Nat.lt_trans (Nat.lt_succ_self _) l2
have l0 : fr < K := Nat.lt_trans (Nat.lt_succ_self _) l1
have uf := u_comp f rest fr (fr + 4) (low_tail hl) l0
(le_re (b := 1 + sz g) (by show fr + 4 + sz f + (1 + sz g) = fr + (5 + sz f + sz g); lib_nat) hf)
have ug := u_comp g ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4) (low_cons l1 (low_cons l0 (low_tail hl))) l3
(le_re (b := 1 + sz f) (by show fr + 4 + sz g + (1 + sz f) = fr + (5 + sz f + sz g); lib_nat) hf)
have hx : x < K := hl x (List.Mem.head _)
exact (⟨uf, TMMu.u_clear l1, TMMu.u_copy hx l2 l3, ⟨l2,
(⟨ug, TMMu.u_copy l3 l0 l4, l1, l2⟩ :
Uses K (comp g ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4)) ∧ Uses K (copy (fr + 3) fr (fr + 4)) ∧ fr + 1 < K ∧ fr + 2 < K)⟩,
TMMu.u_copy l0 ho l4⟩ :
Uses K (comp f rest fr (fr + 4)) ∧ Uses K (clear (fr + 1)) ∧ Uses K (copy x (fr + 2) (fr + 3)) ∧ (fr + 2 < K ∧
Uses K (precBody (comp g ((fr + 1) :: fr :: rest) (fr + 3) (fr + 4)) fr)) ∧ Uses K (copy fr o (fr + 4)))
| .mu f, ins, o, fr, hl, ho, hf => by
have l2 : fr + 2 < K := lt_split (b := sz f) (by rw [show fr + 2 + (sz f + 1) = fr + (3 + sz f) by lib_nat]; exact hf)
have l1 : fr + 1 < K := Nat.lt_trans (Nat.lt_succ_self _) l2
have l0 : fr < K := Nat.lt_trans (Nat.lt_succ_self _) l1
have uf := u_comp f (fr :: ins) (fr + 1) (fr + 2) (low_cons l0 hl) l1
(le_re (b := 1) (by show fr + 2 + sz f + 1 = fr + (3 + sz f); lib_nat) hf)
exact (⟨TMMu.u_clear l0, uf, ⟨l1, l0, uf⟩, TMMu.u_copy l0 ho l2⟩ :
Uses K (clear fr) ∧ Uses K (comp f (fr :: ins) (fr + 1) (fr + 2)) ∧ (fr + 1 < K ∧ fr < K ∧
Uses K (comp f (fr :: ins) (fr + 1) (fr + 2))) ∧ Uses K (copy fr o (fr + 2)))
theorem u_compL {K : Nat} : (gs : List MR) → (ins : List Nat) → (k b : Nat) → Low ins K → k + gs.length ≤ K →
b + szL gs ≤ K → Uses K (compL gs ins k b)
| [], _, _, _, _, _, hb => TMMu.u_clear (lt_split (b := 0) hb)
| g :: gs, ins, k, b, hl, hk, hb =>
(⟨u_comp g ins k b hl (lt_split (b := gs.length) hk) (le_re (b := szL gs) (by show b + sz g + szL gs = b + (sz g + szL gs); lib_nat) hb),
u_compL gs ins (k + 1) b hl (le_re (b := 0) (by show k + 1 + gs.length + 0 = k + (gs.length + 1); lib_nat) hk)
(le_re (b := sz g) (by show b + szL gs + sz g = b + (sz g + szL gs); lib_nat) hb)⟩ :
Uses K (comp g ins k b) ∧ Uses K (compL gs ins (k + 1) b))
end
/-- μ-recursive functions → Turing machines: an evaluation of h on the registers 0..k-1 of s is
carried out by a Turing machine, from the unary tape of the code of s to a halted tape of the code
of a store holding the value in register k -/
theorem mu_to_tm (h : MR) (k : Nat) (s : Store) (n : Nat) (d : Ev h (rd s (outsFrom 0 k)) n) :
∃ s', s' k = n ∧
TMR.Reach (tmOf (Mk.prog (comp h (outsFrom 0 k) k (k + 1))))
⟨0, ones (E s (k + 1 + sz h)), false, 0⟩
(enc ⟨clen (comp h (outsFrom 0 k) k (k + 1)), E s' (k + 1 + sz h), 0⟩) ∧
Halted (tmOf (Mk.prog (comp h (outsFrom 0 k) k (k + 1))))
(enc ⟨clen (comp h (outsFrom 0 k) k (k + 1)), E s' (k + 1 + sz h), 0⟩) :=
match mu_to_register h k s n d with
| ⟨s', r, hk, _⟩ =>
have hu : Uses (k + 1 + sz h) (comp h (outsFrom 0 k) k (k + 1)) :=
u_comp h _ k (k + 1)
(low_mono (by have := low_outs 0 k; rw [Nat.zero_add] at this; exact this) (Nat.le_trans (Nat.le_succ k) (Nat.le_add_right (k + 1) (sz h))))
(lt_split (b := sz h) (Nat.le_of_eq (by lib_nat))) (Nat.le_refl _)
match minsky _ _ hu r with
| ⟨hr, hh⟩ => ⟨s', hk, two_to_tm _ _ 0 _ hr hh⟩
end TT
end Found
#print axioms Found.TT.step_sim
#print axioms Found.TT.run_sim
#print axioms Found.TT.two_to_tm
#print axioms Found.TT.u_comp
#print axioms Found.TT.mu_to_tm
lean_all/found/TypeVariants.lean
/-
T195. found/TypeVariants — type-theory variants as points on existing
coordinates:
* Session types: protocols with send/receive/choice/offer/end; duality is
an involution and swaps the roles — the line to linear logic's negation
(T68: session types = propositions of linear logic, Caires–Pfenning).
* Linear type theory: the residuated/closed coordinate (T68, T150).
* Modal / cohesive type theory: modalities as (co)monads on the type
coordinate — □ as an idempotent comonad is S4 (T67) (cited for cohesion).
* Parametricity: relational interpretation (cited).
Lean 4 core only, hand-written proofs, no axioms.
-/
namespace Found
namespace Session
inductive S where
| stop : S
| send : Nat → S → S -- !T.s (message type index)
| recv : Nat → S → S -- ?T.s
| choose : S → S → S -- ⊕
| offer : S → S → S -- &
def dual : S → S
| .stop => .stop
| .send t s => .recv t (dual s)
| .recv t s => .send t (dual s)
| .choose a b => .offer (dual a) (dual b)
| .offer a b => .choose (dual a) (dual b)
theorem dual_dual : (s : S) → dual (dual s) = s
| .stop => rfl
| .send t s => congrArg (S.send t) (dual_dual s)
| .recv t s => congrArg (S.recv t) (dual_dual s)
| .choose a b => by show S.choose (dual (dual a)) (dual (dual b)) = _; rw [dual_dual a, dual_dual b]
| .offer a b => by show S.offer (dual (dual a)) (dual (dual b)) = _; rw [dual_dual a, dual_dual b]
/-- the "linear negation" reading: ⊕ ↔ &, ! ↔ ? (sizes agree) -/
def size : S → Nat
| .stop => 0
| .send _ s => size s + 1
| .recv _ s => size s + 1
| .choose a b => size a + size b + 1
| .offer a b => size a + size b + 1
theorem size_dual : (s : S) → size (dual s) = size s
| .stop => rfl
| .send _ s => congrArg (· + 1) (size_dual s)
| .recv _ s => congrArg (· + 1) (size_dual s)
| .choose a b => by show size (dual a) + size (dual b) + 1 = _; rw [size_dual a, size_dual b]; rfl
| .offer a b => by show size (dual a) + size (dual b) + 1 = _; rw [size_dual a, size_dual b]; rfl
end Session
end Found
#print axioms Found.Session.dual_dual
#print axioms Found.Session.size_dual
lean_all/found/TypedCalculi.lean
/-
T144. found/TypedCalculi — typed calculi as points on the λ coordinate:
* PCF: simply typed λ with naturals, if-zero and a fixed-point operator;
environment semantics with fuel (no substitution), a type checker, and
computations: the factorial written with fix evaluates to 120, and the
term checks at type nat.
* Fω and λΠ (LF) are the higher-kind / dependent corners of the λ-cube
(T181); their typing is the PTS line (cited here, PTS in T181).
Lean 4 core only, concrete computations by rfl, no axioms.
-/
namespace Found
namespace PCF
inductive Ty where
| nat : Ty
| arr : Ty → Ty → Ty
inductive Tm where
| var : Nat → Tm
| lit : Nat → Tm
| succ : Tm → Tm
| pred : Tm → Tm
| mul : Tm → Tm → Tm
| ifz : Tm → Tm → Tm → Tm
| lam : Ty → Tm → Tm
| app : Tm → Tm → Tm
| fix : Ty → Ty → Tm → Tm -- fix f : τ → σ. λ x : τ. body (x = var 0, f = var 1)
inductive Val where
| num : Nat → Val
| clo : List Val → Tm → Val
| fixc : List Val → Tm → Val
def look : List Val → Nat → Option Val
| [], _ => none
| v :: _, 0 => some v
| _ :: l, n + 1 => look l n
def predN : Nat → Nat
| 0 => 0
| n + 1 => n
def asNum : Option Val → Option Nat
| none => none
| some (.num n) => some n
| some (.clo _ _) => none
| some (.fixc _ _) => none
def mapNum (f : Nat → Nat) : Option Nat → Option Val
| none => none
| some n => some (.num (f n))
def mul2 : Option Nat → Option Nat → Option Val
| none, _ => none
| some _, none => none
| some a, some b => some (.num (a * b))
def eval : Nat → List Val → Tm → Option Val
| 0, _, _ => none
| _ + 1, ρ, .var n => look ρ n
| _ + 1, _, .lit n => some (.num n)
| k + 1, ρ, .succ t => mapNum (· + 1) (asNum (eval k ρ t))
| k + 1, ρ, .pred t => mapNum predN (asNum (eval k ρ t))
| k + 1, ρ, .mul s t => mul2 (asNum (eval k ρ s)) (asNum (eval k ρ t))
| k + 1, ρ, .ifz c a b => branch (asNum (eval k ρ c)) (eval k ρ a) (eval k ρ b)
| _ + 1, ρ, .lam _ b => some (.clo ρ b)
| k + 1, ρ, .app s t => apply (eval k ρ s) (eval k ρ t) (fun ρ' b => eval k ρ' b)
| _ + 1, ρ, .fix _ _ b => some (.fixc ρ b)
where
branch : Option Nat → Option Val → Option Val → Option Val
| none, _, _ => none
| some 0, a, _ => a
| some (_ + 1), _, b => b
apply : Option Val → Option Val → (List Val → Tm → Option Val) → Option Val
| none, _, _ => none
| some (.num _), _, _ => none
| some (.clo _ _), none, _ => none
| some (.clo ρ' b), some v, e => e (v :: ρ') b
| some (.fixc _ _), none, _ => none
| some (.fixc ρ' b), some v, e => e (v :: .fixc ρ' b :: ρ') b
/-- fact = fix f. λ n. ifz n 1 (n * f (pred n)) -/
def fact : Tm :=
.fix .nat .nat (.ifz (.var 0) (.lit 1) (.mul (.var 0) (.app (.var 1) (.pred (.var 0)))))
theorem fact5 : asNum (eval 40 [] (.app fact (.lit 5))) = some 120 := rfl
theorem fact0 : asNum (eval 10 [] (.app fact (.lit 0))) = some 1 := rfl
/-! a type checker -/
def tyEq : Ty → Ty → Bool
| .nat, .nat => true
| .nat, .arr _ _ => false
| .arr _ _, .nat => false
| .arr a b, .arr c d => tyEq a c && tyEq b d
def lookT : List Ty → Nat → Option Ty
| [], _ => none
| v :: _, 0 => some v
| _ :: l, n + 1 => lookT l n
def isNat : Option Ty → Bool
| none => false
| some .nat => true
| some (.arr _ _) => false
def guard' (b : Bool) (t : Option Ty) : Option Ty := match b with
| true => t
| false => none
def appT : Option Ty → Option Ty → Option Ty
| none, _ => none
| some .nat, _ => none
| some (.arr _ _), none => none
| some (.arr τ σ), some τ' => guard' (tyEq τ τ') (some σ)
def sameT : Option Ty → Option Ty → Option Ty
| none, _ => none
| some _, none => none
| some τ, some σ => guard' (tyEq τ σ) (some τ)
def lamT (τ : Ty) : Option Ty → Option Ty
| none => none
| some σ => some (.arr τ σ)
def check : List Ty → Tm → Option Ty
| Γ, .var n => lookT Γ n
| _, .lit _ => some .nat
| Γ, .succ t => guard' (isNat (check Γ t)) (some .nat)
| Γ, .pred t => guard' (isNat (check Γ t)) (some .nat)
| Γ, .mul s t => guard' (isNat (check Γ s) && isNat (check Γ t)) (some .nat)
| Γ, .ifz c a b => guard' (isNat (check Γ c)) (sameT (check Γ a) (check Γ b))
| Γ, .lam τ b => lamT τ (check (τ :: Γ) b)
| Γ, .app s t => appT (check Γ s) (check Γ t)
| Γ, .fix τ σ b => lamT τ (sameT (check (τ :: .arr τ σ :: Γ) b) (some σ))
theorem fact_type : check [] fact = some (.arr .nat .nat) := rfl
theorem fact5_type : check [] (.app fact (.lit 5)) = some .nat := rfl
end PCF
end Found
#print axioms Found.PCF.fact5
#print axioms Found.PCF.fact0
#print axioms Found.PCF.fact_type
#print axioms Found.PCF.fact5_type
lean_all/found/Ultraproduct.lean
/-
T190. found/Ultraproduct — reduced products and ultraproducts as a point:
a filter F on an index type I (a parameter; an ultrafilter is the
condition "for every A, A ∈ F or Aᶜ ∈ F"), structures Mᵢ, and the reduced
product as a setoid (no quotient): a ~ b ⟺ {i | aᵢ = bᵢ} ∈ F.
* ~ is an equivalence (filter laws); pointwise operations respect ~.
* Łoś for equations and conjunctions (Horn part), constructively;
the full Łoś theorem needs the ultrafilter condition (and choice for
existentials), giving nonstandard models (T165) — cited for ∃.
Morley categoricity and Lindström's theorem are cited lines.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Core
namespace Found
namespace Ultra
universe u v
structure Filter (I : Type u) where
mem : (I → Prop) → Prop
univ : mem (fun _ => True)
up : ∀ {A B : I → Prop}, (∀ i, A i → B i) → mem A → mem B
inter : ∀ {A B : I → Prop}, mem A → mem B → mem (fun i => A i ∧ B i)
variable {I : Type u} (F : Filter I) (M : I → Type v)
def Prod' : Type (max u v) := (i : I) → M i
def sim (a b : Prod' M) : Prop := F.mem (fun i => a i = b i)
def reduced : Setd.{max u v} where
car := Prod' M
eqv := sim F M
refl _ := F.up (fun _ _ => rfl) F.univ
symm h := F.up (fun _ e => e.symm) h
trans h k := F.up (fun _ e => e.1.trans e.2) (F.inter h k)
/-- a pointwise binary operation respects ~ -/
theorem op_resp (op : ∀ i, M i → M i → M i) {a a' b b' : Prod' M}
(ha : sim F M a a') (hb : sim F M b b') :
sim F M (fun i => op i (a i) (b i)) (fun i => op i (a' i) (b' i)) :=
F.up (fun i e => show op i (a i) (b i) = op i (a' i) (b' i) by rw [e.1, e.2]) (F.inter ha hb)
/-- Łoś for equations: the product satisfies t = s iff the set of factors does is in F -/
theorem los_eq (a b : Prod' M) : (reduced F M).eqv a b ↔ F.mem (fun i => a i = b i) := Iff.rfl
/-- Łoś for conjunction -/
theorem los_and (P Q : I → Prop) :
F.mem (fun i => P i ∧ Q i) ↔ F.mem P ∧ F.mem Q :=
⟨fun h => ⟨F.up (fun _ x => x.1) h, F.up (fun _ x => x.2) h⟩, fun h => F.inter h.1 h.2⟩
end Ultra
end Found
#print axioms Found.Ultra.reduced
#print axioms Found.Ultra.op_resp
#print axioms Found.Ultra.los_eq
#print axioms Found.Ultra.los_and
lean_all/found/UniversalLogic.lean
/-
T206. found/UniversalLogic — universal logic (Béziau) as a point: a logic
is any set of formulas with a consequence relation; Tarskian logics satisfy
reflexivity, monotonicity and cut (a free parameter with conditions).
* Intuitionistic natural deduction (T65) is Tarskian.
* Every semantic consequence (truth-preservation in a class of
valuations: LP, K3, Heyting) is Tarskian.
* Preferential consequence (T173) is not monotone: it sits outside the
Tarskian class — the coordinate "monotonicity" separates them.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Minimal
import found.NonMono
namespace Found
namespace UL2
universe u v
structure Logic where
F : Type u
cons : (F → Prop) → F → Prop
def Reflexive (L : Logic.{u}) : Prop := ∀ Γ φ, Γ φ → L.cons Γ φ
def Monotone (L : Logic.{u}) : Prop := ∀ Γ Δ φ, (∀ x, Γ x → Δ x) → L.cons Γ φ → L.cons Δ φ
def Cut (L : Logic.{u}) : Prop := ∀ Γ Δ φ, (∀ x, Δ x → L.cons Γ x) → L.cons Δ φ → L.cons Γ φ
structure Tarskian (L : Logic.{u}) : Prop where
refl : Reflexive L
mono : Monotone L
cut : Cut L
/-- intuitionistic natural deduction is Tarskian -/
def nd : Logic.{0} := ⟨Prp.Form, fun Γ φ => Prp.PD true Γ φ⟩
theorem nd_tarskian : Tarskian nd :=
⟨fun _ _ g => .hyp g, fun _ _ _ h d => Prp.mono d h, fun _ _ _ h d => Prp.cut d h⟩
/-- semantic consequence over any class of valuations is Tarskian -/
def sem (F : Type u) (Val : Type v) (holds : Val → F → Prop) : Logic.{u} :=
⟨F, fun Γ φ => ∀ v, (∀ x, Γ x → holds v x) → holds v φ⟩
theorem sem_tarskian (F : Type u) (Val : Type v) (holds : Val → F → Prop) : Tarskian (sem F Val holds) :=
⟨fun _ _ g _ h => h _ g,
fun _ _ _ h c v hv => c v (fun x g => hv x (h x g)),
fun _ _ _ h c v hv => c v (fun x g => h x g v hv)⟩
/-- preferential consequence (bird/penguin, T173) is not monotone -/
def prefLogic : Logic.{0} :=
⟨Bool → Prop, fun Γ φ => NonMono.nm NonMono.pref (fun w => ∀ ψ, Γ ψ → ψ w) φ⟩
theorem pref_not_monotone : ¬ Monotone prefLogic := fun h =>
have k := h (fun ψ => ψ = (fun _ => True)) (fun ψ => ψ = (fun _ => True) ∨ ψ = (fun w => w = true))
(fun w => w = false) (fun _ e => Or.inl e)
(fun w m => match w, m with
| false, _ => rfl
| true, m => (m.2 false ⟨rfl, rfl⟩ (fun _ e => e ▸ trivial)).elim)
Bool.noConfusion (k true ⟨fun _ e => e.elim (fun e1 => e1 ▸ trivial) (fun e2 => e2 ▸ rfl),
fun _ hv hA => Bool.noConfusion (hv.1.symm.trans (hA (fun w => w = true) (Or.inr rfl)))⟩)
end UL2
end Found
#print axioms Found.UL2.nd_tarskian
#print axioms Found.UL2.sem_tarskian
#print axioms Found.UL2.pref_not_monotone
lean_all/found/VeqL.lean
/-
T169. found/VeqL — V = L as a point: the constructible hierarchy
L₀ = ∅, L_{α+1} = Def(L_α), and V = L as a condition on the set
coordinate (with GCH, ◊ consequences, cited).
Here: the definable-power-set operator Def on Aczel's V (T109), for the
quantifier-free fragment with parameters from x (the Gödel-operation
core):
* every member of Def(x) is a subset of x (Def(x) ⊆ 𝒫(x));
* if x is transitive then x ⊆ Def(x) (each y ∈ x is {z ∈ x | z ∈ y}),
so the L-hierarchy is increasing on transitive stages.
The full first-order Def, absoluteness of L and V = L ⇒ GCH are cited.
Lean 4 core only, hand-written proofs, no axioms.
CIC dependence: impredicative Prop (separation).
-/
import found.IZF
namespace Found
namespace VL
open WF
/-- quantifier-free formulas in the bound variable z and parameters pₙ -/
inductive QF where
| memP : Nat → QF -- z ∈ pₙ
| eqP : Nat → QF -- z ≈ pₙ
| neg : QF → QF
| and : QF → QF → QF
def ev (ρ : Nat → V.{0}) : QF → V.{0} → Prop
| .memP n, z => Mem z (ρ n)
| .eqP n, z => Eq' z (ρ n)
| .neg a, z => ¬ ev ρ a z
| .and a b, z => ev ρ a z ∧ ev ρ b z
theorem ev_resp (ρ : Nat → V.{0}) : (a : QF) → IZF.Resp (ev ρ a)
| .memP _ => fun _ _ e h => mem_resp_left e h
| .eqP _ => fun _ _ e h => eq_trans _ _ _ (eq_symm _ _ e) h
| .neg a => fun x y e h h' => h (ev_resp ρ a y x (eq_symm _ _ e) h')
| .and a b => fun x y e h => ⟨ev_resp ρ a x y e h.1, ev_resp ρ b x y e h.2⟩
/-- definable subsets of x with parameters from x -/
def Def (x : V.{0}) : V.{0} :=
.sup (QF × (Nat → x.I)) (fun p => IZF.sep x (ev (fun n => x.f (p.2 n)) p.1))
theorem def_sub (x w : V.{0}) (hw : Mem w (Def x)) : ∀ z, Mem z w → Mem z x :=
match hw with
| ⟨⟨φ, _⟩, e⟩ => fun z m =>
((IZF.sep_spec x _ (ev_resp _ φ) z).mp (mem_resp_right m e)).1
def Transitive (x : V.{0}) : Prop := ∀ y z, Mem z y → Mem y x → Mem z x
theorem sub_def (x : V.{0}) (ht : Transitive x) (y : V.{0}) (hy : Mem y x) : Mem y (Def x) :=
match x, hy with
| .sup I f, ⟨i, ei⟩ => ⟨⟨.memP 0, fun _ => i⟩, extensionality _ _ (fun z =>
⟨fun m => (IZF.sep_spec (.sup I f) _ (ev_resp _ (.memP 0)) z).mpr
⟨ht y z m ⟨i, ei⟩, mem_resp_right m ei⟩,
fun m => mem_resp_right ((IZF.sep_spec (.sup I f) _ (ev_resp _ (.memP 0)) z).mp m).2 (eq_symm _ _ ei)⟩)⟩
end VL
end Found
#print axioms Found.VL.ev_resp
#print axioms Found.VL.def_sub
#print axioms Found.VL.sub_def
lean_all/found/WKL.lean
/-
T84 line. found/WKL — weak König's lemma (the WKL₀ value of the
comprehension/choice coordinate of reverse mathematics) holds in the full
ω-model, in the classical point: every infinite binary tree (membership
at depth n depends only on the first n bits, closed under prefixes) has
an infinite path. Derived from the fan theorem (found/Fan).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Fan
namespace Found
namespace WKL
open CP Fan
variable (K : Classical') (T : (Nat → Bool) → Nat → Prop)
(loc : ∀ α β n, (∀ i, i < n → α i = β i) → T α n → T β n)
(pref : ∀ α n m, m ≤ n → T α n → T α m)
include K loc pref in
/-- weak König's lemma -/
theorem wkl (inf : ∀ N, ∃ α, T α N) : ∃ α, ∀ n, T α n := by
refine dne K _ (fun hno => ?_)
have bar : ∀ α, ∃ n, ¬ T α n := fun α => dne K _ (fun h => hno ⟨α, fun n => dne K _ (fun hn => h ⟨n, hn⟩)⟩)
have locB : ∀ α β n, (∀ i, i < n → α i = β i) → ¬ T α n → ¬ T β n :=
fun α β n h hn ht => hn (loc β α n (fun i hi => (h i hi).symm) ht)
match fan K (fun α n => ¬ T α n) locB bar with
| ⟨N, hN⟩ => match inf N with
| ⟨α, hα⟩ => match hN α with
| ⟨n, hn, hb⟩ => exact hb (pref α N n hn hα)
end WKL
end Found
#print axioms Found.WKL.wkl
lean_all/found/WellFounded.lean
/-
T125. found/WellFounded — foundation versus anti-foundation as a
condition on the same graph coordinate (T105, T109 reused).
* Condition WF + extensional on a graph: no decoration is a member of
itself (foundation holds on the decorated part).
* Condition "has a loop": the decoration of the looping node is a member
of itself (an Ω).
So the initial-algebra point (V, T109) and the final-coalgebra point
(AFA, T105) are the two values of one condition on (N, E).
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Mostowski
namespace Found
namespace WFvsAFA
open AFA
variable {N : Type} (E : N → N → Prop)
theorem wf_no_self_member (hW : WF.WellFounded' E) (hX : WF.Extensional E) (n : N) :
¬ Mem (dec ⟨N, E⟩ n) (dec ⟨N, E⟩ n) :=
fun ⟨c, e, h⟩ => match h with
| ⟨S, hS, s⟩ =>
have eq : n = c := WF.bisim_eq E hW hX (S := S) hS n c s
WF.no_loop E hW n (eq ▸ e)
theorem loop_self_member (n : N) (h : E n n) : Mem (dec ⟨N, E⟩ n) (dec ⟨N, E⟩ n) :=
⟨n, h, eqv_refl _⟩
end WFvsAFA
end Found
#print axioms Found.WFvsAFA.wf_no_self_member
#print axioms Found.WFvsAFA.loop_self_member
lean_all/found/WellOrder.lean
/-
T106 (b), slice N2. found/WellOrder — Zermelo's well-ordering theorem in
the classical point (found/ClassicalPoint), by towers:
the tower T is the least family of subsets closed under unions and under
nxt A = A plus one chosen new element. Every tower set is "extreme",
so the tower is a chain; x ≼ y iff Below x ⊆ Below y, where Below x is the
union of the tower sets missing x. This order is total, antisymmetric,
and every nonempty set has a least element.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.ClassicalPoint
namespace Found
namespace WO
open CP
variable (K : Classical') {α : Type}
def Sub (A B : α → Prop) : Prop := ∀ x, A x → B x
/-- A plus the chosen element of its complement (if any) -/
def nxt (A : α → Prop) : α → Prop := fun x => A x ∨ ∃ h : ∃ y, ¬ A y, x = K.ch (fun y => ¬ A y) h
def U (S : (α → Prop) → Prop) : α → Prop := fun x => ∃ A, S A ∧ A x
def Closed (F : (α → Prop) → Prop) : Prop :=
(∀ S, (∀ A, S A → F A) → F (U S)) ∧ (∀ A, F A → F (nxt K A))
def T (A : α → Prop) : Prop := ∀ F, Closed K F → F A
theorem T_closed : Closed K (T K (α := α)) :=
⟨fun S hS F hF => hF.1 S (fun A hA => hS A hA F hF), fun A hA F hF => hF.2 A (hA F hF)⟩
/-- induction over the tower -/
theorem T_ind (P : (α → Prop) → Prop) (hU : ∀ S, (∀ A, S A → T K A ∧ P A) → P (U S))
(hN : ∀ A, T K A → P A → P (nxt K A)) : ∀ A, T K A → P A := fun _ hA =>
(hA (fun B => T K B ∧ P B) ⟨fun S hS => ⟨(T_closed K).1 S (fun B hB => (hS B hB).1), hU S hS⟩,
fun B hB => ⟨(T_closed K).2 B hB.1, hN B hB.1 hB.2⟩⟩).2
theorem sub_nxt (A : α → Prop) : Sub A (nxt K A) := fun _ h => Or.inl h
def Ssub (A B : α → Prop) : Prop := Sub A B ∧ ¬ Sub B A
/-- extensionally equal sets have extensionally equal successors -/
theorem nxt_ext {A B : α → Prop} (h1 : Sub A B) (h2 : Sub B A) : Sub (nxt K A) (nxt K B) := fun x hx =>
hx.elim (fun ha => Or.inl (h1 x ha)) (fun ⟨h, e⟩ =>
have hB : ∃ y, ¬ B y := match h with | ⟨y, hy⟩ => ⟨y, fun b => hy (h2 y b)⟩
Or.inr ⟨hB, e.trans (K.ch_ext _ _ h hB (fun y => ⟨fun na b => na (h2 y b), fun nb a => nb (h1 y a)⟩))⟩)
def Extreme (C : α → Prop) : Prop := ∀ A, T K A → Ssub A C → Sub (nxt K A) C
/-- Lemma 1: an extreme C is comparable with every tower set in the strong form -/
theorem lemma1 (C : α → Prop) (hE : Extreme K C) :
∀ A, T K A → Sub A C ∨ Sub (nxt K C) A :=
T_ind K (fun A => Sub A C ∨ Sub (nxt K C) A)
(fun S hS => (K.lem (∀ A, S A → Sub A C)).elim
(fun hall => Or.inl (fun x ⟨A, hA, hx⟩ => hall A hA x hx))
(fun hn => Or.inr (by
have : ∃ A, S A ∧ ¬ Sub A C := dne K _ (fun hne => hn (fun A hA => dne K _ (fun hs => hne ⟨A, hA, hs⟩)))
match this with
| ⟨A, hA, hns⟩ => exact fun x hx => match (hS A hA).2 with
| Or.inl hs => (hns hs).elim
| Or.inr hs => ⟨A, hA, hs x hx⟩)))
(fun A hA ih => ih.elim
(fun hs => (K.lem (Sub C A)).elim
(fun hca => Or.inr (nxt_ext K hca hs))
(fun hnca => Or.inl (hE A hA ⟨hs, hnca⟩)))
(fun hs => Or.inr (fun x hx => sub_nxt K A x (hs x hx))))
/-- Lemma 2: every tower set is extreme -/
theorem lemma2 : ∀ C, T K C → Extreme K (α := α) C :=
T_ind K (fun C => Extreme K C)
(fun S hS A hA hss => by
-- some member of S is not contained in A
have hex : ∃ C, S C ∧ ¬ Sub C A := dne K _ (fun hne => hss.2 (fun x ⟨C, hC, hx⟩ =>
dne K _ (fun hxa => hne ⟨C, hC, fun hca => hxa (hca x hx)⟩)))
match hex with
| ⟨C, hCS, hnca⟩ =>
have hTC := (hS C hCS).1
have hEC := (hS C hCS).2
cases lemma1 K C hEC A hA with
| inr h => exact ((hnca (fun x hx => h x (sub_nxt K C x hx))).elim)
| inl hac =>
exact (K.lem (Sub C A)).elim
(fun hca => (hnca hca).elim)
(fun hnca' => fun x hx => ⟨C, hCS, hEC A hA ⟨hac, hnca'⟩ x hx⟩))
(fun C hC hE A hA hss => by
cases lemma1 K C hE A hA with
| inr h => exact (hss.2 h).elim
| inl hac =>
exact (K.lem (Sub C A)).elim
(fun hca => nxt_ext K hac hca)
(fun hnca => fun x hx => sub_nxt K C x (hE A hA ⟨hac, hnca⟩ x hx)))
/-- the tower is a chain -/
theorem chain (A B : α → Prop) (hA : T K A) (hB : T K B) : Sub A B ∨ Sub B A :=
(lemma1 K B (lemma2 K B hB) A hA).elim Or.inl (fun h => Or.inr (fun x hx => h x (sub_nxt K B x hx)))
/-! ## the well-order -/
def Below (x : α) : α → Prop := U (fun A => T K A ∧ ¬ A x)
theorem below_T (x : α) : T K (Below K x) := (T_closed K).1 _ (fun _ h => h.1)
theorem below_not (x : α) : ¬ Below K x x := fun ⟨_, ⟨_, hn⟩, hx⟩ => hn hx
/-- a tower set whose successor adds nothing is everything -/
theorem nxt_new (A : α → Prop) (h : ∃ y, ¬ A y) : nxt K A (K.ch (fun y => ¬ A y) h) ∧ ¬ A (K.ch (fun y => ¬ A y) h) :=
⟨Or.inr ⟨h, rfl⟩, K.ch_spec (fun y => ¬ A y) h⟩
/-- x is the element added after Below x -/
theorem below_succ (x : α) : x = K.ch (fun y => ¬ Below K x y) ⟨x, below_not K x⟩ := by
have hn : nxt K (Below K x) x := dne K _ (fun hnx => by
have hsub : Sub (nxt K (Below K x)) (Below K x) := fun z hz => ⟨_, ⟨(T_closed K).2 _ (below_T K x), hnx⟩, hz⟩
have := nxt_new K (Below K x) ⟨x, below_not K x⟩
exact this.2 (hsub _ this.1))
exact hn.elim (fun hb => (below_not K x hb).elim) (fun ⟨h, e⟩ => e)
def Le (x y : α) : Prop := Sub (Below K x) (Below K y)
theorem le_total (x y : α) : Le K x y ∨ Le K y x := chain K _ _ (below_T K x) (below_T K y)
theorem le_antisymm (x y : α) (h1 : Le K x y) (h2 : Le K y x) : x = y :=
(below_succ K x).trans ((K.ch_ext _ _ _ _ (fun z => ⟨fun n b => n (h2 z b), fun n b => n (h1 z b)⟩)).trans
(below_succ K y).symm)
theorem le_trans {x y z : α} (h1 : Le K x y) (h2 : Le K y z) : Le K x z := fun w hw => h2 w (h1 w hw)
/-- every nonempty set has a least element -/
theorem least (S : α → Prop) (hS : ∃ s, S s) : ∃ m, S m ∧ ∀ s, S s → Le K m s := by
let D : α → Prop := U (fun A => T K A ∧ ∀ s, S s → ¬ A s)
have hDT : T K D := (T_closed K).1 _ (fun _ h => h.1)
have hDS : ∀ s, S s → ¬ D s := fun s hs ⟨_, ⟨_, hA⟩, h⟩ => hA s hs h
have hne : ∃ y, ¬ D y := match hS with | ⟨s, hs⟩ => ⟨s, hDS s hs⟩
let m := K.ch (fun y => ¬ D y) hne
have hm : nxt K D m := (nxt_new K D hne).1
have hmD : ¬ D m := (nxt_new K D hne).2
-- nxt D meets S, at m
have hmeet : ∃ s, S s ∧ nxt K D s := dne K _ (fun hno => hmD
(⟨_, ⟨(T_closed K).2 _ hDT, fun s hs hn => hno ⟨s, hs, hn⟩⟩, hm⟩ : D m))
have hSm : S m := match hmeet with
| ⟨s, hs, hn⟩ => hn.elim (fun hd => (hDS s hs hd).elim) (fun ⟨h, e⟩ => by
have : s = m := e.trans (K.ch_ext _ _ h hne (fun _ => Iff.rfl))
rw [← this]; exact hs)
refine ⟨m, hSm, fun s hs => ?_⟩
-- Below m ⊆ D ⊆ Below s
have h1 : Sub (Below K m) D := by
cases chain K _ _ (below_T K m) ((T_closed K).2 _ hDT) with
| inr h => exact ((below_not K m) (h m hm)).elim
| inl h => exact fun z hz => (h z hz).elim id (fun ⟨h', e⟩ => by
have : z = m := e.trans (K.ch_ext _ _ h' hne (fun _ => Iff.rfl))
rw [this] at hz
exact (below_not K m hz).elim)
have h2 : Sub D (Below K s) := fun z hz => ⟨D, ⟨hDT, hDS s hs⟩, hz⟩
exact fun z hz => h2 z (h1 z hz)
end WO
end Found
#print axioms Found.WO.lemma1
#print axioms Found.WO.lemma2
#print axioms Found.WO.chain
#print axioms Found.WO.le_antisymm
#print axioms Found.WO.le_total
#print axioms Found.WO.least
lean_all/found/ZF.lean
/-
T89. found/ZF — ZF and ZFC as points: the IZF point (T88) with the
classical condition on the truth-value coordinate.
* ZF = IZF + excluded middle: under the condition LEM, foundation takes its
classical form (every inhabited set has an ∈-minimal element), derived
from ∈-induction (T109) — the constructive part needs no LEM, LEM is used
only to remove a double negation.
* Without LEM the same coordinate proves the double-negated form
(constructively): the ZF ↪ IZF double-negation translation (Friedman,
cited) is the line from this point to T88.
* ZFC = ZF + choice; choice ⇒ LEM (Diaconescu, T87 reused at the setoid
coordinate), so the ZFC condition reduces to choice.
Lean 4 core only, hand-written proofs, no axioms (LEM is a hypothesis).
-/
import found.IZF
import found.Setoid
universe u
namespace Found
namespace ZF
open WF
def Minimal (a m : V.{u}) : Prop := Mem m a ∧ ¬ ∃ y : V.{u}, Mem y m ∧ Mem y a
/-- constructively: an inhabited set cannot lack ∈-minimal elements -/
theorem not_not_minimal (a : V.{u}) (h : ∃ x : V.{u}, Mem x a) : ¬ ¬ ∃ m : V.{u}, Minimal a m := by
intro hn
have all : ∀ x : V.{u}, ¬ Mem x a :=
mem_induction (fun x => ¬ Mem x a)
(fun x y e hx hy => hx (mem_resp_left (eq_symm _ _ e) hy))
(fun x ih hx => hn ⟨x, hx, fun ⟨y, hy, hya⟩ => ih y hy hya⟩)
match h with
| ⟨x, hx⟩ => exact all x hx
/-- with the classical condition: foundation in its ZF form -/
theorem foundation_classical (lem : ∀ p : Prop, p ∨ ¬ p) (a : V.{u}) (h : ∃ x : V.{u}, Mem x a) :
∃ m : V.{u}, Minimal a m :=
(lem (∃ m : V.{u}, Minimal a m)).elim id (fun n => (not_not_minimal a h n).elim)
/-- the ZFC condition reduces to choice (Diaconescu at the setoid coordinate, T87) -/
theorem zfc_condition (ac : SetoidModel.SetoidAC) (a : V.{u}) (h : ∃ x : V.{u}, Mem x a) : ∃ m : V.{u}, Minimal a m :=
foundation_classical (SetoidModel.ac_lem ac) a h
end ZF
end Found
#print axioms Found.ZF.not_not_minimal
#print axioms Found.ZF.foundation_classical
#print axioms Found.ZF.zfc_condition
lean_all/found/ZFV.lean
/-
Shared tool: Aczel's universe V.{0} is a model of ZFC (universe-hierarchy
point, classical point with choice). found/ZFV — every axiom of ZF(B1)
(found/NbgZ5, NbgZ6: Leibniz extensionality, pairing, union, power set,
infinity, choice, the replacement scheme and the foundation scheme) is
true in V.{0} under every valuation.
Lean 4 core only, hand-written proofs, no axioms.
Classical point: K (Type) and K1 (choice on Type 1, extensional), as
parameters.
CIC dependence: impredicative Prop (power sets).
-/
import found.Refl3
import found.NbgZ6
namespace Found
namespace RF
open WF FO FOCT NBGc
section Z
theorem ceqC_iff {u a : V.{0}} : (∀ s, (Mem s u → Mem s a) ∧ (Mem s a → Mem s u)) ↔ Eq' u a :=
⟨fun h => extensionality u a (fun s => ⟨(h s).1, (h s).2⟩),
fun e _ => ⟨fun m => mem_resp_right m e, fun m => mem_resp_right m (eq_symm _ _ e)⟩⟩
theorem extAx_V (v : Nat → V.{0}) : Sat RV extAx v := fun X Y h _ hm =>
mem_resp_left (extensionality X Y (fun z => ⟨(h z).1, (h z).2⟩)) hm
theorem pairAx_V (v : Nat → V.{0}) : Sat RV pairAx v := fun a b =>
⟨IZF.pair a b, fun u =>
⟨fun hm => ((IZF.pair_spec a b u).1 hm).elim (fun e => .inl (ceqC_iff.2 e)) (fun e => .inr (ceqC_iff.2 e)),
fun h => (IZF.pair_spec a b u).2 (h.elim (fun e => .inl (ceqC_iff.1 e)) (fun e => .inr (ceqC_iff.1 e)))⟩⟩
theorem unionAx_V (v : Nat → V.{0}) : Sat RV unionAx v := fun a =>
⟨IZF.union a, fun u =>
⟨fun hm => match (IZF.union_spec a u).1 hm with
| ⟨t, h1, h2⟩ => ⟨t, h1, h2⟩,
fun ⟨t, h1, h2⟩ => (IZF.union_spec a u).2 ⟨t, h1, h2⟩⟩⟩
theorem powerAx_V (v : Nat → V.{0}) : Sat RV powerAx v := fun a =>
⟨IZF.power a, fun u => ⟨fun hm t ht => (IZF.power_spec a u).1 hm t ht, fun h => (IZF.power_spec a u).2 h⟩⟩
theorem succ_mem (x s : V.{0}) : Mem s (IZF.succ x) ↔ Mem s x ∨ Eq' s x :=
match x with
| .sup _ _ => ⟨fun ⟨o, e⟩ => match o, e with
| none, e => .inr e
| some i, e => .inl ⟨i, e⟩,
fun h => h.elim (fun ⟨i, e⟩ => ⟨some i, e⟩) (fun e => ⟨none, e⟩)⟩
theorem infAx_V (v : Nat → V.{0}) : Sat RV infAx v :=
⟨IZF.omega.{0}, ⟨IZF.empty.{0}, IZF.infinity.{0, 0}.1, fun s hs => IZF.empty_spec s hs⟩, fun x hx =>
⟨IZF.succ x, IZF.infinity.{0, 0}.2 x hx, fun s =>
⟨fun hm => ((succ_mem x s).1 hm).elim .inl (fun e => .inr (ceqC_iff.2 e)),
fun h => (succ_mem x s).2 (h.elim .inl (fun e => .inr (ceqC_iff.1 e)))⟩⟩⟩
theorem acAx_V (K1 : Classical1) (v : Nat → V.{0}) : Sat RV acAx v := fun a hne hdis =>
match a with
| .sup I f =>
have ex : ∀ i, ∃ t, Mem t (f i) := fun i => hne (f i) ⟨i, eq_refl _⟩
let u : I → V.{0} := fun i => K1.ch1 (fun t => Mem t (f i)) (ex i)
have hu : ∀ i, Mem (u i) (f i) := fun i => K1.ch1_spec (fun t => Mem t (f i)) (ex i)
⟨.sup I u, fun x ⟨i, e⟩ =>
⟨u i, mem_resp_right (hu i) (eq_symm _ _ e), ⟨i, eq_refl _⟩, fun s hsx ⟨i', es⟩ =>
have hsi' : Mem s (f i') := mem_resp_left (eq_symm _ _ es) (hu i')
have hsi : Mem s (f i) := mem_resp_right hsx e
match hdis (f i) (f i') ⟨i, eq_refl _⟩ ⟨i', eq_refl _⟩ with
| .inl hc =>
have ee : u i = u i' := K1.ch1_ext _ _ (ex i) (ex i') (fun t => ⟨fun m => (hc t).1 m, fun m => (hc t).2 m⟩)
by
show ∀ w, (Mem w s → Mem w (u i)) ∧ (Mem w (u i) → Mem w s)
rw [ee]
exact ceqC_iff.2 es
| .inr hn => (hn ⟨s, hsi, hsi'⟩).elim⟩⟩
theorem ext_eq0' (v : Nat → V.{0}) {x y : V.{0}} (e : Eq' x y) : ∀ n, Eq' (ext v x n) (ext v y n)
| 0 => e
| _ + 1 => eq_refl _
theorem foundZ_V (K : CP.Classical') {θ : Fm} (hl : L0 θ) (v : Nat → V.{0}) : Sat RV (foundZ θ) v := fun ⟨x0, h0⟩ =>
have e : ∀ x y, Sat RV (ren (up Nat.succ) θ) (ext (ext v x) y) ↔ Sat RV θ (ext v y) := fun _ _ =>
(sat_ren RV θ _ _).trans (sat_ext RV θ (fun n => match n with
| 0 => rfl
| _ + 1 => rfl))
CP.dne K _ (fun hno =>
have all_out : ∀ x, ¬ Sat RV θ (ext v x) := mem_induction (fun x => ¬ Sat RV θ (ext v x))
(fun _ _ e' h hy => h (sat_eqV θ hl (ext_eq0' v (eq_symm _ _ e')) hy))
(fun x ih hx => hno ⟨x, hx, fun y hy hty => ih y hy ((e x y).1 hty)⟩)
all_out x0 h0)
theorem replZ_V (K1 : Classical1) {θ : Fm} (hl : L0 θ) (pF : Nat → V.{0}) : Sat RV (replZ θ) pF := fun x hpre =>
let Θ : V.{0} → V.{0} → Prop := fun w z => Sat RV θ (ext (ext pF z) w)
have hΘ : ∀ w w' z z', Eq' w w' → Eq' z z' → Θ w z → Θ w' z' := fun w w' z z' ew ez h =>
sat_eqV θ hl (v := ext (ext pF z) w) (w := ext (ext pF z') w') (fun n => match n with
| 0 => ew
| 1 => ez
| _ + 2 => eq_refl _) h
have eA : ∀ w z z', Sat RV (ren (r3 2 1) θ) (ext (ext (ext (ext pF x) w) z) z') ↔ Θ w z :=
fun _ _ _ => (sat_ren RV θ _ _).trans (sat_ext RV θ (fun n => match n with
| 0 => rfl
| 1 => rfl
| _ + 2 => rfl))
have eB : ∀ w z z', Sat RV (ren (r3 2 0) θ) (ext (ext (ext (ext pF x) w) z) z') ↔ Θ w z' :=
fun _ _ _ => (sat_ren RV θ _ _).trans (sat_ext RV θ (fun n => match n with
| 0 => rfl
| 1 => rfl
| _ + 2 => rfl))
have eC : ∀ y z w, Sat RV (ren (r3 0 1) θ) (ext (ext (ext (ext pF x) y) z) w) ↔ Θ w z :=
fun _ _ _ => (sat_ren RV θ _ _).trans (sat_ext RV θ (fun n => match n with
| 0 => rfl
| 1 => rfl
| _ + 2 => rfl))
have fn : ∀ w, Mem w x → ∀ z z', Θ w z → Θ w z' → Eq' z z' := fun w hw z z' h1 h2 =>
ceqC_iff.1 (hpre w hw z z' ⟨(eA w z z').2 h1, (eB w z z').2 h2⟩)
match x with
| .sup I g =>
let J := {i : I // ∃ z, Θ (g i) z}
let img : J → V.{0} := fun p => K1.ch1 (fun z => Θ (g p.1) z) p.2
have himg : ∀ p : J, Θ (g p.1) (img p) := fun p => K1.ch1_spec (fun z => Θ (g p.1) z) p.2
⟨.sup J img, fun z =>
⟨fun ⟨p, e⟩ => ⟨g p.1, ⟨p.1, eq_refl _⟩, (eC _ z (g p.1)).2 (hΘ _ _ _ _ (eq_refl _) (eq_symm _ _ e) (himg p))⟩,
fun ⟨w, ⟨i, ew⟩, ht⟩ =>
have h1 : Θ (g i) z := hΘ _ _ _ _ ew (eq_refl _) ((eC _ z w).1 ht)
let p : J := ⟨i, z, h1⟩
⟨p, fn (g i) ⟨i, eq_refl _⟩ z (img p) h1 (himg p)⟩⟩⟩
/-- V.{0} is a model of ZFC -/
theorem zfc_V (K : CP.Classical') (K1 : Classical1) : ∀ φ, ZF B1 φ → ∀ v : Nat → V.{0}, Sat RV φ v := fun φ h v =>
match h with
| .inl e => by rw [e]; exact extAx_V v
| .inr (.inl hb) => match hb with
| .inl (.inl e) => by rw [e]; exact pairAx_V v
| .inl (.inr (.inl e)) => by rw [e]; exact unionAx_V v
| .inl (.inr (.inr (.inl e))) => by rw [e]; exact powerAx_V v
| .inl (.inr (.inr (.inr e))) => by rw [e]; exact infAx_V v
| .inr e => by rw [e]; exact acAx_V K1 v
| .inr (.inr (.inl ⟨θ, hl, e⟩)) => by rw [e]; exact replZ_V K1 hl v
| .inr (.inr (.inr ⟨θ, hl, e⟩)) => by rw [e]; exact foundZ_V K hl v
end Z
end RF
end Found
#print axioms Found.RF.ceqC_iff
#print axioms Found.RF.acAx_V
#print axioms Found.RF.foundZ_V
#print axioms Found.RF.replZ_V
#print axioms Found.RF.zfc_V
lean_all/found/ZX.lean
/-
T184, the ZX-calculus (phases 0 and π). found/ZX — linear maps on qubits
as integer matrices indexed by bit lists; spiders and the Hadamard map:
* Z(n,m,a) = |0…0⟩⟨0…0| + (−1)^a |1…1⟩⟨1…1|;
* X(n,m,a) (unnormalised) = 1 exactly when the parity of all legs is a;
* H^{⊗k}(x, y) = (−1)^{x·y}.
Rules proved for all arities: spider fusion along one wire for Z and for
X (phases add), the general colour change H^{⊗m} ∘ Z(n,m,a) ∘ H^{⊗n} =
2 X(n,m,a); and the circuit line: CNOT is the Z-copy followed by the X-xor
(single-qubit Z, X and H are spiders and the Hadamard box).
Lean 4 core only, hand-written proofs, no axioms.
-/
import lib.IntRing
namespace Found
namespace ZX
/-- all bit lists of length k -/
def bits : Nat → List (List Bool)
| 0 => [[]]
| k + 1 => (bits k).map (List.cons false) ++ (bits k).map (List.cons true)
def sumL {α : Type} (f : α → Int) : List α → Int
| [] => 0
| x :: l => f x + sumL f l
def ind (b : Bool) : Int := cond b 1 0
def sgn (b : Bool) : Int := cond b (-1) 1
def allF : List Bool → Bool
| [] => true
| b :: l => !b && allF l
def allT : List Bool → Bool
| [] => true
| b :: l => b && allT l
def par : List Bool → Bool
| [] => false
| b :: l => xor b (par l)
/-- the Z spider -/
def Zs (a : Bool) (i o : List Bool) : Int := ind (allF i && allF o) + sgn a * ind (allT i && allT o)
/-- the (unnormalised) X spider -/
def Xs (a : Bool) (i o : List Bool) : Int := ind (xor (par i) (par o) == a)
/-- composition through one wire -/
def comp1 (B A : List Bool → List Bool → Int) (i o : List Bool) : Int := A i [false] * B [false] o + A i [true] * B [true] o
theorem allF_one (b : Bool) : allF [b] = !b := by cases b <;> rfl
theorem allT_one (b : Bool) : allT [b] = b := by cases b <;> rfl
theorem par_one (b : Bool) : par [b] = b := by cases b <;> rfl
theorem sgn_mul (a b : Bool) : sgn a * sgn b = sgn (xor a b) := by cases a <;> cases b <;> rfl
/-- Z spider fusion along one wire: Z(1,m,b) ∘ Z(n,1,a) = Z(n,m,a ⊕ b) -/
theorem z_fusion (a b : Bool) (i o : List Bool) : comp1 (Zs b) (Zs a) i o = Zs (xor a b) i o := by
unfold comp1 Zs
rw [allF_one, allF_one, allT_one, allT_one]
cases hF : allF i <;> cases hT : allT i <;> cases hF' : allF o <;> cases hT' : allT o <;> cases a <;> cases b <;> rfl
/-- X spider fusion along one wire: X(1,m,b) ∘ X(n,1,a) = X(n,m,a ⊕ b) -/
theorem x_fusion (a b : Bool) (i o : List Bool) : comp1 (Xs b) (Xs a) i o = Xs (xor a b) i o := by
unfold comp1 Xs
rw [par_one, par_one]
cases par i <;> cases par o <;> cases a <;> cases b <;> rfl
/-- the identity rule: Z(1,1,0) is the identity on one qubit -/
theorem z_id (x y : Bool) : Zs false [x] [y] = ind (x == y) := by cases x <;> cases y <;> rfl
/-- single-qubit gates: Z(1,1,π) is Pauli Z, X(1,1,π) is Pauli X (bit flip), X(1,1,0) the identity -/
theorem z_pauli (x y : Bool) : Zs true [x] [y] = ind (x == y) * sgn x := by cases x <;> cases y <;> rfl
theorem x_pauli (x y : Bool) : Xs true [x] [y] = ind (y == !x) := by cases x <;> cases y <;> rfl
theorem x_id (x y : Bool) : Xs false [x] [y] = ind (x == y) := by cases x <;> cases y <;> rfl
/-- CNOT = X-xor after Z-copy: Σ_w Z(1,2,0)(c; c', w) X(2,1,0)(w, t; t') -/
theorem cnot (c t c' t' : Bool) :
Zs false [c] [c', false] * Xs false [false, t] [t'] + Zs false [c] [c', true] * Xs false [true, t] [t'] =
ind (c == c' && t' == xor t c) := by
cases c <;> cases t <;> cases c' <;> cases t' <;> rfl
/-! ## colour change for all arities -/
def dot : List Bool → List Bool → Bool
| [], _ => false
| _ :: _, [] => false
| x :: xs, y :: ys => xor (x && y) (dot xs ys)
/-- the Hadamard map on k qubits (unnormalised): (−1)^{x·y} -/
def Hk (x y : List Bool) : Int := sgn (dot x y)
def Xs' (a p q : Bool) : Int := ind (xor p q == a)
def zeros : Nat → List Bool
| 0 => []
| k + 1 => false :: zeros k
def ones : Nat → List Bool
| 0 => []
| k + 1 => true :: ones k
theorem sum_append {α : Type} (f : α → Int) : (l m : List α) → sumL f (l ++ m) = sumL f l + sumL f m
| [], m => by show sumL f m = 0 + sumL f m; lib_int
| x :: l, m => by
show f x + sumL f (l ++ m) = f x + sumL f l + sumL f m
rw [sum_append f l m]; lib_int
theorem sum_map {α β : Type} (f : β → Int) (g : α → β) : (l : List α) → sumL f (l.map g) = sumL (fun x => f (g x)) l
| [] => rfl
| x :: l => congrArg (f (g x) + ·) (sum_map f g l)
theorem sum_zero {α : Type} : (l : List α) → sumL (fun _ => (0 : Int)) l = 0
| [] => rfl
| _ :: l => by show 0 + sumL _ l = 0; rw [sum_zero l]; lib_int
theorem sum_ext {α : Type} {f g : α → Int} (h : ∀ x, f x = g x) : (l : List α) → sumL f l = sumL g l
| [] => rfl
| x :: l => by show f x + sumL f l = g x + sumL g l; rw [h x, sum_ext h l]
theorem sum_allF (g : List Bool → Int) : (k : Nat) → sumL (fun l => ind (allF l) * g l) (bits k) = g (zeros k)
| 0 => by show ind true * g [] + 0 = g []; show 1 * g [] + 0 = g []; lib_int
| k + 1 => by
show sumL _ ((bits k).map (List.cons false) ++ (bits k).map (List.cons true)) = g (false :: zeros k)
rw [sum_append, sum_map, sum_map]
have h2 : sumL (fun l => ind (allF (true :: l)) * g (true :: l)) (bits k) = 0 :=
(sum_ext (fun l => by show (0 : Int) * g (true :: l) = 0; lib_int) (bits k)).trans (sum_zero _)
rw [h2]
show sumL (fun l => ind (allF l) * g (false :: l)) (bits k) + 0 = _
rw [sum_allF (fun l => g (false :: l)) k]
lib_int
theorem sum_allT (g : List Bool → Int) : (k : Nat) → sumL (fun l => ind (allT l) * g l) (bits k) = g (ones k)
| 0 => by show ind true * g [] + 0 = g []; show 1 * g [] + 0 = g []; lib_int
| k + 1 => by
show sumL _ ((bits k).map (List.cons false) ++ (bits k).map (List.cons true)) = g (true :: ones k)
rw [sum_append, sum_map, sum_map]
have h1 : sumL (fun l => ind (allT (false :: l)) * g (false :: l)) (bits k) = 0 :=
(sum_ext (fun l => by show (0 : Int) * g (false :: l) = 0; lib_int) (bits k)).trans (sum_zero _)
rw [h1]
show 0 + sumL (fun l => ind (allT l) * g (true :: l)) (bits k) = _
rw [sum_allT (fun l => g (true :: l)) k]
lib_int
theorem dot_zeros_l : (k : Nat) → (y : List Bool) → dot (zeros k) y = false
| 0, _ => rfl
| _ + 1, [] => rfl
| k + 1, _ :: ys => by show xor false (dot (zeros k) ys) = false; rw [dot_zeros_l k ys]; rfl
theorem xor_false_r (b : Bool) : xor b false = b := by cases b <;> rfl
theorem and_false_r (b : Bool) : (b && false) = false := by cases b <;> rfl
theorem and_true_r (b : Bool) : (b && true) = b := by cases b <;> rfl
theorem dot_zeros_r : (k : Nat) → (x : List Bool) → dot x (zeros k) = false
| 0, [] => rfl
| 0, _ :: _ => rfl
| _ + 1, [] => rfl
| k + 1, x :: xs => (congrArg (xor (x && false)) (dot_zeros_r k xs)).trans
((xor_false_r _).trans (and_false_r x))
theorem dot_ones_l : (y : List Bool) → dot (ones y.length) y = par y
| [] => rfl
| y :: ys => congrArg (xor y) (dot_ones_l ys)
theorem dot_ones_r : (x : List Bool) → dot x (ones x.length) = par x
| [] => rfl
| x :: xs => (congrArg (xor (x && true)) (dot_ones_r xs)).trans (congrArg (fun b => xor b (par xs)) (and_true_r x))
theorem ind_and (p q : Bool) : ind (p && q) = ind p * ind q := by cases p <;> cases q <;> rfl
theorem sum_two {α : Type} (f g : α → Int) (p q s0 : Int) : (l : List α) →
sumL (fun x => f x * p + s0 * (g x * q)) l = sumL f l * p + s0 * (sumL g l * q)
| [] => by show (0 : Int) = 0 * p + s0 * (0 * q); lib_int
| x :: l => by
show f x * p + s0 * (g x * q) + sumL (fun x => f x * p + s0 * (g x * q)) l = (f x + sumL f l) * p + s0 * ((g x + sumL g l) * q)
rw [sum_two f g p q s0 l]
lib_int
theorem sum_two' {α : Type} (f g : α → Int) (p q s0 : Int) : (l : List α) →
sumL (fun x => p * f x + s0 * (q * g x)) l = p * sumL f l + s0 * (q * sumL g l)
| [] => by show (0 : Int) = p * 0 + s0 * (q * 0); lib_int
| x :: l => by
show p * f x + s0 * (q * g x) + sumL (fun x => p * f x + s0 * (q * g x)) l = p * (f x + sumL f l) + s0 * (q * (g x + sumL g l))
rw [sum_two' f g p q s0 l]
lib_int
theorem fin (a p q : Bool) : (1 : Int) * 1 + sgn a * (sgn p * sgn q) = 2 * Xs' a p q := by
cases a <;> cases p <;> cases q <;> rfl
/-- colour change: H^{⊗m} ∘ Z(n,m,a) ∘ H^{⊗n} = 2 X(n,m,a) -/
theorem colour_change (a : Bool) (i o : List Bool) :
sumL (fun l => sumL (fun l' => Hk o l' * Zs a l l' * Hk l i) (bits o.length)) (bits i.length) = 2 * Xs a i o := by
have inner : ∀ l, sumL (fun l' => Hk o l' * Zs a l l' * Hk l i) (bits o.length) =
(ind (allF l) * Hk l i) * Hk o (zeros o.length) + sgn a * ((ind (allT l) * Hk l i) * Hk o (ones o.length)) := by
intro l
have e := sum_two' (fun l' => ind (allF l') * Hk o l') (fun l' => ind (allT l') * Hk o l')
(ind (allF l) * Hk l i) (ind (allT l) * Hk l i) (sgn a) (bits o.length)
rw [sum_allF, sum_allT] at e
refine (sum_ext (fun l' => ?_) _).trans e
show Hk o l' * (ind (allF l && allF l') + sgn a * ind (allT l && allT l')) * Hk l i = _
rw [ind_and, ind_and]
lib_int
rw [sum_ext inner]
have e2 := sum_two (fun l => ind (allF l) * Hk l i) (fun l => ind (allT l) * Hk l i)
(Hk o (zeros o.length)) (Hk o (ones o.length)) (sgn a) (bits i.length)
rw [sum_allF, sum_allT] at e2
rw [e2]
have h1 : Hk (zeros i.length) i = 1 := congrArg sgn (dot_zeros_l _ i)
have h2 : Hk o (zeros o.length) = 1 := congrArg sgn (dot_zeros_r _ o)
have h3 : Hk (ones i.length) i = sgn (par i) := congrArg sgn (dot_ones_l i)
have h4 : Hk o (ones o.length) = sgn (par o) := congrArg sgn (dot_ones_r o)
rw [h1, h2, h3, h4]
exact fin a (par i) (par o)
end ZX
end Found
#print axioms Found.ZX.z_fusion
#print axioms Found.ZX.x_fusion
#print axioms Found.ZX.z_id
#print axioms Found.ZX.cnot
#print axioms Found.ZX.sum_allF
#print axioms Found.ZX.colour_change
lean_all/found/Zinf.lean
/-
T124 (b), part 2. found/Zinf — Schütte's infinitary arithmetic Z∞.
Formulas of arithmetic in negation normal form are evaluated in an
environment ρ (no substitution needed); sequents are lists of
(formula, environment) items; ∀ has the ω-rule. Derivations carry a height
(an ordinal notation below ε₀, found/Ordinal) and a cut bound r: every
premise is strictly lower, and cut formulas have rank < r.
Part 2: syntax, derivations, weakening, raising heights, deleting false
atoms, and the consistency of cut-free derivations.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.OrdArith
namespace Found
namespace Zinf
open _root_.Found.Ord
inductive Tm where
| var : Nat → Tm
| zero : Tm
| succ : Tm → Tm
| add : Tm → Tm → Tm
| mul : Tm → Tm → Tm
def ev (ρ : Nat → Nat) : Tm → Nat
| .var i => ρ i
| .zero => 0
| .succ t => ev ρ t + 1
| .add s t => ev ρ s + ev ρ t
| .mul s t => ev ρ s * ev ρ t
inductive Fm where
| eq : Tm → Tm → Fm
| ne : Tm → Tm → Fm
| and : Fm → Fm → Fm
| or : Fm → Fm → Fm
| all : Fm → Fm
| ex : Fm → Fm
def dual : Fm → Fm
| .eq s t => .ne s t
| .ne s t => .eq s t
| .and a b => .or (dual a) (dual b)
| .or a b => .and (dual a) (dual b)
| .all a => .ex (dual a)
| .ex a => .all (dual a)
def rk : Fm → Nat
| .eq _ _ => 0
| .ne _ _ => 0
| .and a b => rk a + rk b + 1
| .or a b => rk a + rk b + 1
| .all a => rk a + 1
| .ex a => rk a + 1
theorem rk_dual : (a : Fm) → rk (dual a) = rk a
| .eq _ _ => rfl
| .ne _ _ => rfl
| .and a b => by show rk (dual a) + rk (dual b) + 1 = _; rw [rk_dual a, rk_dual b]; rfl
| .or a b => by show rk (dual a) + rk (dual b) + 1 = _; rw [rk_dual a, rk_dual b]; rfl
| .all a => congrArg (· + 1) (rk_dual a)
| .ex a => congrArg (· + 1) (rk_dual a)
def cons (n : Nat) (ρ : Nat → Nat) : Nat → Nat
| 0 => n
| k + 1 => ρ k
/-- a true atom in an environment -/
def TrueAt : Fm → (Nat → Nat) → Prop
| .eq s t, ρ => ev ρ s = ev ρ t
| .ne s t, ρ => ev ρ s ≠ ev ρ t
| .and _ _, _ => False
| .or _ _, _ => False
| .all _, _ => False
| .ex _, _ => False
abbrev Item := Fm × (Nat → Nat)
inductive Der : ON → Nat → List Item → Prop where
| ax {α r Γ} (A : Fm) (ρ : Nat → Nat) : (A, ρ) ∈ Γ → TrueAt A ρ → Der α r Γ
| and {α r Γ} (A B : Fm) (ρ : Nat → Nat) (β γ : ON) : (.and A B, ρ) ∈ Γ →
Der β r ((A, ρ) :: Γ) → Der γ r ((B, ρ) :: Γ) → Lt β α → Lt γ α → Der α r Γ
| orL {α r Γ} (A B : Fm) (ρ : Nat → Nat) (β : ON) : (.or A B, ρ) ∈ Γ →
Der β r ((A, ρ) :: Γ) → Lt β α → Der α r Γ
| orR {α r Γ} (A B : Fm) (ρ : Nat → Nat) (β : ON) : (.or A B, ρ) ∈ Γ →
Der β r ((B, ρ) :: Γ) → Lt β α → Der α r Γ
| all {α r Γ} (A : Fm) (ρ : Nat → Nat) (β : Nat → ON) : (.all A, ρ) ∈ Γ →
(∀ n, Der (β n) r ((A, cons n ρ) :: Γ)) → (∀ n, Lt (β n) α) → Der α r Γ
| ex {α r Γ} (A : Fm) (ρ : Nat → Nat) (n : Nat) (β : ON) : (.ex A, ρ) ∈ Γ →
Der β r ((A, cons n ρ) :: Γ) → Lt β α → Der α r Γ
| cut {α r Γ} (C : Fm) (ρ : Nat → Nat) (β γ : ON) : rk C < r →
Der β r ((C, ρ) :: Γ) → Der γ r ((dual C, ρ) :: Γ) → Lt β α → Lt γ α → Der α r Γ
def Sub (Γ Δ : List Item) : Prop := ∀ x, x ∈ Γ → x ∈ Δ
theorem sub_cons {Γ Δ : List Item} (x : Item) (h : Sub Γ Δ) : Sub (x :: Γ) (x :: Δ) := fun y m => by
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (h y m')
/-- weakening -/
theorem weaken {α r Γ} (d : Der α r Γ) : ∀ {Δ}, Sub Γ Δ → Der α r Δ := by
induction d with
| ax A ρ m t => exact fun h => .ax A ρ (h _ m) t
| and A B ρ β γ m _ _ h1 h2 ih1 ih2 => exact fun h => .and A B ρ β γ (h _ m) (ih1 (sub_cons _ h)) (ih2 (sub_cons _ h)) h1 h2
| orL A B ρ β m _ h1 ih => exact fun h => .orL A B ρ β (h _ m) (ih (sub_cons _ h)) h1
| orR A B ρ β m _ h1 ih => exact fun h => .orR A B ρ β (h _ m) (ih (sub_cons _ h)) h1
| all A ρ β m _ h1 ih => exact fun h => .all A ρ β (h _ m) (fun n => ih n (sub_cons _ h)) h1
| ex A ρ n β m _ h1 ih => exact fun h => .ex A ρ n β (h _ m) (ih (sub_cons _ h)) h1
| cut C ρ β γ hr _ _ h1 h2 ih1 ih2 => exact fun h => .cut C ρ β γ hr (ih1 (sub_cons _ h)) (ih2 (sub_cons _ h)) h1 h2
/-- raising the height -/
theorem raise {α r Γ} (d : Der α r Γ) : ∀ {α'}, Lt α α' → Der α' r Γ := by
induction d with
| ax A ρ m t => exact fun _ => .ax A ρ m t
| and A B ρ β γ m d1 d2 h1 h2 _ _ => exact fun h => .and A B ρ β γ m d1 d2 (lt_trans _ _ _ h1 h) (lt_trans _ _ _ h2 h)
| orL A B ρ β m d1 h1 _ => exact fun h => .orL A B ρ β m d1 (lt_trans _ _ _ h1 h)
| orR A B ρ β m d1 h1 _ => exact fun h => .orR A B ρ β m d1 (lt_trans _ _ _ h1 h)
| all A ρ β m d1 h1 _ => exact fun h => .all A ρ β m d1 (fun n => lt_trans _ _ _ (h1 n) h)
| ex A ρ n β m d1 h1 _ => exact fun h => .ex A ρ n β m d1 (lt_trans _ _ _ h1 h)
| cut C ρ β γ hr d1 d2 h1 h2 _ _ => exact fun h => .cut C ρ β γ hr d1 d2 (lt_trans _ _ _ h1 h) (lt_trans _ _ _ h2 h)
/-- a sequent of false atoms only -/
def AllFalse (Γ : List Item) : Prop := ∀ x, x ∈ Γ → ∃ s t, (x.1 = .eq s t ∨ x.1 = .ne s t) ∧ ¬ TrueAt x.1 x.2
/-- consistency of cut-free derivations: no sequent of false atoms is derivable without cuts -/
theorem cutfree_consistent' {α r Γ} (d : Der α r Γ) (hr0 : r = 0) : ¬ AllFalse Γ := by
induction d with
| ax A ρ m t => exact fun h => match h _ m with | ⟨_, _, _, hf⟩ => hf t
| and A B ρ _ _ m _ _ _ _ _ _ => exact fun h => match h _ m with
| ⟨_, _, Or.inl e, _⟩ => Fm.noConfusion e
| ⟨_, _, Or.inr e, _⟩ => Fm.noConfusion e
| orL A B ρ _ m _ _ _ => exact fun h => match h _ m with
| ⟨_, _, Or.inl e, _⟩ => Fm.noConfusion e
| ⟨_, _, Or.inr e, _⟩ => Fm.noConfusion e
| orR A B ρ _ m _ _ _ => exact fun h => match h _ m with
| ⟨_, _, Or.inl e, _⟩ => Fm.noConfusion e
| ⟨_, _, Or.inr e, _⟩ => Fm.noConfusion e
| all A ρ _ m _ _ _ => exact fun h => match h _ m with
| ⟨_, _, Or.inl e, _⟩ => Fm.noConfusion e
| ⟨_, _, Or.inr e, _⟩ => Fm.noConfusion e
| ex A ρ _ _ m _ _ _ => exact fun h => match h _ m with
| ⟨_, _, Or.inl e, _⟩ => Fm.noConfusion e
| ⟨_, _, Or.inr e, _⟩ => Fm.noConfusion e
| cut C ρ _ _ hr _ _ _ _ _ _ => exact absurd (hr0 ▸ hr) (Nat.not_lt_zero _)
theorem cutfree_consistent {α Γ} (d : Der α 0 Γ) : ¬ AllFalse Γ := cutfree_consistent' d rfl
/-- in particular 0 = 1 has no cut-free derivation -/
theorem no_cutfree_false (α : ON) (ρ : Nat → Nat) : ¬ Der α 0 [(.eq .zero (.succ .zero), ρ)] :=
fun d => cutfree_consistent d (fun x m => by
cases m with
| head => exact ⟨.zero, .succ .zero, Or.inl rfl, fun e => Nat.noConfusion e⟩
| tail _ m' => exact nomatch m')
/-! ## Part 3: inversion, reduction, elimination -/
def fstF : Fm → Fm
| .eq _ _ => .eq .zero .zero
| .ne _ _ => .eq .zero .zero
| .and a _ => a
| .or a _ => a
| .all a => a
| .ex a => a
def sndF : Fm → Fm
| .eq _ _ => .eq .zero .zero
| .ne _ _ => .eq .zero .zero
| .and _ b => b
| .or _ b => b
| .all a => a
| .ex a => a
def tagF : Fm → Nat
| .eq _ _ => 0
| .ne _ _ => 1
| .and _ _ => 2
| .or _ _ => 3
| .all _ => 4
| .ex _ => 5
theorem beqN_refl : (n : Nat) → Nat.beq n n = true
| 0 => rfl
| n + 1 => beqN_refl n
theorem tag_ne {A B : Fm} (e : A = B) (h : Nat.beq (tagF A) (tagF B) = false) : False :=
Bool.noConfusion (h.symm.trans ((congrArg (fun x => Nat.beq (tagF x) (tagF B)) e).trans (beqN_refl _)))
theorem item_fst {x y : Item} (e : x = y) : x.1 = y.1 := congrArg Prod.fst e
theorem item_snd {x y : Item} (e : x = y) : x.2 = y.2 := congrArg Prod.snd e
theorem swap2' (a b : Item) (Γ : List Item) : Sub (a :: Γ) (a :: b :: Γ) := fun _ m => by
cases m with
| head => exact .head _
| tail _ m' => exact .tail _ (.tail _ m')
theorem mem_cons' {x y : Item} {l : List Item} (m : x ∈ y :: l) : x = y ∨ x ∈ l := by
cases m with
| head => exact Or.inl rfl
| tail _ m' => exact Or.inr m'
theorem swap2 (a b : Item) (Γ : List Item) : Sub (a :: b :: Γ) (b :: a :: Γ) := fun _ m =>
(mem_cons' m).elim (fun e => e ▸ .tail _ (.head _)) (fun m' =>
(mem_cons' m').elim (fun e => e ▸ .head _) (fun m'' => .tail _ (.tail _ m'')))
theorem dup1 (a : Item) (Γ : List Item) : Sub (a :: a :: Γ) (a :: Γ) := fun _ m =>
(mem_cons' m).elim (fun e => e ▸ .head _) id
/-- the context bookkeeping used by every inversion step: if Δ ⊆ C :: Γ then
X :: Δ ⊆ C :: X :: Γ -/
theorem sub_push {C : Item} {Δ Γ : List Item} (h : Sub Δ (C :: Γ)) (X : Item) : Sub (X :: Δ) (C :: X :: Γ) :=
fun z m => (mem_cons' m).elim (fun e => e ▸ .tail _ (.head _)) (fun m' =>
(mem_cons' (h z m')).elim (fun e => e ▸ .head _) (fun m'' => .tail _ (.tail _ m'')))
/-- re-attach: from D :: X :: Γ get X :: D :: Γ -/
theorem fix_order {α r} {D X : Item} {Γ : List Item} (d : Der α r (D :: X :: Γ)) : Der α r (X :: D :: Γ) :=
weaken d (swap2 D X Γ)
/-- generic inversion: an item C whose only rules are given by `prem` can be
replaced by any item D such that every rule with principal C yields D;
stated concretely for ∧ (left/right), ∀ (each n), and false atoms. -/
theorem inv_gen (C : Item) (D : Item) (hax : ¬ TrueAt C.1 C.2)
(hand : ∀ A B ρ β γ r Γ', (Fm.and A B, ρ) = C → Der β r ((A, ρ) :: Γ') → Der γ r ((B, ρ) :: Γ') →
∀ α, Lt β α → Lt γ α → (∀ Δ', Sub ((A, ρ) :: Γ') (C :: Δ') → Der β r (D :: Δ')) →
(∀ Δ', Sub ((B, ρ) :: Γ') (C :: Δ') → Der γ r (D :: Δ')) → ∀ Γ, Sub Γ' (C :: Γ) → Der α r (D :: Γ))
(hor : ∀ A B ρ, (Fm.or A B, ρ) ≠ C)
(hall : ∀ A ρ (β : Nat → ON) r Γ', (Fm.all A, ρ) = C → (∀ n, Der (β n) r ((A, cons n ρ) :: Γ')) →
∀ α, (∀ n, Lt (β n) α) → (∀ n Δ', Sub ((A, cons n ρ) :: Γ') (C :: Δ') → Der (β n) r (D :: Δ')) →
∀ Γ, Sub Γ' (C :: Γ) → Der α r (D :: Γ))
(hex : ∀ A ρ, (Fm.ex A, ρ) ≠ C)
{α r Δ} (d : Der α r Δ) : ∀ Γ, Sub Δ (C :: Γ) → Der α r (D :: Γ) := by
induction d with
| ax A ρ m t =>
intro Γ h
exact (mem_cons' (h _ m)).elim (fun e => absurd (e ▸ t) hax) (fun m' => .ax A ρ (.tail _ m') t)
| @and α' r' Γ' A B ρ β γ m d1 d2 h1 h2 ih1 ih2 =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => hand A B ρ β γ r' Γ' e d1 d2 α' h1 h2 ih1 ih2 Γ h)
(fun m' => .and A B ρ β γ (.tail _ m') (fix_order (ih1 _ (sub_push h _))) (fix_order (ih2 _ (sub_push h _))) h1 h2)
| orL A B ρ β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim (fun e => absurd e (hor A B ρ))
(fun m' => .orL A B ρ β (.tail _ m') (fix_order (ih _ (sub_push h _))) h1)
| orR A B ρ β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim (fun e => absurd e (hor A B ρ))
(fun m' => .orR A B ρ β (.tail _ m') (fix_order (ih _ (sub_push h _))) h1)
| @all α' r' Γ' A ρ β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => hall A ρ β r' Γ' e d1 α' h1 ih Γ h)
(fun m' => .all A ρ β (.tail _ m') (fun n => fix_order (ih n _ (sub_push h _))) h1)
| ex A ρ n β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim (fun e => absurd e (hex A ρ))
(fun m' => .ex A ρ n β (.tail _ m') (fix_order (ih _ (sub_push h _))) h1)
| cut C' ρ β γ hr d1 d2 h1 h2 ih1 ih2 =>
intro Γ h
exact .cut C' ρ β γ hr (fix_order (ih1 _ (sub_push h _))) (fix_order (ih2 _ (sub_push h _))) h1 h2
theorem and_ne_or (A B A' B' : Fm) (ρ ρ' : Nat → Nat) : (Fm.or A' B', ρ') ≠ (Fm.and A B, ρ) :=
fun e => tag_ne (item_fst e) rfl
theorem ex_ne_and (A A' B : Fm) (ρ ρ' : Nat → Nat) : (Fm.ex A', ρ') ≠ (Fm.and A B, ρ) :=
fun e => tag_ne (item_fst e) rfl
theorem or_ne_all (A A' B' : Fm) (ρ ρ' : Nat → Nat) : (Fm.or A' B', ρ') ≠ (Fm.all A, ρ) :=
fun e => tag_ne (item_fst e) rfl
theorem ex_ne_all (A A' : Fm) (ρ ρ' : Nat → Nat) : (Fm.ex A', ρ') ≠ (Fm.all A, ρ) :=
fun e => tag_ne (item_fst e) rfl
theorem inv_andL (A B : Fm) (ρ : Nat → Nat) {α r Δ} (d : Der α r Δ) (Γ : List Item)
(h : Sub Δ ((.and A B, ρ) :: Γ)) : Der α r ((A, ρ) :: Γ) :=
inv_gen (.and A B, ρ) (A, ρ) id
(fun A' B' ρ' β _ _ Γ' e _ _ α' h1 _ ih1 _ Γ'' hs => by
have hA : A' = A := congrArg fstF (item_fst e)
have hρ : ρ' = ρ := item_snd e
subst hA hρ
exact raise (weaken (ih1 _ (sub_push hs _)) (dup1 _ _)) h1)
(fun A' B' ρ' => and_ne_or A B A' B' ρ ρ')
(fun _ _ _ _ _ e => absurd (item_fst e) (fun e' => tag_ne e' rfl))
(fun A' ρ' => ex_ne_and A A' B ρ ρ') d Γ h
theorem inv_andR (A B : Fm) (ρ : Nat → Nat) {α r Δ} (d : Der α r Δ) (Γ : List Item)
(h : Sub Δ ((.and A B, ρ) :: Γ)) : Der α r ((B, ρ) :: Γ) :=
inv_gen (.and A B, ρ) (B, ρ) id
(fun A' B' ρ' _ γ _ Γ' e _ _ α' _ h2 _ ih2 Γ'' hs => by
have hB : B' = B := congrArg sndF (item_fst e)
have hρ : ρ' = ρ := item_snd e
subst hB hρ
exact raise (weaken (ih2 _ (sub_push hs _)) (dup1 _ _)) h2)
(fun A' B' ρ' => and_ne_or A B A' B' ρ ρ')
(fun _ _ _ _ _ e => absurd (item_fst e) (fun e' => tag_ne e' rfl))
(fun A' ρ' => ex_ne_and A A' B ρ ρ') d Γ h
theorem inv_all (A : Fm) (ρ : Nat → Nat) (n : Nat) {α r Δ} (d : Der α r Δ) (Γ : List Item)
(h : Sub Δ ((.all A, ρ) :: Γ)) : Der α r ((A, cons n ρ) :: Γ) :=
inv_gen (.all A, ρ) (A, cons n ρ) id
(fun _ _ _ _ _ _ _ e => absurd (item_fst e) (fun e' => tag_ne e' rfl))
(fun A' B' ρ' => or_ne_all A A' B' ρ ρ')
(fun A' ρ' β _ Γ' e _ α' h1 ih Γ'' hs => by
have hA : A' = A := congrArg fstF (item_fst e)
have hρ : ρ' = ρ := item_snd e
subst hA hρ
exact raise (weaken (ih n _ (sub_push hs _)) (dup1 _ _)) (h1 n))
(fun A' ρ' => ex_ne_all A A' ρ ρ') d Γ h
def IsAtom (A : Fm) : Prop := tagF A = 0 ∨ tagF A = 1
theorem not_atom_of {A B : Fm} (e : A = B) (hA : tagF A ≠ 0 ∧ tagF A ≠ 1) (hB : IsAtom B) : False :=
hB.elim (fun h => hA.1 (by rw [e]; exact h)) (fun h => hA.2 (by rw [e]; exact h))
/-- deleting a false atom -/
theorem del_false (C : Item) (hC : ¬ TrueAt C.1 C.2) (ha : IsAtom C.1) {α r Δ} (d : Der α r Δ) :
∀ Γ, Sub Δ (C :: Γ) → Der α r Γ := by
induction d with
| ax A ρ m t =>
intro Γ h
exact (mem_cons' (h _ m)).elim (fun e => absurd (e ▸ t) hC) (fun m' => .ax A ρ m' t)
| and A B ρ β γ m d1 d2 h1 h2 ih1 ih2 =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => (not_atom_of (item_fst e) ⟨fun e' => Nat.noConfusion e', fun e' => Nat.noConfusion (Nat.succ.inj e')⟩ ha).elim)
(fun m' => .and A B ρ β γ m' (ih1 _ (sub_push h _)) (ih2 _ (sub_push h _)) h1 h2)
| orL A B ρ β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => (not_atom_of (item_fst e) ⟨fun e' => Nat.noConfusion e', fun e' => Nat.noConfusion (Nat.succ.inj e')⟩ ha).elim)
(fun m' => .orL A B ρ β m' (ih _ (sub_push h _)) h1)
| orR A B ρ β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => (not_atom_of (item_fst e) ⟨fun e' => Nat.noConfusion e', fun e' => Nat.noConfusion (Nat.succ.inj e')⟩ ha).elim)
(fun m' => .orR A B ρ β m' (ih _ (sub_push h _)) h1)
| all A ρ β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => (not_atom_of (item_fst e) ⟨fun e' => Nat.noConfusion e', fun e' => Nat.noConfusion (Nat.succ.inj e')⟩ ha).elim)
(fun m' => .all A ρ β m' (fun n => ih n _ (sub_push h _)) h1)
| ex A ρ n β m d1 h1 ih =>
intro Γ h
exact (mem_cons' (h _ m)).elim
(fun e => (not_atom_of (item_fst e) ⟨fun e' => Nat.noConfusion e', fun e' => Nat.noConfusion (Nat.succ.inj e')⟩ ha).elim)
(fun m' => .ex A ρ n β m' (ih _ (sub_push h _)) h1)
| cut C' ρ β γ hr d1 d2 h1 h2 ih1 ih2 =>
intro Γ h
exact .cut C' ρ β γ hr (ih1 _ (sub_push h _)) (ih2 _ (sub_push h _)) h1 h2
/-! ## the reduction lemma -/
def Pos : Fm → Prop
| .eq _ _ => True
| .ne _ _ => True
| .and _ _ => True
| .or _ _ => False
| .all _ => True
| .ex _ => False
theorem add_zero_r : (x : ON) → add x .zero = x
| .zero => rfl
| .oadd _ _ _ => rfl
theorem raise_add {α r Γ} (d : Der α r Γ) (β : ON) : Der (add α β) r Γ := by
cases β with
| zero => rw [add_zero_r]; exact d
| oadd a n b => exact raise d (lt_add_pos α a n b)
theorem lt_add_of_lt {α β β0 : ON} (h : Lt β0 β) : Lt α (add α β) := by
cases β with
| zero => exact absurd h (fun h' => by cases β0 <;> exact C3.noConfusion h')
| oadd a n b => exact lt_add_pos α a n b
theorem dual_and (A B : Fm) : dual (.and A B) = .or (dual A) (dual B) := rfl
theorem dual_all (A : Fm) : dual (.all A) = .ex (dual A) := rfl
/-- reduction: a cut on a positive formula C (rank ≤ r) whose two sides are
derived with bound r is replaced by derivations of lower rank, at height α + β -/
theorem red (C : Fm) (ρ : Nat → Nat) (hpos : Pos C) (r : Nat) (hrk : rk C ≤ r) (α : ON)
{β Δ} (d : Der β r Δ) : ∀ Γ, Sub Δ ((dual C, ρ) :: Γ) → Der α r ((C, ρ) :: Γ) → Der (add α β) r Γ := by
induction d with
| ax A ρ' m t =>
intro Γ h dC
exact (mem_cons' (h _ m)).elim
(fun e => by
have hA : A = dual C := item_fst e
have hρ : ρ' = ρ := item_snd e
subst hρ
cases C with
| eq s u =>
subst hA
exact raise_add (del_false (.eq s u, ρ') (fun t' => t t') (Or.inl rfl) dC Γ (fun _ m => m)) _
| ne s u =>
subst hA
exact raise_add (del_false (.ne s u, ρ') (fun t' => t' t) (Or.inr rfl) dC Γ (fun _ m => m)) _
| and A1 B1 => subst hA; exact t.elim
| or A1 B1 => exact hpos.elim
| all A1 => subst hA; exact t.elim
| ex A1 => exact hpos.elim)
(fun m' => .ax A ρ' m' t)
| and A B ρ' β1 β2 m d1 d2 h1 h2 ih1 ih2 =>
intro Γ h dC
exact (mem_cons' (h _ m)).elim
(fun e => by
cases C with
| eq _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ne _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| and _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| or _ _ => exact hpos.elim
| all _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ex _ => exact hpos.elim)
(fun m' => .and A B ρ' (add α β1) (add α β2) m'
(ih1 hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))) (ih2 hrk _ (sub_push h _) (weaken dC (swap2' _ _ _)))
(add_mono α _ _ h1) (add_mono α _ _ h2))
| orL A B ρ' β1 m d1 h1 ih =>
intro Γ h dC
exact (mem_cons' (h _ m)).elim
(fun e => by
have hρ : ρ' = ρ := item_snd e
subst hρ
cases C with
| eq _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ne _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| and A1 B1 =>
have hA : A = dual A1 := congrArg fstF (item_fst e)
subst hA
have dI := ih hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))
have dA := inv_andL A1 B1 ρ' dC Γ (fun _ m => m)
have hr := Nat.lt_of_lt_of_le (Nat.lt_succ_of_le (Nat.le_add_right (rk A1) (rk B1))) hrk
exact .cut A1 ρ' α (add α β1) hr dA dI (lt_add_of_lt h1) (add_mono α _ _ h1)
| or _ _ => exact hpos.elim
| all _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ex _ => exact hpos.elim)
(fun m' => .orL A B ρ' (add α β1) m' (ih hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))) (add_mono α _ _ h1))
| orR A B ρ' β1 m d1 h1 ih =>
intro Γ h dC
exact (mem_cons' (h _ m)).elim
(fun e => by
have hρ : ρ' = ρ := item_snd e
subst hρ
cases C with
| eq _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ne _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| and A1 B1 =>
have hB : B = dual B1 := congrArg sndF (item_fst e)
subst hB
have dI := ih hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))
have dB := inv_andR A1 B1 ρ' dC Γ (fun _ m => m)
have hr := Nat.lt_of_lt_of_le (Nat.lt_succ_of_le (Nat.le_add_left (rk B1) (rk A1))) hrk
exact .cut B1 ρ' α (add α β1) hr dB dI (lt_add_of_lt h1) (add_mono α _ _ h1)
| or _ _ => exact hpos.elim
| all _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ex _ => exact hpos.elim)
(fun m' => .orR A B ρ' (add α β1) m' (ih hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))) (add_mono α _ _ h1))
| all A ρ' βs m d1 h1 ih =>
intro Γ h dC
exact (mem_cons' (h _ m)).elim
(fun e => by
cases C with
| eq _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ne _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| and _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| or _ _ => exact hpos.elim
| all _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ex _ => exact hpos.elim)
(fun m' => .all A ρ' (fun n => add α (βs n)) m'
(fun n => ih n hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))) (fun n => add_mono α _ _ (h1 n)))
| ex A ρ' n β1 m d1 h1 ih =>
intro Γ h dC
exact (mem_cons' (h _ m)).elim
(fun e => by
have hρ : ρ' = ρ := item_snd e
subst hρ
cases C with
| eq _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| ne _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| and _ _ => exact absurd (item_fst e) (fun e' => tag_ne e' rfl)
| or _ _ => exact hpos.elim
| all A1 =>
have hA : A = dual A1 := congrArg fstF (item_fst e)
subst hA
have dI := ih hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))
have dA := inv_all A1 ρ' n dC Γ (fun _ m => m)
have hr := Nat.lt_of_lt_of_le (Nat.lt_succ_self (rk A1)) hrk
exact .cut A1 (cons n ρ') α (add α β1) hr dA dI (lt_add_of_lt h1) (add_mono α _ _ h1)
| ex _ => exact hpos.elim)
(fun m' => .ex A ρ' n (add α β1) m' (ih hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))) (add_mono α _ _ h1))
| cut C' ρ' β1 β2 hr d1 d2 h1 h2 ih1 ih2 =>
intro Γ h dC
exact .cut C' ρ' (add α β1) (add α β2) hr
(ih1 hrk _ (sub_push h _) (weaken dC (swap2' _ _ _))) (ih2 hrk _ (sub_push h _) (weaken dC (swap2' _ _ _)))
(add_mono α _ _ h1) (add_mono α _ _ h2)
/-! ## elimination and consistency -/
theorem dual_dual : (A : Fm) → dual (dual A) = A
| .eq _ _ => rfl
| .ne _ _ => rfl
| .and a b => by show Fm.and (dual (dual a)) (dual (dual b)) = _; rw [dual_dual a, dual_dual b]
| .or a b => by show Fm.or (dual (dual a)) (dual (dual b)) = _; rw [dual_dual a, dual_dual b]
| .all a => congrArg Fm.all (dual_dual a)
| .ex a => congrArg Fm.ex (dual_dual a)
def w (α : ON) : ON := .oadd α 0 .zero
/-- the elimination lemma: cuts of rank r are removed at the price ω^α -/
theorem elim {α r' Γ} (d : Der α r' Γ) : ∀ r, r' = r + 1 → Der (w α) r Γ := by
induction d with
| ax A ρ m t => exact fun _ _ => .ax A ρ m t
| and A B ρ β γ m _ _ h1 h2 ih1 ih2 =>
exact fun r hr => .and A B ρ (w β) (w γ) m (ih1 r hr) (ih2 r hr) (lt_of_exp h1) (lt_of_exp h2)
| orL A B ρ β m _ h1 ih => exact fun r hr => .orL A B ρ (w β) m (ih r hr) (lt_of_exp h1)
| orR A B ρ β m _ h1 ih => exact fun r hr => .orR A B ρ (w β) m (ih r hr) (lt_of_exp h1)
| all A ρ β m _ h1 ih => exact fun r hr => .all A ρ (fun n => w (β n)) m (fun n => ih n r hr) (fun n => lt_of_exp (h1 n))
| ex A ρ n β m _ h1 ih => exact fun r hr => .ex A ρ n (w β) m (ih r hr) (lt_of_exp h1)
| @cut α' r'' Γ' C ρ β γ hrk _ _ h1 h2 ih1 ih2 =>
intro r hr
have hle : rk C ≤ r := Nat.le_of_lt_succ (by show rk C < r + 1; rw [← hr]; exact hrk)
have d1 := ih1 r hr
have d2 := ih2 r hr
cases C with
| eq s u => exact raise (red (.eq s u) ρ trivial r hle (w β) d2 Γ' (fun _ m => m) d1) (omega_add_lt h1 h2)
| ne s u => exact raise (red (.ne s u) ρ trivial r hle (w β) d2 Γ' (fun _ m => m) d1) (omega_add_lt h1 h2)
| and A B => exact raise (red (.and A B) ρ trivial r hle (w β) d2 Γ' (fun _ m => m) d1) (omega_add_lt h1 h2)
| all A => exact raise (red (.all A) ρ trivial r hle (w β) d2 Γ' (fun _ m => m) d1) (omega_add_lt h1 h2)
| or A B =>
have d1' : Der (w β) r ((dual (dual (.or A B)), ρ) :: Γ') := by rw [dual_dual]; exact d1
have hle' : rk (dual (.or A B)) ≤ r := by rw [rk_dual]; exact hle
exact raise (red (dual (.or A B)) ρ trivial r hle' (w γ) d1' Γ' (fun _ m => m) d2) (omega_add_lt h2 h1)
| ex A =>
have d1' : Der (w β) r ((dual (dual (.ex A)), ρ) :: Γ') := by rw [dual_dual]; exact d1
have hle' : rk (dual (.ex A)) ≤ r := by rw [rk_dual]; exact hle
exact raise (red (dual (.ex A)) ρ trivial r hle' (w γ) d1' Γ' (fun _ m => m) d2) (omega_add_lt h2 h1)
/-- iterated ω-exponentials: the heights stay below ε₀ -/
def tw : Nat → ON → ON
| 0, α => α
| k + 1, α => tw k (w α)
/-- full cut elimination -/
theorem cut_elim : (r : Nat) → ∀ {α Γ}, Der α r Γ → Der (tw r α) 0 Γ
| 0, _, _, d => d
| r + 1, _, _, d => cut_elim r (elim d r rfl)
/-- consistency of Z∞: 0 = 1 is not derivable, with any cuts and any height -/
theorem consistent (α : ON) (r : Nat) (ρ : Nat → Nat) : ¬ Der α r [(.eq .zero (.succ .zero), ρ)] :=
fun d => no_cutfree_false _ ρ (cut_elim r d)
end Zinf
end Found
#print axioms Found.Zinf.inv_andL
#print axioms Found.Zinf.inv_all
#print axioms Found.Zinf.del_false
#print axioms Found.Zinf.red
#print axioms Found.Zinf.elim
#print axioms Found.Zinf.cut_elim
#print axioms Found.Zinf.consistent
lean_all/found/Zorn.lean
/-
T106 (b), slice N3c(iv)(a). found/Zorn — Zorn's lemma in the classical
point: if every chain of a partial order has an upper bound, there is a
maximal element. Proof: along the Zermelo well-order (found/Cardinal),
x joins the greedy chain C when it lies strictly above every earlier member;
an upper bound of C is maximal.
Lean 4 core only, hand-written proofs, no axioms.
-/
import found.Cardinal
namespace Found
namespace ZL
open CP WO Card
variable (K : Classical') {P : Type} (le : P → P → Prop)
(refl : ∀ x, le x x) (trans : ∀ {x y z}, le x y → le y z → le x z)
(antisymm : ∀ {x y}, le x y → le y x → x = y)
def Lts (x y : P) : Prop := le x y ∧ x ≠ y
def Chain (C : P → Prop) : Prop := ∀ x y, C x → C y → le x y ∨ le y x
/-- the greedy chain -/
def InC : P → Prop :=
(wf K P).fix (fun x rec => ∀ z (h : Lt' K z x), rec z h → Lts le z x)
theorem inC_eq (x : P) : InC K le x ↔ ∀ z, Lt' K z x → InC K le z → Lts le z x := by
have e : InC K le x = ∀ z (h : Lt' K z x), InC K le z → Lts le z x := (wf K P).fix_eq _ x
rw [e]
include refl in
theorem inC_chain : Chain le (InC K le) := fun x y hx hy => by
rcases le_total K x y with hxy | hyx
· rcases K.lem (x = y) with e | ne
· rw [e]; exact Or.inl (refl y)
· exact Or.inl ((inC_eq K le y).mp hy x ⟨hxy, fun hyx => ne (le_antisymm K x y hxy hyx)⟩ hx).1
· rcases K.lem (y = x) with e | ne
· rw [e]; exact Or.inl (refl x)
· exact Or.inr ((inC_eq K le x).mp hx y ⟨hyx, fun hxy => ne (le_antisymm K y x hyx hxy)⟩ hy).1
include K refl trans antisymm in
/-- Zorn's lemma -/
theorem zorn (ub : ∀ C, Chain le C → ∃ u, ∀ x, C x → le x u) : ∃ m, ∀ y, le m y → y = m :=
match ub (InC K le) (inC_chain K le refl) with
| ⟨u, hu⟩ => ⟨u, fun y huy => dne K _ (fun hne => by
-- y is strictly above every member of the chain, so it joins it, so y ≤ u
have hy : InC K le y := (inC_eq K le y).mpr (fun z _ hz =>
⟨trans (hu z hz) huy, fun e => hne (antisymm (e ▸ hu z hz) huy)⟩)
exact hne (antisymm (hu y hy) huy))⟩
/-! ## the preorder version (no antisymmetry needed) -/
section Pre
variable {Q : Type} (pl : Q → Q → Prop) (prefl : ∀ x, pl x x) (ptrans : ∀ {x y z}, pl x y → pl y z → pl x z)
def SLt (x y : Q) : Prop := pl x y ∧ ¬ pl y x
def InCp : Q → Prop :=
(wf K Q).fix (fun x rec => ∀ z (h : Lt' K z x), rec z h → SLt pl z x)
theorem inCp_eq (x : Q) : InCp K pl x ↔ ∀ z, Lt' K z x → InCp K pl z → SLt pl z x := by
have e : InCp K pl x = ∀ z (h : Lt' K z x), InCp K pl z → SLt pl z x := (wf K Q).fix_eq _ x
rw [e]
include prefl in
theorem inCp_chain : Chain pl (InCp K pl) := fun x y hx hy => by
rcases le_total K x y with hxy | hyx
· rcases K.lem (x = y) with e | ne
· rw [e]; exact Or.inl (prefl y)
· exact Or.inl ((inCp_eq K pl y).mp hy x ⟨hxy, fun hyx => ne (le_antisymm K x y hxy hyx)⟩ hx).1
· rcases K.lem (y = x) with e | ne
· rw [e]; exact Or.inl (prefl x)
· exact Or.inr ((inCp_eq K pl x).mp hx y ⟨hyx, fun hxy => ne (le_antisymm K y x hyx hxy)⟩ hy).1
include K prefl ptrans in
/-- Zorn's lemma for preorders: a maximal element up to equivalence -/
theorem zorn_pre (ub : ∀ C, Chain pl C → ∃ u, ∀ x, C x → pl x u) : ∃ m, ∀ y, pl m y → pl y m :=
match ub (InCp K pl) (inCp_chain K pl prefl) with
| ⟨u, hu⟩ => ⟨u, fun y huy => dne K _ (fun hn => by
have hy : InCp K pl y := (inCp_eq K pl y).mpr (fun z _ hz =>
⟨ptrans (hu z hz) huy, fun hyz => hn (ptrans hyz (hu z hz))⟩)
exact hn (hu y hy))⟩
end Pre
end ZL
end Found
#print axioms Found.ZL.inC_chain
#print axioms Found.ZL.zorn
#print axioms Found.ZL.zorn_pre
lean_all/found/user/BranchN2.lean
/-
Branch N: from the identity to the triangle, and everything from the triangle.
Core Lean 4, no Mathlib. TR numbers refer to the items of the branch.
found/user/BranchN2 — the axiom-free version of
~/Downloads/The_Totality_Theorem/BranchN.lean (original untouched): same
theorem names and statements, except that the equations between relations
(eq_join_eq, eq_rev, rjoin_eq, eq_rjoin, rrev_rjoin, tri_map_eq, part_join)
are stated pointwise with ↔ instead of = (no funext, no propext), and the
finite checks are closed by kernel computation (rfl) instead of
`decide +kernel`; `act` looks up with a hand-written getD' because core's
List.getD depends on propext.
-/
namespace BranchN
section Relations
variable {A B C : Type}
abbrev Rel (A B : Type) := A → B → Prop
abbrev rjoin (R : Rel A B) (S : Rel B C) : Rel A C := fun x z => ∃ y, R x y ∧ S y z
abbrev rrev (R : Rel A B) : Rel B A := fun y x => R x y
abbrev eqRel (A : Type) : Rel A A := fun x y => x = y
abbrev sub (R S : Rel A B) : Prop := ∀ x y, R x y → S x y
/-! ## TR3, TR4: the triangle for equations -/
theorem tr3 {a x : A} (p : a = x) : p.trans p.symm = rfl := rfl
theorem tr3' {a x : A} (p : a = x) : (rfl : a = a).trans p = p := rfl
/-- TR4: p ; p° ; p = p -/
theorem tr4 {a x : A} (p : a = x) : (p.trans p.symm).trans p = p := rfl
/-! ## TR5, TR6: equality as a relation; join of relations -/
theorem eq_join_eq : ∀ x z : A, rjoin (eqRel A) (eqRel A) x z ↔ eqRel A x z := by
intro x z
constructor
· intro ⟨y, e1, e2⟩
exact e1.trans e2
· intro e
exact ⟨x, rfl, e⟩
theorem eq_rev : ∀ x y : A, rrev (eqRel A) x y ↔ eqRel A x y := by
intro x y
constructor
· intro e
exact e.symm
· intro e
exact e.symm
theorem rjoin_eq (R : Rel A B) : ∀ x z, rjoin R (eqRel B) x z ↔ R x z := by
intro x z
constructor
· intro ⟨y, r, e⟩
exact e ▸ r
· intro r
exact ⟨z, r, rfl⟩
theorem eq_rjoin (R : Rel A B) : ∀ x z, rjoin (eqRel A) R x z ↔ R x z := by
intro x z
constructor
· intro ⟨y, e, r⟩
exact e ▸ r
· intro r
exact ⟨x, rfl, r⟩
theorem rrev_rjoin (R : Rel A B) (S : Rel B C) :
∀ z x, rrev (rjoin R S) z x ↔ rjoin (rrev S) (rrev R) z x := by
intro z x
constructor
· intro ⟨y, r, s⟩
exact ⟨y, s, r⟩
· intro ⟨y, s, r⟩
exact ⟨y, r, s⟩
/-! ## TR7: one half holds for every relation -/
theorem half_always (R : Rel A B) : sub R (rjoin (rjoin R (rrev R)) R) :=
fun x y h => ⟨x, ⟨y, h, h⟩, h⟩
/-- the other half: this is what "having the triangle" asks -/
abbrev Tri (R : Rel A B) : Prop := sub (rjoin (rjoin R (rrev R)) R) R
/-! ## TR8-TR13: maps; unit, counit, the triangle for maps -/
abbrev graphOf (f : A → B) : Rel A B := fun x y => f x = y
/-- TR9: the unit -/
theorem unit_map (f : A → B) : sub (eqRel A) (rjoin (graphOf f) (rrev (graphOf f))) := by
intro x x' e
cases e
exact ⟨f x, rfl, rfl⟩
/-- TR10: the counit -/
theorem counit_map (f : A → B) : sub (rjoin (rrev (graphOf f)) (graphOf f)) (eqRel B) := by
intro y y' h
match h with
| ⟨_, p, q⟩ => exact p.symm.trans q
/-- TR11: the triangle for maps, as the half that is asked -/
theorem tri_map (f : A → B) : Tri (graphOf f) := by
intro x y h
match h with
| ⟨_, ⟨_, p, q⟩, r⟩ => exact p.trans (q.symm.trans r)
/-- TR11: with TR7, the equation -/
theorem tri_map_eq (f : A → B) :
∀ x y, rjoin (rjoin (graphOf f) (rrev (graphOf f))) (graphOf f) x y ↔ graphOf f x y := by
intro x y
constructor
· exact tri_map f x y
· exact half_always (graphOf f) x y
/-- TR13: reversed, it is again a triangle -/
theorem tri_rev (R : Rel A B) (h : Tri R) : Tri (rrev R) := by
intro y x hh
match hh with
| ⟨y', ⟨x', r1, r2⟩, r3⟩ => exact h x y ⟨x', ⟨y', r3, r2⟩, r1⟩
/-! ## TR14-TR17: kernel and image are fixed by join and by reverse -/
abbrev ker (R : Rel A B) : Rel A A := rjoin R (rrev R)
abbrev im (R : Rel A B) : Rel B B := rjoin (rrev R) R
/-- TR15: symmetric -/
theorem ker_symm (R : Rel A B) (x y : A) : ker R x y → ker R y x := by
intro ⟨b, r1, r2⟩
exact ⟨b, r2, r1⟩
/-- TR14: transitive, from the triangle -/
theorem ker_trans (R : Rel A B) (h : Tri R) (x y z : A) :
ker R x y → ker R y z → ker R x z := by
intro ⟨b, r1, r2⟩ ⟨c, r3, r4⟩
exact ⟨c, h x c ⟨y, ⟨b, r1, r2⟩, r3⟩, r4⟩
theorem im_symm (R : Rel A B) (y y' : B) : im R y y' → im R y' y := by
intro ⟨a, r1, r2⟩
exact ⟨a, r2, r1⟩
theorem im_trans (R : Rel A B) (h : Tri R) (y y' y'' : B) :
im R y y' → im R y' y'' → im R y y'' := by
intro ⟨a, r1, r2⟩ ⟨c, r3, r4⟩
exact ⟨a, r1, h a y'' ⟨c, ⟨y', r2, r3⟩, r4⟩⟩
/-- TR22: for a map, the kernel is reflexive (the unit) -/
theorem ker_refl_map (f : A → B) (x : A) : ker (graphOf f) x x := ⟨f x, rfl, rfl⟩
/-- TR16: for a map, the kernel is "f x = f x'" -/
theorem ker_map (f : A → B) (x x' : A) : ker (graphOf f) x x' ↔ f x = f x' := by
constructor
· intro ⟨_, p, q⟩
exact p.trans q.symm
· intro e
exact ⟨f x, rfl, e.symm⟩
/-- TR21: for a map, the image is a part: inside equality (the counit) -/
theorem im_part_map (f : A → B) : sub (im (graphOf f)) (eqRel B) := counit_map f
/-! ## TR18, TR19: a relation with the triangle is an isomorphism kernel → image -/
/-- things the same in the kernel go to the same things -/
theorem ker_respects (R : Rel A B) (h : Tri R) (x x' : A) (y : B) :
ker R x x' → R x y → R x' y := by
intro ⟨b, r1, r2⟩ r
exact h x' y ⟨x, ⟨b, r2, r1⟩, r⟩
/-- and only those -/
theorem ker_exact (R : Rel A B) (x x' : A) (y : B) : R x y → R x' y → ker R x x' :=
fun r r' => ⟨y, r, r'⟩
/-- the values are the same in the image -/
theorem im_exact (R : Rel A B) (x : A) (y y' : B) : R x y → R x y' → im R y y' :=
fun r r' => ⟨x, r, r'⟩
/-- and whatever is the same in the image is also a value -/
theorem im_respects (R : Rel A B) (h : Tri R) (x : A) (y y' : B) :
im R y y' → R x y → R x y' := by
intro ⟨a, r1, r2⟩ r
exact h x y' ⟨a, ⟨y, r, r1⟩, r2⟩
/-! ## TR20-TR23: membership, parts, meet -/
/-- a part, as a relation inside equality -/
abbrev partRel (S : A → Prop) : Rel A A := fun x y => x = y ∧ S x
/-- membership is the diagonal of the part -/
theorem mem_diag (S : A → Prop) (x : A) : partRel S x x ↔ S x :=
⟨fun h => h.2, fun h => ⟨rfl, h⟩⟩
theorem part_le_eq (S : A → Prop) : sub (partRel S) (eqRel A) := fun _ _ h => h.1
/-- TR23: the join of two parts is their meet -/
theorem part_join (S T : A → Prop) :
∀ x y, rjoin (partRel S) (partRel T) x y ↔ partRel (fun x => S x ∧ T x) x y := by
intro x y
constructor
· intro ⟨m, ⟨e1, s⟩, ⟨e2, t⟩⟩
cases e1
cases e2
exact ⟨rfl, s, t⟩
· intro ⟨e, s, t⟩
cases e
exact ⟨x, ⟨rfl, s⟩, ⟨rfl, t⟩⟩
end Relations
/-! ## TR24: inclusion and exclusion, counted -/
def cnt (n : Nat) (p : Nat → Bool) : Nat := ((List.range n).filter p).length
def m2 (x : Nat) : Bool := x % 2 == 0
def m3 (x : Nat) : Bool := x % 3 == 0
def m5 (x : Nat) : Bool := x % 5 == 0
theorem incl_excl_two :
cnt 30 (fun x => m2 x || m3 x) + cnt 30 (fun x => m2 x && m3 x)
= cnt 30 m2 + cnt 30 m3 := rfl
theorem incl_excl_three :
cnt 30 (fun x => m2 x || m3 x || m5 x) + cnt 30 (fun x => m2 x && m3 x)
+ cnt 30 (fun x => m2 x && m5 x) + cnt 30 (fun x => m3 x && m5 x)
= cnt 30 m2 + cnt 30 m3 + cnt 30 m5 + cnt 30 (fun x => m2 x && m3 x && m5 x) :=
rfl
/-- the exclusion of a join of exclusions -/
theorem union_is_excl :
(List.range 30).all (fun x => (m2 x || m3 x) == !((!m2 x) && (!m3 x))) = true :=
rfl
/-! ## TR25-TR32: groups, on the six isomorphisms of three things -/
abbrev Perm := List Nat
def e : Perm := [0, 1, 2]
def s01 : Perm := [1, 0, 2]
def s12 : Perm := [0, 2, 1]
def s02 : Perm := [2, 1, 0]
def c1 : Perm := [1, 2, 0]
def c2 : Perm := [2, 0, 1]
def perms : List Perm := [e, s01, s12, s02, c1, c2]
/-- `List.getD` of core depends on propext, so the lookup is written out here -/
def getD' : List Nat → Nat → Nat → Nat
| [], _, d => d
| a :: _, 0, _ => a
| _ :: l, n + 1, d => getD' l n d
def act (p : Perm) (i : Nat) : Nat := getD' p i 0
/-- join: first q, then p -/
def mul (p q : Perm) : Perm := [0, 1, 2].map (fun i => act p (act q i))
def inv (p : Perm) : Perm := (perms.find? (fun q => mul p q == e)).getD e
def setMul (X Y : List Perm) : List Perm :=
perms.filter (fun z => X.any fun x => Y.any fun y => mul x y == z)
def setInv (X : List Perm) : List Perm := perms.filter (fun z => X.contains (inv z))
def sameSet (X Y : List Perm) : Bool := perms.all (fun z => X.contains z == Y.contains z)
/-- TR25: the laws of a group -/
theorem grp_id : perms.all (fun g => mul e g == g && mul g e == g) = true := rfl
theorem grp_inv : perms.all (fun g => mul g (inv g) == e && mul (inv g) g == e) = true :=
rfl
theorem grp_assoc :
perms.all (fun g => perms.all fun h => perms.all fun k =>
mul (mul g h) k == mul g (mul h k)) = true := rfl
/-- TR4 for a group: g ; g° ; g = g -/
theorem grp_triangle : perms.all (fun g => mul (mul g (inv g)) g == g) = true :=
rfl
/-- the only idempotent is the identity -/
theorem grp_idem : perms.all (fun g => (mul g g != g) || (g == e)) = true := rfl
/-- two exchanges that share a place do not commute -/
theorem not_abelian : mul s01 s12 ≠ mul s12 s01 := fun h =>
have h' : (1 : Nat) = 2 := congrArg (fun l : List Nat => getD' l 0 0) h
Nat.noConfusion (Nat.succ.inj h')
theorem braid : mul s01 (mul s12 s01) = mul s12 (mul s01 s12) := rfl
/-- TR28: a subgroup is fixed by reverse and by join -/
def H : List Perm := [e, s01]
def A3 : List Perm := [e, c1, c2]
theorem H_rev : sameSet (setInv H) H = true := rfl
theorem H_join : sameSet (setMul H H) H = true := rfl
theorem A3_rev : sameSet (setInv A3) A3 = true := rfl
theorem A3_join : sameSet (setMul A3 A3) A3 = true := rfl
/-- TR27: every class has the triangle, and X° ; X is the subgroup -/
theorem class_triangle :
perms.all (fun g =>
sameSet (setMul (setMul (setMul [g] H) (setInv (setMul [g] H))) (setMul [g] H))
(setMul [g] H)) = true := rfl
theorem class_gives_subgroup :
perms.all (fun g => sameSet (setMul (setInv (setMul [g] H)) (setMul [g] H)) H) = true :=
rfl
/-- TR29: all classes have as many things as H, and 6 = 3 · 2 -/
theorem class_size : perms.all (fun g => (setMul [g] H).length == H.length) = true :=
rfl
theorem lagrange : perms.length = 3 * H.length := rfl
/-- TR30: A3 is normal and its classes are a group; H is not normal -/
theorem A3_normal :
perms.all (fun g => sameSet (setMul [g] A3) (setMul A3 [g])) = true := rfl
theorem H_not_normal :
perms.all (fun g => sameSet (setMul [g] H) (setMul H [g])) = false := rfl
theorem quotient_join :
perms.all (fun g => perms.all fun g' =>
sameSet (setMul (setMul [g] A3) (setMul [g'] A3)) (setMul [mul g g'] A3)) = true :=
rfl
/-- TR31: a map of groups to the two values; its kernel is A3 -/
def sgn (p : Perm) : Nat := if A3.contains p then 0 else 1
theorem sgn_keeps_join :
perms.all (fun g => perms.all fun h => sgn (mul g h) == (sgn g + sgn h) % 2) = true :=
rfl
theorem sgn_kernel : sameSet (perms.filter (fun g => sgn g == 0)) A3 = true :=
rfl
/-- G / K has as many things as the image -/
theorem first_iso_count :
perms.length = A3.length * ((List.range 2).filter (fun v => perms.any fun g => sgn g == v)).length :=
rfl
/-- TR32: orbit and the part fixing a thing -/
def orbit0 : List Nat := (List.range 3).filter (fun j => perms.any fun g => act g 0 == j)
def fix0 : List Perm := perms.filter (fun g => act g 0 == 0)
theorem orbit_stabilizer : perms.length = orbit0.length * fix0.length := rfl
theorem fix0_is_subgroup :
(sameSet (setInv fix0) fix0 && sameSet (setMul fix0 fix0) fix0) = true := rfl
end BranchN
#print axioms BranchN.tr3
#print axioms BranchN.tr3'
#print axioms BranchN.tr4
#print axioms BranchN.eq_join_eq
#print axioms BranchN.eq_rev
#print axioms BranchN.rjoin_eq
#print axioms BranchN.eq_rjoin
#print axioms BranchN.rrev_rjoin
#print axioms BranchN.half_always
#print axioms BranchN.unit_map
#print axioms BranchN.counit_map
#print axioms BranchN.tri_map
#print axioms BranchN.tri_map_eq
#print axioms BranchN.tri_rev
#print axioms BranchN.ker_symm
#print axioms BranchN.ker_trans
#print axioms BranchN.im_symm
#print axioms BranchN.im_trans
#print axioms BranchN.ker_refl_map
#print axioms BranchN.ker_map
#print axioms BranchN.im_part_map
#print axioms BranchN.ker_respects
#print axioms BranchN.ker_exact
#print axioms BranchN.im_exact
#print axioms BranchN.im_respects
#print axioms BranchN.mem_diag
#print axioms BranchN.part_le_eq
#print axioms BranchN.part_join
#print axioms BranchN.incl_excl_two
#print axioms BranchN.incl_excl_three
#print axioms BranchN.union_is_excl
#print axioms BranchN.grp_id
#print axioms BranchN.grp_inv
#print axioms BranchN.grp_assoc
#print axioms BranchN.grp_triangle
#print axioms BranchN.grp_idem
#print axioms BranchN.not_abelian
#print axioms BranchN.braid
#print axioms BranchN.H_rev
#print axioms BranchN.H_join
#print axioms BranchN.A3_rev
#print axioms BranchN.A3_join
#print axioms BranchN.class_triangle
#print axioms BranchN.class_gives_subgroup
#print axioms BranchN.class_size
#print axioms BranchN.lagrange
#print axioms BranchN.A3_normal
#print axioms BranchN.H_not_normal
#print axioms BranchN.quotient_join
#print axioms BranchN.sgn_keeps_join
#print axioms BranchN.sgn_kernel
#print axioms BranchN.first_iso_count
#print axioms BranchN.orbit_stabilizer
#print axioms BranchN.fix0_is_subgroup
lean_all/found/user/IdChain.lean
/-
IdChain.lean
One chain: id → diagonal → readings → triangles → adjunction →
idempotent / sameness → functions → K, S → composition (last, as a
branch) → relations → kernel → Yoneda step.
Lean 4 core only. No imports. No axioms (see the #print axioms block
at the end). Until Link 12 the only operation used is application.
-/
namespace IdChain
/-! ## Link 1: the identity -/
def idf {A : Type} (x : A) : A := x
theorem id_app {A : Type} (x : A) : idf x = x := rfl
/-! ## Link 2 (from 1): the diagonal -/
structure Pair (A B : Type) where
fst : A
snd : B
def diag {A : Type} (x : A) : Pair A A := Pair.mk x x
/-! ## Link 3 (from 2): the two readings -/
def p1 {A B : Type} (p : Pair A B) : A := p.fst
def p2 {A B : Type} (p : Pair A B) : B := p.snd
theorem p1_mk {A B : Type} (x : A) (y : B) : p1 (Pair.mk x y) = x := rfl
theorem p2_mk {A B : Type} (x : A) (y : B) : p2 (Pair.mk x y) = y := rfl
/-! ## Link 4 (from 2, 3): the first triangle -/
theorem tri1 {A : Type} (x : A) : p1 (diag x) = idf x := rfl
theorem tri1_right {A : Type} (x : A) : p2 (diag x) = idf x := rfl
/-! ## Link 5 (from 3): the second triangle and pairs -/
def e {A B : Type} (p : Pair A B) : Pair A B := Pair.mk (p1 p) (p2 p)
theorem e_idem {A B : Type} (p : Pair A B) : e (e p) = e p := rfl
/-- Every pair is fixed by `e`. -/
theorem e_fix {A B : Type} (p : Pair A B) : e p = p := rfl
/-- Extensionality of pairs, for every pair. -/
theorem pair_ext {A B : Type} (p : Pair A B) : p = Pair.mk (p1 p) (p2 p) := rfl
/-! ## Link 6 (from 4, 5): the adjunction (names only) -/
def eta1 {A : Type} : A → Pair A A := diag
/-- Triangle 1: make, then read. -/
theorem adj_tri1 {A : Type} (x : A) : p1 (eta1 x) = x := rfl
/-- Triangle 2: p ↦ (p, p) ↦ (π₁ p, π₂ p) = p. -/
theorem adj_tri2 {A B : Type} (p : Pair A B) :
Pair.mk (p1 (p1 (eta1 p))) (p2 (p2 (eta1 p))) = p := rfl
/-! ## Link 7 (from 4): idempotent, sameness, swap -/
def e1 {A : Type} (p : Pair A A) : Pair A A := diag (p1 p)
theorem e1_idem {A : Type} (p : Pair A A) : e1 (e1 p) = e1 p := rfl
/-- Sameness: the pair `(x, y)` is fixed by `e1`. -/
abbrev E {A : Type} (x y : A) : Prop := e1 (Pair.mk x y) = Pair.mk x y
theorem E_refl {A : Type} (x : A) : E x x := Eq.refl (Pair.mk x x)
theorem E_to_eq {A : Type} {x y : A} (h : E x y) : x = y := congrArg p2 h
theorem E_of_eq {A : Type} {x y : A} (h : x = y) : E x y :=
congrArg (fun t => Pair.mk x t) h
def sw {A B : Type} (p : Pair A B) : Pair B A := Pair.mk (p2 p) (p1 p)
theorem sw_sw {A B : Type} (p : Pair A B) : sw (sw p) = p := rfl
theorem sw_diag {A : Type} (x : A) : sw (diag x) = diag x := rfl
/-! ## Link 8 (from 7): transport, reversal, joining, application -/
/-- Transport: Q(y) = Q(π₂(x,y)) = Q(π₂(x,x)) = Q(x). -/
theorem transport {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q y) : Q x :=
Eq.mpr (congrArg (fun p => Q (p2 p)) h) q
theorem transport' {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q x) : Q y :=
Eq.mp (congrArg (fun p => Q (p2 p)) h) q
/-- The swap step of the reversal: σ(x,x) = σ(x,y). -/
theorem sw_step {A : Type} {x y : A} (h : E x y) : Pair.mk x x = Pair.mk y x :=
congrArg sw h
theorem E_symm {A : Type} {x y : A} (h : E x y) : E y x :=
transport (fun t => E y t) h (E_refl y)
theorem E_trans {A : Type} {x y z : A} (h1 : E x y) (h2 : E y z) : E x z :=
transport (fun t => E t z) h1 h2
theorem E_app {A B : Type} (f : A → B) {x y : A} (h : E x y) : E (f x) (f y) :=
transport' (fun t => E (f x) (f t)) h (E_refl (f x))
/-! ## Link 9 (from 6): one place held open -/
def unit2 {C A : Type} (c : C) (a : A) : Pair C A := Pair.mk c a
def ev {A B : Type} (p : Pair (A → B) A) : B := (p1 p) (p2 p)
/-- Triangle 1: ε(η(c), a) = (c, a). -/
theorem fn_tri1 {C A : Type} (c : C) (a : A) :
ev (Pair.mk (unit2 c) a) = Pair.mk c a := rfl
/-- Triangle 2: (a ↦ ε(f, a)) = f. Extensionality of functions, for every function. -/
theorem fn_tri2 {A B : Type} (f : A → B) : (fun a => ev (Pair.mk f a)) = f := rfl
/-! ## Link 10 (from 9): the correspondence -/
def phi {C A B : Type} (k : Pair C A → B) (c : C) (a : A) : B := k (Pair.mk c a)
def psi {C A B : Type} (h : C → A → B) (p : Pair C A) : B := h (p1 p) (p2 p)
theorem psi_phi {C A B : Type} (k : Pair C A → B) : psi (phi k) = k := rfl
theorem phi_psi {C A B : Type} (h : C → A → B) : phi (psi h) = h := rfl
/-! ## Link 11 (from 2, 3, 9): K and S -/
/-- K: read the left place of η(x)(y). -/
def K {A B : Type} (x : A) (y : B) : A := p1 (unit2 x y)
/-- S: use x twice through the diagonal, then apply with ε. -/
def S {A B C : Type} (f : A → B → C) (g : A → B) (x : A) : C :=
ev (Pair.mk (f (p1 (diag x))) (g (p2 (diag x))))
theorem K_app {A B : Type} (x : A) (y : B) : K x y = x := rfl
theorem S_app {A B C : Type} (f : A → B → C) (g : A → B) (x : A) :
S f g x = f x (g x) := rfl
theorem SKK_app {A : Type} (x : A) :
@S A (A → A) A (@K A (A → A)) (@K A A) x = idf x := rfl
theorem SKK {A : Type} :
@S A (A → A) A (@K A (A → A)) (@K A A) = @idf A := rfl
/-! ## Link 12 (from 11): composition, as a branch -/
/-- B := S (K S) K. -/
def Bc {A M C : Type} : (M → C) → (A → M) → A → C :=
@S (M → C) (A → M → C) ((A → M) → A → C)
(@K ((A → M → C) → (A → M) → A → C) (M → C) (@S A M C))
(@K (M → C) A)
theorem Bc_app {A M C : Type} (g : M → C) (f : A → M) (x : A) :
Bc g f x = g (f x) := rfl
def comp {A M C : Type} (g : M → C) (f : A → M) : A → C := Bc g f
theorem comp_id_left {A B : Type} (f : A → B) : comp idf f = f := rfl
theorem comp_id_right {A B : Type} (f : A → B) : comp f idf = f := rfl
theorem comp_assoc {A B C D : Type} (h : C → D) (g : B → C) (f : A → B) :
comp (comp h g) f = comp h (comp g f) := rfl
/-- The earlier links, rewritten with composition. -/
theorem tri1_comp {A : Type} : comp (@p1 A A) (@diag A) = @idf A := rfl
theorem e1_comp {A : Type} : @e1 A = comp (@diag A) (@p1 A A) := rfl
theorem e1_idem_comp {A : Type} : comp (@e1 A) (@e1 A) = @e1 A := rfl
theorem sw_sw_comp {A B : Type} : comp (@sw B A) (@sw A B) = @idf (Pair A B) := rfl
/-! ## Link 13 (from 7, 8): composition of relations -/
abbrev rcomp {A M C : Type} (R : A → M → Prop) (T : M → C → Prop)
(a : A) (c : C) : Prop :=
∃ b, R a b ∧ T b c
theorem unit_left {A C : Type} (R : A → C → Prop) (a : A) (c : C) :
rcomp E R a c ↔ R a c :=
Iff.intro
(fun h => match h with
| ⟨_, hab, hr⟩ => transport (fun t => R t c) hab hr)
(fun r => ⟨a, E_refl a, r⟩)
theorem unit_right {A C : Type} (R : A → C → Prop) (a : A) (c : C) :
rcomp R E a c ↔ R a c :=
Iff.intro
(fun h => match h with
| ⟨_, hr, hbc⟩ => transport' (fun t => R a t) hbc hr)
(fun r => ⟨c, r, E_refl c⟩)
theorem rcomp_assoc {A B C D : Type}
(R : A → B → Prop) (T : B → C → Prop) (U : C → D → Prop) (a : A) (d : D) :
rcomp (rcomp R T) U a d ↔ rcomp R (rcomp T U) a d :=
Iff.intro
(fun h => match h with
| ⟨c, ⟨b, r, t⟩, u⟩ => ⟨b, r, ⟨c, t, u⟩⟩)
(fun h => match h with
| ⟨b, r, ⟨c, t, u⟩⟩ => ⟨c, ⟨b, r, t⟩, u⟩)
/-! ## Link 14 (from 13): the kernel of a function -/
abbrev conv {A B : Type} (R : A → B → Prop) (b : B) (a : A) : Prop := R a b
abbrev rle {A B : Type} (R T : A → B → Prop) : Prop := ∀ a b, R a b → T a b
abbrev ker {A B : Type} (f : A → B → Prop) : A → A → Prop := rcomp f (conv f)
/-- k;k ≤ k, from "the value is one" (f°;f ≤ E). -/
theorem ker_sub {A B : Type} (f : A → B → Prop)
(single : rle (rcomp (conv f) f) E) :
rle (rcomp (ker f) (ker f)) (ker f) :=
fun _ a'' h => match h with
| ⟨a', ⟨b, hab, ha'b⟩, ⟨b', ha'b', ha''b'⟩⟩ =>
⟨b, hab,
transport (fun t => f a'' t) (single b b' ⟨a', ha'b, ha'b'⟩) ha''b'⟩
/-- k ≤ k;k. -/
theorem ker_sup {A B : Type} (f : A → B → Prop) :
rle (ker f) (rcomp (ker f) (ker f)) :=
fun _ a' h => match h with
| ⟨b, hab, ha'b⟩ => ⟨a', ⟨b, hab, ha'b⟩, ⟨b, ha'b, ha'b⟩⟩
/-- The kernel is symmetric. -/
theorem ker_symm {A B : Type} (f : A → B → Prop) (a a' : A) :
ker f a a' → ker f a' a :=
fun h => match h with
| ⟨b, hab, ha'b⟩ => ⟨b, ha'b, hab⟩
/-- E ≤ k, from "a value exists". -/
theorem ker_refl {A B : Type} (f : A → B → Prop) (tot : ∀ a, ∃ b, f a b) :
rle E (ker f) :=
fun a _ h => match tot a with
| ⟨b, hab⟩ => ⟨b, hab, transport' (fun t => f t b) h hab⟩
/-! ## Link 15 (from 12): the Yoneda step -/
/-- The value at the identity fixes the value at every arrow. -/
theorem yoneda
(F : Type → Type)
(map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(A : Type)
(α : ∀ X : Type, (A → X) → F X)
(nat : ∀ (X Y : Type) (g : X → Y) (h : A → X),
α Y (comp g h) = map X Y g (α X h))
(X : Type) (f : A → X) :
α X f = map A X f (α A idf) :=
nat A X f idf
/-- Back: every `x : F A` gives such a family, and its value at the identity is `x`. -/
theorem yoneda_back
(F : Type → Type)
(map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(map_id : ∀ (X : Type) (x : F X), map X X idf x = x)
(map_comp : ∀ (X Y Z : Type) (g : Y → Z) (h : X → Y) (x : F X),
map X Z (comp g h) x = map Y Z g (map X Y h x))
(A : Type) (x : F A) :
(∀ (X Y : Type) (g : X → Y) (h : A → X),
map A Y (comp g h) x = map X Y g (map A X h x))
∧ map A A idf x = x :=
⟨fun X Y g h => map_comp A X Y g h x, map_id A x⟩
/-! ## Axiom check -/
#print axioms tri1
#print axioms pair_ext
#print axioms adj_tri2
#print axioms e1_idem
#print axioms E_symm
#print axioms E_trans
#print axioms E_app
#print axioms fn_tri2
#print axioms psi_phi
#print axioms phi_psi
#print axioms SKK
#print axioms Bc_app
#print axioms comp_assoc
#print axioms e1_idem_comp
#print axioms unit_left
#print axioms unit_right
#print axioms rcomp_assoc
#print axioms ker_sub
#print axioms ker_sup
#print axioms ker_refl
#print axioms yoneda
#print axioms yoneda_back
end IdChain
lean_all/found/user/OneChain2.lean
/-
OneChain.lean
From a = a to the numbers: core Lean 4 only (no Mathlib, no imports).
No `axiom`, no `sorry`, no `propext`, no `Classical`, no `Quot.sound`,
no `funext`. The `#print axioms` lines at the end report this.
Sections 1-9: a = a, composition, N, Z, words. Sections 10-12: D, I, R.
-/
universe u
/-! ## 1. Pairs and the diagonal -/
section Diagonal
variable {α : Type u}
def diag (a : α) : α × α := (a, a)
theorem fst_diag (a : α) : (diag a).1 = a := rfl
theorem snd_diag (a : α) : (diag a).2 = a := rfl
end Diagonal
/-! ## 2. (J): the only equal pairs are the diagonal pairs -/
inductive Path {α : Type u} (a : α) : α → Type u where
| refl : Path a a
namespace Path
variable {α : Type u}
/-- (J): everything equal to `a` is the one point `(a, refl)`. -/
theorem contract (a x : α) (p : Path a x) :
(Sigma.mk x p : Sigma (fun y => Path a y)) = Sigma.mk a Path.refl := by
cases p; rfl
/-! ## 3. Composition of equalities, with its laws -/
def carry {P : α → Type u} {a x : α} : Path a x → P a → P x
| .refl, h => h
def trans {a b c : α} : Path a b → Path b c → Path a c
| p, .refl => p
def symm {a b : α} : Path a b → Path b a
| .refl => .refl
theorem trans_refl {a b : α} (p : Path a b) : trans p .refl = p := rfl
theorem refl_trans {a b : α} (q : Path a b) : trans .refl q = q := by
cases q; rfl
theorem trans_assoc {a b c d : α} (p : Path a b) (q : Path b c) (r : Path c d) :
trans (trans p q) r = trans p (trans q r) := by
cases r; rfl
theorem trans_symm {a b : α} (p : Path a b) : trans p (symm p) = .refl := by
cases p; rfl
end Path
/-! ## 3'. Composition of relations: match the middle, then forget it -/
section Relations
variable {α β γ δ : Type u}
/-- Unit law: putting the diagonal in the middle changes nothing. -/
theorem comp_unit (R : α → β → Prop) (a : α) (c : β) :
(∃ b, a = b ∧ R b c) ↔ R a c :=
⟨fun ⟨_, h, r⟩ => by cases h; exact r, fun r => ⟨a, rfl, r⟩⟩
theorem comp_assoc (R : α → β → Prop) (S : β → γ → Prop) (T : γ → δ → Prop)
(a : α) (d : δ) :
(∃ c, (∃ b, R a b ∧ S b c) ∧ T c d) ↔ (∃ b, R a b ∧ ∃ c, S b c ∧ T c d) :=
⟨fun ⟨c, ⟨b, r, s⟩, t⟩ => ⟨b, r, c, s, t⟩,
fun ⟨b, r, c, s, t⟩ => ⟨c, ⟨b, r, s⟩, t⟩⟩
/-- Composition of arrows is computed, not assumed: `(g ∘ f) a = g (f a)`. -/
theorem comp_arrows (f : α → β) (g : β → γ) (a : α) (c : γ) :
(∃ b, f a = b ∧ g b = c) ↔ g (f a) = c :=
⟨fun ⟨_, h, k⟩ => by cases h; exact k, fun k => ⟨f a, rfl, k⟩⟩
/-- The diagonal lies in every kernel. -/
theorem diag_le_ker (f : α → β) (x : α) : f x = f x := rfl
end Relations
/-! ## 4. Sum: the two parts do not meet; `0` is the negation of `a = a` -/
section SumZero
variable {α β : Type u}
theorem inl_ne_inr (a : α) (b : β) : (Sum.inl a : Sum α β) ≠ Sum.inr b :=
fun h => nomatch h
theorem inr_inj {b b' : β} (h : (Sum.inr b : Sum α β) = Sum.inr b') : b = b' :=
Sum.inr.inj h
theorem not_not_refl (a : α) : ¬ ¬ (a = a) := fun h => h rfl
end SumZero
/-! ## 5. One loop: ℕ, recursion, induction -/
inductive N where
| z : N
| s : N → N
namespace N
/-- Recursion: the "there is" of (U). -/
def iter {X : Type u} (x0 : X) (e : X → X) : N → X
| .z => x0
| .s n => e (iter x0 e n)
/-- The "exactly one" of (U). -/
theorem iter_unique {X : Type u} (x0 : X) (e : X → X) (h : N → X)
(h0 : h N.z = x0) (hs : ∀ n, h (N.s n) = e (h n)) :
∀ n, h n = iter x0 e n := by
intro n
induction n with
| z => exact h0
| s n ih => exact (hs n).trans (congrArg e ih)
/-- Induction. -/
theorem ind (P : N → Prop) (h0 : P N.z) (hs : ∀ n, P n → P (N.s n)) :
∀ n, P n := by
intro n
induction n with
| z => exact h0
| s n ih => exact hs n ih
/-- `[0, S] : 1 + ℕ → ℕ` and its inverse (the least kind is fixed). -/
def unpred : Sum Unit N → N
| .inl _ => N.z
| .inr n => N.s n
def pred : N → Sum Unit N
| .z => .inl ()
| .s n => .inr n
theorem pred_unpred (x : Sum Unit N) : pred (unpred x) = x := by
cases x <;> rfl
theorem unpred_pred (n : N) : unpred (pred n) = n := by
cases n <;> rfl
/-- `S n ≠ 0`, read off a map into `1 + 1`. -/
def isS : N → Sum Unit Unit :=
iter (X := Sum Unit Unit) (Sum.inl ()) (fun _ => Sum.inr ())
theorem s_ne_z (n : N) : N.s n ≠ N.z :=
fun h =>
have h' : (Sum.inr () : Sum Unit Unit) = Sum.inl () := congrArg isS h
nomatch h'
/-- The kernel of `S` is the diagonal, read off `pred`. -/
theorem s_inj {m n : N} (h : N.s m = N.s n) : m = n :=
have h' : (Sum.inr m : Sum Unit N) = Sum.inr n := congrArg pred h
Sum.inr.inj h'
/-! ## 6. Sum is composition: `add m n = S^m n` -/
def add (m n : N) : N := iter n N.s m
theorem z_add (n : N) : add N.z n = n := rfl
theorem s_add (m n : N) : add (N.s m) n = N.s (add m n) := rfl
theorem add_z (m : N) : add m N.z = m := by
induction m with
| z => rfl
| s m ih => exact congrArg N.s ih
theorem add_s (m n : N) : add m (N.s n) = N.s (add m n) := by
induction m with
| z => rfl
| s m ih => exact congrArg N.s ih
theorem add_comm (m n : N) : add m n = add n m := by
induction m with
| z => exact (add_z n).symm
| s m ih => exact (congrArg N.s ih).trans (add_s n m).symm
theorem add_assoc (a b c : N) : add (add a b) c = add a (add b c) := by
induction a with
| z => rfl
| s a ih => exact congrArg N.s ih
theorem add_left_comm (a b c : N) : add a (add b c) = add b (add a c) :=
(add_assoc a b c).symm.trans
((congrArg (fun t => add t c) (add_comm a b)).trans (add_assoc b a c))
theorem add_right_cancel {a b : N} (c : N) (h : add a c = add b c) : a = b := by
induction c with
| z => exact (add_z a).symm.trans (h.trans (add_z b))
| s c ih =>
exact ih (s_inj ((add_s a c).symm.trans (h.trans (add_s b c))))
/-! ## 7. Product is iterated sum: `mul m n = (n + ·)^m 0` -/
def mul (m n : N) : N := iter N.z (add n) m
theorem z_mul (n : N) : mul N.z n = N.z := rfl
theorem s_mul (m n : N) : mul (N.s m) n = add n (mul m n) := rfl
theorem mul_z (m : N) : mul m N.z = N.z := by
induction m with
| z => rfl
| s m ih => exact ih
theorem mul_s (m n : N) : mul m (N.s n) = add m (mul m n) := by
induction m with
| z => rfl
| s m ih =>
exact (congrArg (fun t => N.s (add n t)) ih).trans
(congrArg N.s (add_left_comm n m (mul m n)))
theorem mul_comm (m n : N) : mul m n = mul n m := by
induction m with
| z => exact (mul_z n).symm
| s m ih => exact (congrArg (add n) ih).trans (mul_s n m).symm
/-- Distributivity. -/
theorem add_mul (a b c : N) : mul (add a b) c = add (mul a c) (mul b c) := by
induction a with
| z => rfl
| s a ih =>
exact (congrArg (add c) ih).trans (add_assoc c (mul a c) (mul b c)).symm
theorem mul_assoc (a b c : N) : mul (mul a b) c = mul a (mul b c) := by
induction a with
| z => rfl
| s a ih =>
exact (add_mul b (mul a b) c).trans (congrArg (add (mul b c)) ih)
/-- Powers: iterate the product. -/
def num : Nat → N
| 0 => N.z
| k + 1 => N.s (num k)
def pow (m n : N) : N := iter (num 1) (mul m) n
example : add (num 2) (num 3) = num 5 := rfl
example : mul (num 3) (num 2) = num 6 := rfl
example : mul (num 2) (num 3) = num 6 := rfl
example : mul (num 2) (add (num 1) (num 2)) = num 6 := rfl
example : pow (num 2) (num 3) = num 8 := rfl
end N
/-! ## 8. ℤ: pairs up to the kernel of the difference -/
namespace Z
open N
abbrev rel (p q : N × N) : Prop := add p.1 q.2 = add q.1 p.2
theorem rel_refl (p : N × N) : rel p p := rfl
theorem rel_symm {p q : N × N} (h : rel p q) : rel q p := h.symm
theorem add_swap (a b c d : N) :
add (add a b) (add c d) = add (add a d) (add c b) :=
have e1 : add b (add c d) = add d (add c b) :=
(congrArg (add b) (N.add_comm c d)).trans
((N.add_left_comm b d c).trans (congrArg (add d) (N.add_comm b c)))
(N.add_assoc a b (add c d)).trans
((congrArg (add a) e1).trans (N.add_assoc a d (add c b)).symm)
/-- Transitivity: add the two equations and cancel. -/
theorem rel_trans {p q r : N × N} (h1 : rel p q) (h2 : rel q r) : rel p r :=
have k : add (add p.1 r.2) (add q.1 q.2) = add (add r.1 p.2) (add q.1 q.2) :=
(add_swap p.1 r.2 q.1 q.2).trans
((congrArg (fun t => add t (add q.1 r.2)) h1).trans
((congrArg (add (add q.1 p.2)) h2).trans
((N.add_comm (add q.1 p.2) (add r.1 q.2)).trans
(add_swap r.1 q.2 q.1 p.2))))
N.add_right_cancel (add q.1 q.2) k
def zadd (p q : N × N) : N × N := (add p.1 q.1, add p.2 q.2)
def zmul (p q : N × N) : N × N :=
(add (mul p.1 q.1) (mul p.2 q.2), add (mul p.1 q.2) (mul p.2 q.1))
/-- `2 + (-3) = -1`. -/
example : rel (zadd (num 2, num 0) (num 0, num 3)) (num 0, num 1) := rfl
/-- `(-1)(-1) = 1`. -/
example : zmul (num 0, num 1) (num 0, num 1) = (num 1, num 0) := rfl
/-- `(-2) · 3 = -6`. -/
example : zmul (num 0, num 2) (num 3, num 0) = (num 0, num 6) := rfl
end Z
/-! ## 9. The greatest kind for `2 × X`: words without end -/
namespace Word
open N
abbrev W := N → Bool
def head (w : W) : Bool := w N.z
def tail (w : W) : W := fun n => w (N.s n)
theorem iter_shift {X : Type u} (x0 : X) (e : X → X) (n : N) :
iter (e x0) e n = e (iter x0 e n) := by
induction n with
| z => rfl
| s n ih => exact congrArg e ih
/-- The one map into the greatest kind. -/
def unfold {X : Type u} (c : X → Bool × X) (x : X) : W :=
fun n => (c (iter x (fun y => (c y).2) n)).1
theorem unfold_head {X : Type u} (c : X → Bool × X) (x : X) :
head (unfold c x) = (c x).1 := rfl
theorem unfold_tail {X : Type u} (c : X → Bool × X) (x : X) (n : N) :
tail (unfold c x) n = unfold c (c x).2 n :=
congrArg (fun y => (c y).1) (iter_shift x (fun y => (c y).2) n).symm
/-- It is the only one: any map that reads the same digit and goes on
agrees with it at every place. -/
theorem unfold_unique {X : Type u} (c : X → Bool × X) (k : X → W)
(hh : ∀ x, head (k x) = (c x).1)
(ht : ∀ x n, tail (k x) n = k (c x).2 n) :
∀ n x, k x n = unfold c x n := by
intro n
induction n with
| z => intro x; exact hh x
| s n ih =>
intro x
exact (ht x n).trans ((ih (c x).2).trans (unfold_tail c x n).symm)
/-- `not` has no fixed point. -/
theorem not_ne (b : Bool) : (!b) ≠ b := by
cases b
· intro h; exact Bool.noConfusion (h : true = false)
· intro h; exact Bool.noConfusion (h : false = true)
/-- The diagonal: no list of words contains every word. -/
theorem diagonal (e : N → W) : ∀ n, (fun m => !(e m m)) ≠ e n :=
fun n h => not_ne (e n n) (congrFun h n)
end Word
/-! ## 10. D: doubling inverted (the least side of gluing) -/
namespace N
theorem iter_shift {X : Type u} (x0 : X) (e : X → X) (n : N) :
iter (e x0) e n = e (iter x0 e n) := by
induction n with
| z => rfl
| s n ih => exact congrArg e ih
theorem add4 (a b c d : N) :
add (add a b) (add c d) = add (add a c) (add b d) :=
(add_assoc a b (add c d)).trans
((congrArg (add a) (add_left_comm b c d)).trans
(add_assoc a c (add b d)).symm)
/-- Doubling: reading one `s` as `s ∘ s`. -/
def dbl (n : N) : N := add n n
theorem dbl_s (a : N) : dbl (N.s a) = N.s (N.s (dbl a)) :=
congrArg N.s (add_s a a)
theorem dbl_add (a b : N) : dbl (add a b) = add (dbl a) (dbl b) :=
add4 a b a b
theorem dbl_inj {a b : N} (h : dbl a = dbl b) : a = b := by
induction a generalizing b with
| z =>
cases b with
| z => rfl
| s b =>
have e : N.s (N.s (dbl b)) = N.z := (dbl_s b).symm.trans h.symm
exact absurd e (s_ne_z _)
| s a ih =>
cases b with
| z =>
have e : N.s (N.s (dbl a)) = N.z := (dbl_s a).symm.trans h
exact absurd e (s_ne_z _)
| s b =>
have e : N.s (N.s (dbl a)) = N.s (N.s (dbl b)) :=
(dbl_s a).symm.trans (h.trans (dbl_s b))
exact congrArg N.s (ih (s_inj (s_inj e)))
/-- `sh m k` is `k` doubled `m` times: the point `k` seen `m` levels up. -/
def sh (m k : N) : N := iter k dbl m
theorem sh_dbl (m k : N) : sh m (dbl k) = dbl (sh m k) := iter_shift k dbl m
theorem sh_add (m a b : N) : sh m (add a b) = add (sh m a) (sh m b) := by
induction m with
| z => rfl
| s m ih => exact (congrArg dbl ih).trans (dbl_add (sh m a) (sh m b))
theorem sh_sh (m n k : N) : sh m (sh n k) = sh (add m n) k := by
induction m with
| z => rfl
| s m ih => exact congrArg dbl ih
theorem sh_comm (m n k : N) : sh m (sh n k) = sh n (sh m k) :=
(sh_sh m n k).trans
((congrArg (fun t => sh t k) (add_comm m n)).trans (sh_sh n m k).symm)
theorem sh_inj (m : N) {a b : N} (h : sh m a = sh m b) : a = b := by
induction m with
| z => exact h
| s m ih => exact ih (dbl_inj h)
theorem dbl_mul (a b : N) : mul (dbl a) b = dbl (mul a b) := add_mul a a b
theorem mul_dbl (a b : N) : mul a (dbl b) = dbl (mul a b) :=
(mul_comm a (dbl b)).trans
((dbl_mul b a).trans (congrArg dbl (mul_comm b a)))
theorem sh_mul (m a b : N) : mul (sh m a) b = sh m (mul a b) := by
induction m with
| z => rfl
| s m ih => exact (dbl_mul (sh m a) b).trans (congrArg dbl ih)
theorem mul_sh (m a b : N) : mul a (sh m b) = sh m (mul a b) := by
induction m with
| z => rfl
| s m ih => exact (mul_dbl a (sh m b)).trans (congrArg dbl ih)
end N
namespace D
open N
/-- A dyadic point `k / 2^n` is the pair `(k, n)`; the kernel says
`k / 2^n = j / 2^m` when `k · 2^m = j · 2^n`. -/
abbrev rel (x y : N × N) : Prop := sh y.2 x.1 = sh x.2 y.1
theorem rel_refl (x : N × N) : rel x x := rfl
theorem rel_symm {x y : N × N} (h : rel x y) : rel y x := h.symm
theorem rel_trans {x y w : N × N} (h1 : rel x y) (h2 : rel y w) : rel x w :=
sh_inj y.2
((sh_comm y.2 w.2 x.1).trans
((congrArg (sh w.2) h1).trans
((sh_comm w.2 x.2 y.1).trans
((congrArg (sh x.2) h2).trans (sh_comm x.2 y.2 w.1)))))
/-- `k / 2^n = 2k / 2^(n+1)`: the same point one level up. -/
theorem rel_up (k n : N) : rel (k, n) (dbl k, N.s n) := (sh_dbl n k).symm
def double (x : N × N) : N × N := (dbl x.1, x.2)
def half (x : N × N) : N × N := (x.1, N.s x.2)
/-- Halving is the inverse of doubling. -/
theorem double_half (x : N × N) : rel (double (half x)) x := sh_dbl x.2 x.1
theorem half_double (x : N × N) : rel (half (double x)) x := sh_dbl x.2 x.1
def dadd (x y : N × N) : N × N :=
(add (sh y.2 x.1) (sh x.2 y.1), add x.2 y.2)
def dmul (x y : N × N) : N × N := (mul x.1 y.1, add x.2 y.2)
theorem dadd_comm (x y : N × N) : dadd x y = dadd y x :=
(congrArg (fun t => (t, add x.2 y.2)) (N.add_comm (sh y.2 x.1) (sh x.2 y.1))).trans
(congrArg (fun t => (add (sh x.2 y.1) (sh y.2 x.1), t)) (N.add_comm x.2 y.2))
theorem dmul_comm (x y : N × N) : dmul x y = dmul y x :=
(congrArg (fun t => (t, add x.2 y.2)) (N.mul_comm x.1 y.1)).trans
(congrArg (fun t => (mul y.1 x.1, t)) (N.add_comm x.2 y.2))
theorem dmul_assoc (x y w : N × N) : dmul (dmul x y) w = dmul x (dmul y w) :=
(congrArg (fun t => (t, add (add x.2 y.2) w.2)) (N.mul_assoc x.1 y.1 w.1)).trans
(congrArg (fun t => (mul x.1 (mul y.1 w.1), t)) (N.add_assoc x.2 y.2 w.2))
/-- One summand moved across the kernel. -/
theorem lift_one {k n k' n' : N} (m m' : N) (h : sh n' k = sh n k') :
sh (add n' m') (sh m k) = sh (add n m) (sh m' k') :=
(sh_sh n' m' (sh m k)).symm.trans
((sh_comm n' m' (sh m k)).trans
((congrArg (sh m') (sh_comm n' m k)).trans
((congrArg (fun t => sh m' (sh m t)) h).trans
((congrArg (sh m') (sh_comm m n k')).trans
((sh_comm m' n (sh m k')).trans
((congrArg (sh n) (sh_comm m' m k')).trans
(sh_sh n m (sh m' k'))))))))
/-- Sum does not depend on the representative. -/
theorem dadd_rel {x x' y y' : N × N} (hx : rel x x') (hy : rel y y') :
rel (dadd x y) (dadd x' y') :=
have e1 : sh (add x'.2 y'.2) (sh y.2 x.1) = sh (add x.2 y.2) (sh y'.2 x'.1) :=
lift_one y.2 y'.2 hx
have e2 : sh (add x'.2 y'.2) (sh x.2 y.1) = sh (add x.2 y.2) (sh x'.2 y'.1) :=
(congrArg (fun t => sh t (sh x.2 y.1)) (N.add_comm x'.2 y'.2)).trans
((lift_one x.2 x'.2 hy).trans
(congrArg (fun t => sh t (sh x'.2 y'.1)) (N.add_comm y.2 x.2)))
(sh_add (add x'.2 y'.2) (sh y.2 x.1) (sh x.2 y.1)).trans
((congrArg (fun t => add t (sh (add x'.2 y'.2) (sh x.2 y.1))) e1).trans
((congrArg (add (sh (add x.2 y.2) (sh y'.2 x'.1))) e2).trans
(sh_add (add x.2 y.2) (sh y'.2 x'.1) (sh x'.2 y'.1)).symm))
theorem mul_sh_sh (a b k j : N) : mul (sh a k) (sh b j) = sh (add a b) (mul k j) :=
(sh_mul a k (sh b j)).trans
((congrArg (sh a) (mul_sh b k j)).trans (sh_sh a b (mul k j)))
/-- Product does not depend on the representative. -/
theorem dmul_rel {x x' y y' : N × N} (hx : rel x x') (hy : rel y y') :
rel (dmul x y) (dmul x' y') :=
(mul_sh_sh x'.2 y'.2 x.1 y.1).symm.trans
((congrArg (fun t => mul t (sh y'.2 y.1)) hx).trans
((congrArg (mul (sh x.2 x'.1)) hy).trans
(mul_sh_sh x.2 y.2 x'.1 y'.1)))
/-- `1/2 + 1/4 = 3/4`. -/
example : rel (dadd (num 1, num 1) (num 1, num 2)) (num 3, num 2) := rfl
/-- `3/4 · 1/2 = 3/8`. -/
example : dmul (num 3, num 2) (num 1, num 1) = (num 3, num 3) := rfl
end D
/-! ## 11. I: the greatest side of the same gluing -/
namespace I
open N Word
def bit : Bool → N
| true => N.s N.z
| false => N.z
/-- The word cut at `n` digits, as a numerator on level `n`. -/
def tr (w : W) : N → N
| .z => N.z
| .s n => add (bit (w n)) (dbl (tr w n))
/-- Two numerators on one level differ by at most one. -/
abbrev near (a b : N) : Prop := ∃ p r : Bool, add (bit p) a = add (bit r) b
/-- Equality of points of `I`, read in `D`: no finite cut tells them apart. -/
abbrev eqv (u v : W) : Prop := ∀ n, near (tr u n) (tr v n)
theorem near_refl (a : N) : near a a := ⟨false, false, rfl⟩
theorem near_symm {a b : N} : near a b → near b a :=
fun ⟨p, r, h⟩ => ⟨r, p, h.symm⟩
theorem eqv_refl (u : W) : eqv u u := fun n => near_refl (tr u n)
theorem eqv_symm {u v : W} (h : eqv u v) : eqv v u := fun n => near_symm (h n)
theorem tr_congr {u v : W} (h : ∀ n, u n = v n) : ∀ n, tr u n = tr v n := by
intro n
induction n with
| z => rfl
| s n ih =>
exact (congrArg (fun b => add (bit b) (dbl (tr u n))) (h n)).trans
(congrArg (fun t => add (bit (v n)) (dbl t)) ih)
/-- Two steps of `near`: equal, one apart, or two apart. -/
theorem tri (p q r t : Bool) (a c : N)
(h : add (bit q) (add (bit p) a) = add (bit r) (add (bit t) c)) :
near a c ∨ N.s (N.s a) = c ∨ a = N.s (N.s c) := by
cases p <;> cases q <;> cases r <;> cases t <;>
first
| exact Or.inl ⟨false, false, h⟩
| exact Or.inl ⟨true, false, h⟩
| exact Or.inl ⟨false, true, h⟩
| exact Or.inl ⟨false, false, s_inj h⟩
| exact Or.inl ⟨true, false, s_inj h⟩
| exact Or.inl ⟨false, true, s_inj h⟩
| exact Or.inl ⟨false, false, s_inj (s_inj h)⟩
| exact Or.inr (Or.inl h)
| exact Or.inr (Or.inr h)
theorem two_steps {a b c : N} {p r q t : Bool}
(h1 : add (bit p) a = add (bit r) b) (h2 : add (bit q) b = add (bit t) c) :
add (bit q) (add (bit p) a) = add (bit r) (add (bit t) c) :=
(congrArg (add (bit q)) h1).trans
((add_left_comm (bit q) (bit r) b).trans (congrArg (add (bit r)) h2))
theorem no_gap (q p x r t y : Bool) :
add (bit q) (add (bit p) (bit x)) ≠
add (bit r) (add (bit t) (add (bit y) (num 4))) := by
cases q <;> cases p <;> cases x <;> cases r <;> cases t <;> cases y <;>
exact fun h => nomatch h
/-- Two apart on one level cannot be within two on the next. -/
theorem gap_false (X : N) (q p x r t y : Bool)
(h : add (bit q) (add (bit p) (add (bit x) X)) =
add (bit r) (add (bit t) (add (bit y) (add (num 4) X)))) : False :=
have l : add (bit q) (add (bit p) (add (bit x) X)) =
add (add (bit q) (add (bit p) (bit x))) X :=
(congrArg (add (bit q)) (add_assoc (bit p) (bit x) X).symm).trans
(add_assoc (bit q) (add (bit p) (bit x)) X).symm
have m : add (bit r) (add (bit t) (add (bit y) (add (num 4) X))) =
add (add (bit r) (add (bit t) (add (bit y) (num 4)))) X :=
(congrArg (fun k => add (bit r) (add (bit t) k))
(add_assoc (bit y) (num 4) X).symm).trans
((congrArg (add (bit r))
(add_assoc (bit t) (add (bit y) (num 4)) X).symm).trans
(add_assoc (bit r) (add (bit t) (add (bit y) (num 4))) X).symm)
no_gap q p x r t y (add_right_cancel X (l.symm.trans (h.trans m)))
theorem dbl_ss (a : N) : dbl (N.s (N.s a)) = add (num 4) (dbl a) :=
(dbl_s (N.s a)).trans (congrArg (fun k => N.s (N.s k)) (dbl_s a))
/-- The reading of equality is transitive, so it is an equivalence. -/
theorem eqv_trans {u v w : W} (h1 : eqv u v) (h2 : eqv v w) : eqv u w := by
intro n
have ⟨p, r, e1⟩ := h1 n
have ⟨q, t, e2⟩ := h2 n
have ⟨p', r', e1'⟩ := h1 (N.s n)
have ⟨q', t', e2'⟩ := h2 (N.s n)
have K' : add (bit q') (add (bit p') (add (bit (u n)) (dbl (tr u n)))) =
add (bit r') (add (bit t') (add (bit (w n)) (dbl (tr w n)))) :=
two_steps e1' e2'
cases tri p q r t (tr u n) (tr w n) (two_steps e1 e2) with
| inl h => exact h
| inr h =>
cases h with
| inl hc =>
have e : dbl (tr w n) = add (num 4) (dbl (tr u n)) :=
(congrArg dbl hc.symm).trans (dbl_ss (tr u n))
exact (gap_false (dbl (tr u n)) q' p' (u n) r' t' (w n)
(K'.trans (congrArg
(fun k => add (bit r') (add (bit t') (add (bit (w n)) k))) e))).elim
| inr ha =>
have e : dbl (tr u n) = add (num 4) (dbl (tr w n)) :=
(congrArg dbl ha).trans (dbl_ss (tr w n))
exact (gap_false (dbl (tr w n)) r' t' (w n) q' p' (u n)
(K'.symm.trans (congrArg
(fun k => add (bit q') (add (bit p') (add (bit (u n)) k))) e))).elim
/-- Reading the first digit apart. -/
theorem tr_tail (w : W) (n : N) :
tr w (N.s n) = add (sh n (bit (w N.z))) (tr (tail w) n) := by
induction n with
| z => rfl
| s n ih =>
exact (congrArg (fun k => add (bit (w (N.s n))) (dbl k)) ih).trans
((congrArg (add (bit (w (N.s n))))
(dbl_add (sh n (bit (w N.z))) (tr (tail w) n))).trans
(add_left_comm (bit (w (N.s n))) (dbl (sh n (bit (w N.z))))
(dbl (tr (tail w) n))))
/-- Twins: `u 0111…` and `u 1000…`. -/
inductive Twin : W → W → Prop where
| base (u v : W) : u N.z = false → v N.z = true →
(∀ k, u (N.s k) = true) → (∀ k, v (N.s k) = false) → Twin u v
| step (u v : W) : u N.z = v N.z → Twin (tail u) (tail v) → Twin u v
theorem base_step (u v : W) (hu0 : u N.z = false) (hv0 : v N.z = true)
(hu : ∀ k, u (N.s k) = true) (hv : ∀ k, v (N.s k) = false) :
∀ n, N.s (tr u (N.s n)) = tr v (N.s n) := by
intro n
induction n with
| z =>
have eu : tr u (N.s N.z) = N.z :=
congrArg (fun b => add (bit b) N.z) hu0
have ev : tr v (N.s N.z) = N.s N.z :=
congrArg (fun b => add (bit b) N.z) hv0
exact (congrArg N.s eu).trans ev.symm
| s n ih =>
have eu : tr u (N.s (N.s n)) = N.s (dbl (tr u (N.s n))) :=
congrArg (fun b => add (bit b) (dbl (tr u (N.s n)))) (hu n)
have ev : tr v (N.s (N.s n)) = dbl (tr v (N.s n)) :=
congrArg (fun b => add (bit b) (dbl (tr v (N.s n)))) (hv n)
exact (congrArg N.s eu).trans
(((dbl_s (tr u (N.s n))).symm.trans (congrArg dbl ih)).trans ev.symm)
/-- Twins have cuts that are equal or one apart on every level. -/
theorem twin_near {u v : W} (h : Twin u v) :
∀ n, tr u n = tr v n ∨ N.s (tr u n) = tr v n := by
induction h with
| base u v hu0 hv0 hu hv =>
intro n
cases n with
| z => exact Or.inl rfl
| s n => exact Or.inr (base_step u v hu0 hv0 hu hv n)
| step u v h0 _ ih =>
intro n
cases n with
| z => exact Or.inl rfl
| s n =>
have hd : add (sh n (bit (u N.z))) (tr (tail v) n) = tr v (N.s n) :=
(congrArg (fun b => add (sh n (bit b)) (tr (tail v) n)) h0).trans
(tr_tail v n).symm
cases ih n with
| inl e =>
exact Or.inl ((tr_tail u n).trans
((congrArg (add (sh n (bit (u N.z)))) e).trans hd))
| inr e =>
exact Or.inr ((congrArg N.s (tr_tail u n)).trans
((add_s (sh n (bit (u N.z))) (tr (tail u) n)).symm.trans
((congrArg (add (sh n (bit (u N.z)))) e).trans hd)))
/-- The twin kernel lies inside the reading of equality. -/
theorem twin_eqv {u v : W} (h : Twin u v) : eqv u v := fun n =>
match twin_near h n with
| Or.inl e => ⟨false, false, e⟩
| Or.inr e => ⟨true, false, e⟩
def ones : W := fun _ => true
def zeros : W := fun _ => false
/-- `0111… ∼ 1000…`. -/
theorem half_twins :
eqv (fun n => match n with | .z => false | .s _ => true)
(fun n => match n with | .z => true | .s _ => false) :=
twin_eqv (Twin.base _ _ rfl rfl (fun _ => rfl) (fun _ => rfl))
/-! ### Gluing: the two choices at the glued point are twins -/
theorem unfold_fixed {X : Type u} (c : X → Bool × X) (x : X) (b : Bool)
(hx : c x = (b, x)) : ∀ n, unfold c x n = b := by
intro n
have fix : ∀ n, iter x (fun y => (c y).2) n = x := by
intro n
induction n with
| z => rfl
| s n ih =>
exact (congrArg (fun y => (c y).2) ih).trans (congrArg Prod.snd hx)
exact (congrArg (fun y => (c y).1) (fix n)).trans (congrArg Prod.fst hx)
/-- At a glued point one co-structure goes left and continues at the end
point, the other goes right and continues at the start point: the two
words are twins. -/
theorem glued_twin {X : Type u} (c c' : X → Bool × X) (top bot x : X)
(htop : c top = (true, top)) (hbot : c' bot = (false, bot))
(hl : c x = (false, top)) (hr : c' x = (true, bot)) :
Twin (unfold c x) (unfold c' x) :=
Twin.base _ _
(congrArg Prod.fst hl)
(congrArg Prod.fst hr)
(fun k => (unfold_tail c x k).trans
((congrArg (fun y => unfold c y k) (congrArg Prod.snd hl)).trans
(unfold_fixed c top true htop k)))
(fun k => (unfold_tail c' x k).trans
((congrArg (fun y => unfold c' y k) (congrArg Prod.snd hr)).trans
(unfold_fixed c' bot false hbot k)))
/-! ### Size: a copy of all words with no twins -/
def enc : W → N → Bool
| w, .z => w N.z
| w, .s .z => !(w N.z)
| w, .s (.s n) => enc (tail w) n
theorem enc_even (n : N) : ∀ w : W, enc w (dbl n) = w n := by
induction n with
| z => intro w; rfl
| s n ih =>
intro w
exact (congrArg (enc w) (dbl_s n)).trans (ih (tail w))
theorem enc_odd (n : N) : ∀ w : W, enc w (N.s (dbl n)) = !(w n) := by
induction n with
| z => intro w; rfl
| s n ih =>
intro w
exact (congrArg (fun k => enc w (N.s k)) (dbl_s n)).trans (ih (tail w))
/-- The copy is injective. -/
theorem enc_inj {u v : W} (h : ∀ k, enc u k = enc v k) : ∀ n, u n = v n :=
fun n => (enc_even n u).symm.trans ((h (dbl n)).trans (enc_even n v))
/-- It has no constant tail, hence no twins. -/
theorem enc_no_tail (w : W) (n : N) : enc w (N.s (dbl n)) ≠ enc w (dbl n) :=
fun h => not_ne (w n) ((enc_odd n w).symm.trans (h.trans (enc_even n w)))
end I
/-! ## 12. ℝ: an integer and a point of the unit length -/
namespace R
open N Word I
abbrev Pt := (N × N) × W
/-- The point cut at `n` digits, as an integer on level `n`. -/
def val (x : Pt) (n : N) : N × N :=
(add (sh n x.1.1) (tr x.2 n), sh n x.1.2)
abbrev znear (P Q : N × N) : Prop :=
∃ p r : Bool, Z.rel (add (bit p) P.1, P.2) (add (bit r) Q.1, Q.2)
/-- Equality of reals: every cut agrees up to its own precision. -/
abbrev req (x y : Pt) : Prop := ∀ n, znear (val x n) (val y n)
theorem req_refl (x : Pt) : req x x := fun _ => ⟨false, false, rfl⟩
theorem req_symm {x y : Pt} (h : req x y) : req y x := fun n =>
match h n with
| ⟨p, r, e⟩ => ⟨r, p, Z.rel_symm e⟩
theorem sh_z (n : N) : sh n N.z = N.z := by
induction n with
| z => rfl
| s n ih => exact congrArg dbl ih
theorem tr_zeros (n : N) : tr zeros n = N.z := by
induction n with
| z => rfl
| s n ih => exact congrArg dbl ih
/-- `0.111… + 2^{-n} = 1` on every level. -/
theorem tr_ones (n : N) : N.s (tr ones n) = sh n (num 1) := by
induction n with
| z => rfl
| s n ih => exact (dbl_s (tr ones n)).symm.trans (congrArg dbl ih)
/-- The gluing: `n` with `x = 1` is `n + 1` with `x = 0`. -/
theorem glue (a b : N) : req ((a, b), ones) ((N.s a, b), zeros) := fun n =>
have e : N.s (add (sh n a) (tr ones n)) = add (sh n (N.s a)) (tr zeros n) :=
(add_s (sh n a) (tr ones n)).symm.trans
((congrArg (add (sh n a)) (tr_ones n)).trans
((sh_add n a (num 1)).symm.trans
((congrArg (sh n) ((add_s a N.z).trans (congrArg N.s (add_z a)))).trans
((add_z (sh n (N.s a))).symm.trans
(congrArg (add (sh n (N.s a))) (tr_zeros n).symm)))))
⟨true, false, congrArg (fun k => add k (sh n b)) e⟩
/-! ### 1/3 and 2/3 -/
def alt : Bool → W
| b, .z => b
| b, .s n => alt (!b) n
def third : W := alt false -- 0.0101…
def twoThirds : W := alt true -- 0.1010…
theorem alt_not (n : N) : ∀ b : Bool, alt (!b) n = !(alt b n) := by
induction n with
| z => intro b; rfl
| s n ih => intro b; exact ih (!b)
theorem bit_compl (c : Bool) : add (bit c) (bit (!c)) = num 1 := by
cases c <;> rfl
theorem alt_compl (b : Bool) (n : N) :
add (tr (alt b) n) (tr (alt (!b)) n) = tr ones n := by
induction n with
| z => rfl
| s n ih =>
exact (add4 (bit (alt b n)) (dbl (tr (alt b) n))
(bit (alt (!b) n)) (dbl (tr (alt (!b)) n))).trans
((congrArg
(fun c => add (add (bit (alt b n)) (bit c))
(add (dbl (tr (alt b) n)) (dbl (tr (alt (!b)) n))))
(alt_not n b)).trans
((congrArg
(fun k => add k (add (dbl (tr (alt b) n)) (dbl (tr (alt (!b)) n))))
(bit_compl (alt b n))).trans
(congrArg (fun k => N.s k)
((dbl_add (tr (alt b) n) (tr (alt (!b)) n)).symm.trans
(congrArg dbl ih)))))
/-- `1/3 + 2/3` is one step below `1` on every level: `1/3 + 2/3 = 1`. -/
theorem third_twoThirds (n : N) :
N.s (add (tr third n) (tr twoThirds n)) = sh n (num 1) :=
(congrArg N.s (alt_compl false n)).trans (tr_ones n)
/-- `2/3` on level `n` is `1/3` on level `n + 1`: `1/3 + 1/3 = 2/3`. -/
theorem twice_third (n : N) : tr third (N.s n) = tr twoThirds n :=
(tr_tail third n).trans
((congrArg (fun k => add k (tr (tail third) n)) (sh_z n)).trans
(tr_congr (u := tail third) (v := twoThirds) (fun _ => rfl) n))
/-! ### The digits of √(1/2), read by `(2a+1)² < 2^(2k+1)` -/
def rt : Nat → Nat
| 0 => 0
| k + 1 => if (2 * rt k + 1) ^ 2 < 2 ^ (2 * k + 1) then 2 * rt k + 1 else 2 * rt k
/-- The first eight digits are `10110101`. -/
theorem rt_eight : rt 8 = 181 := by decide
theorem rt_bounds : 181 ^ 2 < 2 ^ 15 ∧ 2 ^ 15 < 182 ^ 2 := by decide
end R
/-! ## Axiom report -/
#print axioms Path.contract
#print axioms Path.trans_assoc
#print axioms comp_unit
#print axioms comp_arrows
#print axioms N.iter_unique
#print axioms N.s_ne_z
#print axioms N.s_inj
#print axioms N.add_comm
#print axioms N.mul_comm
#print axioms N.add_mul
#print axioms N.mul_assoc
#print axioms Z.rel_trans
#print axioms Word.unfold_unique
#print axioms Word.diagonal
#print axioms D.rel_trans
#print axioms D.dadd_rel
#print axioms D.dmul_rel
#print axioms D.double_half
#print axioms I.eqv_trans
#print axioms I.twin_eqv
#print axioms I.half_twins
#print axioms I.glued_twin
#print axioms I.enc_inj
#print axioms I.enc_no_tail
#print axioms R.glue
#print axioms R.third_twoThirds
#print axioms R.twice_third
#print axioms R.rt_eight
#print axioms R.rt_bounds
lean_all/found/user/OneMove.lean
/-
OneMove.lean
One source, one move: idempotents and their fixed points.
Seeds: a = a, and its negation.
Move: form an idempotent, look at what it fixes.
Lean 4 core only. No imports. No axioms (see the end).
Coverage, by link of the section:
1-8 places, pairs, e1, sameness, transport
9-12 terminal object, product, arrows (sandwich), currying, K, S
13 solutions of equations, commuting idempotents, order
14 K, S as the axioms of implication
15 the Yoneda idempotent
16-18 zero as the negation of a = a, double negation, or, some
20 closure, least fixed point
21-22 numbers, sum, product (realised as "compose n times")
23 integers: the normalising idempotent on pairs
26 complex numbers and quaternions: i*i = -1, ij = k, ji = -k
(computed on the core integers)
Not in this file: 19 (topos, stated in the text), 24 (rationals),
25 (reals), 27 (sheaves).
-/
namespace OneMove
/-! ## Links 1-8: places -/
def idf {A : Type} (x : A) : A := x
structure Pair (A B : Type) where
fst : A
snd : B
def diag {A : Type} (x : A) : Pair A A := Pair.mk x x
def p1 {A B : Type} (p : Pair A B) : A := p.fst
def p2 {A B : Type} (p : Pair A B) : B := p.snd
theorem tri1 {A : Type} (x : A) : p1 (diag x) = idf x := rfl
def e {A B : Type} (p : Pair A B) : Pair A B := Pair.mk (p1 p) (p2 p)
theorem e_idem {A B : Type} (p : Pair A B) : e (e p) = e p := rfl
theorem pair_ext {A B : Type} (p : Pair A B) : p = Pair.mk (p1 p) (p2 p) := rfl
def e1 {A : Type} (p : Pair A A) : Pair A A := diag (p1 p)
theorem e1_idem {A : Type} (p : Pair A A) : e1 (e1 p) = e1 p := rfl
/-- Sameness: the pair is fixed by `e1`. -/
abbrev E {A : Type} (x y : A) : Prop := e1 (Pair.mk x y) = Pair.mk x y
theorem E_refl {A : Type} (x : A) : E x x := Eq.refl (Pair.mk x x)
theorem E_to_eq {A : Type} {x y : A} (h : E x y) : x = y := congrArg p2 h
theorem E_of_eq {A : Type} {x y : A} (h : x = y) : E x y :=
congrArg (fun t => Pair.mk x t) h
def sw {A B : Type} (p : Pair A B) : Pair B A := Pair.mk (p2 p) (p1 p)
theorem sw_sw {A B : Type} (p : Pair A B) : sw (sw p) = p := rfl
theorem transport {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q y) : Q x :=
Eq.mpr (congrArg (fun p => Q (p2 p)) h) q
theorem transport' {A : Type} {x y : A} (Q : A → Prop) (h : E x y) (q : Q x) : Q y :=
Eq.mp (congrArg (fun p => Q (p2 p)) h) q
theorem E_symm {A : Type} {x y : A} (h : E x y) : E y x :=
transport (fun t => E y t) h (E_refl y)
theorem E_trans {A : Type} {x y z : A} (h1 : E x y) (h2 : E y z) : E x z :=
transport (fun t => E t z) h1 h2
theorem E_app {A B : Type} (f : A → B) {x y : A} (h : E x y) : E (f x) (f y) :=
transport' (fun t => E (f x) (f t)) h (E_refl (f x))
/-! ## The move: idempotents -/
def Idem {A : Type} (a : A → A) : Prop := ∀ x, a (a x) = a x
theorem idem_id {A : Type} : Idem (@idf A) := fun _ => rfl
theorem idem_e {A B : Type} : Idem (@e A B) := fun _ => rfl
theorem idem_e1 {A : Type} : Idem (@e1 A) := fun _ => rfl
/-! ## Link 9: the terminal object -/
def konst {A : Type} (a : A) : A → A := fun _ => a
theorem konst_idem {A : Type} (a : A) : Idem (konst a) := fun _ => rfl
theorem konst_fix {A : Type} (a x : A) : konst a x = x ↔ x = a :=
Iff.intro (fun h => Eq.symm h) (fun h => Eq.symm h)
/-- Every arrow into `konst a` is the constant one. -/
theorem to_konst {A B : Type} (a : A) (b : B → B) (f : B → A) :
(fun x => konst a (f (b x))) = fun _ => a := rfl
/-! ## Link 10: products -/
def prod {A B : Type} (a : A → A) (b : B → B) (p : Pair A B) : Pair A B :=
Pair.mk (a (p1 p)) (b (p2 p))
theorem prod_idem {A B : Type} {a : A → A} {b : B → B}
(ha : Idem a) (hb : Idem b) : Idem (prod a b) :=
fun p =>
Eq.trans
(congrArg (fun t => Pair.mk t (b (b (p2 p)))) (ha (p1 p)))
(congrArg (fun t => Pair.mk (a (p1 p)) t) (hb (p2 p)))
theorem e_is_prod {A B : Type} : prod (@idf A) (@idf B) = @e A B := rfl
/-! ## Link 11: arrows are the fixed points of the sandwich -/
def sand {A B : Type} (a : A → A) (b : B → B) (f : A → B) : A → B :=
fun x => b (f (a x))
theorem sand_idem {A B : Type} {a : A → A} {b : B → B}
(ha : Idem a) (hb : Idem b) (f : A → B) (x : A) :
sand a b (sand a b f) x = sand a b f x :=
Eq.trans (hb (f (a (a x)))) (congrArg (fun t => b (f t)) (ha x))
def Arr {A B : Type} (a : A → A) (b : B → B) (f : A → B) : Prop :=
∀ x, sand a b f x = f x
/-- The idempotent is its own identity arrow. -/
theorem arr_id {A : Type} {a : A → A} (ha : Idem a) : Arr a a a :=
fun x => Eq.trans (ha (a x)) (ha x)
/-- Right unit law: f ∘ a = f. -/
theorem arr_right {A B : Type} {a : A → A} {b : B → B} {f : A → B}
(ha : Idem a) (hf : Arr a b f) (x : A) : f (a x) = f x :=
Eq.trans (Eq.symm (hf (a x)))
(Eq.trans (congrArg (fun t => b (f t)) (ha x)) (hf x))
/-- Left unit law: b ∘ f = f. -/
theorem arr_left {A B : Type} {a : A → A} {b : B → B} {f : A → B}
(hb : Idem b) (hf : Arr a b f) (x : A) : b (f x) = f x :=
Eq.trans (congrArg b (Eq.symm (hf x)))
(Eq.trans (hb (f (a x))) (hf x))
/-- Composition: arrows compose to an arrow. -/
theorem arr_comp {A B C : Type} {a : A → A} {b : B → B} {c : C → C}
{f : A → B} {g : B → C}
(ha : Idem a) (hc : Idem c) (hf : Arr a b f) (hg : Arr b c g) :
Arr a c (fun x => g (f x)) :=
fun x =>
Eq.trans (congrArg (fun t => c (g t)) (arr_right ha hf x))
(arr_left hc hg (f x))
/-- Associativity: doing maps in a row has no brackets. -/
theorem comp_assoc {A B C D : Type} (h : C → D) (g : B → C) (f : A → B) :
(fun x => h ((fun y => g (f y)) x)) = (fun x => (fun y => h (g y)) (f x)) := rfl
/-- Links 4 and 7 read as arrows: Δ : id → e1 and π₁ : e1 → id. -/
theorem diag_arr {A : Type} : Arr (@idf A) (@e1 A) (@diag A) := fun _ => rfl
theorem p1_arr {A : Type} : Arr (@e1 A) (@idf A) (@p1 A A) := fun _ => rfl
theorem p1_diag {A : Type} (x : A) : p1 (diag x) = x := rfl
theorem diag_p1 {A : Type} (p : Pair A A) : diag (p1 p) = e1 p := rfl
/-! ## Link 12: currying -/
def phi {A B C : Type} (k : Pair A B → C) (x : A) (y : B) : C := k (Pair.mk x y)
def psi {A B C : Type} (h : A → B → C) (p : Pair A B) : C := h (p1 p) (p2 p)
theorem psi_phi {A B C : Type} (k : Pair A B → C) : psi (phi k) = k := rfl
theorem phi_psi {A B C : Type} (h : A → B → C) : phi (psi h) = h := rfl
theorem curry_arr {A B C : Type} {a : A → A} {b : B → B} {c : C → C}
{k : Pair A B → C} (hk : Arr (prod a b) c k) (x : A) (y : B) :
c (phi k (a x) (b y)) = phi k x y :=
hk (Pair.mk x y)
theorem uncurry_arr {A B C : Type} {a : A → A} {b : B → B} {c : C → C}
{h : A → B → C} (hh : ∀ x y, c (h (a x) (b y)) = h x y) :
Arr (prod a b) c (psi h) :=
fun p => hh (p1 p) (p2 p)
def eta {A B : Type} (a : A → A) (b : B → B) : A → B → Pair A B := phi (prod a b)
theorem eta_app {A B : Type} (a : A → A) (b : B → B) (x : A) (y : B) :
eta a b x y = Pair.mk (a x) (b y) := rfl
def eps {B C : Type} (b : B → B) (c : C → C) (p : Pair (B → C) B) : C :=
c ((p1 p) (b (p2 p)))
/-- Triangle 1. -/
theorem tri_one {A B : Type} {a : A → A} {b : B → B}
(ha : Idem a) (hb : Idem b) (x : A) (y : B) :
eps b (prod a b) (Pair.mk (eta a b x) y) = Pair.mk (a x) (b y) :=
Eq.trans
(congrArg (fun t => Pair.mk t (b (b (b y)))) (ha x))
(congrArg (fun t => Pair.mk (a x) t) (Eq.trans (hb (b y)) (hb y)))
/-- Triangle 2: the map y ↦ ε(f, y) is the sandwich of f. -/
theorem tri_two {B C : Type} (b : B → B) (c : C → C) (f : B → C) :
(fun y => eps b c (Pair.mk f y)) = sand b c f := rfl
/-- Triangle 2 on an arrow: extensionality. -/
theorem tri_two_arr {B C : Type} {b : B → B} {c : C → C} {f : B → C}
(hf : Arr b c f) (y : B) : eps b c (Pair.mk f y) = f y := hf y
/-- The combinators, at the identity idempotents. -/
def K {A B : Type} (x : A) (_y : B) : A := x
def S {A B C : Type} (f : A → B → C) (g : A → B) (x : A) : C := f x (g x)
theorem SKK {A : Type} : @S A (A → A) A (@K A (A → A)) (@K A A) = @idf A := rfl
def Bc {A M C : Type} : (M → C) → (A → M) → A → C :=
@S (M → C) (A → M → C) ((A → M) → A → C)
(@K ((A → M → C) → (A → M) → A → C) (M → C) (@S A M C))
(@K (M → C) A)
theorem Bc_app {A M C : Type} (g : M → C) (f : A → M) (x : A) :
Bc g f x = g (f x) := rfl
/-! ## Link 13: solutions of equations; commuting idempotents; order -/
def Sol {X A : Type} (f g : X → A) (x : X) : Prop := E (f x) (g x)
theorem sol_iff {X A : Type} (f g : X → A) (x : X) : Sol f g x ↔ f x = g x :=
Iff.intro (fun h => E_to_eq h) (fun h => E_of_eq h)
theorem sol_refl {X A : Type} (f : X → A) (x : X) : Sol f f x := E_refl (f x)
theorem comp_idem {X : Type} {u v : X → X}
(hu : Idem u) (hv : Idem v) (hc : ∀ y, u (v y) = v (u y)) :
Idem (fun x => u (v x)) :=
fun x =>
Eq.trans
(congrArg u (Eq.trans (Eq.symm (hc (v x))) (congrArg u (hv x))))
(hu (v x))
theorem fix_both {X : Type} {u v : X → X} {x : X}
(h : u x = x) (h' : v x = x) : u (v x) = x :=
Eq.trans (congrArg u h') h
theorem fix_left {X : Type} {u v : X → X} {x : X}
(hu : Idem u) (h : u (v x) = x) : u x = x :=
Eq.trans (congrArg u (Eq.symm h)) (Eq.trans (hu (v x)) h)
theorem fix_right {X : Type} {u v : X → X} {x : X}
(hv : Idem v) (hc : ∀ y, u (v y) = v (u y)) (h : u (v x) = x) : v x = x :=
Eq.trans (congrArg v (Eq.symm h))
(Eq.trans (Eq.trans (Eq.symm (hc (v x))) (congrArg u (hv x))) h)
/-- The order on idempotents. -/
def ile {X : Type} (u v : X → X) : Prop := ∀ x, v (u x) = u x
theorem ile_refl {X : Type} {u : X → X} (hu : Idem u) : ile u u := fun x => hu x
/-! ## Link 14: K and S as the axioms of implication -/
theorem ax_K {P Q : Prop} : P → Q → P := fun p _ => p
theorem ax_S {P Q R : Prop} : (P → Q → R) → (P → Q) → P → R := fun f g p => f p (g p)
theorem detach {P Q : Prop} : (P → Q) → P → Q := fun f p => f p
theorem id_from_SK {P : Prop} : P → P := @ax_S P (P → P) P ax_K ax_K
/-! ## Link 15: the Yoneda idempotent -/
def yN (F : Type → Type) (map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(A : Type) (α : ∀ X : Type, (A → X) → F X) : ∀ X : Type, (A → X) → F X :=
fun X f => map A X f (α A idf)
theorem yN_idem (F : Type → Type) (map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(map_id : ∀ (X : Type) (x : F X), map X X idf x = x)
(A : Type) (α : ∀ X : Type, (A → X) → F X) (X : Type) (f : A → X) :
yN F map A (yN F map A α) X f = yN F map A α X f :=
congrArg (map A X f) (map_id A (α A idf))
/-- A natural family is a fixed point of `yN`. -/
theorem yN_fix (F : Type → Type) (map : ∀ (X Y : Type), (X → Y) → F X → F Y)
(A : Type) (α : ∀ X : Type, (A → X) → F X)
(nat : ∀ (X Y : Type) (g : X → Y) (h : A → X),
α Y (fun x => g (h x)) = map X Y g (α X h))
(X : Type) (f : A → X) :
α X f = yN F map A α X f :=
nat A X f idf
/-! ## Links 16-18: the negative side -/
/-- One: a = a. -/
def OneP : Prop := ∀ (A : Type) (a : A), a = a
theorem one_holds : OneP := fun _ _ => rfl
/-- Zero: the negation of a = a. From it anything follows. -/
def ZeroP : Prop := ∀ C : Prop, OneP → C
theorem zero_elim (h : ZeroP) (C : Prop) : C := h C one_holds
/-- The two seeds differ. -/
theorem one_ne_zero : OneP = ZeroP → ZeroP := fun h => Eq.mp h one_holds
abbrev Not' (P : Prop) : Prop := P → ZeroP
theorem dn_in {P : Prop} : P → Not' (Not' P) := fun p k => k p
theorem dn_triple {P : Prop} : Not' (Not' (Not' P)) → Not' P :=
fun n p => n (fun k => k p)
/-- Double negation is idempotent. -/
theorem dn_idem {P : Prop} : Not' (Not' (Not' (Not' P))) ↔ Not' (Not' P) :=
Iff.intro (fun h => dn_triple h) (fun h => dn_in h)
structure Both (P Q : Prop) : Prop where
l : P
r : Q
abbrev Or' (P Q : Prop) : Prop := Not' (Both (Not' P) (Not' Q))
theorem inl' {P Q : Prop} (p : P) : Or' P Q := fun w => w.l p
theorem inr' {P Q : Prop} (q : Q) : Or' P Q := fun w => w.r q
/-- P or not P. -/
theorem lem' (P : Prop) : Or' P (Not' P) := fun w => w.r w.l
theorem demorgan {P Q : Prop} : Not' (Or' P Q) ↔ Both (Not' P) (Not' Q) :=
Iff.intro
(fun n => Both.mk (fun p => n (inl' p)) (fun q => n (inr' q)))
(fun w o => o w)
abbrev Some' {A : Type} (R : A → Prop) : Prop := Not' (∀ b, Not' (R b))
theorem some_intro {A : Type} {R : A → Prop} (b : A) (r : R b) : Some' R :=
fun w => w b r
/-! ## Link 20: closure and the least fixed point -/
def cl {X : Type} (Φ : (X → Prop) → X → Prop) (P : X → Prop) (x : X) : Prop :=
∀ Q : X → Prop, (∀ y, P y → Q y) → (∀ y, Φ Q y → Q y) → Q x
def Mono {X : Type} (Φ : (X → Prop) → X → Prop) : Prop :=
∀ P Q : X → Prop, (∀ y, P y → Q y) → ∀ y, Φ P y → Φ Q y
theorem le_cl {X : Type} {Φ : (X → Prop) → X → Prop} (P : X → Prop) (y : X)
(h : P y) : cl Φ P y :=
fun _ hPQ _ => hPQ y h
theorem cl_closed {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ)
(P : X → Prop) (y : X) (h : Φ (cl Φ P) y) : cl Φ P y :=
fun Q hPQ hQ => hQ y (m (cl Φ P) Q (fun _ hz => hz Q hPQ hQ) y h)
/-- Closure is idempotent. -/
theorem cl_idem {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ)
(P : X → Prop) (x : X) : cl Φ (cl Φ P) x ↔ cl Φ P x :=
Iff.intro
(fun h => h (cl Φ P) (fun _ hy => hy) (fun y hy => cl_closed m P y hy))
(fun h => le_cl (cl Φ P) x h)
/-- The least fixed point: the closure of zero. -/
def mu {X : Type} (Φ : (X → Prop) → X → Prop) : X → Prop := cl Φ (fun _ => ZeroP)
theorem mu_closed {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ) (y : X)
(h : Φ (mu Φ) y) : mu Φ y :=
cl_closed m (fun _ => ZeroP) y h
theorem mu_open {X : Type} {Φ : (X → Prop) → X → Prop} (m : Mono Φ) (x : X)
(h : mu Φ x) : Φ (mu Φ) x :=
h (Φ (mu Φ))
(fun y z => zero_elim z (Φ (mu Φ) y))
(fun y hy => m (Φ (mu Φ)) (mu Φ) (fun z hz => mu_closed m z hz) y hy)
/-! ## Links 21-22: numbers, realised as "compose n times" -/
abbrev Num : Type 1 := ∀ A : Type, (A → A) → A → A
def zero : Num := fun _ _ a => a
def succ (n : Num) : Num := fun A f a => f (n A f a)
def add (m n : Num) : Num := fun A f a => n A f (m A f a)
def mul (m n : Num) : Num := fun A f a => n A (m A f) a
theorem add_zero (m : Num) : add m zero = m := rfl
theorem add_succ (m n : Num) : add m (succ n) = succ (add m n) := rfl
theorem mul_zero (m : Num) : mul m zero = zero := rfl
theorem mul_succ (m n : Num) : mul m (succ n) = add (mul m n) m := rfl
/-- One is the identity. -/
theorem one_is_id (A : Type) (f : A → A) : succ zero A f = f := rfl
/-- Being a number: the closure of zero under successor. -/
def IsNat (n : Num) : Prop :=
∀ P : Num → Prop, P zero → (∀ m, P m → P (succ m)) → P n
theorem isNat_zero : IsNat zero := fun _ h0 _ => h0
theorem isNat_succ {n : Num} (h : IsNat n) : IsNat (succ n) :=
fun P h0 hs => hs n (h P h0 hs)
theorem num_ind (P : Num → Prop) (h0 : P zero) (hs : ∀ m, P m → P (succ m))
{n : Num} (h : IsNat n) : P n := h P h0 hs
def Same (m n : Num) : Prop :=
∀ (A : Type) (f : A → A) (a : A), m A f a = n A f a
theorem same_refl (n : Num) : Same n n := fun _ _ _ => rfl
/-- 0 is not a successor: read at (Ω, K 0, 1). -/
theorem zero_ne_succ (n : Num) : Same zero (succ n) → ZeroP :=
fun h => one_ne_zero (h Prop (fun _ => ZeroP) OneP)
def shift {A : Type} (f : A → A) (p : Pair A A) : Pair A A :=
Pair.mk (f (p1 p)) (p1 p)
theorem left_read (A : Type) (f : A → A) (a : A) {n : Num} (h : IsNat n) :
p1 (n (Pair A A) (shift f) (diag a)) = n A f a :=
h (fun k => p1 (k (Pair A A) (shift f) (diag a)) = k A f a)
rfl
(fun _ ih => congrArg f ih)
theorem right_read (A : Type) (f : A → A) (a : A) (n : Num) :
p2 (succ n (Pair A A) (shift f) (diag a))
= p1 (n (Pair A A) (shift f) (diag a)) := rfl
/-- Successor is injective. -/
theorem succ_inj {m n : Num} (hm : IsNat m) (hn : IsNat n)
(h : Same (succ m) (succ n)) : Same m n :=
fun A f a =>
Eq.trans (Eq.symm (left_read A f a hm))
(Eq.trans
(congrArg p2 (h (Pair A A) (shift f) (diag a)))
(left_read A f a hn))
/-! ## Link 23: the integers as fixed points of a normalising idempotent -/
inductive Nt : Type where
| z : Nt
| s : Nt → Nt
def pred : Nt → Nt
| Nt.z => Nt.z
| Nt.s a => a
/-- Truncated subtraction. -/
def monus (a : Nt) : Nt → Nt
| Nt.z => a
| Nt.s b => pred (monus a b)
theorem zm : ∀ b : Nt, monus Nt.z b = Nt.z
| Nt.z => rfl
| Nt.s b => congrArg pred (zm b)
theorem monus_ss (a : Nt) : ∀ b : Nt, monus (Nt.s a) (Nt.s b) = monus a b
| Nt.z => rfl
| Nt.s b => congrArg pred (monus_ss a b)
theorem mm : ∀ a : Nt, monus a a = Nt.z
| Nt.z => rfl
| Nt.s a => Eq.trans (monus_ss a a) (mm a)
theorem monus_swap : ∀ a b : Nt, monus (monus a b) (monus b a) = monus a b
| Nt.z, b => congrArg (fun t => monus t b) (zm b)
| Nt.s a, Nt.z => congrArg (fun t => monus (Nt.s a) t) (zm (Nt.s a))
| Nt.s a, Nt.s b =>
Eq.trans
(congrArg (fun t => monus t (monus (Nt.s b) (Nt.s a))) (monus_ss a b))
(Eq.trans
(congrArg (fun t => monus (monus a b) t) (monus_ss b a))
(Eq.trans (monus_swap a b) (Eq.symm (monus_ss a b))))
def norm (p : Pair Nt Nt) : Pair Nt Nt :=
Pair.mk (monus (p1 p) (p2 p)) (monus (p2 p) (p1 p))
/-- The normalisation is idempotent; its fixed points are the integers. -/
theorem norm_idem : Idem norm :=
fun p =>
Eq.trans
(congrArg
(fun t => Pair.mk t (monus (monus (p2 p) (p1 p)) (monus (p1 p) (p2 p))))
(monus_swap (p1 p) (p2 p)))
(congrArg (fun t => Pair.mk (monus (p1 p) (p2 p)) t)
(monus_swap (p2 p) (p1 p)))
/-- The diagonal is zero. -/
theorem norm_diag (a : Nt) : norm (diag a) = Pair.mk Nt.z Nt.z :=
Eq.trans
(congrArg (fun t => Pair.mk t (monus a a)) (mm a))
(congrArg (fun t => Pair.mk Nt.z t) (mm a))
/-- Negation is the swap. -/
theorem norm_sw (p : Pair Nt Nt) : norm (sw p) = sw (norm p) := rfl
/-! ## Link 26: pairs with conjugation, computed on the core integers -/
abbrev Cx : Type := Pair Int Int
def cmul (x y : Cx) : Cx :=
Pair.mk (p1 x * p1 y - p2 y * p2 x) (p2 y * p1 x + p2 x * p1 y)
def cconj (x : Cx) : Cx := Pair.mk (p1 x) (- p2 x)
def cneg (x : Cx) : Cx := Pair.mk (- p1 x) (- p2 x)
def cadd (x y : Cx) : Cx := Pair.mk (p1 x + p1 y) (p2 x + p2 y)
def csub (x y : Cx) : Cx := Pair.mk (p1 x - p1 y) (p2 x - p2 y)
def c0 : Cx := Pair.mk 0 0
def c1 : Cx := Pair.mk 1 0
def ci : Cx := Pair.mk 0 1
/-- i * i = -1. -/
theorem ci_sq : cmul ci ci = (Pair.mk (-1) 0 : Cx) := rfl
abbrev Hq : Type := Pair Cx Cx
def hmul (x y : Hq) : Hq :=
Pair.mk
(csub (cmul (p1 x) (p1 y)) (cmul (cconj (p2 y)) (p2 x)))
(cadd (cmul (p2 y) (p1 x)) (cmul (p2 x) (cconj (p1 y))))
def hneg (x : Hq) : Hq := Pair.mk (cneg (p1 x)) (cneg (p2 x))
def hi : Hq := Pair.mk ci c0
def hj : Hq := Pair.mk c0 c1
def hk : Hq := Pair.mk c0 ci
/-- ij = k and ji = -k: commutativity is lost. -/
theorem ij_eq_k : hmul hi hj = hk := rfl
theorem ji_eq_neg_k : hmul hj hi = hneg hk := rfl
/-! ## Axiom check -/
#print axioms E_trans
#print axioms konst_fix
#print axioms prod_idem
#print axioms sand_idem
#print axioms arr_id
#print axioms arr_comp
#print axioms curry_arr
#print axioms uncurry_arr
#print axioms tri_one
#print axioms tri_two_arr
#print axioms SKK
#print axioms Bc_app
#print axioms comp_idem
#print axioms fix_right
#print axioms yN_idem
#print axioms yN_fix
#print axioms one_ne_zero
#print axioms dn_idem
#print axioms lem'
#print axioms demorgan
#print axioms cl_idem
#print axioms mu_open
#print axioms mul_succ
#print axioms zero_ne_succ
#print axioms succ_inj
#print axioms norm_idem
#print axioms norm_diag
#print axioms ci_sq
#print axioms ij_eq_k
#print axioms ji_eq_neg_k
end OneMove
lean_all/hodge/APDouble.lean
/-
hodge/APDouble.lean — T41 cycle 286 (goal G29): for every d ∣ m (m = 2h even), every a with 0 < da < h, the
character AP_d(a) + (da + m/2, m − 2da) = [a, a + q, …, a + (d−1)q, da + h, w] (q = m/d, 2da + w = m)
is balanced. d = 4 is the first pair family (APPair); d = 2 gives length 4 (surfaces, where Lefschetz (1,1) applies).
Lean 4 core plus hodge/StdGeneral (t_sum, tsum_j, two_sum: Σ_k ⟨t(a + kq)⟩ = Σ_j (r + jq)), hodge/DupTriple
(tsum_dup), hodge/UnitInv (inverse), hodge/UnitMul (gcd_dvd), hodge/APPair1 (dvd_gcd), hodge/TwistBal
(all_fr_intro), ESChain (rem_eq_mod), lib/Semi (lib_nat). Per unit t: the AP contributes ⟨t·da⟩ + (d−1)m/2,
the pair ⟨t(da + h)⟩ + ⟨tw⟩ = 3h − ⟨t·da⟩; total (d + 2)·m/2.
apL, tsum_append, tsum_apL the AP as a list, and its t-sum as sumTo
unit_d a unit of m = dq is a unit of d
ap_double_bal the theorem
-/
import hodge.DupTriple
import hodge.StdGeneral
namespace APDouble
open FTAChain FrobChain QRChain ESChain StdGeneral
open ModHand HalfGeneral Indecomp GcdHand APPair APPairIrrGen APPairGen TwistBal UnitMul UnitInv DupTriple
def apL (d a q : Nat) : List Nat := (List.range d).map (fun k => a + k * q)
theorem tsum_append (m t : Nat) : ∀ A B : List Nat, tsum m t (A ++ B) = tsum m t A + tsum m t B
| [], B => (Nat.zero_add _).symm
| x :: A, B => by
show (t * x) % m + tsum m t (A ++ B) = ((t * x) % m + tsum m t A) + tsum m t B
rw [tsum_append m t A B, Nat.add_assoc]
theorem map_append' {α β : Type} (f : α → β) : ∀ A B : List α, (A ++ B).map f = A.map f ++ B.map f
| [], _ => rfl
| x :: A, B => by show f x :: (A ++ B).map f = f x :: (A.map f ++ B.map f); rw [map_append' f A B]
theorem tsum_apL (m t a q : Nat) : ∀ n, tsum m t (apL n a q) = sumTo n (fun k => (t * (a + k * q)) % m)
| 0 => rfl
| n + 1 => by
unfold apL
rw [range_succ', map_append', tsum_append]
show tsum m t (apL n a q) + ((t * (a + n * q)) % m + 0) = _
rw [tsum_apL m t a q n]; rfl
theorem sumTo_congr (f g : Nat → Nat) (h : ∀ k, f k = g k) : ∀ n, sumTo n f = sumTo n g
| 0 => rfl
| n + 1 => by show sumTo n f + f n = sumTo n g + g n; rw [sumTo_congr f g h n, h n]
theorem len_apL (d a q : Nat) : (apL d a q).length = d := by
unfold apL; rw [length_map']
induction d with
| zero => rfl
| succ d ih => rw [range_succ']; exact (show (List.range d ++ [d]).length = d + 1 from by
have e : ∀ L : List Nat, (L ++ [d]).length = L.length + 1 := by
intro L; induction L with
| nil => rfl
| cons x L ihL => show (L ++ [d]).length + 1 = L.length + 1 + 1; rw [ihL]
rw [e, ih])
/-- A unit of m = d q is a unit of d. -/
theorem unit_d (t d q : Nat) (hg : Nat.gcd t (d * q) = 1) : Nat.gcd t d = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := gcd_dvd t d
generalize Nat.gcd t d = g at hi hj ⊢
have ⟨c, hc⟩ := APPair1.dvd_gcd g t (d * q) ⟨i, hi⟩ ⟨j * q, by rw [hj]; lib_nat⟩
rw [hg] at hc
exact one_of_dvd_one g c hc
/-- **AP_d(a) + (da + m/2, m − 2da) is balanced.** (d = d″ + 2, q = q′ + 1, m = dq = 2h, 0 < da < h, 2da + w = 2h) -/
theorem ap_double_bal (d'' q' h a w : Nat) (hm : (d'' + 1 + 1) * (q' + 1) = h + h)
(ha : 0 < (d'' + 1 + 1) * a) (hah : (d'' + 1 + 1) * a < h)
(hw : (d'' + 1 + 1) * a + (d'' + 1 + 1) * a + w = h + h) :
bal (h + h) (apL (d'' + 1 + 1) a (q' + 1) ++ [(d'' + 1 + 1) * a + h, w]) = true := by
have hh : 0 < h := Nat.lt_of_le_of_lt (Nat.zero_le _) hah
have hM0 : 0 < h + h := Nat.lt_of_lt_of_le hh (Nat.le_add_right h h)
have hMM : (d'' + 1 + 1) * (q' + 1) = ((d'' + 1) * (q' + 1) + q') + 1 := by lib_nat
unfold bal FermatPrime.units
apply all_fr_intro
intro t _ hp
have hg := Nat.eq_of_beq_eq_true hp
have ht : isOdd t = true := unit_isOdd h t hg
-- inverse of t mod d
have hgd : Nat.gcd t (d'' + 1 + 1) = 1 := unit_d t _ (q' + 1) (by rw [hm]; exact hg)
have ⟨v, hv⟩ := inverse t d'' hgd
have ht' : rem ((d'' + 1) + 1) (v * t) = 1 := by rw [rem_eq_mod]; exact hv
-- x0 = ⟨ta⟩_m = r + s q
have ⟨s, hs⟩ := decomp ((t * a) % (h + h)) (q' + 1) (Nat.succ_pos q')
generalize hr : ((t * a) % (h + h)) % (q' + 1) = r at hs
have hrq : r < q' + 1 := hr ▸ Nat.mod_lt _ (Nat.succ_pos q')
have hx : rem ((d'' + 1 + 1) * (q' + 1)) (t * a) = r + s * (q' + 1) := by
rw [hMM, rem_eq_mod, ← hMM, hm, hs, Nat.mul_comm (q' + 1) s]
have ts := t_sum (d'' + 1) q' t v a r s (Nat.succ_pos d'') ht' hx hrq
rw [tsum_j] at ts
-- the AP part as tsum
have hap : tsum (h + h) t (apL (d'' + 1 + 1) a (q' + 1))
= (d'' + 1 + 1) * r + (q' + 1) * sumTo (d'' + 1 + 1) (fun j => j) := by
rw [tsum_apL, ← ts, ← hm]
apply sumTo_congr
intro k
rw [hMM, rem_eq_mod]
-- ⟨t·da⟩ = d r
have hdr : (t * ((d'' + 1 + 1) * a)) % (h + h) = (d'' + 1 + 1) * r := by
have ⟨k, hk⟩ := decomp (t * a) (h + h) hM0
have ⟨e, he⟩ := Nat.le.dest hrq
apply mod_rep _ _ _ (s + (d'' + 1 + 1) * k)
· rw [← hm, ← he]
show (d'' + 1 + 1) * r < (d'' + 1 + 1) * (r + 1 + e)
rw [show (d'' + 1 + 1) * (r + 1 + e) = (d'' + 1 + 1) * r + (d'' + 1 + 1 + (d'' + 1 + 1) * e) by lib_nat]
exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos _) (Nat.le_add_right _ _))
· rw [show t * ((d'' + 1 + 1) * a) = (d'' + 1 + 1) * (t * a) by lib_nat, hk, hs, ← hm]
lib_nat
-- the pair: ⟨t·da⟩ + ⟨t(da + h)⟩ + ⟨tw⟩ = 3h
have hnd : (t * ((d'' + 1 + 1) * a)) % h ≠ 0 := by
intro z
have ⟨N, hN⟩ := decomp (t * ((d'' + 1 + 1) * a)) h hh
rw [z, Nat.zero_add] at hN
have ⟨k, hk⟩ := euclid t (h + h) h ((d'' + 1 + 1) * a) hg ⟨N, hN⟩ ⟨2 * ((d'' + 1 + 1) * a), by lib_nat⟩
exact not_dvd_small h _ k ha hah hk
have hdup := tsum_dup h ((d'' + 1 + 1) * a) w t hh hw ht hnd
rw [hdr] at hdup
-- assemble
show Nat.beq (tsum (h + h) t (apL (d'' + 1 + 1) a (q' + 1) ++ [(d'' + 1 + 1) * a + h, w])
+ tsum (h + h) t (apL (d'' + 1 + 1) a (q' + 1) ++ [(d'' + 1 + 1) * a + h, w]))
((apL (d'' + 1 + 1) a (q' + 1) ++ [(d'' + 1 + 1) * a + h, w]).length * (h + h)) = true
have hlen : (apL (d'' + 1 + 1) a (q' + 1) ++ [(d'' + 1 + 1) * a + h, w]).length = d'' + 1 + 1 + 2 := by
have e : ∀ L : List Nat, (L ++ [(d'' + 1 + 1) * a + h, w]).length = L.length + 2 := by
intro L; induction L with
| nil => rfl
| cons x L ihL => show (L ++ _).length + 1 = L.length + 1 + 2; rw [ihL]
rw [e, len_apL]
rw [hlen, tsum_append, hap]
show Nat.beq ((d'' + 1 + 1) * r + (q' + 1) * sumTo (d'' + 1 + 1) (fun j => j)
+ ((t * ((d'' + 1 + 1) * a + h)) % (h + h) + ((t * w) % (h + h) + 0))
+ ((d'' + 1 + 1) * r + (q' + 1) * sumTo (d'' + 1 + 1) (fun j => j)
+ ((t * ((d'' + 1 + 1) * a + h)) % (h + h) + ((t * w) % (h + h) + 0))))
((d'' + 1 + 1 + 2) * (h + h)) = true
have two := two_sum (d'' + 1 + 1)
generalize sumTo (d'' + 1 + 1) (fun j => j) = S at two ⊢
generalize (t * ((d'' + 1 + 1) * a + h)) % (h + h) = P at hdup ⊢
generalize (t * w) % (h + h) = W at hdup ⊢
have goal : (d'' + 1 + 1) * r + (q' + 1) * S + (P + (W + 0)) + ((d'' + 1 + 1) * r + (q' + 1) * S + (P + (W + 0)))
= (d'' + 1 + 1 + 2) * (h + h) := by
have e1 : (d'' + 1 + 1) * r + (q' + 1) * S + (P + (W + 0)) + ((d'' + 1 + 1) * r + (q' + 1) * S + (P + (W + 0)))
= ((d'' + 1 + 1) * r + (P + W)) + ((d'' + 1 + 1) * r + (P + W)) + (q' + 1) * (S + S) := by lib_nat
have e2 : (d'' + 1 + 1 + 2) * (h + h) = (h + h + h) + (h + h + h) + (q' + 1) * (S + S) := by
have e3 : (d'' + 1 + 1) * (h + h) = (q' + 1) * (S + S + (d'' + 1 + 1)) := by
rw [two, ← hm]; lib_nat
rw [show (d'' + 1 + 1 + 2) * (h + h) = (d'' + 1 + 1) * (h + h) + (h + h) + (h + h) by lib_nat, e3,
show (q' + 1) * (S + S + (d'' + 1 + 1)) = (q' + 1) * (S + S) + (d'' + 1 + 1) * (q' + 1) by lib_nat, hm]
lib_nat
rw [e1, e2, hdup]
rw [goal]; exact beq_self _
end APDouble
#print axioms APDouble.tsum_apL
#print axioms APDouble.unit_d
#print axioms APDouble.ap_double_bal
lean_all/hodge/APDouble2.lean
/-
hodge/APDouble2.lean — T41 cycle 299 (goal G42): the d = 2 APDouble character [1, 1+h, 2+h, 2h−4] (length 4, m = 2h)
is balanced and irreducible for every h ≥ 5 (h = 5 + r), by APDouble.ap_double_bal and the t = 1 reflection.
(Length 4 = Fermat surfaces, where these classes are algebraic by Lefschetz (1,1).)
-/
import hodge.APDouble
import hodge.APPairIrrGen
namespace APDouble2
open Indecomp APPairIrrGen APDouble
def co2 : List (Nat × Nat) := [(1, 0), (6, 1), (7, 1), (6, 2)]
theorem co2_ok : co2.all (small 10 2) = true ∧ (splitsG co2).all (chkSplit 10 2) = true := ⟨rfl, rfl⟩
theorem d2_list (r : Nat) : apL (0 + 1 + 1) 1 (4 + r + 1) ++ [(0 + 1 + 1) * 1 + (5 + r), 6 + 2 * r] = co2.map (ev r) := by
show [1 + 0 * (4 + r + 1), 1 + 1 * (4 + r + 1), (0 + 1 + 1) * 1 + (5 + r), 6 + 2 * r]
= [1 + 0 * r, 6 + 1 * r, 7 + 1 * r, 6 + 2 * r]
rw [show 1 + 0 * (4 + r + 1) = 1 + 0 * r by lib_nat, show 1 + 1 * (4 + r + 1) = 6 + 1 * r by lib_nat,
show (0 + 1 + 1) * 1 + (5 + r) = 7 + 1 * r by lib_nat]
theorem d2_both (r : Nat) :
bal (5 + r + (5 + r)) (co2.map (ev r)) = true ∧ indec (8 + 2 * r + 2) (co2.map (ev r)) = true := by
refine ⟨?_, indec_lin _ 10 2 r (by lib_nat) co2 co2_ok.1 co2_ok.2⟩
rw [← d2_list r]
exact ap_double_bal 0 (4 + r) (5 + r) 1 (6 + 2 * r) (by lib_nat)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [show 5 + r = (0 + 1 + 1) * 1 + (1 + (2 + r)) by lib_nat]
exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(by lib_nat)
end APDouble2
#print axioms APDouble2.d2_both
lean_all/hodge/APDoubleAll.lean
/-
hodge/APDoubleAll.lean — T41 cycle 289 (goal G32): the AP_d + duplication-pair characters (a = 1) are balanced and
irreducible, symbolically in r: d = 3 (m = 30 + 6r), d = 6 (m = 78 + 6r), d = 8 (m = 128 + 8r). Balance from
APDouble.ap_double_bal, irreducibility from APDoubleIrr; the lists are matched by NatNorm.
-/
import hodge.APDouble
import hodge.APDoubleIrr
namespace APDoubleAll
open Indecomp APPairIrrGen APDouble
theorem d3_list (r : Nat) : apL (1 + 1 + 1) 1 (9 + 2 * r + 1) ++ [(1 + 1 + 1) * 1 + (15 + 3 * r), 24 + 6 * r]
= APDoubleIrr.co3.map (ev r) := by
show [1 + 0 * (9 + 2 * r + 1), 1 + 1 * (9 + 2 * r + 1), 1 + 2 * (9 + 2 * r + 1), (1 + 1 + 1) * 1 + (15 + 3 * r), 24 + 6 * r] = [1 + 0 * r, 11 + 2 * r, 21 + 4 * r, 18 + 3 * r, 24 + 6 * r]
rw [(show 1 + 0*(9 + 2*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 9) (.mul (.lit 2) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(9 + 2*(r) + 1) = 11 + 2*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 9) (.mul (.lit 2) (.var 0))) (.lit 1)))) (.add (.lit 11) (.mul (.lit 2) (.var 0))) -- (+431 chars; full line in the Zenodo source)
/-- **d = 3: balanced and irreducible.** -/
theorem d3_both (r : Nat) :
bal (15 + 3 * r + (15 + 3 * r)) (APDoubleIrr.co3.map (ev r)) = true ∧
indec (28 + 6 * r + 2) (APDoubleIrr.co3.map (ev r)) = true := by
refine ⟨?_, APDoubleIrr.d3_indec r⟩
rw [← d3_list r]
exact ap_double_bal 1 (9 + 2 * r) (15 + 3 * r) 1 (24 + 6 * r)
(show (1 + 1 + 1)*(9 + 2*(r) + 1) = 15 + 3*(r) + (15 + 3*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.add (.add (.lit 9) (.mul (.lit 2) (.var 0))) (.lit 1))) (.add (.add (.lit 15) (.mul (.lit 3) (.var 0))) (.add (.lit 15) (.mul (.lit 3) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (15 + 3*(r)) = (1 + 1 + 1)*1 + (1 + (11 + 3*(r))) from NatNorm.sound [r] (.add (.lit 15) (.mul (.lit 3) (.var 0))) (.add (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 11) (.mul (.lit 3) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (1 + 1 + 1)*1 + (1 + 1 + 1)*1 + (24 + 6*(r)) = 15 + 3*(r) + (15 + 3*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 24) (.mul (.lit 6) (.var 0)))) (.add (.add (.lit 15) (.mul (.lit 3) (.var 0))) (.add (.lit 15) (.mul (.lit 3) (.var 0)))) rfl)
set_option maxHeartbeats 4000000 in
theorem d6_list (r : Nat) : apL (4 + 1 + 1) 1 (12 + 1 * r + 1) ++ [(4 + 1 + 1) * 1 + (39 + 3 * r), 66 + 6 * r]
= APDoubleIrr.co6.map (ev r) := by
show [1 + 0 * (12 + 1 * r + 1), 1 + 1 * (12 + 1 * r + 1), 1 + 2 * (12 + 1 * r + 1), 1 + 3 * (12 + 1 * r + 1), 1 + 4 * (12 + 1 * r + 1), 1 + 5 * (12 + 1 * r + 1), (4 + 1 + 1) * 1 + (39 + 3 * r), 66 + 6 * r] = [1 + 0 * r, 14 + 1 * r, 27 + 2 * r, 40 + 3 * r, 53 + 4 * r, 66 + 5 * r, 45 + 3 * r, 66 + 6 * r]
rw [(show 1 + 0*(12 + 1*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 12) (.mul (.lit 1) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(12 + 1*(r) + 1) = 14 + 1*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 12) (.mul (.lit 1) (.var 0))) (.lit 1)))) (.add (.lit 14) (.mul (.lit 1) (.var 0 -- (+1046 chars; full line in the Zenodo source)
/-- **d = 6: balanced and irreducible.** -/
theorem d6_both (r : Nat) :
bal (39 + 3 * r + (39 + 3 * r)) (APDoubleIrr.co6.map (ev r)) = true ∧
indec (76 + 6 * r + 2) (APDoubleIrr.co6.map (ev r)) = true := by
refine ⟨?_, APDoubleIrr.d6_indec r⟩
rw [← d6_list r]
exact ap_double_bal 4 (12 + 1 * r) (39 + 3 * r) 1 (66 + 6 * r)
(show (4 + 1 + 1)*(12 + 1*(r) + 1) = 39 + 3*(r) + (39 + 3*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.add (.add (.lit 12) (.mul (.lit 1) (.var 0))) (.lit 1))) (.add (.add (.lit 39) (.mul (.lit 3) (.var 0))) (.add (.lit 39) (.mul (.lit 3) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (39 + 3*(r)) = (4 + 1 + 1)*1 + (1 + (32 + 3*(r))) from NatNorm.sound [r] (.add (.lit 39) (.mul (.lit 3) (.var 0))) (.add (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 32) (.mul (.lit 3) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (4 + 1 + 1)*1 + (4 + 1 + 1)*1 + (66 + 6*(r)) = 39 + 3*(r) + (39 + 3*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 66) (.mul (.lit 6) (.var 0)))) (.add (.add (.lit 39) (.mul (.lit 3) (.var 0))) (.add (.lit 39) (.mul (.lit 3) (.var 0)))) rfl)
set_option maxHeartbeats 4000000 in
theorem d8_list (r : Nat) : apL (6 + 1 + 1) 1 (15 + 1 * r + 1) ++ [(6 + 1 + 1) * 1 + (64 + 4 * r), 112 + 8 * r]
= APDoubleIrr.co8.map (ev r) := by
show [1 + 0 * (15 + 1 * r + 1), 1 + 1 * (15 + 1 * r + 1), 1 + 2 * (15 + 1 * r + 1), 1 + 3 * (15 + 1 * r + 1), 1 + 4 * (15 + 1 * r + 1), 1 + 5 * (15 + 1 * r + 1), 1 + 6 * (15 + 1 * r + 1), 1 + 7 * (15 + 1 * r + 1), (6 + 1 + 1) * 1 + (64 + 4 * r), 112 + 8 * r] = [1 + 0 * r, 17 + 1 * r, 33 + 2 * r, 49 + 3 * r, 65 + 4 * r, 81 + 5 * r, 97 + 6 * r, 113 + 7 * r, 72 + 4 * r, 112 + 8 * r]
rw [(show 1 + 0*(15 + 1*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 15) (.mul (.lit 1) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(15 + 1*(r) + 1) = 17 + 1*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 15) (.mul (.lit 1) (.var 0))) (.lit 1)))) (.add (.lit 17) (.mul (.lit 1) (.var 0 -- (+1454 chars; full line in the Zenodo source)
/-- **d = 8: balanced and irreducible.** -/
theorem d8_both (r : Nat) :
bal (64 + 4 * r + (64 + 4 * r)) (APDoubleIrr.co8.map (ev r)) = true ∧
indec (126 + 8 * r + 2) (APDoubleIrr.co8.map (ev r)) = true := by
refine ⟨?_, APDoubleIrr.d8_indec r⟩
rw [← d8_list r]
exact ap_double_bal 6 (15 + 1 * r) (64 + 4 * r) 1 (112 + 8 * r)
(show (6 + 1 + 1)*(15 + 1*(r) + 1) = 64 + 4*(r) + (64 + 4*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 6) (.lit 1)) (.lit 1)) (.add (.add (.lit 15) (.mul (.lit 1) (.var 0))) (.lit 1))) (.add (.add (.lit 64) (.mul (.lit 4) (.var 0))) (.add (.lit 64) (.mul (.lit 4) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (64 + 4*(r)) = (6 + 1 + 1)*1 + (1 + (55 + 4*(r))) from NatNorm.sound [r] (.add (.lit 64) (.mul (.lit 4) (.var 0))) (.add (.mul (.add (.add (.lit 6) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 55) (.mul (.lit 4) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (6 + 1 + 1)*1 + (6 + 1 + 1)*1 + (112 + 8*(r)) = 64 + 4*(r) + (64 + 4*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 6) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 6) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 112) (.mul (.lit 8) (.var 0)))) (.add (.add (.lit 64) (.mul (.lit 4) (.var 0))) (.add (.lit 64) (.mul (.lit 4) (.var 0)))) rfl)
end APDoubleAll
#print axioms APDoubleAll.d3_both
#print axioms APDoubleAll.d6_both
#print axioms APDoubleAll.d8_both
lean_all/hodge/APDoubleAll5.lean
/-
hodge/APDoubleAll5.lean — T41 cycle 290 (goal G33): the d = 5 APDouble character (a = 1) is balanced and
irreducible for every p ≥ 9: m = 100 + 20r (p = 10 + 2r) and m = 90 + 20r (p = 9 + 2r).
-/
import hodge.APDouble
import hodge.APDoubleIrr5
namespace APDoubleAll5
open Indecomp APPairIrrGen APDouble APDoubleIrr5
set_option maxHeartbeats 4000000 in
theorem d5e_list (r : Nat) : apL (3 + 1 + 1) 1 (19 + 4 * r + 1) ++ [(3 + 1 + 1) * 1 + (50 + 10 * r), 90 + 20 * r]
= APDoubleIrr5.coE.map (evE r) := by
show [1 + 0 * (19 + 4 * r + 1), 1 + 1 * (19 + 4 * r + 1), 1 + 2 * (19 + 4 * r + 1), 1 + 3 * (19 + 4 * r + 1), 1 + 4 * (19 + 4 * r + 1), (3 + 1 + 1) * 1 + (50 + 10 * r), 90 + 20 * r] = [1 + 0 * r, 21 + 4 * r, 41 + 8 * r, 61 + 12 * r, 81 + 16 * r, 55 + 10 * r, 90 + 20 * r]
rw [(show 1 + 0*(19 + 4*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 19) (.mul (.lit 4) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(19 + 4*(r) + 1) = 21 + 4*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 19) (.mul (.lit 4) (.var 0))) (.lit 1)))) (.add (.lit 21) (.mul (.lit 4) (.var 0 -- (+851 chars; full line in the Zenodo source)
theorem d5e_both (r : Nat) :
bal (50 + 10 * r + (50 + 10 * r)) (APDoubleIrr5.coE.map (evE r)) = true ∧
indec (98 + 20 * r + 2) (APDoubleIrr5.coE.map (evE r)) = true := by
refine ⟨?_, APDoubleIrr5.d5_even r⟩
rw [← d5e_list r]
exact ap_double_bal 3 (19 + 4 * r) (50 + 10 * r) 1 (90 + 20 * r)
(show (3 + 1 + 1)*(19 + 4*(r) + 1) = 50 + 10*(r) + (50 + 10*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.add (.add (.lit 19) (.mul (.lit 4) (.var 0))) (.lit 1))) (.add (.add (.lit 50) (.mul (.lit 10) (.var 0))) (.add (.lit 50) (.mul (.lit 10) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (50 + 10*(r)) = (3 + 1 + 1)*1 + (1 + (44 + 10*(r))) from NatNorm.sound [r] (.add (.lit 50) (.mul (.lit 10) (.var 0))) (.add (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 44) (.mul (.lit 10) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (3 + 1 + 1)*1 + (3 + 1 + 1)*1 + (90 + 20*(r)) = 50 + 10*(r) + (50 + 10*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 90) (.mul (.lit 20) (.var 0)))) (.add (.add (.lit 50) (.mul (.lit 10) (.var 0))) (.add (.lit 50) (.mul (.lit 10) (.var 0)))) rfl)
set_option maxHeartbeats 4000000 in
theorem d5o_list (r : Nat) : apL (3 + 1 + 1) 1 (17 + 4 * r + 1) ++ [(3 + 1 + 1) * 1 + (45 + 10 * r), 80 + 20 * r]
= APDoubleIrr5.coO.map (evE r) := by
show [1 + 0 * (17 + 4 * r + 1), 1 + 1 * (17 + 4 * r + 1), 1 + 2 * (17 + 4 * r + 1), 1 + 3 * (17 + 4 * r + 1), 1 + 4 * (17 + 4 * r + 1), (3 + 1 + 1) * 1 + (45 + 10 * r), 80 + 20 * r] = [1 + 0 * r, 19 + 4 * r, 37 + 8 * r, 55 + 12 * r, 73 + 16 * r, 50 + 10 * r, 80 + 20 * r]
rw [(show 1 + 0*(17 + 4*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 17) (.mul (.lit 4) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(17 + 4*(r) + 1) = 19 + 4*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 17) (.mul (.lit 4) (.var 0))) (.lit 1)))) (.add (.lit 19) (.mul (.lit 4) (.var 0 -- (+851 chars; full line in the Zenodo source)
theorem d5o_both (r : Nat) :
bal (45 + 10 * r + (45 + 10 * r)) (APDoubleIrr5.coO.map (evE r)) = true ∧
indec (88 + 20 * r + 2) (APDoubleIrr5.coO.map (evE r)) = true := by
refine ⟨?_, APDoubleIrr5.d5_odd r⟩
rw [← d5o_list r]
exact ap_double_bal 3 (17 + 4 * r) (45 + 10 * r) 1 (80 + 20 * r)
(show (3 + 1 + 1)*(17 + 4*(r) + 1) = 45 + 10*(r) + (45 + 10*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.add (.add (.lit 17) (.mul (.lit 4) (.var 0))) (.lit 1))) (.add (.add (.lit 45) (.mul (.lit 10) (.var 0))) (.add (.lit 45) (.mul (.lit 10) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (45 + 10*(r)) = (3 + 1 + 1)*1 + (1 + (39 + 10*(r))) from NatNorm.sound [r] (.add (.lit 45) (.mul (.lit 10) (.var 0))) (.add (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 39) (.mul (.lit 10) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (3 + 1 + 1)*1 + (3 + 1 + 1)*1 + (80 + 20*(r)) = 45 + 10*(r) + (45 + 10*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 3) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 80) (.mul (.lit 20) (.var 0)))) (.add (.add (.lit 45) (.mul (.lit 10) (.var 0))) (.add (.lit 45) (.mul (.lit 10) (.var 0)))) rfl)
end APDoubleAll5
#print axioms APDoubleAll5.d5e_both
#print axioms APDoubleAll5.d5o_both
lean_all/hodge/APDoubleGenA.lean
/-
hodge/APDoubleGenA.lean — T41 cycle 292 (goal G35): the APDouble character is balanced and irreducible for every
start a ≥ 1, d = 2, 3, 6 here (7, 8: APDoubleGenA2, Kamiak), q = q₀a + q₁r: with every entry homogeneous in (a, r) the coefficient lists of
APDoubleIrr/APDoubleMore serve unchanged (APPairIrrGen2.indec_lin2), and APDouble.ap_double_bal gives the balance.
-/
import hodge.APDoubleAll
import hodge.APDoubleMore
import hodge.APPairIrrGen2
import hodge.APDouble2
import lib.Semi
namespace APDoubleGenA
open Indecomp APPairIrrGen APPairIrrGen2 APDouble
set_option maxHeartbeats 8000000 in
set_option maxRecDepth 200000 in
theorem d3_list (k r : Nat) : apL (1 + 1 + 1) (k + 1) (10 * k + 2 * r + 9 + 1) ++ [(1 + 1 + 1) * (k + 1) + (15 * (k + 1) + 3 * r), 24 * (k + 1) + 6 * r]
= APDoubleIrr.co3.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (10 * k + 2 * r + 9 + 1), (k + 1) + 1 * (10 * k + 2 * r + 9 + 1), (k + 1) + 2 * (10 * k + 2 * r + 9 + 1), (1 + 1 + 1) * (k + 1) + (15 * (k + 1) + 3 * r), 24 * (k + 1) + 6 * r] = [1 * (k + 1) + 0 * r, 11 * (k + 1) + 2 * r, 21 * (k + 1) + 4 * r, 18 * (k + 1) + 3 * r, 24 * (k + 1) + 6 * r]
rw [(show ((k) + 1) + 0*(10*(k) + 2*(r) + 9 + 1) = 1*((k) + 1) + 0*(r) from NatNorm.sound [k, r] (.add (.add (.var 0) (.lit 1)) (.mul (.lit 0) (.add (.add (.add (.mul (.lit 10) (.var 0)) (.mul (.lit 2) (.var 1))) (.lit 9)) (.lit 1)))) (.add (.mul (.lit 1) (.add (.var 0) (.lit 1))) (.mul (.lit 0) (.var 1))) rfl), (show ((k) + 1) + 1*(10*(k) + 2*(r) + 9 + 1) = 11*((k) + 1) + 2*(r) from NatNorm.sou -- (+875 chars; full line in the Zenodo source)
set_option maxRecDepth 200000 in
/-- **d = 3, start a = k + 1, q = 10a + 2r: balanced and irreducible.** -/
theorem d3_both (k r : Nat) :
bal ((15 * (k + 1) + 3 * r) + (15 * (k + 1) + 3 * r)) (APDoubleIrr.co3.map (ev2 (k + 1) r)) = true ∧
indec (30 * k + 6 * r + 28 + 2) (APDoubleIrr.co3.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 30 6 (k + 1) r (Nat.succ_pos k)
(show 30*((k) + 1) + 6*(r) = 30*(k) + 6*(r) + 28 + 2 from NatNorm.sound [k, r] (.add (.mul (.lit 30) (.add (.var 0) (.lit 1))) (.mul (.lit 6) (.var 1))) (.add (.add (.add (.mul (.lit 30) (.var 0)) (.mul (.lit 6) (.var 1))) (.lit 28)) (.lit 2)) rfl) APDoubleIrr.co3 APDoubleIrr.co3_ok.1 APDoubleIrr.co3_ok.2⟩
rw [← d3_list k r]
exact ap_double_bal 1 (10 * k + 2 * r + 9) (15 * (k + 1) + 3 * r) (k + 1) (24 * (k + 1) + 6 * r)
(show (1 + 1 + 1)*(10*(k) + 2*(r) + 9 + 1) = 15*((k) + 1) + 3*(r) + (15*((k) + 1) + 3*(r)) from NatNorm.sound [k, r] (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.add (.add (.add (.mul (.lit 10) (.var 0)) (.mul (.lit 2) (.var 1))) (.lit 9)) (.lit 1))) (.add (.add (.mul (.lit 15) (.add (.var 0) (.lit 1))) (.mul (.lit 3) (.var 1))) (.add (.mul (.lit 15) (.add (.var 0) (.lit 1))) (.mul (.lit 3 -- (+18 chars; full line in the Zenodo source)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [(show (1 + 1 + 1)*((k) + 1) = 1 + (2 + 3*(k)) from NatNorm.sound [k] (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.lit 2) (.mul (.lit 3) (.var 0)))) rfl)]; exact Nat.le_add_right 1 _))
(by rw [(show 15*((k) + 1) + 3*(r) = (1 + 1 + 1)*((k) + 1) + (1 + (11 + 12*(k) + 3*(r))) from NatNorm.sound [k, r] (.add (.mul (.lit 15) (.add (.var 0) (.lit 1))) (.mul (.lit 3) (.var 1))) (.add (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.add (.lit 11) (.mul (.lit 12) (.var 0))) (.mul (.lit 3) (.var 1))))) rfl)]; exact Nat.lt_add_of_pos_right -- (+62 chars; full line in the Zenodo source)
(show (1 + 1 + 1)*((k) + 1) + (1 + 1 + 1)*((k) + 1) + (24*((k) + 1) + 6*(r)) = 15*((k) + 1) + 3*(r) + (15*((k) + 1) + 3*(r)) from NatNorm.sound [k, r] (.add (.add (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1))) (.mul (.add (.add (.lit 1) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1)))) (.add (.mul (.lit 24) (.add (.var 0) (.lit 1))) (.mul (.lit 6) (.var 1)))) (.add (.add -- (+148 chars; full line in the Zenodo source)
set_option maxHeartbeats 8000000 in
set_option maxRecDepth 200000 in
theorem d6_list (k r : Nat) : apL (4 + 1 + 1) (k + 1) (13 * k + 1 * r + 12 + 1) ++ [(4 + 1 + 1) * (k + 1) + (39 * (k + 1) + 3 * r), 66 * (k + 1) + 6 * r]
= APDoubleIrr.co6.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (13 * k + 1 * r + 12 + 1), (k + 1) + 1 * (13 * k + 1 * r + 12 + 1), (k + 1) + 2 * (13 * k + 1 * r + 12 + 1), (k + 1) + 3 * (13 * k + 1 * r + 12 + 1), (k + 1) + 4 * (13 * k + 1 * r + 12 + 1), (k + 1) + 5 * (13 * k + 1 * r + 12 + 1), (4 + 1 + 1) * (k + 1) + (39 * (k + 1) + 3 * r), 66 * (k + 1) + 6 * r] = [1 * (k + 1) + 0 * r, 14 * (k + 1) + 1 * r, 27 * (k + 1) + 2 * r, 40 * (k -- (+101 chars; full line in the Zenodo source)
rw [(show ((k) + 1) + 0*(13*(k) + 1*(r) + 12 + 1) = 1*((k) + 1) + 0*(r) from NatNorm.sound [k, r] (.add (.add (.var 0) (.lit 1)) (.mul (.lit 0) (.add (.add (.add (.mul (.lit 13) (.var 0)) (.mul (.lit 1) (.var 1))) (.lit 12)) (.lit 1)))) (.add (.mul (.lit 1) (.add (.var 0) (.lit 1))) (.mul (.lit 0) (.var 1))) rfl), (show ((k) + 1) + 1*(13*(k) + 1*(r) + 12 + 1) = 14*((k) + 1) + 1*(r) from NatNorm. -- (+1823 chars; full line in the Zenodo source)
set_option maxRecDepth 200000 in
/-- **d = 6, start a = k + 1, q = 13a + 1r: balanced and irreducible.** -/
theorem d6_both (k r : Nat) :
bal ((39 * (k + 1) + 3 * r) + (39 * (k + 1) + 3 * r)) (APDoubleIrr.co6.map (ev2 (k + 1) r)) = true ∧
indec (78 * k + 6 * r + 76 + 2) (APDoubleIrr.co6.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 78 6 (k + 1) r (Nat.succ_pos k)
(show 78*((k) + 1) + 6*(r) = 78*(k) + 6*(r) + 76 + 2 from NatNorm.sound [k, r] (.add (.mul (.lit 78) (.add (.var 0) (.lit 1))) (.mul (.lit 6) (.var 1))) (.add (.add (.add (.mul (.lit 78) (.var 0)) (.mul (.lit 6) (.var 1))) (.lit 76)) (.lit 2)) rfl) APDoubleIrr.co6 APDoubleIrr.co6_ok.1 APDoubleIrr.co6_ok.2⟩
rw [← d6_list k r]
exact ap_double_bal 4 (13 * k + 1 * r + 12) (39 * (k + 1) + 3 * r) (k + 1) (66 * (k + 1) + 6 * r)
(show (4 + 1 + 1)*(13*(k) + 1*(r) + 12 + 1) = 39*((k) + 1) + 3*(r) + (39*((k) + 1) + 3*(r)) from NatNorm.sound [k, r] (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.add (.add (.add (.mul (.lit 13) (.var 0)) (.mul (.lit 1) (.var 1))) (.lit 12)) (.lit 1))) (.add (.add (.mul (.lit 39) (.add (.var 0) (.lit 1))) (.mul (.lit 3) (.var 1))) (.add (.mul (.lit 39) (.add (.var 0) (.lit 1))) (.mul (.lit -- (+20 chars; full line in the Zenodo source)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [(show (4 + 1 + 1)*((k) + 1) = 1 + (5 + 6*(k)) from NatNorm.sound [k] (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.lit 5) (.mul (.lit 6) (.var 0)))) rfl)]; exact Nat.le_add_right 1 _))
(by rw [(show 39*((k) + 1) + 3*(r) = (4 + 1 + 1)*((k) + 1) + (1 + (32 + 33*(k) + 3*(r))) from NatNorm.sound [k, r] (.add (.mul (.lit 39) (.add (.var 0) (.lit 1))) (.mul (.lit 3) (.var 1))) (.add (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.add (.lit 32) (.mul (.lit 33) (.var 0))) (.mul (.lit 3) (.var 1))))) rfl)]; exact Nat.lt_add_of_pos_right -- (+62 chars; full line in the Zenodo source)
(show (4 + 1 + 1)*((k) + 1) + (4 + 1 + 1)*((k) + 1) + (66*((k) + 1) + 6*(r)) = 39*((k) + 1) + 3*(r) + (39*((k) + 1) + 3*(r)) from NatNorm.sound [k, r] (.add (.add (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1))) (.mul (.add (.add (.lit 4) (.lit 1)) (.lit 1)) (.add (.var 0) (.lit 1)))) (.add (.mul (.lit 66) (.add (.var 0) (.lit 1))) (.mul (.lit 6) (.var 1)))) (.add (.add -- (+148 chars; full line in the Zenodo source)
/-- **d = 2, start a = k + 1, h = 5a + r: balanced and irreducible.** -/
theorem d2_both (k r : Nat) :
bal ((5 * (k + 1) + r) + (5 * (k + 1) + r)) (APDouble2.co2.map (ev2 (k + 1) r)) = true ∧
indec (10 * k + 2 * r + 8 + 2) (APDouble2.co2.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 10 2 (k + 1) r (Nat.succ_pos k) (by lib_nat) APDouble2.co2
APDouble2.co2_ok.1 APDouble2.co2_ok.2⟩
have hl : apL (0 + 1 + 1) (k + 1) (5 * k + r + 4 + 1) ++ [(0 + 1 + 1) * (k + 1) + (5 * (k + 1) + r), 6 * (k + 1) + 2 * r]
= APDouble2.co2.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (5 * k + r + 4 + 1), (k + 1) + 1 * (5 * k + r + 4 + 1),
(0 + 1 + 1) * (k + 1) + (5 * (k + 1) + r), 6 * (k + 1) + 2 * r]
= [1 * (k + 1) + 0 * r, 6 * (k + 1) + 1 * r, 7 * (k + 1) + 1 * r, 6 * (k + 1) + 2 * r]
rw [show (k + 1) + 0 * (5 * k + r + 4 + 1) = 1 * (k + 1) + 0 * r by lib_nat,
show (k + 1) + 1 * (5 * k + r + 4 + 1) = 6 * (k + 1) + 1 * r by lib_nat,
show (0 + 1 + 1) * (k + 1) + (5 * (k + 1) + r) = 7 * (k + 1) + 1 * r by lib_nat]
rw [← hl]
exact ap_double_bal 0 (5 * k + r + 4) (5 * (k + 1) + r) (k + 1) (6 * (k + 1) + 2 * r) (by lib_nat)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [show (0 + 1 + 1) * (k + 1) = 1 + (1 + 2 * k) by lib_nat]; exact Nat.le_add_right 1 _))
(by rw [show 5 * (k + 1) + r = (0 + 1 + 1) * (k + 1) + (1 + (2 + 3 * k + r)) by lib_nat]
exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(by lib_nat)
end APDoubleGenA
#print axioms APDoubleGenA.d3_both
#print axioms APDoubleGenA.d6_both
#print axioms APDoubleGenA.d2_both
lean_all/hodge/APDoubleGenA2.lean
/-
hodge/APDoubleGenA2.lean — T41 cycle 292 (goal G35, Kamiak part): the APDouble character is balanced and irreducible for every
start a ≥ 1, d = 7, 8 (d = 9, 10: kernel timeout on the list matching), q = q₀a + q₁r: with every entry homogeneous in (a, r) the coefficient lists of
APDoubleIrr/APDoubleMore serve unchanged (APPairIrrGen2.indec_lin2), and APDouble.ap_double_bal gives the balance.
-/
import hodge.APDoubleAll
import hodge.APDoubleMore
import hodge.APPairIrrGen2
import lib.Semi
namespace APDoubleGenA2
open Indecomp APPairIrrGen APPairIrrGen2 APDouble
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d7_list (k r : Nat) : apL (5 + 1 + 1) (k + 1) (26 * k + 2 * r + 25 + 1) ++ [(5 + 1 + 1) * (k + 1) + (91 * (k + 1) + 7 * r), 168 * (k + 1) + 14 * r]
= APDoubleMore.co7.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (26 * k + 2 * r + 25 + 1), (k + 1) + 1 * (26 * k + 2 * r + 25 + 1), (k + 1) + 2 * (26 * k + 2 * r + 25 + 1), (k + 1) + 3 * (26 * k + 2 * r + 25 + 1), (k + 1) + 4 * (26 * k + 2 * r + 25 + 1), (k + 1) + 5 * (26 * k + 2 * r + 25 + 1), (k + 1) + 6 * (26 * k + 2 * r + 25 + 1), (5 + 1 + 1) * (k + 1) + (91 * (k + 1) + 7 * r), 168 * (k + 1) + 14 * r] = [1 * (k + 1) + 0 * r, 27 * (k + -- (+173 chars; full line in the Zenodo source)
rw [(show ((k) + 1) + 0*(26*(k) + 2*(r) + 25 + 1) = 1*((k) + 1) + 0*(r) by lib_nat), (show ((k) + 1) + 1*(26*(k) + 2*(r) + 25 + 1) = 27*((k) + 1) + 2*(r) by lib_nat), (show ((k) + 1) + 2*(26*(k) + 2*(r) + 25 + 1) = 53*((k) + 1) + 4*(r) by lib_nat), (show ((k) + 1) + 3*(26*(k) + 2*(r) + 25 + 1) = 79*((k) + 1) + 6*(r) by lib_nat), (show ((k) + 1) + 4*(26*(k) + 2*(r) + 25 + 1) = 105*((k) + 1) + 8*( -- (+272 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
/-- **d = 7, start a = k + 1, q = 26a + 2r: balanced and irreducible.** -/
theorem d7_both (k r : Nat) :
bal ((91 * (k + 1) + 7 * r) + (91 * (k + 1) + 7 * r)) (APDoubleMore.co7.map (ev2 (k + 1) r)) = true ∧
indec (182 * k + 14 * r + 180 + 2) (APDoubleMore.co7.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 182 14 (k + 1) r (Nat.succ_pos k)
(show 182*((k) + 1) + 14*(r) = 182*(k) + 14*(r) + 180 + 2 by lib_nat) APDoubleMore.co7 APDoubleMore.co7_ok.1 APDoubleMore.co7_ok.2⟩
rw [← d7_list k r]
exact ap_double_bal 5 (26 * k + 2 * r + 25) (91 * (k + 1) + 7 * r) (k + 1) (168 * (k + 1) + 14 * r)
(show (5 + 1 + 1)*(26*(k) + 2*(r) + 25 + 1) = 91*((k) + 1) + 7*(r) + (91*((k) + 1) + 7*(r)) by lib_nat)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [(show (5 + 1 + 1)*((k) + 1) = 1 + (6 + 7*(k)) by lib_nat)]; exact Nat.le_add_right 1 _))
(by rw [(show 91*((k) + 1) + 7*(r) = (5 + 1 + 1)*((k) + 1) + (1 + (83 + 84*(k) + 7*(r))) by lib_nat)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (5 + 1 + 1)*((k) + 1) + (5 + 1 + 1)*((k) + 1) + (168*((k) + 1) + 14*(r)) = 91*((k) + 1) + 7*(r) + (91*((k) + 1) + 7*(r)) by lib_nat)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d8_list (k r : Nat) : apL (6 + 1 + 1) (k + 1) (16 * k + 1 * r + 15 + 1) ++ [(6 + 1 + 1) * (k + 1) + (64 * (k + 1) + 4 * r), 112 * (k + 1) + 8 * r]
= APDoubleIrr.co8.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (16 * k + 1 * r + 15 + 1), (k + 1) + 1 * (16 * k + 1 * r + 15 + 1), (k + 1) + 2 * (16 * k + 1 * r + 15 + 1), (k + 1) + 3 * (16 * k + 1 * r + 15 + 1), (k + 1) + 4 * (16 * k + 1 * r + 15 + 1), (k + 1) + 5 * (16 * k + 1 * r + 15 + 1), (k + 1) + 6 * (16 * k + 1 * r + 15 + 1), (k + 1) + 7 * (16 * k + 1 * r + 15 + 1), (6 + 1 + 1) * (k + 1) + (64 * (k + 1) + 4 * r), 112 * (k + 1) + -- (+230 chars; full line in the Zenodo source)
rw [(show ((k) + 1) + 0*(16*(k) + 1*(r) + 15 + 1) = 1*((k) + 1) + 0*(r) by lib_nat), (show ((k) + 1) + 1*(16*(k) + 1*(r) + 15 + 1) = 17*((k) + 1) + 1*(r) by lib_nat), (show ((k) + 1) + 2*(16*(k) + 1*(r) + 15 + 1) = 33*((k) + 1) + 2*(r) by lib_nat), (show ((k) + 1) + 3*(16*(k) + 1*(r) + 15 + 1) = 49*((k) + 1) + 3*(r) by lib_nat), (show ((k) + 1) + 4*(16*(k) + 1*(r) + 15 + 1) = 65*((k) + 1) + 4*(r -- (+350 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
/-- **d = 8, start a = k + 1, q = 16a + 1r: balanced and irreducible.** -/
theorem d8_both (k r : Nat) :
bal ((64 * (k + 1) + 4 * r) + (64 * (k + 1) + 4 * r)) (APDoubleIrr.co8.map (ev2 (k + 1) r)) = true ∧
indec (128 * k + 8 * r + 126 + 2) (APDoubleIrr.co8.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 128 8 (k + 1) r (Nat.succ_pos k)
(show 128*((k) + 1) + 8*(r) = 128*(k) + 8*(r) + 126 + 2 by lib_nat) APDoubleIrr.co8 APDoubleIrr.co8_ok.1 APDoubleIrr.co8_ok.2⟩
rw [← d8_list k r]
exact ap_double_bal 6 (16 * k + 1 * r + 15) (64 * (k + 1) + 4 * r) (k + 1) (112 * (k + 1) + 8 * r)
(show (6 + 1 + 1)*(16*(k) + 1*(r) + 15 + 1) = 64*((k) + 1) + 4*(r) + (64*((k) + 1) + 4*(r)) by lib_nat)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [(show (6 + 1 + 1)*((k) + 1) = 1 + (7 + 8*(k)) by lib_nat)]; exact Nat.le_add_right 1 _))
(by rw [(show 64*((k) + 1) + 4*(r) = (6 + 1 + 1)*((k) + 1) + (1 + (55 + 56*(k) + 4*(r))) by lib_nat)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (6 + 1 + 1)*((k) + 1) + (6 + 1 + 1)*((k) + 1) + (112*((k) + 1) + 8*(r)) = 64*((k) + 1) + 4*(r) + (64*((k) + 1) + 4*(r)) by lib_nat)
end APDoubleGenA2
#print axioms APDoubleGenA2.d7_both
#print axioms APDoubleGenA2.d8_both
lean_all/hodge/APDoubleGenA3.lean
/-
hodge/APDoubleGenA3.lean — T41 cycle 310 (goal G48): d = 9 (q = 34a + 2r) and d = 10 (q = 20a + r), every start
a ≥ 1: balanced and irreducible. As APDoubleGenA2, with the linear identities checked by lib/LinNorm (numeric
coefficients; NatNorm and lib_nat timed out in the kernel on the large numerals).
-/
import hodge.APDoubleMore
import hodge.APPairIrrGen2
import lib.LinNorm
namespace APDoubleGenA3
open Indecomp APPairIrrGen APPairIrrGen2 APDouble
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d9_list (k r : Nat) : apL (7 + 1 + 1) (k + 1) (34 * k + 2 * r + 33 + 1) ++ [(7 + 1 + 1) * (k + 1) + (153 * (k + 1) + 9 * r), 288 * (k + 1) + 18 * r]
= APDoubleMore.co9.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (34 * k + 2 * r + 33 + 1), (k + 1) + 1 * (34 * k + 2 * r + 33 + 1), (k + 1) + 2 * (34 * k + 2 * r + 33 + 1), (k + 1) + 3 * (34 * k + 2 * r + 33 + 1), (k + 1) + 4 * (34 * k + 2 * r + 33 + 1), (k + 1) + 5 * (34 * k + 2 * r + 33 + 1), (k + 1) + 6 * (34 * k + 2 * r + 33 + 1), (k + 1) + 7 * (34 * k + 2 * r + 33 + 1), (k + 1) + 8 * (34 * k + 2 * r + 33 + 1), (7 + 1 + 1) * (k + 1) + -- (+306 chars; full line in the Zenodo source)
rw [(show ((k) + 1) + 0*(34*(k) + 2*(r) + 33 + 1) = 1*((k) + 1) + 0*(r) from LinNorm.sound [k, r] 2 (.add (.add (.var 0) (.lit 1)) (.smul 0 (.add (.add (.add (.smul 34 (.var 0)) (.smul 2 (.var 1))) (.lit 33)) (.lit 1)))) (.add (.smul 1 (.add (.var 0) (.lit 1))) (.smul 0 (.var 1))) rfl), (show ((k) + 1) + 1*(34*(k) + 2*(r) + 33 + 1) = 35*((k) + 1) + 2*(r) from LinNorm.sound [k, r] 2 (.add (.add ( -- (+2477 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d9_both (k r : Nat) :
bal ((153 * (k + 1) + 9 * r) + (153 * (k + 1) + 9 * r)) (APDoubleMore.co9.map (ev2 (k + 1) r)) = true ∧
indec (306 * k + 18 * r + 304 + 2) (APDoubleMore.co9.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 306 18 (k + 1) r (Nat.succ_pos k)
(show 306*((k) + 1) + 18*(r) = 306*(k) + 18*(r) + 304 + 2 from LinNorm.sound [k, r] 2 (.add (.smul 306 (.add (.var 0) (.lit 1))) (.smul 18 (.var 1))) (.add (.add (.add (.smul 306 (.var 0)) (.smul 18 (.var 1))) (.lit 304)) (.lit 2)) rfl) APDoubleMore.co9 APDoubleMore.co9_ok.1 APDoubleMore.co9_ok.2⟩
rw [← d9_list k r]
exact ap_double_bal 7 (34 * k + 2 * r + 33) (153 * (k + 1) + 9 * r) (k + 1) (288 * (k + 1) + 18 * r)
(show (7 + 1 + 1)*(34*(k) + 2*(r) + 33 + 1) = 153*((k) + 1) + 9*(r) + (153*((k) + 1) + 9*(r)) from LinNorm.sound [k, r] 2 (.smul 9 (.add (.add (.add (.smul 34 (.var 0)) (.smul 2 (.var 1))) (.lit 33)) (.lit 1))) (.add (.add (.smul 153 (.add (.var 0) (.lit 1))) (.smul 9 (.var 1))) (.add (.smul 153 (.add (.var 0) (.lit 1))) (.smul 9 (.var 1)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [(show (7 + 1 + 1)*((k) + 1) = 1 + (8 + 9*(k)) from LinNorm.sound [k] 1 (.smul 9 (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.lit 8) (.smul 9 (.var 0)))) rfl)]; exact Nat.le_add_right 1 _))
(by rw [(show 153*((k) + 1) + 9*(r) = (7 + 1 + 1)*((k) + 1) + (1 + (143 + 144*(k) + 9*(r))) from LinNorm.sound [k, r] 2 (.add (.smul 153 (.add (.var 0) (.lit 1))) (.smul 9 (.var 1))) (.add (.smul 9 (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.add (.lit 143) (.smul 144 (.var 0))) (.smul 9 (.var 1))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_righ -- (+8 chars; full line in the Zenodo source)
(show (7 + 1 + 1)*((k) + 1) + (7 + 1 + 1)*((k) + 1) + (288*((k) + 1) + 18*(r)) = 153*((k) + 1) + 9*(r) + (153*((k) + 1) + 9*(r)) from LinNorm.sound [k, r] 2 (.add (.add (.smul 9 (.add (.var 0) (.lit 1))) (.smul 9 (.add (.var 0) (.lit 1)))) (.add (.smul 288 (.add (.var 0) (.lit 1))) (.smul 18 (.var 1)))) (.add (.add (.smul 153 (.add (.var 0) (.lit 1))) (.smul 9 (.var 1))) (.add (.smul 153 (.add -- (+46 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d10_list (k r : Nat) : apL (8 + 1 + 1) (k + 1) (20 * k + 1 * r + 19 + 1) ++ [(8 + 1 + 1) * (k + 1) + (100 * (k + 1) + 5 * r), 180 * (k + 1) + 10 * r]
= APDoubleMore.co10.map (ev2 (k + 1) r) := by
show [(k + 1) + 0 * (20 * k + 1 * r + 19 + 1), (k + 1) + 1 * (20 * k + 1 * r + 19 + 1), (k + 1) + 2 * (20 * k + 1 * r + 19 + 1), (k + 1) + 3 * (20 * k + 1 * r + 19 + 1), (k + 1) + 4 * (20 * k + 1 * r + 19 + 1), (k + 1) + 5 * (20 * k + 1 * r + 19 + 1), (k + 1) + 6 * (20 * k + 1 * r + 19 + 1), (k + 1) + 7 * (20 * k + 1 * r + 19 + 1), (k + 1) + 8 * (20 * k + 1 * r + 19 + 1), (k + 1) + 9 * (20 * k + -- (+364 chars; full line in the Zenodo source)
rw [(show ((k) + 1) + 0*(20*(k) + 1*(r) + 19 + 1) = 1*((k) + 1) + 0*(r) from LinNorm.sound [k, r] 2 (.add (.add (.var 0) (.lit 1)) (.smul 0 (.add (.add (.add (.smul 20 (.var 0)) (.smul 1 (.var 1))) (.lit 19)) (.lit 1)))) (.add (.smul 1 (.add (.var 0) (.lit 1))) (.smul 0 (.var 1))) rfl), (show ((k) + 1) + 1*(20*(k) + 1*(r) + 19 + 1) = 21*((k) + 1) + 1*(r) from LinNorm.sound [k, r] 2 (.add (.add ( -- (+2754 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d10_both (k r : Nat) :
bal ((100 * (k + 1) + 5 * r) + (100 * (k + 1) + 5 * r)) (APDoubleMore.co10.map (ev2 (k + 1) r)) = true ∧
indec (200 * k + 10 * r + 198 + 2) (APDoubleMore.co10.map (ev2 (k + 1) r)) = true := by
refine ⟨?_, indec_lin2 _ 200 10 (k + 1) r (Nat.succ_pos k)
(show 200*((k) + 1) + 10*(r) = 200*(k) + 10*(r) + 198 + 2 from LinNorm.sound [k, r] 2 (.add (.smul 200 (.add (.var 0) (.lit 1))) (.smul 10 (.var 1))) (.add (.add (.add (.smul 200 (.var 0)) (.smul 10 (.var 1))) (.lit 198)) (.lit 2)) rfl) APDoubleMore.co10 APDoubleMore.co10_ok.1 APDoubleMore.co10_ok.2⟩
rw [← d10_list k r]
exact ap_double_bal 8 (20 * k + 1 * r + 19) (100 * (k + 1) + 5 * r) (k + 1) (180 * (k + 1) + 10 * r)
(show (8 + 1 + 1)*(20*(k) + 1*(r) + 19 + 1) = 100*((k) + 1) + 5*(r) + (100*((k) + 1) + 5*(r)) from LinNorm.sound [k, r] 2 (.smul 10 (.add (.add (.add (.smul 20 (.var 0)) (.smul 1 (.var 1))) (.lit 19)) (.lit 1))) (.add (.add (.smul 100 (.add (.var 0) (.lit 1))) (.smul 5 (.var 1))) (.add (.smul 100 (.add (.var 0) (.lit 1))) (.smul 5 (.var 1)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (by rw [(show (8 + 1 + 1)*((k) + 1) = 1 + (9 + 10*(k)) from LinNorm.sound [k] 1 (.smul 10 (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.lit 9) (.smul 10 (.var 0)))) rfl)]; exact Nat.le_add_right 1 _))
(by rw [(show 100*((k) + 1) + 5*(r) = (8 + 1 + 1)*((k) + 1) + (1 + (89 + 90*(k) + 5*(r))) from LinNorm.sound [k, r] 2 (.add (.smul 100 (.add (.var 0) (.lit 1))) (.smul 5 (.var 1))) (.add (.smul 10 (.add (.var 0) (.lit 1))) (.add (.lit 1) (.add (.add (.lit 89) (.smul 90 (.var 0))) (.smul 5 (.var 1))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 -- (+5 chars; full line in the Zenodo source)
(show (8 + 1 + 1)*((k) + 1) + (8 + 1 + 1)*((k) + 1) + (180*((k) + 1) + 10*(r)) = 100*((k) + 1) + 5*(r) + (100*((k) + 1) + 5*(r)) from LinNorm.sound [k, r] 2 (.add (.add (.smul 10 (.add (.var 0) (.lit 1))) (.smul 10 (.add (.var 0) (.lit 1)))) (.add (.smul 180 (.add (.var 0) (.lit 1))) (.smul 10 (.var 1)))) (.add (.add (.smul 100 (.add (.var 0) (.lit 1))) (.smul 5 (.var 1))) (.add (.smul 100 (.a -- (+48 chars; full line in the Zenodo source)
end APDoubleGenA3
#print axioms APDoubleGenA3.d9_both
#print axioms APDoubleGenA3.d10_both
lean_all/hodge/APDoubleIrr.lean
/-
hodge/APDoubleIrr.lean — T41 cycle 287 (goal G30): irreducibility of the AP_d + duplication-pair characters of
APDouble for d = 3, 6, 8 (a = 1), symbolically in the size, by the t = 1 reflection test of APPairIrrGen.
Lean 4 core plus hodge/APPairIrrGen (indec_lin, ev, chkSplit, small, splitsG), rfl on the coefficient lists.
d = 3: m = 30 + 6r, [1, 11+2r, 21+4r, 18+3r, 24+6r] (p = 5 + r, q = 2p)
d = 6: m = 78 + 6r, [1 + 13k + kr (k < 6), 45+3r, 66+6r] (q = 13 + r)
d = 8: m = 128 + 8r, [1 + 16k + kr (k < 8), 72+4r, 112+8r] (q = 16 + r)
(d = 4 is APPairIrrGen; for d = 5 the t = 1 test does not separate every splitting.)
-/
import hodge.APPairIrrGen
namespace APDoubleIrr
open Indecomp APPairIrrGen
def co3 : List (Nat × Nat) := [(1, 0), (11, 2), (21, 4), (18, 3), (24, 6)]
def co6 : List (Nat × Nat) := [(1, 0), (14, 1), (27, 2), (40, 3), (53, 4), (66, 5), (45, 3), (66, 6)]
def co8 : List (Nat × Nat) := [(1, 0), (17, 1), (33, 2), (49, 3), (65, 4), (81, 5), (97, 6), (113, 7), (72, 4), (112, 8)]
theorem co3_ok : co3.all (small 30 6) = true ∧ (splitsG co3).all (chkSplit 30 6) = true := ⟨rfl, rfl⟩
set_option maxRecDepth 10000 in
theorem co6_ok : co6.all (small 78 6) = true ∧ (splitsG co6).all (chkSplit 78 6) = true := ⟨rfl, rfl⟩
set_option maxRecDepth 10000 in
theorem co8_ok : co8.all (small 128 8) = true ∧ (splitsG co8).all (chkSplit 128 8) = true := ⟨rfl, rfl⟩
theorem d3_indec (r : Nat) : indec (28 + 6 * r + 2) (co3.map (ev r)) = true :=
indec_lin _ 30 6 r (by rw [Nat.add_right_comm]) co3 co3_ok.1 co3_ok.2
theorem d6_indec (r : Nat) : indec (76 + 6 * r + 2) (co6.map (ev r)) = true :=
indec_lin _ 78 6 r (by rw [Nat.add_right_comm]) co6 co6_ok.1 co6_ok.2
theorem d8_indec (r : Nat) : indec (126 + 8 * r + 2) (co8.map (ev r)) = true :=
indec_lin _ 128 8 r (by rw [Nat.add_right_comm]) co8 co8_ok.1 co8_ok.2
end APDoubleIrr
#print axioms APDoubleIrr.co3_ok
#print axioms APDoubleIrr.co6_ok
#print axioms APDoubleIrr.co8_ok
#print axioms APDoubleIrr.d3_indec
#print axioms APDoubleIrr.d6_indec
#print axioms APDoubleIrr.d8_indec
lean_all/hodge/APDoubleIrr5.lean
/-
hodge/APDoubleIrr5.lean — T41 cycle 288 (goal G31): the d = 5 member of APDouble, a = 1,
[1, 1+2p, 1+4p, 1+6p, 1+8p, 5+5p, 10p−10] in m = 10p, is irreducible for every p ≥ 9 (both parities).
The t = 1 test of APPairIrrGen leaves some splittings; a second unit t₂ separates them: t₂ = 1 + 5p (p even),
t₂ = 2 + 5p (p odd). With p = 10 + 2r resp. 9 + 2r every entry, every residue ⟨t₂·e⟩_m and every quotient is
linear in r; a row (e, res, Q) is checked by coefficient comparison of t₂·e = res + Q·m (rowOK, rfl), and every
splitting fails the Hodge condition at t = 1 or at t = t₂ (chk2, rfl over the 128 splittings).
Lean 4 core plus hodge/APPairIrrGen (lin_bal_false, chk, small, splitsG, …), hodge/TwistBal (all_fr_elim),
hodge/UnitMul (gcd_dvd, one_of_dvd_one), hodge/APPair1 (dvd_sub_form), lib/NatNorm.
-/
import hodge.APPairIrrGen
import hodge.TwistIndec
namespace APDoubleIrr5
open ModHand HalfGeneral Indecomp GcdHand APPair APPairIrrGen TwistBal UnitMul
abbrev Row := (Nat × Nat) × (Nat × Nat) × (Nat × Nat)
def rowOK (t0 t1 m0 m1 : Nat) (w : Row) : Bool :=
Nat.beq (t0 * w.1.1) (w.2.1.1 + w.2.2.1 * m0) &&
Nat.beq (t0 * w.1.2 + t1 * w.1.1) (w.2.1.2 + w.2.2.1 * m1 + w.2.2.2 * m0) &&
Nat.beq (t1 * w.1.2) (w.2.2.2 * m1) && small m0 m1 w.2.1
theorem and4 {a b c d : Bool} (h : (a && b && c && d) = true) : a = true ∧ b = true ∧ c = true ∧ d = true := by
cases a <;> cases b <;> cases c <;> cases d <;> first | exact ⟨rfl, rfl, rfl, rfl⟩ | exact Bool.noConfusion h
theorem row_res (t0 t1 m0 m1 r : Nat) (w : Row) (h : rowOK t0 t1 m0 m1 w = true) :
((t0 + t1 * r) * ev r w.1) % (m0 + m1 * r) = ev r w.2.1 := by
have ⟨h1, h2, h3, h4⟩ := and4 h
have e1 := Nat.eq_of_beq_eq_true h1
have e2 := Nat.eq_of_beq_eq_true h2
have e3 := Nat.eq_of_beq_eq_true h3
have hs : w.2.1.1 < m0 ∧ w.2.1.2 ≤ m1 := by
have h4' : (Nat.blt w.2.1.1 m0 && Nat.ble w.2.1.2 m1) = true := h4
cases b1 : Nat.blt w.2.1.1 m0 <;> cases b2 : Nat.ble w.2.1.2 m1 <;> rw [b1, b2] at h4'
· exact Bool.noConfusion h4'
· exact Bool.noConfusion h4'
· exact Bool.noConfusion h4'
· exact ⟨Nat.le_of_ble_eq_true b1, Nat.le_of_ble_eq_true b2⟩
apply mod_rep _ _ _ (w.2.2.1 + w.2.2.2 * r) (lt_lin _ _ _ _ r hs.1 hs.2)
show (t0 + t1 * r) * (w.1.1 + w.1.2 * r) = w.2.1.1 + w.2.1.2 * r + (w.2.2.1 + w.2.2.2 * r) * (m0 + m1 * r)
rw [((show ((t0) + (t1)*(r))*((w.1.1) + (w.1.2)*(r)) = (t0)*(w.1.1) + ((t0)*(w.1.2) + (t1)*(w.1.1))*(r) + (t1)*(w.1.2)*(r)*(r) from NatNorm.sound [t0, t1, w.1.1, w.1.2, r] (.mul (.add (.var 0) (.mul (.var 1) (.var 4))) (.add (.var 2) (.mul (.var 3) (.var 4)))) (.add (.add (.mul (.var 0) (.var 2)) (.mul (.add (.mul (.var 0) (.var 3)) (.mul (.var 1) (.var 2))) (.var 4))) (.mul (.mul (.mul (.var 1) -- (+50 chars; full line in the Zenodo source)
exact ((show (w.2.1.1) + (w.2.2.1)*(m0) + ((w.2.1.2) + (w.2.2.1)*(m1) + (w.2.2.2)*(m0))*(r) + (w.2.2.2)*(m1)*(r)*(r) = (w.2.1.1) + (w.2.1.2)*(r) + ((w.2.2.1) + (w.2.2.2)*(r))*((m0) + (m1)*(r)) from NatNorm.sound [w.2.1.1, w.2.1.2, w.2.2.1, w.2.2.2, m0, m1, r] (.add (.add (.add (.var 0) (.mul (.var 2) (.var 4))) (.mul (.add (.add (.var 1) (.mul (.var 2) (.var 5))) (.mul (.var 3) (.var 4))) (.var -- (+205 chars; full line in the Zenodo source)
def evE (r : Nat) (w : Row) : Nat := ev r w.1
def evR (r : Nat) (w : Row) : Nat := ev r w.2.1
theorem tsum_rows (t0 t1 m0 m1 r : Nat) : ∀ S : List Row, S.all (rowOK t0 t1 m0 m1) = true →
tsum (m0 + m1 * r) (t0 + t1 * r) (S.map (evE r)) = sumL (S.map (evR r))
| [], _ => rfl
| w :: S, h => by
have h' : (rowOK t0 t1 m0 m1 w && S.all (rowOK t0 t1 m0 m1)) = true := h
cases a : rowOK t0 t1 m0 m1 w with
| false => rw [a] at h'; exact Bool.noConfusion h'
| true =>
rw [a] at h'
show ((t0 + t1 * r) * ev r w.1) % (m0 + m1 * r) + tsum _ _ (S.map (evE r)) = ev r w.2.1 + sumL (S.map (evR r))
rw [row_res t0 t1 m0 m1 r w a, tsum_rows t0 t1 m0 m1 r S h']
theorem map_map' {α β γ : Type} (f : α → β) (g : β → γ) : ∀ l : List α, (l.map f).map g = l.map (fun x => g (f x))
| [] => rfl
| x :: l => by show g (f x) :: (l.map f).map g = g (f x) :: l.map _; rw [map_map' f g l]
/-- the linear contradiction: 2·Σ(α + βr) = |S|(m₀ + m₁r) is impossible when chk holds -/
theorem lin_contra (m0 m1 r : Nat) (S : List (Nat × Nat)) (hc : chk m0 m1 S = true)
(e : sumL (S.map (ev r)) + sumL (S.map (ev r)) = S.length * (m0 + m1 * r)) : False := by
rw [sumL_map] at e
have e2 : 2 * sA S + 2 * sB S * r = S.length * m0 + S.length * m1 * r := by
rw [((show 2*(sA S) + 2*(sB S)*(r) = (sA S) + (sB S)*(r) + ((sA S) + (sB S)*(r)) from NatNorm.sound [sA S, sB S, r] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.var 2))) (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.add (.var 0) (.mul (.var 1) (.var 2)))) rfl)), e]
exact ((show (S.length)*((m0) + (m1)*(r)) = (S.length)*(m0) + (S.length)*(m1)*(r) from NatNorm.sound [S.length, m0, m1, r] (.mul (.var 0) (.add (.var 1) (.mul (.var 2) (.var 3)))) (.add (.mul (.var 0) (.var 1)) (.mul (.mul (.var 0) (.var 2)) (.var 3))) rfl))
have hc' : ((Nat.blt (2 * sA S) (S.length * m0) && Nat.ble (2 * sB S) (S.length * m1)) ||
(Nat.blt (S.length * m0) (2 * sA S) && Nat.ble (S.length * m1) (2 * sB S))) = true := hc
cases c1 : Nat.blt (2 * sA S) (S.length * m0) <;> cases c2 : Nat.ble (2 * sB S) (S.length * m1) <;>
cases c3 : Nat.blt (S.length * m0) (2 * sA S) <;> cases c4 : Nat.ble (S.length * m1) (2 * sB S) <;>
rw [c1, c2, c3, c4] at hc' <;> first
| exact Bool.noConfusion hc'
| exact absurd (e2 ▸ lt_lin _ _ _ _ r (Nat.le_of_ble_eq_true c1) (Nat.le_of_ble_eq_true c2)) (Nat.lt_irrefl _)
| exact absurd (e2 ▸ lt_lin _ _ _ _ r (Nat.le_of_ble_eq_true c3) (Nat.le_of_ble_eq_true c4)) (Nat.lt_irrefl _)
theorem len_map {α β : Type} (f : α → β) : ∀ l : List α, (l.map f).length = l.length := length_map' f
/-- bal fails when the residues under the unit t₂ fail the linear test -/
theorem bal_false_t2 (n t0 t1 m0 m1 r : Nat) (hm : m0 + m1 * r = n + 2)
(hu : Nat.gcd (t0 + t1 * r) (n + 2) = 1) (hlt : t0 + t1 * r < n + 2) (S : List Row)
(hrows : S.all (rowOK t0 t1 m0 m1) = true) (hc : chk m0 m1 (S.map (fun w => w.2.1)) = true) :
bal (n + 2) (S.map (evE r)) = false := by
cases hb : bal (n + 2) (S.map (evE r)) with
| false => rfl
| true =>
unfold bal FermatPrime.units at hb
have h := all_fr_elim _ _ (n + 2) hb (t0 + t1 * r) hlt (by rw [hu]; rfl)
have e := Nat.eq_of_beq_eq_true h
rw [← hm, tsum_rows t0 t1 m0 m1 r S hrows, len_map] at e
exact (lin_contra m0 m1 r (S.map (fun w => w.2.1)) hc (by rw [map_map', len_map]; exact e)).elim
def chk2 (m0 m1 : Nat) (p : List Row × List Row) : Bool :=
p.1.isEmpty || p.2.isEmpty || chk m0 m1 (p.1.map (fun w => w.1)) || chk m0 m1 (p.2.map (fun w => w.1)) ||
chk m0 m1 (p.1.map (fun w => w.2.1)) || chk m0 m1 (p.2.map (fun w => w.2.1))
def okRow (t0 t1 m0 m1 : Nat) (w : Row) : Bool := rowOK t0 t1 m0 m1 w && small m0 m1 w.1
theorem okRow_parts (t0 t1 m0 m1 : Nat) : ∀ S : List Row, S.all (okRow t0 t1 m0 m1) = true →
S.all (rowOK t0 t1 m0 m1) = true ∧ (S.map (fun w => w.1)).all (small m0 m1) = true
| [], _ => ⟨rfl, rfl⟩
| w :: S, h => by
have h' : ((rowOK t0 t1 m0 m1 w && small m0 m1 w.1) && S.all (okRow t0 t1 m0 m1)) = true := h
cases c : S.all (okRow t0 t1 m0 m1) with
| false =>
rw [c] at h'
cases a : rowOK t0 t1 m0 m1 w <;> cases b : small m0 m1 w.1 <;> rw [a, b] at h' <;> exact Bool.noConfusion h'
| true =>
have ⟨i1, i2⟩ := okRow_parts t0 t1 m0 m1 S c
rw [c] at h'
cases a : rowOK t0 t1 m0 m1 w <;> cases b : small m0 m1 w.1 <;> rw [a, b] at h'
· exact Bool.noConfusion h'
· exact Bool.noConfusion h'
· exact Bool.noConfusion h'
· exact ⟨by show (rowOK t0 t1 m0 m1 w && S.all _) = true; rw [a, i1]; rfl,
by show (small m0 m1 w.1 && (S.map _).all _) = true; rw [b, i2]; rfl⟩
/-- **Reflection with two units.** -/
theorem indec_two (n t0 t1 m0 m1 r : Nat) (hm : m0 + m1 * r = n + 2)
(hu : Nat.gcd (t0 + t1 * r) (n + 2) = 1) (hlt : t0 + t1 * r < n + 2) (co : List Row)
(hok : co.all (okRow t0 t1 m0 m1) = true) (hsp : (splitsG co).all (chk2 m0 m1) = true) :
indec (n + 2) (co.map (evE r)) = true := by
unfold indec
rw [splits_eq, splits_map]
have hb := all_and _ _ _ (TwistIndec.splits_all _ co hok) hsp
rw [Reach49.all_map]
apply all_imp _ _ _ _ hb
intro p hp
have hp' : ((p.1.all (okRow t0 t1 m0 m1) && p.2.all (okRow t0 t1 m0 m1)) && chk2 m0 m1 p) = true := hp
cases s1 : p.1.all (okRow t0 t1 m0 m1) <;> cases s2 : p.2.all (okRow t0 t1 m0 m1) <;> rw [s1, s2] at hp'
· exact Bool.noConfusion hp'
· exact Bool.noConfusion hp'
· exact Bool.noConfusion hp'
· have ⟨r1, q1⟩ := okRow_parts _ _ _ _ p.1 s1
have ⟨r2, q2⟩ := okRow_parts _ _ _ _ p.2 s2
have em : ∀ l : List Row, (l.map (evE r)).isEmpty = l.isEmpty := fun l => by cases l <;> rfl
have f1 : ∀ S : List Row, (S.map (fun w => w.1)).all (small m0 m1) = true →
chk m0 m1 (S.map (fun w => w.1)) = true → bal (n + 2) (S.map (evE r)) = false := by
intro S hs hc
have := lin_bal_false n m0 m1 r hm _ hs hc
rw [map_map'] at this; exact this
have f2 : ∀ S : List Row, S.all (rowOK t0 t1 m0 m1) = true →
chk m0 m1 (S.map (fun w => w.2.1)) = true → bal (n + 2) (S.map (evE r)) = false :=
fun S hs hc => bal_false_t2 n t0 t1 m0 m1 r hm hu hlt S hs hc
show ((p.1.map (evE r)).isEmpty || (p.2.map (evE r)).isEmpty ||
!(bal (n + 2) (p.1.map (evE r)) && bal (n + 2) (p.2.map (evE r)))) = true
rw [em, em]
have hc : (p.1.isEmpty || p.2.isEmpty || chk m0 m1 (p.1.map (fun w => w.1)) || chk m0 m1 (p.2.map (fun w => w.1)) ||
chk m0 m1 (p.1.map (fun w => w.2.1)) || chk m0 m1 (p.2.map (fun w => w.2.1))) = true := hp'
cases e1 : p.1.isEmpty <;> cases e2 : p.2.isEmpty <;> rw [e1, e2] at hc <;> try rfl
cases k1 : chk m0 m1 (p.1.map (fun w => w.1))
· cases k2 : chk m0 m1 (p.2.map (fun w => w.1))
· cases k3 : chk m0 m1 (p.1.map (fun w => w.2.1))
· cases k4 : chk m0 m1 (p.2.map (fun w => w.2.1))
· rw [k1, k2, k3, k4] at hc; exact Bool.noConfusion hc
· rw [f2 p.2 r2 k4]; cases bal (n + 2) (p.1.map (evE r)) <;> rfl
· rw [f2 p.1 r1 k3]; rfl
· rw [f1 p.2 q2 k2]; cases bal (n + 2) (p.1.map (evE r)) <;> rfl
· rw [f1 p.1 q1 k1]; rfl
def coE : List Row := [((1,0), (51,10), (0,0)), ((21,4), (71,14), (10,2)), ((41,8), (91,18), (20,4)), ((61,12), (11,2), (31,6)), ((81,16), (31,6), (41,8)), ((55,10), (5,0), (28,5)), ((90,20), (90,20), (45,10))]
def coO : List Row := [((1,0), (47,10), (0,0)), ((19,4), (83,18), (9,2)), ((37,8), (29,6), (19,4)), ((55,12), (65,14), (28,6)), ((73,16), (11,2), (38,8)), ((50,10), (10,0), (26,5)), ((80,20), (70,20), (41,10))]
set_option maxRecDepth 20000 in
theorem coE_ok : coE.all (okRow 51 10 100 20) = true ∧ (splitsG coE).all (chk2 100 20) = true := ⟨rfl, rfl⟩
set_option maxRecDepth 20000 in
theorem coO_ok : coO.all (okRow 47 10 90 20) = true ∧ (splitsG coO).all (chk2 90 20) = true := ⟨rfl, rfl⟩
/-- d ∣ 2·t − m with 2·t = m + c ⇒ d ∣ c -/
theorem unit_of_rel (t m c g : Nat) (hrel : t + t = m + c) (ht : ∃ i, t = g * i) (hm : ∃ j, m = g * j) :
∃ k, c = g * k := by
have ⟨i, hi⟩ := ht
have ⟨j, hj⟩ := hm
apply APPair1.dvd_sub_form g c j (i + i)
rw [((show (g)*((i) + (i)) = (g)*(i) + (g)*(i) from NatNorm.sound [g, i] (.mul (.var 0) (.add (.var 1) (.var 1))) (.add (.mul (.var 0) (.var 1)) (.mul (.var 0) (.var 1))) rfl)), ← hi, hrel, hj, Nat.add_comm]
theorem odd_not_even (x y : Nat) : 2 * x + 1 ≠ 2 * y := TorsionImage.odd_ne_even x y
/-- gcd(51 + 10r, 100 + 20r) = 1 -/
theorem unitE (r : Nat) : Nat.gcd (51 + 10 * r) (98 + 20 * r + 2) = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := gcd_dvd (51 + 10 * r) (98 + 20 * r + 2)
generalize Nat.gcd (51 + 10 * r) (98 + 20 * r + 2) = g at hi hj ⊢
have ⟨k, hk⟩ := unit_of_rel _ _ 2 g (by exact ((show 51 + 10*(r) + (51 + 10*(r)) = 98 + 20*(r) + 2 + 2 from NatNorm.sound [r] (.add (.add (.lit 51) (.mul (.lit 10) (.var 0))) (.add (.lit 51) (.mul (.lit 10) (.var 0)))) (.add (.add (.add (.lit 98) (.mul (.lit 20) (.var 0))) (.lit 2)) (.lit 2)) rfl))) ⟨i, hi⟩ ⟨j, hj⟩
-- g ∣ 2, g ∣ odd ⇒ g = 1
cases g with
| zero => rw [Nat.zero_mul] at hk; exact Nat.noConfusion hk
| succ g =>
cases g with
| zero => rfl
| succ g =>
cases g with
| zero =>
exact absurd (show 2 * (25 + 5 * r) + 1 = 2 * i by rw [← hi]; exact ((show 2*(25 + 5*(r)) + 1 = 51 + 10*(r) from NatNorm.sound [r] (.add (.mul (.lit 2) (.add (.lit 25) (.mul (.lit 5) (.var 0)))) (.lit 1)) (.add (.lit 51) (.mul (.lit 10) (.var 0))) rfl))) (odd_not_even _ _)
| succ g =>
cases k with
| zero => rw [Nat.mul_zero] at hk; exact Nat.noConfusion hk
| succ k =>
have : 2 = g + 3 + (g + 3) * k := by rw [hk]; exact ((show ((g) + 1 + 1 + 1)*((k) + 1) = (g) + 3 + ((g) + 3)*(k) from NatNorm.sound [g, k] (.mul (.add (.add (.add (.var 0) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.var 1) (.lit 1))) (.add (.add (.var 0) (.lit 3)) (.mul (.add (.var 0) (.lit 3)) (.var 1))) rfl))
exact absurd (this ▸ Nat.le_add_right (g + 3) _) (by exact fun h => Nat.lt_irrefl 2 (Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le (Nat.lt_succ_self 2) (Nat.le_add_left 3 g)) h))
/-- gcd(47 + 10r, 90 + 20r) = 1 -/
theorem unitO (r : Nat) : Nat.gcd (47 + 10 * r) (88 + 20 * r + 2) = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := gcd_dvd (47 + 10 * r) (88 + 20 * r + 2)
generalize Nat.gcd (47 + 10 * r) (88 + 20 * r + 2) = g at hi hj ⊢
have ⟨k, hk⟩ := unit_of_rel _ _ 4 g (by exact ((show 47 + 10*(r) + (47 + 10*(r)) = 88 + 20*(r) + 2 + 4 from NatNorm.sound [r] (.add (.add (.lit 47) (.mul (.lit 10) (.var 0))) (.add (.lit 47) (.mul (.lit 10) (.var 0)))) (.add (.add (.add (.lit 88) (.mul (.lit 20) (.var 0))) (.lit 2)) (.lit 4)) rfl))) ⟨i, hi⟩ ⟨j, hj⟩
have hodd : ∀ i', 47 + 10 * r ≠ 2 * i' := fun i' h =>
odd_not_even (23 + 5 * r) i' (by rw [← h]; exact ((show 2*(23 + 5*(r)) + 1 = 47 + 10*(r) from NatNorm.sound [r] (.add (.mul (.lit 2) (.add (.lit 23) (.mul (.lit 5) (.var 0)))) (.lit 1)) (.add (.lit 47) (.mul (.lit 10) (.var 0))) rfl)))
cases g with
| zero => rw [Nat.zero_mul] at hk; exact Nat.noConfusion hk
| succ g =>
cases g with
| zero => rfl
| succ g =>
cases g with
| zero => exact absurd hi (hodd i)
| succ g =>
cases g with
| zero =>
-- g = 3: 3 k = 4 impossible
cases k with
| zero => exact Nat.noConfusion hk
| succ k => cases k with
| zero => exact Nat.noConfusion (Nat.succ.inj (Nat.succ.inj (Nat.succ.inj hk)))
| succ k =>
have : 4 = 6 + 3 * k := by rw [hk]; exact ((show (0 + 1 + 1 + 1)*((k) + 1 + 1) = 6 + 3*(k) from NatNorm.sound [k] (.mul (.add (.add (.add (.lit 0) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.add (.var 0) (.lit 1)) (.lit 1))) (.add (.lit 6) (.mul (.lit 3) (.var 0))) rfl))
exact absurd (this ▸ Nat.le_add_right 6 _) (fun h => Nat.lt_irrefl 4 (Nat.lt_of_lt_of_le (Nat.le_add_left 5 0 |> Nat.lt_of_lt_of_le (Nat.lt_succ_self 4)) (Nat.le_trans (Nat.le_add_left 5 1) h)))
| succ g =>
cases g with
| zero => exact absurd (show 47 + 10 * r = 2 * (2 * i) by rw [hi]; exact ((show (0 + 1 + 1 + 1 + 1)*(i) = 2*(2*(i)) from NatNorm.sound [i] (.mul (.add (.add (.add (.add (.lit 0) (.lit 1)) (.lit 1)) (.lit 1)) (.lit 1)) (.var 0)) (.mul (.lit 2) (.mul (.lit 2) (.var 0))) rfl))) (hodd _)
| succ g =>
cases k with
| zero => rw [Nat.mul_zero] at hk; exact Nat.noConfusion hk
| succ k =>
have : 4 = g + 5 + (g + 5) * k := by rw [hk]; exact ((show ((g) + 1 + 1 + 1 + 1 + 1)*((k) + 1) = (g) + 5 + ((g) + 5)*(k) from NatNorm.sound [g, k] (.mul (.add (.add (.add (.add (.add (.var 0) (.lit 1)) (.lit 1)) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.var 1) (.lit 1))) (.add (.add (.var 0) (.lit 5)) (.mul (.add (.var 0) (.lit 5)) (.var 1))) rfl))
exact absurd (this ▸ Nat.le_add_right (g + 5) _) (fun h => Nat.lt_irrefl 4 (Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le (Nat.lt_succ_self 4) (Nat.le_add_left 5 g)) h))
/-- **p = 10 + 2r (even): irreducible.** -/
theorem d5_even (r : Nat) : indec (98 + 20 * r + 2) (coE.map (evE r)) = true :=
indec_two (98 + 20 * r) 51 10 100 20 r ((show 100 + 20*(r) = 98 + 20*(r) + 2 from NatNorm.sound [r] (.add (.lit 100) (.mul (.lit 20) (.var 0))) (.add (.add (.lit 98) (.mul (.lit 20) (.var 0))) (.lit 2)) rfl)) (unitE r)
(by rw [((show 98 + 20*(r) + 2 = 51 + 10*(r) + (49 + 10*(r)) from NatNorm.sound [r] (.add (.add (.lit 98) (.mul (.lit 20) (.var 0))) (.lit 2)) (.add (.add (.lit 51) (.mul (.lit 10) (.var 0))) (.add (.lit 49) (.mul (.lit 10) (.var 0)))) rfl))]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 48) (Nat.le_add_right 49 _)))
coE coE_ok.1 coE_ok.2
/-- **p = 9 + 2r (odd): irreducible.** -/
theorem d5_odd (r : Nat) : indec (88 + 20 * r + 2) (coO.map (evE r)) = true :=
indec_two (88 + 20 * r) 47 10 90 20 r ((show 90 + 20*(r) = 88 + 20*(r) + 2 from NatNorm.sound [r] (.add (.lit 90) (.mul (.lit 20) (.var 0))) (.add (.add (.lit 88) (.mul (.lit 20) (.var 0))) (.lit 2)) rfl)) (unitO r)
(by rw [((show 88 + 20*(r) + 2 = 47 + 10*(r) + (43 + 10*(r)) from NatNorm.sound [r] (.add (.add (.lit 88) (.mul (.lit 20) (.var 0))) (.lit 2)) (.add (.add (.lit 47) (.mul (.lit 10) (.var 0))) (.add (.lit 43) (.mul (.lit 10) (.var 0)))) rfl))]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 42) (Nat.le_add_right 43 _)))
coO coO_ok.1 coO_ok.2
end APDoubleIrr5
#print axioms APDoubleIrr5.row_res
#print axioms APDoubleIrr5.bal_false_t2
#print axioms APDoubleIrr5.indec_two
#print axioms APDoubleIrr5.coE_ok
#print axioms APDoubleIrr5.coO_ok
#print axioms APDoubleIrr5.unitE
#print axioms APDoubleIrr5.unitO
#print axioms APDoubleIrr5.d5_even
#print axioms APDoubleIrr5.d5_odd
lean_all/hodge/APDoubleIrr5b.lean
/-
hodge/APDoubleIrr5b.lean — T41 cycle 315 (goal G53): the d = 5 APDouble character with start a = 3, 7, 9,
[a, a+2p, a+4p, a+6p, a+8p, 5a+5p, 10p−10a] in m = 10p, is irreducible for every p from an explicit bound on
(both parities), by the two-unit reflection of APDoubleIrr5 (t₂ = 1 + 5p or 2 + 5p; rows computed in Python).
unit2, unit4 t odd, 2t = m + 2 (resp. m + 4) ⇒ gcd t m = 1 (general forms of APDoubleIrr5.unitE/O)
-/
import hodge.APDoubleIrr5
import lib.LinNorm
namespace APDoubleIrr5b
open Indecomp APPairIrrGen APDoubleIrr5 UnitMul
theorem unit2 (t n2 : Nat) (hrel : t + t = (n2 + 2) + 2) (hodd : ∀ i, t ≠ 2 * i) : Nat.gcd t (n2 + 2) = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := gcd_dvd t (n2 + 2)
generalize Nat.gcd t (n2 + 2) = g at hi hj ⊢
have ⟨k, hk⟩ := unit_of_rel _ _ 2 g hrel ⟨i, hi⟩ ⟨j, hj⟩
cases g with
| zero => rw [Nat.zero_mul] at hk; exact Nat.noConfusion hk
| succ g =>
cases g with
| zero => rfl
| succ g =>
cases g with
| zero => exact absurd hi (hodd i)
| succ g =>
cases k with
| zero => rw [Nat.mul_zero] at hk; exact Nat.noConfusion hk
| succ k =>
have : 2 = g + 3 + (g + 3) * k := by rw [hk]; lib_nat
exact absurd (this ▸ Nat.le_add_right (g + 3) _) (fun h => Nat.lt_irrefl 2 (Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le (Nat.lt_succ_self 2) (Nat.le_add_left 3 g)) h))
theorem unit4 (t n2 : Nat) (hrel : t + t = (n2 + 2) + 4) (hodd : ∀ i, t ≠ 2 * i) : Nat.gcd t (n2 + 2) = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := gcd_dvd t (n2 + 2)
generalize Nat.gcd t (n2 + 2) = g at hi hj ⊢
have ⟨k, hk⟩ := unit_of_rel _ _ 4 g hrel ⟨i, hi⟩ ⟨j, hj⟩
cases g with
| zero => rw [Nat.zero_mul] at hk; exact Nat.noConfusion hk
| succ g =>
cases g with
| zero => rfl
| succ g =>
cases g with
| zero => exact absurd hi (hodd i)
| succ g =>
cases g with
| zero =>
cases k with
| zero => exact Nat.noConfusion hk
| succ k => cases k with
| zero => exact Nat.noConfusion (Nat.succ.inj (Nat.succ.inj (Nat.succ.inj hk)))
| succ k =>
have : 4 = 6 + 3 * k := by rw [hk]; lib_nat
exact absurd (this ▸ Nat.le_add_right 6 _) (fun h => Nat.lt_irrefl 4 (Nat.lt_of_lt_of_le (Nat.le_add_left 5 0 |> Nat.lt_of_lt_of_le (Nat.lt_succ_self 4)) (Nat.le_trans (Nat.le_add_left 5 1) h)))
| succ g =>
cases g with
| zero => exact absurd (show t = 2 * (2 * i) by rw [hi]; lib_nat) (hodd _)
| succ g =>
cases k with
| zero => rw [Nat.mul_zero] at hk; exact Nat.noConfusion hk
| succ k =>
have : 4 = g + 5 + (g + 5) * k := by rw [hk]; lib_nat
exact absurd (this ▸ Nat.le_add_right (g + 5) _) (fun h => Nat.lt_irrefl 4 (Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le (Nat.lt_succ_self 4) (Nat.le_add_left 5 g)) h))
def co_a3e : List Row := [((3,0), (133,10), (1,0)), ((55,4), (185,14), (27,2)), ((107,8), (237,18), (53,4)), ((159,12), (29,2), (80,6)), ((211,16), (81,6), (106,8)), ((145,10), (15,0), (73,5)), ((230,20), (230,20), (115,10))]
set_option maxRecDepth 20000 in
theorem co_a3e_ok : co_a3e.all (okRow 131 10 260 20) = true ∧ (splitsG co_a3e).all (chk2 260 20) = true := ⟨rfl, rfl⟩
theorem a3e (r : Nat) : indec (258 + 20 * r + 2) (co_a3e.map (evE r)) = true :=
indec_two (258 + 20 * r) 131 10 260 20 r (show 260 + 20*(r) = 258 + 20*(r) + 2 from LinNorm.sound [r] 1 (.add (.lit 260) (.smul 20 (.var 0))) (.add (.add (.lit 258) (.smul 20 (.var 0))) (.lit 2)) rfl)
(unit2 _ _ (show 131 + 10*(r) + (131 + 10*(r)) = 258 + 20*(r) + 2 + 2 from LinNorm.sound [r] 1 (.add (.add (.lit 131) (.smul 10 (.var 0))) (.add (.lit 131) (.smul 10 (.var 0)))) (.add (.add (.add (.lit 258) (.smul 20 (.var 0))) (.lit 2)) (.lit 2)) rfl)
(fun i h => odd_not_even (65 + 5 * r) i (by rw [← h]; exact (show 2*(65 + 5*(r)) + 1 = 131 + 10*(r) from LinNorm.sound [r] 1 (.add (.smul 2 (.add (.lit 65) (.smul 5 (.var 0)))) (.lit 1)) (.add (.lit 131) (.smul 10 (.var 0))) rfl))))
(by rw [(show 258 + 20*(r) + 2 = 131 + 10*(r) + (129 + 10*(r)) from LinNorm.sound [r] 1 (.add (.add (.lit 258) (.smul 20 (.var 0))) (.lit 2)) (.add (.add (.lit 131) (.smul 10 (.var 0))) (.add (.lit 129) (.smul 10 (.var 0)))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 128) (Nat.le_add_right 129 _)))
co_a3e co_a3e_ok.1 co_a3e_ok.2
def co_a3o : List Row := [((3,0), (61,10), (1,0)), ((25,4), (105,18), (12,2)), ((47,8), (39,6), (24,4)), ((69,12), (83,14), (35,6)), ((91,16), (17,2), (47,8)), ((70,10), (30,0), (36,5)), ((80,20), (50,20), (41,10))]
set_option maxRecDepth 20000 in
theorem co_a3o_ok : co_a3o.all (okRow 57 10 110 20) = true ∧ (splitsG co_a3o).all (chk2 110 20) = true := ⟨rfl, rfl⟩
theorem a3o (r : Nat) : indec (108 + 20 * r + 2) (co_a3o.map (evE r)) = true :=
indec_two (108 + 20 * r) 57 10 110 20 r (show 110 + 20*(r) = 108 + 20*(r) + 2 from LinNorm.sound [r] 1 (.add (.lit 110) (.smul 20 (.var 0))) (.add (.add (.lit 108) (.smul 20 (.var 0))) (.lit 2)) rfl)
(unit4 _ _ (show 57 + 10*(r) + (57 + 10*(r)) = 108 + 20*(r) + 2 + 4 from LinNorm.sound [r] 1 (.add (.add (.lit 57) (.smul 10 (.var 0))) (.add (.lit 57) (.smul 10 (.var 0)))) (.add (.add (.add (.lit 108) (.smul 20 (.var 0))) (.lit 2)) (.lit 4)) rfl)
(fun i h => odd_not_even (28 + 5 * r) i (by rw [← h]; exact (show 2*(28 + 5*(r)) + 1 = 57 + 10*(r) from LinNorm.sound [r] 1 (.add (.smul 2 (.add (.lit 28) (.smul 5 (.var 0)))) (.lit 1)) (.add (.lit 57) (.smul 10 (.var 0))) rfl))))
(by rw [(show 108 + 20*(r) + 2 = 57 + 10*(r) + (53 + 10*(r)) from LinNorm.sound [r] 1 (.add (.add (.lit 108) (.smul 20 (.var 0))) (.lit 2)) (.add (.add (.lit 57) (.smul 10 (.var 0))) (.add (.lit 53) (.smul 10 (.var 0)))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 52) (Nat.le_add_right 53 _)))
co_a3o co_a3o_ok.1 co_a3o_ok.2
def co_a7e : List Row := [((7,0), (297,10), (3,0)), ((123,4), (413,14), (61,2)), ((239,8), (529,18), (119,4)), ((355,12), (65,2), (178,6)), ((471,16), (181,6), (236,8)), ((325,10), (35,0), (163,5)), ((510,20), (510,20), (255,10))]
set_option maxRecDepth 20000 in
theorem co_a7e_ok : co_a7e.all (okRow 291 10 580 20) = true ∧ (splitsG co_a7e).all (chk2 580 20) = true := ⟨rfl, rfl⟩
theorem a7e (r : Nat) : indec (578 + 20 * r + 2) (co_a7e.map (evE r)) = true :=
indec_two (578 + 20 * r) 291 10 580 20 r (show 580 + 20*(r) = 578 + 20*(r) + 2 from LinNorm.sound [r] 1 (.add (.lit 580) (.smul 20 (.var 0))) (.add (.add (.lit 578) (.smul 20 (.var 0))) (.lit 2)) rfl)
(unit2 _ _ (show 291 + 10*(r) + (291 + 10*(r)) = 578 + 20*(r) + 2 + 2 from LinNorm.sound [r] 1 (.add (.add (.lit 291) (.smul 10 (.var 0))) (.add (.lit 291) (.smul 10 (.var 0)))) (.add (.add (.add (.lit 578) (.smul 20 (.var 0))) (.lit 2)) (.lit 2)) rfl)
(fun i h => odd_not_even (145 + 5 * r) i (by rw [← h]; exact (show 2*(145 + 5*(r)) + 1 = 291 + 10*(r) from LinNorm.sound [r] 1 (.add (.smul 2 (.add (.lit 145) (.smul 5 (.var 0)))) (.lit 1)) (.add (.lit 291) (.smul 10 (.var 0))) rfl))))
(by rw [(show 578 + 20*(r) + 2 = 291 + 10*(r) + (289 + 10*(r)) from LinNorm.sound [r] 1 (.add (.add (.lit 578) (.smul 20 (.var 0))) (.lit 2)) (.add (.add (.lit 291) (.smul 10 (.var 0))) (.add (.lit 289) (.smul 10 (.var 0)))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 288) (Nat.le_add_right 289 _)))
co_a7e co_a7e_ok.1 co_a7e_ok.2
def co_a7o : List Row := [((7,0), (129,10), (3,0)), ((53,4), (221,18), (26,2)), ((99,8), (83,6), (50,4)), ((145,12), (175,14), (73,6)), ((191,16), (37,2), (97,8)), ((150,10), (70,0), (76,5)), ((160,20), (90,20), (81,10))]
set_option maxRecDepth 20000 in
theorem co_a7o_ok : co_a7o.all (okRow 117 10 230 20) = true ∧ (splitsG co_a7o).all (chk2 230 20) = true := ⟨rfl, rfl⟩
theorem a7o (r : Nat) : indec (228 + 20 * r + 2) (co_a7o.map (evE r)) = true :=
indec_two (228 + 20 * r) 117 10 230 20 r (show 230 + 20*(r) = 228 + 20*(r) + 2 from LinNorm.sound [r] 1 (.add (.lit 230) (.smul 20 (.var 0))) (.add (.add (.lit 228) (.smul 20 (.var 0))) (.lit 2)) rfl)
(unit4 _ _ (show 117 + 10*(r) + (117 + 10*(r)) = 228 + 20*(r) + 2 + 4 from LinNorm.sound [r] 1 (.add (.add (.lit 117) (.smul 10 (.var 0))) (.add (.lit 117) (.smul 10 (.var 0)))) (.add (.add (.add (.lit 228) (.smul 20 (.var 0))) (.lit 2)) (.lit 4)) rfl)
(fun i h => odd_not_even (58 + 5 * r) i (by rw [← h]; exact (show 2*(58 + 5*(r)) + 1 = 117 + 10*(r) from LinNorm.sound [r] 1 (.add (.smul 2 (.add (.lit 58) (.smul 5 (.var 0)))) (.lit 1)) (.add (.lit 117) (.smul 10 (.var 0))) rfl))))
(by rw [(show 228 + 20*(r) + 2 = 117 + 10*(r) + (113 + 10*(r)) from LinNorm.sound [r] 1 (.add (.add (.lit 228) (.smul 20 (.var 0))) (.lit 2)) (.add (.add (.lit 117) (.smul 10 (.var 0))) (.add (.lit 113) (.smul 10 (.var 0)))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 112) (Nat.le_add_right 113 _)))
co_a7o co_a7o_ok.1 co_a7o_ok.2
def co_a9e : List Row := [((9,0), (379,10), (4,0)), ((157,4), (527,14), (78,2)), ((305,8), (675,18), (152,4)), ((453,12), (83,2), (227,6)), ((601,16), (231,6), (301,8)), ((415,10), (45,0), (208,5)), ((650,20), (650,20), (325,10))]
set_option maxRecDepth 20000 in
theorem co_a9e_ok : co_a9e.all (okRow 371 10 740 20) = true ∧ (splitsG co_a9e).all (chk2 740 20) = true := ⟨rfl, rfl⟩
theorem a9e (r : Nat) : indec (738 + 20 * r + 2) (co_a9e.map (evE r)) = true :=
indec_two (738 + 20 * r) 371 10 740 20 r (show 740 + 20*(r) = 738 + 20*(r) + 2 from LinNorm.sound [r] 1 (.add (.lit 740) (.smul 20 (.var 0))) (.add (.add (.lit 738) (.smul 20 (.var 0))) (.lit 2)) rfl)
(unit2 _ _ (show 371 + 10*(r) + (371 + 10*(r)) = 738 + 20*(r) + 2 + 2 from LinNorm.sound [r] 1 (.add (.add (.lit 371) (.smul 10 (.var 0))) (.add (.lit 371) (.smul 10 (.var 0)))) (.add (.add (.add (.lit 738) (.smul 20 (.var 0))) (.lit 2)) (.lit 2)) rfl)
(fun i h => odd_not_even (185 + 5 * r) i (by rw [← h]; exact (show 2*(185 + 5*(r)) + 1 = 371 + 10*(r) from LinNorm.sound [r] 1 (.add (.smul 2 (.add (.lit 185) (.smul 5 (.var 0)))) (.lit 1)) (.add (.lit 371) (.smul 10 (.var 0))) rfl))))
(by rw [(show 738 + 20*(r) + 2 = 371 + 10*(r) + (369 + 10*(r)) from LinNorm.sound [r] 1 (.add (.add (.lit 738) (.smul 20 (.var 0))) (.lit 2)) (.add (.add (.lit 371) (.smul 10 (.var 0))) (.add (.lit 369) (.smul 10 (.var 0)))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 368) (Nat.le_add_right 369 _)))
co_a9e co_a9e_ok.1 co_a9e_ok.2
def co_a9o : List Row := [((9,0), (163,10), (4,0)), ((67,4), (279,18), (33,2)), ((125,8), (105,6), (63,4)), ((183,12), (221,14), (92,6)), ((241,16), (47,2), (122,8)), ((190,10), (90,0), (96,5)), ((200,20), (110,20), (101,10))]
set_option maxRecDepth 20000 in
theorem co_a9o_ok : co_a9o.all (okRow 147 10 290 20) = true ∧ (splitsG co_a9o).all (chk2 290 20) = true := ⟨rfl, rfl⟩
theorem a9o (r : Nat) : indec (288 + 20 * r + 2) (co_a9o.map (evE r)) = true :=
indec_two (288 + 20 * r) 147 10 290 20 r (show 290 + 20*(r) = 288 + 20*(r) + 2 from LinNorm.sound [r] 1 (.add (.lit 290) (.smul 20 (.var 0))) (.add (.add (.lit 288) (.smul 20 (.var 0))) (.lit 2)) rfl)
(unit4 _ _ (show 147 + 10*(r) + (147 + 10*(r)) = 288 + 20*(r) + 2 + 4 from LinNorm.sound [r] 1 (.add (.add (.lit 147) (.smul 10 (.var 0))) (.add (.lit 147) (.smul 10 (.var 0)))) (.add (.add (.add (.lit 288) (.smul 20 (.var 0))) (.lit 2)) (.lit 4)) rfl)
(fun i h => odd_not_even (73 + 5 * r) i (by rw [← h]; exact (show 2*(73 + 5*(r)) + 1 = 147 + 10*(r) from LinNorm.sound [r] 1 (.add (.smul 2 (.add (.lit 73) (.smul 5 (.var 0)))) (.lit 1)) (.add (.lit 147) (.smul 10 (.var 0))) rfl))))
(by rw [(show 288 + 20*(r) + 2 = 147 + 10*(r) + (143 + 10*(r)) from LinNorm.sound [r] 1 (.add (.add (.lit 288) (.smul 20 (.var 0))) (.lit 2)) (.add (.add (.lit 147) (.smul 10 (.var 0))) (.add (.lit 143) (.smul 10 (.var 0)))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 142) (Nat.le_add_right 143 _)))
co_a9o co_a9o_ok.1 co_a9o_ok.2
end APDoubleIrr5b
#print axioms APDoubleIrr5b.a3e
#print axioms APDoubleIrr5b.a3o
#print axioms APDoubleIrr5b.a7e
#print axioms APDoubleIrr5b.a7o
#print axioms APDoubleIrr5b.a9e
#print axioms APDoubleIrr5b.a9o
lean_all/hodge/APDoubleMore.lean
/-
hodge/APDoubleMore.lean — T41 cycle 291 (goal G34): the APDouble character (a = 1) is balanced and irreducible for
d = 7 (q = 26 + 2r), d = 9 (q = 34 + 2r), d = 10 (q = 20 + r), every r — the t = 1 reflection test of APPairIrrGen
(rfl over all splittings) and APDouble.ap_double_bal.
-/
import hodge.APDouble
import hodge.APPairIrrGen
namespace APDoubleMore
open Indecomp APPairIrrGen APDouble
def co7 : List (Nat × Nat) := [(1, 0), (27, 2), (53, 4), (79, 6), (105, 8), (131, 10), (157, 12), (98, 7), (168, 14)]
set_option maxRecDepth 200000 in
theorem co7_ok : co7.all (small 182 14) = true ∧ (splitsG co7).all (chkSplit 182 14) = true := ⟨rfl, rfl⟩
set_option maxHeartbeats 8000000 in
set_option maxRecDepth 200000 in
theorem d7_list (r : Nat) : apL (5 + 1 + 1) 1 (25 + 2 * r + 1) ++ [(5 + 1 + 1) * 1 + (91 + 7 * r), 168 + 14 * r]
= co7.map (ev r) := by
show [1 + 0 * (25 + 2 * r + 1), 1 + 1 * (25 + 2 * r + 1), 1 + 2 * (25 + 2 * r + 1), 1 + 3 * (25 + 2 * r + 1), 1 + 4 * (25 + 2 * r + 1), 1 + 5 * (25 + 2 * r + 1), 1 + 6 * (25 + 2 * r + 1), (5 + 1 + 1) * 1 + (91 + 7 * r), 168 + 14 * r] = [1 + 0 * r, 27 + 2 * r, 53 + 4 * r, 79 + 6 * r, 105 + 8 * r, 131 + 10 * r, 157 + 12 * r, 98 + 7 * r, 168 + 14 * r]
rw [(show 1 + 0*(25 + 2*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 25) (.mul (.lit 2) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(25 + 2*(r) + 1) = 27 + 2*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 25) (.mul (.lit 2) (.var 0))) (.lit 1)))) (.add (.lit 27) (.mul (.lit 2) (.var 0 -- (+1259 chars; full line in the Zenodo source)
set_option maxRecDepth 200000 in
/-- **d = 7: balanced and irreducible.** -/
theorem d7_both (r : Nat) :
bal (91 + 7 * r + (91 + 7 * r)) (co7.map (ev r)) = true ∧
indec (180 + 14 * r + 2) (co7.map (ev r)) = true := by
refine ⟨?_, indec_lin _ 182 14 r (show 182 + 14*(r) = 180 + 14*(r) + 2 from NatNorm.sound [r] (.add (.lit 182) (.mul (.lit 14) (.var 0))) (.add (.add (.lit 180) (.mul (.lit 14) (.var 0))) (.lit 2)) rfl) co7 co7_ok.1 co7_ok.2⟩
rw [← d7_list r]
exact ap_double_bal 5 (25 + 2 * r) (91 + 7 * r) 1 (168 + 14 * r)
(show (5 + 1 + 1)*(25 + 2*(r) + 1) = 91 + 7*(r) + (91 + 7*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 5) (.lit 1)) (.lit 1)) (.add (.add (.lit 25) (.mul (.lit 2) (.var 0))) (.lit 1))) (.add (.add (.lit 91) (.mul (.lit 7) (.var 0))) (.add (.lit 91) (.mul (.lit 7) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (91 + 7*(r)) = (5 + 1 + 1)*1 + (1 + (83 + 7*(r))) from NatNorm.sound [r] (.add (.lit 91) (.mul (.lit 7) (.var 0))) (.add (.mul (.add (.add (.lit 5) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 83) (.mul (.lit 7) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (5 + 1 + 1)*1 + (5 + 1 + 1)*1 + (168 + 14*(r)) = 91 + 7*(r) + (91 + 7*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 5) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 5) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 168) (.mul (.lit 14) (.var 0)))) (.add (.add (.lit 91) (.mul (.lit 7) (.var 0))) (.add (.lit 91) (.mul (.lit 7) (.var 0)))) rfl)
def co9 : List (Nat × Nat) := [(1, 0), (35, 2), (69, 4), (103, 6), (137, 8), (171, 10), (205, 12), (239, 14), (273, 16), (162, 9), (288, 18)]
set_option maxRecDepth 200000 in
theorem co9_ok : co9.all (small 306 18) = true ∧ (splitsG co9).all (chkSplit 306 18) = true := ⟨rfl, rfl⟩
set_option maxHeartbeats 8000000 in
set_option maxRecDepth 200000 in
theorem d9_list (r : Nat) : apL (7 + 1 + 1) 1 (33 + 2 * r + 1) ++ [(7 + 1 + 1) * 1 + (153 + 9 * r), 288 + 18 * r]
= co9.map (ev r) := by
show [1 + 0 * (33 + 2 * r + 1), 1 + 1 * (33 + 2 * r + 1), 1 + 2 * (33 + 2 * r + 1), 1 + 3 * (33 + 2 * r + 1), 1 + 4 * (33 + 2 * r + 1), 1 + 5 * (33 + 2 * r + 1), 1 + 6 * (33 + 2 * r + 1), 1 + 7 * (33 + 2 * r + 1), 1 + 8 * (33 + 2 * r + 1), (7 + 1 + 1) * 1 + (153 + 9 * r), 288 + 18 * r] = [1 + 0 * r, 35 + 2 * r, 69 + 4 * r, 103 + 6 * r, 137 + 8 * r, 171 + 10 * r, 205 + 12 * r, 239 + 14 * r, 273 + -- (+35 chars; full line in the Zenodo source)
rw [(show 1 + 0*(33 + 2*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 33) (.mul (.lit 2) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(33 + 2*(r) + 1) = 35 + 2*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 33) (.mul (.lit 2) (.var 0))) (.lit 1)))) (.add (.lit 35) (.mul (.lit 2) (.var 0 -- (+1679 chars; full line in the Zenodo source)
set_option maxRecDepth 200000 in
/-- **d = 9: balanced and irreducible.** -/
theorem d9_both (r : Nat) :
bal (153 + 9 * r + (153 + 9 * r)) (co9.map (ev r)) = true ∧
indec (304 + 18 * r + 2) (co9.map (ev r)) = true := by
refine ⟨?_, indec_lin _ 306 18 r (show 306 + 18*(r) = 304 + 18*(r) + 2 from NatNorm.sound [r] (.add (.lit 306) (.mul (.lit 18) (.var 0))) (.add (.add (.lit 304) (.mul (.lit 18) (.var 0))) (.lit 2)) rfl) co9 co9_ok.1 co9_ok.2⟩
rw [← d9_list r]
exact ap_double_bal 7 (33 + 2 * r) (153 + 9 * r) 1 (288 + 18 * r)
(show (7 + 1 + 1)*(33 + 2*(r) + 1) = 153 + 9*(r) + (153 + 9*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 7) (.lit 1)) (.lit 1)) (.add (.add (.lit 33) (.mul (.lit 2) (.var 0))) (.lit 1))) (.add (.add (.lit 153) (.mul (.lit 9) (.var 0))) (.add (.lit 153) (.mul (.lit 9) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (153 + 9*(r)) = (7 + 1 + 1)*1 + (1 + (143 + 9*(r))) from NatNorm.sound [r] (.add (.lit 153) (.mul (.lit 9) (.var 0))) (.add (.mul (.add (.add (.lit 7) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 143) (.mul (.lit 9) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (7 + 1 + 1)*1 + (7 + 1 + 1)*1 + (288 + 18*(r)) = 153 + 9*(r) + (153 + 9*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 7) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 7) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 288) (.mul (.lit 18) (.var 0)))) (.add (.add (.lit 153) (.mul (.lit 9) (.var 0))) (.add (.lit 153) (.mul (.lit 9) (.var 0)))) rfl)
def co10 : List (Nat × Nat) := [(1, 0), (21, 1), (41, 2), (61, 3), (81, 4), (101, 5), (121, 6), (141, 7), (161, 8), (181, 9), (110, 5), (180, 10)]
set_option maxRecDepth 200000 in
theorem co10_ok : co10.all (small 200 10) = true ∧ (splitsG co10).all (chkSplit 200 10) = true := ⟨rfl, rfl⟩
set_option maxHeartbeats 8000000 in
set_option maxRecDepth 200000 in
theorem d10_list (r : Nat) : apL (8 + 1 + 1) 1 (19 + 1 * r + 1) ++ [(8 + 1 + 1) * 1 + (100 + 5 * r), 180 + 10 * r]
= co10.map (ev r) := by
show [1 + 0 * (19 + 1 * r + 1), 1 + 1 * (19 + 1 * r + 1), 1 + 2 * (19 + 1 * r + 1), 1 + 3 * (19 + 1 * r + 1), 1 + 4 * (19 + 1 * r + 1), 1 + 5 * (19 + 1 * r + 1), 1 + 6 * (19 + 1 * r + 1), 1 + 7 * (19 + 1 * r + 1), 1 + 8 * (19 + 1 * r + 1), 1 + 9 * (19 + 1 * r + 1), (8 + 1 + 1) * 1 + (100 + 5 * r), 180 + 10 * r] = [1 + 0 * r, 21 + 1 * r, 41 + 2 * r, 61 + 3 * r, 81 + 4 * r, 101 + 5 * r, 121 + 6 * -- (+68 chars; full line in the Zenodo source)
rw [(show 1 + 0*(19 + 1*(r) + 1) = 1 + 0*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.add (.add (.lit 19) (.mul (.lit 1) (.var 0))) (.lit 1)))) (.add (.lit 1) (.mul (.lit 0) (.var 0))) rfl), (show 1 + 1*(19 + 1*(r) + 1) = 21 + 1*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 1) (.add (.add (.lit 19) (.mul (.lit 1) (.var 0))) (.lit 1)))) (.add (.lit 21) (.mul (.lit 1) (.var 0 -- (+1872 chars; full line in the Zenodo source)
set_option maxRecDepth 200000 in
/-- **d = 10: balanced and irreducible.** -/
theorem d10_both (r : Nat) :
bal (100 + 5 * r + (100 + 5 * r)) (co10.map (ev r)) = true ∧
indec (198 + 10 * r + 2) (co10.map (ev r)) = true := by
refine ⟨?_, indec_lin _ 200 10 r (show 200 + 10*(r) = 198 + 10*(r) + 2 from NatNorm.sound [r] (.add (.lit 200) (.mul (.lit 10) (.var 0))) (.add (.add (.lit 198) (.mul (.lit 10) (.var 0))) (.lit 2)) rfl) co10 co10_ok.1 co10_ok.2⟩
rw [← d10_list r]
exact ap_double_bal 8 (19 + 1 * r) (100 + 5 * r) 1 (180 + 10 * r)
(show (8 + 1 + 1)*(19 + 1*(r) + 1) = 100 + 5*(r) + (100 + 5*(r)) from NatNorm.sound [r] (.mul (.add (.add (.lit 8) (.lit 1)) (.lit 1)) (.add (.add (.lit 19) (.mul (.lit 1) (.var 0))) (.lit 1))) (.add (.add (.lit 100) (.mul (.lit 5) (.var 0))) (.add (.lit 100) (.mul (.lit 5) (.var 0)))) rfl)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (100 + 5*(r)) = (8 + 1 + 1)*1 + (1 + (89 + 5*(r))) from NatNorm.sound [r] (.add (.lit 100) (.mul (.lit 5) (.var 0))) (.add (.mul (.add (.add (.lit 8) (.lit 1)) (.lit 1)) (.lit 1)) (.add (.lit 1) (.add (.lit 89) (.mul (.lit 5) (.var 0))))) rfl)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (8 + 1 + 1)*1 + (8 + 1 + 1)*1 + (180 + 10*(r)) = 100 + 5*(r) + (100 + 5*(r)) from NatNorm.sound [r] (.add (.add (.mul (.add (.add (.lit 8) (.lit 1)) (.lit 1)) (.lit 1)) (.mul (.add (.add (.lit 8) (.lit 1)) (.lit 1)) (.lit 1))) (.add (.lit 180) (.mul (.lit 10) (.var 0)))) (.add (.add (.lit 100) (.mul (.lit 5) (.var 0))) (.add (.lit 100) (.mul (.lit 5) (.var 0)))) rfl)
end APDoubleMore
#print axioms APDoubleMore.d7_both
#print axioms APDoubleMore.d9_both
#print axioms APDoubleMore.d10_both
lean_all/hodge/APDoubleMore2.lean
/-
hodge/APDoubleMore2.lean — T41 cycle 298 (goal G41, Kamiak): the APDouble character (a = 1) is balanced and
irreducible for d = 11 (q = 42 + 2r) and d = 12 (q = 24 + r), every r — t = 1 reflection over 8192 and 16384
splittings (rfl, checked on Kamiak) and APDouble.ap_double_bal.
-/
import hodge.APDouble
import hodge.APPairIrrGen
import lib.Semi
namespace APDoubleMore2
open Indecomp APPairIrrGen APDouble
def co11 : List (Nat × Nat) := [(1, 0), (43, 2), (85, 4), (127, 6), (169, 8), (211, 10), (253, 12), (295, 14), (337, 16), (379, 18), (421, 20), (242, 11), (440, 22)]
set_option maxRecDepth 2000000 in
theorem co11_ok : co11.all (small 462 22) = true ∧ (splitsG co11).all (chkSplit 462 22) = true := ⟨rfl, rfl⟩
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d11_list (r : Nat) : apL (9 + 1 + 1) 1 (41 + 2 * r + 1) ++ [(9 + 1 + 1) * 1 + (231 + 11 * r), 440 + 22 * r]
= co11.map (ev r) := by
show [1 + 0 * (41 + 2 * r + 1), 1 + 1 * (41 + 2 * r + 1), 1 + 2 * (41 + 2 * r + 1), 1 + 3 * (41 + 2 * r + 1), 1 + 4 * (41 + 2 * r + 1), 1 + 5 * (41 + 2 * r + 1), 1 + 6 * (41 + 2 * r + 1), 1 + 7 * (41 + 2 * r + 1), 1 + 8 * (41 + 2 * r + 1), 1 + 9 * (41 + 2 * r + 1), 1 + 10 * (41 + 2 * r + 1), (9 + 1 + 1) * 1 + (231 + 11 * r), 440 + 22 * r] = [1 + 0 * r, 43 + 2 * r, 85 + 4 * r, 127 + 6 * r, 169 + -- (+118 chars; full line in the Zenodo source)
rw [(show 1 + 0*(41 + 2*(r) + 1) = 1 + 0*(r) by lib_nat), (show 1 + 1*(41 + 2*(r) + 1) = 43 + 2*(r) by lib_nat), (show 1 + 2*(41 + 2*(r) + 1) = 85 + 4*(r) by lib_nat), (show 1 + 3*(41 + 2*(r) + 1) = 127 + 6*(r) by lib_nat), (show 1 + 4*(41 + 2*(r) + 1) = 169 + 8*(r) by lib_nat), (show 1 + 5*(41 + 2*(r) + 1) = 211 + 10*(r) by lib_nat), (show 1 + 6*(41 + 2*(r) + 1) = 253 + 12*(r) by lib_nat), (sho -- (+289 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d11_both (r : Nat) :
bal (231 + 11 * r + (231 + 11 * r)) (co11.map (ev r)) = true ∧
indec (460 + 22 * r + 2) (co11.map (ev r)) = true := by
refine ⟨?_, indec_lin _ 462 22 r (show 462 + 22*(r) = 460 + 22*(r) + 2 by lib_nat) co11 co11_ok.1 co11_ok.2⟩
rw [← d11_list r]
exact ap_double_bal 9 (41 + 2 * r) (231 + 11 * r) 1 (440 + 22 * r)
(show (9 + 1 + 1)*(41 + 2*(r) + 1) = 231 + 11*(r) + (231 + 11*(r)) by lib_nat)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (231 + 11*(r)) = (9 + 1 + 1)*1 + (1 + (219 + 11*(r))) by lib_nat)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (9 + 1 + 1)*1 + (9 + 1 + 1)*1 + (440 + 22*(r)) = 231 + 11*(r) + (231 + 11*(r)) by lib_nat)
def co12 : List (Nat × Nat) := [(1, 0), (25, 1), (49, 2), (73, 3), (97, 4), (121, 5), (145, 6), (169, 7), (193, 8), (217, 9), (241, 10), (265, 11), (156, 6), (264, 12)]
set_option maxRecDepth 2000000 in
theorem co12_ok : co12.all (small 288 12) = true ∧ (splitsG co12).all (chkSplit 288 12) = true := ⟨rfl, rfl⟩
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d12_list (r : Nat) : apL (10 + 1 + 1) 1 (23 + 1 * r + 1) ++ [(10 + 1 + 1) * 1 + (144 + 6 * r), 264 + 12 * r]
= co12.map (ev r) := by
show [1 + 0 * (23 + 1 * r + 1), 1 + 1 * (23 + 1 * r + 1), 1 + 2 * (23 + 1 * r + 1), 1 + 3 * (23 + 1 * r + 1), 1 + 4 * (23 + 1 * r + 1), 1 + 5 * (23 + 1 * r + 1), 1 + 6 * (23 + 1 * r + 1), 1 + 7 * (23 + 1 * r + 1), 1 + 8 * (23 + 1 * r + 1), 1 + 9 * (23 + 1 * r + 1), 1 + 10 * (23 + 1 * r + 1), 1 + 11 * (23 + 1 * r + 1), (10 + 1 + 1) * 1 + (144 + 6 * r), 264 + 12 * r] = [1 + 0 * r, 25 + 1 * r, 49 + -- (+151 chars; full line in the Zenodo source)
rw [(show 1 + 0*(23 + 1*(r) + 1) = 1 + 0*(r) by lib_nat), (show 1 + 1*(23 + 1*(r) + 1) = 25 + 1*(r) by lib_nat), (show 1 + 2*(23 + 1*(r) + 1) = 49 + 2*(r) by lib_nat), (show 1 + 3*(23 + 1*(r) + 1) = 73 + 3*(r) by lib_nat), (show 1 + 4*(23 + 1*(r) + 1) = 97 + 4*(r) by lib_nat), (show 1 + 5*(23 + 1*(r) + 1) = 121 + 5*(r) by lib_nat), (show 1 + 6*(23 + 1*(r) + 1) = 145 + 6*(r) by lib_nat), (show 1 -- (+339 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 200000 in
theorem d12_both (r : Nat) :
bal (144 + 6 * r + (144 + 6 * r)) (co12.map (ev r)) = true ∧
indec (286 + 12 * r + 2) (co12.map (ev r)) = true := by
refine ⟨?_, indec_lin _ 288 12 r (show 288 + 12*(r) = 286 + 12*(r) + 2 by lib_nat) co12 co12_ok.1 co12_ok.2⟩
rw [← d12_list r]
exact ap_double_bal 10 (23 + 1 * r) (144 + 6 * r) 1 (264 + 12 * r)
(show (10 + 1 + 1)*(23 + 1*(r) + 1) = 144 + 6*(r) + (144 + 6*(r)) by lib_nat)
(Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_left 1 _))
(by rw [(show (144 + 6*(r)) = (10 + 1 + 1)*1 + (1 + (131 + 6*(r))) by lib_nat)]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 _)))
(show (10 + 1 + 1)*1 + (10 + 1 + 1)*1 + (264 + 12*(r)) = 144 + 6*(r) + (144 + 6*(r)) by lib_nat)
end APDoubleMore2
#print axioms APDoubleMore2.d11_both
#print axioms APDoubleMore2.d12_both
lean_all/hodge/APDoubleSmall.lean
/-
hodge/APDoubleSmall.lean — T41 cycle 320 (goal G55): the small sizes of the d = 3 and d = 5 APDouble families (a = 1),
by rfl, completing the classification with APDoubleIrr (d = 3, p ≥ 5) and APDoubleIrr5 (d = 5, p ≥ 9):
d = 3, m = 6p: [1, 1+2p, 1+4p, 3+3p, 6p−6] is irreducible exactly for p ≠ 2, 4 (p ≥ 2)
d = 5, m = 10p: [1, 1+2p, …, 1+8p, 5+5p, 10p−10] is irreducible exactly for p ≠ 2, 3, 6 (p ≥ 2)
(balanced for every p ≥ 2 by APDouble.)
-/
import hodge.Indecomp
namespace APDoubleSmall
open Indecomp
def f3 (p : Nat) : List Nat := [1, 1 + 2 * p, 1 + 4 * p, 3 + 3 * p, 6 * p - 6]
def f5 (p : Nat) : List Nat := [1, 1 + 2 * p, 1 + 4 * p, 1 + 6 * p, 1 + 8 * p, 5 + 5 * p, 10 * p - 10]
set_option maxRecDepth 100000 in
theorem d3_small : [3].all (fun p => indec (6 * p) (f3 p)) = true ∧
[2, 4].all (fun p => !(indec (6 * p) (f3 p))) = true := ⟨rfl, rfl⟩
set_option maxRecDepth 100000 in
theorem d5_small : [4, 5, 7, 8].all (fun p => indec (10 * p) (f5 p)) = true ∧
[2, 3, 6].all (fun p => !(indec (10 * p) (f5 p))) = true := ⟨rfl, rfl⟩
end APDoubleSmall
#print axioms APDoubleSmall.d3_small
#print axioms APDoubleSmall.d5_small
lean_all/hodge/APDoubleSmall2.lean
/-
hodge/APDoubleSmall2.lean — T41 cycle 321 (goal G56): the small sizes of the d = 6 and d = 8 APDouble families
(a = 1), by rfl; with APDoubleIrr (d = 6: q ≥ 13; d = 8: q ≥ 16) the classification is complete:
d = 6, m = 6q: [1 + kq (k < 6), 6 + 3q, 6q − 12] is irreducible exactly for q ∈ {6, 9, 12} ∪ [13, ∞) (q ≥ 3)
d = 8, m = 8q: [1 + kq (k < 8), 8 + 4q, 8q − 16] is irreducible exactly for q ∈ {8, 10, …, 14} ∪ [16, ∞) (q ≥ 3)
-/
import hodge.Indecomp
namespace APDoubleSmall2
open Indecomp
def f6 (q : Nat) : List Nat := [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 1 + 4 * q, 1 + 5 * q, 6 + 3 * q, 6 * q - 12]
def f8 (q : Nat) : List Nat := [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 1 + 4 * q, 1 + 5 * q, 1 + 6 * q, 1 + 7 * q, 8 + 4 * q, 8 * q - 16]
set_option maxRecDepth 200000 in
set_option maxHeartbeats 0 in
theorem d6_small : [6, 9, 12].all (fun q => indec (6 * q) (f6 q)) = true ∧
[3, 4, 5, 7, 8, 10, 11].all (fun q => !(indec (6 * q) (f6 q))) = true := ⟨rfl, rfl⟩
set_option maxRecDepth 200000 in
set_option maxHeartbeats 0 in
theorem d8_small : [8, 10, 11, 12, 13, 14].all (fun q => indec (8 * q) (f8 q)) = true ∧
[3, 4, 5, 6, 7, 9, 15].all (fun q => !(indec (8 * q) (f8 q))) = true := ⟨rfl, rfl⟩
end APDoubleSmall2
#print axioms APDoubleSmall2.d6_small
#print axioms APDoubleSmall2.d8_small
lean_all/hodge/APDoubleSmall3.lean
/-
hodge/APDoubleSmall3.lean — T41 cycle 322 (goal G57): the small sizes of the d = 7 APDouble family (a = 1, m = 7q,
q even), by rfl; with APDoubleMore (q ≥ 26) the classification is complete: irreducible exactly for even
q ∈ {8, 10, 12, 14, 18, 20, 22, 24} ∪ [26, ∞) (q = 4, 6, 16 split).
-/
import hodge.Indecomp
namespace APDoubleSmall3
open Indecomp
def f7 (q : Nat) : List Nat :=
[1, 1 + q, 1 + 2 * q, 1 + 3 * q, 1 + 4 * q, 1 + 5 * q, 1 + 6 * q, 7 + 7 * q / 2, 7 * q - 14]
set_option maxRecDepth 400000 in
set_option maxHeartbeats 0 in
theorem d7_small : [8, 10, 12, 14, 18, 20, 22, 24].all (fun q => indec (7 * q) (f7 q)) = true ∧
[4, 6, 16].all (fun q => !(indec (7 * q) (f7 q))) = true := ⟨rfl, rfl⟩
end APDoubleSmall3
#print axioms APDoubleSmall3.d7_small
lean_all/hodge/APDoubleSmall4.lean
/-
hodge/APDoubleSmall4.lean — T41 cycle 323 (goal G58, Kamiak): the small sizes of the d = 9 (m = 9q, q even) and
d = 10 (m = 10q) APDouble families (a = 1), by rfl; with APDoubleMore (d = 9: q ≥ 34; d = 10: q ≥ 20):
d = 9: irreducible exactly for even q ∈ {6, 12, 16, 18, 22, 24, …, 32} ∪ [34, ∞) (q = 4, 8, 10, 14, 20 split)
d = 10: irreducible exactly for q ∈ {5, 8, 10, 13, …, 18} ∪ [20, ∞) (q = 3, 4, 6, 7, 9, 11, 12, 19 split)
-/
import hodge.Indecomp
namespace APDoubleSmall4
open Indecomp
def f9 (q : Nat) : List Nat :=
[1, 1 + q, 1 + 2 * q, 1 + 3 * q, 1 + 4 * q, 1 + 5 * q, 1 + 6 * q, 1 + 7 * q, 1 + 8 * q, 9 + 9 * q / 2, 9 * q - 18]
def f10 (q : Nat) : List Nat :=
[1, 1 + q, 1 + 2 * q, 1 + 3 * q, 1 + 4 * q, 1 + 5 * q, 1 + 6 * q, 1 + 7 * q, 1 + 8 * q, 1 + 9 * q, 10 + 5 * q, 10 * q - 20]
set_option maxRecDepth 2000000 in
set_option maxHeartbeats 0 in
theorem d9_small : [6, 12, 16, 18, 22, 24, 26, 28, 30, 32].all (fun q => indec (9 * q) (f9 q)) = true ∧
[4, 8, 10, 14, 20].all (fun q => !(indec (9 * q) (f9 q))) = true := ⟨rfl, rfl⟩
set_option maxRecDepth 2000000 in
set_option maxHeartbeats 0 in
theorem d10_small : [5, 8, 10, 13, 14, 15, 16, 17, 18].all (fun q => indec (10 * q) (f10 q)) = true ∧
[3, 4, 6, 7, 9, 11, 12, 19].all (fun q => !(indec (10 * q) (f10 q))) = true := ⟨rfl, rfl⟩
end APDoubleSmall4
#print axioms APDoubleSmall4.d9_small
#print axioms APDoubleSmall4.d10_small
lean_all/hodge/APPair.lean
/-
hodge/APPair.lean — T41 cycle 268 (goal G8, general step): an arithmetic progression of step m/4 plus the pair
(m/2 + 4a, m − 8a) is a balanced (Hodge) character of the Fermat variety, for every m = 4q.
Lean 4 core plus lib/NatNorm (Nat polynomial identities), hodge/ModHand, hodge/GcdHand, hodge/HalfGeneral.
mod_rep, mod_add, zero_mod_two residues by hand (x = r + k m, r < m ⇒ x mod m = r; etc.)
four_form, four_cases t odd ⇒ t = 1 + 4s ∨ 3 + 4s; N = n₀ + 4N′, n₀ < 4
res_ap t(a + kq) mod 4q = ρ + q·e when ta = ρ + q(n₀ + 4N′), n₀ + k t₀ = e + 4f
tsum_key for odd t with ρ = ta mod q ∉ {0, q/2}:
Σ ⟨t c_i⟩ = 12q = 3m for c = [a, a+q, a+2q, a+3q, 2q+4a, b], 8a + b = 4q
ap_pair_bal c is balanced in m = 4q whenever every unit t has ρ_t ∉ {0, q/2}
ap_pair_96, ap_pair_104 the AP(24), AP(26) characters of Unreached96 come from ap_pair_bal
-/
import lib.NatNorm
import hodge.GcdHand
namespace APPair
open Indecomp ModHand HalfGeneral
theorem mod_rep (x r m k : Nat) (hr : r < m) (h : x = r + k * m) : x % m = r := by
rw [h, add_mul_mod' r m (Nat.lt_of_le_of_lt (Nat.zero_le r) hr) k]
exact mod_lt' r m hr
theorem decomp (n m : Nat) (hm : 0 < m) : ∃ k, n = n % m + m * k :=
GcdHand.div_mod m hm (n + 1) n (Nat.lt_succ_self n)
theorem mod_add (u v m : Nat) (hm : 0 < m) : (u % m + v % m) % m = (u + v) % m := by
have ⟨i, hi⟩ := decomp u m hm
have ⟨j, hj⟩ := decomp v m hm
have e : u + v = (u % m + v % m) + (i + j) * m := by
calc u + v = (u % m + m * i) + (v % m + m * j) := by rw [← hi, ← hj]
_ = (u % m + v % m) + (i + j) * m := ((show (u % m) + (m)*(i) + ((v % m) + (m)*(j)) = (u % m) + (v % m) + ((i) + (j))*(m) from NatNorm.sound [u % m, v % m, m, i, j] (.add (.add (.var 0) (.mul (.var 2) (.var 3))) (.add (.var 1) (.mul (.var 2) (.var 4)))) (.add (.add (.var 0) (.var 1)) (.mul (.add (.var 3) (.var 4)) (.var 2))) rfl))
rw [e, add_mul_mod' _ m hm]
theorem zero_mod_two (z m : Nat) (h0 : 0 < z) (h2 : z < m + m) (hz : z % m = 0) : z = m := by
cases Nat.lt_or_ge z m with
| inl h =>
rw [mod_lt' z m h] at hz
rw [hz] at h0
exact absurd h0 (Nat.lt_irrefl 0)
| inr h =>
have ⟨w, hw⟩ := Nat.le.dest h
have hwm : w < m := Nat.lt_of_add_lt_add_left (hw ▸ h2)
have e : z % m = w := by
rw [← hw, Nat.add_comm, add_mod' w m (Nat.lt_of_le_of_lt (Nat.zero_le w) hwm)]
exact mod_lt' w m hwm
rw [e] at hz
rw [← hw, hz]
exact Nat.add_zero m
theorem two_form : ∀ s, ∃ s', s = 2 * s' ∨ s = 2 * s' + 1
| 0 => ⟨0, Or.inl rfl⟩
| s + 1 => by
have ⟨s', h⟩ := two_form s
cases h with
| inl h => exact ⟨s', Or.inr (by rw [h])⟩
| inr h => exact ⟨s' + 1, Or.inl (by rw [h]; exact ((show 2*(s')+1+1 = 2*((s')+1) from NatNorm.sound [s'] (.add (.add (.mul (.lit 2) (.var 0)) (.lit 1)) (.lit 1)) (.mul (.lit 2) (.add (.var 0) (.lit 1))) rfl)))⟩
theorem four_form (t : Nat) (ht : isOdd t = true) : ∃ s, t = 1 + 4 * s ∨ t = 3 + 4 * s := by
have ⟨s, hs⟩ := odd_form t ht
have ⟨s', h⟩ := two_form s
cases h with
| inl h => exact ⟨s', Or.inl (by rw [hs, h]; exact ((show 2*(2*(s'))+1 = 1+4*(s') from NatNorm.sound [s'] (.add (.mul (.lit 2) (.mul (.lit 2) (.var 0))) (.lit 1)) (.add (.lit 1) (.mul (.lit 4) (.var 0))) rfl)))⟩
| inr h => exact ⟨s', Or.inr (by rw [hs, h]; exact ((show 2*(2*(s')+1)+1 = 3+4*(s') from NatNorm.sound [s'] (.add (.mul (.lit 2) (.add (.mul (.lit 2) (.var 0)) (.lit 1))) (.lit 1)) (.add (.lit 3) (.mul (.lit 4) (.var 0))) rfl)))⟩
theorem four_cases : ∀ N, ∃ N', N = 0 + 4 * N' ∨ N = 1 + 4 * N' ∨ N = 2 + 4 * N' ∨ N = 3 + 4 * N'
| 0 => ⟨0, Or.inl rfl⟩
| N + 1 => by
have ⟨N', h⟩ := four_cases N
cases h with
| inl h => exact ⟨N', Or.inr (Or.inl (by rw [h]; exact ((show 0+4*(N')+1 = 1+4*(N') from NatNorm.sound [N'] (.add (.add (.lit 0) (.mul (.lit 4) (.var 0))) (.lit 1)) (.add (.lit 1) (.mul (.lit 4) (.var 0))) rfl))))⟩
| inr h => cases h with
| inl h => exact ⟨N', Or.inr (Or.inr (Or.inl (by rw [h]; exact ((show 1+4*(N')+1 = 2+4*(N') from NatNorm.sound [N'] (.add (.add (.lit 1) (.mul (.lit 4) (.var 0))) (.lit 1)) (.add (.lit 2) (.mul (.lit 4) (.var 0))) rfl)))))⟩
| inr h => cases h with
| inl h => exact ⟨N', Or.inr (Or.inr (Or.inr (by rw [h]; exact ((show 2+4*(N')+1 = 3+4*(N') from NatNorm.sound [N'] (.add (.add (.lit 2) (.mul (.lit 4) (.var 0))) (.lit 1)) (.add (.lit 3) (.mul (.lit 4) (.var 0))) rfl)))))⟩
| inr h => exact ⟨N' + 1, Or.inl (by rw [h]; exact ((show 3+4*(N')+1 = 0+4*((N')+1) from NatNorm.sound [N'] (.add (.add (.lit 3) (.mul (.lit 4) (.var 0))) (.lit 1)) (.add (.lit 0) (.mul (.lit 4) (.add (.var 0) (.lit 1)))) rfl)))⟩
theorem lt4 (ρ q e : Nat) (hρ : ρ < q) (he : e < 4) : ρ + q * e < 4 * q := by
have ⟨d, hd⟩ := Nat.le.dest he
have e1 : 4 * q = (q + q * e) + q * d := by
rw [← hd]; exact ((show ((e)+1+(d))*(q) = (q) + (q)*(e) + (q)*(d) from NatNorm.sound [q, e, d] (.mul (.add (.add (.var 1) (.lit 1)) (.var 2)) (.var 0)) (.add (.add (.var 0) (.mul (.var 0) (.var 1))) (.mul (.var 0) (.var 2))) rfl))
rw [e1]
exact Nat.lt_of_lt_of_le (Nat.add_lt_add_right hρ (q * e)) (Nat.le_add_right _ _)
theorem res_ap (q a t ρ N' s' t0 n0 k e f x : Nat) (hρ : ρ < q) (ht : t = t0 + 4 * s')
(hta : t * a = ρ + q * (n0 + 4 * N')) (hx : x = a + k * q) (hk : n0 + k * t0 = e + 4 * f) (he : e < 4) :
(t * x) % (4 * q) = ρ + q * e := by
apply mod_rep _ _ _ (f + N' + k * s') (lt4 ρ q e hρ he)
have e1 : t * x = t * a + k * q * t := by rw [hx]; exact ((show (t)*((a)+(k)*(q)) = (t)*(a) + (k)*(q)*(t) from NatNorm.sound [t, a, k, q] (.mul (.var 0) (.add (.var 1) (.mul (.var 2) (.var 3)))) (.add (.mul (.var 0) (.var 1)) (.mul (.mul (.var 2) (.var 3)) (.var 0))) rfl))
rw [e1, hta, ht]
have e2 : ρ + q * (n0 + 4 * N') + k * q * (t0 + 4 * s') = ρ + q * (n0 + k * t0) + (N' + k * s') * (4 * q) :=
((show (ρ) + (q)*((n0) + 4*(N')) + (k)*(q)*((t0) + 4*(s')) = (ρ) + (q)*((n0) + (k)*(t0)) + ((N') + (k)*(s'))*(4*(q)) from NatNorm.sound [ρ, q, n0, N', k, t0, s'] (.add (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.mul (.lit 4) (.var 3))))) (.mul (.mul (.var 4) (.var 1)) (.add (.var 5) (.mul (.lit 4) (.var 6))))) (.add (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.mul (.var 4) (.var 5))))) (. -- (+77 chars; full line in the Zenodo source)
rw [e2, hk]
exact ((show (ρ) + (q)*((e) + 4*(f)) + ((N') + (k)*(s'))*(4*(q)) = (ρ) + (q)*(e) + ((f) + (N') + (k)*(s'))*(4*(q)) from NatNorm.sound [ρ, q, e, f, N', k, s'] (.add (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.mul (.lit 4) (.var 3))))) (.mul (.add (.var 4) (.mul (.var 5) (.var 6))) (.mul (.lit 4) (.var 1)))) (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.mul (.add (.add (.var 3) (.var 4)) (.m -- (+55 chars; full line in the Zenodo source)
/-- The four AP residues sum to 4ρ + 6q (for given residue pattern e₀..e₃). -/
theorem ap4 (q a t ρ N' s' t0 n0 e0 e1 e2 e3 f0 f1 f2 f3 : Nat) (hρ : ρ < q) (ht : t = t0 + 4 * s')
(hta : t * a = ρ + q * (n0 + 4 * N'))
(k0 : n0 + 0 * t0 = e0 + 4 * f0) (k1 : n0 + 1 * t0 = e1 + 4 * f1) (k2 : n0 + 2 * t0 = e2 + 4 * f2)
(k3 : n0 + 3 * t0 = e3 + 4 * f3) (l0 : e0 < 4) (l1 : e1 < 4) (l2 : e2 < 4) (l3 : e3 < 4)
(h6 : e0 + e1 + e2 + e3 = 6) :
(t * a) % (4 * q) + ((t * (a + q)) % (4 * q) + ((t * (a + 2 * q)) % (4 * q) + (t * (a + 3 * q)) % (4 * q)))
= 4 * ρ + 6 * q := by
rw [res_ap q a t ρ N' s' t0 n0 0 e0 f0 a hρ ht hta ((show (a) = (a) + 0*(q) from NatNorm.sound [a, q] (.var 0) (.add (.var 0) (.mul (.lit 0) (.var 1))) rfl)) k0 l0,
res_ap q a t ρ N' s' t0 n0 1 e1 f1 (a + q) hρ ht hta ((show (a)+(q) = (a) + 1*(q) from NatNorm.sound [a, q] (.add (.var 0) (.var 1)) (.add (.var 0) (.mul (.lit 1) (.var 1))) rfl)) k1 l1,
res_ap q a t ρ N' s' t0 n0 2 e2 f2 (a + 2 * q) hρ ht hta rfl k2 l2,
res_ap q a t ρ N' s' t0 n0 3 e3 f3 (a + 3 * q) hρ ht hta rfl k3 l3]
have e : ρ + q * e0 + (ρ + q * e1 + (ρ + q * e2 + (ρ + q * e3))) = 4 * ρ + q * (e0 + e1 + e2 + e3) :=
((show (ρ) + (q)*(e0) + ((ρ) + (q)*(e1) + ((ρ) + (q)*(e2) + ((ρ) + (q)*(e3)))) = 4*(ρ) + (q)*((e0) + (e1) + (e2) + (e3)) from NatNorm.sound [ρ, q, e0, e1, e2, e3] (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.add (.add (.var 0) (.mul (.var 1) (.var 3))) (.add (.add (.var 0) (.mul (.var 1) (.var 4))) (.add (.var 0) (.mul (.var 1) (.var 5)))))) (.add (.mul (.lit 4) (.var 0)) (.mul (.var 1) (. -- (+62 chars; full line in the Zenodo source)
rw [e, h6, Nat.mul_comm q 6]
theorem add_lt_add' (a b c d : Nat) (h1 : a < b) (h2 : c < d) : a + c < b + d :=
Nat.lt_trans (Nat.add_lt_add_right h1 c) (Nat.add_lt_add_left h2 b)
theorem pos4 (q : Nat) (hq : 0 < q) : 0 < 4 * q :=
Nat.lt_of_lt_of_le hq (by rw [((show 4*(q) = (q) + 3*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.var 0) (.mul (.lit 3) (.var 0))) rfl))]; exact Nat.le_add_right q (3 * q))
theorem res_p1A (q a t ρ N' s' t0 n0 g : Nat) (ht : t = t0 + 4 * s') (hta : t * a = ρ + q * (n0 + 4 * N'))
(hg : 2 * t0 = 2 + 4 * g) (hA : 4 * ρ + 2 * q < 4 * q) : (t * (2 * q + 4 * a)) % (4 * q) = 4 * ρ + 2 * q := by
apply mod_rep _ _ _ (g + 2 * s' + n0 + 4 * N') hA
rw [((show (t)*(2*(q)+4*(a)) = 2*(q)*(t) + 4*((t)*(a)) from NatNorm.sound [t, q, a] (.mul (.var 0) (.add (.mul (.lit 2) (.var 1)) (.mul (.lit 4) (.var 2)))) (.add (.mul (.mul (.lit 2) (.var 1)) (.var 0)) (.mul (.lit 4) (.mul (.var 0) (.var 2)))) rfl)), hta, ht,
((show 2*(q)*((t0)+4*(s')) + 4*((ρ) + (q)*((n0)+4*(N'))) = (q)*(2*(t0)) + 4*(ρ) + (2*(s') + (n0) + 4*(N'))*(4*(q)) from NatNorm.sound [q, t0, ρ, s', n0, N'] (.add (.mul (.mul (.lit 2) (.var 0)) (.add (.var 1) (.mul (.lit 4) (.var 3)))) (.mul (.lit 4) (.add (.var 2) (.mul (.var 0) (.add (.var 4) (.mul (.lit 4) (.var 5))))))) (.add (.add (.mul (.var 0) (.mul (.lit 2) (.var 1))) (.mul (.lit 4) (. -- (+125 chars; full line in the Zenodo source)
exact ((show (q)*(2+4*(g)) + 4*(ρ) + (2*(s') + (n0) + 4*(N'))*(4*(q)) = 4*(ρ) + 2*(q) + ((g) + 2*(s') + (n0) + 4*(N'))*(4*(q)) from NatNorm.sound [q, g, ρ, s', n0, N'] (.add (.add (.mul (.var 0) (.add (.lit 2) (.mul (.lit 4) (.var 1)))) (.mul (.lit 4) (.var 2))) (.mul (.add (.add (.mul (.lit 2) (.var 3)) (.var 4)) (.mul (.lit 4) (.var 5))) (.mul (.lit 4) (.var 0)))) (.add (.add (.mul (.lit 4) (. -- (+161 chars; full line in the Zenodo source)
theorem res_p1B (q a t ρ N' s' t0 n0 g w : Nat) (ht : t = t0 + 4 * s') (hta : t * a = ρ + q * (n0 + 4 * N'))
(hg : 2 * t0 = 2 + 4 * g) (hw : 4 * ρ = 2 * q + w) (hwl : w < 4 * q) : (t * (2 * q + 4 * a)) % (4 * q) = w := by
apply mod_rep _ _ _ (1 + g + 2 * s' + n0 + 4 * N') hwl
rw [((show (t)*(2*(q)+4*(a)) = 2*(q)*(t) + 4*((t)*(a)) from NatNorm.sound [t, q, a] (.mul (.var 0) (.add (.mul (.lit 2) (.var 1)) (.mul (.lit 4) (.var 2)))) (.add (.mul (.mul (.lit 2) (.var 1)) (.var 0)) (.mul (.lit 4) (.mul (.var 0) (.var 2)))) rfl)), hta, ht,
((show 2*(q)*((t0)+4*(s')) + 4*((ρ) + (q)*((n0)+4*(N'))) = (q)*(2*(t0)) + 4*(ρ) + (2*(s') + (n0) + 4*(N'))*(4*(q)) from NatNorm.sound [q, t0, ρ, s', n0, N'] (.add (.mul (.mul (.lit 2) (.var 0)) (.add (.var 1) (.mul (.lit 4) (.var 3)))) (.mul (.lit 4) (.add (.var 2) (.mul (.var 0) (.add (.var 4) (.mul (.lit 4) (.var 5))))))) (.add (.add (.mul (.var 0) (.mul (.lit 2) (.var 1))) (.mul (.lit 4) (. -- (+129 chars; full line in the Zenodo source)
exact ((show (q)*(2+4*(g)) + (2*(q) + (w)) + (2*(s') + (n0) + 4*(N'))*(4*(q)) = (w) + (1 + (g) + 2*(s') + (n0) + 4*(N'))*(4*(q)) from NatNorm.sound [q, g, w, s', n0, N'] (.add (.add (.mul (.var 0) (.add (.lit 2) (.mul (.lit 4) (.var 1)))) (.add (.mul (.lit 2) (.var 0)) (.var 2))) (.mul (.add (.add (.mul (.lit 2) (.var 3)) (.var 4)) (.mul (.lit 4) (.var 5))) (.mul (.lit 4) (.var 0)))) (.add (.var -- (+147 chars; full line in the Zenodo source)
theorem res_8A (q a t ρ N' n0 : Nat) (hta : t * a = ρ + q * (n0 + 4 * N')) (h8 : 8 * ρ < 4 * q) :
(t * (8 * a)) % (4 * q) = 8 * ρ := by
apply mod_rep _ _ _ (2 * n0 + 8 * N') h8
rw [((show (t)*(8*(a)) = 8*((t)*(a)) from NatNorm.sound [t, a] (.mul (.var 0) (.mul (.lit 8) (.var 1))) (.mul (.lit 8) (.mul (.var 0) (.var 1))) rfl)), hta]
exact ((show 8*((ρ) + (q)*((n0) + 4*(N'))) = 8*(ρ) + (2*(n0) + 8*(N'))*(4*(q)) from NatNorm.sound [ρ, q, n0, N'] (.mul (.lit 8) (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.mul (.lit 4) (.var 3)))))) (.add (.mul (.lit 8) (.var 0)) (.mul (.add (.mul (.lit 2) (.var 2)) (.mul (.lit 8) (.var 3))) (.mul (.lit 4) (.var 1)))) rfl))
theorem res_8B (q a t ρ N' n0 w : Nat) (hta : t * a = ρ + q * (n0 + 4 * N')) (hw : 4 * ρ = 2 * q + w)
(h8 : w + w < 4 * q) : (t * (8 * a)) % (4 * q) = w + w := by
apply mod_rep _ _ _ (1 + 2 * n0 + 8 * N') h8
rw [((show (t)*(8*(a)) = 8*((t)*(a)) from NatNorm.sound [t, a] (.mul (.var 0) (.mul (.lit 8) (.var 1))) (.mul (.lit 8) (.mul (.var 0) (.var 1))) rfl)), hta, ((show 8*((ρ) + (q)*((n0) + 4*(N'))) = 2*(4*(ρ)) + (2*(n0) + 8*(N'))*(4*(q)) from NatNorm.sound [ρ, q, n0, N'] (.mul (.lit 8) (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.mul (.lit 4) (.var 3)))))) (.add (.mul (.lit 2) (.mul (.lit 4) (.var -- (+106 chars; full line in the Zenodo source)
exact ((show 2*(2*(q) + (w)) + (2*(n0) + 8*(N'))*(4*(q)) = (w) + (w) + (1 + 2*(n0) + 8*(N'))*(4*(q)) from NatNorm.sound [q, w, n0, N'] (.add (.mul (.lit 2) (.add (.mul (.lit 2) (.var 0)) (.var 1))) (.mul (.add (.mul (.lit 2) (.var 2)) (.mul (.lit 8) (.var 3))) (.mul (.lit 4) (.var 0)))) (.add (.add (.var 1) (.var 1)) (.mul (.add (.add (.lit 1) (.mul (.lit 2) (.var 2))) (.mul (.lit 8) (.var 3))) -- (+32 chars; full line in the Zenodo source)
theorem comp (x y m r : Nat) (hm : 0 < m) (hy : y % m = r) (hr0 : 0 < r) (hrm : r < m) (hxy : (x + y) % m = 0) :
x % m + r = m := by
have e := mod_add x y m hm
rw [hy, hxy] at e
exact zero_mod_two _ m (Nat.lt_of_lt_of_le hr0 (Nat.le_add_left r _)) (add_lt_add' _ _ _ _ (Nat.mod_lt x hm) hrm) e
theorem tb8 (q a b t : Nat) (hq : 0 < q) (hb : 8 * a + b = 4 * q) : (t * b + t * (8 * a)) % (4 * q) = 0 := by
rw [((show (t)*(b) + (t)*(8*(a)) = (t)*(8*(a)+(b)) from NatNorm.sound [t, a, b] (.add (.mul (.var 0) (.var 2)) (.mul (.var 0) (.mul (.lit 8) (.var 1)))) (.mul (.var 0) (.add (.mul (.lit 8) (.var 1)) (.var 2))) rfl)), hb]
exact mod_rep _ 0 _ t (pos4 q hq) ((show (t)*(4*(q)) = 0 + (t)*(4*(q)) from NatNorm.sound [t, q] (.mul (.var 0) (.mul (.lit 4) (.var 1))) (.add (.lit 0) (.mul (.var 0) (.mul (.lit 4) (.var 1)))) rfl))
theorem dbl_inj (x y : Nat) (h : x + x = y + y) : x = y := by
cases Nat.lt_trichotomy x y with
| inl l => exact absurd (h ▸ add_lt_add' _ _ _ _ l l) (Nat.lt_irrefl _)
| inr h' => cases h' with
| inl e => exact e
| inr l => exact absurd (h ▸ add_lt_add' _ _ _ _ l l) (Nat.lt_irrefl _)
/-- **The pair part.** ⟨t(2q+4a)⟩ + ⟨tb⟩ + 4ρ = 6q. -/
theorem pair_sum (q a b t ρ N' s' t0 n0 g : Nat) (hq : 0 < q) (hb : 8 * a + b = 4 * q) (hρq : ρ < q) (hρ0 : 0 < ρ)
(hρh : ρ + ρ ≠ q) (ht : t = t0 + 4 * s') (hta : t * a = ρ + q * (n0 + 4 * N')) (hg : 2 * t0 = 2 + 4 * g) :
(t * (2 * q + 4 * a)) % (4 * q) + (t * b) % (4 * q) + 4 * ρ = 6 * q := by
have hm := pos4 q hq
have h4 : 4 * ρ < 4 * q := by
rw [((show 4*(ρ) = (ρ) + (ρ) + ((ρ) + (ρ)) from NatNorm.sound [ρ] (.mul (.lit 4) (.var 0)) (.add (.add (.var 0) (.var 0)) (.add (.var 0) (.var 0))) rfl)), ((show 4*(q) = (q) + (q) + ((q) + (q)) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.add (.var 0) (.var 0)) (.add (.var 0) (.var 0))) rfl))]
exact add_lt_add' _ _ _ _ (add_lt_add' _ _ _ _ hρq hρq) (add_lt_add' _ _ _ _ hρq hρq)
cases Nat.lt_trichotomy (4 * ρ) (2 * q) with
| inl lt =>
have hA : 4 * ρ + 2 * q < 4 * q := by
rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.add_lt_add_right lt (2 * q)
have h8 : 8 * ρ < 4 * q := by
rw [((show 8*(ρ) = 4*(ρ) + 4*(ρ) from NatNorm.sound [ρ] (.mul (.lit 8) (.var 0)) (.add (.mul (.lit 4) (.var 0)) (.mul (.lit 4) (.var 0))) rfl)), ((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact add_lt_add' _ _ _ _ lt lt
have h80 : 0 < 8 * ρ := Nat.lt_of_lt_of_le hρ0 (by rw [((show 8*(ρ) = (ρ) + 7*(ρ) from NatNorm.sound [ρ] (.mul (.lit 8) (.var 0)) (.add (.var 0) (.mul (.lit 7) (.var 0))) rfl))]; exact Nat.le_add_right _ _)
have hB := comp (t * b) (t * (8 * a)) (4 * q) (8 * ρ) hm (res_8A q a t ρ N' n0 hta h8) h80 h8 (tb8 q a b t hq hb)
rw [res_p1A q a t ρ N' s' t0 n0 g ht hta hg hA,
((show 4*(ρ) + 2*(q) + ((t * b) % (4 * q)) + 4*(ρ) = 2*(q) + (((t * b) % (4 * q)) + 8*(ρ)) from NatNorm.sound [ρ, q, (t * b) % (4 * q)] (.add (.add (.add (.mul (.lit 4) (.var 0)) (.mul (.lit 2) (.var 1))) (.var 2)) (.mul (.lit 4) (.var 0))) (.add (.mul (.lit 2) (.var 1)) (.add (.var 2) (.mul (.lit 8) (.var 0)))) rfl)), hB]
exact ((show 2*(q) + 4*(q) = 6*(q) from NatNorm.sound [q] (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 4) (.var 0))) (.mul (.lit 6) (.var 0)) rfl))
| inr h => cases h with
| inl eq =>
have e2 : ρ + ρ = q := dbl_inj _ _ (by rw [((show (ρ) + (ρ) + ((ρ) + (ρ)) = 4*(ρ) from NatNorm.sound [ρ] (.add (.add (.var 0) (.var 0)) (.add (.var 0) (.var 0))) (.mul (.lit 4) (.var 0)) rfl)), eq]; exact ((show 2*(q) = (q) + (q) from NatNorm.sound [q] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl)))
exact absurd e2 hρh
| inr gt =>
have ⟨k, hk⟩ := Nat.le.dest gt
have hw : 4 * ρ = 2 * q + (k + 1) := by rw [← hk]; exact ((show 2*(q) + 1 + (k) = 2*(q) + ((k) + 1) from NatNorm.sound [q, k] (.add (.add (.mul (.lit 2) (.var 0)) (.lit 1)) (.var 1)) (.add (.mul (.lit 2) (.var 0)) (.add (.var 1) (.lit 1))) rfl))
have hw2 : k + 1 < 2 * q := by
apply Nat.lt_of_add_lt_add_left (n := 2 * q)
rw [← hw, ← ((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact h4
have h2q : 0 < 2 * q := Nat.lt_of_lt_of_le hq (by rw [((show 2*(q) = (q) + (q) from NatNorm.sound [q] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl))]; exact Nat.le_add_right q q)
have hwl : k + 1 < 4 * q := Nat.lt_trans hw2 (by rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.lt_add_of_pos_right h2q)
have h8 : (k + 1) + (k + 1) < 4 * q := by rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact add_lt_add' _ _ _ _ hw2 hw2
have hB := comp (t * b) (t * (8 * a)) (4 * q) ((k + 1) + (k + 1)) hm (res_8B q a t ρ N' n0 (k + 1) hta hw h8)
(Nat.lt_of_lt_of_le (Nat.succ_pos k) (Nat.le_add_right _ _)) h8 (tb8 q a b t hq hb)
rw [res_p1B q a t ρ N' s' t0 n0 g (k + 1) ht hta hg hw hwl, hw,
((show ((k + 1)) + ((t * b) % (4 * q)) + (2*(q) + ((k + 1))) = 2*(q) + (((t * b) % (4 * q)) + (((k + 1)) + ((k + 1)))) from NatNorm.sound [(k + 1), q, (t * b) % (4 * q)] (.add (.add (.var 0) (.var 2)) (.add (.mul (.lit 2) (.var 1)) (.var 0))) (.add (.mul (.lit 2) (.var 1)) (.add (.var 2) (.add (.var 0) (.var 0)))) rfl)), hB]
exact ((show 2*(q) + 4*(q) = 6*(q) from NatNorm.sound [q] (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 4) (.var 0))) (.mul (.lit 6) (.var 0)) rfl))
theorem combine (X P B ρ q : Nat) (h1 : X = 4 * ρ + 6 * q) (h2 : P + B + 4 * ρ = 6 * q) : X + (P + B) = 12 * q := by
rw [h1, ((show 4*(ρ) + 6*(q) + ((P) + (B)) = 6*(q) + ((P) + (B) + 4*(ρ)) from NatNorm.sound [ρ, q, P, B] (.add (.add (.mul (.lit 4) (.var 0)) (.mul (.lit 6) (.var 1))) (.add (.var 2) (.var 3))) (.add (.mul (.lit 6) (.var 1)) (.add (.add (.var 2) (.var 3)) (.mul (.lit 4) (.var 0)))) rfl)), h2]
exact ((show 6*(q) + 6*(q) = 12*(q) from NatNorm.sound [q] (.add (.mul (.lit 6) (.var 0)) (.mul (.lit 6) (.var 0))) (.mul (.lit 12) (.var 0)) rfl))
/-- **Key identity.** For odd t with ρ = ⟨ta⟩_q ∉ {0, q/2}: Σ ⟨t c_i⟩_m = 12q = 3m. -/
theorem tsum_key (q a b t ρ N : Nat) (hq : 0 < q) (hb : 8 * a + b = 4 * q) (ht : isOdd t = true)
(hN : t * a = ρ + q * N) (hρq : ρ < q) (hρ0 : 0 < ρ) (hρh : ρ + ρ ≠ q) :
tsum (4 * q) t [a, a + q, a + 2 * q, a + 3 * q, 2 * q + 4 * a, b] = 12 * q := by
show (t * a) % (4 * q) + ((t * (a + q)) % (4 * q) + ((t * (a + 2 * q)) % (4 * q) + ((t * (a + 3 * q)) % (4 * q) + ((t * (2 * q + 4 * a)) % (4 * q) + ((t * b) % (4 * q) + 0))))) = 12 * q
rw [((show ((t * a) % (4 * q)) + (((t * (a + q)) % (4 * q)) + (((t * (a + 2 * q)) % (4 * q)) + (((t * (a + 3 * q)) % (4 * q)) + (((t * (2 * q + 4 * a)) % (4 * q)) + (((t * b) % (4 * q)) + 0))))) = ((t * a) % (4 * q)) + (((t * (a + q)) % (4 * q)) + (((t * (a + 2 * q)) % (4 * q)) + ((t * (a + 3 * q)) % (4 * q)))) + (((t * (2 * q + 4 * a)) % (4 * q)) + ((t * b) % (4 * q))) from NatNorm.sound [(t * -- (+349 chars; full line in the Zenodo source)
have ⟨s', hs⟩ := four_form t ht
have ⟨N', hN'⟩ := four_cases N
cases hs with
| inl hs =>
cases hN' with
| inl hn =>
have hta : t * a = ρ + q * (0 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 0 0 1 2 3 0 0 0 0 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 1 0 0 hq hb hρq hρ0 hρh hs hta rfl)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (1 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 1 1 2 3 0 0 0 0 1 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 1 1 0 hq hb hρq hρ0 hρh hs hta rfl)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (2 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 2 2 3 0 1 0 0 1 1 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 1 2 0 hq hb hρq hρ0 hρh hs hta rfl)
| inr hn =>
have hta : t * a = ρ + q * (3 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 3 3 0 1 2 0 1 1 1 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 1 3 0 hq hb hρq hρ0 hρh hs hta rfl)
| inr hs =>
cases hN' with
| inl hn =>
have hta : t * a = ρ + q * (0 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 0 0 3 2 1 0 0 1 2 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 3 0 1 hq hb hρq hρ0 hρh hs hta rfl)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (1 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 1 1 0 3 2 0 1 1 2 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 3 1 1 hq hb hρq hρ0 hρh hs hta rfl)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (2 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 2 2 1 0 3 0 1 2 2 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 3 2 1 hq hb hρq hρ0 hρh hs hta rfl)
| inr hn =>
have hta : t * a = ρ + q * (3 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 3 3 2 1 0 0 1 2 3 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair_sum q a b t ρ N' s' 3 3 1 hq hb hρq hρ0 hρh hs hta rfl)
def good (q a t : Nat) : Bool := !(Nat.beq ((t * a) % q) 0) && !(Nat.beq ((t * a) % q + (t * a) % q) q)
theorem all_and {α : Type} (p r : α → Bool) : ∀ l : List α, l.all p = true → l.all r = true →
l.all (fun x => p x && r x) = true
| [], _, _ => rfl
| x :: l, h1, h2 => by
have h1' : (p x && l.all p) = true := h1
have h2' : (r x && l.all r) = true := h2
cases a : p x <;> cases b : r x <;> rw [a] at h1' <;> rw [b] at h2'
· exact Bool.noConfusion h1'
· exact Bool.noConfusion h1'
· exact Bool.noConfusion h2'
· show ((p x && r x) && l.all _) = true
rw [a, b, all_and p r l h1' h2']; rfl
theorem bool_ne {b : Bool} (h : (!b) = true) : b = false := by
cases b with
| false => rfl
| true => exact Bool.noConfusion h
/-- **AP(m/4) + pair is balanced.** For m = 4q, 8a + b = 4q and every unit t with ⟨ta⟩_q ∉ {0, q/2}, the character
[a, a+q, a+2q, a+3q, 2q+4a, b] is balanced (Hodge). -/
theorem ap_pair_bal (q a b : Nat) (hq : 0 < q) (hb : 8 * a + b = 4 * q)
(hgood : (FermatPrime.units (4 * q)).all (good q a) = true) :
bal (4 * q) [a, a + q, a + 2 * q, a + 3 * q, 2 * q + 4 * a, b] = true := by
have hodd : (FermatPrime.units (4 * q)).all isOdd = true := by
rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact GcdHand.units_odd (2 * q)
unfold bal
apply all_imp _ _ _ _ (all_and _ _ _ hodd hgood)
intro t h
have h' : (isOdd t && good q a t) = true := h
cases ho : isOdd t with
| false => rw [ho] at h'; exact Bool.noConfusion h'
| true =>
rw [ho] at h'
have hg : (!(Nat.beq ((t * a) % q) 0) && !(Nat.beq ((t * a) % q + (t * a) % q) q)) = true := h'
cases g1 : Nat.beq ((t * a) % q) 0 <;> cases g2 : Nat.beq ((t * a) % q + (t * a) % q) q <;>
rw [g1, g2] at hg
· have ⟨N, hN⟩ := decomp (t * a) q hq
have e := tsum_key q a b t _ N hq hb ho hN (Nat.mod_lt _ hq)
(Nat.pos_of_ne_zero (Nat.ne_of_beq_eq_false g1)) (Nat.ne_of_beq_eq_false g2)
rw [e]
show Nat.beq (12 * q + 12 * q) (6 * (4 * q)) = true
rw [((show 6*(4*(q)) = 12*(q) + 12*(q) from NatNorm.sound [q] (.mul (.lit 6) (.mul (.lit 4) (.var 0))) (.add (.mul (.lit 12) (.var 0)) (.mul (.lit 12) (.var 0))) rfl))]
exact beq_self _
· exact Bool.noConfusion hg
· exact Bool.noConfusion hg
· exact Bool.noConfusion hg
/-- The AP(24) + pair characters at m = 96 with a = 1, 2, 3 (orbit representatives in Unreached96). -/
theorem ap_pair_96 : bal 96 [1, 25, 49, 73, 52, 88] = true ∧ bal 96 [2, 26, 50, 74, 56, 80] = true
∧ bal 96 [3, 27, 51, 75, 60, 72] = true :=
⟨ap_pair_bal 24 1 88 (Nat.le_of_ble_eq_true rfl) rfl rfl, ap_pair_bal 24 2 80 (Nat.le_of_ble_eq_true rfl) rfl rfl,
ap_pair_bal 24 3 72 (Nat.le_of_ble_eq_true rfl) rfl rfl⟩
/-- The AP(26) + pair character at m = 104 (Unreached96.reps104). -/
theorem ap_pair_104 : bal 104 [1, 27, 53, 79, 56, 96] = true :=
ap_pair_bal 26 1 96 (Nat.le_of_ble_eq_true rfl) rfl rfl
/-- The hypothesis holds for a = 1 and every 3 ≤ q ≤ 40 (m = 12 … 160). -/
theorem good1_table : (List.range 38).all (fun i => (FermatPrime.units (4 * (i + 3))).all (good (i + 3) 1)) = true := rfl
end APPair
#print axioms APPair.mod_rep
#print axioms APPair.mod_add
#print axioms APPair.zero_mod_two
#print axioms APPair.four_form
#print axioms APPair.four_cases
#print axioms APPair.res_ap
#print axioms APPair.ap4
#print axioms APPair.pair_sum
#print axioms APPair.tsum_key
#print axioms APPair.ap_pair_bal
#print axioms APPair.ap_pair_96
#print axioms APPair.ap_pair_104
#print axioms APPair.good1_table
lean_all/hodge/APPair1.lean
/-
hodge/APPair1.lean — T41 cycle 269 (goal G8b): the hypothesis of APPair.ap_pair_bal for a = 1 holds for every q ≥ 3,
so AP(m/4) + (m/2 + 4, m − 8) is a balanced character for every m = 4q ≥ 12, with no hypothesis.
Lean 4 core plus hodge/APPair, hodge/GcdHand (GH, GF, gcd_go, div_mod, filter_all), lib/NatNorm.
dvd_sub_form d·a = r + d·k ⇒ d ∣ r
dvd_mod d ∣ n, d ∣ m, m > 0 ⇒ d ∣ n mod m
dvd_gcd d ∣ m, d ∣ n ⇒ d ∣ gcd m n (fuel induction on core's gcd, as GcdHand.two_dvd_gcd)
good_unit gcd t 4q = 1, q ≥ 3 ⇒ t mod q ∉ {0, q/2}
ap_pair_bal1 bal (4q) [1, 1+q, 1+2q, 1+3q, 2q+4, b] for 8 + b = 4q, q ≥ 3
-/
import hodge.APPair
namespace APPair1
open ModHand HalfGeneral Indecomp GcdHand APPair
theorem dvd_sub_form (d r : Nat) : ∀ k a, d * a = r + d * k → ∃ c, r = d * c
| 0, a, h => ⟨a, by rw [h]; rfl⟩
| k + 1, a, h => by
cases a with
| zero =>
have h' : 0 = (r + d * k) + d := by rw [← ((show (r) + (d)*((k)+1) = (r) + (d)*(k) + (d) from NatNorm.sound [r, d, k] (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.lit 1)))) (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.var 1)) rfl))]; exact h
cases d with
| zero => exact ⟨0, by rw [((show (r) + 0*(k) + 0 = (r) from NatNorm.sound [r, k] (.add (.add (.var 0) (.mul (.lit 0) (.var 1))) (.lit 0)) (.var 0) rfl))] at h'; rw [← h']⟩
| succ d' => exact Nat.noConfusion h'
| succ a' =>
have h' : d * a' + d = (r + d * k) + d := by
rw [← ((show (r) + (d)*((k)+1) = (r) + (d)*(k) + (d) from NatNorm.sound [r, d, k] (.add (.var 0) (.mul (.var 1) (.add (.var 2) (.lit 1)))) (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.var 1)) rfl)), ← h]; exact ((show (d)*(a') + (d) = (d)*((a') + 1) from NatNorm.sound [d, a'] (.add (.mul (.var 0) (.var 1)) (.var 0)) (.mul (.var 0) (.add (.var 1) (.lit 1))) rfl))
exact dvd_sub_form d r k a' (add_right_cancel' _ _ _ h')
theorem dvd_mod (d n m : Nat) (hm : 0 < m) (hn : ∃ a, n = d * a) (hmd : ∃ b, m = d * b) : ∃ c, n % m = d * c := by
have ⟨k, hk⟩ := decomp n m hm
have ⟨a, ha⟩ := hn
have ⟨b, hb⟩ := hmd
apply dvd_sub_form d (n % m) (b * k) a
rw [← ha]
calc n = n % m + m * k := hk
_ = n % m + d * (b * k) := by rw [hb, ((show (d)*(b)*(k) = (d)*((b)*(k)) from NatNorm.sound [d, b, k] (.mul (.mul (.var 0) (.var 1)) (.var 2)) (.mul (.var 0) (.mul (.var 1) (.var 2))) rfl))]
theorem dvd_go (d : Nat) : ∀ (f : Nat) (x : (_ : Nat) ×' Nat) (hf : GH x < f),
(∃ a, x.1 = d * a) → (∃ b, x.2 = d * b) → ∃ c, WellFounded.Nat.fix.go GH GF f x hf = d * c
| 0, _, hf, _, _ => absurd hf (Nat.not_lt_zero _)
| f + 1, ⟨m, n⟩, hf, hm, hn => by
show ∃ c, (if h : m = 0 then n else WellFounded.Nat.fix.go GH GF f ⟨n % m, m⟩ _) = d * c
by_cases h0 : m = 0
· rw [dite_eq_left h0]; exact hn
· rw [dite_eq_right h0]
exact dvd_go d f ⟨n % m, m⟩ _ (dvd_mod d n m (Nat.pos_of_ne_zero h0) hn hm) hm
theorem dvd_gcd (d m n : Nat) (hm : ∃ a, m = d * a) (hn : ∃ b, n = d * b) : ∃ c, Nat.gcd m n = d * c := by
rw [gcd_go]; exact dvd_go d _ ⟨m, n⟩ _ hm hn
/-- 1 = d·c forces d = 1. -/
theorem one_eq_mul (d c : Nat) (h : 1 = d * c) (hd : 2 ≤ d) : False := by
cases c with
| zero => exact Nat.noConfusion h
| succ c' =>
have e : d * (c' + 1) = d + d * c' := ((show (d)*((c')+1) = (d) + (d)*(c') from NatNorm.sound [d, c'] (.mul (.var 0) (.add (.var 1) (.lit 1))) (.add (.var 0) (.mul (.var 0) (.var 1))) rfl))
rw [e] at h
have : 2 ≤ 1 := Nat.le_trans hd (h ▸ Nat.le_add_right d (d * c'))
exact absurd this (Nat.not_succ_le_self 1)
/-- **For a unit t of 4q (q ≥ 3), t mod q is neither 0 nor q/2.** -/
theorem good_unit (q t : Nat) (hq : 3 ≤ q) (hg : Nat.gcd t (4 * q) = 1) : good q 1 t = true := by
have hq0 : 0 < q := Nat.lt_of_lt_of_le (Nat.zero_lt_succ 2) hq
have ⟨N, hN⟩ := decomp t q hq0
have ht1 : t * 1 = t := Nat.mul_one t
show (!(Nat.beq ((t * 1) % q) 0) && !(Nat.beq ((t * 1) % q + (t * 1) % q) q)) = true
rw [ht1]
cases g1 : Nat.beq (t % q) 0 with
| true =>
have e := Nat.eq_of_beq_eq_true g1
rw [e, Nat.zero_add] at hN
have ⟨c, hc⟩ := dvd_gcd q t (4 * q) ⟨N, hN⟩ ⟨4, Nat.mul_comm 4 q⟩
rw [hg] at hc
exact absurd (one_eq_mul q c hc (Nat.le_trans (Nat.le_succ 2) hq)) id
| false =>
cases g2 : Nat.beq (t % q + t % q) q with
| false => rfl
| true =>
have e := Nat.eq_of_beq_eq_true g2
-- ρ = t mod q divides t = ρ(1 + 2N) and 4q = ρ·8
have ht : t = t % q * (1 + 2 * N) := by
rw [((show (t % q)*(1 + 2*(N)) = (t % q) + ((t % q) + (t % q))*(N) from NatNorm.sound [t % q, N] (.mul (.var 0) (.add (.lit 1) (.mul (.lit 2) (.var 1)))) (.add (.var 0) (.mul (.add (.var 0) (.var 0)) (.var 1))) rfl)), e]; exact hN
have h4 : 4 * q = t % q * 8 := by
calc 4 * q = 4 * (t % q + t % q) := by rw [e]
_ = t % q * 8 := ((show 4*((t % q) + (t % q)) = (t % q)*8 from NatNorm.sound [t % q] (.mul (.lit 4) (.add (.var 0) (.var 0))) (.mul (.var 0) (.lit 8)) rfl))
have ⟨c, hc⟩ := dvd_gcd (t % q) t (4 * q) ⟨_, ht⟩ ⟨8, h4⟩
rw [hg] at hc
have h2 : 2 ≤ t % q := by
cases Nat.lt_or_ge (t % q) 2 with
| inr h => exact h
| inl h =>
have h1 : t % q ≤ 1 := Nat.le_of_lt_succ h
have h' : t % q + t % q ≤ 1 + 1 :=
Nat.le_trans (Nat.add_le_add_left h1 (t % q)) (Nat.add_le_add_right h1 1)
rw [e] at h'
exact absurd (Nat.le_trans hq h') (Nat.not_succ_le_self 2)
exact absurd (one_eq_mul _ c hc h2) id
/-- **AP(m/4) + (m/2 + 4, m − 8) is balanced for every m = 4q ≥ 12.** -/
theorem ap_pair_bal1 (q b : Nat) (hq : 3 ≤ q) (hb : 8 + b = 4 * q) :
bal (4 * q) [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 2 * q + 4 * 1, b] = true :=
ap_pair_bal q 1 b (Nat.lt_of_lt_of_le (Nat.zero_lt_succ 2) hq) hb
(filter_all _ _ (fun t hg => good_unit q t hq (Nat.eq_of_beq_eq_true hg)) _)
end APPair1
#print axioms APPair1.dvd_sub_form
#print axioms APPair1.dvd_mod
#print axioms APPair1.dvd_go
#print axioms APPair1.dvd_gcd
#print axioms APPair1.one_eq_mul
#print axioms APPair1.good_unit
#print axioms APPair1.ap_pair_bal1
lean_all/hodge/APPair2.lean
/-
hodge/APPair2.lean — T41 cycle 274 (goal G17): the second pair family. For m = 4q, 2a + c = 2q, 2a + d = 4q, the
character [a, a+q, a+2q, a+3q, c, d] = AP(a) + (m/2 − 2a, m − 2a) is balanced whenever every unit t has ta ≢ 0 (q);
for a = 1 this holds for every q ≥ 3 (APPair1.good_unit), so AP(m/4) + (m/2 − 2, m − 2) is balanced for every
m = 4q ≥ 12.
Lean 4 core plus hodge/APPair (mod_rep, mod_add, res_ap, ap4, four_form, four_cases, combine), hodge/APPair1, lib/NatNorm.
mod_two_cases z < 2m, z mod m = s ⇒ z = s ∨ z = m + s
pair2_even/odd ⟨tc⟩ + ⟨td⟩ + 4ρ = 6q (n₀ even / odd; ⟨2ta⟩ = 2ρ or 2ρ + 2q)
tsum_key2, ap_pair2_bal, ap_pair2_bal1
-/
import hodge.APPair1
namespace APPair2
open ModHand HalfGeneral Indecomp GcdHand APPair
theorem mod_two_cases (z m s : Nat) (hz : z < m + m) (h : z % m = s) : z = s ∨ z = m + s := by
cases Nat.lt_or_ge z m with
| inl l => rw [mod_lt' z m l] at h; exact Or.inl h
| inr g =>
have ⟨w, hw⟩ := Nat.le.dest g
have hwm : w < m := Nat.lt_of_add_lt_add_left (hw ▸ hz)
have hm : 0 < m := Nat.lt_of_le_of_lt (Nat.zero_le w) hwm
rw [← hw, Nat.add_comm, add_mod' w m hm, mod_lt' w m hwm] at h
exact Or.inr (by rw [← hw, h])
theorem res_2q (q t t0 s' g : Nat) (hq : 0 < q) (ht : t = t0 + 4 * s') (hg : t0 = 1 + 2 * g) :
(t * (2 * q)) % (4 * q) = 2 * q := by
have h2 : 2 * q < 4 * q := by
rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le hq (by rw [((show 2*(q) = (q) + (q) from NatNorm.sound [q] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl))]; exact Nat.le_add_right q q))
apply mod_rep _ _ _ (g + 2 * s') h2
rw [ht, hg]; exact ((show (1 + 2*(g) + 4*(s'))*(2*(q)) = 2*(q) + ((g) + 2*(s'))*(4*(q)) from NatNorm.sound [q, g, s'] (.mul (.add (.add (.lit 1) (.mul (.lit 2) (.var 1))) (.mul (.lit 4) (.var 2))) (.mul (.lit 2) (.var 0))) (.add (.mul (.lit 2) (.var 0)) (.mul (.add (.var 1) (.mul (.lit 2) (.var 2))) (.mul (.lit 4) (.var 0)))) rfl))
theorem res_x2 (q a t ρ N' n0 par h0 : Nat) (hta : t * a = ρ + q * (n0 + 4 * N')) (hn : n0 = par + 2 * h0)
(hr : 2 * ρ + 2 * q * par < 4 * q) : (t * (2 * a)) % (4 * q) = 2 * ρ + 2 * q * par := by
apply mod_rep _ _ _ (h0 + 2 * N') hr
rw [((show (t)*(2*(a)) = 2*((t)*(a)) from NatNorm.sound [t, a] (.mul (.var 0) (.mul (.lit 2) (.var 1))) (.mul (.lit 2) (.mul (.var 0) (.var 1))) rfl)), hta, hn]
exact ((show 2*((ρ) + (q)*((par) + 2*(h0) + 4*(N'))) = 2*(ρ) + 2*(q)*(par) + ((h0) + 2*(N'))*(4*(q)) from NatNorm.sound [ρ, q, par, h0, N'] (.mul (.lit 2) (.add (.var 0) (.mul (.var 1) (.add (.add (.var 2) (.mul (.lit 2) (.var 3))) (.mul (.lit 4) (.var 4)))))) (.add (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.var 2))) (.mul (.add (.var 3) (.mul (.lit 2) (.var 4))) (.mul (.lit -- (+21 chars; full line in the Zenodo source)
theorem two_lt (ρ q : Nat) (hρq : ρ < q) : 2 * ρ < 2 * q := by
rw [((show 2*(ρ) = (ρ) + (ρ) from NatNorm.sound [ρ] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl)), ((show 2*(q) = (q) + (q) from NatNorm.sound [q] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl))]; exact add_lt_add' _ _ _ _ hρq hρq
theorem pair2_even (q a c d t ρ N' s' t0 g h0 : Nat) (hq : 0 < q) (hρq : ρ < q) (hρ0 : 0 < ρ)
(hc : 2 * a + c = 2 * q) (hd : 2 * a + d = 4 * q) (ht : t = t0 + 4 * s') (hg : t0 = 1 + 2 * g)
(hta : t * a = ρ + q * ((0 + 2 * h0) + 4 * N')) :
(t * c) % (4 * q) + (t * d) % (4 * q) + 4 * ρ = 6 * q := by
have hm := pos4 q hq
have h2 := two_lt ρ q hρq
have hr : 2 * ρ + 2 * q * 0 < 4 * q := by
rw [((show 2*(ρ) + 2*(q)*0 = 2*(ρ) from NatNorm.sound [ρ, q] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.lit 0))) (.mul (.lit 2) (.var 0)) rfl))]
exact Nat.lt_trans h2 (by rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.lt_add_of_pos_right (Nat.lt_of_le_of_lt (Nat.zero_le _) h2))
have x2 := res_x2 q a t ρ N' (0 + 2 * h0) 0 h0 hta rfl hr
rw [((show 2*(ρ) + 2*(q)*0 = 2*(ρ) from NatNorm.sound [ρ, q] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.lit 0))) (.mul (.lit 2) (.var 0)) rfl))] at x2
-- d: complement of 2ta
have hD : (t * d) % (4 * q) + 2 * ρ = 4 * q := by
apply comp (t * d) (t * (2 * a)) (4 * q) (2 * ρ) hm x2
(Nat.lt_of_lt_of_le hρ0 (by rw [((show 2*(ρ) = (ρ) + (ρ) from NatNorm.sound [ρ] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl))]; exact Nat.le_add_right ρ ρ))
(Nat.lt_trans h2 (by rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.lt_add_of_pos_right (Nat.lt_of_le_of_lt (Nat.zero_le _) h2)))
rw [((show (t)*(d) + (t)*(2*(a)) = (t)*(2*(a) + (d)) from NatNorm.sound [t, a, d] (.add (.mul (.var 0) (.var 2)) (.mul (.var 0) (.mul (.lit 2) (.var 1)))) (.mul (.var 0) (.add (.mul (.lit 2) (.var 1)) (.var 2))) rfl)), hd]
exact mod_rep _ 0 _ t hm ((show (t)*(4*(q)) = 0 + (t)*(4*(q)) from NatNorm.sound [t, q] (.mul (.var 0) (.mul (.lit 4) (.var 1))) (.add (.lit 0) (.mul (.var 0) (.mul (.lit 4) (.var 1)))) rfl))
-- c: ⟨tc⟩ + 2ρ ≡ 2q
have e := mod_add (t * c) (t * (2 * a)) (4 * q) hm
rw [x2, ((show (t)*(c) + (t)*(2*(a)) = (t)*(2*(a) + (c)) from NatNorm.sound [t, a, c] (.add (.mul (.var 0) (.var 2)) (.mul (.var 0) (.mul (.lit 2) (.var 1)))) (.mul (.var 0) (.add (.mul (.lit 2) (.var 1)) (.var 2))) rfl)), hc, res_2q q t t0 s' g hq ht hg] at e
have hz : (t * c) % (4 * q) + 2 * ρ < 4 * q + 4 * q :=
add_lt_add' _ _ _ _ (Nat.mod_lt _ hm) (Nat.lt_trans h2 (by rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.lt_add_of_pos_right (Nat.lt_of_le_of_lt (Nat.zero_le _) h2)))
have hC : (t * c) % (4 * q) + 2 * ρ = 2 * q := by
cases mod_two_cases _ _ _ hz e with
| inl e1 => exact e1
| inr e2 =>
have big : (t * c) % (4 * q) + 2 * ρ < 4 * q + 2 * q := add_lt_add' _ _ _ _ (Nat.mod_lt _ hm) h2
rw [e2] at big; exact absurd big (Nat.lt_irrefl _)
rw [((show ((t * c) % (4 * q)) + ((t * d) % (4 * q)) + 4*(ρ) = (((t * c) % (4 * q)) + 2*(ρ)) + (((t * d) % (4 * q)) + 2*(ρ)) from NatNorm.sound [(t * c) % (4 * q), (t * d) % (4 * q), ρ] (.add (.add (.var 0) (.var 1)) (.mul (.lit 4) (.var 2))) (.add (.add (.var 0) (.mul (.lit 2) (.var 2))) (.add (.var 1) (.mul (.lit 2) (.var 2)))) rfl)), hC, hD]
exact ((show 2*(q) + 4*(q) = 6*(q) from NatNorm.sound [q] (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 4) (.var 0))) (.mul (.lit 6) (.var 0)) rfl))
theorem pair2_odd (q a c d t ρ N' s' t0 g h0 : Nat) (hq : 0 < q) (hρq : ρ < q) (hρ0 : 0 < ρ)
(hc : 2 * a + c = 2 * q) (hd : 2 * a + d = 4 * q) (ht : t = t0 + 4 * s') (hg : t0 = 1 + 2 * g)
(hta : t * a = ρ + q * ((1 + 2 * h0) + 4 * N')) :
(t * c) % (4 * q) + (t * d) % (4 * q) + 4 * ρ = 6 * q := by
have hm := pos4 q hq
have h2 := two_lt ρ q hρq
have hr : 2 * ρ + 2 * q * 1 < 4 * q := by
rw [((show 2*(ρ) + 2*(q)*1 = 2*(ρ) + 2*(q) from NatNorm.sound [ρ, q] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.lit 1))) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 1))) rfl)), ((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact Nat.add_lt_add_right h2 _
have x2 := res_x2 q a t ρ N' (1 + 2 * h0) 1 h0 hta rfl hr
rw [((show 2*(ρ) + 2*(q)*1 = 2*(ρ) + 2*(q) from NatNorm.sound [ρ, q] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.lit 1))) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 1))) rfl))] at x2
rw [((show 2*(ρ) + 2*(q)*1 = 2*(ρ) + 2*(q) from NatNorm.sound [ρ, q] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.lit 1))) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 1))) rfl))] at hr
have hpos : 0 < 2 * ρ + 2 * q :=
Nat.lt_of_lt_of_le hρ0 (by rw [((show 2*(ρ) + 2*(q) = (ρ) + ((ρ) + 2*(q)) from NatNorm.sound [ρ, q] (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 1))) (.add (.var 0) (.add (.var 0) (.mul (.lit 2) (.var 1)))) rfl))]; exact Nat.le_add_right ρ _)
have hD : (t * d) % (4 * q) + (2 * ρ + 2 * q) = 4 * q := by
apply comp (t * d) (t * (2 * a)) (4 * q) _ hm x2 hpos hr
rw [((show (t)*(d) + (t)*(2*(a)) = (t)*(2*(a) + (d)) from NatNorm.sound [t, a, d] (.add (.mul (.var 0) (.var 2)) (.mul (.var 0) (.mul (.lit 2) (.var 1)))) (.mul (.var 0) (.add (.mul (.lit 2) (.var 1)) (.var 2))) rfl)), hd]
exact mod_rep _ 0 _ t hm ((show (t)*(4*(q)) = 0 + (t)*(4*(q)) from NatNorm.sound [t, q] (.mul (.var 0) (.mul (.lit 4) (.var 1))) (.add (.lit 0) (.mul (.var 0) (.mul (.lit 4) (.var 1)))) rfl))
have e := mod_add (t * c) (t * (2 * a)) (4 * q) hm
rw [x2, ((show (t)*(c) + (t)*(2*(a)) = (t)*(2*(a) + (c)) from NatNorm.sound [t, a, c] (.add (.mul (.var 0) (.var 2)) (.mul (.var 0) (.mul (.lit 2) (.var 1)))) (.mul (.var 0) (.add (.mul (.lit 2) (.var 1)) (.var 2))) rfl)), hc, res_2q q t t0 s' g hq ht hg] at e
have hz : (t * c) % (4 * q) + (2 * ρ + 2 * q) < 4 * q + 4 * q := add_lt_add' _ _ _ _ (Nat.mod_lt _ hm) hr
have hC : (t * c) % (4 * q) + (2 * ρ + 2 * q) = 4 * q + 2 * q := by
cases mod_two_cases _ _ _ hz e with
| inr e2 => exact e2
| inl e1 =>
-- x + 2ρ + 2q = 2q forces 2ρ = 0
have e3 : (t * c) % (4 * q) + 2 * ρ + 2 * q = 0 + 2 * q := by
rw [Nat.zero_add, Nat.add_assoc]; exact e1
have e4 := add_right_cancel' _ _ _ e3
have : 2 * ρ ≤ 0 := e4 ▸ Nat.le_add_left (2 * ρ) ((t * c) % (4 * q))
exact absurd (Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le hρ0 (by rw [((show 2*(ρ) = (ρ) + (ρ) from NatNorm.sound [ρ] (.mul (.lit 2) (.var 0)) (.add (.var 0) (.var 0)) rfl))]; exact Nat.le_add_right ρ ρ)) this) (Nat.lt_irrefl 0)
apply add_right_cancel' _ _ (4 * q)
rw [((show ((t * c) % (4 * q)) + ((t * d) % (4 * q)) + 4*(ρ) + 4*(q) = (((t * c) % (4 * q)) + (2*(ρ) + 2*(q))) + (((t * d) % (4 * q)) + (2*(ρ) + 2*(q))) from NatNorm.sound [(t * c) % (4 * q), (t * d) % (4 * q), ρ, q] (.add (.add (.add (.var 0) (.var 1)) (.mul (.lit 4) (.var 2))) (.mul (.lit 4) (.var 3))) (.add (.add (.var 0) (.add (.mul (.lit 2) (.var 2)) (.mul (.lit 2) (.var 3)))) (.add (.var 1 -- (+75 chars; full line in the Zenodo source)
exact ((show 4*(q) + 2*(q) + 4*(q) = 6*(q) + 4*(q) from NatNorm.sound [q] (.add (.add (.mul (.lit 4) (.var 0)) (.mul (.lit 2) (.var 0))) (.mul (.lit 4) (.var 0))) (.add (.mul (.lit 6) (.var 0)) (.mul (.lit 4) (.var 0))) rfl))
/-- **Key identity, second family.** For odd t with ρ = ⟨ta⟩_q ≠ 0: Σ ⟨t c_i⟩_m = 12q = 3m. -/
theorem tsum_key2 (q a c d t ρ N : Nat) (hq : 0 < q) (hc : 2 * a + c = 2 * q) (hd : 2 * a + d = 4 * q)
(ht : isOdd t = true) (hN : t * a = ρ + q * N) (hρq : ρ < q) (hρ0 : 0 < ρ) :
tsum (4 * q) t [a, a + q, a + 2 * q, a + 3 * q, c, d] = 12 * q := by
show (t * a) % (4 * q) + ((t * (a + q)) % (4 * q) + ((t * (a + 2 * q)) % (4 * q) + ((t * (a + 3 * q)) % (4 * q) + ((t * c) % (4 * q) + ((t * d) % (4 * q) + 0))))) = 12 * q
rw [((show ((t * a) % (4 * q)) + (((t * (a + q)) % (4 * q)) + (((t * (a + 2 * q)) % (4 * q)) + (((t * (a + 3 * q)) % (4 * q)) + (((t * c) % (4 * q)) + (((t * d) % (4 * q)) + 0))))) = ((t * a) % (4 * q)) + (((t * (a + q)) % (4 * q)) + (((t * (a + 2 * q)) % (4 * q)) + ((t * (a + 3 * q)) % (4 * q)))) + (((t * c) % (4 * q)) + ((t * d) % (4 * q))) from NatNorm.sound [(t * a) % (4 * q), (t * (a + q)) -- (+307 chars; full line in the Zenodo source)
have ⟨s', hs⟩ := four_form t ht
have ⟨N', hN'⟩ := four_cases N
cases hs with
| inl hs =>
cases hN' with
| inl hn =>
have hta : t * a = ρ + q * (0 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 0 0 1 2 3 0 0 0 0 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_even q a c d t ρ N' s' 1 0 0 hq hρq hρ0 hc hd hs rfl hta)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (1 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 1 1 2 3 0 0 0 0 1 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_odd q a c d t ρ N' s' 1 0 0 hq hρq hρ0 hc hd hs rfl hta)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (2 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 2 2 3 0 1 0 0 1 1 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_even q a c d t ρ N' s' 1 0 1 hq hρq hρ0 hc hd hs rfl hta)
| inr hn =>
have hta : t * a = ρ + q * (3 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 1 3 3 0 1 2 0 1 1 1 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_odd q a c d t ρ N' s' 1 0 1 hq hρq hρ0 hc hd hs rfl hta)
| inr hs =>
cases hN' with
| inl hn =>
have hta : t * a = ρ + q * (0 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 0 0 3 2 1 0 0 1 2 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_even q a c d t ρ N' s' 3 1 0 hq hρq hρ0 hc hd hs rfl hta)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (1 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 1 1 0 3 2 0 1 1 2 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_odd q a c d t ρ N' s' 3 1 0 hq hρq hρ0 hc hd hs rfl hta)
| inr hn => cases hn with
| inl hn =>
have hta : t * a = ρ + q * (2 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 2 2 1 0 3 0 1 2 2 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_even q a c d t ρ N' s' 3 1 1 hq hρq hρ0 hc hd hs rfl hta)
| inr hn =>
have hta : t * a = ρ + q * (3 + 4 * N') := by rw [hN, hn]
exact combine _ _ _ ρ q (ap4 q a t ρ N' s' 3 3 3 2 1 0 0 1 2 3 hρq hs hta rfl rfl rfl rfl (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) rfl)
(pair2_odd q a c d t ρ N' s' 3 1 1 hq hρq hρ0 hc hd hs rfl hta)
def good2 (q a t : Nat) : Bool := !(Nat.beq ((t * a) % q) 0)
/-- **AP(m/4) + (m/2 − 2a, m − 2a) is balanced** when no unit sends ta to 0 mod q. -/
theorem ap_pair2_bal (q a c d : Nat) (hq : 0 < q) (hc : 2 * a + c = 2 * q) (hd : 2 * a + d = 4 * q)
(hgood : (FermatPrime.units (4 * q)).all (good2 q a) = true) :
bal (4 * q) [a, a + q, a + 2 * q, a + 3 * q, c, d] = true := by
have hodd : (FermatPrime.units (4 * q)).all isOdd = true := by
rw [((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))]; exact GcdHand.units_odd (2 * q)
unfold bal
apply all_imp _ _ _ _ (all_and _ _ _ hodd hgood)
intro t h
have h' : (isOdd t && good2 q a t) = true := h
cases ho : isOdd t with
| false => rw [ho] at h'; exact Bool.noConfusion h'
| true =>
rw [ho] at h'
have hg : (!(Nat.beq ((t * a) % q) 0)) = true := h'
cases g1 : Nat.beq ((t * a) % q) 0 with
| true => rw [g1] at hg; exact Bool.noConfusion hg
| false =>
have ⟨N, hN⟩ := decomp (t * a) q hq
have e := tsum_key2 q a c d t _ N hq hc hd ho hN (Nat.mod_lt _ hq) (Nat.pos_of_ne_zero (Nat.ne_of_beq_eq_false g1))
rw [e]
show Nat.beq (12 * q + 12 * q) (6 * (4 * q)) = true
rw [((show 6*(4*(q)) = 12*(q) + 12*(q) from NatNorm.sound [q] (.mul (.lit 6) (.mul (.lit 4) (.var 0))) (.add (.mul (.lit 12) (.var 0)) (.mul (.lit 12) (.var 0))) rfl))]
exact beq_self _
/-- **For every m = 4q ≥ 12, AP(m/4) + (m/2 − 2, m − 2) is balanced.** -/
theorem ap_pair2_bal1 (q c d : Nat) (hq : 3 ≤ q) (hc : 2 + c = 2 * q) (hd : 2 + d = 4 * q) :
bal (4 * q) [1, 1 + q, 1 + 2 * q, 1 + 3 * q, c, d] = true :=
ap_pair2_bal q 1 c d (Nat.lt_of_lt_of_le (Nat.zero_lt_succ 2) hq) hc hd
(filter_all _ _ (fun t hg => by
have g := APPair1.good_unit q t hq (Nat.eq_of_beq_eq_true hg)
have g' : (!(Nat.beq ((t * 1) % q) 0) && !(Nat.beq ((t * 1) % q + (t * 1) % q) q)) = true := g
show (!(Nat.beq ((t * 1) % q) 0)) = true
cases b1 : Nat.beq ((t * 1) % q) 0 with
| false => rfl
| true => rw [b1] at g'; exact Bool.noConfusion g') _)
/-- m = 96: [1, 25, 49, 73, 46, 94]. -/
theorem ap_pair2_96 : bal 96 [1, 25, 49, 73, 46, 94] = true :=
ap_pair2_bal1 24 46 94 (Nat.le_of_ble_eq_true rfl) rfl rfl
end APPair2
#print axioms APPair2.mod_two_cases
#print axioms APPair2.res_2q
#print axioms APPair2.res_x2
#print axioms APPair2.pair2_even
#print axioms APPair2.pair2_odd
#print axioms APPair2.tsum_key2
#print axioms APPair2.ap_pair2_bal
#print axioms APPair2.ap_pair2_bal1
#print axioms APPair2.ap_pair2_96
lean_all/hodge/APPairGen.lean
/-
hodge/APPairGen.lean — T41 cycle 277 (goal G20): Euclid's lemma by hand through core gcd, and the first pair family
for every start a: AP(a) + (m/2 + 4a, m − 8a) is balanced in m = 4q whenever 0 < a and 2a < q.
Lean 4 core plus hodge/APPair1 (dvd_sub_form, dvd_gcd), hodge/APPair (ap_pair_bal, good), hodge/GcdHand, lib/NatNorm.
euclid_go d ∣ x₁a, d ∣ x₂a ⇒ d ∣ (go x)·a (fuel recursion of core gcd)
euclid gcd t n = 1, d ∣ ta, d ∣ na ⇒ d ∣ a
not_dvd_small 0 < y < q ⇒ ¬ q ∣ y
good_gen gcd t 4q = 1, 0 < a, 2a < q ⇒ good q a t
ap_pair_bal_gen bal (4q) [a, a+q, a+2q, a+3q, 2q+4a, b] for 8a + b = 4q, 0 < a, 2a < q
-/
import hodge.APPair1
namespace APPairGen
open ModHand HalfGeneral Indecomp GcdHand APPair APPair1
theorem euclid_go (d a : Nat) : ∀ (f : Nat) (x : (_ : Nat) ×' Nat) (hf : GH x < f),
(∃ i, x.1 * a = d * i) → (∃ j, x.2 * a = d * j) → ∃ k, WellFounded.Nat.fix.go GH GF f x hf * a = d * k
| 0, _, hf, _, _ => absurd hf (Nat.not_lt_zero _)
| f + 1, ⟨m, n⟩, hf, hm, hn => by
show ∃ k, (if h : m = 0 then n else WellFounded.Nat.fix.go GH GF f ⟨n % m, m⟩ _) * a = d * k
by_cases h0 : m = 0
· rw [dite_eq_left h0]; exact hn
· rw [dite_eq_right h0]
apply euclid_go d a f ⟨n % m, m⟩ _ _ hm
-- n a = (n % m) a + (m a) k
have ⟨k, hk⟩ := decomp n m (Nat.pos_of_ne_zero h0)
have ⟨i, hi⟩ := hm
have ⟨j, hj⟩ := hn
apply dvd_sub_form d ((n % m) * a) (i * k) j
rw [← hj]
show n * a = n % m * a + d * (i * k)
calc n * a = (n % m + m * k) * a := by rw [← hk]
_ = n % m * a + (m * a) * k := ((show ((n % m) + (m)*(k))*(a) = (n % m)*(a) + ((m)*(a))*(k) from NatNorm.sound [n % m, m, k, a] (.mul (.add (.var 0) (.mul (.var 1) (.var 2))) (.var 3)) (.add (.mul (.var 0) (.var 3)) (.mul (.mul (.var 1) (.var 3)) (.var 2))) rfl))
_ = n % m * a + d * (i * k) := by rw [hi, ((show (d)*(i)*(k) = (d)*((i)*(k)) from NatNorm.sound [d, i, k] (.mul (.mul (.var 0) (.var 1)) (.var 2)) (.mul (.var 0) (.mul (.var 1) (.var 2))) rfl))]
theorem euclid (t n d a : Nat) (hg : Nat.gcd t n = 1) (h1 : ∃ i, t * a = d * i) (h2 : ∃ j, n * a = d * j) :
∃ k, a = d * k := by
have := euclid_go d a _ ⟨t, n⟩ (eager_gt t) h1 h2
rw [← gcd_go, hg, Nat.one_mul] at this
exact this
theorem not_dvd_small (q y k : Nat) (h0 : 0 < y) (hq : y < q) (h : y = q * k) : False := by
cases k with
| zero => rw [h, Nat.mul_zero] at h0; exact Nat.lt_irrefl 0 h0
| succ k =>
have : q ≤ y := by rw [h, ((show (q)*((k)+1) = (q) + (q)*(k) from NatNorm.sound [q, k] (.mul (.var 0) (.add (.var 1) (.lit 1))) (.add (.var 0) (.mul (.var 0) (.var 1))) rfl))]; exact Nat.le_add_right q _
exact Nat.lt_irrefl y (Nat.lt_of_lt_of_le hq this)
theorem good_gen (q a t : Nat) (ha : 0 < a) (h2a : a + a < q) (hg : Nat.gcd t (4 * q) = 1) : good q a t = true := by
have hq0 : 0 < q := Nat.lt_of_le_of_lt (Nat.zero_le _) h2a
have haq : a < q := Nat.lt_of_le_of_lt (Nat.le_add_right a a) h2a
have h4 : ∃ j, 4 * q * (a + a) = q * j := ⟨4 * (a + a), ((show 4*(q)*((a) + (a)) = (q)*(4*((a) + (a))) from NatNorm.sound [q, a] (.mul (.mul (.lit 4) (.var 0)) (.add (.var 1) (.var 1))) (.mul (.var 0) (.mul (.lit 4) (.add (.var 1) (.var 1)))) rfl))⟩
have ⟨N, hN⟩ := decomp (t * a) q hq0
show (!(Nat.beq ((t * a) % q) 0) && !(Nat.beq ((t * a) % q + (t * a) % q) q)) = true
cases g1 : Nat.beq ((t * a) % q) 0 with
| true =>
have e := Nat.eq_of_beq_eq_true g1
rw [e, Nat.zero_add] at hN
have ⟨k, hk⟩ := euclid t (4 * q) q a hg ⟨N, hN⟩ ⟨4 * a, ((show 4*(q)*(a) = (q)*(4*(a)) from NatNorm.sound [q, a] (.mul (.mul (.lit 4) (.var 0)) (.var 1)) (.mul (.var 0) (.mul (.lit 4) (.var 1))) rfl))⟩
exact absurd (not_dvd_small q a k ha haq hk) id
| false =>
cases g2 : Nat.beq ((t * a) % q + (t * a) % q) q with
| false => rfl
| true =>
have e := Nat.eq_of_beq_eq_true g2
have h1 : ∃ i, t * (a + a) = q * i := ⟨1 + 2 * N, by
rw [((show (t)*((a) + (a)) = (t)*(a) + (t)*(a) from NatNorm.sound [t, a] (.mul (.var 0) (.add (.var 1) (.var 1))) (.add (.mul (.var 0) (.var 1)) (.mul (.var 0) (.var 1))) rfl)), hN,
((show ((t * a) % q) + (q)*(N) + (((t * a) % q) + (q)*(N)) = ((t * a) % q) + ((t * a) % q) + (q)*(2*(N)) from NatNorm.sound [(t * a) % q, q, N] (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.add (.var 0) (.mul (.var 1) (.var 2)))) (.add (.add (.var 0) (.var 0)) (.mul (.var 1) (.mul (.lit 2) (.var 2)))) rfl)), e]
exact ((show (q) + (q)*(2*(N)) = (q)*(1 + 2*(N)) from NatNorm.sound [q, N] (.add (.var 0) (.mul (.var 0) (.mul (.lit 2) (.var 1)))) (.mul (.var 0) (.add (.lit 1) (.mul (.lit 2) (.var 1)))) rfl))⟩
have ⟨k, hk⟩ := euclid t (4 * q) q (a + a) hg h1 h4
exact absurd (not_dvd_small q (a + a) k (Nat.lt_of_lt_of_le ha (Nat.le_add_right a a)) h2a hk) id
/-- **AP(a) + (m/2 + 4a, m − 8a) is balanced for every m = 4q and 0 < a, 2a < q.** -/
theorem ap_pair_bal_gen (q a b : Nat) (ha : 0 < a) (h2a : a + a < q) (hb : 8 * a + b = 4 * q) :
bal (4 * q) [a, a + q, a + 2 * q, a + 3 * q, 2 * q + 4 * a, b] = true :=
ap_pair_bal q a b (Nat.lt_of_le_of_lt (Nat.zero_le _) h2a) hb
(filter_all _ _ (fun t hg => good_gen q a t ha h2a (Nat.eq_of_beq_eq_true hg)) _)
end APPairGen
#print axioms APPairGen.euclid_go
#print axioms APPairGen.euclid
#print axioms APPairGen.not_dvd_small
#print axioms APPairGen.good_gen
#print axioms APPairGen.ap_pair_bal_gen
lean_all/hodge/APPairIrr.lean
/-
hodge/APPairIrr.lean — T41 cycle 274 (goal G17, table): which pair families are irreducible.
Lean 4 core plus hodge/Indecomp (bal, indec), rfl. For m = 4q:
fam1 q = [1, 1+q, 1+2q, 1+3q, 2q+4, 4q−8] (APPair1: balanced for q ≥ 3)
fam2 q = [1, 1+q, 1+2q, 1+3q, 2q−2, 4q−2] (APPair2: balanced for q ≥ 3)
fam1_irr fam1 q has no balanced splitting for every 8 ≤ q ≤ 40 (m = 32 … 160); for q ≤ 7 it splits (fam1_red)
fam2_red fam2 q splits for every 3 ≤ q ≤ 40 — the second family is never a new Hodge class
So the AP(m/4) + (m/2 + 4, m − 8) characters are the irreducible ones, as in the unreached sets of m = 88, 96, 104.
-/
import hodge.Indecomp
namespace APPairIrr
open Indecomp
def fam1 (q : Nat) : List Nat := [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 2 * q + 4, 4 * q - 8]
def fam2 (q : Nat) : List Nat := [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 2 * q - 2, 4 * q - 2]
set_option maxRecDepth 100000 in
theorem fam1_irr : (List.range 33).all (fun i => indec (4 * (i + 8)) (fam1 (i + 8))) = true := rfl
set_option maxRecDepth 100000 in
theorem fam1_red : (List.range 5).all (fun i => !(indec (4 * (i + 3)) (fam1 (i + 3)))) = true := rfl
set_option maxRecDepth 100000 in
theorem fam2_red : (List.range 38).all (fun i => !(indec (4 * (i + 3)) (fam2 (i + 3)))) = true := rfl
end APPairIrr
#print axioms APPairIrr.fam1_irr
#print axioms APPairIrr.fam1_red
#print axioms APPairIrr.fam2_red
lean_all/hodge/APPairIrrGen.lean
/-
hodge/APPairIrrGen.lean — T41 cycle 276 (goal G19): AP(m/4) + (m/2 + 4, m − 8) is irreducible for every m = 4q ≥ 32,
symbolically in q, by reflection: with q = 8 + r the six entries are α_i + β_i r, and every splitting fails the Hodge
condition already at t = 1 (a linear identity in r with incompatible coefficients, checked by rfl on the α, β).
Lean 4 core plus hodge/GcdHand (gcd_go, GH, GF), hodge/HalfGeneral (all_imp), hodge/ModHand (mod_lt'),
hodge/APPair (all_and), hodge/Reach49Defs (all_map), lib/NatNorm.
range_succ' List.range (n+1) = List.range n ++ [n] (hand)
gcd_one Nat.gcd 1 m = 1 (fuel recursion)
units_one a predicate true on all units of n+2 is true at t = 1
bal_t1 bal m A ⇒ 2·Σ⟨A⟩ = |A|·m (t = 1)
splits_map splits (map g l) = map (map g × map g) (splits l)
lin_bal_false check on the coefficients ⇒ bal (m₀ + m₁r) (S.map ev) = false
fam1_indec indec (32 + 4r) [1, 9+r, 17+2r, 25+3r, 20+2r, 24+4r] for every r
fam1_indec_q the same in q: indec (4q) [1, 1+q, 1+2q, 1+3q, 2q+4, b] for q ≥ 8, 8 + b = 4q
-/
import hodge.APPair1
import lib.NatNorm
import hodge.Reach49Defs
namespace APPairIrrGen
open ModHand HalfGeneral Indecomp GcdHand
theorem loop_acc : ∀ (n : Nat) (acc : List Nat), List.range.loop n acc = List.range.loop n [] ++ acc
| 0, acc => rfl
| n + 1, acc => by
show List.range.loop n (n :: acc) = List.range.loop n [n] ++ acc
rw [loop_acc n (n :: acc), loop_acc n [n]]
exact app_assoc (List.range.loop n []) [n] acc
where
app_assoc : ∀ (a : List Nat) (b c : List Nat), a ++ (b ++ c) = (a ++ b) ++ c := by
intro a; induction a with
| nil => intro b c; rfl
| cons x a ih => intro b c; show x :: (a ++ (b ++ c)) = x :: ((a ++ b) ++ c); rw [ih]
theorem range_succ' (n : Nat) : List.range (n + 1) = List.range n ++ [n] := loop_acc n [n]
theorem filter_append' {α : Type} (p : α → Bool) : ∀ l1 l2 : List α, (l1 ++ l2).filter p = l1.filter p ++ l2.filter p
| [], _ => rfl
| x :: l1, l2 => by
cases h : p x with
| false =>
show (match p x with | true => x :: (l1 ++ l2).filter p | false => (l1 ++ l2).filter p)
= (match p x with | true => x :: l1.filter p | false => l1.filter p) ++ l2.filter p
rw [h]; exact filter_append' p l1 l2
| true =>
show (match p x with | true => x :: (l1 ++ l2).filter p | false => (l1 ++ l2).filter p)
= (match p x with | true => x :: l1.filter p | false => l1.filter p) ++ l2.filter p
rw [h, filter_append' p l1 l2]; rfl
theorem all_append' {α : Type} (p : α → Bool) : ∀ l1 l2 : List α, (l1 ++ l2).all p = true → l1.all p = true
| [], _, _ => rfl
| x :: l1, l2, h => by
have h' : (p x && (l1 ++ l2).all p) = true := h
cases a : p x with
| false => rw [a] at h'; exact Bool.noConfusion h'
| true =>
rw [a] at h'
show (p x && l1.all p) = true
rw [a, all_append' p l1 l2 h']; rfl
theorem units_one_gen (p g : Nat → Bool) (hp : p 1 = true) :
∀ n, ((List.range (n + 2)).filter p).all g = true → g 1 = true
| 0, h => by
have h' : ([0, 1].filter p).all g = true := h
cases a : p 0 with
| false =>
have e : [0, 1].filter p = [1] := by
show (match p 0 with | true => 0 :: [1].filter p | false => [1].filter p) = [1]
rw [a]; show (match p 1 with | true => [1] | false => []) = [1]; rw [hp]
rw [e] at h'
have h'' : (g 1 && true) = true := h'
cases b : g 1 with
| false => rw [b] at h''; exact Bool.noConfusion h''
| true => rfl
| true =>
have e : [0, 1].filter p = [0, 1] := by
show (match p 0 with | true => 0 :: [1].filter p | false => [1].filter p) = [0, 1]
rw [a]; show 0 :: (match p 1 with | true => [1] | false => []) = [0, 1]; rw [hp]
rw [e] at h'
have h'' : (g 0 && (g 1 && true)) = true := h'
cases b : g 1 with
| false => rw [b] at h''; cases c : g 0 <;> rw [c] at h'' <;> exact Bool.noConfusion h''
| true => rfl
| n + 1, h => by
rw [range_succ', filter_append'] at h
exact units_one_gen p g hp n (all_append' g _ _ h)
theorem gcd_one (m : Nat) : Nat.gcd 1 m = 1 := by
rw [gcd_go]
have inner : ∀ f (hf : GH ⟨m % 1, 1⟩ < f), WellFounded.Nat.fix.go GH GF f ⟨m % 1, 1⟩ hf = 1 := by
intro f hf
cases f with
| zero => exact absurd hf (Nat.not_lt_zero _)
| succ f =>
show (if h : m % 1 = 0 then 1 else WellFounded.Nat.fix.go GH GF f ⟨1 % (m % 1), m % 1⟩ _) = 1
rw [dite_eq_left (Nat.mod_one m)]
have outer : ∀ f (hf : GH ⟨1, m⟩ < f), WellFounded.Nat.fix.go GH GF f ⟨1, m⟩ hf = 1 := by
intro f hf
cases f with
| zero => exact absurd hf (Nat.not_lt_zero _)
| succ f =>
show (if h : 1 = 0 then m else WellFounded.Nat.fix.go GH GF f ⟨m % 1, 1⟩ _) = 1
rw [dite_eq_right (fun h => Nat.noConfusion h)]
exact inner f _
exact outer _ _
/-- A predicate true on every unit of n + 2 holds at t = 1. -/
theorem units_one (n : Nat) (g : Nat → Bool) (h : (FermatPrime.units (n + 2)).all g = true) : g 1 = true :=
units_one_gen (fun t => Nat.beq (Nat.gcd t (n + 2)) 1) g (by show Nat.beq (Nat.gcd 1 (n + 2)) 1 = true; rw [gcd_one]; rfl) n h
def sumL : List Nat → Nat
| [] => 0
| x :: l => x + sumL l
theorem tsum1 (m : Nat) : ∀ A : List Nat, A.all (fun x => Nat.blt x m) = true → tsum m 1 A = sumL A
| [], _ => rfl
| x :: A, h => by
have h' : (Nat.blt x m && A.all (fun x => Nat.blt x m)) = true := h
cases a : Nat.blt x m with
| false => rw [a] at h'; exact Bool.noConfusion h'
| true =>
rw [a] at h'
show (1 * x) % m + tsum m 1 A = x + sumL A
rw [Nat.one_mul, mod_lt' x m (Nat.le_of_ble_eq_true a), tsum1 m A h']
/-- **bal at t = 1.** -/
theorem bal_t1 (n : Nat) (A : List Nat) (hA : A.all (fun x => Nat.blt x (n + 2)) = true) (hb : bal (n + 2) A = true) :
sumL A + sumL A = A.length * (n + 2) := by
have h := units_one n _ hb
rw [tsum1 (n + 2) A hA] at h
exact Nat.eq_of_beq_eq_true h
/-! ## Reflection over coefficient lists -/
def ev (r : Nat) (c : Nat × Nat) : Nat := c.1 + c.2 * r
def sA : List (Nat × Nat) → Nat
| [] => 0
| c :: l => c.1 + sA l
def sB : List (Nat × Nat) → Nat
| [] => 0
| c :: l => c.2 + sB l
theorem sumL_map (r : Nat) : ∀ S : List (Nat × Nat), sumL (S.map (ev r)) = sA S + sB S * r
| [] => by show 0 = 0 + 0 * r; exact ((show 0 = 0 + 0*(r) from NatNorm.sound [r] (.lit 0) (.add (.lit 0) (.mul (.lit 0) (.var 0))) rfl))
| c :: S => by
show c.1 + c.2 * r + sumL (S.map (ev r)) = c.1 + sA S + (c.2 + sB S) * r
rw [sumL_map r S]
exact ((show (c.1) + (c.2)*(r) + ((sA S) + (sB S)*(r)) = (c.1) + (sA S) + ((c.2) + (sB S))*(r) from NatNorm.sound [c.1, c.2, sA S, sB S, r] (.add (.add (.var 0) (.mul (.var 1) (.var 4))) (.add (.var 2) (.mul (.var 3) (.var 4)))) (.add (.add (.var 0) (.var 2)) (.mul (.add (.var 1) (.var 3)) (.var 4))) rfl))
theorem length_map' {α β : Type} (g : α → β) : ∀ l : List α, (l.map g).length = l.length
| [] => rfl
| _ :: l => by show (l.map g).length + 1 = l.length + 1; rw [length_map' g l]
/-- the coefficient test: 2Σα + 2Σβ·r = |S|(m₀ + m₁ r) is impossible for every r -/
def chk (m0 m1 : Nat) (S : List (Nat × Nat)) : Bool :=
let a1 := 2 * sA S; let b1 := 2 * sB S; let a2 := S.length * m0; let b2 := S.length * m1
(Nat.blt a1 a2 && Nat.ble b1 b2) || (Nat.blt a2 a1 && Nat.ble b2 b1)
def small (m0 m1 : Nat) (c : Nat × Nat) : Bool := Nat.blt c.1 m0 && Nat.ble c.2 m1
theorem lt_lin (a b c d r : Nat) (h1 : a < c) (h2 : b ≤ d) : a + b * r < c + d * r := by
have ⟨x, hx⟩ := Nat.le.dest h1
have ⟨y, hy⟩ := Nat.le.dest h2
rw [← hx, ← hy, ((show (a) + 1 + (x) + ((b) + (y))*(r) = (a) + (b)*(r) + (1 + (x) + (y)*(r)) from NatNorm.sound [a, x, b, y, r] (.add (.add (.add (.var 0) (.lit 1)) (.var 1)) (.mul (.add (.var 2) (.var 3)) (.var 4))) (.add (.add (.var 0) (.mul (.var 2) (.var 4))) (.add (.add (.lit 1) (.var 1)) (.mul (.var 3) (.var 4)))) rfl))]
exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le (Nat.zero_lt_succ 0) (by
rw [((show 1 + (x) + (y)*(r) = 1 + ((x) + (y)*(r)) from NatNorm.sound [x, y, r] (.add (.add (.lit 1) (.var 0)) (.mul (.var 1) (.var 2))) (.add (.lit 1) (.add (.var 0) (.mul (.var 1) (.var 2)))) rfl))]; exact Nat.le_add_right 1 _))
theorem small_lt (m0 m1 r : Nat) : ∀ S : List (Nat × Nat), S.all (small m0 m1) = true →
(S.map (ev r)).all (fun x => Nat.blt x (m0 + m1 * r)) = true
| [], _ => rfl
| c :: S, h => by
have h' : (small m0 m1 c && S.all (small m0 m1)) = true := h
cases a : small m0 m1 c with
| false => rw [a] at h'; exact Bool.noConfusion h'
| true =>
rw [a] at h'
have a' : (Nat.blt c.1 m0 && Nat.ble c.2 m1) = true := a
cases b1 : Nat.blt c.1 m0 <;> cases b2 : Nat.ble c.2 m1 <;> rw [b1, b2] at a'
· exact Bool.noConfusion a'
· exact Bool.noConfusion a'
· exact Bool.noConfusion a'
· show (Nat.blt (ev r c) (m0 + m1 * r) && (S.map (ev r)).all _) = true
have lt : ev r c < m0 + m1 * r := lt_lin _ _ _ _ r (Nat.le_of_ble_eq_true b1) (Nat.le_of_ble_eq_true b2)
have : Nat.blt (ev r c) (m0 + m1 * r) = true := Nat.ble_eq_true_of_le lt
rw [this, small_lt m0 m1 r S h']; rfl
theorem lin_bal_false (n m0 m1 r : Nat) (hm : m0 + m1 * r = n + 2) (S : List (Nat × Nat))
(hs : S.all (small m0 m1) = true) (hc : chk m0 m1 S = true) : bal (n + 2) (S.map (ev r)) = false := by
cases hb : bal (n + 2) (S.map (ev r)) with
| false => rfl
| true =>
have e := bal_t1 n _ (hm ▸ small_lt m0 m1 r S hs) hb
rw [sumL_map, length_map', ← hm] at e
have e2 : 2 * sA S + 2 * sB S * r = S.length * m0 + S.length * m1 * r := by
rw [((show 2*(sA S) + 2*(sB S)*(r) = (sA S) + (sB S)*(r) + ((sA S) + (sB S)*(r)) from NatNorm.sound [sA S, sB S, r] (.add (.mul (.lit 2) (.var 0)) (.mul (.mul (.lit 2) (.var 1)) (.var 2))) (.add (.add (.var 0) (.mul (.var 1) (.var 2))) (.add (.var 0) (.mul (.var 1) (.var 2)))) rfl)), e]
exact ((show (S.length)*((m0) + (m1)*(r)) = (S.length)*(m0) + (S.length)*(m1)*(r) from NatNorm.sound [S.length, m0, m1, r] (.mul (.var 0) (.add (.var 1) (.mul (.var 2) (.var 3)))) (.add (.mul (.var 0) (.var 1)) (.mul (.mul (.var 0) (.var 2)) (.var 3))) rfl))
have hc' : ((Nat.blt (2 * sA S) (S.length * m0) && Nat.ble (2 * sB S) (S.length * m1)) ||
(Nat.blt (S.length * m0) (2 * sA S) && Nat.ble (S.length * m1) (2 * sB S))) = true := hc
cases c1 : Nat.blt (2 * sA S) (S.length * m0) <;> cases c2 : Nat.ble (2 * sB S) (S.length * m1) <;>
cases c3 : Nat.blt (S.length * m0) (2 * sA S) <;> cases c4 : Nat.ble (S.length * m1) (2 * sB S) <;>
rw [c1, c2, c3, c4] at hc' <;> first
| exact Bool.noConfusion hc'
| exact absurd (e2 ▸ lt_lin _ _ _ _ r (Nat.le_of_ble_eq_true c1) (Nat.le_of_ble_eq_true c2)) (Nat.lt_irrefl _)
| exact absurd (e2 ▸ lt_lin _ _ _ _ r (Nat.le_of_ble_eq_true c3) (Nat.le_of_ble_eq_true c4)) (Nat.lt_irrefl _)
def splitsG {α : Type} : List α → List (List α × List α)
| [] => [([], [])]
| x :: l => (splitsG l).flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)])
theorem splits_eq : ∀ l : List Nat, splits l = splitsG l
| [] => rfl
| x :: l => by
show (splits l).flatMap _ = (splitsG l).flatMap _
rw [splits_eq l]
theorem splits_map {α β : Type} (g : α → β) : ∀ l : List α,
splitsG (l.map g) = (splitsG l).map (fun p => (p.1.map g, p.2.map g))
| [] => rfl
| x :: l => by
show (splitsG (l.map g)).flatMap (fun p => [(g x :: p.1, p.2), (p.1, g x :: p.2)])
= ((splitsG l).flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)])).map (fun p => (p.1.map g, p.2.map g))
rw [splits_map g l]
generalize splitsG l = L
induction L with
| nil => rfl
| cons p L ih =>
show (g x :: p.1.map g, p.2.map g) :: (p.1.map g, g x :: p.2.map g) ::
List.flatMap (fun p => [(g x :: p.1, p.2), (p.1, g x :: p.2)]) (L.map (fun p => (p.1.map g, p.2.map g)))
= (g x :: p.1.map g, p.2.map g) :: (p.1.map g, g x :: p.2.map g) ::
List.map (fun p => (p.1.map g, p.2.map g)) (List.flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)]) L)
rw [ih]
def chkSplit (m0 m1 : Nat) (p : List (Nat × Nat) × List (Nat × Nat)) : Bool :=
p.1.isEmpty || p.2.isEmpty || chk m0 m1 p.1 || chk m0 m1 p.2
theorem sub_small (m0 m1 : Nat) : ∀ (l : List (Nat × Nat)), l.all (small m0 m1) = true →
(splitsG l).all (fun p => p.1.all (small m0 m1) && p.2.all (small m0 m1)) = true := by
intro l; induction l with
| nil => intro _; rfl
| cons x l ih =>
intro h
have h' : (small m0 m1 x && l.all (small m0 m1)) = true := h
cases a : small m0 m1 x with
| false => rw [a] at h'; exact Bool.noConfusion h'
| true =>
rw [a] at h'
have ih' := ih h'
show ((splitsG l).flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)])).all _ = true
generalize splitsG l = L at ih'
induction L with
| nil => rfl
| cons p L ihL =>
have q : ((p.1.all (small m0 m1) && p.2.all (small m0 m1)) && L.all _) = true := ih'
cases b1 : p.1.all (small m0 m1) <;> cases b2 : p.2.all (small m0 m1) <;> rw [b1, b2] at q
· exact Bool.noConfusion q
· exact Bool.noConfusion q
· exact Bool.noConfusion q
· show (((small m0 m1 x && p.1.all (small m0 m1)) && p.2.all (small m0 m1)) &&
((p.1.all (small m0 m1) && (small m0 m1 x && p.2.all (small m0 m1))) &&
(List.flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)]) L).all
(fun p => p.1.all (small m0 m1) && p.2.all (small m0 m1)))) = true
rw [a, b1, b2, ihL q]; rfl
/-- **Reflection.** If every splitting passes chkSplit, the family is irreducible for every r. -/
theorem indec_lin (n m0 m1 r : Nat) (hm : m0 + m1 * r = n + 2) (co : List (Nat × Nat))
(hs : co.all (small m0 m1) = true) (hsp : (splitsG co).all (chkSplit m0 m1) = true) :
indec (n + 2) (co.map (ev r)) = true := by
unfold indec
rw [splits_eq, splits_map]
have hb := APPair.all_and _ _ _ (sub_small m0 m1 co hs) hsp
rw [Reach49.all_map]
apply all_imp _ _ _ _ hb
intro p hp
have hp' : ((p.1.all (small m0 m1) && p.2.all (small m0 m1)) && chkSplit m0 m1 p) = true := hp
cases s1 : p.1.all (small m0 m1) <;> cases s2 : p.2.all (small m0 m1) <;> rw [s1, s2] at hp'
· exact Bool.noConfusion hp'
· exact Bool.noConfusion hp'
· exact Bool.noConfusion hp'
· have hc : (p.1.isEmpty || p.2.isEmpty || chk m0 m1 p.1 || chk m0 m1 p.2) = true := hp'
show ((p.1.map (ev r)).isEmpty || (p.2.map (ev r)).isEmpty || !(bal (n + 2) (p.1.map (ev r)) && bal (n + 2) (p.2.map (ev r)))) = true
have em : ∀ l : List (Nat × Nat), (l.map (ev r)).isEmpty = l.isEmpty := fun l => by cases l <;> rfl
rw [em, em]
cases e1 : p.1.isEmpty
· cases e2 : p.2.isEmpty
· rw [e1, e2] at hc
cases k1 : chk m0 m1 p.1
· rw [k1] at hc
have k2 : chk m0 m1 p.2 = true := hc
rw [lin_bal_false n m0 m1 r hm p.2 s2 k2]
cases bal (n + 2) (p.1.map (ev r)) <;> rfl
· rw [lin_bal_false n m0 m1 r hm p.1 s1 k1]; rfl
· rfl
· rfl
def co1 : List (Nat × Nat) := [(1, 0), (9, 1), (17, 2), (25, 3), (20, 2), (24, 4)]
theorem co1_small : co1.all (small 32 4) = true := rfl
theorem co1_splits : (splitsG co1).all (chkSplit 32 4) = true := rfl
/-- **AP(m/4) + (m/2 + 4, m − 8) is irreducible for every m = 4(8 + r).** -/
theorem fam1_indec (r : Nat) : indec (30 + 4 * r + 2) (co1.map (ev r)) = true :=
indec_lin (30 + 4 * r) 32 4 r ((show 32 + 4*(r) = 30 + 4*(r) + 2 from NatNorm.sound [r] (.add (.lit 32) (.mul (.lit 4) (.var 0))) (.add (.add (.lit 30) (.mul (.lit 4) (.var 0))) (.lit 2)) rfl)) co1 co1_small co1_splits
/-- The same in q: for q ≥ 8 and 8 + b = 4q, [1, 1+q, 1+2q, 1+3q, 2q+4, b] is irreducible in m = 4q. -/
theorem fam1_indec_q (q b : Nat) (hq : 8 ≤ q) (hb : 8 + b = 4 * q) :
indec (4 * q) [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 2 * q + 4, b] = true := by
have ⟨r, hr⟩ := Nat.le.dest hq
have e1 := fam1_indec r
have hb' : b = 24 + 4 * r := by
apply add_right_cancel' _ _ 8
rw [Nat.add_comm b 8, hb, ← hr]; exact ((show 4*(8 + (r)) = 24 + 4*(r) + 8 from NatNorm.sound [r] (.mul (.lit 4) (.add (.lit 8) (.var 0))) (.add (.add (.lit 24) (.mul (.lit 4) (.var 0))) (.lit 8)) rfl))
have eq : [1, 1 + q, 1 + 2 * q, 1 + 3 * q, 2 * q + 4, b] = co1.map (ev r) := by
rw [hb', ← hr]
show [1, 1 + (8 + r), 1 + 2 * (8 + r), 1 + 3 * (8 + r), 2 * (8 + r) + 4, 24 + 4 * r]
= [1 + 0 * r, 9 + 1 * r, 17 + 2 * r, 25 + 3 * r, 20 + 2 * r, 24 + 4 * r]
rw [((show 1 + 0*(r) = 1 from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 0) (.var 0))) (.lit 1) rfl)), ((show 1 + (8 + (r)) = 9 + 1*(r) from NatNorm.sound [r] (.add (.lit 1) (.add (.lit 8) (.var 0))) (.add (.lit 9) (.mul (.lit 1) (.var 0))) rfl)), ((show 1 + 2*(8 + (r)) = 17 + 2*(r) from NatNorm.sound [r] (.add (.lit 1) (.mul (.lit 2) (.add (.lit 8) (.var 0)))) (.add (.lit 17) (.mul (.lit 2) -- (+183 chars; full line in the Zenodo source)
((show 2*(8 + (r)) + 4 = 20 + 2*(r) from NatNorm.sound [r] (.add (.mul (.lit 2) (.add (.lit 8) (.var 0))) (.lit 4)) (.add (.lit 20) (.mul (.lit 2) (.var 0))) rfl))]
rw [eq, ← hr, ((show 4*(8 + (r)) = 30 + 4*(r) + 2 from NatNorm.sound [r] (.mul (.lit 4) (.add (.lit 8) (.var 0))) (.add (.add (.lit 30) (.mul (.lit 4) (.var 0))) (.lit 2)) rfl))]
exact e1
end APPairIrrGen
#print axioms APPairIrrGen.range_succ'
#print axioms APPairIrrGen.gcd_one
#print axioms APPairIrrGen.units_one
#print axioms APPairIrrGen.bal_t1
#print axioms APPairIrrGen.splits_map
#print axioms APPairIrrGen.lin_bal_false
#print axioms APPairIrrGen.indec_lin
#print axioms APPairIrrGen.fam1_indec
#print axioms APPairIrrGen.fam1_indec_q
lean_all/hodge/APPairIrrGen2.lean
/-
hodge/APPairIrrGen2.lean — T41 cycle 278 (goal G21): AP(a) + (m/2 + 4a, m − 8a) is irreducible in m = 4q for every
a ≥ 1 and q ≥ 8a. With q = 8a + r every entry is α·a + β·r (α as for a = 1), and the t = 1 test of APPairIrrGen
works verbatim in two variables (a > 0).
Lean 4 core plus hodge/APPairIrrGen (splitsG, splits_eq, splits_map, chk, chkSplit, small, sA, sB, sub_small, bal_t1,
sumL, length_map', co1, co1_small, co1_splits), hodge/APPairGen, lib/NatNorm.
lt_lin2, sumL_map2, small_lt2, lin_bal_false2, indec_lin2
fam_indec indec (32a + 4r) [a, 9a+r, 17a+2r, 25a+3r, 20a+2r, 24a+4r] (a ≥ 1, every r)
fam_indec_q indec (4q) [a, a+q, a+2q, a+3q, 2q+4a, b] for q ≥ 8a, a ≥ 1, 8a + b = 4q
With APPairGen.ap_pair_bal_gen: balanced and irreducible.
-/
import hodge.APPairIrrGen
import hodge.APPairGen
namespace APPairIrrGen2
open ModHand HalfGeneral Indecomp GcdHand APPairIrrGen
def ev2 (a r : Nat) (c : Nat × Nat) : Nat := c.1 * a + c.2 * r
theorem sumL_map2 (a r : Nat) : ∀ S : List (Nat × Nat), sumL (S.map (ev2 a r)) = sA S * a + sB S * r
| [] => by show 0 = 0 * a + 0 * r; exact ((show 0 = 0*(a) + 0*(r) from NatNorm.sound [a, r] (.lit 0) (.add (.mul (.lit 0) (.var 0)) (.mul (.lit 0) (.var 1))) rfl))
| c :: S => by
show c.1 * a + c.2 * r + sumL (S.map (ev2 a r)) = (c.1 + sA S) * a + (c.2 + sB S) * r
rw [sumL_map2 a r S]
exact ((show (c.1)*(a) + (c.2)*(r) + ((sA S)*(a) + (sB S)*(r)) = ((c.1) + (sA S))*(a) + ((c.2) + (sB S))*(r) from NatNorm.sound [c.1, c.2, sA S, sB S, a, r] (.add (.add (.mul (.var 0) (.var 4)) (.mul (.var 1) (.var 5))) (.add (.mul (.var 2) (.var 4)) (.mul (.var 3) (.var 5)))) (.add (.mul (.add (.var 0) (.var 2)) (.var 4)) (.mul (.add (.var 1) (.var 3)) (.var 5))) rfl))
theorem lt_lin2 (p b c d a r : Nat) (ha : 0 < a) (h1 : p < c) (h2 : b ≤ d) : p * a + b * r < c * a + d * r := by
have ⟨x, hx⟩ := Nat.le.dest h1
have ⟨y, hy⟩ := Nat.le.dest h2
rw [← hx, ← hy, ((show ((p) + 1 + (x))*(a) + ((b) + (y))*(r) = (p)*(a) + (b)*(r) + ((a) + ((x)*(a) + (y)*(r))) from NatNorm.sound [p, x, b, y, a, r] (.add (.mul (.add (.add (.var 0) (.lit 1)) (.var 1)) (.var 4)) (.mul (.add (.var 2) (.var 3)) (.var 5))) (.add (.add (.mul (.var 0) (.var 4)) (.mul (.var 2) (.var 5))) (.add (.var 4) (.add (.mul (.var 1) (.var 4)) (.mul (.var 3) (.var 5))))) rfl))]
exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le ha (Nat.le_add_right a _))
theorem small_lt2 (m0 m1 a r : Nat) (ha : 0 < a) : ∀ S : List (Nat × Nat), S.all (small m0 m1) = true →
(S.map (ev2 a r)).all (fun x => Nat.blt x (m0 * a + m1 * r)) = true
| [], _ => rfl
| c :: S, h => by
have h' : (small m0 m1 c && S.all (small m0 m1)) = true := h
cases e : small m0 m1 c with
| false => rw [e] at h'; exact Bool.noConfusion h'
| true =>
rw [e] at h'
have a' : (Nat.blt c.1 m0 && Nat.ble c.2 m1) = true := e
cases b1 : Nat.blt c.1 m0 <;> cases b2 : Nat.ble c.2 m1 <;> rw [b1, b2] at a'
· exact Bool.noConfusion a'
· exact Bool.noConfusion a'
· exact Bool.noConfusion a'
· show (Nat.blt (ev2 a r c) (m0 * a + m1 * r) && (S.map (ev2 a r)).all _) = true
have lt : ev2 a r c < m0 * a + m1 * r :=
lt_lin2 _ _ _ _ a r ha (Nat.le_of_ble_eq_true b1) (Nat.le_of_ble_eq_true b2)
have : Nat.blt (ev2 a r c) (m0 * a + m1 * r) = true := Nat.ble_eq_true_of_le lt
rw [this, small_lt2 m0 m1 a r ha S h']; rfl
theorem lin_bal_false2 (n m0 m1 a r : Nat) (ha : 0 < a) (hm : m0 * a + m1 * r = n + 2) (S : List (Nat × Nat))
(hs : S.all (small m0 m1) = true) (hc : chk m0 m1 S = true) : bal (n + 2) (S.map (ev2 a r)) = false := by
cases hb : bal (n + 2) (S.map (ev2 a r)) with
| false => rfl
| true =>
have e := bal_t1 n _ (hm ▸ small_lt2 m0 m1 a r ha S hs) hb
rw [sumL_map2, length_map', ← hm] at e
have e2 : 2 * sA S * a + 2 * sB S * r = S.length * m0 * a + S.length * m1 * r := by
rw [((show 2*(sA S)*(a) + 2*(sB S)*(r) = (sA S)*(a) + (sB S)*(r) + ((sA S)*(a) + (sB S)*(r)) from NatNorm.sound [sA S, sB S, a, r] (.add (.mul (.mul (.lit 2) (.var 0)) (.var 2)) (.mul (.mul (.lit 2) (.var 1)) (.var 3))) (.add (.add (.mul (.var 0) (.var 2)) (.mul (.var 1) (.var 3))) (.add (.mul (.var 0) (.var 2)) (.mul (.var 1) (.var 3)))) rfl)), e]
exact ((show (S.length)*((m0)*(a) + (m1)*(r)) = (S.length)*(m0)*(a) + (S.length)*(m1)*(r) from NatNorm.sound [S.length, m0, m1, a, r] (.mul (.var 0) (.add (.mul (.var 1) (.var 3)) (.mul (.var 2) (.var 4)))) (.add (.mul (.mul (.var 0) (.var 1)) (.var 3)) (.mul (.mul (.var 0) (.var 2)) (.var 4))) rfl))
have hc' : ((Nat.blt (2 * sA S) (S.length * m0) && Nat.ble (2 * sB S) (S.length * m1)) ||
(Nat.blt (S.length * m0) (2 * sA S) && Nat.ble (S.length * m1) (2 * sB S))) = true := hc
cases c1 : Nat.blt (2 * sA S) (S.length * m0) <;> cases c2 : Nat.ble (2 * sB S) (S.length * m1) <;>
cases c3 : Nat.blt (S.length * m0) (2 * sA S) <;> cases c4 : Nat.ble (S.length * m1) (2 * sB S) <;>
rw [c1, c2, c3, c4] at hc' <;> first
| exact Bool.noConfusion hc'
| exact absurd (e2 ▸ lt_lin2 _ _ _ _ a r ha (Nat.le_of_ble_eq_true c1) (Nat.le_of_ble_eq_true c2)) (Nat.lt_irrefl _)
| exact absurd (e2 ▸ lt_lin2 _ _ _ _ a r ha (Nat.le_of_ble_eq_true c3) (Nat.le_of_ble_eq_true c4)) (Nat.lt_irrefl _)
theorem indec_lin2 (n m0 m1 a r : Nat) (ha : 0 < a) (hm : m0 * a + m1 * r = n + 2) (co : List (Nat × Nat))
(hs : co.all (small m0 m1) = true) (hsp : (splitsG co).all (chkSplit m0 m1) = true) :
indec (n + 2) (co.map (ev2 a r)) = true := by
unfold indec
rw [splits_eq, splits_map]
have hb := APPair.all_and _ _ _ (sub_small m0 m1 co hs) hsp
rw [Reach49.all_map]
apply all_imp _ _ _ _ hb
intro p hp
have hp' : ((p.1.all (small m0 m1) && p.2.all (small m0 m1)) && chkSplit m0 m1 p) = true := hp
cases s1 : p.1.all (small m0 m1) <;> cases s2 : p.2.all (small m0 m1) <;> rw [s1, s2] at hp'
· exact Bool.noConfusion hp'
· exact Bool.noConfusion hp'
· exact Bool.noConfusion hp'
· have hc : (p.1.isEmpty || p.2.isEmpty || chk m0 m1 p.1 || chk m0 m1 p.2) = true := hp'
show ((p.1.map (ev2 a r)).isEmpty || (p.2.map (ev2 a r)).isEmpty ||
!(bal (n + 2) (p.1.map (ev2 a r)) && bal (n + 2) (p.2.map (ev2 a r)))) = true
have em : ∀ l : List (Nat × Nat), (l.map (ev2 a r)).isEmpty = l.isEmpty := fun l => by cases l <;> rfl
rw [em, em]
cases e1 : p.1.isEmpty
· cases e2 : p.2.isEmpty
· rw [e1, e2] at hc
cases k1 : chk m0 m1 p.1
· rw [k1] at hc
have k2 : chk m0 m1 p.2 = true := hc
rw [lin_bal_false2 n m0 m1 a r ha hm p.2 s2 k2]
cases bal (n + 2) (p.1.map (ev2 a r)) <;> rfl
· rw [lin_bal_false2 n m0 m1 a r ha hm p.1 s1 k1]; rfl
· rfl
· rfl
/-- **AP(a) + (m/2 + 4a, m − 8a) is irreducible in m = 4(8a + r), every a ≥ 1, r.** -/
theorem fam_indec (a r : Nat) (ha : 0 < a) (n : Nat) (hn : 32 * a + 4 * r = n + 2) :
indec (n + 2) (co1.map (ev2 a r)) = true :=
indec_lin2 n 32 4 a r ha hn co1 co1_small co1_splits
/-- The same in q: for a ≥ 1, q ≥ 8a and 8a + b = 4q, [a, a+q, a+2q, a+3q, 2q+4a, b] is irreducible. -/
theorem fam_indec_q (q a b : Nat) (ha : 0 < a) (hq : 8 * a ≤ q) (hb : 8 * a + b = 4 * q) :
indec (4 * q) [a, a + q, a + 2 * q, a + 3 * q, 2 * q + 4 * a, b] = true := by
have ⟨r, hr⟩ := Nat.le.dest hq
have ⟨k, hk⟩ := Nat.le.dest ha
have hn : 32 * a + 4 * r = (30 * a + 4 * r + 2 * k) + 2 := by
rw [← hk]; exact ((show 32*(0 + 1 + (k)) + 4*(r) = 30*(0 + 1 + (k)) + 4*(r) + 2*(k) + 2 from NatNorm.sound [k, r] (.add (.mul (.lit 32) (.add (.add (.lit 0) (.lit 1)) (.var 0))) (.mul (.lit 4) (.var 1))) (.add (.add (.add (.mul (.lit 30) (.add (.add (.lit 0) (.lit 1)) (.var 0))) (.mul (.lit 4) (.var 1))) (.mul (.lit 2) (.var 0))) (.lit 2)) rfl))
have e1 := fam_indec a r ha _ hn
have hb' : b = 24 * a + 4 * r := by
apply add_right_cancel' _ _ (8 * a)
rw [Nat.add_comm b (8 * a), hb, ← hr]; exact ((show 4*(8*(a) + (r)) = 24*(a) + 4*(r) + 8*(a) from NatNorm.sound [a, r] (.mul (.lit 4) (.add (.mul (.lit 8) (.var 0)) (.var 1))) (.add (.add (.mul (.lit 24) (.var 0)) (.mul (.lit 4) (.var 1))) (.mul (.lit 8) (.var 0))) rfl))
have eq : [a, a + q, a + 2 * q, a + 3 * q, 2 * q + 4 * a, b] = co1.map (ev2 a r) := by
rw [hb', ← hr]
show [a, a + (8 * a + r), a + 2 * (8 * a + r), a + 3 * (8 * a + r), 2 * (8 * a + r) + 4 * a, 24 * a + 4 * r]
= [1 * a + 0 * r, 9 * a + 1 * r, 17 * a + 2 * r, 25 * a + 3 * r, 20 * a + 2 * r, 24 * a + 4 * r]
rw [((show 1*(a) + 0*(r) = (a) from NatNorm.sound [a, r] (.add (.mul (.lit 1) (.var 0)) (.mul (.lit 0) (.var 1))) (.var 0) rfl)), ((show (a) + (8*(a) + (r)) = 9*(a) + 1*(r) from NatNorm.sound [a, r] (.add (.var 0) (.add (.mul (.lit 8) (.var 0)) (.var 1))) (.add (.mul (.lit 9) (.var 0)) (.mul (.lit 1) (.var 1))) rfl)), ((show (a) + 2*(8*(a) + (r)) = 17*(a) + 2*(r) from NatNorm.sound [a, r] (.ad -- (+133 chars; full line in the Zenodo source)
((show (a) + 3*(8*(a) + (r)) = 25*(a) + 3*(r) from NatNorm.sound [a, r] (.add (.var 0) (.mul (.lit 3) (.add (.mul (.lit 8) (.var 0)) (.var 1)))) (.add (.mul (.lit 25) (.var 0)) (.mul (.lit 3) (.var 1))) rfl)), ((show 2*(8*(a) + (r)) + 4*(a) = 20*(a) + 2*(r) from NatNorm.sound [a, r] (.add (.mul (.lit 2) (.add (.mul (.lit 8) (.var 0)) (.var 1))) (.mul (.lit 4) (.var 0))) (.add (.mul (.lit 20) -- (+43 chars; full line in the Zenodo source)
rw [eq, ← hr, ((show 4*(8*(a) + (r)) = 32*(a) + 4*(r) from NatNorm.sound [a, r] (.mul (.lit 4) (.add (.mul (.lit 8) (.var 0)) (.var 1))) (.add (.mul (.lit 32) (.var 0)) (.mul (.lit 4) (.var 1))) rfl)), hn]
exact e1
end APPairIrrGen2
#print axioms APPairIrrGen2.sumL_map2
#print axioms APPairIrrGen2.lt_lin2
#print axioms APPairIrrGen2.lin_bal_false2
#print axioms APPairIrrGen2.indec_lin2
#print axioms APPairIrrGen2.fam_indec
#print axioms APPairIrrGen2.fam_indec_q
lean_all/hodge/AvgIndec.lean
/-
hodge/AvgIndec.lean — T41 cycle 1167 (goal G757): the subgroup-average criterion for indecomposability, generalising
PadCriterion.sum_indec (H = {1}) and the argument of FamIndec3. For a list H of units of m and
D(x) = Σ_{t∈H} ⟨t·x⟩_m:
hsum_gs Σ_{t∈H} tsum m t A = Σ_{x∈A} D(x)
avg_indec if no split (A, B) of c with A, B nonempty has 2·Σ_{x∈A} D(x) = |A|·|H|·m, then c is indecomposable.
A balanced part satisfies 2·tsum = |A|·m for every unit t, hence for the sum over H. The per-split test needs only
the precomputed values D(x) (for the m = 72 seed with H = ⟨5, 13⟩ ⊂ (Z/36)ˣ only the split {32} | rest survives).
Lean 4 core plus hodge/FamIndec3 (bal_unit, splits lemmas), hodge/QFamPrime (gs).
-/
import hodge.FamIndec3
namespace AvgIndec
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal FamIndec3 Q4Conv QFamPrime
def hs (m : Nat) (H : List Nat) (A : List Nat) : Nat := gs (fun t => tsum m t A) H
def D (m : Nat) (H : List Nat) (x : Nat) : Nat := gs (fun t => (t * x) % m) H
theorem gs_addf (f g : Nat → Nat) : ∀ H : List Nat, gs (fun t => f t + g t) H = gs f H + gs g H
| [] => rfl
| t :: H => by
show (f t + g t) + gs (fun t => f t + g t) H = (f t + gs f H) + (g t + gs g H)
rw [gs_addf f g H]; lib_nat
theorem hsum_gs (m : Nat) (H : List Nat) : ∀ A : List Nat, hs m H A = gs (D m H) A
| [] => by
show gs (fun _ => 0) H = 0
induction H with
| nil => rfl
| cons t H ih => show 0 + gs (fun _ => 0) H = 0; rw [ih]
| x :: A => by
show gs (fun t => (t * x) % m + tsum m t A) H = D m H x + gs (D m H) A
rw [gs_addf, ← hsum_gs m H A]; rfl
theorem bal_hs (m : Nat) (H : List Nat) (hH : ∀ t, t ∈ H → t < m ∧ Nat.gcd t m = 1) (A : List Nat)
(hb : bal m A = true) : ∀ H' : List Nat, (∀ t, t ∈ H' → t ∈ H) → hs m H' A + hs m H' A = A.length * (H'.length * m)
| [], _ => by show 0 + 0 = A.length * (0 * m); lib_nat
| t :: H', hsub => by
have ih := bal_hs m H hH A hb H' (fun s hs' => hsub s (List.Mem.tail _ hs'))
have ht := hH t (hsub t (List.Mem.head _))
have e := bal_unit m t A hb ht.1 ht.2
show (tsum m t A + hs m H' A) + (tsum m t A + hs m H' A) = A.length * ((H'.length + 1) * m)
calc (tsum m t A + hs m H' A) + (tsum m t A + hs m H' A)
= (tsum m t A + tsum m t A) + (hs m H' A + hs m H' A) := by lib_nat
_ = A.length * m + A.length * (H'.length * m) := by rw [e, ih]
_ = _ := by lib_nat
/-- **the subgroup-average criterion** -/
theorem avg_indec (m : Nat) (c H : List Nat) (hH : ∀ t, t ∈ H → t < m ∧ Nat.gcd t m = 1)
(hcrit : ∀ A B, (A, B) ∈ splits c → A.isEmpty = false → B.isEmpty = false →
gs (D m H) A + gs (D m H) A ≠ A.length * (H.length * m)) : indec m c = true := by
cases hind : indec m c with
| true => rfl
| false =>
exfalso
cases all_false _ (splits c) hind with
| intro sp hsp =>
have hf : (sp.1.isEmpty || sp.2.isEmpty || !(bal m sp.1 && bal m sp.2)) = false := hsp.2
cases h1 : sp.1.isEmpty with
| true => rw [h1] at hf; exact nomatch hf
| false => cases h2 : sp.2.isEmpty with
| true => rw [h1, h2] at hf; exact nomatch hf
| false => cases hA : bal m sp.1 with
| false => rw [h1, h2, hA] at hf; exact nomatch hf
| true =>
have e := bal_hs m H hH sp.1 hA H (fun t ht => ht)
rw [hsum_gs] at e
exact hcrit sp.1 sp.2 hsp.1 h1 h2 e
/-- a Bool certificate for avg_indec -/
def unitsOK (m : Nat) (H : List Nat) : Bool := H.all (fun t => Nat.blt t m && Nat.beq (Nat.gcd t m) 1)
def splitOK (m : Nat) (H : List Nat) (sp : List Nat × List Nat) : Bool :=
sp.1.isEmpty || sp.2.isEmpty || !Nat.beq (gs (D m H) sp.1 + gs (D m H) sp.1) (sp.1.length * (H.length * m))
def avgCheck (m : Nat) (c H : List Nat) : Bool := unitsOK m H && (splits c).all (splitOK m H)
theorem all_mem' {α : Type} (P : α → Bool) : ∀ (l : List α), l.all P = true → ∀ r, r ∈ l → P r = true
| [], _, _, h => nomatch h
| x :: l, hl, r, hr => by
have hx : P x = true ∧ l.all P = true := by
cases e1 : P x with
| false => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact nomatch hl
| true => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact ⟨rfl, hl⟩
cases hr with
| head => exact hx.1
| tail _ h' => exact all_mem' P l hx.2 r h'
theorem avg_sound (m : Nat) (c H : List Nat) (h : avgCheck m c H = true) : indec m c = true := by
have h12 : unitsOK m H = true ∧ (splits c).all (splitOK m H) = true := by
cases e1 : unitsOK m H with
| false => rw [show avgCheck m c H = (unitsOK m H && (splits c).all (splitOK m H)) from rfl, e1] at h; exact nomatch h
| true => rw [show avgCheck m c H = (unitsOK m H && (splits c).all (splitOK m H)) from rfl, e1] at h; exact ⟨rfl, h⟩
apply avg_indec m c H
· intro t ht
have u := all_mem' _ H h12.1 t ht
cases e1 : Nat.blt t m with
| false => rw [e1] at u; exact nomatch u
| true =>
rw [e1] at u
exact ⟨Nat.le_of_ble_eq_true e1, Nat.eq_of_beq_eq_true u⟩
· intro A B hAB hA hB heq
have u := all_mem' _ _ h12.2 (A, B) hAB
have u' : (A.isEmpty || B.isEmpty || !Nat.beq (gs (D m H) A + gs (D m H) A) (A.length * (H.length * m))) = true := u
rw [hA, hB, heq, beq_refl'] at u'
exact nomatch u'
/-- the m = 72 seed of G510b, certified with H = {t : t mod 36 ∈ ⟨5, 13⟩} ∪ {1} -/
theorem seed72 : indec 72 [2, 10, 50, 54, 64] = true :=
avg_sound 72 _ [1, 5, 13, 17, 25, 29, 37, 41, 49, 53, 61, 65, 1] rfl
end AvgIndec
#print axioms AvgIndec.gs_addf
#print axioms AvgIndec.hsum_gs
#print axioms AvgIndec.bal_hs
#print axioms AvgIndec.avg_indec
#print axioms AvgIndec.all_mem'
#print axioms AvgIndec.avg_sound
#print axioms AvgIndec.seed72
lean_all/hodge/BalAppend.lean
/-
hodge/BalAppend.lean — T41 cycle 704 (goal G417): balanced lists form a cancellative monoid under ⊔, every m.
Lean 4 core plus hodge/HalfIff (all_and), hodge/HalfGeneral (all_imp, beq_self), lib/Semi (lib_nat).
tsum_app T_t(A ++ B) = T_t(A) + T_t(B)
len_app |A ++ B| = |A| + |B|
bal_append A, B balanced ⇒ A ++ B balanced
bal_cancel A balanced, A ++ B balanced ⇒ B balanced
So a Hodge character with a balanced sub-list A splits as A ⊔ B with B Hodge: reduction along any
balanced block (pairs, m/2, longer blocks) is exact, in both directions.
-/
import hodge.HalfIff
namespace BalAppend
open Indecomp HalfGeneral HalfIff
theorem tsum_app (m t : Nat) : ∀ A B : List Nat, tsum m t (A ++ B) = tsum m t A + tsum m t B
| [], B => (Nat.zero_add _).symm
| a :: A, B => by
show (t * a) % m + tsum m t (A ++ B) = ((t * a) % m + tsum m t A) + tsum m t B
rw [tsum_app m t A B, Nat.add_assoc]
theorem len_app {α : Type} : ∀ A B : List α, (A ++ B).length = A.length + B.length
| [], B => (Nat.zero_add _).symm
| _ :: A, B => by
show (A ++ B).length + 1 = (A.length + 1) + B.length
rw [len_app A B]; lib_nat
theorem add_cancel (k : Nat) : ∀ x y : Nat, k + x = k + y → x = y := by
induction k with
| zero => intro x y h; rw [Nat.zero_add, Nat.zero_add] at h; exact h
| succ k ih =>
intro x y h
apply ih
have h' : (k + x) + 1 = (k + y) + 1 := by
have e1 : k + 1 + x = (k + x) + 1 := by lib_nat
have e2 : k + 1 + y = (k + y) + 1 := by lib_nat
rw [← e1, ← e2]; exact h
exact Nat.succ.inj h'
theorem bal_append (m : Nat) (A B : List Nat) (ha : bal m A = true) (hb : bal m B = true) :
bal m (A ++ B) = true := by
unfold bal at ha hb ⊢
have both := all_and _ _ _ ha hb
apply all_imp _ _ _ _ both
intro t hboth
have h2 : (Nat.beq (tsum m t A + tsum m t A) (A.length * m)
&& Nat.beq (tsum m t B + tsum m t B) (B.length * m)) = true := hboth
cases a : Nat.beq (tsum m t A + tsum m t A) (A.length * m) with
| false => rw [a] at h2; exact Bool.noConfusion h2
| true =>
rw [a] at h2
have e1 := Nat.eq_of_beq_eq_true a
have e2 := Nat.eq_of_beq_eq_true h2
show Nat.beq (tsum m t (A ++ B) + tsum m t (A ++ B)) ((A ++ B).length * m) = true
rw [tsum_app, len_app]
have e3 : tsum m t A + tsum m t B + (tsum m t A + tsum m t B)
= (tsum m t A + tsum m t A) + (tsum m t B + tsum m t B) := by lib_nat
have e4 : (A.length + B.length) * m = A.length * m + B.length * m := by lib_nat
rw [e3, e4, e1, e2]
exact beq_self _
theorem bal_cancel (m : Nat) (A B : List Nat) (ha : bal m A = true) (hab : bal m (A ++ B) = true) :
bal m B = true := by
unfold bal at ha hab ⊢
have both := all_and _ _ _ ha hab
apply all_imp _ _ _ _ both
intro t hboth
have h2 : (Nat.beq (tsum m t A + tsum m t A) (A.length * m)
&& Nat.beq (tsum m t (A ++ B) + tsum m t (A ++ B)) ((A ++ B).length * m)) = true := hboth
cases a : Nat.beq (tsum m t A + tsum m t A) (A.length * m) with
| false => rw [a] at h2; exact Bool.noConfusion h2
| true =>
rw [a] at h2
have e1 := Nat.eq_of_beq_eq_true a
have e2 := Nat.eq_of_beq_eq_true h2
rw [tsum_app, len_app] at e2
have e3 : tsum m t A + tsum m t B + (tsum m t A + tsum m t B)
= (tsum m t A + tsum m t A) + (tsum m t B + tsum m t B) := by lib_nat
have e4 : (A.length + B.length) * m = A.length * m + B.length * m := by lib_nat
rw [e3, e4, e1] at e2
rw [add_cancel _ _ _ e2]
exact beq_self _
end BalAppend
#print axioms BalAppend.tsum_app
#print axioms BalAppend.len_app
#print axioms BalAppend.add_cancel
#print axioms BalAppend.bal_append
#print axioms BalAppend.bal_cancel
lean_all/hodge/CertSplit.lean
/-
hodge/CertSplit.lean — T41 (goal G865g, tool): splitting an integer certificate B · A = d · I (hodge/MailletLin, used by
FamCert<p> and MailletCert<p>) into row blocks, so that each block is checked by its own rfl (one block per file or
per Kamiak task) and the full certificate follows by concatenation.
lcs_append the rows of (B₁ ++ B₂) · A are the rows of B₁ · A followed by those of B₂ · A
take_drop' L.take k ++ L.drop k = L
cert_split lcs B₁ A = (sid d n).take k and lcs B₂ A = (sid d n).drop k ⇒ lcs (B₁ ++ B₂) A = sid d n
cert_split3 the same with three blocks
Lean 4 core plus hodge/MailletLin.
-/
import hodge.MailletLin
namespace CertSplit
open MailletLin
theorem lcs_append (n : Nat) (A : List (List Int)) :
∀ B1 B2 : List (List Int), lcs n (B1 ++ B2) A = lcs n B1 A ++ lcs n B2 A
| [], _ => rfl
| b :: bs, B2 => congrArg (lc n b A :: ·) (lcs_append n A bs B2)
theorem take_drop' {α : Type} : ∀ (k : Nat) (L : List α), L.take k ++ L.drop k = L
| 0, _ => rfl
| _ + 1, [] => rfl
| k + 1, a :: l => congrArg (a :: ·) (take_drop' k l)
theorem cert_split (n k : Nat) (d : Int) (A B1 B2 : List (List Int))
(h1 : lcs n B1 A = (sid d n).take k) (h2 : lcs n B2 A = (sid d n).drop k) :
lcs n (B1 ++ B2) A = sid d n := by
rw [lcs_append, h1, h2]
exact take_drop' k (sid d n)
theorem cert_split3 (n k1 k2 : Nat) (d : Int) (A B1 B2 B3 : List (List Int))
(h1 : lcs n B1 A = (sid d n).take k1)
(h2 : lcs n B2 A = ((sid d n).drop k1).take k2)
(h3 : lcs n B3 A = ((sid d n).drop k1).drop k2) :
lcs n (B1 ++ (B2 ++ B3)) A = sid d n := by
rw [lcs_append, lcs_append, h1, h2, h3, take_drop' k2 ((sid d n).drop k1)]
exact take_drop' k1 (sid d n)
end CertSplit
#print axioms CertSplit.lcs_append
#print axioms CertSplit.take_drop'
#print axioms CertSplit.cert_split
#print axioms CertSplit.cert_split3
lean_all/hodge/ComplBal.lean
/-
hodge/ComplBal.lean — T41 cycle 1434 (goal G825 — done): complex conjugation preserves balance. For m = m' + 1,
a unit t and entries in (0, m):
tsum_compl T_t(m − c) + T_t(c) = |c|·m (PairsSplit.pair_mod entrywise)
filter_all_imp (filter pr l).all P ⇒ (filter pr l).all Q when pr t ∧ P t ⇒ Q t
compl_bal c balanced ⇒ m − c = (m − c_i)_i balanced
(T + T_c = T_c + T_c gives T = T_c). The conjugate of a Hodge character is a Hodge character.
Lean 4 core plus hodge/PairsSplit, hodge/BalAppend (add_cancel), hodge/Pullback (len_map).
-/
import hodge.PairsSplit
import hodge.BalAppend
import hodge.Pullback
namespace ComplBal
open Indecomp PairsSplit
theorem tsum_compl (m' t : Nat) (hg : Nat.gcd t (m' + 1) = 1) : ∀ c : List Nat, c.all (inR (m' + 1)) = true →
tsum (m' + 1) t (c.map (fun x => m' + 1 - x)) + tsum (m' + 1) t c = c.length * (m' + 1)
| [], _ => by show 0 + 0 = 0 * (m' + 1); rw [Nat.zero_mul]
| x :: c, hr => by
have hr' : (inR (m' + 1) x && c.all (inR (m' + 1))) = true := hr
have hx0 : 0 < x := Nat.le_of_ble_eq_true (andL (andL hr'))
have hxm : x < m' + 1 := Nat.le_of_ble_eq_true (andR (andL hr'))
have pm := pair_mod m' t x hg hx0 hxm
have ih := tsum_compl m' t hg c (andR hr')
show ((t * (m' + 1 - x)) % (m' + 1) + tsum (m' + 1) t (c.map (fun x => m' + 1 - x)))
+ ((t * x) % (m' + 1) + tsum (m' + 1) t c) = (c.length + 1) * (m' + 1)
generalize (t * x) % (m' + 1) = A at pm ⊢
generalize (t * (m' + 1 - x)) % (m' + 1) = B at pm ⊢
generalize tsum (m' + 1) t (c.map (fun x => m' + 1 - x)) = M at ih ⊢
generalize tsum (m' + 1) t c = C at ih ⊢
rw [show B + M + (A + C) = (M + C) + (A + B) by lib_nat, ih, pm]
lib_nat
theorem filter_all_imp (pr P Q : Nat → Bool) (h : ∀ t, pr t = true → P t = true → Q t = true) :
∀ l : List Nat, (l.filter pr).all P = true → (l.filter pr).all Q = true
| [], _ => rfl
| x :: l, hl => by
cases hx : pr x with
| false =>
have e : (x :: l).filter pr = l.filter pr := by
show (match pr x with | true => x :: l.filter pr | false => l.filter pr) = _; rw [hx]
rw [e] at hl ⊢
exact filter_all_imp pr P Q h l hl
| true =>
have e : (x :: l).filter pr = x :: l.filter pr := by
show (match pr x with | true => x :: l.filter pr | false => l.filter pr) = _; rw [hx]
rw [e] at hl ⊢
have hl' : (P x && (l.filter pr).all P) = true := hl
show (Q x && (l.filter pr).all Q) = true
rw [h x hx (andL hl'), filter_all_imp pr P Q h l (andR hl')]
rfl
theorem compl_bal (m' : Nat) (c : List Nat) (hr : c.all (inR (m' + 1)) = true) (hb : bal (m' + 1) c = true) :
bal (m' + 1) (c.map (fun x => m' + 1 - x)) = true := by
have hb' : ((List.range (m' + 1)).filter (fun t => Nat.beq (Nat.gcd t (m' + 1)) 1)).all
(fun t => Nat.beq (tsum (m' + 1) t c + tsum (m' + 1) t c) (c.length * (m' + 1))) = true := hb
show ((List.range (m' + 1)).filter (fun t => Nat.beq (Nat.gcd t (m' + 1)) 1)).all
(fun t => Nat.beq (tsum (m' + 1) t (c.map (fun x => m' + 1 - x)) + tsum (m' + 1) t (c.map (fun x => m' + 1 - x)))
((c.map (fun x => m' + 1 - x)).length * (m' + 1))) = true
refine filter_all_imp _ _ _ ?_ _ hb'
intro t ht hP
have hg : Nat.gcd t (m' + 1) = 1 := Nat.eq_of_beq_eq_true ht
have hc : tsum (m' + 1) t c + tsum (m' + 1) t c = c.length * (m' + 1) := Nat.eq_of_beq_eq_true hP
have tc := tsum_compl m' t hg c hr
rw [Pullback.len_map]
generalize tsum (m' + 1) t (c.map (fun x => m' + 1 - x)) = M at tc ⊢
generalize tsum (m' + 1) t c = C at tc hc
have e : C + M = C + C := by rw [Nat.add_comm C M, tc, hc]
have e2 := BalAppend.add_cancel _ _ _ e
rw [e2, hc]
exact FamBal.beq_refl' _
end ComplBal
#print axioms ComplBal.tsum_compl
#print axioms ComplBal.filter_all_imp
#print axioms ComplBal.compl_bal
lean_all/hodge/ComplBig.lean
/-
hodge/ComplBig.lean — T41 cycle 1432 (goal G824 — done): complementing a character in odd degree swaps the
entries above and below m/2. For m = 2j + 3 and entries < m:
big_append #big(l₁ ++ l₂) = #big(l₁) + #big(l₂)
compl_big #big(m − c) + #big(c) = |c|
(each x contributes one to exactly one side by PairBig.pair_big). With HalfBig.half_big this says that the complement
m − c of a balanced character is again half above m/2.
Lean 4 core plus hodge/PairBig.
-/
import hodge.PairBig
namespace ComplBig
open HalfBig
theorem big_append (m : Nat) : ∀ l₁ l₂ : List Nat, big m (l₁ ++ l₂) = big m l₁ + big m l₂
| [], l₂ => (Nat.zero_add _).symm
| a :: l₁, l₂ => by
show (if Nat.ble m (2 * a) = true then 1 else 0) + big m (l₁ ++ l₂)
= ((if Nat.ble m (2 * a) = true then 1 else 0) + big m l₁) + big m l₂
rw [big_append m l₁ l₂, Nat.add_assoc]
def allLt (m : Nat) : List Nat → Prop
| [] => True
| x :: l => x < m ∧ allLt m l
theorem compl_big (j : Nat) : ∀ c : List Nat, allLt (2 * j + 3) c →
big (2 * j + 3) (c.map (fun x => 2 * j + 3 - x)) + big (2 * j + 3) c = c.length
| [], _ => rfl
| x :: c, ⟨hx, hc⟩ => by
have p := PairBig.pair_big j x hx
have ih := compl_big j c hc
show ((if Nat.ble (2 * j + 3) (2 * (2 * j + 3 - x)) = true then 1 else 0)
+ big (2 * j + 3) (c.map (fun x => 2 * j + 3 - x)))
+ ((if Nat.ble (2 * j + 3) (2 * x) = true then 1 else 0) + big (2 * j + 3) c) = c.length + 1
have p' : (if Nat.ble (2 * j + 3) (2 * x) = true then 1 else 0)
+ ((if Nat.ble (2 * j + 3) (2 * (2 * j + 3 - x)) = true then 1 else 0) + 0) = 1 := p
generalize (if Nat.ble (2 * j + 3) (2 * x) = true then 1 else 0) = A at p' ⊢
generalize (if Nat.ble (2 * j + 3) (2 * (2 * j + 3 - x)) = true then 1 else 0) = B at p' ⊢
generalize big (2 * j + 3) (c.map (fun x => 2 * j + 3 - x)) = M at ih ⊢
generalize big (2 * j + 3) c = C at ih ⊢
rw [show B + M + (A + C) = (M + C) + (A + (B + 0)) by lib_nat, ih, p']
end ComplBig
#print axioms ComplBig.big_append
#print axioms ComplBig.compl_big
lean_all/hodge/ComplInv.lean
/-
hodge/ComplInv.lean — T41 cycle 1436 (goal G826 — done): complex conjugation is an involution on Hodge-type data.
For m = m' + 1:
sub_sub x ≤ m ⇒ m − (m − x) = x
compl_inR entries in (0, m) stay in (0, m) under x ↦ m − x
compl_compl m − (m − c) = c for entries in (0, m)
compl_hodge c in (0, m) and balanced ⇒ m − c in (0, m) and balanced
so conjugation permutes the Hodge characters of degree m and is its own inverse.
Lean 4 core plus hodge/ComplBal, hodge/GcdHand (sub_add'), hodge/ModHand (add_sub').
-/
import hodge.ComplBal
namespace ComplInv
open Indecomp PairsSplit
theorem sub_sub (m x : Nat) (h : x ≤ m) : m - (m - x) = x := by
have e := GcdHand.sub_add' x m h
generalize m - x = y at e ⊢
rw [← e, Nat.add_comm y x, ModHand.add_sub']
theorem compl_inR (m' : Nat) : ∀ c : List Nat, c.all (inR (m' + 1)) = true →
(c.map (fun x => m' + 1 - x)).all (inR (m' + 1)) = true
| [], _ => rfl
| x :: c, hr => by
have hr' : (inR (m' + 1) x && c.all (inR (m' + 1))) = true := hr
have hx0 : 0 < x := Nat.le_of_ble_eq_true (andL (andL hr'))
have hxm : x < m' + 1 := Nat.le_of_ble_eq_true (andR (andL hr'))
have e := GcdHand.sub_add' x (m' + 1) (Nat.le_of_lt hxm)
have p0 : 0 < m' + 1 - x := by
cases ey : m' + 1 - x with
| succ k => exact Nat.succ_pos k
| zero =>
rw [ey, Nat.zero_add] at e
rw [e] at hxm
exact absurd hxm (Nat.lt_irrefl _)
have pl : m' + 1 - x < m' + 1 := by
have l := Nat.add_lt_add_left hx0 (m' + 1 - x)
rw [Nat.add_zero, e] at l
exact l
show (inR (m' + 1) (m' + 1 - x) && (c.map (fun x => m' + 1 - x)).all (inR (m' + 1))) = true
rw [compl_inR m' c (andR hr')]
show ((Nat.blt 0 (m' + 1 - x) && Nat.blt (m' + 1 - x) (m' + 1)) && true) = true
have e1 : Nat.blt 0 (m' + 1 - x) = true := Nat.ble_eq_true_of_le p0
have e2 : Nat.blt (m' + 1 - x) (m' + 1) = true := Nat.ble_eq_true_of_le pl
rw [e1, e2]
rfl
theorem compl_compl (m' : Nat) : ∀ c : List Nat, c.all (inR (m' + 1)) = true →
(c.map (fun x => m' + 1 - x)).map (fun x => m' + 1 - x) = c
| [], _ => rfl
| x :: c, hr => by
have hr' : (inR (m' + 1) x && c.all (inR (m' + 1))) = true := hr
have hxm : x < m' + 1 := Nat.le_of_ble_eq_true (andR (andL hr'))
show (m' + 1 - (m' + 1 - x)) :: (c.map (fun x => m' + 1 - x)).map (fun x => m' + 1 - x) = x :: c
rw [sub_sub _ _ (Nat.le_of_lt hxm), compl_compl m' c (andR hr')]
theorem compl_hodge (m' : Nat) (c : List Nat) (hr : c.all (inR (m' + 1)) = true) (hb : bal (m' + 1) c = true) :
(c.map (fun x => m' + 1 - x)).all (inR (m' + 1)) = true ∧ bal (m' + 1) (c.map (fun x => m' + 1 - x)) = true :=
⟨compl_inR m' c hr, ComplBal.compl_bal m' c hr hb⟩
end ComplInv
#print axioms ComplInv.sub_sub
#print axioms ComplInv.compl_inR
#print axioms ComplInv.compl_compl
#print axioms ComplInv.compl_hodge
lean_all/hodge/ConjTwist.lean
/-
hodge/ConjTwist.lean — T41 cycle 1440 (goal G828 — done): complex conjugation is the Galois twist by −1.
For m = m' + 1 and 0 < x < m:
neg_one_mul ⟨(m − 1)·x⟩_m = m − x
conj_twist twist by m − 1 = (m − c_i)_i for entries in (0, m)
so the conjugation lemmas (ComplBal, ComplInv, TwistCompl) are the t = −1 case of the Galois action.
Lean 4 core plus hodge/ModHand (add_mul_mod', mod_lt'), hodge/GcdHand (sub_add'), hodge/PairsSplit (inR),
hodge/GaloisOrbit (twist).
-/
import hodge.PairsSplit
import hodge.GaloisOrbit
namespace ConjTwist
open PairsSplit
theorem neg_one_mul (m' x : Nat) (hx0 : 0 < x) (hxm : x < m' + 1) : (m' * x) % (m' + 1) = m' + 1 - x := by
cases x with
| zero => exact absurd hx0 (Nat.lt_irrefl 0)
| succ k =>
have hk : k ≤ m' := Nat.le_of_succ_le_succ (Nat.le_of_lt hxm)
rw [Nat.succ_sub_succ]
have e := GcdHand.sub_add' k m' hk
generalize m' - k = r at e ⊢
rw [← e]
have h1 : (r + k) * (k + 1) = r + k * (r + k + 1) := by lib_nat
rw [h1, ModHand.add_mul_mod' r (r + k + 1) (Nat.succ_pos _) k]
exact ModHand.mod_lt' r (r + k + 1) (Nat.lt_succ_of_le (Nat.le_add_right r k))
theorem conj_twist (m' : Nat) : ∀ c : List Nat, c.all (inR (m' + 1)) = true →
GaloisOrbit.twist (m' + 1) m' c = c.map (fun x => m' + 1 - x)
| [], _ => rfl
| x :: c, hr => by
have hr' : (inR (m' + 1) x && c.all (inR (m' + 1))) = true := hr
have hx0 : 0 < x := Nat.le_of_ble_eq_true (andL (andL hr'))
have hxm : x < m' + 1 := Nat.le_of_ble_eq_true (andR (andL hr'))
show (m' * x) % (m' + 1) :: GaloisOrbit.twist (m' + 1) m' c = (m' + 1 - x) :: c.map (fun x => m' + 1 - x)
rw [neg_one_mul m' x hx0 hxm, conj_twist m' c (andR hr')]
end ConjTwist
#print axioms ConjTwist.neg_one_mul
#print axioms ConjTwist.conj_twist
lean_all/hodge/Conjugate.lean
/-
hodge/Conjugate.lean — T41 cycle 147: Hodge characters are closed under complex conjugation, every m.
Lean 4 core plus hodge/GaloisOrbit (twist, mul_mod), lib/Semi.
Conjugation is the twist by m − 1 (≡ −1): ⟨s⟨(m−1)x⟩⟩ + ⟨sx⟩ = m when m ∤ sx, so
T_s(c̄) + T_s(c) = |c|·m, hence 2T_s(c) = |c|m ⇒ 2T_s(c̄) = |c|m
(c̄ = (m−1)·c mod m; H^{p,q} ↔ H^{q,p}).
-/
import hodge.GaloisOrbit
import lib.Semi
namespace Conjugate
open FTAChain FrobChain QRChain ESChain FermatGens GaloisOrbit
theorem pair_gen (m' a b : Nat) (h0 : rem (m' + 1) (a + b) = 0) (hb : ¬ Dv (m' + 1) b) :
a % (m' + 1) + b % (m' + 1) = m' + 1 := by
rw [← rem_eq_mod, ← rem_eq_mod]
have hx := rem_lt' m' a
have hy := rem_lt' m' b
have z : rem (m' + 1) (rem (m' + 1) a + rem (m' + 1) b) = 0 := by
rw [rem_add_congr2 m' _ a _ b (rem_idem m' _) (rem_idem m' _)]; exact h0
have hy0 : rem (m' + 1) b ≠ 0 := fun e => hb (dv_of_rem_zero _ _ e)
cases dv_of_rem_zero _ _ z with
| intro q hq =>
match q, hq with
| 0, hq => rw [Nat.zero_mul] at hq; exact absurd (Nat.eq_zero_of_add_eq_zero_left hq) hy0
| 1, hq => rw [hq, Nat.one_mul]
| q + 2, hq =>
have l : rem (m' + 1) a + rem (m' + 1) b < (m' + 1) + (m' + 1) := Nat.add_lt_add hx hy
have g : (m' + 1) + (m' + 1) ≤ (q + 2) * (m' + 1) := by
rw [show (q + 2) * (m' + 1) = q * (m' + 1) + ((m' + 1) + (m' + 1)) by lib_nat]; exact Nat.le_add_left _ _
rw [hq] at l; exact absurd (Nat.lt_of_lt_of_le l g) (Nat.lt_irrefl _)
def nz (m s : Nat) : List Nat → Prop
| [] => True
| x :: c => ¬ Dv m (s * x) ∧ nz m s c
theorem conj_sum (m' s : Nat) : ∀ c : List Nat, nz (m' + 1) s c →
tsum (m' + 1) s (twist (m' + 1) m' c) + tsum (m' + 1) s c = c.length * (m' + 1)
| [], _ => by show 0 + 0 = 0 * (m' + 1); rw [Nat.zero_mul]
| x :: c, ⟨hx, hc⟩ => by
have ih := conj_sum m' s c hc
show (s * ((m' * x) % (m' + 1))) % (m' + 1) + tsum (m' + 1) s (twist (m' + 1) m' c)
+ ((s * x) % (m' + 1) + tsum (m' + 1) s c) = (c.length + 1) * (m' + 1)
rw [mul_mod]
have p := pair_gen m' (s * m' * x) (s * x) (by
apply rem_zero_of_dv; exact ⟨s * x, by lib_nat⟩) hx
have e : (s * m' * x) % (m' + 1) + tsum (m' + 1) s (twist (m' + 1) m' c) + ((s * x) % (m' + 1) + tsum (m' + 1) s c)
= ((s * m' * x) % (m' + 1) + (s * x) % (m' + 1)) + (tsum (m' + 1) s (twist (m' + 1) m' c) + tsum (m' + 1) s c) := by
lib_nat
rw [e, p, ih]; lib_nat
/-- **Conjugation preserves the Hodge condition.** -/
theorem conj_hodge (m' s : Nat) (c : List Nat) (hnz : nz (m' + 1) s c)
(h : tsum (m' + 1) s c + tsum (m' + 1) s c = c.length * (m' + 1)) :
tsum (m' + 1) s (twist (m' + 1) m' c) + tsum (m' + 1) s (twist (m' + 1) m' c) = c.length * (m' + 1) := by
have cs := conj_sum m' s c hnz
apply add_left_cancel' (tsum (m' + 1) s c + tsum (m' + 1) s c)
have e : tsum (m' + 1) s c + tsum (m' + 1) s c
+ (tsum (m' + 1) s (twist (m' + 1) m' c) + tsum (m' + 1) s (twist (m' + 1) m' c))
= (tsum (m' + 1) s (twist (m' + 1) m' c) + tsum (m' + 1) s c)
+ (tsum (m' + 1) s (twist (m' + 1) m' c) + tsum (m' + 1) s c) := by lib_nat
rw [e, cs, h]
end Conjugate
#print axioms Conjugate.pair_gen
#print axioms Conjugate.conj_sum
#print axioms Conjugate.conj_hodge
lean_all/hodge/CosetAvg.lean
/-
hodge/CosetAvg.lean — T41 cycle 1914 (goal G862c, step 1): unit sums over the cosets ρ·H of
H = {1 + 14i} in (Z/14p)^×, written as t_j = ρ + 14j (j < p), generalising FamIndec1 from ρ = 1, x ≡ 1 (mod 14)
to any ρ and any c:
coset_all gcd(c, p) = 1: Σ_{j<p} ⟨(ρ + 14j)·c⟩_{14p} = p·⟨ρc⟩_14 + 14·Σ_{i<p} i
coset_term c = p·e: ⟨(ρ + 14j)·c⟩_{14p} = p·⟨ρe⟩_14 for every j
omit_gen ρ + 14j₀ = p·y: ⟨(ρ + 14j₀)·c⟩_{14p} = p·⟨yc⟩_14
coset_omit Σ_{j<p, j≠j₀} ⟨(ρ + 14j)·c⟩_{14p} + p·⟨yc⟩_14 = p·⟨ρc⟩_14 + 14·Σ_{i<p} i (gcd(c, p) = 1)
So the coset-averaged balance condition of a list depends only on residues mod 14 (HODGE_LOG cycle 1914).
Lean 4 core plus hodge/FamIndec1 (FamMod.mod_split, PermSum.perm_sum, FamArith.sumF_replace); no axioms.
-/
import hodge.FamIndec1
namespace CosetAvg
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp
theorem lt14 (r p : Nat) (hr : r < 14) (hp : 0 < p) : p * r < 14 * p := by
rw [Nat.mul_comm 14 p]
exact Nat.mul_lt_mul_of_le_of_lt (Nat.le_refl p) hr hp
theorem coset_all (p ρ c : Nat) (hp : 0 < p) (hx : Nat.gcd c p = 1) :
sumF (fun j => ((ρ + 14 * j) * c) % (14 * p)) p = p * ((ρ * c) % 14) + 14 * sumF (fun i => i) p := by
have hr : (ρ * c) % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
obtain ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (ρ * c + 1) (ρ * c) (Nat.lt_succ_self _)
generalize (ρ * c) % 14 = r at hr hq ⊢
have e : ∀ j, ((ρ + 14 * j) * c) % (14 * p) = r + 14 * ((q + c * j) % p) := by
intro j
have e1 : (ρ + 14 * j) * c = r + 14 * (q + c * j) := by
calc (ρ + 14 * j) * c = ρ * c + 14 * (c * j) := by lib_nat
_ = (r + 14 * q) + 14 * (c * j) := by rw [hq]
_ = _ := by lib_nat
rw [e1, mod_split r _ p hp hr]
rw [sumF_congr _ _ e p, sumF_lin, perm_sum p c q hp hx]
theorem coset_term (p ρ e j : Nat) (hp : 0 < p) :
((ρ + 14 * j) * (p * e)) % (14 * p) = p * ((ρ * e) % 14) := by
have hr : (ρ * e) % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
obtain ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (ρ * e + 1) (ρ * e) (Nat.lt_succ_self _)
generalize (ρ * e) % 14 = r at hr hq ⊢
have e1 : (ρ + 14 * j) * (p * e) = p * r + (q + j * e) * (14 * p) := by
calc (ρ + 14 * j) * (p * e) = p * (ρ * e) + 14 * p * (j * e) := by lib_nat
_ = p * (r + 14 * q) + 14 * p * (j * e) := by rw [hq]
_ = _ := by lib_nat
rw [e1, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 13) hp)]
exact mod_lt' _ _ (lt14 r p hr hp)
theorem omit_gen (p ρ j0 y c : Nat) (hp : 0 < p) (ht : ρ + 14 * j0 = p * y) :
((ρ + 14 * j0) * c) % (14 * p) = p * ((y * c) % 14) := by
have hr : (y * c) % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
obtain ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (y * c + 1) (y * c) (Nat.lt_succ_self _)
generalize (y * c) % 14 = r at hr hq ⊢
have e1 : (ρ + 14 * j0) * c = p * r + q * (14 * p) := by
rw [ht]
calc p * y * c = p * (y * c) := by lib_nat
_ = p * (r + 14 * q) := by rw [hq]
_ = _ := by lib_nat
rw [e1, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 13) hp)]
exact mod_lt' _ _ (lt14 r p hr hp)
/-- the sum over t_j = ρ + 14j, j ≠ j₀ (the j₀ term set to 0) -/
def omitR (p ρ j0 c : Nat) : Nat :=
sumF (fun j => if Nat.beq j j0 then 0 else ((ρ + 14 * j) * c) % (14 * p)) p
theorem omitR_add (p ρ j0 c : Nat) (hi : j0 < p) :
omitR p ρ j0 c + ((ρ + 14 * j0) * c) % (14 * p) = sumF (fun j => ((ρ + 14 * j) * c) % (14 * p)) p := by
have rep := sumF_replace (fun j => if Nat.beq j j0 then 0 else ((ρ + 14 * j) * c) % (14 * p))
(fun j => ((ρ + 14 * j) * c) % (14 * p)) j0 (fun j hne => by
have : Nat.beq j j0 = false := by
cases e : Nat.beq j j0 with
| false => rfl
| true => exact absurd (Nat.eq_of_beq_eq_true e) hne
show (if Nat.beq j j0 = true then 0 else _) = _
rw [this]; rfl) p hi
have rep' : omitR p ρ j0 c + ((ρ + 14 * j0) * c) % (14 * p)
= sumF (fun j => ((ρ + 14 * j) * c) % (14 * p)) p
+ (if Nat.beq j0 j0 = true then 0 else ((ρ + 14 * j0) * c) % (14 * p)) := rep
rw [FamBal.beq_refl' j0] at rep'
exact rep'
/-- **Coset average of a unit element.** -/
theorem coset_omit (p ρ j0 y c : Nat) (hi : j0 < p) (ht : ρ + 14 * j0 = p * y) (hx : Nat.gcd c p = 1) :
omitR p ρ j0 c + p * ((y * c) % 14) = p * ((ρ * c) % 14) + 14 * sumF (fun i => i) p := by
have hp : 0 < p := Nat.lt_of_le_of_lt (Nat.zero_le j0) hi
rw [← omit_gen p ρ j0 y c hp ht, omitR_add p ρ j0 c hi, coset_all p ρ c hp hx]
theorem sumF_const (C : Nat) : ∀ n, sumF (fun _ => C) n = n * C
| 0 => by show 0 = 0 * C; lib_nat
| n + 1 => by show sumF (fun _ => C) n + C = (n + 1) * C; rw [sumF_const C n]; lib_nat
/-- **Coset average of a multiple of p.** -/
theorem coset_omit_div (p ρ j0 e : Nat) (hi : j0 < p) :
omitR p ρ j0 (p * e) + p * ((ρ * e) % 14) = p * (p * ((ρ * e) % 14)) := by
have hp : 0 < p := Nat.lt_of_le_of_lt (Nat.zero_le j0) hi
have h := omitR_add p ρ j0 (p * e) hi
rw [coset_term p ρ e j0 hp, sumF_congr _ _ (fun j => coset_term p ρ e j hp) p, sumF_const] at h
exact h
end CosetAvg
#print axioms CosetAvg.lt14
#print axioms CosetAvg.coset_all
#print axioms CosetAvg.coset_term
#print axioms CosetAvg.omit_gen
#print axioms CosetAvg.omitR_add
#print axioms CosetAvg.coset_omit
#print axioms CosetAvg.sumF_const
#print axioms CosetAvg.coset_omit_div
lean_all/hodge/CosetBal.lean
/-
hodge/CosetBal.lean — T41 cycle 1914 (goal G862c, step 2b): averaging the balance condition of any balanced list L
at 14p over the coset units t_j = ρ + 14j (j ≠ j₀, ρ coprime to 14, ρ < 14, p prime with gcd(14, p) = 1):
coset_bal 2·Σ_{x∈L} omitR(p, ρ, j₀, x) + |L|·14p = p·|L|·14p
(CosetAvg.omitR is the sum over j ≠ j₀ of ⟨(ρ + 14j)x⟩_{14p}). With CosetAvg.coset_omit / coset_omit_div each
omitR is a residue mod 14, so this is the coset-averaged condition of HODGE_LOG cycle 1914 (G862b).
Lean 4 core plus hodge/FamIndec3 (swap, gs lemmas, bal_unit), hodge/CosetAvg, hodge/CosetUnit; no axioms.
-/
import hodge.FamIndec3
import hodge.CosetAvg
import hodge.CosetUnit
namespace CosetBal
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamIndec3 FamBal CosetAvg CosetUnit QFamPrime
theorem coset_bal (p ρ j0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hρ14 : Nat.gcd ρ 14 = 1) (hρ : ρ < 14) (hj : j0 < p) (h0 : p ∣ ρ + 14 * j0) (L : List Nat)
(hb : bal (14 * p) L = true) :
gs (fun x => omitR p ρ j0 x) L + gs (fun x => omitR p ρ j0 x) L + L.length * (14 * p) = p * (L.length * (14 * p)) := by
have hne_i : ∀ i, Nat.beq i j0 = false ↔ i ≠ j0 := by
intro i
constructor
· intro h e; rw [e, beq_refl'] at h; exact nomatch h
· intro h
cases e : Nat.beq i j0 with
| false => rfl
| true => exact absurd (Nat.eq_of_beq_eq_true e) h
have E1 : sumF (fun i => if Nat.beq i j0 = true then 0 else tsum (14 * p) (ρ + 14 * i) L + tsum (14 * p) (ρ + 14 * i) L) p
+ L.length * (14 * p) = p * (L.length * (14 * p)) := by
have c1 : sumF (fun i => if Nat.beq i j0 = true then 0 else tsum (14 * p) (ρ + 14 * i) L + tsum (14 * p) (ρ + 14 * i) L) p
= sumF (fun i => if Nat.beq i j0 = true then 0 else L.length * (14 * p)) p := by
apply sumF_congr_lt; intro i hip
cases e : Nat.beq i j0 with
| true => rfl
| false =>
show tsum (14 * p) (ρ + 14 * i) L + tsum (14 * p) (ρ + 14 * i) L = L.length * (14 * p)
have hlt : ρ + 14 * i < 14 * p := by
have h1 : ρ + 14 * i < 14 + 14 * i := Nat.add_lt_add_right hρ _
have h2 : 14 + 14 * i ≤ 14 * p := by
have : 14 * (i + 1) ≤ 14 * p := Nat.mul_le_mul_left 14 hip
rw [show 14 * (i + 1) = 14 + 14 * i by lib_nat] at this; exact this
exact Nat.lt_of_lt_of_le h1 h2
exact bal_unit _ _ L hb hlt (unit_tr p ρ i j0 hρ14 hp hpr h14 hip hj h0 ((hne_i i).1 e))
have r := sumF_replace (fun i => if Nat.beq i j0 = true then 0 else L.length * (14 * p)) (fun _ => L.length * (14 * p)) j0
(fun k hk => by
show (if Nat.beq k j0 = true then 0 else _) = _
rw [(hne_i k).2 hk]; rfl) p hj
have r' : sumF (fun i => if Nat.beq i j0 = true then 0 else L.length * (14 * p)) p + L.length * (14 * p)
= sumF (fun _ => L.length * (14 * p)) p + (if Nat.beq j0 j0 = true then 0 else L.length * (14 * p)) := r
rw [beq_refl'] at r'
rw [c1, r', sumF_const]; rfl
have sw : sumF (fun i => if Nat.beq i j0 = true then 0 else tsum (14 * p) (ρ + 14 * i) L) p
= gs (fun x => omitR p ρ j0 x) L := by
show _ = gs (fun x => sumF (fun j => if Nat.beq j j0 = true then 0 else ((ρ + 14 * j) * x) % (14 * p)) p) L
rw [← swap]
apply sumF_congr; intro i
rw [tsum_gs, gs_ite]
have hsplit : sumF (fun i => if Nat.beq i j0 = true then 0 else tsum (14 * p) (ρ + 14 * i) L + tsum (14 * p) (ρ + 14 * i) L) p
= sumF (fun i => if Nat.beq i j0 = true then 0 else tsum (14 * p) (ρ + 14 * i) L) p
+ sumF (fun i => if Nat.beq i j0 = true then 0 else tsum (14 * p) (ρ + 14 * i) L) p := by
rw [← sumF_add]; apply sumF_congr; intro i; exact ite_two _ _
rw [hsplit, sw] at E1
exact E1
end CosetBal
#print axioms CosetBal.coset_bal
lean_all/hodge/CosetDev.lean
/-
hodge/CosetDev.lean — T41 cycle 1930 (goal G862c, step 3a): the coset-averaged balance condition as a sum of
per-element deviations in Int. For ρ + 14j₀ = p·y (j₀ < p) and S = Σ_{i<p} i:
dev_unit gcd(c, p) = 1: omitR(c) = 14S + p·(⟨ρc⟩_14 − ⟨yc⟩_14)
dev_div c = p·e: omitR(c) = 14S + p·((p − 1)(⟨ρe⟩_14 − 7))
part_zero L balanced at 14p (coset units of CosetBal) and omitR(x) = 14S + p·f(x) on L ⇒ Σ_{x∈L} f(x) = 0
int_cancel: k > 0, k·z = 0 ⇒ z = 0 (hand proof on the constructors of Int).
Lean 4 core plus hodge/CosetBal, lib/IntRing (lib_int); no axioms.
-/
import hodge.CosetBal
import lib.IntRing
namespace CosetDev
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamIndec3 FamBal CosetAvg CosetUnit CosetBal QFamPrime
theorem int_cancel (k : Nat) (z : Int) (hk : 0 < k) (h : (k : Int) * z = 0) : z = 0 := by
cases k with
| zero => exact absurd hk (Nat.lt_irrefl 0)
| succ k =>
cases z with
| ofNat n =>
cases n with
| zero => rfl
| succ n =>
have h' : Int.ofNat ((k + 1) * (n + 1)) = Int.ofNat 0 := h
have h'' : (k + 1) * (n + 1) = 0 := Int.ofNat.inj h'
rw [show (k + 1) * (n + 1) = ((k + 1) * n + k) + 1 by lib_nat] at h''
exact Nat.noConfusion h''
| negSucc n =>
have h' : Int.negOfNat ((k + 1) * (n + 1)) = Int.ofNat 0 := h
rw [show (k + 1) * (n + 1) = ((k + 1) * n + k) + 1 by lib_nat] at h'
exact Int.noConfusion h'
/-- Int-valued list sum -/
def gsI (f : Nat → Int) : List Nat → Int
| [] => 0
| x :: l => f x + gsI f l
theorem gs_cast (g : Nat → Nat) : ∀ L : List Nat, ((gs g L : Nat) : Int) = gsI (fun x => (g x : Int)) L
| [] => rfl
| x :: L => by
show Int.ofNat (g x + gs g L) = (g x : Int) + gsI (fun x => (g x : Int)) L
rw [← gs_cast g L]; rfl
theorem gsI_affine (g : Nat → Int) (f : Nat → Int) (a b : Int) :
∀ L : List Nat, (∀ x, x ∈ L → g x = a + b * f x) → gsI g L = (L.length : Int) * a + b * gsI f L
| [], _ => by show (0 : Int) = 0 * a + b * 0; lib_int
| x :: L, h => by
show g x + gsI g L = (((L.length + 1 : Nat)) : Int) * a + b * (f x + gsI f L)
rw [h x (List.Mem.head _), gsI_affine g f a b L (fun y hy => h y (List.Mem.tail _ hy))]
show a + b * f x + ((L.length : Int) * a + b * gsI f L) = ((L.length : Int) + 1) * a + b * (f x + gsI f L)
lib_int
theorem sumS (p : Nat) : ((sumF (fun i => i) p : Nat) : Int) + (sumF (fun i => i) p : Nat) + (p : Int) = (p : Int) * p := by
have h := congrArg Int.ofNat (sum_id p)
exact h
theorem dev_unit (p ρ j0 y c : Nat) (hi : j0 < p) (ht : ρ + 14 * j0 = p * y) (hx : Nat.gcd c p = 1) :
(omitR p ρ j0 c : Int) = 14 * (sumF (fun i => i) p : Nat) + (p : Int) * (((ρ * c) % 14 : Nat) - ((y * c) % 14 : Nat)) := by
have h := congrArg Int.ofNat (coset_omit p ρ j0 y c hi ht hx)
have h' : (omitR p ρ j0 c : Int) + (p : Int) * ((y * c) % 14 : Nat)
= (p : Int) * ((ρ * c) % 14 : Nat) + 14 * (sumF (fun i => i) p : Nat) := h
generalize (omitR p ρ j0 c : Int) = O at h' ⊢
generalize (((y * c) % 14 : Nat) : Int) = Y at h' ⊢
generalize (((ρ * c) % 14 : Nat) : Int) = R at h' ⊢
generalize ((sumF (fun i => i) p : Nat) : Int) = S at h' ⊢
calc O = (O + p * Y) - p * Y := by lib_int
_ = (p * R + 14 * S) - p * Y := by rw [h']
_ = _ := by lib_int
theorem dev_div (p ρ j0 e : Nat) (hi : j0 < p) :
(omitR p ρ j0 (p * e) : Int) = 14 * (sumF (fun i => i) p : Nat) + (p : Int) * (((p : Int) - 1) * (((ρ * e) % 14 : Nat) - 7)) := by
have h := congrArg Int.ofNat (coset_omit_div p ρ j0 e hi)
have h' : (omitR p ρ j0 (p * e) : Int) + (p : Int) * ((ρ * e) % 14 : Nat)
= (p : Int) * ((p : Int) * ((ρ * e) % 14 : Nat)) := h
have hS := sumS p
generalize (omitR p ρ j0 (p * e) : Int) = O at h' ⊢
generalize (((ρ * e) % 14 : Nat) : Int) = R at h' ⊢
generalize ((sumF (fun i => i) p : Nat) : Int) = S at hS ⊢
calc O = (O + p * R) - p * R := by lib_int
_ = p * (p * R) - p * R := by rw [h']
_ = 14 * S + p * ((p - 1) * (R - 7)) - 7 * ((S + S + p) - p * p) := by lib_int
_ = 14 * S + p * ((p - 1) * (R - 7)) - 7 * ((p * p) - p * p) := by rw [hS]
_ = _ := by lib_int
/-- **Coset-averaged balance as a sum of deviations.** -/
theorem part_zero (p ρ j0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hρ14 : Nat.gcd ρ 14 = 1) (hρ : ρ < 14) (hj : j0 < p) (h0 : p ∣ ρ + 14 * j0) (L : List Nat)
(hb : bal (14 * p) L = true) (f : Nat → Int)
(hf : ∀ x, x ∈ L → (omitR p ρ j0 x : Int) = 14 * (sumF (fun i => i) p : Nat) + (p : Int) * f x) :
gsI f L = 0 := by
have h := congrArg Int.ofNat (coset_bal p ρ j0 hp hpr h14 hρ14 hρ hj h0 L hb)
have h' : ((gs (fun x => omitR p ρ j0 x) L : Nat) : Int) + ((gs (fun x => omitR p ρ j0 x) L : Nat) : Int)
+ (L.length : Int) * (14 * p) = (p : Int) * ((L.length : Int) * (14 * p)) := h
rw [gs_cast, gsI_affine _ f (14 * (sumF (fun i => i) p : Nat)) (p : Int) L hf] at h'
have hS := sumS p
apply int_cancel (2 * p) _ (Nat.mul_pos (Nat.succ_pos 1) hp)
generalize gsI f L = F at h' ⊢
generalize ((sumF (fun i => i) p : Nat) : Int) = S at h' hS
generalize (L.length : Int) = n at h'
show (2 : Int) * p * F = 0
calc (2 : Int) * p * F
= ((n * (14 * S) + p * F) + (n * (14 * S) + p * F) + n * (14 * p)) - 14 * n * (S + S + p) := by lib_int
_ = p * (n * (14 * p)) - 14 * n * (S + S + p) := by rw [h']
_ = p * (n * (14 * p)) - 14 * n * (p * p) := by rw [hS]
_ = 0 := by lib_int
end CosetDev
#print axioms CosetDev.int_cancel
#print axioms CosetDev.gs_cast
#print axioms CosetDev.gsI_affine
#print axioms CosetDev.sumS
#print axioms CosetDev.dev_unit
#print axioms CosetDev.dev_div
#print axioms CosetDev.part_zero
lean_all/hodge/CosetElim.lean
/-
hodge/CosetElim.lean — T41 cycle 1932 (goal G862c, step 3c): the finite residue tables. With D_ρ = ρ − ⟨ρu⟩_14
(u = x₀ mod 14 ∈ {3, 5}) and a completion element c, the coset conditions for ρ = 1, 3, 5 read
p ∤ c, γ = c mod 14: W·D_ρ + (⟨ργ⟩ − ⟨ρuγ⟩) = 0
c = p·e: W·D_ρ + (p − 1)(⟨ρe⟩ − 7) = 0
Eliminating W between two cosets leaves a condition on γ (resp. e) alone, checked case by case:
elim_unit (W, γ) ∈ {(−1, 1), (0, 0), (0, 7), (1, 13)}
elim_div (W, e) ∈ {(0, 7), (−(p − 1), e₋), (p − 1, e₊)}, (e₋, e₊) = (5, 9) for u = 3, (3, 11) for u = 5
Generated by tools/mk_coset_elim.py. Lean 4 core plus hodge/CosetDev (int_cancel), lib/IntRing; no axioms.
-/
import hodge.CosetDev
namespace CosetElim
open CosetDev
def D (ρ u : Nat) : Int := (ρ : Int) - (((ρ * u) % 14 : Nat) : Int)
def F (ρ u g : Nat) : Int := (((ρ * g) % 14 : Nat) : Int) - (((ρ * u * g) % 14 : Nat) : Int)
def G (ρ e : Nat) : Int := (((ρ * e) % 14 : Nat) : Int) - 7
theorem elim2 (W a b x y : Int) (h1 : W * a + x = 0) (h2 : W * b + y = 0) : b * x - a * y = 0 := by
calc b * x - a * y = b * (W * a + x) - a * (W * b + y) := by lib_int
_ = b * 0 - a * 0 := by rw [h1, h2]
_ = 0 := by lib_int
theorem elim2k (W a b x y : Int) (k : Nat) (hk : 0 < k) (h1 : W * a + (k : Int) * x = 0) (h2 : W * b + (k : Int) * y = 0) :
b * x - a * y = 0 := by
apply int_cancel k _ hk
calc (k : Int) * (b * x - a * y) = b * (W * a + (k : Int) * x) - a * (W * b + (k : Int) * y) := by lib_int
_ = b * 0 - a * 0 := by rw [h1, h2]
_ = 0 := by lib_int
theorem ne_of_dec (a b : Int) (h : decide (a = b) = false) : a ≠ b := by
intro e; rw [e] at h
have : decide (b = b) = true := decide_eq_true rfl
rw [this] at h; exact Bool.noConfusion h
/-- W·a + x = 0 and w₀·a + x = 0 with a·a = k·k, k > 0 give W = w₀ -/
theorem solve (W w0 a x : Int) (k : Nat) (hk : 0 < k) (ha : a * a = (k : Int) * k) (h : W * a + x = 0) (hw : w0 * a + x = 0) :
W = w0 := by
have e : (k * k : Nat) * (W - w0) = 0 := by
show (k : Int) * k * (W - w0) = 0
calc (k : Int) * k * (W - w0) = a * a * (W - w0) := by rw [ha]
_ = a * ((W * a + x) - (w0 * a + x)) := by lib_int
_ = a * (0 - 0) := by rw [h, hw]
_ = 0 := by lib_int
have := int_cancel (k * k) _ (Nat.mul_pos hk hk) e
calc W = (W - w0) + w0 := by lib_int
_ = 0 + w0 := by rw [this]
_ = w0 := by lib_int
theorem solvek (W w0 a x : Int) (k m : Nat) (hk : 0 < k) (ha : a * a = (k : Int) * k)
(h : W * a + (m : Int) * x = 0) (hw : w0 * a + (m : Int) * x = 0) : W = w0 :=
solve W w0 a ((m : Int) * x) k hk ha h hw
theorem lt14 : ∀ g, g < 14 → g = 0 ∨ g = 1 ∨ g = 2 ∨ g = 3 ∨ g = 4 ∨ g = 5 ∨ g = 6 ∨ g = 7 ∨ g = 8 ∨ g = 9 ∨ g = 10 ∨ g = 11 ∨ g = 12 ∨ g = 13
| 0, _ => Or.inl rfl
| 1, _ => Or.inr (Or.inl rfl)
| 2, _ => Or.inr (Or.inr (Or.inl rfl))
| 3, _ => Or.inr (Or.inr (Or.inr (Or.inl rfl)))
| 4, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))
| 5, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl)))))
| 6, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))))
| 7, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl)))))))
| 8, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))))))
| 9, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl)))))))))
| 10, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))))))))
| 11, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl)))))))))))
| 12, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl rfl))))))))))))
| 13, _ => Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inr rfl))))))))))))
| n + 14, h => absurd h (fun h' => Nat.lt_irrefl 14 (Nat.lt_of_le_of_lt (Nat.le_add_left 14 n) h'))
theorem elim_unit3 (g : Nat) (hg : g < 14) (W : Int)
(h1 : W * D 1 3 + F 1 3 g = 0) (h3 : W * D 3 3 + F 3 3 g = 0) (h5 : W * D 5 3 + F 5 3 g = 0) :
(W = -1 ∧ g = 1) ∨ (W = 0 ∧ (g = 0 ∨ g = 7)) ∨ (W = 1 ∧ g = 13) := by
rcases lt14 g hg with h | h | h | h | h | h | h | h | h | h | h | h | h | h <;> subst h
· exact Or.inr (Or.inl ⟨solve W (0) (D 1 3) (F 1 3 0) 2 (Nat.succ_pos 1) rfl h1 rfl, Or.inl rfl⟩)
· exact Or.inl ⟨solve W (-1) (D 1 3) (F 1 3 1) 2 (Nat.succ_pos 1) rfl h1 rfl, rfl⟩
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 2) (F 3 3 2) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 3) (F 3 3 3) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 4) (F 3 3 4) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 5) (F 3 3 5) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 6) (F 3 3 6) h1 h3) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inl ⟨solve W (0) (D 1 3) (F 1 3 7) 2 (Nat.succ_pos 1) rfl h1 rfl, Or.inr rfl⟩)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 8) (F 3 3 8) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 9) (F 3 3 9) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 10) (F 3 3 10) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 11) (F 3 3 11) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 3) (D 3 3) (F 1 3 12) (F 3 3 12) h1 h3) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inr ⟨solve W (1) (D 1 3) (F 1 3 13) 2 (Nat.succ_pos 1) rfl h1 rfl, rfl⟩)
theorem elim_unit5 (g : Nat) (hg : g < 14) (W : Int)
(h1 : W * D 1 5 + F 1 5 g = 0) (h3 : W * D 3 5 + F 3 5 g = 0) (h5 : W * D 5 5 + F 5 5 g = 0) :
(W = -1 ∧ g = 1) ∨ (W = 0 ∧ (g = 0 ∨ g = 7)) ∨ (W = 1 ∧ g = 13) := by
rcases lt14 g hg with h | h | h | h | h | h | h | h | h | h | h | h | h | h <;> subst h
· exact Or.inr (Or.inl ⟨solve W (0) (D 1 5) (F 1 5 0) 4 (Nat.succ_pos 3) rfl h1 rfl, Or.inl rfl⟩)
· exact Or.inl ⟨solve W (-1) (D 1 5) (F 1 5 1) 4 (Nat.succ_pos 3) rfl h1 rfl, rfl⟩
· exact absurd (elim2 W (D 1 5) (D 5 5) (F 1 5 2) (F 5 5 2) h1 h5) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 3 5) (F 1 5 3) (F 3 5 3) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 3 5) (F 1 5 4) (F 3 5 4) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 3 5) (F 1 5 5) (F 3 5 5) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 5 5) (F 1 5 6) (F 5 5 6) h1 h5) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inl ⟨solve W (0) (D 1 5) (F 1 5 7) 4 (Nat.succ_pos 3) rfl h1 rfl, Or.inr rfl⟩)
· exact absurd (elim2 W (D 1 5) (D 5 5) (F 1 5 8) (F 5 5 8) h1 h5) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 3 5) (F 1 5 9) (F 3 5 9) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 3 5) (F 1 5 10) (F 3 5 10) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 3 5) (F 1 5 11) (F 3 5 11) h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2 W (D 1 5) (D 5 5) (F 1 5 12) (F 5 5 12) h1 h5) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inr ⟨solve W (1) (D 1 5) (F 1 5 13) 4 (Nat.succ_pos 3) rfl h1 rfl, rfl⟩)
theorem elim_div3 (e : Nat) (he : e < 14) (W : Int) (k : Nat) (hk : 0 < k)
(h1 : W * D 1 3 + (k : Int) * G 1 e = 0) (h3 : W * D 3 3 + (k : Int) * G 3 e = 0)
(h5 : W * D 5 3 + (k : Int) * G 5 e = 0) :
(W = 0 ∧ e = 7) ∨ (W = -(k : Int) ∧ e = 5) ∨ (W = (k : Int) ∧ e = 9) := by
rcases lt14 e he with h | h | h | h | h | h | h | h | h | h | h | h | h | h <;> subst h
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 0) (G 3 0) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 1) (G 3 1) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 2) (G 3 2) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 3) (G 3 3) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 4) (G 3 4) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inl ⟨solvek W (-(k : Int)) (D 1 3) (G 1 5) 2 k (Nat.succ_pos 1) rfl h1 (by show (-(k : Int)) * (-2) + (k : Int) * (-2) = 0; lib_int), rfl⟩)
· exact absurd (elim2k W (D 1 3) (D 5 3) (G 1 6) (G 5 6) k hk h1 h5) (ne_of_dec _ _ rfl)
· exact Or.inl ⟨solvek W 0 (D 1 3) (G 1 7) 2 k (Nat.succ_pos 1) rfl h1 (by show (0 : Int) * (-2) + (k : Int) * (0) = 0; lib_int), rfl⟩
· exact absurd (elim2k W (D 1 3) (D 5 3) (G 1 8) (G 5 8) k hk h1 h5) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inr ⟨solvek W ((k : Int)) (D 1 3) (G 1 9) 2 k (Nat.succ_pos 1) rfl h1 (by show ((k : Int)) * (-2) + (k : Int) * (2) = 0; lib_int), rfl⟩)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 10) (G 3 10) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 11) (G 3 11) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 12) (G 3 12) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 3) (D 3 3) (G 1 13) (G 3 13) k hk h1 h3) (ne_of_dec _ _ rfl)
theorem elim_div5 (e : Nat) (he : e < 14) (W : Int) (k : Nat) (hk : 0 < k)
(h1 : W * D 1 5 + (k : Int) * G 1 e = 0) (h3 : W * D 3 5 + (k : Int) * G 3 e = 0)
(h5 : W * D 5 5 + (k : Int) * G 5 e = 0) :
(W = 0 ∧ e = 7) ∨ (W = -(k : Int) ∧ e = 3) ∨ (W = (k : Int) ∧ e = 11) := by
rcases lt14 e he with h | h | h | h | h | h | h | h | h | h | h | h | h | h <;> subst h
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 0) (G 3 0) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 1) (G 3 1) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 2) (G 3 2) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inl ⟨solvek W (-(k : Int)) (D 1 5) (G 1 3) 4 k (Nat.succ_pos 3) rfl h1 (by show (-(k : Int)) * (-4) + (k : Int) * (-4) = 0; lib_int), rfl⟩)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 4) (G 3 4) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 5) (G 3 5) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 6) (G 3 6) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact Or.inl ⟨solvek W 0 (D 1 5) (G 1 7) 4 k (Nat.succ_pos 3) rfl h1 (by show (0 : Int) * (-4) + (k : Int) * (0) = 0; lib_int), rfl⟩
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 8) (G 3 8) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 9) (G 3 9) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 10) (G 3 10) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact Or.inr (Or.inr ⟨solvek W ((k : Int)) (D 1 5) (G 1 11) 4 k (Nat.succ_pos 3) rfl h1 (by show ((k : Int)) * (-4) + (k : Int) * (4) = 0; lib_int), rfl⟩)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 12) (G 3 12) k hk h1 h3) (ne_of_dec _ _ rfl)
· exact absurd (elim2k W (D 1 5) (D 3 5) (G 1 13) (G 3 13) k hk h1 h3) (ne_of_dec _ _ rfl)
end CosetElim
#print axioms CosetElim.elim2
#print axioms CosetElim.elim2k
#print axioms CosetElim.ne_of_dec
#print axioms CosetElim.solve
#print axioms CosetElim.solvek
#print axioms CosetElim.lt14
#print axioms CosetElim.elim_unit3
#print axioms CosetElim.elim_unit5
#print axioms CosetElim.elim_div3
#print axioms CosetElim.elim_div5
lean_all/hodge/CosetSize.lean
/-
hodge/CosetSize.lean — T41 cycle 1932 (goal G862c, step 3d): the solutions of CosetElim only occur for parts of
size 1. A part c :: Q of a completed split of F_p ∪ {7p} with n₁ ordinary elements, δ special, η = [7p ∈ Q] has
coset weight W = n₁ − δ(p − 1) and c ≡ −ΣQ ≡ −(n₁ + δ(1 + 6p) + 7pη) (mod 14). For p = 14a + v (v = 5, 3) and each
solution (W, c mod 14) of CosetElim, either the part has n₁ + δ + η ≤ 1 elements besides c, or its complement does
(p ≤ n₁ + δ + η). Lean 4 core plus hodge/CosetDev, lib/IntRing; no axioms.
-/
import hodge.CosetDev
namespace CosetSize
open ModHand
theorem le1 : ∀ x, x ≤ 1 → x = 0 ∨ x = 1
| 0, _ => Or.inl rfl
| 1, _ => Or.inr rfl
| n + 2, h => absurd h (fun h' => Nat.lt_irrefl 1 (Nat.lt_of_lt_of_le (Nat.succ_lt_succ (Nat.succ_pos n)) h'))
theorem mod_ne (x r q : Nat) (hr : r < 14) (hr0 : r ≠ 0) (hx : x = r + q * 14) (h : x % 14 = 0) : False := by
rw [hx, add_mul_mod' r 14 (Nat.succ_pos 13) q, mod_lt' r 14 hr] at h
exact hr0 h
theorem size5 (a n1 δ η g : Nat) (W : Int) (hδ : δ ≤ 1) (hη : η ≤ 1) (hn : n1 + 1 ≤ 14 * a + 5)
(hW : W = (n1 : Int) - (δ : Int) * (14 * (a : Int) + 4))
(hg : (g + n1 + δ * (1 + 6 * (14 * a + 5)) + η * (7 * (14 * a + 5))) % 14 = 0)
(hc : (W = -1 ∧ g = 1) ∨ W = 0 ∨ (W = 1 ∧ g = 13) ∨ (W = -(14 * (a : Int) + 4) ∧ g = 11)
∨ (W = 14 * (a : Int) + 4 ∧ g = 3)) :
n1 + δ + η ≤ 1 ∨ 14 * a + 5 ≤ n1 + δ + η := by
rcases le1 δ hδ with hd | hd <;> rcases le1 η hη with he | he <;> subst hd he
all_goals (try rw [show ((0 : Nat) : Int) = 0 from rfl] at hW)
all_goals (try rw [show ((1 : Nat) : Int) = 1 from rfl] at hW)
all_goals rcases hc with ⟨h1, h2⟩ | h1 | ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩
· have e : (n1 : Int) = -1 := by rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]; lib_int
exact Int.noConfusion e
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 0 + 0 + 0 ≤ 1; exact Nat.zero_le 1)
· have e : (n1 : Int) = ((1 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((1) : Nat) : Int)
rw [show (((1) : Nat) : Int) = 1 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 1 + 0 + 0 ≤ 1; exact Nat.le_refl 1)
· have e : ((n1 + 14 * a + 4 : Nat) : Int) = 0 := by
show (n1 : Int) + 14 * (a : Int) + 4 = 0
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]; lib_int
have e' := Int.ofNat.inj e
rw [show n1 + 14 * a + 4 = (n1 + 14 * a + 3) + 1 by lib_nat] at e'
exact Nat.noConfusion e'
· have e : (n1 : Int) = ((14 * a + 4 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 4) : Nat) : Int)
rw [show (((14 * a + 4) : Nat) : Int) = 14 * (a : Int) + 4 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (0 + 1 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : (n1 : Int) = -1 := by rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]; lib_int
exact Int.noConfusion e
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 0 + 0 + 1 ≤ 1; exact Nat.le_refl 1)
· have e : (n1 : Int) = ((1 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((1) : Nat) : Int)
rw [show (((1) : Nat) : Int) = 1 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (3 + 7 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : ((n1 + 14 * a + 4 : Nat) : Int) = 0 := by
show (n1 : Int) + 14 * (a : Int) + 4 = 0
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]; lib_int
have e' := Int.ofNat.inj e
rw [show n1 + 14 * a + 4 = (n1 + 14 * a + 3) + 1 by lib_nat] at e'
exact Nat.noConfusion e'
· have e : (n1 : Int) = ((14 * a + 4 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 4) : Nat) : Int)
rw [show (((14 * a + 4) : Nat) : Int) = 14 * (a : Int) + 4 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 0) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 3 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 3) : Nat) : Int)
rw [show (((14 * a + 3) : Nat) : Int) = 14 * (a : Int) + 3 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (2 + 7 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : (n1 : Int) = ((14 * a + 4 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 4) : Nat) : Int)
rw [show (((14 * a + 4) : Nat) : Int) = 14 * (a : Int) + 4 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 0) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 5 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 5) : Nat) : Int)
rw [show (((14 * a + 5) : Nat) : Int) = 14 * (a : Int) + 5 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hn)
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 0 + 1 + 0 ≤ 1; exact Nat.le_refl 1)
· have e : (n1 : Int) = ((28 * a + 8 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((28 * a + 8) : Nat) : Int)
rw [show (((28 * a + 8) : Nat) : Int) = 28 * (a : Int) + 8 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.le.intro (k := 14 * a + 3) (by lib_nat) : 14 * a + 5 < 28 * a + 8 + 1) hn)
· have e : (n1 : Int) = ((14 * a + 3 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 3) : Nat) : Int)
rw [show (((14 * a + 3) : Nat) : Int) = 14 * (a : Int) + 3 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 0) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 4 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 4) : Nat) : Int)
rw [show (((14 * a + 4) : Nat) : Int) = 14 * (a : Int) + 4 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 1) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 5 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 5) : Nat) : Int)
rw [show (((14 * a + 5) : Nat) : Int) = 14 * (a : Int) + 5 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hn)
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (5 + 13 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : (n1 : Int) = ((28 * a + 8 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 4) by rw [hW]; lib_int, h1]
show _ = (((28 * a + 8) : Nat) : Int)
rw [show (((28 * a + 8) : Nat) : Int) = 28 * (a : Int) + 8 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.le.intro (k := 14 * a + 3) (by lib_nat) : 14 * a + 5 < 28 * a + 8 + 1) hn)
theorem size3 (a n1 δ η g : Nat) (W : Int) (hδ : δ ≤ 1) (hη : η ≤ 1) (hn : n1 + 1 ≤ 14 * a + 3)
(hW : W = (n1 : Int) - (δ : Int) * (14 * (a : Int) + 2))
(hg : (g + n1 + δ * (1 + 6 * (14 * a + 3)) + η * (7 * (14 * a + 3))) % 14 = 0)
(hc : (W = -1 ∧ g = 1) ∨ W = 0 ∨ (W = 1 ∧ g = 13) ∨ (W = -(14 * (a : Int) + 2) ∧ g = 9)
∨ (W = 14 * (a : Int) + 2 ∧ g = 5)) :
n1 + δ + η ≤ 1 ∨ 14 * a + 3 ≤ n1 + δ + η := by
rcases le1 δ hδ with hd | hd <;> rcases le1 η hη with he | he <;> subst hd he
all_goals (try rw [show ((0 : Nat) : Int) = 0 from rfl] at hW)
all_goals (try rw [show ((1 : Nat) : Int) = 1 from rfl] at hW)
all_goals rcases hc with ⟨h1, h2⟩ | h1 | ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩
· have e : (n1 : Int) = -1 := by rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]; lib_int
exact Int.noConfusion e
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 0 + 0 + 0 ≤ 1; exact Nat.zero_le 1)
· have e : (n1 : Int) = ((1 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((1) : Nat) : Int)
rw [show (((1) : Nat) : Int) = 1 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 1 + 0 + 0 ≤ 1; exact Nat.le_refl 1)
· have e : ((n1 + 14 * a + 2 : Nat) : Int) = 0 := by
show (n1 : Int) + 14 * (a : Int) + 2 = 0
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]; lib_int
have e' := Int.ofNat.inj e
rw [show n1 + 14 * a + 2 = (n1 + 14 * a + 1) + 1 by lib_nat] at e'
exact Nat.noConfusion e'
· have e : (n1 : Int) = ((14 * a + 2 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 2) : Nat) : Int)
rw [show (((14 * a + 2) : Nat) : Int) = 14 * (a : Int) + 2 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (0 + 1 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : (n1 : Int) = -1 := by rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]; lib_int
exact Int.noConfusion e
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 0 + 0 + 1 ≤ 1; exact Nat.le_refl 1)
· have e : (n1 : Int) = ((1 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((1) : Nat) : Int)
rw [show (((1) : Nat) : Int) = 1 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (2 + 7 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : ((n1 + 14 * a + 2 : Nat) : Int) = 0 := by
show (n1 : Int) + 14 * (a : Int) + 2 = 0
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]; lib_int
have e' := Int.ofNat.inj e
rw [show n1 + 14 * a + 2 = (n1 + 14 * a + 1) + 1 by lib_nat] at e'
exact Nat.noConfusion e'
· have e : (n1 : Int) = ((14 * a + 2 : Nat) : Int) := by
rw [show (n1 : Int) = W + 0 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 2) : Nat) : Int)
rw [show (((14 * a + 2) : Nat) : Int) = 14 * (a : Int) + 2 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 0) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 1 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 1) : Nat) : Int)
rw [show (((14 * a + 1) : Nat) : Int) = 14 * (a : Int) + 1 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (1 + 7 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : (n1 : Int) = ((14 * a + 2 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 2) : Nat) : Int)
rw [show (((14 * a + 2) : Nat) : Int) = 14 * (a : Int) + 2 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 0) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 3 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 3) : Nat) : Int)
rw [show (((14 * a + 3) : Nat) : Int) = 14 * (a : Int) + 3 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hn)
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inl (by show 0 + 1 + 0 ≤ 1; exact Nat.le_refl 1)
· have e : (n1 : Int) = ((28 * a + 4 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((28 * a + 4) : Nat) : Int)
rw [show (((28 * a + 4) : Nat) : Int) = 28 * (a : Int) + 4 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.le.intro (k := 14 * a + 1) (by lib_nat) : 14 * a + 3 < 28 * a + 4 + 1) hn)
· have e : (n1 : Int) = ((14 * a + 1 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 1) : Nat) : Int)
rw [show (((14 * a + 1) : Nat) : Int) = 14 * (a : Int) + 1 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 0) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 2 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 2) : Nat) : Int)
rw [show (((14 * a + 2) : Nat) : Int) = 14 * (a : Int) + 2 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exact Or.inr (Nat.le.intro (k := 1) (by lib_nat))
· have e : (n1 : Int) = ((14 * a + 3 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((14 * a + 3) : Nat) : Int)
rw [show (((14 * a + 3) : Nat) : Int) = 14 * (a : Int) + 3 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.lt_succ_self _) hn)
· have e : (n1 : Int) = ((0 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((0) : Nat) : Int)
rw [show (((0) : Nat) : Int) = 0 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
subst h2
exact mod_ne _ 7 (3 + 13 * a) (Nat.le.intro (k := 6) rfl) (by intro h; exact Nat.noConfusion h) (by lib_nat) hg
· have e : (n1 : Int) = ((28 * a + 4 : Nat) : Int) := by
rw [show (n1 : Int) = W + 1 * (14 * (a : Int) + 2) by rw [hW]; lib_int, h1]
show _ = (((28 * a + 4) : Nat) : Int)
rw [show (((28 * a + 4) : Nat) : Int) = 28 * (a : Int) + 4 from rfl]; lib_int
have hn1 := Int.ofNat.inj e
subst hn1
exfalso
exact Nat.lt_irrefl _ (Nat.lt_of_lt_of_le (Nat.le.intro (k := 14 * a + 1) (by lib_nat) : 14 * a + 3 < 28 * a + 4 + 1) hn)
end CosetSize
#print axioms CosetSize.le1
#print axioms CosetSize.mod_ne
#print axioms CosetSize.size5
#print axioms CosetSize.size3
lean_all/hodge/CosetSplitA.lean
/-
hodge/CosetSplitA.lean — T41 cycle 1932 (goal G862c, step 3e, part A): the halved doubled character
Fq = 7p :: F_p (F_p = FamBal.fam p i₀, p = 14a + v, v ∈ {3, 5}) and its three kinds of elements:
ordinary 1 + 14k (residue 1 mod 14), special s* = 1 + 14i₀ + 6p (residue 5 or 3), and 7p (residue 7).
io, isp, ih indicators of the three kinds (io + isp + ih = 1 everywhere)
fq_totals over Fq: Σ io + 1 = p, Σ isp = 1, Σ ih = 1
split_counts for (A, B) ∈ splits Fq: the counts add up as above, and |A| = Σ_A io + Σ_A isp + Σ_A ih
sum_decomp for A ⊆ Fq: Σ_A x = n₁ + δ(1 + 6p) + η·7p + 14K
Lean 4 core plus hodge/FamIndec3, hodge/Q4Conv (splits_props); no axioms.
-/
import hodge.FamIndec3
import hodge.Q4Conv
namespace CosetSplitA
open GcdHand ModHand OrbitSum PermSum FamMod FamArith Indecomp FamIndec3 FamBal QFamPrime
def sst (p i0 : Nat) : Nat := 1 + 14 * i0 + 6 * p
def ih (p x : Nat) : Nat := if Nat.beq x (7 * p) then 1 else 0
def isp (p i0 x : Nat) : Nat := if Nat.beq x (7 * p) then 0 else if Nat.beq x (sst p i0) then 1 else 0
def io (p i0 x : Nat) : Nat := if Nat.beq x (7 * p) then 0 else if Nat.beq x (sst p i0) then 0 else 1
def Fq (p i0 : Nat) : List Nat := 7 * p :: fam p i0
theorem res_of (x r q : Nat) (hr : r < 14) (h : x = r + q * 14) : x % 14 = r := by
rw [h, add_mul_mod' r 14 (Nat.succ_pos 13) q, mod_lt' r 14 hr]
theorem beq_false_res (x y : Nat) (h : x % 14 ≠ y % 14) : Nat.beq x y = false := by
cases e : Nat.beq x y with
| false => rfl
| true => exact absurd (by rw [Nat.eq_of_beq_eq_true e]) h
theorem res_ord (k : Nat) : (1 + 14 * k) % 14 = 1 := res_of _ 1 k (Nat.succ_lt_succ (Nat.succ_pos 12)) (by lib_nat)
theorem res_half (a v : Nat) (hv : v = 3 ∨ v = 5) : (7 * (14 * a + v)) % 14 = 7 := by
rcases hv with h | h <;> subst h
· exact res_of _ 7 (1 + 7 * a) (Nat.le.intro (k := 6) rfl) (by lib_nat)
· exact res_of _ 7 (2 + 7 * a) (Nat.le.intro (k := 6) rfl) (by lib_nat)
/-- the residue of s* is 5 (v = 3) or 3 (v = 5): neither 1 nor 7 -/
theorem res_sst (a v i0 : Nat) (hv : v = 3 ∨ v = 5) :
(sst (14 * a + v) i0) % 14 ≠ 1 ∧ (sst (14 * a + v) i0) % 14 ≠ 7 := by
rcases hv with h | h <;> subst h
· rw [res_of _ 5 (1 + i0 + 6 * a) (Nat.le.intro (k := 8) rfl) (by unfold sst; lib_nat)]
exact ⟨fun e => Nat.noConfusion (Nat.succ.inj e), fun e => by
have e' : (5 : Nat) = 7 := e
exact Nat.noConfusion (Nat.succ.inj (Nat.succ.inj (Nat.succ.inj (Nat.succ.inj (Nat.succ.inj e')))))⟩
· rw [res_of _ 3 (2 + i0 + 6 * a) (Nat.le.intro (k := 10) rfl) (by unfold sst; lib_nat)]
exact ⟨fun e => Nat.noConfusion (Nat.succ.inj e), fun e => by
have e' : (3 : Nat) = 7 := e
exact Nat.noConfusion (Nat.succ.inj (Nat.succ.inj (Nat.succ.inj e')))⟩
theorem one_ne_seven : (1 : Nat) ≠ 7 := fun e => Nat.noConfusion (Nat.succ.inj e)
/-- the kinds of the three element types -/
theorem kind_ord (a v i0 k : Nat) (hv : v = 3 ∨ v = 5) :
io (14 * a + v) i0 (1 + 14 * k) = 1 ∧ isp (14 * a + v) i0 (1 + 14 * k) = 0 ∧ ih (14 * a + v) (1 + 14 * k) = 0 := by
have h7 : Nat.beq (1 + 14 * k) (7 * (14 * a + v)) = false := by
apply beq_false_res; rw [res_ord, res_half a v hv]; exact one_ne_seven
have hs : Nat.beq (1 + 14 * k) (sst (14 * a + v) i0) = false := by
apply beq_false_res; rw [res_ord]; exact fun e => (res_sst a v i0 hv).1 e.symm
unfold io isp ih; rw [h7, hs]; exact ⟨rfl, rfl, rfl⟩
theorem kind_sst (a v i0 : Nat) (hv : v = 3 ∨ v = 5) :
io (14 * a + v) i0 (sst (14 * a + v) i0) = 0 ∧ isp (14 * a + v) i0 (sst (14 * a + v) i0) = 1
∧ ih (14 * a + v) (sst (14 * a + v) i0) = 0 := by
have h7 : Nat.beq (sst (14 * a + v) i0) (7 * (14 * a + v)) = false := by
apply beq_false_res; rw [res_half a v hv]; exact (res_sst a v i0 hv).2
unfold io isp ih; rw [h7, beq_refl']; exact ⟨rfl, rfl, rfl⟩
theorem kind_half (a v i0 : Nat) :
io (14 * a + v) i0 (7 * (14 * a + v)) = 0 ∧ isp (14 * a + v) i0 (7 * (14 * a + v)) = 0
∧ ih (14 * a + v) (7 * (14 * a + v)) = 1 := by
unfold io isp ih; rw [beq_refl']; exact ⟨rfl, rfl, rfl⟩
theorem kind_sum (p i0 x : Nat) : io p i0 x + isp p i0 x + ih p x = 1 := by
unfold io isp ih
cases Nat.beq x (7 * p) <;> cases Nat.beq x (sst p i0) <;> rfl
/-- the elements of F_p -/
theorem fam_kind (p i0 x : Nat) (hx : x ∈ fam p i0) : x = sst p i0 ∨ ∃ k, k < p ∧ k ≠ i0 ∧ x = 1 + 14 * k := by
have ⟨k, hk, ek⟩ := gl_mem _ p x hx
cases e : Nat.beq k i0 with
| true =>
have ek0 := Nat.eq_of_beq_eq_true e
left; rw [← ek]
show (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = _
rw [e, ek0]; rfl
| false =>
right; refine ⟨k, hk, (fun h => by rw [h, beq_refl'] at e; exact nomatch e), ?_⟩
rw [← ek]
show (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = _
rw [e]; rfl
theorem gs_add3 (f g h : Nat → Nat) : ∀ L : List Nat, gs f L + gs g L + gs h L = gs (fun x => f x + g x + h x) L
| [] => rfl
| x :: L => by
show (f x + gs f L) + (g x + gs g L) + (h x + gs h L) = (f x + g x + h x) + gs (fun x => f x + g x + h x) L
rw [← gs_add3 f g h L]; lib_nat
theorem gs_one : ∀ L : List Nat, gs (fun _ => 1) L = L.length
| [] => rfl
| _ :: L => by show 1 + gs (fun _ => 1) L = L.length + 1; rw [gs_one L]; lib_nat
theorem gs_congr' (f g : Nat → Nat) (h : ∀ x, f x = g x) : ∀ L : List Nat, gs f L = gs g L
| [] => rfl
| x :: L => by show f x + gs f L = g x + gs g L; rw [h x, gs_congr' f g h L]
/-- |A| = n₁ + δ + η -/
theorem len_counts (p i0 : Nat) (L : List Nat) : gs (io p i0) L + gs (isp p i0) L + gs (ih p) L = L.length := by
rw [gs_add3, ← gs_one L]
exact gs_congr' _ _ (fun x => kind_sum p i0 x) L
theorem sumF_const' (C : Nat) : ∀ n, sumF (fun _ => C) n = n * C
| 0 => by show 0 = 0 * C; lib_nat
| n + 1 => by show sumF (fun _ => C) n + C = (n + 1) * C; rw [sumF_const' C n]; lib_nat
theorem sum_ite (α β i0 p : Nat) (hi : i0 < p) :
sumF (fun k => if Nat.beq k i0 = true then α else β) p + β = p * β + α := by
have r := sumF_replace (fun k => if Nat.beq k i0 = true then α else β) (fun _ => β) i0 (fun k hk => by
cases e : Nat.beq k i0 with
| true => exact absurd (Nat.eq_of_beq_eq_true e) hk
| false => rfl) p hi
have r' : sumF (fun k => if Nat.beq k i0 = true then α else β) p + β
= sumF (fun _ => β) p + (if Nat.beq i0 i0 = true then α else β) := r
rw [beq_refl', sumF_const'] at r'
exact r'
/-- an indicator g composed with the family generator is α at i₀ and β elsewhere -/
theorem fam_ind (a v i0 : Nat) (g : Nat → Nat) (α β : Nat) (hs : g (sst (14 * a + v) i0) = α)
(ho : ∀ k, g (1 + 14 * k) = β) (hi : i0 < 14 * a + v) :
gs g (fam (14 * a + v) i0) + β = (14 * a + v) * β + α := by
unfold fam
rw [gl_gs]
have e : ∀ k, k < 14 * a + v → g ((fun k => if Nat.beq k i0 then 1 + 14 * k + 6 * (14 * a + v) else 1 + 14 * k) k)
= (if Nat.beq k i0 = true then α else β) := by
intro k _
cases eb : Nat.beq k i0 with
| true =>
have ek := Nat.eq_of_beq_eq_true eb
subst ek
show g (if Nat.beq k k = true then 1 + 14 * k + 6 * (14 * a + v) else 1 + 14 * k) = _
rw [eb]; exact hs
| false =>
show g (if Nat.beq k i0 = true then 1 + 14 * k + 6 * (14 * a + v) else 1 + 14 * k) = _
rw [eb]; exact ho k
rw [sumF_congr_lt _ _ _ e]
exact sum_ite α β i0 _ hi
theorem tot_ih (a v i0 : Nat) (hv : v = 3 ∨ v = 5) (hi : i0 < 14 * a + v) :
gs (ih (14 * a + v)) (Fq (14 * a + v) i0) = 1 := by
have h := fam_ind a v i0 (ih (14 * a + v)) 0 0 (kind_sst a v i0 hv).2.2 (fun k => (kind_ord a v i0 k hv).2.2) hi
show ih (14 * a + v) (7 * (14 * a + v)) + gs (ih (14 * a + v)) (fam (14 * a + v) i0) = 1
rw [(kind_half a v i0).2.2]
rw [show (14 * a + v) * 0 + 0 = 0 by lib_nat] at h
rw [show gs (ih (14 * a + v)) (fam (14 * a + v) i0) = 0 from h]
theorem tot_isp (a v i0 : Nat) (hv : v = 3 ∨ v = 5) (hi : i0 < 14 * a + v) :
gs (isp (14 * a + v) i0) (Fq (14 * a + v) i0) = 1 := by
have h := fam_ind a v i0 (isp (14 * a + v) i0) 1 0 (kind_sst a v i0 hv).2.1 (fun k => (kind_ord a v i0 k hv).2.1) hi
show isp (14 * a + v) i0 (7 * (14 * a + v)) + gs (isp (14 * a + v) i0) (fam (14 * a + v) i0) = 1
rw [(kind_half a v i0).2.1]
rw [show (14 * a + v) * 0 + 1 = 1 by lib_nat] at h
rw [show gs (isp (14 * a + v) i0) (fam (14 * a + v) i0) = 1 from h]
theorem tot_io (a v i0 : Nat) (hv : v = 3 ∨ v = 5) (hi : i0 < 14 * a + v) :
gs (io (14 * a + v) i0) (Fq (14 * a + v) i0) + 1 = 14 * a + v := by
have h := fam_ind a v i0 (io (14 * a + v) i0) 0 1 (kind_sst a v i0 hv).1 (fun k => (kind_ord a v i0 k hv).1) hi
show io (14 * a + v) i0 (7 * (14 * a + v)) + gs (io (14 * a + v) i0) (fam (14 * a + v) i0) + 1 = 14 * a + v
rw [(kind_half a v i0).1]
rw [show (14 * a + v) * 1 + 0 = 14 * a + v by lib_nat] at h
rw [show 0 + gs (io (14 * a + v) i0) (fam (14 * a + v) i0) + 1 = gs (io (14 * a + v) i0) (fam (14 * a + v) i0) + 1 by lib_nat]
exact h
/-- Σ_A x = n₁ + δ(1 + 6p) + η·7p + 14K for A ⊆ Fq -/
theorem sum_decomp (a v i0 : Nat) (hv : v = 3 ∨ v = 5) : ∀ A : List Nat, (∀ x, x ∈ A → x ∈ Fq (14 * a + v) i0) →
∃ K, gs (fun x => x) A = gs (io (14 * a + v) i0) A + gs (isp (14 * a + v) i0) A * (1 + 6 * (14 * a + v))
+ gs (ih (14 * a + v)) A * (7 * (14 * a + v)) + 14 * K
| [], _ => ⟨0, by show 0 = 0 + 0 * _ + 0 * _ + 14 * 0; lib_nat⟩
| x :: A, hA => by
have ⟨K, hK⟩ := sum_decomp a v i0 hv A (fun y hy => hA y (List.Mem.tail _ hy))
have hx : x ∈ 7 * (14 * a + v) :: fam (14 * a + v) i0 := hA x (List.Mem.head _)
show ∃ K', x + gs (fun x => x) A = (io (14 * a + v) i0 x + gs (io (14 * a + v) i0) A)
+ (isp (14 * a + v) i0 x + gs (isp (14 * a + v) i0) A) * (1 + 6 * (14 * a + v))
+ (ih (14 * a + v) x + gs (ih (14 * a + v)) A) * (7 * (14 * a + v)) + 14 * K'
rw [hK]
cases hx with
| head =>
have ⟨e1, e2, e3⟩ := kind_half a v i0
rw [e1, e2, e3]; exact ⟨K, by lib_nat⟩
| tail _ hf =>
rcases fam_kind _ i0 x hf with e | ⟨k, _, _, e⟩
· subst e
have ⟨e1, e2, e3⟩ := kind_sst a v i0 hv
rw [e1, e2, e3]; exact ⟨K + i0, by unfold sst; lib_nat⟩
· subst e
have ⟨e1, e2, e3⟩ := kind_ord a v i0 k hv
rw [e1, e2, e3]; exact ⟨K + k, by lib_nat⟩
end CosetSplitA
#print axioms CosetSplitA.res_of
#print axioms CosetSplitA.beq_false_res
#print axioms CosetSplitA.res_ord
#print axioms CosetSplitA.res_half
#print axioms CosetSplitA.res_sst
#print axioms CosetSplitA.kind_ord
#print axioms CosetSplitA.kind_sst
#print axioms CosetSplitA.kind_half
#print axioms CosetSplitA.kind_sum
#print axioms CosetSplitA.fam_kind
#print axioms CosetSplitA.gs_add3
#print axioms CosetSplitA.gs_one
#print axioms CosetSplitA.gs_congr'
#print axioms CosetSplitA.len_counts
#print axioms CosetSplitA.sumF_const'
#print axioms CosetSplitA.sum_ite
#print axioms CosetSplitA.fam_ind
#print axioms CosetSplitA.tot_ih
#print axioms CosetSplitA.tot_isp
#print axioms CosetSplitA.tot_io
#print axioms CosetSplitA.sum_decomp
lean_all/hodge/CosetSplitB.lean
/-
hodge/CosetSplitB.lean — T41 cycle 1932 (goal G862c, step 3e, part B): on a part c :: A of a completed split of
Fq = 7p :: F_p (p = 14a + v), balanced at 14p, the coset ρ condition reads
W·D_ρ + f_ρ(c) = 0, W = n₁ − δ(p − 1), D_ρ = ρ − ⟨ρx₀⟩_14,
where omitR(c) = 14S + p·f_ρ(c) (CosetDev) and n₁, δ are the counts of ordinary and special elements of A
(CosetSplitA). Lean 4 core plus hodge/CosetWeight, hodge/CosetSplitA; no axioms.
-/
import hodge.CosetWeight
import hodge.CosetSplitA
namespace CosetSplitB
open GcdHand ModHand OrbitSum PermSum FamMod FamArith Indecomp FamIndec2 FamIndec3 FamBal QFamPrime CosetAvg CosetBal
CosetDev CosetWeight CosetSplitA
/-- part_zero with the sum of omitR given directly -/
theorem part_zero' (p ρ j0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hρ14 : Nat.gcd ρ 14 = 1) (hρ : ρ < 14) (hj : j0 < p) (h0 : p ∣ ρ + 14 * j0) (L : List Nat)
(hb : bal (14 * p) L = true) (T : Int)
(hT : gsI (fun x => (omitR p ρ j0 x : Int)) L = (L.length : Int) * (14 * (sumF (fun i => i) p : Nat)) + (p : Int) * T) :
T = 0 := by
have h := congrArg Int.ofNat (coset_bal p ρ j0 hp hpr h14 hρ14 hρ hj h0 L hb)
have h' : ((gs (fun x => omitR p ρ j0 x) L : Nat) : Int) + ((gs (fun x => omitR p ρ j0 x) L : Nat) : Int)
+ (L.length : Int) * (14 * p) = (p : Int) * ((L.length : Int) * (14 * p)) := h
rw [gs_cast, hT] at h'
have hS := sumS p
apply int_cancel (2 * p) _ (Nat.mul_pos (Nat.succ_pos 1) hp)
generalize ((sumF (fun i => i) p : Nat) : Int) = S at h' hS
generalize (L.length : Int) = n at h'
show (2 : Int) * p * T = 0
calc (2 : Int) * p * T
= ((n * (14 * S) + p * T) + (n * (14 * S) + p * T) + n * (14 * p)) - 14 * n * (S + S + p) := by lib_int
_ = p * (n * (14 * p)) - 14 * n * (S + S + p) := by rw [h']
_ = p * (n * (14 * p)) - 14 * n * (p * p) := by rw [hS]
_ = 0 := by lib_int
/-- the coset weight of an element: 1 (ordinary), −(p − 1) (special), 0 (7p) -/
def wI (p i0 x : Nat) : Int := (io p i0 x : Int) - (isp p i0 x : Int) * ((p : Int) - 1)
theorem gsI_wI (p i0 : Nat) : ∀ A : List Nat,
gsI (wI p i0) A = (gs (io p i0) A : Int) - (gs (isp p i0) A : Int) * ((p : Int) - 1)
| [] => by show (0 : Int) = ((0 : Nat) : Int) - ((0 : Nat) : Int) * _; show (0 : Int) = 0 - 0 * _; lib_int
| x :: A => by
show wI p i0 x + gsI (wI p i0) A = ((io p i0 x + gs (io p i0) A : Nat) : Int)
- ((isp p i0 x + gs (isp p i0) A : Nat) : Int) * ((p : Int) - 1)
rw [gsI_wI p i0 A]
show (io p i0 x : Int) - (isp p i0 x : Int) * ((p : Int) - 1)
+ ((gs (io p i0) A : Int) - (gs (isp p i0) A : Int) * ((p : Int) - 1))
= ((io p i0 x : Int) + (gs (io p i0) A : Int)) - ((isp p i0 x : Int) + (gs (isp p i0) A : Int)) * ((p : Int) - 1)
lib_int
/-- every element of Fq has omitR = 14S + p·(w·D_ρ) -/
theorem elem_dev (a v i0 x0 ρ j0 y : Nat) (hv : v = 3 ∨ v = 5) (hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v)
(h14 : Nat.gcd 14 (14 * a + v) = 1) (hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(hρ : ρ < 14) (hj : j0 < 14 * a + v) (ht : ρ + 14 * j0 = (14 * a + v) * y)
(hT : (((ρ * (x0 + 6)) % 14 : Nat) : Int) - 7 = (((ρ * x0) % 14 : Nat) : Int) - ρ) (hT7 : (ρ * 7) % 14 = 7)
(x : Nat) (hxF : x ∈ Fq (14 * a + v) i0) :
(omitR (14 * a + v) ρ j0 x : Int) = 14 * (sumF (fun i => i) (14 * a + v) : Nat)
+ ((14 * a + v : Nat) : Int) * (wI (14 * a + v) i0 x * ((ρ : Int) - ((ρ * x0) % 14 : Nat))) := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have h0 : (14 * a + v) ∣ 1 + 14 * i0 := ⟨x0, hx⟩
have hx' : x ∈ 7 * (14 * a + v) :: fam (14 * a + v) i0 := hxF
cases hx' with
| head =>
have ⟨e1, e2, _⟩ := kind_half a v i0
unfold wI; rw [e1, e2, show 7 * (14 * a + v) = (14 * a + v) * 7 by lib_nat, f_half _ ρ j0 hj hT7]
show _ = _ + ((14 * a + v : Nat) : Int) * ((((0 : Nat) : Int) - ((0 : Nat) : Int) * _) * _)
show _ = _ + ((14 * a + v : Nat) : Int) * (((0 : Int) - 0 * _) * _)
lib_int
| tail _ hf =>
rcases fam_kind _ i0 x hf with e | ⟨k, hk, hk0, e⟩
· subst e
have ⟨e1, e2, _⟩ := kind_sst a v i0 hv
unfold wI; rw [e1, e2]
rw [show sst (14 * a + v) i0 = (14 * a + v) * (x0 + 6) by unfold sst; rw [show 1 + 14 * i0 + 6 * (14 * a + v) = (1 + 14 * i0) + 6 * (14 * a + v) by lib_nat, hx]; lib_nat]
rw [f_spec _ ρ j0 x0 hj hT]
show _ = _ + ((14 * a + v : Nat) : Int) * (((0 : Int) - 1 * _) * _)
lib_int
· subst e
have ⟨e1, e2, _⟩ := kind_ord a v i0 k hv
unfold wI; rw [e1, e2]
rw [f_ord _ ρ j0 y i0 x0 k hρ hj ht hx (cop_coset _ k i0 hp hpr h14 hk hi h0 hk0)]
show _ = _ + ((14 * a + v : Nat) : Int) * (((1 : Int) - 0 * _) * _)
lib_int
/-- **The coset ρ condition of a part c :: A.** -/
theorem part_eq (a v i0 x0 ρ j0 y : Nat) (hv : v = 3 ∨ v = 5) (hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v)
(h14 : Nat.gcd 14 (14 * a + v) = 1) (hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(hρ14 : Nat.gcd ρ 14 = 1) (hρ : ρ < 14) (hj : j0 < 14 * a + v) (ht : ρ + 14 * j0 = (14 * a + v) * y)
(hT : (((ρ * (x0 + 6)) % 14 : Nat) : Int) - 7 = (((ρ * x0) % 14 : Nat) : Int) - ρ) (hT7 : (ρ * 7) % 14 = 7)
(A : List Nat) (hA : ∀ x, x ∈ A → x ∈ Fq (14 * a + v) i0) (c : Nat) (fc : Int)
(hc : (omitR (14 * a + v) ρ j0 c : Int) = 14 * (sumF (fun i => i) (14 * a + v) : Nat) + ((14 * a + v : Nat) : Int) * fc)
(hb : bal (14 * (14 * a + v)) (c :: A) = true) :
((gs (io (14 * a + v) i0) A : Int) - (gs (isp (14 * a + v) i0) A : Int) * (((14 * a + v : Nat) : Int) - 1))
* ((ρ : Int) - ((ρ * x0) % 14 : Nat)) + fc = 0 := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have h0j : (14 * a + v) ∣ ρ + 14 * j0 := ⟨y, ht⟩
have hsumA := gsI_affine (fun x => (omitR (14 * a + v) ρ j0 x : Int))
(fun x => wI (14 * a + v) i0 x * ((ρ : Int) - ((ρ * x0) % 14 : Nat)))
(14 * (sumF (fun i => i) (14 * a + v) : Nat)) ((14 * a + v : Nat) : Int) A
(fun x hxA => elem_dev a v i0 x0 ρ j0 y hv hpr h14 hi hx hρ hj ht hT hT7 x (hA x hxA))
have hW := gsI_affine (fun x => wI (14 * a + v) i0 x * ((ρ : Int) - ((ρ * x0) % 14 : Nat)))
(wI (14 * a + v) i0) 0 ((ρ : Int) - ((ρ * x0) % 14 : Nat)) A (fun x _ => by lib_int)
rw [gsI_wI] at hW
have key := part_zero' (14 * a + v) ρ j0 hp hpr h14 hρ14 hρ hj h0j (c :: A) hb
(fc + ((gs (io (14 * a + v) i0) A : Int) - (gs (isp (14 * a + v) i0) A : Int) * (((14 * a + v : Nat) : Int) - 1))
* ((ρ : Int) - ((ρ * x0) % 14 : Nat)))
(by
show (omitR (14 * a + v) ρ j0 c : Int) + gsI (fun x => (omitR (14 * a + v) ρ j0 x : Int)) A = _
rw [hc, hsumA, hW]
show _ = ((A.length + 1 : Nat) : Int) * _ + _
show _ = ((A.length : Int) + 1) * _ + _
lib_int)
calc _ = fc + ((gs (io (14 * a + v) i0) A : Int) - (gs (isp (14 * a + v) i0) A : Int) * (((14 * a + v : Nat) : Int) - 1))
* ((ρ : Int) - ((ρ * x0) % 14 : Nat)) := by lib_int
_ = 0 := key
end CosetSplitB
#print axioms CosetSplitB.part_zero'
#print axioms CosetSplitB.gsI_wI
#print axioms CosetSplitB.elem_dev
#print axioms CosetSplitB.part_eq
lean_all/hodge/CosetSplitC.lean
/-
hodge/CosetSplitC.lean — T41 cycle 1932 (goal G862c, step 3f): every completed split of the halved doubled
character Fq = 7p :: F_p (p = 14a + v, v ∈ {3, 5}, p prime, FamBal data 1 + 14i₀ = p·x₀) whose part c :: A is
balanced at 14p (c + (Σ_A x mod 14p) = 14p) has |A| ≤ 1 or |B| ≤ 1:
split_small
Proof: the three coset conditions ρ = 1, 3, 5 (CosetSplitB.part_eq, with c a unit mod p or a multiple of p),
the residue tables (CosetElim), and the size arithmetic (CosetSize) with the counts of CosetSplitA.
Lean 4 core plus hodge/CosetSplitB, hodge/CosetElim, hodge/CosetSize; no axioms.
-/
import hodge.CosetSplitB
import hodge.CosetElim
import hodge.CosetSize
namespace CosetSplitC
open GcdHand ModHand OrbitSum PermSum FamMod FamArith Indecomp FamIndec2 FamIndec3 FamBal QFamPrime CosetAvg CosetBal
CosetDev CosetWeight CosetSplitA CosetSplitB
theorem nat_ne (a b : Nat) (h : Nat.beq a b = false) : a ≠ b := fun e => by rw [e, beq_refl'] at h; exact nomatch h
theorem mod14 (r x : Nat) (hr : r < 14) : (r * x) % 14 = (r * (x % 14)) % 14 := by
rw [mul_mod' 14 r x (Nat.succ_pos 13), mod_lt' r 14 hr]
/-- x₀ mod 14 from p·x₀ ≡ 1 -/
theorem u_of (a v i0 x0 : Nat) (hv : v = 3 ∨ v = 5) (hx : 1 + 14 * i0 = (14 * a + v) * x0) :
(v = 3 ∧ x0 % 14 = 5) ∨ (v = 5 ∧ x0 % 14 = 3) := by
have h1 : ((14 * a + v) * x0) % 14 = 1 := by rw [← hx]; exact CosetSplitA.res_ord i0
have hu : x0 % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
rcases hv with h | h <;> subst h
· have h2 : (3 * (x0 % 14)) % 14 = 1 := by
rw [← mod14 3 x0 (Nat.le.intro (k := 10) rfl), ← add_mul_mod' (3 * x0) 14 (Nat.succ_pos 13) (a * x0),
show 3 * x0 + a * x0 * 14 = (14 * a + 3) * x0 by lib_nat]
exact h1
left; refine ⟨rfl, ?_⟩
generalize x0 % 14 = u at h2 hu ⊢
rcases CosetElim.lt14 u hu with e | e | e | e | e | e | e | e | e | e | e | e | e | e <;> subst e
all_goals first | rfl | exact absurd h2 (nat_ne _ _ rfl)
· have h2 : (5 * (x0 % 14)) % 14 = 1 := by
rw [← mod14 5 x0 (Nat.le.intro (k := 8) rfl), ← add_mul_mod' (5 * x0) 14 (Nat.succ_pos 13) (a * x0),
show 5 * x0 + a * x0 * 14 = (14 * a + 5) * x0 by lib_nat]
exact h1
right; refine ⟨rfl, ?_⟩
generalize x0 % 14 = u at h2 hu ⊢
rcases CosetElim.lt14 u hu with e | e | e | e | e | e | e | e | e | e | e | e | e | e <;> subst e
all_goals first | rfl | exact absurd h2 (nat_ne _ _ rfl)
/-- the coset index j₀ = ρi₀ mod p, with p ∣ ρ + 14j₀ -/
theorem jy (p ρ i0 x0 : Nat) (hp : 0 < p) (hx : 1 + 14 * i0 = p * x0) :
∃ j0 y, j0 < p ∧ ρ + 14 * j0 = p * y := by
have hj : (ρ * i0) % p < p := Nat.mod_lt _ hp
obtain ⟨q, hq⟩ := div_mod p hp (ρ * i0 + 1) (ρ * i0) (Nat.lt_succ_self _)
generalize (ρ * i0) % p = j0 at hq hj
have e : p * (ρ * x0) = (ρ + 14 * j0) + p * (14 * q) := by
calc p * (ρ * x0) = ρ * (p * x0) := by lib_nat
_ = ρ * (1 + 14 * i0) := by rw [hx]
_ = ρ + 14 * (ρ * i0) := by lib_nat
_ = ρ + 14 * (j0 + p * q) := by rw [hq]
_ = _ := by lib_nat
have ⟨y, hy⟩ := APPair1.dvd_sub_form p (ρ + 14 * j0) (14 * q) (ρ * x0) e
exact ⟨j0, y, hj, hy⟩
/-- the unit case of the coset equation, in the form of CosetElim -/
theorem unit_form (ρ x0 u c g y : Nat) (W : Int) (hρ : ρ < 14) (hu : x0 % 14 = u) (hg : c % 14 = g)
(hy : y % 14 = (ρ * x0) % 14)
(h : W * ((ρ : Int) - ((ρ * x0) % 14 : Nat)) + ((((ρ * c) % 14 : Nat) : Int) - ((y * c) % 14 : Nat)) = 0) :
W * CosetElim.D ρ u + CosetElim.F ρ u g = 0 := by
have e1 : (ρ * x0) % 14 = (ρ * u) % 14 := by rw [mod14 ρ x0 hρ, hu]
have e2 : (ρ * c) % 14 = (ρ * g) % 14 := by rw [mod14 ρ c hρ, hg]
have hg14 : g < 14 := by rw [← hg]; exact Nat.mod_lt _ (Nat.succ_pos 13)
have e3 : (y * c) % 14 = (ρ * u * g) % 14 := by
rw [mul_mod' 14 y c (Nat.succ_pos 13), hy, hg, e1, mul_mod' 14 (ρ * u) g (Nat.succ_pos 13), mod_lt' g 14 hg14]
rw [e1, e2, e3] at h
exact h
/-- the divisible case, in the form of CosetElim -/
theorem div_form (ρ x0 u e k : Nat) (W : Int) (hρ : ρ < 14) (hu : x0 % 14 = u)
(h : W * ((ρ : Int) - ((ρ * x0) % 14 : Nat)) + (k : Int) * ((((ρ * e) % 14 : Nat) : Int) - 7) = 0) :
W * CosetElim.D ρ u + (k : Int) * CosetElim.G ρ (e % 14) = 0 := by
have e1 : (ρ * x0) % 14 = (ρ * u) % 14 := by rw [mod14 ρ x0 hρ, hu]
have e2 : (ρ * e) % 14 = (ρ * (e % 14)) % 14 := mod14 ρ e hρ
rw [e1, e2] at h
exact h
end CosetSplitC
#print axioms CosetSplitC.nat_ne
#print axioms CosetSplitC.mod14
#print axioms CosetSplitC.u_of
#print axioms CosetSplitC.jy
#print axioms CosetSplitC.unit_form
#print axioms CosetSplitC.div_form
lean_all/hodge/CosetSplitD.lean
/-
hodge/CosetSplitD.lean — T41 cycle 1934 (goal G862c, step 3g): a completed part c :: A of the halved doubled
character Fq = 7p :: F_p (p = 14a + v, v ∈ {3, 5}, p prime, FamBal data 1 + 14i₀ = p·x₀), balanced at 14p with
c + Σ_A x ≡ 0 (mod 14), has |A| ≤ 1 or |A| ≥ p:
part_small
Proof: the coset conditions ρ = 1, 3, 5 (CosetSplitB.part_eq, c a unit mod p or c = p·e), the residue
tables (CosetElim), and the size arithmetic (CosetSize) with the counts of CosetSplitA.
Lean 4 core plus hodge/CosetSplitC, hodge/CosetSize; no axioms.
-/
import hodge.CosetSplitC
import hodge.CosetSize
namespace CosetSplitD
open GcdHand ModHand OrbitSum PermSum FamMod FamArith Indecomp FamIndec2 FamIndec3 FamBal QFamPrime CosetAvg CosetBal
CosetDev CosetWeight CosetSplitA CosetSplitB CosetSplitC CosetSize
theorem add6 (x : Nat) : (x + 6) % 14 = (x % 14 + 6) % 14 := by
have ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (x + 1) x (Nat.lt_succ_self x)
generalize x % 14 = r at hq ⊢
rw [hq, show r + 14 * q + 6 = (r + 6) + q * 14 by lib_nat, add_mul_mod' (r + 6) 14 (Nat.succ_pos 13) q]
theorem hT_of (ρ x0 u : Nat) (hρ : ρ < 14) (hu : x0 % 14 = u)
(hchk : ((((ρ * (u + 6)) % 14 : Nat) : Int) - 7 = (((ρ * u) % 14 : Nat) : Int) - ρ)) :
((((ρ * (x0 + 6)) % 14 : Nat) : Int) - 7 = (((ρ * x0) % 14 : Nat) : Int) - ρ) := by
rw [mod14 ρ (x0 + 6) hρ, add6, hu, ← mod14 ρ (u + 6) hρ, mod14 ρ x0 hρ, hu]
exact hchk
theorem y_res (p ρ i0 x0 j0 y : Nat) (hx : 1 + 14 * i0 = p * x0) (ht : ρ + 14 * j0 = p * y) :
y % 14 = (ρ * x0) % 14 := by
have e : ρ * x0 + (j0 * x0) * 14 = y + (y * i0) * 14 :=
calc ρ * x0 + (j0 * x0) * 14 = (ρ + 14 * j0) * x0 := by lib_nat
_ = (p * y) * x0 := by rw [ht]
_ = y * (p * x0) := by lib_nat
_ = y * (1 + 14 * i0) := by rw [hx]
_ = y + (y * i0) * 14 := by lib_nat
rw [← add_mul_mod' (ρ * x0) 14 (Nat.succ_pos 13) (j0 * x0), e, add_mul_mod' y 14 (Nat.succ_pos 13) (y * i0)]
theorem mod_cond (c n1 δ η K P Q : Nat) (hs : (c + (n1 + δ * P + η * Q + 14 * K)) % 14 = 0) :
(c % 14 + n1 + δ * P + η * Q) % 14 = 0 := by
have ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (c + 1) c (Nat.lt_succ_self c)
have e : c + (n1 + δ * P + η * Q + 14 * K) = (c % 14 + n1 + δ * P + η * Q) + (q + K) * 14 := by
generalize c % 14 = r at hq ⊢
rw [hq]; lib_nat
rw [e, add_mul_mod' _ 14 (Nat.succ_pos 13) (q + K)] at hs
exact hs
/-- the coset ρ condition for a completion c prime to p, in the form of CosetElim -/
theorem unit_cond (a v i0 x0 u ρ : Nat) (hv : v = 3 ∨ v = 5) (hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v)
(h14 : Nat.gcd 14 (14 * a + v) = 1) (hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(hu : x0 % 14 = u) (hρ14 : Nat.gcd ρ 14 = 1) (hρ : ρ < 14)
(hchk : ((((ρ * (u + 6)) % 14 : Nat) : Int) - 7 = (((ρ * u) % 14 : Nat) : Int) - ρ)) (hT7 : (ρ * 7) % 14 = 7)
(A : List Nat) (hA : ∀ x, x ∈ A → x ∈ Fq (14 * a + v) i0) (c g : Nat) (hcop : Nat.gcd c (14 * a + v) = 1)
(hg : c % 14 = g) (hb : bal (14 * (14 * a + v)) (c :: A) = true) :
((gs (io (14 * a + v) i0) A : Int) - (gs (isp (14 * a + v) i0) A : Int) * (((14 * a + v : Nat) : Int) - 1))
* CosetElim.D ρ u + CosetElim.F ρ u g = 0 := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have ⟨j0, y, hj, ht⟩ := jy (14 * a + v) ρ i0 x0 hp hx
have h := part_eq a v i0 x0 ρ j0 y hv hpr h14 hi hx hρ14 hρ hj ht (hT_of ρ x0 u hρ hu hchk) hT7 A hA c _
(dev_unit (14 * a + v) ρ j0 y c hj ht hcop) hb
exact unit_form ρ x0 u c g y _ hρ hu hg (y_res _ ρ i0 x0 j0 y hx ht) h
/-- the coset ρ condition for a completion c = p·e, in the form of CosetElim -/
theorem div_cond (a v i0 x0 u ρ : Nat) (hv : v = 3 ∨ v = 5) (hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v)
(h14 : Nat.gcd 14 (14 * a + v) = 1) (hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(hu : x0 % 14 = u) (hρ14 : Nat.gcd ρ 14 = 1) (hρ : ρ < 14)
(hchk : ((((ρ * (u + 6)) % 14 : Nat) : Int) - 7 = (((ρ * u) % 14 : Nat) : Int) - ρ)) (hT7 : (ρ * 7) % 14 = 7)
(A : List Nat) (hA : ∀ x, x ∈ A → x ∈ Fq (14 * a + v) i0) (e k : Nat)
(hk : (k : Int) = ((14 * a + v : Nat) : Int) - 1)
(hb : bal (14 * (14 * a + v)) ((14 * a + v) * e :: A) = true) :
((gs (io (14 * a + v) i0) A : Int) - (gs (isp (14 * a + v) i0) A : Int) * (((14 * a + v : Nat) : Int) - 1))
* CosetElim.D ρ u + (k : Int) * CosetElim.G ρ (e % 14) = 0 := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have ⟨j0, y, hj, ht⟩ := jy (14 * a + v) ρ i0 x0 hp hx
have h := part_eq a v i0 x0 ρ j0 y hv hpr h14 hi hx hρ14 hρ hj ht (hT_of ρ x0 u hρ hu hchk) hT7 A hA
((14 * a + v) * e) _ (dev_div (14 * a + v) ρ j0 e hj) hb
apply div_form ρ x0 u e k _ hρ hu
rw [hk]
exact h
/-- p = 14a + 5 (x₀ ≡ 3 mod 14) -/
theorem part_small5 (a i0 x0 : Nat) (hpr : ∀ d, d ∣ (14 * a + 5) → d = 1 ∨ d = 14 * a + 5)
(h14 : Nat.gcd 14 (14 * a + 5) = 1) (hi : i0 < 14 * a + 5) (hx : 1 + 14 * i0 = (14 * a + 5) * x0)
(hu : x0 % 14 = 3) (A : List Nat) (hA : ∀ x, x ∈ A → x ∈ Fq (14 * a + 5) i0)
(hδ : gs (isp (14 * a + 5) i0) A ≤ 1) (hη : gs (ih (14 * a + 5)) A ≤ 1)
(hn : gs (io (14 * a + 5) i0) A + 1 ≤ 14 * a + 5)
(c : Nat) (hs : (c + gs (fun x => x) A) % 14 = 0) (hb : bal (14 * (14 * a + 5)) (c :: A) = true) :
A.length ≤ 1 ∨ 14 * a + 5 ≤ A.length := by
have hv : ((5 : Nat) = 3 ∨ (5 : Nat) = 5) := Or.inr rfl
rw [← len_counts (14 * a + 5) i0 A]
have ⟨K, hK⟩ := sum_decomp a 5 i0 hv A hA
rw [hK] at hs
have hgm := mod_cond c _ _ _ K _ _ hs
have hW : ((gs (io (14 * a + 5) i0) A : Int) - (gs (isp (14 * a + 5) i0) A : Int) * (((14 * a + 5 : Nat) : Int) - 1))
= (gs (io (14 * a + 5) i0) A : Int) - (gs (isp (14 * a + 5) i0) A : Int) * (14 * (a : Int) + 4) := by
rw [show ((14 * a + 5 : Nat) : Int) = 14 * (a : Int) + 5 from rfl]
lib_int
have ⟨⟨i, hci⟩, ⟨j, hpj⟩⟩ := UnitMul.gcd_dvd c (14 * a + 5)
rcases hpr _ ⟨j, hpj⟩ with h1 | h1
· have hg14 : c % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have e1 := unit_cond a 5 i0 x0 3 1 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 12) rfl) rfl rfl A hA c (c % 14) h1 rfl hb
have e3 := unit_cond a 5 i0 x0 3 3 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 10) rfl) rfl rfl A hA c (c % 14) h1 rfl hb
have e5 := unit_cond a 5 i0 x0 3 5 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 8) rfl) rfl rfl A hA c (c % 14) h1 rfl hb
rcases CosetElim.elim_unit3 (c % 14) hg14 _ e1 e3 e5 with ⟨hw, hg⟩ | ⟨hw, _⟩ | ⟨hw, hg⟩
· exact size5 a _ _ _ (c % 14) _ hδ hη hn hW hgm (Or.inl ⟨hw, hg⟩)
· exact size5 a _ _ _ (c % 14) _ hδ hη hn hW hgm (Or.inr (Or.inl hw))
· exact size5 a _ _ _ (c % 14) _ hδ hη hn hW hgm (Or.inr (Or.inr (Or.inl ⟨hw, hg⟩)))
· rw [h1] at hci
subst hci
have hk : ((14 * a + 4 : Nat) : Int) = ((14 * a + 5 : Nat) : Int) - 1 := by
rw [show ((14 * a + 4 : Nat) : Int) = 14 * (a : Int) + 4 from rfl,
show ((14 * a + 5 : Nat) : Int) = 14 * (a : Int) + 5 from rfl]
lib_int
have hk0 : 0 < 14 * a + 4 := Nat.succ_pos _
have he14 : i % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have e1 := div_cond a 5 i0 x0 3 1 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 12) rfl) rfl rfl A hA i _ hk hb
have e3 := div_cond a 5 i0 x0 3 3 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 10) rfl) rfl rfl A hA i _ hk hb
have e5 := div_cond a 5 i0 x0 3 5 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 8) rfl) rfl rfl A hA i _ hk hb
have hgc : ((14 * a + 5) * i) % 14 = (5 * (i % 14)) % 14 := by
rw [show (14 * a + 5) * i = 5 * i + (a * i) * 14 by lib_nat, add_mul_mod' _ 14 (Nat.succ_pos 13),
mod14 5 i (Nat.le.intro (k := 8) rfl)]
rcases CosetElim.elim_div3 (i % 14) he14 _ _ hk0 e1 e3 e5 with ⟨hw, _⟩ | ⟨hw, he⟩ | ⟨hw, he⟩
· exact size5 a _ _ _ _ _ hδ hη hn hW hgm (Or.inr (Or.inl hw))
· exact size5 a _ _ _ _ _ hδ hη hn hW hgm
(Or.inr (Or.inr (Or.inr (Or.inl ⟨by rw [hw] <;> rfl, by rw [hgc, he] <;> rfl⟩))))
· exact size5 a _ _ _ _ _ hδ hη hn hW hgm
(Or.inr (Or.inr (Or.inr (Or.inr ⟨by rw [hw] <;> rfl, by rw [hgc, he] <;> rfl⟩))))
/-- p = 14a + 3 (x₀ ≡ 5 mod 14) -/
theorem part_small3 (a i0 x0 : Nat) (hpr : ∀ d, d ∣ (14 * a + 3) → d = 1 ∨ d = 14 * a + 3)
(h14 : Nat.gcd 14 (14 * a + 3) = 1) (hi : i0 < 14 * a + 3) (hx : 1 + 14 * i0 = (14 * a + 3) * x0)
(hu : x0 % 14 = 5) (A : List Nat) (hA : ∀ x, x ∈ A → x ∈ Fq (14 * a + 3) i0)
(hδ : gs (isp (14 * a + 3) i0) A ≤ 1) (hη : gs (ih (14 * a + 3)) A ≤ 1)
(hn : gs (io (14 * a + 3) i0) A + 1 ≤ 14 * a + 3)
(c : Nat) (hs : (c + gs (fun x => x) A) % 14 = 0) (hb : bal (14 * (14 * a + 3)) (c :: A) = true) :
A.length ≤ 1 ∨ 14 * a + 3 ≤ A.length := by
have hv : ((3 : Nat) = 3 ∨ (3 : Nat) = 5) := Or.inl rfl
rw [← len_counts (14 * a + 3) i0 A]
have ⟨K, hK⟩ := sum_decomp a 3 i0 hv A hA
rw [hK] at hs
have hgm := mod_cond c _ _ _ K _ _ hs
have hW : ((gs (io (14 * a + 3) i0) A : Int) - (gs (isp (14 * a + 3) i0) A : Int) * (((14 * a + 3 : Nat) : Int) - 1))
= (gs (io (14 * a + 3) i0) A : Int) - (gs (isp (14 * a + 3) i0) A : Int) * (14 * (a : Int) + 2) := by
rw [show ((14 * a + 3 : Nat) : Int) = 14 * (a : Int) + 3 from rfl]
lib_int
have ⟨⟨i, hci⟩, ⟨j, hpj⟩⟩ := UnitMul.gcd_dvd c (14 * a + 3)
rcases hpr _ ⟨j, hpj⟩ with h1 | h1
· have hg14 : c % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have e1 := unit_cond a 3 i0 x0 5 1 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 12) rfl) rfl rfl A hA c (c % 14) h1 rfl hb
have e3 := unit_cond a 3 i0 x0 5 3 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 10) rfl) rfl rfl A hA c (c % 14) h1 rfl hb
have e5 := unit_cond a 3 i0 x0 5 5 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 8) rfl) rfl rfl A hA c (c % 14) h1 rfl hb
rcases CosetElim.elim_unit5 (c % 14) hg14 _ e1 e3 e5 with ⟨hw, hg⟩ | ⟨hw, _⟩ | ⟨hw, hg⟩
· exact size3 a _ _ _ (c % 14) _ hδ hη hn hW hgm (Or.inl ⟨hw, hg⟩)
· exact size3 a _ _ _ (c % 14) _ hδ hη hn hW hgm (Or.inr (Or.inl hw))
· exact size3 a _ _ _ (c % 14) _ hδ hη hn hW hgm (Or.inr (Or.inr (Or.inl ⟨hw, hg⟩)))
· rw [h1] at hci
subst hci
have hk : ((14 * a + 2 : Nat) : Int) = ((14 * a + 3 : Nat) : Int) - 1 := by
rw [show ((14 * a + 2 : Nat) : Int) = 14 * (a : Int) + 2 from rfl,
show ((14 * a + 3 : Nat) : Int) = 14 * (a : Int) + 3 from rfl]
lib_int
have hk0 : 0 < 14 * a + 2 := Nat.succ_pos _
have he14 : i % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have e1 := div_cond a 3 i0 x0 5 1 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 12) rfl) rfl rfl A hA i _ hk hb
have e3 := div_cond a 3 i0 x0 5 3 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 10) rfl) rfl rfl A hA i _ hk hb
have e5 := div_cond a 3 i0 x0 5 5 hv hpr h14 hi hx hu rfl (Nat.le.intro (k := 8) rfl) rfl rfl A hA i _ hk hb
have hgc : ((14 * a + 3) * i) % 14 = (3 * (i % 14)) % 14 := by
rw [show (14 * a + 3) * i = 3 * i + (a * i) * 14 by lib_nat, add_mul_mod' _ 14 (Nat.succ_pos 13),
mod14 3 i (Nat.le.intro (k := 10) rfl)]
rcases CosetElim.elim_div5 (i % 14) he14 _ _ hk0 e1 e3 e5 with ⟨hw, _⟩ | ⟨hw, he⟩ | ⟨hw, he⟩
· exact size3 a _ _ _ _ _ hδ hη hn hW hgm (Or.inr (Or.inl hw))
· exact size3 a _ _ _ _ _ hδ hη hn hW hgm
(Or.inr (Or.inr (Or.inr (Or.inl ⟨by rw [hw] <;> rfl, by rw [hgc, he] <;> rfl⟩))))
· exact size3 a _ _ _ _ _ hδ hη hn hW hgm
(Or.inr (Or.inr (Or.inr (Or.inr ⟨by rw [hw] <;> rfl, by rw [hgc, he] <;> rfl⟩))))
/-- **A completed part of Fq has at most one element or at least p elements.** -/
theorem part_small (a v i0 x0 : Nat) (hv : v = 3 ∨ v = 5) (hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v)
(h14 : Nat.gcd 14 (14 * a + v) = 1) (hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(A : List Nat) (hA : ∀ x, x ∈ A → x ∈ Fq (14 * a + v) i0)
(hδ : gs (isp (14 * a + v) i0) A ≤ 1) (hη : gs (ih (14 * a + v)) A ≤ 1)
(hn : gs (io (14 * a + v) i0) A + 1 ≤ 14 * a + v)
(c : Nat) (hs : (c + gs (fun x => x) A) % 14 = 0) (hb : bal (14 * (14 * a + v)) (c :: A) = true) :
A.length ≤ 1 ∨ 14 * a + v ≤ A.length := by
rcases u_of a v i0 x0 hv hx with ⟨h3, hu⟩ | ⟨h5, hu⟩
· subst h3; exact part_small3 a i0 x0 hpr h14 hi hx hu A hA hδ hη hn c hs hb
· subst h5; exact part_small5 a i0 x0 hpr h14 hi hx hu A hA hδ hη hn c hs hb
end CosetSplitD
#print axioms CosetSplitD.add6
#print axioms CosetSplitD.hT_of
#print axioms CosetSplitD.y_res
#print axioms CosetSplitD.mod_cond
#print axioms CosetSplitD.unit_cond
#print axioms CosetSplitD.div_cond
#print axioms CosetSplitD.part_small5
#print axioms CosetSplitD.part_small3
#print axioms CosetSplitD.part_small
lean_all/hodge/CosetUnit.lean
/-
hodge/CosetUnit.lean — T41 cycle 1914 (goal G862c, step 2a): FamIndec2 for the coset ρ·H, ρ coprime to 14:
for a prime p with gcd(14, p) = 1 and the unique j₀ < p with p ∣ ρ + 14j₀,
idx_unique_r p ∣ ρ + 14i, i < p ⇒ i = j₀
cop_coset_r k < p, k ≠ j₀ ⇒ gcd(ρ + 14k, p) = 1
dvd_one_of_r d ∣ 14, d ∣ ρ + 14i, gcd(ρ, 14) = 1 ⇒ d = 1
unit_tr i < p, i ≠ j₀ ⇒ gcd(ρ + 14i, 14p) = 1
so t_j = ρ + 14j (j ≠ j₀) are units of 14p, the summation range of CosetAvg.coset_omit.
Lean 4 core plus hodge/FamIndec2; no axioms.
-/
import hodge.FamIndec2
namespace CosetUnit
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamIndec2
theorem idx_unique_r (p ρ i i0 : Nat) (hp : 0 < p) (h14 : Nat.gcd 14 p = 1) (hi : i < p) (hi0 : i0 < p)
(h : p ∣ ρ + 14 * i) (h0 : p ∣ ρ + 14 * i0) : i = i0 := by
have a := mod_zero p _ hp h
have b := mod_zero p _ hp h0
cases Nat.lt_or_ge i i0 with
| inl hlt =>
have ⟨d, hd⟩ := LibGcd.le_dest hlt
-- i0 = (i + 1) + d
exfalso
apply inj_mod p 14 ρ i (d + 1) hp h14 (Nat.succ_pos d)
· rw [show i + (d + 1) = i + 1 + d by lib_nat, ← hd]; exact hi0
· rw [a, show i + (d + 1) = i + 1 + d by lib_nat, ← hd, b]
| inr hge =>
cases Nat.lt_or_ge i0 i with
| inl hlt =>
have ⟨d, hd⟩ := LibGcd.le_dest hlt
exfalso
apply inj_mod p 14 ρ i0 (d + 1) hp h14 (Nat.succ_pos d)
· rw [show i0 + (d + 1) = i0 + 1 + d by lib_nat, ← hd]; exact hi
· rw [b, show i0 + (d + 1) = i0 + 1 + d by lib_nat, ← hd, a]
| inr hge' => exact Nat.le_antisymm hge' hge
theorem cop_coset_r (p ρ k i0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hk : k < p) (hi0 : i0 < p) (h0 : p ∣ ρ + 14 * i0) (hne : k ≠ i0) : Nat.gcd (ρ + 14 * k) p = 1 := by
apply FamIndec2.gcd_one_of
intro d hd1 hd2
cases hpr d hd2 with
| inl e => exact e
| inr e =>
rw [e] at hd1
exact absurd (idx_unique_r p ρ k i0 hp h14 hk hi0 hd1 h0) hne
theorem dvd_one_of_r (ρ d i : Nat) (hρ : Nat.gcd ρ 14 = 1) (h1 : d ∣ 14) (h2 : d ∣ ρ + 14 * i) : d = 1 := by
have a := LibGcd.idv_lin (LibGcd.idv_of_nat h2) (LibGcd.idv_of_nat h1) 1 (-(Int.ofNat i))
have e : (1 : Int) * Int.ofNat (ρ + 14 * i) + -(Int.ofNat i) * Int.ofNat 14 = Int.ofNat ρ := by
show (1 : Int) * Int.ofNat (ρ + 14 * i) + -(Int.ofNat i) * Int.ofNat 14 = Int.ofNat ρ
rw [show Int.ofNat (ρ + 14 * i) = Int.ofNat ρ + Int.ofNat 14 * Int.ofNat i from rfl]
lib_int
rw [e] at a
have ⟨c, hc⟩ := LibGcd.idv_nat a
have ⟨e1, he1⟩ := APPair1.dvd_gcd d ρ 14 ⟨c, hc⟩ (let ⟨u, hu⟩ := h1; ⟨u, hu⟩)
rw [hρ] at he1
exact UnitMul.one_of_dvd_one d e1 he1
theorem unit_tr (p ρ i i0 : Nat) (hρ : Nat.gcd ρ 14 = 1) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hi : i < p) (hi0 : i0 < p) (h0 : p ∣ ρ + 14 * i0) (hne : i ≠ i0) : Nat.gcd (ρ + 14 * i) (14 * p) = 1 := by
apply FamIndec2.gcd_one_of
intro d hd1 hd2
-- q = gcd d p is 1 or p
have ⟨⟨a, ha⟩, ⟨b, hb⟩⟩ := UnitMul.gcd_dvd d p
cases hpr (Nat.gcd d p) ⟨b, hb⟩ with
| inr e =>
rw [e] at ha
exact absurd (idx_unique_r p ρ i i0 hp h14 hi hi0 (LibGcd.dvd_trans' ⟨a, ha⟩ hd1) h0) hne
| inl e =>
have hc : ∀ f, f ∣ d → f ∣ p → f = 1 := by
intro f hf1 hf2
have ⟨c, hc⟩ := APPair1.dvd_gcd f d p (let ⟨u, hu⟩ := hf1; ⟨u, hu⟩) (let ⟨u, hu⟩ := hf2; ⟨u, hu⟩)
rw [e] at hc
exact UnitMul.one_of_dvd_one f c hc
have h14d : d ∣ 14 := LibGcd.gauss hc (by rw [show 14 * p = 14 * p from rfl]; exact hd2)
exact dvd_one_of_r ρ d i hρ h14d hd1
end CosetUnit
#print axioms CosetUnit.idx_unique_r
#print axioms CosetUnit.cop_coset_r
#print axioms CosetUnit.dvd_one_of_r
#print axioms CosetUnit.unit_tr
lean_all/hodge/CosetWeight.lean
/-
hodge/CosetWeight.lean — T41 cycle 1932 (goal G862c, step 3b): the coset deviation of each element of
F_p ∪ {7p} is a weight times D_ρ = ρ − ⟨ρx₀⟩_14, where p·x₀ = 1 + 14i₀ and ρ + 14j₀ = p·y:
y_mod y ≡ ρ·x₀ (mod 14)
f_ord ordinary element 1 + 14k (p ∤ it): omitR = 14S + p·(1·D_ρ)
f_spec special element p(x₀ + 6), given the residue identity ⟨ρ(x₀ + 6)⟩ − 7 = ⟨ρx₀⟩ − ρ:
omitR = 14S + p·(−(p − 1)·D_ρ)
f_half 7p, given ⟨7ρ⟩ = 7: omitR = 14S + p·0
tab the residue identities hold for x₀ mod 14 ∈ {3, 5} and ρ ∈ {1, 3, 5, 9, 11, 13} (rfl)
Lean 4 core plus hodge/CosetDev; no axioms.
-/
import hodge.CosetDev
namespace CosetWeight
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp CosetAvg CosetDev
theorem y_mod (p ρ j0 y i0 x0 : Nat) (ht : ρ + 14 * j0 = p * y) (hx : 1 + 14 * i0 = p * x0) :
y % 14 = (ρ * x0) % 14 := by
have e1 : y * (p * x0) = y + (y * i0) * 14 := by rw [← hx]; lib_nat
have e2 : y * (p * x0) = ρ * x0 + (j0 * x0) * 14 := by
calc y * (p * x0) = (p * y) * x0 := by lib_nat
_ = (ρ + 14 * j0) * x0 := by rw [ht]
_ = _ := by lib_nat
have a := add_mul_mod' y 14 (Nat.succ_pos 13) (y * i0)
have b := add_mul_mod' (ρ * x0) 14 (Nat.succ_pos 13) (j0 * x0)
rw [← e1, e2, b] at a
exact a.symm
theorem ord_mod (r k : Nat) : (r * (1 + 14 * k)) % 14 = r % 14 := by
rw [show r * (1 + 14 * k) = r + (r * k) * 14 by lib_nat]
exact add_mul_mod' r 14 (Nat.succ_pos 13) (r * k)
theorem f_ord (p ρ j0 y i0 x0 k : Nat) (hρ : ρ < 14) (hi : j0 < p) (ht : ρ + 14 * j0 = p * y)
(hx : 1 + 14 * i0 = p * x0) (hk : Nat.gcd (1 + 14 * k) p = 1) :
(omitR p ρ j0 (1 + 14 * k) : Int)
= 14 * (sumF (fun i => i) p : Nat) + (p : Int) * (1 * ((ρ : Int) - ((ρ * x0) % 14 : Nat))) := by
rw [dev_unit p ρ j0 y (1 + 14 * k) hi ht hk, ord_mod ρ k, ord_mod y k, mod_lt' ρ 14 hρ,
y_mod p ρ j0 y i0 x0 ht hx]
generalize (((ρ * x0) % 14 : Nat) : Int) = R
lib_int
theorem f_spec (p ρ j0 x0 : Nat) (hi : j0 < p)
(hT : (((ρ * (x0 + 6)) % 14 : Nat) : Int) - 7 = (((ρ * x0) % 14 : Nat) : Int) - ρ) :
(omitR p ρ j0 (p * (x0 + 6)) : Int)
= 14 * (sumF (fun i => i) p : Nat) + (p : Int) * (-((p : Int) - 1) * ((ρ : Int) - ((ρ * x0) % 14 : Nat))) := by
rw [dev_div p ρ j0 (x0 + 6) hi, hT]
generalize (((ρ * x0) % 14 : Nat) : Int) = R
lib_int
theorem f_half (p ρ j0 : Nat) (hi : j0 < p) (hT : (ρ * 7) % 14 = 7) :
(omitR p ρ j0 (p * 7) : Int) = 14 * (sumF (fun i => i) p : Nat) + (p : Int) * 0 := by
rw [dev_div p ρ j0 7 hi, hT]
show _ = _ + (p : Int) * 0
have : ((7 : Nat) : Int) - 7 = 0 := rfl
rw [this]
lib_int
/-- the residue tables (u = x₀ mod 14) -/
def specOK (u ρ : Nat) : Bool := Int.decEq ((((ρ * (u + 6)) % 14 : Nat) : Int) - 7) ((((ρ * u) % 14 : Nat) : Int) - ρ) |>.decide
theorem tab_spec : [3, 5].all (fun u => [1, 3, 5, 9, 11, 13].all (fun ρ => specOK u ρ)) = true := rfl
theorem tab_half : [1, 3, 5, 9, 11, 13].all (fun ρ => Nat.beq ((ρ * 7) % 14) 7) = true := rfl
end CosetWeight
#print axioms CosetWeight.y_mod
#print axioms CosetWeight.ord_mod
#print axioms CosetWeight.f_ord
#print axioms CosetWeight.f_spec
#print axioms CosetWeight.f_half
#print axioms CosetWeight.tab_spec
#print axioms CosetWeight.tab_half
lean_all/hodge/CurveSplit20.lean
/-
hodge/CurveSplit20.lean — T41 cycle 946 (goal G585 / G544b): six of the nine Open20 orbits are curve × curve.
A fourfold character c = β ⊔ γ with |β| = |γ| = 3 and Σβ ≡ Σγ ≡ 0 (mod m) comes, by Shioda's inductive
structure (cited, not formalized here), from H¹(C) ⊗ H¹(C) on a product of two Fermat curves of degree m.
There it is a class of type (1,1) exactly when, for every unit t, the two fractional sums are {m, 2m}:
tsum t β = m ∧ tsum t γ = 2m or tsum t β = 2m ∧ tsum t γ = m,
and then it is algebraic by the Lefschetz (1,1) theorem (cited). The checks below are rfl:
m = 20: [1, 1, 18] ⊔ [6, 17, 17]
m = 21: [1, 4, 16] ⊔ [9, 15, 18], [1, 4, 16] ⊔ [10, 13, 19]
m = 24: [1, 1, 22] ⊔ [10, 19, 19], [1, 1, 22] ⊔ [14, 17, 17], [1, 6, 17] ⊔ [4, 22, 22]
The m = 24 orbits [1, 1, 13, 18, 19, 20], [1, 1, 14, 17, 19, 20], [1, 8, 9, 13, 20, 21] have no zero-sum triple;
they split as S ⊔ T with a connecting value b ≡ −ΣS, and (S, b), (T, m − b) balanced surface characters — the
surface × surface case of the inductive structure (Hodge classes on Fermat surfaces, Lefschetz (1,1); cited):
[1, 13, 18 | 16] ⊔ [1, 19, 20 | 8], [1, 14, 17 | 16] ⊔ [1, 19, 20 | 8], [1, 8, 20 | 19] ⊔ [9, 13, 21 | 5].
So every Open20 orbit is reached by the inductive structure from curves and surfaces.
Lean 4 core plus hodge/Indecomp (tsum), hodge/FermatPrime (units), rfl.
-/
import hodge.Indecomp
namespace CurveSplit20
open Indecomp
def lsum : List Nat → Nat
| [] => 0
| a :: l => a + lsum l
/-- curve × curve test: both triples sum to 0 mod m and every unit gives fractional sums {m, 2m} -/
def ccTest (m : Nat) (b g : List Nat) : Bool :=
Nat.beq b.length 3 && Nat.beq g.length 3 && Nat.beq (lsum b % m) 0 && Nat.beq (lsum g % m) 0 &&
(FermatPrime.units m).all (fun t =>
(Nat.beq (tsum m t b) m && Nat.beq (tsum m t g) (2 * m)) ||
(Nat.beq (tsum m t b) (2 * m) && Nat.beq (tsum m t g) m))
/-- the orbit representative is the concatenation, up to order -/
def splitOK (m : Nat) (c b g : List Nat) : Bool := ccTest m b g && List.isPerm (b ++ g) c
/-- surface × surface test with connecting value b: (S, b) and (T, m − b) balanced, b ≡ −ΣS, b ≠ 0 -/
def ssOK (m : Nat) (c S T : List Nat) (b : Nat) : Bool :=
Nat.beq S.length 3 && Nat.beq T.length 3 && Nat.beq ((lsum S + b) % m) 0 && !(Nat.beq b 0) && Nat.blt b m &&
bal m (S ++ [b]) && bal m (T ++ [m - b]) && List.isPerm (S ++ T) c
theorem cc20_0 : splitOK 20 [1, 1, 6, 17, 17, 18] [1, 1, 18] [6, 17, 17] = true := rfl
theorem cc21_1 : splitOK 21 [1, 4, 9, 15, 16, 18] [1, 4, 16] [9, 15, 18] = true := rfl
theorem cc21_2 : splitOK 21 [1, 4, 10, 13, 16, 19] [1, 4, 16] [10, 13, 19] = true := rfl
theorem cc24_3 : splitOK 24 [1, 1, 10, 19, 19, 22] [1, 1, 22] [10, 19, 19] = true := rfl
theorem cc24_5 : splitOK 24 [1, 1, 14, 17, 17, 22] [1, 1, 22] [14, 17, 17] = true := rfl
theorem cc24_7 : splitOK 24 [1, 4, 6, 17, 22, 22] [1, 6, 17] [4, 22, 22] = true := rfl
theorem ss24_4 : ssOK 24 [1, 1, 13, 18, 19, 20] [1, 13, 18] [1, 19, 20] 16 = true := rfl
theorem ss24_6 : ssOK 24 [1, 1, 14, 17, 19, 20] [1, 14, 17] [1, 19, 20] 16 = true := rfl
theorem ss24_8 : ssOK 24 [1, 8, 9, 13, 20, 21] [1, 8, 20] [9, 13, 21] 19 = true := rfl
end CurveSplit20
#print axioms CurveSplit20.cc20_0
#print axioms CurveSplit20.cc21_1
#print axioms CurveSplit20.cc21_2
#print axioms CurveSplit20.cc24_3
#print axioms CurveSplit20.cc24_5
#print axioms CurveSplit20.cc24_7
#print axioms CurveSplit20.ss24_4
#print axioms CurveSplit20.ss24_6
#print axioms CurveSplit20.ss24_8
lean_all/hodge/Descent.lean
/-
hodge/Descent.lean — T41 cycle 156: descent of the Hodge condition along X_m → X_{m′}, every m.
Lean 4 core plus hodge/Pullback (tsum_scale, len_map), QRChain (add_right_cancel'), lib/Semi.
mul_cancel k·A = k·B, k ≥ 1 ⇒ A = B (by hand; Nat.eq_of_mul_eq_mul_left avoided)
descent 2T^{(m)}_t(e·c) = |c|·m ⇒ 2T^{(m′)}_t(c) = |c|·m′ (m = e·m′)
With Pullback.pull_hodge: e·c is a Hodge character of X_m iff c is one of X_{m′}, twist by twist.
Reading: an open character of X_m with all entries divisible by e comes from an open character of
X_{m/e}; the certified open cases (m = 32 … 78) all contain the entry 1, so none is a pullback.
-/
import hodge.Pullback
namespace Descent
open FTAChain FrobChain QRChain ESChain FermatGens Pullback
theorem mul_cancel (e' : Nat) : ∀ A B : Nat, (e' + 1) * A = (e' + 1) * B → A = B
| 0, 0, _ => rfl
| 0, B + 1, h => by
have h' : 0 = (e' + 1) * B + e' + 1 := h
exact Nat.noConfusion h'
| A + 1, 0, h => by
have h' : (e' + 1) * A + e' + 1 = 0 := h
exact Nat.noConfusion h'
| A + 1, B + 1, h => by
have h' : (e' + 1) * A + (e' + 1) = (e' + 1) * B + (e' + 1) := h
have := mul_cancel e' A B (add_right_cancel' _ _ _ h')
rw [this]
/-- **Descent of a Hodge character.** -/
theorem descent (e' m' t : Nat) (c : List Nat)
(h : tsum ((e' + 1) * (m' + 1)) t (c.map (fun x => (e' + 1) * x))
+ tsum ((e' + 1) * (m' + 1)) t (c.map (fun x => (e' + 1) * x))
= (c.map (fun x => (e' + 1) * x)).length * ((e' + 1) * (m' + 1))) :
tsum (m' + 1) t c + tsum (m' + 1) t c = c.length * (m' + 1) := by
rw [tsum_scale, len_map] at h
apply mul_cancel e'
have e1 : (e' + 1) * (tsum (m' + 1) t c + tsum (m' + 1) t c)
= (e' + 1) * tsum (m' + 1) t c + (e' + 1) * tsum (m' + 1) t c := by lib_nat
have e2 : (e' + 1) * (c.length * (m' + 1)) = c.length * ((e' + 1) * (m' + 1)) := by lib_nat
rw [e1, e2]; exact h
end Descent
#print axioms Descent.mul_cancel
#print axioms Descent.descent
lean_all/hodge/DivHand.lean
/-
hodge/DivHand.lean — T41 cycle 1934 (goal G862d, tool): Nat division by hand from the axiom-free unfoldings
Nat.div.eq_def and Nat.div.go.eq_def (core's Nat.div_add_mod and its consequences use simp).
go_val the fuelled loop returns q on r + q·y with r < y
div_val (r + q·y) / y = q for r < y
mul_div' (q·y) / y = q
Lean 4 core plus hodge/ModHand; no axioms.
-/
import hodge.ModHand
import lib.Semi
namespace DivHand
open ModHand
theorem go_arg (y : Nat) (hy : 0 < y) (F x x' : Nat) (h : x < F) (h' : x' < F) (e : x = x') :
Nat.div.go y hy F x h = Nat.div.go y hy F x' h' := by
subst e; rfl
theorem go_val (y : Nat) (hy : 0 < y) (r : Nat) (hr : r < y) :
∀ (q F : Nat) (h : r + q * y < F), Nat.div.go y hy F (r + q * y) h = q
| _, 0, h => absurd h (Nat.not_lt_zero _)
| 0, F + 1, h => by
rw [Nat.div.go.eq_def]
show (if hyx : y ≤ r + 0 * y then Nat.div.go y hy F (r + 0 * y - y) _ + 1 else 0) = 0
have hn : ¬ (y ≤ r + 0 * y) := fun hle => by
have e : r + 0 * y = r := by lib_nat
rw [e] at hle
exact Nat.lt_irrefl r (Nat.lt_of_lt_of_le hr hle)
rw [dite_eq_right hn]
| q + 1, F + 1, h => by
rw [Nat.div.go.eq_def]
show (if hyx : y ≤ r + (q + 1) * y then Nat.div.go y hy F (r + (q + 1) * y - y) _ + 1 else 0) = q + 1
have hle : y ≤ r + (q + 1) * y := by
rw [show r + (q + 1) * y = y + (r + q * y) by lib_nat]
exact Nat.le_add_right y _
rw [dite_eq_left hle]
have e : r + (q + 1) * y - y = r + q * y := by
rw [show r + (q + 1) * y = (r + q * y) + y by lib_nat]
exact add_sub' (r + q * y) y
have h2 : r + q * y < F := by
have h' : r + (q + 1) * y - y < F :=
Nat.div_rec_fuel_lemma hy hle h
rw [e] at h'
exact h'
rw [go_arg y hy F _ (r + q * y) _ h2 e, go_val y hy r hr q F h2]
theorem div_val (y : Nat) (hy : 0 < y) (r q : Nat) (hr : r < y) : (r + q * y) / y = q := by
show Nat.div (r + q * y) y = q
rw [Nat.div.eq_def]
show (if hy' : 0 < y then Nat.div.go y hy' (r + q * y + 1) (r + q * y) (Nat.lt_succ_self _) else 0) = q
rw [dite_eq_left hy]
exact go_val y hy r hr q _ _
theorem mul_div' (y : Nat) (hy : 0 < y) (q : Nat) : (q * y) / y = q := by
have e := div_val y hy 0 q hy
rw [show 0 + q * y = q * y by lib_nat] at e
exact e
end DivHand
#print axioms DivHand.go_arg
#print axioms DivHand.go_val
#print axioms DivHand.div_val
#print axioms DivHand.mul_div'
lean_all/hodge/DupTriple.lean
/-
hodge/DupTriple.lean — T41 cycle 285 (goal G28): the duplication triple {u, u + m/2, m − 2u} is balanced for every
even m = 2h and 0 < u < h, and the second pair family AP(m/4) + (m/2 − 2, m − 2) always splits into two such
triples — it is never irreducible (symbolic in q ≥ 2).
Lean 4 core plus hodge/TwistIndec (splits_eq), hodge/APPairGen (euclid, not_dvd_small), hodge/APPair (mod_rep,
comp, decomp), hodge/HalfGeneral (half_mul), hodge/GcdHand (units_odd), lib/NatNorm.
tsum_dup for odd t with h ∤ tu: ⟨tu⟩ + ⟨t(u+h)⟩ + ⟨tw⟩ = 3h (2u + w = 2h)
dup_bal bal (2h) [u, u+h, w]
fam2_split the splitting ([1, 1+2q, 4q−2], [1+q, 1+3q, 2q−2]) is balanced on both sides
fam2_red indec (4q) [1, 1+q, 1+2q, 1+3q, 2q−2, 4q−2] = false (q ≥ 2)
-/
import hodge.TwistIndec
namespace DupTriple
open ModHand HalfGeneral Indecomp GcdHand APPair APPairIrrGen APPairGen TwistBal
theorem tsum_dup (h u w t : Nat) (hh : 0 < h) (hw : u + u + w = h + h) (ht : isOdd t = true)
(hnd : (t * u) % h ≠ 0) :
(t * u) % (h + h) + ((t * (u + h)) % (h + h) + (t * w) % (h + h)) = h + h + h := by
have hm : 0 < h + h := Nat.lt_of_lt_of_le hh (Nat.le_add_right h h)
have x_lt := Nat.mod_lt (t * u) hm
-- ⟨t(u+h)⟩ = ⟨x + h⟩
have e1 : (t * (u + h)) % (h + h) = ((t * u) % (h + h) + h) % (h + h) := by
rw [Nat.left_distrib, ← mod_add (t * u) (t * h) _ hm, half_mul h t hh ht]
-- ⟨tw⟩ + ⟨2x⟩ = m
have ⟨k, hk⟩ := decomp (t * u) (h + h) hm
generalize hx : (t * u) % (h + h) = x at e1 x_lt hk
have hx0 : 0 < x := by
cases x with
| succ x => exact Nat.succ_pos x
| zero =>
apply absurd _ hnd
rw [hk, Nat.zero_add, ((show ((h) + (h))*(k) = 0 + (2*(k))*(h) from NatNorm.sound [h, k] (.mul (.add (.var 0) (.var 0)) (.var 1)) (.add (.lit 0) (.mul (.mul (.lit 2) (.var 1)) (.var 0))) rfl)), add_mul_mod' 0 h hh, mod_lt' 0 h hh]
have hxh : x ≠ h := by
intro e
apply hnd
rw [hk, e, ((show (h) + ((h) + (h))*(k) = 0 + (1 + 2*(k))*(h) from NatNorm.sound [h, k] (.add (.var 0) (.mul (.add (.var 0) (.var 0)) (.var 1))) (.add (.lit 0) (.mul (.add (.lit 1) (.mul (.lit 2) (.var 1))) (.var 0))) rfl)), add_mul_mod' 0 h hh, mod_lt' 0 h hh]
have hc2 : (t * (u + u)) % (h + h) = (x + x) % (h + h) := by
rw [((show (t)*((u) + (u)) = (t)*(u) + (t)*(u) from NatNorm.sound [t, u] (.mul (.var 0) (.add (.var 1) (.var 1))) (.add (.mul (.var 0) (.var 1)) (.mul (.var 0) (.var 1))) rfl)), ← mod_add _ _ _ hm, hx]
have hcomp : ∀ r, (t * (u + u)) % (h + h) = r → 0 < r → r < h + h → (t * w) % (h + h) + r = h + h := by
intro r hr r0 rl
apply comp (t * w) (t * (u + u)) (h + h) r hm hr r0 rl
rw [((show (t)*(w) + (t)*((u) + (u)) = (t)*((u) + (u) + (w)) from NatNorm.sound [t, w, u] (.add (.mul (.var 0) (.var 1)) (.mul (.var 0) (.add (.var 2) (.var 2)))) (.mul (.var 0) (.add (.add (.var 2) (.var 2)) (.var 1))) rfl)), hw]
exact mod_rep _ 0 _ t hm ((show (t)*((h) + (h)) = 0 + (t)*((h) + (h)) from NatNorm.sound [t, h] (.mul (.var 0) (.add (.var 1) (.var 1))) (.add (.lit 0) (.mul (.var 0) (.add (.var 1) (.var 1)))) rfl))
cases Nat.lt_or_ge x h with
| inl l =>
have r1 : (x + h) % (h + h) = x + h := mod_lt' _ _ (Nat.add_lt_add_right l h)
have r2 : (x + x) % (h + h) = x + x := mod_lt' _ _ (add_lt_add' _ _ _ _ l l)
rw [hc2, r2] at hcomp
have hc := hcomp (x + x) rfl (Nat.lt_of_lt_of_le hx0 (Nat.le_add_right x x)) (add_lt_add' _ _ _ _ l l)
rw [e1, r1]
apply add_right_cancel' _ _ (x + x)
rw [((show (x) + ((x) + (h) + ((t * w) % (h + h))) + ((x) + (x)) = (x) + (x) + (h) + (((t * w) % (h + h)) + ((x) + (x))) from NatNorm.sound [x, h, (t * w) % (h + h)] (.add (.add (.var 0) (.add (.add (.var 0) (.var 1)) (.var 2))) (.add (.var 0) (.var 0))) (.add (.add (.add (.var 0) (.var 0)) (.var 1)) (.add (.var 2) (.add (.var 0) (.var 0)))) rfl)), hc]
exact ((show (x) + (x) + (h) + ((h) + (h)) = (h) + (h) + (h) + ((x) + (x)) from NatNorm.sound [x, h] (.add (.add (.add (.var 0) (.var 0)) (.var 1)) (.add (.var 1) (.var 1))) (.add (.add (.add (.var 1) (.var 1)) (.var 1)) (.add (.var 0) (.var 0))) rfl))
| inr g =>
have ⟨y, hy⟩ := Nat.le.dest g
have hyh : y < h := Nat.lt_of_add_lt_add_left (hy ▸ x_lt)
have hy0 : 0 < y := by
cases y with
| succ y => exact Nat.succ_pos y
| zero => exact absurd (by rw [← hy]; rfl) hxh
have r1 : (x + h) % (h + h) = y := by
rw [← hy]; apply mod_rep _ _ _ 1 (Nat.lt_of_lt_of_le hyh (Nat.le_add_right h h)); exact ((show (h) + (y) + (h) = (y) + 1*((h) + (h)) from NatNorm.sound [h, y] (.add (.add (.var 0) (.var 1)) (.var 0)) (.add (.var 1) (.mul (.lit 1) (.add (.var 0) (.var 0)))) rfl))
have r2 : (x + x) % (h + h) = y + y := by
rw [← hy]; apply mod_rep _ _ _ 1 (add_lt_add' _ _ _ _ hyh hyh); exact ((show (h) + (y) + ((h) + (y)) = (y) + (y) + 1*((h) + (h)) from NatNorm.sound [h, y] (.add (.add (.var 0) (.var 1)) (.add (.var 0) (.var 1))) (.add (.add (.var 1) (.var 1)) (.mul (.lit 1) (.add (.var 0) (.var 0)))) rfl))
rw [hc2, r2] at hcomp
have hc := hcomp (y + y) rfl (Nat.lt_of_lt_of_le hy0 (Nat.le_add_right y y)) (add_lt_add' _ _ _ _ hyh hyh)
rw [e1, r1, ← hy]
apply add_right_cancel' _ _ (y + y)
rw [((show (h) + (y) + ((y) + ((t * w) % (h + h))) + ((y) + (y)) = (h) + (y) + (y) + (((t * w) % (h + h)) + ((y) + (y))) from NatNorm.sound [h, y, (t * w) % (h + h)] (.add (.add (.add (.var 0) (.var 1)) (.add (.var 1) (.var 2))) (.add (.var 1) (.var 1))) (.add (.add (.add (.var 0) (.var 1)) (.var 1)) (.add (.var 2) (.add (.var 1) (.var 1)))) rfl)), hc]
exact ((show (h) + (y) + (y) + ((h) + (h)) = (h) + (h) + (h) + ((y) + (y)) from NatNorm.sound [h, y] (.add (.add (.add (.var 0) (.var 1)) (.var 1)) (.add (.var 0) (.var 0))) (.add (.add (.add (.var 0) (.var 0)) (.var 0)) (.add (.var 1) (.var 1))) rfl))
/-- **The duplication triple is balanced.** -/
theorem dup_bal (h u w : Nat) (hu : 0 < u) (huh : u < h) (hw : u + u + w = h + h) :
bal (h + h) [u, u + h, w] = true := by
have hh : 0 < h := Nat.lt_of_le_of_lt (Nat.zero_le u) huh
have hm : 0 < h + h := Nat.lt_of_lt_of_le hh (Nat.le_add_right h h)
unfold bal FermatPrime.units
apply all_fr_intro
intro t _ hp
have hg := Nat.eq_of_beq_eq_true hp
have ht : isOdd t = true := unit_isOdd h t hg
have hnd : (t * u) % h ≠ 0 := by
intro z
have ⟨N, hN⟩ := decomp (t * u) h hh
rw [z, Nat.zero_add] at hN
have ⟨k, hk⟩ := euclid t (h + h) h u hg ⟨N, hN⟩ ⟨2 * u, ((show ((h) + (h))*(u) = (h)*(2*(u)) from NatNorm.sound [h, u] (.mul (.add (.var 0) (.var 0)) (.var 1)) (.mul (.var 0) (.mul (.lit 2) (.var 1))) rfl))⟩
exact not_dvd_small h u k hu huh hk
show Nat.beq ((t * u) % (h + h) + ((t * (u + h)) % (h + h) + ((t * w) % (h + h) + 0))
+ ((t * u) % (h + h) + ((t * (u + h)) % (h + h) + ((t * w) % (h + h) + 0)))) (3 * (h + h)) = true
rw [Nat.add_zero, tsum_dup h u w t hh hw ht hnd, ((show (h) + (h) + (h) + ((h) + (h) + (h)) = 3*((h) + (h)) from NatNorm.sound [h] (.add (.add (.add (.var 0) (.var 0)) (.var 0)) (.add (.add (.var 0) (.var 0)) (.var 0))) (.mul (.lit 3) (.add (.var 0) (.var 0))) rfl))]
exact beq_self _
theorem all_mem {α : Type} (P : α → Bool) {a : α} : ∀ {l : List α}, a ∈ l → l.all P = true → P a = true
| _ :: _, List.Mem.head _, h => by
have h' : (P a && _) = true := h
cases e : P a with
| true => rfl
| false => rw [e] at h'; exact Bool.noConfusion h'
| b :: l, List.Mem.tail _ m, h => by
have h' : (P b && l.all P) = true := h
cases e : l.all P with
| true => exact all_mem P m e
| false => rw [e] at h'; cases e2 : P b <;> rw [e2] at h' <;> exact Bool.noConfusion h'
/-- **The second pair family always splits.** (q ≥ 2, c + 2 = 2q, d + 2 = 4q) -/
theorem fam2_red (q c d : Nat) (hq : 2 ≤ q) (hc : c + 2 = 2 * q) (hd : d + 2 = 4 * q) :
indec (4 * q) [1, 1 + q, 1 + 2 * q, 1 + 3 * q, c, d] = false := by
have ⟨r, hr⟩ := Nat.le.dest hq
-- first triple: u = 1, h = 2q
have b1 : bal (2 * q + 2 * q) [1, 1 + 2 * q, d] = true := by
apply dup_bal _ 1 d (Nat.succ_pos 0)
· rw [← hr]; exact Nat.lt_of_lt_of_le (Nat.succ_lt_succ (Nat.succ_pos 0)) (by rw [((show 2*(2 + (r)) = 2 + (2 + 2*(r)) from NatNorm.sound [r] (.mul (.lit 2) (.add (.lit 2) (.var 0))) (.add (.lit 2) (.add (.lit 2) (.mul (.lit 2) (.var 0)))) rfl))]; exact Nat.le_add_right 2 _)
· rw [((show 1 + 1 + (d) = (d) + 2 from NatNorm.sound [d] (.add (.add (.lit 1) (.lit 1)) (.var 0)) (.add (.var 0) (.lit 2)) rfl)), hd]; exact ((show 4*(q) = 2*(q) + 2*(q) from NatNorm.sound [q] (.mul (.lit 4) (.var 0)) (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) rfl))
have b2 : bal (2 * q + 2 * q) [1 + q, 1 + q + 2 * q, c] = true := by
apply dup_bal _ (1 + q) c (Nat.lt_of_lt_of_le (Nat.succ_pos 0) (Nat.le_add_right 1 q))
· rw [← hr, ((show 2*(2 + (r)) = 1 + (2 + (r)) + (1 + (r)) from NatNorm.sound [r] (.mul (.lit 2) (.add (.lit 2) (.var 0))) (.add (.add (.lit 1) (.add (.lit 2) (.var 0))) (.add (.lit 1) (.var 0))) rfl))]; exact Nat.lt_add_of_pos_right (by rw [Nat.add_comm]; exact Nat.succ_pos r)
· rw [((show 1 + (q) + (1 + (q)) + (c) = (c) + 2 + 2*(q) from NatNorm.sound [q, c] (.add (.add (.add (.lit 1) (.var 0)) (.add (.lit 1) (.var 0))) (.var 1)) (.add (.add (.var 1) (.lit 2)) (.mul (.lit 2) (.var 0))) rfl)), hc]
rw [((show 2*(q) + 2*(q) = 4*(q) from NatNorm.sound [q] (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) (.mul (.lit 4) (.var 0)) rfl)), ((show 1 + (q) + 2*(q) = 1 + 3*(q) from NatNorm.sound [q] (.add (.add (.lit 1) (.var 0)) (.mul (.lit 2) (.var 0))) (.add (.lit 1) (.mul (.lit 3) (.var 0))) rfl))] at b2
rw [((show 2*(q) + 2*(q) = 4*(q) from NatNorm.sound [q] (.add (.mul (.lit 2) (.var 0)) (.mul (.lit 2) (.var 0))) (.mul (.lit 4) (.var 0)) rfl))] at b1
cases hi : indec (4 * q) [1, 1 + q, 1 + 2 * q, 1 + 3 * q, c, d] with
| false => rfl
| true =>
unfold indec at hi
rw [splits_eq] at hi
have mem : ([1, 1 + 2 * q, d], [1 + q, 1 + 3 * q, c]) ∈ splitsG [1, 1 + q, 1 + 2 * q, 1 + 3 * q, c, d] :=
List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (Lis -- (+89 chars; full line in the Zenodo source)
have := all_mem _ mem hi
have this' : (([1, 1 + 2 * q, d] : List Nat).isEmpty || ([1 + q, 1 + 3 * q, c] : List Nat).isEmpty ||
!(bal (4 * q) [1, 1 + 2 * q, d] && bal (4 * q) [1 + q, 1 + 3 * q, c])) = true := this
rw [b1, b2] at this'
exact Bool.noConfusion this'
end DupTriple
#print axioms DupTriple.tsum_dup
#print axioms DupTriple.dup_bal
#print axioms DupTriple.all_mem
#print axioms DupTriple.fam2_red
lean_all/hodge/EvenThird.lean
/-
hodge/EvenThird.lean — T41 cycle 928 (goal G620): for every even q ≥ 4 and a > 0 the μ_q-orbit character at
k = 3a,
QFam(q, 3a, a) = [a + i·3a (i < q)] ⊔ [3qa − qa] at m = 3qa,
contains Triple(a) = {a, m/2 + a, m − 2a} (the members i = 0, q/2, q − 1) and therefore decomposes
(the rest is balanced by BalAppend.bal_cancel). Computation: q = 4, 6, 8 (k < 25) — k = 3a is always decomposable
for even q; for q = 5 it is not (k = 6, a = 2).
Lean 4 core plus hodge/HalfKDec (gl_snoc, app_assoc', mem_all_right), hodge/SplitFalse (split_false, mem_left,
rev3), hodge/IndecPerm (bal_perm, indec_perm), hodge/Triple (triple_bal), hodge/QFam (qfam_bal).
-/
import hodge.HalfKDec
namespace EvenThird
open Indecomp PermSum QFam SplitFalse BalAppend HalfKDec
theorem gl_add (g : Nat → Nat) (m : Nat) : ∀ n, gl g (n + m) = gl (fun i => g (i + m)) n ++ gl g m
| 0 => by rw [Nat.zero_add]; rfl
| n + 1 => by
rw [show n + 1 + m = (n + m) + 1 by lib_nat]
show g (n + m) :: gl g (n + m) = g (n + m) :: (gl (fun i => g (i + m)) n ++ gl g m)
rw [gl_add g m n]
theorem triple_bal' (h a : Nat) (hh : 0 < h) (ha0 : 0 < a) (hah : a < h) :
bal (h + h) [a, h + a, (h + h) - (a + a)] = true := by
cases h with
| zero => exact absurd hh (Nat.lt_irrefl 0)
| succ h0 => exact Triple.triple_bal h0 a ha0 hah
theorem not_indec_of_perm (m : Nat) {c c' : List Nat} (hp : c.Perm c') (h : indec m c' = false) : indec m c = false := by
cases hc : indec m c with
| false => rfl
| true => rw [IndecPerm.indec_perm m hp hc] at h; exact nomatch h
/-- **Even q ≥ 4, k = 3a: the orbit character decomposes.** q = 2r + 4. -/
theorem even_third (r a : Nat) (ha : 0 < a) :
indec ((2 * r + 4) * (3 * a)) (gl (fun i => a + i * (3 * a)) (2 * r + 4) ++ [(2 * r + 4) * (3 * a) - (2 * r + 4) * a]) = false := by
have hak : a < 3 * a := by
rw [show 3 * a = a + (a + a) by lib_nat]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le ha (Nat.le_add_right a a))
have hc := qfam_bal (2 * r + 4) (3 * a) a (Nat.succ_pos _) ha hak
generalize hL : (2 * r + 4) * (3 * a) - (2 * r + 4) * a = L at hc ⊢
let g : Nat → Nat := fun i => a + i * (3 * a)
have e : gl g (2 * r + 4) ++ [L]
= g (2 * r + 3) :: (gl (fun i => g (i + (r + 3))) r ++ g (r + 2) :: (gl (fun i => g (i + 1)) (r + 1) ++ g 0 :: [L])) := by
show g (2 * r + 3) :: gl g (2 * r + 3) ++ [L] = _
rw [show 2 * r + 3 = r + (r + 3) by lib_nat, gl_add g (r + 3) r]
show g (r + (r + 3)) :: ((gl (fun i => g (i + (r + 3))) r ++ (g (r + 2) :: gl g (r + 2))) ++ [L]) = _
rw [gl_snoc g (r + 1), show r + (r + 3) = 2 * r + 3 by lib_nat, app_assoc']
show g (2 * r + 3) :: (gl (fun i => g (i + (r + 3))) r ++ g (r + 2) :: ((gl (fun i => g (i + 1)) (r + 1) ++ [g 0]) ++ [L])) = _
rw [app_assoc']; rfl
have hc' : bal ((2 * r + 4) * (3 * a)) (gl g (2 * r + 4) ++ [L]) = true := hc
show indec ((2 * r + 4) * (3 * a)) (gl g (2 * r + 4) ++ [L]) = false
rw [e] at hc' ⊢
generalize gl (fun i => g (i + (r + 3))) r = X at hc' ⊢
generalize gl (fun i => g (i + 1)) (r + 1) = Y at hc' ⊢
-- permute the three Triple members to the front
have p1 : List.Perm (X ++ g (r + 2) :: (Y ++ g 0 :: [L])) (g (r + 2) :: g 0 :: ((X ++ Y) ++ [L])) := by
refine List.Perm.trans List.perm_middle (List.Perm.cons _ ?_)
rw [← app_assoc']
exact List.perm_middle
have pc : List.Perm (g (2 * r + 3) :: (X ++ g (r + 2) :: (Y ++ g 0 :: [L])))
([g (2 * r + 3), g (r + 2), g 0] ++ ((X ++ Y) ++ [L])) := List.Perm.cons _ p1
have hm : (2 * r + 4) * (3 * a) = (r + 2) * (3 * a) + (r + 2) * (3 * a) := by lib_nat
have hpos : 0 < (r + 2) * (3 * a) := Nat.mul_pos (Nat.succ_pos _) (Nat.lt_of_lt_of_le ha (Nat.le_of_lt hak))
have hlt : a < (r + 2) * (3 * a) := Nat.lt_of_lt_of_le hak (by
have := Nat.mul_le_mul_right (3 * a) (show 1 ≤ r + 2 from Nat.succ_le_succ (Nat.zero_le _))
rw [Nat.one_mul] at this; exact this)
have tb := triple_bal' _ a hpos ha hlt
have e1 : (r + 2) * (3 * a) + a = g (r + 2) := by show _ = a + (r + 2) * (3 * a); lib_nat
have e2 : (r + 2) * (3 * a) + (r + 2) * (3 * a) - (a + a) = g (2 * r + 3) := by
show _ = a + (2 * r + 3) * (3 * a)
rw [show (r + 2) * (3 * a) + (r + 2) * (3 * a) = (a + (2 * r + 3) * (3 * a)) + (a + a) by lib_nat]
exact ModHand.add_sub' _ _
have e0 : g 0 = a := by show a + 0 * (3 * a) = a; lib_nat
rw [e1, e2, ← hm] at tb
have tb' : bal ((2 * r + 4) * (3 * a)) [g 0, g (r + 2), g (2 * r + 3)] = true := by rw [e0]; exact tb
have hA : bal ((2 * r + 4) * (3 * a)) [g (2 * r + 3), g (r + 2), g 0] = true := by
rw [← tb']; exact IndecPerm.bal_perm _ (rev3 _ _ _)
have hAB : bal ((2 * r + 4) * (3 * a)) ([g (2 * r + 3), g (r + 2), g 0] ++ ((X ++ Y) ++ [L])) = true := by
rw [← IndecPerm.bal_perm _ pc]; exact hc'
have hB := bal_cancel _ _ _ hA hAB
apply not_indec_of_perm _ pc
exact split_false _ _ _ _ (mem_left _ _ _ _ (mem_left _ _ _ _ (mem_left _ _ _ _ (mem_all_right _))))
(fun h => nomatch h) (fun h => by
cases X with
| nil => cases Y with
| nil => exact nomatch h
| cons _ _ => exact nomatch h
| cons _ _ => exact nomatch h) hA hB
/-- **Even q ≥ 6, 2k = 3a (k = 3b, a = 2b): the orbit character decomposes.** q = 2r + 6; the Triple members are
i = 0, q/2, q − 2. (For q = 4 the members q/2 and q − 2 coincide; that case is SplitFalse.q4_twothird.) -/
theorem even_twothird (r b : Nat) (hb : 0 < b) :
indec ((2 * r + 6) * (3 * b)) (gl (fun i => 2 * b + i * (3 * b)) (2 * r + 6) ++ [(2 * r + 6) * (3 * b) - (2 * r + 6) * (2 * b)]) = false := by
have hak : 2 * b < 3 * b := by
rw [show 3 * b = 2 * b + b by lib_nat]; exact Nat.lt_add_of_pos_right hb
have ha : 0 < 2 * b := Nat.mul_pos (Nat.succ_pos 1) hb
have hc := qfam_bal (2 * r + 6) (3 * b) (2 * b) (Nat.succ_pos _) ha hak
generalize hL : (2 * r + 6) * (3 * b) - (2 * r + 6) * (2 * b) = L at hc ⊢
let g : Nat → Nat := fun i => 2 * b + i * (3 * b)
have e : gl g (2 * r + 6) ++ [L]
= g (2 * r + 5) :: g (2 * r + 4) :: (gl (fun i => g (i + (r + 4))) r ++ g (r + 3) :: (gl (fun i => g (i + 1)) (r + 2) ++ g 0 :: [L])) := by
show g (2 * r + 5) :: g (2 * r + 4) :: gl g (2 * r + 4) ++ [L] = _
rw [show 2 * r + 4 = r + (r + 4) by lib_nat, gl_add g (r + 4) r]
show g (2 * r + 5) :: g (r + (r + 4)) :: ((gl (fun i => g (i + (r + 4))) r ++ (g (r + 3) :: gl g (r + 3))) ++ [L]) = _
rw [gl_snoc g (r + 2), show r + (r + 4) = 2 * r + 4 by lib_nat, app_assoc']
show g (2 * r + 5) :: g (2 * r + 4) :: (gl (fun i => g (i + (r + 4))) r ++ g (r + 3) :: ((gl (fun i => g (i + 1)) (r + 2) ++ [g 0]) ++ [L])) = _
rw [app_assoc']; rfl
have hc' : bal ((2 * r + 6) * (3 * b)) (gl g (2 * r + 6) ++ [L]) = true := hc
show indec ((2 * r + 6) * (3 * b)) (gl g (2 * r + 6) ++ [L]) = false
rw [e] at hc' ⊢
generalize gl (fun i => g (i + (r + 4))) r = X at hc' ⊢
generalize gl (fun i => g (i + 1)) (r + 2) = Y at hc' ⊢
have p1 : List.Perm (X ++ g (r + 3) :: (Y ++ g 0 :: [L])) (g (r + 3) :: g 0 :: ((X ++ Y) ++ [L])) := by
refine List.Perm.trans List.perm_middle (List.Perm.cons _ ?_)
rw [← app_assoc']
exact List.perm_middle
have p2 : List.Perm (g (2 * r + 5) :: g (r + 3) :: g 0 :: ((X ++ Y) ++ [L]))
(g (r + 3) :: g 0 :: g (2 * r + 5) :: ((X ++ Y) ++ [L])) :=
(List.perm_middle (a := g (2 * r + 5)) (l₁ := [g (r + 3), g 0]) (l₂ := (X ++ Y) ++ [L])).symm
have pc : List.Perm (g (2 * r + 5) :: g (2 * r + 4) :: (X ++ g (r + 3) :: (Y ++ g 0 :: [L])))
([g (2 * r + 4), g (r + 3), g 0] ++ (g (2 * r + 5) :: ((X ++ Y) ++ [L]))) :=
List.Perm.trans (List.Perm.swap _ _ _) (List.Perm.cons _ (List.Perm.trans (List.Perm.cons _ p1) p2))
have hm : (2 * r + 6) * (3 * b) = (r + 3) * (3 * b) + (r + 3) * (3 * b) := by lib_nat
have hpos : 0 < (r + 3) * (3 * b) := Nat.mul_pos (Nat.succ_pos _) (Nat.lt_of_lt_of_le ha (Nat.le_of_lt hak))
have hlt : 2 * b < (r + 3) * (3 * b) := Nat.lt_of_lt_of_le hak (by
have := Nat.mul_le_mul_right (3 * b) (show 1 ≤ r + 3 from Nat.succ_le_succ (Nat.zero_le _))
rw [Nat.one_mul] at this; exact this)
have tb := triple_bal' _ (2 * b) hpos ha hlt
have e1 : (r + 3) * (3 * b) + 2 * b = g (r + 3) := by show _ = 2 * b + (r + 3) * (3 * b); lib_nat
have e2 : (r + 3) * (3 * b) + (r + 3) * (3 * b) - (2 * b + 2 * b) = g (2 * r + 4) := by
show _ = 2 * b + (2 * r + 4) * (3 * b)
rw [show (r + 3) * (3 * b) + (r + 3) * (3 * b) = (2 * b + (2 * r + 4) * (3 * b)) + (2 * b + 2 * b) by lib_nat]
exact ModHand.add_sub' _ _
have e0 : g 0 = 2 * b := by show 2 * b + 0 * (3 * b) = 2 * b; lib_nat
rw [e1, e2, ← hm] at tb
have tb' : bal ((2 * r + 6) * (3 * b)) [g 0, g (r + 3), g (2 * r + 4)] = true := by rw [e0]; exact tb
have hA : bal ((2 * r + 6) * (3 * b)) [g (2 * r + 4), g (r + 3), g 0] = true := by
rw [← tb']; exact IndecPerm.bal_perm _ (rev3 _ _ _)
have hAB : bal ((2 * r + 6) * (3 * b)) ([g (2 * r + 4), g (r + 3), g 0] ++ (g (2 * r + 5) :: ((X ++ Y) ++ [L]))) = true := by
rw [← IndecPerm.bal_perm _ pc]; exact hc'
have hB := bal_cancel _ _ _ hA hAB
apply not_indec_of_perm _ pc
exact split_false _ _ _ _ (mem_left _ _ _ _ (mem_left _ _ _ _ (mem_left _ _ _ _ (mem_all_right _))))
(fun h => nomatch h) (fun h => nomatch h) hA hB
end EvenThird
#print axioms EvenThird.gl_add
#print axioms EvenThird.not_indec_of_perm
#print axioms EvenThird.even_third
#print axioms EvenThird.even_twothird
lean_all/hodge/ExistsIrr.lean
/-
hodge/ExistsIrr.lean — T41 cycle 295 (goal G38): for every m = 4q ≥ 32 the Fermat variety has a balanced (Hodge)
irreducible character of length 6, explicitly AP(m/4) + (m/2 + 4, m − 8).
Lean 4 core plus hodge/APPairGen (ap_pair_bal_gen), hodge/APPairIrrGen (fam1_indec_q), lib/Semi (lib_nat).
-/
import hodge.APPairGen
import hodge.APPairIrrGen
import hodge.APDoubleAll
import hodge.APDoubleAll5
import hodge.APDouble2
namespace ExistsIrr
open Indecomp
theorem exists_irr (q : Nat) (hq : 8 ≤ q) :
∃ c : List Nat, c.length = 6 ∧ bal (4 * q) c = true ∧ indec (4 * q) c = true := by
have ⟨r, hr⟩ := Nat.le.dest hq
have hb : 8 * 1 + (24 + 4 * r) = 4 * q := by rw [← hr]; lib_nat
have hb' : 8 + (24 + 4 * r) = 4 * q := by rw [← hr]; lib_nat
refine ⟨[1, 1 + q, 1 + 2 * q, 1 + 3 * q, 2 * q + 4 * 1, 24 + 4 * r], rfl, ?_, ?_⟩
· exact APPairGen.ap_pair_bal_gen q 1 (24 + 4 * r) (Nat.succ_pos 0)
(Nat.lt_of_lt_of_le (Nat.lt_of_lt_of_le (Nat.lt_succ_self 2) (Nat.le_add_left 3 5)) hq) hb
· have := APPairIrrGen.fam1_indec_q q (24 + 4 * r) hq hb'
rw [show 2 * q + 4 * 1 = 2 * q + 4 by lib_nat]; exact this
/-- **Threefolds (length 5): every m = 30 + 6r.** -/
theorem exists_irr5 (r : Nat) :
∃ c : List Nat, c.length = 5 ∧ bal (30 + 6 * r) c = true ∧ indec (30 + 6 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleAll.d3_both r
refine ⟨APDoubleIrr.co3.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 30 + 6 * r = 15 + 3 * r + (15 + 3 * r) by lib_nat]; exact h1
· rw [show 30 + 6 * r = 28 + 6 * r + 2 by lib_nat]; exact h2
/-- **Fivefolds (length 7): every m = 10p, p ≥ 9.** -/
theorem exists_irr7_even (r : Nat) :
∃ c : List Nat, c.length = 7 ∧ bal (100 + 20 * r) c = true ∧ indec (100 + 20 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleAll5.d5e_both r
refine ⟨APDoubleIrr5.coE.map (APDoubleIrr5.evE r), rfl, ?_, ?_⟩
· rw [show 100 + 20 * r = 50 + 10 * r + (50 + 10 * r) by lib_nat]; exact h1
· rw [show 100 + 20 * r = 98 + 20 * r + 2 by lib_nat]; exact h2
theorem exists_irr7_odd (r : Nat) :
∃ c : List Nat, c.length = 7 ∧ bal (90 + 20 * r) c = true ∧ indec (90 + 20 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleAll5.d5o_both r
refine ⟨APDoubleIrr5.coO.map (APDoubleIrr5.evE r), rfl, ?_, ?_⟩
· rw [show 90 + 20 * r = 45 + 10 * r + (45 + 10 * r) by lib_nat]; exact h1
· rw [show 90 + 20 * r = 88 + 20 * r + 2 by lib_nat]; exact h2
/-- **Length 8: every m = 78 + 6r.** -/
theorem exists_irr8 (r : Nat) :
∃ c : List Nat, c.length = 8 ∧ bal (78 + 6 * r) c = true ∧ indec (78 + 6 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleAll.d6_both r
refine ⟨APDoubleIrr.co6.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 78 + 6 * r = 39 + 3 * r + (39 + 3 * r) by lib_nat]; exact h1
· rw [show 78 + 6 * r = 76 + 6 * r + 2 by lib_nat]; exact h2
/-- **Length 10: every m = 128 + 8r.** -/
theorem exists_irr10 (r : Nat) :
∃ c : List Nat, c.length = 10 ∧ bal (128 + 8 * r) c = true ∧ indec (128 + 8 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleAll.d8_both r
refine ⟨APDoubleIrr.co8.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 128 + 8 * r = 64 + 4 * r + (64 + 4 * r) by lib_nat]; exact h1
· rw [show 128 + 8 * r = 126 + 8 * r + 2 by lib_nat]; exact h2
/-- **Length 4 (surfaces): every m = 10 + 2r.** -/
theorem exists_irr4 (r : Nat) :
∃ c : List Nat, c.length = 4 ∧ bal (10 + 2 * r) c = true ∧ indec (10 + 2 * r) c = true := by
have ⟨h1, h2⟩ := APDouble2.d2_both r
refine ⟨APDouble2.co2.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 10 + 2 * r = 5 + r + (5 + r) by lib_nat]; exact h1
· rw [show 10 + 2 * r = 8 + 2 * r + 2 by lib_nat]; exact h2
end ExistsIrr
#print axioms ExistsIrr.exists_irr
#print axioms ExistsIrr.exists_irr5
#print axioms ExistsIrr.exists_irr7_even
#print axioms ExistsIrr.exists_irr7_odd
#print axioms ExistsIrr.exists_irr8
#print axioms ExistsIrr.exists_irr10
#print axioms ExistsIrr.exists_irr4
lean_all/hodge/ExistsIrr2.lean
/-
hodge/ExistsIrr2.lean — T41 cycle 312 (goal G50): balanced irreducible characters of lengths 9, 11, 12 for every
m = 182 + 14r, 306 + 18r, 200 + 10r (APDoubleMore, a = 1). With ExistsIrr: lengths 4–12 all covered; 13, 14
(d = 11, 12: APDoubleMore2, Kamiak).
-/
import hodge.APDoubleMore
namespace ExistsIrr2
open Indecomp
theorem exists_irr9 (r : Nat) :
∃ c : List Nat, c.length = 9 ∧ bal (182 + 14 * r) c = true ∧ indec (182 + 14 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleMore.d7_both r
refine ⟨APDoubleMore.co7.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 182 + 14 * r = 91 + 7 * r + (91 + 7 * r) by lib_nat]; exact h1
· rw [show 182 + 14 * r = 180 + 14 * r + 2 by lib_nat]; exact h2
theorem exists_irr11 (r : Nat) :
∃ c : List Nat, c.length = 11 ∧ bal (306 + 18 * r) c = true ∧ indec (306 + 18 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleMore.d9_both r
refine ⟨APDoubleMore.co9.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 306 + 18 * r = 153 + 9 * r + (153 + 9 * r) by lib_nat]; exact h1
· rw [show 306 + 18 * r = 304 + 18 * r + 2 by lib_nat]; exact h2
theorem exists_irr12 (r : Nat) :
∃ c : List Nat, c.length = 12 ∧ bal (200 + 10 * r) c = true ∧ indec (200 + 10 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleMore.d10_both r
refine ⟨APDoubleMore.co10.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 200 + 10 * r = 100 + 5 * r + (100 + 5 * r) by lib_nat]; exact h1
· rw [show 200 + 10 * r = 198 + 10 * r + 2 by lib_nat]; exact h2
end ExistsIrr2
#print axioms ExistsIrr2.exists_irr9
#print axioms ExistsIrr2.exists_irr11
#print axioms ExistsIrr2.exists_irr12
lean_all/hodge/ExistsIrr3.lean
/-
hodge/ExistsIrr3.lean — T41 cycle 331 (goal G66, Kamiak): balanced irreducible characters of lengths 13 and 14 for
every m = 462 + 22r and 288 + 12r (APDoubleMore2, d = 11, 12, a = 1). With ExistsIrr/ExistsIrr2: lengths 4–14.
-/
import hodge.APDoubleMore2
namespace ExistsIrr3
open Indecomp
theorem exists_irr13 (r : Nat) :
∃ c : List Nat, c.length = 13 ∧ bal (462 + 22 * r) c = true ∧ indec (462 + 22 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleMore2.d11_both r
refine ⟨APDoubleMore2.co11.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 462 + 22 * r = 231 + 11 * r + (231 + 11 * r) by lib_nat]; exact h1
· rw [show 462 + 22 * r = 460 + 22 * r + 2 by lib_nat]; exact h2
theorem exists_irr14 (r : Nat) :
∃ c : List Nat, c.length = 14 ∧ bal (288 + 12 * r) c = true ∧ indec (288 + 12 * r) c = true := by
have ⟨h1, h2⟩ := APDoubleMore2.d12_both r
refine ⟨APDoubleMore2.co12.map (APPairIrrGen.ev r), rfl, ?_, ?_⟩
· rw [show 288 + 12 * r = 144 + 6 * r + (144 + 6 * r) by lib_nat]; exact h1
· rw [show 288 + 12 * r = 286 + 12 * r + 2 by lib_nat]; exact h2
end ExistsIrr3
#print axioms ExistsIrr3.exists_irr13
#print axioms ExistsIrr3.exists_irr14
lean_all/hodge/FamArith.lean
/-
hodge/FamArith.lean — T41 cycle 1151 (goal G749b, step 3a): arithmetic for the balancedness of the family F_p.
cop_right gcd t (a·p) = 1 ⇒ gcd t p = 1 cop_left ⇒ gcd t a = 1
mul_mod' (t·x) % n = ((t % n)·(x % n)) % n (hand, n > 0)
lin_mod' (t·x + 6t) % n = ((t % n)·(x % n) + 6·(t % n)) % n
unit14 gcd t 14 = 1 ⇒ t % 14 ∈ [1, 3, 5, 9, 11, 13]
gl_tsum tsum m t (gl g n) = Σ_{k<n} (t·g k) % m
sumF_replace f = g off the index i₀ < n ⇒ Σ_{k<n} f + g i₀ = Σ_{k<n} g + f i₀
Lean 4 core plus hodge/FamMod, hodge/UnitMul (gcd_dvd, one_of_dvd_one), hodge/APPair1 (dvd_gcd), hodge/Indecomp (tsum).
-/
import hodge.FamMod
import hodge.UnitMul
import hodge.Indecomp
namespace FamArith
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod Indecomp
theorem cop_right (t a p : Nat) (h : Nat.gcd t (a * p) = 1) : Nat.gcd t p = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := UnitMul.gcd_dvd t p
have ⟨c, hc⟩ := APPair1.dvd_gcd (Nat.gcd t p) t (a * p) ⟨i, hi⟩ ⟨a * j, by
calc a * p = a * (Nat.gcd t p * j) := by rw [← hj]
_ = Nat.gcd t p * (a * j) := by lib_nat⟩
rw [h] at hc
exact UnitMul.one_of_dvd_one _ c hc
theorem cop_left (t a p : Nat) (h : Nat.gcd t (a * p) = 1) : Nat.gcd t a = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := UnitMul.gcd_dvd t a
have ⟨c, hc⟩ := APPair1.dvd_gcd (Nat.gcd t a) t (a * p) ⟨i, hi⟩ ⟨j * p, by
calc a * p = (Nat.gcd t a * j) * p := by rw [← hj]
_ = Nat.gcd t a * (j * p) := by lib_nat⟩
rw [h] at hc
exact UnitMul.one_of_dvd_one _ c hc
theorem mul_mod' (n t x : Nat) (hn : 0 < n) : (t * x) % n = ((t % n) * (x % n)) % n := by
have ⟨a, ha⟩ := div_mod n hn (t + 1) t (Nat.lt_succ_self t)
have ⟨b, hb⟩ := div_mod n hn (x + 1) x (Nat.lt_succ_self x)
generalize t % n = r at ha ⊢
generalize x % n = s at hb ⊢
subst ha; subst hb
have e : (r + n * a) * (s + n * b) = r * s + (a * s + r * b + n * a * b) * n := by lib_nat
rw [e, add_mul_mod' _ _ hn]
theorem lin_mod' (n t x : Nat) (hn : 0 < n) : (t * x + 6 * t) % n = ((t % n) * (x % n) + 6 * (t % n)) % n := by
have ⟨a, ha⟩ := div_mod n hn (t + 1) t (Nat.lt_succ_self t)
have ⟨b, hb⟩ := div_mod n hn (x + 1) x (Nat.lt_succ_self x)
generalize t % n = r at ha ⊢
generalize x % n = s at hb ⊢
subst ha; subst hb
have e : (r + n * a) * (s + n * b) + 6 * (r + n * a) = (r * s + 6 * r) + (a * s + r * b + n * a * b + 6 * a) * n := by lib_nat
rw [e, add_mul_mod' _ _ hn]
theorem no_common (t d e f : Nat) (h : Nat.gcd t 14 = 1) (ht : t = d * e) (h14 : 14 = d * f) (hd : 2 ≤ d) : False := by
have ⟨c, hc⟩ := APPair1.dvd_gcd d t 14 ⟨e, ht⟩ ⟨f, h14⟩
rw [h] at hc
exact APPair1.one_eq_mul d c hc hd
theorem unit14 (t : Nat) (h : Nat.gcd t 14 = 1) : t % 14 ∈ [1, 3, 5, 9, 11, 13] := by
have hr : t % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (t + 1) t (Nat.lt_succ_self t)
generalize t % 14 = r at hr hq ⊢
have two : 2 ≤ 2 := Nat.le_refl 2
have seven : 2 ≤ 7 := Nat.le_succ_of_le (Nat.le_succ_of_le (Nat.le_succ_of_le (Nat.le_succ_of_le (Nat.le_succ_of_le (Nat.le_refl 2)))))
match r, hr with
| 0, _ => exact (no_common t 2 (7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 1, _ => exact List.Mem.head _
| 2, _ => exact (no_common t 2 (1 + 7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 3, _ => exact List.Mem.tail _ (List.Mem.head _)
| 4, _ => exact (no_common t 2 (2 + 7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 5, _ => exact List.Mem.tail _ (List.Mem.tail _ (List.Mem.head _))
| 6, _ => exact (no_common t 2 (3 + 7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 7, _ => exact (no_common t 7 (1 + 2 * q) 2 h (by rw [hq]; lib_nat) rfl seven).elim
| 8, _ => exact (no_common t 2 (4 + 7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 9, _ => exact List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.head _)))
| 10, _ => exact (no_common t 2 (5 + 7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 11, _ => exact List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.head _))))
| 12, _ => exact (no_common t 2 (6 + 7 * q) 7 h (by rw [hq]; lib_nat) rfl two).elim
| 13, _ => exact List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.tail _ (List.Mem.head _)))))
| r + 14, hr' => exact absurd hr' (Nat.not_lt.mpr (Nat.le_add_left 14 r))
theorem gl_tsum (m t : Nat) (g : Nat → Nat) : ∀ n, tsum m t (gl g n) = sumF (fun k => (t * g k) % m) n
| 0 => rfl
| n + 1 => by
show (t * g n) % m + tsum m t (gl g n) = sumF (fun k => (t * g k) % m) n + (t * g n) % m
rw [gl_tsum m t g n]; lib_nat
theorem sumF_congr_lt (f g : Nat → Nat) : ∀ n, (∀ k, k < n → f k = g k) → sumF f n = sumF g n
| 0, _ => rfl
| n + 1, h => by
show sumF f n + f n = sumF g n + g n
rw [sumF_congr_lt f g n (fun k hk => h k (Nat.lt_succ_of_lt hk)), h n (Nat.lt_succ_self n)]
theorem sumF_replace (f g : Nat → Nat) (i0 : Nat) (h : ∀ k, k ≠ i0 → f k = g k) : ∀ n, i0 < n →
sumF f n + g i0 = sumF g n + f i0
| 0, hi => absurd hi (Nat.not_lt_zero _)
| n + 1, hi => by
show sumF f n + f n + g i0 = sumF g n + g n + f i0
cases Nat.lt_or_ge i0 n with
| inl hlt =>
have ih := sumF_replace f g i0 h n hlt
have e := h n (fun e => Nat.lt_irrefl n (e ▸ hlt))
rw [e]
calc sumF f n + g n + g i0 = (sumF f n + g i0) + g n := by lib_nat
_ = (sumF g n + f i0) + g n := by rw [ih]
_ = _ := by lib_nat
| inr hge =>
have e0 : i0 = n := Nat.le_antisymm (Nat.le_of_lt_succ hi) hge
subst e0
rw [sumF_congr_lt f g i0 (fun k hk => h k (fun e => Nat.lt_irrefl k (e ▸ hk)))]
lib_nat
end FamArith
#print axioms FamArith.cop_right
#print axioms FamArith.cop_left
#print axioms FamArith.mul_mod'
#print axioms FamArith.lin_mod'
#print axioms FamArith.no_common
#print axioms FamArith.unit14
#print axioms FamArith.gl_tsum
#print axioms FamArith.sumF_congr_lt
#print axioms FamArith.sumF_replace
lean_all/hodge/FamBal.lean
/-
hodge/FamBal.lean — T41 cycle 1153 (goal G749b — the balancedness of the family): for every p > 0 and index i₀ < p
with 1 + 14·i₀ = p·x₀ and x₀ mod 14 ∈ {1, 3, 5} (i.e. p mod 14 ∈ {1, 5, 3} when gcd(p, 14) = 1), the character
F_p = {1 + 14k : k < p, k ≠ i₀} ∪ {1 + 14·i₀ + 6p} ⊂ Z/14p
is balanced:
fam_bal bal (14p) (fam p i₀) = true.
For every unit t of 14p (r = t mod 14 ∈ {1,3,5,9,11,13}, gcd(t, p) = 1) the unit sum is
Σ_coset − p·(rs mod 14) + p·((rs + 6r) mod 14) = 7p + 14·Σ_{i<p} i = 7p² by FamMod.coset_sum and the finite
table FamMod.fcond. With hodge/SeedFam this covers the open m = 70 seed (p = 5) and m = 42, 238, 266, … .
Lean 4 core plus hodge/FamArith, hodge/FamMod, hodge/FermatPrime (units).
-/
import hodge.FamArith
namespace FamBal
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp
def fam (p i0 : Nat) : List Nat := gl (fun k => if Nat.beq k i0 then 1 + 14 * k + 6 * p else 1 + 14 * k) p
theorem add_right_cancel' (n k : Nat) : ∀ m, n + m = k + m → n = k
| 0, h => h
| m + 1, h => add_right_cancel' n k m (Nat.succ.inj h)
theorem beq_refl' : ∀ n : Nat, Nat.beq n n = true
| 0 => rfl
| n + 1 => beq_refl' n
theorem all_filter (pr P : Nat → Bool) (h : ∀ t, pr t = true → P t = true) : ∀ l : List Nat, (l.filter pr).all P = true
| [] => rfl
| x :: l => by
cases hx : pr x with
| false =>
have e : (x :: l).filter pr = l.filter pr := by show (match pr x with | true => x :: l.filter pr | false => l.filter pr) = _; rw [hx]
rw [e]; exact all_filter pr P h l
| true =>
have e : (x :: l).filter pr = x :: l.filter pr := by show (match pr x with | true => x :: l.filter pr | false => l.filter pr) = _; rw [hx]
rw [e]
show (P x && (l.filter pr).all P) = true
rw [h x hx, all_filter pr P h l]; rfl
theorem all_mem (P : Nat → Bool) : ∀ (l : List Nat), l.all P = true → ∀ r, r ∈ l → P r = true
| [], _, _, h => nomatch h
| x :: l, hl, r, hr => by
have hx : P x = true ∧ l.all P = true := by
cases e1 : P x with
| false => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact nomatch hl
| true => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact ⟨rfl, hl⟩
cases hr with
| head => exact hx.1
| tail _ h' => exact all_mem P l hx.2 r h'
theorem sum_id : ∀ p, sumF (fun i => i) p + sumF (fun i => i) p + p = p * p
| 0 => rfl
| p + 1 => by
show (sumF (fun i => i) p + p) + (sumF (fun i => i) p + p) + (p + 1) = (p + 1) * (p + 1)
have ih := sum_id p
calc (sumF (fun i => i) p + p) + (sumF (fun i => i) p + p) + (p + 1)
= (sumF (fun i => i) p + sumF (fun i => i) p + p) + (p + p + 1) := by lib_nat
_ = p * p + (p + p + 1) := by rw [ih]
_ = _ := by lib_nat
/-- the unit sum of F_p for one unit t -/
theorem fam_tsum (p i0 x0 t : Nat) (hp : 0 < p) (hi : i0 < p) (hx : 1 + 14 * i0 = p * x0)
(hs : fcond (x0 % 14) = true) (ht : Nat.gcd t (14 * p) = 1) :
tsum (14 * p) t (fam p i0) + tsum (14 * p) t (fam p i0) = p * (14 * p) := by
have htp : Nat.gcd t p = 1 := cop_right t 14 p ht
have ht14 : Nat.gcd t 14 = 1 := cop_left t 14 p ht
have hr := unit14 t ht14
have h14 : 0 < 14 := Nat.succ_pos 13
-- the condition for r = t mod 14
have cond := Nat.eq_of_beq_eq_true (all_mem _ [1, 3, 5, 9, 11, 13] hs (t % 14) hr)
-- the sum as sumF, and the replacement
unfold fam
rw [gl_tsum]
have rep := sumF_replace (fun k => (t * (if Nat.beq k i0 then 1 + 14 * k + 6 * p else 1 + 14 * k)) % (14 * p))
(fun k => (t * (1 + 14 * k)) % (14 * p)) i0 (fun k hk => by
have : Nat.beq k i0 = false := by
cases e : Nat.beq k i0 with
| false => rfl
| true => exact absurd (Nat.eq_of_beq_eq_true e) hk
show (t * (if Nat.beq k i0 = true then _ else _)) % _ = _
rw [this]; rfl) p hi
rw [coset_sum t p hp htp] at rep
have bi : Nat.beq i0 i0 = true := beq_refl' i0
have f0 : (t * (if Nat.beq i0 i0 = true then 1 + 14 * i0 + 6 * p else 1 + 14 * i0)) % (14 * p)
= p * (((t % 14) * (x0 % 14) + 6 * (t % 14)) % 14) := by
rw [bi]
show (t * (1 + 14 * i0 + 6 * p)) % (14 * p) = _
have e : t * (1 + 14 * i0 + 6 * p) = p * (t * x0 + 6 * t) := by
calc t * (1 + 14 * i0 + 6 * p) = t * (1 + 14 * i0) + 6 * p * t := by lib_nat
_ = t * (p * x0) + 6 * p * t := by rw [hx]
_ = _ := by lib_nat
rw [e, mod_pmul p _ hp, lin_mod' 14 t x0 h14]
have g0 : (t * (1 + 14 * i0)) % (14 * p) = p * (((t % 14) * (x0 % 14)) % 14) := by
have e : t * (1 + 14 * i0) = p * (t * x0) := by rw [hx]; lib_nat
rw [e, mod_pmul p _ hp, mul_mod' 14 t x0 h14]
have rep' : sumF (fun k => (t * (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k)) % (14 * p)) p
+ (t * (1 + 14 * i0)) % (14 * p)
= p * (t % 14) + 14 * sumF (fun i => i) p + (t * (if Nat.beq i0 i0 = true then 1 + 14 * i0 + 6 * p else 1 + 14 * i0)) % (14 * p) := rep
rw [f0, g0] at rep'
-- rep' : T + p·u = p·r + 14·S + p·u' with r + u' = 7 + u
generalize sumF (fun k => (t * (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k)) % (14 * p)) p = T at rep' ⊢
generalize ((t % 14) * (x0 % 14)) % 14 = u at rep' cond
generalize ((t % 14) * (x0 % 14) + 6 * (t % 14)) % 14 = u' at rep' cond
generalize t % 14 = r at rep' cond
have sid := sum_id p
generalize sumF (fun i => i) p = S at rep' sid
have hT : T = 7 * p + 14 * S := by
apply add_right_cancel' T (7 * p + 14 * S) (p * u)
calc T + p * u = p * r + 14 * S + p * u' := rep'
_ = p * (r + u') + 14 * S := by lib_nat
_ = p * (7 + u) + 14 * S := by rw [cond]
_ = _ := by lib_nat
rw [hT]
calc 7 * p + 14 * S + (7 * p + 14 * S) = 14 * (S + S + p) := by lib_nat
_ = 14 * (p * p) := by rw [sid]
_ = _ := by lib_nat
/-- **The family F_p is balanced.** -/
theorem fam_bal (p i0 x0 : Nat) (hp : 0 < p) (hi : i0 < p) (hx : 1 + 14 * i0 = p * x0)
(hs : fcond (x0 % 14) = true) : bal (14 * p) (fam p i0) = true := by
unfold bal FermatPrime.units
apply all_filter
intro t ht
have hg : Nat.gcd t (14 * p) = 1 := Nat.eq_of_beq_eq_true ht
have e := fam_tsum p i0 x0 t hp hi hx hs hg
have hl : (fam p i0).length = p := gl_len _ p
rw [hl, e]
exact beq_refl' _
/-- instances: p = 5 (the m = 70 seed), p = 17 (m = 238), p = 29 (m = 406) -/
theorem inst5 : bal 70 (fam 5 1) = true := fam_bal 5 1 3 (Nat.succ_pos 4) (Nat.succ_lt_succ (Nat.succ_pos 3)) rfl rfl
theorem inst17 : bal 238 (fam 17 6) = true := fam_bal 17 6 5 (Nat.succ_pos 16) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 6) (Nat.le_add_left 7 10)) rfl rfl
theorem inst29 : bal 406 (fam 29 2) = true := fam_bal 29 2 1 (Nat.succ_pos 28) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 2) (Nat.le_add_left 3 26)) rfl rfl
theorem fam5_eq : fam 5 1 = [57, 43, 29, 45, 1] := rfl
end FamBal
#print axioms FamBal.add_right_cancel'
#print axioms FamBal.beq_refl'
#print axioms FamBal.all_filter
#print axioms FamBal.all_mem
#print axioms FamBal.sum_id
#print axioms FamBal.fam_tsum
#print axioms FamBal.fam_bal
#print axioms FamBal.inst5
#print axioms FamBal.inst17
#print axioms FamBal.inst29
#print axioms FamBal.fam5_eq
lean_all/hodge/FamBridge.lean
/-
hodge/FamBridge.lean — T41 cycle 2018 (goal G865e): from balance to the rank certificate. For a list xs of residues
mod M (the first n − 1 elements of F′_p), a last element ℓ ∉ xs, unit columns C, and a list S with entries in xs or
ℓ that is balanced at every t ∈ C (2·T_t(S) = |S|·M), the counts g_x = #x(S) (x ∈ xs) and e = #ℓ(S) satisfy the
certificate equations A g = −e·cl (A = rows 2⟨t x⟩ − M, cl = 2⟨t ℓ⟩ − M); with a certificate B A = d I, B cl = −d·1
(hodge/FamCert<p>), MailletLin2.affine_fix gives
fam_counts every x ∈ xs occurs in S exactly as often as ℓ,
i.e. a balanced subset of F′_p is ∅ or all of F′_p: F′_p is indecomposable (G865 for p = 15, 29, 43).
Lean 4 core, hand proofs, no axioms; the per-x facts row_t · e_y are finite checks (rfl in the instance file).
-/
import hodge.MailletLin2
import hodge.MailletBridge
namespace FamBridge
open LibInt MailletLin MailletLin1 MailletLin2 MailletBridge
/-- counts of the elements of xs in S -/
def gv (xs S : List Nat) : List Int := xs.map (fun x => (cnt x S : Int))
/-- indicator of y on xs -/
def ev (xs : List Nat) (y : Nat) : List Int := xs.map (fun x => ind (Nat.beq x y))
/-- the all-ones vector -/
def ones : Nat → List Int
| 0 => []
| n + 1 => 1 :: ones n
theorem gv_nil : ∀ xs : List Nat, gv xs [] = zeros xs.length
| [] => rfl
| _ :: xs => by
show ((0 : Nat) : Int) :: gv xs [] = 0 :: zeros xs.length
rw [gv_nil xs]; rfl
theorem gv_cons (y : Nat) (S : List Nat) : ∀ xs : List Nat, gv xs (y :: S) = addV (gv xs S) (ev xs y)
| [] => rfl
| x :: xs => by
show ((cond (Nat.beq x y) 1 0 + cnt x S : Nat) : Int) :: gv xs (y :: S)
= ((cnt x S : Int) + ind (Nat.beq x y)) :: addV (gv xs S) (ev xs y)
rw [gv_cons y S xs, natCast_add, cond_cast]
generalize ind (Nat.beq x y) = a
generalize ((cnt x S : Nat) : Int) = u
have e : a + u = u + a := by lib_int
rw [e]
theorem len_ones : ∀ n : Nat, (ones n).length = n
| 0 => rfl
| n + 1 => by show (ones n).length + 1 = n + 1; rw [len_ones n]
theorem len_gv (xs S : List Nat) : (gv xs S).length = xs.length := len_map _ xs
theorem len_ev (xs : List Nat) (y : Nat) : (ev xs y).length = xs.length := len_map _ xs
theorem beq_false_of_ne {a b : Nat} (h : a ≠ b) : Nat.beq a b = false := by
cases e : Nat.beq a b with
| false => rfl
| true => exact absurd (beq_eq a b e) h
/-- Σ_{y∈S} (2⟨t y⟩ − M) splits into the xs part and the ℓ part. -/
theorem sumT_split (M t ℓ : Nat) (xs : List Nat)
(hrow : ∀ y, y ∈ xs → dot (rowA M t xs) (ev xs y) = 2 * (((t * y) % M : Nat) : Int) - (M : Int))
(hl : dot (rowA M t xs) (ev xs ℓ) = 0) (hne : ∀ y, y ∈ xs → ℓ ≠ y) :
∀ S : List Nat, (∀ y, y ∈ S → y ∈ xs ∨ y = ℓ) →
sumT M t S = dot (rowA M t xs) (gv xs S) + (2 * (((t * ℓ) % M : Nat) : Int) - (M : Int)) * (cnt ℓ S : Int)
| [], _ => by
rw [gv_nil]
show (0 : Int) = dot (rowA M t xs) (zeros xs.length) + _ * ((0 : Nat) : Int)
rw [dot_zeros_right]
generalize (2 * (((t * ℓ) % M : Nat) : Int) - (M : Int)) = c
show (0 : Int) = 0 + c * 0
lib_int
| y :: S, hS => by
have ih := sumT_split M t ℓ xs hrow hl hne S (fun z hz => hS z (List.Mem.tail _ hz))
show (2 * (((t * y) % M : Nat) : Int) - (M : Int)) + sumT M t S
= dot (rowA M t xs) (gv xs (y :: S)) + _ * ((cond (Nat.beq ℓ y) 1 0 + cnt ℓ S : Nat) : Int)
rw [gv_cons, dot_addV_r _ _ _ (by rw [len_gv, len_ev]), natCast_add, cond_cast, ih]
cases hS y (List.Mem.head _) with
| inl hy =>
rw [hrow y hy, beq_false_of_ne (hne y hy)]
show _ = _ + _ + _ * ((0 : Int) + _)
generalize dot (rowA M t xs) (gv xs S) = P
generalize (2 * (((t * y) % M : Nat) : Int) - (M : Int)) = a
generalize (2 * (((t * ℓ) % M : Nat) : Int) - (M : Int)) = c
generalize ((cnt ℓ S : Nat) : Int) = k
lib_int
| inr hy =>
subst hy
rw [hl, beq_refl]
show _ = _ + _ * ((1 : Int) + _)
generalize dot (rowA M t xs) (gv xs S) = P
generalize (2 * (((t * y) % M : Nat) : Int) - (M : Int)) = c
generalize ((cnt y S : Nat) : Int) = k
lib_int
/-- mv over a mapped row family -/
theorem mv_map (row : Nat → List Int) (g : List Int) : ∀ C : List Nat,
mv (C.map row) g = C.map (fun t => dot (row t) g)
| [] => rfl
| t :: C => by
show dot (row t) g :: mv (C.map row) g = dot (row t) g :: C.map (fun t => dot (row t) g)
rw [mv_map row g C]
theorem smul_smul (a b : Int) : ∀ v : List Int, smul a (smul b v) = smul (a * b) v
| [] => rfl
| x :: xs => by
show (a * (b * x)) :: smul a (smul b xs) = (a * b * x) :: smul (a * b) xs
rw [smul_smul a b xs]
have e : a * (b * x) = a * b * x := by lib_int
rw [e]
theorem len_smul' (c : Int) (v : List Int) : (smul c v).length = v.length := len_smul c v
theorem smul_cancel (d : Int) (hd : d ≠ 0) : ∀ u v : List Int, u.length = v.length → smul d u = smul d v → u = v
| [], [], _, _ => rfl
| [], _ :: _, h, _ => Nat.noConfusion h
| _ :: _, [], h, _ => Nat.noConfusion h
| x :: xs, y :: ys, hl, h => by
have h1 : d * x = d * y := List.cons.inj h |>.1
have h2 : smul d xs = smul d ys := List.cons.inj h |>.2
have h3 : d * (x - y) = 0 := by
have e : d * (x - y) = d * x - d * y := by lib_int
rw [e, h1]; lib_int
have hxy : x = y := by
cases int_noZD d (x - y) h3 with
| inl h => exact absurd h hd
| inr h =>
calc x = (x - y) + y := by lib_int
_ = 0 + y := by rw [h]; rfl
_ = y := by lib_int
rw [hxy, smul_cancel d hd xs ys (Nat.succ.inj hl) h2]
/-- the certificate equations, column by column -/
theorem cols_eq (M ℓ : Nat) (xs : List Nat) (g : List Int) (e : Int) :
∀ C : List Nat, (∀ t, t ∈ C → dot (rowA M t xs) g = -e * (2 * (((t * ℓ) % M : Nat) : Int) - (M : Int))) →
C.map (fun t => dot (rowA M t xs) g) = smul (-e) (C.map (fun t => 2 * (((t * ℓ) % M : Nat) : Int) - (M : Int)))
| [], _ => rfl
| t :: C, h => by
show dot (rowA M t xs) g :: C.map (fun t => dot (rowA M t xs) g)
= (-e * (2 * (((t * ℓ) % M : Nat) : Int) - (M : Int))) :: smul (-e) (C.map (fun t => 2 * (((t * ℓ) % M : Nat) : Int) - (M : Int)))
rw [h t (List.Mem.head _), cols_eq M ℓ xs g e C (fun t' ht' => h t' (List.Mem.tail _ ht'))]
/-- **A balanced list over xs ∪ {ℓ} has equal counts.** -/
theorem fam_counts (M ℓ : Nat) (xs C : List Nat) (d : Int) (hd : d ≠ 0) (B : List (List Int))
(hA : allLen xs.length (C.map (fun t => rowA M t xs)) = true)
(hc : lcs xs.length B (C.map (fun t => rowA M t xs)) = sid d xs.length)
(hW : mv B (C.map (fun t => 2 * (((t * ℓ) % M : Nat) : Int) - (M : Int))) = smul (-d) (ones xs.length))
(hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs → dot (rowA M t xs) (ev xs y) = 2 * (((t * y) % M : Nat) : Int) - (M : Int))
(hl : ∀ t, t ∈ C → dot (rowA M t xs) (ev xs ℓ) = 0) (hne : ∀ y, y ∈ xs → ℓ ≠ y)
(S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = ℓ)
(hbal : ∀ t, t ∈ C → tsum M t S + tsum M t S = S.length * M) :
gv xs S = smul (cnt ℓ S : Int) (ones xs.length) := by
have eqs : mv (C.map (fun t => rowA M t xs)) (gv xs S)
= smul (-(cnt ℓ S : Int)) (C.map (fun t => 2 * (((t * ℓ) % M : Nat) : Int) - (M : Int))) := by
rw [mv_map]
apply cols_eq
intro t ht
have sp := sumT_split M t ℓ xs (hrow t ht) (hl t ht) hne S hS
rw [sumT_zero M t S (hbal t ht)] at sp
generalize dot (rowA M t xs) (gv xs S) = P at sp ⊢
generalize (2 * (((t * ℓ) % M : Nat) : Int) - (M : Int)) = c at sp ⊢
generalize ((cnt ℓ S : Nat) : Int) = k at sp ⊢
have e : P = P + c * k - c * k := by lib_int
rw [e, ← sp]; lib_int
have af := affine_fix xs.length d (-(cnt ℓ S : Int)) _ B hA hc _ _ hW (gv xs S) (len_gv xs S) eqs
rw [smul_smul] at af
have e1 : -(cnt ℓ S : Int) * -d = d * (cnt ℓ S : Int) := by lib_int
rw [e1, ← smul_smul] at af
have hlen1 : (smul (cnt ℓ S : Int) (ones xs.length)).length = (ones xs.length).length := len_smul _ _
have hlen : (gv xs S).length = (smul (cnt ℓ S : Int) (ones xs.length)).length := by
rw [len_gv, hlen1, len_ones]
exact smul_cancel d hd _ _ hlen af
end FamBridge
#print axioms FamBridge.gv_nil
#print axioms FamBridge.gv_cons
#print axioms FamBridge.len_ones
#print axioms FamBridge.len_gv
#print axioms FamBridge.len_ev
#print axioms FamBridge.beq_false_of_ne
#print axioms FamBridge.sumT_split
#print axioms FamBridge.mv_map
#print axioms FamBridge.smul_smul
#print axioms FamBridge.len_smul'
#print axioms FamBridge.smul_cancel
#print axioms FamBridge.cols_eq
#print axioms FamBridge.fam_counts
lean_all/hodge/FamCert113.lean
/- hodge/FamCert113.lean — T41 (goal G865d): rank certificate for the balance matrix of F′_113 (n = 112): the rows of A (balance equations on 111 unit columns, restricted to the first 111 elements of F′_113) combine under the integer matrix B to d·I, d = 646701086328051203347283892188685850560, and B applied to the last element's column values is W (tools/g865_cert.py). With hodge/MailletLin1.kernel_affine: every balanced 0/1 indicator is fixed by its last entry. Lean 4 core, rfl. -/ import hodge.MailletLin1 set_option maxHeartbeats 0 set_option maxRecDepth 100000 namespace FamCert113 open MailletLin def A : List (List Int) := [[-1580, -1552, -1524, -1496, -1468, -1440, -1412, -1384, -1328, -1300, -1272, -1244, -1216, -1188, -1160, -1132, -1104, -1076, -1048, -1020, -992, -964, -936, -908, -880, -852, -824, -796, -768, -740, -712, -684, -656, -628, -600, -572, -544, -516, -488, -460, -432, -404, -376, -348, -320, -292, -264, -236, -208, -180, -152, -124, -96, -68, -40, -12, 16, 44, 72, 100, 12 -- (+71318 chars; full line in the Zenodo source) def B : List (List Int) := [[106317641163899793646338411751586814, -110199572238170468919583564459398878, 24471165773845097785414549510243786, 29835790673352287206185846553108728, 138439531899700141517483005951625778, 70742871717941605488334118748242392, 277547099098056710103752996874683146, -111340502468762755057684059273340564, -13800098732098951444448242902702900, -13738550155027128401141740722 -- (+463590 chars; full line in the Zenodo source) def cl : List Int := [1556, 1504, 1452, 1348, 1296, 1244, 1192, 1140, 1088, 984, 932, 880, 828, 776, 724, 620, 568, 516, 464, 412, 360, 256, 204, 152, 100, 48, -4, -108, -160, -212, -264, -316, -368, -472, -524, -576, -628, -680, -732, -836, -888, -940, -992, -1044, -1096, -1200, -1252, -1304, -1408, -1460, -1564, 1548, 1496, 1444, 1392, 1340, 1236, 1184, 1132, 1080, 1028, 976, 872, 820, 768, 716, -- (+266 chars; full line in the Zenodo source) def W : List Int := [-646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, -646701086328051203347283892188685850560, - -- (+4282 chars; full line in the Zenodo source) theorem allLen_A : allLen 111 A = true := rfl theorem cert : lcs 111 B A = sid 646701086328051203347283892188685850560 111 := rfl theorem w_eq : mv B cl = W := rfl end FamCert113 #print axioms FamCert113.allLen_A #print axioms FamCert113.cert #print axioms FamCert113.w_eq
lean_all/hodge/FamCert127.lean
/- hodge/FamCert127.lean — T41 (goal G865d): rank certificate for the balance matrix of F′_127 (n = 126): the rows of A (balance equations on 125 unit columns, restricted to the first 125 elements of F′_127) combine under the integer matrix B to d·I, d = 43695760204506482216150656097585456725303823520, and B applied to the last element's column values is W (tools/g865_cert.py). With hodge/MailletLin1.kernel_affine: every balanced 0/1 indicator is fixed by its last entry. Lean 4 core, rfl. -/ import hodge.MailletLin1 set_option maxHeartbeats 0 set_option maxRecDepth 100000 namespace FamCert127 open MailletLin def A : List (List Int) := [[-1776, -1748, -1720, -1692, -1664, -1636, -1608, -1580, -1552, -1496, -1468, -1440, -1412, -1384, -1356, -1328, -1300, -1272, -1244, -1216, -1188, -1160, -1132, -1104, -1076, -1048, -1020, -992, -964, -936, -908, -880, -852, -824, -796, -768, -740, -712, -684, -656, -628, -600, -572, -544, -516, -488, -460, -432, -404, -376, -348, -320, -292, -264, -236, -208, -180, -1 -- (+91685 chars; full line in the Zenodo source) def B : List (List Int) := [[12654662507020542044621811632323191954487710, -9381489992872954610402802290935379184346095, -4573510454491906438565791520737274279537820, -6294426802058233897833304693556407174184190, -1897548382370500809683688702309134504444145, -17091757043732498614485909023310247757758645, 8158216383284818385938982656249608620242970, -16757084585444345203539881646059642044835110, -4 -- (+712431 chars; full line in the Zenodo source) def cl : List Int := [1752, 1700, 1648, 1544, 1492, 1440, 1388, 1336, 1284, 1180, 1128, 1076, 1024, 972, 920, 816, 764, 712, 660, 608, 556, 452, 400, 348, 296, 244, 192, 88, 36, -16, -68, -120, -172, -276, -328, -380, -432, -484, -536, -640, -692, -744, -796, -848, -900, -1004, -1056, -1108, -1160, -1212, -1264, -1368, -1420, -1472, -1576, -1628, -1732, 1772, 1720, 1668, 1616, 1564, 1460, 1408, 13 -- (+355 chars; full line in the Zenodo source) def W : List Int := [-43695760204506482216150656097585456725303823520, -43695760204506482216150656097585456725303823520, -43695760204506482216150656097585456725303823520, -43695760204506482216150656097585456725303823520, -43695760204506482216150656097585456725303823520, -43695760204506482216150656097585456725303823520, -43695760204506482216150656097585456725303823520, -4369576020450648221615065609 -- (+5870 chars; full line in the Zenodo source) theorem allLen_A : allLen 125 A = true := rfl theorem cert : lcs 125 B A = sid 43695760204506482216150656097585456725303823520 125 := rfl theorem w_eq : mv B cl = W := rfl end FamCert127 #print axioms FamCert127.allLen_A #print axioms FamCert127.cert #print axioms FamCert127.w_eq
lean_all/hodge/FamCert15.lean
/- hodge/FamCert15.lean — T41 (goal G865d): rank certificate for the balance matrix of F′_15 (n = 14): the rows of A (balance equations on 13 unit columns, restricted to the first 13 elements of F′_15) combine under the integer matrix B to d·I, d = 420, and B applied to the last element's column values is W (tools/g865_cert.py). With hodge/MailletLin1.kernel_affine: every balanced 0/1 indicator is fixed by its last entry. Lean 4 core, rfl. -/ import hodge.MailletLin1 set_option maxHeartbeats 0 set_option maxRecDepth 100000 namespace FamCert15 open MailletLin def A : List (List Int) := [[-208, -152, -124, -96, -68, -40, -12, 16, 44, 72, 100, 128, 156], [-188, 8, -104, 204, 92, -20, -132, 176, 64, -48, -160, 148, 36], [-184, 124, 68, 12, -44, -100, -156, 208, 152, 96, 40, -16, -72], [-176, -64, -8, 48, 104, 160, -204, -148, -92, -36, 20, 76, 132], [-172, 52, 164, -144, -32, 80, 192, -116, -4, 108, -200, -88, 24], [-164, -136, 88, -108, 116, -80, 144, -5 -- (+492 chars; full line in the Zenodo source) def B : List (List Int) := [[0, -1, 0, -1, -1, -1, 1, 0, 0, 1, 0, 0, 0], [-1, 0, 1, 0, 1, -1, 0, 1, -1, 0, 0, 1, -1], [0, -1, 1, -1, 0, -1, 2, 0, 0, 1, 0, 0, -1], [0, 0, 0, 0, 0, -1, 1, 1, -1, 0, 0, 0, 0], [0, 0, 0, -1, -1, 0, 1, -1, 0, 1, 1, 1, 0], [-1, -1, 1, 1, 1, -2, 1, 2, -1, 0, -1, 1, -1], [0, 0, 0, -1, 1, -1, 1, 1, -1, 0, 0, 1, -1], [0, 0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 1, -1], [0, -1, 1, 0, -- (+210 chars; full line in the Zenodo source) def cl : List Int := [184, -76, -128, 188, 136, 32, -124, -176, 88, -16, -68, -64, -116] def W : List Int := [-420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420] theorem allLen_A : allLen 13 A = true := rfl theorem cert : lcs 13 B A = sid 420 13 := rfl theorem w_eq : mv B cl = W := rfl end FamCert15 #print axioms FamCert15.allLen_A #print axioms FamCert15.cert #print axioms FamCert15.w_eq
lean_all/hodge/FamCert29.lean
/- hodge/FamCert29.lean — T41 (goal G865d): rank certificate for the balance matrix of F′_29 (n = 28): the rows of A (balance equations on 27 unit columns, restricted to the first 27 elements of F′_29) combine under the integer matrix B to d·I, d = 37352, and B applied to the last element's column values is W (tools/g865_cert.py). With hodge/MailletLin1.kernel_affine: every balanced 0/1 indicator is fixed by its last entry. Lean 4 core, rfl. -/ import hodge.MailletLin1 set_option maxHeartbeats 0 set_option maxRecDepth 100000 namespace FamCert29 open MailletLin def A : List (List Int) := [[-404, -376, -320, -292, -264, -236, -208, -180, -152, -124, -96, -68, -40, -12, 16, 44, 72, 100, 128, 156, 184, 212, 240, 268, 296, 324, 352], [-400, -316, -148, -64, 20, 104, 188, 272, 356, -372, -288, -204, -120, -36, 48, 132, 216, 300, 384, -344, -260, -176, -92, -8, 76, 160, 244], [-396, -256, 24, 164, 304, -368, -228, -88, 52, 192, 332, -340, -200, -60, 80, 220, 3 -- (+3490 chars; full line in the Zenodo source) def B : List (List Int) := [[92, 26, 9, -28, 11, -25, -106, -21, -71, 43, 23, 53, -56, -12, -26, -46, -76, -84, 0, 18, 0, 115, 89, 126, -24, -104, -33], [92, -24, -3, -52, -19, -7, -26, 7, -7, 1, 23, 59, -58, 4, -22, -46, -36, -18, 0, 40, 0, 69, 47, 96, -38, -42, -35], [46, 58, 13, -20, 21, -31, -102, -15, -77, 57, 23, 51, -40, -2, -12, -46, -74, -60, 0, 26, 0, 115, 103, 90, -4, -94, -17], [46, 18 -- (+2921 chars; full line in the Zenodo source) def cl : List Int := [380, 328, 276, 172, 120, 68, 16, -36, -88, -192, -244, -296, -400, 360, 256, 204, 152, 100, 48, -4, -108, -160, -212, -264, -316, -368, 340] def W : List Int := [-37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352, -37352] theorem allLen_A : allLen 27 A = true := rfl theorem cert : lcs 27 B A = sid 37352 27 := rfl theorem w_eq : mv B cl = W := rfl end FamCert29 #print axioms FamCert29.allLen_A #print axioms FamCert29.cert #print axioms FamCert29.w_eq
lean_all/hodge/FamCert43.lean
/- hodge/FamCert43.lean — T41 (goal G865d): rank certificate for the balance matrix of F′_43 (n = 42): the rows of A (balance equations on 41 unit columns, restricted to the first 41 elements of F′_43) combine under the integer matrix B to d·I, d = 100051196, and B applied to the last element's column values is W (tools/g865_cert.py). With hodge/MailletLin1.kernel_affine: every balanced 0/1 indicator is fixed by its last entry. Lean 4 core, rfl. -/ import hodge.MailletLin1 set_option maxHeartbeats 0 set_option maxRecDepth 100000 namespace FamCert43 open MailletLin def A : List (List Int) := [[-600, -572, -544, -488, -460, -432, -404, -376, -348, -320, -292, -264, -236, -208, -180, -152, -124, -96, -68, -40, -12, 16, 44, 72, 100, 128, 156, 184, 212, 240, 268, 296, 324, 352, 380, 408, 436, 464, 492, 520, 548], [-596, -512, -428, -260, -176, -92, -8, 76, 160, 244, 328, 412, 496, 580, -540, -456, -372, -288, -204, -120, -36, 48, 132, 216, 300, 384, 468, 552, -5 -- (+8649 chars; full line in the Zenodo source) def B : List (List Int) := [[648090, -253171, -234821, -315862, -376438, 200314, 67075, -123222, -217703, -249470, 62840, 136504, 334877, 574778, 376705, -539975, -159382, 279002, 37730, -242923, 52278, -128508, 402608, 241107, -138154, 102505, 119054, -204609, -339624, -49119, 116691, -61818, -36128, -284651, 170072, 532933, -690726, -46834, -537571, 380283, 143492], [265423, -142765, -110171, -1 -- (+13215 chars; full line in the Zenodo source) def cl : List Int := [576, 524, 472, 368, 316, 264, 212, 160, 108, 4, -48, -100, -152, -204, -256, -360, -412, -464, -568, 584, 480, 428, 376, 324, 272, 220, 116, 64, 12, -40, -92, -144, -248, -300, -352, -404, -456, -508, 592, 540, 488] def W : List Int := [-100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051196, -100051 -- (+112 chars; full line in the Zenodo source) theorem allLen_A : allLen 41 A = true := rfl theorem cert : lcs 41 B A = sid 100051196 41 := rfl theorem w_eq : mv B cl = W := rfl end FamCert43 #print axioms FamCert43.allLen_A #print axioms FamCert43.cert #print axioms FamCert43.w_eq
lean_all/hodge/FamCert71.lean
/- hodge/FamCert71.lean — T41 (goal G865d): rank certificate for the balance matrix of F′_71 (n = 70): the rows of A (balance equations on 69 unit columns, restricted to the first 69 elements of F′_71) combine under the integer matrix B to d·I, d = 94888030305892122656, and B applied to the last element's column values is W (tools/g865_cert.py). With hodge/MailletLin1.kernel_affine: every balanced 0/1 indicator is fixed by its last entry. Lean 4 core, rfl. -/ import hodge.MailletLin1 set_option maxHeartbeats 0 set_option maxRecDepth 100000 namespace FamCert71 open MailletLin def A : List (List Int) := [[-992, -964, -936, -908, -880, -824, -796, -768, -740, -712, -684, -656, -628, -600, -572, -544, -516, -488, -460, -432, -404, -376, -348, -320, -292, -264, -236, -208, -180, -152, -124, -96, -68, -40, -12, 16, 44, 72, 100, 128, 156, 184, 212, 240, 268, 296, 324, 352, 380, 408, 436, 464, 492, 520, 548, 576, 604, 632, 660, 688, 716, 744, 772, 800, 828, 856, 884, 912, 940 -- (+25431 chars; full line in the Zenodo source) def B : List (List Int) := [[-4354484071084492, 19733458429642222, 16484043318734358, -15690011601435842, 7954488201740776, -10232158174901908, -12987229374322502, -36254523169646892, -3179076735093398, 7020160688245734, -2194850274115564, -4331242885242438, -8559340655542748, -19493763190442652, -11351037299452180, -25555556234390516, -4505602358375174, 2883447067367398, 3963219840568572, 6532613 -- (+89668 chars; full line in the Zenodo source) def cl : List Int := [968, 916, 864, 760, 708, 656, 604, 552, 500, 396, 344, 292, 240, 188, 136, 32, -20, -72, -124, -176, -228, -332, -384, -436, -488, -540, -592, -696, -748, -800, -904, -956, 928, 876, 824, 772, 720, 668, 564, 512, 460, 408, 356, 304, 200, 148, 96, 44, -8, -60, -164, -216, -268, -320, -372, -424, -528, -580, -632, -684, -736, -788, -892, -944, 992, 940, 888, 836, 732] def W : List Int := [-94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -94888030305892122656, -9488803030 -- (+1207 chars; full line in the Zenodo source) theorem allLen_A : allLen 69 A = true := rfl theorem cert : lcs 69 B A = sid 94888030305892122656 69 := rfl theorem w_eq : mv B cl = W := rfl end FamCert71 #print axioms FamCert71.allLen_A #print axioms FamCert71.cert #print axioms FamCert71.w_eq
lean_all/hodge/FamComposite.lean
/-
hodge/FamComposite.lean — T41 cycle 1183 (after G749): primality is needed for the indecomposability of F_p.
For p = 87 = 3·29 (p ≡ 3 mod 14, i₀ = 31, x₀ = 5) the family member F_87 at m = 1218 is balanced (FamBal) but splits
into two balanced parts: S = the 31 elements sharing a factor with 87 (including the moved element 957) and the 56
elements prime to 87:
f87_split bal 1218 S = true ∧ bal 1218 T = true (rfl)
(contrast FamIndec3.fam_indec for prime p).
Lean 4 core plus hodge/Indecomp (bal), rfl.
-/
import hodge.Indecomp
namespace FamComposite
open Indecomp
set_option maxRecDepth 100000 in
theorem f87_split : bal 1218 [15, 29, 57, 99, 141, 183, 225, 267, 309, 351, 393, 957, 477, 519, 561, 603, 645, 687, 729, 771, 813, 841, 855, 897, 939, 981, 1023, 1065, 1107, 1149, 1191] = true ∧
bal 1218 [1, 43, 71, 85, 113, 127, 155, 169, 197, 211, 239, 253, 281, 295, 323, 337, 365, 379, 407, 421, 449, 463, 491, 505, 533, 547, 575, 589, 617, 631, 659, 673, 701, 715, 743, 757, 785, 799, 827, 869, 883, 911, 925, 953, 967, 995, 1009, 1037, 1051, 1079, 1093, 1121, 1135, 1163, 1177, 1205] = true := ⟨rfl, rfl⟩
end FamComposite
#print axioms FamComposite.f87_split
lean_all/hodge/FamComposite4575.lean
/-
hodge/FamComposite4575.lean — T41 cycle 1870 (goal G769): the composite family members F_45 (m = 630) and F_75
(m = 1050) of the 1 + 14k family are decomposable: each has a balanced part of size 3 resp. 5 whose complement is
balanced too, so indec = false. (F_33 is indecomposable: hodge/LinCert33.) The parts were read off the kernel of
the unit matrix (tools/g861_cert.py, computation only); here they are checked by rfl.
sel_splits (selT bs c, selF bs c) ∈ splits c for every Bool list bs of the same length
split45 bal 630 (selT b45 F45) = true ∧ bal 630 (selF b45 F45) = true, both parts nonempty
not_indec45 indec 630 F45 = false; the same for 75.
Lean 4 core plus hodge/FamBal, hodge/Indecomp.
-/
import hodge.FamBal
namespace FamComposite4575
open Indecomp FamBal
def selT : List Bool → List Nat → List Nat
| [], _ => []
| _ :: _, [] => []
| b :: bs, x :: xs => if b = true then x :: selT bs xs else selT bs xs
def selF : List Bool → List Nat → List Nat
| [], _ => []
| _ :: _, [] => []
| b :: bs, x :: xs => if b = true then selF bs xs else x :: selF bs xs
theorem mem_app_l {α : Type} (x : α) (l' : List α) : ∀ l : List α, x ∈ l → x ∈ l ++ l'
| [], h => nomatch h
| _ :: l, h => by
cases h with
| head => exact List.Mem.head _
| tail _ h' => exact List.Mem.tail _ (mem_app_l x l' l h')
theorem mem_app_r {α : Type} (x : α) (l' : List α) (h : x ∈ l') : ∀ l : List α, x ∈ l ++ l'
| [] => h
| _ :: l => List.Mem.tail _ (mem_app_r x l' h l)
theorem mem_fm {α β : Type} (f : α → List β) (q : β) (p : α) (hq : q ∈ f p) : ∀ L : List α, p ∈ L → q ∈ L.flatMap f
| [], h => nomatch h
| a :: L, h => by
show q ∈ f a ++ L.flatMap f
cases h with
| head => exact mem_app_l q _ _ hq
| tail _ h' => exact mem_app_r q _ (mem_fm f q p hq L h') _
theorem sel_splits : ∀ (c : List Nat) (bs : List Bool), bs.length = c.length → (selT bs c, selF bs c) ∈ splits c
| [], [], _ => List.Mem.head _
| [], _ :: _, h => nomatch h
| _ :: _, [], h => nomatch h
| x :: l, b :: bs, h => by
have ih := sel_splits l bs (Nat.succ.inj h)
cases b with
| true =>
show (x :: selT bs l, selF bs l) ∈ (splits l).flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)])
exact mem_fm _ _ (selT bs l, selF bs l) (List.Mem.head _) _ ih
| false =>
show (selT bs l, x :: selF bs l) ∈ (splits l).flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)])
exact mem_fm _ _ (selT bs l, selF bs l) (List.Mem.tail _ (List.Mem.head _)) _ ih
theorem all_memP {α : Type} (P : α → Bool) : ∀ l : List α, l.all P = true → ∀ r, r ∈ l → P r = true
| [], _, _, h => nomatch h
| x :: l, hl, r, hr => by
have hx : P x = true ∧ l.all P = true := by
cases e1 : P x with
| false => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact nomatch hl
| true => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact ⟨rfl, hl⟩
cases hr with
| head => exact hx.1
| tail _ h' => exact all_memP P l hx.2 r h'
theorem not_indec (m : Nat) (c : List Nat) (bs : List Bool) (hl : bs.length = c.length)
(h : ((selT bs c).isEmpty || (selF bs c).isEmpty || !(bal m (selT bs c) && bal m (selF bs c))) = false) :
indec m c = false := by
cases e : indec m c with
| false => rfl
| true =>
have hm := all_memP _ (splits c) e _ (sel_splits c bs hl)
rw [h] at hm
exact nomatch hm
def inL (S : List Nat) (x : Nat) : Bool := S.any (fun y => Nat.beq x y)
def F45 : List Nat := fam 45 16
def b45 : List Bool := F45.map (inL [15, 495, 435])
def F75 : List Nat := fam 75 16
def b75 : List Bool := F75.map (inL [15, 675, 435, 645, 855])
set_option maxRecDepth 100000 in
theorem split45 : ((selT b45 F45).isEmpty || (selF b45 F45).isEmpty || !(bal 630 (selT b45 F45) && bal 630 (selF b45 F45))) = false := rfl
set_option maxRecDepth 100000 in
theorem split75 : ((selT b75 F75).isEmpty || (selF b75 F75).isEmpty || !(bal 1050 (selT b75 F75) && bal 1050 (selF b75 F75))) = false := rfl
theorem size45 : (selT b45 F45).length = 3 := rfl
theorem size75 : (selT b75 F75).length = 5 := rfl
theorem not_indec45 : indec 630 F45 = false := not_indec 630 F45 b45 rfl split45
theorem not_indec75 : indec 1050 F75 = false := not_indec 1050 F75 b75 rfl split75
end FamComposite4575
#print axioms FamComposite4575.all_memP
#print axioms FamComposite4575.sel_splits
#print axioms FamComposite4575.split45
#print axioms FamComposite4575.split75
#print axioms FamComposite4575.not_indec45
#print axioms FamComposite4575.not_indec75
lean_all/hodge/FamDouble.lean
/-
hodge/FamDouble.lean — T41 cycle 1199 (after G749): the Fermat character carried by the seed F_p. At m' = 28p,
G_p = 14p :: 2·F_p (length p + 1, entry sum ≡ 0 mod m')
gp_bal G_p is balanced at 28p whenever F_p satisfies the hypotheses of FamBal.fam_bal
(for t a unit of 28p: t is odd, ⟨t·14p⟩ = 14p, ⟨t·2x⟩_{28p} = 2⟨tx⟩_{14p}, so the unit sum is 14p + 2·7p²
= (p + 1)·14p). With FamIndec3 the seed F_p of G_p is indecomposable for primes p ≡ 3, 5 (mod 14).
Lean 4 core plus hodge/FamBal, hodge/FamArith (cop_left/right), hodge/APPair1 (dvd_gcd).
-/
import hodge.FamBal
namespace FamDouble
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal
theorem mod_double (y M : Nat) (hM : 0 < M) : (2 * y) % (2 * M) = 2 * (y % M) := by
have hs : y % M < M := Nat.mod_lt _ hM
have ⟨q, hq⟩ := div_mod M hM (y + 1) y (Nat.lt_succ_self y)
generalize y % M = s at hs hq ⊢
subst hq
have e : 2 * (s + M * q) = 2 * s + q * (2 * M) := by lib_nat
rw [e, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 1) hM)]
apply mod_lt'
exact Nat.mul_lt_mul_of_le_of_lt (Nat.le_refl 2) hs (Nat.succ_pos 1)
theorem odd_of_cop (t : Nat) (h : Nat.gcd t 2 = 1) : ∃ s, t = 2 * s + 1 := by
have ⟨q, hq⟩ := div_mod 2 (Nat.succ_pos 1) (t + 1) t (Nat.lt_succ_self t)
have hr : t % 2 < 2 := Nat.mod_lt _ (Nat.succ_pos 1)
generalize t % 2 = r at hq hr
match r, hr with
| 0, _ =>
exfalso
have ⟨c, hc⟩ := APPair1.dvd_gcd 2 t 2 ⟨q, by rw [hq]; lib_nat⟩ ⟨1, rfl⟩
rw [h] at hc
exact APPair1.one_eq_mul 2 c hc (Nat.le_refl 2)
| 1, _ => exact ⟨q, by rw [hq]; lib_nat⟩
| r + 2, hr' => exact absurd hr' (Nat.not_lt.mpr (Nat.le_add_left 2 r))
theorem half_term (t p : Nat) (hp : 0 < p) (ht : Nat.gcd t 2 = 1) : (t * (14 * p)) % (28 * p) = 14 * p := by
have ⟨s, hs⟩ := odd_of_cop t ht
subst hs
have e : (2 * s + 1) * (14 * p) = 14 * p + s * (28 * p) := by lib_nat
rw [e, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 27) hp)]
apply mod_lt'
have : 14 * p < 14 * p + 14 * p := Nat.lt_add_of_pos_right (Nat.mul_pos (Nat.succ_pos 13) hp)
rw [show 14 * p + 14 * p = 28 * p by lib_nat] at this; exact this
theorem len_map (f : Nat → Nat) : ∀ L : List Nat, (L.map f).length = L.length
| [] => rfl
| _ :: L => by show (L.map f).length + 1 = L.length + 1; rw [len_map f L]
theorem tsum_map2 (M t : Nat) (hM : 0 < M) : ∀ L : List Nat, tsum (2 * M) t (L.map (fun x => 2 * x)) = 2 * tsum M t L
| [] => rfl
| x :: L => by
show (t * (2 * x)) % (2 * M) + tsum (2 * M) t (L.map (fun x => 2 * x)) = 2 * ((t * x) % M + tsum M t L)
rw [tsum_map2 M t hM L, show t * (2 * x) = 2 * (t * x) by lib_nat, mod_double _ _ hM]; lib_nat
/-- **G_p = 14p :: 2·F_p is balanced at 28p.** -/
theorem gp_bal (p i0 x0 : Nat) (hp : 0 < p) (hi : i0 < p) (hx : 1 + 14 * i0 = p * x0)
(hs : fcond (x0 % 14) = true) : bal (28 * p) (14 * p :: (fam p i0).map (fun x => 2 * x)) = true := by
unfold bal FermatPrime.units
apply all_filter
intro t ht
have hg : Nat.gcd t (2 * (14 * p)) = 1 := by
have := Nat.eq_of_beq_eq_true ht
rw [show 2 * (14 * p) = 28 * p by lib_nat]; exact this
have h14 : Nat.gcd t (14 * p) = 1 := cop_right t 2 (14 * p) hg
have h2 : Nat.gcd t 2 = 1 := cop_left t 2 (14 * p) hg
have e := fam_tsum p i0 x0 t hp hi hx hs h14
have hl : ((fam p i0).map (fun x => 2 * x)).length = p := by
rw [len_map]; exact gl_len _ p
show Nat.beq (((t * (14 * p)) % (28 * p) + tsum (28 * p) t ((fam p i0).map (fun x => 2 * x)))
+ ((t * (14 * p)) % (28 * p) + tsum (28 * p) t ((fam p i0).map (fun x => 2 * x))))
((((fam p i0).map (fun x => 2 * x)).length + 1) * (28 * p)) = true
rw [half_term t p hp h2, hl, show 28 * p = 2 * (14 * p) by lib_nat, tsum_map2 (14 * p) t (Nat.mul_pos (Nat.succ_pos 13) hp)]
have goal : 14 * p + 2 * tsum (14 * p) t (fam p i0) + (14 * p + 2 * tsum (14 * p) t (fam p i0)) = (p + 1) * (2 * (14 * p)) := by
calc 14 * p + 2 * tsum (14 * p) t (fam p i0) + (14 * p + 2 * tsum (14 * p) t (fam p i0))
= 28 * p + 2 * (tsum (14 * p) t (fam p i0) + tsum (14 * p) t (fam p i0)) := by lib_nat
_ = 28 * p + 2 * (p * (14 * p)) := by rw [e]
_ = _ := by lib_nat
rw [goal]; exact beq_refl' _
theorem g5 : bal 140 (70 :: (fam 5 1).map (fun x => 2 * x)) = true :=
gp_bal 5 1 3 (Nat.succ_pos 4) (Nat.succ_lt_succ (Nat.succ_pos 3)) rfl rfl
theorem g5_eq : (70 :: (fam 5 1).map (fun x => 2 * x)) = [70, 114, 86, 58, 90, 2] := rfl
end FamDouble
#print axioms FamDouble.mod_double
#print axioms FamDouble.odd_of_cop
#print axioms FamDouble.half_term
#print axioms FamDouble.len_map
#print axioms FamDouble.tsum_map2
#print axioms FamDouble.gp_bal
#print axioms FamDouble.g5
#print axioms FamDouble.g5_eq
lean_all/hodge/FamHalf.lean
/-
hodge/FamHalf.lean — T41 cycle 1213 (after G749): the hypothesis x₀ ≠ 1 of FamIndec3.fam_indec is necessary.
If 1 + 14·i₀ = p (x₀ = 1, i.e. p ≡ 1 mod 14), the moved element of F_p is 7p = m/2, which is balanced by itself:
half_mem 7p ∈ fam p i₀
half_bal7 bal (14p) [7p] = true
so F_p = [7p] ⊔ (rest) splits (e.g. p = 29, 43, 71).
Lean 4 core plus hodge/FamStab (gl_mem'), hodge/GcdHand (half_bal_even).
-/
import hodge.FamStab
namespace FamHalf
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal FamStab
theorem half_mem (p i0 : Nat) (hi : i0 < p) (hx : 1 + 14 * i0 = p) : 7 * p ∈ fam p i0 := by
have := gl_mem' (fun k => if Nat.beq k i0 then 1 + 14 * k + 6 * p else 1 + 14 * k) p i0 hi
have hv : (if Nat.beq i0 i0 = true then 1 + 14 * i0 + 6 * p else 1 + 14 * i0) = 7 * p := by
rw [beq_refl']; show 1 + 14 * i0 + 6 * p = 7 * p; rw [hx]; lib_nat
rw [hv] at this; exact this
theorem half_bal7 (p : Nat) (hp : 0 < p) : bal (14 * p) [7 * p] = true := by
have h := half_bal_even (7 * p) (Nat.mul_pos (Nat.succ_pos 6) hp)
rw [show 7 * p + 7 * p = 14 * p by lib_nat] at h
exact h
end FamHalf
#print axioms FamHalf.half_mem
#print axioms FamHalf.half_bal7
lean_all/hodge/FamIndec1.lean
/-
hodge/FamIndec1.lean — T41 cycle 1157 (goal G749c, piece K2): the unit sums of a coset element over the units
t_i = 1 + 14i of Z/14p. For x = 1 + 14k with gcd(x, p) = 1, and t* = 1 + 14·i₀ = p·x₀ (i₀ < p):
avg_all Σ_{i<p} ⟨(1 + 14i)·x⟩_{14p} = p + 14·Σ_{i<p} i
omit_term ⟨t*·x⟩_{14p} = t*
avg_omit Σ_{i<p, i≠i₀} ⟨(1 + 14i)·x⟩_{14p} + t* = p + 14·Σ_{i<p} i
Averaging the balance condition of a split part over these p − 1 units (FamIndec2) forces t* = p.
Lean 4 core plus hodge/FamArith (sumF_replace), hodge/FamMod (mod_split), hodge/PermSum (perm_sum).
-/
import hodge.FamBal
namespace FamIndec1
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp
theorem avg_all (p k : Nat) (hp : 0 < p) (hx : Nat.gcd (1 + 14 * k) p = 1) :
sumF (fun i => ((1 + 14 * i) * (1 + 14 * k)) % (14 * p)) p = p + 14 * sumF (fun i => i) p := by
have e : ∀ i, ((1 + 14 * i) * (1 + 14 * k)) % (14 * p) = 1 + 14 * ((k + (1 + 14 * k) * i) % p) := by
intro i
have e1 : (1 + 14 * i) * (1 + 14 * k) = 1 + 14 * (k + (1 + 14 * k) * i) := by lib_nat
rw [e1, mod_split 1 _ p hp (Nat.succ_lt_succ (Nat.succ_pos 12))]
rw [sumF_congr _ _ e p, sumF_lin, perm_sum p (1 + 14 * k) k hp hx]
lib_nat
theorem omit_term (p i0 x0 k : Nat) (hi : i0 < p) (ht : 1 + 14 * i0 = p * x0) :
((1 + 14 * i0) * (1 + 14 * k)) % (14 * p) = 1 + 14 * i0 := by
have hp : 0 < p := Nat.lt_of_le_of_lt (Nat.zero_le i0) hi
have e : (1 + 14 * i0) * (1 + 14 * k) = (1 + 14 * i0) + (k * x0) * (14 * p) := by
calc (1 + 14 * i0) * (1 + 14 * k) = (1 + 14 * i0) + 14 * k * (1 + 14 * i0) := by lib_nat
_ = (1 + 14 * i0) + 14 * k * (p * x0) := by rw [ht]
_ = _ := by lib_nat
rw [e, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 13) hp)]
apply mod_lt'
have h1 : 1 + 14 * i0 < 14 + 14 * i0 := Nat.add_lt_add_right (Nat.succ_lt_succ (Nat.succ_pos 12)) _
have h2 : 14 + 14 * i0 ≤ 14 * p := by
have : 14 * (i0 + 1) ≤ 14 * p := Nat.mul_le_mul_left 14 hi
have e2 : 14 * (i0 + 1) = 14 + 14 * i0 := by lib_nat
rw [e2] at this; exact this
exact Nat.lt_of_lt_of_le h1 h2
/-- the sum over the units t_i, i ≠ i₀ (as a sumF with the i₀ term set to 0) -/
def omitS (p i0 k : Nat) : Nat :=
sumF (fun i => if Nat.beq i i0 then 0 else ((1 + 14 * i) * (1 + 14 * k)) % (14 * p)) p
theorem avg_omit (p i0 x0 k : Nat) (hi : i0 < p) (ht : 1 + 14 * i0 = p * x0) (hx : Nat.gcd (1 + 14 * k) p = 1) :
omitS p i0 k + (1 + 14 * i0) = p + 14 * sumF (fun i => i) p := by
have hp : 0 < p := Nat.lt_of_le_of_lt (Nat.zero_le i0) hi
have rep := sumF_replace (fun i => if Nat.beq i i0 then 0 else ((1 + 14 * i) * (1 + 14 * k)) % (14 * p))
(fun i => ((1 + 14 * i) * (1 + 14 * k)) % (14 * p)) i0 (fun i hne => by
have : Nat.beq i i0 = false := by
cases e : Nat.beq i i0 with
| false => rfl
| true => exact absurd (Nat.eq_of_beq_eq_true e) hne
show (if Nat.beq i i0 = true then 0 else _) = _
rw [this]; rfl) p hi
have rep' : omitS p i0 k + ((1 + 14 * i0) * (1 + 14 * k)) % (14 * p)
= sumF (fun i => ((1 + 14 * i) * (1 + 14 * k)) % (14 * p)) p + (if Nat.beq i0 i0 = true then 0 else ((1 + 14 * i0) * (1 + 14 * k)) % (14 * p)) := rep
rw [FamBal.beq_refl' i0, omit_term p i0 x0 k hi ht, avg_all p k hp hx] at rep'
exact rep'
end FamIndec1
#print axioms FamIndec1.avg_all
#print axioms FamIndec1.omit_term
#print axioms FamIndec1.avg_omit
lean_all/hodge/FamIndec2.lean
/-
hodge/FamIndec2.lean — T41 cycle 1159 (goal G749c, piece K3): the units t_i = 1 + 14i of Z/14p for a prime p with
gcd(14, p) = 1 and the unique index i₀ < p with p ∣ 1 + 14i₀:
mod_zero p ∣ n ⇒ n % p = 0
idx_unique p ∣ 1 + 14i, i < p ⇒ i = i₀
cop_coset k < p, k ≠ i₀ ⇒ gcd(1 + 14k, p) = 1
unit_t i < p, i ≠ i₀ ⇒ gcd(1 + 14i, 14p) = 1
(hand divisibility: GcdHand, UnitMul, APPair1, LibGcd.gauss, PermSum.inj_mod).
Lean 4 core plus hodge/FamIndec1, hodge/UnitMul, lib/Gcd.
-/
import hodge.FamIndec1
import hodge.UnitMul
import lib.Gcd
namespace FamIndec2
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp
theorem mod_zero (p n : Nat) (hp : 0 < p) (h : p ∣ n) : n % p = 0 := by
have ⟨c, hc⟩ := h
have e : n = 0 + c * p := by rw [hc]; lib_nat
rw [e, add_mul_mod' _ _ hp]
exact mod_lt' 0 p hp
theorem idx_unique (p i i0 : Nat) (hp : 0 < p) (h14 : Nat.gcd 14 p = 1) (hi : i < p) (hi0 : i0 < p)
(h : p ∣ 1 + 14 * i) (h0 : p ∣ 1 + 14 * i0) : i = i0 := by
have a := mod_zero p _ hp h
have b := mod_zero p _ hp h0
cases Nat.lt_or_ge i i0 with
| inl hlt =>
have ⟨d, hd⟩ := LibGcd.le_dest hlt
-- i0 = (i + 1) + d
exfalso
apply inj_mod p 14 1 i (d + 1) hp h14 (Nat.succ_pos d)
· rw [show i + (d + 1) = i + 1 + d by lib_nat, ← hd]; exact hi0
· rw [a, show i + (d + 1) = i + 1 + d by lib_nat, ← hd, b]
| inr hge =>
cases Nat.lt_or_ge i0 i with
| inl hlt =>
have ⟨d, hd⟩ := LibGcd.le_dest hlt
exfalso
apply inj_mod p 14 1 i0 (d + 1) hp h14 (Nat.succ_pos d)
· rw [show i0 + (d + 1) = i0 + 1 + d by lib_nat, ← hd]; exact hi
· rw [b, show i0 + (d + 1) = i0 + 1 + d by lib_nat, ← hd, a]
| inr hge' => exact Nat.le_antisymm hge' hge
theorem gcd_one_of (t n : Nat) (h : ∀ d, d ∣ t → d ∣ n → d = 1) : Nat.gcd t n = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := UnitMul.gcd_dvd t n
exact h _ ⟨i, hi⟩ ⟨j, hj⟩
theorem cop_coset (p k i0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hk : k < p) (hi0 : i0 < p) (h0 : p ∣ 1 + 14 * i0) (hne : k ≠ i0) : Nat.gcd (1 + 14 * k) p = 1 := by
apply gcd_one_of
intro d hd1 hd2
cases hpr d hd2 with
| inl e => exact e
| inr e =>
rw [e] at hd1
exact absurd (idx_unique p k i0 hp h14 hk hi0 hd1 h0) hne
theorem dvd_one_of (d i : Nat) (h1 : d ∣ 14) (h2 : d ∣ 1 + 14 * i) : d = 1 := by
have a := LibGcd.idv_lin (LibGcd.idv_of_nat h2) (LibGcd.idv_of_nat h1) 1 (-(Int.ofNat i))
have e : (1 : Int) * Int.ofNat (1 + 14 * i) + -(Int.ofNat i) * Int.ofNat 14 = Int.ofNat 1 := by
show (1 : Int) * Int.ofNat (1 + 14 * i) + -(Int.ofNat i) * Int.ofNat 14 = Int.ofNat 1
rw [show Int.ofNat (1 + 14 * i) = Int.ofNat 1 + Int.ofNat 14 * Int.ofNat i from rfl]
lib_int
rw [e] at a
exact LibGcd.dvd_one' (LibGcd.idv_nat a)
theorem unit_t (p i i0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hi : i < p) (hi0 : i0 < p) (h0 : p ∣ 1 + 14 * i0) (hne : i ≠ i0) : Nat.gcd (1 + 14 * i) (14 * p) = 1 := by
apply gcd_one_of
intro d hd1 hd2
-- q = gcd d p is 1 or p
have ⟨⟨a, ha⟩, ⟨b, hb⟩⟩ := UnitMul.gcd_dvd d p
cases hpr (Nat.gcd d p) ⟨b, hb⟩ with
| inr e =>
rw [e] at ha
exact absurd (idx_unique p i i0 hp h14 hi hi0 (LibGcd.dvd_trans' ⟨a, ha⟩ hd1) h0) hne
| inl e =>
have hc : ∀ f, f ∣ d → f ∣ p → f = 1 := by
intro f hf1 hf2
have ⟨c, hc⟩ := APPair1.dvd_gcd f d p (let ⟨u, hu⟩ := hf1; ⟨u, hu⟩) (let ⟨u, hu⟩ := hf2; ⟨u, hu⟩)
rw [e] at hc
exact UnitMul.one_of_dvd_one f c hc
have h14d : d ∣ 14 := LibGcd.gauss hc (by rw [show 14 * p = 14 * p from rfl]; exact hd2)
exact dvd_one_of d i h14d hd1
end FamIndec2
#print axioms FamIndec2.mod_zero
#print axioms FamIndec2.idx_unique
#print axioms FamIndec2.gcd_one_of
#print axioms FamIndec2.cop_coset
#print axioms FamIndec2.dvd_one_of
#print axioms FamIndec2.unit_t
lean_all/hodge/FamIndec3.lean
/-
hodge/FamIndec3.lean — T41 cycle 1161 (goal G749c — indecomposability of the family): for a prime p with
gcd(14, p) = 1, i₀ < p, 1 + 14i₀ = p·x₀ and x₀ ≠ 1 (i.e. p ≢ 1 mod 14),
fam_indec indec (14p) (fam p i₀) = true.
Proof: in a split (A, B) of F_p into two balanced nonempty parts, one part P avoids the unique element ≡ 0 (mod p)
(an additive count over the split). Every member of P is a coset element 1 + 14k (k ≠ i₀). Summing the balance
condition of P over the p − 1 units t_i = 1 + 14i (i ≠ i₀) and using FamIndec1.avg_omit element by element gives
|P|·(p − 1)·14p + 2|P|·t* = |P|·(2p + 28·Σ_{i<p} i), hence t* = p and x₀ = 1.
With FamBal.fam_bal: F_p is a balanced indecomposable character of the degree-14p Fermat variety for every prime
p ≡ 3, 5 (mod 14) — an infinite family through the open m = 70 seed (p = 5).
Lean 4 core plus hodge/FamIndec2, hodge/FamBal, hodge/Q4Conv (splits).
-/
import hodge.FamIndec2
import hodge.QFamPrime
namespace FamIndec3
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal FamIndec1 FamIndec2 Q4Conv QFamPrime
theorem splits_gs (f : Nat → Nat) : ∀ (l A B : List Nat), (A, B) ∈ splits l → gs f A + gs f B = gs f l
| [], A, B, h => by
have e : (A, B) = (([] : List Nat), ([] : List Nat)) := by
cases h with
| head => rfl
| tail _ h' => exact nomatch h'
injection e with e1 e2
subst e1; subst e2; rfl
| z :: l, A, B, h => by
cases mem_flatMap_inv _ _ (splits l) h with
| intro p hp =>
have ih := splits_gs f l p.1 p.2 hp.1
cases hp.2 with
| head =>
show (f z + gs f p.1) + gs f p.2 = f z + gs f l
rw [← ih]; lib_nat
| tail _ h2 => cases h2 with
| head =>
show gs f p.1 + (f z + gs f p.2) = f z + gs f l
rw [← ih]; lib_nat
| tail _ h3 => exact nomatch h3
theorem tsum_gs (m t : Nat) : ∀ P : List Nat, tsum m t P = gs (fun x => (t * x) % m) P
| [] => rfl
| x :: P => by show (t * x) % m + tsum m t P = (t * x) % m + gs _ P; rw [tsum_gs m t P]
theorem gs_zero (g : Nat → Nat) : ∀ P : List Nat, gs g P = 0 → ∀ x, x ∈ P → g x = 0
| [], _, _, h => nomatch h
| y :: P, h, x, hx => by
have h' : g y + gs g P = 0 := h
have a : g y = 0 := by
cases e : g y with
| zero => rfl
| succ n => rw [e, Nat.succ_add] at h'; exact Nat.noConfusion h'
have b : gs g P = 0 := by rw [a, Nat.zero_add] at h'; exact h'
cases hx with
| head => exact a
| tail _ hx' => exact gs_zero g P b x hx'
theorem mem_filter' (pr : Nat → Bool) (t : Nat) (hp : pr t = true) : ∀ l : List Nat, t ∈ l → t ∈ l.filter pr
| [], h => nomatch h
| x :: l, h => by
cases hx : pr x with
| false =>
have e : (x :: l).filter pr = l.filter pr := by show (match pr x with | true => x :: l.filter pr | false => l.filter pr) = _; rw [hx]
rw [e]
cases h with
| head => rw [hp] at hx; exact nomatch hx
| tail _ h' => exact mem_filter' pr t hp l h'
| true =>
have e : (x :: l).filter pr = x :: l.filter pr := by show (match pr x with | true => x :: l.filter pr | false => l.filter pr) = _; rw [hx]
rw [e]
cases h with
| head => exact List.Mem.head _
| tail _ h' => exact List.Mem.tail _ (mem_filter' pr t hp l h')
theorem mem_loop : ∀ (n : Nat) (acc : List Nat) (t : Nat), (t < n ∨ t ∈ acc) → t ∈ List.range.loop n acc
| 0, acc, t, h => by
cases h with
| inl h => exact absurd h (Nat.not_lt_zero t)
| inr h => exact h
| n + 1, acc, t, h => by
show t ∈ List.range.loop n (n :: acc)
apply mem_loop n (n :: acc) t
cases h with
| inr h => exact Or.inr (List.Mem.tail _ h)
| inl h =>
cases Nat.lt_or_ge t n with
| inl h' => exact Or.inl h'
| inr h' =>
have e : t = n := Nat.le_antisymm (Nat.le_of_lt_succ h) h'
rw [e]; exact Or.inr (List.Mem.head _)
theorem mem_range' (m t : Nat) (h : t < m) : t ∈ List.range m := by
show t ∈ List.range.loop m []
exact mem_loop m [] t (Or.inl h)
theorem bal_unit (m t : Nat) (P : List Nat) (hb : bal m P = true) (ht : t < m) (hg : Nat.gcd t m = 1) :
tsum m t P + tsum m t P = P.length * m := by
have hm : t ∈ FermatPrime.units m := mem_filter' _ t (by rw [hg]; rfl) _ (mem_range' m t ht)
exact Nat.eq_of_beq_eq_true (all_mem _ _ hb t hm)
theorem sumF_add (f g : Nat → Nat) : ∀ n, sumF (fun i => f i + g i) n = sumF f n + sumF g n
| 0 => rfl
| n + 1 => by
show sumF (fun i => f i + g i) n + (f n + g n) = (sumF f n + f n) + (sumF g n + g n)
rw [sumF_add f g n]; lib_nat
/-- swap a sum over i with a sum over a list -/
theorem swap (F : Nat → Nat → Nat) (n : Nat) : ∀ P : List Nat,
sumF (fun i => gs (F i) P) n = gs (fun x => sumF (fun i => F i x) n) P
| [] => by
show sumF (fun _ => 0) n = 0
induction n with
| zero => rfl
| succ n ih => show sumF (fun _ => 0) n + 0 = 0; rw [ih]
| x :: P => by
show sumF (fun i => F i x + gs (F i) P) n = sumF (fun i => F i x) n + gs (fun x => sumF (fun i => F i x) n) P
rw [sumF_add, swap F n P]
theorem gs_ite (c : Bool) (g : Nat → Nat) : ∀ P : List Nat,
(if c = true then 0 else gs g P) = gs (fun x => if c = true then 0 else g x) P := by
intro P
cases c with
| true =>
show 0 = gs (fun _ => 0) P
induction P with
| nil => rfl
| cons x P ih => show 0 = 0 + gs (fun _ => 0) P; rw [← ih]
| false => rfl
theorem gs_const_len (c : Nat) (g : Nat → Nat) : ∀ P : List Nat, (∀ x, x ∈ P → g x = c) → gs g P = P.length * c
| [], _ => by show 0 = 0 * c; lib_nat
| x :: P, h => by
show g x + gs g P = (P.length + 1) * c
rw [h x (List.Mem.head _), gs_const_len c g P (fun y hy => h y (List.Mem.tail _ hy))]; lib_nat
theorem gs_add_const (g : Nat → Nat) (c : Nat) : ∀ P : List Nat, gs (fun x => g x + c) P = gs g P + P.length * c
| [] => by show 0 = 0 + 0 * c; lib_nat
| x :: P => by
show (g x + c) + gs (fun x => g x + c) P = (g x + gs g P) + (P.length + 1) * c
rw [gs_add_const g c P]; lib_nat
theorem ite_two (c : Bool) (a : Nat) : (if c = true then 0 else a + a) = (if c = true then 0 else a) + (if c = true then 0 else a) := by
cases c with
| true => rfl
| false => rfl
/-- the core contradiction: a balanced nonempty part of coset elements (k ≠ i₀) forces x₀ = 1 -/
theorem coset_part (p i0 x0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hi : i0 < p) (hx : 1 + 14 * i0 = p * x0) (P : List Nat) (hne : 0 < P.length)
(hmem : ∀ x, x ∈ P → ∃ k, k < p ∧ k ≠ i0 ∧ x = 1 + 14 * k) (hb : bal (14 * p) P = true) : x0 = 1 := by
have h0 : p ∣ 1 + 14 * i0 := ⟨x0, hx⟩
have hne_i : ∀ i, Nat.beq i i0 = false ↔ i ≠ i0 := by
intro i
constructor
· intro h e; rw [e, beq_refl'] at h; exact nomatch h
· intro h
cases e : Nat.beq i i0 with
| false => rfl
| true => exact absurd (Nat.eq_of_beq_eq_true e) h
-- E1: Σ_{i≠i₀} 2·tsum(t_i, P) + |P|·14p = p·|P|·14p
have E1 : sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P + tsum (14 * p) (1 + 14 * i) P) p
+ P.length * (14 * p) = p * (P.length * (14 * p)) := by
have c1 : sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P + tsum (14 * p) (1 + 14 * i) P) p
= sumF (fun i => if Nat.beq i i0 = true then 0 else P.length * (14 * p)) p := by
apply sumF_congr_lt; intro i hip
cases e : Nat.beq i i0 with
| true => rfl
| false =>
show tsum (14 * p) (1 + 14 * i) P + tsum (14 * p) (1 + 14 * i) P = P.length * (14 * p)
have hlt : 1 + 14 * i < 14 * p := by
have h1 : 1 + 14 * i < 14 + 14 * i := Nat.add_lt_add_right (Nat.succ_lt_succ (Nat.succ_pos 12)) _
have h2 : 14 + 14 * i ≤ 14 * p := by
have : 14 * (i + 1) ≤ 14 * p := Nat.mul_le_mul_left 14 hip
rw [show 14 * (i + 1) = 14 + 14 * i by lib_nat] at this; exact this
exact Nat.lt_of_lt_of_le h1 h2
exact bal_unit _ _ P hb hlt (unit_t p i i0 hp hpr h14 hip hi h0 ((hne_i i).1 e))
have r := sumF_replace (fun i => if Nat.beq i i0 = true then 0 else P.length * (14 * p)) (fun _ => P.length * (14 * p)) i0
(fun k hk => by
show (if Nat.beq k i0 = true then 0 else _) = _
rw [(hne_i k).2 hk]; rfl) p hi
have r' : sumF (fun i => if Nat.beq i i0 = true then 0 else P.length * (14 * p)) p + P.length * (14 * p)
= sumF (fun _ => P.length * (14 * p)) p + (if Nat.beq i0 i0 = true then 0 else P.length * (14 * p)) := r
rw [beq_refl'] at r'
have sc : ∀ n, sumF (fun _ => P.length * (14 * p)) n = n * (P.length * (14 * p)) := by
intro n; induction n with
| zero => show 0 = 0 * _; lib_nat
| succ n ih =>
show sumF (fun _ => P.length * (14 * p)) n + P.length * (14 * p) = (n + 1) * (P.length * (14 * p))
rw [ih]; lib_nat
rw [c1, r', sc]; rfl
-- Φ₁ elementwise
have E2 : sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P) p + P.length * (1 + 14 * i0)
= P.length * (p + 14 * sumF (fun i => i) p) := by
have sw : sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P) p
= gs (fun x => sumF (fun i => if Nat.beq i i0 = true then 0 else ((1 + 14 * i) * x) % (14 * p)) p) P := by
rw [← swap]
apply sumF_congr; intro i
rw [tsum_gs, gs_ite]
rw [sw, ← gs_add_const]
apply gs_const_len
intro x hxP
have ⟨k, hk, hk0, e⟩ := hmem x hxP
subst e
exact avg_omit p i0 x0 k hi hx (cop_coset p k i0 hp hpr h14 hk hi h0 hk0)
have E3 := sum_id p
-- combine: 2|P|·t* = 2|P|·p
have hsplit : sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P + tsum (14 * p) (1 + 14 * i) P) p
= sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P) p
+ sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P) p := by
rw [← sumF_add]; apply sumF_congr; intro i; exact ite_two _ _
rw [hsplit] at E1
generalize sumF (fun i => if Nat.beq i i0 = true then 0 else tsum (14 * p) (1 + 14 * i) P) p = F at E1 E2
generalize sumF (fun i => i) p = S at E2 E3
generalize P.length = L at E1 E2 hne
have key : (L + L) * (1 + 14 * i0) = (L + L) * p := by
apply add_right_cancel' _ _ (F + F + L * (14 * p))
calc (L + L) * (1 + 14 * i0) + (F + F + L * (14 * p))
= (F + L * (1 + 14 * i0)) + (F + L * (1 + 14 * i0)) + L * (14 * p) := by lib_nat
_ = L * (p + 14 * S) + L * (p + 14 * S) + L * (14 * p) := by rw [E2]
_ = (L + L) * p + 14 * L * (S + S + p) := by lib_nat
_ = (L + L) * p + 14 * L * (p * p) := by rw [E3]
_ = (L + L) * p + p * (L * (14 * p)) := by lib_nat
_ = (L + L) * p + (F + F + L * (14 * p)) := by rw [E1]
have hL : 0 < L + L := Nat.lt_of_lt_of_le hne (Nat.le_add_right L L)
have ht := Nat.eq_of_mul_eq_mul_left hL key
rw [hx] at ht
exact Nat.eq_of_mul_eq_mul_left hp (by rw [ht]; lib_nat)
def ind (p x : Nat) : Nat := if Nat.beq (x % p) 0 then 1 else 0
theorem gl_gs (g f : Nat → Nat) : ∀ n, gs g (gl f n) = sumF (fun k => g (f k)) n
| 0 => rfl
| n + 1 => by
show g (f n) + gs g (gl f n) = sumF (fun k => g (f k)) n + g (f n)
rw [gl_gs g f n]; lib_nat
theorem len_pos : ∀ P : List Nat, P.isEmpty = false → 0 < P.length
| [], h => nomatch h
| _ :: _, _ => Nat.succ_pos _
/-- **The family F_p is indecomposable** (p prime, gcd(14, p) = 1, x₀ ≠ 1). -/
theorem fam_indec (p i0 x0 : Nat) (hp : 0 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hi : i0 < p) (hx : 1 + 14 * i0 = p * x0) (hx1 : x0 ≠ 1) : indec (14 * p) (fam p i0) = true := by
have h0 : p ∣ 1 + 14 * i0 := ⟨x0, hx⟩
-- the indicator of the multiples of p sums to 1 over F_p
have hfk : ∀ k, k < p → ind p ((fun k => if Nat.beq k i0 then 1 + 14 * k + 6 * p else 1 + 14 * k) k)
= (if Nat.beq k i0 then 1 else 0) := by
intro k hk
cases e : Nat.beq k i0 with
| true =>
have ek := Nat.eq_of_beq_eq_true e
subst ek
show ind p (if Nat.beq k k = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = 1
rw [e]
show (if Nat.beq ((1 + 14 * k + 6 * p) % p) 0 = true then 1 else 0) = 1
have : (1 + 14 * k + 6 * p) % p = 0 := mod_zero p _ hp ⟨x0 + 6, by rw [hx]; lib_nat⟩
rw [this]; rfl
| false =>
show ind p (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = 0
rw [e]
show (if Nat.beq ((1 + 14 * k) % p) 0 = true then 1 else 0) = 0
cases e2 : Nat.beq ((1 + 14 * k) % p) 0 with
| false => rfl
| true =>
exfalso
have z := Nat.eq_of_beq_eq_true e2
have ⟨q, hq⟩ := div_mod p hp (1 + 14 * k + 1) (1 + 14 * k) (Nat.lt_succ_self _)
rw [z, Nat.zero_add] at hq
have hk0 : k ≠ i0 := fun h => by rw [h, beq_refl'] at e; exact nomatch e
exact hk0 (idx_unique p k i0 hp h14 hk hi ⟨q, hq⟩ h0)
have tot : gs (ind p) (fam p i0) = 1 := by
unfold fam
rw [gl_gs, sumF_congr_lt _ _ p hfk]
have r := sumF_replace (fun k => if Nat.beq k i0 = true then 1 else 0) (fun _ => 0) i0 (fun k hk => by
cases e : Nat.beq k i0 with
| true => exact absurd (Nat.eq_of_beq_eq_true e) hk
| false => rfl) p hi
have r' : sumF (fun k => if Nat.beq k i0 = true then 1 else 0) p + 0 = sumF (fun _ => 0) p + (if Nat.beq i0 i0 = true then 1 else 0) := r
rw [beq_refl'] at r'
have z : ∀ n, sumF (fun _ => 0) n = 0 := by
intro n; induction n with
| zero => rfl
| succ n ih => show sumF (fun _ => 0) n + 0 = 0; rw [ih]
rw [z] at r'
exact r'
-- a decomposition gives a balanced nonempty part without the multiple of p
cases hind : indec (14 * p) (fam p i0) with
| true => rfl
| false =>
exfalso
cases all_false _ (splits (fam p i0)) hind with
| intro sp hsp =>
have hpr' := splits_props (fam p i0) sp.1 sp.2 hsp.1
have hf : (sp.1.isEmpty || sp.2.isEmpty || !(bal (14 * p) sp.1 && bal (14 * p) sp.2)) = false := hsp.2
have hsum := splits_gs (ind p) (fam p i0) sp.1 sp.2 hsp.1
rw [tot] at hsum
cases h1 : sp.1.isEmpty with
| true => rw [h1] at hf; exact nomatch hf
| false => cases h2 : sp.2.isEmpty with
| true => rw [h1, h2] at hf; exact nomatch hf
| false => cases hA : bal (14 * p) sp.1 with
| false => rw [h1, h2, hA] at hf; exact nomatch hf
| true => cases hB : bal (14 * p) sp.2 with
| false => rw [h1, h2, hA, hB] at hf; exact nomatch hf
| true =>
-- the part P with gs ind P = 0
have part : ∀ P : List Nat, (∀ x, x ∈ P → x ∈ fam p i0) → gs (ind p) P = 0 → P.isEmpty = false →
bal (14 * p) P = true → False := by
intro P hPm hP0 hPne hPb
apply hx1
apply coset_part p i0 x0 hp hpr h14 hi hx P (len_pos P hPne) _ hPb
intro x hxP
have ⟨k, hk, ek⟩ := gl_mem _ p x (hPm x hxP)
have hk0 : k ≠ i0 := by
intro e
have := gs_zero (ind p) P hP0 x hxP
rw [← ek, hfk k hk, e, beq_refl'] at this
exact nomatch this
refine ⟨k, hk, hk0, ?_⟩
rw [← ek]
show (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = 1 + 14 * k
cases e : Nat.beq k i0 with
| true => exact absurd (Nat.eq_of_beq_eq_true e) hk0
| false => rfl
cases ea : gs (ind p) sp.1 with
| zero => exact part sp.1 hpr'.2.1 ea h1 hA
| succ a =>
have eb : gs (ind p) sp.2 = 0 := by
rw [ea] at hsum
cases e2 : gs (ind p) sp.2 with
| zero => rfl
| succ b =>
rw [e2] at hsum
exfalso
have e3 : (a + b + 1) + 1 = 0 + 1 := by
calc (a + b + 1) + 1 = (a + 1) + (b + 1) := by lib_nat
_ = 1 := hsum
exact Nat.noConfusion (Nat.succ.inj e3)
exact part sp.2 hpr'.2.2 eb h2 hB
end FamIndec3
#print axioms FamIndec3.splits_gs
#print axioms FamIndec3.tsum_gs
#print axioms FamIndec3.gs_zero
#print axioms FamIndec3.mem_filter'
#print axioms FamIndec3.mem_loop
#print axioms FamIndec3.mem_range'
#print axioms FamIndec3.bal_unit
#print axioms FamIndec3.sumF_add
#print axioms FamIndec3.swap
#print axioms FamIndec3.gs_ite
#print axioms FamIndec3.gs_const_len
#print axioms FamIndec3.gs_add_const
#print axioms FamIndec3.ite_two
#print axioms FamIndec3.coset_part
#print axioms FamIndec3.gl_gs
#print axioms FamIndec3.len_pos
#print axioms FamIndec3.fam_indec
lean_all/hodge/FamInst.lean
/-
hodge/FamInst.lean — T41 cycle 1163 (goal G749 — instances): a Bool primality certificate and the family F_p as
balanced indecomposable characters for p = 3, 5, 17, 19, 31, 47, 59, 61, 73, 89, 101, 103, 131, 157, 173, 199:
prime_of primeB n = true, 1 < n ⇒ ∀ d, d ∣ n → d = 1 ∨ d = n
fp3 … fp31 bal (14p) (fam p i₀) = true ∧ indec (14p) (fam p i₀) = true (FamBal.fam_bal, FamIndec3.fam_indec)
F_5 = [57, 43, 29, 45, 1] is the open m = 70 seed of G498c.
Lean 4 core plus hodge/FamIndec3, hodge/FamBal.
-/
import hodge.FamIndec3
namespace FamInst
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal FamIndec1 FamIndec2 FamIndec3
def primeB (n : Nat) : Bool := (List.range n).all (fun d => Nat.blt d 2 || !Nat.beq (n % d) 0)
theorem le_of_dvd' (d n : Nat) (hn : 0 < n) (h : d ∣ n) : d ≤ n := by
have ⟨c, hc⟩ := h
cases c with
| zero => rw [Nat.mul_zero] at hc; rw [hc] at hn; exact absurd hn (Nat.lt_irrefl 0)
| succ c => rw [hc, show d * (c + 1) = d + d * c by lib_nat]; exact Nat.le_add_right _ _
theorem prime_of (n : Nat) (hb : primeB n = true) (hn : 1 < n) : ∀ d, d ∣ n → d = 1 ∨ d = n := by
intro d hd
have hn0 : 0 < n := Nat.lt_of_lt_of_le (Nat.zero_lt_one) (Nat.le_of_lt hn)
have hle := le_of_dvd' d n hn0 hd
cases Nat.lt_or_ge d n with
| inr hge => exact Or.inr (Nat.le_antisymm hle hge)
| inl hlt =>
have hc := all_mem _ _ hb d (mem_range' n d hlt)
cases d with
| zero =>
have ⟨c, hc'⟩ := hd
rw [Nat.zero_mul] at hc'; rw [hc'] at hn0; exact absurd hn0 (Nat.lt_irrefl 0)
| succ d =>
cases d with
| zero => exact Or.inl rfl
| succ d =>
exfalso
have z := mod_zero (d + 2) n (Nat.succ_pos _) hd
have hlt2 : Nat.blt (d + 2) 2 = false := rfl
rw [hlt2, z] at hc
exact nomatch hc
theorem p3 : ∀ d, d ∣ 3 → d = 1 ∨ d = 3 := prime_of 3 rfl (Nat.succ_lt_succ (Nat.succ_pos 1))
theorem p5 : ∀ d, d ∣ 5 → d = 1 ∨ d = 5 := prime_of 5 rfl (Nat.succ_lt_succ (Nat.succ_pos 3))
theorem p17 : ∀ d, d ∣ 17 → d = 1 ∨ d = 17 := prime_of 17 rfl (Nat.succ_lt_succ (Nat.succ_pos 15))
theorem p19 : ∀ d, d ∣ 19 → d = 1 ∨ d = 19 := prime_of 19 rfl (Nat.succ_lt_succ (Nat.succ_pos 17))
theorem p31 : ∀ d, d ∣ 31 → d = 1 ∨ d = 31 := prime_of 31 rfl (Nat.succ_lt_succ (Nat.succ_pos 29))
theorem ne1 (x : Nat) (h : Nat.beq x 1 = false) : x ≠ 1 := fun e => by rw [e] at h; exact nomatch h
/-- F_3 = fam 3 1 (1 + 14 = 3·5), F_5 = fam 5 1 (15 = 5·3), F_17 = fam 17 6 (85 = 17·5), F_19 = fam 19 4 (57 = 19·3),
F_31 = fam 31 11 (155 = 31·5) -/
theorem fp3 : bal 42 (fam 3 1) = true ∧ indec 42 (fam 3 1) = true :=
⟨fam_bal 3 1 5 (Nat.succ_pos 2) (Nat.succ_lt_succ (Nat.succ_pos 1)) rfl rfl,
fam_indec 3 1 5 (Nat.succ_pos 2) p3 rfl (Nat.succ_lt_succ (Nat.succ_pos 1)) rfl (ne1 5 rfl)⟩
theorem fp5 : bal 70 (fam 5 1) = true ∧ indec 70 (fam 5 1) = true :=
⟨fam_bal 5 1 3 (Nat.succ_pos 4) (Nat.succ_lt_succ (Nat.succ_pos 3)) rfl rfl,
fam_indec 5 1 3 (Nat.succ_pos 4) p5 rfl (Nat.succ_lt_succ (Nat.succ_pos 3)) rfl (ne1 3 rfl)⟩
theorem fp17 : bal 238 (fam 17 6) = true ∧ indec 238 (fam 17 6) = true :=
⟨fam_bal 17 6 5 (Nat.succ_pos 16) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 6) (Nat.le_add_left 7 10)) rfl rfl,
fam_indec 17 6 5 (Nat.succ_pos 16) p17 rfl (Nat.lt_of_lt_of_le (Nat.lt_succ_self 6) (Nat.le_add_left 7 10)) rfl (ne1 5 rfl)⟩
theorem fp19 : bal 266 (fam 19 4) = true ∧ indec 266 (fam 19 4) = true :=
⟨fam_bal 19 4 3 (Nat.succ_pos 18) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 4) (Nat.le_add_left 5 14)) rfl rfl,
fam_indec 19 4 3 (Nat.succ_pos 18) p19 rfl (Nat.lt_of_lt_of_le (Nat.lt_succ_self 4) (Nat.le_add_left 5 14)) rfl (ne1 3 rfl)⟩
theorem fp31 : bal 434 (fam 31 11) = true ∧ indec 434 (fam 31 11) = true :=
⟨fam_bal 31 11 5 (Nat.succ_pos 30) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 11) (Nat.le_add_left 12 19)) rfl rfl,
fam_indec 31 11 5 (Nat.succ_pos 30) p31 rfl (Nat.lt_of_lt_of_le (Nat.lt_succ_self 11) (Nat.le_add_left 12 19)) rfl (ne1 5 rfl)⟩
theorem fam5_seed : fam 5 1 = [57, 43, 29, 45, 1] := rfl
/-- the instance builder: all hypotheses are Bool checks (rfl) -/
theorem fp_inst (p i0 x0 : Nat) (hb : primeB p = true) (h2 : Nat.ble 2 p = true) (hi : Nat.ble (i0 + 1) p = true)
(hx : 1 + 14 * i0 = p * x0) (h14 : Nat.gcd 14 p = 1) (hs : fcond (x0 % 14) = true) (hx1 : Nat.beq x0 1 = false) :
bal (14 * p) (fam p i0) = true ∧ indec (14 * p) (fam p i0) = true := by
have hp2 : 2 ≤ p := Nat.le_of_ble_eq_true h2
have hp : 0 < p := Nat.lt_of_lt_of_le (Nat.succ_pos 1) hp2
have hi' : i0 < p := Nat.le_of_ble_eq_true hi
exact ⟨fam_bal p i0 x0 hp hi' hx hs, fam_indec p i0 x0 hp (prime_of p hb hp2) h14 hi' hx (ne1 x0 hx1)⟩
theorem fp47 : bal 658 (fam 47 10) = true ∧ indec 658 (fam 47 10) = true := fp_inst 47 10 3 rfl rfl rfl rfl rfl rfl rfl
theorem fp59 : bal 826 (fam 59 21) = true ∧ indec 826 (fam 59 21) = true := fp_inst 59 21 5 rfl rfl rfl rfl rfl rfl rfl
theorem fp61 : bal 854 (fam 61 13) = true ∧ indec 854 (fam 61 13) = true := fp_inst 61 13 3 rfl rfl rfl rfl rfl rfl rfl
theorem fp73 : bal 1022 (fam 73 26) = true ∧ indec 1022 (fam 73 26) = true := fp_inst 73 26 5 rfl rfl rfl rfl rfl rfl rfl
theorem fp89 : bal 1246 (fam 89 19) = true ∧ indec 1246 (fam 89 19) = true := fp_inst 89 19 3 rfl rfl rfl rfl rfl rfl rfl
theorem fp101 : bal 1414 (fam 101 36) = true ∧ indec 1414 (fam 101 36) = true := fp_inst 101 36 5 rfl rfl rfl rfl rfl rfl rfl
theorem fp103 : bal 1442 (fam 103 22) = true ∧ indec 1442 (fam 103 22) = true := fp_inst 103 22 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 100000 in
theorem fp131 : bal 1834 (fam 131 28) = true ∧ indec 1834 (fam 131 28) = true := fp_inst 131 28 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 100000 in
theorem fp157 : bal 2198 (fam 157 56) = true ∧ indec 2198 (fam 157 56) = true := fp_inst 157 56 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 100000 in
theorem fp173 : bal 2422 (fam 173 37) = true ∧ indec 2422 (fam 173 37) = true := fp_inst 173 37 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 100000 in
theorem fp199 : bal 2786 (fam 199 71) = true ∧ indec 2786 (fam 199 71) = true := fp_inst 199 71 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp227 : bal 3178 (fam 227 81) = true ∧ indec 3178 (fam 227 81) = true := fp_inst 227 81 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp229 : bal 3206 (fam 229 49) = true ∧ indec 3206 (fam 229 49) = true := fp_inst 229 49 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp241 : bal 3374 (fam 241 86) = true ∧ indec 3374 (fam 241 86) = true := fp_inst 241 86 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp257 : bal 3598 (fam 257 55) = true ∧ indec 3598 (fam 257 55) = true := fp_inst 257 55 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp269 : bal 3766 (fam 269 96) = true ∧ indec 3766 (fam 269 96) = true := fp_inst 269 96 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp271 : bal 3794 (fam 271 58) = true ∧ indec 3794 (fam 271 58) = true := fp_inst 271 58 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp283 : bal 3962 (fam 283 101) = true ∧ indec 3962 (fam 283 101) = true := fp_inst 283 101 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp311 : bal 4354 (fam 311 111) = true ∧ indec 4354 (fam 311 111) = true := fp_inst 311 111 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp313 : bal 4382 (fam 313 67) = true ∧ indec 4382 (fam 313 67) = true := fp_inst 313 67 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp353 : bal 4942 (fam 353 126) = true ∧ indec 4942 (fam 353 126) = true := fp_inst 353 126 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp367 : bal 5138 (fam 367 131) = true ∧ indec 5138 (fam 367 131) = true := fp_inst 367 131 5 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp383 : bal 5362 (fam 383 82) = true ∧ indec 5362 (fam 383 82) = true := fp_inst 383 82 3 rfl rfl rfl rfl rfl rfl rfl
set_option maxRecDepth 200000 in
theorem fp397 : bal 5558 (fam 397 85) = true ∧ indec 5558 (fam 397 85) = true := fp_inst 397 85 3 rfl rfl rfl rfl rfl rfl rfl
end FamInst
#print axioms FamInst.le_of_dvd'
#print axioms FamInst.prime_of
#print axioms FamInst.p3
#print axioms FamInst.p5
#print axioms FamInst.p17
#print axioms FamInst.p19
#print axioms FamInst.p31
#print axioms FamInst.ne1
#print axioms FamInst.fp3
#print axioms FamInst.fp5
#print axioms FamInst.fp17
#print axioms FamInst.fp19
#print axioms FamInst.fp31
#print axioms FamInst.fam5_seed
#print axioms FamInst.fp_inst
#print axioms FamInst.fp47
#print axioms FamInst.fp59
#print axioms FamInst.fp61
#print axioms FamInst.fp73
#print axioms FamInst.fp89
#print axioms FamInst.fp101
#print axioms FamInst.fp103
#print axioms FamInst.fp131
#print axioms FamInst.fp157
#print axioms FamInst.fp173
#print axioms FamInst.fp199
#print axioms FamInst.fp227
#print axioms FamInst.fp229
#print axioms FamInst.fp241
#print axioms FamInst.fp257
#print axioms FamInst.fp269
#print axioms FamInst.fp271
#print axioms FamInst.fp283
#print axioms FamInst.fp311
#print axioms FamInst.fp313
#print axioms FamInst.fp353
#print axioms FamInst.fp367
#print axioms FamInst.fp383
#print axioms FamInst.fp397
lean_all/hodge/FamInst113.lean
/-
hodge/FamInst113.lean — T41 (goal G865e): F′_113 is indecomposable. The data of the rank certificate
hodge/FamCert113 (columns C = 111 units mod 1582, the first 111 elements xs of F′_113 and the last ℓ = 1569) and
the finite checks of hodge/FamBridge.fam_counts, by rfl (tools/g865_inst.py):
indec113 a list S over F′_113 balanced at every t ∈ C contains every element of xs exactly as often as ℓ,
so a balanced subset of F′_113 is ∅ or F′_113. Lean 4 core.
-/
import hodge.FamCert113
import hodge.FamBridge
set_option maxHeartbeats 0
set_option maxRecDepth 100000
namespace FamInst113
open MailletLin MailletBridge FamBridge
def xs : List Nat := [1, 15, 29, 43, 57, 71, 85, 99, 127, 141, 155, 169, 183, 197, 211, 225, 239, 253, 267, 281, 295, 309, 323, 337, 351, 365, 379, 393, 407, 421, 435, 449, 463, 477, 491, 505, 519, 533, 547, 561, 575, 589, 603, 617, 631, 645, 659, 673, 687, 701, 715, 729, 743, 757, 771, 785, 799, 813, 827, 841, 855, 869, 883, 897, 911, 925, 939, 953, 967, 981, 995, 1009, 1023, 1037, 1051, 1065, 10 -- (+207 chars; full line in the Zenodo source)
def C : List Nat := [1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27, 29, 31, 33, 37, 39, 41, 43, 45, 47, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 73, 75, 79, 81, 83, 85, 87, 89, 93, 95, 97, 99, 101, 103, 107, 109, 111, 115, 117, 121, 123, 125, 127, 129, 131, 135, 137, 139, 141, 143, 145, 149, 151, 153, 155, 157, 159, 163, 165, 167, 169, 171, 173, 177, 179, 181, 183, 185, 187, 191, 193, 195, 197, 199, 2 -- (+128 chars; full line in the Zenodo source)
theorem hA_def : FamCert113.A = C.map (fun t => rowA 1582 t xs) := rfl
theorem hcl_def : FamCert113.cl = C.map (fun t => 2 * (((t * 1569) % 1582 : Nat) : Int) - ((1582 : Nat) : Int)) := rfl
theorem hW_def : FamCert113.W = smul (-646701086328051203347283892188685850560) (ones 111) := rfl
theorem len_xs : xs.length = 111 := rfl
def rowChk : Bool := C.all (fun t => xs.all (fun y =>
decide (dot (rowA 1582 t xs) (ev xs y) = 2 * (((t * y) % 1582 : Nat) : Int) - ((1582 : Nat) : Int))))
def lastChk : Bool := C.all (fun t => decide (dot (rowA 1582 t xs) (ev xs 1569) = 0))
def neChk : Bool := xs.all (fun y => !(Nat.beq 1569 y))
theorem rowChk_ok : rowChk = true := rfl
theorem lastChk_ok : lastChk = true := rfl
theorem neChk_ok : neChk = true := rfl
theorem all_mem {α : Type} (P : α → Bool) : ∀ (l : List α) (x : α), l.all P = true → x ∈ l → P x = true
| [], _, _, h => nomatch h
| y :: l, x, h, hx => by
have h1 : P y = true := MailletBridge.and_true_left h
have h2 : l.all P = true := MailletBridge.and_true_right h
cases hx with
| head => exact h1
| tail _ hx' => exact all_mem P l x h2 hx'
theorem ne_of_beq_false {a b : Nat} (h : (!(Nat.beq a b)) = true) : a ≠ b := by
intro e
rw [e, beq_refl] at h
exact nomatch h
/-- **F′_113 is indecomposable**: a list over F′_113 balanced at every t ∈ C has equal counts. -/
theorem indec113 (S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = 1569)
(hbal : ∀ t, t ∈ C → tsum 1582 t S + tsum 1582 t S = S.length * 1582) :
gv xs S = smul (cnt 1569 S : Int) (ones 111) := by
have hA : allLen xs.length (C.map (fun t => rowA 1582 t xs)) = true := by
rw [len_xs, ← hA_def]; exact FamCert113.allLen_A
have hc : lcs xs.length FamCert113.B (C.map (fun t => rowA 1582 t xs)) = sid 646701086328051203347283892188685850560 xs.length := by
rw [len_xs, ← hA_def]; exact FamCert113.cert
have hW : mv FamCert113.B (C.map (fun t => 2 * (((t * 1569) % 1582 : Nat) : Int) - ((1582 : Nat) : Int)))
= smul (-646701086328051203347283892188685850560) (ones xs.length) := by
rw [len_xs, ← hcl_def, FamCert113.w_eq, hW_def]
have hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs →
dot (rowA 1582 t xs) (ev xs y) = 2 * (((t * y) % 1582 : Nat) : Int) - ((1582 : Nat) : Int) := fun t ht y hy =>
decide_eq (all_mem _ xs y (all_mem _ C t rowChk_ok ht) hy)
have hl : ∀ t, t ∈ C → dot (rowA 1582 t xs) (ev xs 1569) = 0 := fun t ht =>
decide_eq (all_mem _ C t lastChk_ok ht)
have hne : ∀ y, y ∈ xs → 1569 ≠ y := fun y hy => ne_of_beq_false (all_mem _ xs y neChk_ok hy)
have r := fam_counts 1582 1569 xs C 646701086328051203347283892188685850560 (fun h => nomatch h) FamCert113.B hA hc hW hrow hl hne S hS hbal
rw [len_xs] at r
exact r
end FamInst113
#print axioms FamInst113.hA_def
#print axioms FamInst113.hcl_def
#print axioms FamInst113.hW_def
#print axioms FamInst113.len_xs
#print axioms FamInst113.rowChk_ok
#print axioms FamInst113.lastChk_ok
#print axioms FamInst113.neChk_ok
#print axioms FamInst113.all_mem
#print axioms FamInst113.ne_of_beq_false
#print axioms FamInst113.indec113
lean_all/hodge/FamInst127.lean
/-
hodge/FamInst127.lean — T41 (goal G865e): F′_127 is indecomposable. The data of the rank certificate
hodge/FamCert127 (columns C = 125 units mod 1778, the first 125 elements xs of F′_127 and the last ℓ = 1765) and
the finite checks of hodge/FamBridge.fam_counts, by rfl (tools/g865_inst.py):
indec127 a list S over F′_127 balanced at every t ∈ C contains every element of xs exactly as often as ℓ,
so a balanced subset of F′_127 is ∅ or F′_127. Lean 4 core.
-/
import hodge.FamCert127
import hodge.FamBridge
set_option maxHeartbeats 0
set_option maxRecDepth 100000
namespace FamInst127
open MailletLin MailletBridge FamBridge
def xs : List Nat := [1, 15, 29, 43, 57, 71, 85, 99, 113, 141, 155, 169, 183, 197, 211, 225, 239, 253, 267, 281, 295, 309, 323, 337, 351, 365, 379, 393, 407, 421, 435, 449, 463, 477, 491, 505, 519, 533, 547, 561, 575, 589, 603, 617, 631, 645, 659, 673, 687, 701, 715, 729, 743, 757, 771, 785, 799, 813, 827, 841, 855, 869, 883, 897, 911, 925, 939, 953, 967, 981, 995, 1009, 1023, 1037, 1051, 1065, 10 -- (+291 chars; full line in the Zenodo source)
def C : List Nat := [1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27, 29, 31, 33, 37, 39, 41, 43, 45, 47, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 73, 75, 79, 81, 83, 85, 87, 89, 93, 95, 97, 99, 101, 103, 107, 109, 111, 113, 115, 117, 121, 123, 125, 129, 131, 135, 137, 139, 141, 143, 145, 149, 151, 153, 155, 157, 159, 163, 165, 167, 169, 171, 173, 177, 179, 181, 183, 185, 187, 191, 193, 195, 197, 199, 2 -- (+198 chars; full line in the Zenodo source)
theorem hA_def : FamCert127.A = C.map (fun t => rowA 1778 t xs) := rfl
theorem hcl_def : FamCert127.cl = C.map (fun t => 2 * (((t * 1765) % 1778 : Nat) : Int) - ((1778 : Nat) : Int)) := rfl
theorem hW_def : FamCert127.W = smul (-43695760204506482216150656097585456725303823520) (ones 125) := rfl
theorem len_xs : xs.length = 125 := rfl
def rowChk : Bool := C.all (fun t => xs.all (fun y =>
decide (dot (rowA 1778 t xs) (ev xs y) = 2 * (((t * y) % 1778 : Nat) : Int) - ((1778 : Nat) : Int))))
def lastChk : Bool := C.all (fun t => decide (dot (rowA 1778 t xs) (ev xs 1765) = 0))
def neChk : Bool := xs.all (fun y => !(Nat.beq 1765 y))
theorem rowChk_ok : rowChk = true := rfl
theorem lastChk_ok : lastChk = true := rfl
theorem neChk_ok : neChk = true := rfl
theorem all_mem {α : Type} (P : α → Bool) : ∀ (l : List α) (x : α), l.all P = true → x ∈ l → P x = true
| [], _, _, h => nomatch h
| y :: l, x, h, hx => by
have h1 : P y = true := MailletBridge.and_true_left h
have h2 : l.all P = true := MailletBridge.and_true_right h
cases hx with
| head => exact h1
| tail _ hx' => exact all_mem P l x h2 hx'
theorem ne_of_beq_false {a b : Nat} (h : (!(Nat.beq a b)) = true) : a ≠ b := by
intro e
rw [e, beq_refl] at h
exact nomatch h
/-- **F′_127 is indecomposable**: a list over F′_127 balanced at every t ∈ C has equal counts. -/
theorem indec127 (S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = 1765)
(hbal : ∀ t, t ∈ C → tsum 1778 t S + tsum 1778 t S = S.length * 1778) :
gv xs S = smul (cnt 1765 S : Int) (ones 125) := by
have hA : allLen xs.length (C.map (fun t => rowA 1778 t xs)) = true := by
rw [len_xs, ← hA_def]; exact FamCert127.allLen_A
have hc : lcs xs.length FamCert127.B (C.map (fun t => rowA 1778 t xs)) = sid 43695760204506482216150656097585456725303823520 xs.length := by
rw [len_xs, ← hA_def]; exact FamCert127.cert
have hW : mv FamCert127.B (C.map (fun t => 2 * (((t * 1765) % 1778 : Nat) : Int) - ((1778 : Nat) : Int)))
= smul (-43695760204506482216150656097585456725303823520) (ones xs.length) := by
rw [len_xs, ← hcl_def, FamCert127.w_eq, hW_def]
have hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs →
dot (rowA 1778 t xs) (ev xs y) = 2 * (((t * y) % 1778 : Nat) : Int) - ((1778 : Nat) : Int) := fun t ht y hy =>
decide_eq (all_mem _ xs y (all_mem _ C t rowChk_ok ht) hy)
have hl : ∀ t, t ∈ C → dot (rowA 1778 t xs) (ev xs 1765) = 0 := fun t ht =>
decide_eq (all_mem _ C t lastChk_ok ht)
have hne : ∀ y, y ∈ xs → 1765 ≠ y := fun y hy => ne_of_beq_false (all_mem _ xs y neChk_ok hy)
have r := fam_counts 1778 1765 xs C 43695760204506482216150656097585456725303823520 (fun h => nomatch h) FamCert127.B hA hc hW hrow hl hne S hS hbal
rw [len_xs] at r
exact r
end FamInst127
#print axioms FamInst127.hA_def
#print axioms FamInst127.hcl_def
#print axioms FamInst127.hW_def
#print axioms FamInst127.len_xs
#print axioms FamInst127.rowChk_ok
#print axioms FamInst127.lastChk_ok
#print axioms FamInst127.neChk_ok
#print axioms FamInst127.all_mem
#print axioms FamInst127.ne_of_beq_false
#print axioms FamInst127.indec127
lean_all/hodge/FamInst15.lean
/-
hodge/FamInst15.lean — T41 (goal G865e): F′_15 is indecomposable. The data of the rank certificate
hodge/FamCert15 (columns C = 13 units mod 210, the first 13 elements xs of F′_15 and the last ℓ = 197) and
the finite checks of hodge/FamBridge.fam_counts, by rfl (tools/g865_inst.py):
indec15 a list S over F′_15 balanced at every t ∈ C contains every element of xs exactly as often as ℓ,
so a balanced subset of F′_15 is ∅ or F′_15. Lean 4 core.
-/
import hodge.FamCert15
import hodge.FamBridge
set_option maxHeartbeats 0
set_option maxRecDepth 100000
namespace FamInst15
open MailletLin MailletBridge FamBridge
def xs : List Nat := [1, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, 169, 183]
def C : List Nat := [1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 59, 61]
theorem hA_def : FamCert15.A = C.map (fun t => rowA 210 t xs) := rfl
theorem hcl_def : FamCert15.cl = C.map (fun t => 2 * (((t * 197) % 210 : Nat) : Int) - ((210 : Nat) : Int)) := rfl
theorem hW_def : FamCert15.W = smul (-420) (ones 13) := rfl
theorem len_xs : xs.length = 13 := rfl
def rowChk : Bool := C.all (fun t => xs.all (fun y =>
decide (dot (rowA 210 t xs) (ev xs y) = 2 * (((t * y) % 210 : Nat) : Int) - ((210 : Nat) : Int))))
def lastChk : Bool := C.all (fun t => decide (dot (rowA 210 t xs) (ev xs 197) = 0))
def neChk : Bool := xs.all (fun y => !(Nat.beq 197 y))
theorem rowChk_ok : rowChk = true := rfl
theorem lastChk_ok : lastChk = true := rfl
theorem neChk_ok : neChk = true := rfl
theorem all_mem {α : Type} (P : α → Bool) : ∀ (l : List α) (x : α), l.all P = true → x ∈ l → P x = true
| [], _, _, h => nomatch h
| y :: l, x, h, hx => by
have h1 : P y = true := MailletBridge.and_true_left h
have h2 : l.all P = true := MailletBridge.and_true_right h
cases hx with
| head => exact h1
| tail _ hx' => exact all_mem P l x h2 hx'
theorem ne_of_beq_false {a b : Nat} (h : (!(Nat.beq a b)) = true) : a ≠ b := by
intro e
rw [e, beq_refl] at h
exact nomatch h
/-- **F′_15 is indecomposable**: a list over F′_15 balanced at every t ∈ C has equal counts. -/
theorem indec15 (S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = 197)
(hbal : ∀ t, t ∈ C → tsum 210 t S + tsum 210 t S = S.length * 210) :
gv xs S = smul (cnt 197 S : Int) (ones 13) := by
have hA : allLen xs.length (C.map (fun t => rowA 210 t xs)) = true := by
rw [len_xs, ← hA_def]; exact FamCert15.allLen_A
have hc : lcs xs.length FamCert15.B (C.map (fun t => rowA 210 t xs)) = sid 420 xs.length := by
rw [len_xs, ← hA_def]; exact FamCert15.cert
have hW : mv FamCert15.B (C.map (fun t => 2 * (((t * 197) % 210 : Nat) : Int) - ((210 : Nat) : Int)))
= smul (-420) (ones xs.length) := by
rw [len_xs, ← hcl_def, FamCert15.w_eq, hW_def]
have hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs →
dot (rowA 210 t xs) (ev xs y) = 2 * (((t * y) % 210 : Nat) : Int) - ((210 : Nat) : Int) := fun t ht y hy =>
decide_eq (all_mem _ xs y (all_mem _ C t rowChk_ok ht) hy)
have hl : ∀ t, t ∈ C → dot (rowA 210 t xs) (ev xs 197) = 0 := fun t ht =>
decide_eq (all_mem _ C t lastChk_ok ht)
have hne : ∀ y, y ∈ xs → 197 ≠ y := fun y hy => ne_of_beq_false (all_mem _ xs y neChk_ok hy)
have r := fam_counts 210 197 xs C 420 (fun h => nomatch h) FamCert15.B hA hc hW hrow hl hne S hS hbal
rw [len_xs] at r
exact r
end FamInst15
#print axioms FamInst15.hA_def
#print axioms FamInst15.hcl_def
#print axioms FamInst15.hW_def
#print axioms FamInst15.len_xs
#print axioms FamInst15.rowChk_ok
#print axioms FamInst15.lastChk_ok
#print axioms FamInst15.neChk_ok
#print axioms FamInst15.all_mem
#print axioms FamInst15.ne_of_beq_false
#print axioms FamInst15.indec15
lean_all/hodge/FamInst29.lean
/-
hodge/FamInst29.lean — T41 (goal G865e): F′_29 is indecomposable. The data of the rank certificate
hodge/FamCert29 (columns C = 27 units mod 406, the first 27 elements xs of F′_29 and the last ℓ = 393) and
the finite checks of hodge/FamBridge.fam_counts, by rfl (tools/g865_inst.py):
indec29 a list S over F′_29 balanced at every t ∈ C contains every element of xs exactly as often as ℓ,
so a balanced subset of F′_29 is ∅ or F′_29. Lean 4 core.
-/
import hodge.FamCert29
import hodge.FamBridge
set_option maxHeartbeats 0
set_option maxRecDepth 100000
namespace FamInst29
open MailletLin MailletBridge FamBridge
def xs : List Nat := [1, 15, 43, 57, 71, 85, 99, 113, 127, 141, 155, 169, 183, 197, 211, 225, 239, 253, 267, 281, 295, 309, 323, 337, 351, 365, 379]
def C : List Nat := [1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27, 31, 33, 37, 39, 41, 43, 45, 47, 51, 53, 55, 57, 59, 61, 65]
theorem hA_def : FamCert29.A = C.map (fun t => rowA 406 t xs) := rfl
theorem hcl_def : FamCert29.cl = C.map (fun t => 2 * (((t * 393) % 406 : Nat) : Int) - ((406 : Nat) : Int)) := rfl
theorem hW_def : FamCert29.W = smul (-37352) (ones 27) := rfl
theorem len_xs : xs.length = 27 := rfl
def rowChk : Bool := C.all (fun t => xs.all (fun y =>
decide (dot (rowA 406 t xs) (ev xs y) = 2 * (((t * y) % 406 : Nat) : Int) - ((406 : Nat) : Int))))
def lastChk : Bool := C.all (fun t => decide (dot (rowA 406 t xs) (ev xs 393) = 0))
def neChk : Bool := xs.all (fun y => !(Nat.beq 393 y))
theorem rowChk_ok : rowChk = true := rfl
theorem lastChk_ok : lastChk = true := rfl
theorem neChk_ok : neChk = true := rfl
theorem all_mem {α : Type} (P : α → Bool) : ∀ (l : List α) (x : α), l.all P = true → x ∈ l → P x = true
| [], _, _, h => nomatch h
| y :: l, x, h, hx => by
have h1 : P y = true := MailletBridge.and_true_left h
have h2 : l.all P = true := MailletBridge.and_true_right h
cases hx with
| head => exact h1
| tail _ hx' => exact all_mem P l x h2 hx'
theorem ne_of_beq_false {a b : Nat} (h : (!(Nat.beq a b)) = true) : a ≠ b := by
intro e
rw [e, beq_refl] at h
exact nomatch h
/-- **F′_29 is indecomposable**: a list over F′_29 balanced at every t ∈ C has equal counts. -/
theorem indec29 (S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = 393)
(hbal : ∀ t, t ∈ C → tsum 406 t S + tsum 406 t S = S.length * 406) :
gv xs S = smul (cnt 393 S : Int) (ones 27) := by
have hA : allLen xs.length (C.map (fun t => rowA 406 t xs)) = true := by
rw [len_xs, ← hA_def]; exact FamCert29.allLen_A
have hc : lcs xs.length FamCert29.B (C.map (fun t => rowA 406 t xs)) = sid 37352 xs.length := by
rw [len_xs, ← hA_def]; exact FamCert29.cert
have hW : mv FamCert29.B (C.map (fun t => 2 * (((t * 393) % 406 : Nat) : Int) - ((406 : Nat) : Int)))
= smul (-37352) (ones xs.length) := by
rw [len_xs, ← hcl_def, FamCert29.w_eq, hW_def]
have hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs →
dot (rowA 406 t xs) (ev xs y) = 2 * (((t * y) % 406 : Nat) : Int) - ((406 : Nat) : Int) := fun t ht y hy =>
decide_eq (all_mem _ xs y (all_mem _ C t rowChk_ok ht) hy)
have hl : ∀ t, t ∈ C → dot (rowA 406 t xs) (ev xs 393) = 0 := fun t ht =>
decide_eq (all_mem _ C t lastChk_ok ht)
have hne : ∀ y, y ∈ xs → 393 ≠ y := fun y hy => ne_of_beq_false (all_mem _ xs y neChk_ok hy)
have r := fam_counts 406 393 xs C 37352 (fun h => nomatch h) FamCert29.B hA hc hW hrow hl hne S hS hbal
rw [len_xs] at r
exact r
end FamInst29
#print axioms FamInst29.hA_def
#print axioms FamInst29.hcl_def
#print axioms FamInst29.hW_def
#print axioms FamInst29.len_xs
#print axioms FamInst29.rowChk_ok
#print axioms FamInst29.lastChk_ok
#print axioms FamInst29.neChk_ok
#print axioms FamInst29.all_mem
#print axioms FamInst29.ne_of_beq_false
#print axioms FamInst29.indec29
lean_all/hodge/FamInst43.lean
/-
hodge/FamInst43.lean — T41 (goal G865e): F′_43 is indecomposable. The data of the rank certificate
hodge/FamCert43 (columns C = 41 units mod 602, the first 41 elements xs of F′_43 and the last ℓ = 589) and
the finite checks of hodge/FamBridge.fam_counts, by rfl (tools/g865_inst.py):
indec43 a list S over F′_43 balanced at every t ∈ C contains every element of xs exactly as often as ℓ,
so a balanced subset of F′_43 is ∅ or F′_43. Lean 4 core.
-/
import hodge.FamCert43
import hodge.FamBridge
set_option maxHeartbeats 0
set_option maxRecDepth 100000
namespace FamInst43
open MailletLin MailletBridge FamBridge
def xs : List Nat := [1, 15, 29, 57, 71, 85, 99, 113, 127, 141, 155, 169, 183, 197, 211, 225, 239, 253, 267, 281, 295, 309, 323, 337, 351, 365, 379, 393, 407, 421, 435, 449, 463, 477, 491, 505, 519, 533, 547, 561, 575]
def C : List Nat := [1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27, 29, 31, 33, 37, 39, 41, 45, 47, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 73, 75, 79, 81, 83, 85, 87, 89, 93, 95, 97]
theorem hA_def : FamCert43.A = C.map (fun t => rowA 602 t xs) := rfl
theorem hcl_def : FamCert43.cl = C.map (fun t => 2 * (((t * 589) % 602 : Nat) : Int) - ((602 : Nat) : Int)) := rfl
theorem hW_def : FamCert43.W = smul (-100051196) (ones 41) := rfl
theorem len_xs : xs.length = 41 := rfl
def rowChk : Bool := C.all (fun t => xs.all (fun y =>
decide (dot (rowA 602 t xs) (ev xs y) = 2 * (((t * y) % 602 : Nat) : Int) - ((602 : Nat) : Int))))
def lastChk : Bool := C.all (fun t => decide (dot (rowA 602 t xs) (ev xs 589) = 0))
def neChk : Bool := xs.all (fun y => !(Nat.beq 589 y))
theorem rowChk_ok : rowChk = true := rfl
theorem lastChk_ok : lastChk = true := rfl
theorem neChk_ok : neChk = true := rfl
theorem all_mem {α : Type} (P : α → Bool) : ∀ (l : List α) (x : α), l.all P = true → x ∈ l → P x = true
| [], _, _, h => nomatch h
| y :: l, x, h, hx => by
have h1 : P y = true := MailletBridge.and_true_left h
have h2 : l.all P = true := MailletBridge.and_true_right h
cases hx with
| head => exact h1
| tail _ hx' => exact all_mem P l x h2 hx'
theorem ne_of_beq_false {a b : Nat} (h : (!(Nat.beq a b)) = true) : a ≠ b := by
intro e
rw [e, beq_refl] at h
exact nomatch h
/-- **F′_43 is indecomposable**: a list over F′_43 balanced at every t ∈ C has equal counts. -/
theorem indec43 (S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = 589)
(hbal : ∀ t, t ∈ C → tsum 602 t S + tsum 602 t S = S.length * 602) :
gv xs S = smul (cnt 589 S : Int) (ones 41) := by
have hA : allLen xs.length (C.map (fun t => rowA 602 t xs)) = true := by
rw [len_xs, ← hA_def]; exact FamCert43.allLen_A
have hc : lcs xs.length FamCert43.B (C.map (fun t => rowA 602 t xs)) = sid 100051196 xs.length := by
rw [len_xs, ← hA_def]; exact FamCert43.cert
have hW : mv FamCert43.B (C.map (fun t => 2 * (((t * 589) % 602 : Nat) : Int) - ((602 : Nat) : Int)))
= smul (-100051196) (ones xs.length) := by
rw [len_xs, ← hcl_def, FamCert43.w_eq, hW_def]
have hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs →
dot (rowA 602 t xs) (ev xs y) = 2 * (((t * y) % 602 : Nat) : Int) - ((602 : Nat) : Int) := fun t ht y hy =>
decide_eq (all_mem _ xs y (all_mem _ C t rowChk_ok ht) hy)
have hl : ∀ t, t ∈ C → dot (rowA 602 t xs) (ev xs 589) = 0 := fun t ht =>
decide_eq (all_mem _ C t lastChk_ok ht)
have hne : ∀ y, y ∈ xs → 589 ≠ y := fun y hy => ne_of_beq_false (all_mem _ xs y neChk_ok hy)
have r := fam_counts 602 589 xs C 100051196 (fun h => nomatch h) FamCert43.B hA hc hW hrow hl hne S hS hbal
rw [len_xs] at r
exact r
end FamInst43
#print axioms FamInst43.hA_def
#print axioms FamInst43.hcl_def
#print axioms FamInst43.hW_def
#print axioms FamInst43.len_xs
#print axioms FamInst43.rowChk_ok
#print axioms FamInst43.lastChk_ok
#print axioms FamInst43.neChk_ok
#print axioms FamInst43.all_mem
#print axioms FamInst43.ne_of_beq_false
#print axioms FamInst43.indec43
lean_all/hodge/FamInst71.lean
/-
hodge/FamInst71.lean — T41 (goal G865e): F′_71 is indecomposable. The data of the rank certificate
hodge/FamCert71 (columns C = 69 units mod 994, the first 69 elements xs of F′_71 and the last ℓ = 981) and
the finite checks of hodge/FamBridge.fam_counts, by rfl (tools/g865_inst.py):
indec71 a list S over F′_71 balanced at every t ∈ C contains every element of xs exactly as often as ℓ,
so a balanced subset of F′_71 is ∅ or F′_71. Lean 4 core.
-/
import hodge.FamCert71
import hodge.FamBridge
set_option maxHeartbeats 0
set_option maxRecDepth 100000
namespace FamInst71
open MailletLin MailletBridge FamBridge
def xs : List Nat := [1, 15, 29, 43, 57, 85, 99, 113, 127, 141, 155, 169, 183, 197, 211, 225, 239, 253, 267, 281, 295, 309, 323, 337, 351, 365, 379, 393, 407, 421, 435, 449, 463, 477, 491, 505, 519, 533, 547, 561, 575, 589, 603, 617, 631, 645, 659, 673, 687, 701, 715, 729, 743, 757, 771, 785, 799, 813, 827, 841, 855, 869, 883, 897, 911, 925, 939, 953, 967]
def C : List Nat := [1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27, 29, 31, 33, 37, 39, 41, 43, 45, 47, 51, 53, 55, 57, 59, 61, 65, 67, 69, 73, 75, 79, 81, 83, 85, 87, 89, 93, 95, 97, 99, 101, 103, 107, 109, 111, 113, 115, 117, 121, 123, 125, 127, 129, 131, 135, 137, 139, 141, 143, 145, 149, 151, 153, 155, 157, 159, 163]
theorem hA_def : FamCert71.A = C.map (fun t => rowA 994 t xs) := rfl
theorem hcl_def : FamCert71.cl = C.map (fun t => 2 * (((t * 981) % 994 : Nat) : Int) - ((994 : Nat) : Int)) := rfl
theorem hW_def : FamCert71.W = smul (-94888030305892122656) (ones 69) := rfl
theorem len_xs : xs.length = 69 := rfl
def rowChk : Bool := C.all (fun t => xs.all (fun y =>
decide (dot (rowA 994 t xs) (ev xs y) = 2 * (((t * y) % 994 : Nat) : Int) - ((994 : Nat) : Int))))
def lastChk : Bool := C.all (fun t => decide (dot (rowA 994 t xs) (ev xs 981) = 0))
def neChk : Bool := xs.all (fun y => !(Nat.beq 981 y))
theorem rowChk_ok : rowChk = true := rfl
theorem lastChk_ok : lastChk = true := rfl
theorem neChk_ok : neChk = true := rfl
theorem all_mem {α : Type} (P : α → Bool) : ∀ (l : List α) (x : α), l.all P = true → x ∈ l → P x = true
| [], _, _, h => nomatch h
| y :: l, x, h, hx => by
have h1 : P y = true := MailletBridge.and_true_left h
have h2 : l.all P = true := MailletBridge.and_true_right h
cases hx with
| head => exact h1
| tail _ hx' => exact all_mem P l x h2 hx'
theorem ne_of_beq_false {a b : Nat} (h : (!(Nat.beq a b)) = true) : a ≠ b := by
intro e
rw [e, beq_refl] at h
exact nomatch h
/-- **F′_71 is indecomposable**: a list over F′_71 balanced at every t ∈ C has equal counts. -/
theorem indec71 (S : List Nat) (hS : ∀ y, y ∈ S → y ∈ xs ∨ y = 981)
(hbal : ∀ t, t ∈ C → tsum 994 t S + tsum 994 t S = S.length * 994) :
gv xs S = smul (cnt 981 S : Int) (ones 69) := by
have hA : allLen xs.length (C.map (fun t => rowA 994 t xs)) = true := by
rw [len_xs, ← hA_def]; exact FamCert71.allLen_A
have hc : lcs xs.length FamCert71.B (C.map (fun t => rowA 994 t xs)) = sid 94888030305892122656 xs.length := by
rw [len_xs, ← hA_def]; exact FamCert71.cert
have hW : mv FamCert71.B (C.map (fun t => 2 * (((t * 981) % 994 : Nat) : Int) - ((994 : Nat) : Int)))
= smul (-94888030305892122656) (ones xs.length) := by
rw [len_xs, ← hcl_def, FamCert71.w_eq, hW_def]
have hrow : ∀ t, t ∈ C → ∀ y, y ∈ xs →
dot (rowA 994 t xs) (ev xs y) = 2 * (((t * y) % 994 : Nat) : Int) - ((994 : Nat) : Int) := fun t ht y hy =>
decide_eq (all_mem _ xs y (all_mem _ C t rowChk_ok ht) hy)
have hl : ∀ t, t ∈ C → dot (rowA 994 t xs) (ev xs 981) = 0 := fun t ht =>
decide_eq (all_mem _ C t lastChk_ok ht)
have hne : ∀ y, y ∈ xs → 981 ≠ y := fun y hy => ne_of_beq_false (all_mem _ xs y neChk_ok hy)
have r := fam_counts 994 981 xs C 94888030305892122656 (fun h => nomatch h) FamCert71.B hA hc hW hrow hl hne S hS hbal
rw [len_xs] at r
exact r
end FamInst71
#print axioms FamInst71.hA_def
#print axioms FamInst71.hcl_def
#print axioms FamInst71.hW_def
#print axioms FamInst71.len_xs
#print axioms FamInst71.rowChk_ok
#print axioms FamInst71.lastChk_ok
#print axioms FamInst71.neChk_ok
#print axioms FamInst71.all_mem
#print axioms FamInst71.ne_of_beq_false
#print axioms FamInst71.indec71
lean_all/hodge/FamInvariant.lean
/-
hodge/FamInvariant.lean — T41 cycle 837 (goal G547): an invariant of the μ_q-orbit families. For m = q·k and any
t (no unit condition needed), every entry of the twisted orbit t·[a + ik (i < q)] reduces mod k to (t·a) mod k:
((t·(a + ik)) mod qk) mod k = (t·a) mod k.
So every unit twist of QFam(q, k, a) / QFamHalf(q, k, a) has q entries in one residue class mod k. The residual
seeds [1, 16, 25, 38, 40] (m = 48) and [2, 10, 50, 54, 64] (m = 72) have at most 2 entries in any class mod 12, 16
(resp. 18, 24) (rfl), hence are not twists of the length-5 family members (q = 4 / q = 3 at these m).
(a2_seed: no add-and-subtract relation with |T| ≤ 6 at m = 48, |T| ≤ 5 at m = 72.)
Lean 4 core plus hodge/ModHand (add_mul_mod'), hodge/GcdHand (div_mod), lib/Semi.
mod_mod_dvd (x mod qk) mod k = x mod k
orbit_class the invariant
-/
import hodge.GcdHand
namespace FamInvariant
open GcdHand ModHand
theorem mod_mod_dvd (q k x : Nat) (hq : 0 < q) (hk : 0 < k) : (x % (q * k)) % k = x % k := by
have ⟨p, hp⟩ := div_mod (q * k) (Nat.mul_pos hq hk) (x + 1) x (Nat.lt_succ_self x)
have e : x = x % (q * k) + (p * q) * k := by
have t : x % (q * k) + q * k * p = x % (q * k) + (p * q) * k := by lib_nat
exact hp.trans t
conv => rhs; rw [e]
rw [add_mul_mod' _ _ hk]
theorem orbit_class (q k a t i : Nat) (hq : 0 < q) (hk : 0 < k) :
((t * (a + i * k)) % (q * k)) % k = (t * a) % k := by
rw [mod_mod_dvd q k _ hq hk, show t * (a + i * k) = t * a + (t * i) * k by lib_nat, add_mul_mod' _ _ hk]
def classCount (k r : Nat) : List Nat → Nat
| [] => 0
| x :: l => (if Nat.beq (x % k) r then 1 else 0) + classCount k r l
def maxClass (k : Nat) (l : List Nat) : Nat := ((List.range k).map (fun r => classCount k r l)).foldl Nat.max 0
theorem seed48_12 : maxClass 12 [1, 16, 25, 38, 40] = 2 := rfl
theorem seed48_16 : maxClass 16 [1, 16, 25, 38, 40] = 1 := rfl
theorem seed72_18 : maxClass 18 [2, 10, 50, 54, 64] = 2 := rfl
theorem seed72_24 : maxClass 24 [2, 10, 50, 54, 64] = 2 := rfl
end FamInvariant
#print axioms FamInvariant.mod_mod_dvd
#print axioms FamInvariant.orbit_class
#print axioms FamInvariant.seed48_12
#print axioms FamInvariant.seed48_16
#print axioms FamInvariant.seed72_18
#print axioms FamInvariant.seed72_24
lean_all/hodge/FamMod.lean
/-
hodge/FamMod.lean — T41 cycle 1147 (goal G749b, step 1): the Chinese-remainder split of a residue mod 14p.
mod_split r < 14, 0 < p ⇒ (r + 14·X) % (14·p) = r + 14·(X % p)
coset_sum for a unit-type multiplier: Σ_{k<p} (r + 14·((a + t·k) % p)) = p·r + 14·Σ_{i<p} i (gcd t p = 1)
mod_pmul (p·Z) % (14·p) = p·(Z % 14)
fcond_table the finite condition r + ((r s + 6r) mod 14) = 7 + (r s mod 14) for all units r mod 14 holds iff s ∈ {1,3,5}
The unit-t sum of the coset {1 + 14k : k < p} ⊂ Z/14p is therefore p·r + 14·p(p−1)/2 with r = t mod 14
(PermSum.perm_sum), the first half of the balancedness of the family F_p (G749b).
Lean 4 core plus hodge/PermSum (perm_sum, sumF), hodge/GcdHand (div_mod), hodge/ModHand.
-/
import hodge.PermSum
namespace FamMod
open GcdHand ModHand OrbitSum APPairGen PermSum
theorem mod_split (r X p : Nat) (hp : 0 < p) (hr : r < 14) : (r + 14 * X) % (14 * p) = r + 14 * (X % p) := by
have hs : X % p < p := Nat.mod_lt _ hp
have ⟨q, hq⟩ := div_mod p hp (X + 1) X (Nat.lt_succ_self X)
generalize X % p = s at hs hq ⊢
subst hq
have e : r + 14 * (s + p * q) = (r + 14 * s) + q * (14 * p) := by lib_nat
rw [e, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 13) hp)]
apply mod_lt'
have h1 : r + 14 * s < 14 + 14 * s := Nat.add_lt_add_right hr _
have h2 : 14 + 14 * s ≤ 14 * p := by
have : 14 * (s + 1) ≤ 14 * p := Nat.mul_le_mul_left 14 hs
have e2 : 14 * (s + 1) = 14 + 14 * s := by lib_nat
rw [e2] at this; exact this
exact Nat.lt_of_lt_of_le h1 h2
theorem sumF_congr (f g : Nat → Nat) (h : ∀ i, f i = g i) : ∀ n, sumF f n = sumF g n
| 0 => rfl
| n + 1 => by show sumF f n + f n = sumF g n + g n; rw [sumF_congr f g h n, h n]
theorem sumF_lin (r : Nat) (f : Nat → Nat) : ∀ n, sumF (fun i => r + 14 * f i) n = n * r + 14 * sumF f n
| 0 => by show 0 = 0 * r + 14 * 0; lib_nat
| n + 1 => by
show sumF (fun i => r + 14 * f i) n + (r + 14 * f n) = (n + 1) * r + 14 * (sumF f n + f n)
rw [sumF_lin r f n]; lib_nat
/-- the unit-t sum of the coset {1 + 14k : k < p} in Z/14p -/
theorem coset_sum (t p : Nat) (hp : 0 < p) (hg : Nat.gcd t p = 1) :
sumF (fun k => (t * (1 + 14 * k)) % (14 * p)) p = p * (t % 14) + 14 * sumF (fun i => i) p := by
have hr : t % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (t + 1) t (Nat.lt_succ_self t)
have e : ∀ k, (t * (1 + 14 * k)) % (14 * p) = t % 14 + 14 * ((q + t * k) % p) := by
intro k
have e1 : t * (1 + 14 * k) = t % 14 + 14 * (q + t * k) := by
calc t * (1 + 14 * k) = t + 14 * (t * k) := by lib_nat
_ = (t % 14 + 14 * q) + 14 * (t * k) := by rw [← hq]
_ = _ := by lib_nat
rw [e1, mod_split _ _ _ hp hr]
rw [sumF_congr _ _ e p, sumF_lin, perm_sum p t q hp hg]
theorem mod_pmul (p Z : Nat) (hp : 0 < p) : (p * Z) % (14 * p) = p * (Z % 14) := by
have hs : Z % 14 < 14 := Nat.mod_lt _ (Nat.succ_pos 13)
have ⟨q, hq⟩ := div_mod 14 (Nat.succ_pos 13) (Z + 1) Z (Nat.lt_succ_self Z)
generalize Z % 14 = s at hs hq ⊢
subst hq
have e : p * (s + 14 * q) = p * s + q * (14 * p) := by lib_nat
rw [e, add_mul_mod' _ _ (Nat.mul_pos (Nat.succ_pos 13) hp)]
apply mod_lt'
have : p * s < p * 14 := Nat.mul_lt_mul_of_le_of_lt (Nat.le_refl p) hs hp
have e2 : p * 14 = 14 * p := by lib_nat
rw [e2] at this; exact this
/-- the finite condition: for the units r mod 14 and the inverse class s = x₀ mod 14,
r − (r·s mod 14) + ((r·s + 6r) mod 14) = 7 -/
def fcond (s : Nat) : Bool :=
[1, 3, 5, 9, 11, 13].all (fun r => Nat.beq (r + (r * s + 6 * r) % 14) (7 + (r * s) % 14))
/-- it holds exactly for s ∈ {1, 3, 5} (s = p⁻¹ mod 14, i.e. p mod 14 ∈ {1, 5, 3}) -/
theorem fcond_table : (fcond 1, fcond 3, fcond 5, fcond 9, fcond 11, fcond 13) = (true, true, true, false, false, false) := rfl
end FamMod
#print axioms FamMod.mod_split
#print axioms FamMod.sumF_congr
#print axioms FamMod.sumF_lin
#print axioms FamMod.coset_sum
#print axioms FamMod.mod_pmul
#print axioms FamMod.fcond_table
lean_all/hodge/FamOne15.lean
/-
hodge/FamOne15.lean — T41 cycle 1934 (goal G865b): for p ≡ 1 (mod 14) the FamBal datum has x₀ = 1, the
special element is 7p and F_p = {7p} ⊔ F′_p. For p = 15 (m = 14p = 210): F′_15 is balanced and
indecomposable, by rfl (2^14 splittings). (p = 29, 43: computation tools/g865.py, meet in the middle.)
Lean 4 core plus hodge/FamBal; no axioms.
-/
import hodge.FamBal
namespace FamOne15
open Indecomp FamBal
def f15' : List Nat := [197, 183, 169, 155, 141, 127, 113, 99, 85, 71, 57, 43, 29, 1]
theorem fam15_eq : fam 15 1 = [197, 183, 169, 155, 141, 127, 113, 99, 85, 71, 57, 43, 29, 105, 1] := rfl
theorem f15_bal : bal 210 f15' = true := rfl
set_option maxRecDepth 100000 in
theorem f15_indec : indec 210 f15' = true := rfl
end FamOne15
#print axioms FamOne15.fam15_eq
#print axioms FamOne15.f15_bal
#print axioms FamOne15.f15_indec
lean_all/hodge/FamOrbit.lean
/-
hodge/FamOrbit.lean — T41 cycle 1195 (goal G770): the Galois orbit of the family F_p. With
stabB m c t = (t·c ⊆ c) ∧ (c ⊆ t·c) as a Bool test (lists without repetitions), by rfl:
stab3, stab5, stab17 the units t of 14p with t·F_p = F_p are exactly the units ≡ 1 (mod 14):
[1, 29] (p = 3), [1, 29, 43, 57] (p = 5), 16 units (p = 17)
so the Galois orbit of F_p has φ(14) = 6 members (computed also for p = 19, 31). Reason: t ≡ 1 (mod 14) fixes the
moved element (≡ 0 mod p) and permutes the coset; any other t changes the residue mod 14.
Lean 4 core plus hodge/FamBal (fam), hodge/FermatPrime (units), hodge/TwistBal (tw).
-/
import hodge.FamBal
import hodge.TwistBal
namespace FamOrbit
open Indecomp FamBal
def stabB (m : Nat) (c : List Nat) (t : Nat) : Bool :=
(TwistBal.tw m t c).all (fun x => c.contains x) && c.all (fun x => (TwistBal.tw m t c).contains x)
theorem stab3 : (FermatPrime.units 42).filter (stabB 42 (fam 3 1)) = [1, 29] := rfl
theorem stab5 : (FermatPrime.units 70).filter (stabB 70 (fam 5 1)) = [1, 29, 43, 57] := rfl
theorem stab17 : (FermatPrime.units 238).filter (stabB 238 (fam 17 6))
= [1, 15, 29, 43, 57, 71, 99, 113, 127, 141, 155, 169, 183, 197, 211, 225] := rfl
theorem units_count : ((FermatPrime.units 42).length, (FermatPrime.units 70).length, (FermatPrime.units 238).length) = (12, 24, 96) := rfl
end FamOrbit
#print axioms FamOrbit.stab3
#print axioms FamOrbit.stab5
#print axioms FamOrbit.stab17
#print axioms FamOrbit.units_count
lean_all/hodge/FamStab.lean
/-
hodge/FamStab.lean — T41 cycle 1205 (goal G770b): F_p is stable under the units ≡ 1 (mod 14), for every prime p with
gcd(14, p) = 1, i₀ < p, 1 + 14i₀ = p·x₀:
gl_mem' k < n ⇒ f k ∈ gl f n
fam_stab t = 1 + 14j with gcd(t, p) = 1 ⇒ ∀ x ∈ F_p, (t·x) mod 14p ∈ F_p
(the moved element y = p(x₀ + 6) is fixed: t·y ≡ y; a coset element 1 + 14k goes to 1 + 14·((k + j(1+14k)) mod p),
which is not the omitted index i₀ since p ∤ t(1 + 14k)).
stab_sub a unit t prime to p with t mod 14p ∈ F_p is ≡ 1 (mod 14) (so t ≢ 1 moves 1 ∈ F_p off F_p).
With FamOrbit: the Galois orbit of F_p has at most
φ(14) = 6 members for every such p — exactly 6 by stab_sub.
Lean 4 core plus hodge/FamIndec3, lib/Gcd (euclid_prime).
-/
import hodge.FamIndec3
namespace FamStab
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal FamIndec1 FamIndec2 FamIndec3
theorem gl_mem' (f : Nat → Nat) : ∀ n k, k < n → f k ∈ gl f n
| 0, k, h => absurd h (Nat.not_lt_zero k)
| n + 1, k, h => by
cases Nat.lt_or_ge k n with
| inl hlt => exact List.Mem.tail _ (gl_mem' f n k hlt)
| inr hge =>
have e : k = n := Nat.le_antisymm (Nat.le_of_lt_succ h) hge
subst e; exact List.Mem.head _
theorem fam_stab (p i0 x0 j : Nat) (hp1 : 1 < p) (hpr : ∀ d, d ∣ p → d = 1 ∨ d = p) (h14 : Nat.gcd 14 p = 1)
(hi : i0 < p) (hx : 1 + 14 * i0 = p * x0) (hx6 : x0 + 6 < 14) (ht : Nat.gcd (1 + 14 * j) p = 1) :
∀ x, x ∈ fam p i0 → ((1 + 14 * j) * x) % (14 * p) ∈ fam p i0 := by
intro x hxm
have hp : 0 < p := Nat.lt_of_le_of_lt (Nat.zero_le 1) hp1
have h0 : p ∣ 1 + 14 * i0 := ⟨x0, hx⟩
have hm : 0 < 14 * p := Nat.mul_pos (Nat.succ_pos 13) hp
have ⟨k, hk, ek⟩ := gl_mem _ p x hxm
cases e : Nat.beq k i0 with
| true =>
have ek0 := Nat.eq_of_beq_eq_true e
subst ek0
have ex : x = 1 + 14 * k + 6 * p := by
rw [← ek]; show (if Nat.beq k k = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = _; rw [beq_refl']; rfl
have hxy : x = p * (x0 + 6) := by rw [ex, hx]; lib_nat
have hlt : x < 14 * p := by
rw [hxy, show 14 * p = p * 14 by lib_nat]
exact Nat.mul_lt_mul_of_le_of_lt (Nat.le_refl p) hx6 hp
have e2 : (1 + 14 * j) * x = x + (j * (x0 + 6)) * (14 * p) := by
calc (1 + 14 * j) * x = x + 14 * j * x := by lib_nat
_ = x + 14 * j * (p * (x0 + 6)) := by rw [← hxy]
_ = _ := by lib_nat
rw [e2, add_mul_mod' _ _ hm, mod_lt' x _ hlt, ex]
have := gl_mem' (fun k' => if Nat.beq k' k then 1 + 14 * k' + 6 * p else 1 + 14 * k') p k hk
have hv : (if Nat.beq k k = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = 1 + 14 * k + 6 * p := by
rw [beq_refl']; rfl
rw [hv] at this; exact this
| false =>
have hk0 : k ≠ i0 := fun h => by rw [h, beq_refl'] at e; exact nomatch e
have ex : x = 1 + 14 * k := by
rw [← ek]; show (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = _; rw [e]; rfl
have hk' : (k + j * x) % p < p := Nat.mod_lt _ hp
have e1 : (1 + 14 * j) * x = 1 + 14 * (k + j * x) := by rw [ex]; lib_nat
rw [e1, mod_split 1 _ p hp (Nat.succ_lt_succ (Nat.succ_pos 12))]
generalize hkk : (k + j * x) % p = k' at hk'
have hne : k' ≠ i0 := by
intro hki
-- p ∣ (1 + 14j)·x
have ⟨q, hq⟩ := div_mod p hp (k + j * x + 1) (k + j * x) (Nat.lt_succ_self _)
rw [hkk, hki] at hq
have hdv : p ∣ (1 + 14 * j) * x := ⟨x0 + 14 * q, by
rw [e1, hq]
calc 1 + 14 * (i0 + p * q) = (1 + 14 * i0) + 14 * p * q := by lib_nat
_ = p * x0 + 14 * p * q := by rw [hx]
_ = _ := by lib_nat⟩
cases LibGcd.euclid_prime hpr hdv with
| inl hpt =>
have ⟨c, hc⟩ := APPair1.dvd_gcd p (1 + 14 * j) p (let ⟨u, hu⟩ := hpt; ⟨u, hu⟩) ⟨1, by lib_nat⟩
rw [ht] at hc
exact APPair1.one_eq_mul p c hc hp1
| inr hpx =>
rw [ex] at hpx
exact hk0 (idx_unique p k i0 hp h14 hk hi hpx h0)
have hb : Nat.beq k' i0 = false := by
cases e3 : Nat.beq k' i0 with
| false => rfl
| true => exact absurd (Nat.eq_of_beq_eq_true e3) hne
have := gl_mem' (fun k'' => if Nat.beq k'' i0 then 1 + 14 * k'' + 6 * p else 1 + 14 * k'') p k' hk'
have hv : (if Nat.beq k' i0 = true then 1 + 14 * k' + 6 * p else 1 + 14 * k') = 1 + 14 * k' := by
rw [hb]; rfl
rw [hv] at this; exact this
/-- conversely, a unit t (prime to p) with t mod 14p ∈ F_p (e.g. one fixing F_p, which contains 1) is ≡ 1 (mod 14) -/
theorem stab_sub (p i0 x0 t : Nat) (hp1 : 1 < p) (hx : 1 + 14 * i0 = p * x0) (ht : Nat.gcd t p = 1)
(hmem : t % (14 * p) ∈ fam p i0) : t % 14 = 1 := by
have hp : 0 < p := Nat.lt_of_le_of_lt (Nat.zero_le 1) hp1
have ⟨k, _, ek⟩ := gl_mem _ p _ hmem
have ⟨q, hq⟩ := div_mod (14 * p) (Nat.mul_pos (Nat.succ_pos 13) hp) (t + 1) t (Nat.lt_succ_self t)
cases e : Nat.beq k i0 with
| true =>
exfalso
have ek0 := Nat.eq_of_beq_eq_true e
subst ek0
have ev : t % (14 * p) = p * (x0 + 6) := by
rw [← ek]; show (if Nat.beq k k = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = _
rw [beq_refl']; show 1 + 14 * k + 6 * p = _; rw [hx]; lib_nat
rw [ev] at hq
have ⟨c, hc⟩ := APPair1.dvd_gcd p t p ⟨x0 + 6 + 14 * q, by rw [hq]; lib_nat⟩ ⟨1, by lib_nat⟩
rw [ht] at hc
exact APPair1.one_eq_mul p c hc hp1
| false =>
have ev : t % (14 * p) = 1 + 14 * k := by
rw [← ek]; show (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = _; rw [e]; rfl
rw [ev] at hq
have e2 : t = 1 + (k + p * q) * 14 := by rw [hq]; lib_nat
rw [e2, add_mul_mod' _ _ (Nat.succ_pos 13)]
end FamStab
#print axioms FamStab.gl_mem'
#print axioms FamStab.fam_stab
#print axioms FamStab.stab_sub
lean_all/hodge/Fermat10.lean
/-
hodge/Fermat10.lean — T41 cycle 31: generators of the Hodge characters of X_10^n.
Lean 4 core plus HodgeChain (hodgeB, units). Finite checks by rfl.
Measured (Python, HODGE_LOG cycle 31): every Hodge multiset of exponents for m = 10 of length ≤ 12
contains one of 17 indecomposable Hodge multisets — the 5 pairs, the 4 standard characters
(a, a+5, −2a, 5) and 8 further ones, one Galois orbit of length 4 ([1,3,8,8], [3,4,4,9], [1,6,6,7],
[2,2,7,9]) and one of length 6 ([1,1,6,6,8,8], …). Proved here:
gens_hodge all 17 satisfy Shioda's condition (X_10^n with n + 2 = their length)
others_indecomp the 8 further ones have no proper Hodge sub-multiset, and contain no pair:
they are not sums of linear-subspace and standard characters — new cycles
(Aoki's) are needed for them; for n = 2 they are algebraic by Lefschetz (1,1)
-/
import HodgeChain
namespace Fermat10
open HodgeChain
def hB (a : List Nat) : Bool := hodgeB 10 (a.length / 2 - 1) a
def gens : List (List Nat) :=
[[1, 9], [2, 8], [3, 7], [4, 6], [5, 5],
[1, 5, 6, 8], [2, 4, 5, 9], [2, 5, 6, 7], [3, 4, 5, 8],
[1, 3, 8, 8], [3, 4, 4, 9], [1, 6, 6, 7], [2, 2, 7, 9],
[1, 1, 6, 6, 8, 8], [2, 2, 4, 4, 9, 9], [2, 2, 6, 6, 7, 7], [3, 3, 4, 4, 8, 8]]
theorem gens_hodge : gens.all hB = true := rfl
/-- All sub-multisets (as sublists) of a list. -/
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (fun s => x :: s) ++ subs l
/-- No proper sub-multiset of even length ≥ 2 is a Hodge character. -/
def indecomp (a : List Nat) : Bool :=
(subs a).all (fun s => !(Nat.blt 1 s.length && Nat.blt s.length a.length && Nat.beq (s.length % 2) 0 && hB s))
def others : List (List Nat) :=
[[1, 3, 8, 8], [3, 4, 4, 9], [1, 6, 6, 7], [2, 2, 7, 9],
[1, 1, 6, 6, 8, 8], [2, 2, 4, 4, 9, 9], [2, 2, 6, 6, 7, 7], [3, 3, 4, 4, 8, 8]]
set_option maxRecDepth 100000 in
theorem others_indecomp : others.all indecomp = true := rfl
end Fermat10
#print axioms Fermat10.gens_hodge
#print axioms Fermat10.others_indecomp
lean_all/hodge/Fermat14Exc.lean
/-
hodge/Fermat14Exc.lean — T41 cycle 55: the m = 14 exceptional sextuples are indecomposable.
Lean 4 core plus hodge/FermatGens (hodgeB, zs). For m = 14 (units 1, 3, 5, 9, 11, 13) the Hodge
characters (1,1,9,9,11,11) and (3,3,5,5,13,13) of X_14^4
· are Hodge (exc_hodge)
· have no Hodge sub-character of length 2 or 4 (no_sub: so no product decomposition)
· have no split into two zero-sum triples (no_cc)
so the inductive structure (surfaces, products of curves) does not reach them: the first open
cases of the method for m = 14, n = 4 (they are the Galois orbit of one character up to t·).
-/
import hodge.FermatGens
namespace Fermat14Exc
open FermatGens
def U14 : List Nat := [1, 3, 5, 9, 11, 13]
def E1 : List Nat := [1, 1, 9, 9, 11, 11]
def E2 : List Nat := [3, 3, 5, 5, 13, 13]
/-- all sublists (as index choices) of a list -/
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (x :: ·) ++ subs l
def compl (c s : List Nat) : List Nat := (sub c s).getD []
def noSub (c : List Nat) : Bool :=
(subs c).all (fun s => !((Nat.beq s.length 2 || Nat.beq s.length 4) && hodgeB 14 U14 s))
def noCC (c : List Nat) : Bool :=
(subs c).all (fun s => !(Nat.beq s.length 3 && zs 14 s && zs 14 (compl c s)))
theorem exc_hodge : hodgeB 14 U14 E1 && hodgeB 14 U14 E2 = true := rfl
theorem no_sub : noSub E1 && noSub E2 = true := rfl
theorem no_cc : noCC E1 && noCC E2 = true := rfl
/-- E2 = 3·E1 (mod 14): one Galois orbit. -/
theorem galois : (E1.map (fun x => (3 * x) % 14)) = [3, 3, 13, 13, 5, 5] := rfl
end Fermat14Exc
#print axioms Fermat14Exc.exc_hodge
#print axioms Fermat14Exc.no_sub
#print axioms Fermat14Exc.no_cc
#print axioms Fermat14Exc.galois
lean_all/hodge/Fermat25Std.lean
/-
hodge/Fermat25Std.lean — T41 cycle 73: the four characters of X_25^4 that the inductive structure does not
reach are exactly the Aoki–Shioda standard characters of step m/d = 5 (d = 5):
std(a) = (a, a + 5, a + 10, a + 15, a + 20, −5a) (a = 1, 2, 3, 4)
They are Hodge (hodgeB, rfl), and std(a) for a = 1..4 is the list of unreached characters found by
hodge_reach.py (NUMERIC_HODGE_REACH.jsonl). Standard characters are algebraic by Aoki–Shioda (cited):
with them as an extra base, X_25^4 is covered.
-/
import hodge.FermatGens
namespace Fermat25Std
open FermatGens
def U25 : List Nat := [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24]
def std (m d a : Nat) : List Nat :=
((List.range d).map (fun k => (a + k * (m / d)) % m)) ++ [(m * m - d * a) % m]
theorem std_list : [1, 2, 3, 4].map (std 25 5) =
[[1, 6, 11, 16, 21, 20], [2, 7, 12, 17, 22, 15], [3, 8, 13, 18, 23, 10], [4, 9, 14, 19, 24, 5]] := rfl
theorem std_hodge : ([1, 2, 3, 4].map (std 25 5)).all (hodgeB 25 U25) = true := rfl
/-- Every unit multiple of a standard character is standard: the orbit is closed (t · std(1) for t in U). -/
theorem std_orbit : U25.all (fun t => [1, 2, 3, 4].any (fun a =>
FermatGens.sub ((std 25 5 1).map (fun x => (t * x) % 25)) (std 25 5 a) == some [])) = true := rfl
end Fermat25Std
#print axioms Fermat25Std.std_list
#print axioms Fermat25Std.std_hodge
#print axioms Fermat25Std.std_orbit
lean_all/hodge/Fermat32Open.lean
/-
hodge/Fermat32Open.lean — T41 cycle 76: the first character not reached by inductive structure plus
standard characters, m = 32, n = 4:
c = (1, 9, 17, 25, 20, 24) = AP(1, step 8 = m/4) ⊔ (20, 24), Σ AP ≡ 20, 20 + 24 + 20 ≡ 0
c32_hodge c is Hodge (rfl)
c32_not_std c is not a standard character std(m, d, a) for any d | 32 with d + 1 = 6 (no such d)
— and for every a, d it differs (finite check over d ∈ {1, 2, 4, 8, 16, 32})
Not reached by the inductive closure with standard base: measured (NUMERIC_HODGE_REACH.jsonl).
Its algebraicity needs a further cycle (Aoki's 'AP ⊔ pair' type or a correspondence); open here.
-/
import hodge.Fermat25Std
namespace Fermat32Open
open FermatGens Fermat25Std
def U32 : List Nat := [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
def c32 : List Nat := [1, 9, 17, 20, 24, 25]
def sameMS (a b : List Nat) : Bool := FermatGens.sub a b == some []
theorem c32_hodge : hodgeB 32 U32 c32 = true := rfl
theorem c32_not_std : ([1, 2, 4, 8, 16, 32].all (fun d => (List.range 32).all (fun a =>
!(sameMS c32 (std 32 d a))))) = true := rfl
end Fermat32Open
#print axioms Fermat32Open.c32_hodge
#print axioms Fermat32Open.c32_not_std
lean_all/hodge/Fermat33Open.lean
/-
hodge/Fermat33Open.lean — T41 cycle 113: the open characters of X_33^4 for the method.
c = (1, 4, 16, 22, 25, 31) and its unit multiples: Hodge, every entry ≡ 1 (mod 3) (a twisted lift from
X_11), not a standard character, and not reached by the inductive closure with standard base
(reach returns false, rfl). Their algebraicity is open here.
-/
import hodge.Fermat32Open
namespace Fermat33Open
open FermatGens Fermat25Std Fermat32Open
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (x :: ·) ++ subs l
def lsumN : List Nat → Nat
| [] => 0
| x :: l => x + lsumN l
def compl (c s : List Nat) : List Nat := (sub c s).getD []
/-- one split step, given the closure at smaller fuel -/
def splitOK (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c A : List Nat) : Bool :=
let B := compl c A
let s := lsumN A % m
if Nat.beq s 0 then
!A.isEmpty && !B.isEmpty && hodgeB m U A && hodgeB m U B && rec A && rec B
else
let A2 := (m - s) :: A
let B2 := s :: B
Nat.blt A2.length c.length && Nat.blt B2.length c.length &&
hodgeB m U A2 && hodgeB m U B2 && rec A2 && rec B2
def anySplit (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c : List Nat) : List (List Nat) → Bool
| [] => false
| A :: As => splitOK m U rec c A || anySplit m U rec c As
def isStd (m : Nat) (c : List Nat) : Bool :=
(List.range (m + 1)).any (fun d => Nat.blt 1 d && Nat.beq (m % d) 0 &&
(List.range m).any (fun a => sameMS c (std m d a)))
def reach (m : Nat) (U : List Nat) : Nat → List Nat → Bool
| 0, c => Nat.blt c.length 5 || isStd m c
| f + 1, c => Nat.blt c.length 5 || isStd m c || anySplit m U (reach m U f) c (subs c)
def allReach (m : Nat) (U : List Nat) (L : Nat) : Bool :=
(multis m L 1).all (fun c => !(hodgeB m U c) || reach m U L c)
def U33 : List Nat := [1, 2, 4, 5, 7, 8, 10, 13, 14, 16, 17, 19, 20, 23, 25, 26, 28, 29, 31, 32]
def c33 : List Nat := [1, 4, 16, 22, 25, 31]
theorem c33_hodge : hodgeB 33 U33 c33 = true := rfl
theorem c33_mod3 : c33.all (fun x => Nat.beq (x % 3) 1) = true := rfl
theorem c33_not_std : isStd 33 c33 = false := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem c33_not_reached : reach 33 U33 6 c33 = false := rfl
end Fermat33Open
#print axioms Fermat33Open.c33_hodge
#print axioms Fermat33Open.c33_mod3
#print axioms Fermat33Open.c33_not_std
#print axioms Fermat33Open.c33_not_reached
lean_all/hodge/Fermat6.lean
/-
hodge/Fermat6.lean — T41 cycle 22: the Hodge characters of X_6^n, every n.
Lean 4 core plus hodge/FermatFull. For m = 6 the Hodge system has rank 1 (the rows t = 1, 5 are
opposite), and its one equation reads 2·#1 + #2 = #4 + 2·#5 (#v = number of exponents equal to v).
So a character is Hodge iff its count vector is symmetric (#v = #(6−v), the linear-subspace part)
plus a multiple of the standard direction (1, −2, 0, 2, −1)… i.e. exactly the span found in
NUMERIC_HODGE.txt (EXC = 0 for m = 6 once the standard shapes are added).
extract_lin S + u = S' + v coefficientwise and S·x = S'·x ⇒ u·x = v·x
hodge6_rel every Hodge character of X_6^n satisfies 2·#1 + #2 = #4 + 2·#5
-/
import hodge.FermatFull
namespace Fermat6
open FTAChain FrobChain FermatPrime FermatFull
theorem extract_lin (M : Nat) (s s' u v x : Nat → Nat)
(hs : ∀ c, c < M → s c + u c = s' c + v c)
(h : dot M s x = dot M s' x) : dot M u x = dot M v x := by
have e1 : dot M s x + dot M u x = dot M s' x + dot M v x := by
unfold dot
rw [← sum_add, ← sum_add]
exact sum_ext _ _ _ (fun c hc => by rw [← rdistrib, ← rdistrib, hs c hc])
rw [h] at e1
exact cancel_l e1
def u6 (c : Nat) : Nat := match c with
| 3 => 2
| 4 => 4
| _ => 0
def v6 (c : Nat) : Nat := match c with
| 0 => 4
| 1 => 2
| _ => 0
def cert6 : Bool :=
allBelow (fun c =>
Nat.beq (S1 (units 6) (fun t => pos (nthD [-1, 0, 0, 0, 0] (t - 1))) (fun t => negp (nthD [-1, 0, 0, 0, 0] (t - 1))) (qf 6) (rf 6) c + u6 c)
(S1 (units 6) (fun t => pos (nthD [-1, 0, 0, 0, 0] (t - 1))) (fun t => negp (nthD [-1, 0, 0, 0, 0] (t - 1))) (rf 6) (qf 6) c + v6 c)) 5
theorem cert6_ok : cert6 = true := rfl
/-- **Hodge characters of X_6^n** satisfy 2·#1 + #2 = #4 + 2·#5. -/
theorem hodge6_rel (a : List Nat) (hin : AllIn 5 a) (h : HodgeList 6 a) :
cnt 1 a + cnt 1 a + cnt 2 a = cnt 4 a + (cnt 5 a + cnt 5 a) := by
let x : Nat → Nat := fun c => cnt (c + 1) a
have hx : ∀ t, t ∈ units 6 → dot 5 (qf 6 t) x = dot 5 (rf 6 t) x := by
intro t ht
have e := h t ht
rw [regroup 5 _ a hin, regroup 5 _ a hin] at e
unfold dot
rw [sum_ext _ _ _ (fun c _ => nmul_comm (qf 6 t c) (x c)),
sum_ext _ _ _ (fun c _ => nmul_comm (rf 6 t c) (x c))]
exact e
have k := extract_lin 5 _ _ u6 v6 x (fun c hc => beq_eq (all_range _ 5 cert6_ok c hc))
(combine1 5 (qf 6) (rf 6) x _ _ (units 6) hx)
-- k : 2·x₃ + 4·x₄ = 4·x₀ + 2·x₁ (indices c = residue − 1)
have k' : 2 * x 3 + 4 * x 4 = 4 * x 0 + 2 * x 1 := by
have l : dot 5 u6 x = 2 * x 3 + 4 * x 4 := by
show 0 + 0 * x 0 + 0 * x 1 + 0 * x 2 + 2 * x 3 + 4 * x 4 = _
rw [Nat.zero_mul, Nat.zero_mul, Nat.zero_mul, Nat.add_zero, Nat.zero_add]
have r : dot 5 v6 x = 4 * x 0 + 2 * x 1 := by
show 0 + 4 * x 0 + 2 * x 1 + 0 * x 2 + 0 * x 3 + 0 * x 4 = _
rw [Nat.zero_mul, Nat.zero_mul, Nat.zero_mul, Nat.zero_add]; rfl
rw [← l, ← r]; exact k
-- divide by 2
have f4 : ∀ y, 4 * y = 2 * y + 2 * y := fun y => nright_distrib 2 2 y
have two : 2 * (x 3 + (x 4 + x 4)) = 2 * (x 0 + x 0 + x 1) := by
rw [nleft_distrib, nleft_distrib, nleft_distrib, nleft_distrib, ← f4 (x 4), ← f4 (x 0)]
exact k'
exact (Nat.eq_of_mul_eq_mul_left (Nat.zero_lt_succ 1) two).symm
end Fermat6
#print axioms Fermat6.extract_lin
#print axioms Fermat6.cert6_ok
#print axioms Fermat6.hodge6_rel
lean_all/hodge/Fermat8.lean
/-
hodge/Fermat8.lean — T41 cycle 25: the Hodge characters of X_8^n, every n.
Lean 4 core plus hodge/Fermat6 (extract_lin) and hodge/FermatFull. For m = 8 the rows of the
Hodge system come in opposite pairs (t = 1, 7 and t = 3, 5): rank 2. The two equations, with
#v the number of exponents equal to v, are
6#1 + 4#2 + 2#3 = 2#5 + 4#6 + 6#7 (row t = 1)
2#1 + 6#3 + 4#6 = 4#2 + 6#5 + 2#7 (row t = 3)
and every Hodge character of X_8^n satisfies both (hodge8_rel1, hodge8_rel2); the symmetric
(paired) counts satisfy them trivially, the standard characters span the rest (NUMERIC_HODGE:
EXC = 0 for m = 8, n = 2).
-/
import hodge.Fermat6
namespace Fermat8
open FTAChain FrobChain FermatPrime FermatFull Fermat6
def u1 (c : Nat) : Nat := match c with
| 4 => 2 | 5 => 4 | 6 => 6 | _ => 0
def v1 (c : Nat) : Nat := match c with
| 0 => 6 | 1 => 4 | 2 => 2 | _ => 0
def u2 (c : Nat) : Nat := match c with
| 1 => 4 | 4 => 6 | 6 => 2 | _ => 0
def v2 (c : Nat) : Nat := match c with
| 0 => 2 | 2 => 6 | 5 => 4 | _ => 0
def certL (l : List Int) (u v : Nat → Nat) : Bool :=
allBelow (fun c =>
Nat.beq (S1 (units 8) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (qf 8) (rf 8) c + u c)
(S1 (units 8) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (rf 8) (qf 8) c + v c)) 7
theorem cert8_1 : certL [-1, 0, 0, 0, 0, 0, 0] u1 v1 = true := rfl
theorem cert8_2 : certL [0, 0, -1, 0, 0, 0, 0] u2 v2 = true := rfl
theorem hx8 (a : List Nat) (hin : AllIn 7 a) (h : HodgeList 8 a) :
∀ t, t ∈ units 8 → dot 7 (qf 8 t) (fun c => cnt (c + 1) a) = dot 7 (rf 8 t) (fun c => cnt (c + 1) a) := by
intro t ht
have e := h t ht
rw [regroup 7 _ a hin, regroup 7 _ a hin] at e
unfold dot
rw [sum_ext _ _ _ (fun c _ => nmul_comm (qf 8 t c) (cnt (c + 1) a)),
sum_ext _ _ _ (fun c _ => nmul_comm (rf 8 t c) (cnt (c + 1) a))]
exact e
/-- Row t = 1: 2#5 + 4#6 + 6#7 = 6#1 + 4#2 + 2#3 (as u₁·x = v₁·x). -/
theorem hodge8_rel1 (a : List Nat) (hin : AllIn 7 a) (h : HodgeList 8 a) :
dot 7 u1 (fun c => cnt (c + 1) a) = dot 7 v1 (fun c => cnt (c + 1) a) :=
extract_lin 7 _ _ u1 v1 _ (fun c hc => beq_eq (all_range _ 7 cert8_1 c hc))
(combine1 7 (qf 8) (rf 8) _ _ _ (units 8) (hx8 a hin h))
/-- Row t = 3: 4#2 + 6#5 + 2#7 = 2#1 + 6#3 + 4#6 (as u₂·x = v₂·x). -/
theorem hodge8_rel2 (a : List Nat) (hin : AllIn 7 a) (h : HodgeList 8 a) :
dot 7 u2 (fun c => cnt (c + 1) a) = dot 7 v2 (fun c => cnt (c + 1) a) :=
extract_lin 7 _ _ u2 v2 _ (fun c hc => beq_eq (all_range _ 7 cert8_2 c hc))
(combine1 7 (qf 8) (rf 8) _ _ _ (units 8) (hx8 a hin h))
end Fermat8
#print axioms Fermat8.cert8_1
#print axioms Fermat8.cert8_2
#print axioms Fermat8.hx8
#print axioms Fermat8.hodge8_rel1
#print axioms Fermat8.hodge8_rel2
lean_all/hodge/FermatFour.lean
/-
hodge/FermatFour.lean — T41 cycle 16: m = 4 (paired, every dimension) and m = 6 (not paired).
Lean 4 core plus hodge/FermatFull. Certificates and witnesses by rfl.
certF4_0, paired_char_4 X_4^n, every n: #{a_i = 1} = #{a_i = 3} for every Hodge character
(the residue 2 is its own negative): with FermatFull/FermatPrimes2,
Ran's range "m prime or m = 4" is covered for m ≤ 47.
units6, hodge6, not_paired6
X_6^2: the exponent list [1, 3, 4, 4] satisfies Shioda's condition for
both units t = 1, 5 but #{a_i = 1} = 1 ≠ 0 = #{a_i = 5}: for m = 6 the
Hodge classes are not spanned by linear subspaces (the standard
character of NUMERIC_HODGE.txt; algebraic by Lefschetz (1,1), n = 2).
-/
import hodge.FermatFull
namespace FermatFour
open FTAChain FrobChain FermatPrime FermatFull
theorem certF4_0 : certF 4 0 2 [-1, 0, 0] = true := rfl
/-- X_4^n, every n: Hodge characters are paired. -/
theorem paired_char_4 (a : List Nat) (hin : AllIn 3 a) (h : HodgeList 4 a) : cnt 1 a = cnt 3 a :=
pair_one 4 0 2 [-1, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl)
(Nat.le_of_ble_eq_true rfl) certF4_0 a hin h
theorem units6 : units 6 = [1, 5] := rfl
theorem hodge6 : HodgeList 6 [1, 3, 4, 4] := by
intro t ht
rw [units6] at ht
cases ht with
| head => rfl
| tail _ ht =>
cases ht with
| head => rfl
| tail _ ht => cases ht
theorem not_paired6 : cnt 1 [1, 3, 4, 4] = 1 ∧ cnt 5 [1, 3, 4, 4] = 0 := ⟨rfl, rfl⟩
end FermatFour
#print axioms FermatFour.certF4_0
#print axioms FermatFour.paired_char_4
#print axioms FermatFour.units6
#print axioms FermatFour.hodge6
#print axioms FermatFour.not_paired6
lean_all/hodge/FermatFull.lean
/-
hodge/FermatFull.lean — T41 cycle 6: from Shioda's condition on a character to "paired",
directly on the list of exponents, for m = 3, 5, 7, 11, 13 and every dimension.
Lean 4 core plus hodge/FermatPrime (sum_scale, sum_indicator, rdistrib, dot, lsum, S, ind,
allBelow, all_range, nthD, pos, negp, units, and_left/right, beq_eq, cancel_l).
A character of X_m^n is a list a of exponents in 1..m−1 (length n + 2, sum ≡ 0). Shioda's
condition at a unit t, with Σ_i 1 = n + 2 = 2(n/2 + 1), reads
Σ_i 2⟨t a_i⟩ = Σ_i m (H_t)
Writing x_c = #{i : a_i = c + 1} (c < m − 1), H_t is the linear equation q_t · x = m · x with
q_t(c) = 2⟨t(c+1)⟩ (regroup). Weighted sums of the H_t give S·x = S'·x (combine1); a certificate
S + D e_{b'} = S' + D e_b (b' = m − 2 − b, the index of the residue m − (b+1)) gives x_b = x_{b'}
(extract1). The certificates are those of FermatPrime (ℓᵀA = D(e_b − e_{b'}) for the full matrix
A_{tv} = 2⟨tv⟩ − m), checked here by rfl.
regroup Σ_i g(a_i) = Σ_{c<M} x_c g(c+1) for entries in 1..M
combine1, extract1 the linear algebra in ℕ
paired_char_3 … paired_char_13
every list a with entries in 1..m−1 satisfying H_t for all units t has
#{a_i = b+1} = #{a_i = m−(b+1)} for b < (m−1)/2: every Hodge character
of every Fermat variety X_m^n (m = 3, 5, 7, 11, 13, every even n) is paired,
i.e. its Hodge class is a combination of classes of linear subspaces
(with HodgeChain.paired_sum for the converse).
-/
import hodge.FermatPrime
namespace FermatFull
open FTAChain FrobChain FermatPrime
/-! ## Counting -/
/-- #{i : a_i = v}. -/
def cnt (v : Nat) : List Nat → Nat
| [] => 0
| x :: a => ind x 1 v + cnt v a
def lsumL (g : Nat → Nat) : List Nat → Nat
| [] => 0
| x :: a => g x + lsumL g a
def AllIn (M : Nat) : List Nat → Prop
| [] => True
| x :: a => (0 < x ∧ x ≤ M) ∧ AllIn M a
theorem sum_zero'' : ∀ n, sumTo n (fun _ => 0) = 0
| 0 => rfl
| n + 1 => by show sumTo n (fun _ => 0) + 0 = 0; rw [sum_zero'' n]
/-- Regrouping a sum over the list by values. -/
theorem regroup (M : Nat) (g : Nat → Nat) : ∀ a : List Nat, AllIn M a →
lsumL g a = sumTo M (fun c => cnt (c + 1) a * g (c + 1))
| [], _ => by
show 0 = sumTo M (fun c => 0 * g (c + 1))
rw [sum_ext _ _ (fun _ => 0) (fun c _ => Nat.zero_mul _), sum_zero'']
| x :: a, h => by
show g x + lsumL g a = sumTo M (fun c => (ind x 1 (c + 1) + cnt (c + 1) a) * g (c + 1))
rw [sum_ext _ _ _ (fun c _ => rdistrib _ _ _), sum_add, ← regroup M g a h.2]
cases x with
| zero => exact absurd h.1.1 (Nat.lt_irrefl 0)
| succ j =>
have e : ∀ c, ind (j + 1) 1 (c + 1) * g (c + 1) = ind j 1 c * g (c + 1) := by
intro c
unfold ind
cases Nat.decEq c j with
| isTrue hc => rw [hc, ite_eq_left rfl, ite_eq_left rfl]
| isFalse hc =>
rw [ite_eq_right (fun e => hc (Nat.succ.inj e)), ite_eq_right hc]
rw [sum_ext _ _ _ (fun c _ => e c), sum_indicator j 1 (fun c => g (c + 1)) M h.1.2, Nat.one_mul]
/-! ## One-sided linear algebra -/
def S1 (T : List Nat) (lam mu : Nat → Nat) (q r : Nat → Nat → Nat) (c : Nat) : Nat :=
lsum T (fun t => lam t * q t c + mu t * r t c)
theorem combine1 (M : Nat) (q r : Nat → Nat → Nat) (x lam mu : Nat → Nat) : ∀ T : List Nat,
(∀ t, t ∈ T → dot M (q t) x = dot M (r t) x) →
dot M (S1 T lam mu q r) x = dot M (S1 T lam mu r q) x
| [] => fun _ => rfl
| t :: T => fun h => by
have ih := combine1 M q r x lam mu T (fun t' ht' => h t' (List.Mem.tail t ht'))
have ht := h t (List.Mem.head T)
unfold S1 at ih ⊢
rw [dot_lsum, dot_lsum] at ih ⊢
show dot M (fun c => lam t * q t c + mu t * r t c) x + lsum T (fun t => dot M (fun c => lam t * q t c + mu t * r t c) x)
= dot M (fun c => lam t * r t c + mu t * q t c) x + lsum T (fun t => dot M (fun c => lam t * r t c + mu t * q t c) x)
rw [dot_add_scale, dot_add_scale, ih, ht]
theorem extract1 (M b b' D : Nat) (hb : b < M) (hb' : b' < M) (hD : 0 < D) (s s' x : Nat → Nat)
(hs : ∀ c, c < M → s c + ind b' D c = s' c + ind b D c)
(h : dot M s x = dot M s' x) : x b = x b' := by
have e1 : dot M s x + D * x b' = dot M s' x + D * x b := by
unfold dot
rw [← sum_indicator b' D x M hb', ← sum_indicator b D x M hb, ← sum_add, ← sum_add]
exact sum_ext _ _ _ (fun c hc => by rw [← rdistrib, ← rdistrib, hs c hc])
rw [h] at e1
exact (Nat.eq_of_mul_eq_mul_left hD (cancel_l e1)).symm
/-! ## Instances -/
def qf (m t c : Nat) : Nat := 2 * (t * (c + 1) % m)
def rf (m _ _ : Nat) : Nat := m
def certF (m b D : Nat) (l : List Int) : Bool :=
allBelow (fun c =>
Nat.beq (S1 (units m) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (qf m) (rf m) c
+ ind (m - 2 - b) D c)
(S1 (units m) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (rf m) (qf m) c
+ ind b D c)) (m - 1)
def HodgeList (m : Nat) (a : List Nat) : Prop :=
∀ t, t ∈ units m → lsumL (fun i => 2 * (t * i % m)) a = lsumL (fun _ => m) a
theorem pair_one (m b D : Nat) (l : List Int) (hb : b < m - 1) (hb' : m - 2 - b < m - 1) (hD : 0 < D)
(hc : certF m b D l = true) (a : List Nat) (hin : AllIn (m - 1) a) (h : HodgeList m a) :
cnt (b + 1) a = cnt (m - 2 - b + 1) a := by
let x : Nat → Nat := fun c => cnt (c + 1) a
have hx : ∀ t, t ∈ units m → dot (m - 1) (qf m t) x = dot (m - 1) (rf m t) x := by
intro t ht
have e := h t ht
rw [regroup (m - 1) _ a hin, regroup (m - 1) _ a hin] at e
unfold dot
rw [sum_ext _ _ _ (fun c _ => nmul_comm (qf m t c) (x c)),
sum_ext _ _ _ (fun c _ => nmul_comm (rf m t c) (x c))]
exact e
exact extract1 (m - 1) b (m - 2 - b) D hb hb' hD _ _ x
(fun c hcM => beq_eq (all_range _ (m - 1) hc c hcM))
(combine1 (m - 1) (qf m) (rf m) x _ _ (units m) hx)
theorem certF3_0 : certF 3 0 1 [-1, 0] = true := rfl
/-- X_3^n, every n: a Hodge character is paired. -/
theorem paired_char_3 (a : List Nat) (hin : AllIn 2 a) (h : HodgeList 3 a) :
cnt 1 a = cnt 2 a :=
pair_one 3 0 1 [-1, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF3_0 a hin h
theorem certF5_0 : certF 5 0 10 [-3, -1, 0, 0] = true := rfl
theorem certF5_1 : certF 5 1 10 [-1, 3, 0, 0] = true := rfl
/-- X_5^n, every n: a Hodge character is paired. -/
theorem paired_char_5 (a : List Nat) (hin : AllIn 4 a) (h : HodgeList 5 a) :
cnt 1 a = cnt 4 a ∧ cnt 2 a = cnt 3 a :=
⟨pair_one 5 0 10 [-3, -1, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF5_0 a hin h,
pair_one 5 1 10 [-1, 3, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF5_1 a hin h⟩
theorem certF7_0 : certF 7 0 14 [-2, -1, -1, 0, 0, 0] = true := rfl
theorem certF7_1 : certF 7 1 14 [-1, 1, 2, 0, 0, 0] = true := rfl
theorem certF7_2 : certF 7 2 14 [-1, 2, -1, 0, 0, 0] = true := rfl
/-- X_7^n, every n: a Hodge character is paired. -/
theorem paired_char_7 (a : List Nat) (hin : AllIn 6 a) (h : HodgeList 7 a) :
cnt 1 a = cnt 6 a ∧ cnt 2 a = cnt 5 a ∧ cnt 3 a = cnt 4 a :=
⟨pair_one 7 0 14 [-2, -1, -1, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF7_0 a hin h,
pair_one 7 1 14 [-1, 1, 2, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF7_1 a hin h,
pair_one 7 2 14 [-1, 2, -1, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF7_2 a hin h⟩
theorem certF11_0 : certF 11 0 22 [-1, -1, -1, 0, -1, 0, 0, 0, 0, 0] = true := rfl
theorem certF11_1 : certF 11 1 22 [-1, 0, 1, 1, 1, 0, 0, 0, 0, 0] = true := rfl
theorem certF11_2 : certF 11 2 22 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem certF11_3 : certF 11 3 22 [0, 1, -1, -1, 1, 0, 0, 0, 0, 0] = true := rfl
theorem certF11_4 : certF 11 4 22 [-1, 1, 0, 1, -1, 0, 0, 0, 0, 0] = true := rfl
/-- X_11^n, every n: a Hodge character is paired. -/
theorem paired_char_11 (a : List Nat) (hin : AllIn 10 a) (h : HodgeList 11 a) :
cnt 1 a = cnt 10 a ∧ cnt 2 a = cnt 9 a ∧ cnt 3 a = cnt 8 a ∧ cnt 4 a = cnt 7 a ∧ cnt 5 a = cnt 6 a :=
⟨pair_one 11 0 22 [-1, -1, -1, 0, -1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF11_0 a hin h,
pair_one 11 1 22 [-1, 0, 1, 1, 1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF11_1 a hin h,
pair_one 11 2 22 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF11_2 a hin h,
pair_one 11 3 22 [0, 1, -1, -1, 1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF11_3 a hin h,
pair_one 11 4 22 [-1, 1, 0, 1, -1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF11_4 a hin h⟩
theorem certF13_0 : certF 13 0 26 [-1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0] = true := rfl
theorem certF13_1 : certF 13 1 26 [0, -1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem certF13_2 : certF 13 2 26 [-1, 0, 1, 1, 0, -1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem certF13_3 : certF 13 3 26 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
theorem certF13_4 : certF 13 4 26 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem certF13_5 : certF 13 5 26 [0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_13^n, every n: a Hodge character is paired. -/
theorem paired_char_13 (a : List Nat) (hin : AllIn 12 a) (h : HodgeList 13 a) :
cnt 1 a = cnt 12 a ∧ cnt 2 a = cnt 11 a ∧ cnt 3 a = cnt 10 a ∧ cnt 4 a = cnt 9 a ∧ cnt 5 a = cnt 8 a ∧ cnt 6 a = cnt 7 a :=
⟨pair_one 13 0 26 [-1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF13_0 a hin h,
pair_one 13 1 26 [0, -1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF13_1 a hin h,
pair_one 13 2 26 [-1, 0, 1, 1, 0, -1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF13_2 a hin h,
pair_one 13 3 26 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF13_3 a hin h,
pair_one 13 4 26 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF13_4 a hin h,
pair_one 13 5 26 [0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF13_5 a hin h⟩
end FermatFull
#print axioms FermatFull.sum_zero''
#print axioms FermatFull.regroup
#print axioms FermatFull.combine1
#print axioms FermatFull.extract1
#print axioms FermatFull.pair_one
#print axioms FermatFull.certF3_0
#print axioms FermatFull.paired_char_3
#print axioms FermatFull.certF5_0
#print axioms FermatFull.certF5_1
#print axioms FermatFull.paired_char_5
#print axioms FermatFull.certF7_0
#print axioms FermatFull.certF7_1
#print axioms FermatFull.certF7_2
#print axioms FermatFull.paired_char_7
#print axioms FermatFull.certF11_0
#print axioms FermatFull.certF11_1
#print axioms FermatFull.certF11_2
#print axioms FermatFull.certF11_3
#print axioms FermatFull.certF11_4
#print axioms FermatFull.paired_char_11
#print axioms FermatFull.certF13_0
#print axioms FermatFull.certF13_1
#print axioms FermatFull.certF13_2
#print axioms FermatFull.certF13_3
#print axioms FermatFull.certF13_4
#print axioms FermatFull.certF13_5
#print axioms FermatFull.paired_char_13
lean_all/hodge/FermatGens.lean
/-
hodge/FermatGens.lean — T41 cycle 46: the Hodge semigroup of the Fermat varieties X_m^n for m = 6, 8
is generated, up to length 10, by three kinds of characters (checked by rfl):
pairs (a, m − a) — algebraic: linear subspaces (Shioda)
standard quadruples — algebraic: Aoki–Shioda standard cycles
two zero-sum triples (curve × curve) — algebraic: Lefschetz (1,1) on a product of Fermat curves
m = 6: [1,1,4,4,4,4] = [1,1,4] + [4,4,4], [2,2,2,2,5,5] = [2,2,2] + [2,5,5];
m = 8: [1,1,5,5,6,6] = [1,1,6] + [5,5,6], [2,2,3,3,7,7] = [2,3,3] + [2,7,7].
So for m ∈ {6, 8} and dimension n ≤ 8 (length ≤ 10) every Hodge character is a sum of algebraic
ones (the Hodge conjecture for these Fermat varieties, character by character, modulo the cited
algebraicity of the three generator kinds). Measured to length 12 in numeric form (HODGE_LOG c46).
-/
namespace FermatGens
/-- ⟨t·a⟩ summed, compared with (L/2)·m. -/
def tsum (m t : Nat) : List Nat → Nat
| [] => 0
| a :: l => (t * a) % m + tsum m t l
def hodgeB (m : Nat) (U : List Nat) (c : List Nat) : Bool :=
U.all (fun t => Nat.beq (tsum m t c + tsum m t c) (c.length * m))
/-- Remove one occurrence. -/
def erase1 (x : Nat) : List Nat → Option (List Nat)
| [] => none
| y :: l => if Nat.beq x y then some l else (erase1 x l).map (y :: ·)
def sub (c : List Nat) : List Nat → Option (List Nat)
| [] => some c
| g :: gs => match erase1 g c with
| none => none
| some c' => sub c' gs
/-- Is c a sum of generators from G? (fuel = length bound; explicit recursion, no propext) -/
def tryG (rec : List Nat → Bool) (c : List Nat) : List (List Nat) → Bool
| [] => false
| g :: gs => (match sub c g with
| none => false
| some c' => rec c') || tryG rec c gs
def cover (G : List (List Nat)) : Nat → List Nat → Bool
| 0, c => c.isEmpty
| f + 1, c => c.isEmpty || tryG (cover G f) c G
/-- Nondecreasing lists of length L with entries in [lo, m). -/
def multis (m : Nat) : Nat → Nat → List (List Nat)
| 0, _ => [[]]
| L + 1, lo => (List.range (m - lo)).flatMap (fun i => (multis m L (lo + i)).map ((lo + i) :: ·))
def check (m : Nat) (U : List Nat) (G : List (List Nat)) (L : Nat) : Bool :=
(multis m L 1).all (fun c => !(hodgeB m U c) || cover G L c)
def G6 : List (List Nat) := [[1,5],[2,4],[3,3],[1,3,4,4],[2,2,3,5],[1,1,4,4,4,4],[2,2,2,2,5,5]]
def G8 : List (List Nat) := [[1,7],[2,6],[3,5],[4,4],[1,4,5,6],[2,3,4,7],[1,1,5,5,6,6],[2,2,3,3,7,7]]
def zs (m : Nat) (l : List Nat) : Bool := Nat.beq (l.foldr (· + ·) 0 % m) 0
theorem split6a : zs 6 [1,1,4] && zs 6 [4,4,4] = true := rfl
theorem split6b : zs 6 [2,2,2] && zs 6 [2,5,5] = true := rfl
theorem split8a : zs 8 [1,1,6] && zs 8 [5,5,6] = true := rfl
theorem split8b : zs 8 [2,3,3] && zs 8 [2,7,7] = true := rfl
theorem gens6_hodge : G6.all (hodgeB 6 [1,5]) = true := rfl
theorem gens8_hodge : G8.all (hodgeB 8 [1,3,5,7]) = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover6_2 : check 6 [1,5] G6 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover6_4 : check 6 [1,5] G6 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover6_6 : check 6 [1,5] G6 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover6_8 : check 6 [1,5] G6 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover6_10 : check 6 [1,5] G6 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover8_2 : check 8 [1,3,5,7] G8 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover8_4 : check 8 [1,3,5,7] G8 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover8_6 : check 8 [1,3,5,7] G8 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover8_8 : check 8 [1,3,5,7] G8 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 100000 in
theorem cover8_10 : check 8 [1,3,5,7] G8 10 = true := rfl
end FermatGens
#print axioms FermatGens.split6a
#print axioms FermatGens.split6b
#print axioms FermatGens.split8a
#print axioms FermatGens.split8b
#print axioms FermatGens.gens6_hodge
#print axioms FermatGens.gens8_hodge
#print axioms FermatGens.cover6_2
#print axioms FermatGens.cover6_4
#print axioms FermatGens.cover6_6
#print axioms FermatGens.cover6_8
#print axioms FermatGens.cover6_10
#print axioms FermatGens.cover8_2
#print axioms FermatGens.cover8_4
#print axioms FermatGens.cover8_6
#print axioms FermatGens.cover8_8
#print axioms FermatGens.cover8_10
lean_all/hodge/FermatGens2.lean
/- hodge/FermatGens2.lean — T41 cycle 49: for m = 10 (n ≤ 8) and m = 15 (n ≤ 4) every Hodge character of the Fermat variety X_m^n is a sum of characters of length 2 and 4 (Hodge classes on Fermat curves' products of dimension ≤ 2: algebraic by Lefschetz (1,1) through Shioda's inductive structure) and curve×curve sextuples (two zero-sum triples). Checked by rfl with FermatGens.check. -/ import hodge.FermatGens namespace FermatGens2 open FermatGens def G10 : List (List Nat) := [[1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [1, 3, 8, 8], [1, 5, 6, 8], [1, 6, 6, 7], [2, 2, 7, 9], [2, 4, 5, 9], [2, 5, 6, 7], [3, 4, 4, 9], [3, 4, 5, 8], [1, 1, 6, 6, 8, 8], [2, 2, 4, 4, 9, 9], [2, 2, 6, 6, 7, 7], [3, 3, 4, 4, 8, 8]] theorem gens10_hodge : G10.all (hodgeB 10 [1, 3, 7, 9]) = true := rfl theorem split10_0 : zs 10 [1, 1, 8] && zs 10 [6, 6, 8] = true := rfl theorem split10_1 : zs 10 [2, 4, 4] && zs 10 [2, 9, 9] = true := rfl theorem split10_2 : zs 10 [2, 2, 6] && zs 10 [6, 7, 7] = true := rfl theorem split10_3 : zs 10 [3, 3, 4] && zs 10 [4, 8, 8] = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover10_2 : check 10 [1, 3, 7, 9] G10 2 = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover10_4 : check 10 [1, 3, 7, 9] G10 4 = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover10_6 : check 10 [1, 3, 7, 9] G10 6 = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover10_8 : check 10 [1, 3, 7, 9] G10 8 = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover10_10 : check 10 [1, 3, 7, 9] G10 10 = true := rfl def G15 : List (List Nat) := [[1, 14], [2, 13], [3, 12], [4, 11], [5, 10], [6, 9], [7, 8], [1, 6, 10, 13], [1, 6, 11, 12], [1, 7, 10, 12], [2, 5, 9, 14], [2, 5, 11, 12], [2, 7, 9, 12], [3, 4, 9, 14], [3, 4, 10, 13], [3, 5, 8, 14], [3, 6, 8, 13], [4, 7, 9, 10], [5, 6, 8, 11], [1, 2, 7, 11, 12, 12], [1, 4, 7, 10, 10, 13], [1, 6, 6, 8, 11, 13], [2, 4, 7, 9, 9, 14], [2, 5, 5, 8, 11, 14], [3, 3, 4, 8, -- (+8 chars; full line in the Zenodo source) theorem gens15_hodge : G15.all (hodgeB 15 [1, 2, 4, 7, 8, 11, 13, 14]) = true := rfl theorem split15_0 : zs 15 [1, 2, 12] && zs 15 [7, 11, 12] = true := rfl theorem split15_1 : zs 15 [1, 4, 10] && zs 15 [7, 10, 13] = true := rfl theorem split15_2 : zs 15 [1, 6, 8] && zs 15 [6, 11, 13] = true := rfl theorem split15_3 : zs 15 [2, 4, 9] && zs 15 [7, 9, 14] = true := rfl theorem split15_4 : zs 15 [2, 5, 8] && zs 15 [5, 11, 14] = true := rfl theorem split15_5 : zs 15 [3, 4, 8] && zs 15 [3, 13, 14] = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover15_2 : check 15 [1, 2, 4, 7, 8, 11, 13, 14] G15 2 = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover15_4 : check 15 [1, 2, 4, 7, 8, 11, 13, 14] G15 4 = true := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 2000000 in theorem cover15_6 : check 15 [1, 2, 4, 7, 8, 11, 13, 14] G15 6 = true := rfl end FermatGens2 #print axioms FermatGens2.gens10_hodge #print axioms FermatGens2.split10_0 #print axioms FermatGens2.split10_1 #print axioms FermatGens2.split10_2 #print axioms FermatGens2.split10_3 #print axioms FermatGens2.cover10_2 #print axioms FermatGens2.cover10_4 #print axioms FermatGens2.cover10_6 #print axioms FermatGens2.cover10_8 #print axioms FermatGens2.cover10_10 #print axioms FermatGens2.gens15_hodge #print axioms FermatGens2.split15_0 #print axioms FermatGens2.split15_1 #print axioms FermatGens2.split15_2 #print axioms FermatGens2.split15_3 #print axioms FermatGens2.split15_4 #print axioms FermatGens2.split15_5 #print axioms FermatGens2.cover15_2 #print axioms FermatGens2.cover15_4 #print axioms FermatGens2.cover15_6
lean_all/hodge/FermatInductive.lean
/-
hodge/FermatInductive.lean — T41 cycle 58: Shioda's inductive structure, with a connecting character,
reaches every Hodge character of X_m^n for m = 12, 14 (n ≤ 6) from surfaces.
Inductive structure (Shioda 1979): X_m^r × X_m^s ⇢ X_m^{r+s}; a character c = A ⊔ B of X^{r+s} comes from
(A, −s) on X^r and (B, s) on X^s, s = ΣA mod m ≠ 0 (or s = 0: plain product). If both pieces are
Hodge and algebraic, so is c. Base: length ≤ 4 (points, curves, surfaces: Lefschetz (1,1)).
reach Bool closure (fuel = length), checked by rfl
e14_split (1,1,9,9,11,11) = [1,9,11 | 7] ⊔ [1,9,11 | 7], and (1,9,11,7) is Hodge on X_14^2
reach12_L_a, reach14_L_a every Hodge character of length L = 6, 8 with smallest entry a is reached
This corrects cycle 55: the m = 14 exceptional characters are indecomposable as products, but are
reached with a connecting character (Fermat14Exc stays true as stated).
-/
import hodge.FermatGens
namespace FermatInductive
open FermatGens
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (x :: ·) ++ subs l
def lsumN : List Nat → Nat
| [] => 0
| x :: l => x + lsumN l
def compl (c s : List Nat) : List Nat := (sub c s).getD []
/-- one split step, given the closure at smaller fuel -/
def splitOK (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c A : List Nat) : Bool :=
let B := compl c A
let s := lsumN A % m
if Nat.beq s 0 then
!A.isEmpty && !B.isEmpty && hodgeB m U A && hodgeB m U B && rec A && rec B
else
let A2 := (m - s) :: A
let B2 := s :: B
Nat.blt A2.length c.length && Nat.blt B2.length c.length &&
hodgeB m U A2 && hodgeB m U B2 && rec A2 && rec B2
def anySplit (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c : List Nat) : List (List Nat) → Bool
| [] => false
| A :: As => splitOK m U rec c A || anySplit m U rec c As
def reach (m : Nat) (U : List Nat) : Nat → List Nat → Bool
| 0, c => Nat.blt c.length 5
| f + 1, c => Nat.blt c.length 5 || anySplit m U (reach m U f) c (subs c)
def allReach (m : Nat) (U : List Nat) (L : Nat) : Bool :=
(multis m L 1).all (fun c => !(hodgeB m U c) || reach m U L c)
theorem e14_split : hodgeB 14 [1, 3, 5, 9, 11, 13] [1, 9, 11, 7] = true ∧
lsumN [1, 9, 11] % 14 = 7 := ⟨rfl, rfl⟩
theorem e14_reach : reach 14 [1, 3, 5, 9, 11, 13] 6 [1, 1, 9, 9, 11, 11] = true ∧
reach 14 [1, 3, 5, 9, 11, 13] 6 [3, 3, 5, 5, 13, 13] = true := ⟨rfl, rfl⟩
def allReachFrom (m : Nat) (U : List Nat) (L a : Nat) : Bool :=
(multis m L a).all (fun c => !(hodgeB m U (a :: c)) || reach m U (L + 1) (a :: c))
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_1 : allReachFrom 12 [1, 5, 7, 11] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_2 : allReachFrom 12 [1, 5, 7, 11] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_3 : allReachFrom 12 [1, 5, 7, 11] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_4 : allReachFrom 12 [1, 5, 7, 11] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_5 : allReachFrom 12 [1, 5, 7, 11] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_6 : allReachFrom 12 [1, 5, 7, 11] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_7 : allReachFrom 12 [1, 5, 7, 11] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_8 : allReachFrom 12 [1, 5, 7, 11] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_9 : allReachFrom 12 [1, 5, 7, 11] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_10 : allReachFrom 12 [1, 5, 7, 11] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_6_11 : allReachFrom 12 [1, 5, 7, 11] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_1 : allReachFrom 12 [1, 5, 7, 11] 7 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_2 : allReachFrom 12 [1, 5, 7, 11] 7 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_3 : allReachFrom 12 [1, 5, 7, 11] 7 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_4 : allReachFrom 12 [1, 5, 7, 11] 7 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_5 : allReachFrom 12 [1, 5, 7, 11] 7 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_6 : allReachFrom 12 [1, 5, 7, 11] 7 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_7 : allReachFrom 12 [1, 5, 7, 11] 7 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_8 : allReachFrom 12 [1, 5, 7, 11] 7 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_9 : allReachFrom 12 [1, 5, 7, 11] 7 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_10 : allReachFrom 12 [1, 5, 7, 11] 7 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach12_8_11 : allReachFrom 12 [1, 5, 7, 11] 7 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_1 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_2 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_3 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_4 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_5 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_6 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_7 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_8 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_9 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_10 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_11 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_12 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_6_13 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 5 13 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_1 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_2 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_3 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_4 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_5 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_6 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_7 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_8 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_9 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_10 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_11 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_12 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach14_8_13 : allReachFrom 14 [1, 3, 5, 9, 11, 13] 7 13 = true := rfl
end FermatInductive
#print axioms FermatInductive.e14_split
#print axioms FermatInductive.e14_reach
#print axioms FermatInductive.reach12_6_1
#print axioms FermatInductive.reach12_6_2
#print axioms FermatInductive.reach12_6_3
#print axioms FermatInductive.reach12_6_4
#print axioms FermatInductive.reach12_6_5
#print axioms FermatInductive.reach12_6_6
#print axioms FermatInductive.reach12_6_7
#print axioms FermatInductive.reach12_6_8
#print axioms FermatInductive.reach12_6_9
#print axioms FermatInductive.reach12_6_10
#print axioms FermatInductive.reach12_6_11
#print axioms FermatInductive.reach12_8_1
#print axioms FermatInductive.reach12_8_2
#print axioms FermatInductive.reach12_8_3
#print axioms FermatInductive.reach12_8_4
#print axioms FermatInductive.reach12_8_5
#print axioms FermatInductive.reach12_8_6
#print axioms FermatInductive.reach12_8_7
#print axioms FermatInductive.reach12_8_8
#print axioms FermatInductive.reach12_8_9
#print axioms FermatInductive.reach12_8_10
#print axioms FermatInductive.reach12_8_11
#print axioms FermatInductive.reach14_6_1
#print axioms FermatInductive.reach14_6_2
#print axioms FermatInductive.reach14_6_3
#print axioms FermatInductive.reach14_6_4
#print axioms FermatInductive.reach14_6_5
#print axioms FermatInductive.reach14_6_6
#print axioms FermatInductive.reach14_6_7
#print axioms FermatInductive.reach14_6_8
#print axioms FermatInductive.reach14_6_9
#print axioms FermatInductive.reach14_6_10
#print axioms FermatInductive.reach14_6_11
#print axioms FermatInductive.reach14_6_12
#print axioms FermatInductive.reach14_6_13
#print axioms FermatInductive.reach14_8_1
#print axioms FermatInductive.reach14_8_2
#print axioms FermatInductive.reach14_8_3
#print axioms FermatInductive.reach14_8_4
#print axioms FermatInductive.reach14_8_5
#print axioms FermatInductive.reach14_8_6
#print axioms FermatInductive.reach14_8_7
#print axioms FermatInductive.reach14_8_8
#print axioms FermatInductive.reach14_8_9
#print axioms FermatInductive.reach14_8_10
#print axioms FermatInductive.reach14_8_11
#print axioms FermatInductive.reach14_8_12
#print axioms FermatInductive.reach14_8_13
lean_all/hodge/FermatInductive2.lean
/-
hodge/FermatInductive2.lean — T41 cycle 69: the inductive structure (with connecting characters) reaches every
Hodge character of length 6 (n = 4) for m = 18, 20, 21 from surfaces (Lefschetz), checked by rfl, split by the smallest entry a (allReachFrom; every nondecreasing
character of length 6 is a :: c with c nondecreasing from a), with
allReach (same definition as FermatInductive) (compiled on Kamiak).
-/
import hodge.FermatGens
namespace FermatInductive2
open FermatGens
-- the definitions of FermatInductive (repeated: that file is checked on Kamiak, not a lake root)
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (x :: ·) ++ subs l
def lsumN : List Nat → Nat
| [] => 0
| x :: l => x + lsumN l
def compl (c s : List Nat) : List Nat := (sub c s).getD []
/-- one split step, given the closure at smaller fuel -/
def splitOK (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c A : List Nat) : Bool :=
let B := compl c A
let s := lsumN A % m
if Nat.beq s 0 then
!A.isEmpty && !B.isEmpty && hodgeB m U A && hodgeB m U B && rec A && rec B
else
let A2 := (m - s) :: A
let B2 := s :: B
Nat.blt A2.length c.length && Nat.blt B2.length c.length &&
hodgeB m U A2 && hodgeB m U B2 && rec A2 && rec B2
def anySplit (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c : List Nat) : List (List Nat) → Bool
| [] => false
| A :: As => splitOK m U rec c A || anySplit m U rec c As
def reach (m : Nat) (U : List Nat) : Nat → List Nat → Bool
| 0, c => Nat.blt c.length 5
| f + 1, c => Nat.blt c.length 5 || anySplit m U (reach m U f) c (subs c)
def allReach (m : Nat) (U : List Nat) (L : Nat) : Bool :=
(multis m L 1).all (fun c => !(hodgeB m U c) || reach m U L c)
/-- the check restricted to characters whose smallest entry is a (split for memory) -/
def allReachFrom (m : Nat) (U : List Nat) (L a : Nat) : Bool :=
(multis m L a).all (fun c => !(hodgeB m U (a :: c)) || reach m U (L + 1) (a :: c))
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_1 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_2 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_3 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_4 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_5 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_6 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_7 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_8 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_9 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_10 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_11 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_12 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_13 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 13 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_14 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 14 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_15 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 15 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_16 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 16 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach18_6_17 : allReachFrom 18 [1, 5, 7, 11, 13, 17] 5 17 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_1 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_2 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_3 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_4 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_5 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_6 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_7 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_8 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_9 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_10 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_11 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_12 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_13 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 13 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_14 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 14 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_15 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 15 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_16 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 16 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_17 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 17 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_18 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 18 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach20_6_19 : allReachFrom 20 [1, 3, 7, 9, 11, 13, 17, 19] 5 19 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_1 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_2 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_3 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_4 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_5 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_6 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_7 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_8 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_9 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_10 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_11 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_12 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_13 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 13 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_14 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 14 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_15 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 15 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_16 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 16 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_17 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 17 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_18 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 18 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_19 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 19 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach21_6_20 : allReachFrom 21 [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20] 5 20 = true := rfl
end FermatInductive2
#print axioms FermatInductive2.reach18_6_1
#print axioms FermatInductive2.reach18_6_2
#print axioms FermatInductive2.reach18_6_3
#print axioms FermatInductive2.reach18_6_4
#print axioms FermatInductive2.reach18_6_5
#print axioms FermatInductive2.reach18_6_6
#print axioms FermatInductive2.reach18_6_7
#print axioms FermatInductive2.reach18_6_8
#print axioms FermatInductive2.reach18_6_9
#print axioms FermatInductive2.reach18_6_10
#print axioms FermatInductive2.reach18_6_11
#print axioms FermatInductive2.reach18_6_12
#print axioms FermatInductive2.reach18_6_13
#print axioms FermatInductive2.reach18_6_14
#print axioms FermatInductive2.reach18_6_15
#print axioms FermatInductive2.reach18_6_16
#print axioms FermatInductive2.reach18_6_17
#print axioms FermatInductive2.reach20_6_1
#print axioms FermatInductive2.reach20_6_2
#print axioms FermatInductive2.reach20_6_3
#print axioms FermatInductive2.reach20_6_4
#print axioms FermatInductive2.reach20_6_5
#print axioms FermatInductive2.reach20_6_6
#print axioms FermatInductive2.reach20_6_7
#print axioms FermatInductive2.reach20_6_8
#print axioms FermatInductive2.reach20_6_9
#print axioms FermatInductive2.reach20_6_10
#print axioms FermatInductive2.reach20_6_11
#print axioms FermatInductive2.reach20_6_12
#print axioms FermatInductive2.reach20_6_13
#print axioms FermatInductive2.reach20_6_14
#print axioms FermatInductive2.reach20_6_15
#print axioms FermatInductive2.reach20_6_16
#print axioms FermatInductive2.reach20_6_17
#print axioms FermatInductive2.reach20_6_18
#print axioms FermatInductive2.reach20_6_19
#print axioms FermatInductive2.reach21_6_1
#print axioms FermatInductive2.reach21_6_2
#print axioms FermatInductive2.reach21_6_3
#print axioms FermatInductive2.reach21_6_4
#print axioms FermatInductive2.reach21_6_5
#print axioms FermatInductive2.reach21_6_6
#print axioms FermatInductive2.reach21_6_7
#print axioms FermatInductive2.reach21_6_8
#print axioms FermatInductive2.reach21_6_9
#print axioms FermatInductive2.reach21_6_10
#print axioms FermatInductive2.reach21_6_11
#print axioms FermatInductive2.reach21_6_12
#print axioms FermatInductive2.reach21_6_13
#print axioms FermatInductive2.reach21_6_14
#print axioms FermatInductive2.reach21_6_15
#print axioms FermatInductive2.reach21_6_16
#print axioms FermatInductive2.reach21_6_17
#print axioms FermatInductive2.reach21_6_18
#print axioms FermatInductive2.reach21_6_19
#print axioms FermatInductive2.reach21_6_20
lean_all/hodge/FermatInductive3m25.lean
/-
hodge/FermatInductive3.lean — T41 cycle 110: inductive structure with the Aoki–Shioda standard characters
as extra base (Hodge for every m: hodge/StdGeneral) covers every Hodge character of X_m^4 for the prime
square m = 25 (split by smallest entry, rfl on Kamiak). Cycle half of both operations cited.
-/
import hodge.Fermat32Open
namespace FermatInductive3m25
open FermatGens Fermat25Std Fermat32Open
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (x :: ·) ++ subs l
def lsumN : List Nat → Nat
| [] => 0
| x :: l => x + lsumN l
def compl (c s : List Nat) : List Nat := (sub c s).getD []
/-- one split step, given the closure at smaller fuel -/
def splitOK (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c A : List Nat) : Bool :=
let B := compl c A
let s := lsumN A % m
if Nat.beq s 0 then
!A.isEmpty && !B.isEmpty && hodgeB m U A && hodgeB m U B && rec A && rec B
else
let A2 := (m - s) :: A
let B2 := s :: B
Nat.blt A2.length c.length && Nat.blt B2.length c.length &&
hodgeB m U A2 && hodgeB m U B2 && rec A2 && rec B2
def anySplit (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c : List Nat) : List (List Nat) → Bool
| [] => false
| A :: As => splitOK m U rec c A || anySplit m U rec c As
def isStd (m : Nat) (c : List Nat) : Bool :=
(List.range (m + 1)).any (fun d => Nat.blt 1 d && Nat.beq (m % d) 0 &&
(List.range m).any (fun a => sameMS c (std m d a)))
def reach (m : Nat) (U : List Nat) : Nat → List Nat → Bool
| 0, c => Nat.blt c.length 5 || isStd m c
| f + 1, c => Nat.blt c.length 5 || isStd m c || anySplit m U (reach m U f) c (subs c)
def allReach (m : Nat) (U : List Nat) (L : Nat) : Bool :=
(multis m L 1).all (fun c => !(hodgeB m U c) || reach m U L c)
def allReachFrom (m : Nat) (U : List Nat) (L a : Nat) : Bool :=
(multis m L a).all (fun c => !(hodgeB m U (a :: c)) || reach m U (L + 1) (a :: c))
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_1 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_2 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_3 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_4 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_5 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_6 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_7 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_8 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_9 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_10 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_11 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_12 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_13 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 13 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_14 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 14 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_15 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 15 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_16 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 16 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_17 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 17 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_18 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 18 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_19 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 19 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_20 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 20 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_21 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 21 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_22 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 22 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_23 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 23 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach25_24 : allReachFrom 25 [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24] 5 24 = true := rfl
end FermatInductive3m25
#print axioms FermatInductive3m25.reach25_1
#print axioms FermatInductive3m25.reach25_2
#print axioms FermatInductive3m25.reach25_3
#print axioms FermatInductive3m25.reach25_4
#print axioms FermatInductive3m25.reach25_5
#print axioms FermatInductive3m25.reach25_6
#print axioms FermatInductive3m25.reach25_7
#print axioms FermatInductive3m25.reach25_8
#print axioms FermatInductive3m25.reach25_9
#print axioms FermatInductive3m25.reach25_10
#print axioms FermatInductive3m25.reach25_11
#print axioms FermatInductive3m25.reach25_12
#print axioms FermatInductive3m25.reach25_13
#print axioms FermatInductive3m25.reach25_14
#print axioms FermatInductive3m25.reach25_15
#print axioms FermatInductive3m25.reach25_16
#print axioms FermatInductive3m25.reach25_17
#print axioms FermatInductive3m25.reach25_18
#print axioms FermatInductive3m25.reach25_19
#print axioms FermatInductive3m25.reach25_20
#print axioms FermatInductive3m25.reach25_21
#print axioms FermatInductive3m25.reach25_22
#print axioms FermatInductive3m25.reach25_23
#print axioms FermatInductive3m25.reach25_24
lean_all/hodge/FermatInductive3m49.lean
/-
hodge/FermatInductive3.lean — T41 cycle 110: inductive structure with the Aoki–Shioda standard characters
as extra base (Hodge for every m: hodge/StdGeneral) covers every Hodge character of X_m^4 for the prime
square m = 49 (split by smallest entry, rfl on Kamiak). Cycle half of both operations cited.
-/
import hodge.Fermat32Open
namespace FermatInductive3m49
open FermatGens Fermat25Std Fermat32Open
def subs : List Nat → List (List Nat)
| [] => [[]]
| x :: l => (subs l).map (x :: ·) ++ subs l
def lsumN : List Nat → Nat
| [] => 0
| x :: l => x + lsumN l
def compl (c s : List Nat) : List Nat := (sub c s).getD []
/-- one split step, given the closure at smaller fuel -/
def splitOK (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c A : List Nat) : Bool :=
let B := compl c A
let s := lsumN A % m
if Nat.beq s 0 then
!A.isEmpty && !B.isEmpty && hodgeB m U A && hodgeB m U B && rec A && rec B
else
let A2 := (m - s) :: A
let B2 := s :: B
Nat.blt A2.length c.length && Nat.blt B2.length c.length &&
hodgeB m U A2 && hodgeB m U B2 && rec A2 && rec B2
def anySplit (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c : List Nat) : List (List Nat) → Bool
| [] => false
| A :: As => splitOK m U rec c A || anySplit m U rec c As
def isStd (m : Nat) (c : List Nat) : Bool :=
(List.range (m + 1)).any (fun d => Nat.blt 1 d && Nat.beq (m % d) 0 &&
(List.range m).any (fun a => sameMS c (std m d a)))
def reach (m : Nat) (U : List Nat) : Nat → List Nat → Bool
| 0, c => Nat.blt c.length 5 || isStd m c
| f + 1, c => Nat.blt c.length 5 || isStd m c || anySplit m U (reach m U f) c (subs c)
def allReach (m : Nat) (U : List Nat) (L : Nat) : Bool :=
(multis m L 1).all (fun c => !(hodgeB m U c) || reach m U L c)
def allReachFrom (m : Nat) (U : List Nat) (L a : Nat) : Bool :=
(multis m L a).all (fun c => !(hodgeB m U (a :: c)) || reach m U (L + 1) (a :: c))
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_1 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 1 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_2 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 2 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_3 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 3 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_4 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 4 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_5 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 5 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_6 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 6 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_7 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 7 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_8 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 8 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_9 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 9 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_10 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 10 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_11 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 11 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_12 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 12 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_13 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 13 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_14 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 14 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_15 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 15 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_16 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 16 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_17 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 17 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_18 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 18 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_19 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 19 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_20 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 20 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_21 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 21 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_22 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 22 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_23 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 23 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_24 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 24 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_25 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 25 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_26 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 26 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_27 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 27 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_28 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 28 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_29 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 29 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_30 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 30 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_31 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 31 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_32 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 32 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_33 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 33 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_34 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 34 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_35 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 35 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_36 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 36 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_37 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 37 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_38 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 38 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_39 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 39 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_40 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 40 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_41 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 41 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_42 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 42 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_43 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 43 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_44 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 44 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_45 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 45 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_46 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 46 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_47 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 47 = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 2000000 in
theorem reach49_48 : allReachFrom 49 [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48] 5 48 = true := rfl
end FermatInductive3m49
#print axioms FermatInductive3m49.reach49_1
#print axioms FermatInductive3m49.reach49_2
#print axioms FermatInductive3m49.reach49_3
#print axioms FermatInductive3m49.reach49_4
#print axioms FermatInductive3m49.reach49_5
#print axioms FermatInductive3m49.reach49_6
#print axioms FermatInductive3m49.reach49_7
#print axioms FermatInductive3m49.reach49_8
#print axioms FermatInductive3m49.reach49_9
#print axioms FermatInductive3m49.reach49_10
#print axioms FermatInductive3m49.reach49_11
#print axioms FermatInductive3m49.reach49_12
#print axioms FermatInductive3m49.reach49_13
#print axioms FermatInductive3m49.reach49_14
#print axioms FermatInductive3m49.reach49_15
#print axioms FermatInductive3m49.reach49_16
#print axioms FermatInductive3m49.reach49_17
#print axioms FermatInductive3m49.reach49_18
#print axioms FermatInductive3m49.reach49_19
#print axioms FermatInductive3m49.reach49_20
#print axioms FermatInductive3m49.reach49_21
#print axioms FermatInductive3m49.reach49_22
#print axioms FermatInductive3m49.reach49_23
#print axioms FermatInductive3m49.reach49_24
#print axioms FermatInductive3m49.reach49_25
#print axioms FermatInductive3m49.reach49_26
#print axioms FermatInductive3m49.reach49_27
#print axioms FermatInductive3m49.reach49_28
#print axioms FermatInductive3m49.reach49_29
#print axioms FermatInductive3m49.reach49_30
#print axioms FermatInductive3m49.reach49_31
#print axioms FermatInductive3m49.reach49_32
#print axioms FermatInductive3m49.reach49_33
#print axioms FermatInductive3m49.reach49_34
#print axioms FermatInductive3m49.reach49_35
#print axioms FermatInductive3m49.reach49_36
#print axioms FermatInductive3m49.reach49_37
#print axioms FermatInductive3m49.reach49_38
#print axioms FermatInductive3m49.reach49_39
#print axioms FermatInductive3m49.reach49_40
#print axioms FermatInductive3m49.reach49_41
#print axioms FermatInductive3m49.reach49_42
#print axioms FermatInductive3m49.reach49_43
#print axioms FermatInductive3m49.reach49_44
#print axioms FermatInductive3m49.reach49_45
#print axioms FermatInductive3m49.reach49_46
#print axioms FermatInductive3m49.reach49_47
#print axioms FermatInductive3m49.reach49_48
lean_all/hodge/FermatPrime.lean
/-
hodge/FermatPrime.lean — T41 cycle 3: Hodge characters of Fermat varieties of prime degree are
paired, in every dimension (the linear part of Ran's theorem), for m = 3, 5, 7, 11, 13.
Lean 4 core plus FTAChain / FrobChain (sumTo, sum_add, sum_ext, nadd_*, nmul_*). Hand proofs;
certificates checked by `rfl`.
Setting. A character of X_m^n (m odd prime) has multiplicities n_c of the residues c = 1..m−1;
write x_c = n_c and y_c = n_{m−c} for c = 1..k, k = (m−1)/2. Since ⟨t(m−c)⟩ = m − ⟨tc⟩ for a unit t,
the Hodge condition Σ_i ⟨t a_i⟩ = (n/2 + 1) m, together with Σ_i 1 = n + 2, becomes, for every unit t,
E_t : Σ_c 2⟨tc⟩ x_c + Σ_c m y_c = Σ_c 2⟨tc⟩ y_c + Σ_c m x_c ,
a linear system that does not depend on n. "Paired" means x_c = y_c for every c.
Proved here:
sum_scale, sum_swap, sum_indicator linear algebra of finite sums in ℕ
combine Nat-weighted combinations of the E_t (and of their mirror
images) are again of the form S·x + S'·y = S·y + S'·x
extract if S = S' + D·e_b with D > 0, then x_b = y_b
paired_3, paired_5, paired_7, paired_11, paired_13
for m = 3, 5, 7, 11, 13 and every multiplicity vector
(hence every dimension n): E_t for all units t ⇒ x = y.
The certificates ℓ with ℓᵀM' = D e_b (M'_{tc} = 2⟨tc⟩ − m,
D = 2m) were found by exact elimination (Python) and are
checked here by rfl.
Remaining (OPEN_LEMMAS_HODGE): the reduction from characters to E_t (the identity
⟨t(m−c)⟩ = m − ⟨tc⟩ and the regrouping), and every prime m (rank of M' = k: equivalent to
B_{1,χ} ≠ 0 for the odd Dirichlet characters χ mod m).
-/
import FrobChain
namespace FermatPrime
open FTAChain FrobChain
/-! ## Finite sums -/
theorem rdistrib (a b c : Nat) : (a + b) * c = a * c + b * c := by
rw [nmul_comm, Nat.left_distrib, nmul_comm c a, nmul_comm c b]
theorem sum_scale (a : Nat) : ∀ (n : Nat) (f : Nat → Nat), sumTo n (fun c => a * f c) = a * sumTo n f
| 0, _ => (Nat.mul_zero a).symm
| n + 1, f => by
show sumTo n (fun c => a * f c) + a * f n = a * (sumTo n f + f n)
rw [sum_scale a n f, Nat.left_distrib]
/-- Sum over a list of indices. -/
def lsum (T : List Nat) (g : Nat → Nat) : Nat := T.foldr (fun t acc => g t + acc) 0
theorem sum_swap (k : Nat) (g : Nat → Nat → Nat) : ∀ T : List Nat,
sumTo k (fun c => lsum T (fun t => g t c)) = lsum T (fun t => sumTo k (fun c => g t c))
| [] => by
show sumTo k (fun _ => 0) = 0
exact ESChainFree.sum_zero' k
| t :: T => by
show sumTo k (fun c => g t c + lsum T (fun t => g t c)) = sumTo k (fun c => g t c) + lsum T (fun t => sumTo k (fun c => g t c))
rw [sum_add, sum_swap k g T]
where
ESChainFree.sum_zero' : ∀ n, sumTo n (fun _ => 0) = 0
| 0 => rfl
| n + 1 => by show sumTo n (fun _ => 0) + 0 = 0; rw [ESChainFree.sum_zero' n]
def ind (b D c : Nat) : Nat := if c = b then D else 0
theorem sum_indicator (b D : Nat) (x : Nat → Nat) : ∀ k, b < k → sumTo k (fun c => ind b D c * x c) = D * x b
| 0, h => absurd h (Nat.not_lt_zero b)
| k + 1, h => by
show sumTo k (fun c => ind b D c * x c) + ind b D k * x k = D * x b
cases Nat.lt_or_eq_of_le (Nat.le_of_lt_succ h) with
| inl hl =>
rw [sum_indicator b D x k hl]
have : ind b D k = 0 := by
unfold ind
exact ite_eq_right (fun (e : k = b) => Nat.lt_irrefl b (e ▸ hl))
rw [this, Nat.zero_mul]
rfl
| inr he =>
have z : sumTo k (fun c => ind b D c * x c) = 0 := by
apply zero_below
intro c hc
have : ind b D c = 0 := ite_eq_right (fun (e : c = b) => by
have ck : c = k := e.trans he
exact Nat.lt_irrefl k (ck ▸ hc))
rw [this, Nat.zero_mul]
rw [z, Nat.zero_add, he]
unfold ind
rw [ite_eq_left rfl]
where
zero_below : ∀ {n : Nat} {f : Nat → Nat}, (∀ c, c < n → f c = 0) → sumTo n f = 0
| 0, _, _ => rfl
| n + 1, f, h => by
show sumTo n f + f n = 0
rw [zero_below (fun c hc => h c (Nat.lt_succ_of_lt hc)), h n (Nat.lt_succ_self n)]
def dot (k : Nat) (v x : Nat → Nat) : Nat := sumTo k (fun c => v c * x c)
/-! ## Combining the equations -/
/-- S c = Σ_t (λ_t q_t c + μ_t r_t c), S' c = Σ_t (λ_t r_t c + μ_t q_t c). -/
def S (T : List Nat) (lam mu : Nat → Nat) (q r : Nat → Nat → Nat) (c : Nat) : Nat :=
lsum T (fun t => lam t * q t c + mu t * r t c)
theorem dot_lsum (k : Nat) (T : List Nat) (g : Nat → Nat → Nat) (x : Nat → Nat) :
dot k (fun c => lsum T (fun t => g t c)) x = lsum T (fun t => dot k (g t) x) := by
unfold dot
have e : ∀ c, lsum T (fun t => g t c) * x c = lsum T (fun t => g t c * x c) := by
intro c
induction T with
| nil => exact Nat.zero_mul _
| cons t T ih =>
show (g t c + lsum T (fun t => g t c)) * x c = g t c * x c + lsum T (fun t => g t c * x c)
rw [rdistrib, ih]
rw [sum_ext _ _ _ (fun c _ => e c)]
exact sum_swap k (fun t c => g t c * x c) T
theorem dot_add_scale (k a b : Nat) (u v x : Nat → Nat) :
dot k (fun c => a * u c + b * v c) x = a * dot k u x + b * dot k v x := by
unfold dot
have e : ∀ c, (a * u c + b * v c) * x c = a * (u c * x c) + b * (v c * x c) := by
intro c
rw [rdistrib, nmul_assoc, nmul_assoc]
rw [sum_ext _ _ _ (fun c _ => e c), sum_add, sum_scale, sum_scale]
/-- Each pair of weights preserves the symmetric form of the equations. -/
theorem combine (k : Nat) (q r : Nat → Nat → Nat) (x y lam mu : Nat → Nat) : ∀ T : List Nat,
(∀ t, t ∈ T → dot k (q t) x + dot k (r t) y = dot k (q t) y + dot k (r t) x) →
dot k (S T lam mu q r) x + dot k (S T lam mu r q) y = dot k (S T lam mu q r) y + dot k (S T lam mu r q) x
| [] => fun _ => by
show dot k (fun _ => 0) x + dot k (fun _ => 0) y = dot k (fun _ => 0) y + dot k (fun _ => 0) x
exact nadd_comm _ _
| t :: T => fun h => by
have ih := combine k q r x y lam mu T (fun t' ht' => h t' (List.Mem.tail t ht'))
have ht := h t (List.Mem.head T)
unfold S at ih ⊢
rw [dot_lsum, dot_lsum, dot_lsum, dot_lsum] at ih ⊢
show (dot k (fun c => lam t * q t c + mu t * r t c) x + lsum T (fun t => dot k (fun c => lam t * q t c + mu t * r t c) x))
+ (dot k (fun c => lam t * r t c + mu t * q t c) y + lsum T (fun t => dot k (fun c => lam t * r t c + mu t * q t c) y))
= (dot k (fun c => lam t * q t c + mu t * r t c) y + lsum T (fun t => dot k (fun c => lam t * q t c + mu t * r t c) y))
+ (dot k (fun c => lam t * r t c + mu t * q t c) x + lsum T (fun t => dot k (fun c => lam t * r t c + mu t * q t c) x))
rw [dot_add_scale, dot_add_scale, dot_add_scale, dot_add_scale]
-- local part: λ(qx + ry) + μ(rx + qy) = λ(qy + rx) + μ(ry + qx)
have loc : lam t * dot k (q t) x + mu t * dot k (r t) x + (lam t * dot k (r t) y + mu t * dot k (q t) y)
= lam t * dot k (q t) y + mu t * dot k (r t) y + (lam t * dot k (r t) x + mu t * dot k (q t) x) := by
have h1 : lam t * dot k (q t) x + lam t * dot k (r t) y = lam t * dot k (q t) y + lam t * dot k (r t) x := by
rw [← Nat.left_distrib, ← Nat.left_distrib, ht]
have h2 : mu t * dot k (r t) x + mu t * dot k (q t) y = mu t * dot k (r t) y + mu t * dot k (q t) x := by
rw [← Nat.left_distrib, ← Nat.left_distrib, nadd_comm (dot k (r t) x), ← ht, nadd_comm]
rw [mid4 (lam t * dot k (q t) x), h1, h2, ← mid4]
rw [mid4 _ (lsum T _), loc, ih, ← mid4]
where
mid4 (a b c d : Nat) : a + b + (c + d) = a + c + (b + d) := by
rw [nadd_assoc, ← nadd_assoc b, nadd_comm b c, nadd_assoc c, ← nadd_assoc a]
theorem cancel_l {a u v : Nat} : a + u = a + v → u = v := by
intro e
induction a with
| zero => rw [Nat.zero_add, Nat.zero_add] at e; exact e
| succ a ih =>
apply ih
rw [Nat.succ_add, Nat.succ_add] at e
exact Nat.succ.inj e
/-- If S = S' + D e_b (D > 0) and S·x + S'·y = S·y + S'·x, then x_b = y_b. -/
theorem extract (k b D : Nat) (hb : b < k) (hD : 0 < D) (s s' x y : Nat → Nat)
(hs : ∀ c, c < k → s c = s' c + ind b D c)
(h : dot k s x + dot k s' y = dot k s y + dot k s' x) : x b = y b := by
have ex : ∀ z : Nat → Nat, dot k s z = dot k s' z + D * z b := by
intro z
unfold dot
rw [sum_ext _ _ (fun c => s' c * z c + ind b D c * z c) (fun c hc => by rw [hs c hc, rdistrib]),
sum_add, sum_indicator b D z k hb]
rw [ex x, ex y] at h
-- s'x + Dx_b + s'y = s'y + Dy_b + s'x
have h' : dot k s' x + dot k s' y + D * x b = dot k s' x + dot k s' y + D * y b := by
rw [nadd_right_comm, h, nadd_right_comm (dot k s' y), nadd_comm (dot k s' y) (dot k s' x)]
exact Nat.eq_of_mul_eq_mul_left hD (cancel_l h')
/-! ## The instances -/
def nthD : List Int → Nat → Int
| [], _ => 0
| x :: _, 0 => x
| _ :: l, n + 1 => nthD l n
def pos (z : Int) : Nat := match z with
| Int.ofNat n => n
| Int.negSucc _ => 0
def negp (z : Int) : Nat := match z with
| Int.ofNat _ => 0
| Int.negSucc n => n + 1
def units (m : Nat) : List Nat := (List.range m).filter (fun t => Nat.beq (Nat.gcd t m) 1)
/-- q_t(c) = 2⟨t(c+1)⟩, r_t(c) = m (c = 0..k−1 stands for the residue c + 1). -/
def qm (m t c : Nat) : Nat := 2 * (t * (c + 1) % m)
def rm (m _ _ : Nat) : Nat := m
def allBelow (f : Nat → Bool) : Nat → Bool
| 0 => true
| k + 1 => allBelow f k && f k
def certOK (m k b D : Nat) (l : List Int) : Bool :=
allBelow (fun c =>
Nat.beq (S (units m) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (qm m) (rm m) c)
(S (units m) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (rm m) (qm m) c + ind b D c)) k
theorem and_left {a b : Bool} (h : (a && b) = true) : a = true := by
cases a with
| false => exact Bool.noConfusion h
| true => rfl
theorem and_right {a b : Bool} (h : (a && b) = true) : b = true := by
cases a with
| false => exact Bool.noConfusion h
| true => exact h
theorem all_range (f : Nat → Bool) : ∀ k, allBelow f k = true → ∀ c, c < k → f c = true
| 0, _, c, hc => absurd hc (Nat.not_lt_zero c)
| k + 1, h, c, hc => by
cases Nat.lt_or_eq_of_le (Nat.le_of_lt_succ hc) with
| inl hl => exact all_range f k (and_left h) c hl
| inr he => rw [he]; exact and_right h
theorem beq_eq {a b : Nat} (h : Nat.beq a b = true) : a = b := Nat.eq_of_beq_eq_true h
def Hodge (m k : Nat) (x y : Nat → Nat) : Prop :=
∀ t, t ∈ units m → dot k (qm m t) x + dot k (rm m t) y = dot k (qm m t) y + dot k (rm m t) x
/-- From one certificate: x_b = y_b. -/
theorem paired_one (m k b D : Nat) (l : List Int) (hb : b < k) (hD : 0 < D) (hc : certOK m k b D l = true)
(x y : Nat → Nat) (hE : Hodge m k x y) : x b = y b :=
extract k b D hb hD _ _ x y (fun c hcK => beq_eq (all_range _ k hc c hcK))
(combine k (qm m) (rm m) x y _ _ (units m) hE)
theorem paired_3 (x y : Nat → Nat) (h : Hodge 3 1 x y) : x 0 = y 0 :=
paired_one 3 1 0 1 [-1, 0] (Nat.lt_succ_self 0) (Nat.lt_succ_self 0) rfl x y h
theorem paired_5 (x y : Nat → Nat) (h : Hodge 5 2 x y) : x 0 = y 0 ∧ x 1 = y 1 :=
⟨paired_one 5 2 0 10 [-3, -1, 0, 0] (Nat.zero_lt_succ 1) (Nat.zero_lt_succ 9) rfl x y h,
paired_one 5 2 1 10 [-1, 3, 0, 0] (Nat.lt_succ_self 1) (Nat.zero_lt_succ 9) rfl x y h⟩
theorem cert7_0 : certOK 7 3 0 14 [-2, -1, -1, 0, 0, 0] = true := rfl
theorem cert7_1 : certOK 7 3 1 14 [-1, 1, 2, 0, 0, 0] = true := rfl
theorem cert7_2 : certOK 7 3 2 14 [-1, 2, -1, 0, 0, 0] = true := rfl
theorem paired_7 (x y : Nat → Nat) (h : Hodge 7 3 x y) :
x 0 = y 0 ∧ x 1 = y 1 ∧ x 2 = y 2 :=
⟨paired_one 7 3 0 14 [-2, -1, -1, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert7_0 x y h,
paired_one 7 3 1 14 [-1, 1, 2, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert7_1 x y h,
paired_one 7 3 2 14 [-1, 2, -1, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert7_2 x y h⟩
theorem cert11_0 : certOK 11 5 0 22 [-1, -1, -1, 0, -1, 0, 0, 0, 0, 0] = true := rfl
theorem cert11_1 : certOK 11 5 1 22 [-1, 0, 1, 1, 1, 0, 0, 0, 0, 0] = true := rfl
theorem cert11_2 : certOK 11 5 2 22 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem cert11_3 : certOK 11 5 3 22 [0, 1, -1, -1, 1, 0, 0, 0, 0, 0] = true := rfl
theorem cert11_4 : certOK 11 5 4 22 [-1, 1, 0, 1, -1, 0, 0, 0, 0, 0] = true := rfl
theorem paired_11 (x y : Nat → Nat) (h : Hodge 11 5 x y) :
x 0 = y 0 ∧ x 1 = y 1 ∧ x 2 = y 2 ∧ x 3 = y 3 ∧ x 4 = y 4 :=
⟨paired_one 11 5 0 22 [-1, -1, -1, 0, -1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert11_0 x y h,
paired_one 11 5 1 22 [-1, 0, 1, 1, 1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert11_1 x y h,
paired_one 11 5 2 22 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert11_2 x y h,
paired_one 11 5 3 22 [0, 1, -1, -1, 1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert11_3 x y h,
paired_one 11 5 4 22 [-1, 1, 0, 1, -1, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert11_4 x y h⟩
theorem cert13_0 : certOK 13 6 0 26 [-1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0] = true := rfl
theorem cert13_1 : certOK 13 6 1 26 [0, -1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem cert13_2 : certOK 13 6 2 26 [-1, 0, 1, 1, 0, -1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem cert13_3 : certOK 13 6 3 26 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
theorem cert13_4 : certOK 13 6 4 26 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem cert13_5 : certOK 13 6 5 26 [0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0] = true := rfl
theorem paired_13 (x y : Nat → Nat) (h : Hodge 13 6 x y) :
x 0 = y 0 ∧ x 1 = y 1 ∧ x 2 = y 2 ∧ x 3 = y 3 ∧ x 4 = y 4 ∧ x 5 = y 5 :=
⟨paired_one 13 6 0 26 [-1, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert13_0 x y h,
paired_one 13 6 1 26 [0, -1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert13_1 x y h,
paired_one 13 6 2 26 [-1, 0, 1, 1, 0, -1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert13_2 x y h,
paired_one 13 6 3 26 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert13_3 x y h,
paired_one 13 6 4 26 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert13_4 x y h,
paired_one 13 6 5 26 [0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) cert13_5 x y h⟩
end FermatPrime
#print axioms FermatPrime.rdistrib
#print axioms FermatPrime.sum_scale
#print axioms FermatPrime.sum_swap
#print axioms FermatPrime.sum_indicator
#print axioms FermatPrime.dot_lsum
#print axioms FermatPrime.dot_add_scale
#print axioms FermatPrime.combine
#print axioms FermatPrime.cancel_l
#print axioms FermatPrime.extract
#print axioms FermatPrime.and_left
#print axioms FermatPrime.and_right
#print axioms FermatPrime.all_range
#print axioms FermatPrime.beq_eq
#print axioms FermatPrime.paired_one
#print axioms FermatPrime.paired_3
#print axioms FermatPrime.paired_5
#print axioms FermatPrime.cert7_0
#print axioms FermatPrime.cert7_1
#print axioms FermatPrime.cert7_2
#print axioms FermatPrime.paired_7
#print axioms FermatPrime.cert11_0
#print axioms FermatPrime.cert11_1
#print axioms FermatPrime.cert11_2
#print axioms FermatPrime.cert11_3
#print axioms FermatPrime.cert11_4
#print axioms FermatPrime.paired_11
#print axioms FermatPrime.cert13_0
#print axioms FermatPrime.cert13_1
#print axioms FermatPrime.cert13_2
#print axioms FermatPrime.cert13_3
#print axioms FermatPrime.cert13_4
#print axioms FermatPrime.cert13_5
#print axioms FermatPrime.paired_13
lean_all/hodge/FermatPrimes2.lean
/-
hodge/FermatPrimes2.lean — T41 cycle 10: the linear part of Ran's theorem at the character level for
the primes 17 ≤ m ≤ 47, every dimension (FermatFull.pair_one with certificates found by exact
elimination, checked by rfl). Together with FermatFull: every prime m ≤ 47.
-/
import hodge.FermatFull
namespace FermatPrimes2
open FTAChain FrobChain FermatPrime FermatFull
set_option maxHeartbeats 0 in
theorem certF17_0 : certF 17 0 34 [0, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_1 : certF 17 1 34 [-1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_2 : certF 17 2 34 [-1, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_3 : certF 17 3 34 [0, 0, 1, 0, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_4 : certF 17 4 34 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_5 : certF 17 5 34 [0, 1, 0, -1, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_6 : certF 17 6 34 [-1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF17_7 : certF 17 7 34 [0, 0, -1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_17^n, every n: a Hodge character is paired. -/
theorem paired_char_17 (a : List Nat) (hin : AllIn 16 a) (h : HodgeList 17 a) :
cnt 1 a = cnt 16 a ∧ cnt 2 a = cnt 15 a ∧ cnt 3 a = cnt 14 a ∧ cnt 4 a = cnt 13 a ∧ cnt 5 a = cnt 12 a ∧ cnt 6 a = cnt 11 a ∧ cnt 7 a = cnt 10 a ∧ cnt 8 a = cnt 9 a :=
⟨pair_one 17 0 34 [0, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_0 a hin h,
pair_one 17 1 34 [-1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_1 a hin h,
pair_one 17 2 34 [-1, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_2 a hin h,
pair_one 17 3 34 [0, 0, 1, 0, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_3 a hin h,
pair_one 17 4 34 [-1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_4 a hin h,
pair_one 17 5 34 [0, 1, 0, -1, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_5 a hin h,
pair_one 17 6 34 [-1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_6 a hin h,
pair_one 17 7 34 [0, 0, -1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF17_7 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF19_0 : certF 19 0 38 [0, 0, -1, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_1 : certF 19 1 38 [0, -1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_2 : certF 19 2 38 [-1, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_3 : certF 19 3 38 [-1, 0, 1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_4 : certF 19 4 38 [-1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_5 : certF 19 5 38 [0, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_6 : certF 19 6 38 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_7 : certF 19 7 38 [0, 1, -1, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF19_8 : certF 19 8 38 [0, 0, 0, 0, -1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_19^n, every n: a Hodge character is paired. -/
theorem paired_char_19 (a : List Nat) (hin : AllIn 18 a) (h : HodgeList 19 a) :
cnt 1 a = cnt 18 a ∧ cnt 2 a = cnt 17 a ∧ cnt 3 a = cnt 16 a ∧ cnt 4 a = cnt 15 a ∧ cnt 5 a = cnt 14 a ∧ cnt 6 a = cnt 13 a ∧ cnt 7 a = cnt 12 a ∧ cnt 8 a = cnt 11 a ∧ cnt 9 a = cnt 10 a :=
⟨pair_one 19 0 38 [0, 0, -1, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_0 a hin h,
pair_one 19 1 38 [0, -1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_1 a hin h,
pair_one 19 2 38 [-1, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_2 a hin h,
pair_one 19 3 38 [-1, 0, 1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_3 a hin h,
pair_one 19 4 38 [-1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_4 a hin h,
pair_one 19 5 38 [0, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_5 a hin h,
pair_one 19 6 38 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_6 a hin h,
pair_one 19 7 38 [0, 1, -1, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_7 a hin h,
pair_one 19 8 38 [0, 0, 0, 0, -1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF19_8 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF23_0 : certF 23 0 138 [-1, -1, -1, -1, -2, -1, -2, -1, -1, 1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_1 : certF 23 1 138 [-1, -1, -1, -1, 1, 2, 1, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_2 : certF 23 2 138 [-1, -1, -1, 2, 1, 2, 1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_3 : certF 23 3 138 [-1, -1, 2, 2, 1, -1, -2, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_4 : certF 23 4 138 [-2, 1, 1, 1, -1, -2, 2, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_5 : certF 23 5 138 [-1, 2, 2, -1, -2, -1, 1, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_6 : certF 23 6 138 [-2, 1, 1, -2, 2, 1, -1, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_7 : certF 23 7 138 [-1, 2, -1, -1, 1, -1, 1, 2, -1, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_8 : certF 23 8 138 [-1, 2, -1, -1, 1, -1, 1, -1, 2, 1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_9 : certF 23 9 138 [1, 1, -2, 1, -1, 1, -1, -2, 1, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF23_10 : certF 23 10 138 [-2, 1, 1, 1, -1, 1, -1, 1, -2, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_23^n, every n: a Hodge character is paired. -/
theorem paired_char_23 (a : List Nat) (hin : AllIn 22 a) (h : HodgeList 23 a) :
cnt 1 a = cnt 22 a ∧ cnt 2 a = cnt 21 a ∧ cnt 3 a = cnt 20 a ∧ cnt 4 a = cnt 19 a ∧ cnt 5 a = cnt 18 a ∧ cnt 6 a = cnt 17 a ∧ cnt 7 a = cnt 16 a ∧ cnt 8 a = cnt 15 a ∧ cnt 9 a = cnt 14 a ∧ cnt 10 a = cnt 13 a ∧ cnt 11 a = cnt 12 a :=
⟨pair_one 23 0 138 [-1, -1, -1, -1, -2, -1, -2, -1, -1, 1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_0 a hin h,
pair_one 23 1 138 [-1, -1, -1, -1, 1, 2, 1, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_1 a hin h,
pair_one 23 2 138 [-1, -1, -1, 2, 1, 2, 1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_2 a hin h,
pair_one 23 3 138 [-1, -1, 2, 2, 1, -1, -2, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_3 a hin h,
pair_one 23 4 138 [-2, 1, 1, 1, -1, -2, 2, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_4 a hin h,
pair_one 23 5 138 [-1, 2, 2, -1, -2, -1, 1, -1, -1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_5 a hin h,
pair_one 23 6 138 [-2, 1, 1, -2, 2, 1, -1, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_6 a hin h,
pair_one 23 7 138 [-1, 2, -1, -1, 1, -1, 1, 2, -1, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_7 a hin h,
pair_one 23 8 138 [-1, 2, -1, -1, 1, -1, 1, -1, 2, 1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_8 a hin h,
pair_one 23 9 138 [1, 1, -2, 1, -1, 1, -1, -2, 1, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_9 a hin h,
pair_one 23 10 138 [-2, 1, 1, 1, -1, 1, -1, 1, -2, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF23_10 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF29_0 : certF 29 0 116 [0, -1, -1, 0, -1, 0, -1, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_1 : certF 29 1 116 [-1, 0, 0, -1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_2 : certF 29 2 116 [-1, 0, -1, 0, 0, 1, 1, 1, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_3 : certF 29 3 116 [0, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_4 : certF 29 4 116 [-1, 0, 0, 1, 0, 0, 0, -1, 1, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_5 : certF 29 5 116 [0, 0, 1, 1, 0, -1, -1, 0, 0, -1, -1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_6 : certF 29 6 116 [-1, 0, 1, 0, 0, -1, 1, 1, -1, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_7 : certF 29 7 116 [-1, 1, 1, -1, -1, 0, 1, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_8 : certF 29 8 116 [-1, 1, 1, -1, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_9 : certF 29 9 116 [0, 1, 0, -1, 1, -1, 0, 1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_10 : certF 29 10 116 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, -1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_11 : certF 29 11 116 [0, 1, -1, 0, -1, 0, 1, -1, 1, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_12 : certF 29 12 116 [-1, 1, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF29_13 : certF 29 13 116 [0, 0, -1, 1, 0, 1, -1, 0, 0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_29^n, every n: a Hodge character is paired. -/
theorem paired_char_29 (a : List Nat) (hin : AllIn 28 a) (h : HodgeList 29 a) :
cnt 1 a = cnt 28 a ∧ cnt 2 a = cnt 27 a ∧ cnt 3 a = cnt 26 a ∧ cnt 4 a = cnt 25 a ∧ cnt 5 a = cnt 24 a ∧ cnt 6 a = cnt 23 a ∧ cnt 7 a = cnt 22 a ∧ cnt 8 a = cnt 21 a ∧ cnt 9 a = cnt 20 a ∧ cnt 10 a = cnt 19 a ∧ cnt 11 a = cnt 18 a ∧ cnt 12 a = cnt 17 a ∧ cnt 13 a = cnt 16 a ∧ cnt 14 a = cnt 15 a :=
⟨pair_one 29 0 116 [0, -1, -1, 0, -1, 0, -1, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_0 a hin h,
pair_one 29 1 116 [-1, 0, 0, -1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_1 a hin h,
pair_one 29 2 116 [-1, 0, -1, 0, 0, 1, 1, 1, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_2 a hin h,
pair_one 29 3 116 [0, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_3 a hin h,
pair_one 29 4 116 [-1, 0, 0, 1, 0, 0, 0, -1, 1, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_4 a hin h,
pair_one 29 5 116 [0, 0, 1, 1, 0, -1, -1, 0, 0, -1, -1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_5 a hin h,
pair_one 29 6 116 [-1, 0, 1, 0, 0, -1, 1, 1, -1, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_6 a hin h,
pair_one 29 7 116 [-1, 1, 1, -1, -1, 0, 1, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_7 a hin h,
pair_one 29 8 116 [-1, 1, 1, -1, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_8 a hin h,
pair_one 29 9 116 [0, 1, 0, -1, 1, -1, 0, 1, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_9 a hin h,
pair_one 29 10 116 [-1, 1, 0, 0, 1, -1, 0, 0, 0, 0, -1, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_10 a hin h,
pair_one 29 11 116 [0, 1, -1, 0, -1, 0, 1, -1, 1, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_11 a hin h,
pair_one 29 12 116 [-1, 1, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_12 a hin h,
pair_one 29 13 116 [0, 0, -1, 1, 0, 1, -1, 0, 0, 1, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF29_13 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF31_0 : certF 31 0 558 [-1, -1, -2, -1, -4, -2, -7, -1, -4, -4, -5, -2, -5, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_1 : certF 31 1 558 [-1, -1, -2, -1, -4, -2, 2, -1, 5, 5, 4, 7, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_2 : certF 31 2 558 [-2, -2, -4, -2, 1, 5, 4, 7, 1, 1, -1, -4, -1, -5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_3 : certF 31 3 558 [-1, -1, -2, -1, 5, 7, 2, -1, -4, -4, -5, -2, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_4 : certF 31 4 558 [-4, -4, 1, 5, 2, 1, -1, -4, 2, 2, 7, 1, -2, -1, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_5 : certF 31 5 558 [-2, -2, 5, 7, 1, -4, -5, -2, 1, 1, -1, -4, -1, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_6 : certF 31 6 558 [-7, 2, 4, 2, -1, -5, 5, 2, -1, -1, 1, 4, 1, -4, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_7 : certF 31 7 558 [-1, -1, 7, -1, -4, -2, 2, -1, -4, 5, 4, -2, -5, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_8 : certF 31 8 558 [-4, 5, 1, -4, 2, 1, -1, -4, 2, 2, -2, 1, 7, -1, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_9 : certF 31 9 558 [-4, 5, 1, -4, 2, 1, -1, 5, 2, -7, -2, 1, -2, -1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_10 : certF 31 10 558 [-5, 4, -1, -5, 7, -1, 1, 4, -2, -2, 2, -1, 2, 1, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_11 : certF 31 11 558 [-2, 7, -4, -2, 1, -4, 4, -2, 1, 1, -1, 5, -1, -5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_12 : certF 31 12 558 [-5, 4, -1, 4, -2, -1, 1, -5, 7, -2, 2, -1, 2, 1, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_13 : certF 31 13 558 [2, 2, -5, 2, -1, 4, -4, 2, -1, -1, 1, -5, 1, -4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF31_14 : certF 31 14 558 [1, 1, 2, 1, -5, 2, -2, 1, -5, 4, -4, 2, -4, 7, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_31^n, every n: a Hodge character is paired. -/
theorem paired_char_31 (a : List Nat) (hin : AllIn 30 a) (h : HodgeList 31 a) :
cnt 1 a = cnt 30 a ∧ cnt 2 a = cnt 29 a ∧ cnt 3 a = cnt 28 a ∧ cnt 4 a = cnt 27 a ∧ cnt 5 a = cnt 26 a ∧ cnt 6 a = cnt 25 a ∧ cnt 7 a = cnt 24 a ∧ cnt 8 a = cnt 23 a ∧ cnt 9 a = cnt 22 a ∧ cnt 10 a = cnt 21 a ∧ cnt 11 a = cnt 20 a ∧ cnt 12 a = cnt 19 a ∧ cnt 13 a = cnt 18 a ∧ cnt 14 a = cnt 17 a ∧ cnt 15 a = cnt 16 a :=
⟨pair_one 31 0 558 [-1, -1, -2, -1, -4, -2, -7, -1, -4, -4, -5, -2, -5, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_0 a hin h,
pair_one 31 1 558 [-1, -1, -2, -1, -4, -2, 2, -1, 5, 5, 4, 7, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_1 a hin h,
pair_one 31 2 558 [-2, -2, -4, -2, 1, 5, 4, 7, 1, 1, -1, -4, -1, -5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_2 a hin h,
pair_one 31 3 558 [-1, -1, -2, -1, 5, 7, 2, -1, -4, -4, -5, -2, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_3 a hin h,
pair_one 31 4 558 [-4, -4, 1, 5, 2, 1, -1, -4, 2, 2, 7, 1, -2, -1, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_4 a hin h,
pair_one 31 5 558 [-2, -2, 5, 7, 1, -4, -5, -2, 1, 1, -1, -4, -1, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_5 a hin h,
pair_one 31 6 558 [-7, 2, 4, 2, -1, -5, 5, 2, -1, -1, 1, 4, 1, -4, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_6 a hin h,
pair_one 31 7 558 [-1, -1, 7, -1, -4, -2, 2, -1, -4, 5, 4, -2, -5, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_7 a hin h,
pair_one 31 8 558 [-4, 5, 1, -4, 2, 1, -1, -4, 2, 2, -2, 1, 7, -1, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_8 a hin h,
pair_one 31 9 558 [-4, 5, 1, -4, 2, 1, -1, 5, 2, -7, -2, 1, -2, -1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_9 a hin h,
pair_one 31 10 558 [-5, 4, -1, -5, 7, -1, 1, 4, -2, -2, 2, -1, 2, 1, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_10 a hin h,
pair_one 31 11 558 [-2, 7, -4, -2, 1, -4, 4, -2, 1, 1, -1, 5, -1, -5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_11 a hin h,
pair_one 31 12 558 [-5, 4, -1, 4, -2, -1, 1, -5, 7, -2, 2, -1, 2, 1, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_12 a hin h,
pair_one 31 13 558 [2, 2, -5, 2, -1, 4, -4, 2, -1, -1, 1, -5, 1, -4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_13 a hin h,
pair_one 31 14 558 [1, 1, 2, 1, -5, 2, -2, 1, -5, 4, -4, 2, -4, 7, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF31_14 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF37_0 : certF 37 0 2738 [-5, 1, -2, -15, -9, -7, -17, 3, -23, -13, -18, -6, -16, -4, -11, -8, -10, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_1 : certF 37 1 2738 [1, -15, -7, 3, -13, -6, -4, -8, 12, 10, 11, 16, 18, 23, 17, 9, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_2 : certF 37 2 2738 [-2, -7, -23, -6, -11, 12, 8, 16, 13, 17, 15, 5, 1, -9, 3, -18, -4, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_3 : certF 37 3 2738 [-15, 3, -6, -8, 10, 16, 23, 9, 5, -2, -17, -18, -11, -12, 4, 13, 7, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_4 : certF 37 4 2738 [-9, -13, -11, 10, 6, 17, -1, -2, 3, -16, 12, 4, 23, 15, -5, -7, -18, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_5 : certF 37 5 2738 [-7, -6, 12, 16, 17, 5, -9, -18, -10, 4, -3, -1, -15, -13, -8, 11, 23, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_6 : certF 37 6 2738 [-17, -4, 8, 23, -1, -9, -6, -12, 18, 15, -2, -13, -10, 16, 7, -5, 3, -11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_7 : certF 37 7 2738 [3, -8, 16, 9, -2, -18, -12, 13, -1, -7, -4, 11, 17, -5, -23, -10, 6, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_8 : certF 37 8 2738 [-23, 12, 13, 5, 3, -10, 18, -1, -17, -8, 6, 2, -7, -11, 16, 15, -9, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_9 : certF 37 9 2738 [-13, 10, 17, -2, -16, 4, 15, -7, -8, 18, 5, -23, -12, -3, 1, -6, 11, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_10 : certF 37 10 2738 [-18, 11, 15, -17, 12, -3, -2, -4, 6, 5, -13, 8, 9, -7, -10, 23, 1, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_11 : certF 37 11 2738 [-6, 16, 5, -18, 4, -1, -13, 11, 2, -23, 8, 15, 3, 10, 9, -17, -12, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_12 : certF 37 12 2738 [-16, 18, 1, -11, 23, -15, -10, 17, -7, -12, 9, 3, 8, 2, -13, 4, 5, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_13 : certF 37 13 2738 [-4, 23, -9, -12, 15, -13, 16, -5, -11, -3, -7, 10, 2, -18, 6, 1, -8, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_14 : certF 37 14 2738 [-11, 17, 3, 4, -5, -8, 7, -23, 16, 1, -10, 9, -13, 6, -2, 12, 15, -18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_15 : certF 37 15 2738 [-8, 9, -18, 13, -7, 11, -5, -10, 15, -6, 23, -17, 4, 1, 12, 2, -16, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_16 : certF 37 16 2738 [-10, 2, -4, 7, -18, 23, 3, 6, -9, 11, 1, -12, 5, -8, 15, -16, 17, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF37_17 : certF 37 17 2738 [12, 5, -10, -1, -8, 2, -11, 15, -4, 9, -16, 7, -6, 17, -18, -3, -13, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_37^n, every n: a Hodge character is paired. -/
theorem paired_char_37 (a : List Nat) (hin : AllIn 36 a) (h : HodgeList 37 a) :
cnt 1 a = cnt 36 a ∧ cnt 2 a = cnt 35 a ∧ cnt 3 a = cnt 34 a ∧ cnt 4 a = cnt 33 a ∧ cnt 5 a = cnt 32 a ∧ cnt 6 a = cnt 31 a ∧ cnt 7 a = cnt 30 a ∧ cnt 8 a = cnt 29 a ∧ cnt 9 a = cnt 28 a ∧ cnt 10 a = cnt 27 a ∧ cnt 11 a = cnt 26 a ∧ cnt 12 a = cnt 25 a ∧ cnt 13 a = cnt 24 a ∧ cnt 14 a = cnt 23 a ∧ cnt 15 a = cnt 22 a ∧ cnt 16 a = cnt 21 a ∧ cnt 17 a = cnt 20 a ∧ cnt 18 a = cnt 19 a :=
⟨pair_one 37 0 2738 [-5, 1, -2, -15, -9, -7, -17, 3, -23, -13, -18, -6, -16, -4, -11, -8, -10, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_0 a hin h,
pair_one 37 1 2738 [1, -15, -7, 3, -13, -6, -4, -8, 12, 10, 11, 16, 18, 23, 17, 9, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_1 a hin h,
pair_one 37 2 2738 [-2, -7, -23, -6, -11, 12, 8, 16, 13, 17, 15, 5, 1, -9, 3, -18, -4, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_2 a hin h,
pair_one 37 3 2738 [-15, 3, -6, -8, 10, 16, 23, 9, 5, -2, -17, -18, -11, -12, 4, 13, 7, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_3 a hin h,
pair_one 37 4 2738 [-9, -13, -11, 10, 6, 17, -1, -2, 3, -16, 12, 4, 23, 15, -5, -7, -18, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_4 a hin h,
pair_one 37 5 2738 [-7, -6, 12, 16, 17, 5, -9, -18, -10, 4, -3, -1, -15, -13, -8, 11, 23, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_5 a hin h,
pair_one 37 6 2738 [-17, -4, 8, 23, -1, -9, -6, -12, 18, 15, -2, -13, -10, 16, 7, -5, 3, -11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_6 a hin h,
pair_one 37 7 2738 [3, -8, 16, 9, -2, -18, -12, 13, -1, -7, -4, 11, 17, -5, -23, -10, 6, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_7 a hin h,
pair_one 37 8 2738 [-23, 12, 13, 5, 3, -10, 18, -1, -17, -8, 6, 2, -7, -11, 16, 15, -9, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_8 a hin h,
pair_one 37 9 2738 [-13, 10, 17, -2, -16, 4, 15, -7, -8, 18, 5, -23, -12, -3, 1, -6, 11, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_9 a hin h,
pair_one 37 10 2738 [-18, 11, 15, -17, 12, -3, -2, -4, 6, 5, -13, 8, 9, -7, -10, 23, 1, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_10 a hin h,
pair_one 37 11 2738 [-6, 16, 5, -18, 4, -1, -13, 11, 2, -23, 8, 15, 3, 10, 9, -17, -12, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_11 a hin h,
pair_one 37 12 2738 [-16, 18, 1, -11, 23, -15, -10, 17, -7, -12, 9, 3, 8, 2, -13, 4, 5, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_12 a hin h,
pair_one 37 13 2738 [-4, 23, -9, -12, 15, -13, 16, -5, -11, -3, -7, 10, 2, -18, 6, 1, -8, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_13 a hin h,
pair_one 37 14 2738 [-11, 17, 3, 4, -5, -8, 7, -23, 16, 1, -10, 9, -13, 6, -2, 12, 15, -18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_14 a hin h,
pair_one 37 15 2738 [-8, 9, -18, 13, -7, 11, -5, -10, 15, -6, 23, -17, 4, 1, 12, 2, -16, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_15 a hin h,
pair_one 37 16 2738 [-10, 2, -4, 7, -18, 23, 3, 6, -9, 11, 1, -12, 5, -8, 15, -16, 17, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_16 a hin h,
pair_one 37 17 2738 [12, 5, -10, -1, -8, 2, -11, 15, -4, 9, -16, 7, -6, 17, -18, -3, -13, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF37_17 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF41_0 : certF 41 0 902 [0, -2, -1, 0, -5, -3, -4, -4, -3, 0, -6, -2, -3, -1, -2, 0, -5, 0, -4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_1 : certF 41 1 902 [-2, 0, -3, -4, 0, -2, -1, 0, 0, 1, 4, 5, 2, 3, 6, 3, 4, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_2 : certF 41 2 902 [-1, -3, -3, -2, -2, 0, -1, 5, 1, 6, 4, 5, 2, 0, 0, -4, 0, -3, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_3 : certF 41 3 902 [0, -4, -2, 0, 1, 5, 3, 3, 5, 0, -1, -4, -6, -2, -4, 0, 1, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_4 : certF 41 4 902 [-5, 0, -2, 1, 0, 6, 3, 0, 0, -3, -1, -4, 5, 2, 4, 2, -1, -4, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_5 : certF 41 5 902 [-3, -2, 0, 5, 6, 5, 0, -4, -3, -4, 0, 0, 0, -2, -4, -1, 1, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_6 : certF 41 6 902 [-4, -1, -1, 3, 3, 0, -4, -2, 4, 2, 5, -2, -3, 0, 0, 6, 0, -1, 0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_7 : certF 41 7 902 [-4, 0, 5, 3, 0, -4, -2, 0, 0, 2, -3, -1, 4, 6, 1, -5, -3, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_8 : certF 41 8 902 [-3, 0, 1, 5, 0, -3, 4, 0, 0, -4, -5, 2, 3, -1, -2, -1, 6, 2, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_9 : certF 41 9 902 [0, 1, 6, 0, -3, -4, 2, 2, -4, 0, 3, 1, -4, -5, 1, 0, -3, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_10 : certF 41 10 902 [-6, 4, 4, -1, -1, 0, 5, -3, -5, 3, 2, -3, 1, 0, 0, -2, 0, 4, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_11 : certF 41 11 902 [-2, 5, 5, -4, -4, 0, -2, -1, 2, 1, -3, -1, 4, 0, 0, 3, 0, -6, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_12 : certF 41 12 902 [-3, 2, 2, -6, 5, 0, -3, 4, 3, -4, 1, 4, -5, 0, 0, -1, 0, 2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_13 : certF 41 13 902 [-1, 3, 0, -2, 2, -2, 0, 6, -1, -5, 0, 0, 0, 3, -5, -4, 4, -3, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_14 : certF 41 14 902 [-2, 6, 0, -4, 4, -4, 0, 1, -2, 1, 0, 0, 0, -5, 1, 3, -3, 5, 2, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_15 : certF 41 15 902 [0, 3, -4, 0, 2, -1, 6, -5, -1, 0, -2, 3, -1, -4, 3, 0, 2, 0, -5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_16 : certF 41 16 902 [-5, 4, 0, 1, -1, 1, 0, -3, 6, -3, 0, 0, 0, 4, -3, 2, -2, -4, 5, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_17 : certF 41 17 902 [0, 5, -3, 0, -4, 2, -1, -1, 2, 0, 4, -6, 2, -3, 5, 0, -4, 0, -1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_18 : certF 41 18 902 [-4, 1, 0, 3, -3, 3, 0, 2, -4, 2, 0, 0, 0, 1, 2, -5, 5, -1, 4, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF41_19 : certF 41 19 902 [1, 0, -4, 2, 0, 1, -5, 0, 0, 5, -2, 3, -1, 4, -3, 4, -2, 3, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_41^n, every n: a Hodge character is paired. -/
theorem paired_char_41 (a : List Nat) (hin : AllIn 40 a) (h : HodgeList 41 a) :
cnt 1 a = cnt 40 a ∧ cnt 2 a = cnt 39 a ∧ cnt 3 a = cnt 38 a ∧ cnt 4 a = cnt 37 a ∧ cnt 5 a = cnt 36 a ∧ cnt 6 a = cnt 35 a ∧ cnt 7 a = cnt 34 a ∧ cnt 8 a = cnt 33 a ∧ cnt 9 a = cnt 32 a ∧ cnt 10 a = cnt 31 a ∧ cnt 11 a = cnt 30 a ∧ cnt 12 a = cnt 29 a ∧ cnt 13 a = cnt 28 a ∧ cnt 14 a = cnt 27 a ∧ cnt 15 a = cnt 26 a ∧ cnt 16 a = cnt 25 a ∧ cnt 17 a = cnt 24 a ∧ cnt 18 a = cnt 23 a ∧ cnt 19 a -- (+35 chars; full line in the Zenodo source)
⟨pair_one 41 0 902 [0, -2, -1, 0, -5, -3, -4, -4, -3, 0, -6, -2, -3, -1, -2, 0, -5, 0, -4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_0 a hin h,
pair_one 41 1 902 [-2, 0, -3, -4, 0, -2, -1, 0, 0, 1, 4, 5, 2, 3, 6, 3, 4, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_1 a hin h,
pair_one 41 2 902 [-1, -3, -3, -2, -2, 0, -1, 5, 1, 6, 4, 5, 2, 0, 0, -4, 0, -3, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_2 a hin h,
pair_one 41 3 902 [0, -4, -2, 0, 1, 5, 3, 3, 5, 0, -1, -4, -6, -2, -4, 0, 1, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_3 a hin h,
pair_one 41 4 902 [-5, 0, -2, 1, 0, 6, 3, 0, 0, -3, -1, -4, 5, 2, 4, 2, -1, -4, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_4 a hin h,
pair_one 41 5 902 [-3, -2, 0, 5, 6, 5, 0, -4, -3, -4, 0, 0, 0, -2, -4, -1, 1, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_5 a hin h,
pair_one 41 6 902 [-4, -1, -1, 3, 3, 0, -4, -2, 4, 2, 5, -2, -3, 0, 0, 6, 0, -1, 0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_6 a hin h,
pair_one 41 7 902 [-4, 0, 5, 3, 0, -4, -2, 0, 0, 2, -3, -1, 4, 6, 1, -5, -3, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_7 a hin h,
pair_one 41 8 902 [-3, 0, 1, 5, 0, -3, 4, 0, 0, -4, -5, 2, 3, -1, -2, -1, 6, 2, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_8 a hin h,
pair_one 41 9 902 [0, 1, 6, 0, -3, -4, 2, 2, -4, 0, 3, 1, -4, -5, 1, 0, -3, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_9 a hin h,
pair_one 41 10 902 [-6, 4, 4, -1, -1, 0, 5, -3, -5, 3, 2, -3, 1, 0, 0, -2, 0, 4, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_10 a hin h,
pair_one 41 11 902 [-2, 5, 5, -4, -4, 0, -2, -1, 2, 1, -3, -1, 4, 0, 0, 3, 0, -6, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_11 a hin h,
pair_one 41 12 902 [-3, 2, 2, -6, 5, 0, -3, 4, 3, -4, 1, 4, -5, 0, 0, -1, 0, 2, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_12 a hin h,
pair_one 41 13 902 [-1, 3, 0, -2, 2, -2, 0, 6, -1, -5, 0, 0, 0, 3, -5, -4, 4, -3, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_13 a hin h,
pair_one 41 14 902 [-2, 6, 0, -4, 4, -4, 0, 1, -2, 1, 0, 0, 0, -5, 1, 3, -3, 5, 2, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_14 a hin h,
pair_one 41 15 902 [0, 3, -4, 0, 2, -1, 6, -5, -1, 0, -2, 3, -1, -4, 3, 0, 2, 0, -5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_15 a hin h,
pair_one 41 16 902 [-5, 4, 0, 1, -1, 1, 0, -3, 6, -3, 0, 0, 0, 4, -3, 2, -2, -4, 5, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_16 a hin h,
pair_one 41 17 902 [0, 5, -3, 0, -4, 2, -1, -1, 2, 0, 4, -6, 2, -3, 5, 0, -4, 0, -1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_17 a hin h,
pair_one 41 18 902 [-4, 1, 0, 3, -3, 3, 0, 2, -4, 2, 0, 0, 0, 1, 2, -5, 5, -1, 4, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_18 a hin h,
pair_one 41 19 902 [1, 0, -4, 2, 0, 1, -5, 0, 0, 5, -2, 3, -1, 4, -3, 4, -2, 3, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF41_19 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF43_0 : certF 43 0 18146 [-26, 15, -43, -33, -34, -32, -58, -54, -63, -94, -110, -14, -88, 1, -40, -50, -67, 12, -73, 38, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_1 : certF 43 1 18146 [15, -33, -32, -54, -94, -14, 1, -50, 12, 38, 31, 73, 67, 40, 88, 110, 63, 58, 34, 43, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_2 : certF 43 2 18146 [-43, -32, -63, -14, -40, 12, -31, 73, 50, 88, 94, 58, 33, 26, 15, -34, -54, -110, 1, -67, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_3 : certF 43 3 18146 [-33, -54, -14, -50, 38, 73, 40, 110, 58, 43, -26, -34, -63, -88, -67, -31, -12, -1, 94, 32, -15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_4 : certF 43 4 18146 [-34, -94, -40, 38, -12, 88, 54, 43, 15, -58, -14, -67, 31, 50, 110, 32, 26, -33, -63, 1, -73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_5 : certF 43 5 18146 [-32, -14, 12, 73, 88, 58, 26, -34, -110, -67, -38, -1, 54, -15, -33, -94, -50, 31, 40, 63, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_6 : certF 43 6 18146 [-58, 1, -31, 40, 54, 26, -32, -88, 38, 50, 63, -15, -34, -14, -73, 67, 94, 43, -33, -110, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_7 : certF 43 7 18146 [-54, -50, 73, 110, 43, -34, -88, -31, -1, 32, 15, -94, 12, 67, 63, 26, -58, -40, -38, 14, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_8 : certF 43 8 18146 [-63, 12, 50, 58, 15, -110, 38, -1, 34, -33, -88, 31, 14, 43, -32, -40, 73, 94, 26, -54, -67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_9 : certF 43 9 18146 [-94, 38, 88, 43, -58, -67, 50, 32, -33, 1, 73, 63, -26, -110, -31, 14, -15, -54, 12, 40, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_10 : certF 43 10 18146 [-110, 31, 94, -26, -14, -38, 63, 15, -88, 73, 54, -43, 1, -12, 58, -33, -40, 67, 32, -34, -50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_11 : certF 43 11 18146 [-14, 73, 58, -34, -67, -1, -15, -94, 31, 63, -43, -40, 50, 33, -54, 38, 110, -26, -88, -12, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_12 : certF 43 12 18146 [-88, 67, 33, -63, 31, 54, -34, 12, 14, -26, 1, 50, 43, -94, -38, 58, -32, -73, 110, 15, -40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_13 : certF 43 13 18146 [1, 40, 26, -88, 50, -15, -14, 67, 43, -110, -12, 33, -94, 73, 34, -63, -38, 32, -54, 31, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_14 : certF 43 14 18146 [-40, 88, 15, -67, 110, -33, -73, 63, -32, -31, 58, -54, -38, 34, -94, -12, 43, -14, 50, 26, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_15 : certF 43 15 18146 [-50, 110, -34, -31, 32, -94, 67, 26, -40, 14, -33, 38, 58, -63, -12, -15, 1, 88, -43, -73, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_16 : certF 43 16 18146 [-67, 63, -54, -12, 26, -50, 94, -58, 73, -15, -40, 110, -32, -38, 43, 1, 14, -34, 31, 33, -88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_17 : certF 43 17 18146 [12, 58, -110, -1, -33, 31, 43, -40, 94, -54, 67, -26, -73, 32, -14, 88, -34, -38, -15, -50, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_18 : certF 43 18 18146 [-73, 34, 1, 94, -63, 40, -33, -38, 26, 12, 32, -88, 110, -54, 50, -43, 31, -15, -67, 58, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_19 : certF 43 19 18146 [38, 43, -67, 32, 1, 63, -110, 14, -54, 40, -34, -12, 15, 31, 26, -73, 33, -50, 58, -88, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF43_20 : certF 43 20 18146 [-31, 26, 38, -15, -73, 43, 12, 33, -67, 34, -50, 32, -40, 58, 1, 54, -88, 63, -14, 94, -110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_43^n, every n: a Hodge character is paired. -/
theorem paired_char_43 (a : List Nat) (hin : AllIn 42 a) (h : HodgeList 43 a) :
cnt 1 a = cnt 42 a ∧ cnt 2 a = cnt 41 a ∧ cnt 3 a = cnt 40 a ∧ cnt 4 a = cnt 39 a ∧ cnt 5 a = cnt 38 a ∧ cnt 6 a = cnt 37 a ∧ cnt 7 a = cnt 36 a ∧ cnt 8 a = cnt 35 a ∧ cnt 9 a = cnt 34 a ∧ cnt 10 a = cnt 33 a ∧ cnt 11 a = cnt 32 a ∧ cnt 12 a = cnt 31 a ∧ cnt 13 a = cnt 30 a ∧ cnt 14 a = cnt 29 a ∧ cnt 15 a = cnt 28 a ∧ cnt 16 a = cnt 27 a ∧ cnt 17 a = cnt 26 a ∧ cnt 18 a = cnt 25 a ∧ cnt 19 a -- (+57 chars; full line in the Zenodo source)
⟨pair_one 43 0 18146 [-26, 15, -43, -33, -34, -32, -58, -54, -63, -94, -110, -14, -88, 1, -40, -50, -67, 12, -73, 38, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_0 a hin h,
pair_one 43 1 18146 [15, -33, -32, -54, -94, -14, 1, -50, 12, 38, 31, 73, 67, 40, 88, 110, 63, 58, 34, 43, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_1 a hin h,
pair_one 43 2 18146 [-43, -32, -63, -14, -40, 12, -31, 73, 50, 88, 94, 58, 33, 26, 15, -34, -54, -110, 1, -67, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_2 a hin h,
pair_one 43 3 18146 [-33, -54, -14, -50, 38, 73, 40, 110, 58, 43, -26, -34, -63, -88, -67, -31, -12, -1, 94, 32, -15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_3 a hin h,
pair_one 43 4 18146 [-34, -94, -40, 38, -12, 88, 54, 43, 15, -58, -14, -67, 31, 50, 110, 32, 26, -33, -63, 1, -73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_4 a hin h,
pair_one 43 5 18146 [-32, -14, 12, 73, 88, 58, 26, -34, -110, -67, -38, -1, 54, -15, -33, -94, -50, 31, 40, 63, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_5 a hin h,
pair_one 43 6 18146 [-58, 1, -31, 40, 54, 26, -32, -88, 38, 50, 63, -15, -34, -14, -73, 67, 94, 43, -33, -110, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_6 a hin h,
pair_one 43 7 18146 [-54, -50, 73, 110, 43, -34, -88, -31, -1, 32, 15, -94, 12, 67, 63, 26, -58, -40, -38, 14, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_7 a hin h,
pair_one 43 8 18146 [-63, 12, 50, 58, 15, -110, 38, -1, 34, -33, -88, 31, 14, 43, -32, -40, 73, 94, 26, -54, -67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_8 a hin h,
pair_one 43 9 18146 [-94, 38, 88, 43, -58, -67, 50, 32, -33, 1, 73, 63, -26, -110, -31, 14, -15, -54, 12, 40, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_9 a hin h,
pair_one 43 10 18146 [-110, 31, 94, -26, -14, -38, 63, 15, -88, 73, 54, -43, 1, -12, 58, -33, -40, 67, 32, -34, -50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_10 a hin h,
pair_one 43 11 18146 [-14, 73, 58, -34, -67, -1, -15, -94, 31, 63, -43, -40, 50, 33, -54, 38, 110, -26, -88, -12, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_11 a hin h,
pair_one 43 12 18146 [-88, 67, 33, -63, 31, 54, -34, 12, 14, -26, 1, 50, 43, -94, -38, 58, -32, -73, 110, 15, -40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_12 a hin h,
pair_one 43 13 18146 [1, 40, 26, -88, 50, -15, -14, 67, 43, -110, -12, 33, -94, 73, 34, -63, -38, 32, -54, 31, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_13 a hin h,
pair_one 43 14 18146 [-40, 88, 15, -67, 110, -33, -73, 63, -32, -31, 58, -54, -38, 34, -94, -12, 43, -14, 50, 26, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_14 a hin h,
pair_one 43 15 18146 [-50, 110, -34, -31, 32, -94, 67, 26, -40, 14, -33, 38, 58, -63, -12, -15, 1, 88, -43, -73, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_15 a hin h,
pair_one 43 16 18146 [-67, 63, -54, -12, 26, -50, 94, -58, 73, -15, -40, 110, -32, -38, 43, 1, 14, -34, 31, 33, -88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_16 a hin h,
pair_one 43 17 18146 [12, 58, -110, -1, -33, 31, 43, -40, 94, -54, 67, -26, -73, 32, -14, 88, -34, -38, -15, -50, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_17 a hin h,
pair_one 43 18 18146 [-73, 34, 1, 94, -63, 40, -33, -38, 26, 12, 32, -88, 110, -54, 50, -43, 31, -15, -67, 58, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_18 a hin h,
pair_one 43 19 18146 [38, 43, -67, 32, 1, 63, -110, 14, -54, 40, -34, -12, 15, 31, 26, -73, 33, -50, 58, -88, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_19 a hin h,
pair_one 43 20 18146 [-31, 26, 38, -15, -73, 43, 12, 33, -67, 34, -50, 32, -40, 58, 1, 54, -88, 63, -14, 94, -110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF43_20 a hin h⟩
set_option maxHeartbeats 0 in
theorem certF47_0 : certF 47 0 65330 [-1, -91, -116, 59, -199, -131, -216, -191, -251, -39, -214, -106, -244, -196, -149, -6, -341, 94, -234, -74, -36, -14, -84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_1 : certF 47 1 65330 [-91, 59, -131, -191, -39, -106, -196, -6, 94, -74, -14, 84, 36, 234, 341, 149, 244, 214, 251, 216, 199, 116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_2 : certF 47 2 65330 [-116, -131, -251, -106, -149, 94, -36, 84, 74, 341, 196, 214, 191, 199, 91, -1, 59, -216, -39, -244, -6, -234, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_3 : certF 47 3 65330 [59, -191, -106, -6, -74, 84, 234, 149, 214, 216, 116, -1, -199, -251, -244, -341, -36, 14, -94, 196, 39, 131, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_4 : certF 47 4 65330 [-199, -39, -149, -74, 14, 341, 106, 216, 91, -116, -191, -244, 94, -84, 234, 196, 251, -59, -1, -131, -214, -6, -36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_5 : certF 47 5 65330 [-131, -106, 94, 84, 341, 214, 199, -1, -216, -244, -234, 14, 6, 39, -59, -91, -191, -196, -74, 36, 149, 251, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_6 : certF 47 6 65330 [-216, -196, -36, 234, 106, 199, -91, -251, -6, -84, 341, 39, 116, 59, -214, 94, 14, 149, 191, 1, -131, -244, -74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_7 : certF 47 7 65330 [-191, -6, 84, 149, 216, -1, -251, -341, 14, 196, 131, -91, -39, 94, 36, 244, 199, -116, -214, -234, 74, 106, -59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_8 : certF 47 8 65330 [-251, 94, 74, 214, 91, -216, -6, 14, 244, -59, -199, -196, -84, 149, 131, -116, -106, -36, 341, 191, -1, -39, -234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_9 : certF 47 9 65330 [-39, -74, 341, 216, -116, -244, -84, 196, -59, -131, -6, 36, 214, 1, -251, -234, -94, 191, -91, -106, -14, 149, 199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_10 : certF 47 10 65330 [-214, -14, 196, 116, -191, -234, 341, 131, -199, -6, 74, 251, -91, -244, 84, 106, 1, -39, -36, 149, -59, -216, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_11 : certF 47 11 65330 [-106, 84, 214, -1, -244, 14, 39, -91, -196, 36, 251, -116, -149, 74, 191, 59, -6, 234, 216, -199, -341, -94, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_12 : certF 47 12 65330 [-244, 36, 191, -199, 94, 6, 116, -39, -84, 214, -91, -149, 234, 131, -216, -74, 196, 1, -106, 14, 251, 59, -341, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_13 : certF 47 13 65330 [-196, 234, 199, -251, -84, 39, 59, 94, 149, 1, -244, 74, 131, -191, -14, 214, -116, -341, 6, 91, -106, 36, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_14 : certF 47 14 65330 [-149, 341, 91, -244, 234, -59, -214, 36, 131, -251, 84, 191, -216, -14, 39, -199, -74, 106, -116, 94, 196, -1, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_15 : certF 47 15 65330 [-6, 149, -1, -341, 196, -91, 94, 244, -116, -234, 106, 59, -74, 214, -199, -36, 39, -131, -14, 251, -216, -84, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_16 : certF 47 16 65330 [-341, 244, 59, -36, 251, -191, 14, 199, -106, -94, 1, -6, 196, -116, -74, 39, -216, 84, 131, -214, 234, 91, -149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_17 : certF 47 17 65330 [94, 214, -216, 14, -59, -196, 149, -116, -36, 191, -39, 234, 1, -341, 106, -131, 84, 199, -244, 6, -91, -74, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_18 : certF 47 18 65330 [-234, 251, -39, -94, -1, -74, 191, -214, 341, -91, -36, 216, -106, 6, -116, -14, 131, -244, 149, 59, -84, 199, -196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_19 : certF 47 19 65330 [-74, 216, -244, 196, -131, 36, 1, -234, 191, -106, 149, -199, 14, 91, 94, 251, -214, 6, 59, 84, 116, -341, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_20 : certF 47 20 65330 [-36, 199, -6, 39, -214, 149, -131, 74, -1, -14, -59, -341, 251, -106, 196, -216, 234, -91, -84, 116, 94, 191, -244, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_21 : certF 47 21 65330 [-14, 116, -234, 131, -6, 251, -244, 106, -39, 149, -216, -94, 59, 36, -1, -84, 91, -74, 199, -341, 191, -196, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
theorem certF47_22 : certF 47 22 65330 [-84, 1, -14, 91, -36, 116, -74, -59, -234, 199, 94, 131, -341, 216, -6, 191, -149, 251, -196, 39, -244, 214, -106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
/-- X_47^n, every n: a Hodge character is paired. -/
theorem paired_char_47 (a : List Nat) (hin : AllIn 46 a) (h : HodgeList 47 a) :
cnt 1 a = cnt 46 a ∧ cnt 2 a = cnt 45 a ∧ cnt 3 a = cnt 44 a ∧ cnt 4 a = cnt 43 a ∧ cnt 5 a = cnt 42 a ∧ cnt 6 a = cnt 41 a ∧ cnt 7 a = cnt 40 a ∧ cnt 8 a = cnt 39 a ∧ cnt 9 a = cnt 38 a ∧ cnt 10 a = cnt 37 a ∧ cnt 11 a = cnt 36 a ∧ cnt 12 a = cnt 35 a ∧ cnt 13 a = cnt 34 a ∧ cnt 14 a = cnt 33 a ∧ cnt 15 a = cnt 32 a ∧ cnt 16 a = cnt 31 a ∧ cnt 17 a = cnt 30 a ∧ cnt 18 a = cnt 29 a ∧ cnt 19 a -- (+101 chars; full line in the Zenodo source)
⟨pair_one 47 0 65330 [-1, -91, -116, 59, -199, -131, -216, -191, -251, -39, -214, -106, -244, -196, -149, -6, -341, 94, -234, -74, -36, -14, -84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_0 a hin h,
pair_one 47 1 65330 [-91, 59, -131, -191, -39, -106, -196, -6, 94, -74, -14, 84, 36, 234, 341, 149, 244, 214, 251, 216, 199, 116, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_1 a hin h,
pair_one 47 2 65330 [-116, -131, -251, -106, -149, 94, -36, 84, 74, 341, 196, 214, 191, 199, 91, -1, 59, -216, -39, -244, -6, -234, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_2 a hin h,
pair_one 47 3 65330 [59, -191, -106, -6, -74, 84, 234, 149, 214, 216, 116, -1, -199, -251, -244, -341, -36, 14, -94, 196, 39, 131, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_3 a hin h,
pair_one 47 4 65330 [-199, -39, -149, -74, 14, 341, 106, 216, 91, -116, -191, -244, 94, -84, 234, 196, 251, -59, -1, -131, -214, -6, -36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_4 a hin h,
pair_one 47 5 65330 [-131, -106, 94, 84, 341, 214, 199, -1, -216, -244, -234, 14, 6, 39, -59, -91, -191, -196, -74, 36, 149, 251, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_5 a hin h,
pair_one 47 6 65330 [-216, -196, -36, 234, 106, 199, -91, -251, -6, -84, 341, 39, 116, 59, -214, 94, 14, 149, 191, 1, -131, -244, -74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_6 a hin h,
pair_one 47 7 65330 [-191, -6, 84, 149, 216, -1, -251, -341, 14, 196, 131, -91, -39, 94, 36, 244, 199, -116, -214, -234, 74, 106, -59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_7 a hin h,
pair_one 47 8 65330 [-251, 94, 74, 214, 91, -216, -6, 14, 244, -59, -199, -196, -84, 149, 131, -116, -106, -36, 341, 191, -1, -39, -234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_8 a hin h,
pair_one 47 9 65330 [-39, -74, 341, 216, -116, -244, -84, 196, -59, -131, -6, 36, 214, 1, -251, -234, -94, 191, -91, -106, -14, 149, 199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_9 a hin h,
pair_one 47 10 65330 [-214, -14, 196, 116, -191, -234, 341, 131, -199, -6, 74, 251, -91, -244, 84, 106, 1, -39, -36, 149, -59, -216, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_10 a hin h,
pair_one 47 11 65330 [-106, 84, 214, -1, -244, 14, 39, -91, -196, 36, 251, -116, -149, 74, 191, 59, -6, 234, 216, -199, -341, -94, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_11 a hin h,
pair_one 47 12 65330 [-244, 36, 191, -199, 94, 6, 116, -39, -84, 214, -91, -149, 234, 131, -216, -74, 196, 1, -106, 14, 251, 59, -341, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_12 a hin h,
pair_one 47 13 65330 [-196, 234, 199, -251, -84, 39, 59, 94, 149, 1, -244, 74, 131, -191, -14, 214, -116, -341, 6, 91, -106, 36, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_13 a hin h,
pair_one 47 14 65330 [-149, 341, 91, -244, 234, -59, -214, 36, 131, -251, 84, 191, -216, -14, 39, -199, -74, 106, -116, 94, 196, -1, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_14 a hin h,
pair_one 47 15 65330 [-6, 149, -1, -341, 196, -91, 94, 244, -116, -234, 106, 59, -74, 214, -199, -36, 39, -131, -14, 251, -216, -84, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_15 a hin h,
pair_one 47 16 65330 [-341, 244, 59, -36, 251, -191, 14, 199, -106, -94, 1, -6, 196, -116, -74, 39, -216, 84, 131, -214, 234, 91, -149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_16 a hin h,
pair_one 47 17 65330 [94, 214, -216, 14, -59, -196, 149, -116, -36, 191, -39, 234, 1, -341, 106, -131, 84, 199, -244, 6, -91, -74, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_17 a hin h,
pair_one 47 18 65330 [-234, 251, -39, -94, -1, -74, 191, -214, 341, -91, -36, 216, -106, 6, -116, -14, 131, -244, 149, 59, -84, 199, -196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_18 a hin h,
pair_one 47 19 65330 [-74, 216, -244, 196, -131, 36, 1, -234, 191, -106, 149, -199, 14, 91, 94, 251, -214, 6, 59, 84, 116, -341, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_19 a hin h,
pair_one 47 20 65330 [-36, 199, -6, 39, -214, 149, -131, 74, -1, -14, -59, -341, 251, -106, 196, -216, 234, -91, -84, 116, 94, 191, -244, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_20 a hin h,
pair_one 47 21 65330 [-14, 116, -234, 131, -6, 251, -244, 106, -39, 149, -216, -94, 59, 36, -1, -84, 91, -74, 199, -341, 191, -196, 214, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_21 a hin h,
pair_one 47 22 65330 [-84, 1, -14, 91, -36, 116, -74, -59, -234, 199, 94, 131, -341, 216, -6, 191, -149, 251, -196, 39, -244, 214, -106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF47_22 a hin h⟩
end FermatPrimes2
#print axioms FermatPrimes2.certF17_0
#print axioms FermatPrimes2.certF17_1
#print axioms FermatPrimes2.certF17_2
#print axioms FermatPrimes2.certF17_3
#print axioms FermatPrimes2.certF17_4
#print axioms FermatPrimes2.certF17_5
#print axioms FermatPrimes2.certF17_6
#print axioms FermatPrimes2.certF17_7
#print axioms FermatPrimes2.paired_char_17
#print axioms FermatPrimes2.certF19_0
#print axioms FermatPrimes2.certF19_1
#print axioms FermatPrimes2.certF19_2
#print axioms FermatPrimes2.certF19_3
#print axioms FermatPrimes2.certF19_4
#print axioms FermatPrimes2.certF19_5
#print axioms FermatPrimes2.certF19_6
#print axioms FermatPrimes2.certF19_7
#print axioms FermatPrimes2.certF19_8
#print axioms FermatPrimes2.paired_char_19
#print axioms FermatPrimes2.certF23_0
#print axioms FermatPrimes2.certF23_1
#print axioms FermatPrimes2.certF23_2
#print axioms FermatPrimes2.certF23_3
#print axioms FermatPrimes2.certF23_4
#print axioms FermatPrimes2.certF23_5
#print axioms FermatPrimes2.certF23_6
#print axioms FermatPrimes2.certF23_7
#print axioms FermatPrimes2.certF23_8
#print axioms FermatPrimes2.certF23_9
#print axioms FermatPrimes2.certF23_10
#print axioms FermatPrimes2.paired_char_23
#print axioms FermatPrimes2.certF29_0
#print axioms FermatPrimes2.certF29_1
#print axioms FermatPrimes2.certF29_2
#print axioms FermatPrimes2.certF29_3
#print axioms FermatPrimes2.certF29_4
#print axioms FermatPrimes2.certF29_5
#print axioms FermatPrimes2.certF29_6
#print axioms FermatPrimes2.certF29_7
#print axioms FermatPrimes2.certF29_8
#print axioms FermatPrimes2.certF29_9
#print axioms FermatPrimes2.certF29_10
#print axioms FermatPrimes2.certF29_11
#print axioms FermatPrimes2.certF29_12
#print axioms FermatPrimes2.certF29_13
#print axioms FermatPrimes2.paired_char_29
#print axioms FermatPrimes2.certF31_0
#print axioms FermatPrimes2.certF31_1
#print axioms FermatPrimes2.certF31_2
#print axioms FermatPrimes2.certF31_3
#print axioms FermatPrimes2.certF31_4
#print axioms FermatPrimes2.certF31_5
#print axioms FermatPrimes2.certF31_6
#print axioms FermatPrimes2.certF31_7
#print axioms FermatPrimes2.certF31_8
#print axioms FermatPrimes2.certF31_9
#print axioms FermatPrimes2.certF31_10
#print axioms FermatPrimes2.certF31_11
#print axioms FermatPrimes2.certF31_12
#print axioms FermatPrimes2.certF31_13
#print axioms FermatPrimes2.certF31_14
#print axioms FermatPrimes2.paired_char_31
#print axioms FermatPrimes2.certF37_0
#print axioms FermatPrimes2.certF37_1
#print axioms FermatPrimes2.certF37_2
#print axioms FermatPrimes2.certF37_3
#print axioms FermatPrimes2.certF37_4
#print axioms FermatPrimes2.certF37_5
#print axioms FermatPrimes2.certF37_6
#print axioms FermatPrimes2.certF37_7
#print axioms FermatPrimes2.certF37_8
#print axioms FermatPrimes2.certF37_9
#print axioms FermatPrimes2.certF37_10
#print axioms FermatPrimes2.certF37_11
#print axioms FermatPrimes2.certF37_12
#print axioms FermatPrimes2.certF37_13
#print axioms FermatPrimes2.certF37_14
#print axioms FermatPrimes2.certF37_15
#print axioms FermatPrimes2.certF37_16
#print axioms FermatPrimes2.certF37_17
#print axioms FermatPrimes2.paired_char_37
#print axioms FermatPrimes2.certF41_0
#print axioms FermatPrimes2.certF41_1
#print axioms FermatPrimes2.certF41_2
#print axioms FermatPrimes2.certF41_3
#print axioms FermatPrimes2.certF41_4
#print axioms FermatPrimes2.certF41_5
#print axioms FermatPrimes2.certF41_6
#print axioms FermatPrimes2.certF41_7
#print axioms FermatPrimes2.certF41_8
#print axioms FermatPrimes2.certF41_9
#print axioms FermatPrimes2.certF41_10
#print axioms FermatPrimes2.certF41_11
#print axioms FermatPrimes2.certF41_12
#print axioms FermatPrimes2.certF41_13
#print axioms FermatPrimes2.certF41_14
#print axioms FermatPrimes2.certF41_15
#print axioms FermatPrimes2.certF41_16
#print axioms FermatPrimes2.certF41_17
#print axioms FermatPrimes2.certF41_18
#print axioms FermatPrimes2.certF41_19
#print axioms FermatPrimes2.paired_char_41
#print axioms FermatPrimes2.certF43_0
#print axioms FermatPrimes2.certF43_1
#print axioms FermatPrimes2.certF43_2
#print axioms FermatPrimes2.certF43_3
#print axioms FermatPrimes2.certF43_4
#print axioms FermatPrimes2.certF43_5
#print axioms FermatPrimes2.certF43_6
#print axioms FermatPrimes2.certF43_7
#print axioms FermatPrimes2.certF43_8
#print axioms FermatPrimes2.certF43_9
#print axioms FermatPrimes2.certF43_10
#print axioms FermatPrimes2.certF43_11
#print axioms FermatPrimes2.certF43_12
#print axioms FermatPrimes2.certF43_13
#print axioms FermatPrimes2.certF43_14
#print axioms FermatPrimes2.certF43_15
#print axioms FermatPrimes2.certF43_16
#print axioms FermatPrimes2.certF43_17
#print axioms FermatPrimes2.certF43_18
#print axioms FermatPrimes2.certF43_19
#print axioms FermatPrimes2.certF43_20
#print axioms FermatPrimes2.paired_char_43
#print axioms FermatPrimes2.certF47_0
#print axioms FermatPrimes2.certF47_1
#print axioms FermatPrimes2.certF47_2
#print axioms FermatPrimes2.certF47_3
#print axioms FermatPrimes2.certF47_4
#print axioms FermatPrimes2.certF47_5
#print axioms FermatPrimes2.certF47_6
#print axioms FermatPrimes2.certF47_7
#print axioms FermatPrimes2.certF47_8
#print axioms FermatPrimes2.certF47_9
#print axioms FermatPrimes2.certF47_10
#print axioms FermatPrimes2.certF47_11
#print axioms FermatPrimes2.certF47_12
#print axioms FermatPrimes2.certF47_13
#print axioms FermatPrimes2.certF47_14
#print axioms FermatPrimes2.certF47_15
#print axioms FermatPrimes2.certF47_16
#print axioms FermatPrimes2.certF47_17
#print axioms FermatPrimes2.certF47_18
#print axioms FermatPrimes2.certF47_19
#print axioms FermatPrimes2.certF47_20
#print axioms FermatPrimes2.certF47_21
#print axioms FermatPrimes2.certF47_22
#print axioms FermatPrimes2.paired_char_47
lean_all/hodge/FermatPrimes3.lean
/-
hodge/FermatPrimes3.lean — T41 cycle 43: Ran's theorem at the character level for the primes
53 ≤ m ≤ 97, every dimension (certificates by exact elimination, checked by rfl). With FermatFull,
FermatPrimes2 and HodgeCounts: for every prime m < 100, Hodge ⟺ symmetric counts, every n.
-/
import hodge.FermatFull
namespace FermatPrimes3
open FTAChain FrobChain FermatPrime FermatFull
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_0 : certF 53 0 518234 [-82, -367, -610, -152, -952, -226, -985, -1515, -722, 32, -2055, -773, -1371, -1487, -1239, -401, -1762, -1085, -1415, -453, -1246, 521, -1192, 1012, -1036, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_1 : certF 53 1 518234 [-367, -152, -226, -1515, 32, -773, -1487, -401, -1085, -453, 521, 1012, 5, 1036, 1192, 1246, 1415, 1762, 1239, 1371, 2055, 722, 985, 952, 610, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_2 : certF 53 2 518234 [-610, -226, -722, -773, -1239, -1085, -1246, 1012, -5, 1192, 453, 1762, 1487, 2055, 1515, 952, 367, -82, -152, -985, 32, -1371, -401, -1415, 521, -1036, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_3 : certF 53 3 518234 [-152, -1515, -773, -401, -453, 1012, 1036, 1246, 1762, 1371, 722, 952, 82, -610, -985, -2055, -1239, -1415, -1192, -5, -521, 1085, 1487, -32, 226, 367, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_4 : certF 53 4 518234 [-952, 32, -1239, -453, -1036, 1192, 1085, 1371, 1515, 610, -367, -985, -773, -1762, 521, -5, 1246, 401, 2055, 226, 82, -152, -722, -1487, -1415, 1012, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_5 : certF 53 5 518234 [-226, -773, -1085, 1012, 1192, 1762, 2055, 952, -82, -985, -1371, -1415, -1036, -521, 401, -32, 152, -367, -1515, -1487, -453, 5, 1246, 1239, 722, 610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_6 : certF 53 6 518234 [-985, -1487, -1246, 1036, 1085, 2055, 152, -610, 32, -1762, 1012, -521, 1239, 1515, 82, -226, -1371, -453, -5, 1415, 773, 952, -367, -722, -401, -1192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_7 : certF 53 7 518234 [-1515, -401, 1012, 1246, 1371, 952, -610, -2055, -1415, -5, 1085, -32, 367, -226, -1487, 521, 1192, 1239, 985, -82, -722, -1762, -1036, 453, 773, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_8 : certF 53 8 518234 [-722, -1085, -5, 1762, 1515, -82, 32, -1415, 1036, 401, 985, -367, -2055, -453, -1012, 1239, 226, -610, -773, -1246, 1192, 1487, 952, -152, -1371, 521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_9 : certF 53 9 518234 [32, -453, 1192, 1371, 610, -985, -1762, -5, 401, 226, -152, -1487, 1012, 1415, 722, -82, -2055, -1246, -521, 773, 367, -1515, -1085, 1036, 1239, 952, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_10 : certF 53 10 518234 [-2055, 521, 453, 722, -367, -1371, 1012, 1085, 985, -152, -1239, 5, 401, 952, -226, -1762, 1036, 1487, 610, -1515, -1415, 1192, 773, 82, 32, -1246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_11 : certF 53 11 518234 [-773, 1012, 1762, 952, -985, -1415, -521, -32, -367, -1487, 5, 1239, 610, -722, -1246, 453, 1515, -152, -401, 1036, 1371, 82, -2055, -1192, 1085, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_12 : certF 53 12 518234 [-1371, 5, 1487, 82, -773, -1036, 1239, 367, -2055, 1012, 401, 610, 32, -1192, 1762, 152, -722, 521, 1085, 952, -1515, -1246, 1415, 226, -985, -453, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_13 : certF 53 13 518234 [-1487, 1036, 2055, -610, -1762, -521, 1515, -226, -453, 1415, 952, -722, -1192, 401, 367, -773, 5, 1371, -82, -1239, -1012, -32, -152, -1085, 1246, 985, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_14 : certF 53 14 518234 [-1239, 1192, 1515, -985, 521, 401, 82, -1487, -1012, 722, -226, -1246, 1762, 367, -1371, 1036, -32, -952, -453, 1085, 610, -773, -5, 2055, -152, -1415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_15 : certF 53 15 518234 [-401, 1246, 952, -2055, -5, -32, -226, 521, 1239, -82, -1762, 453, 152, -773, 1036, 722, -985, -1192, 1487, -367, -1085, 1415, 610, -1371, -1012, 1515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_16 : certF 53 16 518234 [-1762, 1415, 367, -1239, 1246, 152, -1371, 1192, 226, -2055, 1036, 1515, -722, 5, -32, -985, 1012, 773, -952, 521, 1487, -610, -453, 401, -82, -1085, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_17 : certF 53 17 518234 [-1085, 1762, -82, -1415, 401, -367, -453, 1239, -610, -1246, 1487, -152, 521, 1371, -952, -1192, 773, -226, 1012, 2055, -985, -1036, -32, -1515, 5, 722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_18 : certF 53 18 518234 [-1415, 1239, -152, -1192, 2055, -1515, -5, 985, -773, -521, 610, -401, 1085, -82, -453, 1487, -952, 1012, -32, -722, 1036, 226, -1371, 1246, 367, -1762, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_19 : certF 53 19 518234 [-453, 1371, -985, -5, 226, -1487, 1415, -82, -1246, 773, -1515, 1036, 952, -1239, 1085, -367, 521, 2055, -722, -1012, 152, -401, 1762, -610, -1192, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_20 : certF 53 20 518234 [-1246, 2055, 32, -521, 82, -453, 773, -722, 1192, 367, -1415, 1371, -1515, -1012, 610, -1085, 1487, -985, 1036, 152, -1762, 1239, -226, -5, 952, -401, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_21 : certF 53 21 518234 [521, 722, -1371, 1085, -152, 5, 952, -1762, 1487, -1515, 1192, 82, -1246, -32, -773, 1415, -610, -1036, 226, -401, 1239, -985, -1012, 367, -453, 2055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_22 : certF 53 22 518234 [-1192, 985, -401, 1487, -722, 1246, -367, -1036, 952, -1085, 773, -2055, 1415, -152, -5, 610, -453, -32, -1371, 1762, -226, -1012, 82, 521, 1515, -1239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_23 : certF 53 23 518234 [1012, 952, -1415, -32, -1487, 1239, -722, 453, -152, 1036, 82, -1192, 226, -1085, 2055, -1371, 401, -1515, 1246, -610, -5, 367, 521, 985, -1762, 773, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_24 : certF 53 24 518234 [-1036, 610, 521, 226, -1415, 722, -401, 773, -1371, 1239, 32, 1085, -985, 1246, -152, -1012, -82, 5, 367, -1192, 952, -453, 1515, -1762, 2055, -1487, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF53_25 : certF 53 25 518234 [5, 82, -1036, 367, 1012, 610, -1192, 152, 521, 952, -1246, 226, -453, 985, -1415, 1515, -1085, 722, -1762, -32, -401, 2055, -1239, 773, -1487, 1371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxRecDepth 1000000 in
theorem paired_char_53 (a : List Nat) (hin : AllIn 52 a) (h : HodgeList 53 a) :
cnt 1 a = cnt 52 a ∧ cnt 2 a = cnt 51 a ∧ cnt 3 a = cnt 50 a ∧ cnt 4 a = cnt 49 a ∧ cnt 5 a = cnt 48 a ∧ cnt 6 a = cnt 47 a ∧ cnt 7 a = cnt 46 a ∧ cnt 8 a = cnt 45 a ∧ cnt 9 a = cnt 44 a ∧ cnt 10 a = cnt 43 a ∧ cnt 11 a = cnt 42 a ∧ cnt 12 a = cnt 41 a ∧ cnt 13 a = cnt 40 a ∧ cnt 14 a = cnt 39 a ∧ cnt 15 a = cnt 38 a ∧ cnt 16 a = cnt 37 a ∧ cnt 17 a = cnt 36 a ∧ cnt 18 a = cnt 35 a ∧ cnt 19 a -- (+167 chars; full line in the Zenodo source)
⟨pair_one 53 0 518234 [-82, -367, -610, -152, -952, -226, -985, -1515, -722, 32, -2055, -773, -1371, -1487, -1239, -401, -1762, -1085, -1415, -453, -1246, 521, -1192, 1012, -1036, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_0 a hin h,
pair_one 53 1 518234 [-367, -152, -226, -1515, 32, -773, -1487, -401, -1085, -453, 521, 1012, 5, 1036, 1192, 1246, 1415, 1762, 1239, 1371, 2055, 722, 985, 952, 610, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_1 a hin h,
pair_one 53 2 518234 [-610, -226, -722, -773, -1239, -1085, -1246, 1012, -5, 1192, 453, 1762, 1487, 2055, 1515, 952, 367, -82, -152, -985, 32, -1371, -401, -1415, 521, -1036, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_2 a hin h,
pair_one 53 3 518234 [-152, -1515, -773, -401, -453, 1012, 1036, 1246, 1762, 1371, 722, 952, 82, -610, -985, -2055, -1239, -1415, -1192, -5, -521, 1085, 1487, -32, 226, 367, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_3 a hin h,
pair_one 53 4 518234 [-952, 32, -1239, -453, -1036, 1192, 1085, 1371, 1515, 610, -367, -985, -773, -1762, 521, -5, 1246, 401, 2055, 226, 82, -152, -722, -1487, -1415, 1012, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_4 a hin h,
pair_one 53 5 518234 [-226, -773, -1085, 1012, 1192, 1762, 2055, 952, -82, -985, -1371, -1415, -1036, -521, 401, -32, 152, -367, -1515, -1487, -453, 5, 1246, 1239, 722, 610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_5 a hin h,
pair_one 53 6 518234 [-985, -1487, -1246, 1036, 1085, 2055, 152, -610, 32, -1762, 1012, -521, 1239, 1515, 82, -226, -1371, -453, -5, 1415, 773, 952, -367, -722, -401, -1192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_6 a hin h,
pair_one 53 7 518234 [-1515, -401, 1012, 1246, 1371, 952, -610, -2055, -1415, -5, 1085, -32, 367, -226, -1487, 521, 1192, 1239, 985, -82, -722, -1762, -1036, 453, 773, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_7 a hin h,
pair_one 53 8 518234 [-722, -1085, -5, 1762, 1515, -82, 32, -1415, 1036, 401, 985, -367, -2055, -453, -1012, 1239, 226, -610, -773, -1246, 1192, 1487, 952, -152, -1371, 521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_8 a hin h,
pair_one 53 9 518234 [32, -453, 1192, 1371, 610, -985, -1762, -5, 401, 226, -152, -1487, 1012, 1415, 722, -82, -2055, -1246, -521, 773, 367, -1515, -1085, 1036, 1239, 952, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_9 a hin h,
pair_one 53 10 518234 [-2055, 521, 453, 722, -367, -1371, 1012, 1085, 985, -152, -1239, 5, 401, 952, -226, -1762, 1036, 1487, 610, -1515, -1415, 1192, 773, 82, 32, -1246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_10 a hin h,
pair_one 53 11 518234 [-773, 1012, 1762, 952, -985, -1415, -521, -32, -367, -1487, 5, 1239, 610, -722, -1246, 453, 1515, -152, -401, 1036, 1371, 82, -2055, -1192, 1085, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_11 a hin h,
pair_one 53 12 518234 [-1371, 5, 1487, 82, -773, -1036, 1239, 367, -2055, 1012, 401, 610, 32, -1192, 1762, 152, -722, 521, 1085, 952, -1515, -1246, 1415, 226, -985, -453, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_12 a hin h,
pair_one 53 13 518234 [-1487, 1036, 2055, -610, -1762, -521, 1515, -226, -453, 1415, 952, -722, -1192, 401, 367, -773, 5, 1371, -82, -1239, -1012, -32, -152, -1085, 1246, 985, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_13 a hin h,
pair_one 53 14 518234 [-1239, 1192, 1515, -985, 521, 401, 82, -1487, -1012, 722, -226, -1246, 1762, 367, -1371, 1036, -32, -952, -453, 1085, 610, -773, -5, 2055, -152, -1415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_14 a hin h,
pair_one 53 15 518234 [-401, 1246, 952, -2055, -5, -32, -226, 521, 1239, -82, -1762, 453, 152, -773, 1036, 722, -985, -1192, 1487, -367, -1085, 1415, 610, -1371, -1012, 1515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_15 a hin h,
pair_one 53 16 518234 [-1762, 1415, 367, -1239, 1246, 152, -1371, 1192, 226, -2055, 1036, 1515, -722, 5, -32, -985, 1012, 773, -952, 521, 1487, -610, -453, 401, -82, -1085, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_16 a hin h,
pair_one 53 17 518234 [-1085, 1762, -82, -1415, 401, -367, -453, 1239, -610, -1246, 1487, -152, 521, 1371, -952, -1192, 773, -226, 1012, 2055, -985, -1036, -32, -1515, 5, 722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_17 a hin h,
pair_one 53 18 518234 [-1415, 1239, -152, -1192, 2055, -1515, -5, 985, -773, -521, 610, -401, 1085, -82, -453, 1487, -952, 1012, -32, -722, 1036, 226, -1371, 1246, 367, -1762, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_18 a hin h,
pair_one 53 19 518234 [-453, 1371, -985, -5, 226, -1487, 1415, -82, -1246, 773, -1515, 1036, 952, -1239, 1085, -367, 521, 2055, -722, -1012, 152, -401, 1762, -610, -1192, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_19 a hin h,
pair_one 53 20 518234 [-1246, 2055, 32, -521, 82, -453, 773, -722, 1192, 367, -1415, 1371, -1515, -1012, 610, -1085, 1487, -985, 1036, 152, -1762, 1239, -226, -5, 952, -401, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_20 a hin h,
pair_one 53 21 518234 [521, 722, -1371, 1085, -152, 5, 952, -1762, 1487, -1515, 1192, 82, -1246, -32, -773, 1415, -610, -1036, 226, -401, 1239, -985, -1012, 367, -453, 2055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_21 a hin h,
pair_one 53 22 518234 [-1192, 985, -401, 1487, -722, 1246, -367, -1036, 952, -1085, 773, -2055, 1415, -152, -5, 610, -453, -32, -1371, 1762, -226, -1012, 82, 521, 1515, -1239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_22 a hin h,
pair_one 53 23 518234 [1012, 952, -1415, -32, -1487, 1239, -722, 453, -152, 1036, 82, -1192, 226, -1085, 2055, -1371, 401, -1515, 1246, -610, -5, 367, 521, 985, -1762, 773, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_23 a hin h,
pair_one 53 24 518234 [-1036, 610, 521, 226, -1415, 722, -401, 773, -1371, 1239, 32, 1085, -985, 1246, -152, -1012, -82, 5, 367, -1192, 952, -453, 1515, -1762, 2055, -1487, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_24 a hin h,
pair_one 53 25 518234 [5, 82, -1036, 367, 1012, 610, -1192, 152, 521, 952, -1246, 226, -453, 985, -1415, 1515, -1085, 722, -1762, -32, -401, 2055, -1239, 773, -1487, 1371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF53_25 a hin h⟩
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_0 : certF 59 0 4866438 [875, -6080, -5470, -172, -6061, -2054, -4174, -9881, -8224, -1718, -7217, -4345, -15959, -12002, -9007, -3454, -11872, -1535, -15373, -9979, -7135, -991, -14201, 1912, -6610, 2723, -5383, 6335, -7912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_1 : certF 59 1 4866438 [-6080, -172, -2054, -9881, -1718, -4345, -12002, -3454, -1535, -9979, -991, 1912, 2723, 6335, 7912, 5383, 6610, 14201, 7135, 15373, 11872, 9007, 15959, 7217, 8224, 4174, 6061, 5470, -875, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_2 : certF 59 2 4866438 [-5470, -2054, -8224, -4345, -9007, -1535, -7135, 1912, -5383, 7912, -2723, 14201, 9979, 11872, 12002, 7217, 9881, 6061, 6080, 875, -172, -4174, -1718, -15959, -3454, -15373, -991, -6610, 6335, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_3 : certF 59 3 4866438 [-172, -9881, -4345, -3454, -9979, 1912, 6335, 5383, 14201, 15373, 9007, 7217, 4174, 5470, 875, -6061, -8224, -15959, -11872, -7135, -6610, -7912, -2723, 991, 1535, 12002, 1718, 2054, 6080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_4 : certF 59 4 4866438 [-6061, -1718, -9007, -9979, -6610, 7912, -1912, 15373, 12002, 8224, 172, 875, -2054, -7217, -3454, -7135, 2723, -6335, 14201, 1535, 15959, 9881, 5470, -6080, -4174, -4345, -11872, -991, -5383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_5 : certF 59 5 4866438 [-2054, -4345, -1535, 1912, 7912, 14201, 11872, 7217, 6061, 875, -4174, -15959, -15373, -6610, -6335, 991, 3454, 1718, 172, -6080, -9881, -12002, -9979, 2723, 5383, 7135, 9007, 8224, 5470, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_6 : certF 59 6 4866438 [-4174, -12002, -7135, 6335, -1912, 11872, 1718, 5470, -172, -7217, -1535, -6610, 5383, 9979, 15959, 2054, 875, -9881, -9007, -991, -7912, 14201, 3454, 8224, 6080, -6061, -4345, -15373, 2723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_7 : certF 59 7 4866438 [-9881, -3454, 1912, 5383, 15373, 7217, 5470, -6061, -15959, -7135, -7912, 991, 12002, 2054, -6080, -1718, -1535, 2723, 6610, 11872, 8224, -875, -4174, -9007, -14201, -6335, 9979, 4345, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_8 : certF 59 8 4866438 [-8224, -1535, -5383, 14201, 12002, 6061, -172, -15959, -991, -6335, 15373, 1718, -875, -9881, -11872, 2723, -1912, 9007, 2054, -5470, -4345, -7135, 7912, 9979, 7217, 6080, -4174, -3454, -6610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_9 : certF 59 9 4866438 [-1718, -9979, 7912, 15373, 8224, 875, -7217, -7135, -6335, 1535, 9881, -6080, -4345, -991, 5383, 11872, 4174, -5470, -15959, -14201, -2723, 3454, 2054, -172, -12002, 1912, 6610, 9007, 6061, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_10 : certF 59 10 4866438 [-7217, -991, -2723, 9007, 172, -4174, -1535, -7912, 15373, 9881, -5470, -12002, -6610, 14201, 4345, -875, -1718, -7135, 5383, 3454, 6061, -2054, -11872, 6335, 9979, 8224, -6080, -15959, 1912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_11 : certF 59 11 4866438 [-4345, 1912, 14201, 7217, 875, -15959, -6610, 991, 1718, -6080, -12002, 2723, 7135, 8224, -5470, -9007, -5383, 9979, 9881, -172, -3454, 6335, 15373, 4174, -6061, -11872, -7912, 1535, 2054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_12 : certF 59 12 4866438 [-15959, 2723, 9979, 4174, -2054, -15373, 5383, 12002, -875, -4345, -6610, 7135, 9881, -6061, -1535, -6335, 9007, 6080, -7217, 1912, 991, 8224, -172, -11872, 7912, 3454, 5470, -1718, -14201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_13 : certF 59 13 4866438 [-12002, 6335, 11872, 5470, -7217, -6610, 9979, 2054, -9881, -991, 14201, 8224, -6061, -15373, -2723, 4345, -6080, -3454, 7912, 9007, -875, -15959, -5383, 1535, 172, -1718, 1912, 7135, 4174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_14 : certF 59 14 4866438 [-9007, 7912, 12002, 875, -3454, -6335, 15959, -6080, -11872, 5383, 4345, -5470, -1535, -2723, 7217, -172, -15373, 6610, 1718, -6061, -9979, -1912, 8224, -2054, -7135, 14201, 9881, -4174, -991, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_15 : certF 59 15 4866438 [-3454, 5383, 7217, -6061, -7135, 991, 2054, -1718, 2723, 11872, -875, -9007, -6335, 4345, -172, -9979, 14201, 4174, -8224, -6610, 1535, 6080, -12002, 7912, 15959, -5470, -15373, -1912, 9881, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_16 : certF 59 16 4866438 [-11872, 6610, 9881, -8224, 2723, 3454, 875, -1535, -1912, 4174, -1718, -5383, 9007, -6080, -15373, 14201, 2054, -7217, 6335, 12002, -5470, -9979, 991, 6061, -4345, -7912, 15959, -172, -7135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_17 : certF 59 17 4866438 [-1535, 14201, 6061, -15959, -6335, 1718, -9881, 2723, 9007, -5470, -7135, 9979, 6080, -3454, 6610, 4174, -7217, -7912, 4345, -2054, 1912, 11872, 875, -15373, 991, 172, -12002, 5383, 8224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_18 : certF 59 18 4866438 [-15373, 7135, 6080, -11872, 14201, 172, -9007, 6610, 2054, -15959, 5383, 9881, -7217, 7912, 1718, -8224, 6335, 4345, -4174, 2723, 12002, -6061, 1912, 3454, -5470, -991, 1535, 875, -9979, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_19 : certF 59 19 4866438 [-9979, 15373, 875, -7135, 1535, -6080, -991, 11872, -5470, -14201, 3454, -172, 1912, 9007, -6061, -6610, 12002, -2054, 2723, 15959, -4174, -5383, 4345, -9881, 6335, 7217, -8224, -7912, 1718, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_20 : certF 59 20 4866438 [-7135, 11872, -172, -6610, 15959, -9881, -7912, 8224, -4345, -2723, 6061, -3454, 991, -875, -9979, 1535, -5470, 1912, 12002, -4174, 6335, 1718, -7217, 5383, 2054, -9007, 14201, 6080, -15373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_21 : certF 59 21 4866438 [-991, 9007, -4174, -7912, 9881, -12002, 14201, -875, -7135, 3454, -2054, 6335, 8224, -15959, -1912, 6080, -9979, 11872, -6061, -5383, 1718, -4345, 6610, 5470, -15373, 1535, -172, 2723, 7217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_22 : certF 59 22 4866438 [-14201, 15959, -1718, -2723, 5470, -9979, 3454, -4174, 7912, 2054, -11872, 15373, -172, -5383, 8224, -12002, 991, 875, 1912, 4345, -7217, 6610, 6080, -7135, 9007, -9881, -6335, 6061, -1535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_23 : certF 59 23 4866438 [1912, 7217, -15959, 991, -6080, 2723, 8224, -9007, 9979, -172, 6335, 4174, -11872, 1535, -2054, 7912, 6061, -15373, 3454, -9881, 5383, 5470, -7135, 12002, -1718, 6610, -875, -14201, 4345, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_24 : certF 59 24 4866438 [-6610, 8224, -3454, 1535, -4174, 5383, 6080, -14201, 7217, -12002, 9979, -6061, 7912, 172, -7135, 15959, -4345, 991, -5470, 6335, 2054, -15373, 9007, -1718, -1912, 875, 2723, 9881, -11872, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_25 : certF 59 25 4866438 [2723, 4174, -15373, 12002, -4345, 7135, -6061, -6335, 6080, 1912, 8224, -11872, 3454, -1718, 14201, -5470, -7912, 172, -991, 7217, -9007, 1535, -9881, 6610, 875, -5383, 2054, -9979, 15959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_26 : certF 59 26 4866438 [-5383, 6061, -991, 1718, -11872, 9007, -4345, 9979, -4174, 6610, -6080, -7912, 5470, 1912, 9881, -15373, 15959, -12002, 1535, -8224, 14201, -172, -6335, -875, 2723, 2054, -7135, 7217, -3454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_27 : certF 59 27 4866438 [6335, 5470, -6610, 2054, -991, 8224, -15373, 4345, -3454, 9007, -15959, 1535, -1718, 7135, -4174, -1912, -172, 5383, 875, -7912, 6080, 2723, 6061, -14201, 9881, -9979, 7217, -11872, 12002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF59_28 : certF 59 28 4866438 [-7912, -875, 6335, 6080, -5383, 5470, 2723, 172, -6610, 6061, 1912, 2054, -14201, 4174, -991, 9881, -7135, 8224, -9979, 1718, -15373, 7217, -1535, 4345, -11872, 15959, -3454, 12002, -9007, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxRecDepth 1000000 in
theorem paired_char_59 (a : List Nat) (hin : AllIn 58 a) (h : HodgeList 59 a) :
cnt 1 a = cnt 58 a ∧ cnt 2 a = cnt 57 a ∧ cnt 3 a = cnt 56 a ∧ cnt 4 a = cnt 55 a ∧ cnt 5 a = cnt 54 a ∧ cnt 6 a = cnt 53 a ∧ cnt 7 a = cnt 52 a ∧ cnt 8 a = cnt 51 a ∧ cnt 9 a = cnt 50 a ∧ cnt 10 a = cnt 49 a ∧ cnt 11 a = cnt 48 a ∧ cnt 12 a = cnt 47 a ∧ cnt 13 a = cnt 46 a ∧ cnt 14 a = cnt 45 a ∧ cnt 15 a = cnt 44 a ∧ cnt 16 a = cnt 43 a ∧ cnt 17 a = cnt 42 a ∧ cnt 18 a = cnt 41 a ∧ cnt 19 a -- (+233 chars; full line in the Zenodo source)
⟨pair_one 59 0 4866438 [875, -6080, -5470, -172, -6061, -2054, -4174, -9881, -8224, -1718, -7217, -4345, -15959, -12002, -9007, -3454, -11872, -1535, -15373, -9979, -7135, -991, -14201, 1912, -6610, 2723, -5383, 6335, -7912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) ce -- (+16 chars; full line in the Zenodo source)
pair_one 59 1 4866438 [-6080, -172, -2054, -9881, -1718, -4345, -12002, -3454, -1535, -9979, -991, 1912, 2723, 6335, 7912, 5383, 6610, 14201, 7135, 15373, 11872, 9007, 15959, 7217, 8224, 4174, 6061, 5470, -875, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_1 a hin -- (+3 chars; full line in the Zenodo source)
pair_one 59 2 4866438 [-5470, -2054, -8224, -4345, -9007, -1535, -7135, 1912, -5383, 7912, -2723, 14201, 9979, 11872, 12002, 7217, 9881, 6061, 6080, 875, -172, -4174, -1718, -15959, -3454, -15373, -991, -6610, 6335, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_2 -- (+8 chars; full line in the Zenodo source)
pair_one 59 3 4866438 [-172, -9881, -4345, -3454, -9979, 1912, 6335, 5383, 14201, 15373, 9007, 7217, 4174, 5470, 875, -6061, -8224, -15959, -11872, -7135, -6610, -7912, -2723, 991, 1535, 12002, 1718, 2054, 6080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_3 a hi -- (+4 chars; full line in the Zenodo source)
pair_one 59 4 4866438 [-6061, -1718, -9007, -9979, -6610, 7912, -1912, 15373, 12002, 8224, 172, 875, -2054, -7217, -3454, -7135, 2723, -6335, 14201, 1535, 15959, 9881, 5470, -6080, -4174, -4345, -11872, -991, -5383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_4 -- (+8 chars; full line in the Zenodo source)
pair_one 59 5 4866438 [-2054, -4345, -1535, 1912, 7912, 14201, 11872, 7217, 6061, 875, -4174, -15959, -15373, -6610, -6335, 991, 3454, 1718, 172, -6080, -9881, -12002, -9979, 2723, 5383, 7135, 9007, 8224, 5470, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_5 a hin -- (+3 chars; full line in the Zenodo source)
pair_one 59 6 4866438 [-4174, -12002, -7135, 6335, -1912, 11872, 1718, 5470, -172, -7217, -1535, -6610, 5383, 9979, 15959, 2054, 875, -9881, -9007, -991, -7912, 14201, 3454, 8224, 6080, -6061, -4345, -15373, 2723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_6 a -- (+6 chars; full line in the Zenodo source)
pair_one 59 7 4866438 [-9881, -3454, 1912, 5383, 15373, 7217, 5470, -6061, -15959, -7135, -7912, 991, 12002, 2054, -6080, -1718, -1535, 2723, 6610, 11872, 8224, -875, -4174, -9007, -14201, -6335, 9979, 4345, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_7 a h -- (+5 chars; full line in the Zenodo source)
pair_one 59 8 4866438 [-8224, -1535, -5383, 14201, 12002, 6061, -172, -15959, -991, -6335, 15373, 1718, -875, -9881, -11872, 2723, -1912, 9007, 2054, -5470, -4345, -7135, 7912, 9979, 7217, 6080, -4174, -3454, -6610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_8 -- (+8 chars; full line in the Zenodo source)
pair_one 59 9 4866438 [-1718, -9979, 7912, 15373, 8224, 875, -7217, -7135, -6335, 1535, 9881, -6080, -4345, -991, 5383, 11872, 4174, -5470, -15959, -14201, -2723, 3454, 2054, -172, -12002, 1912, 6610, 9007, 6061, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_9 a h -- (+5 chars; full line in the Zenodo source)
pair_one 59 10 4866438 [-7217, -991, -2723, 9007, 172, -4174, -1535, -7912, 15373, 9881, -5470, -12002, -6610, 14201, 4345, -875, -1718, -7135, 5383, 3454, 6061, -2054, -11872, 6335, 9979, 8224, -6080, -15959, 1912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_10 -- (+9 chars; full line in the Zenodo source)
pair_one 59 11 4866438 [-4345, 1912, 14201, 7217, 875, -15959, -6610, 991, 1718, -6080, -12002, 2723, 7135, 8224, -5470, -9007, -5383, 9979, 9881, -172, -3454, 6335, 15373, 4174, -6061, -11872, -7912, 1535, 2054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_11 a -- (+6 chars; full line in the Zenodo source)
pair_one 59 12 4866438 [-15959, 2723, 9979, 4174, -2054, -15373, 5383, 12002, -875, -4345, -6610, 7135, 9881, -6061, -1535, -6335, 9007, 6080, -7217, 1912, 991, 8224, -172, -11872, 7912, 3454, 5470, -1718, -14201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_12 a -- (+7 chars; full line in the Zenodo source)
pair_one 59 13 4866438 [-12002, 6335, 11872, 5470, -7217, -6610, 9979, 2054, -9881, -991, 14201, 8224, -6061, -15373, -2723, 4345, -6080, -3454, 7912, 9007, -875, -15959, -5383, 1535, 172, -1718, 1912, 7135, 4174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_13 a -- (+7 chars; full line in the Zenodo source)
pair_one 59 14 4866438 [-9007, 7912, 12002, 875, -3454, -6335, 15959, -6080, -11872, 5383, 4345, -5470, -1535, -2723, 7217, -172, -15373, 6610, 1718, -6061, -9979, -1912, 8224, -2054, -7135, 14201, 9881, -4174, -991, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_1 -- (+10 chars; full line in the Zenodo source)
pair_one 59 15 4866438 [-3454, 5383, 7217, -6061, -7135, 991, 2054, -1718, 2723, 11872, -875, -9007, -6335, 4345, -172, -9979, 14201, 4174, -8224, -6610, 1535, 6080, -12002, 7912, 15959, -5470, -15373, -1912, 9881, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_15 -- (+8 chars; full line in the Zenodo source)
pair_one 59 16 4866438 [-11872, 6610, 9881, -8224, 2723, 3454, 875, -1535, -1912, 4174, -1718, -5383, 9007, -6080, -15373, 14201, 2054, -7217, 6335, 12002, -5470, -9979, 991, 6061, -4345, -7912, 15959, -172, -7135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_16 -- (+8 chars; full line in the Zenodo source)
pair_one 59 17 4866438 [-1535, 14201, 6061, -15959, -6335, 1718, -9881, 2723, 9007, -5470, -7135, 9979, 6080, -3454, 6610, 4174, -7217, -7912, 4345, -2054, 1912, 11872, 875, -15373, 991, 172, -12002, 5383, 8224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_17 a h -- (+5 chars; full line in the Zenodo source)
pair_one 59 18 4866438 [-15373, 7135, 6080, -11872, 14201, 172, -9007, 6610, 2054, -15959, 5383, 9881, -7217, 7912, 1718, -8224, 6335, 4345, -4174, 2723, 12002, -6061, 1912, 3454, -5470, -991, 1535, 875, -9979, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_18 a hi -- (+4 chars; full line in the Zenodo source)
pair_one 59 19 4866438 [-9979, 15373, 875, -7135, 1535, -6080, -991, 11872, -5470, -14201, 3454, -172, 1912, 9007, -6061, -6610, 12002, -2054, 2723, 15959, -4174, -5383, 4345, -9881, 6335, 7217, -8224, -7912, 1718, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_19 -- (+8 chars; full line in the Zenodo source)
pair_one 59 20 4866438 [-7135, 11872, -172, -6610, 15959, -9881, -7912, 8224, -4345, -2723, 6061, -3454, 991, -875, -9979, 1535, -5470, 1912, 12002, -4174, 6335, 1718, -7217, 5383, 2054, -9007, 14201, 6080, -15373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_20 -- (+8 chars; full line in the Zenodo source)
pair_one 59 21 4866438 [-991, 9007, -4174, -7912, 9881, -12002, 14201, -875, -7135, 3454, -2054, 6335, 8224, -15959, -1912, 6080, -9979, 11872, -6061, -5383, 1718, -4345, 6610, 5470, -15373, 1535, -172, 2723, 7217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_21 -- (+8 chars; full line in the Zenodo source)
pair_one 59 22 4866438 [-14201, 15959, -1718, -2723, 5470, -9979, 3454, -4174, 7912, 2054, -11872, 15373, -172, -5383, 8224, -12002, 991, 875, 1912, 4345, -7217, 6610, 6080, -7135, 9007, -9881, -6335, 6061, -1535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_22 a -- (+7 chars; full line in the Zenodo source)
pair_one 59 23 4866438 [1912, 7217, -15959, 991, -6080, 2723, 8224, -9007, 9979, -172, 6335, 4174, -11872, 1535, -2054, 7912, 6061, -15373, 3454, -9881, 5383, 5470, -7135, 12002, -1718, 6610, -875, -14201, 4345, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_23 a h -- (+5 chars; full line in the Zenodo source)
pair_one 59 24 4866438 [-6610, 8224, -3454, 1535, -4174, 5383, 6080, -14201, 7217, -12002, 9979, -6061, 7912, 172, -7135, 15959, -4345, 991, -5470, 6335, 2054, -15373, 9007, -1718, -1912, 875, 2723, 9881, -11872, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_24 a -- (+6 chars; full line in the Zenodo source)
pair_one 59 25 4866438 [2723, 4174, -15373, 12002, -4345, 7135, -6061, -6335, 6080, 1912, 8224, -11872, 3454, -1718, 14201, -5470, -7912, 172, -991, 7217, -9007, 1535, -9881, 6610, 875, -5383, 2054, -9979, 15959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_25 a -- (+6 chars; full line in the Zenodo source)
pair_one 59 26 4866438 [-5383, 6061, -991, 1718, -11872, 9007, -4345, 9979, -4174, 6610, -6080, -7912, 5470, 1912, 9881, -15373, 15959, -12002, 1535, -8224, 14201, -172, -6335, -875, 2723, 2054, -7135, 7217, -3454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_26 -- (+8 chars; full line in the Zenodo source)
pair_one 59 27 4866438 [6335, 5470, -6610, 2054, -991, 8224, -15373, 4345, -3454, 9007, -15959, 1535, -1718, 7135, -4174, -1912, -172, 5383, 875, -7912, 6080, 2723, 6061, -14201, 9881, -9979, 7217, -11872, 12002, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_27 a -- (+6 chars; full line in the Zenodo source)
pair_one 59 28 4866438 [-7912, -875, 6335, 6080, -5383, 5470, 2723, 172, -6610, 6061, 1912, 2054, -14201, 4174, -991, 9881, -7135, 8224, -9979, 1718, -15373, 7217, -1535, 4345, -11872, 15959, -3454, 12002, -9007, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) certF59_28 a -- (+6 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_0 : certF 61 0 9308722 [-9119, 5958, -3274, -3056, -5270, -8822, -20702, -3760, -10187, -18069, -11346, -17246, -25355, -4698, -17656, -19407, -26370, -6941, -23323, -260, -12863, -19153, -18443, 2750, -13831, 2760, -16292, -587, -14872, 14230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_1 : certF 61 1 9308722 [5958, -3056, -8822, -3760, -18069, -17246, -4698, -19407, -6941, -260, -19153, 2750, 2760, -587, 14230, 14872, 16292, 13831, 18443, 12863, 23323, 26370, 17656, 25355, 11346, 10187, 20702, 5270, 3274, 9119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_2 : certF 61 2 9308722 [-3274, -8822, -10187, -17246, -17656, -6941, -12863, 2750, -16292, 14230, 587, 13831, 19153, 23323, 19407, 25355, 18069, 20702, 3056, 9119, 5958, -5270, -3760, -11346, -4698, -26370, -260, -18443, 2760, -14872, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_3 : certF 61 3 9308722 [-3056, -3760, -17246, -19407, -260, 2750, -587, 14872, 13831, 12863, 26370, 25355, 10187, 5270, 9119, -3274, -20702, -11346, -17656, -23323, -18443, -16292, -14230, -2760, 19153, 6941, 4698, 18069, 8822, -5958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_4 : certF 61 4 9308722 [-5270, -18069, -17656, -260, -13831, 14230, -2760, 12863, 19407, 11346, 8822, 9119, -3056, -10187, -4698, -23323, 2750, -14872, 16292, 19153, 26370, 17246, 20702, -5958, -3274, -3760, -25355, -6941, -18443, -587, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_5 : certF 61 5 9308722 [-8822, -17246, -6941, 2750, 14230, 13831, 23323, 25355, 20702, 9119, -5270, -11346, -26370, -18443, -14872, -2760, 260, 4698, 3760, -5958, -3056, -18069, -19407, -19153, -587, 16292, 12863, 17656, 10187, 3274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_6 : certF 61 6 9308722 [-20702, -4698, -12863, -587, -2760, 23323, 17246, 5270, 5958, -10187, -19407, -18443, 14230, -2750, 26370, 18069, 3274, -3056, -11346, -6941, -13831, 14872, 19153, 17656, 3760, 9119, -8822, -25355, -260, -16292, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_7 : certF 61 7 9308722 [-3760, -19407, 2750, 14872, 12863, 25355, 5270, -3274, -11346, -23323, -16292, -2760, 6941, 18069, -5958, -8822, -4698, -19153, 14230, 18443, 17656, 20702, -9119, -10187, -26370, -13831, 587, 260, 17246, 3056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_8 : certF 61 8 9308722 [-10187, -6941, -16292, 13831, 19407, 20702, 5958, -11346, -260, -14872, 18443, 4698, 5270, -3056, -25355, -19153, -14230, 12863, 17246, 3274, -8822, -17656, 2750, 587, 23323, 18069, 9119, -3760, -26370, 2760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_9 : certF 61 9 9308722 [-18069, -260, 14230, 12863, 11346, 9119, -10187, -23323, -14872, 19153, 17246, -5958, -3760, -6941, -587, 18443, 25355, 3274, -20702, -26370, -16292, -2750, 4698, 3056, -8822, -19407, 2760, 13831, 17656, 5270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_10 : certF 61 10 9308722 [-11346, -19153, 587, 26370, 8822, -5270, -19407, -16292, 18443, 17246, 9119, -18069, -12863, 14872, 6941, 20702, -3056, -17656, 2760, -2750, 25355, -5958, -10187, -260, -14230, 23323, 3760, -3274, -4698, -13831, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_11 : certF 61 11 9308722 [-17246, 2750, 13831, 25355, 9119, -11346, -18443, -2760, 4698, -5958, -18069, -19153, 16292, 17656, 3274, -10187, -12863, 587, 19407, 3056, -3760, -260, 14872, 26370, 5270, -20702, -23323, -14230, 6941, 8822, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_12 : certF 61 12 9308722 [-25355, 2760, 19153, 10187, -3056, -26370, 14230, 6941, 5270, -3760, -12863, 16292, 4698, 9119, -17246, -13831, 18443, 18069, -3274, -19407, -14872, 23323, 8822, -20702, -260, 587, 17656, -5958, -11346, 2750, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_13 : certF 61 13 9308722 [-4698, -587, 23323, 5270, -10187, -18443, -2750, 18069, -3056, -6941, 14872, 17656, 9119, -25355, -16292, 260, 8822, -3760, -19153, 13831, 11346, -3274, -26370, -14230, 19407, -5958, -17246, 2760, 12863, 20702, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_14 : certF 61 14 9308722 [-17656, 14230, 19407, 9119, -4698, -14872, 26370, -5958, -25355, -587, 6941, 3274, -17246, -16292, 23323, 3056, -11346, 2760, 260, 5270, -18069, -13831, 12863, 8822, -10187, 2750, 19153, 20702, -3760, -18443, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_15 : certF 61 15 9308722 [-19407, 14872, 25355, -3274, -23323, -2760, 18069, -8822, -19153, 18443, 20702, -10187, -13831, 260, 3056, -17246, -587, 26370, 9119, -17656, -14230, 4698, 5958, -6941, 16292, 11346, -5270, -12863, -2750, 3760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_16 : certF 61 16 9308722 [-26370, 16292, 18069, -20702, 2750, 260, 3274, -4698, -14230, 25355, -3056, -12863, 18443, 8822, -11346, -587, 19407, -9119, -6941, -2760, 10187, -3760, -13831, 23323, -5958, -17656, 14872, 17246, -5270, -19153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_17 : certF 61 17 9308722 [-6941, 13831, 20702, -11346, -14872, 4698, -3056, -19153, 12863, 3274, -17656, 587, 18069, -3760, 2760, 26370, -9119, -23323, -2750, 8822, -17246, 14230, 25355, -5270, -18443, 260, -5958, -19407, 16292, 10187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_18 : certF 61 18 9308722 [-23323, 18443, 3056, -17656, 16292, 3760, -11346, 14230, 17246, -20702, 2760, 19407, -3274, -19153, 260, 9119, -6941, -2750, 5270, -4698, 587, 10187, -18069, -14872, 25355, -8822, -13831, 26370, 5958, -12863, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_19 : certF 61 19 9308722 [-260, 12863, 9119, -23323, 19153, -5958, -6941, 18443, 3274, -26370, -2750, 3056, -19407, 13831, 5270, -17656, -2760, 8822, -4698, 16292, 20702, -25355, 587, 3760, -17246, 14872, 10187, -11346, -14230, 18069, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_20 : certF 61 20 9308722 [-12863, 23323, 5958, -18443, 26370, -3056, -13831, 17656, -8822, -16292, 25355, -3760, -14872, 11346, -18069, -14230, 10187, -17246, 587, 20702, -4698, -2760, 5270, -19407, -2750, 3274, -6941, 19153, 9119, -260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_21 : certF 61 21 9308722 [-19153, 26370, -5270, -16292, 17246, -18069, 14872, 20702, -17656, -2750, -5958, -260, 23323, -3274, -13831, 4698, -3760, 14230, 10187, -25355, -2760, 3056, -6941, 12863, -9119, -18443, 19407, -8822, -587, 11346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_22 : certF 61 22 9308722 [-18443, 17656, -3760, -14230, 20702, -19407, 19153, -9119, 2750, 4698, -10187, 14872, 8822, -26370, 12863, 5958, -13831, 25355, -18069, 587, 5270, -6941, 260, -3274, 2760, 17246, -11346, 16292, 3056, -23323, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_23 : certF 61 23 9308722 [2750, 25355, -11346, -2760, -5958, -19153, 17656, -10187, 587, 3056, -260, 26370, -20702, -14230, 8822, -6941, 23323, -5270, -14872, 3760, -19407, 12863, -3274, -16292, 18069, -4698, 18443, -9119, -13831, 17246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_24 : certF 61 24 9308722 [-13831, 11346, -4698, 19153, -3274, -587, 3760, -26370, 23323, -8822, -14230, 5270, -260, 19407, -10187, 16292, -5958, -18443, 25355, -17246, -2750, -9119, 2760, 18069, -17656, 12863, -3056, -14872, 20702, -6941, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_25 : certF 61 25 9308722 [2760, 10187, -26370, 6941, -3760, 16292, 9119, -13831, 18069, -19407, 23323, -20702, 587, -5958, 2750, 11346, -17656, 260, -8822, 14872, 3274, -18443, 17246, -4698, 12863, -5270, -14230, 3056, -19153, 25355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_26 : certF 61 26 9308722 [-16292, 20702, -260, 4698, -25355, 12863, -8822, 587, 9119, 2760, 3760, -23323, 17656, -17246, 19153, -5270, 14872, -5958, -13831, 10187, -6941, 19407, -11346, 18443, -3056, -14230, 3274, 2750, 18069, -26370, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_27 : certF 61 27 9308722 [-587, 5270, -18443, 18069, -6941, 17656, -25355, 260, -3760, 13831, -3274, -14230, -5958, 2760, 20702, -12863, 17246, -19407, 26370, -11346, 19153, -8822, 16292, -9119, -14872, 3056, 2750, 10187, -23323, 4698, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_28 : certF 61 28 9308722 [-14872, 3274, 2760, 8822, -18443, 10187, -260, 17246, -26370, 17656, -4698, 6941, -11346, 12863, -3760, -2750, -5270, 16292, 5958, -14230, 9119, -587, 3056, -13831, 20702, -19153, 18069, -23323, 25355, -19407, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF61_29 : certF 61 29 9308722 [14230, 9119, -14872, -5958, -587, 3274, -16292, 3056, 2760, 5270, -13831, 8822, 2750, 20702, -18443, 3760, -19153, 10187, -12863, 18069, -260, 11346, -23323, 17246, -6941, 25355, -26370, 4698, -19407, 17656, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = true := rfl
set_option maxRecDepth 1000000 in
theorem paired_char_61 (a : List Nat) (hin : AllIn 60 a) (h : HodgeList 61 a) :
cnt 1 a = cnt 60 a ∧ cnt 2 a = cnt 59 a ∧ cnt 3 a = cnt 58 a ∧ cnt 4 a = cnt 57 a ∧ cnt 5 a = cnt 56 a ∧ cnt 6 a = cnt 55 a ∧ cnt 7 a = cnt 54 a ∧ cnt 8 a = cnt 53 a ∧ cnt 9 a = cnt 52 a ∧ cnt 10 a = cnt 51 a ∧ cnt 11 a = cnt 50 a ∧ cnt 12 a = cnt 49 a ∧ cnt 13 a = cnt 48 a ∧ cnt 14 a = cnt 47 a ∧ cnt 15 a = cnt 46 a ∧ cnt 16 a = cnt 45 a ∧ cnt 17 a = cnt 44 a ∧ cnt 18 a = cnt 43 a ∧ cnt 19 a -- (+255 chars; full line in the Zenodo source)
⟨pair_one 61 0 9308722 [-9119, 5958, -3274, -3056, -5270, -8822, -20702, -3760, -10187, -18069, -11346, -17246, -25355, -4698, -17656, -19407, -26370, -6941, -23323, -260, -12863, -19153, -18443, 2750, -13831, 2760, -16292, -587, -14872, 14230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le -- (+39 chars; full line in the Zenodo source)
pair_one 61 1 9308722 [5958, -3056, -8822, -3760, -18069, -17246, -4698, -19407, -6941, -260, -19153, 2750, 2760, -587, 14230, 14872, 16292, 13831, 18443, 12863, 23323, 26370, 17656, 25355, 11346, 10187, 20702, 5270, 3274, 9119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true -- (+24 chars; full line in the Zenodo source)
pair_one 61 2 9308722 [-3274, -8822, -10187, -17246, -17656, -6941, -12863, 2750, -16292, 14230, 587, 13831, 19153, 23323, 19407, 25355, 18069, 20702, 3056, 9119, 5958, -5270, -3760, -11346, -4698, -26370, -260, -18443, 2760, -14872, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq -- (+29 chars; full line in the Zenodo source)
pair_one 61 3 9308722 [-3056, -3760, -17246, -19407, -260, 2750, -587, 14872, 13831, 12863, 26370, 25355, 10187, 5270, 9119, -3274, -20702, -11346, -17656, -23323, -18443, -16292, -14230, -2760, 19153, 6941, 4698, 18069, 8822, -5958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq -- (+29 chars; full line in the Zenodo source)
pair_one 61 4 9308722 [-5270, -18069, -17656, -260, -13831, 14230, -2760, 12863, 19407, 11346, 8822, 9119, -3056, -10187, -4698, -23323, 2750, -14872, 16292, 19153, 26370, 17246, 20702, -5958, -3274, -3760, -25355, -6941, -18443, -587, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_ -- (+31 chars; full line in the Zenodo source)
pair_one 61 5 9308722 [-8822, -17246, -6941, 2750, 14230, 13831, 23323, 25355, 20702, 9119, -5270, -11346, -26370, -18443, -14872, -2760, 260, 4698, 3760, -5958, -3056, -18069, -19407, -19153, -587, 16292, 12863, 17656, 10187, 3274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+28 chars; full line in the Zenodo source)
pair_one 61 6 9308722 [-20702, -4698, -12863, -587, -2760, 23323, 17246, 5270, 5958, -10187, -19407, -18443, 14230, -2750, 26370, 18069, 3274, -3056, -11346, -6941, -13831, 14872, 19153, 17656, 3760, 9119, -8822, -25355, -260, -16292, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_e -- (+30 chars; full line in the Zenodo source)
pair_one 61 7 9308722 [-3760, -19407, 2750, 14872, 12863, 25355, 5270, -3274, -11346, -23323, -16292, -2760, 6941, 18069, -5958, -8822, -4698, -19153, 14230, 18443, 17656, 20702, -9119, -10187, -26370, -13831, 587, 260, 17246, 3056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+28 chars; full line in the Zenodo source)
pair_one 61 8 9308722 [-10187, -6941, -16292, 13831, 19407, 20702, 5958, -11346, -260, -14872, 18443, 4698, 5270, -3056, -25355, -19153, -14230, 12863, 17246, 3274, -8822, -17656, 2750, 587, 23323, 18069, 9119, -3760, -26370, 2760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_t -- (+27 chars; full line in the Zenodo source)
pair_one 61 9 9308722 [-18069, -260, 14230, 12863, 11346, 9119, -10187, -23323, -14872, 19153, 17246, -5958, -3760, -6941, -587, 18443, 25355, 3274, -20702, -26370, -16292, -2750, 4698, 3056, -8822, -19407, 2760, 13831, 17656, 5270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+28 chars; full line in the Zenodo source)
pair_one 61 10 9308722 [-11346, -19153, 587, 26370, 8822, -5270, -19407, -16292, 18443, 17246, 9119, -18069, -12863, 14872, 6941, 20702, -3056, -17656, 2760, -2750, 25355, -5958, -10187, -260, -14230, 23323, 3760, -3274, -4698, -13831, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_ -- (+32 chars; full line in the Zenodo source)
pair_one 61 11 9308722 [-17246, 2750, 13831, 25355, 9119, -11346, -18443, -2760, 4698, -5958, -18069, -19153, 16292, 17656, 3274, -10187, -12863, 587, 19407, 3056, -3760, -260, 14872, 26370, 5270, -20702, -23323, -14230, 6941, 8822, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+29 chars; full line in the Zenodo source)
pair_one 61 12 9308722 [-25355, 2760, 19153, 10187, -3056, -26370, 14230, 6941, 5270, -3760, -12863, 16292, 4698, 9119, -17246, -13831, 18443, 18069, -3274, -19407, -14872, 23323, 8822, -20702, -260, 587, 17656, -5958, -11346, 2750, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+29 chars; full line in the Zenodo source)
pair_one 61 13 9308722 [-4698, -587, 23323, 5270, -10187, -18443, -2750, 18069, -3056, -6941, 14872, 17656, 9119, -25355, -16292, 260, 8822, -3760, -19153, 13831, 11346, -3274, -26370, -14230, 19407, -5958, -17246, 2760, 12863, 20702, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_e -- (+31 chars; full line in the Zenodo source)
pair_one 61 14 9308722 [-17656, 14230, 19407, 9119, -4698, -14872, 26370, -5958, -25355, -587, 6941, 3274, -17246, -16292, 23323, 3056, -11346, 2760, 260, 5270, -18069, -13831, 12863, 8822, -10187, 2750, 19153, 20702, -3760, -18443, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+29 chars; full line in the Zenodo source)
pair_one 61 15 9308722 [-19407, 14872, 25355, -3274, -23323, -2760, 18069, -8822, -19153, 18443, 20702, -10187, -13831, 260, 3056, -17246, -587, 26370, 9119, -17656, -14230, 4698, 5958, -6941, 16292, 11346, -5270, -12863, -2750, 3760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_e -- (+31 chars; full line in the Zenodo source)
pair_one 61 16 9308722 [-26370, 16292, 18069, -20702, 2750, 260, 3274, -4698, -14230, 25355, -3056, -12863, 18443, 8822, -11346, -587, 19407, -9119, -6941, -2760, 10187, -3760, -13831, 23323, -5958, -17656, 14872, 17246, -5270, -19153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_ -- (+32 chars; full line in the Zenodo source)
pair_one 61 17 9308722 [-6941, 13831, 20702, -11346, -14872, 4698, -3056, -19153, 12863, 3274, -17656, 587, 18069, -3760, 2760, 26370, -9119, -23323, -2750, 8822, -17246, 14230, 25355, -5270, -18443, 260, -5958, -19407, 16292, 10187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq -- (+30 chars; full line in the Zenodo source)
pair_one 61 18 9308722 [-23323, 18443, 3056, -17656, 16292, 3760, -11346, 14230, 17246, -20702, 2760, 19407, -3274, -19153, 260, 9119, -6941, -2750, 5270, -4698, 587, 10187, -18069, -14872, 25355, -8822, -13831, 26370, 5958, -12863, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+29 chars; full line in the Zenodo source)
pair_one 61 19 9308722 [-260, 12863, 9119, -23323, 19153, -5958, -6941, 18443, 3274, -26370, -2750, 3056, -19407, 13831, 5270, -17656, -2760, 8822, -4698, 16292, 20702, -25355, 587, 3760, -17246, 14872, 10187, -11346, -14230, 18069, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+29 chars; full line in the Zenodo source)
pair_one 61 20 9308722 [-12863, 23323, 5958, -18443, 26370, -3056, -13831, 17656, -8822, -16292, 25355, -3760, -14872, 11346, -18069, -14230, 10187, -17246, 587, 20702, -4698, -2760, 5270, -19407, -2750, 3274, -6941, 19153, 9119, -260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_ -- (+32 chars; full line in the Zenodo source)
pair_one 61 21 9308722 [-19153, 26370, -5270, -16292, 17246, -18069, 14872, 20702, -17656, -2750, -5958, -260, 23323, -3274, -13831, 4698, -3760, 14230, 10187, -25355, -2760, 3056, -6941, 12863, -9119, -18443, 19407, -8822, -587, 11346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble -- (+33 chars; full line in the Zenodo source)
pair_one 61 22 9308722 [-18443, 17656, -3760, -14230, 20702, -19407, 19153, -9119, 2750, 4698, -10187, 14872, 8822, -26370, 12863, 5958, -13831, 25355, -18069, 587, 5270, -6941, 260, -3274, 2760, 17246, -11346, 16292, 3056, -23323, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_t -- (+28 chars; full line in the Zenodo source)
pair_one 61 23 9308722 [2750, 25355, -11346, -2760, -5958, -19153, 17656, -10187, 587, 3056, -260, 26370, -20702, -14230, 8822, -6941, 23323, -5270, -14872, 3760, -19407, 12863, -3274, -16292, 18069, -4698, 18443, -9119, -13831, 17246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_ -- (+32 chars; full line in the Zenodo source)
pair_one 61 24 9308722 [-13831, 11346, -4698, 19153, -3274, -587, 3760, -26370, 23323, -8822, -14230, 5270, -260, 19407, -10187, 16292, -5958, -18443, 25355, -17246, -2750, -9119, 2760, 18069, -17656, 12863, -3056, -14872, 20702, -6941, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble -- (+33 chars; full line in the Zenodo source)
pair_one 61 25 9308722 [2760, 10187, -26370, 6941, -3760, 16292, 9119, -13831, 18069, -19407, 23323, -20702, 587, -5958, 2750, 11346, -17656, 260, -8822, 14872, 3274, -18443, 17246, -4698, 12863, -5270, -14230, 3056, -19153, 25355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_t -- (+28 chars; full line in the Zenodo source)
pair_one 61 26 9308722 [-16292, 20702, -260, 4698, -25355, 12863, -8822, 587, 9119, 2760, 3760, -23323, 17656, -17246, 19153, -5270, 14872, -5958, -13831, 10187, -6941, 19407, -11346, 18443, -3056, -14230, 3274, 2750, 18069, -26370, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_ -- (+29 chars; full line in the Zenodo source)
pair_one 61 27 9308722 [-587, 5270, -18443, 18069, -6941, 17656, -25355, 260, -3760, 13831, -3274, -14230, -5958, 2760, 20702, -12863, 17246, -19407, 26370, -11346, 19153, -8822, 16292, -9119, -14872, 3056, 2750, 10187, -23323, 4698, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq -- (+30 chars; full line in the Zenodo source)
pair_one 61 28 9308722 [-14872, 3274, 2760, 8822, -18443, 10187, -260, 17246, -26370, 17656, -4698, 6941, -11346, 12863, -3760, -2750, -5270, 16292, 5958, -14230, 9119, -587, 3056, -13831, 20702, -19153, 18069, -23323, 25355, -19407, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq -- (+30 chars; full line in the Zenodo source)
pair_one 61 29 9308722 [14230, 9119, -14872, -5958, -587, 3274, -16292, 3056, 2760, 5270, -13831, 8822, 2750, 20702, -18443, 3760, -19153, 10187, -12863, 18069, -260, 11346, -23323, 17246, -6941, 25355, -26370, 4698, -19407, 17656, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_true rfl) (Nat.le_of_ble_eq_t -- (+28 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_0 : certF 67 0 114370742 [-29954, -4486, -38547, -145365, -74044, -24750, -151685, 78643, -168910, -151964, -142451, -161963, -196267, -89621, -227384, -178278, -228603, -56640, -293446, 42322, -155735, -161411, -187310, -19697, -256318, -31958, -65834, -8122, -221105, 54677, -134216, 5100, 11270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+27 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_1 : certF 67 1 114370742 [-4486, -145365, -24750, 78643, -151964, -161963, -89621, -178278, -56640, 42322, -161411, -19697, -31958, -8122, 54677, 5100, -11270, 134216, 221105, 65834, 256318, 187310, 155735, 293446, 228603, 227384, 196267, 142451, 168910, 151685, 74044, 38547, 29954, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] = -- (+12 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_2 : certF 67 2 114370742 [-38547, -24750, -168910, -161963, -227384, -56640, -155735, -19697, -65834, 54677, 11270, 134216, 8122, 256318, 161411, 293446, 178278, 196267, 151964, 151685, 145365, 29954, -4486, -74044, 78643, -142451, -89621, -228603, 42322, -187310, -31958, -221105, 5100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_3 : certF 67 3 114370742 [-145365, 78643, -161963, -178278, 42322, -19697, -8122, 5100, 134216, 65834, 187310, 293446, 227384, 142451, 151685, 38547, -29954, -74044, -168910, -196267, -228603, -155735, -256318, -221105, 11270, -54677, 31958, 161411, 56640, 89621, 151964, 24750, 4486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -- (+13 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_4 : certF 67 4 114370742 [-74044, -151964, -227384, 42322, -256318, 54677, -5100, 65834, 161411, 228603, 161963, 151685, 4486, -38547, 78643, -196267, -56640, -187310, -8122, 11270, 221105, 19697, 293446, 89621, 168910, 145365, -29954, -24750, -142451, -178278, -155735, -31958, -134216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_5 : certF 67 5 114370742 [-24750, -161963, -56640, -19697, 54677, 134216, 256318, 293446, 196267, 151685, 29954, -74044, -142451, -228603, -187310, -221105, -5100, 31958, -42322, 89621, -78643, 4486, -145365, -151964, -178278, -161411, -8122, -11270, 65834, 155735, 227384, 168910, 38547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+17 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_6 : certF 67 6 114370742 [-151685, -89621, -155735, -8122, -5100, 256318, 56640, 142451, 145365, -38547, -151964, -228603, -19697, -134216, 221105, 161411, 227384, -78643, 29954, -24750, -196267, 42322, -65834, -11270, 31958, 293446, 161963, 74044, -4486, -168910, -178278, -187310, 54677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+18 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_7 : certF 67 7 114370742 [78643, -178278, -19697, 5100, 65834, 293446, 142451, 38547, -74044, -196267, -155735, -221105, -54677, 161411, 89621, 24750, -4486, -151964, -56640, -31958, -11270, 256318, 228603, 168910, 29954, -151685, -227384, -187310, -134216, 8122, -42322, 161963, 145365, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_8 : certF 67 8 114370742 [-168910, -56640, -65834, 134216, 161411, 196267, 145365, -74044, -89621, -187310, 5100, 31958, 228603, -78643, -29954, -151964, -293446, -8122, -54677, 155735, 161963, 38547, -24750, -227384, -19697, 11270, 256318, 178278, 151685, -4486, -142451, 42322, -221105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+17 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_9 : certF 67 9 114370742 [-151964, 42322, 54677, 65834, 228603, 151685, -38547, -196267, -187310, 11270, 19697, 89621, 145365, -24750, -178278, -31958, 134216, 155735, 142451, 29954, -168910, -293446, -221105, 8122, 56640, -78643, -4486, -161963, -161411, 5100, 256318, 227384, 74044, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -- (+13 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_10 : certF 67 10 114370742 [-142451, -161411, 11270, 187310, 161963, 29954, -151964, -155735, 5100, 19697, 196267, 4486, -168910, 42322, -134216, 256318, 89621, 38547, 78643, -293446, 54677, 31958, 227384, 145365, -151685, -56640, -221105, 65834, 178278, 74044, -24750, -228603, -8122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -- (+14 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_11 : certF 67 11 114370742 [-161963, -19697, 134216, 293446, 151685, -74044, -228603, -221105, 31958, 89621, 4486, -151964, -161411, -11270, 155735, 168910, -38547, -227384, -65834, 8122, 178278, 145365, 78643, 42322, 5100, 187310, 142451, -29954, -196267, -256318, -54677, 56640, 24750, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_12 : certF 67 12 114370742 [-196267, -31958, 8122, 227384, 4486, -142451, -19697, -54677, 228603, 145365, -168910, -161411, -5100, 293446, 24750, -151685, 42322, 11270, 155735, -78643, -74044, -56640, -134216, 187310, 151964, -38547, -178278, -221105, 256318, 161963, -29954, -89621, -65834, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+20 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_13 : certF 67 13 114370742 [-89621, -8122, 256318, 142451, -38547, -228603, -134216, 161411, -78643, -24750, 42322, -11270, 293446, 74044, -168910, -187310, -54677, 178278, 4486, -161963, -31958, 65834, 196267, -29954, -227384, -221105, 19697, 151964, -145365, -56640, 5100, 155735, 151685, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+19 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_14 : certF 67 14 114370742 [-227384, 54677, 161411, 151685, 78643, -187310, 221105, 89621, -29954, -178278, -134216, 155735, 24750, -168910, -19697, 8122, 196267, -4486, -228603, 5100, -42322, 74044, -151964, -256318, 65834, 161963, -38547, -56640, 11270, 293446, 145365, -142451, -31958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+17 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_15 : certF 67 15 114370742 [-178278, 5100, 293446, 38547, -196267, -221105, 161411, 24750, -151964, -31958, 256318, 168910, -151685, -187310, 8122, 161963, -145365, 42322, 134216, 227384, -29954, -228603, 11270, 56640, 4486, -89621, 54677, 155735, 74044, -142451, -65834, 19697, -78643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+15 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_16 : certF 67 16 114370742 [-228603, -11270, 178278, -29954, -56640, -5100, 227384, -4486, -293446, 134216, 89621, -38547, 42322, -54677, 196267, -145365, -155735, 221105, 161963, -74044, -161411, 8122, 142451, -24750, -187310, 65834, 151964, -151685, -19697, 31958, 168910, 78643, -256318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+19 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_17 : certF 67 17 114370742 [-56640, 134216, 196267, -74044, -187310, 31958, -78643, -151964, -8122, 155735, 38547, -227384, 11270, 178278, -4486, 42322, 221105, 142451, -151685, -256318, 19697, 24750, -161963, 54677, 293446, 29954, -228603, -5100, 89621, -145365, -161411, 65834, 168910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_18 : certF 67 18 114370742 [-293446, 221105, 151964, -168910, -8122, -42322, 29954, -56640, -54677, 142451, 78643, -65834, 155735, 4486, -228603, 134216, 161963, -151685, -31958, 161411, 38547, -178278, -5100, 196267, -24750, -256318, 187310, 145365, -227384, -11270, 89621, -74044, -19697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+19 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_19 : certF 67 19 114370742 [42322, 65834, 151685, -196267, 11270, 89621, -24750, -31958, 155735, 29954, -293446, 8122, -78643, -161963, 5100, 227384, -74044, -256318, 161411, 4486, -56640, 221105, 168910, -142451, -134216, 178278, -145365, -19697, 187310, 38547, -228603, -54677, 151964, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_20 : certF 67 20 114370742 [-155735, 256318, 145365, -228603, 221105, -78643, -196267, -11270, 161963, -168910, 54677, 178278, -74044, -31958, -42322, -29954, -161411, 19697, 38547, -56640, 8122, 151685, -89621, -5100, 142451, -151964, -134216, 227384, -24750, -65834, 293446, -4486, -187310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+21 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_21 : certF 67 21 114370742 [-161411, 187310, 29954, -155735, 19697, 4486, 42322, 256318, 38547, -293446, 31958, 145365, -56640, 65834, 74044, -228603, 8122, 24750, -178278, 221105, 151685, -227384, -54677, -78643, -89621, 134216, 168910, -196267, -5100, 151964, -161963, -11270, 142451, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+15 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_22 : certF 67 22 114370742 [-187310, 155735, -4486, -256318, 293446, -145365, -65834, 228603, -24750, -221105, 227384, 78643, -134216, 196267, -151964, 11270, 142451, -161963, -5100, 168910, -89621, -54677, 151685, -178278, 8122, 74044, -56640, 31958, 38547, 42322, 19697, 29954, -161411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+17 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_23 : certF 67 23 114370742 [-19697, 293446, -74044, -221105, 89621, -151964, -11270, 168910, -227384, 8122, 145365, 42322, 187310, -29954, -256318, 56640, -24750, 54677, 196267, -142451, -5100, -78643, -178278, 65834, 38547, -155735, 161411, -4486, -31958, 228603, -151685, -134216, 161963, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+19 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_24 : certF 67 24 114370742 [-256318, 228603, 78643, 11270, 168910, -178278, 31958, 29954, -19697, 56640, -151685, 5100, 151964, -227384, 65834, 4486, -187310, 293446, -24750, -134216, 142451, -89621, 8122, 38547, -161411, -42322, -74044, 54677, 161963, -196267, 221105, 145365, -155735, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+15 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_25 : certF 67 25 114370742 [-31958, 227384, -142451, -54677, 145365, -161411, 293446, -151685, 11270, -78643, -56640, 187310, -38547, -221105, 161963, -89621, 65834, 29954, -256318, 178278, -151964, 134216, 74044, -155735, -42322, -24750, 5100, 168910, -228603, 19697, -4486, -8122, 196267, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+19 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_26 : certF 67 26 114370742 [-65834, 196267, -89621, 31958, -29954, -8122, 161963, -227384, 256318, -4486, -221105, 142451, -178278, 19697, -38547, 54677, 151964, -228603, 187310, -145365, -134216, 168910, -56640, 161411, -74044, 5100, -78643, -293446, 155735, -24750, 11270, 151685, 42322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+18 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_27 : certF 67 27 114370742 [-8122, 142451, -228603, 161411, -24750, -11270, 74044, -187310, 178278, -161963, 65834, -29954, -221105, 151964, -56640, 155735, -151685, -5100, 145365, -19697, 227384, -196267, 31958, -4486, 54677, 168910, -293446, -42322, 78643, 134216, 38547, -256318, 89621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+18 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_28 : certF 67 28 114370742 [-221105, 168910, 42322, 56640, -142451, 65834, -4486, -134216, 151685, -161411, 178278, -196267, 256318, -145365, 11270, 74044, -19697, 89621, -227384, 187310, -24750, -5100, 38547, -31958, 161963, -228603, 155735, 78643, -54677, 29954, -8122, 151964, -293446, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+17 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_29 : certF 67 29 114370742 [54677, 151685, -187310, 89621, -178278, 155735, -168910, 8122, -4486, 5100, 74044, -256318, 161963, -56640, 293446, -142451, 31958, -145365, -11270, 38547, -65834, 151964, 42322, 228603, -196267, 19697, -24750, 134216, 29954, -221105, -78643, -161411, 227384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_30 : certF 67 30 114370742 [-134216, 74044, -31958, 151964, -155735, 227384, -178278, -42322, -142451, 256318, -24750, -54677, -29954, 5100, 145365, -65834, 168910, -161411, 89621, -228603, 293446, -161963, 19697, -151685, 221105, -4486, 11270, 38547, -8122, -78643, -187310, 196267, -56640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+20 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_31 : certF 67 31 114370742 [5100, 38547, -221105, 24750, -31958, 168910, -187310, 161963, 42322, 227384, -228603, 56640, -89621, 155735, -142451, 19697, 78643, 65834, -74044, -54677, -4486, -11270, 29954, -134216, 145365, -8122, 151685, -256318, 151964, -161411, 196267, -293446, 178278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+16 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF67_32 : certF 67 32 114370742 [11270, 29954, 5100, 4486, -134216, 38547, 54677, 145365, -221105, 74044, -8122, 24750, -65834, 151685, -31958, -78643, -256318, 168910, -19697, 151964, -187310, 142451, -161411, 161963, -155735, 196267, 42322, 89621, -293446, 227384, -56640, 178278, -228603, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+15 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_67 (a : List Nat) (hin : AllIn 66 a) (h : HodgeList 67 a) :
cnt 1 a = cnt 66 a ∧ cnt 2 a = cnt 65 a ∧ cnt 3 a = cnt 64 a ∧ cnt 4 a = cnt 63 a ∧ cnt 5 a = cnt 62 a ∧ cnt 6 a = cnt 61 a ∧ cnt 7 a = cnt 60 a ∧ cnt 8 a = cnt 59 a ∧ cnt 9 a = cnt 58 a ∧ cnt 10 a = cnt 57 a ∧ cnt 11 a = cnt 56 a ∧ cnt 12 a = cnt 55 a ∧ cnt 13 a = cnt 54 a ∧ cnt 14 a = cnt 53 a ∧ cnt 15 a = cnt 52 a ∧ cnt 16 a = cnt 51 a ∧ cnt 17 a = cnt 50 a ∧ cnt 18 a = cnt 49 a ∧ cnt 19 a -- (+321 chars; full line in the Zenodo source)
⟨pair_one 67 0 114370742 [-29954, -4486, -38547, -145365, -74044, -24750, -151685, 78643, -168910, -151964, -142451, -161963, -196267, -89621, -227384, -178278, -228603, -56640, -293446, 42322, -155735, -161411, -187310, -19697, -256318, -31958, -65834, -8122, -221105, 54677, -134216, 5100, 11270, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -- (+102 chars; full line in the Zenodo source)
pair_one 67 1 114370742 [-4486, -145365, -24750, 78643, -151964, -161963, -89621, -178278, -56640, 42322, -161411, -19697, -31958, -8122, 54677, 5100, -11270, 134216, 221105, 65834, 256318, 187310, 155735, 293446, 228603, 227384, 196267, 142451, 168910, 151685, 74044, 38547, 29954, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble_ -- (+87 chars; full line in the Zenodo source)
pair_one 67 2 114370742 [-38547, -24750, -168910, -161963, -227384, -56640, -155735, -19697, -65834, 54677, 11270, 134216, 8122, 256318, 161411, 293446, 178278, 196267, 151964, 151685, 145365, 29954, -4486, -74044, 78643, -142451, -89621, -228603, 42322, -187310, -31958, -221105, 5100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ -- (+91 chars; full line in the Zenodo source)
pair_one 67 3 114370742 [-145365, 78643, -161963, -178278, 42322, -19697, -8122, 5100, 134216, 65834, 187310, 293446, 227384, 142451, 151685, 38547, -29954, -74044, -168910, -196267, -228603, -155735, -256318, -221105, 11270, -54677, 31958, 161411, 56640, 89621, 151964, 24750, 4486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble -- (+88 chars; full line in the Zenodo source)
pair_one 67 4 114370742 [-74044, -151964, -227384, 42322, -256318, 54677, -5100, 65834, 161411, 228603, 161963, 151685, 4486, -38547, 78643, -196267, -56640, -187310, -8122, 11270, 221105, 19697, 293446, 89621, 168910, 145365, -29954, -24750, -142451, -178278, -155735, -31958, -134216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ -- (+91 chars; full line in the Zenodo source)
pair_one 67 5 114370742 [-24750, -161963, -56640, -19697, 54677, 134216, 256318, 293446, 196267, 151685, 29954, -74044, -142451, -228603, -187310, -221105, -5100, 31958, -42322, 89621, -78643, 4486, -145365, -151964, -178278, -161411, -8122, -11270, 65834, 155735, 227384, 168910, 38547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of -- (+92 chars; full line in the Zenodo source)
pair_one 67 6 114370742 [-151685, -89621, -155735, -8122, -5100, 256318, 56640, 142451, 145365, -38547, -151964, -228603, -19697, -134216, 221105, 161411, 227384, -78643, 29954, -24750, -196267, 42322, -65834, -11270, 31958, 293446, 161963, 74044, -4486, -168910, -178278, -187310, 54677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_o -- (+93 chars; full line in the Zenodo source)
pair_one 67 7 114370742 [78643, -178278, -19697, 5100, 65834, 293446, 142451, 38547, -74044, -196267, -155735, -221105, -54677, 161411, 89621, 24750, -4486, -151964, -56640, -31958, -11270, 256318, 228603, 168910, 29954, -151685, -227384, -187310, -134216, 8122, -42322, 161963, 145365, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ -- (+91 chars; full line in the Zenodo source)
pair_one 67 8 114370742 [-168910, -56640, -65834, 134216, 161411, 196267, 145365, -74044, -89621, -187310, 5100, 31958, 228603, -78643, -29954, -151964, -293446, -8122, -54677, 155735, 161963, 38547, -24750, -227384, -19697, 11270, 256318, 178278, 151685, -4486, -142451, 42322, -221105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of -- (+92 chars; full line in the Zenodo source)
pair_one 67 9 114370742 [-151964, 42322, 54677, 65834, 228603, 151685, -38547, -196267, -187310, 11270, 19697, 89621, 145365, -24750, -178278, -31958, 134216, 155735, 142451, 29954, -168910, -293446, -221105, 8122, 56640, -78643, -4486, -161963, -161411, 5100, 256318, 227384, 74044, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble -- (+88 chars; full line in the Zenodo source)
pair_one 67 10 114370742 [-142451, -161411, 11270, 187310, 161963, 29954, -151964, -155735, 5100, 19697, 196267, 4486, -168910, 42322, -134216, 256318, 89621, 38547, 78643, -293446, 54677, 31958, 227384, 145365, -151685, -56640, -221105, 65834, 178278, 74044, -24750, -228603, -8122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ble -- (+89 chars; full line in the Zenodo source)
pair_one 67 11 114370742 [-161963, -19697, 134216, 293446, 151685, -74044, -228603, -221105, 31958, 89621, 4486, -151964, -161411, -11270, 155735, 168910, -38547, -227384, -65834, 8122, 178278, 145365, 78643, 42322, 5100, 187310, 142451, -29954, -196267, -256318, -54677, 56640, 24750, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_b -- (+91 chars; full line in the Zenodo source)
pair_one 67 12 114370742 [-196267, -31958, 8122, 227384, 4486, -142451, -19697, -54677, 228603, 145365, -168910, -161411, -5100, 293446, 24750, -151685, 42322, 11270, 155735, -78643, -74044, -56640, -134216, 187310, 151964, -38547, -178278, -221105, 256318, 161963, -29954, -89621, -65834, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_ -- (+95 chars; full line in the Zenodo source)
pair_one 67 13 114370742 [-89621, -8122, 256318, 142451, -38547, -228603, -134216, 161411, -78643, -24750, 42322, -11270, 293446, 74044, -168910, -187310, -54677, 178278, 4486, -161963, -31958, 65834, 196267, -29954, -227384, -221105, 19697, 151964, -145365, -56640, 5100, 155735, 151685, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_o -- (+94 chars; full line in the Zenodo source)
pair_one 67 14 114370742 [-227384, 54677, 161411, 151685, 78643, -187310, 221105, 89621, -29954, -178278, -134216, 155735, 24750, -168910, -19697, 8122, 196267, -4486, -228603, 5100, -42322, 74044, -151964, -256318, 65834, 161963, -38547, -56640, 11270, 293446, 145365, -142451, -31958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ -- (+92 chars; full line in the Zenodo source)
pair_one 67 15 114370742 [-178278, 5100, 293446, 38547, -196267, -221105, 161411, 24750, -151964, -31958, 256318, 168910, -151685, -187310, 8122, 161963, -145365, 42322, 134216, 227384, -29954, -228603, 11270, 56640, 4486, -89621, 54677, 155735, 74044, -142451, -65834, 19697, -78643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_bl -- (+90 chars; full line in the Zenodo source)
pair_one 67 16 114370742 [-228603, -11270, 178278, -29954, -56640, -5100, 227384, -4486, -293446, 134216, 89621, -38547, 42322, -54677, 196267, -145365, -155735, 221105, 161963, -74044, -161411, 8122, 142451, -24750, -187310, 65834, 151964, -151685, -19697, 31958, 168910, 78643, -256318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_o -- (+94 chars; full line in the Zenodo source)
pair_one 67 17 114370742 [-56640, 134216, 196267, -74044, -187310, 31958, -78643, -151964, -8122, 155735, 38547, -227384, 11270, 178278, -4486, 42322, 221105, 142451, -151685, -256318, 19697, 24750, -161963, 54677, 293446, 29954, -228603, -5100, 89621, -145365, -161411, 65834, 168910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_b -- (+91 chars; full line in the Zenodo source)
pair_one 67 18 114370742 [-293446, 221105, 151964, -168910, -8122, -42322, 29954, -56640, -54677, 142451, 78643, -65834, 155735, 4486, -228603, 134216, 161963, -151685, -31958, 161411, 38547, -178278, -5100, 196267, -24750, -256318, 187310, 145365, -227384, -11270, 89621, -74044, -19697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_o -- (+94 chars; full line in the Zenodo source)
pair_one 67 19 114370742 [42322, 65834, 151685, -196267, 11270, 89621, -24750, -31958, 155735, 29954, -293446, 8122, -78643, -161963, 5100, 227384, -74044, -256318, 161411, 4486, -56640, 221105, 168910, -142451, -134216, 178278, -145365, -19697, 187310, 38547, -228603, -54677, 151964, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_b -- (+91 chars; full line in the Zenodo source)
pair_one 67 20 114370742 [-155735, 256318, 145365, -228603, 221105, -78643, -196267, -11270, 161963, -168910, 54677, 178278, -74044, -31958, -42322, -29954, -161411, 19697, 38547, -56640, 8122, 151685, -89621, -5100, 142451, -151964, -134216, 227384, -24750, -65834, 293446, -4486, -187310, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le -- (+96 chars; full line in the Zenodo source)
pair_one 67 21 114370742 [-161411, 187310, 29954, -155735, 19697, 4486, 42322, 256318, 38547, -293446, 31958, 145365, -56640, 65834, 74044, -228603, 8122, 24750, -178278, 221105, 151685, -227384, -54677, -78643, -89621, 134216, 168910, -196267, -5100, 151964, -161963, -11270, 142451, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_bl -- (+90 chars; full line in the Zenodo source)
pair_one 67 22 114370742 [-187310, 155735, -4486, -256318, 293446, -145365, -65834, 228603, -24750, -221105, 227384, 78643, -134216, 196267, -151964, 11270, 142451, -161963, -5100, 168910, -89621, -54677, 151685, -178278, 8122, 74044, -56640, 31958, 38547, 42322, 19697, 29954, -161411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ -- (+92 chars; full line in the Zenodo source)
pair_one 67 23 114370742 [-19697, 293446, -74044, -221105, 89621, -151964, -11270, 168910, -227384, 8122, 145365, 42322, 187310, -29954, -256318, 56640, -24750, 54677, 196267, -142451, -5100, -78643, -178278, 65834, 38547, -155735, 161411, -4486, -31958, 228603, -151685, -134216, 161963, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_o -- (+94 chars; full line in the Zenodo source)
pair_one 67 24 114370742 [-256318, 228603, 78643, 11270, 168910, -178278, 31958, 29954, -19697, 56640, -151685, 5100, 151964, -227384, 65834, 4486, -187310, 293446, -24750, -134216, 142451, -89621, 8122, 38547, -161411, -42322, -74044, 54677, 161963, -196267, 221105, 145365, -155735, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_bl -- (+90 chars; full line in the Zenodo source)
pair_one 67 25 114370742 [-31958, 227384, -142451, -54677, 145365, -161411, 293446, -151685, 11270, -78643, -56640, 187310, -38547, -221105, 161963, -89621, 65834, 29954, -256318, 178278, -151964, 134216, 74044, -155735, -42322, -24750, 5100, 168910, -228603, 19697, -4486, -8122, 196267, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_o -- (+94 chars; full line in the Zenodo source)
pair_one 67 26 114370742 [-65834, 196267, -89621, 31958, -29954, -8122, 161963, -227384, 256318, -4486, -221105, 142451, -178278, 19697, -38547, 54677, 151964, -228603, 187310, -145365, -134216, 168910, -56640, 161411, -74044, 5100, -78643, -293446, 155735, -24750, 11270, 151685, 42322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of -- (+93 chars; full line in the Zenodo source)
pair_one 67 27 114370742 [-8122, 142451, -228603, 161411, -24750, -11270, 74044, -187310, 178278, -161963, 65834, -29954, -221105, 151964, -56640, 155735, -151685, -5100, 145365, -19697, 227384, -196267, 31958, -4486, 54677, 168910, -293446, -42322, 78643, 134216, 38547, -256318, 89621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of -- (+93 chars; full line in the Zenodo source)
pair_one 67 28 114370742 [-221105, 168910, 42322, 56640, -142451, 65834, -4486, -134216, 151685, -161411, 178278, -196267, 256318, -145365, 11270, 74044, -19697, 89621, -227384, 187310, -24750, -5100, 38547, -31958, 161963, -228603, 155735, 78643, -54677, 29954, -8122, 151964, -293446, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_ -- (+92 chars; full line in the Zenodo source)
pair_one 67 29 114370742 [54677, 151685, -187310, 89621, -178278, 155735, -168910, 8122, -4486, 5100, 74044, -256318, 161963, -56640, 293446, -142451, 31958, -145365, -11270, 38547, -65834, 151964, 42322, 228603, -196267, 19697, -24750, 134216, 29954, -221105, -78643, -161411, 227384, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_b -- (+91 chars; full line in the Zenodo source)
pair_one 67 30 114370742 [-134216, 74044, -31958, 151964, -155735, 227384, -178278, -42322, -142451, 256318, -24750, -54677, -29954, 5100, 145365, -65834, 168910, -161411, 89621, -228603, 293446, -161963, 19697, -151685, 221105, -4486, 11270, 38547, -8122, -78643, -187310, 196267, -56640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_ -- (+95 chars; full line in the Zenodo source)
pair_one 67 31 114370742 [5100, 38547, -221105, 24750, -31958, 168910, -187310, 161963, 42322, 227384, -228603, 56640, -89621, 155735, -142451, 19697, 78643, 65834, -74044, -54677, -4486, -11270, 29954, -134216, 145365, -8122, 151685, -256318, 151964, -161411, 196267, -293446, 178278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_b -- (+91 chars; full line in the Zenodo source)
pair_one 67 32 114370742 [11270, 29954, 5100, 4486, -134216, 38547, 54677, 145365, -221105, 74044, -8122, 24750, -65834, 151685, -31958, -78643, -256318, 168910, -19697, 151964, -187310, 142451, -161411, 161963, -155735, 196267, 42322, 89621, -293446, 227384, -56640, 178278, -228603, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Nat.le_of_bl -- (+90 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_0 : certF 71 0 551358878 [-114456, -311331, 110811, 111742, -449812, -352673, -535326, -599584, -757504, -267280, -717396, -338799, -572790, -538763, -712095, -454439, -1265923, -349082, -734663, -535695, -722324, -246905, -1294140, -223103, -844213, -674864, -741908, 51631, -797306, 248998, -1081361, -207913, -45130, 805251, -372891, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+71 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_1 : certF 71 1 551358878 [-311331, 111742, -352673, -599584, -267280, -338799, -538763, -454439, -349082, -535695, -246905, -223103, -674864, 51631, 248998, -207913, 805251, 372891, 45130, 1081361, 797306, 741908, 844213, 1294140, 722324, 734663, 1265923, 712095, 572790, 717396, 757504, 535326, 449812, -110811, 114456, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+55 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_2 : certF 71 2 551358878 [110811, -352673, -757504, -338799, -712095, -349082, -722324, -223103, -741908, 248998, -45130, 372891, 207913, 797306, 674864, 1294140, 535695, 1265923, 538763, 717396, 599584, 449812, 311331, -114456, 111742, -535326, -267280, -572790, -454439, -734663, -246905, -844213, 51631, -1081361, 805251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+59 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_3 : certF 71 3 551358878 [111742, -599584, -338799, -454439, -535695, -223103, 51631, -207913, 372891, 1081361, 741908, 1294140, 734663, 712095, 717396, 535326, -110811, -114456, -449812, -757504, -572790, -1265923, -722324, -844213, -797306, -45130, -805251, -248998, 674864, 246905, 349082, 538763, 267280, 352673, 311331, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+59 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_4 : certF 71 4 551358878 [-449812, -267280, -712095, -535695, -844213, 248998, -372891, 1081361, 674864, 722324, 454439, 717396, 352673, 114456, 111742, -757504, -538763, -734663, -223103, -797306, 805251, 207913, 741908, 246905, 1265923, 338799, 535326, 311331, 110811, -599584, -572790, -349082, -1294140, 51631, -45130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+57 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_5 : certF 71 5 551358878 [-352673, -338799, -349082, -223103, 248998, 372891, 797306, 1294140, 1265923, 717396, 449812, -114456, -535326, -572790, -734663, -844213, -1081361, -805251, -51631, 246905, 454439, 267280, -111742, -311331, -599584, -538763, -535695, -674864, -207913, 45130, 741908, 722324, 712095, 757504, -110811, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_6 : certF 71 6 551358878 [-535326, -538763, -722324, 51631, -372891, 797306, 246905, 712095, 599584, 114456, -352673, -572790, -535695, -741908, 805251, -248998, 1294140, 454439, 757504, 311331, -449812, -338799, -734663, -674864, -45130, 1081361, 223103, 1265923, 267280, -110811, 111742, -717396, -349082, -844213, -207913, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_7 : certF 71 7 551358878 [-599584, -454439, -223103, -207913, 1081361, 1294140, 712095, 535326, -114456, -757504, -1265923, -844213, -45130, -248998, 246905, 538763, 352673, -311331, -267280, -349082, -674864, 805251, 797306, 722324, 572790, 449812, 110811, -717396, -734663, -741908, -372891, -51631, 535695, 338799, -111742, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_8 : certF 71 8 551358878 [-757504, -349082, -741908, 372891, 674864, 1265923, 599584, -114456, -267280, -734663, 51631, -805251, 844213, 454439, 535326, -311331, -717396, -535695, -797306, 45130, 223103, 712095, 352673, 110811, -338799, -722324, 248998, 207913, 1294140, 538763, 449812, 111742, -572790, -246905, -1081361, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+57 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_9 : certF 71 9 551358878 [-267280, -535695, 248998, 1081361, 722324, 717396, 114456, -757504, -734663, -797306, 207913, 246905, 338799, 311331, -599584, -349082, 51631, 45130, 1294140, 572790, -110811, -535326, -1265923, -741908, -805251, 223103, 538763, -111742, -352673, -454439, -674864, 372891, 844213, 712095, 449812, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+57 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_10 : certF 71 10 551358878 [-717396, -246905, -45130, 741908, 454439, 449812, -352673, -1265923, 51631, 207913, 722324, 267280, -114456, -338799, -1294140, 805251, 674864, 712095, -111742, -535326, -349082, -797306, 1081361, 535695, 757504, -311331, -572790, -223103, -372891, 844213, 538763, -110811, -599584, -734663, 248998, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+62 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_11 : certF 71 11 551358878 [-338799, -223103, 372891, 1294140, 717396, -114456, -572790, -844213, -805251, 246905, 267280, -311331, -538763, -674864, 45130, 722324, 757504, 110811, -712095, -741908, 207913, 535695, 599584, 111742, -454439, 51631, 1081361, 734663, 535326, -449812, -1265923, -797306, -248998, 349082, 352673, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+59 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_12 : certF 71 12 551358878 [-572790, -674864, 207913, 734663, 352673, -535326, -535695, -45130, 844213, 338799, -114456, -538763, -741908, 1081361, 349082, 449812, -599584, -722324, 805251, 223103, 717396, -311331, -712095, 51631, -248998, 1265923, -111742, -757504, -246905, -372891, 1294140, 267280, 110811, -454439, -797306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+62 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_13 : certF 71 13 551358878 [-538763, 51631, 797306, 712095, 114456, -572790, -741908, -248998, 454439, 311331, -338799, -674864, 1081361, 1265923, -110811, -717396, -844213, 207913, 349082, -111742, -267280, -223103, 45130, 734663, 449812, -757504, -1294140, -805251, 535695, 352673, -599584, -246905, 372891, 722324, 535326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_14 : certF 71 14 551358878 [-712095, 248998, 674864, 717396, 111742, -734663, 805251, 246905, 535326, -599584, -1294140, 45130, 349082, -110811, -338799, -741908, 797306, 538763, -114456, -454439, -1081361, 844213, 267280, -449812, -535695, -372891, 722324, 352673, -757504, -223103, 207913, 1265923, 311331, -572790, 51631, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+59 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_15 : certF 71 15 551358878 [-454439, -207913, 1294140, 535326, -757504, -844213, -248998, 538763, -311331, -349082, 805251, 722324, 449812, -717396, -741908, -51631, 338799, 111742, -535695, 372891, 734663, -110811, -572790, -797306, 674864, 267280, -352673, -246905, 45130, 1265923, 114456, -712095, -1081361, 223103, 599584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_16 : certF 71 16 551358878 [-1265923, 805251, 535695, -110811, -538763, -1081361, 1294140, 352673, -717396, 51631, 674864, 757504, -599584, -844213, 797306, 338799, -449812, -246905, 207913, 712095, -311331, -734663, 372891, 349082, 114456, -454439, -45130, 722324, -111742, -572790, 248998, 223103, 535326, -267280, -741908, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_17 : certF 71 17 551358878 [-349082, 372891, 1265923, -114456, -734663, -805251, 454439, -311331, -535695, 45130, 712095, 110811, -722324, 207913, 538763, 111742, -246905, 1081361, 572790, -449812, -1294140, -248998, 338799, -352673, -223103, 797306, 717396, -535326, -844213, -51631, 267280, -599584, -674864, 741908, 757504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_18 : certF 71 18 551358878 [-734663, 45130, 538763, -449812, -223103, -51631, 757504, -267280, -797306, 1294140, -111742, -712095, 805251, 349082, -114456, -535695, 207913, 572790, -352673, -844213, 741908, 599584, -717396, 248998, 246905, -110811, -454439, -372891, 1265923, -311331, -722324, 1081361, 338799, -535326, -674864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+63 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_19 : certF 71 19 551358878 [-535695, 1081361, 717396, -757504, -797306, 246905, 311331, -349082, 45130, 572790, -535326, -741908, 223103, -111742, -454439, 372891, 712095, -449812, -844213, 674864, 352673, -538763, 805251, 1265923, 110811, -1294140, -51631, 599584, -338799, -207913, 734663, -114456, -722324, -248998, 267280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_20 : certF 71 20 551358878 [-722324, 797306, 599584, -572790, 805251, 454439, -449812, -674864, 223103, -110811, -349082, 207913, 717396, -267280, -1081361, 734663, -311331, -1294140, 741908, 352673, -712095, 372891, 538763, -535326, 51631, 246905, 114456, -535695, -248998, 757504, -338799, -45130, 1265923, 111742, -844213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_21 : certF 71 21 551358878 [-246905, 741908, 449812, -1265923, 207913, 267280, -338799, 805251, 712095, -535326, -797306, 535695, -311331, -223103, 844213, -110811, -734663, -248998, 599584, -538763, 372891, 572790, -757504, -1081361, 349082, 111742, -674864, 1294140, 114456, -722324, -51631, 352673, -454439, 45130, 717396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_22 : certF 71 22 551358878 [-1294140, 844213, 311331, -722324, 741908, -111742, -734663, 797306, 352673, -1265923, 1081361, 599584, -712095, 45130, 267280, -572790, 372891, 338799, -717396, 805251, 538763, -757504, -207913, 454439, -535326, 248998, 349082, -449812, 51631, 535695, 110811, -674864, 246905, -114456, -223103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+58 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_23 : certF 71 23 551358878 [-223103, 1294140, -114456, -844213, 246905, -311331, -674864, 722324, 110811, -741908, 535695, 111742, 51631, 734663, -449812, -797306, 349082, -352673, 248998, 1265923, -535326, -1081361, 454439, -599584, -207913, 712095, -757504, -45130, 538763, -267280, 805251, 572790, -717396, -372891, 338799, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_24 : certF 71 24 551358878 [-844213, 722324, 111742, -797306, 1265923, -599584, -45130, 572790, -338799, -805251, 757504, -454439, -248998, 449812, -535695, 674864, 114456, -223103, 246905, 110811, 51631, 349082, -535326, -207913, 538763, -717396, 372891, 267280, -712095, 1081361, 352673, -734663, 741908, 311331, -1294140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+59 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_25 : certF 71 25 551358878 [-674864, 734663, -535326, -45130, 338799, -538763, 1081361, 449812, -722324, 223103, -311331, 51631, 1265923, -757504, -372891, 267280, -454439, 797306, -110811, -1294140, 246905, 111742, 248998, 712095, -717396, -805251, 599584, -349082, 741908, 114456, -844213, 535695, -352673, -207913, 572790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_26 : certF 71 26 551358878 [-741908, 1265923, -267280, -805251, 535326, -535695, 223103, 110811, 248998, 538763, -572790, 1081361, -111742, -1294140, 722324, -352673, -45130, 717396, -454439, -51631, 114456, -674864, 349082, -757504, 372891, 599584, -734663, 844213, -311331, -797306, 712095, -338799, 207913, 449812, -246905, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_27 : certF 71 27 551358878 [51631, 712095, -572790, -248998, 311331, -674864, 1265923, -717396, 207913, -111742, -223103, 734663, -757504, -805251, 352673, -246905, 722324, -535326, -372891, 599584, -535695, 1294140, -449812, -45130, 267280, -349082, 844213, 110811, -1081361, 338799, -454439, 741908, -114456, -797306, 538763, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+62 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_28 : certF 71 28 551358878 [-797306, 572790, -454439, 674864, 110811, -207913, 267280, -734663, 1294140, -352673, -372891, 535326, -246905, 535695, -757504, 45130, -111742, -844213, 1265923, -338799, -248998, 114456, 51631, 538763, -712095, 741908, -311331, -1081361, 717396, -349082, 223103, -449812, 805251, 599584, -722324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_29 : certF 71 29 551358878 [248998, 717396, -734663, 246905, -599584, 45130, -110811, -741908, 538763, -454439, 844213, -449812, -372891, 352673, -223103, 1265923, -572790, -51631, -311331, -207913, 757504, -722324, 535695, -267280, 1081361, 114456, -797306, 338799, -349082, 1294140, -535326, -805251, -111742, -674864, 712095, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+63 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_30 : certF 71 30 551358878 [-1081361, 757504, -246905, 349082, -572790, 741908, 111742, -372891, 449812, -674864, 538763, -1265923, 1294140, -599584, 207913, 114456, 248998, 267280, -722324, 734663, -338799, -51631, 110811, 805251, 352673, -844213, 712095, -454439, 223103, -535326, 45130, 311331, -797306, 717396, -535695, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+58 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_31 : certF 71 31 551358878 [-207913, 535326, -844213, 538763, -349082, 722324, -717396, -51631, 111742, 372891, -110811, -797306, 267280, -246905, 1265923, -712095, 223103, -599584, 1081361, -114456, -45130, 352673, -674864, 572790, -734663, 535695, -338799, 741908, -449812, -805251, 311331, 248998, 757504, -1294140, 454439, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+61 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_32 : certF 71 32 551358878 [-45130, 449812, 51631, 267280, -1294140, 712095, -349082, 535695, -572790, 844213, -599584, -248998, 110811, 372891, 311331, -1081361, 535326, -674864, 338799, -722324, 1265923, -454439, 246905, -717396, 741908, -352673, 207913, -114456, 805251, -111742, -797306, 757504, -223103, 538763, -734663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_33 : certF 71 33 551358878 [805251, -110811, -1081361, 352673, 51631, 757504, -844213, 338799, -246905, 712095, -734663, 349082, -454439, 722324, -572790, 223103, -267280, 741908, -535326, -248998, 111742, 45130, -114456, -372891, 311331, -207913, 449812, -797306, 599584, -674864, 717396, -1294140, 538763, -535695, 1265923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF71_34 : certF 71 34 551358878 [-372891, 114456, 805251, 311331, -45130, -110811, -207913, -111742, -1081361, 449812, 248998, 352673, -797306, 535326, 51631, 599584, -741908, 757504, -674864, 267280, -844213, 717396, -223103, 338799, -1294140, 572790, -246905, 538763, -722324, 712095, -535695, 454439, -734663, 1265923, -349082, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+60 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_71 (a : List Nat) (hin : AllIn 70 a) (h : HodgeList 71 a) :
cnt 1 a = cnt 70 a ∧ cnt 2 a = cnt 69 a ∧ cnt 3 a = cnt 68 a ∧ cnt 4 a = cnt 67 a ∧ cnt 5 a = cnt 66 a ∧ cnt 6 a = cnt 65 a ∧ cnt 7 a = cnt 64 a ∧ cnt 8 a = cnt 63 a ∧ cnt 9 a = cnt 62 a ∧ cnt 10 a = cnt 61 a ∧ cnt 11 a = cnt 60 a ∧ cnt 12 a = cnt 59 a ∧ cnt 13 a = cnt 58 a ∧ cnt 14 a = cnt 57 a ∧ cnt 15 a = cnt 56 a ∧ cnt 16 a = cnt 55 a ∧ cnt 17 a = cnt 54 a ∧ cnt 18 a = cnt 53 a ∧ cnt 19 a -- (+365 chars; full line in the Zenodo source)
⟨pair_one 71 0 551358878 [-114456, -311331, 110811, 111742, -449812, -352673, -535326, -599584, -757504, -267280, -717396, -338799, -572790, -538763, -712095, -454439, -1265923, -349082, -734663, -535695, -722324, -246905, -1294140, -223103, -844213, -674864, -741908, 51631, -797306, 248998, -1081361, -207913, -45130, 805251, -372891, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+146 chars; full line in the Zenodo source)
pair_one 71 1 551358878 [-311331, 111742, -352673, -599584, -267280, -338799, -538763, -454439, -349082, -535695, -246905, -223103, -674864, 51631, 248998, -207913, 805251, 372891, 45130, 1081361, 797306, 741908, 844213, 1294140, 722324, 734663, 1265923, 712095, 572790, 717396, 757504, 535326, 449812, -110811, 114456, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+130 chars; full line in the Zenodo source)
pair_one 71 2 551358878 [110811, -352673, -757504, -338799, -712095, -349082, -722324, -223103, -741908, 248998, -45130, 372891, 207913, 797306, 674864, 1294140, 535695, 1265923, 538763, 717396, 599584, 449812, 311331, -114456, 111742, -535326, -267280, -572790, -454439, -734663, -246905, -844213, 51631, -1081361, 805251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+134 chars; full line in the Zenodo source)
pair_one 71 3 551358878 [111742, -599584, -338799, -454439, -535695, -223103, 51631, -207913, 372891, 1081361, 741908, 1294140, 734663, 712095, 717396, 535326, -110811, -114456, -449812, -757504, -572790, -1265923, -722324, -844213, -797306, -45130, -805251, -248998, 674864, 246905, 349082, 538763, 267280, 352673, 311331, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+134 chars; full line in the Zenodo source)
pair_one 71 4 551358878 [-449812, -267280, -712095, -535695, -844213, 248998, -372891, 1081361, 674864, 722324, 454439, 717396, 352673, 114456, 111742, -757504, -538763, -734663, -223103, -797306, 805251, 207913, 741908, 246905, 1265923, 338799, 535326, 311331, 110811, -599584, -572790, -349082, -1294140, 51631, -45130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+132 chars; full line in the Zenodo source)
pair_one 71 5 551358878 [-352673, -338799, -349082, -223103, 248998, 372891, 797306, 1294140, 1265923, 717396, 449812, -114456, -535326, -572790, -734663, -844213, -1081361, -805251, -51631, 246905, 454439, 267280, -111742, -311331, -599584, -538763, -535695, -674864, -207913, 45130, 741908, 722324, 712095, 757504, -110811, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 6 551358878 [-535326, -538763, -722324, 51631, -372891, 797306, 246905, 712095, 599584, 114456, -352673, -572790, -535695, -741908, 805251, -248998, 1294140, 454439, 757504, 311331, -449812, -338799, -734663, -674864, -45130, 1081361, 223103, 1265923, 267280, -110811, 111742, -717396, -349082, -844213, -207913, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+135 chars; full line in the Zenodo source)
pair_one 71 7 551358878 [-599584, -454439, -223103, -207913, 1081361, 1294140, 712095, 535326, -114456, -757504, -1265923, -844213, -45130, -248998, 246905, 538763, 352673, -311331, -267280, -349082, -674864, 805251, 797306, 722324, 572790, 449812, 110811, -717396, -734663, -741908, -372891, -51631, 535695, 338799, -111742, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 8 551358878 [-757504, -349082, -741908, 372891, 674864, 1265923, 599584, -114456, -267280, -734663, 51631, -805251, 844213, 454439, 535326, -311331, -717396, -535695, -797306, 45130, 223103, 712095, 352673, 110811, -338799, -722324, 248998, 207913, 1294140, 538763, 449812, 111742, -572790, -246905, -1081361, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+132 chars; full line in the Zenodo source)
pair_one 71 9 551358878 [-267280, -535695, 248998, 1081361, 722324, 717396, 114456, -757504, -734663, -797306, 207913, 246905, 338799, 311331, -599584, -349082, 51631, 45130, 1294140, 572790, -110811, -535326, -1265923, -741908, -805251, 223103, 538763, -111742, -352673, -454439, -674864, 372891, 844213, 712095, 449812, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+132 chars; full line in the Zenodo source)
pair_one 71 10 551358878 [-717396, -246905, -45130, 741908, 454439, 449812, -352673, -1265923, 51631, 207913, 722324, 267280, -114456, -338799, -1294140, 805251, 674864, 712095, -111742, -535326, -349082, -797306, 1081361, 535695, 757504, -311331, -572790, -223103, -372891, 844213, 538763, -110811, -599584, -734663, 248998, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+137 chars; full line in the Zenodo source)
pair_one 71 11 551358878 [-338799, -223103, 372891, 1294140, 717396, -114456, -572790, -844213, -805251, 246905, 267280, -311331, -538763, -674864, 45130, 722324, 757504, 110811, -712095, -741908, 207913, 535695, 599584, 111742, -454439, 51631, 1081361, 734663, 535326, -449812, -1265923, -797306, -248998, 349082, 352673, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+134 chars; full line in the Zenodo source)
pair_one 71 12 551358878 [-572790, -674864, 207913, 734663, 352673, -535326, -535695, -45130, 844213, 338799, -114456, -538763, -741908, 1081361, 349082, 449812, -599584, -722324, 805251, 223103, 717396, -311331, -712095, 51631, -248998, 1265923, -111742, -757504, -246905, -372891, 1294140, 267280, 110811, -454439, -797306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+137 chars; full line in the Zenodo source)
pair_one 71 13 551358878 [-538763, 51631, 797306, 712095, 114456, -572790, -741908, -248998, 454439, 311331, -338799, -674864, 1081361, 1265923, -110811, -717396, -844213, 207913, 349082, -111742, -267280, -223103, 45130, 734663, 449812, -757504, -1294140, -805251, 535695, 352673, -599584, -246905, 372891, 722324, 535326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 14 551358878 [-712095, 248998, 674864, 717396, 111742, -734663, 805251, 246905, 535326, -599584, -1294140, 45130, 349082, -110811, -338799, -741908, 797306, 538763, -114456, -454439, -1081361, 844213, 267280, -449812, -535695, -372891, 722324, 352673, -757504, -223103, 207913, 1265923, 311331, -572790, 51631, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+134 chars; full line in the Zenodo source)
pair_one 71 15 551358878 [-454439, -207913, 1294140, 535326, -757504, -844213, -248998, 538763, -311331, -349082, 805251, 722324, 449812, -717396, -741908, -51631, 338799, 111742, -535695, 372891, 734663, -110811, -572790, -797306, 674864, 267280, -352673, -246905, 45130, 1265923, 114456, -712095, -1081361, 223103, 599584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 16 551358878 [-1265923, 805251, 535695, -110811, -538763, -1081361, 1294140, 352673, -717396, 51631, 674864, 757504, -599584, -844213, 797306, 338799, -449812, -246905, 207913, 712095, -311331, -734663, 372891, 349082, 114456, -454439, -45130, 722324, -111742, -572790, 248998, 223103, 535326, -267280, -741908, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 17 551358878 [-349082, 372891, 1265923, -114456, -734663, -805251, 454439, -311331, -535695, 45130, 712095, 110811, -722324, 207913, 538763, 111742, -246905, 1081361, 572790, -449812, -1294140, -248998, 338799, -352673, -223103, 797306, 717396, -535326, -844213, -51631, 267280, -599584, -674864, 741908, 757504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 18 551358878 [-734663, 45130, 538763, -449812, -223103, -51631, 757504, -267280, -797306, 1294140, -111742, -712095, 805251, 349082, -114456, -535695, 207913, 572790, -352673, -844213, 741908, 599584, -717396, 248998, 246905, -110811, -454439, -372891, 1265923, -311331, -722324, 1081361, 338799, -535326, -674864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+138 chars; full line in the Zenodo source)
pair_one 71 19 551358878 [-535695, 1081361, 717396, -757504, -797306, 246905, 311331, -349082, 45130, 572790, -535326, -741908, 223103, -111742, -454439, 372891, 712095, -449812, -844213, 674864, 352673, -538763, 805251, 1265923, 110811, -1294140, -51631, 599584, -338799, -207913, 734663, -114456, -722324, -248998, 267280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 20 551358878 [-722324, 797306, 599584, -572790, 805251, 454439, -449812, -674864, 223103, -110811, -349082, 207913, 717396, -267280, -1081361, 734663, -311331, -1294140, 741908, 352673, -712095, 372891, 538763, -535326, 51631, 246905, 114456, -535695, -248998, 757504, -338799, -45130, 1265923, 111742, -844213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 21 551358878 [-246905, 741908, 449812, -1265923, 207913, 267280, -338799, 805251, 712095, -535326, -797306, 535695, -311331, -223103, 844213, -110811, -734663, -248998, 599584, -538763, 372891, 572790, -757504, -1081361, 349082, 111742, -674864, 1294140, 114456, -722324, -51631, 352673, -454439, 45130, 717396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 22 551358878 [-1294140, 844213, 311331, -722324, 741908, -111742, -734663, 797306, 352673, -1265923, 1081361, 599584, -712095, 45130, 267280, -572790, 372891, 338799, -717396, 805251, 538763, -757504, -207913, 454439, -535326, 248998, 349082, -449812, 51631, 535695, 110811, -674864, 246905, -114456, -223103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+133 chars; full line in the Zenodo source)
pair_one 71 23 551358878 [-223103, 1294140, -114456, -844213, 246905, -311331, -674864, 722324, 110811, -741908, 535695, 111742, 51631, 734663, -449812, -797306, 349082, -352673, 248998, 1265923, -535326, -1081361, 454439, -599584, -207913, 712095, -757504, -45130, 538763, -267280, 805251, 572790, -717396, -372891, 338799, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 24 551358878 [-844213, 722324, 111742, -797306, 1265923, -599584, -45130, 572790, -338799, -805251, 757504, -454439, -248998, 449812, -535695, 674864, 114456, -223103, 246905, 110811, 51631, 349082, -535326, -207913, 538763, -717396, 372891, 267280, -712095, 1081361, 352673, -734663, 741908, 311331, -1294140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+134 chars; full line in the Zenodo source)
pair_one 71 25 551358878 [-674864, 734663, -535326, -45130, 338799, -538763, 1081361, 449812, -722324, 223103, -311331, 51631, 1265923, -757504, -372891, 267280, -454439, 797306, -110811, -1294140, 246905, 111742, 248998, 712095, -717396, -805251, 599584, -349082, 741908, 114456, -844213, 535695, -352673, -207913, 572790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 26 551358878 [-741908, 1265923, -267280, -805251, 535326, -535695, 223103, 110811, 248998, 538763, -572790, 1081361, -111742, -1294140, 722324, -352673, -45130, 717396, -454439, -51631, 114456, -674864, 349082, -757504, 372891, 599584, -734663, 844213, -311331, -797306, 712095, -338799, 207913, 449812, -246905, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 27 551358878 [51631, 712095, -572790, -248998, 311331, -674864, 1265923, -717396, 207913, -111742, -223103, 734663, -757504, -805251, 352673, -246905, 722324, -535326, -372891, 599584, -535695, 1294140, -449812, -45130, 267280, -349082, 844213, 110811, -1081361, 338799, -454439, 741908, -114456, -797306, 538763, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+137 chars; full line in the Zenodo source)
pair_one 71 28 551358878 [-797306, 572790, -454439, 674864, 110811, -207913, 267280, -734663, 1294140, -352673, -372891, 535326, -246905, 535695, -757504, 45130, -111742, -844213, 1265923, -338799, -248998, 114456, 51631, 538763, -712095, 741908, -311331, -1081361, 717396, -349082, 223103, -449812, 805251, 599584, -722324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 29 551358878 [248998, 717396, -734663, 246905, -599584, 45130, -110811, -741908, 538763, -454439, 844213, -449812, -372891, 352673, -223103, 1265923, -572790, -51631, -311331, -207913, 757504, -722324, 535695, -267280, 1081361, 114456, -797306, 338799, -349082, 1294140, -535326, -805251, -111742, -674864, 712095, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+138 chars; full line in the Zenodo source)
pair_one 71 30 551358878 [-1081361, 757504, -246905, 349082, -572790, 741908, 111742, -372891, 449812, -674864, 538763, -1265923, 1294140, -599584, 207913, 114456, 248998, 267280, -722324, 734663, -338799, -51631, 110811, 805251, 352673, -844213, 712095, -454439, 223103, -535326, 45130, 311331, -797306, 717396, -535695, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+133 chars; full line in the Zenodo source)
pair_one 71 31 551358878 [-207913, 535326, -844213, 538763, -349082, 722324, -717396, -51631, 111742, 372891, -110811, -797306, 267280, -246905, 1265923, -712095, 223103, -599584, 1081361, -114456, -45130, 352673, -674864, 572790, -734663, 535695, -338799, 741908, -449812, -805251, 311331, 248998, 757504, -1294140, 454439, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+136 chars; full line in the Zenodo source)
pair_one 71 32 551358878 [-45130, 449812, 51631, 267280, -1294140, 712095, -349082, 535695, -572790, 844213, -599584, -248998, 110811, 372891, 311331, -1081361, 535326, -674864, 338799, -722324, 1265923, -454439, 246905, -717396, 741908, -352673, 207913, -114456, 805251, -111742, -797306, 757504, -223103, 538763, -734663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 33 551358878 [805251, -110811, -1081361, 352673, 51631, 757504, -844213, 338799, -246905, 712095, -734663, 349082, -454439, 722324, -572790, 223103, -267280, 741908, -535326, -248998, 111742, 45130, -114456, -372891, 311331, -207913, 449812, -797306, 599584, -674864, 717396, -1294140, 538763, -535695, 1265923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
pair_one 71 34 551358878 [-372891, 114456, 805251, 311331, -45130, -110811, -207913, -111742, -1081361, 449812, 248998, 352673, -797306, 535326, 51631, 599584, -741908, 757504, -674864, 267280, -844213, 717396, -223103, 338799, -1294140, 572790, -246905, 538763, -722324, 712095, -535695, 454439, -734663, 1265923, -349082, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+135 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_0 : certF 73 0 1745782882 [-998459, 1049876, -1487210, -1232885, -657238, -1298174, -995794, -840840, -1167534, -2743932, -2002350, 417123, -3495447, -816815, -1585741, -2490900, -2799255, -769259, -2818294, -679755, -2839484, -1368581, -3068028, -1183275, -3041644, 308146, -1595661, -1461531, -1854465, 311828, -2711268, 979388, -1178298, -556099, -1576081, 418268, 0, 0, 0, 0, 0, 0 -- (+105 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_1 : certF 73 1 1745782882 [1049876, -1232885, -1298174, -840840, -2743932, 417123, -816815, -2490900, -769259, -679755, -1368581, -1183275, 308146, -1461531, 311828, 979388, -556099, 418268, 1576081, 1178298, 2711268, 1854465, 1595661, 3041644, 3068028, 2839484, 2818294, 2799255, 1585741, 3495447, 2002350, 1167534, 995794, 657238, 1487210, 998459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+87 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_2 : certF 73 2 1745782882 [-1487210, -1298174, -1167534, 417123, -1585741, -769259, -2839484, -1183275, -1595661, 311828, -1178298, 418268, 556099, 2711268, 1461531, 3041644, 1368581, 2818294, 2490900, 3495447, 2743932, 995794, 1232885, 998459, 1049876, -657238, -840840, -2002350, -816815, -2799255, -679755, -3068028, 308146, -1854465, 979388, -1576081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_3 : certF 73 3 1745782882 [-1232885, -840840, 417123, -2490900, -679755, -1183275, -1461531, 979388, 418268, 1178298, 1854465, 3041644, 2839484, 2799255, 3495447, 1167534, 657238, 998459, -1487210, -995794, -2002350, -1585741, -2818294, -3068028, -1595661, -2711268, -1576081, 556099, -311828, -308146, 1368581, 769259, 816815, 2743932, 1298174, -1049876, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_4 : certF 73 4 1745782882 [-657238, -2743932, -1585741, -679755, -3041644, 311828, -1576081, 1178298, 1461531, 3068028, 769259, 3495447, 840840, 1487210, 1049876, -995794, 417123, -2799255, -1368581, -1595661, 979388, -418268, 2711268, -308146, 2839484, 2490900, 2002350, 1298174, 998459, -1232885, -1167534, -816815, -2818294, -1183275, -1854465, -556099, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_5 : certF 73 5 1745782882 [-1298174, 417123, -769259, -1183275, 311828, 418268, 2711268, 3041644, 2818294, 3495447, 995794, 998459, -657238, -2002350, -2799255, -3068028, -1854465, -1576081, -979388, -308146, 679755, 816815, 840840, -1049876, -1232885, -2743932, -2490900, -1368581, -1461531, -556099, 1178298, 1595661, 2839484, 1585741, 1167534, 1487210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_6 : certF 73 6 1745782882 [-995794, -816815, -2839484, -1461531, -1576081, 2711268, 1183275, 2799255, 2743932, 1487210, -1232885, -2002350, -769259, -3041644, 979388, 556099, 1595661, 679755, 3495447, 1298174, -998459, -840840, -1585741, -1368581, -1854465, 418268, -311828, 3068028, 2490900, 1167534, -1049876, -657238, 417123, -2818294, 308146, -1178298, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_7 : certF 73 7 1745782882 [-840840, -2490900, -1183275, 979388, 1178298, 3041644, 2799255, 1167534, 998459, -995794, -1585741, -3068028, -2711268, 556099, -308146, 769259, 2743932, -1049876, -1298174, -816815, -1368581, 311828, 1576081, 1595661, 2818294, 2002350, 1487210, -657238, -3495447, -2839484, -1854465, -418268, 1461531, 679755, -417123, 1232885, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_8 : certF 73 8 1745782882 [-1167534, -769259, -1595661, 418268, 1461531, 2818294, 2743932, 998459, -840840, -2799255, 308146, -1576081, 1854465, 679755, 2002350, -1049876, -995794, -2490900, -3041644, -556099, -311828, 2839484, -417123, 1487210, -1298174, -1585741, -1183275, -1178298, 2711268, 1368581, 3495447, 1232885, -657238, -816815, -3068028, 979388, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+95 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_9 : certF 73 9 1745782882 [-2743932, -679755, 311828, 1178298, 3068028, 3495447, 1487210, -995794, -2799255, -1595661, -418268, -308146, 2490900, 1298174, -1232885, -816815, -1183275, -556099, 1854465, 2818294, 1167534, -998459, -2002350, -2839484, -2711268, -979388, 1368581, -417123, -1049876, -840840, -769259, -1461531, 1576081, 3041644, 1585741, 657238, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_10 : certF 73 10 1745782882 [-2002350, -1368581, -1178298, 1854465, 769259, 995794, -1232885, -1585741, 308146, -418268, 3041644, 816815, 1487210, -840840, -2818294, 311828, -979388, 2839484, 2743932, -998459, 417123, -3068028, -556099, 1461531, 2799255, 1298174, -657238, -2490900, -1595661, 1576081, 1183275, 3495447, -1049876, -1167534, -679755, -2711268, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_11 : certF 73 11 1745782882 [417123, -1183275, 418268, 3041644, 3495447, 998459, -2002350, -3068028, -1576081, -308146, 816815, -1049876, -2743932, -1368581, -556099, 1595661, 1585741, 1487210, -1167534, -2839484, -1178298, 1461531, 2490900, 1232885, -840840, -679755, 979388, 1854465, 2799255, 657238, -995794, -2818294, -2711268, -311828, 769259, 1298174, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+95 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_12 : certF 73 12 1745782882 [-3495447, 308146, 556099, 2839484, 840840, -657238, -769259, -2711268, 1854465, 2490900, 1487210, -2743932, -3068028, 418268, 1183275, 2002350, 1049876, -1585741, -1461531, -979388, 2818294, 1298174, -995794, -679755, -1178298, 1595661, 816815, 998459, 417123, -3041644, 1576081, 1368581, 1167534, -1232885, -2799255, 311828, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+92 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_13 : certF 73 13 1745782882 [-816815, -1461531, 2711268, 2799255, 1487210, -2002350, -3041644, 556099, 679755, 1298174, -840840, -1368581, 418268, 3068028, 1167534, -657238, -2818294, -1178298, -308146, -417123, 1049876, -2490900, 311828, 1854465, 1585741, 998459, -3495447, -1595661, -979388, 769259, 1232885, -2743932, -1183275, 1576081, 2839484, 995794, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_14 : certF 73 14 1745782882 [-1585741, 311828, 1461531, 3495447, 1049876, -2799255, 979388, -308146, 2002350, -1232885, -2818294, -556099, 1183275, 1167534, -1298174, -2839484, 418268, 1368581, 995794, -840840, -3068028, 1576081, 679755, 657238, -2743932, -3041644, 1178298, 769259, 1487210, 417123, -1595661, 2711268, 2490900, 998459, -816815, -1854465, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+92 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_15 : certF 73 15 1745782882 [-2490900, 979388, 3041644, 1167534, -995794, -3068028, 556099, 769259, -1049876, -816815, 311828, 1595661, 2002350, -657238, -2839484, -418268, 679755, 1232885, 417123, -1461531, 1854465, 3495447, -1487210, -2818294, -1576081, 1368581, 1298174, -2743932, 308146, 2711268, 1585741, -998459, -2799255, -1178298, 1183275, 840840, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_16 : certF 73 16 1745782882 [-2799255, -556099, 1368581, 657238, 417123, -1854465, 1595661, 2743932, -995794, -1183275, -979388, 1585741, 1049876, -2818294, 418268, 679755, 1487210, -816815, -2711268, 3041644, 840840, -1167534, 308146, -311828, 3495447, -1232885, -2839484, 1576081, 769259, 998459, -2490900, -1178298, 3068028, 1298174, -2002350, -1461531, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_17 : certF 73 17 1745782882 [-769259, 418268, 2818294, 998459, -2799255, -1576081, 679755, -1049876, -2490900, -556099, 2839484, 1487210, -1585741, -1178298, 1368581, 1232885, -816815, 979388, 3068028, 657238, -3495447, -2711268, 1183275, 1298174, 417123, 311828, 3041644, 995794, -2002350, -1854465, -308146, 840840, -2743932, -1461531, 1595661, 1167534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_18 : certF 73 18 1745782882 [-2818294, 1576081, 2490900, -1487210, -1368581, -979388, 3495447, -1298174, -3041644, 1854465, 2743932, -1167534, -1461531, -308146, 995794, 417123, -2711268, 3068028, 1232885, -1585741, -556099, 679755, 998459, -769259, -418268, 2799255, 1049876, -2839484, 1178298, 816815, -657238, -1183275, -311828, 2002350, -840840, -1595661, 0, 0, 0, 0, 0, 0, 0, 0, -- (+97 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_19 : certF 73 19 1745782882 [-679755, 1178298, 3495447, -995794, -1595661, -308146, 1298174, -816815, -556099, 2818294, -998459, -2839484, -979388, -417123, -840840, -1461531, 3041644, 657238, -1585741, -1576081, 769259, 1049876, -1368581, 2711268, 2002350, -1167534, -1854465, 1183275, 1232885, -2490900, 418268, 2799255, -1487210, -3068028, -311828, 2743932, 0, 0, 0, 0, 0, 0, 0, 0, -- (+98 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_20 : certF 73 20 1745782882 [-2839484, 2711268, 2743932, -2002350, 979388, 679755, -998459, -1368581, -311828, 1167534, 417123, -1178298, 2818294, 1049876, -3068028, 1854465, 840840, -3495447, -556099, 769259, -1487210, -1183275, 1461531, 995794, -816815, -1576081, 2799255, -1232885, -3041644, 1595661, 1298174, -1585741, 418268, 2490900, -657238, 308146, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_21 : certF 73 21 1745782882 [-1368581, 1854465, 995794, -1585741, -418268, 816815, -840840, 311828, 2839484, -998459, -3068028, 1461531, 1298174, -2490900, 1576081, 3495447, -1167534, -2711268, 679755, 1049876, -1183275, 1595661, 657238, -2799255, 556099, -417123, -2743932, 979388, 2818294, -1487210, -3041644, -308146, 1232885, -769259, 1178298, 2002350, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_22 : certF 73 22 1745782882 [-3068028, 1595661, 1232885, -2818294, 2711268, 840840, -1585741, 1576081, -417123, -2002350, -556099, 2490900, -995794, 311828, 679755, -1487210, 308146, 1183275, 998459, -1368581, 1461531, 657238, -769259, -979388, 1167534, -816815, -418268, 3495447, -2743932, -1178298, 2799255, -1298174, -1854465, 2839484, 1049876, -3041644, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+95 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_23 : certF 73 23 1745782882 [-1183275, 3041644, 998459, -3068028, -308146, -1049876, -1368581, 1595661, 1487210, -2839484, 1461531, 1232885, -679755, 1854465, 657238, -2818294, -311828, 1298174, -769259, 2711268, 995794, -2799255, -979388, 840840, -2490900, 1178298, 1167534, -1585741, 556099, 2743932, -816815, 1576081, 2002350, -3495447, -418268, -417123, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+95 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_24 : certF 73 24 1745782882 [-3041644, 3068028, 1049876, -1595661, 2839484, -1232885, -1854465, 2818294, -1298174, -2711268, 2799255, -840840, -1178298, 1585741, -2743932, -1576081, 3495447, 417123, -418268, 2002350, -816815, 556099, 1167534, -2490900, -979388, 995794, -769259, -311828, 657238, -679755, 1461531, 1487210, -1368581, -308146, 998459, -1183275, 0, 0, 0, 0, 0, 0, 0, 0, -- (+97 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_25 : certF 73 25 1745782882 [308146, 2839484, -657238, -2711268, 2490900, -2743932, 418268, 2002350, -1585741, -979388, 1298174, -679755, 1595661, 998459, -3041644, 1368581, -1232885, 311828, 2799255, -1167534, -1576081, -417123, -816815, 1178298, 995794, -2818294, 1461531, -1049876, -1183275, 3068028, -1487210, -1854465, 769259, -840840, -556099, 3495447, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_26 : certF 73 26 1745782882 [-1595661, 2818294, -840840, -1576081, 2002350, -2490900, -311828, 1487210, -1183275, 1368581, -657238, 979388, 816815, -3495447, 1178298, 1298174, -2839484, 3041644, 1049876, -1854465, 2799255, -2743932, -418268, 1167534, -769259, 1461531, 998459, 308146, 679755, -995794, -556099, -417123, -1585741, 2711268, 1232885, -3068028, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+95 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_27 : certF 73 27 1745782882 [-1461531, 2799255, -2002350, 556099, 1298174, -1368581, 3068028, -657238, -1178298, -417123, -2490900, 1854465, 998459, -1595661, 769259, -2743932, 1576081, 995794, -2839484, 1183275, -1232885, 979388, 3495447, -1585741, -311828, -1049876, 308146, 2818294, -1167534, -418268, 840840, -679755, 3041644, -1487210, -2711268, 816815, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_28 : certF 73 28 1745782882 [-1854465, 1585741, -816815, -311828, 998459, -1461531, 2490900, -3495447, 2711268, -1049876, -1595661, 2799255, 417123, -979388, 1487210, 308146, 769259, -2002350, 1178298, 1232885, -3041644, 2818294, -2743932, 556099, 657238, -1183275, 679755, -1167534, 1576081, 1298174, -3068028, 2839484, -840840, -418268, 995794, -1368581, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+94 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_29 : certF 73 29 1745782882 [311828, 3495447, -2799255, -308146, -1232885, -556099, 1167534, -2839484, 1368581, -840840, 1576081, 657238, -3041644, 769259, 417123, 2711268, 998459, -1854465, 816815, -2490900, 1595661, -1487210, -1178298, 2743932, -679755, 3068028, -995794, -418268, 1298174, -1183275, 2818294, -2002350, -979388, -1049876, -1461531, 1585741, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_30 : certF 73 30 1745782882 [-2711268, 2002350, -679755, 1368581, -1167534, 1178298, -1049876, -1854465, 3495447, -769259, 1183275, -995794, 1576081, 1232885, -1595661, 1585741, -2490900, -308146, -657238, 418268, 1298174, -3041644, 2799255, -816815, 1461531, -1487210, -556099, 840840, -3068028, 2818294, 417123, -311828, -998459, 979388, 2743932, -2839484, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_31 : certF 73 31 1745782882 [979388, 1167534, -3068028, 769259, -816815, 1595661, -657238, -418268, 1232885, -1461531, 3495447, -2818294, 1368581, -2743932, 2711268, -998459, -1178298, 840840, -1183275, 2799255, -1585741, -308146, -1298174, 1576081, 1487210, -1854465, -417123, -679755, 2839484, -2002350, -311828, 1049876, -556099, 995794, -3041644, 2490900, 0, 0, 0, 0, 0, 0, 0, 0, -- (+97 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_32 : certF 73 32 1745782882 [-1178298, 995794, 308146, 816815, -2818294, 2839484, 417123, 1461531, -657238, 1576081, -1049876, -2711268, 1167534, -1183275, 2490900, -2799255, 3068028, -2743932, -311828, -1487210, 418268, 1232885, -1854465, 2002350, -1368581, 769259, -1585741, 3041644, -840840, -979388, -998459, -556099, 1298174, -1595661, 3495447, -679755, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+96 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_33 : certF 73 33 1745782882 [-556099, 657238, -1854465, 2743932, -1183275, 1585741, -2818294, 679755, -816815, 3041644, -1167534, -311828, -1232885, 1576081, 998459, -1178298, 1298174, -1461531, 2002350, -3068028, 2490900, -769259, 2839484, -3495447, -308146, -840840, 2711268, -1487210, -418268, -1049876, 979388, 995794, -1595661, -417123, -1368581, 2799255, 0, 0, 0, 0, 0, 0, 0, 0, -- (+98 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_34 : certF 73 34 1745782882 [-1576081, 1487210, 979388, 1298174, -1854465, 1167534, 308146, -417123, -3068028, 1585741, -679755, 769259, -2799255, 2839484, -816815, 1183275, -2002350, 1595661, -840840, -311828, -657238, 1178298, 1049876, -418268, 998459, -556099, 1232885, -2711268, 995794, -1461531, 2743932, -3041644, 3495447, -1368581, 2490900, -2818294, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+95 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF73_35 : certF 73 35 1745782882 [418268, 998459, -1576081, -1049876, -556099, 1487210, -1178298, 1232885, 979388, 657238, -2711268, 1298174, 311828, 995794, -1854465, 840840, -1461531, 1167534, -1595661, 2743932, 308146, 2002350, -3041644, -417123, -1183275, 3495447, -3068028, 816815, -1368581, 1585741, -2839484, 2490900, -679755, 2799255, -2818294, 769259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+93 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_73 (a : List Nat) (hin : AllIn 72 a) (h : HodgeList 73 a) :
cnt 1 a = cnt 72 a ∧ cnt 2 a = cnt 71 a ∧ cnt 3 a = cnt 70 a ∧ cnt 4 a = cnt 69 a ∧ cnt 5 a = cnt 68 a ∧ cnt 6 a = cnt 67 a ∧ cnt 7 a = cnt 66 a ∧ cnt 8 a = cnt 65 a ∧ cnt 9 a = cnt 64 a ∧ cnt 10 a = cnt 63 a ∧ cnt 11 a = cnt 62 a ∧ cnt 12 a = cnt 61 a ∧ cnt 13 a = cnt 60 a ∧ cnt 14 a = cnt 59 a ∧ cnt 15 a = cnt 58 a ∧ cnt 16 a = cnt 57 a ∧ cnt 17 a = cnt 56 a ∧ cnt 18 a = cnt 55 a ∧ cnt 19 a -- (+387 chars; full line in the Zenodo source)
⟨pair_one 73 0 1745782882 [-998459, 1049876, -1487210, -1232885, -657238, -1298174, -995794, -840840, -1167534, -2743932, -2002350, 417123, -3495447, -816815, -1585741, -2490900, -2799255, -769259, -2818294, -679755, -2839484, -1368581, -3068028, -1183275, -3041644, 308146, -1595661, -1461531, -1854465, 311828, -2711268, 979388, -1178298, -556099, -1576081, 418268, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+180 chars; full line in the Zenodo source)
pair_one 73 1 1745782882 [1049876, -1232885, -1298174, -840840, -2743932, 417123, -816815, -2490900, -769259, -679755, -1368581, -1183275, 308146, -1461531, 311828, 979388, -556099, 418268, 1576081, 1178298, 2711268, 1854465, 1595661, 3041644, 3068028, 2839484, 2818294, 2799255, 1585741, 3495447, 2002350, 1167534, 995794, 657238, 1487210, 998459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+162 chars; full line in the Zenodo source)
pair_one 73 2 1745782882 [-1487210, -1298174, -1167534, 417123, -1585741, -769259, -2839484, -1183275, -1595661, 311828, -1178298, 418268, 556099, 2711268, 1461531, 3041644, 1368581, 2818294, 2490900, 3495447, 2743932, 995794, 1232885, 998459, 1049876, -657238, -840840, -2002350, -816815, -2799255, -679755, -3068028, 308146, -1854465, 979388, -1576081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+168 chars; full line in the Zenodo source)
pair_one 73 3 1745782882 [-1232885, -840840, 417123, -2490900, -679755, -1183275, -1461531, 979388, 418268, 1178298, 1854465, 3041644, 2839484, 2799255, 3495447, 1167534, 657238, 998459, -1487210, -995794, -2002350, -1585741, -2818294, -3068028, -1595661, -2711268, -1576081, 556099, -311828, -308146, 1368581, 769259, 816815, 2743932, 1298174, -1049876, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+168 chars; full line in the Zenodo source)
pair_one 73 4 1745782882 [-657238, -2743932, -1585741, -679755, -3041644, 311828, -1576081, 1178298, 1461531, 3068028, 769259, 3495447, 840840, 1487210, 1049876, -995794, 417123, -2799255, -1368581, -1595661, 979388, -418268, 2711268, -308146, 2839484, 2490900, 2002350, 1298174, 998459, -1232885, -1167534, -816815, -2818294, -1183275, -1854465, -556099, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 5 1745782882 [-1298174, 417123, -769259, -1183275, 311828, 418268, 2711268, 3041644, 2818294, 3495447, 995794, 998459, -657238, -2002350, -2799255, -3068028, -1854465, -1576081, -979388, -308146, 679755, 816815, 840840, -1049876, -1232885, -2743932, -2490900, -1368581, -1461531, -556099, 1178298, 1595661, 2839484, 1585741, 1167534, 1487210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+168 chars; full line in the Zenodo source)
pair_one 73 6 1745782882 [-995794, -816815, -2839484, -1461531, -1576081, 2711268, 1183275, 2799255, 2743932, 1487210, -1232885, -2002350, -769259, -3041644, 979388, 556099, 1595661, 679755, 3495447, 1298174, -998459, -840840, -1585741, -1368581, -1854465, 418268, -311828, 3068028, 2490900, 1167534, -1049876, -657238, 417123, -2818294, 308146, -1178298, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 7 1745782882 [-840840, -2490900, -1183275, 979388, 1178298, 3041644, 2799255, 1167534, 998459, -995794, -1585741, -3068028, -2711268, 556099, -308146, 769259, 2743932, -1049876, -1298174, -816815, -1368581, 311828, 1576081, 1595661, 2818294, 2002350, 1487210, -657238, -3495447, -2839484, -1854465, -418268, 1461531, 679755, -417123, 1232885, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+168 chars; full line in the Zenodo source)
pair_one 73 8 1745782882 [-1167534, -769259, -1595661, 418268, 1461531, 2818294, 2743932, 998459, -840840, -2799255, 308146, -1576081, 1854465, 679755, 2002350, -1049876, -995794, -2490900, -3041644, -556099, -311828, 2839484, -417123, 1487210, -1298174, -1585741, -1183275, -1178298, 2711268, 1368581, 3495447, 1232885, -657238, -816815, -3068028, 979388, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+170 chars; full line in the Zenodo source)
pair_one 73 9 1745782882 [-2743932, -679755, 311828, 1178298, 3068028, 3495447, 1487210, -995794, -2799255, -1595661, -418268, -308146, 2490900, 1298174, -1232885, -816815, -1183275, -556099, 1854465, 2818294, 1167534, -998459, -2002350, -2839484, -2711268, -979388, 1368581, -417123, -1049876, -840840, -769259, -1461531, 1576081, 3041644, 1585741, 657238, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+171 chars; full line in the Zenodo source)
pair_one 73 10 1745782882 [-2002350, -1368581, -1178298, 1854465, 769259, 995794, -1232885, -1585741, 308146, -418268, 3041644, 816815, 1487210, -840840, -2818294, 311828, -979388, 2839484, 2743932, -998459, 417123, -3068028, -556099, 1461531, 2799255, 1298174, -657238, -2490900, -1595661, 1576081, 1183275, 3495447, -1049876, -1167534, -679755, -2711268, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+171 chars; full line in the Zenodo source)
pair_one 73 11 1745782882 [417123, -1183275, 418268, 3041644, 3495447, 998459, -2002350, -3068028, -1576081, -308146, 816815, -1049876, -2743932, -1368581, -556099, 1595661, 1585741, 1487210, -1167534, -2839484, -1178298, 1461531, 2490900, 1232885, -840840, -679755, 979388, 1854465, 2799255, 657238, -995794, -2818294, -2711268, -311828, 769259, 1298174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+170 chars; full line in the Zenodo source)
pair_one 73 12 1745782882 [-3495447, 308146, 556099, 2839484, 840840, -657238, -769259, -2711268, 1854465, 2490900, 1487210, -2743932, -3068028, 418268, 1183275, 2002350, 1049876, -1585741, -1461531, -979388, 2818294, 1298174, -995794, -679755, -1178298, 1595661, 816815, 998459, 417123, -3041644, 1576081, 1368581, 1167534, -1232885, -2799255, 311828, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+167 chars; full line in the Zenodo source)
pair_one 73 13 1745782882 [-816815, -1461531, 2711268, 2799255, 1487210, -2002350, -3041644, 556099, 679755, 1298174, -840840, -1368581, 418268, 3068028, 1167534, -657238, -2818294, -1178298, -308146, -417123, 1049876, -2490900, 311828, 1854465, 1585741, 998459, -3495447, -1595661, -979388, 769259, 1232885, -2743932, -1183275, 1576081, 2839484, 995794, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 14 1745782882 [-1585741, 311828, 1461531, 3495447, 1049876, -2799255, 979388, -308146, 2002350, -1232885, -2818294, -556099, 1183275, 1167534, -1298174, -2839484, 418268, 1368581, 995794, -840840, -3068028, 1576081, 679755, 657238, -2743932, -3041644, 1178298, 769259, 1487210, 417123, -1595661, 2711268, 2490900, 998459, -816815, -1854465, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+167 chars; full line in the Zenodo source)
pair_one 73 15 1745782882 [-2490900, 979388, 3041644, 1167534, -995794, -3068028, 556099, 769259, -1049876, -816815, 311828, 1595661, 2002350, -657238, -2839484, -418268, 679755, 1232885, 417123, -1461531, 1854465, 3495447, -1487210, -2818294, -1576081, 1368581, 1298174, -2743932, 308146, 2711268, 1585741, -998459, -2799255, -1178298, 1183275, 840840, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+168 chars; full line in the Zenodo source)
pair_one 73 16 1745782882 [-2799255, -556099, 1368581, 657238, 417123, -1854465, 1595661, 2743932, -995794, -1183275, -979388, 1585741, 1049876, -2818294, 418268, 679755, 1487210, -816815, -2711268, 3041644, 840840, -1167534, 308146, -311828, 3495447, -1232885, -2839484, 1576081, 769259, 998459, -2490900, -1178298, 3068028, 1298174, -2002350, -1461531, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 17 1745782882 [-769259, 418268, 2818294, 998459, -2799255, -1576081, 679755, -1049876, -2490900, -556099, 2839484, 1487210, -1585741, -1178298, 1368581, 1232885, -816815, 979388, 3068028, 657238, -3495447, -2711268, 1183275, 1298174, 417123, 311828, 3041644, 995794, -2002350, -1854465, -308146, 840840, -2743932, -1461531, 1595661, 1167534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+168 chars; full line in the Zenodo source)
pair_one 73 18 1745782882 [-2818294, 1576081, 2490900, -1487210, -1368581, -979388, 3495447, -1298174, -3041644, 1854465, 2743932, -1167534, -1461531, -308146, 995794, 417123, -2711268, 3068028, 1232885, -1585741, -556099, 679755, 998459, -769259, -418268, 2799255, 1049876, -2839484, 1178298, 816815, -657238, -1183275, -311828, 2002350, -840840, -1595661, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+172 chars; full line in the Zenodo source)
pair_one 73 19 1745782882 [-679755, 1178298, 3495447, -995794, -1595661, -308146, 1298174, -816815, -556099, 2818294, -998459, -2839484, -979388, -417123, -840840, -1461531, 3041644, 657238, -1585741, -1576081, 769259, 1049876, -1368581, 2711268, 2002350, -1167534, -1854465, 1183275, 1232885, -2490900, 418268, 2799255, -1487210, -3068028, -311828, 2743932, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+173 chars; full line in the Zenodo source)
pair_one 73 20 1745782882 [-2839484, 2711268, 2743932, -2002350, 979388, 679755, -998459, -1368581, -311828, 1167534, 417123, -1178298, 2818294, 1049876, -3068028, 1854465, 840840, -3495447, -556099, 769259, -1487210, -1183275, 1461531, 995794, -816815, -1576081, 2799255, -1232885, -3041644, 1595661, 1298174, -1585741, 418268, 2490900, -657238, 308146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 21 1745782882 [-1368581, 1854465, 995794, -1585741, -418268, 816815, -840840, 311828, 2839484, -998459, -3068028, 1461531, 1298174, -2490900, 1576081, 3495447, -1167534, -2711268, 679755, 1049876, -1183275, 1595661, 657238, -2799255, 556099, -417123, -2743932, 979388, 2818294, -1487210, -3041644, -308146, 1232885, -769259, 1178298, 2002350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 22 1745782882 [-3068028, 1595661, 1232885, -2818294, 2711268, 840840, -1585741, 1576081, -417123, -2002350, -556099, 2490900, -995794, 311828, 679755, -1487210, 308146, 1183275, 998459, -1368581, 1461531, 657238, -769259, -979388, 1167534, -816815, -418268, 3495447, -2743932, -1178298, 2799255, -1298174, -1854465, 2839484, 1049876, -3041644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+170 chars; full line in the Zenodo source)
pair_one 73 23 1745782882 [-1183275, 3041644, 998459, -3068028, -308146, -1049876, -1368581, 1595661, 1487210, -2839484, 1461531, 1232885, -679755, 1854465, 657238, -2818294, -311828, 1298174, -769259, 2711268, 995794, -2799255, -979388, 840840, -2490900, 1178298, 1167534, -1585741, 556099, 2743932, -816815, 1576081, 2002350, -3495447, -418268, -417123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+170 chars; full line in the Zenodo source)
pair_one 73 24 1745782882 [-3041644, 3068028, 1049876, -1595661, 2839484, -1232885, -1854465, 2818294, -1298174, -2711268, 2799255, -840840, -1178298, 1585741, -2743932, -1576081, 3495447, 417123, -418268, 2002350, -816815, 556099, 1167534, -2490900, -979388, 995794, -769259, -311828, 657238, -679755, 1461531, 1487210, -1368581, -308146, 998459, -1183275, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+172 chars; full line in the Zenodo source)
pair_one 73 25 1745782882 [308146, 2839484, -657238, -2711268, 2490900, -2743932, 418268, 2002350, -1585741, -979388, 1298174, -679755, 1595661, 998459, -3041644, 1368581, -1232885, 311828, 2799255, -1167534, -1576081, -417123, -816815, 1178298, 995794, -2818294, 1461531, -1049876, -1183275, 3068028, -1487210, -1854465, 769259, -840840, -556099, 3495447, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+171 chars; full line in the Zenodo source)
pair_one 73 26 1745782882 [-1595661, 2818294, -840840, -1576081, 2002350, -2490900, -311828, 1487210, -1183275, 1368581, -657238, 979388, 816815, -3495447, 1178298, 1298174, -2839484, 3041644, 1049876, -1854465, 2799255, -2743932, -418268, 1167534, -769259, 1461531, 998459, 308146, 679755, -995794, -556099, -417123, -1585741, 2711268, 1232885, -3068028, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+170 chars; full line in the Zenodo source)
pair_one 73 27 1745782882 [-1461531, 2799255, -2002350, 556099, 1298174, -1368581, 3068028, -657238, -1178298, -417123, -2490900, 1854465, 998459, -1595661, 769259, -2743932, 1576081, 995794, -2839484, 1183275, -1232885, 979388, 3495447, -1585741, -311828, -1049876, 308146, 2818294, -1167534, -418268, 840840, -679755, 3041644, -1487210, -2711268, 816815, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+171 chars; full line in the Zenodo source)
pair_one 73 28 1745782882 [-1854465, 1585741, -816815, -311828, 998459, -1461531, 2490900, -3495447, 2711268, -1049876, -1595661, 2799255, 417123, -979388, 1487210, 308146, 769259, -2002350, 1178298, 1232885, -3041644, 2818294, -2743932, 556099, 657238, -1183275, 679755, -1167534, 1576081, 1298174, -3068028, 2839484, -840840, -418268, 995794, -1368581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+169 chars; full line in the Zenodo source)
pair_one 73 29 1745782882 [311828, 3495447, -2799255, -308146, -1232885, -556099, 1167534, -2839484, 1368581, -840840, 1576081, 657238, -3041644, 769259, 417123, 2711268, 998459, -1854465, 816815, -2490900, 1595661, -1487210, -1178298, 2743932, -679755, 3068028, -995794, -418268, 1298174, -1183275, 2818294, -2002350, -979388, -1049876, -1461531, 1585741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+171 chars; full line in the Zenodo source)
pair_one 73 30 1745782882 [-2711268, 2002350, -679755, 1368581, -1167534, 1178298, -1049876, -1854465, 3495447, -769259, 1183275, -995794, 1576081, 1232885, -1595661, 1585741, -2490900, -308146, -657238, 418268, 1298174, -3041644, 2799255, -816815, 1461531, -1487210, -556099, 840840, -3068028, 2818294, 417123, -311828, -998459, 979388, 2743932, -2839484, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+171 chars; full line in the Zenodo source)
pair_one 73 31 1745782882 [979388, 1167534, -3068028, 769259, -816815, 1595661, -657238, -418268, 1232885, -1461531, 3495447, -2818294, 1368581, -2743932, 2711268, -998459, -1178298, 840840, -1183275, 2799255, -1585741, -308146, -1298174, 1576081, 1487210, -1854465, -417123, -679755, 2839484, -2002350, -311828, 1049876, -556099, 995794, -3041644, 2490900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+172 chars; full line in the Zenodo source)
pair_one 73 32 1745782882 [-1178298, 995794, 308146, 816815, -2818294, 2839484, 417123, 1461531, -657238, 1576081, -1049876, -2711268, 1167534, -1183275, 2490900, -2799255, 3068028, -2743932, -311828, -1487210, 418268, 1232885, -1854465, 2002350, -1368581, 769259, -1585741, 3041644, -840840, -979388, -998459, -556099, 1298174, -1595661, 3495447, -679755, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+171 chars; full line in the Zenodo source)
pair_one 73 33 1745782882 [-556099, 657238, -1854465, 2743932, -1183275, 1585741, -2818294, 679755, -816815, 3041644, -1167534, -311828, -1232885, 1576081, 998459, -1178298, 1298174, -1461531, 2002350, -3068028, 2490900, -769259, 2839484, -3495447, -308146, -840840, 2711268, -1487210, -418268, -1049876, 979388, 995794, -1595661, -417123, -1368581, 2799255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+173 chars; full line in the Zenodo source)
pair_one 73 34 1745782882 [-1576081, 1487210, 979388, 1298174, -1854465, 1167534, 308146, -417123, -3068028, 1585741, -679755, 769259, -2799255, 2839484, -816815, 1183275, -2002350, 1595661, -840840, -311828, -657238, 1178298, 1049876, -418268, 998459, -556099, 1232885, -2711268, 995794, -1461531, 2743932, -3041644, 3495447, -1368581, 2490900, -2818294, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -- (+170 chars; full line in the Zenodo source)
pair_one 73 35 1745782882 [418268, 998459, -1576081, -1049876, -556099, 1487210, -1178298, 1232885, 979388, 657238, -2711268, 1298174, 311828, 995794, -1854465, 840840, -1461531, 1167534, -1595661, 2743932, 308146, 2002350, -3041644, -417123, -1183275, 3495447, -3068028, 816815, -1368581, 1585741, -2839484, 2490900, -679755, 2799255, -2818294, 769259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_0 : certF 79 0 15823133570 [-555804, 1913516, -5016596, -19480284, -3565664, -1571011, -5514531, -685889, -10879884, -16955614, -15601339, -1116126, -21117189, -7592341, -22065466, -12632014, -19056546, -14909069, -23890979, -4250509, -19037644, -15010384, -28057504, -8961936, -25933684, 1105246, -14250646, -16901116, -23638506, 1071174, -16769514, -1381964, -12210621, -10162151, - -- (+181 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_1 : certF 79 1 15823133570 [1913516, -19480284, -1571011, -685889, -16955614, -1116126, -7592341, -12632014, -14909069, -4250509, -15010384, -8961936, 1105246, -16901116, 1071174, -1381964, -10162151, 16482116, 10891941, 7680706, 15369566, 10226856, 12210621, 16769514, 23638506, 14250646, 25933684, 28057504, 19037644, 23890979, 19056546, 22065466, 21117189, 15601339, 10879884, 5514 -- (+161 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_2 : certF 79 2 15823133570 [-5016596, -1571011, -10879884, -1116126, -22065466, -14909069, -19037644, -8961936, -14250646, 1071174, -12210621, 16482116, -7680706, 15369566, 10162151, 16769514, 16901116, 25933684, 15010384, 23890979, 12632014, 21117189, 16955614, 5514531, 19480284, 555804, 1913516, -3565664, -685889, -15601339, -7592341, -19056546, -4250509, -28057504, 1105246, -236 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_3 : certF 79 3 15823133570 [-19480284, -685889, -1116126, -12632014, -4250509, -8961936, -16901116, -1381964, 16482116, 7680706, 10226856, 16769514, 14250646, 28057504, 23890979, 22065466, 15601339, 5514531, 5016596, -555804, -3565664, -10879884, -21117189, -19056546, -19037644, -25933684, -23638506, -12210621, -15369566, -10891941, 10162151, -1071174, -1105246, 15010384, 14909069, -- (+169 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_4 : certF 79 4 15823133570 [-3565664, -16955614, -22065466, -4250509, -25933684, 1071174, -10226856, 7680706, 10162151, 23638506, 8961936, 23890979, 7592341, 10879884, 19480284, -555804, -1571011, -15601339, -12632014, -19037644, 1105246, -16769514, 16482116, -10891941, 12210621, 16901116, 28057504, 14909069, 21117189, 685889, 5016596, 1913516, -5514531, -1116126, -19056546, -15010 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_5 : certF 79 5 15823133570 [-1571011, -1116126, -14909069, -8961936, 1071174, 16482116, 15369566, 16769514, 25933684, 23890979, 21117189, 5514531, 555804, -3565664, -15601339, -19056546, -28057504, -23638506, -10226856, -10891941, 1381964, -1105246, 4250509, 7592341, 685889, -1913516, -19480284, -16955614, -12632014, -15010384, -16901116, -10162151, 7680706, 12210621, 14250646, 190 -- (+166 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_6 : certF 79 6 15823133570 [-5514531, -7592341, -19037644, -16901116, -10226856, 15369566, -1071174, 28057504, 12632014, 10879884, -1913516, -3565664, -1116126, -23890979, 1105246, -12210621, 7680706, 1381964, 25933684, 14909069, 15601339, 19480284, -5016596, -16955614, -19056546, -8961936, -16769514, 10891941, 10162151, 14250646, 4250509, 21117189, 1571011, -555804, -685889, -2206 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_7 : certF 79 7 15823133570 [-685889, -12632014, -8961936, -1381964, 7680706, 16769514, 28057504, 22065466, 5514531, -555804, -10879884, -19056546, -25933684, -12210621, -10891941, -1071174, 15010384, 7592341, 1571011, 1913516, -16955614, -14909069, 1105246, -10162151, 15369566, 23638506, 19037644, 21117189, 3565664, -5016596, -15601339, -23890979, -14250646, -10226856, -16482116, 1 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_8 : certF 79 8 15823133570 [-10879884, -14909069, -14250646, 16482116, 10162151, 25933684, 12632014, 5514531, 1913516, -15601339, -4250509, -23638506, 10891941, 1381964, 28057504, 7592341, 3565664, -19480284, -21117189, -15010384, -16769514, 7680706, -1071174, 19037644, 1116126, 5016596, -1571011, -22065466, -8961936, -12210621, 15369566, 16901116, 23890979, 16955614, 555804, -6858 -- (+165 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_9 : certF 79 9 15823133570 [-16955614, -4250509, 1071174, 7680706, 23638506, 23890979, 10879884, -555804, -15601339, -19037644, -16769514, -10891941, 16901116, 14909069, 685889, 1913516, -1116126, -15010384, -1381964, 15369566, 14250646, 19056546, 5514531, -5016596, -21117189, -28057504, -12210621, -16482116, -1105246, 12632014, 1571011, -19480284, -7592341, -8961936, -10162151, 10 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_10 : certF 79 10 15823133570 [-15601339, -15010384, -12210621, 10226856, 8961936, 21117189, -1913516, -10879884, -4250509, -16769514, 15369566, -1105246, 22065466, 19480284, -5514531, -14909069, -23638506, 7680706, 16901116, 19056546, 1571011, -3565664, -12632014, -14250646, 10891941, -1071174, 23890979, 685889, -5016596, -7592341, -25933684, 16482116, 1381964, 19037644, 16955614, -- (+171 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_11 : certF 79 11 15823133570 [-1116126, -8961936, 16482116, 16769514, 23890979, 5514531, -3565664, -19056546, -23638506, -10891941, -1105246, 7592341, -1913516, -16955614, -15010384, -10162151, 12210621, 19037644, 10879884, -5016596, -22065466, -14250646, -7680706, 16901116, 12632014, 19480284, -685889, -4250509, -1381964, 10226856, 28057504, 15601339, -555804, -21117189, -25933684 -- (+172 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_12 : certF 79 12 15823133570 [-21117189, 1105246, -7680706, 14250646, 7592341, 555804, -1116126, -25933684, 10891941, 16901116, 22065466, -1913516, -15601339, -8961936, -15369566, 23638506, 12632014, 5016596, -16955614, -28057504, 16482116, -1071174, 19056546, 19480284, -10879884, -15010384, -10226856, 16769514, 14909069, 3565664, -685889, -19037644, -10162151, 1381964, 23890979, 1 -- (+169 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_13 : certF 79 13 15823133570 [-7592341, -16901116, 15369566, 28057504, 10879884, -3565664, -23890979, -12210621, 1381964, 14909069, 19480284, -16955614, -8961936, 10891941, 14250646, 21117189, -555804, -22065466, -23638506, -16482116, 15010384, 685889, -1571011, -4250509, -10162151, 16769514, 19056546, 5016596, -15601339, -25933684, -7680706, -1105246, 1116126, 1913516, -12632014, -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_14 : certF 79 14 15823133570 [-22065466, 1071174, 10162151, 23890979, 19480284, -15601339, 1105246, -10891941, 28057504, 685889, -5514531, -15010384, -15369566, 14250646, 1116126, -5016596, -14909069, -12210621, 16769514, 12632014, 555804, -7592341, -23638506, 10226856, 4250509, 3565664, -16955614, -25933684, 7680706, 8961936, 10879884, -1571011, -19037644, 16482116, 16901116, 2111 -- (+166 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_15 : certF 79 15 15823133570 [-12632014, -1381964, 16769514, 22065466, -555804, -19056546, -12210621, -1071174, 7592341, 1913516, -14909069, -10162151, 23638506, 21117189, -5016596, -23890979, -10226856, 16901116, 1116126, -19480284, -4250509, 16482116, 14250646, 15601339, -3565664, -19037644, -15369566, -1105246, 16955614, -1571011, -15010384, 10891941, 25933684, 10879884, -551453 -- (+171 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_16 : certF 79 16 15823133570 [-19056546, -10162151, 16901116, 15601339, -1571011, -28057504, 7680706, 15010384, 3565664, -1116126, -23638506, 12210621, 12632014, -555804, -14909069, -10226856, 14250646, 16955614, -5514531, -8961936, -10891941, 19037644, 19480284, -21117189, 1071174, 1381964, 22065466, 1913516, -23890979, 16482116, -1105246, 10879884, -685889, -25933684, 15369566, 4 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_17 : certF 79 17 15823133570 [-14909069, 16482116, 25933684, 5514531, -15601339, -23638506, 1381964, 7592341, -19480284, -15010384, 7680706, 19037644, 5016596, -22065466, -12210621, 16901116, 16955614, -685889, 1105246, 10226856, 19056546, -555804, -23890979, -15369566, 8961936, 1571011, -1116126, 1071174, 16769514, 21117189, -3565664, -28057504, -10891941, 4250509, -1913516, -1263 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_18 : certF 79 18 15823133570 [-23890979, 10891941, 15010384, 5016596, -12632014, -10226856, 25933684, 1571011, -21117189, -1381964, 16901116, 10879884, -16955614, -23638506, 16769514, 1116126, -5514531, 1105246, 10162151, 22065466, -19480284, -28057504, 15369566, 14909069, -555804, -4250509, -7680706, 19037644, -1913516, -19056546, 16482116, 8961936, 3565664, -7592341, -12210621, 1 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_19 : certF 79 19 15823133570 [-4250509, 7680706, 23890979, -555804, -19037644, -10891941, 14909069, 1913516, -15010384, 15369566, 19056546, -5016596, -28057504, -16482116, 12632014, -19480284, -8961936, 10226856, 22065466, -3565664, -25933684, 10162151, 7592341, -1571011, 1105246, 12210621, 21117189, -5514531, -14250646, 1381964, 1116126, -685889, -16901116, 16769514, 15601339, -10 -- (+169 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_20 : certF 79 20 15823133570 [-19037644, 15369566, 12632014, -3565664, 1105246, 1381964, 15601339, -16955614, -16769514, 14250646, 1571011, -22065466, 16482116, 15010384, 555804, -4250509, -10891941, 19056546, -19480284, -25933684, 12210621, 1116126, -10879884, 1071174, 16901116, 5514531, -7592341, -10226856, 28057504, -1913516, -23890979, 7680706, 14909069, -5016596, -8961936, 101 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_21 : certF 79 21 15823133570 [-15010384, 10226856, 21117189, -10879884, -16769514, -1105246, 19480284, -14909069, 7680706, 19056546, -3565664, -14250646, -1071174, 685889, -7592341, 16482116, 19037644, -555804, -28057504, 10162151, 1116126, -16955614, -1381964, 25933684, 5016596, -23890979, -10891941, 12632014, -1571011, -16901116, 23638506, 5514531, -22065466, -15369566, 4250509, -- (+169 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_22 : certF 79 22 15823133570 [-28057504, 12210621, 16955614, -21117189, 16482116, 4250509, -5016596, 1105246, -1071174, 5514531, -12632014, -7680706, 19056546, -1571011, -23638506, 14250646, 19480284, -23890979, 15369566, 7592341, -10879884, -1381964, 8961936, 555804, -15010384, 10162151, 15601339, -1116126, -10226856, 19037644, 1913516, -25933684, 16769514, 685889, -22065466, 1089 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_23 : certF 79 23 15823133570 [-8961936, 16769514, 5514531, -19056546, -10891941, 7592341, -16955614, -10162151, 19037644, -5016596, -14250646, 16901116, 19480284, -4250509, 10226856, 15601339, -21117189, -15369566, 14909069, -1571011, 1071174, 25933684, 555804, -28057504, 1381964, 685889, -12632014, 7680706, 22065466, -10879884, -12210621, 15010384, 1913516, 1105246, 23638506, 3565 -- (+166 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_24 : certF 79 24 15823133570 [-25933684, 23638506, 19480284, -19037644, 12210621, 685889, -19056546, 15369566, 1116126, -21117189, 10891941, 12632014, -10879884, -10162151, 4250509, -3565664, 1071174, 8961936, -555804, 1105246, 16901116, 5016596, -15010384, 1381964, 5514531, -14909069, -16482116, 15601339, -7592341, -7680706, 22065466, -16955614, -10226856, 23890979, -1571011, -167 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_25 : certF 79 25 15823133570 [1105246, 14250646, 555804, -25933684, 16901116, -1913516, -8961936, 23638506, 5016596, -28057504, -1071174, 19480284, -15010384, 16769514, 3565664, -19037644, 1381964, 1571011, -4250509, 12210621, 5514531, -23890979, 10162151, 685889, -14909069, 10226856, 10879884, -19056546, -16482116, 16955614, -12632014, 15369566, 15601339, -22065466, -10891941, 111 -- (+165 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_26 : certF 79 26 15823133570 [-14250646, 25933684, 1913516, -23638506, 28057504, -19480284, -16769514, 19037644, -1571011, -12210621, 23890979, -685889, -10226856, 19056546, -16955614, -15369566, 22065466, -1116126, -7680706, 21117189, -7592341, -10891941, 15601339, -12632014, -16482116, 10879884, -14909069, 10162151, 5514531, -4250509, 1381964, 3565664, -15010384, -1071174, 501659 -- (+170 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_27 : certF 79 27 15823133570 [-16901116, 28057504, -3565664, -12210621, 14909069, -16955614, 10891941, 21117189, -22065466, -16482116, 685889, -4250509, 16769514, 5016596, -25933684, -1105246, 1913516, 1071174, 19037644, -5514531, -10226856, 12632014, -1116126, 7680706, 15601339, -19056546, 10162151, 1571011, -15010384, 23638506, 555804, -14250646, 8961936, -19480284, -1381964, 238 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_28 : certF 79 28 15823133570 [-23638506, 19037644, -685889, -15369566, 21117189, -12632014, 10162151, 3565664, -8961936, -1105246, -5016596, -1381964, 14909069, -15601339, 7680706, 16955614, -23890979, 16769514, -1913516, -14250646, 28057504, -1571011, -10226856, 22065466, -7592341, -16482116, 5514531, -15010384, 16901116, -555804, 1071174, 4250509, -10879884, 10891941, 1116126, -1 -- (+170 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_29 : certF 79 29 15823133570 [1071174, 23890979, -15601339, -10891941, 685889, -15010384, 14250646, -5016596, -12210621, 12632014, -7592341, 10226856, 3565664, -25933684, 8961936, -1571011, 16482116, 21117189, -19056546, 1381964, -1913516, -16901116, 19037644, -10879884, -7680706, 16955614, -4250509, 23638506, -555804, -16769514, 14909069, -1116126, 15369566, 5514531, -28057504, -1 -- (+170 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_30 : certF 79 30 15823133570 [-16769514, 19056546, -7592341, 10162151, 5016596, -16901116, 4250509, -15601339, 15369566, 1571011, -25933684, 28057504, -685889, -7680706, 10879884, -15010384, -1105246, -3565664, 16482116, 1116126, -23890979, 23638506, 1913516, -12210621, 22065466, -12632014, 1381964, 555804, 1071174, 14909069, -21117189, 10226856, 19480284, -14250646, 19037644, -169 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_31 : certF 79 31 15823133570 [-1381964, 22065466, -19056546, -1071174, 1913516, -10162151, 21117189, -23890979, 16901116, -19480284, 16482116, 15601339, -19037644, -1105246, -1571011, 10891941, 10879884, -28057504, 8961936, -685889, 7680706, 5514531, -25933684, 15010384, -16955614, 15369566, 3565664, -14250646, 4250509, -1116126, 10226856, 5016596, -23638506, 14909069, -7592341, 12 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_32 : certF 79 32 15823133570 [-12210621, 21117189, -4250509, -1105246, -5514531, 7680706, 1571011, -14250646, 23890979, -7592341, 1381964, -555804, -10162151, 1116126, -19037644, 25933684, -685889, -10891941, 3565664, -16901116, 14909069, -22065466, 16769514, 1913516, -10226856, 15601339, -15010384, 8961936, -10879884, 15369566, 19480284, -23638506, 19056546, -12632014, -1071174, - -- (+170 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_33 : certF 79 33 15823133570 [-10162151, 15601339, -28057504, 15010384, -1116126, 12210621, -555804, -10226856, 16955614, -8961936, 19037644, -21117189, 1381964, 1913516, 16482116, 10879884, -25933684, 4250509, -7592341, 16769514, -5016596, -15369566, 685889, 1105246, 23890979, -22065466, -1071174, -19480284, 10891941, 5514531, -14250646, 14909069, -12632014, 23638506, -3565664, -7 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_34 : certF 79 34 15823133570 [-10226856, 10879884, 1105246, 14909069, -19056546, 14250646, -685889, -16482116, 555804, -10162151, 16955614, -25933684, 23890979, -12632014, 16901116, -5514531, 15369566, -1913516, -12210621, 15601339, -8961936, 4250509, -22065466, 23638506, -1571011, -10891941, 5016596, -1381964, 1116126, -28057504, 19037644, -7592341, -1071174, -3565664, 7680706, 19 -- (+170 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_35 : certF 79 35 15823133570 [16482116, 5514531, -23638506, 7592341, -15010384, 19037644, -22065466, 16901116, -685889, 10226856, -555804, -15369566, 1571011, 1071174, 21117189, -28057504, 4250509, -12632014, 14250646, -10879884, 10162151, 1913516, 10891941, 3565664, -16769514, 1116126, -8961936, 23890979, -19056546, -1105246, -16955614, 12210621, -5016596, -7680706, 19480284, -138 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_36 : certF 79 36 15823133570 [-15369566, 3565664, -1381964, 16955614, -14250646, 22065466, -15010384, 4250509, -19056546, 25933684, -1116126, -1071174, -5514531, 10226856, 1913516, -7680706, 5016596, -10162151, 685889, -23638506, 21117189, -8961936, 14909069, -23890979, 28057504, -7592341, 16901116, -10879884, 12210621, -19480284, -10891941, 555804, 16482116, 1571011, -16769514, 15 -- (+168 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_37 : certF 79 37 15823133570 [10891941, 5016596, -10226856, 1571011, -1381964, 10879884, -23638506, 1116126, 1105246, 22065466, -28057504, 14909069, -4250509, 19037644, -19056546, 8961936, -7592341, 14250646, -15601339, -1071174, -685889, 12210621, -3565664, -16482116, 1913516, 7680706, 555804, -15369566, 19480284, -10162151, 5514531, -16769514, 16955614, -16901116, 21117189, -2593 -- (+167 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF79_38 : certF 79 38 15823133570 [-7680706, 555804, 10891941, -1913516, -15369566, 5016596, 16482116, 19480284, -10226856, 3565664, -10162151, 1571011, -12210621, 5514531, -1381964, 685889, -16769514, 10879884, 1071174, 16955614, -23638506, 15601339, -16901116, 1116126, -14250646, 21117189, 1105246, 7592341, -25933684, 22065466, -8961936, 12632014, -28057504, 19056546, -15010384, 14909 -- (+166 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_79 (a : List Nat) (hin : AllIn 78 a) (h : HodgeList 79 a) :
cnt 1 a = cnt 78 a ∧ cnt 2 a = cnt 77 a ∧ cnt 3 a = cnt 76 a ∧ cnt 4 a = cnt 75 a ∧ cnt 5 a = cnt 74 a ∧ cnt 6 a = cnt 73 a ∧ cnt 7 a = cnt 72 a ∧ cnt 8 a = cnt 71 a ∧ cnt 9 a = cnt 70 a ∧ cnt 10 a = cnt 69 a ∧ cnt 11 a = cnt 68 a ∧ cnt 12 a = cnt 67 a ∧ cnt 13 a = cnt 66 a ∧ cnt 14 a = cnt 65 a ∧ cnt 15 a = cnt 64 a ∧ cnt 16 a = cnt 63 a ∧ cnt 17 a = cnt 62 a ∧ cnt 18 a = cnt 61 a ∧ cnt 19 a -- (+453 chars; full line in the Zenodo source)
⟨pair_one 79 0 15823133570 [-555804, 1913516, -5016596, -19480284, -3565664, -1571011, -5514531, -685889, -10879884, -16955614, -15601339, -1116126, -21117189, -7592341, -22065466, -12632014, -19056546, -14909069, -23890979, -4250509, -19037644, -15010384, -28057504, -8961936, -25933684, 1105246, -14250646, -16901116, -23638506, 1071174, -16769514, -1381964, -12210621, -10162151, -10226856, 1648 -- (+256 chars; full line in the Zenodo source)
pair_one 79 1 15823133570 [1913516, -19480284, -1571011, -685889, -16955614, -1116126, -7592341, -12632014, -14909069, -4250509, -15010384, -8961936, 1105246, -16901116, 1071174, -1381964, -10162151, 16482116, 10891941, 7680706, 15369566, 10226856, 12210621, 16769514, 23638506, 14250646, 25933684, 28057504, 19037644, 23890979, 19056546, 22065466, 21117189, 15601339, 10879884, 5514531, 3565664, -- (+236 chars; full line in the Zenodo source)
pair_one 79 2 15823133570 [-5016596, -1571011, -10879884, -1116126, -22065466, -14909069, -19037644, -8961936, -14250646, 1071174, -12210621, 16482116, -7680706, 15369566, 10162151, 16769514, 16901116, 25933684, 15010384, 23890979, 12632014, 21117189, 16955614, 5514531, 19480284, 555804, 1913516, -3565664, -685889, -15601339, -7592341, -19056546, -4250509, -28057504, 1105246, -23638506, -138196 -- (+243 chars; full line in the Zenodo source)
pair_one 79 3 15823133570 [-19480284, -685889, -1116126, -12632014, -4250509, -8961936, -16901116, -1381964, 16482116, 7680706, 10226856, 16769514, 14250646, 28057504, 23890979, 22065466, 15601339, 5514531, 5016596, -555804, -3565664, -10879884, -21117189, -19056546, -19037644, -25933684, -23638506, -12210621, -15369566, -10891941, 10162151, -1071174, -1105246, 15010384, 14909069, 7592341, 1695 -- (+244 chars; full line in the Zenodo source)
pair_one 79 4 15823133570 [-3565664, -16955614, -22065466, -4250509, -25933684, 1071174, -10226856, 7680706, 10162151, 23638506, 8961936, 23890979, 7592341, 10879884, 19480284, -555804, -1571011, -15601339, -12632014, -19037644, 1105246, -16769514, 16482116, -10891941, 12210621, 16901116, 28057504, 14909069, 21117189, 685889, 5016596, 1913516, -5514531, -1116126, -19056546, -15010384, -14250646 -- (+242 chars; full line in the Zenodo source)
pair_one 79 5 15823133570 [-1571011, -1116126, -14909069, -8961936, 1071174, 16482116, 15369566, 16769514, 25933684, 23890979, 21117189, 5514531, 555804, -3565664, -15601339, -19056546, -28057504, -23638506, -10226856, -10891941, 1381964, -1105246, 4250509, 7592341, 685889, -1913516, -19480284, -16955614, -12632014, -15010384, -16901116, -10162151, 7680706, 12210621, 14250646, 19037644, 2206546 -- (+241 chars; full line in the Zenodo source)
pair_one 79 6 15823133570 [-5514531, -7592341, -19037644, -16901116, -10226856, 15369566, -1071174, 28057504, 12632014, 10879884, -1913516, -3565664, -1116126, -23890979, 1105246, -12210621, 7680706, 1381964, 25933684, 14909069, 15601339, 19480284, -5016596, -16955614, -19056546, -8961936, -16769514, 10891941, 10162151, 14250646, 4250509, 21117189, 1571011, -555804, -685889, -22065466, -1501038 -- (+243 chars; full line in the Zenodo source)
pair_one 79 7 15823133570 [-685889, -12632014, -8961936, -1381964, 7680706, 16769514, 28057504, 22065466, 5514531, -555804, -10879884, -19056546, -25933684, -12210621, -10891941, -1071174, 15010384, 7592341, 1571011, 1913516, -16955614, -14909069, 1105246, -10162151, 15369566, 23638506, 19037644, 21117189, 3565664, -5016596, -15601339, -23890979, -14250646, -10226856, -16482116, 16901116, 42505 -- (+242 chars; full line in the Zenodo source)
pair_one 79 8 15823133570 [-10879884, -14909069, -14250646, 16482116, 10162151, 25933684, 12632014, 5514531, 1913516, -15601339, -4250509, -23638506, 10891941, 1381964, 28057504, 7592341, 3565664, -19480284, -21117189, -15010384, -16769514, 7680706, -1071174, 19037644, 1116126, 5016596, -1571011, -22065466, -8961936, -12210621, 15369566, 16901116, 23890979, 16955614, 555804, -685889, -19056546, -- (+240 chars; full line in the Zenodo source)
pair_one 79 9 15823133570 [-16955614, -4250509, 1071174, 7680706, 23638506, 23890979, 10879884, -555804, -15601339, -19037644, -16769514, -10891941, 16901116, 14909069, 685889, 1913516, -1116126, -15010384, -1381964, 15369566, 14250646, 19056546, 5514531, -5016596, -21117189, -28057504, -12210621, -16482116, -1105246, 12632014, 1571011, -19480284, -7592341, -8961936, -10162151, 10226856, 259336 -- (+242 chars; full line in the Zenodo source)
pair_one 79 10 15823133570 [-15601339, -15010384, -12210621, 10226856, 8961936, 21117189, -1913516, -10879884, -4250509, -16769514, 15369566, -1105246, 22065466, 19480284, -5514531, -14909069, -23638506, 7680706, 16901116, 19056546, 1571011, -3565664, -12632014, -14250646, 10891941, -1071174, 23890979, 685889, -5016596, -7592341, -25933684, 16482116, 1381964, 19037644, 16955614, -555804, -11161 -- (+246 chars; full line in the Zenodo source)
pair_one 79 11 15823133570 [-1116126, -8961936, 16482116, 16769514, 23890979, 5514531, -3565664, -19056546, -23638506, -10891941, -1105246, 7592341, -1913516, -16955614, -15010384, -10162151, 12210621, 19037644, 10879884, -5016596, -22065466, -14250646, -7680706, 16901116, 12632014, 19480284, -685889, -4250509, -1381964, 10226856, 28057504, 15601339, -555804, -21117189, -25933684, -15369566, -1 -- (+247 chars; full line in the Zenodo source)
pair_one 79 12 15823133570 [-21117189, 1105246, -7680706, 14250646, 7592341, 555804, -1116126, -25933684, 10891941, 16901116, 22065466, -1913516, -15601339, -8961936, -15369566, 23638506, 12632014, 5016596, -16955614, -28057504, 16482116, -1071174, 19056546, 19480284, -10879884, -15010384, -10226856, 16769514, 14909069, 3565664, -685889, -19037644, -10162151, 1381964, 23890979, 1571011, -551453 -- (+244 chars; full line in the Zenodo source)
pair_one 79 13 15823133570 [-7592341, -16901116, 15369566, 28057504, 10879884, -3565664, -23890979, -12210621, 1381964, 14909069, 19480284, -16955614, -8961936, 10891941, 14250646, 21117189, -555804, -22065466, -23638506, -16482116, 15010384, 685889, -1571011, -4250509, -10162151, 16769514, 19056546, 5016596, -15601339, -25933684, -7680706, -1105246, 1116126, 1913516, -12632014, 1071174, 102268 -- (+243 chars; full line in the Zenodo source)
pair_one 79 14 15823133570 [-22065466, 1071174, 10162151, 23890979, 19480284, -15601339, 1105246, -10891941, 28057504, 685889, -5514531, -15010384, -15369566, 14250646, 1116126, -5016596, -14909069, -12210621, 16769514, 12632014, 555804, -7592341, -23638506, 10226856, 4250509, 3565664, -16955614, -25933684, 7680706, 8961936, 10879884, -1571011, -19037644, 16482116, 16901116, 21117189, 1913516, -- (+241 chars; full line in the Zenodo source)
pair_one 79 15 15823133570 [-12632014, -1381964, 16769514, 22065466, -555804, -19056546, -12210621, -1071174, 7592341, 1913516, -14909069, -10162151, 23638506, 21117189, -5016596, -23890979, -10226856, 16901116, 1116126, -19480284, -4250509, 16482116, 14250646, 15601339, -3565664, -19037644, -15369566, -1105246, 16955614, -1571011, -15010384, 10891941, 25933684, 10879884, -5514531, -28057504, - -- (+246 chars; full line in the Zenodo source)
pair_one 79 16 15823133570 [-19056546, -10162151, 16901116, 15601339, -1571011, -28057504, 7680706, 15010384, 3565664, -1116126, -23638506, 12210621, 12632014, -555804, -14909069, -10226856, 14250646, 16955614, -5514531, -8961936, -10891941, 19037644, 19480284, -21117189, 1071174, 1381964, 22065466, 1913516, -23890979, 16482116, -1105246, 10879884, -685889, -25933684, 15369566, 4250509, 5016596 -- (+243 chars; full line in the Zenodo source)
pair_one 79 17 15823133570 [-14909069, 16482116, 25933684, 5514531, -15601339, -23638506, 1381964, 7592341, -19480284, -15010384, 7680706, 19037644, 5016596, -22065466, -12210621, 16901116, 16955614, -685889, 1105246, 10226856, 19056546, -555804, -23890979, -15369566, 8961936, 1571011, -1116126, 1071174, 16769514, 21117189, -3565664, -28057504, -10891941, 4250509, -1913516, -12632014, -10162151 -- (+242 chars; full line in the Zenodo source)
pair_one 79 18 15823133570 [-23890979, 10891941, 15010384, 5016596, -12632014, -10226856, 25933684, 1571011, -21117189, -1381964, 16901116, 10879884, -16955614, -23638506, 16769514, 1116126, -5514531, 1105246, 10162151, 22065466, -19480284, -28057504, 15369566, 14909069, -555804, -4250509, -7680706, 19037644, -1913516, -19056546, 16482116, 8961936, 3565664, -7592341, -12210621, 14250646, 685889 -- (+242 chars; full line in the Zenodo source)
pair_one 79 19 15823133570 [-4250509, 7680706, 23890979, -555804, -19037644, -10891941, 14909069, 1913516, -15010384, 15369566, 19056546, -5016596, -28057504, -16482116, 12632014, -19480284, -8961936, 10226856, 22065466, -3565664, -25933684, 10162151, 7592341, -1571011, 1105246, 12210621, 21117189, -5514531, -14250646, 1381964, 1116126, -685889, -16901116, 16769514, 15601339, -10879884, -236385 -- (+244 chars; full line in the Zenodo source)
pair_one 79 20 15823133570 [-19037644, 15369566, 12632014, -3565664, 1105246, 1381964, 15601339, -16955614, -16769514, 14250646, 1571011, -22065466, 16482116, 15010384, 555804, -4250509, -10891941, 19056546, -19480284, -25933684, 12210621, 1116126, -10879884, 1071174, 16901116, 5514531, -7592341, -10226856, 28057504, -1913516, -23890979, 7680706, 14909069, -5016596, -8961936, 10162151, 21117189 -- (+242 chars; full line in the Zenodo source)
pair_one 79 21 15823133570 [-15010384, 10226856, 21117189, -10879884, -16769514, -1105246, 19480284, -14909069, 7680706, 19056546, -3565664, -14250646, -1071174, 685889, -7592341, 16482116, 19037644, -555804, -28057504, 10162151, 1116126, -16955614, -1381964, 25933684, 5016596, -23890979, -10891941, 12632014, -1571011, -16901116, 23638506, 5514531, -22065466, -15369566, 4250509, 1913516, -89619 -- (+244 chars; full line in the Zenodo source)
pair_one 79 22 15823133570 [-28057504, 12210621, 16955614, -21117189, 16482116, 4250509, -5016596, 1105246, -1071174, 5514531, -12632014, -7680706, 19056546, -1571011, -23638506, 14250646, 19480284, -23890979, 15369566, 7592341, -10879884, -1381964, 8961936, 555804, -15010384, 10162151, 15601339, -1116126, -10226856, 19037644, 1913516, -25933684, 16769514, 685889, -22065466, 10891941, 14909069, -- (+242 chars; full line in the Zenodo source)
pair_one 79 23 15823133570 [-8961936, 16769514, 5514531, -19056546, -10891941, 7592341, -16955614, -10162151, 19037644, -5016596, -14250646, 16901116, 19480284, -4250509, 10226856, 15601339, -21117189, -15369566, 14909069, -1571011, 1071174, 25933684, 555804, -28057504, 1381964, 685889, -12632014, 7680706, 22065466, -10879884, -12210621, 15010384, 1913516, 1105246, 23638506, 3565664, -23890979, -- (+241 chars; full line in the Zenodo source)
pair_one 79 24 15823133570 [-25933684, 23638506, 19480284, -19037644, 12210621, 685889, -19056546, 15369566, 1116126, -21117189, 10891941, 12632014, -10879884, -10162151, 4250509, -3565664, 1071174, 8961936, -555804, 1105246, 16901116, 5016596, -15010384, 1381964, 5514531, -14909069, -16482116, 15601339, -7592341, -7680706, 22065466, -16955614, -10226856, 23890979, -1571011, -16769514, 28057504 -- (+242 chars; full line in the Zenodo source)
pair_one 79 25 15823133570 [1105246, 14250646, 555804, -25933684, 16901116, -1913516, -8961936, 23638506, 5016596, -28057504, -1071174, 19480284, -15010384, 16769514, 3565664, -19037644, 1381964, 1571011, -4250509, 12210621, 5514531, -23890979, 10162151, 685889, -14909069, 10226856, 10879884, -19056546, -16482116, 16955614, -12632014, 15369566, 15601339, -22065466, -10891941, 1116126, -7592341, -- (+240 chars; full line in the Zenodo source)
pair_one 79 26 15823133570 [-14250646, 25933684, 1913516, -23638506, 28057504, -19480284, -16769514, 19037644, -1571011, -12210621, 23890979, -685889, -10226856, 19056546, -16955614, -15369566, 22065466, -1116126, -7680706, 21117189, -7592341, -10891941, 15601339, -12632014, -16482116, 10879884, -14909069, 10162151, 5514531, -4250509, 1381964, 3565664, -15010384, -1071174, 5016596, -8961936, 16 -- (+245 chars; full line in the Zenodo source)
pair_one 79 27 15823133570 [-16901116, 28057504, -3565664, -12210621, 14909069, -16955614, 10891941, 21117189, -22065466, -16482116, 685889, -4250509, 16769514, 5016596, -25933684, -1105246, 1913516, 1071174, 19037644, -5514531, -10226856, 12632014, -1116126, 7680706, 15601339, -19056546, 10162151, 1571011, -15010384, 23638506, 555804, -14250646, 8961936, -19480284, -1381964, 23890979, -1087988 -- (+243 chars; full line in the Zenodo source)
pair_one 79 28 15823133570 [-23638506, 19037644, -685889, -15369566, 21117189, -12632014, 10162151, 3565664, -8961936, -1105246, -5016596, -1381964, 14909069, -15601339, 7680706, 16955614, -23890979, 16769514, -1913516, -14250646, 28057504, -1571011, -10226856, 22065466, -7592341, -16482116, 5514531, -15010384, 16901116, -555804, 1071174, 4250509, -10879884, 10891941, 1116126, -19056546, 122106 -- (+245 chars; full line in the Zenodo source)
pair_one 79 29 15823133570 [1071174, 23890979, -15601339, -10891941, 685889, -15010384, 14250646, -5016596, -12210621, 12632014, -7592341, 10226856, 3565664, -25933684, 8961936, -1571011, 16482116, 21117189, -19056546, 1381964, -1913516, -16901116, 19037644, -10879884, -7680706, 16955614, -4250509, 23638506, -555804, -16769514, 14909069, -1116126, 15369566, 5514531, -28057504, -1105246, -194802 -- (+245 chars; full line in the Zenodo source)
pair_one 79 30 15823133570 [-16769514, 19056546, -7592341, 10162151, 5016596, -16901116, 4250509, -15601339, 15369566, 1571011, -25933684, 28057504, -685889, -7680706, 10879884, -15010384, -1105246, -3565664, 16482116, 1116126, -23890979, 23638506, 1913516, -12210621, 22065466, -12632014, 1381964, 555804, 1071174, 14909069, -21117189, 10226856, 19480284, -14250646, 19037644, -16955614, -1089194 -- (+242 chars; full line in the Zenodo source)
pair_one 79 31 15823133570 [-1381964, 22065466, -19056546, -1071174, 1913516, -10162151, 21117189, -23890979, 16901116, -19480284, 16482116, 15601339, -19037644, -1105246, -1571011, 10891941, 10879884, -28057504, 8961936, -685889, 7680706, 5514531, -25933684, 15010384, -16955614, 15369566, 3565664, -14250646, 4250509, -1116126, 10226856, 5016596, -23638506, 14909069, -7592341, 12210621, 555804, -- (+242 chars; full line in the Zenodo source)
pair_one 79 32 15823133570 [-12210621, 21117189, -4250509, -1105246, -5514531, 7680706, 1571011, -14250646, 23890979, -7592341, 1381964, -555804, -10162151, 1116126, -19037644, 25933684, -685889, -10891941, 3565664, -16901116, 14909069, -22065466, 16769514, 1913516, -10226856, 15601339, -15010384, 8961936, -10879884, 15369566, 19480284, -23638506, 19056546, -12632014, -1071174, -5016596, 164821 -- (+245 chars; full line in the Zenodo source)
pair_one 79 33 15823133570 [-10162151, 15601339, -28057504, 15010384, -1116126, 12210621, -555804, -10226856, 16955614, -8961936, 19037644, -21117189, 1381964, 1913516, 16482116, 10879884, -25933684, 4250509, -7592341, 16769514, -5016596, -15369566, 685889, 1105246, 23890979, -22065466, -1071174, -19480284, 10891941, 5514531, -14250646, 14909069, -12632014, 23638506, -3565664, -7680706, 1571011 -- (+243 chars; full line in the Zenodo source)
pair_one 79 34 15823133570 [-10226856, 10879884, 1105246, 14909069, -19056546, 14250646, -685889, -16482116, 555804, -10162151, 16955614, -25933684, 23890979, -12632014, 16901116, -5514531, 15369566, -1913516, -12210621, 15601339, -8961936, 4250509, -22065466, 23638506, -1571011, -10891941, 5016596, -1381964, 1116126, -28057504, 19037644, -7592341, -1071174, -3565664, 7680706, 19480284, -167695 -- (+245 chars; full line in the Zenodo source)
pair_one 79 35 15823133570 [16482116, 5514531, -23638506, 7592341, -15010384, 19037644, -22065466, 16901116, -685889, 10226856, -555804, -15369566, 1571011, 1071174, 21117189, -28057504, 4250509, -12632014, 14250646, -10879884, 10162151, 1913516, 10891941, 3565664, -16769514, 1116126, -8961936, 23890979, -19056546, -1105246, -16955614, 12210621, -5016596, -7680706, 19480284, -1381964, 15601339, -- (+242 chars; full line in the Zenodo source)
pair_one 79 36 15823133570 [-15369566, 3565664, -1381964, 16955614, -14250646, 22065466, -15010384, 4250509, -19056546, 25933684, -1116126, -1071174, -5514531, 10226856, 1913516, -7680706, 5016596, -10162151, 685889, -23638506, 21117189, -8961936, 14909069, -23890979, 28057504, -7592341, 16901116, -10879884, 12210621, -19480284, -10891941, 555804, 16482116, 1571011, -16769514, 15601339, 1105246 -- (+243 chars; full line in the Zenodo source)
pair_one 79 37 15823133570 [10891941, 5016596, -10226856, 1571011, -1381964, 10879884, -23638506, 1116126, 1105246, 22065466, -28057504, 14909069, -4250509, 19037644, -19056546, 8961936, -7592341, 14250646, -15601339, -1071174, -685889, 12210621, -3565664, -16482116, 1913516, 7680706, 555804, -15369566, 19480284, -10162151, 5514531, -16769514, 16955614, -16901116, 21117189, -25933684, 12632014, -- (+242 chars; full line in the Zenodo source)
pair_one 79 38 15823133570 [-7680706, 555804, 10891941, -1913516, -15369566, 5016596, 16482116, 19480284, -10226856, 3565664, -10162151, 1571011, -12210621, 5514531, -1381964, 685889, -16769514, 10879884, 1071174, 16955614, -23638506, 15601339, -16901116, 1116126, -14250646, 21117189, 1105246, 7592341, -25933684, 22065466, -8961936, 12632014, -28057504, 19056546, -15010384, 14909069, -19037644, -- (+241 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_0 : certF 83 0 139144015194 [-33610568, -9667549, -13173785, -3295286, -121399075, -78834667, -69117386, -92449705, -34480535, 10428544, -161781404, -46842896, -183992647, -143884510, -114724501, -14045465, -163988306, -133288738, -123239029, -145046410, -131209964, 9974021, -233287451, -62145544, -169535864, -129118754, -122893403, -69579398, -150848516, -5028230, -167160803, -313 -- (+243 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_1 : certF 83 1 139144015194 [-9667549, -3295286, -78834667, -92449705, 10428544, -46842896, -143884510, -14045465, -133288738, -145046410, 9974021, -62145544, -129118754, -69579398, -5028230, -31329430, -12673546, 64055266, -24635792, 79191130, 132703937, 18033856, 91560662, 136293079, 141616106, 167160803, 150848516, 122893403, 169535864, 233287451, 131209964, 123239029, 163988306 -- (+222 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_2 : certF 83 2 139144015194 [-13173785, -78834667, -34480535, -46842896, -114724501, -133288738, -131209964, -62145544, -122893403, -5028230, -141616106, 64055266, -18033856, 132703937, 24635792, 136293079, 31329430, 150848516, 129118754, 233287451, 145046410, 163988306, 143884510, 161781404, 92449705, 121399075, 9667549, -33610568, -3295286, -69117386, 10428544, -183992647, -14045 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_3 : certF 83 3 139144015194 [-3295286, -92449705, -46842896, -14045465, -145046410, -62145544, -69579398, -31329430, 64055266, 79191130, 18033856, 136293079, 167160803, 122893403, 233287451, 123239029, 114724501, 161781404, 69117386, 13173785, -33610568, -121399075, -34480535, -183992647, -163988306, -131209964, -169535864, -150848516, -141616106, -91560662, -132703937, 24635792, 1 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_4 : certF 83 4 139144015194 [-121399075, 10428544, -114724501, -145046410, -169535864, -5028230, -136293079, 79191130, 24635792, 141616106, 69579398, 233287451, 133288738, 183992647, 92449705, 13173785, -9667549, -69117386, -46842896, -163988306, 9974021, -122893403, -31329430, -91560662, 132703937, -64055266, 167160803, 129118754, 131209964, 14045465, 161781404, 78834667, 33610568 -- (+228 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_5 : certF 83 5 139144015194 [-78834667, -46842896, -133288738, -62145544, -5028230, 64055266, 132703937, 136293079, 150848516, 233287451, 163988306, 161781404, 121399075, -33610568, -69117386, -183992647, -123239029, -169535864, -167160803, -91560662, -79191130, 12673546, 69579398, -9974021, 14045465, -10428544, 3295286, -9667549, -92449705, -143884510, -145046410, -129118754, -313 -- (+228 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_6 : certF 83 6 139144015194 [-69117386, -143884510, -131209964, -69579398, -136293079, 132703937, 12673546, 122893403, 145046410, 183992647, 78834667, -33610568, -92449705, -114724501, 9974021, -150848516, 64055266, -79191130, 141616106, 129118754, 123239029, 46842896, 121399075, -9667549, -34480535, -14045465, -233287451, -5028230, -91560662, 18033856, 31329430, 169535864, 1332887 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_7 : certF 83 7 139144015194 [-92449705, -14045465, -62145544, -31329430, 79191130, 136293079, 122893403, 123239029, 161781404, 13173785, -121399075, -183992647, -131209964, -150848516, -91560662, 24635792, 5028230, -9974021, 143884510, 78834667, -9667549, 10428544, -133288738, -129118754, -12673546, 132703937, 141616106, 169535864, 163988306, 34480535, 33610568, -69117386, -1147245 -- (+226 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_8 : certF 83 8 139144015194 [-34480535, -133288738, -122893403, 64055266, 24635792, 150848516, 145046410, 161781404, 9667549, -69117386, -14045465, -169535864, -12673546, -79191130, 167160803, -9974021, 183992647, 3295286, -121399075, -143884510, -233287451, -31329430, -132703937, 141616106, 62145544, 114724501, 78834667, -13173785, -46842896, -131209964, -5028230, -18033856, 13629 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_9 : certF 83 9 139144015194 [10428544, -145046410, -5028230, 79191130, 141616106, 233287451, 183992647, 13173785, -69117386, -163988306, -122893403, -91560662, -64055266, 129118754, 14045465, 78834667, -3295286, -143884510, -62145544, -12673546, 18033856, 150848516, 123239029, 34480535, -33610568, -161781404, -131209964, -167160803, -132703937, 31329430, -9974021, 46842896, 9667549 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_10 : certF 83 10 139144015194 [-161781404, 9974021, -141616106, 18033856, 69579398, 163988306, 78834667, -121399075, -14045465, -122893403, -24635792, 12673546, 233287451, 46842896, 33610568, 10428544, -131209964, -31329430, -79191130, 150848516, 133288738, 69117386, -3295286, -114724501, -129118754, -91560662, 136293079, 62145544, 183992647, 9667549, -34480535, -145046410, -167160 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_11 : certF 83 11 139144015194 [-46842896, -62145544, 64055266, 136293079, 233287451, 161781404, -33610568, -183992647, -169535864, -91560662, 12673546, -9974021, -10428544, -9667549, -143884510, -129118754, -24635792, 141616106, 131209964, 34480535, -13173785, -114724501, -122893403, -18033856, 31329430, 145046410, 92449705, -3295286, -14045465, -69579398, 79191130, 167160803, 1232 -- (+231 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_12 : certF 83 12 139144015194 [-183992647, -129118754, -18033856, 167160803, 133288738, 121399075, -92449705, -131209964, -12673546, -64055266, 233287451, -10428544, -13173785, -14045465, -150848516, 132703937, 69579398, 114724501, 9667549, -161781404, -62145544, -91560662, 141616106, 145046410, 69117386, -78834667, -123239029, -31329430, 24635792, 169535864, 46842896, -33610568, - -- (+230 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_13 : certF 83 13 139144015194 [-143884510, -69579398, 132703937, 122893403, 183992647, -33610568, -114724501, -150848516, -79191130, 129118754, 46842896, -9667549, -14045465, -5028230, 18033856, 169535864, 161781404, -13173785, -163988306, -167160803, 24635792, 62145544, -10428544, -3295286, -133288738, -31329430, 91560662, 233287451, 34480535, -121399075, -123239029, -141616106, - -- (+232 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_14 : certF 83 14 139144015194 [-114724501, -5028230, 24635792, 233287451, 92449705, -69117386, 9974021, -91560662, 167160803, 14045465, 33610568, -143884510, -150848516, 18033856, 62145544, 34480535, -78834667, -131209964, 64055266, 31329430, 163988306, 9667549, -183992647, -69579398, -79191130, 169535864, -10428544, -121399075, -145046410, -136293079, 141616106, 133288738, 1317378 -- (+228 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_15 : certF 83 15 139144015194 [-14045465, -31329430, 136293079, 123239029, 13173785, -183992647, -150848516, 24635792, -9974021, 78834667, 10428544, -129118754, 132703937, 169535864, 34480535, -69117386, -233287451, -18033856, 69579398, 46842896, -3295286, -145046410, 64055266, 167160803, 114724501, -33610568, -163988306, -141616106, 12673546, 133288738, 9667549, -143884510, -50282 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_16 : certF 83 16 139144015194 [-163988306, -12673546, 31329430, 114724501, -9667549, -123239029, 64055266, 5028230, 183992647, -3295286, -131209964, -24635792, 69579398, 161781404, -78834667, -233287451, 79191130, 129118754, 34480535, -92449705, -169535864, 132703937, 62145544, 69117386, 10428544, -122893403, 18033856, -9974021, 121399075, -46842896, -150848516, 91560662, 145046410 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_17 : certF 83 17 139144015194 [-133288738, 64055266, 150848516, 161781404, -69117386, -169535864, -79191130, -9974021, 3295286, -143884510, -31329430, 141616106, 114724501, -13173785, -131209964, -18033856, 129118754, 92449705, 10428544, -69579398, 91560662, 123239029, 33610568, -163988306, -136293079, 5028230, 46842896, -78834667, -62145544, 132703937, 233287451, 121399075, -18399 -- (+228 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_18 : certF 83 18 139144015194 [-123239029, -24635792, 129118754, 69117386, -46842896, -167160803, 141616106, 143884510, -121399075, -62145544, -79191130, 131209964, 9667549, -163988306, 64055266, 69579398, 34480535, 10428544, -150848516, 136293079, 14045465, -13173785, 9974021, -132703937, 233287451, 3295286, -114724501, -12673546, 5028230, 161781404, -92449705, -122893403, 9156066 -- (+228 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_19 : certF 83 19 139144015194 [-145046410, 79191130, 233287451, 13173785, -163988306, -91560662, 129118754, 78834667, -143884510, -12673546, 150848516, 34480535, -161781404, -167160803, 31329430, 46842896, -92449705, -69579398, 136293079, 114724501, -121399075, -169535864, 24635792, 133288738, -9667549, 9974021, 132703937, 131209964, 33610568, -123239029, -18033856, 62145544, 32952 -- (+226 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_20 : certF 83 20 139144015194 [-131209964, 132703937, 145046410, -33610568, 9974021, -79191130, 123239029, -9667549, -233287451, 18033856, 133288738, -13173785, -62145544, 24635792, 163988306, -3295286, -169535864, 91560662, 14045465, -121399075, -129118754, -64055266, 114724501, -78834667, -122893403, 136293079, 143884510, -69117386, -69579398, 12673546, 183992647, -92449705, -150 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_21 : certF 83 21 139144015194 [9974021, 18033856, 163988306, -121399075, -122893403, 12673546, 46842896, 10428544, -31329430, 150848516, 69117386, -114724501, -91560662, 62145544, 9667549, -145046410, 132703937, 123239029, -13173785, -169535864, -64055266, 143884510, -92449705, -5028230, 167160803, 34480535, -183992647, -136293079, 129118754, 3295286, -133288738, 79191130, 13120996 -- (+226 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_22 : certF 83 22 139144015194 [-233287451, 91560662, 143884510, -34480535, -31329430, 69579398, 121399075, -133288738, -132703937, 123239029, -3295286, -122893403, 141616106, -10428544, -183992647, 64055266, 62145544, 33610568, 9974021, 24635792, 114724501, -92449705, -167160803, 150848516, 78834667, -163988306, 79191130, 145046410, -13173785, -129118754, 12673546, 161781404, -4684 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_23 : certF 83 23 139144015194 [-62145544, 136293079, 161781404, -183992647, -91560662, -9974021, -9667549, -129118754, 141616106, 34480535, -114724501, -18033856, 145046410, -3295286, -69579398, 167160803, 69117386, -163988306, -132703937, 133288738, -78834667, -5028230, 150848516, 121399075, -123239029, -79191130, 14045465, -92449705, -31329430, 122893403, 13173785, -131209964, 24 -- (+230 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_24 : certF 83 24 139144015194 [-169535864, 141616106, 92449705, -163988306, 132703937, 14045465, -34480535, -12673546, 62145544, -33610568, -129118754, 31329430, 69117386, -133288738, -79191130, 114724501, 10428544, -136293079, 233287451, -9667549, -122893403, 167160803, 78834667, -123239029, 18033856, 143884510, -161781404, 64055266, -9974021, -13173785, -69579398, 5028230, 121399 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_25 : certF 83 25 139144015194 [-129118754, 167160803, 121399075, -131209964, -64055266, -10428544, -14045465, 132703937, 114724501, -161781404, -91560662, 145046410, -78834667, -31329430, 169535864, -33610568, -122893403, 5028230, 3295286, 9974021, 136293079, 34480535, -163988306, -79191130, 143884510, -46842896, -24635792, 123239029, -69117386, -141616106, 62145544, -9667549, -695 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_26 : certF 83 26 139144015194 [-122893403, 150848516, 9667549, -169535864, 167160803, 3295286, -233287451, 141616106, 78834667, -131209964, 136293079, 92449705, -123239029, 91560662, -10428544, -163988306, 18033856, 46842896, -114724501, 132703937, 143884510, -183992647, 79191130, 14045465, -161781404, -24635792, 133288738, -34480535, 64055266, 145046410, -69117386, -12673546, -997 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_27 : certF 83 27 139144015194 [-69579398, 122893403, -33610568, -150848516, 129118754, -9667549, -5028230, 169535864, -13173785, -167160803, 62145544, -3295286, -31329430, 233287451, -121399075, -141616106, -9974021, -78834667, -12673546, 131209964, -69117386, -136293079, 145046410, -92449705, 64055266, 123239029, -34480535, -91560662, 133288738, 10428544, -24635792, 163988306, -16 -- (+233 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_28 : certF 83 28 139144015194 [-150848516, 169535864, -3295286, -141616106, 131209964, -92449705, -91560662, 163988306, -46842896, -132703937, 183992647, -14045465, 24635792, 34480535, -145046410, 12673546, 121399075, -62145544, 5028230, 33610568, -69579398, 129118754, -13173785, -31329430, -9974021, -69117386, 64055266, 133288738, -161781404, 79191130, 143884510, -114724501, 18033 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_29 : certF 83 29 139144015194 [-5028230, 233287451, -69117386, -91560662, 14045465, -143884510, 18033856, 34480535, -131209964, 31329430, 9667549, -69579398, 169535864, -121399075, -136293079, 133288738, -46842896, 132703937, 161781404, -123239029, 12673546, 3295286, -129118754, 122893403, -13173785, -141616106, 145046410, 10428544, 79191130, 183992647, -163988306, -64055266, 78834 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_30 : certF 83 30 139144015194 [-167160803, 131209964, 10428544, -132703937, 161781404, -145046410, 31329430, 33610568, -5028230, -9974021, -34480535, 79191130, 46842896, -123239029, 141616106, 9667549, -150848516, 233287451, -92449705, -18033856, 183992647, -133288738, 12673546, 13173785, -69579398, 62145544, -69117386, -24635792, 143884510, -163988306, 136293079, 3295286, -1228934 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_31 : certF 83 31 139144015194 [-31329430, 123239029, -183992647, 24635792, 78834667, -129118754, 169535864, -69117386, -18033856, 46842896, -145046410, 167160803, -33610568, -141616106, 133288738, -143884510, 91560662, 121399075, -122893403, 62145544, -92449705, 79191130, 161781404, -131209964, 5028230, -9667549, -12673546, 163988306, -114724501, -64055266, 3295286, -69579398, 2332 -- (+230 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_32 : certF 83 32 139144015194 [-141616106, 163988306, -14045465, 12673546, 33610568, -31329430, 133288738, -114724501, 136293079, 9667549, -167160803, 123239029, -143884510, -64055266, 13173785, -5028230, 145046410, -183992647, 91560662, 3295286, -150848516, 131209964, -46842896, 24635792, 121399075, -69579398, -9974021, -161781404, 18033856, 78834667, -122893403, 233287451, 104285 -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_33 : certF 83 33 139144015194 [-12673546, 114724501, -123239029, 5028230, -3295286, -24635792, 161781404, -233287451, 129118754, -92449705, 132703937, 69117386, -122893403, -9974021, -46842896, 91560662, 13173785, -167160803, 133288738, -14045465, 141616106, -33610568, -136293079, 143884510, -145046410, 150848516, -121399075, -18033856, -10428544, -62145544, 169535864, -34480535, - -- (+232 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_34 : certF 83 34 139144015194 [-136293079, 183992647, 9974021, 129118754, -34480535, 18033856, 3295286, -167160803, 163988306, -133288738, 5028230, -121399075, 79191130, 92449705, -122893403, 131209964, -143884510, 12673546, -33610568, 64055266, 46842896, -233287451, 169535864, 10428544, 24635792, 13173785, -31329430, 14045465, -123239029, 150848516, -78834667, -132703937, 69117386 -- (+226 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_35 : certF 83 35 139144015194 [64055266, 161781404, -169535864, -9974021, -143884510, 141616106, -13173785, -18033856, 92449705, -69579398, 123239029, -163988306, 5028230, -78834667, 132703937, 121399075, -167160803, 14045465, -145046410, 122893403, -34480535, 24635792, 9667549, -12673546, 183992647, -233287451, 62145544, -46842896, 136293079, -33610568, -91560662, -10428544, -1291 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_36 : certF 83 36 139144015194 [-91560662, 34480535, -69579398, 133288738, -123239029, 122893403, 10428544, -64055266, -33610568, -24635792, 92449705, -150848516, 163988306, -145046410, 129118754, -161781404, 136293079, -9667549, -18033856, 69117386, -5028230, 14045465, -131209964, 169535864, -46842896, 12673546, -13173785, 79191130, 78834667, -167160803, 114724501, 9974021, 6214554 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_37 : certF 83 37 139144015194 [-24635792, 69117386, -167160803, 143884510, -62145544, 131209964, -163988306, 69579398, 10428544, 136293079, -13173785, -132703937, 3295286, -12673546, 161781404, -122893403, 133288738, -145046410, 169535864, -183992647, 31329430, -78834667, 18033856, 33610568, -91560662, 92449705, -5028230, 114724501, -233287451, -9974021, -14045465, 150848516, -3448 -- (+229 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_38 : certF 83 38 139144015194 [-18033856, 121399075, -12673546, -10428544, -150848516, 114724501, -62145544, 145046410, -123239029, 169535864, -143884510, 5028230, -34480535, 136293079, -3295286, -79191130, 33610568, -24635792, 78834667, -141616106, 161781404, -69579398, 14045465, -233287451, 131209964, -133288738, 129118754, -183992647, 167160803, -92449705, -64055266, -13173785, -- (+230 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_39 : certF 83 39 139144015194 [79191130, 13173785, -91560662, 78834667, -12673546, 34480535, -167160803, 46842896, -69579398, 114724501, -169535864, 133288738, 9974021, 131209964, -123239029, 62145544, -14045465, 122893403, -183992647, 5028230, 10428544, 141616106, -69117386, -64055266, -3295286, 18033856, -33610568, -132703937, 9667549, -24635792, 121399075, -136293079, 92449705, -- (+227 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF83_40 : certF 83 40 139144015194 [-132703937, 33610568, 79191130, 9667549, -18033856, 13173785, -24635792, 3295286, -91560662, 121399075, 64055266, 78834667, -136293079, 69117386, -12673546, 92449705, -141616106, 34480535, -31329430, -10428544, -167160803, 161781404, -5028230, 46842896, -150848516, 183992647, -69579398, 143884510, -122893403, 114724501, -129118754, 14045465, -16953586 -- (+227 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_83 (a : List Nat) (hin : AllIn 82 a) (h : HodgeList 83 a) :
cnt 1 a = cnt 82 a ∧ cnt 2 a = cnt 81 a ∧ cnt 3 a = cnt 80 a ∧ cnt 4 a = cnt 79 a ∧ cnt 5 a = cnt 78 a ∧ cnt 6 a = cnt 77 a ∧ cnt 7 a = cnt 76 a ∧ cnt 8 a = cnt 75 a ∧ cnt 9 a = cnt 74 a ∧ cnt 10 a = cnt 73 a ∧ cnt 11 a = cnt 72 a ∧ cnt 12 a = cnt 71 a ∧ cnt 13 a = cnt 70 a ∧ cnt 14 a = cnt 69 a ∧ cnt 15 a = cnt 68 a ∧ cnt 16 a = cnt 67 a ∧ cnt 17 a = cnt 66 a ∧ cnt 18 a = cnt 65 a ∧ cnt 19 a -- (+497 chars; full line in the Zenodo source)
⟨pair_one 83 0 139144015194 [-33610568, -9667549, -13173785, -3295286, -121399075, -78834667, -69117386, -92449705, -34480535, 10428544, -161781404, -46842896, -183992647, -143884510, -114724501, -14045465, -163988306, -133288738, -123239029, -145046410, -131209964, 9974021, -233287451, -62145544, -169535864, -129118754, -122893403, -69579398, -150848516, -5028230, -167160803, -31329430, -141616 -- (+318 chars; full line in the Zenodo source)
pair_one 83 1 139144015194 [-9667549, -3295286, -78834667, -92449705, 10428544, -46842896, -143884510, -14045465, -133288738, -145046410, 9974021, -62145544, -129118754, -69579398, -5028230, -31329430, -12673546, 64055266, -24635792, 79191130, 132703937, 18033856, 91560662, 136293079, 141616106, 167160803, 150848516, 122893403, 169535864, 233287451, 131209964, 123239029, 163988306, 114724501, 1 -- (+297 chars; full line in the Zenodo source)
pair_one 83 2 139144015194 [-13173785, -78834667, -34480535, -46842896, -114724501, -133288738, -131209964, -62145544, -122893403, -5028230, -141616106, 64055266, -18033856, 132703937, 24635792, 136293079, 31329430, 150848516, 129118754, 233287451, 145046410, 163988306, 143884510, 161781404, 92449705, 121399075, 9667549, -33610568, -3295286, -69117386, 10428544, -183992647, -14045465, -12323902 -- (+304 chars; full line in the Zenodo source)
pair_one 83 3 139144015194 [-3295286, -92449705, -46842896, -14045465, -145046410, -62145544, -69579398, -31329430, 64055266, 79191130, 18033856, 136293079, 167160803, 122893403, 233287451, 123239029, 114724501, 161781404, 69117386, 13173785, -33610568, -121399075, -34480535, -183992647, -163988306, -131209964, -169535864, -150848516, -141616106, -91560662, -132703937, 24635792, 12673546, 50282 -- (+302 chars; full line in the Zenodo source)
pair_one 83 4 139144015194 [-121399075, 10428544, -114724501, -145046410, -169535864, -5028230, -136293079, 79191130, 24635792, 141616106, 69579398, 233287451, 133288738, 183992647, 92449705, 13173785, -9667549, -69117386, -46842896, -163988306, 9974021, -122893403, -31329430, -91560662, 132703937, -64055266, 167160803, 129118754, 131209964, 14045465, 161781404, 78834667, 33610568, -3295286, -3 -- (+303 chars; full line in the Zenodo source)
pair_one 83 5 139144015194 [-78834667, -46842896, -133288738, -62145544, -5028230, 64055266, 132703937, 136293079, 150848516, 233287451, 163988306, 161781404, 121399075, -33610568, -69117386, -183992647, -123239029, -169535864, -167160803, -91560662, -79191130, 12673546, 69579398, -9974021, 14045465, -10428544, 3295286, -9667549, -92449705, -143884510, -145046410, -129118754, -31329430, -246357 -- (+303 chars; full line in the Zenodo source)
pair_one 83 6 139144015194 [-69117386, -143884510, -131209964, -69579398, -136293079, 132703937, 12673546, 122893403, 145046410, 183992647, 78834667, -33610568, -92449705, -114724501, 9974021, -150848516, 64055266, -79191130, 141616106, 129118754, 123239029, 46842896, 121399075, -9667549, -34480535, -14045465, -233287451, -5028230, -91560662, 18033856, 31329430, 169535864, 133288738, 161781404, -- (+302 chars; full line in the Zenodo source)
pair_one 83 7 139144015194 [-92449705, -14045465, -62145544, -31329430, 79191130, 136293079, 122893403, 123239029, 161781404, 13173785, -121399075, -183992647, -131209964, -150848516, -91560662, 24635792, 5028230, -9974021, 143884510, 78834667, -9667549, 10428544, -133288738, -129118754, -12673546, 132703937, 141616106, 169535864, 163988306, 34480535, 33610568, -69117386, -114724501, -233287451 -- (+301 chars; full line in the Zenodo source)
pair_one 83 8 139144015194 [-34480535, -133288738, -122893403, 64055266, 24635792, 150848516, 145046410, 161781404, 9667549, -69117386, -14045465, -169535864, -12673546, -79191130, 167160803, -9974021, 183992647, 3295286, -121399075, -143884510, -233287451, -31329430, -132703937, 141616106, 62145544, 114724501, 78834667, -13173785, -46842896, -131209964, -5028230, -18033856, 136293079, 12911875 -- (+304 chars; full line in the Zenodo source)
pair_one 83 9 139144015194 [10428544, -145046410, -5028230, 79191130, 141616106, 233287451, 183992647, 13173785, -69117386, -163988306, -122893403, -91560662, -64055266, 129118754, 14045465, 78834667, -3295286, -143884510, -62145544, -12673546, 18033856, 150848516, 123239029, 34480535, -33610568, -161781404, -131209964, -167160803, -132703937, 31329430, -9974021, 46842896, 9667549, -92449705, - -- (+302 chars; full line in the Zenodo source)
pair_one 83 10 139144015194 [-161781404, 9974021, -141616106, 18033856, 69579398, 163988306, 78834667, -121399075, -14045465, -122893403, -24635792, 12673546, 233287451, 46842896, 33610568, 10428544, -131209964, -31329430, -79191130, 150848516, 133288738, 69117386, -3295286, -114724501, -129118754, -91560662, 136293079, 62145544, 183992647, 9667549, -34480535, -145046410, -167160803, 132703937, -- (+302 chars; full line in the Zenodo source)
pair_one 83 11 139144015194 [-46842896, -62145544, 64055266, 136293079, 233287451, 161781404, -33610568, -183992647, -169535864, -91560662, 12673546, -9974021, -10428544, -9667549, -143884510, -129118754, -24635792, 141616106, 131209964, 34480535, -13173785, -114724501, -122893403, -18033856, 31329430, 145046410, 92449705, -3295286, -14045465, -69579398, 79191130, 167160803, 123239029, 69117386 -- (+306 chars; full line in the Zenodo source)
pair_one 83 12 139144015194 [-183992647, -129118754, -18033856, 167160803, 133288738, 121399075, -92449705, -131209964, -12673546, -64055266, 233287451, -10428544, -13173785, -14045465, -150848516, 132703937, 69579398, 114724501, 9667549, -161781404, -62145544, -91560662, 141616106, 145046410, 69117386, -78834667, -123239029, -31329430, 24635792, 169535864, 46842896, -33610568, -143884510, -122 -- (+305 chars; full line in the Zenodo source)
pair_one 83 13 139144015194 [-143884510, -69579398, 132703937, 122893403, 183992647, -33610568, -114724501, -150848516, -79191130, 129118754, 46842896, -9667549, -14045465, -5028230, 18033856, 169535864, 161781404, -13173785, -163988306, -167160803, 24635792, 62145544, -10428544, -3295286, -133288738, -31329430, 91560662, 233287451, 34480535, -121399075, -123239029, -141616106, -64055266, -9974 -- (+307 chars; full line in the Zenodo source)
pair_one 83 14 139144015194 [-114724501, -5028230, 24635792, 233287451, 92449705, -69117386, 9974021, -91560662, 167160803, 14045465, 33610568, -143884510, -150848516, 18033856, 62145544, 34480535, -78834667, -131209964, 64055266, 31329430, 163988306, 9667549, -183992647, -69579398, -79191130, 169535864, -10428544, -121399075, -145046410, -136293079, 141616106, 133288738, 13173785, -46842896, - -- (+303 chars; full line in the Zenodo source)
pair_one 83 15 139144015194 [-14045465, -31329430, 136293079, 123239029, 13173785, -183992647, -150848516, 24635792, -9974021, 78834667, 10428544, -129118754, 132703937, 169535864, 34480535, -69117386, -233287451, -18033856, 69579398, 46842896, -3295286, -145046410, 64055266, 167160803, 114724501, -33610568, -163988306, -141616106, 12673546, 133288738, 9667549, -143884510, -5028230, 91560662, 1 -- (+302 chars; full line in the Zenodo source)
pair_one 83 16 139144015194 [-163988306, -12673546, 31329430, 114724501, -9667549, -123239029, 64055266, 5028230, 183992647, -3295286, -131209964, -24635792, 69579398, 161781404, -78834667, -233287451, 79191130, 129118754, 34480535, -92449705, -169535864, 132703937, 62145544, 69117386, 10428544, -122893403, 18033856, -9974021, 121399075, -46842896, -150848516, 91560662, 145046410, 13173785, -14 -- (+302 chars; full line in the Zenodo source)
pair_one 83 17 139144015194 [-133288738, 64055266, 150848516, 161781404, -69117386, -169535864, -79191130, -9974021, 3295286, -143884510, -31329430, 141616106, 114724501, -13173785, -131209964, -18033856, 129118754, 92449705, 10428544, -69579398, 91560662, 123239029, 33610568, -163988306, -136293079, 5028230, 46842896, -78834667, -62145544, 132703937, 233287451, 121399075, -183992647, -16716080 -- (+303 chars; full line in the Zenodo source)
pair_one 83 18 139144015194 [-123239029, -24635792, 129118754, 69117386, -46842896, -167160803, 141616106, 143884510, -121399075, -62145544, -79191130, 131209964, 9667549, -163988306, 64055266, 69579398, 34480535, 10428544, -150848516, 136293079, 14045465, -13173785, 9974021, -132703937, 233287451, 3295286, -114724501, -12673546, 5028230, 161781404, -92449705, -122893403, 91560662, 133288738, - -- (+303 chars; full line in the Zenodo source)
pair_one 83 19 139144015194 [-145046410, 79191130, 233287451, 13173785, -163988306, -91560662, 129118754, 78834667, -143884510, -12673546, 150848516, 34480535, -161781404, -167160803, 31329430, 46842896, -92449705, -69579398, 136293079, 114724501, -121399075, -169535864, 24635792, 133288738, -9667549, 9974021, 132703937, 131209964, 33610568, -123239029, -18033856, 62145544, 3295286, -14045465, -- (+301 chars; full line in the Zenodo source)
pair_one 83 20 139144015194 [-131209964, 132703937, 145046410, -33610568, 9974021, -79191130, 123239029, -9667549, -233287451, 18033856, 133288738, -13173785, -62145544, 24635792, 163988306, -3295286, -169535864, 91560662, 14045465, -121399075, -129118754, -64055266, 114724501, -78834667, -122893403, 136293079, 143884510, -69117386, -69579398, 12673546, 183992647, -92449705, -150848516, 1416161 -- (+304 chars; full line in the Zenodo source)
pair_one 83 21 139144015194 [9974021, 18033856, 163988306, -121399075, -122893403, 12673546, 46842896, 10428544, -31329430, 150848516, 69117386, -114724501, -91560662, 62145544, 9667549, -145046410, 132703937, 123239029, -13173785, -169535864, -64055266, 143884510, -92449705, -5028230, 167160803, 34480535, -183992647, -136293079, 129118754, 3295286, -133288738, 79191130, 131209964, -33610568, - -- (+301 chars; full line in the Zenodo source)
pair_one 83 22 139144015194 [-233287451, 91560662, 143884510, -34480535, -31329430, 69579398, 121399075, -133288738, -132703937, 123239029, -3295286, -122893403, 141616106, -10428544, -183992647, 64055266, 62145544, 33610568, 9974021, 24635792, 114724501, -92449705, -167160803, 150848516, 78834667, -163988306, 79191130, 145046410, -13173785, -129118754, 12673546, 161781404, -46842896, -13629307 -- (+302 chars; full line in the Zenodo source)
pair_one 83 23 139144015194 [-62145544, 136293079, 161781404, -183992647, -91560662, -9974021, -9667549, -129118754, 141616106, 34480535, -114724501, -18033856, 145046410, -3295286, -69579398, 167160803, 69117386, -163988306, -132703937, 133288738, -78834667, -5028230, 150848516, 121399075, -123239029, -79191130, 14045465, -92449705, -31329430, 122893403, 13173785, -131209964, 24635792, 1438845 -- (+305 chars; full line in the Zenodo source)
pair_one 83 24 139144015194 [-169535864, 141616106, 92449705, -163988306, 132703937, 14045465, -34480535, -12673546, 62145544, -33610568, -129118754, 31329430, 69117386, -133288738, -79191130, 114724501, 10428544, -136293079, 233287451, -9667549, -122893403, 167160803, 78834667, -123239029, 18033856, 143884510, -161781404, 64055266, -9974021, -13173785, -69579398, 5028230, 121399075, -145046410 -- (+304 chars; full line in the Zenodo source)
pair_one 83 25 139144015194 [-129118754, 167160803, 121399075, -131209964, -64055266, -10428544, -14045465, 132703937, 114724501, -161781404, -91560662, 145046410, -78834667, -31329430, 169535864, -33610568, -122893403, 5028230, 3295286, 9974021, 136293079, 34480535, -163988306, -79191130, 143884510, -46842896, -24635792, 123239029, -69117386, -141616106, 62145544, -9667549, -69579398, 15084851 -- (+304 chars; full line in the Zenodo source)
pair_one 83 26 139144015194 [-122893403, 150848516, 9667549, -169535864, 167160803, 3295286, -233287451, 141616106, 78834667, -131209964, 136293079, 92449705, -123239029, 91560662, -10428544, -163988306, 18033856, 46842896, -114724501, 132703937, 143884510, -183992647, 79191130, 14045465, -161781404, -24635792, 133288738, -34480535, 64055266, 145046410, -69117386, -12673546, -9974021, -12139907 -- (+304 chars; full line in the Zenodo source)
pair_one 83 27 139144015194 [-69579398, 122893403, -33610568, -150848516, 129118754, -9667549, -5028230, 169535864, -13173785, -167160803, 62145544, -3295286, -31329430, 233287451, -121399075, -141616106, -9974021, -78834667, -12673546, 131209964, -69117386, -136293079, 145046410, -92449705, 64055266, 123239029, -34480535, -91560662, 133288738, 10428544, -24635792, 163988306, -161781404, -18033 -- (+308 chars; full line in the Zenodo source)
pair_one 83 28 139144015194 [-150848516, 169535864, -3295286, -141616106, 131209964, -92449705, -91560662, 163988306, -46842896, -132703937, 183992647, -14045465, 24635792, 34480535, -145046410, 12673546, 121399075, -62145544, 5028230, 33610568, -69579398, 129118754, -13173785, -31329430, -9974021, -69117386, 64055266, 133288738, -161781404, 79191130, 143884510, -114724501, 18033856, -10428544, -- (+304 chars; full line in the Zenodo source)
pair_one 83 29 139144015194 [-5028230, 233287451, -69117386, -91560662, 14045465, -143884510, 18033856, 34480535, -131209964, 31329430, 9667549, -69579398, 169535864, -121399075, -136293079, 133288738, -46842896, 132703937, 161781404, -123239029, 12673546, 3295286, -129118754, 122893403, -13173785, -141616106, 145046410, 10428544, 79191130, 183992647, -163988306, -64055266, 78834667, -62145544, -- (+304 chars; full line in the Zenodo source)
pair_one 83 30 139144015194 [-167160803, 131209964, 10428544, -132703937, 161781404, -145046410, 31329430, 33610568, -5028230, -9974021, -34480535, 79191130, 46842896, -123239029, 141616106, 9667549, -150848516, 233287451, -92449705, -18033856, 183992647, -133288738, 12673546, 13173785, -69579398, 62145544, -69117386, -24635792, 143884510, -163988306, 136293079, 3295286, -122893403, 169535864, -- (+304 chars; full line in the Zenodo source)
pair_one 83 31 139144015194 [-31329430, 123239029, -183992647, 24635792, 78834667, -129118754, 169535864, -69117386, -18033856, 46842896, -145046410, 167160803, -33610568, -141616106, 133288738, -143884510, 91560662, 121399075, -122893403, 62145544, -92449705, 79191130, 161781404, -131209964, 5028230, -9667549, -12673546, 163988306, -114724501, -64055266, 3295286, -69579398, 233287451, -3448053 -- (+305 chars; full line in the Zenodo source)
pair_one 83 32 139144015194 [-141616106, 163988306, -14045465, 12673546, 33610568, -31329430, 133288738, -114724501, 136293079, 9667549, -167160803, 123239029, -143884510, -64055266, 13173785, -5028230, 145046410, -183992647, 91560662, 3295286, -150848516, 131209964, -46842896, 24635792, 121399075, -69579398, -9974021, -161781404, 18033856, 78834667, -122893403, 233287451, 10428544, -79191130, -- (+302 chars; full line in the Zenodo source)
pair_one 83 33 139144015194 [-12673546, 114724501, -123239029, 5028230, -3295286, -24635792, 161781404, -233287451, 129118754, -92449705, 132703937, 69117386, -122893403, -9974021, -46842896, 91560662, 13173785, -167160803, 133288738, -14045465, 141616106, -33610568, -136293079, 143884510, -145046410, 150848516, -121399075, -18033856, -10428544, -62145544, 169535864, -34480535, -79191130, 78834 -- (+307 chars; full line in the Zenodo source)
pair_one 83 34 139144015194 [-136293079, 183992647, 9974021, 129118754, -34480535, 18033856, 3295286, -167160803, 163988306, -133288738, 5028230, -121399075, 79191130, 92449705, -122893403, 131209964, -143884510, 12673546, -33610568, 64055266, 46842896, -233287451, 169535864, 10428544, 24635792, 13173785, -31329430, 14045465, -123239029, 150848516, -78834667, -132703937, 69117386, -69579398, 14 -- (+301 chars; full line in the Zenodo source)
pair_one 83 35 139144015194 [64055266, 161781404, -169535864, -9974021, -143884510, 141616106, -13173785, -18033856, 92449705, -69579398, 123239029, -163988306, 5028230, -78834667, 132703937, 121399075, -167160803, 14045465, -145046410, 122893403, -34480535, 24635792, 9667549, -12673546, 183992647, -233287451, 62145544, -46842896, 136293079, -33610568, -91560662, -10428544, -129118754, 13120996 -- (+304 chars; full line in the Zenodo source)
pair_one 83 36 139144015194 [-91560662, 34480535, -69579398, 133288738, -123239029, 122893403, 10428544, -64055266, -33610568, -24635792, 92449705, -150848516, 163988306, -145046410, 129118754, -161781404, 136293079, -9667549, -18033856, 69117386, -5028230, 14045465, -131209964, 169535864, -46842896, 12673546, -13173785, 79191130, 78834667, -167160803, 114724501, 9974021, 62145544, -183992647, -- (+304 chars; full line in the Zenodo source)
pair_one 83 37 139144015194 [-24635792, 69117386, -167160803, 143884510, -62145544, 131209964, -163988306, 69579398, 10428544, 136293079, -13173785, -132703937, 3295286, -12673546, 161781404, -122893403, 133288738, -145046410, 169535864, -183992647, 31329430, -78834667, 18033856, 33610568, -91560662, 92449705, -5028230, 114724501, -233287451, -9974021, -14045465, 150848516, -34480535, -64055266 -- (+304 chars; full line in the Zenodo source)
pair_one 83 38 139144015194 [-18033856, 121399075, -12673546, -10428544, -150848516, 114724501, -62145544, 145046410, -123239029, 169535864, -143884510, 5028230, -34480535, 136293079, -3295286, -79191130, 33610568, -24635792, 78834667, -141616106, 161781404, -69579398, 14045465, -233287451, 131209964, -133288738, 129118754, -183992647, 167160803, -92449705, -64055266, -13173785, 132703937, 9667 -- (+305 chars; full line in the Zenodo source)
pair_one 83 39 139144015194 [79191130, 13173785, -91560662, 78834667, -12673546, 34480535, -167160803, 46842896, -69579398, 114724501, -169535864, 133288738, 9974021, 131209964, -123239029, 62145544, -14045465, 122893403, -183992647, 5028230, 10428544, 141616106, -69117386, -64055266, -3295286, 18033856, -33610568, -132703937, 9667549, -24635792, 121399075, -136293079, 92449705, -31329430, 1617 -- (+302 chars; full line in the Zenodo source)
pair_one 83 40 139144015194 [-132703937, 33610568, 79191130, 9667549, -18033856, 13173785, -24635792, 3295286, -91560662, 121399075, 64055266, 78834667, -136293079, 69117386, -12673546, 92449705, -141616106, 34480535, -31329430, -10428544, -167160803, 161781404, -5028230, 46842896, -150848516, 183992647, -69579398, 143884510, -122893403, 114724501, -129118754, 14045465, -169535864, 163988306, - -- (+302 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_0 : certF 89 0 2381526745186 [-31926605, -1100432231, -1614723377, 662477944, -1134761378, 842419474, -673475300, -2195194085, -657819433, 126941026, -1475782110, -1411097603, -2140760806, -2575229253, -1791494078, -242962241, -2618693537, -1337663593, -2505022771, -2279271143, -1662319260, -941937114, -3385638133, -1316278173, -1955508129, -1476323744, -1933227968, -134813001, -31 -- (+337 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_1 : certF 89 1 2381526745186 [-1100432231, 662477944, 842419474, -2195194085, 126941026, -1411097603, -2575229253, -242962241, -1337663593, -2279271143, -941937114, -1316278173, -1476323744, -134813001, 132578957, -906750570, -465755500, 312997128, -1108987097, 996048886, 692546839, 347321357, 1517784314, 1538040242, 921526902, 1915725511, 2133370719, 2713755748, 2639160301, 317757 -- (+315 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_2 : certF 89 2 2381526745186 [-1614723377, 842419474, -657819433, -1411097603, -1791494078, -1337663593, -1662319260, -1316278173, -1933227968, 132578957, -2713755748, 312997128, -921526902, 692546839, -347321357, 1538040242, 1108987097, 2133370719, 906750570, 3177574589, 1476323744, 3385638133, 2279271143, 2618693537, 2575229253, 1475782110, 2195194085, 1134761378, 1100432231, -31 -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_3 : certF 89 3 2381526745186 [662477944, -2195194085, -1411097603, -242962241, -2279271143, -1316278173, -134813001, -906750570, 312997128, 996048886, 347321357, 1538040242, 1915725511, 2713755748, 3177574589, 1955508129, 1662319260, 2618693537, 2140760806, 657819433, 1134761378, 31926605, -1614723377, -673475300, -1475782110, -1791494078, -2505022771, -3385638133, -1933227968, -26 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_4 : certF 89 4 2381526745186 [-1134761378, 126941026, -1791494078, -2279271143, -1955508129, 132578957, -2133370719, 996048886, -347321357, 921526902, 465755500, 3177574589, 1316278173, 2505022771, 2575229253, 657819433, -662477944, -31926605, 842419474, -1475782110, -242962241, -1662319260, -1476323744, -2639160301, 312997128, -1538040242, 1517784314, 1108987097, 2713755748, 13481 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_5 : certF 89 5 2381526745186 [842419474, -1411097603, -1337663593, -1316278173, 132578957, 312997128, 692546839, 1538040242, 2133370719, 3177574589, 3385638133, 2618693537, 1475782110, 1134761378, -31926605, -673475300, -2140760806, -2505022771, -1955508129, -2639160301, -1915725511, -1517784314, -996048886, 465755500, 134813001, 941937114, 242962241, -126941026, -662477944, -11004 -- (+322 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_6 : certF 89 6 2381526745186 [-673475300, -2575229253, -1662319260, -134813001, -2133370719, 692546839, -996048886, 2713755748, 1476323744, 2505022771, 1411097603, 1134761378, -1100432231, -657819433, -242962241, -3385638133, 132578957, -1915725511, 347321357, 1108987097, 2639160301, 1316278173, 2618693537, -126941026, 1614723377, 662477944, -1475782110, -1337663593, -1955508129, - -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_7 : certF 89 7 2381526745186 [-2195194085, -242962241, -1316278173, -906750570, 996048886, 1538040242, 2713755748, 1955508129, 2618693537, 657819433, 31926605, -673475300, -1791494078, -3385638133, -2639160301, -921526902, -692546839, 465755500, 1476323744, 1337663593, -126941026, 1100432231, 842419474, -2575229253, -941937114, 132578957, -1108987097, 1517784314, 2133370719, 193322 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_8 : certF 89 8 2381526745186 [-657819433, -1337663593, -1933227968, 312997128, -347321357, 2133370719, 1476323744, 2618693537, 2195194085, -31926605, 126941026, -2505022771, -134813001, -1915725511, 1517784314, 465755500, 1955508129, 242962241, 673475300, -1100432231, -1475782110, -2279271143, -3177574589, -1108987097, -692546839, 2713755748, 1316278173, 1791494078, -842419474, -16 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_9 : certF 89 9 2381526745186 [126941026, -2279271143, 132578957, 996048886, 921526902, 3177574589, 2505022771, 657819433, -31926605, -1475782110, -1662319260, -2639160301, -1538040242, 1108987097, 134813001, 1337663593, 2195194085, -1100432231, -1411097603, -941937114, -906750570, 692546839, 1915725511, 1933227968, 2618693537, 673475300, -1614723377, -2140760806, -3385638133, -2713 -- (+321 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_10 : certF 89 10 2381526745186 [-1475782110, -941937114, -2713755748, 347321357, 465755500, 3385638133, 1411097603, 31926605, 126941026, -1662319260, -906750570, -1517784314, 2133370719, 1316278173, 2140760806, 1100432231, -657819433, -2279271143, -2639160301, 692546839, -312997128, 1955508129, 2575229253, 1614723377, -2195194085, -2505022771, 132578957, -1538040242, 1915725511, 14 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_11 : certF 89 11 2381526745186 [-1411097603, -1316278173, 312997128, 1538040242, 3177574589, 2618693537, 1134761378, -673475300, -2505022771, -2639160301, -1517784314, 465755500, 941937114, -126941026, -1100432231, -2575229253, -1476323744, -1108987097, 921526902, 1933227968, 1791494078, 1614723377, -657819433, -1662319260, -2713755748, -347321357, 906750570, 2279271143, 2195194085 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_12 : certF 89 12 2381526745186 [-2140760806, -1476323744, -921526902, 1915725511, 1316278173, 1475782110, -1100432231, -1791494078, -134813001, -1538040242, 2133370719, 941937114, 657819433, 662477944, -2618693537, 132578957, -1517784314, 2713755748, 2279271143, 673475300, 842419474, -2505022771, -906750570, -347321357, 2639160301, 1337663593, 1134761378, -2195194085, -1662319260, -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_13 : certF 89 13 2381526745186 [-2575229253, -134813001, 692546839, 2713755748, 2505022771, 1134761378, -657819433, -3385638133, -1915725511, 1108987097, 1316278173, -126941026, 662477944, -1337663593, -906750570, 1517784314, 3177574589, 1791494078, 31926605, -2140760806, -1933227968, -1538040242, 465755500, 2279271143, -842419474, -2195194085, -941937114, 312997128, 921526902, 195 -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_14 : certF 89 14 2381526745186 [-1791494078, 132578957, -347321357, 3177574589, 2575229253, -31926605, -242962241, -2639160301, 1517784314, 134813001, 2140760806, -1100432231, -2618693537, -906750570, -692546839, 1933227968, 1411097603, -1614723377, -1337663593, -2713755748, 1538040242, 1476323744, 1475782110, 662477944, -2505022771, -465755500, -996048886, 1955508129, -126941026, -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_15 : certF 89 15 2381526745186 [-242962241, -906750570, 1538040242, 1955508129, 657819433, -673475300, -3385638133, -921526902, 465755500, 1337663593, 1100432231, -2575229253, 132578957, 1517784314, 1933227968, 1475782110, -1134761378, -1662319260, -1915725511, -312997128, 2279271143, -662477944, -1411097603, -134813001, 347321357, 3177574589, 2140760806, -1614723377, -2505022771, -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_16 : certF 89 16 2381526745186 [-2618693537, -465755500, 1108987097, 1662319260, -662477944, -2140760806, 132578957, -692546839, 1955508129, 2195194085, -657819433, -1476323744, -1517784314, 3177574589, 1411097603, -1134761378, -941937114, -921526902, 2713755748, 242962241, -31926605, -1337663593, -2133370719, 1915725511, 2279271143, 1614723377, -2575229253, -2639160301, 1538040242 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_17 : certF 89 17 2381526745186 [-1337663593, 312997128, 2133370719, 2618693537, -31926605, -2505022771, -1915725511, 465755500, 242962241, -1100432231, -2279271143, -1108987097, 2713755748, 1791494078, -1614723377, -1662319260, -921526902, 906750570, 2575229253, 662477944, -941937114, 996048886, 2639160301, 2140760806, -1134761378, -3385638133, -1538040242, -132578957, 1411097603, -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_18 : certF 89 18 2381526745186 [-2505022771, -1108987097, 906750570, 2140760806, 842419474, -1955508129, 347321357, 1476323744, 673475300, -1411097603, -2639160301, 921526902, 2279271143, 31926605, -1337663593, -1915725511, 2713755748, 2575229253, -1134761378, -1316278173, -1517784314, 1933227968, 2195194085, -1475782110, 132578957, -996048886, 1662319260, 1100432231, -2618693537, -- (+320 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_19 : certF 89 19 2381526745186 [-2279271143, 996048886, 3177574589, 657819433, -1475782110, -2639160301, 1108987097, 1337663593, -1100432231, -941937114, 692546839, 1933227968, 673475300, -2140760806, -2713755748, -312997128, 242962241, 662477944, -1316278173, 347321357, 1955508129, 1134761378, -1791494078, -2133370719, 465755500, 2575229253, 842419474, -1476323744, 1517784314, 338 -- (+323 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_20 : certF 89 20 2381526745186 [-1662319260, 692546839, 1476323744, 1134761378, -242962241, -1915725511, 2639160301, -126941026, -1475782110, -906750570, -312997128, 1791494078, 842419474, -1933227968, 1538040242, 2279271143, -31926605, -941937114, -1517784314, 1955508129, -662477944, -2618693537, -1108987097, -132578957, 657819433, -1411097603, -2713755748, 2133370719, 2575229253, -- (+329 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_21 : certF 89 21 2381526745186 [-941937114, 347321357, 3385638133, 31926605, -1662319260, -1517784314, 1316278173, 1100432231, -2279271143, 692546839, 1955508129, 1614723377, -2505022771, -1538040242, 1476323744, -662477944, -1337663593, 996048886, 1933227968, 1134761378, -2618693537, -921526902, 134813001, -842419474, -242962241, -1108987097, 3177574589, 673475300, -1791494078, -1 -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_22 : certF 89 22 2381526745186 [-3385638133, 1517784314, 2279271143, -1614723377, -1476323744, -996048886, 2618693537, 842419474, -3177574589, 1915725511, 2575229253, -657819433, -906750570, 465755500, 1475782110, -1411097603, -2133370719, 2639160301, 2195194085, -1791494078, -1108987097, 134813001, 1134761378, -1337663593, -1538040242, 1955508129, 1100432231, -1662319260, 34732135 -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_23 : certF 89 23 2381526745186 [-1316278173, 1538040242, 2618693537, -673475300, -2639160301, 465755500, -126941026, -2575229253, -1108987097, 1933227968, 1614723377, -1662319260, -347321357, 2279271143, 662477944, -134813001, 1915725511, 2140760806, -1475782110, -2133370719, -132578957, -842419474, -1337663593, 692546839, 3385638133, -31926605, -1955508129, -996048886, 242962241, -- (+328 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_24 : certF 89 24 2381526745186 [-1955508129, 921526902, 2575229253, -1475782110, 312997128, 134813001, 1614723377, -941937114, -692546839, 2618693537, -2195194085, -2713755748, 2639160301, -842419474, -2505022771, 347321357, 2279271143, -1134761378, 132578957, 465755500, 657819433, -242962241, -1538040242, 3385638133, -1100432231, -1933227968, 1915725511, 1411097603, -2140760806, - -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_25 : certF 89 25 2381526745186 [-1476323744, 1915725511, 1475782110, -1791494078, -1538040242, 941937114, 662477944, 132578957, 2713755748, 673475300, -2505022771, -347321357, 1337663593, -2195194085, -465755500, 3177574589, 1614723377, -3385638133, -996048886, 2575229253, -1411097603, -1108987097, 1955508129, -31926605, -1933227968, -312997128, -126941026, -242962241, 692546839, 1 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_26 : certF 89 26 2381526745186 [-1933227968, 2133370719, 2195194085, -2505022771, 1517784314, 242962241, -1475782110, -1108987097, 1316278173, -1614723377, 132578957, 906750570, 1134761378, -941937114, -996048886, 2140760806, -2575229253, -1538040242, 1662319260, 842419474, -2713755748, 3177574589, 1100432231, -1955508129, 1915725511, -126941026, -2618693537, 347321357, 1337663593, -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_27 : certF 89 27 2381526745186 [-134813001, 2713755748, 1134761378, -3385638133, 1108987097, -126941026, -1337663593, 1517784314, 1791494078, -2140760806, -1538040242, 2279271143, -2195194085, 312997128, 1955508129, -1614723377, -2639160301, -132578957, 1100432231, -1476323744, 2133370719, 673475300, -1662319260, -996048886, 1411097603, -242962241, 347321357, 2618693537, -147578211 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_28 : certF 89 28 2381526745186 [-3177574589, 2639160301, 1100432231, -1933227968, 2713755748, -662477944, -1955508129, 2133370719, -842419474, -3385638133, 1915725511, 2195194085, -1662319260, 921526902, -126941026, -2505022771, 1538040242, 1411097603, -2618693537, 1517784314, 2575229253, -1791494078, 347321357, 242962241, -2140760806, 692546839, 1337663593, -1475782110, 996048886, -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_29 : certF 89 29 2381526745186 [132578957, 3177574589, -31926605, -2639160301, 134813001, -1100432231, -906750570, 1933227968, -1614723377, -2713755748, 1476323744, 662477944, -465755500, 1955508129, -1134761378, -2133370719, 1316278173, 842419474, 312997128, 3385638133, -673475300, -1915725511, 941937114, -2195194085, -1108987097, 1662319260, -657819433, -921526902, 2279271143, 12 -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_30 : certF 89 30 2381526745186 [-2639160301, 1933227968, 662477944, -2133370719, 3385638133, -2195194085, -921526902, 2505022771, -1411097603, -1517784314, 1791494078, -242962241, -692546839, 1475782110, -2279271143, 1108987097, 673475300, -1316278173, 465755500, 1614723377, -134813001, -132578957, -31926605, -906750570, 1476323744, -1134761378, 312997128, 941937114, -657819433, 99 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_31 : certF 89 31 2381526745186 [-906750570, 1955508129, -673475300, -921526902, 1337663593, -2575229253, 1517784314, 1475782110, -1662319260, -312997128, -662477944, -134813001, 3177574589, -1614723377, -2133370719, 941937114, 126941026, 692546839, 1791494078, -2618693537, -996048886, 2195194085, -1316278173, 2713755748, 31926605, -2639160301, 1476323744, 842419474, -1108987097, 25 -- (+327 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_32 : certF 89 32 2381526745186 [-2713755748, 3385638133, 126941026, -1517784314, 2140760806, -2279271143, -312997128, 1614723377, 132578957, 1476323744, -673475300, 996048886, 242962241, -2618693537, 921526902, -842419474, -1933227968, 3177574589, 662477944, -1915725511, 2505022771, -2575229253, -692546839, 657819433, -1316278173, 906750570, -31926605, -465755500, 941937114, -14757 -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_33 : certF 89 33 2381526745186 [-465755500, 1662319260, -2140760806, -692546839, 2195194085, -1476323744, 3177574589, -1134761378, -921526902, 242962241, -1337663593, 1915725511, 1614723377, -2639160301, 1316278173, 126941026, 347321357, 1475782110, -3385638133, 906750570, -1100432231, 312997128, 2505022771, -1791494078, -996048886, -842419474, -134813001, 1933227968, -673475300, - -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_34 : certF 89 34 2381526745186 [-2133370719, 2505022771, -242962241, 1108987097, 1614723377, -906750570, 941937114, -2140760806, 1538040242, -842419474, -3177574589, 1955508129, 126941026, -347321357, 657819433, -1476323744, 134813001, -673475300, 692546839, 1411097603, -3385638133, 2639160301, 662477944, -921526902, 1791494078, -2279271143, 465755500, -31926605, 312997128, 1337663 -- (+322 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_35 : certF 89 35 2381526745186 [312997128, 2618693537, -2505022771, 465755500, -1100432231, -1108987097, 1791494078, -1662319260, 906750570, 662477944, 996048886, 2140760806, -3385638133, -132578957, 842419474, 692546839, 1475782110, -1955508129, 134813001, -2195194085, 347321357, 657819433, -1933227968, 1476323744, 126941026, 1517784314, 673475300, -3177574589, 1316278173, -141109 -- (+319 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_36 : certF 89 36 2381526745186 [-1915725511, 1791494078, -941937114, -132578957, -673475300, 347321357, 2195194085, -3177574589, 3385638133, -2575229253, 1108987097, 31926605, 312997128, 242962241, -1662319260, 2639160301, 842419474, -1517784314, 657819433, -134813001, 1316278173, -2140760806, 921526902, 1100432231, -2133370719, 2618693537, -2279271143, 906750570, -1134761378, 6925 -- (+324 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_37 : certF 89 37 2381526745186 [-1108987097, 2140760806, -1955508129, 1476323744, -1411097603, 921526902, 31926605, -1915725511, 2575229253, -1316278173, 1933227968, -1475782110, -996048886, 1100432231, 312997128, 1791494078, -3385638133, 134813001, 126941026, 1538040242, 1614723377, -2133370719, 242962241, -941937114, 3177574589, -657819433, -692546839, -662477944, -465755500, 261 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_38 : certF 89 38 2381526745186 [-921526902, 1475782110, -134813001, 941937114, -2618693537, 2713755748, 842419474, -347321357, 1134761378, -465755500, 242962241, -3385638133, 1933227968, -1411097603, 1108987097, -31926605, 996048886, -126941026, -3177574589, 1662319260, -1337663593, 906750570, -673475300, 1517784314, -662477944, -2133370719, 1791494078, -1316278173, 1476323744, -21 -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_39 : certF 89 39 2381526745186 [996048886, 657819433, -2639160301, 1337663593, -941937114, 1933227968, -2140760806, -312997128, 662477944, 347321357, 1134761378, -2133370719, 2575229253, -1476323744, 3385638133, -2618693537, 906750570, -2195194085, 1538040242, 31926605, -921526902, -126941026, 132578957, 2505022771, -1662319260, 134813001, -1411097603, 1915725511, -1614723377, -151 -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_40 : certF 89 40 2381526745186 [-1538040242, 673475300, -465755500, 2575229253, -1933227968, 1662319260, -2279271143, 134813001, -2140760806, 2133370719, 842419474, -692546839, 31926605, 996048886, 2195194085, -2713755748, 1791494078, -1476323744, 941937114, -2505022771, 3177574589, -1411097603, -312997128, -1134761378, 1517784314, 1100432231, -921526902, 657819433, -906750570, 242 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_41 : certF 89 41 2381526745186 [692546839, 1134761378, -1915725511, -126941026, -906750570, 1791494078, -1933227968, 2279271143, -941937114, 1955508129, -2618693537, -132578957, -1411097603, 2133370719, -673475300, -996048886, -1100432231, 347321357, 1614723377, -921526902, 2195194085, -465755500, 2140760806, -3177574589, 1337663593, -1316278173, 3385638133, -2505022771, 134813001, -- (+325 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_42 : certF 89 42 2381526745186 [-1517784314, 1614723377, 996048886, -842419474, -1915725511, 657819433, -465755500, 1411097603, -2639160301, 1791494078, -134813001, 1337663593, -1955508129, 1662319260, -941937114, 1316278173, -2505022771, 1933227968, -242962241, -132578957, -2140760806, 2713755748, 126941026, -312997128, -673475300, 921526902, 662477944, -692546839, -31926605, 3473 -- (+326 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF89_43 : certF 89 43 2381526745186 [347321357, 31926605, -1517784314, 1100432231, 692546839, 1614723377, -1538040242, -662477944, 996048886, 1134761378, -921526902, -842419474, -1108987097, 673475300, -1915725511, 2195194085, 312997128, 657819433, -2133370719, -126941026, -465755500, 1475782110, -2713755748, 1411097603, -906750570, 2140760806, -2639160301, 2575229253, 132578957, 179149 -- (+323 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_89 (a : List Nat) (hin : AllIn 88 a) (h : HodgeList 89 a) :
cnt 1 a = cnt 88 a ∧ cnt 2 a = cnt 87 a ∧ cnt 3 a = cnt 86 a ∧ cnt 4 a = cnt 85 a ∧ cnt 5 a = cnt 84 a ∧ cnt 6 a = cnt 83 a ∧ cnt 7 a = cnt 82 a ∧ cnt 8 a = cnt 81 a ∧ cnt 9 a = cnt 80 a ∧ cnt 10 a = cnt 79 a ∧ cnt 11 a = cnt 78 a ∧ cnt 12 a = cnt 77 a ∧ cnt 13 a = cnt 76 a ∧ cnt 14 a = cnt 75 a ∧ cnt 15 a = cnt 74 a ∧ cnt 16 a = cnt 73 a ∧ cnt 17 a = cnt 72 a ∧ cnt 18 a = cnt 71 a ∧ cnt 19 a -- (+563 chars; full line in the Zenodo source)
⟨pair_one 89 0 2381526745186 [-31926605, -1100432231, -1614723377, 662477944, -1134761378, 842419474, -673475300, -2195194085, -657819433, 126941026, -1475782110, -1411097603, -2140760806, -2575229253, -1791494078, -242962241, -2618693537, -1337663593, -2505022771, -2279271143, -1662319260, -941937114, -3385638133, -1316278173, -1955508129, -1476323744, -1933227968, -134813001, -3177574589, 1325 -- (+412 chars; full line in the Zenodo source)
pair_one 89 1 2381526745186 [-1100432231, 662477944, 842419474, -2195194085, 126941026, -1411097603, -2575229253, -242962241, -1337663593, -2279271143, -941937114, -1316278173, -1476323744, -134813001, 132578957, -906750570, -465755500, 312997128, -1108987097, 996048886, 692546839, 347321357, 1517784314, 1538040242, 921526902, 1915725511, 2133370719, 2713755748, 2639160301, 3177574589, 19332279 -- (+390 chars; full line in the Zenodo source)
pair_one 89 2 2381526745186 [-1614723377, 842419474, -657819433, -1411097603, -1791494078, -1337663593, -1662319260, -1316278173, -1933227968, 132578957, -2713755748, 312997128, -921526902, 692546839, -347321357, 1538040242, 1108987097, 2133370719, 906750570, 3177574589, 1476323744, 3385638133, 2279271143, 2618693537, 2575229253, 1475782110, 2195194085, 1134761378, 1100432231, -31926605, 662477 -- (+399 chars; full line in the Zenodo source)
pair_one 89 3 2381526745186 [662477944, -2195194085, -1411097603, -242962241, -2279271143, -1316278173, -134813001, -906750570, 312997128, 996048886, 347321357, 1538040242, 1915725511, 2713755748, 3177574589, 1955508129, 1662319260, 2618693537, 2140760806, 657819433, 1134761378, 31926605, -1614723377, -673475300, -1475782110, -1791494078, -2505022771, -3385638133, -1933227968, -2639160301, -213 -- (+398 chars; full line in the Zenodo source)
pair_one 89 4 2381526745186 [-1134761378, 126941026, -1791494078, -2279271143, -1955508129, 132578957, -2133370719, 996048886, -347321357, 921526902, 465755500, 3177574589, 1316278173, 2505022771, 2575229253, 657819433, -662477944, -31926605, 842419474, -1475782110, -242962241, -1662319260, -1476323744, -2639160301, 312997128, -1538040242, 1517784314, 1108987097, 2713755748, 134813001, 33856381 -- (+398 chars; full line in the Zenodo source)
pair_one 89 5 2381526745186 [842419474, -1411097603, -1337663593, -1316278173, 132578957, 312997128, 692546839, 1538040242, 2133370719, 3177574589, 3385638133, 2618693537, 1475782110, 1134761378, -31926605, -673475300, -2140760806, -2505022771, -1955508129, -2639160301, -1915725511, -1517784314, -996048886, 465755500, 134813001, 941937114, 242962241, -126941026, -662477944, -1100432231, -219519 -- (+397 chars; full line in the Zenodo source)
pair_one 89 6 2381526745186 [-673475300, -2575229253, -1662319260, -134813001, -2133370719, 692546839, -996048886, 2713755748, 1476323744, 2505022771, 1411097603, 1134761378, -1100432231, -657819433, -242962241, -3385638133, 132578957, -1915725511, 347321357, 1108987097, 2639160301, 1316278173, 2618693537, -126941026, 1614723377, 662477944, -1475782110, -1337663593, -1955508129, -906750570, -92 -- (+399 chars; full line in the Zenodo source)
pair_one 89 7 2381526745186 [-2195194085, -242962241, -1316278173, -906750570, 996048886, 1538040242, 2713755748, 1955508129, 2618693537, 657819433, 31926605, -673475300, -1791494078, -3385638133, -2639160301, -921526902, -692546839, 465755500, 1476323744, 1337663593, -126941026, 1100432231, 842419474, -2575229253, -941937114, 132578957, -1108987097, 1517784314, 2133370719, 1933227968, 25050227 -- (+398 chars; full line in the Zenodo source)
pair_one 89 8 2381526745186 [-657819433, -1337663593, -1933227968, 312997128, -347321357, 2133370719, 1476323744, 2618693537, 2195194085, -31926605, 126941026, -2505022771, -134813001, -1915725511, 1517784314, 465755500, 1955508129, 242962241, 673475300, -1100432231, -1475782110, -2279271143, -3177574589, -1108987097, -692546839, 2713755748, 1316278173, 1791494078, -842419474, -1614723377, -141 -- (+398 chars; full line in the Zenodo source)
pair_one 89 9 2381526745186 [126941026, -2279271143, 132578957, 996048886, 921526902, 3177574589, 2505022771, 657819433, -31926605, -1475782110, -1662319260, -2639160301, -1538040242, 1108987097, 134813001, 1337663593, 2195194085, -1100432231, -1411097603, -941937114, -906750570, 692546839, 1915725511, 1933227968, 2618693537, 673475300, -1614723377, -2140760806, -3385638133, -2713755748, -15177 -- (+396 chars; full line in the Zenodo source)
pair_one 89 10 2381526745186 [-1475782110, -941937114, -2713755748, 347321357, 465755500, 3385638133, 1411097603, 31926605, 126941026, -1662319260, -906750570, -1517784314, 2133370719, 1316278173, 2140760806, 1100432231, -657819433, -2279271143, -2639160301, 692546839, -312997128, 1955508129, 2575229253, 1614723377, -2195194085, -2505022771, 132578957, -1538040242, 1915725511, 1476323744, 17914 -- (+398 chars; full line in the Zenodo source)
pair_one 89 11 2381526745186 [-1411097603, -1316278173, 312997128, 1538040242, 3177574589, 2618693537, 1134761378, -673475300, -2505022771, -2639160301, -1517784314, 465755500, 941937114, -126941026, -1100432231, -2575229253, -1476323744, -1108987097, 921526902, 1933227968, 1791494078, 1614723377, -657819433, -1662319260, -2713755748, -347321357, 906750570, 2279271143, 2195194085, 662477944, -2 -- (+401 chars; full line in the Zenodo source)
pair_one 89 12 2381526745186 [-2140760806, -1476323744, -921526902, 1915725511, 1316278173, 1475782110, -1100432231, -1791494078, -134813001, -1538040242, 2133370719, 941937114, 657819433, 662477944, -2618693537, 132578957, -1517784314, 2713755748, 2279271143, 673475300, 842419474, -2505022771, -906750570, -347321357, 2639160301, 1337663593, 1134761378, -2195194085, -1662319260, -465755500, -69 -- (+399 chars; full line in the Zenodo source)
pair_one 89 13 2381526745186 [-2575229253, -134813001, 692546839, 2713755748, 2505022771, 1134761378, -657819433, -3385638133, -1915725511, 1108987097, 1316278173, -126941026, 662477944, -1337663593, -906750570, 1517784314, 3177574589, 1791494078, 31926605, -2140760806, -1933227968, -1538040242, 465755500, 2279271143, -842419474, -2195194085, -941937114, 312997128, 921526902, 1955508129, 147578 -- (+399 chars; full line in the Zenodo source)
pair_one 89 14 2381526745186 [-1791494078, 132578957, -347321357, 3177574589, 2575229253, -31926605, -242962241, -2639160301, 1517784314, 134813001, 2140760806, -1100432231, -2618693537, -906750570, -692546839, 1933227968, 1411097603, -1614723377, -1337663593, -2713755748, 1538040242, 1476323744, 1475782110, 662477944, -2505022771, -465755500, -996048886, 1955508129, -126941026, -1134761378, -2 -- (+401 chars; full line in the Zenodo source)
pair_one 89 15 2381526745186 [-242962241, -906750570, 1538040242, 1955508129, 657819433, -673475300, -3385638133, -921526902, 465755500, 1337663593, 1100432231, -2575229253, 132578957, 1517784314, 1933227968, 1475782110, -1134761378, -1662319260, -1915725511, -312997128, 2279271143, -662477944, -1411097603, -134813001, 347321357, 3177574589, 2140760806, -1614723377, -2505022771, -2133370719, 11 -- (+400 chars; full line in the Zenodo source)
pair_one 89 16 2381526745186 [-2618693537, -465755500, 1108987097, 1662319260, -662477944, -2140760806, 132578957, -692546839, 1955508129, 2195194085, -657819433, -1476323744, -1517784314, 3177574589, 1411097603, -1134761378, -941937114, -921526902, 2713755748, 242962241, -31926605, -1337663593, -2133370719, 1915725511, 2279271143, 1614723377, -2575229253, -2639160301, 1538040242, 1316278173, 6 -- (+398 chars; full line in the Zenodo source)
pair_one 89 17 2381526745186 [-1337663593, 312997128, 2133370719, 2618693537, -31926605, -2505022771, -1915725511, 465755500, 242962241, -1100432231, -2279271143, -1108987097, 2713755748, 1791494078, -1614723377, -1662319260, -921526902, 906750570, 2575229253, 662477944, -941937114, 996048886, 2639160301, 2140760806, -1134761378, -3385638133, -1538040242, -132578957, 1411097603, 842419474, -131 -- (+400 chars; full line in the Zenodo source)
pair_one 89 18 2381526745186 [-2505022771, -1108987097, 906750570, 2140760806, 842419474, -1955508129, 347321357, 1476323744, 673475300, -1411097603, -2639160301, 921526902, 2279271143, 31926605, -1337663593, -1915725511, 2713755748, 2575229253, -1134761378, -1316278173, -1517784314, 1933227968, 2195194085, -1475782110, 132578957, -996048886, 1662319260, 1100432231, -2618693537, 312997128, 4657 -- (+395 chars; full line in the Zenodo source)
pair_one 89 19 2381526745186 [-2279271143, 996048886, 3177574589, 657819433, -1475782110, -2639160301, 1108987097, 1337663593, -1100432231, -941937114, 692546839, 1933227968, 673475300, -2140760806, -2713755748, -312997128, 242962241, 662477944, -1316278173, 347321357, 1955508129, 1134761378, -1791494078, -2133370719, 465755500, 2575229253, 842419474, -1476323744, 1517784314, 3385638133, 161472 -- (+398 chars; full line in the Zenodo source)
pair_one 89 20 2381526745186 [-1662319260, 692546839, 1476323744, 1134761378, -242962241, -1915725511, 2639160301, -126941026, -1475782110, -906750570, -312997128, 1791494078, 842419474, -1933227968, 1538040242, 2279271143, -31926605, -941937114, -1517784314, 1955508129, -662477944, -2618693537, -1108987097, -132578957, 657819433, -1411097603, -2713755748, 2133370719, 2575229253, -673475300, -1 -- (+404 chars; full line in the Zenodo source)
pair_one 89 21 2381526745186 [-941937114, 347321357, 3385638133, 31926605, -1662319260, -1517784314, 1316278173, 1100432231, -2279271143, 692546839, 1955508129, 1614723377, -2505022771, -1538040242, 1476323744, -662477944, -1337663593, 996048886, 1933227968, 1134761378, -2618693537, -921526902, 134813001, -842419474, -242962241, -1108987097, 3177574589, 673475300, -1791494078, -1915725511, -132 -- (+400 chars; full line in the Zenodo source)
pair_one 89 22 2381526745186 [-3385638133, 1517784314, 2279271143, -1614723377, -1476323744, -996048886, 2618693537, 842419474, -3177574589, 1915725511, 2575229253, -657819433, -906750570, 465755500, 1475782110, -1411097603, -2133370719, 2639160301, 2195194085, -1791494078, -1108987097, 134813001, 1134761378, -1337663593, -1538040242, 1955508129, 1100432231, -1662319260, 347321357, 941937114, - -- (+399 chars; full line in the Zenodo source)
pair_one 89 23 2381526745186 [-1316278173, 1538040242, 2618693537, -673475300, -2639160301, 465755500, -126941026, -2575229253, -1108987097, 1933227968, 1614723377, -1662319260, -347321357, 2279271143, 662477944, -134813001, 1915725511, 2140760806, -1475782110, -2133370719, -132578957, -842419474, -1337663593, 692546839, 3385638133, -31926605, -1955508129, -996048886, 242962241, -2195194085, -9 -- (+403 chars; full line in the Zenodo source)
pair_one 89 24 2381526745186 [-1955508129, 921526902, 2575229253, -1475782110, 312997128, 134813001, 1614723377, -941937114, -692546839, 2618693537, -2195194085, -2713755748, 2639160301, -842419474, -2505022771, 347321357, 2279271143, -1134761378, 132578957, 465755500, 657819433, -242962241, -1538040242, 3385638133, -1100432231, -1933227968, 1915725511, 1411097603, -2140760806, -1108987097, 147 -- (+400 chars; full line in the Zenodo source)
pair_one 89 25 2381526745186 [-1476323744, 1915725511, 1475782110, -1791494078, -1538040242, 941937114, 662477944, 132578957, 2713755748, 673475300, -2505022771, -347321357, 1337663593, -2195194085, -465755500, 3177574589, 1614723377, -3385638133, -996048886, 2575229253, -1411097603, -1108987097, 1955508129, -31926605, -1933227968, -312997128, -126941026, -242962241, 692546839, 1662319260, -113 -- (+401 chars; full line in the Zenodo source)
pair_one 89 26 2381526745186 [-1933227968, 2133370719, 2195194085, -2505022771, 1517784314, 242962241, -1475782110, -1108987097, 1316278173, -1614723377, 132578957, 906750570, 1134761378, -941937114, -996048886, 2140760806, -2575229253, -1538040242, 1662319260, 842419474, -2713755748, 3177574589, 1100432231, -1955508129, 1915725511, -126941026, -2618693537, 347321357, 1337663593, -657819433, 31 -- (+399 chars; full line in the Zenodo source)
pair_one 89 27 2381526745186 [-134813001, 2713755748, 1134761378, -3385638133, 1108987097, -126941026, -1337663593, 1517784314, 1791494078, -2140760806, -1538040242, 2279271143, -2195194085, 312997128, 1955508129, -1614723377, -2639160301, -132578957, 1100432231, -1476323744, 2133370719, 673475300, -1662319260, -996048886, 1411097603, -242962241, 347321357, 2618693537, -1475782110, -921526902, -- (+401 chars; full line in the Zenodo source)
pair_one 89 28 2381526745186 [-3177574589, 2639160301, 1100432231, -1933227968, 2713755748, -662477944, -1955508129, 2133370719, -842419474, -3385638133, 1915725511, 2195194085, -1662319260, 921526902, -126941026, -2505022771, 1538040242, 1411097603, -2618693537, 1517784314, 2575229253, -1791494078, 347321357, 242962241, -2140760806, 692546839, 1337663593, -1475782110, 996048886, 2279271143, -6 -- (+399 chars; full line in the Zenodo source)
pair_one 89 29 2381526745186 [132578957, 3177574589, -31926605, -2639160301, 134813001, -1100432231, -906750570, 1933227968, -1614723377, -2713755748, 1476323744, 662477944, -465755500, 1955508129, -1134761378, -2133370719, 1316278173, 842419474, 312997128, 3385638133, -673475300, -1915725511, 941937114, -2195194085, -1108987097, 1662319260, -657819433, -921526902, 2279271143, 126941026, 996048 -- (+399 chars; full line in the Zenodo source)
pair_one 89 30 2381526745186 [-2639160301, 1933227968, 662477944, -2133370719, 3385638133, -2195194085, -921526902, 2505022771, -1411097603, -1517784314, 1791494078, -242962241, -692546839, 1475782110, -2279271143, 1108987097, 673475300, -1316278173, 465755500, 1614723377, -134813001, -132578957, -31926605, -906750570, 1476323744, -1134761378, 312997128, 941937114, -657819433, 996048886, 133766 -- (+401 chars; full line in the Zenodo source)
pair_one 89 31 2381526745186 [-906750570, 1955508129, -673475300, -921526902, 1337663593, -2575229253, 1517784314, 1475782110, -1662319260, -312997128, -662477944, -134813001, 3177574589, -1614723377, -2133370719, 941937114, 126941026, 692546839, 1791494078, -2618693537, -996048886, 2195194085, -1316278173, 2713755748, 31926605, -2639160301, 1476323744, 842419474, -1108987097, 2505022771, -2140 -- (+402 chars; full line in the Zenodo source)
pair_one 89 32 2381526745186 [-2713755748, 3385638133, 126941026, -1517784314, 2140760806, -2279271143, -312997128, 1614723377, 132578957, 1476323744, -673475300, 996048886, 242962241, -2618693537, 921526902, -842419474, -1933227968, 3177574589, 662477944, -1915725511, 2505022771, -2575229253, -692546839, 657819433, -1316278173, 906750570, -31926605, -465755500, 941937114, -1475782110, 34732135 -- (+399 chars; full line in the Zenodo source)
pair_one 89 33 2381526745186 [-465755500, 1662319260, -2140760806, -692546839, 2195194085, -1476323744, 3177574589, -1134761378, -921526902, 242962241, -1337663593, 1915725511, 1614723377, -2639160301, 1316278173, 126941026, 347321357, 1475782110, -3385638133, 906750570, -1100432231, 312997128, 2505022771, -1791494078, -996048886, -842419474, -134813001, 1933227968, -673475300, -1538040242, 257 -- (+400 chars; full line in the Zenodo source)
pair_one 89 34 2381526745186 [-2133370719, 2505022771, -242962241, 1108987097, 1614723377, -906750570, 941937114, -2140760806, 1538040242, -842419474, -3177574589, 1955508129, 126941026, -347321357, 657819433, -1476323744, 134813001, -673475300, 692546839, 1411097603, -3385638133, 2639160301, 662477944, -921526902, 1791494078, -2279271143, 465755500, -31926605, 312997128, 1337663593, -261869353 -- (+397 chars; full line in the Zenodo source)
pair_one 89 35 2381526745186 [312997128, 2618693537, -2505022771, 465755500, -1100432231, -1108987097, 1791494078, -1662319260, 906750570, 662477944, 996048886, 2140760806, -3385638133, -132578957, 842419474, 692546839, 1475782110, -1955508129, 134813001, -2195194085, 347321357, 657819433, -1933227968, 1476323744, 126941026, 1517784314, 673475300, -3177574589, 1316278173, -1411097603, 153804024 -- (+394 chars; full line in the Zenodo source)
pair_one 89 36 2381526745186 [-1915725511, 1791494078, -941937114, -132578957, -673475300, 347321357, 2195194085, -3177574589, 3385638133, -2575229253, 1108987097, 31926605, 312997128, 242962241, -1662319260, 2639160301, 842419474, -1517784314, 657819433, -134813001, 1316278173, -2140760806, 921526902, 1100432231, -2133370719, 2618693537, -2279271143, 906750570, -1134761378, 692546839, -1269410 -- (+399 chars; full line in the Zenodo source)
pair_one 89 37 2381526745186 [-1108987097, 2140760806, -1955508129, 1476323744, -1411097603, 921526902, 31926605, -1915725511, 2575229253, -1316278173, 1933227968, -1475782110, -996048886, 1100432231, 312997128, 1791494078, -3385638133, 134813001, 126941026, 1538040242, 1614723377, -2133370719, 242962241, -941937114, 3177574589, -657819433, -692546839, -662477944, -465755500, 2618693537, -16623 -- (+401 chars; full line in the Zenodo source)
pair_one 89 38 2381526745186 [-921526902, 1475782110, -134813001, 941937114, -2618693537, 2713755748, 842419474, -347321357, 1134761378, -465755500, 242962241, -3385638133, 1933227968, -1411097603, 1108987097, -31926605, 996048886, -126941026, -3177574589, 1662319260, -1337663593, 906750570, -673475300, 1517784314, -662477944, -2133370719, 1791494078, -1316278173, 1476323744, -2140760806, 19157 -- (+400 chars; full line in the Zenodo source)
pair_one 89 39 2381526745186 [996048886, 657819433, -2639160301, 1337663593, -941937114, 1933227968, -2140760806, -312997128, 662477944, 347321357, 1134761378, -2133370719, 2575229253, -1476323744, 3385638133, -2618693537, 906750570, -2195194085, 1538040242, 31926605, -921526902, -126941026, 132578957, 2505022771, -1662319260, 134813001, -1411097603, 1915725511, -1614723377, -1517784314, -84241 -- (+400 chars; full line in the Zenodo source)
pair_one 89 40 2381526745186 [-1538040242, 673475300, -465755500, 2575229253, -1933227968, 1662319260, -2279271143, 134813001, -2140760806, 2133370719, 842419474, -692546839, 31926605, 996048886, 2195194085, -2713755748, 1791494078, -1476323744, 941937114, -2505022771, 3177574589, -1411097603, -312997128, -1134761378, 1517784314, 1100432231, -921526902, 657819433, -906750570, 242962241, -195550 -- (+401 chars; full line in the Zenodo source)
pair_one 89 41 2381526745186 [692546839, 1134761378, -1915725511, -126941026, -906750570, 1791494078, -1933227968, 2279271143, -941937114, 1955508129, -2618693537, -132578957, -1411097603, 2133370719, -673475300, -996048886, -1100432231, 347321357, 1614723377, -921526902, 2195194085, -465755500, 2140760806, -3177574589, 1337663593, -1316278173, 3385638133, -2505022771, 134813001, -2575229253, 2 -- (+400 chars; full line in the Zenodo source)
pair_one 89 42 2381526745186 [-1517784314, 1614723377, 996048886, -842419474, -1915725511, 657819433, -465755500, 1411097603, -2639160301, 1791494078, -134813001, 1337663593, -1955508129, 1662319260, -941937114, 1316278173, -2505022771, 1933227968, -242962241, -132578957, -2140760806, 2713755748, 126941026, -312997128, -673475300, 921526902, 662477944, -692546839, -31926605, 347321357, 11004322 -- (+401 chars; full line in the Zenodo source)
pair_one 89 43 2381526745186 [347321357, 31926605, -1517784314, 1100432231, 692546839, 1614723377, -1538040242, -662477944, 996048886, 1134761378, -921526902, -842419474, -1108987097, 673475300, -1915725511, 2195194085, 312997128, 657819433, -2133370719, -126941026, -465755500, 1475782110, -2713755748, 1411097603, -906750570, 2140760806, -2639160301, 2575229253, 132578957, 1791494078, -31775745 -- (+398 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_0 : certF 97 0 79796627856194 [-1674823000, 6764073537, -1043180158, -52363534505, -31227943921, -8591312294, -49044094492, 35873732201, -36476698263, -31476012949, -30133943735, -51719541547, -46422349327, -19209113016, -21235960659, -73342121873, -73855341714, -30528409597, -95888407463, -10280608885, -53919903191, -61111480392, -51879355621, -33859317138, -88219573471, -21077861 -- (+464 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_1 : certF 97 1 79796627856194 [6764073537, -52363534505, -8591312294, 35873732201, -31476012949, -51719541547, -19209113016, -73342121873, -30528409597, -10280608885, -61111480392, -33859317138, -21077861354, -13849368010, -23901790711, -22650157468, -43963076902, 8213679731, 11429315902, -44925347004, 12262193034, 19150619083, -10634348869, 48466965025, 53979365093, 25413510839, 5 -- (+440 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_2 : certF 97 2 79796627856194 [-1043180158, -8591312294, -36476698263, -51719541547, -21235960659, -30528409597, -53919903191, -33859317138, -70866049157, -23901790711, -68670259099, 8213679731, -54039729138, 12262193034, -25413510839, 48466965025, 10634348869, 56228840775, 44925347004, 62270436254, 43963076902, 91231832716, 13849368010, 88219573471, 61111480392, 95888407463, 73342 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_3 : certF 97 3 79796627856194 [-52363534505, 35873732201, -51719541547, -73342121873, -10280608885, -33859317138, -13849368010, -22650157468, 8213679731, -44925347004, 19150619083, 48466965025, 25413510839, 34930794198, 62270436254, 68670259099, 79526191114, 88219573471, 53919903191, 73855341714, 46422349327, 36476698263, 31227943921, 1674823000, -1043180158, -49044094492, -3013394 -- (+446 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_4 : certF 97 4 79796627856194 [-31227943921, -31476012949, -21235960659, -10280608885, -88219573471, -23901790711, -55789888605, -44925347004, -25413510839, 53979365093, -12262193034, 62270436254, 22650157468, 70866049157, 61111480392, 73855341714, 51719541547, 49044094492, -6764073537, -1043180158, 35873732201, -46422349327, -30528409597, -51879355621, -13849368010, -68670259099, -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_5 : certF 97 5 79796627856194 [-8591312294, -51719541547, -30528409597, -33859317138, -23901790711, 8213679731, 12262193034, 48466965025, 56228840775, 62270436254, 91231832716, 88219573471, 95888407463, 46422349327, 49044094492, 1674823000, -31227943921, -30133943735, -73855341714, -51879355621, -79526191114, -55789888605, -34930794198, -53979365093, -19150619083, -11429315902, 226 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_6 : certF 97 6 79796627856194 [-49044094492, -19209113016, -53919903191, -13849368010, -55789888605, 12262193034, -48466965025, 34930794198, 43963076902, 70866049157, 10280608885, 46422349327, 8591312294, -1674823000, 35873732201, -21235960659, -61111480392, -79526191114, 8213679731, -56228840775, 53979365093, 44925347004, 68670259099, 21077861354, 95888407463, 51719541547, 3122794 -- (+445 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_7 : certF 97 7 79796627856194 [35873732201, -73342121873, -33859317138, -22650157468, -44925347004, 48466965025, 34930794198, 68670259099, 88219573471, 73855341714, 36476698263, 1674823000, -49044094492, -21235960659, -51879355621, -91231832716, -54039729138, -53979365093, -12262193034, 43963076902, 21077861354, 30528409597, 31476012949, -6764073537, -8591312294, -19209113016, -611 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_8 : certF 97 8 79796627856194 [-36476698263, -30528409597, -70866049157, 8213679731, -25413510839, 56228840775, 43963076902, 88219573471, 73342121873, 49044094492, 6764073537, -30133943735, -10280608885, -79526191114, 11429315902, -53979365093, 34930794198, 22650157468, 51879355621, 19209113016, 31227943921, -52363534505, -46422349327, -61111480392, -91231832716, -44925347004, -484 -- (+444 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_9 : certF 97 9 79796627856194 [-31476012949, -10280608885, -23901790711, -44925347004, 53979365093, 62270436254, 70866049157, 73855341714, 49044094492, -1043180158, -46422349327, -51879355621, -68670259099, -56228840775, -19150619083, 43963076902, 33859317138, 19209113016, 52363534505, -8591312294, -73342121873, -21077861354, 8213679731, -10634348869, 34930794198, 91231832716, 5391 -- (+447 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_10 : certF 97 10 79796627856194 [-30133943735, -61111480392, -68670259099, 19150619083, -12262193034, 91231832716, 10280608885, 36476698263, 6764073537, -46422349327, -33859317138, -55789888605, -10634348869, 44925347004, 79526191114, 30528409597, 49044094492, -52363534505, -21235960659, -21077861354, -62270436254, 48466965025, -11429315902, 70866049157, 73342121873, 31227943921, - -- (+450 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_11 : certF 97 11 79796627856194 [-51719541547, -33859317138, 8213679731, 48466965025, 62270436254, 88219573471, 46422349327, 1674823000, -30133943735, -51879355621, -55789888605, -53979365093, -11429315902, 21077861354, 19209113016, -6764073537, -31476012949, -61111480392, -43963076902, -10634348869, 54039729138, 70866049157, 21235960659, 1043180158, -36476698263, -53919903191, -68 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_12 : certF 97 12 79796627856194 [-46422349327, -21077861354, -54039729138, 25413510839, 22650157468, 95888407463, 8591312294, -49044094492, -10280608885, -68670259099, -10634348869, -11429315902, 88219573471, 51719541547, -1674823000, -19209113016, -70866049157, -44925347004, -19150619083, 91231832716, 30528409597, 31227943921, 35873732201, -53919903191, -43963076902, -53979365093, -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_13 : certF 97 13 79796627856194 [-19209113016, -13849368010, 12262193034, 34930794198, 70866049157, 46422349327, -1674823000, -21235960659, -79526191114, -56228840775, 44925347004, 21077861354, 51719541547, 6764073537, -73342121873, -23901790711, 19150619083, 54039729138, 88219573471, 30133943735, -1043180158, -73855341714, -91231832716, -25413510839, -11429315902, 33859317138, 314 -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_14 : certF 97 14 79796627856194 [-21235960659, -23901790711, -25413510839, 62270436254, 61111480392, 49044094492, 35873732201, -51879355621, 11429315902, -19150619083, 79526191114, 19209113016, -1674823000, -73342121873, -91231832716, -10634348869, -8213679731, 53919903191, 8591312294, -36476698263, -33859317138, -54039729138, 56228840775, 13849368010, 46422349327, 6764073537, -738 -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_15 : certF 97 15 79796627856194 [-73342121873, -22650157468, 48466965025, 68670259099, 73855341714, 1674823000, -21235960659, -91231832716, -53979365093, 43963076902, 30528409597, -6764073537, -19209113016, -23901790711, -10634348869, 55789888605, 95888407463, 1043180158, -46422349327, -79526191114, -25413510839, -8213679731, 10280608885, 52363534505, -51719541547, -13849368010, 19 -- (+450 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_16 : certF 97 16 79796627856194 [-73855341714, -43963076902, 10634348869, 79526191114, 51719541547, -31227943921, -61111480392, -54039729138, 34930794198, 33859317138, 49044094492, -31476012949, -70866049157, 19150619083, -8213679731, 95888407463, -6764073537, -21235960659, -22650157468, -48466965025, 91231832716, 19209113016, -1043180158, -10280608885, -62270436254, 56228840775, 2 -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_17 : certF 97 17 79796627856194 [-30528409597, 8213679731, 56228840775, 88219573471, 49044094492, -30133943735, -79526191114, -53979365093, 22650157468, 19209113016, -52363534505, -61111480392, -44925347004, 54039729138, 53919903191, 1043180158, -21235960659, -68670259099, 10634348869, 13849368010, 31476012949, 35873732201, -21077861354, 19150619083, 55789888605, 73855341714, -1674 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_18 : certF 97 18 79796627856194 [-95888407463, 11429315902, 44925347004, 53919903191, -6764073537, -73855341714, 8213679731, -12262193034, 51879355621, 52363534505, -21235960659, -43963076902, -19150619083, 88219573471, 8591312294, -46422349327, -22650157468, 10634348869, 70866049157, -35873732201, -30133943735, -23901790711, -48466965025, 79526191114, 31476012949, -36476698263, -1 -- (+453 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_19 : certF 97 19 79796627856194 [-10280608885, -44925347004, 62270436254, 73855341714, -1043180158, -51879355621, -56228840775, 43963076902, 19209113016, -8591312294, -21077861354, -10634348869, 91231832716, 30133943735, -36476698263, -79526191114, -48466965025, 13849368010, -35873732201, -51719541547, -22650157468, 25413510839, 88219573471, 31227943921, -21235960659, -55789888605, -- (+453 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_20 : certF 97 20 79796627856194 [-53919903191, 12262193034, 43963076902, 46422349327, 35873732201, -79526191114, 53979365093, 21077861354, 31227943921, -73342121873, -62270436254, 54039729138, 30528409597, -1043180158, -33859317138, -25413510839, 91231832716, 31476012949, -30133943735, -22650157468, -19150619083, 51879355621, -6764073537, -95888407463, -44925347004, -8213679731, 21 -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_21 : certF 97 21 79796627856194 [-61111480392, 19150619083, 91231832716, 36476698263, -46422349327, -55789888605, 44925347004, 30528409597, -52363534505, -21077861354, 48466965025, 70866049157, 31227943921, -73855341714, -54039729138, -8213679731, 19209113016, 35873732201, -23901790711, 25413510839, 51879355621, 1674823000, -53919903191, -56228840775, 22650157468, 31476012949, -517 -- (+446 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_22 : certF 97 22 79796627856194 [-51879355621, -10634348869, 13849368010, 31227943921, -30528409597, -34930794198, 68670259099, 31476012949, -46422349327, 8213679731, -11429315902, 21235960659, 35873732201, -91231832716, 56228840775, 10280608885, -1043180158, -21077861354, -48466965025, 88219573471, -6764073537, -53919903191, 19150619083, 23901790711, 49044094492, -73342121873, -54 -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_23 : certF 97 23 79796627856194 [-33859317138, 48466965025, 88219573471, 1674823000, -51879355621, -53979365093, 21077861354, -6764073537, -61111480392, -10634348869, 70866049157, 1043180158, -53919903191, -25413510839, 13849368010, 52363534505, -10280608885, 19150619083, 79526191114, 31227943921, -95888407463, -56228840775, 23901790711, 8591312294, -30528409597, 12262193034, 91231 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_24 : certF 97 24 79796627856194 [-88219573471, 53979365093, 61111480392, -1043180158, -13849368010, -19150619083, 95888407463, -8591312294, -91231832716, 34930794198, 73342121873, -36476698263, -43963076902, -11429315902, 46422349327, -51719541547, -62270436254, 55789888605, 31476012949, -21235960659, -44925347004, 22650157468, 49044094492, -30528409597, -56228840775, 79526191114, -- (+450 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_25 : certF 97 25 79796627856194 [-21077861354, 25413510839, 95888407463, -49044094492, -68670259099, -11429315902, 51719541547, -19209113016, -44925347004, 91231832716, 31227943921, -53919903191, -53979365093, 33859317138, 6764073537, -13849368010, 56228840775, 73855341714, -36476698263, -55789888605, -8213679731, 31476012949, -73342121873, 12262193034, 79526191114, 1043180158, -51 -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_26 : certF 97 26 79796627856194 [-70866049157, 56228840775, 73342121873, -30133943735, 11429315902, 22650157468, 31227943921, -61111480392, -48466965025, 53919903191, -8591312294, -68670259099, 62270436254, 31476012949, -73855341714, 19150619083, 21077861354, -1674823000, -13849368010, -12262193034, 21235960659, -51719541547, -54039729138, 91231832716, 52363534505, -51879355621, 53 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_27 : certF 97 27 79796627856194 [-13849368010, 34930794198, 46422349327, -21235960659, -56228840775, 21077861354, 6764073537, -23901790711, 54039729138, 30133943735, -73855341714, -25413510839, 33859317138, -52363534505, -22650157468, 62270436254, 36476698263, -95888407463, -53979365093, 61111480392, -8591312294, -43963076902, 55789888605, 49044094492, -53919903191, -48466965025, 1 -- (+447 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_28 : certF 97 28 79796627856194 [-79526191114, 54039729138, 31476012949, -95888407463, 48466965025, 10280608885, -36476698263, 11429315902, 23901790711, 1674823000, -13849368010, 44925347004, 30133943735, -30528409597, -53979365093, 53919903191, 35873732201, -62270436254, 91231832716, -6764073537, -70866049157, 34930794198, 51719541547, -73855341714, -10634348869, 61111480392, -490 -- (+447 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_29 : certF 97 29 79796627856194 [-23901790711, 62270436254, 49044094492, -51879355621, -19150619083, 19209113016, -73342121873, -10634348869, 53919903191, -36476698263, -54039729138, 13849368010, 6764073537, -22650157468, 55789888605, 31227943921, -88219573471, -12262193034, 51719541547, -30528409597, 48466965025, 95888407463, -30133943735, -34930794198, 21077861354, -52363534505, -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_30 : certF 97 30 79796627856194 [-91231832716, 55789888605, 52363534505, -70866049157, 54039729138, -35873732201, -51879355621, 56228840775, 51719541547, -95888407463, 53979365093, 73342121873, -21235960659, -10634348869, 10280608885, -30133943735, 12262193034, 33859317138, -49044094492, 11429315902, 13849368010, -1043180158, -43963076902, 22650157468, 1674823000, -23901790711, -82 -- (+450 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_31 : certF 97 31 79796627856194 [-22650157468, 68670259099, 1674823000, -91231832716, 43963076902, -6764073537, -23901790711, 55789888605, 1043180158, -79526191114, -8213679731, 52363534505, -13849368010, 62270436254, 31227943921, -70866049157, -11429315902, 8591312294, -21077861354, 54039729138, 49044094492, -88219573471, 44925347004, -35873732201, -33859317138, 34930794198, 36476 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_32 : certF 97 32 79796627856194 [-68670259099, 91231832716, 6764073537, -55789888605, 79526191114, -52363534505, -62270436254, 70866049157, -8591312294, -54039729138, 88219573471, 35873732201, -34930794198, 51879355621, -31476012949, -56228840775, 53919903191, -51719541547, -25413510839, 95888407463, -19209113016, -53979365093, 73855341714, -73342121873, -48466965025, 21235960659, -- (+452 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_33 : certF 97 33 79796627856194 [-43963076902, 79526191114, -31227943921, -54039729138, 33859317138, -31476012949, 19150619083, 95888407463, -21235960659, -48466965025, 19209113016, -10280608885, 56228840775, 36476698263, -88219573471, -11429315902, 52363534505, -23901790711, 68670259099, -1674823000, -55789888605, 13849368010, -8591312294, -44925347004, 51879355621, -30133943735, -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_34 : certF 97 34 79796627856194 [-55789888605, 70866049157, 35873732201, -56228840775, 95888407463, -73342121873, 10634348869, 30133943735, -33859317138, -11429315902, 1043180158, -22650157468, 23901790711, -31227943921, -44925347004, 61111480392, -46422349327, 48466965025, 19209113016, -53919903191, 34930794198, 8591312294, -79526191114, 68670259099, 6764073537, -62270436254, 8821 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_35 : certF 97 35 79796627856194 [8213679731, 88219573471, -30133943735, -53979365093, 19209113016, -61111480392, 54039729138, 1043180158, -68670259099, 13849368010, 35873732201, 19150619083, 73855341714, -95888407463, -12262193034, 8591312294, -23901790711, 91231832716, -31227943921, -34930794198, 10280608885, -73342121873, 25413510839, 36476698263, -70866049157, 43963076902, 67640 -- (+446 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_36 : certF 97 36 79796627856194 [-62270436254, 51879355621, -19209113016, 10634348869, 36476698263, -13849368010, 22650157468, -31227943921, 12262193034, 30528409597, -95888407463, 34930794198, 52363534505, -68670259099, 70866049157, -31476012949, -53979365093, 46422349327, -33859317138, -8213679731, -1674823000, 11429315902, 61111480392, -21235960659, 25413510839, -35873732201, -7 -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_37 : certF 97 37 79796627856194 [11429315902, 53919903191, -73855341714, -12262193034, 52363534505, -43963076902, 88219573471, -46422349327, 10634348869, -35873732201, -23901790711, 79526191114, -36476698263, -53979365093, 51719541547, -21077861354, 68670259099, -31227943921, -56228840775, 73342121873, -61111480392, 62270436254, -1674823000, -54039729138, 10280608885, -30528409597, -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_38 : certF 97 38 79796627856194 [-54039729138, 95888407463, -10280608885, -11429315902, -1674823000, -44925347004, 30528409597, -53919903191, 62270436254, 6764073537, -34930794198, 73855341714, -61111480392, -8213679731, -1043180158, 12262193034, 73342121873, -51879355621, 55789888605, -52363534505, -56228840775, 21235960659, -33859317138, 43963076902, -31227943921, 19150619083, 19 -- (+451 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_39 : certF 97 39 79796627856194 [-44925347004, 73855341714, -51879355621, 43963076902, -8591312294, -10634348869, 30133943735, -79526191114, 13849368010, -51719541547, 25413510839, 31227943921, -55789888605, 61111480392, -30528409597, 54039729138, -1674823000, -34930794198, 73342121873, -33859317138, 68670259099, -49044094492, -53979365093, 31476012949, -23901790711, 70866049157, - -- (+447 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_40 : certF 97 40 79796627856194 [-34930794198, 21235960659, -21077861354, 23901790711, -30133943735, 25413510839, 52363534505, -62270436254, 95888407463, -61111480392, 43963076902, -49044094492, 48466965025, -35873732201, -68670259099, 51879355621, -30528409597, -11429315902, -1043180158, 19150619083, 51719541547, -79526191114, 70866049157, -19209113016, -12262193034, 1674823000, - -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_41 : certF 97 41 79796627856194 [12262193034, 46422349327, -79526191114, 21077861354, -73342121873, 54039729138, -1043180158, -25413510839, 31476012949, -22650157468, 51879355621, -95888407463, -8213679731, -8591312294, 48466965025, 49044094492, -55789888605, 10280608885, -61111480392, 68670259099, -36476698263, 10634348869, 52363534505, 11429315902, 73855341714, -88219573471, 2390 -- (+447 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_42 : certF 97 42 79796627856194 [-56228840775, 30133943735, -22650157468, 61111480392, -53919903191, 68670259099, -31476012949, -19150619083, 1674823000, 12262193034, 51719541547, -91231832716, 51879355621, -10280608885, 43963076902, -36476698263, 25413510839, -6764073537, -34930794198, 46422349327, -23901790711, 33859317138, -95888407463, 55789888605, 35873732201, 10634348869, 104 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_43 : certF 97 43 79796627856194 [19150619083, 36476698263, -55789888605, 30528409597, -21077861354, 70866049157, -73855341714, -8213679731, 35873732201, 25413510839, 1674823000, -56228840775, 31476012949, -43963076902, 95888407463, -88219573471, 13849368010, -73342121873, 62270436254, -49044094492, 10634348869, -6764073537, 12262193034, 30133943735, -68670259099, 10280608885, -3385 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_44 : certF 97 44 79796627856194 [-25413510839, 49044094492, 11429315902, 19209113016, -91231832716, 53919903191, -33859317138, 13849368010, -73855341714, 55789888605, -31476012949, -12262193034, -1043180158, 48466965025, 52363534505, -34930794198, 30133943735, -43963076902, 30528409597, -70866049157, 88219573471, -10280608885, 22650157468, -46422349327, 54039729138, -8591312294, 10 -- (+449 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_45 : certF 97 45 79796627856194 [-10634348869, 31227943921, -34930794198, 31476012949, 8213679731, 21235960659, -91231832716, 10280608885, -21077861354, 88219573471, -53919903191, 23901790711, -73342121873, 55789888605, -30133943735, 44925347004, -8591312294, 25413510839, -1674823000, -53979365093, 52363534505, 12262193034, 36476698263, -62270436254, 19209113016, -22650157468, 9588 -- (+447 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_46 : certF 97 46 79796627856194 [-53979365093, 1043180158, 19150619083, 8591312294, -34930794198, 36476698263, 11429315902, 51719541547, -55789888605, 21235960659, -22650157468, 30528409597, -79526191114, 53919903191, -21077861354, 33859317138, -51879355621, 70866049157, -10280608885, 23901790711, -73855341714, 68670259099, -19209113016, -8213679731, -30133943735, 54039729138, 3587 -- (+448 chars; full line in the Zenodo source)
set_option maxHeartbeats 0 in
set_option maxRecDepth 1000000 in
theorem certF97_47 : certF 97 47 79796627856194 [48466965025, 1674823000, -53979365093, -6764073537, -10634348869, 1043180158, -25413510839, 52363534505, 19150619083, 31227943921, -56228840775, 8591312294, 12262193034, 49044094492, -34930794198, -35873732201, -44925347004, 36476698263, -54039729138, 31476012949, 11429315902, 30133943735, -62270436254, 51719541547, 8213679731, 46422349327, -5578988 -- (+446 chars; full line in the Zenodo source)
set_option maxRecDepth 1000000 in
theorem paired_char_97 (a : List Nat) (hin : AllIn 96 a) (h : HodgeList 97 a) :
cnt 1 a = cnt 96 a ∧ cnt 2 a = cnt 95 a ∧ cnt 3 a = cnt 94 a ∧ cnt 4 a = cnt 93 a ∧ cnt 5 a = cnt 92 a ∧ cnt 6 a = cnt 91 a ∧ cnt 7 a = cnt 90 a ∧ cnt 8 a = cnt 89 a ∧ cnt 9 a = cnt 88 a ∧ cnt 10 a = cnt 87 a ∧ cnt 11 a = cnt 86 a ∧ cnt 12 a = cnt 85 a ∧ cnt 13 a = cnt 84 a ∧ cnt 14 a = cnt 83 a ∧ cnt 15 a = cnt 82 a ∧ cnt 16 a = cnt 81 a ∧ cnt 17 a = cnt 80 a ∧ cnt 18 a = cnt 79 a ∧ cnt 19 a -- (+651 chars; full line in the Zenodo source)
⟨pair_one 97 0 79796627856194 [-1674823000, 6764073537, -1043180158, -52363534505, -31227943921, -8591312294, -49044094492, 35873732201, -36476698263, -31476012949, -30133943735, -51719541547, -46422349327, -19209113016, -21235960659, -73342121873, -73855341714, -30528409597, -95888407463, -10280608885, -53919903191, -61111480392, -51879355621, -33859317138, -88219573471, -21077861354, -70866049 -- (+539 chars; full line in the Zenodo source)
pair_one 97 1 79796627856194 [6764073537, -52363534505, -8591312294, 35873732201, -31476012949, -51719541547, -19209113016, -73342121873, -30528409597, -10280608885, -61111480392, -33859317138, -21077861354, -13849368010, -23901790711, -22650157468, -43963076902, 8213679731, 11429315902, -44925347004, 12262193034, 19150619083, -10634348869, 48466965025, 53979365093, 25413510839, 56228840775, 34 -- (+515 chars; full line in the Zenodo source)
pair_one 97 2 79796627856194 [-1043180158, -8591312294, -36476698263, -51719541547, -21235960659, -30528409597, -53919903191, -33859317138, -70866049157, -23901790711, -68670259099, 8213679731, -54039729138, 12262193034, -25413510839, 48466965025, 10634348869, 56228840775, 44925347004, 62270436254, 43963076902, 91231832716, 13849368010, 88219573471, 61111480392, 95888407463, 73342121873, 464223 -- (+523 chars; full line in the Zenodo source)
pair_one 97 3 79796627856194 [-52363534505, 35873732201, -51719541547, -73342121873, -10280608885, -33859317138, -13849368010, -22650157468, 8213679731, -44925347004, 19150619083, 48466965025, 25413510839, 34930794198, 62270436254, 68670259099, 79526191114, 88219573471, 53919903191, 73855341714, 46422349327, 36476698263, 31227943921, 1674823000, -1043180158, -49044094492, -30133943735, -2123596 -- (+521 chars; full line in the Zenodo source)
pair_one 97 4 79796627856194 [-31227943921, -31476012949, -21235960659, -10280608885, -88219573471, -23901790711, -55789888605, -44925347004, -25413510839, 53979365093, -12262193034, 62270436254, 22650157468, 70866049157, 61111480392, 73855341714, 51719541547, 49044094492, -6764073537, -1043180158, 35873732201, -46422349327, -30528409597, -51879355621, -13849368010, -68670259099, 11429315902, - -- (+526 chars; full line in the Zenodo source)
pair_one 97 5 79796627856194 [-8591312294, -51719541547, -30528409597, -33859317138, -23901790711, 8213679731, 12262193034, 48466965025, 56228840775, 62270436254, 91231832716, 88219573471, 95888407463, 46422349327, 49044094492, 1674823000, -31227943921, -30133943735, -73855341714, -51879355621, -79526191114, -55789888605, -34930794198, -53979365093, -19150619083, -11429315902, 22650157468, 2107 -- (+523 chars; full line in the Zenodo source)
pair_one 97 6 79796627856194 [-49044094492, -19209113016, -53919903191, -13849368010, -55789888605, 12262193034, -48466965025, 34930794198, 43963076902, 70866049157, 10280608885, 46422349327, 8591312294, -1674823000, 35873732201, -21235960659, -61111480392, -79526191114, 8213679731, -56228840775, 53979365093, 44925347004, 68670259099, 21077861354, 95888407463, 51719541547, 31227943921, 67640735 -- (+520 chars; full line in the Zenodo source)
pair_one 97 7 79796627856194 [35873732201, -73342121873, -33859317138, -22650157468, -44925347004, 48466965025, 34930794198, 68670259099, 88219573471, 73855341714, 36476698263, 1674823000, -49044094492, -21235960659, -51879355621, -91231832716, -54039729138, -53979365093, -12262193034, 43963076902, 21077861354, 30528409597, 31476012949, -6764073537, -8591312294, -19209113016, -61111480392, -239 -- (+523 chars; full line in the Zenodo source)
pair_one 97 8 79796627856194 [-36476698263, -30528409597, -70866049157, 8213679731, -25413510839, 56228840775, 43963076902, 88219573471, 73342121873, 49044094492, 6764073537, -30133943735, -10280608885, -79526191114, 11429315902, -53979365093, 34930794198, 22650157468, 51879355621, 19209113016, 31227943921, -52363534505, -46422349327, -61111480392, -91231832716, -44925347004, -48466965025, 5403 -- (+519 chars; full line in the Zenodo source)
pair_one 97 9 79796627856194 [-31476012949, -10280608885, -23901790711, -44925347004, 53979365093, 62270436254, 70866049157, 73855341714, 49044094492, -1043180158, -46422349327, -51879355621, -68670259099, -56228840775, -19150619083, 43963076902, 33859317138, 19209113016, 52363534505, -8591312294, -73342121873, -21077861354, 8213679731, -10634348869, 34930794198, 91231832716, 53919903191, 30133 -- (+522 chars; full line in the Zenodo source)
pair_one 97 10 79796627856194 [-30133943735, -61111480392, -68670259099, 19150619083, -12262193034, 91231832716, 10280608885, 36476698263, 6764073537, -46422349327, -33859317138, -55789888605, -10634348869, 44925347004, 79526191114, 30528409597, 49044094492, -52363534505, -21235960659, -21077861354, -62270436254, 48466965025, -11429315902, 70866049157, 73342121873, 31227943921, -8591312294, -73 -- (+525 chars; full line in the Zenodo source)
pair_one 97 11 79796627856194 [-51719541547, -33859317138, 8213679731, 48466965025, 62270436254, 88219573471, 46422349327, 1674823000, -30133943735, -51879355621, -55789888605, -53979365093, -11429315902, 21077861354, 19209113016, -6764073537, -31476012949, -61111480392, -43963076902, -10634348869, 54039729138, 70866049157, 21235960659, 1043180158, -36476698263, -53919903191, -68670259099, -254 -- (+523 chars; full line in the Zenodo source)
pair_one 97 12 79796627856194 [-46422349327, -21077861354, -54039729138, 25413510839, 22650157468, 95888407463, 8591312294, -49044094492, -10280608885, -68670259099, -10634348869, -11429315902, 88219573471, 51719541547, -1674823000, -19209113016, -70866049157, -44925347004, -19150619083, 91231832716, 30528409597, 31227943921, 35873732201, -53919903191, -43963076902, -53979365093, 62270436254, 3 -- (+526 chars; full line in the Zenodo source)
pair_one 97 13 79796627856194 [-19209113016, -13849368010, 12262193034, 34930794198, 70866049157, 46422349327, -1674823000, -21235960659, -79526191114, -56228840775, 44925347004, 21077861354, 51719541547, 6764073537, -73342121873, -23901790711, 19150619083, 54039729138, 88219573471, 30133943735, -1043180158, -73855341714, -91231832716, -25413510839, -11429315902, 33859317138, 31476012949, -5236 -- (+526 chars; full line in the Zenodo source)
pair_one 97 14 79796627856194 [-21235960659, -23901790711, -25413510839, 62270436254, 61111480392, 49044094492, 35873732201, -51879355621, 11429315902, -19150619083, 79526191114, 19209113016, -1674823000, -73342121873, -91231832716, -10634348869, -8213679731, 53919903191, 8591312294, -36476698263, -33859317138, -54039729138, 56228840775, 13849368010, 46422349327, 6764073537, -73855341714, -2265 -- (+526 chars; full line in the Zenodo source)
pair_one 97 15 79796627856194 [-73342121873, -22650157468, 48466965025, 68670259099, 73855341714, 1674823000, -21235960659, -91231832716, -53979365093, 43963076902, 30528409597, -6764073537, -19209113016, -23901790711, -10634348869, 55789888605, 95888407463, 1043180158, -46422349327, -79526191114, -25413510839, -8213679731, 10280608885, 52363534505, -51719541547, -13849368010, 19150619083, 6227 -- (+525 chars; full line in the Zenodo source)
pair_one 97 16 79796627856194 [-73855341714, -43963076902, 10634348869, 79526191114, 51719541547, -31227943921, -61111480392, -54039729138, 34930794198, 33859317138, 49044094492, -31476012949, -70866049157, 19150619083, -8213679731, 95888407463, -6764073537, -21235960659, -22650157468, -48466965025, 91231832716, 19209113016, -1043180158, -10280608885, -62270436254, 56228840775, 21077861354, 364 -- (+526 chars; full line in the Zenodo source)
pair_one 97 17 79796627856194 [-30528409597, 8213679731, 56228840775, 88219573471, 49044094492, -30133943735, -79526191114, -53979365093, 22650157468, 19209113016, -52363534505, -61111480392, -44925347004, 54039729138, 53919903191, 1043180158, -21235960659, -68670259099, 10634348869, 13849368010, 31476012949, 35873732201, -21077861354, 19150619083, 55789888605, 73855341714, -1674823000, -958884 -- (+523 chars; full line in the Zenodo source)
pair_one 97 18 79796627856194 [-95888407463, 11429315902, 44925347004, 53919903191, -6764073537, -73855341714, 8213679731, -12262193034, 51879355621, 52363534505, -21235960659, -43963076902, -19150619083, 88219573471, 8591312294, -46422349327, -22650157468, 10634348869, 70866049157, -35873732201, -30133943735, -23901790711, -48466965025, 79526191114, 31476012949, -36476698263, -13849368010, -53 -- (+528 chars; full line in the Zenodo source)
pair_one 97 19 79796627856194 [-10280608885, -44925347004, 62270436254, 73855341714, -1043180158, -51879355621, -56228840775, 43963076902, 19209113016, -8591312294, -21077861354, -10634348869, 91231832716, 30133943735, -36476698263, -79526191114, -48466965025, 13849368010, -35873732201, -51719541547, -22650157468, 25413510839, 88219573471, 31227943921, -21235960659, -55789888605, -12262193034, -- (+528 chars; full line in the Zenodo source)
pair_one 97 20 79796627856194 [-53919903191, 12262193034, 43963076902, 46422349327, 35873732201, -79526191114, 53979365093, 21077861354, 31227943921, -73342121873, -62270436254, 54039729138, 30528409597, -1043180158, -33859317138, -25413510839, 91231832716, 31476012949, -30133943735, -22650157468, -19150619083, 51879355621, -6764073537, -95888407463, -44925347004, -8213679731, 21235960659, -859 -- (+524 chars; full line in the Zenodo source)
pair_one 97 21 79796627856194 [-61111480392, 19150619083, 91231832716, 36476698263, -46422349327, -55789888605, 44925347004, 30528409597, -52363534505, -21077861354, 48466965025, 70866049157, 31227943921, -73855341714, -54039729138, -8213679731, 19209113016, 35873732201, -23901790711, 25413510839, 51879355621, 1674823000, -53919903191, -56228840775, 22650157468, 31476012949, -51719541547, -4396 -- (+521 chars; full line in the Zenodo source)
pair_one 97 22 79796627856194 [-51879355621, -10634348869, 13849368010, 31227943921, -30528409597, -34930794198, 68670259099, 31476012949, -46422349327, 8213679731, -11429315902, 21235960659, 35873732201, -91231832716, 56228840775, 10280608885, -1043180158, -21077861354, -48466965025, 88219573471, -6764073537, -53919903191, 19150619083, 23901790711, 49044094492, -73342121873, -54039729138, 5578 -- (+524 chars; full line in the Zenodo source)
pair_one 97 23 79796627856194 [-33859317138, 48466965025, 88219573471, 1674823000, -51879355621, -53979365093, 21077861354, -6764073537, -61111480392, -10634348869, 70866049157, 1043180158, -53919903191, -25413510839, 13849368010, 52363534505, -10280608885, 19150619083, 79526191114, 31227943921, -95888407463, -56228840775, 23901790711, 8591312294, -30528409597, 12262193034, 91231832716, 4904409 -- (+523 chars; full line in the Zenodo source)
pair_one 97 24 79796627856194 [-88219573471, 53979365093, 61111480392, -1043180158, -13849368010, -19150619083, 95888407463, -8591312294, -91231832716, 34930794198, 73342121873, -36476698263, -43963076902, -11429315902, 46422349327, -51719541547, -62270436254, 55789888605, 31476012949, -21235960659, -44925347004, 22650157468, 49044094492, -30528409597, -56228840775, 79526191114, 52363534505, -5 -- (+525 chars; full line in the Zenodo source)
pair_one 97 25 79796627856194 [-21077861354, 25413510839, 95888407463, -49044094492, -68670259099, -11429315902, 51719541547, -19209113016, -44925347004, 91231832716, 31227943921, -53919903191, -53979365093, 33859317138, 6764073537, -13849368010, 56228840775, 73855341714, -36476698263, -55789888605, -8213679731, 31476012949, -73342121873, 12262193034, 79526191114, 1043180158, -51879355621, -484 -- (+524 chars; full line in the Zenodo source)
pair_one 97 26 79796627856194 [-70866049157, 56228840775, 73342121873, -30133943735, 11429315902, 22650157468, 31227943921, -61111480392, -48466965025, 53919903191, -8591312294, -68670259099, 62270436254, 31476012949, -73855341714, 19150619083, 21077861354, -1674823000, -13849368010, -12262193034, 21235960659, -51719541547, -54039729138, 91231832716, 52363534505, -51879355621, 53979365093, 1028 -- (+523 chars; full line in the Zenodo source)
pair_one 97 27 79796627856194 [-13849368010, 34930794198, 46422349327, -21235960659, -56228840775, 21077861354, 6764073537, -23901790711, 54039729138, 30133943735, -73855341714, -25413510839, 33859317138, -52363534505, -22650157468, 62270436254, 36476698263, -95888407463, -53979365093, 61111480392, -8591312294, -43963076902, 55789888605, 49044094492, -53919903191, -48466965025, 10280608885, 358 -- (+522 chars; full line in the Zenodo source)
pair_one 97 28 79796627856194 [-79526191114, 54039729138, 31476012949, -95888407463, 48466965025, 10280608885, -36476698263, 11429315902, 23901790711, 1674823000, -13849368010, 44925347004, 30133943735, -30528409597, -53979365093, 53919903191, 35873732201, -62270436254, 91231832716, -6764073537, -70866049157, 34930794198, 51719541547, -73855341714, -10634348869, 61111480392, -49044094492, 82136 -- (+522 chars; full line in the Zenodo source)
pair_one 97 29 79796627856194 [-23901790711, 62270436254, 49044094492, -51879355621, -19150619083, 19209113016, -73342121873, -10634348869, 53919903191, -36476698263, -54039729138, 13849368010, 6764073537, -22650157468, 55789888605, 31227943921, -88219573471, -12262193034, 51719541547, -30528409597, 48466965025, 95888407463, -30133943735, -34930794198, 21077861354, -52363534505, -43963076902, 6 -- (+524 chars; full line in the Zenodo source)
pair_one 97 30 79796627856194 [-91231832716, 55789888605, 52363534505, -70866049157, 54039729138, -35873732201, -51879355621, 56228840775, 51719541547, -95888407463, 53979365093, 73342121873, -21235960659, -10634348869, 10280608885, -30133943735, 12262193034, 33859317138, -49044094492, 11429315902, 13849368010, -1043180158, -43963076902, 22650157468, 1674823000, -23901790711, -8213679731, 31227 -- (+525 chars; full line in the Zenodo source)
pair_one 97 31 79796627856194 [-22650157468, 68670259099, 1674823000, -91231832716, 43963076902, -6764073537, -23901790711, 55789888605, 1043180158, -79526191114, -8213679731, 52363534505, -13849368010, 62270436254, 31227943921, -70866049157, -11429315902, 8591312294, -21077861354, 54039729138, 49044094492, -88219573471, 44925347004, -35873732201, -33859317138, 34930794198, 36476698263, -518793 -- (+523 chars; full line in the Zenodo source)
pair_one 97 32 79796627856194 [-68670259099, 91231832716, 6764073537, -55789888605, 79526191114, -52363534505, -62270436254, 70866049157, -8591312294, -54039729138, 88219573471, 35873732201, -34930794198, 51879355621, -31476012949, -56228840775, 53919903191, -51719541547, -25413510839, 95888407463, -19209113016, -53979365093, 73855341714, -73342121873, -48466965025, 21235960659, -30528409597, 1 -- (+527 chars; full line in the Zenodo source)
pair_one 97 33 79796627856194 [-43963076902, 79526191114, -31227943921, -54039729138, 33859317138, -31476012949, 19150619083, 95888407463, -21235960659, -48466965025, 19209113016, -10280608885, 56228840775, 36476698263, -88219573471, -11429315902, 52363534505, -23901790711, 68670259099, -1674823000, -55789888605, 13849368010, -8591312294, -44925347004, 51879355621, -30133943735, -25413510839, 3 -- (+526 chars; full line in the Zenodo source)
pair_one 97 34 79796627856194 [-55789888605, 70866049157, 35873732201, -56228840775, 95888407463, -73342121873, 10634348869, 30133943735, -33859317138, -11429315902, 1043180158, -22650157468, 23901790711, -31227943921, -44925347004, 61111480392, -46422349327, 48466965025, 19209113016, -53919903191, 34930794198, 8591312294, -79526191114, 68670259099, 6764073537, -62270436254, 88219573471, -31476 -- (+523 chars; full line in the Zenodo source)
pair_one 97 35 79796627856194 [8213679731, 88219573471, -30133943735, -53979365093, 19209113016, -61111480392, 54039729138, 1043180158, -68670259099, 13849368010, 35873732201, 19150619083, 73855341714, -95888407463, -12262193034, 8591312294, -23901790711, 91231832716, -31227943921, -34930794198, 10280608885, -73342121873, 25413510839, 36476698263, -70866049157, 43963076902, 6764073537, 11429315 -- (+521 chars; full line in the Zenodo source)
pair_one 97 36 79796627856194 [-62270436254, 51879355621, -19209113016, 10634348869, 36476698263, -13849368010, 22650157468, -31227943921, 12262193034, 30528409597, -95888407463, 34930794198, 52363534505, -68670259099, 70866049157, -31476012949, -53979365093, 46422349327, -33859317138, -8213679731, -1674823000, 11429315902, 61111480392, -21235960659, 25413510839, -35873732201, -79526191114, 912 -- (+524 chars; full line in the Zenodo source)
pair_one 97 37 79796627856194 [11429315902, 53919903191, -73855341714, -12262193034, 52363534505, -43963076902, 88219573471, -46422349327, 10634348869, -35873732201, -23901790711, 79526191114, -36476698263, -53979365093, 51719541547, -21077861354, 68670259099, -31227943921, -56228840775, 73342121873, -61111480392, 62270436254, -1674823000, -54039729138, 10280608885, -30528409597, 34930794198, 1 -- (+524 chars; full line in the Zenodo source)
pair_one 97 38 79796627856194 [-54039729138, 95888407463, -10280608885, -11429315902, -1674823000, -44925347004, 30528409597, -53919903191, 62270436254, 6764073537, -34930794198, 73855341714, -61111480392, -8213679731, -1043180158, 12262193034, 73342121873, -51879355621, 55789888605, -52363534505, -56228840775, 21235960659, -33859317138, 43963076902, -31227943921, 19150619083, 19209113016, -882 -- (+526 chars; full line in the Zenodo source)
pair_one 97 39 79796627856194 [-44925347004, 73855341714, -51879355621, 43963076902, -8591312294, -10634348869, 30133943735, -79526191114, 13849368010, -51719541547, 25413510839, 31227943921, -55789888605, 61111480392, -30528409597, 54039729138, -1674823000, -34930794198, 73342121873, -33859317138, 68670259099, -49044094492, -53979365093, 31476012949, -23901790711, 70866049157, -46422349327, -1 -- (+522 chars; full line in the Zenodo source)
pair_one 97 40 79796627856194 [-34930794198, 21235960659, -21077861354, 23901790711, -30133943735, 25413510839, 52363534505, -62270436254, 95888407463, -61111480392, 43963076902, -49044094492, 48466965025, -35873732201, -68670259099, 51879355621, -30528409597, -11429315902, -1043180158, 19150619083, 51719541547, -79526191114, 70866049157, -19209113016, -12262193034, 1674823000, -44925347004, 73 -- (+524 chars; full line in the Zenodo source)
pair_one 97 41 79796627856194 [12262193034, 46422349327, -79526191114, 21077861354, -73342121873, 54039729138, -1043180158, -25413510839, 31476012949, -22650157468, 51879355621, -95888407463, -8213679731, -8591312294, 48466965025, 49044094492, -55789888605, 10280608885, -61111480392, 68670259099, -36476698263, 10634348869, 52363534505, 11429315902, 73855341714, -88219573471, 23901790711, -51719 -- (+522 chars; full line in the Zenodo source)
pair_one 97 42 79796627856194 [-56228840775, 30133943735, -22650157468, 61111480392, -53919903191, 68670259099, -31476012949, -19150619083, 1674823000, 12262193034, 51719541547, -91231832716, 51879355621, -10280608885, 43963076902, -36476698263, 25413510839, -6764073537, -34930794198, 46422349327, -23901790711, 33859317138, -95888407463, 55789888605, 35873732201, 10634348869, 1043180158, -44925 -- (+523 chars; full line in the Zenodo source)
pair_one 97 43 79796627856194 [19150619083, 36476698263, -55789888605, 30528409597, -21077861354, 70866049157, -73855341714, -8213679731, 35873732201, 25413510839, 1674823000, -56228840775, 31476012949, -43963076902, 95888407463, -88219573471, 13849368010, -73342121873, 62270436254, -49044094492, 10634348869, -6764073537, 12262193034, 30133943735, -68670259099, 10280608885, -33859317138, 795261 -- (+523 chars; full line in the Zenodo source)
pair_one 97 44 79796627856194 [-25413510839, 49044094492, 11429315902, 19209113016, -91231832716, 53919903191, -33859317138, 13849368010, -73855341714, 55789888605, -31476012949, -12262193034, -1043180158, 48466965025, 52363534505, -34930794198, 30133943735, -43963076902, 30528409597, -70866049157, 88219573471, -10280608885, 22650157468, -46422349327, 54039729138, -8591312294, 10634348869, 1674 -- (+524 chars; full line in the Zenodo source)
pair_one 97 45 79796627856194 [-10634348869, 31227943921, -34930794198, 31476012949, 8213679731, 21235960659, -91231832716, 10280608885, -21077861354, 88219573471, -53919903191, 23901790711, -73342121873, 55789888605, -30133943735, 44925347004, -8591312294, 25413510839, -1674823000, -53979365093, 52363534505, 12262193034, 36476698263, -62270436254, 19209113016, -22650157468, 95888407463, -70866 -- (+522 chars; full line in the Zenodo source)
pair_one 97 46 79796627856194 [-53979365093, 1043180158, 19150619083, 8591312294, -34930794198, 36476698263, 11429315902, 51719541547, -55789888605, 21235960659, -22650157468, 30528409597, -79526191114, 53919903191, -21077861354, 33859317138, -51879355621, 70866049157, -10280608885, 23901790711, -73855341714, 68670259099, -19209113016, -8213679731, -30133943735, 54039729138, 35873732201, -12262 -- (+523 chars; full line in the Zenodo source)
pair_one 97 47 79796627856194 [48466965025, 1674823000, -53979365093, -6764073537, -10634348869, 1043180158, -25413510839, 52363534505, 19150619083, 31227943921, -56228840775, 8591312294, 12262193034, 49044094492, -34930794198, -35873732201, -44925347004, 36476698263, -54039729138, 31476012949, 11429315902, 30133943735, -62270436254, 51719541547, 8213679731, 46422349327, -55789888605, 192091130 -- (+521 chars; full line in the Zenodo source)
end FermatPrimes3
#print axioms FermatPrimes3.certF53_0
#print axioms FermatPrimes3.certF53_1
#print axioms FermatPrimes3.certF53_2
#print axioms FermatPrimes3.certF53_3
#print axioms FermatPrimes3.certF53_4
#print axioms FermatPrimes3.certF53_5
#print axioms FermatPrimes3.certF53_6
#print axioms FermatPrimes3.certF53_7
#print axioms FermatPrimes3.certF53_8
#print axioms FermatPrimes3.certF53_9
#print axioms FermatPrimes3.certF53_10
#print axioms FermatPrimes3.certF53_11
#print axioms FermatPrimes3.certF53_12
#print axioms FermatPrimes3.certF53_13
#print axioms FermatPrimes3.certF53_14
#print axioms FermatPrimes3.certF53_15
#print axioms FermatPrimes3.certF53_16
#print axioms FermatPrimes3.certF53_17
#print axioms FermatPrimes3.certF53_18
#print axioms FermatPrimes3.certF53_19
#print axioms FermatPrimes3.certF53_20
#print axioms FermatPrimes3.certF53_21
#print axioms FermatPrimes3.certF53_22
#print axioms FermatPrimes3.certF53_23
#print axioms FermatPrimes3.certF53_24
#print axioms FermatPrimes3.certF53_25
#print axioms FermatPrimes3.paired_char_53
#print axioms FermatPrimes3.certF59_0
#print axioms FermatPrimes3.certF59_1
#print axioms FermatPrimes3.certF59_2
#print axioms FermatPrimes3.certF59_3
#print axioms FermatPrimes3.certF59_4
#print axioms FermatPrimes3.certF59_5
#print axioms FermatPrimes3.certF59_6
#print axioms FermatPrimes3.certF59_7
#print axioms FermatPrimes3.certF59_8
#print axioms FermatPrimes3.certF59_9
#print axioms FermatPrimes3.certF59_10
#print axioms FermatPrimes3.certF59_11
#print axioms FermatPrimes3.certF59_12
#print axioms FermatPrimes3.certF59_13
#print axioms FermatPrimes3.certF59_14
#print axioms FermatPrimes3.certF59_15
#print axioms FermatPrimes3.certF59_16
#print axioms FermatPrimes3.certF59_17
#print axioms FermatPrimes3.certF59_18
#print axioms FermatPrimes3.certF59_19
#print axioms FermatPrimes3.certF59_20
#print axioms FermatPrimes3.certF59_21
#print axioms FermatPrimes3.certF59_22
#print axioms FermatPrimes3.certF59_23
#print axioms FermatPrimes3.certF59_24
#print axioms FermatPrimes3.certF59_25
#print axioms FermatPrimes3.certF59_26
#print axioms FermatPrimes3.certF59_27
#print axioms FermatPrimes3.certF59_28
#print axioms FermatPrimes3.paired_char_59
#print axioms FermatPrimes3.certF61_0
#print axioms FermatPrimes3.certF61_1
#print axioms FermatPrimes3.certF61_2
#print axioms FermatPrimes3.certF61_3
#print axioms FermatPrimes3.certF61_4
#print axioms FermatPrimes3.certF61_5
#print axioms FermatPrimes3.certF61_6
#print axioms FermatPrimes3.certF61_7
#print axioms FermatPrimes3.certF61_8
#print axioms FermatPrimes3.certF61_9
#print axioms FermatPrimes3.certF61_10
#print axioms FermatPrimes3.certF61_11
#print axioms FermatPrimes3.certF61_12
#print axioms FermatPrimes3.certF61_13
#print axioms FermatPrimes3.certF61_14
#print axioms FermatPrimes3.certF61_15
#print axioms FermatPrimes3.certF61_16
#print axioms FermatPrimes3.certF61_17
#print axioms FermatPrimes3.certF61_18
#print axioms FermatPrimes3.certF61_19
#print axioms FermatPrimes3.certF61_20
#print axioms FermatPrimes3.certF61_21
#print axioms FermatPrimes3.certF61_22
#print axioms FermatPrimes3.certF61_23
#print axioms FermatPrimes3.certF61_24
#print axioms FermatPrimes3.certF61_25
#print axioms FermatPrimes3.certF61_26
#print axioms FermatPrimes3.certF61_27
#print axioms FermatPrimes3.certF61_28
#print axioms FermatPrimes3.certF61_29
#print axioms FermatPrimes3.paired_char_61
#print axioms FermatPrimes3.certF67_0
#print axioms FermatPrimes3.certF67_1
#print axioms FermatPrimes3.certF67_2
#print axioms FermatPrimes3.certF67_3
#print axioms FermatPrimes3.certF67_4
#print axioms FermatPrimes3.certF67_5
#print axioms FermatPrimes3.certF67_6
#print axioms FermatPrimes3.certF67_7
#print axioms FermatPrimes3.certF67_8
#print axioms FermatPrimes3.certF67_9
#print axioms FermatPrimes3.certF67_10
#print axioms FermatPrimes3.certF67_11
#print axioms FermatPrimes3.certF67_12
#print axioms FermatPrimes3.certF67_13
#print axioms FermatPrimes3.certF67_14
#print axioms FermatPrimes3.certF67_15
#print axioms FermatPrimes3.certF67_16
#print axioms FermatPrimes3.certF67_17
#print axioms FermatPrimes3.certF67_18
#print axioms FermatPrimes3.certF67_19
#print axioms FermatPrimes3.certF67_20
#print axioms FermatPrimes3.certF67_21
#print axioms FermatPrimes3.certF67_22
#print axioms FermatPrimes3.certF67_23
#print axioms FermatPrimes3.certF67_24
#print axioms FermatPrimes3.certF67_25
#print axioms FermatPrimes3.certF67_26
#print axioms FermatPrimes3.certF67_27
#print axioms FermatPrimes3.certF67_28
#print axioms FermatPrimes3.certF67_29
#print axioms FermatPrimes3.certF67_30
#print axioms FermatPrimes3.certF67_31
#print axioms FermatPrimes3.certF67_32
#print axioms FermatPrimes3.paired_char_67
#print axioms FermatPrimes3.certF71_0
#print axioms FermatPrimes3.certF71_1
#print axioms FermatPrimes3.certF71_2
#print axioms FermatPrimes3.certF71_3
#print axioms FermatPrimes3.certF71_4
#print axioms FermatPrimes3.certF71_5
#print axioms FermatPrimes3.certF71_6
#print axioms FermatPrimes3.certF71_7
#print axioms FermatPrimes3.certF71_8
#print axioms FermatPrimes3.certF71_9
#print axioms FermatPrimes3.certF71_10
#print axioms FermatPrimes3.certF71_11
#print axioms FermatPrimes3.certF71_12
#print axioms FermatPrimes3.certF71_13
#print axioms FermatPrimes3.certF71_14
#print axioms FermatPrimes3.certF71_15
#print axioms FermatPrimes3.certF71_16
#print axioms FermatPrimes3.certF71_17
#print axioms FermatPrimes3.certF71_18
#print axioms FermatPrimes3.certF71_19
#print axioms FermatPrimes3.certF71_20
#print axioms FermatPrimes3.certF71_21
#print axioms FermatPrimes3.certF71_22
#print axioms FermatPrimes3.certF71_23
#print axioms FermatPrimes3.certF71_24
#print axioms FermatPrimes3.certF71_25
#print axioms FermatPrimes3.certF71_26
#print axioms FermatPrimes3.certF71_27
#print axioms FermatPrimes3.certF71_28
#print axioms FermatPrimes3.certF71_29
#print axioms FermatPrimes3.certF71_30
#print axioms FermatPrimes3.certF71_31
#print axioms FermatPrimes3.certF71_32
#print axioms FermatPrimes3.certF71_33
#print axioms FermatPrimes3.certF71_34
#print axioms FermatPrimes3.paired_char_71
#print axioms FermatPrimes3.certF73_0
#print axioms FermatPrimes3.certF73_1
#print axioms FermatPrimes3.certF73_2
#print axioms FermatPrimes3.certF73_3
#print axioms FermatPrimes3.certF73_4
#print axioms FermatPrimes3.certF73_5
#print axioms FermatPrimes3.certF73_6
#print axioms FermatPrimes3.certF73_7
#print axioms FermatPrimes3.certF73_8
#print axioms FermatPrimes3.certF73_9
#print axioms FermatPrimes3.certF73_10
#print axioms FermatPrimes3.certF73_11
#print axioms FermatPrimes3.certF73_12
#print axioms FermatPrimes3.certF73_13
#print axioms FermatPrimes3.certF73_14
#print axioms FermatPrimes3.certF73_15
#print axioms FermatPrimes3.certF73_16
#print axioms FermatPrimes3.certF73_17
#print axioms FermatPrimes3.certF73_18
#print axioms FermatPrimes3.certF73_19
#print axioms FermatPrimes3.certF73_20
#print axioms FermatPrimes3.certF73_21
#print axioms FermatPrimes3.certF73_22
#print axioms FermatPrimes3.certF73_23
#print axioms FermatPrimes3.certF73_24
#print axioms FermatPrimes3.certF73_25
#print axioms FermatPrimes3.certF73_26
#print axioms FermatPrimes3.certF73_27
#print axioms FermatPrimes3.certF73_28
#print axioms FermatPrimes3.certF73_29
#print axioms FermatPrimes3.certF73_30
#print axioms FermatPrimes3.certF73_31
#print axioms FermatPrimes3.certF73_32
#print axioms FermatPrimes3.certF73_33
#print axioms FermatPrimes3.certF73_34
#print axioms FermatPrimes3.certF73_35
#print axioms FermatPrimes3.paired_char_73
#print axioms FermatPrimes3.certF79_0
#print axioms FermatPrimes3.certF79_1
#print axioms FermatPrimes3.certF79_2
#print axioms FermatPrimes3.certF79_3
#print axioms FermatPrimes3.certF79_4
#print axioms FermatPrimes3.certF79_5
#print axioms FermatPrimes3.certF79_6
#print axioms FermatPrimes3.certF79_7
#print axioms FermatPrimes3.certF79_8
#print axioms FermatPrimes3.certF79_9
#print axioms FermatPrimes3.certF79_10
#print axioms FermatPrimes3.certF79_11
#print axioms FermatPrimes3.certF79_12
#print axioms FermatPrimes3.certF79_13
#print axioms FermatPrimes3.certF79_14
#print axioms FermatPrimes3.certF79_15
#print axioms FermatPrimes3.certF79_16
#print axioms FermatPrimes3.certF79_17
#print axioms FermatPrimes3.certF79_18
#print axioms FermatPrimes3.certF79_19
#print axioms FermatPrimes3.certF79_20
#print axioms FermatPrimes3.certF79_21
#print axioms FermatPrimes3.certF79_22
#print axioms FermatPrimes3.certF79_23
#print axioms FermatPrimes3.certF79_24
#print axioms FermatPrimes3.certF79_25
#print axioms FermatPrimes3.certF79_26
#print axioms FermatPrimes3.certF79_27
#print axioms FermatPrimes3.certF79_28
#print axioms FermatPrimes3.certF79_29
#print axioms FermatPrimes3.certF79_30
#print axioms FermatPrimes3.certF79_31
#print axioms FermatPrimes3.certF79_32
#print axioms FermatPrimes3.certF79_33
#print axioms FermatPrimes3.certF79_34
#print axioms FermatPrimes3.certF79_35
#print axioms FermatPrimes3.certF79_36
#print axioms FermatPrimes3.certF79_37
#print axioms FermatPrimes3.certF79_38
#print axioms FermatPrimes3.paired_char_79
#print axioms FermatPrimes3.certF83_0
#print axioms FermatPrimes3.certF83_1
#print axioms FermatPrimes3.certF83_2
#print axioms FermatPrimes3.certF83_3
#print axioms FermatPrimes3.certF83_4
#print axioms FermatPrimes3.certF83_5
#print axioms FermatPrimes3.certF83_6
#print axioms FermatPrimes3.certF83_7
#print axioms FermatPrimes3.certF83_8
#print axioms FermatPrimes3.certF83_9
#print axioms FermatPrimes3.certF83_10
#print axioms FermatPrimes3.certF83_11
#print axioms FermatPrimes3.certF83_12
#print axioms FermatPrimes3.certF83_13
#print axioms FermatPrimes3.certF83_14
#print axioms FermatPrimes3.certF83_15
#print axioms FermatPrimes3.certF83_16
#print axioms FermatPrimes3.certF83_17
#print axioms FermatPrimes3.certF83_18
#print axioms FermatPrimes3.certF83_19
#print axioms FermatPrimes3.certF83_20
#print axioms FermatPrimes3.certF83_21
#print axioms FermatPrimes3.certF83_22
#print axioms FermatPrimes3.certF83_23
#print axioms FermatPrimes3.certF83_24
#print axioms FermatPrimes3.certF83_25
#print axioms FermatPrimes3.certF83_26
#print axioms FermatPrimes3.certF83_27
#print axioms FermatPrimes3.certF83_28
#print axioms FermatPrimes3.certF83_29
#print axioms FermatPrimes3.certF83_30
#print axioms FermatPrimes3.certF83_31
#print axioms FermatPrimes3.certF83_32
#print axioms FermatPrimes3.certF83_33
#print axioms FermatPrimes3.certF83_34
#print axioms FermatPrimes3.certF83_35
#print axioms FermatPrimes3.certF83_36
#print axioms FermatPrimes3.certF83_37
#print axioms FermatPrimes3.certF83_38
#print axioms FermatPrimes3.certF83_39
#print axioms FermatPrimes3.certF83_40
#print axioms FermatPrimes3.paired_char_83
#print axioms FermatPrimes3.certF89_0
#print axioms FermatPrimes3.certF89_1
#print axioms FermatPrimes3.certF89_2
#print axioms FermatPrimes3.certF89_3
#print axioms FermatPrimes3.certF89_4
#print axioms FermatPrimes3.certF89_5
#print axioms FermatPrimes3.certF89_6
#print axioms FermatPrimes3.certF89_7
#print axioms FermatPrimes3.certF89_8
#print axioms FermatPrimes3.certF89_9
#print axioms FermatPrimes3.certF89_10
#print axioms FermatPrimes3.certF89_11
#print axioms FermatPrimes3.certF89_12
#print axioms FermatPrimes3.certF89_13
#print axioms FermatPrimes3.certF89_14
#print axioms FermatPrimes3.certF89_15
#print axioms FermatPrimes3.certF89_16
#print axioms FermatPrimes3.certF89_17
#print axioms FermatPrimes3.certF89_18
#print axioms FermatPrimes3.certF89_19
#print axioms FermatPrimes3.certF89_20
#print axioms FermatPrimes3.certF89_21
#print axioms FermatPrimes3.certF89_22
#print axioms FermatPrimes3.certF89_23
#print axioms FermatPrimes3.certF89_24
#print axioms FermatPrimes3.certF89_25
#print axioms FermatPrimes3.certF89_26
#print axioms FermatPrimes3.certF89_27
#print axioms FermatPrimes3.certF89_28
#print axioms FermatPrimes3.certF89_29
#print axioms FermatPrimes3.certF89_30
#print axioms FermatPrimes3.certF89_31
#print axioms FermatPrimes3.certF89_32
#print axioms FermatPrimes3.certF89_33
#print axioms FermatPrimes3.certF89_34
#print axioms FermatPrimes3.certF89_35
#print axioms FermatPrimes3.certF89_36
#print axioms FermatPrimes3.certF89_37
#print axioms FermatPrimes3.certF89_38
#print axioms FermatPrimes3.certF89_39
#print axioms FermatPrimes3.certF89_40
#print axioms FermatPrimes3.certF89_41
#print axioms FermatPrimes3.certF89_42
#print axioms FermatPrimes3.certF89_43
#print axioms FermatPrimes3.paired_char_89
#print axioms FermatPrimes3.certF97_0
#print axioms FermatPrimes3.certF97_1
#print axioms FermatPrimes3.certF97_2
#print axioms FermatPrimes3.certF97_3
#print axioms FermatPrimes3.certF97_4
#print axioms FermatPrimes3.certF97_5
#print axioms FermatPrimes3.certF97_6
#print axioms FermatPrimes3.certF97_7
#print axioms FermatPrimes3.certF97_8
#print axioms FermatPrimes3.certF97_9
#print axioms FermatPrimes3.certF97_10
#print axioms FermatPrimes3.certF97_11
#print axioms FermatPrimes3.certF97_12
#print axioms FermatPrimes3.certF97_13
#print axioms FermatPrimes3.certF97_14
#print axioms FermatPrimes3.certF97_15
#print axioms FermatPrimes3.certF97_16
#print axioms FermatPrimes3.certF97_17
#print axioms FermatPrimes3.certF97_18
#print axioms FermatPrimes3.certF97_19
#print axioms FermatPrimes3.certF97_20
#print axioms FermatPrimes3.certF97_21
#print axioms FermatPrimes3.certF97_22
#print axioms FermatPrimes3.certF97_23
#print axioms FermatPrimes3.certF97_24
#print axioms FermatPrimes3.certF97_25
#print axioms FermatPrimes3.certF97_26
#print axioms FermatPrimes3.certF97_27
#print axioms FermatPrimes3.certF97_28
#print axioms FermatPrimes3.certF97_29
#print axioms FermatPrimes3.certF97_30
#print axioms FermatPrimes3.certF97_31
#print axioms FermatPrimes3.certF97_32
#print axioms FermatPrimes3.certF97_33
#print axioms FermatPrimes3.certF97_34
#print axioms FermatPrimes3.certF97_35
#print axioms FermatPrimes3.certF97_36
#print axioms FermatPrimes3.certF97_37
#print axioms FermatPrimes3.certF97_38
#print axioms FermatPrimes3.certF97_39
#print axioms FermatPrimes3.certF97_40
#print axioms FermatPrimes3.certF97_41
#print axioms FermatPrimes3.certF97_42
#print axioms FermatPrimes3.certF97_43
#print axioms FermatPrimes3.certF97_44
#print axioms FermatPrimes3.certF97_45
#print axioms FermatPrimes3.certF97_46
#print axioms FermatPrimes3.certF97_47
#print axioms FermatPrimes3.paired_char_97
lean_all/hodge/FermatRel.lean
/-
hodge/FermatRel.lean — T41 cycle 28: for m = 9, 10, 12, 14, 15, 16 and every unit t, every Hodge
character of X_m^n (every n) satisfies the equation of row t of the Hodge system,
Σ_v (2⟨tv⟩ − m)⁺ #v = Σ_v (2⟨tv⟩ − m)⁻ #v ,
proved by Fermat6.extract_lin with the certificate ℓ = −e_t (generated, checked by rfl). Together
these are all the linear conditions on the count vector (the Hodge system itself); the symmetric
(paired) counts satisfy them, and the remaining kernel is what further cycles (standard characters,
Aoki's cycles) must fill.
-/
import hodge.Fermat8
namespace FermatRel
open FTAChain FrobChain FermatPrime FermatFull Fermat6 Fermat8
def certG (m : Nat) (l : List Int) (u v : Nat → Nat) : Bool :=
allBelow (fun c =>
Nat.beq (S1 (units m) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (qf m) (rf m) c + u c)
(S1 (units m) (fun t => pos (nthD l (t - 1))) (fun t => negp (nthD l (t - 1))) (rf m) (qf m) c + v c)) (m - 1)
theorem hxG (m : Nat) (a : List Nat) (hin : AllIn (m - 1) a) (h : HodgeList m a) :
∀ t, t ∈ units m → dot (m - 1) (qf m t) (fun c => cnt (c + 1) a) = dot (m - 1) (rf m t) (fun c => cnt (c + 1) a) := by
intro t ht
have e := h t ht
rw [regroup (m - 1) _ a hin, regroup (m - 1) _ a hin] at e
unfold dot
rw [sum_ext _ _ _ (fun c _ => nmul_comm (qf m t c) (cnt (c + 1) a)),
sum_ext _ _ _ (fun c _ => nmul_comm (rf m t c) (cnt (c + 1) a))]
exact e
def u9_1 (c : Nat) : Nat := match c with
| 4 => 1
| 5 => 3
| 6 => 5
| 7 => 7
| _ => 0
def v9_1 (c : Nat) : Nat := match c with
| 0 => 7
| 1 => 5
| 2 => 3
| 3 => 1
| _ => 0
set_option maxHeartbeats 0 in
theorem cert9_1 : certG 9 [-1, 0, 0, 0, 0, 0, 0, 0] u9_1 v9_1 = true := rfl
/-- X_9^n, row t = 1: 1#5 + 3#6 + 5#7 + 7#8 = 7#1 + 5#2 + 3#3 + 1#4. -/
theorem rel9_1 (a : List Nat) (hin : AllIn 8 a) (h : HodgeList 9 a) :
dot 8 u9_1 (fun c => cnt (c + 1) a) = dot 8 v9_1 (fun c => cnt (c + 1) a) :=
extract_lin 8 _ _ u9_1 v9_1 _ (fun c hc => beq_eq (all_range _ 8 cert9_1 c hc))
(combine1 8 (qf 9) (rf 9) _ _ _ (units 9) (hxG 9 a hin h))
def u9_2 (c : Nat) : Nat := match c with
| 2 => 3
| 3 => 7
| 6 => 1
| 7 => 5
| _ => 0
def v9_2 (c : Nat) : Nat := match c with
| 0 => 5
| 1 => 1
| 4 => 7
| 5 => 3
| _ => 0
set_option maxHeartbeats 0 in
theorem cert9_2 : certG 9 [0, -1, 0, 0, 0, 0, 0, 0] u9_2 v9_2 = true := rfl
/-- X_9^n, row t = 2: 3#3 + 7#4 + 1#7 + 5#8 = 5#1 + 1#2 + 7#5 + 3#6. -/
theorem rel9_2 (a : List Nat) (hin : AllIn 8 a) (h : HodgeList 9 a) :
dot 8 u9_2 (fun c => cnt (c + 1) a) = dot 8 v9_2 (fun c => cnt (c + 1) a) :=
extract_lin 8 _ _ u9_2 v9_2 _ (fun c hc => beq_eq (all_range _ 8 cert9_2 c hc))
(combine1 8 (qf 9) (rf 9) _ _ _ (units 9) (hxG 9 a hin h))
def u9_4 (c : Nat) : Nat := match c with
| 1 => 7
| 3 => 5
| 5 => 3
| 7 => 1
| _ => 0
def v9_4 (c : Nat) : Nat := match c with
| 0 => 1
| 2 => 3
| 4 => 5
| 6 => 7
| _ => 0
set_option maxHeartbeats 0 in
theorem cert9_4 : certG 9 [0, 0, 0, -1, 0, 0, 0, 0] u9_4 v9_4 = true := rfl
/-- X_9^n, row t = 4: 7#2 + 5#4 + 3#6 + 1#8 = 1#1 + 3#3 + 5#5 + 7#7. -/
theorem rel9_4 (a : List Nat) (hin : AllIn 8 a) (h : HodgeList 9 a) :
dot 8 u9_4 (fun c => cnt (c + 1) a) = dot 8 v9_4 (fun c => cnt (c + 1) a) :=
extract_lin 8 _ _ u9_4 v9_4 _ (fun c hc => beq_eq (all_range _ 8 cert9_4 c hc))
(combine1 8 (qf 9) (rf 9) _ _ _ (units 9) (hxG 9 a hin h))
def u9_5 (c : Nat) : Nat := match c with
| 0 => 1
| 2 => 3
| 4 => 5
| 6 => 7
| _ => 0
def v9_5 (c : Nat) : Nat := match c with
| 1 => 7
| 3 => 5
| 5 => 3
| 7 => 1
| _ => 0
set_option maxHeartbeats 0 in
theorem cert9_5 : certG 9 [0, 0, 0, 0, -1, 0, 0, 0] u9_5 v9_5 = true := rfl
/-- X_9^n, row t = 5: 1#1 + 3#3 + 5#5 + 7#7 = 7#2 + 5#4 + 3#6 + 1#8. -/
theorem rel9_5 (a : List Nat) (hin : AllIn 8 a) (h : HodgeList 9 a) :
dot 8 u9_5 (fun c => cnt (c + 1) a) = dot 8 v9_5 (fun c => cnt (c + 1) a) :=
extract_lin 8 _ _ u9_5 v9_5 _ (fun c hc => beq_eq (all_range _ 8 cert9_5 c hc))
(combine1 8 (qf 9) (rf 9) _ _ _ (units 9) (hxG 9 a hin h))
def u9_7 (c : Nat) : Nat := match c with
| 0 => 5
| 1 => 1
| 4 => 7
| 5 => 3
| _ => 0
def v9_7 (c : Nat) : Nat := match c with
| 2 => 3
| 3 => 7
| 6 => 1
| 7 => 5
| _ => 0
set_option maxHeartbeats 0 in
theorem cert9_7 : certG 9 [0, 0, 0, 0, 0, 0, -1, 0] u9_7 v9_7 = true := rfl
/-- X_9^n, row t = 7: 5#1 + 1#2 + 7#5 + 3#6 = 3#3 + 7#4 + 1#7 + 5#8. -/
theorem rel9_7 (a : List Nat) (hin : AllIn 8 a) (h : HodgeList 9 a) :
dot 8 u9_7 (fun c => cnt (c + 1) a) = dot 8 v9_7 (fun c => cnt (c + 1) a) :=
extract_lin 8 _ _ u9_7 v9_7 _ (fun c hc => beq_eq (all_range _ 8 cert9_7 c hc))
(combine1 8 (qf 9) (rf 9) _ _ _ (units 9) (hxG 9 a hin h))
def u9_8 (c : Nat) : Nat := match c with
| 0 => 7
| 1 => 5
| 2 => 3
| 3 => 1
| _ => 0
def v9_8 (c : Nat) : Nat := match c with
| 4 => 1
| 5 => 3
| 6 => 5
| 7 => 7
| _ => 0
set_option maxHeartbeats 0 in
theorem cert9_8 : certG 9 [0, 0, 0, 0, 0, 0, 0, -1] u9_8 v9_8 = true := rfl
/-- X_9^n, row t = 8: 7#1 + 5#2 + 3#3 + 1#4 = 1#5 + 3#6 + 5#7 + 7#8. -/
theorem rel9_8 (a : List Nat) (hin : AllIn 8 a) (h : HodgeList 9 a) :
dot 8 u9_8 (fun c => cnt (c + 1) a) = dot 8 v9_8 (fun c => cnt (c + 1) a) :=
extract_lin 8 _ _ u9_8 v9_8 _ (fun c hc => beq_eq (all_range _ 8 cert9_8 c hc))
(combine1 8 (qf 9) (rf 9) _ _ _ (units 9) (hxG 9 a hin h))
def u10_1 (c : Nat) : Nat := match c with
| 5 => 2
| 6 => 4
| 7 => 6
| 8 => 8
| _ => 0
def v10_1 (c : Nat) : Nat := match c with
| 0 => 8
| 1 => 6
| 2 => 4
| 3 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert10_1 : certG 10 [-1, 0, 0, 0, 0, 0, 0, 0, 0] u10_1 v10_1 = true := rfl
/-- X_10^n, row t = 1: 2#6 + 4#7 + 6#8 + 8#9 = 8#1 + 6#2 + 4#3 + 2#4. -/
theorem rel10_1 (a : List Nat) (hin : AllIn 9 a) (h : HodgeList 10 a) :
dot 9 u10_1 (fun c => cnt (c + 1) a) = dot 9 v10_1 (fun c => cnt (c + 1) a) :=
extract_lin 9 _ _ u10_1 v10_1 _ (fun c hc => beq_eq (all_range _ 9 cert10_1 c hc))
(combine1 9 (qf 10) (rf 10) _ _ _ (units 10) (hxG 10 a hin h))
def u10_3 (c : Nat) : Nat := match c with
| 1 => 2
| 2 => 8
| 5 => 6
| 8 => 4
| _ => 0
def v10_3 (c : Nat) : Nat := match c with
| 0 => 4
| 3 => 6
| 6 => 8
| 7 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert10_3 : certG 10 [0, 0, -1, 0, 0, 0, 0, 0, 0] u10_3 v10_3 = true := rfl
/-- X_10^n, row t = 3: 2#2 + 8#3 + 6#6 + 4#9 = 4#1 + 6#4 + 8#7 + 2#8. -/
theorem rel10_3 (a : List Nat) (hin : AllIn 9 a) (h : HodgeList 10 a) :
dot 9 u10_3 (fun c => cnt (c + 1) a) = dot 9 v10_3 (fun c => cnt (c + 1) a) :=
extract_lin 9 _ _ u10_3 v10_3 _ (fun c hc => beq_eq (all_range _ 9 cert10_3 c hc))
(combine1 9 (qf 10) (rf 10) _ _ _ (units 10) (hxG 10 a hin h))
def u10_7 (c : Nat) : Nat := match c with
| 0 => 4
| 3 => 6
| 6 => 8
| 7 => 2
| _ => 0
def v10_7 (c : Nat) : Nat := match c with
| 1 => 2
| 2 => 8
| 5 => 6
| 8 => 4
| _ => 0
set_option maxHeartbeats 0 in
theorem cert10_7 : certG 10 [0, 0, 0, 0, 0, 0, -1, 0, 0] u10_7 v10_7 = true := rfl
/-- X_10^n, row t = 7: 4#1 + 6#4 + 8#7 + 2#8 = 2#2 + 8#3 + 6#6 + 4#9. -/
theorem rel10_7 (a : List Nat) (hin : AllIn 9 a) (h : HodgeList 10 a) :
dot 9 u10_7 (fun c => cnt (c + 1) a) = dot 9 v10_7 (fun c => cnt (c + 1) a) :=
extract_lin 9 _ _ u10_7 v10_7 _ (fun c hc => beq_eq (all_range _ 9 cert10_7 c hc))
(combine1 9 (qf 10) (rf 10) _ _ _ (units 10) (hxG 10 a hin h))
def u10_9 (c : Nat) : Nat := match c with
| 0 => 8
| 1 => 6
| 2 => 4
| 3 => 2
| _ => 0
def v10_9 (c : Nat) : Nat := match c with
| 5 => 2
| 6 => 4
| 7 => 6
| 8 => 8
| _ => 0
set_option maxHeartbeats 0 in
theorem cert10_9 : certG 10 [0, 0, 0, 0, 0, 0, 0, 0, -1] u10_9 v10_9 = true := rfl
/-- X_10^n, row t = 9: 8#1 + 6#2 + 4#3 + 2#4 = 2#6 + 4#7 + 6#8 + 8#9. -/
theorem rel10_9 (a : List Nat) (hin : AllIn 9 a) (h : HodgeList 10 a) :
dot 9 u10_9 (fun c => cnt (c + 1) a) = dot 9 v10_9 (fun c => cnt (c + 1) a) :=
extract_lin 9 _ _ u10_9 v10_9 _ (fun c hc => beq_eq (all_range _ 9 cert10_9 c hc))
(combine1 9 (qf 10) (rf 10) _ _ _ (units 10) (hxG 10 a hin h))
def u12_1 (c : Nat) : Nat := match c with
| 6 => 2
| 7 => 4
| 8 => 6
| 9 => 8
| 10 => 10
| _ => 0
def v12_1 (c : Nat) : Nat := match c with
| 0 => 10
| 1 => 8
| 2 => 6
| 3 => 4
| 4 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert12_1 : certG 12 [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u12_1 v12_1 = true := rfl
/-- X_12^n, row t = 1: 2#7 + 4#8 + 6#9 + 8#10 + 10#11 = 10#1 + 8#2 + 6#3 + 4#4 + 2#5. -/
theorem rel12_1 (a : List Nat) (hin : AllIn 11 a) (h : HodgeList 12 a) :
dot 11 u12_1 (fun c => cnt (c + 1) a) = dot 11 v12_1 (fun c => cnt (c + 1) a) :=
extract_lin 11 _ _ u12_1 v12_1 _ (fun c hc => beq_eq (all_range _ 11 cert12_1 c hc))
(combine1 11 (qf 12) (rf 12) _ _ _ (units 12) (hxG 12 a hin h))
def u12_5 (c : Nat) : Nat := match c with
| 1 => 8
| 3 => 4
| 6 => 10
| 8 => 6
| 10 => 2
| _ => 0
def v12_5 (c : Nat) : Nat := match c with
| 0 => 2
| 2 => 6
| 4 => 10
| 7 => 4
| 9 => 8
| _ => 0
set_option maxHeartbeats 0 in
theorem cert12_5 : certG 12 [0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0] u12_5 v12_5 = true := rfl
/-- X_12^n, row t = 5: 8#2 + 4#4 + 10#7 + 6#9 + 2#11 = 2#1 + 6#3 + 10#5 + 4#8 + 8#10. -/
theorem rel12_5 (a : List Nat) (hin : AllIn 11 a) (h : HodgeList 12 a) :
dot 11 u12_5 (fun c => cnt (c + 1) a) = dot 11 v12_5 (fun c => cnt (c + 1) a) :=
extract_lin 11 _ _ u12_5 v12_5 _ (fun c hc => beq_eq (all_range _ 11 cert12_5 c hc))
(combine1 11 (qf 12) (rf 12) _ _ _ (units 12) (hxG 12 a hin h))
def u12_7 (c : Nat) : Nat := match c with
| 0 => 2
| 2 => 6
| 4 => 10
| 7 => 4
| 9 => 8
| _ => 0
def v12_7 (c : Nat) : Nat := match c with
| 1 => 8
| 3 => 4
| 6 => 10
| 8 => 6
| 10 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert12_7 : certG 12 [0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0] u12_7 v12_7 = true := rfl
/-- X_12^n, row t = 7: 2#1 + 6#3 + 10#5 + 4#8 + 8#10 = 8#2 + 4#4 + 10#7 + 6#9 + 2#11. -/
theorem rel12_7 (a : List Nat) (hin : AllIn 11 a) (h : HodgeList 12 a) :
dot 11 u12_7 (fun c => cnt (c + 1) a) = dot 11 v12_7 (fun c => cnt (c + 1) a) :=
extract_lin 11 _ _ u12_7 v12_7 _ (fun c hc => beq_eq (all_range _ 11 cert12_7 c hc))
(combine1 11 (qf 12) (rf 12) _ _ _ (units 12) (hxG 12 a hin h))
def u12_11 (c : Nat) : Nat := match c with
| 0 => 10
| 1 => 8
| 2 => 6
| 3 => 4
| 4 => 2
| _ => 0
def v12_11 (c : Nat) : Nat := match c with
| 6 => 2
| 7 => 4
| 8 => 6
| 9 => 8
| 10 => 10
| _ => 0
set_option maxHeartbeats 0 in
theorem cert12_11 : certG 12 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1] u12_11 v12_11 = true := rfl
/-- X_12^n, row t = 11: 10#1 + 8#2 + 6#3 + 4#4 + 2#5 = 2#7 + 4#8 + 6#9 + 8#10 + 10#11. -/
theorem rel12_11 (a : List Nat) (hin : AllIn 11 a) (h : HodgeList 12 a) :
dot 11 u12_11 (fun c => cnt (c + 1) a) = dot 11 v12_11 (fun c => cnt (c + 1) a) :=
extract_lin 11 _ _ u12_11 v12_11 _ (fun c hc => beq_eq (all_range _ 11 cert12_11 c hc))
(combine1 11 (qf 12) (rf 12) _ _ _ (units 12) (hxG 12 a hin h))
def u14_1 (c : Nat) : Nat := match c with
| 7 => 2
| 8 => 4
| 9 => 6
| 10 => 8
| 11 => 10
| 12 => 12
| _ => 0
def v14_1 (c : Nat) : Nat := match c with
| 0 => 12
| 1 => 10
| 2 => 8
| 3 => 6
| 4 => 4
| 5 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert14_1 : certG 14 [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u14_1 v14_1 = true := rfl
/-- X_14^n, row t = 1: 2#8 + 4#9 + 6#10 + 8#11 + 10#12 + 12#13 = 12#1 + 10#2 + 8#3 + 6#4 + 4#5 + 2#6. -/
theorem rel14_1 (a : List Nat) (hin : AllIn 13 a) (h : HodgeList 14 a) :
dot 13 u14_1 (fun c => cnt (c + 1) a) = dot 13 v14_1 (fun c => cnt (c + 1) a) :=
extract_lin 13 _ _ u14_1 v14_1 _ (fun c hc => beq_eq (all_range _ 13 cert14_1 c hc))
(combine1 13 (qf 14) (rf 14) _ _ _ (units 14) (hxG 14 a hin h))
def u14_3 (c : Nat) : Nat := match c with
| 2 => 4
| 3 => 10
| 7 => 6
| 8 => 12
| 11 => 2
| 12 => 8
| _ => 0
def v14_3 (c : Nat) : Nat := match c with
| 0 => 8
| 1 => 2
| 4 => 12
| 5 => 6
| 9 => 10
| 10 => 4
| _ => 0
set_option maxHeartbeats 0 in
theorem cert14_3 : certG 14 [0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u14_3 v14_3 = true := rfl
/-- X_14^n, row t = 3: 4#3 + 10#4 + 6#8 + 12#9 + 2#12 + 8#13 = 8#1 + 2#2 + 12#5 + 6#6 + 10#10 + 4#11. -/
theorem rel14_3 (a : List Nat) (hin : AllIn 13 a) (h : HodgeList 14 a) :
dot 13 u14_3 (fun c => cnt (c + 1) a) = dot 13 v14_3 (fun c => cnt (c + 1) a) :=
extract_lin 13 _ _ u14_3 v14_3 _ (fun c hc => beq_eq (all_range _ 13 cert14_3 c hc))
(combine1 13 (qf 14) (rf 14) _ _ _ (units 14) (hxG 14 a hin h))
def u14_5 (c : Nat) : Nat := match c with
| 1 => 6
| 4 => 8
| 7 => 10
| 9 => 2
| 10 => 12
| 12 => 4
| _ => 0
def v14_5 (c : Nat) : Nat := match c with
| 0 => 4
| 2 => 12
| 3 => 2
| 5 => 10
| 8 => 8
| 11 => 6
| _ => 0
set_option maxHeartbeats 0 in
theorem cert14_5 : certG 14 [0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0] u14_5 v14_5 = true := rfl
/-- X_14^n, row t = 5: 6#2 + 8#5 + 10#8 + 2#10 + 12#11 + 4#13 = 4#1 + 12#3 + 2#4 + 10#6 + 8#9 + 6#12. -/
theorem rel14_5 (a : List Nat) (hin : AllIn 13 a) (h : HodgeList 14 a) :
dot 13 u14_5 (fun c => cnt (c + 1) a) = dot 13 v14_5 (fun c => cnt (c + 1) a) :=
extract_lin 13 _ _ u14_5 v14_5 _ (fun c hc => beq_eq (all_range _ 13 cert14_5 c hc))
(combine1 13 (qf 14) (rf 14) _ _ _ (units 14) (hxG 14 a hin h))
def u14_9 (c : Nat) : Nat := match c with
| 0 => 4
| 2 => 12
| 3 => 2
| 5 => 10
| 8 => 8
| 11 => 6
| _ => 0
def v14_9 (c : Nat) : Nat := match c with
| 1 => 6
| 4 => 8
| 7 => 10
| 9 => 2
| 10 => 12
| 12 => 4
| _ => 0
set_option maxHeartbeats 0 in
theorem cert14_9 : certG 14 [0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0] u14_9 v14_9 = true := rfl
/-- X_14^n, row t = 9: 4#1 + 12#3 + 2#4 + 10#6 + 8#9 + 6#12 = 6#2 + 8#5 + 10#8 + 2#10 + 12#11 + 4#13. -/
theorem rel14_9 (a : List Nat) (hin : AllIn 13 a) (h : HodgeList 14 a) :
dot 13 u14_9 (fun c => cnt (c + 1) a) = dot 13 v14_9 (fun c => cnt (c + 1) a) :=
extract_lin 13 _ _ u14_9 v14_9 _ (fun c hc => beq_eq (all_range _ 13 cert14_9 c hc))
(combine1 13 (qf 14) (rf 14) _ _ _ (units 14) (hxG 14 a hin h))
def u14_11 (c : Nat) : Nat := match c with
| 0 => 8
| 1 => 2
| 4 => 12
| 5 => 6
| 9 => 10
| 10 => 4
| _ => 0
def v14_11 (c : Nat) : Nat := match c with
| 2 => 4
| 3 => 10
| 7 => 6
| 8 => 12
| 11 => 2
| 12 => 8
| _ => 0
set_option maxHeartbeats 0 in
theorem cert14_11 : certG 14 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0] u14_11 v14_11 = true := rfl
/-- X_14^n, row t = 11: 8#1 + 2#2 + 12#5 + 6#6 + 10#10 + 4#11 = 4#3 + 10#4 + 6#8 + 12#9 + 2#12 + 8#13. -/
theorem rel14_11 (a : List Nat) (hin : AllIn 13 a) (h : HodgeList 14 a) :
dot 13 u14_11 (fun c => cnt (c + 1) a) = dot 13 v14_11 (fun c => cnt (c + 1) a) :=
extract_lin 13 _ _ u14_11 v14_11 _ (fun c hc => beq_eq (all_range _ 13 cert14_11 c hc))
(combine1 13 (qf 14) (rf 14) _ _ _ (units 14) (hxG 14 a hin h))
def u14_13 (c : Nat) : Nat := match c with
| 0 => 12
| 1 => 10
| 2 => 8
| 3 => 6
| 4 => 4
| 5 => 2
| _ => 0
def v14_13 (c : Nat) : Nat := match c with
| 7 => 2
| 8 => 4
| 9 => 6
| 10 => 8
| 11 => 10
| 12 => 12
| _ => 0
set_option maxHeartbeats 0 in
theorem cert14_13 : certG 14 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1] u14_13 v14_13 = true := rfl
/-- X_14^n, row t = 13: 12#1 + 10#2 + 8#3 + 6#4 + 4#5 + 2#6 = 2#8 + 4#9 + 6#10 + 8#11 + 10#12 + 12#13. -/
theorem rel14_13 (a : List Nat) (hin : AllIn 13 a) (h : HodgeList 14 a) :
dot 13 u14_13 (fun c => cnt (c + 1) a) = dot 13 v14_13 (fun c => cnt (c + 1) a) :=
extract_lin 13 _ _ u14_13 v14_13 _ (fun c hc => beq_eq (all_range _ 13 cert14_13 c hc))
(combine1 13 (qf 14) (rf 14) _ _ _ (units 14) (hxG 14 a hin h))
def u15_1 (c : Nat) : Nat := match c with
| 7 => 1
| 8 => 3
| 9 => 5
| 10 => 7
| 11 => 9
| 12 => 11
| 13 => 13
| _ => 0
def v15_1 (c : Nat) : Nat := match c with
| 0 => 13
| 1 => 11
| 2 => 9
| 3 => 7
| 4 => 5
| 5 => 3
| 6 => 1
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_1 : certG 15 [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u15_1 v15_1 = true := rfl
/-- X_15^n, row t = 1: 1#8 + 3#9 + 5#10 + 7#11 + 9#12 + 11#13 + 13#14 = 13#1 + 11#2 + 9#3 + 7#4 + 5#5 + 3#6 + 1#7. -/
theorem rel15_1 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_1 (fun c => cnt (c + 1) a) = dot 14 v15_1 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_1 v15_1 _ (fun c hc => beq_eq (all_range _ 14 cert15_1 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_2 (c : Nat) : Nat := match c with
| 3 => 1
| 4 => 5
| 5 => 9
| 6 => 13
| 11 => 3
| 12 => 7
| 13 => 11
| _ => 0
def v15_2 (c : Nat) : Nat := match c with
| 0 => 11
| 1 => 7
| 2 => 3
| 7 => 13
| 8 => 9
| 9 => 5
| 10 => 1
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_2 : certG 15 [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u15_2 v15_2 = true := rfl
/-- X_15^n, row t = 2: 1#4 + 5#5 + 9#6 + 13#7 + 3#12 + 7#13 + 11#14 = 11#1 + 7#2 + 3#3 + 13#8 + 9#9 + 5#10 + 1#11. -/
theorem rel15_2 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_2 (fun c => cnt (c + 1) a) = dot 14 v15_2 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_2 v15_2 _ (fun c hc => beq_eq (all_range _ 14 cert15_2 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_4 (c : Nat) : Nat := match c with
| 1 => 1
| 2 => 9
| 5 => 3
| 6 => 11
| 9 => 5
| 10 => 13
| 13 => 7
| _ => 0
def v15_4 (c : Nat) : Nat := match c with
| 0 => 7
| 3 => 13
| 4 => 5
| 7 => 11
| 8 => 3
| 11 => 9
| 12 => 1
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_4 : certG 15 [0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u15_4 v15_4 = true := rfl
/-- X_15^n, row t = 4: 1#2 + 9#3 + 3#6 + 11#7 + 5#10 + 13#11 + 7#14 = 7#1 + 13#4 + 5#5 + 11#8 + 3#9 + 9#12 + 1#13. -/
theorem rel15_4 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_4 (fun c => cnt (c + 1) a) = dot 14 v15_4 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_4 v15_4 _ (fun c hc => beq_eq (all_range _ 14 cert15_4 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_7 (c : Nat) : Nat := match c with
| 1 => 13
| 3 => 11
| 5 => 9
| 7 => 7
| 9 => 5
| 11 => 3
| 13 => 1
| _ => 0
def v15_7 (c : Nat) : Nat := match c with
| 0 => 1
| 2 => 3
| 4 => 5
| 6 => 7
| 8 => 9
| 10 => 11
| 12 => 13
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_7 : certG 15 [0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0] u15_7 v15_7 = true := rfl
/-- X_15^n, row t = 7: 13#2 + 11#4 + 9#6 + 7#8 + 5#10 + 3#12 + 1#14 = 1#1 + 3#3 + 5#5 + 7#7 + 9#9 + 11#11 + 13#13. -/
theorem rel15_7 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_7 (fun c => cnt (c + 1) a) = dot 14 v15_7 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_7 v15_7 _ (fun c hc => beq_eq (all_range _ 14 cert15_7 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_8 (c : Nat) : Nat := match c with
| 0 => 1
| 2 => 3
| 4 => 5
| 6 => 7
| 8 => 9
| 10 => 11
| 12 => 13
| _ => 0
def v15_8 (c : Nat) : Nat := match c with
| 1 => 13
| 3 => 11
| 5 => 9
| 7 => 7
| 9 => 5
| 11 => 3
| 13 => 1
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_8 : certG 15 [0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0] u15_8 v15_8 = true := rfl
/-- X_15^n, row t = 8: 1#1 + 3#3 + 5#5 + 7#7 + 9#9 + 11#11 + 13#13 = 13#2 + 11#4 + 9#6 + 7#8 + 5#10 + 3#12 + 1#14. -/
theorem rel15_8 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_8 (fun c => cnt (c + 1) a) = dot 14 v15_8 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_8 v15_8 _ (fun c hc => beq_eq (all_range _ 14 cert15_8 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_11 (c : Nat) : Nat := match c with
| 0 => 7
| 3 => 13
| 4 => 5
| 7 => 11
| 8 => 3
| 11 => 9
| 12 => 1
| _ => 0
def v15_11 (c : Nat) : Nat := match c with
| 1 => 1
| 2 => 9
| 5 => 3
| 6 => 11
| 9 => 5
| 10 => 13
| 13 => 7
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_11 : certG 15 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0] u15_11 v15_11 = true := rfl
/-- X_15^n, row t = 11: 7#1 + 13#4 + 5#5 + 11#8 + 3#9 + 9#12 + 1#13 = 1#2 + 9#3 + 3#6 + 11#7 + 5#10 + 13#11 + 7#14. -/
theorem rel15_11 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_11 (fun c => cnt (c + 1) a) = dot 14 v15_11 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_11 v15_11 _ (fun c hc => beq_eq (all_range _ 14 cert15_11 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_13 (c : Nat) : Nat := match c with
| 0 => 11
| 1 => 7
| 2 => 3
| 7 => 13
| 8 => 9
| 9 => 5
| 10 => 1
| _ => 0
def v15_13 (c : Nat) : Nat := match c with
| 3 => 1
| 4 => 5
| 5 => 9
| 6 => 13
| 11 => 3
| 12 => 7
| 13 => 11
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_13 : certG 15 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0] u15_13 v15_13 = true := rfl
/-- X_15^n, row t = 13: 11#1 + 7#2 + 3#3 + 13#8 + 9#9 + 5#10 + 1#11 = 1#4 + 5#5 + 9#6 + 13#7 + 3#12 + 7#13 + 11#14. -/
theorem rel15_13 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_13 (fun c => cnt (c + 1) a) = dot 14 v15_13 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_13 v15_13 _ (fun c hc => beq_eq (all_range _ 14 cert15_13 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u15_14 (c : Nat) : Nat := match c with
| 0 => 13
| 1 => 11
| 2 => 9
| 3 => 7
| 4 => 5
| 5 => 3
| 6 => 1
| _ => 0
def v15_14 (c : Nat) : Nat := match c with
| 7 => 1
| 8 => 3
| 9 => 5
| 10 => 7
| 11 => 9
| 12 => 11
| 13 => 13
| _ => 0
set_option maxHeartbeats 0 in
theorem cert15_14 : certG 15 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1] u15_14 v15_14 = true := rfl
/-- X_15^n, row t = 14: 13#1 + 11#2 + 9#3 + 7#4 + 5#5 + 3#6 + 1#7 = 1#8 + 3#9 + 5#10 + 7#11 + 9#12 + 11#13 + 13#14. -/
theorem rel15_14 (a : List Nat) (hin : AllIn 14 a) (h : HodgeList 15 a) :
dot 14 u15_14 (fun c => cnt (c + 1) a) = dot 14 v15_14 (fun c => cnt (c + 1) a) :=
extract_lin 14 _ _ u15_14 v15_14 _ (fun c hc => beq_eq (all_range _ 14 cert15_14 c hc))
(combine1 14 (qf 15) (rf 15) _ _ _ (units 15) (hxG 15 a hin h))
def u16_1 (c : Nat) : Nat := match c with
| 8 => 2
| 9 => 4
| 10 => 6
| 11 => 8
| 12 => 10
| 13 => 12
| 14 => 14
| _ => 0
def v16_1 (c : Nat) : Nat := match c with
| 0 => 14
| 1 => 12
| 2 => 10
| 3 => 8
| 4 => 6
| 5 => 4
| 6 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_1 : certG 16 [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u16_1 v16_1 = true := rfl
/-- X_16^n, row t = 1: 2#9 + 4#10 + 6#11 + 8#12 + 10#13 + 12#14 + 14#15 = 14#1 + 12#2 + 10#3 + 8#4 + 6#5 + 4#6 + 2#7. -/
theorem rel16_1 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_1 (fun c => cnt (c + 1) a) = dot 15 v16_1 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_1 v16_1 _ (fun c hc => beq_eq (all_range _ 15 cert16_1 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_3 (c : Nat) : Nat := match c with
| 2 => 2
| 3 => 8
| 4 => 14
| 8 => 6
| 9 => 12
| 13 => 4
| 14 => 10
| _ => 0
def v16_3 (c : Nat) : Nat := match c with
| 0 => 10
| 1 => 4
| 5 => 12
| 6 => 6
| 10 => 14
| 11 => 8
| 12 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_3 : certG 16 [0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u16_3 v16_3 = true := rfl
/-- X_16^n, row t = 3: 2#3 + 8#4 + 14#5 + 6#9 + 12#10 + 4#14 + 10#15 = 10#1 + 4#2 + 12#6 + 6#7 + 14#11 + 8#12 + 2#13. -/
theorem rel16_3 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_3 (fun c => cnt (c + 1) a) = dot 15 v16_3 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_3 v16_3 _ (fun c hc => beq_eq (all_range _ 15 cert16_3 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_5 (c : Nat) : Nat := match c with
| 1 => 4
| 2 => 14
| 4 => 2
| 5 => 12
| 8 => 10
| 11 => 8
| 14 => 6
| _ => 0
def v16_5 (c : Nat) : Nat := match c with
| 0 => 6
| 3 => 8
| 6 => 10
| 9 => 12
| 10 => 2
| 12 => 14
| 13 => 4
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_5 : certG 16 [0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] u16_5 v16_5 = true := rfl
/-- X_16^n, row t = 5: 4#2 + 14#3 + 2#5 + 12#6 + 10#9 + 8#12 + 6#15 = 6#1 + 8#4 + 10#7 + 12#10 + 2#11 + 14#13 + 4#14. -/
theorem rel16_5 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_5 (fun c => cnt (c + 1) a) = dot 15 v16_5 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_5 v16_5 _ (fun c hc => beq_eq (all_range _ 15 cert16_5 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_7 (c : Nat) : Nat := match c with
| 1 => 12
| 3 => 8
| 5 => 4
| 8 => 14
| 10 => 10
| 12 => 6
| 14 => 2
| _ => 0
def v16_7 (c : Nat) : Nat := match c with
| 0 => 2
| 2 => 6
| 4 => 10
| 6 => 14
| 9 => 4
| 11 => 8
| 13 => 12
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_7 : certG 16 [0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0] u16_7 v16_7 = true := rfl
/-- X_16^n, row t = 7: 12#2 + 8#4 + 4#6 + 14#9 + 10#11 + 6#13 + 2#15 = 2#1 + 6#3 + 10#5 + 14#7 + 4#10 + 8#12 + 12#14. -/
theorem rel16_7 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_7 (fun c => cnt (c + 1) a) = dot 15 v16_7 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_7 v16_7 _ (fun c hc => beq_eq (all_range _ 15 cert16_7 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_9 (c : Nat) : Nat := match c with
| 0 => 2
| 2 => 6
| 4 => 10
| 6 => 14
| 9 => 4
| 11 => 8
| 13 => 12
| _ => 0
def v16_9 (c : Nat) : Nat := match c with
| 1 => 12
| 3 => 8
| 5 => 4
| 8 => 14
| 10 => 10
| 12 => 6
| 14 => 2
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_9 : certG 16 [0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0] u16_9 v16_9 = true := rfl
/-- X_16^n, row t = 9: 2#1 + 6#3 + 10#5 + 14#7 + 4#10 + 8#12 + 12#14 = 12#2 + 8#4 + 4#6 + 14#9 + 10#11 + 6#13 + 2#15. -/
theorem rel16_9 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_9 (fun c => cnt (c + 1) a) = dot 15 v16_9 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_9 v16_9 _ (fun c hc => beq_eq (all_range _ 15 cert16_9 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_11 (c : Nat) : Nat := match c with
| 0 => 6
| 3 => 8
| 6 => 10
| 9 => 12
| 10 => 2
| 12 => 14
| 13 => 4
| _ => 0
def v16_11 (c : Nat) : Nat := match c with
| 1 => 4
| 2 => 14
| 4 => 2
| 5 => 12
| 8 => 10
| 11 => 8
| 14 => 6
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_11 : certG 16 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0] u16_11 v16_11 = true := rfl
/-- X_16^n, row t = 11: 6#1 + 8#4 + 10#7 + 12#10 + 2#11 + 14#13 + 4#14 = 4#2 + 14#3 + 2#5 + 12#6 + 10#9 + 8#12 + 6#15. -/
theorem rel16_11 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_11 (fun c => cnt (c + 1) a) = dot 15 v16_11 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_11 v16_11 _ (fun c hc => beq_eq (all_range _ 15 cert16_11 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_13 (c : Nat) : Nat := match c with
| 0 => 10
| 1 => 4
| 5 => 12
| 6 => 6
| 10 => 14
| 11 => 8
| 12 => 2
| _ => 0
def v16_13 (c : Nat) : Nat := match c with
| 2 => 2
| 3 => 8
| 4 => 14
| 8 => 6
| 9 => 12
| 13 => 4
| 14 => 10
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_13 : certG 16 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0] u16_13 v16_13 = true := rfl
/-- X_16^n, row t = 13: 10#1 + 4#2 + 12#6 + 6#7 + 14#11 + 8#12 + 2#13 = 2#3 + 8#4 + 14#5 + 6#9 + 12#10 + 4#14 + 10#15. -/
theorem rel16_13 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_13 (fun c => cnt (c + 1) a) = dot 15 v16_13 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_13 v16_13 _ (fun c hc => beq_eq (all_range _ 15 cert16_13 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
def u16_15 (c : Nat) : Nat := match c with
| 0 => 14
| 1 => 12
| 2 => 10
| 3 => 8
| 4 => 6
| 5 => 4
| 6 => 2
| _ => 0
def v16_15 (c : Nat) : Nat := match c with
| 8 => 2
| 9 => 4
| 10 => 6
| 11 => 8
| 12 => 10
| 13 => 12
| 14 => 14
| _ => 0
set_option maxHeartbeats 0 in
theorem cert16_15 : certG 16 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1] u16_15 v16_15 = true := rfl
/-- X_16^n, row t = 15: 14#1 + 12#2 + 10#3 + 8#4 + 6#5 + 4#6 + 2#7 = 2#9 + 4#10 + 6#11 + 8#12 + 10#13 + 12#14 + 14#15. -/
theorem rel16_15 (a : List Nat) (hin : AllIn 15 a) (h : HodgeList 16 a) :
dot 15 u16_15 (fun c => cnt (c + 1) a) = dot 15 v16_15 (fun c => cnt (c + 1) a) :=
extract_lin 15 _ _ u16_15 v16_15 _ (fun c hc => beq_eq (all_range _ 15 cert16_15 c hc))
(combine1 15 (qf 16) (rf 16) _ _ _ (units 16) (hxG 16 a hin h))
end FermatRel
#print axioms FermatRel.hxG
#print axioms FermatRel.cert9_1
#print axioms FermatRel.rel9_1
#print axioms FermatRel.cert9_2
#print axioms FermatRel.rel9_2
#print axioms FermatRel.cert9_4
#print axioms FermatRel.rel9_4
#print axioms FermatRel.cert9_5
#print axioms FermatRel.rel9_5
#print axioms FermatRel.cert9_7
#print axioms FermatRel.rel9_7
#print axioms FermatRel.cert9_8
#print axioms FermatRel.rel9_8
#print axioms FermatRel.cert10_1
#print axioms FermatRel.rel10_1
#print axioms FermatRel.cert10_3
#print axioms FermatRel.rel10_3
#print axioms FermatRel.cert10_7
#print axioms FermatRel.rel10_7
#print axioms FermatRel.cert10_9
#print axioms FermatRel.rel10_9
#print axioms FermatRel.cert12_1
#print axioms FermatRel.rel12_1
#print axioms FermatRel.cert12_5
#print axioms FermatRel.rel12_5
#print axioms FermatRel.cert12_7
#print axioms FermatRel.rel12_7
#print axioms FermatRel.cert12_11
#print axioms FermatRel.rel12_11
#print axioms FermatRel.cert14_1
#print axioms FermatRel.rel14_1
#print axioms FermatRel.cert14_3
#print axioms FermatRel.rel14_3
#print axioms FermatRel.cert14_5
#print axioms FermatRel.rel14_5
#print axioms FermatRel.cert14_9
#print axioms FermatRel.rel14_9
#print axioms FermatRel.cert14_11
#print axioms FermatRel.rel14_11
#print axioms FermatRel.cert14_13
#print axioms FermatRel.rel14_13
#print axioms FermatRel.cert15_1
#print axioms FermatRel.rel15_1
#print axioms FermatRel.cert15_2
#print axioms FermatRel.rel15_2
#print axioms FermatRel.cert15_4
#print axioms FermatRel.rel15_4
#print axioms FermatRel.cert15_7
#print axioms FermatRel.rel15_7
#print axioms FermatRel.cert15_8
#print axioms FermatRel.rel15_8
#print axioms FermatRel.cert15_11
#print axioms FermatRel.rel15_11
#print axioms FermatRel.cert15_13
#print axioms FermatRel.rel15_13
#print axioms FermatRel.cert15_14
#print axioms FermatRel.rel15_14
#print axioms FermatRel.cert16_1
#print axioms FermatRel.rel16_1
#print axioms FermatRel.cert16_3
#print axioms FermatRel.rel16_3
#print axioms FermatRel.cert16_5
#print axioms FermatRel.rel16_5
#print axioms FermatRel.cert16_7
#print axioms FermatRel.rel16_7
#print axioms FermatRel.cert16_9
#print axioms FermatRel.rel16_9
#print axioms FermatRel.cert16_11
#print axioms FermatRel.rel16_11
#print axioms FermatRel.cert16_13
#print axioms FermatRel.rel16_13
#print axioms FermatRel.cert16_15
#print axioms FermatRel.rel16_15
lean_all/hodge/GaloisOrbit.lean
/-
hodge/GaloisOrbit.lean — T41 cycle 118: Hodge characters are closed under the Galois action, every m.
Lean 4 core plus hodge/FermatGens (tsum), ESChain (rem_eq_mod), QRChain (rem lemmas).
mul_mod ⟨s·⟨t·x⟩_m⟩_m = ⟨(s t)·x⟩_m
tsum_twist T_s(t·c) = T_{st}(c) (t·c = (⟨t c_i⟩_m)_i)
twist_hodge 2T_{st}(c) = |c| m ⇒ 2T_s(t·c) = |t·c| m
Since st runs over the units when s does (t a unit), the unit multiples of a Hodge character are Hodge:
every statement about one character of an orbit holds for the whole orbit (used implicitly in the
reach measurements and in Fermat25Std.std_orbit).
-/
import hodge.Pullback
namespace GaloisOrbit
open FTAChain FrobChain QRChain ESChain FermatGens Pullback
def twist (m t : Nat) (c : List Nat) : List Nat := c.map (fun x => (t * x) % m)
theorem mul_mod (m' s t x : Nat) :
(s * ((t * x) % (m' + 1))) % (m' + 1) = ((s * t) * x) % (m' + 1) := by
rw [← rem_eq_mod, ← rem_eq_mod, ← rem_eq_mod]
rw [rem_mul_congr' m' _ _ s (rem_idem m' _), show s * (t * x) = s * t * x from (nmul_assoc s t x).symm]
theorem tsum_twist (m' s t : Nat) : ∀ c : List Nat,
tsum (m' + 1) s (twist (m' + 1) t c) = tsum (m' + 1) (s * t) c
| [] => rfl
| x :: c => by
show (s * ((t * x) % (m' + 1))) % (m' + 1) + tsum (m' + 1) s (twist (m' + 1) t c)
= ((s * t) * x) % (m' + 1) + tsum (m' + 1) (s * t) c
rw [mul_mod, tsum_twist m' s t c]
theorem twist_hodge (m' s t : Nat) (c : List Nat)
(h : tsum (m' + 1) (s * t) c + tsum (m' + 1) (s * t) c = c.length * (m' + 1)) :
tsum (m' + 1) s (twist (m' + 1) t c) + tsum (m' + 1) s (twist (m' + 1) t c)
= (twist (m' + 1) t c).length * (m' + 1) := by
unfold twist at *
rw [len_map]
have := tsum_twist m' s t c
unfold twist at this
rw [this]; exact h
end GaloisOrbit
#print axioms GaloisOrbit.mul_mod
#print axioms GaloisOrbit.tsum_twist
#print axioms GaloisOrbit.twist_hodge
lean_all/hodge/GcdHand.lean
/-
hodge/GcdHand.lean — T41 cycle 254 (goal G10): the units of an even m are odd, for every m, axiom-free; with
HalfGeneral this gives the m/2 split for every even m with no hypothesis.
Lean 4 core plus hodge/HalfGeneral (isOdd, half_bal, rest_bal), hodge/ModHand (mod_lt', add_mod', add_sub'),
bsd/TorsionImage (parity, odd_ne_even), lib/Semi (lib_nat). Core's Nat.gcd is WellFounded.Nat.fix.go with fuel;
its unfolding lemmas (Nat.gcd.eq_def, Nat.gcd_rec, Nat.dvd_gcd) depend on Quot.sound, but the definition itself
matches GH/GF below by rfl, and the fuel recursion can be followed by hand.
gcd_go Nat.gcd m n = go GH GF (eager (m + 1)) ⟨m, n⟩ (rfl after delta)
div_mod n = n % m + m·q for some q (fuel induction, ModHand)
even_mod 2 ∣ n, 2 ∣ m ⇒ 2 ∣ n % m
two_dvd_gcd 2 ∣ m, 2 ∣ n ⇒ 2 ∣ gcd m n (fuel induction on go)
units_odd every unit of an even m is odd
half_bal_even, rest_bal_even HalfGeneral without the hypothesis (units m).all isOdd
-/
import hodge.HalfGeneral
import bsd.TorsionImage
namespace GcdHand
open ModHand HalfGeneral TorsionImage Indecomp
def GH : (_ : Nat) ×' Nat → Nat := fun x => PSigma.casesOn x fun m _ => m
def GF : (x : (_ : Nat) ×' Nat) → ((y : (_ : Nat) ×' Nat) → InvImage (fun x1 x2 => x1 < x2) GH y x → Nat) → Nat :=
fun x a => PSigma.casesOn (motive := fun x =>
((y : (_ : Nat) ×' Nat) → InvImage (fun x1 x2 => x1 < x2) GH y x → Nat) → Nat)
x (fun m n a => if h : m = 0 then n else a ⟨n % m, m⟩ (Nat.mod_lt n (Nat.pos_of_ne_zero h))) a
theorem eager_gt (m : Nat) : m < WellFounded.Nat.eager (m + 1) := by
unfold WellFounded.Nat.eager
split <;> exact Nat.lt_succ_self m
theorem gcd_go (m n : Nat) : Nat.gcd m n = WellFounded.Nat.fix.go GH GF (WellFounded.Nat.eager (m + 1)) ⟨m, n⟩ (eager_gt m) := by
delta Nat.gcd Nat.gcd._unary WellFounded.Nat.fix
rfl
theorem sub_add' : ∀ m n : Nat, m ≤ n → n - m + m = n
| 0, n, _ => rfl
| m + 1, 0, h => absurd h (Nat.not_succ_le_zero m)
| m + 1, n + 1, h => by
rw [Nat.succ_sub_succ, show n - m + (m + 1) = (n - m + m) + 1 from rfl, sub_add' m n (Nat.le_of_succ_le_succ h)]
theorem div_mod (m : Nat) (hm : 0 < m) : ∀ F n, n < F → ∃ q, n = n % m + m * q
| 0, n, h => absurd h (Nat.not_lt_zero n)
| F + 1, n, h => by
by_cases hnm : n < m
· exact ⟨0, by rw [mod_lt' n m hnm, Nat.mul_zero, Nat.add_zero]⟩
· have hle : m ≤ n := Nat.le_of_not_lt hnm
have e : n - m + m = n := sub_add' m n hle
have hlt : n - m < F := by
have this : n - m + 1 ≤ n := by
have a := Nat.add_le_add_left hm (n - m)
rw [e] at a; exact a
exact Nat.lt_of_lt_of_le (Nat.lt_of_succ_le this) (Nat.le_of_lt_succ h)
have ⟨q, hq⟩ := div_mod m hm F (n - m) hlt
refine ⟨q + 1, ?_⟩
have hmod : n % m = (n - m) % m := by rw [← add_mod' (n - m) m hm, e]
rw [hmod]
calc n = (n - m) + m := e.symm
_ = ((n - m) % m + m * q) + m := by rw [← hq]
_ = (n - m) % m + m * (q + 1) := by rw [Nat.mul_succ, Nat.add_assoc]
theorem even_mod (n m : Nat) (hm : 0 < m) (hn : ∃ a, n = 2 * a) (hm2 : ∃ b, m = 2 * b) : ∃ c, n % m = 2 * c := by
have ⟨q, hq⟩ := div_mod m hm (n + 1) n (Nat.lt_succ_self n)
have ⟨a, ha⟩ := hn
have ⟨b, hb⟩ := hm2
have ⟨c, hc⟩ := parity (n % m)
cases hc with
| inl e => exact ⟨c, e⟩
| inr e =>
rw [e, hb, ha, show 2 * c + 1 + 2 * b * q = 2 * (c + b * q) + 1 by lib_nat] at hq
exact absurd hq.symm (odd_ne_even _ _)
theorem two_dvd_go : ∀ (f : Nat) (x : (_ : Nat) ×' Nat) (hf : GH x < f),
(∃ a, x.1 = 2 * a) → (∃ b, x.2 = 2 * b) → ∃ c, WellFounded.Nat.fix.go GH GF f x hf = 2 * c
| 0, _, hf, _, _ => absurd hf (Nat.not_lt_zero _)
| f + 1, ⟨m, n⟩, hf, hm, hn => by
show ∃ c, (if h : m = 0 then n else WellFounded.Nat.fix.go GH GF f ⟨n % m, m⟩ _) = 2 * c
by_cases h0 : m = 0
· rw [dite_eq_left h0]; exact hn
· rw [dite_eq_right h0]
exact two_dvd_go f ⟨n % m, m⟩ _ (even_mod n m (Nat.pos_of_ne_zero h0) hn hm) hm
theorem two_dvd_gcd (m n : Nat) (hm : ∃ a, m = 2 * a) (hn : ∃ b, n = 2 * b) : ∃ c, Nat.gcd m n = 2 * c := by
rw [gcd_go]; exact two_dvd_go _ ⟨m, n⟩ _ hm hn
theorem isOdd_odd : ∀ c, isOdd (2 * c + 1) = true
| 0 => rfl
| c + 1 => by rw [show 2 * (c + 1) + 1 = (2 * c + 1) + 2 by lib_nat]; exact isOdd_odd c
theorem unit_isOdd (h t : Nat) (hg : Nat.gcd t (h + h) = 1) : isOdd t = true := by
have ⟨c, hc⟩ := parity t
cases hc with
| inr e => rw [e]; exact isOdd_odd c
| inl e =>
have ⟨d, hd⟩ := two_dvd_gcd t (h + h) ⟨c, e⟩ ⟨h, by lib_nat⟩
rw [hg] at hd
exact absurd (show 2 * 0 + 1 = 2 * d by rw [← hd]) (odd_ne_even 0 d)
theorem filter_all {α : Type} (q p : α → Bool) (hqp : ∀ x, q x = true → p x = true) :
∀ l : List α, (l.filter q).all p = true
| [] => rfl
| x :: l => by
cases hq : q x with
| false =>
have e : (x :: l).filter q = l.filter q := by
show (match q x with | true => x :: l.filter q | false => l.filter q) = _; rw [hq]
rw [e]; exact filter_all q p hqp l
| true =>
have e : (x :: l).filter q = x :: l.filter q := by
show (match q x with | true => x :: l.filter q | false => l.filter q) = _; rw [hq]
rw [e]
show (p x && (l.filter q).all p) = true
rw [hqp x hq, filter_all q p hqp l]; rfl
/-- **The units of an even m are odd.** -/
theorem units_odd (h : Nat) : (FermatPrime.units (h + h)).all isOdd = true :=
filter_all _ _ (fun t hg => unit_isOdd h t (Nat.eq_of_beq_eq_true hg)) _
theorem half_bal_even (h : Nat) (hh : 0 < h) : bal (h + h) [h] = true := half_bal h hh (units_odd h)
theorem rest_bal_even (h : Nat) (hh : 0 < h) (rest : List Nat) (hb : bal (h + h) (h :: rest) = true) :
bal (h + h) rest = true := rest_bal h hh (units_odd h) rest hb
end GcdHand
#print axioms GcdHand.eager_gt
#print axioms GcdHand.gcd_go
#print axioms GcdHand.sub_add'
#print axioms GcdHand.div_mod
#print axioms GcdHand.even_mod
#print axioms GcdHand.two_dvd_go
#print axioms GcdHand.two_dvd_gcd
#print axioms GcdHand.isOdd_odd
#print axioms GcdHand.unit_isOdd
#print axioms GcdHand.filter_all
#print axioms GcdHand.units_odd
#print axioms GcdHand.half_bal_even
#print axioms GcdHand.rest_bal_even
lean_all/hodge/Glue.lean
/-
hodge/Glue.lean — T41 cycle 774 (goal G485): gluing balanced characters along a complementary pair (the
character form of Shioda's inductive structure, for lists of any length):
X ⊔ [z] balanced, Y ⊔ [m − z] balanced, 0 < z < m ⇒ X ⊔ Y balanced.
Computation (Open148 data): 3 of the 6 unreached orbits at m = 140 and 32 of the 50 at m = 144 are
[a, a + m/2] ⊔ R with R ⊔ [2a] balanced, i.e. Triple(a) glued to a length-5 character along {2a, m − 2a}.
Lean 4 core plus hodge/QFamHalf (bal_congr), hodge/PairBal (pair_bal), hodge/BalAppend, lib/Semi.
glue the statement
-/
import hodge.QFamHalf
namespace Glue
open Indecomp HalfGeneral BalAppend PairBal QFamHalf GcdHand
theorem glue (m' z : Nat) (X Y : List Nat) (hz0 : 0 < z) (hzm : z < m' + 1)
(hX : bal (m' + 1) (X ++ [z]) = true) (hY : bal (m' + 1) (Y ++ [m' + 1 - z]) = true) :
bal (m' + 1) (X ++ Y) = true := by
have hs : z + (m' + 1 - z) = m' + 1 := by rw [Nat.add_comm]; exact sub_add' _ _ (Nat.le_of_lt hzm)
have hw0 : 0 < m' + 1 - z := by
cases hc : m' + 1 - z with
| zero => rw [hc, Nat.add_zero] at hs; rw [hs] at hzm; exact absurd hzm (Nat.lt_irrefl _)
| succ c => exact Nat.succ_pos c
have P := pair_bal m' z (m' + 1 - z) hs hz0 hw0
have XY := bal_append _ _ _ hX hY
apply bal_cancel _ [z, m' + 1 - z] _ P
apply bal_congr _ _ _ _ _ XY
· intro t
rw [tsum_app, tsum_app, tsum_app, tsum_app, tsum_app]
show tsum (m' + 1) t X + ((t * z) % (m' + 1) + 0) + (tsum (m' + 1) t Y + ((t * (m' + 1 - z)) % (m' + 1) + 0))
= (t * z) % (m' + 1) + ((t * (m' + 1 - z)) % (m' + 1) + 0) + (tsum (m' + 1) t X + tsum (m' + 1) t Y)
lib_nat
· rw [len_app, len_app, len_app, len_app, len_app]
show X.length + 1 + (Y.length + 1) = 2 + (X.length + Y.length)
lib_nat
end Glue
#print axioms Glue.glue
lean_all/hodge/Glue4.lean
/-
hodge/Glue4.lean — T41 cycle 828 (goal G538): length-4 indecomposable characters outside the QFam / QFamHalf
families. Computation (m ≤ 30): 180 such characters, 156 of them glued (Glue) from two balanced length-3
characters along {z, m − z}; the other 24 occur at odd m (no balanced odd-length pieces there). Here: the four
at m = 12 and examples at m = 18, 20, glued with rfl leaves. (Surface classes: algebraic by Lefschetz (1,1).)
Lean 4 core plus hodge/Glue, rfl.
-/
import hodge.Glue
namespace Glue4
open Indecomp Glue
set_option maxRecDepth 100000 in
theorem g4_12_0 : bal 12 ([1, 9] ++ [4, 10]) = true :=
glue 11 8 [1, 9] [4, 10] (Nat.succ_pos 7) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 8) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem g4_12_1 : bal 12 ([2, 8] ++ [3, 11]) = true :=
glue 11 8 [2, 8] [3, 11] (Nat.succ_pos 7) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 8) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem g4_12_2 : bal 12 ([2, 5] ++ [8, 9]) = true :=
glue 11 11 [2, 5] [8, 9] (Nat.succ_pos 10) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 11) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem g4_12_3 : bal 12 ([3, 4] ++ [7, 10]) = true :=
glue 11 11 [3, 4] [7, 10] (Nat.succ_pos 10) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 11) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem g4_18_4 : bal 18 ([1, 14] ++ [6, 15]) = true :=
glue 17 12 [1, 14] [6, 15] (Nat.succ_pos 11) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 12) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem g4_20_5 : bal 20 ([1, 17] ++ [4, 18]) = true :=
glue 19 12 [1, 17] [4, 18] (Nat.succ_pos 11) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 12) (Nat.le_of_ble_eq_true rfl)) rfl rfl
end Glue4
#print axioms Glue4.g4_12_0
#print axioms Glue4.g4_12_1
#print axioms Glue4.g4_12_2
#print axioms Glue4.g4_12_3
#print axioms Glue4.g4_18_4
#print axioms Glue4.g4_20_5
lean_all/hodge/GpNoStep.lean
/-
hodge/GpNoStep.lean — T41 cycle 1934 (goal G862b): the doubled family character
G_p = 14p :: 2·F_p (F_p = FamBal.fam p i₀, p = 14a + v, v ∈ {3, 5}, p prime, F_p indecomposable at 14p)
has no split step in the inductive closure of OpenCerts at m = 28p:
no_step for every A ∈ subs G_p, splitOK (28p) (units 28p) rec G_p A = false
Proof. Write A ⊔ R for the splitting behind A (SubsSum.compl_spec), halve it to A₀ ⊔ B₀ ∈ splits Fq.
s = ΣA mod 28p = 0: both parts balanced and nonempty, so one is {14p} (GpSplit.gp_split); then s = 14p
(A = {14p}) or s = 14p·p mod 28p = 14p (R = {14p}, ΣF_p = 7p²), not 0.
s ≠ 0: the completed part (28p − s) :: A is 2·((14p − s/2) :: A₀), balanced at 14p (GpSplit.half), so
|A₀| ≤ 1 or |A₀| ≥ p (CosetSplitD.part_small); both contradict the length conditions |A|, |B| < p.
Lean 4 core plus hodge/SubsSum, hodge/CosetSplitD, hodge/GpSplit; no axioms.
-/
import hodge.SubsSum
import hodge.CosetSplitD
import hodge.GpSplit
namespace GpNoStep
open FermatGens OpenCerts Indecomp QFamPrime GcdHand ModHand OrbitSum FamArith FamBal CosetSplitA SubsSum
theorem tsum_eq (m t : Nat) : ∀ L : List Nat, Indecomp.tsum m t L = FermatGens.tsum m t L
| [] => rfl
| x :: L => by
show (t * x) % m + Indecomp.tsum m t L = (t * x) % m + FermatGens.tsum m t L
rw [tsum_eq m t L]
theorem hodge_bal (m : Nat) (L : List Nat) : hodgeB m (FermatPrime.units m) L = bal m L := by
unfold hodgeB bal
apply all_congr
intro t
show Nat.beq (FermatGens.tsum m t L + FermatGens.tsum m t L) (L.length * m)
= Nat.beq (Indecomp.tsum m t L + Indecomp.tsum m t L) (L.length * m)
rw [tsum_eq]
theorem gs_map (g h : Nat → Nat) : ∀ L : List Nat, gs g (L.map h) = gs (fun x => g (h x)) L
| [] => rfl
| x :: L => by
show g (h x) + gs g (L.map h) = g (h x) + gs (fun x => g (h x)) L
rw [gs_map g h L]
theorem gs_dbl : ∀ L : List Nat, gs (fun x => 2 * x) L = gs (fun x => x) L + gs (fun x => x) L
| [] => rfl
| x :: L => by
show 2 * x + gs (fun x => 2 * x) L = (x + gs (fun x => x) L) + (x + gs (fun x => x) L)
rw [gs_dbl L]; lib_nat
theorem ble_le : ∀ a b : Nat, Nat.ble a b = true → a ≤ b
| 0, _, _ => Nat.zero_le _
| _ + 1, 0, h => nomatch h
| a + 1, b + 1, h => Nat.succ_le_succ (ble_le a b h)
theorem lt_of_blt' {a b : Nat} (h : Nat.blt a b = true) : a < b := ble_le (a + 1) b h
theorem len_gs (L : List Nat) : L.length = gs (fun _ => 1) L := (CosetSplitA.gs_one L).symm
theorem ne_nil_of_gs (L L' : List Nat) (h : gs (fun _ => 1) L = gs (fun _ => 1) L') (hL : L ≠ []) : L' ≠ [] := by
intro e
rw [e] at h
cases L with
| nil => exact hL rfl
| cons x l =>
have h3 : 1 + gs (fun _ => 1) l = 0 := h
have h2 : gs (fun _ => 1) l + 1 = 0 := by
rw [show gs (fun _ => 1) l + 1 = 1 + gs (fun _ => 1) l by lib_nat]; exact h3
exact Nat.noConfusion h2
theorem ne_of_isEmpty (L : List Nat) (h : L.isEmpty = false) : L ≠ [] := by
intro e
subst e
exact Bool.noConfusion h
/-- the split step is false once both branches are excluded -/
theorem splitOK_false (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c A : List Nat)
(h0 : lsumN A % m = 0 → A ≠ [] → compl c A ≠ [] → hodgeB m U A = true → hodgeB m U (compl c A) = true → False)
(h1 : Nat.blt (((m - lsumN A % m) :: A).length) c.length = true →
Nat.blt (((lsumN A % m) :: compl c A).length) c.length = true →
hodgeB m U ((m - lsumN A % m) :: A) = true → False) :
splitOK m U rec c A = false := by
show (if Nat.beq (lsumN A % m) 0 = true then
(!A.isEmpty && !(compl c A).isEmpty && hodgeB m U A && hodgeB m U (compl c A) && rec A && rec (compl c A))
else
(Nat.blt ((m - lsumN A % m) :: A).length c.length && Nat.blt ((lsumN A % m) :: compl c A).length c.length &&
hodgeB m U ((m - lsumN A % m) :: A) && hodgeB m U ((lsumN A % m) :: compl c A) &&
rec ((m - lsumN A % m) :: A) && rec ((lsumN A % m) :: compl c A))) = false
cases hs : Nat.beq (lsumN A % m) 0 with
| true =>
have e0 := beq_eq_h _ _ hs
show (!A.isEmpty && !(compl c A).isEmpty && hodgeB m U A && hodgeB m U (compl c A) && rec A && rec (compl c A)) = false
cases e1 : A.isEmpty <;> cases e2 : (compl c A).isEmpty <;> cases e3 : hodgeB m U A <;>
cases e4 : hodgeB m U (compl c A) <;>
first | rfl | exact (h0 e0 (ne_of_isEmpty A e1) (ne_of_isEmpty _ e2) e3 e4).elim
| false =>
show (Nat.blt ((m - lsumN A % m) :: A).length c.length && Nat.blt ((lsumN A % m) :: compl c A).length c.length &&
hodgeB m U ((m - lsumN A % m) :: A) && hodgeB m U ((lsumN A % m) :: compl c A) &&
rec ((m - lsumN A % m) :: A) && rec ((lsumN A % m) :: compl c A)) = false
cases f1 : Nat.blt ((m - lsumN A % m) :: A).length c.length <;>
cases f2 : Nat.blt ((lsumN A % m) :: compl c A).length c.length <;>
cases f3 : hodgeB m U ((m - lsumN A % m) :: A) <;>
first | rfl | exact (h1 f1 f2 f3).elim
theorem sum_lin : ∀ n, sumF (fun k => 1 + 14 * k) n = n + 14 * sumF (fun i => i) n
| 0 => rfl
| n + 1 => by
show sumF (fun k => 1 + 14 * k) n + (1 + 14 * n) = (n + 1) + 14 * (sumF (fun i => i) n + n)
rw [sum_lin n]; lib_nat
/-- Σ F_p = 7p², doubled -/
theorem sum_fam (p i0 : Nat) (hi : i0 < p) :
gs (fun x => x) (fam p i0) + gs (fun x => x) (fam p i0) = 14 * (p * p) := by
have eg := FamIndec3.gl_gs (fun x => x) (fun k => if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) p
have eg' : gs (fun x => x) (fam p i0)
= sumF (fun k => if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) p := eg
rw [eg']
have r := sumF_replace (fun k => if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k)
(fun k => 1 + 14 * k) i0 (fun k hk => by
show (if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) = 1 + 14 * k
cases e : Nat.beq k i0 with
| true => exact absurd (beq_eq_h k i0 e) hk
| false => rfl) p hi
have e2 : (if Nat.beq i0 i0 = true then 1 + 14 * i0 + 6 * p else 1 + 14 * i0) = 1 + 14 * i0 + 6 * p := by
rw [beq_refl_h i0] <;> rfl
have r' : sumF (fun k => if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) p + (1 + 14 * i0)
= sumF (fun k => 1 + 14 * k) p + (1 + 14 * i0 + 6 * p) := by
rw [← e2]; exact r
generalize sumF (fun k => if Nat.beq k i0 = true then 1 + 14 * k + 6 * p else 1 + 14 * k) p = T at r' ⊢
have hT : T = p + 14 * sumF (fun i => i) p + 6 * p := add_right_cancel' T _ (1 + 14 * i0) (by
rw [r', sum_lin p]; lib_nat)
have hS := sum_id p
rw [hT]
generalize sumF (fun i => i) p = S at hS ⊢
calc p + 14 * S + 6 * p + (p + 14 * S + 6 * p) = 14 * (S + S + p) := by lib_nat
_ = 14 * (p * p) := by rw [hS]
theorem odd_mul_mod (K j : Nat) (hK : 0 < K) : (K * (2 * j + 1)) % (K + K) = K := by
have hKK : 0 < K + K := Nat.lt_of_lt_of_le hK (Nat.le_add_right K K)
rw [show K * (2 * j + 1) = K + j * (K + K) by lib_nat, add_mul_mod' K (K + K) hKK j]
exact mod_lt' K (K + K) (Nat.add_le_add_left hK K)
theorem dbl_mod (X Y : Nat) (hY : 0 < Y) : (2 * X) % (2 * Y) = 2 * (X % Y) := by
have ⟨q, hq⟩ := div_mod Y hY (X + 1) X (Nat.lt_succ_self X)
have hr : X % Y < Y := Nat.mod_lt _ hY
generalize X % Y = r at hq hr ⊢
have h2Y : 0 < 2 * Y := Nat.mul_pos (Nat.succ_pos 1) hY
have hlt : 2 * r < 2 * Y := Nat.le_trans (Nat.le_succ _) (by
show 2 * r + 1 + 1 ≤ 2 * Y
rw [show 2 * r + 1 + 1 = (r + 1) + (r + 1) by lib_nat, show 2 * Y = Y + Y by lib_nat]
exact Nat.add_le_add hr hr)
rw [hq, show 2 * (r + Y * q) = 2 * r + q * (2 * Y) by lib_nat, add_mul_mod' _ _ h2Y q]
exact mod_lt' _ _ hlt
/-- **G862b: G_p has no split step.** -/
theorem no_step (a v i0 x0 k : Nat) (ek : k = 7 * (14 * a + v)) (hv : v = 3 ∨ v = 5)
(hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v) (h14 : Nat.gcd 14 (14 * a + v) = 1)
(hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(hF : indec (k + k) (fam (14 * a + v) i0) = true) (rec : List Nat → Bool) (A : List Nat)
(hA : A ∈ subs ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x))) :
splitOK ((k + k) + (k + k)) (FermatPrime.units ((k + k) + (k + k))) rec
((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) A = false := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have hk0 : 0 < k := by rw [ek]; exact Nat.mul_pos (Nat.succ_pos 6) hp
have hkk : 0 < k + k := Nat.lt_of_lt_of_le hk0 (Nat.le_add_right k k)
have ekk : k + k = 14 * (14 * a + v) := by rw [ek]; lib_nat
have ec : (k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x) = (Fq (14 * a + v) i0).map (fun x => 2 * x) := by
show (k + k) :: _ = (2 * (7 * (14 * a + v))) :: _
rw [ek, show 2 * (7 * (14 * a + v)) = 7 * (14 * a + v) + 7 * (14 * a + v) by lib_nat]
have ⟨R, hR, hBR⟩ := compl_spec _ A hA
have hR' := hR
rw [ec, APPairIrrGen.splits_eq, APPairIrrGen.splits_map] at hR
have ⟨A0, B0, h0, eA, eR⟩ := GpSplit.mem_mapP (fun x => 2 * x) _ A R hR
rw [← APPairIrrGen.splits_eq] at h0
have hsum : ∀ f : Nat → Nat, gs f A0 + gs f B0 = gs f (Fq (14 * a + v) i0) := fun f => SubsSum.splits_gs f _ _ _ h0
have hmem := (Q4Conv.splits_props _ _ _ h0).2.1
have tI := tot_isp a v i0 hv hi
have tH := tot_ih a v i0 hv hi
have tO := tot_io a v i0 hv hi
have hδ : gs (isp (14 * a + v) i0) A0 ≤ 1 :=
Nat.le.intro (k := gs (isp (14 * a + v) i0) B0) (by rw [hsum]; exact tI)
have hη : gs (ih (14 * a + v)) A0 ≤ 1 :=
Nat.le.intro (k := gs (ih (14 * a + v)) B0) (by rw [hsum]; exact tH)
have hn : gs (io (14 * a + v) i0) A0 + 1 ≤ 14 * a + v := Nat.le.intro (k := gs (io (14 * a + v) i0) B0) (by
rw [show gs (io (14 * a + v) i0) A0 + 1 + gs (io (14 * a + v) i0) B0
= gs (io (14 * a + v) i0) A0 + gs (io (14 * a + v) i0) B0 + 1 by lib_nat, hsum]
exact tO)
have lF : (Fq (14 * a + v) i0).length = 14 * a + v + 1 := by
rw [← len_counts (14 * a + v) i0 (Fq (14 * a + v) i0), tI, tH, tO]
have lAB : A0.length + B0.length = 14 * a + v + 1 := by
rw [len_gs A0, len_gs B0, hsum, ← len_gs, lF]
have lA : A.length = A0.length := by
rw [eA, len_gs (List.map (fun x => 2 * x) A0), len_gs A0, gs_map]
have lB : (compl ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) A).length = B0.length := by
rw [len_gs (compl _ A), hBR (fun _ => 1), eR, gs_map, len_gs B0]
have lc : ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x)).length = 14 * a + v + 1 := by
rw [ec, len_gs (List.map (fun x => 2 * x) (Fq (14 * a + v) i0)), gs_map, ← len_gs (Fq (14 * a + v) i0), lF]
apply splitOK_false
· intro hs0 hAn hBn hhA hhB
rw [hodge_bal] at hhA
rw [hodgeB_congr _ _ _ R hBR, hodge_bal] at hhB
have hRn : R ≠ [] := ne_nil_of_gs _ _ (hBR (fun _ => 1)) hBn
have hlt : k + k < (k + k) + (k + k) := Nat.add_le_add_left hkk (k + k)
rcases GpSplit.gp_split k hk0 (fam (14 * a + v) i0) A R hF hR' hhA hhB hAn hRn with e | e
· rw [e] at hs0
have e2 : lsumN [k + k] % ((k + k) + (k + k)) = k + k := by
show (k + k + 0) % ((k + k) + (k + k)) = k + k
exact mod_lt' _ _ hlt
rw [e2] at hs0
rw [hs0] at hkk
exact Nat.lt_irrefl 0 hkk
· have hsA := SubsSum.splits_gs (fun x => x) _ _ _ hR'
rw [e] at hsA
have e3 : gs (fun x => x) ((fam (14 * a + v) i0).map (fun x => 2 * x)) = gs (fun x => 2 * x) (fam (14 * a + v) i0) :=
gs_map _ _ _
have hc : gs (fun x => x) ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x))
= (k + k) + (k + k) * (14 * a + v) := by
show (k + k) + gs (fun x => x) ((fam (14 * a + v) i0).map (fun x => 2 * x)) = _
rw [e3, gs_dbl, sum_fam _ _ hi, ek]; lib_nat
have hAs : gs (fun x => x) A = (k + k) * (14 * a + v) := add_right_cancel' _ _ (k + k) (by
rw [show gs (fun x => x) A + (k + k) = gs (fun x => x) A + gs (fun x => x) [k + k] from rfl, hsA, hc]
lib_nat)
have hodd : ∃ j, 14 * a + v = 2 * j + 1 := by
rcases hv with h | h
· subst h; exact ⟨7 * a + 1, by lib_nat⟩
· subst h; exact ⟨7 * a + 2, by lib_nat⟩
have ⟨j, hj⟩ := hodd
rw [lsum_gs, hAs, hj, odd_mul_mod (k + k) j hkk] at hs0
rw [hs0] at hkk
exact Nat.lt_irrefl 0 hkk
· intro hlA hlB hhA2
have hlA' : A.length + 1 < ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x)).length :=
lt_of_blt' hlA
have hlB' : (compl ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) A).length + 1
< ((k + k) :: (fam (14 * a + v) i0).map (fun x => 2 * x)).length := lt_of_blt' hlB
rw [lA, lc] at hlA'
rw [lB, lc] at hlB'
have hA0 : A0.length < 14 * a + v := Nat.lt_of_succ_lt_succ hlA'
have hB0 : B0.length < 14 * a + v := Nat.lt_of_succ_lt_succ hlB'
rw [hodge_bal] at hhA2
have hX : lsumN A = 2 * gs (fun x => x) A0 := by
rw [lsum_gs, eA]
have e3 : gs (fun x => x) (A0.map (fun x => 2 * x)) = gs (fun x => 2 * x) A0 := gs_map _ _ _
rw [e3, gs_dbl]; lib_nat
have hsd : lsumN A % ((k + k) + (k + k)) = 2 * (gs (fun x => x) A0 % (k + k)) := by
rw [hX, show (k + k) + (k + k) = 2 * (k + k) by lib_nat, dbl_mod _ _ hkk]
rw [hsd, eA] at hhA2
have hslt : gs (fun x => x) A0 % (k + k) < k + k := Nat.mod_lt _ hkk
have ⟨q, hq⟩ := div_mod (k + k) hkk (gs (fun x => x) A0 + 1) (gs (fun x => x) A0) (Nat.lt_succ_self _)
generalize gs (fun x => x) A0 % (k + k) = s' at hhA2 hslt hq
have es := sub_add' s' (k + k) (Nat.le_of_lt hslt)
have hms : (k + k) + (k + k) - 2 * s' = 2 * (k + k - s') := by
generalize k + k - s' = d at es ⊢
rw [← es, show d + s' + (d + s') = 2 * d + 2 * s' by lib_nat]
exact add_sub' (2 * d) (2 * s')
rw [hms] at hhA2
have hb2 : bal ((k + k) + (k + k)) (((k + k - s') :: A0).map (fun x => 2 * x)) = true := hhA2
have hb := GpSplit.half k hk0 _ hb2
have hs14 : ((k + k - s') + gs (fun x => x) A0) % 14 = 0 := by
rw [hq]
generalize k + k - s' = d at es ⊢
rw [show d + (s' + (k + k) * q) = (d + s') + (k + k) * q by lib_nat, es, ekk,
show 14 * (14 * a + v) + 14 * (14 * a + v) * q = 0 + ((14 * a + v) * (1 + q)) * 14 by lib_nat,
add_mul_mod' 0 14 (Nat.succ_pos 13)] <;> rfl
rw [ekk] at hb hs14
rcases CosetSplitD.part_small a v i0 x0 hv hpr h14 hi hx A0 hmem hδ hη hn _ hs14 hb with h | h
· have h2 : A0.length + B0.length ≤ 1 + B0.length := Nat.add_le_add_right h _
rw [lAB, show 1 + B0.length = B0.length + 1 by lib_nat] at h2
exact Nat.lt_irrefl _ (Nat.lt_of_le_of_lt (Nat.le_of_succ_le_succ h2) hB0)
· exact Nat.lt_irrefl _ (Nat.lt_of_le_of_lt h hA0)
end GpNoStep
#print axioms GpNoStep.tsum_eq
#print axioms GpNoStep.hodge_bal
#print axioms GpNoStep.gs_map
#print axioms GpNoStep.gs_dbl
#print axioms GpNoStep.ble_le
#print axioms GpNoStep.lt_of_blt'
#print axioms GpNoStep.len_gs
#print axioms GpNoStep.ne_nil_of_gs
#print axioms GpNoStep.ne_of_isEmpty
#print axioms GpNoStep.splitOK_false
#print axioms GpNoStep.sum_lin
#print axioms GpNoStep.sum_fam
#print axioms GpNoStep.odd_mul_mod
#print axioms GpNoStep.dbl_mod
#print axioms GpNoStep.no_step
lean_all/hodge/GpNotStd.lean
/-
hodge/GpNotStd.lean — T41 cycle 1934 (goal G862d): the doubled family character G_p = 14p :: 2·F_p
(p = 14a + v, v ∈ {3, 5}) is not Shioda-standard at m = 28p:
not_std isStd (28p) G_p = false
Proof. sameMS G_p (std m d a) makes the additive functionals of the two lists equal (sub run backwards).
Lengths give d = p, so m / d = 28 (DivHand) and the p entries (a + 28k) mod 28p of std lie in the class
a mod 28. G_p has p − 1 entries ≡ 2 (2(1 + 14k)), one ≡ 14 (14p) and one ≡ 6 or 10 (the special entry),
so no class mod 28 holds p of its entries.
Lean 4 core plus hodge/GpNoStep, hodge/DivHand, hodge/CosetSplitC; no axioms.
-/
import hodge.GpNoStep
import hodge.DivHand
import hodge.CosetSplitC
namespace GpNotStd
open FermatGens OpenCerts Fermat25Std Fermat32Open Indecomp QFamPrime GcdHand ModHand OrbitSum FamArith FamBal
CosetSplitA SubsSum GpNoStep
theorem none_ne_some (y : List Nat) (h : (none : Option (List Nat)) = some y) : False := by cases h
theorem erase1_some (x : Nat) : ∀ l l' : List Nat, erase1 x l = some l' → ∀ f : Nat → Nat, f x + gs f l' = gs f l
| [], l', h, _ => (none_ne_some _ (show (none : Option (List Nat)) = some l' from h)).elim
| y :: l, l', h, f => by
have h' : (if Nat.beq x y = true then some l else (erase1 x l).map (y :: ·)) = some l' := h
cases hb : Nat.beq x y with
| true =>
rw [hb] at h'
have h2 : some l = some l' := h'
injection h2 with h3
subst h3
show f x + gs f l = f y + gs f l
rw [beq_eq_h x y hb]
| false =>
rw [hb] at h'
cases he : erase1 x l with
| none =>
rw [he] at h'
exact (none_ne_some _ (show (none : Option (List Nat)) = some l' from h')).elim
| some l'' =>
rw [he] at h'
have h2 : some (y :: l'') = some l' := h'
injection h2 with h3
subst h3
show f x + (f y + gs f l'') = f y + gs f l
rw [← erase1_some x l l'' he f]; lib_nat
theorem sub_some : ∀ (S c B : List Nat), sub c S = some B → ∀ f : Nat → Nat, gs f S + gs f B = gs f c
| [], c, B, h, f => by
have h2 : some c = some B := h
injection h2 with h3
subst h3
show 0 + gs f c = gs f c; lib_nat
| x :: S, c, B, h, f => by
have h' : (match erase1 x c with | none => none | some c' => sub c' S) = some B := h
cases he : erase1 x c with
| none =>
rw [he] at h'
exact (none_ne_some _ (show (none : Option (List Nat)) = some B from h')).elim
| some c' =>
rw [he] at h'
have h2 : sub c' S = some B := h'
show (f x + gs f S) + gs f B = gs f c
rw [← erase1_some x c c' he f, ← sub_some S c' B h2 f]; lib_nat
theorem sameMS_gs (c S : List Nat) (h : sameMS c S = true) : ∀ f : Nat → Nat, gs f S = gs f c := by
have h' : (sub c S == some []) = true := h
cases hs : sub c S with
| none =>
rw [hs] at h'
exact Bool.noConfusion (show false = true from h')
| some B =>
cases B with
| nil =>
intro f
have e := sub_some S c [] hs f
rw [← e]; show gs f S = gs f S + 0; rfl
| cons b B' =>
rw [hs] at h'
exact Bool.noConfusion (show false = true from h')
theorem loop_gs (h : Nat → Nat) : ∀ (n : Nat) (acc : List Nat), gs h (List.range.loop n acc) = sumF h n + gs h acc
| 0, acc => by show gs h acc = 0 + gs h acc; lib_nat
| n + 1, acc => by
show gs h (List.range.loop n (n :: acc)) = (sumF h n + h n) + gs h acc
rw [loop_gs h n (n :: acc)]
show sumF h n + (h n + gs h acc) = _
lib_nat
theorem gs_range (h : Nat → Nat) (n : Nat) : gs h (List.range n) = sumF h n := by
show gs h (List.range.loop n []) = sumF h n
rw [loop_gs] <;> rfl
theorem gs_append (f : Nat → Nat) : ∀ L L' : List Nat, gs f (L ++ L') = gs f L + gs f L'
| [], L' => by show gs f L' = 0 + gs f L'; lib_nat
| x :: L, L' => by
show f x + gs f (L ++ L') = (f x + gs f L) + gs f L'
rw [gs_append f L L']; lib_nat
theorem gs_std (f : Nat → Nat) (m d a : Nat) :
gs f (std m d a) = sumF (fun k => f ((a + k * (m / d)) % m)) d + f ((m * m - d * a) % m) := by
show gs f (((List.range d).map (fun k => (a + k * (m / d)) % m)) ++ [(m * m - d * a) % m]) = _
rw [gs_append, GpNoStep.gs_map, gs_range] <;> rfl
theorem any_false (P : Nat → Bool) (h : ∀ x, P x = false) : ∀ L : List Nat, L.any P = false
| [] => rfl
| x :: L => by
show (P x || L.any P) = false
rw [h x, any_false P h L] <;> rfl
theorem and_false' (b : Bool) : (b && false) = false := by cases b <;> rfl
theorem sumF_one (f : Nat → Nat) (h : ∀ k, f k = 1) : ∀ n, sumF f n = n
| 0 => rfl
| n + 1 => by show sumF f n + f n = n + 1; rw [sumF_one f h n, h n]
theorem gs_congr_mem (g h : Nat → Nat) : ∀ L : List Nat, (∀ x, x ∈ L → g x = h x) → gs g L = gs h L
| [], _ => rfl
| x :: L, hx => by
show g x + gs g L = h x + gs h L
rw [hx x (List.Mem.head _), gs_congr_mem g h L (fun y hy => hx y (List.Mem.tail _ hy))]
theorem gs_lin3 (u w z : Nat → Nat) (α β γ : Nat) : ∀ L : List Nat,
gs (fun x => u x * α + w x * β + z x * γ) L = gs u L * α + gs w L * β + gs z L * γ
| [] => by show 0 = 0 * α + 0 * β + 0 * γ; lib_nat
| x :: L => by
show (u x * α + w x * β + z x * γ) + gs (fun x => u x * α + w x * β + z x * γ) L
= (u x + gs u L) * α + (w x + gs w L) * β + (z x + gs z L) * γ
rw [gs_lin3 u w z α β γ L]; lib_nat
/-- class indicator mod 28 -/
def fr (r y : Nat) : Nat := if Nat.beq (y % 28) r then 1 else 0
theorem fr_congr (r y z : Nat) (h : y % 28 = z % 28) : fr r y = fr r z := by
unfold fr; rw [h]
theorem fr_one (r y : Nat) (h : y % 28 = r) : fr r y = 1 := by
unfold fr; rw [h, beq_refl_h r] <;> rfl
theorem fr_val (r y : Nat) (hy : y < 28) : fr r y = if Nat.beq y r then 1 else 0 := by
unfold fr; rw [mod_lt' y 28 hy]
theorem mod_mod28 (p x : Nat) (hp : 0 < p) : (x % (28 * p)) % 28 = x % 28 := by
have h28p : 0 < 28 * p := Nat.mul_pos (Nat.succ_pos 27) hp
have ⟨q, hq⟩ := div_mod (28 * p) h28p (x + 1) x (Nat.lt_succ_self x)
have e : x % 28 = (x % (28 * p) + (p * q) * 28) % 28 := by
conv => lhs; rw [hq]
rw [show x % (28 * p) + 28 * p * q = x % (28 * p) + (p * q) * 28 by lib_nat]
rw [e, add_mul_mod' _ 28 (Nat.succ_pos 27)]
/-- the pointwise class of 2x for x ∈ Fq -/
theorem pt (a v i0 rs r : Nat) (hv : v = 3 ∨ v = 5) (hs : (2 * sst (14 * a + v) i0) % 28 = rs % 28)
(hh : (2 * (7 * (14 * a + v))) % 28 = 14 % 28) :
∀ x, x ∈ Fq (14 * a + v) i0 → fr r (2 * x)
= io (14 * a + v) i0 x * fr r 2 + isp (14 * a + v) i0 x * fr r rs + ih (14 * a + v) x * fr r 14 := by
intro x hx
have hx' : x ∈ 7 * (14 * a + v) :: fam (14 * a + v) i0 := hx
cases hx' with
| head =>
have ⟨e1, e2, e3⟩ := kind_half a v i0
rw [e1, e2, e3, fr_congr r _ 14 hh]; lib_nat
| tail _ hf =>
rcases fam_kind _ i0 x hf with e | ⟨k, _, _, e⟩
· subst e
have ⟨e1, e2, e3⟩ := kind_sst a v i0 hv
rw [e1, e2, e3, fr_congr r _ rs hs]; lib_nat
· subst e
have ⟨e1, e2, e3⟩ := kind_ord a v i0 k hv
have hk : (2 * (1 + 14 * k)) % 28 = 2 % 28 := by
rw [show 2 * (1 + 14 * k) = 2 + k * 28 by lib_nat, add_mul_mod' 2 28 (Nat.succ_pos 27)]
rw [e1, e2, e3, fr_congr r _ 2 hk]; lib_nat
theorem no_big (p x : Nat) (h : p + x + 1 = p) : False := by
have h1 : p < p + x + 1 := Nat.lt_succ_of_le (Nat.le_add_right p x)
rw [h] at h1
exact Nat.lt_irrefl p h1
theorem small (p x c : Nat) (hp : 2 ≤ p) (hc : c ≤ 1) (h : p + x = c) : False := by
have h1 : p ≤ c := by rw [← h]; exact Nat.le_add_right p x
exact Nat.not_succ_le_zero 0 (Nat.le_of_succ_le_succ (Nat.le_trans hp (Nat.le_trans h1 hc)))
/-- the class count on both sides cannot match -/
theorem count_ne (p fl G rs r : Nat) (hp : 2 ≤ p) (hrs : rs = 6 ∨ rs = 10) (hG : G + 1 = p)
(h : p + fl = G * (if Nat.beq 2 r = true then 1 else 0) + 1 * (if Nat.beq rs r = true then 1 else 0)
+ 1 * (if Nat.beq 14 r = true then 1 else 0)) : False := by
have n2s : rs ≠ 2 := by rcases hrs with e | e <;> subst e <;> exact CosetSplitC.nat_ne _ _ rfl
have n14s : rs ≠ 14 := by rcases hrs with e | e <;> subst e <;> exact CosetSplitC.nat_ne _ _ rfl
have n2 : (2 : Nat) ≠ 14 := CosetSplitC.nat_ne _ _ rfl
cases e2 : Nat.beq 2 r <;> cases es : Nat.beq rs r <;> cases e14 : Nat.beq 14 r <;> rw [e2, es, e14] at h
· have h' : p + fl = G * 0 + 1 * 0 + 1 * 0 := h
exact small p fl 0 hp (Nat.zero_le 1) (by rw [h']; lib_nat)
· have h' : p + fl = G * 0 + 1 * 0 + 1 * 1 := h
exact small p fl 1 hp (Nat.le_refl 1) (by rw [h']; lib_nat)
· have h' : p + fl = G * 0 + 1 * 1 + 1 * 0 := h
exact small p fl 1 hp (Nat.le_refl 1) (by rw [h']; lib_nat)
· exact n14s ((beq_eq_h _ _ es).trans (beq_eq_h _ _ e14).symm)
· have h' : p + fl = G * 1 + 1 * 0 + 1 * 0 := h
exact no_big p fl (calc p + fl + 1 = (G * 1 + 1 * 0 + 1 * 0) + 1 := by rw [h']
_ = G + 1 := by lib_nat
_ = p := hG)
· exact n2 ((beq_eq_h _ _ e2).trans (beq_eq_h _ _ e14).symm)
· exact n2s ((beq_eq_h _ _ es).trans (beq_eq_h _ _ e2).symm)
· exact n2s ((beq_eq_h _ _ es).trans (beq_eq_h _ _ e2).symm)
/-- **G862d: G_p is not standard.** -/
theorem not_std (a v i0 K : Nat) (eK : K = 7 * (14 * a + v)) (hv : v = 3 ∨ v = 5) (hi : i0 < 14 * a + v) :
isStd ((K + K) + (K + K)) ((K + K) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) = false := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have hp2 : 2 ≤ 14 * a + v := by
rcases hv with h | h <;> subst h
· exact Nat.le_trans (Nat.le.intro (k := 1) rfl) (Nat.le_add_left 3 (14 * a))
· exact Nat.le_trans (Nat.le.intro (k := 3) rfl) (Nat.le_add_left 5 (14 * a))
have ⟨rs, hrs, hs⟩ : ∃ rs, (rs = 6 ∨ rs = 10) ∧ (2 * sst (14 * a + v) i0) % 28 = rs % 28 := by
rcases hv with h | h <;> subst h
· refine ⟨10, Or.inr rfl, ?_⟩
unfold sst
rw [show 2 * (1 + 14 * i0 + 6 * (14 * a + 3)) = 10 + (1 + i0 + 6 * a) * 28 by lib_nat,
add_mul_mod' 10 28 (Nat.succ_pos 27)]
· refine ⟨6, Or.inl rfl, ?_⟩
unfold sst
rw [show 2 * (1 + 14 * i0 + 6 * (14 * a + 5)) = 6 + (2 + i0 + 6 * a) * 28 by lib_nat,
add_mul_mod' 6 28 (Nat.succ_pos 27)]
have hh : (2 * (7 * (14 * a + v))) % 28 = 14 % 28 := by
rcases hv with h | h <;> subst h
· rw [show 2 * (7 * (14 * a + 3)) = 14 + (7 * a + 1) * 28 by lib_nat, add_mul_mod' 14 28 (Nat.succ_pos 27)]
· rw [show 2 * (7 * (14 * a + 5)) = 14 + (7 * a + 2) * 28 by lib_nat, add_mul_mod' 14 28 (Nat.succ_pos 27)]
have em : (K + K) + (K + K) = 28 * (14 * a + v) := by rw [eK]; lib_nat
have ec : (K + K) :: (fam (14 * a + v) i0).map (fun x => 2 * x) = (Fq (14 * a + v) i0).map (fun x => 2 * x) := by
show (K + K) :: _ = (2 * (7 * (14 * a + v))) :: _
rw [eK, show 2 * (7 * (14 * a + v)) = 7 * (14 * a + v) + 7 * (14 * a + v) by lib_nat]
have tI := tot_isp a v i0 hv hi
have tH := tot_ih a v i0 hv hi
have tO := tot_io a v i0 hv hi
have lF : (Fq (14 * a + v) i0).length = 14 * a + v + 1 := by
rw [← len_counts (14 * a + v) i0 (Fq (14 * a + v) i0), tI, tH, tO]
have same_false : ∀ d b, sameMS ((K + K) :: (fam (14 * a + v) i0).map (fun x => 2 * x))
(std ((K + K) + (K + K)) d b) = false := by
intro d b
cases hsm : sameMS ((K + K) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) (std ((K + K) + (K + K)) d b) with
| false => rfl
| true =>
exfalso
have G := sameMS_gs _ _ hsm
rw [ec, em] at G
-- lengths: d = p
have G1 := G (fun _ => 1)
rw [gs_std, GpNoStep.gs_map, ← len_gs, lF] at G1
have e1 : sumF (fun _ => 1) d + 1 = 14 * a + v + 1 := G1
rw [sumF_const' 1 d, show d * 1 = d by lib_nat] at e1
have ed : d = 14 * a + v := Nat.succ.inj e1
subst ed
-- class count mod 28
have G2 := G (fr (b % 28))
rw [gs_std, DivHand.mul_div' _ hp 28, GpNoStep.gs_map] at G2
have hterm : ∀ k, fr (b % 28) ((b + k * 28) % (28 * (14 * a + v))) = 1 := fun k =>
fr_one _ _ (by rw [mod_mod28 _ _ hp, add_mul_mod' b 28 (Nat.succ_pos 27) k])
rw [sumF_one _ hterm] at G2
rw [gs_congr_mem _ _ _ (pt a v i0 rs (b % 28) hv hs hh), gs_lin3] at G2
rw [tI, tH] at G2
have hb28 : b % 28 < 28 := Nat.mod_lt _ (Nat.succ_pos 27)
have v2 : fr (b % 28) 2 = if Nat.beq 2 (b % 28) then 1 else 0 := fr_val _ 2 (Nat.le.intro (k := 25) rfl)
have vs : fr (b % 28) rs = if Nat.beq rs (b % 28) then 1 else 0 := by
rcases hrs with e | e <;> subst e
· exact fr_val _ 6 (Nat.le.intro (k := 21) rfl)
· exact fr_val _ 10 (Nat.le.intro (k := 17) rfl)
have v14 : fr (b % 28) 14 = if Nat.beq 14 (b % 28) then 1 else 0 := fr_val _ 14 (Nat.le.intro (k := 13) rfl)
rw [v2, vs, v14] at G2
exact count_ne _ _ _ rs (b % 28) hp2 hrs tO G2
unfold isStd
apply any_false
intro d
show (Nat.blt 1 d && Nat.beq (((K + K) + (K + K)) % d) 0 && (List.range ((K + K) + (K + K))).any
(fun b => sameMS ((K + K) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) (std ((K + K) + (K + K)) d b))) = false
rw [any_false _ (fun b => same_false d b)]
exact and_false' _
end GpNotStd
#print axioms GpNotStd.none_ne_some
#print axioms GpNotStd.erase1_some
#print axioms GpNotStd.sub_some
#print axioms GpNotStd.sameMS_gs
#print axioms GpNotStd.loop_gs
#print axioms GpNotStd.gs_range
#print axioms GpNotStd.gs_append
#print axioms GpNotStd.gs_std
#print axioms GpNotStd.any_false
#print axioms GpNotStd.and_false'
#print axioms GpNotStd.sumF_one
#print axioms GpNotStd.gs_congr_mem
#print axioms GpNotStd.gs_lin3
#print axioms GpNotStd.fr_congr
#print axioms GpNotStd.fr_one
#print axioms GpNotStd.fr_val
#print axioms GpNotStd.mod_mod28
#print axioms GpNotStd.pt
#print axioms GpNotStd.no_big
#print axioms GpNotStd.small
#print axioms GpNotStd.count_ne
#print axioms GpNotStd.not_std
lean_all/hodge/GpOpen.lean
/-
hodge/GpOpen.lean — T41 cycle 1934 (goal G862): for every prime p = 14a + v (v ∈ {3, 5}, p ≥ 5) with
FamBal data 1 + 14i₀ = p·x₀, the doubled family character G_p = 14p :: 2·F_p at m = 28p is
Hodge bal (28p) G_p (FamDouble.gp_bal)
not standard isStd (28p) G_p = false (GpNotStd.not_std)
not reached reach (28p) (units 28p) f G_p = false for every fuel f (GpNoStep.no_step)
by the inductive closure of OpenCerts (Shioda standard characters + splitting with completion).
This is the uniform form of OpenCertG5 (p = 5, by rfl).
Lean 4 core plus hodge/GpNotStd, hodge/FamDouble; no axioms.
-/
import hodge.GpNotStd
import hodge.FamDouble
namespace GpOpen
open FermatGens OpenCerts Indecomp FamBal CosetSplitA GpNoStep GpNotStd
theorem anySplit_false (m : Nat) (U : List Nat) (rec : List Nat → Bool) (c : List Nat) :
∀ L : List (List Nat), (∀ A, A ∈ L → splitOK m U rec c A = false) → anySplit m U rec c L = false
| [], _ => rfl
| A :: L, h => by
show (splitOK m U rec c A || anySplit m U rec c L) = false
rw [h A (List.Mem.head _), anySplit_false m U rec c L (fun B hB => h B (List.Mem.tail _ hB))] <;> rfl
theorem blt5 (n : Nat) (h : 5 ≤ n) : Nat.blt n 5 = false := by
have ⟨k, hk⟩ := Nat.le.dest h
rw [← hk, show 5 + k = k + 5 by lib_nat]
rfl
theorem reach_zero (m : Nat) (U c : List Nat) : reach m U 0 c = (Nat.blt c.length 5 || isStd m c) := rfl
theorem reach_succ (m : Nat) (U c : List Nat) (f : Nat) :
reach m U (f + 1) c = (Nat.blt c.length 5 || isStd m c || anySplit m U (reach m U f) c (subs c)) := rfl
/-- **G862: G_p is Hodge, not standard, and never reached.** -/
theorem gp_open (a v i0 x0 : Nat) (hv : v = 3 ∨ v = 5) (hpr : ∀ d, d ∣ (14 * a + v) → d = 1 ∨ d = 14 * a + v)
(h14 : Nat.gcd 14 (14 * a + v) = 1) (hi : i0 < 14 * a + v) (hx : 1 + 14 * i0 = (14 * a + v) * x0)
(h4 : 4 ≤ 14 * a + v) :
bal (28 * (14 * a + v)) (14 * (14 * a + v) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) = true ∧
isStd (28 * (14 * a + v)) (14 * (14 * a + v) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) = false ∧
∀ f, reach (28 * (14 * a + v)) (FermatPrime.units (28 * (14 * a + v))) f
(14 * (14 * a + v) :: (fam (14 * a + v) i0).map (fun x => 2 * x)) = false := by
have hp : 0 < 14 * a + v := Nat.lt_of_le_of_lt (Nat.zero_le _) hi
have hu := CosetSplitC.u_of a v i0 x0 hv hx
have hfc : FamMod.fcond (x0 % 14) = true := by
rcases hu with ⟨_, e⟩ | ⟨_, e⟩ <;> rw [e] <;> rfl
have hx1 : x0 ≠ 1 := fun e => by
subst e
rcases hu with ⟨_, e⟩ | ⟨_, e⟩
· exact CosetSplitC.nat_ne _ _ rfl e
· exact CosetSplitC.nat_ne _ _ rfl e
have hF := FamIndec3.fam_indec _ i0 x0 hp hpr h14 hi hx hx1
have e1 : 7 * (14 * a + v) + 7 * (14 * a + v) = 14 * (14 * a + v) := by lib_nat
have e2 : 14 * (14 * a + v) + 14 * (14 * a + v) = 28 * (14 * a + v) := by lib_nat
have hF' : indec (7 * (14 * a + v) + 7 * (14 * a + v)) (fam (14 * a + v) i0) = true := by rw [e1]; exact hF
have hstd := not_std a v i0 (7 * (14 * a + v)) rfl hv hi
rw [e1, e2] at hstd
have hns := fun rec A hA => no_step a v i0 x0 (7 * (14 * a + v)) rfl hv hpr h14 hi hx hF' rec A hA
rw [e1, e2] at hns
have lF : (Fq (14 * a + v) i0).length = 14 * a + v + 1 := by
rw [← len_counts (14 * a + v) i0 (Fq (14 * a + v) i0), tot_isp a v i0 hv hi, tot_ih a v i0 hv hi,
tot_io a v i0 hv hi]
have hlen : (14 * (14 * a + v) :: (fam (14 * a + v) i0).map (fun x => 2 * x)).length = 14 * a + v + 1 := by
show ((fam (14 * a + v) i0).map (fun x => 2 * x)).length + 1 = _
rw [FamDouble.len_map]
exact lF
have hblt : Nat.blt (14 * (14 * a + v) :: (fam (14 * a + v) i0).map (fun x => 2 * x)).length 5 = false := by
rw [hlen]; exact blt5 _ (Nat.succ_le_succ h4)
refine ⟨FamDouble.gp_bal _ i0 x0 hp hi hx hfc, hstd, ?_⟩
intro f
cases f with
| zero => rw [reach_zero, hblt, hstd] <;> rfl
| succ f =>
rw [reach_succ, hblt, hstd, anySplit_false _ _ _ _ _ (fun A hA => hns _ A hA)] <;> rfl
end GpOpen
#print axioms GpOpen.anySplit_false
#print axioms GpOpen.blt5
#print axioms GpOpen.reach_zero
#print axioms GpOpen.reach_succ
#print axioms GpOpen.gp_open
lean_all/hodge/GpSplit.lean
/-
hodge/GpSplit.lean — T41 cycle 1914 (goal G862a, structure side): for any indecomposable F at modulus M = 2k,
the only splitting of the doubled character G = M :: 2·F (modulus 2M) into two nonempty balanced parts is
{M} ⊔ 2·F. With F = F_p (M = 14p) this is the split of G_p = 2F_p ∪ {m/2} used in G862.
Proof: a part containing M is balanced iff the rest is (GcdHand.rest_bal_even); a doubled list 2·X balanced at
2M gives X balanced at M (every unit t of M is a unit of 2M: t odd, gcd(t, 2M) odd divides M; tsum of 2·X at 2M
is 2·tsum of X at M, FamDouble.tsum_map2); so a splitting gives a balanced splitting of F, which is trivial.
Lean 4 core plus hodge/FamDouble, hodge/UnitMul, hodge/APPairIrrGen, hodge/FamIndec3, lib/Semi (lib_nat);
hand proofs, no axioms.
-/
import hodge.FamDouble
import hodge.UnitMul
import hodge.APPairIrrGen
import hodge.FamIndec3
namespace GpSplit
open Indecomp ModHand GcdHand APPair1 FamBal FamDouble TorsionImage APPairIrrGen
theorem double_inj : ∀ a b : Nat, a + a = b + b → a = b
| 0, 0, _ => rfl
| 0, _ + 1, h => Nat.noConfusion h
| _ + 1, 0, h => Nat.noConfusion h
| a + 1, b + 1, h => by
have h2 : (a + a) + 2 = (b + b) + 2 := calc
(a + a) + 2 = (a + 1) + (a + 1) := by lib_nat
_ = (b + 1) + (b + 1) := h
_ = (b + b) + 2 := by lib_nat
exact congrArg (· + 1) (double_inj a b (add_right_cancel' (a + a) (b + b) 2 h2))
/-- a unit of 2k is a unit of 4k -/
theorem unit_double (k t : Nat) (hg : Nat.gcd t (k + k) = 1) : Nat.gcd t ((k + k) + (k + k)) = 1 := by
obtain ⟨c, hc⟩ := parity t
cases hc with
| inl e =>
have ⟨d, hd⟩ := dvd_gcd 2 t (k + k) ⟨c, e⟩ ⟨k, by lib_nat⟩
rw [hg] at hd
exact (one_eq_mul 2 d hd (Nat.le_refl 2)).elim
| inr e =>
obtain ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := UnitMul.gcd_dvd t ((k + k) + (k + k))
generalize Nat.gcd t ((k + k) + (k + k)) = g at hi hj ⊢
obtain ⟨a, ha⟩ := parity g
cases ha with
| inl ga =>
rw [ga, e] at hi
exact (odd_ne_even c (a * i) (by rw [hi]; lib_nat)).elim
| inr ga =>
obtain ⟨b, hb⟩ := parity j
cases hb with
| inr jb =>
rw [ga, jb] at hj
exact (odd_ne_even (2 * a * b + a + b) (k + k)
(by rw [show 2 * (k + k) = (k + k) + (k + k) by lib_nat, hj]; lib_nat)).elim
| inl jb =>
rw [jb] at hj
have hM : k + k = g * b := double_inj _ _ (by rw [hj]; lib_nat)
have ⟨d, hd⟩ := dvd_gcd g t (k + k) ⟨i, hi⟩ ⟨b, hM⟩
rw [hg] at hd
exact UnitMul.one_of_dvd_one g d hd
theorem all_app (P : Nat → Bool) : ∀ l1 l2 : List Nat, l1.all P = true → l2.all P = true → (l1 ++ l2).all P = true
| [], _, _, h2 => h2
| x :: l1, l2, h1, h2 => by
have h1' : (P x && l1.all P) = true := h1
cases hx : P x with
| false => rw [hx] at h1'; exact Bool.noConfusion h1'
| true =>
rw [hx] at h1'
show (P x && (l1 ++ l2).all P) = true
rw [hx, all_app P l1 l2 h1' h2]; rfl
theorem all_range (pr P : Nat → Bool) : ∀ M, (∀ t, t < M → pr t = true → P t = true) →
((List.range M).filter pr).all P = true
| 0, _ => rfl
| M + 1, h => by
rw [range_succ' M, filter_append' pr (List.range M) [M]]
apply all_app
· exact all_range pr P M (fun t ht hp => h t (Nat.lt_succ_of_lt ht) hp)
· cases hM : pr M with
| false =>
have e : [M].filter pr = [] := by
show (match pr M with | true => M :: [].filter pr | false => [].filter pr) = _; rw [hM]; rfl
rw [e]; rfl
| true =>
have e : [M].filter pr = [M] := by
show (match pr M with | true => M :: [].filter pr | false => [].filter pr) = _; rw [hM]; rfl
rw [e]
show (P M && true) = true
rw [h M (Nat.lt_succ_self M) hM]; rfl
/-- 2·X balanced at 4k ⇒ X balanced at 2k -/
theorem half (k : Nat) (hk : 0 < k) (X : List Nat) (h : bal ((k + k) + (k + k)) (X.map (fun x => 2 * x)) = true) :
bal (k + k) X = true := by
have hM : 0 < k + k := Nat.lt_of_lt_of_le hk (Nat.le_add_right k k)
unfold bal FermatPrime.units
apply all_range
intro t ht hp
have hg : Nat.gcd t (k + k) = 1 := Nat.eq_of_beq_eq_true hp
have e := FamIndec3.bal_unit _ t _ h (Nat.lt_of_lt_of_le ht (Nat.le_add_right _ _)) (unit_double k t hg)
rw [show (k + k) + (k + k) = 2 * (k + k) by lib_nat, tsum_map2 (k + k) t hM X, len_map] at e
have e2 : (tsum (k + k) t X + tsum (k + k) t X) + (tsum (k + k) t X + tsum (k + k) t X)
= X.length * (k + k) + X.length * (k + k) := calc
_ = 2 * tsum (k + k) t X + 2 * tsum (k + k) t X := by lib_nat
_ = X.length * (2 * (k + k)) := e
_ = X.length * (k + k) + X.length * (k + k) := by lib_nat
rw [double_inj _ _ e2]
exact beq_refl' _
theorem mem_fm (x : Nat) : ∀ (L : List (List Nat × List Nat)) (A B : List Nat),
(A, B) ∈ L.flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)]) →
∃ A' B', (A', B') ∈ L ∧ ((A = x :: A' ∧ B = B') ∨ (A = A' ∧ B = x :: B'))
| [], _, _, h => by cases h
| p :: L, A, B, h => by
have h' : (A, B) ∈ (x :: p.1, p.2) :: (p.1, x :: p.2) :: L.flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)]) := h
cases h' with
| head => exact ⟨p.1, p.2, List.Mem.head _, Or.inl ⟨rfl, rfl⟩⟩
| tail _ h2 =>
cases h2 with
| head => exact ⟨p.1, p.2, List.Mem.head _, Or.inr ⟨rfl, rfl⟩⟩
| tail _ h3 =>
have ⟨A', B', hm, hc⟩ := mem_fm x L A B h3
exact ⟨A', B', List.Mem.tail _ hm, hc⟩
theorem mem_mapP (g : Nat → Nat) : ∀ (L : List (List Nat × List Nat)) (A B : List Nat),
(A, B) ∈ L.map (fun p => (p.1.map g, p.2.map g)) → ∃ A0 B0, (A0, B0) ∈ L ∧ A = A0.map g ∧ B = B0.map g
| [], _, _, h => by cases h
| p :: L, A, B, h => by
have h' : (A, B) ∈ (p.1.map g, p.2.map g) :: L.map (fun p => (p.1.map g, p.2.map g)) := h
cases h' with
| head => exact ⟨p.1, p.2, List.Mem.head _, rfl, rfl⟩
| tail _ h2 =>
have ⟨A0, B0, hm, e1, e2⟩ := mem_mapP g L A B h2
exact ⟨A0, B0, List.Mem.tail _ hm, e1, e2⟩
theorem all_memG {α : Type} (P : α → Bool) : ∀ (l : List α), l.all P = true → ∀ r, r ∈ l → P r = true
| [], _, _, h => nomatch h
| x :: l, hl, r, hr => by
have hx : P x = true ∧ l.all P = true := by
cases e1 : P x with
| false => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact nomatch hl
| true => rw [show (x :: l).all P = (P x && l.all P) from rfl, e1] at hl; exact ⟨rfl, hl⟩
cases hr with
| head => exact hx.1
| tail _ h' => exact all_memG P l hx.2 r h'
theorem empty_or (A0 B0 : List Nat) (h : (A0.isEmpty || B0.isEmpty || !(true && true)) = true) : A0 = [] ∨ B0 = [] := by
cases A0 with
| nil => exact Or.inl rfl
| cons a l =>
cases B0 with
| nil => exact Or.inr rfl
| cons b l' => exact Bool.noConfusion h
/-- **The only balanced splitting of M :: 2·F (F indecomposable at M = 2k) is {M} ⊔ 2·F.** -/
theorem gp_split (k : Nat) (hk : 0 < k) (F A B : List Nat) (hF : indec (k + k) F = true)
(hs : (A, B) ∈ splits ((k + k) :: F.map (fun x => 2 * x)))
(hA : bal ((k + k) + (k + k)) A = true) (hB : bal ((k + k) + (k + k)) B = true)
(hAn : A ≠ []) (hBn : B ≠ []) : A = [k + k] ∨ B = [k + k] := by
have hM : 0 < k + k := Nat.lt_of_lt_of_le hk (Nat.le_add_right k k)
rw [splits_eq] at hs
obtain ⟨A', B', hm, hc⟩ := mem_fm (k + k) _ A B hs
rw [splits_map] at hm
obtain ⟨A0, B0, h0, e1, e2⟩ := mem_mapP (fun x => 2 * x) _ A' B' hm
have hi := all_memG _ (splits F) hF (A0, B0) (by rw [splits_eq]; exact h0)
have hi' : (A0.isEmpty || B0.isEmpty || !(bal (k + k) A0 && bal (k + k) B0)) = true := hi
rcases hc with ⟨ea, eb⟩ | ⟨ea, eb⟩
· subst ea eb e1 e2
rw [half k hk A0 (rest_bal_even (k + k) hM _ hA), half k hk B0 hB] at hi'
rcases empty_or A0 B0 hi' with h | h
· subst h; exact Or.inl rfl
· subst h; exact (hBn rfl).elim
· subst ea eb e1 e2
rw [half k hk A0 hA, half k hk B0 (rest_bal_even (k + k) hM _ hB)] at hi'
rcases empty_or A0 B0 hi' with h | h
· subst h; exact (hAn rfl).elim
· subst h; exact Or.inr rfl
-- the case p = 5: F_5 = fam 5 1 is indecomposable at 70, so G_5 = 70 :: 2·F_5 splits only as {70} ⊔ 2·F_5
set_option maxRecDepth 100000 in
theorem f5_indec : indec (35 + 35) (fam 5 1) = true := rfl
theorem g5_split (A B : List Nat) (hs : (A, B) ∈ splits ((35 + 35) :: (fam 5 1).map (fun x => 2 * x)))
(hA : bal ((35 + 35) + (35 + 35)) A = true) (hB : bal ((35 + 35) + (35 + 35)) B = true)
(hAn : A ≠ []) (hBn : B ≠ []) : A = [35 + 35] ∨ B = [35 + 35] :=
gp_split 35 (Nat.succ_pos 34) (fam 5 1) A B f5_indec hs hA hB hAn hBn
end GpSplit
#print axioms GpSplit.double_inj
#print axioms GpSplit.unit_double
#print axioms GpSplit.all_app
#print axioms GpSplit.all_range
#print axioms GpSplit.half
#print axioms GpSplit.mem_fm
#print axioms GpSplit.mem_mapP
#print axioms GpSplit.all_memG
#print axioms GpSplit.empty_or
#print axioms GpSplit.gp_split
#print axioms GpSplit.f5_indec
#print axioms GpSplit.g5_split
lean_all/hodge/HalfBig.lean
/-
hodge/HalfBig.lean — T41 cycle 1385 (goal G817 — done): in odd degree, a balanced character has exactly half of
its entries above m/2. For m = 2j + 3 and c balanced with entries in (0, m),
gcd_two gcd(2, m) = 1 (2 is a unit)
dbl_mod ⟨2a⟩ + m·[2a ≥ m] = 2a for 0 < a < m
tsum_one ⟨1·a⟩ summed is Σa for entries in (0, m)
half_big 2·#{a ∈ c : 2a ≥ m} = |c|,
comparing the balance equations at the units t = 1 and t = 2. A necessary condition on every Hodge character of
odd degree (and the count of entries above m/2 is |c|/2, as for complementary pairs).
Lean 4 core plus hodge/PairsSplit (inR, andL/andR), hodge/FamIndec2 (gcd_one_of), hodge/FamIndec3 (bal_unit),
hodge/APPairIrrGen (gcd_one), hodge/ModHand, hodge/GcdHand, bsd/TorsionImage (odd_ne_even).
-/
import hodge.PairsSplit
import hodge.FamIndec2
import hodge.FamIndec3
import hodge.APPairIrrGen
import bsd.TorsionImage
namespace HalfBig
open Indecomp PairsSplit
def big (m : Nat) : List Nat → Nat
| [] => 0
| a :: l => (if Nat.ble m (2 * a) = true then 1 else 0) + big m l
theorem gcd_two (j : Nat) : Nat.gcd 2 (2 * j + 3) = 1 := by
apply FamIndec2.gcd_one_of
intro d h2 hm
cases h2 with
| intro k hk =>
match d, k, hk with
| 0, k, hk => rw [Nat.zero_mul] at hk; exact Nat.noConfusion hk
| 1, _, _ => rfl
| 2, _, _ =>
cases hm with
| intro q hq =>
exact absurd (show 2 * (j + 1) + 1 = 2 * q by rw [← hq]; lib_nat) (TorsionImage.odd_ne_even _ _)
| d + 3, 0, hk => rw [Nat.mul_zero] at hk; exact Nat.noConfusion hk
| d + 3, k + 1, hk =>
have e : (d + 3) * (k + 1) = ((d + 3) * k + d) + 1 + 1 + 1 := by lib_nat
rw [e] at hk
exact Nat.noConfusion (Nat.succ.inj (Nat.succ.inj hk))
theorem dbl_mod (m a : Nat) (ha0 : 0 < a) (ham : a < m) :
(2 * a) % m + m * (if Nat.ble m (2 * a) = true then 1 else 0) = 2 * a := by
have hm : 0 < m := Nat.lt_trans ha0 ham
cases h : Nat.ble m (2 * a) with
| true =>
have hle : m ≤ 2 * a := Nat.le_of_ble_eq_true h
have e := GcdHand.sub_add' m (2 * a) hle
have hs : 2 * a - m < m := by
have l2 : 2 * a < m + m := by rw [show 2 * a = a + a by lib_nat]; exact Nat.add_lt_add ham ham
rw [← e] at l2
exact Nat.lt_of_add_lt_add_right l2
show (2 * a) % m + m * 1 = 2 * a
rw [← e, ModHand.add_mod' _ _ hm, ModHand.mod_lt' _ _ hs, Nat.mul_one]
| false =>
have hlt : 2 * a < m := by
cases Nat.lt_or_ge (2 * a) m with
| inl hl => exact hl
| inr hg => rw [Nat.ble_eq_true_of_le hg] at h; exact Bool.noConfusion h
show (2 * a) % m + m * 0 = 2 * a
rw [ModHand.mod_lt' _ _ hlt, Nat.mul_zero, Nat.add_zero]
theorem sum_rel (m : Nat) : ∀ c : List Nat, c.all (inR m) = true →
tsum m 2 c + m * big m c = 2 * tsum m 1 c
| [], _ => rfl
| a :: l, h => by
have h' : (inR m a && l.all (inR m)) = true := h
have ha0 : 0 < a := Nat.le_of_ble_eq_true (andL (andL h'))
have ham : a < m := Nat.le_of_ble_eq_true (andR (andL h'))
have ih := sum_rel m l (andR h')
have dm := dbl_mod m a ha0 ham
have one : (1 * a) % m = a := by rw [Nat.one_mul]; exact ModHand.mod_lt' _ _ ham
show (2 * a) % m + tsum m 2 l + m * ((if Nat.ble m (2 * a) = true then 1 else 0) + big m l)
= 2 * ((1 * a) % m + tsum m 1 l)
rw [one]
generalize (if Nat.ble m (2 * a) = true then 1 else 0) = I at dm ⊢
generalize (2 * a) % m = D at dm ⊢
rw [show D + tsum m 2 l + m * (I + big m l) = (D + m * I) + (tsum m 2 l + m * big m l) by lib_nat, dm, ih]
lib_nat
theorem half_big (j : Nat) (c : List Nat) (hr : c.all (inR (2 * j + 3)) = true) (hb : bal (2 * j + 3) c = true) :
2 * big (2 * j + 3) c = c.length := by
have h3 : 2 < 2 * j + 3 := Nat.le_add_left 3 (2 * j)
have u1 := FamIndec3.bal_unit (2 * j + 3) 1 c hb (Nat.lt_trans (Nat.lt_succ_self 1) h3) (APPairIrrGen.gcd_one _)
have u2 := FamIndec3.bal_unit (2 * j + 3) 2 c hb h3 (gcd_two j)
have sr := sum_rel (2 * j + 3) c hr
generalize tsum (2 * j + 3) 1 c = T1 at u1 sr
generalize tsum (2 * j + 3) 2 c = T2 at u2 sr
generalize big (2 * j + 3) c = B at sr ⊢
generalize c.length = L at u1 u2 ⊢
generalize 2 * j + 3 = m at u1 u2 sr h3 ⊢
-- (T2 + T2) + 2mB = 4T1 = 2Lm, T2 + T2 = Lm ⇒ 2mB = Lm
have e : (T2 + T2) + (2 * B) * m = (T2 + T2) + L * m := by
calc (T2 + T2) + (2 * B) * m = 2 * (T2 + m * B) := by lib_nat
_ = 2 * (2 * T1) := by rw [sr]
_ = (T1 + T1) + (T1 + T1) := by lib_nat
_ = L * m + L * m := by rw [u1]
_ = (T2 + T2) + L * m := by rw [u2]
have e2 := BalAppend.add_cancel _ _ _ e
exact Nat.eq_of_mul_eq_mul_right (Nat.lt_trans (Nat.zero_lt_succ 1) h3) e2
end HalfBig
#print axioms HalfBig.gcd_two
#print axioms HalfBig.dbl_mod
#print axioms HalfBig.sum_rel
#print axioms HalfBig.half_big
lean_all/hodge/HalfEntry.lean
/-
hodge/HalfEntry.lean — T41 cycle 159: the entry m/2 is neutral for the Hodge condition, every even m.
Lean 4 core plus hodge/HodgeIff (lsumL_append), FTAChain (rem_add_mul), QRChain (rem_of_lt,
add_right_cancel'), ESChain (rem_eq_mod), lib/Semi. With m = 2q:
half_mod t odd ⇒ ⟨t q⟩_m = q (every odd twist fixes the entry m/2)
half_cancel a ++ [q] Hodge ⇒ a Hodge (when every unit t has ⟨t q⟩ = q)
half_append a Hodge ⇒ a ++ [q] Hodge
half62 every unit of 62 fixes 31 (rfl)
Reading: the open character (1, 31, 33, 35, 39, 47) of m = 62 is Hodge iff its five entries without 31 are
balanced, i.e. the entry 31 = m/2 carries no Hodge information; the obstruction sits in the odd-length rest.
-/
import hodge.HodgeIff
import lib.Semi
namespace HalfEntry
open FTAChain FrobChain QRChain ESChain FermatPrime FermatFull HodgeChain HodgeIff
theorem half_mod (q' j : Nat) : ((j + j + 1) * (q' + 1)) % ((q' + q' + 1) + 1) = q' + 1 := by
rw [← rem_eq_mod, show (j + j + 1) * (q' + 1) = j * ((q' + q' + 1) + 1) + (q' + 1) by lib_nat,
rem_add_mul]
exact rem_of_lt _ _ (by
show q' + 1 < (q' + q' + 1) + 1
exact Nat.succ_lt_succ (Nat.lt_succ_of_le (Nat.le_add_left q' q')))
theorem half_cancel (q' : Nat) (a : List Nat)
(hfix : ∀ t, t ∈ FermatPrime.units ((q' + q' + 1) + 1) → (t * (q' + 1)) % ((q' + q' + 1) + 1) = q' + 1)
(h : HodgeList ((q' + q' + 1) + 1) (a ++ [q' + 1])) : HodgeList ((q' + q' + 1) + 1) a := by
intro t ht
have e := h t ht
rw [lsumL_append, lsumL_append] at e
have e' : lsumL (fun i => 2 * (t * i % ((q' + q' + 1) + 1))) a + ((q' + q' + 1) + 1)
= lsumL (fun _ => (q' + q' + 1) + 1) a + ((q' + q' + 1) + 1) := by
have l : lsumL (fun i => 2 * (t * i % ((q' + q' + 1) + 1))) [q' + 1] = (q' + q' + 1) + 1 := by
show 2 * (t * (q' + 1) % ((q' + q' + 1) + 1)) + 0 = (q' + q' + 1) + 1
rw [hfix t ht]; lib_nat
have r : lsumL (fun _ => (q' + q' + 1) + 1) [q' + 1] = (q' + q' + 1) + 1 := by
show (q' + q' + 1) + 1 + 0 = (q' + q' + 1) + 1; rfl
rw [l, r] at e; exact e
exact add_right_cancel' _ _ _ e'
theorem half_append (q' : Nat) (a : List Nat)
(hfix : ∀ t, t ∈ FermatPrime.units ((q' + q' + 1) + 1) → (t * (q' + 1)) % ((q' + q' + 1) + 1) = q' + 1)
(h : HodgeList ((q' + q' + 1) + 1) a) : HodgeList ((q' + q' + 1) + 1) (a ++ [q' + 1]) := by
intro t ht
rw [lsumL_append, lsumL_append, h t ht]
show lsumL (fun _ => (q' + q' + 1) + 1) a + (2 * (t * (q' + 1) % ((q' + q' + 1) + 1)) + 0)
= lsumL (fun _ => (q' + q' + 1) + 1) a + ((q' + q' + 1) + 1 + 0)
rw [hfix t ht]; lib_nat
def fix62 : Bool := (FermatPrime.units 62).all (fun t => Nat.beq ((t * 31) % 62) 31)
theorem fix62_ok : fix62 = true := rfl
theorem half62 : ∀ t, t ∈ FermatPrime.units ((30 + 30 + 1) + 1) → (t * (30 + 1)) % ((30 + 30 + 1) + 1) = 30 + 1 :=
fun t ht => Nat.eq_of_beq_eq_true (all_mem _ (FermatPrime.units 62) fix62_ok t ht)
end HalfEntry
#print axioms HalfEntry.half_mod
#print axioms HalfEntry.half_cancel
#print axioms HalfEntry.half_append
#print axioms HalfEntry.fix62_ok
#print axioms HalfEntry.half62
lean_all/hodge/HalfGeneral.lean
/-
hodge/HalfGeneral.lean — T41 cycle 242 (goal G4, step 2): m/2 splits off a balanced character for every even m
whose units are odd.
Lean 4 core plus hodge/ModHand (mod_lt', add_mul_mod'), hodge/Indecomp (bal, tsum). For m = h + h, h > 0:
isOdd, odd_form structural parity; isOdd t ⇒ t = 2s + 1
half_mul t odd ⇒ t·h mod m = h
half_bal (units m).all isOdd ⇒ [h] is balanced
rest_bal (units m).all isOdd ⇒ (h :: rest balanced ⇒ rest balanced)
The hypothesis (units m).all isOdd is true for every even m (a unit is prime to 2) — checked here by rfl for every
even m ≤ 100 (units_odd_100); for symbolic m it needs gcd lemmas, which in core depend on Quot.sound.
-/
import hodge.ModHand
import hodge.Indecomp
namespace HalfGeneral
open Indecomp ModHand
def isOdd : Nat → Bool
| 0 => false
| 1 => true
| n + 2 => isOdd n
theorem odd_form : ∀ t, isOdd t = true → ∃ s, t = 2 * s + 1
| 0, h => Bool.noConfusion h
| 1, _ => ⟨0, rfl⟩
| n + 2, h => by
have ⟨s, hs⟩ := odd_form n h
exact ⟨s + 1, by rw [hs, Nat.mul_succ]⟩
theorem all_imp {α : Type} (p q : α → Bool) (h : ∀ x, p x = true → q x = true) :
∀ l : List α, l.all p = true → l.all q = true
| [], _ => rfl
| x :: l, hp => by
have hp' : (p x && l.all p) = true := hp
cases hpx : p x with
| false => rw [hpx] at hp'; exact Bool.noConfusion hp'
| true =>
rw [hpx] at hp'
show (q x && l.all q) = true
rw [h x hpx, all_imp p q h l hp']; rfl
theorem beq_self (n : Nat) : Nat.beq n n = true := by
induction n with
| zero => rfl
| succ k ih => exact ih
theorem add_right_cancel' (a b : Nat) : ∀ c, a + c = b + c → a = b
| 0, h => h
| c + 1, h => add_right_cancel' a b c (Nat.succ.inj h)
theorem half_mul (h t : Nat) (hh : 0 < h) (ht : isOdd t = true) : t * h % (h + h) = h := by
have ⟨s, hs⟩ := odd_form t ht
have e : t * h = h + s * (h + h) := by
rw [hs, Nat.mul_comm (2 * s + 1) h, Nat.left_distrib, Nat.mul_one, Nat.two_mul, Nat.left_distrib,
Nat.left_distrib s h h, Nat.mul_comm h s]
exact Nat.add_comm _ _
rw [e, add_mul_mod' h (h + h) (Nat.lt_of_lt_of_le hh (Nat.le_add_right h h)) s]
exact mod_lt' h (h + h) (Nat.lt_add_of_pos_right hh)
/-- **[h] is balanced in m = h + h.** -/
theorem half_bal (h : Nat) (hh : 0 < h) (hu : (FermatPrime.units (h + h)).all isOdd = true) :
bal (h + h) [h] = true := by
unfold bal
apply all_imp _ _ _ _ hu
intro t ht
show Nat.beq (t * h % (h + h) + 0 + (t * h % (h + h) + 0)) (1 * (h + h)) = true
rw [half_mul h t hh ht, Nat.add_zero, Nat.one_mul]
exact beq_self _
/-- **The rest of a balanced character containing h is balanced.** -/
theorem rest_bal (h : Nat) (hh : 0 < h) (hu : (FermatPrime.units (h + h)).all isOdd = true) (rest : List Nat)
(hb : bal (h + h) (h :: rest) = true) : bal (h + h) rest = true := by
unfold bal at hb ⊢
-- pair each unit's two facts: odd and balanced for h :: rest
have both : (FermatPrime.units (h + h)).all
(fun t => isOdd t && Nat.beq (tsum (h + h) t (h :: rest) + tsum (h + h) t (h :: rest))
((h :: rest).length * (h + h))) = true := by
have z : ∀ l : List Nat, l.all isOdd = true →
l.all (fun t => Nat.beq (tsum (h + h) t (h :: rest) + tsum (h + h) t (h :: rest)) ((h :: rest).length * (h + h))) = true →
l.all (fun t => isOdd t && Nat.beq (tsum (h + h) t (h :: rest) + tsum (h + h) t (h :: rest))
((h :: rest).length * (h + h))) = true := by
intro l; induction l with
| nil => intro _ _; rfl
| cons x l ih =>
intro h1 h2
have h1' : (isOdd x && l.all isOdd) = true := h1
have h2' : (Nat.beq (tsum (h + h) x (h :: rest) + tsum (h + h) x (h :: rest)) ((h :: rest).length * (h + h))
&& l.all _) = true := h2
cases a : isOdd x <;> cases b : Nat.beq (tsum (h + h) x (h :: rest) + tsum (h + h) x (h :: rest))
((h :: rest).length * (h + h)) <;> rw [a] at h1' <;> rw [b] at h2'
· exact Bool.noConfusion h1'
· exact Bool.noConfusion h1'
· exact Bool.noConfusion h2'
· show ((isOdd x && Nat.beq (tsum (h + h) x (h :: rest) + tsum (h + h) x (h :: rest))
((h :: rest).length * (h + h))) && l.all _) = true
rw [a, b, ih h1' h2']; rfl
exact z _ hu hb
apply all_imp _ _ _ _ both
intro t hboth
have hboth' : (isOdd t && Nat.beq (tsum (h + h) t (h :: rest) + tsum (h + h) t (h :: rest))
((h :: rest).length * (h + h))) = true := hboth
cases a : isOdd t with
| false => rw [a] at hboth'; exact Bool.noConfusion hboth'
| true =>
rw [a] at hboth'
have e := Nat.eq_of_beq_eq_true hboth'
have e2 : tsum (h + h) t (h :: rest) = h + tsum (h + h) t rest := by
show t * h % (h + h) + tsum (h + h) t rest = _
rw [half_mul h t hh a]
rw [e2] at e
-- (h + S) + (h + S) = (len + 1)(h + h) = len (h + h) + (h + h)
have e3 : (tsum (h + h) t rest + tsum (h + h) t rest) + (h + h) = rest.length * (h + h) + (h + h) := by
calc (tsum (h + h) t rest + tsum (h + h) t rest) + (h + h)
= (h + tsum (h + h) t rest) + (h + tsum (h + h) t rest) := by
rw [Nat.add_comm (tsum (h + h) t rest + tsum (h + h) t rest) (h + h), Nat.add_assoc, Nat.add_assoc,
Nat.add_left_comm h (tsum (h + h) t rest)]
_ = (rest.length + 1) * (h + h) := e
_ = rest.length * (h + h) + (h + h) := Nat.succ_mul _ _
rw [add_right_cancel' _ _ _ e3]
exact beq_self _
theorem units_odd_100 : (List.range 51).all (fun h => Nat.beq h 0 || (FermatPrime.units (h + h)).all isOdd) = true := rfl
end HalfGeneral
#print axioms HalfGeneral.odd_form
#print axioms HalfGeneral.all_imp
#print axioms HalfGeneral.beq_self
#print axioms HalfGeneral.add_right_cancel'
#print axioms HalfGeneral.half_mul
#print axioms HalfGeneral.half_bal
#print axioms HalfGeneral.rest_bal
#print axioms HalfGeneral.units_odd_100
lean_all/hodge/HalfIff.lean
/-
hodge/HalfIff.lean — T41 cycle 700 (goal G413): the m/2 split is an equivalence, for every even m.
Lean 4 core plus hodge/GcdHand (units_odd, rest_bal_even), hodge/HalfGeneral (half_mul), lib/Semi (lib_nat).
For m = h + h, h > 0, and any list B:
all_and l.all p ∧ l.all q ⇒ l.all (p && q)
half_cons_bal B balanced ⇒ h :: B balanced
half_iff h :: B balanced ⇔ B balanced
So a character through m/2 is Hodge exactly when the rest (of odd length for length-6 characters) is balanced:
the ODD rule of hodge_reach_odd.py (goal G153) adds no new Hodge characters and misses none.
-/
import hodge.GcdHand
import lib.Semi
namespace HalfIff
open Indecomp HalfGeneral GcdHand
theorem all_and {α : Type} (p q : α → Bool) :
∀ l : List α, l.all p = true → l.all q = true → l.all (fun x => p x && q x) = true
| [], _, _ => rfl
| x :: l, h1, h2 => by
have h1' : (p x && l.all p) = true := h1
have h2' : (q x && l.all q) = true := h2
cases a : p x <;> cases b : q x <;> rw [a] at h1' <;> rw [b] at h2'
· exact Bool.noConfusion h1'
· exact Bool.noConfusion h1'
· exact Bool.noConfusion h2'
· show ((p x && q x) && l.all _) = true
rw [a, b, all_and p q l h1' h2']; rfl
theorem half_cons_bal (h : Nat) (hh : 0 < h) (B : List Nat) (hb : bal (h + h) B = true) :
bal (h + h) (h :: B) = true := by
unfold bal at hb ⊢
have both := all_and _ _ _ (units_odd h) hb
apply all_imp _ _ _ _ both
intro t hboth
have hb' : (isOdd t && Nat.beq (tsum (h + h) t B + tsum (h + h) t B) (B.length * (h + h))) = true := hboth
cases a : isOdd t with
| false => rw [a] at hb'; exact Bool.noConfusion hb'
| true =>
rw [a] at hb'
have e := Nat.eq_of_beq_eq_true hb'
show Nat.beq (t * h % (h + h) + tsum (h + h) t B + (t * h % (h + h) + tsum (h + h) t B))
((B.length + 1) * (h + h)) = true
rw [half_mul h t hh a]
have e2 : h + tsum (h + h) t B + (h + tsum (h + h) t B)
= (tsum (h + h) t B + tsum (h + h) t B) + (h + h) := by lib_nat
have e3 : (B.length + 1) * (h + h) = B.length * (h + h) + (h + h) := by lib_nat
rw [e2, e3, e]
exact beq_self _
theorem half_iff (h : Nat) (hh : 0 < h) (B : List Nat) :
bal (h + h) (h :: B) = true ↔ bal (h + h) B = true :=
⟨rest_bal_even h hh B, half_cons_bal h hh B⟩
end HalfIff
#print axioms HalfIff.all_and
#print axioms HalfIff.half_cons_bal
#print axioms HalfIff.half_iff
lean_all/hodge/HalfIndec.lean
/-
hodge/HalfIndec.lean — T41 cycle 857 (goal G566): the q = 2 member of the QFamHalf family for m = 2k,
[a, a + k, k + 2a, 2k − 4a] (0 < a, 2a < k; balanced by QFamHalf), is indecomposable whenever 3a ≠ k and 4a ≠ k
(computation: those are exactly the decomposable cases). By Indec4.
Lean 4 core plus hodge/Indec4, hodge/ThirdIndec (canc), hodge/PairIff (dbl_inj), lib/Semi.
-/
import hodge.Indec4
import hodge.ThirdIndec
namespace HalfIndec
open Indecomp Indec4 BalAppend GcdHand PairIff ThirdIndec
theorem zero_of_sum (a s : Nat) (h : s + a = 0) : a = 0 := by
cases a with
| zero => rfl
| succ a => exact Nat.noConfusion h
theorem half_indec (n k a : Nat) (hm : n + 2 = k + k) (ha0 : 0 < a) (h2 : a + a < k)
(h3 : a + a + a ≠ k) (h4 : a + a + a + a ≠ k) :
indec (n + 2) [a, a + k, k + (a + a), (k + k) - (a + a + a + a)] = true := by
have h4le : a + a + a + a ≤ k + k := by
have := Nat.add_le_add (Nat.le_of_lt h2) (Nat.le_of_lt h2)
rw [show a + a + a + a = (a + a) + (a + a) by lib_nat]; exact this
generalize hz : (k + k) - (a + a + a + a) = z
have hza : z + (a + a + a + a) = k + k := by rw [← hz]; exact sub_add' _ _ h4le
have ha_ne : a ≠ 0 := Nat.ne_of_gt ha0
have hz0 : 0 < z := by
cases z with
| zero =>
rw [Nat.zero_add] at hza
exact absurd hza (Nat.ne_of_lt (by rw [show a + a + a + a = (a + a) + (a + a) by lib_nat]; exact Nat.add_lt_add h2 h2))
| succ z => exact Nat.succ_pos z
have hk : 0 < k := Nat.lt_of_le_of_lt (Nat.zero_le _) h2
have lt_m : ∀ v, v < k → v < n + 2 := fun v hv => by rw [hm]; exact Nat.lt_of_lt_of_le hv (Nat.le_add_right k k)
apply indec4 n
· exact ha0
· exact Nat.lt_of_lt_of_le ha0 (Nat.le_add_right a k)
· exact Nat.lt_of_lt_of_le hk (Nat.le_add_right k _)
· exact hz0
· exact lt_m a (Nat.lt_of_le_of_lt (Nat.le_add_right a a) h2)
· rw [hm, Nat.add_comm a k]; exact Nat.add_lt_add_left (Nat.lt_of_le_of_lt (Nat.le_add_right a a) h2) k
· rw [hm]; exact Nat.add_lt_add_left h2 k
· rw [hm, ← hza]; exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le ha0 (Nat.le_add_left a _))
-- singletons: v + v ≠ k + k
· rw [hm]; intro e; exact Nat.ne_of_lt (Nat.lt_of_le_of_lt (Nat.le_add_right a a) h2) (dbl_inj a k e)
· rw [hm]; intro e
have t : (a + a) + (k + k) = 0 + (k + k) := by rw [show a + a + (k + k) = a + k + (a + k) by lib_nat, e]; lib_nat
exact ha_ne (zero_of_sum a a (canc (k + k) _ _ t))
· rw [hm]; intro e
have t : (a + a + (a + a)) + (k + k) = 0 + (k + k) := by
rw [show a + a + (a + a) + (k + k) = k + (a + a) + (k + (a + a)) by lib_nat, e]; lib_nat
exact ha_ne (zero_of_sum a (a + a + a) (by rw [show a + a + a + a = a + a + (a + a) by lib_nat]; exact canc (k + k) _ _ t))
· rw [hm]; intro e
-- z + z = k + k and z + 4a = k + k ⇒ z = 4a ⇒ 4a + 4a = 2k ⇒ 4a = k
have t : z + z = (a + a + a + a) + z := by rw [e, ← hza]; lib_nat
have zz : z = a + a + a + a := canc z _ _ t
rw [zz] at e
exact h4 (dbl_inj _ _ e)
-- pairs
· rw [hm]; intro e
exact Nat.ne_of_lt h2 (canc k _ _ (by rw [show a + a + k = a + (a + k) by lib_nat, e]))
· rw [hm]; intro e
exact h3 (canc k _ _ (by rw [show a + a + a + k = a + (k + (a + a)) by lib_nat, e]))
· rw [hm]; intro e
-- a + z = z + 4a ⇒ 0 = 3a
have t1 : a + z = z + (a + a + a + a) := e.trans hza.symm
have t2 : 0 + a = (a + a + a) + a := canc z _ _ (by rw [show 0 + a + z = a + z by lib_nat, t1]; lib_nat)
exact ha_ne (zero_of_sum a (a + a) (canc a _ _ t2).symm)
· rw [hm]; intro e
have t : (a + a + a) + (k + k) = 0 + (k + k) := by rw [show a + a + a + (k + k) = a + k + (k + (a + a)) by lib_nat, e]; lib_nat
exact ha_ne (zero_of_sum a (a + a) (canc (k + k) _ _ t))
· rw [hm]; intro e
-- (a + k) + z = z + 4a ⇒ k = 3a
have t : k + (a + z) = (a + a + a) + (a + z) := by rw [show k + (a + z) = a + k + z by lib_nat, e, ← hza]; lib_nat
exact h3 (canc (a + z) _ _ t).symm
· rw [hm]; intro e
-- (k + 2a) + z = z + 4a ⇒ k = 2a
have t : k + (a + a + z) = (a + a) + (a + a + z) := by rw [show k + (a + a + z) = k + (a + a) + z by lib_nat, e, ← hza]; lib_nat
exact Nat.ne_of_lt h2 (canc (a + a + z) _ _ t).symm
end HalfIndec
#print axioms HalfIndec.zero_of_sum
#print axioms HalfIndec.half_indec
lean_all/hodge/HalfIndecIff.lean
/-
hodge/HalfIndecIff.lean — T41 cycle 860 (goal G569): the converse of HalfIndec. For the q = 2 half-twisted
character [a, a + k, k + 2a, 2k − 4a] at m = 2k:
k = 3a ⇒ it splits as {a, 5a} ⊔ {4a, 2a} (two complementary pairs, m = 6a),
k = 4a ⇒ it splits as {4a} ⊔ {a, 5a, 6a} (m/2 and Triple(a), m = 8a),
so indec = false. With HalfIndec: indecomposable ⇔ 3a ≠ k ∧ 4a ≠ k (for 0 < a, 2a < k).
Lean 4 core plus hodge/HalfIndec, hodge/Indec4 (indec4_eq), hodge/PairBal (pair_bal), hodge/GcdHand (half_bal_even),
hodge/Triple (triple_bal), hodge/IndecTriple (and_false').
-/
import hodge.HalfIndec
namespace HalfIndecIff
open Indecomp Indec4 PairBal GcdHand IndecTriple
theorem false_and' (b : Bool) : (false && b) = false := rfl
theorem dec3 (m' a z : Nat) (hm : m' + 1 = (a + a + a) + (a + a + a)) (ha : 0 < a)
(hz : z + (a + a + a + a) = (a + a + a) + (a + a + a)) :
indec (m' + 1) [a, a + (a + a + a), (a + a + a) + (a + a), z] = false := by
have hz0 : 0 < z := by
cases z with
| zero => rw [Nat.zero_add] at hz; exact absurd hz (Nat.ne_of_lt (by
rw [show a + a + a + (a + a + a) = (a + a + a + a) + (a + a) by lib_nat]
exact Nat.lt_add_of_pos_right (Nat.lt_of_lt_of_le ha (Nat.le_add_right a a))))
| succ z => exact Nat.succ_pos z
have p1 : bal (m' + 1) [a + (a + a + a), z] = true :=
pair_bal m' _ _ (by rw [hm, ← hz]; lib_nat) (Nat.lt_of_lt_of_le ha (Nat.le_add_right a _)) hz0
have p2 : bal (m' + 1) [a, (a + a + a) + (a + a)] = true :=
pair_bal m' _ _ (by rw [hm]; lib_nat) ha (by
have t := Nat.le_add_left a (a + a + a + a)
rw [show a + a + a + a + a = a + a + a + (a + a) by lib_nat] at t
exact Nat.lt_of_lt_of_le ha t)
rw [indec4_eq, p1, p2, show (!(true && true)) = false from rfl, false_and']
rw [and_false', and_false', and_false', and_false']
rfl
theorem dec4 (h0 a z : Nat) (hh : h0 + 1 = a + a + a + a) (ha : 0 < a)
(hz : z + (a + a + a + a) = (h0 + 1) + (h0 + 1)) :
indec ((h0 + 1) + (h0 + 1)) [a, a + (a + a + a + a), (a + a + a + a) + (a + a), z] = false := by
have zh : z = h0 + 1 := by
have : z + (h0 + 1) = (h0 + 1) + (h0 + 1) := by rw [hh]; exact hz.trans (by rw [hh])
exact ThirdIndec.canc (h0 + 1) _ _ this
have s1 : bal ((h0 + 1) + (h0 + 1)) [z] = true := by rw [zh]; exact half_bal_even (h0 + 1) (Nat.succ_pos h0)
have t1 : bal ((h0 + 1) + (h0 + 1)) [a, a + (a + a + a + a), (a + a + a + a) + (a + a)] = true := by
have tb := Triple.triple_bal h0 a ha (by
rw [hh]
have t := Nat.le_add_right (a + a) (a + a)
rw [show a + a + (a + a) = a + a + a + a by lib_nat] at t
exact Nat.lt_of_lt_of_le (Nat.lt_add_of_pos_right ha) t)
have e1 : h0 + 1 + a = a + (a + a + a + a) := by rw [hh]; lib_nat
have e2 : h0 + 1 + (h0 + 1) - (a + a) = (a + a + a + a) + (a + a) := by
rw [hh]
have : a + a + a + a + (a + a + a + a) = (a + a + a + a + (a + a)) + (a + a) := by lib_nat
rw [this, ModHand.add_sub']
rw [e1, e2] at tb; exact tb
rw [indec4_eq, s1, t1, show (!(true && true)) = false from rfl, false_and']
rw [and_false', and_false', and_false', and_false', and_false', and_false', and_false']
end HalfIndecIff
#print axioms HalfIndecIff.false_and'
#print axioms HalfIndecIff.dec3
#print axioms HalfIndecIff.dec4
lean_all/hodge/HalfKDec.lean
/-
hodge/HalfKDec.lean — T41 cycle 913 (goal G610): for every q ≥ 2 and a > 0 the μ_q-orbit character at k = 2a,
[a + i·2a (i < q)] ⊔ [q·2a − q·a] at m = 2qa,
is decomposable: it splits as the complementary pair {(2q − 1)a, a} ⊔ the rest (the rest is balanced because the
whole is (QFam.qfam_bal) and the pair is (BalAppend.bal_cancel)). Computation (q = 4, 5, k < 40) shows k = 2a is
among the decomposable cases for every q; this proves it for all q.
Lean 4 core plus hodge/QFam (qfam_bal, gl), hodge/SplitFalse (split_false, mem_left, mem_right, pair_bal'),
hodge/QFamHalf (bal_congr), hodge/BalAppend (bal_cancel, tsum_app).
-/
import hodge.SplitFalse
import hodge.QFamHalf
namespace HalfKDec
open Indecomp PermSum QFam SplitFalse BalAppend QFamHalf
theorem gl_snoc (g : Nat → Nat) : ∀ n, gl g (n + 1) = gl (fun i => g (i + 1)) n ++ [g 0]
| 0 => rfl
| n + 1 => by
show g (n + 1) :: gl g (n + 1) = g (n + 1) :: (gl (fun i => g (i + 1)) n ++ [g 0])
rw [gl_snoc g n]
theorem app_assoc' {α : Type} : ∀ (l1 l2 l3 : List α), (l1 ++ l2) ++ l3 = l1 ++ (l2 ++ l3)
| [], _, _ => rfl
| x :: l1, l2, l3 => by
show x :: ((l1 ++ l2) ++ l3) = x :: (l1 ++ (l2 ++ l3))
rw [app_assoc' l1 l2 l3]
theorem mem_all_right : ∀ l : List Nat, (([] : List Nat), l) ∈ splits l
| [] => mem_nil
| x :: l => mem_right x l [] l (mem_all_right l)
theorem mem_one_mid (y : Nat) (l2 : List Nat) : ∀ l1 : List Nat, ([y], l1 ++ l2) ∈ splits (l1 ++ y :: l2)
| [] => mem_left y l2 [] l2 (mem_all_right l2)
| x :: l1 => mem_right x (l1 ++ y :: l2) [y] (l1 ++ l2) (mem_one_mid y l2 l1)
theorem tsum_mid (m t x y : Nat) (l1 l2 : List Nat) :
tsum m t (x :: (l1 ++ y :: l2)) = tsum m t ([x, y] ++ (l1 ++ l2)) := by
show (t * x) % m + tsum m t (l1 ++ y :: l2) = (t * x) % m + ((t * y) % m + tsum m t (l1 ++ l2))
rw [tsum_app, tsum_app]
show (t * x) % m + (tsum m t l1 + ((t * y) % m + tsum m t l2)) = (t * x) % m + ((t * y) % m + (tsum m t l1 + tsum m t l2))
generalize (t * x) % m = u; generalize (t * y) % m = v; generalize tsum m t l1 = s1; generalize tsum m t l2 = s2
lib_nat
theorem len_mid (x y : Nat) (l1 l2 : List Nat) : (x :: (l1 ++ y :: l2)).length = ([x, y] ++ (l1 ++ l2)).length := by
show (l1 ++ y :: l2).length + 1 = ([x, y] ++ (l1 ++ l2)).length
rw [len_app, len_app, len_app]
show l1.length + (l2.length + 1) + 1 = 2 + (l1.length + l2.length)
lib_nat
/-- **The k = 2a member of every μ_q-orbit family (q ≥ 2) decomposes.** -/
theorem half_k_dec (r a : Nat) (ha : 0 < a) :
indec ((r + 2) * (a + a)) (gl (fun i => a + i * (a + a)) (r + 2) ++ [(r + 2) * (a + a) - (r + 2) * a]) = false := by
have hc := qfam_bal (r + 2) (a + a) a (Nat.succ_pos _) ha (Nat.lt_add_of_pos_right ha)
generalize hL : (r + 2) * (a + a) - (r + 2) * a = L at hc ⊢
have e : gl (fun i => a + i * (a + a)) (r + 2) ++ [L]
= (a + (r + 1) * (a + a)) :: (gl (fun i => a + (i + 1) * (a + a)) r ++ (a + 0 * (a + a)) :: [L]) := by
show (a + (r + 1) * (a + a)) :: gl (fun i => a + i * (a + a)) (r + 1) ++ [L] = _
rw [gl_snoc (fun i => a + i * (a + a)) r]
show (a + (r + 1) * (a + a)) :: ((gl (fun i => a + (i + 1) * (a + a)) r ++ [a + 0 * (a + a)]) ++ [L]) = _
rw [app_assoc']; rfl
rw [e] at hc ⊢
generalize gl (fun i => a + (i + 1) * (a + a)) r = l1 at hc ⊢
have hA : bal ((r + 2) * (a + a)) [a + (r + 1) * (a + a), a + 0 * (a + a)] = true :=
pair_bal' _ _ _ (by lib_nat) (Nat.lt_of_lt_of_le ha (Nat.le_add_right a _)) (Nat.lt_of_lt_of_le ha (Nat.le_add_right a _))
have hAB := bal_congr _ _ _ (fun t => tsum_mid _ t _ _ l1 [L]) (len_mid _ _ l1 [L]) hc
have hB := bal_cancel _ _ _ hA hAB
exact split_false _ _ _ _ (mem_left _ _ _ _ (mem_one_mid _ [L] l1)) (fun h => nomatch h)
(fun h => by cases l1 with
| nil => exact nomatch h
| cons _ _ => exact nomatch h) hA hB
end HalfKDec
#print axioms HalfKDec.gl_snoc
#print axioms HalfKDec.mem_one_mid
#print axioms HalfKDec.tsum_mid
#print axioms HalfKDec.half_k_dec
lean_all/hodge/HalfPair.lean
/-
hodge/HalfPair.lean — T41 (goal G529b, piece: pairing a ↔ p − a), over a commutative ring. For a function f on
0, …, p − 1 (p = 2q + 1) with f(0) = 0 and f(p − a) = −f(a), and weights w with w(p − a) = P − w(a):
sum_shift Σ_{i<m+1} g(i) = g(0) + Σ_{i<m} g(i + 1),
sum_split Σ_{i<n+m} g(i) = Σ_{i<n} g(i) + Σ_{i<m} g(n + i),
sum_rev Σ_{i<m} g(i) = Σ_{j<m} g′(j) when g(i) = g′(j) for i + j + 1 = m,
half_pair Σ_{a<p} w(a) f(a) = Σ_{a<q+1} (2w(a) − P) f(a).
With f = χ odd and w = a this is S = 2T − pH, the first step of S·(χ̄(2) − 2) = p·H (HODGE_LOG cycle 2034).
Lean 4 core plus NSChain (sumN), lib/RingTac.
-/
import NSChain
import lib.RingTac
namespace HalfPair
open DetChain NSChain LibRing
section Gen
variable {R : Type} (K : CRing R)
theorem sum_shift (g : Nat → R) : ∀ m : Nat, sumN K g (m + 1) = K.add (g 0) (sumN K (fun i => g (i + 1)) m)
| 0 => by show K.add K.zero (g 0) = K.add (g 0) K.zero; lib_ring
| m + 1 => by
show K.add (sumN K g (m + 1)) (g (m + 1)) = K.add (g 0) (K.add (sumN K (fun i => g (i + 1)) m) (g (m + 1)))
rw [sum_shift g m]; lib_ring
theorem sum_split (g : Nat → R) (n : Nat) : ∀ m : Nat,
sumN K g (n + m) = K.add (sumN K g n) (sumN K (fun i => g (n + i)) m)
| 0 => by show sumN K g n = K.add (sumN K g n) K.zero; lib_ring
| m + 1 => by
show K.add (sumN K g (n + m)) (g (n + m)) = K.add (sumN K g n) (K.add (sumN K (fun i => g (n + i)) m) (g (n + m)))
rw [sum_split g n m]; lib_ring
theorem sum_rev : ∀ (m : Nat) (g g' : Nat → R), (∀ i j, i + j + 1 = m → g i = g' j) → sumN K g m = sumN K g' m
| 0, _, _, _ => rfl
| m + 1, g, g', h => by
rw [sum_shift K g' m]
have ih := sum_rev m g (fun j => g' (j + 1)) (fun i j hij => h i (j + 1) (congrArg (· + 1) hij))
have h0 : g m = g' 0 := h m 0 rfl
show K.add (sumN K g m) (g m) = K.add (g' 0) (sumN K (fun i => g' (i + 1)) m)
rw [ih, h0]; lib_ring
/-- (q + 1 + i) + (j + 1) = q + q + 1 when i + j + 1 = q -/
theorem nat_pair (q i j : Nat) (h : i + j + 1 = q) : q + 1 + i + (j + 1) = q + q + 1 := by
rw [Nat.add_assoc (q + 1) i (j + 1)]
show q + 1 + (i + j + 1) = q + q + 1
rw [h, Nat.add_right_comm q 1 q]
/-- **Σ_{a<p} w(a) f(a) = Σ_{a<q+1} (2w(a) − P) f(a)** (p = 2q + 1) -/
theorem half_pair (q : Nat) (f w : Nat → R) (P : R) (hf0 : f 0 = K.zero)
(hf : ∀ a b, a + b = q + q + 1 → f b = K.neg (f a))
(hw : ∀ a b, a + b = q + q + 1 → w b = K.add P (K.neg (w a))) :
sumN K (fun a => K.mul (w a) (f a)) (q + 1 + q)
= sumN K (fun a => K.mul (K.add (K.add (w a) (w a)) (K.neg P)) (f a)) (q + 1) := by
rw [sum_split K _ (q + 1) q]
show K.add (sumN K (fun a => K.mul (w a) (f a)) (q + 1)) (sumN K (fun i => K.mul (w (q + 1 + i)) (f (q + 1 + i))) q)
= _
-- reverse the upper half: index q + 1 + i ↔ j + 1 with i + j + 1 = q
have hr := sum_rev K q (fun i => K.mul (w (q + 1 + i)) (f (q + 1 + i)))
(fun j => K.mul (K.add P (K.neg (w (j + 1)))) (K.neg (f (j + 1))))
(fun i j hij => by
have e := nat_pair q i j hij
show K.mul (w (q + 1 + i)) (f (q + 1 + i)) = K.mul (K.add P (K.neg (w (j + 1)))) (K.neg (f (j + 1)))
rw [hw (j + 1) (q + 1 + i) ((Nat.add_comm (j + 1) (q + 1 + i)).trans e),
hf (j + 1) (q + 1 + i) ((Nat.add_comm (j + 1) (q + 1 + i)).trans e)])
rw [hr, sum_shift K _ q, sum_shift K _ q]
show K.add (K.add (K.mul (w 0) (f 0)) (sumN K (fun i => K.mul (w (i + 1)) (f (i + 1))) q))
(sumN K (fun j => K.mul (K.add P (K.neg (w (j + 1)))) (K.neg (f (j + 1)))) q)
= K.add (K.mul (K.add (K.add (w 0) (w 0)) (K.neg P)) (f 0))
(sumN K (fun i => K.mul (K.add (K.add (w (i + 1)) (w (i + 1))) (K.neg P)) (f (i + 1))) q)
rw [hf0]
have e2 : ∀ i, K.add (K.mul (w (i + 1)) (f (i + 1))) (K.mul (K.add P (K.neg (w (i + 1)))) (K.neg (f (i + 1))))
= K.mul (K.add (K.add (w (i + 1)) (w (i + 1))) (K.neg P)) (f (i + 1)) := fun i => by lib_ring
have hs : sumN K (fun i => K.mul (K.add (K.add (w (i + 1)) (w (i + 1))) (K.neg P)) (f (i + 1))) q
= K.add (sumN K (fun i => K.mul (w (i + 1)) (f (i + 1))) q)
(sumN K (fun j => K.mul (K.add P (K.neg (w (j + 1)))) (K.neg (f (j + 1)))) q) := by
rw [← sumN_ext K _ _ e2 q]; exact sumN_add K _ _ q
rw [hs]
lib_ring
end Gen
end HalfPair
#print axioms HalfPair.sum_shift
#print axioms HalfPair.sum_split
#print axioms HalfPair.sum_rev
#print axioms HalfPair.nat_pair
#print axioms HalfPair.half_pair
lean_all/hodge/HalfPair2.lean
/-
hodge/HalfPair2.lean — T41 (goal G529b-q, piece 2): the even/odd rearrangement, over a commutative ring. For f on
0, …, p − 1 (p = 2q + 1) with f(0) = 0, f(p − a) = −f(a), f(2a) = c·f(a), and weights with w(p − a) = P − w(a),
w(2a) = 2w(a):
sum_eo Σ_{b<2m} F(b) = Σ_{a<m} (F(2a) + F(2a + 1)),
even_odd Σ_{b<p} w(b) f(b) = c · Σ_{a<q+1} (4w(a) − P) f(a).
With f = χ odd, c = χ(2), w = a and HalfPair.half_pair (S = 2T − pH): S = c(4T − pH) = c(2S + pH) − cpH + … , i.e.
S·(χ̄(2) − 2) = p·H.
Lean 4 core plus hodge/HalfPair.
-/
import hodge.HalfPair
namespace HalfPair2
open DetChain NSChain LibRing HalfPair
section Gen
variable {R : Type} (K : CRing R)
def ev (w f : Nat → R) (c : R) (a : Nat) : R := K.mul (K.add (w a) (w a)) (K.mul c (f a))
def od (w f : Nat → R) (c P : R) (a : Nat) : R := K.mul (K.add P (K.neg (K.add (w a) (w a)))) (K.neg (K.mul c (f a)))
def tm (w f : Nat → R) (P : R) (a : Nat) : R :=
K.mul (K.add (K.add (K.add (w a) (w a)) (K.add (w a) (w a))) (K.neg P)) (f a)
theorem sum_eo (F : Nat → R) : ∀ m : Nat, sumN K F (2 * m) = sumN K (fun a => K.add (F (2 * a)) (F (2 * a + 1))) m
| 0 => rfl
| m + 1 => by
show K.add (K.add (sumN K F (2 * m)) (F (2 * m))) (F (2 * m + 1))
= K.add (sumN K (fun a => K.add (F (2 * a)) (F (2 * a + 1))) m) (K.add (F (2 * m)) (F (2 * m + 1)))
rw [sum_eo F m]; lib_ring
/-- 2a + 1 + 2(j + 1) = 2q + 1 when a + j + 1 = q -/
theorem nat_eo (q a j : Nat) (h : a + j + 1 = q) : 2 * a + 1 + 2 * (j + 1) = 2 * q + 1 := by
rw [← h]
show 2 * a + 1 + 2 * (j + 1) = 2 * (a + j) + 2 + 1
rw [Nat.left_distrib 2 a j]
exact congrArg (fun x => Nat.succ (Nat.succ x)) (Nat.succ_add (2 * a) (2 * j))
/-- **Σ_{b<2q+1} w(b) f(b) = c Σ_{a<q+1} (4w(a) − P) f(a)** -/
theorem even_odd (q : Nat) (f w : Nat → R) (c P : R) (hf0 : f 0 = K.zero)
(hf : ∀ a b, a + b = 2 * q + 1 → f b = K.neg (f a))
(hw : ∀ a b, a + b = 2 * q + 1 → w b = K.add P (K.neg (w a)))
(h2f : ∀ a, f (2 * a) = K.mul c (f a)) (h2w : ∀ a, w (2 * a) = K.add (w a) (w a)) :
sumN K (fun b => K.mul (w b) (f b)) (2 * q + 1) = K.mul c (sumN K (tm K w f P) (q + 1)) := by
have hsplit : sumN K (fun b => K.mul (w b) (f b)) (2 * q + 1)
= K.add (K.add (sumN K (fun a => K.mul (w (2 * a)) (f (2 * a))) q)
(sumN K (fun a => K.mul (w (2 * a + 1)) (f (2 * a + 1))) q)) (K.mul (w (2 * q)) (f (2 * q))) := by
show K.add (sumN K (fun b => K.mul (w b) (f b)) (2 * q)) (K.mul (w (2 * q)) (f (2 * q))) = _
rw [sum_eo K _ q]
exact congrArg (fun x => K.add x (K.mul (w (2 * q)) (f (2 * q))))
(sumN_add K (fun a => K.mul (w (2 * a)) (f (2 * a))) (fun a => K.mul (w (2 * a + 1)) (f (2 * a + 1))) q)
have hE : ∀ a, K.mul (w (2 * a)) (f (2 * a)) = ev K w f c a := fun a => by
show K.mul (w (2 * a)) (f (2 * a)) = K.mul (K.add (w a) (w a)) (K.mul c (f a))
rw [h2w a, h2f a]
have hO := sum_rev K q (fun a => K.mul (w (2 * a + 1)) (f (2 * a + 1))) (fun j => od K w f c P (j + 1))
(fun a j haj => by
have e := (Nat.add_comm (2 * (j + 1)) (2 * a + 1)).trans (nat_eo q a j haj)
show K.mul (w (2 * a + 1)) (f (2 * a + 1))
= K.mul (K.add P (K.neg (K.add (w (j + 1)) (w (j + 1))))) (K.neg (K.mul c (f (j + 1))))
rw [hw (2 * (j + 1)) (2 * a + 1) e, hf (2 * (j + 1)) (2 * a + 1) e, h2w (j + 1), h2f (j + 1)])
have hG0 : od K w f c P 0 = K.zero := by
show K.mul (K.add P (K.neg (K.add (w 0) (w 0)))) (K.neg (K.mul c (f 0))) = K.zero
rw [hf0]; lib_ring
have hGs := sum_shift K (od K w f c P) q
rw [hG0] at hGs
have hEG : ∀ a, K.add (ev K w f c a) (od K w f c P a) = K.mul c (tm K w f P a) := fun a => by
show K.add (K.mul (K.add (w a) (w a)) (K.mul c (f a)))
(K.mul (K.add P (K.neg (K.add (w a) (w a)))) (K.neg (K.mul c (f a))))
= K.mul c (K.mul (K.add (K.add (K.add (w a) (w a)) (K.add (w a) (w a))) (K.neg P)) (f a))
lib_ring
rw [hsplit, sumN_ext K (fun a => K.mul (w (2 * a)) (f (2 * a))) (ev K w f c) hE q, hO, hE q,
← sumN_mul_left K c (tm K w f P) (q + 1),
← sumN_ext K (fun a => K.add (ev K w f c a) (od K w f c P a)) (fun n => K.mul c (tm K w f P n)) hEG (q + 1),
sumN_add K (ev K w f c) (od K w f c P) (q + 1), hGs]
show K.add (K.add (sumN K (ev K w f c) q) (sumN K (fun j => od K w f c P (j + 1)) q)) (ev K w f c q)
= K.add (K.add (sumN K (ev K w f c) q) (ev K w f c q)) (K.add K.zero (sumN K (fun i => od K w f c P (i + 1)) q))
lib_ring
end Gen
end HalfPair2
#print axioms HalfPair2.sum_eo
#print axioms HalfPair2.nat_eo
#print axioms HalfPair2.even_odd
lean_all/hodge/HalfPair3.lean
/-
hodge/HalfPair3.lean — T41 (goal G529b-q, piece 4): the identity S·(c̄ − 2) = P·H for an odd "character" f on
0, …, p − 1 (p = 2q + 1), over a commutative ring, from HalfPair.half_pair and HalfPair2.even_odd:
combine S = 2T − PH, S = c(4T − PH), c·c̄ = 1 ⇒ S(c̄ − 2) = PH,
sum_lin2 Σ (2w − P) f = 2T − P·H, sum_lin4 Σ (4w − P) f = 4T − P·H,
chi_ident Σ_{b<p} w(b) f(b) · (c̄ − 2) = P · Σ_{a<q+1} f(a).
With f = χ odd (c = χ(2)), w = a, P = p: S·(χ̄(2) − 2) = p·H, so S ≠ 0 ⇔ H ≠ 0.
Lean 4 core plus hodge/HalfPair, hodge/HalfPair2, hodge/SignParity (two_mul').
-/
import hodge.HalfPair
import hodge.HalfPair2
import hodge.SignParity
namespace HalfPair3
open DetChain NSChain LibRing HalfPair HalfPair2
section Gen
variable {R : Type} (K : CRing R)
/-- **S = 2T − PH, S = c(4T − PH), c c̄ = 1 ⇒ S (c̄ − 2) = PH** -/
theorem combine (S T H P c cb : R) (h1 : S = K.add (K.add T T) (K.neg (K.mul P H)))
(h2 : S = K.mul c (K.add (K.add (K.add T T) (K.add T T)) (K.neg (K.mul P H)))) (hc : K.mul c cb = K.one) :
K.mul S (K.add cb (K.neg (K.add K.one K.one))) = K.mul P H := by
have hT : K.add T T = K.add S (K.mul P H) := by rw [h1]; lib_ring
rw [hT] at h2
have key : K.mul S cb = K.add (K.add S S) (K.mul P H) := by
calc K.mul S cb
= K.mul (K.mul c (K.add (K.add (K.add S (K.mul P H)) (K.add S (K.mul P H))) (K.neg (K.mul P H)))) cb :=
congrArg (fun x => K.mul x cb) h2
_ = K.mul (K.mul c cb) (K.add (K.add (K.add S (K.mul P H)) (K.add S (K.mul P H))) (K.neg (K.mul P H))) := by
lib_ring
_ = K.add (K.add S S) (K.mul P H) := by rw [hc]; lib_ring
calc K.mul S (K.add cb (K.neg (K.add K.one K.one))) = K.add (K.mul S cb) (K.neg (K.add S S)) := by lib_ring
_ = K.mul P H := by rw [key]; lib_ring
/-- Σ (2w − P) f = 2T − P·H -/
theorem sum_lin2 (f w : Nat → R) (P : R) (n : Nat) :
sumN K (fun a => K.mul (K.add (K.add (w a) (w a)) (K.neg P)) (f a)) n
= K.add (K.add (sumN K (fun a => K.mul (w a) (f a)) n) (sumN K (fun a => K.mul (w a) (f a)) n))
(K.neg (K.mul P (sumN K f n))) := by
have e : ∀ a, K.mul (K.add (K.add (w a) (w a)) (K.neg P)) (f a)
= K.add (K.add (K.mul (w a) (f a)) (K.mul (w a) (f a))) (K.neg (K.mul P (f a))) := fun a => by lib_ring
rw [sumN_ext K _ _ e n, sumN_add K, sumN_add K, sumN_neg K, sumN_mul_left K]
/-- Σ (4w − P) f = 4T − P·H -/
theorem sum_lin4 (f w : Nat → R) (P : R) (n : Nat) :
sumN K (tm K w f P) n
= K.add (K.add (K.add (sumN K (fun a => K.mul (w a) (f a)) n) (sumN K (fun a => K.mul (w a) (f a)) n))
(K.add (sumN K (fun a => K.mul (w a) (f a)) n) (sumN K (fun a => K.mul (w a) (f a)) n)))
(K.neg (K.mul P (sumN K f n))) := by
have e : ∀ a, tm K w f P a
= K.add (K.add (K.add (K.mul (w a) (f a)) (K.mul (w a) (f a))) (K.add (K.mul (w a) (f a)) (K.mul (w a) (f a))))
(K.neg (K.mul P (f a))) := fun a => by
show K.mul (K.add (K.add (K.add (w a) (w a)) (K.add (w a) (w a))) (K.neg P)) (f a) = _
lib_ring
rw [sumN_ext K _ _ e n, sumN_add K, sumN_add K, sumN_add K, sumN_neg K, sumN_mul_left K]
theorem nat_q (q : Nat) : q + 1 + q = 2 * q + 1 := by
rw [Nat.add_right_comm q 1 q, SignParity.two_mul' q]
/-- **S·(c̄ − 2) = P·H** -/
theorem chi_ident (q : Nat) (f w : Nat → R) (c cb P : R) (hc : K.mul c cb = K.one) (hf0 : f 0 = K.zero)
(hf : ∀ a b, a + b = 2 * q + 1 → f b = K.neg (f a))
(hw : ∀ a b, a + b = 2 * q + 1 → w b = K.add P (K.neg (w a)))
(h2f : ∀ a, f (2 * a) = K.mul c (f a)) (h2w : ∀ a, w (2 * a) = K.add (w a) (w a)) :
K.mul (sumN K (fun b => K.mul (w b) (f b)) (2 * q + 1)) (K.add cb (K.neg (K.add K.one K.one)))
= K.mul P (sumN K f (q + 1)) := by
have hqq : q + q + 1 = 2 * q + 1 := congrArg (· + 1) (SignParity.two_mul' q)
have h1 := half_pair K q f w P hf0 (fun a b h => hf a b (h.trans hqq)) (fun a b h => hw a b (h.trans hqq))
rw [nat_q q, sum_lin2 K f w P (q + 1)] at h1
have h2 := even_odd K q f w c P hf0 hf hw h2f h2w
rw [sum_lin4 K f w P (q + 1)] at h2
exact combine K _ _ _ P c cb h1 h2 hc
end Gen
end HalfPair3
#print axioms HalfPair3.combine
#print axioms HalfPair3.sum_lin2
#print axioms HalfPair3.sum_lin4
#print axioms HalfPair3.nat_q
#print axioms HalfPair3.chi_ident
lean_all/hodge/HalfPair4.lean
/-
hodge/HalfPair4.lean — T41 (goal G529b-q, piece 5): the half sum of an odd number of signs is nonzero, and with
HalfPair3.chi_ident the full weighted sum is nonzero, over a commutative ring whose natural numbers are distinct
(castN injective) and without zero divisors:
sign_count f(0) = 0 and f(a) = ±1 for 1 ≤ a ≤ j ⇒ Σ_{a<j+1} f(a) = m − m′ with m + m′ = j,
half_ne q odd ⇒ Σ_{a<q+1} f(a) ≠ 0,
weighted_ne S·(c̄ − 2) = P·H, P ≠ 0, H ≠ 0 ⇒ S ≠ 0.
For the quadratic character mod p ≡ 3 (mod 4) (q = (p − 1)/2 odd): Σ_a a·(a/p) ≠ 0, i.e. B_{1,χ} ≠ 0.
Lean 4 core plus hodge/SignParity, NSChain, lib/RingTac.
-/
import hodge.SignParity
import NSChain
import lib.RingTac
namespace HalfPair4
open DetChain NSChain LibRing
section Gen
variable {R : Type} (K : CRing R)
/-- **Σ_{a<j+1} f(a) = m − m′ with m + m′ = j** -/
theorem sign_count (f : Nat → R) (hf0 : f 0 = K.zero) (q : Nat)
(hs : ∀ a, 1 ≤ a → a ≤ q → f a = K.one ∨ f a = K.neg K.one) :
∀ j, j ≤ q → ∃ m m' : Nat, m + m' = j ∧ sumN K f (j + 1) = K.add (castN K m) (K.neg (castN K m'))
| 0, _ => ⟨0, 0, rfl, by
show K.add K.zero (f 0) = K.add K.zero (K.neg K.zero)
rw [hf0]; lib_ring⟩
| j + 1, hj => by
have ⟨m, m', hmm, hS⟩ := sign_count f hf0 q hs j (Nat.le_of_succ_le hj)
have hS' : sumN K f (j + 1 + 1) = K.add (sumN K f (j + 1)) (f (j + 1)) := rfl
cases hs (j + 1) (Nat.succ_le_succ (Nat.zero_le j)) hj with
| inl h =>
refine ⟨m + 1, m', ?_, ?_⟩
· rw [Nat.add_right_comm, hmm]
· rw [hS', hS, h]
show K.add (K.add (castN K m) (K.neg (castN K m'))) K.one
= K.add (K.add K.one (castN K m)) (K.neg (castN K m'))
lib_ring
| inr h =>
refine ⟨m, m' + 1, ?_, ?_⟩
· show m + m' + 1 = j + 1
rw [hmm]
· rw [hS', hS, h]
show K.add (K.add (castN K m) (K.neg (castN K m'))) (K.neg K.one)
= K.add (castN K m) (K.neg (K.add K.one (castN K m')))
lib_ring
/-- x − y = 0 ⇒ x = y -/
theorem eq_of_sub (x y : R) (h : K.add x (K.neg y) = K.zero) : x = y := by
calc x = K.add (K.add x (K.neg y)) y := by lib_ring
_ = K.add K.zero y := by rw [h]
_ = y := by lib_ring
/-- **an odd number of signs does not sum to zero** -/
theorem half_ne (f : Nat → R) (hf0 : f 0 = K.zero) (k : Nat)
(hs : ∀ a, 1 ≤ a → a ≤ 2 * k + 1 → f a = K.one ∨ f a = K.neg K.one)
(hinj : ∀ a b : Nat, castN K a = castN K b → a = b) : sumN K f (2 * k + 1 + 1) ≠ K.zero := by
intro h0
have ⟨m, m', hmm, hS⟩ := sign_count K f hf0 (2 * k + 1) hs (2 * k + 1) (Nat.le_refl _)
rw [hS] at h0
have e := hinj m m' (eq_of_sub K _ _ h0)
rw [e, SignParity.two_mul'] at hmm
exact TorsionImage.odd_ne_even k m' hmm.symm
/-- **S(c̄ − 2) = PH, P ≠ 0, H ≠ 0 ⇒ S ≠ 0** -/
theorem weighted_ne (S P H d : R) (hid : K.mul S d = K.mul P H)
(hdom : ∀ x y : R, K.mul x y = K.zero → x = K.zero ∨ y = K.zero) (hP : P ≠ K.zero) (hH : H ≠ K.zero) :
S ≠ K.zero := by
intro hS
have z : K.mul P H = K.zero := by
rw [← hid, hS]; lib_ring
cases hdom P H z with
| inl h => exact hP h
| inr h => exact hH h
end Gen
end HalfPair4
#print axioms HalfPair4.sign_count
#print axioms HalfPair4.eq_of_sub
#print axioms HalfPair4.half_ne
#print axioms HalfPair4.weighted_ne
lean_all/hodge/HalfSplit.lean
/- hodge/HalfSplit.lean — T41 cycle 189: the reducible unreached characters at m = 36, 48, 54, 70, 72, 78 are m/2 plus an indecomposable balanced 5-list. Lean 4 core plus hodge/Indecomp (bal, indec), rfl. The 68 rows below are all the unreached characters of length 6 at m = 36 (12), 48 (8), 54 (18), 70 (6), 72 (12), 78 (12) that have a balanced splitting (OrbitDecomp, OrbitDecomp2: 96 − 84, 100 − 92, 360 − 342, 60 − 54, 384 − 372, 804 − 792). For each: m/2 is an entry, the other five entries form a balanced list, and that 5-list has no balanced splitting — as at m = 62 (Reduce62). The singleton m/2 is balanced for every even m. -/ import hodge.Indecomp namespace HalfSplit open Indecomp def rest (m : Nat) (c : List Nat) : List Nat := c.filter (fun a => !(Nat.beq a (m / 2))) def red : List (Nat × List Nat) := [(36, [1, 5, 18, 25, 27, 32]), (36, [1, 5, 18, 27, 28, 29]), (36, [1, 13, 18, 20, 27, 29]), (36, [4, 9, 11, 18, 31, 35]), (36, [4, 13, 17, 18, 27, 29]), (36, [5, 16, 17, 18, 25, 27]), (36, [7, 8, 9, 18, 31, 35]), (36, [7, 9, 16, 18, 23, 35]), (36, [7, 9, 18, 19, 23, 32]), (36, [8, 13, 17, 18, 25, 27]), (36, [9, 11, 18, 19, 20, 31]), (36, [9, 11, 18, 19, 23, 28]), (48, [1, 17, 24, 27, 36, 39]), (48, [3, 5, 24, 36, 37, 39]), (48, [3, 15, 24, 25, 36, 41]), (48, [7, 12, 23, 24, 33, 45]), (48, [9, 11, 12, 24, 43, 45]), (48, [9, 12, 21, 24, 31, 47]), (48, [12, 19, 21, 24, 33, 35]), (48, [13, 15, 24, 27, 29, 36]), (54, [1, 7, 27, 38, 41, 48]), (54, [1, 22, 27, 29, 41, 42]), (54, [1, 27, 29, 30, 31, 44]), (54, [2, 5, 27, 37, 43, 48]), (54, [4, 5, 27, 37, 42, 47]), (54, [5, 24, 27, 28, 35, 43]), (54, [6, 11, 17, 27, 49, 52]), (54, [6, 13, 16, 27, 47, 53]), (54, [6, 27, 29, 31, 34, 35]), (54, [7, 12, 17, 27, 49, 50]), (54, [7, 17, 24, 27, 41, 46]), (54, [8, 13, 27, 30, 37, 47]), (54, [10, 23, 24, 25, 27, 53]), (54, [11, 19, 23, 27, 40, 42]), (54, [11, 19, 26, 27, 30, 49]), (54, [12, 13, 25, 27, 32, 53]), (54, [12, 14, 27, 31, 35, 43]), (54, [19, 20, 23, 25, 27, 48]), (70, [1, 29, 35, 43, 45, 57]), (70, [3, 17, 31, 35, 59, 65]), (70, [5, 11, 35, 39, 53, 67]), (70, [9, 23, 35, 37, 51, 55]), (70, [13, 25, 27, 35, 41, 69]), (70, [15, 19, 33, 35, 47, 61]), (72, [2, 10, 36, 50, 54, 64]), (72, [2, 10, 36, 54, 56, 58]), (72, [2, 26, 36, 40, 54, 58]), (72, [8, 18, 22, 36, 62, 70]), (72, [8, 26, 34, 36, 54, 58]), (72, [10, 32, 34, 36, 50, 54]), (72, [14, 16, 18, 36, 62, 70]), (72, [14, 18, 32, 36, 46, 70]), (72, [14, 18, 36, 38, 46, 64]), (72, [16, 26, 34, 36, 50, 54]), (72, [18, 22, 36, 38, 40, 62]), (72, [18, 22, 36, 38, 46, 56]), (78, [1, 39, 42, 45, 53, 54]), (78, [3, 7, 39, 59, 60, 66]), (78, [5, 31, 36, 39, 54, 69]), (78, [6, 29, 39, 48, 55, 57]), (78, [6, 30, 39, 41, 51, 67]), (78, [9, 24, 39, 42, 47, 73]), (78, [11, 27, 37, 39, 48, 72]), (78, [12, 17, 39, 43, 60, 63]), (78, [12, 18, 19, 39, 71, 75]), (78, [15, 18, 35, 39, 61, 66]), (78, [21, 23, 30, 39, 49, 72]), (78, [24, 25, 33, 36, 39, 77])] set_option maxRecDepth 100000 in theorem has_half : red.all (fun (m, c) => c.any (fun a => Nat.beq a (m / 2)) && Nat.beq (rest m c).length 5) = true := rfl set_option maxRecDepth 100000 in theorem half_bal : red.all (fun (m, _) => bal m [m / 2]) = true := rfl set_option maxRecDepth 100000 in theorem rest_bal : red.all (fun (m, c) => bal m (rest m c)) = true := rfl set_option maxRecDepth 100000 in theorem rest_indec : red.all (fun (m, c) => indec m (rest m c)) = true := rfl set_option maxRecDepth 100000 in theorem reducible : red.all (fun (m, c) => !(indec m c)) = true := rfl end HalfSplit #print axioms HalfSplit.has_half #print axioms HalfSplit.half_bal #print axioms HalfSplit.rest_bal #print axioms HalfSplit.rest_indec #print axioms HalfSplit.reducible
lean_all/hodge/HalfUnits.lean
/-
hodge/HalfUnits.lean — T41 cycle 723 (goal G436): balance can be checked on the units t with 2t ≤ m only,
every m.
Lean 4 core plus hodge/UnitSym (unit_sym), hodge/UnitMul (gcd_dvd, one_of_dvd_one), hodge/APPair1 (dvd_gcd),
hodge/TwistBal (all_fr_elim, all_fr_intro), hodge/GcdHand (sub_add'), hodge/ModHand (add_sub').
dvd_of_add x + g·i = g·j ⇒ g ∣ x
gcd_sub gcd t m = 1, t ≤ m ⇒ gcd (m − t) m = 1
balH the balance test restricted to units t with 2t ≤ m
bal_half balH m c ⇒ bal m c (entries of c in (0, m))
-/
import hodge.UnitSym
namespace HalfUnits
open FTAChain Indecomp HalfGeneral BalAppend PairBal GcdHand ModHand TwistBal UnitSym UnitMul
theorem dvd_of_add (g : Nat) : ∀ (i j x : Nat), x + g * i = g * j → ∃ c, x = g * c
| 0, j, x, h => ⟨j, h⟩
| i + 1, 0, x, h => by
have e : x + g * (i + 1) = (x + g * i) + g := by lib_nat
rw [e] at h
have h0 : (x + g * i) + g = 0 := h
cases g with
| zero =>
have h1 : x + 0 * i = 0 := h0
rw [Nat.zero_mul] at h1
exact ⟨0, h1⟩
| succ g => exact Nat.noConfusion h0
| i + 1, j + 1, x, h => by
have e : x + g * (i + 1) = (x + g * i) + g := by lib_nat
have e2 : g * (j + 1) = g * j + g := rfl
rw [e, e2, Nat.add_comm (x + g * i), Nat.add_comm (g * j)] at h
exact dvd_of_add g i j x (add_cancel g _ _ h)
theorem gcd_sub (t m : Nat) (ht : Nat.gcd t m = 1) (hle : t ≤ m) : Nat.gcd (m - t) m = 1 := by
have ⟨⟨i, hi⟩, ⟨j, hj⟩⟩ := gcd_dvd (m - t) m
generalize Nat.gcd (m - t) m = g at hi hj ⊢
have hs : t + (m - t) = m := by rw [Nat.add_comm]; exact sub_add' t m hle
have ht' : ∃ c, t = g * c := by
apply dvd_of_add g i j t
rw [← hi, ← hj]; exact hs
have ⟨c, hc⟩ := APPair1.dvd_gcd g t m ht' ⟨j, hj⟩
rw [ht] at hc
exact one_of_dvd_one g c hc
theorem sub_sub' (m t : Nat) (h : t ≤ m) : m - (m - t) = t := by
have e : m = (m - t) + t := (sub_add' t m h).symm
have e2 : m - (m - t) = ((m - t) + t) - (m - t) := by rw [← e]
rw [e2, Nat.add_comm, add_sub']
def balH (m : Nat) (A : List Nat) : Bool :=
((List.range m).filter (fun t => Nat.beq (Nat.gcd t m) 1 && Nat.ble (t + t) m)).all
(fun t => Nat.beq (tsum m t A + tsum m t A) (A.length * m))
theorem bal_half (m' : Nat) (c : List Nat) (hc : ∀ x, x ∈ c → 0 < x ∧ x < m' + 1)
(hb : balH (m' + 1) c = true) : bal (m' + 1) c = true := by
unfold bal FermatPrime.units
apply all_fr_intro
intro t htm hp
have hg : Nat.gcd t (m' + 1) = 1 := Nat.eq_of_beq_eq_true hp
cases hl : Nat.ble (t + t) (m' + 1) with
| true =>
exact all_fr_elim _ _ (m' + 1) hb t htm (by rw [hp, hl]; rfl)
| false =>
have nle : ¬ (t + t ≤ m' + 1) := fun q => by rw [Nat.ble_eq_true_of_le q] at hl; exact Bool.noConfusion hl
have hle : t ≤ m' + 1 := Nat.le_of_lt htm
have hs : (m' + 1 - t) + t = m' + 1 := sub_add' t (m' + 1) hle
generalize ht' : m' + 1 - t = u at hs
have hlt : u < t := by
cases Nat.lt_or_ge u t with
| inl q => exact q
| inr q => exact absurd (by rw [← hs]; exact Nat.add_le_add_right q t) nle
have huu : u + u ≤ m' + 1 := by rw [← hs]; exact Nat.add_le_add_left (Nat.le_of_lt hlt) u
have hum : u < m' + 1 := Nat.lt_of_lt_of_le hlt hle
have hgu : Nat.gcd u (m' + 1) = 1 := by rw [← ht']; exact gcd_sub t (m' + 1) hg hle
have hbu := Nat.eq_of_beq_eq_true (all_fr_elim _ _ (m' + 1) hb u hum
(by show (Nat.beq (Nat.gcd u (m' + 1)) 1 && Nat.ble (u + u) (m' + 1)) = true
rw [hgu, Nat.ble_eq_true_of_le huu]; rfl))
have hsym := (unit_sym m' u hgu hum c hc).1 hbu
have hmu : m' + 1 - u = t := by rw [← ht']; exact sub_sub' (m' + 1) t hle
rw [hmu] at hsym
rw [hsym]; exact beq_self _
end HalfUnits
#print axioms HalfUnits.dvd_of_add
#print axioms HalfUnits.gcd_sub
#print axioms HalfUnits.sub_sub'
#print axioms HalfUnits.bal_half
lean_all/hodge/HalfUnitsIff.lean
/-
hodge/HalfUnitsIff.lean — T41 cycle 726 (goal G439): balance ⇔ the half-unit test, and the half test in use.
Lean 4 core plus hodge/HalfUnits (balH, bal_half), hodge/TwistBal (all_fr_elim, all_fr_intro).
balH_of_bal bal m c ⇒ balH m c
bal_iff_balH entries in (0, m): bal m c ⇔ balH m c
ex96 the m = 96 character [1, 25, 49, 73, 46, 94] (APPair2) by the half test (rfl) and bal_half
-/
import hodge.HalfUnits
namespace HalfUnitsIff
open Indecomp HalfGeneral TwistBal HalfUnits
theorem balH_of_bal (m : Nat) (c : List Nat) (hb : bal m c = true) : balH m c = true := by
unfold bal FermatPrime.units at hb
unfold balH
apply all_fr_intro
intro t ht hp
have hp' : (Nat.beq (Nat.gcd t m) 1 && Nat.ble (t + t) m) = true := hp
cases q : Nat.beq (Nat.gcd t m) 1 with
| false => rw [q] at hp'; exact Bool.noConfusion hp'
| true => exact all_fr_elim _ _ m hb t ht q
theorem bal_iff_balH (m' : Nat) (c : List Nat) (hc : ∀ x, x ∈ c → 0 < x ∧ x < m' + 1) :
bal (m' + 1) c = true ↔ balH (m' + 1) c = true :=
⟨balH_of_bal _ c, bal_half m' c hc⟩
theorem mem_range (c : List Nat) (m' : Nat) (h : c.all (fun x => Nat.ble 1 x && Nat.ble (x + 1) (m' + 1)) = true) :
∀ x, x ∈ c → 0 < x ∧ x < m' + 1 := by
intro x hx
induction c with
| nil => cases hx
| cons y l ih =>
have h' : ((Nat.ble 1 y && Nat.ble (y + 1) (m' + 1)) && l.all _) = true := h
cases a : (Nat.ble 1 y && Nat.ble (y + 1) (m' + 1)) with
| false => rw [a] at h'; exact Bool.noConfusion h'
| true =>
rw [a] at h'
cases hx with
| head =>
cases b : Nat.ble 1 x with
| false => rw [b] at a; exact Bool.noConfusion a
| true =>
rw [b] at a
exact ⟨Nat.le_of_ble_eq_true b, Nat.le_of_ble_eq_true a⟩
| tail _ hx' => exact ih h' hx'
theorem ex96 : bal 96 [1, 25, 49, 73, 46, 94] = true :=
bal_half 95 _ (mem_range _ 95 rfl) rfl
end HalfUnitsIff
#print axioms HalfUnitsIff.balH_of_bal
#print axioms HalfUnitsIff.bal_iff_balH
#print axioms HalfUnitsIff.mem_range
#print axioms HalfUnitsIff.ex96
lean_all/hodge/HodgeCounts.lean
/-
hodge/HodgeCounts.lean — T41 cycle 39: Shioda's condition depends only on the count vector, and the
converse "symmetric counts ⇒ Hodge" for every m.
Lean 4 core plus hodge/HodgeIff.
hodge_of_counts equal counts (entries in 1..M) ⇒ same Hodge status
cnt_pairsList #v in pairsList m l = #v in l + #(m − v) in l (for 0 < v < m, entries of l in 1..m−1)
sym_hodge symmetric counts ⇒ Hodge (odd m, t·b ≢ 0 for units t), through the explicit
list pairsList m (lows m a), which has the same counts as a (counts_match).
With FermatFull/FermatPrimes2 (Hodge ⇒ symmetric): for every prime m ≤ 47 and every n,
Hodge character ⟺ symmetric count vector ⟺ sum of classes of linear subspaces (Ran).
-/
import hodge.HodgeIff
import bsd.Congruent2pF
namespace HodgeCounts
open FTAChain FrobChain QRChain ESChain FermatPrime FermatFull HodgeChain HodgeIff
theorem hodge_of_counts (m M : Nat) (a b : List Nat) (ha : AllIn M a) (hb : AllIn M b)
(hc : ∀ v, cnt v a = cnt v b) (h : HodgeList m a) : HodgeList m b := by
intro t ht
have e := h t ht
rw [regroup M _ a ha, regroup M _ a ha] at e
rw [regroup M _ b hb, regroup M _ b hb]
have l : sumTo M (fun c => cnt (c + 1) b * (2 * (t * (c + 1) % m)))
= sumTo M (fun c => cnt (c + 1) a * (2 * (t * (c + 1) % m))) :=
sum_ext _ _ _ (fun c _ => by rw [hc (c + 1)])
have r : sumTo M (fun c => cnt (c + 1) b * m) = sumTo M (fun c => cnt (c + 1) a * m) :=
sum_ext _ _ _ (fun c _ => by rw [hc (c + 1)])
rw [l, r]
exact e
def lows (m : Nat) : List Nat → List Nat
| [] => []
| x :: l => cond (Nat.blt (x + x) m) (x :: lows m l) (lows m l)
def cntNeg (m v : Nat) : List Nat → Nat
| [] => 0
| x :: l => ind (m - x) 1 v + cntNeg m v l
theorem cnt_cons (v x : Nat) (l : List Nat) : cnt v (x :: l) = ind x 1 v + cnt v l := rfl
theorem cnt_append (v : Nat) : ∀ a b : List Nat, cnt v (a ++ b) = cnt v a + cnt v b
| [], b => (Nat.zero_add _).symm
| x :: a, b => by
show ind x 1 v + cnt v (a ++ b) = ind x 1 v + cnt v a + cnt v b
rw [cnt_append v a b, nadd_assoc]
theorem cnt_pairsList (m v : Nat) : ∀ l : List Nat, cnt v (pairsList m l) = cnt v l + cntNeg m v l
| [] => rfl
| x :: l => by
show cnt v ([x, m - x] ++ pairsList m l) = ind x 1 v + cnt v l + (ind (m - x) 1 v + cntNeg m v l)
rw [cnt_append, cnt_pairsList m v l]
show ind x 1 v + (ind (m - x) 1 v + 0) + (cnt v l + cntNeg m v l)
= ind x 1 v + cnt v l + (ind (m - x) 1 v + cntNeg m v l)
rw [Nat.add_zero, Congruent2pF.nmid4]
theorem ind_eq (x v : Nat) (h : v = x) : ind x 1 v = 1 := by unfold ind; exact ite_eq_left h
theorem ind_ne (x v : Nat) (h : ¬ v = x) : ind x 1 v = 0 := by unfold ind; exact ite_eq_right h
/-- #v in lows m l: all of #v l if 2v < m, none otherwise. -/
theorem cnt_lows (m v : Nat) : ∀ l : List Nat,
cnt v (lows m l) = cond (Nat.blt (v + v) m) (cnt v l) 0
| [] => by cases Nat.blt (v + v) m <;> rfl
| x :: l => by
have ih := cnt_lows m v l
unfold lows
cases hx : Nat.blt (x + x) m with
| true =>
show ind x 1 v + cnt v (lows m l) = cond (Nat.blt (v + v) m) (ind x 1 v + cnt v l) 0
rw [ih]
cases Nat.decEq v x with
| isTrue e => rw [e, hx, ind_eq x x rfl]; rfl
| isFalse ne =>
rw [ind_ne x v ne, Nat.zero_add, Nat.zero_add]
| false =>
show cnt v (lows m l) = cond (Nat.blt (v + v) m) (ind x 1 v + cnt v l) 0
rw [ih]
cases Nat.decEq v x with
| isTrue e => rw [e, hx]; rfl
| isFalse ne => rw [ind_ne x v ne, Nat.zero_add]
/-- For x, v ≤ m: m − x = v ⟺ x = m − v. -/
theorem sub_swap (m x v : Nat) (hx : x ≤ m) (hv : v ≤ m) : (v = m - x) ↔ (m - v = x) := by
constructor
· intro e
have h1 := add_sub_of_le' x m hx
rw [← e] at h1
have h2 := add_sub_of_le' v m hv
exact add_left_cancel' v _ _ (h2.trans (h1.symm.trans (nadd_comm x v)))
· intro e
have h2 := add_sub_of_le' v m hv
rw [e] at h2
have h1 := add_sub_of_le' x m hx
exact add_left_cancel' x _ _ ((nadd_comm x v).trans (h2.trans h1.symm))
theorem cntNeg_eq (m v : Nat) (hv : v ≤ m) : ∀ l : List Nat, AllIn (m - 1) l → cntNeg m v l = cnt (m - v) l
| [], _ => rfl
| x :: l, h => by
show ind (m - x) 1 v + cntNeg m v l = ind x 1 (m - v) + cnt (m - v) l
have hxm : x ≤ m := Nat.le_trans h.1.2 (Nat.sub_le m 1)
rw [cntNeg_eq m v hv l h.2]
congr 1
cases Nat.decEq v (m - x) with
| isTrue e => rw [ind_eq _ _ e, ind_eq _ _ ((sub_swap m x v hxm hv).mp e)]
| isFalse ne => rw [ind_ne _ _ ne, ind_ne _ _ (fun e' => ne ((sub_swap m x v hxm hv).mpr e'))]
theorem cnt_out (M v : Nat) : ∀ l : List Nat, AllIn M l → (v = 0 ∨ M < v) → cnt v l = 0
| [], _, _ => rfl
| x :: l, h, hv => by
show ind x 1 v + cnt v l = 0
rw [cnt_out M v l h.2 hv]
apply ind_ne
intro e
rw [e] at hv
cases hv with
| inl z => rw [z] at h; exact absurd h.1.1 (Nat.lt_irrefl 0)
| inr g => exact absurd (Nat.lt_of_lt_of_le g h.1.2) (Nat.lt_irrefl _)
theorem allIn_lows (M m : Nat) : ∀ l : List Nat, AllIn M l → AllIn M (lows m l)
| [], _ => trivial
| x :: l, h => by
unfold lows
cases Nat.blt (x + x) m with
| true => exact ⟨h.1, allIn_lows M m l h.2⟩
| false => exact allIn_lows M m l h.2
theorem allIn_append (M : Nat) : ∀ a b : List Nat, AllIn M a → AllIn M b → AllIn M (a ++ b)
| [], _, _, hb => hb
| _ :: a, b, ha, hb => ⟨ha.1, allIn_append M a b ha.2 hb⟩
theorem allIn_pairs (m' : Nat) : ∀ l : List Nat, AllIn m' l → AllIn m' (pairsList (m' + 1) l)
| [], _ => trivial
| x :: l, h => by
apply allIn_append m' [x, m' + 1 - x] _ _ (allIn_pairs m' l h.2)
refine ⟨h.1, ⟨?_, ?_⟩, trivial⟩
· -- 0 < m' + 1 − x since x ≤ m'
have e := add_sub_of_le' x (m' + 1) (Nat.le_succ_of_le h.1.2)
cases hz : m' + 1 - x with
| zero => rw [hz, Nat.add_zero] at e; rw [e] at h; exact absurd h.1.2 (Nat.lt_irrefl _)
| succ k => exact Nat.zero_lt_succ k
· -- m' + 1 − x ≤ m' since x ≥ 1
have e := add_sub_of_le' x (m' + 1) (Nat.le_succ_of_le h.1.2)
apply Nat.le_of_lt_succ
apply Nat.lt_of_add_lt_add_left (n := x)
rw [e]
show m' + 1 < x + (m' + 1)
rw [nadd_comm x]
exact Nat.lt_add_of_pos_right h.1.1
theorem allIn_mem (M : Nat) : ∀ l : List Nat, AllIn M l → ∀ b, b ∈ l → 0 < b ∧ b ≤ M
| [], _, _, hb => by cases hb
| x :: l, h, b, hb => by
cases hb with
| head => exact h.1
| tail _ hb => exact allIn_mem M l h.2 b hb
theorem lt_of_blt {a b : Nat} (h : Nat.blt a b = true) : a < b := Nat.le_of_ble_eq_true h
/-- counts of the explicit pair list agree with a (symmetric counts, odd m). -/
theorem counts_match (m' : Nat) (a : List Nat) (hin : AllIn m' a)
(hsym : ∀ v, 0 < v → v ≤ m' → cnt v a = cnt (m' + 1 - v) a) (hodd : ∀ v, v + v ≠ m' + 1) (v : Nat)
(h0 : 0 < v) (hv : v ≤ m') :
cnt v (pairsList (m' + 1) (lows (m' + 1) a)) = cnt v a := by
have hl := allIn_lows m' (m' + 1) a hin
rw [cnt_pairsList, cntNeg_eq (m' + 1) v (Nat.le_succ_of_le hv) _ hl, cnt_lows, cnt_lows]
have hw := add_sub_of_le' v (m' + 1) (Nat.le_succ_of_le hv)
generalize hW : m' + 1 - v = w at hw
-- hw : v + w = m' + 1
cases hb : Nat.blt (v + v) (m' + 1) with
| true =>
have lt := lt_of_blt hb
cases hb' : Nat.blt (w + w) (m' + 1) with
| false => rfl
| true =>
have lt' := lt_of_blt hb'
-- v + v < v + w and w + w < v + w impossible together
have a1 : v < w := Nat.lt_of_add_lt_add_left (n := v) (hw ▸ lt)
have a2 : w < v := Nat.lt_of_add_lt_add_left (n := w) (by rw [nadd_comm w v, hw]; exact lt')
exact absurd (Nat.lt_trans a1 a2) (Nat.lt_irrefl v)
| false =>
cases hb' : Nat.blt (w + w) (m' + 1) with
| false =>
-- v + v ≥ m'+1 and w + w ≥ m'+1 with v + w = m'+1 ⇒ v = w ⇒ v + v = m' + 1
exfalso
have nv : ¬ (v + v < m' + 1) := fun h => by rw [show Nat.blt (v + v) (m' + 1) = true from Nat.ble_eq_true_of_le h] at hb; exact Bool.noConfusion hb
have nw : ¬ (w + w < m' + 1) := fun h => by rw [show Nat.blt (w + w) (m' + 1) = true from Nat.ble_eq_true_of_le h] at hb'; exact Bool.noConfusion hb'
cases Nat.lt_or_ge v w with
| inl l => exact nv (hw ▸ Nat.add_lt_add_left l v)
| inr g =>
cases Nat.lt_or_eq_of_le g with
| inl l => exact nw (by rw [← hw, nadd_comm v w]; exact Nat.add_lt_add_left l w)
| inr e => exact hodd v (by rw [← hw, ← e])
| true =>
show 0 + cnt w a = cnt v a
rw [Nat.zero_add]
have w0 : 0 < w := by
cases w with
| zero => rw [Nat.add_zero] at hw; rw [hw] at hv; exact absurd hv (Nat.not_succ_le_self m')
| succ k => exact Nat.zero_lt_succ k
have wv : w ≤ m' := Nat.le_of_lt_succ (show w < m' + 1 by
rw [← hw, nadd_comm v w]; exact Nat.lt_add_of_pos_right h0)
rw [hsym w w0 wv]
have : m' + 1 - w = v := by
have t1 := add_sub_of_le' w (m' + 1) (Nat.le_succ_of_le wv)
exact add_left_cancel' w _ _ (t1.trans (hw.symm.trans (nadd_comm v w)))
rw [this]
/-- **Symmetric counts ⇒ Hodge** (odd m; every unit t with t·b ≢ 0 for 0 < b < m). -/
theorem sym_hodge (m' : Nat) (a : List Nat) (hin : AllIn m' a)
(hsym : ∀ v, 0 < v → v ≤ m' → cnt v a = cnt (m' + 1 - v) a) (hodd : ∀ v, v + v ≠ m' + 1)
(hnz : ∀ b, 0 < b → b ≤ m' → ∀ t, t ∈ FermatPrime.units (m' + 1) → rem (m' + 1) (t * b) ≠ 0) :
HodgeList (m' + 1) a := by
have hl := allIn_lows m' (m' + 1) a hin
have hb := allIn_pairs m' _ hl
have hp : HodgeList (m' + 1) (pairsList (m' + 1) (lows (m' + 1) a)) :=
pairs_hodge m' _ (fun b hbm =>
have r := allIn_mem m' _ hl b hbm
⟨Nat.le_succ_of_le r.2, hnz b r.1 r.2⟩)
apply hodge_of_counts (m' + 1) m' _ a hb hin _ hp
intro v
cases Nat.eq_zero_or_pos v with
| inl z => rw [cnt_out m' v _ hb (Or.inl z), cnt_out m' v _ hin (Or.inl z)]
| inr pos =>
cases Nat.lt_or_ge m' v with
| inl g => rw [cnt_out m' v _ hb (Or.inr g), cnt_out m' v _ hin (Or.inr g)]
| inr le => exact counts_match m' a hin hsym hodd v pos le
end HodgeCounts
#print axioms HodgeCounts.hodge_of_counts
#print axioms HodgeCounts.cnt_cons
#print axioms HodgeCounts.cnt_append
#print axioms HodgeCounts.cnt_pairsList
#print axioms HodgeCounts.ind_eq
#print axioms HodgeCounts.ind_ne
#print axioms HodgeCounts.cnt_lows
#print axioms HodgeCounts.sub_swap
#print axioms HodgeCounts.cntNeg_eq
#print axioms HodgeCounts.cnt_out
#print axioms HodgeCounts.allIn_lows
#print axioms HodgeCounts.allIn_append
#print axioms HodgeCounts.allIn_pairs
#print axioms HodgeCounts.allIn_mem
#print axioms HodgeCounts.lt_of_blt
#print axioms HodgeCounts.counts_match
#print axioms HodgeCounts.sym_hodge
lean_all/hodge/HodgeIff.lean
/-
hodge/HodgeIff.lean — T41 cycle 33: the converse direction at the level of exponent lists.
Lean 4 core plus hodge/FermatFull, HodgeChain (dv_between), ESChain (rem_eq_mod).
lsumL_append Σ over a ++ b = Σ over a + Σ over b
hodge_append Shioda's inductive structure: Hodge characters of X_m^r and X_m^s concatenate to a
Hodge character of X_m^{r+s+2}
all_mem a Boolean `all` over a list gives the property for every member
pair_sum_mod (t(m−b)) % m + (t b) % m = m when (t b) % m ≠ 0, 0 < b < m
pair_hodge [b, m − b] satisfies Shioda's condition whenever every unit t has t·b ≢ 0
pairs_hodge every concatenation of pairs [b, m − b] is a Hodge character
With FermatFull/FermatPrimes2 (Hodge ⇒ #b = #(m−b)): for prime m ≤ 47 a character is Hodge iff its
count vector is symmetric, in every dimension.
-/
import hodge.FermatFull
import ESChain
import HodgeChain
namespace HodgeIff
open FTAChain FrobChain QRChain ESChain FermatPrime FermatFull HodgeChain
theorem lsumL_append (g : Nat → Nat) : ∀ a b : List Nat, lsumL g (a ++ b) = lsumL g a + lsumL g b
| [], b => (Nat.zero_add _).symm
| x :: a, b => by
show g x + lsumL g (a ++ b) = g x + lsumL g a + lsumL g b
rw [lsumL_append g a b, nadd_assoc]
theorem hodge_append (m : Nat) (a b : List Nat) (ha : HodgeList m a) (hb : HodgeList m b) :
HodgeList m (a ++ b) := by
intro t ht
rw [lsumL_append, lsumL_append, ha t ht, hb t ht]
theorem all_mem {A : Type} (f : A → Bool) : ∀ l : List A, l.all f = true → ∀ x, x ∈ l → f x = true
| [], _, x, hx => by cases hx
| y :: l, h, x, hx => by
have h' : (f y && l.all f) = true := h
cases hx with
| head => exact and_left h'
| tail _ hx => exact all_mem f l (and_right h') x hx
/-- (t(m−b)) % m + (t b) % m = m, written with `rem` (= %). -/
theorem pair_sum_rem (m' t b : Nat) (hb : b ≤ m' + 1) (hnz : rem (m' + 1) (t * b) ≠ 0) :
rem (m' + 1) (t * (m' + 1 - b)) + rem (m' + 1) (t * b) = m' + 1 := by
have hsum : t * (m' + 1 - b) + t * b = t * (m' + 1) := by
rw [← nleft_distrib, nadd_comm, add_sub_of_le' b (m' + 1) hb]
apply dv_between (m' + 1)
· -- divisible: r1 + r2 ≡ t(m) ≡ 0
apply dv_of_rem_zero
rw [rem_add_congr2 m' _ (t * (m' + 1 - b)) _ (t * b) (rem_idem m' _) (rem_idem m' _), hsum]
exact rem_add_mul m' 0 t
· cases Nat.eq_zero_or_pos (rem (m' + 1) (t * b)) with
| inl h0 => exact absurd h0 hnz
| inr hp => exact Nat.lt_of_lt_of_le hp (Nat.le_add_left _ _)
· exact Nat.add_lt_add (rem_lt' m' _) (rem_lt' m' _)
/-- **A pair is Hodge.** -/
theorem pair_hodge (m' b : Nat) (hb : b ≤ m' + 1)
(hnz : ∀ t, t ∈ FermatPrime.units (m' + 1) → rem (m' + 1) (t * b) ≠ 0) :
HodgeList (m' + 1) [b, m' + 1 - b] := by
intro t ht
show 2 * (t * b % (m' + 1)) + (2 * (t * (m' + 1 - b) % (m' + 1)) + 0) = (m' + 1) + ((m' + 1) + 0)
rw [← rem_eq_mod, ← rem_eq_mod]
show 2 * rem (m' + 1) (t * b) + 2 * rem (m' + 1) (t * (m' + 1 - b)) = (m' + 1) + (m' + 1)
rw [← nleft_distrib, nadd_comm (rem (m' + 1) (t * b)), pair_sum_rem m' t b hb (hnz t ht), Nat.two_mul]
def pairsList (m : Nat) : List Nat → List Nat
| [] => []
| b :: l => [b, m - b] ++ pairsList m l
/-- **Every concatenation of pairs is Hodge** (Shioda's linear-subspace characters, every dimension). -/
theorem pairs_hodge (m' : Nat) : ∀ l : List Nat,
(∀ b, b ∈ l → b ≤ m' + 1 ∧ ∀ t, t ∈ FermatPrime.units (m' + 1) → rem (m' + 1) (t * b) ≠ 0) →
HodgeList (m' + 1) (pairsList (m' + 1) l)
| [], _ => fun _ _ => rfl
| b :: l, h => hodge_append _ _ _
(pair_hodge m' b (h b (List.Mem.head l)).1 (h b (List.Mem.head l)).2)
(pairs_hodge m' l (fun b' hb' => h b' (List.Mem.tail b hb')))
/-- Instance: m = 7 — every unit t and every 0 < b < 7 have t·b ≢ 0, so every pair list is Hodge. -/
def nz7 : Bool := (FermatPrime.units 7).all (fun t => (List.range 7).all (fun b => Nat.beq b 0 || !(Nat.beq (rem 7 (t * b)) 0)))
set_option maxRecDepth 100000 in
theorem nz7_ok : nz7 = true := rfl
end HodgeIff
#print axioms HodgeIff.lsumL_append
#print axioms HodgeIff.hodge_append
#print axioms HodgeIff.all_mem
#print axioms HodgeIff.pair_sum_rem
#print axioms HodgeIff.pair_hodge
#print axioms HodgeIff.pairs_hodge
#print axioms HodgeIff.nz7_ok
lean_all/hodge/Indec4.lean
/-
hodge/Indec4.lean — T41 cycle 754 (goal G467): a four-element character with no entry m/2 and no two entries
summing to m is indecomposable, every m ≥ 2. In particular the ThirdFam characters [a, a+k, a+2k, 3k−3a] for odd
m = 3k (e.g. [1, 4, 6, 7] at m = 9, as in IndecSmall) are indecomposable when no two entries sum to m.
Lean 4 core plus hodge/IndecTriple (and_false', single_false), hodge/PairIff (pair_iff), hodge/Indecomp.
indec4_eq indec m [w, x, y, z] as an explicit Boolean formula (rfl)
indec4_of singletons and pairs unbalanced ⇒ indecomposable
pair_false 0 < u, v < m, u + v ≠ m ⇒ bal m [u, v] = false
indec4 the arithmetic form
-/
import hodge.IndecTriple
namespace Indec4
open Indecomp IndecTriple PairIff
theorem indec4_eq (m w x y z : Nat) : indec m [w, x, y, z] = (true && (!(bal m [x, y, z] && bal m [w]) && (!(bal m [w, y, z] && bal m [x]) && (!(bal m [y, z] && bal m [w, x]) && (!(bal m [w, x, z] && bal m [y]) && (!(bal m [x, z] && bal m [w, y]) && (!(bal m [w, z] && bal m [x, y]) && (!(bal m [z] && bal m [w, x, y]) && (!(bal m [w, x, y] && bal m [z]) && (!(bal m [x, y] && bal m [w, z]) && (!(bal -- (+210 chars; full line in the Zenodo source)
theorem indec4_of (m w x y z : Nat)
(sw : bal m [w] = false) (sx : bal m [x] = false) (sy : bal m [y] = false) (sz : bal m [z] = false)
(pwx : bal m [w, x] = false) (pwy : bal m [w, y] = false) (pwz : bal m [w, z] = false)
(pxy : bal m [x, y] = false) (pxz : bal m [x, z] = false) (pyz : bal m [y, z] = false) :
indec m [w, x, y, z] = true := by
rw [indec4_eq, sw, sx, sy, sz, pwx, pwy, pwz, pxy, pxz, pyz, and_false', and_false', and_false', and_false', and_false' (bal m [w, x, y])]
rfl
theorem pair_false (n u v : Nat) (hu0 : 0 < u) (hv0 : 0 < v) (hu : u < n + 2) (hv : v < n + 2)
(hne : u + v ≠ n + 2) : bal (n + 2) [u, v] = false := by
cases e : bal (n + 2) [u, v] with
| false => rfl
| true => exact absurd ((pair_iff n u v hu0 hv0 hu hv).1 e) hne
theorem indec4 (n w x y z : Nat) (hw0 : 0 < w) (hx0 : 0 < x) (hy0 : 0 < y) (hz0 : 0 < z)
(hw : w < n + 2) (hx : x < n + 2) (hy : y < n + 2) (hz : z < n + 2)
(nw : w + w ≠ n + 2) (nx : x + x ≠ n + 2) (ny : y + y ≠ n + 2) (nz : z + z ≠ n + 2)
(qwx : w + x ≠ n + 2) (qwy : w + y ≠ n + 2) (qwz : w + z ≠ n + 2)
(qxy : x + y ≠ n + 2) (qxz : x + z ≠ n + 2) (qyz : y + z ≠ n + 2) :
indec (n + 2) [w, x, y, z] = true :=
indec4_of _ w x y z (single_false n w hw0 hw nw) (single_false n x hx0 hx nx) (single_false n y hy0 hy ny)
(single_false n z hz0 hz nz) (pair_false n w x hw0 hx0 hw hx qwx) (pair_false n w y hw0 hy0 hw hy qwy)
(pair_false n w z hw0 hz0 hw hz qwz) (pair_false n x y hx0 hy0 hx hy qxy) (pair_false n x z hx0 hz0 hx hz qxz)
(pair_false n y z hy0 hz0 hy hz qyz)
end Indec4
#print axioms Indec4.indec4_eq
#print axioms Indec4.indec4_of
#print axioms Indec4.pair_false
#print axioms Indec4.indec4
lean_all/hodge/IndecPerm.lean
/-
hodge/IndecPerm.lean — T41 cycle 313 (goal G51): balance and irreducibility depend only on the multiset of
entries (List.Perm), every m, axiom-free.
Lean 4 core plus hodge/APPairIrrGen (splitsG, splits_eq), hodge/Indecomp (bal, indec, tsum), lib/Semi.
perm_len, perm_nil own versions (core's Perm.length_eq / isEmpty_eq use propext)
tsum_perm', bal_perm T_t and bal are Perm-invariant
mem_flatMap' hand membership in flatMap
splits_perm every splitting of c' is a Perm-image of a splitting of c (c ~ c')
indec_perm c ~ c' ⇒ (indec m c = true → indec m c' = true)
-/
import hodge.APPairIrrGen
namespace IndecPerm
open Indecomp APPairIrrGen
theorem perm_len {α : Type} {a b : List α} (h : a.Perm b) : a.length = b.length := by
induction h with
| nil => rfl
| cons x _ ih => show _ + 1 = _ + 1; rw [ih]
| swap x y l => rfl
| trans _ _ ih1 ih2 => exact ih1.trans ih2
theorem perm_isEmpty {α : Type} {a b : List α} (h : a.Perm b) : a.isEmpty = b.isEmpty := by
induction h with
| nil => rfl
| cons x _ _ => rfl
| swap x y l => rfl
| trans _ _ ih1 ih2 => exact ih1.trans ih2
theorem tsum_perm' (m t : Nat) {a b : List Nat} (h : a.Perm b) : tsum m t a = tsum m t b := by
induction h with
| nil => rfl
| cons x _ ih => show (t * x) % m + tsum m t _ = (t * x) % m + tsum m t _; rw [ih]
| swap x y l => show (t * y) % m + ((t * x) % m + tsum m t l) = (t * x) % m + ((t * y) % m + tsum m t l); lib_nat
| trans _ _ ih1 ih2 => exact ih1.trans ih2
theorem all_congr' {α : Type} (f g : α → Bool) (h : ∀ x, f x = g x) : ∀ l : List α, l.all f = l.all g
| [] => rfl
| x :: l => by show (f x && l.all f) = (g x && l.all g); rw [h x, all_congr' f g h l]
theorem bal_perm (m : Nat) {a b : List Nat} (h : a.Perm b) : bal m a = bal m b := by
unfold bal
rw [perm_len h]
exact all_congr' _ _ (fun t => by rw [tsum_perm' m t h]) _
theorem mem_append_l {α : Type} {x : α} : ∀ {l1 : List α} (l2 : List α), x ∈ l1 → x ∈ l1 ++ l2
| _ :: _, _, List.Mem.head _ => List.Mem.head _
| _ :: _, l2, List.Mem.tail _ m => List.Mem.tail _ (mem_append_l l2 m)
theorem mem_append_r {α : Type} {x : α} : ∀ (l1 : List α) {l2 : List α}, x ∈ l2 → x ∈ l1 ++ l2
| [], _, m => m
| _ :: l1, _, m => List.Mem.tail _ (mem_append_r l1 m)
theorem mem_append_or {α : Type} {x : α} : ∀ (l1 l2 : List α), x ∈ l1 ++ l2 → x ∈ l1 ∨ x ∈ l2
| [], _, m => Or.inr m
| _ :: _, _, List.Mem.head _ => Or.inl (List.Mem.head _)
| _ :: l1, l2, List.Mem.tail _ m => (mem_append_or l1 l2 m).elim (fun h => Or.inl (List.Mem.tail _ h)) Or.inr
theorem mem_flatMap_of {α β : Type} (f : α → List β) {y : β} {x : α} : ∀ {l : List α}, x ∈ l → y ∈ f x → y ∈ l.flatMap f
| _ :: _, List.Mem.head _, hy => by
show y ∈ f x ++ List.flatMap f _
exact mem_append_l _ hy
| z :: l, List.Mem.tail _ m, hy => by
show y ∈ f z ++ List.flatMap f l
exact mem_append_r _ (mem_flatMap_of f m hy)
theorem of_mem_flatMap {α β : Type} (f : α → List β) {y : β} : ∀ (l : List α), y ∈ l.flatMap f → ∃ x, x ∈ l ∧ y ∈ f x
| [], m => by cases m
| z :: l, m => by
have m' : y ∈ f z ++ List.flatMap f l := m
cases mem_append_or _ _ m' with
| inl h => exact ⟨z, List.Mem.head _, h⟩
| inr h =>
have ⟨x, hx, hy⟩ := of_mem_flatMap f l h
exact ⟨x, List.Mem.tail _ hx, hy⟩
/-- the two ways to place an entry into a splitting -/
def place {α : Type} (x : α) (p : List α × List α) : List (List α × List α) := [(x :: p.1, p.2), (p.1, x :: p.2)]
theorem splitsG_cons {α : Type} (x : α) (l : List α) : splitsG (x :: l) = (splitsG l).flatMap (place x) := rfl
def PP {α : Type} (p q : List α × List α) : Prop := p.1.Perm q.1 ∧ p.2.Perm q.2
/-- **Every splitting of c' is a Perm-image of one of c.** -/
theorem splits_perm {α : Type} {c c' : List α} (h : c.Perm c') :
∀ p', p' ∈ splitsG c' → ∃ p, p ∈ splitsG c ∧ PP p p' := by
induction h with
| nil => intro p' hp; exact ⟨p', hp, List.Perm.refl _, List.Perm.refl _⟩
| cons x _ ih =>
intro p' hp
rw [splitsG_cons] at hp
have ⟨q', hq', hp'⟩ := of_mem_flatMap _ _ hp
have ⟨q, hq, h1, h2⟩ := ih q' hq'
cases hp' with
| head => exact ⟨(x :: q.1, q.2), mem_flatMap_of _ hq (List.Mem.head _), h1.cons x, h2⟩
| tail _ hp'' =>
cases hp'' with
| head => exact ⟨(q.1, x :: q.2), mem_flatMap_of _ hq (List.Mem.tail _ (List.Mem.head _)), h1, h2.cons x⟩
| tail _ h3 => cases h3
| swap x y l =>
intro p' hp
rw [splitsG_cons, splitsG_cons] at hp
have ⟨q1, hq1, hp1⟩ := of_mem_flatMap _ _ hp
have ⟨q, hq, hq1'⟩ := of_mem_flatMap _ _ hq1
-- q1 is q with y placed, p' is q1 with x placed; build the same with x first then y
have mem2 : ∀ r, r ∈ place y q → ∀ s, s ∈ place x r →
∃ p, p ∈ ((splitsG l).flatMap (place x)).flatMap (place y) ∧ PP p s := by
intro r hr s hs
cases hr with
| head =>
cases hs with
| head => exact ⟨(y :: x :: q.1, q.2), mem_flatMap_of _ (mem_flatMap_of _ hq (List.Mem.head _)) (List.Mem.head _),
List.Perm.swap x y q.1, List.Perm.refl _⟩
| tail _ hs' => cases hs' with
| head => exact ⟨(y :: q.1, x :: q.2),
mem_flatMap_of _ (mem_flatMap_of _ hq (List.Mem.tail _ (List.Mem.head _))) (List.Mem.head _),
List.Perm.refl _, List.Perm.refl _⟩
| tail _ h3 => cases h3
| tail _ hr' => cases hr' with
| head =>
cases hs with
| head => exact ⟨(x :: q.1, y :: q.2),
mem_flatMap_of _ (mem_flatMap_of _ hq (List.Mem.head _)) (List.Mem.tail _ (List.Mem.head _)),
List.Perm.refl _, List.Perm.refl _⟩
| tail _ hs' => cases hs' with
| head => exact ⟨(q.1, y :: x :: q.2),
mem_flatMap_of _ (mem_flatMap_of _ hq (List.Mem.tail _ (List.Mem.head _))) (List.Mem.tail _ (List.Mem.head _)),
List.Perm.refl _, List.Perm.swap x y q.2⟩
| tail _ h3 => cases h3
| tail _ h3 => cases h3
have ⟨p, hp0, hpp⟩ := mem2 q1 hq1' p' hp1
exact ⟨p, by rw [splitsG_cons, splitsG_cons]; exact hp0, hpp⟩
| trans _ _ ih1 ih2 =>
intro p'' hp''
have ⟨p', hp', h1, h2⟩ := ih2 p'' hp''
have ⟨p, hp, h3, h4⟩ := ih1 p' hp'
exact ⟨p, hp, h3.trans h1, h4.trans h2⟩
theorem all_of_mem {α : Type} (f : α → Bool) : ∀ (l : List α), (∀ x, x ∈ l → f x = true) → l.all f = true
| [], _ => rfl
| x :: l, h => by
show (f x && l.all f) = true
rw [h x (List.Mem.head _), all_of_mem f l (fun y hy => h y (List.Mem.tail _ hy))]; rfl
theorem mem_of_all {α : Type} (f : α → Bool) {x : α} : ∀ {l : List α}, l.all f = true → x ∈ l → f x = true
| _ :: _, h, List.Mem.head _ => by
have h' : (f x && _) = true := h
cases e : f x with
| true => rfl
| false => rw [e] at h'; exact Bool.noConfusion h'
| y :: l, h, List.Mem.tail _ m => by
have h' : (f y && l.all f) = true := h
cases e : l.all f with
| true => exact mem_of_all f e m
| false => rw [e] at h'; cases e2 : f y <;> rw [e2] at h' <;> exact Bool.noConfusion h'
/-- **Irreducibility is invariant under reordering.** -/
theorem indec_perm (m : Nat) {c c' : List Nat} (h : c.Perm c') (hc : indec m c = true) : indec m c' = true := by
unfold indec at *
rw [splits_eq] at *
apply all_of_mem
intro p' hp'
have ⟨p, hp, h1, h2⟩ := splits_perm h p' hp'
have := mem_of_all _ hc hp
rw [← perm_isEmpty h1, ← perm_isEmpty h2, ← bal_perm m h1, ← bal_perm m h2]
exact this
end IndecPerm
#print axioms IndecPerm.bal_perm
#print axioms IndecPerm.splits_perm
#print axioms IndecPerm.indec_perm
lean_all/hodge/IndecSmall.lean
/- hodge/IndecSmall.lean — T41 cycle 741 (goal G454): the indecomposable balanced characters of length 3 (m ≤ 24) and length 4 (m ≤ 16): those with no splitting into two nonempty balanced parts, by rfl. Lean 4 core plus hodge/Len4Class (cls, cls4), hodge/Indecomp (indec), rfl. These are the characters the inductive (pair / m/2 / block) method cannot reach at these m. -/ import hodge.Len4Class namespace IndecSmall open Indecomp Len3Class Len4Class set_option maxRecDepth 100000 in theorem i3_3 : (cls 3).filter (indec 3) = [] := rfl set_option maxRecDepth 100000 in theorem i3_4 : (cls 4).filter (indec 4) = [] := rfl set_option maxRecDepth 100000 in theorem i3_5 : (cls 5).filter (indec 5) = [] := rfl set_option maxRecDepth 100000 in theorem i3_6 : (cls 6).filter (indec 6) = [[1, 4, 4], [2, 2, 5]] := rfl set_option maxRecDepth 100000 in theorem i3_7 : (cls 7).filter (indec 7) = [] := rfl set_option maxRecDepth 100000 in theorem i3_8 : (cls 8).filter (indec 8) = [[1, 5, 6], [2, 3, 7]] := rfl set_option maxRecDepth 100000 in theorem i3_9 : (cls 9).filter (indec 9) = [] := rfl set_option maxRecDepth 100000 in theorem i3_10 : (cls 10).filter (indec 10) = [[1, 6, 8], [2, 4, 9], [2, 6, 7], [3, 4, 8]] := rfl set_option maxRecDepth 100000 in theorem i3_11 : (cls 11).filter (indec 11) = [] := rfl set_option maxRecDepth 100000 in theorem i3_12 : (cls 12).filter (indec 12) = [[1, 7, 10], [1, 8, 9], [2, 5, 11], [2, 8, 8], [3, 4, 11], [3, 7, 8], [4, 4, 10], [4, 5, 9]] := rfl set_option maxRecDepth 100000 in theorem i3_13 : (cls 13).filter (indec 13) = [] := rfl set_option maxRecDepth 100000 in theorem i3_14 : (cls 14).filter (indec 14) = [[1, 8, 12], [1, 9, 11], [2, 6, 13], [2, 9, 10], [3, 5, 13], [3, 8, 10], [4, 5, 12], [4, 6, 11]] := rfl set_option maxRecDepth 100000 in theorem i3_15 : (cls 15).filter (indec 15) = [] := rfl set_option maxRecDepth 100000 in theorem i3_16 : (cls 16).filter (indec 16) = [[1, 9, 14], [2, 7, 15], [2, 10, 12], [3, 10, 11], [4, 6, 14], [5, 6, 13]] := rfl set_option maxRecDepth 100000 in theorem i3_17 : (cls 17).filter (indec 17) = [] := rfl set_option maxRecDepth 100000 in theorem i3_18 : (cls 18).filter (indec 18) = [[1, 10, 16], [1, 12, 14], [2, 8, 17], [2, 11, 14], [2, 12, 13], [3, 12, 12], [4, 6, 17], [4, 7, 16], [4, 10, 13], [5, 6, 16], [5, 8, 14], [6, 6, 15], [6, 10, 11], [7, 8, 12]] := rfl set_option maxRecDepth 100000 in theorem i3_19 : (cls 19).filter (indec 19) = [] := rfl set_option maxRecDepth 100000 in theorem i3_20 : (cls 20).filter (indec 20) = [[1, 11, 18], [1, 12, 17], [1, 13, 16], [2, 9, 19], [2, 12, 16], [3, 8, 19], [3, 11, 16], [3, 13, 14], [4, 7, 19], [4, 8, 18], [4, 9, 17], [4, 12, 14], [6, 7, 17], [6, 8, 16], [7, 11, 12], [8, 9, 13]] := rfl set_option maxRecDepth 100000 in theorem i3_21 : (cls 21).filter (indec 21) = [] := rfl set_option maxRecDepth 100000 in theorem i3_22 : (cls 22).filter (indec 22) = [[1, 12, 20], [2, 10, 21], [2, 13, 18], [3, 14, 16], [4, 9, 20], [4, 14, 15], [5, 12, 16], [6, 8, 19], [6, 10, 17], [7, 8, 18]] := rfl set_option maxRecDepth 100000 in theorem i3_23 : (cls 23).filter (indec 23) = [] := rfl set_option maxRecDepth 100000 in theorem i3_24 : (cls 24).filter (indec 24) = [[1, 13, 22], [1, 16, 19], [1, 17, 18], [2, 11, 23], [2, 14, 20], [2, 16, 18], [3, 15, 18], [4, 10, 22], [4, 16, 16], [5, 8, 23], [5, 13, 18], [5, 14, 17], [6, 7, 23], [6, 8, 22], [6, 9, 21], [6, 11, 19], [6, 14, 16], [7, 10, 19], [7, 13, 16], [8, 8, 20], [8, 10, 18], [8, 11, 17]] := rfl set_option maxRecDepth 100000 in theorem i4_3 : (cls4 3).filter (indec 3) = [] := rfl set_option maxRecDepth 100000 in theorem i4_4 : (cls4 4).filter (indec 4) = [] := rfl set_option maxRecDepth 100000 in theorem i4_5 : (cls4 5).filter (indec 5) = [] := rfl set_option maxRecDepth 100000 in theorem i4_6 : (cls4 6).filter (indec 6) = [] := rfl set_option maxRecDepth 100000 in theorem i4_7 : (cls4 7).filter (indec 7) = [] := rfl set_option maxRecDepth 100000 in theorem i4_8 : (cls4 8).filter (indec 8) = [] := rfl set_option maxRecDepth 100000 in theorem i4_9 : (cls4 9).filter (indec 9) = [[1, 4, 6, 7], [2, 3, 5, 8]] := rfl set_option maxRecDepth 100000 in theorem i4_10 : (cls4 10).filter (indec 10) = [[1, 3, 8, 8], [1, 6, 6, 7], [2, 2, 7, 9], [3, 4, 4, 9]] := rfl set_option maxRecDepth 100000 in theorem i4_11 : (cls4 11).filter (indec 11) = [] := rfl set_option maxRecDepth 100000 in theorem i4_12 : (cls4 12).filter (indec 12) = [[1, 4, 9, 10], [1, 5, 9, 9], [1, 7, 8, 8], [2, 3, 8, 11], [2, 5, 8, 9], [3, 3, 7, 11], [3, 4, 7, 10], [4, 4, 5, 11]] := rfl set_option maxRecDepth 100000 in theorem i4_13 : (cls4 13).filter (indec 13) = [] := rfl set_option maxRecDepth 100000 in theorem i4_14 : (cls4 14).filter (indec 14) = [[1, 4, 11, 12], [1, 8, 9, 10], [2, 3, 10, 13], [2, 6, 9, 11], [3, 5, 8, 12], [4, 5, 6, 13]] := rfl set_option maxRecDepth 100000 in theorem i4_15 : (cls4 15).filter (indec 15) = [[1, 6, 10, 13], [1, 6, 11, 12], [1, 7, 10, 12], [2, 5, 9, 14], [2, 5, 11, 12], [2, 7, 9, 12], [3, 4, 9, 14], [3, 4, 10, 13], [3, 5, 8, 14], [3, 6, 8, 13], [4, 7, 9, 10], [5, 6, 8, 11]] := rfl set_option maxRecDepth 100000 in theorem i4_16 : (cls4 16).filter (indec 16) = [[1, 9, 10, 12], [2, 5, 12, 13], [3, 4, 11, 14], [4, 6, 7, 15]] := rfl end IndecSmall #print axioms IndecSmall.i3_3 #print axioms IndecSmall.i3_4 #print axioms IndecSmall.i3_5 #print axioms IndecSmall.i3_6 #print axioms IndecSmall.i3_7 #print axioms IndecSmall.i3_8 #print axioms IndecSmall.i3_9 #print axioms IndecSmall.i3_10 #print axioms IndecSmall.i3_11 #print axioms IndecSmall.i3_12 #print axioms IndecSmall.i3_13 #print axioms IndecSmall.i3_14 #print axioms IndecSmall.i3_15 #print axioms IndecSmall.i3_16 #print axioms IndecSmall.i3_17 #print axioms IndecSmall.i3_18 #print axioms IndecSmall.i3_19 #print axioms IndecSmall.i3_20 #print axioms IndecSmall.i3_21 #print axioms IndecSmall.i3_22 #print axioms IndecSmall.i3_23 #print axioms IndecSmall.i3_24 #print axioms IndecSmall.i4_3 #print axioms IndecSmall.i4_4 #print axioms IndecSmall.i4_5 #print axioms IndecSmall.i4_6 #print axioms IndecSmall.i4_7 #print axioms IndecSmall.i4_8 #print axioms IndecSmall.i4_9 #print axioms IndecSmall.i4_10 #print axioms IndecSmall.i4_11 #print axioms IndecSmall.i4_12 #print axioms IndecSmall.i4_13 #print axioms IndecSmall.i4_14 #print axioms IndecSmall.i4_15 #print axioms IndecSmall.i4_16
lean_all/hodge/IndecTriple.lean
/-
hodge/IndecTriple.lean — T41 cycle 744 (goal G457): a three-element character with no entry m/2 is
indecomposable, for every m ≥ 2; so every Triple-family character [a, h+a, 2h−2a] with no entry equal to h is
indecomposable.
Lean 4 core plus hodge/PairReduce (single_iff), hodge/Triple (triple_bal), hodge/Indecomp (indec, splits).
indec3_eq indec m [x, y, z] as an explicit Boolean formula (rfl: splits of a 3-list)
and_false' b && false = false
single_false 0 < x < m, x + x ≠ m ⇒ bal m [x] = false
indec_triple no entry equals m/2 ⇒ indec m [x, y, z] = true
-/
import hodge.PairReduce
import hodge.Triple
namespace IndecTriple
open Indecomp PairReduce
theorem indec3_eq (m x y z : Nat) : indec m [x, y, z] =
(true && (!(bal m [y, z] && bal m [x]) && (!(bal m [x, z] && bal m [y]) && (!(bal m [z] && bal m [x, y])
&& (!(bal m [x, y] && bal m [z]) && (!(bal m [y] && bal m [x, z]) && (!(bal m [x] && bal m [y, z])
&& (true && true)))))))) := rfl
theorem and_false' (b : Bool) : (b && false) = false := by cases b <;> rfl
theorem single_false (n x : Nat) (hx0 : 0 < x) (hx : x < n + 2) (hne : x + x ≠ n + 2) :
bal (n + 2) [x] = false := by
cases e : bal (n + 2) [x] with
| false => rfl
| true => exact absurd ((single_iff n x hx0 hx).1 e) hne
theorem indec_triple (n x y z : Nat) (hx0 : 0 < x) (hx : x < n + 2) (hy0 : 0 < y) (hy : y < n + 2)
(hz0 : 0 < z) (hz : z < n + 2) (nx : x + x ≠ n + 2) (ny : y + y ≠ n + 2) (nz : z + z ≠ n + 2) :
indec (n + 2) [x, y, z] = true := by
rw [indec3_eq, single_false n x hx0 hx nx, single_false n y hy0 hy ny, single_false n z hz0 hz nz,
and_false', and_false', and_false']
rfl
end IndecTriple
#print axioms IndecTriple.indec3_eq
#print axioms IndecTriple.and_false'
#print axioms IndecTriple.single_false
#print axioms IndecTriple.indec_triple
lean_all/hodge/Indecomp.lean
/- hodge/Indecomp.lean — T41 cycle 168: the certified open characters have no balanced splitting. Lean 4 core, rfl. A list A is balanced for m if 2T_t(A) = |A|·m for every unit t (Shioda's condition at any length). For each certified open character c (m = 32, 33, 36, 56, 68, 70, 76, 78) no splitting c = A ⊔ B into two nonempty sub-multisets has both parts balanced; for m = 62 the only one is 31 ⊔ (1, 33, 35, 39, 47) (Reduce62), and that 5-list has none. So no block-wise reduction (pairs, m/2, Hodge sub-characters of any length) reaches these characters: they are irreducible obstructions of the inductive method. -/ import hodge.FermatPrime namespace Indecomp def tsum (m t : Nat) : List Nat → Nat | [] => 0 | a :: l => (t * a) % m + tsum m t l def bal (m : Nat) (A : List Nat) : Bool := (FermatPrime.units m).all (fun t => Nat.beq (tsum m t A + tsum m t A) (A.length * m)) /-- all (A, B) splittings of a list, as pairs of sub-multisets -/ def splits : List Nat → List (List Nat × List Nat) | [] => [([], [])] | x :: l => (splits l).flatMap (fun p => [(x :: p.1, p.2), (p.1, x :: p.2)]) def indec (m : Nat) (c : List Nat) : Bool := (splits c).all (fun p => p.1.isEmpty || p.2.isEmpty || !(bal m p.1 && bal m p.2)) def openChars : List (Nat × List Nat) := [(32, [1, 9, 17, 20, 24, 25]), (33, [1, 4, 16, 22, 25, 31]), (36, [1, 4, 13, 27, 29, 34]), (56, [1, 9, 29, 37, 42, 50]), (68, [1, 18, 35, 38, 52, 60]), (70, [1, 6, 43, 45, 57, 58]), (76, [1, 20, 39, 42, 58, 68]), (78, [1, 6, 12, 64, 75, 76]), (62, [1, 33, 35, 39, 47])] set_option maxRecDepth 100000 in theorem indec_ok : openChars.all (fun p => indec p.1 p.2) = true := rfl -- the 5-list of m = 62 is itself balanced (Reduce62), so the split 31 ⊔ rest is the only one set_option maxRecDepth 100000 in theorem rest62_bal : bal 62 [1, 33, 35, 39, 47] = true := rfl end Indecomp #print axioms Indecomp.indec_ok #print axioms Indecomp.rest62_bal
lean_all/hodge/Indecomp2.lean
/-
hodge/Indecomp2.lean — T41 cycle 171: indecomposability of every stored unreached character.
Lean 4 core plus hodge/Indecomp (bal, splits, indec), rfl. NUMERIC_HODGE_REACH.jsonl stores up to five
unreached characters per (m, length). Of the 126 distinct ones:
indec_all 110 have no splitting into two nonempty balanced parts (all of length 6; m = 25, 32, 33, 35,
36, 39, 40, 42, 44, 45, 48, 50, 52, 54, 56, 60, 64, 66, 68, 70, 72, 76, 78)
dec_all the other 16 do split: the length-8 ones into a pair and a length-6 open character, and the
length-6 ones at m = 62 and m = 70 into the entry m/2 and a balanced 5-list
So every stored open character of length 8 reduces to one of length 6, and every open character of length 6
is irreducible unless it contains m/2.
-/
import hodge.Indecomp
namespace Indecomp2
open Indecomp
def indList : List (Nat × List Nat) :=
[(25, [1, 6, 11, 16, 20, 21]),
(25, [2, 7, 12, 15, 17, 22]),
(25, [3, 8, 10, 13, 18, 23]),
(25, [4, 5, 9, 14, 19, 24]),
(32, [1, 9, 17, 20, 24, 25]),
(32, [3, 8, 11, 19, 27, 28]),
(32, [4, 5, 13, 21, 24, 29]),
(32, [7, 8, 12, 15, 23, 31]),
(33, [1, 4, 16, 22, 25, 31]),
(33, [2, 8, 11, 17, 29, 32]),
(33, [5, 11, 14, 20, 23, 26]),
(33, [7, 10, 13, 19, 22, 28]),
(35, [1, 8, 15, 22, 29, 30]),
(35, [2, 9, 16, 23, 25, 30]),
(35, [3, 10, 17, 20, 24, 31]),
(35, [4, 11, 15, 18, 25, 32]),
(35, [5, 6, 13, 20, 27, 34]),
(36, [1, 4, 13, 27, 29, 34]),
(36, [1, 5, 6, 29, 33, 34]),
(36, [1, 5, 12, 27, 29, 34]),
(36, [1, 5, 12, 28, 29, 33]),
(36, [1, 5, 14, 26, 29, 33]),
(39, [1, 7, 16, 22, 34, 37]),
(39, [1, 14, 16, 22, 29, 35]),
(39, [1, 16, 19, 22, 28, 31]),
(39, [2, 5, 14, 29, 32, 35]),
(39, [2, 5, 17, 23, 32, 38]),
(40, [1, 9, 17, 25, 33, 35]),
(40, [3, 11, 19, 25, 27, 35]),
(40, [5, 7, 15, 23, 31, 39]),
(40, [5, 13, 15, 21, 29, 37]),
(42, [2, 10, 16, 27, 33, 38]),
(42, [2, 15, 16, 20, 34, 39]),
(42, [3, 4, 20, 32, 33, 34]),
(42, [3, 8, 22, 26, 27, 40]),
(42, [4, 9, 15, 26, 32, 40]),
(44, [1, 12, 23, 26, 34, 36]),
(44, [2, 6, 17, 28, 39, 40]),
(44, [2, 13, 24, 28, 30, 35]),
(44, [3, 14, 20, 25, 34, 36]),
(44, [4, 5, 16, 27, 38, 42]),
(45, [1, 19, 20, 28, 30, 37]),
(45, [2, 11, 15, 29, 38, 40]),
(45, [4, 13, 22, 30, 31, 35]),
(45, [5, 7, 16, 30, 34, 43]),
(45, [8, 15, 17, 25, 26, 44]),
(48, [1, 6, 7, 39, 45, 46]),
(48, [1, 7, 18, 34, 39, 45]),
(48, [1, 7, 27, 30, 33, 46]),
(48, [1, 7, 27, 33, 34, 42]),
(48, [1, 13, 25, 28, 37, 40]),
(50, [1, 7, 27, 30, 41, 44]),
(50, [1, 11, 13, 40, 42, 43]),
(50, [1, 11, 27, 30, 34, 47]),
(50, [1, 13, 22, 32, 40, 42]),
(50, [1, 13, 22, 33, 40, 41]),
(52, [1, 14, 27, 30, 40, 44]),
(52, [2, 7, 20, 33, 46, 48]),
(52, [2, 15, 28, 34, 36, 41]),
(52, [3, 16, 28, 29, 38, 42]),
(52, [4, 6, 19, 32, 45, 50]),
(54, [1, 4, 30, 31, 44, 52]),
(54, [1, 5, 28, 37, 43, 48]),
(54, [1, 5, 29, 41, 42, 44]),
(54, [1, 6, 8, 44, 51, 52]),
(54, [1, 6, 29, 31, 44, 51]),
(56, [1, 9, 29, 37, 42, 50]),
(56, [1, 10, 29, 36, 42, 50]),
(56, [1, 15, 29, 32, 43, 48]),
(56, [1, 15, 29, 36, 43, 44]),
(56, [1, 18, 21, 29, 49, 50]),
(60, [1, 3, 32, 44, 49, 51]),
(60, [1, 7, 32, 41, 47, 52]),
(60, [1, 8, 9, 49, 56, 57]),
(60, [1, 8, 27, 39, 49, 56]),
(60, [1, 13, 16, 41, 53, 56]),
(64, [1, 17, 33, 36, 49, 56]),
(64, [2, 18, 34, 40, 48, 50]),
(64, [3, 19, 35, 40, 44, 51]),
(64, [4, 9, 25, 41, 56, 57]),
(64, [5, 21, 24, 37, 52, 53]),
(66, [1, 5, 27, 38, 63, 64]),
(66, [1, 5, 36, 38, 54, 64]),
(66, [1, 5, 45, 46, 50, 51]),
(66, [1, 6, 10, 54, 63, 64]),
(66, [1, 8, 22, 50, 55, 62]),
(68, [1, 18, 35, 38, 52, 60]),
(68, [2, 9, 26, 43, 60, 64]),
(68, [2, 19, 36, 42, 52, 53]),
(68, [3, 20, 37, 44, 46, 54]),
(68, [4, 8, 25, 42, 59, 66]),
(70, [1, 6, 43, 45, 57, 58]),
(70, [1, 16, 29, 45, 57, 62]),
(70, [1, 20, 24, 42, 61, 62]),
(70, [1, 20, 29, 43, 57, 60]),
(72, [1, 6, 11, 59, 69, 70]),
(72, [1, 10, 25, 57, 59, 64]),
(72, [1, 10, 37, 50, 52, 66]),
(72, [1, 10, 37, 50, 54, 64]),
(72, [1, 10, 37, 54, 56, 58]),
(76, [1, 20, 39, 42, 58, 68]),
(76, [2, 10, 29, 48, 67, 72]),
(76, [2, 21, 40, 46, 59, 60]),
(76, [3, 22, 41, 50, 52, 60]),
(76, [4, 9, 28, 47, 66, 74]),
(78, [1, 6, 12, 64, 75, 76]),
(78, [1, 6, 42, 45, 64, 76]),
(78, [1, 7, 31, 61, 64, 70]),
(78, [1, 7, 40, 43, 70, 73]),
(78, [1, 7, 44, 49, 59, 74])]
def decList : List (Nat × List Nat) :=
[(32, [1, 1, 9, 17, 20, 24, 25, 31]),
(32, [1, 3, 8, 11, 19, 27, 28, 31]),
(32, [1, 3, 9, 17, 20, 24, 25, 29]),
(32, [1, 4, 5, 13, 21, 24, 29, 31]),
(32, [1, 5, 9, 17, 20, 24, 25, 27]),
(33, [1, 1, 4, 16, 22, 25, 31, 32]),
(33, [1, 2, 4, 16, 22, 25, 31, 31]),
(33, [1, 2, 8, 11, 17, 29, 32, 32]),
(33, [1, 3, 4, 16, 22, 25, 30, 31]),
(33, [1, 4, 4, 16, 22, 25, 29, 31]),
(62, [1, 31, 33, 35, 39, 47]),
(62, [3, 17, 31, 37, 43, 55]),
(62, [5, 9, 31, 41, 49, 51]),
(62, [7, 19, 25, 31, 45, 59]),
(62, [11, 13, 21, 31, 53, 57]),
(70, [1, 29, 35, 43, 45, 57])]
set_option maxRecDepth 200000 in
theorem indec_all : indList.all (fun p => indec p.1 p.2) = true := rfl
set_option maxRecDepth 200000 in
theorem dec_all : decList.all (fun p => !(indec p.1 p.2)) = true := rfl
set_option maxRecDepth 200000 in
theorem counts : indList.length = 110 ∧ decList.length = 16 := ⟨rfl, rfl⟩
end Indecomp2
#print axioms Indecomp2.indec_all
#print axioms Indecomp2.dec_all
#print axioms Indecomp2.counts
lean_all/hodge/InductiveStep.lean
/-
hodge/InductiveStep.lean — T41 cycle 67: one step of Shioda's inductive structure, at the character
level, for every m.
Lean 4 core plus hodge/FermatGens (tsum), ESChain (rem_eq_mod), QRChain, lib/Semi (lib_nat).
For a unit t (m ∤ t·x when m ∤ x) and pieces A, B with connecting characters c, s (c + s = m, m ∤ t·c):
pair_m ⟨tc⟩ + ⟨ts⟩ = m
tsum_append tsum(A ++ B) = tsum A + tsum B
step_hodge 2·tsum(c :: A) = (|A|+1)m and 2·tsum(s :: B) = (|B|+1)m ⇒ 2·tsum(A ++ B) = (|A|+|B|)m
i.e. if (A, c) is a Hodge character of X^r and (B, s) of X^s, then A ⊔ B is Hodge on X^{r+s}: the
combinatorial half of Shioda's inductive structure (the cycle-theoretic half: the rational map
X^r × X^s ⇢ X^{r+s} carries algebraic cycles to algebraic cycles — cited).
-/
import hodge.FermatGens
import ESChain
import lib.Semi
namespace InductiveStep
open FTAChain FrobChain QRChain ESChain FermatGens
theorem tsum_append (m t : Nat) : ∀ A B : List Nat, tsum m t (A ++ B) = tsum m t A + tsum m t B
| [], B => by show tsum m t B = 0 + tsum m t B; rw [Nat.zero_add]
| a :: A, B => by
show (t * a) % m + tsum m t (A ++ B) = ((t * a) % m + tsum m t A) + tsum m t B
rw [tsum_append m t A B, Nat.add_assoc]
theorem pair_m (m' t c s : Nat) (hcs : c + s = m' + 1)
(hc : ¬ Dv (m' + 1) (t * c)) :
(t * c) % (m' + 1) + (t * s) % (m' + 1) = m' + 1 := by
rw [← rem_eq_mod, ← rem_eq_mod]
have hx := rem_lt' m' (t * c)
have hy := rem_lt' m' (t * s)
have z : rem (m' + 1) (rem (m' + 1) (t * c) + rem (m' + 1) (t * s)) = 0 := by
rw [rem_add_congr2 m' _ (t * c) _ (t * s) (rem_idem m' _) (rem_idem m' _)]
apply rem_zero_of_dv
exact ⟨t, by rw [← nleft_distrib, hcs, nmul_comm]⟩
have hx0 : rem (m' + 1) (t * c) ≠ 0 := fun e => hc (dv_of_rem_zero _ _ e)
cases dv_of_rem_zero _ _ z with
| intro q hq =>
match q, hq with
| 0, hq =>
rw [Nat.zero_mul] at hq
exact absurd (Nat.eq_zero_of_add_eq_zero_right hq) hx0
| 1, hq => rw [hq, Nat.one_mul]
| q + 2, hq =>
have l : rem (m' + 1) (t * c) + rem (m' + 1) (t * s) < (m' + 1) + (m' + 1) := Nat.add_lt_add hx hy
have g : (m' + 1) + (m' + 1) ≤ (q + 2) * (m' + 1) := by
have e : (q + 2) * (m' + 1) = q * (m' + 1) + ((m' + 1) + (m' + 1)) := by lib_nat
rw [e]; exact Nat.le_add_left _ _
rw [hq] at l
exact absurd (Nat.lt_of_lt_of_le l g) (Nat.lt_irrefl _)
/-- **Inductive step at character level.** -/
theorem step_hodge (m' t c s : Nat) (A B : List Nat) (hcs : c + s = m' + 1)
(hc : ¬ Dv (m' + 1) (t * c))
(hA : tsum (m' + 1) t (c :: A) + tsum (m' + 1) t (c :: A) = (A.length + 1) * (m' + 1))
(hB : tsum (m' + 1) t (s :: B) + tsum (m' + 1) t (s :: B) = (B.length + 1) * (m' + 1)) :
tsum (m' + 1) t (A ++ B) + tsum (m' + 1) t (A ++ B) = (A.length + B.length) * (m' + 1) := by
have pm := pair_m m' t c s hcs hc
rw [tsum_append]
have hA' : tsum (m' + 1) t (c :: A) = (t * c) % (m' + 1) + tsum (m' + 1) t A := rfl
have hB' : tsum (m' + 1) t (s :: B) = (t * s) % (m' + 1) + tsum (m' + 1) t B := rfl
rw [hA'] at hA; rw [hB'] at hB
revert hA hB pm
generalize (t * c) % (m' + 1) = x
generalize (t * s) % (m' + 1) = y
generalize tsum (m' + 1) t A = a
generalize tsum (m' + 1) t B = b
generalize A.length = la
generalize B.length = lb
generalize m' + 1 = M
intro hA hB pm
-- (a+b)+(a+b) + (M + M) = (la+lb) M + (M + M)
apply add_left_cancel' (M + M)
have e1 : (M + M) + ((a + b) + (a + b)) = ((x + a) + (x + a)) + ((y + b) + (y + b)) := by
rw [← pm]; lib_nat
rw [e1, hA, hB]; lib_nat
end InductiveStep
#print axioms InductiveStep.tsum_append
#print axioms InductiveStep.pair_m
#print axioms InductiveStep.step_hodge
lean_all/hodge/LcsSplit.lean
/-
hodge/LcsSplit.lean — T41 (goal G865f, tool): splitting a large rank certificate B·A = d·I into row blocks, so that
each block is a separate rfl check:
lcs_append lcs n (B₁ ++ B₂) A = lcs n B₁ A ++ lcs n B₂ A,
cert_split lcs n B₁ A = S₁, lcs n B₂ A = S₂, S₁ ++ S₂ = S ⇒ lcs n (B₁ ++ B₂) A = S.
Lean 4 core plus hodge/MailletLin.
-/
import hodge.MailletLin
namespace LcsSplit
open MailletLin
theorem lcs_append (n : Nat) (A : List (List Int)) : ∀ B₁ B₂ : List (List Int),
lcs n (B₁ ++ B₂) A = lcs n B₁ A ++ lcs n B₂ A
| [], _ => rfl
| b :: bs, B₂ => by
show lc n b A :: lcs n (bs ++ B₂) A = lc n b A :: (lcs n bs A ++ lcs n B₂ A)
rw [lcs_append n A bs B₂]
theorem cert_split (n : Nat) (A B₁ B₂ S₁ S₂ S : List (List Int)) (h₁ : lcs n B₁ A = S₁) (h₂ : lcs n B₂ A = S₂)
(h : S₁ ++ S₂ = S) : lcs n (B₁ ++ B₂) A = S := by
rw [lcs_append, h₁, h₂, h]
end LcsSplit
#print axioms LcsSplit.lcs_append
#print axioms LcsSplit.cert_split
lean_all/hodge/LegendreHalf.lean
/-
hodge/LegendreHalf.lean — T41 (goal G529b-q, instantiation): for a prime p = 2m + 1 with m = 2j + 1 odd
(p ≡ 3 mod 4) and the quadratic character given by Euler's criterion, f(a) = leg((a mod p)^m) ∈ {0, ±1},
Σ_{b<p} b·f(b) ≠ 0 (B_{1,χ} ≠ 0 for the quadratic character mod p ≡ 3 (mod 4)).
Pieces:
tri lemmas on a commutative ring, the set {0, 1, −1} is closed under ·, −, and leg is multiplicative there
pw_neg_odd (−x)^(2j+1) = −x^(2j+1)
f_vals 1 ≤ a ≤ m ⇒ f(a) = ±1 (lib/Euler.euler_pm)
f_odd a + b = p ⇒ f(b) = −f(a)
f_two f(2a) = f(2)·f(a)
legendre_ne Σ_{b<p} b·f(b) ≠ 0 (hodge/HalfPair3.chi_ident, hodge/HalfPair4.half_ne, weighted_ne)
Lean 4 core plus hodge/HalfPair3, hodge/HalfPair4, lib/Euler (copied from lib_shared).
-/
import hodge.HalfPair3
import hodge.HalfPair4
import lib.Euler
namespace LegendreHalf
open DetChain NSChain LibRing LibMod LibZp LibInt
/-! ## Three-valued elements of a commutative ring -/
section Tri
variable {R : Type} (K : CRing R)
/-- y ∈ {0, 1, −1} -/
def Tri (y : R) : Prop := y = K.zero ∨ y = K.one ∨ y = K.neg K.one
theorem tri_mul {y z : R} (hy : Tri K y) (hz : Tri K z) : Tri K (K.mul y z) := by
rcases hy with h | h | h <;> rcases hz with g | g | g <;> rw [h, g]
· exact Or.inl (by lib_ring)
· exact Or.inl (by lib_ring)
· exact Or.inl (by lib_ring)
· exact Or.inl (by lib_ring)
· exact Or.inr (Or.inl (by lib_ring))
· exact Or.inr (Or.inr (by lib_ring))
· exact Or.inl (by lib_ring)
· exact Or.inr (Or.inr (by lib_ring))
· exact Or.inr (Or.inl (by lib_ring))
theorem tri_neg {y : R} (hy : Tri K y) : Tri K (K.neg y) := by
rcases hy with h | h | h <;> rw [h]
· exact Or.inl (by lib_ring)
· exact Or.inr (Or.inr rfl)
· exact Or.inr (Or.inl (by lib_ring))
/-- (−1)^(2j) = 1 -/
theorem pw_negone_even : ∀ j, pw K (K.neg K.one) (2 * j) = K.one
| 0 => rfl
| j + 1 => by
show pw K (K.neg K.one) (2 * j + 1 + 1) = K.one
show K.mul (K.mul (pw K (K.neg K.one) (2 * j)) (K.neg K.one)) (K.neg K.one) = K.one
rw [pw_negone_even j]; lib_ring
theorem pw_neg_odd (x : R) (j : Nat) : pw K (K.neg x) (2 * j + 1) = K.neg (pw K x (2 * j + 1)) := by
have e : K.neg x = K.mul (K.neg K.one) x := by lib_ring
rw [e, LibEuler.mul_pw_r K]
show K.mul (K.mul (pw K (K.neg K.one) (2 * j)) (K.neg K.one)) (pw K x (2 * j + 1)) = K.neg (pw K x (2 * j + 1))
rw [pw_negone_even K j]; lib_ring
theorem pw_zero_succ (n : Nat) : pw K K.zero (n + 1) = K.zero := by
show K.mul (pw K K.zero n) K.zero = K.zero
lib_ring
theorem neg_unique (x y : R) (h : K.add x y = K.zero) : y = K.neg x :=
calc y = K.add (K.add x y) (K.neg x) := by lib_ring
_ = K.add K.zero (K.neg x) := by rw [h]
_ = K.neg x := by lib_ring
end Tri
/-! ## The Legendre value -/
/-- 0 ↦ 0, 1 ↦ 1, anything else ↦ −1 (non-overlapping arms) -/
def legV : Nat → Int
| 0 => 0
| 1 => 1
| _ + 2 => -1
section Leg
variable (j : Nat)
/-- k = p − 1 = 2m, m = 2j + 1 -/
abbrev kk : Nat := 2 * (2 * j + 1)
theorem kk_eq : kk j = 4 * j + 2 := by
show 2 * (2 * j + 1) = 4 * j + 2
lib_nat
theorem one_lt : 1 < kk j + 1 := by
rw [kk_eq]; exact Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _))
theorem two_lt : 2 < kk j + 1 := by
rw [kk_eq]; exact Nat.succ_le_succ (Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _)))
def leg (x : ZN (kk j)) : Int := legV x.val
theorem leg_zero : leg j (znR (kk j)).zero = 0 := rfl
theorem leg_one : leg j (znR (kk j)).one = 1 := by
show legV (md (kk j + 1) 1) = 1
rw [md_of_lt (pos (kk j)) (one_lt j)] <;> rfl
theorem negone_val : ((znR (kk j)).neg (znR (kk j)).one).val = 4 * j + 2 := by
show md (kk j + 1) (kk j * md (kk j + 1) 1) = 4 * j + 2
rw [md_of_lt (pos (kk j)) (one_lt j), show kk j * 1 = kk j by lib_nat,
md_of_lt (pos (kk j)) (Nat.lt_succ_self (kk j)), kk_eq]
theorem leg_negone : leg j ((znR (kk j)).neg (znR (kk j)).one) = -1 := by
show legV ((znR (kk j)).neg (znR (kk j)).one).val = -1
rw [negone_val] <;> rfl
theorem leg_mul {y z : ZN (kk j)} (hy : Tri (znR (kk j)) y) (hz : Tri (znR (kk j)) z) :
leg j ((znR (kk j)).mul y z) = leg j y * leg j z := by
rcases hy with h | h | h <;> rcases hz with g | g | g <;> rw [h, g]
· rw [show (znR (kk j)).mul (znR (kk j)).zero (znR (kk j)).zero = (znR (kk j)).zero by lib_ring, leg_zero] <;> rfl
· rw [show (znR (kk j)).mul (znR (kk j)).zero (znR (kk j)).one = (znR (kk j)).zero by lib_ring, leg_zero, leg_one] <;> rfl
· rw [show (znR (kk j)).mul (znR (kk j)).zero ((znR (kk j)).neg (znR (kk j)).one) = (znR (kk j)).zero by lib_ring,
leg_zero, leg_negone] <;> rfl
· rw [show (znR (kk j)).mul (znR (kk j)).one (znR (kk j)).zero = (znR (kk j)).zero by lib_ring, leg_zero, leg_one] <;> rfl
· rw [show (znR (kk j)).mul (znR (kk j)).one (znR (kk j)).one = (znR (kk j)).one by lib_ring, leg_one] <;> rfl
· rw [show (znR (kk j)).mul (znR (kk j)).one ((znR (kk j)).neg (znR (kk j)).one) = (znR (kk j)).neg (znR (kk j)).one
by lib_ring, leg_one, leg_negone] <;> rfl
· rw [show (znR (kk j)).mul ((znR (kk j)).neg (znR (kk j)).one) (znR (kk j)).zero = (znR (kk j)).zero by lib_ring,
leg_zero, leg_negone] <;> rfl
· rw [show (znR (kk j)).mul ((znR (kk j)).neg (znR (kk j)).one) (znR (kk j)).one = (znR (kk j)).neg (znR (kk j)).one
by lib_ring, leg_one, leg_negone] <;> rfl
· rw [show (znR (kk j)).mul ((znR (kk j)).neg (znR (kk j)).one) ((znR (kk j)).neg (znR (kk j)).one) = (znR (kk j)).one
by lib_ring, leg_one, leg_negone] <;> rfl
theorem leg_neg {y : ZN (kk j)} (hy : Tri (znR (kk j)) y) : leg j ((znR (kk j)).neg y) = -leg j y := by
rcases hy with h | h | h <;> rw [h]
· rw [show (znR (kk j)).neg (znR (kk j)).zero = (znR (kk j)).zero by lib_ring, leg_zero] <;> rfl
· rw [leg_one, leg_negone]
· rw [show (znR (kk j)).neg ((znR (kk j)).neg (znR (kk j)).one) = (znR (kk j)).one by lib_ring, leg_one, leg_negone] <;> rfl
/-- the power x^m, m = 2j + 1 -/
def ev (a : Nat) : ZN (kk j) := pw (znR (kk j)) (mk (kk j) a) (2 * j + 1)
/-- the quadratic character by Euler's criterion -/
def f (a : Nat) : Int := leg j (ev j a)
theorem ev_tri (hp : Prime1 (kk j)) (a : Nat) : Tri (znR (kk j)) (ev j a) := by
cases hv : (mk (kk j) a).val with
| zero =>
have e : mk (kk j) a = (znR (kk j)).zero := eq_zero_of_val (kk j) hv
exact Or.inl (by unfold ev; rw [e]; exact pw_zero_succ (znR (kk j)) (2 * j))
| succ v =>
have hx : mk (kk j) a ≠ (znR (kk j)).zero := fun h => by
rw [val_of_eq_zero (kk j) h] at hv; exact Nat.noConfusion hv
exact Or.inr (LibEuler.euler_pm (2 * j + 1) hp _ hx)
theorem f_zero : f j 0 = 0 := by
show leg j (pw (znR (kk j)) (znR (kk j)).zero (2 * j + 1)) = 0
rw [pw_zero_succ (znR (kk j)) (2 * j)] <;> rfl
theorem f_vals (hp : Prime1 (kk j)) (a : Nat) (h1 : 1 ≤ a) (h2 : a ≤ 2 * j + 1) : f j a = 1 ∨ f j a = -1 := by
have hm : 2 * j + 1 ≤ kk j := by
show 2 * j + 1 ≤ 2 * (2 * j + 1)
rw [show 2 * (2 * j + 1) = (2 * j + 1) + (2 * j + 1) by lib_nat]
exact Nat.le_add_right _ _
have hlt : a < kk j + 1 := Nat.lt_succ_of_le (Nat.le_trans h2 hm)
have hx : mk (kk j) a ≠ (znR (kk j)).zero := fun h => by
have e := val_of_eq_zero (kk j) h
have e2 : (mk (kk j) a).val = a := md_of_lt (pos (kk j)) hlt
rw [e2] at e; rw [e] at h1; exact Nat.not_succ_le_zero 0 h1
cases LibEuler.euler_pm (2 * j + 1) hp _ hx with
| inl e => exact Or.inl (by unfold f ev; rw [e]; exact leg_one j)
| inr e => exact Or.inr (by unfold f ev; rw [e]; exact leg_negone j)
theorem mk_add (a b : Nat) : (znR (kk j)).add (mk (kk j) a) (mk (kk j) b) = mk (kk j) (a + b) :=
ext (kk j) (by
show md (kk j + 1) (md (kk j + 1) a + md (kk j + 1) b) = md (kk j + 1) (a + b)
rw [md_add_l (pos (kk j)), md_add_r (pos (kk j))])
theorem mk_mul (a b : Nat) : (znR (kk j)).mul (mk (kk j) a) (mk (kk j) b) = mk (kk j) (a * b) :=
ext (kk j) (by
show md (kk j + 1) (md (kk j + 1) a * md (kk j + 1) b) = md (kk j + 1) (a * b)
rw [md_mul_l (pos (kk j)), md_mul_r (pos (kk j))])
theorem f_odd (hp : Prime1 (kk j)) (a b : Nat) (h : a + b = 2 * (2 * j + 1) + 1) : f j b = -f j a := by
have hs : (znR (kk j)).add (mk (kk j) a) (mk (kk j) b) = (znR (kk j)).zero := by
rw [mk_add, h]
exact ext (kk j) (md_zero_of_dvd (pos (kk j)) ⟨1, by show 2 * (2 * j + 1) + 1 = (2 * (2 * j + 1) + 1) * 1; lib_nat⟩)
have hb := neg_unique (znR (kk j)) _ _ hs
show leg j (pw (znR (kk j)) (mk (kk j) b) (2 * j + 1)) = -leg j (pw (znR (kk j)) (mk (kk j) a) (2 * j + 1))
rw [hb, pw_neg_odd]
exact leg_neg j (ev_tri j hp a)
theorem f_two (hp : Prime1 (kk j)) (a : Nat) : f j (2 * a) = f j 2 * f j a := by
show leg j (pw (znR (kk j)) (mk (kk j) (2 * a)) (2 * j + 1))
= leg j (pw (znR (kk j)) (mk (kk j) 2) (2 * j + 1)) * leg j (pw (znR (kk j)) (mk (kk j) a) (2 * j + 1))
rw [← mk_mul, LibEuler.mul_pw_r]
exact leg_mul j (ev_tri j hp 2) (ev_tri j hp a)
end Leg
/-! ## Over Z -/
theorem castN_int : ∀ n : Nat, castN intR n = Int.ofNat n
| 0 => rfl
| n + 1 => by
show intR.add intR.one (castN intR n) = Int.ofNat (n + 1)
rw [castN_int n]
show (1 : Int) + Int.ofNat n = Int.ofNat n + 1
lib_int
theorem castN_inj (a b : Nat) (h : castN intR a = castN intR b) : a = b := by
rw [castN_int, castN_int] at h; exact Int.ofNat.inj h
theorem f2_sq (j : Nat) (hp : Prime1 (kk j)) : f j 2 * f j 2 = 1 := by
have hx : mk (kk j) 2 ≠ (znR (kk j)).zero := fun h => by
have e1 := val_of_eq_zero (kk j) h
rw [show (mk (kk j) 2).val = 2 from md_of_lt (pos (kk j)) (two_lt j)] at e1
exact Nat.noConfusion e1
show leg j (ev j 2) * leg j (ev j 2) = 1
unfold ev
cases LibEuler.euler_pm (2 * j + 1) hp _ hx with
| inl e => rw [e, leg_one] <;> rfl
| inr e => rw [e, leg_negone] <;> rfl
/-- **B_{1,χ} ≠ 0 for the quadratic character mod p ≡ 3 (mod 4).** p = 2(2j + 1) + 1 prime ⇒ Σ_{b<p} b·(b/p) ≠ 0. -/
theorem legendre_ne (j : Nat) (hp : Prime1 (kk j)) :
sumN intR (fun b => intR.mul (castN intR b) (f j b)) (2 * (2 * j + 1) + 1) ≠ intR.zero := by
have hid := HalfPair3.chi_ident intR (2 * j + 1) (f j) (castN intR) (f j 2) (f j 2) (castN intR (2 * (2 * j + 1) + 1))
(f2_sq j hp) (f_zero j) (fun a b h => f_odd j hp a b h)
(fun a b h => by
rw [← h, castN_int, castN_int, castN_int]
show Int.ofNat b = Int.ofNat a + Int.ofNat b + -Int.ofNat a
lib_int)
(fun a => f_two j hp a)
(fun a => by
rw [castN_int, castN_int]
exact congrArg Int.ofNat (show 2 * a = a + a by lib_nat))
have hH := HalfPair4.half_ne intR (f j) (f_zero j) j (fun a h1 h2 => f_vals j hp a h1 h2) castN_inj
have hP : castN intR (2 * (2 * j + 1) + 1) ≠ intR.zero := by
rw [castN_int]; exact fun h => Nat.noConfusion (Int.ofNat.inj h)
exact HalfPair4.weighted_ne intR _ _ _ _ hid int_noZD hP hH
end LegendreHalf
#print axioms LegendreHalf.Tri
#print axioms LegendreHalf.tri_mul
#print axioms LegendreHalf.tri_neg
#print axioms LegendreHalf.pw_negone_even
#print axioms LegendreHalf.pw_neg_odd
#print axioms LegendreHalf.pw_zero_succ
#print axioms LegendreHalf.neg_unique
#print axioms LegendreHalf.kk_eq
#print axioms LegendreHalf.leg_one
#print axioms LegendreHalf.negone_val
#print axioms LegendreHalf.leg_negone
#print axioms LegendreHalf.leg_mul
#print axioms LegendreHalf.leg_neg
#print axioms LegendreHalf.ev_tri
#print axioms LegendreHalf.f_zero
#print axioms LegendreHalf.f_vals
#print axioms LegendreHalf.mk_add
#print axioms LegendreHalf.mk_mul
#print axioms LegendreHalf.f_odd
#print axioms LegendreHalf.f_two
#print axioms LegendreHalf.castN_int
#print axioms LegendreHalf.castN_inj
#print axioms LegendreHalf.f2_sq
#print axioms LegendreHalf.legendre_ne
lean_all/hodge/Len2Pair.lean
/-
hodge/Len2Pair.lean — T41 cycle 1369 (goal G808 — done): balanced length-2 characters are complementary pairs,
every degree m ≥ 2. If 0 < a, b < m and [a, b] is balanced, then
len2_pair a + b = m
(the unit t = 1: 2(⟨a⟩ + ⟨b⟩) = 2m). With PairsSplit.bal_of_pairs the converse holds, so the length-2 classification
is complete for every m; with PairPeel this is the base of the pair peeling.
Lean 4 core plus hodge/FamIndec3 (bal_unit), hodge/APPairIrrGen (gcd_one), hodge/ModHand (mod_lt'),
hodge/BalAppend (add_cancel).
-/
import hodge.FamIndec3
import hodge.APPairIrrGen
import hodge.ModHand
import hodge.BalAppend
namespace Len2Pair
open Indecomp
theorem double_cancel : ∀ x y : Nat, x + x = y + y → x = y
| 0, 0, _ => rfl
| 0, y + 1, h => by
have h' : 0 = (y + y + 1) + 1 := by rw [show y + 1 + (y + 1) = (y + y + 1) + 1 by lib_nat] at h; exact h
exact Nat.noConfusion h'
| x + 1, 0, h => by
have h' : (x + x + 1) + 1 = 0 := by rw [show x + 1 + (x + 1) = (x + x + 1) + 1 by lib_nat] at h; exact h
exact Nat.noConfusion h'
| x + 1, y + 1, h => by
have h' : (x + x) + 2 = (y + y) + 2 := by
rw [show x + 1 + (x + 1) = (x + x) + 2 by lib_nat, show y + 1 + (y + 1) = (y + y) + 2 by lib_nat] at h; exact h
have := double_cancel x y (Nat.succ.inj (Nat.succ.inj h'))
rw [this]
theorem len2_pair (m a b : Nat) (hm : 1 < m) (ha : a < m) (hb : b < m) (hbal : bal m [a, b] = true) : a + b = m := by
have hu := FamIndec3.bal_unit m 1 [a, b] hbal hm (APPairIrrGen.gcd_one m)
have e : tsum m 1 [a, b] = a + b := by
show (1 * a) % m + ((1 * b) % m + 0) = a + b
rw [Nat.one_mul, Nat.one_mul, ModHand.mod_lt' a m ha, ModHand.mod_lt' b m hb, Nat.add_zero]
rw [e] at hu
have hu' : (a + b) + (a + b) = m + m := by rw [hu]; show (0 + 1 + 1) * m = m + m; lib_nat
exact double_cancel _ _ hu'
end Len2Pair
#print axioms Len2Pair.double_cancel
#print axioms Len2Pair.len2_pair
lean_all/hodge/Len3Class.lean
/-
hodge/Len3Class.lean — T41 cycle 735 (goal G448): complete list of balanced length-3 characters (x ≤ y ≤ z,
entries in (0, m)) for every 3 ≤ m ≤ 24, by rfl. Odd m: none (OddLength). Even m: the Triple family
[a, h+a, 2h−2a], the m/2-entries {h} ⊔ pair, and sporadic ones only at m = 12, 14, 18, 20, 24.
Lean 4 core plus hodge/Indecomp (bal), rfl.
-/
import hodge.Indecomp
namespace Len3Class
open Indecomp
def zs (m x y : Nat) : List (List Nat) := ((List.range m).filter (fun z => Nat.ble y z && Nat.ble 1 z)).map (fun z => [x, y, z])
def ys (m x : Nat) : List (List Nat) := (((List.range m).filter (fun y => Nat.ble x y)).map (fun y => zs m x y)).flatten
def triples (m : Nat) : List (List Nat) := (((List.range m).filter (fun x => Nat.ble 1 x)).map (fun x => ys m x)).flatten
def cls (m : Nat) : List (List Nat) := (triples m).filter (bal m)
set_option maxRecDepth 100000 in
theorem cls3 : cls 3 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls4 : cls 4 = [[1, 2, 3], [2, 2, 2]] := rfl
set_option maxRecDepth 100000 in
theorem cls5 : cls 5 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls6 : cls 6 = [[1, 3, 5], [1, 4, 4], [2, 2, 5], [2, 3, 4], [3, 3, 3]] := rfl
set_option maxRecDepth 100000 in
theorem cls7 : cls 7 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls8 : cls 8 = [[1, 4, 7], [1, 5, 6], [2, 3, 7], [2, 4, 6], [3, 4, 5], [4, 4, 4]] := rfl
set_option maxRecDepth 100000 in
theorem cls9 : cls 9 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls10 : cls 10 = [[1, 5, 9], [1, 6, 8], [2, 4, 9], [2, 5, 8], [2, 6, 7], [3, 4, 8], [3, 5, 7], [4, 5, 6], [5, 5, 5]] := rfl
set_option maxRecDepth 100000 in
theorem cls11 : cls 11 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls12 : cls 12 = [[1, 6, 11], [1, 7, 10], [1, 8, 9], [2, 5, 11], [2, 6, 10], [2, 8, 8], [3, 4, 11], [3, 6, 9], [3, 7, 8], [4, 4, 10], [4, 5, 9], [4, 6, 8], [5, 6, 7], [6, 6, 6]] := rfl
set_option maxRecDepth 100000 in
theorem cls13 : cls 13 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls14 : cls 14 = [[1, 7, 13], [1, 8, 12], [1, 9, 11], [2, 6, 13], [2, 7, 12], [2, 9, 10], [3, 5, 13], [3, 7, 11], [3, 8, 10], [4, 5, 12], [4, 6, 11], [4, 7, 10], [5, 7, 9], [6, 7, 8], [7, 7, 7]] := rfl
set_option maxRecDepth 100000 in
theorem cls15 : cls 15 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls16 : cls 16 = [[1, 8, 15], [1, 9, 14], [2, 7, 15], [2, 8, 14], [2, 10, 12], [3, 8, 13], [3, 10, 11], [4, 6, 14], [4, 8, 12], [5, 6, 13], [5, 8, 11], [6, 8, 10], [7, 8, 9], [8, 8, 8]] := rfl
set_option maxRecDepth 100000 in
theorem cls17 : cls 17 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls18 : cls 18 = [[1, 9, 17], [1, 10, 16], [1, 12, 14], [2, 8, 17], [2, 9, 16], [2, 11, 14], [2, 12, 13], [3, 9, 15], [3, 12, 12], [4, 6, 17], [4, 7, 16], [4, 9, 14], [4, 10, 13], [5, 6, 16], [5, 8, 14], [5, 9, 13], [6, 6, 15], [6, 9, 12], [6, 10, 11], [7, 8, 12], [7, 9, 11], [8, 9, 10], [9, 9, 9]] := rfl
set_option maxRecDepth 100000 in
theorem cls19 : cls 19 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls20 : cls 20 = [[1, 10, 19], [1, 11, 18], [1, 12, 17], [1, 13, 16], [2, 9, 19], [2, 10, 18], [2, 12, 16], [3, 8, 19], [3, 10, 17], [3, 11, 16], [3, 13, 14], [4, 7, 19], [4, 8, 18], [4, 9, 17], [4, 10, 16], [4, 12, 14], [5, 10, 15], [6, 7, 17], [6, 8, 16], [6, 10, 14], [7, 10, 13], [7, 11, 12], [8, 9, 13], [8, 10, 12], [9, 10, 11], [10, 10, 10]] := rfl
set_option maxRecDepth 100000 in
theorem cls21 : cls 21 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls22 : cls 22 = [[1, 11, 21], [1, 12, 20], [2, 10, 21], [2, 11, 20], [2, 13, 18], [3, 11, 19], [3, 14, 16], [4, 9, 20], [4, 11, 18], [4, 14, 15], [5, 11, 17], [5, 12, 16], [6, 8, 19], [6, 10, 17], [6, 11, 16], [7, 8, 18], [7, 11, 15], [8, 11, 14], [9, 11, 13], [10, 11, 12], [11, 11, 11]] := rfl
set_option maxRecDepth 100000 in
theorem cls23 : cls 23 = [] := rfl
set_option maxRecDepth 100000 in
theorem cls24 : cls 24 = [[1, 12, 23], [1, 13, 22], [1, 16, 19], [1, 17, 18], [2, 11, 23], [2, 12, 22], [2, 14, 20], [2, 16, 18], [3, 12, 21], [3, 15, 18], [4, 10, 22], [4, 12, 20], [4, 16, 16], [5, 8, 23], [5, 12, 19], [5, 13, 18], [5, 14, 17], [6, 7, 23], [6, 8, 22], [6, 9, 21], [6, 11, 19], [6, 12, 18], [6, 14, 16], [7, 10, 19], [7, 12, 17], [7, 13, 16], [8, 8, 20], [8, 10, 18], [8, 11, 17], [8 -- (+72 chars; full line in the Zenodo source)
end Len3Class
#print axioms Len3Class.cls3
#print axioms Len3Class.cls4
#print axioms Len3Class.cls5
#print axioms Len3Class.cls6
#print axioms Len3Class.cls7
#print axioms Len3Class.cls8
#print axioms Len3Class.cls9
#print axioms Len3Class.cls10
#print axioms Len3Class.cls11
#print axioms Len3Class.cls12
#print axioms Len3Class.cls13
#print axioms Len3Class.cls14
#print axioms Len3Class.cls15
#print axioms Len3Class.cls16
#print axioms Len3Class.cls17
#print axioms Len3Class.cls18
#print axioms Len3Class.cls19
#print axioms Len3Class.cls20
#print axioms Len3Class.cls21
#print axioms Len3Class.cls22
#print axioms Len3Class.cls23
#print axioms Len3Class.cls24
lean_all/hodge/Len4Class.lean
/-
hodge/Len4Class.lean — T41 cycle 738 (goal G451): complete list of balanced length-4 characters
(x ≤ y ≤ z ≤ w, entries in (0, m)) for every 3 ≤ m ≤ 16, by rfl.
Lean 4 core plus hodge/Len3Class (list builders), hodge/Indecomp (bal), rfl.
-/
import hodge.Len3Class
namespace Len4Class
open Indecomp Len3Class
def quads (m : Nat) : List (List Nat) :=
(((List.range m).filter (fun x => Nat.ble 1 x)).map (fun x => ((triples m).filter (fun l => match l with
| y :: _ => Nat.ble x y
| [] => false)).map (fun l => x :: l))).flatten
def cls4 (m : Nat) : List (List Nat) := (quads m).filter (bal m)
set_option maxRecDepth 100000 in
theorem c4_3 : cls4 3 = [[1, 1, 2, 2]] := rfl
set_option maxRecDepth 100000 in
theorem c4_4 : cls4 4 = [[1, 1, 3, 3], [1, 2, 2, 3], [2, 2, 2, 2]] := rfl
set_option maxRecDepth 100000 in
theorem c4_5 : cls4 5 = [[1, 1, 4, 4], [1, 2, 3, 4], [2, 2, 3, 3]] := rfl
set_option maxRecDepth 100000 in
theorem c4_6 : cls4 6 = [[1, 1, 5, 5], [1, 2, 4, 5], [1, 3, 3, 5], [1, 3, 4, 4], [2, 2, 3, 5], [2, 2, 4, 4], [2, 3, 3, 4], [3, 3, 3, 3]] := rfl
set_option maxRecDepth 100000 in
theorem c4_7 : cls4 7 = [[1, 1, 6, 6], [1, 2, 5, 6], [1, 3, 4, 6], [2, 2, 5, 5], [2, 3, 4, 5], [3, 3, 4, 4]] := rfl
set_option maxRecDepth 100000 in
theorem c4_8 : cls4 8 = [[1, 1, 7, 7], [1, 2, 6, 7], [1, 3, 5, 7], [1, 4, 4, 7], [1, 4, 5, 6], [2, 2, 6, 6], [2, 3, 4, 7], [2, 3, 5, 6], [2, 4, 4, 6], [3, 3, 5, 5], [3, 4, 4, 5], [4, 4, 4, 4]] := rfl
set_option maxRecDepth 100000 in
theorem c4_9 : cls4 9 = [[1, 1, 8, 8], [1, 2, 7, 8], [1, 3, 6, 8], [1, 4, 5, 8], [1, 4, 6, 7], [2, 2, 7, 7], [2, 3, 5, 8], [2, 3, 6, 7], [2, 4, 5, 7], [3, 3, 6, 6], [3, 4, 5, 6], [4, 4, 5, 5]] := rfl
set_option maxRecDepth 100000 in
theorem c4_10 : cls4 10 = [[1, 1, 9, 9], [1, 2, 8, 9], [1, 3, 7, 9], [1, 3, 8, 8], [1, 4, 6, 9], [1, 5, 5, 9], [1, 5, 6, 8], [1, 6, 6, 7], [2, 2, 7, 9], [2, 2, 8, 8], [2, 3, 7, 8], [2, 4, 5, 9], [2, 4, 6, 8], [2, 5, 5, 8], [2, 5, 6, 7], [3, 3, 7, 7], [3, 4, 4, 9], [3, 4, 5, 8], [3, 4, 6, 7], [3, 5, 5, 7], [4, 4, 6, 6], [4, 5, 5, 6], [5, 5, 5, 5]] := rfl
set_option maxRecDepth 100000 in
theorem c4_11 : cls4 11 = [[1, 1, 10, 10], [1, 2, 9, 10], [1, 3, 8, 10], [1, 4, 7, 10], [1, 5, 6, 10], [2, 2, 9, 9], [2, 3, 8, 9], [2, 4, 7, 9], [2, 5, 6, 9], [3, 3, 8, 8], [3, 4, 7, 8], [3, 5, 6, 8], [4, 4, 7, 7], [4, 5, 6, 7], [5, 5, 6, 6]] := rfl
set_option maxRecDepth 100000 in
theorem c4_12 : cls4 12 = [[1, 1, 11, 11], [1, 2, 10, 11], [1, 3, 9, 11], [1, 4, 8, 11], [1, 4, 9, 10], [1, 5, 7, 11], [1, 5, 9, 9], [1, 6, 6, 11], [1, 6, 7, 10], [1, 6, 8, 9], [1, 7, 8, 8], [2, 2, 10, 10], [2, 3, 8, 11], [2, 3, 9, 10], [2, 4, 8, 10], [2, 5, 6, 11], [2, 5, 7, 10], [2, 5, 8, 9], [2, 6, 6, 10], [2, 6, 8, 8], [3, 3, 7, 11], [3, 3, 9, 9], [3, 4, 6, 11], [3, 4, 7, 10], [3, 4, 8, 9], [3 -- (+174 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem c4_13 : cls4 13 = [[1, 1, 12, 12], [1, 2, 11, 12], [1, 3, 10, 12], [1, 4, 9, 12], [1, 5, 8, 12], [1, 6, 7, 12], [2, 2, 11, 11], [2, 3, 10, 11], [2, 4, 9, 11], [2, 5, 8, 11], [2, 6, 7, 11], [3, 3, 10, 10], [3, 4, 9, 10], [3, 5, 8, 10], [3, 6, 7, 10], [4, 4, 9, 9], [4, 5, 8, 9], [4, 6, 7, 9], [5, 5, 8, 8], [5, 6, 7, 8], [6, 6, 7, 7]] := rfl
set_option maxRecDepth 100000 in
theorem c4_14 : cls4 14 = [[1, 1, 13, 13], [1, 2, 12, 13], [1, 3, 11, 13], [1, 4, 10, 13], [1, 4, 11, 12], [1, 5, 9, 13], [1, 6, 8, 13], [1, 7, 7, 13], [1, 7, 8, 12], [1, 7, 9, 11], [1, 8, 9, 10], [2, 2, 12, 12], [2, 3, 10, 13], [2, 3, 11, 12], [2, 4, 10, 12], [2, 5, 9, 12], [2, 6, 7, 13], [2, 6, 8, 12], [2, 6, 9, 11], [2, 7, 7, 12], [2, 7, 9, 10], [3, 3, 11, 11], [3, 4, 10, 11], [3, 5, 7, 13], [3 -- (+269 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem c4_15 : cls4 15 = [[1, 1, 14, 14], [1, 2, 13, 14], [1, 3, 12, 14], [1, 4, 11, 14], [1, 5, 10, 14], [1, 6, 9, 14], [1, 6, 10, 13], [1, 6, 11, 12], [1, 7, 8, 14], [1, 7, 10, 12], [2, 2, 13, 13], [2, 3, 12, 13], [2, 4, 11, 13], [2, 5, 9, 14], [2, 5, 10, 13], [2, 5, 11, 12], [2, 6, 9, 13], [2, 7, 8, 13], [2, 7, 9, 12], [3, 3, 12, 12], [3, 4, 9, 14], [3, 4, 10, 13], [3, 4, 11, 12], [3, 5, 8, 14 -- (+250 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem c4_16 : cls4 16 = [[1, 1, 15, 15], [1, 2, 14, 15], [1, 3, 13, 15], [1, 4, 12, 15], [1, 5, 11, 15], [1, 6, 10, 15], [1, 7, 9, 15], [1, 8, 8, 15], [1, 8, 9, 14], [1, 9, 10, 12], [2, 2, 14, 14], [2, 3, 13, 14], [2, 4, 12, 14], [2, 5, 11, 14], [2, 5, 12, 13], [2, 6, 10, 14], [2, 7, 8, 15], [2, 7, 9, 14], [2, 8, 8, 14], [2, 8, 10, 12], [3, 3, 13, 13], [3, 4, 11, 14], [3, 4, 12, 13], [3, 5, 11, -- (+346 chars; full line in the Zenodo source)
end Len4Class
#print axioms Len4Class.c4_3
#print axioms Len4Class.c4_4
#print axioms Len4Class.c4_5
#print axioms Len4Class.c4_6
#print axioms Len4Class.c4_7
#print axioms Len4Class.c4_8
#print axioms Len4Class.c4_9
#print axioms Len4Class.c4_10
#print axioms Len4Class.c4_11
#print axioms Len4Class.c4_12
#print axioms Len4Class.c4_13
#print axioms Len4Class.c4_14
#print axioms Len4Class.c4_15
#print axioms Len4Class.c4_16
lean_all/hodge/Len4OnePair.lean
/-
hodge/Len4OnePair.lean — T41 cycle 1373 (goal G810 — done): a balanced length-4 character containing one
complementary pair is two complementary pairs, every m ≥ 2. If |c| = 4, the entries lie in (0, m), c is balanced,
contains x and (after removing x) m − x, then
len4_one_pair the remaining two entries u, v satisfy u + v = m
(PairPeel.pair_peel, then Len2Pair.len2_pair). So for length 4 the whole question "two pairs?" is whether one
complementary pair occurs.
Lean 4 core plus hodge/PairPeel, hodge/Len2Pair.
-/
import hodge.PairPeel
import hodge.Len2Pair
namespace Len4OnePair
open Indecomp PairsSplit
theorem len4_one_pair (m' x : Nat) (c : List Nat) (hm : 1 < m' + 1) (hlen : c.length = 4)
(hr : c.all (inR (m' + 1)) = true) (hb : bal (m' + 1) c = true) (hx0 : 0 < x) (hxm : x < m' + 1)
(h1 : c.contains x = true) (h2 : (c.erase x).contains (m' + 1 - x) = true) :
∃ u v, (c.erase x).erase (m' + 1 - x) = [u, v] ∧ u + v = m' + 1 := by
have hp := PairPeel.pair_peel m' x c hb hx0 hxm h1 h2
have l1 := len_erase x c h1
have l2 := len_erase (m' + 1 - x) (c.erase x) h2
have hrr := all_erase _ (m' + 1 - x) _ (all_erase _ x c hr)
generalize (c.erase x).erase (m' + 1 - x) = r at hp l2 hrr ⊢
have l1' : (c.erase x).length + 1 = 3 + 1 := by rw [l1, hlen]
rw [Nat.succ.inj l1'] at l2
have e2 : r.length = 2 := Nat.succ.inj l2
cases r with
| nil => exact Nat.noConfusion e2
| cons u r2 =>
cases r2 with
| nil => exact Nat.noConfusion (Nat.succ.inj e2)
| cons v r3 =>
cases r3 with
| cons w r4 => exact Nat.noConfusion (Nat.succ.inj (Nat.succ.inj e2))
| nil =>
have hu : (inR (m' + 1) u && (inR (m' + 1) v && true)) = true := hrr
have hum : u < m' + 1 := Nat.le_of_ble_eq_true (andR (andL hu))
have hvm : v < m' + 1 := Nat.le_of_ble_eq_true (andR (andL (andR hu)))
exact ⟨u, v, rfl, Len2Pair.len2_pair (m' + 1) u v hm hum hvm hp⟩
end Len4OnePair
#print axioms Len4OnePair.len4_one_pair
lean_all/hodge/Len5Odd2.lean
/- hodge/Len5Odd2.lean — T41 cycle 879 (goal G588): balanced length-5 characters without m/2 at m = 2·odd. Computation (m ≤ 70): indecomposable unit-orbits not explained by the proved rules (families up to twist, gluing, scaling, splits) occur only at m = 18 (2), 30 (23), 42 (33), 54 (5), 62 (1), 66 (5), 70 (1); for m = 2p with p prime ≠ 31 every indecomposable orbit is explained. The m = 62 orbit [1, 33, 35, 39, 47] is the 5-list of Indecomp/Reduce62 and the m = 70 orbit is Seed70. Representatives at m = 18, 62, 70: balanced and indecomposable by rfl. Lean 4 core plus hodge/Indecomp (bal, indec), rfl. -/ import hodge.Indecomp namespace Len5Odd2 open Indecomp set_option maxRecDepth 100000 in theorem u18_0 : bal 18 [1, 1, 14, 14, 15] = true ∧ indec 18 [1, 1, 14, 14, 15] = true := ⟨rfl, rfl⟩ set_option maxRecDepth 100000 in theorem u18_1 : bal 18 [1, 6, 7, 15, 16] = true ∧ indec 18 [1, 6, 7, 15, 16] = true := ⟨rfl, rfl⟩ set_option maxRecDepth 100000 in theorem u62_2 : bal 62 [1, 33, 35, 39, 47] = true ∧ indec 62 [1, 33, 35, 39, 47] = true := ⟨rfl, rfl⟩ set_option maxRecDepth 100000 in theorem u70_3 : bal 70 [1, 29, 43, 45, 57] = true ∧ indec 70 [1, 29, 43, 45, 57] = true := ⟨rfl, rfl⟩ end Len5Odd2 #print axioms Len5Odd2.u18_0 #print axioms Len5Odd2.u18_1 #print axioms Len5Odd2.u62_2 #print axioms Len5Odd2.u70_3
lean_all/hodge/Len6Decomp.lean
/-
hodge/Len6Decomp.lean — T41 cycle 747 (goal G460): for 3 ≤ m ≤ 12 every balanced length-6 character (sorted,
entries in (0, m)) of the Fermat fourfold of degree m splits into two nonempty balanced parts, by rfl.
So at these degrees every Hodge character is reached by the inductive structure from curves and surfaces
(where the Hodge conjecture holds: Lefschetz (1,1)). First indecomposable ones: m = 15 (6), m = 18 (18).
Lean 4 core plus hodge/Len4Class (quads), hodge/Indecomp (bal, indec), rfl.
-/
import hodge.Len4Class
namespace Len6Decomp
open Indecomp Len3Class Len4Class
def ext (m : Nat) (L : List (List Nat)) : List (List Nat) :=
(((List.range m).filter (fun x => Nat.ble 1 x)).map (fun x => (L.filter (fun l => match l with
| y :: _ => Nat.ble x y
| [] => false)).map (fun l => x :: l))).flatten
def quints (m : Nat) : List (List Nat) := ext m (quads m)
def sexts (m : Nat) : List (List Nat) := ext m (quints m)
def bad (m : Nat) : List (List Nat) := (sexts m).filter (fun c => bal m c && indec m c)
set_option maxRecDepth 200000 in
theorem d3 : bad 3 = [] := rfl
set_option maxRecDepth 200000 in
theorem d4 : bad 4 = [] := rfl
set_option maxRecDepth 200000 in
theorem d5 : bad 5 = [] := rfl
set_option maxRecDepth 200000 in
theorem d6 : bad 6 = [] := rfl
set_option maxRecDepth 200000 in
theorem d7 : bad 7 = [] := rfl
set_option maxRecDepth 200000 in
theorem d8 : bad 8 = [] := rfl
set_option maxRecDepth 200000 in
theorem d9 : bad 9 = [] := rfl
set_option maxRecDepth 200000 in
theorem d10 : bad 10 = [] := rfl
set_option maxRecDepth 200000 in
theorem d11 : bad 11 = [] := rfl
set_option maxRecDepth 200000 in
theorem d12 : bad 12 = [] := rfl
end Len6Decomp
#print axioms Len6Decomp.d3
#print axioms Len6Decomp.d4
#print axioms Len6Decomp.d5
#print axioms Len6Decomp.d6
#print axioms Len6Decomp.d7
#print axioms Len6Decomp.d8
#print axioms Len6Decomp.d9
#print axioms Len6Decomp.d10
#print axioms Len6Decomp.d11
#print axioms Len6Decomp.d12
lean_all/hodge/Len6Decomp2.lean
/- hodge/Len6Decomp2.lean — T41 goal G460b (Kamiak): the indecomposable balanced length-6 characters for 13 ≤ m ≤ 18, by rfl: none for m = 13, 14, 16, 17; six for m = 15, eighteen for m = 18. Lean 4 core plus hodge/Len6Decomp (bad), rfl. -/ import hodge.Len6Decomp namespace Len6Decomp2 open Len6Decomp set_option maxHeartbeats 0 in set_option maxRecDepth 400000 in theorem e13 : bad 13 = [] := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 400000 in theorem e14 : bad 14 = [] := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 400000 in theorem e15 : bad 15 = [[1, 2, 7, 11, 12, 12], [1, 4, 7, 10, 10, 13], [1, 6, 6, 8, 11, 13], [2, 4, 7, 9, 9, 14], [2, 5, 5, 8, 11, 14], [3, 3, 4, 8, 13, 14]] := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 400000 in theorem e16 : bad 16 = [] := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 400000 in theorem e17 : bad 17 = [] := rfl set_option maxHeartbeats 0 in set_option maxRecDepth 400000 in theorem e18 : bad 18 = [[1, 1, 7, 14, 15, 16], [1, 1, 10, 13, 14, 15], [1, 2, 8, 14, 14, 15], [1, 2, 10, 13, 13, 15], [1, 7, 7, 8, 15, 16], [2, 2, 8, 13, 14, 15], [2, 3, 4, 11, 17, 17], [2, 3, 10, 11, 11, 17], [2, 4, 7, 13, 13, 15], [2, 7, 8, 8, 14, 15], [3, 4, 4, 10, 16, 17], [3, 4, 5, 8, 17, 17], [3, 4, 5, 10, 16, 16], [3, 4, 10, 10, 11, 16], [3, 5, 5, 8, 16, 17], [3, 5, 5, 11, 14, 16], [3, 5, 1 -- (+44 chars; full line in the Zenodo source) end Len6Decomp2 #print axioms Len6Decomp2.e13 #print axioms Len6Decomp2.e14 #print axioms Len6Decomp2.e15 #print axioms Len6Decomp2.e16 #print axioms Len6Decomp2.e17 #print axioms Len6Decomp2.e18
lean_all/hodge/Len6Explain.lean
/-
hodge/Len6Explain.lean — T41 cycle 811 (goal G519): the indecomposable length-6 characters of the Fermat
fourfolds of degree 15 and 18 (Len6Decomp2: 2 unit-orbits at m = 15, 3 at m = 18) are all explained by the
proved rules: [1, 4, 7, 10, 10, 13] (m = 15) is QFam(q = 5, k = 3, a = 1); the other four orbit representatives
are glued (Glue) from two shorter characters along {z, m − z}, both of which are family twists or Triple-type
(computation). Leaves by rfl.
Lean 4 core plus hodge/Glue, hodge/QFam, rfl.
-/
import hodge.Glue
namespace Len6Explain
open Indecomp Glue PermSum QFam
theorem fam15 : bal (5 * 3) (gl (fun i => 1 + i * 3) 5 ++ [5 * 3 - 5 * 1]) = true :=
qfam_bal 5 3 1 (Nat.succ_pos 4) (Nat.succ_pos 0) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 1) (Nat.le_of_ble_eq_true rfl))
theorem fam15_list : gl (fun i => 1 + i * 3) 5 ++ [5 * 3 - 5 * 1] = [13, 10, 7, 4, 1, 10] := rfl
set_option maxRecDepth 100000 in
theorem glue15_0 : bal 15 ([1, 11, 12] ++ [2, 7, 12]) = true :=
glue 14 6 [1, 11, 12] [2, 7, 12] (Nat.succ_pos 5) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 6) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem glue18_1 : bal 18 ([1, 16] ++ [1, 7, 14, 15]) = true :=
glue 17 10 [1, 16] [1, 7, 14, 15] (Nat.succ_pos 9) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 10) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem glue18_2 : bal 18 ([1, 10] ++ [1, 13, 14, 15]) = true :=
glue 17 16 [1, 10] [1, 13, 14, 15] (Nat.succ_pos 15) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 16) (Nat.le_of_ble_eq_true rfl)) rfl rfl
set_option maxRecDepth 100000 in
theorem glue18_3 : bal 18 ([2, 14] ++ [1, 8, 14, 15]) = true :=
glue 17 11 [2, 14] [1, 8, 14, 15] (Nat.succ_pos 10) (Nat.lt_of_lt_of_le (Nat.lt_succ_self 11) (Nat.le_of_ble_eq_true rfl)) rfl rfl
end Len6Explain
#print axioms Len6Explain.fam15
#print axioms Len6Explain.fam15_list
#print axioms Len6Explain.glue15_0
#print axioms Len6Explain.glue18_1
#print axioms Len6Explain.glue18_2
#print axioms Len6Explain.glue18_3
lean_all/hodge/Len6Scan.lean
/- hodge/Len6Scan.lean — T41 cycle 888 (goal G584): balanced indecomposable length-6 characters, m = 25–30. Computation (all multisets, all splits): number of indecomposable unit-orbits not explained by the proved rules (families up to twist, gluing, scaling, splits): m = 25: 0 (1 orbit, explained), 26: 0, 27: 0, 29: none at all, 28: 3, 30: 29. Representatives of the three m = 28 orbits and one m = 30 orbit: balanced and indecomposable (rfl). Lean 4 core plus hodge/Indecomp (bal, indec), rfl. -/ import hodge.Indecomp namespace Len6Scan open Indecomp set_option maxRecDepth 100000 in theorem u28_0 : bal 28 [1, 5, 6, 21, 25, 26] = true ∧ indec 28 [1, 5, 6, 21, 25, 26] = true := ⟨rfl, rfl⟩ set_option maxRecDepth 100000 in theorem u28_1 : bal 28 [1, 5, 8, 21, 24, 25] = true ∧ indec 28 [1, 5, 8, 21, 24, 25] = true := ⟨rfl, rfl⟩ set_option maxRecDepth 100000 in theorem u28_2 : bal 28 [1, 9, 11, 15, 23, 25] = true ∧ indec 28 [1, 9, 11, 15, 23, 25] = true := ⟨rfl, rfl⟩ set_option maxRecDepth 100000 in theorem u30_3 : bal 30 [1, 1, 8, 25, 27, 28] = true ∧ indec 30 [1, 1, 8, 25, 27, 28] = true := ⟨rfl, rfl⟩ end Len6Scan #print axioms Len6Scan.u28_0 #print axioms Len6Scan.u28_1 #print axioms Len6Scan.u28_2 #print axioms Len6Scan.u30_3
lean_all/hodge/Len6TwoPairs.lean
/-
hodge/Len6TwoPairs.lean — T41 cycle 1375 (goal G811 — done): a balanced length-6 character containing two
complementary pairs is three complementary pairs, every m ≥ 2. If |c| = 6, entries in (0, m), c balanced, c
contains x and m − x, and the rest contains y and m − y, then
len6_two_pairs the last two entries u, v satisfy u + v = m
(PairPeel.pair_peel on the first pair, then Len4OnePair on the balanced length-4 rest). For G529b (length 6) the
open part is: every balanced length-6 character of prime degree contains two disjoint complementary pairs.
Lean 4 core plus hodge/Len4OnePair.
-/
import hodge.Len4OnePair
namespace Len6TwoPairs
open Indecomp PairsSplit
theorem len6_two_pairs (m' x y : Nat) (c : List Nat) (hm : 1 < m' + 1) (hlen : c.length = 6)
(hr : c.all (inR (m' + 1)) = true) (hb : bal (m' + 1) c = true) (hx0 : 0 < x) (hxm : x < m' + 1)
(h1 : c.contains x = true) (h2 : (c.erase x).contains (m' + 1 - x) = true)
(hy0 : 0 < y) (hym : y < m' + 1)
(h3 : ((c.erase x).erase (m' + 1 - x)).contains y = true)
(h4 : (((c.erase x).erase (m' + 1 - x)).erase y).contains (m' + 1 - y) = true) :
∃ u v, (((c.erase x).erase (m' + 1 - x)).erase y).erase (m' + 1 - y) = [u, v] ∧ u + v = m' + 1 := by
have hp := PairPeel.pair_peel m' x c hb hx0 hxm h1 h2
have l1 := len_erase x c h1
have l2 := len_erase (m' + 1 - x) (c.erase x) h2
have hrr := all_erase _ (m' + 1 - x) _ (all_erase _ x c hr)
have l1' : (c.erase x).length + 1 = 5 + 1 := by rw [l1, hlen]
rw [Nat.succ.inj l1'] at l2
have e4 : ((c.erase x).erase (m' + 1 - x)).length = 4 := Nat.succ.inj l2
exact Len4OnePair.len4_one_pair m' y _ hm e4 hrr hp hy0 hym h3 h4
end Len6TwoPairs
#print axioms Len6TwoPairs.len6_two_pairs
lean_all/hodge/LinCert33.lean
/-
hodge/LinCert33.lean — T41 cycle 1868 (goals G861, G769): F_33 (m = 462, the composite member of the 1 + 14k family)
is indecomposable, by a linear certificate over all units instead of subgroup averages.
A balanced part A satisfies 2·T_t(A) = |A|·m for every unit t. With integer weights λ_t = lp − ln on 31 units the
combination Σ λ_t (2⟨t·x⟩ − m) equals L·[x = c_k] − α₁[x = s₁] − α₂[x = s₂] on every element x of c (checked by
rfl as PT x + Em x = NT x + Ep x), so the counts n_x of A satisfy L·n_k + α₁⁻n₁ + α₂⁻n₂ = α₁⁺n₁ + α₂⁺n₂
(row_eq). The kernel of the unit matrix is span(1, v) (rank 31 of 33): the counts of the two free elements s₁, s₂
decide all others, the two mixed cases are impossible and the two pure ones give A = ∅ or B = ∅.
lin gs PT A = gs NT A for balanced A
row_eq the count relation of each certificate row
lincert indec 462 F33 = true
The weights were found by exact Gaussian elimination (tools/g861_cert.py, computation only).
Lean 4 core plus hodge/AvgIndec.
-/
import hodge.AvgIndec
namespace LinCert33
open GcdHand ModHand OrbitSum APPairGen PermSum FamMod FamArith Indecomp FamBal FamIndec3 Q4Conv QFamPrime AvgIndec
def F33 : List Nat := [1, 15, 29, 43, 57, 71, 85, 297, 113, 127, 141, 155, 169, 183, 197, 211, 225, 239, 253, 267, 281, 295, 309, 323, 337, 351, 365, 379, 393, 407, 421, 435, 449]
structure Row where
ck : Nat
L : Nat
a1p : Nat
a1n : Nat
a2p : Nat
a2n : Nat
T : List (Nat × Nat × Nat)
def ind (s x : Nat) : Nat := if Nat.beq x s = true then 1 else 0
def cnt (s : Nat) (A : List Nat) : Nat := gs (ind s) A
def PT (m : Nat) : List (Nat × Nat × Nat) → Nat → Nat
| [], _ => 0
| (t, lp, ln) :: T, x => (lp * ((t * x) % m + (t * x) % m) + ln * m) + PT m T x
def NT (m : Nat) : List (Nat × Nat × Nat) → Nat → Nat
| [], _ => 0
| (t, lp, ln) :: T, x => (ln * ((t * x) % m + (t * x) % m) + lp * m) + NT m T x
def Em (s1 s2 : Nat) (r : Row) (x : Nat) : Nat := r.a1p * ind s1 x + r.a2p * ind s2 x
def Ep (s1 s2 : Nat) (r : Row) (x : Nat) : Nat := r.L * ind r.ck x + (r.a1n * ind s1 x + r.a2n * ind s2 x)
def rowOK (m s1 s2 : Nat) (c : List Nat) (r : Row) : Bool :=
r.T.all (fun e => Nat.blt e.1 m && Nat.beq (Nat.gcd e.1 m) 1) &&
c.all (fun x => Nat.beq (PT m r.T x + Em s1 s2 r x) (NT m r.T x + Ep s1 s2 r x))
def allows (r : Row) (n1 n2 nk : Nat) : Bool :=
Nat.beq (r.a1p * n1 + r.a2p * n2) (r.L * nk + (r.a1n * n1 + r.a2n * n2))
theorem add_left_cancel' (n a b : Nat) (h : n + a = n + b) : a = b :=
add_right_cancel' a b n (by rw [Nat.add_comm a n, Nat.add_comm b n]; exact h)
theorem and_tt {a b : Bool} (h : (a && b) = true) : a = true ∧ b = true := by
cases a with
| false => exact nomatch h
| true => exact ⟨rfl, h⟩
theorem gs_lin (lp ln m : Nat) (g : Nat → Nat) : ∀ A : List Nat,
gs (fun x => lp * (g x + g x) + ln * m) A = lp * (gs g A + gs g A) + ln * (m * A.length)
| [] => rfl
| x :: A => by
show (lp * (g x + g x) + ln * m) + gs (fun x => lp * (g x + g x) + ln * m) A
= lp * ((g x + gs g A) + (g x + gs g A)) + ln * (m * (A.length + 1))
rw [gs_lin lp ln m g A]; lib_nat
theorem gs_mul (w : Nat) (g : Nat → Nat) : ∀ A : List Nat, gs (fun x => w * g x) A = w * gs g A
| [] => rfl
| x :: A => by
show w * g x + gs (fun x => w * g x) A = w * (g x + gs g A)
rw [gs_mul w g A]; lib_nat
theorem gs_congr (f g : Nat → Nat) : ∀ A : List Nat, (∀ x, x ∈ A → f x = g x) → gs f A = gs g A
| [], _ => rfl
| x :: A, h => by
show f x + gs f A = g x + gs g A
rw [h x (List.Mem.head _), gs_congr f g A (fun y hy => h y (List.Mem.tail _ hy))]
theorem lin (m : Nat) (A : List Nat) : ∀ T : List (Nat × Nat × Nat),
(∀ e, e ∈ T → tsum m e.1 A + tsum m e.1 A = A.length * m) → gs (PT m T) A = gs (NT m T) A
| [], _ => by
show gs (fun _ => 0) A = gs (fun _ => 0) A; rfl
| (t, lp, ln) :: T, h => by
have e1 : gs (PT m ((t, lp, ln) :: T)) A
= gs (fun x => lp * ((t * x) % m + (t * x) % m) + ln * m) A + gs (PT m T) A :=
gs_addf (fun x => lp * ((t * x) % m + (t * x) % m) + ln * m) (PT m T) A
have e2 : gs (NT m ((t, lp, ln) :: T)) A
= gs (fun x => ln * ((t * x) % m + (t * x) % m) + lp * m) A + gs (NT m T) A :=
gs_addf (fun x => ln * ((t * x) % m + (t * x) % m) + lp * m) (NT m T) A
have h0 := h (t, lp, ln) (List.Mem.head _)
have ih := lin m A T (fun e he => h e (List.Mem.tail _ he))
rw [e1, e2, gs_lin lp ln m (fun x => (t * x) % m) A, gs_lin ln lp m (fun x => (t * x) % m) A, ih]
rw [tsum_gs] at h0
show lp * (gs (fun x => (t * x) % m) A + gs (fun x => (t * x) % m) A) + ln * (m * A.length) + gs (NT m T) A
= ln * (gs (fun x => (t * x) % m) A + gs (fun x => (t * x) % m) A) + lp * (m * A.length) + gs (NT m T) A
rw [h0]; lib_nat
theorem mem_of_cnt (x : Nat) : ∀ l : List Nat, 0 < cnt x l → x ∈ l
| [], h => nomatch h
| y :: l, h => by
cases hb : Nat.beq y x with
| true => rw [Nat.eq_of_beq_eq_true hb]; exact List.Mem.head _
| false =>
have e : cnt x (y :: l) = cnt x l := by
show ind x y + cnt x l = cnt x l
unfold ind; rw [hb]; show 0 + cnt x l = cnt x l; lib_nat
rw [e] at h
exact List.Mem.tail _ (mem_of_cnt x l h)
theorem cnt_pos (x : Nat) : ∀ l : List Nat, x ∈ l → 0 < cnt x l
| [], h => nomatch h
| y :: l, h => by
show 0 < ind x y + cnt x l
cases h with
| head => unfold ind; rw [beq_refl' x]; exact Nat.lt_of_lt_of_le (Nat.lt_succ_self 0) (Nat.le_add_right 1 _)
| tail _ h' => exact Nat.lt_of_lt_of_le (cnt_pos x l h') (Nat.le_add_left _ _)
theorem mem_split (c A B : List Nat) (hs : (A, B) ∈ splits c) (x : Nat) (hx : x ∈ A) : x ∈ c := by
have e := FamIndec3.splits_gs (ind x) c A B hs
exact mem_of_cnt x c (Nat.lt_of_lt_of_le (cnt_pos x A hx) (by rw [show cnt x c = gs (ind x) A + gs (ind x) B from e.symm]; exact Nat.le_add_right _ _))
theorem mem_split_r (c A B : List Nat) (hs : (A, B) ∈ splits c) (x : Nat) (hx : x ∈ B) : x ∈ c := by
have e := FamIndec3.splits_gs (ind x) c A B hs
exact mem_of_cnt x c (Nat.lt_of_lt_of_le (cnt_pos x B hx) (by rw [show cnt x c = gs (ind x) A + gs (ind x) B from e.symm]; exact Nat.le_add_left _ _))
theorem all_mem2 {α : Type} (P : α → Bool) (l : List α) (h : l.all P = true) (r : α) (hr : r ∈ l) : P r = true :=
all_mem' P l h r hr
theorem row_eq (m s1 s2 : Nat) (c A B : List Nat) (hs : (A, B) ∈ splits c) (hb : bal m A = true) (r : Row)
(hr : rowOK m s1 s2 c r = true) : allows r (cnt s1 A) (cnt s2 A) (cnt r.ck A) = true := by
have h2 := and_tt hr
have hT : ∀ e, e ∈ r.T → tsum m e.1 A + tsum m e.1 A = A.length * m := by
intro e he
have u := and_tt (all_mem2 _ r.T h2.1 e he)
exact bal_unit m e.1 A hb (Nat.le_of_ble_eq_true u.1) (Nat.eq_of_beq_eq_true u.2)
have hl := lin m A r.T hT
have hc : ∀ x, x ∈ A → PT m r.T x + Em s1 s2 r x = NT m r.T x + Ep s1 s2 r x := fun x hx =>
Nat.eq_of_beq_eq_true (all_mem2 _ c h2.2 x (mem_split c A B hs x hx))
have g := gs_congr _ _ A hc
rw [gs_addf, gs_addf, hl] at g
have g2 := add_left_cancel' _ _ _ g
have eEm : gs (Em s1 s2 r) A = r.a1p * cnt s1 A + r.a2p * cnt s2 A := by
show gs (fun x => r.a1p * ind s1 x + r.a2p * ind s2 x) A = _
rw [gs_addf, gs_mul, gs_mul]; rfl
have eEp : gs (Ep s1 s2 r) A = r.L * cnt r.ck A + (r.a1n * cnt s1 A + r.a2n * cnt s2 A) := by
show gs (fun x => r.L * ind r.ck x + (r.a1n * ind s1 x + r.a2n * ind s2 x)) A = _
rw [gs_addf, gs_addf, gs_mul, gs_mul, gs_mul]; rfl
rw [eEm, eEp] at g2
unfold allows; rw [g2]; exact beq_refl' _
theorem zero_or_one : ∀ a b : Nat, a + b = 1 → a = 0 ∨ a = 1
| 0, _, _ => Or.inl rfl
| 1, _, _ => Or.inr rfl
| a + 2, b, h => by
have h' : a + b + 2 = 1 := by rw [← h]; lib_nat
exact Nat.noConfusion (Nat.succ.inj h')
theorem cnt01 (c A B : List Nat) (hs : (A, B) ∈ splits c) (x : Nat) (h1 : cnt x c = 1) : cnt x A = 0 ∨ cnt x A = 1 :=
zero_or_one _ (cnt x B) ((FamIndec3.splits_gs (ind x) c A B hs).trans h1)
theorem any_mem {α : Type} (P : α → Bool) : ∀ l : List α, l.any P = true → ∃ r, r ∈ l ∧ P r = true
| [], h => nomatch h
| x :: l, h => by
cases e : P x with
| true => exact ⟨x, List.Mem.head _, e⟩
| false =>
rw [show (x :: l).any P = (P x || l.any P) from rfl, e] at h
cases any_mem P l h with
| intro r hr => exact ⟨r, List.Mem.tail _ hr.1, hr.2⟩
theorem mem_app {α : Type} (x : α) : ∀ l l' : List α, x ∈ l ++ l' → x ∈ l ∨ x ∈ l'
| [], _, h => Or.inr h
| y :: l, l', h => by
cases h with
| head => exact Or.inl (List.Mem.head _)
| tail _ h' =>
cases mem_app x l l' h' with
| inl a => exact Or.inl (List.Mem.tail _ a)
| inr b => exact Or.inr b
theorem mem_map' {α β : Type} (f : α → β) (y : β) : ∀ l : List α, y ∈ l.map f → ∃ r, r ∈ l ∧ f r = y
| [], h => nomatch h
| x :: l, h => by
cases h with
| head => exact ⟨x, List.Mem.head _, rfl⟩
| tail _ h' =>
cases mem_map' f y l h' with
| intro r hr => exact ⟨r, List.Mem.tail _ hr.1, hr.2⟩
def rows : List Row := [
⟨1, 57288, 0, 0, 57288, 0, [(1, 0, 9), (5, 0, 67), (13, 0, 23), (17, 0, 40), (19, 34, 0), (23, 0, 35), (25, 10, 0), (29, 0, 8), (31, 0, 1), (37, 15, 0), (41, 0, 54), (43, 6, 0), (47, 15, 0), (53, 0, 1), (59, 30, 0), (61, 0, 27), (65, 0, 3), (67, 40, 0), (71, 30, 0), (73, 0, 19), (79, 5, 0), (83, 32, 0), (85, 0, 48), (89, 0, 23), (95, 14, 0), (97, 0, 23), (101, 15, 0), (103, 0, 10), (107, 6, 0), -- (+29 chars; full line in the Zenodo source)
⟨15, 57288, 57288, 0, 0, 0, [(1, 0, 4), (5, 15, 0), (13, 69, 0), (17, 58, 0), (19, 22, 0), (23, 0, 50), (25, 0, 30), (29, 0, 7), (31, 3, 0), (37, 0, 76), (41, 38, 0), (43, 0, 80), (47, 17, 0), (53, 0, 59), (59, 3, 0), (61, 50, 0), (65, 9, 0), (67, 4, 0), (71, 0, 90), (73, 26, 0), (79, 47, 0), (83, 0, 3), (85, 0, 42), (89, 100, 0), (95, 0, 73), (97, 7, 0), (101, 17, 0), (103, 61, 0), (107, 13, 0) -- (+31 chars; full line in the Zenodo source)
⟨29, 57288, 0, 0, 57288, 0, [(1, 12, 0), (5, 0, 45), (13, 41, 0), (17, 0, 50), (19, 58, 0), (23, 0, 36), (25, 0, 3), (29, 0, 10), (31, 22, 0), (37, 11, 0), (41, 0, 83), (43, 0, 39), (47, 73, 0), (53, 0, 9), (59, 53, 0), (61, 0, 26), (65, 4, 0), (67, 50, 0), (71, 0, 9), (73, 15, 0), (79, 14, 0), (83, 40, 0), (85, 0, 60), (89, 41, 0), (95, 2, 0), (97, 0, 52), (101, 42, 0), (103, 3, 0), (107, 23, 0 -- (+32 chars; full line in the Zenodo source)
⟨43, 57288, 0, 0, 57288, 0, [(1, 0, 46), (5, 2, 0), (13, 34, 0), (17, 16, 0), (19, 0, 26), (23, 14, 0), (25, 0, 35), (29, 0, 3), (31, 19, 0), (37, 25, 0), (41, 3, 0), (43, 0, 21), (47, 0, 6), (53, 50, 0), (59, 0, 12), (61, 48, 0), (65, 0, 5), (67, 46, 0), (71, 19, 0), (73, 0, 11), (79, 0, 33), (83, 0, 19), (85, 0, 18), (89, 0, 59), (95, 0, 49), (97, 0, 59), (101, 25, 0), (103, 66, 0), (107, 10, -- (+33 chars; full line in the Zenodo source)
⟨57, 57288, 57288, 0, 0, 0, [(1, 0, 49), (5, 52, 0), (13, 16, 0), (17, 44, 0), (19, 0, 56), (23, 23, 0), (25, 0, 42), (29, 15, 0), (31, 0, 2), (37, 0, 1), (41, 16, 0), (43, 12, 0), (47, 0, 32), (53, 0, 2), (59, 0, 33), (61, 39, 0), (65, 0, 6), (67, 18, 0), (71, 0, 2), (73, 0, 7), (79, 10, 0), (83, 0, 29), (85, 28, 0), (89, 0, 15), (95, 0, 3), (97, 16, 0), (101, 0, 32), (103, 11, 0), (107, 0, 19) -- (+30 chars; full line in the Zenodo source)
⟨71, 57288, 0, 0, 57288, 0, [(1, 0, 13), (5, 0, 21), (13, 77, 0), (17, 18, 0), (19, 56, 0), (23, 0, 23), (25, 0, 51), (29, 0, 15), (31, 2, 0), (37, 0, 30), (41, 0, 47), (43, 0, 43), (47, 63, 0), (53, 0, 29), (59, 2, 0), (61, 23, 0), (65, 6, 0), (67, 44, 0), (71, 0, 29), (73, 38, 0), (79, 0, 10), (83, 29, 0), (85, 0, 90), (89, 46, 0), (95, 0, 59), (97, 0, 16), (101, 32, 0), (103, 82, 0), (107, 50 -- (+35 chars; full line in the Zenodo source)
⟨85, 57288, 0, 0, 57288, 0, [(1, 0, 57), (5, 0, 11), (13, 0, 63), (17, 0, 26), (19, 0, 12), (23, 47, 0), (25, 53, 0), (29, 1, 0), (31, 4, 0), (37, 64, 0), (41, 0, 1), (43, 69, 0), (47, 0, 29), (53, 35, 0), (59, 4, 0), (61, 15, 0), (65, 12, 0), (67, 26, 0), (71, 35, 0), (73, 0, 48), (79, 0, 20), (83, 0, 35), (85, 6, 0), (89, 0, 94), (95, 37, 0), (97, 0, 32), (101, 2, 0), (103, 0, 22), (107, 0, 24 -- (+32 chars; full line in the Zenodo source)
⟨297, 57288, 114576, 0, 0, 57288, [(1, 0, 5), (5, 42, 0), (13, 94, 0), (17, 88, 0), (19, 0, 50), (23, 0, 47), (25, 0, 53), (29, 0, 32), (31, 27, 0), (37, 0, 64), (41, 63, 0), (43, 0, 69), (47, 0, 2), (53, 0, 66), (59, 0, 35), (61, 47, 0), (65, 19, 0), (67, 0, 26), (71, 0, 97), (73, 48, 0), (79, 51, 0), (83, 4, 0), (85, 0, 6), (89, 94, 0), (95, 0, 68), (97, 1, 0), (101, 29, 0), (103, 53, 0), (107 -- (+38 chars; full line in the Zenodo source)
⟨113, 28644, 0, 0, 28644, 0, [(1, 1, 0), (5, 4, 0), (13, 37, 0), (17, 1, 0), (19, 10, 0), (23, 0, 3), (25, 0, 39), (29, 0, 6), (31, 7, 0), (37, 0, 12), (41, 0, 25), (43, 0, 42), (47, 19, 0), (53, 7, 0), (59, 7, 0), (61, 34, 0), (65, 21, 0), (67, 30, 0), (71, 0, 24), (73, 9, 0), (79, 0, 4), (83, 0, 7), (85, 0, 36), (89, 6, 0), (95, 0, 36), (97, 0, 25), (101, 19, 0), (103, 39, 0), (107, 20, 0), (1 -- (+25 chars; full line in the Zenodo source)
⟨127, 28644, 0, 0, 28644, 0, [(1, 0, 13), (5, 0, 21), (13, 0, 16), (17, 0, 13), (19, 0, 6), (23, 8, 0), (25, 11, 0), (29, 16, 0), (31, 2, 0), (37, 32, 0), (41, 0, 16), (43, 19, 0), (47, 1, 0), (53, 33, 0), (59, 2, 0), (61, 0, 8), (65, 6, 0), (67, 13, 0), (71, 33, 0), (73, 0, 24), (79, 0, 10), (83, 0, 2), (85, 3, 0), (89, 0, 47), (95, 3, 0), (97, 0, 16), (101, 1, 0), (103, 0, 11), (107, 0, 12), ( -- (+27 chars; full line in the Zenodo source)
⟨141, 57288, 57288, 0, 0, 0, [(1, 10, 0), (5, 9, 0), (13, 29, 0), (17, 10, 0), (19, 0, 24), (23, 0, 30), (25, 13, 0), (29, 2, 0), (31, 8, 0), (37, 0, 27), (41, 29, 0), (43, 0, 17), (47, 0, 27), (53, 0, 23), (59, 0, 23), (61, 30, 0), (65, 24, 0), (67, 0, 10), (71, 0, 23), (73, 0, 3), (79, 22, 0), (83, 0, 8), (85, 12, 0), (89, 29, 0), (95, 12, 0), (97, 0, 2), (101, 4, 0), (103, 0, 13), (107, 0, 17 -- (+32 chars; full line in the Zenodo source)
⟨155, 57288, 0, 0, 57288, 0, [(1, 45, 0), (5, 0, 68), (13, 22, 0), (17, 0, 48), (19, 78, 0), (23, 0, 73), (25, 0, 19), (29, 0, 22), (31, 5, 0), (37, 0, 44), (41, 0, 71), (43, 0, 61), (47, 80, 0), (53, 0, 26), (59, 67, 0), (61, 0, 51), (65, 15, 0), (67, 48, 0), (71, 5, 0), (73, 2, 0), (79, 37, 0), (83, 88, 0), (85, 0, 70), (89, 84, 0), (95, 0, 8), (97, 0, 9), (101, 49, 0), (103, 19, 0), (107, 63, -- (+34 chars; full line in the Zenodo source)
⟨169, 57288, 0, 0, 57288, 0, [(1, 0, 46), (5, 33, 0), (13, 3, 0), (17, 16, 0), (19, 0, 26), (23, 14, 0), (25, 0, 35), (29, 28, 0), (31, 0, 12), (37, 25, 0), (41, 3, 0), (43, 0, 21), (47, 0, 37), (53, 19, 0), (59, 19, 0), (61, 48, 0), (65, 26, 0), (67, 46, 0), (71, 19, 0), (73, 0, 11), (79, 0, 2), (83, 0, 50), (85, 0, 18), (89, 0, 59), (95, 0, 18), (97, 0, 28), (101, 0, 6), (103, 35, 0), (107, 0, -- (+35 chars; full line in the Zenodo source)
⟨183, 57288, 57288, 0, 0, 0, [(1, 1, 0), (5, 4, 0), (13, 68, 0), (17, 32, 0), (19, 10, 0), (23, 0, 65), (25, 0, 39), (29, 0, 6), (31, 7, 0), (37, 0, 12), (41, 0, 25), (43, 0, 73), (47, 50, 0), (53, 0, 24), (59, 7, 0), (61, 3, 0), (65, 21, 0), (67, 30, 0), (71, 0, 55), (73, 40, 0), (79, 27, 0), (83, 24, 0), (85, 0, 36), (89, 68, 0), (95, 0, 36), (97, 0, 25), (101, 19, 0), (103, 39, 0), (107, 0, 1 -- (+32 chars; full line in the Zenodo source)
⟨197, 57288, 0, 0, 57288, 0, [(1, 6, 0), (5, 0, 7), (13, 67, 0), (17, 6, 0), (19, 0, 2), (23, 0, 18), (25, 0, 48), (29, 0, 5), (31, 11, 0), (37, 0, 10), (41, 0, 26), (43, 0, 66), (47, 21, 0), (53, 11, 0), (59, 11, 0), (61, 18, 0), (65, 33, 0), (67, 56, 0), (71, 0, 20), (73, 0, 8), (79, 7, 0), (83, 0, 11), (85, 0, 30), (89, 36, 0), (95, 0, 61), (97, 0, 57), (101, 21, 0), (103, 79, 0), (107, 27, 0 -- (+32 chars; full line in the Zenodo source)
⟨211, 57288, 0, 0, 57288, 0, [(1, 0, 51), (5, 0, 18), (13, 4, 0), (17, 0, 20), (19, 0, 14), (23, 29, 0), (25, 0, 26), (29, 27, 0), (31, 0, 16), (37, 85, 0), (41, 0, 58), (43, 34, 0), (47, 0, 8), (53, 46, 0), (59, 15, 0), (61, 33, 0), (65, 14, 0), (67, 82, 0), (71, 46, 0), (73, 0, 25), (79, 0, 44), (83, 0, 15), (85, 0, 24), (89, 0, 89), (95, 7, 0), (97, 0, 58), (101, 0, 8), (103, 0, 5), (107, 3, -- (+33 chars; full line in the Zenodo source)
⟨225, 57288, 57288, 0, 0, 0, [(1, 0, 8), (5, 0, 1), (13, 45, 0), (17, 54, 0), (19, 0, 18), (23, 0, 38), (25, 0, 29), (29, 0, 14), (31, 6, 0), (37, 0, 59), (41, 45, 0), (43, 0, 5), (47, 3, 0), (53, 0, 25), (59, 0, 25), (61, 38, 0), (65, 18, 0), (67, 8, 0), (71, 0, 25), (73, 21, 0), (79, 32, 0), (83, 0, 6), (85, 0, 22), (89, 45, 0), (95, 0, 22), (97, 14, 0), (101, 0, 28), (103, 29, 0), (107, 0, 5) -- (+31 chars; full line in the Zenodo source)
⟨239, 57288, 0, 0, 57288, 0, [(1, 0, 9), (5, 0, 5), (13, 0, 23), (17, 0, 40), (19, 34, 0), (23, 27, 0), (25, 10, 0), (29, 0, 8), (31, 0, 1), (37, 15, 0), (41, 0, 54), (43, 6, 0), (47, 15, 0), (53, 0, 1), (59, 30, 0), (61, 0, 27), (65, 0, 3), (67, 40, 0), (71, 30, 0), (73, 0, 19), (79, 5, 0), (83, 32, 0), (85, 14, 0), (89, 0, 23), (95, 14, 0), (97, 0, 23), (101, 15, 0), (103, 0, 10), (107, 6, 0), -- (+30 chars; full line in the Zenodo source)
⟨253, 57288, 0, 57288, 114576, 0, [(1, 0, 8), (5, 0, 63), (13, 0, 79), (17, 0, 70), (19, 44, 0), (23, 24, 0), (25, 33, 0), (29, 48, 0), (31, 6, 0), (37, 65, 0), (41, 0, 79), (43, 57, 0), (47, 3, 0), (53, 37, 0), (59, 37, 0), (61, 0, 24), (65, 18, 0), (67, 70, 0), (71, 99, 0), (73, 0, 41), (79, 0, 30), (83, 0, 6), (85, 0, 22), (89, 0, 79), (95, 40, 0), (97, 0, 48), (101, 0, 28), (103, 0, 33), (10 -- (+39 chars; full line in the Zenodo source)
⟨267, 57288, 57288, 0, 0, 0, [(1, 13, 0), (5, 21, 0), (13, 47, 0), (17, 44, 0), (19, 6, 0), (23, 0, 39), (25, 0, 42), (29, 0, 16), (31, 29, 0), (37, 0, 63), (41, 16, 0), (43, 0, 50), (47, 0, 1), (53, 0, 33), (59, 0, 2), (61, 39, 0), (65, 25, 0), (67, 18, 0), (71, 0, 64), (73, 0, 7), (79, 41, 0), (83, 2, 0), (85, 0, 34), (89, 47, 0), (95, 0, 34), (97, 0, 15), (101, 0, 1), (103, 42, 0), (107, 12, -- (+33 chars; full line in the Zenodo source)
⟨281, 57288, 0, 0, 57288, 0, [(1, 30, 0), (5, 0, 35), (13, 25, 0), (17, 0, 32), (19, 52, 0), (23, 0, 28), (25, 0, 23), (29, 6, 0), (31, 24, 0), (37, 0, 19), (41, 0, 37), (43, 0, 51), (47, 43, 0), (53, 0, 7), (59, 55, 0), (61, 0, 34), (65, 10, 0), (67, 32, 0), (71, 0, 7), (73, 0, 9), (79, 4, 0), (83, 38, 0), (85, 0, 26), (89, 25, 0), (95, 0, 26), (97, 0, 6), (101, 12, 0), (103, 23, 0), (107, 11, -- (+33 chars; full line in the Zenodo source)
⟨295, 57288, 0, 0, 57288, 0, [(1, 0, 35), (5, 0, 16), (13, 0, 86), (17, 0, 4), (19, 0, 40), (23, 43, 0), (25, 63, 0), (29, 24, 0), (31, 3, 0), (37, 48, 0), (41, 7, 0), (43, 75, 0), (47, 0, 76), (53, 34, 0), (59, 3, 0), (61, 19, 0), (65, 9, 0), (67, 4, 0), (71, 65, 0), (73, 0, 36), (79, 0, 15), (83, 0, 34), (85, 20, 0), (89, 0, 86), (95, 82, 0), (97, 7, 0), (101, 0, 45), (103, 0, 63), (107, 0, 49 -- (+32 chars; full line in the Zenodo source)
⟨309, 57288, 57288, 0, 0, 0, [(1, 43, 0), (5, 0, 45), (13, 103, 0), (17, 12, 0), (19, 58, 0), (23, 0, 129), (25, 0, 65), (29, 0, 41), (31, 22, 0), (37, 0, 82), (41, 0, 21), (43, 0, 101), (47, 73, 0), (53, 0, 71), (59, 22, 0), (61, 5, 0), (65, 4, 0), (67, 50, 0), (71, 0, 71), (73, 46, 0), (79, 76, 0), (83, 71, 0), (85, 0, 60), (89, 134, 0), (95, 0, 91), (97, 10, 0), (101, 42, 0), (103, 96, 0), (1 -- (+40 chars; full line in the Zenodo source)
⟨323, 57288, 0, 0, 57288, 0, [(1, 10, 0), (5, 9, 0), (13, 29, 0), (17, 10, 0), (19, 38, 0), (23, 0, 30), (25, 0, 49), (29, 2, 0), (31, 8, 0), (37, 0, 27), (41, 0, 33), (43, 0, 79), (47, 35, 0), (53, 0, 23), (59, 39, 0), (61, 30, 0), (65, 24, 0), (67, 52, 0), (71, 0, 23), (73, 0, 3), (79, 22, 0), (83, 0, 8), (85, 0, 50), (89, 29, 0), (95, 0, 50), (97, 0, 2), (101, 4, 0), (103, 49, 0), (107, 45, 0 -- (+32 chars; full line in the Zenodo source)
⟨337, 28644, 0, 0, 28644, 0, [(1, 6, 0), (5, 0, 38), (13, 5, 0), (17, 0, 25), (19, 29, 0), (23, 0, 18), (25, 14, 0), (29, 0, 5), (31, 11, 0), (37, 21, 0), (41, 0, 26), (43, 0, 4), (47, 21, 0), (53, 11, 0), (59, 11, 0), (61, 0, 13), (65, 2, 0), (67, 25, 0), (71, 11, 0), (73, 0, 8), (79, 7, 0), (83, 20, 0), (85, 0, 30), (89, 5, 0), (95, 1, 0), (97, 0, 26), (101, 21, 0), (103, 0, 14), (107, 0, 4), -- (+29 chars; full line in the Zenodo source)
⟨351, 57288, 57288, 0, 0, 0, [(1, 0, 10), (5, 22, 0), (13, 64, 0), (17, 52, 0), (19, 0, 38), (23, 0, 32), (25, 0, 13), (29, 0, 33), (31, 23, 0), (37, 0, 35), (41, 33, 0), (43, 0, 45), (47, 0, 4), (53, 0, 8), (59, 0, 8), (61, 32, 0), (65, 7, 0), (67, 10, 0), (71, 0, 39), (73, 3, 0), (79, 9, 0), (83, 0, 23), (85, 0, 12), (89, 33, 0), (95, 0, 43), (97, 0, 29), (101, 27, 0), (103, 44, 0), (107, 0, 1 -- (+32 chars; full line in the Zenodo source)
⟨365, 57288, 0, 0, 57288, 0, [(1, 9, 0), (5, 5, 0), (13, 85, 0), (17, 0, 22), (19, 28, 0), (23, 0, 27), (25, 0, 72), (29, 8, 0), (31, 1, 0), (37, 0, 15), (41, 0, 70), (43, 0, 68), (47, 47, 0), (53, 1, 0), (59, 32, 0), (61, 27, 0), (65, 3, 0), (67, 84, 0), (71, 0, 30), (73, 19, 0), (79, 0, 5), (83, 30, 0), (85, 0, 76), (89, 23, 0), (95, 0, 76), (97, 0, 39), (101, 47, 0), (103, 72, 0), (107, 56, 0 -- (+32 chars; full line in the Zenodo source)
⟨379, 28644, 0, 0, 28644, 0, [(1, 0, 28), (5, 0, 19), (13, 0, 13), (17, 3, 0), (19, 0, 1), (23, 22, 0), (25, 7, 0), (29, 13, 0), (31, 0, 10), (37, 26, 0), (41, 0, 13), (43, 29, 0), (47, 0, 5), (53, 21, 0), (59, 0, 10), (61, 9, 0), (65, 1, 0), (67, 28, 0), (71, 21, 0), (73, 0, 4), (79, 0, 12), (83, 0, 21), (85, 0, 15), (89, 0, 44), (95, 16, 0), (97, 0, 13), (101, 0, 5), (103, 0, 7), (107, 0, 2), -- (+28 chars; full line in the Zenodo source)
⟨393, 57288, 57288, 0, 0, 0, [(1, 0, 22), (5, 36, 0), (13, 54, 0), (17, 40, 0), (19, 0, 34), (23, 4, 0), (25, 0, 41), (29, 0, 23), (31, 1, 0), (37, 0, 15), (41, 23, 0), (43, 0, 37), (47, 16, 0), (53, 0, 30), (59, 0, 30), (61, 58, 0), (65, 3, 0), (67, 22, 0), (71, 0, 61), (73, 19, 0), (79, 0, 5), (83, 0, 1), (85, 0, 14), (89, 23, 0), (95, 0, 45), (97, 0, 39), (101, 47, 0), (103, 72, 0), (107, 0, -- (+32 chars; full line in the Zenodo source)
⟨407, 57288, 0, 57288, 114576, 0, [(1, 27, 0), (5, 0, 78), (13, 0, 24), (17, 0, 66), (19, 84, 0), (23, 0, 19), (25, 1, 0), (29, 24, 0), (31, 3, 0), (37, 48, 0), (41, 0, 117), (43, 13, 0), (47, 48, 0), (53, 34, 0), (59, 65, 0), (61, 0, 43), (65, 9, 0), (67, 66, 0), (71, 65, 0), (73, 0, 36), (79, 0, 15), (83, 28, 0), (85, 0, 42), (89, 0, 24), (95, 20, 0), (97, 0, 55), (101, 17, 0), (103, 0, 1), (1 -- (+41 chars; full line in the Zenodo source)
⟨421, 57288, 0, 0, 57288, 0, [(1, 6, 0), (5, 0, 7), (13, 67, 0), (17, 6, 0), (19, 0, 2), (23, 0, 18), (25, 0, 48), (29, 0, 5), (31, 11, 0), (37, 0, 10), (41, 0, 26), (43, 0, 66), (47, 21, 0), (53, 11, 0), (59, 11, 0), (61, 80, 0), (65, 33, 0), (67, 56, 0), (71, 0, 20), (73, 0, 8), (79, 7, 0), (83, 0, 11), (85, 0, 92), (89, 0, 26), (95, 0, 61), (97, 0, 57), (101, 21, 0), (103, 79, 0), (107, 27, 0 -- (+32 chars; full line in the Zenodo source)
def S1 : Nat := 435
def S2 : Nat := 449
theorem rows_ok : rows.all (rowOK 462 S1 S2 F33) = true := rfl
theorem c_split : F33 = rows.map (fun r => r.ck) ++ [S1, S2] := rfl
theorem c_once : F33.all (fun x => Nat.beq (cnt x F33) 1) = true := rfl
theorem mixed10 : rows.any (fun r => !allows r 1 0 0 && !allows r 1 0 1) = true := rfl
theorem mixed01 : rows.any (fun r => !allows r 0 1 0 && !allows r 0 1 1) = true := rfl
theorem pure00 : rows.all (fun r => !allows r 0 0 1) = true := rfl
theorem pure11 : rows.all (fun r => !allows r 1 1 0) = true := rfl
theorem not_tt {b : Bool} (h : (!b) = true) (h' : b = true) : False := by
rw [h'] at h; exact nomatch h
theorem mem_app_r {α : Type} (x : α) (l' : List α) (h : x ∈ l') : ∀ l : List α, x ∈ l ++ l'
| [] => h
| _ :: l => List.Mem.tail _ (mem_app_r x l' h l)
theorem mem_app_l {α : Type} (x : α) (l' : List α) : ∀ l : List α, x ∈ l → x ∈ l ++ l'
| [], h => nomatch h
| _ :: l, h => by
cases h with
| head => exact List.Mem.head _
| tail _ h' => exact List.Mem.tail _ (mem_app_l x l' l h')
theorem map_mem {α β : Type} (f : α → β) (r : α) : ∀ l : List α, r ∈ l → f r ∈ l.map f
| [], h => nomatch h
| _ :: l, h => by
cases h with
| head => exact List.Mem.head _
| tail _ h' => exact List.Mem.tail _ (map_mem f r l h')
theorem ne_nil {α : Type} : ∀ l : List α, l.isEmpty = false → ∃ x, x ∈ l
| [], h => nomatch h
| x :: _, _ => ⟨x, List.Mem.head _⟩
theorem memS1 : S1 ∈ F33 := by rw [c_split]; exact mem_app_r S1 [S1, S2] (List.Mem.head _) _
theorem memS2 : S2 ∈ F33 := by rw [c_split]; exact mem_app_r S2 [S1, S2] (List.Mem.tail _ (List.Mem.head _)) _
theorem mem_ck (r : Row) (hr : r ∈ rows) : r.ck ∈ F33 := by
rw [c_split]; exact mem_app_l r.ck [S1, S2] _ (map_mem (fun r => r.ck) r rows hr)
theorem key (x : Nat) (hx : x ∈ F33) : (∃ r, r ∈ rows ∧ r.ck = x) ∨ x = S1 ∨ x = S2 := by
rw [c_split] at hx
cases mem_app x _ _ hx with
| inl h => exact Or.inl (mem_map' _ x rows h)
| inr h =>
cases h with
| head => exact Or.inr (Or.inl rfl)
| tail _ h' =>
cases h' with
| head => exact Or.inr (Or.inr rfl)
| tail _ h'' => exact nomatch h''
theorem no_split (A B : List Nat) (hs : (A, B) ∈ splits F33) (hA : bal 462 A = true)
(hAne : A.isEmpty = false) (hBne : B.isEmpty = false) : False := by
have R : ∀ r, r ∈ rows → allows r (cnt S1 A) (cnt S2 A) (cnt r.ck A) = true := fun r hr =>
row_eq 462 S1 S2 F33 A B hs hA r (all_mem2 _ rows rows_ok r hr)
have once : ∀ x, x ∈ F33 → cnt x F33 = 1 := fun x hx => Nat.eq_of_beq_eq_true (all_mem2 _ F33 c_once x hx)
have c01 : ∀ x, x ∈ F33 → cnt x A = 0 ∨ cnt x A = 1 := fun x hx => cnt01 F33 A B hs x (once x hx)
cases c01 S1 memS1 with
| inl a1 =>
cases c01 S2 memS2 with
| inl a2 =>
cases ne_nil A hAne with
| intro x hxA =>
have hxF := mem_split F33 A B hs x hxA
have pos := cnt_pos x A hxA
cases key x hxF with
| inl hr =>
cases hr with
| intro r hr =>
have q := R r hr.1
rw [a1, a2, hr.2] at q
have p00 := all_mem2 _ rows pure00 r hr.1
cases c01 x hxF with
| inl z => rw [z] at pos; exact Nat.lt_irrefl 0 pos
| inr o => rw [o] at q; exact not_tt p00 q
| inr h =>
cases h with
| inl e => rw [e, a1] at pos; exact Nat.lt_irrefl 0 pos
| inr e => rw [e, a2] at pos; exact Nat.lt_irrefl 0 pos
| inr b2 =>
cases any_mem _ rows mixed01 with
| intro r hr =>
have q := R r hr.1
rw [a1, b2] at q
have hb := and_tt hr.2
cases c01 r.ck (mem_ck r hr.1) with
| inl z => rw [z] at q; exact not_tt hb.1 q
| inr o => rw [o] at q; exact not_tt hb.2 q
| inr b1 =>
cases c01 S2 memS2 with
| inl a2 =>
cases any_mem _ rows mixed10 with
| intro r hr =>
have q := R r hr.1
rw [b1, a2] at q
have hb := and_tt hr.2
cases c01 r.ck (mem_ck r hr.1) with
| inl z => rw [z] at q; exact not_tt hb.1 q
| inr o => rw [o] at q; exact not_tt hb.2 q
| inr b2 =>
cases ne_nil B hBne with
| intro y hyB =>
have hyF := mem_split_r F33 A B hs y hyB
have posB := cnt_pos y B hyB
have sum : cnt y A + cnt y B = 1 := (FamIndec3.splits_gs (ind y) F33 A B hs).trans (once y hyF)
have hyA1 : cnt y A = 1 := by
cases key y hyF with
| inl hr =>
cases hr with
| intro r hr =>
have q := R r hr.1
rw [b1, b2, hr.2] at q
cases c01 y hyF with
| inl z => rw [z] at q; exact (not_tt (all_mem2 _ rows pure11 r hr.1) q).elim
| inr o => exact o
| inr h =>
cases h with
| inl e => rw [e]; exact b1
| inr e => rw [e]; exact b2
rw [hyA1] at sum
have z : cnt y B = 0 := add_left_cancel' 1 _ 0 (sum.trans rfl : 1 + cnt y B = 1 + 0)
rw [z] at posB
exact Nat.lt_irrefl 0 posB
theorem lincert : indec 462 F33 = true := by
cases hind : indec 462 F33 with
| true => rfl
| false =>
exfalso
cases all_false _ (splits F33) hind with
| intro sp hsp =>
have hf : (sp.1.isEmpty || sp.2.isEmpty || !(bal 462 sp.1 && bal 462 sp.2)) = false := hsp.2
cases h1 : sp.1.isEmpty with
| true => rw [h1] at hf; exact nomatch hf
| false => cases h2 : sp.2.isEmpty with
| true => rw [h1, h2] at hf; exact nomatch hf
| false => cases hA : bal 462 sp.1 with
| false => rw [h1, h2, hA] at hf; exact nomatch hf
| true => exact no_split sp.1 sp.2 hsp.1 hA h1 h2
end LinCert33
#print axioms LinCert33.gs_lin
#print axioms LinCert33.lin
#print axioms LinCert33.row_eq
#print axioms LinCert33.rows_ok
#print axioms LinCert33.no_split
#print axioms LinCert33.lincert
lean_all/hodge/MailletBridge.lean
/-
hodge/MailletBridge.lean — T41 cycle 1716 (goal G849c): balanced characters of degree p = q + 1 and the
Maillet-type matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ h). For a list c with entries in (0, p) put
G_x = #x(c) − #(p − x)(c). If c is balanced for 1 ≤ t ≤ h (2 T_t(c) = |c| p), then row_t · G = 0 for each t
(given the finite check deltaOK: row_t · D(y) = 2⟨t y⟩ − p for 1 ≤ y ≤ q, where D(y) is G of the one-entry list).
With an integer certificate B · A = d · I (hodge/MailletLin) this forces G = 0: every x has as many copies as
p − x, i.e. c is a union of complementary pairs — at every length. Lean 4 core, hand proofs, no axioms.
-/
import hodge.MailletLin
namespace MailletBridge
open MailletLin LibInt
/-- s, s+1, …, s+k−1. -/
def rng : Nat → Nat → List Nat
| _, 0 => []
| s, k + 1 => s :: rng (s + 1) k
/-- Number of copies of x in a list. -/
def cnt (x : Nat) : List Nat → Nat
| [] => 0
| y :: l => cond (Nat.beq x y) 1 0 + cnt x l
def ind (b : Bool) : Int := cond b 1 0
/-- The sum T_t(c) = Σ ⟨t c_i⟩. -/
def tsum (m t : Nat) : List Nat → Nat
| [] => 0
| a :: l => (t * a) % m + tsum m t l
def rowA (p t : Nat) (xs : List Nat) : List Int := xs.map (fun x => 2 * (((t * x) % p : Nat) : Int) - p)
def Gv (p : Nat) (xs c : List Nat) : List Int := xs.map (fun x => (cnt x c : Int) - (cnt (p - x) c : Int))
def Dv (p : Nat) (xs : List Nat) (y : Nat) : List Int := xs.map (fun x => ind (Nat.beq x y) - ind (Nat.beq (p - x) y))
def sumT (p t : Nat) : List Nat → Int
| [] => 0
| y :: l => (2 * (((t * y) % p : Nat) : Int) - p) + sumT p t l
/-- Finite check for p = q + 1: row_t · D(y) = 2⟨t y⟩ − p for 1 ≤ t ≤ h, 1 ≤ y ≤ q. -/
def deltaOK (q h : Nat) : Bool :=
(rng 1 h).all (fun t => (rng 1 q).all (fun y =>
decide (dot (rowA (q + 1) t (rng 1 h)) (Dv (q + 1) (rng 1 h) y) = 2 * (((t * y) % (q + 1) : Nat) : Int) - (q + 1 : Nat))))
theorem len_map {α β : Type} (f : α → β) : ∀ xs : List α, (xs.map f).length = xs.length
| [] => rfl
| _ :: xs => congrArg (· + 1) (len_map f xs)
theorem len_rng : ∀ s k : Nat, (rng s k).length = k
| _, 0 => rfl
| s, k + 1 => congrArg (· + 1) (len_rng (s + 1) k)
theorem and_true_left : ∀ {a b : Bool}, (a && b) = true → a = true
| true, _, _ => rfl
| false, _, h => Bool.noConfusion h
theorem and_true_right : ∀ {a b : Bool}, (a && b) = true → b = true
| true, _, h => h
| false, _, h => Bool.noConfusion h
theorem le_cases {s y : Nat} (h : s ≤ y) : y = s ∨ s + 1 ≤ y := by
cases h with
| refl => exact Or.inl rfl
| step h' => exact Or.inr (Nat.succ_le_succ h')
theorem succ_add' (s k : Nat) : s + 1 + k = s + (k + 1) := by
induction k with
| zero => rfl
| succ k ih => exact congrArg (· + 1) ih
theorem lt_irrefl' : ∀ s : Nat, ¬ s < s
| 0, h => Nat.noConfusion (Nat.eq_zero_of_le_zero h)
| s + 1, h => lt_irrefl' s (Nat.le_of_succ_le_succ h)
/-- Every element of rng s k satisfies P when the Boolean check holds. -/
theorem all_rng (P : Nat → Bool) : ∀ (k s y : Nat), (rng s k).all P = true → s ≤ y → y < s + k → P y = true
| 0, s, y, _, h1, h2 => absurd (Nat.lt_of_lt_of_le h2 h1) (lt_irrefl' y)
| k + 1, s, y, h, h1, h2 => by
have h' : (P s && (rng (s + 1) k).all P) = true := h
cases le_cases h1 with
| inl e => rw [e]; exact and_true_left h'
| inr e =>
apply all_rng P k (s + 1) y (and_true_right h') e
rw [succ_add']; exact h2
theorem natCast_add (a b : Nat) : ((a + b : Nat) : Int) = (a : Int) + (b : Int) := rfl
theorem natCast_mul (a b : Nat) : ((a * b : Nat) : Int) = (a : Int) * (b : Int) := rfl
theorem cond_cast (b : Bool) : ((cond b 1 0 : Nat) : Int) = ind b := by
cases b <;> rfl
theorem G_nil (p : Nat) : ∀ xs : List Nat, Gv p xs [] = zeros xs.length
| [] => rfl
| _ :: xs => by
show (((0 : Nat) : Int) - ((0 : Nat) : Int)) :: Gv p xs [] = 0 :: zeros xs.length
rw [G_nil p xs]
rfl
theorem G_cons (p y : Nat) (l : List Nat) : ∀ xs : List Nat, Gv p xs (y :: l) = addV (Gv p xs l) (Dv p xs y)
| [] => rfl
| x :: xs => by
show (((cond (Nat.beq x y) 1 0 + cnt x l : Nat) : Int) - ((cond (Nat.beq (p - x) y) 1 0 + cnt (p - x) l : Nat) : Int))
:: Gv p xs (y :: l)
= (((cnt x l : Int) - (cnt (p - x) l : Int)) + (ind (Nat.beq x y) - ind (Nat.beq (p - x) y)))
:: addV (Gv p xs l) (Dv p xs y)
rw [G_cons p y l xs, natCast_add, natCast_add, cond_cast, cond_cast]
generalize ind (Nat.beq x y) = a
generalize ind (Nat.beq (p - x) y) = b
generalize ((cnt x l : Nat) : Int) = u
generalize ((cnt (p - x) l : Nat) : Int) = v
have e : a + u - (b + v) = u - v + (a - b) := by lib_int
rw [e]
theorem dot_addV_r : ∀ r u v : List Int, u.length = v.length → dot r (addV u v) = dot r u + dot r v
| [], _, _, _ => by
show (0 : Int) = 0 + 0
rfl
| _ :: _, [], [], _ => by
show (0 : Int) = 0 + 0
rfl
| _ :: _, [], _ :: _, h => Nat.noConfusion h
| _ :: _, _ :: _, [], h => Nat.noConfusion h
| a :: rs, x :: xs, y :: ys, h => by
show a * (x + y) + dot rs (addV xs ys) = (a * x + dot rs xs) + (a * y + dot rs ys)
rw [dot_addV_r rs xs ys (Nat.succ.inj h)]
generalize dot rs xs = P
generalize dot rs ys = Q
lib_int
theorem decide_eq {a b : Int} (h : decide (a = b) = true) : a = b := of_decide_eq_true h
/-- row_t · G(c) = Σ_{y ∈ c} (2⟨t y⟩ − p), given the finite check. -/
theorem dot_G (q h t : Nat) (hD : deltaOK q h = true) (ht1 : 1 ≤ t) (ht2 : t < 1 + h) :
∀ c : List Nat, (∀ y, y ∈ c → 1 ≤ y ∧ y < 1 + q) →
dot (rowA (q + 1) t (rng 1 h)) (Gv (q + 1) (rng 1 h) c) = sumT (q + 1) t c
| [], _ => by
rw [G_nil]
exact dot_zeros_right _ _
| y :: l, hc => by
have hy := hc y (List.Mem.head l)
have hl : ∀ z, z ∈ l → 1 ≤ z ∧ z < 1 + q := fun z hz => hc z (List.Mem.tail y hz)
have hrow := all_rng _ h 1 t hD ht1 ht2
have hdy := decide_eq (all_rng _ q 1 y hrow hy.1 hy.2)
rw [G_cons, dot_addV_r _ _ _ (by rw [Gv, Dv, len_map, len_map]), hdy, dot_G q h t hD ht1 ht2 l hl]
show sumT (q + 1) t l + (2 * (((t * y) % (q + 1) : Nat) : Int) - ((q + 1 : Nat) : Int))
= (2 * (((t * y) % (q + 1) : Nat) : Int) - ((q + 1 : Nat) : Int)) + sumT (q + 1) t l
exact i_add_comm _ _
theorem sumT_eq (p t : Nat) : ∀ c : List Nat,
sumT p t c = ((tsum p t c : Nat) : Int) + ((tsum p t c : Nat) : Int) - ((c.length * p : Nat) : Int)
| [] => by
show (0 : Int) = 0 + 0 - 0 * ((p : Nat) : Int)
generalize ((p : Nat) : Int) = P
lib_int
| y :: l => by
show (2 * (((t * y) % p : Nat) : Int) - ((p : Nat) : Int)) + sumT p t l = _
rw [sumT_eq p t l]
show (2 * (((t * y) % p : Nat) : Int) - ((p : Nat) : Int))
+ (((tsum p t l : Nat) : Int) + ((tsum p t l : Nat) : Int) - ((l.length : Nat) : Int) * ((p : Nat) : Int))
= (((t * y) % p : Nat) : Int) + ((tsum p t l : Nat) : Int) + ((((t * y) % p : Nat) : Int) + ((tsum p t l : Nat) : Int))
- (((l.length : Nat) : Int) + 1) * ((p : Nat) : Int)
generalize (((t * y) % p : Nat) : Int) = r
generalize ((tsum p t l : Nat) : Int) = T
generalize ((l.length : Nat) : Int) = L
generalize ((p : Nat) : Int) = P
lib_int
theorem sumT_zero (p t : Nat) (c : List Nat) (hb : tsum p t c + tsum p t c = c.length * p) : sumT p t c = 0 := by
rw [sumT_eq, ← natCast_add, hb]
generalize ((c.length * p : Nat) : Int) = z
lib_int
/-- Rows with zero dot product give the zero vector. -/
theorem mv_rows (row : Nat → List Int) (g : List Int) :
∀ (k s : Nat), (∀ t, s ≤ t → t < s + k → dot (row t) g = 0) → mv ((rng s k).map row) g = zeros k
| 0, _, _ => rfl
| k + 1, s, hz => by
show dot (row s) g :: mv ((rng (s + 1) k).map row) g = 0 :: zeros k
have h0 : dot (row s) g = 0 := hz s (Nat.le_refl s) (Nat.succ_le_succ (Nat.le_add_right s k))
have h1 : mv ((rng (s + 1) k).map row) g = zeros k := by
apply mv_rows row g k (s + 1)
intro t ht1 ht2
apply hz t (Nat.le_of_succ_le ht1)
rw [← succ_add']; exact ht2
rw [h0, h1]
theorem beq_refl : ∀ a : Nat, Nat.beq a a = true
| 0 => rfl
| a + 1 => beq_refl a
theorem sub_zero_eq (a b : Nat) (h : (a : Int) - (b : Int) = 0) : a = b := by
have e : (a : Int) = ((a : Int) - (b : Int)) + (b : Int) := by
generalize (a : Int) = u
generalize (b : Int) = v
lib_int
rw [h] at e
have e2 : (a : Int) = (b : Int) := by
rw [e]
generalize (b : Int) = v
lib_int
exact Int.ofNat.inj e2
theorem all_of_zero (p : Nat) (c : List Nat) : ∀ xs : List Nat, Gv p xs c = zeros xs.length →
xs.all (fun x => Nat.beq (cnt x c) (cnt (p - x) c)) = true
| [], _ => rfl
| x :: xs, h => by
have h1 : (cnt x c : Int) - (cnt (p - x) c : Int) = 0 := (List.cons.inj h).1
have h2 : Gv p xs c = zeros xs.length := (List.cons.inj h).2
show (Nat.beq (cnt x c) (cnt (p - x) c) && xs.all (fun x => Nat.beq (cnt x c) (cnt (p - x) c))) = true
rw [sub_zero_eq _ _ h1, beq_refl, all_of_zero p c xs h2]
rfl
/-- **Bridge.** For p = q + 1, an invertibility certificate for A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ h) and the
finite check deltaOK, every list with entries in (0, p) that is balanced for 1 ≤ t ≤ h has
#x = #(p − x) for 1 ≤ x ≤ h: it is a union of complementary pairs. -/
theorem pairs_of_bal (q h : Nat) (d : Int) (hd : d ≠ 0) (A B : List (List Int))
(hA : allLen h A = true) (hc : lcs h B A = sid d h)
(hAdef : A = (rng 1 h).map (fun t => rowA (q + 1) t (rng 1 h))) (hD : deltaOK q h = true)
(c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < q + 1)
(hb : ∀ t, 1 ≤ t → t < 1 + h → tsum (q + 1) t c + tsum (q + 1) t c = c.length * (q + 1)) :
(rng 1 h).all (fun x => Nat.beq (cnt x c) (cnt (q + 1 - x) c)) = true := by
have hr' : ∀ y, y ∈ c → 1 ≤ y ∧ y < 1 + q := fun y hy =>
⟨(hr y hy).1, by rw [Nat.add_comm]; exact (hr y hy).2⟩
have hz : mv A (Gv (q + 1) (rng 1 h) c) = zeros A.length := by
rw [hAdef, len_map, len_rng]
apply mv_rows _ _ h 1
intro t ht1 ht2
rw [dot_G q h t hD ht1 ht2 c hr']
exact sumT_zero _ _ _ (hb t ht1 ht2)
have hg : (Gv (q + 1) (rng 1 h) c).length = h := by rw [Gv, len_map, len_rng]
have h0 := kernel_zero h d hd A B hA hc _ hg hz
apply all_of_zero (q + 1) c (rng 1 h)
rw [len_rng]; exact h0
end MailletBridge
#print axioms MailletBridge.all_rng
#print axioms MailletBridge.G_cons
#print axioms MailletBridge.dot_addV_r
#print axioms MailletBridge.dot_G
#print axioms MailletBridge.sumT_eq
#print axioms MailletBridge.sumT_zero
#print axioms MailletBridge.mv_rows
#print axioms MailletBridge.sub_zero_eq
#print axioms MailletBridge.all_of_zero
#print axioms MailletBridge.pairs_of_bal
lean_all/hodge/MailletCert101.lean
/-
hodge/MailletCert101.lean — T41 (goals G849b, G849c): for p = 101 the 50 × 50 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 50)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 28663027375250 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 101) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert101
open MailletLin MailletBridge
def A : List (List Int) := [
[-99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99],
[-95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97],
[-91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95],
[-87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, -91, -77, -63, -49, -35, -21, -7],
[-85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93],
[-83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, -99, -81, -63, -45, -27, -9],
[-81, -61, -41, -21, -1, 19, 39, 59, 79, 99, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91],
[-79, -57, -35, -13, 9, 31, 53, 75, 97, -83, -61, -39, -17, 5, 27, 49, 71, 93, -87, -65, -43, -21, 1, 23, 45, 67, 89, -91, -69, -47, -25, -3, 19, 41, 63, 85, -95, -73, -51, -29, -7, 15, 37, 59, 81, -99, -77, -55, -33, -11],
[-77, -53, -29, -5, 19, 43, 67, 91, -87, -63, -39, -15, 9, 33, 57, 81, -97, -73, -49, -25, -1, 23, 47, 71, 95, -83, -59, -35, -11, 13, 37, 61, 85, -93, -69, -45, -21, 3, 27, 51, 75, 99, -79, -55, -31, -7, 17, 41, 65, 89],
[-75, -49, -23, 3, 29, 55, 81, -95, -69, -43, -17, 9, 35, 61, 87, -89, -63, -37, -11, 15, 41, 67, 93, -83, -57, -31, -5, 21, 47, 73, 99, -77, -51, -25, 1, 27, 53, 79, -97, -71, -45, -19, 7, 33, 59, 85, -91, -65, -39, -13],
[-73, -45, -17, 11, 39, 67, 95, -79, -51, -23, 5, 33, 61, 89, -85, -57, -29, -1, 27, 55, 83, -91, -63, -35, -7, 21, 49, 77, -97, -69, -41, -13, 15, 43, 71, 99, -75, -47, -19, 9, 37, 65, 93, -81, -53, -25, 3, 31, 59, 87],
[-71, -41, -11, 19, 49, 79, -93, -63, -33, -3, 27, 57, 87, -85, -55, -25, 5, 35, 65, 95, -77, -47, -17, 13, 43, 73, -99, -69, -39, -9, 21, 51, 81, -91, -61, -31, -1, 29, 59, 89, -83, -53, -23, 7, 37, 67, 97, -75, -45, -15],
[-69, -37, -5, 27, 59, 91, -79, -47, -15, 17, 49, 81, -89, -57, -25, 7, 39, 71, -99, -67, -35, -3, 29, 61, 93, -77, -45, -13, 19, 51, 83, -87, -55, -23, 9, 41, 73, -97, -65, -33, -1, 31, 63, 95, -75, -43, -11, 21, 53, 85],
[-67, -33, 1, 35, 69, -99, -65, -31, 3, 37, 71, -97, -63, -29, 5, 39, 73, -95, -61, -27, 7, 41, 75, -93, -59, -25, 9, 43, 77, -91, -57, -23, 11, 45, 79, -89, -55, -21, 13, 47, 81, -87, -53, -19, 15, 49, 83, -85, -51, -17],
[-65, -29, 7, 43, 79, -87, -51, -15, 21, 57, 93, -73, -37, -1, 35, 71, -95, -59, -23, 13, 49, 85, -81, -45, -9, 27, 63, 99, -67, -31, 5, 41, 77, -89, -53, -17, 19, 55, 91, -75, -39, -3, 33, 69, -97, -61, -25, 11, 47, 83],
[-63, -25, 13, 51, 89, -75, -37, 1, 39, 77, -87, -49, -11, 27, 65, -99, -61, -23, 15, 53, 91, -73, -35, 3, 41, 79, -85, -47, -9, 29, 67, -97, -59, -21, 17, 55, 93, -71, -33, 5, 43, 81, -83, -45, -7, 31, 69, -95, -57, -19],
[-61, -21, 19, 59, 99, -63, -23, 17, 57, 97, -65, -25, 15, 55, 95, -67, -27, 13, 53, 93, -69, -29, 11, 51, 91, -71, -31, 9, 49, 89, -73, -33, 7, 47, 87, -75, -35, 5, 45, 85, -77, -37, 3, 43, 83, -79, -39, 1, 41, 81],
[-59, -17, 25, 67, -93, -51, -9, 33, 75, -85, -43, -1, 41, 83, -77, -35, 7, 49, 91, -69, -27, 15, 57, 99, -61, -19, 23, 65, -95, -53, -11, 31, 73, -87, -45, -3, 39, 81, -79, -37, 5, 47, 89, -71, -29, 13, 55, 97, -63, -21],
[-57, -13, 31, 75, -83, -39, 5, 49, 93, -65, -21, 23, 67, -91, -47, -3, 41, 85, -73, -29, 15, 59, -99, -55, -11, 33, 77, -81, -37, 7, 51, 95, -63, -19, 25, 69, -89, -45, -1, 43, 87, -71, -27, 17, 61, -97, -53, -9, 35, 79],
[-55, -9, 37, 83, -73, -27, 19, 65, -91, -45, 1, 47, 93, -63, -17, 29, 75, -81, -35, 11, 57, -99, -53, -7, 39, 85, -71, -25, 21, 67, -89, -43, 3, 49, 95, -61, -15, 31, 77, -79, -33, 13, 59, -97, -51, -5, 41, 87, -69, -23],
[-53, -5, 43, 91, -63, -15, 33, 81, -73, -25, 23, 71, -83, -35, 13, 61, -93, -45, 3, 51, 99, -55, -7, 41, 89, -65, -17, 31, 79, -75, -27, 21, 69, -85, -37, 11, 59, -95, -47, 1, 49, 97, -57, -9, 39, 87, -67, -19, 29, 77],
[-51, -1, 49, 99, -53, -3, 47, 97, -55, -5, 45, 95, -57, -7, 43, 93, -59, -9, 41, 91, -61, -11, 39, 89, -63, -13, 37, 87, -65, -15, 35, 85, -67, -17, 33, 83, -69, -19, 31, 81, -71, -21, 29, 79, -73, -23, 27, 77, -75, -25],
[-49, 3, 55, -95, -43, 9, 61, -89, -37, 15, 67, -83, -31, 21, 73, -77, -25, 27, 79, -71, -19, 33, 85, -65, -13, 39, 91, -59, -7, 45, 97, -53, -1, 51, -99, -47, 5, 57, -93, -41, 11, 63, -87, -35, 17, 69, -81, -29, 23, 75],
[-47, 7, 61, -87, -33, 21, 75, -73, -19, 35, 89, -59, -5, 49, -99, -45, 9, 63, -85, -31, 23, 77, -71, -17, 37, 91, -57, -3, 51, -97, -43, 11, 65, -83, -29, 25, 79, -69, -15, 39, 93, -55, -1, 53, -95, -41, 13, 67, -81, -27],
[-45, 11, 67, -79, -23, 33, 89, -57, -1, 55, -91, -35, 21, 77, -69, -13, 43, 99, -47, 9, 65, -81, -25, 31, 87, -59, -3, 53, -93, -37, 19, 75, -71, -15, 41, 97, -49, 7, 63, -83, -27, 29, 85, -61, -5, 51, -95, -39, 17, 73],
[-43, 15, 73, -71, -13, 45, -99, -41, 17, 75, -69, -11, 47, -97, -39, 19, 77, -67, -9, 49, -95, -37, 21, 79, -65, -7, 51, -93, -35, 23, 81, -63, -5, 53, -91, -33, 25, 83, -61, -3, 55, -89, -31, 27, 85, -59, -1, 57, -87, -29],
[-41, 19, 79, -63, -3, 57, -85, -25, 35, 95, -47, 13, 73, -69, -9, 51, -91, -31, 29, 89, -53, 7, 67, -75, -15, 45, -97, -37, 23, 83, -59, 1, 61, -81, -21, 39, 99, -43, 17, 77, -65, -5, 55, -87, -27, 33, 93, -49, 11, 71],
[-39, 23, 85, -55, 7, 69, -71, -9, 53, -87, -25, 37, 99, -41, 21, 83, -57, 5, 67, -73, -11, 51, -89, -27, 35, 97, -43, 19, 81, -59, 3, 65, -75, -13, 49, -91, -29, 33, 95, -45, 17, 79, -61, 1, 63, -77, -15, 47, -93, -31],
[-37, 27, 91, -47, 17, 81, -57, 7, 71, -67, -3, 61, -77, -13, 51, -87, -23, 41, -97, -33, 31, 95, -43, 21, 85, -53, 11, 75, -63, 1, 65, -73, -9, 55, -83, -19, 45, -93, -29, 35, 99, -39, 25, 89, -49, 15, 79, -59, 5, 69],
[-35, 31, 97, -39, 27, 93, -43, 23, 89, -47, 19, 85, -51, 15, 81, -55, 11, 77, -59, 7, 73, -63, 3, 69, -67, -1, 65, -71, -5, 61, -75, -9, 57, -79, -13, 53, -83, -17, 49, -87, -21, 45, -91, -25, 41, -95, -29, 37, -99, -33],
[-33, 35, -99, -31, 37, -97, -29, 39, -95, -27, 41, -93, -25, 43, -91, -23, 45, -89, -21, 47, -87, -19, 49, -85, -17, 51, -83, -15, 53, -81, -13, 55, -79, -11, 57, -77, -9, 59, -75, -7, 61, -73, -5, 63, -71, -3, 65, -69, -1, 67],
[-31, 39, -93, -23, 47, -85, -15, 55, -77, -7, 63, -69, 1, 71, -61, 9, 79, -53, 17, 87, -45, 25, 95, -37, 33, -99, -29, 41, -91, -21, 49, -83, -13, 57, -75, -5, 65, -67, 3, 73, -59, 11, 81, -51, 19, 89, -43, 27, 97, -35],
[-29, 43, -87, -15, 57, -73, -1, 71, -59, 13, 85, -45, 27, 99, -31, 41, -89, -17, 55, -75, -3, 69, -61, 11, 83, -47, 25, 97, -33, 39, -91, -19, 53, -77, -5, 67, -63, 9, 81, -49, 23, 95, -35, 37, -93, -21, 51, -79, -7, 65],
[-27, 47, -81, -7, 67, -61, 13, 87, -41, 33, -95, -21, 53, -75, -1, 73, -55, 19, 93, -35, 39, -89, -15, 59, -69, 5, 79, -49, 25, 99, -29, 45, -83, -9, 65, -63, 11, 85, -43, 31, -97, -23, 51, -77, -3, 71, -57, 17, 91, -37],
[-25, 51, -75, 1, 77, -49, 27, -99, -23, 53, -73, 3, 79, -47, 29, -97, -21, 55, -71, 5, 81, -45, 31, -95, -19, 57, -69, 7, 83, -43, 33, -93, -17, 59, -67, 9, 85, -41, 35, -91, -15, 61, -65, 11, 87, -39, 37, -89, -13, 63],
[-23, 55, -69, 9, 87, -37, 41, -83, -5, 73, -51, 27, -97, -19, 59, -65, 13, 91, -33, 45, -79, -1, 77, -47, 31, -93, -15, 63, -61, 17, 95, -29, 49, -75, 3, 81, -43, 35, -89, -11, 67, -57, 21, 99, -25, 53, -71, 7, 85, -39],
[-21, 59, -63, 17, 97, -25, 55, -67, 13, 93, -29, 51, -71, 9, 89, -33, 47, -75, 5, 85, -37, 43, -79, 1, 81, -41, 39, -83, -3, 77, -45, 35, -87, -7, 73, -49, 31, -91, -11, 69, -53, 27, -95, -15, 65, -57, 23, -99, -19, 61],
[-19, 63, -57, 25, -95, -13, 69, -51, 31, -89, -7, 75, -45, 37, -83, -1, 81, -39, 43, -77, 5, 87, -33, 49, -71, 11, 93, -27, 55, -65, 17, 99, -21, 61, -59, 23, -97, -15, 67, -53, 29, -91, -9, 73, -47, 35, -85, -3, 79, -41],
[-17, 67, -51, 33, -85, -1, 83, -35, 49, -69, 15, 99, -19, 65, -53, 31, -87, -3, 81, -37, 47, -71, 13, 97, -21, 63, -55, 29, -89, -5, 79, -39, 45, -73, 11, 95, -23, 61, -57, 27, -91, -7, 77, -41, 43, -75, 9, 93, -25, 59],
[-15, 71, -45, 41, -75, 11, 97, -19, 67, -49, 37, -79, 7, 93, -23, 63, -53, 33, -83, 3, 89, -27, 59, -57, 29, -87, -1, 85, -31, 55, -61, 25, -91, -5, 81, -35, 51, -65, 21, -95, -9, 77, -39, 47, -69, 17, -99, -13, 73, -43],
[-13, 75, -39, 49, -65, 23, -91, -3, 85, -29, 59, -55, 33, -81, 7, 95, -19, 69, -45, 43, -71, 17, -97, -9, 79, -35, 53, -61, 27, -87, 1, 89, -25, 63, -51, 37, -77, 11, 99, -15, 73, -41, 47, -67, 21, -93, -5, 83, -31, 57],
[-11, 79, -33, 57, -55, 35, -77, 13, -99, -9, 81, -31, 59, -53, 37, -75, 15, -97, -7, 83, -29, 61, -51, 39, -73, 17, -95, -5, 85, -27, 63, -49, 41, -71, 19, -93, -3, 87, -25, 65, -47, 43, -69, 21, -91, -1, 89, -23, 67, -45],
[-9, 83, -27, 65, -45, 47, -63, 29, -81, 11, -99, -7, 85, -25, 67, -43, 49, -61, 31, -79, 13, -97, -5, 87, -23, 69, -41, 51, -59, 33, -77, 15, -95, -3, 89, -21, 71, -39, 53, -57, 35, -75, 17, -93, -1, 91, -19, 73, -37, 55],
[-7, 87, -21, 73, -35, 59, -49, 45, -63, 31, -77, 17, -91, 3, 97, -11, 83, -25, 69, -39, 55, -53, 41, -67, 27, -81, 13, -95, -1, 93, -15, 79, -29, 65, -43, 51, -57, 37, -71, 23, -85, 9, -99, -5, 89, -19, 75, -33, 61, -47],
[-5, 91, -15, 81, -25, 71, -35, 61, -45, 51, -55, 41, -65, 31, -75, 21, -85, 11, -95, 1, 97, -9, 87, -19, 77, -29, 67, -39, 57, -49, 47, -59, 37, -69, 27, -79, 17, -89, 7, -99, -3, 93, -13, 83, -23, 73, -33, 63, -43, 53],
[-3, 95, -9, 89, -15, 83, -21, 77, -27, 71, -33, 65, -39, 59, -45, 53, -51, 47, -57, 41, -63, 35, -69, 29, -75, 23, -81, 17, -87, 11, -93, 5, -99, -1, 97, -7, 91, -13, 85, -19, 79, -25, 73, -31, 67, -37, 61, -43, 55, -49],
[-1, 99, -3, 97, -5, 95, -7, 93, -9, 91, -11, 89, -13, 87, -15, 85, -17, 83, -19, 81, -21, 79, -23, 77, -25, 75, -27, 73, -29, 71, -31, 69, -33, 67, -35, 65, -37, 63, -39, 61, -41, 59, -43, 57, -45, 55, -47, 53, -49, 51]]
def B : List (List Int) := [
[-546525367, -8821438721, 1706237024, 5178636597, -8136279257, -9622807733, -8474069476, -14030331119, -9814463233, -5842759456, -23715470031, -6954167879, -18678810928, -11280095058, -13273537606, -9590292882, -32733293158, -3840333274, -15886215647, -16281178653, -20560493033, 3524928257, -26898089128, -11672958672, -17548541817, -18340337454, -27767352254, -8019103829, -20257331479, -91082493 -- (+269 chars; full line in the Zenodo source)
[-8821438721, 5178636597, -9622807733, -14030331119, -5842759456, -6954167879, -11280095058, -9590292882, -3840333274, -16281178653, 3524928257, -11672958672, -18340337454, -8019103829, -9108249368, -17195685881, 3705776446, -7682894542, -12361486821, 3994857471, 2251264476, -5263281894, 7047957396, 8804890819, -497083351, 12746396833, 19833964758, 8775084428, 11483615003, 28245707156, 119657885 -- (+246 chars; full line in the Zenodo source)
[1706237024, -9622807733, -9814463233, -6954167879, -13273537606, -3840333274, -20560493033, -11672958672, -27767352254, -9108249368, -13620436853, -7682894542, -11965788569, 2251264476, -8775084428, 8804890819, 497083351, 19833964758, 5263281894, 28245707156, 12361486821, 19901296331, 17195685881, 20257331479, 18340337454, 26898089128, 16281178653, 32733293158, 11280095058, 23715470031, 1403033 -- (+252 chars; full line in the Zenodo source)
[5178636597, -14030331119, -6954167879, -9590292882, -16281178653, -11672958672, -8019103829, -17195685881, -7682894542, 3994857471, -5263281894, 8804890819, 12746396833, 8775084428, 28245707156, 28944322047, 13620436853, 20257331479, 17548541817, 20560493033, 32733293158, 18678810928, 9814463233, 8136279257, 546525367, 1706237024, -8474069476, -23715470031, -13273537606, -15886215647, -26898089 -- (+251 chars; full line in the Zenodo source)
[-8136279257, -5842759456, -13273537606, -16281178653, -17548541817, -9108249368, -19901296331, 3994857471, -8775084428, -497083351, -7047957396, 28245707156, 7682894542, 27587678007, 18340337454, 20560493033, 9590292882, 23715470031, 9622807733, 546525367, 5178636597, -9814463233, -11280095058, -15886215647, -11672958672, -20257331479, 3705776446, -11965788569, -5263281894, -12746396833, 198339 -- (+255 chars; full line in the Zenodo source)
[-9622807733, -6954167879, -3840333274, -11672958672, -9108249368, -7682894542, 2251264476, 8804890819, 19833964758, 28245707156, 19901296331, 20257331479, 26898089128, 32733293158, 23715470031, 8136279257, -546525367, -8474069476, -18678810928, -15886215647, -17548541817, -27587678007, -28944322047, -11483615003, -12746396833, -7047957396, -3994857471, -3705776446, 8019103829, -3524928257, 9590 -- (+257 chars; full line in the Zenodo source)
[-8474069476, -11280095058, -20560493033, -8019103829, -19901296331, 2251264476, -12746396833, 8775084428, 12361486821, 27587678007, 11672958672, 32733293158, 5842759456, -1706237024, 5178636597, -23715470031, -3840333274, -17548541817, -17195685881, -11965788569, 7047957396, -8804890819, 28245707156, -3705776446, 27767352254, 16281178653, 18678810928, 9622807733, -546525367, -14030331119, -1327 -- (+254 chars; full line in the Zenodo source)
[-14030331119, -9590292882, -11672958672, -17195685881, 3994857471, 8804890819, 8775084428, 28944322047, 20257331479, 20560493033, 18678810928, 8136279257, 1706237024, -23715470031, -15886215647, -27767352254, -19901296331, -11483615003, 497083351, -2251264476, -3705776446, 18340337454, 3840333274, 5842759456, 8821438721, -9622807733, -11280095058, 3524928257, -9108249368, -12361486821, 70479573 -- (+250 chars; full line in the Zenodo source)
[-9814463233, -3840333274, -27767352254, -7682894542, -8775084428, 19833964758, 12361486821, 20257331479, 16281178653, 23715470031, 8821438721, -8474069476, -9590292882, -17548541817, 3705776446, -11483615003, 12746396833, -3994857471, 27587678007, -3524928257, 18678810928, -5178636597, -8136279257, -11280095058, -26898089128, -17195685881, -28245707156, -497083351, -2251264476, 13620436853, 116 -- (+255 chars; full line in the Zenodo source)
[-5842759456, -16281178653, -9108249368, 3994857471, -497083351, 28245707156, 27587678007, 20560493033, 23715470031, 546525367, -9814463233, -15886215647, -20257331479, -11965788569, -12746396833, -2251264476, 17195685881, -3524928257, 6954167879, 8821438721, -14030331119, -3840333274, -8019103829, -12361486821, 8804890819, 11483615003, 13620436853, 26898089128, 18678810928, -1706237024, -847406 -- (+254 chars; full line in the Zenodo source)
[-23715470031, 3524928257, -13620436853, -5263281894, -7047957396, 19901296331, 11672958672, 18678810928, 8821438721, -9814463233, -16281178653, -27587678007, 2251264476, -8804890819, 28944322047, 18340337454, 13273537606, -5178636597, -8474069476, -3840333274, -20257331479, 3994857471, 497083351, 11965788569, 8019103829, 32733293158, 9622807733, -8136279257, -9590292882, -27767352254, -12361486 -- (+252 chars; full line in the Zenodo source)
[-6954167879, -11672958672, -7682894542, 8804890819, 28245707156, 20257331479, 32733293158, 8136279257, -8474069476, -15886215647, -27587678007, -11483615003, -7047957396, -3705776446, -3524928257, 5842759456, -8821438721, -11280095058, -18340337454, -12361486821, -497083351, 11965788569, 27767352254, 13273537606, -1706237024, -9814463233, -20560493033, -13620436853, -8775084428, 5263281894, 171 -- (+254 chars; full line in the Zenodo source)
[-18678810928, -18340337454, -11965788569, 12746396833, 7682894542, 26898089128, 5842759456, 1706237024, -9590292882, -20257331479, 2251264476, -7047957396, 13620436853, 16281178653, 8474069476, -9622807733, -15886215647, -17195685881, -8775084428, 11483615003, 9108249368, 32733293158, -5178636597, -9814463233, 3524928257, -19901296331, 8804890819, -3994857471, 27767352254, 11280095058, 54652536 -- (+253 chars; full line in the Zenodo source)
[-11280095058, -8019103829, 2251264476, 8775084428, 27587678007, 32733293158, -1706237024, -23715470031, -17548541817, -11965788569, -8804890819, -3705776446, 16281178653, 9622807733, -14030331119, 3524928257, -7682894542, -497083351, 28944322047, 26898089128, 9814463233, -8136279257, -15886215647, -13620436853, -19833964758, -3994857471, 18340337454, 6954167879, -8821438721, -9590292882, -91082 -- (+255 chars; full line in the Zenodo source)
[-13273537606, -9108249368, -8775084428, 28245707156, 18340337454, 23715470031, 5178636597, -15886215647, 3705776446, -12746396833, 28944322047, -3524928257, 8474069476, -14030331119, -26898089128, -12361486821, -8804890819, 13620436853, 3840333274, -1706237024, -6954167879, -27767352254, 2251264476, 5263281894, 20257331479, 11280095058, -546525367, -9590292882, -27587678007, 7047957396, -399485 -- (+254 chars; full line in the Zenodo source)
[-9590292882, -17195685881, 8804890819, 28944322047, 20560493033, 8136279257, -23715470031, -27767352254, -11483615003, -2251264476, 18340337454, 5842759456, -9622807733, 3524928257, -12361486821, 19833964758, 27587678007, 13273537606, -546525367, -32733293158, -13620436853, -12746396833, 7682894542, 16281178653, -5178636597, -6954167879, -8019103829, -5263281894, 28245707156, 17548541817, 98144 -- (+255 chars; full line in the Zenodo source)
[-32733293158, 3705776446, 497083351, 13620436853, 9590292882, -546525367, -3840333274, -19901296331, 12746396833, 17195685881, 13273537606, -8821438721, -15886215647, -7682894542, -8804890819, 27587678007, 11280095058, 1706237024, -16281178653, -28944322047, 19833964758, 9108249368, 18678810928, 5178636597, -20560493033, -12361486821, -7047957396, 20257331479, 6954167879, -8136279257, 352492825 -- (+249 chars; full line in the Zenodo source)
[-3840333274, -7682894542, 19833964758, 20257331479, 23715470031, -8474069476, -17548541817, -11483615003, -3994857471, -3524928257, -5178636597, -11280095058, -17195685881, -497083351, 13620436853, 13273537606, 1706237024, -20560493033, -11965788569, 5263281894, 18340337454, 14030331119, -5842759456, -8019103829, 7047957396, 28944322047, 15886215647, 546525367, -32733293158, -19901296331, -8804 -- (+254 chars; full line in the Zenodo source)
[-15886215647, -12361486821, 5263281894, 17548541817, 9622807733, -18678810928, -17195685881, 497083351, 27587678007, 6954167879, -8474069476, -18340337454, -8775084428, 28944322047, 3840333274, -546525367, -16281178653, -11965788569, 11483615003, 11672958672, 8136279257, -11280095058, -13620436853, 12746396833, 9108249368, 23715470031, -14030331119, -27767352254, 7047957396, 7682894542, 3273329 -- (+251 chars; full line in the Zenodo source)
[-16281178653, 3994857471, 28245707156, 20560493033, 546525367, -15886215647, -11965788569, -2251264476, -3524928257, 8821438721, -3840333274, -12361486821, 11483615003, 26898089128, -1706237024, -32733293158, -28944322047, 5263281894, 11672958672, -5178636597, -9590292882, -7682894542, 8775084428, 17548541817, 8136279257, -13273537606, -19901296331, -7047957396, 18340337454, 9622807733, -112800 -- (+251 chars; full line in the Zenodo source)
[-20560493033, 2251264476, 12361486821, 32733293158, 5178636597, -17548541817, 7047957396, -3705776446, 18678810928, -14030331119, -20257331479, -497083351, 9108249368, 9814463233, -6954167879, -13620436853, 19833964758, 18340337454, 8136279257, -9590292882, -28944322047, 11483615003, -3524928257, 546525367, -16281178653, -28245707156, 11965788569, 3840333274, 1706237024, -11672958672, -87750844 -- (+251 chars; full line in the Zenodo source)
[3524928257, -5263281894, 19901296331, 18678810928, -9814463233, -27587678007, -8804890819, 18340337454, -5178636597, -3840333274, 3994857471, 11965788569, 32733293158, -8136279257, -27767352254, -12746396833, 9108249368, 14030331119, -11280095058, -7682894542, 11483615003, 20560493033, -546525367, -26898089128, -8775084428, -3705776446, 6954167879, -5842759456, -17195685881, 19833964758, 175485 -- (+255 chars; full line in the Zenodo source)
[-26898089128, 7047957396, 17195685881, 9814463233, -11280095058, -28944322047, 28245707156, 3840333274, -8136279257, -8019103829, 497083351, 27767352254, -5178636597, -15886215647, 2251264476, 7682894542, 18678810928, -5842759456, -13620436853, 8775084428, -3524928257, -546525367, -11672958672, -19833964758, 27587678007, 14030331119, -13273537606, -12361486821, -3994857471, 32733293158, -962280 -- (+253 chars; full line in the Zenodo source)
[-11672958672, 8804890819, 20257331479, 8136279257, -15886215647, -11483615003, -3705776446, 5842759456, -11280095058, -12361486821, 11965788569, 13273537606, -9814463233, -13620436853, 5263281894, 16281178653, 5178636597, -8019103829, 12746396833, 17548541817, 546525367, -26898089128, -19833964758, 9108249368, 9622807733, -3840333274, 2251264476, 19901296331, 23715470031, -18678810928, -2894432 -- (+247 chars; full line in the Zenodo source)
[-17548541817, -497083351, 18340337454, 546525367, -11672958672, -12746396833, 27767352254, 8821438721, -26898089128, 8804890819, 8019103829, -1706237024, 3524928257, -19833964758, 20257331479, -5178636597, -20560493033, 7047957396, 9108249368, 8136279257, -16281178653, -8775084428, 27587678007, 9622807733, -15886215647, -5263281894, 17195685881, 8474069476, -3840333274, -11483615003, 1362043685 -- (+251 chars; full line in the Zenodo source)
[-18340337454, 12746396833, 26898089128, 1706237024, -20257331479, -7047957396, 16281178653, -9622807733, -17195685881, 11483615003, 32733293158, -9814463233, -19901296331, -3994857471, 11280095058, -6954167879, -12361486821, 28944322047, 23715470031, -13273537606, -28245707156, -3705776446, 14030331119, -3840333274, -5263281894, 27587678007, 8136279257, -20560493033, -19833964758, 8019103829, 8 -- (+256 chars; full line in the Zenodo source)
[-27767352254, 19833964758, 16281178653, -8474069476, 3705776446, -3994857471, 18678810928, -11280095058, -28245707156, 13620436853, 9622807733, -20560493033, 8804890819, 18340337454, -546525367, -8019103829, -7047957396, 15886215647, -14030331119, -19901296331, 11965788569, 6954167879, -13273537606, 2251264476, 17195685881, 8136279257, 3524928257, -12746396833, 17548541817, -8821438721, -202573 -- (+252 chars; full line in the Zenodo source)
[-8019103829, 8775084428, 32733293158, -23715470031, -11965788569, -3705776446, 9622807733, 3524928257, -497083351, 26898089128, -8136279257, -13620436853, -3994857471, 6954167879, -9590292882, -5263281894, 20257331479, 546525367, -27767352254, -7047957396, 3840333274, -5842759456, -12361486821, 19901296331, 8474069476, -20560493033, -12746396833, 11672958672, 5178636597, -17195685881, 282457071 -- (+252 chars; full line in the Zenodo source)
[-20257331479, 11483615003, 11280095058, -13273537606, -5263281894, 8019103829, -546525367, -9108249368, -2251264476, 18678810928, -9590292882, -8775084428, 27767352254, -8821438721, -27587678007, 28245707156, 6954167879, -32733293158, 7047957396, 18340337454, 1706237024, -17195685881, -3994857471, 23715470031, -3840333274, -19833964758, 17548541817, 5178636597, -13620436853, 11965788569, 584275 -- (+254 chars; full line in the Zenodo source)
[-9108249368, 28245707156, 23715470031, -15886215647, -12746396833, -3524928257, -14030331119, -12361486821, 13620436853, -1706237024, -27767352254, 5263281894, 11280095058, -9590292882, 7047957396, 17548541817, -8136279257, -19901296331, 7682894542, 9622807733, -11672958672, 19833964758, 32733293158, -18678810928, -11483615003, 8019103829, -8821438721, -17195685881, 11965788569, 9814463233, -20 -- (+253 chars; full line in the Zenodo source)
[-27587678007, 11965788569, 14030331119, -26898089128, 19833964758, 9590292882, -13273537606, 7047957396, 11672958672, -8474069476, -12361486821, 17195685881, 546525367, -9108249368, -3994857471, 9814463233, 3524928257, -8804890819, 32733293158, -11280095058, -8775084428, 17548541817, -9622807733, -28944322047, 13620436853, 8821438721, -20257331479, 28245707156, 5842759456, -20560493033, 1274639 -- (+253 chars; full line in the Zenodo source)
[-17195685881, 28944322047, 8136279257, -27767352254, -2251264476, 5842759456, 3524928257, 19833964758, 13273537606, -32733293158, -12746396833, 16281178653, -6954167879, -5263281894, 17548541817, -8474069476, -11965788569, 9108249368, -8821438721, 3705776446, 19901296331, -1706237024, -20257331479, -3994857471, 14030331119, -11672958672, 8775084428, 18678810928, -15886215647, 497083351, 3840333 -- (+250 chars; full line in the Zenodo source)
[-13620436853, 19901296331, 8821438721, -27587678007, 28944322047, -5178636597, -20257331479, 11965788569, 9622807733, -27767352254, 28245707156, 14030331119, -17548541817, 11483615003, 5842759456, -26898089128, 8775084428, 6954167879, -20560493033, 19833964758, 11280095058, -15886215647, 12746396833, 9590292882, -32733293158, -497083351, 3840333274, -13273537606, 8804890819, 16281178653, -18678 -- (+249 chars; full line in the Zenodo source)
[3705776446, 13620436853, -546525367, -19901296331, 17195685881, -8821438721, -7682894542, 27587678007, 1706237024, -28944322047, 9108249368, 5178636597, -12361486821, 20257331479, -8136279257, -11965788569, 8019103829, -9622807733, 3994857471, 27767352254, -8474069476, -28245707156, 18340337454, -14030331119, 2251264476, 17548541817, -9814463233, -11483615003, 11672958672, -5842759456, -5263281 -- (+254 chars; full line in the Zenodo source)
[-19901296331, 27587678007, 5178636597, -11965788569, 27767352254, -14030331119, -11483615003, 26898089128, -6954167879, -19833964758, 15886215647, -9590292882, 497083351, 13273537606, -16281178653, -7047957396, 23715470031, -11672958672, -2251264476, 8474069476, -8019103829, 12361486821, -1706237024, -17195685881, -3705776446, -546525367, -7682894542, 9108249368, -8136279257, 3994857471, 183403 -- (+254 chars; full line in the Zenodo source)
[-7682894542, 20257331479, -8474069476, -11483615003, -3524928257, -11280095058, -497083351, 13273537606, -20560493033, 5263281894, 14030331119, -8019103829, 28944322047, 546525367, -19901296331, 9108249368, -9622807733, 2251264476, 26898089128, -18678810928, -12746396833, 9590292882, -16281178653, 8775084428, 9814463233, -27767352254, 12361486821, 8821438721, 3705776446, 27587678007, -813627925 -- (+251 chars; full line in the Zenodo source)
[-28944322047, 27767352254, -5842759456, -19833964758, 32733293158, -16281178653, 5263281894, 8474069476, -9108249368, -3705776446, 1706237024, 3994857471, 11672958672, -18678810928, -497083351, 11280095058, -26898089128, 28245707156, -5178636597, -13620436853, 27587678007, -9622807733, -11483615003, 20560493033, -9590292882, -8804890819, 23715470031, -18340337454, 12361486821, 546525367, -76828 -- (+253 chars; full line in the Zenodo source)
[-12361486821, 17548541817, -18678810928, 497083351, 6954167879, -18340337454, 28944322047, -546525367, -11965788569, 11672958672, -11280095058, 12746396833, 23715470031, -27767352254, 7682894542, -8821438721, 3994857471, 26898089128, -13273537606, -8804890819, 5842759456, -8019103829, 19901296331, 1706237024, -28245707156, -3524928257, -9590292882, 19833964758, 9814463233, -20257331479, -370577 -- (+252 chars; full line in the Zenodo source)
[-11965788569, 26898089128, -9590292882, -7047957396, 8474069476, -17195685881, 9108249368, -9814463233, 8804890819, 11280095058, -17548541817, 28944322047, -8821438721, -28245707156, 20560493033, -3840333274, 5263281894, 8136279257, 3705776446, 8019103829, -23715470031, -497083351, 6954167879, -27767352254, 19901296331, 5178636597, -11483615003, 15886215647, -16281178653, -2251264476, -17062370 -- (+252 chars; full line in the Zenodo source)
[3994857471, 20560493033, -15886215647, -2251264476, 8821438721, -12361486821, 26898089128, -32733293158, 5263281894, -5178636597, -7682894542, 17548541817, -13273537606, -7047957396, 9622807733, 3705776446, 27767352254, -18678810928, -8804890819, 14030331119, -17195685881, 20257331479, -23715470031, 497083351, 5842759456, -9108249368, 27587678007, -9814463233, -12746396833, 6954167879, -8019103 -- (+252 chars; full line in the Zenodo source)
[-28245707156, 15886215647, 3524928257, 12361486821, 1706237024, -5263281894, 9590292882, -17548541817, 19901296331, -9622807733, -19833964758, 18678810928, -8019103829, 17195685881, -9814463233, -497083351, 5842759456, -27587678007, 20257331479, -6954167879, -8804890819, 8474069476, 3705776446, 18340337454, -13273537606, 8775084428, -5178636597, -28944322047, 26898089128, -3840333274, -22512644 -- (+252 chars; full line in the Zenodo source)
[2251264476, 32733293158, -17548541817, -3705776446, -14030331119, -497083351, 9814463233, -13620436853, 18340337454, -9590292882, 11483615003, 546525367, -28245707156, 3840333274, -11672958672, 19901296331, -8474069476, -12746396833, 5842759456, -17195685881, 27767352254, -13273537606, 5263281894, 8821438721, 3994857471, 15886215647, -26898089128, 7682894542, -9622807733, 8804890819, 2371547003 -- (+252 chars; full line in the Zenodo source)
[-11483615003, 13273537606, -8019103829, 9108249368, -18678810928, 8775084428, 8821438721, -28245707156, 32733293158, -18340337454, 17195685881, -23715470031, 19833964758, -5178636597, -11965788569, 15886215647, -11672958672, -3705776446, -9814463233, 12746396833, 9622807733, -28944322047, 20560493033, 3524928257, 7682894542, -8474069476, -497083351, 14030331119, -19901296331, 26898089128, -1628 -- (+253 chars; full line in the Zenodo source)
[-5263281894, 18678810928, -27587678007, 18340337454, -3840333274, 11965788569, -8136279257, -12746396833, 14030331119, -7682894542, 20560493033, -26898089128, -3705776446, -5842759456, 19833964758, -1706237024, -28245707156, 9590292882, -8019103829, 20257331479, -13273537606, -2251264476, -8821438721, 7047957396, 23715470031, -13620436853, 11672958672, -16281178653, 28944322047, -8474069476, 49 -- (+254 chars; full line in the Zenodo source)
[-8775084428, 23715470031, 3705776446, -3524928257, -26898089128, 13620436853, -6954167879, 5263281894, -546525367, 7047957396, 5842759456, -19901296331, 20560493033, -11672958672, 17195685881, -18678810928, 11483615003, -8821438721, -19833964758, 9814463233, -7682894542, 16281178653, -17548541817, 27587678007, -11280095058, -2251264476, 1706237024, 8804890819, 14030331119, -28944322047, 1588621 -- (+253 chars; full line in the Zenodo source)
[7047957396, 9814463233, -28944322047, 3840333274, -8019103829, 27767352254, -15886215647, 7682894542, -5842759456, 8775084428, -546525367, -19833964758, 14030331119, -12361486821, 32733293158, -20257331479, 18340337454, -16281178653, 19901296331, -23715470031, 5263281894, -8821438721, 8804890819, 8474069476, -11965788569, 9590292882, -9108249368, 17548541817, -20560493033, -3705776446, -6954167 -- (+250 chars; full line in the Zenodo source)
[-19833964758, 8474069476, 3994857471, 11280095058, -13620436853, 20560493033, -18340337454, 8019103829, -15886215647, 19901296331, -6954167879, -2251264476, -8136279257, 12746396833, 8821438721, -8775084428, 9814463233, -12361486821, 9590292882, -27587678007, 26898089128, -11672958672, 9108249368, -32733293158, 28944322047, -5842759456, 5263281894, 1706237024, -497083351, -5178636597, -11483615 -- (+251 chars; full line in the Zenodo source)
[8804890819, 8136279257, -11483615003, 5842759456, -12361486821, 13273537606, -13620436853, 16281178653, -8019103829, 17548541817, -26898089128, 9108249368, -3840333274, 19901296331, -18678810928, -3994857471, -14030331119, 8775084428, 1706237024, 497083351, 8821438721, 7047957396, 8474069476, -28245707156, 6954167879, -7682894542, 32733293158, -27587678007, -3524928257, -18340337454, 2776735225 -- (+252 chars; full line in the Zenodo source)
[-12746396833, -1706237024, 7047957396, 9622807733, -11483615003, 9814463233, 3994857471, 6954167879, -28944322047, 13273537606, 3705776446, 3840333274, -27587678007, 20560493033, -8019103829, 11672958672, -17548541817, 27767352254, 3524928257, 9108249368, -15886215647, 13620436853, -9590292882, 7682894542, -18678810928, 11965788569, -5842759456, -2251264476, -8474069476, 8775084428, 5178636597, -- (+251 chars; full line in the Zenodo source)
[-497083351, 546525367, -12746396833, 8821438721, 8804890819, -1706237024, -19833964758, -5178636597, 7047957396, 8136279257, -8775084428, 9622807733, -5263281894, 8474069476, -11483615003, 14030331119, 2251264476, 9814463233, -28245707156, 5842759456, 3994857471, 23715470031, -11965788569, 6954167879, -12361486821, 18678810928, -28944322047, 11280095058, -7682894542, 13273537606, -19901296331, -- (+250 chars; full line in the Zenodo source)
theorem A_def : A = (rng 1 50).map (fun t => rowA (100 + 1) t (rng 1 50)) := rfl
theorem len : allLen 50 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 50 B A = sid 28663027375250 50 := rfl
theorem d_ne : (28663027375250 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 50 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 50) (h0 : mv A g = zeros 50) : g = zeros 50 :=
kernel_zero 50 28663027375250 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 100 50 = true := rfl
/-- **Balanced ⇒ pairs for p = 101.** A list with entries in (0, 101) that is balanced for 1 ≤ t ≤ 50
has as many copies of x as of 101 − x for every 1 ≤ x ≤ 50 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 101)
(hb : ∀ t, 1 ≤ t → t < 1 + 50 → tsum 101 t c + tsum 101 t c = c.length * 101) :
(rng 1 50).all (fun x => Nat.beq (cnt x c) (cnt (101 - x) c)) = true :=
pairs_of_bal 100 50 28663027375250 d_ne A B len cert A_def delta c hr hb
end MailletCert101
#print axioms MailletCert101.A_def
#print axioms MailletCert101.len
#print axioms MailletCert101.cert
#print axioms MailletCert101.d_ne
#print axioms MailletCert101.kernel
#print axioms MailletCert101.delta
#print axioms MailletCert101.pairs
lean_all/hodge/MailletCert103.lean
/-
hodge/MailletCert103.lean — T41 (goals G849b, G849c): for p = 103 the 51 × 51 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 51)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 1868233496491990 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 103) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert103
open MailletLin MailletBridge
def A : List (List Int) := [
[-101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101],
[-97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99],
[-93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97],
[-89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, -91, -77, -63, -49, -35, -21, -7],
[-87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95],
[-85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, -99, -81, -63, -45, -27, -9],
[-83, -63, -43, -23, -3, 17, 37, 57, 77, 97, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93],
[-81, -59, -37, -15, 7, 29, 51, 73, 95, -89, -67, -45, -23, -1, 21, 43, 65, 87, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, -83, -61, -39, -17, 5, 27, 49, 71, 93, -91, -69, -47, -25, -3, 19, 41, 63, 85, -99, -77, -55, -33, -11],
[-79, -55, -31, -7, 17, 41, 65, 89, -93, -69, -45, -21, 3, 27, 51, 75, 99, -83, -59, -35, -11, 13, 37, 61, 85, -97, -73, -49, -25, -1, 23, 47, 71, 95, -87, -63, -39, -15, 9, 33, 57, 81, -101, -77, -53, -29, -5, 19, 43, 67, 91],
[-77, -51, -25, 1, 27, 53, 79, -101, -75, -49, -23, 3, 29, 55, 81, -99, -73, -47, -21, 5, 31, 57, 83, -97, -71, -45, -19, 7, 33, 59, 85, -95, -69, -43, -17, 9, 35, 61, 87, -93, -67, -41, -15, 11, 37, 63, 89, -91, -65, -39, -13],
[-75, -47, -19, 9, 37, 65, 93, -85, -57, -29, -1, 27, 55, 83, -95, -67, -39, -11, 17, 45, 73, 101, -77, -49, -21, 7, 35, 63, 91, -87, -59, -31, -3, 25, 53, 81, -97, -69, -41, -13, 15, 43, 71, 99, -79, -51, -23, 5, 33, 61, 89],
[-73, -43, -13, 17, 47, 77, -99, -69, -39, -9, 21, 51, 81, -95, -65, -35, -5, 25, 55, 85, -91, -61, -31, -1, 29, 59, 89, -87, -57, -27, 3, 33, 63, 93, -83, -53, -23, 7, 37, 67, 97, -79, -49, -19, 11, 41, 71, 101, -75, -45, -15],
[-71, -39, -7, 25, 57, 89, -85, -53, -21, 11, 43, 75, -99, -67, -35, -3, 29, 61, 93, -81, -49, -17, 15, 47, 79, -95, -63, -31, 1, 33, 65, 97, -77, -45, -13, 19, 51, 83, -91, -59, -27, 5, 37, 69, 101, -73, -41, -9, 23, 55, 87],
[-69, -35, -1, 33, 67, 101, -71, -37, -3, 31, 65, 99, -73, -39, -5, 29, 63, 97, -75, -41, -7, 27, 61, 95, -77, -43, -9, 25, 59, 93, -79, -45, -11, 23, 57, 91, -81, -47, -13, 21, 55, 89, -83, -49, -15, 19, 53, 87, -85, -51, -17],
[-67, -31, 5, 41, 77, -93, -57, -21, 15, 51, 87, -83, -47, -11, 25, 61, 97, -73, -37, -1, 35, 71, -99, -63, -27, 9, 45, 81, -89, -53, -17, 19, 55, 91, -79, -43, -7, 29, 65, 101, -69, -33, 3, 39, 75, -95, -59, -23, 13, 49, 85],
[-65, -27, 11, 49, 87, -81, -43, -5, 33, 71, -97, -59, -21, 17, 55, 93, -75, -37, 1, 39, 77, -91, -53, -15, 23, 61, 99, -69, -31, 7, 45, 83, -85, -47, -9, 29, 67, -101, -63, -25, 13, 51, 89, -79, -41, -3, 35, 73, -95, -57, -19],
[-63, -23, 17, 57, 97, -69, -29, 11, 51, 91, -75, -35, 5, 45, 85, -81, -41, -1, 39, 79, -87, -47, -7, 33, 73, -93, -53, -13, 27, 67, -99, -59, -19, 21, 61, 101, -65, -25, 15, 55, 95, -71, -31, 9, 49, 89, -77, -37, 3, 43, 83],
[-61, -19, 23, 65, -99, -57, -15, 27, 69, -95, -53, -11, 31, 73, -91, -49, -7, 35, 77, -87, -45, -3, 39, 81, -83, -41, 1, 43, 85, -79, -37, 5, 47, 89, -75, -33, 9, 51, 93, -71, -29, 13, 55, 97, -67, -25, 17, 59, 101, -63, -21],
[-59, -15, 29, 73, -89, -45, -1, 43, 87, -75, -31, 13, 57, 101, -61, -17, 27, 71, -91, -47, -3, 41, 85, -77, -33, 11, 55, 99, -63, -19, 25, 69, -93, -49, -5, 39, 83, -79, -35, 9, 53, 97, -65, -21, 23, 67, -95, -51, -7, 37, 81],
[-57, -11, 35, 81, -79, -33, 13, 59, -101, -55, -9, 37, 83, -77, -31, 15, 61, -99, -53, -7, 39, 85, -75, -29, 17, 63, -97, -51, -5, 41, 87, -73, -27, 19, 65, -95, -49, -3, 43, 89, -71, -25, 21, 67, -93, -47, -1, 45, 91, -69, -23],
[-55, -7, 41, 89, -69, -21, 27, 75, -83, -35, 13, 61, -97, -49, -1, 47, 95, -63, -15, 33, 81, -77, -29, 19, 67, -91, -43, 5, 53, 101, -57, -9, 39, 87, -71, -23, 25, 73, -85, -37, 11, 59, -99, -51, -3, 45, 93, -65, -17, 31, 79],
[-53, -3, 47, 97, -59, -9, 41, 91, -65, -15, 35, 85, -71, -21, 29, 79, -77, -27, 23, 73, -83, -33, 17, 67, -89, -39, 11, 61, -95, -45, 5, 55, -101, -51, -1, 49, 99, -57, -7, 43, 93, -63, -13, 37, 87, -69, -19, 31, 81, -75, -25],
[-51, 1, 53, -101, -49, 3, 55, -99, -47, 5, 57, -97, -45, 7, 59, -95, -43, 9, 61, -93, -41, 11, 63, -91, -39, 13, 65, -89, -37, 15, 67, -87, -35, 17, 69, -85, -33, 19, 71, -83, -31, 21, 73, -81, -29, 23, 75, -79, -27, 25, 77],
[-49, 5, 59, -93, -39, 15, 69, -83, -29, 25, 79, -73, -19, 35, 89, -63, -9, 45, 99, -53, 1, 55, -97, -43, 11, 65, -87, -33, 21, 75, -77, -23, 31, 85, -67, -13, 41, 95, -57, -3, 51, -101, -47, 7, 61, -91, -37, 17, 71, -81, -27],
[-47, 9, 65, -85, -29, 27, 83, -67, -11, 45, 101, -49, 7, 63, -87, -31, 25, 81, -69, -13, 43, 99, -51, 5, 61, -89, -33, 23, 79, -71, -15, 41, 97, -53, 3, 59, -91, -35, 21, 77, -73, -17, 39, 95, -55, 1, 57, -93, -37, 19, 75],
[-45, 13, 71, -77, -19, 39, 97, -51, 7, 65, -83, -25, 33, 91, -57, 1, 59, -89, -31, 27, 85, -63, -5, 53, -95, -37, 21, 79, -69, -11, 47, -101, -43, 15, 73, -75, -17, 41, 99, -49, 9, 67, -81, -23, 35, 93, -55, 3, 61, -87, -29],
[-43, 17, 77, -69, -9, 51, -95, -35, 25, 85, -61, -1, 59, -87, -27, 33, 93, -53, 7, 67, -79, -19, 41, 101, -45, 15, 75, -71, -11, 49, -97, -37, 23, 83, -63, -3, 57, -89, -29, 31, 91, -55, 5, 65, -81, -21, 39, 99, -47, 13, 73],
[-41, 21, 83, -61, 1, 63, -81, -19, 43, -101, -39, 23, 85, -59, 3, 65, -79, -17, 45, -99, -37, 25, 87, -57, 5, 67, -77, -15, 47, -97, -35, 27, 89, -55, 7, 69, -75, -13, 49, -95, -33, 29, 91, -53, 9, 71, -73, -11, 51, -93, -31],
[-39, 25, 89, -53, 11, 75, -67, -3, 61, -81, -17, 47, -95, -31, 33, 97, -45, 19, 83, -59, 5, 69, -73, -9, 55, -87, -23, 41, -101, -37, 27, 91, -51, 13, 77, -65, -1, 63, -79, -15, 49, -93, -29, 35, 99, -43, 21, 85, -57, 7, 71],
[-37, 29, 95, -45, 21, 87, -53, 13, 79, -61, 5, 71, -69, -3, 63, -77, -11, 55, -85, -19, 47, -93, -27, 39, -101, -35, 31, 97, -43, 23, 89, -51, 15, 81, -59, 7, 73, -67, -1, 65, -75, -9, 57, -83, -17, 49, -91, -25, 41, -99, -33],
[-35, 33, 101, -37, 31, 99, -39, 29, 97, -41, 27, 95, -43, 25, 93, -45, 23, 91, -47, 21, 89, -49, 19, 87, -51, 17, 85, -53, 15, 83, -55, 13, 81, -57, 11, 79, -59, 9, 77, -61, 7, 75, -63, 5, 73, -65, 3, 71, -67, 1, 69],
[-33, 37, -99, -29, 41, -95, -25, 45, -91, -21, 49, -87, -17, 53, -83, -13, 57, -79, -9, 61, -75, -5, 65, -71, -1, 69, -67, 3, 73, -63, 7, 77, -59, 11, 81, -55, 15, 85, -51, 19, 89, -47, 23, 93, -43, 27, 97, -39, 31, 101, -35],
[-31, 41, -93, -21, 51, -83, -11, 61, -73, -1, 71, -63, 9, 81, -53, 19, 91, -43, 29, 101, -33, 39, -95, -23, 49, -85, -13, 59, -75, -3, 69, -65, 7, 79, -55, 17, 89, -45, 27, 99, -35, 37, -97, -25, 47, -87, -15, 57, -77, -5, 67],
[-29, 45, -87, -13, 61, -71, 3, 77, -55, 19, 93, -39, 35, -97, -23, 51, -81, -7, 67, -65, 9, 83, -49, 25, 99, -33, 41, -91, -17, 57, -75, -1, 73, -59, 15, 89, -43, 31, -101, -27, 47, -85, -11, 63, -69, 5, 79, -53, 21, 95, -37],
[-27, 49, -81, -5, 71, -59, 17, 93, -37, 39, -91, -15, 61, -69, 7, 83, -47, 29, -101, -25, 51, -79, -3, 73, -57, 19, 95, -35, 41, -89, -13, 63, -67, 9, 85, -45, 31, -99, -23, 53, -77, -1, 75, -55, 21, 97, -33, 43, -87, -11, 65],
[-25, 53, -75, 3, 81, -47, 31, -97, -19, 59, -69, 9, 87, -41, 37, -91, -13, 65, -63, 15, 93, -35, 43, -85, -7, 71, -57, 21, 99, -29, 49, -79, -1, 77, -51, 27, -101, -23, 55, -73, 5, 83, -45, 33, -95, -17, 61, -67, 11, 89, -39],
[-23, 57, -69, 11, 91, -35, 45, -81, -1, 79, -47, 33, -93, -13, 67, -59, 21, 101, -25, 55, -71, 9, 89, -37, 43, -83, -3, 77, -49, 31, -95, -15, 65, -61, 19, 99, -27, 53, -73, 7, 87, -39, 41, -85, -5, 75, -51, 29, -97, -17, 63],
[-21, 61, -63, 19, 101, -23, 59, -65, 17, 99, -25, 57, -67, 15, 97, -27, 55, -69, 13, 95, -29, 53, -71, 11, 93, -31, 51, -73, 9, 91, -33, 49, -75, 7, 89, -35, 47, -77, 5, 87, -37, 45, -79, 3, 85, -39, 43, -81, 1, 83, -41],
[-19, 65, -57, 27, -95, -11, 73, -49, 35, -87, -3, 81, -41, 43, -79, 5, 89, -33, 51, -71, 13, 97, -25, 59, -63, 21, -101, -17, 67, -55, 29, -93, -9, 75, -47, 37, -85, -1, 83, -39, 45, -77, 7, 91, -31, 53, -69, 15, 99, -23, 61],
[-17, 69, -51, 35, -85, 1, 87, -33, 53, -67, 19, -101, -15, 71, -49, 37, -83, 3, 89, -31, 55, -65, 21, -99, -13, 73, -47, 39, -81, 5, 91, -29, 57, -63, 23, -97, -11, 75, -45, 41, -79, 7, 93, -27, 59, -61, 25, -95, -9, 77, -43],
[-15, 73, -45, 43, -75, 13, 101, -17, 71, -47, 41, -77, 11, 99, -19, 69, -49, 39, -79, 9, 97, -21, 67, -51, 37, -81, 7, 95, -23, 65, -53, 35, -83, 5, 93, -25, 63, -55, 33, -85, 3, 91, -27, 61, -57, 31, -87, 1, 89, -29, 59],
[-13, 77, -39, 51, -65, 25, -91, -1, 89, -27, 63, -53, 37, -79, 11, 101, -15, 75, -41, 49, -67, 23, -93, -3, 87, -29, 61, -55, 35, -81, 9, 99, -17, 73, -43, 47, -69, 21, -95, -5, 85, -31, 59, -57, 33, -83, 7, 97, -19, 71, -45],
[-11, 81, -33, 59, -55, 37, -77, 15, -99, -7, 85, -29, 63, -51, 41, -73, 19, -95, -3, 89, -25, 67, -47, 45, -69, 23, -91, 1, 93, -21, 71, -43, 49, -65, 27, -87, 5, 97, -17, 75, -39, 53, -61, 31, -83, 9, 101, -13, 79, -35, 57],
[-9, 85, -27, 67, -45, 49, -63, 31, -81, 13, -99, -5, 89, -23, 71, -41, 53, -59, 35, -77, 17, -95, -1, 93, -19, 75, -37, 57, -55, 39, -73, 21, -91, 3, 97, -15, 79, -33, 61, -51, 43, -69, 25, -87, 7, 101, -11, 83, -29, 65, -47],
[-7, 89, -21, 75, -35, 61, -49, 47, -63, 33, -77, 19, -91, 5, 101, -9, 87, -23, 73, -37, 59, -51, 45, -65, 31, -79, 17, -93, 3, 99, -11, 85, -25, 71, -39, 57, -53, 43, -67, 29, -81, 15, -95, 1, 97, -13, 83, -27, 69, -41, 55],
[-5, 93, -15, 83, -25, 73, -35, 63, -45, 53, -55, 43, -65, 33, -75, 23, -85, 13, -95, 3, 101, -7, 91, -17, 81, -27, 71, -37, 61, -47, 51, -57, 41, -67, 31, -77, 21, -87, 11, -97, 1, 99, -9, 89, -19, 79, -29, 69, -39, 59, -49],
[-3, 97, -9, 91, -15, 85, -21, 79, -27, 73, -33, 67, -39, 61, -45, 55, -51, 49, -57, 43, -63, 37, -69, 31, -75, 25, -81, 19, -87, 13, -93, 7, -99, 1, 101, -5, 95, -11, 89, -17, 83, -23, 77, -29, 71, -35, 65, -41, 59, -47, 53],
[-1, 101, -3, 99, -5, 97, -7, 95, -9, 93, -11, 91, -13, 89, -15, 87, -17, 85, -19, 83, -21, 81, -23, 79, -25, 77, -27, 75, -29, 73, -31, 71, -33, 69, -35, 67, -37, 65, -39, 63, -41, 61, -43, 59, -45, 57, -47, 55, -49, 53, -51]]
def B : List (List Int) := [
[-474249356151, 718611246004, -357172659199, -523653800981, -415750652069, -315902961434, -553455875666, -863458035026, -488667161416, -1119341968569, -567709881089, -397269141569, -1208057053861, 67442299384, -756512737471, -890462561906, -923484342146, -644621615521, -1622746928706, -160875461654, -1600208410414, -1273089634709, -1859773329336, -503741800209, -1404037462616, -604838724116, -11 -- (+377 chars; full line in the Zenodo source)
[718611246004, -523653800981, -315902961434, -863458035026, -1119341968569, -397269141569, 67442299384, -890462561906, -644621615521, -160875461654, -1273089634709, -503741800209, -604838724116, -1238282119301, -169608922836, 236281990084, -1386283430806, -486388895371, -483862848431, -731036251589, 356788088641, 535032485156, -108951662426, 362752035421, 555667048599, 538101407344, 652193438791 -- (+351 chars; full line in the Zenodo source)
[-357172659199, -315902961434, -488667161416, -397269141569, -756512737471, -644621615521, -1600208410414, -503741800209, -1164688231729, -169608922836, -1056004783816, -486388895371, -566959698034, 356788088641, -742786340864, 362752035421, -538101407344, 652193438791, 108951662426, 1384079725379, 731036251589, 1381233014904, 1386283430806, 2187034999969, 1238282119301, 1404037462616, 127308963 -- (+360 chars; full line in the Zenodo source)
[-523653800981, -863458035026, -397269141569, -890462561906, -160875461654, -503741800209, -1238282119301, 236281990084, -486388895371, -731036251589, 535032485156, 362752035421, 538101407344, 812371088894, 1384079725379, 566959698034, 1359589637294, 2187034999969, 1164688231729, 1859773329336, 1622746928706, 756512737471, 567709881089, 553455875666, 357172659199, -474249356151, -415750652069, - -- (+359 chars; full line in the Zenodo source)
[-415750652069, -1119341968569, -756512737471, -160875461654, -1404037462616, -169608922836, -1359589637294, -731036251589, -742786340864, 555667048599, -362752035421, 1384079725379, 483862848431, 1056004783816, 1238282119301, 1859773329336, 644621615521, 1208057053861, 863458035026, 357172659199, 718611246004, -553455875666, -397269141569, -923484342146, -1273089634709, -1164688231729, 23628199 -- (+358 chars; full line in the Zenodo source)
[-315902961434, -397269141569, -644621615521, -503741800209, -169608922836, -486388895371, 356788088641, 362752035421, 652193438791, 1384079725379, 1381233014904, 2187034999969, 1404037462616, 1622746928706, 1208057053861, 553455875666, 474249356151, -415750652069, -567709881089, -923484342146, -1859773329336, -1498635420676, -1359589637294, -1631780291661, -812371088894, -555667048599, -5350324 -- (+360 chars; full line in the Zenodo source)
[-553455875666, 67442299384, -1600208410414, -1238282119301, -1359589637294, 356788088641, -652193438791, 812371088894, 731036251589, 1056004783816, 604838724116, 1622746928706, 397269141569, 415750652069, 718611246004, -488667161416, -890462561906, -1859773329336, -169608922836, -1381233014904, 535032485156, -538101407344, 742786340864, 483862848431, 2187034999969, 503741800209, 923484342146, 1 -- (+357 chars; full line in the Zenodo source)
[-863458035026, -890462561906, -503741800209, 236281990084, -731036251589, 362752035421, 812371088894, 566959698034, 2187034999969, 1859773329336, 756512737471, 553455875666, -474249356151, -488667161416, -923484342146, -1404037462616, -1056004783816, -1631780291661, -652193438791, 108951662426, 483862848431, 169608922836, 1273089634709, -67442299384, 315902961434, 718611246004, -1119341968569, -- (+357 chars; full line in the Zenodo source)
[-488667161416, -644621615521, -1164688231729, -486388895371, -742786340864, 652193438791, 731036251589, 2187034999969, 1273089634709, 1208057053861, 523653800981, -415750652069, 67442299384, -1859773329336, 236281990084, -1631780291661, 555667048599, -535032485156, 1359589637294, 604838724116, 923484342146, 863458035026, -474249356151, -1119341968569, -1622746928706, -1238282119301, -1381233014 -- (+359 chars; full line in the Zenodo source)
[-1119341968569, -160875461654, -169608922836, -731036251589, 555667048599, 1384079725379, 1056004783816, 1859773329336, 1208057053861, 357172659199, -553455875666, -923484342146, -1164688231729, -1381233014904, -812371088894, 108951662426, 486388895371, 604838724116, 890462561906, 315902961434, -523653800981, 67442299384, -503741800209, -1386283430806, 535032485156, 652193438791, 566959698034, -- (+358 chars; full line in the Zenodo source)
[-567709881089, -1273089634709, -1056004783816, 535032485156, -362752035421, 1381233014904, 604838724116, 756512737471, 523653800981, -553455875666, -644621615521, -1498635420676, -731036251589, -538101407344, 1631780291661, 169608922836, 1622746928706, 863458035026, -357172659199, 67442299384, -1404037462616, -486388895371, -812371088894, 742786340864, 1386283430806, 1859773329336, 397269141569 -- (+358 chars; full line in the Zenodo source)
[-397269141569, -503741800209, -486388895371, 362752035421, 1384079725379, 2187034999969, 1622746928706, 553455875666, -415750652069, -923484342146, -1498635420676, -1631780291661, -555667048599, 483862848431, 604838724116, -67442299384, -718611246004, -1119341968569, -1273089634709, -1386283430806, -108951662426, 742786340864, 1056004783816, 1600208410414, 488667161416, -357172659199, -75651273 -- (+360 chars; full line in the Zenodo source)
[-1208057053861, -604838724116, -566959698034, 538101407344, 483862848431, 1404037462616, 397269141569, -474249356151, 67442299384, -1164688231729, -731036251589, -555667048599, 1381233014904, 503741800209, 567709881089, 718611246004, -756512737471, -1238282119301, -1631780291661, 652193438791, 486388895371, 1859773329336, 1119341968569, -357172659199, -890462561906, -1498635420676, 356788088641 -- (+357 chars; full line in the Zenodo source)
[67442299384, -1238282119301, 356788088641, 812371088894, 1056004783816, 1622746928706, 415750652069, -488667161416, -1859773329336, -1381233014904, -538101407344, 483862848431, 503741800209, 1119341968569, -523653800981, -644621615521, 236281990084, -108951662426, 1384079725379, 1498635420676, 756512737471, 474249356151, -1208057053861, -1164688231729, -1631780291661, -362752035421, 13862834308 -- (+357 chars; full line in the Zenodo source)
[-756512737471, -169608922836, -742786340864, 1384079725379, 1238282119301, 1208057053861, 718611246004, -923484342146, 236281990084, -812371088894, 1631780291661, 604838724116, 567709881089, -523653800981, -1622746928706, -1386283430806, -652193438791, 566959698034, 503741800209, 488667161416, -315902961434, -1600208410414, -486388895371, -538101407344, 1381233014904, 1273089634709, 55345587566 -- (+357 chars; full line in the Zenodo source)
[-890462561906, 236281990084, 362752035421, 566959698034, 1859773329336, 553455875666, -488667161416, -1404037462616, -1631780291661, 108951662426, 169608922836, -67442299384, 718611246004, -644621615521, -1386283430806, 555667048599, 1381233014904, 1600208410414, 415750652069, -567709881089, -1164688231729, -1384079725379, -535032485156, 1238282119301, 397269141569, -523653800981, -160875461654 -- (+357 chars; full line in the Zenodo source)
[-923484342146, -1386283430806, -538101407344, 1359589637294, 644621615521, 474249356151, -890462561906, -1056004783816, 555667048599, 486388895371, 1622746928706, -718611246004, -756512737471, 236281990084, -652193438791, 1381233014904, 160875461654, 357172659199, 67442299384, -2187034999969, 362752035421, 483862848431, 1600208410414, 523653800981, -1208057053861, -169608922836, -812371088894, -- (+357 chars; full line in the Zenodo source)
[-644621615521, -486388895371, 652193438791, 2187034999969, 1208057053861, -415750652069, -1859773329336, -1631780291661, -535032485156, 604838724116, 863458035026, -1119341968569, -1238282119301, -108951662426, 566959698034, 1600208410414, 357172659199, -756512737471, -1056004783816, -538101407344, 1386283430806, 890462561906, 718611246004, -160875461654, -483862848431, 812371088894, 1498635420 -- (+361 chars; full line in the Zenodo source)
[-1622746928706, -483862848431, 108951662426, 1164688231729, 863458035026, -567709881089, -169608922836, -652193438791, 1359589637294, 890462561906, -357172659199, -1273089634709, -1631780291661, 1384079725379, 503741800209, 415750652069, 67442299384, -1056004783816, 538101407344, -236281990084, 1208057053861, -315902961434, -1404037462616, 535032485156, 731036251589, 1600208410414, -71861124600 -- (+359 chars; full line in the Zenodo source)
[-160875461654, -731036251589, 1384079725379, 1859773329336, 357172659199, -923484342146, -1381233014904, 108951662426, 604838724116, 315902961434, 67442299384, -1386283430806, 652193438791, 1498635420676, 488667161416, -567709881089, -2187034999969, -538101407344, -236281990084, 397269141569, -863458035026, -1238282119301, 362752035421, 1359589637294, 756512737471, -415750652069, -1404037462616 -- (+356 chars; full line in the Zenodo source)
[-1600208410414, 356788088641, 731036251589, 1622746928706, 718611246004, -1859773329336, 535032485156, 483862848431, 923484342146, -523653800981, -1404037462616, -108951662426, 486388895371, 756512737471, -315902961434, -1164688231729, 362752035421, 1386283430806, 1208057053861, -863458035026, -1498635420676, 555667048599, -236281990084, 567709881089, -1119341968569, -2187034999969, 53810140734 -- (+354 chars; full line in the Zenodo source)
[-1273089634709, 535032485156, 1381233014904, 756512737471, -553455875666, -1498635420676, -538101407344, 169608922836, 863458035026, 67442299384, -486388895371, 742786340864, 1859773329336, 474249356151, -1600208410414, -1384079725379, 483862848431, 890462561906, -315902961434, -1238282119301, 555667048599, 2187034999969, 488667161416, -1208057053861, -1359589637294, 108951662426, 503741800209, -- (+356 chars; full line in the Zenodo source)
[-1859773329336, -108951662426, 1386283430806, 567709881089, -397269141569, -1359589637294, 742786340864, 1273089634709, -474249356151, -503741800209, -812371088894, 1056004783816, 1119341968569, -1208057053861, -486388895371, -535032485156, 1600208410414, 718611246004, -1404037462616, 362752035421, -236281990084, 488667161416, 67442299384, -1381233014904, 1384079725379, 160875461654, -357172659 -- (+361 chars; full line in the Zenodo source)
[-503741800209, 362752035421, 2187034999969, 553455875666, -923484342146, -1631780291661, 483862848431, -67442299384, -1119341968569, -1386283430806, 742786340864, 1600208410414, -357172659199, -1164688231729, -538101407344, 1238282119301, 523653800981, -160875461654, 535032485156, 1359589637294, 567709881089, -1208057053861, -1381233014904, -356788088641, 644621615521, -315902961434, -169608922 -- (+358 chars; full line in the Zenodo source)
[-1404037462616, 555667048599, 1238282119301, 357172659199, -1273089634709, -812371088894, 2187034999969, 315902961434, -1622746928706, 535032485156, 1386283430806, 488667161416, -890462561906, -1631780291661, 1381233014904, 397269141569, -1208057053861, -483862848431, 731036251589, 756512737471, -1119341968569, -1359589637294, 1384079725379, 644621615521, -553455875666, 236281990084, 1089516624 -- (+355 chars; full line in the Zenodo source)
[-604838724116, 538101407344, 1404037462616, -474249356151, -1164688231729, -555667048599, 503741800209, 718611246004, -1238282119301, 652193438791, 1859773329336, -357172659199, -1498635420676, -362752035421, 1273089634709, -523653800981, -169608922836, 812371088894, 1600208410414, -415750652069, -2187034999969, 108951662426, 160875461654, -315902961434, 236281990084, 742786340864, 162274692870 -- (+361 chars; full line in the Zenodo source)
[-1164688231729, 652193438791, 1273089634709, -415750652069, 236281990084, -535032485156, 923484342146, -1119341968569, -1381233014904, 566959698034, 397269141569, -756512737471, 356788088641, 1386283430806, 553455875666, -160875461654, -812371088894, 1498635420676, -718611246004, -1404037462616, 538101407344, 503741800209, -357172659199, -169608922836, 108951662426, 1622746928706, -863458035026 -- (+360 chars; full line in the Zenodo source)
[-1238282119301, 812371088894, 1622746928706, -488667161416, -1381233014904, 483862848431, 1119341968569, -644621615521, -108951662426, 1498635420676, 474249356151, -1164688231729, -362752035421, 160875461654, -863458035026, -486388895371, 566959698034, 567709881089, -923484342146, -742786340864, 169608922836, -718611246004, -604838724116, 652193438791, 1600208410414, -553455875666, -13595896372 -- (+361 chars; full line in the Zenodo source)
[-1498635420676, 742786340864, 890462561906, -1208057053861, 356788088641, -236281990084, 357172659199, -604838724116, -362752035421, 1622746928706, -1119341968569, -566959698034, 1359589637294, 315902961434, -1859773329336, 538101407344, 1273089634709, -553455875666, -486388895371, 483862848431, 488667161416, -160875461654, -652193438791, 1404037462616, -523653800981, -1056004783816, 1631780291 -- (+361 chars; full line in the Zenodo source)
[-169608922836, 1384079725379, 1208057053861, -923484342146, -812371088894, 604838724116, -523653800981, -1386283430806, 566959698034, 488667161416, -1600208410414, -538101407344, 1273089634709, -863458035026, -483862848431, 1359589637294, 415750652069, -1404037462616, -362752035421, 644621615521, -397269141569, 356788088641, 2187034999969, 474249356151, -1498635420676, -535032485156, -674422993 -- (+361 chars; full line in the Zenodo source)
[-2187034999969, 1631780291661, 1119341968569, -1600208410414, 538101407344, 160875461654, -567709881089, 356788088641, 169608922836, -474249356151, 236281990084, 731036251589, 488667161416, -1273089634709, -555667048599, 1622746928706, -397269141569, -1384079725379, 1498635420676, 718611246004, -1056004783816, 566959698034, 863458035026, -1859773329336, 652193438791, 644621615521, -120805705386 -- (+356 chars; full line in the Zenodo source)
[236281990084, 566959698034, 553455875666, -1404037462616, 108951662426, -67442299384, -644621615521, 555667048599, 1600208410414, -567709881089, -1384079725379, 1238282119301, -523653800981, -486388895371, 1359589637294, 357172659199, -1498635420676, -356788088641, 1119341968569, -1273089634709, 652193438791, 923484342146, -756512737471, -812371088894, 503741800209, -863458035026, -731036251589 -- (+359 chars; full line in the Zenodo source)
[-1056004783816, 1381233014904, 523653800981, -1498635420676, 1631780291661, 863458035026, -1404037462616, 742786340864, 397269141569, -1600208410414, 652193438791, 890462561906, -923484342146, 555667048599, 160875461654, -1208057053861, -108951662426, 503741800209, -488667161416, 356788088641, 1238282119301, -415750652069, -483862848431, -236281990084, -474249356151, -1386283430806, 48638889537 -- (+359 chars; full line in the Zenodo source)
[-1386283430806, 1359589637294, 474249356151, -1056004783816, 486388895371, -718611246004, 236281990084, 1381233014904, 357172659199, -2187034999969, 483862848431, 523653800981, -169608922836, 566959698034, 415750652069, -1498635420676, 731036251589, 315902961434, -1238282119301, 1631780291661, 553455875666, -1164688231729, -356788088641, 863458035026, -604838724116, 1384079725379, 488667161416, -- (+355 chars; full line in the Zenodo source)
[-1359589637294, 1056004783816, 718611246004, -1381233014904, 2187034999969, -523653800981, -566959698034, 1498635420676, -315902961434, -1631780291661, 1164688231729, -863458035026, -1384079725379, 1404037462616, -1119341968569, -742786340864, 1859773329336, -397269141569, -812371088894, 1600208410414, 67442299384, -652193438791, 1622746928706, -890462561906, -538101407344, 923484342146, -64462 -- (+360 chars; full line in the Zenodo source)
[-486388895371, 2187034999969, -415750652069, -1631780291661, 604838724116, -1119341968569, -108951662426, 1600208410414, -756512737471, -538101407344, 890462561906, -160875461654, 812371088894, 567709881089, -1404037462616, -356788088641, 315902961434, -169608922836, 1381233014904, 474249356151, -1359589637294, -236281990084, -523653800981, -731036251589, 1164688231729, -488667161416, -74278634 -- (+361 chars; full line in the Zenodo source)
[-1381233014904, 1498635420676, -863458035026, -742786340864, 1600208410414, -890462561906, -555667048599, 1208057053861, -503741800209, -356788088641, 415750652069, 236281990084, 1386283430806, -357172659199, -731036251589, 604838724116, -567709881089, 362752035421, 644621615521, -1622746928706, 812371088894, 1119341968569, -1164688231729, 566959698034, -718611246004, -1359589637294, 2187034999 -- (+360 chars; full line in the Zenodo source)
[-483862848431, 1164688231729, -567709881089, -652193438791, 890462561906, -1273089634709, 1384079725379, 415750652069, -1056004783816, -236281990084, -315902961434, 535032485156, 1600208410414, -923484342146, -362752035421, 1119341968569, -1238282119301, 1381233014904, -474249356151, -566959698034, 604838724116, -397269141569, 555667048599, 756512737471, -1859773329336, -356788088641, 523653800 -- (+361 chars; full line in the Zenodo source)
[-566959698034, 1404037462616, 67442299384, -555667048599, 567709881089, -1238282119301, 486388895371, -357172659199, 356788088641, 1273089634709, -923484342146, 812371088894, 863458035026, -2187034999969, 1056004783816, -315902961434, -742786340864, 1622746928706, -160875461654, -535032485156, 415750652069, -1386283430806, 169608922836, -488667161416, 362752035421, 890462561906, -1859773329336, -- (+358 chars; full line in the Zenodo source)
[-731036251589, 1859773329336, -923484342146, 108951662426, 315902961434, -1386283430806, 1498635420676, -567709881089, -538101407344, 397269141569, -1238282119301, 1359589637294, -415750652069, -742786340864, 644621615521, -1273089634709, 1631780291661, 474249356151, -566959698034, 503741800209, -890462561906, 812371088894, 553455875666, -1056004783816, 169608922836, -1119341968569, 55566704859 -- (+360 chars; full line in the Zenodo source)
[-1631780291661, 1600208410414, -160875461654, -356788088641, 474249356151, -731036251589, 1273089634709, -1622746928706, 1384079725379, -718611246004, -566959698034, 1859773329336, -644621615521, -535032485156, 357172659199, -483862848431, 503741800209, -923484342146, 742786340864, 523653800981, -1381233014904, 1404037462616, -890462561906, 108951662426, 415750652069, -486388895371, 60483872411 -- (+357 chars; full line in the Zenodo source)
[356788088641, 1622746928706, -1859773329336, 483862848431, -523653800981, -108951662426, 756512737471, -1164688231729, 1386283430806, -863458035026, 555667048599, 567709881089, -2187034999969, 169608922836, -397269141569, 652193438791, 553455875666, -1359589637294, 604838724116, -890462561906, 742786340864, 357172659199, -566959698034, 1273089634709, -160875461654, 1631780291661, -474249356151, -- (+360 chars; full line in the Zenodo source)
[-1384079725379, 923484342146, -604838724116, 1386283430806, -488667161416, 538101407344, 863458035026, -1359589637294, 1404037462616, -644621615521, -356788088641, -474249356151, 535032485156, 890462561906, -1164688231729, 1056004783816, -1119341968569, -555667048599, 553455875666, -486388895371, 503741800209, -1622746928706, 1631780291661, 718611246004, -742786340864, 756512737471, -1238282119 -- (+362 chars; full line in the Zenodo source)
[535032485156, 756512737471, -1498635420676, 169608922836, 67442299384, 742786340864, 474249356151, -1384079725379, 890462561906, -1238282119301, 2187034999969, -1208057053861, 108951662426, -718611246004, 356788088641, 923484342146, -1164688231729, -236281990084, -397269141569, 812371088894, 357172659199, -1631780291661, 644621615521, -604838724116, 1056004783816, -567709881089, -362752035421, -- (+356 chars; full line in the Zenodo source)
[-742786340864, 1208057053861, 236281990084, 604838724116, -1622746928706, 566959698034, -315902961434, -538101407344, 553455875666, -483862848431, 160875461654, -1404037462616, 1056004783816, -397269141569, 108951662426, 474249356151, 535032485156, -67442299384, -2187034999969, 1164688231729, -644621615521, 731036251589, -415750652069, 555667048599, 863458035026, -1381233014904, 1600208410414, -- (+358 chars; full line in the Zenodo source)
[-108951662426, 567709881089, -1359589637294, 1273089634709, -503741800209, 1056004783816, -1208057053861, -535032485156, 718611246004, 362752035421, 488667161416, -1381233014904, 160875461654, -604838724116, 2187034999969, -756512737471, -356788088641, -523653800981, 555667048599, 553455875666, -566959698034, 644621615521, -1238282119301, 1498635420676, -923484342146, 731036251589, -31590296143 -- (+357 chars; full line in the Zenodo source)
[-812371088894, 488667161416, -483862848431, 644621615521, -1498635420676, 1164688231729, -160875461654, 486388895371, -567709881089, 742786340864, 718611246004, -652193438791, 553455875666, -731036251589, 890462561906, -2187034999969, 1404037462616, -1273089634709, 1386283430806, -1208057053861, 1384079725379, -523653800981, -538101407344, 415750652069, 356788088641, -67442299384, -105600478381 -- (+360 chars; full line in the Zenodo source)
[362752035421, 553455875666, -1631780291661, -67442299384, -1386283430806, 1600208410414, -1164688231729, 1238282119301, -160875461654, 1359589637294, -1208057053861, -356788088641, -315902961434, 652193438791, 474249356151, -812371088894, 863458035026, -731036251589, 756512737471, -1056004783816, 1273089634709, -604838724116, 1498635420676, -1622746928706, 486388895371, -397269141569, 138407972 -- (+360 chars; full line in the Zenodo source)
[-652193438791, 415750652069, 535032485156, 1119341968569, -566959698034, 756512737471, -1386283430806, 160875461654, -1498635420676, 1404037462616, -503741800209, 169608922836, -1622746928706, 1359589637294, 67442299384, 731036251589, -488667161416, 742786340864, -523653800981, -555667048599, 474249356151, 362752035421, 315902961434, -1384079725379, 567709881089, -483862848431, 890462561906, -1 -- (+355 chars; full line in the Zenodo source)
[555667048599, 357172659199, -812371088894, 315902961434, 535032485156, 488667161416, -1631780291661, 397269141569, -483862848431, 756512737471, -1359589637294, 644621615521, 236281990084, 1600208410414, -1498635420676, 503741800209, -604838724116, 1164688231729, -1859773329336, 169608922836, -160875461654, 1056004783816, -923484342146, 486388895371, 67442299384, 566959698034, -567709881089, -35 -- (+355 chars; full line in the Zenodo source)
[-538101407344, 474249356151, 555667048599, -718611246004, -652193438791, 357172659199, 362752035421, 523653800981, -812371088894, 415750652069, -108951662426, 315902961434, -742786340864, 553455875666, 535032485156, 863458035026, -1384079725379, 488667161416, 356788088641, 1119341968569, -1631780291661, 567709881089, -731036251589, 397269141569, -566959698034, 1208057053861, -483862848431, -674 -- (+356 chars; full line in the Zenodo source)
theorem A_def : A = (rng 1 51).map (fun t => rowA (102 + 1) t (rng 1 51)) := rfl
theorem len : allLen 51 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 51 B A = sid 1868233496491990 51 := rfl
theorem d_ne : (1868233496491990 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 51 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 51) (h0 : mv A g = zeros 51) : g = zeros 51 :=
kernel_zero 51 1868233496491990 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 102 51 = true := rfl
/-- **Balanced ⇒ pairs for p = 103.** A list with entries in (0, 103) that is balanced for 1 ≤ t ≤ 51
has as many copies of x as of 103 − x for every 1 ≤ x ≤ 51 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 103)
(hb : ∀ t, 1 ≤ t → t < 1 + 51 → tsum 103 t c + tsum 103 t c = c.length * 103) :
(rng 1 51).all (fun x => Nat.beq (cnt x c) (cnt (103 - x) c)) = true :=
pairs_of_bal 102 51 1868233496491990 d_ne A B len cert A_def delta c hr hb
end MailletCert103
#print axioms MailletCert103.A_def
#print axioms MailletCert103.len
#print axioms MailletCert103.cert
#print axioms MailletCert103.d_ne
#print axioms MailletCert103.kernel
#print axioms MailletCert103.delta
#print axioms MailletCert103.pairs
lean_all/hodge/MailletCert107.lean
/-
hodge/MailletCert107.lean — T41 (goals G849b, G849c): for p = 107 the 53 × 53 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 53)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 13575075778121322 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 107) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert107
open MailletLin MailletBridge
def A : List (List Int) := [
[-105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105],
[-101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103],
[-97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101],
[-93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, -105, -91, -77, -63, -49, -35, -21, -7],
[-91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99],
[-89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, -99, -81, -63, -45, -27, -9],
[-87, -67, -47, -27, -7, 13, 33, 53, 73, 93, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97],
[-85, -63, -41, -19, 3, 25, 47, 69, 91, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, -89, -67, -45, -23, -1, 21, 43, 65, 87, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, -99, -77, -55, -33, -11],
[-83, -59, -35, -11, 13, 37, 61, 85, -105, -81, -57, -33, -9, 15, 39, 63, 87, -103, -79, -55, -31, -7, 17, 41, 65, 89, -101, -77, -53, -29, -5, 19, 43, 67, 91, -99, -75, -51, -27, -3, 21, 45, 69, 93, -97, -73, -49, -25, -1, 23, 47, 71, 95],
[-81, -55, -29, -3, 23, 49, 75, 101, -87, -61, -35, -9, 17, 43, 69, 95, -93, -67, -41, -15, 11, 37, 63, 89, -99, -73, -47, -21, 5, 31, 57, 83, -105, -79, -53, -27, -1, 25, 51, 77, 103, -85, -59, -33, -7, 19, 45, 71, 97, -91, -65, -39, -13],
[-79, -51, -23, 5, 33, 61, 89, -97, -69, -41, -13, 15, 43, 71, 99, -87, -59, -31, -3, 25, 53, 81, -105, -77, -49, -21, 7, 35, 63, 91, -95, -67, -39, -11, 17, 45, 73, 101, -85, -57, -29, -1, 27, 55, 83, -103, -75, -47, -19, 9, 37, 65, 93],
[-77, -47, -17, 13, 43, 73, 103, -81, -51, -21, 9, 39, 69, 99, -85, -55, -25, 5, 35, 65, 95, -89, -59, -29, 1, 31, 61, 91, -93, -63, -33, -3, 27, 57, 87, -97, -67, -37, -7, 23, 53, 83, -101, -71, -41, -11, 19, 49, 79, -105, -75, -45, -15],
[-75, -43, -11, 21, 53, 85, -97, -65, -33, -1, 31, 63, 95, -87, -55, -23, 9, 41, 73, 105, -77, -45, -13, 19, 51, 83, -99, -67, -35, -3, 29, 61, 93, -89, -57, -25, 7, 39, 71, 103, -79, -47, -15, 17, 49, 81, -101, -69, -37, -5, 27, 59, 91],
[-73, -39, -5, 29, 63, 97, -83, -49, -15, 19, 53, 87, -93, -59, -25, 9, 43, 77, -103, -69, -35, -1, 33, 67, 101, -79, -45, -11, 23, 57, 91, -89, -55, -21, 13, 47, 81, -99, -65, -31, 3, 37, 71, 105, -75, -41, -7, 27, 61, 95, -85, -51, -17],
[-71, -35, 1, 37, 73, -105, -69, -33, 3, 39, 75, -103, -67, -31, 5, 41, 77, -101, -65, -29, 7, 43, 79, -99, -63, -27, 9, 45, 81, -97, -61, -25, 11, 47, 83, -95, -59, -23, 13, 49, 85, -93, -57, -21, 15, 51, 87, -91, -55, -19, 17, 53, 89],
[-69, -31, 7, 45, 83, -93, -55, -17, 21, 59, 97, -79, -41, -3, 35, 73, -103, -65, -27, 11, 49, 87, -89, -51, -13, 25, 63, 101, -75, -37, 1, 39, 77, -99, -61, -23, 15, 53, 91, -85, -47, -9, 29, 67, 105, -71, -33, 5, 43, 81, -95, -57, -19],
[-67, -27, 13, 53, 93, -81, -41, -1, 39, 79, -95, -55, -15, 25, 65, 105, -69, -29, 11, 51, 91, -83, -43, -3, 37, 77, -97, -57, -17, 23, 63, 103, -71, -31, 9, 49, 89, -85, -45, -5, 35, 75, -99, -59, -19, 21, 61, 101, -73, -33, 7, 47, 87],
[-65, -23, 19, 61, 103, -69, -27, 15, 57, 99, -73, -31, 11, 53, 95, -77, -35, 7, 49, 91, -81, -39, 3, 45, 87, -85, -43, -1, 41, 83, -89, -47, -5, 37, 79, -93, -51, -9, 33, 75, -97, -55, -13, 29, 71, -101, -59, -17, 25, 67, -105, -63, -21],
[-63, -19, 25, 69, -101, -57, -13, 31, 75, -95, -51, -7, 37, 81, -89, -45, -1, 43, 87, -83, -39, 5, 49, 93, -77, -33, 11, 55, 99, -71, -27, 17, 61, 105, -65, -21, 23, 67, -103, -59, -15, 29, 73, -97, -53, -9, 35, 79, -91, -47, -3, 41, 85],
[-61, -15, 31, 77, -91, -45, 1, 47, 93, -75, -29, 17, 63, -105, -59, -13, 33, 79, -89, -43, 3, 49, 95, -73, -27, 19, 65, -103, -57, -11, 35, 81, -87, -41, 5, 51, 97, -71, -25, 21, 67, -101, -55, -9, 37, 83, -85, -39, 7, 53, 99, -69, -23],
[-59, -11, 37, 85, -81, -33, 15, 63, -103, -55, -7, 41, 89, -77, -29, 19, 67, -99, -51, -3, 45, 93, -73, -25, 23, 71, -95, -47, 1, 49, 97, -69, -21, 27, 75, -91, -43, 5, 53, 101, -65, -17, 31, 79, -87, -39, 9, 57, 105, -61, -13, 35, 83],
[-57, -7, 43, 93, -71, -21, 29, 79, -85, -35, 15, 65, -99, -49, 1, 51, 101, -63, -13, 37, 87, -77, -27, 23, 73, -91, -41, 9, 59, -105, -55, -5, 45, 95, -69, -19, 31, 81, -83, -33, 17, 67, -97, -47, 3, 53, 103, -61, -11, 39, 89, -75, -25],
[-55, -3, 49, 101, -61, -9, 43, 95, -67, -15, 37, 89, -73, -21, 31, 83, -79, -27, 25, 77, -85, -33, 19, 71, -91, -39, 13, 65, -97, -45, 7, 59, -103, -51, 1, 53, 105, -57, -5, 47, 99, -63, -11, 41, 93, -69, -17, 35, 87, -75, -23, 29, 81],
[-53, 1, 55, -105, -51, 3, 57, -103, -49, 5, 59, -101, -47, 7, 61, -99, -45, 9, 63, -97, -43, 11, 65, -95, -41, 13, 67, -93, -39, 15, 69, -91, -37, 17, 71, -89, -35, 19, 73, -87, -33, 21, 75, -85, -31, 23, 77, -83, -29, 25, 79, -81, -27],
[-51, 5, 61, -97, -41, 15, 71, -87, -31, 25, 81, -77, -21, 35, 91, -67, -11, 45, 101, -57, -1, 55, -103, -47, 9, 65, -93, -37, 19, 75, -83, -27, 29, 85, -73, -17, 39, 95, -63, -7, 49, 105, -53, 3, 59, -99, -43, 13, 69, -89, -33, 23, 79],
[-49, 9, 67, -89, -31, 27, 85, -71, -13, 45, 103, -53, 5, 63, -93, -35, 23, 81, -75, -17, 41, 99, -57, 1, 59, -97, -39, 19, 77, -79, -21, 37, 95, -61, -3, 55, -101, -43, 15, 73, -83, -25, 33, 91, -65, -7, 51, -105, -47, 11, 69, -87, -29],
[-47, 13, 73, -81, -21, 39, 99, -55, 5, 65, -89, -29, 31, 91, -63, -3, 57, -97, -37, 23, 83, -71, -11, 49, -105, -45, 15, 75, -79, -19, 41, 101, -53, 7, 67, -87, -27, 33, 93, -61, -1, 59, -95, -35, 25, 85, -69, -9, 51, -103, -43, 17, 77],
[-45, 17, 79, -73, -11, 51, -101, -39, 23, 85, -67, -5, 57, -95, -33, 29, 91, -61, 1, 63, -89, -27, 35, 97, -55, 7, 69, -83, -21, 41, 103, -49, 13, 75, -77, -15, 47, -105, -43, 19, 81, -71, -9, 53, -99, -37, 25, 87, -65, -3, 59, -93, -31],
[-43, 21, 85, -65, -1, 63, -87, -23, 41, 105, -45, 19, 83, -67, -3, 61, -89, -25, 39, 103, -47, 17, 81, -69, -5, 59, -91, -27, 37, 101, -49, 15, 79, -71, -7, 57, -93, -29, 35, 99, -51, 13, 77, -73, -9, 55, -95, -31, 33, 97, -53, 11, 75],
[-41, 25, 91, -57, 9, 75, -73, -7, 59, -89, -23, 43, -105, -39, 27, 93, -55, 11, 77, -71, -5, 61, -87, -21, 45, -103, -37, 29, 95, -53, 13, 79, -69, -3, 63, -85, -19, 47, -101, -35, 31, 97, -51, 15, 81, -67, -1, 65, -83, -17, 49, -99, -33],
[-39, 29, 97, -49, 19, 87, -59, 9, 77, -69, -1, 67, -79, -11, 57, -89, -21, 47, -99, -31, 37, 105, -41, 27, 95, -51, 17, 85, -61, 7, 75, -71, -3, 65, -81, -13, 55, -91, -23, 45, -101, -33, 35, 103, -43, 25, 93, -53, 15, 83, -63, 5, 73],
[-37, 33, 103, -41, 29, 99, -45, 25, 95, -49, 21, 91, -53, 17, 87, -57, 13, 83, -61, 9, 79, -65, 5, 75, -69, 1, 71, -73, -3, 67, -77, -7, 63, -81, -11, 59, -85, -15, 55, -89, -19, 51, -93, -23, 47, -97, -27, 43, -101, -31, 39, -105, -35],
[-35, 37, -105, -33, 39, -103, -31, 41, -101, -29, 43, -99, -27, 45, -97, -25, 47, -95, -23, 49, -93, -21, 51, -91, -19, 53, -89, -17, 55, -87, -15, 57, -85, -13, 59, -83, -11, 61, -81, -9, 63, -79, -7, 65, -77, -5, 67, -75, -3, 69, -73, -1, 71],
[-33, 41, -99, -25, 49, -91, -17, 57, -83, -9, 65, -75, -1, 73, -67, 7, 81, -59, 15, 89, -51, 23, 97, -43, 31, 105, -35, 39, -101, -27, 47, -93, -19, 55, -85, -11, 63, -77, -3, 71, -69, 5, 79, -61, 13, 87, -53, 21, 95, -45, 29, 103, -37],
[-31, 45, -93, -17, 59, -79, -3, 73, -65, 11, 87, -51, 25, 101, -37, 39, -99, -23, 53, -85, -9, 67, -71, 5, 81, -57, 19, 95, -43, 33, -105, -29, 47, -91, -15, 61, -77, -1, 75, -63, 13, 89, -49, 27, 103, -35, 41, -97, -21, 55, -83, -7, 69],
[-29, 49, -87, -9, 69, -67, 11, 89, -47, 31, -105, -27, 51, -85, -7, 71, -65, 13, 91, -45, 33, -103, -25, 53, -83, -5, 73, -63, 15, 93, -43, 35, -101, -23, 55, -81, -3, 75, -61, 17, 95, -41, 37, -99, -21, 57, -79, -1, 77, -59, 19, 97, -39],
[-27, 53, -81, -1, 79, -55, 25, 105, -29, 51, -83, -3, 77, -57, 23, 103, -31, 49, -85, -5, 75, -59, 21, 101, -33, 47, -87, -7, 73, -61, 19, 99, -35, 45, -89, -9, 71, -63, 17, 97, -37, 43, -91, -11, 69, -65, 15, 95, -39, 41, -93, -13, 67],
[-25, 57, -75, 7, 89, -43, 39, -93, -11, 71, -61, 21, 103, -29, 53, -79, 3, 85, -47, 35, -97, -15, 67, -65, 17, 99, -33, 49, -83, -1, 81, -51, 31, -101, -19, 63, -69, 13, 95, -37, 45, -87, -5, 77, -55, 27, -105, -23, 59, -73, 9, 91, -41],
[-23, 61, -69, 15, 99, -31, 53, -77, 7, 91, -39, 45, -85, -1, 83, -47, 37, -93, -9, 75, -55, 29, -101, -17, 67, -63, 21, 105, -25, 59, -71, 13, 97, -33, 51, -79, 5, 89, -41, 43, -87, -3, 81, -49, 35, -95, -11, 73, -57, 27, -103, -19, 65],
[-21, 65, -63, 23, -105, -19, 67, -61, 25, -103, -17, 69, -59, 27, -101, -15, 71, -57, 29, -99, -13, 73, -55, 31, -97, -11, 75, -53, 33, -95, -9, 77, -51, 35, -93, -7, 79, -49, 37, -91, -5, 81, -47, 39, -89, -3, 83, -45, 41, -87, -1, 85, -43],
[-19, 69, -57, 31, -95, -7, 81, -45, 43, -83, 5, 93, -33, 55, -71, 17, 105, -21, 67, -59, 29, -97, -9, 79, -47, 41, -85, 3, 91, -35, 53, -73, 15, 103, -23, 65, -61, 27, -99, -11, 77, -49, 39, -87, 1, 89, -37, 51, -75, 13, 101, -25, 63],
[-17, 73, -51, 39, -85, 5, 95, -29, 61, -63, 27, -97, -7, 83, -41, 49, -75, 15, 105, -19, 71, -53, 37, -87, 3, 93, -31, 59, -65, 25, -99, -9, 81, -43, 47, -77, 13, 103, -21, 69, -55, 35, -89, 1, 91, -33, 57, -67, 23, -101, -11, 79, -45],
[-15, 77, -45, 47, -75, 17, -105, -13, 79, -43, 49, -73, 19, -103, -11, 81, -41, 51, -71, 21, -101, -9, 83, -39, 53, -69, 23, -99, -7, 85, -37, 55, -67, 25, -97, -5, 87, -35, 57, -65, 27, -95, -3, 89, -33, 59, -63, 29, -93, -1, 91, -31, 61],
[-13, 81, -39, 55, -65, 29, -91, 3, 97, -23, 71, -49, 45, -75, 19, -101, -7, 87, -33, 61, -59, 35, -85, 9, 103, -17, 77, -43, 51, -69, 25, -95, -1, 93, -27, 67, -53, 41, -79, 15, -105, -11, 83, -37, 57, -63, 31, -89, 5, 99, -21, 73, -47],
[-11, 85, -33, 63, -55, 41, -77, 19, -99, -3, 93, -25, 71, -47, 49, -69, 27, -91, 5, 101, -17, 79, -39, 57, -61, 35, -83, 13, -105, -9, 87, -31, 65, -53, 43, -75, 21, -97, -1, 95, -23, 73, -45, 51, -67, 29, -89, 7, 103, -15, 81, -37, 59],
[-9, 89, -27, 71, -45, 53, -63, 35, -81, 17, -99, -1, 97, -19, 79, -37, 61, -55, 43, -73, 25, -91, 7, 105, -11, 87, -29, 69, -47, 51, -65, 33, -83, 15, -101, -3, 95, -21, 77, -39, 59, -57, 41, -75, 23, -93, 5, 103, -13, 85, -31, 67, -49],
[-7, 93, -21, 79, -35, 65, -49, 51, -63, 37, -77, 23, -91, 9, -105, -5, 95, -19, 81, -33, 67, -47, 53, -61, 39, -75, 25, -89, 11, -103, -3, 97, -17, 83, -31, 69, -45, 55, -59, 41, -73, 27, -87, 13, -101, -1, 99, -15, 85, -29, 71, -43, 57],
[-5, 97, -15, 87, -25, 77, -35, 67, -45, 57, -55, 47, -65, 37, -75, 27, -85, 17, -95, 7, -105, -3, 99, -13, 89, -23, 79, -33, 69, -43, 59, -53, 49, -63, 39, -73, 29, -83, 19, -93, 9, -103, -1, 101, -11, 91, -21, 81, -31, 71, -41, 61, -51],
[-3, 101, -9, 95, -15, 89, -21, 83, -27, 77, -33, 71, -39, 65, -45, 59, -51, 53, -57, 47, -63, 41, -69, 35, -75, 29, -81, 23, -87, 17, -93, 11, -99, 5, -105, -1, 103, -7, 97, -13, 91, -19, 85, -25, 79, -31, 73, -37, 67, -43, 61, -49, 55],
[-1, 105, -3, 103, -5, 101, -7, 99, -9, 97, -11, 95, -13, 93, -15, 91, -17, 89, -19, 87, -21, 85, -23, 83, -25, 81, -27, 79, -29, 77, -31, 75, -33, 73, -35, 71, -37, 69, -39, 67, -41, 65, -43, 63, -45, 61, -47, 59, -49, 57, -51, 55, -53]]
def B : List (List Int) := [
[3443566991087, -8309698478975, 450293284229, 3355443784100, -6469013711231, -1436152533239, -3122065186142, -4368481708007, -6932820660715, 2179383266489, -7329299004787, -4281981439978, -8281440339718, -4659998748838, -7138272190049, -2365185972679, -8169210894170, -2088583502333, -9979509030862, -9831787958021, -7108610971478, -5388745667195, -9594743733436, -4423452402071, -10316800972069, - -- (+443 chars; full line in the Zenodo source)
[-8309698478975, 3355443784100, -1436152533239, -4368481708007, 2179383266489, -4281981439978, -4659998748838, -2365185972679, -2088583502333, -9831787958021, -5388745667195, -4423452402071, -4702699305158, -1294241706068, -2557462551211, -9768191420138, -3493097199301, -1048475302867, -3854628357851, 4108950169331, -2004398337400, -3812663015434, 331408547833, 3359748163439, 353973355459, 25660 -- (+420 chars; full line in the Zenodo source)
[450293284229, -1436152533239, -6932820660715, -4281981439978, -7138272190049, -2088583502333, -7108610971478, -4423452402071, -8770696677565, -2557462551211, -6182059698658, -1048475302867, -9491547412504, -2004398337400, -949560204512, 3359748163439, -2830901105711, 4569052204144, -353973355459, 6742064623606, 3812663015434, 10089375936793, 3854628357851, 11534388054445, 9768191420138, 1341854 -- (+427 chars; full line in the Zenodo source)
[3355443784100, -4368481708007, -4281981439978, -2365185972679, -9831787958021, -4423452402071, -1294241706068, -9768191420138, -1048475302867, 4108950169331, -3812663015434, 3359748163439, 2566084777490, 2830901105711, 6742064623606, 8739720889082, 9491547412504, 11534388054445, 6416252949566, 8770696677565, 9594743733436, 9979509030862, 7138272190049, 7329299004787, 3122065186142, -45029328422 -- (+425 chars; full line in the Zenodo source)
[-6469013711231, 2179383266489, -7138272190049, -9831787958021, -10316800972069, -2557462551211, -11534388054445, 4108950169331, -949560204512, 353973355459, -2566084777490, 6742064623606, 2004398337400, 12046966901845, 9768191420138, 8770696677565, 5388745667195, 8169210894170, 4281981439978, 3122065186142, 8309698478975, 450293284229, -4368481708007, -8281440339718, -2088583502333, -9594743733 -- (+426 chars; full line in the Zenodo source)
[-1436152533239, -4281981439978, -2088583502333, -4423452402071, -2557462551211, -1048475302867, -2004398337400, 3359748163439, 4569052204144, 6742064623606, 10089375936793, 11534388054445, 13418543285671, 9594743733436, 8169210894170, 7329299004787, 6469013711231, 3443566991087, -3122065186142, -8281440339718, -9979509030862, -10316800972069, -6416252949566, -12046966901845, -8739720889082, -79 -- (+428 chars; full line in the Zenodo source)
[-3122065186142, -4659998748838, -7108610971478, -1294241706068, -11534388054445, -2004398337400, -7975744264426, 2830901105711, 3812663015434, 12046966901845, 2557462551211, 9594743733436, 2365185972679, 6932820660715, 8309698478975, -6469013711231, -4281981439978, -9979509030862, -4702699305158, -6182059698658, 4108950169331, -6742064623606, 4569052204144, -331408547833, 9491547412504, 9768191 -- (+426 chars; full line in the Zenodo source)
[-4368481708007, -2365185972679, -4423452402071, -9768191420138, 4108950169331, 3359748163439, 2830901105711, 8739720889082, 11534388054445, 8770696677565, 9979509030862, 7329299004787, -450293284229, -6469013711231, -8281440339718, -7108610971478, -13418543285671, -12046966901845, -949560204512, -4569052204144, -331408547833, 3854628357851, 2557462551211, 5388745667195, 4659998748838, 143615253 -- (+426 chars; full line in the Zenodo source)
[-6932820660715, -2088583502333, -8770696677565, -1048475302867, -949560204512, 4569052204144, 3812663015434, 11534388054445, 4702699305158, 8169210894170, 4368481708007, 3443566991087, 2179383266489, -9979509030862, -1294241706068, -12046966901845, 331408547833, -2566084777490, 8739720889082, 3493097199301, 10316800972069, 2365185972679, 3122065186142, -8309698478975, -7329299004787, -983178795 -- (+423 chars; full line in the Zenodo source)
[2179383266489, -9831787958021, -2557462551211, 4108950169331, 353973355459, 6742064623606, 12046966901845, 8770696677565, 8169210894170, 3122065186142, 450293284229, -8281440339718, -9594743733436, -6182059698658, -8739720889082, -4569052204144, 3812663015434, 3493097199301, 4423452402071, 4659998748838, -3355443784100, -1436152533239, -2365185972679, -4702699305158, -1048475302867, 33140854783 -- (+423 chars; full line in the Zenodo source)
[-7329299004787, -5388745667195, -6182059698658, -3812663015434, -2566084777490, 10089375936793, 2557462551211, 9979509030862, 4368481708007, 450293284229, -4659998748838, -10316800972069, -1048475302867, -6742064623606, 7975744264426, 3854628357851, 8770696677565, 2365185972679, 6469013711231, -1436152533239, -8169210894170, -1294241706068, -9491547412504, 353973355459, -331408547833, 115343880 -- (+427 chars; full line in the Zenodo source)
[-4281981439978, -4423452402071, -1048475302867, 3359748163439, 6742064623606, 11534388054445, 9594743733436, 7329299004787, 3443566991087, -8281440339718, -10316800972069, -12046966901845, -7975744264426, -331408547833, 3493097199301, 5388745667195, -2179383266489, -8309698478975, -4659998748838, -4702699305158, -3854628357851, 353973355459, 949560204512, 6182059698658, 7108610971478, 693282066 -- (+423 chars; full line in the Zenodo source)
[-8281440339718, -4702699305158, -9491547412504, 2566084777490, 2004398337400, 13418543285671, 2365185972679, -450293284229, 2179383266489, -9594743733436, -1048475302867, -7975744264426, 949560204512, 9768191420138, 9979509030862, 1436152533239, -3122065186142, -9831787958021, -6182059698658, 331408547833, -3359748163439, 11534388054445, 5388745667195, 6932820660715, 3355443784100, -81692108941 -- (+423 chars; full line in the Zenodo source)
[-4659998748838, -1294241706068, -2004398337400, 2830901105711, 12046966901845, 9594743733436, 6932820660715, -6469013711231, -9979509030862, -6182059698658, -6742064623606, -331408547833, 9768191420138, 2088583502333, -3355443784100, 2179383266489, -4423452402071, -3854628357851, 2566084777490, 10089375936793, 8770696677565, 8281440339718, 3443566991087, -7138272190049, -13418543285671, -873972 -- (+427 chars; full line in the Zenodo source)
[-7138272190049, -2557462551211, -949560204512, 6742064623606, 9768191420138, 8169210894170, 8309698478975, -8281440339718, -1294241706068, -8739720889082, 7975744264426, 3493097199301, 9979509030862, -3355443784100, -7329299004787, -4702699305158, -10089375936793, 2830901105711, 1048475302867, 7108610971478, 1436152533239, -6932820660715, -4423452402071, -9491547412504, 4569052204144, 385462835 -- (+424 chars; full line in the Zenodo source)
[-2365185972679, -9768191420138, 3359748163439, 8739720889082, 8770696677565, 7329299004787, -6469013711231, -7108610971478, -12046966901845, -4569052204144, 3854628357851, 5388745667195, 1436152533239, 2179383266489, -4702699305158, -2004398337400, 7975744264426, 6182059698658, 8169210894170, -3443566991087, -7138272190049, -6416252949566, -6742064623606, 3812663015434, 1294241706068, 428198143 -- (+423 chars; full line in the Zenodo source)
[-8169210894170, -3493097199301, -2830901105711, 9491547412504, 5388745667195, 6469013711231, -4281981439978, -13418543285671, 331408547833, 3812663015434, 8770696677565, -2179383266489, -3122065186142, -4423452402071, -10089375936793, 7975744264426, 9768191420138, 7138272190049, -8309698478975, -9979509030862, -1048475302867, -4569052204144, 12046966901845, 9831787958021, -450293284229, -465999 -- (+428 chars; full line in the Zenodo source)
[-2088583502333, -1048475302867, 4569052204144, 11534388054445, 8169210894170, 3443566991087, -9979509030862, -12046966901845, -2566084777490, 3493097199301, 2365185972679, -8309698478975, -9831787958021, -3854628357851, 2830901105711, 6182059698658, 7138272190049, 450293284229, -7108610971478, -9491547412504, -353973355459, 9768191420138, 4659998748838, 3355443784100, -5388745667195, 4108950169 -- (+426 chars; full line in the Zenodo source)
[-9979509030862, -3854628357851, -353973355459, 6416252949566, 4281981439978, -3122065186142, -4702699305158, -949560204512, 8739720889082, 4423452402071, 6469013711231, -4659998748838, -6182059698658, 2566084777490, 1048475302867, 8169210894170, -8309698478975, -7108610971478, 4108950169331, -3359748163439, 13418543285671, -2179383266489, -6932820660715, -1294241706068, -6742064623606, 10089375 -- (+429 chars; full line in the Zenodo source)
[-9831787958021, 4108950169331, 6742064623606, 8770696677565, 3122065186142, -8281440339718, -6182059698658, -4569052204144, 3493097199301, 4659998748838, -1436152533239, -4702699305158, 331408547833, 10089375936793, 7108610971478, -3443566991087, -9979509030862, -9491547412504, -3359748163439, 1294241706068, 4368481708007, -4281981439978, -9768191420138, 2566084777490, 11534388054445, 713827219 -- (+426 chars; full line in the Zenodo source)
[-7108610971478, -2004398337400, 3812663015434, 9594743733436, 8309698478975, -9979509030862, 4108950169331, -331408547833, 10316800972069, -3355443784100, -8169210894170, -3854628357851, -3359748163439, 8770696677565, 1436152533239, -7138272190049, -1048475302867, -353973355459, 13418543285671, 4368481708007, -8281440339718, -3493097199301, -2566084777490, 6416252949566, -2179383266489, -732929 -- (+430 chars; full line in the Zenodo source)
[-5388745667195, -3812663015434, 10089375936793, 9979509030862, 450293284229, -10316800972069, -6742064623606, 3854628357851, 2365185972679, -1436152533239, -1294241706068, 353973355459, 11534388054445, 8281440339718, -6932820660715, -6416252949566, -4569052204144, 9768191420138, -2179383266489, -4281981439978, -3493097199301, 2830901105711, 13418543285671, 3122065186142, -7138272190049, -120469 -- (+426 chars; full line in the Zenodo source)
[-9594743733436, 331408547833, 3854628357851, 7138272190049, -4368481708007, -6416252949566, 4569052204144, 2557462551211, 3122065186142, -2365185972679, -9491547412504, 949560204512, 5388745667195, 3443566991087, -4423452402071, -6742064623606, 12046966901845, 4659998748838, -6932820660715, -9768191420138, -2566084777490, 13418543285671, 1436152533239, -8169210894170, 4108950169331, 38126630154 -- (+423 chars; full line in the Zenodo source)
[-4423452402071, 3359748163439, 11534388054445, 7329299004787, -8281440339718, -12046966901845, -331408547833, 5388745667195, -8309698478975, -4702699305158, 353973355459, 6182059698658, 6932820660715, -7138272190049, -9491547412504, 3812663015434, 9831787958021, 3355443784100, -1294241706068, 2566084777490, 6416252949566, 3122065186142, -8169210894170, -10089375936793, 2004398337400, 2088583502 -- (+424 chars; full line in the Zenodo source)
[-10316800972069, 353973355459, 9768191420138, 3122065186142, -2088583502333, -8739720889082, 9491547412504, 4659998748838, -7329299004787, -1048475302867, -331408547833, 7108610971478, 3355443784100, -13418543285671, 4569052204144, 1294241706068, -450293284229, -5388745667195, -6742064623606, 11534388054445, -2179383266489, -7138272190049, 4108950169331, 2004398337400, 8169210894170, -436848170 -- (+425 chars; full line in the Zenodo source)
[-4702699305158, 2566084777490, 13418543285671, -450293284229, -9594743733436, -7975744264426, 9768191420138, 1436152533239, -9831787958021, 331408547833, 11534388054445, 6932820660715, -8169210894170, -8739720889082, 3854628357851, 4281981439978, -4659998748838, 4108950169331, 10089375936793, 7138272190049, -7329299004787, -12046966901845, 3812663015434, 2088583502333, -4368481708007, -34930971 -- (+426 chars; full line in the Zenodo source)
[-8770696677565, 4569052204144, 4702699305158, 3443566991087, -1294241706068, -2566084777490, 10316800972069, -8309698478975, -13418543285671, 2830901105711, 4423452402071, 450293284229, -2557462551211, -353973355459, 9594743733436, 3355443784100, -6416252949566, 7975744264426, 5388745667195, -6469013711231, -9768191420138, -3359748163439, 7108610971478, -1436152533239, -6182059698658, 674206462 -- (+425 chars; full line in the Zenodo source)
[-1294241706068, 2830901105711, 9594743733436, -6469013711231, -6182059698658, -331408547833, 2088583502333, 2179383266489, -3854628357851, 10089375936793, 8281440339718, -7138272190049, -8739720889082, 1048475302867, 4368481708007, -9831787958021, 3359748163439, 6416252949566, -450293284229, -10316800972069, -4569052204144, 4702699305158, -8309698478975, -2557462551211, 7975744264426, 710861097 -- (+424 chars; full line in the Zenodo source)
[-13418543285671, 7975744264426, 9831787958021, -6932820660715, -3854628357851, -4108950169331, 7329299004787, -2088583502333, -6742064623606, 6416252949566, 8309698478975, -8770696677565, 2830901105711, 5388745667195, -3122065186142, -1048475302867, 2004398337400, 8281440339718, -2365185972679, -949560204512, 6182059698658, -3355443784100, -10316800972069, 4569052204144, 4423452402071, -6469013 -- (+425 chars; full line in the Zenodo source)
[-2557462551211, 6742064623606, 8169210894170, -8281440339718, -8739720889082, 3493097199301, -3355443784100, -4702699305158, 2830901105711, 7108610971478, -6932820660715, -9491547412504, 3854628357851, 4368481708007, -5388745667195, 2566084777490, 10316800972069, -6469013711231, -11534388054445, 2004398337400, 4281981439978, -2088583502333, 3359748163439, 13418543285671, 3443566991087, -6416252 -- (+425 chars; full line in the Zenodo source)
[-6416252949566, 949560204512, 4659998748838, -8169210894170, 3359748163439, 1294241706068, 450293284229, -3493097199301, 2004398337400, 7329299004787, -9831787958021, -2830901105711, 10316800972069, -1436152533239, -12046966901845, 9491547412504, 4368481708007, -9594743733436, 4569052204144, 5388745667195, -6932820660715, 4108950169331, 1048475302867, 6469013711231, -4702699305158, -35397335545 -- (+422 chars; full line in the Zenodo source)
[-9768191420138, 8739720889082, 7329299004787, -7108610971478, -4569052204144, 5388745667195, 2179383266489, -2004398337400, 6182059698658, -3443566991087, -6416252949566, 3812663015434, 4281981439978, -9831787958021, 2566084777490, 9594743733436, -6932820660715, -10089375936793, 3493097199301, 8309698478975, -2557462551211, 949560204512, 8281440339718, -9979509030862, -2830901105711, 4423452402 -- (+426 chars; full line in the Zenodo source)
[-6182059698658, 10089375936793, 4368481708007, -10316800972069, 7975744264426, 2365185972679, -8169210894170, 353973355459, 4423452402071, -6932820660715, -2004398337400, 9768191420138, 3443566991087, -3493097199301, -4108950169331, 3122065186142, -4702699305158, -3359748163439, 7138272190049, -2088583502333, -2830901105711, 9594743733436, 2179383266489, -8739720889082, 6416252949566, -83096984 -- (+425 chars; full line in the Zenodo source)
[-3493097199301, 9491547412504, 6469013711231, -13418543285671, 3812663015434, -2179383266489, -4423452402071, 7975744264426, 7138272190049, -9979509030862, -4569052204144, 9831787958021, -4659998748838, 3359748163439, 10316800972069, -6932820660715, -8739720889082, 2557462551211, 3355443784100, -3854628357851, 11534388054445, -3443566991087, -6182059698658, -4108950169331, 1436152533239, -12942 -- (+425 chars; full line in the Zenodo source)
[-11534388054445, 12046966901845, 8309698478975, -6182059698658, 9491547412504, -3355443784100, -6416252949566, 10089375936793, 1436152533239, -13418543285671, 8739720889082, 4368481708007, -8770696677565, 949560204512, -2179383266489, -10316800972069, 6742064623606, 4281981439978, -9594743733436, 7975744264426, 4659998748838, -7108610971478, 2830901105711, 2365185972679, -9979509030862, 4569052 -- (+421 chars; full line in the Zenodo source)
[-1048475302867, 11534388054445, 3443566991087, -12046966901845, 3493097199301, -8309698478975, -3854628357851, 6182059698658, 450293284229, -9491547412504, 9768191420138, 3355443784100, 4108950169331, 6416252949566, -6469013711231, -10089375936793, 2557462551211, -1436152533239, -2004398337400, 13418543285671, -3122065186142, -8739720889082, 1294241706068, -4368481708007, -3812663015434, 877069 -- (+425 chars; full line in the Zenodo source)
[-12046966901845, 6182059698658, 3355443784100, -10089375936793, 13418543285671, -4368481708007, -949560204512, 10316800972069, -4281981439978, -7975744264426, 7108610971478, -2365185972679, -4569052204144, 8169210894170, -9831787958021, -353973355459, 8281440339718, -4423452402071, -331408547833, 6932820660715, -1294241706068, 2004398337400, 6469013711231, -9768191420138, 3854628357851, -344356 -- (+425 chars; full line in the Zenodo source)
[-3854628357851, 6416252949566, -3122065186142, -949560204512, 4423452402071, -4659998748838, 2566084777490, 8169210894170, -7108610971478, -3359748163439, -2179383266489, -1294241706068, 10089375936793, -450293284229, -11534388054445, 3493097199301, 3355443784100, -2004398337400, 8770696677565, -7329299004787, -7975744264426, 9831787958021, -2088583502333, 2830901105711, 8281440339718, -1031680 -- (+426 chars; full line in the Zenodo source)
[-9491547412504, 13418543285671, 2179383266489, -7975744264426, 9979509030862, -9831787958021, -3359748163439, 6932820660715, -2557462551211, 3854628357851, 3443566991087, 4108950169331, 1294241706068, -7329299004787, 353973355459, 2088583502333, -7108610971478, 6742064623606, 4368481708007, -6416252949566, 12046966901845, -8309698478975, -10089375936793, 8770696677565, -4281981439978, -28309011 -- (+423 chars; full line in the Zenodo source)
[4108950169331, 8770696677565, -8281440339718, -4569052204144, 4659998748838, -4702699305158, 10089375936793, -3443566991087, -9491547412504, 1294241706068, -4281981439978, 2566084777490, 7138272190049, -10316800972069, 2004398337400, 8309698478975, -3854628357851, 13418543285671, -7329299004787, -2830901105711, 2365185972679, -4423452402071, 8739720889082, -450293284229, -12046966901845, 255746 -- (+425 chars; full line in the Zenodo source)
[-10089375936793, 10316800972069, -2365185972679, -353973355459, 6932820660715, -9768191420138, 3493097199301, -3122065186142, 3359748163439, 2088583502333, -9594743733436, 8739720889082, 8309698478975, -9491547412504, 8770696677565, -4659998748838, -2566084777490, 7329299004787, -2557462551211, 1048475302867, -6469013711231, 331408547833, 9831787958021, -7108610971478, 949560204512, -3355443784 -- (+425 chars; full line in the Zenodo source)
[-2004398337400, 9594743733436, -9979509030862, -331408547833, -3355443784100, -3854628357851, 8770696677565, -7138272190049, -353973355459, 4368481708007, -3493097199301, 6416252949566, -7329299004787, -4569052204144, 4281981439978, -2557462551211, 11534388054445, -3122065186142, -7975744264426, 2365185972679, -4702699305158, 9491547412504, 450293284229, -949560204512, 9831787958021, -538874566 -- (+427 chars; full line in the Zenodo source)
[-8739720889082, 7108610971478, -5388745667195, 2004398337400, 3443566991087, -3812663015434, 9831787958021, -9594743733436, 10089375936793, -8309698478975, -949560204512, 9979509030862, -4423452402071, -4108950169331, 450293284229, 331408547833, 2088583502333, -10316800972069, 9491547412504, 3355443784100, -6742064623606, 8169210894170, -4702699305158, 3854628357851, -6469013711231, 33597481634 -- (+424 chars; full line in the Zenodo source)
[-3812663015434, 9979509030862, -10316800972069, 3854628357851, -1436152533239, 353973355459, 8281440339718, -6416252949566, 9768191420138, -4281981439978, 2830901105711, 3122065186142, -12046966901845, 4702699305158, -2088583502333, 949560204512, -3443566991087, -8739720889082, 9831787958021, -4423452402071, 9491547412504, -6469013711231, -7975744264426, 4659998748838, -2557462551211, 618205969 -- (+425 chars; full line in the Zenodo source)
[-949560204512, 8169210894170, -1294241706068, 3493097199301, -7329299004787, 2830901105711, 1436152533239, -9491547412504, 9594743733436, -5388745667195, -4108950169331, -6469013711231, 353973355459, 4281981439978, -6182059698658, 13418543285671, -2365185972679, -331408547833, -3443566991087, -3812663015434, 2088583502333, -8770696677565, 11534388054445, 2179383266489, -2566084777490, 312206518 -- (+424 chars; full line in the Zenodo source)
[331408547833, 7138272190049, -6416252949566, 2557462551211, -2365185972679, 949560204512, 3443566991087, -6742064623606, 4659998748838, -9768191420138, 13418543285671, -8169210894170, 3812663015434, -8309698478975, 3359748163439, 8281440339718, -6182059698658, 1294241706068, -2088583502333, 8739720889082, 450293284229, -7975744264426, 4281981439978, -3493097199301, 8770696677565, -9979509030862 -- (+424 chars; full line in the Zenodo source)
[-6742064623606, 8281440339718, -3493097199301, 4702699305158, -7108610971478, 9491547412504, -4368481708007, -2566084777490, 6469013711231, -2004398337400, 2088583502333, -13418543285671, 6416252949566, -2365185972679, 3812663015434, 450293284229, 353973355459, -2179383266489, -12046966901845, 9594743733436, -4423452402071, 1048475302867, -7329299004787, 7975744264426, 8309698478975, -949560204 -- (+425 chars; full line in the Zenodo source)
[3359748163439, 7329299004787, -12046966901845, 5388745667195, -4702699305158, 6182059698658, -7138272190049, 3812663015434, 3355443784100, 2566084777490, 3122065186142, -10089375936793, 2088583502333, -2557462551211, 13418543285671, -9979509030862, -4108950169331, -4368481708007, 2830901105711, -450293284229, -949560204512, 4659998748838, -3493097199301, 10316800972069, -9594743733436, 10484753 -- (+425 chars; full line in the Zenodo source)
[-7975744264426, 6932820660715, 4108950169331, 2088583502333, -6416252949566, 8770696677565, -5388745667195, 1048475302867, -8281440339718, 949560204512, 3355443784100, -4569052204144, 6469013711231, -3812663015434, 4659998748838, -11534388054445, 9594743733436, -4702699305158, 9768191420138, -8169210894170, 10089375936793, -4368481708007, -353973355459, -3443566991087, 3359748163439, -217938326 -- (+425 chars; full line in the Zenodo source)
[353973355459, 3122065186142, -8739720889082, 4659998748838, -1048475302867, 7108610971478, -13418543285671, 1294241706068, -5388745667195, 11534388054445, -7138272190049, 2004398337400, -4368481708007, 7975744264426, 3443566991087, -2830901105711, 1436152533239, -3812663015434, 8281440339718, -12046966901845, 9831787958021, -2557462551211, 8770696677565, -9594743733436, 3493097199301, -23651859 -- (+424 chars; full line in the Zenodo source)
[-2830901105711, 6469013711231, 331408547833, -2179383266489, -10089375936793, 7138272190049, -1048475302867, 9831787958021, -6416252949566, 10316800972069, -4702699305158, 2557462551211, -7108610971478, 11534388054445, -2365185972679, -4108950169331, -7329299004787, 949560204512, -1436152533239, -353973355459, 3443566991087, 2566084777490, -3355443784100, -6742064623606, 6932820660715, -2004398 -- (+428 chars; full line in the Zenodo source)
[2566084777490, -450293284229, -7975744264426, 1436152533239, 331408547833, 6932820660715, -8739720889082, 4281981439978, 4108950169331, 7138272190049, -12046966901845, 2088583502333, -3493097199301, 7108610971478, -6416252949566, 4423452402071, -1294241706068, 8770696677565, -10316800972069, 2557462551211, -5388745667195, 6182059698658, -9979509030862, 1048475302867, -2365185972679, 94915474125 -- (+421 chars; full line in the Zenodo source)
[-4569052204144, -3443566991087, 2566084777490, 8309698478975, -2830901105711, -450293284229, 353973355459, -3355443784100, -7975744264426, 6469013711231, 3359748163439, 1436152533239, -6742064623606, 3122065186142, 331408547833, 4368481708007, -949560204512, 6932820660715, -3812663015434, -2179383266489, -8739720889082, 7329299004787, -2004398337400, 4281981439978, -10089375936793, 828144033971 -- (+425 chars; full line in the Zenodo source)
theorem A_def : A = (rng 1 53).map (fun t => rowA (106 + 1) t (rng 1 53)) := rfl
theorem len : allLen 53 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 53 B A = sid 13575075778121322 53 := rfl
theorem d_ne : (13575075778121322 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 53 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 53) (h0 : mv A g = zeros 53) : g = zeros 53 :=
kernel_zero 53 13575075778121322 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 106 53 = true := rfl
/-- **Balanced ⇒ pairs for p = 107.** A list with entries in (0, 107) that is balanced for 1 ≤ t ≤ 53
has as many copies of x as of 107 − x for every 1 ≤ x ≤ 53 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 107)
(hb : ∀ t, 1 ≤ t → t < 1 + 53 → tsum 107 t c + tsum 107 t c = c.length * 107) :
(rng 1 53).all (fun x => Nat.beq (cnt x c) (cnt (107 - x) c)) = true :=
pairs_of_bal 106 53 13575075778121322 d_ne A B len cert A_def delta c hr hb
end MailletCert107
#print axioms MailletCert107.A_def
#print axioms MailletCert107.len
#print axioms MailletCert107.cert
#print axioms MailletCert107.d_ne
#print axioms MailletCert107.kernel
#print axioms MailletCert107.delta
#print axioms MailletCert107.pairs
lean_all/hodge/MailletCert109.lean
/-
hodge/MailletCert109.lean — T41 (goals G849b, G849c): for p = 109 the 54 × 54 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 54)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 35269086426685162 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 109) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert109
open MailletLin MailletBridge
def A : List (List Int) := [
[-107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107],
[-103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105],
[-99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103],
[-95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, -105, -91, -77, -63, -49, -35, -21, -7],
[-93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101],
[-91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, -99, -81, -63, -45, -27, -9],
[-89, -69, -49, -29, -9, 11, 31, 51, 71, 91, -107, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99],
[-87, -65, -43, -21, 1, 23, 45, 67, 89, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, -99, -77, -55, -33, -11],
[-85, -61, -37, -13, 11, 35, 59, 83, 107, -87, -63, -39, -15, 9, 33, 57, 81, 105, -89, -65, -41, -17, 7, 31, 55, 79, 103, -91, -67, -43, -19, 5, 29, 53, 77, 101, -93, -69, -45, -21, 3, 27, 51, 75, 99, -95, -71, -47, -23, 1, 25, 49, 73, 97],
[-83, -57, -31, -5, 21, 47, 73, 99, -93, -67, -41, -15, 11, 37, 63, 89, -103, -77, -51, -25, 1, 27, 53, 79, 105, -87, -61, -35, -9, 17, 43, 69, 95, -97, -71, -45, -19, 7, 33, 59, 85, -107, -81, -55, -29, -3, 23, 49, 75, 101, -91, -65, -39, -13],
[-81, -53, -25, 3, 31, 59, 87, -103, -75, -47, -19, 9, 37, 65, 93, -97, -69, -41, -13, 15, 43, 71, 99, -91, -63, -35, -7, 21, 49, 77, 105, -85, -57, -29, -1, 27, 55, 83, -107, -79, -51, -23, 5, 33, 61, 89, -101, -73, -45, -17, 11, 39, 67, 95],
[-79, -49, -19, 11, 41, 71, 101, -87, -57, -27, 3, 33, 63, 93, -95, -65, -35, -5, 25, 55, 85, -103, -73, -43, -13, 17, 47, 77, 107, -81, -51, -21, 9, 39, 69, 99, -89, -59, -29, 1, 31, 61, 91, -97, -67, -37, -7, 23, 53, 83, -105, -75, -45, -15],
[-77, -45, -13, 19, 51, 83, -103, -71, -39, -7, 25, 57, 89, -97, -65, -33, -1, 31, 63, 95, -91, -59, -27, 5, 37, 69, 101, -85, -53, -21, 11, 43, 75, 107, -79, -47, -15, 17, 49, 81, -105, -73, -41, -9, 23, 55, 87, -99, -67, -35, -3, 29, 61, 93],
[-75, -41, -7, 27, 61, 95, -89, -55, -21, 13, 47, 81, -103, -69, -35, -1, 33, 67, 101, -83, -49, -15, 19, 53, 87, -97, -63, -29, 5, 39, 73, 107, -77, -43, -9, 25, 59, 93, -91, -57, -23, 11, 45, 79, -105, -71, -37, -3, 31, 65, 99, -85, -51, -17],
[-73, -37, -1, 35, 71, 107, -75, -39, -3, 33, 69, 105, -77, -41, -5, 31, 67, 103, -79, -43, -7, 29, 65, 101, -81, -45, -9, 27, 63, 99, -83, -47, -11, 25, 61, 97, -85, -49, -13, 23, 59, 95, -87, -51, -15, 21, 57, 93, -89, -53, -17, 19, 55, 91],
[-71, -33, 5, 43, 81, -99, -61, -23, 15, 53, 91, -89, -51, -13, 25, 63, 101, -79, -41, -3, 35, 73, -107, -69, -31, 7, 45, 83, -97, -59, -21, 17, 55, 93, -87, -49, -11, 27, 65, 103, -77, -39, -1, 37, 75, -105, -67, -29, 9, 47, 85, -95, -57, -19],
[-69, -29, 11, 51, 91, -87, -47, -7, 33, 73, -105, -65, -25, 15, 55, 95, -83, -43, -3, 37, 77, -101, -61, -21, 19, 59, 99, -79, -39, 1, 41, 81, -97, -57, -17, 23, 63, 103, -75, -35, 5, 45, 85, -93, -53, -13, 27, 67, 107, -71, -31, 9, 49, 89],
[-67, -25, 17, 59, 101, -75, -33, 9, 51, 93, -83, -41, 1, 43, 85, -91, -49, -7, 35, 77, -99, -57, -15, 27, 69, -107, -65, -23, 19, 61, 103, -73, -31, 11, 53, 95, -81, -39, 3, 45, 87, -89, -47, -5, 37, 79, -97, -55, -13, 29, 71, -105, -63, -21],
[-65, -21, 23, 67, -107, -63, -19, 25, 69, -105, -61, -17, 27, 71, -103, -59, -15, 29, 73, -101, -57, -13, 31, 75, -99, -55, -11, 33, 77, -97, -53, -9, 35, 79, -95, -51, -7, 37, 81, -93, -49, -5, 39, 83, -91, -47, -3, 41, 85, -89, -45, -1, 43, 87],
[-63, -17, 29, 75, -97, -51, -5, 41, 87, -85, -39, 7, 53, 99, -73, -27, 19, 65, -107, -61, -15, 31, 77, -95, -49, -3, 43, 89, -83, -37, 9, 55, 101, -71, -25, 21, 67, -105, -59, -13, 33, 79, -93, -47, -1, 45, 91, -81, -35, 11, 57, 103, -69, -23],
[-61, -13, 35, 83, -87, -39, 9, 57, 105, -65, -17, 31, 79, -91, -43, 5, 53, 101, -69, -21, 27, 75, -95, -47, 1, 49, 97, -73, -25, 23, 71, -99, -51, -3, 45, 93, -77, -29, 19, 67, -103, -55, -7, 41, 89, -81, -33, 15, 63, -107, -59, -11, 37, 85],
[-59, -9, 41, 91, -77, -27, 23, 73, -95, -45, 5, 55, 105, -63, -13, 37, 87, -81, -31, 19, 69, -99, -49, 1, 51, 101, -67, -17, 33, 83, -85, -35, 15, 65, -103, -53, -3, 47, 97, -71, -21, 29, 79, -89, -39, 11, 61, -107, -57, -7, 43, 93, -75, -25],
[-57, -5, 47, 99, -67, -15, 37, 89, -77, -25, 27, 79, -87, -35, 17, 69, -97, -45, 7, 59, -107, -55, -3, 49, 101, -65, -13, 39, 91, -75, -23, 29, 81, -85, -33, 19, 71, -95, -43, 9, 61, -105, -53, -1, 51, 103, -63, -11, 41, 93, -73, -21, 31, 83],
[-55, -1, 53, 107, -57, -3, 51, 105, -59, -5, 49, 103, -61, -7, 47, 101, -63, -9, 45, 99, -65, -11, 43, 97, -67, -13, 41, 95, -69, -15, 39, 93, -71, -17, 37, 91, -73, -19, 35, 89, -75, -21, 33, 87, -77, -23, 31, 85, -79, -25, 29, 83, -81, -27],
[-53, 3, 59, -103, -47, 9, 65, -97, -41, 15, 71, -91, -35, 21, 77, -85, -29, 27, 83, -79, -23, 33, 89, -73, -17, 39, 95, -67, -11, 45, 101, -61, -5, 51, 107, -55, 1, 57, -105, -49, 7, 63, -99, -43, 13, 69, -93, -37, 19, 75, -87, -31, 25, 81],
[-51, 7, 65, -95, -37, 21, 79, -81, -23, 35, 93, -67, -9, 49, 107, -53, 5, 63, -97, -39, 19, 77, -83, -25, 33, 91, -69, -11, 47, 105, -55, 3, 61, -99, -41, 17, 75, -85, -27, 31, 89, -71, -13, 45, 103, -57, 1, 59, -101, -43, 15, 73, -87, -29],
[-49, 11, 71, -87, -27, 33, 93, -65, -5, 55, -103, -43, 17, 77, -81, -21, 39, 99, -59, 1, 61, -97, -37, 23, 83, -75, -15, 45, 105, -53, 7, 67, -91, -31, 29, 89, -69, -9, 51, -107, -47, 13, 73, -85, -25, 35, 95, -63, -3, 57, -101, -41, 19, 79],
[-47, 15, 77, -79, -17, 45, 107, -49, 13, 75, -81, -19, 43, 105, -51, 11, 73, -83, -21, 41, 103, -53, 9, 71, -85, -23, 39, 101, -55, 7, 69, -87, -25, 37, 99, -57, 5, 67, -89, -27, 35, 97, -59, 3, 65, -91, -29, 33, 95, -61, 1, 63, -93, -31],
[-45, 19, 83, -71, -7, 57, -97, -33, 31, 95, -59, 5, 69, -85, -21, 43, 107, -47, 17, 81, -73, -9, 55, -99, -35, 29, 93, -61, 3, 67, -87, -23, 41, 105, -49, 15, 79, -75, -11, 53, -101, -37, 27, 91, -63, 1, 65, -89, -25, 39, 103, -51, 13, 77],
[-43, 23, 89, -63, 3, 69, -83, -17, 49, -103, -37, 29, 95, -57, 9, 75, -77, -11, 55, -97, -31, 35, 101, -51, 15, 81, -71, -5, 61, -91, -25, 41, 107, -45, 21, 87, -65, 1, 67, -85, -19, 47, -105, -39, 27, 93, -59, 7, 73, -79, -13, 53, -99, -33],
[-41, 27, 95, -55, 13, 81, -69, -1, 67, -83, -15, 53, -97, -29, 39, 107, -43, 25, 93, -57, 11, 79, -71, -3, 65, -85, -17, 51, -99, -31, 37, 105, -45, 23, 91, -59, 9, 77, -73, -5, 63, -87, -19, 49, -101, -33, 35, 103, -47, 21, 89, -61, 7, 75],
[-39, 31, 101, -47, 23, 93, -55, 15, 85, -63, 7, 77, -71, -1, 69, -79, -9, 61, -87, -17, 53, -95, -25, 45, -103, -33, 37, 107, -41, 29, 99, -49, 21, 91, -57, 13, 83, -65, 5, 75, -73, -3, 67, -81, -11, 59, -89, -19, 51, -97, -27, 43, -105, -35],
[-37, 35, 107, -39, 33, 105, -41, 31, 103, -43, 29, 101, -45, 27, 99, -47, 25, 97, -49, 23, 95, -51, 21, 93, -53, 19, 91, -55, 17, 89, -57, 15, 87, -59, 13, 85, -61, 11, 83, -63, 9, 81, -65, 7, 79, -67, 5, 77, -69, 3, 75, -71, 1, 73],
[-35, 39, -105, -31, 43, -101, -27, 47, -97, -23, 51, -93, -19, 55, -89, -15, 59, -85, -11, 63, -81, -7, 67, -77, -3, 71, -73, 1, 75, -69, 5, 79, -65, 9, 83, -61, 13, 87, -57, 17, 91, -53, 21, 95, -49, 25, 99, -45, 29, 103, -41, 33, 107, -37],
[-33, 43, -99, -23, 53, -89, -13, 63, -79, -3, 73, -69, 7, 83, -59, 17, 93, -49, 27, 103, -39, 37, -105, -29, 47, -95, -19, 57, -85, -9, 67, -75, 1, 77, -65, 11, 87, -55, 21, 97, -45, 31, 107, -35, 41, -101, -25, 51, -91, -15, 61, -81, -5, 71],
[-31, 47, -93, -15, 63, -77, 1, 79, -61, 17, 95, -45, 33, -107, -29, 49, -91, -13, 65, -75, 3, 81, -59, 19, 97, -43, 35, -105, -27, 51, -89, -11, 67, -73, 5, 83, -57, 21, 99, -41, 37, -103, -25, 53, -87, -9, 69, -71, 7, 85, -55, 23, 101, -39],
[-29, 51, -87, -7, 73, -65, 15, 95, -43, 37, -101, -21, 59, -79, 1, 81, -57, 23, 103, -35, 45, -93, -13, 67, -71, 9, 89, -49, 31, -107, -27, 53, -85, -5, 75, -63, 17, 97, -41, 39, -99, -19, 61, -77, 3, 83, -55, 25, 105, -33, 47, -91, -11, 69],
[-27, 55, -81, 1, 83, -53, 29, -107, -25, 57, -79, 3, 85, -51, 31, -105, -23, 59, -77, 5, 87, -49, 33, -103, -21, 61, -75, 7, 89, -47, 35, -101, -19, 63, -73, 9, 91, -45, 37, -99, -17, 65, -71, 11, 93, -43, 39, -97, -15, 67, -69, 13, 95, -41],
[-25, 59, -75, 9, 93, -41, 43, -91, -7, 77, -57, 27, -107, -23, 61, -73, 11, 95, -39, 45, -89, -5, 79, -55, 29, -105, -21, 63, -71, 13, 97, -37, 47, -87, -3, 81, -53, 31, -103, -19, 65, -69, 15, 99, -35, 49, -85, -1, 83, -51, 33, -101, -17, 67],
[-23, 63, -69, 17, 103, -29, 57, -75, 11, 97, -35, 51, -81, 5, 91, -41, 45, -87, -1, 85, -47, 39, -93, -7, 79, -53, 33, -99, -13, 73, -59, 27, -105, -19, 67, -65, 21, 107, -25, 61, -71, 15, 101, -31, 55, -77, 9, 95, -37, 49, -83, 3, 89, -43],
[-21, 67, -63, 25, -105, -17, 71, -59, 29, -101, -13, 75, -55, 33, -97, -9, 79, -51, 37, -93, -5, 83, -47, 41, -89, -1, 87, -43, 45, -85, 3, 91, -39, 49, -81, 7, 95, -35, 53, -77, 11, 99, -31, 57, -73, 15, 103, -27, 61, -69, 19, 107, -23, 65],
[-19, 71, -57, 33, -95, -5, 85, -43, 47, -81, 9, 99, -29, 61, -67, 23, -105, -15, 75, -53, 37, -91, -1, 89, -39, 51, -77, 13, 103, -25, 65, -63, 27, -101, -11, 79, -49, 41, -87, 3, 93, -35, 55, -73, 17, 107, -21, 69, -59, 31, -97, -7, 83, -45],
[-17, 75, -51, 41, -85, 7, 99, -27, 65, -61, 31, -95, -3, 89, -37, 55, -71, 21, -105, -13, 79, -47, 45, -81, 11, 103, -23, 69, -57, 35, -91, 1, 93, -33, 59, -67, 25, -101, -9, 83, -43, 49, -77, 15, 107, -19, 73, -53, 39, -87, 5, 97, -29, 63],
[-15, 79, -45, 49, -75, 19, -105, -11, 83, -41, 53, -71, 23, -101, -7, 87, -37, 57, -67, 27, -97, -3, 91, -33, 61, -63, 31, -93, 1, 95, -29, 65, -59, 35, -89, 5, 99, -25, 69, -55, 39, -85, 9, 103, -21, 73, -51, 43, -81, 13, 107, -17, 77, -47],
[-13, 83, -39, 57, -65, 31, -91, 5, 101, -21, 75, -47, 49, -73, 23, -99, -3, 93, -29, 67, -55, 41, -81, 15, -107, -11, 85, -37, 59, -63, 33, -89, 7, 103, -19, 77, -45, 51, -71, 25, -97, -1, 95, -27, 69, -53, 43, -79, 17, -105, -9, 87, -35, 61],
[-11, 87, -33, 65, -55, 43, -77, 21, -99, -1, 97, -23, 75, -45, 53, -67, 31, -89, 9, 107, -13, 85, -35, 63, -57, 41, -79, 19, -101, -3, 95, -25, 73, -47, 51, -69, 29, -91, 7, 105, -15, 83, -37, 61, -59, 39, -81, 17, -103, -5, 93, -27, 71, -49],
[-9, 91, -27, 73, -45, 55, -63, 37, -81, 19, -99, 1, 101, -17, 83, -35, 65, -53, 47, -71, 29, -89, 11, -107, -7, 93, -25, 75, -43, 57, -61, 39, -79, 21, -97, 3, 103, -15, 85, -33, 67, -51, 49, -69, 31, -87, 13, -105, -5, 95, -23, 77, -41, 59],
[-7, 95, -21, 81, -35, 67, -49, 53, -63, 39, -77, 25, -91, 11, -105, -3, 99, -17, 85, -31, 71, -45, 57, -59, 43, -73, 29, -87, 15, -101, 1, 103, -13, 89, -27, 75, -41, 61, -55, 47, -69, 33, -83, 19, -97, 5, 107, -9, 93, -23, 79, -37, 65, -51],
[-5, 99, -15, 89, -25, 79, -35, 69, -45, 59, -55, 49, -65, 39, -75, 29, -85, 19, -95, 9, -105, -1, 103, -11, 93, -21, 83, -31, 73, -41, 63, -51, 53, -61, 43, -71, 33, -81, 23, -91, 13, -101, 3, 107, -7, 97, -17, 87, -27, 77, -37, 67, -47, 57],
[-3, 103, -9, 97, -15, 91, -21, 85, -27, 79, -33, 73, -39, 67, -45, 61, -51, 55, -57, 49, -63, 43, -69, 37, -75, 31, -81, 25, -87, 19, -93, 13, -99, 7, -105, 1, 107, -5, 101, -11, 95, -17, 89, -23, 83, -29, 77, -35, 71, -41, 65, -47, 59, -53],
[-1, 107, -3, 105, -5, 103, -7, 101, -9, 99, -11, 97, -13, 95, -15, 93, -17, 91, -19, 89, -21, 87, -23, 85, -25, 83, -27, 81, -29, 79, -31, 77, -33, 75, -35, 73, -37, 71, -39, 69, -41, 67, -43, 65, -45, 63, -47, 61, -49, 59, -51, 57, -53, 55]]
def B : List (List Int) := [
[-1977794161343, 7739597309903, -3842122086659, -20458627459595, -3509362995412, 2946533821118, -12528643830589, 2299231461631, -16045046036670, -19577683273972, -9806675619092, -5530907931559, -16538522011784, -3310597712924, -18093307654238, -7959401037207, -17359899261340, -18231571642677, -26116635853034, -918191631749, -17820994156405, -27997118286408, -29688288361229, -10042079286510, -286 -- (+486 chars; full line in the Zenodo source)
[7739597309903, -20458627459595, 2946533821118, 2299231461631, -19577683273972, -5530907931559, -3310597712924, -7959401037207, -18231571642677, -918191631749, -27997118286408, -10042079286510, -5195940056260, -24901998179590, -5207378140973, -12367978153606, -15883630535606, 2812940613575, -4519141594979, -14330403474187, 703748613323, 6619224113309, -4464201201625, 2956433821464, 9653796264675 -- (+459 chars; full line in the Zenodo source)
[-3842122086659, 2946533821118, -16045046036670, -5530907931559, -18093307654238, -18231571642677, -17820994156405, -10042079286510, -15375178282337, -5207378140973, -31067258092912, 2812940613575, -23011221403192, 703748613323, -6098811776881, 2956433821464, -7600803871185, 6762223370309, 3381679912289, 17020017335069, 4464201201625, 33190879449429, 14330403474187, 23094010836028, 1588363053560 -- (+468 chars; full line in the Zenodo source)
[-20458627459595, 2299231461631, -5530907931559, -7959401037207, -918191631749, -10042079286510, -24901998179590, -12367978153606, 2812940613575, -14330403474187, 6619224113309, 2956433821464, -3381679912289, 19503526771606, 17020017335069, 6098811776881, 19487070336729, 23094010836028, 31067258092912, 28835549198066, 28630374208477, 17820994156405, 17359899261340, 16538522011784, 16045046036670 -- (+468 chars; full line in the Zenodo source)
[-3509362995412, -19577683273972, -18093307654238, -918191631749, -28630374208477, -5207378140973, -20815969236645, -14330403474187, -6098811776881, 9653796264675, -6762223370309, 17020017335069, -6619224113309, 23011221403192, 15883630535606, 28835549198066, 10042079286510, 26116635853034, 3310597712924, 16045046036670, 20458627459595, -1977794161343, 2946533821118, -9806675619092, -79594010372 -- (+472 chars; full line in the Zenodo source)
[2946533821118, -5530907931559, -18231571642677, -10042079286510, -5207378140973, 2812940613575, 703748613323, 2956433821464, 6762223370309, 17020017335069, 33190879449429, 23094010836028, 25517979198586, 28630374208477, 26116635853034, 16538522011784, 12528643830589, 1977794161343, -3509362995412, -9806675619092, -17359899261340, -29688288361229, -28835549198066, -20815969236645, -1948707033672 -- (+467 chars; full line in the Zenodo source)
[-12528643830589, -3310597712924, -17820994156405, -24901998179590, -20815969236645, 703748613323, -17020017335069, 19503526771606, 4464201201625, 23011221403192, 12367978153606, 28630374208477, 18231571642677, 9806675619092, 20458627459595, -3842122086659, -19577683273972, -17359899261340, -10042079286510, -25517979198586, -4519141594979, -6098811776881, -3381679912289, -9653796264675, 33190879 -- (+470 chars; full line in the Zenodo source)
[2299231461631, -7959401037207, -10042079286510, -12367978153606, -14330403474187, 2956433821464, 19503526771606, 6098811776881, 23094010836028, 28835549198066, 17820994156405, 16538522011784, 3509362995412, -3842122086659, -9806675619092, -26116635853034, -15375178282337, -20815969236645, -33190879449429, -7600803871185, -9653796264675, -703748613323, 15883630535606, 5195940056260, 182315716426 -- (+469 chars; full line in the Zenodo source)
[-16045046036670, -18231571642677, -15375178282337, 2812940613575, -6098811776881, 6762223370309, 4464201201625, 23094010836028, 24901998179590, 26116635853034, 19577683273972, 1977794161343, 2299231461631, -17359899261340, -5195940056260, -20815969236645, 6619224113309, -19503526771606, 12778458342290, 4519141594979, 28835549198066, 918191631749, 9806675619092, -7739597309903, -12528643830589, -- (+466 chars; full line in the Zenodo source)
[-19577683273972, -918191631749, -5207378140973, -14330403474187, 9653796264675, 17020017335069, 23011221403192, 28835549198066, 26116635853034, 16045046036670, -1977794161343, -9806675619092, -17820994156405, -25517979198586, -19487070336729, -7600803871185, -2956433821464, 4519141594979, 24901998179590, 18231571642677, -2299231461631, 7739597309903, -5530907931559, -27997118286408, -1236797815 -- (+469 chars; full line in the Zenodo source)
[-9806675619092, -27997118286408, -31067258092912, 6619224113309, -6762223370309, 33190879449429, 12367978153606, 17820994156405, 19577683273972, -1977794161343, -5530907931559, -29688288361229, -15883630535606, -6098811776881, 19503526771606, -703748613323, 25517979198586, 918191631749, 16045046036670, 7739597309903, -16538522011784, -10042079286510, -20815969236645, -4464201201625, 33816799122 -- (+471 chars; full line in the Zenodo source)
[-5530907931559, -10042079286510, 2812940613575, 2956433821464, 17020017335069, 23094010836028, 28630374208477, 16538522011784, 1977794161343, -9806675619092, -29688288361229, -20815969236645, -12778458342290, -9653796264675, 4519141594979, 5195940056260, 3310597712924, -7739597309903, -19577683273972, -27997118286408, -15883630535606, -4464201201625, 7600803871185, 23011221403192, 1537517828233 -- (+466 chars; full line in the Zenodo source)
[-16538522011784, -5195940056260, -23011221403192, -3381679912289, -6619224113309, 25517979198586, 18231571642677, 3509362995412, 2299231461631, -17820994156405, -15883630535606, -12778458342290, 17020017335069, -2812940613575, 29688288361229, 19577683273972, -3842122086659, -7959401037207, -28835549198066, 703748613323, -6762223370309, 19487070336729, 24901998179590, 18093307654238, -7739597309 -- (+469 chars; full line in the Zenodo source)
[-3310597712924, -24901998179590, 703748613323, 19503526771606, 23011221403192, 28630374208477, 9806675619092, -3842122086659, -17359899261340, -25517979198586, -6098811776881, -9653796264675, -2812940613575, 27997118286408, -2299231461631, 2946533821118, -918191631749, -15883630535606, 2956433821464, 12778458342290, 31067258092912, 26116635853034, 3509362995412, -16045046036670, -29688288361229 -- (+469 chars; full line in the Zenodo source)
[-18093307654238, -5207378140973, -6098811776881, 17020017335069, 15883630535606, 26116635853034, 20458627459595, -9806675619092, -5195940056260, -19487070336729, 19503526771606, 4519141594979, 29688288361229, -2299231461631, -12528643830589, -27997118286408, -23094010836028, -3381679912289, -703748613323, 15375178282337, 5530907931559, -3842122086659, -18231571642677, -31067258092912, 295643382 -- (+468 chars; full line in the Zenodo source)
[-7959401037207, -12367978153606, 2956433821464, 6098811776881, 28835549198066, 16538522011784, -3842122086659, -26116635853034, -20815969236645, -7600803871185, -703748613323, 5195940056260, 19577683273972, 2946533821118, -27997118286408, -4519141594979, 6762223370309, 23011221403192, 29688288361229, 12528643830589, -16045046036670, -28630374208477, -19487070336729, 3381679912289, -281294061357 -- (+466 chars; full line in the Zenodo source)
[-17359899261340, -15883630535606, -7600803871185, 19487070336729, 10042079286510, 12528643830589, -19577683273972, -15375178282337, 6619224113309, -2956433821464, 25517979198586, 3310597712924, -3842122086659, -918191631749, -23094010836028, 6762223370309, 4519141594979, 17820994156405, 20458627459595, -16538522011784, -5207378140973, -12778458342290, 6098811776881, 24901998179590, 980667561909 -- (+467 chars; full line in the Zenodo source)
[-18231571642677, 2812940613575, 6762223370309, 23094010836028, 26116635853034, 1977794161343, -17359899261340, -20815969236645, -19503526771606, 4519141594979, 918191631749, -7739597309903, -7959401037207, -15883630535606, -3381679912289, 23011221403192, 17820994156405, 3842122086659, -18093307654238, -31067258092912, -7600803871185, 14330403474187, 27997118286408, 20458627459595, -331059771292 -- (+469 chars; full line in the Zenodo source)
[-26116635853034, -4519141594979, 3381679912289, 31067258092912, 3310597712924, -3509362995412, -10042079286510, -33190879449429, 12778458342290, 24901998179590, 16045046036670, -19577683273972, -28835549198066, 2956433821464, -703748613323, 29688288361229, 20458627459595, -18093307654238, -15883630535606, -19503526771606, 23094010836028, 18231571642677, -1977794161343, -918191631749, -230112214 -- (+469 chars; full line in the Zenodo source)
[-918191631749, -14330403474187, 17020017335069, 28835549198066, 16045046036670, -9806675619092, -25517979198586, -7600803871185, 4519141594979, 18231571642677, 7739597309903, -27997118286408, 703748613323, 12778458342290, 15375178282337, 12528643830589, -16538522011784, -31067258092912, -19503526771606, -2812940613575, 7959401037207, -20458627459595, -10042079286510, 6619224113309, 609881177688 -- (+464 chars; full line in the Zenodo source)
[-17820994156405, 703748613323, 4464201201625, 28630374208477, 20458627459595, -17359899261340, -4519141594979, -9653796264675, 28835549198066, -2299231461631, -16538522011784, -15883630535606, -6762223370309, 31067258092912, 5530907931559, -16045046036670, -5207378140973, -7600803871185, 23094010836028, 7959401037207, -3509362995412, -5195940056260, -12778458342290, 19487070336729, 918191631749 -- (+468 chars; full line in the Zenodo source)
[-27997118286408, 6619224113309, 33190879449429, 17820994156405, -1977794161343, -29688288361229, -6098811776881, -703748613323, 918191631749, 7739597309903, -10042079286510, -4464201201625, 19487070336729, 26116635853034, -3842122086659, -28630374208477, -12778458342290, 14330403474187, 18231571642677, -20458627459595, -5195940056260, 2956433821464, 23011221403192, 17359899261340, -350936299541 -- (+468 chars; full line in the Zenodo source)
[-29688288361229, -4464201201625, 14330403474187, 17359899261340, 2946533821118, -28835549198066, -3381679912289, 15883630535606, 9806675619092, -5530907931559, -20815969236645, 7600803871185, 24901998179590, 3509362995412, -18231571642677, -19487070336729, 6098811776881, 27997118286408, -1977794161343, -10042079286510, -12778458342290, 23011221403192, 7959401037207, -12528643830589, -5207378140 -- (+465 chars; full line in the Zenodo source)
[-10042079286510, 2956433821464, 23094010836028, 16538522011784, -9806675619092, -20815969236645, -9653796264675, 5195940056260, -7739597309903, -27997118286408, -4464201201625, 23011221403192, 18093307654238, -16045046036670, -31067258092912, 3381679912289, 24901998179590, 20458627459595, -918191631749, 6619224113309, 19487070336729, 17359899261340, -12528643830589, -25517979198586, -6762223370 -- (+471 chars; full line in the Zenodo source)
[-28630374208477, 9653796264675, 15883630535606, 16045046036670, -7959401037207, -19487070336729, 33190879449429, 18231571642677, -12528643830589, -12367978153606, 3381679912289, 15375178282337, -7739597309903, -29688288361229, 2956433821464, -2812940613575, 9806675619092, -3310597712924, -23011221403192, 6098811776881, 918191631749, -3509362995412, -5207378140973, -6762223370309, 28835549198066 -- (+470 chars; full line in the Zenodo source)
[-5195940056260, -3381679912289, 25517979198586, 3509362995412, -17820994156405, -12778458342290, -2812940613575, 19577683273972, -7959401037207, 703748613323, 19487070336729, 18093307654238, -9806675619092, -23094010836028, 4464201201625, 918191631749, 2946533821118, -12367978153606, 7600803871185, 28630374208477, -1977794161343, -15375178282337, -19503526771606, 5207378140973, 20458627459595, -- (+466 chars; full line in the Zenodo source)
[-15375178282337, 6762223370309, 24901998179590, 1977794161343, -5195940056260, -19503526771606, 28835549198066, -7739597309903, -28630374208477, -3381679912289, 5207378140973, 3842122086659, -10042079286510, -7600803871185, 25517979198586, 20458627459595, -29688288361229, 9653796264675, 12367978153606, 3509362995412, -27997118286408, -17020017335069, 31067258092912, -2946533821118, -17820994156 -- (+468 chars; full line in the Zenodo source)
[-24901998179590, 19503526771606, 28630374208477, -3842122086659, -25517979198586, -9653796264675, 27997118286408, 2946533821118, -15883630535606, 12778458342290, 26116635853034, -16045046036670, -23094010836028, -6619224113309, 7959401037207, -5530907931559, -14330403474187, 19487070336729, 16538522011784, -18093307654238, -33190879449429, 4519141594979, 19577683273972, -18231571642677, -446420 -- (+468 chars; full line in the Zenodo source)
[-28835549198066, 7600803871185, 27997118286408, -12528643830589, 2812940613575, -6619224113309, 18093307654238, -3310597712924, -33190879449429, 23094010836028, -2299231461631, -17820994156405, 9653796264675, 5207378140973, 1977794161343, -24901998179590, 3381679912289, 29688288361229, 2946533821118, -20815969236645, 6098811776881, 7959401037207, -16538522011784, 703748613323, 4519141594979, 16 -- (+466 chars; full line in the Zenodo source)
[-5207378140973, 17020017335069, 26116635853034, -9806675619092, -19487070336729, 4519141594979, -2299231461631, -27997118286408, -3381679912289, 15375178282337, -3842122086659, -31067258092912, 4464201201625, 7959401037207, -3310597712924, 6619224113309, 20815969236645, 3509362995412, -28630374208477, -6762223370309, 10042079286510, 2946533821118, 2812940613575, 33190879449429, 16538522011784, -- (+467 chars; full line in the Zenodo source)
[-25517979198586, 12778458342290, 7959401037207, -18093307654238, -4464201201625, 12367978153606, 1977794161343, -5207378140973, -2956433821464, 17359899261340, -3310597712924, -6098811776881, 31067258092912, -7739597309903, -28835549198066, 17020017335069, 18231571642677, -16538522011784, 6619224113309, 15883630535606, 3842122086659, -24901998179590, -9653796264675, 26116635853034, -55309079315 -- (+468 chars; full line in the Zenodo source)
[-12367978153606, 6098811776881, 16538522011784, -26116635853034, -7600803871185, 5195940056260, 2946533821118, -4519141594979, 23011221403192, 12528643830589, -28630374208477, 3381679912289, 918191631749, -5530907931559, 6619224113309, 31067258092912, 1977794161343, -25517979198586, 4464201201625, 3310597712924, -18231571642677, 9653796264675, 15375178282337, -3509362995412, -23094010836028, 14 -- (+465 chars; full line in the Zenodo source)
[-31067258092912, 33190879449429, 19577683273972, -29688288361229, 19503526771606, 918191631749, -16538522011784, -4464201201625, 5207378140973, -3842122086659, 2812940613575, 14330403474187, 12528643830589, -5195940056260, -9653796264675, 17359899261340, -7959401037207, -17020017335069, 15375178282337, 2946533821118, -23011221403192, 23094010836028, 20458627459595, -28835549198066, 127784583422 -- (+467 chars; full line in the Zenodo source)
[-15883630535606, 19487070336729, 12528643830589, -15375178282337, -2956433821464, 3310597712924, -918191631749, 6762223370309, 17820994156405, -16538522011784, -12778458342290, 24901998179590, 2946533821118, -14330403474187, 20815969236645, 1977794161343, -31067258092912, -703748613323, -2299231461631, -5195940056260, 17020017335069, 18093307654238, -26116635853034, -19503526771606, 27997118286 -- (+472 chars; full line in the Zenodo source)
[-20815969236645, 23011221403192, 20458627459595, -25517979198586, 33190879449429, -2299231461631, -15375178282337, 12778458342290, 5530907931559, -29688288361229, 7600803871185, 7959401037207, -26116635853034, 6762223370309, 918191631749, -18093307654238, 9653796264675, 10042079286510, -9806675619092, -4464201201625, 24901998179590, -12528643830589, 703748613323, 12367978153606, -3842122086659, -- (+468 chars; full line in the Zenodo source)
[2812940613575, 23094010836028, 1977794161343, -20815969236645, 4519141594979, -7739597309903, -15883630535606, 23011221403192, 3842122086659, -31067258092912, 14330403474187, 20458627459595, -12367978153606, 19487070336729, 3509362995412, -25517979198586, -703748613323, -2946533821118, -5207378140973, 33190879449429, 12528643830589, -28835549198066, -6619224113309, -2299231461631, -249019981795 -- (+466 chars; full line in the Zenodo source)
[-23094010836028, 20815969236645, 7739597309903, -23011221403192, 31067258092912, -20458627459595, -19487070336729, 25517979198586, 2946533821118, -33190879449429, 28835549198066, 2299231461631, -6098811776881, 15375178282337, -19577683273972, -12778458342290, 28630374208477, -5530907931559, -17020017335069, 29688288361229, -3310597712924, -7600803871185, 17820994156405, -7959401037207, -1950352 -- (+469 chars; full line in the Zenodo source)
[-4519141594979, 31067258092912, -3509362995412, -33190879449429, 24901998179590, -19577683273972, 2956433821464, 29688288361229, -18093307654238, -19503526771606, 18231571642677, -918191631749, 7600803871185, 16538522011784, -28630374208477, 4464201201625, -2299231461631, -5207378140973, 19487070336729, 3842122086659, -20815969236645, -2812940613575, 7739597309903, -14330403474187, 255179791985 -- (+470 chars; full line in the Zenodo source)
[-23011221403192, 25517979198586, 2299231461631, -12778458342290, 29688288361229, -7959401037207, -6762223370309, 18093307654238, -10042079286510, 4464201201625, 12528643830589, -12367978153606, 4519141594979, -1977794161343, -14330403474187, 5207378140973, -16045046036670, 2956433821464, 27997118286408, -17359899261340, 19503526771606, 3310597712924, -28630374208477, 6098811776881, -29465338211 -- (+467 chars; full line in the Zenodo source)
[-14330403474187, 28835549198066, -9806675619092, -7600803871185, 18231571642677, -27997118286408, 12778458342290, 12528643830589, -31067258092912, -2812940613575, -20458627459595, 6619224113309, 28630374208477, -18093307654238, -6762223370309, 3310597712924, -5195940056260, 33190879449429, 3842122086659, -23094010836028, 12367978153606, 2299231461631, 2956433821464, 17820994156405, -26116635853 -- (+471 chars; full line in the Zenodo source)
[-19487070336729, 15375178282337, -3310597712924, -6762223370309, 16538522011784, -24901998179590, 14330403474187, -1977794161343, 703748613323, 5195940056260, -18093307654238, 19503526771606, 5530907931559, -28835549198066, 23011221403192, 7739597309903, -33190879449429, 28630374208477, -7959401037207, 3381679912289, 9806675619092, -5207378140973, 4519141594979, -3842122086659, 6619224113309, 1 -- (+469 chars; full line in the Zenodo source)
[703748613323, 28630374208477, -17359899261340, -9653796264675, -2299231461631, -15883630535606, 31067258092912, -16045046036670, -7600803871185, 7959401037207, -5195940056260, 19487070336729, -1977794161343, -33190879449429, 10042079286510, -18231571642677, 17020017335069, 12528643830589, -20815969236645, 12367978153606, -19577683273972, -3381679912289, 18093307654238, -15375178282337, 14330403 -- (+469 chars; full line in the Zenodo source)
[-33190879449429, 29688288361229, -918191631749, 4464201201625, 3842122086659, -14330403474187, 5195940056260, -17359899261340, 17020017335069, -2946533821118, -23094010836028, 28835549198066, -3310597712924, 3381679912289, 16045046036670, -15883630535606, 12367978153606, -9806675619092, 6762223370309, 5530907931559, -25517979198586, 20815969236645, 2299231461631, -7600803871185, 18093307654238, -- (+464 chars; full line in the Zenodo source)
[6619224113309, 17820994156405, -29688288361229, -703748613323, 7739597309903, -4464201201625, 26116635853034, -28630374208477, 14330403474187, -20458627459595, 2956433821464, 17359899261340, -15375178282337, 4519141594979, 2946533821118, 9653796264675, 18093307654238, -28835549198066, -2812940613575, 2299231461631, -3381679912289, 16538522011784, -25517979198586, 15883630535606, -19577683273972 -- (+463 chars; full line in the Zenodo source)
[-6098811776881, 26116635853034, -5195940056260, 4519141594979, -12528643830589, -3381679912289, 5530907931559, -31067258092912, 25517979198586, -3310597712924, -9653796264675, 3509362995412, -14330403474187, 10042079286510, -17820994156405, 33190879449429, 7739597309903, -12778458342290, 17359899261340, -24901998179590, -2812940613575, -16045046036670, 6762223370309, 19577683273972, -2081596923 -- (+468 chars; full line in the Zenodo source)
[-4464201201625, 17359899261340, -28835549198066, 15883630535606, -5530907931559, 7600803871185, 3509362995412, -19487070336729, 27997118286408, -10042079286510, 23011221403192, -12528643830589, -19503526771606, 19577683273972, 2812940613575, 15375178282337, -26116635853034, -6619224113309, 7739597309903, 2956433821464, 18093307654238, -25517979198586, 12367978153606, -3310597712924, 17020017335 -- (+468 chars; full line in the Zenodo source)
[-12778458342290, 18093307654238, -12367978153606, 5207378140973, -17359899261340, 6098811776881, 7739597309903, -17020017335069, 16538522011784, -15883630535606, 24901998179590, -26116635853034, 33190879449429, -20458627459595, -7600803871185, 9806675619092, 2812940613575, 5195940056260, -17820994156405, 19487070336729, 2946533821118, -19503526771606, 16045046036670, -4519141594979, 10042079286 -- (+465 chars; full line in the Zenodo source)
[2956433821464, 16538522011784, -20815969236645, 5195940056260, -27997118286408, 23011221403192, -16045046036670, 3381679912289, 20458627459595, 6619224113309, 17359899261340, -25517979198586, 5207378140973, -18231571642677, 33190879449429, -3509362995412, -19503526771606, -2299231461631, -14330403474187, 17820994156405, -15375178282337, 15883630535606, -3310597712924, 12778458342290, -197779416 -- (+464 chars; full line in the Zenodo source)
[-17020017335069, 9806675619092, -4519141594979, 27997118286408, -15375178282337, 31067258092912, -7959401037207, -6619224113309, -3509362995412, 6762223370309, -2946533821118, -33190879449429, 17359899261340, -12367978153606, 24901998179590, -17820994156405, 23011221403192, -19577683273972, -9653796264675, 1977794161343, 2956433821464, 5530907931559, -23094010836028, 29688288361229, -5195940056 -- (+470 chars; full line in the Zenodo source)
[9653796264675, 16045046036670, -19487070336729, 18231571642677, -12367978153606, 15375178282337, -29688288361229, -2812940613575, -3310597712924, 6098811776881, -3509362995412, -6762223370309, 20458627459595, -4464201201625, 16538522011784, -23094010836028, 27997118286408, -24901998179590, 25517979198586, -26116635853034, 14330403474187, -19577683273972, 17020017335069, -1977794161343, -7600803 -- (+469 chars; full line in the Zenodo source)
[-7600803871185, 12528643830589, 6619224113309, 3310597712924, -23094010836028, 17820994156405, -5207378140973, 24901998179590, -29688288361229, 20815969236645, -7959401037207, -703748613323, -16045046036670, 17020017335069, 7739597309903, -19503526771606, 3509362995412, -4464201201625, 5530907931559, -23011221403192, 26116635853034, -12367978153606, 5195940056260, -28630374208477, 3106725809291 -- (+465 chars; full line in the Zenodo source)
[-3381679912289, 3509362995412, -12778458342290, 19577683273972, 703748613323, 18093307654238, -23094010836028, 918191631749, -12367978153606, 28630374208477, -15375178282337, 5207378140973, -27997118286408, 20815969236645, -17359899261340, 14330403474187, -5530907931559, 6098811776881, -12528643830589, -9653796264675, 7739597309903, 6762223370309, 3842122086659, -17020017335069, -2299231461631, -- (+467 chars; full line in the Zenodo source)
[-19503526771606, 3842122086659, 9653796264675, -2946533821118, -12778458342290, 16045046036670, 6619224113309, 5530907931559, -19487070336729, 18093307654238, -4519141594979, 18231571642677, -20815969236645, 17820994156405, -12367978153606, 10042079286510, -28835549198066, 15375178282337, -5195940056260, 5207378140973, -29688288361229, 31067258092912, -918191631749, -2812940613575, -17359899261 -- (+469 chars; full line in the Zenodo source)
[6762223370309, 1977794161343, -19503526771606, -7739597309903, -3381679912289, 3842122086659, -7600803871185, 20458627459595, 9653796264675, 3509362995412, -17020017335069, -2946533821118, 2956433821464, 12528643830589, -12778458342290, -2299231461631, -4464201201625, 16045046036670, -6098811776881, 19577683273972, 6619224113309, 9806675619092, -33190879449429, 5530907931559, 703748613323, 1653 -- (+465 chars; full line in the Zenodo source)
theorem A_def : A = (rng 1 54).map (fun t => rowA (108 + 1) t (rng 1 54)) := rfl
theorem len : allLen 54 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 54 B A = sid 35269086426685162 54 := rfl
theorem d_ne : (35269086426685162 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 54 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 54) (h0 : mv A g = zeros 54) : g = zeros 54 :=
kernel_zero 54 35269086426685162 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 108 54 = true := rfl
/-- **Balanced ⇒ pairs for p = 109.** A list with entries in (0, 109) that is balanced for 1 ≤ t ≤ 54
has as many copies of x as of 109 − x for every 1 ≤ x ≤ 54 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 109)
(hb : ∀ t, 1 ≤ t → t < 1 + 54 → tsum 109 t c + tsum 109 t c = c.length * 109) :
(rng 1 54).all (fun x => Nat.beq (cnt x c) (cnt (109 - x) c)) = true :=
pairs_of_bal 108 54 35269086426685162 d_ne A B len cert A_def delta c hr hb
end MailletCert109
#print axioms MailletCert109.A_def
#print axioms MailletCert109.len
#print axioms MailletCert109.cert
#print axioms MailletCert109.d_ne
#print axioms MailletCert109.kernel
#print axioms MailletCert109.delta
#print axioms MailletCert109.pairs
lean_all/hodge/MailletCert11.lean
/-
hodge/MailletCert11.lean — T41 (goals G849b, G849c): for p = 11 the 5 × 5 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 5)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 22 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 11) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert11
open MailletLin MailletBridge
def A : List (List Int) := [
[-9, -7, -5, -3, -1],
[-7, -3, 1, 5, 9],
[-5, 1, 7, -9, -3],
[-3, 5, -9, -1, 7],
[-1, 9, -3, 7, -5]]
def B : List (List Int) := [
[-1, -1, -1, 0, -1],
[-1, 0, 1, 1, 1],
[-1, 1, 1, -1, 0],
[0, 1, -1, -1, 1],
[-1, 1, 0, 1, -1]]
theorem A_def : A = (rng 1 5).map (fun t => rowA (10 + 1) t (rng 1 5)) := rfl
theorem len : allLen 5 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 5 B A = sid 22 5 := rfl
theorem d_ne : (22 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 5 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 5) (h0 : mv A g = zeros 5) : g = zeros 5 :=
kernel_zero 5 22 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 10 5 = true := rfl
/-- **Balanced ⇒ pairs for p = 11.** A list with entries in (0, 11) that is balanced for 1 ≤ t ≤ 5
has as many copies of x as of 11 − x for every 1 ≤ x ≤ 5 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 11)
(hb : ∀ t, 1 ≤ t → t < 1 + 5 → tsum 11 t c + tsum 11 t c = c.length * 11) :
(rng 1 5).all (fun x => Nat.beq (cnt x c) (cnt (11 - x) c)) = true :=
pairs_of_bal 10 5 22 d_ne A B len cert A_def delta c hr hb
end MailletCert11
#print axioms MailletCert11.A_def
#print axioms MailletCert11.len
#print axioms MailletCert11.cert
#print axioms MailletCert11.d_ne
#print axioms MailletCert11.kernel
#print axioms MailletCert11.delta
#print axioms MailletCert11.pairs
lean_all/hodge/MailletCert113.lean
/-
hodge/MailletCert113.lean — T41 (goals G849b, G849c): for p = 113 the 56 × 56 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 56)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 91082068077006788 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 113) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert113
open MailletLin MailletBridge
def A : List (List Int) := [
[-111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111],
[-107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109],
[-103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107],
[-99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, 111, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, -105, -91, -77, -63, -49, -35, -21, -7],
[-97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105],
[-95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, -99, -81, -63, -45, -27, -9],
[-93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103],
[-91, -69, -47, -25, -3, 19, 41, 63, 85, 107, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, -99, -77, -55, -33, -11],
[-89, -65, -41, -17, 7, 31, 55, 79, 103, -99, -75, -51, -27, -3, 21, 45, 69, 93, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, -95, -71, -47, -23, 1, 25, 49, 73, 97, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, -91, -67, -43, -19, 5, 29, 53, 77, 101],
[-87, -61, -35, -9, 17, 43, 69, 95, -105, -79, -53, -27, -1, 25, 51, 77, 103, -97, -71, -45, -19, 7, 33, 59, 85, 111, -89, -63, -37, -11, 15, 41, 67, 93, -107, -81, -55, -29, -3, 23, 49, 75, 101, -99, -73, -47, -21, 5, 31, 57, 83, 109, -91, -65, -39, -13],
[-85, -57, -29, -1, 27, 55, 83, 111, -87, -59, -31, -3, 25, 53, 81, 109, -89, -61, -33, -5, 23, 51, 79, 107, -91, -63, -35, -7, 21, 49, 77, 105, -93, -65, -37, -9, 19, 47, 75, 103, -95, -67, -39, -11, 17, 45, 73, 101, -97, -69, -41, -13, 15, 43, 71, 99],
[-83, -53, -23, 7, 37, 67, 97, -99, -69, -39, -9, 21, 51, 81, 111, -85, -55, -25, 5, 35, 65, 95, -101, -71, -41, -11, 19, 49, 79, 109, -87, -57, -27, 3, 33, 63, 93, -103, -73, -43, -13, 17, 47, 77, 107, -89, -59, -29, 1, 31, 61, 91, -105, -75, -45, -15],
[-81, -49, -17, 15, 47, 79, 111, -83, -51, -19, 13, 45, 77, 109, -85, -53, -21, 11, 43, 75, 107, -87, -55, -23, 9, 41, 73, 105, -89, -57, -25, 7, 39, 71, 103, -91, -59, -27, 5, 37, 69, 101, -93, -61, -29, 3, 35, 67, 99, -95, -63, -31, 1, 33, 65, 97],
[-79, -45, -11, 23, 57, 91, -101, -67, -33, 1, 35, 69, 103, -89, -55, -21, 13, 47, 81, -111, -77, -43, -9, 25, 59, 93, -99, -65, -31, 3, 37, 71, 105, -87, -53, -19, 15, 49, 83, -109, -75, -41, -7, 27, 61, 95, -97, -63, -29, 5, 39, 73, 107, -85, -51, -17],
[-77, -41, -5, 31, 67, 103, -87, -51, -15, 21, 57, 93, -97, -61, -25, 11, 47, 83, -107, -71, -35, 1, 37, 73, 109, -81, -45, -9, 27, 63, 99, -91, -55, -19, 17, 53, 89, -101, -65, -29, 7, 43, 79, -111, -75, -39, -3, 33, 69, 105, -85, -49, -13, 23, 59, 95],
[-75, -37, 1, 39, 77, -111, -73, -35, 3, 41, 79, -109, -71, -33, 5, 43, 81, -107, -69, -31, 7, 45, 83, -105, -67, -29, 9, 47, 85, -103, -65, -27, 11, 49, 87, -101, -63, -25, 13, 51, 89, -99, -61, -23, 15, 53, 91, -97, -59, -21, 17, 55, 93, -95, -57, -19],
[-73, -33, 7, 47, 87, -99, -59, -19, 21, 61, 101, -85, -45, -5, 35, 75, -111, -71, -31, 9, 49, 89, -97, -57, -17, 23, 63, 103, -83, -43, -3, 37, 77, -109, -69, -29, 11, 51, 91, -95, -55, -15, 25, 65, 105, -81, -41, -1, 39, 79, -107, -67, -27, 13, 53, 93],
[-71, -29, 13, 55, 97, -87, -45, -3, 39, 81, -103, -61, -19, 23, 65, 107, -77, -35, 7, 49, 91, -93, -51, -9, 33, 75, -109, -67, -25, 17, 59, 101, -83, -41, 1, 43, 85, -99, -57, -15, 27, 69, 111, -73, -31, 11, 53, 95, -89, -47, -5, 37, 79, -105, -63, -21],
[-69, -25, 19, 63, 107, -75, -31, 13, 57, 101, -81, -37, 7, 51, 95, -87, -43, 1, 45, 89, -93, -49, -5, 39, 83, -99, -55, -11, 33, 77, -105, -61, -17, 27, 71, -111, -67, -23, 21, 65, 109, -73, -29, 15, 59, 103, -79, -35, 9, 53, 97, -85, -41, 3, 47, 91],
[-67, -21, 25, 71, -109, -63, -17, 29, 75, -105, -59, -13, 33, 79, -101, -55, -9, 37, 83, -97, -51, -5, 41, 87, -93, -47, -1, 45, 91, -89, -43, 3, 49, 95, -85, -39, 7, 53, 99, -81, -35, 11, 57, 103, -77, -31, 15, 61, 107, -73, -27, 19, 65, 111, -69, -23],
[-65, -17, 31, 79, -99, -51, -3, 45, 93, -85, -37, 11, 59, 107, -71, -23, 25, 73, -105, -57, -9, 39, 87, -91, -43, 5, 53, 101, -77, -29, 19, 67, -111, -63, -15, 33, 81, -97, -49, -1, 47, 95, -83, -35, 13, 61, 109, -69, -21, 27, 75, -103, -55, -7, 41, 89],
[-63, -13, 37, 87, -89, -39, 11, 61, 111, -65, -15, 35, 85, -91, -41, 9, 59, 109, -67, -17, 33, 83, -93, -43, 7, 57, 107, -69, -19, 31, 81, -95, -45, 5, 55, 105, -71, -21, 29, 79, -97, -47, 3, 53, 103, -73, -23, 27, 77, -99, -49, 1, 51, 101, -75, -25],
[-61, -9, 43, 95, -79, -27, 25, 77, -97, -45, 7, 59, 111, -63, -11, 41, 93, -81, -29, 23, 75, -99, -47, 5, 57, 109, -65, -13, 39, 91, -83, -31, 21, 73, -101, -49, 3, 55, 107, -67, -15, 37, 89, -85, -33, 19, 71, -103, -51, 1, 53, 105, -69, -17, 35, 87],
[-59, -5, 49, 103, -69, -15, 39, 93, -79, -25, 29, 83, -89, -35, 19, 73, -99, -45, 9, 63, -109, -55, -1, 53, 107, -65, -11, 43, 97, -75, -21, 33, 87, -85, -31, 23, 77, -95, -41, 13, 67, -105, -51, 3, 57, 111, -61, -7, 47, 101, -71, -17, 37, 91, -81, -27],
[-57, -1, 55, 111, -59, -3, 53, 109, -61, -5, 51, 107, -63, -7, 49, 105, -65, -9, 47, 103, -67, -11, 45, 101, -69, -13, 43, 99, -71, -15, 41, 97, -73, -17, 39, 95, -75, -19, 37, 93, -77, -21, 35, 91, -79, -23, 33, 89, -81, -25, 31, 87, -83, -27, 29, 85],
[-55, 3, 61, -107, -49, 9, 67, -101, -43, 15, 73, -95, -37, 21, 79, -89, -31, 27, 85, -83, -25, 33, 91, -77, -19, 39, 97, -71, -13, 45, 103, -65, -7, 51, 109, -59, -1, 57, -111, -53, 5, 63, -105, -47, 11, 69, -99, -41, 17, 75, -93, -35, 23, 81, -87, -29],
[-53, 7, 67, -99, -39, 21, 81, -85, -25, 35, 95, -71, -11, 49, 109, -57, 3, 63, -103, -43, 17, 77, -89, -29, 31, 91, -75, -15, 45, 105, -61, -1, 59, -107, -47, 13, 73, -93, -33, 27, 87, -79, -19, 41, 101, -65, -5, 55, -111, -51, 9, 69, -97, -37, 23, 83],
[-51, 11, 73, -91, -29, 33, 95, -69, -7, 55, -109, -47, 15, 77, -87, -25, 37, 99, -65, -3, 59, -105, -43, 19, 81, -83, -21, 41, 103, -61, 1, 63, -101, -39, 23, 85, -79, -17, 45, 107, -57, 5, 67, -97, -35, 27, 89, -75, -13, 49, 111, -53, 9, 71, -93, -31],
[-49, 15, 79, -83, -19, 45, 109, -53, 11, 75, -87, -23, 41, 105, -57, 7, 71, -91, -27, 37, 101, -61, 3, 67, -95, -31, 33, 97, -65, -1, 63, -99, -35, 29, 93, -69, -5, 59, -103, -39, 25, 89, -73, -9, 55, -107, -43, 21, 85, -77, -13, 51, -111, -47, 17, 81],
[-47, 19, 85, -75, -9, 57, -103, -37, 29, 95, -65, 1, 67, -93, -27, 39, 105, -55, 11, 77, -83, -17, 49, -111, -45, 21, 87, -73, -7, 59, -101, -35, 31, 97, -63, 3, 69, -91, -25, 41, 107, -53, 13, 79, -81, -15, 51, -109, -43, 23, 89, -71, -5, 61, -99, -33],
[-45, 23, 91, -67, 1, 69, -89, -21, 47, -111, -43, 25, 93, -65, 3, 71, -87, -19, 49, -109, -41, 27, 95, -63, 5, 73, -85, -17, 51, -107, -39, 29, 97, -61, 7, 75, -83, -15, 53, -105, -37, 31, 99, -59, 9, 77, -81, -13, 55, -103, -35, 33, 101, -57, 11, 79],
[-43, 27, 97, -59, 11, 81, -75, -5, 65, -91, -21, 49, -107, -37, 33, 103, -53, 17, 87, -69, 1, 71, -85, -15, 55, -101, -31, 39, 109, -47, 23, 93, -63, 7, 77, -79, -9, 61, -95, -25, 45, -111, -41, 29, 99, -57, 13, 83, -73, -3, 67, -89, -19, 51, -105, -35],
[-41, 31, 103, -51, 21, 93, -61, 11, 83, -71, 1, 73, -81, -9, 63, -91, -19, 53, -101, -29, 43, -111, -39, 33, 105, -49, 23, 95, -59, 13, 85, -69, 3, 75, -79, -7, 65, -89, -17, 55, -99, -27, 45, -109, -37, 35, 107, -47, 25, 97, -57, 15, 87, -67, 5, 77],
[-39, 35, 109, -43, 31, 105, -47, 27, 101, -51, 23, 97, -55, 19, 93, -59, 15, 89, -63, 11, 85, -67, 7, 81, -71, 3, 77, -75, -1, 73, -79, -5, 69, -83, -9, 65, -87, -13, 61, -91, -17, 57, -95, -21, 53, -99, -25, 49, -103, -29, 45, -107, -33, 41, -111, -37],
[-37, 39, -111, -35, 41, -109, -33, 43, -107, -31, 45, -105, -29, 47, -103, -27, 49, -101, -25, 51, -99, -23, 53, -97, -21, 55, -95, -19, 57, -93, -17, 59, -91, -15, 61, -89, -13, 63, -87, -11, 65, -85, -9, 67, -83, -7, 69, -81, -5, 71, -79, -3, 73, -77, -1, 75],
[-35, 43, -105, -27, 51, -97, -19, 59, -89, -11, 67, -81, -3, 75, -73, 5, 83, -65, 13, 91, -57, 21, 99, -49, 29, 107, -41, 37, -111, -33, 45, -103, -25, 53, -95, -17, 61, -87, -9, 69, -79, -1, 77, -71, 7, 85, -63, 15, 93, -55, 23, 101, -47, 31, 109, -39],
[-33, 47, -99, -19, 61, -85, -5, 75, -71, 9, 89, -57, 23, 103, -43, 37, -109, -29, 51, -95, -15, 65, -81, -1, 79, -67, 13, 93, -53, 27, 107, -39, 41, -105, -25, 55, -91, -11, 69, -77, 3, 83, -63, 17, 97, -49, 31, 111, -35, 45, -101, -21, 59, -87, -7, 73],
[-31, 51, -93, -11, 71, -73, 9, 91, -53, 29, 111, -33, 49, -95, -13, 69, -75, 7, 89, -55, 27, 109, -35, 47, -97, -15, 67, -77, 5, 87, -57, 25, 107, -37, 45, -99, -17, 65, -79, 3, 85, -59, 23, 105, -39, 43, -101, -19, 63, -81, 1, 83, -61, 21, 103, -41],
[-29, 55, -87, -3, 81, -61, 23, 107, -35, 49, -93, -9, 75, -67, 17, 101, -41, 43, -99, -15, 69, -73, 11, 95, -47, 37, -105, -21, 63, -79, 5, 89, -53, 31, -111, -27, 57, -85, -1, 83, -59, 25, 109, -33, 51, -91, -7, 77, -65, 19, 103, -39, 45, -97, -13, 71],
[-27, 59, -81, 5, 91, -49, 37, -103, -17, 69, -71, 15, 101, -39, 47, -93, -7, 79, -61, 25, 111, -29, 57, -83, 3, 89, -51, 35, -105, -19, 67, -73, 13, 99, -41, 45, -95, -9, 77, -63, 23, 109, -31, 55, -85, 1, 87, -53, 33, -107, -21, 65, -75, 11, 97, -43],
[-25, 63, -75, 13, 101, -37, 51, -87, 1, 89, -49, 39, -99, -11, 77, -61, 27, -111, -23, 65, -73, 15, 103, -35, 53, -85, 3, 91, -47, 41, -97, -9, 79, -59, 29, -109, -21, 67, -71, 17, 105, -33, 55, -83, 5, 93, -45, 43, -95, -7, 81, -57, 31, -107, -19, 69],
[-23, 67, -69, 21, 111, -25, 65, -71, 19, 109, -27, 63, -73, 17, 107, -29, 61, -75, 15, 105, -31, 59, -77, 13, 103, -33, 57, -79, 11, 101, -35, 55, -81, 9, 99, -37, 53, -83, 7, 97, -39, 51, -85, 5, 95, -41, 49, -87, 3, 93, -43, 47, -89, 1, 91, -45],
[-21, 71, -63, 29, -105, -13, 79, -55, 37, -97, -5, 87, -47, 45, -89, 3, 95, -39, 53, -81, 11, 103, -31, 61, -73, 19, 111, -23, 69, -65, 27, -107, -15, 77, -57, 35, -99, -7, 85, -49, 43, -91, 1, 93, -41, 51, -83, 9, 101, -33, 59, -75, 17, 109, -25, 67],
[-19, 75, -57, 37, -95, -1, 93, -39, 55, -77, 17, 111, -21, 73, -59, 35, -97, -3, 91, -41, 53, -79, 15, 109, -23, 71, -61, 33, -99, -5, 89, -43, 51, -81, 13, 107, -25, 69, -63, 31, -101, -7, 87, -45, 49, -83, 11, 105, -27, 67, -65, 29, -103, -9, 85, -47],
[-17, 79, -51, 45, -85, 11, 107, -23, 73, -57, 39, -91, 5, 101, -29, 67, -63, 33, -97, -1, 95, -35, 61, -69, 27, -103, -7, 89, -41, 55, -75, 21, -109, -13, 83, -47, 49, -81, 15, 111, -19, 77, -53, 43, -87, 9, 105, -25, 71, -59, 37, -93, 3, 99, -31, 65],
[-15, 83, -45, 53, -75, 23, -105, -7, 91, -37, 61, -67, 31, -97, 1, 99, -29, 69, -59, 39, -89, 9, 107, -21, 77, -51, 47, -81, 17, -111, -13, 85, -43, 55, -73, 25, -103, -5, 93, -35, 63, -65, 33, -95, 3, 101, -27, 71, -57, 41, -87, 11, 109, -19, 79, -49],
[-13, 87, -39, 61, -65, 35, -91, 9, 109, -17, 83, -43, 57, -69, 31, -95, 5, 105, -21, 79, -47, 53, -73, 27, -99, 1, 101, -25, 75, -51, 49, -77, 23, -103, -3, 97, -29, 71, -55, 45, -81, 19, -107, -7, 93, -33, 67, -59, 41, -85, 15, -111, -11, 89, -37, 63],
[-11, 91, -33, 69, -55, 47, -77, 25, -99, 3, 105, -19, 83, -41, 61, -63, 39, -85, 17, -107, -5, 97, -27, 75, -49, 53, -71, 31, -93, 9, 111, -13, 89, -35, 67, -57, 45, -79, 23, -101, 1, 103, -21, 81, -43, 59, -65, 37, -87, 15, -109, -7, 95, -29, 73, -51],
[-9, 95, -27, 77, -45, 59, -63, 41, -81, 23, -99, 5, 109, -13, 91, -31, 73, -49, 55, -67, 37, -85, 19, -103, 1, 105, -17, 87, -35, 69, -53, 51, -71, 33, -89, 15, -107, -3, 101, -21, 83, -39, 65, -57, 47, -75, 29, -93, 11, -111, -7, 97, -25, 79, -43, 61],
[-7, 99, -21, 85, -35, 71, -49, 57, -63, 43, -77, 29, -91, 15, -105, 1, 107, -13, 93, -27, 79, -41, 65, -55, 51, -69, 37, -83, 23, -97, 9, -111, -5, 101, -19, 87, -33, 73, -47, 59, -61, 45, -75, 31, -89, 17, -103, 3, 109, -11, 95, -25, 81, -39, 67, -53],
[-5, 103, -15, 93, -25, 83, -35, 73, -45, 63, -55, 53, -65, 43, -75, 33, -85, 23, -95, 13, -105, 3, 111, -7, 101, -17, 91, -27, 81, -37, 71, -47, 61, -57, 51, -67, 41, -77, 31, -87, 21, -97, 11, -107, 1, 109, -9, 99, -19, 89, -29, 79, -39, 69, -49, 59],
[-3, 107, -9, 101, -15, 95, -21, 89, -27, 83, -33, 77, -39, 71, -45, 65, -51, 59, -57, 53, -63, 47, -69, 41, -75, 35, -81, 29, -87, 23, -93, 17, -99, 11, -105, 5, -111, -1, 109, -7, 103, -13, 97, -19, 91, -25, 85, -31, 79, -37, 73, -43, 67, -49, 61, -55],
[-1, 111, -3, 109, -5, 107, -7, 105, -9, 103, -11, 101, -13, 99, -15, 97, -17, 95, -19, 93, -21, 91, -23, 89, -25, 87, -27, 85, -29, 83, -31, 81, -33, 79, -35, 77, -37, 75, -39, 73, -41, 71, -43, 69, -45, 67, -47, 65, -49, 63, -51, 61, -53, 59, -55, 57]]
def B : List (List Int) := [
[-13972260666242, -5462312479377, -11218456889571, 13583759109033, -17036503967696, -7541173554100, -8863512227493, -33820074801551, -22262923234916, -4266858354153, -53286304184209, -5370092211715, -34213549080315, -58530226600676, -50771099749904, -16636078459614, -48609268551001, -24741064437238, -19283878644785, -48995662103032, -45474280745074, -2332483000524, -90405920547418, -242659593166 -- (+539 chars; full line in the Zenodo source)
[-5462312479377, 13583759109033, -7541173554100, -33820074801551, -4266858354153, -5370092211715, -58530226600676, -16636078459614, -24741064437238, -48995662103032, -2332483000524, -24265959316676, -46871727105778, -34272744029353, -22207245238795, -33113098209665, -11688396811307, -36486562736217, -53341419359390, 6332043176448, 15533692845844, -46550279062434, 21169770658623, 12722554598960, -- (+511 chars; full line in the Zenodo source)
[-11218456889571, -7541173554100, -22262923234916, -5370092211715, -50771099749904, -24741064437238, -45474280745074, -24265959316676, -33355476738565, -22207245238795, -46205032791351, -36486562736217, -40919904323290, 15533692845844, -38563612981551, 12722554598960, -41806923662930, 19915560826351, -9973264423790, 51429333488719, 13866175819039, 30662616440125, 46550279062434, 68361923537369, -- (+522 chars; full line in the Zenodo source)
[13583759109033, -33820074801551, -5370092211715, -16636078459614, -48995662103032, -24265959316676, -34272744029353, -33113098209665, -36486562736217, 6332043176448, -46550279062434, 12722554598960, 28110987710847, 9973264423790, 51429333488719, 50433071903540, 38563612981551, 68361923537369, 58894778024787, 46205032791351, 58589535169823, 57759868109533, 45474280745074, 48609268551001, 3421354 -- (+517 chars; full line in the Zenodo source)
[-17036503967696, -4266858354153, -50771099749904, -48995662103032, -57759868109533, -22207245238795, -57076883677964, 6332043176448, -38563612981551, -13866175819039, -19780321397633, 51429333488719, -12722554598960, 61060292605581, 53341419359390, 46205032791351, 34272744029353, 90405920547418, 24741064437238, 34213549080315, 33820074801551, 11218456889571, -5462312479377, -8863512227493, -537 -- (+522 chars; full line in the Zenodo source)
[-7541173554100, -5370092211715, -24741064437238, -24265959316676, -22207245238795, -36486562736217, 15533692845844, 12722554598960, 19915560826351, 51429333488719, 30662616440125, 68361923537369, 57076883677964, 58589535169823, 90405920547418, 48609268551001, 53286304184209, 17036503967696, -13972260666242, -8863512227493, -34213549080315, -19283878644785, -57759868109533, -78756467680829, -588 -- (+520 chars; full line in the Zenodo source)
[-8863512227493, -58530226600676, -45474280745074, -34272744029353, -57076883677964, 15533692845844, -50433071903540, 9973264423790, 13866175819039, 61060292605581, 36486562736217, 58589535169823, 2332483000524, 50771099749904, 33820074801551, 13972260666242, -7541173554100, -34213549080315, -48995662103032, -33355476738565, -11688396811307, -68361923537369, 12722554598960, -19780321397633, 4180 -- (+517 chars; full line in the Zenodo source)
[-33820074801551, -16636078459614, -24265959316676, -33113098209665, 6332043176448, 12722554598960, 9973264423790, 50433071903540, 68361923537369, 46205032791351, 57759868109533, 48609268551001, 22262923234916, 13972260666242, -8863512227493, -50771099749904, -90405920547418, -78756467680829, -40919904323290, -30662616440125, -19780321397633, 13866175819039, -15533692845844, 11688396811307, 4687 -- (+517 chars; full line in the Zenodo source)
[-22262923234916, -24741064437238, -33355476738565, -36486562736217, -38563612981551, 19915560826351, 13866175819039, 68361923537369, 33113098209665, 90405920547418, 58530226600676, 17036503967696, 13583759109033, -34213549080315, -2332483000524, -78756467680829, 6332043176448, -50433071903540, 19780321397633, -21169770658623, 58894778024787, 34272744029353, 19283878644785, 4266858354153, 139722 -- (+519 chars; full line in the Zenodo source)
[-4266858354153, -48995662103032, -22207245238795, 6332043176448, -13866175819039, 51429333488719, 61060292605581, 46205032791351, 90405920547418, 34213549080315, 11218456889571, -8863512227493, -48609268551001, -33355476738565, -58894778024787, -30662616440125, -9973264423790, -21169770658623, 36486562736217, 46871727105778, 16636078459614, 7541173554100, 13583759109033, -58530226600676, -24265 -- (+518 chars; full line in the Zenodo source)
[-53286304184209, -2332483000524, -46205032791351, -46550279062434, -19780321397633, 30662616440125, 36486562736217, 57759868109533, 58530226600676, 11218456889571, -33820074801551, -19283878644785, -22207245238795, -68361923537369, 28110987710847, 13866175819039, 40919904323290, 34272744029353, 48609268551001, 7541173554100, -17036503967696, -16636078459614, -33355476738565, -53341419359390, -5 -- (+521 chars; full line in the Zenodo source)
[-5370092211715, -24265959316676, -36486562736217, 12722554598960, 51429333488719, 68361923537369, 58589535169823, 48609268551001, 17036503967696, -8863512227493, -19283878644785, -78756467680829, -61060292605581, -19780321397633, -21169770658623, 11688396811307, 2332483000524, 4266858354153, -5462312479377, -58530226600676, -46871727105778, -53341419359390, -13866175819039, 41806923662930, 4091 -- (+518 chars; full line in the Zenodo source)
[-34213549080315, -46871727105778, -40919904323290, 28110987710847, -12722554598960, 57076883677964, 2332483000524, 22262923234916, 13583759109033, -48609268551001, -22207245238795, -61060292605581, 9973264423790, 46550279062434, 78756467680829, 24741064437238, 17036503967696, -33820074801551, -45474280745074, -11688396811307, -30662616440125, 51429333488719, -6332043176448, 33355476738565, 5853 -- (+519 chars; full line in the Zenodo source)
[-58530226600676, -34272744029353, 15533692845844, 9973264423790, 61060292605581, 58589535169823, 50771099749904, 13972260666242, -34213549080315, -33355476738565, -68361923537369, -19780321397633, 46550279062434, 22207245238795, 16636078459614, 5462312479377, -5370092211715, -46871727105778, 6332043176448, 19915560826351, 38563612981551, 78756467680829, 48609268551001, 11218456889571, -53286304 -- (+517 chars; full line in the Zenodo source)
[-50771099749904, -22207245238795, -38563612981551, 51429333488719, 53341419359390, 90405920547418, 33820074801551, -8863512227493, -2332483000524, -58894778024787, 28110987710847, -21169770658623, 78756467680829, 16636078459614, 13972260666242, -58530226600676, -58589535169823, -46550279062434, -19915560826351, 40919904323290, 24265959316676, 22262923234916, -7541173554100, -45474280745074, -36 -- (+521 chars; full line in the Zenodo source)
[-16636078459614, -33113098209665, 12722554598960, 50433071903540, 46205032791351, 48609268551001, 13972260666242, -50771099749904, -78756467680829, -30662616440125, 13866175819039, 11688396811307, 24741064437238, 5462312479377, -58530226600676, -22207245238795, 21169770658623, 41806923662930, 57076883677964, 19283878644785, 11218456889571, -34213549080315, -58589535169823, -38563612981551, -281 -- (+517 chars; full line in the Zenodo source)
[-48609268551001, -11688396811307, -41806923662930, 38563612981551, 34272744029353, 53286304184209, -7541173554100, -90405920547418, 6332043176448, -9973264423790, 40919904323290, 2332483000524, 17036503967696, -5370092211715, -58589535169823, 21169770658623, 13866175819039, 46205032791351, 16636078459614, -13972260666242, -24741064437238, -57076883677964, 28110987710847, 46550279062434, 3335547 -- (+518 chars; full line in the Zenodo source)
[-24741064437238, -36486562736217, 19915560826351, 68361923537369, 90405920547418, 17036503967696, -34213549080315, -78756467680829, -50433071903540, -21169770658623, 34272744029353, 4266858354153, -33820074801551, -46871727105778, -46550279062434, 41806923662930, 46205032791351, 50771099749904, -11218456889571, -45474280745074, -40919904323290, -9973264423790, 53341419359390, 48995662103032, 54 -- (+521 chars; full line in the Zenodo source)
[-19283878644785, -53341419359390, -9973264423790, 58894778024787, 24741064437238, -13972260666242, -48995662103032, -40919904323290, 19780321397633, 36486562736217, 48609268551001, -5462312479377, -45474280745074, 6332043176448, -19915560826351, 57076883677964, 16636078459614, -11218456889571, -2332483000524, -68361923537369, 51429333488719, 11688396811307, 50771099749904, 13583759109033, -9040 -- (+520 chars; full line in the Zenodo source)
[-48995662103032, 6332043176448, 51429333488719, 46205032791351, 34213549080315, -8863512227493, -33355476738565, -30662616440125, -21169770658623, 46871727105778, 7541173554100, -58530226600676, -11688396811307, 19915560826351, 40919904323290, 19283878644785, -13972260666242, -45474280745074, -68361923537369, -28110987710847, 33113098209665, 5370092211715, -33820074801551, -34272744029353, 1272 -- (+518 chars; full line in the Zenodo source)
[-45474280745074, 15533692845844, 13866175819039, 58589535169823, 33820074801551, -34213549080315, -11688396811307, -19780321397633, 58894778024787, 16636078459614, -17036503967696, -46871727105778, -30662616440125, 38563612981551, 24265959316676, 11218456889571, -24741064437238, -40919904323290, 51429333488719, 33113098209665, 53286304184209, -4266858354153, -78756467680829, 28110987710847, -63 -- (+518 chars; full line in the Zenodo source)
[-2332483000524, -46550279062434, 30662616440125, 57759868109533, 11218456889571, -19283878644785, -68361923537369, 13866175819039, 34272744029353, 7541173554100, -16636078459614, -53341419359390, 51429333488719, 78756467680829, 22262923234916, -34213549080315, -57076883677964, -9973264423790, 11688396811307, 5370092211715, -4266858354153, -33113098209665, 19915560826351, 58894778024787, 5077109 -- (+517 chars; full line in the Zenodo source)
[-90405920547418, 21169770658623, 46550279062434, 45474280745074, -5462312479377, -57759868109533, 12722554598960, -15533692845844, 19283878644785, 13583759109033, -33355476738565, -13866175819039, -6332043176448, 48609268551001, -7541173554100, -58589535169823, 28110987710847, 53341419359390, 50771099749904, -33820074801551, -78756467680829, 19915560826351, 36486562736217, 34213549080315, -4266 -- (+516 chars; full line in the Zenodo source)
[-24265959316676, 12722554598960, 68361923537369, 48609268551001, -8863512227493, -78756467680829, -19780321397633, 11688396811307, 4266858354153, -58530226600676, -53341419359390, 41806923662930, 33355476738565, 11218456889571, -45474280745074, -38563612981551, 46550279062434, 48995662103032, 13583759109033, -34272744029353, 28110987710847, 58894778024787, 34213549080315, -53286304184209, -5707 -- (+516 chars; full line in the Zenodo source)
[-57759868109533, -13866175819039, 53341419359390, 34213549080315, -5370092211715, -58894778024787, 41806923662930, 46871727105778, 13972260666242, -24265959316676, -50433071903540, 40919904323290, 58530226600676, -53286304184209, -36486562736217, -28110987710847, 33355476738565, 5462312479377, -90405920547418, 12722554598960, -6332043176448, 50771099749904, -4266858354153, -57076883677964, 5142 -- (+521 chars; full line in the Zenodo source)
[-46871727105778, 28110987710847, 57076883677964, 22262923234916, -48609268551001, -61060292605581, 46550279062434, 24741064437238, -33820074801551, -11688396811307, 51429333488719, 33355476738565, 13972260666242, -57759868109533, -41806923662930, 36486562736217, 4266858354153, -16636078459614, 15533692845844, 38563612981551, 19283878644785, -8863512227493, -46205032791351, -19915560826351, 3427 -- (+517 chars; full line in the Zenodo source)
[-33355476738565, 19915560826351, 33113098209665, 17036503967696, -2332483000524, -50433071903540, 58894778024787, 4266858354153, -48609268551001, -46550279062434, -15533692845844, 50771099749904, -5370092211715, -40919904323290, 30662616440125, 48995662103032, -8863512227493, -11688396811307, -28110987710847, 57759868109533, -5462312479377, -58589535169823, 9973264423790, 22207245238795, 112184 -- (+518 chars; full line in the Zenodo source)
[-34272744029353, 9973264423790, 58589535169823, 13972260666242, -33355476738565, -19780321397633, 22207245238795, 5462312479377, -46871727105778, 19915560826351, 78756467680829, 11218456889571, -57759868109533, -51429333488719, 33113098209665, -13583759109033, -24265959316676, 28110987710847, 46205032791351, 17036503967696, -90405920547418, -41806923662930, 11688396811307, 7541173554100, -23324 -- (+517 chars; full line in the Zenodo source)
[-58589535169823, 19780321397633, 46871727105778, -11218456889571, -33113098209665, -28110987710847, 90405920547418, -7541173554100, -57076883677964, 50433071903540, 48995662103032, -22262923234916, -53341419359390, -21169770658623, 48609268551001, -5370092211715, -68361923537369, 61060292605581, 58530226600676, -50771099749904, -46550279062434, -6332043176448, 53286304184209, -24741064437238, - -- (+522 chars; full line in the Zenodo source)
[-22207245238795, 51429333488719, 90405920547418, -8863512227493, -58894778024787, -21169770658623, 16636078459614, -58530226600676, -46550279062434, 40919904323290, 22262923234916, -45474280745074, -41806923662930, 33113098209665, 5462312479377, -34272744029353, 19780321397633, 57759868109533, -17036503967696, -57076883677964, -12722554598960, 24741064437238, -5370092211715, 15533692845844, 683 -- (+519 chars; full line in the Zenodo source)
[-78756467680829, 41806923662930, 48995662103032, -53286304184209, 15533692845844, -6332043176448, 22262923234916, -2332483000524, -51429333488719, 58589535169823, -5462312479377, -46205032791351, 50433071903540, 24741064437238, -34213549080315, -46550279062434, 53341419359390, 8863512227493, -24265959316676, -19780321397633, 33355476738565, 13583759109033, -57076883677964, 30662616440125, 16636 -- (+519 chars; full line in the Zenodo source)
[-33113098209665, 50433071903540, 48609268551001, -50771099749904, -30662616440125, 11688396811307, 5462312479377, -22207245238795, 41806923662930, 19283878644785, -34213549080315, -38563612981551, 36486562736217, -13583759109033, -34272744029353, 51429333488719, 45474280745074, -53286304184209, -61060292605581, 53341419359390, 7541173554100, -46871727105778, 19780321397633, 90405920547418, -222 -- (+521 chars; full line in the Zenodo source)
[-46205032791351, 30662616440125, 58530226600676, -19283878644785, 28110987710847, 34272744029353, -17036503967696, -53341419359390, -15533692845844, 22262923234916, -24265959316676, -9973264423790, 90405920547418, -4266858354153, -61060292605581, 58894778024787, -13583759109033, -58589535169823, 41806923662930, 24741064437238, -50771099749904, 12722554598960, 33113098209665, -13972260666242, -1 -- (+520 chars; full line in the Zenodo source)
[-11688396811307, 38563612981551, 53286304184209, -90405920547418, -9973264423790, 2332483000524, -5370092211715, 21169770658623, 46205032791351, -13972260666242, -57076883677964, 46550279062434, 4266858354153, -24265959316676, 19780321397633, 45474280745074, -34213549080315, -30662616440125, 33113098209665, -5462312479377, -36486562736217, 61060292605581, 22262923234916, -57759868109533, -19915 -- (+520 chars; full line in the Zenodo source)
[-57076883677964, 61060292605581, 33820074801551, -33355476738565, 41806923662930, 16636078459614, -19283878644785, 19915560826351, 24265959316676, -53286304184209, 21169770658623, 33113098209665, -11218456889571, -53341419359390, -6332043176448, 17036503967696, -22207245238795, -12722554598960, 34213549080315, -2332483000524, -9973264423790, 45474280745074, -58530226600676, -50433071903540, 585 -- (+520 chars; full line in the Zenodo source)
[-36486562736217, 68361923537369, 17036503967696, -78756467680829, -21169770658623, 4266858354153, -46871727105778, 41806923662930, 50771099749904, -45474280745074, -9973264423790, 48995662103032, -16636078459614, 28110987710847, 57759868109533, -53286304184209, -30662616440125, 22207245238795, -7541173554100, 15533692845844, 57076883677964, -13972260666242, -58894778024787, -6332043176448, -135 -- (+519 chars; full line in the Zenodo source)
[-58894778024787, 40919904323290, 5462312479377, -57076883677964, 68361923537369, -13583759109033, -46205032791351, 61060292605581, 7541173554100, -78756467680829, 38563612981551, 33820074801551, -58589535169823, 30662616440125, 4266858354153, -33355476738565, 50433071903540, 5370092211715, -57759868109533, 41806923662930, 58530226600676, -90405920547418, 51429333488719, 16636078459614, -4547428 -- (+514 chars; full line in the Zenodo source)
[-53341419359390, 58894778024787, -13972260666242, -40919904323290, 36486562736217, -5462312479377, 6332043176448, 57076883677964, -11218456889571, -68361923537369, 11688396811307, 13583759109033, 15533692845844, 46205032791351, -17036503967696, -61060292605581, 33113098209665, -7541173554100, -46550279062434, 78756467680829, -8863512227493, -38563612981551, 22207245238795, -33820074801551, 2116 -- (+520 chars; full line in the Zenodo source)
[-40919904323290, 57076883677964, 13583759109033, -61060292605581, 78756467680829, -33820074801551, -30662616440125, 33355476738565, -5370092211715, -41806923662930, 90405920547418, -16636078459614, -19780321397633, 19283878644785, -48995662103032, -19915560826351, 50771099749904, -24265959316676, 13866175819039, 53286304184209, -34272744029353, -21169770658623, 8863512227493, -33113098209665, - -- (+518 chars; full line in the Zenodo source)
[6332043176448, 46205032791351, -8863512227493, -30662616440125, 46871727105778, -58530226600676, 19915560826351, 19283878644785, -45474280745074, -28110987710847, 5370092211715, -34272744029353, 38563612981551, 17036503967696, -57076883677964, 53341419359390, -5462312479377, 15533692845844, 78756467680829, -22262923234916, -50433071903540, 24265959316676, -16636078459614, 9973264423790, 4860926 -- (+516 chars; full line in the Zenodo source)
[-68361923537369, 78756467680829, -4266858354153, -41806923662930, 45474280745074, -48995662103032, -28110987710847, 53286304184209, -22207245238795, -15533692845844, 13972260666242, 6332043176448, 33113098209665, -22262923234916, -13866175819039, 2332483000524, -19283878644785, 51429333488719, 5370092211715, -58589535169823, 61060292605581, 5462312479377, -40919904323290, 46205032791351, -33820 -- (+521 chars; full line in the Zenodo source)
[15533692845844, 58589535169823, -34213549080315, -19780321397633, 16636078459614, -46871727105778, 38563612981551, 11218456889571, -40919904323290, 33113098209665, -4266858354153, 28110987710847, 19283878644785, -90405920547418, -12722554598960, 7541173554100, -36486562736217, 57076883677964, -8863512227493, -50433071903540, 2332483000524, -48995662103032, 41806923662930, 22262923234916, -46205 -- (+516 chars; full line in the Zenodo source)
[-61060292605581, 33355476738565, -16636078459614, -19915560826351, 53286304184209, -33113098209665, 53341419359390, -17036503967696, 12722554598960, 2332483000524, -45474280745074, 50433071903540, 7541173554100, -58894778024787, 46205032791351, -4266858354153, -51429333488719, 48609268551001, -46871727105778, 46550279062434, 13972260666242, 15533692845844, 34272744029353, -50771099749904, 19780 -- (+516 chars; full line in the Zenodo source)
[-46550279062434, 57759868109533, -19283878644785, 13866175819039, 7541173554100, -53341419359390, 78756467680829, -34213549080315, -9973264423790, 5370092211715, -33113098209665, 58894778024787, -8863512227493, -41806923662930, 24741064437238, -46871727105778, 61060292605581, -13972260666242, -38563612981551, 24265959316676, -48995662103032, 50433071903540, 17036503967696, -40919904323290, 2220 -- (+521 chars; full line in the Zenodo source)
[-38563612981551, 90405920547418, -2332483000524, -21169770658623, 13972260666242, -46550279062434, 24265959316676, -45474280745074, 30662616440125, 5462312479377, -61060292605581, 57759868109533, -48995662103032, -12722554598960, 11218456889571, 15533692845844, 46871727105778, -19283878644785, 50433071903540, -13583759109033, -68361923537369, 33355476738565, -24741064437238, 13866175819039, 170 -- (+518 chars; full line in the Zenodo source)
[21169770658623, 45474280745074, -57759868109533, -15533692845844, 13583759109033, -13866175819039, 48609268551001, -58589535169823, 53341419359390, -33820074801551, 19915560826351, 34213549080315, -46205032791351, 11688396811307, -5370092211715, 19780321397633, 22262923234916, -58894778024787, 22207245238795, -16636078459614, 41806923662930, 17036503967696, -68361923537369, 46871727105778, -489 -- (+518 chars; full line in the Zenodo source)
[-30662616440125, 19283878644785, -34272744029353, 53341419359390, -22262923234916, 9973264423790, 4266858354153, -58894778024787, 58589535169823, -24741064437238, -12722554598960, 13972260666242, 21169770658623, 48995662103032, -33355476738565, 40919904323290, -33820074801551, -19780321397633, 53286304184209, -36486562736217, 22207245238795, -48609268551001, 50433071903540, 5462312479377, -3856 -- (+520 chars; full line in the Zenodo source)
[12722554598960, 48609268551001, -78756467680829, 11688396811307, -58530226600676, 41806923662930, 11218456889571, -38563612981551, 48995662103032, -34272744029353, 58894778024787, -53286304184209, -19915560826351, 7541173554100, 15533692845844, 90405920547418, -57759868109533, -6332043176448, -33820074801551, 9973264423790, 22262923234916, -40919904323290, 46871727105778, -2332483000524, 610602 -- (+520 chars; full line in the Zenodo source)
[-50433071903540, 50771099749904, -11688396811307, 22207245238795, -19283878644785, 38563612981551, 13583759109033, -51429333488719, 53286304184209, -53341419359390, 46871727105778, -90405920547418, 68361923537369, -33820074801551, -9973264423790, 8863512227493, 15533692845844, 2332483000524, -33355476738565, 58894778024787, -5370092211715, -28110987710847, 11218456889571, 21169770658623, 247410 -- (+519 chars; full line in the Zenodo source)
[-13866175819039, 34213549080315, -58894778024787, 46871727105778, -24265959316676, 40919904323290, -53286304184209, -28110987710847, 5462312479377, 12722554598960, 50771099749904, -57076883677964, 34272744029353, -2332483000524, 68361923537369, -22262923234916, -19915560826351, -13583759109033, 21169770658623, 48609268551001, -46205032791351, 22207245238795, -48995662103032, 61060292605581, -88 -- (+519 chars; full line in the Zenodo source)
[-41806923662930, 53286304184209, 6332043176448, 2332483000524, -58589535169823, 46205032791351, -24741064437238, 46550279062434, -8863512227493, 19780321397633, -13583759109033, -30662616440125, 50771099749904, -36486562736217, 46871727105778, -57759868109533, 58894778024787, -58530226600676, -12722554598960, -11218456889571, 19915560826351, 33820074801551, -61060292605581, 19283878644785, -331 -- (+519 chars; full line in the Zenodo source)
[28110987710847, 22262923234916, -61060292605581, 24741064437238, -11688396811307, 33355476738565, -57759868109533, 36486562736217, -16636078459614, 38563612981551, -8863512227493, -19915560826351, 5462312479377, -13866175819039, 53286304184209, -68361923537369, 48995662103032, -33113098209665, 58589535169823, -90405920547418, 53341419359390, -58530226600676, 30662616440125, -17036503967696, -99 -- (+521 chars; full line in the Zenodo source)
[-51429333488719, 8863512227493, 21169770658623, 58530226600676, -40919904323290, 45474280745074, -33113098209665, 34272744029353, -57759868109533, 57076883677964, -24741064437238, -15533692845844, -53286304184209, 50433071903540, 13583759109033, -9973264423790, 11218456889571, -13866175819039, 4266858354153, -61060292605581, 48609268551001, -36486562736217, 24265959316676, -58589535169823, 7875 -- (+519 chars; full line in the Zenodo source)
[19915560826351, 17036503967696, -50433071903540, 4266858354153, -46550279062434, 50771099749904, -40919904323290, 48995662103032, -11688396811307, 57759868109533, -58589535169823, 22207245238795, -24265959316676, 57076883677964, -19283878644785, -6332043176448, -58530226600676, 38563612981551, -22262923234916, 13866175819039, 13583759109033, 19780321397633, 13972260666242, -51429333488719, 7541 -- (+516 chars; full line in the Zenodo source)
[-19780321397633, 11218456889571, 28110987710847, 7541173554100, -50433071903540, 22262923234916, 21169770658623, 5370092211715, -61060292605581, 50771099749904, 6332043176448, 24741064437238, -58894778024787, 45474280745074, -11688396811307, 24265959316676, -78756467680829, 33355476738565, -34272744029353, 22207245238795, -57759868109533, 46205032791351, -2332483000524, 36486562736217, -1928387 -- (+518 chars; full line in the Zenodo source)
[9973264423790, 13972260666242, -19780321397633, 5462312479377, 19915560826351, 11218456889571, -51429333488719, -13583759109033, 28110987710847, 17036503967696, -41806923662930, 7541173554100, -13866175819039, 8863512227493, -50433071903540, 33820074801551, 12722554598960, 22262923234916, -30662616440125, 4266858354153, 21169770658623, 53286304184209, -38563612981551, 5370092211715, -4655027906 -- (+513 chars; full line in the Zenodo source)
theorem A_def : A = (rng 1 56).map (fun t => rowA (112 + 1) t (rng 1 56)) := rfl
theorem len : allLen 56 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 56 B A = sid 91082068077006788 56 := rfl
theorem d_ne : (91082068077006788 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 56 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 56) (h0 : mv A g = zeros 56) : g = zeros 56 :=
kernel_zero 56 91082068077006788 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 112 56 = true := rfl
/-- **Balanced ⇒ pairs for p = 113.** A list with entries in (0, 113) that is balanced for 1 ≤ t ≤ 56
has as many copies of x as of 113 − x for every 1 ≤ x ≤ 56 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 113)
(hb : ∀ t, 1 ≤ t → t < 1 + 56 → tsum 113 t c + tsum 113 t c = c.length * 113) :
(rng 1 56).all (fun x => Nat.beq (cnt x c) (cnt (113 - x) c)) = true :=
pairs_of_bal 112 56 91082068077006788 d_ne A B len cert A_def delta c hr hb
end MailletCert113
#print axioms MailletCert113.A_def
#print axioms MailletCert113.len
#print axioms MailletCert113.cert
#print axioms MailletCert113.d_ne
#print axioms MailletCert113.kernel
#print axioms MailletCert113.delta
#print axioms MailletCert113.pairs
lean_all/hodge/MailletCert127.lean
/-
hodge/MailletCert127.lean — T41 (goals G849b, G849c): for p = 127 the 63 × 63 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 63)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 661550413311054017530 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 127) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert127
open MailletLin MailletBridge
def A : List (List Int) := [
[-125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125],
[-121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123],
[-117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, 113, 125, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121],
[-113, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, 111, 125, -115, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, 123, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, -125, -109, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, 115, -123, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, 117, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119],
[-109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, -117, -99, -81, -63, -45, -27, -9],
[-107, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, 113, -121, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, 119, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, -109, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91, 111, -123, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, 117],
[-105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, -117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, -121, -99, -77, -55, -33, -11],
[-103, -79, -55, -31, -7, 17, 41, 65, 89, 113, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, -107, -83, -59, -35, -11, 13, 37, 61, 85, 109, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115],
[-101, -75, -49, -23, 3, 29, 55, 81, 107, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, -103, -77, -51, -25, 1, 27, 53, 79, 105, -123, -97, -71, -45, -19, 7, 33, 59, 85, 111, -117, -91, -65, -39, -13],
[-99, -71, -43, -15, 13, 41, 69, 97, 125, -101, -73, -45, -17, 11, 39, 67, 95, 123, -103, -75, -47, -19, 9, 37, 65, 93, 121, -105, -77, -49, -21, 7, 35, 63, 91, 119, -107, -79, -51, -23, 5, 33, 61, 89, 117, -109, -81, -53, -25, 3, 31, 59, 87, 115, -111, -83, -55, -27, 1, 29, 57, 85, 113],
[-97, -67, -37, -7, 23, 53, 83, 113, -111, -81, -51, -21, 9, 39, 69, 99, -125, -95, -65, -35, -5, 25, 55, 85, 115, -109, -79, -49, -19, 11, 41, 71, 101, -123, -93, -63, -33, -3, 27, 57, 87, 117, -107, -77, -47, -17, 13, 43, 73, 103, -121, -91, -61, -31, -1, 29, 59, 89, 119, -105, -75, -45, -15],
[-95, -63, -31, 1, 33, 65, 97, -125, -93, -61, -29, 3, 35, 67, 99, -123, -91, -59, -27, 5, 37, 69, 101, -121, -89, -57, -25, 7, 39, 71, 103, -119, -87, -55, -23, 9, 41, 73, 105, -117, -85, -53, -21, 11, 43, 75, 107, -115, -83, -51, -19, 13, 45, 77, 109, -113, -81, -49, -17, 15, 47, 79, 111],
[-93, -59, -25, 9, 43, 77, 111, -109, -75, -41, -7, 27, 61, 95, -125, -91, -57, -23, 11, 45, 79, 113, -107, -73, -39, -5, 29, 63, 97, -123, -89, -55, -21, 13, 47, 81, 115, -105, -71, -37, -3, 31, 65, 99, -121, -87, -53, -19, 15, 49, 83, 117, -103, -69, -35, -1, 33, 67, 101, -119, -85, -51, -17],
[-91, -55, -19, 17, 53, 89, 125, -93, -57, -21, 15, 51, 87, 123, -95, -59, -23, 13, 49, 85, 121, -97, -61, -25, 11, 47, 83, 119, -99, -63, -27, 9, 45, 81, 117, -101, -65, -29, 7, 43, 79, 115, -103, -67, -31, 5, 41, 77, 113, -105, -69, -33, 3, 39, 75, 111, -107, -71, -35, 1, 37, 73, 109],
[-89, -51, -13, 25, 63, 101, -115, -77, -39, -1, 37, 75, 113, -103, -65, -27, 11, 49, 87, 125, -91, -53, -15, 23, 61, 99, -117, -79, -41, -3, 35, 73, 111, -105, -67, -29, 9, 47, 85, 123, -93, -55, -17, 21, 59, 97, -119, -81, -43, -5, 33, 71, 109, -107, -69, -31, 7, 45, 83, 121, -95, -57, -19],
[-87, -47, -7, 33, 73, 113, -101, -61, -21, 19, 59, 99, -115, -75, -35, 5, 45, 85, 125, -89, -49, -9, 31, 71, 111, -103, -63, -23, 17, 57, 97, -117, -77, -37, 3, 43, 83, 123, -91, -51, -11, 29, 69, 109, -105, -65, -25, 15, 55, 95, -119, -79, -39, 1, 41, 81, 121, -93, -53, -13, 27, 67, 107],
[-85, -43, -1, 41, 83, 125, -87, -45, -3, 39, 81, 123, -89, -47, -5, 37, 79, 121, -91, -49, -7, 35, 77, 119, -93, -51, -9, 33, 75, 117, -95, -53, -11, 31, 73, 115, -97, -55, -13, 29, 71, 113, -99, -57, -15, 27, 69, 111, -101, -59, -17, 25, 67, 109, -103, -61, -19, 23, 65, 107, -105, -63, -21],
[-83, -39, 5, 49, 93, -117, -73, -29, 15, 59, 103, -107, -63, -19, 25, 69, 113, -97, -53, -9, 35, 79, 123, -87, -43, 1, 45, 89, -121, -77, -33, 11, 55, 99, -111, -67, -23, 21, 65, 109, -101, -57, -13, 31, 75, 119, -91, -47, -3, 41, 85, -125, -81, -37, 7, 51, 95, -115, -71, -27, 17, 61, 105],
[-81, -35, 11, 57, 103, -105, -59, -13, 33, 79, 125, -83, -37, 9, 55, 101, -107, -61, -15, 31, 77, 123, -85, -39, 7, 53, 99, -109, -63, -17, 29, 75, 121, -87, -41, 5, 51, 97, -111, -65, -19, 27, 73, 119, -89, -43, 3, 49, 95, -113, -67, -21, 25, 71, 117, -91, -45, 1, 47, 93, -115, -69, -23],
[-79, -31, 17, 65, 113, -93, -45, 3, 51, 99, -107, -59, -11, 37, 85, -121, -73, -25, 23, 71, 119, -87, -39, 9, 57, 105, -101, -53, -5, 43, 91, -115, -67, -19, 29, 77, 125, -81, -33, 15, 63, 111, -95, -47, 1, 49, 97, -109, -61, -13, 35, 83, -123, -75, -27, 21, 69, 117, -89, -41, 7, 55, 103],
[-77, -27, 23, 73, 123, -81, -31, 19, 69, 119, -85, -35, 15, 65, 115, -89, -39, 11, 61, 111, -93, -43, 7, 57, 107, -97, -47, 3, 53, 103, -101, -51, -1, 49, 99, -105, -55, -5, 45, 95, -109, -59, -9, 41, 91, -113, -63, -13, 37, 87, -117, -67, -17, 33, 83, -121, -71, -21, 29, 79, -125, -75, -25],
[-75, -23, 29, 81, -121, -69, -17, 35, 87, -115, -63, -11, 41, 93, -109, -57, -5, 47, 99, -103, -51, 1, 53, 105, -97, -45, 7, 59, 111, -91, -39, 13, 65, 117, -85, -33, 19, 71, 123, -79, -27, 25, 77, -125, -73, -21, 31, 83, -119, -67, -15, 37, 89, -113, -61, -9, 43, 95, -107, -55, -3, 49, 101],
[-73, -19, 35, 89, -111, -57, -3, 51, 105, -95, -41, 13, 67, 121, -79, -25, 29, 83, -117, -63, -9, 45, 99, -101, -47, 7, 61, 115, -85, -31, 23, 77, -123, -69, -15, 39, 93, -107, -53, 1, 55, 109, -91, -37, 17, 71, 125, -75, -21, 33, 87, -113, -59, -5, 49, 103, -97, -43, 11, 65, 119, -81, -27],
[-71, -15, 41, 97, -101, -45, 11, 67, 123, -75, -19, 37, 93, -105, -49, 7, 63, 119, -79, -23, 33, 89, -109, -53, 3, 59, 115, -83, -27, 29, 85, -113, -57, -1, 55, 111, -87, -31, 25, 81, -117, -61, -5, 51, 107, -91, -35, 21, 77, -121, -65, -9, 47, 103, -95, -39, 17, 73, -125, -69, -13, 43, 99],
[-69, -11, 47, 105, -91, -33, 25, 83, -113, -55, 3, 61, 119, -77, -19, 39, 97, -99, -41, 17, 75, -121, -63, -5, 53, 111, -85, -27, 31, 89, -107, -49, 9, 67, 125, -71, -13, 45, 103, -93, -35, 23, 81, -115, -57, 1, 59, 117, -79, -21, 37, 95, -101, -43, 15, 73, -123, -65, -7, 51, 109, -87, -29],
[-67, -7, 53, 113, -81, -21, 39, 99, -95, -35, 25, 85, -109, -49, 11, 71, -123, -63, -3, 57, 117, -77, -17, 43, 103, -91, -31, 29, 89, -105, -45, 15, 75, -119, -59, 1, 61, 121, -73, -13, 47, 107, -87, -27, 33, 93, -101, -41, 19, 79, -115, -55, 5, 65, 125, -69, -9, 51, 111, -83, -23, 37, 97],
[-65, -3, 59, 121, -71, -9, 53, 115, -77, -15, 47, 109, -83, -21, 41, 103, -89, -27, 35, 97, -95, -33, 29, 91, -101, -39, 23, 85, -107, -45, 17, 79, -113, -51, 11, 73, -119, -57, 5, 67, -125, -63, -1, 61, 123, -69, -7, 55, 117, -75, -13, 49, 111, -81, -19, 43, 105, -87, -25, 37, 99, -93, -31],
[-63, 1, 65, -125, -61, 3, 67, -123, -59, 5, 69, -121, -57, 7, 71, -119, -55, 9, 73, -117, -53, 11, 75, -115, -51, 13, 77, -113, -49, 15, 79, -111, -47, 17, 81, -109, -45, 19, 83, -107, -43, 21, 85, -105, -41, 23, 87, -103, -39, 25, 89, -101, -37, 27, 91, -99, -35, 29, 93, -97, -33, 31, 95],
[-61, 5, 71, -117, -51, 15, 81, -107, -41, 25, 91, -97, -31, 35, 101, -87, -21, 45, 111, -77, -11, 55, 121, -67, -1, 65, -123, -57, 9, 75, -113, -47, 19, 85, -103, -37, 29, 95, -93, -27, 39, 105, -83, -17, 49, 115, -73, -7, 59, 125, -63, 3, 69, -119, -53, 13, 79, -109, -43, 23, 89, -99, -33],
[-59, 9, 77, -109, -41, 27, 95, -91, -23, 45, 113, -73, -5, 63, -123, -55, 13, 81, -105, -37, 31, 99, -87, -19, 49, 117, -69, -1, 67, -119, -51, 17, 85, -101, -33, 35, 103, -83, -15, 53, 121, -65, 3, 71, -115, -47, 21, 89, -97, -29, 39, 107, -79, -11, 57, 125, -61, 7, 75, -111, -43, 25, 93],
[-57, 13, 83, -101, -31, 39, 109, -75, -5, 65, -119, -49, 21, 91, -93, -23, 47, 117, -67, 3, 73, -111, -41, 29, 99, -85, -15, 55, 125, -59, 11, 81, -103, -33, 37, 107, -77, -7, 63, -121, -51, 19, 89, -95, -25, 45, 115, -69, 1, 71, -113, -43, 27, 97, -87, -17, 53, 123, -61, 9, 79, -105, -35],
[-55, 17, 89, -93, -21, 51, 123, -59, 13, 85, -97, -25, 47, 119, -63, 9, 81, -101, -29, 43, 115, -67, 5, 77, -105, -33, 39, 111, -71, 1, 73, -109, -37, 35, 107, -75, -3, 69, -113, -41, 31, 103, -79, -7, 65, -117, -45, 27, 99, -83, -11, 61, -121, -49, 23, 95, -87, -15, 57, -125, -53, 19, 91],
[-53, 21, 95, -85, -11, 63, -117, -43, 31, 105, -75, -1, 73, -107, -33, 41, 115, -65, 9, 83, -97, -23, 51, 125, -55, 19, 93, -87, -13, 61, -119, -45, 29, 103, -77, -3, 71, -109, -35, 39, 113, -67, 7, 81, -99, -25, 49, 123, -57, 17, 91, -89, -15, 59, -121, -47, 27, 101, -79, -5, 69, -111, -37],
[-51, 25, 101, -77, -1, 75, -103, -27, 49, 125, -53, 23, 99, -79, -3, 73, -105, -29, 47, 123, -55, 21, 97, -81, -5, 71, -107, -31, 45, 121, -57, 19, 95, -83, -7, 69, -109, -33, 43, 119, -59, 17, 93, -85, -9, 67, -111, -35, 41, 117, -61, 15, 91, -87, -11, 65, -113, -37, 39, 115, -63, 13, 89],
[-49, 29, 107, -69, 9, 87, -89, -11, 67, -109, -31, 47, 125, -51, 27, 105, -71, 7, 85, -91, -13, 65, -111, -33, 45, 123, -53, 25, 103, -73, 5, 83, -93, -15, 63, -113, -35, 43, 121, -55, 23, 101, -75, 3, 81, -95, -17, 61, -115, -37, 41, 119, -57, 21, 99, -77, 1, 79, -97, -19, 59, -117, -39],
[-47, 33, 113, -61, 19, 99, -75, 5, 85, -89, -9, 71, -103, -23, 57, -117, -37, 43, 123, -51, 29, 109, -65, 15, 95, -79, 1, 81, -93, -13, 67, -107, -27, 53, -121, -41, 39, 119, -55, 25, 105, -69, 11, 91, -83, -3, 77, -97, -17, 63, -111, -31, 49, -125, -45, 35, 115, -59, 21, 101, -73, 7, 87],
[-45, 37, 119, -53, 29, 111, -61, 21, 103, -69, 13, 95, -77, 5, 87, -85, -3, 79, -93, -11, 71, -101, -19, 63, -109, -27, 55, -117, -35, 47, -125, -43, 39, 121, -51, 31, 113, -59, 23, 105, -67, 15, 97, -75, 7, 89, -83, -1, 81, -91, -9, 73, -99, -17, 65, -107, -25, 57, -115, -33, 49, -123, -41],
[-43, 41, 125, -45, 39, 123, -47, 37, 121, -49, 35, 119, -51, 33, 117, -53, 31, 115, -55, 29, 113, -57, 27, 111, -59, 25, 109, -61, 23, 107, -63, 21, 105, -65, 19, 103, -67, 17, 101, -69, 15, 99, -71, 13, 97, -73, 11, 95, -75, 9, 93, -77, 7, 91, -79, 5, 89, -81, 3, 87, -83, 1, 85],
[-41, 45, -123, -37, 49, -119, -33, 53, -115, -29, 57, -111, -25, 61, -107, -21, 65, -103, -17, 69, -99, -13, 73, -95, -9, 77, -91, -5, 81, -87, -1, 85, -83, 3, 89, -79, 7, 93, -75, 11, 97, -71, 15, 101, -67, 19, 105, -63, 23, 109, -59, 27, 113, -55, 31, 117, -51, 35, 121, -47, 39, 125, -43],
[-39, 49, -117, -29, 59, -107, -19, 69, -97, -9, 79, -87, 1, 89, -77, 11, 99, -67, 21, 109, -57, 31, 119, -47, 41, -125, -37, 51, -115, -27, 61, -105, -17, 71, -95, -7, 81, -85, 3, 91, -75, 13, 101, -65, 23, 111, -55, 33, 121, -45, 43, -123, -35, 53, -113, -25, 63, -103, -15, 73, -93, -5, 83],
[-37, 53, -111, -21, 69, -95, -5, 85, -79, 11, 101, -63, 27, 117, -47, 43, -121, -31, 59, -105, -15, 75, -89, 1, 91, -73, 17, 107, -57, 33, 123, -41, 49, -115, -25, 65, -99, -9, 81, -83, 7, 97, -67, 23, 113, -51, 39, -125, -35, 55, -109, -19, 71, -93, -3, 87, -77, 13, 103, -61, 29, 119, -45],
[-35, 57, -105, -13, 79, -83, 9, 101, -61, 31, 123, -39, 53, -109, -17, 75, -87, 5, 97, -65, 27, 119, -43, 49, -113, -21, 71, -91, 1, 93, -69, 23, 115, -47, 45, -117, -25, 67, -95, -3, 89, -73, 19, 111, -51, 41, -121, -29, 63, -99, -7, 85, -77, 15, 107, -55, 37, -125, -33, 59, -103, -11, 81],
[-33, 61, -99, -5, 89, -71, 23, 117, -43, 51, -109, -15, 79, -81, 13, 107, -53, 41, -119, -25, 69, -91, 3, 97, -63, 31, 125, -35, 59, -101, -7, 87, -73, 21, 115, -45, 49, -111, -17, 77, -83, 11, 105, -55, 39, -121, -27, 67, -93, 1, 95, -65, 29, 123, -37, 57, -103, -9, 85, -75, 19, 113, -47],
[-31, 65, -93, 3, 99, -59, 37, -121, -25, 71, -87, 9, 105, -53, 43, -115, -19, 77, -81, 15, 111, -47, 49, -109, -13, 83, -75, 21, 117, -41, 55, -103, -7, 89, -69, 27, 123, -35, 61, -97, -1, 95, -63, 33, -125, -29, 67, -91, 5, 101, -57, 39, -119, -23, 73, -85, 11, 107, -51, 45, -113, -17, 79],
[-29, 69, -87, 11, 109, -47, 51, -105, -7, 91, -65, 33, -123, -25, 73, -83, 15, 113, -43, 55, -101, -3, 95, -61, 37, -119, -21, 77, -79, 19, 117, -39, 59, -97, 1, 99, -57, 41, -115, -17, 81, -75, 23, 121, -35, 63, -93, 5, 103, -53, 45, -111, -13, 85, -71, 27, 125, -31, 67, -89, 9, 107, -49],
[-27, 73, -81, 19, 119, -35, 65, -89, 11, 111, -43, 57, -97, 3, 103, -51, 49, -105, -5, 95, -59, 41, -113, -13, 87, -67, 33, -121, -21, 79, -75, 25, 125, -29, 71, -83, 17, 117, -37, 63, -91, 9, 109, -45, 55, -99, 1, 101, -53, 47, -107, -7, 93, -61, 39, -115, -15, 85, -69, 31, -123, -23, 77],
[-25, 77, -75, 27, -125, -23, 79, -73, 29, -123, -21, 81, -71, 31, -121, -19, 83, -69, 33, -119, -17, 85, -67, 35, -117, -15, 87, -65, 37, -115, -13, 89, -63, 39, -113, -11, 91, -61, 41, -111, -9, 93, -59, 43, -109, -7, 95, -57, 45, -107, -5, 97, -55, 47, -105, -3, 99, -53, 49, -103, -1, 101, -51],
[-23, 81, -69, 35, -115, -11, 93, -57, 47, -103, 1, 105, -45, 59, -91, 13, 117, -33, 71, -79, 25, -125, -21, 83, -67, 37, -113, -9, 95, -55, 49, -101, 3, 107, -43, 61, -89, 15, 119, -31, 73, -77, 27, -123, -19, 85, -65, 39, -111, -7, 97, -53, 51, -99, 5, 109, -41, 63, -87, 17, 121, -29, 75],
[-21, 85, -63, 43, -105, 1, 107, -41, 65, -83, 23, -125, -19, 87, -61, 45, -103, 3, 109, -39, 67, -81, 25, -123, -17, 89, -59, 47, -101, 5, 111, -37, 69, -79, 27, -121, -15, 91, -57, 49, -99, 7, 113, -35, 71, -77, 29, -119, -13, 93, -55, 51, -97, 9, 115, -33, 73, -75, 31, -117, -11, 95, -53],
[-19, 89, -57, 51, -95, 13, 121, -25, 83, -63, 45, -101, 7, 115, -31, 77, -69, 39, -107, 1, 109, -37, 71, -75, 33, -113, -5, 103, -43, 65, -81, 27, -119, -11, 97, -49, 59, -87, 21, -125, -17, 91, -55, 53, -93, 15, 123, -23, 85, -61, 47, -99, 9, 117, -29, 79, -67, 41, -105, 3, 111, -35, 73],
[-17, 93, -51, 59, -85, 25, -119, -9, 101, -43, 67, -77, 33, -111, -1, 109, -35, 75, -69, 41, -103, 7, 117, -27, 83, -61, 49, -95, 15, 125, -19, 91, -53, 57, -87, 23, -121, -11, 99, -45, 65, -79, 31, -113, -3, 107, -37, 73, -71, 39, -105, 5, 115, -29, 81, -63, 47, -97, 13, 123, -21, 89, -55],
[-15, 97, -45, 67, -75, 37, -105, 7, 119, -23, 89, -53, 59, -83, 29, -113, -1, 111, -31, 81, -61, 51, -91, 21, -121, -9, 103, -39, 73, -69, 43, -99, 13, 125, -17, 95, -47, 65, -77, 35, -107, 5, 117, -25, 87, -55, 57, -85, 27, -115, -3, 109, -33, 79, -63, 49, -93, 19, -123, -11, 101, -41, 71],
[-13, 101, -39, 75, -65, 49, -91, 23, -117, -3, 111, -29, 85, -55, 59, -81, 33, -107, 7, 121, -19, 95, -45, 69, -71, 43, -97, 17, -123, -9, 105, -35, 79, -61, 53, -87, 27, -113, 1, 115, -25, 89, -51, 63, -77, 37, -103, 11, 125, -15, 99, -41, 73, -67, 47, -93, 21, -119, -5, 109, -31, 83, -57],
[-11, 105, -33, 83, -55, 61, -77, 39, -99, 17, -121, -5, 111, -27, 89, -49, 67, -71, 45, -93, 23, -115, 1, 117, -21, 95, -43, 73, -65, 51, -87, 29, -109, 7, 123, -15, 101, -37, 79, -59, 57, -81, 35, -103, 13, -125, -9, 107, -31, 85, -53, 63, -75, 41, -97, 19, -119, -3, 113, -25, 91, -47, 69],
[-9, 109, -27, 91, -45, 73, -63, 55, -81, 37, -99, 19, -117, 1, 119, -17, 101, -35, 83, -53, 65, -71, 47, -89, 29, -107, 11, -125, -7, 111, -25, 93, -43, 75, -61, 57, -79, 39, -97, 21, -115, 3, 121, -15, 103, -33, 85, -51, 67, -69, 49, -87, 31, -105, 13, -123, -5, 113, -23, 95, -41, 77, -59],
[-7, 113, -21, 99, -35, 85, -49, 71, -63, 57, -77, 43, -91, 29, -105, 15, -119, 1, 121, -13, 107, -27, 93, -41, 79, -55, 65, -69, 51, -83, 37, -97, 23, -111, 9, -125, -5, 115, -19, 101, -33, 87, -47, 73, -61, 59, -75, 45, -89, 31, -103, 17, -117, 3, 123, -11, 109, -25, 95, -39, 81, -53, 67],
[-5, 117, -15, 107, -25, 97, -35, 87, -45, 77, -55, 67, -65, 57, -75, 47, -85, 37, -95, 27, -105, 17, -115, 7, -125, -3, 119, -13, 109, -23, 99, -33, 89, -43, 79, -53, 69, -63, 59, -73, 49, -83, 39, -93, 29, -103, 19, -113, 9, -123, -1, 121, -11, 111, -21, 101, -31, 91, -41, 81, -51, 71, -61],
[-3, 121, -9, 115, -15, 109, -21, 103, -27, 97, -33, 91, -39, 85, -45, 79, -51, 73, -57, 67, -63, 61, -69, 55, -75, 49, -81, 43, -87, 37, -93, 31, -99, 25, -105, 19, -111, 13, -117, 7, -123, 1, 125, -5, 119, -11, 113, -17, 107, -23, 101, -29, 95, -35, 89, -41, 83, -47, 77, -53, 71, -59, 65],
[-1, 125, -3, 123, -5, 121, -7, 119, -9, 117, -11, 115, -13, 113, -15, 111, -17, 109, -19, 107, -21, 105, -23, 103, -25, 101, -27, 99, -29, 97, -31, 95, -33, 93, -35, 91, -37, 89, -39, 87, -41, 85, -43, 83, -45, 81, -47, 79, -49, 77, -51, 75, -53, 73, -55, 71, -57, 69, -59, 67, -61, 65, -63]]
def B : List (List Int) := [
[-55156670819013986, 423523731663564, 21738725725989106, -111068375504289971, 73160809122027446, -1033082108092629, -273996241356140274, 26150246785693679, -217509958698224981, -230366148510990569, -129242259951787706, -162597131760442844, -201130142325973006, -638248445047119, -269680195315729981, -282540906881497746, -293320036521088131, -58417272860393976, -279159016091911281, 557386849563232 -- (+887 chars; full line in the Zenodo source)
[423523731663564, -111068375504289971, -1033082108092629, 26150246785693679, -230366148510990569, -162597131760442844, -638248445047119, -282540906881497746, -58417272860393976, 5573868495632321, -317904513517288486, -216957939838059274, -16253028158925366, -177016720114791099, -174362021604923051, -58286759022967216, -247581949089430731, -118714928011633781, -72656216396088261, -357647176832407 -- (+859 chars; full line in the Zenodo source)
[21738725725989106, -1033082108092629, -217509958698224981, -162597131760442844, -269680195315729981, -58417272860393976, -165720672974374111, -216957939838059274, -298378729779816789, -174362021604923051, -272308542847855084, -118714928011633781, -415472753699461189, -32634406619712166, -192334347113811309, 125472560449380446, -221549260445630454, 47939211432826936, -165774142285339104, 1842153 -- (+866 chars; full line in the Zenodo source)
[-111068375504289971, 26150246785693679, -162597131760442844, -282540906881497746, 5573868495632321, -216957939838059274, -177016720114791099, -58286759022967216, -118714928011633781, -357647176832407474, -48171318361245556, 125472560449380446, -255518677845587991, 32482617629237766, 184215345755237014, 449643663924974, 340394109744598654, 209341095190926924, 221549260445630454, 3755155562054526 -- (+865 chars; full line in the Zenodo source)
[73160809122027446, -230366148510990569, -269680195315729981, 5573868495632321, -369047933450716911, -174362021604923051, -312381474987222826, -357647176832407474, -192334347113811309, 8235072767264459, -209341095190926924, 184215345755237014, -123140240974781729, 165774142285339104, 255518677845587991, 375515556205452651, 32634406619712166, 463102752565185131, 58286759022967216, 298378729779816 -- (+868 chars; full line in the Zenodo source)
[-1033082108092629, -162597131760442844, -58417272860393976, -216957939838059274, -174362021604923051, -118714928011633781, -32634406619712166, 125472560449380446, 47939211432826936, 184215345755237014, 166239179406943956, 209341095190926924, 419927672724407116, 267375629807208069, 463102752565185131, 307142517691378866, 369047933450716911, 279159016091911281, 201130142325973006, 273996241356140 -- (+868 chars; full line in the Zenodo source)
[-273996241356140274, -638248445047119, -165720672974374111, -177016720114791099, -312381474987222826, -32634406619712166, -419927672724407116, 32482617629237766, -449643663924974, 165774142285339104, -8235072767264459, 267375629807208069, 118714928011633781, 386651058991559964, 317904513517288486, 269680195315729981, -26150246785693679, 55156670819013986, -1033082108092629, -201130142325973006, -- (+868 chars; full line in the Zenodo source)
[26150246785693679, -282540906881497746, -216957939838059274, -58286759022967216, -357647176832407474, 125472560449380446, 32482617629237766, 449643663924974, 209341095190926924, 375515556205452651, 415472753699461189, 307142517691378866, 340814723116532389, 269680195315729981, 273996241356140274, -55156670819013986, -217509958698224981, -293320036521088131, -369047933450716911, -272308542847855 -- (+865 chars; full line in the Zenodo source)
[-217509958698224981, -58417272860393976, -298378729779816789, -118714928011633781, -192334347113811309, 47939211432826936, -449643663924974, 209341095190926924, 190187185345915339, 463102752565185131, 177016720114791099, 279159016091911281, 230366148510990569, 55156670819013986, 26150246785693679, -293320036521088131, -16253028158925366, -312381474987222826, -48171318361245556, -245628549675748 -- (+869 chars; full line in the Zenodo source)
[-230366148510990569, 5573868495632321, -174362021604923051, -357647176832407474, 8235072767264459, 184215345755237014, 165774142285339104, 375515556205452651, 463102752565185131, 298378729779816789, 293320036521088131, 273996241356140274, 21738725725989106, -201130142325973006, -340814723116532389, -272308542847855084, -267375629807208069, -245628549675748984, -449643663924974, -479392114328269 -- (+864 chars; full line in the Zenodo source)
[-129242259951787706, -317904513517288486, -272308542847855084, -48171318361245556, -209341095190926924, 166239179406943956, -8235072767264459, 415472753699461189, 177016720114791099, 293320036521088131, 1033082108092629, 73160809122027446, -282540906881497746, -298378729779816789, -72656216396088261, -419927672724407116, 184215345755237014, -32482617629237766, 192334347113811309, 24758194908943 -- (+867 chars; full line in the Zenodo source)
[-162597131760442844, -216957939838059274, -118714928011633781, 125472560449380446, 184215345755237014, 209341095190926924, 267375629807208069, 307142517691378866, 279159016091911281, 273996241356140274, 73160809122027446, -293320036521088131, -386651058991559964, -253742226192028336, -245628549675748984, -123140240974781729, -8235072767264459, 72656216396088261, 16253028158925366, 6382484450471 -- (+864 chars; full line in the Zenodo source)
[-201130142325973006, -16253028158925366, -415472753699461189, -255518677845587991, -123140240974781729, 419927672724407116, 118714928011633781, 340814723116532389, 230366148510990569, 21738725725989106, -282540906881497746, -386651058991559964, -32634406619712166, -209341095190926924, 340394109744598654, 190187185345915339, 272308542847855084, -5573868495632321, 273996241356140274, -10330821080 -- (+869 chars; full line in the Zenodo source)
[-638248445047119, -177016720114791099, -32634406619712166, 32482617629237766, 165774142285339104, 267375629807208069, 386651058991559964, 269680195315729981, 55156670819013986, -201130142325973006, -298378729779816789, -253742226192028336, -209341095190926924, 27607867455979464, 48171318361245556, 174362021604923051, 282540906881497746, -423523731663564, -162597131760442844, -16253028158925366, -- (+866 chars; full line in the Zenodo source)
[-269680195315729981, -174362021604923051, -192334347113811309, 184215345755237014, 255518677845587991, 463102752565185131, 317904513517288486, 273996241356140274, 26150246785693679, -340814723116532389, -72656216396088261, -245628549675748984, 340394109744598654, 48171318361245556, 386651058991559964, 638248445047119, -55156670819013986, -282540906881497746, -307142517691378866, -19018718534591 -- (+865 chars; full line in the Zenodo source)
[-282540906881497746, -58286759022967216, 125472560449380446, 449643663924974, 375515556205452651, 307142517691378866, 269680195315729981, -55156670819013986, -293320036521088131, -272308542847855084, -419927672724407116, -123140240974781729, 190187185345915339, 174362021604923051, 638248445047119, 423523731663564, -58417272860393976, -247581949089430731, 8235072767264459, 166239179406943956, 19 -- (+863 chars; full line in the Zenodo source)
[-293320036521088131, -247581949089430731, -221549260445630454, 340394109744598654, 32634406619712166, 369047933450716911, -26150246785693679, -217509958698224981, -16253028158925366, -267375629807208069, 184215345755237014, -8235072767264459, 272308542847855084, 282540906881497746, -55156670819013986, -58417272860393976, -312381474987222826, -255518677845587991, 27607867455979464, 2537422261920 -- (+869 chars; full line in the Zenodo source)
[-58417272860393976, -118714928011633781, 47939211432826936, 209341095190926924, 463102752565185131, 279159016091911281, 55156670819013986, -293320036521088131, -312381474987222826, -245628549675748984, -32482617629237766, 72656216396088261, -5573868495632321, -423523731663564, -282540906881497746, -247581949089430731, -255518677845587991, 165774142285339104, 415472753699461189, 1657206729743741 -- (+867 chars; full line in the Zenodo source)
[-279159016091911281, -72656216396088261, -165774142285339104, 221549260445630454, 58286759022967216, 201130142325973006, -1033082108092629, -369047933450716911, -48171318361245556, -449643663924974, 192334347113811309, 16253028158925366, 273996241356140274, -162597131760442844, -307142517691378866, 8235072767264459, 27607867455979464, 415472753699461189, -5573868495632321, 55156670819013986, -5 -- (+867 chars; full line in the Zenodo source)
[5573868495632321, -357647176832407474, 184215345755237014, 375515556205452651, 298378729779816789, 273996241356140274, -201130142325973006, -272308542847855084, -245628549675748984, -47939211432826936, 247581949089430731, 638248445047119, -1033082108092629, -16253028158925366, -190187185345915339, 166239179406943956, 253742226192028336, 165720672974374111, 55156670819013986, -279159016091911281 -- (+870 chars; full line in the Zenodo source)
[-165720672974374111, -32634406619712166, -449643663924974, 267375629807208069, 317904513517288486, 55156670819013986, 5573868495632321, -253742226192028336, 123140240974781729, 48171318361245556, 340814723116532389, -423523731663564, -279159016091911281, -357647176832407474, -166239179406943956, 192334347113811309, 216957939838059274, -21738725725989106, -58417272860393976, -415472753699461189, -- (+869 chars; full line in the Zenodo source)
[-317904513517288486, -48171318361245556, 166239179406943956, 415472753699461189, 293320036521088131, 73160809122027446, -298378729779816789, -419927672724407116, -32482617629237766, 247581949089430731, 162597131760442844, -230366148510990569, -58286759022967216, 47939211432826936, 221549260445630454, 386651058991559964, 273996241356140274, -269680195315729981, -463102752565185131, -340394109744 -- (+863 chars; full line in the Zenodo source)
[-340814723116532389, -190187185345915339, 27607867455979464, 312381474987222826, 162597131760442844, -129242259951787706, -247581949089430731, -165774142285339104, 375515556205452651, 216957939838059274, 55156670819013986, -317904513517288486, -192334347113811309, 340394109744598654, 118714928011633781, 201130142325973006, -230366148510990569, -272308542847855084, 32482617629237766, -1254725604 -- (+868 chars; full line in the Zenodo source)
[-216957939838059274, 125472560449380446, 209341095190926924, 307142517691378866, 273996241356140274, -293320036521088131, -253742226192028336, -123140240974781729, 72656216396088261, 638248445047119, -230366148510990569, -247581949089430731, -27607867455979464, 192334347113811309, 165720672974374111, 21738725725989106, -298378729779816789, -221549260445630454, 255518677845587991, 17701672011479 -- (+864 chars; full line in the Zenodo source)
[-369047933450716911, 8235072767264459, 255518677845587991, 298378729779816789, -423523731663564, -340814723116532389, 125472560449380446, -47939211432826936, 386651058991559964, 111068375504289971, -165720672974374111, -190187185345915339, -32482617629237766, 307142517691378866, 1033082108092629, -279159016091911281, -48171318361245556, 27607867455979464, 272308542847855084, -26150246785693679, -- (+871 chars; full line in the Zenodo source)
[-16253028158925366, -255518677845587991, 419927672724407116, 340814723116532389, 21738725725989106, -386651058991559964, -209341095190926924, 190187185345915339, -5573868495632321, -1033082108092629, -58286759022967216, -27607867455979464, 267375629807208069, 293320036521088131, -217509958698224981, -312381474987222826, -166239179406943956, 357647176832407474, 638248445047119, -1625971317604428 -- (+871 chars; full line in the Zenodo source)
[-298378729779816789, 47939211432826936, 190187185345915339, 279159016091911281, 26150246785693679, -312381474987222826, 123140240974781729, 72656216396088261, 129242259951787706, -282540906881497746, -267375629807208069, 165774142285339104, 174362021604923051, -21738725725989106, -216957939838059274, -221549260445630454, 419927672724407116, 317904513517288486, 73160809122027446, -58286759022967 -- (+862 chars; full line in the Zenodo source)
[-177016720114791099, 32482617629237766, 267375629807208069, 269680195315729981, -201130142325973006, -253742226192028336, 27607867455979464, 174362021604923051, -423523731663564, -16253028158925366, 47939211432826936, 192334347113811309, 293320036521088131, -129242259951787706, -415472753699461189, -184215345755237014, 58286759022967216, 111068375504289971, -216957939838059274, -255518677845587 -- (+864 chars; full line in the Zenodo source)
[-386651058991559964, -27607867455979464, 357647176832407474, 129242259951787706, -58417272860393976, -375515556205452651, 221549260445630454, 317904513517288486, -273996241356140274, -118714928011633781, -123140240974781729, 272308542847855084, 111068375504289971, -369047933450716911, 47939211432826936, 48171318361245556, 269680195315729981, -638248445047119, -267375629807208069, 20934109519092 -- (+866 chars; full line in the Zenodo source)
[-174362021604923051, 184215345755237014, 463102752565185131, 273996241356140274, -340814723116532389, -245628549675748984, 48171318361245556, 638248445047119, -282540906881497746, -190187185345915339, 221549260445630454, 165720672974374111, -217509958698224981, -415472753699461189, 27607867455979464, 177016720114791099, 423523731663564, -58286759022967216, 123140240974781729, 312381474987222826 -- (+865 chars; full line in the Zenodo source)
[-307142517691378866, 123140240974781729, 247581949089430731, -21738725725989106, -177016720114791099, -340394109744598654, 463102752565185131, 1033082108092629, -369047933450716911, 32482617629237766, 357647176832407474, 217509958698224981, -317904513517288486, -245628549675748984, 267375629807208069, 162597131760442844, -279159016091911281, 8235072767264459, 190187185345915339, 269680195315729 -- (+865 chars; full line in the Zenodo source)
[-58286759022967216, 449643663924974, 307142517691378866, -55156670819013986, -272308542847855084, -123140240974781729, 174362021604923051, 423523731663564, -247581949089430731, 166239179406943956, 386651058991559964, 21738725725989106, -312381474987222826, -184215345755237014, 177016720114791099, -111068375504289971, -118714928011633781, 340394109744598654, 298378729779816789, 73160809122027446 -- (+869 chars; full line in the Zenodo source)
[-272308542847855084, 166239179406943956, 177016720114791099, 73160809122027446, -72656216396088261, -32482617629237766, 340814723116532389, -230366148510990569, -267375629807208069, 221549260445630454, 58417272860393976, -269680195315729981, 125472560449380446, 190187185345915339, 201130142325973006, 5573868495632321, -245628549675748984, 253742226192028336, -26150246785693679, -369047933450716 -- (+866 chars; full line in the Zenodo source)
[-247581949089430731, 340394109744598654, 369047933450716911, -217509958698224981, -267375629807208069, -8235072767264459, 282540906881497746, -58417272860393976, -255518677845587991, 253742226192028336, 273996241356140274, -298378729779816789, -166239179406943956, 58286759022967216, 423523731663564, -118714928011633781, 165774142285339104, 340814723116532389, -129242259951787706, -1923343471138 -- (+867 chars; full line in the Zenodo source)
[-312381474987222826, 165774142285339104, 317904513517288486, -201130142325973006, 125472560449380446, 48171318361245556, 217509958698224981, -16253028158925366, -166239179406943956, 307142517691378866, -111068375504289971, -415472753699461189, 245628549675748984, 58417272860393976, -293320036521088131, -255518677845587991, 357647176832407474, -73160809122027446, -174362021604923051, -1231402409 -- (+865 chars; full line in the Zenodo source)
[-118714928011633781, 209341095190926924, 279159016091911281, -293320036521088131, -245628549675748984, 72656216396088261, -423523731663564, -247581949089430731, 165774142285339104, 165720672974374111, -269680195315729981, -221549260445630454, 357647176832407474, 111068375504289971, -58286759022967216, 340394109744598654, 340814723116532389, -201130142325973006, -419927672724407116, 326344066197 -- (+865 chars; full line in the Zenodo source)
[-463102752565185131, 245628549675748984, 282540906881497746, -165720672974374111, -27607867455979464, 58286759022967216, 73160809122027446, -32634406619712166, -125472560449380446, 129242259951787706, -16253028158925366, -449643663924974, 298378729779816789, -230366148510990569, -375515556205452651, 267375629807208069, 1033082108092629, -307142517691378866, 340394109744598654, 31790451351728848 -- (+867 chars; full line in the Zenodo source)
[-72656216396088261, 221549260445630454, 201130142325973006, -369047933450716911, -449643663924974, 16253028158925366, -162597131760442844, 8235072767264459, 415472753699461189, 55156670819013986, -463102752565185131, 255518677845587991, 638248445047119, -216957939838059274, 123140240974781729, 298378729779816789, -129242259951787706, -419927672724407116, 357647176832407474, -423523731663564, -1 -- (+865 chars; full line in the Zenodo source)
[-415472753699461189, 419927672724407116, 230366148510990569, -386651058991559964, 340394109744598654, -5573868495632321, -279159016091911281, -27607867455979464, 174362021604923051, -217509958698224981, 125472560449380446, 357647176832407474, 55156670819013986, -72656216396088261, -8235072767264459, 129242259951787706, -177016720114791099, -184215345755237014, 165720672974374111, -5841727286039 -- (+866 chars; full line in the Zenodo source)
[-357647176832407474, 375515556205452651, 273996241356140274, -272308542847855084, -47939211432826936, 638248445047119, -16253028158925366, 166239179406943956, 165720672974374111, -279159016091911281, -340394109744598654, 177016720114791099, -162597131760442844, -255518677845587991, 312381474987222826, 73160809122027446, -192334347113811309, 32634406619712166, -423523731663564, -7265621639608826 -- (+864 chars; full line in the Zenodo source)
[-253742226192028336, 192334347113811309, 111068375504289971, -463102752565185131, 419927672724407116, -26150246785693679, -272308542847855084, 245628549675748984, 162597131760442844, -386651058991559964, 165774142285339104, 282540906881497746, -369047933450716911, 166239179406943956, -5573868495632321, -165720672974374111, 123140240974781729, 216957939838059274, -293320036521088131, -2760786745 -- (+869 chars; full line in the Zenodo source)
[-32634406619712166, 267375629807208069, 55156670819013986, -253742226192028336, 48171318361245556, -423523731663564, -357647176832407474, 192334347113811309, -21738725725989106, -415472753699461189, 190187185345915339, 111068375504289971, -72656216396088261, 375515556205452651, -73160809122027446, -463102752565185131, -125472560449380446, 1033082108092629, -118714928011633781, 41992767272440711 -- (+867 chars; full line in the Zenodo source)
[-267375629807208069, 253742226192028336, 423523731663564, -192334347113811309, 415472753699461189, -111068375504289971, -375515556205452651, 463102752565185131, -1033082108092629, -419927672724407116, 312381474987222826, 26150246785693679, -221549260445630454, 272308542847855084, -230366148510990569, -245628549675748984, 307142517691378866, -162597131760442844, -209341095190926924, 386651058991 -- (+872 chars; full line in the Zenodo source)
[-48171318361245556, 415472753699461189, 73160809122027446, -419927672724407116, 247581949089430731, -230366148510990569, 47939211432826936, 386651058991559964, -269680195315729981, -340394109744598654, 216957939838059274, 5573868495632321, 449643663924974, 279159016091911281, -369047933450716911, 27607867455979464, 638248445047119, -174362021604923051, 245628549675748984, 217509958698224981, -3 -- (+865 chars; full line in the Zenodo source)
[-192334347113811309, 463102752565185131, 26150246785693679, -245628549675748984, 386651058991559964, -282540906881497746, -166239179406943956, 165720672974374111, -216957939838059274, 27607867455979464, 201130142325973006, -58286759022967216, -8235072767264459, -73160809122027446, -357647176832407474, 32634406619712166, 21738725725989106, 125472560449380446, 247581949089430731, -129242259951787 -- (+866 chars; full line in the Zenodo source)
[-190187185345915339, 312381474987222826, -129242259951787706, -165774142285339104, 216957939838059274, -317904513517288486, 340394109744598654, 201130142325973006, -272308542847855084, -125472560449380446, -423523731663564, -48171318361245556, 463102752565185131, -217509958698224981, -209341095190926924, 16253028158925366, 5573868495632321, 166239179406943956, 269680195315729981, -3071425176913 -- (+868 chars; full line in the Zenodo source)
[-375515556205452651, 272308542847855084, -638248445047119, -166239179406943956, 279159016091911281, -177016720114791099, 255518677845587991, -73160809122027446, -32634406619712166, 72656216396088261, -217509958698224981, 32482617629237766, 216957939838059274, -340814723116532389, 165774142285339104, 230366148510990569, -463102752565185131, 267375629807208069, -111068375504289971, -2215492604456 -- (+867 chars; full line in the Zenodo source)
[125472560449380446, 307142517691378866, -293320036521088131, -123140240974781729, 638248445047119, -247581949089430731, 192334347113811309, 21738725725989106, -221549260445630454, 177016720114791099, 5573868495632321, 340394109744598654, 129242259951787706, -463102752565185131, 32634406619712166, -1033082108092629, 47939211432826936, 369047933450716911, -340814723116532389, -32482617629237766, -- (+868 chars; full line in the Zenodo source)
[-419927672724407116, 386651058991559964, 5573868495632321, 27607867455979464, 217509958698224981, -357647176832407474, 72656216396088261, -129242259951787706, 184215345755237014, 58417272860393976, -307142517691378866, 375515556205452651, 423523731663564, -221549260445630454, 298378729779816789, -317904513517288486, -32482617629237766, 273996241356140274, -32634406619712166, 118714928011633781, -- (+865 chars; full line in the Zenodo source)
[8235072767264459, 298378729779816789, -340814723116532389, -47939211432826936, 111068375504289971, -190187185345915339, 307142517691378866, -279159016091911281, 27607867455979464, -26150246785693679, -32634406619712166, 312381474987222826, -269680195315729981, -123140240974781729, 162597131760442844, -72656216396088261, 415472753699461189, -129242259951787706, -166239179406943956, 2825409068814 -- (+867 chars; full line in the Zenodo source)
[-221549260445630454, 369047933450716911, -16253028158925366, -8235072767264459, -55156670819013986, -255518677845587991, 216957939838059274, -298378729779816789, 419927672724407116, 423523731663564, -245628549675748984, 340814723116532389, -177016720114791099, -125472560449380446, 21738725725989106, 47939211432826936, 317904513517288486, -386651058991559964, 375515556205452651, -111068375504289 -- (+868 chars; full line in the Zenodo source)
[-255518677845587991, 340814723116532389, -386651058991559964, 190187185345915339, -1033082108092629, -27607867455979464, 293320036521088131, -312381474987222826, 357647176832407474, -162597131760442844, 449643663924974, 129242259951787706, -253742226192028336, 247581949089430731, -58417272860393976, 165774142285339104, -73160809122027446, -375515556205452651, 177016720114791099, -21695793983805 -- (+865 chars; full line in the Zenodo source)
[-245628549675748984, 165720672974374111, -58286759022967216, 32634406619712166, -129242259951787706, 449643663924974, 230366148510990569, -267375629807208069, 307142517691378866, -317904513517288486, 255518677845587991, -55156670819013986, 47939211432826936, -5573868495632321, -272308542847855084, 253742226192028336, -162597131760442844, -123140240974781729, 217509958698224981, -481713183612455 -- (+868 chars; full line in the Zenodo source)
[47939211432826936, 279159016091911281, -312381474987222826, 72656216396088261, -282540906881497746, 165774142285339104, -21738725725989106, -221549260445630454, 317904513517288486, -58286759022967216, 253742226192028336, -201130142325973006, -184215345755237014, 1033082108092629, 125472560449380446, 369047933450716911, -386651058991559964, 48171318361245556, -230366148510990569, 449643663924974 -- (+870 chars; full line in the Zenodo source)
[-209341095190926924, 293320036521088131, -72656216396088261, 247581949089430731, -165720672974374111, 221549260445630454, -111068375504289971, -340394109744598654, 201130142325973006, -32634406619712166, 174362021604923051, -369047933450716911, 375515556205452651, 26150246785693679, -449643663924974, 217509958698224981, -190187185345915339, 16253028158925366, -386651058991559964, 26737562980720 -- (+866 chars; full line in the Zenodo source)
[32482617629237766, 269680195315729981, -253742226192028336, 174362021604923051, -16253028158925366, 192334347113811309, -129242259951787706, -184215345755237014, 111068375504289971, -255518677845587991, 279159016091911281, -463102752565185131, 247581949089430731, -317904513517288486, 419927672724407116, -273996241356140274, -449643663924974, -26150246785693679, 125472560449380446, 3408147231165 -- (+868 chars; full line in the Zenodo source)
[-165774142285339104, 201130142325973006, -48171318361245556, 16253028158925366, -307142517691378866, 415472753699461189, -58417272860393976, 255518677845587991, 73160809122027446, 123140240974781729, -26150246785693679, -419927672724407116, 165720672974374111, -118714928011633781, 247581949089430731, -340814723116532389, 375515556205452651, -230366148510990569, -184215345755237014, -21738725725 -- (+864 chars; full line in the Zenodo source)
[-27607867455979464, 129242259951787706, -375515556205452651, 317904513517288486, -118714928011633781, 272308542847855084, -369047933450716911, 48171318361245556, -638248445047119, 209341095190926924, 21738725725989106, -166239179406943956, -26150246785693679, 8235072767264459, 279159016091911281, -415472753699461189, 174362021604923051, -177016720114791099, 253742226192028336, -2933200365210881 -- (+866 chars; full line in the Zenodo source)
[-340394109744598654, 217509958698224981, 8235072767264459, 58417272860393976, -253742226192028336, 298378729779816789, -58286759022967216, 118714928011633781, -340814723116532389, 192334347113811309, -638248445047119, -47939211432826936, 73160809122027446, 449643663924974, 111068375504289971, -209341095190926924, 201130142325973006, -190187185345915339, 317904513517288486, -463102752565185131, -- (+866 chars; full line in the Zenodo source)
[184215345755237014, 273996241356140274, -245628549675748984, 638248445047119, -190187185345915339, 165720672974374111, -415472753699461189, 177016720114791099, -58286759022967216, 312381474987222826, -369047933450716911, 32634406619712166, -58417272860393976, 419927672724407116, -129242259951787706, -32482617629237766, -111068375504289971, 449643663924974, -21738725725989106, -16577414228533910 -- (+867 chars; full line in the Zenodo source)
[-166239179406943956, -73160809122027446, 32482617629237766, 230366148510990569, -221549260445630454, 269680195315729981, -190187185345915339, -5573868495632321, -253742226192028336, 369047933450716911, -118714928011633781, 174362021604923051, -307142517691378866, 312381474987222826, -16253028158925366, 357647176832407474, -165720672974374111, 192334347113811309, -282540906881497746, -8235072767 -- (+871 chars; full line in the Zenodo source)
[123140240974781729, -21738725725989106, -340394109744598654, 1033082108092629, 32482617629237766, 217509958698224981, -245628549675748984, 162597131760442844, 8235072767264459, 269680195315729981, -375515556205452651, 58417272860393976, -48171318361245556, 165720672974374111, -253742226192028336, 216957939838059274, -72656216396088261, 298378729779816789, -312381474987222826, 174362021604923051 -- (+863 chars; full line in the Zenodo source)
[-449643663924974, 55156670819013986, 123140240974781729, -423523731663564, -166239179406943956, -21738725725989106, 184215345755237014, 111068375504289971, -340394109744598654, -73160809122027446, -27607867455979464, 1033082108092629, -165774142285339104, 273996241356140274, 32482617629237766, -26150246785693679, -209341095190926924, 217509958698224981, 47939211432826936, 230366148510990569, -2 -- (+866 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 63).map (fun t => rowA (126 + 1) t (rng 1 63)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 63 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 63 B A = sid 661550413311054017530 63 := rfl
theorem d_ne : (661550413311054017530 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 63 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 63) (h0 : mv A g = zeros 63) : g = zeros 63 :=
kernel_zero 63 661550413311054017530 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 126 63 = true := rfl
/-- **Balanced ⇒ pairs for p = 127.** A list with entries in (0, 127) that is balanced for 1 ≤ t ≤ 63
has as many copies of x as of 127 − x for every 1 ≤ x ≤ 63 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 127)
(hb : ∀ t, 1 ≤ t → t < 1 + 63 → tsum 127 t c + tsum 127 t c = c.length * 127) :
(rng 1 63).all (fun x => Nat.beq (cnt x c) (cnt (127 - x) c)) = true :=
pairs_of_bal 126 63 661550413311054017530 d_ne A B len cert A_def delta c hr hb
end MailletCert127
#print axioms MailletCert127.A_def
#print axioms MailletCert127.len
#print axioms MailletCert127.cert
#print axioms MailletCert127.d_ne
#print axioms MailletCert127.kernel
#print axioms MailletCert127.delta
#print axioms MailletCert127.pairs
lean_all/hodge/MailletCert13.lean
/-
hodge/MailletCert13.lean — T41 (goals G849b, G849c): for p = 13 the 6 × 6 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 6)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 26 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 13) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert13
open MailletLin MailletBridge
def A : List (List Int) := [
[-11, -9, -7, -5, -3, -1],
[-9, -5, -1, 3, 7, 11],
[-7, -1, 5, 11, -9, -3],
[-5, 3, 11, -7, 1, 9],
[-3, 7, -9, 1, 11, -5],
[-1, 11, -3, 9, -5, 7]]
def B : List (List Int) := [
[-1, 0, -1, -1, -1, 0],
[0, -1, 0, 1, 1, 1],
[-1, 0, 1, 1, 0, -1],
[-1, 1, 1, -1, 0, 0],
[-1, 1, 0, 0, 1, -1],
[0, 1, -1, 0, -1, 1]]
theorem A_def : A = (rng 1 6).map (fun t => rowA (12 + 1) t (rng 1 6)) := rfl
theorem len : allLen 6 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 6 B A = sid 26 6 := rfl
theorem d_ne : (26 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 6 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 6) (h0 : mv A g = zeros 6) : g = zeros 6 :=
kernel_zero 6 26 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 12 6 = true := rfl
/-- **Balanced ⇒ pairs for p = 13.** A list with entries in (0, 13) that is balanced for 1 ≤ t ≤ 6
has as many copies of x as of 13 − x for every 1 ≤ x ≤ 6 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 13)
(hb : ∀ t, 1 ≤ t → t < 1 + 6 → tsum 13 t c + tsum 13 t c = c.length * 13) :
(rng 1 6).all (fun x => Nat.beq (cnt x c) (cnt (13 - x) c)) = true :=
pairs_of_bal 12 6 26 d_ne A B len cert A_def delta c hr hb
end MailletCert13
#print axioms MailletCert13.A_def
#print axioms MailletCert13.len
#print axioms MailletCert13.cert
#print axioms MailletCert13.d_ne
#print axioms MailletCert13.kernel
#print axioms MailletCert13.delta
#print axioms MailletCert13.pairs
lean_all/hodge/MailletCert131.lean
/-
hodge/MailletCert131.lean — T41 (goals G849b, G849c): for p = 131 the 65 × 65 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 65)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 829561276563255529950 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 131) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert131
open MailletLin MailletBridge
def A : List (List Int) := [
[-129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129],
[-125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-123, -115, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125, -129, -121, -113, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127],
[-121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, -127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, 113, 125],
[-117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, -127, -113, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, 111, 125, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123],
[-113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, -125, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, 127, -117, -99, -81, -63, -45, -27, -9],
[-111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121],
[-109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, -121, -99, -77, -55, -33, -11],
[-107, -83, -59, -35, -11, 13, 37, 61, 85, 109, -129, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, -127, -103, -79, -55, -31, -7, 17, 41, 65, 89, 113, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, -123, -99, -75, -51, -27, -3, 21, 45, 69, 93, 117, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119],
[-105, -79, -53, -27, -1, 25, 51, 77, 103, 129, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, -113, -87, -61, -35, -9, 17, 43, 69, 95, 121, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, -117, -91, -65, -39, -13],
[-103, -75, -47, -19, 9, 37, 65, 93, 121, -113, -85, -57, -29, -1, 27, 55, 83, 111, -123, -95, -67, -39, -11, 17, 45, 73, 101, 129, -105, -77, -49, -21, 7, 35, 63, 91, 119, -115, -87, -59, -31, -3, 25, 53, 81, 109, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, -107, -79, -51, -23, 5, 33, 61, 89, 117],
[-101, -71, -41, -11, 19, 49, 79, 109, -123, -93, -63, -33, -3, 27, 57, 87, 117, -115, -85, -55, -25, 5, 35, 65, 95, 125, -107, -77, -47, -17, 13, 43, 73, 103, -129, -99, -69, -39, -9, 21, 51, 81, 111, -121, -91, -61, -31, -1, 29, 59, 89, 119, -113, -83, -53, -23, 7, 37, 67, 97, 127, -105, -75, -45, -15],
[-99, -67, -35, -3, 29, 61, 93, 125, -105, -73, -41, -9, 23, 55, 87, 119, -111, -79, -47, -15, 17, 49, 81, 113, -117, -85, -53, -21, 11, 43, 75, 107, -123, -91, -59, -27, 5, 37, 69, 101, -129, -97, -65, -33, -1, 31, 63, 95, 127, -103, -71, -39, -7, 25, 57, 89, 121, -109, -77, -45, -13, 19, 51, 83, 115],
[-97, -63, -29, 5, 39, 73, 107, -121, -87, -53, -19, 15, 49, 83, 117, -111, -77, -43, -9, 25, 59, 93, 127, -101, -67, -33, 1, 35, 69, 103, -125, -91, -57, -23, 11, 45, 79, 113, -115, -81, -47, -13, 21, 55, 89, 123, -105, -71, -37, -3, 31, 65, 99, -129, -95, -61, -27, 7, 41, 75, 109, -119, -85, -51, -17],
[-95, -59, -23, 13, 49, 85, 121, -105, -69, -33, 3, 39, 75, 111, -115, -79, -43, -7, 29, 65, 101, -125, -89, -53, -17, 19, 55, 91, 127, -99, -63, -27, 9, 45, 81, 117, -109, -73, -37, -1, 35, 71, 107, -119, -83, -47, -11, 25, 61, 97, -129, -93, -57, -21, 15, 51, 87, 123, -103, -67, -31, 5, 41, 77, 113],
[-93, -55, -17, 21, 59, 97, -127, -89, -51, -13, 25, 63, 101, -123, -85, -47, -9, 29, 67, 105, -119, -81, -43, -5, 33, 71, 109, -115, -77, -39, -1, 37, 75, 113, -111, -73, -35, 3, 41, 79, 117, -107, -69, -31, 7, 45, 83, 121, -103, -65, -27, 11, 49, 87, 125, -99, -61, -23, 15, 53, 91, 129, -95, -57, -19],
[-91, -51, -11, 29, 69, 109, -113, -73, -33, 7, 47, 87, 127, -95, -55, -15, 25, 65, 105, -117, -77, -37, 3, 43, 83, 123, -99, -59, -19, 21, 61, 101, -121, -81, -41, -1, 39, 79, 119, -103, -63, -23, 17, 57, 97, -125, -85, -45, -5, 35, 75, 115, -107, -67, -27, 13, 53, 93, -129, -89, -49, -9, 31, 71, 111],
[-89, -47, -5, 37, 79, 121, -99, -57, -15, 27, 69, 111, -109, -67, -25, 17, 59, 101, -119, -77, -35, 7, 49, 91, -129, -87, -45, -3, 39, 81, 123, -97, -55, -13, 29, 71, 113, -107, -65, -23, 19, 61, 103, -117, -75, -33, 9, 51, 93, -127, -85, -43, -1, 41, 83, 125, -95, -53, -11, 31, 73, 115, -105, -63, -21],
[-87, -43, 1, 45, 89, -129, -85, -41, 3, 47, 91, -127, -83, -39, 5, 49, 93, -125, -81, -37, 7, 51, 95, -123, -79, -35, 9, 53, 97, -121, -77, -33, 11, 55, 99, -119, -75, -31, 13, 57, 101, -117, -73, -29, 15, 59, 103, -115, -71, -27, 17, 61, 105, -113, -69, -25, 19, 63, 107, -111, -67, -23, 21, 65, 109],
[-85, -39, 7, 53, 99, -117, -71, -25, 21, 67, 113, -103, -57, -11, 35, 81, 127, -89, -43, 3, 49, 95, -121, -75, -29, 17, 63, 109, -107, -61, -15, 31, 77, 123, -93, -47, -1, 45, 91, -125, -79, -33, 13, 59, 105, -111, -65, -19, 27, 73, 119, -97, -51, -5, 41, 87, -129, -83, -37, 9, 55, 101, -115, -69, -23],
[-83, -35, 13, 61, 109, -105, -57, -9, 39, 87, -127, -79, -31, 17, 65, 113, -101, -53, -5, 43, 91, -123, -75, -27, 21, 69, 117, -97, -49, -1, 47, 95, -119, -71, -23, 25, 73, 121, -93, -45, 3, 51, 99, -115, -67, -19, 29, 77, 125, -89, -41, 7, 55, 103, -111, -63, -15, 33, 81, 129, -85, -37, 11, 59, 107],
[-81, -31, 19, 69, 119, -93, -43, 7, 57, 107, -105, -55, -5, 45, 95, -117, -67, -17, 33, 83, -129, -79, -29, 21, 71, 121, -91, -41, 9, 59, 109, -103, -53, -3, 47, 97, -115, -65, -15, 35, 85, -127, -77, -27, 23, 73, 123, -89, -39, 11, 61, 111, -101, -51, -1, 49, 99, -113, -63, -13, 37, 87, -125, -75, -25],
[-79, -27, 25, 77, 129, -81, -29, 23, 75, 127, -83, -31, 21, 73, 125, -85, -33, 19, 71, 123, -87, -35, 17, 69, 121, -89, -37, 15, 67, 119, -91, -39, 13, 65, 117, -93, -41, 11, 63, 115, -95, -43, 9, 61, 113, -97, -45, 7, 59, 111, -99, -47, 5, 57, 109, -101, -49, 3, 55, 107, -103, -51, 1, 53, 105],
[-77, -23, 31, 85, -123, -69, -15, 39, 93, -115, -61, -7, 47, 101, -107, -53, 1, 55, 109, -99, -45, 9, 63, 117, -91, -37, 17, 71, 125, -83, -29, 25, 79, -129, -75, -21, 33, 87, -121, -67, -13, 41, 95, -113, -59, -5, 49, 103, -105, -51, 3, 57, 111, -97, -43, 11, 65, 119, -89, -35, 19, 73, 127, -81, -27],
[-75, -19, 37, 93, -113, -57, -1, 55, 111, -95, -39, 17, 73, 129, -77, -21, 35, 91, -115, -59, -3, 53, 109, -97, -41, 15, 71, 127, -79, -23, 33, 89, -117, -61, -5, 51, 107, -99, -43, 13, 69, 125, -81, -25, 31, 87, -119, -63, -7, 49, 105, -101, -45, 11, 67, 123, -83, -27, 29, 85, -121, -65, -9, 47, 103],
[-73, -15, 43, 101, -103, -45, 13, 71, 129, -75, -17, 41, 99, -105, -47, 11, 69, 127, -77, -19, 39, 97, -107, -49, 9, 67, 125, -79, -21, 37, 95, -109, -51, 7, 65, 123, -81, -23, 35, 93, -111, -53, 5, 63, 121, -83, -25, 33, 91, -113, -55, 3, 61, 119, -85, -27, 31, 89, -115, -57, 1, 59, 117, -87, -29],
[-71, -11, 49, 109, -93, -33, 27, 87, -115, -55, 5, 65, 125, -77, -17, 43, 103, -99, -39, 21, 81, -121, -61, -1, 59, 119, -83, -23, 37, 97, -105, -45, 15, 75, -127, -67, -7, 53, 113, -89, -29, 31, 91, -111, -51, 9, 69, 129, -73, -13, 47, 107, -95, -35, 25, 85, -117, -57, 3, 63, 123, -79, -19, 41, 101],
[-69, -7, 55, 117, -83, -21, 41, 103, -97, -35, 27, 89, -111, -49, 13, 75, -125, -63, -1, 61, 123, -77, -15, 47, 109, -91, -29, 33, 95, -105, -43, 19, 81, -119, -57, 5, 67, 129, -71, -9, 53, 115, -85, -23, 39, 101, -99, -37, 25, 87, -113, -51, 11, 73, -127, -65, -3, 59, 121, -79, -17, 45, 107, -93, -31],
[-67, -3, 61, 125, -73, -9, 55, 119, -79, -15, 49, 113, -85, -21, 43, 107, -91, -27, 37, 101, -97, -33, 31, 95, -103, -39, 25, 89, -109, -45, 19, 83, -115, -51, 13, 77, -121, -57, 7, 71, -127, -63, 1, 65, 129, -69, -5, 59, 123, -75, -11, 53, 117, -81, -17, 47, 111, -87, -23, 41, 105, -93, -29, 35, 99],
[-65, 1, 67, -129, -63, 3, 69, -127, -61, 5, 71, -125, -59, 7, 73, -123, -57, 9, 75, -121, -55, 11, 77, -119, -53, 13, 79, -117, -51, 15, 81, -115, -49, 17, 83, -113, -47, 19, 85, -111, -45, 21, 87, -109, -43, 23, 89, -107, -41, 25, 91, -105, -39, 27, 93, -103, -37, 29, 95, -101, -35, 31, 97, -99, -33],
[-63, 5, 73, -121, -53, 15, 83, -111, -43, 25, 93, -101, -33, 35, 103, -91, -23, 45, 113, -81, -13, 55, 123, -71, -3, 65, -129, -61, 7, 75, -119, -51, 17, 85, -109, -41, 27, 95, -99, -31, 37, 105, -89, -21, 47, 115, -79, -11, 57, 125, -69, -1, 67, -127, -59, 9, 77, -117, -49, 19, 87, -107, -39, 29, 97],
[-61, 9, 79, -113, -43, 27, 97, -95, -25, 45, 115, -77, -7, 63, -129, -59, 11, 81, -111, -41, 29, 99, -93, -23, 47, 117, -75, -5, 65, -127, -57, 13, 83, -109, -39, 31, 101, -91, -21, 49, 119, -73, -3, 67, -125, -55, 15, 85, -107, -37, 33, 103, -89, -19, 51, 121, -71, -1, 69, -123, -53, 17, 87, -105, -35],
[-59, 13, 85, -105, -33, 39, 111, -79, -7, 65, -125, -53, 19, 91, -99, -27, 45, 117, -73, -1, 71, -119, -47, 25, 97, -93, -21, 51, 123, -67, 5, 77, -113, -41, 31, 103, -87, -15, 57, 129, -61, 11, 83, -107, -35, 37, 109, -81, -9, 63, -127, -55, 17, 89, -101, -29, 43, 115, -75, -3, 69, -121, -49, 23, 95],
[-57, 17, 91, -97, -23, 51, 125, -63, 11, 85, -103, -29, 45, 119, -69, 5, 79, -109, -35, 39, 113, -75, -1, 73, -115, -41, 33, 107, -81, -7, 67, -121, -47, 27, 101, -87, -13, 61, -127, -53, 21, 95, -93, -19, 55, 129, -59, 15, 89, -99, -25, 49, 123, -65, 9, 83, -105, -31, 43, 117, -71, 3, 77, -111, -37],
[-55, 21, 97, -89, -13, 63, -123, -47, 29, 105, -81, -5, 71, -115, -39, 37, 113, -73, 3, 79, -107, -31, 45, 121, -65, 11, 87, -99, -23, 53, 129, -57, 19, 95, -91, -15, 61, -125, -49, 27, 103, -83, -7, 69, -117, -41, 35, 111, -75, 1, 77, -109, -33, 43, 119, -67, 9, 85, -101, -25, 51, 127, -59, 17, 93],
[-53, 25, 103, -81, -3, 75, -109, -31, 47, 125, -59, 19, 97, -87, -9, 69, -115, -37, 41, 119, -65, 13, 91, -93, -15, 63, -121, -43, 35, 113, -71, 7, 85, -99, -21, 57, -127, -49, 29, 107, -77, 1, 79, -105, -27, 51, 129, -55, 23, 101, -83, -5, 73, -111, -33, 45, 123, -61, 17, 95, -89, -11, 67, -117, -39],
[-51, 29, 109, -73, 7, 87, -95, -15, 65, -117, -37, 43, 123, -59, 21, 101, -81, -1, 79, -103, -23, 57, -125, -45, 35, 115, -67, 13, 93, -89, -9, 71, -111, -31, 49, 129, -53, 27, 107, -75, 5, 85, -97, -17, 63, -119, -39, 41, 121, -61, 19, 99, -83, -3, 77, -105, -25, 55, -127, -47, 33, 113, -69, 11, 91],
[-49, 33, 115, -65, 17, 99, -81, 1, 83, -97, -15, 67, -113, -31, 51, -129, -47, 35, 117, -63, 19, 101, -79, 3, 85, -95, -13, 69, -111, -29, 53, -127, -45, 37, 119, -61, 21, 103, -77, 5, 87, -93, -11, 71, -109, -27, 55, -125, -43, 39, 121, -59, 23, 105, -75, 7, 89, -91, -9, 73, -107, -25, 57, -123, -41],
[-47, 37, 121, -57, 27, 111, -67, 17, 101, -77, 7, 91, -87, -3, 81, -97, -13, 71, -107, -23, 61, -117, -33, 51, -127, -43, 41, 125, -53, 31, 115, -63, 21, 105, -73, 11, 95, -83, 1, 85, -93, -9, 75, -103, -19, 65, -113, -29, 55, -123, -39, 45, 129, -49, 35, 119, -59, 25, 109, -69, 15, 99, -79, 5, 89],
[-45, 41, 127, -49, 37, 123, -53, 33, 119, -57, 29, 115, -61, 25, 111, -65, 21, 107, -69, 17, 103, -73, 13, 99, -77, 9, 95, -81, 5, 91, -85, 1, 87, -89, -3, 83, -93, -7, 79, -97, -11, 75, -101, -15, 71, -105, -19, 67, -109, -23, 63, -113, -27, 59, -117, -31, 55, -121, -35, 51, -125, -39, 47, -129, -43],
[-43, 45, -129, -41, 47, -127, -39, 49, -125, -37, 51, -123, -35, 53, -121, -33, 55, -119, -31, 57, -117, -29, 59, -115, -27, 61, -113, -25, 63, -111, -23, 65, -109, -21, 67, -107, -19, 69, -105, -17, 71, -103, -15, 73, -101, -13, 75, -99, -11, 77, -97, -9, 79, -95, -7, 81, -93, -5, 83, -91, -3, 85, -89, -1, 87],
[-41, 49, -123, -33, 57, -115, -25, 65, -107, -17, 73, -99, -9, 81, -91, -1, 89, -83, 7, 97, -75, 15, 105, -67, 23, 113, -59, 31, 121, -51, 39, 129, -43, 47, -125, -35, 55, -117, -27, 63, -109, -19, 71, -101, -11, 79, -93, -3, 87, -85, 5, 95, -77, 13, 103, -69, 21, 111, -61, 29, 119, -53, 37, 127, -45],
[-39, 53, -117, -25, 67, -103, -11, 81, -89, 3, 95, -75, 17, 109, -61, 31, 123, -47, 45, -125, -33, 59, -111, -19, 73, -97, -5, 87, -83, 9, 101, -69, 23, 115, -55, 37, 129, -41, 51, -119, -27, 65, -105, -13, 79, -91, 1, 93, -77, 15, 107, -63, 29, 121, -49, 43, -127, -35, 57, -113, -21, 71, -99, -7, 85],
[-37, 57, -111, -17, 77, -91, 3, 97, -71, 23, 117, -51, 43, -125, -31, 63, -105, -11, 83, -85, 9, 103, -65, 29, 123, -45, 49, -119, -25, 69, -99, -5, 89, -79, 15, 109, -59, 35, 129, -39, 55, -113, -19, 75, -93, 1, 95, -73, 21, 115, -53, 41, -127, -33, 61, -107, -13, 81, -87, 7, 101, -67, 27, 121, -47],
[-35, 61, -105, -9, 87, -79, 17, 113, -53, 43, -123, -27, 69, -97, -1, 95, -71, 25, 121, -45, 51, -115, -19, 77, -89, 7, 103, -63, 33, 129, -37, 59, -107, -11, 85, -81, 15, 111, -55, 41, -125, -29, 67, -99, -3, 93, -73, 23, 119, -47, 49, -117, -21, 75, -91, 5, 101, -65, 31, 127, -39, 57, -109, -13, 83],
[-33, 65, -99, -1, 97, -67, 31, 129, -35, 63, -101, -3, 95, -69, 29, 127, -37, 61, -103, -5, 93, -71, 27, 125, -39, 59, -105, -7, 91, -73, 25, 123, -41, 57, -107, -9, 89, -75, 23, 121, -43, 55, -109, -11, 87, -77, 21, 119, -45, 53, -111, -13, 85, -79, 19, 117, -47, 51, -113, -15, 83, -81, 17, 115, -49],
[-31, 69, -93, 7, 107, -55, 45, -117, -17, 83, -79, 21, 121, -41, 59, -103, -3, 97, -65, 35, -127, -27, 73, -89, 11, 111, -51, 49, -113, -13, 87, -75, 25, 125, -37, 63, -99, 1, 101, -61, 39, -123, -23, 77, -85, 15, 115, -47, 53, -109, -9, 91, -71, 29, 129, -33, 67, -95, 5, 105, -57, 43, -119, -19, 81],
[-29, 73, -87, 15, 117, -43, 59, -101, 1, 103, -57, 45, -115, -13, 89, -71, 31, -129, -27, 75, -85, 17, 119, -41, 61, -99, 3, 105, -55, 47, -113, -11, 91, -69, 33, -127, -25, 77, -83, 19, 121, -39, 63, -97, 5, 107, -53, 49, -111, -9, 93, -67, 35, -125, -23, 79, -81, 21, 123, -37, 65, -95, 7, 109, -51],
[-27, 77, -81, 23, 127, -31, 73, -85, 19, 123, -35, 69, -89, 15, 119, -39, 65, -93, 11, 115, -43, 61, -97, 7, 111, -47, 57, -101, 3, 107, -51, 53, -105, -1, 103, -55, 49, -109, -5, 99, -59, 45, -113, -9, 95, -63, 41, -117, -13, 91, -67, 37, -121, -17, 87, -71, 33, -125, -21, 83, -75, 29, -129, -25, 79],
[-25, 81, -75, 31, -125, -19, 87, -69, 37, -119, -13, 93, -63, 43, -113, -7, 99, -57, 49, -107, -1, 105, -51, 55, -101, 5, 111, -45, 61, -95, 11, 117, -39, 67, -89, 17, 123, -33, 73, -83, 23, 129, -27, 79, -77, 29, -127, -21, 85, -71, 35, -121, -15, 91, -65, 41, -115, -9, 97, -59, 47, -109, -3, 103, -53],
[-23, 85, -69, 39, -115, -7, 101, -53, 55, -99, 9, 117, -37, 71, -83, 25, -129, -21, 87, -67, 41, -113, -5, 103, -51, 57, -97, 11, 119, -35, 73, -81, 27, -127, -19, 89, -65, 43, -111, -3, 105, -49, 59, -95, 13, 121, -33, 75, -79, 29, -125, -17, 91, -63, 45, -109, -1, 107, -47, 61, -93, 15, 123, -31, 77],
[-21, 89, -63, 47, -105, 5, 115, -37, 73, -79, 31, -121, -11, 99, -53, 57, -95, 15, 125, -27, 83, -69, 41, -111, -1, 109, -43, 67, -85, 25, -127, -17, 93, -59, 51, -101, 9, 119, -33, 77, -75, 35, -117, -7, 103, -49, 61, -91, 19, 129, -23, 87, -65, 45, -107, 3, 113, -39, 71, -81, 29, -123, -13, 97, -55],
[-19, 93, -57, 55, -95, 17, 129, -21, 91, -59, 53, -97, 15, 127, -23, 89, -61, 51, -99, 13, 125, -25, 87, -63, 49, -101, 11, 123, -27, 85, -65, 47, -103, 9, 121, -29, 83, -67, 45, -105, 7, 119, -31, 81, -69, 43, -107, 5, 117, -33, 79, -71, 41, -109, 3, 115, -35, 77, -73, 39, -111, 1, 113, -37, 75],
[-17, 97, -51, 63, -85, 29, -119, -5, 109, -39, 75, -73, 41, -107, 7, 121, -27, 87, -61, 53, -95, 19, -129, -15, 99, -49, 65, -83, 31, -117, -3, 111, -37, 77, -71, 43, -105, 9, 123, -25, 89, -59, 55, -93, 21, -127, -13, 101, -47, 67, -81, 33, -115, -1, 113, -35, 79, -69, 45, -103, 11, 125, -23, 91, -57],
[-15, 101, -45, 71, -75, 41, -105, 11, 127, -19, 97, -49, 67, -79, 37, -109, 7, 123, -23, 93, -53, 63, -83, 33, -113, 3, 119, -27, 89, -57, 59, -87, 29, -117, -1, 115, -31, 85, -61, 55, -91, 25, -121, -5, 111, -35, 81, -65, 51, -95, 21, -125, -9, 107, -39, 77, -69, 47, -99, 17, -129, -13, 103, -43, 73],
[-13, 105, -39, 79, -65, 53, -91, 27, -117, 1, 119, -25, 93, -51, 67, -77, 41, -103, 15, -129, -11, 107, -37, 81, -63, 55, -89, 29, -115, 3, 121, -23, 95, -49, 69, -75, 43, -101, 17, -127, -9, 109, -35, 83, -61, 57, -87, 31, -113, 5, 123, -21, 97, -47, 71, -73, 45, -99, 19, -125, -7, 111, -33, 85, -59],
[-11, 109, -33, 87, -55, 65, -77, 43, -99, 21, -121, -1, 119, -23, 97, -45, 75, -67, 53, -89, 31, -111, 9, 129, -13, 107, -35, 85, -57, 63, -79, 41, -101, 19, -123, -3, 117, -25, 95, -47, 73, -69, 51, -91, 29, -113, 7, 127, -15, 105, -37, 83, -59, 61, -81, 39, -103, 17, -125, -5, 115, -27, 93, -49, 71],
[-9, 113, -27, 95, -45, 77, -63, 59, -81, 41, -99, 23, -117, 5, 127, -13, 109, -31, 91, -49, 73, -67, 55, -85, 37, -103, 19, -121, 1, 123, -17, 105, -35, 87, -53, 69, -71, 51, -89, 33, -107, 15, -125, -3, 119, -21, 101, -39, 83, -57, 65, -75, 47, -93, 29, -111, 11, -129, -7, 115, -25, 97, -43, 79, -61],
[-7, 117, -21, 103, -35, 89, -49, 75, -63, 61, -77, 47, -91, 33, -105, 19, -119, 5, 129, -9, 115, -23, 101, -37, 87, -51, 73, -65, 59, -79, 45, -93, 31, -107, 17, -121, 3, 127, -11, 113, -25, 99, -39, 85, -53, 71, -67, 57, -81, 43, -95, 29, -109, 15, -123, 1, 125, -13, 111, -27, 97, -41, 83, -55, 69],
[-5, 121, -15, 111, -25, 101, -35, 91, -45, 81, -55, 71, -65, 61, -75, 51, -85, 41, -95, 31, -105, 21, -115, 11, -125, 1, 127, -9, 117, -19, 107, -29, 97, -39, 87, -49, 77, -59, 67, -69, 57, -79, 47, -89, 37, -99, 27, -109, 17, -119, 7, -129, -3, 123, -13, 113, -23, 103, -33, 93, -43, 83, -53, 73, -63],
[-3, 125, -9, 119, -15, 113, -21, 107, -27, 101, -33, 95, -39, 89, -45, 83, -51, 77, -57, 71, -63, 65, -69, 59, -75, 53, -81, 47, -87, 41, -93, 35, -99, 29, -105, 23, -111, 17, -117, 11, -123, 5, -129, -1, 127, -7, 121, -13, 115, -19, 109, -25, 103, -31, 97, -37, 91, -43, 85, -49, 79, -55, 73, -61, 67],
[-1, 129, -3, 127, -5, 125, -7, 123, -9, 121, -11, 119, -13, 117, -15, 115, -17, 113, -19, 111, -21, 109, -23, 107, -25, 105, -27, 103, -29, 101, -31, 99, -33, 97, -35, 95, -37, 93, -39, 91, -41, 89, -43, 87, -45, 85, -47, 83, -49, 81, -51, 79, -53, 77, -55, 75, -57, 73, -59, 71, -61, 69, -63, 67, -65]]
def B : List (List Int) := [
[-90555098971090761, -100213837876841329, 3974861451078069, 130341536161486094, -190061233131800796, -127251056459255809, -172882856902671996, -242129032370283334, -76073123672322776, 75211943846139206, -242119316724287121, -120047736105625751, -100790428931820816, -107026085856827344, -185152050693032741, -86231316152740926, -512169044908024434, -159824545193450114, -253019078109083464, -300862 -- (+945 chars; full line in the Zenodo source)
[-100213837876841329, 130341536161486094, -127251056459255809, -242129032370283334, 75211943846139206, -120047736105625751, -107026085856827344, -86231316152740926, -159824545193450114, -300862688502154616, -136320743070204444, -110067227741557414, -417883255433106949, -164006309095319916, -174018236244678974, -360546686070360489, 51613711525483074, -209893704244608446, -434161239230367746, -575 -- (+914 chars; full line in the Zenodo source)
[3974861451078069, -127251056459255809, -76073123672322776, -120047736105625751, -185152050693032741, -159824545193450114, -309384225260959966, -110067227741557414, -390882016485404396, -174018236244678974, -255688502747181316, -209893704244608446, -277433430863358511, -115390623082288374, -393364165091276786, -20862410978948221, -208520989451843039, 59264107732330181, -245125581179642944, 19134 -- (+925 chars; full line in the Zenodo source)
[130341536161486094, -242129032370283334, -120047736105625751, -86231316152740926, -300862688502154616, -110067227741557414, -164006309095319916, -360546686070360489, -209893704244608446, -57557283167007124, -125264622039168566, -20862410978948221, -43726913483538336, -71075128354315849, 191340773242178839, 175904631570904279, 41864531293722236, 271916206051569081, 379754396860898281, 2085209894 -- (+925 chars; full line in the Zenodo source)
[-190061233131800796, 75211943846139206, -185152050693032741, -300862688502154616, -176376865697724131, -174018236244678974, -385836012822425731, -57557283167007124, -393364165091276786, -284552638372069184, -379754396860898281, 191340773242178839, -168002531350440751, 231810297128935116, 71075128354315849, 208520989451843039, 133693168798250851, 613199000398801121, 209893704244608446, 542909841 -- (+921 chars; full line in the Zenodo source)
[-127251056459255809, -120047736105625751, -159824545193450114, -110067227741557414, -174018236244678974, -209893704244608446, -115390623082288374, -20862410978948221, 59264107732330181, 191340773242178839, 168002531350440751, 271916206051569081, 363830500889214321, 512627993673027139, 613199000398801121, 385836012822425731, 439697034350029679, 253556199139854634, 512169044908024434, 24211931672 -- (+924 chars; full line in the Zenodo source)
[-172882856902671996, -107026085856827344, -309384225260959966, -164006309095319916, -385836012822425731, -115390623082288374, -349447221393001031, -71075128354315849, -41864531293722236, 231810297128935116, -59264107732330181, 512627993673027139, 57557283167007124, 255688502747181316, 417883255433106949, 253019078109083464, 120047736105625751, 190061233131800796, -100213837876841329, -760731236 -- (+925 chars; full line in the Zenodo source)
[-242129032370283334, -86231316152740926, -110067227741557414, -360546686070360489, -57557283167007124, -20862410978948221, -71075128354315849, 175904631570904279, 271916206051569081, 208520989451843039, 466448473039200501, 385836012822425731, 390882016485404396, 253019078109083464, 242119316724287121, -3974861451078069, -190061233131800796, -100790428931820816, -309384225260959966, -43969703435 -- (+922 chars; full line in the Zenodo source)
[-76073123672322776, -159824545193450114, -390882016485404396, -209893704244608446, -393364165091276786, 59264107732330181, -41864531293722236, 271916206051569081, 284552638372069184, 613199000398801121, 360546686070360489, 253556199139854634, 107026085856827344, 190061233131800796, 130341536161486094, -100790428931820816, -136320743070204444, -542909841035329699, -57557283167007124, -3494472213 -- (+921 chars; full line in the Zenodo source)
[75211943846139206, -300862688502154616, -174018236244678974, -57557283167007124, -284552638372069184, 191340773242178839, 231810297128935116, 208520989451843039, 613199000398801121, 542909841035329699, 309384225260959966, 242119316724287121, 90555098971090761, -76073123672322776, -253019078109083464, -439697034350029679, -277433430863358511, -349447221393001031, -271916206051569081, -6420145881 -- (+922 chars; full line in the Zenodo source)
[-242119316724287121, -136320743070204444, -255688502747181316, -125264622039168566, -379754396860898281, 168002531350440751, -59264107732330181, 466448473039200501, 360546686070360489, 309384225260959966, -75211943846139206, -90555098971090761, -120047736105625751, -253556199139854634, 51613711525483074, -393364165091276786, -71075128354315849, -175904631570904279, 363830500889214321, 115390623 -- (+923 chars; full line in the Zenodo source)
[-120047736105625751, -110067227741557414, -209893704244608446, -20862410978948221, 191340773242178839, 271916206051569081, 512627993673027139, 385836012822425731, 253556199139854634, 242119316724287121, -90555098971090761, -100790428931820816, -176376865697724131, -402269856293814929, -349447221393001031, -231810297128935116, -188463910663048944, 133693168798250851, -51613711525483074, 13632074 -- (+923 chars; full line in the Zenodo source)
[-100790428931820816, -417883255433106949, -277433430863358511, -43726913483538336, -168002531350440751, 363830500889214321, 57557283167007124, 390882016485404396, 107026085856827344, 90555098971090761, -120047736105625751, -176376865697724131, -434161239230367746, -208520989451843039, 175904631570904279, -59264107732330181, 613199000398801121, 164006309095319916, 185152050693032741, 10021383787 -- (+923 chars; full line in the Zenodo source)
[-107026085856827344, -164006309095319916, -115390623082288374, -71075128354315849, 231810297128935116, 512627993673027139, 255688502747181316, 253019078109083464, 190061233131800796, -76073123672322776, -253556199139854634, -402269856293814929, -208520989451843039, -168002531350440751, 43726913483538336, 434161239230367746, 110067227741557414, -75211943846139206, 130341536161486094, -1598245451 -- (+920 chars; full line in the Zenodo source)
[-185152050693032741, -174018236244678974, -393364165091276786, 191340773242178839, 71075128354315849, 613199000398801121, 417883255433106949, 242119316724287121, 130341536161486094, -253019078109083464, 51613711525483074, -349447221393001031, 175904631570904279, 43726913483538336, 402269856293814929, 136320743070204444, 172882856902671996, -242129032370283334, -253556199139854634, -434161239230 -- (+921 chars; full line in the Zenodo source)
[-86231316152740926, -360546686070360489, -20862410978948221, 175904631570904279, 208520989451843039, 385836012822425731, 253019078109083464, -3974861451078069, -100790428931820816, -439697034350029679, -393364165091276786, -231810297128935116, -59264107732330181, 434161239230367746, 136320743070204444, 127251056459255809, 75211943846139206, -417883255433106949, -115390623082288374, 188463910663 -- (+921 chars; full line in the Zenodo source)
[-512169044908024434, 51613711525483074, -208520989451843039, 41864531293722236, 133693168798250851, 439697034350029679, 120047736105625751, -190061233131800796, -136320743070204444, -277433430863358511, -71075128354315849, -188463910663048944, 613199000398801121, 110067227741557414, 172882856902671996, 75211943846139206, -390882016485404396, -125264622039168566, -231810297128935116, 36383050088 -- (+922 chars; full line in the Zenodo source)
[-159824545193450114, -209893704244608446, 59264107732330181, 271916206051569081, 613199000398801121, 253556199139854634, 190061233131800796, -100790428931820816, -542909841035329699, -349447221393001031, -175904631570904279, 133693168798250851, 164006309095319916, -75211943846139206, -242129032370283334, -417883255433106949, -125264622039168566, 64201458817828764, 208520989451843039, 2556885027 -- (+920 chars; full line in the Zenodo source)
[-253019078109083464, -434161239230367746, -245125581179642944, 379754396860898281, 209893704244608446, 512169044908024434, -100213837876841329, -309384225260959966, -57557283167007124, -271916206051569081, 363830500889214321, -51613711525483074, 185152050693032741, 130341536161486094, -253556199139854634, -115390623082288374, -231810297128935116, 208520989451843039, 360546686070360489, 10079042 -- (+926 chars; full line in the Zenodo source)
[-300862688502154616, -57557283167007124, 191340773242178839, 208520989451843039, 542909841035329699, 242119316724287121, -76073123672322776, -439697034350029679, -349447221393001031, -64201458817828764, 115390623082288374, 136320743070204444, 100213837876841329, -159824545193450114, -434161239230367746, 188463910663048944, 363830500889214321, 255688502747181316, 100790428931820816, -17288285690 -- (+921 chars; full line in the Zenodo source)
[-309384225260959966, -115390623082288374, -41864531293722236, 512627993673027139, 417883255433106949, 190061233131800796, -86231316152740926, -402269856293814929, 188463910663048944, 43726913483538336, 542909841035329699, -75211943846139206, -242119316724287121, -360546686070360489, -363830500889214321, 245125581179642944, 209893704244608446, 185152050693032741, -127251056459255809, -3908820164 -- (+923 chars; full line in the Zenodo source)
[-136320743070204444, -125264622039168566, 168002531350440751, 466448473039200501, 309384225260959966, -90555098971090761, -253556199139854634, -393364165091276786, -175904631570904279, 115390623082288374, 300862688502154616, -100213837876841329, -110067227741557414, -133693168798250851, 41864531293722236, 613199000398801121, 253019078109083464, 3974861451078069, -176376865697724131, -5126279936 -- (+922 chars; full line in the Zenodo source)
[-253556199139854634, -133693168798250851, -64201458817828764, 277433430863358511, 86231316152740926, -172882856902671996, -174018236244678974, -363830500889214321, 379754396860898281, 360546686070360489, 76073123672322776, -107026085856827344, -402269856293814929, 191340773242178839, 20862410978948221, 176376865697724131, 100213837876841329, -309384225260959966, -125264622039168566, -1759046315 -- (+922 chars; full line in the Zenodo source)
[-110067227741557414, -20862410978948221, 271916206051569081, 385836012822425731, 242119316724287121, -100790428931820816, -402269856293814929, -231810297128935116, 133693168798250851, 136320743070204444, -100213837876841329, -417883255433106949, -284552638372069184, 245125581179642944, 255688502747181316, 76073123672322776, -185152050693032741, -277433430863358511, -41864531293722236, 125264622 -- (+920 chars; full line in the Zenodo source)
[-176376865697724131, -284552638372069184, 71075128354315849, 542909841035329699, 127251056459255809, -253019078109083464, -125264622039168566, -64201458817828764, 402269856293814929, 120047736105625751, -100790428931820816, -434161239230367746, -41864531293722236, 466448473039200501, 159824545193450114, -172882856902671996, -360546686070360489, -245125581179642944, 349447221393001031, 110067227 -- (+925 chars; full line in the Zenodo source)
[-417883255433106949, -43726913483538336, 363830500889214321, 390882016485404396, 90555098971090761, -176376865697724131, -208520989451843039, -59264107732330181, 164006309095319916, 100213837876841329, -110067227741557414, -284552638372069184, 379754396860898281, 439697034350029679, -3974861451078069, -253556199139854634, -349447221393001031, 71075128354315849, 174018236244678974, -130341536161 -- (+924 chars; full line in the Zenodo source)
[-390882016485404396, 59264107732330181, 284552638372069184, 253556199139854634, 130341536161486094, -542909841035329699, 188463910663048944, 133693168798250851, 253019078109083464, -242129032370283334, -385836012822425731, 64201458817828764, 115390623082288374, 185152050693032741, -120047736105625751, -277433430863358511, 168002531350440751, 434161239230367746, 242119316724287121, -862313161527 -- (+923 chars; full line in the Zenodo source)
[-164006309095319916, -71075128354315849, 512627993673027139, 253019078109083464, -76073123672322776, -402269856293814929, -168002531350440751, 434161239230367746, -75211943846139206, -159824545193450114, -133693168798250851, 245125581179642944, 439697034350029679, 90555098971090761, -390882016485404396, -379754396860898281, 20862410978948221, 300862688502154616, -242129032370283334, -2098937042 -- (+923 chars; full line in the Zenodo source)
[-439697034350029679, 188463910663048944, 125264622039168566, 185152050693032741, -107026085856827344, -466448473039200501, 271916206051569081, 174018236244678974, 90555098971090761, -164006309095319916, -245125581179642944, 393364165091276786, 86231316152740926, -100790428931820816, -115390623082288374, -191340773242178839, 542909841035329699, 100213837876841329, -390882016485404396, -710751283 -- (+922 chars; full line in the Zenodo source)
[-174018236244678974, 191340773242178839, 613199000398801121, 242119316724287121, -253019078109083464, -349447221393001031, 43726913483538336, 136320743070204444, -242129032370283334, -434161239230367746, 41864531293722236, 255688502747181316, -3974861451078069, -390882016485404396, -245125581179642944, 125264622039168566, 107026085856827344, -86231316152740926, -133693168798250851, 379754396860 -- (+922 chars; full line in the Zenodo source)
[-542909841035329699, 64201458817828764, 434161239230367746, 172882856902671996, -110067227741557414, -379754396860898281, 393364165091276786, 107026085856827344, -512169044908024434, -20862410978948221, 43726913483538336, 309384225260959966, 75211943846139206, -613199000398801121, 271916206051569081, 164006309095319916, 3974861451078069, 51613711525483074, -168002531350440751, 38583601282242573 -- (+918 chars; full line in the Zenodo source)
[-360546686070360489, 175904631570904279, 385836012822425731, -3974861451078069, -439697034350029679, -231810297128935116, 434161239230367746, 127251056459255809, -417883255433106949, 188463910663048944, 613199000398801121, 76073123672322776, -253556199139854634, -379754396860898281, 125264622039168566, 120047736105625751, -300862688502154616, -43726913483538336, 512627993673027139, 185152050693 -- (+920 chars; full line in the Zenodo source)
[-255688502747181316, 168002531350440751, 360546686070360489, -90555098971090761, 51613711525483074, -175904631570904279, 542909841035329699, -100213837876841329, -385836012822425731, 41864531293722236, 174018236244678974, 3974861451078069, -209893704244608446, -64201458817828764, 439697034350029679, 130341536161486094, -402269856293814929, 231810297128935116, 164006309095319916, -19006123313180 -- (+923 chars; full line in the Zenodo source)
[51613711525483074, 41864531293722236, 439697034350029679, -190061233131800796, -277433430863358511, -188463910663048944, 110067227741557414, 75211943846139206, -125264622039168566, 363830500889214321, 253019078109083464, -185152050693032741, -349447221393001031, 20862410978948221, 107026085856827344, -300862688502154616, 59264107732330181, 466448473039200501, 76073123672322776, -176376865697724 -- (+921 chars; full line in the Zenodo source)
[-385836012822425731, 231810297128935116, 417883255433106949, -76073123672322776, -125264622039168566, 43726913483538336, 512169044908024434, -159824545193450114, -363830500889214321, 466448473039200501, 242129032370283334, -390882016485404396, 64201458817828764, -51613711525483074, -90555098971090761, -209893704244608446, -191340773242178839, 176376865697724131, 75211943846139206, -393364165091 -- (+921 chars; full line in the Zenodo source)
[-209893704244608446, 271916206051569081, 253556199139854634, -100790428931820816, -349447221393001031, 133693168798250851, -75211943846139206, -417883255433106949, 64201458817828764, 255688502747181316, 3974861451078069, -277433430863358511, 71075128354315849, 300862688502154616, -86231316152740926, -43726913483538336, 466448473039200501, 172882856902671996, -439697034350029679, -16800253135044 -- (+923 chars; full line in the Zenodo source)
[-402269856293814929, 245125581179642944, 300862688502154616, -512169044908024434, 59264107732330181, 57557283167007124, -3974861451078069, 51613711525483074, -191340773242178839, 253556199139854634, -107026085856827344, -208520989451843039, 466448473039200501, 127251056459255809, -542909841035329699, 41864531293722236, 417883255433106949, -242119316724287121, -20862410978948221, 133693168798250 -- (+922 chars; full line in the Zenodo source)
[-434161239230367746, 379754396860898281, 512169044908024434, -309384225260959966, -271916206051569081, -51613711525483074, 130341536161486094, -115390623082288374, 208520989451843039, 100790428931820816, -176376865697724131, -41864531293722236, 174018236244678974, -242129032370283334, -133693168798250851, 512627993673027139, 76073123672322776, -439697034350029679, -175904631570904279, 417883255 -- (+919 chars; full line in the Zenodo source)
[-277433430863358511, 363830500889214321, 107026085856827344, -176376865697724131, 175904631570904279, 164006309095319916, -242119316724287121, -284552638372069184, 115390623082288374, -3974861451078069, -209893704244608446, 71075128354315849, 512169044908024434, -136320743070204444, -231810297128935116, 542909841035329699, -242129032370283334, -512627993673027139, 393364165091276786, 1272510564 -- (+923 chars; full line in the Zenodo source)
[-57557283167007124, 208520989451843039, 242119316724287121, -439697034350029679, -64201458817828764, 136320743070204444, -159824545193450114, 188463910663048944, 255688502747181316, -172882856902671996, -512627993673027139, 125264622039168566, -130341536161486094, -209893704244608446, 379754396860898281, 185152050693032741, -176376865697724131, -168002531350440751, 417883255433106949, -10702608 -- (+920 chars; full line in the Zenodo source)
[-613199000398801121, 349447221393001031, 242129032370283334, -255688502747181316, 245125581179642944, 86231316152740926, -176376865697724131, 168002531350440751, 110067227741557414, -512169044908024434, 188463910663048944, 360546686070360489, -76073123672322776, -284552638372069184, 57557283167007124, -90555098971090761, -115390623082288374, 20862410978948221, 172882856902671996, 51613711525483 -- (+919 chars; full line in the Zenodo source)
[-115390623082288374, 512627993673027139, 190061233131800796, -402269856293814929, 43726913483538336, -75211943846139206, -360546686070360489, 245125581179642944, 185152050693032741, -390882016485404396, -64201458817828764, 300862688502154616, -136320743070204444, 175904631570904279, 176376865697724131, -512169044908024434, -271916206051569081, 174018236244678974, -120047736105625751, 5926410773 -- (+920 chars; full line in the Zenodo source)
[-466448473039200501, 393364165091276786, 100213837876841329, -613199000398801121, 512627993673027139, -130341536161486094, -277433430863358511, 349447221393001031, 127251056459255809, -402269856293814929, 208520989451843039, 242129032370283334, -385836012822425731, 363830500889214321, -75211943846139206, -255688502747181316, 379754396860898281, 120047736105625751, -542909841035329699, 245125581 -- (+919 chars; full line in the Zenodo source)
[-125264622039168566, 466448473039200501, -90555098971090761, -393364165091276786, 115390623082288374, -100213837876841329, -133693168798250851, 613199000398801121, 3974861451078069, -512627993673027139, 57557283167007124, 130341536161486094, -20862410978948221, 277433430863358511, -190061233131800796, -349447221393001031, 434161239230367746, -127251056459255809, -284552638372069184, 40226985629 -- (+925 chars; full line in the Zenodo source)
[-393364165091276786, 613199000398801121, 130341536161486094, -349447221393001031, 402269856293814929, -242129032370283334, -363830500889214321, 255688502747181316, -120047736105625751, -245125581179642944, 439697034350029679, -86231316152740926, -231810297128935116, 176376865697724131, -300862688502154616, -168002531350440751, 309384225260959966, -110067227741557414, -64201458817828764, 5121690 -- (+923 chars; full line in the Zenodo source)
[-133693168798250851, 277433430863358511, -172882856902671996, -363830500889214321, 360546686070360489, -107026085856827344, 191340773242178839, 176376865697724131, -309384225260959966, -175904631570904279, 159824545193450114, -164006309095319916, 245125581179642944, 242119316724287121, -385836012822425731, 284552638372069184, -130341536161486094, -115390623082288374, 466448473039200501, 3974861 -- (+921 chars; full line in the Zenodo source)
[-512627993673027139, 402269856293814929, 75211943846139206, -245125581179642944, 390882016485404396, -300862688502154616, -175904631570904279, 512169044908024434, -174018236244678974, -59264107732330181, 172882856902671996, -57557283167007124, 125264622039168566, 3974861451078069, -284552638372069184, -51613711525483074, -100790428931820816, 191340773242178839, 110067227741557414, -253556199139 -- (+924 chars; full line in the Zenodo source)
[-20862410978948221, 385836012822425731, -100790428931820816, -231810297128935116, 136320743070204444, -417883255433106949, 245125581179642944, 76073123672322776, -277433430863358511, 125264622039168566, 130341536161486094, -43726913483538336, 542909841035329699, -512169044908024434, -168002531350440751, 159824545193450114, -174018236244678974, 363830500889214321, 190061233131800796, -4664484730 -- (+921 chars; full line in the Zenodo source)
[-349447221393001031, 255688502747181316, -86231316152740926, -168002531350440751, 512169044908024434, -360546686070360489, 284552638372069184, 90555098971090761, -20862410978948221, -51613711525483074, -185152050693032741, 175904631570904279, 159824545193450114, -542909841035329699, 208520989451843039, 100213837876841329, -512627993673027139, 385836012822425731, -107026085856827344, -4186453129 -- (+921 chars; full line in the Zenodo source)
[-284552638372069184, 542909841035329699, -253019078109083464, -64201458817828764, 120047736105625751, -434161239230367746, 466448473039200501, -172882856902671996, -245125581179642944, 110067227741557414, -417883255433106949, 379754396860898281, 190061233131800796, -393364165091276786, 209893704244608446, -107026085856827344, 175904631570904279, 512169044908024434, -255688502747181316, 20862410 -- (+924 chars; full line in the Zenodo source)
[-208520989451843039, 439697034350029679, -136320743070204444, -188463910663048944, 172882856902671996, -125264622039168566, 209893704244608446, -185152050693032741, 168002531350440751, 107026085856827344, -402269856293814929, 466448473039200501, -242129032370283334, -271916206051569081, 309384225260959966, -174018236244678974, 284552638372069184, -90555098971090761, -43726913483538336, 16400630 -- (+922 chars; full line in the Zenodo source)
[-43726913483538336, 390882016485404396, -176376865697724131, -59264107732330181, 100213837876841329, -284552638372069184, 439697034350029679, -253556199139854634, 71075128354315849, -130341536161486094, -20862410978948221, 542909841035329699, -309384225260959966, -188463910663048944, 127251056459255809, -133693168798250851, 255688502747181316, -253019078109083464, -191340773242178839, 242129032 -- (+927 chars; full line in the Zenodo source)
[-363830500889214321, 176376865697724131, -164006309095319916, 284552638372069184, 3974861451078069, -71075128354315849, 136320743070204444, -542909841035329699, 512627993673027139, -127251056459255809, -271916206051569081, 253019078109083464, 51613711525483074, 125264622039168566, -76073123672322776, 64201458817828764, 86231316152740926, -402269856293814929, 613199000398801121, -120047736105625 -- (+923 chars; full line in the Zenodo source)
[59264107732330181, 253556199139854634, -542909841035329699, 133693168798250851, -242129032370283334, 64201458817828764, 185152050693032741, -277433430863358511, 434161239230367746, -86231316152740926, 231810297128935116, 172882856902671996, -512627993673027139, 174018236244678974, -110067227741557414, 363830500889214321, -90555098971090761, -379754396860898281, 136320743070204444, -360546686070 -- (+920 chars; full line in the Zenodo source)
[-379754396860898281, 309384225260959966, 51613711525483074, 115390623082288374, -100790428931820816, 41864531293722236, 242129032370283334, -512627993673027139, 439697034350029679, -417883255433106949, 284552638372069184, -190061233131800796, 191340773242178839, 86231316152740926, -277433430863358511, 402269856293814929, -159824545193450114, -188463910663048944, -3974861451078069, -437269134835 -- (+919 chars; full line in the Zenodo source)
[-71075128354315849, 253019078109083464, -402269856293814929, 434161239230367746, -159824545193450114, 245125581179642944, 90555098971090761, -379754396860898281, 300862688502154616, -209893704244608446, 277433430863358511, -512169044908024434, -188463910663048944, 100213837876841329, 59264107732330181, 309384225260959966, -385836012822425731, 57557283167007124, -86231316152740926, 2719162060515 -- (+920 chars; full line in the Zenodo source)
[-245125581179642944, 512169044908024434, -57557283167007124, -51613711525483074, -253556199139854634, 208520989451843039, -127251056459255809, -41864531293722236, 242119316724287121, -133693168798250851, 164006309095319916, -439697034350029679, 393364165091276786, -120047736105625751, -64201458817828764, 190061233131800796, -43726913483538336, 136320743070204444, -385836012822425731, 2774334308 -- (+926 chars; full line in the Zenodo source)
[188463910663048944, 185152050693032741, -466448473039200501, 174018236244678974, -164006309095319916, 393364165091276786, -100790428931820816, -191340773242178839, 100213837876841329, -71075128354315849, 512169044908024434, -613199000398801121, 360546686070360489, -417883255433106949, 512627993673027139, -242119316724287121, -64201458817828764, -130341536161486094, 59264107732330181, 2530190781 -- (+925 chars; full line in the Zenodo source)
[-271916206051569081, 100790428931820816, -133693168798250851, 417883255433106949, -255688502747181316, 277433430863358511, -300862688502154616, 43726913483538336, -172882856902671996, 168002531350440751, 127251056459255809, -363830500889214321, 253019078109083464, -57557283167007124, 360546686070360489, -390882016485404396, 393364165091276786, -107026085856827344, -188463910663048944, -90555098 -- (+921 chars; full line in the Zenodo source)
[191340773242178839, 242119316724287121, -349447221393001031, 136320743070204444, -434161239230367746, 255688502747181316, -390882016485404396, 125264622039168566, -86231316152740926, 379754396860898281, -190061233131800796, -168002531350440751, 127251056459255809, 59264107732330181, 512169044908024434, -466448473039200501, 164006309095319916, -360546686070360489, 277433430863358511, -3093842252 -- (+917 chars; full line in the Zenodo source)
[-231810297128935116, 76073123672322776, -43726913483538336, 159824545193450114, -466448473039200501, 390882016485404396, 51613711525483074, 209893704244608446, -176376865697724131, 393364165091276786, -86231316152740926, -59264107732330181, -172882856902671996, 41864531293722236, 100213837876841329, -271916206051569081, 242119316724287121, -284552638372069184, 300862688502154616, -6131990003988 -- (+921 chars; full line in the Zenodo source)
[64201458817828764, 172882856902671996, -379754396860898281, 107026085856827344, -20862410978948221, 309384225260959966, -613199000398801121, 164006309095319916, 51613711525483074, 385836012822425731, -390882016485404396, 115390623082288374, -300862688502154616, 349447221393001031, -100790428931820816, 71075128354315849, -127251056459255809, 41864531293722236, 90555098971090761, -231810297128935 -- (+919 chars; full line in the Zenodo source)
[-41864531293722236, 190061233131800796, 188463910663048944, -75211943846139206, -363830500889214321, 185152050693032741, -20862410978948221, 300862688502154616, -466448473039200501, 176376865697724131, -434161239230367746, 174018236244678974, -255688502747181316, 385836012822425731, -164006309095319916, 57557283167007124, -253556199139854634, 393364165091276786, -159824545193450114, 28455263837 -- (+921 chars; full line in the Zenodo source)
[175904631570904279, -3974861451078069, -231810297128935116, 127251056459255809, 188463910663048944, 76073123672322776, -379754396860898281, 120047736105625751, -43726913483538336, 185152050693032741, -349447221393001031, 159824545193450114, -133693168798250851, 309384225260959966, -466448473039200501, 110067227741557414, -57557283167007124, 390882016485404396, -402269856293814929, 1740182362446 -- (+919 chars; full line in the Zenodo source)
[-168002531350440751, 90555098971090761, 175904631570904279, 100213837876841329, -41864531293722236, -3974861451078069, 64201458817828764, -130341536161486094, -231810297128935116, 190061233131800796, 191340773242178839, 127251056459255809, -271916206051569081, 172882856902671996, 188463910663048944, 242129032370283334, -245125581179642944, 76073123672322776, -71075128354315849, -752119438461392 -- (+919 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 65).map (fun t => rowA (130 + 1) t (rng 1 65)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 65 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 65 B A = sid 829561276563255529950 65 := rfl
theorem d_ne : (829561276563255529950 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 65 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 65) (h0 : mv A g = zeros 65) : g = zeros 65 :=
kernel_zero 65 829561276563255529950 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 130 65 = true := rfl
/-- **Balanced ⇒ pairs for p = 131.** A list with entries in (0, 131) that is balanced for 1 ≤ t ≤ 65
has as many copies of x as of 131 − x for every 1 ≤ x ≤ 65 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 131)
(hb : ∀ t, 1 ≤ t → t < 1 + 65 → tsum 131 t c + tsum 131 t c = c.length * 131) :
(rng 1 65).all (fun x => Nat.beq (cnt x c) (cnt (131 - x) c)) = true :=
pairs_of_bal 130 65 829561276563255529950 d_ne A B len cert A_def delta c hr hb
end MailletCert131
#print axioms MailletCert131.A_def
#print axioms MailletCert131.len
#print axioms MailletCert131.cert
#print axioms MailletCert131.d_ne
#print axioms MailletCert131.kernel
#print axioms MailletCert131.delta
#print axioms MailletCert131.pairs
lean_all/hodge/MailletCert137.lean
/-
hodge/MailletCert137.lean — T41 (goals G849b, G849c): for p = 137 the 68 × 68 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 68)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 177251030228005065273922 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 137) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert137
open MailletLin MailletBridge
def A : List (List Int) := [
[-135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 135],
[-131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-129, -121, -113, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127, 135, -131, -123, -115, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125, 133],
[-127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103, 115, 127, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, -133, -121, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, 119, 131],
[-123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, -131, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, 135, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, -133, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, 135, -123, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, 117, 133, -125, -109, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, 115, 131, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129],
[-119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, -131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, -135, -117, -99, -81, -63, -45, -27, -9],
[-117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127],
[-115, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, 127, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, -135, -113, -91, -69, -47, -25, -3, 19, 41, 63, 85, 107, 129, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, -133, -111, -89, -67, -45, -23, -1, 21, 43, 65, 87, 109, 131, -121, -99, -77, -55, -33, -11],
[-113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127, -123, -99, -75, -51, -27, -3, 21, 45, 69, 93, 117, -133, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, 131, -119, -95, -71, -47, -23, 1, 25, 49, 73, 97, 121, -129, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, 135, -115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125],
[-111, -85, -59, -33, -7, 19, 45, 71, 97, 123, -125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, -113, -87, -61, -35, -9, 17, 43, 69, 95, 121, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, -117, -91, -65, -39, -13],
[-109, -81, -53, -25, 3, 31, 59, 87, 115, -131, -103, -75, -47, -19, 9, 37, 65, 93, 121, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, -113, -85, -57, -29, -1, 27, 55, 83, 111, -135, -107, -79, -51, -23, 5, 33, 61, 89, 117, -129, -101, -73, -45, -17, 11, 39, 67, 95, 123],
[-107, -77, -47, -17, 13, 43, 73, 103, 133, -111, -81, -51, -21, 9, 39, 69, 99, 129, -115, -85, -55, -25, 5, 35, 65, 95, 125, -119, -89, -59, -29, 1, 31, 61, 91, 121, -123, -93, -63, -33, -3, 27, 57, 87, 117, -127, -97, -67, -37, -7, 23, 53, 83, 113, -131, -101, -71, -41, -11, 19, 49, 79, 109, -135, -105, -75, -45, -15],
[-105, -73, -41, -9, 23, 55, 87, 119, -123, -91, -59, -27, 5, 37, 69, 101, 133, -109, -77, -45, -13, 19, 51, 83, 115, -127, -95, -63, -31, 1, 33, 65, 97, 129, -113, -81, -49, -17, 15, 47, 79, 111, -131, -99, -67, -35, -3, 29, 61, 93, 125, -117, -85, -53, -21, 11, 43, 75, 107, -135, -103, -71, -39, -7, 25, 57, 89, 121],
[-103, -69, -35, -1, 33, 67, 101, 135, -105, -71, -37, -3, 31, 65, 99, 133, -107, -73, -39, -5, 29, 63, 97, 131, -109, -75, -41, -7, 27, 61, 95, 129, -111, -77, -43, -9, 25, 59, 93, 127, -113, -79, -45, -11, 23, 57, 91, 125, -115, -81, -47, -13, 21, 55, 89, 123, -117, -83, -49, -15, 19, 53, 87, 121, -119, -85, -51, -17],
[-101, -65, -29, 7, 43, 79, 115, -123, -87, -51, -15, 21, 57, 93, 129, -109, -73, -37, -1, 35, 71, 107, -131, -95, -59, -23, 13, 49, 85, 121, -117, -81, -45, -9, 27, 63, 99, 135, -103, -67, -31, 5, 41, 77, 113, -125, -89, -53, -17, 19, 55, 91, 127, -111, -75, -39, -3, 33, 69, 105, -133, -97, -61, -25, 11, 47, 83, 119],
[-99, -61, -23, 15, 53, 91, 129, -107, -69, -31, 7, 45, 83, 121, -115, -77, -39, -1, 37, 75, 113, -123, -85, -47, -9, 29, 67, 105, -131, -93, -55, -17, 21, 59, 97, 135, -101, -63, -25, 13, 51, 89, 127, -109, -71, -33, 5, 43, 81, 119, -117, -79, -41, -3, 35, 73, 111, -125, -87, -49, -11, 27, 65, 103, -133, -95, -57, -19],
[-97, -57, -17, 23, 63, 103, -131, -91, -51, -11, 29, 69, 109, -125, -85, -45, -5, 35, 75, 115, -119, -79, -39, 1, 41, 81, 121, -113, -73, -33, 7, 47, 87, 127, -107, -67, -27, 13, 53, 93, 133, -101, -61, -21, 19, 59, 99, -135, -95, -55, -15, 25, 65, 105, -129, -89, -49, -9, 31, 71, 111, -123, -83, -43, -3, 37, 77, 117],
[-95, -53, -11, 31, 73, 115, -117, -75, -33, 9, 51, 93, 135, -97, -55, -13, 29, 71, 113, -119, -77, -35, 7, 49, 91, 133, -99, -57, -15, 27, 69, 111, -121, -79, -37, 5, 47, 89, 131, -101, -59, -17, 25, 67, 109, -123, -81, -39, 3, 45, 87, 129, -103, -61, -19, 23, 65, 107, -125, -83, -41, 1, 43, 85, 127, -105, -63, -21],
[-93, -49, -5, 39, 83, 127, -103, -59, -15, 29, 73, 117, -113, -69, -25, 19, 63, 107, -123, -79, -35, 9, 53, 97, -133, -89, -45, -1, 43, 87, 131, -99, -55, -11, 33, 77, 121, -109, -65, -21, 23, 67, 111, -119, -75, -31, 13, 57, 101, -129, -85, -41, 3, 47, 91, 135, -95, -51, -7, 37, 81, 125, -105, -61, -17, 27, 71, 115],
[-91, -45, 1, 47, 93, -135, -89, -43, 3, 49, 95, -133, -87, -41, 5, 51, 97, -131, -85, -39, 7, 53, 99, -129, -83, -37, 9, 55, 101, -127, -81, -35, 11, 57, 103, -125, -79, -33, 13, 59, 105, -123, -77, -31, 15, 61, 107, -121, -75, -29, 17, 63, 109, -119, -73, -27, 19, 65, 111, -117, -71, -25, 21, 67, 113, -115, -69, -23],
[-89, -41, 7, 55, 103, -123, -75, -27, 21, 69, 117, -109, -61, -13, 35, 83, 131, -95, -47, 1, 49, 97, -129, -81, -33, 15, 63, 111, -115, -67, -19, 29, 77, 125, -101, -53, -5, 43, 91, -135, -87, -39, 9, 57, 105, -121, -73, -25, 23, 71, 119, -107, -59, -11, 37, 85, 133, -93, -45, 3, 51, 99, -127, -79, -31, 17, 65, 113],
[-87, -37, 13, 63, 113, -111, -61, -11, 39, 89, -135, -85, -35, 15, 65, 115, -109, -59, -9, 41, 91, -133, -83, -33, 17, 67, 117, -107, -57, -7, 43, 93, -131, -81, -31, 19, 69, 119, -105, -55, -5, 45, 95, -129, -79, -29, 21, 71, 121, -103, -53, -3, 47, 97, -127, -77, -27, 23, 73, 123, -101, -51, -1, 49, 99, -125, -75, -25],
[-85, -33, 19, 71, 123, -99, -47, 5, 57, 109, -113, -61, -9, 43, 95, -127, -75, -23, 29, 81, 133, -89, -37, 15, 67, 119, -103, -51, 1, 53, 105, -117, -65, -13, 39, 91, -131, -79, -27, 25, 77, 129, -93, -41, 11, 63, 115, -107, -55, -3, 49, 101, -121, -69, -17, 35, 87, -135, -83, -31, 21, 73, 125, -97, -45, 7, 59, 111],
[-83, -29, 25, 79, 133, -87, -33, 21, 75, 129, -91, -37, 17, 71, 125, -95, -41, 13, 67, 121, -99, -45, 9, 63, 117, -103, -49, 5, 59, 113, -107, -53, 1, 55, 109, -111, -57, -3, 51, 105, -115, -61, -7, 47, 101, -119, -65, -11, 43, 97, -123, -69, -15, 39, 93, -127, -73, -19, 35, 89, -131, -77, -23, 31, 85, -135, -81, -27],
[-81, -25, 31, 87, -131, -75, -19, 37, 93, -125, -69, -13, 43, 99, -119, -63, -7, 49, 105, -113, -57, -1, 55, 111, -107, -51, 5, 61, 117, -101, -45, 11, 67, 123, -95, -39, 17, 73, 129, -89, -33, 23, 79, 135, -83, -27, 29, 85, -133, -77, -21, 35, 91, -127, -71, -15, 41, 97, -121, -65, -9, 47, 103, -115, -59, -3, 53, 109],
[-79, -21, 37, 95, -121, -63, -5, 53, 111, -105, -47, 11, 69, 127, -89, -31, 27, 85, -131, -73, -15, 43, 101, -115, -57, 1, 59, 117, -99, -41, 17, 75, 133, -83, -25, 33, 91, -125, -67, -9, 49, 107, -109, -51, 7, 65, 123, -93, -35, 23, 81, -135, -77, -19, 39, 97, -119, -61, -3, 55, 113, -103, -45, 13, 71, 129, -87, -29],
[-77, -17, 43, 103, -111, -51, 9, 69, 129, -85, -25, 35, 95, -119, -59, 1, 61, 121, -93, -33, 27, 87, -127, -67, -7, 53, 113, -101, -41, 19, 79, -135, -75, -15, 45, 105, -109, -49, 11, 71, 131, -83, -23, 37, 97, -117, -57, 3, 63, 123, -91, -31, 29, 89, -125, -65, -5, 55, 115, -99, -39, 21, 81, -133, -73, -13, 47, 107],
[-75, -13, 49, 111, -101, -39, 23, 85, -127, -65, -3, 59, 121, -91, -29, 33, 95, -117, -55, 7, 69, 131, -81, -19, 43, 105, -107, -45, 17, 79, -133, -71, -9, 53, 115, -97, -35, 27, 89, -123, -61, 1, 63, 125, -87, -25, 37, 99, -113, -51, 11, 73, 135, -77, -15, 47, 109, -103, -41, 21, 83, -129, -67, -5, 57, 119, -93, -31],
[-73, -9, 55, 119, -91, -27, 37, 101, -109, -45, 19, 83, -127, -63, 1, 65, 129, -81, -17, 47, 111, -99, -35, 29, 93, -117, -53, 11, 75, -135, -71, -7, 57, 121, -89, -25, 39, 103, -107, -43, 21, 85, -125, -61, 3, 67, 131, -79, -15, 49, 113, -97, -33, 31, 95, -115, -51, 13, 77, -133, -69, -5, 59, 123, -87, -23, 41, 105],
[-71, -5, 61, 127, -81, -15, 51, 117, -91, -25, 41, 107, -101, -35, 31, 97, -111, -45, 21, 87, -121, -55, 11, 77, -131, -65, 1, 67, 133, -75, -9, 57, 123, -85, -19, 47, 113, -95, -29, 37, 103, -105, -39, 27, 93, -115, -49, 17, 83, -125, -59, 7, 73, -135, -69, -3, 63, 129, -79, -13, 53, 119, -89, -23, 43, 109, -99, -33],
[-69, -1, 67, 135, -71, -3, 65, 133, -73, -5, 63, 131, -75, -7, 61, 129, -77, -9, 59, 127, -79, -11, 57, 125, -81, -13, 55, 123, -83, -15, 53, 121, -85, -17, 51, 119, -87, -19, 49, 117, -89, -21, 47, 115, -91, -23, 45, 113, -93, -25, 43, 111, -95, -27, 41, 109, -97, -29, 39, 107, -99, -31, 37, 105, -101, -33, 35, 103],
[-67, 3, 73, -131, -61, 9, 79, -125, -55, 15, 85, -119, -49, 21, 91, -113, -43, 27, 97, -107, -37, 33, 103, -101, -31, 39, 109, -95, -25, 45, 115, -89, -19, 51, 121, -83, -13, 57, 127, -77, -7, 63, 133, -71, -1, 69, -135, -65, 5, 75, -129, -59, 11, 81, -123, -53, 17, 87, -117, -47, 23, 93, -111, -41, 29, 99, -105, -35],
[-65, 7, 79, -123, -51, 21, 93, -109, -37, 35, 107, -95, -23, 49, 121, -81, -9, 63, 135, -67, 5, 77, -125, -53, 19, 91, -111, -39, 33, 105, -97, -25, 47, 119, -83, -11, 61, 133, -69, 3, 75, -127, -55, 17, 89, -113, -41, 31, 103, -99, -27, 45, 117, -85, -13, 59, 131, -71, 1, 73, -129, -57, 15, 87, -115, -43, 29, 101],
[-63, 11, 85, -115, -41, 33, 107, -93, -19, 55, 129, -71, 3, 77, -123, -49, 25, 99, -101, -27, 47, 121, -79, -5, 69, -131, -57, 17, 91, -109, -35, 39, 113, -87, -13, 61, 135, -65, 9, 83, -117, -43, 31, 105, -95, -21, 53, 127, -73, 1, 75, -125, -51, 23, 97, -103, -29, 45, 119, -81, -7, 67, -133, -59, 15, 89, -111, -37],
[-61, 15, 91, -107, -31, 45, 121, -77, -1, 75, -123, -47, 29, 105, -93, -17, 59, 135, -63, 13, 89, -109, -33, 43, 119, -79, -3, 73, -125, -49, 27, 103, -95, -19, 57, 133, -65, 11, 87, -111, -35, 41, 117, -81, -5, 71, -127, -51, 25, 101, -97, -21, 55, 131, -67, 9, 85, -113, -37, 39, 115, -83, -7, 69, -129, -53, 23, 99],
[-59, 19, 97, -99, -21, 57, 135, -61, 17, 95, -101, -23, 55, 133, -63, 15, 93, -103, -25, 53, 131, -65, 13, 91, -105, -27, 51, 129, -67, 11, 89, -107, -29, 49, 127, -69, 9, 87, -109, -31, 47, 125, -71, 7, 85, -111, -33, 45, 123, -73, 5, 83, -113, -35, 43, 121, -75, 3, 81, -115, -37, 41, 119, -77, 1, 79, -117, -39],
[-57, 23, 103, -91, -11, 69, -125, -45, 35, 115, -79, 1, 81, -113, -33, 47, 127, -67, 13, 93, -101, -21, 59, -135, -55, 25, 105, -89, -9, 71, -123, -43, 37, 117, -77, 3, 83, -111, -31, 49, 129, -65, 15, 95, -99, -19, 61, -133, -53, 27, 107, -87, -7, 73, -121, -41, 39, 119, -75, 5, 85, -109, -29, 51, 131, -63, 17, 97],
[-55, 27, 109, -83, -1, 81, -111, -29, 53, 135, -57, 25, 107, -85, -3, 79, -113, -31, 51, 133, -59, 23, 105, -87, -5, 77, -115, -33, 49, 131, -61, 21, 103, -89, -7, 75, -117, -35, 47, 129, -63, 19, 101, -91, -9, 73, -119, -37, 45, 127, -65, 17, 99, -93, -11, 71, -121, -39, 43, 125, -67, 15, 97, -95, -13, 69, -123, -41],
[-53, 31, 115, -75, 9, 93, -97, -13, 71, -119, -35, 49, 133, -57, 27, 111, -79, 5, 89, -101, -17, 67, -123, -39, 45, 129, -61, 23, 107, -83, 1, 85, -105, -21, 63, -127, -43, 41, 125, -65, 19, 103, -87, -3, 81, -109, -25, 59, -131, -47, 37, 121, -69, 15, 99, -91, -7, 77, -113, -29, 55, -135, -51, 33, 117, -73, 11, 95],
[-51, 35, 121, -67, 19, 105, -83, 3, 89, -99, -13, 73, -115, -29, 57, -131, -45, 41, 127, -61, 25, 111, -77, 9, 95, -93, -7, 79, -109, -23, 63, -125, -39, 47, 133, -55, 31, 117, -71, 15, 101, -87, -1, 85, -103, -17, 69, -119, -33, 53, -135, -49, 37, 123, -65, 21, 107, -81, 5, 91, -97, -11, 75, -113, -27, 59, -129, -43],
[-49, 39, 127, -59, 29, 117, -69, 19, 107, -79, 9, 97, -89, -1, 87, -99, -11, 77, -109, -21, 67, -119, -31, 57, -129, -41, 47, 135, -51, 37, 125, -61, 27, 115, -71, 17, 105, -81, 7, 95, -91, -3, 85, -101, -13, 75, -111, -23, 65, -121, -33, 55, -131, -43, 45, 133, -53, 35, 123, -63, 25, 113, -73, 15, 103, -83, 5, 93],
[-47, 43, 133, -51, 39, 129, -55, 35, 125, -59, 31, 121, -63, 27, 117, -67, 23, 113, -71, 19, 109, -75, 15, 105, -79, 11, 101, -83, 7, 97, -87, 3, 93, -91, -1, 89, -95, -5, 85, -99, -9, 81, -103, -13, 77, -107, -17, 73, -111, -21, 69, -115, -25, 65, -119, -29, 61, -123, -33, 57, -127, -37, 53, -131, -41, 49, -135, -45],
[-45, 47, -135, -43, 49, -133, -41, 51, -131, -39, 53, -129, -37, 55, -127, -35, 57, -125, -33, 59, -123, -31, 61, -121, -29, 63, -119, -27, 65, -117, -25, 67, -115, -23, 69, -113, -21, 71, -111, -19, 73, -109, -17, 75, -107, -15, 77, -105, -13, 79, -103, -11, 81, -101, -9, 83, -99, -7, 85, -97, -5, 87, -95, -3, 89, -93, -1, 91],
[-43, 51, -129, -35, 59, -121, -27, 67, -113, -19, 75, -105, -11, 83, -97, -3, 91, -89, 5, 99, -81, 13, 107, -73, 21, 115, -65, 29, 123, -57, 37, 131, -49, 45, -135, -41, 53, -127, -33, 61, -119, -25, 69, -111, -17, 77, -103, -9, 85, -95, -1, 93, -87, 7, 101, -79, 15, 109, -71, 23, 117, -63, 31, 125, -55, 39, 133, -47],
[-41, 55, -123, -27, 69, -109, -13, 83, -95, 1, 97, -81, 15, 111, -67, 29, 125, -53, 43, -135, -39, 57, -121, -25, 71, -107, -11, 85, -93, 3, 99, -79, 17, 113, -65, 31, 127, -51, 45, -133, -37, 59, -119, -23, 73, -105, -9, 87, -91, 5, 101, -77, 19, 115, -63, 33, 129, -49, 47, -131, -35, 61, -117, -21, 75, -103, -7, 89],
[-39, 59, -117, -19, 79, -97, 1, 99, -77, 21, 119, -57, 41, -135, -37, 61, -115, -17, 81, -95, 3, 101, -75, 23, 121, -55, 43, -133, -35, 63, -113, -15, 83, -93, 5, 103, -73, 25, 123, -53, 45, -131, -33, 65, -111, -13, 85, -91, 7, 105, -71, 27, 125, -51, 47, -129, -31, 67, -109, -11, 87, -89, 9, 107, -69, 29, 127, -49],
[-37, 63, -111, -11, 89, -85, 15, 115, -59, 41, -133, -33, 67, -107, -7, 93, -81, 19, 119, -55, 45, -129, -29, 71, -103, -3, 97, -77, 23, 123, -51, 49, -125, -25, 75, -99, 1, 101, -73, 27, 127, -47, 53, -121, -21, 79, -95, 5, 105, -69, 31, 131, -43, 57, -117, -17, 83, -91, 9, 109, -65, 35, 135, -39, 61, -113, -13, 87],
[-35, 67, -105, -3, 99, -73, 29, 131, -41, 61, -111, -9, 93, -79, 23, 125, -47, 55, -117, -15, 87, -85, 17, 119, -53, 49, -123, -21, 81, -91, 11, 113, -59, 43, -129, -27, 75, -97, 5, 107, -65, 37, -135, -33, 69, -103, -1, 101, -71, 31, 133, -39, 63, -109, -7, 95, -77, 25, 127, -45, 57, -115, -13, 89, -83, 19, 121, -51],
[-33, 71, -99, 5, 109, -61, 43, -127, -23, 81, -89, 15, 119, -51, 53, -117, -13, 91, -79, 25, 129, -41, 63, -107, -3, 101, -69, 35, -135, -31, 73, -97, 7, 111, -59, 45, -125, -21, 83, -87, 17, 121, -49, 55, -115, -11, 93, -77, 27, 131, -39, 65, -105, -1, 103, -67, 37, -133, -29, 75, -95, 9, 113, -57, 47, -123, -19, 85],
[-31, 75, -93, 13, 119, -49, 57, -111, -5, 101, -67, 39, -129, -23, 83, -85, 21, 127, -41, 65, -103, 3, 109, -59, 47, -121, -15, 91, -77, 29, 135, -33, 73, -95, 11, 117, -51, 55, -113, -7, 99, -69, 37, -131, -25, 81, -87, 19, 125, -43, 63, -105, 1, 107, -61, 45, -123, -17, 89, -79, 27, 133, -35, 71, -97, 9, 115, -53],
[-29, 79, -87, 21, 129, -37, 71, -95, 13, 121, -45, 63, -103, 5, 113, -53, 55, -111, -3, 105, -61, 47, -119, -11, 97, -69, 39, -127, -19, 89, -77, 31, -135, -27, 81, -85, 23, 131, -35, 73, -93, 15, 123, -43, 65, -101, 7, 115, -51, 57, -109, -1, 107, -59, 49, -117, -9, 99, -67, 41, -125, -17, 91, -75, 33, -133, -25, 83],
[-27, 83, -81, 29, -135, -25, 85, -79, 31, -133, -23, 87, -77, 33, -131, -21, 89, -75, 35, -129, -19, 91, -73, 37, -127, -17, 93, -71, 39, -125, -15, 95, -69, 41, -123, -13, 97, -67, 43, -121, -11, 99, -65, 45, -119, -9, 101, -63, 47, -117, -7, 103, -61, 49, -115, -5, 105, -59, 51, -113, -3, 107, -57, 53, -111, -1, 109, -55],
[-25, 87, -75, 37, -125, -13, 99, -63, 49, -113, -1, 111, -51, 61, -101, 11, 123, -39, 73, -89, 23, 135, -27, 85, -77, 35, -127, -15, 97, -65, 47, -115, -3, 109, -53, 59, -103, 9, 121, -41, 71, -91, 21, 133, -29, 83, -79, 33, -129, -17, 95, -67, 45, -117, -5, 107, -55, 57, -105, 7, 119, -43, 69, -93, 19, 131, -31, 81],
[-23, 91, -69, 45, -115, -1, 113, -47, 67, -93, 21, 135, -25, 89, -71, 43, -117, -3, 111, -49, 65, -95, 19, 133, -27, 87, -73, 41, -119, -5, 109, -51, 63, -97, 17, 131, -29, 85, -75, 39, -121, -7, 107, -53, 61, -99, 15, 129, -31, 83, -77, 37, -123, -9, 105, -55, 59, -101, 13, 127, -33, 81, -79, 35, -125, -11, 103, -57],
[-21, 95, -63, 53, -105, 11, 127, -31, 85, -73, 43, -115, 1, 117, -41, 75, -83, 33, -125, -9, 107, -51, 65, -93, 23, -135, -19, 97, -61, 55, -103, 13, 129, -29, 87, -71, 45, -113, 3, 119, -39, 77, -81, 35, -123, -7, 109, -49, 67, -91, 25, -133, -17, 99, -59, 57, -101, 15, 131, -27, 89, -69, 47, -111, 5, 121, -37, 79],
[-19, 99, -57, 61, -95, 23, -133, -15, 103, -53, 65, -91, 27, -129, -11, 107, -49, 69, -87, 31, -125, -7, 111, -45, 73, -83, 35, -121, -3, 115, -41, 77, -79, 39, -117, 1, 119, -37, 81, -75, 43, -113, 5, 123, -33, 85, -71, 47, -109, 9, 127, -29, 89, -67, 51, -105, 13, 131, -25, 93, -63, 55, -101, 17, 135, -21, 97, -59],
[-17, 103, -51, 69, -85, 35, -119, 1, 121, -33, 87, -67, 53, -101, 19, -135, -15, 105, -49, 71, -83, 37, -117, 3, 123, -31, 89, -65, 55, -99, 21, -133, -13, 107, -47, 73, -81, 39, -115, 5, 125, -29, 91, -63, 57, -97, 23, -131, -11, 109, -45, 75, -79, 41, -113, 7, 127, -27, 93, -61, 59, -95, 25, -129, -9, 111, -43, 77],
[-15, 107, -45, 77, -75, 47, -105, 17, -135, -13, 109, -43, 79, -73, 49, -103, 19, -133, -11, 111, -41, 81, -71, 51, -101, 21, -131, -9, 113, -39, 83, -69, 53, -99, 23, -129, -7, 115, -37, 85, -67, 55, -97, 25, -127, -5, 117, -35, 87, -65, 57, -95, 27, -125, -3, 119, -33, 89, -63, 59, -93, 29, -123, -1, 121, -31, 91, -61],
[-13, 111, -39, 85, -65, 59, -91, 33, -117, 7, 131, -19, 105, -45, 79, -71, 53, -97, 27, -123, 1, 125, -25, 99, -51, 73, -77, 47, -103, 21, -129, -5, 119, -31, 93, -57, 67, -83, 41, -109, 15, -135, -11, 113, -37, 87, -63, 61, -89, 35, -115, 9, 133, -17, 107, -43, 81, -69, 55, -95, 29, -121, 3, 127, -23, 101, -49, 75],
[-11, 115, -33, 93, -55, 71, -77, 49, -99, 27, -121, 5, 131, -17, 109, -39, 87, -61, 65, -83, 43, -105, 21, -127, -1, 125, -23, 103, -45, 81, -67, 59, -89, 37, -111, 15, -133, -7, 119, -29, 97, -51, 75, -73, 53, -95, 31, -117, 9, 135, -13, 113, -35, 91, -57, 69, -79, 47, -101, 25, -123, 3, 129, -19, 107, -41, 85, -63],
[-9, 119, -27, 101, -45, 83, -63, 65, -81, 47, -99, 29, -117, 11, -135, -7, 121, -25, 103, -43, 85, -61, 67, -79, 49, -97, 31, -115, 13, -133, -5, 123, -23, 105, -41, 87, -59, 69, -77, 51, -95, 33, -113, 15, -131, -3, 125, -21, 107, -39, 89, -57, 71, -75, 53, -93, 35, -111, 17, -129, -1, 127, -19, 109, -37, 91, -55, 73],
[-7, 123, -21, 109, -35, 95, -49, 81, -63, 67, -77, 53, -91, 39, -105, 25, -119, 11, -133, -3, 127, -17, 113, -31, 99, -45, 85, -59, 71, -73, 57, -87, 43, -101, 29, -115, 15, -129, 1, 131, -13, 117, -27, 103, -41, 89, -55, 75, -69, 61, -83, 47, -97, 33, -111, 19, -125, 5, 135, -9, 121, -23, 107, -37, 93, -51, 79, -65],
[-5, 127, -15, 117, -25, 107, -35, 97, -45, 87, -55, 77, -65, 67, -75, 57, -85, 47, -95, 37, -105, 27, -115, 17, -125, 7, -135, -3, 129, -13, 119, -23, 109, -33, 99, -43, 89, -53, 79, -63, 69, -73, 59, -83, 49, -93, 39, -103, 29, -113, 19, -123, 9, -133, -1, 131, -11, 121, -21, 111, -31, 101, -41, 91, -51, 81, -61, 71],
[-3, 131, -9, 125, -15, 119, -21, 113, -27, 107, -33, 101, -39, 95, -45, 89, -51, 83, -57, 77, -63, 71, -69, 65, -75, 59, -81, 53, -87, 47, -93, 41, -99, 35, -105, 29, -111, 23, -117, 17, -123, 11, -129, 5, -135, -1, 133, -7, 127, -13, 121, -19, 115, -25, 109, -31, 103, -37, 97, -43, 91, -49, 85, -55, 79, -61, 73, -67],
[-1, 135, -3, 133, -5, 131, -7, 129, -9, 127, -11, 125, -13, 123, -15, 121, -17, 119, -19, 117, -21, 115, -23, 113, -25, 111, -27, 109, -29, 107, -31, 105, -33, 103, -35, 101, -37, 99, -39, 97, -41, 95, -43, 93, -45, 91, -47, 89, -49, 87, -51, 85, -53, 83, -55, 81, -57, 79, -59, 77, -61, 75, -63, 73, -65, 71, -67, 69]]
def B : List (List Int) := [
[-7292229894448144895, -31385620251278983518, 15292561560211623874, 12035313310828375348, -25509041652430547276, 2800963768458398155, -24807011795657525612, -37887860799237450506, -50461301512948079974, 24252304523863852042, -33637437251474240100, -31629620332808001516, -18046152312164337484, -46832311449579678588, -64237663132332890582, -9358470408922025802, -59924226747826293254, -136460694340 -- (+1148 chars; full line in the Zenodo source)
[-31385620251278983518, 12035313310828375348, 2800963768458398155, -37887860799237450506, 24252304523863852042, -31629620332808001516, -46832311449579678588, -9358470408922025802, -13646069434094366662, -73774740754768692049, -34985833112049379112, -33703170511217634862, -80465083731867874501, -6160010090915817188, -15701747702817315424, -81933635985669729816, -17032990024040779046, -43678575208 -- (+1116 chars; full line in the Zenodo source)
[15292561560211623874, 2800963768458398155, -50461301512948079974, -31629620332808001516, -64237663132332890582, -13646069434094366662, -61071130357708013912, -33703170511217634862, -64418129550696894819, -15701747702817315424, -58186544930970759808, -43678575208680930144, -99841182875174881079, -49060608829274920978, -31747594849802771937, 8767129604060028756, -33162639302903750838, -2039810971 -- (+1127 chars; full line in the Zenodo source)
[12035313310828375348, -37887860799237450506, -31629620332808001516, -9358470408922025802, -73774740754768692049, -33703170511217634862, -6160010090915817188, -81933635985669729816, -43678575208680930144, -7213554346380577899, -40084247415995136903, 8767129604060028756, 10421781305740193635, -24533267276845965742, 9103481496968853772, 20991251345523751143, 7999626811179654695, 541529529414087237 -- (+1122 chars; full line in the Zenodo source)
[-25509041652430547276, 24252304523863852042, -64237663132332890582, -73774740754768692049, -43968122141146304102, -15701747702817315424, -79195273259989906181, -7213554346380577899, -31747594849802771937, -52172560115800244265, -56772561126511400628, 9103481496968853772, -54152952941408723769, 42461029446230896197, 11392265808276869119, 48747553769907694690, -10421781305740193635, 8964264684457 -- (+1127 chars; full line in the Zenodo source)
[2800963768458398155, -31629620332808001516, -13646069434094366662, -33703170511217634862, -15701747702817315424, -43678575208680930144, -49060608829274920978, 8767129604060028756, -20398109718025504956, 9103481496968853772, 44162724859123695202, 54152952941408723769, 96887334753178152412, 89998733798082854845, 89642646844576507269, 85385913383473963159, 79195273259989906181, 1114533753186184033 -- (+1127 chars; full line in the Zenodo source)
[-24807011795657525612, -46832311449579678588, -61071130357708013912, -6160010090915817188, -79195273259989906181, -49060608829274920978, -79517351046964393630, -24533267276845965742, -7336789444659155731, 42461029446230896197, -9103481496968853772, 89998733798082854845, 14545698091270151219, 99841182875174881079, 81933635985669729816, 43968122141146304102, 13646069434094366662, 3363743725147424 -- (+1126 chars; full line in the Zenodo source)
[-37887860799237450506, -9358470408922025802, -33703170511217634862, -81933635985669729816, -7213554346380577899, 8767129604060028756, -24533267276845965742, 20991251345523751143, 54152952941408723769, 48747553769907694690, 79517351046964393630, 85385913383473963159, 58186544930970759808, 43968122141146304102, 59924226747826293254, 50461301512948079974, 7292229894448144895, -24807011795657525612 -- (+1128 chars; full line in the Zenodo source)
[-50461301512948079974, -13646069434094366662, -64418129550696894819, -43678575208680930144, -31747594849802771937, -20398109718025504956, -7336789444659155731, 54152952941408723769, 24533267276845965742, 89642646844576507269, 31456001388752299184, 111453375318618403307, 73774740754768692049, 33637437251474240100, 31385620251278983518, -24807011795657525612, -9358470408922025802, -43968122141146 -- (+1126 chars; full line in the Zenodo source)
[24252304523863852042, -73774740754768692049, -15701747702817315424, -7213554346380577899, -52172560115800244265, 9103481496968853772, 42461029446230896197, 48747553769907694690, 89642646844576507269, 93855937073663349045, 64418129550696894819, 59924226747826293254, 24807011795657525612, 15292561560211623874, -18046152312164337484, -64098236232449075238, -58186544930970759808, -85382681544012231 -- (+1123 chars; full line in the Zenodo source)
[-33637437251474240100, -34985833112049379112, -58186544930970759808, -40084247415995136903, -56772561126511400628, 44162724859123695202, -9103481496968853772, 79517351046964393630, 31456001388752299184, 64418129550696894819, 9358470408922025802, 25509041652430547276, 2800963768458398155, -59924226747826293254, -6160010090915817188, -99841182875174881079, -52172560115800244265, -4822197770077743 -- (+1132 chars; full line in the Zenodo source)
[-31629620332808001516, -33703170511217634862, -43678575208680930144, 8767129604060028756, 9103481496968853772, 54152952941408723769, 89998733798082854845, 85385913383473963159, 111453375318618403307, 59924226747826293254, 25509041652430547276, -24807011795657525612, -76795992138834566730, -69780523954790380042, -85382681544012231644, -56772561126511400628, -42461029446230896197, -21595905587622 -- (+1125 chars; full line in the Zenodo source)
[-18046152312164337484, -80465083731867874501, -99841182875174881079, 10421781305740193635, -54152952941408723769, 96887334753178152412, 14545698091270151219, 58186544930970759808, 73774740754768692049, 24807011795657525612, 2800963768458398155, -76795992138834566730, -81933635985669729816, -31747594849802771937, 21595905587622558098, -44162724859123695202, 89998733798082854845, 7213554346380577 -- (+1125 chars; full line in the Zenodo source)
[-46832311449579678588, -6160010090915817188, -49060608829274920978, -24533267276845965742, 42461029446230896197, 89998733798082854845, 99841182875174881079, 43968122141146304102, 33637437251474240100, 15292561560211623874, -59924226747826293254, -69780523954790380042, -31747594849802771937, -96887334753178152412, -20991251345523751143, 52172560115800244265, 43678575208680930144, 349858331120493 -- (+1124 chars; full line in the Zenodo source)
[-64237663132332890582, -15701747702817315424, -31747594849802771937, 9103481496968853772, 11392265808276869119, 89642646844576507269, 81933635985669729816, 59924226747826293254, 31385620251278983518, -18046152312164337484, -6160010090915817188, -85382681544012231644, 21595905587622558098, -20991251345523751143, 79517351046964393630, 17032990024040779046, 76795992138834566730, -12035313310828375 -- (+1128 chars; full line in the Zenodo source)
[-9358470408922025802, -81933635985669729816, 8767129604060028756, 20991251345523751143, 48747553769907694690, 85385913383473963159, 43968122141146304102, 50461301512948079974, -24807011795657525612, -64098236232449075238, -99841182875174881079, -56772561126511400628, -44162724859123695202, 52172560115800244265, 17032990024040779046, 13646069434094366662, 31385620251278983518, -46832311449579678 -- (+1124 chars; full line in the Zenodo source)
[-59924226747826293254, -17032990024040779046, -33162639302903750838, 7999626811179654695, -10421781305740193635, 79195273259989906181, 13646069434094366662, 7292229894448144895, -9358470408922025802, -58186544930970759808, -52172560115800244265, -42461029446230896197, 89998733798082854845, 43678575208680930144, 76795992138834566730, 31385620251278983518, -64237663132332890582, -8193363598566972 -- (+1126 chars; full line in the Zenodo source)
[-13646069434094366662, -43678575208680930144, -20398109718025504956, 54152952941408723769, 89642646844576507269, 111453375318618403307, 33637437251474240100, -24807011795657525612, -43968122141146304102, -85382681544012231644, -48221977700777438144, -21595905587622558098, 7213554346380577899, 34985833112049379112, -12035313310828375348, -46832311449579678588, -81933635985669729816, -52172560115 -- (+1124 chars; full line in the Zenodo source)
[-76795992138834566730, -31456001388752299184, -48747553769907694690, 48221977700777438144, 49060608829274920978, 64098236232449075238, -12035313310828375348, -64237663132332890582, -17032990024040779046, -89998733798082854845, 54152952941408723769, 14545698091270151219, 64418129550696894819, 37887860799237450506, -33637437251474240100, -15701747702817315424, -79517351046964393630, 7999626811179 -- (+1122 chars; full line in the Zenodo source)
[-73774740754768692049, -7213554346380577899, 9103481496968853772, 48747553769907694690, 93855937073663349045, 59924226747826293254, 15292561560211623874, -64098236232449075238, -85382681544012231644, -7336789444659155731, 20398109718025504956, 17032990024040779046, 46832311449579678588, 2800963768458398155, -80465083731867874501, -14545698091270151219, 44162724859123695202, 33162639302903750838 -- (+1121 chars; full line in the Zenodo source)
[-61071130357708013912, -49060608829274920978, -7336789444659155731, 89998733798082854845, 81933635985669729816, 33637437251474240100, 24252304523863852042, -69780523954790380042, 10421781305740193635, -20991251345523751143, 85382681544012231644, 34985833112049379112, 7292229894448144895, -73774740754768692049, -85385913383473963159, -11392265808276869119, 20398109718025504956, 58186544930970759 -- (+1123 chars; full line in the Zenodo source)
[-34985833112049379112, -40084247415995136903, 44162724859123695202, 79517351046964393630, 64418129550696894819, 25509041652430547276, -59924226747826293254, -99841182875174881079, -48221977700777438144, 20398109718025504956, 81933635985669729816, -24252304523863852042, -31629620332808001516, -17032990024040779046, -24533267276845965742, 96887334753178152412, 93855937073663349045, 64237663132332 -- (+1124 chars; full line in the Zenodo source)
[-64098236232449075238, -14545698091270151219, -7999626811179654695, 31747594849802771937, 34985833112049379112, -7292229894448144895, -33703170511217634862, -89642646844576507269, 42461029446230896197, 40084247415995136903, 61071130357708013912, -31385620251278983518, -43968122141146304102, 8767129604060028756, -44162724859123695202, 85382681544012231644, 73774740754768692049, 15292561560211623 -- (+1125 chars; full line in the Zenodo source)
[-33703170511217634862, 8767129604060028756, 54152952941408723769, 85385913383473963159, 59924226747826293254, -24807011795657525612, -69780523954790380042, -56772561126511400628, -21595905587622558098, 17032990024040779046, -24252304523863852042, -46832311449579678588, -31456001388752299184, -11392265808276869119, 33162639302903750838, 64418129550696894819, -15292561560211623874, -6107113035770 -- (+1127 chars; full line in the Zenodo source)
[-43968122141146304102, -52172560115800244265, 11392265808276869119, 93855937073663349045, 31629620332808001516, -18046152312164337484, -31456001388752299184, -7336789444659155731, 79517351046964393630, 33703170511217634862, -7292229894448144895, -80465083731867874501, -33162639302903750838, 48221977700777438144, 43678575208680930144, 33637437251474240100, -46832311449579678588, -998411828751748 -- (+1126 chars; full line in the Zenodo source)
[-80465083731867874501, 10421781305740193635, 96887334753178152412, 58186544930970759808, 24807011795657525612, -76795992138834566730, -31747594849802771937, -44162724859123695202, 7213554346380577899, 46832311449579678588, -31629620332808001516, -31456001388752299184, 20991251345523751143, 89642646844576507269, 61071130357708013912, -25509041652430547276, -69780523954790380042, -487475537699076 -- (+1123 chars; full line in the Zenodo source)
[-64418129550696894819, -20398109718025504956, 24533267276845965742, 111453375318618403307, 31385620251278983518, -43968122141146304102, 10421781305740193635, -21595905587622558098, 69780523954790380042, -12035313310828375348, -64098236232449075238, -52172560115800244265, -9103481496968853772, 58186544930970759808, -2800963768458398155, -61071130357708013912, 8767129604060028756, 113922658082768 -- (+1131 chars; full line in the Zenodo source)
[-6160010090915817188, -24533267276845965742, 89998733798082854845, 43968122141146304102, 15292561560211623874, -69780523954790380042, -96887334753178152412, 52172560115800244265, 34985833112049379112, 2800963768458398155, -17032990024040779046, -11392265808276869119, 89642646844576507269, 76795992138834566730, -50461301512948079974, -93855937073663349045, -54152952941408723769, 4008424741599513 -- (+1126 chars; full line in the Zenodo source)
[-111453375318618403307, 21595905587622558098, 52172560115800244265, 61071130357708013912, -37887860799237450506, -93855937073663349045, 44162724859123695202, 49060608829274920978, 18046152312164337484, -9358470408922025802, -31747594849802771937, 7336789444659155731, 17032990024040779046, 25509041652430547276, -33703170511217634862, -89998733798082854845, 56772561126511400628, 80465083731867874 -- (+1125 chars; full line in the Zenodo source)
[-15701747702817315424, 9103481496968853772, 89642646844576507269, 59924226747826293254, -18046152312164337484, -85382681544012231644, -20991251345523751143, 17032990024040779046, -12035313310828375348, -80465083731867874501, -24533267276845965742, 33162639302903750838, 61071130357708013912, -50461301512948079974, -99841182875174881079, -7999626811179654695, 31456001388752299184, 378878607992374 -- (+1124 chars; full line in the Zenodo source)
[-69780523954790380042, -11392265808276869119, 40084247415995136903, 18046152312164337484, -13646069434094366662, -79517351046964393630, 48747553769907694690, 80465083731867874501, -25509041652430547276, -43678575208680930144, -42461029446230896197, 99841182875174881079, 37887860799237450506, -64098236232449075238, -20398109718025504956, -10421781305740193635, 61071130357708013912, 2425230452386 -- (+1127 chars; full line in the Zenodo source)
[-81933635985669729816, 20991251345523751143, 85385913383473963159, 50461301512948079974, -64098236232449075238, -56772561126511400628, 52172560115800244265, 13646069434094366662, -46832311449579678588, -14545698091270151219, 96887334753178152412, 64418129550696894819, -25509041652430547276, -93855937073663349045, -7999626811179654695, 43678575208680930144, -12035313310828375348, -61600100909158 -- (+1124 chars; full line in the Zenodo source)
[-58186544930970759808, 44162724859123695202, 31456001388752299184, 25509041652430547276, -6160010090915817188, -48221977700777438144, 85382681544012231644, -24252304523863852042, -64098236232449075238, -24533267276845965742, -8767129604060028756, 64237663132332890582, -13646069434094366662, -33162639302903750838, 89998733798082854845, 73774740754768692049, -18046152312164337484, -14545698091270 -- (+1127 chars; full line in the Zenodo source)
[-17032990024040779046, 7999626811179654695, 79195273259989906181, 7292229894448144895, -58186544930970759808, -42461029446230896197, 43678575208680930144, 31385620251278983518, -81933635985669729816, 44162724859123695202, 93855937073663349045, -15292561560211623874, -69780523954790380042, -54152952941408723769, 31456001388752299184, -12035313310828375348, -15701747702817315424, 2099125134552375 -- (+1124 chars; full line in the Zenodo source)
[-79195273259989906181, 42461029446230896197, 81933635985669729816, 15292561560211623874, -31456001388752299184, -20991251345523751143, 111453375318618403307, 2800963768458398155, -85385913383473963159, 48221977700777438144, 80465083731867874501, -50461301512948079974, -40084247415995136903, -21595905587622558098, 64098236232449075238, -31629620332808001516, -89642646844576507269, 56772561126511 -- (+1125 chars; full line in the Zenodo source)
[-43678575208680930144, 54152952941408723769, 111453375318618403307, -24807011795657525612, -85382681544012231644, -21595905587622558098, 34985833112049379112, -46832311449579678588, -52172560115800244265, 33162639302903750838, 64237663132332890582, -61071130357708013912, -48747553769907694690, 40084247415995136903, 37887860799237450506, -6160010090915817188, 20991251345523751143, 93855937073663 -- (+1126 chars; full line in the Zenodo source)
[-93855937073663349045, 7336789444659155731, 80465083731867874501, -33637437251474240100, 8767129604060028756, -10421781305740193635, 64237663132332890582, -34985833112049379112, -96887334753178152412, 85385913383473963159, -12035313310828375348, -58186544930970759808, 42461029446230896197, 15701747702817315424, -24807011795657525612, -40084247415995136903, 24533267276845965742, 7679599213883456 -- (+1124 chars; full line in the Zenodo source)
[-31456001388752299184, 48221977700777438144, 64098236232449075238, -64237663132332890582, -89998733798082854845, 14545698091270151219, 37887860799237450506, -15701747702817315424, 7999626811179654695, 69780523954790380042, -24807011795657525612, -31747594849802771937, 20398109718025504956, 9358470408922025802, -34985833112049379112, 9103481496968853772, 99841182875174881079, 7292229894448144895 -- (+1122 chars; full line in the Zenodo source)
[-99841182875174881079, 96887334753178152412, 73774740754768692049, -76795992138834566730, 21595905587622558098, 7213554346380577899, 7292229894448144895, -31456001388752299184, -9103481496968853772, 61071130357708013912, -13646069434094366662, -48747553769907694690, 85385913383473963159, 31385620251278983518, -93855937073663349045, 48221977700777438144, 34985833112049379112, -599242267478262932 -- (+1126 chars; full line in the Zenodo source)
[-7213554346380577899, 48747553769907694690, 59924226747826293254, -64098236232449075238, -7336789444659155731, 17032990024040779046, 2800963768458398155, -14545698091270151219, 33162639302903750838, 33637437251474240100, -111453375318618403307, -7999626811179654695, 6160010090915817188, -31629620332808001516, 10421781305740193635, 31747594849802771937, 25509041652430547276, -7919527325998990618 -- (+1125 chars; full line in the Zenodo source)
[-85385913383473963159, 56772561126511400628, 46832311449579678588, -64418129550696894819, 7999626811179654695, 6160010090915817188, -18046152312164337484, -20398109718025504956, 49060608829274920978, 7292229894448144895, -7213554346380577899, 24533267276845965742, 64237663132332890582, -80465083731867874501, -42461029446230896197, 111453375318618403307, -31629620332808001516, -89998733798082854 -- (+1125 chars; full line in the Zenodo source)
[-49060608829274920978, 89998733798082854845, 33637437251474240100, -69780523954790380042, -20991251345523751143, 34985833112049379112, -73774740754768692049, -11392265808276869119, 58186544930970759808, -50461301512948079974, -33162639302903750838, 40084247415995136903, 31385620251278983518, -7213554346380577899, 56772561126511400628, 18046152312164337484, -111453375318618403307, -4416272485912 -- (+1129 chars; full line in the Zenodo source)
[-85382681544012231644, 33162639302903750838, 37887860799237450506, -79195273259989906181, 96887334753178152412, 9358470408922025802, -64418129550696894819, 42461029446230896197, 33703170511217634862, -76795992138834566730, -11392265808276869119, 81933635985669729816, -33637437251474240100, -20398109718025504956, 7213554346380577899, 15292561560211623874, -14545698091270151219, -8767129604060028 -- (+1125 chars; full line in the Zenodo source)
[-40084247415995136903, 79517351046964393630, 25509041652430547276, -99841182875174881079, 20398109718025504956, -24252304523863852042, -17032990024040779046, 96887334753178152412, 64237663132332890582, -111453375318618403307, -20991251345523751143, 73774740754768692049, -33703170511217634862, 7999626811179654695, 43968122141146304102, -76795992138834566730, -7336789444659155731, 157017477028173 -- (+1122 chars; full line in the Zenodo source)
[-31747594849802771937, 89642646844576507269, 31385620251278983518, -85382681544012231644, 79517351046964393630, -12035313310828375348, -85385913383473963159, 33162639302903750838, -2800963768458398155, -99841182875174881079, 89998733798082854845, 37887860799237450506, -93855937073663349045, 56772561126511400628, -24252304523863852042, -79195273259989906181, 48747553769907694690, 316296203328080 -- (+1121 chars; full line in the Zenodo source)
[-14545698091270151219, 31747594849802771937, -7292229894448144895, -89642646844576507269, 40084247415995136903, -31385620251278983518, 8767129604060028756, 85382681544012231644, 15292561560211623874, -79517351046964393630, 49060608829274920978, 12035313310828375348, -52172560115800244265, 85385913383473963159, -25509041652430547276, -33162639302903750838, 7213554346380577899, 280096376845839815 -- (+1125 chars; full line in the Zenodo source)
[-89642646844576507269, 85382681544012231644, 12035313310828375348, -33162639302903750838, 99841182875174881079, -37887860799237450506, -56772561126511400628, 79195273259989906181, -31629620332808001516, -96887334753178152412, 69780523954790380042, -9358470408922025802, -7336789444659155731, 64418129550696894819, -73774740754768692049, -42461029446230896197, 64098236232449075238, -33703170511217 -- (+1125 chars; full line in the Zenodo source)
[8767129604060028756, 85385913383473963159, -24807011795657525612, -56772561126511400628, 17032990024040779046, -46832311449579678588, -11392265808276869119, 64418129550696894819, -61071130357708013912, -7999626811179654695, 73774740754768692049, -6160010090915817188, 48221977700777438144, 18046152312164337484, -79195273259989906181, 20398109718025504956, -2800963768458398155, -49060608829274920 -- (+1127 chars; full line in the Zenodo source)
[-79517351046964393630, 99841182875174881079, 24252304523863852042, -96887334753178152412, 111453375318618403307, -73774740754768692049, -7999626811179654695, 76795992138834566730, -15701747702817315424, -21595905587622558098, 50461301512948079974, -7213554346380577899, -8767129604060028756, -7292229894448144895, -52172560115800244265, 31456001388752299184, -33637437251474240100, 910348149696885 -- (+1126 chars; full line in the Zenodo source)
[-52172560115800244265, 93855937073663349045, -18046152312164337484, -7336789444659155731, 33703170511217634862, -80465083731867874501, 48221977700777438144, 33637437251474240100, -99841182875174881079, -8767129604060028756, -31385620251278983518, 10421781305740193635, 79195273259989906181, -64237663132332890582, -54152952941408723769, 34985833112049379112, -6160010090915817188, 9688733475317815 -- (+1124 chars; full line in the Zenodo source)
[-33162639302903750838, 79195273259989906181, -9358470408922025802, -42461029446230896197, 76795992138834566730, -81933635985669729816, 20398109718025504956, -15292561560211623874, 8767129604060028756, 31456001388752299184, -18046152312164337484, 20991251345523751143, 34985833112049379112, -111453375318618403307, 48747553769907694690, -2800963768458398155, -31747594849802771937, 8538591338347396 -- (+1123 chars; full line in the Zenodo source)
[10421781305740193635, 58186544930970759808, -76795992138834566730, -44162724859123695202, 46832311449579678588, -31456001388752299184, 89642646844576507269, -25509041652430547276, -48747553769907694690, 6160010090915817188, -33703170511217634862, 48221977700777438144, 50461301512948079974, -85382681544012231644, 49060608829274920978, 24252304523863852042, -11392265808276869119, 6409823623244907 -- (+1125 chars; full line in the Zenodo source)
[-89998733798082854845, 69780523954790380042, -34985833112049379112, 11392265808276869119, 50461301512948079974, -40084247415995136903, 7213554346380577899, -18046152312164337484, 44162724859123695202, 13646069434094366662, -79195273259989906181, 79517351046964393630, 12035313310828375348, -48747553769907694690, 64418129550696894819, -80465083731867874501, -21595905587622558098, 2550904165243054 -- (+1123 chars; full line in the Zenodo source)
[-20398109718025504956, 111453375318618403307, -43968122141146304102, -21595905587622558098, -12035313310828375348, -52172560115800244265, 58186544930970759808, -61071130357708013912, 11392265808276869119, 37887860799237450506, -14545698091270151219, 93855937073663349045, -59924226747826293254, -44162724859123695202, 31629620332808001516, -49060608829274920978, 85385913383473963159, -18046152312 -- (+1127 chars; full line in the Zenodo source)
[-56772561126511400628, 64418129550696894819, -6160010090915817188, 20398109718025504956, -7292229894448144895, -24533267276845965742, 80465083731867874501, -111453375318618403307, 89998733798082854845, -31385620251278983518, -48747553769907694690, 43968122141146304102, -15701747702817315424, -10421781305740193635, 15292561560211623874, 21595905587622558098, 33703170511217634862, -69780523954790 -- (+1125 chars; full line in the Zenodo source)
[-24533267276845965742, 43968122141146304102, -69780523954790380042, 52172560115800244265, 2800963768458398155, -11392265808276869119, 76795992138834566730, -93855937073663349045, 40084247415995136903, -31629620332808001516, 7999626811179654695, 18046152312164337484, -85382681544012231644, 31456001388752299184, -13646069434094366662, 7336789444659155731, 24807011795657525612, -795173510469643936 -- (+1122 chars; full line in the Zenodo source)
[-48747553769907694690, 64098236232449075238, -17032990024040779046, 14545698091270151219, -33637437251474240100, 7999626811179654695, 31629620332808001516, -31747594849802771937, 79195273259989906181, -34985833112049379112, -21595905587622558098, 7292229894448144895, -24533267276845965742, 33703170511217634862, -58186544930970759808, 89642646844576507269, 24252304523863852042, -4246102944623089 -- (+1125 chars; full line in the Zenodo source)
[21595905587622558098, 61071130357708013912, -93855937073663349045, 49060608829274920978, -9358470408922025802, 7336789444659155731, 25509041652430547276, -89998733798082854845, 80465083731867874501, -81933635985669729816, 89642646844576507269, -33637437251474240100, -7999626811179654695, -24252304523863852042, 8767129604060028756, 69780523954790380042, -64418129550696894819, -104217813057401936 -- (+1125 chars; full line in the Zenodo source)
[-96887334753178152412, 76795992138834566730, -7213554346380577899, 31456001388752299184, -61071130357708013912, 48747553769907694690, -31385620251278983518, -48221977700777438144, 59924226747826293254, -49060608829274920978, 43678575208680930144, -64098236232449075238, 56772561126511400628, 12035313310828375348, -7336789444659155731, 64237663132332890582, -40084247415995136903, 1703299002404077 -- (+1124 chars; full line in the Zenodo source)
[9103481496968853772, 59924226747826293254, -85382681544012231644, 17032990024040779046, -80465083731867874501, 33162639302903750838, -50461301512948079974, -7999626811179654695, 37887860799237450506, 10421781305740193635, 43968122141146304102, -79195273259989906181, 49060608829274920978, -13646069434094366662, 96887334753178152412, -7292229894448144895, -48221977700777438144, 935847040892202580 -- (+1124 chars; full line in the Zenodo source)
[-48221977700777438144, 64237663132332890582, -14545698091270151219, 15701747702817315424, -69780523954790380042, 31747594849802771937, -9358470408922025802, -9103481496968853772, -7292229894448144895, -11392265808276869119, 46832311449579678588, -89642646844576507269, 111453375318618403307, -81933635985669729816, 40084247415995136903, -59924226747826293254, 96887334753178152412, -31385620251278 -- (+1124 chars; full line in the Zenodo source)
[-11392265808276869119, 18046152312164337484, -79517351046964393630, 80465083731867874501, -43678575208680930144, 99841182875174881079, -64098236232449075238, -10421781305740193635, 24252304523863852042, 54152952941408723769, -15292561560211623874, -96887334753178152412, 9358470408922025802, -14545698091270151219, 111453375318618403307, -58186544930970759808, 49060608829274920978, -7377474075476 -- (+1127 chars; full line in the Zenodo source)
[-7336789444659155731, 33637437251474240100, 10421781305740193635, 34985833112049379112, -85385913383473963159, 58186544930970759808, -15701747702817315424, 40084247415995136903, -76795992138834566730, 56772561126511400628, -37887860799237450506, -44162724859123695202, -15292561560211623874, 9103481496968853772, 46832311449579678588, -79517351046964393630, 43968122141146304102, -3145600138875229 -- (+1126 chars; full line in the Zenodo source)
[20991251345523751143, 50461301512948079974, -56772561126511400628, 13646069434094366662, -14545698091270151219, 64418129550696894819, -93855937073663349045, 43678575208680930144, -6160010090915817188, 31747594849802771937, -76795992138834566730, 20398109718025504956, 24252304523863852042, 7336789444659155731, -7292229894448144895, -54152952941408723769, 37887860799237450506, -245332672768459657 -- (+1122 chars; full line in the Zenodo source)
[-54152952941408723769, 24807011795657525612, 21595905587622558098, 46832311449579678588, -33162639302903750838, 61071130357708013912, -40084247415995136903, 6160010090915817188, -93855937073663349045, 79195273259989906181, -15701747702817315424, 49060608829274920978, -64098236232449075238, 79517351046964393630, -9358470408922025802, 24533267276845965742, -50461301512948079974, 73367894446591557 -- (+1124 chars; full line in the Zenodo source)
[44162724859123695202, 25509041652430547276, -48221977700777438144, -24252304523863852042, -24533267276845965742, 64237663132332890582, -33162639302903750838, 73774740754768692049, -14545698091270151219, 43968122141146304102, -85385913383473963159, 15701747702817315424, -43678575208680930144, 79195273259989906181, -69780523954790380042, 7213554346380577899, -80465083731867874501, 317475948498027 -- (+1125 chars; full line in the Zenodo source)
[-42461029446230896197, -15292561560211623874, 20991251345523751143, -2800963768458398155, -48221977700777438144, 50461301512948079974, 21595905587622558098, 31629620332808001516, -56772561126511400628, 64237663132332890582, 10421781305740193635, 13646069434094366662, -79517351046964393630, 61071130357708013912, -14545698091270151219, 33703170511217634862, -85382681544012231644, 6441812955069689 -- (+1125 chars; full line in the Zenodo source)
[7999626811179654695, 7292229894448144895, -42461029446230896197, 31385620251278983518, 44162724859123695202, -15292561560211623874, -54152952941408723769, -12035313310828375348, 20991251345523751143, 25509041652430547276, -7336789444659155731, -2800963768458398155, -11392265808276869119, 24807011795657525612, -48221977700777438144, 37887860799237450506, 9103481496968853772, 50461301512948079974 -- (+1122 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 68).map (fun t => rowA (136 + 1) t (rng 1 68)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 68 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 68 B A = sid 177251030228005065273922 68 := rfl
theorem d_ne : (177251030228005065273922 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 68 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 68) (h0 : mv A g = zeros 68) : g = zeros 68 :=
kernel_zero 68 177251030228005065273922 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 136 68 = true := rfl
/-- **Balanced ⇒ pairs for p = 137.** A list with entries in (0, 137) that is balanced for 1 ≤ t ≤ 68
has as many copies of x as of 137 − x for every 1 ≤ x ≤ 68 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 137)
(hb : ∀ t, 1 ≤ t → t < 1 + 68 → tsum 137 t c + tsum 137 t c = c.length * 137) :
(rng 1 68).all (fun x => Nat.beq (cnt x c) (cnt (137 - x) c)) = true :=
pairs_of_bal 136 68 177251030228005065273922 d_ne A B len cert A_def delta c hr hb
end MailletCert137
#print axioms MailletCert137.A_def
#print axioms MailletCert137.len
#print axioms MailletCert137.cert
#print axioms MailletCert137.d_ne
#print axioms MailletCert137.kernel
#print axioms MailletCert137.delta
#print axioms MailletCert137.pairs
lean_all/hodge/MailletCert139.lean
/-
hodge/MailletCert139.lean — T41 (goals G849b, G849c): for p = 139 the 69 × 69 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 69)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 1760180501020972344858 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 139) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert139
open MailletLin MailletBridge
def A : List (List Int) := [
[-137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-135, -131, -127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137],
[-133, -127, -121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-131, -123, -115, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125, 133, -137, -129, -121, -113, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127, 135],
[-129, -119, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, -137, -127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, 113, 125, 137, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, 135, -131, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133],
[-125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, -137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, -135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, -133, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-123, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, 117, 133, -129, -113, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, 127, -135, -119, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, 121, 137, -125, -109, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, 115, 131],
[-121, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, 113, 131, -129, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, -135, -117, -99, -81, -63, -45, -27, -9],
[-119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, -137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, -135, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129],
[-117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, -131, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, 133, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, -137, -115, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, 127, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, -121, -99, -77, -55, -33, -11],
[-115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125, -129, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, 135, -119, -95, -71, -47, -23, 1, 25, 49, 73, 97, 121, -133, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, 131, -123, -99, -75, -51, -27, -3, 21, 45, 69, 93, 117, -137, -113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127],
[-113, -87, -61, -35, -9, 17, 43, 69, 95, 121, -131, -105, -79, -53, -27, -1, 25, 51, 77, 103, 129, -123, -97, -71, -45, -19, 7, 33, 59, 85, 111, 137, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, -133, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, -125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, -117, -91, -65, -39, -13],
[-111, -83, -55, -27, 1, 29, 57, 85, 113, -137, -109, -81, -53, -25, 3, 31, 59, 87, 115, -135, -107, -79, -51, -23, 5, 33, 61, 89, 117, -133, -105, -77, -49, -21, 7, 35, 63, 91, 119, -131, -103, -75, -47, -19, 9, 37, 65, 93, 121, -129, -101, -73, -45, -17, 11, 39, 67, 95, 123, -127, -99, -71, -43, -15, 13, 41, 69, 97, 125],
[-109, -79, -49, -19, 11, 41, 71, 101, 131, -117, -87, -57, -27, 3, 33, 63, 93, 123, -125, -95, -65, -35, -5, 25, 55, 85, 115, -133, -103, -73, -43, -13, 17, 47, 77, 107, 137, -111, -81, -51, -21, 9, 39, 69, 99, 129, -119, -89, -59, -29, 1, 31, 61, 91, 121, -127, -97, -67, -37, -7, 23, 53, 83, 113, -135, -105, -75, -45, -15],
[-107, -75, -43, -11, 21, 53, 85, 117, -129, -97, -65, -33, -1, 31, 63, 95, 127, -119, -87, -55, -23, 9, 41, 73, 105, 137, -109, -77, -45, -13, 19, 51, 83, 115, -131, -99, -67, -35, -3, 29, 61, 93, 125, -121, -89, -57, -25, 7, 39, 71, 103, 135, -111, -79, -47, -15, 17, 49, 81, 113, -133, -101, -69, -37, -5, 27, 59, 91, 123],
[-105, -71, -37, -3, 31, 65, 99, 133, -111, -77, -43, -9, 25, 59, 93, 127, -117, -83, -49, -15, 19, 53, 87, 121, -123, -89, -55, -21, 13, 47, 81, 115, -129, -95, -61, -27, 7, 41, 75, 109, -135, -101, -67, -33, 1, 35, 69, 103, 137, -107, -73, -39, -5, 29, 63, 97, 131, -113, -79, -45, -11, 23, 57, 91, 125, -119, -85, -51, -17],
[-103, -67, -31, 5, 41, 77, 113, -129, -93, -57, -21, 15, 51, 87, 123, -119, -83, -47, -11, 25, 61, 97, 133, -109, -73, -37, -1, 35, 71, 107, -135, -99, -63, -27, 9, 45, 81, 117, -125, -89, -53, -17, 19, 55, 91, 127, -115, -79, -43, -7, 29, 65, 101, 137, -105, -69, -33, 3, 39, 75, 111, -131, -95, -59, -23, 13, 49, 85, 121],
[-101, -63, -25, 13, 51, 89, 127, -113, -75, -37, 1, 39, 77, 115, -125, -87, -49, -11, 27, 65, 103, -137, -99, -61, -23, 15, 53, 91, 129, -111, -73, -35, 3, 41, 79, 117, -123, -85, -47, -9, 29, 67, 105, -135, -97, -59, -21, 17, 55, 93, 131, -109, -71, -33, 5, 43, 81, 119, -121, -83, -45, -7, 31, 69, 107, -133, -95, -57, -19],
[-99, -59, -19, 21, 61, 101, -137, -97, -57, -17, 23, 63, 103, -135, -95, -55, -15, 25, 65, 105, -133, -93, -53, -13, 27, 67, 107, -131, -91, -51, -11, 29, 69, 109, -129, -89, -49, -9, 31, 71, 111, -127, -87, -47, -7, 33, 73, 113, -125, -85, -45, -5, 35, 75, 115, -123, -83, -43, -3, 37, 77, 117, -121, -81, -41, -1, 39, 79, 119],
[-97, -55, -13, 29, 71, 113, -123, -81, -39, 3, 45, 87, 129, -107, -65, -23, 19, 61, 103, -133, -91, -49, -7, 35, 77, 119, -117, -75, -33, 9, 51, 93, 135, -101, -59, -17, 25, 67, 109, -127, -85, -43, -1, 41, 83, 125, -111, -69, -27, 15, 57, 99, -137, -95, -53, -11, 31, 73, 115, -121, -79, -37, 5, 47, 89, 131, -105, -63, -21],
[-95, -51, -7, 37, 81, 125, -109, -65, -21, 23, 67, 111, -123, -79, -35, 9, 53, 97, -137, -93, -49, -5, 39, 83, 127, -107, -63, -19, 25, 69, 113, -121, -77, -33, 11, 55, 99, -135, -91, -47, -3, 41, 85, 129, -105, -61, -17, 27, 71, 115, -119, -75, -31, 13, 57, 101, -133, -89, -45, -1, 43, 87, 131, -103, -59, -15, 29, 73, 117],
[-93, -47, -1, 45, 91, 137, -95, -49, -3, 43, 89, 135, -97, -51, -5, 41, 87, 133, -99, -53, -7, 39, 85, 131, -101, -55, -9, 37, 83, 129, -103, -57, -11, 35, 81, 127, -105, -59, -13, 33, 79, 125, -107, -61, -15, 31, 77, 123, -109, -63, -17, 29, 75, 121, -111, -65, -19, 27, 73, 119, -113, -67, -21, 25, 71, 117, -115, -69, -23],
[-91, -43, 5, 53, 101, -129, -81, -33, 15, 63, 111, -119, -71, -23, 25, 73, 121, -109, -61, -13, 35, 83, 131, -99, -51, -3, 45, 93, -137, -89, -41, 7, 55, 103, -127, -79, -31, 17, 65, 113, -117, -69, -21, 27, 75, 123, -107, -59, -11, 37, 85, 133, -97, -49, -1, 47, 95, -135, -87, -39, 9, 57, 105, -125, -77, -29, 19, 67, 115],
[-89, -39, 11, 61, 111, -117, -67, -17, 33, 83, 133, -95, -45, 5, 55, 105, -123, -73, -23, 27, 77, 127, -101, -51, -1, 49, 99, -129, -79, -29, 21, 71, 121, -107, -57, -7, 43, 93, -135, -85, -35, 15, 65, 115, -113, -63, -13, 37, 87, 137, -91, -41, 9, 59, 109, -119, -69, -19, 31, 81, 131, -97, -47, 3, 53, 103, -125, -75, -25],
[-87, -35, 17, 69, 121, -105, -53, -1, 51, 103, -123, -71, -19, 33, 85, 137, -89, -37, 15, 67, 119, -107, -55, -3, 49, 101, -125, -73, -21, 31, 83, 135, -91, -39, 13, 65, 117, -109, -57, -5, 47, 99, -127, -75, -23, 29, 81, 133, -93, -41, 11, 63, 115, -111, -59, -7, 45, 97, -129, -77, -25, 27, 79, 131, -95, -43, 9, 61, 113],
[-85, -31, 23, 77, 131, -93, -39, 15, 69, 123, -101, -47, 7, 61, 115, -109, -55, -1, 53, 107, -117, -63, -9, 45, 99, -125, -71, -17, 37, 91, -133, -79, -25, 29, 83, 137, -87, -33, 21, 75, 129, -95, -41, 13, 67, 121, -103, -49, 5, 59, 113, -111, -57, -3, 51, 105, -119, -65, -11, 43, 97, -127, -73, -19, 35, 89, -135, -81, -27],
[-83, -27, 29, 85, -137, -81, -25, 31, 87, -135, -79, -23, 33, 89, -133, -77, -21, 35, 91, -131, -75, -19, 37, 93, -129, -73, -17, 39, 95, -127, -71, -15, 41, 97, -125, -69, -13, 43, 99, -123, -67, -11, 45, 101, -121, -65, -9, 47, 103, -119, -63, -7, 49, 105, -117, -61, -5, 51, 107, -115, -59, -3, 53, 109, -113, -57, -1, 55, 111],
[-81, -23, 35, 93, -127, -69, -11, 47, 105, -115, -57, 1, 59, 117, -103, -45, 13, 71, 129, -91, -33, 25, 83, -137, -79, -21, 37, 95, -125, -67, -9, 49, 107, -113, -55, 3, 61, 119, -101, -43, 15, 73, 131, -89, -31, 27, 85, -135, -77, -19, 39, 97, -123, -65, -7, 51, 109, -111, -53, 5, 63, 121, -99, -41, 17, 75, 133, -87, -29],
[-79, -19, 41, 101, -117, -57, 3, 63, 123, -95, -35, 25, 85, -133, -73, -13, 47, 107, -111, -51, 9, 69, 129, -89, -29, 31, 91, -127, -67, -7, 53, 113, -105, -45, 15, 75, 135, -83, -23, 37, 97, -121, -61, -1, 59, 119, -99, -39, 21, 81, -137, -77, -17, 43, 103, -115, -55, 5, 65, 125, -93, -33, 27, 87, -131, -71, -11, 49, 109],
[-77, -15, 47, 109, -107, -45, 17, 79, -137, -75, -13, 49, 111, -105, -43, 19, 81, -135, -73, -11, 51, 113, -103, -41, 21, 83, -133, -71, -9, 53, 115, -101, -39, 23, 85, -131, -69, -7, 55, 117, -99, -37, 25, 87, -129, -67, -5, 57, 119, -97, -35, 27, 89, -127, -65, -3, 59, 121, -95, -33, 29, 91, -125, -63, -1, 61, 123, -93, -31],
[-75, -11, 53, 117, -97, -33, 31, 95, -119, -55, 9, 73, 137, -77, -13, 51, 115, -99, -35, 29, 93, -121, -57, 7, 71, 135, -79, -15, 49, 113, -101, -37, 27, 91, -123, -59, 5, 69, 133, -81, -17, 47, 111, -103, -39, 25, 89, -125, -61, 3, 67, 131, -83, -19, 45, 109, -105, -41, 23, 87, -127, -63, 1, 65, 129, -85, -21, 43, 107],
[-73, -7, 59, 125, -87, -21, 45, 111, -101, -35, 31, 97, -115, -49, 17, 83, -129, -63, 3, 69, 135, -77, -11, 55, 121, -91, -25, 41, 107, -105, -39, 27, 93, -119, -53, 13, 79, -133, -67, -1, 65, 131, -81, -15, 51, 117, -95, -29, 37, 103, -109, -43, 23, 89, -123, -57, 9, 75, -137, -71, -5, 61, 127, -85, -19, 47, 113, -99, -33],
[-71, -3, 65, 133, -77, -9, 59, 127, -83, -15, 53, 121, -89, -21, 47, 115, -95, -27, 41, 109, -101, -33, 35, 103, -107, -39, 29, 97, -113, -45, 23, 91, -119, -51, 17, 85, -125, -57, 11, 79, -131, -63, 5, 73, -137, -69, -1, 67, 135, -75, -7, 61, 129, -81, -13, 55, 123, -87, -19, 49, 117, -93, -25, 43, 111, -99, -31, 37, 105],
[-69, 1, 71, -137, -67, 3, 73, -135, -65, 5, 75, -133, -63, 7, 77, -131, -61, 9, 79, -129, -59, 11, 81, -127, -57, 13, 83, -125, -55, 15, 85, -123, -53, 17, 87, -121, -51, 19, 89, -119, -49, 21, 91, -117, -47, 23, 93, -115, -45, 25, 95, -113, -43, 27, 97, -111, -41, 29, 99, -109, -39, 31, 101, -107, -37, 33, 103, -105, -35],
[-67, 5, 77, -129, -57, 15, 87, -119, -47, 25, 97, -109, -37, 35, 107, -99, -27, 45, 117, -89, -17, 55, 127, -79, -7, 65, 137, -69, 3, 75, -131, -59, 13, 85, -121, -49, 23, 95, -111, -39, 33, 105, -101, -29, 43, 115, -91, -19, 53, 125, -81, -9, 63, 135, -71, 1, 73, -133, -61, 11, 83, -123, -51, 21, 93, -113, -41, 31, 103],
[-65, 9, 83, -121, -47, 27, 101, -103, -29, 45, 119, -85, -11, 63, 137, -67, 7, 81, -123, -49, 25, 99, -105, -31, 43, 117, -87, -13, 61, 135, -69, 5, 79, -125, -51, 23, 97, -107, -33, 41, 115, -89, -15, 59, 133, -71, 3, 77, -127, -53, 21, 95, -109, -35, 39, 113, -91, -17, 57, 131, -73, 1, 75, -129, -55, 19, 93, -111, -37],
[-63, 13, 89, -113, -37, 39, 115, -87, -11, 65, -137, -61, 15, 91, -111, -35, 41, 117, -85, -9, 67, -135, -59, 17, 93, -109, -33, 43, 119, -83, -7, 69, -133, -57, 19, 95, -107, -31, 45, 121, -81, -5, 71, -131, -55, 21, 97, -105, -29, 47, 123, -79, -3, 73, -129, -53, 23, 99, -103, -27, 49, 125, -77, -1, 75, -127, -51, 25, 101],
[-61, 17, 95, -105, -27, 51, 129, -71, 7, 85, -115, -37, 41, 119, -81, -3, 75, -125, -47, 31, 109, -91, -13, 65, -135, -57, 21, 99, -101, -23, 55, 133, -67, 11, 89, -111, -33, 45, 123, -77, 1, 79, -121, -43, 35, 113, -87, -9, 69, -131, -53, 25, 103, -97, -19, 59, 137, -63, 15, 93, -107, -29, 49, 127, -73, 5, 83, -117, -39],
[-59, 21, 101, -97, -17, 63, -135, -55, 25, 105, -93, -13, 67, -131, -51, 29, 109, -89, -9, 71, -127, -47, 33, 113, -85, -5, 75, -123, -43, 37, 117, -81, -1, 79, -119, -39, 41, 121, -77, 3, 83, -115, -35, 45, 125, -73, 7, 87, -111, -31, 49, 129, -69, 11, 91, -107, -27, 53, 133, -65, 15, 95, -103, -23, 57, 137, -61, 19, 99],
[-57, 25, 107, -89, -7, 75, -121, -39, 43, 125, -71, 11, 93, -103, -21, 61, -135, -53, 29, 111, -85, -3, 79, -117, -35, 47, 129, -67, 15, 97, -99, -17, 65, -131, -49, 33, 115, -81, 1, 83, -113, -31, 51, 133, -63, 19, 101, -95, -13, 69, -127, -45, 37, 119, -77, 5, 87, -109, -27, 55, 137, -59, 23, 105, -91, -9, 73, -123, -41],
[-55, 29, 113, -81, 3, 87, -107, -23, 61, -133, -49, 35, 119, -75, 9, 93, -101, -17, 67, -127, -43, 41, 125, -69, 15, 99, -95, -11, 73, -121, -37, 47, 131, -63, 21, 105, -89, -5, 79, -115, -31, 53, 137, -57, 27, 111, -83, 1, 85, -109, -25, 59, -135, -51, 33, 117, -77, 7, 91, -103, -19, 65, -129, -45, 39, 123, -71, 13, 97],
[-53, 33, 119, -73, 13, 99, -93, -7, 79, -113, -27, 59, -133, -47, 39, 125, -67, 19, 105, -87, -1, 85, -107, -21, 65, -127, -41, 45, 131, -61, 25, 111, -81, 5, 91, -101, -15, 71, -121, -35, 51, 137, -55, 31, 117, -75, 11, 97, -95, -9, 77, -115, -29, 57, -135, -49, 37, 123, -69, 17, 103, -89, -3, 83, -109, -23, 63, -129, -43],
[-51, 37, 125, -65, 23, 111, -79, 9, 97, -93, -5, 83, -107, -19, 69, -121, -33, 55, -135, -47, 41, 129, -61, 27, 115, -75, 13, 101, -89, -1, 87, -103, -15, 73, -117, -29, 59, -131, -43, 45, 133, -57, 31, 119, -71, 17, 105, -85, 3, 91, -99, -11, 77, -113, -25, 63, -127, -39, 49, 137, -53, 35, 123, -67, 21, 109, -81, 7, 95],
[-49, 41, 131, -57, 33, 123, -65, 25, 115, -73, 17, 107, -81, 9, 99, -89, 1, 91, -97, -7, 83, -105, -15, 75, -113, -23, 67, -121, -31, 59, -129, -39, 51, -137, -47, 43, 133, -55, 35, 125, -63, 27, 117, -71, 19, 109, -79, 11, 101, -87, 3, 93, -95, -5, 85, -103, -13, 77, -111, -21, 69, -119, -29, 61, -127, -37, 53, -135, -45],
[-47, 45, 137, -49, 43, 135, -51, 41, 133, -53, 39, 131, -55, 37, 129, -57, 35, 127, -59, 33, 125, -61, 31, 123, -63, 29, 121, -65, 27, 119, -67, 25, 117, -69, 23, 115, -71, 21, 113, -73, 19, 111, -75, 17, 109, -77, 15, 107, -79, 13, 105, -81, 11, 103, -83, 9, 101, -85, 7, 99, -87, 5, 97, -89, 3, 95, -91, 1, 93],
[-45, 49, -135, -41, 53, -131, -37, 57, -127, -33, 61, -123, -29, 65, -119, -25, 69, -115, -21, 73, -111, -17, 77, -107, -13, 81, -103, -9, 85, -99, -5, 89, -95, -1, 93, -91, 3, 97, -87, 7, 101, -83, 11, 105, -79, 15, 109, -75, 19, 113, -71, 23, 117, -67, 27, 121, -63, 31, 125, -59, 35, 129, -55, 39, 133, -51, 43, 137, -47],
[-43, 53, -129, -33, 63, -119, -23, 73, -109, -13, 83, -99, -3, 93, -89, 7, 103, -79, 17, 113, -69, 27, 123, -59, 37, 133, -49, 47, -135, -39, 57, -125, -29, 67, -115, -19, 77, -105, -9, 87, -95, 1, 97, -85, 11, 107, -75, 21, 117, -65, 31, 127, -55, 41, 137, -45, 51, -131, -35, 61, -121, -25, 71, -111, -15, 81, -101, -5, 91],
[-41, 57, -123, -25, 73, -107, -9, 89, -91, 7, 105, -75, 23, 121, -59, 39, 137, -43, 55, -125, -27, 71, -109, -11, 87, -93, 5, 103, -77, 21, 119, -61, 37, 135, -45, 53, -127, -29, 69, -111, -13, 85, -95, 3, 101, -79, 19, 117, -63, 35, 133, -47, 51, -129, -31, 67, -113, -15, 83, -97, 1, 99, -81, 17, 115, -65, 33, 131, -49],
[-39, 61, -117, -17, 83, -95, 5, 105, -73, 27, 127, -51, 49, -129, -29, 71, -107, -7, 93, -85, 15, 115, -63, 37, 137, -41, 59, -119, -19, 81, -97, 3, 103, -75, 25, 125, -53, 47, -131, -31, 69, -109, -9, 91, -87, 13, 113, -65, 35, 135, -43, 57, -121, -21, 79, -99, 1, 101, -77, 23, 123, -55, 45, -133, -33, 67, -111, -11, 89],
[-37, 65, -111, -9, 93, -83, 19, 121, -55, 47, -129, -27, 75, -101, 1, 103, -73, 29, 131, -45, 57, -119, -17, 85, -91, 11, 113, -63, 39, -137, -35, 67, -109, -7, 95, -81, 21, 123, -53, 49, -127, -25, 77, -99, 3, 105, -71, 31, 133, -43, 59, -117, -15, 87, -89, 13, 115, -61, 41, -135, -33, 69, -107, -5, 97, -79, 23, 125, -51],
[-35, 69, -105, -1, 103, -71, 33, 137, -37, 67, -107, -3, 101, -73, 31, 135, -39, 65, -109, -5, 99, -75, 29, 133, -41, 63, -111, -7, 97, -77, 27, 131, -43, 61, -113, -9, 95, -79, 25, 129, -45, 59, -115, -11, 93, -81, 23, 127, -47, 57, -117, -13, 91, -83, 21, 125, -49, 55, -119, -15, 89, -85, 19, 123, -51, 53, -121, -17, 87],
[-33, 73, -99, 7, 113, -59, 47, -125, -19, 87, -85, 21, 127, -45, 61, -111, -5, 101, -71, 35, -137, -31, 75, -97, 9, 115, -57, 49, -123, -17, 89, -83, 23, 129, -43, 63, -109, -3, 103, -69, 37, -135, -29, 77, -95, 11, 117, -55, 51, -121, -15, 91, -81, 25, 131, -41, 65, -107, -1, 105, -67, 39, -133, -27, 79, -93, 13, 119, -53],
[-31, 77, -93, 15, 123, -47, 61, -109, -1, 107, -63, 45, -125, -17, 91, -79, 29, 137, -33, 75, -95, 13, 121, -49, 59, -111, -3, 105, -65, 43, -127, -19, 89, -81, 27, 135, -35, 73, -97, 11, 119, -51, 57, -113, -5, 103, -67, 41, -129, -21, 87, -83, 25, 133, -37, 71, -99, 9, 117, -53, 55, -115, -7, 101, -69, 39, -131, -23, 85],
[-29, 81, -87, 23, 133, -35, 75, -93, 17, 127, -41, 69, -99, 11, 121, -47, 63, -105, 5, 115, -53, 57, -111, -1, 109, -59, 51, -117, -7, 103, -65, 45, -123, -13, 97, -71, 39, -129, -19, 91, -77, 33, -135, -25, 85, -83, 27, 137, -31, 79, -89, 21, 131, -37, 73, -95, 15, 125, -43, 67, -101, 9, 119, -49, 61, -107, 3, 113, -55],
[-27, 85, -81, 31, -135, -23, 89, -77, 35, -131, -19, 93, -73, 39, -127, -15, 97, -69, 43, -123, -11, 101, -65, 47, -119, -7, 105, -61, 51, -115, -3, 109, -57, 55, -111, 1, 113, -53, 59, -107, 5, 117, -49, 63, -103, 9, 121, -45, 67, -99, 13, 125, -41, 71, -95, 17, 129, -37, 75, -91, 21, 133, -33, 79, -87, 25, 137, -29, 83],
[-25, 89, -75, 39, -125, -11, 103, -61, 53, -111, 3, 117, -47, 67, -97, 17, 131, -33, 81, -83, 31, -133, -19, 95, -69, 45, -119, -5, 109, -55, 59, -105, 9, 123, -41, 73, -91, 23, 137, -27, 87, -77, 37, -127, -13, 101, -63, 51, -113, 1, 115, -49, 65, -99, 15, 129, -35, 79, -85, 29, -135, -21, 93, -71, 43, -121, -7, 107, -57],
[-23, 93, -69, 47, -115, 1, 117, -45, 71, -91, 25, -137, -21, 95, -67, 49, -113, 3, 119, -43, 73, -89, 27, -135, -19, 97, -65, 51, -111, 5, 121, -41, 75, -87, 29, -133, -17, 99, -63, 53, -109, 7, 123, -39, 77, -85, 31, -131, -15, 101, -61, 55, -107, 9, 125, -37, 79, -83, 33, -129, -13, 103, -59, 57, -105, 11, 127, -35, 81],
[-21, 97, -63, 55, -105, 13, 131, -29, 89, -71, 47, -113, 5, 123, -37, 81, -79, 39, -121, -3, 115, -45, 73, -87, 31, -129, -11, 107, -53, 65, -95, 23, -137, -19, 99, -61, 57, -103, 15, 133, -27, 91, -69, 49, -111, 7, 125, -35, 83, -77, 41, -119, -1, 117, -43, 75, -85, 33, -127, -9, 109, -51, 67, -93, 25, -135, -17, 101, -59],
[-19, 101, -57, 63, -95, 25, -133, -13, 107, -51, 69, -89, 31, -127, -7, 113, -45, 75, -83, 37, -121, -1, 119, -39, 81, -77, 43, -115, 5, 125, -33, 87, -71, 49, -109, 11, 131, -27, 93, -65, 55, -103, 17, 137, -21, 99, -59, 61, -97, 23, -135, -15, 105, -53, 67, -91, 29, -129, -9, 111, -47, 73, -85, 35, -123, -3, 117, -41, 79],
[-17, 105, -51, 71, -85, 37, -119, 3, 125, -31, 91, -65, 57, -99, 23, -133, -11, 111, -45, 77, -79, 43, -113, 9, 131, -25, 97, -59, 63, -93, 29, -127, -5, 117, -39, 83, -73, 49, -107, 15, 137, -19, 103, -53, 69, -87, 35, -121, 1, 123, -33, 89, -67, 55, -101, 21, -135, -13, 109, -47, 75, -81, 41, -115, 7, 129, -27, 95, -61],
[-15, 109, -45, 79, -75, 49, -105, 19, -135, -11, 113, -41, 83, -71, 53, -101, 23, -131, -7, 117, -37, 87, -67, 57, -97, 27, -127, -3, 121, -33, 91, -63, 61, -93, 31, -123, 1, 125, -29, 95, -59, 65, -89, 35, -119, 5, 129, -25, 99, -55, 69, -85, 39, -115, 9, 133, -21, 103, -51, 73, -81, 43, -111, 13, 137, -17, 107, -47, 77],
[-13, 113, -39, 87, -65, 61, -91, 35, -117, 9, 135, -17, 109, -43, 83, -69, 57, -95, 31, -121, 5, 131, -21, 105, -47, 79, -73, 53, -99, 27, -125, 1, 127, -25, 101, -51, 75, -77, 49, -103, 23, -129, -3, 123, -29, 97, -55, 71, -81, 45, -107, 19, -133, -7, 119, -33, 93, -59, 67, -85, 41, -111, 15, -137, -11, 115, -37, 89, -63],
[-11, 117, -33, 95, -55, 73, -77, 51, -99, 29, -121, 7, 135, -15, 113, -37, 91, -59, 69, -81, 47, -103, 25, -125, 3, 131, -19, 109, -41, 87, -63, 65, -85, 43, -107, 21, -129, -1, 127, -23, 105, -45, 83, -67, 61, -89, 39, -111, 17, -133, -5, 123, -27, 101, -49, 79, -71, 57, -93, 35, -115, 13, -137, -9, 119, -31, 97, -53, 75],
[-9, 121, -27, 103, -45, 85, -63, 67, -81, 49, -99, 31, -117, 13, -135, -5, 125, -23, 107, -41, 89, -59, 71, -77, 53, -95, 35, -113, 17, -131, -1, 129, -19, 111, -37, 93, -55, 75, -73, 57, -91, 39, -109, 21, -127, 3, 133, -15, 115, -33, 97, -51, 79, -69, 61, -87, 43, -105, 25, -123, 7, 137, -11, 119, -29, 101, -47, 83, -65],
[-7, 125, -21, 111, -35, 97, -49, 83, -63, 69, -77, 55, -91, 41, -105, 27, -119, 13, -133, -1, 131, -15, 117, -29, 103, -43, 89, -57, 75, -71, 61, -85, 47, -99, 33, -113, 19, -127, 5, 137, -9, 123, -23, 109, -37, 95, -51, 81, -65, 67, -79, 53, -93, 39, -107, 25, -121, 11, -135, -3, 129, -17, 115, -31, 101, -45, 87, -59, 73],
[-5, 129, -15, 119, -25, 109, -35, 99, -45, 89, -55, 79, -65, 69, -75, 59, -85, 49, -95, 39, -105, 29, -115, 19, -125, 9, -135, -1, 133, -11, 123, -21, 113, -31, 103, -41, 93, -51, 83, -61, 73, -71, 63, -81, 53, -91, 43, -101, 33, -111, 23, -121, 13, -131, 3, 137, -7, 127, -17, 117, -27, 107, -37, 97, -47, 87, -57, 77, -67],
[-3, 133, -9, 127, -15, 121, -21, 115, -27, 109, -33, 103, -39, 97, -45, 91, -51, 85, -57, 79, -63, 73, -69, 67, -75, 61, -81, 55, -87, 49, -93, 43, -99, 37, -105, 31, -111, 25, -117, 19, -123, 13, -129, 7, -135, 1, 137, -5, 131, -11, 125, -17, 119, -23, 113, -29, 107, -35, 101, -41, 95, -47, 89, -53, 83, -59, 77, -65, 71],
[-1, 137, -3, 135, -5, 133, -7, 131, -9, 129, -11, 127, -13, 125, -15, 123, -17, 121, -19, 119, -21, 117, -23, 115, -25, 113, -27, 111, -29, 109, -31, 107, -33, 105, -35, 103, -37, 101, -39, 99, -41, 97, -43, 95, -45, 93, -47, 91, -49, 89, -51, 87, -53, 85, -55, 83, -57, 81, -59, 79, -61, 77, -63, 75, -65, 73, -67, 71, -69]]
def B : List (List Int) := [
[48378971259925949, 346616402164657138, -326622280249753601, -593587832604370114, -226070220842775166, -100276647491509000, -244528965028104610, 293779850442496540, -184188937618116325, -563601513781265654, -279459895048886953, -58690921930664687, -579325191755982022, -280880605823393423, -287611050603328271, -267563322562215403, -464644367250090890, -416140566807949457, -788214816797662259, 779 -- (+1033 chars; full line in the Zenodo source)
[346616402164657138, -593587832604370114, -100276647491509000, 293779850442496540, -563601513781265654, -58690921930664687, -280880605823393423, -267563322562215403, -416140566807949457, 77909823708983324, -441736812140816129, -536197957484441800, -94340831500479479, -697044967603623406, -164247876741073837, -467949634287323468, -601358229479582656, 28048438043857145, -188464909269528373, -79225 -- (+1000 chars; full line in the Zenodo source)
[-326622280249753601, -100276647491509000, -184188937618116325, -58690921930664687, -287611050603328271, -416140566807949457, -328951645832464037, -536197957484441800, -502895008230805739, -164247876741073837, -806378384914887017, 28048438043857145, -714767164275730034, -128319880706802211, -555632029568602294, -237595619753497748, -400458165522901444, -200581930279535581, -347059962343663666, 7 -- (+1014 chars; full line in the Zenodo source)
[-593587832604370114, 293779850442496540, -58690921930664687, -267563322562215403, 77909823708983324, -536197957484441800, -697044967603623406, -467949634287323468, 28048438043857145, -792253171573189754, -257243974715038561, -237595619753497748, -310050819803079079, 264844200040584835, 74842017086762341, 115324751403707150, 228174340647692836, 401129908114424545, 312821693860251517, 56122064043 -- (+1007 chars; full line in the Zenodo source)
[-226070220842775166, -563601513781265654, -287611050603328271, 77909823708983324, -778343033885053609, -164247876741073837, -598310641100584792, -792253171573189754, -555632029568602294, 25294265125924891, -723934331078708356, 74842017086762341, -192495065142207193, 185430287448457330, -115324751403707150, 561220640430950702, 200581930279535581, 904807605433609954, 257243974715038561, 714767164 -- (+1011 chars; full line in the Zenodo source)
[-100276647491509000, -58690921930664687, -416140566807949457, -536197957484441800, -164247876741073837, 28048438043857145, -128319880706802211, -237595619753497748, -200581930279535581, 74842017086762341, 360393020487152999, 401129908114424545, 634553378471013191, 723934331078708356, 904807605433609954, 1098341903590515593, 780893477061303559, 824658821667913198, 778343033885053609, 78821481679 -- (+1013 chars; full line in the Zenodo source)
[-244528965028104610, -280880605823393423, -328951645832464037, -697044967603623406, -598310641100584792, -128319880706802211, -904807605433609954, 264844200040584835, -312821693860251517, 185430287448457330, -52261073465423740, 723934331078708356, 237595619753497748, 817366428325835239, 601358229479582656, 502895008230805739, -77909823708983324, 579325191755982022, 100276647491509000, 483789712 -- (+1011 chars; full line in the Zenodo source)
[293779850442496540, -267563322562215403, -536197957484441800, -467949634287323468, -792253171573189754, -237595619753497748, 264844200040584835, 115324751403707150, 401129908114424545, 561220640430950702, 400458165522901444, 1098341903590515593, 598310641100584792, 502895008230805739, 788214816797662259, 279459895048886953, 326622280249753601, -226070220842775166, -579325191755982022, -32895164 -- (+1010 chars; full line in the Zenodo source)
[-184188937618116325, -416140566807949457, -502895008230805739, 28048438043857145, -555632029568602294, -200581930279535581, -312821693860251517, 401129908114424545, 372905298421136384, 904807605433609954, 792253171573189754, 824658821667913198, 441736812140816129, 579325191755982022, 593587832604370114, -226070220842775166, -280880605823393423, -666173989453378061, -467949634287323468, -8173664 -- (+1009 chars; full line in the Zenodo source)
[-563601513781265654, 77909823708983324, -164247876741073837, -792253171573189754, 25294265125924891, 74842017086762341, 185430287448457330, 561220640430950702, 904807605433609954, 714767164275730034, 858169790251478902, 788214816797662259, 184188937618116325, 48378971259925949, -279459895048886953, -328951645832464037, -824658821667913198, -817366428325835239, -400458165522901444, -634553378471 -- (+1008 chars; full line in the Zenodo source)
[-279459895048886953, -441736812140816129, -806378384914887017, -257243974715038561, -723934331078708356, 360393020487152999, -52261073465423740, 400458165522901444, 792253171573189754, 858169790251478902, 416140566807949457, 244528965028104610, -593587832604370114, -287611050603328271, -94340831500479479, -780893477061303559, -237595619753497748, -561220640430950702, 185430287448457330, 3729052 -- (+1011 chars; full line in the Zenodo source)
[-58690921930664687, -536197957484441800, 28048438043857145, -237595619753497748, 74842017086762341, 401129908114424545, 723934331078708356, 1098341903590515593, 824658821667913198, 788214816797662259, 244528965028104610, -226070220842775166, -464644367250090890, -858169790251478902, -817366428325835239, -931983436264351928, -192495065142207193, -52261073465423740, -25294265125924891, 1884649092 -- (+1008 chars; full line in the Zenodo source)
[-579325191755982022, -94340831500479479, -714767164275730034, -310050819803079079, -192495065142207193, 634553378471013191, 237595619753497748, 598310641100584792, 441736812140816129, 184188937618116325, -593587832604370114, -464644367250090890, -164247876741073837, -1098341903590515593, 264844200040584835, -185430287448457330, 347059962343663666, 257243974715038561, 824658821667913198, 4161405 -- (+1011 chars; full line in the Zenodo source)
[-280880605823393423, -697044967603623406, -128319880706802211, 264844200040584835, 185430287448457330, 723934331078708356, 817366428325835239, 502895008230805739, 579325191755982022, 48378971259925949, -287611050603328271, -858169790251478902, -1098341903590515593, -347059962343663666, -228174340647692836, 200581930279535581, 792253171573189754, 94340831500479479, 58690921930664687, 34661640216 -- (+1010 chars; full line in the Zenodo source)
[-287611050603328271, -164247876741073837, -555632029568602294, 74842017086762341, -115324751403707150, 904807605433609954, 601358229479582656, 788214816797662259, 593587832604370114, -279459895048886953, -94340831500479479, -817366428325835239, 264844200040584835, -228174340647692836, 931983436264351928, 188464909269528373, 666173989453378061, -293779850442496540, -244528965028104610, -44173681 -- (+1012 chars; full line in the Zenodo source)
[-267563322562215403, -467949634287323468, -237595619753497748, 115324751403707150, 561220640430950702, 1098341903590515593, 502895008230805739, 279459895048886953, -226070220842775166, -328951645832464037, -780893477061303559, -931983436264351928, -185430287448457330, 200581930279535581, 188464909269528373, 441736812140816129, 100276647491509000, -563601513781265654, -94340831500479479, -128319 -- (+1013 chars; full line in the Zenodo source)
[-464644367250090890, -601358229479582656, -400458165522901444, 228174340647692836, 200581930279535581, 780893477061303559, -77909823708983324, 326622280249753601, -280880605823393423, -824658821667913198, -237595619753497748, -192495065142207193, 347059962343663666, 792253171573189754, 666173989453378061, 100276647491509000, -279459895048886953, -697044967603623406, -555632029568602294, 5226107 -- (+1008 chars; full line in the Zenodo source)
[-416140566807949457, 28048438043857145, -200581930279535581, 401129908114424545, 904807605433609954, 824658821667913198, 579325191755982022, -226070220842775166, -666173989453378061, -817366428325835239, -561220640430950702, -52261073465423740, 257243974715038561, 94340831500479479, -293779850442496540, -563601513781265654, -697044967603623406, -428039393903389846, 115324751403707150, 347059962 -- (+1010 chars; full line in the Zenodo source)
[-788214816797662259, -188464909269528373, -347059962343663666, 312821693860251517, 257243974715038561, 778343033885053609, 100276647491509000, -579325191755982022, -467949634287323468, -400458165522901444, 185430287448457330, -25294265125924891, 824658821667913198, 58690921930664687, -244528965028104610, -94340831500479479, -555632029568602294, 115324751403707150, -264844200040584835, 780893477 -- (+1010 chars; full line in the Zenodo source)
[77909823708983324, -792253171573189754, 74842017086762341, 561220640430950702, 714767164275730034, 788214816797662259, 48378971259925949, -328951645832464037, -817366428325835239, -634553378471013191, 372905298421136384, 188464909269528373, 416140566807949457, 346616402164657138, -441736812140816129, -128319880706802211, 52261073465423740, 347059962343663666, 780893477061303559, 464644367250090 -- (+1009 chars; full line in the Zenodo source)
[-328951645832464037, -128319880706802211, -312821693860251517, 723934331078708356, 601358229479582656, 579325191755982022, 293779850442496540, -858169790251478902, 25294265125924891, -228174340647692836, 735690061936123285, 94340831500479479, 226070220842775166, -267563322562215403, -780893477061303559, -372905298421136384, -74842017086762341, 714767164275730034, 416140566807949457, -3266222802 -- (+1012 chars; full line in the Zenodo source)
[-441736812140816129, -257243974715038561, 360393020487152999, 400458165522901444, 858169790251478902, 244528965028104610, -287611050603328271, -780893477061303559, -561220640430950702, 372905298421136384, -28048438043857145, 280880605823393423, 293779850442496540, -164247876741073837, -310050819803079079, 192495065142207193, 1098341903590515593, 328951645832464037, 48378971259925949, -666173989 -- (+1010 chars; full line in the Zenodo source)
[-666173989453378061, -428039393903389846, -185430287448457330, 735690061936123285, 536197957484441800, -48378971259925949, -441736812140816129, -555632029568602294, 228174340647692836, 237595619753497748, 778343033885053609, -346616402164657138, -328951645832464037, -257243974715038561, -401129908114424545, 904807605433609954, 94340831500479479, 326622280249753601, 77909823708983324, -109834190 -- (+1010 chars; full line in the Zenodo source)
[-536197957484441800, -237595619753497748, 401129908114424545, 1098341903590515593, 788214816797662259, -226070220842775166, -858169790251478902, -931983436264351928, -52261073465423740, 188464909269528373, 280880605823393423, -563601513781265654, -601358229479582656, -372905298421136384, 347059962343663666, 806378384914887017, 184188937618116325, -287611050603328271, -714767164275730034, -31282 -- (+1011 chars; full line in the Zenodo source)
[-778343033885053609, 25294265125924891, -115324751403707150, 714767164275730034, 280880605823393423, -279459895048886953, 28048438043857145, -634553378471013191, 931983436264351928, 697044967603623406, 326622280249753601, -441736812140816129, -735690061936123285, 401129908114424545, 128319880706802211, 464644367250090890, 293779850442496540, -806378384914887017, -372905298421136384, -2648442000 -- (+1011 chars; full line in the Zenodo source)
[-94340831500479479, -310050819803079079, 634553378471013191, 598310641100584792, 184188937618116325, -464644367250090890, -1098341903590515593, -185430287448457330, 257243974715038561, 416140566807949457, 293779850442496540, -601358229479582656, 74842017086762341, 931983436264351928, 502895008230805739, -48378971259925949, -778343033885053609, -400458165522901444, -52261073465423740, -280484380 -- (+1012 chars; full line in the Zenodo source)
[-502895008230805739, -200581930279535581, 372905298421136384, 824658821667913198, 593587832604370114, -666173989453378061, 25294265125924891, -52261073465423740, 598310641100584792, -293779850442496540, -788214816797662259, -428039393903389846, -360393020487152999, 714767164275730034, 58690921930664687, -287611050603328271, -128319880706802211, -185430287448457330, 1098341903590515593, 26756332 -- (+1012 chars; full line in the Zenodo source)
[-697044967603623406, 264844200040584835, 723934331078708356, 502895008230805739, 48378971259925949, -858169790251478902, -347059962343663666, 200581930279535581, 94340831500479479, 346616402164657138, -164247876741073837, -372905298421136384, 931983436264351928, 778343033885053609, -326622280249753601, -824658821667913198, -561220640430950702, 310050819803079079, 536197957484441800, -5935878326 -- (+1009 chars; full line in the Zenodo source)
[-858169790251478902, -372905298421136384, 310050819803079079, 666173989453378061, -100276647491509000, -598310641100584792, 115324751403707150, 428039393903389846, 464644367250090890, -58690921930664687, -817366428325835239, 185430287448457330, 792253171573189754, 279459895048886953, -416140566807949457, -735690061936123285, 312821693860251517, 601358229479582656, 226070220842775166, -536197957 -- (+1007 chars; full line in the Zenodo source)
[-164247876741073837, 74842017086762341, 904807605433609954, 788214816797662259, -279459895048886953, -817366428325835239, -228174340647692836, 188464909269528373, -293779850442496540, -441736812140816129, -310050819803079079, 347059962343663666, 502895008230805739, -326622280249753601, -806378384914887017, -312821693860251517, 428039393903389846, 267563322562215403, -280880605823393423, -257243 -- (+1009 chars; full line in the Zenodo source)
[-824658821667913198, 52261073465423740, 428039393903389846, 287611050603328271, -267563322562215403, -735690061936123285, 634553378471013191, 164247876741073837, 48378971259925949, -467949634287323468, -312821693860251517, 555632029568602294, 280880605823393423, -464644367250090890, -237595619753497748, -74842017086762341, 858169790251478902, 346616402164657138, -806378384914887017, 11532475140 -- (+1009 chars; full line in the Zenodo source)
[-467949634287323468, 115324751403707150, 1098341903590515593, 279459895048886953, -328951645832464037, -931983436264351928, 200581930279535581, 441736812140816129, -563601513781265654, -128319880706802211, 192495065142207193, 806378384914887017, -48378971259925949, -824658821667913198, -312821693860251517, 257243974715038561, 58690921930664687, 77909823708983324, -310050819803079079, 7239343310 -- (+1008 chars; full line in the Zenodo source)
[-806378384914887017, 360393020487152999, 792253171573189754, 244528965028104610, -94340831500479479, -561220640430950702, 735690061936123285, 280880605823393423, -788214816797662259, -310050819803079079, 200581930279535581, 328951645832464037, -58690921930664687, -555632029568602294, 634553378471013191, 697044967603623406, -226070220842775166, -188464909269528373, -228174340647692836, 598310641 -- (+1006 chars; full line in the Zenodo source)
[-601358229479582656, 228174340647692836, 780893477061303559, 326622280249753601, -824658821667913198, -192495065142207193, 792253171573189754, 100276647491509000, -697044967603623406, 52261073465423740, 1098341903590515593, 184188937618116325, -778343033885053609, -561220640430950702, 428039393903389846, 58690921930664687, -441736812140816129, 264844200040584835, 904807605433609954, 28761105060 -- (+1007 chars; full line in the Zenodo source)
[-598310641100584792, 185430287448457330, 601358229479582656, 48378971259925949, 28048438043857145, -228174340647692836, 806378384914887017, 346616402164657138, -780893477061303559, 401129908114424545, 467949634287323468, -326622280249753601, -188464909269528373, -360393020487152999, 824658821667913198, -593587832604370114, -714767164275730034, 192495065142207193, 164247876741073837, -2260702208 -- (+1013 chars; full line in the Zenodo source)
[28048438043857145, 401129908114424545, 824658821667913198, -226070220842775166, -817366428325835239, -52261073465423740, 94340831500479479, -563601513781265654, -428039393903389846, 347059962343663666, 328951645832464037, -287611050603328271, -400458165522901444, 310050819803079079, 267563322562215403, 77909823708983324, 264844200040584835, 735690061936123285, 279459895048886953, -7783430338850 -- (+1007 chars; full line in the Zenodo source)
[-780893477061303559, 192495065142207193, 697044967603623406, -184188937618116325, -428039393903389846, -264844200040584835, 788214816797662259, -416140566807949457, -723934331078708356, 735690061936123285, 563601513781265654, -502895008230805739, 115324751403707150, 188464909269528373, -48378971259925949, 28048438043857145, -360393020487152999, 858169790251478902, 293779850442496540, -555632029 -- (+1013 chars; full line in the Zenodo source)
[-188464909269528373, 312821693860251517, 778343033885053609, -579325191755982022, -400458165522901444, -25294265125924891, 58690921930664687, -94340831500479479, 115324751403707150, 780893477061303559, 48378971259925949, -714767164275730034, -52261073465423740, 536197957484441800, -280880605823393423, -310050819803079079, 904807605433609954, 279459895048886953, -502895008230805739, -19249506514 -- (+1013 chars; full line in the Zenodo source)
[-714767164275730034, 634553378471013191, 441736812140816129, -464644367250090890, 264844200040584835, 257243974715038561, 226070220842775166, -601358229479582656, -360393020487152999, 502895008230805739, -58690921930664687, -400458165522901444, 904807605433609954, 563601513781265654, -858169790251478902, 228174340647692836, 467949634287323468, -244528965028104610, -428039393903389846, 200581930 -- (+1010 chars; full line in the Zenodo source)
[-792253171573189754, 561220640430950702, 788214816797662259, -328951645832464037, -634553378471013191, 188464909269528373, 346616402164657138, -128319880706802211, 347059962343663666, 464644367250090890, -666173989453378061, -312821693860251517, -28048438043857145, -593587832604370114, -257243974715038561, 723934331078708356, 287611050603328271, -778343033885053609, -192495065142207193, 6013582 -- (+1014 chars; full line in the Zenodo source)
[-817366428325835239, 347059962343663666, 267563322562215403, -778343033885053609, 360393020487152999, 467949634287323468, -184188937618116325, 25294265125924891, 237595619753497748, 244528965028104610, -601358229479582656, -115324751403707150, 666173989453378061, -416140566807949457, -561220640430950702, 714767164275730034, 346616402164657138, -1098341903590515593, 723934331078708356, 280880605 -- (+1007 chars; full line in the Zenodo source)
[-128319880706802211, 723934331078708356, 579325191755982022, -858169790251478902, -228174340647692836, 94340831500479479, -267563322562215403, -372905298421136384, 714767164275730034, -326622280249753601, -555632029568602294, 310050819803079079, 563601513781265654, -467949634287323468, 192495065142207193, 666173989453378061, -788214816797662259, -634553378471013191, -28048438043857145, -1002766 -- (+1015 chars; full line in the Zenodo source)
[-1098341903590515593, 931983436264351928, 563601513781265654, -806378384914887017, 312821693860251517, -77909823708983324, -666173989453378061, 360393020487152999, 164247876741073837, -579325191755982022, 264844200040584835, 792253171573189754, -326622280249753601, -428039393903389846, -25294265125924891, 244528965028104610, 28048438043857145, -74842017086762341, 464644367250090890, -9434083150 -- (+1012 chars; full line in the Zenodo source)
[-257243974715038561, 400458165522901444, 244528965028104610, -780893477061303559, 372905298421136384, 280880605823393423, -164247876741073837, 192495065142207193, 328951645832464037, -666173989453378061, -401129908114424545, 697044967603623406, -267563322562215403, 74842017086762341, 598310641100584792, -184188937618116325, -931983436264351928, 128319880706802211, 346616402164657138, -428039393 -- (+1007 chars; full line in the Zenodo source)
[-555632029568602294, 904807605433609954, 593587832604370114, -817366428325835239, 931983436264351928, -293779850442496540, -780893477061303559, 347059962343663666, 58690921930664687, -806378384914887017, 634553378471013191, 267563322562215403, -858169790251478902, 192495065142207193, -77909823708983324, -778343033885053609, 185430287448457330, 536197957484441800, -328951645832464037, 3603930204 -- (+1013 chars; full line in the Zenodo source)
[-428039393903389846, 735690061936123285, -48378971259925949, -555632029568602294, 237595619753497748, -346616402164657138, -257243974715038561, 904807605433609954, 326622280249753601, -1098341903590515593, -25294265125924891, 593587832604370114, -128319880706802211, 400458165522901444, 226070220842775166, -817366428325835239, 310050819803079079, 100276647491509000, -792253171573189754, 93198343 -- (+1009 chars; full line in the Zenodo source)
[-735690061936123285, 555632029568602294, 346616402164657138, -904807605433609954, 1098341903590515593, -593587832604370114, -400458165522901444, 817366428325835239, -100276647491509000, -931983436264351928, 714767164275730034, 293779850442496540, -723934331078708356, 780893477061303559, -563601513781265654, -347059962343663666, 598310641100584792, -58690921930664687, -561220640430950702, 806378 -- (+1015 chars; full line in the Zenodo source)
[-237595619753497748, 1098341903590515593, -226070220842775166, -931983436264351928, 188464909269528373, -563601513781265654, -372905298421136384, 806378384914887017, -287611050603328271, -312821693860251517, 697044967603623406, 77909823708983324, 228174340647692836, 666173989453378061, -778343033885053609, -360393020487152999, 416140566807949457, -164247876741073837, 634553378471013191, 5793251 -- (+1012 chars; full line in the Zenodo source)
[-904807605433609954, 817366428325835239, 293779850442496540, -347059962343663666, 806378384914887017, -267563322562215403, -192495065142207193, 778343033885053609, -536197957484441800, -360393020487152999, 464644367250090890, -467949634287323468, 372905298421136384, 184188937618116325, -792253171573189754, -25294265125924891, -48378971259925949, -237595619753497748, 128319880706802211, -2445289 -- (+1013 chars; full line in the Zenodo source)
[25294265125924891, 714767164275730034, -279459895048886953, -634553378471013191, 697044967603623406, -441736812140816129, 401129908114424545, 464644367250090890, -806378384914887017, -264844200040584835, 100276647491509000, -257243974715038561, 555632029568602294, -226070220842775166, -723934331078708356, 601358229479582656, -267563322562215403, 360393020487152999, 666173989453378061, -50289500 -- (+1012 chars; full line in the Zenodo source)
[-400458165522901444, 780893477061303559, -280880605823393423, -192495065142207193, 666173989453378061, -697044967603623406, -74842017086762341, 184188937618116325, -128319880706802211, 428039393903389846, -226070220842775166, 264844200040584835, 467949634287323468, -788214816797662259, 185430287448457330, 416140566807949457, -806378384914887017, 723934331078708356, 593587832604370114, -73569006 -- (+1011 chars; full line in the Zenodo source)
[-310050819803079079, 598310641100584792, -464644367250090890, -185430287448457330, 416140566807949457, -601358229479582656, 931983436264351928, -48378971259925949, -400458165522901444, -28048438043857145, -267563322562215403, 228174340647692836, 788214816797662259, -806378384914887017, 200581930279535581, -346616402164657138, 25294265125924891, 780893477061303559, -287611050603328271, -40112990 -- (+1013 chars; full line in the Zenodo source)
[-931983436264351928, 806378384914887017, 77909823708983324, -360393020487152999, 579325191755982022, -792253171573189754, 428039393903389846, -244528965028104610, 74842017086762341, 94340831500479479, -502895008230805739, 561220640430950702, 100276647491509000, -735690061936123285, 714767164275730034, -280880605823393423, -401129908114424545, 788214816797662259, -601358229479582656, 31005081980 -- (+1006 chars; full line in the Zenodo source)
[-200581930279535581, 824658821667913198, -666173989453378061, -52261073465423740, -293779850442496540, -428039393903389846, 714767164275730034, -287611050603328271, -185430287448457330, 267563322562215403, -188464909269528373, 735690061936123285, -244528965028104610, -634553378471013191, 536197957484441800, -164247876741073837, 723934331078708356, -48378971259925949, -931983436264351928, 467949 -- (+1013 chars; full line in the Zenodo source)
[-723934331078708356, 858169790251478902, -94340831500479479, 372905298421136384, 326622280249753601, -310050819803079079, 467949634287323468, -666173989453378061, 634553378471013191, 100276647491509000, -904807605433609954, 598310641100584792, 77909823708983324, -115324751403707150, 184188937618116325, -428039393903389846, 188464909269528373, -464644367250090890, 401129908114424545, 58690921930 -- (+1011 chars; full line in the Zenodo source)
[264844200040584835, 502895008230805739, -858169790251478902, 200581930279535581, 346616402164657138, -372905298421136384, 778343033885053609, -824658821667913198, 310050819803079079, -593587832604370114, 74842017086762341, 666173989453378061, -806378384914887017, -25294265125924891, -100276647491509000, 52261073465423740, 328951645832464037, -598310641100584792, 237595619753497748, 293779850442 -- (+1004 chars; full line in the Zenodo source)
[-347059962343663666, 778343033885053609, -467949634287323468, -25294265125924891, -244528965028104610, 115324751403707150, 416140566807949457, -714767164275730034, 1098341903590515593, -280880605823393423, -228174340647692836, 279459895048886953, -428039393903389846, -28048438043857145, -328951645832464037, 634553378471013191, 593587832604370114, -931983436264351928, 858169790251478902, -697044 -- (+1011 chars; full line in the Zenodo source)
[-372905298421136384, 666173989453378061, -598310641100584792, 428039393903389846, -58690921930664687, 185430287448457330, 279459895048886953, -735690061936123285, 601358229479582656, -536197957484441800, 347059962343663666, 48378971259925949, -561220640430950702, 441736812140816129, 28048438043857145, 555632029568602294, -579325191755982022, -228174340647692836, 563601513781265654, -23759561975 -- (+1010 chars; full line in the Zenodo source)
[-561220640430950702, 328951645832464037, -188464909269528373, 128319880706802211, -464644367250090890, 312821693860251517, 593587832604370114, -723934331078708356, 778343033885053609, -601358229479582656, 428039393903389846, -579325191755982022, 401129908114424545, -293779850442496540, -400458165522901444, 858169790251478902, -164247876741073837, -25294265125924891, -184188937618116325, 2281743 -- (+1012 chars; full line in the Zenodo source)
[74842017086762341, 788214816797662259, -817366428325835239, 188464909269528373, -441736812140816129, 347059962343663666, -326622280249753601, -312821693860251517, 267563322562215403, -257243974715038561, 598310641100584792, -778343033885053609, 200581930279535581, -100276647491509000, 360393020487152999, 579325191755982022, -735690061936123285, 467949634287323468, -697044967603623406, 400458165 -- (+1008 chars; full line in the Zenodo source)
[-634553378471013191, 464644367250090890, -257243974715038561, 601358229479582656, -502895008230805739, 400458165522901444, -563601513781265654, -228174340647692836, 244528965028104610, -200581930279535581, 536197957484441800, -780893477061303559, 817366428325835239, 77909823708983324, 372905298421136384, -326622280249753601, 115324751403707150, 280880605823393423, -735690061936123285, 824658821 -- (+1008 chars; full line in the Zenodo source)
[52261073465423740, 287611050603328271, -735690061936123285, 164247876741073837, -467949634287323468, 555632029568602294, -464644367250090890, -74842017086762341, 346616402164657138, 115324751403707150, 579325191755982022, -904807605433609954, 697044967603623406, -601358229479582656, 1098341903590515593, -788214816797662259, 372905298421136384, -593587832604370114, 360393020487152999, 2794598950 -- (+1008 chars; full line in the Zenodo source)
[-312821693860251517, 579325191755982022, 25294265125924891, 94340831500479479, -780893477061303559, 714767164275730034, -536197957484441800, 310050819803079079, -279459895048886953, 192495065142207193, -346616402164657138, -634553378471013191, 287611050603328271, -237595619753497748, 697044967603623406, -598310641100584792, 817366428325835239, -441736812140816129, 200581930279535581, -184188937 -- (+1011 chars; full line in the Zenodo source)
[115324751403707150, 279459895048886953, -931983436264351928, 441736812140816129, -128319880706802211, 806378384914887017, -824658821667913198, 257243974715038561, 77909823708983324, 723934331078708356, -184188937618116325, -360393020487152999, -346616402164657138, 52261073465423740, 579325191755982022, -400458165522901444, 536197957484441800, -792253171573189754, 598310641100584792, -8581697902 -- (+1009 chars; full line in the Zenodo source)
[-192495065142207193, 184188937618116325, 264844200040584835, 416140566807949457, -735690061936123285, 502895008230805739, -188464909269528373, -28048438043857145, -858169790251478902, 555632029568602294, 77909823708983324, 200581930279535581, -279459895048886953, 312821693860251517, 346616402164657138, -401129908114424545, 244528965028104610, -372905298421136384, 267563322562215403, -9048076054 -- (+1009 chars; full line in the Zenodo source)
[360393020487152999, 244528965028104610, -561220640430950702, 280880605823393423, -310050819803079079, 328951645832464037, -555632029568602294, 697044967603623406, -188464909269528373, 598310641100584792, -824658821667913198, 128319880706802211, -536197957484441800, 904807605433609954, -464644367250090890, -264844200040584835, -563601513781265654, 312821693860251517, -326622280249753601, -185430 -- (+1013 chars; full line in the Zenodo source)
[-401129908114424545, 226070220842775166, 52261073465423740, 563601513781265654, -347059962343663666, 287611050603328271, -310050819803079079, -77909823708983324, -735690061936123285, 778343033885053609, -128319880706802211, 164247876741073837, -780893477061303559, 598310641100584792, -467949634287323468, 792253171573189754, -502895008230805739, 555632029568602294, -441736812140816129, -25294265 -- (+1011 chars; full line in the Zenodo source)
[228174340647692836, 326622280249753601, -192495065142207193, 100276647491509000, 52261073465423740, 184188937618116325, -561220640430950702, 58690921930664687, 264844200040584835, 287611050603328271, -931983436264351928, 416140566807949457, 25294265125924891, 328951645832464037, -735690061936123285, 536197957484441800, -257243974715038561, 502895008230805739, -817366428325835239, 16424787674107 -- (+1006 chars; full line in the Zenodo source)
[-185430287448457330, -48378971259925949, 228174340647692836, -346616402164657138, -401129908114424545, 326622280249753601, 360393020487152999, 593587832604370114, -192495065142207193, 226070220842775166, 115324751403707150, 100276647491509000, -312821693860251517, 244528965028104610, 52261073465423740, -293779850442496540, -634553378471013191, 184188937618116325, 74842017086762341, 563601513781 -- (+1007 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 69).map (fun t => rowA (138 + 1) t (rng 1 69)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 69 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 69 B A = sid 1760180501020972344858 69 := rfl
theorem d_ne : (1760180501020972344858 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 69 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 69) (h0 : mv A g = zeros 69) : g = zeros 69 :=
kernel_zero 69 1760180501020972344858 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 138 69 = true := rfl
/-- **Balanced ⇒ pairs for p = 139.** A list with entries in (0, 139) that is balanced for 1 ≤ t ≤ 69
has as many copies of x as of 139 − x for every 1 ≤ x ≤ 69 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 139)
(hb : ∀ t, 1 ≤ t → t < 1 + 69 → tsum 139 t c + tsum 139 t c = c.length * 139) :
(rng 1 69).all (fun x => Nat.beq (cnt x c) (cnt (139 - x) c)) = true :=
pairs_of_bal 138 69 1760180501020972344858 d_ne A B len cert A_def delta c hr hb
end MailletCert139
#print axioms MailletCert139.A_def
#print axioms MailletCert139.len
#print axioms MailletCert139.cert
#print axioms MailletCert139.d_ne
#print axioms MailletCert139.kernel
#print axioms MailletCert139.delta
#print axioms MailletCert139.pairs
lean_all/hodge/MailletCert149.lean
/-
hodge/MailletCert149.lean — T41 (goals G849b, G849c): for p = 149 the 74 × 74 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 74)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 68330194062259355532237966 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 149) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert149
open MailletLin MailletBridge
def A : List (List Int) := [
[-147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-145, -141, -137, -133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, 143, 147],
[-143, -137, -131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145],
[-139, -129, -119, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, 141, -147, -137, -127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, -145, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-137, -125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103, 115, 127, 139, -147, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, 141, -145, -133, -121, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, 119, 131, 143],
[-135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, 145, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, -143, -129, -115, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, 123, 137, -147, -133, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, -143, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, -137, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, 135, -147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, 141],
[-131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, 139, -141, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, 147, -133, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, 137, -143, -125, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, 127, 145, -135, -117, -99, -81, -63, -45, -27, -9],
[-129, -109, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91, 111, 131, -147, -127, -107, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, 113, 133, -145, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, -143, -123, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, 117, 137, -141, -121, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, 119, 139],
[-127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, -139, -117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, 147, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, -141, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, 145, -131, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, 133, -143, -121, -99, -77, -55, -33, -11],
[-125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, 139, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, -145, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119, 143, -131, -107, -83, -59, -35, -11, 13, 37, 61, 85, 109, 133, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, -127, -103, -79, -55, -31, -7, 17, 41, 65, 89, 113, 137],
[-123, -97, -71, -45, -19, 7, 33, 59, 85, 111, 137, -135, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, -147, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, 139, -133, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, -145, -119, -93, -67, -41, -15, 11, 37, 63, 89, 115, 141, -131, -105, -79, -53, -27, -1, 25, 51, 77, 103, 129, -143, -117, -91, -65, -39, -13],
[-121, -93, -65, -37, -9, 19, 47, 75, 103, 131, -139, -111, -83, -55, -27, 1, 29, 57, 85, 113, 141, -129, -101, -73, -45, -17, 11, 39, 67, 95, 123, -147, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, -137, -109, -81, -53, -25, 3, 31, 59, 87, 115, 143, -127, -99, -71, -43, -15, 13, 41, 69, 97, 125, -145, -117, -89, -61, -33, -5, 23, 51, 79, 107, 135],
[-119, -89, -59, -29, 1, 31, 61, 91, 121, -147, -117, -87, -57, -27, 3, 33, 63, 93, 123, -145, -115, -85, -55, -25, 5, 35, 65, 95, 125, -143, -113, -83, -53, -23, 7, 37, 67, 97, 127, -141, -111, -81, -51, -21, 9, 39, 69, 99, 129, -139, -109, -79, -49, -19, 11, 41, 71, 101, 131, -137, -107, -77, -47, -17, 13, 43, 73, 103, 133, -135, -105, -75, -45, -15],
[-117, -85, -53, -21, 11, 43, 75, 107, 139, -127, -95, -63, -31, 1, 33, 65, 97, 129, -137, -105, -73, -41, -9, 23, 55, 87, 119, -147, -115, -83, -51, -19, 13, 45, 77, 109, 141, -125, -93, -61, -29, 3, 35, 67, 99, 131, -135, -103, -71, -39, -7, 25, 57, 89, 121, -145, -113, -81, -49, -17, 15, 47, 79, 111, 143, -123, -91, -59, -27, 5, 37, 69, 101, 133],
[-115, -81, -47, -13, 21, 55, 89, 123, -141, -107, -73, -39, -5, 29, 63, 97, 131, -133, -99, -65, -31, 3, 37, 71, 105, 139, -125, -91, -57, -23, 11, 45, 79, 113, 147, -117, -83, -49, -15, 19, 53, 87, 121, -143, -109, -75, -41, -7, 27, 61, 95, 129, -135, -101, -67, -33, 1, 35, 69, 103, 137, -127, -93, -59, -25, 9, 43, 77, 111, 145, -119, -85, -51, -17],
[-113, -77, -41, -5, 31, 67, 103, 139, -123, -87, -51, -15, 21, 57, 93, 129, -133, -97, -61, -25, 11, 47, 83, 119, -143, -107, -71, -35, 1, 37, 73, 109, 145, -117, -81, -45, -9, 27, 63, 99, 135, -127, -91, -55, -19, 17, 53, 89, 125, -137, -101, -65, -29, 7, 43, 79, 115, -147, -111, -75, -39, -3, 33, 69, 105, 141, -121, -85, -49, -13, 23, 59, 95, 131],
[-111, -73, -35, 3, 41, 79, 117, -143, -105, -67, -29, 9, 47, 85, 123, -137, -99, -61, -23, 15, 53, 91, 129, -131, -93, -55, -17, 21, 59, 97, 135, -125, -87, -49, -11, 27, 65, 103, 141, -119, -81, -43, -5, 33, 71, 109, 147, -113, -75, -37, 1, 39, 77, 115, -145, -107, -69, -31, 7, 45, 83, 121, -139, -101, -63, -25, 13, 51, 89, 127, -133, -95, -57, -19],
[-109, -69, -29, 11, 51, 91, 131, -127, -87, -47, -7, 33, 73, 113, -145, -105, -65, -25, 15, 55, 95, 135, -123, -83, -43, -3, 37, 77, 117, -141, -101, -61, -21, 19, 59, 99, 139, -119, -79, -39, 1, 41, 81, 121, -137, -97, -57, -17, 23, 63, 103, 143, -115, -75, -35, 5, 45, 85, 125, -133, -93, -53, -13, 27, 67, 107, 147, -111, -71, -31, 9, 49, 89, 129],
[-107, -65, -23, 19, 61, 103, 145, -111, -69, -27, 15, 57, 99, 141, -115, -73, -31, 11, 53, 95, 137, -119, -77, -35, 7, 49, 91, 133, -123, -81, -39, 3, 45, 87, 129, -127, -85, -43, -1, 41, 83, 125, -131, -89, -47, -5, 37, 79, 121, -135, -93, -51, -9, 33, 75, 117, -139, -97, -55, -13, 29, 71, 113, -143, -101, -59, -17, 25, 67, 109, -147, -105, -63, -21],
[-105, -61, -17, 27, 71, 115, -139, -95, -51, -7, 37, 81, 125, -129, -85, -41, 3, 47, 91, 135, -119, -75, -31, 13, 57, 101, 145, -109, -65, -21, 23, 67, 111, -143, -99, -55, -11, 33, 77, 121, -133, -89, -45, -1, 43, 87, 131, -123, -79, -35, 9, 53, 97, 141, -113, -69, -25, 19, 63, 107, -147, -103, -59, -15, 29, 73, 117, -137, -93, -49, -5, 39, 83, 127],
[-103, -57, -11, 35, 81, 127, -125, -79, -33, 13, 59, 105, -147, -101, -55, -9, 37, 83, 129, -123, -77, -31, 15, 61, 107, -145, -99, -53, -7, 39, 85, 131, -121, -75, -29, 17, 63, 109, -143, -97, -51, -5, 41, 87, 133, -119, -73, -27, 19, 65, 111, -141, -95, -49, -3, 43, 89, 135, -117, -71, -25, 21, 67, 113, -139, -93, -47, -1, 45, 91, 137, -115, -69, -23],
[-101, -53, -5, 43, 91, 139, -111, -63, -15, 33, 81, 129, -121, -73, -25, 23, 71, 119, -131, -83, -35, 13, 61, 109, -141, -93, -45, 3, 51, 99, 147, -103, -55, -7, 41, 89, 137, -113, -65, -17, 31, 79, 127, -123, -75, -27, 21, 69, 117, -133, -85, -37, 11, 59, 107, -143, -95, -47, 1, 49, 97, 145, -105, -57, -9, 39, 87, 135, -115, -67, -19, 29, 77, 125],
[-99, -49, 1, 51, 101, -147, -97, -47, 3, 53, 103, -145, -95, -45, 5, 55, 105, -143, -93, -43, 7, 57, 107, -141, -91, -41, 9, 59, 109, -139, -89, -39, 11, 61, 111, -137, -87, -37, 13, 63, 113, -135, -85, -35, 15, 65, 115, -133, -83, -33, 17, 67, 117, -131, -81, -31, 19, 69, 119, -129, -79, -29, 21, 71, 121, -127, -77, -27, 23, 73, 123, -125, -75, -25],
[-97, -45, 7, 59, 111, -135, -83, -31, 21, 73, 125, -121, -69, -17, 35, 87, 139, -107, -55, -3, 49, 101, -145, -93, -41, 11, 63, 115, -131, -79, -27, 25, 77, 129, -117, -65, -13, 39, 91, 143, -103, -51, 1, 53, 105, -141, -89, -37, 15, 67, 119, -127, -75, -23, 29, 81, 133, -113, -61, -9, 43, 95, 147, -99, -47, 5, 57, 109, -137, -85, -33, 19, 71, 123],
[-95, -41, 13, 67, 121, -123, -69, -15, 39, 93, 147, -97, -43, 11, 65, 119, -125, -71, -17, 37, 91, 145, -99, -45, 9, 63, 117, -127, -73, -19, 35, 89, 143, -101, -47, 7, 61, 115, -129, -75, -21, 33, 87, 141, -103, -49, 5, 59, 113, -131, -77, -23, 31, 85, 139, -105, -51, 3, 57, 111, -133, -79, -25, 29, 83, 137, -107, -53, 1, 55, 109, -135, -81, -27],
[-93, -37, 19, 75, 131, -111, -55, 1, 57, 113, -129, -73, -17, 39, 95, -147, -91, -35, 21, 77, 133, -109, -53, 3, 59, 115, -127, -71, -15, 41, 97, -145, -89, -33, 23, 79, 135, -107, -51, 5, 61, 117, -125, -69, -13, 43, 99, -143, -87, -31, 25, 81, 137, -105, -49, 7, 63, 119, -123, -67, -11, 45, 101, -141, -85, -29, 27, 83, 139, -103, -47, 9, 65, 121],
[-91, -33, 25, 83, 141, -99, -41, 17, 75, 133, -107, -49, 9, 67, 125, -115, -57, 1, 59, 117, -123, -65, -7, 51, 109, -131, -73, -15, 43, 101, -139, -81, -23, 35, 93, -147, -89, -31, 27, 85, 143, -97, -39, 19, 77, 135, -105, -47, 11, 69, 127, -113, -55, 3, 61, 119, -121, -63, -5, 53, 111, -129, -71, -13, 45, 103, -137, -79, -21, 37, 95, -145, -87, -29],
[-89, -29, 31, 91, -147, -87, -27, 33, 93, -145, -85, -25, 35, 95, -143, -83, -23, 37, 97, -141, -81, -21, 39, 99, -139, -79, -19, 41, 101, -137, -77, -17, 43, 103, -135, -75, -15, 45, 105, -133, -73, -13, 47, 107, -131, -71, -11, 49, 109, -129, -69, -9, 51, 111, -127, -67, -7, 53, 113, -125, -65, -5, 55, 115, -123, -63, -3, 57, 117, -121, -61, -1, 59, 119],
[-87, -25, 37, 99, -137, -75, -13, 49, 111, -125, -63, -1, 61, 123, -113, -51, 11, 73, 135, -101, -39, 23, 85, 147, -89, -27, 35, 97, -139, -77, -15, 47, 109, -127, -65, -3, 59, 121, -115, -53, 9, 71, 133, -103, -41, 21, 83, 145, -91, -29, 33, 95, -141, -79, -17, 45, 107, -129, -67, -5, 57, 119, -117, -55, 7, 69, 131, -105, -43, 19, 81, 143, -93, -31],
[-85, -21, 43, 107, -127, -63, 1, 65, 129, -105, -41, 23, 87, -147, -83, -19, 45, 109, -125, -61, 3, 67, 131, -103, -39, 25, 89, -145, -81, -17, 47, 111, -123, -59, 5, 69, 133, -101, -37, 27, 91, -143, -79, -15, 49, 113, -121, -57, 7, 71, 135, -99, -35, 29, 93, -141, -77, -13, 51, 115, -119, -55, 9, 73, 137, -97, -33, 31, 95, -139, -75, -11, 53, 117],
[-83, -17, 49, 115, -117, -51, 15, 81, 147, -85, -19, 47, 113, -119, -53, 13, 79, 145, -87, -21, 45, 111, -121, -55, 11, 77, 143, -89, -23, 43, 109, -123, -57, 9, 75, 141, -91, -25, 41, 107, -125, -59, 7, 73, 139, -93, -27, 39, 105, -127, -61, 5, 71, 137, -95, -29, 37, 103, -129, -63, 3, 69, 135, -97, -31, 35, 101, -131, -65, 1, 67, 133, -99, -33],
[-81, -13, 55, 123, -107, -39, 29, 97, -133, -65, 3, 71, 139, -91, -23, 45, 113, -117, -49, 19, 87, -143, -75, -7, 61, 129, -101, -33, 35, 103, -127, -59, 9, 77, 145, -85, -17, 51, 119, -111, -43, 25, 93, -137, -69, -1, 67, 135, -95, -27, 41, 109, -121, -53, 15, 83, -147, -79, -11, 57, 125, -105, -37, 31, 99, -131, -63, 5, 73, 141, -89, -21, 47, 115],
[-79, -9, 61, 131, -97, -27, 43, 113, -115, -45, 25, 95, -133, -63, 7, 77, 147, -81, -11, 59, 129, -99, -29, 41, 111, -117, -47, 23, 93, -135, -65, 5, 75, 145, -83, -13, 57, 127, -101, -31, 39, 109, -119, -49, 21, 91, -137, -67, 3, 73, 143, -85, -15, 55, 125, -103, -33, 37, 107, -121, -51, 19, 89, -139, -69, 1, 71, 141, -87, -17, 53, 123, -105, -35],
[-77, -5, 67, 139, -87, -15, 57, 129, -97, -25, 47, 119, -107, -35, 37, 109, -117, -45, 27, 99, -127, -55, 17, 89, -137, -65, 7, 79, -147, -75, -3, 69, 141, -85, -13, 59, 131, -95, -23, 49, 121, -105, -33, 39, 111, -115, -43, 29, 101, -125, -53, 19, 91, -135, -63, 9, 81, -145, -73, -1, 71, 143, -83, -11, 61, 133, -93, -21, 51, 123, -103, -31, 41, 113],
[-75, -1, 73, 147, -77, -3, 71, 145, -79, -5, 69, 143, -81, -7, 67, 141, -83, -9, 65, 139, -85, -11, 63, 137, -87, -13, 61, 135, -89, -15, 59, 133, -91, -17, 57, 131, -93, -19, 55, 129, -95, -21, 53, 127, -97, -23, 51, 125, -99, -25, 49, 123, -101, -27, 47, 121, -103, -29, 45, 119, -105, -31, 43, 117, -107, -33, 41, 115, -109, -35, 39, 113, -111, -37],
[-73, 3, 79, -143, -67, 9, 85, -137, -61, 15, 91, -131, -55, 21, 97, -125, -49, 27, 103, -119, -43, 33, 109, -113, -37, 39, 115, -107, -31, 45, 121, -101, -25, 51, 127, -95, -19, 57, 133, -89, -13, 63, 139, -83, -7, 69, 145, -77, -1, 75, -147, -71, 5, 81, -141, -65, 11, 87, -135, -59, 17, 93, -129, -53, 23, 99, -123, -47, 29, 105, -117, -41, 35, 111],
[-71, 7, 85, -135, -57, 21, 99, -121, -43, 35, 113, -107, -29, 49, 127, -93, -15, 63, 141, -79, -1, 77, -143, -65, 13, 91, -129, -51, 27, 105, -115, -37, 41, 119, -101, -23, 55, 133, -87, -9, 69, 147, -73, 5, 83, -137, -59, 19, 97, -123, -45, 33, 111, -109, -31, 47, 125, -95, -17, 61, 139, -81, -3, 75, -145, -67, 11, 89, -131, -53, 25, 103, -117, -39],
[-69, 11, 91, -127, -47, 33, 113, -105, -25, 55, 135, -83, -3, 77, -141, -61, 19, 99, -119, -39, 41, 121, -97, -17, 63, 143, -75, 5, 85, -133, -53, 27, 107, -111, -31, 49, 129, -89, -9, 71, -147, -67, 13, 93, -125, -45, 35, 115, -103, -23, 57, 137, -81, -1, 79, -139, -59, 21, 101, -117, -37, 43, 123, -95, -15, 65, 145, -73, 7, 87, -131, -51, 29, 109],
[-67, 15, 97, -119, -37, 45, 127, -89, -7, 75, -141, -59, 23, 105, -111, -29, 53, 135, -81, 1, 83, -133, -51, 31, 113, -103, -21, 61, 143, -73, 9, 91, -125, -43, 39, 121, -95, -13, 69, -147, -65, 17, 99, -117, -35, 47, 129, -87, -5, 77, -139, -57, 25, 107, -109, -27, 55, 137, -79, 3, 85, -131, -49, 33, 115, -101, -19, 63, 145, -71, 11, 93, -123, -41],
[-65, 19, 103, -111, -27, 57, 141, -73, 11, 95, -119, -35, 49, 133, -81, 3, 87, -127, -43, 41, 125, -89, -5, 79, -135, -51, 33, 117, -97, -13, 71, -143, -59, 25, 109, -105, -21, 63, 147, -67, 17, 101, -113, -29, 55, 139, -75, 9, 93, -121, -37, 47, 131, -83, 1, 85, -129, -45, 39, 123, -91, -7, 77, -137, -53, 31, 115, -99, -15, 69, -145, -61, 23, 107],
[-63, 23, 109, -103, -17, 69, -143, -57, 29, 115, -97, -11, 75, -137, -51, 35, 121, -91, -5, 81, -131, -45, 41, 127, -85, 1, 87, -125, -39, 47, 133, -79, 7, 93, -119, -33, 53, 139, -73, 13, 99, -113, -27, 59, 145, -67, 19, 105, -107, -21, 65, -147, -61, 25, 111, -101, -15, 71, -141, -55, 31, 117, -95, -9, 77, -135, -49, 37, 123, -89, -3, 83, -129, -43],
[-61, 27, 115, -95, -7, 81, -129, -41, 47, 135, -75, 13, 101, -109, -21, 67, -143, -55, 33, 121, -89, -1, 87, -123, -35, 53, 141, -69, 19, 107, -103, -15, 73, -137, -49, 39, 127, -83, 5, 93, -117, -29, 59, 147, -63, 25, 113, -97, -9, 79, -131, -43, 45, 133, -77, 11, 99, -111, -23, 65, -145, -57, 31, 119, -91, -3, 85, -125, -37, 51, 139, -71, 17, 105],
[-59, 31, 121, -87, 3, 93, -115, -25, 65, -143, -53, 37, 127, -81, 9, 99, -109, -19, 71, -137, -47, 43, 133, -75, 15, 105, -103, -13, 77, -131, -41, 49, 139, -69, 21, 111, -97, -7, 83, -125, -35, 55, 145, -63, 27, 117, -91, -1, 89, -119, -29, 61, -147, -57, 33, 123, -85, 5, 95, -113, -23, 67, -141, -51, 39, 129, -79, 11, 101, -107, -17, 73, -135, -45],
[-57, 35, 127, -79, 13, 105, -101, -9, 83, -123, -31, 61, -145, -53, 39, 131, -75, 17, 109, -97, -5, 87, -119, -27, 65, -141, -49, 43, 135, -71, 21, 113, -93, -1, 91, -115, -23, 69, -137, -45, 47, 139, -67, 25, 117, -89, 3, 95, -111, -19, 73, -133, -41, 51, 143, -63, 29, 121, -85, 7, 99, -107, -15, 77, -129, -37, 55, 147, -59, 33, 125, -81, 11, 103],
[-55, 39, 133, -71, 23, 117, -87, 7, 101, -103, -9, 85, -119, -25, 69, -135, -41, 53, 147, -57, 37, 131, -73, 21, 115, -89, 5, 99, -105, -11, 83, -121, -27, 67, -137, -43, 51, 145, -59, 35, 129, -75, 19, 113, -91, 3, 97, -107, -13, 81, -123, -29, 65, -139, -45, 49, 143, -61, 33, 127, -77, 17, 111, -93, 1, 95, -109, -15, 79, -125, -31, 63, -141, -47],
[-53, 43, 139, -63, 33, 129, -73, 23, 119, -83, 13, 109, -93, 3, 99, -103, -7, 89, -113, -17, 79, -123, -27, 69, -133, -37, 59, -143, -47, 49, 145, -57, 39, 135, -67, 29, 125, -77, 19, 115, -87, 9, 105, -97, -1, 95, -107, -11, 85, -117, -21, 75, -127, -31, 65, -137, -41, 55, -147, -51, 45, 141, -61, 35, 131, -71, 25, 121, -81, 15, 111, -91, 5, 101],
[-51, 47, 145, -55, 43, 141, -59, 39, 137, -63, 35, 133, -67, 31, 129, -71, 27, 125, -75, 23, 121, -79, 19, 117, -83, 15, 113, -87, 11, 109, -91, 7, 105, -95, 3, 101, -99, -1, 97, -103, -5, 93, -107, -9, 89, -111, -13, 85, -115, -17, 81, -119, -21, 77, -123, -25, 73, -127, -29, 69, -131, -33, 65, -135, -37, 61, -139, -41, 57, -143, -45, 53, -147, -49],
[-49, 51, -147, -47, 53, -145, -45, 55, -143, -43, 57, -141, -41, 59, -139, -39, 61, -137, -37, 63, -135, -35, 65, -133, -33, 67, -131, -31, 69, -129, -29, 71, -127, -27, 73, -125, -25, 75, -123, -23, 77, -121, -21, 79, -119, -19, 81, -117, -17, 83, -115, -15, 85, -113, -13, 87, -111, -11, 89, -109, -9, 91, -107, -7, 93, -105, -5, 95, -103, -3, 97, -101, -1, 99],
[-47, 55, -141, -39, 63, -133, -31, 71, -125, -23, 79, -117, -15, 87, -109, -7, 95, -101, 1, 103, -93, 9, 111, -85, 17, 119, -77, 25, 127, -69, 33, 135, -61, 41, 143, -53, 49, -147, -45, 57, -139, -37, 65, -131, -29, 73, -123, -21, 81, -115, -13, 89, -107, -5, 97, -99, 3, 105, -91, 11, 113, -83, 19, 121, -75, 27, 129, -67, 35, 137, -59, 43, 145, -51],
[-45, 59, -135, -31, 73, -121, -17, 87, -107, -3, 101, -93, 11, 115, -79, 25, 129, -65, 39, 143, -51, 53, -141, -37, 67, -127, -23, 81, -113, -9, 95, -99, 5, 109, -85, 19, 123, -71, 33, 137, -57, 47, -147, -43, 61, -133, -29, 75, -119, -15, 89, -105, -1, 103, -91, 13, 117, -77, 27, 131, -63, 41, 145, -49, 55, -139, -35, 69, -125, -21, 83, -111, -7, 97],
[-43, 63, -129, -23, 83, -109, -3, 103, -89, 17, 123, -69, 37, 143, -49, 57, -135, -29, 77, -115, -9, 97, -95, 11, 117, -75, 31, 137, -55, 51, -141, -35, 71, -121, -15, 91, -101, 5, 111, -81, 25, 131, -61, 45, -147, -41, 65, -127, -21, 85, -107, -1, 105, -87, 19, 125, -67, 39, 145, -47, 59, -133, -27, 79, -113, -7, 99, -93, 13, 119, -73, 33, 139, -53],
[-41, 67, -123, -15, 93, -97, 11, 119, -71, 37, 145, -45, 63, -127, -19, 89, -101, 7, 115, -75, 33, 141, -49, 59, -131, -23, 85, -105, 3, 111, -79, 29, 137, -53, 55, -135, -27, 81, -109, -1, 107, -83, 25, 133, -57, 51, -139, -31, 77, -113, -5, 103, -87, 21, 129, -61, 47, -143, -35, 73, -117, -9, 99, -91, 17, 125, -65, 43, -147, -39, 69, -121, -13, 95],
[-39, 71, -117, -7, 103, -85, 25, 135, -53, 57, -131, -21, 89, -99, 11, 121, -67, 43, -145, -35, 75, -113, -3, 107, -81, 29, 139, -49, 61, -127, -17, 93, -95, 15, 125, -63, 47, -141, -31, 79, -109, 1, 111, -77, 33, 143, -45, 65, -123, -13, 97, -91, 19, 129, -59, 51, -137, -27, 83, -105, 5, 115, -73, 37, 147, -41, 69, -119, -9, 101, -87, 23, 133, -55],
[-37, 75, -111, 1, 113, -73, 39, -147, -35, 77, -109, 3, 115, -71, 41, -145, -33, 79, -107, 5, 117, -69, 43, -143, -31, 81, -105, 7, 119, -67, 45, -141, -29, 83, -103, 9, 121, -65, 47, -139, -27, 85, -101, 11, 123, -63, 49, -137, -25, 87, -99, 13, 125, -61, 51, -135, -23, 89, -97, 15, 127, -59, 53, -133, -21, 91, -95, 17, 129, -57, 55, -131, -19, 93],
[-35, 79, -105, 9, 123, -61, 53, -131, -17, 97, -87, 27, 141, -43, 71, -113, 1, 115, -69, 45, -139, -25, 89, -95, 19, 133, -51, 63, -121, -7, 107, -77, 37, -147, -33, 81, -103, 11, 125, -59, 55, -129, -15, 99, -85, 29, 143, -41, 73, -111, 3, 117, -67, 47, -137, -23, 91, -93, 21, 135, -49, 65, -119, -5, 109, -75, 39, -145, -31, 83, -101, 13, 127, -57],
[-33, 83, -99, 17, 133, -49, 67, -115, 1, 117, -65, 51, -131, -15, 101, -81, 35, -147, -31, 85, -97, 19, 135, -47, 69, -113, 3, 119, -63, 53, -129, -13, 103, -79, 37, -145, -29, 87, -95, 21, 137, -45, 71, -111, 5, 121, -61, 55, -127, -11, 105, -77, 39, -143, -27, 89, -93, 23, 139, -43, 73, -109, 7, 123, -59, 57, -125, -9, 107, -75, 41, -141, -25, 91],
[-31, 87, -93, 25, 143, -37, 81, -99, 19, 137, -43, 75, -105, 13, 131, -49, 69, -111, 7, 125, -55, 63, -117, 1, 119, -61, 57, -123, -5, 113, -67, 51, -129, -11, 107, -73, 45, -135, -17, 101, -79, 39, -141, -23, 95, -85, 33, -147, -29, 89, -91, 27, 145, -35, 83, -97, 21, 139, -41, 77, -103, 15, 133, -47, 71, -109, 9, 127, -53, 65, -115, 3, 121, -59],
[-29, 91, -87, 33, -145, -25, 95, -83, 37, -141, -21, 99, -79, 41, -137, -17, 103, -75, 45, -133, -13, 107, -71, 49, -129, -9, 111, -67, 53, -125, -5, 115, -63, 57, -121, -1, 119, -59, 61, -117, 3, 123, -55, 65, -113, 7, 127, -51, 69, -109, 11, 131, -47, 73, -105, 15, 135, -43, 77, -101, 19, 139, -39, 81, -97, 23, 143, -35, 85, -93, 27, 147, -31, 89],
[-27, 95, -81, 41, -135, -13, 109, -67, 55, -121, 1, 123, -53, 69, -107, 15, 137, -39, 83, -93, 29, -147, -25, 97, -79, 43, -133, -11, 111, -65, 57, -119, 3, 125, -51, 71, -105, 17, 139, -37, 85, -91, 31, -145, -23, 99, -77, 45, -131, -9, 113, -63, 59, -117, 5, 127, -49, 73, -103, 19, 141, -35, 87, -89, 33, -143, -21, 101, -75, 47, -129, -7, 115, -61],
[-25, 99, -75, 49, -125, -1, 123, -51, 73, -101, 23, 147, -27, 97, -77, 47, -127, -3, 121, -53, 71, -103, 21, 145, -29, 95, -79, 45, -129, -5, 119, -55, 69, -105, 19, 143, -31, 93, -81, 43, -131, -7, 117, -57, 67, -107, 17, 141, -33, 91, -83, 41, -133, -9, 115, -59, 65, -109, 15, 139, -35, 89, -85, 39, -135, -11, 113, -61, 63, -111, 13, 137, -37, 87],
[-23, 103, -69, 57, -115, 11, 137, -35, 91, -81, 45, -127, -1, 125, -47, 79, -93, 33, -139, -13, 113, -59, 67, -105, 21, 147, -25, 101, -71, 55, -117, 9, 135, -37, 89, -83, 43, -129, -3, 123, -49, 77, -95, 31, -141, -15, 111, -61, 65, -107, 19, 145, -27, 99, -73, 53, -119, 7, 133, -39, 87, -85, 41, -131, -5, 121, -51, 75, -97, 29, -143, -17, 109, -63],
[-21, 107, -63, 65, -105, 23, -147, -19, 109, -61, 67, -103, 25, -145, -17, 111, -59, 69, -101, 27, -143, -15, 113, -57, 71, -99, 29, -141, -13, 115, -55, 73, -97, 31, -139, -11, 117, -53, 75, -95, 33, -137, -9, 119, -51, 77, -93, 35, -135, -7, 121, -49, 79, -91, 37, -133, -5, 123, -47, 81, -89, 39, -131, -3, 125, -45, 83, -87, 41, -129, -1, 127, -43, 85],
[-19, 111, -57, 73, -95, 35, -133, -3, 127, -41, 89, -79, 51, -117, 13, 143, -25, 105, -63, 67, -101, 29, -139, -9, 121, -47, 83, -85, 45, -123, 7, 137, -31, 99, -69, 61, -107, 23, -145, -15, 115, -53, 77, -91, 39, -129, 1, 131, -37, 93, -75, 55, -113, 17, 147, -21, 109, -59, 71, -97, 33, -135, -5, 125, -43, 87, -81, 49, -119, 11, 141, -27, 103, -65],
[-17, 115, -51, 81, -85, 47, -119, 13, 145, -21, 111, -55, 77, -89, 43, -123, 9, 141, -25, 107, -59, 73, -93, 39, -127, 5, 137, -29, 103, -63, 69, -97, 35, -131, 1, 133, -33, 99, -67, 65, -101, 31, -135, -3, 129, -37, 95, -71, 61, -105, 27, -139, -7, 125, -41, 91, -75, 57, -109, 23, -143, -11, 121, -45, 87, -79, 53, -113, 19, -147, -15, 117, -49, 83],
[-15, 119, -45, 89, -75, 59, -105, 29, -135, -1, 133, -31, 103, -61, 73, -91, 43, -121, 13, 147, -17, 117, -47, 87, -77, 57, -107, 27, -137, -3, 131, -33, 101, -63, 71, -93, 41, -123, 11, 145, -19, 115, -49, 85, -79, 55, -109, 25, -139, -5, 129, -35, 99, -65, 69, -95, 39, -125, 9, 143, -21, 113, -51, 83, -81, 53, -111, 23, -141, -7, 127, -37, 97, -67],
[-13, 123, -39, 97, -65, 71, -91, 45, -117, 19, -143, -7, 129, -33, 103, -59, 77, -85, 51, -111, 25, -137, -1, 135, -27, 109, -53, 83, -79, 57, -105, 31, -131, 5, 141, -21, 115, -47, 89, -73, 63, -99, 37, -125, 11, 147, -15, 121, -41, 95, -67, 69, -93, 43, -119, 17, -145, -9, 127, -35, 101, -61, 75, -87, 49, -113, 23, -139, -3, 133, -29, 107, -55, 81],
[-11, 127, -33, 105, -55, 83, -77, 61, -99, 39, -121, 17, -143, -5, 133, -27, 111, -49, 89, -71, 67, -93, 45, -115, 23, -137, 1, 139, -21, 117, -43, 95, -65, 73, -87, 51, -109, 29, -131, 7, 145, -15, 123, -37, 101, -59, 79, -81, 57, -103, 35, -125, 13, -147, -9, 129, -31, 107, -53, 85, -75, 63, -97, 41, -119, 19, -141, -3, 135, -25, 113, -47, 91, -69],
[-9, 131, -27, 113, -45, 95, -63, 77, -81, 59, -99, 41, -117, 23, -135, 5, 145, -13, 127, -31, 109, -49, 91, -67, 73, -85, 55, -103, 37, -121, 19, -139, 1, 141, -17, 123, -35, 105, -53, 87, -71, 69, -89, 51, -107, 33, -125, 15, -143, -3, 137, -21, 119, -39, 101, -57, 83, -75, 65, -93, 47, -111, 29, -129, 11, -147, -7, 133, -25, 115, -43, 97, -61, 79],
[-7, 135, -21, 121, -35, 107, -49, 93, -63, 79, -77, 65, -91, 51, -105, 37, -119, 23, -133, 9, -147, -5, 137, -19, 123, -33, 109, -47, 95, -61, 81, -75, 67, -89, 53, -103, 39, -117, 25, -131, 11, -145, -3, 139, -17, 125, -31, 111, -45, 97, -59, 83, -73, 69, -87, 55, -101, 41, -115, 27, -129, 13, -143, -1, 141, -15, 127, -29, 113, -43, 99, -57, 85, -71],
[-5, 139, -15, 129, -25, 119, -35, 109, -45, 99, -55, 89, -65, 79, -75, 69, -85, 59, -95, 49, -105, 39, -115, 29, -125, 19, -135, 9, -145, -1, 143, -11, 133, -21, 123, -31, 113, -41, 103, -51, 93, -61, 83, -71, 73, -81, 63, -91, 53, -101, 43, -111, 33, -121, 23, -131, 13, -141, 3, 147, -7, 137, -17, 127, -27, 117, -37, 107, -47, 97, -57, 87, -67, 77],
[-3, 143, -9, 137, -15, 131, -21, 125, -27, 119, -33, 113, -39, 107, -45, 101, -51, 95, -57, 89, -63, 83, -69, 77, -75, 71, -81, 65, -87, 59, -93, 53, -99, 47, -105, 41, -111, 35, -117, 29, -123, 23, -129, 17, -135, 11, -141, 5, -147, -1, 145, -7, 139, -13, 133, -19, 127, -25, 121, -31, 115, -37, 109, -43, 103, -49, 97, -55, 91, -61, 85, -67, 79, -73],
[-1, 147, -3, 145, -5, 143, -7, 141, -9, 139, -11, 137, -13, 135, -15, 133, -17, 131, -19, 129, -21, 127, -23, 125, -25, 123, -27, 121, -29, 119, -31, 117, -33, 115, -35, 113, -37, 111, -39, 109, -41, 107, -43, 105, -45, 103, -47, 101, -49, 99, -51, 97, -53, 95, -55, 93, -57, 91, -59, 89, -61, 87, -63, 85, -65, 83, -67, 81, -69, 79, -71, 77, -73, 75]]
def B : List (List Int) := [
[2376843523938100598044, -13117470246692398254827, -1057628311303898048341, 3077412451003652640275, -6049679357732946976550, -3534840961773842141135, -564195623966042536999, -11802535291166136981865, -10232449433435490187267, 5239333046293632062167, -16130444239679120014241, -1436371079775116943446, -17942321950486495586771, -18745498553919350416771, -9560738410584400349467, 15010000424281248236 -- (+1489 chars; full line in the Zenodo source)
[-13117470246692398254827, 3077412451003652640275, -3534840961773842141135, -11802535291166136981865, 5239333046293632062167, -1436371079775116943446, -18745498553919350416771, 1501000042428124823647, -17186561605232500815952, -20974499646291035379319, 777623919545768468123, -14340228516803879092120, -11013222324578131688341, -5021051275345674740135, -15538917399776593976717, -306985269348807633 -- (+1454 chars; full line in the Zenodo source)
[-1057628311303898048341, -3534840961773842141135, -10232449433435490187267, -1436371079775116943446, -9560738410584400349467, -17186561605232500815952, -12194689550175373898453, -14340228516803879092120, -12329852399174127025808, -15538917399776593976717, -24106230087288729645524, -1869948943351330892186, -29985483782488168311869, -10076385058704836068528, -25420546353423882522808, -11335601323 -- (+1464 chars; full line in the Zenodo source)
[3077412451003652640275, -11802535291166136981865, -1436371079775116943446, 1501000042428124823647, -20974499646291035379319, -14340228516803879092120, -5021051275345674740135, -30698526934880763306212, -1869948943351330892186, -2915417480816192747176, -25083163011322335924424, -11335601323805990564773, -6571316436658649992639, -8312728060765045507442, 8203815397380812973613, 3250368224961570509 -- (+1465 chars; full line in the Zenodo source)
[-6049679357732946976550, 5239333046293632062167, -9560738410584400349467, -20974499646291035379319, -23035188584564583911633, -15538917399776593976717, -28401300900840208787950, -2915417480816192747176, -25420546353423882522808, -14892564042661440732467, -20299667982942636446201, 8203815397380812973613, -18557266162070853442958, 12274954253698244280713, 7930485311552346260117, 93853737802001295 -- (+1465 chars; full line in the Zenodo source)
[-3534840961773842141135, -1436371079775116943446, -17186561605232500815952, -14340228516803879092120, -15538917399776593976717, -1869948943351330892186, -10076385058704836068528, -11335601323805990564773, 1466481574189169978753, 8203815397380812973613, 15039340287312628964758, 14471050678816389269332, 12006582605528732611366, 18557266162070853442958, 25087831249337177569091, 3606081256709101863 -- (+1467 chars; full line in the Zenodo source)
[-564195623966042536999, -18745498553919350416771, -12194689550175373898453, -5021051275345674740135, -28401300900840208787950, -10076385058704836068528, -29441230338070624345781, -8312728060765045507442, -17614062782078432269049, 12274954253698244280713, -14471050678816389269332, 18557266162070853442958, 1610925683209609159391, 24244033075360221535789, 25083163011322335924424, 19883506319272419 -- (+1467 chars; full line in the Zenodo source)
[-11802535291166136981865, 1501000042428124823647, -14340228516803879092120, -30698526934880763306212, -2915417480816192747176, -11335601323805990564773, -8312728060765045507442, 3250368224961570509132, 14471050678816389269332, 9385373780200129539826, 17734190956899381004777, 36060812567091018631822, 25420546353423882522808, 19883506319272419274409, 25256542809538795680596, 121946895501753738984 -- (+1460 chars; full line in the Zenodo source)
[-10232449433435490187267, -17186561605232500815952, -12329852399174127025808, -1869948943351330892186, -25420546353423882522808, 1466481574189169978753, -17614062782078432269049, 14471050678816389269332, 1494534572118586093081, 25087831249337177569091, 14892564042661440732467, 24582517272557785057916, 30698526934880763306212, 33578338227290139002992, 18745498553919350416771, 6049679357732946976 -- (+1465 chars; full line in the Zenodo source)
[5239333046293632062167, -20974499646291035379319, -15538917399776593976717, -2915417480816192747176, -14892564042661440732467, 8203815397380812973613, 12274954253698244280713, 9385373780200129539826, 25087831249337177569091, 29441230338070624345781, 29985483782488168311869, 25256542809538795680596, 20291780509510138455404, 10232449433435490187267, 2376843523938100598044, -1613044423967912001424 -- (+1460 chars; full line in the Zenodo source)
[-16130444239679120014241, 777623919545768468123, -24106230087288729645524, -25083163011322335924424, -20299667982942636446201, 15039340287312628964758, -14471050678816389269332, 17734190956899381004777, 14892564042661440732467, 29985483782488168311869, 5021051275345674740135, 13527894696449213551403, 3534840961773842141135, -6049679357732946976550, 1501000042428124823647, -123298523991741270258 -- (+1460 chars; full line in the Zenodo source)
[-1436371079775116943446, -14340228516803879092120, -1869948943351330892186, -11335601323805990564773, 8203815397380812973613, 14471050678816389269332, 18557266162070853442958, 36060812567091018631822, 24582517272557785057916, 25256542809538795680596, 13527894696449213551403, 6049679357732946976550, -564195623966042536999, -20291780509510138455404, -19667242109473632298622, -31534038622281027186 -- (+1466 chars; full line in the Zenodo source)
[-17942321950486495586771, -11013222324578131688341, -29985483782488168311869, -6571316436658649992639, -18557266162070853442958, 12006582605528732611366, 1610925683209609159391, 25420546353423882522808, 30698526934880763306212, 20291780509510138455404, 3534840961773842141135, -564195623966042536999, -20974499646291035379319, -24106230087288729645524, 2472442079072382668218, -2508783124933717756 -- (+1464 chars; full line in the Zenodo source)
[-18745498553919350416771, -5021051275345674740135, -10076385058704836068528, -8312728060765045507442, 12274954253698244280713, 18557266162070853442958, 24244033075360221535789, 19883506319272419274409, 33578338227290139002992, 10232449433435490187267, -6049679357732946976550, -20291780509510138455404, -24106230087288729645524, -26194910092467338022583, -17734190956899381004777, 7930485311552346 -- (+1464 chars; full line in the Zenodo source)
[-9560738410584400349467, -15538917399776593976717, -25420546353423882522808, 8203815397380812973613, 7930485311552346260117, 25087831249337177569091, 25083163011322335924424, 25256542809538795680596, 18745498553919350416771, 2376843523938100598044, 1501000042428124823647, -19667242109473632298622, 2472442079072382668218, -17734190956899381004777, 12587934000228507930971, 1610925683209609159391, -- (+1462 chars; full line in the Zenodo source)
[1501000042428124823647, -30698526934880763306212, -11335601323805990564773, 3250368224961570509132, 9385373780200129539826, 36060812567091018631822, 19883506319272419274409, 12194689550175373898453, 6049679357732946976550, -16130444239679120014241, -12329852399174127025808, -31534038622281027186791, -25087831249337177569091, 7930485311552346260117, 1610925683209609159391, 1007638505870483606852 -- (+1459 chars; full line in the Zenodo source)
[-13527894696449213551403, -12474423140973248812934, -24244033075360221535789, -1494534572118586093081, -3250368224961570509132, 26194910092467338022583, 15538917399776593976717, 17942321950486495586771, 3077412451003652640275, -12194689550175373898453, -15199101972192441956636, -20299667982942636446201, 14471050678816389269332, -8203815397380812973613, 31534038622281027186791, 11013222324578131 -- (+1465 chars; full line in the Zenodo source)
[-17186561605232500815952, -1869948943351330892186, 1466481574189169978753, 14471050678816389269332, 25087831249337177569091, 24582517272557785057916, 33578338227290139002992, 6049679357732946976550, -17942321950486495586771, -19667242109473632298622, -29441230338070624345781, -18691499755300851660752, -3250368224961570509132, -2472442079072382668218, 5021051275345674740135, -5239333046293632062 -- (+1464 chars; full line in the Zenodo source)
[-20291780509510138455404, -15199101972192441956636, -17026698312020297398465, 12587934000228507930971, -1466481574189169978753, 28401300900840208787950, -1501000042428124823647, -1057628311303898048341, 777623919545768468123, -24582517272557785057916, 8203815397380812973613, -12274954253698244280713, 24244033075360221535789, 30698526934880763306212, 17942321950486495586771, -3534840961773842141 -- (+1467 chars; full line in the Zenodo source)
[-20974499646291035379319, -2915417480816192747176, 8203815397380812973613, 9385373780200129539826, 29441230338070624345781, 25256542809538795680596, 10232449433435490187267, -16130444239679120014241, -19667242109473632298622, -24244033075360221535789, -12006582605528732611366, 1610925683209609159391, 15199101972192441956636, 17186561605232500815952, -13117470246692398254827, 7776239195457684681 -- (+1463 chars; full line in the Zenodo source)
[-12194689550175373898453, -10076385058704836068528, -17614062782078432269049, 18557266162070853442958, 25083163011322335924424, 33578338227290139002992, 13117470246692398254827, -20291780509510138455404, -2915417480816192747176, -17734190956899381004777, 18691499755300851660752, -2472442079072382668218, 23035188584564583911633, -3077412451003652640275, -13527894696449213551403, -151991019721924 -- (+1466 chars; full line in the Zenodo source)
[777623919545768468123, -25083163011322335924424, 15039340287312628964758, 17734190956899381004777, 29985483782488168311869, 13527894696449213551403, -6049679357732946976550, -12329852399174127025808, -29441230338070624345781, -12006582605528732611366, 8312728060765045507442, 12474423140973248812934, 1436371079775116943446, 5239333046293632062167, -30698526934880763306212, 1466481574189169978753 -- (+1463 chars; full line in the Zenodo source)
[-33578338227290139002992, 2472442079072382668218, -9385373780200129539826, 17026698312020297398465, 12474423140973248812934, 16130444239679120014241, -1436371079775116943446, -28401300900840208787950, -1610925683209609159391, 1494534572118586093081, 25420546353423882522808, -777623919545768468123, 2376843523938100598044, -14340228516803879092120, -26194910092467338022583, 1227495425369824428071 -- (+1466 chars; full line in the Zenodo source)
[-14340228516803879092120, -11335601323805990564773, 14471050678816389269332, 36060812567091018631822, 25256542809538795680596, 6049679357732946976550, -20291780509510138455404, -31534038622281027186791, -18691499755300851660752, 1610925683209609159391, 12474423140973248812934, -5239333046293632062167, -18745498553919350416771, -15199101972192441956636, -13893456309393138231164, 1761406278207843 -- (+1463 chars; full line in the Zenodo source)
[-23035188584564583911633, -14892564042661440732467, 7930485311552346260117, 29441230338070624345781, 14340228516803879092120, 2376843523938100598044, -11013222324578131688341, -24244033075360221535789, 12587934000228507930971, 11335601323805990564773, 33578338227290139002992, -13117470246692398254827, -12329852399174127025808, -6571316436658649992639, -14471050678816389269332, 26194910092467338 -- (+1467 chars; full line in the Zenodo source)
[-11013222324578131688341, -6571316436658649992639, 12006582605528732611366, 25420546353423882522808, 20291780509510138455404, -564195623966042536999, -24106230087288729645524, -25087831249337177569091, -3250368224961570509132, 15199101972192441956636, 1436371079775116943446, -18745498553919350416771, -2915417480816192747176, 15039340287312628964758, 17026698312020297398465, 19667242109473632298 -- (+1465 chars; full line in the Zenodo source)
[-12329852399174127025808, 1466481574189169978753, 1494534572118586093081, 24582517272557785057916, 18745498553919350416771, -17942321950486495586771, -2915417480816192747176, -18691499755300851660752, 20299667982942636446201, 5021051275345674740135, -2376843523938100598044, -11013222324578131688341, -36060812567091018631822, 9385373780200129539826, 10076385058704836068528, 956073841058440034946 -- (+1464 chars; full line in the Zenodo source)
[-5021051275345674740135, -8312728060765045507442, 18557266162070853442958, 19883506319272419274409, 10232449433435490187267, -20291780509510138455404, -26194910092467338022583, 7930485311552346260117, -2472442079072382668218, 17186561605232500815952, 5239333046293632062167, -15199101972192441956636, 15039340287312628964758, 20299667982942636446201, 12329852399174127025808, 237684352393810059804 -- (+1463 chars; full line in the Zenodo source)
[-25256542809538795680596, -1610925683209609159391, 13893456309393138231164, 24106230087288729645524, -3077412451003652640275, -23035188584564583911633, 1466481574189169978753, -15039340287312628964758, 19883506319272419274409, 11802535291166136981865, -12194689550175373898453, -14892564042661440732467, -12274954253698244280713, 24582517272557785057916, 1436371079775116943446, -13527894696449213 -- (+1461 chars; full line in the Zenodo source)
[-15538917399776593976717, 8203815397380812973613, 25087831249337177569091, 25256542809538795680596, 2376843523938100598044, -19667242109473632298622, -17734190956899381004777, 1610925683209609159391, 5021051275345674740135, -13117470246692398254827, -30698526934880763306212, -13893456309393138231164, 17026698312020297398465, 12329852399174127025808, -1057628311303898048341, -2410623008728872964 -- (+1467 chars; full line in the Zenodo source)
[-19667242109473632298622, -13893456309393138231164, 8312728060765045507442, 23035188584564583911633, -3534840961773842141135, -19883506319272419274409, -1494534572118586093081, 14892564042661440732467, 20291780509510138455404, -1436371079775116943446, -31534038622281027186791, -7930485311552346260117, 25083163011322335924424, 17942321950486495586771, -17186561605232500815952, -29441230338070624 -- (+1461 chars; full line in the Zenodo source)
[-30698526934880763306212, 3250368224961570509132, 36060812567091018631822, 12194689550175373898453, -16130444239679120014241, -31534038622281027186791, 7930485311552346260117, 10076385058704836068528, -5239333046293632062167, 777623919545768468123, 1466481574189169978753, 17614062782078432269049, 19667242109473632298622, 2376843523938100598044, -24106230087288729645524, -18557266162070853442958 -- (+1462 chars; full line in the Zenodo source)
[-24106230087288729645524, 15039340287312628964758, 14892564042661440732467, 13527894696449213551403, 1501000042428124823647, -29441230338070624345781, 18691499755300851660752, 12474423140973248812934, -2376843523938100598044, -30698526934880763306212, -18557266162070853442958, 24244033075360221535789, 17186561605232500815952, -9560738410584400349467, -11335601323805990564773, 149453457211858609 -- (+1461 chars; full line in the Zenodo source)
[-12474423140973248812934, -1494534572118586093081, 26194910092467338022583, 17942321950486495586771, -12194689550175373898453, -20299667982942636446201, -8203815397380812973613, 11013222324578131688341, -11802535291166136981865, -10076385058704836068528, 12587934000228507930971, 29985483782488168311869, 6049679357732946976550, -25256542809538795680596, -17614062782078432269049, 6571316436658649 -- (+1466 chars; full line in the Zenodo source)
[-28401300900840208787950, 12274954253698244280713, 25083163011322335924424, 10232449433435490187267, -11013222324578131688341, -17734190956899381004777, 36060812567091018631822, 17186561605232500815952, -13527894696449213551403, -6571316436658649992639, 13893456309393138231164, 12329852399174127025808, -11802535291166136981865, -31534038622281027186791, 12006582605528732611366, 1869948943351330 -- (+1465 chars; full line in the Zenodo source)
[-1869948943351330892186, 14471050678816389269332, 24582517272557785057916, 6049679357732946976550, -19667242109473632298622, -18691499755300851660752, -2472442079072382668218, -5239333046293632062167, -11013222324578131688341, -13893456309393138231164, 24244033075360221535789, 9560738410584400349467, -12194689550175373898453, -17026698312020297398465, 8312728060765045507442, 2097449964629103537 -- (+1467 chars; full line in the Zenodo source)
[-19883506319272419274409, -7930485311552346260117, 15199101972192441956636, -2376843523938100598044, -1869948943351330892186, -12587934000228507930971, 29985483782488168311869, 13117470246692398254827, -28401300900840208787950, 14471050678816389269332, 2915417480816192747176, 1057628311303898048341, -12474423140973248812934, -12006582605528732611366, 24582517272557785057916, -307741245100365264 -- (+1465 chars; full line in the Zenodo source)
[-15199101972192441956636, 12587934000228507930971, 28401300900840208787950, -1057628311303898048341, -24582517272557785057916, -12274954253698244280713, 30698526934880763306212, -3534840961773842141135, -25083163011322335924424, 18691499755300851660752, 25256542809538795680596, -10232449433435490187267, -26194910092467338022583, -3250368224961570509132, 11013222324578131688341, -143637107977511 -- (+1466 chars; full line in the Zenodo source)
[-29985483782488168311869, 12006582605528732611366, 30698526934880763306212, -564195623966042536999, 2472442079072382668218, -3250368224961570509132, 23035188584564583911633, -18745498553919350416771, -36060812567091018631822, 17026698312020297398465, 17186561605232500815952, -12194689550175373898453, 8203815397380812973613, 14892564042661440732467, 16130444239679120014241, -50210512753456747401 -- (+1465 chars; full line in the Zenodo source)
[-2915417480816192747176, 9385373780200129539826, 25256542809538795680596, -16130444239679120014241, -24244033075360221535789, 1610925683209609159391, 17186561605232500815952, 777623919545768468123, -13893456309393138231164, 26194910092467338022583, 564195623966042536999, -24106230087288729645524, -12587934000228507930971, 1869948943351330892186, 3077412451003652640275, -25083163011322335924424, -- (+1464 chars; full line in the Zenodo source)
[-24582517272557785057916, 18691499755300851660752, 11013222324578131688341, -9560738410584400349467, -8312728060765045507442, 6571316436658649992639, 16130444239679120014241, -15538917399776593976717, -12006582605528732611366, 19883506319272419274409, 3077412451003652640275, -25420546353423882522808, 17614062782078432269049, -777623919545768468123, -20291780509510138455404, 82038153973808129736 -- (+1460 chars; full line in the Zenodo source)
[-10076385058704836068528, 18557266162070853442958, 33578338227290139002992, -20291780509510138455404, -17734190956899381004777, -2472442079072382668218, -3077412451003652640275, -15199101972192441956636, 9385373780200129539826, 12329852399174127025808, -9560738410584400349467, -17026698312020297398465, 14892564042661440732467, 11802535291166136981865, -12474423140973248812934, 12587934000228507 -- (+1465 chars; full line in the Zenodo source)
[-31534038622281027186791, 17614062782078432269049, 20974499646291035379319, -33578338227290139002992, 15039340287312628964758, 2915417480816192747176, -1057628311303898048341, 2472442079072382668218, -8203815397380812973613, 13527894696449213551403, -11013222324578131688341, -9385373780200129539826, 19883506319272419274409, -3534840961773842141135, -29441230338070624345781, 17026698312020297398 -- (+1462 chars; full line in the Zenodo source)
[-25083163011322335924424, 17734190956899381004777, 13527894696449213551403, -12329852399174127025808, -12006582605528732611366, 12474423140973248812934, 5239333046293632062167, 1466481574189169978753, 24244033075360221535789, 564195623966042536999, -19883506319272419274409, 1494534572118586093081, 14340228516803879092120, -20974499646291035379319, 3250368224961570509132, 24582517272557785057916 -- (+1462 chars; full line in the Zenodo source)
[-25420546353423882522808, 25087831249337177569091, 18745498553919350416771, -19667242109473632298622, 12587934000228507930971, 5021051275345674740135, -13527894696449213551403, -13893456309393138231164, 10076385058704836068528, -1057628311303898048341, -11335601323805990564773, 8312728060765045507442, 16130444239679120014241, -12474423140973248812934, -12274954253698244280713, 23035188584564583 -- (+1465 chars; full line in the Zenodo source)
[2472442079072382668218, 17026698312020297398465, 16130444239679120014241, -28401300900840208787950, 1494534572118586093081, -777623919545768468123, -14340228516803879092120, 12274954253698244280713, 24106230087288729645524, -17942321950486495586771, -25087831249337177569091, 25083163011322335924424, -13117470246692398254827, -11335601323805990564773, 20299667982942636446201, 1023244943343549018 -- (+1463 chars; full line in the Zenodo source)
[-26194910092467338022583, 20299667982942636446201, 11802535291166136981865, -29985483782488168311869, 17614062782078432269049, -1501000042428124823647, -19667242109473632298622, 12006582605528732611366, 14340228516803879092120, -33578338227290139002992, 12274954253698244280713, 30698526934880763306212, -9560738410584400349467, -13893456309393138231164, 2915417480816192747176, -56419562396604253 -- (+1463 chars; full line in the Zenodo source)
[-11335601323805990564773, 36060812567091018631822, 6049679357732946976550, -31534038622281027186791, 1610925683209609159391, -5239333046293632062167, -15199101972192441956636, 17614062782078432269049, 9560738410584400349467, -24106230087288729645524, 1494534572118586093081, 20974499646291035379319, -5021051275345674740135, 12587934000228507930971, 23035188584564583911633, -335783382272901390029 -- (+1462 chars; full line in the Zenodo source)
[-29441230338070624345781, 24244033075360221535789, 13117470246692398254827, -26194910092467338022583, 36060812567091018631822, -3077412451003652640275, -25420546353423882522808, 20299667982942636446201, 3534840961773842141135, -31534038622281027186791, 17026698312020297398465, 11802535291166136981865, -24582517272557785057916, 25087831249337177569091, -5239333046293632062167, -29985483782488168 -- (+1463 chars; full line in the Zenodo source)
[-14892564042661440732467, 29441230338070624345781, 2376843523938100598044, -24244033075360221535789, 11335601323805990564773, -13117470246692398254827, -6571316436658649992639, 26194910092467338022583, -1057628311303898048341, -36060812567091018631822, -2472442079072382668218, 3077412451003652640275, 1466481574189169978753, 25420546353423882522808, -6049679357732946976550, -20299667982942636446 -- (+1466 chars; full line in the Zenodo source)
[-24244033075360221535789, 26194910092467338022583, 3077412451003652640275, -20299667982942636446201, 31534038622281027186791, -11802535291166136981865, -25087831249337177569091, 29985483782488168311869, -1436371079775116943446, -17614062782078432269049, 28401300900840208787950, 1501000042428124823647, -18691499755300851660752, 19667242109473632298622, -20974499646291035379319, -1200658260552873 -- (+1464 chars; full line in the Zenodo source)
[-6571316436658649992639, 25420546353423882522808, -564195623966042536999, -25087831249337177569091, 15199101972192441956636, -18745498553919350416771, 15039340287312628964758, 19667242109473632298622, -12194689550175373898453, -12587934000228507930971, 14340228516803879092120, -5021051275345674740135, 9385373780200129539826, 13527894696449213551403, -28401300900840208787950, 1389345630939313823 -- (+1462 chars; full line in the Zenodo source)
[-36060812567091018631822, 31534038622281027186791, 5239333046293632062167, -17614062782078432269049, 24106230087288729645524, -20974499646291035379319, -12587934000228507930971, 33578338227290139002992, -15538917399776593976717, -15039340287312628964758, 17942321950486495586771, -2915417480816192747176, 8312728060765045507442, 1057628311303898048341, -14892564042661440732467, -24724420790723826 -- (+1463 chars; full line in the Zenodo source)
[1466481574189169978753, 24582517272557785057916, -17942321950486495586771, -18691499755300851660752, 5021051275345674740135, -11013222324578131688341, 9385373780200129539826, 9560738410584400349467, -29985483782488168311869, 8312728060765045507442, 13117470246692398254827, -6571316436658649992639, 31534038622281027186791, -16130444239679120014241, -18557266162070853442958, 155389173997765939767 -- (+1463 chars; full line in the Zenodo source)
[-20299667982942636446201, 29985483782488168311869, 1501000042428124823647, -12006582605528732611366, 33578338227290139002992, -30698526934880763306212, 13893456309393138231164, 564195623966042536999, -11335601323805990564773, -2472442079072382668218, -10232449433435490187267, 3250368224961570509132, 15538917399776593976717, -23035188584564583911633, 9385373780200129539826, 187454985539193504167 -- (+1462 chars; full line in the Zenodo source)
[-8312728060765045507442, 19883506319272419274409, -20291780509510138455404, 7930485311552346260117, 17186561605232500815952, -15199101972192441956636, 20299667982942636446201, 2376843523938100598044, -17026698312020297398465, 1869948943351330892186, -20974499646291035379319, 12587934000228507930971, 13527894696449213551403, -29985483782488168311869, -1466481574189169978753, -1311747024669239825 -- (+1464 chars; full line in the Zenodo source)
[-17026698312020297398465, 28401300900840208787950, 777623919545768468123, -12274954253698244280713, 17942321950486495586771, -25083163011322335924424, 11335601323805990564773, -10232449433435490187267, 15039340287312628964758, 11013222324578131688341, -19667242109473632298622, 17734190956899381004777, -3077412451003652640275, -36060812567091018631822, 29985483782488168311869, -17186561605232500 -- (+1462 chars; full line in the Zenodo source)
[-1610925683209609159391, 24106230087288729645524, -23035188584564583911633, -15039340287312628964758, 11802535291166136981865, -14892564042661440732467, 24582517272557785057916, -13527894696449213551403, 7930485311552346260117, -1501000042428124823647, -10076385058704836068528, 29441230338070624345781, -10232449433435490187267, -18691499755300851660752, 14340228516803879092120, -124744231409732 -- (+1466 chars; full line in the Zenodo source)
[-25087831249337177569091, 19667242109473632298622, -5021051275345674740135, 13893456309393138231164, 1057628311303898048341, -8312728060765045507442, 12474423140973248812934, -23035188584564583911633, 18557266162070853442958, 3534840961773842141135, -36060812567091018631822, 19883506319272419274409, 777623919545768468123, 1494534572118586093081, 10232449433435490187267, -14892564042661440732467 -- (+1456 chars; full line in the Zenodo source)
[8203815397380812973613, 25256542809538795680596, -19667242109473632298622, 1610925683209609159391, -13117470246692398254827, -13893456309393138231164, 12329852399174127025808, -24106230087288729645524, 8312728060765045507442, 3077412451003652640275, 3250368224961570509132, 23035188584564583911633, -28401300900840208787950, -1466481574189169978753, -3534840961773842141135, 1503934028731262896475 -- (+1458 chars; full line in the Zenodo source)
[-17734190956899381004777, 12329852399174127025808, -12474423140973248812934, -1466481574189169978753, -564195623966042536999, -1494534572118586093081, 20974499646291035379319, -24582517272557785057916, 26194910092467338022583, -18745498553919350416771, 7930485311552346260117, 17942321950486495586771, -11335601323805990564773, 2915417480816192747176, -12194689550175373898453, 1869149975530085166 -- (+1465 chars; full line in the Zenodo source)
[-13893456309393138231164, 23035188584564583911633, -19883506319272419274409, 14892564042661440732467, -1436371079775116943446, -7930485311552346260117, 17942321950486495586771, -29441230338070624345781, 15199101972192441956636, -14340228516803879092120, 17614062782078432269049, -2376843523938100598044, -17734190956899381004777, 11013222324578131688341, -1869948943351330892186, 24244033075360221 -- (+1464 chars; full line in the Zenodo source)
[-17614062782078432269049, 33578338227290139002992, -2915417480816192747176, -2472442079072382668218, -13527894696449213551403, 9385373780200129539826, 3534840961773842141135, -17026698312020297398465, 25256542809538795680596, -12474423140973248812934, 6571316436658649992639, -16130444239679120014241, -7930485311552346260117, 1436371079775116943446, -24244033075360221535789, 28401300900840208787 -- (+1465 chars; full line in the Zenodo source)
[3250368224961570509132, 12194689550175373898453, -31534038622281027186791, 10076385058704836068528, 777623919545768468123, 17614062782078432269049, 2376843523938100598044, -18557266162070853442958, 20974499646291035379319, -25083163011322335924424, 24582517272557785057916, -33578338227290139002992, 13893456309393138231164, -13117470246692398254827, 15039340287312628964758, 202917805095101384554 -- (+1463 chars; full line in the Zenodo source)
[-18557266162070853442958, 20291780509510138455404, 2472442079072382668218, 15199101972192441956636, -12329852399174127025808, 17026698312020297398465, -11802535291166136981865, -12587934000228507930971, 16130444239679120014241, 1466481574189169978753, 15538917399776593976717, -28401300900840208787950, 29441230338070624345781, 1501000042428124823647, 1494534572118586093081, 105762831130389804834 -- (+1462 chars; full line in the Zenodo source)
[15039340287312628964758, 13527894696449213551403, -29441230338070624345781, 12474423140973248812934, -30698526934880763306212, 24244033075360221535789, -9560738410584400349467, 1494534572118586093081, 13117470246692398254827, 3250368224961570509132, 20291780509510138455404, -26194910092467338022583, 1869948943351330892186, -15538917399776593976717, 36060812567091018631822, -17942321950486495586 -- (+1464 chars; full line in the Zenodo source)
[-18691499755300851660752, 9560738410584400349467, -6571316436658649992639, 15538917399776593976717, -19883506319272419274409, 25420546353423882522808, 777623919545768468123, -8203815397380812973613, -564195623966042536999, -7930485311552346260117, 11802535291166136981865, -25087831249337177569091, 33578338227290139002992, -25083163011322335924424, 15199101972192441956636, -252565428095387956805 -- (+1467 chars; full line in the Zenodo source)
[-1494534572118586093081, 17942321950486495586771, -20299667982942636446201, 11013222324578131688341, -10076385058704836068528, 29985483782488168311869, -25256542809538795680596, 6571316436658649992639, 1501000042428124823647, 18557266162070853442958, -1057628311303898048341, -12006582605528732611366, -5239333046293632062167, -1610925683209609159391, 33578338227290139002992, -2542054635342388252 -- (+1465 chars; full line in the Zenodo source)
[-9385373780200129539826, 16130444239679120014241, -1610925683209609159391, -777623919545768468123, -26194910092467338022583, 24106230087288729645524, -1869948943351330892186, 25083163011322335924424, -23035188584564583911633, 20299667982942636446201, -18745498553919350416771, -15039340287312628964758, -1057628311303898048341, 14471050678816389269332, 11802535291166136981865, -177341909568993810 -- (+1467 chars; full line in the Zenodo source)
[12274954253698244280713, 10232449433435490187267, -17734190956899381004777, 17186561605232500815952, -6571316436658649992639, 12329852399174127025808, -31534038622281027186791, 1869948943351330892186, -12474423140973248812934, 25420546353423882522808, -23035188584564583911633, -1466481574189169978753, 1501000042428124823647, 17614062782078432269049, -564195623966042536999, -14471050678816389269 -- (+1462 chars; full line in the Zenodo source)
[-12006582605528732611366, 564195623966042536999, 3250368224961570509132, 18745498553919350416771, -17026698312020297398465, 12194689550175373898453, -14892564042661440732467, 5021051275345674740135, -31534038622281027186791, 28401300900840208787950, -1869948943351330892186, 10076385058704836068528, -25256542809538795680596, 29441230338070624345781, 777623919545768468123, 8312728060765045507442, -- (+1460 chars; full line in the Zenodo source)
[14471050678816389269332, 6049679357732946976550, -18691499755300851660752, -5239333046293632062167, -13893456309393138231164, 9560738410584400349467, -17026698312020297398465, 20974499646291035379319, -6571316436658649992639, 23035188584564583911633, -26194910092467338022583, 15538917399776593976717, -10076385058704836068528, 28401300900840208787950, -19883506319272419274409, 291541748081619274 -- (+1462 chars; full line in the Zenodo source)
[-12587934000228507930971, 1057628311303898048341, 12274954253698244280713, 3534840961773842141135, -18691499755300851660752, 10232449433435490187267, 3250368224961570509132, 1436371079775116943446, -17734190956899381004777, 9560738410584400349467, -1610925683209609159391, 17186561605232500815952, -20299667982942636446201, 12194689550175373898453, -6571316436658649992639, 14340228516803879092120 -- (+1461 chars; full line in the Zenodo source)
[-7930485311552346260117, -2376843523938100598044, -12587934000228507930971, 13117470246692398254827, 14471050678816389269332, 1057628311303898048341, -12006582605528732611366, -3077412451003652640275, 12274954253698244280713, 6049679357732946976550, -9385373780200129539826, 3534840961773842141135, -1494534572118586093081, 564195623966042536999, -18691499755300851660752, 11802535291166136981865, -- (+1462 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 74).map (fun t => rowA (148 + 1) t (rng 1 74)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 74 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 74 B A = sid 68330194062259355532237966 74 := rfl
theorem d_ne : (68330194062259355532237966 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 74 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 74) (h0 : mv A g = zeros 74) : g = zeros 74 :=
kernel_zero 74 68330194062259355532237966 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 148 74 = true := rfl
/-- **Balanced ⇒ pairs for p = 149.** A list with entries in (0, 149) that is balanced for 1 ≤ t ≤ 74
has as many copies of x as of 149 − x for every 1 ≤ x ≤ 74 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 149)
(hb : ∀ t, 1 ≤ t → t < 1 + 74 → tsum 149 t c + tsum 149 t c = c.length * 149) :
(rng 1 74).all (fun x => Nat.beq (cnt x c) (cnt (149 - x) c)) = true :=
pairs_of_bal 148 74 68330194062259355532237966 d_ne A B len cert A_def delta c hr hb
end MailletCert149
#print axioms MailletCert149.A_def
#print axioms MailletCert149.len
#print axioms MailletCert149.cert
#print axioms MailletCert149.d_ne
#print axioms MailletCert149.kernel
#print axioms MailletCert149.delta
#print axioms MailletCert149.pairs
lean_all/hodge/MailletCert151.lean
/-
hodge/MailletCert151.lean — T41 (goals G849b, G849c): for p = 151 the 75 × 75 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 75)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 64066462670128932772786874 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 151) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert151
open MailletLin MailletBridge
def A : List (List Int) := [
[-149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1],
[-147, -143, -139, -135, -131, -127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149],
[-145, -139, -133, -127, -121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, 143, 149, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145, -149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147],
[-141, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, -143, -133, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, -145, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-139, -127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, 113, 125, 137, 149, -141, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, 135, 147, -143, -131, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145],
[-137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, 143, -145, -131, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, 135, 149, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, -147, -133, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-135, -119, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, 121, 137, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, -147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, 141, -145, -129, -113, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, 127, 143],
[-133, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, 137, -147, -129, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, 141, -143, -125, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, 127, 145, -139, -121, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, 113, 131, 149, -135, -117, -99, -81, -63, -45, -27, -9],
[-131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, 149, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, 147, -135, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, 145, -137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, 143, -139, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, 141],
[-129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, -145, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, 141, -139, -117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, 147, -133, -111, -89, -67, -45, -23, -1, 21, 43, 65, 87, 109, 131, -149, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, -143, -121, -99, -77, -55, -33, -11],
[-127, -103, -79, -55, -31, -7, 17, 41, 65, 89, 113, 137, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, -131, -107, -83, -59, -35, -11, 13, 37, 61, 85, 109, 133, -145, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119, 143, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, -149, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, 139],
[-125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, -141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, -131, -105, -79, -53, -27, -1, 25, 51, 77, 103, 129, -147, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, 139, -137, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, 149, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, -143, -117, -91, -65, -39, -13],
[-123, -95, -67, -39, -11, 17, 45, 73, 101, 129, -145, -117, -89, -61, -33, -5, 23, 51, 79, 107, 135, -139, -111, -83, -55, -27, 1, 29, 57, 85, 113, 141, -133, -105, -77, -49, -21, 7, 35, 63, 91, 119, 147, -127, -99, -71, -43, -15, 13, 41, 69, 97, 125, -149, -121, -93, -65, -37, -9, 19, 47, 75, 103, 131, -143, -115, -87, -59, -31, -3, 25, 53, 81, 109, 137],
[-121, -91, -61, -31, -1, 29, 59, 89, 119, 149, -123, -93, -63, -33, -3, 27, 57, 87, 117, 147, -125, -95, -65, -35, -5, 25, 55, 85, 115, 145, -127, -97, -67, -37, -7, 23, 53, 83, 113, 143, -129, -99, -69, -39, -9, 21, 51, 81, 111, 141, -131, -101, -71, -41, -11, 19, 49, 79, 109, 139, -133, -103, -73, -43, -13, 17, 47, 77, 107, 137, -135, -105, -75, -45, -15],
[-119, -87, -55, -23, 9, 41, 73, 105, 137, -133, -101, -69, -37, -5, 27, 59, 91, 123, -147, -115, -83, -51, -19, 13, 45, 77, 109, 141, -129, -97, -65, -33, -1, 31, 63, 95, 127, -143, -111, -79, -47, -15, 17, 49, 81, 113, 145, -125, -93, -61, -29, 3, 35, 67, 99, 131, -139, -107, -75, -43, -11, 21, 53, 85, 117, 149, -121, -89, -57, -25, 7, 39, 71, 103, 135],
[-117, -83, -49, -15, 19, 53, 87, 121, -147, -113, -79, -45, -11, 23, 57, 91, 125, -143, -109, -75, -41, -7, 27, 61, 95, 129, -139, -105, -71, -37, -3, 31, 65, 99, 133, -135, -101, -67, -33, 1, 35, 69, 103, 137, -131, -97, -63, -29, 5, 39, 73, 107, 141, -127, -93, -59, -25, 9, 43, 77, 111, 145, -123, -89, -55, -21, 13, 47, 81, 115, 149, -119, -85, -51, -17],
[-115, -79, -43, -7, 29, 65, 101, 137, -129, -93, -57, -21, 15, 51, 87, 123, -143, -107, -71, -35, 1, 37, 73, 109, 145, -121, -85, -49, -13, 23, 59, 95, 131, -135, -99, -63, -27, 9, 45, 81, 117, -149, -113, -77, -41, -5, 31, 67, 103, 139, -127, -91, -55, -19, 17, 53, 89, 125, -141, -105, -69, -33, 3, 39, 75, 111, 147, -119, -83, -47, -11, 25, 61, 97, 133],
[-113, -75, -37, 1, 39, 77, 115, -149, -111, -73, -35, 3, 41, 79, 117, -147, -109, -71, -33, 5, 43, 81, 119, -145, -107, -69, -31, 7, 45, 83, 121, -143, -105, -67, -29, 9, 47, 85, 123, -141, -103, -65, -27, 11, 49, 87, 125, -139, -101, -63, -25, 13, 51, 89, 127, -137, -99, -61, -23, 15, 53, 91, 129, -135, -97, -59, -21, 17, 55, 93, 131, -133, -95, -57, -19],
[-111, -71, -31, 9, 49, 89, 129, -133, -93, -53, -13, 27, 67, 107, 147, -115, -75, -35, 5, 45, 85, 125, -137, -97, -57, -17, 23, 63, 103, 143, -119, -79, -39, 1, 41, 81, 121, -141, -101, -61, -21, 19, 59, 99, 139, -123, -83, -43, -3, 37, 77, 117, -145, -105, -65, -25, 15, 55, 95, 135, -127, -87, -47, -7, 33, 73, 113, -149, -109, -69, -29, 11, 51, 91, 131],
[-109, -67, -25, 17, 59, 101, 143, -117, -75, -33, 9, 51, 93, 135, -125, -83, -41, 1, 43, 85, 127, -133, -91, -49, -7, 35, 77, 119, -141, -99, -57, -15, 27, 69, 111, -149, -107, -65, -23, 19, 61, 103, 145, -115, -73, -31, 11, 53, 95, 137, -123, -81, -39, 3, 45, 87, 129, -131, -89, -47, -5, 37, 79, 121, -139, -97, -55, -13, 29, 71, 113, -147, -105, -63, -21],
[-107, -63, -19, 25, 69, 113, -145, -101, -57, -13, 31, 75, 119, -139, -95, -51, -7, 37, 81, 125, -133, -89, -45, -1, 43, 87, 131, -127, -83, -39, 5, 49, 93, 137, -121, -77, -33, 11, 55, 99, 143, -115, -71, -27, 17, 61, 105, 149, -109, -65, -21, 23, 67, 111, -147, -103, -59, -15, 29, 73, 117, -141, -97, -53, -9, 35, 79, 123, -135, -91, -47, -3, 41, 85, 129],
[-105, -59, -13, 33, 79, 125, -131, -85, -39, 7, 53, 99, 145, -111, -65, -19, 27, 73, 119, -137, -91, -45, 1, 47, 93, 139, -117, -71, -25, 21, 67, 113, -143, -97, -51, -5, 41, 87, 133, -123, -77, -31, 15, 61, 107, -149, -103, -57, -11, 35, 81, 127, -129, -83, -37, 9, 55, 101, 147, -109, -63, -17, 29, 75, 121, -135, -89, -43, 3, 49, 95, 141, -115, -69, -23],
[-103, -55, -7, 41, 89, 137, -117, -69, -21, 27, 75, 123, -131, -83, -35, 13, 61, 109, -145, -97, -49, -1, 47, 95, 143, -111, -63, -15, 33, 81, 129, -125, -77, -29, 19, 67, 115, -139, -91, -43, 5, 53, 101, 149, -105, -57, -9, 39, 87, 135, -119, -71, -23, 25, 73, 121, -133, -85, -37, 11, 59, 107, -147, -99, -51, -3, 45, 93, 141, -113, -65, -17, 31, 79, 127],
[-101, -51, -1, 49, 99, 149, -103, -53, -3, 47, 97, 147, -105, -55, -5, 45, 95, 145, -107, -57, -7, 43, 93, 143, -109, -59, -9, 41, 91, 141, -111, -61, -11, 39, 89, 139, -113, -63, -13, 37, 87, 137, -115, -65, -15, 35, 85, 135, -117, -67, -17, 33, 83, 133, -119, -69, -19, 31, 81, 131, -121, -71, -21, 29, 79, 129, -123, -73, -23, 27, 77, 127, -125, -75, -25],
[-99, -47, 5, 57, 109, -141, -89, -37, 15, 67, 119, -131, -79, -27, 25, 77, 129, -121, -69, -17, 35, 87, 139, -111, -59, -7, 45, 97, 149, -101, -49, 3, 55, 107, -143, -91, -39, 13, 65, 117, -133, -81, -29, 23, 75, 127, -123, -71, -19, 33, 85, 137, -113, -61, -9, 43, 95, 147, -103, -51, 1, 53, 105, -145, -93, -41, 11, 63, 115, -135, -83, -31, 21, 73, 125],
[-97, -43, 11, 65, 119, -129, -75, -21, 33, 87, 141, -107, -53, 1, 55, 109, -139, -85, -31, 23, 77, 131, -117, -63, -9, 45, 99, -149, -95, -41, 13, 67, 121, -127, -73, -19, 35, 89, 143, -105, -51, 3, 57, 111, -137, -83, -29, 25, 79, 133, -115, -61, -7, 47, 101, -147, -93, -39, 15, 69, 123, -125, -71, -17, 37, 91, 145, -103, -49, 5, 59, 113, -135, -81, -27],
[-95, -39, 17, 73, 129, -117, -61, -5, 51, 107, -139, -83, -27, 29, 85, 141, -105, -49, 7, 63, 119, -127, -71, -15, 41, 97, -149, -93, -37, 19, 75, 131, -115, -59, -3, 53, 109, -137, -81, -25, 31, 87, 143, -103, -47, 9, 65, 121, -125, -69, -13, 43, 99, -147, -91, -35, 21, 77, 133, -113, -57, -1, 55, 111, -135, -79, -23, 33, 89, 145, -101, -45, 11, 67, 123],
[-93, -35, 23, 81, 139, -105, -47, 11, 69, 127, -117, -59, -1, 57, 115, -129, -71, -13, 45, 103, -141, -83, -25, 33, 91, 149, -95, -37, 21, 79, 137, -107, -49, 9, 67, 125, -119, -61, -3, 55, 113, -131, -73, -15, 43, 101, -143, -85, -27, 31, 89, 147, -97, -39, 19, 77, 135, -109, -51, 7, 65, 123, -121, -63, -5, 53, 111, -133, -75, -17, 41, 99, -145, -87, -29],
[-91, -31, 29, 89, 149, -93, -33, 27, 87, 147, -95, -35, 25, 85, 145, -97, -37, 23, 83, 143, -99, -39, 21, 81, 141, -101, -41, 19, 79, 139, -103, -43, 17, 77, 137, -105, -45, 15, 75, 135, -107, -47, 13, 73, 133, -109, -49, 11, 71, 131, -111, -51, 9, 69, 129, -113, -53, 7, 67, 127, -115, -55, 5, 65, 125, -117, -57, 3, 63, 123, -119, -59, 1, 61, 121],
[-89, -27, 35, 97, -143, -81, -19, 43, 105, -135, -73, -11, 51, 113, -127, -65, -3, 59, 121, -119, -57, 5, 67, 129, -111, -49, 13, 75, 137, -103, -41, 21, 83, 145, -95, -33, 29, 91, -149, -87, -25, 37, 99, -141, -79, -17, 45, 107, -133, -71, -9, 53, 115, -125, -63, -1, 61, 123, -117, -55, 7, 69, 131, -109, -47, 15, 77, 139, -101, -39, 23, 85, 147, -93, -31],
[-87, -23, 41, 105, -133, -69, -5, 59, 123, -115, -51, 13, 77, 141, -97, -33, 31, 95, -143, -79, -15, 49, 113, -125, -61, 3, 67, 131, -107, -43, 21, 85, 149, -89, -25, 39, 103, -135, -71, -7, 57, 121, -117, -53, 11, 75, 139, -99, -35, 29, 93, -145, -81, -17, 47, 111, -127, -63, 1, 65, 129, -109, -45, 19, 83, 147, -91, -27, 37, 101, -137, -73, -9, 55, 119],
[-85, -19, 47, 113, -123, -57, 9, 75, 141, -95, -29, 37, 103, -133, -67, -1, 65, 131, -105, -39, 27, 93, -143, -77, -11, 55, 121, -115, -49, 17, 83, 149, -87, -21, 45, 111, -125, -59, 7, 73, 139, -97, -31, 35, 101, -135, -69, -3, 63, 129, -107, -41, 25, 91, -145, -79, -13, 53, 119, -117, -51, 15, 81, 147, -89, -23, 43, 109, -127, -61, 5, 71, 137, -99, -33],
[-83, -15, 53, 121, -113, -45, 23, 91, -143, -75, -7, 61, 129, -105, -37, 31, 99, -135, -67, 1, 69, 137, -97, -29, 39, 107, -127, -59, 9, 77, 145, -89, -21, 47, 115, -119, -51, 17, 85, -149, -81, -13, 55, 123, -111, -43, 25, 93, -141, -73, -5, 63, 131, -103, -35, 33, 101, -133, -65, 3, 71, 139, -95, -27, 41, 109, -125, -57, 11, 79, 147, -87, -19, 49, 117],
[-81, -11, 59, 129, -103, -33, 37, 107, -125, -55, 15, 85, -147, -77, -7, 63, 133, -99, -29, 41, 111, -121, -51, 19, 89, -143, -73, -3, 67, 137, -95, -25, 45, 115, -117, -47, 23, 93, -139, -69, 1, 71, 141, -91, -21, 49, 119, -113, -43, 27, 97, -135, -65, 5, 75, 145, -87, -17, 53, 123, -109, -39, 31, 101, -131, -61, 9, 79, 149, -83, -13, 57, 127, -105, -35],
[-79, -7, 65, 137, -93, -21, 51, 123, -107, -35, 37, 109, -121, -49, 23, 95, -135, -63, 9, 81, -149, -77, -5, 67, 139, -91, -19, 53, 125, -105, -33, 39, 111, -119, -47, 25, 97, -133, -61, 11, 83, -147, -75, -3, 69, 141, -89, -17, 55, 127, -103, -31, 41, 113, -117, -45, 27, 99, -131, -59, 13, 85, -145, -73, -1, 71, 143, -87, -15, 57, 129, -101, -29, 43, 115],
[-77, -3, 71, 145, -83, -9, 65, 139, -89, -15, 59, 133, -95, -21, 53, 127, -101, -27, 47, 121, -107, -33, 41, 115, -113, -39, 35, 109, -119, -45, 29, 103, -125, -51, 23, 97, -131, -57, 17, 91, -137, -63, 11, 85, -143, -69, 5, 79, -149, -75, -1, 73, 147, -81, -7, 67, 141, -87, -13, 61, 135, -93, -19, 55, 129, -99, -25, 49, 123, -105, -31, 43, 117, -111, -37],
[-75, 1, 77, -149, -73, 3, 79, -147, -71, 5, 81, -145, -69, 7, 83, -143, -67, 9, 85, -141, -65, 11, 87, -139, -63, 13, 89, -137, -61, 15, 91, -135, -59, 17, 93, -133, -57, 19, 95, -131, -55, 21, 97, -129, -53, 23, 99, -127, -51, 25, 101, -125, -49, 27, 103, -123, -47, 29, 105, -121, -45, 31, 107, -119, -43, 33, 109, -117, -41, 35, 111, -115, -39, 37, 113],
[-73, 5, 83, -141, -63, 15, 93, -131, -53, 25, 103, -121, -43, 35, 113, -111, -33, 45, 123, -101, -23, 55, 133, -91, -13, 65, 143, -81, -3, 75, -149, -71, 7, 85, -139, -61, 17, 95, -129, -51, 27, 105, -119, -41, 37, 115, -109, -31, 47, 125, -99, -21, 57, 135, -89, -11, 67, 145, -79, -1, 77, -147, -69, 9, 87, -137, -59, 19, 97, -127, -49, 29, 107, -117, -39],
[-71, 9, 89, -133, -53, 27, 107, -115, -35, 45, 125, -97, -17, 63, 143, -79, 1, 81, -141, -61, 19, 99, -123, -43, 37, 117, -105, -25, 55, 135, -87, -7, 73, -149, -69, 11, 91, -131, -51, 29, 109, -113, -33, 47, 127, -95, -15, 65, 145, -77, 3, 83, -139, -59, 21, 101, -121, -41, 39, 119, -103, -23, 57, 137, -85, -5, 75, -147, -67, 13, 93, -129, -49, 31, 111],
[-69, 13, 95, -125, -43, 39, 121, -99, -17, 65, 147, -73, 9, 91, -129, -47, 35, 117, -103, -21, 61, 143, -77, 5, 87, -133, -51, 31, 113, -107, -25, 57, 139, -81, 1, 83, -137, -55, 27, 109, -111, -29, 53, 135, -85, -3, 79, -141, -59, 23, 105, -115, -33, 49, 131, -89, -7, 75, -145, -63, 19, 101, -119, -37, 45, 127, -93, -11, 71, -149, -67, 15, 97, -123, -41],
[-67, 17, 101, -117, -33, 51, 135, -83, 1, 85, -133, -49, 35, 119, -99, -15, 69, -149, -65, 19, 103, -115, -31, 53, 137, -81, 3, 87, -131, -47, 37, 121, -97, -13, 71, -147, -63, 21, 105, -113, -29, 55, 139, -79, 5, 89, -129, -45, 39, 123, -95, -11, 73, -145, -61, 23, 107, -111, -27, 57, 141, -77, 7, 91, -127, -43, 41, 125, -93, -9, 75, -143, -59, 25, 109],
[-65, 21, 107, -109, -23, 63, 149, -67, 19, 105, -111, -25, 61, 147, -69, 17, 103, -113, -27, 59, 145, -71, 15, 101, -115, -29, 57, 143, -73, 13, 99, -117, -31, 55, 141, -75, 11, 97, -119, -33, 53, 139, -77, 9, 95, -121, -35, 51, 137, -79, 7, 93, -123, -37, 49, 135, -81, 5, 91, -125, -39, 47, 133, -83, 3, 89, -127, -41, 45, 131, -85, 1, 87, -129, -43],
[-63, 25, 113, -101, -13, 75, -139, -51, 37, 125, -89, -1, 87, -127, -39, 49, 137, -77, 11, 99, -115, -27, 61, 149, -65, 23, 111, -103, -15, 73, -141, -53, 35, 123, -91, -3, 85, -129, -41, 47, 135, -79, 9, 97, -117, -29, 59, 147, -67, 21, 109, -105, -17, 71, -143, -55, 33, 121, -93, -5, 83, -131, -43, 45, 133, -81, 7, 95, -119, -31, 57, 145, -69, 19, 107],
[-61, 29, 119, -93, -3, 87, -125, -35, 55, 145, -67, 23, 113, -99, -9, 81, -131, -41, 49, 139, -73, 17, 107, -105, -15, 75, -137, -47, 43, 133, -79, 11, 101, -111, -21, 69, -143, -53, 37, 127, -85, 5, 95, -117, -27, 63, -149, -59, 31, 121, -91, -1, 89, -123, -33, 57, 147, -65, 25, 115, -97, -7, 83, -129, -39, 51, 141, -71, 19, 109, -103, -13, 77, -135, -45],
[-59, 33, 125, -85, 7, 99, -111, -19, 73, -137, -45, 47, 139, -71, 21, 113, -97, -5, 87, -123, -31, 61, -149, -57, 35, 127, -83, 9, 101, -109, -17, 75, -135, -43, 49, 141, -69, 23, 115, -95, -3, 89, -121, -29, 63, -147, -55, 37, 129, -81, 11, 103, -107, -15, 77, -133, -41, 51, 143, -67, 25, 117, -93, -1, 91, -119, -27, 65, -145, -53, 39, 131, -79, 13, 105],
[-57, 37, 131, -77, 17, 111, -97, -3, 91, -117, -23, 71, -137, -43, 51, 145, -63, 31, 125, -83, 11, 105, -103, -9, 85, -123, -29, 65, -143, -49, 45, 139, -69, 25, 119, -89, 5, 99, -109, -15, 79, -129, -35, 59, -149, -55, 39, 133, -75, 19, 113, -95, -1, 93, -115, -21, 73, -135, -41, 53, 147, -61, 33, 127, -81, 13, 107, -101, -7, 87, -121, -27, 67, -141, -47],
[-55, 41, 137, -69, 27, 123, -83, 13, 109, -97, -1, 95, -111, -15, 81, -125, -29, 67, -139, -43, 53, 149, -57, 39, 135, -71, 25, 121, -85, 11, 107, -99, -3, 93, -113, -17, 79, -127, -31, 65, -141, -45, 51, 147, -59, 37, 133, -73, 23, 119, -87, 9, 105, -101, -5, 91, -115, -19, 77, -129, -33, 63, -143, -47, 49, 145, -61, 35, 131, -75, 21, 117, -89, 7, 103],
[-53, 45, 143, -61, 37, 135, -69, 29, 127, -77, 21, 119, -85, 13, 111, -93, 5, 103, -101, -3, 95, -109, -11, 87, -117, -19, 79, -125, -27, 71, -133, -35, 63, -141, -43, 55, -149, -51, 47, 145, -59, 39, 137, -67, 31, 129, -75, 23, 121, -83, 15, 113, -91, 7, 105, -99, -1, 97, -107, -9, 89, -115, -17, 81, -123, -25, 73, -131, -33, 65, -139, -41, 57, -147, -49],
[-51, 49, 149, -53, 47, 147, -55, 45, 145, -57, 43, 143, -59, 41, 141, -61, 39, 139, -63, 37, 137, -65, 35, 135, -67, 33, 133, -69, 31, 131, -71, 29, 129, -73, 27, 127, -75, 25, 125, -77, 23, 123, -79, 21, 121, -81, 19, 119, -83, 17, 117, -85, 15, 115, -87, 13, 113, -89, 11, 111, -91, 9, 109, -93, 7, 107, -95, 5, 105, -97, 3, 103, -99, 1, 101],
[-49, 53, -147, -45, 57, -143, -41, 61, -139, -37, 65, -135, -33, 69, -131, -29, 73, -127, -25, 77, -123, -21, 81, -119, -17, 85, -115, -13, 89, -111, -9, 93, -107, -5, 97, -103, -1, 101, -99, 3, 105, -95, 7, 109, -91, 11, 113, -87, 15, 117, -83, 19, 121, -79, 23, 125, -75, 27, 129, -71, 31, 133, -67, 35, 137, -63, 39, 141, -59, 43, 145, -55, 47, 149, -51],
[-47, 57, -141, -37, 67, -131, -27, 77, -121, -17, 87, -111, -7, 97, -101, 3, 107, -91, 13, 117, -81, 23, 127, -71, 33, 137, -61, 43, 147, -51, 53, -145, -41, 63, -135, -31, 73, -125, -21, 83, -115, -11, 93, -105, -1, 103, -95, 9, 113, -85, 19, 123, -75, 29, 133, -65, 39, 143, -55, 49, -149, -45, 59, -139, -35, 69, -129, -25, 79, -119, -15, 89, -109, -5, 99],
[-45, 61, -135, -29, 77, -119, -13, 93, -103, 3, 109, -87, 19, 125, -71, 35, 141, -55, 51, -145, -39, 67, -129, -23, 83, -113, -7, 99, -97, 9, 115, -81, 25, 131, -65, 41, 147, -49, 57, -139, -33, 73, -123, -17, 89, -107, -1, 105, -91, 15, 121, -75, 31, 137, -59, 47, -149, -43, 63, -133, -27, 79, -117, -11, 95, -101, 5, 111, -85, 21, 127, -69, 37, 143, -53],
[-43, 65, -129, -21, 87, -107, 1, 109, -85, 23, 131, -63, 45, -149, -41, 67, -127, -19, 89, -105, 3, 111, -83, 25, 133, -61, 47, -147, -39, 69, -125, -17, 91, -103, 5, 113, -81, 27, 135, -59, 49, -145, -37, 71, -123, -15, 93, -101, 7, 115, -79, 29, 137, -57, 51, -143, -35, 73, -121, -13, 95, -99, 9, 117, -77, 31, 139, -55, 53, -141, -33, 75, -119, -11, 97],
[-41, 69, -123, -13, 97, -95, 15, 125, -67, 43, -149, -39, 71, -121, -11, 99, -93, 17, 127, -65, 45, -147, -37, 73, -119, -9, 101, -91, 19, 129, -63, 47, -145, -35, 75, -117, -7, 103, -89, 21, 131, -61, 49, -143, -33, 77, -115, -5, 105, -87, 23, 133, -59, 51, -141, -31, 79, -113, -3, 107, -85, 25, 135, -57, 53, -139, -29, 81, -111, -1, 109, -83, 27, 137, -55],
[-39, 73, -117, -5, 107, -83, 29, 141, -49, 63, -127, -15, 97, -93, 19, 131, -59, 53, -137, -25, 87, -103, 9, 121, -69, 43, -147, -35, 77, -113, -1, 111, -79, 33, 145, -45, 67, -123, -11, 101, -89, 23, 135, -55, 57, -133, -21, 91, -99, 13, 125, -65, 47, -143, -31, 81, -109, 3, 115, -75, 37, 149, -41, 71, -119, -7, 105, -85, 27, 139, -51, 61, -129, -17, 95],
[-37, 77, -111, 3, 117, -71, 43, -145, -31, 83, -105, 9, 123, -65, 49, -139, -25, 89, -99, 15, 129, -59, 55, -133, -19, 95, -93, 21, 135, -53, 61, -127, -13, 101, -87, 27, 141, -47, 67, -121, -7, 107, -81, 33, 147, -41, 73, -115, -1, 113, -75, 39, -149, -35, 79, -109, 5, 119, -69, 45, -143, -29, 85, -103, 11, 125, -63, 51, -137, -23, 91, -97, 17, 131, -57],
[-35, 81, -105, 11, 127, -59, 57, -129, -13, 103, -83, 33, 149, -37, 79, -107, 9, 125, -61, 55, -131, -15, 101, -85, 31, 147, -39, 77, -109, 7, 123, -63, 53, -133, -17, 99, -87, 29, 145, -41, 75, -111, 5, 121, -65, 51, -135, -19, 97, -89, 27, 143, -43, 73, -113, 3, 119, -67, 49, -137, -21, 95, -91, 25, 141, -45, 71, -115, 1, 117, -69, 47, -139, -23, 93],
[-33, 85, -99, 19, 137, -47, 71, -113, 5, 123, -61, 57, -127, -9, 109, -75, 43, -141, -23, 95, -89, 29, 147, -37, 81, -103, 15, 133, -51, 67, -117, 1, 119, -65, 53, -131, -13, 105, -79, 39, -145, -27, 91, -93, 25, 143, -41, 77, -107, 11, 129, -55, 63, -121, -3, 115, -69, 49, -135, -17, 101, -83, 35, -149, -31, 87, -97, 21, 139, -45, 73, -111, 7, 125, -59],
[-31, 89, -93, 27, 147, -35, 85, -97, 23, 143, -39, 81, -101, 19, 139, -43, 77, -105, 15, 135, -47, 73, -109, 11, 131, -51, 69, -113, 7, 127, -55, 65, -117, 3, 123, -59, 61, -121, -1, 119, -63, 57, -125, -5, 115, -67, 53, -129, -9, 111, -71, 49, -133, -13, 107, -75, 45, -137, -17, 103, -79, 41, -141, -21, 99, -83, 37, -145, -25, 95, -87, 33, -149, -29, 91],
[-29, 93, -87, 35, -145, -23, 99, -81, 41, -139, -17, 105, -75, 47, -133, -11, 111, -69, 53, -127, -5, 117, -63, 59, -121, 1, 123, -57, 65, -115, 7, 129, -51, 71, -109, 13, 135, -45, 77, -103, 19, 141, -39, 83, -97, 25, 147, -33, 89, -91, 31, -149, -27, 95, -85, 37, -143, -21, 101, -79, 43, -137, -15, 107, -73, 49, -131, -9, 113, -67, 55, -125, -3, 119, -61],
[-27, 97, -81, 43, -135, -11, 113, -65, 59, -119, 5, 129, -49, 75, -103, 21, 145, -33, 91, -87, 37, -141, -17, 107, -71, 53, -125, -1, 123, -55, 69, -109, 15, 139, -39, 85, -93, 31, -147, -23, 101, -77, 47, -131, -7, 117, -61, 63, -115, 9, 133, -45, 79, -99, 25, 149, -29, 95, -83, 41, -137, -13, 111, -67, 57, -121, 3, 127, -51, 73, -105, 19, 143, -35, 89],
[-25, 101, -75, 51, -125, 1, 127, -49, 77, -99, 27, -149, -23, 103, -73, 53, -123, 3, 129, -47, 79, -97, 29, -147, -21, 105, -71, 55, -121, 5, 131, -45, 81, -95, 31, -145, -19, 107, -69, 57, -119, 7, 133, -43, 83, -93, 33, -143, -17, 109, -67, 59, -117, 9, 135, -41, 85, -91, 35, -141, -15, 111, -65, 61, -115, 11, 137, -39, 87, -89, 37, -139, -13, 113, -63],
[-23, 105, -69, 59, -115, 13, 141, -33, 95, -79, 49, -125, 3, 131, -43, 85, -89, 39, -135, -7, 121, -53, 75, -99, 29, -145, -17, 111, -63, 65, -109, 19, 147, -27, 101, -73, 55, -119, 9, 137, -37, 91, -83, 45, -129, -1, 127, -47, 81, -93, 35, -139, -11, 117, -57, 71, -103, 25, -149, -21, 107, -67, 61, -113, 15, 143, -31, 97, -77, 51, -123, 5, 133, -41, 87],
[-21, 109, -63, 67, -105, 25, -147, -17, 113, -59, 71, -101, 29, -143, -13, 117, -55, 75, -97, 33, -139, -9, 121, -51, 79, -93, 37, -135, -5, 125, -47, 83, -89, 41, -131, -1, 129, -43, 87, -85, 45, -127, 3, 133, -39, 91, -81, 49, -123, 7, 137, -35, 95, -77, 53, -119, 11, 141, -31, 99, -73, 57, -115, 15, 145, -27, 103, -69, 61, -111, 19, 149, -23, 107, -65],
[-19, 113, -57, 75, -95, 37, -133, -1, 131, -39, 93, -77, 55, -115, 17, 149, -21, 111, -59, 73, -97, 35, -135, -3, 129, -41, 91, -79, 53, -117, 15, 147, -23, 109, -61, 71, -99, 33, -137, -5, 127, -43, 89, -81, 51, -119, 13, 145, -25, 107, -63, 69, -101, 31, -139, -7, 125, -45, 87, -83, 49, -121, 11, 143, -27, 105, -65, 67, -103, 29, -141, -9, 123, -47, 85],
[-17, 117, -51, 83, -85, 49, -119, 15, 149, -19, 115, -53, 81, -87, 47, -121, 13, 147, -21, 113, -55, 79, -89, 45, -123, 11, 145, -23, 111, -57, 77, -91, 43, -125, 9, 143, -25, 109, -59, 75, -93, 41, -127, 7, 141, -27, 107, -61, 73, -95, 39, -129, 5, 139, -29, 105, -63, 71, -97, 37, -131, 3, 137, -31, 103, -65, 69, -99, 35, -133, 1, 135, -33, 101, -67],
[-15, 121, -45, 91, -75, 61, -105, 31, -135, 1, 137, -29, 107, -59, 77, -89, 47, -119, 17, -149, -13, 123, -43, 93, -73, 63, -103, 33, -133, 3, 139, -27, 109, -57, 79, -87, 49, -117, 19, -147, -11, 125, -41, 95, -71, 65, -101, 35, -131, 5, 141, -25, 111, -55, 81, -85, 51, -115, 21, -145, -9, 127, -39, 97, -69, 67, -99, 37, -129, 7, 143, -23, 113, -53, 83],
[-13, 125, -39, 99, -65, 73, -91, 47, -117, 21, -143, -5, 133, -31, 107, -57, 81, -83, 55, -109, 29, -135, 3, 141, -23, 115, -49, 89, -75, 63, -101, 37, -127, 11, 149, -15, 123, -41, 97, -67, 71, -93, 45, -119, 19, -145, -7, 131, -33, 105, -59, 79, -85, 53, -111, 27, -137, 1, 139, -25, 113, -51, 87, -77, 61, -103, 35, -129, 9, 147, -17, 121, -43, 95, -69],
[-11, 129, -33, 107, -55, 85, -77, 63, -99, 41, -121, 19, -143, -3, 137, -25, 115, -47, 93, -69, 71, -91, 49, -113, 27, -135, 5, 145, -17, 123, -39, 101, -61, 79, -83, 57, -105, 35, -127, 13, -149, -9, 131, -31, 109, -53, 87, -75, 65, -97, 43, -119, 21, -141, -1, 139, -23, 117, -45, 95, -67, 73, -89, 51, -111, 29, -133, 7, 147, -15, 125, -37, 103, -59, 81],
[-9, 133, -27, 115, -45, 97, -63, 79, -81, 61, -99, 43, -117, 25, -135, 7, 149, -11, 131, -29, 113, -47, 95, -65, 77, -83, 59, -101, 41, -119, 23, -137, 5, 147, -13, 129, -31, 111, -49, 93, -67, 75, -85, 57, -103, 39, -121, 21, -139, 3, 145, -15, 127, -33, 109, -51, 91, -69, 73, -87, 55, -105, 37, -123, 19, -141, 1, 143, -17, 125, -35, 107, -53, 89, -71],
[-7, 137, -21, 123, -35, 109, -49, 95, -63, 81, -77, 67, -91, 53, -105, 39, -119, 25, -133, 11, -147, -3, 141, -17, 127, -31, 113, -45, 99, -59, 85, -73, 71, -87, 57, -101, 43, -115, 29, -129, 15, -143, 1, 145, -13, 131, -27, 117, -41, 103, -55, 89, -69, 75, -83, 61, -97, 47, -111, 33, -125, 19, -139, 5, 149, -9, 135, -23, 121, -37, 107, -51, 93, -65, 79],
[-5, 141, -15, 131, -25, 121, -35, 111, -45, 101, -55, 91, -65, 81, -75, 71, -85, 61, -95, 51, -105, 41, -115, 31, -125, 21, -135, 11, -145, 1, 147, -9, 137, -19, 127, -29, 117, -39, 107, -49, 97, -59, 87, -69, 77, -79, 67, -89, 57, -99, 47, -109, 37, -119, 27, -129, 17, -139, 7, -149, -3, 143, -13, 133, -23, 123, -33, 113, -43, 103, -53, 93, -63, 83, -73],
[-3, 145, -9, 139, -15, 133, -21, 127, -27, 121, -33, 115, -39, 109, -45, 103, -51, 97, -57, 91, -63, 85, -69, 79, -75, 73, -81, 67, -87, 61, -93, 55, -99, 49, -105, 43, -111, 37, -117, 31, -123, 25, -129, 19, -135, 13, -141, 7, -147, 1, 149, -5, 143, -11, 137, -17, 131, -23, 125, -29, 119, -35, 113, -41, 107, -47, 101, -53, 95, -59, 89, -65, 83, -71, 77],
[-1, 149, -3, 147, -5, 145, -7, 143, -9, 141, -11, 139, -13, 137, -15, 135, -17, 133, -19, 131, -21, 129, -23, 127, -25, 125, -27, 123, -29, 121, -31, 119, -33, 117, -35, 115, -37, 113, -39, 111, -41, 109, -43, 107, -45, 105, -47, 103, -49, 101, -51, 99, -53, 97, -55, 95, -57, 93, -59, 91, -61, 89, -63, 87, -65, 85, -67, 83, -69, 81, -71, 79, -73, 77, -75]]
def B : List (List Int) := [
[-7054678516933879016583, 4875275199988213986582, 1787842233798098457888, -3975299599742403196648, -3805143806432228346379, -5310346466438344906254, -10248958182884182726595, -529299141555595165383, -6406215991301052954838, -10857331262363163137853, -11952526263170542259755, -9250322720447291292181, -13494375564014803122883, 3453941501042674492220, -13788396284599753524128, -19517868671715680347 -- (+1508 chars; full line in the Zenodo source)
[4875275199988213986582, -3975299599742403196648, -5310346466438344906254, -529299141555595165383, -10857331262363163137853, -9250322720447291292181, 3453941501042674492220, -19517868671715680347080, -11081642765470334834146, 3820616892839146231175, -21126083954345262413065, -2567871963741335197346, -13633670199349111227331, -15418325677098525075700, -13148941774542354986549, -117688501795485548 -- (+1474 chars; full line in the Zenodo source)
[1787842233798098457888, -5310346466438344906254, -6406215991301052954838, -9250322720447291292181, -13788396284599753524128, -11081642765470334834146, -17754349892012768300076, -2567871963741335197346, -17917060576790011811630, -13148941774542354986549, -9810889025999671380310, -11768901510672090541511, -20473912172556674746900, -10436479032817063299422, -18582473798447518067422, -4886299945635 -- (+1487 chars; full line in the Zenodo source)
[-3975299599742403196648, -529299141555595165383, -9250322720447291292181, -19517868671715680347080, 3820616892839146231175, -2567871963741335197346, -15418325677098525075700, -11768850179548554847523, -11768901510672090541511, -23673200613310289745689, 7318188990474182247274, -4886299945635763856496, -11834441417054338651248, -6544973504482016372399, -1497043819437830265365, 9841262314858505697 -- (+1486 chars; full line in the Zenodo source)
[-3805143806432228346379, -10857331262363163137853, -13788396284599753524128, 3820616892839146231175, -19689857802812401696190, -13148941774542354986549, -23307932193772832480638, -23673200613310289745689, -18582473798447518067422, -2917407718475701287297, -24362265968592959741809, -1497043819437830265365, -20293352280485549873063, 819973644512659450582, 262214525957621198730, 247880309487879490 -- (+1486 chars; full line in the Zenodo source)
[-5310346466438344906254, -9250322720447291292181, -11081642765470334834146, -2567871963741335197346, -13148941774542354986549, -11768901510672090541511, -10436479032817063299422, -4886299945635763856496, -2316161497319556749052, -1497043819437830265365, 4367602843109386510552, 8058718768010441094061, 15199027755863540886333, 21605492575661842863856, 25046305300911426256257, 24362265968592959741 -- (+1485 chars; full line in the Zenodo source)
[-10248958182884182726595, 3453941501042674492220, -17754349892012768300076, -15418325677098525075700, -23307932193772832480638, -10436479032817063299422, -25255080550413488080697, -6544973504482016372399, -3208288801377989006826, 819973644512659450582, -15043347413701330800833, 21605492575661842863856, 1497043819437830265365, 19456987005431825874564, 23452589412467807781267, 2047391217255667474 -- (+1481 chars; full line in the Zenodo source)
[-529299141555595165383, -19517868671715680347080, -2567871963741335197346, -11768850179548554847523, -23673200613310289745689, -4886299945635763856496, -6544973504482016372399, 984126231485850569719, 8058718768010441094061, 24788030948787949091264, 3208288801377989006826, 24362265968592959741809, 30044457238061491707033, 20473912172556674746900, 25871693920078539307200, 10433829526459778624956, -- (+1482 chars; full line in the Zenodo source)
[-6406215991301052954838, -11081642765470334834146, -17917060576790011811630, -11768901510672090541511, -18582473798447518067422, -2316161497319556749052, -3208288801377989006826, 8058718768010441094061, -819973644512659450582, 25046305300911426256257, 11834441417054338651248, 33028818925185915452046, 13764392025962000786943, 19689857802812401696190, 19517868671715680347080, 10248958182884182726 -- (+1486 chars; full line in the Zenodo source)
[-10857331262363163137853, 3820616892839146231175, -13148941774542354986549, -23673200613310289745689, -2917407718475701287297, -1497043819437830265365, 819973644512659450582, 24788030948787949091264, 25046305300911426256257, 20097408671866677013780, 24184571634456925191438, 25871693920078539307200, 17754349892012768300076, 11952526263170542259755, 7054678516933879016583, -6406215991301052954838 -- (+1486 chars; full line in the Zenodo source)
[-11952526263170542259755, -21126083954345262413065, -9810889025999671380310, 7318188990474182247274, -24362265968592959741809, 4367602843109386510552, -15043347413701330800833, 3208288801377989006826, 11834441417054338651248, 24184571634456925191438, 13148941774542354986549, 16860861818214974402394, 529299141555595165383, 1787842233798098457888, 3453941501042674492220, -19689857802812401696190, -- (+1480 chars; full line in the Zenodo source)
[-9250322720447291292181, -2567871963741335197346, -11768901510672090541511, -4886299945635763856496, -1497043819437830265365, 8058718768010441094061, 21605492575661842863856, 24362265968592959741809, 33028818925185915452046, 25871693920078539307200, 16860861818214974402394, 10248958182884182726595, -3805143806432228346379, -10373020500988956288519, -21469069912352122783799, -2418457163445692519 -- (+1483 chars; full line in the Zenodo source)
[-13494375564014803122883, -13633670199349111227331, -20473912172556674746900, -11834441417054338651248, -20293352280485549873063, 15199027755863540886333, 1497043819437830265365, 30044457238061491707033, 13764392025962000786943, 17754349892012768300076, 529299141555595165383, -3805143806432228346379, -11081642765470334834146, -25871693920078539307200, 7318188990474182247274, -219250890615693728 -- (+1481 chars; full line in the Zenodo source)
[3453941501042674492220, -15418325677098525075700, -10436479032817063299422, -6544973504482016372399, 819973644512659450582, 21605492575661842863856, 19456987005431825874564, 20473912172556674746900, 19689857802812401696190, 11952526263170542259755, 1787842233798098457888, -10373020500988956288519, -25871693920078539307200, -18582473798447518067422, -12031683557576396063979, -1519902775586354088 -- (+1483 chars; full line in the Zenodo source)
[-13788396284599753524128, -13148941774542354986549, -18582473798447518067422, -1497043819437830265365, 262214525957621198730, 25046305300911426256257, 23452589412467807781267, 25871693920078539307200, 19517868671715680347080, 7054678516933879016583, 3453941501042674492220, -21469069912352122783799, 7318188990474182247274, -12031683557576396063979, 15043347413701330800833, -618624167826167092924 -- (+1485 chars; full line in the Zenodo source)
[-19517868671715680347080, -11768850179548554847523, -4886299945635763856496, 984126231485850569719, 24788030948787949091264, 24362265968592959741809, 20473912172556674746900, 10433829526459778624956, 10248958182884182726595, -6406215991301052954838, -19689857802812401696190, -24184571634456925191438, -21925089061569372821696, -15199027755863540886333, -6186241678261670929247, 234525894124678077 -- (+1482 chars; full line in the Zenodo source)
[-10373020500988956288519, -13764392025962000786943, -20097408671866677013780, -2779908116274098170444, -4367602843109386510552, 25255080550413488080697, 11768850179548554847523, 13788396284599753524128, 4875275199988213986582, -16860861818214974402394, -11768901510672090541511, -19456987005431825874564, 819973644512659450582, -984126231485850569719, 30044457238061491707033, 13148941774542354986 -- (+1484 chars; full line in the Zenodo source)
[-11081642765470334834146, -11768901510672090541511, -2316161497319556749052, 8058718768010441094061, 25046305300911426256257, 33028818925185915452046, 19689857802812401696190, 10248958182884182726595, -11952526263170542259755, -21469069912352122783799, -30044457238061491707033, -20293352280485549873063, 2779908116274098170444, 2917407718475701287297, 11768850179548554847523, -345394150104267449 -- (+1484 chars; full line in the Zenodo source)
[-16860861818214974402394, -2523502816622141616954, -21925089061569372821696, -262214525957621198730, 6544973504482016372399, 34260877871810783356253, 11081642765470334834146, -7054678516933879016583, 3820616892839146231175, -20473912172556674746900, -10487482224513499146486, -15043347413701330800833, 24362265968592959741809, 11768901510672090541511, 10373020500988956288519, 48752751999882139865 -- (+1482 chars; full line in the Zenodo source)
[3820616892839146231175, -23673200613310289745689, -1497043819437830265365, 24788030948787949091264, 20097408671866677013780, 25871693920078539307200, 11952526263170542259755, -6406215991301052954838, -21469069912352122783799, -25255080550413488080697, -4388887465808690290690, -6186241678261670929247, 10436479032817063299422, 21126083954345262413065, -4875275199988213986582, -1108164276547033483 -- (+1484 chars; full line in the Zenodo source)
[-17754349892012768300076, -10436479032817063299422, -3208288801377989006826, 21605492575661842863856, 23452589412467807781267, 19689857802812401696190, 3975299599742403196648, -10373020500988956288519, -2523502816622141616954, -12031683557576396063979, 24788030948787949091264, 2917407718475701287297, 21469069912352122783799, 529299141555595165383, -13494375564014803122883, -13764392025962000786 -- (+1486 chars; full line in the Zenodo source)
[-21126083954345262413065, 7318188990474182247274, 4367602843109386510552, 3208288801377989006826, 24184571634456925191438, 16860861818214974402394, 1787842233798098457888, -19689857802812401696190, -30044457238061491707033, -4388887465808690290690, 1497043819437830265365, 2523502816622141616954, 19517868671715680347080, -5310346466438344906254, -15418325677098525075700, -2917407718475701287297, -- (+1480 chars; full line in the Zenodo source)
[-10433829526459778624956, -23452589412467807781267, -4388887465808690290690, 12031683557576396063979, 11768901510672090541511, 13494375564014803122883, -10857331262363163137853, -9810889025999671380310, -6544973504482016372399, -8058718768010441094061, 25255080550413488080697, 13633670199349111227331, -1787842233798098457888, 3820616892839146231175, -33028818925185915452046, 4367602843109386510 -- (+1483 chars; full line in the Zenodo source)
[-2567871963741335197346, -4886299945635763856496, 8058718768010441094061, 24362265968592959741809, 25871693920078539307200, 10248958182884182726595, -10373020500988956288519, -24184571634456925191438, -20293352280485549873063, -6186241678261670929247, 2523502816622141616954, -3453941501042674492220, -10857331262363163137853, -13764392025962000786943, -10487482224513499146486, 438888746580869029 -- (+1479 chars; full line in the Zenodo source)
[-19689857802812401696190, -2917407718475701287297, 262214525957621198730, 20097408671866677013780, 13633670199349111227331, 7054678516933879016583, -2567871963741335197346, -25255080550413488080697, 15043347413701330800833, 11834441417054338651248, 17917060576790011811630, -4875275199988213986582, -10433829526459778624956, -4886299945635763856496, -15199027755863540886333, 194569870054318258745 -- (+1478 chars; full line in the Zenodo source)
[-13633670199349111227331, -11834441417054338651248, 15199027755863540886333, 30044457238061491707033, 17754349892012768300076, -3805143806432228346379, -25871693920078539307200, -21925089061569372821696, 2779908116274098170444, 10436479032817063299422, 19517868671715680347080, -10857331262363163137853, -11768901510672090541511, 6186241678261670929247, 3208288801377989006826, 3426087787181078335 -- (+1481 chars; full line in the Zenodo source)
[-17917060576790011811630, -2316161497319556749052, -819973644512659450582, 33028818925185915452046, 19517868671715680347080, -11952526263170542259755, -2523502816622141616954, -20293352280485549873063, 12031683557576396063979, 11768850179548554847523, 3805143806432228346379, -21126083954345262413065, -25255080550413488080697, -262214525957621198730, 4886299945635763856496, 177543498920127683000 -- (+1485 chars; full line in the Zenodo source)
[-15418325677098525075700, -6544973504482016372399, 21605492575661842863856, 20473912172556674746900, 11952526263170542259755, -10373020500988956288519, -18582473798447518067422, -15199027755863540886333, 2917407718475701287297, 21126083954345262413065, -5310346466438344906254, -13764392025962000786943, 6186241678261670929247, 25046305300911426256257, 9810889025999671380310, 38051438064322283463 -- (+1485 chars; full line in the Zenodo source)
[-21469069912352122783799, -10487482224513499146486, -984126231485850569719, 23307932193772832480638, 5310346466438344906254, -10433829526459778624956, -11834441417054338651248, -819973644512659450582, 24184571634456925191438, 9250322720447291292181, -10373020500988956288519, -23452589412467807781267, 262214525957621198730, 30044457238061491707033, 11081642765470334834146, -119525262631705422597 -- (+1486 chars; full line in the Zenodo source)
[-13148941774542354986549, -1497043819437830265365, 25046305300911426256257, 25871693920078539307200, 7054678516933879016583, -21469069912352122783799, -12031683557576396063979, -6186241678261670929247, 11768850179548554847523, -4875275199988213986582, -15418325677098525075700, -10487482224513499146486, 3208288801377989006826, 9810889025999671380310, -1787842233798098457888, -1791706057679001181 -- (+1485 chars; full line in the Zenodo source)
[-25871693920078539307200, 6186241678261670929247, 10487482224513499146486, 17917060576790011811630, -3975299599742403196648, -23307932193772832480638, 4367602843109386510552, 2316161497319556749052, 10433829526459778624956, -529299141555595165383, -20473912172556674746900, 819973644512659450582, 2917407718475701287297, 16860861818214974402394, -9250322720447291292181, -33028818925185915452046, -- (+1482 chars; full line in the Zenodo source)
[-11768850179548554847523, 984126231485850569719, 24362265968592959741809, 10433829526459778624956, -6406215991301052954838, -24184571634456925191438, -15199027755863540886333, 23452589412467807781267, -3453941501042674492220, -11081642765470334834146, -2917407718475701287297, 4388887465808690290690, 34260877871810783356253, 3805143806432228346379, -17917060576790011811630, -12031683557576396063 -- (+1484 chars; full line in the Zenodo source)
[-9810889025999671380310, 4367602843109386510552, 11834441417054338651248, 16860861818214974402394, 3453941501042674492220, -30044457238061491707033, 24788030948787949091264, 2523502816622141616954, 3805143806432228346379, -15418325677098525075700, -25046305300911426256257, 21925089061569372821696, 2567871963741335197346, -6406215991301052954838, -10436479032817063299422, 262214525957621198730, -- (+1481 chars; full line in the Zenodo source)
[-13764392025962000786943, -2779908116274098170444, 25255080550413488080697, 13788396284599753524128, -16860861818214974402394, -19456987005431825874564, -984126231485850569719, 13148941774542354986549, -3975299599742403196648, -2523502816622141616954, 8058718768010441094061, 18582473798447518067422, 11952526263170542259755, -10433829526459778624956, -21925089061569372821696, 1497043819437830265 -- (+1486 chars; full line in the Zenodo source)
[-23307932193772832480638, 819973644512659450582, 23452589412467807781267, 11952526263170542259755, -2567871963741335197346, -12031683557576396063979, 21925089061569372821696, 21126083954345262413065, -13494375564014803122883, -4886299945635763856496, 2779908116274098170444, 9810889025999671380310, 4875275199988213986582, -34260877871810783356253, 8058718768010441094061, -7318188990474182247274, -- (+1487 chars; full line in the Zenodo source)
[-11768901510672090541511, 8058718768010441094061, 33028818925185915452046, 10248958182884182726595, -21469069912352122783799, -20293352280485549873063, 2917407718475701287297, -3453941501042674492220, -21126083954345262413065, -10487482224513499146486, 21925089061569372821696, 17754349892012768300076, -13788396284599753524128, -20097408671866677013780, -984126231485850569719, 154183256770985250 -- (+1482 chars; full line in the Zenodo source)
[-34260877871810783356253, 15043347413701330800833, 23673200613310289745689, -1787842233798098457888, -13764392025962000786943, -24788030948787949091264, 33028818925185915452046, 5310346466438344906254, -25871693920078539307200, -2779908116274098170444, 23452589412467807781267, 6406215991301052954838, -15418325677098525075700, -20293352280485549873063, 25255080550413488080697, 925032272044729129 -- (+1482 chars; full line in the Zenodo source)
[-2523502816622141616954, -262214525957621198730, 34260877871810783356253, -7054678516933879016583, -20473912172556674746900, -15043347413701330800833, 11768901510672090541511, 4875275199988213986582, -23673200613310289745689, 15199027755863540886333, 23307932193772832480638, 1787842233798098457888, -24184571634456925191438, -8058718768010441094061, 13764392025962000786943, -39752995997424031966 -- (+1486 chars; full line in the Zenodo source)
[-20473912172556674746900, 15199027755863540886333, 13764392025962000786943, -3805143806432228346379, 7318188990474182247274, 2779908116274098170444, 21469069912352122783799, -10857331262363163137853, -25255080550413488080697, 3208288801377989006826, 2567871963741335197346, -13788396284599753524128, -2316161497319556749052, 10487482224513499146486, 16860861818214974402394, 3820616892839146231175 -- (+1482 chars; full line in the Zenodo source)
[-23673200613310289745689, 24788030948787949091264, 25871693920078539307200, -6406215991301052954838, -25255080550413488080697, -6186241678261670929247, 21126083954345262413065, -11081642765470334834146, -10487482224513499146486, 19456987005431825874564, 13494375564014803122883, -17917060576790011811630, -21605492575661842863856, -7318188990474182247274, 3975299599742403196648, -1176890151067209 -- (+1486 chars; full line in the Zenodo source)
[-24184571634456925191438, 4388887465808690290690, 15418325677098525075700, -13494375564014803122883, -2316161497319556749052, 6544973504482016372399, 13788396284599753524128, -13633670199349111227331, -21605492575661842863856, 33028818925185915452046, -4875275199988213986582, -20473912172556674746900, 24788030948787949091264, 13148941774542354986549, -11952526263170542259755, -11834441417054338 -- (+1481 chars; full line in the Zenodo source)
[-10436479032817063299422, 21605492575661842863856, 19689857802812401696190, -10373020500988956288519, -12031683557576396063979, 2917407718475701287297, 529299141555595165383, -13764392025962000786943, -262214525957621198730, 9810889025999671380310, -6406215991301052954838, -20097408671866677013780, 10487482224513499146486, 19517868671715680347080, -13633670199349111227331, -27799081162740981704 -- (+1482 chars; full line in the Zenodo source)
[-33028818925185915452046, 20293352280485549873063, 21126083954345262413065, -17754349892012768300076, 984126231485850569719, -7318188990474182247274, 7054678516933879016583, -10436479032817063299422, -4367602843109386510552, 10433829526459778624956, 3820616892839146231175, -3208288801377989006826, 18582473798447518067422, -4875275199988213986582, -24184571634456925191438, 2160549257566184286385 -- (+1482 chars; full line in the Zenodo source)
[7318188990474182247274, 3208288801377989006826, 16860861818214974402394, -19689857802812401696190, -4388887465808690290690, 2523502816622141616954, -5310346466438344906254, -2917407718475701287297, 21925089061569372821696, 13494375564014803122883, -25871693920078539307200, 262214525957621198730, 11768850179548554847523, -9250322720447291292181, -6544973504482016372399, 20097408671866677013780, -- (+1486 chars; full line in the Zenodo source)
[-18582473798447518067422, 25046305300911426256257, 19517868671715680347080, -21469069912352122783799, 15043347413701330800833, 11768850179548554847523, -13494375564014803122883, -10487482224513499146486, 4886299945635763856496, -1787842233798098457888, -10436479032817063299422, -984126231485850569719, 16860861818214974402394, -13633670199349111227331, -24788030948787949091264, 23307932193772832 -- (+1484 chars; full line in the Zenodo source)
[-23452589412467807781267, 12031683557576396063979, 13494375564014803122883, -9810889025999671380310, -8058718768010441094061, 13633670199349111227331, 3820616892839146231175, 4367602843109386510552, 20473912172556674746900, -10248958182884182726595, -19456987005431825874564, 11834441417054338651248, 5310346466438344906254, -23673200613310289745689, 20293352280485549873063, 168608618182149744023 -- (+1479 chars; full line in the Zenodo source)
[-30044457238061491707033, 21925089061569372821696, 10857331262363163137853, -34260877871810783356253, 21605492575661842863856, -3820616892839146231175, -17917060576790011811630, 15043347413701330800833, 13148941774542354986549, -10373020500988956288519, 984126231485850569719, 23673200613310289745689, -10248958182884182726595, -2316161497319556749052, 2917407718475701287297, -1787842233798098457 -- (+1482 chars; full line in the Zenodo source)
[-4886299945635763856496, 24362265968592959741809, 10248958182884182726595, -24184571634456925191438, -6186241678261670929247, -3453941501042674492220, -13764392025962000786943, 4388887465808690290690, 17754349892012768300076, -17917060576790011811630, 262214525957621198730, 15418325677098525075700, 3820616892839146231175, -2779908116274098170444, 23307932193772832480638, -1349437556401480312288 -- (+1485 chars; full line in the Zenodo source)
[-25255080550413488080697, 19456987005431825874564, 3975299599742403196648, -18582473798447518067422, 21925089061569372821696, 529299141555595165383, -24184571634456925191438, 25046305300911426256257, 9250322720447291292181, -34260877871810783356253, 20293352280485549873063, 19517868671715680347080, -9810889025999671380310, 4388887465808690290690, -3820616892839146231175, -2146906991235212278379 -- (+1482 chars; full line in the Zenodo source)
[-2917407718475701287297, 20097408671866677013780, 7054678516933879016583, -25255080550413488080697, 11834441417054338651248, -4875275199988213986582, -4886299945635763856496, 19456987005431825874564, -1787842233798098457888, -30044457238061491707033, 2316161497319556749052, 3975299599742403196648, -23452589412467807781267, 24362265968592959741809, 3805143806432228346379, -1858247379844751806742 -- (+1480 chars; full line in the Zenodo source)
[-20097408671866677013780, 25255080550413488080697, 4875275199988213986582, -19456987005431825874564, 30044457238061491707033, -3975299599742403196648, -24362265968592959741809, 18582473798447518067422, -5310346466438344906254, -21925089061569372821696, 33028818925185915452046, -529299141555595165383, -12031683557576396063979, 24184571634456925191438, -10857331262363163137853, -25046305300911426 -- (+1485 chars; full line in the Zenodo source)
[-11834441417054338651248, 30044457238061491707033, -3805143806432228346379, -21925089061569372821696, 10436479032817063299422, -10857331262363163137853, 6186241678261670929247, 34260877871810783356253, -13788396284599753524128, -21605492575661842863856, 11768850179548554847523, 3820616892839146231175, 8058718768010441094061, 17917060576790011811630, -19689857802812401696190, -150433474137013308 -- (+1485 chars; full line in the Zenodo source)
[-19456987005431825874564, 18582473798447518067422, -529299141555595165383, -25046305300911426256257, 34260877871810783356253, -19517868671715680347080, -4388887465808690290690, 21469069912352122783799, -2567871963741335197346, -15043347413701330800833, 17754349892012768300076, -11768850179548554847523, -4367602843109386510552, 13494375564014803122883, -23673200613310289745689, 10487482224513499 -- (+1481 chars; full line in the Zenodo source)
[-2316161497319556749052, 33028818925185915452046, -11952526263170542259755, -20293352280485549873063, 11768850179548554847523, -21126083954345262413065, -262214525957621198730, 17754349892012768300076, -9810889025999671380310, -984126231485850569719, 10857331262363163137853, 7318188990474182247274, 19456987005431825874564, -7054678516933879016583, -24362265968592959741809, 104364790328170632994 -- (+1483 chars; full line in the Zenodo source)
[-24362265968592959741809, 24184571634456925191438, 3453941501042674492220, -4388887465808690290690, 17917060576790011811630, -15418325677098525075700, 2779908116274098170444, 13494375564014803122883, -10436479032817063299422, 2316161497319556749052, -7054678516933879016583, -6544973504482016372399, 23673200613310289745689, -13788396284599753524128, 819973644512659450582, 13633670199349111227331 -- (+1480 chars; full line in the Zenodo source)
[-6544973504482016372399, 20473912172556674746900, -10373020500988956288519, -15199027755863540886333, 21126083954345262413065, -13764392025962000786943, 25046305300911426256257, 3805143806432228346379, -20097408671866677013780, -7318188990474182247274, -9250322720447291292181, -2779908116274098170444, 17917060576790011811630, -21469069912352122783799, -4367602843109386510552, 108573312623631631 -- (+1485 chars; full line in the Zenodo source)
[-21925089061569372821696, 34260877871810783356253, 3820616892839146231175, -15043347413701330800833, 10373020500988956288519, -23673200613310289745689, 2316161497319556749052, 1787842233798098457888, -1497043819437830265365, 13764392025962000786943, -10433829526459778624956, 24788030948787949091264, -3453941501042674492220, -33028818925185915452046, 20097408671866677013780, -5310346466438344906 -- (+1481 chars; full line in the Zenodo source)
[-10487482224513499146486, 23307932193772832480638, -10433829526459778624956, -819973644512659450582, 9250322720447291292181, -23452589412467807781267, 30044457238061491707033, -11952526263170542259755, -4388887465808690290690, 2567871963741335197346, -13764392025962000786943, 12031683557576396063979, 7054678516933879016583, -21925089061569372821696, 11768901510672090541511, -2112608395434526241 -- (+1484 chars; full line in the Zenodo source)
[-12031683557576396063979, 9810889025999671380310, -13633670199349111227331, -4367602843109386510552, 10248958182884182726595, -11834441417054338651248, 23673200613310289745689, -16860861818214974402394, 15199027755863540886333, -3453941501042674492220, -18582473798447518067422, 30044457238061491707033, -9250322720447291292181, -24788030948787949091264, 17754349892012768300076, -2523502816622141 -- (+1484 chars; full line in the Zenodo source)
[-1497043819437830265365, 25871693920078539307200, -21469069912352122783799, -6186241678261670929247, -4875275199988213986582, -10487482224513499146486, 9810889025999671380310, -17917060576790011811630, -984126231485850569719, 3975299599742403196648, -6544973504482016372399, 23307932193772832480638, -19689857802812401696190, -4367602843109386510552, 5310346466438344906254, -231616149731955674905 -- (+1489 chars; full line in the Zenodo source)
[-25046305300911426256257, 21469069912352122783799, -11768850179548554847523, 10487482224513499146486, 1787842233798098457888, 984126231485850569719, 13633670199349111227331, -23307932193772832480638, 24362265968592959741809, -5310346466438344906254, -21605492575661842863856, 10433829526459778624956, -2523502816622141616954, 11834441417054338651248, -6406215991301052954838, 819973644512659450582 -- (+1485 chars; full line in the Zenodo source)
[6186241678261670929247, 17917060576790011811630, -23307932193772832480638, 2316161497319556749052, -529299141555595165383, 819973644512659450582, 16860861818214974402394, -33028818925185915452046, 23452589412467807781267, -19517868671715680347080, 15199027755863540886333, 11952526263170542259755, -20097408671866677013780, 2523502816622141616954, -2567871963741335197346, 20293352280485549873063, -- (+1482 chars; full line in the Zenodo source)
[-3208288801377989006826, 19689857802812401696190, -2523502816622141616954, 2917407718475701287297, -13494375564014803122883, -262214525957621198730, 9250322720447291292181, -20097408671866677013780, 34260877871810783356253, -13633670199349111227331, -6186241678261670929247, -7054678516933879016583, 984126231485850569719, 2567871963741335197346, -20473912172556674746900, 25255080550413488080697, -- (+1483 chars; full line in the Zenodo source)
[984126231485850569719, 10433829526459778624956, -24184571634456925191438, 23452589412467807781267, -11081642765470334834146, 4388887465808690290690, 3805143806432228346379, -12031683557576396063979, 15418325677098525075700, -11768901510672090541511, 20097408671866677013780, -13494375564014803122883, -15043347413701330800833, 10857331262363163137853, -2316161497319556749052, 98108890259996713803 -- (+1478 chars; full line in the Zenodo source)
[-20293352280485549873063, 17754349892012768300076, 7318188990474182247274, 10436479032817063299422, -10433829526459778624956, 3208288801377989006826, 4875275199988213986582, -21605492575661842863856, 16860861818214974402394, -23452589412467807781267, 23673200613310289745689, -19689857802812401696190, 25046305300911426256257, -3975299599742403196648, -4388887465808690290690, 10373020500988956288 -- (+1481 chars; full line in the Zenodo source)
[4367602843109386510552, 16860861818214974402394, -30044457238061491707033, 2523502816622141616954, -15418325677098525075700, 21925089061569372821696, -6406215991301052954838, 262214525957621198730, 10857331262363163137853, -6544973504482016372399, 21469069912352122783799, -34260877871810783356253, 4886299945635763856496, -11081642765470334834146, 21605492575661842863856, 7054678516933879016583, -- (+1481 chars; full line in the Zenodo source)
[-21605492575661842863856, 10373020500988956288519, -2917407718475701287297, 13764392025962000786943, -9810889025999671380310, 20097408671866677013780, -19517868671715680347080, 2779908116274098170444, 7054678516933879016583, 4367602843109386510552, 11081642765470334834146, -25255080550413488080697, 23307932193772832480638, -11768850179548554847523, 11834441417054338651248, -13788396284599753524 -- (+1481 chars; full line in the Zenodo source)
[-2779908116274098170444, 13788396284599753524128, -19456987005431825874564, 13148941774542354986549, -2523502816622141616954, 18582473798447518067422, -10433829526459778624956, 1497043819437830265365, -529299141555595165383, -262214525957621198730, 10248958182884182726595, -25046305300911426256257, 21126083954345262413065, -23452589412467807781267, 34260877871810783356253, -25871693920078539307 -- (+1484 chars; full line in the Zenodo source)
[-4388887465808690290690, 13494375564014803122883, -6544973504482016372399, 13633670199349111227331, -33028818925185915452046, 20473912172556674746900, -13148941774542354986549, 11834441417054338651248, -10373020500988956288519, 20293352280485549873063, -3975299599742403196648, -15199027755863540886333, 6406215991301052954838, -1497043819437830265365, 21126083954345262413065, -300444572380614917 -- (+1486 chars; full line in the Zenodo source)
[819973644512659450582, 11952526263170542259755, -12031683557576396063979, 21126083954345262413065, -4886299945635763856496, 9810889025999671380310, -34260877871810783356253, -7318188990474182247274, -13633670199349111227331, 24362265968592959741809, -13788396284599753524128, -4367602843109386510552, -3975299599742403196648, 15043347413701330800833, 10248958182884182726595, -32082888013779890068 -- (+1485 chars; full line in the Zenodo source)
[-24788030948787949091264, 6406215991301052954838, 6186241678261670929247, 11081642765470334834146, -19456987005431825874564, 17917060576790011811630, 7318188990474182247274, 11768901510672090541511, -23307932193772832480638, 18582473798447518067422, -13633670199349111227331, 2316161497319556749052, -10373020500988956288519, 3208288801377989006826, -529299141555595165383, -8058718768010441094061 -- (+1485 chars; full line in the Zenodo source)
[8058718768010441094061, 10248958182884182726595, -20293352280485549873063, -3453941501042674492220, -10487482224513499146486, 17754349892012768300076, -20097408671866677013780, 15418325677098525075700, 7318188990474182247274, 23307932193772832480638, -34260877871810783356253, 10436479032817063299422, -13148941774542354986549, 25255080550413488080697, -10433829526459778624956, 654497350448201637 -- (+1480 chars; full line in the Zenodo source)
[-15199027755863540886333, 3805143806432228346379, -2779908116274098170444, 10857331262363163137853, -3208288801377989006826, 13788396284599753524128, -10487482224513499146486, -3820616892839146231175, -19456987005431825874564, 19689857802812401696190, -4886299945635763856496, 13148941774542354986549, -33028818925185915452046, 23307932193772832480638, -2523502816622141616954, 2367320061331028974 -- (+1485 chars; full line in the Zenodo source)
[15043347413701330800833, -1787842233798098457888, -24788030948787949091264, 5310346466438344906254, -2779908116274098170444, 6406215991301052954838, -20293352280485549873063, 9250322720447291292181, 6186241678261670929247, 13788396284599753524128, -12031683557576396063979, 11081642765470334834146, -6544973504482016372399, 17754349892012768300076, -19456987005431825874564, 2567871963741335197346 -- (+1478 chars; full line in the Zenodo source)
[262214525957621198730, 7054678516933879016583, 15043347413701330800833, -4875275199988213986582, -15199027755863540886333, -1787842233798098457888, 8058718768010441094061, 3975299599742403196648, -24788030948787949091264, 3805143806432228346379, 819973644512659450582, 5310346466438344906254, -4388887465808690290690, 10248958182884182726595, -2779908116274098170444, 529299141555595165383, -21605 -- (+1479 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 75).map (fun t => rowA (150 + 1) t (rng 1 75)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 75 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 75 B A = sid 64066462670128932772786874 75 := rfl
theorem d_ne : (64066462670128932772786874 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 75 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 75) (h0 : mv A g = zeros 75) : g = zeros 75 :=
kernel_zero 75 64066462670128932772786874 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 150 75 = true := rfl
/-- **Balanced ⇒ pairs for p = 151.** A list with entries in (0, 151) that is balanced for 1 ≤ t ≤ 75
has as many copies of x as of 151 − x for every 1 ≤ x ≤ 75 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 151)
(hb : ∀ t, 1 ≤ t → t < 1 + 75 → tsum 151 t c + tsum 151 t c = c.length * 151) :
(rng 1 75).all (fun x => Nat.beq (cnt x c) (cnt (151 - x) c)) = true :=
pairs_of_bal 150 75 64066462670128932772786874 d_ne A B len cert A_def delta c hr hb
end MailletCert151
#print axioms MailletCert151.A_def
#print axioms MailletCert151.len
#print axioms MailletCert151.cert
#print axioms MailletCert151.d_ne
#print axioms MailletCert151.kernel
#print axioms MailletCert151.delta
#print axioms MailletCert151.pairs
lean_all/hodge/MailletCert157.lean
/-
hodge/MailletCert157.lean — T41 (goals G849b, G849c): for p = 157 the 78 × 78 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 78)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 112468655400803665534138490 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 157) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert157
open MailletLin MailletBridge
def A : List (List Int) := [
[-155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -- (+16 chars; full line in the Zenodo source)
[-153, -149, -145, -141, -137, -133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, 143, 147, 151, 155],
[-151, -145, -139, -133, -127, -121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, 143, 149, 155, -153, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, -9, -3],
[-149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, -151, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145, 153],
[-147, -137, -127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, 153, -151, -141, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, -155, -145, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5],
[-145, -133, -121, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, 119, 131, 143, 155, -147, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, 141, 153, -149, -137, -125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103, 115, 127, 139, 151],
[-143, -129, -115, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, 123, 137, 151, -149, -135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, 145, -155, -141, -127, -113, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, 111, 125, 139, 153, -147, -133, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-141, -125, -109, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, -151, -135, -119, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, 121, 137, 153, -145, -129, -113, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, 127, 143, -155, -139, -123, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, 117, 133, 149],
[-139, -121, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, 113, 131, 149, -147, -129, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, 141, -155, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, 151, -145, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, 143, -153, -135, -117, -99, -81, -63, -45, -27, -9],
[-137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, 143, -151, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, 149, -145, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, 155, -139, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, 141, -153, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, 147],
[-135, -113, -91, -69, -47, -25, -3, 19, 41, 63, 85, 107, 129, 151, -141, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, 145, -147, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, 139, -153, -131, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, 133, 155, -137, -115, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, 127, 149, -143, -121, -99, -77, -55, -33, -11],
[-133, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, 131, 155, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, 153, -137, -113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127, 151, -139, -115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125, 149, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, -143, -119, -95, -71, -47, -23, 1, 25, 49, 73, 97, 121, 145],
[-131, -105, -79, -53, -27, -1, 25, 51, 77, 103, 129, 155, -133, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, 153, -135, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, 151, -137, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, 149, -139, -113, -87, -61, -35, -9, 17, 43, 69, 95, 121, 147, -141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, -143, -117, -91, -65, -39, -13],
[-129, -101, -73, -45, -17, 11, 39, 67, 95, 123, 151, -135, -107, -79, -51, -23, 5, 33, 61, 89, 117, 145, -141, -113, -85, -57, -29, -1, 27, 55, 83, 111, 139, -147, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, -153, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, 155, -131, -103, -75, -47, -19, 9, 37, 65, 93, 121, 149, -137, -109, -81, -53, -25, 3, 31, 59, 87, 115, 143],
[-127, -97, -67, -37, -7, 23, 53, 83, 113, 143, -141, -111, -81, -51, -21, 9, 39, 69, 99, 129, -155, -125, -95, -65, -35, -5, 25, 55, 85, 115, 145, -139, -109, -79, -49, -19, 11, 41, 71, 101, 131, -153, -123, -93, -63, -33, -3, 27, 57, 87, 117, 147, -137, -107, -77, -47, -17, 13, 43, 73, 103, 133, -151, -121, -91, -61, -31, -1, 29, 59, 89, 119, 149, -135, -105, -75, -45, -15],
[-125, -93, -61, -29, 3, 35, 67, 99, 131, -151, -119, -87, -55, -23, 9, 41, 73, 105, 137, -145, -113, -81, -49, -17, 15, 47, 79, 111, 143, -139, -107, -75, -43, -11, 21, 53, 85, 117, 149, -133, -101, -69, -37, -5, 27, 59, 91, 123, 155, -127, -95, -63, -31, 1, 33, 65, 97, 129, -153, -121, -89, -57, -25, 7, 39, 71, 103, 135, -147, -115, -83, -51, -19, 13, 45, 77, 109, 141],
[-123, -89, -55, -21, 13, 47, 81, 115, 149, -131, -97, -63, -29, 5, 39, 73, 107, 141, -139, -105, -71, -37, -3, 31, 65, 99, 133, -147, -113, -79, -45, -11, 23, 57, 91, 125, -155, -121, -87, -53, -19, 15, 49, 83, 117, 151, -129, -95, -61, -27, 7, 41, 75, 109, 143, -137, -103, -69, -35, -1, 33, 67, 101, 135, -145, -111, -77, -43, -9, 25, 59, 93, 127, -153, -119, -85, -51, -17],
[-121, -85, -49, -13, 23, 59, 95, 131, -147, -111, -75, -39, -3, 33, 69, 105, 141, -137, -101, -65, -29, 7, 43, 79, 115, 151, -127, -91, -55, -19, 17, 53, 89, 125, -153, -117, -81, -45, -9, 27, 63, 99, 135, -143, -107, -71, -35, 1, 37, 73, 109, 145, -133, -97, -61, -25, 11, 47, 83, 119, 155, -123, -87, -51, -15, 21, 57, 93, 129, -149, -113, -77, -41, -5, 31, 67, 103, 139],
[-119, -81, -43, -5, 33, 71, 109, 147, -129, -91, -53, -15, 23, 61, 99, 137, -139, -101, -63, -25, 13, 51, 89, 127, -149, -111, -73, -35, 3, 41, 79, 117, 155, -121, -83, -45, -7, 31, 69, 107, 145, -131, -93, -55, -17, 21, 59, 97, 135, -141, -103, -65, -27, 11, 49, 87, 125, -151, -113, -75, -37, 1, 39, 77, 115, 153, -123, -85, -47, -9, 29, 67, 105, 143, -133, -95, -57, -19],
[-117, -77, -37, 3, 43, 83, 123, -151, -111, -71, -31, 9, 49, 89, 129, -145, -105, -65, -25, 15, 55, 95, 135, -139, -99, -59, -19, 21, 61, 101, 141, -133, -93, -53, -13, 27, 67, 107, 147, -127, -87, -47, -7, 33, 73, 113, 153, -121, -81, -41, -1, 39, 79, 119, -155, -115, -75, -35, 5, 45, 85, 125, -149, -109, -69, -29, 11, 51, 91, 131, -143, -103, -63, -23, 17, 57, 97, 137],
[-115, -73, -31, 11, 53, 95, 137, -135, -93, -51, -9, 33, 75, 117, -155, -113, -71, -29, 13, 55, 97, 139, -133, -91, -49, -7, 35, 77, 119, -153, -111, -69, -27, 15, 57, 99, 141, -131, -89, -47, -5, 37, 79, 121, -151, -109, -67, -25, 17, 59, 101, 143, -129, -87, -45, -3, 39, 81, 123, -149, -107, -65, -23, 19, 61, 103, 145, -127, -85, -43, -1, 41, 83, 125, -147, -105, -63, -21],
[-113, -69, -25, 19, 63, 107, 151, -119, -75, -31, 13, 57, 101, 145, -125, -81, -37, 7, 51, 95, 139, -131, -87, -43, 1, 45, 89, 133, -137, -93, -49, -5, 39, 83, 127, -143, -99, -55, -11, 33, 77, 121, -149, -105, -61, -17, 27, 71, 115, -155, -111, -67, -23, 21, 65, 109, 153, -117, -73, -29, 15, 59, 103, 147, -123, -79, -35, 9, 53, 97, 141, -129, -85, -41, 3, 47, 91, 135],
[-111, -65, -19, 27, 73, 119, -149, -103, -57, -11, 35, 81, 127, -141, -95, -49, -3, 43, 89, 135, -133, -87, -41, 5, 51, 97, 143, -125, -79, -33, 13, 59, 105, 151, -117, -71, -25, 21, 67, 113, -155, -109, -63, -17, 29, 75, 121, -147, -101, -55, -9, 37, 83, 129, -139, -93, -47, -1, 45, 91, 137, -131, -85, -39, 7, 53, 99, 145, -123, -77, -31, 15, 61, 107, 153, -115, -69, -23],
[-109, -61, -13, 35, 83, 131, -135, -87, -39, 9, 57, 105, 153, -113, -65, -17, 31, 79, 127, -139, -91, -43, 5, 53, 101, 149, -117, -69, -21, 27, 75, 123, -143, -95, -47, 1, 49, 97, 145, -121, -73, -25, 23, 71, 119, -147, -99, -51, -3, 45, 93, 141, -125, -77, -29, 19, 67, 115, -151, -103, -55, -7, 41, 89, 137, -129, -81, -33, 15, 63, 111, -155, -107, -59, -11, 37, 85, 133],
[-107, -57, -7, 43, 93, 143, -121, -71, -21, 29, 79, 129, -135, -85, -35, 15, 65, 115, -149, -99, -49, 1, 51, 101, 151, -113, -63, -13, 37, 87, 137, -127, -77, -27, 23, 73, 123, -141, -91, -41, 9, 59, 109, -155, -105, -55, -5, 45, 95, 145, -119, -69, -19, 31, 81, 131, -133, -83, -33, 17, 67, 117, -147, -97, -47, 3, 53, 103, 153, -111, -61, -11, 39, 89, 139, -125, -75, -25],
[-105, -53, -1, 51, 103, 155, -107, -55, -3, 49, 101, 153, -109, -57, -5, 47, 99, 151, -111, -59, -7, 45, 97, 149, -113, -61, -9, 43, 95, 147, -115, -63, -11, 41, 93, 145, -117, -65, -13, 39, 91, 143, -119, -67, -15, 37, 89, 141, -121, -69, -17, 35, 87, 139, -123, -71, -19, 33, 85, 137, -125, -73, -21, 31, 83, 135, -127, -75, -23, 29, 81, 133, -129, -77, -25, 27, 79, 131],
[-103, -49, 5, 59, 113, -147, -93, -39, 15, 69, 123, -137, -83, -29, 25, 79, 133, -127, -73, -19, 35, 89, 143, -117, -63, -9, 45, 99, 153, -107, -53, 1, 55, 109, -151, -97, -43, 11, 65, 119, -141, -87, -33, 21, 75, 129, -131, -77, -23, 31, 85, 139, -121, -67, -13, 41, 95, 149, -111, -57, -3, 51, 105, -155, -101, -47, 7, 61, 115, -145, -91, -37, 17, 71, 125, -135, -81, -27],
[-101, -45, 11, 67, 123, -135, -79, -23, 33, 89, 145, -113, -57, -1, 55, 111, -147, -91, -35, 21, 77, 133, -125, -69, -13, 43, 99, 155, -103, -47, 9, 65, 121, -137, -81, -25, 31, 87, 143, -115, -59, -3, 53, 109, -149, -93, -37, 19, 75, 131, -127, -71, -15, 41, 97, 153, -105, -49, 7, 63, 119, -139, -83, -27, 29, 85, 141, -117, -61, -5, 51, 107, -151, -95, -39, 17, 73, 129],
[-99, -41, 17, 75, 133, -123, -65, -7, 51, 109, -147, -89, -31, 27, 85, 143, -113, -55, 3, 61, 119, -137, -79, -21, 37, 95, 153, -103, -45, 13, 71, 129, -127, -69, -11, 47, 105, -151, -93, -35, 23, 81, 139, -117, -59, -1, 57, 115, -141, -83, -25, 33, 91, 149, -107, -49, 9, 67, 125, -131, -73, -15, 43, 101, -155, -97, -39, 19, 77, 135, -121, -63, -5, 53, 111, -145, -87, -29],
[-97, -37, 23, 83, 143, -111, -51, 9, 69, 129, -125, -65, -5, 55, 115, -139, -79, -19, 41, 101, -153, -93, -33, 27, 87, 147, -107, -47, 13, 73, 133, -121, -61, -1, 59, 119, -135, -75, -15, 45, 105, -149, -89, -29, 31, 91, 151, -103, -43, 17, 77, 137, -117, -57, 3, 63, 123, -131, -71, -11, 49, 109, -145, -85, -25, 35, 95, 155, -99, -39, 21, 81, 141, -113, -53, 7, 67, 127],
[-95, -33, 29, 91, 153, -99, -37, 25, 87, 149, -103, -41, 21, 83, 145, -107, -45, 17, 79, 141, -111, -49, 13, 75, 137, -115, -53, 9, 71, 133, -119, -57, 5, 67, 129, -123, -61, 1, 63, 125, -127, -65, -3, 59, 121, -131, -69, -7, 55, 117, -135, -73, -11, 51, 113, -139, -77, -15, 47, 109, -143, -81, -19, 43, 105, -147, -85, -23, 39, 101, -151, -89, -27, 35, 97, -155, -93, -31],
[-93, -29, 35, 99, -151, -87, -23, 41, 105, -145, -81, -17, 47, 111, -139, -75, -11, 53, 117, -133, -69, -5, 59, 123, -127, -63, 1, 65, 129, -121, -57, 7, 71, 135, -115, -51, 13, 77, 141, -109, -45, 19, 83, 147, -103, -39, 25, 89, 153, -97, -33, 31, 95, -155, -91, -27, 37, 101, -149, -85, -21, 43, 107, -143, -79, -15, 49, 113, -137, -73, -9, 55, 119, -131, -67, -3, 61, 125],
[-91, -25, 41, 107, -141, -75, -9, 57, 123, -125, -59, 7, 73, 139, -109, -43, 23, 89, 155, -93, -27, 39, 105, -143, -77, -11, 55, 121, -127, -61, 5, 71, 137, -111, -45, 21, 87, 153, -95, -29, 37, 103, -145, -79, -13, 53, 119, -129, -63, 3, 69, 135, -113, -47, 19, 85, 151, -97, -31, 35, 101, -147, -81, -15, 51, 117, -131, -65, 1, 67, 133, -115, -49, 17, 83, 149, -99, -33],
[-89, -21, 47, 115, -131, -63, 5, 73, 141, -105, -37, 31, 99, -147, -79, -11, 57, 125, -121, -53, 15, 83, 151, -95, -27, 41, 109, -137, -69, -1, 67, 135, -111, -43, 25, 93, -153, -85, -17, 51, 119, -127, -59, 9, 77, 145, -101, -33, 35, 103, -143, -75, -7, 61, 129, -117, -49, 19, 87, 155, -91, -23, 45, 113, -133, -65, 3, 71, 139, -107, -39, 29, 97, -149, -81, -13, 55, 123],
[-87, -17, 53, 123, -121, -51, 19, 89, -155, -85, -15, 55, 125, -119, -49, 21, 91, -153, -83, -13, 57, 127, -117, -47, 23, 93, -151, -81, -11, 59, 129, -115, -45, 25, 95, -149, -79, -9, 61, 131, -113, -43, 27, 97, -147, -77, -7, 63, 133, -111, -41, 29, 99, -145, -75, -5, 65, 135, -109, -39, 31, 101, -143, -73, -3, 67, 137, -107, -37, 33, 103, -141, -71, -1, 69, 139, -105, -35],
[-85, -13, 59, 131, -111, -39, 33, 105, -137, -65, 7, 79, 151, -91, -19, 53, 125, -117, -45, 27, 99, -143, -71, 1, 73, 145, -97, -25, 47, 119, -123, -51, 21, 93, -149, -77, -5, 67, 139, -103, -31, 41, 113, -129, -57, 15, 87, -155, -83, -11, 61, 133, -109, -37, 35, 107, -135, -63, 9, 81, 153, -89, -17, 55, 127, -115, -43, 29, 101, -141, -69, 3, 75, 147, -95, -23, 49, 121],
[-83, -9, 65, 139, -101, -27, 47, 121, -119, -45, 29, 103, -137, -63, 11, 85, -155, -81, -7, 67, 141, -99, -25, 49, 123, -117, -43, 31, 105, -135, -61, 13, 87, -153, -79, -5, 69, 143, -97, -23, 51, 125, -115, -41, 33, 107, -133, -59, 15, 89, -151, -77, -3, 71, 145, -95, -21, 53, 127, -113, -39, 35, 109, -131, -57, 17, 91, -149, -75, -1, 73, 147, -93, -19, 55, 129, -111, -37],
[-81, -5, 71, 147, -91, -15, 61, 137, -101, -25, 51, 127, -111, -35, 41, 117, -121, -45, 31, 107, -131, -55, 21, 97, -141, -65, 11, 87, -151, -75, 1, 77, 153, -85, -9, 67, 143, -95, -19, 57, 133, -105, -29, 47, 123, -115, -39, 37, 113, -125, -49, 27, 103, -135, -59, 17, 93, -145, -69, 7, 83, -155, -79, -3, 73, 149, -89, -13, 63, 139, -99, -23, 53, 129, -109, -33, 43, 119],
[-79, -1, 77, 155, -81, -3, 75, 153, -83, -5, 73, 151, -85, -7, 71, 149, -87, -9, 69, 147, -89, -11, 67, 145, -91, -13, 65, 143, -93, -15, 63, 141, -95, -17, 61, 139, -97, -19, 59, 137, -99, -21, 57, 135, -101, -23, 55, 133, -103, -25, 53, 131, -105, -27, 51, 129, -107, -29, 49, 127, -109, -31, 47, 125, -111, -33, 45, 123, -113, -35, 43, 121, -115, -37, 41, 119, -117, -39],
[-77, 3, 83, -151, -71, 9, 89, -145, -65, 15, 95, -139, -59, 21, 101, -133, -53, 27, 107, -127, -47, 33, 113, -121, -41, 39, 119, -115, -35, 45, 125, -109, -29, 51, 131, -103, -23, 57, 137, -97, -17, 63, 143, -91, -11, 69, 149, -85, -5, 75, 155, -79, 1, 81, -153, -73, 7, 87, -147, -67, 13, 93, -141, -61, 19, 99, -135, -55, 25, 105, -129, -49, 31, 111, -123, -43, 37, 117],
[-75, 7, 89, -143, -61, 21, 103, -129, -47, 35, 117, -115, -33, 49, 131, -101, -19, 63, 145, -87, -5, 77, -155, -73, 9, 91, -141, -59, 23, 105, -127, -45, 37, 119, -113, -31, 51, 133, -99, -17, 65, 147, -85, -3, 79, -153, -71, 11, 93, -139, -57, 25, 107, -125, -43, 39, 121, -111, -29, 53, 135, -97, -15, 67, 149, -83, -1, 81, -151, -69, 13, 95, -137, -55, 27, 109, -123, -41],
[-73, 11, 95, -135, -51, 33, 117, -113, -29, 55, 139, -91, -7, 77, -153, -69, 15, 99, -131, -47, 37, 121, -109, -25, 59, 143, -87, -3, 81, -149, -65, 19, 103, -127, -43, 41, 125, -105, -21, 63, 147, -83, 1, 85, -145, -61, 23, 107, -123, -39, 45, 129, -101, -17, 67, 151, -79, 5, 89, -141, -57, 27, 111, -119, -35, 49, 133, -97, -13, 71, 155, -75, 9, 93, -137, -53, 31, 115],
[-71, 15, 101, -127, -41, 45, 131, -97, -11, 75, -153, -67, 19, 105, -123, -37, 49, 135, -93, -7, 79, -149, -63, 23, 109, -119, -33, 53, 139, -89, -3, 83, -145, -59, 27, 113, -115, -29, 57, 143, -85, 1, 87, -141, -55, 31, 117, -111, -25, 61, 147, -81, 5, 91, -137, -51, 35, 121, -107, -21, 65, 151, -77, 9, 95, -133, -47, 39, 125, -103, -17, 69, 155, -73, 13, 99, -129, -43],
[-69, 19, 107, -119, -31, 57, 145, -81, 7, 95, -131, -43, 45, 133, -93, -5, 83, -143, -55, 33, 121, -105, -17, 71, -155, -67, 21, 109, -117, -29, 59, 147, -79, 9, 97, -129, -41, 47, 135, -91, -3, 85, -141, -53, 35, 123, -103, -15, 73, -153, -65, 23, 111, -115, -27, 61, 149, -77, 11, 99, -127, -39, 49, 137, -89, -1, 87, -139, -51, 37, 125, -101, -13, 75, -151, -63, 25, 113],
[-67, 23, 113, -111, -21, 69, -155, -65, 25, 115, -109, -19, 71, -153, -63, 27, 117, -107, -17, 73, -151, -61, 29, 119, -105, -15, 75, -149, -59, 31, 121, -103, -13, 77, -147, -57, 33, 123, -101, -11, 79, -145, -55, 35, 125, -99, -9, 81, -143, -53, 37, 127, -97, -7, 83, -141, -51, 39, 129, -95, -5, 85, -139, -49, 41, 131, -93, -3, 87, -137, -47, 43, 133, -91, -1, 89, -135, -45],
[-65, 27, 119, -103, -11, 81, -141, -49, 43, 135, -87, 5, 97, -125, -33, 59, 151, -71, 21, 113, -109, -17, 75, -147, -55, 37, 129, -93, -1, 91, -131, -39, 53, 145, -77, 15, 107, -115, -23, 69, -153, -61, 31, 123, -99, -7, 85, -137, -45, 47, 139, -83, 9, 101, -121, -29, 63, 155, -67, 25, 117, -105, -13, 79, -143, -51, 41, 133, -89, 3, 95, -127, -35, 57, 149, -73, 19, 111],
[-63, 31, 125, -95, -1, 93, -127, -33, 61, 155, -65, 29, 123, -97, -3, 91, -129, -35, 59, 153, -67, 27, 121, -99, -5, 89, -131, -37, 57, 151, -69, 25, 119, -101, -7, 87, -133, -39, 55, 149, -71, 23, 117, -103, -9, 85, -135, -41, 53, 147, -73, 21, 115, -105, -11, 83, -137, -43, 51, 145, -75, 19, 113, -107, -13, 81, -139, -45, 49, 143, -77, 17, 111, -109, -15, 79, -141, -47],
[-61, 35, 131, -87, 9, 105, -113, -17, 79, -139, -43, 53, 149, -69, 27, 123, -95, 1, 97, -121, -25, 71, -147, -51, 45, 141, -77, 19, 115, -103, -7, 89, -129, -33, 63, -155, -59, 37, 133, -85, 11, 107, -111, -15, 81, -137, -41, 55, 151, -67, 29, 125, -93, 3, 99, -119, -23, 73, -145, -49, 47, 143, -75, 21, 117, -101, -5, 91, -127, -31, 65, -153, -57, 39, 135, -83, 13, 109],
[-59, 39, 137, -79, 19, 117, -99, -1, 97, -119, -21, 77, -139, -41, 57, 155, -61, 37, 135, -81, 17, 115, -101, -3, 95, -121, -23, 75, -141, -43, 55, 153, -63, 35, 133, -83, 15, 113, -103, -5, 93, -123, -25, 73, -143, -45, 53, 151, -65, 33, 131, -85, 13, 111, -105, -7, 91, -125, -27, 71, -145, -47, 51, 149, -67, 31, 129, -87, 11, 109, -107, -9, 89, -127, -29, 69, -147, -49],
[-57, 43, 143, -71, 29, 129, -85, 15, 115, -99, 1, 101, -113, -13, 87, -127, -27, 73, -141, -41, 59, -155, -55, 45, 145, -69, 31, 131, -83, 17, 117, -97, 3, 103, -111, -11, 89, -125, -25, 75, -139, -39, 61, -153, -53, 47, 147, -67, 33, 133, -81, 19, 119, -95, 5, 105, -109, -9, 91, -123, -23, 77, -137, -37, 63, -151, -51, 49, 149, -65, 35, 135, -79, 21, 121, -93, 7, 107],
[-55, 47, 149, -63, 39, 141, -71, 31, 133, -79, 23, 125, -87, 15, 117, -95, 7, 109, -103, -1, 101, -111, -9, 93, -119, -17, 85, -127, -25, 77, -135, -33, 69, -143, -41, 61, -151, -49, 53, 155, -57, 45, 147, -65, 37, 139, -73, 29, 131, -81, 21, 123, -89, 13, 115, -97, 5, 107, -105, -3, 99, -113, -11, 91, -121, -19, 83, -129, -27, 75, -137, -35, 67, -145, -43, 59, -153, -51],
[-53, 51, 155, -55, 49, 153, -57, 47, 151, -59, 45, 149, -61, 43, 147, -63, 41, 145, -65, 39, 143, -67, 37, 141, -69, 35, 139, -71, 33, 137, -73, 31, 135, -75, 29, 133, -77, 27, 131, -79, 25, 129, -81, 23, 127, -83, 21, 125, -85, 19, 123, -87, 17, 121, -89, 15, 119, -91, 13, 117, -93, 11, 115, -95, 9, 113, -97, 7, 111, -99, 5, 109, -101, 3, 107, -103, 1, 105],
[-51, 55, -153, -47, 59, -149, -43, 63, -145, -39, 67, -141, -35, 71, -137, -31, 75, -133, -27, 79, -129, -23, 83, -125, -19, 87, -121, -15, 91, -117, -11, 95, -113, -7, 99, -109, -3, 103, -105, 1, 107, -101, 5, 111, -97, 9, 115, -93, 13, 119, -89, 17, 123, -85, 21, 127, -81, 25, 131, -77, 29, 135, -73, 33, 139, -69, 37, 143, -65, 41, 147, -61, 45, 151, -57, 49, 155, -53],
[-49, 59, -147, -39, 69, -137, -29, 79, -127, -19, 89, -117, -9, 99, -107, 1, 109, -97, 11, 119, -87, 21, 129, -77, 31, 139, -67, 41, 149, -57, 51, -155, -47, 61, -145, -37, 71, -135, -27, 81, -125, -17, 91, -115, -7, 101, -105, 3, 111, -95, 13, 121, -85, 23, 131, -75, 33, 141, -65, 43, 151, -55, 53, -153, -45, 63, -143, -35, 73, -133, -25, 83, -123, -15, 93, -113, -5, 103],
[-47, 63, -141, -31, 79, -125, -15, 95, -109, 1, 111, -93, 17, 127, -77, 33, 143, -61, 49, -155, -45, 65, -139, -29, 81, -123, -13, 97, -107, 3, 113, -91, 19, 129, -75, 35, 145, -59, 51, -153, -43, 67, -137, -27, 83, -121, -11, 99, -105, 5, 115, -89, 21, 131, -73, 37, 147, -57, 53, -151, -41, 69, -135, -25, 85, -119, -9, 101, -103, 7, 117, -87, 23, 133, -71, 39, 149, -55],
[-45, 67, -135, -23, 89, -113, -1, 111, -91, 21, 133, -69, 43, 155, -47, 65, -137, -25, 87, -115, -3, 109, -93, 19, 131, -71, 41, 153, -49, 63, -139, -27, 85, -117, -5, 107, -95, 17, 129, -73, 39, 151, -51, 61, -141, -29, 83, -119, -7, 105, -97, 15, 127, -75, 37, 149, -53, 59, -143, -31, 81, -121, -9, 103, -99, 13, 125, -77, 35, 147, -55, 57, -145, -33, 79, -123, -11, 101],
[-43, 71, -129, -15, 99, -101, 13, 127, -73, 41, 155, -45, 69, -131, -17, 97, -103, 11, 125, -75, 39, 153, -47, 67, -133, -19, 95, -105, 9, 123, -77, 37, 151, -49, 65, -135, -21, 93, -107, 7, 121, -79, 35, 149, -51, 63, -137, -23, 91, -109, 5, 119, -81, 33, 147, -53, 61, -139, -25, 89, -111, 3, 117, -83, 31, 145, -55, 59, -141, -27, 87, -113, 1, 115, -85, 29, 143, -57],
[-41, 75, -123, -7, 109, -89, 27, 143, -55, 61, -137, -21, 95, -103, 13, 129, -69, 47, -151, -35, 81, -117, -1, 115, -83, 33, 149, -49, 67, -131, -15, 101, -97, 19, 135, -63, 53, -145, -29, 87, -111, 5, 121, -77, 39, 155, -43, 73, -125, -9, 107, -91, 25, 141, -57, 59, -139, -23, 93, -105, 11, 127, -71, 45, -153, -37, 79, -119, -3, 113, -85, 31, 147, -51, 65, -133, -17, 99],
[-39, 79, -117, 1, 119, -77, 41, -155, -37, 81, -115, 3, 121, -75, 43, -153, -35, 83, -113, 5, 123, -73, 45, -151, -33, 85, -111, 7, 125, -71, 47, -149, -31, 87, -109, 9, 127, -69, 49, -147, -29, 89, -107, 11, 129, -67, 51, -145, -27, 91, -105, 13, 131, -65, 53, -143, -25, 93, -103, 15, 133, -63, 55, -141, -23, 95, -101, 17, 135, -61, 57, -139, -21, 97, -99, 19, 137, -59],
[-37, 83, -111, 9, 129, -65, 55, -139, -19, 101, -93, 27, 147, -47, 73, -121, -1, 119, -75, 45, -149, -29, 91, -103, 17, 137, -57, 63, -131, -11, 109, -85, 35, 155, -39, 81, -113, 7, 127, -67, 53, -141, -21, 99, -95, 25, 145, -49, 71, -123, -3, 117, -77, 43, -151, -31, 89, -105, 15, 135, -59, 61, -133, -13, 107, -87, 33, 153, -41, 79, -115, 5, 125, -69, 51, -143, -23, 97],
[-35, 87, -105, 17, 139, -53, 69, -123, -1, 121, -71, 51, -141, -19, 103, -89, 33, 155, -37, 85, -107, 15, 137, -55, 67, -125, -3, 119, -73, 49, -143, -21, 101, -91, 31, 153, -39, 83, -109, 13, 135, -57, 65, -127, -5, 117, -75, 47, -145, -23, 99, -93, 29, 151, -41, 81, -111, 11, 133, -59, 63, -129, -7, 115, -77, 45, -147, -25, 97, -95, 27, 149, -43, 79, -113, 9, 131, -61],
[-33, 91, -99, 25, 149, -41, 83, -107, 17, 141, -49, 75, -115, 9, 133, -57, 67, -123, 1, 125, -65, 59, -131, -7, 117, -73, 51, -139, -15, 109, -81, 43, -147, -23, 101, -89, 35, -155, -31, 93, -97, 27, 151, -39, 85, -105, 19, 143, -47, 77, -113, 11, 135, -55, 69, -121, 3, 127, -63, 61, -129, -5, 119, -71, 53, -137, -13, 111, -79, 45, -145, -21, 103, -87, 37, -153, -29, 95],
[-31, 95, -93, 33, -155, -29, 97, -91, 35, -153, -27, 99, -89, 37, -151, -25, 101, -87, 39, -149, -23, 103, -85, 41, -147, -21, 105, -83, 43, -145, -19, 107, -81, 45, -143, -17, 109, -79, 47, -141, -15, 111, -77, 49, -139, -13, 113, -75, 51, -137, -11, 115, -73, 53, -135, -9, 117, -71, 55, -133, -7, 119, -69, 57, -131, -5, 121, -67, 59, -129, -3, 123, -65, 61, -127, -1, 125, -63],
[-29, 99, -87, 41, -145, -17, 111, -75, 53, -133, -5, 123, -63, 65, -121, 7, 135, -51, 77, -109, 19, 147, -39, 89, -97, 31, -155, -27, 101, -85, 43, -143, -15, 113, -73, 55, -131, -3, 125, -61, 67, -119, 9, 137, -49, 79, -107, 21, 149, -37, 91, -95, 33, -153, -25, 103, -83, 45, -141, -13, 115, -71, 57, -129, -1, 127, -59, 69, -117, 11, 139, -47, 81, -105, 23, 151, -35, 93],
[-27, 103, -81, 49, -135, -5, 125, -59, 71, -113, 17, 147, -37, 93, -91, 39, -145, -15, 115, -69, 61, -123, 7, 137, -47, 83, -101, 29, -155, -25, 105, -79, 51, -133, -3, 127, -57, 73, -111, 19, 149, -35, 95, -89, 41, -143, -13, 117, -67, 63, -121, 9, 139, -45, 85, -99, 31, -153, -23, 107, -77, 53, -131, -1, 129, -55, 75, -109, 21, 151, -33, 97, -87, 43, -141, -11, 119, -65],
[-25, 107, -75, 57, -125, 7, 139, -43, 89, -93, 39, -143, -11, 121, -61, 71, -111, 21, 153, -29, 103, -79, 53, -129, 3, 135, -47, 85, -97, 35, -147, -15, 117, -65, 67, -115, 17, 149, -33, 99, -83, 49, -133, -1, 131, -51, 81, -101, 31, -151, -19, 113, -69, 63, -119, 13, 145, -37, 95, -87, 45, -137, -5, 127, -55, 77, -105, 27, -155, -23, 109, -73, 59, -123, 9, 141, -41, 91],
[-23, 111, -69, 65, -115, 19, 153, -27, 107, -73, 61, -119, 15, 149, -31, 103, -77, 57, -123, 11, 145, -35, 99, -81, 53, -127, 7, 141, -39, 95, -85, 49, -131, 3, 137, -43, 91, -89, 45, -135, -1, 133, -47, 87, -93, 41, -139, -5, 129, -51, 83, -97, 37, -143, -9, 125, -55, 79, -101, 33, -147, -13, 121, -59, 75, -105, 29, -151, -17, 117, -63, 71, -109, 25, -155, -21, 113, -67],
[-21, 115, -63, 73, -105, 31, -147, -11, 125, -53, 83, -95, 41, -137, -1, 135, -43, 93, -85, 51, -127, 9, 145, -33, 103, -75, 61, -117, 19, 155, -23, 113, -65, 71, -107, 29, -149, -13, 123, -55, 81, -97, 39, -139, -3, 133, -45, 91, -87, 49, -129, 7, 143, -35, 101, -77, 59, -119, 17, 153, -25, 111, -67, 69, -109, 27, -151, -15, 121, -57, 79, -99, 37, -141, -5, 131, -47, 89],
[-19, 119, -57, 81, -95, 43, -133, 5, 143, -33, 105, -71, 67, -109, 29, -147, -9, 129, -47, 91, -85, 53, -123, 15, 153, -23, 115, -61, 77, -99, 39, -137, 1, 139, -37, 101, -75, 63, -113, 25, -151, -13, 125, -51, 87, -89, 49, -127, 11, 149, -27, 111, -65, 73, -103, 35, -141, -3, 135, -41, 97, -79, 59, -117, 21, -155, -17, 121, -55, 83, -93, 45, -131, 7, 145, -31, 107, -69],
[-17, 123, -51, 89, -85, 55, -119, 21, -153, -13, 127, -47, 93, -81, 59, -115, 25, -149, -9, 131, -43, 97, -77, 63, -111, 29, -145, -5, 135, -39, 101, -73, 67, -107, 33, -141, -1, 139, -35, 105, -69, 71, -103, 37, -137, 3, 143, -31, 109, -65, 75, -99, 41, -133, 7, 147, -27, 113, -61, 79, -95, 45, -129, 11, 151, -23, 117, -57, 83, -91, 49, -125, 15, 155, -19, 121, -53, 87],
[-15, 127, -45, 97, -75, 67, -105, 37, -135, 7, 149, -23, 119, -53, 89, -83, 59, -113, 29, -143, -1, 141, -31, 111, -61, 81, -91, 51, -121, 21, -151, -9, 133, -39, 103, -69, 73, -99, 43, -129, 13, 155, -17, 125, -47, 95, -77, 65, -107, 35, -137, 5, 147, -25, 117, -55, 87, -85, 57, -115, 27, -145, -3, 139, -33, 109, -63, 79, -93, 49, -123, 19, -153, -11, 131, -41, 101, -71],
[-13, 131, -39, 105, -65, 79, -91, 53, -117, 27, -143, 1, 145, -25, 119, -51, 93, -77, 67, -103, 41, -129, 15, -155, -11, 133, -37, 107, -63, 81, -89, 55, -115, 29, -141, 3, 147, -23, 121, -49, 95, -75, 69, -101, 43, -127, 17, -153, -9, 135, -35, 109, -61, 83, -87, 57, -113, 31, -139, 5, 149, -21, 123, -47, 97, -73, 71, -99, 45, -125, 19, -151, -7, 137, -33, 111, -59, 85],
[-11, 135, -33, 113, -55, 91, -77, 69, -99, 47, -121, 25, -143, 3, 149, -19, 127, -41, 105, -63, 83, -85, 61, -107, 39, -129, 17, -151, -5, 141, -27, 119, -49, 97, -71, 75, -93, 53, -115, 31, -137, 9, 155, -13, 133, -35, 111, -57, 89, -79, 67, -101, 45, -123, 23, -145, 1, 147, -21, 125, -43, 103, -65, 81, -87, 59, -109, 37, -131, 15, -153, -7, 139, -29, 117, -51, 95, -73],
[-9, 139, -27, 121, -45, 103, -63, 85, -81, 67, -99, 49, -117, 31, -135, 13, -153, -5, 143, -23, 125, -41, 107, -59, 89, -77, 71, -95, 53, -113, 35, -131, 17, -149, -1, 147, -19, 129, -37, 111, -55, 93, -73, 75, -91, 57, -109, 39, -127, 21, -145, 3, 151, -15, 133, -33, 115, -51, 97, -69, 79, -87, 61, -105, 43, -123, 25, -141, 7, 155, -11, 137, -29, 119, -47, 101, -65, 83],
[-7, 143, -21, 129, -35, 115, -49, 101, -63, 87, -77, 73, -91, 59, -105, 45, -119, 31, -133, 17, -147, 3, 153, -11, 139, -25, 125, -39, 111, -53, 97, -67, 83, -81, 69, -95, 55, -109, 41, -123, 27, -137, 13, -151, -1, 149, -15, 135, -29, 121, -43, 107, -57, 93, -71, 79, -85, 65, -99, 51, -113, 37, -127, 23, -141, 9, -155, -5, 145, -19, 131, -33, 117, -47, 103, -61, 89, -75],
[-5, 147, -15, 137, -25, 127, -35, 117, -45, 107, -55, 97, -65, 87, -75, 77, -85, 67, -95, 57, -105, 47, -115, 37, -125, 27, -135, 17, -145, 7, -155, -3, 149, -13, 139, -23, 129, -33, 119, -43, 109, -53, 99, -63, 89, -73, 79, -83, 69, -93, 59, -103, 49, -113, 39, -123, 29, -133, 19, -143, 9, -153, -1, 151, -11, 141, -21, 131, -31, 121, -41, 111, -51, 101, -61, 91, -71, 81],
[-3, 151, -9, 145, -15, 139, -21, 133, -27, 127, -33, 121, -39, 115, -45, 109, -51, 103, -57, 97, -63, 91, -69, 85, -75, 79, -81, 73, -87, 67, -93, 61, -99, 55, -105, 49, -111, 43, -117, 37, -123, 31, -129, 25, -135, 19, -141, 13, -147, 7, -153, 1, 155, -5, 149, -11, 143, -17, 137, -23, 131, -29, 125, -35, 119, -41, 113, -47, 107, -53, 101, -59, 95, -65, 89, -71, 83, -77],
[-1, 155, -3, 153, -5, 151, -7, 149, -9, 147, -11, 145, -13, 143, -15, 141, -17, 139, -19, 137, -21, 135, -23, 133, -25, 131, -27, 129, -29, 127, -31, 125, -33, 123, -35, 121, -37, 119, -39, 117, -41, 115, -43, 113, -45, 111, -47, 109, -49, 107, -51, 105, -53, 103, -55, 101, -57, 99, -59, 97, -61, 95, -63, 93, -65, 91, -67, 89, -69, 87, -71, 85, -73, 83, -75, 81, -77, 79]]
def B : List (List Int) := [
[2553906188254829543212, -1524592497216679000804, -6927535611059880514617, -16408974313469721811632, 2571962813907785451281, -4166928609773575635871, -17730959267025031269081, 23164904371279913020784, -12272522047918828755458, -21432164971901850370552, -3339861953383178666238, -11040648330021995683313, -18555128753209653075982, -1729709699031587370878, -16421422924068763179911, -3407303611902536 -- (+1600 chars; full line in the Zenodo source)
[-1524592497216679000804, -16408974313469721811632, -4166928609773575635871, 23164904371279913020784, -21432164971901850370552, -11040648330021995683313, -1729709699031587370878, -34073036119025362033173, -1707187409905396318464, -11519773888842327837181, -32599633517952869833194, -21934804727710012936384, -11720966159308555120836, -18465544875452979429884, -16688445727135840993253, -83098850447 -- (+1565 chars; full line in the Zenodo source)
[-6927535611059880514617, -4166928609773575635871, -12272522047918828755458, -11040648330021995683313, -16421422924068763179911, -1707187409905396318464, -11423379777238926760109, -21934804727710012936384, -31697560599394304842057, -16688445727135840993253, -33762359593847987882407, -9724473375635732864557, -41195585478843911651823, -21757469305706328274142, -45886786577137613902384, 38553918511 -- (+1576 chars; full line in the Zenodo source)
[-16408974313469721811632, 23164904371279913020784, -11040648330021995683313, -34073036119025362033173, -11519773888842327837181, -21934804727710012936384, -18465544875452979429884, -8309885044794018530174, -9724473375635732864557, -28436957034015528520928, -11404200285858808840357, 385539185115984732238, -28579016945523890040958, -8753337349101898504262, 13334727259719272583911, -20992053777972 -- (+1570 chars; full line in the Zenodo source)
[2571962813907785451281, -21432164971901850370552, -16421422924068763179911, -11519773888842327837181, -35574690154424089548247, -16688445727135840993253, -27818527752634453222248, -28436957034015528520928, -45886786577137613902384, -844603007113852664711, -46433063677889978865704, 13334727259719272583911, -27437701433911425267736, -5753213183013071365969, -7574493701686873254853, 19123679449274 -- (+1571 chars; full line in the Zenodo source)
[-4166928609773575635871, -11040648330021995683313, -1707187409905396318464, -21934804727710012936384, -16688445727135840993253, -9724473375635732864557, -21757469305706328274142, 385539185115984732238, -16607517913939078909791, 13334727259719272583911, 5703811652976159722889, -6773661402548588389446, 27677245562451713138646, 19701097779482969932279, 46928853235749686204173, 28825066918228139914 -- (+1569 chars; full line in the Zenodo source)
[-17730959267025031269081, -1729709699031587370878, -11423379777238926760109, -18465544875452979429884, -27818527752634453222248, -21757469305706328274142, -49182628892366998683212, -8753337349101898504262, -13847457839306743658611, -5753213183013071365969, -19123679449274737467791, 19701097779482969932279, -5703811652976159722889, 37948235109869389090609, 28579016945523890040958, 45886786577137 -- (+1571 chars; full line in the Zenodo source)
[23164904371279913020784, -34073036119025362033173, -21934804727710012936384, -8309885044794018530174, -28436957034015528520928, 385539185115984732238, -8753337349101898504262, -20992053777972898112062, -6773661402548588389446, 19123679449274737467791, 27121734646232047004224, 28825066918228139914669, 41415745702142412670791, 45886786577137613902384, 45667320892217181175508, 36859613149784955706 -- (+1571 chars; full line in the Zenodo source)
[-12272522047918828755458, -1707187409905396318464, -31697560599394304842057, -9724473375635732864557, -45886786577137613902384, -16607517913939078909791, -13847457839306743658611, -6773661402548588389446, 5222012906066789638322, 46928853235749686204173, 19748084822974117529347, 49182628892366998683212, 28436957034015528520928, 43674591680960852834707, 32599633517952869833194, 185551287532096530 -- (+1572 chars; full line in the Zenodo source)
[-21432164971901850370552, -11519773888842327837181, -16688445727135840993253, -28436957034015528520928, -844603007113852664711, 13334727259719272583911, -5753213183013071365969, 19123679449274737467791, 46928853235749686204173, 21710813329151765282377, 42679356139344025563393, 45667320892217181175508, 31697560599394304842057, 27744266150183360295833, 17730959267025031269081, -692753561105988051 -- (+1574 chars; full line in the Zenodo source)
[-3339861953383178666238, -32599633517952869833194, -33762359593847987882407, -11404200285858808840357, -46433063677889978865704, 5703811652976159722889, -19123679449274737467791, 27121734646232047004224, 19748084822974117529347, 42679356139344025563393, 9724473375635732864557, 35574690154424089548247, 1729709699031587370878, 6927535611059880514617, 23164904371279913020784, -36727703133798939449 -- (+1570 chars; full line in the Zenodo source)
[-11040648330021995683313, -21934804727710012936384, -9724473375635732864557, 385539185115984732238, 13334727259719272583911, -6773661402548588389446, 19701097779482969932279, 28825066918228139914669, 49182628892366998683212, 45667320892217181175508, 35574690154424089548247, 18555128753209653075982, -2553906188254829543212, -3339861953383178666238, -29895314569722469726321, -27818527752634453222 -- (+1568 chars; full line in the Zenodo source)
[-18555128753209653075982, -11720966159308555120836, -41195585478843911651823, -28579016945523890040958, -27437701433911425267736, 27677245562451713138646, -5703811652976159722889, 41415745702142412670791, 28436957034015528520928, 31697560599394304842057, 1729709699031587370878, -2553906188254829543212, -11040648330021995683313, -35574690154424089548247, -4491933320481482155334, -250389659447494 -- (+1572 chars; full line in the Zenodo source)
[-1729709699031587370878, -18465544875452979429884, -21757469305706328274142, -8753337349101898504262, -5753213183013071365969, 19701097779482969932279, 37948235109869389090609, 45886786577137613902384, 43674591680960852834707, 27744266150183360295833, 6927535611059880514617, -3339861953383178666238, -35574690154424089548247, -41195585478843911651823, -41415745702142412670791, -46928853235749686 -- (+1570 chars; full line in the Zenodo source)
[-16421422924068763179911, -16688445727135840993253, -45886786577137613902384, 13334727259719272583911, -7574493701686873254853, 46928853235749686204173, 28579016945523890040958, 45667320892217181175508, 32599633517952869833194, 17730959267025031269081, 23164904371279913020784, -29895314569722469726321, -4491933320481482155334, -41415745702142412670791, 19417370301501885295833, -2040426419541149 -- (+1571 chars; full line in the Zenodo source)
[-34073036119025362033173, -8309885044794018530174, 385539185115984732238, -20992053777972898112062, 19123679449274737467791, 28825066918228139914669, 45886786577137613902384, 36859613149784955706779, 18555128753209653075982, -6927535611059880514617, -36727703133798939449983, -27818527752634453222248, -25038965944749460662417, -46928853235749686204173, -20404264195411496896386, 19748084822974117 -- (+1570 chars; full line in the Zenodo source)
[-27744266150183360295833, -39824589721566825890054, -25038965944749460662417, 19417370301501885295833, 6773661402548588389446, 46433063677889978865704, 4491933320481482155334, 11423379777238926760109, 16408974313469721811632, -18555128753209653075982, -16688445727135840993253, -42679356139344025563393, -20992053777972898112062, 5222012906066789638322, 37948235109869389090609, 217574693057063282 -- (+1568 chars; full line in the Zenodo source)
[-1707187409905396318464, -9724473375635732864557, -16607517913939078909791, -6773661402548588389446, 46928853235749686204173, 49182628892366998683212, 43674591680960852834707, 18555128753209653075982, 2571962813907785451281, -29895314569722469726321, -46377604226583546387359, -37948235109869389090609, -19123679449274737467791, 2687537616444085188466, 11404200285858808840357, 1172096615930855512 -- (+1571 chars; full line in the Zenodo source)
[-36727703133798939449983, -4491933320481482155334, -21710813329151765282377, -5222012906066789638322, 2687537616444085188466, 35033046157765255595989, 21934804727710012936384, -2571962813907785451281, -1729709699031587370878, -33762359593847987882407, -28579016945523890040958, -20112488389824358564968, 46928853235749686204173, -385539185115984732238, 36859613149784955706779, 2143216497190185037 -- (+1572 chars; full line in the Zenodo source)
[-11519773888842327837181, -28436957034015528520928, 13334727259719272583911, 19123679449274737467791, 21710813329151765282377, 45667320892217181175508, 27744266150183360295833, -6927535611059880514617, -29895314569722469726321, -35033046157765255595989, -13847457839306743658611, -20404264195411496896386, 16607517913939078909791, 39824589721566825890054, 1729709699031587370878, -4166928609773575 -- (+1571 chars; full line in the Zenodo source)
[-11423379777238926760109, -21757469305706328274142, -13847457839306743658611, 19701097779482969932279, 28579016945523890040958, 43674591680960852834707, 21432164971901850370552, -3339861953383178666238, -8309885044794018530174, -41415745702142412670791, 20404264195411496896386, 2687537616444085188466, 46377604226583546387359, 11519773888842327837181, 2553906188254829543212, -3259963351795286983 -- (+1571 chars; full line in the Zenodo source)
[-32599633517952869833194, -11404200285858808840357, 5703811652976159722889, 27121734646232047004224, 42679356139344025563393, 35574690154424089548247, 6927535611059880514617, -36727703133798939449983, -46377604226583546387359, -13847457839306743658611, 6773661402548588389446, 844603007113852664711, 18465544875452979429884, 4166928609773575635871, -34073036119025362033173, -449193332048148215533 -- (+1569 chars; full line in the Zenodo source)
[-29895314569722469726321, -23345335881701202775173, -27121734646232047004224, 27437701433911425267736, 21757469305706328274142, 36727703133798939449983, -16408974313469721811632, -31697560599394304842057, -844603007113852664711, -19701097779482969932279, 28825066918228139914669, 4491933320481482155334, 16421422924068763179911, 23164904371279913020784, -43674591680960852834707, -1660751791393907 -- (+1569 chars; full line in the Zenodo source)
[-21934804727710012936384, 385539185115984732238, -6773661402548588389446, 28825066918228139914669, 45667320892217181175508, 18555128753209653075982, -3339861953383178666238, -27818527752634453222248, -37948235109869389090609, -20404264195411496896386, 844603007113852664711, 11720966159308555120836, 1524592497216679000804, -32599633517952869833194, -23345335881701202775173, -57532131830130713659 -- (+1569 chars; full line in the Zenodo source)
[-35574690154424089548247, -844603007113852664711, -7574493701686873254853, 21710813329151765282377, 8309885044794018530174, 17730959267025031269081, -1707187409905396318464, -35033046157765255595989, 19417370301501885295833, 20992053777972898112062, 41195585478843911651823, 1729709699031587370878, -3339861953383178666238, -9724473375635732864557, -28825066918228139914669, 2011248838982435856496 -- (+1568 chars; full line in the Zenodo source)
[-11720966159308555120836, -28579016945523890040958, 27677245562451713138646, 41415745702142412670791, 31697560599394304842057, -2553906188254829543212, -35574690154424089548247, -25038965944749460662417, -19123679449274737467791, 16607517913939078909791, 18465544875452979429884, 1524592497216679000804, -21934804727710012936384, -844603007113852664711, -5222012906066789638322, 464330636778899788 -- (+1569 chars; full line in the Zenodo source)
[-31697560599394304842057, -16607517913939078909791, 5222012906066789638322, 49182628892366998683212, 32599633517952869833194, 2571962813907785451281, -8309885044794018530174, -37948235109869389090609, 20112488389824358564968, 11404200285858808840357, 27744266150183360295833, -21432164971901850370552, -45667320892217181175508, -20992053777972898112062, -5703811652976159722889, 411955854788439116 -- (+1570 chars; full line in the Zenodo source)
[-18465544875452979429884, -8753337349101898504262, 19701097779482969932279, 45886786577137613902384, 27744266150183360295833, -3339861953383178666238, -41195585478843911651823, -46928853235749686204173, 2687537616444085188466, 39824589721566825890054, 4166928609773575635871, -32599633517952869833194, -844603007113852664711, 27677245562451713138646, 25038965944749460662417, 298953145697224697263 -- (+1569 chars; full line in the Zenodo source)
[-36859613149784955706779, -19748084822974117529347, 5753213183013071365969, 46377604226583546387359, 11040648330021995683313, -27744266150183360295833, -23345335881701202775173, -7574493701686873254853, 41415745702142412670791, 21934804727710012936384, 2571962813907785451281, -39824589721566825890054, -13847457839306743658611, 27437701433911425267736, 9724473375635732864557, 1773095926702503126 -- (+1569 chars; full line in the Zenodo source)
[-16688445727135840993253, 13334727259719272583911, 46928853235749686204173, 45667320892217181175508, 17730959267025031269081, -29895314569722469726321, -41415745702142412670791, -20404264195411496896386, 11404200285858808840357, 1729709699031587370878, -34073036119025362033173, -23345335881701202775173, -5222012906066789638322, 25038965944749460662417, 11423379777238926760109, -1227252204791882 -- (+1570 chars; full line in the Zenodo source)
[-43674591680960852834707, -2687537616444085188466, 20992053777972898112062, 33762359593847987882407, 1524592497216679000804, -36859613149784955706779, 13334727259719272583911, -5703811652976159722889, 27818527752634453222248, 16408974313469721811632, -31697560599394304842057, -19748084822974117529347, -19417370301501885295833, 45667320892217181175508, 4166928609773575635871, -355746901544240895 -- (+1572 chars; full line in the Zenodo source)
[-8309885044794018530174, -20992053777972898112062, 28825066918228139914669, 36859613149784955706779, -6927535611059880514617, -27818527752634453222248, -46928853235749686204173, 19748084822974117529347, 11720966159308555120836, -4166928609773575635871, -4491933320481482155334, -5753213183013071365969, 46433063677889978865704, 29895314569722469726321, -12272522047918828755458, -46377604226583546 -- (+1575 chars; full line in the Zenodo source)
[-33762359593847987882407, 5703811652976159722889, 19748084822974117529347, 35574690154424089548247, 23164904371279913020784, -46377604226583546387359, 20404264195411496896386, 844603007113852664711, 27744266150183360295833, -34073036119025362033173, -49182628892366998683212, 7574493701686873254853, 21757469305706328274142, 12272522047918828755458, -21934804727710012936384, -21710813329151765282 -- (+1568 chars; full line in the Zenodo source)
[-39824589721566825890054, 19417370301501885295833, 46433063677889978865704, 11423379777238926760109, -18555128753209653075982, -42679356139344025563393, 5222012906066789638322, 21757469305706328274142, -23164904371279913020784, -11720966159308555120836, 13334727259719272583911, 13847457839306743658611, 36859613149784955706779, 2571962813907785451281, -41195585478843911651823, -19701097779482969 -- (+1571 chars; full line in the Zenodo source)
[-27818527752634453222248, -5753213183013071365969, 28579016945523890040958, 27744266150183360295833, -1707187409905396318464, -41415745702142412670791, 27121734646232047004224, 39824589721566825890054, 2553906188254829543212, -9724473375635732864557, -20112488389824358564968, 25038965944749460662417, 34073036119025362033173, -36727703133798939449983, -16607517913939078909791, -19417370301501885 -- (+1572 chars; full line in the Zenodo source)
[-9724473375635732864557, -6773661402548588389446, 49182628892366998683212, 18555128753209653075982, -29895314569722469726321, -37948235109869389090609, 2687537616444085188466, 11720966159308555120836, -21432164971901850370552, -23345335881701202775173, 7574493701686873254853, 41195585478843911651823, 6927535611059880514617, -33762359593847987882407, -27121734646232047004224, 2857901694552389004 -- (+1570 chars; full line in the Zenodo source)
[-45667320892217181175508, 20404264195411496896386, 23345335881701202775173, 12272522047918828755458, -18465544875452979429884, -27437701433911425267736, 46433063677889978865704, 1707187409905396318464, -36727703133798939449983, -8753337349101898504262, 20992053777972898112062, 31697560599394304842057, -21432164971901850370552, -42679356139344025563393, 19701097779482969932279, 97244733756357328 -- (+1568 chars; full line in the Zenodo source)
[-4491933320481482155334, -5222012906066789638322, 35033046157765255595989, -2571962813907785451281, -33762359593847987882407, -20112488389824358564968, -385539185115984732238, 21432164971901850370552, -18465544875452979429884, 5703811652976159722889, 41415745702142412670791, 16421422924068763179911, -29895314569722469726321, -28825066918228139914669, 19748084822974117529347, 1151977388884232783 -- (+1571 chars; full line in the Zenodo source)
[-41195585478843911651823, 27677245562451713138646, 28436957034015528520928, -2553906188254829543212, -4491933320481482155334, -19123679449274737467791, 46377604226583546387359, 1524592497216679000804, -45667320892217181175508, -5222012906066789638322, 21757469305706328274142, 6927535611059880514617, -9724473375635732864557, -7574493701686873254853, 35033046157765255595989, 164089743134697218116 -- (+1570 chars; full line in the Zenodo source)
[-28436957034015528520928, 19123679449274737467791, 45667320892217181175508, -6927535611059880514617, -35033046157765255595989, -20404264195411496896386, 39824589721566825890054, -4166928609773575635871, -23345335881701202775173, 20112488389824358564968, 43674591680960852834707, -12272522047918828755458, -49182628892366998683212, -19417370301501885295833, 18465544875452979429884, -11040648330021 -- (+1572 chars; full line in the Zenodo source)
[-46377604226583546387359, 7574493701686873254853, 39824589721566825890054, -17730959267025031269081, 385539185115984732238, -19417370301501885295833, 31697560599394304842057, -1729709699031587370878, -46433063677889978865704, 28825066918228139914669, 11519773888842327837181, -11423379777238926760109, -2687537616444085188466, 16607517913939078909791, 18555128753209653075982, -1846554487545297942 -- (+1573 chars; full line in the Zenodo source)
[-21757469305706328274142, 19701097779482969932279, 43674591680960852834707, -3339861953383178666238, -41415745702142412670791, 2687537616444085188466, 11519773888842327837181, -32599633517952869833194, -20992053777972898112062, 25038965944749460662417, 12272522047918828755458, -33762359593847987882407, -7574493701686873254853, 28436957034015528520928, -1524592497216679000804, -11404200285858808 -- (+1570 chars; full line in the Zenodo source)
[-35033046157765255595989, 20112488389824358564968, 18465544875452979429884, -16421422924068763179911, -19748084822974117529347, 8753337349101898504262, 18555128753209653075982, -16688445727135840993253, -19701097779482969932279, 46377604226583546387359, -1524592497216679000804, -45886786577137613902384, 27121734646232047004224, 11720966159308555120836, -27744266150183360295833, 1333472725971927 -- (+1571 chars; full line in the Zenodo source)
[-11404200285858808840357, 27121734646232047004224, 35574690154424089548247, -36727703133798939449983, -13847457839306743658611, 844603007113852664711, 4166928609773575635871, -4491933320481482155334, 7574493701686873254853, 43674591680960852834707, -18555128753209653075982, -21710813329151765282377, 8753337349101898504262, 11040648330021995683313, -8309885044794018530174, -522201290606678963832 -- (+1574 chars; full line in the Zenodo source)
[-45886786577137613902384, 46928853235749686204173, 32599633517952869833194, -29895314569722469726321, 19417370301501885295833, 11404200285858808840357, 2553906188254829543212, -23345335881701202775173, -5703811652976159722889, 11423379777238926760109, -21934804727710012936384, -27121734646232047004224, 35033046157765255595989, -1524592497216679000804, -42679356139344025563393, 27437701433911425 -- (+1571 chars; full line in the Zenodo source)
[-23345335881701202775173, 27437701433911425267736, 36727703133798939449983, -31697560599394304842057, -19701097779482969932279, 4491933320481482155334, 23164904371279913020784, -16607517913939078909791, 21710813329151765282377, 3339861953383178666238, -27818527752634453222248, 5222012906066789638322, 16688445727135840993253, -34073036119025362033173, -2687537616444085188466, 4918262889236699868 -- (+1570 chars; full line in the Zenodo source)
[-42679356139344025563393, 13847457839306743658611, 34073036119025362033173, -43674591680960852834707, 27677245562451713138646, 8309885044794018530174, -16421422924068763179911, -2687537616444085188466, -385539185115984732238, -2553906188254829543212, -23345335881701202775173, 20992053777972898112062, 27744266150183360295833, -16688445727135840993253, -19123679449274737467791, 337623595938479878 -- (+1572 chars; full line in the Zenodo source)
[385539185115984732238, 28825066918228139914669, 18555128753209653075982, -27818527752634453222248, -20404264195411496896386, 11720966159308555120836, -32599633517952869833194, -5753213183013071365969, 41195585478843911651823, -12272522047918828755458, -21710813329151765282377, 28579016945523890040958, 16408974313469721811632, -11404200285858808840357, 27437701433911425267736, 277442661501833602 -- (+1570 chars; full line in the Zenodo source)
[-49182628892366998683212, 37948235109869389090609, 21432164971901850370552, -41195585478843911651823, 27121734646232047004224, 11519773888842327837181, -36859613149784955706779, 27677245562451713138646, 16688445727135840993253, -36727703133798939449983, 19417370301501885295833, 28436957034015528520928, -12272522047918828755458, -19748084822974117529347, 844603007113852664711, -25539061882548295 -- (+1566 chars; full line in the Zenodo source)
[-844603007113852664711, 21710813329151765282377, 17730959267025031269081, -35033046157765255595989, 20992053777972898112062, 1729709699031587370878, -9724473375635732864557, 20112488389824358564968, 11423379777238926760109, -36859613149784955706779, -27677245562451713138646, 18465544875452979429884, -32599633517952869833194, -6773661402548588389446, 27818527752634453222248, -1642142292406876317 -- (+1567 chars; full line in the Zenodo source)
[-25038965944749460662417, 46433063677889978865704, 16408974313469721811632, -42679356139344025563393, 37948235109869389090609, -23164904371279913020784, -35033046157765255595989, 13847457839306743658611, 11040648330021995683313, -41195585478843911651823, 46928853235749686204173, 34073036119025362033173, -27818527752634453222248, 20112488389824358564968, 11519773888842327837181, -436745916809608 -- (+1574 chars; full line in the Zenodo source)
[-28579016945523890040958, 41415745702142412670791, -2553906188254829543212, -25038965944749460662417, 16607517913939078909791, 1524592497216679000804, -844603007113852664711, 46433063677889978865704, 6927535611059880514617, -49182628892366998683212, 8753337349101898504262, 16408974313469721811632, 385539185115984732238, 21710813329151765282377, -2571962813907785451281, -42679356139344025563393, -- (+1564 chars; full line in the Zenodo source)
[-41415745702142412670791, 25038965944749460662417, -1524592497216679000804, -46433063677889978865704, 49182628892366998683212, -16408974313469721811632, -21710813329151765282377, 42679356139344025563393, -4166928609773575635871, -37948235109869389090609, 45886786577137613902384, 23164904371279913020784, -28825066918228139914669, 35033046157765255595989, -21432164971901850370552, -13847457839306 -- (+1575 chars; full line in the Zenodo source)
[-16607517913939078909791, 49182628892366998683212, 2571962813907785451281, -37948235109869389090609, 11404200285858808840357, -21432164971901850370552, -20992053777972898112062, 41195585478843911651823, -16421422924068763179911, -27121734646232047004224, 39824589721566825890054, -11519773888842327837181, 20404264195411496896386, 36859613149784955706779, -35574690154424089548247, -27677245562451 -- (+1571 chars; full line in the Zenodo source)
[-46433063677889978865704, 42679356139344025563393, 23164904371279913020784, -13847457839306743658611, 41195585478843911651823, -34073036119025362033173, -20112488389824358564968, 43674591680960852834707, -21934804727710012936384, -27677245562451713138646, 29895314569722469726321, -8309885044794018530174, 5753213183013071365969, 16421422924068763179911, -28436957034015528520928, 2687537616444085 -- (+1569 chars; full line in the Zenodo source)
[-8753337349101898504262, 45886786577137613902384, -3339861953383178666238, -46928853235749686204173, 39824589721566825890054, -32599633517952869833194, 27677245562451713138646, 29895314569722469726321, -33762359593847987882407, -19417370301501885295833, 11040648330021995683313, -11404200285858808840357, 21710813329151765282377, -2553906188254829543212, -46433063677889978865704, 2334533588170120 -- (+1572 chars; full line in the Zenodo source)
[-21710813329151765282377, 35033046157765255595989, -1729709699031587370878, -20112488389824358564968, 36859613149784955706779, -18465544875452979429884, 6773661402548588389446, 16421422924068763179911, -21757469305706328274142, 19748084822974117529347, -2553906188254829543212, -8753337349101898504262, 11404200285858808840357, -18555128753209653075982, -5753213183013071365969, 166884457271358409 -- (+1570 chars; full line in the Zenodo source)
[-19748084822974117529347, 46377604226583546387359, -27744266150183360295833, -7574493701686873254853, 21934804727710012936384, -39824589721566825890054, 27437701433911425267736, 17730959267025031269081, -25038965944749460662417, -385539185115984732238, -21432164971901850370552, 19417370301501885295833, 43674591680960852834707, -31697560599394304842057, 6773661402548588389446, 172970969903158737 -- (+1572 chars; full line in the Zenodo source)
[-37948235109869389090609, 41195585478843911651823, -11519773888842327837181, -27677245562451713138646, 36727703133798939449983, -28436957034015528520928, 19748084822974117529347, 2553906188254829543212, 13334727259719272583911, 4491933320481482155334, -11423379777238926760109, 19123679449274737467791, 1707187409905396318464, -46377604226583546387359, 21710813329151765282377, -152459249721667900 -- (+1565 chars; full line in the Zenodo source)
[13334727259719272583911, 45667320892217181175508, -29895314569722469726321, -20404264195411496896386, 1729709699031587370878, -23345335881701202775173, 25038965944749460662417, -12272522047918828755458, -27121734646232047004224, 18465544875452979429884, -8309885044794018530174, 27437701433911425267736, -2571962813907785451281, -46433063677889978865704, 21757469305706328274142, -1707187409905396 -- (+1571 chars; full line in the Zenodo source)
[-28825066918228139914669, 27818527752634453222248, -11720966159308555120836, 5753213183013071365969, 12272522047918828755458, -28579016945523890040958, 11404200285858808840357, -27744266150183360295833, 27677245562451713138646, 1707187409905396318464, -35033046157765255595989, 41415745702142412670791, 23164904371279913020784, -27121734646232047004224, 31697560599394304842057, -39824589721566825 -- (+1565 chars; full line in the Zenodo source)
[-2687537616444085188466, 33762359593847987882407, -36859613149784955706779, -5703811652976159722889, 16408974313469721811632, -19748084822974117529347, 45667320892217181175508, -35574690154424089548247, 5753213183013071365969, -23164904371279913020784, -16607517913939078909791, 46377604226583546387359, -11423379777238926760109, -20404264195411496896386, 11040648330021995683313, -844603007113852 -- (+1573 chars; full line in the Zenodo source)
[-13847457839306743658611, 43674591680960852834707, -8309885044794018530174, 2687537616444085188466, 2553906188254829543212, -20992053777972898112062, 16688445727135840993253, -33762359593847987882407, 28825066918228139914669, -1524592497216679000804, -27437701433911425267736, 36859613149784955706779, -39824589721566825890054, -13334727259719272583911, -6927535611059880514617, 570381165297615972 -- (+1573 chars; full line in the Zenodo source)
[-20992053777972898112062, 36859613149784955706779, -27818527752634453222248, 19748084822974117529347, -4166928609773575635871, -5753213183013071365969, 29895314569722469726321, -46377604226583546387359, 28579016945523890040958, -11040648330021995683313, -5222012906066789638322, 27744266150183360295833, -42679356139344025563393, 23345335881701202775173, -1707187409905396318464, 75744937016868732 -- (+1568 chars; full line in the Zenodo source)
[-27437701433911425267736, 31697560599394304842057, -4491933320481482155334, 16607517913939078909791, -3339861953383178666238, -5222012906066789638322, 34073036119025362033173, -49182628892366998683212, 35033046157765255595989, -32599633517952869833194, 5753213183013071365969, -2571962813907785451281, 13334727259719272583911, 8309885044794018530174, -33762359593847987882407, 37948235109869389090 -- (+1571 chars; full line in the Zenodo source)
[5703811652976159722889, 35574690154424089548247, -46377604226583546387359, 844603007113852664711, -34073036119025362033173, 7574493701686873254853, 12272522047918828755458, -21710813329151765282377, 39824589721566825890054, -8309885044794018530174, 37948235109869389090609, -17730959267025031269081, -19701097779482969932279, 1707187409905396318464, 385539185115984732238, 35033046157765255595989, -- (+1567 chars; full line in the Zenodo source)
[-46928853235749686204173, 29895314569722469726321, -11404200285858808840357, 23345335881701202775173, -11423379777238926760109, 27121734646232047004224, 1524592497216679000804, -27437701433911425267736, 35574690154424089548247, -21757469305706328274142, -385539185115984732238, -36727703133798939449983, 20112488389824358564968, 16408974313469721811632, -13847457839306743658611, 31697560599394304 -- (+1570 chars; full line in the Zenodo source)
[19417370301501885295833, 11423379777238926760109, -42679356139344025563393, 21757469305706328274142, -11720966159308555120836, 13847457839306743658611, 2571962813907785451281, -19701097779482969932279, 34073036119025362033173, -28579016945523890040958, 45667320892217181175508, -43674591680960852834707, 19748084822974117529347, -21432164971901850370552, 27677245562451713138646, 33398619533831786 -- (+1570 chars; full line in the Zenodo source)
[-27121734646232047004224, 36727703133798939449983, -844603007113852664711, 4491933320481482155334, -43674591680960852834707, 21710813329151765282377, -11040648330021995683313, 5222012906066789638322, 17730959267025031269081, -2687537616444085188466, 11720966159308555120836, -35033046157765255595989, 45886786577137613902384, -21934804727710012936384, 20992053777972898112062, 25719628139077854512 -- (+1567 chars; full line in the Zenodo source)
[-5753213183013071365969, 27744266150183360295833, -41415745702142412670791, 39824589721566825890054, -9724473375635732864557, 25038965944749460662417, -36727703133798939449983, -19417370301501885295833, -1524592497216679000804, -6773661402548588389446, 16421422924068763179911, -46433063677889978865704, 8309885044794018530174, -4491933320481482155334, 49182628892366998683212, -114233797772389267 -- (+1571 chars; full line in the Zenodo source)
[-20112488389824358564968, 16421422924068763179911, -8753337349101898504262, 16688445727135840993253, -46377604226583546387359, 45886786577137613902384, -11720966159308555120836, -13334727259719272583911, -3339861953383178666238, 7574493701686873254853, 16408974313469721811632, -46928853235749686204173, 36727703133798939449983, -28579016945523890040958, 39824589721566825890054, -4566732089221718 -- (+1572 chars; full line in the Zenodo source)
[-6773661402548588389446, 18555128753209653075982, -37948235109869389090609, 11720966159308555120836, -23345335881701202775173, 41195585478843911651823, -33762359593847987882407, 28579016945523890040958, -11519773888842327837181, 27437701433911425267736, -17730959267025031269081, -27677245562451713138646, 4166928609773575635871, 5703811652976159722889, 36727703133798939449983, -41415745702142412 -- (+1565 chars; full line in the Zenodo source)
[-19701097779482969932279, 3339861953383178666238, -2687537616444085188466, 32599633517952869833194, -25038965944749460662417, 33762359593847987882407, -28436957034015528520928, 11404200285858808840357, -36859613149784955706779, 46433063677889978865704, -1707187409905396318464, -5703811652976159722889, -17730959267025031269081, 19123679449274737467791, 16408974313469721811632, -27121734646232047 -- (+1577 chars; full line in the Zenodo source)
[20404264195411496896386, 12272522047918828755458, -27437701433911425267736, 1707187409905396318464, -8753337349101898504262, 31697560599394304842057, -42679356139344025563393, 9724473375635732864557, -4491933320481482155334, 45886786577137613902384, -36859613149784955706779, 16607517913939078909791, -11519773888842327837181, 13847457839306743658611, -3339861953383178666238, 67736614025485883894 -- (+1571 chars; full line in the Zenodo source)
[-7574493701686873254853, 17730959267025031269081, 19417370301501885295833, 1729709699031587370878, -28825066918228139914669, 11423379777238926760109, -16607517913939078909791, 18465544875452979429884, -42679356139344025563393, 27818527752634453222248, -28436957034015528520928, 21757469305706328274142, -33762359593847987882407, 49182628892366998683212, -11720966159308555120836, 87533373491018985 -- (+1566 chars; full line in the Zenodo source)
[-5222012906066789638322, -2571962813907785451281, -20112488389824358564968, 21432164971901850370552, 5703811652976159722889, 16421422924068763179911, -28825066918228139914669, 11519773888842327837181, -8753337349101898504262, 35574690154424089548247, -25038965944749460662417, 16688445727135840993253, -23345335881701202775173, 27818527752634453222248, -46377604226583546387359, 284369570340155285 -- (+1570 chars; full line in the Zenodo source)
[-19123679449274737467791, 6927535611059880514617, 20404264195411496896386, 4166928609773575635871, -20112488389824358564968, 12272522047918828755458, 19417370301501885295833, 11040648330021995683313, -27437701433911425267736, 16421422924068763179911, -2687537616444085188466, 1707187409905396318464, -37948235109869389090609, 11423379777238926760109, -8753337349101898504262, 219348047277100129363 -- (+1571 chars; full line in the Zenodo source)
[27677245562451713138646, -2553906188254829543212, -19123679449274737467791, 1524592497216679000804, -5222012906066789638322, 6927535611059880514617, -7574493701686873254853, 16408974313469721811632, 20404264195411496896386, -2571962813907785451281, -19701097779482969932279, 4166928609773575635871, -6773661402548588389446, 17730959267025031269081, -20112488389824358564968, -231649043712799130207 -- (+1567 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 78).map (fun t => rowA (156 + 1) t (rng 1 78)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 78 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 78 B A = sid 112468655400803665534138490 78 := rfl
theorem d_ne : (112468655400803665534138490 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 78 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 78) (h0 : mv A g = zeros 78) : g = zeros 78 :=
kernel_zero 78 112468655400803665534138490 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 156 78 = true := rfl
/-- **Balanced ⇒ pairs for p = 157.** A list with entries in (0, 157) that is balanced for 1 ≤ t ≤ 78
has as many copies of x as of 157 − x for every 1 ≤ x ≤ 78 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 157)
(hb : ∀ t, 1 ≤ t → t < 1 + 78 → tsum 157 t c + tsum 157 t c = c.length * 157) :
(rng 1 78).all (fun x => Nat.beq (cnt x c) (cnt (157 - x) c)) = true :=
pairs_of_bal 156 78 112468655400803665534138490 d_ne A B len cert A_def delta c hr hb
end MailletCert157
#print axioms MailletCert157.A_def
#print axioms MailletCert157.len
#print axioms MailletCert157.cert
#print axioms MailletCert157.d_ne
#print axioms MailletCert157.kernel
#print axioms MailletCert157.delta
#print axioms MailletCert157.pairs
lean_all/hodge/MailletCert163.lean
/-
hodge/MailletCert163.lean — T41 (goals G849b, G849c): for p = 163 the 81 × 81 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 81)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 441491163384808559455646456668 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 163) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert163
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -19, -17, - -- (+34 chars; full line in the Zenodo source)
[-159, -155, -151, -147, -143, -139, -135, -131, -127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161],
[-157, -151, -145, -139, -133, -127, -121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, 143, 149, 155, 161, -159, -153, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -21, -15, - -- (+7 chars; full line in the Zenodo source)
[-155, -147, -139, -131, -123, -115, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125, 133, 141, 149, 157, -161, -153, -145, -137, -129, -121, -113, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127, 135, 143, 151, 159],
[-153, -143, -133, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, -159, -149, -139, -129, -119, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, 141, 151, 161, -155, -145, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, -25, -15, -5] -- (+1 chars; full line in the Zenodo source)
[-151, -139, -127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, 113, 125, 137, 149, 161, -153, -141, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, 135, 147, 159, -155, -143, -131, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145, 157],
[-149, -135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, 145, 159, -153, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, -157, -143, -129, -115, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, 123, 137, 151, -161, -147, -133, -119, -105, -91, -77, -63, -49, -35, -21, -7],
[-147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, 141, 157, -153, -137, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, -159, -143, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, 155],
[-145, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, 143, 161, -147, -129, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, 141, 159, -149, -131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, 139, 157, -151, -133, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, 137, 155, -153, -135, -117, -99, -81, -63, -45, -27, -9],
[-143, -123, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, 117, 137, 157, -149, -129, -109, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91, 111, 131, 151, -155, -135, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, 145, -161, -141, -121, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, 119, 139, 159, -147, -127, -107, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, 113, 133, 153],
[-141, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, 145, -159, -137, -115, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, 127, 149, -155, -133, -111, -89, -67, -45, -23, -1, 21, 43, 65, 87, 109, 131, 153, -151, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, 157, -147, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, 139, 161, -143, -121, -99, -77, -55, -33, -11],
[-139, -115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125, 149, -153, -129, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, 135, 159, -143, -119, -95, -71, -47, -23, 1, 25, 49, 73, 97, 121, 145, -157, -133, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, 131, 155, -147, -123, -99, -75, -51, -27, -3, 21, 45, 69, 93, 117, 141, -161, -137, -113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127, 151],
[-137, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, 149, -151, -125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, 161, -139, -113, -87, -61, -35, -9, 17, 43, 69, 95, 121, 147, -153, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, 159, -141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, -155, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, 157, -143, -117, -91, -65, -39, -13],
[-135, -107, -79, -51, -23, 5, 33, 61, 89, 117, 145, -153, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, 155, -143, -115, -87, -59, -31, -3, 25, 53, 81, 109, 137, -161, -133, -105, -77, -49, -21, 7, 35, 63, 91, 119, 147, -151, -123, -95, -67, -39, -11, 17, 45, 73, 101, 129, 157, -141, -113, -85, -57, -29, -1, 27, 55, 83, 111, 139, -159, -131, -103, -75, -47, -19, 9, 37, 65, 93, 121, 149],
[-133, -103, -73, -43, -13, 17, 47, 77, 107, 137, -159, -129, -99, -69, -39, -9, 21, 51, 81, 111, 141, -155, -125, -95, -65, -35, -5, 25, 55, 85, 115, 145, -151, -121, -91, -61, -31, -1, 29, 59, 89, 119, 149, -147, -117, -87, -57, -27, 3, 33, 63, 93, 123, 153, -143, -113, -83, -53, -23, 7, 37, 67, 97, 127, 157, -139, -109, -79, -49, -19, 11, 41, 71, 101, 131, 161, -135, -105, -75, -45, -15],
[-131, -99, -67, -35, -3, 29, 61, 93, 125, 157, -137, -105, -73, -41, -9, 23, 55, 87, 119, 151, -143, -111, -79, -47, -15, 17, 49, 81, 113, 145, -149, -117, -85, -53, -21, 11, 43, 75, 107, 139, -155, -123, -91, -59, -27, 5, 37, 69, 101, 133, -161, -129, -97, -65, -33, -1, 31, 63, 95, 127, 159, -135, -103, -71, -39, -7, 25, 57, 89, 121, 153, -141, -109, -77, -45, -13, 19, 51, 83, 115, 147],
[-129, -95, -61, -27, 7, 41, 75, 109, 143, -149, -115, -81, -47, -13, 21, 55, 89, 123, 157, -135, -101, -67, -33, 1, 35, 69, 103, 137, -155, -121, -87, -53, -19, 15, 49, 83, 117, 151, -141, -107, -73, -39, -5, 29, 63, 97, 131, -161, -127, -93, -59, -25, 9, 43, 77, 111, 145, -147, -113, -79, -45, -11, 23, 57, 91, 125, 159, -133, -99, -65, -31, 3, 37, 71, 105, 139, -153, -119, -85, -51, -17],
[-127, -91, -55, -19, 17, 53, 89, 125, 161, -129, -93, -57, -21, 15, 51, 87, 123, 159, -131, -95, -59, -23, 13, 49, 85, 121, 157, -133, -97, -61, -25, 11, 47, 83, 119, 155, -135, -99, -63, -27, 9, 45, 81, 117, 153, -137, -101, -65, -29, 7, 43, 79, 115, 151, -139, -103, -67, -31, 5, 41, 77, 113, 149, -141, -105, -69, -33, 3, 39, 75, 111, 147, -143, -107, -71, -35, 1, 37, 73, 109, 145],
[-125, -87, -49, -11, 27, 65, 103, 141, -147, -109, -71, -33, 5, 43, 81, 119, 157, -131, -93, -55, -17, 21, 59, 97, 135, -153, -115, -77, -39, -1, 37, 75, 113, 151, -137, -99, -61, -23, 15, 53, 91, 129, -159, -121, -83, -45, -7, 31, 69, 107, 145, -143, -105, -67, -29, 9, 47, 85, 123, 161, -127, -89, -51, -13, 25, 63, 101, 139, -149, -111, -73, -35, 3, 41, 79, 117, 155, -133, -95, -57, -19],
[-123, -83, -43, -3, 37, 77, 117, 157, -129, -89, -49, -9, 31, 71, 111, 151, -135, -95, -55, -15, 25, 65, 105, 145, -141, -101, -61, -21, 19, 59, 99, 139, -147, -107, -67, -27, 13, 53, 93, 133, -153, -113, -73, -33, 7, 47, 87, 127, -159, -119, -79, -39, 1, 41, 81, 121, 161, -125, -85, -45, -5, 35, 75, 115, 155, -131, -91, -51, -11, 29, 69, 109, 149, -137, -97, -57, -17, 23, 63, 103, 143],
[-121, -79, -37, 5, 47, 89, 131, -153, -111, -69, -27, 15, 57, 99, 141, -143, -101, -59, -17, 25, 67, 109, 151, -133, -91, -49, -7, 35, 77, 119, 161, -123, -81, -39, 3, 45, 87, 129, -155, -113, -71, -29, 13, 55, 97, 139, -145, -103, -61, -19, 23, 65, 107, 149, -135, -93, -51, -9, 33, 75, 117, 159, -125, -83, -41, 1, 43, 85, 127, -157, -115, -73, -31, 11, 53, 95, 137, -147, -105, -63, -21],
[-119, -75, -31, 13, 57, 101, 145, -137, -93, -49, -5, 39, 83, 127, -155, -111, -67, -23, 21, 65, 109, 153, -129, -85, -41, 3, 47, 91, 135, -147, -103, -59, -15, 29, 73, 117, 161, -121, -77, -33, 11, 55, 99, 143, -139, -95, -51, -7, 37, 81, 125, -157, -113, -69, -25, 19, 63, 107, 151, -131, -87, -43, 1, 45, 89, 133, -149, -105, -61, -17, 27, 71, 115, 159, -123, -79, -35, 9, 53, 97, 141],
[-117, -71, -25, 21, 67, 113, 159, -121, -75, -29, 17, 63, 109, 155, -125, -79, -33, 13, 59, 105, 151, -129, -83, -37, 9, 55, 101, 147, -133, -87, -41, 5, 51, 97, 143, -137, -91, -45, 1, 47, 93, 139, -141, -95, -49, -3, 43, 89, 135, -145, -99, -53, -7, 39, 85, 131, -149, -103, -57, -11, 35, 81, 127, -153, -107, -61, -15, 31, 77, 123, -157, -111, -65, -19, 27, 73, 119, -161, -115, -69, -23],
[-115, -67, -19, 29, 77, 125, -153, -105, -57, -9, 39, 87, 135, -143, -95, -47, 1, 49, 97, 145, -133, -85, -37, 11, 59, 107, 155, -123, -75, -27, 21, 69, 117, -161, -113, -65, -17, 31, 79, 127, -151, -103, -55, -7, 41, 89, 137, -141, -93, -45, 3, 51, 99, 147, -131, -83, -35, 13, 61, 109, 157, -121, -73, -25, 23, 71, 119, -159, -111, -63, -15, 33, 81, 129, -149, -101, -53, -5, 43, 91, 139],
[-113, -63, -13, 37, 87, 137, -139, -89, -39, 11, 61, 111, 161, -115, -65, -15, 35, 85, 135, -141, -91, -41, 9, 59, 109, 159, -117, -67, -17, 33, 83, 133, -143, -93, -43, 7, 57, 107, 157, -119, -69, -19, 31, 81, 131, -145, -95, -45, 5, 55, 105, 155, -121, -71, -21, 29, 79, 129, -147, -97, -47, 3, 53, 103, 153, -123, -73, -23, 27, 77, 127, -149, -99, -49, 1, 51, 101, 151, -125, -75, -25],
[-111, -59, -7, 45, 97, 149, -125, -73, -21, 31, 83, 135, -139, -87, -35, 17, 69, 121, -153, -101, -49, 3, 55, 107, 159, -115, -63, -11, 41, 93, 145, -129, -77, -25, 27, 79, 131, -143, -91, -39, 13, 65, 117, -157, -105, -53, -1, 51, 103, 155, -119, -67, -15, 37, 89, 141, -133, -81, -29, 23, 75, 127, -147, -95, -43, 9, 61, 113, -161, -109, -57, -5, 47, 99, 151, -123, -71, -19, 33, 85, 137],
[-109, -55, -1, 53, 107, 161, -111, -57, -3, 51, 105, 159, -113, -59, -5, 49, 103, 157, -115, -61, -7, 47, 101, 155, -117, -63, -9, 45, 99, 153, -119, -65, -11, 43, 97, 151, -121, -67, -13, 41, 95, 149, -123, -69, -15, 39, 93, 147, -125, -71, -17, 37, 91, 145, -127, -73, -19, 35, 89, 143, -129, -75, -21, 33, 87, 141, -131, -77, -23, 31, 85, 139, -133, -79, -25, 29, 83, 137, -135, -81, -27],
[-107, -51, 5, 61, 117, -153, -97, -41, 15, 71, 127, -143, -87, -31, 25, 81, 137, -133, -77, -21, 35, 91, 147, -123, -67, -11, 45, 101, 157, -113, -57, -1, 55, 111, -159, -103, -47, 9, 65, 121, -149, -93, -37, 19, 75, 131, -139, -83, -27, 29, 85, 141, -129, -73, -17, 39, 95, 151, -119, -63, -7, 49, 105, 161, -109, -53, 3, 59, 115, -155, -99, -43, 13, 69, 125, -145, -89, -33, 23, 79, 135],
[-105, -47, 11, 69, 127, -141, -83, -25, 33, 91, 149, -119, -61, -3, 55, 113, -155, -97, -39, 19, 77, 135, -133, -75, -17, 41, 99, 157, -111, -53, 5, 63, 121, -147, -89, -31, 27, 85, 143, -125, -67, -9, 49, 107, -161, -103, -45, 13, 71, 129, -139, -81, -23, 35, 93, 151, -117, -59, -1, 57, 115, -153, -95, -37, 21, 79, 137, -131, -73, -15, 43, 101, 159, -109, -51, 7, 65, 123, -145, -87, -29],
[-103, -43, 17, 77, 137, -129, -69, -9, 51, 111, -155, -95, -35, 25, 85, 145, -121, -61, -1, 59, 119, -147, -87, -27, 33, 93, 153, -113, -53, 7, 67, 127, -139, -79, -19, 41, 101, 161, -105, -45, 15, 75, 135, -131, -71, -11, 49, 109, -157, -97, -37, 23, 83, 143, -123, -63, -3, 57, 117, -149, -89, -29, 31, 91, 151, -115, -55, 5, 65, 125, -141, -81, -21, 39, 99, 159, -107, -47, 13, 73, 133],
[-101, -39, 23, 85, 147, -117, -55, 7, 69, 131, -133, -71, -9, 53, 115, -149, -87, -25, 37, 99, 161, -103, -41, 21, 83, 145, -119, -57, 5, 67, 129, -135, -73, -11, 51, 113, -151, -89, -27, 35, 97, 159, -105, -43, 19, 81, 143, -121, -59, 3, 65, 127, -137, -75, -13, 49, 111, -153, -91, -29, 33, 95, 157, -107, -45, 17, 79, 141, -123, -61, 1, 63, 125, -139, -77, -15, 47, 109, -155, -93, -31],
[-99, -35, 29, 93, 157, -105, -41, 23, 87, 151, -111, -47, 17, 81, 145, -117, -53, 11, 75, 139, -123, -59, 5, 69, 133, -129, -65, -1, 63, 127, -135, -71, -7, 57, 121, -141, -77, -13, 51, 115, -147, -83, -19, 45, 109, -153, -89, -25, 39, 103, -159, -95, -31, 33, 97, 161, -101, -37, 27, 91, 155, -107, -43, 21, 85, 149, -113, -49, 15, 79, 143, -119, -55, 9, 73, 137, -125, -61, 3, 67, 131],
[-97, -31, 35, 101, -159, -93, -27, 39, 105, -155, -89, -23, 43, 109, -151, -85, -19, 47, 113, -147, -81, -15, 51, 117, -143, -77, -11, 55, 121, -139, -73, -7, 59, 125, -135, -69, -3, 63, 129, -131, -65, 1, 67, 133, -127, -61, 5, 71, 137, -123, -57, 9, 75, 141, -119, -53, 13, 79, 145, -115, -49, 17, 83, 149, -111, -45, 21, 87, 153, -107, -41, 25, 91, 157, -103, -37, 29, 95, 161, -99, -33],
[-95, -27, 41, 109, -149, -81, -13, 55, 123, -135, -67, 1, 69, 137, -121, -53, 15, 83, 151, -107, -39, 29, 97, -161, -93, -25, 43, 111, -147, -79, -11, 57, 125, -133, -65, 3, 71, 139, -119, -51, 17, 85, 153, -105, -37, 31, 99, -159, -91, -23, 45, 113, -145, -77, -9, 59, 127, -131, -63, 5, 73, 141, -117, -49, 19, 87, 155, -103, -35, 33, 101, -157, -89, -21, 47, 115, -143, -75, -7, 61, 129],
[-93, -23, 47, 117, -139, -69, 1, 71, 141, -115, -45, 25, 95, -161, -91, -21, 49, 119, -137, -67, 3, 73, 143, -113, -43, 27, 97, -159, -89, -19, 51, 121, -135, -65, 5, 75, 145, -111, -41, 29, 99, -157, -87, -17, 53, 123, -133, -63, 7, 77, 147, -109, -39, 31, 101, -155, -85, -15, 55, 125, -131, -61, 9, 79, 149, -107, -37, 33, 103, -153, -83, -13, 57, 127, -129, -59, 11, 81, 151, -105, -35],
[-91, -19, 53, 125, -129, -57, 15, 87, 159, -95, -23, 49, 121, -133, -61, 11, 83, 155, -99, -27, 45, 117, -137, -65, 7, 79, 151, -103, -31, 41, 113, -141, -69, 3, 75, 147, -107, -35, 37, 109, -145, -73, -1, 71, 143, -111, -39, 33, 105, -149, -77, -5, 67, 139, -115, -43, 29, 101, -153, -81, -9, 63, 135, -119, -47, 25, 97, -157, -85, -13, 59, 131, -123, -51, 21, 93, -161, -89, -17, 55, 127],
[-89, -15, 59, 133, -119, -45, 29, 103, -149, -75, -1, 73, 147, -105, -31, 43, 117, -135, -61, 13, 87, 161, -91, -17, 57, 131, -121, -47, 27, 101, -151, -77, -3, 71, 145, -107, -33, 41, 115, -137, -63, 11, 85, 159, -93, -19, 55, 129, -123, -49, 25, 99, -153, -79, -5, 69, 143, -109, -35, 39, 113, -139, -65, 9, 83, 157, -95, -21, 53, 127, -125, -51, 23, 97, -155, -81, -7, 67, 141, -111, -37],
[-87, -11, 65, 141, -109, -33, 43, 119, -131, -55, 21, 97, -153, -77, -1, 75, 151, -99, -23, 53, 129, -121, -45, 31, 107, -143, -67, 9, 85, 161, -89, -13, 63, 139, -111, -35, 41, 117, -133, -57, 19, 95, -155, -79, -3, 73, 149, -101, -25, 51, 127, -123, -47, 29, 105, -145, -69, 7, 83, 159, -91, -15, 61, 137, -113, -37, 39, 115, -135, -59, 17, 93, -157, -81, -5, 71, 147, -103, -27, 49, 125],
[-85, -7, 71, 149, -99, -21, 57, 135, -113, -35, 43, 121, -127, -49, 29, 107, -141, -63, 15, 93, -155, -77, 1, 79, 157, -91, -13, 65, 143, -105, -27, 51, 129, -119, -41, 37, 115, -133, -55, 23, 101, -147, -69, 9, 87, -161, -83, -5, 73, 151, -97, -19, 59, 137, -111, -33, 45, 123, -125, -47, 31, 109, -139, -61, 17, 95, -153, -75, 3, 81, 159, -89, -11, 67, 145, -103, -25, 53, 131, -117, -39],
[-83, -3, 77, 157, -89, -9, 71, 151, -95, -15, 65, 145, -101, -21, 59, 139, -107, -27, 53, 133, -113, -33, 47, 127, -119, -39, 41, 121, -125, -45, 35, 115, -131, -51, 29, 109, -137, -57, 23, 103, -143, -63, 17, 97, -149, -69, 11, 91, -155, -75, 5, 85, -161, -81, -1, 79, 159, -87, -7, 73, 153, -93, -13, 67, 147, -99, -19, 61, 141, -105, -25, 55, 135, -111, -31, 49, 129, -117, -37, 43, 123],
[-81, 1, 83, -161, -79, 3, 85, -159, -77, 5, 87, -157, -75, 7, 89, -155, -73, 9, 91, -153, -71, 11, 93, -151, -69, 13, 95, -149, -67, 15, 97, -147, -65, 17, 99, -145, -63, 19, 101, -143, -61, 21, 103, -141, -59, 23, 105, -139, -57, 25, 107, -137, -55, 27, 109, -135, -53, 29, 111, -133, -51, 31, 113, -131, -49, 33, 115, -129, -47, 35, 117, -127, -45, 37, 119, -125, -43, 39, 121, -123, -41],
[-79, 5, 89, -153, -69, 15, 99, -143, -59, 25, 109, -133, -49, 35, 119, -123, -39, 45, 129, -113, -29, 55, 139, -103, -19, 65, 149, -93, -9, 75, 159, -83, 1, 85, -157, -73, 11, 95, -147, -63, 21, 105, -137, -53, 31, 115, -127, -43, 41, 125, -117, -33, 51, 135, -107, -23, 61, 145, -97, -13, 71, 155, -87, -3, 81, -161, -77, 7, 91, -151, -67, 17, 101, -141, -57, 27, 111, -131, -47, 37, 121],
[-77, 9, 95, -145, -59, 27, 113, -127, -41, 45, 131, -109, -23, 63, 149, -91, -5, 81, -159, -73, 13, 99, -141, -55, 31, 117, -123, -37, 49, 135, -105, -19, 67, 153, -87, -1, 85, -155, -69, 17, 103, -137, -51, 35, 121, -119, -33, 53, 139, -101, -15, 71, 157, -83, 3, 89, -151, -65, 21, 107, -133, -47, 39, 125, -115, -29, 57, 143, -97, -11, 75, 161, -79, 7, 93, -147, -61, 25, 111, -129, -43],
[-75, 13, 101, -137, -49, 39, 127, -111, -23, 65, 153, -85, 3, 91, -147, -59, 29, 117, -121, -33, 55, 143, -95, -7, 81, -157, -69, 19, 107, -131, -43, 45, 133, -105, -17, 71, 159, -79, 9, 97, -141, -53, 35, 123, -115, -27, 61, 149, -89, -1, 87, -151, -63, 25, 113, -125, -37, 51, 139, -99, -11, 77, -161, -73, 15, 103, -135, -47, 41, 129, -109, -21, 67, 155, -83, 5, 93, -145, -57, 31, 119],
[-73, 17, 107, -129, -39, 51, 141, -95, -5, 85, -151, -61, 29, 119, -117, -27, 63, 153, -83, 7, 97, -139, -49, 41, 131, -105, -15, 75, -161, -71, 19, 109, -127, -37, 53, 143, -93, -3, 87, -149, -59, 31, 121, -115, -25, 65, 155, -81, 9, 99, -137, -47, 43, 133, -103, -13, 77, -159, -69, 21, 111, -125, -35, 55, 145, -91, -1, 89, -147, -57, 33, 123, -113, -23, 67, 157, -79, 11, 101, -135, -45],
[-71, 21, 113, -121, -29, 63, 155, -79, 13, 105, -129, -37, 55, 147, -87, 5, 97, -137, -45, 47, 139, -95, -3, 89, -145, -53, 39, 131, -103, -11, 81, -153, -61, 31, 123, -111, -19, 73, -161, -69, 23, 115, -119, -27, 65, 157, -77, 15, 107, -127, -35, 57, 149, -85, 7, 99, -135, -43, 49, 141, -93, -1, 91, -143, -51, 41, 133, -101, -9, 83, -151, -59, 33, 125, -109, -17, 75, -159, -67, 25, 117],
[-69, 25, 119, -113, -19, 75, -157, -63, 31, 125, -107, -13, 81, -151, -57, 37, 131, -101, -7, 87, -145, -51, 43, 137, -95, -1, 93, -139, -45, 49, 143, -89, 5, 99, -133, -39, 55, 149, -83, 11, 105, -127, -33, 61, 155, -77, 17, 111, -121, -27, 67, 161, -71, 23, 117, -115, -21, 73, -159, -65, 29, 123, -109, -15, 79, -153, -59, 35, 129, -103, -9, 85, -147, -53, 41, 135, -97, -3, 91, -141, -47],
[-67, 29, 125, -105, -9, 87, -143, -47, 49, 145, -85, 11, 107, -123, -27, 69, -161, -65, 31, 127, -103, -7, 89, -141, -45, 51, 147, -83, 13, 109, -121, -25, 71, -159, -63, 33, 129, -101, -5, 91, -139, -43, 53, 149, -81, 15, 111, -119, -23, 73, -157, -61, 35, 131, -99, -3, 93, -137, -41, 55, 151, -79, 17, 113, -117, -21, 75, -155, -59, 37, 133, -97, -1, 95, -135, -39, 57, 153, -77, 19, 115],
[-65, 33, 131, -97, 1, 99, -129, -31, 67, -161, -63, 35, 133, -95, 3, 101, -127, -29, 69, -159, -61, 37, 135, -93, 5, 103, -125, -27, 71, -157, -59, 39, 137, -91, 7, 105, -123, -25, 73, -155, -57, 41, 139, -89, 9, 107, -121, -23, 75, -153, -55, 43, 141, -87, 11, 109, -119, -21, 77, -151, -53, 45, 143, -85, 13, 111, -117, -19, 79, -149, -51, 47, 145, -83, 15, 113, -115, -17, 81, -147, -49],
[-63, 37, 137, -89, 11, 111, -115, -15, 85, -141, -41, 59, 159, -67, 33, 133, -93, 7, 107, -119, -19, 81, -145, -45, 55, 155, -71, 29, 129, -97, 3, 103, -123, -23, 77, -149, -49, 51, 151, -75, 25, 125, -101, -1, 99, -127, -27, 73, -153, -53, 47, 147, -79, 21, 121, -105, -5, 95, -131, -31, 69, -157, -57, 43, 143, -83, 17, 117, -109, -9, 91, -135, -35, 65, -161, -61, 39, 139, -87, 13, 113],
[-61, 41, 143, -81, 21, 123, -101, 1, 103, -121, -19, 83, -141, -39, 63, -161, -59, 43, 145, -79, 23, 125, -99, 3, 105, -119, -17, 85, -139, -37, 65, -159, -57, 45, 147, -77, 25, 127, -97, 5, 107, -117, -15, 87, -137, -35, 67, -157, -55, 47, 149, -75, 27, 129, -95, 7, 109, -115, -13, 89, -135, -33, 69, -155, -53, 49, 151, -73, 29, 131, -93, 9, 111, -113, -11, 91, -133, -31, 71, -153, -51],
[-59, 45, 149, -73, 31, 135, -87, 17, 121, -101, 3, 107, -115, -11, 93, -129, -25, 79, -143, -39, 65, -157, -53, 51, 155, -67, 37, 141, -81, 23, 127, -95, 9, 113, -109, -5, 99, -123, -19, 85, -137, -33, 71, -151, -47, 57, 161, -61, 43, 147, -75, 29, 133, -89, 15, 119, -103, 1, 105, -117, -13, 91, -131, -27, 77, -145, -41, 63, -159, -55, 49, 153, -69, 35, 139, -83, 21, 125, -97, 7, 111],
[-57, 49, 155, -65, 41, 147, -73, 33, 139, -81, 25, 131, -89, 17, 123, -97, 9, 115, -105, 1, 107, -113, -7, 99, -121, -15, 91, -129, -23, 83, -137, -31, 75, -145, -39, 67, -153, -47, 59, -161, -55, 51, 157, -63, 43, 149, -71, 35, 141, -79, 27, 133, -87, 19, 125, -95, 11, 117, -103, 3, 109, -111, -5, 101, -119, -13, 93, -127, -21, 85, -135, -29, 77, -143, -37, 69, -151, -45, 61, -159, -53],
[-55, 53, 161, -57, 51, 159, -59, 49, 157, -61, 47, 155, -63, 45, 153, -65, 43, 151, -67, 41, 149, -69, 39, 147, -71, 37, 145, -73, 35, 143, -75, 33, 141, -77, 31, 139, -79, 29, 137, -81, 27, 135, -83, 25, 133, -85, 23, 131, -87, 21, 129, -89, 19, 127, -91, 17, 125, -93, 15, 123, -95, 13, 121, -97, 11, 119, -99, 9, 117, -101, 7, 115, -103, 5, 113, -105, 3, 111, -107, 1, 109],
[-53, 57, -159, -49, 61, -155, -45, 65, -151, -41, 69, -147, -37, 73, -143, -33, 77, -139, -29, 81, -135, -25, 85, -131, -21, 89, -127, -17, 93, -123, -13, 97, -119, -9, 101, -115, -5, 105, -111, -1, 109, -107, 3, 113, -103, 7, 117, -99, 11, 121, -95, 15, 125, -91, 19, 129, -87, 23, 133, -83, 27, 137, -79, 31, 141, -75, 35, 145, -71, 39, 149, -67, 43, 153, -63, 47, 157, -59, 51, 161, -55],
[-51, 61, -153, -41, 71, -143, -31, 81, -133, -21, 91, -123, -11, 101, -113, -1, 111, -103, 9, 121, -93, 19, 131, -83, 29, 141, -73, 39, 151, -63, 49, 161, -53, 59, -155, -43, 69, -145, -33, 79, -135, -23, 89, -125, -13, 99, -115, -3, 109, -105, 7, 119, -95, 17, 129, -85, 27, 139, -75, 37, 149, -65, 47, 159, -55, 57, -157, -45, 67, -147, -35, 77, -137, -25, 87, -127, -15, 97, -117, -5, 107],
[-49, 65, -147, -33, 81, -131, -17, 97, -115, -1, 113, -99, 15, 129, -83, 31, 145, -67, 47, 161, -51, 63, -149, -35, 79, -133, -19, 95, -117, -3, 111, -101, 13, 127, -85, 29, 143, -69, 45, 159, -53, 61, -151, -37, 77, -135, -21, 93, -119, -5, 109, -103, 11, 125, -87, 27, 141, -71, 43, 157, -55, 59, -153, -39, 75, -137, -23, 91, -121, -7, 107, -105, 9, 123, -89, 25, 139, -73, 41, 155, -57],
[-47, 69, -141, -25, 91, -119, -3, 113, -97, 19, 135, -75, 41, 157, -53, 63, -147, -31, 85, -125, -9, 107, -103, 13, 129, -81, 35, 151, -59, 57, -153, -37, 79, -131, -15, 101, -109, 7, 123, -87, 29, 145, -65, 51, -159, -43, 73, -137, -21, 95, -115, 1, 117, -93, 23, 139, -71, 45, 161, -49, 67, -143, -27, 89, -121, -5, 111, -99, 17, 133, -77, 39, 155, -55, 61, -149, -33, 83, -127, -11, 105],
[-45, 73, -135, -17, 101, -107, 11, 129, -79, 39, 157, -51, 67, -141, -23, 95, -113, 5, 123, -85, 33, 151, -57, 61, -147, -29, 89, -119, -1, 117, -91, 27, 145, -63, 55, -153, -35, 83, -125, -7, 111, -97, 21, 139, -69, 49, -159, -41, 77, -131, -13, 105, -103, 15, 133, -75, 43, 161, -47, 71, -137, -19, 99, -109, 9, 127, -81, 37, 155, -53, 65, -143, -25, 93, -115, 3, 121, -87, 31, 149, -59],
[-43, 77, -129, -9, 111, -95, 25, 145, -61, 59, -147, -27, 93, -113, 7, 127, -79, 41, 161, -45, 75, -131, -11, 109, -97, 23, 143, -63, 57, -149, -29, 91, -115, 5, 125, -81, 39, 159, -47, 73, -133, -13, 107, -99, 21, 141, -65, 55, -151, -31, 89, -117, 3, 123, -83, 37, 157, -49, 71, -135, -15, 105, -101, 19, 139, -67, 53, -153, -33, 87, -119, 1, 121, -85, 35, 155, -51, 69, -137, -17, 103],
[-41, 81, -123, -1, 121, -83, 39, 161, -43, 79, -125, -3, 119, -85, 37, 159, -45, 77, -127, -5, 117, -87, 35, 157, -47, 75, -129, -7, 115, -89, 33, 155, -49, 73, -131, -9, 113, -91, 31, 153, -51, 71, -133, -11, 111, -93, 29, 151, -53, 69, -135, -13, 109, -95, 27, 149, -55, 67, -137, -15, 107, -97, 25, 147, -57, 65, -139, -17, 105, -99, 23, 145, -59, 63, -141, -19, 103, -101, 21, 143, -61],
[-39, 85, -117, 7, 131, -71, 53, -149, -25, 99, -103, 21, 145, -57, 67, -135, -11, 113, -89, 35, 159, -43, 81, -121, 3, 127, -75, 49, -153, -29, 95, -107, 17, 141, -61, 63, -139, -15, 109, -93, 31, 155, -47, 77, -125, -1, 123, -79, 45, -157, -33, 91, -111, 13, 137, -65, 59, -143, -19, 105, -97, 27, 151, -51, 73, -129, -5, 119, -83, 41, -161, -37, 87, -115, 9, 133, -69, 55, -147, -23, 101],
[-37, 89, -111, 15, 141, -59, 67, -133, -7, 119, -81, 45, -155, -29, 97, -103, 23, 149, -51, 75, -125, 1, 127, -73, 53, -147, -21, 105, -95, 31, 157, -43, 83, -117, 9, 135, -65, 61, -139, -13, 113, -87, 39, -161, -35, 91, -109, 17, 143, -57, 69, -131, -5, 121, -79, 47, -153, -27, 99, -101, 25, 151, -49, 77, -123, 3, 129, -71, 55, -145, -19, 107, -93, 33, 159, -41, 85, -115, 11, 137, -63],
[-35, 93, -105, 23, 151, -47, 81, -117, 11, 139, -59, 69, -129, -1, 127, -71, 57, -141, -13, 115, -83, 45, -153, -25, 103, -95, 33, 161, -37, 91, -107, 21, 149, -49, 79, -119, 9, 137, -61, 67, -131, -3, 125, -73, 55, -143, -15, 113, -85, 43, -155, -27, 101, -97, 31, 159, -39, 89, -109, 19, 147, -51, 77, -121, 7, 135, -63, 65, -133, -5, 123, -75, 53, -145, -17, 111, -87, 41, -157, -29, 99],
[-33, 97, -99, 31, 161, -35, 95, -101, 29, 159, -37, 93, -103, 27, 157, -39, 91, -105, 25, 155, -41, 89, -107, 23, 153, -43, 87, -109, 21, 151, -45, 85, -111, 19, 149, -47, 83, -113, 17, 147, -49, 81, -115, 15, 145, -51, 79, -117, 13, 143, -53, 77, -119, 11, 141, -55, 75, -121, 9, 139, -57, 73, -123, 7, 137, -59, 71, -125, 5, 135, -61, 69, -127, 3, 133, -63, 67, -129, 1, 131, -65],
[-31, 101, -93, 39, -155, -23, 109, -85, 47, -147, -15, 117, -77, 55, -139, -7, 125, -69, 63, -131, 1, 133, -61, 71, -123, 9, 141, -53, 79, -115, 17, 149, -45, 87, -107, 25, 157, -37, 95, -99, 33, -161, -29, 103, -91, 41, -153, -21, 111, -83, 49, -145, -13, 119, -75, 57, -137, -5, 127, -67, 65, -129, 3, 135, -59, 73, -121, 11, 143, -51, 81, -113, 19, 151, -43, 89, -105, 27, 159, -35, 97],
[-29, 105, -87, 47, -145, -11, 123, -69, 65, -127, 7, 141, -51, 83, -109, 25, 159, -33, 101, -91, 43, -149, -15, 119, -73, 61, -131, 3, 137, -55, 79, -113, 21, 155, -37, 97, -95, 39, -153, -19, 115, -77, 57, -135, -1, 133, -59, 75, -117, 17, 151, -41, 93, -99, 35, -157, -23, 111, -81, 53, -139, -5, 129, -63, 71, -121, 13, 147, -45, 89, -103, 31, -161, -27, 107, -85, 49, -143, -9, 125, -67],
[-27, 109, -81, 55, -135, 1, 137, -53, 83, -107, 29, -161, -25, 111, -79, 57, -133, 3, 139, -51, 85, -105, 31, -159, -23, 113, -77, 59, -131, 5, 141, -49, 87, -103, 33, -157, -21, 115, -75, 61, -129, 7, 143, -47, 89, -101, 35, -155, -19, 117, -73, 63, -127, 9, 145, -45, 91, -99, 37, -153, -17, 119, -71, 65, -125, 11, 147, -43, 93, -97, 39, -151, -15, 121, -69, 67, -123, 13, 149, -41, 95],
[-25, 113, -75, 63, -125, 13, 151, -37, 101, -87, 51, -137, 1, 139, -49, 89, -99, 39, -149, -11, 127, -61, 77, -111, 27, -161, -23, 115, -73, 65, -123, 15, 153, -35, 103, -85, 53, -135, 3, 141, -47, 91, -97, 41, -147, -9, 129, -59, 79, -109, 29, -159, -21, 117, -71, 67, -121, 17, 155, -33, 105, -83, 55, -133, 5, 143, -45, 93, -95, 43, -145, -7, 131, -57, 81, -107, 31, -157, -19, 119, -69],
[-23, 117, -69, 71, -115, 25, -161, -21, 119, -67, 73, -113, 27, -159, -19, 121, -65, 75, -111, 29, -157, -17, 123, -63, 77, -109, 31, -155, -15, 125, -61, 79, -107, 33, -153, -13, 127, -59, 81, -105, 35, -151, -11, 129, -57, 83, -103, 37, -149, -9, 131, -55, 85, -101, 39, -147, -7, 133, -53, 87, -99, 41, -145, -5, 135, -51, 89, -97, 43, -143, -3, 137, -49, 91, -95, 45, -141, -1, 139, -47, 93],
[-21, 121, -63, 79, -105, 37, -147, -5, 137, -47, 95, -89, 53, -131, 11, 153, -31, 111, -73, 69, -115, 27, -157, -15, 127, -57, 85, -99, 43, -141, 1, 143, -41, 101, -83, 59, -125, 17, 159, -25, 117, -67, 75, -109, 33, -151, -9, 133, -51, 91, -93, 49, -135, 7, 149, -35, 107, -77, 65, -119, 23, -161, -19, 123, -61, 81, -103, 39, -145, -3, 139, -45, 97, -87, 55, -129, 13, 155, -29, 113, -71],
[-19, 125, -57, 87, -95, 49, -133, 11, 155, -27, 117, -65, 79, -103, 41, -141, 3, 147, -35, 109, -73, 71, -111, 33, -149, -5, 139, -43, 101, -81, 63, -119, 25, -157, -13, 131, -51, 93, -89, 55, -127, 17, 161, -21, 123, -59, 85, -97, 47, -135, 9, 153, -29, 115, -67, 77, -105, 39, -143, 1, 145, -37, 107, -75, 69, -113, 31, -151, -7, 137, -45, 99, -83, 61, -121, 23, -159, -15, 129, -53, 91],
[-17, 129, -51, 95, -85, 61, -119, 27, -153, -7, 139, -41, 105, -75, 71, -109, 37, -143, 3, 149, -31, 115, -65, 81, -99, 47, -133, 13, 159, -21, 125, -55, 91, -89, 57, -123, 23, -157, -11, 135, -45, 101, -79, 67, -113, 33, -147, -1, 145, -35, 111, -69, 77, -103, 43, -137, 9, 155, -25, 121, -59, 87, -93, 53, -127, 19, -161, -15, 131, -49, 97, -83, 63, -117, 29, -151, -5, 141, -39, 107, -73],
[-15, 133, -45, 103, -75, 73, -105, 43, -135, 13, 161, -17, 131, -47, 101, -77, 71, -107, 41, -137, 11, 159, -19, 129, -49, 99, -79, 69, -109, 39, -139, 9, 157, -21, 127, -51, 97, -81, 67, -111, 37, -141, 7, 155, -23, 125, -53, 95, -83, 65, -113, 35, -143, 5, 153, -25, 123, -55, 93, -85, 63, -115, 33, -145, 3, 151, -27, 121, -57, 91, -87, 61, -117, 31, -147, 1, 149, -29, 119, -59, 89],
[-13, 137, -39, 111, -65, 85, -91, 59, -117, 33, -143, 7, 157, -19, 131, -45, 105, -71, 79, -97, 53, -123, 27, -149, 1, 151, -25, 125, -51, 99, -77, 73, -103, 47, -129, 21, -155, -5, 145, -31, 119, -57, 93, -83, 67, -109, 41, -135, 15, -161, -11, 139, -37, 113, -63, 87, -89, 61, -115, 35, -141, 9, 159, -17, 133, -43, 107, -69, 81, -95, 55, -121, 29, -147, 3, 153, -23, 127, -49, 101, -75],
[-11, 141, -33, 119, -55, 97, -77, 75, -99, 53, -121, 31, -143, 9, 161, -13, 139, -35, 117, -57, 95, -79, 73, -101, 51, -123, 29, -145, 7, 159, -15, 137, -37, 115, -59, 93, -81, 71, -103, 49, -125, 27, -147, 5, 157, -17, 135, -39, 113, -61, 91, -83, 69, -105, 47, -127, 25, -149, 3, 155, -19, 133, -41, 111, -63, 89, -85, 67, -107, 45, -129, 23, -151, 1, 153, -21, 131, -43, 109, -65, 87],
[-9, 145, -27, 127, -45, 109, -63, 91, -81, 73, -99, 55, -117, 37, -135, 19, -153, 1, 155, -17, 137, -35, 119, -53, 101, -71, 83, -89, 65, -107, 47, -125, 29, -143, 11, -161, -7, 147, -25, 129, -43, 111, -61, 93, -79, 75, -97, 57, -115, 39, -133, 21, -151, 3, 157, -15, 139, -33, 121, -51, 103, -69, 85, -87, 67, -105, 49, -123, 31, -141, 13, -159, -5, 149, -23, 131, -41, 113, -59, 95, -77],
[-7, 149, -21, 135, -35, 121, -49, 107, -63, 93, -77, 79, -91, 65, -105, 51, -119, 37, -133, 23, -147, 9, -161, -5, 151, -19, 137, -33, 123, -47, 109, -61, 95, -75, 81, -89, 67, -103, 53, -117, 39, -131, 25, -145, 11, -159, -3, 153, -17, 139, -31, 125, -45, 111, -59, 97, -73, 83, -87, 69, -101, 55, -115, 41, -129, 27, -143, 13, -157, -1, 155, -15, 141, -29, 127, -43, 113, -57, 99, -71, 85],
[-5, 153, -15, 143, -25, 133, -35, 123, -45, 113, -55, 103, -65, 93, -75, 83, -85, 73, -95, 63, -105, 53, -115, 43, -125, 33, -135, 23, -145, 13, -155, 3, 161, -7, 151, -17, 141, -27, 131, -37, 121, -47, 111, -57, 101, -67, 91, -77, 81, -87, 71, -97, 61, -107, 51, -117, 41, -127, 31, -137, 21, -147, 11, -157, 1, 159, -9, 149, -19, 139, -29, 129, -39, 119, -49, 109, -59, 99, -69, 89, -79],
[-3, 157, -9, 151, -15, 145, -21, 139, -27, 133, -33, 127, -39, 121, -45, 115, -51, 109, -57, 103, -63, 97, -69, 91, -75, 85, -81, 79, -87, 73, -93, 67, -99, 61, -105, 55, -111, 49, -117, 43, -123, 37, -129, 31, -135, 25, -141, 19, -147, 13, -153, 7, -159, 1, 161, -5, 155, -11, 149, -17, 143, -23, 137, -29, 131, -35, 125, -41, 119, -47, 113, -53, 107, -59, 101, -65, 95, -71, 89, -77, 83],
[-1, 161, -3, 159, -5, 157, -7, 155, -9, 153, -11, 151, -13, 149, -15, 147, -17, 145, -19, 143, -21, 141, -23, 139, -25, 137, -27, 135, -29, 133, -31, 131, -33, 129, -35, 127, -37, 125, -39, 123, -41, 121, -43, 119, -45, 117, -47, 115, -49, 113, -51, 111, -53, 109, -55, 107, -57, 105, -59, 103, -61, 101, -63, 99, -65, 97, -67, 95, -69, 93, -71, 91, -73, 89, -75, 87, -77, 85, -79, 83, -81]]
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[-49438489306898625757806133, 46971200878372246312301548, -17532192265415431956126443, -54304914018205394822715251, 9333093018422928312112471, -28273723245527265079444637, -11863318722957227430411332, 8592145740181710933349911, -30799882186561349205545594, -86450439368334098694817000, -41528743386893454136857767, 12626642539748325952081886, -60599011540279180595944117, -3214773641072505591241785 -- (+1959 chars; full line in the Zenodo source)
[46971200878372246312301548, -54304914018205394822715251, -28273723245527265079444637, 8592145740181710933349911, -86450439368334098694817000, 12626642539748325952081886, -32147736410725055912417859, -124535800299247616715942306, -61451104913013598857393671, -33585097597353903072498425, -79111976468602031123416811, -43666791300637489790711953, -45227498487512486047356770, -1068932648180123783190 -- (+1920 chars; full line in the Zenodo source)
[-17532192265415431956126443, -28273723245527265079444637, -30799882186561349205545594, 12626642539748325952081886, -52319572160091513150712605, -61451104913013598857393671, -100255124452569041068434831, -43666791300637489790711953, -103264085663760195275366685, -54707202196842460213897815, -128627473393364184082833558, -86502936742152988010290503, -133890198539565074949688655, -2105473638858877 -- (+1932 chars; full line in the Zenodo source)
[-54304914018205394822715251, 8592145740181710933349911, 12626642539748325952081886, -124535800299247616715942306, -33585097597353903072498425, -43666791300637489790711953, -106893264818012378319067397, 3031766787128416012290277, -86502936742152988010290503, -120781008240447402397518939, -38944311324028575451510416, -61189080829566084885347563, -26556686315300333896155511, -133457501062552498962 -- (+1931 chars; full line in the Zenodo source)
[9333093018422928312112471, -86450439368334098694817000, -52319572160091513150712605, -33585097597353903072498425, -170972634053536504956006285, -54707202196842460213897815, -140489952965661086240980348, -120781008240447402397518939, -56167937352209261197385316, 27406193354183017849564822, -162041126600782461683636161, -59642413950548290577238710, -110598684837025646596213777, -48974297398343801 -- (+1934 chars; full line in the Zenodo source)
[-28273723245527265079444637, 12626642539748325952081886, -61451104913013598857393671, -43666791300637489790711953, -54707202196842460213897815, -86502936742152988010290503, -21054736388588770148831736, -61189080829566084885347563, -7525934707018734766733550, -59642413950548290577238710, 1817370281808594867030975, 76619941294683708425413780, 79105545094145556944224869, 81164392821706832284459249 -- (+1933 chars; full line in the Zenodo source)
[-11863318722957227430411332, -32147736410725055912417859, -100255124452569041068434831, -106893264818012378319067397, -140489952965661086240980348, -21054736388588770148831736, -152539081716872091542528167, -13345750106255249896261708, -72486097596569213728609545, -4897429739834380124338315, -69520228079669729220686689, 81164392821706832284459249, -76619941294683708425413780, 110598684837025646 -- (+1934 chars; full line in the Zenodo source)
[8592145740181710933349911, -124535800299247616715942306, -43666791300637489790711953, 3031766787128416012290277, -120781008240447402397518939, -61189080829566084885347563, -13345750106255249896261708, -86598227096219667752158881, 76619941294683708425413780, 96697225747072887076692520, 9427168298519291503319597, 120454314633030803773565528, 50844213046452145891373727, 150599608294857151689211513 -- (+1926 chars; full line in the Zenodo source)
[-30799882186561349205545594, -61451104913013598857393671, -103264085663760195275366685, -86502936742152988010290503, -56167937352209261197385316, -7525934707018734766733550, -72486097596569213728609545, 76619941294683708425413780, -66159212594185177979601319, 104590936698680931857445169, 86598227096219667752158881, 162041126600782461683636161, 129205962840221905360343360, 1112921111149650957491 -- (+1931 chars; full line in the Zenodo source)
[-86450439368334098694817000, -33585097597353903072498425, -54707202196842460213897815, -120781008240447402397518939, 27406193354183017849564822, -59642413950548290577238710, -4897429739834380124338315, 96697225747072887076692520, 104590936698680931857445169, 72486097596569213728609545, 202455623054545707903831309, 194404922036438741718753617, 128627473393364184082833558, 12715563021251859881396 -- (+1933 chars; full line in the Zenodo source)
[-41528743386893454136857767, -79111976468602031123416811, -128627473393364184082833558, -38944311324028575451510416, -162041126600782461683636161, 1817370281808594867030975, -69520228079669729220686689, 9427168298519291503319597, 86598227096219667752158881, 202455623054545707903831309, 21054736388588770148831736, 159340191160152310567837989, 33585097597353903072498425, 3079988218656134920554559 -- (+1932 chars; full line in the Zenodo source)
[12626642539748325952081886, -43666791300637489790711953, -86502936742152988010290503, -61189080829566084885347563, -59642413950548290577238710, 76619941294683708425413780, 81164392821706832284459249, 120454314633030803773565528, 162041126600782461683636161, 194404922036438741718753617, 159340191160152310567837989, 62062777036114136995120841, 11863318722957227430411332, 9333093018422928312112471 -- (+1930 chars; full line in the Zenodo source)
[-60599011540279180595944117, -45227498487512486047356770, -133890198539565074949688655, -26556686315300333896155511, -110598684837025646596213777, 79105545094145556944224869, -76619941294683708425413780, 50844213046452145891373727, 129205962840221905360343360, 128627473393364184082833558, 33585097597353903072498425, 11863318722957227430411332, -28273723245527265079444637, -620627770361141369951 -- (+1934 chars; full line in the Zenodo source)
[-32147736410725055912417859, -106893264818012378319067397, -21054736388588770148831736, -13345750106255249896261708, -4897429739834380124338315, 81164392821706832284459249, 110598684837025646596213777, 150599608294857151689211513, 111292111114965095749154015, 127155630212518598813962565, 30799882186561349205545594, 9333093018422928312112471, -62062777036114136995120841, -12862747339336418408283 -- (+1933 chars; full line in the Zenodo source)
[-52319572160091513150712605, -54707202196842460213897815, -56167937352209261197385316, -59642413950548290577238710, -9427168298519291503319597, 104590936698680931857445169, 104616779848472220428669259, 194404922036438741718753617, 106893264818012378319067397, 60599011540279180595944117, 46971200878372246312301548, -15243911426009537988401753, 3031766787128416012290277, -159816179901613603012535 -- (+1929 chars; full line in the Zenodo source)
[-124535800299247616715942306, 3031766787128416012290277, -61189080829566084885347563, -86598227096219667752158881, 96697225747072887076692520, 120454314633030803773565528, 150599608294857151689211513, 140489952965661086240980348, 62062777036114136995120841, 17532192265415431956126443, -60599011540279180595944117, -103995684827690291987844087, -56167937352209261197385316, -1673484899671330771660 -- (+1933 chars; full line in the Zenodo source)
[-15243911426009537988401753, -156621436198286521811807402, -150599608294857151689211513, 21672156876023586429074455, -79105545094145556944224869, 167348489967133077166035843, 38944311324028575451510416, 103264085663760195275366685, 86450439368334098694817000, -11863318722957227430411332, -43666791300637489790711953, -181213500938960582213963124, -104616779848472220428669259, -942716829851929150 -- (+1932 chars; full line in the Zenodo source)
[-61451104913013598857393671, -86502936742152988010290503, -7525934707018734766733550, 76619941294683708425413780, 104590936698680931857445169, 162041126600782461683636161, 111292111114965095749154015, 62062777036114136995120841, 49438489306898625757806133, -15243911426009537988401753, -140489952965661086240980348, -202455623054545707903831309, -160738112687421070243027685, -60634294404591790946 -- (+1928 chars; full line in the Zenodo source)
[-62062777036114136995120841, -54157678936027147618935387, -111814967119492901432040492, -19849022031345078349476758, -21672156876023586429074455, 152539081716872091542528167, 54707202196842460213897815, 41528743386893454136857767, 8592145740181710933349911, -103264085663760195275366685, -129205962840221905360343360, -110598684837025646596213777, 81164392821706832284459249, 596424139505482905772 -- (+1932 chars; full line in the Zenodo source)
[-33585097597353903072498425, -120781008240447402397518939, -59642413950548290577238710, 96697225747072887076692520, 72486097596569213728609545, 194404922036438741718753617, 127155630212518598813962565, 17532192265415431956126443, -15243911426009537988401753, -111292111114965095749154015, -111814967119492901432040492, -69520228079669729220686689, -1817370281808594867030975, 129205962840221905360 -- (+1930 chars; full line in the Zenodo source)
[-100255124452569041068434831, -21054736388588770148831736, -72486097596569213728609545, 81164392821706832284459249, 104616779848472220428669259, 111292111114965095749154015, 124535800299247616715942306, 9333093018422928312112471, -45227498487512486047356770, -159816179901613603012535458, 21672156876023586429074455, -6063429440459179094677736, 202455623054545707903831309, -3031766787128416012290 -- (+1929 chars; full line in the Zenodo source)
[-79111976468602031123416811, -38944311324028575451510416, 1817370281808594867030975, 9427168298519291503319597, 202455623054545707903831309, 159340191160152310567837989, 30799882186561349205545594, -60599011540279180595944117, -140489952965661086240980348, -111814967119492901432040492, -81164392821706832284459249, -6973954038481374291029296, 120781008240447402397518939, 614511049130135988573936 -- (+1933 chars; full line in the Zenodo source)
[-127155630212518598813962565, -129205962840221905360343360, -67079427365369242577551037, 160738112687421070243027685, 61189080829566084885347563, 170972634053536504956006285, -46971200878372246312301548, -100255124452569041068434831, -38944311324028575451510416, -120454314633030803773565528, 104590936698680931857445169, -27406193354183017849564822, 103264085663760195275366685, 54304914018205394 -- (+1934 chars; full line in the Zenodo source)
[-43666791300637489790711953, -61189080829566084885347563, 76619941294683708425413780, 120454314633030803773565528, 194404922036438741718753617, 62062777036114136995120841, 9333093018422928312112471, -103995684827690291987844087, -202455623054545707903831309, -69520228079669729220686689, -6973954038481374291029296, 54157678936027147618935387, 32147736410725055912417859, -864504393683340986948170 -- (+1931 chars; full line in the Zenodo source)
[-170972634053536504956006285, 27406193354183017849564822, -9427168298519291503319597, 72486097596569213728609545, 54157678936027147618935387, 60599011540279180595944117, 12626642539748325952081886, -111292111114965095749154015, 6973954038481374291029296, 19849022031345078349476758, 150599608294857151689211513, 45227498487512486047356770, 49438489306898625757806133, -43666791300637489790711953, -- (+1929 chars; full line in the Zenodo source)
[-45227498487512486047356770, -26556686315300333896155511, 79105545094145556944224869, 50844213046452145891373727, 128627473393364184082833558, 11863318722957227430411332, -62062777036114136995120841, -56167937352209261197385316, -160738112687421070243027685, -1817370281808594867030975, 120781008240447402397518939, 32147736410725055912417859, 12626642539748325952081886, -541576789360271476189353 -- (+1929 chars; full line in the Zenodo source)
[-103264085663760195275366685, -7525934707018734766733550, -66159212594185177979601319, 162041126600782461683636161, 106893264818012378319067397, 49438489306898625757806133, -45227498487512486047356770, -202455623054545707903831309, 96697225747072887076692520, 13345750106255249896261708, 103995684827690291987844087, -46971200878372246312301548, -170972634053536504956006285, -26556686315300333896 -- (+1934 chars; full line in the Zenodo source)
[-106893264818012378319067397, -13345750106255249896261708, 81164392821706832284459249, 150599608294857151689211513, 127155630212518598813962565, 9333093018422928312112471, -128627473393364184082833558, -167348489967133077166035843, -6063429440459179094677736, 129205962840221905360343360, 61451104913013598857393671, -86450439368334098694817000, -54157678936027147618935387, 1817370281808594867030 -- (+1928 chars; full line in the Zenodo source)
[-103995684827690291987844087, -104616779848472220428669259, 19849022031345078349476758, 159816179901613603012535458, 61451104913013598857393671, -41528743386893454136857767, -120781008240447402397518939, -67079427365369242577551037, 110598684837025646596213777, 86502936742152988010290503, 11863318722957227430411332, -79111976468602031123416811, -150599608294857151689211513, 96697225747072887076 -- (+1932 chars; full line in the Zenodo source)
[-54707202196842460213897815, -59642413950548290577238710, 104590936698680931857445169, 194404922036438741718753617, 60599011540279180595944117, -15243911426009537988401753, -159816179901613603012535458, -69520228079669729220686689, 13345750106255249896261708, 45227498487512486047356770, -54304914018205394822715251, -156621436198286521811807402, -86598227096219667752158881, 670794273653692425775 -- (+1932 chars; full line in the Zenodo source)
[-159340191160152310567837989, 6973954038481374291029296, 4897429739834380124338315, 133890198539565074949688655, -8592145740181710933349911, -127155630212518598813962565, -7525934707018734766733550, -79105545094145556944224869, 159816179901613603012535458, 124535800299247616715942306, -52319572160091513150712605, -129205962840221905360343360, -69520228079669729220686689, 16204112660078246168363 -- (+1932 chars; full line in the Zenodo source)
[3031766787128416012290277, -86598227096219667752158881, 120454314633030803773565528, 140489952965661086240980348, 17532192265415431956126443, -103995684827690291987844087, -167348489967133077166035843, 4897429739834380124338315, 54157678936027147618935387, 28273723245527265079444637, -45227498487512486047356770, -104616779848472220428669259, 104590936698680931857445169, 181213500938960582213963 -- (+1928 chars; full line in the Zenodo source)
[-128627473393364184082833558, 1817370281808594867030975, 86598227096219667752158881, 159340191160152310567837989, 46971200878372246312301548, -140489952965661086240980348, 21672156876023586429074455, -6973954038481374291029296, 103995684827690291987844087, -54304914018205394822715251, -111292111114965095749154015, -4897429739834380124338315, 59642413950548290577238710, 1032640856637601952753666 -- (+1925 chars; full line in the Zenodo source)
[-156621436198286521811807402, 21672156876023586429074455, 167348489967133077166035843, 103264085663760195275366685, -11863318722957227430411332, -181213500938960582213963124, -9427168298519291503319597, 7525934707018734766733550, 33585097597353903072498425, -32147736410725055912417859, -61189080829566084885347563, 66159212594185177979601319, 159816179901613603012535458, 605990115402791805959441 -- (+1933 chars; full line in the Zenodo source)
[-140489952965661086240980348, -4897429739834380124338315, 104616779848472220428669259, 127155630212518598813962565, 12626642539748325952081886, -159816179901613603012535458, 66159212594185177979601319, 129205962840221905360343360, 41528743386893454136857767, -43666791300637489790711953, -50844213046452145891373727, 67079427365369242577551037, 156621436198286521811807402, -4943848930689862575780 -- (+1931 chars; full line in the Zenodo source)
[-86502936742152988010290503, 76619941294683708425413780, 162041126600782461683636161, 62062777036114136995120841, -15243911426009537988401753, -202455623054545707903831309, -6063429440459179094677736, 54157678936027147618935387, -46971200878372246312301548, -156621436198286521811807402, -4897429739834380124338315, 111814967119492901432040492, 100255124452569041068434831, -5231957216009151315071 -- (+1933 chars; full line in the Zenodo source)
[-111292111114965095749154015, 6063429440459179094677736, 26556686315300333896155511, 52319572160091513150712605, -79111976468602031123416811, -50844213046452145891373727, 120454314633030803773565528, 54707202196842460213897815, -11863318722957227430411332, -38944311324028575451510416, -66159212594185177979601319, 56167937352209261197385316, -8592145740181710933349911, -1039956848276902919878440 -- (+1930 chars; full line in the Zenodo source)
[-54157678936027147618935387, -19849022031345078349476758, 152539081716872091542528167, 41528743386893454136857767, -103264085663760195275366685, -110598684837025646596213777, 59642413950548290577238710, 79111976468602031123416811, -124535800299247616715942306, -7525934707018734766733550, 160738112687421070243027685, 128627473393364184082833558, 9333093018422928312112471, -1944049220364387417187 -- (+1935 chars; full line in the Zenodo source)
[-133890198539565074949688655, 79105545094145556944224869, 129205962840221905360343360, 11863318722957227430411332, 3031766787128416012290277, -160738112687421070243027685, 202455623054545707903831309, 32147736410725055912417859, -170972634053536504956006285, -86598227096219667752158881, 59642413950548290577238710, 100255124452569041068434831, -61451104913013598857393671, -1118149671194929014320 -- (+1927 chars; full line in the Zenodo source)
[-120781008240447402397518939, 96697225747072887076692520, 194404922036438741718753617, 17532192265415431956126443, -111292111114965095749154015, -69520228079669729220686689, 129205962840221905360343360, 28273723245527265079444637, -156621436198286521811807402, 6063429440459179094677736, 152539081716872091542528167, 30799882186561349205545594, -159340191160152310567837989, -160738112687421070243 -- (+1927 chars; full line in the Zenodo source)
[-181213500938960582213963124, 66159212594185177979601319, 120781008240447402397518939, -49438489306898625757806133, -21054736388588770148831736, -96697225747072887076692520, 133890198539565074949688655, 46971200878372246312301548, -194404922036438741718753617, 81164392821706832284459249, 54157678936027147618935387, -17532192265415431956126443, -38944311324028575451510416, -791055450941455569442 -- (+1935 chars; full line in the Zenodo source)
[-21054736388588770148831736, 81164392821706832284459249, 111292111114965095749154015, 9333093018422928312112471, -159816179901613603012535458, -6063429440459179094677736, -3031766787128416012290277, -86450439368334098694817000, -26556686315300333896155511, 67079427365369242577551037, 103264085663760195275366685, -52319572160091513150712605, -111814967119492901432040492, 865982270962196677521588 -- (+1932 chars; full line in the Zenodo source)
[-194404922036438741718753617, 69520228079669729220686689, 156621436198286521811807402, -30799882186561349205545594, -26556686315300333896155511, -21672156876023586429074455, 170972634053536504956006285, -61451104913013598857393671, -167348489967133077166035843, 50844213046452145891373727, 124535800299247616715942306, -103264085663760195275366685, -4897429739834380124338315, -2740619335418301784 -- (+1937 chars; full line in the Zenodo source)
[-38944311324028575451510416, 9427168298519291503319597, 159340191160152310567837989, -60599011540279180595944117, -111814967119492901432040492, -6973954038481374291029296, 61451104913013598857393671, -45227498487512486047356770, -4897429739834380124338315, 152539081716872091542528167, -9333093018422928312112471, -133890198539565074949688655, -96697225747072887076692520, 865029367421529880102905 -- (+1934 chars; full line in the Zenodo source)
[-56167937352209261197385316, 104590936698680931857445169, 106893264818012378319067397, -15243911426009537988401753, 6973954038481374291029296, 13345750106255249896261708, 41528743386893454136857767, -156621436198286521811807402, -81164392821706832284459249, 133890198539565074949688655, -28273723245527265079444637, -150599608294857151689211513, 120454314633030803773565528, 7911197646860203112341 -- (+1932 chars; full line in the Zenodo source)
[-129205962840221905360343360, 160738112687421070243027685, 170972634053536504956006285, -100255124452569041068434831, -120454314633030803773565528, -27406193354183017849564822, 54304914018205394822715251, -21054736388588770148831736, 9427168298519291503319597, 103995684827690291987844087, -15243911426009537988401753, -72486097596569213728609545, 7525934707018734766733550, -859214574018171093334 -- (+1935 chars; full line in the Zenodo source)
[-159816179901613603012535458, 67079427365369242577551037, 79111976468602031123416811, -170972634053536504956006285, 76619941294683708425413780, 38944311324028575451510416, -17532192265415431956126443, 27406193354183017849564822, -1817370281808594867030975, 62062777036114136995120841, -106893264818012378319067397, -9427168298519291503319597, 181213500938960582213963124, -282737232455272650794446 -- (+1925 chars; full line in the Zenodo source)
[-61189080829566084885347563, 120454314633030803773565528, 62062777036114136995120841, -103995684827690291987844087, -69520228079669729220686689, 54157678936027147618935387, -86450439368334098694817000, -104616779848472220428669259, 111814967119492901432040492, 30799882186561349205545594, -133890198539565074949688655, 19849022031345078349476758, 106893264818012378319067397, -33585097597353903072 -- (+1930 chars; full line in the Zenodo source)
[-152539081716872091542528167, 110598684837025646596213777, 124535800299247616715942306, -128627473393364184082833558, 66159212594185177979601319, -3031766787128416012290277, -15243911426009537988401753, 1817370281808594867030975, 61189080829566084885347563, -49438489306898625757806133, 27406193354183017849564822, 86598227096219667752158881, 52319572160091513150712605, -1566214361982865218118074 -- (+1931 chars; full line in the Zenodo source)
[27406193354183017849564822, 72486097596569213728609545, 60599011540279180595944117, -111292111114965095749154015, 19849022031345078349476758, 45227498487512486047356770, -43666791300637489790711953, 6063429440459179094677736, 133890198539565074949688655, -41528743386893454136857767, -167348489967133077166035843, 26556686315300333896155511, -46971200878372246312301548, -6118908082956608488534756 -- (+1932 chars; full line in the Zenodo source)
[-150599608294857151689211513, 167348489967133077166035843, 86450439368334098694817000, -181213500938960582213963124, 160738112687421070243027685, 33585097597353903072498425, -159340191160152310567837989, 66159212594185177979601319, 54707202196842460213897815, -100255124452569041068434831, 76619941294683708425413780, 120781008240447402397518939, -41528743386893454136857767, 697395403848137429102 -- (+1929 chars; full line in the Zenodo source)
[-26556686315300333896155511, 50844213046452145891373727, 11863318722957227430411332, -56167937352209261197385316, -1817370281808594867030975, 32147736410725055912417859, -54157678936027147618935387, 104590936698680931857445169, 100255124452569041068434831, -159340191160152310567837989, -96697225747072887076692520, 106893264818012378319067397, -43666791300637489790711953, -1984902203134507834947 -- (+1934 chars; full line in the Zenodo source)
[-202455623054545707903831309, 111814967119492901432040492, 54304914018205394822715251, -152539081716872091542528167, 167348489967133077166035843, -8592145740181710933349911, -56167937352209261197385316, 110598684837025646596213777, -12626642539748325952081886, -181213500938960582213963124, 67079427365369242577551037, 124535800299247616715942306, -111292111114965095749154015, 1045909366986809318 -- (+1931 chars; full line in the Zenodo source)
[-7525934707018734766733550, 162041126600782461683636161, 49438489306898625757806133, -202455623054545707903831309, 13345750106255249896261708, -46971200878372246312301548, -26556686315300333896155511, 111814967119492901432040492, 17532192265415431956126443, -150599608294857151689211513, 104616779848472220428669259, 54304914018205394822715251, 27406193354183017849564822, 508442130464521458913737 -- (+1927 chars; full line in the Zenodo source)
[-162041126600782461683636161, 202455623054545707903831309, 46971200878372246312301548, -111814967119492901432040492, 150599608294857151689211513, -54304914018205394822715251, -50844213046452145891373727, 152539081716872091542528167, -28273723245527265079444637, -167348489967133077166035843, 159816179901613603012535458, 8592145740181710933349911, -72486097596569213728609545, 56167937352209261197 -- (+1935 chars; full line in the Zenodo source)
[-13345750106255249896261708, 150599608294857151689211513, 9333093018422928312112471, -167348489967133077166035843, 129205962840221905360343360, -86450439368334098694817000, 1817370281808594867030975, 181213500938960582213963124, -52319572160091513150712605, -160738112687421070243027685, 86502936742152988010290503, -33585097597353903072498425, -19849022031345078349476758, 15934019116015231056783 -- (+1935 chars; full line in the Zenodo source)
[-111814967119492901432040492, 152539081716872091542528167, 8592145740181710933349911, -110598684837025646596213777, 181213500938960582213963124, -124535800299247616715942306, -104590936698680931857445169, 128627473393364184082833558, -43666791300637489790711953, -66159212594185177979601319, 170972634053536504956006285, 3031766787128416012290277, -6063429440459179094677736, 152439114260095379884 -- (+1931 chars; full line in the Zenodo source)
[-104616779848472220428669259, 159816179901613603012535458, -41528743386893454136857767, -67079427365369242577551037, 86502936742152988010290503, -79111976468602031123416811, 96697225747072887076692520, 170972634053536504956006285, -128627473393364184082833558, -76619941294683708425413780, 32147736410725055912417859, -38944311324028575451510416, 167348489967133077166035843, 175321922654154319561 -- (+1929 chars; full line in the Zenodo source)
[-50844213046452145891373727, 56167937352209261197385316, -32147736410725055912417859, -104590936698680931857445169, 159340191160152310567837989, -106893264818012378319067397, 19849022031345078349476758, 15243911426009537988401753, -21054736388588770148831736, -6973954038481374291029296, 17532192265415431956126443, -13345750106255249896261708, 61189080829566084885347563, -41528743386893454136857 -- (+1932 chars; full line in the Zenodo source)
[-59642413950548290577238710, 194404922036438741718753617, -15243911426009537988401753, -69520228079669729220686689, 45227498487512486047356770, -156621436198286521811807402, 67079427365369242577551037, 30799882186561349205545594, -150599608294857151689211513, 26556686315300333896155511, 8592145740181710933349911, 21672156876023586429074455, 140489952965661086240980348, -170972634053536504956006 -- (+1929 chars; full line in the Zenodo source)
[-167348489967133077166035843, 181213500938960582213963124, -33585097597353903072498425, -66159212594185177979601319, 100255124452569041068434831, -120781008240447402397518939, -6973954038481374291029296, 49438489306898625757806133, -59642413950548290577238710, 21054736388588770148831736, -62062777036114136995120841, 96697225747072887076692520, 79111976468602031123416811, -1338901985395650749496 -- (+1933 chars; full line in the Zenodo source)
[6973954038481374291029296, 133890198539565074949688655, -127155630212518598813962565, -79105545094145556944224869, 124535800299247616715942306, -129205962840221905360343360, 162041126600782461683636161, -11863318722957227430411332, -67079427365369242577551037, -3031766787128416012290277, -54707202196842460213897815, 160738112687421070243027685, 30799882186561349205545594, -202455623054545707903 -- (+1933 chars; full line in the Zenodo source)
[-72486097596569213728609545, 111292111114965095749154015, -45227498487512486047356770, -6063429440459179094677736, 41528743386893454136857767, -26556686315300333896155511, 61189080829566084885347563, -52319572160091513150712605, 79105545094145556944224869, 79111976468602031123416811, -181213500938960582213963124, 50844213046452145891373727, -54304914018205394822715251, -120454314633030803773565 -- (+1930 chars; full line in the Zenodo source)
[-86598227096219667752158881, 140489952965661086240980348, -103995684827690291987844087, 4897429739834380124338315, 28273723245527265079444637, -104616779848472220428669259, 181213500938960582213963124, -127155630212518598813962565, 19849022031345078349476758, -12626642539748325952081886, -26556686315300333896155511, 159816179901613603012535458, -15243911426009537988401753, -66159212594185177979 -- (+1933 chars; full line in the Zenodo source)
[-110598684837025646596213777, 128627473393364184082833558, 3031766787128416012290277, -1817370281808594867030975, 49438489306898625757806133, -86598227096219667752158881, 156621436198286521811807402, -159340191160152310567837989, 120454314633030803773565528, -46971200878372246312301548, -72486097596569213728609545, 140489952965661086240980348, -54707202196842460213897815, -216721568760235864290 -- (+1931 chars; full line in the Zenodo source)
[1817370281808594867030975, 159340191160152310567837989, -140489952965661086240980348, -6973954038481374291029296, -54304914018205394822715251, -4897429739834380124338315, 103264085663760195275366685, -133890198539565074949688655, 104616779848472220428669259, 8592145740181710933349911, 6063429440459179094677736, 127155630212518598813962565, -194404922036438741718753617, 7525934707018734766733550 -- (+1930 chars; full line in the Zenodo source)
[-120454314633030803773565528, 103995684827690291987844087, -54157678936027147618935387, 104616779848472220428669259, -30799882186561349205545594, -19849022031345078349476758, 33585097597353903072498425, -159816179901613603012535458, 152539081716872091542528167, -61451104913013598857393671, -79105545094145556944224869, 41528743386893454136857767, -13345750106255249896261708, 12078100824044740239 -- (+1932 chars; full line in the Zenodo source)
[21672156876023586429074455, 103264085663760195275366685, -181213500938960582213963124, 7525934707018734766733550, -32147736410725055912417859, 66159212594185177979601319, 60599011540279180595944117, -162041126600782461683636161, 120781008240447402397518939, -106893264818012378319067397, 120454314633030803773565528, -49438489306898625757806133, -67079427365369242577551037, 4522749848751248604735 -- (+1932 chars; full line in the Zenodo source)
[-67079427365369242577551037, 170972634053536504956006285, -38944311324028575451510416, -27406193354183017849564822, -62062777036114136995120841, 9427168298519291503319597, 28273723245527265079444637, -72486097596569213728609545, 159340191160152310567837989, -54157678936027147618935387, 13345750106255249896261708, -60599011540279180595944117, 66159212594185177979601319, -126266425397483259520818 -- (+1935 chars; full line in the Zenodo source)
[-4897429739834380124338315, 127155630212518598813962565, -159816179901613603012535458, 129205962840221905360343360, -43666791300637489790711953, 67079427365369242577551037, -49438489306898625757806133, -160738112687421070243027685, 79111976468602031123416811, -61189080829566084885347563, 56167937352209261197385316, -170972634053536504956006285, -21672156876023586429074455, 469712008783722463123 -- (+1932 chars; full line in the Zenodo source)
[-160738112687421070243027685, 100255124452569041068434831, 27406193354183017849564822, 21054736388588770148831736, -103995684827690291987844087, 72486097596569213728609545, 8592145740181710933349911, -81164392821706832284459249, 60599011540279180595944117, -104616779848472220428669259, 156621436198286521811807402, -111292111114965095749154015, 162041126600782461683636161, -124535800299247616715 -- (+1931 chars; full line in the Zenodo source)
[76619941294683708425413780, 62062777036114136995120841, -202455623054545707903831309, 54157678936027147618935387, -156621436198286521811807402, 111814967119492901432040492, -52319572160091513150712605, 19849022031345078349476758, 54304914018205394822715251, 21672156876023586429074455, 127155630212518598813962565, -152539081716872091542528167, 21054736388588770148831736, -54707202196842460213897 -- (+1934 chars; full line in the Zenodo source)
[-104590936698680931857445169, 15243911426009537988401753, -13345750106255249896261708, 156621436198286521811807402, -133890198539565074949688655, 150599608294857151689211513, -79111976468602031123416811, -21672156876023586429074455, 9333093018422928312112471, 79105545094145556944224869, -12626642539748325952081886, -167348489967133077166035843, 103995684827690291987844087, -38944311324028575451 -- (+1932 chars; full line in the Zenodo source)
[6063429440459179094677736, 52319572160091513150712605, -50844213046452145891373727, 54707202196842460213897815, -38944311324028575451510416, 56167937352209261197385316, -103995684827690291987844087, 59642413950548290577238710, -32147736410725055912417859, 9427168298519291503319597, 49438489306898625757806133, -104590936698680931857445169, 124535800299247616715942306, -10461677984847222042866925 -- (+1931 chars; full line in the Zenodo source)
[-9427168298519291503319597, 60599011540279180595944117, 6973954038481374291029296, 45227498487512486047356770, -152539081716872091542528167, 133890198539565074949688655, -86502936742152988010290503, 26556686315300333896155511, -127155630212518598813962565, 110598684837025646596213777, -86450439368334098694817000, -79105545094145556944224869, 17532192265415431956126443, 7661994129468370842541378 -- (+1934 chars; full line in the Zenodo source)
[-19849022031345078349476758, 41528743386893454136857767, -110598684837025646596213777, 79111976468602031123416811, -7525934707018734766733550, 128627473393364184082833558, -194404922036438741718753617, 38944311324028575451510416, 3031766787128416012290277, 162041126600782461683636161, -100255124452569041068434831, -1817370281808594867030975, -86450439368334098694817000, 695202280796697292206866 -- (+1930 chars; full line in the Zenodo source)
[-69520228079669729220686689, 30799882186561349205545594, 21672156876023586429074455, 61451104913013598857393671, -50844213046452145891373727, 103264085663760195275366685, 27406193354183017849564822, 86502936742152988010290503, -181213500938960582213963124, 56167937352209261197385316, 3031766787128416012290277, 7525934707018734766733550, -127155630212518598813962565, 72486097596569213728609545, -- (+1931 chars; full line in the Zenodo source)
[79105545094145556944224869, 11863318722957227430411332, -160738112687421070243027685, 32147736410725055912417859, -86598227096219667752158881, 100255124452569041068434831, -111814967119492901432040492, 106893264818012378319067397, 27406193354183017849564822, 140489952965661086240980348, -194404922036438741718753617, 21054736388588770148831736, -86502936742152988010290503, 1525390817168720915425 -- (+1930 chars; full line in the Zenodo source)
[-81164392821706832284459249, -9333093018422928312112471, 6063429440459179094677736, 86450439368334098694817000, -67079427365369242577551037, 52319572160091513150712605, -86598227096219667752158881, 33585097597353903072498425, -50844213046452145891373727, 170972634053536504956006285, -7525934707018734766733550, 54707202196842460213897815, -152539081716872091542528167, 140489952965661086240980348 -- (+1932 chars; full line in the Zenodo source)
[96697225747072887076692520, 17532192265415431956126443, -69520228079669729220686689, 28273723245527265079444637, 6063429440459179094677736, 30799882186561349205545594, -160738112687421070243027685, -12626642539748325952081886, 21672156876023586429074455, 52319572160091513150712605, -110598684837025646596213777, 61451104913013598857393671, 6973954038481374291029296, 100255124452569041068434831, -- (+1926 chars; full line in the Zenodo source)
[-66159212594185177979601319, 49438489306898625757806133, 96697225747072887076692520, -46971200878372246312301548, -81164392821706832284459249, 17532192265415431956126443, 79105545094145556944224869, 54304914018205394822715251, -69520228079669729220686689, -9333093018422928312112471, -19849022031345078349476758, 28273723245527265079444637, -9427168298519291503319597, 11863318722957227430411332, -- (+1929 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 81).map (fun t => rowA (162 + 1) t (rng 1 81)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 81 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 81 B A = sid 441491163384808559455646456668 81 := rfl
theorem d_ne : (441491163384808559455646456668 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 81 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 81) (h0 : mv A g = zeros 81) : g = zeros 81 :=
kernel_zero 81 441491163384808559455646456668 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 162 81 = true := rfl
/-- **Balanced ⇒ pairs for p = 163.** A list with entries in (0, 163) that is balanced for 1 ≤ t ≤ 81
has as many copies of x as of 163 − x for every 1 ≤ x ≤ 81 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 163)
(hb : ∀ t, 1 ≤ t → t < 1 + 81 → tsum 163 t c + tsum 163 t c = c.length * 163) :
(rng 1 81).all (fun x => Nat.beq (cnt x c) (cnt (163 - x) c)) = true :=
pairs_of_bal 162 81 441491163384808559455646456668 d_ne A B len cert A_def delta c hr hb
end MailletCert163
#print axioms MailletCert163.A_def
#print axioms MailletCert163.len
#print axioms MailletCert163.cert
#print axioms MailletCert163.d_ne
#print axioms MailletCert163.kernel
#print axioms MailletCert163.delta
#print axioms MailletCert163.pairs
lean_all/hodge/MailletCert167.lean
/-
hodge/MailletCert167.lean — T41 (goals G849b, G849c): for p = 167 the 83 × 83 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 83)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 9392477403327859681557337885594 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 167) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert167
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27, -25, -23, -21, -- (+46 chars; full line in the Zenodo source)
[-163, -159, -155, -151, -147, -143, -139, -135, -131, -127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 1 -- (+4 chars; full line in the Zenodo source)
[-161, -155, -149, -143, -137, -131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, -165, -159, -153, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45, -39, -33, -27, -- (+18 chars; full line in the Zenodo source)
[-159, -151, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145, 153, 161, -165, -157, -149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 1 -- (+4 chars; full line in the Zenodo source)
[-157, -147, -137, -127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, 153, 163, -161, -151, -141, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, 159, -165, -155, -145, -135, -125, -115, -105, -95, -85, -75, -65, -55, -45, -35, - -- (+13 chars; full line in the Zenodo source)
[-155, -143, -131, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145, 157, -165, -153, -141, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, 135, 147, 159, -163, -151, -139, -127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89, 101, 113, 125, 137, 149, 1 -- (+4 chars; full line in the Zenodo source)
[-153, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, -165, -151, -137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, 143, 157, -163, -149, -135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, 145, 159, -161, -147, -133, -119, -105, -91, -77, -63, -49, -35, -- (+10 chars; full line in the Zenodo source)
[-151, -135, -119, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, 121, 137, 153, -165, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, 155, -163, -147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, 141, 157, -161, -145, -129, -113, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, 127, 143, -- (+6 chars; full line in the Zenodo source)
[-149, -131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, 139, 157, -159, -141, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, 147, 165, -151, -133, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, 137, 155, -161, -143, -125, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, 127, 145, 163, -153, -135, -117, -99, -81, -63, -45, - -- (+8 chars; full line in the Zenodo source)
[-147, -127, -107, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, 113, 133, 153, -161, -141, -121, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, 119, 139, 159, -155, -135, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, 145, 165, -149, -129, -109, -89, -69, -49, -29, -9, 11, 31, 51, 71, 91, 111, 131, 151, -163, -143, -123, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, 117, 137, -- (+5 chars; full line in the Zenodo source)
[-145, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, 141, 163, -149, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, 159, -153, -131, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, 133, 155, -157, -135, -113, -91, -69, -47, -25, -3, 19, 41, 63, 85, 107, 129, 151, -161, -139, -117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, 147, -165, -143, -121, -99, -77, -55, -3 -- (+8 chars; full line in the Zenodo source)
[-143, -119, -95, -71, -47, -23, 1, 25, 49, 73, 97, 121, 145, -165, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, -163, -139, -115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125, 149, -161, -137, -113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127, 151, -159, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, 153, -157, -133, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, 131, 1 -- (+4 chars; full line in the Zenodo source)
[-141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, -163, -137, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, 149, -159, -133, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, 153, -155, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, 157, -151, -125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, 161, -147, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, 139, 165, -143, -117, -91, -65, -39 -- (+7 chars; full line in the Zenodo source)
[-139, -111, -83, -55, -27, 1, 29, 57, 85, 113, 141, -165, -137, -109, -81, -53, -25, 3, 31, 59, 87, 115, 143, -163, -135, -107, -79, -51, -23, 5, 33, 61, 89, 117, 145, -161, -133, -105, -77, -49, -21, 7, 35, 63, 91, 119, 147, -159, -131, -103, -75, -47, -19, 9, 37, 65, 93, 121, 149, -157, -129, -101, -73, -45, -17, 11, 39, 67, 95, 123, 151, -155, -127, -99, -71, -43, -15, 13, 41, 69, 97, 125, 1 -- (+4 chars; full line in the Zenodo source)
[-137, -107, -77, -47, -17, 13, 43, 73, 103, 133, 163, -141, -111, -81, -51, -21, 9, 39, 69, 99, 129, 159, -145, -115, -85, -55, -25, 5, 35, 65, 95, 125, 155, -149, -119, -89, -59, -29, 1, 31, 61, 91, 121, 151, -153, -123, -93, -63, -33, -3, 27, 57, 87, 117, 147, -157, -127, -97, -67, -37, -7, 23, 53, 83, 113, 143, -161, -131, -101, -71, -41, -11, 19, 49, 79, 109, 139, -165, -135, -105, -75, -45 -- (+7 chars; full line in the Zenodo source)
[-135, -103, -71, -39, -7, 25, 57, 89, 121, 153, -149, -117, -85, -53, -21, 11, 43, 75, 107, 139, -163, -131, -99, -67, -35, -3, 29, 61, 93, 125, 157, -145, -113, -81, -49, -17, 15, 47, 79, 111, 143, -159, -127, -95, -63, -31, 1, 33, 65, 97, 129, 161, -141, -109, -77, -45, -13, 19, 51, 83, 115, 147, -155, -123, -91, -59, -27, 5, 37, 69, 101, 133, 165, -137, -105, -73, -41, -9, 23, 55, 87, 119, 1 -- (+4 chars; full line in the Zenodo source)
[-133, -99, -65, -31, 3, 37, 71, 105, 139, -161, -127, -93, -59, -25, 9, 43, 77, 111, 145, -155, -121, -87, -53, -19, 15, 49, 83, 117, 151, -149, -115, -81, -47, -13, 21, 55, 89, 123, 157, -143, -109, -75, -41, -7, 27, 61, 95, 129, 163, -137, -103, -69, -35, -1, 33, 67, 101, 135, -165, -131, -97, -63, -29, 5, 39, 73, 107, 141, -159, -125, -91, -57, -23, 11, 45, 79, 113, 147, -153, -119, -85, -51 -- (+7 chars; full line in the Zenodo source)
[-131, -95, -59, -23, 13, 49, 85, 121, 157, -141, -105, -69, -33, 3, 39, 75, 111, 147, -151, -115, -79, -43, -7, 29, 65, 101, 137, -161, -125, -89, -53, -17, 19, 55, 91, 127, 163, -135, -99, -63, -27, 9, 45, 81, 117, 153, -145, -109, -73, -37, -1, 35, 71, 107, 143, -155, -119, -83, -47, -11, 25, 61, 97, 133, -165, -129, -93, -57, -21, 15, 51, 87, 123, 159, -139, -103, -67, -31, 5, 41, 77, 113, 1 -- (+4 chars; full line in the Zenodo source)
[-129, -91, -53, -15, 23, 61, 99, 137, -159, -121, -83, -45, -7, 31, 69, 107, 145, -151, -113, -75, -37, 1, 39, 77, 115, 153, -143, -105, -67, -29, 9, 47, 85, 123, 161, -135, -97, -59, -21, 17, 55, 93, 131, -165, -127, -89, -51, -13, 25, 63, 101, 139, -157, -119, -81, -43, -5, 33, 71, 109, 147, -149, -111, -73, -35, 3, 41, 79, 117, 155, -141, -103, -65, -27, 11, 49, 87, 125, 163, -133, -95, -57, -- (+6 chars; full line in the Zenodo source)
[-127, -87, -47, -7, 33, 73, 113, 153, -141, -101, -61, -21, 19, 59, 99, 139, -155, -115, -75, -35, 5, 45, 85, 125, 165, -129, -89, -49, -9, 31, 71, 111, 151, -143, -103, -63, -23, 17, 57, 97, 137, -157, -117, -77, -37, 3, 43, 83, 123, 163, -131, -91, -51, -11, 29, 69, 109, 149, -145, -105, -65, -25, 15, 55, 95, 135, -159, -119, -79, -39, 1, 41, 81, 121, 161, -133, -93, -53, -13, 27, 67, 107, 14 -- (+3 chars; full line in the Zenodo source)
[-125, -83, -41, 1, 43, 85, 127, -165, -123, -81, -39, 3, 45, 87, 129, -163, -121, -79, -37, 5, 47, 89, 131, -161, -119, -77, -35, 7, 49, 91, 133, -159, -117, -75, -33, 9, 51, 93, 135, -157, -115, -73, -31, 11, 53, 95, 137, -155, -113, -71, -29, 13, 55, 97, 139, -153, -111, -69, -27, 15, 57, 99, 141, -151, -109, -67, -25, 17, 59, 101, 143, -149, -107, -65, -23, 19, 61, 103, 145, -147, -105, -63, -- (+6 chars; full line in the Zenodo source)
[-123, -79, -35, 9, 53, 97, 141, -149, -105, -61, -17, 27, 71, 115, 159, -131, -87, -43, 1, 45, 89, 133, -157, -113, -69, -25, 19, 63, 107, 151, -139, -95, -51, -7, 37, 81, 125, -165, -121, -77, -33, 11, 55, 99, 143, -147, -103, -59, -15, 29, 73, 117, 161, -129, -85, -41, 3, 47, 91, 135, -155, -111, -67, -23, 21, 65, 109, 153, -137, -93, -49, -5, 39, 83, 127, -163, -119, -75, -31, 13, 57, 101, 1 -- (+4 chars; full line in the Zenodo source)
[-121, -75, -29, 17, 63, 109, 155, -133, -87, -41, 5, 51, 97, 143, -145, -99, -53, -7, 39, 85, 131, -157, -111, -65, -19, 27, 73, 119, 165, -123, -77, -31, 15, 61, 107, 153, -135, -89, -43, 3, 49, 95, 141, -147, -101, -55, -9, 37, 83, 129, -159, -113, -67, -21, 25, 71, 117, 163, -125, -79, -33, 13, 59, 105, 151, -137, -91, -45, 1, 47, 93, 139, -149, -103, -57, -11, 35, 81, 127, -161, -115, -69, -- (+5 chars; full line in the Zenodo source)
[-119, -71, -23, 25, 73, 121, -165, -117, -69, -21, 27, 75, 123, -163, -115, -67, -19, 29, 77, 125, -161, -113, -65, -17, 31, 79, 127, -159, -111, -63, -15, 33, 81, 129, -157, -109, -61, -13, 35, 83, 131, -155, -107, -59, -11, 37, 85, 133, -153, -105, -57, -9, 39, 87, 135, -151, -103, -55, -7, 41, 89, 137, -149, -101, -53, -5, 43, 91, 139, -147, -99, -51, -3, 45, 93, 141, -145, -97, -49, -1, 47, -- (+10 chars; full line in the Zenodo source)
[-117, -67, -17, 33, 83, 133, -151, -101, -51, -1, 49, 99, 149, -135, -85, -35, 15, 65, 115, 165, -119, -69, -19, 31, 81, 131, -153, -103, -53, -3, 47, 97, 147, -137, -87, -37, 13, 63, 113, 163, -121, -71, -21, 29, 79, 129, -155, -105, -55, -5, 45, 95, 145, -139, -89, -39, 11, 61, 111, 161, -123, -73, -23, 27, 77, 127, -157, -107, -57, -7, 43, 93, 143, -141, -91, -41, 9, 59, 109, 159, -125, -75, -- (+6 chars; full line in the Zenodo source)
[-115, -63, -11, 41, 93, 145, -137, -85, -33, 19, 71, 123, -159, -107, -55, -3, 49, 101, 153, -129, -77, -25, 27, 79, 131, -151, -99, -47, 5, 57, 109, 161, -121, -69, -17, 35, 87, 139, -143, -91, -39, 13, 65, 117, -165, -113, -61, -9, 43, 95, 147, -135, -83, -31, 21, 73, 125, -157, -105, -53, -1, 51, 103, 155, -127, -75, -23, 29, 81, 133, -149, -97, -45, 7, 59, 111, 163, -119, -67, -15, 37, 89, -- (+5 chars; full line in the Zenodo source)
[-113, -59, -5, 49, 103, 157, -123, -69, -15, 39, 93, 147, -133, -79, -25, 29, 83, 137, -143, -89, -35, 19, 73, 127, -153, -99, -45, 9, 63, 117, -163, -109, -55, -1, 53, 107, 161, -119, -65, -11, 43, 97, 151, -129, -75, -21, 33, 87, 141, -139, -85, -31, 23, 77, 131, -149, -95, -41, 13, 67, 121, -159, -105, -51, 3, 57, 111, 165, -115, -61, -7, 47, 101, 155, -125, -71, -17, 37, 91, 145, -135, -81, -- (+6 chars; full line in the Zenodo source)
[-111, -55, 1, 57, 113, -165, -109, -53, 3, 59, 115, -163, -107, -51, 5, 61, 117, -161, -105, -49, 7, 63, 119, -159, -103, -47, 9, 65, 121, -157, -101, -45, 11, 67, 123, -155, -99, -43, 13, 69, 125, -153, -97, -41, 15, 71, 127, -151, -95, -39, 17, 73, 129, -149, -93, -37, 19, 75, 131, -147, -91, -35, 21, 77, 133, -145, -89, -33, 23, 79, 135, -143, -87, -31, 25, 81, 137, -141, -85, -29, 27, 83, 1 -- (+4 chars; full line in the Zenodo source)
[-109, -51, 7, 65, 123, -153, -95, -37, 21, 79, 137, -139, -81, -23, 35, 93, 151, -125, -67, -9, 49, 107, 165, -111, -53, 5, 63, 121, -155, -97, -39, 19, 77, 135, -141, -83, -25, 33, 91, 149, -127, -69, -11, 47, 105, 163, -113, -55, 3, 61, 119, -157, -99, -41, 17, 75, 133, -143, -85, -27, 31, 89, 147, -129, -71, -13, 45, 103, 161, -115, -57, 1, 59, 117, -159, -101, -43, 15, 73, 131, -145, -87, - -- (+4 chars; full line in the Zenodo source)
[-107, -47, 13, 73, 133, -141, -81, -21, 39, 99, 159, -115, -55, 5, 65, 125, -149, -89, -29, 31, 91, 151, -123, -63, -3, 57, 117, -157, -97, -37, 23, 83, 143, -131, -71, -11, 49, 109, -165, -105, -45, 15, 75, 135, -139, -79, -19, 41, 101, 161, -113, -53, 7, 67, 127, -147, -87, -27, 33, 93, 153, -121, -61, -1, 59, 119, -155, -95, -35, 25, 85, 145, -129, -69, -9, 51, 111, -163, -103, -43, 17, 77, -- (+5 chars; full line in the Zenodo source)
[-105, -43, 19, 81, 143, -129, -67, -5, 57, 119, -153, -91, -29, 33, 95, 157, -115, -53, 9, 71, 133, -139, -77, -15, 47, 109, -163, -101, -39, 23, 85, 147, -125, -63, -1, 61, 123, -149, -87, -25, 37, 99, 161, -111, -49, 13, 75, 137, -135, -73, -11, 51, 113, -159, -97, -35, 27, 89, 151, -121, -59, 3, 65, 127, -145, -83, -21, 41, 103, 165, -107, -45, 17, 79, 141, -131, -69, -7, 55, 117, -155, -93, -- (+6 chars; full line in the Zenodo source)
[-103, -39, 25, 89, 153, -117, -53, 11, 75, 139, -131, -67, -3, 61, 125, -145, -81, -17, 47, 111, -159, -95, -31, 33, 97, 161, -109, -45, 19, 83, 147, -123, -59, 5, 69, 133, -137, -73, -9, 55, 119, -151, -87, -23, 41, 105, -165, -101, -37, 27, 91, 155, -115, -51, 13, 77, 141, -129, -65, -1, 63, 127, -143, -79, -15, 49, 113, -157, -93, -29, 35, 99, 163, -107, -43, 21, 85, 149, -121, -57, 7, 71, 1 -- (+4 chars; full line in the Zenodo source)
[-101, -35, 31, 97, 163, -105, -39, 27, 93, 159, -109, -43, 23, 89, 155, -113, -47, 19, 85, 151, -117, -51, 15, 81, 147, -121, -55, 11, 77, 143, -125, -59, 7, 73, 139, -129, -63, 3, 69, 135, -133, -67, -1, 65, 131, -137, -71, -5, 61, 127, -141, -75, -9, 57, 123, -145, -79, -13, 53, 119, -149, -83, -17, 49, 115, -153, -87, -21, 45, 111, -157, -91, -25, 41, 107, -161, -95, -29, 37, 103, -165, -99, -- (+6 chars; full line in the Zenodo source)
[-99, -31, 37, 105, -161, -93, -25, 43, 111, -155, -87, -19, 49, 117, -149, -81, -13, 55, 123, -143, -75, -7, 61, 129, -137, -69, -1, 67, 135, -131, -63, 5, 73, 141, -125, -57, 11, 79, 147, -119, -51, 17, 85, 153, -113, -45, 23, 91, 159, -107, -39, 29, 97, 165, -101, -33, 35, 103, -163, -95, -27, 41, 109, -157, -89, -21, 47, 115, -151, -83, -15, 53, 121, -145, -77, -9, 59, 127, -139, -71, -3, 65 -- (+7 chars; full line in the Zenodo source)
[-97, -27, 43, 113, -151, -81, -11, 59, 129, -135, -65, 5, 75, 145, -119, -49, 21, 91, 161, -103, -33, 37, 107, -157, -87, -17, 53, 123, -141, -71, -1, 69, 139, -125, -55, 15, 85, 155, -109, -39, 31, 101, -163, -93, -23, 47, 117, -147, -77, -7, 63, 133, -131, -61, 9, 79, 149, -115, -45, 25, 95, 165, -99, -29, 41, 111, -153, -83, -13, 57, 127, -137, -67, 3, 73, 143, -121, -51, 19, 89, 159, -105, -- (+5 chars; full line in the Zenodo source)
[-95, -23, 49, 121, -141, -69, 3, 75, 147, -115, -43, 29, 101, -161, -89, -17, 55, 127, -135, -63, 9, 81, 153, -109, -37, 35, 107, -155, -83, -11, 61, 133, -129, -57, 15, 87, 159, -103, -31, 41, 113, -149, -77, -5, 67, 139, -123, -51, 21, 93, 165, -97, -25, 47, 119, -143, -71, 1, 73, 145, -117, -45, 27, 99, -163, -91, -19, 53, 125, -137, -65, 7, 79, 151, -111, -39, 33, 105, -157, -85, -13, 59, 1 -- (+4 chars; full line in the Zenodo source)
[-93, -19, 55, 129, -131, -57, 17, 91, 165, -95, -21, 53, 127, -133, -59, 15, 89, 163, -97, -23, 51, 125, -135, -61, 13, 87, 161, -99, -25, 49, 123, -137, -63, 11, 85, 159, -101, -27, 47, 121, -139, -65, 9, 83, 157, -103, -29, 45, 119, -141, -67, 7, 81, 155, -105, -31, 43, 117, -143, -69, 5, 79, 153, -107, -33, 41, 115, -145, -71, 3, 77, 151, -109, -35, 39, 113, -147, -73, 1, 75, 149, -111, -37] -- (+1 chars; full line in the Zenodo source)
[-91, -15, 61, 137, -121, -45, 31, 107, -151, -75, 1, 77, 153, -105, -29, 47, 123, -135, -59, 17, 93, -165, -89, -13, 63, 139, -119, -43, 33, 109, -149, -73, 3, 79, 155, -103, -27, 49, 125, -133, -57, 19, 95, -163, -87, -11, 65, 141, -117, -41, 35, 111, -147, -71, 5, 81, 157, -101, -25, 51, 127, -131, -55, 21, 97, -161, -85, -9, 67, 143, -115, -39, 37, 113, -145, -69, 7, 83, 159, -99, -23, 53, 1 -- (+4 chars; full line in the Zenodo source)
[-89, -11, 67, 145, -111, -33, 45, 123, -133, -55, 23, 101, -155, -77, 1, 79, 157, -99, -21, 57, 135, -121, -43, 35, 113, -143, -65, 13, 91, -165, -87, -9, 69, 147, -109, -31, 47, 125, -131, -53, 25, 103, -153, -75, 3, 81, 159, -97, -19, 59, 137, -119, -41, 37, 115, -141, -63, 15, 93, -163, -85, -7, 71, 149, -107, -29, 49, 127, -129, -51, 27, 105, -151, -73, 5, 83, 161, -95, -17, 61, 139, -117, -- (+5 chars; full line in the Zenodo source)
[-87, -7, 73, 153, -101, -21, 59, 139, -115, -35, 45, 125, -129, -49, 31, 111, -143, -63, 17, 97, -157, -77, 3, 83, 163, -91, -11, 69, 149, -105, -25, 55, 135, -119, -39, 41, 121, -133, -53, 27, 107, -147, -67, 13, 93, -161, -81, -1, 79, 159, -95, -15, 65, 145, -109, -29, 51, 131, -123, -43, 37, 117, -137, -57, 23, 103, -151, -71, 9, 89, -165, -85, -5, 75, 155, -99, -19, 61, 141, -113, -33, 47, -- (+5 chars; full line in the Zenodo source)
[-85, -3, 79, 161, -91, -9, 73, 155, -97, -15, 67, 149, -103, -21, 61, 143, -109, -27, 55, 137, -115, -33, 49, 131, -121, -39, 43, 125, -127, -45, 37, 119, -133, -51, 31, 113, -139, -57, 25, 107, -145, -63, 19, 101, -151, -69, 13, 95, -157, -75, 7, 89, -163, -81, 1, 83, 165, -87, -5, 77, 159, -93, -11, 71, 153, -99, -17, 65, 147, -105, -23, 59, 141, -111, -29, 53, 135, -117, -35, 47, 129, -123, -- (+5 chars; full line in the Zenodo source)
[-83, 1, 85, -165, -81, 3, 87, -163, -79, 5, 89, -161, -77, 7, 91, -159, -75, 9, 93, -157, -73, 11, 95, -155, -71, 13, 97, -153, -69, 15, 99, -151, -67, 17, 101, -149, -65, 19, 103, -147, -63, 21, 105, -145, -61, 23, 107, -143, -59, 25, 109, -141, -57, 27, 111, -139, -55, 29, 113, -137, -53, 31, 115, -135, -51, 33, 117, -133, -49, 35, 119, -131, -47, 37, 121, -129, -45, 39, 123, -127, -43, 41, 1 -- (+4 chars; full line in the Zenodo source)
[-81, 5, 91, -157, -71, 15, 101, -147, -61, 25, 111, -137, -51, 35, 121, -127, -41, 45, 131, -117, -31, 55, 141, -107, -21, 65, 151, -97, -11, 75, 161, -87, -1, 85, -163, -77, 9, 95, -153, -67, 19, 105, -143, -57, 29, 115, -133, -47, 39, 125, -123, -37, 49, 135, -113, -27, 59, 145, -103, -17, 69, 155, -93, -7, 79, 165, -83, 3, 89, -159, -73, 13, 99, -149, -63, 23, 109, -139, -53, 33, 119, -129, -- (+5 chars; full line in the Zenodo source)
[-79, 9, 97, -149, -61, 27, 115, -131, -43, 45, 133, -113, -25, 63, 151, -95, -7, 81, -165, -77, 11, 99, -147, -59, 29, 117, -129, -41, 47, 135, -111, -23, 65, 153, -93, -5, 83, -163, -75, 13, 101, -145, -57, 31, 119, -127, -39, 49, 137, -109, -21, 67, 155, -91, -3, 85, -161, -73, 15, 103, -143, -55, 33, 121, -125, -37, 51, 139, -107, -19, 69, 157, -89, -1, 87, -159, -71, 17, 105, -141, -53, 35, -- (+6 chars; full line in the Zenodo source)
[-77, 13, 103, -141, -51, 39, 129, -115, -25, 65, 155, -89, 1, 91, -153, -63, 27, 117, -127, -37, 53, 143, -101, -11, 79, -165, -75, 15, 105, -139, -49, 41, 131, -113, -23, 67, 157, -87, 3, 93, -151, -61, 29, 119, -125, -35, 55, 145, -99, -9, 81, -163, -73, 17, 107, -137, -47, 43, 133, -111, -21, 69, 159, -85, 5, 95, -149, -59, 31, 121, -123, -33, 57, 147, -97, -7, 83, -161, -71, 19, 109, -135, -- (+5 chars; full line in the Zenodo source)
[-75, 17, 109, -133, -41, 51, 143, -99, -7, 85, -157, -65, 27, 119, -123, -31, 61, 153, -89, 3, 95, -147, -55, 37, 129, -113, -21, 71, 163, -79, 13, 105, -137, -45, 47, 139, -103, -11, 81, -161, -69, 23, 115, -127, -35, 57, 149, -93, -1, 91, -151, -59, 33, 125, -117, -25, 67, 159, -83, 9, 101, -141, -49, 43, 135, -107, -15, 77, -165, -73, 19, 111, -131, -39, 53, 145, -97, -5, 87, -155, -63, 29, -- (+5 chars; full line in the Zenodo source)
[-73, 21, 115, -125, -31, 63, 157, -83, 11, 105, -135, -41, 53, 147, -93, 1, 95, -145, -51, 43, 137, -103, -9, 85, -155, -61, 33, 127, -113, -19, 75, -165, -71, 23, 117, -123, -29, 65, 159, -81, 13, 107, -133, -39, 55, 149, -91, 3, 97, -143, -49, 45, 139, -101, -7, 87, -153, -59, 35, 129, -111, -17, 77, -163, -69, 25, 119, -121, -27, 67, 161, -79, 15, 109, -131, -37, 57, 151, -89, 5, 99, -141, - -- (+4 chars; full line in the Zenodo source)
[-71, 25, 121, -117, -21, 75, -163, -67, 29, 125, -113, -17, 79, -159, -63, 33, 129, -109, -13, 83, -155, -59, 37, 133, -105, -9, 87, -151, -55, 41, 137, -101, -5, 91, -147, -51, 45, 141, -97, -1, 95, -143, -47, 49, 145, -93, 3, 99, -139, -43, 53, 149, -89, 7, 103, -135, -39, 57, 153, -85, 11, 107, -131, -35, 61, 157, -81, 15, 111, -127, -31, 65, 161, -77, 19, 115, -123, -27, 69, 165, -73, 23, 1 -- (+4 chars; full line in the Zenodo source)
[-69, 29, 127, -109, -11, 87, -149, -51, 47, 145, -91, 7, 105, -131, -33, 65, 163, -73, 25, 123, -113, -15, 83, -153, -55, 43, 141, -95, 3, 101, -135, -37, 61, 159, -77, 21, 119, -117, -19, 79, -157, -59, 39, 137, -99, -1, 97, -139, -41, 57, 155, -81, 17, 115, -121, -23, 75, -161, -63, 35, 133, -103, -5, 93, -143, -45, 53, 151, -85, 13, 111, -125, -27, 71, -165, -67, 31, 129, -107, -9, 89, -147, -- (+6 chars; full line in the Zenodo source)
[-67, 33, 133, -101, -1, 99, -135, -35, 65, 165, -69, 31, 131, -103, -3, 97, -137, -37, 63, 163, -71, 29, 129, -105, -5, 95, -139, -39, 61, 161, -73, 27, 127, -107, -7, 93, -141, -41, 59, 159, -75, 25, 125, -109, -9, 91, -143, -43, 57, 157, -77, 23, 123, -111, -11, 89, -145, -45, 55, 155, -79, 21, 121, -113, -13, 87, -147, -47, 53, 153, -81, 19, 119, -115, -15, 85, -149, -49, 51, 151, -83, 17, 1 -- (+4 chars; full line in the Zenodo source)
[-65, 37, 139, -93, 9, 111, -121, -19, 83, -149, -47, 55, 157, -75, 27, 129, -103, -1, 101, -131, -29, 73, -159, -57, 45, 147, -85, 17, 119, -113, -11, 91, -141, -39, 63, 165, -67, 35, 137, -95, 7, 109, -123, -21, 81, -151, -49, 53, 155, -77, 25, 127, -105, -3, 99, -133, -31, 71, -161, -59, 43, 145, -87, 15, 117, -115, -13, 89, -143, -41, 61, 163, -69, 33, 135, -97, 5, 107, -125, -23, 79, -153, -- (+5 chars; full line in the Zenodo source)
[-63, 41, 145, -85, 19, 123, -107, -3, 101, -129, -25, 79, -151, -47, 57, 161, -69, 35, 139, -91, 13, 117, -113, -9, 95, -135, -31, 73, -157, -53, 51, 155, -75, 29, 133, -97, 7, 111, -119, -15, 89, -141, -37, 67, -163, -59, 45, 149, -81, 23, 127, -103, 1, 105, -125, -21, 83, -147, -43, 61, 165, -65, 39, 143, -87, 17, 121, -109, -5, 99, -131, -27, 77, -153, -49, 55, 159, -71, 33, 137, -93, 11, 11 -- (+3 chars; full line in the Zenodo source)
[-61, 45, 151, -77, 29, 135, -93, 13, 119, -109, -3, 103, -125, -19, 87, -141, -35, 71, -157, -51, 55, 161, -67, 39, 145, -83, 23, 129, -99, 7, 113, -115, -9, 97, -131, -25, 81, -147, -41, 65, -163, -57, 49, 155, -73, 33, 139, -89, 17, 123, -105, 1, 107, -121, -15, 91, -137, -31, 75, -153, -47, 59, 165, -63, 43, 149, -79, 27, 133, -95, 11, 117, -111, -5, 101, -127, -21, 85, -143, -37, 69, -159, -- (+5 chars; full line in the Zenodo source)
[-59, 49, 157, -69, 39, 147, -79, 29, 137, -89, 19, 127, -99, 9, 117, -109, -1, 107, -119, -11, 97, -129, -21, 87, -139, -31, 77, -149, -41, 67, -159, -51, 57, 165, -61, 47, 155, -71, 37, 145, -81, 27, 135, -91, 17, 125, -101, 7, 115, -111, -3, 105, -121, -13, 95, -131, -23, 85, -141, -33, 75, -151, -43, 65, -161, -53, 55, 163, -63, 45, 153, -73, 35, 143, -83, 25, 133, -93, 15, 123, -103, 5, 113 -- (+2 chars; full line in the Zenodo source)
[-57, 53, 163, -61, 49, 159, -65, 45, 155, -69, 41, 151, -73, 37, 147, -77, 33, 143, -81, 29, 139, -85, 25, 135, -89, 21, 131, -93, 17, 127, -97, 13, 123, -101, 9, 119, -105, 5, 115, -109, 1, 111, -113, -3, 107, -117, -7, 103, -121, -11, 99, -125, -15, 95, -129, -19, 91, -133, -23, 87, -137, -27, 83, -141, -31, 79, -145, -35, 75, -149, -39, 71, -153, -43, 67, -157, -47, 63, -161, -51, 59, -165, -- (+5 chars; full line in the Zenodo source)
[-55, 57, -165, -53, 59, -163, -51, 61, -161, -49, 63, -159, -47, 65, -157, -45, 67, -155, -43, 69, -153, -41, 71, -151, -39, 73, -149, -37, 75, -147, -35, 77, -145, -33, 79, -143, -31, 81, -141, -29, 83, -139, -27, 85, -137, -25, 87, -135, -23, 89, -133, -21, 91, -131, -19, 93, -129, -17, 95, -127, -15, 97, -125, -13, 99, -123, -11, 101, -121, -9, 103, -119, -7, 105, -117, -5, 107, -115, -3, 10 -- (+18 chars; full line in the Zenodo source)
[-53, 61, -159, -45, 69, -151, -37, 77, -143, -29, 85, -135, -21, 93, -127, -13, 101, -119, -5, 109, -111, 3, 117, -103, 11, 125, -95, 19, 133, -87, 27, 141, -79, 35, 149, -71, 43, 157, -63, 51, 165, -55, 59, -161, -47, 67, -153, -39, 75, -145, -31, 83, -137, -23, 91, -129, -15, 99, -121, -7, 107, -113, 1, 115, -105, 9, 123, -97, 17, 131, -89, 25, 139, -81, 33, 147, -73, 41, 155, -65, 49, 163, - -- (+4 chars; full line in the Zenodo source)
[-51, 65, -153, -37, 79, -139, -23, 93, -125, -9, 107, -111, 5, 121, -97, 19, 135, -83, 33, 149, -69, 47, 163, -55, 61, -157, -41, 75, -143, -27, 89, -129, -13, 103, -115, 1, 117, -101, 15, 131, -87, 29, 145, -73, 43, 159, -59, 57, -161, -45, 71, -147, -31, 85, -133, -17, 99, -119, -3, 113, -105, 11, 127, -91, 25, 141, -77, 39, 155, -63, 53, -165, -49, 67, -151, -35, 81, -137, -21, 95, -123, -7, -- (+6 chars; full line in the Zenodo source)
[-49, 69, -147, -29, 89, -127, -9, 109, -107, 11, 129, -87, 31, 149, -67, 51, -165, -47, 71, -145, -27, 91, -125, -7, 111, -105, 13, 131, -85, 33, 151, -65, 53, -163, -45, 73, -143, -25, 93, -123, -5, 113, -103, 15, 133, -83, 35, 153, -63, 55, -161, -43, 75, -141, -23, 95, -121, -3, 115, -101, 17, 135, -81, 37, 155, -61, 57, -159, -41, 77, -139, -21, 97, -119, -1, 117, -99, 19, 137, -79, 39, 157 -- (+7 chars; full line in the Zenodo source)
[-47, 73, -141, -21, 99, -115, 5, 125, -89, 31, 151, -63, 57, -157, -37, 83, -131, -11, 109, -105, 15, 135, -79, 41, 161, -53, 67, -147, -27, 93, -121, -1, 119, -95, 25, 145, -69, 51, -163, -43, 77, -137, -17, 103, -111, 9, 129, -85, 35, 155, -59, 61, -153, -33, 87, -127, -7, 113, -101, 19, 139, -75, 45, 165, -49, 71, -143, -23, 97, -117, 3, 123, -91, 29, 149, -65, 55, -159, -39, 81, -133, -13, -- (+5 chars; full line in the Zenodo source)
[-45, 77, -135, -13, 109, -103, 19, 141, -71, 51, -161, -39, 83, -129, -7, 115, -97, 25, 147, -65, 57, -155, -33, 89, -123, -1, 121, -91, 31, 153, -59, 63, -149, -27, 95, -117, 5, 127, -85, 37, 159, -53, 69, -143, -21, 101, -111, 11, 133, -79, 43, 165, -47, 75, -137, -15, 107, -105, 17, 139, -73, 49, -163, -41, 81, -131, -9, 113, -99, 23, 145, -67, 55, -157, -35, 87, -125, -3, 119, -93, 29, 151, -- (+6 chars; full line in the Zenodo source)
[-43, 81, -129, -5, 119, -91, 33, 157, -53, 71, -139, -15, 109, -101, 23, 147, -63, 61, -149, -25, 99, -111, 13, 137, -73, 51, -159, -35, 89, -121, 3, 127, -83, 41, 165, -45, 79, -131, -7, 117, -93, 31, 155, -55, 69, -141, -17, 107, -103, 21, 145, -65, 59, -151, -27, 97, -113, 11, 135, -75, 49, -161, -37, 87, -123, 1, 125, -85, 39, 163, -47, 77, -133, -9, 115, -95, 29, 153, -57, 67, -143, -19, 1 -- (+4 chars; full line in the Zenodo source)
[-41, 85, -123, 3, 129, -79, 47, -161, -35, 91, -117, 9, 135, -73, 53, -155, -29, 97, -111, 15, 141, -67, 59, -149, -23, 103, -105, 21, 147, -61, 65, -143, -17, 109, -99, 27, 153, -55, 71, -137, -11, 115, -93, 33, 159, -49, 77, -131, -5, 121, -87, 39, 165, -43, 83, -125, 1, 127, -81, 45, -163, -37, 89, -119, 7, 133, -75, 51, -157, -31, 95, -113, 13, 139, -69, 57, -151, -25, 101, -107, 19, 145, - -- (+4 chars; full line in the Zenodo source)
[-39, 89, -117, 11, 139, -67, 61, -145, -17, 111, -95, 33, 161, -45, 83, -123, 5, 133, -73, 55, -151, -23, 105, -101, 27, 155, -51, 77, -129, -1, 127, -79, 49, -157, -29, 99, -107, 21, 149, -57, 71, -135, -7, 121, -85, 43, -163, -35, 93, -113, 15, 143, -63, 65, -141, -13, 115, -91, 37, 165, -41, 87, -119, 9, 137, -69, 59, -147, -19, 109, -97, 31, 159, -47, 81, -125, 3, 131, -75, 53, -153, -25, 1 -- (+4 chars; full line in the Zenodo source)
[-37, 93, -111, 19, 149, -55, 75, -129, 1, 131, -73, 57, -147, -17, 113, -91, 39, -165, -35, 95, -109, 21, 151, -53, 77, -127, 3, 133, -71, 59, -145, -15, 115, -89, 41, -163, -33, 97, -107, 23, 153, -51, 79, -125, 5, 135, -69, 61, -143, -13, 117, -87, 43, -161, -31, 99, -105, 25, 155, -49, 81, -123, 7, 137, -67, 63, -141, -11, 119, -85, 45, -159, -29, 101, -103, 27, 157, -47, 83, -121, 9, 139, - -- (+4 chars; full line in the Zenodo source)
[-35, 97, -105, 27, 159, -43, 89, -113, 19, 151, -51, 81, -121, 11, 143, -59, 73, -129, 3, 135, -67, 65, -137, -5, 127, -75, 57, -145, -13, 119, -83, 49, -153, -21, 111, -91, 41, -161, -29, 103, -99, 33, 165, -37, 95, -107, 25, 157, -45, 87, -115, 17, 149, -53, 79, -123, 9, 141, -61, 71, -131, 1, 133, -69, 63, -139, -7, 125, -77, 55, -147, -15, 117, -85, 47, -155, -23, 109, -93, 39, -163, -31, 1 -- (+4 chars; full line in the Zenodo source)
[-33, 101, -99, 35, -165, -31, 103, -97, 37, -163, -29, 105, -95, 39, -161, -27, 107, -93, 41, -159, -25, 109, -91, 43, -157, -23, 111, -89, 45, -155, -21, 113, -87, 47, -153, -19, 115, -85, 49, -151, -17, 117, -83, 51, -149, -15, 119, -81, 53, -147, -13, 121, -79, 55, -145, -11, 123, -77, 57, -143, -9, 125, -75, 59, -141, -7, 127, -73, 61, -139, -5, 129, -71, 63, -137, -3, 131, -69, 65, -135, - -- (+13 chars; full line in the Zenodo source)
[-31, 105, -93, 43, -155, -19, 117, -81, 55, -143, -7, 129, -69, 67, -131, 5, 141, -57, 79, -119, 17, 153, -45, 91, -107, 29, 165, -33, 103, -95, 41, -157, -21, 115, -83, 53, -145, -9, 127, -71, 65, -133, 3, 139, -59, 77, -121, 15, 151, -47, 89, -109, 27, 163, -35, 101, -97, 39, -159, -23, 113, -85, 51, -147, -11, 125, -73, 63, -135, 1, 137, -61, 75, -123, 13, 149, -49, 87, -111, 25, 161, -37, 9 -- (+3 chars; full line in the Zenodo source)
[-29, 109, -87, 51, -145, -7, 131, -65, 73, -123, 15, 153, -43, 95, -101, 37, -159, -21, 117, -79, 59, -137, 1, 139, -57, 81, -115, 23, 161, -35, 103, -93, 45, -151, -13, 125, -71, 67, -129, 9, 147, -49, 89, -107, 31, -165, -27, 111, -85, 53, -143, -5, 133, -63, 75, -121, 17, 155, -41, 97, -99, 39, -157, -19, 119, -77, 61, -135, 3, 141, -55, 83, -113, 25, 163, -33, 105, -91, 47, -149, -11, 127, -- (+5 chars; full line in the Zenodo source)
[-27, 113, -81, 59, -135, 5, 145, -49, 91, -103, 37, -157, -17, 123, -71, 69, -125, 15, 155, -39, 101, -93, 47, -147, -7, 133, -61, 79, -115, 25, 165, -29, 111, -83, 57, -137, 3, 143, -51, 89, -105, 35, -159, -19, 121, -73, 67, -127, 13, 153, -41, 99, -95, 45, -149, -9, 131, -63, 77, -117, 23, 163, -31, 109, -85, 55, -139, 1, 141, -53, 87, -107, 33, -161, -21, 119, -75, 65, -129, 11, 151, -43, 9 -- (+3 chars; full line in the Zenodo source)
[-25, 117, -75, 67, -125, 17, 159, -33, 109, -83, 59, -133, 9, 151, -41, 101, -91, 51, -141, 1, 143, -49, 93, -99, 43, -149, -7, 135, -57, 85, -107, 35, -157, -15, 127, -65, 77, -115, 27, -165, -23, 119, -73, 69, -123, 19, 161, -31, 111, -81, 61, -131, 11, 153, -39, 103, -89, 53, -139, 3, 145, -47, 95, -97, 45, -147, -5, 137, -55, 87, -105, 37, -155, -13, 129, -63, 79, -113, 29, -163, -21, 121, -- (+5 chars; full line in the Zenodo source)
[-23, 121, -69, 75, -115, 29, -161, -17, 127, -63, 81, -109, 35, -155, -11, 133, -57, 87, -103, 41, -149, -5, 139, -51, 93, -97, 47, -143, 1, 145, -45, 99, -91, 53, -137, 7, 151, -39, 105, -85, 59, -131, 13, 157, -33, 111, -79, 65, -125, 19, 163, -27, 117, -73, 71, -119, 25, -165, -21, 123, -67, 77, -113, 31, -159, -15, 129, -61, 83, -107, 37, -153, -9, 135, -55, 89, -101, 43, -147, -3, 141, -49 -- (+6 chars; full line in the Zenodo source)
[-21, 125, -63, 83, -105, 41, -147, -1, 145, -43, 103, -85, 61, -127, 19, 165, -23, 123, -65, 81, -107, 39, -149, -3, 143, -45, 101, -87, 59, -129, 17, 163, -25, 121, -67, 79, -109, 37, -151, -5, 141, -47, 99, -89, 57, -131, 15, 161, -27, 119, -69, 77, -111, 35, -153, -7, 139, -49, 97, -91, 55, -133, 13, 159, -29, 117, -71, 75, -113, 33, -155, -9, 137, -51, 95, -93, 53, -135, 11, 157, -31, 115, -- (+5 chars; full line in the Zenodo source)
[-19, 129, -57, 91, -95, 53, -133, 15, 163, -23, 125, -61, 87, -99, 49, -137, 11, 159, -27, 121, -65, 83, -103, 45, -141, 7, 155, -31, 117, -69, 79, -107, 41, -145, 3, 151, -35, 113, -73, 75, -111, 37, -149, -1, 147, -39, 109, -77, 71, -115, 33, -153, -5, 143, -43, 105, -81, 67, -119, 29, -157, -9, 139, -47, 101, -85, 63, -123, 25, -161, -13, 135, -51, 97, -89, 59, -127, 21, -165, -17, 131, -55, -- (+5 chars; full line in the Zenodo source)
[-17, 133, -51, 99, -85, 65, -119, 31, -153, -3, 147, -37, 113, -71, 79, -105, 45, -139, 11, 161, -23, 127, -57, 93, -91, 59, -125, 25, -159, -9, 141, -43, 107, -77, 73, -111, 39, -145, 5, 155, -29, 121, -63, 87, -97, 53, -131, 19, -165, -15, 135, -49, 101, -83, 67, -117, 33, -151, -1, 149, -35, 115, -69, 81, -103, 47, -137, 13, 163, -21, 129, -55, 95, -89, 61, -123, 27, -157, -7, 143, -41, 109, -- (+6 chars; full line in the Zenodo source)
[-15, 137, -45, 107, -75, 77, -105, 47, -135, 17, -165, -13, 139, -43, 109, -73, 79, -103, 49, -133, 19, -163, -11, 141, -41, 111, -71, 81, -101, 51, -131, 21, -161, -9, 143, -39, 113, -69, 83, -99, 53, -129, 23, -159, -7, 145, -37, 115, -67, 85, -97, 55, -127, 25, -157, -5, 147, -35, 117, -65, 87, -95, 57, -125, 27, -155, -3, 149, -33, 119, -63, 89, -93, 59, -123, 29, -153, -1, 151, -31, 121, - -- (+8 chars; full line in the Zenodo source)
[-13, 141, -39, 115, -65, 89, -91, 63, -117, 37, -143, 11, 165, -15, 139, -41, 113, -67, 87, -93, 61, -119, 35, -145, 9, 163, -17, 137, -43, 111, -69, 85, -95, 59, -121, 33, -147, 7, 161, -19, 135, -45, 109, -71, 83, -97, 57, -123, 31, -149, 5, 159, -21, 133, -47, 107, -73, 81, -99, 55, -125, 29, -151, 3, 157, -23, 131, -49, 105, -75, 79, -101, 53, -127, 27, -153, 1, 155, -25, 129, -51, 103, -77 -- (+2 chars; full line in the Zenodo source)
[-11, 145, -33, 123, -55, 101, -77, 79, -99, 57, -121, 35, -143, 13, -165, -9, 147, -31, 125, -53, 103, -75, 81, -97, 59, -119, 37, -141, 15, -163, -7, 149, -29, 127, -51, 105, -73, 83, -95, 61, -117, 39, -139, 17, -161, -5, 151, -27, 129, -49, 107, -71, 85, -93, 63, -115, 41, -137, 19, -159, -3, 153, -25, 131, -47, 109, -69, 87, -91, 65, -113, 43, -135, 21, -157, -1, 155, -23, 133, -45, 111, -6 -- (+7 chars; full line in the Zenodo source)
[-9, 149, -27, 131, -45, 113, -63, 95, -81, 77, -99, 59, -117, 41, -135, 23, -153, 5, 163, -13, 145, -31, 127, -49, 109, -67, 91, -85, 73, -103, 55, -121, 37, -139, 19, -157, 1, 159, -17, 141, -35, 123, -53, 105, -71, 87, -89, 69, -107, 51, -125, 33, -143, 15, -161, -3, 155, -21, 137, -39, 119, -57, 101, -75, 83, -93, 65, -111, 47, -129, 29, -147, 11, -165, -7, 151, -25, 133, -43, 115, -61, 97, -- (+5 chars; full line in the Zenodo source)
[-7, 153, -21, 139, -35, 125, -49, 111, -63, 97, -77, 83, -91, 69, -105, 55, -119, 41, -133, 27, -147, 13, -161, -1, 159, -15, 145, -29, 131, -43, 117, -57, 103, -71, 89, -85, 75, -99, 61, -113, 47, -127, 33, -141, 19, -155, 5, 165, -9, 151, -23, 137, -37, 123, -51, 109, -65, 95, -79, 81, -93, 67, -107, 53, -121, 39, -135, 25, -149, 11, -163, -3, 157, -17, 143, -31, 129, -45, 115, -59, 101, -73, -- (+5 chars; full line in the Zenodo source)
[-5, 157, -15, 147, -25, 137, -35, 127, -45, 117, -55, 107, -65, 97, -75, 87, -85, 77, -95, 67, -105, 57, -115, 47, -125, 37, -135, 27, -145, 17, -155, 7, -165, -3, 159, -13, 149, -23, 139, -33, 129, -43, 119, -53, 109, -63, 99, -73, 89, -83, 79, -93, 69, -103, 59, -113, 49, -123, 39, -133, 29, -143, 19, -153, 9, -163, -1, 161, -11, 151, -21, 141, -31, 131, -41, 121, -51, 111, -61, 101, -71, 91, -- (+6 chars; full line in the Zenodo source)
[-3, 161, -9, 155, -15, 149, -21, 143, -27, 137, -33, 131, -39, 125, -45, 119, -51, 113, -57, 107, -63, 101, -69, 95, -75, 89, -81, 83, -87, 77, -93, 71, -99, 65, -105, 59, -111, 53, -117, 47, -123, 41, -129, 35, -135, 29, -141, 23, -147, 17, -153, 11, -159, 5, -165, -1, 163, -7, 157, -13, 151, -19, 145, -25, 139, -31, 133, -37, 127, -43, 121, -49, 115, -55, 109, -61, 103, -67, 97, -73, 91, -79, -- (+5 chars; full line in the Zenodo source)
[-1, 165, -3, 163, -5, 161, -7, 159, -9, 157, -11, 155, -13, 153, -15, 151, -17, 149, -19, 147, -21, 145, -23, 143, -25, 141, -27, 139, -29, 137, -31, 135, -33, 133, -35, 131, -37, 129, -39, 127, -41, 125, -43, 123, -45, 121, -47, 119, -49, 117, -51, 115, -53, 113, -55, 111, -57, 109, -59, 107, -61, 105, -63, 103, -65, 101, -67, 99, -69, 97, -71, 95, -73, 93, -75, 91, -77, 89, -79, 87, -81, 85, -- (+5 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[977423643068998835894499069, -1597863786739009634213874388, -485363135376871756790607430, 636591647070256988234990235, -1162997184745872092660607901, -98310599387939231304865682, -808566414972736834828532672, -896068786568935237847590313, -625154251935324760044480594, 674286748947407885947151795, -1157168746106532091034712669, -889458385719609813938693823, -1218586445776687650760741959, -124502 -- (+2133 chars; full line in the Zenodo source)
[-1597863786739009634213874388, 636591647070256988234990235, -98310599387939231304865682, -896068786568935237847590313, 674286748947407885947151795, -889458385719609813938693823, -1245027464193874766172211921, 611336683208335311641756096, -583514650211044977172865077, -2117855023320329089077164022, -947462190624990535217426422, -1824154815995446036492577246, -2686874883698598971451799381, 345153 -- (+2093 chars; full line in the Zenodo source)
[-485363135376871756790607430, -98310599387939231304865682, -625154251935324760044480594, -889458385719609813938693823, -1032026767571584116137556307, -583514650211044977172865077, -658255261856054958670678481, -1824154815995446036492577246, -2389193278289998927304042918, -1059057115242999512911982949, -2734702415686277219971435828, -1012400213515239109415897079, -3137340231337238232207178350, - -- (+2107 chars; full line in the Zenodo source)
[636591647070256988234990235, -896068786568935237847590313, -889458385719609813938693823, 611336683208335311641756096, -2117855023320329089077164022, -1824154815995446036492577246, 34515363899546125604068793, -2864118245035004619367550365, -1012400213515239109415897079, -600572897233925597151987967, -2297090812903499689079032495, -1104899857934756903583218846, -861015218919201369372972707, -2258 -- (+2103 chars; full line in the Zenodo source)
[-1162997184745872092660607901, 674286748947407885947151795, -1032026767571584116137556307, -2117855023320329089077164022, -1946080559065193064224590521, -1059057115242999512911982949, -2810458116559351896703078449, -600572897233925597151987967, -2738521093051727778398246287, -1582502267833424603546649993, -2489713387820945460145282692, -222813702949222015966548594, -2160169344237055110859168207 -- (+2108 chars; full line in the Zenodo source)
[-98310599387939231304865682, -889458385719609813938693823, -583514650211044977172865077, -1824154815995446036492577246, -1059057115242999512911982949, -1012400213515239109415897079, -1689711788856596022042058802, -1104899857934756903583218846, -1023072366366315172165830378, -222813702949222015966548594, 415047617744240008748646521, 155537852999268171067047606, 2263301469399144409645315833, 1611 -- (+2109 chars; full line in the Zenodo source)
[-808566414972736834828532672, -1245027464193874766172211921, -658255261856054958670678481, 34515363899546125604068793, -2810458116559351896703078449, -1689711788856596022042058802, -3194772757623460986161560298, -2258824290494157582420059301, -1776355325221898094194745899, 329017372330784431298518925, -2148113684716556160509069762, 1611629711327839165702198224, -208736685354534226578732061, 163 -- (+2103 chars; full line in the Zenodo source)
[-896068786568935237847590313, 611336683208335311641756096, -1824154815995446036492577246, -2864118245035004619367550365, -600572897233925597151987967, -1104899857934756903583218846, -2258824290494157582420059301, 218895510844383934788180499, 155537852999268171067047606, 582858897946262056759230199, 1728214030410934358570153520, 1904494907491565103111720033, 1776355325221898094194745899, 2489713 -- (+2103 chars; full line in the Zenodo source)
[-625154251935324760044480594, -583514650211044977172865077, -2389193278289998927304042918, -1012400213515239109415897079, -2738521093051727778398246287, -1023072366366315172165830378, -1776355325221898094194745899, 155537852999268171067047606, -202866741498391204658274811, 2148113684716556160509069762, 1132338740859466411714088059, 4395930539661729352041127696, 1582502267833424603546649993, 356 -- (+2107 chars; full line in the Zenodo source)
[674286748947407885947151795, -2117855023320329089077164022, -1059057115242999512911982949, -600572897233925597151987967, -1582502267833424603546649993, -222813702949222015966548594, 329017372330784431298518925, 582858897946262056759230199, 2148113684716556160509069762, 3064305562680523145436725324, 1870562250263627644153202084, 3755184582683202557820261631, 3015516974201181288709592443, 2389193 -- (+2104 chars; full line in the Zenodo source)
[-1157168746106532091034712669, -947462190624990535217426422, -2734702415686277219971435828, -2297090812903499689079032495, -2489713387820945460145282692, 415047617744240008748646521, -2148113684716556160509069762, 1728214030410934358570153520, 1132338740859466411714088059, 1870562250263627644153202084, 1600971703317209020985937240, 2810458116559351896703078449, 1824154815995446036492577246, 121 -- (+2107 chars; full line in the Zenodo source)
[-889458385719609813938693823, -1824154815995446036492577246, -1012400213515239109415897079, -1104899857934756903583218846, -222813702949222015966548594, 155537852999268171067047606, 1611629711327839165702198224, 1904494907491565103111720033, 4395930539661729352041127696, 3755184582683202557820261631, 2810458116559351896703078449, 1884523039379593638799019187, 1157168746106532091034712669, 97742 -- (+2105 chars; full line in the Zenodo source)
[-1218586445776687650760741959, -2686874883698598971451799381, -3137340231337238232207178350, -861015218919201369372972707, -2160169344237055110859168207, 2263301469399144409645315833, -208736685354534226578732061, 1776355325221898094194745899, 1582502267833424603546649993, 3015516974201181288709592443, 1824154815995446036492577246, 1157168746106532091034712669, -1597863786739009634213874388, -1 -- (+2106 chars; full line in the Zenodo source)
[-1245027464193874766172211921, 34515363899546125604068793, -1689711788856596022042058802, -2258824290494157582420059301, 329017372330784431298518925, 1611629711327839165702198224, 1634184258759882834139281934, 2489713387820945460145282692, 3566919937102739692258324240, 2389193278289998927304042918, 1218586445776687650760741959, 977423643068998835894499069, -1032026767571584116137556307, -334279 -- (+2103 chars; full line in the Zenodo source)
[-1032026767571584116137556307, -1059057115242999512911982949, -2738521093051727778398246287, -222813702949222015966548594, -1152208273331717441696704632, 2148113684716556160509069762, 1432623763877127377476331184, 3755184582683202557820261631, 2864118245035004619367550365, 1962109360866892494532021292, 1597863786739009634213874388, -1218586445776687650760741959, 34515363899546125604068793, -184 -- (+2106 chars; full line in the Zenodo source)
[611336683208335311641756096, -2864118245035004619367550365, -1104899857934756903583218846, 218895510844383934788180499, 582858897946262056759230199, 1904494907491565103111720033, 2489713387820945460145282692, 3137340231337238232207178350, 1884523039379593638799019187, 808566414972736834828532672, -625154251935324760044480594, -1946080559065193064224590521, -3566919937102739692258324240, -187056 -- (+2105 chars; full line in the Zenodo source)
[-1962109360866892494532021292, -669506891717155692934762200, -1010949990105822004415418820, -1132338740859466411714088059, -1056801504494858608346049094, 2160169344237055110859168207, 1104899857934756903583218846, 2515906900585167488090233051, 1245027464193874766172211921, -485363135376871756790607430, -2117855023320329089077164022, -3015516974201181288709592443, -1023072366366315172165830378, -- (+2110 chars; full line in the Zenodo source)
[-583514650211044977172865077, -1012400213515239109415897079, -1023072366366315172165830378, 155537852999268171067047606, 2148113684716556160509069762, 4395930539661729352041127696, 3566919937102739692258324240, 1884523039379593638799019187, 1162997184745872092660607901, -1218586445776687650760741959, -2515906900585167488090233051, -3194772757623460986161560298, -3064305562680523145436725324, -1 -- (+2107 chars; full line in the Zenodo source)
[-2804213520214811521357119880, -826410308113373884296400514, -1870562250263627644153202084, 208736685354534226578732061, -155537852999268171067047606, 2932202283587694957916573867, 669506891717155692934762200, 1032026767571584116137556307, 636591647070256988234990235, -1884523039379593638799019187, -1689711788856596022042058802, -3065136867326386863326504335, 582858897946262056759230199, 113233 -- (+2103 chars; full line in the Zenodo source)
[-2117855023320329089077164022, -600572897233925597151987967, -222813702949222015966548594, 582858897946262056759230199, 3064305562680523145436725324, 3755184582683202557820261631, 2389193278289998927304042918, 808566414972736834828532672, -1218586445776687650760741959, -2734702415686277219971435828, -2932202283587694957916573867, -1407018333394826699916506430, 1092943798595877162878332638, 1023 -- (+2104 chars; full line in the Zenodo source)
[-658255261856054958670678481, -1689711788856596022042058802, -1776355325221898094194745899, 1611629711327839165702198224, 1432623763877127377476331184, 3566919937102739692258324240, 2117855023320329089077164022, 977423643068998835894499069, -947462190624990535217426422, -1840581719319076652682338835, 218895510844383934788180499, -1056801504494858608346049094, 3065136867326386863326504335, 60057 -- (+2105 chars; full line in the Zenodo source)
[-947462190624990535217426422, -2297090812903499689079032495, 415047617744240008748646521, 1728214030410934358570153520, 1870562250263627644153202084, 2810458116559351896703078449, 1218586445776687650760741959, -625154251935324760044480594, -2515906900585167488090233051, -2932202283587694957916573867, -1152208273331717441696704632, -329017372330784431298518925, 1104899857934756903583218846, 2686 -- (+2103 chars; full line in the Zenodo source)
[-1884523039379593638799019187, -1600971703317209020985937240, -1634184258759882834139281934, 1152208273331717441696704632, 861015218919201369372972707, 3342794947892825069901028249, 98310599387939231304865682, -1962109360866892494532021292, -600572897233925597151987967, -1776355325221898094194745899, 202866741498391204658274811, -909347385662374703223639038, 2810458116559351896703078449, 889458 -- (+2106 chars; full line in the Zenodo source)
[-1824154815995446036492577246, -1104899857934756903583218846, 155537852999268171067047606, 1904494907491565103111720033, 3755184582683202557820261631, 1884523039379593638799019187, 977423643068998835894499069, -1946080559065193064224590521, -3194772757623460986161560298, -1407018333394826699916506430, -329017372330784431298518925, 1600971703317209020985937240, 947462190624990535217426422, -1597 -- (+2105 chars; full line in the Zenodo source)
[-1946080559065193064224590521, -1582502267833424603546649993, -1152208273331717441696704632, 3064305562680523145436725324, 1689711788856596022042058802, 1962109360866892494532021292, -896068786568935237847590313, -2734702415686277219971435828, 909347385662374703223639038, -1611629711327839165702198224, 4395930539661729352041127696, 669506891717155692934762200, 625154251935324760044480594, 61133 -- (+2107 chars; full line in the Zenodo source)
[-2686874883698598971451799381, -861015218919201369372972707, 2263301469399144409645315833, 1776355325221898094194745899, 3015516974201181288709592443, 1157168746106532091034712669, -1032026767571584116137556307, -3566919937102739692258324240, -3064305562680523145436725324, 1092943798595877162878332638, 1104899857934756903583218846, 947462190624990535217426422, 636591647070256988234990235, -1059 -- (+2104 chars; full line in the Zenodo source)
[-2389193278289998927304042918, -1023072366366315172165830378, -202866741498391204658274811, 4395930539661729352041127696, 2864118245035004619367550365, 1162997184745872092660607901, -947462190624990535217426422, -3194772757623460986161560298, 208736685354534226578732061, -218895510844383934788180499, 3015516974201181288709592443, -674286748947407885947151795, -1962109360866892494532021292, -229 -- (+2105 chars; full line in the Zenodo source)
[34515363899546125604068793, -2258824290494157582420059301, 1611629711327839165702198224, 2489713387820945460145282692, 2389193278289998927304042918, 977423643068998835894499069, -3342794947892825069901028249, -1870562250263627644153202084, -1056801504494858608346049094, 1023072366366315172165830378, 2686874883698598971451799381, -1597863786739009634213874388, -1059057115242999512911982949, 9093 -- (+2105 chars; full line in the Zenodo source)
[-3342794947892825069901028249, 909347385662374703223639038, -582858897946262056759230199, 1010949990105822004415418820, 947462190624990535217426422, -808566414972736834828532672, -1012400213515239109415897079, -2160169344237055110859168207, 1407018333394826699916506430, 2297090812903499689079032495, 1032026767571584116137556307, -1245027464193874766172211921, -1840581719319076652682338835, 1555 -- (+2105 chars; full line in the Zenodo source)
[-1059057115242999512911982949, -222813702949222015966548594, 2148113684716556160509069762, 3755184582683202557820261631, 1962109360866892494532021292, -1218586445776687650760741959, -1840581719319076652682338835, -1407018333394826699916506430, -218895510844383934788180499, 669506891717155692934762200, -636591647070256988234990235, -2686874883698598971451799381, -2258824290494157582420059301, 20 -- (+2108 chars; full line in the Zenodo source)
[-2515906900585167488090233051, -1432623763877127377476331184, 1092943798595877162878332638, 1840581719319076652682338835, 889458385719609813938693823, -2804213520214811521357119880, -1582502267833424603546649993, -202866741498391204658274811, 2489713387820945460145282692, 1824154815995446036492577246, -808566414972736834828532672, -826410308113373884296400514, -1634184258759882834139281934, 306 -- (+2105 chars; full line in the Zenodo source)
[-2864118245035004619367550365, 218895510844383934788180499, 1904494907491565103111720033, 3137340231337238232207178350, 808566414972736834828532672, -1946080559065193064224590521, -1870562250263627644153202084, -2263301469399144409645315833, 1600971703317209020985937240, 1245027464193874766172211921, -583514650211044977172865077, -1582502267833424603546649993, 1056801504494858608346049094, 2932 -- (+2105 chars; full line in the Zenodo source)
[-2734702415686277219971435828, 415047617744240008748646521, 1132338740859466411714088059, 2810458116559351896703078449, 1597863786739009634213874388, -2515906900585167488090233051, 218895510844383934788180499, -329017372330784431298518925, 3015516974201181288709592443, -636591647070256988234990235, -3342794947892825069901028249, -1432623763877127377476331184, -155537852999268171067047606, 31373 -- (+2113 chars; full line in the Zenodo source)
[-669506891717155692934762200, -1132338740859466411714088059, 2160169344237055110859168207, 2515906900585167488090233051, -485363135376871756790607430, -3015516974201181288709592443, -1904494907491565103111720033, 1432623763877127377476331184, -34515363899546125604068793, -98310599387939231304865682, -600572897233925597151987967, -1092943798595877162878332638, 4395930539661729352041127696, 19460 -- (+2110 chars; full line in the Zenodo source)
[-2810458116559351896703078449, 329017372330784431298518925, 1432623763877127377476331184, 2389193278289998927304042918, -896068786568935237847590313, -1840581719319076652682338835, 2263301469399144409645315833, 1023072366366315172165830378, 2804213520214811521357119880, 611336683208335311641756096, -1010949990105822004415418820, 202866741498391204658274811, 1600971703317209020985937240, 1157168 -- (+2102 chars; full line in the Zenodo source)
[-1012400213515239109415897079, 155537852999268171067047606, 4395930539661729352041127696, 1884523039379593638799019187, -1218586445776687650760741959, -3194772757623460986161560298, -1056801504494858608346049094, 1600971703317209020985937240, -674286748947407885947151795, -2686874883698598971451799381, -1432623763877127377476331184, 1634184258759882834139281934, 2734702415686277219971435828, -4 -- (+2107 chars; full line in the Zenodo source)
[-3015516974201181288709592443, -1092943798595877162878332638, 2258824290494157582420059301, 2804213520214811521357119880, -583514650211044977172865077, -2489713387820945460145282692, 1152208273331717441696704632, 826410308113373884296400514, -977423643068998835894499069, -1012400213515239109415897079, -1407018333394826699916506430, 1870562250263627644153202084, 2117855023320329089077164022, -19 -- (+2104 chars; full line in the Zenodo source)
[-826410308113373884296400514, 208736685354534226578732061, 2932202283587694957916573867, 1032026767571584116137556307, -1884523039379593638799019187, -3065136867326386863326504335, 1132338740859466411714088059, 1059057115242999512911982949, -896068786568935237847590313, -1600971703317209020985937240, 1611629711327839165702198224, 2738521093051727778398246287, 808566414972736834828532672, -25159 -- (+2103 chars; full line in the Zenodo source)
[-3137340231337238232207178350, 2263301469399144409645315833, 1582502267833424603546649993, 1157168746106532091034712669, 34515363899546125604068793, -3064305562680523145436725324, 3065136867326386863326504335, 947462190624990535217426422, -1962109360866892494532021292, -2258824290494157582420059301, -155537852999268171067047606, 2734702415686277219971435828, -98310599387939231304865682, -273852 -- (+2108 chars; full line in the Zenodo source)
[-600572897233925597151987967, 582858897946262056759230199, 3755184582683202557820261631, 808566414972736834828532672, -2734702415686277219971435828, -1407018333394826699916506430, 1023072366366315172165830378, 1245027464193874766172211921, -2686874883698598971451799381, 415047617744240008748646521, 3065136867326386863326504335, 658255261856054958670678481, -2804213520214811521357119880, -439593 -- (+2106 chars; full line in the Zenodo source)
[-3566919937102739692258324240, 1056801504494858608346049094, 2297090812903499689079032495, 485363135376871756790607430, -826410308113373884296400514, -1728214030410934358570153520, 3755184582683202557820261631, 98310599387939231304865682, -2810458116559351896703078449, 208736685354534226578732061, 1582502267833424603546649993, 625154251935324760044480594, -2864118245035004619367550365, -1407018 -- (+2102 chars; full line in the Zenodo source)
[-1689711788856596022042058802, 1611629711327839165702198224, 3566919937102739692258324240, 977423643068998835894499069, -1840581719319076652682338835, -1056801504494858608346049094, 600572897233925597151987967, -1597863786739009634213874388, -2297090812903499689079032495, 202866741498391204658274811, 3137340231337238232207178350, -485363135376871756790607430, -2738521093051727778398246287, -582 -- (+2109 chars; full line in the Zenodo source)
[-1840581719319076652682338835, 202866741498391204658274811, 826410308113373884296400514, -1162997184745872092660607901, -1104899857934756903583218846, -208736685354534226578732061, 2734702415686277219971435828, 674286748947407885947151795, -2932202283587694957916573867, 1904494907491565103111720033, -34515363899546125604068793, -1032026767571584116137556307, 909347385662374703223639038, -415047 -- (+2108 chars; full line in the Zenodo source)
[-2297090812903499689079032495, 1728214030410934358570153520, 2810458116559351896703078449, -625154251935324760044480594, -2932202283587694957916573867, -329017372330784431298518925, 2686874883698598971451799381, -583514650211044977172865077, -1432623763877127377476331184, 3065136867326386863326504335, 1962109360866892494532021292, -2389193278289998927304042918, -1904494907491565103111720033, 86 -- (+2105 chars; full line in the Zenodo source)
[-2738521093051727778398246287, 2148113684716556160509069762, 2864118245035004619367550365, -1218586445776687650760741959, 909347385662374703223639038, -218895510844383934788180499, 2804213520214811521357119880, -2686874883698598971451799381, -1904494907491565103111720033, 1010949990105822004415418820, 98310599387939231304865682, -3137340231337238232207178350, 1611629711327839165702198224, 82641 -- (+2104 chars; full line in the Zenodo source)
[-1600971703317209020985937240, 1152208273331717441696704632, 3342794947892825069901028249, -1962109360866892494532021292, -1776355325221898094194745899, -909347385662374703223639038, 889458385719609813938693823, -669506891717155692934762200, 582858897946262056759230199, 3566919937102739692258324240, -1162997184745872092660607901, -1010949990105822004415418820, -329017372330784431298518925, 1824 -- (+2106 chars; full line in the Zenodo source)
[-3755184582683202557820261631, 1407018333394826699916506430, 2686874883698598971451799381, -658255261856054958670678481, -1132338740859466411714088059, 861015218919201369372972707, 1162997184745872092660607901, -1689711788856596022042058802, -2263301469399144409645315833, 2515906900585167488090233051, 611336683208335311641756096, -1776355325221898094194745899, 1870562250263627644153202084, -674 -- (+2105 chars; full line in the Zenodo source)
[-1104899857934756903583218846, 1904494907491565103111720033, 1884523039379593638799019187, -1946080559065193064224590521, -1407018333394826699916506430, 1600971703317209020985937240, -1597863786739009634213874388, -1582502267833424603546649993, 1634184258759882834139281934, 658255261856054958670678481, -2389193278289998927304042918, -1152208273331717441696704632, 2297090812903499689079032495, 6 -- (+2105 chars; full line in the Zenodo source)
[-3194772757623460986161560298, 1634184258759882834139281934, 2117855023320329089077164022, -3342794947892825069901028249, 2263301469399144409645315833, 600572897233925597151987967, -625154251935324760044480594, 909347385662374703223639038, 222813702949222015966548594, 1157168746106532091034712669, -826410308113373884296400514, -582858897946262056759230199, 2515906900585167488090233051, -5835146 -- (+2105 chars; full line in the Zenodo source)
[-1582502267833424603546649993, 3064305562680523145436725324, 1962109360866892494532021292, -2734702415686277219971435828, -1611629711327839165702198224, 669506891717155692934762200, 611336683208335311641756096, 415047617744240008748646521, 1010949990105822004415418820, -977423643068998835894499069, -3194772757623460986161560298, 1132338740859466411714088059, 583514650211044977172865077, -286411 -- (+2101 chars; full line in the Zenodo source)
[-1010949990105822004415418820, 2160169344237055110859168207, 1245027464193874766172211921, -3015516974201181288709592443, 1728214030410934358570153520, -34515363899546125604068793, -1884523039379593638799019187, -1092943798595877162878332638, 1689711788856596022042058802, -625154251935324760044480594, -222813702949222015966548594, 2258824290494157582420059301, 1162997184745872092660607901, -160 -- (+2108 chars; full line in the Zenodo source)
[-861015218919201369372972707, 1776355325221898094194745899, 1157168746106532091034712669, -3566919937102739692258324240, 1092943798595877162878332638, 947462190624990535217426422, -1059057115242999512911982949, 1056801504494858608346049094, 2734702415686277219971435828, -2804213520214811521357119880, -1904494907491565103111720033, 2297090812903499689079032495, -896068786568935237847590313, -222 -- (+2108 chars; full line in the Zenodo source)
[-2932202283587694957916573867, 3065136867326386863326504335, 896068786568935237847590313, -2738521093051727778398246287, 1634184258759882834139281934, -611336683208335311641756096, -3015516974201181288709592443, 2148113684716556160509069762, 1824154815995446036492577246, -3342794947892825069901028249, 1056801504494858608346049094, 2864118245035004619367550365, -658255261856054958670678481, -109 -- (+2106 chars; full line in the Zenodo source)
[-1023072366366315172165830378, 4395930539661729352041127696, 1162997184745872092660607901, -3194772757623460986161560298, -218895510844383934788180499, -674286748947407885947151795, -2297090812903499689079032495, 1634184258759882834139281934, 1032026767571584116137556307, -3137340231337238232207178350, 1092943798595877162878332638, 2117855023320329089077164022, -669506891717155692934762200, 172 -- (+2105 chars; full line in the Zenodo source)
[-2489713387820945460145282692, 1870562250263627644153202084, 1597863786739009634213874388, -2932202283587694957916573867, 4395930539661729352041127696, -636591647070256988234990235, -1010949990105822004415418820, 3065136867326386863326504335, 98310599387939231304865682, -3194772757623460986161560298, 1776355325221898094194745899, 896068786568935237847590313, -3755184582683202557820261631, 21601 -- (+2100 chars; full line in the Zenodo source)
[-2258824290494157582420059301, 2489713387820945460145282692, 977423643068998835894499069, -1870562250263627644153202084, 1023072366366315172165830378, -1597863786739009634213874388, 909347385662374703223639038, 2932202283587694957916573867, -485363135376871756790607430, -4395930539661729352041127696, 861015218919201369372972707, 636591647070256988234990235, -222813702949222015966548594, 1010949 -- (+2107 chars; full line in the Zenodo source)
[-1870562250263627644153202084, 2932202283587694957916573867, 636591647070256988234990235, -3065136867326386863326504335, 3194772757623460986161560298, -896068786568935237847590313, -2160169344237055110859168207, 2738521093051727778398246287, -889458385719609813938693823, -1634184258759882834139281934, 3566919937102739692258324240, 611336683208335311641756096, -1407018333394826699916506430, 3015 -- (+2105 chars; full line in the Zenodo source)
[909347385662374703223639038, 1010949990105822004415418820, -808566414972736834828532672, -2160169344237055110859168207, 2297090812903499689079032495, -1245027464193874766172211921, 155537852999268171067047606, 3015516974201181288709592443, -658255261856054958670678481, -1728214030410934358570153520, 1059057115242999512911982949, 34515363899546125604068793, 202866741498391204658274811, 188452303 -- (+2103 chars; full line in the Zenodo source)
[-4395930539661729352041127696, 3194772757623460986161560298, 674286748947407885947151795, -1634184258759882834139281934, 3137340231337238232207178350, -2117855023320329089077164022, -1728214030410934358570153520, 3342794947892825069901028249, -1059057115242999512911982949, -2263301469399144409645315833, 2804213520214811521357119880, -600572897233925597151987967, 1132338740859466411714088059, 62 -- (+2108 chars; full line in the Zenodo source)
[-222813702949222015966548594, 3755184582683202557820261631, -1218586445776687650760741959, -1407018333394826699916506430, 669506891717155692934762200, -2686874883698598971451799381, 202866741498391204658274811, 658255261856054958670678481, -3137340231337238232207178350, 1132338740859466411714088059, 896068786568935237847590313, -861015218919201369372972707, 2489713387820945460145282692, -116299 -- (+2104 chars; full line in the Zenodo source)
[-3065136867326386863326504335, 2738521093051727778398246287, 611336683208335311641756096, -2148113684716556160509069762, 3342794947892825069901028249, -2864118245035004619367550365, 1092943798595877162878332638, 1218586445776687650760741959, -1104899857934756903583218846, -909347385662374703223639038, -485363135376871756790607430, 218895510844383934788180499, 1689711788856596022042058802, -2804 -- (+2105 chars; full line in the Zenodo source)
[-1432623763877127377476331184, 1840581719319076652682338835, -2804213520214811521357119880, -202866741498391204658274811, 1824154815995446036492577246, -826410308113373884296400514, 3064305562680523145436725324, 1162997184745872092660607901, -1870562250263627644153202084, 1104899857934756903583218846, -1245027464193874766172211921, 208736685354534226578732061, 3342794947892825069901028249, -273 -- (+2107 chars; full line in the Zenodo source)
[-1776355325221898094194745899, 3566919937102739692258324240, -947462190624990535217426422, -1056801504494858608346049094, 2804213520214811521357119880, -2297090812903499689079032495, 222813702949222015966548594, -485363135376871756790607430, 415047617744240008748646521, 826410308113373884296400514, -1946080559065193064224590521, 1728214030410934358570153520, -611336683208335311641756096, -37551 -- (+2111 chars; full line in the Zenodo source)
[218895510844383934788180499, 3137340231337238232207178350, -1946080559065193064224590521, -2263301469399144409645315833, 1245027464193874766172211921, -1582502267833424603546649993, 2932202283587694957916573867, -1157168746106532091034712669, -1152208273331717441696704632, -34515363899546125604068793, -1012400213515239109415897079, 3064305562680523145436725324, 485363135376871756790607430, -306 -- (+2105 chars; full line in the Zenodo source)
[-2160169344237055110859168207, 3015516974201181288709592443, 34515363899546125604068793, 1092943798595877162878332638, 625154251935324760044480594, -2258824290494157582420059301, 1600971703317209020985937240, -2804213520214811521357119880, 1611629711327839165702198224, 583514650211044977172865077, -3755184582683202557820261631, 2489713387820945460145282692, 674286748947407885947151795, -1152208 -- (+2103 chars; full line in the Zenodo source)
[415047617744240008748646521, 2810458116559351896703078449, -2515906900585167488090233051, -329017372330784431298518925, -636591647070256988234990235, -1432623763877127377476331184, 3137340231337238232207178350, -2389193278289998927304042918, 1092943798595877162878332638, 896068786568935237847590313, 909347385662374703223639038, 1840581719319076652682338835, -1884523039379593638799019187, -22633 -- (+2107 chars; full line in the Zenodo source)
[-3064305562680523145436725324, 2734702415686277219971435828, -669506891717155692934762200, -415047617744240008748646521, 977423643068998835894499069, -1132338740859466411714088059, 2864118245035004619367550365, -2810458116559351896703078449, 2160169344237055110859168207, -1597863786739009634213874388, -1634184258759882834139281934, 2515906900585167488090233051, -1012400213515239109415897079, -2 -- (+2108 chars; full line in the Zenodo source)
[-1132338740859466411714088059, 2515906900585167488090233051, -3015516974201181288709592443, 1432623763877127377476331184, -98310599387939231304865682, -1092943798595877162878332638, 1946080559065193064224590521, -1840581719319076652682338835, 2258824290494157582420059301, -889458385719609813938693823, 582858897946262056759230199, 2804213520214811521357119880, -3194772757623460986161560298, 1582 -- (+2102 chars; full line in the Zenodo source)
[-1634184258759882834139281934, 3342794947892825069901028249, -600572897233925597151987967, -909347385662374703223639038, -1157168746106532091034712669, 582858897946262056759230199, 583514650211044977172865077, -1010949990105822004415418820, 3755184582683202557820261631, -947462190624990535217426422, -208736685354534226578732061, 808566414972736834828532672, -1432623763877127377476331184, 101240 -- (+2106 chars; full line in the Zenodo source)
[329017372330784431298518925, 2389193278289998927304042918, -1840581719319076652682338835, 1023072366366315172165830378, 611336683208335311641756096, 202866741498391204658274811, 1157168746106532091034712669, -4395930539661729352041127696, 826410308113373884296400514, -2864118245035004619367550365, 2160169344237055110859168207, -1162997184745872092660607901, -1152208273331717441696704632, 947462 -- (+2104 chars; full line in the Zenodo source)
[-1904494907491565103111720033, 1946080559065193064224590521, -1600971703317209020985937240, 1582502267833424603546649993, -658255261856054958670678481, 1152208273331717441696704632, -636591647070256988234990235, -3064305562680523145436725324, 3342794947892825069901028249, -1689711788856596022042058802, 1023072366366315172165830378, -1962109360866892494532021292, 1728214030410934358570153520, 89 -- (+2108 chars; full line in the Zenodo source)
[155537852999268171067047606, 1884523039379593638799019187, -3194772757623460986161560298, 1600971703317209020985937240, -2686874883698598971451799381, 1634184258759882834139281934, -485363135376871756790607430, -1152208273331717441696704632, 2117855023320329089077164022, -861015218919201369372972707, 1840581719319076652682338835, -3342794947892825069901028249, -415047617744240008748646521, -983 -- (+2101 chars; full line in the Zenodo source)
[-1407018333394826699916506430, 658255261856054958670678481, -861015218919201369372972707, 1689711788856596022042058802, -2515906900585167488090233051, 1776355325221898094194745899, 674286748947407885947151795, -1611629711327839165702198224, 1157168746106532091034712669, -1432623763877127377476331184, 2864118245035004619367550365, -3566919937102739692258324240, 2932202283587694957916573867, -211 -- (+2104 chars; full line in the Zenodo source)
[-1092943798595877162878332638, 2804213520214811521357119880, -2489713387820945460145282692, 826410308113373884296400514, -1012400213515239109415897079, 1870562250263627644153202084, -1962109360866892494532021292, -208736685354534226578732061, 1597863786739009634213874388, 155537852999268171067047606, 658255261856054958670678481, -2932202283587694957916573867, 600572897233925597151987967, -66950 -- (+2106 chars; full line in the Zenodo source)
[-1152208273331717441696704632, 1962109360866892494532021292, 909347385662374703223639038, 669506891717155692934762200, -3566919937102739692258324240, 1010949990105822004415418820, -1824154815995446036492577246, 1132338740859466411714088059, -808566414972736834828532672, 1056801504494858608346049094, -674286748947407885947151795, -2160169344237055110859168207, 2389193278289998927304042918, -1104 -- (+2103 chars; full line in the Zenodo source)
[208736685354534226578732061, 1032026767571584116137556307, -3065136867326386863326504335, 1059057115242999512911982949, -1600971703317209020985937240, 2738521093051727778398246287, -2515906900585167488090233051, 222813702949222015966548594, 611336683208335311641756096, 1152208273331717441696704632, 977423643068998835894499069, -2148113684716556160509069762, 1245027464193874766172211921, -143262 -- (+2105 chars; full line in the Zenodo source)
[-2148113684716556160509069762, 1218586445776687650760741959, 218895510844383934788180499, 2686874883698598971451799381, -1010949990105822004415418820, 3137340231337238232207178350, -826410308113373884296400514, 861015218919201369372972707, -1946080559065193064224590521, 2160169344237055110859168207, -889458385719609813938693823, -2263301469399144409645315833, -977423643068998835894499069, 20873 -- (+2107 chars; full line in the Zenodo source)
[2263301469399144409645315833, 1157168746106532091034712669, -3064305562680523145436725324, 947462190624990535217426422, -2258824290494157582420059301, 2734702415686277219971435828, -2738521093051727778398246287, 2297090812903499689079032495, -669506891717155692934762200, 2489713387820945460145282692, -1884523039379593638799019187, -415047617744240008748646521, -889458385719609813938693823, 2148 -- (+2104 chars; full line in the Zenodo source)
[-1728214030410934358570153520, 625154251935324760044480594, 329017372330784431298518925, 583514650211044977172865077, -3065136867326386863326504335, 2389193278289998927304042918, -861015218919201369372972707, 1012400213515239109415897079, -1840581719319076652682338835, 2738521093051727778398246287, -669506891717155692934762200, 1023072366366315172165830378, -1946080559065193064224590521, 177635 -- (+2102 chars; full line in the Zenodo source)
[582858897946262056759230199, 808566414972736834828532672, -1407018333394826699916506430, 1245027464193874766172211921, 415047617744240008748646521, 658255261856054958670678481, -4395930539661729352041127696, -34515363899546125604068793, -861015218919201369372972707, 2810458116559351896703078449, -2738521093051727778398246287, 1689711788856596022042058802, -826410308113373884296400514, 319477275 -- (+2104 chars; full line in the Zenodo source)
[-202866741498391204658274811, 1162997184745872092660607901, 208736685354534226578732061, -674286748947407885947151795, -1904494907491565103111720033, 1032026767571584116137556307, 415047617744240008748646521, 2117855023320329089077164022, -3065136867326386863326504335, 1946080559065193064224590521, -2258824290494157582420059301, 1059057115242999512911982949, -1010949990105822004415418820, 28104 -- (+2105 chars; full line in the Zenodo source)
[1056801504494858608346049094, 485363135376871756790607430, -1728214030410934358570153520, 98310599387939231304865682, 208736685354534226578732061, 625154251935324760044480594, -1407018333394826699916506430, 889458385719609813938693823, 329017372330784431298518925, 1032026767571584116137556307, -3064305562680523145436725324, 583514650211044977172865077, 218895510844383934788180499, 6582552618560 -- (+2098 chars; full line in the Zenodo source)
[-1611629711327839165702198224, -977423643068998835894499069, 1056801504494858608346049094, 1597863786739009634213874388, -202866741498391204658274811, 485363135376871756790607430, 582858897946262056759230199, -636591647070256988234990235, -1728214030410934358570153520, 1162997184745872092660607901, 2263301469399144409645315833, 98310599387939231304865682, -2148113684716556160509069762, 80856641 -- (+2102 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 83).map (fun t => rowA (166 + 1) t (rng 1 83)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 83 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 83 B A = sid 9392477403327859681557337885594 83 := rfl
theorem d_ne : (9392477403327859681557337885594 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 83 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 83) (h0 : mv A g = zeros 83) : g = zeros 83 :=
kernel_zero 83 9392477403327859681557337885594 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 166 83 = true := rfl
/-- **Balanced ⇒ pairs for p = 167.** A list with entries in (0, 167) that is balanced for 1 ≤ t ≤ 83
has as many copies of x as of 167 − x for every 1 ≤ x ≤ 83 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 167)
(hb : ∀ t, 1 ≤ t → t < 1 + 83 → tsum 167 t c + tsum 167 t c = c.length * 167) :
(rng 1 83).all (fun x => Nat.beq (cnt x c) (cnt (167 - x) c)) = true :=
pairs_of_bal 166 83 9392477403327859681557337885594 d_ne A B len cert A_def delta c hr hb
end MailletCert167
#print axioms MailletCert167.A_def
#print axioms MailletCert167.len
#print axioms MailletCert167.cert
#print axioms MailletCert167.d_ne
#print axioms MailletCert167.kernel
#print axioms MailletCert167.delta
#print axioms MailletCert167.pairs
lean_all/hodge/MailletCert17.lean
/-
hodge/MailletCert17.lean — T41 (goals G849b, G849c): for p = 17 the 8 × 8 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 8)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 34 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 17) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert17
open MailletLin MailletBridge
def A : List (List Int) := [
[-15, -13, -11, -9, -7, -5, -3, -1],
[-13, -9, -5, -1, 3, 7, 11, 15],
[-11, -5, 1, 7, 13, -15, -9, -3],
[-9, -1, 7, 15, -11, -3, 5, 13],
[-7, 3, 13, -11, -1, 9, -15, -5],
[-5, 7, -15, -3, 9, -13, -1, 11],
[-3, 11, -9, 5, -15, -1, 13, -7],
[-1, 15, -3, 13, -5, 11, -7, 9]]
def B : List (List Int) := [
[0, -1, -1, 0, -1, 0, -1, 0],
[-1, 0, 0, 0, 1, 1, 1, 0],
[-1, 0, 0, 1, 1, 0, 0, -1],
[0, 0, 1, 0, -1, -1, 0, 1],
[-1, 1, 1, -1, 0, 0, 0, 0],
[0, 1, 0, -1, 0, -1, 0, 1],
[-1, 1, 0, 0, 0, 0, 1, -1],
[0, 0, -1, 1, 0, 1, -1, 0]]
theorem A_def : A = (rng 1 8).map (fun t => rowA (16 + 1) t (rng 1 8)) := rfl
theorem len : allLen 8 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 8 B A = sid 34 8 := rfl
theorem d_ne : (34 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 8 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 8) (h0 : mv A g = zeros 8) : g = zeros 8 :=
kernel_zero 8 34 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 16 8 = true := rfl
/-- **Balanced ⇒ pairs for p = 17.** A list with entries in (0, 17) that is balanced for 1 ≤ t ≤ 8
has as many copies of x as of 17 − x for every 1 ≤ x ≤ 8 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 17)
(hb : ∀ t, 1 ≤ t → t < 1 + 8 → tsum 17 t c + tsum 17 t c = c.length * 17) :
(rng 1 8).all (fun x => Nat.beq (cnt x c) (cnt (17 - x) c)) = true :=
pairs_of_bal 16 8 34 d_ne A B len cert A_def delta c hr hb
end MailletCert17
#print axioms MailletCert17.A_def
#print axioms MailletCert17.len
#print axioms MailletCert17.cert
#print axioms MailletCert17.d_ne
#print axioms MailletCert17.kernel
#print axioms MailletCert17.delta
#print axioms MailletCert17.pairs
lean_all/hodge/MailletCert173.lean
/-
hodge/MailletCert173.lean — T41 (goals G849b, G849c): for p = 173 the 86 × 86 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 86)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 589081008262337923240805891855690 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 173) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert173
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-171, -169, -167, -165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, - -- (+64 chars; full line in the Zenodo source)
[-169, -165, -161, -157, -153, -149, -145, -141, -137, -133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, 143, 147, 151, 155, -- (+21 chars; full line in the Zenodo source)
[-167, -161, -155, -149, -143, -137, -131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 169, -171, -165, -159, -153, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, -63, -57, -51, -45 -- (+35 chars; full line in the Zenodo source)
[-165, -157, -149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, -167, -159, -151, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, -- (+20 chars; full line in the Zenodo source)
[-163, -153, -143, -133, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, -169, -159, -149, -139, -129, -119, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, 141, 151, 161, 171, -165, -155, -145, -135, -125, -115, -105, -95, -85, -75, -65, -- (+29 chars; full line in the Zenodo source)
[-161, -149, -137, -125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103, 115, 127, 139, 151, 163, -171, -159, -147, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, 141, 153, 165, -169, -157, -145, -133, -121, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, 119 -- (+22 chars; full line in the Zenodo source)
[-159, -145, -131, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, 135, 149, 163, -169, -155, -141, -127, -113, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, 111, 125, 139, 153, 167, -165, -151, -137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, 143, 157, 171, -161, -147, -133, -119, -105, -91, -7 -- (+27 chars; full line in the Zenodo source)
[-157, -141, -125, -109, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, -167, -151, -135, -119, -103, -87, -71, -55, -39, -23, -7, 9, 25, 41, 57, 73, 89, 105, 121, 137, 153, 169, -161, -145, -129, -113, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, -171, -155, -139, -123, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, -- (+21 chars; full line in the Zenodo source)
[-155, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, 151, 169, -159, -141, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, 147, 165, -163, -145, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, 143, 161, -167, -149, -131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, 139, 157, -171, -153, -135, -117, -99 -- (+26 chars; full line in the Zenodo source)
[-153, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, 147, 167, -159, -139, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, 141, 161, -165, -145, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, 155, -171, -151, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, 149, 169, -157, -137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, -- (+20 chars; full line in the Zenodo source)
[-151, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, 157, -167, -145, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, 141, 163, -161, -139, -117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, 147, 169, -155, -133, -111, -89, -67, -45, -23, -1, 21, 43, 65, 87, 109, 131, 153, -171, -149, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, 159, -165, -143, -121, -- (+25 chars; full line in the Zenodo source)
[-149, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, 139, 163, -159, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, 153, -169, -145, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119, 143, 167, -155, -131, -107, -83, -59, -35, -11, 13, 37, 61, 85, 109, 133, 157, -165, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, 171, -151, -127, -103, -79, -55, -31, -7, 17, 41, 65 -- (+21 chars; full line in the Zenodo source)
[-147, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, 139, 165, -155, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, 157, -163, -137, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, 149, -171, -145, -119, -93, -67, -41, -15, 11, 37, 63, 89, 115, 141, 167, -153, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, 159, -161, -135, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, 151, -169, -143, -1 -- (+24 chars; full line in the Zenodo source)
[-145, -117, -89, -61, -33, -5, 23, 51, 79, 107, 135, 163, -155, -127, -99, -71, -43, -15, 13, 41, 69, 97, 125, 153, -165, -137, -109, -81, -53, -25, 3, 31, 59, 87, 115, 143, 171, -147, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, 161, -157, -129, -101, -73, -45, -17, 11, 39, 67, 95, 123, 151, -167, -139, -111, -83, -55, -27, 1, 29, 57, 85, 113, 141, 169, -149, -121, -93, -65, -37, -9, 19, 47, -- (+20 chars; full line in the Zenodo source)
[-143, -113, -83, -53, -23, 7, 37, 67, 97, 127, 157, -159, -129, -99, -69, -39, -9, 21, 51, 81, 111, 141, 171, -145, -115, -85, -55, -25, 5, 35, 65, 95, 125, 155, -161, -131, -101, -71, -41, -11, 19, 49, 79, 109, 139, 169, -147, -117, -87, -57, -27, 3, 33, 63, 93, 123, 153, -163, -133, -103, -73, -43, -13, 17, 47, 77, 107, 137, 167, -149, -119, -89, -59, -29, 1, 31, 61, 91, 121, 151, -165, -135, -- (+22 chars; full line in the Zenodo source)
[-141, -109, -77, -45, -13, 19, 51, 83, 115, 147, -167, -135, -103, -71, -39, -7, 25, 57, 89, 121, 153, -161, -129, -97, -65, -33, -1, 31, 63, 95, 127, 159, -155, -123, -91, -59, -27, 5, 37, 69, 101, 133, 165, -149, -117, -85, -53, -21, 11, 43, 75, 107, 139, 171, -143, -111, -79, -47, -15, 17, 49, 81, 113, 145, -169, -137, -105, -73, -41, -9, 23, 55, 87, 119, 151, -163, -131, -99, -67, -35, -3, -- (+22 chars; full line in the Zenodo source)
[-139, -105, -71, -37, -3, 31, 65, 99, 133, 167, -145, -111, -77, -43, -9, 25, 59, 93, 127, 161, -151, -117, -83, -49, -15, 19, 53, 87, 121, 155, -157, -123, -89, -55, -21, 13, 47, 81, 115, 149, -163, -129, -95, -61, -27, 7, 41, 75, 109, 143, -169, -135, -101, -67, -33, 1, 35, 69, 103, 137, 171, -141, -107, -73, -39, -5, 29, 63, 97, 131, 165, -147, -113, -79, -45, -11, 23, 57, 91, 125, 159, -153 -- (+23 chars; full line in the Zenodo source)
[-137, -101, -65, -29, 7, 43, 79, 115, 151, -159, -123, -87, -51, -15, 21, 57, 93, 129, 165, -145, -109, -73, -37, -1, 35, 71, 107, 143, -167, -131, -95, -59, -23, 13, 49, 85, 121, 157, -153, -117, -81, -45, -9, 27, 63, 99, 135, 171, -139, -103, -67, -31, 5, 41, 77, 113, 149, -161, -125, -89, -53, -17, 19, 55, 91, 127, 163, -147, -111, -75, -39, -3, 33, 69, 105, 141, -169, -133, -97, -61, -25, 1 -- (+21 chars; full line in the Zenodo source)
[-135, -97, -59, -21, 17, 55, 93, 131, 169, -139, -101, -63, -25, 13, 51, 89, 127, 165, -143, -105, -67, -29, 9, 47, 85, 123, 161, -147, -109, -71, -33, 5, 43, 81, 119, 157, -151, -113, -75, -37, 1, 39, 77, 115, 153, -155, -117, -79, -41, -3, 35, 73, 111, 149, -159, -121, -83, -45, -7, 31, 69, 107, 145, -163, -125, -87, -49, -11, 27, 65, 103, 141, -167, -129, -91, -53, -15, 23, 61, 99, 137, -171 -- (+23 chars; full line in the Zenodo source)
[-133, -93, -53, -13, 27, 67, 107, 147, -159, -119, -79, -39, 1, 41, 81, 121, 161, -145, -105, -65, -25, 15, 55, 95, 135, -171, -131, -91, -51, -11, 29, 69, 109, 149, -157, -117, -77, -37, 3, 43, 83, 123, 163, -143, -103, -63, -23, 17, 57, 97, 137, -169, -129, -89, -49, -9, 31, 71, 111, 151, -155, -115, -75, -35, 5, 45, 85, 125, 165, -141, -101, -61, -21, 19, 59, 99, 139, -167, -127, -87, -47, - -- (+21 chars; full line in the Zenodo source)
[-131, -89, -47, -5, 37, 79, 121, 163, -141, -99, -57, -15, 27, 69, 111, 153, -151, -109, -67, -25, 17, 59, 101, 143, -161, -119, -77, -35, 7, 49, 91, 133, -171, -129, -87, -45, -3, 39, 81, 123, 165, -139, -97, -55, -13, 29, 71, 113, 155, -149, -107, -65, -23, 19, 61, 103, 145, -159, -117, -75, -33, 9, 51, 93, 135, -169, -127, -85, -43, -1, 41, 83, 125, 167, -137, -95, -53, -11, 31, 73, 115, 157 -- (+24 chars; full line in the Zenodo source)
[-129, -85, -41, 3, 47, 91, 135, -167, -123, -79, -35, 9, 53, 97, 141, -161, -117, -73, -29, 15, 59, 103, 147, -155, -111, -67, -23, 21, 65, 109, 153, -149, -105, -61, -17, 27, 71, 115, 159, -143, -99, -55, -11, 33, 77, 121, 165, -137, -93, -49, -5, 39, 83, 127, 171, -131, -87, -43, 1, 45, 89, 133, -169, -125, -81, -37, 7, 51, 95, 139, -163, -119, -75, -31, 13, 57, 101, 145, -157, -113, -69, -25 -- (+20 chars; full line in the Zenodo source)
[-127, -81, -35, 11, 57, 103, 149, -151, -105, -59, -13, 33, 79, 125, 171, -129, -83, -37, 9, 55, 101, 147, -153, -107, -61, -15, 31, 77, 123, 169, -131, -85, -39, 7, 53, 99, 145, -155, -109, -63, -17, 29, 75, 121, 167, -133, -87, -41, 5, 51, 97, 143, -157, -111, -65, -19, 27, 73, 119, 165, -135, -89, -43, 3, 49, 95, 141, -159, -113, -67, -21, 25, 71, 117, 163, -137, -91, -45, 1, 47, 93, 139, -1 -- (+20 chars; full line in the Zenodo source)
[-125, -77, -29, 19, 67, 115, 163, -135, -87, -39, 9, 57, 105, 153, -145, -97, -49, -1, 47, 95, 143, -155, -107, -59, -11, 37, 85, 133, -165, -117, -69, -21, 27, 75, 123, 171, -127, -79, -31, 17, 65, 113, 161, -137, -89, -41, 7, 55, 103, 151, -147, -99, -51, -3, 45, 93, 141, -157, -109, -61, -13, 35, 83, 131, -167, -119, -71, -23, 25, 73, 121, 169, -129, -81, -33, 15, 63, 111, 159, -139, -91, -4 -- (+20 chars; full line in the Zenodo source)
[-123, -73, -23, 27, 77, 127, -169, -119, -69, -19, 31, 81, 131, -165, -115, -65, -15, 35, 85, 135, -161, -111, -61, -11, 39, 89, 139, -157, -107, -57, -7, 43, 93, 143, -153, -103, -53, -3, 47, 97, 147, -149, -99, -49, 1, 51, 101, 151, -145, -95, -45, 5, 55, 105, 155, -141, -91, -41, 9, 59, 109, 159, -137, -87, -37, 13, 63, 113, 163, -133, -83, -33, 17, 67, 117, 167, -129, -79, -29, 21, 71, 121, -- (+22 chars; full line in the Zenodo source)
[-121, -69, -17, 35, 87, 139, -155, -103, -51, 1, 53, 105, 157, -137, -85, -33, 19, 71, 123, -171, -119, -67, -15, 37, 89, 141, -153, -101, -49, 3, 55, 107, 159, -135, -83, -31, 21, 73, 125, -169, -117, -65, -13, 39, 91, 143, -151, -99, -47, 5, 57, 109, 161, -133, -81, -29, 23, 75, 127, -167, -115, -63, -11, 41, 93, 145, -149, -97, -45, 7, 59, 111, 163, -131, -79, -27, 25, 77, 129, -165, -113, - -- (+21 chars; full line in the Zenodo source)
[-119, -65, -11, 43, 97, 151, -141, -87, -33, 21, 75, 129, -163, -109, -55, -1, 53, 107, 161, -131, -77, -23, 31, 85, 139, -153, -99, -45, 9, 63, 117, 171, -121, -67, -13, 41, 95, 149, -143, -89, -35, 19, 73, 127, -165, -111, -57, -3, 51, 105, 159, -133, -79, -25, 29, 83, 137, -155, -101, -47, 7, 61, 115, 169, -123, -69, -15, 39, 93, 147, -145, -91, -37, 17, 71, 125, -167, -113, -59, -5, 49, 103 -- (+23 chars; full line in the Zenodo source)
[-117, -61, -5, 51, 107, 163, -127, -71, -15, 41, 97, 153, -137, -81, -25, 31, 87, 143, -147, -91, -35, 21, 77, 133, -157, -101, -45, 11, 67, 123, -167, -111, -55, 1, 57, 113, 169, -121, -65, -9, 47, 103, 159, -131, -75, -19, 37, 93, 149, -141, -85, -29, 27, 83, 139, -151, -95, -39, 17, 73, 129, -161, -105, -49, 7, 63, 119, -171, -115, -59, -3, 53, 109, 165, -125, -69, -13, 43, 99, 155, -135, -7 -- (+21 chars; full line in the Zenodo source)
[-115, -57, 1, 59, 117, -171, -113, -55, 3, 61, 119, -169, -111, -53, 5, 63, 121, -167, -109, -51, 7, 65, 123, -165, -107, -49, 9, 67, 125, -163, -105, -47, 11, 69, 127, -161, -103, -45, 13, 71, 129, -159, -101, -43, 15, 73, 131, -157, -99, -41, 17, 75, 133, -155, -97, -39, 19, 77, 135, -153, -95, -37, 21, 79, 137, -151, -93, -35, 23, 81, 139, -149, -91, -33, 25, 83, 141, -147, -89, -31, 27, 85, -- (+22 chars; full line in the Zenodo source)
[-113, -53, 7, 67, 127, -159, -99, -39, 21, 81, 141, -145, -85, -25, 35, 95, 155, -131, -71, -11, 49, 109, 169, -117, -57, 3, 63, 123, -163, -103, -43, 17, 77, 137, -149, -89, -29, 31, 91, 151, -135, -75, -15, 45, 105, 165, -121, -61, -1, 59, 119, -167, -107, -47, 13, 73, 133, -153, -93, -33, 27, 87, 147, -139, -79, -19, 41, 101, 161, -125, -65, -5, 55, 115, -171, -111, -51, 9, 69, 129, -157, -9 -- (+21 chars; full line in the Zenodo source)
[-111, -49, 13, 75, 137, -147, -85, -23, 39, 101, 163, -121, -59, 3, 65, 127, -157, -95, -33, 29, 91, 153, -131, -69, -7, 55, 117, -167, -105, -43, 19, 81, 143, -141, -79, -17, 45, 107, 169, -115, -53, 9, 71, 133, -151, -89, -27, 35, 97, 159, -125, -63, -1, 61, 123, -161, -99, -37, 25, 87, 149, -135, -73, -11, 51, 113, -171, -109, -47, 15, 77, 139, -145, -83, -21, 41, 103, 165, -119, -57, 5, 67, -- (+22 chars; full line in the Zenodo source)
[-109, -45, 19, 83, 147, -135, -71, -7, 57, 121, -161, -97, -33, 31, 95, 159, -123, -59, 5, 69, 133, -149, -85, -21, 43, 107, 171, -111, -47, 17, 81, 145, -137, -73, -9, 55, 119, -163, -99, -35, 29, 93, 157, -125, -61, 3, 67, 131, -151, -87, -23, 41, 105, 169, -113, -49, 15, 79, 143, -139, -75, -11, 53, 117, -165, -101, -37, 27, 91, 155, -127, -63, 1, 65, 129, -153, -89, -25, 39, 103, 167, -115, -- (+19 chars; full line in the Zenodo source)
[-107, -41, 25, 91, 157, -123, -57, 9, 75, 141, -139, -73, -7, 59, 125, -155, -89, -23, 43, 109, -171, -105, -39, 27, 93, 159, -121, -55, 11, 77, 143, -137, -71, -5, 61, 127, -153, -87, -21, 45, 111, -169, -103, -37, 29, 95, 161, -119, -53, 13, 79, 145, -135, -69, -3, 63, 129, -151, -85, -19, 47, 113, -167, -101, -35, 31, 97, 163, -117, -51, 15, 81, 147, -133, -67, -1, 65, 131, -149, -83, -17, 4 -- (+24 chars; full line in the Zenodo source)
[-105, -37, 31, 99, 167, -111, -43, 25, 93, 161, -117, -49, 19, 87, 155, -123, -55, 13, 81, 149, -129, -61, 7, 75, 143, -135, -67, 1, 69, 137, -141, -73, -5, 63, 131, -147, -79, -11, 57, 125, -153, -85, -17, 51, 119, -159, -91, -23, 45, 113, -165, -97, -29, 39, 107, -171, -103, -35, 33, 101, 169, -109, -41, 27, 95, 163, -115, -47, 21, 89, 157, -121, -53, 15, 83, 151, -127, -59, 9, 77, 145, -133, -- (+18 chars; full line in the Zenodo source)
[-103, -33, 37, 107, -169, -99, -29, 41, 111, -165, -95, -25, 45, 115, -161, -91, -21, 49, 119, -157, -87, -17, 53, 123, -153, -83, -13, 57, 127, -149, -79, -9, 61, 131, -145, -75, -5, 65, 135, -141, -71, -1, 69, 139, -137, -67, 3, 73, 143, -133, -63, 7, 77, 147, -129, -59, 11, 81, 151, -125, -55, 15, 85, 155, -121, -51, 19, 89, 159, -117, -47, 23, 93, 163, -113, -43, 27, 97, 167, -109, -39, 31, -- (+22 chars; full line in the Zenodo source)
[-101, -29, 43, 115, -159, -87, -15, 57, 129, -145, -73, -1, 71, 143, -131, -59, 13, 85, 157, -117, -45, 27, 99, 171, -103, -31, 41, 113, -161, -89, -17, 55, 127, -147, -75, -3, 69, 141, -133, -61, 11, 83, 155, -119, -47, 25, 97, 169, -105, -33, 39, 111, -163, -91, -19, 53, 125, -149, -77, -5, 67, 139, -135, -63, 9, 81, 153, -121, -49, 23, 95, 167, -107, -35, 37, 109, -165, -93, -21, 51, 123, -1 -- (+22 chars; full line in the Zenodo source)
[-99, -25, 49, 123, -149, -75, -1, 73, 147, -125, -51, 23, 97, 171, -101, -27, 47, 121, -151, -77, -3, 71, 145, -127, -53, 21, 95, 169, -103, -29, 45, 119, -153, -79, -5, 69, 143, -129, -55, 19, 93, 167, -105, -31, 43, 117, -155, -81, -7, 67, 141, -131, -57, 17, 91, 165, -107, -33, 41, 115, -157, -83, -9, 65, 139, -133, -59, 15, 89, 163, -109, -35, 39, 113, -159, -85, -11, 63, 137, -135, -61, 13 -- (+22 chars; full line in the Zenodo source)
[-97, -21, 55, 131, -139, -63, 13, 89, 165, -105, -29, 47, 123, -147, -71, 5, 81, 157, -113, -37, 39, 115, -155, -79, -3, 73, 149, -121, -45, 31, 107, -163, -87, -11, 65, 141, -129, -53, 23, 99, -171, -95, -19, 57, 133, -137, -61, 15, 91, 167, -103, -27, 49, 125, -145, -69, 7, 83, 159, -111, -35, 41, 117, -153, -77, -1, 75, 151, -119, -43, 33, 109, -161, -85, -9, 67, 143, -127, -51, 25, 101, -16 -- (+22 chars; full line in the Zenodo source)
[-95, -17, 61, 139, -129, -51, 27, 105, -163, -85, -7, 71, 149, -119, -41, 37, 115, -153, -75, 3, 81, 159, -109, -31, 47, 125, -143, -65, 13, 91, 169, -99, -21, 57, 135, -133, -55, 23, 101, -167, -89, -11, 67, 145, -123, -45, 33, 111, -157, -79, -1, 77, 155, -113, -35, 43, 121, -147, -69, 9, 87, 165, -103, -25, 53, 131, -137, -59, 19, 97, -171, -93, -15, 63, 141, -127, -49, 29, 107, -161, -83, - -- (+23 chars; full line in the Zenodo source)
[-93, -13, 67, 147, -119, -39, 41, 121, -145, -65, 15, 95, -171, -91, -11, 69, 149, -117, -37, 43, 123, -143, -63, 17, 97, -169, -89, -9, 71, 151, -115, -35, 45, 125, -141, -61, 19, 99, -167, -87, -7, 73, 153, -113, -33, 47, 127, -139, -59, 21, 101, -165, -85, -5, 75, 155, -111, -31, 49, 129, -137, -57, 23, 103, -163, -83, -3, 77, 157, -109, -29, 51, 131, -135, -55, 25, 105, -161, -81, -1, 79, 1 -- (+24 chars; full line in the Zenodo source)
[-91, -9, 73, 155, -109, -27, 55, 137, -127, -45, 37, 119, -145, -63, 19, 101, -163, -81, 1, 83, 165, -99, -17, 65, 147, -117, -35, 47, 129, -135, -53, 29, 111, -153, -71, 11, 93, -171, -89, -7, 75, 157, -107, -25, 57, 139, -125, -43, 39, 121, -143, -61, 21, 103, -161, -79, 3, 85, 167, -97, -15, 67, 149, -115, -33, 49, 131, -133, -51, 31, 113, -151, -69, 13, 95, -169, -87, -5, 77, 159, -105, -23 -- (+22 chars; full line in the Zenodo source)
[-89, -5, 79, 163, -99, -15, 69, 153, -109, -25, 59, 143, -119, -35, 49, 133, -129, -45, 39, 123, -139, -55, 29, 113, -149, -65, 19, 103, -159, -75, 9, 93, -169, -85, -1, 83, 167, -95, -11, 73, 157, -105, -21, 63, 147, -115, -31, 53, 137, -125, -41, 43, 127, -135, -51, 33, 117, -145, -61, 23, 107, -155, -71, 13, 97, -165, -81, 3, 87, 171, -91, -7, 77, 161, -101, -17, 67, 151, -111, -27, 57, 141, -- (+21 chars; full line in the Zenodo source)
[-87, -1, 85, 171, -89, -3, 83, 169, -91, -5, 81, 167, -93, -7, 79, 165, -95, -9, 77, 163, -97, -11, 75, 161, -99, -13, 73, 159, -101, -15, 71, 157, -103, -17, 69, 155, -105, -19, 67, 153, -107, -21, 65, 151, -109, -23, 63, 149, -111, -25, 61, 147, -113, -27, 59, 145, -115, -29, 57, 143, -117, -31, 55, 141, -119, -33, 53, 139, -121, -35, 51, 137, -123, -37, 49, 135, -125, -39, 47, 133, -127, -41 -- (+22 chars; full line in the Zenodo source)
[-85, 3, 91, -167, -79, 9, 97, -161, -73, 15, 103, -155, -67, 21, 109, -149, -61, 27, 115, -143, -55, 33, 121, -137, -49, 39, 127, -131, -43, 45, 133, -125, -37, 51, 139, -119, -31, 57, 145, -113, -25, 63, 151, -107, -19, 69, 157, -101, -13, 75, 163, -95, -7, 81, 169, -89, -1, 87, -171, -83, 5, 93, -165, -77, 11, 99, -159, -71, 17, 105, -153, -65, 23, 111, -147, -59, 29, 117, -141, -53, 35, 123, -- (+21 chars; full line in the Zenodo source)
[-83, 7, 97, -159, -69, 21, 111, -145, -55, 35, 125, -131, -41, 49, 139, -117, -27, 63, 153, -103, -13, 77, 167, -89, 1, 91, -165, -75, 15, 105, -151, -61, 29, 119, -137, -47, 43, 133, -123, -33, 57, 147, -109, -19, 71, 161, -95, -5, 85, -171, -81, 9, 99, -157, -67, 23, 113, -143, -53, 37, 127, -129, -39, 51, 141, -115, -25, 65, 155, -101, -11, 79, 169, -87, 3, 93, -163, -73, 17, 107, -149, -59, -- (+21 chars; full line in the Zenodo source)
[-81, 11, 103, -151, -59, 33, 125, -129, -37, 55, 147, -107, -15, 77, 169, -85, 7, 99, -155, -63, 29, 121, -133, -41, 51, 143, -111, -19, 73, 165, -89, 3, 95, -159, -67, 25, 117, -137, -45, 47, 139, -115, -23, 69, 161, -93, -1, 91, -163, -71, 21, 113, -141, -49, 43, 135, -119, -27, 65, 157, -97, -5, 87, -167, -75, 17, 109, -145, -53, 39, 131, -123, -31, 61, 153, -101, -9, 83, -171, -79, 13, 105, -- (+21 chars; full line in the Zenodo source)
[-79, 15, 109, -143, -49, 45, 139, -113, -19, 75, 169, -83, 11, 105, -147, -53, 41, 135, -117, -23, 71, 165, -87, 7, 101, -151, -57, 37, 131, -121, -27, 67, 161, -91, 3, 97, -155, -61, 33, 127, -125, -31, 63, 157, -95, -1, 93, -159, -65, 29, 123, -129, -35, 59, 153, -99, -5, 89, -163, -69, 25, 119, -133, -39, 55, 149, -103, -9, 85, -167, -73, 21, 115, -137, -43, 51, 145, -107, -13, 81, -171, -77 -- (+22 chars; full line in the Zenodo source)
[-77, 19, 115, -135, -39, 57, 153, -97, -1, 95, -155, -59, 37, 133, -117, -21, 75, 171, -79, 17, 113, -137, -41, 55, 151, -99, -3, 93, -157, -61, 35, 131, -119, -23, 73, 169, -81, 15, 111, -139, -43, 53, 149, -101, -5, 91, -159, -63, 33, 129, -121, -25, 71, 167, -83, 13, 109, -141, -45, 51, 147, -103, -7, 89, -161, -65, 31, 127, -123, -27, 69, 165, -85, 11, 107, -143, -47, 49, 145, -105, -9, 87, -- (+21 chars; full line in the Zenodo source)
[-75, 23, 121, -127, -29, 69, 167, -81, 17, 115, -133, -35, 63, 161, -87, 11, 109, -139, -41, 57, 155, -93, 5, 103, -145, -47, 51, 149, -99, -1, 97, -151, -53, 45, 143, -105, -7, 91, -157, -59, 39, 137, -111, -13, 85, -163, -65, 33, 131, -117, -19, 79, -169, -71, 27, 125, -123, -25, 73, 171, -77, 21, 119, -129, -31, 67, 165, -83, 15, 113, -135, -37, 61, 159, -89, 9, 107, -141, -43, 55, 153, -95, -- (+20 chars; full line in the Zenodo source)
[-73, 27, 127, -119, -19, 81, -165, -65, 35, 135, -111, -11, 89, -157, -57, 43, 143, -103, -3, 97, -149, -49, 51, 151, -95, 5, 105, -141, -41, 59, 159, -87, 13, 113, -133, -33, 67, 167, -79, 21, 121, -125, -25, 75, -171, -71, 29, 129, -117, -17, 83, -163, -63, 37, 137, -109, -9, 91, -155, -55, 45, 145, -101, -1, 99, -147, -47, 53, 153, -93, 7, 107, -139, -39, 61, 161, -85, 15, 115, -131, -31, 69 -- (+21 chars; full line in the Zenodo source)
[-71, 31, 133, -111, -9, 93, -151, -49, 53, 155, -89, 13, 115, -129, -27, 75, -169, -67, 35, 137, -107, -5, 97, -147, -45, 57, 159, -85, 17, 119, -125, -23, 79, -165, -63, 39, 141, -103, -1, 101, -143, -41, 61, 163, -81, 21, 123, -121, -19, 83, -161, -59, 43, 145, -99, 3, 105, -139, -37, 65, 167, -77, 25, 127, -117, -15, 87, -157, -55, 47, 149, -95, 7, 109, -135, -33, 69, 171, -73, 29, 131, -113 -- (+22 chars; full line in the Zenodo source)
[-69, 35, 139, -103, 1, 105, -137, -33, 71, -171, -67, 37, 141, -101, 3, 107, -135, -31, 73, -169, -65, 39, 143, -99, 5, 109, -133, -29, 75, -167, -63, 41, 145, -97, 7, 111, -131, -27, 77, -165, -61, 43, 147, -95, 9, 113, -129, -25, 79, -163, -59, 45, 149, -93, 11, 115, -127, -23, 81, -161, -57, 47, 151, -91, 13, 117, -125, -21, 83, -159, -55, 49, 153, -89, 15, 119, -123, -19, 85, -157, -53, 51, -- (+20 chars; full line in the Zenodo source)
[-67, 39, 145, -95, 11, 117, -123, -17, 89, -151, -45, 61, 167, -73, 33, 139, -101, 5, 111, -129, -23, 83, -157, -51, 55, 161, -79, 27, 133, -107, -1, 105, -135, -29, 77, -163, -57, 49, 155, -85, 21, 127, -113, -7, 99, -141, -35, 71, -169, -63, 43, 149, -91, 15, 121, -119, -13, 93, -147, -41, 65, 171, -69, 37, 143, -97, 9, 115, -125, -19, 87, -153, -47, 59, 165, -75, 31, 137, -103, 3, 109, -131, -- (+21 chars; full line in the Zenodo source)
[-65, 43, 151, -87, 21, 129, -109, -1, 107, -131, -23, 85, -153, -45, 63, 171, -67, 41, 149, -89, 19, 127, -111, -3, 105, -133, -25, 83, -155, -47, 61, 169, -69, 39, 147, -91, 17, 125, -113, -5, 103, -135, -27, 81, -157, -49, 59, 167, -71, 37, 145, -93, 15, 123, -115, -7, 101, -137, -29, 79, -159, -51, 57, 165, -73, 35, 143, -95, 13, 121, -117, -9, 99, -139, -31, 77, -161, -53, 55, 163, -75, 33, -- (+20 chars; full line in the Zenodo source)
[-63, 47, 157, -79, 31, 141, -95, 15, 125, -111, -1, 109, -127, -17, 93, -143, -33, 77, -159, -49, 61, 171, -65, 45, 155, -81, 29, 139, -97, 13, 123, -113, -3, 107, -129, -19, 91, -145, -35, 75, -161, -51, 59, 169, -67, 43, 153, -83, 27, 137, -99, 11, 121, -115, -5, 105, -131, -21, 89, -147, -37, 73, -163, -53, 57, 167, -69, 41, 151, -85, 25, 135, -101, 9, 119, -117, -7, 103, -133, -23, 87, -149 -- (+22 chars; full line in the Zenodo source)
[-61, 51, 163, -71, 41, 153, -81, 31, 143, -91, 21, 133, -101, 11, 123, -111, 1, 113, -121, -9, 103, -131, -19, 93, -141, -29, 83, -151, -39, 73, -161, -49, 63, -171, -59, 53, 165, -69, 43, 155, -79, 33, 145, -89, 23, 135, -99, 13, 125, -109, 3, 115, -119, -7, 105, -129, -17, 95, -139, -27, 85, -149, -37, 75, -159, -47, 65, -169, -57, 55, 167, -67, 45, 157, -77, 35, 147, -87, 25, 137, -97, 15, 1 -- (+18 chars; full line in the Zenodo source)
[-59, 55, 169, -63, 51, 165, -67, 47, 161, -71, 43, 157, -75, 39, 153, -79, 35, 149, -83, 31, 145, -87, 27, 141, -91, 23, 137, -95, 19, 133, -99, 15, 129, -103, 11, 125, -107, 7, 121, -111, 3, 117, -115, -1, 113, -119, -5, 109, -123, -9, 105, -127, -13, 101, -131, -17, 97, -135, -21, 93, -139, -25, 89, -143, -29, 85, -147, -33, 81, -151, -37, 77, -155, -41, 73, -159, -45, 69, -163, -49, 65, -167 -- (+22 chars; full line in the Zenodo source)
[-57, 59, -171, -55, 61, -169, -53, 63, -167, -51, 65, -165, -49, 67, -163, -47, 69, -161, -45, 71, -159, -43, 73, -157, -41, 75, -155, -39, 77, -153, -37, 79, -151, -35, 81, -149, -33, 83, -147, -31, 85, -145, -29, 87, -143, -27, 89, -141, -25, 91, -139, -23, 93, -137, -21, 95, -135, -19, 97, -133, -17, 99, -131, -15, 101, -129, -13, 103, -127, -11, 105, -125, -9, 107, -123, -7, 109, -121, -5, -- (+35 chars; full line in the Zenodo source)
[-55, 63, -165, -47, 71, -157, -39, 79, -149, -31, 87, -141, -23, 95, -133, -15, 103, -125, -7, 111, -117, 1, 119, -109, 9, 127, -101, 17, 135, -93, 25, 143, -85, 33, 151, -77, 41, 159, -69, 49, 167, -61, 57, -171, -53, 65, -163, -45, 73, -155, -37, 81, -147, -29, 89, -139, -21, 97, -131, -13, 105, -123, -5, 113, -115, 3, 121, -107, 11, 129, -99, 19, 137, -91, 27, 145, -83, 35, 153, -75, 43, 161 -- (+21 chars; full line in the Zenodo source)
[-53, 67, -159, -39, 81, -145, -25, 95, -131, -11, 109, -117, 3, 123, -103, 17, 137, -89, 31, 151, -75, 45, 165, -61, 59, -167, -47, 73, -153, -33, 87, -139, -19, 101, -125, -5, 115, -111, 9, 129, -97, 23, 143, -83, 37, 157, -69, 51, 171, -55, 65, -161, -41, 79, -147, -27, 93, -133, -13, 107, -119, 1, 121, -105, 15, 135, -91, 29, 149, -77, 43, 163, -63, 57, -169, -49, 71, -155, -35, 85, -141, -2 -- (+22 chars; full line in the Zenodo source)
[-51, 71, -153, -31, 91, -133, -11, 111, -113, 9, 131, -93, 29, 151, -73, 49, 171, -53, 69, -155, -33, 89, -135, -13, 109, -115, 7, 129, -95, 27, 149, -75, 47, 169, -55, 67, -157, -35, 87, -137, -15, 107, -117, 5, 127, -97, 25, 147, -77, 45, 167, -57, 65, -159, -37, 85, -139, -17, 105, -119, 3, 125, -99, 23, 145, -79, 43, 165, -59, 63, -161, -39, 83, -141, -19, 103, -121, 1, 123, -101, 21, 143, -- (+19 chars; full line in the Zenodo source)
[-49, 75, -147, -23, 101, -121, 3, 127, -95, 29, 153, -69, 55, -167, -43, 81, -141, -17, 107, -115, 9, 133, -89, 35, 159, -63, 61, -161, -37, 87, -135, -11, 113, -109, 15, 139, -83, 41, 165, -57, 67, -155, -31, 93, -129, -5, 119, -103, 21, 145, -77, 47, 171, -51, 73, -149, -25, 99, -123, 1, 125, -97, 27, 151, -71, 53, -169, -45, 79, -143, -19, 105, -117, 7, 131, -91, 33, 157, -65, 59, -163, -39, -- (+21 chars; full line in the Zenodo source)
[-47, 79, -141, -15, 111, -109, 17, 143, -77, 49, -171, -45, 81, -139, -13, 113, -107, 19, 145, -75, 51, -169, -43, 83, -137, -11, 115, -105, 21, 147, -73, 53, -167, -41, 85, -135, -9, 117, -103, 23, 149, -71, 55, -165, -39, 87, -133, -7, 119, -101, 25, 151, -69, 57, -163, -37, 89, -131, -5, 121, -99, 27, 153, -67, 59, -161, -35, 91, -129, -3, 123, -97, 29, 155, -65, 61, -159, -33, 93, -127, -1, -- (+25 chars; full line in the Zenodo source)
[-45, 83, -135, -7, 121, -97, 31, 159, -59, 69, -149, -21, 107, -111, 17, 145, -73, 55, -163, -35, 93, -125, 3, 131, -87, 41, 169, -49, 79, -139, -11, 117, -101, 27, 155, -63, 65, -153, -25, 103, -115, 13, 141, -77, 51, -167, -39, 89, -129, -1, 127, -91, 37, 165, -53, 75, -143, -15, 113, -105, 23, 151, -67, 61, -157, -29, 99, -119, 9, 137, -81, 47, -171, -43, 85, -133, -5, 123, -95, 33, 161, -57 -- (+22 chars; full line in the Zenodo source)
[-43, 87, -129, 1, 131, -85, 45, -171, -41, 89, -127, 3, 133, -83, 47, -169, -39, 91, -125, 5, 135, -81, 49, -167, -37, 93, -123, 7, 137, -79, 51, -165, -35, 95, -121, 9, 139, -77, 53, -163, -33, 97, -119, 11, 141, -75, 55, -161, -31, 99, -117, 13, 143, -73, 57, -159, -29, 101, -115, 15, 145, -71, 59, -157, -27, 103, -113, 17, 147, -69, 61, -155, -25, 105, -111, 19, 149, -67, 63, -153, -23, 107, -- (+21 chars; full line in the Zenodo source)
[-41, 91, -123, 9, 141, -73, 59, -155, -23, 109, -105, 27, 159, -55, 77, -137, -5, 127, -87, 45, -169, -37, 95, -119, 13, 145, -69, 63, -151, -19, 113, -101, 31, 163, -51, 81, -133, -1, 131, -83, 49, -165, -33, 99, -115, 17, 149, -65, 67, -147, -15, 117, -97, 35, 167, -47, 85, -129, 3, 135, -79, 53, -161, -29, 103, -111, 21, 153, -61, 71, -143, -11, 121, -93, 39, 171, -43, 89, -125, 7, 139, -75, -- (+21 chars; full line in the Zenodo source)
[-39, 95, -117, 17, 151, -61, 73, -139, -5, 129, -83, 51, -161, -27, 107, -105, 29, 163, -49, 85, -127, 7, 141, -71, 63, -149, -15, 119, -93, 41, -171, -37, 97, -115, 19, 153, -59, 75, -137, -3, 131, -81, 53, -159, -25, 109, -103, 31, 165, -47, 87, -125, 9, 143, -69, 65, -147, -13, 121, -91, 43, -169, -35, 99, -113, 21, 155, -57, 77, -135, -1, 133, -79, 55, -157, -23, 111, -101, 33, 167, -45, 89 -- (+22 chars; full line in the Zenodo source)
[-37, 99, -111, 25, 161, -49, 87, -123, 13, 149, -61, 75, -135, 1, 137, -73, 63, -147, -11, 125, -85, 51, -159, -23, 113, -97, 39, -171, -35, 101, -109, 27, 163, -47, 89, -121, 15, 151, -59, 77, -133, 3, 139, -71, 65, -145, -9, 127, -83, 53, -157, -21, 115, -95, 41, -169, -33, 103, -107, 29, 165, -45, 91, -119, 17, 153, -57, 79, -131, 5, 141, -69, 67, -143, -7, 129, -81, 55, -155, -19, 117, -93, -- (+21 chars; full line in the Zenodo source)
[-35, 103, -105, 33, 171, -37, 101, -107, 31, 169, -39, 99, -109, 29, 167, -41, 97, -111, 27, 165, -43, 95, -113, 25, 163, -45, 93, -115, 23, 161, -47, 91, -117, 21, 159, -49, 89, -119, 19, 157, -51, 87, -121, 17, 155, -53, 85, -123, 15, 153, -55, 83, -125, 13, 151, -57, 81, -127, 11, 149, -59, 79, -129, 9, 147, -61, 77, -131, 7, 145, -63, 75, -133, 5, 143, -65, 73, -135, 3, 141, -67, 71, -137, -- (+13 chars; full line in the Zenodo source)
[-33, 107, -99, 41, -165, -25, 115, -91, 49, -157, -17, 123, -83, 57, -149, -9, 131, -75, 65, -141, -1, 139, -67, 73, -133, 7, 147, -59, 81, -125, 15, 155, -51, 89, -117, 23, 163, -43, 97, -109, 31, 171, -35, 105, -101, 39, -167, -27, 113, -93, 47, -159, -19, 121, -85, 55, -151, -11, 129, -77, 63, -143, -3, 137, -69, 71, -135, 5, 145, -61, 79, -127, 13, 153, -53, 87, -119, 21, 161, -45, 95, -111 -- (+21 chars; full line in the Zenodo source)
[-31, 111, -93, 49, -155, -13, 129, -75, 67, -137, 5, 147, -57, 85, -119, 23, 165, -39, 103, -101, 41, -163, -21, 121, -83, 59, -145, -3, 139, -65, 77, -127, 15, 157, -47, 95, -109, 33, -171, -29, 113, -91, 51, -153, -11, 131, -73, 69, -135, 7, 149, -55, 87, -117, 25, 167, -37, 105, -99, 43, -161, -19, 123, -81, 61, -143, -1, 141, -63, 79, -125, 17, 159, -45, 97, -107, 35, -169, -27, 115, -89, 5 -- (+23 chars; full line in the Zenodo source)
[-29, 115, -87, 57, -145, -1, 143, -59, 85, -117, 27, 171, -31, 113, -89, 55, -147, -3, 141, -61, 83, -119, 25, 169, -33, 111, -91, 53, -149, -5, 139, -63, 81, -121, 23, 167, -35, 109, -93, 51, -151, -7, 137, -65, 79, -123, 21, 165, -37, 107, -95, 49, -153, -9, 135, -67, 77, -125, 19, 163, -39, 105, -97, 47, -155, -11, 133, -69, 75, -127, 17, 161, -41, 103, -99, 45, -157, -13, 131, -71, 73, -129 -- (+21 chars; full line in the Zenodo source)
[-27, 119, -81, 65, -135, 11, 157, -43, 103, -97, 49, -151, -5, 141, -59, 87, -113, 33, -167, -21, 125, -75, 71, -129, 17, 163, -37, 109, -91, 55, -145, 1, 147, -53, 93, -107, 39, -161, -15, 131, -69, 77, -123, 23, 169, -31, 115, -85, 61, -139, 7, 153, -47, 99, -101, 45, -155, -9, 137, -63, 83, -117, 29, -171, -25, 121, -79, 67, -133, 13, 159, -41, 105, -95, 51, -149, -3, 143, -57, 89, -111, 35, -- (+22 chars; full line in the Zenodo source)
[-25, 123, -75, 73, -125, 23, 171, -27, 121, -77, 71, -127, 21, 169, -29, 119, -79, 69, -129, 19, 167, -31, 117, -81, 67, -131, 17, 165, -33, 115, -83, 65, -133, 15, 163, -35, 113, -85, 63, -135, 13, 161, -37, 111, -87, 61, -137, 11, 159, -39, 109, -89, 59, -139, 9, 157, -41, 107, -91, 57, -141, 7, 155, -43, 105, -93, 55, -143, 5, 153, -45, 103, -95, 53, -145, 3, 151, -47, 101, -97, 51, -147, 1, -- (+15 chars; full line in the Zenodo source)
[-23, 127, -69, 81, -115, 35, -161, -11, 139, -57, 93, -103, 47, -149, 1, 151, -45, 105, -91, 59, -137, 13, 163, -33, 117, -79, 71, -125, 25, -171, -21, 129, -67, 83, -113, 37, -159, -9, 141, -55, 95, -101, 49, -147, 3, 153, -43, 107, -89, 61, -135, 15, 165, -31, 119, -77, 73, -123, 27, -169, -19, 131, -65, 85, -111, 39, -157, -7, 143, -53, 97, -99, 51, -145, 5, 155, -41, 109, -87, 63, -133, 17, -- (+21 chars; full line in the Zenodo source)
[-21, 131, -63, 89, -105, 47, -147, 5, 157, -37, 115, -79, 73, -121, 31, -163, -11, 141, -53, 99, -95, 57, -137, 15, 167, -27, 125, -69, 83, -111, 41, -153, -1, 151, -43, 109, -85, 67, -127, 25, -169, -17, 135, -59, 93, -101, 51, -143, 9, 161, -33, 119, -75, 77, -117, 35, -159, -7, 145, -49, 103, -91, 61, -133, 19, 171, -23, 129, -65, 87, -107, 45, -149, 3, 155, -39, 113, -81, 71, -123, 29, -165 -- (+21 chars; full line in the Zenodo source)
[-19, 135, -57, 97, -95, 59, -133, 21, -171, -17, 137, -55, 99, -93, 61, -131, 23, -169, -15, 139, -53, 101, -91, 63, -129, 25, -167, -13, 141, -51, 103, -89, 65, -127, 27, -165, -11, 143, -49, 105, -87, 67, -125, 29, -163, -9, 145, -47, 107, -85, 69, -123, 31, -161, -7, 147, -45, 109, -83, 71, -121, 33, -159, -5, 149, -43, 111, -81, 73, -119, 35, -157, -3, 151, -41, 113, -79, 75, -117, 37, -155 -- (+26 chars; full line in the Zenodo source)
[-17, 139, -51, 105, -85, 71, -119, 37, -153, 3, 159, -31, 125, -65, 91, -99, 57, -133, 23, -167, -11, 145, -45, 111, -79, 77, -113, 43, -147, 9, 165, -25, 131, -59, 97, -93, 63, -127, 29, -161, -5, 151, -39, 117, -73, 83, -107, 49, -141, 15, 171, -19, 137, -53, 103, -87, 69, -121, 35, -155, 1, 157, -33, 123, -67, 89, -101, 55, -135, 21, -169, -13, 143, -47, 109, -81, 75, -115, 41, -149, 7, 163, -- (+20 chars; full line in the Zenodo source)
[-15, 143, -45, 113, -75, 83, -105, 53, -135, 23, -165, -7, 151, -37, 121, -67, 91, -97, 61, -127, 31, -157, 1, 159, -29, 129, -59, 99, -89, 69, -119, 39, -149, 9, 167, -21, 137, -51, 107, -81, 77, -111, 47, -141, 17, -171, -13, 145, -43, 115, -73, 85, -103, 55, -133, 25, -163, -5, 153, -35, 123, -65, 93, -95, 63, -125, 33, -155, 3, 161, -27, 131, -57, 101, -87, 71, -117, 41, -147, 11, 169, -19, -- (+21 chars; full line in the Zenodo source)
[-13, 147, -39, 121, -65, 95, -91, 69, -117, 43, -143, 17, -169, -9, 151, -35, 125, -61, 99, -87, 73, -113, 47, -139, 21, -165, -5, 155, -31, 129, -57, 103, -83, 77, -109, 51, -135, 25, -161, -1, 159, -27, 133, -53, 107, -79, 81, -105, 55, -131, 29, -157, 3, 163, -23, 137, -49, 111, -75, 85, -101, 59, -127, 33, -153, 7, 167, -19, 141, -45, 115, -71, 89, -97, 63, -123, 37, -149, 11, 171, -15, 145 -- (+21 chars; full line in the Zenodo source)
[-11, 151, -33, 129, -55, 107, -77, 85, -99, 63, -121, 41, -143, 19, -165, -3, 159, -25, 137, -47, 115, -69, 93, -91, 71, -113, 49, -135, 27, -157, 5, 167, -17, 145, -39, 123, -61, 101, -83, 79, -105, 57, -127, 35, -149, 13, -171, -9, 153, -31, 131, -53, 109, -75, 87, -97, 65, -119, 43, -141, 21, -163, -1, 161, -23, 139, -45, 117, -67, 95, -89, 73, -111, 51, -133, 29, -155, 7, 169, -15, 147, -37 -- (+22 chars; full line in the Zenodo source)
[-9, 155, -27, 137, -45, 119, -63, 101, -81, 83, -99, 65, -117, 47, -135, 29, -153, 11, -171, -7, 157, -25, 139, -43, 121, -61, 103, -79, 85, -97, 67, -115, 49, -133, 31, -151, 13, -169, -5, 159, -23, 141, -41, 123, -59, 105, -77, 87, -95, 69, -113, 51, -131, 33, -149, 15, -167, -3, 161, -21, 143, -39, 125, -57, 107, -75, 89, -93, 71, -111, 53, -129, 35, -147, 17, -165, -1, 163, -19, 145, -37, 1 -- (+23 chars; full line in the Zenodo source)
[-7, 159, -21, 145, -35, 131, -49, 117, -63, 103, -77, 89, -91, 75, -105, 61, -119, 47, -133, 33, -147, 19, -161, 5, 171, -9, 157, -23, 143, -37, 129, -51, 115, -65, 101, -79, 87, -93, 73, -107, 59, -121, 45, -135, 31, -149, 17, -163, 3, 169, -11, 155, -25, 141, -39, 127, -53, 113, -67, 99, -81, 85, -95, 71, -109, 57, -123, 43, -137, 29, -151, 15, -165, 1, 167, -13, 153, -27, 139, -41, 125, -55, -- (+20 chars; full line in the Zenodo source)
[-5, 163, -15, 153, -25, 143, -35, 133, -45, 123, -55, 113, -65, 103, -75, 93, -85, 83, -95, 73, -105, 63, -115, 53, -125, 43, -135, 33, -145, 23, -155, 13, -165, 3, 171, -7, 161, -17, 151, -27, 141, -37, 131, -47, 121, -57, 111, -67, 101, -77, 91, -87, 81, -97, 71, -107, 61, -117, 51, -127, 41, -137, 31, -147, 21, -157, 11, -167, 1, 169, -9, 159, -19, 149, -29, 139, -39, 129, -49, 119, -59, 109 -- (+20 chars; full line in the Zenodo source)
[-3, 167, -9, 161, -15, 155, -21, 149, -27, 143, -33, 137, -39, 131, -45, 125, -51, 119, -57, 113, -63, 107, -69, 101, -75, 95, -81, 89, -87, 83, -93, 77, -99, 71, -105, 65, -111, 59, -117, 53, -123, 47, -129, 41, -135, 35, -141, 29, -147, 23, -153, 17, -159, 11, -165, 5, -171, -1, 169, -7, 163, -13, 157, -19, 151, -25, 145, -31, 139, -37, 133, -43, 127, -49, 121, -55, 115, -61, 109, -67, 103, - -- (+22 chars; full line in the Zenodo source)
[-1, 171, -3, 169, -5, 167, -7, 165, -9, 163, -11, 161, -13, 159, -15, 157, -17, 155, -19, 153, -21, 151, -23, 149, -25, 147, -27, 145, -29, 143, -31, 141, -33, 139, -35, 137, -37, 135, -39, 133, -41, 131, -43, 129, -45, 127, -47, 125, -49, 123, -51, 121, -53, 119, -55, 117, -57, 115, -59, 113, -61, 111, -63, 109, -65, 107, -67, 105, -69, 103, -71, 101, -73, 99, -75, 97, -77, 95, -79, 93, -81, 9 -- (+21 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[-3084758953717210994484646907, -26649346603672485939931739819, -74872420354495680501338027561, 30561446927492870138985373112, -49972533046461873726229662821, 4611685970830922903239925273, -16761365716864834698405769386, -124842796057932906569312071321, 46257532782015295682846378167, 12014002000933427613738537468, -70028009502609711564163842006, -51612972106153091183099633464, -83346374336455866 -- (+2370 chars; full line in the Zenodo source)
[-26649346603672485939931739819, 30561446927492870138985373112, 4611685970830922903239925273, -124842796057932906569312071321, 12014002000933427613738537468, -51612972106153091183099633464, -76560547100740206456272996007, 9774382458911211238203834928, -107555389217981640439220229176, -101465445785366662124220771924, -11683439514939946945360769857, -52027270926783353066334831768, -163621243240750 -- (+2329 chars; full line in the Zenodo source)
[-74872420354495680501338027561, 4611685970830922903239925273, 46257532782015295682846378167, -51612972106153091183099633464, -71142753819002225278376586238, -107555389217981640439220229176, -144912141569761166035053730088, -52027270926783353066334831768, -140012551652682145665529648789, -19739614538537679791999846001, -128841301804062973532287999808, -54527169125557757805729172417, -49327208991 -- (+2343 chars; full line in the Zenodo source)
[30561446927492870138985373112, -124842796057932906569312071321, -51612972106153091183099633464, 9774382458911211238203834928, -101465445785366662124220771924, -52027270926783353066334831768, -54558506979293437066428422869, -67371092020564666995218197594, -54527169125557757805729172417, -31577352118500793653804448173, -133871701949404191074819779279, -73645865553675270934878435041, -214478478527 -- (+2342 chars; full line in the Zenodo source)
[-49972533046461873726229662821, 12014002000933427613738537468, -71142753819002225278376586238, -101465445785366662124220771924, -98160132709493180702047988673, -19739614538537679791999846001, -183624669880321150579592758298, -31577352118500793653804448173, -131955593571538123424215125909, -138223064349476460375080511021, -181772435323286377449856621193, -32455058117597322288187455232, -16063008 -- (+2347 chars; full line in the Zenodo source)
[4611685970830922903239925273, -51612972106153091183099633464, -107555389217981640439220229176, -52027270926783353066334831768, -19739614538537679791999846001, -54527169125557757805729172417, -14402454612460717511566715526, -73645865553675270934878435041, -61810112618837663550887746113, -32455058117597322288187455232, -31819187486846887492711056186, 66559918064758179582777597461, 784345556658247 -- (+2344 chars; full line in the Zenodo source)
[-16761365716864834698405769386, -76560547100740206456272996007, -144912141569761166035053730088, -54558506979293437066428422869, -183624669880321150579592758298, -14402454612460717511566715526, -169255312045439533638597383273, -84572606542192969070731554308, -126615924602331090065810043464, 58600707501792840694962165009, -105621366309376931106826648348, 58310017508500337870838891768, -743914815 -- (+2339 chars; full line in the Zenodo source)
[-124842796057932906569312071321, 9774382458911211238203834928, -52027270926783353066334831768, -67371092020564666995218197594, -31577352118500793653804448173, -73645865553675270934878435041, -84572606542192969070731554308, -38918167121395760683660832458, 66559918064758179582777597461, -24070626132452634749641941326, 83244786858728986281564543367, 105621366309376931106826648348, 9570193616060633 -- (+2339 chars; full line in the Zenodo source)
[46257532782015295682846378167, -107555389217981640439220229176, -140012551652682145665529648789, -54527169125557757805729172417, -131955593571538123424215125909, -61810112618837663550887746113, -126615924602331090065810043464, 66559918064758179582777597461, -64293156147609138017683973247, 84632533897496310568956269132, 42644657197221903861600222966, 160630085179087261096782225604, 8457260654219 -- (+2342 chars; full line in the Zenodo source)
[12014002000933427613738537468, -101465445785366662124220771924, -19739614538537679791999846001, -31577352118500793653804448173, -138223064349476460375080511021, -32455058117597322288187455232, 58600707501792840694962165009, -24070626132452634749641941326, 84632533897496310568956269132, 170113403887475072487878328453, 126615924602331090065810043464, 172689004972109926154744422381, 22156540777980 -- (+2340 chars; full line in the Zenodo source)
[-70028009502609711564163842006, -11683439514939946945360769857, -128841301804062973532287999808, -133871701949404191074819779279, -181772435323286377449856621193, -31819187486846887492711056186, -105621366309376931106826648348, 83244786858728986281564543367, 42644657197221903861600222966, 126615924602331090065810043464, 21447847852735724765243079072, 225191515908825175191357101968, 197396145385 -- (+2341 chars; full line in the Zenodo source)
[-51612972106153091183099633464, -52027270926783353066334831768, -54527169125557757805729172417, -73645865553675270934878435041, -32455058117597322288187455232, 66559918064758179582777597461, 58310017508500337870838891768, 105621366309376931106826648348, 160630085179087261096782225604, 172689004972109926154744422381, 225191515908825175191357101968, 171421377255734784469199724097, 102403485014168 -- (+2339 chars; full line in the Zenodo source)
[-83346374336455866944805588603, -163621243240750969260195329586, -49327208991490144398989638259, -21447847852735724765243079072, -160630085179087261096782225604, 7843455566582471828338777287, -74391481562257735569127216164, 95701936160606331543824967026, 84572606542192969070731554308, 221565407779802817632096984527, 19739614538537679791999846001, 102403485014168547337126929294, -305614469274928 -- (+2342 chars; full line in the Zenodo source)
[-76560547100740206456272996007, -54558506979293437066428422869, -14402454612460717511566715526, -84572606542192969070731554308, 58600707501792840694962165009, 58310017508500337870838891768, 44708428168670035290817245104, 171476167394917317091974832994, 166902873805191629814079121782, 128841301804062973532287999808, 52966649204190999416313715659, 49972533046461873726229662821, 462575327820152956 -- (+2340 chars; full line in the Zenodo source)
[-71142753819002225278376586238, -19739614538537679791999846001, -131955593571538123424215125909, -32455058117597322288187455232, -44708428168670035290817245104, 84632533897496310568956269132, 109018633146576658911345123571, 172689004972109926154744422381, 211869021856185274124417758133, 127525183380821433179541151397, 124842796057932906569312071321, -16761365716864834698405769386, -116834395149 -- (+2344 chars; full line in the Zenodo source)
[9774382458911211238203834928, -67371092020564666995218197594, -73645865553675270934878435041, -38918167121395760683660832458, -24070626132452634749641941326, 105621366309376931106826648348, 171476167394917317091974832994, 131955593571538123424215125909, 171421377255734784469199724097, 83346374336455866944805588603, -74872420354495680501338027561, -52966649204190999416313715659, -183624669880321 -- (+2340 chars; full line in the Zenodo source)
[-102403485014168547337126929294, -23623440670475051008826909488, -188384060237234364941209476392, -109018633146576658911345123571, -83244786858728986281564543367, 209531672764257156233325368361, 61810112618837663550887746113, 141803963085474528424406087198, 101465445785366662124220771924, 74872420354495680501338027561, -76560547100740206456272996007, -157660677006162332397286692778, -7364586555 -- (+2341 chars; full line in the Zenodo source)
[-107555389217981640439220229176, -54527169125557757805729172417, -61810112618837663550887746113, 66559918064758179582777597461, 84632533897496310568956269132, 160630085179087261096782225604, 166902873805191629814079121782, 171421377255734784469199724097, 70028009502609711564163842006, -16761365716864834698405769386, -98160132709493180702047988673, -221565407779802817632096984527, -1714761673949 -- (+2341 chars; full line in the Zenodo source)
[-52966649204190999416313715659, -211869021856185274124417758133, -125766305162928252625070021412, 39696444638719564485314533509, -7843455566582471828338777287, 234641972931453428374274737911, 31577352118500793653804448173, 144912141569761166035053730088, 26649346603672485939931739819, -102403485014168547337126929294, -54527169125557757805729172417, -181772435323286377449856621193, -426446571972 -- (+2345 chars; full line in the Zenodo source)
[-101465445785366662124220771924, -31577352118500793653804448173, -32455058117597322288187455232, -24070626132452634749641941326, 170113403887475072487878328453, 172689004972109926154744422381, 128841301804062973532287999808, 83346374336455866944805588603, -16761365716864834698405769386, -140012551652682145665529648789, -166902873805191629814079121782, -89130592980736754391859149173, -1700534259 -- (+2345 chars; full line in the Zenodo source)
[-144912141569761166035053730088, -14402454612460717511566715526, -126615924602331090065810043464, 58310017508500337870838891768, 109018633146576658911345123571, 166902873805191629814079121782, 163621243240750969260195329586, 49972533046461873726229662821, 9774382458911211238203834928, -141803963085474528424406087198, 9019771837338424080359558816, -62204239371410034965201702081, 1701134038874750 -- (+2342 chars; full line in the Zenodo source)
[-11683439514939946945360769857, -133871701949404191074819779279, -31819187486846887492711056186, 83244786858728986281564543367, 126615924602331090065810043464, 225191515908825175191357101968, 52966649204190999416313715659, -74872420354495680501338027561, -98160132709493180702047988673, -166902873805191629814079121782, -95701936160606331543824967026, -74391481562257735569127216164, 3245505811759 -- (+2342 chars; full line in the Zenodo source)
[-127525183380821433179541151397, -52249482670105359697366757089, -95701936160606331543824967026, 64293156147609138017683973247, -9019771837338424080359558816, 183624669880321150579592758298, 51612972106153091183099633464, -70028009502609711564163842006, -23623440670475051008826909488, -125766305162928252625070021412, -24070626132452634749641941326, -58600707501792840694962165009, 16690287380519 -- (+2342 chars; full line in the Zenodo source)
[-52027270926783353066334831768, -73645865553675270934878435041, 66559918064758179582777597461, 105621366309376931106826648348, 172689004972109926154744422381, 171421377255734784469199724097, 49972533046461873726229662821, -52966649204190999416313715659, -221565407779802817632096984527, -89130592980736754391859149173, -74391481562257735569127216164, -9019771837338424080359558816, 236234406704750 -- (+2340 chars; full line in the Zenodo source)
[-98160132709493180702047988673, -138223064349476460375080511021, -44708428168670035290817245104, 170113403887475072487878328453, 73645865553675270934878435041, 127525183380821433179541151397, -26649346603672485939931739819, -140012551652682145665529648789, -21447847852735724765243079072, -105621366309376931106826648348, 209531672764257156233325368361, 52249482670105359697366757089, 144912141569 -- (+2340 chars; full line in the Zenodo source)
[-163621243240750969260195329586, -21447847852735724765243079072, 7843455566582471828338777287, 95701936160606331543824967026, 221565407779802817632096984527, 102403485014168547337126929294, 46257532782015295682846378167, -183624669880321150579592758298, -171476167394917317091974832994, -17005342596549585337317691421, 32455058117597322288187455232, 23623440670475051008826909488, 1248427960579329 -- (+2339 chars; full line in the Zenodo source)
[-140012551652682145665529648789, -61810112618837663550887746113, -64293156147609138017683973247, 160630085179087261096782225604, 211869021856185274124417758133, 70028009502609711564163842006, 9774382458911211238203834928, -221565407779802817632096984527, 58600707501792840694962165009, -39696444638719564485314533509, 169255312045439533638597383273, 11683439514939946945360769857, -499725330464618 -- (+2339 chars; full line in the Zenodo source)
[-54558506979293437066428422869, -84572606542192969070731554308, 58310017508500337870838891768, 171476167394917317091974832994, 128841301804062973532287999808, 49972533046461873726229662821, -127525183380821433179541151397, -188384060237234364941209476392, -62204239371410034965201702081, 31819187486846887492711056186, 211869021856185274124417758133, -12014002000933427613738537468, -1075553892179 -- (+2343 chars; full line in the Zenodo source)
[-171421377255734784469199724097, 9019771837338424080359558816, -17005342596549585337317691421, 125766305162928252625070021412, 54558506979293437066428422869, -3084758953717210994484646907, -19739614538537679791999846001, -234641972931453428374274737911, 83244786858728986281564543367, 84572606542192969070731554308, 140012551652682145665529648789, -26649346603672485939931739819, -1576606770061623 -- (+2340 chars; full line in the Zenodo source)
[-19739614538537679791999846001, -32455058117597322288187455232, 84632533897496310568956269132, 172689004972109926154744422381, 127525183380821433179541151397, -16761365716864834698405769386, -141803963085474528424406087198, -89130592980736754391859149173, -39696444638719564485314533509, 52249482670105359697366757089, -9774382458911211238203834928, -76560547100740206456272996007, -13387170194940 -- (+2341 chars; full line in the Zenodo source)
[-157660677006162332397286692778, -52500810074407971461889799696, 24070626132452634749641941326, 169255312045439533638597383273, 107555389217981640439220229176, -83346374336455866944805588603, -133871701949404191074819779279, -44708428168670035290817245104, 89130592980736754391859149173, 54527169125557757805729172417, 49972533046461873726229662821, -163621243240750969260195329586, -1257663051629 -- (+2338 chars; full line in the Zenodo source)
[-67371092020564666995218197594, -38918167121395760683660832458, 105621366309376931106826648348, 131955593571538123424215125909, 83346374336455866944805588603, -52966649204190999416313715659, -188384060237234364941209476392, -84632533897496310568956269132, -9019771837338424080359558816, 163621243240750969260195329586, 4611685970830922903239925273, -211869021856185274124417758133, 586007075017928 -- (+2339 chars; full line in the Zenodo source)
[-128841301804062973532287999808, -31819187486846887492711056186, 42644657197221903861600222966, 225191515908825175191357101968, 124842796057932906569312071321, -98160132709493180702047988673, 9019771837338424080359558816, -74391481562257735569127216164, 169255312045439533638597383273, -9774382458911211238203834928, -102403485014168547337126929294, -138223064349476460375080511021, -8463253389749 -- (+2338 chars; full line in the Zenodo source)
[-23623440670475051008826909488, -109018633146576658911345123571, 209531672764257156233325368361, 141803963085474528424406087198, 74872420354495680501338027561, -157660677006162332397286692778, -160630085179087261096782225604, 42644657197221903861600222966, 31577352118500793653804448173, -4611685970830922903239925273, -54558506979293437066428422869, -52500810074407971461889799696, 10562136630937 -- (+2338 chars; full line in the Zenodo source)
[-183624669880321150579592758298, 58600707501792840694962165009, 109018633146576658911345123571, 128841301804062973532287999808, -26649346603672485939931739819, -141803963085474528424406087198, 66559918064758179582777597461, 31819187486846887492711056186, 157660677006162332397286692778, 30561446927492870138985373112, -49327208991490144398989638259, -42644657197221903861600222966, 389181671213957 -- (+2332 chars; full line in the Zenodo source)
[-54527169125557757805729172417, 66559918064758179582777597461, 160630085179087261096782225604, 171421377255734784469199724097, -16761365716864834698405769386, -221565407779802817632096984527, -62204239371410034965201702081, -9019771837338424080359558816, 11683439514939946945360769857, -76560547100740206456272996007, -138223064349476460375080511021, 17005342596549585337317691421, 188384060237234 -- (+2338 chars; full line in the Zenodo source)
[-141803963085474528424406087198, -42644657197221903861600222966, 52500810074407971461889799696, 98160132709493180702047988673, -51612972106153091183099633464, -169255312045439533638597383273, 17005342596549585337317691421, 138223064349476460375080511021, 83346374336455866944805588603, -52027270926783353066334831768, -171476167394917317091974832994, 44708428168670035290817245104, 211869021856185 -- (+2338 chars; full line in the Zenodo source)
[-211869021856185274124417758133, 39696444638719564485314533509, 234641972931453428374274737911, 144912141569761166035053730088, -102403485014168547337126929294, -181772435323286377449856621193, 24070626132452634749641941326, 14402454612460717511566715526, -30561446927492870138985373112, -23623440670475051008826909488, 66559918064758179582777597461, 126615924602331090065810043464, 98160132709493 -- (+2338 chars; full line in the Zenodo source)
[-49327208991490144398989638259, 7843455566582471828338777287, 84572606542192969070731554308, 102403485014168547337126929294, -11683439514939946945360769857, -171476167394917317091974832994, 170113403887475072487878328453, 23623440670475051008826909488, -49972533046461873726229662821, -133871701949404191074819779279, -84632533897496310568956269132, 188384060237234364941209476392, 516129721061530 -- (+2343 chars; full line in the Zenodo source)
[-31577352118500793653804448173, -24070626132452634749641941326, 172689004972109926154744422381, 83346374336455866944805588603, -140012551652682145665529648789, -89130592980736754391859149173, 31819187486846887492711056186, 163621243240750969260195329586, -76560547100740206456272996007, -61810112618837663550887746113, 62204239371410034965201702081, 49327208991490144398989638259, -308475895371721 -- (+2338 chars; full line in the Zenodo source)
[-225191515908825175191357101968, 74391481562257735569127216164, 138223064349476460375080511021, -46257532782015295682846378167, -67371092020564666995218197594, -170113403887475072487878328453, 234641972931453428374274737911, 107555389217981640439220229176, -127525183380821433179541151397, -38918167121395760683660832458, 109018633146576658911345123571, 140012551652682145665529648789, -7656054710 -- (+2342 chars; full line in the Zenodo source)
[-14402454612460717511566715526, 58310017508500337870838891768, 166902873805191629814079121782, 49972533046461873726229662821, -141803963085474528424406087198, -62204239371410034965201702081, 21447847852735724765243079072, -12014002000933427613738537468, -67371092020564666995218197594, -42644657197221903861600222966, 125766305162928252625070021412, 71142753819002225278376586238, -140012551652682 -- (+2341 chars; full line in the Zenodo source)
[-221565407779802817632096984527, 17005342596549585337317691421, 133871701949404191074819779279, 3084758953717210994484646907, -14402454612460717511566715526, -83244786858728986281564543367, 131955593571538123424215125909, 26649346603672485939931739819, -225191515908825175191357101968, 58310017508500337870838891768, 52249482670105359697366757089, 74872420354495680501338027561, -31577352118500793 -- (+2340 chars; full line in the Zenodo source)
[-133871701949404191074819779279, 83244786858728986281564543367, 225191515908825175191357101968, -74872420354495680501338027561, -166902873805191629814079121782, -74391481562257735569127216164, 211869021856185274124417758133, 4611685970830922903239925273, -138223064349476460375080511021, 62204239371410034965201702081, 183624669880321150579592758298, 46257532782015295682846378167, -17268900497210 -- (+2341 chars; full line in the Zenodo source)
[-131955593571538123424215125909, 84632533897496310568956269132, 211869021856185274124417758133, -16761365716864834698405769386, -21447847852735724765243079072, -39696444638719564485314533509, 157660677006162332397286692778, -76560547100740206456272996007, -234641972931453428374274737911, 95701936160606331543824967026, 52027270926783353066334831768, -144912141569761166035053730088, -318191874868 -- (+2347 chars; full line in the Zenodo source)
[-52249482670105359697366757089, 64293156147609138017683973247, 183624669880321150579592758298, -70028009502609711564163842006, -125766305162928252625070021412, -58600707501792840694962165009, 52027270926783353066334831768, -11683439514939946945360769857, -109018633146576658911345123571, 234641972931453428374274737911, 83346374336455866944805588603, -128841301804062973532287999808, -622042393714 -- (+2341 chars; full line in the Zenodo source)
[-166902873805191629814079121782, 62204239371410034965201702081, 67371092020564666995218197594, -71142753819002225278376586238, -52500810074407971461889799696, 38918167121395760683660832458, 102403485014168547337126929294, -19739614538537679791999846001, -105621366309376931106826648348, 169255312045439533638597383273, 26649346603672485939931739819, -131955593571538123424215125909, 64293156147609 -- (+2342 chars; full line in the Zenodo source)
[-73645865553675270934878435041, 105621366309376931106826648348, 171421377255734784469199724097, -52966649204190999416313715659, -89130592980736754391859149173, -9019771837338424080359558816, -12014002000933427613738537468, -211869021856185274124417758133, 17005342596549585337317691421, 49327208991490144398989638259, 46257532782015295682846378167, -125766305162928252625070021412, 109018633146576 -- (+2339 chars; full line in the Zenodo source)
[-169255312045439533638597383273, 44708428168670035290817245104, 163621243240750969260195329586, -127525183380821433179541151397, 66559918064758179582777597461, 21447847852735724765243079072, 74872420354495680501338027561, -52249482670105359697366757089, -7843455566582471828338777287, 171421377255734784469199724097, -101465445785366662124220771924, -95701936160606331543824967026, 181772435323286 -- (+2346 chars; full line in the Zenodo source)
[-138223064349476460375080511021, 170113403887475072487878328453, 127525183380821433179541151397, -140012551652682145665529648789, -105621366309376931106826648348, 52249482670105359697366757089, 30561446927492870138985373112, -61810112618837663550887746113, 95701936160606331543824967026, 52966649204190999416313715659, -157660677006162332397286692778, -64293156147609138017683973247, 1440245461246 -- (+2337 chars; full line in the Zenodo source)
[-188384060237234364941209476392, 209531672764257156233325368361, 101465445785366662124220771924, -157660677006162332397286692778, 74391481562257735569127216164, 31577352118500793653804448173, -70028009502609711564163842006, -52500810074407971461889799696, 32455058117597322288187455232, -46257532782015295682846378167, -14402454612460717511566715526, 24070626132452634749641941326, 171421377255734 -- (+2340 chars; full line in the Zenodo source)
[-21447847852735724765243079072, 95701936160606331543824967026, 102403485014168547337126929294, -183624669880321150579592758298, -17005342596549585337317691421, 23623440670475051008826909488, -107555389217981640439220229176, 58600707501792840694962165009, 188384060237234364941209476392, -3084758953717210994484646907, -172689004972109926154744422381, 109018633146576658911345123571, -9774382458911 -- (+2340 chars; full line in the Zenodo source)
[-172689004972109926154744422381, 89130592980736754391859149173, 76560547100740206456272996007, -49327208991490144398989638259, 64293156147609138017683973247, 54558506979293437066428422869, -98160132709493180702047988673, 7843455566582471828338777287, 14402454612460717511566715526, -70028009502609711564163842006, -38918167121395760683660832458, 84572606542192969070731554308, 74872420354495680501 -- (+2341 chars; full line in the Zenodo source)
[-61810112618837663550887746113, 160630085179087261096782225604, 70028009502609711564163842006, -221565407779802817632096984527, -39696444638719564485314533509, 11683439514939946945360769857, -67371092020564666995218197594, 17005342596549585337317691421, 128841301804062973532287999808, -144912141569761166035053730088, -44708428168670035290817245104, 133871701949404191074819779279, 12014002000933 -- (+2338 chars; full line in the Zenodo source)
[-181772435323286377449856621193, 126615924602331090065810043464, 124842796057932906569312071321, -166902873805191629814079121782, 209531672764257156233325368361, -9774382458911211238203834928, -49327208991490144398989638259, 62204239371410034965201702081, 52027270926783353066334831768, -157660677006162332397286692778, 17005342596549585337317691421, 67371092020564666995218197594, -12752518338082 -- (+2340 chars; full line in the Zenodo source)
[-84572606542192969070731554308, 171476167394917317091974832994, 49972533046461873726229662821, -188384060237234364941209476392, 31819187486846887492711056186, -12014002000933427613738537468, -52249482670105359697366757089, 209531672764257156233325368361, 71142753819002225278376586238, -225191515908825175191357101968, -39696444638719564485314533509, 101465445785366662124220771924, -5452716912555 -- (+2338 chars; full line in the Zenodo source)
[-125766305162928252625070021412, 234641972931453428374274737911, 26649346603672485939931739819, -181772435323286377449856621193, 171476167394917317091974832994, -30561446927492870138985373112, -172689004972109926154744422381, 126615924602331090065810043464, -4611685970830922903239925273, -188384060237234364941209476392, 160630085179087261096782225604, 124842796057932906569312071321, -1692553120 -- (+2336 chars; full line in the Zenodo source)
[9019771837338424080359558816, 125766305162928252625070021412, -3084758953717210994484646907, -234641972931453428374274737911, 84572606542192969070731554308, -26649346603672485939931739819, -32455058117597322288187455232, 181772435323286377449856621193, -74872420354495680501338027561, -171476167394917317091974832994, 61810112618837663550887746113, 30561446927492870138985373112, -5250081007440797 -- (+2341 chars; full line in the Zenodo source)
[-234641972931453428374274737911, 181772435323286377449856621193, 30561446927492870138985373112, -126615924602331090065810043464, 188384060237234364941209476392, -124842796057932906569312071321, -89130592980736754391859149173, 166902873805191629814079121782, -51612972106153091183099633464, -209531672764257156233325368361, 221565407779802817632096984527, 9774382458911211238203834928, -44708428168 -- (+2341 chars; full line in the Zenodo source)
[-32455058117597322288187455232, 172689004972109926154744422381, -16761365716864834698405769386, -89130592980736754391859149173, 52249482670105359697366757089, -76560547100740206456272996007, -42644657197221903861600222966, 49327208991490144398989638259, -144912141569761166035053730088, -64293156147609138017683973247, 67371092020564666995218197594, -54558506979293437066428422869, 832447868587289 -- (+2340 chars; full line in the Zenodo source)
[-171476167394917317091974832994, 188384060237234364941209476392, 12014002000933427613738537468, -209531672764257156233325368361, 225191515908825175191357101968, -101465445785366662124220771924, -64293156147609138017683973247, 157660677006162332397286692778, -19739614538537679791999846001, -74391481562257735569127216164, 144912141569761166035053730088, -31577352118500793653804448173, -6655991806 -- (+2337 chars; full line in the Zenodo source)
[-52500810074407971461889799696, 169255312045439533638597383273, -83346374336455866944805588603, -44708428168670035290817245104, 54527169125557757805729172417, -163621243240750969260195329586, 83244786858728986281564543367, 127525183380821433179541151397, -49327208991490144398989638259, -66559918064758179582777597461, -12014002000933427613738537468, -21447847852735724765243079072, 23464197293145 -- (+2341 chars; full line in the Zenodo source)
[-126615924602331090065810043464, 166902873805191629814079121782, 9774382458911211238203834928, -62204239371410034965201702081, 157660677006162332397286692778, -67371092020564666995218197594, -7843455566582471828338777287, 71142753819002225278376586238, -73645865553675270934878435041, 52500810074407971461889799696, -3084758953717210994484646907, -38918167121395760683660832458, 522494826701053596 -- (+2343 chars; full line in the Zenodo source)
[-38918167121395760683660832458, 131955593571538123424215125909, -52966649204190999416313715659, -84632533897496310568956269132, 163621243240750969260195329586, -211869021856185274124417758133, 209531672764257156233325368361, 16761365716864834698405769386, -125766305162928252625070021412, 21447847852735724765243079072, -51612972106153091183099633464, 39696444638719564485314533509, 12884130180406 -- (+2342 chars; full line in the Zenodo source)
[-160630085179087261096782225604, 221565407779802817632096984527, -11683439514939946945360769857, -17005342596549585337317691421, 144912141569761166035053730088, -133871701949404191074819779279, 38918167121395760683660832458, -3084758953717210994484646907, -31819187486846887492711056186, 14402454612460717511566715526, -127525183380821433179541151397, 83244786858728986281564543367, 10146544578536 -- (+2341 chars; full line in the Zenodo source)
[-31819187486846887492711056186, 225191515908825175191357101968, -98160132709493180702047988673, -74391481562257735569127216164, -9774382458911211238203834928, -138223064349476460375080511021, 125766305162928252625070021412, 46257532782015295682846378167, -44708428168670035290817245104, 67371092020564666995218197594, -23623440670475051008826909488, 170113403887475072487878328453, 167613657168648 -- (+2339 chars; full line in the Zenodo source)
[-89130592980736754391859149173, 49327208991490144398989638259, -54558506979293437066428422869, -7843455566582471828338777287, 70028009502609711564163842006, -84572606542192969070731554308, 138223064349476460375080511021, -102403485014168547337126929294, 58310017508500337870838891768, 11683439514939946945360769857, -131955593571538123424215125909, 171476167394917317091974832994, 4611685970830922 -- (+2346 chars; full line in the Zenodo source)
[-109018633146576658911345123571, 141803963085474528424406087198, -157660677006162332397286692778, 42644657197221903861600222966, -4611685970830922903239925273, -52500810074407971461889799696, 221565407779802817632096984527, -98160132709493180702047988673, 24070626132452634749641941326, 51612972106153091183099633464, -84572606542192969070731554308, 169255312045439533638597383273, -52966649204190 -- (+2343 chars; full line in the Zenodo source)
[-95701936160606331543824967026, 183624669880321150579592758298, -23623440670475051008826909488, -58600707501792840694962165009, 3084758953717210994484646907, -109018633146576658911345123571, 54527169125557757805729172417, -128841301804062973532287999808, 209531672764257156233325368361, 26649346603672485939931739819, -89130592980736754391859149173, 141803963085474528424406087198, -67371092020564 -- (+2343 chars; full line in the Zenodo source)
[58600707501792840694962165009, 128841301804062973532287999808, -141803963085474528424406087198, 31819187486846887492711056186, 30561446927492870138985373112, -42644657197221903861600222966, 171421377255734784469199724097, -225191515908825175191357101968, 52500810074407971461889799696, -124842796057932906569312071321, 7843455566582471828338777287, 98160132709493180702047988673, -1319555935715381 -- (+2341 chars; full line in the Zenodo source)
[-209531672764257156233325368361, 157660677006162332397286692778, -31577352118500793653804448173, 52500810074407971461889799696, 46257532782015295682846378167, -24070626132452634749641941326, 11683439514939946945360769857, -169255312045439533638597383273, 172689004972109926154744422381, -107555389217981640439220229176, -58310017508500337870838891768, 83346374336455866944805588603, 90197718373384 -- (+2339 chars; full line in the Zenodo source)
[66559918064758179582777597461, 171421377255734784469199724097, -221565407779802817632096984527, -9019771837338424080359558816, -76560547100740206456272996007, 17005342596549585337317691421, 71142753819002225278376586238, -125766305162928252625070021412, 133871701949404191074819779279, -54558506979293437066428422869, 170113403887475072487878328453, 3084758953717210994484646907, -2095316727642571 -- (+2339 chars; full line in the Zenodo source)
[-170113403887475072487878328453, 140012551652682145665529648789, -52249482670105359697366757089, 61810112618837663550887746113, -52966649204190999416313715659, 64293156147609138017683973247, 124842796057932906569312071321, -160630085179087261096782225604, 183624669880321150579592758298, -211869021856185274124417758133, 52500810074407971461889799696, -70028009502609711564163842006, 5831001750850 -- (+2340 chars; full line in the Zenodo source)
[-42644657197221903861600222966, 98160132709493180702047988673, -169255312045439533638597383273, 138223064349476460375080511021, -52027270926783353066334831768, 44708428168670035290817245104, 3084758953717210994484646907, -170113403887475072487878328453, 163621243240750969260195329586, -73645865553675270934878435041, 188384060237234364941209476392, -127525183380821433179541151397, -3969644463871 -- (+2341 chars; full line in the Zenodo source)
[-44708428168670035290817245104, 127525183380821433179541151397, -21447847852735724765243079072, 52249482670105359697366757089, -171421377255734784469199724097, 95701936160606331543824967026, 4611685970830922903239925273, -64293156147609138017683973247, 102403485014168547337126929294, 9019771837338424080359558816, 31577352118500793653804448173, -183624669880321150579592758298, 126615924602331090 -- (+2341 chars; full line in the Zenodo source)
[39696444638719564485314533509, 144912141569761166035053730088, -181772435323286377449856621193, 14402454612460717511566715526, -23623440670475051008826909488, 126615924602331090065810043464, -83346374336455866944805588603, -58310017508500337870838891768, 124842796057932906569312071321, -109018633146576658911345123571, 171421377255734784469199724097, -166902873805191629814079121782, 138223064349 -- (+2341 chars; full line in the Zenodo source)
[-105621366309376931106826648348, 52966649204190999416313715659, 9019771837338424080359558816, 211869021856185274124417758133, -49327208991490144398989638259, 125766305162928252625070021412, -101465445785366662124220771924, -39696444638719564485314533509, -3084758953717210994484646907, 7843455566582471828338777287, 107555389217981640439220229176, -234641972931453428374274737911, 1418039630854745 -- (+2342 chars; full line in the Zenodo source)
[7843455566582471828338777287, 102403485014168547337126929294, -171476167394917317091974832994, 23623440670475051008826909488, -133871701949404191074819779279, 188384060237234364941209476392, -140012551652682145665529648789, 109018633146576658911345123571, 12014002000933427613738537468, 83244786858728986281564543367, 16761365716864834698405769386, -209531672764257156233325368361, 520272709267833 -- (+2338 chars; full line in the Zenodo source)
[-62204239371410034965201702081, 71142753819002225278376586238, -38918167121395760683660832458, 19739614538537679791999846001, -169255312045439533638597383273, 131955593571538123424215125909, -23623440670475051008826909488, 32455058117597322288187455232, -52966649204190999416313715659, 44708428168670035290817245104, 30561446927492870138985373112, -84632533897496310568956269132, 70028009502609711 -- (+2339 chars; full line in the Zenodo source)
[-24070626132452634749641941326, 83346374336455866944805588603, -89130592980736754391859149173, 163621243240750969260195329586, -61810112618837663550887746113, 49327208991490144398989638259, -225191515908825175191357101968, 21447847852735724765243079072, -54558506979293437066428422869, 160630085179087261096782225604, -71142753819002225278376586238, -7843455566582471828338777287, -266493466036724 -- (+2339 chars; full line in the Zenodo source)
[-64293156147609138017683973247, 70028009502609711564163842006, 58600707501792840694962165009, 11683439514939946945360769857, -234641972931453428374274737911, 128841301804062973532287999808, -73645865553675270934878435041, 133871701949404191074819779279, -141803963085474528424406087198, 181772435323286377449856621193, -163621243240750969260195329586, 31819187486846887492711056186, -7114275381900 -- (+2340 chars; full line in the Zenodo source)
[74391481562257735569127216164, -46257532782015295682846378167, -170113403887475072487878328453, 107555389217981640439220229176, -38918167121395760683660832458, 140012551652682145665529648789, -181772435323286377449856621193, 54527169125557757805729172417, -52249482670105359697366757089, 131955593571538123424215125909, -141803963085474528424406087198, 61810112618837663550887746113, -545585069792 -- (+2341 chars; full line in the Zenodo source)
[-84632533897496310568956269132, 16761365716864834698405769386, 39696444638719564485314533509, 76560547100740206456272996007, -95701936160606331543824967026, 144912141569761166035053730088, -52500810074407971461889799696, 54558506979293437066428422869, -181772435323286377449856621193, 183624669880321150579592758298, -73645865553675270934878435041, 14402454612460717511566715526, -2251915159088251 -- (+2344 chars; full line in the Zenodo source)
[58310017508500337870838891768, 49972533046461873726229662821, -62204239371410034965201702081, -12014002000933427613738537468, -42644657197221903861600222966, 71142753819002225278376586238, -95701936160606331543824967026, 101465445785366662124220771924, -38918167121395760683660832458, 98160132709493180702047988673, -234641972931453428374274737911, 19739614538537679791999846001, -6181011261883766 -- (+2338 chars; full line in the Zenodo source)
[-83244786858728986281564543367, 74872420354495680501338027561, 74391481562257735569127216164, -4611685970830922903239925273, -62204239371410034965201702081, -46257532782015295682846378167, 39696444638719564485314533509, 51612972106153091183099633464, -170113403887475072487878328453, 71142753819002225278376586238, 58600707501792840694962165009, 107555389217981640439220229176, -891305929807367543 -- (+2338 chars; full line in the Zenodo source)
[17005342596549585337317691421, 3084758953717210994484646907, -83244786858728986281564543367, 26649346603672485939931739819, 58310017508500337870838891768, 74872420354495680501338027561, -84632533897496310568956269132, -30561446927492870138985373112, 74391481562257735569127216164, 49972533046461873726229662821, -64293156147609138017683973247, -4611685970830922903239925273, -240706261324526347496 -- (+2337 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 86).map (fun t => rowA (172 + 1) t (rng 1 86)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 86 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 86 B A = sid 589081008262337923240805891855690 86 := rfl
theorem d_ne : (589081008262337923240805891855690 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 86 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 86) (h0 : mv A g = zeros 86) : g = zeros 86 :=
kernel_zero 86 589081008262337923240805891855690 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 172 86 = true := rfl
/-- **Balanced ⇒ pairs for p = 173.** A list with entries in (0, 173) that is balanced for 1 ≤ t ≤ 86
has as many copies of x as of 173 − x for every 1 ≤ x ≤ 86 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 173)
(hb : ∀ t, 1 ≤ t → t < 1 + 86 → tsum 173 t c + tsum 173 t c = c.length * 173) :
(rng 1 86).all (fun x => Nat.beq (cnt x c) (cnt (173 - x) c)) = true :=
pairs_of_bal 172 86 589081008262337923240805891855690 d_ne A B len cert A_def delta c hr hb
end MailletCert173
#print axioms MailletCert173.A_def
#print axioms MailletCert173.len
#print axioms MailletCert173.cert
#print axioms MailletCert173.d_ne
#print axioms MailletCert173.kernel
#print axioms MailletCert173.delta
#print axioms MailletCert173.pairs
lean_all/hodge/MailletCert179.lean
/-
hodge/MailletCert179.lean — T41 (goals G849b, G849c): for p = 179 the 89 × 89 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 89)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 27666804641906846896206996950384710 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 179) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert179
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-177, -175, -173, -171, -169, -167, -165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -37, -35 -- (+82 chars; full line in the Zenodo source)
[-175, -171, -167, -163, -159, -155, -151, -147, -143, -139, -135, -131, -127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149 -- (+37 chars; full line in the Zenodo source)
[-173, -167, -161, -155, -149, -143, -137, -131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 169, 175, -177, -171, -165, -159, -153, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -69, - -- (+52 chars; full line in the Zenodo source)
[-171, -163, -155, -147, -139, -131, -123, -115, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, 69, 77, 85, 93, 101, 109, 117, 125, 133, 141, 149, 157, 165, 173, -177, -169, -161, -153, -145, -137, -129, -121, -113, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 11 -- (+38 chars; full line in the Zenodo source)
[-169, -159, -149, -139, -129, -119, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, 141, 151, 161, 171, -177, -167, -157, -147, -137, -127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, 153, 163, 173, -175, -165, -155, -145, -135, -125, -115, -105, -95 -- (+46 chars; full line in the Zenodo source)
[-167, -155, -143, -131, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145, 157, 169, -177, -165, -153, -141, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, 135, 147, 159, 171, -175, -163, -151, -139, -127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5, 17, 29, 41, 53, 65, 77, 89 -- (+37 chars; full line in the Zenodo source)
[-165, -151, -137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, 143, 157, 171, -173, -159, -145, -131, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, 135, 149, 163, 177, -167, -153, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, 169, -175, -161, -147, -133, -11 -- (+43 chars; full line in the Zenodo source)
[-163, -147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, 141, 157, 173, -169, -153, -137, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, -175, -159, -143, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, -165, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, -- (+37 chars; full line in the Zenodo source)
[-161, -143, -125, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, 127, 145, 163, -177, -159, -141, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, 147, 165, -175, -157, -139, -121, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, 113, 131, 149, 167, -173, -155, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, 151, 169, -171, -153, -- (+42 chars; full line in the Zenodo source)
[-159, -139, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, 141, 161, -177, -157, -137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, 143, 163, -175, -155, -135, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, 145, 165, -173, -153, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, 147, 167, -171, -151, -131, -111, -91, -71, -51, -31, -11, 9, -- (+37 chars; full line in the Zenodo source)
[-157, -135, -113, -91, -69, -47, -25, -3, 19, 41, 63, 85, 107, 129, 151, 173, -163, -141, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, 145, 167, -169, -147, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, 139, 161, -175, -153, -131, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, 133, 155, 177, -159, -137, -115, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, 127, 149, 171, -1 -- (+41 chars; full line in the Zenodo source)
[-155, -131, -107, -83, -59, -35, -11, 13, 37, 61, 85, 109, 133, 157, -177, -153, -129, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, 135, 159, -175, -151, -127, -103, -79, -55, -31, -7, 17, 41, 65, 89, 113, 137, 161, -173, -149, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, 139, 163, -171, -147, -123, -99, -75, -51, -27, -3, 21, 45, 69, 93, 117, 141, 165, -169, -145, -121, -97, -73, -49, -- (+40 chars; full line in the Zenodo source)
[-153, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, 159, -173, -147, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, 139, 165, -167, -141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, 171, -161, -135, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, 151, 177, -155, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, 157, -175, -149, -123, -97, -71, -45, -19, 7, 33, 59, 85, 111, 137, 163 -- (+40 chars; full line in the Zenodo source)
[-151, -123, -95, -67, -39, -11, 17, 45, 73, 101, 129, 157, -173, -145, -117, -89, -61, -33, -5, 23, 51, 79, 107, 135, 163, -167, -139, -111, -83, -55, -27, 1, 29, 57, 85, 113, 141, 169, -161, -133, -105, -77, -49, -21, 7, 35, 63, 91, 119, 147, 175, -155, -127, -99, -71, -43, -15, 13, 41, 69, 97, 125, 153, -177, -149, -121, -93, -65, -37, -9, 19, 47, 75, 103, 131, 159, -171, -143, -115, -87, -59 -- (+38 chars; full line in the Zenodo source)
[-149, -119, -89, -59, -29, 1, 31, 61, 91, 121, 151, -177, -147, -117, -87, -57, -27, 3, 33, 63, 93, 123, 153, -175, -145, -115, -85, -55, -25, 5, 35, 65, 95, 125, 155, -173, -143, -113, -83, -53, -23, 7, 37, 67, 97, 127, 157, -171, -141, -111, -81, -51, -21, 9, 39, 69, 99, 129, 159, -169, -139, -109, -79, -49, -19, 11, 41, 71, 101, 131, 161, -167, -137, -107, -77, -47, -17, 13, 43, 73, 103, 133 -- (+40 chars; full line in the Zenodo source)
[-147, -115, -83, -51, -19, 13, 45, 77, 109, 141, 173, -153, -121, -89, -57, -25, 7, 39, 71, 103, 135, 167, -159, -127, -95, -63, -31, 1, 33, 65, 97, 129, 161, -165, -133, -101, -69, -37, -5, 27, 59, 91, 123, 155, -171, -139, -107, -75, -43, -11, 21, 53, 85, 117, 149, -177, -145, -113, -81, -49, -17, 15, 47, 79, 111, 143, 175, -151, -119, -87, -55, -23, 9, 41, 73, 105, 137, 169, -157, -125, -93, -- (+36 chars; full line in the Zenodo source)
[-145, -111, -77, -43, -9, 25, 59, 93, 127, 161, -163, -129, -95, -61, -27, 7, 41, 75, 109, 143, 177, -147, -113, -79, -45, -11, 23, 57, 91, 125, 159, -165, -131, -97, -63, -29, 5, 39, 73, 107, 141, 175, -149, -115, -81, -47, -13, 21, 55, 89, 123, 157, -167, -133, -99, -65, -31, 3, 37, 71, 105, 139, 173, -151, -117, -83, -49, -15, 19, 53, 87, 121, 155, -169, -135, -101, -67, -33, 1, 35, 69, 103, -- (+38 chars; full line in the Zenodo source)
[-143, -107, -71, -35, 1, 37, 73, 109, 145, -177, -141, -105, -69, -33, 3, 39, 75, 111, 147, -175, -139, -103, -67, -31, 5, 41, 77, 113, 149, -173, -137, -101, -65, -29, 7, 43, 79, 115, 151, -171, -135, -99, -63, -27, 9, 45, 81, 117, 153, -169, -133, -97, -61, -25, 11, 47, 83, 119, 155, -167, -131, -95, -59, -23, 13, 49, 85, 121, 157, -165, -129, -93, -57, -21, 15, 51, 87, 123, 159, -163, -127, -- (+37 chars; full line in the Zenodo source)
[-141, -103, -65, -27, 11, 49, 87, 125, 163, -157, -119, -81, -43, -5, 33, 71, 109, 147, -173, -135, -97, -59, -21, 17, 55, 93, 131, 169, -151, -113, -75, -37, 1, 39, 77, 115, 153, -167, -129, -91, -53, -15, 23, 61, 99, 137, 175, -145, -107, -69, -31, 7, 45, 83, 121, 159, -161, -123, -85, -47, -9, 29, 67, 105, 143, -177, -139, -101, -63, -25, 13, 51, 89, 127, 165, -155, -117, -79, -41, -3, 35, 7 -- (+40 chars; full line in the Zenodo source)
[-139, -99, -59, -19, 21, 61, 101, 141, -177, -137, -97, -57, -17, 23, 63, 103, 143, -175, -135, -95, -55, -15, 25, 65, 105, 145, -173, -133, -93, -53, -13, 27, 67, 107, 147, -171, -131, -91, -51, -11, 29, 69, 109, 149, -169, -129, -89, -49, -9, 31, 71, 111, 151, -167, -127, -87, -47, -7, 33, 73, 113, 153, -165, -125, -85, -45, -5, 35, 75, 115, 155, -163, -123, -83, -43, -3, 37, 77, 117, 157, -1 -- (+42 chars; full line in the Zenodo source)
[-137, -95, -53, -11, 31, 73, 115, 157, -159, -117, -75, -33, 9, 51, 93, 135, 177, -139, -97, -55, -13, 29, 71, 113, 155, -161, -119, -77, -35, 7, 49, 91, 133, 175, -141, -99, -57, -15, 27, 69, 111, 153, -163, -121, -79, -37, 5, 47, 89, 131, 173, -143, -101, -59, -17, 25, 67, 109, 151, -165, -123, -81, -39, 3, 45, 87, 129, 171, -145, -103, -61, -19, 23, 65, 107, 149, -167, -125, -83, -41, 1, 43, -- (+37 chars; full line in the Zenodo source)
[-135, -91, -47, -3, 41, 85, 129, 173, -141, -97, -53, -9, 35, 79, 123, 167, -147, -103, -59, -15, 29, 73, 117, 161, -153, -109, -65, -21, 23, 67, 111, 155, -159, -115, -71, -27, 17, 61, 105, 149, -165, -121, -77, -33, 11, 55, 99, 143, -171, -127, -83, -39, 5, 49, 93, 137, -177, -133, -89, -45, -1, 43, 87, 131, 175, -139, -95, -51, -7, 37, 81, 125, 169, -145, -101, -57, -13, 31, 75, 119, 163, -1 -- (+38 chars; full line in the Zenodo source)
[-133, -87, -41, 5, 51, 97, 143, -169, -123, -77, -31, 15, 61, 107, 153, -159, -113, -67, -21, 25, 71, 117, 163, -149, -103, -57, -11, 35, 81, 127, 173, -139, -93, -47, -1, 45, 91, 137, -175, -129, -83, -37, 9, 55, 101, 147, -165, -119, -73, -27, 19, 65, 111, 157, -155, -109, -63, -17, 29, 75, 121, 167, -145, -99, -53, -7, 39, 85, 131, 177, -135, -89, -43, 3, 49, 95, 141, -171, -125, -79, -33, 1 -- (+39 chars; full line in the Zenodo source)
[-131, -83, -35, 13, 61, 109, 157, -153, -105, -57, -9, 39, 87, 135, -175, -127, -79, -31, 17, 65, 113, 161, -149, -101, -53, -5, 43, 91, 139, -171, -123, -75, -27, 21, 69, 117, 165, -145, -97, -49, -1, 47, 95, 143, -167, -119, -71, -23, 25, 73, 121, 169, -141, -93, -45, 3, 51, 99, 147, -163, -115, -67, -19, 29, 77, 125, 173, -137, -89, -41, 7, 55, 103, 151, -159, -111, -63, -15, 33, 81, 129, 17 -- (+37 chars; full line in the Zenodo source)
[-129, -79, -29, 21, 71, 121, 171, -137, -87, -37, 13, 63, 113, 163, -145, -95, -45, 5, 55, 105, 155, -153, -103, -53, -3, 47, 97, 147, -161, -111, -61, -11, 39, 89, 139, -169, -119, -69, -19, 31, 81, 131, -177, -127, -77, -27, 23, 73, 123, 173, -135, -85, -35, 15, 65, 115, 165, -143, -93, -43, 7, 57, 107, 157, -151, -101, -51, -1, 49, 99, 149, -159, -109, -59, -9, 41, 91, 141, -167, -117, -67, -- (+40 chars; full line in the Zenodo source)
[-127, -75, -23, 29, 81, 133, -173, -121, -69, -17, 35, 87, 139, -167, -115, -63, -11, 41, 93, 145, -161, -109, -57, -5, 47, 99, 151, -155, -103, -51, 1, 53, 105, 157, -149, -97, -45, 7, 59, 111, 163, -143, -91, -39, 13, 65, 117, 169, -137, -85, -33, 19, 71, 123, 175, -131, -79, -27, 25, 77, 129, -177, -125, -73, -21, 31, 83, 135, -171, -119, -67, -15, 37, 89, 141, -165, -113, -61, -9, 43, 95, 1 -- (+39 chars; full line in the Zenodo source)
[-125, -71, -17, 37, 91, 145, -159, -105, -51, 3, 57, 111, 165, -139, -85, -31, 23, 77, 131, -173, -119, -65, -11, 43, 97, 151, -153, -99, -45, 9, 63, 117, 171, -133, -79, -25, 29, 83, 137, -167, -113, -59, -5, 49, 103, 157, -147, -93, -39, 15, 69, 123, 177, -127, -73, -19, 35, 89, 143, -161, -107, -53, 1, 55, 109, 163, -141, -87, -33, 21, 75, 129, -175, -121, -67, -13, 41, 95, 149, -155, -101, -- (+38 chars; full line in the Zenodo source)
[-123, -67, -11, 45, 101, 157, -145, -89, -33, 23, 79, 135, -167, -111, -55, 1, 57, 113, 169, -133, -77, -21, 35, 91, 147, -155, -99, -43, 13, 69, 125, -177, -121, -65, -9, 47, 103, 159, -143, -87, -31, 25, 81, 137, -165, -109, -53, 3, 59, 115, 171, -131, -75, -19, 37, 93, 149, -153, -97, -41, 15, 71, 127, -175, -119, -63, -7, 49, 105, 161, -141, -85, -29, 27, 83, 139, -163, -107, -51, 5, 61, 11 -- (+37 chars; full line in the Zenodo source)
[-121, -63, -5, 53, 111, 169, -131, -73, -15, 43, 101, 159, -141, -83, -25, 33, 91, 149, -151, -93, -35, 23, 81, 139, -161, -103, -45, 13, 71, 129, -171, -113, -55, 3, 61, 119, 177, -123, -65, -7, 51, 109, 167, -133, -75, -17, 41, 99, 157, -143, -85, -27, 31, 89, 147, -153, -95, -37, 21, 79, 137, -163, -105, -47, 11, 69, 127, -173, -115, -57, 1, 59, 117, 175, -125, -67, -9, 49, 107, 165, -135, - -- (+38 chars; full line in the Zenodo source)
[-119, -59, 1, 61, 121, -177, -117, -57, 3, 63, 123, -175, -115, -55, 5, 65, 125, -173, -113, -53, 7, 67, 127, -171, -111, -51, 9, 69, 129, -169, -109, -49, 11, 71, 131, -167, -107, -47, 13, 73, 133, -165, -105, -45, 15, 75, 135, -163, -103, -43, 17, 77, 137, -161, -101, -41, 19, 79, 139, -159, -99, -39, 21, 81, 141, -157, -97, -37, 23, 83, 143, -155, -95, -35, 25, 85, 145, -153, -93, -33, 27, 8 -- (+37 chars; full line in the Zenodo source)
[-117, -55, 7, 69, 131, -165, -103, -41, 21, 83, 145, -151, -89, -27, 35, 97, 159, -137, -75, -13, 49, 111, 173, -123, -61, 1, 63, 125, -171, -109, -47, 15, 77, 139, -157, -95, -33, 29, 91, 153, -143, -81, -19, 43, 105, 167, -129, -67, -5, 57, 119, -177, -115, -53, 9, 71, 133, -163, -101, -39, 23, 85, 147, -149, -87, -25, 37, 99, 161, -135, -73, -11, 51, 113, 175, -121, -59, 3, 65, 127, -169, -1 -- (+38 chars; full line in the Zenodo source)
[-115, -51, 13, 77, 141, -153, -89, -25, 39, 103, 167, -127, -63, 1, 65, 129, -165, -101, -37, 27, 91, 155, -139, -75, -11, 53, 117, -177, -113, -49, 15, 79, 143, -151, -87, -23, 41, 105, 169, -125, -61, 3, 67, 131, -163, -99, -35, 29, 93, 157, -137, -73, -9, 55, 119, -175, -111, -47, 17, 81, 145, -149, -85, -21, 43, 107, 171, -123, -59, 5, 69, 133, -161, -97, -33, 31, 95, 159, -135, -71, -7, 57 -- (+37 chars; full line in the Zenodo source)
[-113, -47, 19, 85, 151, -141, -75, -9, 57, 123, -169, -103, -37, 29, 95, 161, -131, -65, 1, 67, 133, -159, -93, -27, 39, 105, 171, -121, -55, 11, 77, 143, -149, -83, -17, 49, 115, -177, -111, -45, 21, 87, 153, -139, -73, -7, 59, 125, -167, -101, -35, 31, 97, 163, -129, -63, 3, 69, 135, -157, -91, -25, 41, 107, 173, -119, -53, 13, 79, 145, -147, -81, -15, 51, 117, -175, -109, -43, 23, 89, 155, - -- (+39 chars; full line in the Zenodo source)
[-111, -43, 25, 93, 161, -129, -61, 7, 75, 143, -147, -79, -11, 57, 125, -165, -97, -29, 39, 107, 175, -115, -47, 21, 89, 157, -133, -65, 3, 71, 139, -151, -83, -15, 53, 121, -169, -101, -33, 35, 103, 171, -119, -51, 17, 85, 153, -137, -69, -1, 67, 135, -155, -87, -19, 49, 117, -173, -105, -37, 31, 99, 167, -123, -55, 13, 81, 149, -141, -73, -5, 63, 131, -159, -91, -23, 45, 113, -177, -109, -41, -- (+37 chars; full line in the Zenodo source)
[-109, -39, 31, 101, 171, -117, -47, 23, 93, 163, -125, -55, 15, 85, 155, -133, -63, 7, 77, 147, -141, -71, -1, 69, 139, -149, -79, -9, 61, 131, -157, -87, -17, 53, 123, -165, -95, -25, 45, 115, -173, -103, -33, 37, 107, 177, -111, -41, 29, 99, 169, -119, -49, 21, 91, 161, -127, -57, 13, 83, 153, -135, -65, 5, 75, 145, -143, -73, -3, 67, 137, -151, -81, -11, 59, 129, -159, -89, -19, 51, 121, -16 -- (+39 chars; full line in the Zenodo source)
[-107, -35, 37, 109, -177, -105, -33, 39, 111, -175, -103, -31, 41, 113, -173, -101, -29, 43, 115, -171, -99, -27, 45, 117, -169, -97, -25, 47, 119, -167, -95, -23, 49, 121, -165, -93, -21, 51, 123, -163, -91, -19, 53, 125, -161, -89, -17, 55, 127, -159, -87, -15, 57, 129, -157, -85, -13, 59, 131, -155, -83, -11, 61, 133, -153, -81, -9, 63, 135, -151, -79, -7, 65, 137, -149, -77, -5, 67, 139, -1 -- (+46 chars; full line in the Zenodo source)
[-105, -31, 43, 117, -167, -93, -19, 55, 129, -155, -81, -7, 67, 141, -143, -69, 5, 79, 153, -131, -57, 17, 91, 165, -119, -45, 29, 103, 177, -107, -33, 41, 115, -169, -95, -21, 53, 127, -157, -83, -9, 65, 139, -145, -71, 3, 77, 151, -133, -59, 15, 89, 163, -121, -47, 27, 101, 175, -109, -35, 39, 113, -171, -97, -23, 51, 125, -159, -85, -11, 63, 137, -147, -73, 1, 75, 149, -135, -61, 13, 87, 161 -- (+37 chars; full line in the Zenodo source)
[-103, -27, 49, 125, -157, -81, -5, 71, 147, -135, -59, 17, 93, 169, -113, -37, 39, 115, -167, -91, -15, 61, 137, -145, -69, 7, 83, 159, -123, -47, 29, 105, -177, -101, -25, 51, 127, -155, -79, -3, 73, 149, -133, -57, 19, 95, 171, -111, -35, 41, 117, -165, -89, -13, 63, 139, -143, -67, 9, 85, 161, -121, -45, 31, 107, -175, -99, -23, 53, 129, -153, -77, -1, 75, 151, -131, -55, 21, 97, 173, -109, -- (+39 chars; full line in the Zenodo source)
[-101, -23, 55, 133, -147, -69, 9, 87, 165, -115, -37, 41, 119, -161, -83, -5, 73, 151, -129, -51, 27, 105, -175, -97, -19, 59, 137, -143, -65, 13, 91, 169, -111, -33, 45, 123, -157, -79, -1, 77, 155, -125, -47, 31, 109, -171, -93, -15, 63, 141, -139, -61, 17, 95, 173, -107, -29, 49, 127, -153, -75, 3, 81, 159, -121, -43, 35, 113, -167, -89, -11, 67, 145, -135, -57, 21, 99, 177, -103, -25, 53, 1 -- (+38 chars; full line in the Zenodo source)
[-99, -19, 61, 141, -137, -57, 23, 103, -175, -95, -15, 65, 145, -133, -53, 27, 107, -171, -91, -11, 69, 149, -129, -49, 31, 111, -167, -87, -7, 73, 153, -125, -45, 35, 115, -163, -83, -3, 77, 157, -121, -41, 39, 119, -159, -79, 1, 81, 161, -117, -37, 43, 123, -155, -75, 5, 85, 165, -113, -33, 47, 127, -151, -71, 9, 89, 169, -109, -29, 51, 131, -147, -67, 13, 93, 173, -105, -25, 55, 135, -143, - -- (+37 chars; full line in the Zenodo source)
[-97, -15, 67, 149, -127, -45, 37, 119, -157, -75, 7, 89, 171, -105, -23, 59, 141, -135, -53, 29, 111, -165, -83, -1, 81, 163, -113, -31, 51, 133, -143, -61, 21, 103, -173, -91, -9, 73, 155, -121, -39, 43, 125, -151, -69, 13, 95, 177, -99, -17, 65, 147, -129, -47, 35, 117, -159, -77, 5, 87, 169, -107, -25, 57, 139, -137, -55, 27, 109, -167, -85, -3, 79, 161, -115, -33, 49, 131, -145, -63, 19, 10 -- (+39 chars; full line in the Zenodo source)
[-95, -11, 73, 157, -117, -33, 51, 135, -139, -55, 29, 113, -161, -77, 7, 91, 175, -99, -15, 69, 153, -121, -37, 47, 131, -143, -59, 25, 109, -165, -81, 3, 87, 171, -103, -19, 65, 149, -125, -41, 43, 127, -147, -63, 21, 105, -169, -85, -1, 83, 167, -107, -23, 61, 145, -129, -45, 39, 123, -151, -67, 17, 101, -173, -89, -5, 79, 163, -111, -27, 57, 141, -133, -49, 35, 119, -155, -71, 13, 97, -177, -- (+38 chars; full line in the Zenodo source)
[-93, -7, 79, 165, -107, -21, 65, 151, -121, -35, 51, 137, -135, -49, 37, 123, -149, -63, 23, 109, -163, -77, 9, 95, -177, -91, -5, 81, 167, -105, -19, 67, 153, -119, -33, 53, 139, -133, -47, 39, 125, -147, -61, 25, 111, -161, -75, 11, 97, -175, -89, -3, 83, 169, -103, -17, 69, 155, -117, -31, 55, 141, -131, -45, 41, 127, -145, -59, 27, 113, -159, -73, 13, 99, -173, -87, -1, 85, 171, -101, -15, -- (+40 chars; full line in the Zenodo source)
[-91, -3, 85, 173, -97, -9, 79, 167, -103, -15, 73, 161, -109, -21, 67, 155, -115, -27, 61, 149, -121, -33, 55, 143, -127, -39, 49, 137, -133, -45, 43, 131, -139, -51, 37, 125, -145, -57, 31, 119, -151, -63, 25, 113, -157, -69, 19, 107, -163, -75, 13, 101, -169, -81, 7, 95, -175, -87, 1, 89, 177, -93, -5, 83, 171, -99, -11, 77, 165, -105, -17, 71, 159, -111, -23, 65, 153, -117, -29, 59, 147, -12 -- (+37 chars; full line in the Zenodo source)
[-89, 1, 91, -177, -87, 3, 93, -175, -85, 5, 95, -173, -83, 7, 97, -171, -81, 9, 99, -169, -79, 11, 101, -167, -77, 13, 103, -165, -75, 15, 105, -163, -73, 17, 107, -161, -71, 19, 109, -159, -69, 21, 111, -157, -67, 23, 113, -155, -65, 25, 115, -153, -63, 27, 117, -151, -61, 29, 119, -149, -59, 31, 121, -147, -57, 33, 123, -145, -55, 35, 125, -143, -53, 37, 127, -141, -51, 39, 129, -139, -49, 41 -- (+38 chars; full line in the Zenodo source)
[-87, 5, 97, -169, -77, 15, 107, -159, -67, 25, 117, -149, -57, 35, 127, -139, -47, 45, 137, -129, -37, 55, 147, -119, -27, 65, 157, -109, -17, 75, 167, -99, -7, 85, 177, -89, 3, 95, -171, -79, 13, 105, -161, -69, 23, 115, -151, -59, 33, 125, -141, -49, 43, 135, -131, -39, 53, 145, -121, -29, 63, 155, -111, -19, 73, 165, -101, -9, 83, 175, -91, 1, 93, -173, -81, 11, 103, -163, -71, 21, 113, -153 -- (+36 chars; full line in the Zenodo source)
[-85, 9, 103, -161, -67, 27, 121, -143, -49, 45, 139, -125, -31, 63, 157, -107, -13, 81, 175, -89, 5, 99, -165, -71, 23, 117, -147, -53, 41, 135, -129, -35, 59, 153, -111, -17, 77, 171, -93, 1, 95, -169, -75, 19, 113, -151, -57, 37, 131, -133, -39, 55, 149, -115, -21, 73, 167, -97, -3, 91, -173, -79, 15, 109, -155, -61, 33, 127, -137, -43, 51, 145, -119, -25, 69, 163, -101, -7, 87, -177, -83, 11 -- (+38 chars; full line in the Zenodo source)
[-83, 13, 109, -153, -57, 39, 135, -127, -31, 65, 161, -101, -5, 91, -171, -75, 21, 117, -145, -49, 47, 143, -119, -23, 73, 169, -93, 3, 99, -163, -67, 29, 125, -137, -41, 55, 151, -111, -15, 81, 177, -85, 11, 107, -155, -59, 37, 133, -129, -33, 63, 159, -103, -7, 89, -173, -77, 19, 115, -147, -51, 45, 141, -121, -25, 71, 167, -95, 1, 97, -165, -69, 27, 123, -139, -43, 53, 149, -113, -17, 79, 17 -- (+36 chars; full line in the Zenodo source)
[-81, 17, 115, -145, -47, 51, 149, -111, -13, 85, -175, -77, 21, 119, -141, -43, 55, 153, -107, -9, 89, -171, -73, 25, 123, -137, -39, 59, 157, -103, -5, 93, -167, -69, 29, 127, -133, -35, 63, 161, -99, -1, 97, -163, -65, 33, 131, -129, -31, 67, 165, -95, 3, 101, -159, -61, 37, 135, -125, -27, 71, 169, -91, 7, 105, -155, -57, 41, 139, -121, -23, 75, 173, -87, 11, 109, -151, -53, 45, 143, -117, - -- (+38 chars; full line in the Zenodo source)
[-79, 21, 121, -137, -37, 63, 163, -95, 5, 105, -153, -53, 47, 147, -111, -11, 89, -169, -69, 31, 131, -127, -27, 73, 173, -85, 15, 115, -143, -43, 57, 157, -101, -1, 99, -159, -59, 41, 141, -117, -17, 83, -175, -75, 25, 125, -133, -33, 67, 167, -91, 9, 109, -149, -49, 51, 151, -107, -7, 93, -165, -65, 35, 135, -123, -23, 77, 177, -81, 19, 119, -139, -39, 61, 161, -97, 3, 103, -155, -55, 45, 145 -- (+37 chars; full line in the Zenodo source)
[-77, 25, 127, -129, -27, 75, 177, -79, 23, 125, -131, -29, 73, 175, -81, 21, 123, -133, -31, 71, 173, -83, 19, 121, -135, -33, 69, 171, -85, 17, 119, -137, -35, 67, 169, -87, 15, 117, -139, -37, 65, 167, -89, 13, 115, -141, -39, 63, 165, -91, 11, 113, -143, -41, 61, 163, -93, 9, 111, -145, -43, 59, 161, -95, 7, 109, -147, -45, 57, 159, -97, 5, 107, -149, -47, 55, 157, -99, 3, 105, -151, -49, 53 -- (+32 chars; full line in the Zenodo source)
[-75, 29, 133, -121, -17, 87, -167, -63, 41, 145, -109, -5, 99, -155, -51, 53, 157, -97, 7, 111, -143, -39, 65, 169, -85, 19, 123, -131, -27, 77, -177, -73, 31, 135, -119, -15, 89, -165, -61, 43, 147, -107, -3, 101, -153, -49, 55, 159, -95, 9, 113, -141, -37, 67, 171, -83, 21, 125, -129, -25, 79, -175, -71, 33, 137, -117, -13, 91, -163, -59, 45, 149, -105, -1, 103, -151, -47, 57, 161, -93, 11, 1 -- (+38 chars; full line in the Zenodo source)
[-73, 33, 139, -113, -7, 99, -153, -47, 59, 165, -87, 19, 125, -127, -21, 85, -167, -61, 45, 151, -101, 5, 111, -141, -35, 71, 177, -75, 31, 137, -115, -9, 97, -155, -49, 57, 163, -89, 17, 123, -129, -23, 83, -169, -63, 43, 149, -103, 3, 109, -143, -37, 69, 175, -77, 29, 135, -117, -11, 95, -157, -51, 55, 161, -91, 15, 121, -131, -25, 81, -171, -65, 41, 147, -105, 1, 107, -145, -39, 67, 173, -79 -- (+37 chars; full line in the Zenodo source)
[-71, 37, 145, -105, 3, 111, -139, -31, 77, -173, -65, 43, 151, -99, 9, 117, -133, -25, 83, -167, -59, 49, 157, -93, 15, 123, -127, -19, 89, -161, -53, 55, 163, -87, 21, 129, -121, -13, 95, -155, -47, 61, 169, -81, 27, 135, -115, -7, 101, -149, -41, 67, 175, -75, 33, 141, -109, -1, 107, -143, -35, 73, -177, -69, 39, 147, -103, 5, 113, -137, -29, 79, -171, -63, 45, 153, -97, 11, 119, -131, -23, 8 -- (+37 chars; full line in the Zenodo source)
[-69, 41, 151, -97, 13, 123, -125, -15, 95, -153, -43, 67, 177, -71, 39, 149, -99, 11, 121, -127, -17, 93, -155, -45, 65, 175, -73, 37, 147, -101, 9, 119, -129, -19, 91, -157, -47, 63, 173, -75, 35, 145, -103, 7, 117, -131, -21, 89, -159, -49, 61, 171, -77, 33, 143, -105, 5, 115, -133, -23, 87, -161, -51, 59, 169, -79, 31, 141, -107, 3, 113, -135, -25, 85, -163, -53, 57, 167, -81, 29, 139, -109, -- (+35 chars; full line in the Zenodo source)
[-67, 45, 157, -89, 23, 135, -111, 1, 113, -133, -21, 91, -155, -43, 69, -177, -65, 47, 159, -87, 25, 137, -109, 3, 115, -131, -19, 93, -153, -41, 71, -175, -63, 49, 161, -85, 27, 139, -107, 5, 117, -129, -17, 95, -151, -39, 73, -173, -61, 51, 163, -83, 29, 141, -105, 7, 119, -127, -15, 97, -149, -37, 75, -171, -59, 53, 165, -81, 31, 143, -103, 9, 121, -125, -13, 99, -147, -35, 77, -169, -57, 55 -- (+36 chars; full line in the Zenodo source)
[-65, 49, 163, -81, 33, 147, -97, 17, 131, -113, 1, 115, -129, -15, 99, -145, -31, 83, -161, -47, 67, -177, -63, 51, 165, -79, 35, 149, -95, 19, 133, -111, 3, 117, -127, -13, 101, -143, -29, 85, -159, -45, 69, -175, -61, 53, 167, -77, 37, 151, -93, 21, 135, -109, 5, 119, -125, -11, 103, -141, -27, 87, -157, -43, 71, -173, -59, 55, 169, -75, 39, 153, -91, 23, 137, -107, 7, 121, -123, -9, 105, -13 -- (+38 chars; full line in the Zenodo source)
[-63, 53, 169, -73, 43, 159, -83, 33, 149, -93, 23, 139, -103, 13, 129, -113, 3, 119, -123, -7, 109, -133, -17, 99, -143, -27, 89, -153, -37, 79, -163, -47, 69, -173, -57, 59, 175, -67, 49, 165, -77, 39, 155, -87, 29, 145, -97, 19, 135, -107, 9, 125, -117, -1, 115, -127, -11, 105, -137, -21, 95, -147, -31, 85, -157, -41, 75, -167, -51, 65, -177, -61, 55, 171, -71, 45, 161, -81, 35, 151, -91, 25, -- (+35 chars; full line in the Zenodo source)
[-61, 57, 175, -65, 53, 171, -69, 49, 167, -73, 45, 163, -77, 41, 159, -81, 37, 155, -85, 33, 151, -89, 29, 147, -93, 25, 143, -97, 21, 139, -101, 17, 135, -105, 13, 131, -109, 9, 127, -113, 5, 123, -117, 1, 119, -121, -3, 115, -125, -7, 111, -129, -11, 107, -133, -15, 103, -137, -19, 99, -141, -23, 95, -145, -27, 91, -149, -31, 87, -153, -35, 83, -157, -39, 79, -161, -43, 75, -165, -47, 71, -16 -- (+38 chars; full line in the Zenodo source)
[-59, 61, -177, -57, 63, -175, -55, 65, -173, -53, 67, -171, -51, 69, -169, -49, 71, -167, -47, 73, -165, -45, 75, -163, -43, 77, -161, -41, 79, -159, -39, 81, -157, -37, 83, -155, -35, 85, -153, -33, 87, -151, -31, 89, -149, -29, 91, -147, -27, 93, -145, -25, 95, -143, -23, 97, -141, -21, 99, -139, -19, 101, -137, -17, 103, -135, -15, 105, -133, -13, 107, -131, -11, 109, -129, -9, 111, -127, -7 -- (+52 chars; full line in the Zenodo source)
[-57, 65, -171, -49, 73, -163, -41, 81, -155, -33, 89, -147, -25, 97, -139, -17, 105, -131, -9, 113, -123, -1, 121, -115, 7, 129, -107, 15, 137, -99, 23, 145, -91, 31, 153, -83, 39, 161, -75, 47, 169, -67, 55, 177, -59, 63, -173, -51, 71, -165, -43, 79, -157, -35, 87, -149, -27, 95, -141, -19, 103, -133, -11, 111, -125, -3, 119, -117, 5, 127, -109, 13, 135, -101, 21, 143, -93, 29, 151, -85, 37, -- (+38 chars; full line in the Zenodo source)
[-55, 69, -165, -41, 83, -151, -27, 97, -137, -13, 111, -123, 1, 125, -109, 15, 139, -95, 29, 153, -81, 43, 167, -67, 57, -177, -53, 71, -163, -39, 85, -149, -25, 99, -135, -11, 113, -121, 3, 127, -107, 17, 141, -93, 31, 155, -79, 45, 169, -65, 59, -175, -51, 73, -161, -37, 87, -147, -23, 101, -133, -9, 115, -119, 5, 129, -105, 19, 143, -91, 33, 157, -77, 47, 171, -63, 61, -173, -49, 75, -159, - -- (+39 chars; full line in the Zenodo source)
[-53, 73, -159, -33, 93, -139, -13, 113, -119, 7, 133, -99, 27, 153, -79, 47, 173, -59, 67, -165, -39, 87, -145, -19, 107, -125, 1, 127, -105, 21, 147, -85, 41, 167, -65, 61, -171, -45, 81, -151, -25, 101, -131, -5, 121, -111, 15, 141, -91, 35, 161, -71, 55, -177, -51, 75, -157, -31, 95, -137, -11, 115, -117, 9, 135, -97, 29, 155, -77, 49, 175, -57, 69, -163, -37, 89, -143, -17, 109, -123, 3, 12 -- (+37 chars; full line in the Zenodo source)
[-51, 77, -153, -25, 103, -127, 1, 129, -101, 27, 155, -75, 53, -177, -49, 79, -151, -23, 105, -125, 3, 131, -99, 29, 157, -73, 55, -175, -47, 81, -149, -21, 107, -123, 5, 133, -97, 31, 159, -71, 57, -173, -45, 83, -147, -19, 109, -121, 7, 135, -95, 33, 161, -69, 59, -171, -43, 85, -145, -17, 111, -119, 9, 137, -93, 35, 163, -67, 61, -169, -41, 87, -143, -15, 113, -117, 11, 139, -91, 37, 165, -6 -- (+38 chars; full line in the Zenodo source)
[-49, 81, -147, -17, 113, -115, 15, 145, -83, 47, 177, -51, 79, -149, -19, 111, -117, 13, 143, -85, 45, 175, -53, 77, -151, -21, 109, -119, 11, 141, -87, 43, 173, -55, 75, -153, -23, 107, -121, 9, 139, -89, 41, 171, -57, 73, -155, -25, 105, -123, 7, 137, -91, 39, 169, -59, 71, -157, -27, 103, -125, 5, 135, -93, 37, 167, -61, 69, -159, -29, 101, -127, 3, 133, -95, 35, 165, -63, 67, -161, -31, 99, -- (+34 chars; full line in the Zenodo source)
[-47, 85, -141, -9, 123, -103, 29, 161, -65, 67, -159, -27, 105, -121, 11, 143, -83, 49, -177, -45, 87, -139, -7, 125, -101, 31, 163, -63, 69, -157, -25, 107, -119, 13, 145, -81, 51, -175, -43, 89, -137, -5, 127, -99, 33, 165, -61, 71, -155, -23, 109, -117, 15, 147, -79, 53, -173, -41, 91, -135, -3, 129, -97, 35, 167, -59, 73, -153, -21, 111, -115, 17, 149, -77, 55, -171, -39, 93, -133, -1, 131, -- (+40 chars; full line in the Zenodo source)
[-45, 89, -135, -1, 133, -91, 43, 177, -47, 87, -137, -3, 131, -93, 41, 175, -49, 85, -139, -5, 129, -95, 39, 173, -51, 83, -141, -7, 127, -97, 37, 171, -53, 81, -143, -9, 125, -99, 35, 169, -55, 79, -145, -11, 123, -101, 33, 167, -57, 77, -147, -13, 121, -103, 31, 165, -59, 75, -149, -15, 119, -105, 29, 163, -61, 73, -151, -17, 117, -107, 27, 161, -63, 71, -153, -19, 115, -109, 25, 159, -65, 69 -- (+38 chars; full line in the Zenodo source)
[-43, 93, -129, 7, 143, -79, 57, -165, -29, 107, -115, 21, 157, -65, 71, -151, -15, 121, -101, 35, 171, -51, 85, -137, -1, 135, -87, 49, -173, -37, 99, -123, 13, 149, -73, 63, -159, -23, 113, -109, 27, 163, -59, 77, -145, -9, 127, -95, 41, 177, -45, 91, -131, 5, 141, -81, 55, -167, -31, 105, -117, 19, 155, -67, 69, -153, -17, 119, -103, 33, 169, -53, 83, -139, -3, 133, -89, 47, -175, -39, 97, -1 -- (+38 chars; full line in the Zenodo source)
[-41, 97, -123, 15, 153, -67, 71, -149, -11, 127, -93, 45, -175, -37, 101, -119, 19, 157, -63, 75, -145, -7, 131, -89, 49, -171, -33, 105, -115, 23, 161, -59, 79, -141, -3, 135, -85, 53, -167, -29, 109, -111, 27, 165, -55, 83, -137, 1, 139, -81, 57, -163, -25, 113, -107, 31, 169, -51, 87, -133, 5, 143, -77, 61, -159, -21, 117, -103, 35, 173, -47, 91, -129, 9, 147, -73, 65, -155, -17, 121, -99, 3 -- (+37 chars; full line in the Zenodo source)
[-39, 101, -117, 23, 163, -55, 85, -133, 7, 147, -71, 69, -149, -9, 131, -87, 53, -165, -25, 115, -103, 37, 177, -41, 99, -119, 21, 161, -57, 83, -135, 5, 145, -73, 67, -151, -11, 129, -89, 51, -167, -27, 113, -105, 35, 175, -43, 97, -121, 19, 159, -59, 81, -137, 3, 143, -75, 65, -153, -13, 127, -91, 49, -169, -29, 111, -107, 33, 173, -45, 95, -123, 17, 157, -61, 79, -139, 1, 141, -77, 63, -155, -- (+36 chars; full line in the Zenodo source)
[-37, 105, -111, 31, 173, -43, 99, -117, 25, 167, -49, 93, -123, 19, 161, -55, 87, -129, 13, 155, -61, 81, -135, 7, 149, -67, 75, -141, 1, 143, -73, 69, -147, -5, 137, -79, 63, -153, -11, 131, -85, 57, -159, -17, 125, -91, 51, -165, -23, 119, -97, 45, -171, -29, 113, -103, 39, -177, -35, 107, -109, 33, 175, -41, 101, -115, 27, 169, -47, 95, -121, 21, 163, -53, 89, -127, 15, 157, -59, 83, -133, 9 -- (+35 chars; full line in the Zenodo source)
[-35, 109, -105, 39, -175, -31, 113, -101, 43, -171, -27, 117, -97, 47, -167, -23, 121, -93, 51, -163, -19, 125, -89, 55, -159, -15, 129, -85, 59, -155, -11, 133, -81, 63, -151, -7, 137, -77, 67, -147, -3, 141, -73, 71, -143, 1, 145, -69, 75, -139, 5, 149, -65, 79, -135, 9, 153, -61, 83, -131, 13, 157, -57, 87, -127, 17, 161, -53, 91, -123, 21, 165, -49, 95, -119, 25, 169, -45, 99, -115, 29, 173 -- (+37 chars; full line in the Zenodo source)
[-33, 113, -99, 47, -165, -19, 127, -85, 61, -151, -5, 141, -71, 75, -137, 9, 155, -57, 89, -123, 23, 169, -43, 103, -109, 37, -175, -29, 117, -95, 51, -161, -15, 131, -81, 65, -147, -1, 145, -67, 79, -133, 13, 159, -53, 93, -119, 27, 173, -39, 107, -105, 41, -171, -25, 121, -91, 55, -157, -11, 135, -77, 69, -143, 3, 149, -63, 83, -129, 17, 163, -49, 97, -115, 31, 177, -35, 111, -101, 45, -167, -- (+39 chars; full line in the Zenodo source)
[-31, 117, -93, 55, -155, -7, 141, -69, 79, -131, 17, 165, -45, 103, -107, 41, -169, -21, 127, -83, 65, -145, 3, 151, -59, 89, -121, 27, 175, -35, 113, -97, 51, -159, -11, 137, -73, 75, -135, 13, 161, -49, 99, -111, 37, -173, -25, 123, -87, 61, -149, -1, 147, -63, 85, -125, 23, 171, -39, 109, -101, 47, -163, -15, 133, -77, 71, -139, 9, 157, -53, 95, -115, 33, -177, -29, 119, -91, 57, -153, -5, 1 -- (+38 chars; full line in the Zenodo source)
[-29, 121, -87, 63, -145, 5, 155, -53, 97, -111, 39, -169, -19, 131, -77, 73, -135, 15, 165, -43, 107, -101, 49, -159, -9, 141, -67, 83, -125, 25, 175, -33, 117, -91, 59, -149, 1, 151, -57, 93, -115, 35, -173, -23, 127, -81, 69, -139, 11, 161, -47, 103, -105, 45, -163, -13, 137, -71, 79, -129, 21, 171, -37, 113, -95, 55, -153, -3, 147, -61, 89, -119, 31, -177, -27, 123, -85, 65, -143, 7, 157, -5 -- (+38 chars; full line in the Zenodo source)
[-27, 125, -81, 71, -135, 17, 169, -37, 115, -91, 61, -145, 7, 159, -47, 105, -101, 51, -155, -3, 149, -57, 95, -111, 41, -165, -13, 139, -67, 85, -121, 31, -175, -23, 129, -77, 75, -131, 21, 173, -33, 119, -87, 65, -141, 11, 163, -43, 109, -97, 55, -151, 1, 153, -53, 99, -107, 45, -161, -9, 143, -63, 89, -117, 35, -171, -19, 133, -73, 79, -127, 25, 177, -29, 123, -83, 69, -137, 15, 167, -39, 11 -- (+36 chars; full line in the Zenodo source)
[-25, 129, -75, 79, -125, 29, -175, -21, 133, -71, 83, -121, 33, -171, -17, 137, -67, 87, -117, 37, -167, -13, 141, -63, 91, -113, 41, -163, -9, 145, -59, 95, -109, 45, -159, -5, 149, -55, 99, -105, 49, -155, -1, 153, -51, 103, -101, 53, -151, 3, 157, -47, 107, -97, 57, -147, 7, 161, -43, 111, -93, 61, -143, 11, 165, -39, 115, -89, 65, -139, 15, 169, -35, 119, -85, 69, -135, 19, 173, -31, 123, - -- (+38 chars; full line in the Zenodo source)
[-23, 133, -69, 87, -115, 41, -161, -5, 151, -51, 105, -97, 59, -143, 13, 169, -33, 123, -79, 77, -125, 31, -171, -15, 141, -61, 95, -107, 49, -153, 3, 159, -43, 113, -89, 67, -135, 21, 177, -25, 131, -71, 85, -117, 39, -163, -7, 149, -53, 103, -99, 57, -145, 11, 167, -35, 121, -81, 75, -127, 29, -173, -17, 139, -63, 93, -109, 47, -155, 1, 157, -45, 111, -91, 65, -137, 19, 175, -27, 129, -73, 83 -- (+37 chars; full line in the Zenodo source)
[-21, 137, -63, 95, -105, 53, -147, 11, 169, -31, 127, -73, 85, -115, 43, -157, 1, 159, -41, 117, -83, 75, -125, 33, -167, -9, 149, -51, 107, -93, 65, -135, 23, -177, -19, 139, -61, 97, -103, 55, -145, 13, 171, -29, 129, -71, 87, -113, 45, -155, 3, 161, -39, 119, -81, 77, -123, 35, -165, -7, 151, -49, 109, -91, 67, -133, 25, -175, -17, 141, -59, 99, -101, 57, -143, 15, 173, -27, 131, -69, 89, -1 -- (+37 chars; full line in the Zenodo source)
[-19, 141, -57, 103, -95, 65, -133, 27, -171, -11, 149, -49, 111, -87, 73, -125, 35, -163, -3, 157, -41, 119, -79, 81, -117, 43, -155, 5, 165, -33, 127, -71, 89, -109, 51, -147, 13, 173, -25, 135, -63, 97, -101, 59, -139, 21, -177, -17, 143, -55, 105, -93, 67, -131, 29, -169, -9, 151, -47, 113, -85, 75, -123, 37, -161, -1, 159, -39, 121, -77, 83, -115, 45, -153, 7, 167, -31, 129, -69, 91, -107, -- (+38 chars; full line in the Zenodo source)
[-17, 145, -51, 111, -85, 77, -119, 43, -153, 9, 171, -25, 137, -59, 103, -93, 69, -127, 35, -161, 1, 163, -33, 129, -67, 95, -101, 61, -135, 27, -169, -7, 155, -41, 121, -75, 87, -109, 53, -143, 19, -177, -15, 147, -49, 113, -83, 79, -117, 45, -151, 11, 173, -23, 139, -57, 105, -91, 71, -125, 37, -159, 3, 165, -31, 131, -65, 97, -99, 63, -133, 29, -167, -5, 157, -39, 123, -73, 89, -107, 55, -14 -- (+38 chars; full line in the Zenodo source)
[-15, 149, -45, 119, -75, 89, -105, 59, -135, 29, -165, -1, 163, -31, 133, -61, 103, -91, 73, -121, 43, -151, 13, 177, -17, 147, -47, 117, -77, 87, -107, 57, -137, 27, -167, -3, 161, -33, 131, -63, 101, -93, 71, -123, 41, -153, 11, 175, -19, 145, -49, 115, -79, 85, -109, 55, -139, 25, -169, -5, 159, -35, 129, -65, 99, -95, 69, -125, 39, -155, 9, 173, -21, 143, -51, 113, -81, 83, -111, 53, -141, -- (+38 chars; full line in the Zenodo source)
[-13, 153, -39, 127, -65, 101, -91, 75, -117, 49, -143, 23, -169, -3, 163, -29, 137, -55, 111, -81, 85, -107, 59, -133, 33, -159, 7, 173, -19, 147, -45, 121, -71, 95, -97, 69, -123, 43, -149, 17, -175, -9, 157, -35, 131, -61, 105, -87, 79, -113, 53, -139, 27, -165, 1, 167, -25, 141, -51, 115, -77, 89, -103, 63, -129, 37, -155, 11, 177, -15, 151, -41, 125, -67, 99, -93, 73, -119, 47, -145, 21, -1 -- (+38 chars; full line in the Zenodo source)
[-11, 157, -33, 135, -55, 113, -77, 91, -99, 69, -121, 47, -143, 25, -165, 3, 171, -19, 149, -41, 127, -63, 105, -85, 83, -107, 61, -129, 39, -151, 17, -173, -5, 163, -27, 141, -49, 119, -71, 97, -93, 75, -115, 53, -137, 31, -159, 9, 177, -13, 155, -35, 133, -57, 111, -79, 89, -101, 67, -123, 45, -145, 23, -167, 1, 169, -21, 147, -43, 125, -65, 103, -87, 81, -109, 59, -131, 37, -153, 15, -175, - -- (+37 chars; full line in the Zenodo source)
[-9, 161, -27, 143, -45, 125, -63, 107, -81, 89, -99, 71, -117, 53, -135, 35, -153, 17, -171, -1, 169, -19, 151, -37, 133, -55, 115, -73, 97, -91, 79, -109, 61, -127, 43, -145, 25, -163, 7, 177, -11, 159, -29, 141, -47, 123, -65, 105, -83, 87, -101, 69, -119, 51, -137, 33, -155, 15, -173, -3, 167, -21, 149, -39, 131, -57, 113, -75, 95, -93, 77, -111, 59, -129, 41, -147, 23, -165, 5, 175, -13, 15 -- (+38 chars; full line in the Zenodo source)
[-7, 165, -21, 151, -35, 137, -49, 123, -63, 109, -77, 95, -91, 81, -105, 67, -119, 53, -133, 39, -147, 25, -161, 11, -175, -3, 169, -17, 155, -31, 141, -45, 127, -59, 113, -73, 99, -87, 85, -101, 71, -115, 57, -129, 43, -143, 29, -157, 15, -171, 1, 173, -13, 159, -27, 145, -41, 131, -55, 117, -69, 103, -83, 89, -97, 75, -111, 61, -125, 47, -139, 33, -153, 19, -167, 5, 177, -9, 163, -23, 149, -3 -- (+37 chars; full line in the Zenodo source)
[-5, 169, -15, 159, -25, 149, -35, 139, -45, 129, -55, 119, -65, 109, -75, 99, -85, 89, -95, 79, -105, 69, -115, 59, -125, 49, -135, 39, -145, 29, -155, 19, -165, 9, -175, -1, 173, -11, 163, -21, 153, -31, 143, -41, 133, -51, 123, -61, 113, -71, 103, -81, 93, -91, 83, -101, 73, -111, 63, -121, 53, -131, 43, -141, 33, -151, 23, -161, 13, -171, 3, 177, -7, 167, -17, 157, -27, 147, -37, 137, -47, 1 -- (+38 chars; full line in the Zenodo source)
[-3, 173, -9, 167, -15, 161, -21, 155, -27, 149, -33, 143, -39, 137, -45, 131, -51, 125, -57, 119, -63, 113, -69, 107, -75, 101, -81, 95, -87, 89, -93, 83, -99, 77, -105, 71, -111, 65, -117, 59, -123, 53, -129, 47, -135, 41, -141, 35, -147, 29, -153, 23, -159, 17, -165, 11, -171, 5, -177, -1, 175, -7, 169, -13, 163, -19, 157, -25, 151, -31, 145, -37, 139, -43, 133, -49, 127, -55, 121, -61, 115, -- (+38 chars; full line in the Zenodo source)
[-1, 177, -3, 175, -5, 173, -7, 171, -9, 169, -11, 167, -13, 165, -15, 163, -17, 161, -19, 159, -21, 157, -23, 155, -25, 153, -27, 151, -29, 149, -31, 147, -33, 145, -35, 143, -37, 141, -39, 139, -41, 137, -43, 135, -45, 133, -47, 131, -49, 129, -51, 127, -53, 125, -55, 123, -57, 121, -59, 119, -61, 117, -63, 115, -65, 113, -67, 111, -69, 109, -71, 107, -73, 105, -75, 103, -77, 101, -79, 99, -81 -- (+38 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[-1715087469838587739501624714732, -1029514842738193683223044879068, -946806202248693789797219526457, -190607837299752896881474016527, -389968833285299427879972850192, 161858187431460083547640990427, 516122130088677666644384884602, -4550688328367087300179561100548, -1879752100044316527441535990407, 1014104808912221309038736660677, -2796671147634622745786176368273, -197981054310379534456454670464 -- (+2598 chars; full line in the Zenodo source)
[-1029514842738193683223044879068, -190607837299752896881474016527, 161858187431460083547640990427, -4550688328367087300179561100548, 1014104808912221309038736660677, -1979810543103795344564546704647, -5524351764261267553974863941202, 2474961596791722316057210608598, -3148078635935904468080342277823, -6567744272250462590032516362612, 223787786482433433415226573583, -23164062428813498171351417236 -- (+2557 chars; full line in the Zenodo source)
[-946806202248693789797219526457, 161858187431460083547640990427, -1879752100044316527441535990407, -1979810543103795344564546704647, -3264835591167726669162860293012, -3148078635935904468080342277823, -3900089066038349990677895757798, -2316406242881349817135141723603, -3605755669059272757166907680502, -2982202749704818629730857191178, -6537163474923391787798234913068, -2614951613350254136285164 -- (+2572 chars; full line in the Zenodo source)
[-190607837299752896881474016527, -4550688328367087300179561100548, -1979810543103795344564546704647, 2474961596791722316057210608598, -6567744272250462590032516362612, -2316406242881349817135141723603, -463701055817712849520865324558, -5443889486240521287365496717678, -2614951613350254136285164894742, -1296829799314844693124560721523, -6969857955664191529739956318948, -3293935428010647312569942 -- (+2574 chars; full line in the Zenodo source)
[-389968833285299427879972850192, 1014104808912221309038736660677, -3264835591167726669162860293012, -6567744272250462590032516362612, -3618355316195468262481658210192, -2982202749704818629730857191178, -6857757847747838369754657718563, -1296829799314844693124560721523, -6437195622940519589366165715517, -7658389641845190301344734176348, -5361804900288956996871007900898, -503881316385262290552633 -- (+2568 chars; full line in the Zenodo source)
[161858187431460083547640990427, -1979810543103795344564546704647, -3148078635935904468080342277823, -2316406242881349817135141723603, -2982202749704818629730857191178, -2614951613350254136285164894742, -2781392738007205631831581422157, -3293935428010647312569942148012, -3573291058182031214143564819933, -503881316385262290552633212282, 2425557328727797376495210000883, 576907082790111425157290602 -- (+2573 chars; full line in the Zenodo source)
[516122130088677666644384884602, -5524351764261267553974863941202, -3900089066038349990677895757798, -463701055817712849520865324558, -6857757847747838369754657718563, -2781392738007205631831581422157, -8004677789645218889839118318512, -3528991948163772858932759973047, -5814264749195871092600159724988, 434381640009829986178116248763, -5586157512867248675568968257142, 3770544233839187897664768596 -- (+2565 chars; full line in the Zenodo source)
[-4550688328367087300179561100548, 2474961596791722316057210608598, -2316406242881349817135141723603, -5443889486240521287365496717678, -1296829799314844693124560721523, -3293935428010647312569942148012, -3528991948163772858932759973047, -3249630104121705386366743295012, 576907082790111425157290602747, 89577417684147223285560266813, 2446875622628669432390839628368, 547211571055616164528430997753 -- (+2567 chars; full line in the Zenodo source)
[-1879752100044316527441535990407, -3148078635935904468080342277823, -3605755669059272757166907680502, -2614951613350254136285164894742, -6437195622940519589366165715517, -3573291058182031214143564819933, -5814264749195871092600159724988, 576907082790111425157290602747, -2114061553754793312049838467377, 6572343850505744992289528062847, -89577417684147223285560266813, 6428142114990510043760319386 -- (+2576 chars; full line in the Zenodo source)
[1014104808912221309038736660677, -6567744272250462590032516362612, -2982202749704818629730857191178, -1296829799314844693124560721523, -7658389641845190301344734176348, -503881316385262290552633212282, 434381640009829986178116248763, 89577417684147223285560266813, 6572343850505744992289528062847, 6881542109839864308337440185168, 4262467212588659893009968009318, 7909544724430647084188517325777, -- (+2571 chars; full line in the Zenodo source)
[-2796671147634622745786176368273, 223787786482433433415226573583, -6537163474923391787798234913068, -6969857955664191529739956318948, -5361804900288956996871007900898, 2425557328727797376495210000883, -5586157512867248675568968257142, 2446875622628669432390839628368, -89577417684147223285560266813, 4262467212588659893009968009318, -212496184570851884925368633262, 7711552710649187722823799472632 -- (+2569 chars; full line in the Zenodo source)
[-1979810543103795344564546704647, -2316406242881349817135141723603, -2614951613350254136285164894742, -3293935428010647312569942148012, -503881316385262290552633212282, 576907082790111425157290602747, 3770544233839187897664768596967, 5472115710556161645284309977537, 6428142114990510043760319386798, 7909544724430647084188517325777, 7711552710649187722823799472632, 6857757847747838369754657718563 -- (+2574 chars; full line in the Zenodo source)
[-2128702338658596401627547772767, -6084862738574597026397351449053, -7449104497236520198638022438892, 293780792197456403378594504433, -6170528223891005307536956411332, -206249592867297632058435237293, -2446875622628669432390839628368, 3991826301975062204032992136682, 5964355328582414870323545355648, 8004677789645218889839118318512, 2614951613350254136285164894742, 689825250047359001614727206849 -- (+2572 chars; full line in the Zenodo source)
[-5524351764261267553974863941202, -463701055817712849520865324558, -2781392738007205631831581422157, -3528991948163772858932759973047, 434381640009829986178116248763, 3770544233839187897664768596967, 2114061553754793312049838467377, 6487157824697124595869899605047, 11119280789195230260150575269503, 7449104497236520198638022438892, 3618355316195468262481658210192, 2796671147634622745786176368273 -- (+2574 chars; full line in the Zenodo source)
[-3264835591167726669162860293012, -2982202749704818629730857191178, -6437195622940519589366165715517, -503881316385262290552633212282, -3991826301975062204032992136682, 6572343850505744992289528062847, 1915536764249907814588518055222, 7909544724430647084188517325777, 6969857955664191529739956318948, 10264968376895039861693614517422, 5524351764261267553974863941202, -1715087469838587739501624714 -- (+2572 chars; full line in the Zenodo source)
[2474961596791722316057210608598, -5443889486240521287365496717678, -3293935428010647312569942148012, -3249630104121705386366743295012, 89577417684147223285560266813, 5472115710556161645284309977537, 6487157824697124595869899605047, 6558639428355314374773806964592, 6857757847747838369754657718563, 4951279968799918741865409979262, 946806202248693789797219526457, -2128702338658596401627547772767, -- (+2570 chars; full line in the Zenodo source)
[-3456120880167206940240770930482, -4223829287358056931164341358653, -6558639428355314374773806964592, -3189185814001860079598561663977, -3678024569597103531271789867237, 5586157512867248675568968257142, 503881316385262290552633212282, 8946675189439245826215858831542, 6084862738574597026397351449053, 1879752100044316527441535990407, -4550688328367087300179561100548, -3618355316195468262481658210 -- (+2570 chars; full line in the Zenodo source)
[-3148078635935904468080342277823, -2614951613350254136285164894742, -3573291058182031214143564819933, 576907082790111425157290602747, 6572343850505744992289528062847, 6428142114990510043760319386798, 11119280789195230260150575269503, 6857757847747838369754657718563, 3456120880167206940240770930482, -1715087469838587739501624714732, -4951279968799918741865409979262, -6191975370725588344556679658 -- (+2573 chars; full line in the Zenodo source)
[-4951279968799918741865409979262, -4333423163349405066602883953813, -5524734709096509375762744557617, 2902868240022044448639215848698, -3770544233839187897664768596967, 6170528223891005307536956411332, 1105815437995380900294201217052, 3605755669059272757166907680502, 4550688328367087300179561100548, -2796671147634622745786176368273, -2982202749704818629730857191178, -800467778964521888983911831 -- (+2570 chars; full line in the Zenodo source)
[-6567744272250462590032516362612, -1296829799314844693124560721523, -503881316385262290552633212282, 89577417684147223285560266813, 6881542109839864308337440185168, 7909544724430647084188517325777, 7449104497236520198638022438892, 4951279968799918741865409979262, -1715087469838587739501624714732, -3900089066038349990677895757798, -6113505074380975193738835545398, -748804168175144442378808337039 -- (+2572 chars; full line in the Zenodo source)
[-3900089066038349990677895757798, -2781392738007205631831581422157, -5814264749195871092600159724988, 3770544233839187897664768596967, 1915536764249907814588518055222, 11119280789195230260150575269503, 5443889486240521287365496717678, 2796671147634622745786176368273, 1014104808912221309038736660677, -4539018964587440966209843037452, 293780792197456403378594504433, -78053558480544172309653981550 -- (+2565 chars; full line in the Zenodo source)
[223787786482433433415226573583, -6969857955664191529739956318948, 2425557328727797376495210000883, 2446875622628669432390839628368, 4262467212588659893009968009318, 7711552710649187722823799472632, 3618355316195468262481658210192, 946806202248693789797219526457, -4951279968799918741865409979262, -6113505074380975193738835545398, -5814264749195871092600159724988, -3678024569597103531271789867237 -- (+2564 chars; full line in the Zenodo source)
[-6898252500473590016147272068493, -1105815437995380900294201217052, -4262467212588659893009968009318, -1470452052234712663608676895128, 3249630104121705386366743295012, 6113505074380975193738835545398, 3148078635935904468080342277823, -389968833285299427879972850192, -463701055817712849520865324558, -6558639428355314374773806964592, -1915536764249907814588518055222, -527156850292224443328877226 -- (+2573 chars; full line in the Zenodo source)
[-2316406242881349817135141723603, -3293935428010647312569942148012, 576907082790111425157290602747, 5472115710556161645284309977537, 7909544724430647084188517325777, 6857757847747838369754657718563, 2796671147634622745786176368273, -2128702338658596401627547772767, -6191975370725588344556679658138, -7488041681751444423788083370397, -3678024569597103531271789867237, -4343816400098299861781162487 -- (+2569 chars; full line in the Zenodo source)
[-3618355316195468262481658210192, -7658389641845190301344734176348, -3991826301975062204032992136682, 6881542109839864308337440185168, 3573291058182031214143564819933, 10264968376895039861693614517422, 190607837299752896881474016527, -3900089066038349990677895757798, -1105815437995380900294201217052, -6428142114990510043760319386798, 5472115710556161645284309977537, -212496184570851884925368633 -- (+2572 chars; full line in the Zenodo source)
[-6084862738574597026397351449053, 293780792197456403378594504433, -206249592867297632058435237293, 3991826301975062204032992136682, 8004677789645218889839118318512, 6898252500473590016147272068493, -946806202248693789797219526457, -10264968376895039861693614517422, -5361804900288956996871007900898, -2114061553754793312049838467377, -576907082790111425157290602747, 110581543799538090029420121705 -- (+2567 chars; full line in the Zenodo source)
[-3605755669059272757166907680502, -3573291058182031214143564819933, -2114061553754793312049838467377, 6428142114990510043760319386798, 6969857955664191529739956318948, 3456120880167206940240770930482, 1014104808912221309038736660677, -6191975370725588344556679658138, -3249630104121705386366743295012, -2446875622628669432390839628368, 7488041681751444423788083370397, 4223829287358056931164341358 -- (+2568 chars; full line in the Zenodo source)
[-463701055817712849520865324558, -3528991948163772858932759973047, 3770544233839187897664768596967, 6487157824697124595869899605047, 7449104497236520198638022438892, 2796671147634622745786176368273, -3456120880167206940240770930482, -6437195622940519589366165715517, -7805355848054417230965398155003, 206249592867297632058435237293, 7658389641845190301344734176348, -223787786482433433415226573583 -- (+2573 chars; full line in the Zenodo source)
[-10264968376895039861693614517422, 212496184570851884925368633262, 1470452052234712663608676895128, 5814264749195871092600159724988, 4223829287358056931164341358653, 389968833285299427879972850192, -2316406242881349817135141723603, -11119280789195230260150575269503, 527156850292224443328877226943, 3189185814001860079598561663977, 7449104497236520198638022438892, -1014104808912221309038736660677 -- (+2568 chars; full line in the Zenodo source)
[-2982202749704818629730857191178, -503881316385262290552633212282, 6572343850505744992289528062847, 7909544724430647084188517325777, 10264968376895039861693614517422, -1715087469838587739501624714732, -4539018964587440966209843037452, -7488041681751444423788083370397, -2446875622628669432390839628368, -212496184570851884925368633262, 463701055817712849520865324558, -1029514842738193683223044879 -- (+2575 chars; full line in the Zenodo source)
[-4539018964587440966209843037452, -5964355328582414870323545355648, -1854970504214435840348558399252, 5361804900288956996871007900898, 2316406242881349817135141723603, 516122130088677666644384884602, -4333423163349405066602883953813, -4262467212588659893009968009318, 6881542109839864308337440185168, 3293935428010647312569942148012, 3456120880167206940240770930482, -55243517642612675539748639412 -- (+2570 chars; full line in the Zenodo source)
[-5443889486240521287365496717678, -3249630104121705386366743295012, 5472115710556161645284309977537, 6558639428355314374773806964592, 4951279968799918741865409979262, -2128702338658596401627547772767, -6437195622940519589366165715517, -5586157512867248675568968257142, -434381640009829986178116248763, 4333423163349405066602883953813, -161858187431460083547640990427, -6084862738574597026397351449 -- (+2571 chars; full line in the Zenodo source)
[-6537163474923391787798234913068, 2425557328727797376495210000883, -89577417684147223285560266813, 7711552710649187722823799472632, 5524351764261267553974863941202, -4951279968799918741865409979262, 293780792197456403378594504433, -3678024569597103531271789867237, 7488041681751444423788083370397, 463701055817712849520865324558, -389968833285299427879972850192, -4333423163349405066602883953813, -- (+2565 chars; full line in the Zenodo source)
[-4223829287358056931164341358653, -3189185814001860079598561663977, 5586157512867248675568968257142, 8946675189439245826215858831542, 1879752100044316527441535990407, -3618355316195468262481658210192, -7909544724430647084188517325777, -1854970504214435840348558399252, -293780792197456403378594504433, 3148078635935904468080342277823, 2474961596791722316057210608598, -7658389641845190301344734176 -- (+2571 chars; full line in the Zenodo source)
[-6857757847747838369754657718563, 434381640009829986178116248763, 1915536764249907814588518055222, 7449104497236520198638022438892, 190607837299752896881474016527, -4539018964587440966209843037452, 2425557328727797376495210000883, 206249592867297632058435237293, 8946675189439245826215858831542, 4550688328367087300179561100548, -3605755669059272757166907680502, -5964355328582414870323545355648, -- (+2565 chars; full line in the Zenodo source)
[-2614951613350254136285164894742, 576907082790111425157290602747, 6428142114990510043760319386798, 6857757847747838369754657718563, -1715087469838587739501624714732, -6191975370725588344556679658138, -7805355848054417230965398155003, -434381640009829986178116248763, 4223829287358056931164341358653, -1029514842738193683223044879068, -4333423163349405066602883953813, -1915536764249907814588518055 -- (+2570 chars; full line in the Zenodo source)
[-6191975370725588344556679658138, -1915536764249907814588518055222, 3189185814001860079598561663977, 4539018964587440966209843037452, 161858187431460083547640990427, -8946675189439245826215858831542, 89577417684147223285560266813, 5964355328582414870323545355648, 3618355316195468262481658210192, -1979810543103795344564546704647, -8004677789645218889839118318512, 1854970504214435840348558399252, -- (+2569 chars; full line in the Zenodo source)
[-4333423163349405066602883953813, 2902868240022044448639215848698, 6170528223891005307536956411332, 3605755669059272757166907680502, -2796671147634622745786176368273, -8004677789645218889839118318512, 1470452052234712663608676895128, 3573291058182031214143564819933, -2474961596791722316057210608598, 223787786482433433415226573583, -503881316385262290552633212282, 2114061553754793312049838467377 -- (+2569 chars; full line in the Zenodo source)
[-7449104497236520198638022438892, -206249592867297632058435237293, 5964355328582414870323545355648, 6898252500473590016147272068493, 2474961596791722316057210608598, -5361804900288956996871007900898, 3678024569597103531271789867237, 1105815437995380900294201217052, -516122130088677666644384884602, -5443889486240521287365496717678, -6428142114990510043760319386798, 426246721258865989300996800931 -- (+2568 chars; full line in the Zenodo source)
[-1296829799314844693124560721523, 89577417684147223285560266813, 7909544724430647084188517325777, 4951279968799918741865409979262, -3900089066038349990677895757798, -7488041681751444423788083370397, 206249592867297632058435237293, 4333423163349405066602883953813, -1029514842738193683223044879068, -2781392738007205631831581422157, 527156850292224443328877226943, 5524734709096509375762744557617, -- (+2567 chars; full line in the Zenodo source)
[-6113505074380975193738835545398, 527156850292224443328877226943, 3528991948163772858932759973047, 3264835591167726669162860293012, -6084862738574597026397351449053, -6487157824697124595869899605047, 6428142114990510043760319386798, 2982202749704818629730857191178, -2796671147634622745786176368273, 293780792197456403378594504433, -1854970504214435840348558399252, 6437195622940519589366165715517 -- (+2567 chars; full line in the Zenodo source)
[-2781392738007205631831581422157, 3770544233839187897664768596967, 11119280789195230260150575269503, 2796671147634622745786176368273, -4539018964587440966209843037452, -7805355848054417230965398155003, 3249630104121705386366743295012, -223787786482433433415226573583, -6567744272250462590032516362612, -5964355328582414870323545355648, 3991826301975062204032992136682, 6537163474923391787798234913 -- (+2572 chars; full line in the Zenodo source)
[-8946675189439245826215858831542, 1854970504214435840348558399252, 7658389641845190301344734176348, -516122130088677666644384884602, -2614951613350254136285164894742, -6881542109839864308337440185168, 5524734709096509375762744557617, 5524351764261267553974863941202, -10264968376895039861693614517422, 576907082790111425157290602747, 3249630104121705386366743295012, 390008906603834999067789575779 -- (+2566 chars; full line in the Zenodo source)
[-6969857955664191529739956318948, 2446875622628669432390839628368, 7711552710649187722823799472632, 946806202248693789797219526457, -6113505074380975193738835545398, -3678024569597103531271789867237, 7658389641845190301344734176348, -161858187431460083547640990427, -4333423163349405066602883953813, 527156850292224443328877226943, 11119280789195230260150575269503, 1879752100044316527441535990407 -- (+2569 chars; full line in the Zenodo source)
[-6437195622940519589366165715517, 6572343850505744992289528062847, 6969857955664191529739956318948, -1715087469838587739501624714732, -1105815437995380900294201217052, -2446875622628669432390839628368, 8946675189439245826215858831542, -1029514842738193683223044879068, -7711552710649187722823799472632, -1470452052234712663608676895128, 2781392738007205631831581422157, -94680620224869378979721952 -- (+2572 chars; full line in the Zenodo source)
[-1105815437995380900294201217052, -1470452052234712663608676895128, 6113505074380975193738835545398, -389968833285299427879972850192, -6558639428355314374773806964592, -527156850292224443328877226943, 2614951613350254136285164894742, 1014104808912221309038736660677, -3528991948163772858932759973047, 5586157512867248675568968257142, 4539018964587440966209843037452, -32648355911677266691628602930 -- (+2574 chars; full line in the Zenodo source)
[-7711552710649187722823799472632, 3678024569597103531271789867237, 4333423163349405066602883953813, -1879752100044316527441535990407, -3528991948163772858932759973047, -2902868240022044448639215848698, 10264968376895039861693614517422, -3148078635935904468080342277823, -6170528223891005307536956411332, 6487157824697124595869899605047, 6567744272250462590032516362612, -36057556690592727571669076 -- (+2570 chars; full line in the Zenodo source)
[-3293935428010647312569942148012, 5472115710556161645284309977537, 6857757847747838369754657718563, -2128702338658596401627547772767, -7488041681751444423788083370397, -434381640009829986178116248763, -223787786482433433415226573583, -6084862738574597026397351449053, -1915536764249907814588518055222, 5524734709096509375762744557617, 1879752100044316527441535990407, -7449104497236520198638022438 -- (+2574 chars; full line in the Zenodo source)
[-8004677789645218889839118318512, 2114061553754793312049838467377, 5443889486240521287365496717678, -3456120880167206940240770930482, 2425557328727797376495210000883, 3249630104121705386366743295012, 3264835591167726669162860293012, -4223829287358056931164341358653, -5472115710556161645284309977537, 7711552710649187722823799472632, -1029514842738193683223044879068, -6558639428355314374773806964 -- (+2570 chars; full line in the Zenodo source)
[-7658389641845190301344734176348, 6881542109839864308337440185168, 10264968376895039861693614517422, -3900089066038349990677895757798, -6428142114990510043760319386798, -212496184570851884925368633262, 4550688328367087300179561100548, -2781392738007205631831581422157, -1470452052234712663608676895128, 6191975370725588344556679658138, -2128702338658596401627547772767, -58142647491958710926001597 -- (+2573 chars; full line in the Zenodo source)
[-6558639428355314374773806964592, 5586157512867248675568968257142, 6084862738574597026397351449053, -3618355316195468262481658210192, 2902868240022044448639215848698, -293780792197456403378594504433, 1715087469838587739501624714732, -7658389641845190301344734176348, 206249592867297632058435237293, 3605755669059272757166907680502, -2316406242881349817135141723603, -399182630197506220403299213668 -- (+2570 chars; full line in the Zenodo source)
[293780792197456403378594504433, 3991826301975062204032992136682, 6898252500473590016147272068493, -10264968376895039861693614517422, -2114061553754793312049838467377, 1105815437995380900294201217052, 161858187431460083547640990427, 212496184570851884925368633262, 4262467212588659893009968009318, 3456120880167206940240770930482, -6857757847747838369754657718563, 1470452052234712663608676895128, -- (+2566 chars; full line in the Zenodo source)
[-11119280789195230260150575269503, 7805355848054417230965398155003, 6567744272250462590032516362612, -6537163474923391787798234913068, 1854970504214435840348558399252, 1296829799314844693124560721523, -2128702338658596401627547772767, 2425557328727797376495210000883, 503881316385262290552633212282, -516122130088677666644384884602, -1105815437995380900294201217052, -89577417684147223285560266813 -- (+2569 chars; full line in the Zenodo source)
[-3573291058182031214143564819933, 6428142114990510043760319386798, 3456120880167206940240770930482, -6191975370725588344556679658138, -2446875622628669432390839628368, 4223829287358056931164341358653, -6567744272250462590032516362612, -1915536764249907814588518055222, 6558639428355314374773806964592, -946806202248693789797219526457, -5524734709096509375762744557617, 3189185814001860079598561663 -- (+2571 chars; full line in the Zenodo source)
[-5361804900288956996871007900898, 4262467212588659893009968009318, 5524351764261267553974863941202, -6113505074380975193738835545398, 5472115710556161645284309977537, 463701055817712849520865324558, -3605755669059272757166907680502, 527156850292224443328877226943, 2781392738007205631831581422157, -2128702338658596401627547772767, -3189185814001860079598561663977, 3528991948163772858932759973047 -- (+2569 chars; full line in the Zenodo source)
[-3528991948163772858932759973047, 6487157824697124595869899605047, 2796671147634622745786176368273, -6437195622940519589366165715517, 206249592867297632058435237293, -223787786482433433415226573583, -4223829287358056931164341358653, 6572343850505744992289528062847, 6537163474923391787798234913068, -6898252500473590016147272068493, -6881542109839864308337440185168, 696985795566419152973995631894 -- (+2574 chars; full line in the Zenodo source)
[-5524734709096509375762744557617, 6170528223891005307536956411332, 4550688328367087300179561100548, -8004677789645218889839118318512, 7805355848054417230965398155003, -2474961596791722316057210608598, -6113505074380975193738835545398, 2114061553754793312049838467377, 2316406242881349817135141723603, -6537163474923391787798234913068, 6572343850505744992289528062847, 54438894862405212873654967176 -- (+2574 chars; full line in the Zenodo source)
[212496184570851884925368633262, 5814264749195871092600159724988, 389968833285299427879972850192, -11119280789195230260150575269503, 3189185814001860079598561663977, -1014104808912221309038736660677, -3293935428010647312569942148012, 7805355848054417230965398155003, 3264835591167726669162860293012, -8946675189439245826215858831542, 206249592867297632058435237293, 6567744272250462590032516362612, -- (+2571 chars; full line in the Zenodo source)
[-7909544724430647084188517325777, 7488041681751444423788083370397, 1029514842738193683223044879068, -5524734709096509375762744557617, 5814264749195871092600159724988, 190607837299752896881474016527, -5361804900288956996871007900898, 6170528223891005307536956411332, -161858187431460083547640990427, -11119280789195230260150575269503, 6487157824697124595869899605047, 455068832836708730017956110054 -- (+2568 chars; full line in the Zenodo source)
[-503881316385262290552633212282, 7909544724430647084188517325777, -1715087469838587739501624714732, -7488041681751444423788083370397, -212496184570851884925368633262, -1029514842738193683223044879068, -5964355328582414870323545355648, 5524734709096509375762744557617, -946806202248693789797219526457, -5814264749195871092600159724988, 3528991948163772858932759973047, -1906078372997528968814740165 -- (+2572 chars; full line in the Zenodo source)
[-7488041681751444423788083370397, 5524734709096509375762744557617, -190607837299752896881474016527, -6170528223891005307536956411332, 11119280789195230260150575269503, -4550688328367087300179561100548, -4262467212588659893009968009318, 8004677789645218889839118318512, -1979810543103795344564546704647, -7805355848054417230965398155003, 6437195622940519589366165715517, 247496159679172231605721060 -- (+2572 chars; full line in the Zenodo source)
[-5964355328582414870323545355648, 5361804900288956996871007900898, 516122130088677666644384884602, -4262467212588659893009968009318, 3293935428010647312569942148012, -5524351764261267553974863941202, 2902868240022044448639215848698, 6113505074380975193738835545398, -3900089066038349990677895757798, -5472115710556161645284309977537, 4223829287358056931164341358653, -46370105581771284952086532455 -- (+2569 chars; full line in the Zenodo source)
[-5814264749195871092600159724988, 11119280789195230260150575269503, 1014104808912221309038736660677, -7805355848054417230965398155003, 8946675189439245826215858831542, -6567744272250462590032516362612, -5472115710556161645284309977537, 6537163474923391787798234913068, -2982202749704818629730857191178, -1854970504214435840348558399252, 6898252500473590016147272068493, -12968297993148446931245607 -- (+2573 chars; full line in the Zenodo source)
[-3249630104121705386366743295012, 6558639428355314374773806964592, -2128702338658596401627547772767, -5586157512867248675568968257142, 4333423163349405066602883953813, -6084862738574597026397351449053, 6572343850505744992289528062847, 3618355316195468262481658210192, -7449104497236520198638022438892, -2902868240022044448639215848698, 1979810543103795344564546704647, 2937807921974564033785945044 -- (+2574 chars; full line in the Zenodo source)
[-6170528223891005307536956411332, 8004677789645218889839118318512, 2474961596791722316057210608598, -2114061553754793312049838467377, 6537163474923391787798234913068, -5443889486240521287365496717678, -527156850292224443328877226943, 3456120880167206940240770930482, -3293935428010647312569942148012, -2425557328727797376495210000883, 1715087469838587739501624714732, -3249630104121705386366743295 -- (+2574 chars; full line in the Zenodo source)
[2425557328727797376495210000883, 7711552710649187722823799472632, -4951279968799918741865409979262, -3678024569597103531271789867237, 463701055817712849520865324558, -4333423163349405066602883953813, 3991826301975062204032992136682, 1879752100044316527441535990407, -5524734709096509375762744557617, 3528991948163772858932759973047, 1014104808912221309038736660677, 2902868240022044448639215848698 -- (+2570 chars; full line in the Zenodo source)
[-6487157824697124595869899605047, 6437195622940519589366165715517, 223787786482433433415226573583, -6572343850505744992289528062847, 6898252500473590016147272068493, -6969857955664191529739956318948, 3189185814001860079598561663977, 1715087469838587739501624714732, 2425557328727797376495210000883, 1105815437995380900294201217052, -3900089066038349990677895757798, 2446875622628669432390839628368 -- (+2568 chars; full line in the Zenodo source)
[-3189185814001860079598561663977, 8946675189439245826215858831542, -3618355316195468262481658210192, -1854970504214435840348558399252, 3148078635935904468080342277823, -7658389641845190301344734176348, 7488041681751444423788083370397, 516122130088677666644384884602, -3991826301975062204032992136682, 2614951613350254136285164894742, -5443889486240521287365496717678, 68815421098398643083374401851 -- (+2574 chars; full line in the Zenodo source)
[-4262467212588659893009968009318, 6113505074380975193738835545398, -463701055817712849520865324558, -527156850292224443328877226943, 2128702338658596401627547772767, -3528991948163772858932759973047, 3573291058182031214143564819933, -3264835591167726669162860293012, 3770544233839187897664768596967, 6084862738574597026397351449053, -8946675189439245826215858831542, 648715782469712459586989960504 -- (+2573 chars; full line in the Zenodo source)
[434381640009829986178116248763, 7449104497236520198638022438892, -4539018964587440966209843037452, 206249592867297632058435237293, 4550688328367087300179561100548, -5964355328582414870323545355648, 7711552710649187722823799472632, -6898252500473590016147272068493, -1854970504214435840348558399252, -2474961596791722316057210608598, -3573291058182031214143564819933, 536180490028895699687100790089 -- (+2570 chars; full line in the Zenodo source)
[-6428142114990510043760319386798, 6191975370725588344556679658138, -4223829287358056931164341358653, 1915536764249907814588518055222, 946806202248693789797219526457, -3189185814001860079598561663977, 1296829799314844693124560721523, -4539018964587440966209843037452, 5586157512867248675568968257142, -161858187431460083547640990427, -6170528223891005307536956411332, 894667518943924582621585883154 -- (+2569 chars; full line in the Zenodo source)
[576907082790111425157290602747, 6857757847747838369754657718563, -6191975370725588344556679658138, -434381640009829986178116248763, -1029514842738193683223044879068, -1915536764249907814588518055222, 6537163474923391787798234913068, -7449104497236520198638022438892, 3189185814001860079598561663977, -190607837299752896881474016527, 2902868240022044448639215848698, 4539018964587440966209843037452 -- (+2565 chars; full line in the Zenodo source)
[-7805355848054417230965398155003, 6537163474923391787798234913068, -1296829799314844693124560721523, -2425557328727797376495210000883, 516122130088677666644384884602, 89577417684147223285560266813, 6084862738574597026397351449053, -7711552710649187722823799472632, 7909544724430647084188517325777, -5524351764261267553974863941202, 1470452052234712663608676895128, 4951279968799918741865409979262, -- (+2567 chars; full line in the Zenodo source)
[-1915536764249907814588518055222, 4539018964587440966209843037452, -8946675189439245826215858831542, 5964355328582414870323545355648, -1979810543103795344564546704647, 1854970504214435840348558399252, 4951279968799918741865409979262, -5361804900288956996871007900898, 7658389641845190301344734176348, -2316406242881349817135141723603, 2114061553754793312049838467377, -5161221300886776666443848846 -- (+2570 chars; full line in the Zenodo source)
[-3991826301975062204032992136682, 10264968376895039861693614517422, -1105815437995380900294201217052, -212496184570851884925368633262, -3456120880167206940240770930482, -1470452052234712663608676895128, 1979810543103795344564546704647, -5814264749195871092600159724988, 6113505074380975193738835545398, -4223829287358056931164341358653, -434381640009829986178116248763, -38996883328529942787997285 -- (+2572 chars; full line in the Zenodo source)
[2902868240022044448639215848698, 3605755669059272757166907680502, -8004677789645218889839118318512, 3573291058182031214143564819933, 223787786482433433415226573583, 2114061553754793312049838467377, 389968833285299427879972850192, -6428142114990510043760319386798, 5443889486240521287365496717678, -6969857955664191529739956318948, 7909544724430647084188517325777, -3456120880167206940240770930482, -- (+2568 chars; full line in the Zenodo source)
[-5586157512867248675568968257142, 3618355316195468262481658210192, 293780792197456403378594504433, 7658389641845190301344734176348, -3605755669059272757166907680502, 3991826301975062204032992136682, -1029514842738193683223044879068, -6881542109839864308337440185168, 6898252500473590016147272068493, -3573291058182031214143564819933, 3293935428010647312569942148012, -10264968376895039861693614517 -- (+2566 chars; full line in the Zenodo source)
[-206249592867297632058435237293, 6898252500473590016147272068493, -5361804900288956996871007900898, 1105815437995380900294201217052, -5443889486240521287365496717678, 4262467212588659893009968009318, -1879752100044316527441535990407, 1470452052234712663608676895128, 5524351764261267553974863941202, -3249630104121705386366743295012, 6191975370725588344556679658138, -61135050743809751937388355453 -- (+2571 chars; full line in the Zenodo source)
[-6881542109839864308337440185168, 3900089066038349990677895757798, 212496184570851884925368633262, 2781392738007205631831581422157, -6191975370725588344556679658138, 5814264749195871092600159724988, 2474961596791722316057210608598, -3770544233839187897664768596967, 389968833285299427879972850192, -1915536764249907814588518055222, 6084862738574597026397351449053, -1111928078919523026015057526950 -- (+2569 chars; full line in the Zenodo source)
[89577417684147223285560266813, 4951279968799918741865409979262, -7488041681751444423788083370397, 4333423163349405066602883953813, -2781392738007205631831581422157, 5524734709096509375762744557617, -6898252500473590016147272068493, -2902868240022044448639215848698, -190607837299752896881474016527, 3770544233839187897664768596967, 3264835591167726669162860293012, -6170528223891005307536956411332 -- (+2574 chars; full line in the Zenodo source)
[-2114061553754793312049838467377, 3456120880167206940240770930482, -3249630104121705386366743295012, 4223829287358056931164341358653, -7711552710649187722823799472632, 6558639428355314374773806964592, -2982202749704818629730857191178, 3189185814001860079598561663977, -2128702338658596401627547772767, 3678024569597103531271789867237, 190607837299752896881474016527, -55861575128672486755689682571 -- (+2570 chars; full line in the Zenodo source)
[527156850292224443328877226943, 3264835591167726669162860293012, -6487157824697124595869899605047, 2982202749704818629730857191178, 293780792197456403378594504433, 6437195622940519589366165715517, -6191975370725588344556679658138, 503881316385262290552633212282, 223787786482433433415226573583, 3991826301975062204032992136682, 516122130088677666644384884602, -6572343850505744992289528062847, 455 -- (+2564 chars; full line in the Zenodo source)
[-5472115710556161645284309977537, 2128702338658596401627547772767, 434381640009829986178116248763, 6084862738574597026397351449053, -5524734709096509375762744557617, 7449104497236520198638022438892, -6969857955664191529739956318948, -293780792197456403378594504433, -4539018964587440966209843037452, 6170528223891005307536956411332, -3148078635935904468080342277823, 206249592867297632058435237293 -- (+2572 chars; full line in the Zenodo source)
[3770544233839187897664768596967, 2796671147634622745786176368273, -7805355848054417230965398155003, -223787786482433433415226573583, -5964355328582414870323545355648, 6537163474923391787798234913068, -6558639428355314374773806964592, 6969857955664191529739956318948, -1296829799314844693124560721523, 5361804900288956996871007900898, -10264968376895039861693614517422, -242555732872779737649521000 -- (+2567 chars; full line in the Zenodo source)
[-3678024569597103531271789867237, 1879752100044316527441535990407, 2902868240022044448639215848698, 3148078635935904468080342277823, -6487157824697124595869899605047, 3605755669059272757166907680502, 212496184570851884925368633262, 2614951613350254136285164894742, -8004677789645218889839118318512, 6437195622940519589366165715517, -1296829799314844693124560721523, 3573291058182031214143564819933 -- (+2566 chars; full line in the Zenodo source)
[1854970504214435840348558399252, -516122130088677666644384884602, -6881542109839864308337440185168, 5524351764261267553974863941202, 576907082790111425157290602747, 3900089066038349990677895757798, -6170528223891005307536956411332, 463701055817712849520865324558, 212496184570851884925368633262, 6857757847747838369754657718563, -6558639428355314374773806964592, 2781392738007205631831581422157, - -- (+2573 chars; full line in the Zenodo source)
[1470452052234712663608676895128, 389968833285299427879972850192, 527156850292224443328877226943, -1014104808912221309038736660677, -5586157512867248675568968257142, 3264835591167726669162860293012, 576907082790111425157290602747, 6567744272250462590032516362612, -6487157824697124595869899605047, 3618355316195468262481658210192, -5964355328582414870323545355648, 2982202749704818629730857191178, -- (+2568 chars; full line in the Zenodo source)
[2446875622628669432390839628368, 946806202248693789797219526457, -3678024569597103531271789867237, -161858187431460083547640990427, 527156850292224443328877226943, 1879752100044316527441535990407, -6881542109839864308337440185168, 1979810543103795344564546704647, 2902868240022044448639215848698, 3264835591167726669162860293012, -7805355848054417230965398155003, 3148078635935904468080342277823, -- (+2564 chars; full line in the Zenodo source)
[-6572343850505744992289528062847, 1715087469838587739501624714732, 2446875622628669432390839628368, 1029514842738193683223044879068, 1470452052234712663608676895128, 946806202248693789797219526457, 1854970504214435840348558399252, 190607837299752896881474016527, -3678024569597103531271789867237, 389968833285299427879972850192, 3770544233839187897664768596967, -161858187431460083547640990427, -5 -- (+2564 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 89).map (fun t => rowA (178 + 1) t (rng 1 89)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 89 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 89 B A = sid 27666804641906846896206996950384710 89 := rfl
theorem d_ne : (27666804641906846896206996950384710 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 89 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 89) (h0 : mv A g = zeros 89) : g = zeros 89 :=
kernel_zero 89 27666804641906846896206996950384710 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 178 89 = true := rfl
/-- **Balanced ⇒ pairs for p = 179.** A list with entries in (0, 179) that is balanced for 1 ≤ t ≤ 89
has as many copies of x as of 179 − x for every 1 ≤ x ≤ 89 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 179)
(hb : ∀ t, 1 ≤ t → t < 1 + 89 → tsum 179 t c + tsum 179 t c = c.length * 179) :
(rng 1 89).all (fun x => Nat.beq (cnt x c) (cnt (179 - x) c)) = true :=
pairs_of_bal 178 89 27666804641906846896206996950384710 d_ne A B len cert A_def delta c hr hb
end MailletCert179
#print axioms MailletCert179.A_def
#print axioms MailletCert179.len
#print axioms MailletCert179.cert
#print axioms MailletCert179.d_ne
#print axioms MailletCert179.kernel
#print axioms MailletCert179.delta
#print axioms MailletCert179.pairs
lean_all/hodge/MailletCert181.lean
/-
hodge/MailletCert181.lean — T41 (goals G849b, G849c): for p = 181 the 90 × 90 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 90)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 76534676305495490094395631557344250 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 181) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert181
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-179, -177, -175, -173, -171, -169, -167, -165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -49, -47, -45, -43, -41, -39, -3 -- (+88 chars; full line in the Zenodo source)
[-177, -173, -169, -165, -161, -157, -153, -149, -145, -141, -137, -133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, 143, 14 -- (+43 chars; full line in the Zenodo source)
[-175, -169, -163, -157, -151, -145, -139, -133, -127, -121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, 143, 149, 155, 161, 167, 173, 179, -177, -171, -165, -159, -153, -147, -141, -135, -129, -123, -117, -111, -105, -99, -93, -87, -81, -75, -- (+58 chars; full line in the Zenodo source)
[-173, -165, -157, -149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, 179, -175, -167, -159, -151, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113 -- (+42 chars; full line in the Zenodo source)
[-171, -161, -151, -141, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, 159, 169, 179, -173, -163, -153, -143, -133, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, 177, -175, -165, -155, -145, -135, -125, -115, -10 -- (+52 chars; full line in the Zenodo source)
[-169, -157, -145, -133, -121, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, 119, 131, 143, 155, 167, 179, -171, -159, -147, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, 141, 153, 165, 177, -173, -161, -149, -137, -125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, -- (+43 chars; full line in the Zenodo source)
[-167, -153, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, 169, -179, -165, -151, -137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, 143, 157, 171, -177, -163, -149, -135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, 145, 159, 173, -175, -161, -147, -13 -- (+49 chars; full line in the Zenodo source)
[-165, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, 155, 171, -175, -159, -143, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, -169, -153, -137, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, -179, -163, -147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29 -- (+43 chars; full line in the Zenodo source)
[-163, -145, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, 143, 161, 179, -165, -147, -129, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, 141, 159, 177, -167, -149, -131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121, 139, 157, 175, -169, -151, -133, -115, -97, -79, -61, -43, -25, -7, 11, 29, 47, 65, 83, 101, 119, 137, 155, 173, -171, -- (+48 chars; full line in the Zenodo source)
[-161, -141, -121, -101, -81, -61, -41, -21, -1, 19, 39, 59, 79, 99, 119, 139, 159, 179, -163, -143, -123, -103, -83, -63, -43, -23, -3, 17, 37, 57, 77, 97, 117, 137, 157, 177, -165, -145, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, 155, 175, -167, -147, -127, -107, -87, -67, -47, -27, -7, 13, 33, 53, 73, 93, 113, 133, 153, 173, -169, -149, -129, -109, -89, -69, -49, -29, - -- (+43 chars; full line in the Zenodo source)
[-159, -137, -115, -93, -71, -49, -27, -5, 17, 39, 61, 83, 105, 127, 149, 171, -169, -147, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, 139, 161, -179, -157, -135, -113, -91, -69, -47, -25, -3, 19, 41, 63, 85, 107, 129, 151, 173, -167, -145, -123, -101, -79, -57, -35, -13, 9, 31, 53, 75, 97, 119, 141, 163, -177, -155, -133, -111, -89, -67, -45, -23, -1, 21, 43, 65, 87, 109, 131, 153, -- (+48 chars; full line in the Zenodo source)
[-157, -133, -109, -85, -61, -37, -13, 11, 35, 59, 83, 107, 131, 155, 179, -159, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, 153, 177, -161, -137, -113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127, 151, 175, -163, -139, -115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125, 149, 173, -165, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, 171, -167, -143, -119, -95, -71, -47, -- (+40 chars; full line in the Zenodo source)
[-155, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, 157, -179, -153, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, 159, -177, -151, -125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, 161, -175, -149, -123, -97, -71, -45, -19, 7, 33, 59, 85, 111, 137, 163, -173, -147, -121, -95, -69, -43, -17, 9, 35, 61, 87, 113, 139, 165, -171, -145, -119, -93, -67, -41, -15, 11, 37, 63, 89, 115, 14 -- (+46 chars; full line in the Zenodo source)
[-153, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, 155, -179, -151, -123, -95, -67, -39, -11, 17, 45, 73, 101, 129, 157, -177, -149, -121, -93, -65, -37, -9, 19, 47, 75, 103, 131, 159, -175, -147, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, 161, -173, -145, -117, -89, -61, -33, -5, 23, 51, 79, 107, 135, 163, -171, -143, -115, -87, -59, -31, -3, 25, 53, 81, 109, 137, 165, -169, -141, -113, -- (+46 chars; full line in the Zenodo source)
[-151, -121, -91, -61, -31, -1, 29, 59, 89, 119, 149, 179, -153, -123, -93, -63, -33, -3, 27, 57, 87, 117, 147, 177, -155, -125, -95, -65, -35, -5, 25, 55, 85, 115, 145, 175, -157, -127, -97, -67, -37, -7, 23, 53, 83, 113, 143, 173, -159, -129, -99, -69, -39, -9, 21, 51, 81, 111, 141, 171, -161, -131, -101, -71, -41, -11, 19, 49, 79, 109, 139, 169, -163, -133, -103, -73, -43, -13, 17, 47, 77, 10 -- (+46 chars; full line in the Zenodo source)
[-149, -117, -85, -53, -21, 11, 43, 75, 107, 139, 171, -159, -127, -95, -63, -31, 1, 33, 65, 97, 129, 161, -169, -137, -105, -73, -41, -9, 23, 55, 87, 119, 151, -179, -147, -115, -83, -51, -19, 13, 45, 77, 109, 141, 173, -157, -125, -93, -61, -29, 3, 35, 67, 99, 131, 163, -167, -135, -103, -71, -39, -7, 25, 57, 89, 121, 153, -177, -145, -113, -81, -49, -17, 15, 47, 79, 111, 143, 175, -155, -123, -- (+42 chars; full line in the Zenodo source)
[-147, -113, -79, -45, -11, 23, 57, 91, 125, 159, -169, -135, -101, -67, -33, 1, 35, 69, 103, 137, 171, -157, -123, -89, -55, -21, 13, 47, 81, 115, 149, -179, -145, -111, -77, -43, -9, 25, 59, 93, 127, 161, -167, -133, -99, -65, -31, 3, 37, 71, 105, 139, 173, -155, -121, -87, -53, -19, 15, 49, 83, 117, 151, -177, -143, -109, -75, -41, -7, 27, 61, 95, 129, 163, -165, -131, -97, -63, -29, 5, 39, 7 -- (+45 chars; full line in the Zenodo source)
[-145, -109, -73, -37, -1, 35, 71, 107, 143, 179, -147, -111, -75, -39, -3, 33, 69, 105, 141, 177, -149, -113, -77, -41, -5, 31, 67, 103, 139, 175, -151, -115, -79, -43, -7, 29, 65, 101, 137, 173, -153, -117, -81, -45, -9, 27, 63, 99, 135, 171, -155, -119, -83, -47, -11, 25, 61, 97, 133, 169, -157, -121, -85, -49, -13, 23, 59, 95, 131, 167, -159, -123, -87, -51, -15, 21, 57, 93, 129, 165, -161, -- (+43 chars; full line in the Zenodo source)
[-143, -105, -67, -29, 9, 47, 85, 123, 161, -163, -125, -87, -49, -11, 27, 65, 103, 141, 179, -145, -107, -69, -31, 7, 45, 83, 121, 159, -165, -127, -89, -51, -13, 25, 63, 101, 139, 177, -147, -109, -71, -33, 5, 43, 81, 119, 157, -167, -129, -91, -53, -15, 23, 61, 99, 137, 175, -149, -111, -73, -35, 3, 41, 79, 117, 155, -169, -131, -93, -55, -17, 21, 59, 97, 135, 173, -151, -113, -75, -37, 1, 39 -- (+43 chars; full line in the Zenodo source)
[-141, -101, -61, -21, 19, 59, 99, 139, 179, -143, -103, -63, -23, 17, 57, 97, 137, 177, -145, -105, -65, -25, 15, 55, 95, 135, 175, -147, -107, -67, -27, 13, 53, 93, 133, 173, -149, -109, -69, -29, 11, 51, 91, 131, 171, -151, -111, -71, -31, 9, 49, 89, 129, 169, -153, -113, -73, -33, 7, 47, 87, 127, 167, -155, -115, -75, -35, 5, 45, 85, 125, 165, -157, -117, -77, -37, 3, 43, 83, 123, 163, -159, -- (+38 chars; full line in the Zenodo source)
[-139, -97, -55, -13, 29, 71, 113, 155, -165, -123, -81, -39, 3, 45, 87, 129, 171, -149, -107, -65, -23, 19, 61, 103, 145, -175, -133, -91, -49, -7, 35, 77, 119, 161, -159, -117, -75, -33, 9, 51, 93, 135, 177, -143, -101, -59, -17, 25, 67, 109, 151, -169, -127, -85, -43, -1, 41, 83, 125, 167, -153, -111, -69, -27, 15, 57, 99, 141, -179, -137, -95, -53, -11, 31, 73, 115, 157, -163, -121, -79, -37 -- (+45 chars; full line in the Zenodo source)
[-137, -93, -49, -5, 39, 83, 127, 171, -147, -103, -59, -15, 29, 73, 117, 161, -157, -113, -69, -25, 19, 63, 107, 151, -167, -123, -79, -35, 9, 53, 97, 141, -177, -133, -89, -45, -1, 43, 87, 131, 175, -143, -99, -55, -11, 33, 77, 121, 165, -153, -109, -65, -21, 23, 67, 111, 155, -163, -119, -75, -31, 13, 57, 101, 145, -173, -129, -85, -41, 3, 47, 91, 135, 179, -139, -95, -51, -7, 37, 81, 125, 16 -- (+43 chars; full line in the Zenodo source)
[-135, -89, -43, 3, 49, 95, 141, -175, -129, -83, -37, 9, 55, 101, 147, -169, -123, -77, -31, 15, 61, 107, 153, -163, -117, -71, -25, 21, 67, 113, 159, -157, -111, -65, -19, 27, 73, 119, 165, -151, -105, -59, -13, 33, 79, 125, 171, -145, -99, -53, -7, 39, 85, 131, 177, -139, -93, -47, -1, 45, 91, 137, -179, -133, -87, -41, 5, 51, 97, 143, -173, -127, -81, -35, 11, 57, 103, 149, -167, -121, -75, -- (+45 chars; full line in the Zenodo source)
[-133, -85, -37, 11, 59, 107, 155, -159, -111, -63, -15, 33, 81, 129, 177, -137, -89, -41, 7, 55, 103, 151, -163, -115, -67, -19, 29, 77, 125, 173, -141, -93, -45, 3, 51, 99, 147, -167, -119, -71, -23, 25, 73, 121, 169, -145, -97, -49, -1, 47, 95, 143, -171, -123, -75, -27, 21, 69, 117, 165, -149, -101, -53, -5, 43, 91, 139, -175, -127, -79, -31, 17, 65, 113, 161, -153, -105, -57, -9, 39, 87, 13 -- (+43 chars; full line in the Zenodo source)
[-131, -81, -31, 19, 69, 119, 169, -143, -93, -43, 7, 57, 107, 157, -155, -105, -55, -5, 45, 95, 145, -167, -117, -67, -17, 33, 83, 133, -179, -129, -79, -29, 21, 71, 121, 171, -141, -91, -41, 9, 59, 109, 159, -153, -103, -53, -3, 47, 97, 147, -165, -115, -65, -15, 35, 85, 135, -177, -127, -77, -27, 23, 73, 123, 173, -139, -89, -39, 11, 61, 111, 161, -151, -101, -51, -1, 49, 99, 149, -163, -113, -- (+46 chars; full line in the Zenodo source)
[-129, -77, -25, 27, 79, 131, -179, -127, -75, -23, 29, 81, 133, -177, -125, -73, -21, 31, 83, 135, -175, -123, -71, -19, 33, 85, 137, -173, -121, -69, -17, 35, 87, 139, -171, -119, -67, -15, 37, 89, 141, -169, -117, -65, -13, 39, 91, 143, -167, -115, -63, -11, 41, 93, 145, -165, -113, -61, -9, 43, 95, 147, -163, -111, -59, -7, 45, 97, 149, -161, -109, -57, -5, 47, 99, 151, -159, -107, -55, -3, -- (+49 chars; full line in the Zenodo source)
[-127, -73, -19, 35, 89, 143, -165, -111, -57, -3, 51, 105, 159, -149, -95, -41, 13, 67, 121, 175, -133, -79, -25, 29, 83, 137, -171, -117, -63, -9, 45, 99, 153, -155, -101, -47, 7, 61, 115, 169, -139, -85, -31, 23, 77, 131, -177, -123, -69, -15, 39, 93, 147, -161, -107, -53, 1, 55, 109, 163, -145, -91, -37, 17, 71, 125, 179, -129, -75, -21, 33, 87, 141, -167, -113, -59, -5, 49, 103, 157, -151, -- (+44 chars; full line in the Zenodo source)
[-125, -69, -13, 43, 99, 155, -151, -95, -39, 17, 73, 129, -177, -121, -65, -9, 47, 103, 159, -147, -91, -35, 21, 77, 133, -173, -117, -61, -5, 51, 107, 163, -143, -87, -31, 25, 81, 137, -169, -113, -57, -1, 55, 111, 167, -139, -83, -27, 29, 85, 141, -165, -109, -53, 3, 59, 115, 171, -135, -79, -23, 33, 89, 145, -161, -105, -49, 7, 63, 119, 175, -131, -75, -19, 37, 93, 149, -157, -101, -45, 11, -- (+43 chars; full line in the Zenodo source)
[-123, -65, -7, 51, 109, 167, -137, -79, -21, 37, 95, 153, -151, -93, -35, 23, 81, 139, -165, -107, -49, 9, 67, 125, -179, -121, -63, -5, 53, 111, 169, -135, -77, -19, 39, 97, 155, -149, -91, -33, 25, 83, 141, -163, -105, -47, 11, 69, 127, -177, -119, -61, -3, 55, 113, 171, -133, -75, -17, 41, 99, 157, -147, -89, -31, 27, 85, 143, -161, -103, -45, 13, 71, 129, -175, -117, -59, -1, 57, 115, 173, -- (+46 chars; full line in the Zenodo source)
[-121, -61, -1, 59, 119, 179, -123, -63, -3, 57, 117, 177, -125, -65, -5, 55, 115, 175, -127, -67, -7, 53, 113, 173, -129, -69, -9, 51, 111, 171, -131, -71, -11, 49, 109, 169, -133, -73, -13, 47, 107, 167, -135, -75, -15, 45, 105, 165, -137, -77, -17, 43, 103, 163, -139, -79, -19, 41, 101, 161, -141, -81, -21, 39, 99, 159, -143, -83, -23, 37, 97, 157, -145, -85, -25, 35, 95, 155, -147, -87, -27, -- (+43 chars; full line in the Zenodo source)
[-119, -57, 5, 67, 129, -171, -109, -47, 15, 77, 139, -161, -99, -37, 25, 87, 149, -151, -89, -27, 35, 97, 159, -141, -79, -17, 45, 107, 169, -131, -69, -7, 55, 117, 179, -121, -59, 3, 65, 127, -173, -111, -49, 13, 75, 137, -163, -101, -39, 23, 85, 147, -153, -91, -29, 33, 95, 157, -143, -81, -19, 43, 105, 167, -133, -71, -9, 53, 115, 177, -123, -61, 1, 63, 125, -175, -113, -51, 11, 73, 135, -16 -- (+43 chars; full line in the Zenodo source)
[-117, -53, 11, 75, 139, -159, -95, -31, 33, 97, 161, -137, -73, -9, 55, 119, -179, -115, -51, 13, 77, 141, -157, -93, -29, 35, 99, 163, -135, -71, -7, 57, 121, -177, -113, -49, 15, 79, 143, -155, -91, -27, 37, 101, 165, -133, -69, -5, 59, 123, -175, -111, -47, 17, 81, 145, -153, -89, -25, 39, 103, 167, -131, -67, -3, 61, 125, -173, -109, -45, 19, 83, 147, -151, -87, -23, 41, 105, 169, -129, -65 -- (+45 chars; full line in the Zenodo source)
[-115, -49, 17, 83, 149, -147, -81, -15, 51, 117, -179, -113, -47, 19, 85, 151, -145, -79, -13, 53, 119, -177, -111, -45, 21, 87, 153, -143, -77, -11, 55, 121, -175, -109, -43, 23, 89, 155, -141, -75, -9, 57, 123, -173, -107, -41, 25, 91, 157, -139, -73, -7, 59, 125, -171, -105, -39, 27, 93, 159, -137, -71, -5, 61, 127, -169, -103, -37, 29, 95, 161, -135, -69, -3, 63, 129, -167, -101, -35, 31, 9 -- (+48 chars; full line in the Zenodo source)
[-113, -45, 23, 91, 159, -135, -67, 1, 69, 137, -157, -89, -21, 47, 115, -179, -111, -43, 25, 93, 161, -133, -65, 3, 71, 139, -155, -87, -19, 49, 117, -177, -109, -41, 27, 95, 163, -131, -63, 5, 73, 141, -153, -85, -17, 51, 119, -175, -107, -39, 29, 97, 165, -129, -61, 7, 75, 143, -151, -83, -15, 53, 121, -173, -105, -37, 31, 99, 167, -127, -59, 9, 77, 145, -149, -81, -13, 55, 123, -171, -103, - -- (+42 chars; full line in the Zenodo source)
[-111, -41, 29, 99, 169, -123, -53, 17, 87, 157, -135, -65, 5, 75, 145, -147, -77, -7, 63, 133, -159, -89, -19, 51, 121, -171, -101, -31, 39, 109, 179, -113, -43, 27, 97, 167, -125, -55, 15, 85, 155, -137, -67, 3, 73, 143, -149, -79, -9, 61, 131, -161, -91, -21, 49, 119, -173, -103, -33, 37, 107, 177, -115, -45, 25, 95, 165, -127, -57, 13, 83, 153, -139, -69, 1, 71, 141, -151, -81, -11, 59, 129, -- (+43 chars; full line in the Zenodo source)
[-109, -37, 35, 107, 179, -111, -39, 33, 105, 177, -113, -41, 31, 103, 175, -115, -43, 29, 101, 173, -117, -45, 27, 99, 171, -119, -47, 25, 97, 169, -121, -49, 23, 95, 167, -123, -51, 21, 93, 165, -125, -53, 19, 91, 163, -127, -55, 17, 89, 161, -129, -57, 15, 87, 159, -131, -59, 13, 85, 157, -133, -61, 11, 83, 155, -135, -63, 9, 81, 153, -137, -65, 7, 79, 151, -139, -67, 5, 77, 149, -141, -69, 3 -- (+34 chars; full line in the Zenodo source)
[-107, -33, 41, 115, -173, -99, -25, 49, 123, -165, -91, -17, 57, 131, -157, -83, -9, 65, 139, -149, -75, -1, 73, 147, -141, -67, 7, 81, 155, -133, -59, 15, 89, 163, -125, -51, 23, 97, 171, -117, -43, 31, 105, 179, -109, -35, 39, 113, -175, -101, -27, 47, 121, -167, -93, -19, 55, 129, -159, -85, -11, 63, 137, -151, -77, -3, 71, 145, -143, -69, 5, 79, 153, -135, -61, 13, 87, 161, -127, -53, 21, 9 -- (+44 chars; full line in the Zenodo source)
[-105, -29, 47, 123, -163, -87, -11, 65, 141, -145, -69, 7, 83, 159, -127, -51, 25, 101, 177, -109, -33, 43, 119, -167, -91, -15, 61, 137, -149, -73, 3, 79, 155, -131, -55, 21, 97, 173, -113, -37, 39, 115, -171, -95, -19, 57, 133, -153, -77, -1, 75, 151, -135, -59, 17, 93, 169, -117, -41, 35, 111, -175, -99, -23, 53, 129, -157, -81, -5, 71, 147, -139, -63, 13, 89, 165, -121, -45, 31, 107, -179, -- (+44 chars; full line in the Zenodo source)
[-103, -25, 53, 131, -153, -75, 3, 81, 159, -125, -47, 31, 109, -175, -97, -19, 59, 137, -147, -69, 9, 87, 165, -119, -41, 37, 115, -169, -91, -13, 65, 143, -141, -63, 15, 93, 171, -113, -35, 43, 121, -163, -85, -7, 71, 149, -135, -57, 21, 99, 177, -107, -29, 49, 127, -157, -79, -1, 77, 155, -129, -51, 27, 105, -179, -101, -23, 55, 133, -151, -73, 5, 83, 161, -123, -45, 33, 111, -173, -95, -17, -- (+44 chars; full line in the Zenodo source)
[-101, -21, 59, 139, -143, -63, 17, 97, 177, -105, -25, 55, 135, -147, -67, 13, 93, 173, -109, -29, 51, 131, -151, -71, 9, 89, 169, -113, -33, 47, 127, -155, -75, 5, 85, 165, -117, -37, 43, 123, -159, -79, 1, 81, 161, -121, -41, 39, 119, -163, -83, -3, 77, 157, -125, -45, 35, 115, -167, -87, -7, 73, 153, -129, -49, 31, 111, -171, -91, -11, 69, 149, -133, -53, 27, 107, -175, -95, -15, 65, 145, -1 -- (+43 chars; full line in the Zenodo source)
[-99, -17, 65, 147, -133, -51, 31, 113, -167, -85, -3, 79, 161, -119, -37, 45, 127, -153, -71, 11, 93, 175, -105, -23, 59, 141, -139, -57, 25, 107, -173, -91, -9, 73, 155, -125, -43, 39, 121, -159, -77, 5, 87, 169, -111, -29, 53, 135, -145, -63, 19, 101, -179, -97, -15, 67, 149, -131, -49, 33, 115, -165, -83, -1, 81, 163, -117, -35, 47, 129, -151, -69, 13, 95, 177, -103, -21, 61, 143, -137, -55, -- (+45 chars; full line in the Zenodo source)
[-97, -13, 71, 155, -123, -39, 45, 129, -149, -65, 19, 103, -175, -91, -7, 77, 161, -117, -33, 51, 135, -143, -59, 25, 109, -169, -85, -1, 83, 167, -111, -27, 57, 141, -137, -53, 31, 115, -163, -79, 5, 89, 173, -105, -21, 63, 147, -131, -47, 37, 121, -157, -73, 11, 95, 179, -99, -15, 69, 153, -125, -41, 43, 127, -151, -67, 17, 101, -177, -93, -9, 75, 159, -119, -35, 49, 133, -145, -61, 23, 107, -- (+44 chars; full line in the Zenodo source)
[-95, -9, 77, 163, -113, -27, 59, 145, -131, -45, 41, 127, -149, -63, 23, 109, -167, -81, 5, 91, 177, -99, -13, 73, 159, -117, -31, 55, 141, -135, -49, 37, 123, -153, -67, 19, 105, -171, -85, 1, 87, 173, -103, -17, 69, 155, -121, -35, 51, 137, -139, -53, 33, 119, -157, -71, 15, 101, -175, -89, -3, 83, 169, -107, -21, 65, 151, -125, -39, 47, 133, -143, -57, 29, 115, -161, -75, 11, 97, -179, -93, -- (+44 chars; full line in the Zenodo source)
[-93, -5, 83, 171, -103, -15, 73, 161, -113, -25, 63, 151, -123, -35, 53, 141, -133, -45, 43, 131, -143, -55, 33, 121, -153, -65, 23, 111, -163, -75, 13, 101, -173, -85, 3, 91, 179, -95, -7, 81, 169, -105, -17, 71, 159, -115, -27, 61, 149, -125, -37, 51, 139, -135, -47, 41, 129, -145, -57, 31, 119, -155, -67, 21, 109, -165, -77, 11, 99, -175, -87, 1, 89, 177, -97, -9, 79, 167, -107, -19, 69, 157 -- (+42 chars; full line in the Zenodo source)
[-91, -1, 89, 179, -93, -3, 87, 177, -95, -5, 85, 175, -97, -7, 83, 173, -99, -9, 81, 171, -101, -11, 79, 169, -103, -13, 77, 167, -105, -15, 75, 165, -107, -17, 73, 163, -109, -19, 71, 161, -111, -21, 69, 159, -113, -23, 67, 157, -115, -25, 65, 155, -117, -27, 63, 153, -119, -29, 61, 151, -121, -31, 59, 149, -123, -33, 57, 147, -125, -35, 55, 145, -127, -37, 53, 143, -129, -39, 51, 141, -131, - -- (+44 chars; full line in the Zenodo source)
[-89, 3, 95, -175, -83, 9, 101, -169, -77, 15, 107, -163, -71, 21, 113, -157, -65, 27, 119, -151, -59, 33, 125, -145, -53, 39, 131, -139, -47, 45, 137, -133, -41, 51, 143, -127, -35, 57, 149, -121, -29, 63, 155, -115, -23, 69, 161, -109, -17, 75, 167, -103, -11, 81, 173, -97, -5, 87, 179, -91, 1, 93, -177, -85, 7, 99, -171, -79, 13, 105, -165, -73, 19, 111, -159, -67, 25, 117, -153, -61, 31, 123 -- (+42 chars; full line in the Zenodo source)
[-87, 7, 101, -167, -73, 21, 115, -153, -59, 35, 129, -139, -45, 49, 143, -125, -31, 63, 157, -111, -17, 77, 171, -97, -3, 91, -177, -83, 11, 105, -163, -69, 25, 119, -149, -55, 39, 133, -135, -41, 53, 147, -121, -27, 67, 161, -107, -13, 81, 175, -93, 1, 95, -173, -79, 15, 109, -159, -65, 29, 123, -145, -51, 43, 137, -131, -37, 57, 151, -117, -23, 71, 165, -103, -9, 85, 179, -89, 5, 99, -169, -7 -- (+43 chars; full line in the Zenodo source)
[-85, 11, 107, -159, -63, 33, 129, -137, -41, 55, 151, -115, -19, 77, 173, -93, 3, 99, -167, -71, 25, 121, -145, -49, 47, 143, -123, -27, 69, 165, -101, -5, 91, -175, -79, 17, 113, -153, -57, 39, 135, -131, -35, 61, 157, -109, -13, 83, 179, -87, 9, 105, -161, -65, 31, 127, -139, -43, 53, 149, -117, -21, 75, 171, -95, 1, 97, -169, -73, 23, 119, -147, -51, 45, 141, -125, -29, 67, 163, -103, -7, 89 -- (+42 chars; full line in the Zenodo source)
[-83, 15, 113, -151, -53, 45, 143, -121, -23, 75, 173, -91, 7, 105, -159, -61, 37, 135, -129, -31, 67, 165, -99, -1, 97, -167, -69, 29, 127, -137, -39, 59, 157, -107, -9, 89, -175, -77, 21, 119, -145, -47, 51, 149, -115, -17, 81, 179, -85, 13, 111, -153, -55, 43, 141, -123, -25, 73, 171, -93, 5, 103, -161, -63, 35, 133, -131, -33, 65, 163, -101, -3, 95, -169, -71, 27, 125, -139, -41, 57, 155, -1 -- (+44 chars; full line in the Zenodo source)
[-81, 19, 119, -143, -43, 57, 157, -105, -5, 95, -167, -67, 33, 133, -129, -29, 71, 171, -91, 9, 109, -153, -53, 47, 147, -115, -15, 85, -177, -77, 23, 123, -139, -39, 61, 161, -101, -1, 99, -163, -63, 37, 137, -125, -25, 75, 175, -87, 13, 113, -149, -49, 51, 151, -111, -11, 89, -173, -73, 27, 127, -135, -35, 65, 165, -97, 3, 103, -159, -59, 41, 141, -121, -21, 79, 179, -83, 17, 117, -145, -45, -- (+43 chars; full line in the Zenodo source)
[-79, 23, 125, -135, -33, 69, 171, -89, 13, 115, -145, -43, 59, 161, -99, 3, 105, -155, -53, 49, 151, -109, -7, 95, -165, -63, 39, 141, -119, -17, 85, -175, -73, 29, 131, -129, -27, 75, 177, -83, 19, 121, -139, -37, 65, 167, -93, 9, 111, -149, -47, 55, 157, -103, -1, 101, -159, -57, 45, 147, -113, -11, 91, -169, -67, 35, 137, -123, -21, 81, -179, -77, 25, 127, -133, -31, 71, 173, -87, 15, 117, - -- (+43 chars; full line in the Zenodo source)
[-77, 27, 131, -127, -23, 81, -177, -73, 31, 135, -123, -19, 85, -173, -69, 35, 139, -119, -15, 89, -169, -65, 39, 143, -115, -11, 93, -165, -61, 43, 147, -111, -7, 97, -161, -57, 47, 151, -107, -3, 101, -157, -53, 51, 155, -103, 1, 105, -153, -49, 55, 159, -99, 5, 109, -149, -45, 59, 163, -95, 9, 113, -145, -41, 63, 167, -91, 13, 117, -141, -37, 67, 171, -87, 17, 121, -137, -33, 71, 175, -83, 2 -- (+42 chars; full line in the Zenodo source)
[-75, 31, 137, -119, -13, 93, -163, -57, 49, 155, -101, 5, 111, -145, -39, 67, 173, -83, 23, 129, -127, -21, 85, -171, -65, 41, 147, -109, -3, 103, -153, -47, 59, 165, -91, 15, 121, -135, -29, 77, -179, -73, 33, 139, -117, -11, 95, -161, -55, 51, 157, -99, 7, 113, -143, -37, 69, 175, -81, 25, 131, -125, -19, 87, -169, -63, 43, 149, -107, -1, 105, -151, -45, 61, 167, -89, 17, 123, -133, -27, 79, -- (+45 chars; full line in the Zenodo source)
[-73, 35, 143, -111, -3, 105, -149, -41, 67, 175, -79, 29, 137, -117, -9, 99, -155, -47, 61, 169, -85, 23, 131, -123, -15, 93, -161, -53, 55, 163, -91, 17, 125, -129, -21, 87, -167, -59, 49, 157, -97, 11, 119, -135, -27, 81, -173, -65, 43, 151, -103, 5, 113, -141, -33, 75, -179, -71, 37, 145, -109, -1, 107, -147, -39, 69, 177, -77, 31, 139, -115, -7, 101, -153, -45, 63, 171, -83, 25, 133, -121, -- (+43 chars; full line in the Zenodo source)
[-71, 39, 149, -103, 7, 117, -135, -25, 85, -167, -57, 53, 163, -89, 21, 131, -121, -11, 99, -153, -43, 67, 177, -75, 35, 145, -107, 3, 113, -139, -29, 81, -171, -61, 49, 159, -93, 17, 127, -125, -15, 95, -157, -47, 63, 173, -79, 31, 141, -111, -1, 109, -143, -33, 77, -175, -65, 45, 155, -97, 13, 123, -129, -19, 91, -161, -51, 59, 169, -83, 27, 137, -115, -5, 105, -147, -37, 73, -179, -69, 41, 1 -- (+44 chars; full line in the Zenodo source)
[-69, 43, 155, -95, 17, 129, -121, -9, 103, -147, -35, 77, -173, -61, 51, 163, -87, 25, 137, -113, -1, 111, -139, -27, 85, -165, -53, 59, 171, -79, 33, 145, -105, 7, 119, -131, -19, 93, -157, -45, 67, 179, -71, 41, 153, -97, 15, 127, -123, -11, 101, -149, -37, 75, -175, -63, 49, 161, -89, 23, 135, -115, -3, 109, -141, -29, 83, -167, -55, 57, 169, -81, 31, 143, -107, 5, 117, -133, -21, 91, -159, -- (+42 chars; full line in the Zenodo source)
[-67, 47, 161, -87, 27, 141, -107, 7, 121, -127, -13, 101, -147, -33, 81, -167, -53, 61, 175, -73, 41, 155, -93, 21, 135, -113, 1, 115, -133, -19, 95, -153, -39, 75, -173, -59, 55, 169, -79, 35, 149, -99, 15, 129, -119, -5, 109, -139, -25, 89, -159, -45, 69, -179, -65, 49, 163, -85, 29, 143, -105, 9, 123, -125, -11, 103, -145, -31, 83, -165, -51, 63, 177, -71, 43, 157, -91, 23, 137, -111, 3, 117 -- (+43 chars; full line in the Zenodo source)
[-65, 51, 167, -79, 37, 153, -93, 23, 139, -107, 9, 125, -121, -5, 111, -135, -19, 97, -149, -33, 83, -163, -47, 69, -177, -61, 55, 171, -75, 41, 157, -89, 27, 143, -103, 13, 129, -117, -1, 115, -131, -15, 101, -145, -29, 87, -159, -43, 73, -173, -57, 59, 175, -71, 45, 161, -85, 31, 147, -99, 17, 133, -113, 3, 119, -127, -11, 105, -141, -25, 91, -155, -39, 77, -169, -53, 63, 179, -67, 49, 165, - -- (+41 chars; full line in the Zenodo source)
[-63, 55, 173, -71, 47, 165, -79, 39, 157, -87, 31, 149, -95, 23, 141, -103, 15, 133, -111, 7, 125, -119, -1, 117, -127, -9, 109, -135, -17, 101, -143, -25, 93, -151, -33, 85, -159, -41, 77, -167, -49, 69, -175, -57, 61, 179, -65, 53, 171, -73, 45, 163, -81, 37, 155, -89, 29, 147, -97, 21, 139, -105, 13, 131, -113, 5, 123, -121, -3, 115, -129, -11, 107, -137, -19, 99, -145, -27, 91, -153, -35, 8 -- (+44 chars; full line in the Zenodo source)
[-61, 59, 179, -63, 57, 177, -65, 55, 175, -67, 53, 173, -69, 51, 171, -71, 49, 169, -73, 47, 167, -75, 45, 165, -77, 43, 163, -79, 41, 161, -81, 39, 159, -83, 37, 157, -85, 35, 155, -87, 33, 153, -89, 31, 151, -91, 29, 149, -93, 27, 147, -95, 25, 145, -97, 23, 143, -99, 21, 141, -101, 19, 139, -103, 17, 137, -105, 15, 135, -107, 13, 133, -109, 11, 131, -111, 9, 129, -113, 7, 127, -115, 5, 125, -- (+28 chars; full line in the Zenodo source)
[-59, 63, -177, -55, 67, -173, -51, 71, -169, -47, 75, -165, -43, 79, -161, -39, 83, -157, -35, 87, -153, -31, 91, -149, -27, 95, -145, -23, 99, -141, -19, 103, -137, -15, 107, -133, -11, 111, -129, -7, 115, -125, -3, 119, -121, 1, 123, -117, 5, 127, -113, 9, 131, -109, 13, 135, -105, 17, 139, -101, 21, 143, -97, 25, 147, -93, 29, 151, -89, 33, 155, -85, 37, 159, -81, 41, 163, -77, 45, 167, -73, -- (+43 chars; full line in the Zenodo source)
[-57, 67, -171, -47, 77, -161, -37, 87, -151, -27, 97, -141, -17, 107, -131, -7, 117, -121, 3, 127, -111, 13, 137, -101, 23, 147, -91, 33, 157, -81, 43, 167, -71, 53, 177, -61, 63, -175, -51, 73, -165, -41, 83, -155, -31, 93, -145, -21, 103, -135, -11, 113, -125, -1, 123, -115, 9, 133, -105, 19, 143, -95, 29, 153, -85, 39, 163, -75, 49, 173, -65, 59, -179, -55, 69, -169, -45, 79, -159, -35, 89, -- (+46 chars; full line in the Zenodo source)
[-55, 71, -165, -39, 87, -149, -23, 103, -133, -7, 119, -117, 9, 135, -101, 25, 151, -85, 41, 167, -69, 57, -179, -53, 73, -163, -37, 89, -147, -21, 105, -131, -5, 121, -115, 11, 137, -99, 27, 153, -83, 43, 169, -67, 59, -177, -51, 75, -161, -35, 91, -145, -19, 107, -129, -3, 123, -113, 13, 139, -97, 29, 155, -81, 45, 171, -65, 61, -175, -49, 77, -159, -33, 93, -143, -17, 109, -127, -1, 125, -11 -- (+45 chars; full line in the Zenodo source)
[-53, 75, -159, -31, 97, -137, -9, 119, -115, 13, 141, -93, 35, 163, -71, 57, -177, -49, 79, -155, -27, 101, -133, -5, 123, -111, 17, 145, -89, 39, 167, -67, 61, -173, -45, 83, -151, -23, 105, -129, -1, 127, -107, 21, 149, -85, 43, 171, -63, 65, -169, -41, 87, -147, -19, 109, -125, 3, 131, -103, 25, 153, -81, 47, 175, -59, 69, -165, -37, 91, -143, -15, 113, -121, 7, 135, -99, 29, 157, -77, 51, 1 -- (+44 chars; full line in the Zenodo source)
[-51, 79, -153, -23, 107, -125, 5, 135, -97, 33, 163, -69, 61, -171, -41, 89, -143, -13, 117, -115, 15, 145, -87, 43, 173, -59, 71, -161, -31, 99, -133, -3, 127, -105, 25, 155, -77, 53, -179, -49, 81, -151, -21, 109, -123, 7, 137, -95, 35, 165, -67, 63, -169, -39, 91, -141, -11, 119, -113, 17, 147, -85, 45, 175, -57, 73, -159, -29, 101, -131, -1, 129, -103, 27, 157, -75, 55, -177, -47, 83, -149, -- (+44 chars; full line in the Zenodo source)
[-49, 83, -147, -15, 117, -113, 19, 151, -79, 53, -177, -45, 87, -143, -11, 121, -109, 23, 155, -75, 57, -173, -41, 91, -139, -7, 125, -105, 27, 159, -71, 61, -169, -37, 95, -135, -3, 129, -101, 31, 163, -67, 65, -165, -33, 99, -131, 1, 133, -97, 35, 167, -63, 69, -161, -29, 103, -127, 5, 137, -93, 39, 171, -59, 73, -157, -25, 107, -123, 9, 141, -89, 43, 175, -55, 77, -153, -21, 111, -119, 13, 1 -- (+43 chars; full line in the Zenodo source)
[-47, 87, -141, -7, 127, -101, 33, 167, -61, 73, -155, -21, 113, -115, 19, 153, -75, 59, -169, -35, 99, -129, 5, 139, -89, 45, 179, -49, 85, -143, -9, 125, -103, 31, 165, -63, 71, -157, -23, 111, -117, 17, 151, -77, 57, -171, -37, 97, -131, 3, 137, -91, 43, 177, -51, 83, -145, -11, 123, -105, 29, 163, -65, 69, -159, -25, 109, -119, 15, 149, -79, 55, -173, -39, 95, -133, 1, 135, -93, 41, 175, -53 -- (+42 chars; full line in the Zenodo source)
[-45, 91, -135, 1, 137, -89, 47, -179, -43, 93, -133, 3, 139, -87, 49, -177, -41, 95, -131, 5, 141, -85, 51, -175, -39, 97, -129, 7, 143, -83, 53, -173, -37, 99, -127, 9, 145, -81, 55, -171, -35, 101, -125, 11, 147, -79, 57, -169, -33, 103, -123, 13, 149, -77, 59, -167, -31, 105, -121, 15, 151, -75, 61, -165, -29, 107, -119, 17, 153, -73, 63, -163, -27, 109, -117, 19, 155, -71, 65, -161, -25, 11 -- (+43 chars; full line in the Zenodo source)
[-43, 95, -129, 9, 147, -77, 61, -163, -25, 113, -111, 27, 165, -59, 79, -145, -7, 131, -93, 45, -179, -41, 97, -127, 11, 149, -75, 63, -161, -23, 115, -109, 29, 167, -57, 81, -143, -5, 133, -91, 47, -177, -39, 99, -125, 13, 151, -73, 65, -159, -21, 117, -107, 31, 169, -55, 83, -141, -3, 135, -89, 49, -175, -37, 101, -123, 15, 153, -71, 67, -157, -19, 119, -105, 33, 171, -53, 85, -139, -1, 137, -- (+45 chars; full line in the Zenodo source)
[-41, 99, -123, 17, 157, -65, 75, -147, -7, 133, -89, 51, -171, -31, 109, -113, 27, 167, -55, 85, -137, 3, 143, -79, 61, -161, -21, 119, -103, 37, 177, -45, 95, -127, 13, 153, -69, 71, -151, -11, 129, -93, 47, -175, -35, 105, -117, 23, 163, -59, 81, -141, -1, 139, -83, 57, -165, -25, 115, -107, 33, 173, -49, 91, -131, 9, 149, -73, 67, -155, -15, 125, -97, 43, -179, -39, 101, -121, 19, 159, -63, -- (+44 chars; full line in the Zenodo source)
[-39, 103, -117, 25, 167, -53, 89, -131, 11, 153, -67, 75, -145, -3, 139, -81, 61, -159, -17, 125, -95, 47, -173, -31, 111, -109, 33, 175, -45, 97, -123, 19, 161, -59, 83, -137, 5, 147, -73, 69, -151, -9, 133, -87, 55, -165, -23, 119, -101, 41, -179, -37, 105, -115, 27, 169, -51, 91, -129, 13, 155, -65, 77, -143, -1, 141, -79, 63, -157, -15, 127, -93, 49, -171, -29, 113, -107, 35, 177, -43, 99, -- (+43 chars; full line in the Zenodo source)
[-37, 107, -111, 33, 177, -41, 103, -115, 29, 173, -45, 99, -119, 25, 169, -49, 95, -123, 21, 165, -53, 91, -127, 17, 161, -57, 87, -131, 13, 157, -61, 83, -135, 9, 153, -65, 79, -139, 5, 149, -69, 75, -143, 1, 145, -73, 71, -147, -3, 141, -77, 67, -151, -7, 137, -81, 63, -155, -11, 133, -85, 59, -159, -15, 129, -89, 55, -163, -19, 125, -93, 51, -167, -23, 121, -97, 47, -171, -27, 117, -101, 43, -- (+43 chars; full line in the Zenodo source)
[-35, 111, -105, 41, -175, -29, 117, -99, 47, -169, -23, 123, -93, 53, -163, -17, 129, -87, 59, -157, -11, 135, -81, 65, -151, -5, 141, -75, 71, -145, 1, 147, -69, 77, -139, 7, 153, -63, 83, -133, 13, 159, -57, 89, -127, 19, 165, -51, 95, -121, 25, 171, -45, 101, -115, 31, 177, -39, 107, -109, 37, -179, -33, 113, -103, 43, -173, -27, 119, -97, 49, -167, -21, 125, -91, 55, -161, -15, 131, -85, 61 -- (+46 chars; full line in the Zenodo source)
[-33, 115, -99, 49, -165, -17, 131, -83, 65, -149, -1, 147, -67, 81, -133, 15, 163, -51, 97, -117, 31, 179, -35, 113, -101, 47, -167, -19, 129, -85, 63, -151, -3, 145, -69, 79, -135, 13, 161, -53, 95, -119, 29, 177, -37, 111, -103, 45, -169, -21, 127, -87, 61, -153, -5, 143, -71, 77, -137, 11, 159, -55, 93, -121, 27, 175, -39, 109, -105, 43, -171, -23, 125, -89, 59, -155, -7, 141, -73, 75, -139, -- (+43 chars; full line in the Zenodo source)
[-31, 119, -93, 57, -155, -5, 145, -67, 83, -129, 21, 171, -41, 109, -103, 47, -165, -15, 135, -77, 73, -139, 11, 161, -51, 99, -113, 37, -175, -25, 125, -87, 63, -149, 1, 151, -61, 89, -123, 27, 177, -35, 115, -97, 53, -159, -9, 141, -71, 79, -133, 17, 167, -45, 105, -107, 43, -169, -19, 131, -81, 69, -143, 7, 157, -55, 95, -117, 33, -179, -29, 121, -91, 59, -153, -3, 147, -65, 85, -127, 23, 17 -- (+44 chars; full line in the Zenodo source)
[-29, 123, -87, 65, -145, 7, 159, -51, 101, -109, 43, -167, -15, 137, -73, 79, -131, 21, 173, -37, 115, -95, 57, -153, -1, 151, -59, 93, -117, 35, -175, -23, 129, -81, 71, -139, 13, 165, -45, 107, -103, 49, -161, -9, 143, -67, 85, -125, 27, 179, -31, 121, -89, 63, -147, 5, 157, -53, 99, -111, 41, -169, -17, 135, -75, 77, -133, 19, 171, -39, 113, -97, 55, -155, -3, 149, -61, 91, -119, 33, -177, - -- (+43 chars; full line in the Zenodo source)
[-27, 127, -81, 73, -135, 19, 173, -35, 119, -89, 65, -143, 11, 165, -43, 111, -97, 57, -151, 3, 157, -51, 103, -105, 49, -159, -5, 149, -59, 95, -113, 41, -167, -13, 141, -67, 87, -121, 33, -175, -21, 133, -75, 79, -129, 25, 179, -29, 125, -83, 71, -137, 17, 171, -37, 117, -91, 63, -145, 9, 163, -45, 109, -99, 55, -153, 1, 155, -53, 101, -107, 47, -161, -7, 147, -61, 93, -115, 39, -169, -15, 13 -- (+43 chars; full line in the Zenodo source)
[-25, 131, -75, 81, -125, 31, -175, -19, 137, -69, 87, -119, 37, -169, -13, 143, -63, 93, -113, 43, -163, -7, 149, -57, 99, -107, 49, -157, -1, 155, -51, 105, -101, 55, -151, 5, 161, -45, 111, -95, 61, -145, 11, 167, -39, 117, -89, 67, -139, 17, 173, -33, 123, -83, 73, -133, 23, 179, -27, 129, -77, 79, -127, 29, -177, -21, 135, -71, 85, -121, 35, -171, -15, 141, -65, 91, -115, 41, -165, -9, 147, -- (+45 chars; full line in the Zenodo source)
[-23, 135, -69, 89, -115, 43, -161, -3, 155, -49, 109, -95, 63, -141, 17, 175, -29, 129, -75, 83, -121, 37, -167, -9, 149, -55, 103, -101, 57, -147, 11, 169, -35, 123, -81, 77, -127, 31, -173, -15, 143, -61, 97, -107, 51, -153, 5, 163, -41, 117, -87, 71, -133, 25, -179, -21, 137, -67, 91, -113, 45, -159, -1, 157, -47, 111, -93, 65, -139, 19, 177, -27, 131, -73, 85, -119, 39, -165, -7, 151, -53, -- (+44 chars; full line in the Zenodo source)
[-21, 139, -63, 97, -105, 55, -147, 13, 173, -29, 131, -71, 89, -113, 47, -155, 5, 165, -37, 123, -79, 81, -121, 39, -163, -3, 157, -45, 115, -87, 73, -129, 31, -171, -11, 149, -53, 107, -95, 65, -137, 23, -179, -19, 141, -61, 99, -103, 57, -145, 15, 175, -27, 133, -69, 91, -111, 49, -153, 7, 167, -35, 125, -77, 83, -119, 41, -161, -1, 159, -43, 117, -85, 75, -127, 33, -169, -9, 151, -51, 109, - -- (+44 chars; full line in the Zenodo source)
[-19, 143, -57, 105, -95, 67, -133, 29, -171, -9, 153, -47, 115, -85, 77, -123, 39, -161, 1, 163, -37, 125, -75, 87, -113, 49, -151, 11, 173, -27, 135, -65, 97, -103, 59, -141, 21, -179, -17, 145, -55, 107, -93, 69, -131, 31, -169, -7, 155, -45, 117, -83, 79, -121, 41, -159, 3, 165, -35, 127, -73, 89, -111, 51, -149, 13, 175, -25, 137, -63, 99, -101, 61, -139, 23, -177, -15, 147, -53, 109, -91, -- (+44 chars; full line in the Zenodo source)
[-17, 147, -51, 113, -85, 79, -119, 45, -153, 11, 175, -23, 141, -57, 107, -91, 73, -125, 39, -159, 5, 169, -29, 135, -63, 101, -97, 67, -131, 33, -165, -1, 163, -35, 129, -69, 95, -103, 61, -137, 27, -171, -7, 157, -41, 123, -75, 89, -109, 55, -143, 21, -177, -13, 151, -47, 117, -81, 83, -115, 49, -149, 15, 179, -19, 145, -53, 111, -87, 77, -121, 43, -155, 9, 173, -25, 139, -59, 105, -93, 71, - -- (+42 chars; full line in the Zenodo source)
[-15, 151, -45, 121, -75, 91, -105, 61, -135, 31, -165, 1, 167, -29, 137, -59, 107, -89, 77, -119, 47, -149, 17, -179, -13, 153, -43, 123, -73, 93, -103, 63, -133, 33, -163, 3, 169, -27, 139, -57, 109, -87, 79, -117, 49, -147, 19, -177, -11, 155, -41, 125, -71, 95, -101, 65, -131, 35, -161, 5, 171, -25, 141, -55, 111, -85, 81, -115, 51, -145, 21, -175, -9, 157, -39, 127, -69, 97, -99, 67, -129, -- (+43 chars; full line in the Zenodo source)
[-13, 155, -39, 129, -65, 103, -91, 77, -117, 51, -143, 25, -169, -1, 167, -27, 141, -53, 115, -79, 89, -105, 63, -131, 37, -157, 11, 179, -15, 153, -41, 127, -67, 101, -93, 75, -119, 49, -145, 23, -171, -3, 165, -29, 139, -55, 113, -81, 87, -107, 61, -133, 35, -159, 9, 177, -17, 151, -43, 125, -69, 99, -95, 73, -121, 47, -147, 21, -173, -5, 163, -31, 137, -57, 111, -83, 85, -109, 59, -135, 33, -- (+43 chars; full line in the Zenodo source)
[-11, 159, -33, 137, -55, 115, -77, 93, -99, 71, -121, 49, -143, 27, -165, 5, 175, -17, 153, -39, 131, -61, 109, -83, 87, -105, 65, -127, 43, -149, 21, -171, -1, 169, -23, 147, -45, 125, -67, 103, -89, 81, -111, 59, -133, 37, -155, 15, -177, -7, 163, -29, 141, -51, 119, -73, 97, -95, 75, -117, 53, -139, 31, -161, 9, 179, -13, 157, -35, 135, -57, 113, -79, 91, -101, 69, -123, 47, -145, 25, -167, -- (+43 chars; full line in the Zenodo source)
[-9, 163, -27, 145, -45, 127, -63, 109, -81, 91, -99, 73, -117, 55, -135, 37, -153, 19, -171, 1, 173, -17, 155, -35, 137, -53, 119, -71, 101, -89, 83, -107, 65, -125, 47, -143, 29, -161, 11, -179, -7, 165, -25, 147, -43, 129, -61, 111, -79, 93, -97, 75, -115, 57, -133, 39, -151, 21, -169, 3, 175, -15, 157, -33, 139, -51, 121, -69, 103, -87, 85, -105, 67, -123, 49, -141, 31, -159, 13, -177, -5, 1 -- (+43 chars; full line in the Zenodo source)
[-7, 167, -21, 153, -35, 139, -49, 125, -63, 111, -77, 97, -91, 83, -105, 69, -119, 55, -133, 41, -147, 27, -161, 13, -175, -1, 173, -15, 159, -29, 145, -43, 131, -57, 117, -71, 103, -85, 89, -99, 75, -113, 61, -127, 47, -141, 33, -155, 19, -169, 5, 179, -9, 165, -23, 151, -37, 137, -51, 123, -65, 109, -79, 95, -93, 81, -107, 67, -121, 53, -135, 39, -149, 25, -163, 11, -177, -3, 171, -17, 157, - -- (+44 chars; full line in the Zenodo source)
[-5, 171, -15, 161, -25, 151, -35, 141, -45, 131, -55, 121, -65, 111, -75, 101, -85, 91, -95, 81, -105, 71, -115, 61, -125, 51, -135, 41, -145, 31, -155, 21, -165, 11, -175, 1, 177, -9, 167, -19, 157, -29, 147, -39, 137, -49, 127, -59, 117, -69, 107, -79, 97, -89, 87, -99, 77, -109, 67, -119, 57, -129, 47, -139, 37, -149, 27, -159, 17, -169, 7, -179, -3, 173, -13, 163, -23, 153, -33, 143, -43, 1 -- (+43 chars; full line in the Zenodo source)
[-3, 175, -9, 169, -15, 163, -21, 157, -27, 151, -33, 145, -39, 139, -45, 133, -51, 127, -57, 121, -63, 115, -69, 109, -75, 103, -81, 97, -87, 91, -93, 85, -99, 79, -105, 73, -111, 67, -117, 61, -123, 55, -129, 49, -135, 43, -141, 37, -147, 31, -153, 25, -159, 19, -165, 13, -171, 7, -177, 1, 179, -5, 173, -11, 167, -17, 161, -23, 155, -29, 149, -35, 143, -41, 137, -47, 131, -53, 125, -59, 119, - -- (+43 chars; full line in the Zenodo source)
[-1, 179, -3, 177, -5, 175, -7, 173, -9, 171, -11, 169, -13, 167, -15, 165, -17, 163, -19, 161, -21, 159, -23, 157, -25, 155, -27, 153, -29, 151, -31, 149, -33, 147, -35, 145, -37, 143, -39, 141, -41, 139, -43, 137, -45, 135, -47, 133, -49, 131, -51, 129, -53, 127, -55, 125, -57, 123, -59, 121, -61, 119, -63, 117, -65, 115, -67, 113, -69, 111, -71, 109, -73, 107, -75, 105, -77, 103, -79, 101, -8 -- (+43 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[-2300209069755768839540393008791, 7116458266933655610089613964412, 1100075401933743537711553242609, -7070503109153382649255145194884, -8201894584224914815095115946766, -6862634228992246973624875834388, -7897481583380285439740326980837, 7248511289838178755128988330688, -3744358968347041267514553778616, -10680386850222282922853834050888, -11133458526154908600049033178634, -58877080883386589951592 -- (+2696 chars; full line in the Zenodo source)
[7116458266933655610089613964412, -7070503109153382649255145194884, -6862634228992246973624875834388, 7248511289838178755128988330688, -10680386850222282922853834050888, -5887708088338658995159295217784, 1120954703475816169672390049859, -14972444296281201201710809080441, 1230841185041535890693328165812, -1584848567046598205361173304034, -14763888168653274690062461375312, -12787156951702189020956 -- (+2653 chars; full line in the Zenodo source)
[1100075401933743537711553242609, -6862634228992246973624875834388, -3744358968347041267514553778616, -5887708088338658995159295217784, -3874617184008186241490877494741, 1230841185041535890693328165812, -16456300468449749697238083039412, -1278715695170218902095615132012, -20160995480690032102501274649216, -4176001730399609027384570683563, -17750891311695452461240812887284, -106401998360407222417 -- (+2666 chars; full line in the Zenodo source)
[-7070503109153382649255145194884, 7248511289838178755128988330688, -5887708088338658995159295217784, -14972444296281201201710809080441, -1584848567046598205361173304034, -1278715695170218902095615132012, -13513127108276700877858424268513, -5847107359923248357618870952538, -10640199836040722241772094426559, -16705818113537711739545971182137, 3485452264006892586280195519934, -12644791994339006509 -- (+2668 chars; full line in the Zenodo source)
[-8201894584224914815095115946766, -10680386850222282922853834050888, -3874617184008186241490877494741, -1584848567046598205361173304034, -15686386554314273782581640623116, -4176001730399609027384570683563, -12502654190732408439327114699287, -16705818113537711739545971182137, -14092800628420291338915533747966, 412755775273133950398479576187, -20214886079594952732959623038659, -839151643338142181 -- (+2666 chars; full line in the Zenodo source)
[-6862634228992246973624875834388, -5887708088338658995159295217784, 1230841185041535890693328165812, -1278715695170218902095615132012, -4176001730399609027384570683563, -10640199836040722241772094426559, -9171607102352871036372571916741, -12644791994339006509419408742291, -3652031622443433451271708437113, -8391516433381421810258069918559, 1839020411391123596535295178363, -2475473883999172835326 -- (+2669 chars; full line in the Zenodo source)
[-7897481583380285439740326980837, 1120954703475816169672390049859, -16456300468449749697238083039412, -13513127108276700877858424268513, -12502654190732408439327114699287, -9171607102352871036372571916741, -21207884812825551516443197096209, -6424569071954100058387807722034, -10365160719500660514711555835612, -9511387434142790105658296788366, -18481654718104029825400266331888, 131850033405811482 -- (+2663 chars; full line in the Zenodo source)
[7248511289838178755128988330688, -14972444296281201201710809080441, -1278715695170218902095615132012, -5847107359923248357618870952538, -16705818113537711739545971182137, -12644791994339006509419408742291, -6424569071954100058387807722034, -5324343394833179548934957264609, -2475473883999172835326456095962, 8972089511577337094831588057959, -8692696062065097813754254347038, 1156223803744541631169 -- (+2667 chars; full line in the Zenodo source)
[-3744358968347041267514553778616, 1230841185041535890693328165812, -20160995480690032102501274649216, -10640199836040722241772094426559, -14092800628420291338915533747966, -3652031622443433451271708437113, -10365160719500660514711555835612, -2475473883999172835326456095962, -5743857891369399912337133849441, 6260117011453607978914069711262, 5543368300622233685437075637066, 1558101353343763220594 -- (+2666 chars; full line in the Zenodo source)
[-10680386850222282922853834050888, -1584848567046598205361173304034, -4176001730399609027384570683563, -16705818113537711739545971182137, 412755775273133950398479576187, -8391516433381421810258069918559, -9511387434142790105658296788366, 8972089511577337094831588057959, 6260117011453607978914069711262, 5743857891369399912337133849441, 20746265538808369616875460274988, 25835904834694423545661725 -- (+2663 chars; full line in the Zenodo source)
[-11133458526154908600049033178634, -14763888168653274690062461375312, -17750891311695452461240812887284, 3485452264006892586280195519934, -20214886079594952732959623038659, 1839020411391123596535295178363, -18481654718104029825400266331888, -8692696062065097813754254347038, 5543368300622233685437075637066, 20746265538808369616875460274988, 8391516433381421810258069918559, 2120788481282555151644 -- (+2664 chars; full line in the Zenodo source)
[-5887708088338658995159295217784, -1278715695170218902095615132012, -10640199836040722241772094426559, -12644791994339006509419408742291, -8391516433381421810258069918559, -2475473883999172835326456095962, 13185003340581148202208121905937, 11562238037445416311693525886037, 15581013533437632205947975743041, 25835904834694423545661725403663, 21207884812825551516443197096209, 258552698953595408352 -- (+2668 chars; full line in the Zenodo source)
[-9107284827006337544214043761066, -10197050202337291685872061172788, -15989353175066572181604540570791, -13242727736663633506194723583484, -12951012341821093738473946324041, 7274153469172877790820910771662, -6260117011453607978914069711262, 18481654718104029825400266331888, 5324343394833179548934957264609, 15341357086409470100710014312662, 7298102759744832156248581988141, 1568638655431427378258 -- (+2664 chars; full line in the Zenodo source)
[1120954703475816169672390049859, -13513127108276700877858424268513, -9171607102352871036372571916741, -6424569071954100058387807722034, -9511387434142790105658296788366, 13185003340581148202208121905937, 11261927261758470819687813923713, 12647494016280336712853184239613, 20214886079594952732959623038659, 19104577695274664580795728227687, 20160995480690032102501274649216, 91072848270063375442140 -- (+2664 chars; full line in the Zenodo source)
[-3874617184008186241490877494741, -4176001730399609027384570683563, -14092800628420291338915533747966, -8391516433381421810258069918559, -10579507906208558498309455811466, 6260117011453607978914069711262, 8978570818414676971286185132638, 25835904834694423545661725403663, 18485862348650560521637207113434, 22461742700478777867063771682762, 14972444296281201201710809080441, 23002090697557688395403 -- (+2668 chars; full line in the Zenodo source)
[-14972444296281201201710809080441, -5847107359923248357618870952538, -12644791994339006509419408742291, -5324343394833179548934957264609, 8972089511577337094831588057959, 11562238037445416311693525886037, 12647494016280336712853184239613, 17618911000361562087069544390013, 25855269895359540835263419336109, 16456300468449749697238083039412, 8201894584224914815095115946766, -1113345852615490860004 -- (+2664 chars; full line in the Zenodo source)
[-11611848222466215864824722905212, -14906830226693134345671866374766, -15341357086409470100710014312662, -1763109624664373260829517529513, -11562238037445416311693525886037, 10391375495993507519832552127259, 4319960470427248783808313034416, 14092800628420291338915533747966, 13513127108276700877858424268513, 11133458526154908600049033178634, -6862634228992246973624875834388, -4537712498517764926 -- (+2667 chars; full line in the Zenodo source)
[1230841185041535890693328165812, -10640199836040722241772094426559, -3652031622443433451271708437113, -2475473883999172835326456095962, 6260117011453607978914069711262, 15581013533437632205947975743041, 20214886079594952732959623038659, 25855269895359540835263419336109, 12920130228200662259798575553212, 2300209069755768839540393008791, -11611848222466215864824722905212, -12502654190732408439327 -- (+2665 chars; full line in the Zenodo source)
[-12920130228200662259798575553212, -7298102759744832156248581988141, -18064527354663312918441168511412, -8978570818414676971286185132638, -6852893073507611134227220813287, 23211240276643272917932852904009, 12644791994339006509419408742291, 10618612356822864148047544279966, 10680386850222282922853834050888, -3744358968347041267514553778616, -13513127108276700877858424268513, -2411295823245895656 -- (+2667 chars; full line in the Zenodo source)
[-1584848567046598205361173304034, -16705818113537711739545971182137, -8391516433381421810258069918559, 8972089511577337094831588057959, 5743857891369399912337133849441, 25835904834694423545661725403663, 19104577695274664580795728227687, 16456300468449749697238083039412, 2300209069755768839540393008791, -12920130228200662259798575553212, -15989353175066572181604540570791, -1879423116755410107787 -- (+2664 chars; full line in the Zenodo source)
[-16456300468449749697238083039412, -9171607102352871036372571916741, -10365160719500660514711555835612, 13185003340581148202208121905937, 8978570818414676971286185132638, 20214886079594952732959623038659, 14906830226693134345671866374766, 9107284827006337544214043761066, 7248511289838178755128988330688, -10618612356822864148047544279966, 412755775273133950398479576187, -207462655388083696168754 -- (+2663 chars; full line in the Zenodo source)
[-14763888168653274690062461375312, 3485452264006892586280195519934, 1839020411391123596535295178363, -8692696062065097813754254347038, 20746265538808369616875460274988, 21207884812825551516443197096209, 20160995480690032102501274649216, 8201894584224914815095115946766, -11611848222466215864824722905212, -15989353175066572181604540570791, -25835904834694423545661725403663, -112619272617584708196 -- (+2665 chars; full line in the Zenodo source)
[-4537712498517764926646924778813, -18485862348650560521637207113434, -12647494016280336712853184239613, 9744039414927216593952127502788, -1839020411391123596535295178363, 22580255018674206702064819066791, 1584848567046598205361173304034, 1100075401933743537711553242609, -10197050202337291685872061172788, -21207884812825551516443197096209, -2475473883999172835326456095962, -685289307350761113422 -- (+2667 chars; full line in the Zenodo source)
[-1278715695170218902095615132012, -12644791994339006509419408742291, -2475473883999172835326456095962, 11562238037445416311693525886037, 25835904834694423545661725403663, 25855269895359540835263419336109, 9107284827006337544214043761066, -11133458526154908600049033178634, -12502654190732408439327114699287, -18794231167554101077879134014891, -11261927261758470819687813923713, -222563317148506720 -- (+2665 chars; full line in the Zenodo source)
[-15686386554314273782581640623116, 412755775273133950398479576187, -10579507906208558498309455811466, 5743857891369399912337133849441, 6424569071954100058387807722034, 22461742700478777867063771682762, 6862634228992246973624875834388, -12920130228200662259798575553212, 3485452264006892586280195519934, -12647494016280336712853184239613, 12319065762995152963555925382066, 4319960470427248783808313 -- (+2664 chars; full line in the Zenodo source)
[-10197050202337291685872061172788, -13242727736663633506194723583484, 7274153469172877790820910771662, 18481654718104029825400266331888, 15341357086409470100710014312662, 15686386554314273782581640623116, -2300209069755768839540393008791, -20160995480690032102501274649216, -17618911000361562087069544390013, -10391375495993507519832552127259, 8978570818414676971286185132638, -4127557752731339503 -- (+2669 chars; full line in the Zenodo source)
[-20160995480690032102501274649216, -3652031622443433451271708437113, -5743857891369399912337133849441, 15581013533437632205947975743041, 18485862348650560521637207113434, 12920130228200662259798575553212, 7248511289838178755128988330688, -12502654190732408439327114699287, -4319960470427248783808313034416, -9744039414927216593952127502788, 12951012341821093738473946324041, 7298102759744832156248 -- (+2666 chars; full line in the Zenodo source)
[-13513127108276700877858424268513, -6424569071954100058387807722034, 13185003340581148202208121905937, 12647494016280336712853184239613, 19104577695274664580795728227687, 9107284827006337544214043761066, -3874617184008186241490877494741, -22580255018674206702064819066791, -20746265538808369616875460274988, 5543368300622233685437075637066, 3652031622443433451271708437113, 10197050202337291685872 -- (+2667 chars; full line in the Zenodo source)
[-10618612356822864148047544279966, -13638258583960612793851349474113, -12319065762995152963555925382066, 12951012341821093738473946324041, 10640199836040722241772094426559, 7897481583380285439740326980837, -14763888168653274690062461375312, -15341357086409470100710014312662, 8972089511577337094831588057959, 2475473883999172835326456095962, 22580255018674206702064819066791, -11209547034758161696 -- (+2664 chars; full line in the Zenodo source)
[-4176001730399609027384570683563, -8391516433381421810258069918559, 6260117011453607978914069711262, 25835904834694423545661725403663, 22461742700478777867063771682762, 2300209069755768839540393008791, -10618612356822864148047544279966, -18794231167554101077879134014891, -9744039414927216593952127502788, 4319960470427248783808313034416, 5847107359923248357618870952538, -711645826693365561008961 -- (+2665 chars; full line in the Zenodo source)
[-22461742700478777867063771682762, -4319960470427248783808313034416, 8692696062065097813754254347038, 18064527354663312918441168511412, 10197050202337291685872061172788, -8201894584224914815095115946766, -10640199836040722241772094426559, -23211240276643272917932852904009, 11261927261758470819687813923713, 13242727736663633506194723583484, 16456300468449749697238083039412, -10680386850222282922 -- (+2665 chars; full line in the Zenodo source)
[-5847107359923248357618870952538, -5324343394833179548934957264609, 11562238037445416311693525886037, 17618911000361562087069544390013, 16456300468449749697238083039412, -11133458526154908600049033178634, -22580255018674206702064819066791, -10579507906208558498309455811466, -2225633171485067207497849391138, 9171607102352871036372571916741, 10680386850222282922853834050888, -14763888168653274690 -- (+2665 chars; full line in the Zenodo source)
[-17750891311695452461240812887284, 1839020411391123596535295178363, 5543368300622233685437075637066, 21207884812825551516443197096209, 14972444296281201201710809080441, -11611848222466215864824722905212, 412755775273133950398479576187, -11261927261758470819687813923713, 12951012341821093738473946324041, 5847107359923248357618870952538, -2300209069755768839540393008791, -149068302266931343456718 -- (+2664 chars; full line in the Zenodo source)
[-14906830226693134345671866374766, -1763109624664373260829517529513, 10391375495993507519832552127259, 14092800628420291338915533747966, 11133458526154908600049033178634, -4537712498517764926646924778813, -18064527354663312918441168511412, -6260117011453607978914069711262, 6424569071954100058387807722034, 14763888168653274690062461375312, -5887708088338658995159295217784, -184858623486505605216 -- (+2666 chars; full line in the Zenodo source)
[-12502654190732408439327114699287, -9511387434142790105658296788366, 8978570818414676971286185132638, 19104577695274664580795728227687, 6862634228992246973624875834388, -10618612356822864148047544279966, -5324343394833179548934957264609, 5543368300622233685437075637066, 24112958232458956563101024760938, 5887708088338658995159295217784, -4537712498517764926646924778813, -136382585839606127938513 -- (+2667 chars; full line in the Zenodo source)
[-10640199836040722241772094426559, -2475473883999172835326456095962, 15581013533437632205947975743041, 25855269895359540835263419336109, 2300209069755768839540393008791, -12502654190732408439327114699287, -20746265538808369616875460274988, -2225633171485067207497849391138, 7298102759744832156248581988141, -7116458266933655610089613964412, -14906830226693134345671866374766, -95113874341427901056 -- (+2668 chars; full line in the Zenodo source)
[-25855269895359540835263419336109, 2225633171485067207497849391138, 9511387434142790105658296788366, 17750891311695452461240812887284, -7070503109153382649255145194884, -19104577695274664580795728227687, 7274153469172877790820910771662, -1839020411391123596535295178363, 10618612356822864148047544279966, 7248511289838178755128988330688, -14092800628420291338915533747966, -55433683006222336854370 -- (+2666 chars; full line in the Zenodo source)
[-7298102759744832156248581988141, -8978570818414676971286185132638, 23211240276643272917932852904009, 10618612356822864148047544279966, -3744358968347041267514553778616, -24112958232458956563101024760938, -11562238037445416311693525886037, 13638258583960612793851349474113, 1584848567046598205361173304034, 1230841185041535890693328165812, -6424569071954100058387807722034, 12319065762995152963555 -- (+2666 chars; full line in the Zenodo source)
[-15989353175066572181604540570791, 7274153469172877790820910771662, 5324343394833179548934957264609, 15686386554314273782581640623116, 1120954703475816169672390049859, -17618911000361562087069544390013, 9744039414927216593952127502788, -412755775273133950398479576187, 11133458526154908600049033178634, -13513127108276700877858424268513, -23211240276643272917932852904009, 105795079062085584983094 -- (+2668 chars; full line in the Zenodo source)
[-16705818113537711739545971182137, 8972089511577337094831588057959, 25835904834694423545661725403663, 16456300468449749697238083039412, -12920130228200662259798575553212, -18794231167554101077879134014891, 5543368300622233685437075637066, 9171607102352871036372571916741, -7116458266933655610089613964412, -7298102759744832156248581988141, 7274153469172877790820910771662, 103651607195006605147115 -- (+2669 chars; full line in the Zenodo source)
[-19104577695274664580795728227687, -5543368300622233685437075637066, 13638258583960612793851349474113, 11611848222466215864824722905212, -1278715695170218902095615132012, -12951012341821093738473946324041, 10579507906208558498309455811466, 14906830226693134345671866374766, -7897481583380285439740326980837, -12644791994339006509419408742291, -9744039414927216593952127502788, 15341357086409470100 -- (+2667 chars; full line in the Zenodo source)
[-9171607102352871036372571916741, 13185003340581148202208121905937, 20214886079594952732959623038659, 9107284827006337544214043761066, -10618612356822864148047544279966, -20746265538808369616875460274988, 1763109624664373260829517529513, 10197050202337291685872061172788, -14972444296281201201710809080441, -13638258583960612793851349474113, 5743857891369399912337133849441, 1598935317506657218160 -- (+2662 chars; full line in the Zenodo source)
[-22580255018674206702064819066791, 6852893073507611134227220813287, 13242727736663633506194723583484, 3744358968347041267514553778616, -14906830226693134345671866374766, -18481654718104029825400266331888, 25835904834694423545661725403663, -1230841185041535890693328165812, -15686386554314273782581640623116, -1763109624664373260829517529513, 9511387434142790105658296788366, 2016099548069003210250 -- (+2662 chars; full line in the Zenodo source)
[3485452264006892586280195519934, -8692696062065097813754254347038, 21207884812825551516443197096209, 8201894584224914815095115946766, -15989353175066572181604540570791, -11261927261758470819687813923713, 3652031622443433451271708437113, 10680386850222282922853834050888, -14906830226693134345671866374766, 7274153469172877790820910771662, 18794231167554101077879134014891, 387461718400818624149087 -- (+2664 chars; full line in the Zenodo source)
[-14092800628420291338915533747966, 6260117011453607978914069711262, 18485862348650560521637207113434, 2300209069755768839540393008791, 3485452264006892586280195519934, -9744039414927216593952127502788, 24112958232458956563101024760938, -7116458266933655610089613964412, -22580255018674206702064819066791, -8692696062065097813754254347038, 12644791994339006509419408742291, -11000754019337435377115 -- (+2666 chars; full line in the Zenodo source)
[-18485862348650560521637207113434, 9744039414927216593952127502788, 22580255018674206702064819066791, 1100075401933743537711553242609, -21207884812825551516443197096209, -6852893073507611134227220813287, 16705818113537711739545971182137, -6862634228992246973624875834388, -13242727736663633506194723583484, 11261927261758470819687813923713, 25855269895359540835263419336109, -374435896834704126751 -- (+2666 chars; full line in the Zenodo source)
[-24112958232458956563101024760938, 12319065762995152963555925382066, 16705818113537711739545971182137, -7897481583380285439740326980837, -3652031622443433451271708437113, -8972089511577337094831588057959, 17750891311695452461240812887284, 1120954703475816169672390049859, -25835904834694423545661725403663, 15581013533437632205947975743041, 10197050202337291685872061172788, -164563004684497496972 -- (+2667 chars; full line in the Zenodo source)
[-12644791994339006509419408742291, 11562238037445416311693525886037, 25855269895359540835263419336109, -11133458526154908600049033178634, -18794231167554101077879134014891, -2225633171485067207497849391138, 10197050202337291685872061172788, -14763888168653274690062461375312, -9511387434142790105658296788366, 10365160719500660514711555835612, 3874617184008186241490877494741, -1775089131169545246 -- (+2660 chars; full line in the Zenodo source)
[-21207884812825551516443197096209, 11261927261758470819687813923713, 14906830226693134345671866374766, -3874617184008186241490877494741, -5324343394833179548934957264609, 1763109624664373260829517529513, 12920130228200662259798575553212, -4176001730399609027384570683563, -10391375495993507519832552127259, 17618911000361562087069544390013, 7070503109153382649255145194884, -1409280062842029133891 -- (+2660 chars; full line in the Zenodo source)
[412755775273133950398479576187, 5743857891369399912337133849441, 22461742700478777867063771682762, -12920130228200662259798575553212, -12647494016280336712853184239613, 4319960470427248783808313034416, 5887708088338658995159295217784, -7298102759744832156248581988141, -8692696062065097813754254347038, 22580255018674206702064819066791, -7897481583380285439740326980837, -1806452735466331291844116 -- (+2663 chars; full line in the Zenodo source)
[-15341357086409470100710014312662, 10391375495993507519832552127259, 13513127108276700877858424268513, -4537712498517764926646924778813, 2225633171485067207497849391138, 6424569071954100058387807722034, 8201894584224914815095115946766, -18485862348650560521637207113434, -13185003340581148202208121905937, 17750891311695452461240812887284, 1230841185041535890693328165812, -12647494016280336712853 -- (+2663 chars; full line in the Zenodo source)
[-13242727736663633506194723583484, 18481654718104029825400266331888, 15686386554314273782581640623116, -20160995480690032102501274649216, -10391375495993507519832552127259, -412755775273133950398479576187, 7116458266933655610089613964412, -3652031622443433451271708437113, 10579507906208558498309455811466, 4537712498517764926646924778813, -10618612356822864148047544279966, -574385789136939991233 -- (+2666 chars; full line in the Zenodo source)
[-17618911000361562087069544390013, 10579507906208558498309455811466, 14763888168653274690062461375312, -22461742700478777867063771682762, 13185003340581148202208121905937, -3485452264006892586280195519934, -3744358968347041267514553778616, -4319960470427248783808313034416, -1839020411391123596535295178363, 9107284827006337544214043761066, -16705818113537711739545971182137, 869269606206509781375 -- (+2665 chars; full line in the Zenodo source)
[-3652031622443433451271708437113, 15581013533437632205947975743041, 12920130228200662259798575553212, -12502654190732408439327114699287, -9744039414927216593952127502788, 7298102759744832156248581988141, -14972444296281201201710809080441, -9511387434142790105658296788366, 18064527354663312918441168511412, -1100075401933743537711553242609, -15341357086409470100710014312662, 897857081841467697128 -- (+2667 chars; full line in the Zenodo source)
[-20214886079594952732959623038659, 20746265538808369616875460274988, 14972444296281201201710809080441, -15989353175066572181604540570791, 12319065762995152963555925382066, 5847107359923248357618870952538, -4537712498517764926646924778813, 7274153469172877790820910771662, 12644791994339006509419408742291, -7897481583380285439740326980837, -4319960470427248783808313034416, 53243433948331795489349 -- (+2666 chars; full line in the Zenodo source)
[-6424569071954100058387807722034, 12647494016280336712853184239613, 9107284827006337544214043761066, -22580255018674206702064819066791, 5543368300622233685437075637066, 10197050202337291685872061172788, -4176001730399609027384570683563, 6852893073507611134227220813287, 15989353175066572181604540570791, -11611848222466215864824722905212, -15581013533437632205947975743041, 13242727736663633506194 -- (+2666 chars; full line in the Zenodo source)
[-18064527354663312918441168511412, 23211240276643272917932852904009, 10680386850222282922853834050888, -24112958232458956563101024760938, 18481654718104029825400266331888, 1584848567046598205361173304034, -25855269895359540835263419336109, 12319065762995152963555925382066, 4176001730399609027384570683563, -20160995480690032102501274649216, 13185003340581148202208121905937, 167058181135377117395 -- (+2665 chars; full line in the Zenodo source)
[-13638258583960612793851349474113, 12951012341821093738473946324041, 7897481583380285439740326980837, -15341357086409470100710014312662, 2475473883999172835326456095962, -1120954703475816169672390049859, 3485452264006892586280195519934, 10391375495993507519832552127259, 16456300468449749697238083039412, -25855269895359540835263419336109, -6852893073507611134227220813287, 13513127108276700877858 -- (+2663 chars; full line in the Zenodo source)
[-18794231167554101077879134014891, 10365160719500660514711555835612, 7070503109153382649255145194884, -20214886079594952732959623038659, 23211240276643272917932852904009, -7248511289838178755128988330688, -15341357086409470100710014312662, 20746265538808369616875460274988, 5887708088338658995159295217784, -24112958232458956563101024760938, 10579507906208558498309455811466, 149724442962812012017 -- (+2660 chars; full line in the Zenodo source)
[-8391516433381421810258069918559, 25835904834694423545661725403663, 2300209069755768839540393008791, -18794231167554101077879134014891, 4319960470427248783808313034416, -7116458266933655610089613964412, -13638258583960612793851349474113, 10365160719500660514711555835612, -1100075401933743537711553242609, -18064527354663312918441168511412, 5324343394833179548934957264609, 70705031091533826492551 -- (+2660 chars; full line in the Zenodo source)
[-25835904834694423545661725403663, 18794231167554101077879134014891, 7116458266933655610089613964412, -10365160719500660514711555835612, 18064527354663312918441168511412, -7070503109153382649255145194884, -12951012341821093738473946324041, 20214886079594952732959623038659, -6862634228992246973624875834388, -23211240276643272917932852904009, 17618911000361562087069544390013, 72485112898381787551 -- (+2667 chars; full line in the Zenodo source)
[-4319960470427248783808313034416, 18064527354663312918441168511412, -8201894584224914815095115946766, -23211240276643272917932852904009, 13242727736663633506194723583484, -10680386850222282922853834050888, -2475473883999172835326456095962, 24112958232458956563101024760938, -3874617184008186241490877494741, -18481654718104029825400266331888, 9171607102352871036372571916741, -15848485670465982053 -- (+2668 chars; full line in the Zenodo source)
[-10365160719500660514711555835612, 20214886079594952732959623038659, 7248511289838178755128988330688, -20746265538808369616875460274988, 24112958232458956563101024760938, -14972444296281201201710809080441, -10391375495993507519832552127259, 15989353175066572181604540570791, -1278715695170218902095615132012, -12319065762995152963555925382066, 22461742700478777867063771682762, -584710735992324835 -- (+2663 chars; full line in the Zenodo source)
[-5324343394833179548934957264609, 17618911000361562087069544390013, -11133458526154908600049033178634, -10579507906208558498309455811466, 9171607102352871036372571916741, -14763888168653274690062461375312, 6852893073507611134227220813287, 22461742700478777867063771682762, -17750891311695452461240812887284, -13185003340581148202208121905937, 1584848567046598205361173304034, 348545226400689258628 -- (+2664 chars; full line in the Zenodo source)
[-12951012341821093738473946324041, 15341357086409470100710014312662, 1120954703475816169672390049859, -10391375495993507519832552127259, 25855269895359540835263419336109, -13513127108276700877858424268513, 8692696062065097813754254347038, 4537712498517764926646924778813, -9171607102352871036372571916741, -2225633171485067207497849391138, 3744358968347041267514553778616, -64245690719541000583878 -- (+2666 chars; full line in the Zenodo source)
[1839020411391123596535295178363, 21207884812825551516443197096209, -11611848222466215864824722905212, -11261927261758470819687813923713, 5847107359923248357618870952538, -14906830226693134345671866374766, 5743857891369399912337133849441, 3874617184008186241490877494741, -15341357086409470100710014312662, 5324343394833179548934957264609, 7116458266933655610089613964412, -176310962466437326082951 -- (+2663 chars; full line in the Zenodo source)
[-23211240276643272917932852904009, 24112958232458956563101024760938, -1584848567046598205361173304034, -12319065762995152963555925382066, 20160995480690032102501274649216, -16705818113537711739545971182137, -2225633171485067207497849391138, 7897481583380285439740326980837, -8391516433381421810258069918559, 3652031622443433451271708437113, -9107284827006337544214043761066, 8972089511577337094831 -- (+2664 chars; full line in the Zenodo source)
[-1763109624664373260829517529513, 14092800628420291338915533747966, -4537712498517764926646924778813, -6260117011453607978914069711262, 14763888168653274690062461375312, -18485862348650560521637207113434, 23211240276643272917932852904009, -2300209069755768839540393008791, -12647494016280336712853184239613, -3485452264006892586280195519934, -1278715695170218902095615132012, 974403941492721659395 -- (+2667 chars; full line in the Zenodo source)
[-12647494016280336712853184239613, 22580255018674206702064819066791, -10197050202337291685872061172788, -6852893073507611134227220813287, 11611848222466215864824722905212, -13242727736663633506194723583484, 8391516433381421810258069918559, -3744358968347041267514553778616, 7274153469172877790820910771662, 14906830226693134345671866374766, -12502654190732408439327114699287, 184816547181040298254 -- (+2667 chars; full line in the Zenodo source)
[-9511387434142790105658296788366, 19104577695274664580795728227687, -10618612356822864148047544279966, 5543368300622233685437075637066, 5887708088338658995159295217784, -13638258583960612793851349474113, 17618911000361562087069544390013, -11611848222466215864824722905212, -12319065762995152963555925382066, 1278715695170218902095615132012, -18485862348650560521637207113434, 129510123418210937384 -- (+2664 chars; full line in the Zenodo source)
[-20746265538808369616875460274988, 15989353175066572181604540570791, -5847107359923248357618870952538, -7274153469172877790820910771662, 7897481583380285439740326980837, -5324343394833179548934957264609, 18485862348650560521637207113434, -15686386554314273782581640623116, 11562238037445416311693525886037, -1120954703475816169672390049859, -18064527354663312918441168511412, 176189110003615620870 -- (+2667 chars; full line in the Zenodo source)
[-2475473883999172835326456095962, 25855269895359540835263419336109, -12502654190732408439327114699287, -2225633171485067207497849391138, -7116458266933655610089613964412, -9511387434142790105658296788366, 15989353175066572181604540570791, -17750891311695452461240812887284, 8978570818414676971286185132638, 7070503109153382649255145194884, -1763109624664373260829517529513, 19104577695274664580795 -- (+2671 chars; full line in the Zenodo source)
[-15581013533437632205947975743041, 12502654190732408439327114699287, -7298102759744832156248581988141, 9511387434142790105658296788366, 1100075401933743537711553242609, -8978570818414676971286185132638, 5847107359923248357618870952538, -19104577695274664580795728227687, 23211240276643272917932852904009, -6862634228992246973624875834388, -10391375495993507519832552127259, 10618612356822864148047 -- (+2668 chars; full line in the Zenodo source)
[2225633171485067207497849391138, 17750891311695452461240812887284, -19104577695274664580795728227687, -1839020411391123596535295178363, 7248511289838178755128988330688, -5543368300622233685437075637066, 15686386554314273782581640623116, -21207884812825551516443197096209, 13638258583960612793851349474113, -14972444296281201201710809080441, 6260117011453607978914069711262, 11611848222466215864824 -- (+2669 chars; full line in the Zenodo source)
[-10579507906208558498309455811466, 22461742700478777867063771682762, 3485452264006892586280195519934, 4319960470427248783808313034416, -9107284827006337544214043761066, -8692696062065097813754254347038, -1230841185041535890693328165812, -18064527354663312918441168511412, 21207884812825551516443197096209, -10197050202337291685872061172788, -8972089511577337094831588057959, 8201894584224914815095 -- (+2664 chars; full line in the Zenodo source)
[-8978570818414676971286185132638, 10618612356822864148047544279966, -24112958232458956563101024760938, 13638258583960612793851349474113, 1230841185041535890693328165812, 12319065762995152963555925382066, 11133458526154908600049033178634, -12951012341821093738473946324041, 16705818113537711739545971182137, -10640199836040722241772094426559, 12647494016280336712853184239613, -78974815833802854397 -- (+2663 chars; full line in the Zenodo source)
[-18481654718104029825400266331888, 20160995480690032102501274649216, 412755775273133950398479576187, 3652031622443433451271708437113, -4537712498517764926646924778813, 5743857891369399912337133849441, 7070503109153382649255145194884, -15581013533437632205947975743041, 22461742700478777867063771682762, -18485862348650560521637207113434, 13638258583960612793851349474113, -129201302282006622597985 -- (+2665 chars; full line in the Zenodo source)
[7274153469172877790820910771662, 15686386554314273782581640623116, -17618911000361562087069544390013, -412755775273133950398479576187, -13513127108276700877858424268513, 10579507906208558498309455811466, 1100075401933743537711553242609, -5743857891369399912337133849441, 14763888168653274690062461375312, -6424569071954100058387807722034, 24112958232458956563101024760938, -22461742700478777867063 -- (+2661 chars; full line in the Zenodo source)
[-10391375495993507519832552127259, 4537712498517764926646924778813, -6424569071954100058387807722034, 18485862348650560521637207113434, -17750891311695452461240812887284, 12647494016280336712853184239613, -10680386850222282922853834050888, -9744039414927216593952127502788, 9107284827006337544214043761066, 1839020411391123596535295178363, 10640199836040722241772094426559, -2258025501867420670206 -- (+2660 chars; full line in the Zenodo source)
[8972089511577337094831588057959, 16456300468449749697238083039412, -18794231167554101077879134014891, 9171607102352871036372571916741, -7298102759744832156248581988141, 10365160719500660514711555835612, -11611848222466215864824722905212, -13185003340581148202208121905937, 7070503109153382649255145194884, -8978570818414676971286185132638, 15686386554314273782581640623116, -2021488607959495273295 -- (+2666 chars; full line in the Zenodo source)
[-5743857891369399912337133849441, 12920130228200662259798575553212, -4319960470427248783808313034416, 7298102759744832156248581988141, -22580255018674206702064819066791, 18064527354663312918441168511412, -1278715695170218902095615132012, 8978570818414676971286185132638, -8201894584224914815095115946766, 6852893073507611134227220813287, -1120954703475816169672390049859, -232112402766432729179328 -- (+2670 chars; full line in the Zenodo source)
[-5543368300622233685437075637066, 11611848222466215864824722905212, -12951012341821093738473946324041, 14906830226693134345671866374766, -12644791994339006509419408742291, 15341357086409470100710014312662, -22461742700478777867063771682762, 1763109624664373260829517529513, 1120954703475816169672390049859, 11562238037445416311693525886037, -1100075401933743537711553242609, -103913754959935075198 -- (+2662 chars; full line in the Zenodo source)
[-11261927261758470819687813923713, 3874617184008186241490877494741, -1763109624664373260829517529513, 4176001730399609027384570683563, -17618911000361562087069544390013, 14092800628420291338915533747966, -7298102759744832156248581988141, 8391516433381421810258069918559, -4537712498517764926646924778813, 10579507906208558498309455811466, 7248511289838178755128988330688, -626011701145360797891406 -- (+2665 chars; full line in the Zenodo source)
[13185003340581148202208121905937, 9107284827006337544214043761066, -20746265538808369616875460274988, 10197050202337291685872061172788, -13638258583960612793851349474113, 15989353175066572181604540570791, -14092800628420291338915533747966, 13242727736663633506194723583484, -5847107359923248357618870952538, 12951012341821093738473946324041, -12920130228200662259798575553212, -7274153469172877790 -- (+2669 chars; full line in the Zenodo source)
[-11562238037445416311693525886037, 11133458526154908600049033178634, 2225633171485067207497849391138, 14763888168653274690062461375312, -10365160719500660514711555835612, 17750891311695452461240812887284, -13242727736663633506194723583484, -3485452264006892586280195519934, -19104577695274664580795728227687, 20214886079594952732959623038659, -4176001730399609027384570683563, -1839020411391123596 -- (+2667 chars; full line in the Zenodo source)
[6852893073507611134227220813287, 3744358968347041267514553778616, -18481654718104029825400266331888, -1230841185041535890693328165812, -1763109624664373260829517529513, 20160995480690032102501274649216, -18794231167554101077879134014891, 10640199836040722241772094426559, 412755775273133950398479576187, 14092800628420291338915533747966, -19104577695274664580795728227687, 365203162244343345127170 -- (+2667 chars; full line in the Zenodo source)
[-12319065762995152963555925382066, 7897481583380285439740326980837, 8972089511577337094831588057959, -1120954703475816169672390049859, -15581013533437632205947975743041, 16456300468449749697238083039412, 1839020411391123596535295178363, 13513127108276700877858424268513, -18794231167554101077879134014891, 12502654190732408439327114699287, -13242727736663633506194723583484, 9171607102352871036372 -- (+2666 chars; full line in the Zenodo source)
[-8692696062065097813754254347038, 8201894584224914815095115946766, -11261927261758470819687813923713, 10680386850222282922853834050888, 7274153469172877790820910771662, 3874617184008186241490877494741, -15581013533437632205947975743041, 1584848567046598205361173304034, -1763109624664373260829517529513, 15686386554314273782581640623116, -10365160719500660514711555835612, 417600173039960902738457 -- (+2663 chars; full line in the Zenodo source)
[-9744039414927216593952127502788, -1100075401933743537711553242609, 6852893073507611134227220813287, 6862634228992246973624875834388, -11261927261758470819687813923713, 3744358968347041267514553778616, 8972089511577337094831588057959, 5887708088338658995159295217784, -18481654718104029825400266331888, 3874617184008186241490877494741, 2225633171485067207497849391138, -123084118504153589069332816 -- (+2663 chars; full line in the Zenodo source)
[6260117011453607978914069711262, 2300209069755768839540393008791, -9744039414927216593952127502788, -7116458266933655610089613964412, -8692696062065097813754254347038, -1100075401933743537711553242609, -12319065762995152963555925382066, 7070503109153382649255145194884, 6852893073507611134227220813287, 8201894584224914815095115946766, -11562238037445416311693525886037, 68626342289922469736248758 -- (+2663 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 90).map (fun t => rowA (180 + 1) t (rng 1 90)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 90 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 90 B A = sid 76534676305495490094395631557344250 90 := rfl
theorem d_ne : (76534676305495490094395631557344250 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 90 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 90) (h0 : mv A g = zeros 90) : g = zeros 90 :=
kernel_zero 90 76534676305495490094395631557344250 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 180 90 = true := rfl
/-- **Balanced ⇒ pairs for p = 181.** A list with entries in (0, 181) that is balanced for 1 ≤ t ≤ 90
has as many copies of x as of 181 − x for every 1 ≤ x ≤ 90 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 181)
(hb : ∀ t, 1 ≤ t → t < 1 + 90 → tsum 181 t c + tsum 181 t c = c.length * 181) :
(rng 1 90).all (fun x => Nat.beq (cnt x c) (cnt (181 - x) c)) = true :=
pairs_of_bal 180 90 76534676305495490094395631557344250 d_ne A B len cert A_def delta c hr hb
end MailletCert181
#print axioms MailletCert181.A_def
#print axioms MailletCert181.len
#print axioms MailletCert181.cert
#print axioms MailletCert181.d_ne
#print axioms MailletCert181.kernel
#print axioms MailletCert181.delta
#print axioms MailletCert181.pairs
lean_all/hodge/MailletCert19.lean
/-
hodge/MailletCert19.lean — T41 (goals G849b, G849c): for p = 19 the 9 × 9 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 9)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 38 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 19) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert19
open MailletLin MailletBridge
def A : List (List Int) := [
[-17, -15, -13, -11, -9, -7, -5, -3, -1],
[-15, -11, -7, -3, 1, 5, 9, 13, 17],
[-13, -7, -1, 5, 11, 17, -15, -9, -3],
[-11, -3, 5, 13, -17, -9, -1, 7, 15],
[-9, 1, 11, -17, -7, 3, 13, -15, -5],
[-7, 5, 17, -9, 3, 15, -11, 1, 13],
[-5, 9, -15, -1, 13, -11, 3, 17, -7],
[-3, 13, -9, 7, -15, 1, 17, -5, 11],
[-1, 17, -3, 15, -5, 13, -7, 11, -9]]
def B : List (List Int) := [
[0, 0, -1, -1, -1, 0, -1, 0, 0],
[0, -1, 0, 0, 0, 1, 1, 1, 0],
[-1, 0, 0, 1, 1, 0, 0, -1, 0],
[-1, 0, 1, 1, 0, -1, 0, 0, 0],
[-1, 0, 1, 0, 0, 0, 1, 0, -1],
[0, 1, 0, -1, 0, 0, -1, 0, 1],
[-1, 1, 0, 0, 1, -1, 0, 0, 0],
[0, 1, -1, 0, 0, 0, 0, -1, 1],
[0, 0, 0, 0, -1, 1, 0, 1, -1]]
theorem A_def : A = (rng 1 9).map (fun t => rowA (18 + 1) t (rng 1 9)) := rfl
theorem len : allLen 9 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 9 B A = sid 38 9 := rfl
theorem d_ne : (38 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 9 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 9) (h0 : mv A g = zeros 9) : g = zeros 9 :=
kernel_zero 9 38 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 18 9 = true := rfl
/-- **Balanced ⇒ pairs for p = 19.** A list with entries in (0, 19) that is balanced for 1 ≤ t ≤ 9
has as many copies of x as of 19 − x for every 1 ≤ x ≤ 9 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 19)
(hb : ∀ t, 1 ≤ t → t < 1 + 9 → tsum 19 t c + tsum 19 t c = c.length * 19) :
(rng 1 9).all (fun x => Nat.beq (cnt x c) (cnt (19 - x) c)) = true :=
pairs_of_bal 18 9 38 d_ne A B len cert A_def delta c hr hb
end MailletCert19
#print axioms MailletCert19.A_def
#print axioms MailletCert19.len
#print axioms MailletCert19.cert
#print axioms MailletCert19.d_ne
#print axioms MailletCert19.kernel
#print axioms MailletCert19.delta
#print axioms MailletCert19.pairs
lean_all/hodge/MailletCert191.lean
/-
hodge/MailletCert191.lean — T41 (goals G849b, G849c): for p = 191 the 95 × 95 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 95)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 63033195616119436767333267526887206138 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 191) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert191
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-189, -187, -185, -183, -181, -179, -177, -175, -173, -171, -169, -167, -165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, -51, -4 -- (+118 chars; full line in the Zenodo source)
[-187, -183, -179, -175, -171, -167, -163, -159, -155, -151, -147, -143, -139, -135, -131, -127, -123, -119, -115, -111, -107, -103, -99, -95, -91, -87, -83, -79, -75, -71, -67, -63, -59, -55, -51, -47, -43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, -- (+70 chars; full line in the Zenodo source)
[-185, -179, -173, -167, -161, -155, -149, -143, -137, -131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 169, 175, 181, 187, -189, -183, -177, -171, -165, -159, -153, -147, -141, -135, -129, -123, -117, -111, -10 -- (+86 chars; full line in the Zenodo source)
[-183, -175, -167, -159, -151, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145, 153, 161, 169, 177, 185, -189, -181, -173, -165, -157, -149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 7 -- (+70 chars; full line in the Zenodo source)
[-181, -171, -161, -151, -141, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, 159, 169, 179, 189, -183, -173, -163, -153, -143, -133, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, 177, 187, -185, -175, -165, -155, -- (+80 chars; full line in the Zenodo source)
[-179, -167, -155, -143, -131, -119, -107, -95, -83, -71, -59, -47, -35, -23, -11, 1, 13, 25, 37, 49, 61, 73, 85, 97, 109, 121, 133, 145, 157, 169, 181, -189, -177, -165, -153, -141, -129, -117, -105, -93, -81, -69, -57, -45, -33, -21, -9, 3, 15, 27, 39, 51, 63, 75, 87, 99, 111, 123, 135, 147, 159, 171, 183, -187, -175, -163, -151, -139, -127, -115, -103, -91, -79, -67, -55, -43, -31, -19, -7, 5 -- (+70 chars; full line in the Zenodo source)
[-177, -163, -149, -135, -121, -107, -93, -79, -65, -51, -37, -23, -9, 5, 19, 33, 47, 61, 75, 89, 103, 117, 131, 145, 159, 173, 187, -181, -167, -153, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, 169, 183, -185, -171, -157, -143, -129, -115, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, 123, 137, 151, 165, 179, -- (+77 chars; full line in the Zenodo source)
[-175, -159, -143, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, -189, -173, -157, -141, -125, -109, -93, -77, -61, -45, -29, -13, 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, 179, -187, -171, -155, -139, -123, -107, -91, -75, -59, -43, -27, -11, 5, 21, 37, 53, 69, 85, 101, 117, 133, 149, 165, 181, -185, -169, -153, -137, -121, -105, -89, -73, -5 -- (+70 chars; full line in the Zenodo source)
[-173, -155, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, 151, 169, 187, -177, -159, -141, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, 147, 165, 183, -181, -163, -145, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 107, 125, 143, 161, 179, -185, -167, -149, -131, -113, -95, -77, -59, -41, -23, -5, 13, 31, 49, 67, 85, 103, 121 -- (+76 chars; full line in the Zenodo source)
[-171, -151, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, 149, 169, 189, -173, -153, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, 147, 167, 187, -175, -155, -135, -115, -95, -75, -55, -35, -15, 5, 25, 45, 65, 85, 105, 125, 145, 165, 185, -177, -157, -137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, 143, 163, 183, -179, -159, -139, -119, - -- (+68 chars; full line in the Zenodo source)
[-169, -147, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, 139, 161, 183, -177, -155, -133, -111, -89, -67, -45, -23, -1, 21, 43, 65, 87, 109, 131, 153, 175, -185, -163, -141, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, 145, 167, 189, -171, -149, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, 159, 181, -179, -157, -135, -113, -91, -69, -47, -25, -3, 19, 41, 63 -- (+75 chars; full line in the Zenodo source)
[-167, -143, -119, -95, -71, -47, -23, 1, 25, 49, 73, 97, 121, 145, 169, -189, -165, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, 171, -187, -163, -139, -115, -91, -67, -43, -19, 5, 29, 53, 77, 101, 125, 149, 173, -185, -161, -137, -113, -89, -65, -41, -17, 7, 31, 55, 79, 103, 127, 151, 175, -183, -159, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, 153, 177, -181, -157 -- (+70 chars; full line in the Zenodo source)
[-165, -139, -113, -87, -61, -35, -9, 17, 43, 69, 95, 121, 147, 173, -183, -157, -131, -105, -79, -53, -27, -1, 25, 51, 77, 103, 129, 155, 181, -175, -149, -123, -97, -71, -45, -19, 7, 33, 59, 85, 111, 137, 163, 189, -167, -141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, 171, -185, -159, -133, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, 153, 179, -177, -151, -125, -99, -73, -47, -21, -- (+74 chars; full line in the Zenodo source)
[-163, -135, -107, -79, -51, -23, 5, 33, 61, 89, 117, 145, 173, -181, -153, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, 155, 183, -171, -143, -115, -87, -59, -31, -3, 25, 53, 81, 109, 137, 165, -189, -161, -133, -105, -77, -49, -21, 7, 35, 63, 91, 119, 147, 175, -179, -151, -123, -95, -67, -39, -11, 17, 45, 73, 101, 129, 157, 185, -169, -141, -113, -85, -57, -29, -1, 27, 55, 83, 111, 139, 167 -- (+71 chars; full line in the Zenodo source)
[-161, -131, -101, -71, -41, -11, 19, 49, 79, 109, 139, 169, -183, -153, -123, -93, -63, -33, -3, 27, 57, 87, 117, 147, 177, -175, -145, -115, -85, -55, -25, 5, 35, 65, 95, 125, 155, 185, -167, -137, -107, -77, -47, -17, 13, 43, 73, 103, 133, 163, -189, -159, -129, -99, -69, -39, -9, 21, 51, 81, 111, 141, 171, -181, -151, -121, -91, -61, -31, -1, 29, 59, 89, 119, 149, 179, -173, -143, -113, -83, -- (+74 chars; full line in the Zenodo source)
[-159, -127, -95, -63, -31, 1, 33, 65, 97, 129, 161, -189, -157, -125, -93, -61, -29, 3, 35, 67, 99, 131, 163, -187, -155, -123, -91, -59, -27, 5, 37, 69, 101, 133, 165, -185, -153, -121, -89, -57, -25, 7, 39, 71, 103, 135, 167, -183, -151, -119, -87, -55, -23, 9, 41, 73, 105, 137, 169, -181, -149, -117, -85, -53, -21, 11, 43, 75, 107, 139, 171, -179, -147, -115, -83, -51, -19, 13, 45, 77, 109, -- (+70 chars; full line in the Zenodo source)
[-157, -123, -89, -55, -21, 13, 47, 81, 115, 149, 183, -165, -131, -97, -63, -29, 5, 39, 73, 107, 141, 175, -173, -139, -105, -71, -37, -3, 31, 65, 99, 133, 167, -181, -147, -113, -79, -45, -11, 23, 57, 91, 125, 159, -189, -155, -121, -87, -53, -19, 15, 49, 83, 117, 151, 185, -163, -129, -95, -61, -27, 7, 41, 75, 109, 143, 177, -171, -137, -103, -69, -35, -1, 33, 67, 101, 135, 169, -179, -145, - -- (+74 chars; full line in the Zenodo source)
[-155, -119, -83, -47, -11, 25, 61, 97, 133, 169, -177, -141, -105, -69, -33, 3, 39, 75, 111, 147, 183, -163, -127, -91, -55, -19, 17, 53, 89, 125, 161, -185, -149, -113, -77, -41, -5, 31, 67, 103, 139, 175, -171, -135, -99, -63, -27, 9, 45, 81, 117, 153, 189, -157, -121, -85, -49, -13, 23, 59, 95, 131, 167, -179, -143, -107, -71, -35, 1, 37, 73, 109, 145, 181, -165, -129, -93, -57, -21, 15, 51, -- (+70 chars; full line in the Zenodo source)
[-153, -115, -77, -39, -1, 37, 75, 113, 151, 189, -155, -117, -79, -41, -3, 35, 73, 111, 149, 187, -157, -119, -81, -43, -5, 33, 71, 109, 147, 185, -159, -121, -83, -45, -7, 31, 69, 107, 145, 183, -161, -123, -85, -47, -9, 29, 67, 105, 143, 181, -163, -125, -87, -49, -11, 27, 65, 103, 141, 179, -165, -127, -89, -51, -13, 25, 63, 101, 139, 177, -167, -129, -91, -53, -15, 23, 61, 99, 137, 175, -16 -- (+73 chars; full line in the Zenodo source)
[-151, -111, -71, -31, 9, 49, 89, 129, 169, -173, -133, -93, -53, -13, 27, 67, 107, 147, 187, -155, -115, -75, -35, 5, 45, 85, 125, 165, -177, -137, -97, -57, -17, 23, 63, 103, 143, 183, -159, -119, -79, -39, 1, 41, 81, 121, 161, -181, -141, -101, -61, -21, 19, 59, 99, 139, 179, -163, -123, -83, -43, -3, 37, 77, 117, 157, -185, -145, -105, -65, -25, 15, 55, 95, 135, 175, -167, -127, -87, -47, -7 -- (+70 chars; full line in the Zenodo source)
[-149, -107, -65, -23, 19, 61, 103, 145, 187, -153, -111, -69, -27, 15, 57, 99, 141, 183, -157, -115, -73, -31, 11, 53, 95, 137, 179, -161, -119, -77, -35, 7, 49, 91, 133, 175, -165, -123, -81, -39, 3, 45, 87, 129, 171, -169, -127, -85, -43, -1, 41, 83, 125, 167, -173, -131, -89, -47, -5, 37, 79, 121, 163, -177, -135, -93, -51, -9, 33, 75, 117, 159, -181, -139, -97, -55, -13, 29, 71, 113, 155, - -- (+73 chars; full line in the Zenodo source)
[-147, -103, -59, -15, 29, 73, 117, 161, -177, -133, -89, -45, -1, 43, 87, 131, 175, -163, -119, -75, -31, 13, 57, 101, 145, 189, -149, -105, -61, -17, 27, 71, 115, 159, -179, -135, -91, -47, -3, 41, 85, 129, 173, -165, -121, -77, -33, 11, 55, 99, 143, 187, -151, -107, -63, -19, 25, 69, 113, 157, -181, -137, -93, -49, -5, 39, 83, 127, 171, -167, -123, -79, -35, 9, 53, 97, 141, 185, -153, -109, - -- (+71 chars; full line in the Zenodo source)
[-145, -99, -53, -7, 39, 85, 131, 177, -159, -113, -67, -21, 25, 71, 117, 163, -173, -127, -81, -35, 11, 57, 103, 149, -187, -141, -95, -49, -3, 43, 89, 135, 181, -155, -109, -63, -17, 29, 75, 121, 167, -169, -123, -77, -31, 15, 61, 107, 153, -183, -137, -91, -45, 1, 47, 93, 139, 185, -151, -105, -59, -13, 33, 79, 125, 171, -165, -119, -73, -27, 19, 65, 111, 157, -179, -133, -87, -41, 5, 51, 97, -- (+72 chars; full line in the Zenodo source)
[-143, -95, -47, 1, 49, 97, 145, -189, -141, -93, -45, 3, 51, 99, 147, -187, -139, -91, -43, 5, 53, 101, 149, -185, -137, -89, -41, 7, 55, 103, 151, -183, -135, -87, -39, 9, 57, 105, 153, -181, -133, -85, -37, 11, 59, 107, 155, -179, -131, -83, -35, 13, 61, 109, 157, -177, -129, -81, -33, 15, 63, 111, 159, -175, -127, -79, -31, 17, 65, 113, 161, -173, -125, -77, -29, 19, 67, 115, 163, -171, -123 -- (+70 chars; full line in the Zenodo source)
[-141, -91, -41, 9, 59, 109, 159, -173, -123, -73, -23, 27, 77, 127, 177, -155, -105, -55, -5, 45, 95, 145, -187, -137, -87, -37, 13, 63, 113, 163, -169, -119, -69, -19, 31, 81, 131, 181, -151, -101, -51, -1, 49, 99, 149, -183, -133, -83, -33, 17, 67, 117, 167, -165, -115, -65, -15, 35, 85, 135, 185, -147, -97, -47, 3, 53, 103, 153, -179, -129, -79, -29, 21, 71, 121, 171, -161, -111, -61, -11, 3 -- (+72 chars; full line in the Zenodo source)
[-139, -87, -35, 17, 69, 121, 173, -157, -105, -53, -1, 51, 103, 155, -175, -123, -71, -19, 33, 85, 137, 189, -141, -89, -37, 15, 67, 119, 171, -159, -107, -55, -3, 49, 101, 153, -177, -125, -73, -21, 31, 83, 135, 187, -143, -91, -39, 13, 65, 117, 169, -161, -109, -57, -5, 47, 99, 151, -179, -127, -75, -23, 29, 81, 133, 185, -145, -93, -41, 11, 63, 115, 167, -163, -111, -59, -7, 45, 97, 149, -18 -- (+70 chars; full line in the Zenodo source)
[-137, -83, -29, 25, 79, 133, 187, -141, -87, -33, 21, 75, 129, 183, -145, -91, -37, 17, 71, 125, 179, -149, -95, -41, 13, 67, 121, 175, -153, -99, -45, 9, 63, 117, 171, -157, -103, -49, 5, 59, 113, 167, -161, -107, -53, 1, 55, 109, 163, -165, -111, -57, -3, 51, 105, 159, -169, -115, -61, -7, 47, 101, 155, -173, -119, -65, -11, 43, 97, 151, -177, -123, -69, -15, 39, 93, 147, -181, -127, -73, -19 -- (+72 chars; full line in the Zenodo source)
[-135, -79, -23, 33, 89, 145, -181, -125, -69, -13, 43, 99, 155, -171, -115, -59, -3, 53, 109, 165, -161, -105, -49, 7, 63, 119, 175, -151, -95, -39, 17, 73, 129, 185, -141, -85, -29, 27, 83, 139, -187, -131, -75, -19, 37, 93, 149, -177, -121, -65, -9, 47, 103, 159, -167, -111, -55, 1, 57, 113, 169, -157, -101, -45, 11, 67, 123, 179, -147, -91, -35, 21, 77, 133, 189, -137, -81, -25, 31, 87, 143, -- (+71 chars; full line in the Zenodo source)
[-133, -75, -17, 41, 99, 157, -167, -109, -51, 7, 65, 123, 181, -143, -85, -27, 31, 89, 147, -177, -119, -61, -3, 55, 113, 171, -153, -95, -37, 21, 79, 137, -187, -129, -71, -13, 45, 103, 161, -163, -105, -47, 11, 69, 127, 185, -139, -81, -23, 35, 93, 151, -173, -115, -57, 1, 59, 117, 175, -149, -91, -33, 25, 83, 141, -183, -125, -67, -9, 49, 107, 165, -159, -101, -43, 15, 73, 131, 189, -135, -7 -- (+71 chars; full line in the Zenodo source)
[-131, -71, -11, 49, 109, 169, -153, -93, -33, 27, 87, 147, -175, -115, -55, 5, 65, 125, 185, -137, -77, -17, 43, 103, 163, -159, -99, -39, 21, 81, 141, -181, -121, -61, -1, 59, 119, 179, -143, -83, -23, 37, 97, 157, -165, -105, -45, 15, 75, 135, -187, -127, -67, -7, 53, 113, 173, -149, -89, -29, 31, 91, 151, -171, -111, -51, 9, 69, 129, 189, -133, -73, -13, 47, 107, 167, -155, -95, -35, 25, 85, -- (+70 chars; full line in the Zenodo source)
[-129, -67, -5, 57, 119, 181, -139, -77, -15, 47, 109, 171, -149, -87, -25, 37, 99, 161, -159, -97, -35, 27, 89, 151, -169, -107, -45, 17, 79, 141, -179, -117, -55, 7, 69, 131, -189, -127, -65, -3, 59, 121, 183, -137, -75, -13, 49, 111, 173, -147, -85, -23, 39, 101, 163, -157, -95, -33, 29, 91, 153, -167, -105, -43, 19, 81, 143, -177, -115, -53, 9, 71, 133, -187, -125, -63, -1, 61, 123, 185, -13 -- (+73 chars; full line in the Zenodo source)
[-127, -63, 1, 65, 129, -189, -125, -61, 3, 67, 131, -187, -123, -59, 5, 69, 133, -185, -121, -57, 7, 71, 135, -183, -119, -55, 9, 73, 137, -181, -117, -53, 11, 75, 139, -179, -115, -51, 13, 77, 141, -177, -113, -49, 15, 79, 143, -175, -111, -47, 17, 81, 145, -173, -109, -45, 19, 83, 147, -171, -107, -43, 21, 85, 149, -169, -105, -41, 23, 87, 151, -167, -103, -39, 25, 89, 153, -165, -101, -37, 2 -- (+70 chars; full line in the Zenodo source)
[-125, -59, 7, 73, 139, -177, -111, -45, 21, 87, 153, -163, -97, -31, 35, 101, 167, -149, -83, -17, 49, 115, 181, -135, -69, -3, 63, 129, -187, -121, -55, 11, 77, 143, -173, -107, -41, 25, 91, 157, -159, -93, -27, 39, 105, 171, -145, -79, -13, 53, 119, 185, -131, -65, 1, 67, 133, -183, -117, -51, 15, 81, 147, -169, -103, -37, 29, 95, 161, -155, -89, -23, 43, 109, 175, -141, -75, -9, 57, 123, 189 -- (+71 chars; full line in the Zenodo source)
[-123, -55, 13, 81, 149, -165, -97, -29, 39, 107, 175, -139, -71, -3, 65, 133, -181, -113, -45, 23, 91, 159, -155, -87, -19, 49, 117, 185, -129, -61, 7, 75, 143, -171, -103, -35, 33, 101, 169, -145, -77, -9, 59, 127, -187, -119, -51, 17, 85, 153, -161, -93, -25, 43, 111, 179, -135, -67, 1, 69, 137, -177, -109, -41, 27, 95, 163, -151, -83, -15, 53, 121, 189, -125, -57, 11, 79, 147, -167, -99, -31 -- (+70 chars; full line in the Zenodo source)
[-121, -51, 19, 89, 159, -153, -83, -13, 57, 127, -185, -115, -45, 25, 95, 165, -147, -77, -7, 63, 133, -179, -109, -39, 31, 101, 171, -141, -71, -1, 69, 139, -173, -103, -33, 37, 107, 177, -135, -65, 5, 75, 145, -167, -97, -27, 43, 113, 183, -129, -59, 11, 81, 151, -161, -91, -21, 49, 119, 189, -123, -53, 17, 87, 157, -155, -85, -15, 55, 125, -187, -117, -47, 23, 93, 163, -149, -79, -9, 61, 131 -- (+73 chars; full line in the Zenodo source)
[-119, -47, 25, 97, 169, -141, -69, 3, 75, 147, -163, -91, -19, 53, 125, -185, -113, -41, 31, 103, 175, -135, -63, 9, 81, 153, -157, -85, -13, 59, 131, -179, -107, -35, 37, 109, 181, -129, -57, 15, 87, 159, -151, -79, -7, 65, 137, -173, -101, -29, 43, 115, 187, -123, -51, 21, 93, 165, -145, -73, -1, 71, 143, -167, -95, -23, 49, 121, -189, -117, -45, 27, 99, 171, -139, -67, 5, 77, 149, -161, -89, -- (+70 chars; full line in the Zenodo source)
[-117, -43, 31, 105, 179, -129, -55, 19, 93, 167, -141, -67, 7, 81, 155, -153, -79, -5, 69, 143, -165, -91, -17, 57, 131, -177, -103, -29, 45, 119, -189, -115, -41, 33, 107, 181, -127, -53, 21, 95, 169, -139, -65, 9, 83, 157, -151, -77, -3, 71, 145, -163, -89, -15, 59, 133, -175, -101, -27, 47, 121, -187, -113, -39, 35, 109, 183, -125, -51, 23, 97, 171, -137, -63, 11, 85, 159, -149, -75, -1, 73, -- (+73 chars; full line in the Zenodo source)
[-115, -39, 37, 113, 189, -117, -41, 35, 111, 187, -119, -43, 33, 109, 185, -121, -45, 31, 107, 183, -123, -47, 29, 105, 181, -125, -49, 27, 103, 179, -127, -51, 25, 101, 177, -129, -53, 23, 99, 175, -131, -55, 21, 97, 173, -133, -57, 19, 95, 171, -135, -59, 17, 93, 169, -137, -61, 15, 91, 167, -139, -63, 13, 89, 165, -141, -65, 11, 87, 163, -143, -67, 9, 85, 161, -145, -69, 7, 83, 159, -147, -7 -- (+61 chars; full line in the Zenodo source)
[-113, -35, 43, 121, -183, -105, -27, 51, 129, -175, -97, -19, 59, 137, -167, -89, -11, 67, 145, -159, -81, -3, 75, 153, -151, -73, 5, 83, 161, -143, -65, 13, 91, 169, -135, -57, 21, 99, 177, -127, -49, 29, 107, 185, -119, -41, 37, 115, -189, -111, -33, 45, 123, -181, -103, -25, 53, 131, -173, -95, -17, 61, 139, -165, -87, -9, 69, 147, -157, -79, -1, 77, 155, -149, -71, 7, 85, 163, -141, -63, 15 -- (+72 chars; full line in the Zenodo source)
[-111, -31, 49, 129, -173, -93, -13, 67, 147, -155, -75, 5, 85, 165, -137, -57, 23, 103, 183, -119, -39, 41, 121, -181, -101, -21, 59, 139, -163, -83, -3, 77, 157, -145, -65, 15, 95, 175, -127, -47, 33, 113, -189, -109, -29, 51, 131, -171, -91, -11, 69, 149, -153, -73, 7, 87, 167, -135, -55, 25, 105, 185, -117, -37, 43, 123, -179, -99, -19, 61, 141, -161, -81, -1, 79, 159, -143, -63, 17, 97, 177 -- (+72 chars; full line in the Zenodo source)
[-109, -27, 55, 137, -163, -81, 1, 83, 165, -135, -53, 29, 111, -189, -107, -25, 57, 139, -161, -79, 3, 85, 167, -133, -51, 31, 113, -187, -105, -23, 59, 141, -159, -77, 5, 87, 169, -131, -49, 33, 115, -185, -103, -21, 61, 143, -157, -75, 7, 89, 171, -129, -47, 35, 117, -183, -101, -19, 63, 145, -155, -73, 9, 91, 173, -127, -45, 37, 119, -181, -99, -17, 65, 147, -153, -71, 11, 93, 175, -125, -43 -- (+71 chars; full line in the Zenodo source)
[-107, -23, 61, 145, -153, -69, 15, 99, 183, -115, -31, 53, 137, -161, -77, 7, 91, 175, -123, -39, 45, 129, -169, -85, -1, 83, 167, -131, -47, 37, 121, -177, -93, -9, 75, 159, -139, -55, 29, 113, -185, -101, -17, 67, 151, -147, -63, 21, 105, 189, -109, -25, 59, 143, -155, -71, 13, 97, 181, -117, -33, 51, 135, -163, -79, 5, 89, 173, -125, -41, 43, 127, -171, -87, -3, 81, 165, -133, -49, 35, 119, -- (+71 chars; full line in the Zenodo source)
[-105, -19, 67, 153, -143, -57, 29, 115, -181, -95, -9, 77, 163, -133, -47, 39, 125, -171, -85, 1, 87, 173, -123, -37, 49, 135, -161, -75, 11, 97, 183, -113, -27, 59, 145, -151, -65, 21, 107, -189, -103, -17, 69, 155, -141, -55, 31, 117, -179, -93, -7, 79, 165, -131, -45, 41, 127, -169, -83, 3, 89, 175, -121, -35, 51, 137, -159, -73, 13, 99, 185, -111, -25, 61, 147, -149, -63, 23, 109, -187, -10 -- (+72 chars; full line in the Zenodo source)
[-103, -15, 73, 161, -133, -45, 43, 131, -163, -75, 13, 101, 189, -105, -17, 71, 159, -135, -47, 41, 129, -165, -77, 11, 99, 187, -107, -19, 69, 157, -137, -49, 39, 127, -167, -79, 9, 97, 185, -109, -21, 67, 155, -139, -51, 37, 125, -169, -81, 7, 95, 183, -111, -23, 65, 153, -141, -53, 35, 123, -171, -83, 5, 93, 181, -113, -25, 63, 151, -143, -55, 33, 121, -173, -85, 3, 91, 179, -115, -27, 61, 1 -- (+67 chars; full line in the Zenodo source)
[-101, -11, 79, 169, -123, -33, 57, 147, -145, -55, 35, 125, -167, -77, 13, 103, -189, -99, -9, 81, 171, -121, -31, 59, 149, -143, -53, 37, 127, -165, -75, 15, 105, -187, -97, -7, 83, 173, -119, -29, 61, 151, -141, -51, 39, 129, -163, -73, 17, 107, -185, -95, -5, 85, 175, -117, -27, 63, 153, -139, -49, 41, 131, -161, -71, 19, 109, -183, -93, -3, 87, 177, -115, -25, 65, 155, -137, -47, 43, 133, - -- (+74 chars; full line in the Zenodo source)
[-99, -7, 85, 177, -113, -21, 71, 163, -127, -35, 57, 149, -141, -49, 43, 135, -155, -63, 29, 121, -169, -77, 15, 107, -183, -91, 1, 93, 185, -105, -13, 79, 171, -119, -27, 65, 157, -133, -41, 51, 143, -147, -55, 37, 129, -161, -69, 23, 115, -175, -83, 9, 101, -189, -97, -5, 87, 179, -111, -19, 73, 165, -125, -33, 59, 151, -139, -47, 45, 137, -153, -61, 31, 123, -167, -75, 17, 109, -181, -89, 3, -- (+70 chars; full line in the Zenodo source)
[-97, -3, 91, 185, -103, -9, 85, 179, -109, -15, 79, 173, -115, -21, 73, 167, -121, -27, 67, 161, -127, -33, 61, 155, -133, -39, 55, 149, -139, -45, 49, 143, -145, -51, 43, 137, -151, -57, 37, 131, -157, -63, 31, 125, -163, -69, 25, 119, -169, -75, 19, 113, -175, -81, 13, 107, -181, -87, 7, 101, -187, -93, 1, 95, 189, -99, -5, 89, 183, -105, -11, 83, 177, -111, -17, 77, 171, -117, -23, 71, 165, -- (+71 chars; full line in the Zenodo source)
[-95, 1, 97, -189, -93, 3, 99, -187, -91, 5, 101, -185, -89, 7, 103, -183, -87, 9, 105, -181, -85, 11, 107, -179, -83, 13, 109, -177, -81, 15, 111, -175, -79, 17, 113, -173, -77, 19, 115, -171, -75, 21, 117, -169, -73, 23, 119, -167, -71, 25, 121, -165, -69, 27, 123, -163, -67, 29, 125, -161, -65, 31, 127, -159, -63, 33, 129, -157, -61, 35, 131, -155, -59, 37, 133, -153, -57, 39, 135, -151, -55, -- (+70 chars; full line in the Zenodo source)
[-93, 5, 103, -181, -83, 15, 113, -171, -73, 25, 123, -161, -63, 35, 133, -151, -53, 45, 143, -141, -43, 55, 153, -131, -33, 65, 163, -121, -23, 75, 173, -111, -13, 85, 183, -101, -3, 95, -189, -91, 7, 105, -179, -81, 17, 115, -169, -71, 27, 125, -159, -61, 37, 135, -149, -51, 47, 145, -139, -41, 57, 155, -129, -31, 67, 165, -119, -21, 77, 175, -109, -11, 87, 185, -99, -1, 97, -187, -89, 9, 107, -- (+72 chars; full line in the Zenodo source)
[-91, 9, 109, -173, -73, 27, 127, -155, -55, 45, 145, -137, -37, 63, 163, -119, -19, 81, 181, -101, -1, 99, -183, -83, 17, 117, -165, -65, 35, 135, -147, -47, 53, 153, -129, -29, 71, 171, -111, -11, 89, 189, -93, 7, 107, -175, -75, 25, 125, -157, -57, 43, 143, -139, -39, 61, 161, -121, -21, 79, 179, -103, -3, 97, -185, -85, 15, 115, -167, -67, 33, 133, -149, -49, 51, 151, -131, -31, 69, 169, -11 -- (+70 chars; full line in the Zenodo source)
[-89, 13, 115, -165, -63, 39, 141, -139, -37, 65, 167, -113, -11, 91, -189, -87, 15, 117, -163, -61, 41, 143, -137, -35, 67, 169, -111, -9, 93, -187, -85, 17, 119, -161, -59, 43, 145, -135, -33, 69, 171, -109, -7, 95, -185, -83, 19, 121, -159, -57, 45, 147, -133, -31, 71, 173, -107, -5, 97, -183, -81, 21, 123, -157, -55, 47, 149, -131, -29, 73, 175, -105, -3, 99, -181, -79, 23, 125, -155, -53, 4 -- (+74 chars; full line in the Zenodo source)
[-87, 17, 121, -157, -53, 51, 155, -123, -19, 85, 189, -89, 15, 119, -159, -55, 49, 153, -125, -21, 83, 187, -91, 13, 117, -161, -57, 47, 151, -127, -23, 81, 185, -93, 11, 115, -163, -59, 45, 149, -129, -25, 79, 183, -95, 9, 113, -165, -61, 43, 147, -131, -27, 77, 181, -97, 7, 111, -167, -63, 41, 145, -133, -29, 75, 179, -99, 5, 109, -169, -65, 39, 143, -135, -31, 73, 177, -101, 3, 107, -171, -6 -- (+66 chars; full line in the Zenodo source)
[-85, 21, 127, -149, -43, 63, 169, -107, -1, 105, -171, -65, 41, 147, -129, -23, 83, 189, -87, 19, 125, -151, -45, 61, 167, -109, -3, 103, -173, -67, 39, 145, -131, -25, 81, 187, -89, 17, 123, -153, -47, 59, 165, -111, -5, 101, -175, -69, 37, 143, -133, -27, 79, 185, -91, 15, 121, -155, -49, 57, 163, -113, -7, 99, -177, -71, 35, 141, -135, -29, 77, 183, -93, 13, 119, -157, -51, 55, 161, -115, -9 -- (+71 chars; full line in the Zenodo source)
[-83, 25, 133, -141, -33, 75, 183, -91, 17, 125, -149, -41, 67, 175, -99, 9, 117, -157, -49, 59, 167, -107, 1, 109, -165, -57, 51, 159, -115, -7, 101, -173, -65, 43, 151, -123, -15, 93, -181, -73, 35, 143, -131, -23, 85, -189, -81, 27, 135, -139, -31, 77, 185, -89, 19, 127, -147, -39, 69, 177, -97, 11, 119, -155, -47, 61, 169, -105, 3, 111, -163, -55, 53, 161, -113, -5, 103, -171, -63, 45, 153, -- (+70 chars; full line in the Zenodo source)
[-81, 29, 139, -133, -23, 87, -185, -75, 35, 145, -127, -17, 93, -179, -69, 41, 151, -121, -11, 99, -173, -63, 47, 157, -115, -5, 105, -167, -57, 53, 163, -109, 1, 111, -161, -51, 59, 169, -103, 7, 117, -155, -45, 65, 175, -97, 13, 123, -149, -39, 71, 181, -91, 19, 129, -143, -33, 77, 187, -85, 25, 135, -137, -27, 83, -189, -79, 31, 141, -131, -21, 89, -183, -73, 37, 147, -125, -15, 95, -177, -6 -- (+73 chars; full line in the Zenodo source)
[-79, 33, 145, -125, -13, 99, -171, -59, 53, 165, -105, 7, 119, -151, -39, 73, 185, -85, 27, 139, -131, -19, 93, -177, -65, 47, 159, -111, 1, 113, -157, -45, 67, 179, -91, 21, 133, -137, -25, 87, -183, -71, 41, 153, -117, -5, 107, -163, -51, 61, 173, -97, 15, 127, -143, -31, 81, -189, -77, 35, 147, -123, -11, 101, -169, -57, 55, 167, -103, 9, 121, -149, -37, 75, 187, -83, 29, 141, -129, -17, 95, -- (+69 chars; full line in the Zenodo source)
[-77, 37, 151, -117, -3, 111, -157, -43, 71, 185, -83, 31, 145, -123, -9, 105, -163, -49, 65, 179, -89, 25, 139, -129, -15, 99, -169, -55, 59, 173, -95, 19, 133, -135, -21, 93, -175, -61, 53, 167, -101, 13, 127, -141, -27, 87, -181, -67, 47, 161, -107, 7, 121, -147, -33, 81, -187, -73, 41, 155, -113, 1, 115, -153, -39, 75, 189, -79, 35, 149, -119, -5, 109, -159, -45, 69, 183, -85, 29, 143, -125, -- (+71 chars; full line in the Zenodo source)
[-75, 41, 157, -109, 7, 123, -143, -27, 89, -177, -61, 55, 171, -95, 21, 137, -129, -13, 103, -163, -47, 69, 185, -81, 35, 151, -115, 1, 117, -149, -33, 83, -183, -67, 49, 165, -101, 15, 131, -135, -19, 97, -169, -53, 63, 179, -87, 29, 145, -121, -5, 111, -155, -39, 77, -189, -73, 43, 159, -107, 9, 125, -141, -25, 91, -175, -59, 57, 173, -93, 23, 139, -127, -11, 105, -161, -45, 71, 187, -79, 37, -- (+69 chars; full line in the Zenodo source)
[-73, 45, 163, -101, 17, 135, -129, -11, 107, -157, -39, 79, -185, -67, 51, 169, -95, 23, 141, -123, -5, 113, -151, -33, 85, -179, -61, 57, 175, -89, 29, 147, -117, 1, 119, -145, -27, 91, -173, -55, 63, 181, -83, 35, 153, -111, 7, 125, -139, -21, 97, -167, -49, 69, 187, -77, 41, 159, -105, 13, 131, -133, -15, 103, -161, -43, 75, -189, -71, 47, 165, -99, 19, 137, -127, -9, 109, -155, -37, 81, -18 -- (+72 chars; full line in the Zenodo source)
[-71, 49, 169, -93, 27, 147, -115, 5, 125, -137, -17, 103, -159, -39, 81, -181, -61, 59, 179, -83, 37, 157, -105, 15, 135, -127, -7, 113, -149, -29, 91, -171, -51, 69, 189, -73, 47, 167, -95, 25, 145, -117, 3, 123, -139, -19, 101, -161, -41, 79, -183, -63, 57, 177, -85, 35, 155, -107, 13, 133, -129, -9, 111, -151, -31, 89, -173, -53, 67, 187, -75, 45, 165, -97, 23, 143, -119, 1, 121, -141, -21, -- (+68 chars; full line in the Zenodo source)
[-69, 53, 175, -85, 37, 159, -101, 21, 143, -117, 5, 127, -133, -11, 111, -149, -27, 95, -165, -43, 79, -181, -59, 63, 185, -75, 47, 169, -91, 31, 153, -107, 15, 137, -123, -1, 121, -139, -17, 105, -155, -33, 89, -171, -49, 73, -187, -65, 57, 179, -81, 41, 163, -97, 25, 147, -113, 9, 131, -129, -7, 115, -145, -23, 99, -161, -39, 83, -177, -55, 67, 189, -71, 51, 173, -87, 35, 157, -103, 19, 141, -- (+71 chars; full line in the Zenodo source)
[-67, 57, 181, -77, 47, 171, -87, 37, 161, -97, 27, 151, -107, 17, 141, -117, 7, 131, -127, -3, 121, -137, -13, 111, -147, -23, 101, -157, -33, 91, -167, -43, 81, -177, -53, 71, -187, -63, 61, 185, -73, 51, 175, -83, 41, 165, -93, 31, 155, -103, 21, 145, -113, 11, 135, -123, 1, 125, -133, -9, 115, -143, -19, 105, -153, -29, 95, -163, -39, 85, -173, -49, 75, -183, -59, 65, 189, -69, 55, 179, -79, -- (+67 chars; full line in the Zenodo source)
[-65, 61, 187, -69, 57, 183, -73, 53, 179, -77, 49, 175, -81, 45, 171, -85, 41, 167, -89, 37, 163, -93, 33, 159, -97, 29, 155, -101, 25, 151, -105, 21, 147, -109, 17, 143, -113, 13, 139, -117, 9, 135, -121, 5, 131, -125, 1, 127, -129, -3, 123, -133, -7, 119, -137, -11, 115, -141, -15, 111, -145, -19, 107, -149, -23, 103, -153, -27, 99, -157, -31, 95, -161, -35, 91, -165, -39, 87, -169, -43, 83, -- (+71 chars; full line in the Zenodo source)
[-63, 65, -189, -61, 67, -187, -59, 69, -185, -57, 71, -183, -55, 73, -181, -53, 75, -179, -51, 77, -177, -49, 79, -175, -47, 81, -173, -45, 83, -171, -43, 85, -169, -41, 87, -167, -39, 89, -165, -37, 91, -163, -35, 93, -161, -33, 95, -159, -31, 97, -157, -29, 99, -155, -27, 101, -153, -25, 103, -151, -23, 105, -149, -21, 107, -147, -19, 109, -145, -17, 111, -143, -15, 113, -141, -13, 115, -139, -- (+86 chars; full line in the Zenodo source)
[-61, 69, -183, -53, 77, -175, -45, 85, -167, -37, 93, -159, -29, 101, -151, -21, 109, -143, -13, 117, -135, -5, 125, -127, 3, 133, -119, 11, 141, -111, 19, 149, -103, 27, 157, -95, 35, 165, -87, 43, 173, -79, 51, 181, -71, 59, 189, -63, 67, -185, -55, 75, -177, -47, 83, -169, -39, 91, -161, -31, 99, -153, -23, 107, -145, -15, 115, -137, -7, 123, -129, 1, 131, -121, 9, 139, -113, 17, 147, -105, -- (+70 chars; full line in the Zenodo source)
[-59, 73, -177, -45, 87, -163, -31, 101, -149, -17, 115, -135, -3, 129, -121, 11, 143, -107, 25, 157, -93, 39, 171, -79, 53, 185, -65, 67, -183, -51, 81, -169, -37, 95, -155, -23, 109, -141, -9, 123, -127, 5, 137, -113, 19, 151, -99, 33, 165, -85, 47, 179, -71, 61, -189, -57, 75, -175, -43, 89, -161, -29, 103, -147, -15, 117, -133, -1, 131, -119, 13, 145, -105, 27, 159, -91, 41, 173, -77, 55, 18 -- (+73 chars; full line in the Zenodo source)
[-57, 77, -171, -37, 97, -151, -17, 117, -131, 3, 137, -111, 23, 157, -91, 43, 177, -71, 63, -185, -51, 83, -165, -31, 103, -145, -11, 123, -125, 9, 143, -105, 29, 163, -85, 49, 183, -65, 69, -179, -45, 89, -159, -25, 109, -139, -5, 129, -119, 15, 149, -99, 35, 169, -79, 55, 189, -59, 75, -173, -39, 95, -153, -19, 115, -133, 1, 135, -113, 21, 155, -93, 41, 175, -73, 61, -187, -53, 81, -167, -33, -- (+70 chars; full line in the Zenodo source)
[-55, 81, -165, -29, 107, -139, -3, 133, -113, 23, 159, -87, 49, 185, -61, 75, -171, -35, 101, -145, -9, 127, -119, 17, 153, -93, 43, 179, -67, 69, -177, -41, 95, -151, -15, 121, -125, 11, 147, -99, 37, 173, -73, 63, -183, -47, 89, -157, -21, 115, -131, 5, 141, -105, 31, 167, -79, 57, -189, -53, 83, -163, -27, 109, -137, -1, 135, -111, 25, 161, -85, 51, 187, -59, 77, -169, -33, 103, -143, -7, 12 -- (+72 chars; full line in the Zenodo source)
[-53, 85, -159, -21, 117, -127, 11, 149, -95, 43, 181, -63, 75, -169, -31, 107, -137, 1, 139, -105, 33, 171, -73, 65, -179, -41, 97, -147, -9, 129, -115, 23, 161, -83, 55, -189, -51, 87, -157, -19, 119, -125, 13, 151, -93, 45, 183, -61, 77, -167, -29, 109, -135, 3, 141, -103, 35, 173, -71, 67, -177, -39, 99, -145, -7, 131, -113, 25, 163, -81, 57, -187, -49, 89, -155, -17, 121, -123, 15, 153, -91 -- (+70 chars; full line in the Zenodo source)
[-51, 89, -153, -13, 127, -115, 25, 165, -77, 63, -179, -39, 101, -141, -1, 139, -103, 37, 177, -65, 75, -167, -27, 113, -129, 11, 151, -91, 49, 189, -53, 87, -155, -15, 125, -117, 23, 163, -79, 61, -181, -41, 99, -143, -3, 137, -105, 35, 175, -67, 73, -169, -29, 111, -131, 9, 149, -93, 47, 187, -55, 85, -157, -17, 123, -119, 21, 161, -81, 59, -183, -43, 97, -145, -5, 135, -107, 33, 173, -69, 71 -- (+71 chars; full line in the Zenodo source)
[-49, 93, -147, -5, 137, -103, 39, 181, -59, 83, -157, -15, 127, -113, 29, 171, -69, 73, -167, -25, 117, -123, 19, 161, -79, 63, -177, -35, 107, -133, 9, 151, -89, 53, -187, -45, 97, -143, -1, 141, -99, 43, 185, -55, 87, -153, -11, 131, -109, 33, 175, -65, 77, -163, -21, 121, -119, 23, 165, -75, 67, -173, -31, 111, -129, 13, 155, -85, 57, -183, -41, 101, -139, 3, 145, -95, 47, 189, -51, 91, -149 -- (+71 chars; full line in the Zenodo source)
[-47, 97, -141, 3, 147, -91, 53, -185, -41, 103, -135, 9, 153, -85, 59, -179, -35, 109, -129, 15, 159, -79, 65, -173, -29, 115, -123, 21, 165, -73, 71, -167, -23, 121, -117, 27, 171, -67, 77, -161, -17, 127, -111, 33, 177, -61, 83, -155, -11, 133, -105, 39, 183, -55, 89, -149, -5, 139, -99, 45, 189, -49, 95, -143, 1, 145, -93, 51, -187, -43, 101, -137, 7, 151, -87, 57, -181, -37, 107, -131, 13, -- (+70 chars; full line in the Zenodo source)
[-45, 101, -135, 11, 157, -79, 67, -169, -23, 123, -113, 33, 179, -57, 89, -147, -1, 145, -91, 55, -181, -35, 111, -125, 21, 167, -69, 77, -159, -13, 133, -103, 43, 189, -47, 99, -137, 9, 155, -81, 65, -171, -25, 121, -115, 31, 177, -59, 87, -149, -3, 143, -93, 53, -183, -37, 109, -127, 19, 165, -71, 75, -161, -15, 131, -105, 41, 187, -49, 97, -139, 7, 153, -83, 63, -173, -27, 119, -117, 29, 175 -- (+71 chars; full line in the Zenodo source)
[-43, 105, -129, 19, 167, -67, 81, -153, -5, 143, -91, 57, -177, -29, 119, -115, 33, 181, -53, 95, -139, 9, 157, -77, 71, -163, -15, 133, -101, 47, -187, -39, 109, -125, 23, 171, -63, 85, -149, -1, 147, -87, 61, -173, -25, 123, -111, 37, 185, -49, 99, -135, 13, 161, -73, 75, -159, -11, 137, -97, 51, -183, -35, 113, -121, 27, 175, -59, 89, -145, 3, 151, -83, 65, -169, -21, 127, -107, 41, 189, -45 -- (+71 chars; full line in the Zenodo source)
[-41, 109, -123, 27, 177, -55, 95, -137, 13, 163, -69, 81, -151, -1, 149, -83, 67, -165, -15, 135, -97, 53, -179, -29, 121, -111, 39, 189, -43, 107, -125, 25, 175, -57, 93, -139, 11, 161, -71, 79, -153, -3, 147, -85, 65, -167, -17, 133, -99, 51, -181, -31, 119, -113, 37, 187, -45, 105, -127, 23, 173, -59, 91, -141, 9, 159, -73, 77, -155, -5, 145, -87, 63, -169, -19, 131, -101, 49, -183, -33, 117 -- (+70 chars; full line in the Zenodo source)
[-39, 113, -117, 35, 187, -43, 109, -121, 31, 183, -47, 105, -125, 27, 179, -51, 101, -129, 23, 175, -55, 97, -133, 19, 171, -59, 93, -137, 15, 167, -63, 89, -141, 11, 163, -67, 85, -145, 7, 159, -71, 81, -149, 3, 155, -75, 77, -153, -1, 151, -79, 73, -157, -5, 147, -83, 69, -161, -9, 143, -87, 65, -165, -13, 139, -91, 61, -169, -17, 135, -95, 57, -173, -21, 131, -99, 53, -177, -25, 127, -103, 4 -- (+71 chars; full line in the Zenodo source)
[-37, 117, -111, 43, -185, -31, 123, -105, 49, -179, -25, 129, -99, 55, -173, -19, 135, -93, 61, -167, -13, 141, -87, 67, -161, -7, 147, -81, 73, -155, -1, 153, -75, 79, -149, 5, 159, -69, 85, -143, 11, 165, -63, 91, -137, 17, 171, -57, 97, -131, 23, 177, -51, 103, -125, 29, 183, -45, 109, -119, 35, 189, -39, 115, -113, 41, -187, -33, 121, -107, 47, -181, -27, 127, -101, 53, -175, -21, 133, -95, -- (+74 chars; full line in the Zenodo source)
[-35, 121, -105, 51, -175, -19, 137, -89, 67, -159, -3, 153, -73, 83, -143, 13, 169, -57, 99, -127, 29, 185, -41, 115, -111, 45, -181, -25, 131, -95, 61, -165, -9, 147, -79, 77, -149, 7, 163, -63, 93, -133, 23, 179, -47, 109, -117, 39, -187, -31, 125, -101, 55, -171, -15, 141, -85, 71, -155, 1, 157, -69, 87, -139, 17, 173, -53, 103, -123, 33, 189, -37, 119, -107, 49, -177, -21, 135, -91, 65, -16 -- (+70 chars; full line in the Zenodo source)
[-33, 125, -99, 59, -165, -7, 151, -73, 85, -139, 19, 177, -47, 111, -113, 45, -179, -21, 137, -87, 71, -153, 5, 163, -61, 97, -127, 31, 189, -35, 123, -101, 57, -167, -9, 149, -75, 83, -141, 17, 175, -49, 109, -115, 43, -181, -23, 135, -89, 69, -155, 3, 161, -63, 95, -129, 29, 187, -37, 121, -103, 55, -169, -11, 147, -77, 81, -143, 15, 173, -51, 107, -117, 41, -183, -25, 133, -91, 67, -157, 1, -- (+70 chars; full line in the Zenodo source)
[-31, 129, -93, 67, -155, 5, 165, -57, 103, -119, 41, -181, -21, 139, -83, 77, -145, 15, 175, -47, 113, -109, 51, -171, -11, 149, -73, 87, -135, 25, 185, -37, 123, -99, 61, -161, -1, 159, -63, 97, -125, 35, -187, -27, 133, -89, 71, -151, 9, 169, -53, 107, -115, 45, -177, -17, 143, -79, 81, -141, 19, 179, -43, 117, -105, 55, -167, -7, 153, -69, 91, -131, 29, 189, -33, 127, -95, 65, -157, 3, 163, -- (+70 chars; full line in the Zenodo source)
[-29, 133, -87, 75, -145, 17, 179, -41, 121, -99, 63, -157, 5, 167, -53, 109, -111, 51, -169, -7, 155, -65, 97, -123, 39, -181, -19, 143, -77, 85, -135, 27, 189, -31, 131, -89, 73, -147, 15, 177, -43, 119, -101, 61, -159, 3, 165, -55, 107, -113, 49, -171, -9, 153, -67, 95, -125, 37, -183, -21, 141, -79, 83, -137, 25, 187, -33, 129, -91, 71, -149, 13, 175, -45, 117, -103, 59, -161, 1, 163, -57, 1 -- (+70 chars; full line in the Zenodo source)
[-27, 137, -81, 83, -135, 29, -189, -25, 139, -79, 85, -133, 31, -187, -23, 141, -77, 87, -131, 33, -185, -21, 143, -75, 89, -129, 35, -183, -19, 145, -73, 91, -127, 37, -181, -17, 147, -71, 93, -125, 39, -179, -15, 149, -69, 95, -123, 41, -177, -13, 151, -67, 97, -121, 43, -175, -11, 153, -65, 99, -119, 45, -173, -9, 155, -63, 101, -117, 47, -171, -7, 157, -61, 103, -115, 49, -169, -5, 159, -59 -- (+77 chars; full line in the Zenodo source)
[-25, 141, -75, 91, -125, 41, -175, -9, 157, -59, 107, -109, 57, -159, 7, 173, -43, 123, -93, 73, -143, 23, 189, -27, 139, -77, 89, -127, 39, -177, -11, 155, -61, 105, -111, 55, -161, 5, 171, -45, 121, -95, 71, -145, 21, 187, -29, 137, -79, 87, -129, 37, -179, -13, 153, -63, 103, -113, 53, -163, 3, 169, -47, 119, -97, 69, -147, 19, 185, -31, 135, -81, 85, -131, 35, -181, -15, 151, -65, 101, -115 -- (+69 chars; full line in the Zenodo source)
[-23, 145, -69, 99, -115, 53, -161, 7, 175, -39, 129, -85, 83, -131, 37, -177, -9, 159, -55, 113, -101, 67, -147, 21, 189, -25, 143, -71, 97, -117, 51, -163, 5, 173, -41, 127, -87, 81, -133, 35, -179, -11, 157, -57, 111, -103, 65, -149, 19, 187, -27, 141, -73, 95, -119, 49, -165, 3, 171, -43, 125, -89, 79, -135, 33, -181, -13, 155, -59, 109, -105, 63, -151, 17, 185, -29, 139, -75, 93, -121, 47, -- (+69 chars; full line in the Zenodo source)
[-21, 149, -63, 107, -105, 65, -147, 23, -189, -19, 151, -61, 109, -103, 67, -145, 25, -187, -17, 153, -59, 111, -101, 69, -143, 27, -185, -15, 155, -57, 113, -99, 71, -141, 29, -183, -13, 157, -55, 115, -97, 73, -139, 31, -181, -11, 159, -53, 117, -95, 75, -137, 33, -179, -9, 161, -51, 119, -93, 77, -135, 35, -177, -7, 163, -49, 121, -91, 79, -133, 37, -175, -5, 165, -47, 123, -89, 81, -131, 39 -- (+76 chars; full line in the Zenodo source)
[-19, 153, -57, 115, -95, 77, -133, 39, -171, 1, 173, -37, 135, -75, 97, -113, 59, -151, 21, -189, -17, 155, -55, 117, -93, 79, -131, 41, -169, 3, 175, -35, 137, -73, 99, -111, 61, -149, 23, -187, -15, 157, -53, 119, -91, 81, -129, 43, -167, 5, 177, -33, 139, -71, 101, -109, 63, -147, 25, -185, -13, 159, -51, 121, -89, 83, -127, 45, -165, 7, 179, -31, 141, -69, 103, -107, 65, -145, 27, -183, -11 -- (+70 chars; full line in the Zenodo source)
[-17, 157, -51, 123, -85, 89, -119, 55, -153, 21, -187, -13, 161, -47, 127, -81, 93, -115, 59, -149, 25, -183, -9, 165, -43, 131, -77, 97, -111, 63, -145, 29, -179, -5, 169, -39, 135, -73, 101, -107, 67, -141, 33, -175, -1, 173, -35, 139, -69, 105, -103, 71, -137, 37, -171, 3, 177, -31, 143, -65, 109, -99, 75, -133, 41, -167, 7, 181, -27, 147, -61, 113, -95, 79, -129, 45, -163, 11, 185, -23, 151 -- (+71 chars; full line in the Zenodo source)
[-15, 161, -45, 131, -75, 101, -105, 71, -135, 41, -165, 11, 187, -19, 157, -49, 127, -79, 97, -109, 67, -139, 37, -169, 7, 183, -23, 153, -53, 123, -83, 93, -113, 63, -143, 33, -173, 3, 179, -27, 149, -57, 119, -87, 89, -117, 59, -147, 29, -177, -1, 175, -31, 145, -61, 115, -91, 85, -121, 55, -151, 25, -181, -5, 171, -35, 141, -65, 111, -95, 81, -125, 51, -155, 21, -185, -9, 167, -39, 137, -69, -- (+71 chars; full line in the Zenodo source)
[-13, 165, -39, 139, -65, 113, -91, 87, -117, 61, -143, 35, -169, 9, 187, -17, 161, -43, 135, -69, 109, -95, 83, -121, 57, -147, 31, -173, 5, 183, -21, 157, -47, 131, -73, 105, -99, 79, -125, 53, -151, 27, -177, 1, 179, -25, 153, -51, 127, -77, 101, -103, 75, -129, 49, -155, 23, -181, -3, 175, -29, 149, -55, 123, -81, 97, -107, 71, -133, 45, -159, 19, -185, -7, 171, -33, 145, -59, 119, -85, 93, -- (+71 chars; full line in the Zenodo source)
[-11, 169, -33, 147, -55, 125, -77, 103, -99, 81, -121, 59, -143, 37, -165, 15, -187, -7, 173, -29, 151, -51, 129, -73, 107, -95, 85, -117, 63, -139, 41, -161, 19, -183, -3, 177, -25, 155, -47, 133, -69, 111, -91, 89, -113, 67, -135, 45, -157, 23, -179, 1, 181, -21, 159, -43, 137, -65, 115, -87, 93, -109, 71, -131, 49, -153, 27, -175, 5, 185, -17, 163, -39, 141, -61, 119, -83, 97, -105, 75, -127 -- (+70 chars; full line in the Zenodo source)
[-9, 173, -27, 155, -45, 137, -63, 119, -81, 101, -99, 83, -117, 65, -135, 47, -153, 29, -171, 11, -189, -7, 175, -25, 157, -43, 139, -61, 121, -79, 103, -97, 85, -115, 67, -133, 49, -151, 31, -169, 13, -187, -5, 177, -23, 159, -41, 141, -59, 123, -77, 105, -95, 87, -113, 69, -131, 51, -149, 33, -167, 15, -185, -3, 179, -21, 161, -39, 143, -57, 125, -75, 107, -93, 89, -111, 71, -129, 53, -147, 3 -- (+73 chars; full line in the Zenodo source)
[-7, 177, -21, 163, -35, 149, -49, 135, -63, 121, -77, 107, -91, 93, -105, 79, -119, 65, -133, 51, -147, 37, -161, 23, -175, 9, -189, -5, 179, -19, 165, -33, 151, -47, 137, -61, 123, -75, 109, -89, 95, -103, 81, -117, 67, -131, 53, -145, 39, -159, 25, -173, 11, -187, -3, 181, -17, 167, -31, 153, -45, 139, -59, 125, -73, 111, -87, 97, -101, 83, -115, 69, -129, 55, -143, 41, -157, 27, -171, 13, -1 -- (+72 chars; full line in the Zenodo source)
[-5, 181, -15, 171, -25, 161, -35, 151, -45, 141, -55, 131, -65, 121, -75, 111, -85, 101, -95, 91, -105, 81, -115, 71, -125, 61, -135, 51, -145, 41, -155, 31, -165, 21, -175, 11, -185, 1, 187, -9, 177, -19, 167, -29, 157, -39, 147, -49, 137, -59, 127, -69, 117, -79, 107, -89, 97, -99, 87, -109, 77, -119, 67, -129, 57, -139, 47, -149, 37, -159, 27, -169, 17, -179, 7, -189, -3, 183, -13, 173, -23, -- (+71 chars; full line in the Zenodo source)
[-3, 185, -9, 179, -15, 173, -21, 167, -27, 161, -33, 155, -39, 149, -45, 143, -51, 137, -57, 131, -63, 125, -69, 119, -75, 113, -81, 107, -87, 101, -93, 95, -99, 89, -105, 83, -111, 77, -117, 71, -123, 65, -129, 59, -135, 53, -141, 47, -147, 41, -153, 35, -159, 29, -165, 23, -171, 17, -177, 11, -183, 5, -189, -1, 187, -7, 181, -13, 175, -19, 169, -25, 163, -31, 157, -37, 151, -43, 145, -49, 139 -- (+71 chars; full line in the Zenodo source)
[-1, 189, -3, 187, -5, 185, -7, 183, -9, 181, -11, 179, -13, 177, -15, 175, -17, 173, -19, 171, -21, 169, -23, 167, -25, 165, -27, 163, -29, 161, -31, 159, -33, 157, -35, 155, -37, 153, -39, 151, -41, 149, -43, 147, -45, 145, -47, 143, -49, 141, -51, 139, -53, 137, -55, 135, -57, 133, -59, 131, -61, 129, -63, 127, -65, 125, -67, 123, -69, 121, -71, 119, -73, 117, -75, 115, -77, 113, -79, 111, -8 -- (+71 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[-2148037367661829908916777931991054, -5706073557235868088537532276143302, 4556883115634912859183148378772624, 3917017278270375732558298163339877, -5742166428533267901243252253170535, -5089159274084254531943654522511589, -3595218154950078040090025878346971, -6162350293745420091659908267760811, -4254577314852752206366611190928339, 5647734844005478925027394442951837, -83137855221011893299374622319 -- (+3134 chars; full line in the Zenodo source)
[-5706073557235868088537532276143302, 3917017278270375732558298163339877, -5089159274084254531943654522511589, -6162350293745420091659908267760811, 5647734844005478925027394442951837, -2470866729613106669996640241767897, -3373762068013276906262906066961206, -3841921053058813217850676956380847, -2398777957970873362801738037112570, -11134736578998021706326692630349437, 2933233261990168078071021509 -- (+3088 chars; full line in the Zenodo source)
[4556883115634912859183148378772624, -5089159274084254531943654522511589, -4254577314852752206366611190928339, -2470866729613106669996640241767897, -6839097942721268784209035519124666, -2398777957970873362801738037112570, -7702391536483808562987561014951728, -3814774911092407102387708803455449, -14905217900763917002479341558715502, -7774327231242128336395489997589478, -69259123108449935000234813 -- (+3102 chars; full line in the Zenodo source)
[3917017278270375732558298163339877, -6162350293745420091659908267760811, -2470866729613106669996640241767897, -3841921053058813217850676956380847, -11134736578998021706326692630349437, -3814774911092407102387708803455449, -6662935311148711117964726119029742, -11397739665390512561013284206328389, -7319335572251190795385706189559581, -1499211915244043279217134748086716, -1067969643332793139308668 -- (+3102 chars; full line in the Zenodo source)
[-5742166428533267901243252253170535, 5647734844005478925027394442951837, -6839097942721268784209035519124666, -11134736578998021706326692630349437, -10365565376701857523748056051318217, -7774327231242128336395489997589478, -15648111419102413096985044558455843, -1499211915244043279217134748086716, -8396711824261018345446931603141434, -10077808763575288468692622559076634, -12780230909553612572023 -- (+3100 chars; full line in the Zenodo source)
[-5089159274084254531943654522511589, -2470866729613106669996640241767897, -2398777957970873362801738037112570, -3814774911092407102387708803455449, -7774327231242128336395489997589478, -7319335572251190795385706189559581, -9186762180018959352812293734386419, -4637181858677999277684398784143902, 1116607533608942001025001286429279, -4305610229167964871879582928818630, -592052242269475319144391258 -- (+3104 chars; full line in the Zenodo source)
[-3595218154950078040090025878346971, -3373762068013276906262906066961206, -7702391536483808562987561014951728, -6662935311148711117964726119029742, -15648111419102413096985044558455843, -9186762180018959352812293734386419, -14870138275297940756147603233736832, -11488878649029741209776299689382260, -9947231694784034054628665777251280, 433419875907855083338243792253912, -1387276906597993530459656 -- (+3099 chars; full line in the Zenodo source)
[-6162350293745420091659908267760811, -3841921053058813217850676956380847, -3814774911092407102387708803455449, -11397739665390512561013284206328389, -1499211915244043279217134748086716, -4637181858677999277684398784143902, -11488878649029741209776299689382260, 2039720289490758357426040603200527, -1571130500572986311765638341503161, -5359569999461124967653292516101419, 11387545838968015499677185 -- (+3098 chars; full line in the Zenodo source)
[-4254577314852752206366611190928339, -2398777957970873362801738037112570, -14905217900763917002479341558715502, -7319335572251190795385706189559581, -8396711824261018345446931603141434, 1116607533608942001025001286429279, -9947231694784034054628665777251280, -1571130500572986311765638341503161, -7669068501734015357619311009672218, 8565114431728714037483389650917677, 1226522986799303287836126096 -- (+3098 chars; full line in the Zenodo source)
[5647734844005478925027394442951837, -11134736578998021706326692630349437, -7774327231242128336395489997589478, -1499211915244043279217134748086716, -10077808763575288468692622559076634, -4305610229167964871879582928818630, 433419875907855083338243792253912, -5359569999461124967653292516101419, 8565114431728714037483389650917677, 9434791964034698394065728494373611, 766906850173401535761931100967 -- (+3100 chars; full line in the Zenodo source)
[-8313785522101189329937462231903813, 293323326199016807807102150967402, -6925912310844993500023481387724011, -10679696433327931393086681239698373, -12780230909553612572023122454705119, -5920522422694753191443912587742501, -13872769065979935304596569680159749, 1138754583896801549967718564456788, 1226522986799303287836126096550734, 7669068501734015357619311009672218, -4334198759078550833382437922 -- (+3099 chars; full line in the Zenodo source)
[-2470866729613106669996640241767897, -3814774911092407102387708803455449, -7319335572251190795385706189559581, -4637181858677999277684398784143902, -4305610229167964871879582928818630, -1571130500572986311765638341503161, 7407434120618542416750500074527478, 7313210954977600273772299832316081, 12326673350921369910073319190787781, 17510796305966744962081303867666424, 14234158744806816397702818318 -- (+3100 chars; full line in the Zenodo source)
[-2638872637456277338317386896085270, -10111357952269891986070581888747570, -12130439576626410295872089923287331, -2068479559971164991024408234777875, -16343114466190371402045280822044181, -65906791795021406377067510241689, -9434791964034698394065728494373611, 3554082161837615122321313235304036, 3509774636222423022598621829950430, 16528350039576134282542039313232980, 4637181858677999277684398784 -- (+3102 chars; full line in the Zenodo source)
[-3373762068013276906262906066961206, -6662935311148711117964726119029742, -9186762180018959352812293734386419, -11488878649029741209776299689382260, 433419875907855083338243792253912, 7407434120618542416750500074527478, 4007072742768070563330755381773587, 14002627630196082443336881268842436, 16343114466190371402045280822044181, 14493041062383986071675381347602098, 154375327574223642929869913833 -- (+3101 chars; full line in the Zenodo source)
[-6839097942721268784209035519124666, -7774327231242128336395489997589478, -8396711824261018345446931603141434, -4305610229167964871879582928818630, -7970871573821519140214053860378381, 8565114431728714037483389650917677, 7394506717034019430993143813630997, 17510796305966744962081303867666424, 11488878649029741209776299689382260, 20881983990383529731350530727569585, 10111357952269891986070581888 -- (+3100 chars; full line in the Zenodo source)
[-3841921053058813217850676956380847, -11397739665390512561013284206328389, -4637181858677999277684398784143902, 2039720289490758357426040603200527, -5359569999461124967653292516101419, 7313210954977600273772299832316081, 14002627630196082443336881268842436, 9947231694784034054628665777251280, 18087039840060826373058219776995483, 10760963026797642930426088244316279, 68390979427212687842090355191 -- (+3094 chars; full line in the Zenodo source)
[-6192521770178672774697733222776785, -2772220046262813624204370999077189, -14493041062383986071675381347602098, -7833604190551782394864448196719247, -11273202987865597066916905097792035, 7371547163342007761799731280923483, 1571130500572986311765638341503161, 12780230909553612572023122454705119, 10652783769754573564423992026429076, 7702391536483808562987561014951728, -391701727827037573255829816 -- (+3100 chars; full line in the Zenodo source)
[-2398777957970873362801738037112570, -7319335572251190795385706189559581, 1116607533608942001025001286429279, -1571130500572986311765638341503161, 8565114431728714037483389650917677, 12326673350921369910073319190787781, 16343114466190371402045280822044181, 18087039840060826373058219776995483, 8359552705022370264898556022851979, 8313785522101189329937462231903813, -359521815495007804009002587834 -- (+3098 chars; full line in the Zenodo source)
[-6499609955529844407612176707882891, -10652783769754573564423992026429076, -16852621312770742028388902817413316, -4309519397984799282901607160609128, -7313210954977600273772299832316081, 13872769065979935304596569680159749, 4695812428872045813345033521597773, 12130439576626410295872089923287331, 11134736578998021706326692630349437, 2148037367661829908916777931991054, -23987779579708733628017380 -- (+3101 chars; full line in the Zenodo source)
[-11134736578998021706326692630349437, -1499211915244043279217134748086716, -4305610229167964871879582928818630, -5359569999461124967653292516101419, 9434791964034698394065728494373611, 17510796305966744962081303867666424, 14493041062383986071675381347602098, 10760963026797642930426088244316279, 8313785522101189329937462231903813, -4254577314852752206366611190928339, -835955270502237026489855602 -- (+3104 chars; full line in the Zenodo source)
[-7702391536483808562987561014951728, -9186762180018959352812293734386419, -9947231694784034054628665777251280, 7407434120618542416750500074527478, 7394506717034019430993143813630997, 16343114466190371402045280822044181, 10679696433327931393086681239698373, 12564703493105890689435233930787672, 5706073557235868088537532276143302, -6499609955529844407612176707882891, -14992119152440432792171347480 -- (+3101 chars; full line in the Zenodo source)
[293323326199016807807102150967402, -10679696433327931393086681239698373, -5920522422694753191443912587742501, 1138754583896801549967718564456788, 7669068501734015357619311009672218, 14234158744806816397702818318742003, 15437532757422364292986991383300900, 6839097942721268784209035519124666, -3595218154950078040090025878346971, -8359552705022370264898556022851979, -144930410623839860716753813476 -- (+3099 chars; full line in the Zenodo source)
[-12564703493105890689435233930787672, -5226484826701436981084805345303997, -6451711572978971526992383411476124, -1226522986799303287836126096550734, 4309519397984799282901607160609128, 17711429839776097040925196276736894, 7774327231242128336395489997589478, 3595218154950078040090025878346971, -3841921053058813217850676956380847, -12130439576626410295872089923287331, -114339996525890306235765373 -- (+3100 chars; full line in the Zenodo source)
[-3814774911092407102387708803455449, -4637181858677999277684398784143902, -1571130500572986311765638341503161, 7313210954977600273772299832316081, 17510796305966744962081303867666424, 18087039840060826373058219776995483, 12564703493105890689435233930787672, -2148037367661829908916777931991054, -10365565376701857523748056051318217, -14870138275297940756147603233736832, -4738739422554141002114270 -- (+3100 chars; full line in the Zenodo source)
[-10365565376701857523748056051318217, -10077808763575288468692622559076634, -7970871573821519140214053860378381, 9434791964034698394065728494373611, 5920522422694753191443912587742501, 20881983990383529731350530727569585, 3841921053058813217850676956380847, -4254577314852752206366611190928339, -2772220046262813624204370999077189, -14234158744806816397702818318742003, 740743412061854241675050007 -- (+3098 chars; full line in the Zenodo source)
[-10111357952269891986070581888747570, -2068479559971164991024408234777875, -65906791795021406377067510241689, 3554082161837615122321313235304036, 16528350039576134282542039313232980, 15648111419102413096985044558455843, 4254577314852752206366611190928339, -6192521770178672774697733222776785, -8766399359570639272036053477585532, -6451711572978971526992383411476124, -73132109549776002737722998323 -- (+3104 chars; full line in the Zenodo source)
[-14905217900763917002479341558715502, 1116607533608942001025001286429279, -7669068501734015357619311009672218, 12326673350921369910073319190787781, 11488878649029741209776299689382260, 8359552705022370264898556022851979, 5706073557235868088537532276143302, -10365565376701857523748056051318217, -2068479559971164991024408234777875, -14002627630196082443336881268842436, 112732029878655970669169050 -- (+3098 chars; full line in the Zenodo source)
[-6662935311148711117964726119029742, -11488878649029741209776299689382260, 7407434120618542416750500074527478, 14002627630196082443336881268842436, 14493041062383986071675381347602098, 12564703493105890689435233930787672, -5742166428533267901243252253170535, -6925912310844993500023481387724011, -16528350039576134282542039313232980, -7371547163342007761799731280923483, 35097746362224230225986218 -- (+3099 chars; full line in the Zenodo source)
[-8359552705022370264898556022851979, -4695812428872045813345033521597773, -3554082161837615122321313235304036, 7970871573821519140214053860378381, 5226484826701436981084805345303997, 6192521770178672774697733222776785, -2470866729613106669996640241767897, -20881983990383529731350530727569585, 433419875907855083338243792253912, 1226522986799303287836126096550734, 99472316947840340546286657772512 -- (+3101 chars; full line in the Zenodo source)
[-7774327231242128336395489997589478, -4305610229167964871879582928818630, 8565114431728714037483389650917677, 17510796305966744962081303867666424, 20881983990383529731350530727569585, 8313785522101189329937462231903813, -6499609955529844407612176707882891, -14870138275297940756147603233736832, -14002627630196082443336881268842436, -4561504299796149486159309768763379, 206847955997116499102440823 -- (+3100 chars; full line in the Zenodo source)
[-10760963026797642930426088244316279, -11433999652589030623576537356141542, -4007072742768070563330755381773587, 21168085622054916227707504195830178, 7319335572251190795385706189559581, 5742166428533267901243252253170535, -10111357952269891986070581888747570, -16852621312770742028388902817413316, 1138754583896801549967718564456788, 1571130500572986311765638341503161, 208819839903835297313505307 -- (+3099 chars; full line in the Zenodo source)
[-11397739665390512561013284206328389, 2039720289490758357426040603200527, 7313210954977600273772299832316081, 9947231694784034054628665777251280, 10760963026797642930426088244316279, -2148037367661829908916777931991054, -6925912310844993500023481387724011, -16343114466190371402045280822044181, -13045110041677392365308655598929545, 11433999652589030623576537356141542, 777432723124212833639548999 -- (+3100 chars; full line in the Zenodo source)
[-6925912310844993500023481387724011, -5920522422694753191443912587742501, 1226522986799303287836126096550734, 14234158744806816397702818318742003, 10111357952269891986070581888747570, -3595218154950078040090025878346971, -1499211915244043279217134748086716, -4738739422554141002114270697589554, 11273202987865597066916905097792035, 2068479559971164991024408234777875, 64996099555298444076121767078 -- (+3099 chars; full line in the Zenodo source)
[-2772220046262813624204370999077189, -7833604190551782394864448196719247, 7371547163342007761799731280923483, 12780230909553612572023122454705119, 7702391536483808562987561014951728, -2638872637456277338317386896085270, -18087039840060826373058219776995483, -7669068501734015357619311009672218, 4309519397984799282901607160609128, 9186762180018959352812293734386419, 616235029374542009165990826776 -- (+3098 chars; full line in the Zenodo source)
[-15648111419102413096985044558455843, 433419875907855083338243792253912, 7394506717034019430993143813630997, 14493041062383986071675381347602098, 3841921053058813217850676956380847, -6499609955529844407612176707882891, 1116607533608942001025001286429279, -7371547163342007761799731280923483, 21168085622054916227707504195830178, 11397739665390512561013284206328389, 4556883115634912859183148378772 -- (+3099 chars; full line in the Zenodo source)
[-7319335572251190795385706189559581, -1571130500572986311765638341503161, 12326673350921369910073319190787781, 18087039840060826373058219776995483, 8313785522101189329937462231903813, -10365565376701857523748056051318217, -16528350039576134282542039313232980, -13045110041677392365308655598929545, 4695812428872045813345033521597773, -293323326199016807807102150967402, -33737620680132769062629060 -- (+3100 chars; full line in the Zenodo source)
[-15437532757422364292986991383300900, -3509774636222423022598621829950430, 5359569999461124967653292516101419, 8766399359570639272036053477585532, 5089159274084254531943654522511589, -10760963026797642930426088244316279, -7833604190551782394864448196719247, 7394506717034019430993143813630997, 14870138275297940756147603233736832, 2470866729613106669996640241767897, -10365565376701857523748056051 -- (+3101 chars; full line in the Zenodo source)
[-10652783769754573564423992026429076, -4309519397984799282901607160609128, 13872769065979935304596569680159749, 12130439576626410295872089923287331, 2148037367661829908916777931991054, -15437532757422364292986991383300900, -7970871573821519140214053860378381, 65906791795021406377067510241689, 1499211915244043279217134748086716, 5706073557235868088537532276143302, -731933557225119079538570618955 -- (+3095 chars; full line in the Zenodo source)
[-12130439576626410295872089923287331, -65906791795021406377067510241689, 3509774636222423022598621829950430, 15648111419102413096985044558455843, 3917017278270375732558298163339877, -8766399359570639272036053477585532, 4561504299796149486159309768763379, -433419875907855083338243792253912, 10760963026797642930426088244316279, -6162350293745420091659908267760811, -1808703984006082637305821977699 -- (+3102 chars; full line in the Zenodo source)
[-1499211915244043279217134748086716, -5359569999461124967653292516101419, 17510796305966744962081303867666424, 10760963026797642930426088244316279, -4254577314852752206366611190928339, -14870138275297940756147603233736832, -7371547163342007761799731280923483, 11433999652589030623576537356141542, -293323326199016807807102150967402, -2398777957970873362801738037112570, -46958124288720458133450335 -- (+3100 chars; full line in the Zenodo source)
[-20881983990383529731350530727569585, 4561504299796149486159309768763379, 7833604190551782394864448196719247, 14905217900763917002479341558715502, -3373762068013276906262906066961206, -12780230909553612572023122454705119, 7313210954977600273772299832316081, -1116607533608942001025001286429279, 2638872637456277338317386896085270, -6662935311148711117964726119029742, -6451711572978971526992383411 -- (+3099 chars; full line in the Zenodo source)
[-9186762180018959352812293734386419, 7407434120618542416750500074527478, 16343114466190371402045280822044181, 12564703493105890689435233930787672, -6499609955529844407612176707882891, -16528350039576134282542039313232980, -1138754583896801549967718564456788, 5226484826701436981084805345303997, -3917017278270375732558298163339877, -10652783769754573564423992026429076, -53595699994611249676532925 -- (+3097 chars; full line in the Zenodo source)
[-8766399359570639272036053477585532, -7394506717034019430993143813630997, 11433999652589030623576537356141542, 6499609955529844407612176707882891, -3814774911092407102387708803455449, -21168085622054916227707504195830178, 7669068501734015357619311009672218, 10652783769754573564423992026429076, -5742166428533267901243252253170535, -4637181858677999277684398784143902, -943479196403469839406572849 -- (+3102 chars; full line in the Zenodo source)
[-10679696433327931393086681239698373, 1138754583896801549967718564456788, 14234158744806816397702818318742003, 6839097942721268784209035519124666, -8359552705022370264898556022851979, -4738739422554141002114270697589554, 3509774636222423022598621829950430, 7774327231242128336395489997589478, -3373762068013276906262906066961206, -4695812428872045813345033521597773, 737154716334200776179973128092 -- (+3095 chars; full line in the Zenodo source)
[-8396711824261018345446931603141434, 8565114431728714037483389650917677, 11488878649029741209776299689382260, 8313785522101189329937462231903813, -2772220046262813624204370999077189, -14002627630196082443336881268842436, 21168085622054916227707504195830178, -293323326199016807807102150967402, -12564703493105890689435233930787672, -7833604190551782394864448196719247, 6590679179502140637706751024 -- (+3100 chars; full line in the Zenodo source)
[-5226484826701436981084805345303997, -1226522986799303287836126096550734, 17711429839776097040925196276736894, 3595218154950078040090025878346971, -12130439576626410295872089923287331, -11273202987865597066916905097792035, 4305610229167964871879582928818630, 3373762068013276906262906066961206, -11397739665390512561013284206328389, -65906791795021406377067510241689, 21168085622054916227707504195 -- (+3098 chars; full line in the Zenodo source)
[-18087039840060826373058219776995483, 13045110041677392365308655598929545, 10077808763575288468692622559076634, -4556883115634912859183148378772624, -10679696433327931393086681239698373, -9434791964034698394065728494373611, 17711429839776097040925196276736894, 5089159274084254531943654522511589, -20881983990383529731350530727569585, 1138754583896801549967718564456788, 11488878649029741209776299 -- (+3097 chars; full line in the Zenodo source)
[-4637181858677999277684398784143902, 7313210954977600273772299832316081, 18087039840060826373058219776995483, -2148037367661829908916777931991054, -14870138275297940756147603233736832, -13045110041677392365308655598929545, 5226484826701436981084805345303997, -5706073557235868088537532276143302, -10077808763575288468692622559076634, 4007072742768070563330755381773587, 839671182426101834544693160 -- (+3096 chars; full line in the Zenodo source)
[-14870138275297940756147603233736832, 4007072742768070563330755381773587, 10679696433327931393086681239698373, -5742166428533267901243252253170535, 1116607533608942001025001286429279, -1138754583896801549967718564456788, 12130439576626410295872089923287331, 5647734844005478925027394442951837, -14234158744806816397702818318742003, 12326673350921369910073319190787781, 2772220046262813624204370999 -- (+3096 chars; full line in the Zenodo source)
[-10077808763575288468692622559076634, 9434791964034698394065728494373611, 20881983990383529731350530727569585, -4254577314852752206366611190928339, -14234158744806816397702818318742003, -4561504299796149486159309768763379, 11397739665390512561013284206328389, -2398777957970873362801738037112570, -7833604190551782394864448196719247, 4738739422554141002114270697589554, 125647034931058906894352339 -- (+3098 chars; full line in the Zenodo source)
[-14493041062383986071675381347602098, 7371547163342007761799731280923483, 10652783769754573564423992026429076, -2638872637456277338317386896085270, 2039720289490758357426040603200527, 4309519397984799282901607160609128, 10365565376701857523748056051318217, -10111357952269891986070581888747570, -13872769065979935304596569680159749, 9947231694784034054628665777251280, 2470866729613106669996640241 -- (+3098 chars; full line in the Zenodo source)
[-2068479559971164991024408234777875, 3554082161837615122321313235304036, 15648111419102413096985044558455843, -6192521770178672774697733222776785, -6451711572978971526992383411476124, -433419875907855083338243792253912, 2398777957970873362801738037112570, -2772220046262813624204370999077189, -7394506717034019430993143813630997, 17711429839776097040925196276736894, 214803736766182990891677793199 -- (+3098 chars; full line in the Zenodo source)
[-17711429839776097040925196276736894, 11273202987865597066916905097792035, 11397739665390512561013284206328389, -7702391536483808562987561014951728, -3509774636222423022598621829950430, -2039720289490758357426040603200527, 8313785522101189329937462231903813, -9186762180018959352812293734386419, -7313210954977600273772299832316081, 8766399359570639272036053477585532, 5647734844005478925027394442 -- (+3101 chars; full line in the Zenodo source)
[1116607533608942001025001286429279, 12326673350921369910073319190787781, 8359552705022370264898556022851979, -10365565376701857523748056051318217, -14002627630196082443336881268842436, 4695812428872045813345033521597773, -3917017278270375732558298163339877, -10077808763575288468692622559076634, 3554082161837615122321313235304036, 6925912310844993500023481387724011, -7702391536483808562987561014 -- (+3098 chars; full line in the Zenodo source)
[-12780230909553612572023122454705119, 7669068501734015357619311009672218, 10111357952269891986070581888747570, -8359552705022370264898556022851979, 7407434120618542416750500074527478, 2068479559971164991024408234777875, 4556883115634912859183148378772624, -4695812428872045813345033521597773, 65906791795021406377067510241689, 12564703493105890689435233930787672, -11397739665390512561013284206328 -- (+3093 chars; full line in the Zenodo source)
[-11488878649029741209776299689382260, 14002627630196082443336881268842436, 12564703493105890689435233930787672, -6925912310844993500023481387724011, -7371547163342007761799731280923483, 5226484826701436981084805345303997, 5647734844005478925027394442951837, -5920522422694753191443912587742501, 6451711572978971526992383411476124, 2638872637456277338317386896085270, -87663993595706392720360534775 -- (+3097 chars; full line in the Zenodo source)
[-16852621312770742028388902817413316, 13872769065979935304596569680159749, 11134736578998021706326692630349437, -15437532757422364292986991383300900, 13045110041677392365308655598929545, 1499211915244043279217134748086716, -6192521770178672774697733222776785, -3509774636222423022598621829950430, 4305610229167964871879582928818630, -4556883115634912859183148378772624, 111660753360894200102500128 -- (+3095 chars; full line in the Zenodo source)
[-4695812428872045813345033521597773, 7970871573821519140214053860378381, 6192521770178672774697733222776785, -20881983990383529731350530727569585, 1226522986799303287836126096550734, 2772220046262813624204370999077189, -3814774911092407102387708803455449, 4561504299796149486159309768763379, 14493041062383986071675381347602098, -3595218154950078040090025878346971, -163431144661903714020452808220 -- (+3101 chars; full line in the Zenodo source)
[-14234158744806816397702818318742003, 4738739422554141002114270697589554, 3373762068013276906262906066961206, -8396711824261018345446931603141434, 3554082161837615122321313235304036, 6662935311148711117964726119029742, -10760963026797642930426088244316279, 8565114431728714037483389650917677, 9186762180018959352812293734386419, -6192521770178672774697733222776785, -430951939798479928290160716060 -- (+3098 chars; full line in the Zenodo source)
[-4305610229167964871879582928818630, 17510796305966744962081303867666424, 8313785522101189329937462231903813, -14870138275297940756147603233736832, -4561504299796149486159309768763379, -293323326199016807807102150967402, -10652783769754573564423992026429076, 4007072742768070563330755381773587, 6925912310844993500023481387724011, -14905217900763917002479341558715502, -355408216183761512232131323 -- (+3096 chars; full line in the Zenodo source)
[-16528350039576134282542039313232980, 6451711572978971526992383411476124, 6162350293745420091659908267760811, -17711429839776097040925196276736894, 13872769065979935304596569680159749, 3841921053058813217850676956380847, -8396711824261018345446931603141434, 11273202987865597066916905097792035, 3814774911092407102387708803455449, -15437532757422364292986991383300900, 4007072742768070563330755381 -- (+3101 chars; full line in the Zenodo source)
[-11433999652589030623576537356141542, 21168085622054916227707504195830178, 5742166428533267901243252253170535, -16852621312770742028388902817413316, 1571130500572986311765638341503161, -5647734844005478925027394442951837, -2068479559971164991024408234777875, 13872769065979935304596569680159749, 6839097942721268784209035519124666, -18087039840060826373058219776995483, -45615042997961494861593097 -- (+3095 chars; full line in the Zenodo source)
[-9947231694784034054628665777251280, 16343114466190371402045280822044181, 5706073557235868088537532276143302, -16528350039576134282542039313232980, 21168085622054916227707504195830178, -3917017278270375732558298163339877, -14234158744806816397702818318742003, 6451711572978971526992383411476124, 5089159274084254531943654522511589, -16852621312770742028388902817413316, 175107963059667449620813038 -- (+3095 chars; full line in the Zenodo source)
[2039720289490758357426040603200527, 9947231694784034054628665777251280, -2148037367661829908916777931991054, -16343114466190371402045280822044181, 11433999652589030623576537356141542, -5706073557235868088537532276143302, -5920522422694753191443912587742501, 16528350039576134282542039313232980, 4556883115634912859183148378772624, -21168085622054916227707504195830178, 4305610229167964871879582928 -- (+3104 chars; full line in the Zenodo source)
[-16343114466190371402045280822044181, 16528350039576134282542039313232980, 3917017278270375732558298163339877, -6451711572978971526992383411476124, 16852621312770742028388902817413316, -6162350293745420091659908267760811, -4738739422554141002114270697589554, 17711429839776097040925196276736894, -2470866729613106669996640241767897, -13872769065979935304596569680159749, 14870138275297940756147603 -- (+3100 chars; full line in the Zenodo source)
[-5920522422694753191443912587742501, 14234158744806816397702818318742003, -3595218154950078040090025878346971, -4738739422554141002114270697589554, 2068479559971164991024408234777875, -3373762068013276906262906066961206, -5359569999461124967653292516101419, 8396711824261018345446931603141434, -7702391536483808562987561014951728, -3554082161837615122321313235304036, 10652783769754573564423992026 -- (+3099 chars; full line in the Zenodo source)
[-21168085622054916227707504195830178, 16852621312770742028388902817413316, 5647734844005478925027394442951837, -13872769065979935304596569680159749, 18087039840060826373058219776995483, -11134736578998021706326692630349437, -3554082161837615122321313235304036, 15437532757422364292986991383300900, -7774327231242128336395489997589478, -13045110041677392365308655598929545, 149052179007639170024793 -- (+3100 chars; full line in the Zenodo source)
[-7833604190551782394864448196719247, 12780230909553612572023122454705119, -2638872637456277338317386896085270, -7669068501734015357619311009672218, 9186762180018959352812293734386419, -10111357952269891986070581888747570, 13045110041677392365308655598929545, 8359552705022370264898556022851979, -12130439576626410295872089923287331, -7407434120618542416750500074527478, 384192105305881321785067695 -- (+3102 chars; full line in the Zenodo source)
[-6451711572978971526992383411476124, 17711429839776097040925196276736894, -3841921053058813217850676956380847, -11273202987865597066916905097792035, 15437532757422364292986991383300900, -11397739665390512561013284206328389, -8565114431728714037483389650917677, 7702391536483808562987561014951728, -4637181858677999277684398784143902, 3509774636222423022598621829950430, 574216642853326790124325225 -- (+3100 chars; full line in the Zenodo source)
[433419875907855083338243792253912, 14493041062383986071675381347602098, -6499609955529844407612176707882891, -7371547163342007761799731280923483, 11397739665390512561013284206328389, -10652783769754573564423992026429076, 12326673350921369910073319190787781, 2638872637456277338317386896085270, -16852621312770742028388902817413316, -2039720289490758357426040603200527, -508915927408425453194365452 -- (+3099 chars; full line in the Zenodo source)
[-17510796305966744962081303867666424, 14870138275297940756147603233736832, 293323326199016807807102150967402, -4007072742768070563330755381773587, 14905217900763917002479341558715502, -10679696433327931393086681239698373, 4309519397984799282901607160609128, 5742166428533267901243252253170535, -5920522422694753191443912587742501, -1116607533608942001025001286429279, -6192521770178672774697733222 -- (+3101 chars; full line in the Zenodo source)
[-1571130500572986311765638341503161, 18087039840060826373058219776995483, -10365565376701857523748056051318217, -13045110041677392365308655598929545, -293323326199016807807102150967402, -10077808763575288468692622559076634, 6451711572978971526992383411476124, 4556883115634912859183148378772624, -7970871573821519140214053860378381, 10679696433327931393086681239698373, -66629353111487111179647261 -- (+3104 chars; full line in the Zenodo source)
[-4738739422554141002114270697589554, 8396711824261018345446931603141434, -6662935311148711117964726119029742, -8565114431728714037483389650917677, 6192521770178672774697733222776785, -11488878649029741209776299689382260, 11433999652589030623576537356141542, -8313785522101189329937462231903813, 7407434120618542416750500074527478, 2772220046262813624204370999077189, -12130439576626410295872089923 -- (+3093 chars; full line in the Zenodo source)
[-3509774636222423022598621829950430, 8766399359570639272036053477585532, -10760963026797642930426088244316279, 7394506717034019430993143813630997, 2470866729613106669996640241767897, -11433999652589030623576537356141542, 12780230909553612572023122454705119, -6499609955529844407612176707882891, -4007072742768070563330755381773587, 3814774911092407102387708803455449, -1007780876357528846869262255 -- (+3101 chars; full line in the Zenodo source)
[-7970871573821519140214053860378381, 20881983990383529731350530727569585, -2772220046262813624204370999077189, -4561504299796149486159309768763379, 3595218154950078040090025878346971, -7833604190551782394864448196719247, 4637181858677999277684398784143902, -14905217900763917002479341558715502, 7371547163342007761799731280923483, 3373762068013276906262906066961206, -16528350039576134282542039313 -- (+3102 chars; full line in the Zenodo source)
[-4309519397984799282901607160609128, 12130439576626410295872089923287331, -15437532757422364292986991383300900, 65906791795021406377067510241689, 5706073557235868088537532276143302, -3509774636222423022598621829950430, 20881983990383529731350530727569585, -15648111419102413096985044558455843, 5359569999461124967653292516101419, -3917017278270375732558298163339877, -15711305005729863117656383415 -- (+3103 chars; full line in the Zenodo source)
[-13872769065979935304596569680159749, 15437532757422364292986991383300900, -1499211915244043279217134748086716, 3509774636222423022598621829950430, 4556883115634912859183148378772624, -5359569999461124967653292516101419, 2772220046262813624204370999077189, -8766399359570639272036053477585532, 17510796305966744962081303867666424, -5089159274084254531943654522511589, -1232667335092136991007331919 -- (+3100 chars; full line in the Zenodo source)
[-65906791795021406377067510241689, 15648111419102413096985044558455843, -8766399359570639272036053477585532, -433419875907855083338243792253912, -6162350293745420091659908267760811, -7394506717034019430993143813630997, 14905217900763917002479341558715502, -14493041062383986071675381347602098, 11433999652589030623576537356141542, -3841921053058813217850676956380847, 13045110041677392365308655598 -- (+3102 chars; full line in the Zenodo source)
[-14002627630196082443336881268842436, 6925912310844993500023481387724011, -5226484826701436981084805345303997, 5920522422694753191443912587742501, -2638872637456277338317386896085270, -1226522986799303287836126096550734, 11134736578998021706326692630349437, -14234158744806816397702818318742003, 17711429839776097040925196276736894, -10111357952269891986070581888747570, 73945067170340194309931438 -- (+3098 chars; full line in the Zenodo source)
[-5359569999461124967653292516101419, 10760963026797642930426088244316279, -14870138275297940756147603233736832, 11433999652589030623576537356141542, -2398777957970873362801738037112570, 4007072742768070563330755381773587, 2638872637456277338317386896085270, -21168085622054916227707504195830178, 10679696433327931393086681239698373, -7319335572251190795385706189559581, 797087157382151914021405386 -- (+3094 chars; full line in the Zenodo source)
[-7669068501734015357619311009672218, 8359552705022370264898556022851979, -2068479559971164991024408234777875, 4695812428872045813345033521597773, -12564703493105890689435233930787672, 3554082161837615122321313235304036, 5089159274084254531943654522511589, -7970871573821519140214053860378381, 15648111419102413096985044558455843, -5226484826701436981084805345303997, -20397202894907583574260406032 -- (+3098 chars; full line in the Zenodo source)
[4561504299796149486159309768763379, 14905217900763917002479341558715502, -12780230909553612572023122454705119, -1116607533608942001025001286429279, -6662935311148711117964726119029742, 7669068501734015357619311009672218, -2148037367661829908916777931991054, -12326673350921369910073319190787781, 10111357952269891986070581888747570, -11488878649029741209776299689382260, 17711429839776097040925196 -- (+3099 chars; full line in the Zenodo source)
[-12326673350921369910073319190787781, 10365565376701857523748056051318217, -4695812428872045813345033521597773, 10077808763575288468692622559076634, -6925912310844993500023481387724011, 7970871573821519140214053860378381, -6162350293745420091659908267760811, -9434791964034698394065728494373611, 6192521770178672774697733222776785, -5920522422694753191443912587742501, 9186762180018959352812293734 -- (+3097 chars; full line in the Zenodo source)
[7407434120618542416750500074527478, 12564703493105890689435233930787672, -16528350039576134282542039313232980, 5226484826701436981084805345303997, -10652783769754573564423992026429076, 6451711572978971526992383411476124, -6839097942721268784209035519124666, 1226522986799303287836126096550734, 6162350293745420091659908267760811, -4309519397984799282901607160609128, 107609630267976429304260882443 -- (+3097 chars; full line in the Zenodo source)
[-11273202987865597066916905097792035, 7702391536483808562987561014951728, 2039720289490758357426040603200527, 9186762180018959352812293734386419, -8766399359570639272036053477585532, 9947231694784034054628665777251280, 293323326199016807807102150967402, -7407434120618542416750500074527478, -2148037367661829908916777931991054, -7394506717034019430993143813630997, 11134736578998021706326692630349 -- (+3098 chars; full line in the Zenodo source)
[-7394506717034019430993143813630997, 6499609955529844407612176707882891, -21168085622054916227707504195830178, 10652783769754573564423992026429076, -4637181858677999277684398784143902, 16852621312770742028388902817413316, -8359552705022370264898556022851979, 4309519397984799282901607160609128, 5647734844005478925027394442951837, 7313210954977600273772299832316081, 425457731485275220636661119092 -- (+3096 chars; full line in the Zenodo source)
[-3554082161837615122321313235304036, 6192521770178672774697733222776785, 433419875907855083338243792253912, 2772220046262813624204370999077189, -17711429839776097040925196276736894, 14493041062383986071675381347602098, -7319335572251190795385706189559581, 7833604190551782394864448196719247, -6499609955529844407612176707882891, 11273202987865597066916905097792035, -570607355723586808853753227614 -- (+3101 chars; full line in the Zenodo source)
[1138754583896801549967718564456788, 6839097942721268784209035519124666, -4738739422554141002114270697589554, 7774327231242128336395489997589478, -4695812428872045813345033521597773, 8396711824261018345446931603141434, -8766399359570639272036053477585532, 4305610229167964871879582928818630, -6662935311148711117964726119029742, 7970871573821519140214053860378381, -26388726374562773383173868960852 -- (+3099 chars; full line in the Zenodo source)
[-7371547163342007761799731280923483, 2638872637456277338317386896085270, -4309519397984799282901607160609128, 10111357952269891986070581888747570, -9947231694784034054628665777251280, 12130439576626410295872089923287331, -10077808763575288468692622559076634, 2068479559971164991024408234777875, -15437532757422364292986991383300900, 16343114466190371402045280822044181, -38147749110924071023877088 -- (+3099 chars; full line in the Zenodo source)
[8565114431728714037483389650917677, 8313785522101189329937462231903813, -14002627630196082443336881268842436, -293323326199016807807102150967402, -7833604190551782394864448196719247, 6925912310844993500023481387724011, -16852621312770742028388902817413316, 10679696433327931393086681239698373, -5226484826701436981084805345303997, 12780230909553612572023122454705119, -1564811141910241309698504455 -- (+3098 chars; full line in the Zenodo source)
[-9434791964034698394065728494373611, 4254577314852752206366611190928339, 4561504299796149486159309768763379, 2398777957970873362801738037112570, -4738739422554141002114270697589554, 14905217900763917002479341558715502, 2039720289490758357426040603200527, 7319335572251190795385706189559581, -12780230909553612572023122454705119, 8396711824261018345446931603141434, -5226484826701436981084805345303 -- (+3097 chars; full line in the Zenodo source)
[-1226522986799303287836126096550734, 3595218154950078040090025878346971, -11273202987865597066916905097792035, 3373762068013276906262906066961206, -65906791795021406377067510241689, 7702391536483808562987561014951728, -17510796305966744962081303867666424, 6662935311148711117964726119029742, 2039720289490758357426040603200527, 15648111419102413096985044558455843, -1685262131277074202838890281741 -- (+3100 chars; full line in the Zenodo source)
[-4007072742768070563330755381773587, 5742166428533267901243252253170535, 1138754583896801549967718564456788, -5647734844005478925027394442951837, -12326673350921369910073319190787781, 6839097942721268784209035519124666, -65906791795021406377067510241689, 11134736578998021706326692630349437, -4738739422554141002114270697589554, 10365565376701857523748056051318217, -783360419055178239486444819671 -- (+3099 chars; full line in the Zenodo source)
[13045110041677392365308655598929545, -4556883115634912859183148378772624, -9434791964034698394065728494373611, 5089159274084254531943654522511589, 1138754583896801549967718564456788, 4254577314852752206366611190928339, -11273202987865597066916905097792035, 2470866729613106669996640241767897, 4561504299796149486159309768763379, 6839097942721268784209035519124666, -1400262763019608244333688126884 -- (+3095 chars; full line in the Zenodo source)
[-7313210954977600273772299832316081, 2148037367661829908916777931991054, 13045110041677392365308655598929545, 5706073557235868088537532276143302, -4007072742768070563330755381773587, -4556883115634912859183148378772624, -1226522986799303287836126096550734, -3917017278270375732558298163339877, -9434791964034698394065728494373611, 5742166428533267901243252253170535, 856511443172871403748338965091 -- (+3095 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 95).map (fun t => rowA (190 + 1) t (rng 1 95)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 95 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 95 B A = sid 63033195616119436767333267526887206138 95 := rfl
theorem d_ne : (63033195616119436767333267526887206138 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 95 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 95) (h0 : mv A g = zeros 95) : g = zeros 95 :=
kernel_zero 95 63033195616119436767333267526887206138 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 190 95 = true := rfl
/-- **Balanced ⇒ pairs for p = 191.** A list with entries in (0, 191) that is balanced for 1 ≤ t ≤ 95
has as many copies of x as of 191 − x for every 1 ≤ x ≤ 95 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 191)
(hb : ∀ t, 1 ≤ t → t < 1 + 95 → tsum 191 t c + tsum 191 t c = c.length * 191) :
(rng 1 95).all (fun x => Nat.beq (cnt x c) (cnt (191 - x) c)) = true :=
pairs_of_bal 190 95 63033195616119436767333267526887206138 d_ne A B len cert A_def delta c hr hb
end MailletCert191
#print axioms MailletCert191.A_def
#print axioms MailletCert191.len
#print axioms MailletCert191.cert
#print axioms MailletCert191.d_ne
#print axioms MailletCert191.kernel
#print axioms MailletCert191.delta
#print axioms MailletCert191.pairs
lean_all/hodge/MailletCert193.lean
/-
hodge/MailletCert193.lean — T41 (goals G849b, G849c): for p = 193 the 96 × 96 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 96)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 210994202882637311900621190515476077826 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 193) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert193
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-191, -189, -187, -185, -183, -181, -179, -177, -175, -173, -171, -169, -167, -165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -55, -53, - -- (+124 chars; full line in the Zenodo source)
[-189, -185, -181, -177, -173, -169, -165, -161, -157, -153, -149, -145, -141, -137, -133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, -- (+76 chars; full line in the Zenodo source)
[-187, -181, -175, -169, -163, -157, -151, -145, -139, -133, -127, -121, -115, -109, -103, -97, -91, -85, -79, -73, -67, -61, -55, -49, -43, -37, -31, -25, -19, -13, -7, -1, 5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 83, 89, 95, 101, 107, 113, 119, 125, 131, 137, 143, 149, 155, 161, 167, 173, 179, 185, 191, -189, -183, -177, -171, -165, -159, -153, -147, -141, -135, -129, -123, -117, -11 -- (+92 chars; full line in the Zenodo source)
[-185, -177, -169, -161, -153, -145, -137, -129, -121, -113, -105, -97, -89, -81, -73, -65, -57, -49, -41, -33, -25, -17, -9, -1, 7, 15, 23, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 119, 127, 135, 143, 151, 159, 167, 175, 183, 191, -187, -179, -171, -163, -155, -147, -139, -131, -123, -115, -107, -99, -91, -83, -75, -67, -59, -51, -43, -35, -27, -19, -11, -3, 5, 13, 21, 29, 37, 45, 53, 61, -- (+76 chars; full line in the Zenodo source)
[-183, -173, -163, -153, -143, -133, -123, -113, -103, -93, -83, -73, -63, -53, -43, -33, -23, -13, -3, 7, 17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 137, 147, 157, 167, 177, 187, -189, -179, -169, -159, -149, -139, -129, -119, -109, -99, -89, -79, -69, -59, -49, -39, -29, -19, -9, 1, 11, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, -185, -175, -165, -- (+85 chars; full line in the Zenodo source)
[-181, -169, -157, -145, -133, -121, -109, -97, -85, -73, -61, -49, -37, -25, -13, -1, 11, 23, 35, 47, 59, 71, 83, 95, 107, 119, 131, 143, 155, 167, 179, 191, -183, -171, -159, -147, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, 141, 153, 165, 177, 189, -185, -173, -161, -149, -137, -125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -- (+76 chars; full line in the Zenodo source)
[-179, -165, -151, -137, -123, -109, -95, -81, -67, -53, -39, -25, -11, 3, 17, 31, 45, 59, 73, 87, 101, 115, 129, 143, 157, 171, 185, -187, -173, -159, -145, -131, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, 135, 149, 163, 177, 191, -181, -167, -153, -139, -125, -111, -97, -83, -69, -55, -41, -27, -13, 1, 15, 29, 43, 57, 71, 85, 99, 113, 127, 141, 155, 169, -- (+82 chars; full line in the Zenodo source)
[-177, -161, -145, -129, -113, -97, -81, -65, -49, -33, -17, -1, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, -179, -163, -147, -131, -115, -99, -83, -67, -51, -35, -19, -3, 13, 29, 45, 61, 77, 93, 109, 125, 141, 157, 173, 189, -181, -165, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, 155, 171, 187, -183, -167, -151, -135, -119, -103, -87, - -- (+76 chars; full line in the Zenodo source)
[-175, -157, -139, -121, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, 113, 131, 149, 167, 185, -183, -165, -147, -129, -111, -93, -75, -57, -39, -21, -3, 15, 33, 51, 69, 87, 105, 123, 141, 159, 177, -191, -173, -155, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, 79, 97, 115, 133, 151, 169, 187, -181, -163, -145, -127, -109, -91, -73, -55, -37, -19, -1, 17, 35, 53, 71, 89, 10 -- (+82 chars; full line in the Zenodo source)
[-173, -153, -133, -113, -93, -73, -53, -33, -13, 7, 27, 47, 67, 87, 107, 127, 147, 167, 187, -179, -159, -139, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, 141, 161, 181, -185, -165, -145, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, 155, 175, -191, -171, -151, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, 149, 169, 189, -177, -157, -137, -- (+75 chars; full line in the Zenodo source)
[-171, -149, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, 159, 181, -183, -161, -139, -117, -95, -73, -51, -29, -7, 15, 37, 59, 81, 103, 125, 147, 169, 191, -173, -151, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, 157, 179, -185, -163, -141, -119, -97, -75, -53, -31, -9, 13, 35, 57, 79, 101, 123, 145, 167, 189, -175, -153, -131, -109, -87, -65, -43, -21, 1, 23, 45 -- (+79 chars; full line in the Zenodo source)
[-169, -145, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119, 143, 167, 191, -171, -147, -123, -99, -75, -51, -27, -3, 21, 45, 69, 93, 117, 141, 165, 189, -173, -149, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, 139, 163, 187, -175, -151, -127, -103, -79, -55, -31, -7, 17, 41, 65, 89, 113, 137, 161, 185, -177, -153, -129, -105, -81, -57, -33, -9, 15, 39, 63, 87, 111, 135, 159, 183, -179 -- (+76 chars; full line in the Zenodo source)
[-167, -141, -115, -89, -63, -37, -11, 15, 41, 67, 93, 119, 145, 171, -189, -163, -137, -111, -85, -59, -33, -7, 19, 45, 71, 97, 123, 149, 175, -185, -159, -133, -107, -81, -55, -29, -3, 23, 49, 75, 101, 127, 153, 179, -181, -155, -129, -103, -77, -51, -25, 1, 27, 53, 79, 105, 131, 157, 183, -177, -151, -125, -99, -73, -47, -21, 5, 31, 57, 83, 109, 135, 161, 187, -173, -147, -121, -95, -69, -43, -- (+79 chars; full line in the Zenodo source)
[-165, -137, -109, -81, -53, -25, 3, 31, 59, 87, 115, 143, 171, -187, -159, -131, -103, -75, -47, -19, 9, 37, 65, 93, 121, 149, 177, -181, -153, -125, -97, -69, -41, -13, 15, 43, 71, 99, 127, 155, 183, -175, -147, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, 161, 189, -169, -141, -113, -85, -57, -29, -1, 27, 55, 83, 111, 139, 167, -191, -163, -135, -107, -79, -51, -23, 5, 33, 61, 89, 117, 145, -- (+76 chars; full line in the Zenodo source)
[-163, -133, -103, -73, -43, -13, 17, 47, 77, 107, 137, 167, -189, -159, -129, -99, -69, -39, -9, 21, 51, 81, 111, 141, 171, -185, -155, -125, -95, -65, -35, -5, 25, 55, 85, 115, 145, 175, -181, -151, -121, -91, -61, -31, -1, 29, 59, 89, 119, 149, 179, -177, -147, -117, -87, -57, -27, 3, 33, 63, 93, 123, 153, 183, -173, -143, -113, -83, -53, -23, 7, 37, 67, 97, 127, 157, 187, -169, -139, -109, - -- (+79 chars; full line in the Zenodo source)
[-161, -129, -97, -65, -33, -1, 31, 63, 95, 127, 159, 191, -163, -131, -99, -67, -35, -3, 29, 61, 93, 125, 157, 189, -165, -133, -101, -69, -37, -5, 27, 59, 91, 123, 155, 187, -167, -135, -103, -71, -39, -7, 25, 57, 89, 121, 153, 185, -169, -137, -105, -73, -41, -9, 23, 55, 87, 119, 151, 183, -171, -139, -107, -75, -43, -11, 21, 53, 85, 117, 149, 181, -173, -141, -109, -77, -45, -13, 19, 51, 83, -- (+76 chars; full line in the Zenodo source)
[-159, -125, -91, -57, -23, 11, 45, 79, 113, 147, 181, -171, -137, -103, -69, -35, -1, 33, 67, 101, 135, 169, -183, -149, -115, -81, -47, -13, 21, 55, 89, 123, 157, 191, -161, -127, -93, -59, -25, 9, 43, 77, 111, 145, 179, -173, -139, -105, -71, -37, -3, 31, 65, 99, 133, 167, -185, -151, -117, -83, -49, -15, 19, 53, 87, 121, 155, 189, -163, -129, -95, -61, -27, 7, 41, 75, 109, 143, 177, -175, -1 -- (+79 chars; full line in the Zenodo source)
[-157, -121, -85, -49, -13, 23, 59, 95, 131, 167, -183, -147, -111, -75, -39, -3, 33, 69, 105, 141, 177, -173, -137, -101, -65, -29, 7, 43, 79, 115, 151, 187, -163, -127, -91, -55, -19, 17, 53, 89, 125, 161, -189, -153, -117, -81, -45, -9, 27, 63, 99, 135, 171, -179, -143, -107, -71, -35, 1, 37, 73, 109, 145, 181, -169, -133, -97, -61, -25, 11, 47, 83, 119, 155, 191, -159, -123, -87, -51, -15, 2 -- (+76 chars; full line in the Zenodo source)
[-155, -117, -79, -41, -3, 35, 73, 111, 149, 187, -161, -123, -85, -47, -9, 29, 67, 105, 143, 181, -167, -129, -91, -53, -15, 23, 61, 99, 137, 175, -173, -135, -97, -59, -21, 17, 55, 93, 131, 169, -179, -141, -103, -65, -27, 11, 49, 87, 125, 163, -185, -147, -109, -71, -33, 5, 43, 81, 119, 157, -191, -153, -115, -77, -39, -1, 37, 75, 113, 151, 189, -159, -121, -83, -45, -7, 31, 69, 107, 145, 183 -- (+79 chars; full line in the Zenodo source)
[-153, -113, -73, -33, 7, 47, 87, 127, 167, -179, -139, -99, -59, -19, 21, 61, 101, 141, 181, -165, -125, -85, -45, -5, 35, 75, 115, 155, -191, -151, -111, -71, -31, 9, 49, 89, 129, 169, -177, -137, -97, -57, -17, 23, 63, 103, 143, 183, -163, -123, -83, -43, -3, 37, 77, 117, 157, -189, -149, -109, -69, -29, 11, 51, 91, 131, 171, -175, -135, -95, -55, -15, 25, 65, 105, 145, 185, -161, -121, -81, -- (+77 chars; full line in the Zenodo source)
[-151, -109, -67, -25, 17, 59, 101, 143, 185, -159, -117, -75, -33, 9, 51, 93, 135, 177, -167, -125, -83, -41, 1, 43, 85, 127, 169, -175, -133, -91, -49, -7, 35, 77, 119, 161, -183, -141, -99, -57, -15, 27, 69, 111, 153, -191, -149, -107, -65, -23, 19, 61, 103, 145, 187, -157, -115, -73, -31, 11, 53, 95, 137, 179, -165, -123, -81, -39, 3, 45, 87, 129, 171, -173, -131, -89, -47, -5, 37, 79, 121, -- (+78 chars; full line in the Zenodo source)
[-149, -105, -61, -17, 27, 71, 115, 159, -183, -139, -95, -51, -7, 37, 81, 125, 169, -173, -129, -85, -41, 3, 47, 91, 135, 179, -163, -119, -75, -31, 13, 57, 101, 145, 189, -153, -109, -65, -21, 23, 67, 111, 155, -187, -143, -99, -55, -11, 33, 77, 121, 165, -177, -133, -89, -45, -1, 43, 87, 131, 175, -167, -123, -79, -35, 9, 53, 97, 141, 185, -157, -113, -69, -25, 19, 63, 107, 151, -191, -147, - -- (+77 chars; full line in the Zenodo source)
[-147, -101, -55, -9, 37, 83, 129, 175, -165, -119, -73, -27, 19, 65, 111, 157, -183, -137, -91, -45, 1, 47, 93, 139, 185, -155, -109, -63, -17, 29, 75, 121, 167, -173, -127, -81, -35, 11, 57, 103, 149, -191, -145, -99, -53, -7, 39, 85, 131, 177, -163, -117, -71, -25, 21, 67, 113, 159, -181, -135, -89, -43, 3, 49, 95, 141, 187, -153, -107, -61, -15, 31, 77, 123, 169, -171, -125, -79, -33, 13, 59 -- (+78 chars; full line in the Zenodo source)
[-145, -97, -49, -1, 47, 95, 143, 191, -147, -99, -51, -3, 45, 93, 141, 189, -149, -101, -53, -5, 43, 91, 139, 187, -151, -103, -55, -7, 41, 89, 137, 185, -153, -105, -57, -9, 39, 87, 135, 183, -155, -107, -59, -11, 37, 85, 133, 181, -157, -109, -61, -13, 35, 83, 131, 179, -159, -111, -63, -15, 33, 81, 129, 177, -161, -113, -65, -17, 31, 79, 127, 175, -163, -115, -67, -19, 29, 77, 125, 173, -165 -- (+76 chars; full line in the Zenodo source)
[-143, -93, -43, 7, 57, 107, 157, -179, -129, -79, -29, 21, 71, 121, 171, -165, -115, -65, -15, 35, 85, 135, 185, -151, -101, -51, -1, 49, 99, 149, -187, -137, -87, -37, 13, 63, 113, 163, -173, -123, -73, -23, 27, 77, 127, 177, -159, -109, -59, -9, 41, 91, 141, 191, -145, -95, -45, 5, 55, 105, 155, -181, -131, -81, -31, 19, 69, 119, 169, -167, -117, -67, -17, 33, 83, 133, 183, -153, -103, -53, - -- (+78 chars; full line in the Zenodo source)
[-141, -89, -37, 15, 67, 119, 171, -163, -111, -59, -7, 45, 97, 149, -185, -133, -81, -29, 23, 75, 127, 179, -155, -103, -51, 1, 53, 105, 157, -177, -125, -73, -21, 31, 83, 135, 187, -147, -95, -43, 9, 61, 113, 165, -169, -117, -65, -13, 39, 91, 143, -191, -139, -87, -35, 17, 69, 121, 173, -161, -109, -57, -5, 47, 99, 151, -183, -131, -79, -27, 25, 77, 129, 181, -153, -101, -49, 3, 55, 107, 159, -- (+75 chars; full line in the Zenodo source)
[-139, -85, -31, 23, 77, 131, 185, -147, -93, -39, 15, 69, 123, 177, -155, -101, -47, 7, 61, 115, 169, -163, -109, -55, -1, 53, 107, 161, -171, -117, -63, -9, 45, 99, 153, -179, -125, -71, -17, 37, 91, 145, -187, -133, -79, -25, 29, 83, 137, 191, -141, -87, -33, 21, 75, 129, 183, -149, -95, -41, 13, 67, 121, 175, -157, -103, -49, 5, 59, 113, 167, -165, -111, -57, -3, 51, 105, 159, -173, -119, -6 -- (+78 chars; full line in the Zenodo source)
[-137, -81, -25, 31, 87, 143, -187, -131, -75, -19, 37, 93, 149, -181, -125, -69, -13, 43, 99, 155, -175, -119, -63, -7, 49, 105, 161, -169, -113, -57, -1, 55, 111, 167, -163, -107, -51, 5, 61, 117, 173, -157, -101, -45, 11, 67, 123, 179, -151, -95, -39, 17, 73, 129, 185, -145, -89, -33, 23, 79, 135, 191, -139, -83, -27, 29, 85, 141, -189, -133, -77, -21, 35, 91, 147, -183, -127, -71, -15, 41, 9 -- (+78 chars; full line in the Zenodo source)
[-135, -77, -19, 39, 97, 155, -173, -115, -57, 1, 59, 117, 175, -153, -95, -37, 21, 79, 137, -191, -133, -75, -17, 41, 99, 157, -171, -113, -55, 3, 61, 119, 177, -151, -93, -35, 23, 81, 139, -189, -131, -73, -15, 43, 101, 159, -169, -111, -53, 5, 63, 121, 179, -149, -91, -33, 25, 83, 141, -187, -129, -71, -13, 45, 103, 161, -167, -109, -51, 7, 65, 123, 181, -147, -89, -31, 27, 85, 143, -185, -12 -- (+77 chars; full line in the Zenodo source)
[-133, -73, -13, 47, 107, 167, -159, -99, -39, 21, 81, 141, -185, -125, -65, -5, 55, 115, 175, -151, -91, -31, 29, 89, 149, -177, -117, -57, 3, 63, 123, 183, -143, -83, -23, 37, 97, 157, -169, -109, -49, 11, 71, 131, 191, -135, -75, -15, 45, 105, 165, -161, -101, -41, 19, 79, 139, -187, -127, -67, -7, 53, 113, 173, -153, -93, -33, 27, 87, 147, -179, -119, -59, 1, 61, 121, 181, -145, -85, -25, 35 -- (+75 chars; full line in the Zenodo source)
[-131, -69, -7, 55, 117, 179, -145, -83, -21, 41, 103, 165, -159, -97, -35, 27, 89, 151, -173, -111, -49, 13, 75, 137, -187, -125, -63, -1, 61, 123, 185, -139, -77, -15, 47, 109, 171, -153, -91, -29, 33, 95, 157, -167, -105, -43, 19, 81, 143, -181, -119, -57, 5, 67, 129, 191, -133, -71, -9, 53, 115, 177, -147, -85, -23, 39, 101, 163, -161, -99, -37, 25, 87, 149, -175, -113, -51, 11, 73, 135, -18 -- (+78 chars; full line in the Zenodo source)
[-129, -65, -1, 63, 127, 191, -131, -67, -3, 61, 125, 189, -133, -69, -5, 59, 123, 187, -135, -71, -7, 57, 121, 185, -137, -73, -9, 55, 119, 183, -139, -75, -11, 53, 117, 181, -141, -77, -13, 51, 115, 179, -143, -79, -15, 49, 113, 177, -145, -81, -17, 47, 111, 175, -147, -83, -19, 45, 109, 173, -149, -85, -21, 43, 107, 171, -151, -87, -23, 41, 105, 169, -153, -89, -25, 39, 103, 167, -155, -91, - -- (+76 chars; full line in the Zenodo source)
[-127, -61, 5, 71, 137, -183, -117, -51, 15, 81, 147, -173, -107, -41, 25, 91, 157, -163, -97, -31, 35, 101, 167, -153, -87, -21, 45, 111, 177, -143, -77, -11, 55, 121, 187, -133, -67, -1, 65, 131, -189, -123, -57, 9, 75, 141, -179, -113, -47, 19, 85, 151, -169, -103, -37, 29, 95, 161, -159, -93, -27, 39, 105, 171, -149, -83, -17, 49, 115, 181, -139, -73, -7, 59, 125, 191, -129, -63, 3, 69, 135, -- (+77 chars; full line in the Zenodo source)
[-125, -57, 11, 79, 147, -171, -103, -35, 33, 101, 169, -149, -81, -13, 55, 123, 191, -127, -59, 9, 77, 145, -173, -105, -37, 31, 99, 167, -151, -83, -15, 53, 121, 189, -129, -61, 7, 75, 143, -175, -107, -39, 29, 97, 165, -153, -85, -17, 51, 119, 187, -131, -63, 5, 73, 141, -177, -109, -41, 27, 95, 163, -155, -87, -19, 49, 117, 185, -133, -65, 3, 71, 139, -179, -111, -43, 25, 93, 161, -157, -89, -- (+73 chars; full line in the Zenodo source)
[-123, -53, 17, 87, 157, -159, -89, -19, 51, 121, 191, -125, -55, 15, 85, 155, -161, -91, -21, 49, 119, 189, -127, -57, 13, 83, 153, -163, -93, -23, 47, 117, 187, -129, -59, 11, 81, 151, -165, -95, -25, 45, 115, 185, -131, -61, 9, 79, 149, -167, -97, -27, 43, 113, 183, -133, -63, 7, 77, 147, -169, -99, -29, 41, 111, 181, -135, -65, 5, 75, 145, -171, -101, -31, 39, 109, 179, -137, -67, 3, 73, 143 -- (+73 chars; full line in the Zenodo source)
[-121, -49, 23, 95, 167, -147, -75, -3, 69, 141, -173, -101, -29, 43, 115, 187, -127, -55, 17, 89, 161, -153, -81, -9, 63, 135, -179, -107, -35, 37, 109, 181, -133, -61, 11, 83, 155, -159, -87, -15, 57, 129, -185, -113, -41, 31, 103, 175, -139, -67, 5, 77, 149, -165, -93, -21, 51, 123, -191, -119, -47, 25, 97, 169, -145, -73, -1, 71, 143, -171, -99, -27, 45, 117, 189, -125, -53, 19, 91, 163, -15 -- (+76 chars; full line in the Zenodo source)
[-119, -45, 29, 103, 177, -135, -61, 13, 87, 161, -151, -77, -3, 71, 145, -167, -93, -19, 55, 129, -183, -109, -35, 39, 113, 187, -125, -51, 23, 97, 171, -141, -67, 7, 81, 155, -157, -83, -9, 65, 139, -173, -99, -25, 49, 123, -189, -115, -41, 33, 107, 181, -131, -57, 17, 91, 165, -147, -73, 1, 75, 149, -163, -89, -15, 59, 133, -179, -105, -31, 43, 117, 191, -121, -47, 27, 101, 175, -137, -63, 11 -- (+77 chars; full line in the Zenodo source)
[-117, -41, 35, 111, 187, -123, -47, 29, 105, 181, -129, -53, 23, 99, 175, -135, -59, 17, 93, 169, -141, -65, 11, 87, 163, -147, -71, 5, 81, 157, -153, -77, -1, 75, 151, -159, -83, -7, 69, 145, -165, -89, -13, 63, 139, -171, -95, -19, 57, 133, -177, -101, -25, 51, 127, -183, -107, -31, 45, 121, -189, -113, -37, 39, 115, 191, -119, -43, 33, 109, 185, -125, -49, 27, 103, 179, -131, -55, 21, 97, 17 -- (+73 chars; full line in the Zenodo source)
[-115, -37, 41, 119, -189, -111, -33, 45, 123, -185, -107, -29, 49, 127, -181, -103, -25, 53, 131, -177, -99, -21, 57, 135, -173, -95, -17, 61, 139, -169, -91, -13, 65, 143, -165, -87, -9, 69, 147, -161, -83, -5, 73, 151, -157, -79, -1, 77, 155, -153, -75, 3, 81, 159, -149, -71, 7, 85, 163, -145, -67, 11, 89, 167, -141, -63, 15, 93, 171, -137, -59, 19, 97, 175, -133, -55, 23, 101, 179, -129, -51 -- (+77 chars; full line in the Zenodo source)
[-113, -33, 47, 127, -179, -99, -19, 61, 141, -165, -85, -5, 75, 155, -151, -71, 9, 89, 169, -137, -57, 23, 103, 183, -123, -43, 37, 117, -189, -109, -29, 51, 131, -175, -95, -15, 65, 145, -161, -81, -1, 79, 159, -147, -67, 13, 93, 173, -133, -53, 27, 107, 187, -119, -39, 41, 121, -185, -105, -25, 55, 135, -171, -91, -11, 69, 149, -157, -77, 3, 83, 163, -143, -63, 17, 97, 177, -129, -49, 31, 111 -- (+77 chars; full line in the Zenodo source)
[-111, -29, 53, 135, -169, -87, -5, 77, 159, -145, -63, 19, 101, 183, -121, -39, 43, 125, -179, -97, -15, 67, 149, -155, -73, 9, 91, 173, -131, -49, 33, 115, -189, -107, -25, 57, 139, -165, -83, -1, 81, 163, -141, -59, 23, 105, 187, -117, -35, 47, 129, -175, -93, -11, 71, 153, -151, -69, 13, 95, 177, -127, -45, 37, 119, -185, -103, -21, 61, 143, -161, -79, 3, 85, 167, -137, -55, 27, 109, 191, -1 -- (+77 chars; full line in the Zenodo source)
[-109, -25, 59, 143, -159, -75, 9, 93, 177, -125, -41, 43, 127, -175, -91, -7, 77, 161, -141, -57, 27, 111, -191, -107, -23, 61, 145, -157, -73, 11, 95, 179, -123, -39, 45, 129, -173, -89, -5, 79, 163, -139, -55, 29, 113, -189, -105, -21, 63, 147, -155, -71, 13, 97, 181, -121, -37, 47, 131, -171, -87, -3, 81, 165, -137, -53, 31, 115, -187, -103, -19, 65, 149, -153, -69, 15, 99, 183, -119, -35, 4 -- (+78 chars; full line in the Zenodo source)
[-107, -21, 65, 151, -149, -63, 23, 109, -191, -105, -19, 67, 153, -147, -61, 25, 111, -189, -103, -17, 69, 155, -145, -59, 27, 113, -187, -101, -15, 71, 157, -143, -57, 29, 115, -185, -99, -13, 73, 159, -141, -55, 31, 117, -183, -97, -11, 75, 161, -139, -53, 33, 119, -181, -95, -9, 77, 163, -137, -51, 35, 121, -179, -93, -7, 79, 165, -135, -49, 37, 123, -177, -91, -5, 81, 167, -133, -47, 39, 12 -- (+82 chars; full line in the Zenodo source)
[-105, -17, 71, 159, -139, -51, 37, 125, -173, -85, 3, 91, 179, -119, -31, 57, 145, -153, -65, 23, 111, -187, -99, -11, 77, 165, -133, -45, 43, 131, -167, -79, 9, 97, 185, -113, -25, 63, 151, -147, -59, 29, 117, -181, -93, -5, 83, 171, -127, -39, 49, 137, -161, -73, 15, 103, 191, -107, -19, 69, 157, -141, -53, 35, 123, -175, -87, 1, 89, 177, -121, -33, 55, 143, -155, -67, 21, 109, -189, -101, -1 -- (+75 chars; full line in the Zenodo source)
[-103, -13, 77, 167, -129, -39, 51, 141, -155, -65, 25, 115, -181, -91, -1, 89, 179, -117, -27, 63, 153, -143, -53, 37, 127, -169, -79, 11, 101, 191, -105, -15, 75, 165, -131, -41, 49, 139, -157, -67, 23, 113, -183, -93, -3, 87, 177, -119, -29, 61, 151, -145, -55, 35, 125, -171, -81, 9, 99, 189, -107, -17, 73, 163, -133, -43, 47, 137, -159, -69, 21, 111, -185, -95, -5, 85, 175, -121, -31, 59, 14 -- (+77 chars; full line in the Zenodo source)
[-101, -9, 83, 175, -119, -27, 65, 157, -137, -45, 47, 139, -155, -63, 29, 121, -173, -81, 11, 103, -191, -99, -7, 85, 177, -117, -25, 67, 159, -135, -43, 49, 141, -153, -61, 31, 123, -171, -79, 13, 105, -189, -97, -5, 87, 179, -115, -23, 69, 161, -133, -41, 51, 143, -151, -59, 33, 125, -169, -77, 15, 107, -187, -95, -3, 89, 181, -113, -21, 71, 163, -131, -39, 53, 145, -149, -57, 35, 127, -167, -- (+78 chars; full line in the Zenodo source)
[-99, -5, 89, 183, -109, -15, 79, 173, -119, -25, 69, 163, -129, -35, 59, 153, -139, -45, 49, 143, -149, -55, 39, 133, -159, -65, 29, 123, -169, -75, 19, 113, -179, -85, 9, 103, -189, -95, -1, 93, 187, -105, -11, 83, 177, -115, -21, 73, 167, -125, -31, 63, 157, -135, -41, 53, 147, -145, -51, 43, 137, -155, -61, 33, 127, -165, -71, 23, 117, -175, -81, 13, 107, -185, -91, 3, 97, 191, -101, -7, 87, -- (+77 chars; full line in the Zenodo source)
[-97, -1, 95, 191, -99, -3, 93, 189, -101, -5, 91, 187, -103, -7, 89, 185, -105, -9, 87, 183, -107, -11, 85, 181, -109, -13, 83, 179, -111, -15, 81, 177, -113, -17, 79, 175, -115, -19, 77, 173, -117, -21, 75, 171, -119, -23, 73, 169, -121, -25, 71, 167, -123, -27, 69, 165, -125, -29, 67, 163, -127, -31, 65, 161, -129, -33, 63, 159, -131, -35, 61, 157, -133, -37, 59, 155, -135, -39, 57, 153, -137 -- (+76 chars; full line in the Zenodo source)
[-95, 3, 101, -187, -89, 9, 107, -181, -83, 15, 113, -175, -77, 21, 119, -169, -71, 27, 125, -163, -65, 33, 131, -157, -59, 39, 137, -151, -53, 45, 143, -145, -47, 51, 149, -139, -41, 57, 155, -133, -35, 63, 161, -127, -29, 69, 167, -121, -23, 75, 173, -115, -17, 81, 179, -109, -11, 87, 185, -103, -5, 93, 191, -97, 1, 99, -189, -91, 7, 105, -183, -85, 13, 111, -177, -79, 19, 117, -171, -73, 25, -- (+76 chars; full line in the Zenodo source)
[-93, 7, 107, -179, -79, 21, 121, -165, -65, 35, 135, -151, -51, 49, 149, -137, -37, 63, 163, -123, -23, 77, 177, -109, -9, 91, 191, -95, 5, 105, -181, -81, 19, 119, -167, -67, 33, 133, -153, -53, 47, 147, -139, -39, 61, 161, -125, -25, 75, 175, -111, -11, 89, 189, -97, 3, 103, -183, -83, 17, 117, -169, -69, 31, 131, -155, -55, 45, 145, -141, -41, 59, 159, -127, -27, 73, 173, -113, -13, 87, 187, -- (+74 chars; full line in the Zenodo source)
[-91, 11, 113, -171, -69, 33, 135, -149, -47, 55, 157, -127, -25, 77, 179, -105, -3, 99, -185, -83, 19, 121, -163, -61, 41, 143, -141, -39, 63, 165, -119, -17, 85, 187, -97, 5, 107, -177, -75, 27, 129, -155, -53, 49, 151, -133, -31, 71, 173, -111, -9, 93, -191, -89, 13, 115, -169, -67, 35, 137, -147, -45, 57, 159, -125, -23, 79, 181, -103, -1, 101, -183, -81, 21, 123, -161, -59, 43, 145, -139, - -- (+77 chars; full line in the Zenodo source)
[-89, 15, 119, -163, -59, 45, 149, -133, -29, 75, 179, -103, 1, 105, -177, -73, 31, 135, -147, -43, 61, 165, -117, -13, 91, -191, -87, 17, 121, -161, -57, 47, 151, -131, -27, 77, 181, -101, 3, 107, -175, -71, 33, 137, -145, -41, 63, 167, -115, -11, 93, -189, -85, 19, 123, -159, -55, 49, 153, -129, -25, 79, 183, -99, 5, 109, -173, -69, 35, 139, -143, -39, 65, 169, -113, -9, 95, -187, -83, 21, 125 -- (+75 chars; full line in the Zenodo source)
[-87, 19, 125, -155, -49, 57, 163, -117, -11, 95, -185, -79, 27, 133, -147, -41, 65, 171, -109, -3, 103, -177, -71, 35, 141, -139, -33, 73, 179, -101, 5, 111, -169, -63, 43, 149, -131, -25, 81, 187, -93, 13, 119, -161, -55, 51, 157, -123, -17, 89, -191, -85, 21, 127, -153, -47, 59, 165, -115, -9, 97, -183, -77, 29, 135, -145, -39, 67, 173, -107, -1, 105, -175, -69, 37, 143, -137, -31, 75, 181, - -- (+77 chars; full line in the Zenodo source)
[-85, 23, 131, -147, -39, 69, 177, -101, 7, 115, -163, -55, 53, 161, -117, -9, 99, -179, -71, 37, 145, -133, -25, 83, 191, -87, 21, 129, -149, -41, 67, 175, -103, 5, 113, -165, -57, 51, 159, -119, -11, 97, -181, -73, 35, 143, -135, -27, 81, 189, -89, 19, 127, -151, -43, 65, 173, -105, 3, 111, -167, -59, 49, 157, -121, -13, 95, -183, -75, 33, 141, -137, -29, 79, 187, -91, 17, 125, -153, -45, 63, -- (+74 chars; full line in the Zenodo source)
[-83, 27, 137, -139, -29, 81, 191, -85, 25, 135, -141, -31, 79, 189, -87, 23, 133, -143, -33, 77, 187, -89, 21, 131, -145, -35, 75, 185, -91, 19, 129, -147, -37, 73, 183, -93, 17, 127, -149, -39, 71, 181, -95, 15, 125, -151, -41, 69, 179, -97, 13, 123, -153, -43, 67, 177, -99, 11, 121, -155, -45, 65, 175, -101, 9, 119, -157, -47, 63, 173, -103, 7, 117, -159, -49, 61, 171, -105, 5, 115, -161, -51 -- (+70 chars; full line in the Zenodo source)
[-81, 31, 143, -131, -19, 93, -181, -69, 43, 155, -119, -7, 105, -169, -57, 55, 167, -107, 5, 117, -157, -45, 67, 179, -95, 17, 129, -145, -33, 79, 191, -83, 29, 141, -133, -21, 91, -183, -71, 41, 153, -121, -9, 103, -171, -59, 53, 165, -109, 3, 115, -159, -47, 65, 177, -97, 15, 127, -147, -35, 77, 189, -85, 27, 139, -135, -23, 89, -185, -73, 39, 151, -123, -11, 101, -173, -61, 51, 163, -111, 1, -- (+74 chars; full line in the Zenodo source)
[-79, 35, 149, -123, -9, 105, -167, -53, 61, 175, -97, 17, 131, -141, -27, 87, -185, -71, 43, 157, -115, -1, 113, -159, -45, 69, 183, -89, 25, 139, -133, -19, 95, -177, -63, 51, 165, -107, 7, 121, -151, -37, 77, 191, -81, 33, 147, -125, -11, 103, -169, -55, 59, 173, -99, 15, 129, -143, -29, 85, -187, -73, 41, 155, -117, -3, 111, -161, -47, 67, 181, -91, 23, 137, -135, -21, 93, -179, -65, 49, 163 -- (+77 chars; full line in the Zenodo source)
[-77, 39, 155, -115, 1, 117, -153, -37, 79, -191, -75, 41, 157, -113, 3, 119, -151, -35, 81, -189, -73, 43, 159, -111, 5, 121, -149, -33, 83, -187, -71, 45, 161, -109, 7, 123, -147, -31, 85, -185, -69, 47, 163, -107, 9, 125, -145, -29, 87, -183, -67, 49, 165, -105, 11, 127, -143, -27, 89, -181, -65, 51, 167, -103, 13, 129, -141, -25, 91, -179, -63, 53, 169, -101, 15, 131, -139, -23, 93, -177, -6 -- (+75 chars; full line in the Zenodo source)
[-75, 43, 161, -107, 11, 129, -139, -21, 97, -171, -53, 65, 183, -85, 33, 151, -117, 1, 119, -149, -31, 87, -181, -63, 55, 173, -95, 23, 141, -127, -9, 109, -159, -41, 77, -191, -73, 45, 163, -105, 13, 131, -137, -19, 99, -169, -51, 67, 185, -83, 35, 153, -115, 3, 121, -147, -29, 89, -179, -61, 57, 175, -93, 25, 143, -125, -7, 111, -157, -39, 79, -189, -71, 47, 165, -103, 15, 133, -135, -17, 101 -- (+76 chars; full line in the Zenodo source)
[-73, 47, 167, -99, 21, 141, -125, -5, 115, -151, -31, 89, -177, -57, 63, 183, -83, 37, 157, -109, 11, 131, -135, -15, 105, -161, -41, 79, -187, -67, 53, 173, -93, 27, 147, -119, 1, 121, -145, -25, 95, -171, -51, 69, 189, -77, 43, 163, -103, 17, 137, -129, -9, 111, -155, -35, 85, -181, -61, 59, 179, -87, 33, 153, -113, 7, 127, -139, -19, 101, -165, -45, 75, -191, -71, 49, 169, -97, 23, 143, -123 -- (+75 chars; full line in the Zenodo source)
[-71, 51, 173, -91, 31, 153, -111, 11, 133, -131, -9, 113, -151, -29, 93, -171, -49, 73, -191, -69, 53, 175, -89, 33, 155, -109, 13, 135, -129, -7, 115, -149, -27, 95, -169, -47, 75, -189, -67, 55, 177, -87, 35, 157, -107, 15, 137, -127, -5, 117, -147, -25, 97, -167, -45, 77, -187, -65, 57, 179, -85, 37, 159, -105, 17, 139, -125, -3, 119, -145, -23, 99, -165, -43, 79, -185, -63, 59, 181, -83, 39 -- (+79 chars; full line in the Zenodo source)
[-69, 55, 179, -83, 41, 165, -97, 27, 151, -111, 13, 137, -125, -1, 123, -139, -15, 109, -153, -29, 95, -167, -43, 81, -181, -57, 67, 191, -71, 53, 177, -85, 39, 163, -99, 25, 149, -113, 11, 135, -127, -3, 121, -141, -17, 107, -155, -31, 93, -169, -45, 79, -183, -59, 65, 189, -73, 51, 175, -87, 37, 161, -101, 23, 147, -115, 9, 133, -129, -5, 119, -143, -19, 105, -157, -33, 91, -171, -47, 77, -18 -- (+74 chars; full line in the Zenodo source)
[-67, 59, 185, -75, 51, 177, -83, 43, 169, -91, 35, 161, -99, 27, 153, -107, 19, 145, -115, 11, 137, -123, 3, 129, -131, -5, 121, -139, -13, 113, -147, -21, 105, -155, -29, 97, -163, -37, 89, -171, -45, 81, -179, -53, 73, -187, -61, 65, 191, -69, 57, 183, -77, 49, 175, -85, 41, 167, -93, 33, 159, -101, 25, 151, -109, 17, 143, -117, 9, 135, -125, 1, 127, -133, -7, 119, -141, -15, 111, -149, -23, -- (+76 chars; full line in the Zenodo source)
[-65, 63, 191, -67, 61, 189, -69, 59, 187, -71, 57, 185, -73, 55, 183, -75, 53, 181, -77, 51, 179, -79, 49, 177, -81, 47, 175, -83, 45, 173, -85, 43, 171, -87, 41, 169, -89, 39, 167, -91, 37, 165, -93, 35, 163, -95, 33, 161, -97, 31, 159, -99, 29, 157, -101, 27, 155, -103, 25, 153, -105, 23, 151, -107, 21, 149, -109, 19, 147, -111, 17, 145, -113, 15, 143, -115, 13, 141, -117, 11, 139, -119, 9, 1 -- (+60 chars; full line in the Zenodo source)
[-63, 67, -189, -59, 71, -185, -55, 75, -181, -51, 79, -177, -47, 83, -173, -43, 87, -169, -39, 91, -165, -35, 95, -161, -31, 99, -157, -27, 103, -153, -23, 107, -149, -19, 111, -145, -15, 115, -141, -11, 119, -137, -7, 123, -133, -3, 127, -129, 1, 131, -125, 5, 135, -121, 9, 139, -117, 13, 143, -113, 17, 147, -109, 21, 151, -105, 25, 155, -101, 29, 159, -97, 33, 163, -93, 37, 167, -89, 41, 171, -- (+76 chars; full line in the Zenodo source)
[-61, 71, -183, -51, 81, -173, -41, 91, -163, -31, 101, -153, -21, 111, -143, -11, 121, -133, -1, 131, -123, 9, 141, -113, 19, 151, -103, 29, 161, -93, 39, 171, -83, 49, 181, -73, 59, 191, -63, 69, -185, -53, 79, -175, -43, 89, -165, -33, 99, -155, -23, 109, -145, -13, 119, -135, -3, 129, -125, 7, 139, -115, 17, 149, -105, 27, 159, -95, 37, 169, -85, 47, 179, -75, 57, 189, -65, 67, -187, -55, 77 -- (+79 chars; full line in the Zenodo source)
[-59, 75, -177, -43, 91, -161, -27, 107, -145, -11, 123, -129, 5, 139, -113, 21, 155, -97, 37, 171, -81, 53, 187, -65, 69, -183, -49, 85, -167, -33, 101, -151, -17, 117, -135, -1, 133, -119, 15, 149, -103, 31, 165, -87, 47, 181, -71, 63, -189, -55, 79, -173, -39, 95, -157, -23, 111, -141, -7, 127, -125, 9, 143, -109, 25, 159, -93, 41, 175, -77, 57, 191, -61, 73, -179, -45, 89, -163, -29, 105, -1 -- (+76 chars; full line in the Zenodo source)
[-57, 79, -171, -35, 101, -149, -13, 123, -127, 9, 145, -105, 31, 167, -83, 53, 189, -61, 75, -175, -39, 97, -153, -17, 119, -131, 5, 141, -109, 27, 163, -87, 49, 185, -65, 71, -179, -43, 93, -157, -21, 115, -135, 1, 137, -113, 23, 159, -91, 45, 181, -69, 67, -183, -47, 89, -161, -25, 111, -139, -3, 133, -117, 19, 155, -95, 41, 177, -73, 63, -187, -51, 85, -165, -29, 107, -143, -7, 129, -121, 15 -- (+77 chars; full line in the Zenodo source)
[-55, 83, -165, -27, 111, -137, 1, 139, -109, 29, 167, -81, 57, -191, -53, 85, -163, -25, 113, -135, 3, 141, -107, 31, 169, -79, 59, -189, -51, 87, -161, -23, 115, -133, 5, 143, -105, 33, 171, -77, 61, -187, -49, 89, -159, -21, 117, -131, 7, 145, -103, 35, 173, -75, 63, -185, -47, 91, -157, -19, 119, -129, 9, 147, -101, 37, 175, -73, 65, -183, -45, 93, -155, -17, 121, -127, 11, 149, -99, 39, 177 -- (+76 chars; full line in the Zenodo source)
[-53, 87, -159, -19, 121, -125, 15, 155, -91, 49, 189, -57, 83, -163, -23, 117, -129, 11, 151, -95, 45, 185, -61, 79, -167, -27, 113, -133, 7, 147, -99, 41, 181, -65, 75, -171, -31, 109, -137, 3, 143, -103, 37, 177, -69, 71, -175, -35, 105, -141, -1, 139, -107, 33, 173, -73, 67, -179, -39, 101, -145, -5, 135, -111, 29, 169, -77, 63, -183, -43, 97, -149, -9, 131, -115, 25, 165, -81, 59, -187, -47 -- (+77 chars; full line in the Zenodo source)
[-51, 91, -153, -11, 131, -113, 29, 171, -73, 69, -175, -33, 109, -135, 7, 149, -95, 47, 189, -55, 87, -157, -15, 127, -117, 25, 167, -77, 65, -179, -37, 105, -139, 3, 145, -99, 43, 185, -59, 83, -161, -19, 123, -121, 21, 163, -81, 61, -183, -41, 101, -143, -1, 141, -103, 39, 181, -63, 79, -165, -23, 119, -125, 17, 159, -85, 57, -187, -45, 97, -147, -5, 137, -107, 35, 177, -67, 75, -169, -27, 11 -- (+77 chars; full line in the Zenodo source)
[-49, 95, -147, -3, 141, -101, 43, 187, -55, 89, -153, -9, 135, -107, 37, 181, -61, 83, -159, -15, 129, -113, 31, 175, -67, 77, -165, -21, 123, -119, 25, 169, -73, 71, -171, -27, 117, -125, 19, 163, -79, 65, -177, -33, 111, -131, 13, 157, -85, 59, -183, -39, 105, -137, 7, 151, -91, 53, -189, -45, 99, -143, 1, 145, -97, 47, 191, -51, 93, -149, -5, 139, -103, 41, 185, -57, 87, -155, -11, 133, -109 -- (+76 chars; full line in the Zenodo source)
[-47, 99, -141, 5, 151, -89, 57, -183, -37, 109, -131, 15, 161, -79, 67, -173, -27, 119, -121, 25, 171, -69, 77, -163, -17, 129, -111, 35, 181, -59, 87, -153, -7, 139, -101, 45, 191, -49, 97, -143, 3, 149, -91, 55, -185, -39, 107, -133, 13, 159, -81, 65, -175, -29, 117, -123, 23, 169, -71, 75, -165, -19, 127, -113, 33, 179, -61, 85, -155, -9, 137, -103, 43, 189, -51, 95, -145, 1, 147, -93, 53, - -- (+75 chars; full line in the Zenodo source)
[-45, 103, -135, 13, 161, -77, 71, -167, -19, 129, -109, 39, 187, -51, 97, -141, 7, 155, -83, 65, -173, -25, 123, -115, 33, 181, -57, 91, -147, 1, 149, -89, 59, -179, -31, 117, -121, 27, 175, -63, 85, -153, -5, 143, -95, 53, -185, -37, 111, -127, 21, 169, -69, 79, -159, -11, 137, -101, 47, -191, -43, 105, -133, 15, 163, -75, 73, -165, -17, 131, -107, 41, 189, -49, 99, -139, 9, 157, -81, 67, -171 -- (+75 chars; full line in the Zenodo source)
[-43, 107, -129, 21, 171, -65, 85, -151, -1, 149, -87, 63, -173, -23, 127, -109, 41, 191, -45, 105, -131, 19, 169, -67, 83, -153, -3, 147, -89, 61, -175, -25, 125, -111, 39, 189, -47, 103, -133, 17, 167, -69, 81, -155, -5, 145, -91, 59, -177, -27, 123, -113, 37, 187, -49, 101, -135, 15, 165, -71, 79, -157, -7, 143, -93, 57, -179, -29, 121, -115, 35, 185, -51, 99, -137, 13, 163, -73, 77, -159, -9 -- (+76 chars; full line in the Zenodo source)
[-41, 111, -123, 29, 181, -53, 99, -135, 17, 169, -65, 87, -147, 5, 157, -77, 75, -159, -7, 145, -89, 63, -171, -19, 133, -101, 51, -183, -31, 121, -113, 39, 191, -43, 109, -125, 27, 179, -55, 97, -137, 15, 167, -67, 85, -149, 3, 155, -79, 73, -161, -9, 143, -91, 61, -173, -21, 131, -103, 49, -185, -33, 119, -115, 37, 189, -45, 107, -127, 25, 177, -57, 95, -139, 13, 165, -69, 83, -151, 1, 153, - -- (+75 chars; full line in the Zenodo source)
[-39, 115, -117, 37, 191, -41, 113, -119, 35, 189, -43, 111, -121, 33, 187, -45, 109, -123, 31, 185, -47, 107, -125, 29, 183, -49, 105, -127, 27, 181, -51, 103, -129, 25, 179, -53, 101, -131, 23, 177, -55, 99, -133, 21, 175, -57, 97, -135, 19, 173, -59, 95, -137, 17, 171, -61, 93, -139, 15, 169, -63, 91, -141, 13, 167, -65, 89, -143, 11, 165, -67, 87, -145, 9, 163, -69, 85, -147, 7, 161, -71, 83 -- (+67 chars; full line in the Zenodo source)
[-37, 119, -111, 45, -185, -29, 127, -103, 53, -177, -21, 135, -95, 61, -169, -13, 143, -87, 69, -161, -5, 151, -79, 77, -153, 3, 159, -71, 85, -145, 11, 167, -63, 93, -137, 19, 175, -55, 101, -129, 27, 183, -47, 109, -121, 35, 191, -39, 117, -113, 43, -187, -31, 125, -105, 51, -179, -23, 133, -97, 59, -171, -15, 141, -89, 67, -163, -7, 149, -81, 75, -155, 1, 157, -73, 83, -147, 9, 165, -65, 91, -- (+75 chars; full line in the Zenodo source)
[-35, 123, -105, 53, -175, -17, 141, -87, 71, -157, 1, 159, -69, 89, -139, 19, 177, -51, 107, -121, 37, -191, -33, 125, -103, 55, -173, -15, 143, -85, 73, -155, 3, 161, -67, 91, -137, 21, 179, -49, 109, -119, 39, -189, -31, 127, -101, 57, -171, -13, 145, -83, 75, -153, 5, 163, -65, 93, -135, 23, 181, -47, 111, -117, 41, -187, -29, 129, -99, 59, -169, -11, 147, -81, 77, -151, 7, 165, -63, 95, -13 -- (+77 chars; full line in the Zenodo source)
[-33, 127, -99, 61, -165, -5, 155, -71, 89, -137, 23, 183, -43, 117, -109, 51, -175, -15, 145, -81, 79, -147, 13, 173, -53, 107, -119, 41, -185, -25, 135, -91, 69, -157, 3, 163, -63, 97, -129, 31, 191, -35, 125, -101, 59, -167, -7, 153, -73, 87, -139, 21, 181, -45, 115, -111, 49, -177, -17, 143, -83, 77, -149, 11, 171, -55, 105, -121, 39, -187, -27, 133, -93, 67, -159, 1, 161, -65, 95, -131, 29, -- (+75 chars; full line in the Zenodo source)
[-31, 131, -93, 69, -155, 7, 169, -55, 107, -117, 45, -179, -17, 145, -79, 83, -141, 21, 183, -41, 121, -103, 59, -165, -3, 159, -65, 97, -127, 35, -189, -27, 135, -89, 73, -151, 11, 173, -51, 111, -113, 49, -175, -13, 149, -75, 87, -137, 25, 187, -37, 125, -99, 63, -161, 1, 163, -61, 101, -123, 39, -185, -23, 139, -85, 77, -147, 15, 177, -47, 115, -109, 53, -171, -9, 153, -71, 91, -133, 29, 191 -- (+76 chars; full line in the Zenodo source)
[-29, 135, -87, 77, -145, 19, 183, -39, 125, -97, 67, -155, 9, 173, -49, 115, -107, 57, -165, -1, 163, -59, 105, -117, 47, -175, -11, 153, -69, 95, -127, 37, -185, -21, 143, -79, 85, -137, 27, 191, -31, 133, -89, 75, -147, 17, 181, -41, 123, -99, 65, -157, 7, 171, -51, 113, -109, 55, -167, -3, 161, -61, 103, -119, 45, -177, -13, 151, -71, 93, -129, 35, -187, -23, 141, -81, 83, -139, 25, 189, -33 -- (+75 chars; full line in the Zenodo source)
[-27, 139, -81, 85, -135, 31, -189, -23, 143, -77, 89, -131, 35, -185, -19, 147, -73, 93, -127, 39, -181, -15, 151, -69, 97, -123, 43, -177, -11, 155, -65, 101, -119, 47, -173, -7, 159, -61, 105, -115, 51, -169, -3, 163, -57, 109, -111, 55, -165, 1, 167, -53, 113, -107, 59, -161, 5, 171, -49, 117, -103, 63, -157, 9, 175, -45, 121, -99, 67, -153, 13, 179, -41, 125, -95, 71, -149, 17, 183, -37, 12 -- (+76 chars; full line in the Zenodo source)
[-25, 143, -75, 93, -125, 43, -175, -7, 161, -57, 111, -107, 61, -157, 11, 179, -39, 129, -89, 79, -139, 29, -189, -21, 147, -71, 97, -121, 47, -171, -3, 165, -53, 115, -103, 65, -153, 15, 183, -35, 133, -85, 83, -135, 33, -185, -17, 151, -67, 101, -117, 51, -167, 1, 169, -49, 119, -99, 69, -149, 19, 187, -31, 137, -81, 87, -131, 37, -181, -13, 155, -63, 105, -113, 55, -163, 5, 173, -45, 123, -9 -- (+76 chars; full line in the Zenodo source)
[-23, 147, -69, 101, -115, 55, -161, 9, 179, -37, 133, -83, 87, -129, 41, -175, -5, 165, -51, 119, -97, 73, -143, 27, -189, -19, 151, -65, 105, -111, 59, -157, 13, 183, -33, 137, -79, 91, -125, 45, -171, -1, 169, -47, 123, -93, 77, -139, 31, -185, -15, 155, -61, 109, -107, 63, -153, 17, 187, -29, 141, -75, 95, -121, 49, -167, 3, 173, -43, 127, -89, 81, -135, 35, -181, -11, 159, -57, 113, -103, 6 -- (+76 chars; full line in the Zenodo source)
[-21, 151, -63, 109, -105, 67, -147, 25, -189, -17, 155, -59, 113, -101, 71, -143, 29, -185, -13, 159, -55, 117, -97, 75, -139, 33, -181, -9, 163, -51, 121, -93, 79, -135, 37, -177, -5, 167, -47, 125, -89, 83, -131, 41, -173, -1, 171, -43, 129, -85, 87, -127, 45, -169, 3, 175, -39, 133, -81, 91, -123, 49, -165, 7, 179, -35, 137, -77, 95, -119, 53, -161, 11, 183, -31, 141, -73, 99, -115, 57, -157 -- (+76 chars; full line in the Zenodo source)
[-19, 155, -57, 117, -95, 79, -133, 41, -171, 3, 177, -35, 139, -73, 101, -111, 63, -149, 25, -187, -13, 161, -51, 123, -89, 85, -127, 47, -165, 9, 183, -29, 145, -67, 107, -105, 69, -143, 31, -181, -7, 167, -45, 129, -83, 91, -121, 53, -159, 15, 189, -23, 151, -61, 113, -99, 75, -137, 37, -175, -1, 173, -39, 135, -77, 97, -115, 59, -153, 21, -191, -17, 157, -55, 119, -93, 81, -131, 43, -169, 5, -- (+77 chars; full line in the Zenodo source)
[-17, 159, -51, 125, -85, 91, -119, 57, -153, 23, -187, -11, 165, -45, 131, -79, 97, -113, 63, -147, 29, -181, -5, 171, -39, 137, -73, 103, -107, 69, -141, 35, -175, 1, 177, -33, 143, -67, 109, -101, 75, -135, 41, -169, 7, 183, -27, 149, -61, 115, -95, 81, -129, 47, -163, 13, 189, -21, 155, -55, 121, -89, 87, -123, 53, -157, 19, -191, -15, 161, -49, 127, -83, 93, -117, 59, -151, 25, -185, -9, 16 -- (+77 chars; full line in the Zenodo source)
[-15, 163, -45, 133, -75, 103, -105, 73, -135, 43, -165, 13, 191, -17, 161, -47, 131, -77, 101, -107, 71, -137, 41, -167, 11, 189, -19, 159, -49, 129, -79, 99, -109, 69, -139, 39, -169, 9, 187, -21, 157, -51, 127, -81, 97, -111, 67, -141, 37, -171, 7, 185, -23, 155, -53, 125, -83, 95, -113, 65, -143, 35, -173, 5, 183, -25, 153, -55, 123, -85, 93, -115, 63, -145, 33, -175, 3, 181, -27, 151, -57, -- (+73 chars; full line in the Zenodo source)
[-13, 167, -39, 141, -65, 115, -91, 89, -117, 63, -143, 37, -169, 11, 191, -15, 165, -41, 139, -67, 113, -93, 87, -119, 61, -145, 35, -171, 9, 189, -17, 163, -43, 137, -69, 111, -95, 85, -121, 59, -147, 33, -173, 7, 187, -19, 161, -45, 135, -71, 109, -97, 83, -123, 57, -149, 31, -175, 5, 185, -21, 159, -47, 133, -73, 107, -99, 81, -125, 55, -151, 29, -177, 3, 183, -23, 157, -49, 131, -75, 105, - -- (+73 chars; full line in the Zenodo source)
[-11, 171, -33, 149, -55, 127, -77, 105, -99, 83, -121, 61, -143, 39, -165, 17, -187, -5, 177, -27, 155, -49, 133, -71, 111, -93, 89, -115, 67, -137, 45, -159, 23, -181, 1, 183, -21, 161, -43, 139, -65, 117, -87, 95, -109, 73, -131, 51, -153, 29, -175, 7, 189, -15, 167, -37, 145, -59, 123, -81, 101, -103, 79, -125, 57, -147, 35, -169, 13, -191, -9, 173, -31, 151, -53, 129, -75, 107, -97, 85, -11 -- (+77 chars; full line in the Zenodo source)
[-9, 175, -27, 157, -45, 139, -63, 121, -81, 103, -99, 85, -117, 67, -135, 49, -153, 31, -171, 13, -189, -5, 179, -23, 161, -41, 143, -59, 125, -77, 107, -95, 89, -113, 71, -131, 53, -149, 35, -167, 17, -185, -1, 183, -19, 165, -37, 147, -55, 129, -73, 111, -91, 93, -109, 75, -127, 57, -145, 39, -163, 21, -181, 3, 187, -15, 169, -33, 151, -51, 133, -69, 115, -87, 97, -105, 79, -123, 61, -141, 43 -- (+76 chars; full line in the Zenodo source)
[-7, 179, -21, 165, -35, 151, -49, 137, -63, 123, -77, 109, -91, 95, -105, 81, -119, 67, -133, 53, -147, 39, -161, 25, -175, 11, -189, -3, 183, -17, 169, -31, 155, -45, 141, -59, 127, -73, 113, -87, 99, -101, 85, -115, 71, -129, 57, -143, 43, -157, 29, -171, 15, -185, 1, 187, -13, 173, -27, 159, -41, 145, -55, 131, -69, 117, -83, 103, -97, 89, -111, 75, -125, 61, -139, 47, -153, 33, -167, 19, -1 -- (+76 chars; full line in the Zenodo source)
[-5, 183, -15, 173, -25, 163, -35, 153, -45, 143, -55, 133, -65, 123, -75, 113, -85, 103, -95, 93, -105, 83, -115, 73, -125, 63, -135, 53, -145, 43, -155, 33, -165, 23, -175, 13, -185, 3, 191, -7, 181, -17, 171, -27, 161, -37, 151, -47, 141, -57, 131, -67, 121, -77, 111, -87, 101, -97, 91, -107, 81, -117, 71, -127, 61, -137, 51, -147, 41, -157, 31, -167, 21, -177, 11, -187, 1, 189, -9, 179, -19, -- (+75 chars; full line in the Zenodo source)
[-3, 187, -9, 181, -15, 175, -21, 169, -27, 163, -33, 157, -39, 151, -45, 145, -51, 139, -57, 133, -63, 127, -69, 121, -75, 115, -81, 109, -87, 103, -93, 97, -99, 91, -105, 85, -111, 79, -117, 73, -123, 67, -129, 61, -135, 55, -141, 49, -147, 43, -153, 37, -159, 31, -165, 25, -171, 19, -177, 13, -183, 7, -189, 1, 191, -5, 185, -11, 179, -17, 173, -23, 167, -29, 161, -35, 155, -41, 149, -47, 143, -- (+76 chars; full line in the Zenodo source)
[-1, 191, -3, 189, -5, 187, -7, 185, -9, 183, -11, 181, -13, 179, -15, 177, -17, 175, -19, 173, -21, 171, -23, 169, -25, 167, -27, 165, -29, 163, -31, 161, -33, 159, -35, 157, -37, 155, -39, 153, -41, 151, -43, 149, -45, 147, -47, 145, -49, 143, -51, 141, -53, 139, -55, 137, -57, 135, -59, 133, -61, 131, -63, 129, -65, 127, -67, 125, -69, 123, -71, 121, -73, 119, -75, 117, -77, 115, -79, 113, -8 -- (+76 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[-25797189572799564739248521364913222, 27349376692497610346754041265764530, -364796231138274846747310725031413, -15551717803658540560436101522178353, -1883916570653868377690808150931228, -9605311469525662777673369989543155, -5205749190920198651831502953766384, -12595641161933007275992703498586322, -1843084633706577879706162548632130, -11040180900241371833073786421067696, -16856766924159917071346 -- (+3217 chars; full line in the Zenodo source)
[27349376692497610346754041265764530, -15551717803658540560436101522178353, -9605311469525662777673369989543155, -12595641161933007275992703498586322, -11040180900241371833073786421067696, -9342691413873513774738029949766457, -348988759870229972188517196552106, -20031879850503843481528991926660111, -40868565129825647312877710709515671, -865291236903708681418288619348553, -35006568394854407024454 -- (+3169 chars; full line in the Zenodo source)
[-364796231138274846747310725031413, -9605311469525662777673369989543155, -1843084633706577879706162548632130, -9342691413873513774738029949766457, -21104285315297529943257274074026444, -40868565129825647312877710709515671, -26696049904907946587172233298573605, -6136755121353674128051749703049231, -21168289099919944268956967876228059, -20042787299343644099714047561757622, -3448659591360837693765 -- (+3185 chars; full line in the Zenodo source)
[-15551717803658540560436101522178353, -12595641161933007275992703498586322, -9342691413873513774738029949766457, -20031879850503843481528991926660111, -865291236903708681418288619348553, -6136755121353674128051749703049231, -37865710799569085485677835576035381, 4025040709513959886972619986746494, -19051690073280514824242608811710096, -50538095665436991725255625024378581, -8041303833287447465725 -- (+3177 chars; full line in the Zenodo source)
[-1883916570653868377690808150931228, -11040180900241371833073786421067696, -21104285315297529943257274074026444, -865291236903708681418288619348553, -42991666995194441289911712472318652, -20042787299343644099714047561757622, -47636575888662751572018791448504507, -50538095665436991725255625024378581, -34528649648977770807146496633119996, -11178285209619536307444581777092697, -4920103943172342500 -- (+3182 chars; full line in the Zenodo source)
[-9605311469525662777673369989543155, -9342691413873513774738029949766457, -40868565129825647312877710709515671, -6136755121353674128051749703049231, -20042787299343644099714047561757622, -19051690073280514824242608811710096, -10782563675320989276608095027027156, -23407096749699750726409382939268199, -11045043718398059959572376371427847, -11391437680198730503778204394574847, -5772283252697316964 -- (+3181 chars; full line in the Zenodo source)
[-5205749190920198651831502953766384, -348988759870229972188517196552106, -26696049904907946587172233298573605, -37865710799569085485677835576035381, -47636575888662751572018791448504507, -10782563675320989276608095027027156, -45799075659619943178843641049934886, -11902095900639926679970223924719421, -45000484294264208472433738789011754, -18375329574763643332958893482318165, -3335081028060355832 -- (+3181 chars; full line in the Zenodo source)
[-12595641161933007275992703498586322, -20031879850503843481528991926660111, -6136755121353674128051749703049231, 4025040709513959886972619986746494, -50538095665436991725255625024378581, -23407096749699750726409382939268199, -11902095900639926679970223924719421, -41372488252758781986126558228334297, 9419448558372897856302156948111191, 16670546969579658463878803624586821, -1070351399078745586254 -- (+3177 chars; full line in the Zenodo source)
[-1843084633706577879706162548632130, -40868565129825647312877710709515671, -21168289099919944268956967876228059, -19051690073280514824242608811710096, -34528649648977770807146496633119996, -11045043718398059959572376371427847, -45000484294264208472433738789011754, 9419448558372897856302156948111191, -38424931727049441469585527238748559, 19225547828907069948695643125565193, 474366927588389614949 -- (+3181 chars; full line in the Zenodo source)
[-11040180900241371833073786421067696, -865291236903708681418288619348553, -20042787299343644099714047561757622, -50538095665436991725255625024378581, -11178285209619536307444581777092697, -11391437680198730503778204394574847, -18375329574763643332958893482318165, 16670546969579658463878803624586821, 19225547828907069948695643125565193, 6110727024017710215357162360451328, 39786718829225834426233 -- (+3182 chars; full line in the Zenodo source)
[-16856766924159917071346211602732945, -35006568394854407024454204946972177, -34486595913608376937657540011873222, -8041303833287447465725346688176929, -49201039431723425003920036298958263, -5772283252697316964017071431041220, -33350810280603558326408087574467633, -10703513990787455862544381396735653, 4743669275883896149493666415303894, 39786718829225834426233474491566989, -941944855837289785630 -- (+3184 chars; full line in the Zenodo source)
[-9342691413873513774738029949766457, -6136755121353674128051749703049231, -19051690073280514824242608811710096, -23407096749699750726409382939268199, -11391437680198730503778204394574847, 9419448558372897856302156948111191, 11271248779562809647742328941424461, 9245093976050955845544321973584903, 44221783486733050041283284882096592, 55223112182282075828053757532231207, 59407096545533953187613348 -- (+3177 chars; full line in the Zenodo source)
[-27910755279464970312409440214378056, -4954394205432914686407884997704443, -25185543601723614634630777938412642, -22149311829126785001214696113397883, -40015526378215040718448971499056505, -10769321606961386548783768352258170, -37207684519550805855273245965567298, 21609227741702330564010519278707006, 18293764460830553281325137675646547, 45000484294264208472433738789011754, 111782852096195363074 -- (+3178 chars; full line in the Zenodo source)
[-348988759870229972188517196552106, -37865710799569085485677835576035381, -10782563675320989276608095027027156, -11902095900639926679970223924719421, -18375329574763643332958893482318165, 11271248779562809647742328941424461, 16353751450786896543746355461651499, 38424931727049441469585527238748559, 55343876886455406328102500872286178, 60660763810303722300537450659441049, 251855436017236146346307 -- (+3179 chars; full line in the Zenodo source)
[-21104285315297529943257274074026444, -20042787299343644099714047561757622, -34528649648977770807146496633119996, -11391437680198730503778204394574847, -30417130059774688589027667610556361, 19225547828907069948695643125565193, 10703513990787455862544381396735653, 55223112182282075828053757532231207, 33460824136595766466128506505484705, 59508974429221115567772732280662401, 3786571079956908548567 -- (+3178 chars; full line in the Zenodo source)
[-20031879850503843481528991926660111, 4025040709513959886972619986746494, -23407096749699750726409382939268199, -41372488252758781986126558228334297, 16670546969579658463878803624586821, 9245093976050955845544321973584903, 38424931727049441469585527238748559, 40015526378215040718448971499056505, 45799075659619943178843641049934886, 34486595913608376937657540011873222, 16259512522983475468195070 -- (+3177 chars; full line in the Zenodo source)
[-16259512522983475468195070794437558, -37004422444036018212380881836941988, -47607170731494157110571408030061005, -25730252712324250039009527518866078, -44221783486733050041283284882096592, 37207684519550805855273245965567298, 8939006193890566816195756790174245, 51995112991445762275566218298337163, 50538095665436991725255625024378581, 34728195228974347578428588796434313, 96053114695256627776733 -- (+3180 chars; full line in the Zenodo source)
[-40868565129825647312877710709515671, -19051690073280514824242608811710096, -11045043718398059959572376371427847, 9419448558372897856302156948111191, 19225547828907069948695643125565193, 44221783486733050041283284882096592, 55343876886455406328102500872286178, 45799075659619943178843641049934886, 52912162163864689939615222243761269, 27910755279464970312409440214378056, -188391657065386837769080 -- (+3179 chars; full line in the Zenodo source)
[-25817550593138263795822647730442106, -11041252314748707566598956223755439, -51995112991445762275566218298337163, -18293764460830553281325137675646547, -16353751450786896543746355461651499, 46055890318178299650505122688025872, 11391437680198730503778204394574847, 41094859616328198495521592382264293, 35006568394854407024454204946972177, 364796231138274846747310725031413, -20031879850503843481528 -- (+3180 chars; full line in the Zenodo source)
[-865291236903708681418288619348553, -50538095665436991725255625024378581, -11391437680198730503778204394574847, 16670546969579658463878803624586821, 6110727024017710215357162360451328, 55223112182282075828053757532231207, 60660763810303722300537450659441049, 34486595913608376937657540011873222, 27910755279464970312409440214378056, -5205749190920198651831502953766384, -21168289099919944268956967 -- (+3182 chars; full line in the Zenodo source)
[-26696049904907946587172233298573605, -10782563675320989276608095027027156, -45000484294264208472433738789011754, 11271248779562809647742328941424461, 10703513990787455862544381396735653, 55343876886455406328102500872286178, 56366775124191543152605546160377203, 42991666995194441289911712472318652, 15551717803658540560436101522178353, -16259512522983475468195070794437558, -1104125231474870756659 -- (+3179 chars; full line in the Zenodo source)
[-35006568394854407024454204946972177, -8041303833287447465725346688176929, -5772283252697316964017071431041220, -10703513990787455862544381396735653, 39786718829225834426233474491566989, 59407096545533953187613348377765117, 25185543601723614634630777938412642, 16259512522983475468195070794437558, -1883916570653868377690808150931228, -21168289099919944268956967876228059, -45799075659619943178843 -- (+3178 chars; full line in the Zenodo source)
[-34728195228974347578428588796434313, -56366775124191543152605546160377203, -22421330808958451211917987073630803, 32961909913524621407939864597589436, 10769321606961386548783768352258170, 49201039431723425003920036298958263, -4025040709513959886972619986746494, 1843084633706577879706162548632130, -348988759870229972188517196552106, -43067706706473119773625999955913461, -113914376801987305037782 -- (+3181 chars; full line in the Zenodo source)
[-6136755121353674128051749703049231, -23407096749699750726409382939268199, 9419448558372897856302156948111191, 9245093976050955845544321973584903, 55223112182282075828053757532231207, 45799075659619943178843641049934886, 42991666995194441289911712472318652, 25797189572799564739248521364913222, -34728195228974347578428588796434313, -44875000228571254807450379268380928, -4986588834033602307996277 -- (+3177 chars; full line in the Zenodo source)
[-42991666995194441289911712472318652, -11178285209619536307444581777092697, -30417130059774688589027667610556361, 6110727024017710215357162360451328, 25730252712324250039009527518866078, 59508974429221115567772732280662401, 40868565129825647312877710709515671, -5205749190920198651831502953766384, 4025040709513959886972619986746494, -51995112991445762275566218298337163, -505864536274432439226397 -- (+3181 chars; full line in the Zenodo source)
[-4954394205432914686407884997704443, -22149311829126785001214696113397883, -10769321606961386548783768352258170, 21609227741702330564010519278707006, 45000484294264208472433738789011754, 43067706706473119773625999955913461, 16856766924159917071346211602732945, -21104285315297529943257274074026444, -41094859616328198495521592382264293, -55343876886455406328102500872286178, -611072702401771021535 -- (+3182 chars; full line in the Zenodo source)
[-21168289099919944268956967876228059, -11045043718398059959572376371427847, -38424931727049441469585527238748559, 44221783486733050041283284882096592, 33460824136595766466128506505484705, 52912162163864689939615222243761269, 15551717803658540560436101522178353, -34728195228974347578428588796434313, -11178285209619536307444581777092697, -33350810280603558326408087574467633, 216092277417023305640 -- (+3179 chars; full line in the Zenodo source)
[-37865710799569085485677835576035381, -11902095900639926679970223924719421, 11271248779562809647742328941424461, 38424931727049441469585527238748559, 60660763810303722300537450659441049, 42991666995194441289911712472318652, -364796231138274846747310725031413, -52912162163864689939615222243761269, -49444522560494472280847162574352608, -10208715879698552697734315871818634, 10769321606961386548783 -- (+3175 chars; full line in the Zenodo source)
[-32195069541566473934804516417933403, -33460824136595766466128506505484705, -10208715879698552697734315871818634, 33350810280603558326408087574467633, 23407096749699750726409382939268199, 25817550593138263795822647730442106, -11040180900241371833073786421067696, -25185543601723614634630777938412642, -25730252712324250039009527518866078, -9245093976050955845544321973584903, 553438768864554063281 -- (+3178 chars; full line in the Zenodo source)
[-20042787299343644099714047561757622, -11391437680198730503778204394574847, 19225547828907069948695643125565193, 55223112182282075828053757532231207, 59508974429221115567772732280662401, 27910755279464970312409440214378056, -16259512522983475468195070794437558, -44875000228571254807450379268380928, -33350810280603558326408087574467633, -9591990404885380216489058998162451, 1190209590063992667997 -- (+3180 chars; full line in the Zenodo source)
[-52912162163864689939615222243761269, 4997646838649065168917398762126501, -6110727024017710215357162360451328, 22421330808958451211917987073630803, 11041252314748707566598956223755439, 5205749190920198651831502953766384, -6136755121353674128051749703049231, -49201039431723425003920036298958263, 9591990404885380216489058998162451, 18293764460830553281325137675646547, 3452864964897777080714649663 -- (+3179 chars; full line in the Zenodo source)
[4025040709513959886972619986746494, -41372488252758781986126558228334297, 9245093976050955845544321973584903, 40015526378215040718448971499056505, 34486595913608376937657540011873222, 25797189572799564739248521364913222, -52912162163864689939615222243761269, -45000484294264208472433738789011754, -16353751450786896543746355461651499, 5772283252697316964017071431041220, 37004422444036018212380881 -- (+3175 chars; full line in the Zenodo source)
[-34486595913608376937657540011873222, -5772283252697316964017071431041220, 4743669275883896149493666415303894, 59407096545533953187613348377765117, 37865710799569085485677835576035381, -1883916570653868377690808150931228, -11041252314748707566598956223755439, -49865888340336023079962772229904577, 21609227741702330564010519278707006, 11902095900639926679970223924719421, 3472819522897434757842858 -- (+3180 chars; full line in the Zenodo source)
[-37004422444036018212380881836941988, -25730252712324250039009527518866078, 37207684519550805855273245965567298, 51995112991445762275566218298337163, 34728195228974347578428588796434313, -16856766924159917071346211602732945, -34528649648977770807146496633119996, -46055890318178299650505122688025872, -16670546969579658463878803624586821, 56366775124191543152605546160377203, 934269141387351377473 -- (+3180 chars; full line in the Zenodo source)
[-47636575888662751572018791448504507, -18375329574763643332958893482318165, 10703513990787455862544381396735653, 60660763810303722300537450659441049, 40868565129825647312877710709515671, -16259512522983475468195070794437558, -22149311829126785001214696113397883, -10208715879698552697734315871818634, 49865888340336023079962772229904577, 19051690073280514824242608811710096, 2579718957279956473924 -- (+3176 chars; full line in the Zenodo source)
[-19051690073280514824242608811710096, 9419448558372897856302156948111191, 44221783486733050041283284882096592, 45799075659619943178843641049934886, 27910755279464970312409440214378056, -34728195228974347578428588796434313, -49444522560494472280847162574352608, -16353751450786896543746355461651499, -4997646838649065168917398762126501, 4954394205432914686407884997704443, -110401809002413718330737 -- (+3179 chars; full line in the Zenodo source)
[-43067706706473119773625999955913461, -8939006193890566816195756790174245, 5058645362744324392263975146680484, 34528649648977770807146496633119996, 12595641161933007275992703498586322, -32195069541566473934804516417933403, -5772283252697316964017071431041220, -19225547828907069948695643125565193, 60660763810303722300537450659441049, 20031879850503843481528991926660111, -266960499049079465871722 -- (+3182 chars; full line in the Zenodo source)
[-11041252314748707566598956223755439, -18293764460830553281325137675646547, 46055890318178299650505122688025872, 41094859616328198495521592382264293, 364796231138274846747310725031413, -47636575888662751572018791448504507, -55223112182282075828053757532231207, 5058645362744324392263975146680484, 8041303833287447465725346688176929, 9605311469525662777673369989543155, 4025040709513959886972619986 -- (+3174 chars; full line in the Zenodo source)
[-25185543601723614634630777938412642, -10769321606961386548783768352258170, 18293764460830553281325137675646547, 43067706706473119773625999955913461, 27349376692497610346754041265764530, -41094859616328198495521592382264293, 16670546969579658463878803624586821, 8939006193890566816195756790174245, 47636575888662751572018791448504507, -15551717803658540560436101522178353, -59508974429221115567772 -- (+3174 chars; full line in the Zenodo source)
[-50538095665436991725255625024378581, 16670546969579658463878803624586821, 55223112182282075828053757532231207, 34486595913608376937657540011873222, -5205749190920198651831502953766384, -44875000228571254807450379268380928, -10208715879698552697734315871818634, 5772283252697316964017071431041220, 4954394205432914686407884997704443, -348988759870229972188517196552106, -11045043718398059959572376 -- (+3176 chars; full line in the Zenodo source)
[-41094859616328198495521592382264293, -5058645362744324392263975146680484, 18375329574763643332958893482318165, 32195069541566473934804516417933403, -9342691413873513774738029949766457, -60660763810303722300537450659441049, -4743669275883896149493666415303894, 33460824136595766466128506505484705, 16259512522983475468195070794437558, -6136755121353674128051749703049231, -400155263782150407184489 -- (+3178 chars; full line in the Zenodo source)
[-10782563675320989276608095027027156, 11271248779562809647742328941424461, 55343876886455406328102500872286178, 42991666995194441289911712472318652, -16259512522983475468195070794437558, -49444522560494472280847162574352608, -32961909913524621407939864597589436, 11178285209619536307444581777092697, 12595641161933007275992703498586322, -37004422444036018212380881836941988, -182937644608305532813 -- (+3181 chars; full line in the Zenodo source)
[-59508974429221115567772732280662401, 9591990404885380216489058998162451, 41372488252758781986126558228334297, 26696049904907946587172233298573605, -35006568394854407024454204946972177, -40015526378215040718448971499056505, 44221783486733050041283284882096592, 10782563675320989276608095027027156, -25797189572799564739248521364913222, -8041303833287447465725346688176929, -10208715879698552697734 -- (+3181 chars; full line in the Zenodo source)
[-8041303833287447465725346688176929, -10703513990787455862544381396735653, 59407096545533953187613348377765117, 16259512522983475468195070794437558, -21168289099919944268956967876228059, -49865888340336023079962772229904577, 10769321606961386548783768352258170, 37004422444036018212380881836941988, -11040180900241371833073786421067696, -11045043718398059959572376371427847, 1635375145078689654374 -- (+3180 chars; full line in the Zenodo source)
[-34528649648977770807146496633119996, 19225547828907069948695643125565193, 33460824136595766466128506505484705, 27910755279464970312409440214378056, 4025040709513959886972619986746494, -33350810280603558326408087574467633, 49865888340336023079962772229904577, 4954394205432914686407884997704443, -25817550593138263795822647730442106, -41372488252758781986126558228334297, -112712487795628096477423 -- (+3182 chars; full line in the Zenodo source)
[-56366775124191543152605546160377203, 32961909913524621407939864597589436, 49201039431723425003920036298958263, 1843084633706577879706162548632130, -43067706706473119773625999955913461, -39786718829225834426233474491566989, 41372488252758781986126558228334297, 40868565129825647312877710709515671, -37865710799569085485677835576035381, -8939006193890566816195756790174245, 552231121822820758280537 -- (+3179 chars; full line in the Zenodo source)
[-44875000228571254807450379268380928, -4743669275883896149493666415303894, 22149311829126785001214696113397883, 1883916570653868377690808150931228, -10782563675320989276608095027027156, -21609227741702330564010519278707006, 51995112991445762275566218298337163, 11040180900241371833073786421067696, -43067706706473119773625999955913461, 11271248779562809647742328941424461, -49976468386490651689173 -- (+3180 chars; full line in the Zenodo source)
[-23407096749699750726409382939268199, 9245093976050955845544321973584903, 45799075659619943178843641049934886, 25797189572799564739248521364913222, -44875000228571254807450379268380928, -16353751450786896543746355461651499, 11178285209619536307444581777092697, -27349376692497610346754041265764530, -56366775124191543152605546160377203, -4743669275883896149493666415303894, 47607170731494157110571 -- (+3175 chars; full line in the Zenodo source)
[-45799075659619943178843641049934886, 16353751450786896543746355461651499, 56366775124191543152605546160377203, -364796231138274846747310725031413, -22149311829126785001214696113397883, -32961909913524621407939864597589436, 59508974429221115567772732280662401, -9605311469525662777673369989543155, -49201039431723425003920036298958263, 21609227741702330564010519278707006, 505380956654369917252556 -- (+3185 chars; full line in the Zenodo source)
[-11178285209619536307444581777092697, 6110727024017710215357162360451328, 59508974429221115567772732280662401, -5205749190920198651831502953766384, -51995112991445762275566218298337163, -9591990404885380216489058998162451, 19051690073280514824242608811710096, -348988759870229972188517196552106, -41372488252758781986126558228334297, 46055890318178299650505122688025872, 32195069541566473934804516 -- (+3179 chars; full line in the Zenodo source)
[-47607170731494157110571408030061005, 37207684519550805855273245965567298, 50538095665436991725255625024378581, -16856766924159917071346211602732945, 4997646838649065168917398762126501, -16670546969579658463878803624586821, 32195069541566473934804516417933403, -35006568394854407024454204946972177, -55223112182282075828053757532231207, 22421330808958451211917987073630803, 40868565129825647312877 -- (+3182 chars; full line in the Zenodo source)
[-22149311829126785001214696113397883, 21609227741702330564010519278707006, 43067706706473119773625999955913461, -21104285315297529943257274074026444, -55343876886455406328102500872286178, 8939006193890566816195756790174245, 35006568394854407024454204946972177, -20042787299343644099714047561757622, -5058645362744324392263975146680484, 49444522560494472280847162574352608, 520574919092019865183150 -- (+3176 chars; full line in the Zenodo source)
[-60660763810303722300537450659441049, 10208715879698552697734315871818634, 37004422444036018212380881836941988, -25817550593138263795822647730442106, 9419448558372897856302156948111191, 25730252712324250039009527518866078, 21104285315297529943257274074026444, -11041252314748707566598956223755439, -37207684519550805855273245965567298, 45799075659619943178843641049934886, -15551717803658540560436 -- (+3176 chars; full line in the Zenodo source)
[-11045043718398059959572376371427847, 44221783486733050041283284882096592, 52912162163864689939615222243761269, -34728195228974347578428588796434313, -33350810280603558326408087574467633, -4997646838649065168917398762126501, 12595641161933007275992703498586322, -56366775124191543152605546160377203, 6110727024017710215357162360451328, 25185543601723614634630777938412642, -21104285315297529943257 -- (+3181 chars; full line in the Zenodo source)
[-49201039431723425003920036298958263, 39786718829225834426233474491566989, 37865710799569085485677835576035381, -21168289099919944268956967876228059, -5058645362744324392263975146680484, 11902095900639926679970223924719421, 25797189572799564739248521364913222, -11045043718398059959572376371427847, -11271248779562809647742328941424461, 32195069541566473934804516417933403, -4954394205432914686407 -- (+3179 chars; full line in the Zenodo source)
[-11902095900639926679970223924719421, 38424931727049441469585527238748559, 42991666995194441289911712472318652, -52912162163864689939615222243761269, -10208715879698552697734315871818634, 11178285209619536307444581777092697, -9605311469525662777673369989543155, 4997646838649065168917398762126501, 30417130059774688589027667610556361, 25817550593138263795822647730442106, -430677067064731197736259 -- (+3177 chars; full line in the Zenodo source)
[-51995112991445762275566218298337163, 46055890318178299650505122688025872, 35006568394854407024454204946972177, -47636575888662751572018791448504507, 32961909913524621407939864597589436, 8041303833287447465725346688176929, -27910755279464970312409440214378056, -18375329574763643332958893482318165, 5772283252697316964017071431041220, 1843084633706577879706162548632130, -2340709674969975072640938 -- (+3182 chars; full line in the Zenodo source)
[-33460824136595766466128506505484705, 33350810280603558326408087574467633, 25817550593138263795822647730442106, -25185543601723614634630777938412642, -9245093976050955845544321973584903, 11041252314748707566598956223755439, -865291236903708681418288619348553, -10769321606961386548783768352258170, 51995112991445762275566218298337163, -25797189572799564739248521364913222, -49444522560494472280847 -- (+3178 chars; full line in the Zenodo source)
[-49444522560494472280847162574352608, 30417130059774688589027667610556361, 20031879850503843481528991926660111, -59508974429221115567772732280662401, 37207684519550805855273245965567298, -4025040709513959886972619986746494, -21168289099919944268956967876228059, 9591990404885380216489058998162451, 23407096749699750726409382939268199, -16856766924159917071346211602732945, -18375329574763643332958 -- (+3181 chars; full line in the Zenodo source)
[-11391437680198730503778204394574847, 55223112182282075828053757532231207, 27910755279464970312409440214378056, -44875000228571254807450379268380928, -9591990404885380216489058998162451, 4954394205432914686407884997704443, -37004422444036018212380881836941988, -4743669275883896149493666415303894, 25185543601723614634630777938412642, -26696049904907946587172233298573605, -38424931727049441469585 -- (+3182 chars; full line in the Zenodo source)
[-59407096545533953187613348377765117, 49865888340336023079962772229904577, 11040180900241371833073786421067696, -47607170731494157110571408030061005, 38424931727049441469585527238748559, 865291236903708681418288619348553, -41094859616328198495521592382264293, 37207684519550805855273245965567298, 20042787299343644099714047561757622, -52912162163864689939615222243761269, 3296190991352462140793986 -- (+3176 chars; full line in the Zenodo source)
[4997646838649065168917398762126501, 22421330808958451211917987073630803, 5205749190920198651831502953766384, -49201039431723425003920036298958263, 18293764460830553281325137675646547, 348988759870229972188517196552106, -23407096749699750726409382939268199, 39786718829225834426233474491566989, 26696049904907946587172233298573605, -41094859616328198495521592382264293, -192255478289070699486956431 -- (+3179 chars; full line in the Zenodo source)
[-45000484294264208472433738789011754, 55343876886455406328102500872286178, 15551717803658540560436101522178353, -49444522560494472280847162574352608, 49865888340336023079962772229904577, 12595641161933007275992703498586322, -49201039431723425003920036298958263, 30417130059774688589027667610556361, 9342691413873513774738029949766457, -47607170731494157110571408030061005, 460558903181782996505051 -- (+3181 chars; full line in the Zenodo source)
[-41372488252758781986126558228334297, 40015526378215040718448971499056505, 25797189572799564739248521364913222, -45000484294264208472433738789011754, 5772283252697316964017071431041220, -27349376692497610346754041265764530, 4997646838649065168917398762126501, 55343876886455406328102500872286178, 364796231138274846747310725031413, -59407096545533953187613348377765117, 257302527123242500390095275 -- (+3171 chars; full line in the Zenodo source)
[-40015526378215040718448971499056505, 45000484294264208472433738789011754, 27349376692497610346754041265764530, -55343876886455406328102500872286178, 59407096545533953187613348377765117, -15551717803658540560436101522178353, -22421330808958451211917987073630803, 49444522560494472280847162574352608, -9605311469525662777673369989543155, -49865888340336023079962772229904577, 5199511299144576227556 -- (+3183 chars; full line in the Zenodo source)
[-5772283252697316964017071431041220, 59407096545533953187613348377765117, -1883916570653868377690808150931228, -49865888340336023079962772229904577, 11902095900639926679970223924719421, -11040180900241371833073786421067696, -18293764460830553281325137675646547, 47607170731494157110571408030061005, -21104285315297529943257274074026444, -38424931727049441469585527238748559, 5636677512419154315260 -- (+3182 chars; full line in the Zenodo source)
[-55343876886455406328102500872286178, 49444522560494472280847162574352608, -12595641161933007275992703498586322, -30417130059774688589027667610556361, 47607170731494157110571408030061005, -20031879850503843481528991926660111, -39786718829225834426233474491566989, 59508974429221115567772732280662401, -6136755121353674128051749703049231, -37207684519550805855273245965567298, 476365758886627515720 -- (+3177 chars; full line in the Zenodo source)
[-25730252712324250039009527518866078, 51995112991445762275566218298337163, -16856766924159917071346211602732945, -46055890318178299650505122688025872, 56366775124191543152605546160377203, -35006568394854407024454204946972177, 19225547828907069948695643125565193, 47636575888662751572018791448504507, -34486595913608376937657540011873222, -32961909913524621407939864597589436, 613675512135367412805 -- (+3180 chars; full line in the Zenodo source)
[-22421330808958451211917987073630803, 49201039431723425003920036298958263, -348988759870229972188517196552106, -39786718829225834426233474491566989, 41094859616328198495521592382264293, -37865710799569085485677835576035381, -9245093976050955845544321973584903, 21168289099919944268956967876228059, -10782563675320989276608095027027156, 5058645362744324392263975146680484, 2791075527946497031240944 -- (+3177 chars; full line in the Zenodo source)
[-18375329574763643332958893482318165, 60660763810303722300537450659441049, -16259512522983475468195070794437558, -10208715879698552697734315871818634, 19051690073280514824242608811710096, -37004422444036018212380881836941988, 21609227741702330564010519278707006, 25817550593138263795822647730442106, -47607170731494157110571408030061005, -9419448558372897856302156948111191, -273493766924976103467 -- (+3180 chars; full line in the Zenodo source)
[-49865888340336023079962772229904577, 47607170731494157110571408030061005, -865291236903708681418288619348553, -37207684519550805855273245965567298, 52912162163864689939615222243761269, -50538095665436991725255625024378581, 5058645362744324392263975146680484, 16856766924159917071346211602732945, -11391437680198730503778204394574847, -4997646838649065168917398762126501, -184308463370657787970616 -- (+3180 chars; full line in the Zenodo source)
[9419448558372897856302156948111191, 45799075659619943178843641049934886, -34728195228974347578428588796434313, -16353751450786896543746355461651499, 4954394205432914686407884997704443, -56366775124191543152605546160377203, 30417130059774688589027667610556361, 364796231138274846747310725031413, -22421330808958451211917987073630803, 22149311829126785001214696113397883, -86529123690370868141828861 -- (+3177 chars; full line in the Zenodo source)
[-55223112182282075828053757532231207, 44875000228571254807450379268380928, -4954394205432914686407884997704443, 4743669275883896149493666415303894, 26696049904907946587172233298573605, -22149311829126785001214696113397883, 25730252712324250039009527518866078, -1883916570653868377690808150931228, -10769321606961386548783768352258170, 10782563675320989276608095027027156, -529121621638646899396152 -- (+3182 chars; full line in the Zenodo source)
[-8939006193890566816195756790174245, 34528649648977770807146496633119996, -32195069541566473934804516417933403, -19225547828907069948695643125565193, 20031879850503843481528991926660111, -33460824136595766466128506505484705, 59407096545533953187613348377765117, -27910755279464970312409440214378056, -10208715879698552697734315871818634, -4025040709513959886972619986746494, -107825636753209892766 -- (+3182 chars; full line in the Zenodo source)
[-30417130059774688589027667610556361, 59508974429221115567772732280662401, 4025040709513959886972619986746494, -9591990404885380216489058998162451, 16856766924159917071346211602732945, -41372488252758781986126558228334297, 11045043718398059959572376371427847, -26696049904907946587172233298573605, 9245093976050955845544321973584903, 35006568394854407024454204946972177, -6066076381030372230053745 -- (+3177 chars; full line in the Zenodo source)
[-18293764460830553281325137675646547, 41094859616328198495521592382264293, -47636575888662751572018791448504507, 5058645362744324392263975146680484, 9605311469525662777673369989543155, -18375329574763643332958893482318165, 44875000228571254807450379268380928, -32195069541566473934804516417933403, 10703513990787455862544381396735653, 9342691413873513774738029949766457, -4137248825275878198612655 -- (+3180 chars; full line in the Zenodo source)
[-33350810280603558326408087574467633, 25185543601723614634630777938412642, -11041252314748707566598956223755439, 10769321606961386548783768352258170, 25797189572799564739248521364913222, -18293764460830553281325137675646547, 50538095665436991725255625024378581, -43067706706473119773625999955913461, 46055890318178299650505122688025872, -27349376692497610346754041265764530, -304171300597746885890 -- (+3174 chars; full line in the Zenodo source)
[-10769321606961386548783768352258170, 43067706706473119773625999955913461, -41094859616328198495521592382264293, 8939006193890566816195756790174245, -15551717803658540560436101522178353, -5058645362744324392263975146680484, 34486595913608376937657540011873222, -34528649648977770807146496633119996, 18375329574763643332958893482318165, -12595641161933007275992703498586322, 95919904048853802164890 -- (+3180 chars; full line in the Zenodo source)
[-46055890318178299650505122688025872, 47636575888662751572018791448504507, -8041303833287447465725346688176929, 18375329574763643332958893482318165, -1843084633706577879706162548632130, -10703513990787455862544381396735653, 4954394205432914686407884997704443, -60660763810303722300537450659441049, 59407096545533953187613348377765117, -40868565129825647312877710709515671, -92450939760509558455443 -- (+3178 chars; full line in the Zenodo source)
[16670546969579658463878803624586821, 34486595913608376937657540011873222, -44875000228571254807450379268380928, 5772283252697316964017071431041220, -348988759870229972188517196552106, -4743669275883896149493666415303894, 25817550593138263795822647730442106, -59407096545533953187613348377765117, 22149311829126785001214696113397883, -37865710799569085485677835576035381, 44221783486733050041283284 -- (+3180 chars; full line in the Zenodo source)
[-38424931727049441469585527238748559, 52912162163864689939615222243761269, -11178285209619536307444581777092697, -4997646838649065168917398762126501, -25817550593138263795822647730442106, 6110727024017710215357162360451328, 9342691413873513774738029949766457, -22421330808958451211917987073630803, 59508974429221115567772732280662401, -11041252314748707566598956223755439, 893900619389056681619575 -- (+3181 chars; full line in the Zenodo source)
[-5058645362744324392263975146680484, 32195069541566473934804516417933403, -60660763810303722300537450659441049, 33460824136595766466128506505484705, -6136755121353674128051749703049231, 10208715879698552697734315871818634, 1883916570653868377690808150931228, -33350810280603558326408087574467633, 37004422444036018212380881836941988, -23407096749699750726409382939268199, 4500048429426420847243373 -- (+3174 chars; full line in the Zenodo source)
[-39786718829225834426233474491566989, 21168289099919944268956967876228059, -11902095900639926679970223924719421, 11045043718398059959572376371427847, -32195069541566473934804516417933403, 38424931727049441469585527238748559, 27349376692497610346754041265764530, -44221783486733050041283284882096592, 42991666995194441289911712472318652, -33460824136595766466128506505484705, 2214931182912678500121 -- (+3181 chars; full line in the Zenodo source)
[11271248779562809647742328941424461, 42991666995194441289911712472318652, -49444522560494472280847162574352608, 11178285209619536307444581777092697, -37004422444036018212380881836941988, 30417130059774688589027667610556361, -1843084633706577879706162548632130, -6110727024017710215357162360451328, 20031879850503843481528991926660111, -25730252712324250039009527518866078, 410948596163281984955215 -- (+3177 chars; full line in the Zenodo source)
[-44221783486733050041283284882096592, 34728195228974347578428588796434313, 4997646838649065168917398762126501, 56366775124191543152605546160377203, -25185543601723614634630777938412642, 22421330808958451211917987073630803, -20031879850503843481528991926660111, -32961909913524621407939864597589436, 5205749190920198651831502953766384, -10769321606961386548783768352258170, 200427872993436440997140 -- (+3177 chars; full line in the Zenodo source)
[9591990404885380216489058998162451, 26696049904907946587172233298573605, -40015526378215040718448971499056505, 10782563675320989276608095027027156, -8041303833287447465725346688176929, 45000484294264208472433738789011754, -34728195228974347578428588796434313, -11271248779562809647742328941424461, 27349376692497610346754041265764530, -10703513990787455862544381396735653, 258175505931382637958226 -- (+3177 chars; full line in the Zenodo source)
[-10208715879698552697734315871818634, 25817550593138263795822647730442106, -25730252712324250039009527518866078, 11041252314748707566598956223755439, -45799075659619943178843641049934886, 51995112991445762275566218298337163, -20042787299343644099714047561757622, 18293764460830553281325137675646547, -16856766924159917071346211602732945, 16353751450786896543746355461651499, 1259564116193300727599 -- (+3182 chars; full line in the Zenodo source)
[-10703513990787455862544381396735653, 16259512522983475468195070794437558, -49865888340336023079962772229904577, 37004422444036018212380881836941988, -11045043718398059959572376371427847, 47607170731494157110571408030061005, -43067706706473119773625999955913461, 25730252712324250039009527518866078, -865291236903708681418288619348553, 44221783486733050041283284882096592, -36479623113827484674731 -- (+3180 chars; full line in the Zenodo source)
[-21609227741702330564010519278707006, 21104285315297529943257274074026444, -8939006193890566816195756790174245, 20042787299343644099714047561757622, -49444522560494472280847162574352608, 34528649648977770807146496633119996, -8041303833287447465725346688176929, 11391437680198730503778204394574847, -32195069541566473934804516417933403, 30417130059774688589027667610556361, -34898875987022997218851 -- (+3180 chars; full line in the Zenodo source)
[19225547828907069948695643125565193, 27910755279464970312409440214378056, -33350810280603558326408087574467633, 4954394205432914686407884997704443, -41372488252758781986126558228334297, 25185543601723614634630777938412642, -47607170731494157110571408030061005, 22149311829126785001214696113397883, -11041252314748707566598956223755439, 40015526378215040718448971499056505, -42991666995194441289911 -- (+3176 chars; full line in the Zenodo source)
[-37207684519550805855273245965567298, 16856766924159917071346211602732945, 16670546969579658463878803624586821, 35006568394854407024454204946972177, -22421330808958451211917987073630803, 34486595913608376937657540011873222, -33460824136595766466128506505484705, 8041303833287447465725346688176929, -44875000228571254807450379268380928, 49201039431723425003920036298958263, -19051690073280514824242 -- (+3178 chars; full line in the Zenodo source)
[32961909913524621407939864597589436, 1843084633706577879706162548632130, -39786718829225834426233474491566989, 40868565129825647312877710709515671, -8939006193890566816195756790174245, 21168289099919944268956967876228059, -40015526378215040718448971499056505, 19051690073280514824242608811710096, -11902095900639926679970223924719421, 34528649648977770807146496633119996, -448750002285712548074503 -- (+3179 chars; full line in the Zenodo source)
[-6110727024017710215357162360451328, 5205749190920198651831502953766384, 9591990404885380216489058998162451, 348988759870229972188517196552106, -46055890318178299650505122688025872, 26696049904907946587172233298573605, 9419448558372897856302156948111191, 37865710799569085485677835576035381, -40015526378215040718448971499056505, 47636575888662751572018791448504507, -33460824136595766466128506505 -- (+3175 chars; full line in the Zenodo source)
[-4743669275883896149493666415303894, 1883916570653868377690808150931228, -21609227741702330564010519278707006, 11040180900241371833073786421067696, 11271248779562809647742328941424461, 21104285315297529943257274074026444, -46055890318178299650505122688025872, 865291236903708681418288619348553, -8939006193890566816195756790174245, 42991666995194441289911712472318652, -224213308089584512119179870 -- (+3180 chars; full line in the Zenodo source)
[-16353751450786896543746355461651499, 364796231138274846747310725031413, 32961909913524621407939864597589436, 9605311469525662777673369989543155, -21609227741702330564010519278707006, 1843084633706577879706162548632130, 9591990404885380216489058998162451, 9342691413873513774738029949766457, -39786718829225834426233474491566989, 21104285315297529943257274074026444, 166705469695796584638788036245 -- (+3177 chars; full line in the Zenodo source)
[9245093976050955845544321973584903, 25797189572799564739248521364913222, -16353751450786896543746355461651499, -27349376692497610346754041265764530, -4743669275883896149493666415303894, 364796231138274846747310725031413, -6110727024017710215357162360451328, 15551717803658540560436101522178353, 32961909913524621407939864597589436, 1883916570653868377690808150931228, -3720768451955080585527324596 -- (+3173 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 96).map (fun t => rowA (192 + 1) t (rng 1 96)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 96 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 96 B A = sid 210994202882637311900621190515476077826 96 := rfl
theorem d_ne : (210994202882637311900621190515476077826 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 96 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 96) (h0 : mv A g = zeros 96) : g = zeros 96 :=
kernel_zero 96 210994202882637311900621190515476077826 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 192 96 = true := rfl
/-- **Balanced ⇒ pairs for p = 193.** A list with entries in (0, 193) that is balanced for 1 ≤ t ≤ 96
has as many copies of x as of 193 − x for every 1 ≤ x ≤ 96 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 193)
(hb : ∀ t, 1 ≤ t → t < 1 + 96 → tsum 193 t c + tsum 193 t c = c.length * 193) :
(rng 1 96).all (fun x => Nat.beq (cnt x c) (cnt (193 - x) c)) = true :=
pairs_of_bal 192 96 210994202882637311900621190515476077826 d_ne A B len cert A_def delta c hr hb
end MailletCert193
#print axioms MailletCert193.A_def
#print axioms MailletCert193.len
#print axioms MailletCert193.cert
#print axioms MailletCert193.d_ne
#print axioms MailletCert193.kernel
#print axioms MailletCert193.delta
#print axioms MailletCert193.pairs
lean_all/hodge/MailletCert197.lean
/-
hodge/MailletCert197.lean — T41 (goals G849b, G849c): for p = 197 the 98 × 98 matrix A[t][x] = 2⟨t x⟩ − p (1 ≤ t, x ≤ 98)
is invertible over ℚ: an integer matrix B with B · A = d · I, d = 544981018543289669550455380759127224420 (tools/maillet_cert.py). With the finite
check deltaOK and hodge/MailletBridge: every balanced list with entries in (0, 197) is a union of complementary
pairs, at every length. Lean 4 core, rfl.
-/
import hodge.MailletBridge
set_option maxHeartbeats 0
namespace MailletCert197
open MailletLin MailletBridge
set_option maxRecDepth 100000 in
def A : List (List Int) := [
[-195, -193, -191, -189, -187, -185, -183, -181, -179, -177, -175, -173, -171, -169, -167, -165, -163, -161, -159, -157, -155, -153, -151, -149, -147, -145, -143, -141, -139, -137, -135, -133, -131, -129, -127, -125, -123, -121, -119, -117, -115, -113, -111, -109, -107, -105, -103, -101, -99, -97, -95, -93, -91, -89, -87, -85, -83, -81, -79, -77, -75, -73, -71, -69, -67, -65, -63, -61, -59, -57, -- (+136 chars; full line in the Zenodo source)
[-193, -189, -185, -181, -177, -173, -169, -165, -161, -157, -153, -149, -145, -141, -137, -133, -129, -125, -121, -117, -113, -109, -105, -101, -97, -93, -89, -85, -81, -77, -73, -69, -65, -61, -57, -53, -49, -45, -41, -37, -33, -29, -25, -21, -17, -13, -9, -5, -1, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127 -- (+87 chars; full line in the Zenodo source)
[-191, -185, -179, -173, -167, -161, -155, -149, -143, -137, -131, -125, -119, -113, -107, -101, -95, -89, -83, -77, -71, -65, -59, -53, -47, -41, -35, -29, -23, -17, -11, -5, 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 169, 175, 181, 187, 193, -195, -189, -183, -177, -171, -165, -159, -153, -147, -141, -135, -129, -123 -- (+103 chars; full line in the Zenodo source)
[-189, -181, -173, -165, -157, -149, -141, -133, -125, -117, -109, -101, -93, -85, -77, -69, -61, -53, -45, -37, -29, -21, -13, -5, 3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, 179, 187, 195, -191, -183, -175, -167, -159, -151, -143, -135, -127, -119, -111, -103, -95, -87, -79, -71, -63, -55, -47, -39, -31, -23, -15, -7, 1, 9, 17, 25, 33, 41, 49 -- (+86 chars; full line in the Zenodo source)
[-187, -177, -167, -157, -147, -137, -127, -117, -107, -97, -87, -77, -67, -57, -47, -37, -27, -17, -7, 3, 13, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133, 143, 153, 163, 173, 183, 193, -191, -181, -171, -161, -151, -141, -131, -121, -111, -101, -91, -81, -71, -61, -51, -41, -31, -21, -11, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 109, 119, 129, 139, 149, 159, 169, 179, 189, -195, -185, -- (+97 chars; full line in the Zenodo source)
[-185, -173, -161, -149, -137, -125, -113, -101, -89, -77, -65, -53, -41, -29, -17, -5, 7, 19, 31, 43, 55, 67, 79, 91, 103, 115, 127, 139, 151, 163, 175, 187, -195, -183, -171, -159, -147, -135, -123, -111, -99, -87, -75, -63, -51, -39, -27, -15, -3, 9, 21, 33, 45, 57, 69, 81, 93, 105, 117, 129, 141, 153, 165, 177, 189, -193, -181, -169, -157, -145, -133, -121, -109, -97, -85, -73, -61, -49, -37 -- (+88 chars; full line in the Zenodo source)
[-183, -169, -155, -141, -127, -113, -99, -85, -71, -57, -43, -29, -15, -1, 13, 27, 41, 55, 69, 83, 97, 111, 125, 139, 153, 167, 181, 195, -185, -171, -157, -143, -129, -115, -101, -87, -73, -59, -45, -31, -17, -3, 11, 25, 39, 53, 67, 81, 95, 109, 123, 137, 151, 165, 179, 193, -187, -173, -159, -145, -131, -117, -103, -89, -75, -61, -47, -33, -19, -5, 9, 23, 37, 51, 65, 79, 93, 107, 121, 135, 14 -- (+94 chars; full line in the Zenodo source)
[-181, -165, -149, -133, -117, -101, -85, -69, -53, -37, -21, -5, 11, 27, 43, 59, 75, 91, 107, 123, 139, 155, 171, 187, -191, -175, -159, -143, -127, -111, -95, -79, -63, -47, -31, -15, 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, 193, -185, -169, -153, -137, -121, -105, -89, -73, -57, -41, -25, -9, 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, -195, -179, -163, -147, -131, -115, - -- (+87 chars; full line in the Zenodo source)
[-179, -161, -143, -125, -107, -89, -71, -53, -35, -17, 1, 19, 37, 55, 73, 91, 109, 127, 145, 163, 181, -195, -177, -159, -141, -123, -105, -87, -69, -51, -33, -15, 3, 21, 39, 57, 75, 93, 111, 129, 147, 165, 183, -193, -175, -157, -139, -121, -103, -85, -67, -49, -31, -13, 5, 23, 41, 59, 77, 95, 113, 131, 149, 167, 185, -191, -173, -155, -137, -119, -101, -83, -65, -47, -29, -11, 7, 25, 43, 61, -- (+92 chars; full line in the Zenodo source)
[-177, -157, -137, -117, -97, -77, -57, -37, -17, 3, 23, 43, 63, 83, 103, 123, 143, 163, 183, -191, -171, -151, -131, -111, -91, -71, -51, -31, -11, 9, 29, 49, 69, 89, 109, 129, 149, 169, 189, -185, -165, -145, -125, -105, -85, -65, -45, -25, -5, 15, 35, 55, 75, 95, 115, 135, 155, 175, 195, -179, -159, -139, -119, -99, -79, -59, -39, -19, 1, 21, 41, 61, 81, 101, 121, 141, 161, 181, -193, -173, - -- (+86 chars; full line in the Zenodo source)
[-175, -153, -131, -109, -87, -65, -43, -21, 1, 23, 45, 67, 89, 111, 133, 155, 177, -195, -173, -151, -129, -107, -85, -63, -41, -19, 3, 25, 47, 69, 91, 113, 135, 157, 179, -193, -171, -149, -127, -105, -83, -61, -39, -17, 5, 27, 49, 71, 93, 115, 137, 159, 181, -191, -169, -147, -125, -103, -81, -59, -37, -15, 7, 29, 51, 73, 95, 117, 139, 161, 183, -189, -167, -145, -123, -101, -79, -57, -35, -1 -- (+91 chars; full line in the Zenodo source)
[-173, -149, -125, -101, -77, -53, -29, -5, 19, 43, 67, 91, 115, 139, 163, 187, -183, -159, -135, -111, -87, -63, -39, -15, 9, 33, 57, 81, 105, 129, 153, 177, -193, -169, -145, -121, -97, -73, -49, -25, -1, 23, 47, 71, 95, 119, 143, 167, 191, -179, -155, -131, -107, -83, -59, -35, -11, 13, 37, 61, 85, 109, 133, 157, 181, -189, -165, -141, -117, -93, -69, -45, -21, 3, 27, 51, 75, 99, 123, 147, 17 -- (+87 chars; full line in the Zenodo source)
[-171, -145, -119, -93, -67, -41, -15, 11, 37, 63, 89, 115, 141, 167, 193, -175, -149, -123, -97, -71, -45, -19, 7, 33, 59, 85, 111, 137, 163, 189, -179, -153, -127, -101, -75, -49, -23, 3, 29, 55, 81, 107, 133, 159, 185, -183, -157, -131, -105, -79, -53, -27, -1, 25, 51, 77, 103, 129, 155, 181, -187, -161, -135, -109, -83, -57, -31, -5, 21, 47, 73, 99, 125, 151, 177, -191, -165, -139, -113, -87 -- (+91 chars; full line in the Zenodo source)
[-169, -141, -113, -85, -57, -29, -1, 27, 55, 83, 111, 139, 167, 195, -171, -143, -115, -87, -59, -31, -3, 25, 53, 81, 109, 137, 165, 193, -173, -145, -117, -89, -61, -33, -5, 23, 51, 79, 107, 135, 163, 191, -175, -147, -119, -91, -63, -35, -7, 21, 49, 77, 105, 133, 161, 189, -177, -149, -121, -93, -65, -37, -9, 19, 47, 75, 103, 131, 159, 187, -179, -151, -123, -95, -67, -39, -11, 17, 45, 73, 10 -- (+87 chars; full line in the Zenodo source)
[-167, -137, -107, -77, -47, -17, 13, 43, 73, 103, 133, 163, 193, -171, -141, -111, -81, -51, -21, 9, 39, 69, 99, 129, 159, 189, -175, -145, -115, -85, -55, -25, 5, 35, 65, 95, 125, 155, 185, -179, -149, -119, -89, -59, -29, 1, 31, 61, 91, 121, 151, 181, -183, -153, -123, -93, -63, -33, -3, 27, 57, 87, 117, 147, 177, -187, -157, -127, -97, -67, -37, -7, 23, 53, 83, 113, 143, 173, -191, -161, -13 -- (+90 chars; full line in the Zenodo source)
[-165, -133, -101, -69, -37, -5, 27, 59, 91, 123, 155, 187, -175, -143, -111, -79, -47, -15, 17, 49, 81, 113, 145, 177, -185, -153, -121, -89, -57, -25, 7, 39, 71, 103, 135, 167, -195, -163, -131, -99, -67, -35, -3, 29, 61, 93, 125, 157, 189, -173, -141, -109, -77, -45, -13, 19, 51, 83, 115, 147, 179, -183, -151, -119, -87, -55, -23, 9, 41, 73, 105, 137, 169, -193, -161, -129, -97, -65, -33, -1, -- (+88 chars; full line in the Zenodo source)
[-163, -129, -95, -61, -27, 7, 41, 75, 109, 143, 177, -183, -149, -115, -81, -47, -13, 21, 55, 89, 123, 157, 191, -169, -135, -101, -67, -33, 1, 35, 69, 103, 137, 171, -189, -155, -121, -87, -53, -19, 15, 49, 83, 117, 151, 185, -175, -141, -107, -73, -39, -5, 29, 63, 97, 131, 165, -195, -161, -127, -93, -59, -25, 9, 43, 77, 111, 145, 179, -181, -147, -113, -79, -45, -11, 23, 57, 91, 125, 159, 19 -- (+89 chars; full line in the Zenodo source)
[-161, -125, -89, -53, -17, 19, 55, 91, 127, 163, -195, -159, -123, -87, -51, -15, 21, 57, 93, 129, 165, -193, -157, -121, -85, -49, -13, 23, 59, 95, 131, 167, -191, -155, -119, -83, -47, -11, 25, 61, 97, 133, 169, -189, -153, -117, -81, -45, -9, 27, 63, 99, 135, 171, -187, -151, -115, -79, -43, -7, 29, 65, 101, 137, 173, -185, -149, -113, -77, -41, -5, 31, 67, 103, 139, 175, -183, -147, -111, - -- (+91 chars; full line in the Zenodo source)
[-159, -121, -83, -45, -7, 31, 69, 107, 145, 183, -173, -135, -97, -59, -21, 17, 55, 93, 131, 169, -187, -149, -111, -73, -35, 3, 41, 79, 117, 155, 193, -163, -125, -87, -49, -11, 27, 65, 103, 141, 179, -177, -139, -101, -63, -25, 13, 51, 89, 127, 165, -191, -153, -115, -77, -39, -1, 37, 75, 113, 151, 189, -167, -129, -91, -53, -15, 23, 61, 99, 137, 175, -181, -143, -105, -67, -29, 9, 47, 85, 12 -- (+90 chars; full line in the Zenodo source)
[-157, -117, -77, -37, 3, 43, 83, 123, 163, -191, -151, -111, -71, -31, 9, 49, 89, 129, 169, -185, -145, -105, -65, -25, 15, 55, 95, 135, 175, -179, -139, -99, -59, -19, 21, 61, 101, 141, 181, -173, -133, -93, -53, -13, 27, 67, 107, 147, 187, -167, -127, -87, -47, -7, 33, 73, 113, 153, 193, -161, -121, -81, -41, -1, 39, 79, 119, 159, -195, -155, -115, -75, -35, 5, 45, 85, 125, 165, -189, -149, - -- (+87 chars; full line in the Zenodo source)
[-155, -113, -71, -29, 13, 55, 97, 139, 181, -171, -129, -87, -45, -3, 39, 81, 123, 165, -187, -145, -103, -61, -19, 23, 65, 107, 149, 191, -161, -119, -77, -35, 7, 49, 91, 133, 175, -177, -135, -93, -51, -9, 33, 75, 117, 159, -193, -151, -109, -67, -25, 17, 59, 101, 143, 185, -167, -125, -83, -41, 1, 43, 85, 127, 169, -183, -141, -99, -57, -15, 27, 69, 111, 153, 195, -157, -115, -73, -31, 11, 5 -- (+89 chars; full line in the Zenodo source)
[-153, -109, -65, -21, 23, 67, 111, 155, -195, -151, -107, -63, -19, 25, 69, 113, 157, -193, -149, -105, -61, -17, 27, 71, 115, 159, -191, -147, -103, -59, -15, 29, 73, 117, 161, -189, -145, -101, -57, -13, 31, 75, 119, 163, -187, -143, -99, -55, -11, 33, 77, 121, 165, -185, -141, -97, -53, -9, 35, 79, 123, 167, -183, -139, -95, -51, -7, 37, 81, 125, 169, -181, -137, -93, -49, -5, 39, 83, 127, 1 -- (+92 chars; full line in the Zenodo source)
[-151, -105, -59, -13, 33, 79, 125, 171, -177, -131, -85, -39, 7, 53, 99, 145, 191, -157, -111, -65, -19, 27, 73, 119, 165, -183, -137, -91, -45, 1, 47, 93, 139, 185, -163, -117, -71, -25, 21, 67, 113, 159, -189, -143, -97, -51, -5, 41, 87, 133, 179, -169, -123, -77, -31, 15, 61, 107, 153, -195, -149, -103, -57, -11, 35, 81, 127, 173, -175, -129, -83, -37, 9, 55, 101, 147, 193, -155, -109, -63, -- (+88 chars; full line in the Zenodo source)
[-149, -101, -53, -5, 43, 91, 139, 187, -159, -111, -63, -15, 33, 81, 129, 177, -169, -121, -73, -25, 23, 71, 119, 167, -179, -131, -83, -35, 13, 61, 109, 157, -189, -141, -93, -45, 3, 51, 99, 147, 195, -151, -103, -55, -7, 41, 89, 137, 185, -161, -113, -65, -17, 31, 79, 127, 175, -171, -123, -75, -27, 21, 69, 117, 165, -181, -133, -85, -37, 11, 59, 107, 155, -191, -143, -95, -47, 1, 49, 97, 145 -- (+86 chars; full line in the Zenodo source)
[-147, -97, -47, 3, 53, 103, 153, -191, -141, -91, -41, 9, 59, 109, 159, -185, -135, -85, -35, 15, 65, 115, 165, -179, -129, -79, -29, 21, 71, 121, 171, -173, -123, -73, -23, 27, 77, 127, 177, -167, -117, -67, -17, 33, 83, 133, 183, -161, -111, -61, -11, 39, 89, 139, 189, -155, -105, -55, -5, 45, 95, 145, 195, -149, -99, -49, 1, 51, 101, 151, -193, -143, -93, -43, 7, 57, 107, 157, -187, -137, -8 -- (+88 chars; full line in the Zenodo source)
[-145, -93, -41, 11, 63, 115, 167, -175, -123, -71, -19, 33, 85, 137, 189, -153, -101, -49, 3, 55, 107, 159, -183, -131, -79, -27, 25, 77, 129, 181, -161, -109, -57, -5, 47, 99, 151, -191, -139, -87, -35, 17, 69, 121, 173, -169, -117, -65, -13, 39, 91, 143, 195, -147, -95, -43, 9, 61, 113, 165, -177, -125, -73, -21, 31, 83, 135, 187, -155, -103, -51, 1, 53, 105, 157, -185, -133, -81, -29, 23, 75 -- (+86 chars; full line in the Zenodo source)
[-143, -89, -35, 19, 73, 127, 181, -159, -105, -51, 3, 57, 111, 165, -175, -121, -67, -13, 41, 95, 149, -191, -137, -83, -29, 25, 79, 133, 187, -153, -99, -45, 9, 63, 117, 171, -169, -115, -61, -7, 47, 101, 155, -185, -131, -77, -23, 31, 85, 139, 193, -147, -93, -39, 15, 69, 123, 177, -163, -109, -55, -1, 53, 107, 161, -179, -125, -71, -17, 37, 91, 145, -195, -141, -87, -33, 21, 75, 129, 183, -1 -- (+89 chars; full line in the Zenodo source)
[-141, -85, -29, 27, 83, 139, 195, -143, -87, -31, 25, 81, 137, 193, -145, -89, -33, 23, 79, 135, 191, -147, -91, -35, 21, 77, 133, 189, -149, -93, -37, 19, 75, 131, 187, -151, -95, -39, 17, 73, 129, 185, -153, -97, -41, 15, 71, 127, 183, -155, -99, -43, 13, 69, 125, 181, -157, -101, -45, 11, 67, 123, 179, -159, -103, -47, 9, 65, 121, 177, -161, -105, -49, 7, 63, 119, 175, -163, -107, -51, 5, 61 -- (+80 chars; full line in the Zenodo source)
[-139, -81, -23, 35, 93, 151, -185, -127, -69, -11, 47, 105, 163, -173, -115, -57, 1, 59, 117, 175, -161, -103, -45, 13, 71, 129, 187, -149, -91, -33, 25, 83, 141, -195, -137, -79, -21, 37, 95, 153, -183, -125, -67, -9, 49, 107, 165, -171, -113, -55, 3, 61, 119, 177, -159, -101, -43, 15, 73, 131, 189, -147, -89, -31, 27, 85, 143, -193, -135, -77, -19, 39, 97, 155, -181, -123, -65, -7, 51, 109, 1 -- (+88 chars; full line in the Zenodo source)
[-137, -77, -17, 43, 103, 163, -171, -111, -51, 9, 69, 129, 189, -145, -85, -25, 35, 95, 155, -179, -119, -59, 1, 61, 121, 181, -153, -93, -33, 27, 87, 147, -187, -127, -67, -7, 53, 113, 173, -161, -101, -41, 19, 79, 139, -195, -135, -75, -15, 45, 105, 165, -169, -109, -49, 11, 71, 131, 191, -143, -83, -23, 37, 97, 157, -177, -117, -57, 3, 63, 123, 183, -151, -91, -31, 29, 89, 149, -185, -125, - -- (+87 chars; full line in the Zenodo source)
[-135, -73, -11, 51, 113, 175, -157, -95, -33, 29, 91, 153, -179, -117, -55, 7, 69, 131, 193, -139, -77, -15, 47, 109, 171, -161, -99, -37, 25, 87, 149, -183, -121, -59, 3, 65, 127, 189, -143, -81, -19, 43, 105, 167, -165, -103, -41, 21, 83, 145, -187, -125, -63, -1, 61, 123, 185, -147, -85, -23, 39, 101, 163, -169, -107, -45, 17, 79, 141, -191, -129, -67, -5, 57, 119, 181, -151, -89, -27, 35, 9 -- (+89 chars; full line in the Zenodo source)
[-133, -69, -5, 59, 123, 187, -143, -79, -15, 49, 113, 177, -153, -89, -25, 39, 103, 167, -163, -99, -35, 29, 93, 157, -173, -109, -45, 19, 83, 147, -183, -119, -55, 9, 73, 137, -193, -129, -65, -1, 63, 127, 191, -139, -75, -11, 53, 117, 181, -149, -85, -21, 43, 107, 171, -159, -95, -31, 33, 97, 161, -169, -105, -41, 23, 87, 151, -179, -115, -51, 13, 77, 141, -189, -125, -61, 3, 67, 131, 195, -1 -- (+87 chars; full line in the Zenodo source)
[-131, -65, 1, 67, 133, -195, -129, -63, 3, 69, 135, -193, -127, -61, 5, 71, 137, -191, -125, -59, 7, 73, 139, -189, -123, -57, 9, 75, 141, -187, -121, -55, 11, 77, 143, -185, -119, -53, 13, 79, 145, -183, -117, -51, 15, 81, 147, -181, -115, -49, 17, 83, 149, -179, -113, -47, 19, 85, 151, -177, -111, -45, 21, 87, 153, -175, -109, -43, 23, 89, 155, -173, -107, -41, 25, 91, 157, -171, -105, -39, 2 -- (+88 chars; full line in the Zenodo source)
[-129, -61, 7, 75, 143, -183, -115, -47, 21, 89, 157, -169, -101, -33, 35, 103, 171, -155, -87, -19, 49, 117, 185, -141, -73, -5, 63, 131, -195, -127, -59, 9, 77, 145, -181, -113, -45, 23, 91, 159, -167, -99, -31, 37, 105, 173, -153, -85, -17, 51, 119, 187, -139, -71, -3, 65, 133, -193, -125, -57, 11, 79, 147, -179, -111, -43, 25, 93, 161, -165, -97, -29, 39, 107, 175, -151, -83, -15, 53, 121, 1 -- (+88 chars; full line in the Zenodo source)
[-127, -57, 13, 83, 153, -171, -101, -31, 39, 109, 179, -145, -75, -5, 65, 135, -189, -119, -49, 21, 91, 161, -163, -93, -23, 47, 117, 187, -137, -67, 3, 73, 143, -181, -111, -41, 29, 99, 169, -155, -85, -15, 55, 125, 195, -129, -59, 11, 81, 151, -173, -103, -33, 37, 107, 177, -147, -77, -7, 63, 133, -191, -121, -51, 19, 89, 159, -165, -95, -25, 45, 115, 185, -139, -69, 1, 71, 141, -183, -113, - -- (+87 chars; full line in the Zenodo source)
[-125, -53, 19, 91, 163, -159, -87, -15, 57, 129, -193, -121, -49, 23, 95, 167, -155, -83, -11, 61, 133, -189, -117, -45, 27, 99, 171, -151, -79, -7, 65, 137, -185, -113, -41, 31, 103, 175, -147, -75, -3, 69, 141, -181, -109, -37, 35, 107, 179, -143, -71, 1, 73, 145, -177, -105, -33, 39, 111, 183, -139, -67, 5, 77, 149, -173, -101, -29, 43, 115, 187, -135, -63, 9, 81, 153, -169, -97, -25, 47, 11 -- (+86 chars; full line in the Zenodo source)
[-123, -49, 25, 99, 173, -147, -73, 1, 75, 149, -171, -97, -23, 51, 125, -195, -121, -47, 27, 101, 175, -145, -71, 3, 77, 151, -169, -95, -21, 53, 127, -193, -119, -45, 29, 103, 177, -143, -69, 5, 79, 153, -167, -93, -19, 55, 129, -191, -117, -43, 31, 105, 179, -141, -67, 7, 81, 155, -165, -91, -17, 57, 131, -189, -115, -41, 33, 107, 181, -139, -65, 9, 83, 157, -163, -89, -15, 59, 133, -187, -11 -- (+88 chars; full line in the Zenodo source)
[-121, -45, 31, 107, 183, -135, -59, 17, 93, 169, -149, -73, 3, 79, 155, -163, -87, -11, 65, 141, -177, -101, -25, 51, 127, -191, -115, -39, 37, 113, 189, -129, -53, 23, 99, 175, -143, -67, 9, 85, 161, -157, -81, -5, 71, 147, -171, -95, -19, 57, 133, -185, -109, -33, 43, 119, 195, -123, -47, 29, 105, 181, -137, -61, 15, 91, 167, -151, -75, 1, 77, 153, -165, -89, -13, 63, 139, -179, -103, -27, 49 -- (+85 chars; full line in the Zenodo source)
[-119, -41, 37, 115, 193, -123, -45, 33, 111, 189, -127, -49, 29, 107, 185, -131, -53, 25, 103, 181, -135, -57, 21, 99, 177, -139, -61, 17, 95, 173, -143, -65, 13, 91, 169, -147, -69, 9, 87, 165, -151, -73, 5, 83, 161, -155, -77, 1, 79, 157, -159, -81, -3, 75, 153, -163, -85, -7, 71, 149, -167, -89, -11, 67, 145, -171, -93, -15, 63, 141, -175, -97, -19, 59, 137, -179, -101, -23, 55, 133, -183, - -- (+88 chars; full line in the Zenodo source)
[-117, -37, 43, 123, -191, -111, -31, 49, 129, -185, -105, -25, 55, 135, -179, -99, -19, 61, 141, -173, -93, -13, 67, 147, -167, -87, -7, 73, 153, -161, -81, -1, 79, 159, -155, -75, 5, 85, 165, -149, -69, 11, 91, 171, -143, -63, 17, 97, 177, -137, -57, 23, 103, 183, -131, -51, 29, 109, 189, -125, -45, 35, 115, 195, -119, -39, 41, 121, -193, -113, -33, 47, 127, -187, -107, -27, 53, 133, -181, -10 -- (+90 chars; full line in the Zenodo source)
[-115, -33, 49, 131, -181, -99, -17, 65, 147, -165, -83, -1, 81, 163, -149, -67, 15, 97, 179, -133, -51, 31, 113, 195, -117, -35, 47, 129, -183, -101, -19, 63, 145, -167, -85, -3, 79, 161, -151, -69, 13, 95, 177, -135, -53, 29, 111, 193, -119, -37, 45, 127, -185, -103, -21, 61, 143, -169, -87, -5, 77, 159, -153, -71, 11, 93, 175, -137, -55, 27, 109, 191, -121, -39, 43, 125, -187, -105, -23, 59, -- (+88 chars; full line in the Zenodo source)
[-113, -29, 55, 139, -171, -87, -3, 81, 165, -145, -61, 23, 107, 191, -119, -35, 49, 133, -177, -93, -9, 75, 159, -151, -67, 17, 101, 185, -125, -41, 43, 127, -183, -99, -15, 69, 153, -157, -73, 11, 95, 179, -131, -47, 37, 121, -189, -105, -21, 63, 147, -163, -79, 5, 89, 173, -137, -53, 31, 115, -195, -111, -27, 57, 141, -169, -85, -1, 83, 167, -143, -59, 25, 109, 193, -117, -33, 51, 135, -175, -- (+88 chars; full line in the Zenodo source)
[-111, -25, 61, 147, -161, -75, 11, 97, 183, -125, -39, 47, 133, -175, -89, -3, 83, 169, -139, -53, 33, 119, -189, -103, -17, 69, 155, -153, -67, 19, 105, 191, -117, -31, 55, 141, -167, -81, 5, 91, 177, -131, -45, 41, 127, -181, -95, -9, 77, 163, -145, -59, 27, 113, -195, -109, -23, 63, 149, -159, -73, 13, 99, 185, -123, -37, 49, 135, -173, -87, -1, 85, 171, -137, -51, 35, 121, -187, -101, -15, -- (+88 chars; full line in the Zenodo source)
[-109, -21, 67, 155, -151, -63, 25, 113, -193, -105, -17, 71, 159, -147, -59, 29, 117, -189, -101, -13, 75, 163, -143, -55, 33, 121, -185, -97, -9, 79, 167, -139, -51, 37, 125, -181, -93, -5, 83, 171, -135, -47, 41, 129, -177, -89, -1, 87, 175, -131, -43, 45, 133, -173, -85, 3, 91, 179, -127, -39, 49, 137, -169, -81, 7, 95, 183, -123, -35, 53, 141, -165, -77, 11, 99, 187, -119, -31, 57, 145, -16 -- (+87 chars; full line in the Zenodo source)
[-107, -17, 73, 163, -141, -51, 39, 129, -175, -85, 5, 95, 185, -119, -29, 61, 151, -153, -63, 27, 117, -187, -97, -7, 83, 173, -131, -41, 49, 139, -165, -75, 15, 105, 195, -109, -19, 71, 161, -143, -53, 37, 127, -177, -87, 3, 93, 183, -121, -31, 59, 149, -155, -65, 25, 115, -189, -99, -9, 81, 171, -133, -43, 47, 137, -167, -77, 13, 103, 193, -111, -21, 69, 159, -145, -55, 35, 125, -179, -89, 1, -- (+87 chars; full line in the Zenodo source)
[-105, -13, 79, 171, -131, -39, 53, 145, -157, -65, 27, 119, -183, -91, 1, 93, 185, -117, -25, 67, 159, -143, -51, 41, 133, -169, -77, 15, 107, -195, -103, -11, 81, 173, -129, -37, 55, 147, -155, -63, 29, 121, -181, -89, 3, 95, 187, -115, -23, 69, 161, -141, -49, 43, 135, -167, -75, 17, 109, -193, -101, -9, 83, 175, -127, -35, 57, 149, -153, -61, 31, 123, -179, -87, 5, 97, 189, -113, -21, 71, 16 -- (+87 chars; full line in the Zenodo source)
[-103, -9, 85, 179, -121, -27, 67, 161, -139, -45, 49, 143, -157, -63, 31, 125, -175, -81, 13, 107, -193, -99, -5, 89, 183, -117, -23, 71, 165, -135, -41, 53, 147, -153, -59, 35, 129, -171, -77, 17, 111, -189, -95, -1, 93, 187, -113, -19, 75, 169, -131, -37, 57, 151, -149, -55, 39, 133, -167, -73, 21, 115, -185, -91, 3, 97, 191, -109, -15, 79, 173, -127, -33, 61, 155, -145, -51, 43, 137, -163, - -- (+88 chars; full line in the Zenodo source)
[-101, -5, 91, 187, -111, -15, 81, 177, -121, -25, 71, 167, -131, -35, 61, 157, -141, -45, 51, 147, -151, -55, 41, 137, -161, -65, 31, 127, -171, -75, 21, 117, -181, -85, 11, 107, -191, -95, 1, 97, 193, -105, -9, 87, 183, -115, -19, 77, 173, -125, -29, 67, 163, -135, -39, 57, 153, -145, -49, 47, 143, -155, -59, 37, 133, -165, -69, 27, 123, -175, -79, 17, 113, -185, -89, 7, 103, -195, -99, -3, 93 -- (+87 chars; full line in the Zenodo source)
[-99, -1, 97, 195, -101, -3, 95, 193, -103, -5, 93, 191, -105, -7, 91, 189, -107, -9, 89, 187, -109, -11, 87, 185, -111, -13, 85, 183, -113, -15, 83, 181, -115, -17, 81, 179, -117, -19, 79, 177, -119, -21, 77, 175, -121, -23, 75, 173, -123, -25, 73, 171, -125, -27, 71, 169, -127, -29, 69, 167, -129, -31, 67, 165, -131, -33, 65, 163, -133, -35, 63, 161, -135, -37, 61, 159, -137, -39, 59, 157, -13 -- (+88 chars; full line in the Zenodo source)
[-97, 3, 103, -191, -91, 9, 109, -185, -85, 15, 115, -179, -79, 21, 121, -173, -73, 27, 127, -167, -67, 33, 133, -161, -61, 39, 139, -155, -55, 45, 145, -149, -49, 51, 151, -143, -43, 57, 157, -137, -37, 63, 163, -131, -31, 69, 169, -125, -25, 75, 175, -119, -19, 81, 181, -113, -13, 87, 187, -107, -7, 93, 193, -101, -1, 99, -195, -95, 5, 105, -189, -89, 11, 111, -183, -83, 17, 117, -177, -77, 23 -- (+87 chars; full line in the Zenodo source)
[-95, 7, 109, -183, -81, 21, 123, -169, -67, 35, 137, -155, -53, 49, 151, -141, -39, 63, 165, -127, -25, 77, 179, -113, -11, 91, 193, -99, 3, 105, -187, -85, 17, 119, -173, -71, 31, 133, -159, -57, 45, 147, -145, -43, 59, 161, -131, -29, 73, 175, -117, -15, 87, 189, -103, -1, 101, -191, -89, 13, 115, -177, -75, 27, 129, -163, -61, 41, 143, -149, -47, 55, 157, -135, -33, 69, 171, -121, -19, 83, 1 -- (+88 chars; full line in the Zenodo source)
[-93, 11, 115, -175, -71, 33, 137, -153, -49, 55, 159, -131, -27, 77, 181, -109, -5, 99, -191, -87, 17, 121, -169, -65, 39, 143, -147, -43, 61, 165, -125, -21, 83, 187, -103, 1, 105, -185, -81, 23, 127, -163, -59, 45, 149, -141, -37, 67, 171, -119, -15, 89, 193, -97, 7, 111, -179, -75, 29, 133, -157, -53, 51, 155, -135, -31, 73, 177, -113, -9, 95, -195, -91, 13, 117, -173, -69, 35, 139, -151, -4 -- (+87 chars; full line in the Zenodo source)
[-91, 15, 121, -167, -61, 45, 151, -137, -31, 75, 181, -107, -1, 105, -183, -77, 29, 135, -153, -47, 59, 165, -123, -17, 89, 195, -93, 13, 119, -169, -63, 43, 149, -139, -33, 73, 179, -109, -3, 103, -185, -79, 27, 133, -155, -49, 57, 163, -125, -19, 87, 193, -95, 11, 117, -171, -65, 41, 147, -141, -35, 71, 177, -111, -5, 101, -187, -81, 25, 131, -157, -51, 55, 161, -127, -21, 85, 191, -97, 9, 11 -- (+88 chars; full line in the Zenodo source)
[-89, 19, 127, -159, -51, 57, 165, -121, -13, 95, -191, -83, 25, 133, -153, -45, 63, 171, -115, -7, 101, -185, -77, 31, 139, -147, -39, 69, 177, -109, -1, 107, -179, -71, 37, 145, -141, -33, 75, 183, -103, 5, 113, -173, -65, 43, 151, -135, -27, 81, 189, -97, 11, 119, -167, -59, 49, 157, -129, -21, 87, 195, -91, 17, 125, -161, -53, 55, 163, -123, -15, 93, -193, -85, 23, 131, -155, -47, 61, 169, - -- (+88 chars; full line in the Zenodo source)
[-87, 23, 133, -151, -41, 69, 179, -105, 5, 115, -169, -59, 51, 161, -123, -13, 97, -187, -77, 33, 143, -141, -31, 79, 189, -95, 15, 125, -159, -49, 61, 171, -113, -3, 107, -177, -67, 43, 153, -131, -21, 89, -195, -85, 25, 135, -149, -39, 71, 181, -103, 7, 117, -167, -57, 53, 163, -121, -11, 99, -185, -75, 35, 145, -139, -29, 81, 191, -93, 17, 127, -157, -47, 63, 173, -111, -1, 109, -175, -65, 4 -- (+88 chars; full line in the Zenodo source)
[-85, 27, 139, -143, -31, 81, 193, -89, 23, 135, -147, -35, 77, 189, -93, 19, 131, -151, -39, 73, 185, -97, 15, 127, -155, -43, 69, 181, -101, 11, 123, -159, -47, 65, 177, -105, 7, 119, -163, -51, 61, 173, -109, 3, 115, -167, -55, 57, 169, -113, -1, 111, -171, -59, 53, 165, -117, -5, 107, -175, -63, 49, 161, -121, -9, 103, -179, -67, 45, 157, -125, -13, 99, -183, -71, 41, 153, -129, -17, 95, -18 -- (+87 chars; full line in the Zenodo source)
[-83, 31, 145, -135, -21, 93, -187, -73, 41, 155, -125, -11, 103, -177, -63, 51, 165, -115, -1, 113, -167, -53, 61, 175, -105, 9, 123, -157, -43, 71, 185, -95, 19, 133, -147, -33, 81, 195, -85, 29, 143, -137, -23, 91, -189, -75, 39, 153, -127, -13, 101, -179, -65, 49, 163, -117, -3, 111, -169, -55, 59, 173, -107, 7, 121, -159, -45, 69, 183, -97, 17, 131, -149, -35, 79, 193, -87, 27, 141, -139, - -- (+89 chars; full line in the Zenodo source)
[-81, 35, 151, -127, -11, 105, -173, -57, 59, 175, -103, 13, 129, -149, -33, 83, -195, -79, 37, 153, -125, -9, 107, -171, -55, 61, 177, -101, 15, 131, -147, -31, 85, -193, -77, 39, 155, -123, -7, 109, -169, -53, 63, 179, -99, 17, 133, -145, -29, 87, -191, -75, 41, 157, -121, -5, 111, -167, -51, 65, 181, -97, 19, 135, -143, -27, 89, -189, -73, 43, 159, -119, -3, 113, -165, -49, 67, 183, -95, 21, -- (+89 chars; full line in the Zenodo source)
[-79, 39, 157, -119, -1, 117, -159, -41, 77, 195, -81, 37, 155, -121, -3, 115, -161, -43, 75, 193, -83, 35, 153, -123, -5, 113, -163, -45, 73, 191, -85, 33, 151, -125, -7, 111, -165, -47, 71, 189, -87, 31, 149, -127, -9, 109, -167, -49, 69, 187, -89, 29, 147, -129, -11, 107, -169, -51, 67, 185, -91, 27, 145, -131, -13, 105, -171, -53, 65, 183, -93, 25, 143, -133, -15, 103, -173, -55, 63, 181, -9 -- (+88 chars; full line in the Zenodo source)
[-77, 43, 163, -111, 9, 129, -145, -25, 95, -179, -59, 61, 181, -93, 27, 147, -127, -7, 113, -161, -41, 79, -195, -75, 45, 165, -109, 11, 131, -143, -23, 97, -177, -57, 63, 183, -91, 29, 149, -125, -5, 115, -159, -39, 81, -193, -73, 47, 167, -107, 13, 133, -141, -21, 99, -175, -55, 65, 185, -89, 31, 151, -123, -3, 117, -157, -37, 83, -191, -71, 49, 169, -105, 15, 135, -139, -19, 101, -173, -53, -- (+88 chars; full line in the Zenodo source)
[-75, 47, 169, -103, 19, 141, -131, -9, 113, -159, -37, 85, -187, -65, 57, 179, -93, 29, 151, -121, 1, 123, -149, -27, 95, -177, -55, 67, 189, -83, 39, 161, -111, 11, 133, -139, -17, 105, -167, -45, 77, -195, -73, 49, 171, -101, 21, 143, -129, -7, 115, -157, -35, 87, -185, -63, 59, 181, -91, 31, 153, -119, 3, 125, -147, -25, 97, -175, -53, 69, 191, -81, 41, 163, -109, 13, 135, -137, -15, 107, -1 -- (+88 chars; full line in the Zenodo source)
[-73, 51, 175, -95, 29, 153, -117, 7, 131, -139, -15, 109, -161, -37, 87, -183, -59, 65, 189, -81, 43, 167, -103, 21, 145, -125, -1, 123, -147, -23, 101, -169, -45, 79, -191, -67, 57, 181, -89, 35, 159, -111, 13, 137, -133, -9, 115, -155, -31, 93, -177, -53, 71, 195, -75, 49, 173, -97, 27, 151, -119, 5, 129, -141, -17, 107, -163, -39, 85, -185, -61, 63, 187, -83, 41, 165, -105, 19, 143, -127, -3 -- (+86 chars; full line in the Zenodo source)
[-71, 55, 181, -87, 39, 165, -103, 23, 149, -119, 7, 133, -135, -9, 117, -151, -25, 101, -167, -41, 85, -183, -57, 69, 195, -73, 53, 179, -89, 37, 163, -105, 21, 147, -121, 5, 131, -137, -11, 115, -153, -27, 99, -169, -43, 83, -185, -59, 67, 193, -75, 51, 177, -91, 35, 161, -107, 19, 145, -123, 3, 129, -139, -13, 113, -155, -29, 97, -171, -45, 81, -187, -61, 65, 191, -77, 49, 175, -93, 33, 159, -- (+86 chars; full line in the Zenodo source)
[-69, 59, 187, -79, 49, 177, -89, 39, 167, -99, 29, 157, -109, 19, 147, -119, 9, 137, -129, -1, 127, -139, -11, 117, -149, -21, 107, -159, -31, 97, -169, -41, 87, -179, -51, 77, -189, -61, 67, 195, -71, 57, 185, -81, 47, 175, -91, 37, 165, -101, 27, 155, -111, 17, 145, -121, 7, 135, -131, -3, 125, -141, -13, 115, -151, -23, 105, -161, -33, 95, -171, -43, 85, -181, -53, 75, -191, -63, 65, 193, -7 -- (+84 chars; full line in the Zenodo source)
[-67, 63, 193, -71, 59, 189, -75, 55, 185, -79, 51, 181, -83, 47, 177, -87, 43, 173, -91, 39, 169, -95, 35, 165, -99, 31, 161, -103, 27, 157, -107, 23, 153, -111, 19, 149, -115, 15, 145, -119, 11, 141, -123, 7, 137, -127, 3, 133, -131, -1, 129, -135, -5, 125, -139, -9, 121, -143, -13, 117, -147, -17, 113, -151, -21, 109, -155, -25, 105, -159, -29, 101, -163, -33, 97, -167, -37, 93, -171, -41, 89 -- (+88 chars; full line in the Zenodo source)
[-65, 67, -195, -63, 69, -193, -61, 71, -191, -59, 73, -189, -57, 75, -187, -55, 77, -185, -53, 79, -183, -51, 81, -181, -49, 83, -179, -47, 85, -177, -45, 87, -175, -43, 89, -173, -41, 91, -171, -39, 93, -169, -37, 95, -167, -35, 97, -165, -33, 99, -163, -31, 101, -161, -29, 103, -159, -27, 105, -157, -25, 107, -155, -23, 109, -153, -21, 111, -151, -19, 113, -149, -17, 115, -147, -15, 117, -145 -- (+103 chars; full line in the Zenodo source)
[-63, 71, -189, -55, 79, -181, -47, 87, -173, -39, 95, -165, -31, 103, -157, -23, 111, -149, -15, 119, -141, -7, 127, -133, 1, 135, -125, 9, 143, -117, 17, 151, -109, 25, 159, -101, 33, 167, -93, 41, 175, -85, 49, 183, -77, 57, 191, -69, 65, -195, -61, 73, -187, -53, 81, -179, -45, 89, -171, -37, 97, -163, -29, 105, -155, -21, 113, -147, -13, 121, -139, -5, 129, -131, 3, 137, -123, 11, 145, -115 -- (+87 chars; full line in the Zenodo source)
[-61, 75, -183, -47, 89, -169, -33, 103, -155, -19, 117, -141, -5, 131, -127, 9, 145, -113, 23, 159, -99, 37, 173, -85, 51, 187, -71, 65, -193, -57, 79, -179, -43, 93, -165, -29, 107, -151, -15, 121, -137, -1, 135, -123, 13, 149, -109, 27, 163, -95, 41, 177, -81, 55, 191, -67, 69, -189, -53, 83, -175, -39, 97, -161, -25, 111, -147, -11, 125, -133, 3, 139, -119, 17, 153, -105, 31, 167, -91, 45, 1 -- (+89 chars; full line in the Zenodo source)
[-59, 79, -177, -39, 99, -157, -19, 119, -137, 1, 139, -117, 21, 159, -97, 41, 179, -77, 61, -195, -57, 81, -175, -37, 101, -155, -17, 121, -135, 3, 141, -115, 23, 161, -95, 43, 181, -75, 63, -193, -55, 83, -173, -35, 103, -153, -15, 123, -133, 5, 143, -113, 25, 163, -93, 45, 183, -73, 65, -191, -53, 85, -171, -33, 105, -151, -13, 125, -131, 7, 145, -111, 27, 165, -91, 47, 185, -71, 67, -189, -5 -- (+87 chars; full line in the Zenodo source)
[-57, 83, -171, -31, 109, -145, -5, 135, -119, 21, 161, -93, 47, 187, -67, 73, -181, -41, 99, -155, -15, 125, -129, 11, 151, -103, 37, 177, -77, 63, -191, -51, 89, -165, -25, 115, -139, 1, 141, -113, 27, 167, -87, 53, 193, -61, 79, -175, -35, 105, -149, -9, 131, -123, 17, 157, -97, 43, 183, -71, 69, -185, -45, 95, -159, -19, 121, -133, 7, 147, -107, 33, 173, -81, 59, -195, -55, 85, -169, -29, 11 -- (+88 chars; full line in the Zenodo source)
[-55, 87, -165, -23, 119, -133, 9, 151, -101, 41, 183, -69, 73, -179, -37, 105, -147, -5, 137, -115, 27, 169, -83, 59, -193, -51, 91, -161, -19, 123, -129, 13, 155, -97, 45, 187, -65, 77, -175, -33, 109, -143, -1, 141, -111, 31, 173, -79, 63, -189, -47, 95, -157, -15, 127, -125, 17, 159, -93, 49, 191, -61, 81, -171, -29, 113, -139, 3, 145, -107, 35, 177, -75, 67, -185, -43, 99, -153, -11, 131, - -- (+87 chars; full line in the Zenodo source)
[-53, 91, -159, -15, 129, -121, 23, 167, -83, 61, -189, -45, 99, -151, -7, 137, -113, 31, 175, -75, 69, -181, -37, 107, -143, 1, 145, -105, 39, 183, -67, 77, -173, -29, 115, -135, 9, 153, -97, 47, 191, -59, 85, -165, -21, 123, -127, 17, 161, -89, 55, -195, -51, 93, -157, -13, 131, -119, 25, 169, -81, 63, -187, -43, 101, -149, -5, 139, -111, 33, 177, -73, 71, -179, -35, 109, -141, 3, 147, -103, 4 -- (+87 chars; full line in the Zenodo source)
[-51, 95, -153, -7, 139, -109, 37, 183, -65, 81, -167, -21, 125, -123, 23, 169, -79, 67, -181, -35, 111, -137, 9, 155, -93, 53, -195, -49, 97, -151, -5, 141, -107, 39, 185, -63, 83, -165, -19, 127, -121, 25, 171, -77, 69, -179, -33, 113, -135, 11, 157, -91, 55, -193, -47, 99, -149, -3, 143, -105, 41, 187, -61, 85, -163, -17, 129, -119, 27, 173, -75, 71, -177, -31, 115, -133, 13, 159, -89, 57, -1 -- (+89 chars; full line in the Zenodo source)
[-49, 99, -147, 1, 149, -97, 51, -195, -47, 101, -145, 3, 151, -95, 53, -193, -45, 103, -143, 5, 153, -93, 55, -191, -43, 105, -141, 7, 155, -91, 57, -189, -41, 107, -139, 9, 157, -89, 59, -187, -39, 109, -137, 11, 159, -87, 61, -185, -37, 111, -135, 13, 161, -85, 63, -183, -35, 113, -133, 15, 163, -83, 65, -181, -33, 115, -131, 17, 165, -81, 67, -179, -31, 117, -129, 19, 167, -79, 69, -177, -29 -- (+87 chars; full line in the Zenodo source)
[-47, 103, -141, 9, 159, -85, 65, -179, -29, 121, -123, 27, 177, -67, 83, -161, -11, 139, -105, 45, 195, -49, 101, -143, 7, 157, -87, 63, -181, -31, 119, -125, 25, 175, -69, 81, -163, -13, 137, -107, 43, 193, -51, 99, -145, 5, 155, -89, 61, -183, -33, 117, -127, 23, 173, -71, 79, -165, -15, 135, -109, 41, 191, -53, 97, -147, 3, 153, -91, 59, -185, -35, 115, -129, 21, 171, -73, 77, -167, -17, 133 -- (+85 chars; full line in the Zenodo source)
[-45, 107, -135, 17, 169, -73, 79, -163, -11, 141, -101, 51, -191, -39, 113, -129, 23, 175, -67, 85, -157, -5, 147, -95, 57, -185, -33, 119, -123, 29, 181, -61, 91, -151, 1, 153, -89, 63, -179, -27, 125, -117, 35, 187, -55, 97, -145, 7, 159, -83, 69, -173, -21, 131, -111, 41, 193, -49, 103, -139, 13, 165, -77, 75, -167, -15, 137, -105, 47, -195, -43, 109, -133, 19, 171, -71, 81, -161, -9, 143, - -- (+88 chars; full line in the Zenodo source)
[-43, 111, -129, 25, 179, -61, 93, -147, 7, 161, -79, 75, -165, -11, 143, -97, 57, -183, -29, 125, -115, 39, 193, -47, 107, -133, 21, 175, -65, 89, -151, 3, 157, -83, 71, -169, -15, 139, -101, 53, -187, -33, 121, -119, 35, 189, -51, 103, -137, 17, 171, -69, 85, -155, -1, 153, -87, 67, -173, -19, 135, -105, 49, -191, -37, 117, -123, 31, 185, -55, 99, -141, 13, 167, -73, 81, -159, -5, 149, -91, 63 -- (+87 chars; full line in the Zenodo source)
[-41, 115, -123, 33, 189, -49, 107, -131, 25, 181, -57, 99, -139, 17, 173, -65, 91, -147, 9, 165, -73, 83, -155, 1, 157, -81, 75, -163, -7, 149, -89, 67, -171, -15, 141, -97, 59, -179, -23, 133, -105, 51, -187, -31, 125, -113, 43, -195, -39, 117, -121, 35, 191, -47, 109, -129, 27, 183, -55, 101, -137, 19, 175, -63, 93, -145, 11, 167, -71, 85, -153, 3, 159, -79, 77, -161, -5, 151, -87, 69, -169, -- (+87 chars; full line in the Zenodo source)
[-39, 119, -117, 41, -195, -37, 121, -115, 43, -193, -35, 123, -113, 45, -191, -33, 125, -111, 47, -189, -31, 127, -109, 49, -187, -29, 129, -107, 51, -185, -27, 131, -105, 53, -183, -25, 133, -103, 55, -181, -23, 135, -101, 57, -179, -21, 137, -99, 59, -177, -19, 139, -97, 61, -175, -17, 141, -95, 63, -173, -15, 143, -93, 65, -171, -13, 145, -91, 67, -169, -11, 147, -89, 69, -167, -9, 149, -87, -- (+97 chars; full line in the Zenodo source)
[-37, 123, -111, 49, -185, -25, 135, -99, 61, -173, -13, 147, -87, 73, -161, -1, 159, -75, 85, -149, 11, 171, -63, 97, -137, 23, 183, -51, 109, -125, 35, 195, -39, 121, -113, 47, -187, -27, 133, -101, 59, -175, -15, 145, -89, 71, -163, -3, 157, -77, 83, -151, 9, 169, -65, 95, -139, 21, 181, -53, 107, -127, 33, 193, -41, 119, -115, 45, -189, -29, 131, -103, 57, -177, -17, 143, -91, 69, -165, -5, -- (+87 chars; full line in the Zenodo source)
[-35, 127, -105, 57, -175, -13, 149, -83, 79, -153, 9, 171, -61, 101, -131, 31, 193, -39, 123, -109, 53, -179, -17, 145, -87, 75, -157, 5, 167, -65, 97, -135, 27, 189, -43, 119, -113, 49, -183, -21, 141, -91, 71, -161, 1, 163, -69, 93, -139, 23, 185, -47, 115, -117, 45, -187, -25, 137, -95, 67, -165, -3, 159, -73, 89, -143, 19, 181, -51, 111, -121, 41, -191, -29, 133, -99, 63, -169, -7, 155, -77 -- (+88 chars; full line in the Zenodo source)
[-33, 131, -99, 65, -165, -1, 163, -67, 97, -133, 31, 195, -35, 129, -101, 63, -167, -3, 161, -69, 95, -135, 29, 193, -37, 127, -103, 61, -169, -5, 159, -71, 93, -137, 27, 191, -39, 125, -105, 59, -171, -7, 157, -73, 91, -139, 25, 189, -41, 123, -107, 57, -173, -9, 155, -75, 89, -141, 23, 187, -43, 121, -109, 55, -175, -11, 153, -77, 87, -143, 21, 185, -45, 119, -111, 53, -177, -13, 151, -79, 85 -- (+87 chars; full line in the Zenodo source)
[-31, 135, -93, 73, -155, 11, 177, -51, 115, -113, 53, -175, -9, 157, -71, 95, -133, 33, -195, -29, 137, -91, 75, -153, 13, 179, -49, 117, -111, 55, -173, -7, 159, -69, 97, -131, 35, -193, -27, 139, -89, 77, -151, 15, 181, -47, 119, -109, 57, -171, -5, 161, -67, 99, -129, 37, -191, -25, 141, -87, 79, -149, 17, 183, -45, 121, -107, 59, -169, -3, 163, -65, 101, -127, 39, -189, -23, 143, -85, 81, - -- (+90 chars; full line in the Zenodo source)
[-29, 139, -87, 81, -145, 23, 191, -35, 133, -93, 75, -151, 17, 185, -41, 127, -99, 69, -157, 11, 179, -47, 121, -105, 63, -163, 5, 173, -53, 115, -111, 57, -169, -1, 167, -59, 109, -117, 51, -175, -7, 161, -65, 103, -123, 45, -181, -13, 155, -71, 97, -129, 39, -187, -19, 149, -77, 91, -135, 33, -193, -25, 143, -83, 85, -141, 27, 195, -31, 137, -89, 79, -147, 21, 189, -37, 131, -95, 73, -153, 15 -- (+85 chars; full line in the Zenodo source)
[-27, 143, -81, 89, -135, 35, -189, -19, 151, -73, 97, -127, 43, -181, -11, 159, -65, 105, -119, 51, -173, -3, 167, -57, 113, -111, 59, -165, 5, 175, -49, 121, -103, 67, -157, 13, 183, -41, 129, -95, 75, -149, 21, 191, -33, 137, -87, 83, -141, 29, -195, -25, 145, -79, 91, -133, 37, -187, -17, 153, -71, 99, -125, 45, -179, -9, 161, -63, 107, -117, 53, -171, -1, 169, -55, 115, -109, 61, -163, 7, 1 -- (+88 chars; full line in the Zenodo source)
[-25, 147, -75, 97, -125, 47, -175, -3, 169, -53, 119, -103, 69, -153, 19, 191, -31, 141, -81, 91, -131, 41, -181, -9, 163, -59, 113, -109, 63, -159, 13, 185, -37, 135, -87, 85, -137, 35, -187, -15, 157, -65, 107, -115, 57, -165, 7, 179, -43, 129, -93, 79, -143, 29, -193, -21, 151, -71, 101, -121, 51, -171, 1, 173, -49, 123, -99, 73, -149, 23, 195, -27, 145, -77, 95, -127, 45, -177, -5, 167, -55 -- (+87 chars; full line in the Zenodo source)
[-23, 151, -69, 105, -115, 59, -161, 13, 187, -33, 141, -79, 95, -125, 49, -171, 3, 177, -43, 131, -89, 85, -135, 39, -181, -7, 167, -53, 121, -99, 75, -145, 29, -191, -17, 157, -63, 111, -109, 65, -155, 19, 193, -27, 147, -73, 101, -119, 55, -165, 9, 183, -37, 137, -83, 91, -129, 45, -175, -1, 173, -47, 127, -93, 81, -139, 35, -185, -11, 163, -57, 117, -103, 71, -149, 25, -195, -21, 153, -67, 1 -- (+87 chars; full line in the Zenodo source)
[-21, 155, -63, 113, -105, 71, -147, 29, -189, -13, 163, -55, 121, -97, 79, -139, 37, -181, -5, 171, -47, 129, -89, 87, -131, 45, -173, 3, 179, -39, 137, -81, 95, -123, 53, -165, 11, 187, -31, 145, -73, 103, -115, 61, -157, 19, 195, -23, 153, -65, 111, -107, 69, -149, 27, -191, -15, 161, -57, 119, -99, 77, -141, 35, -183, -7, 169, -49, 127, -91, 85, -133, 43, -175, 1, 177, -41, 135, -83, 93, -12 -- (+86 chars; full line in the Zenodo source)
[-19, 159, -57, 121, -95, 83, -133, 45, -171, 7, 185, -31, 147, -69, 109, -107, 71, -145, 33, -183, -5, 173, -43, 135, -81, 97, -119, 59, -157, 21, -195, -17, 161, -55, 123, -93, 85, -131, 47, -169, 9, 187, -29, 149, -67, 111, -105, 73, -143, 35, -181, -3, 175, -41, 137, -79, 99, -117, 61, -155, 23, -193, -15, 163, -53, 125, -91, 87, -129, 49, -167, 11, 189, -27, 151, -65, 113, -103, 75, -141, 3 -- (+89 chars; full line in the Zenodo source)
[-17, 163, -51, 129, -85, 95, -119, 61, -153, 27, -187, -7, 173, -41, 139, -75, 105, -109, 71, -143, 37, -177, 3, 183, -31, 149, -65, 115, -99, 81, -133, 47, -167, 13, 193, -21, 159, -55, 125, -89, 91, -123, 57, -157, 23, -191, -11, 169, -45, 135, -79, 101, -113, 67, -147, 33, -181, -1, 179, -35, 145, -69, 111, -103, 77, -137, 43, -171, 9, 189, -25, 155, -59, 121, -93, 87, -127, 53, -161, 19, -1 -- (+88 chars; full line in the Zenodo source)
[-15, 167, -45, 137, -75, 107, -105, 77, -135, 47, -165, 17, -195, -13, 169, -43, 139, -73, 109, -103, 79, -133, 49, -163, 19, -193, -11, 171, -41, 141, -71, 111, -101, 81, -131, 51, -161, 21, -191, -9, 173, -39, 143, -69, 113, -99, 83, -129, 53, -159, 23, -189, -7, 175, -37, 145, -67, 115, -97, 85, -127, 55, -157, 25, -187, -5, 177, -35, 147, -65, 117, -95, 87, -125, 57, -155, 27, -185, -3, 179 -- (+91 chars; full line in the Zenodo source)
[-13, 171, -39, 145, -65, 119, -91, 93, -117, 67, -143, 41, -169, 15, -195, -11, 173, -37, 147, -63, 121, -89, 95, -115, 69, -141, 43, -167, 17, -193, -9, 175, -35, 149, -61, 123, -87, 97, -113, 71, -139, 45, -165, 19, -191, -7, 177, -33, 151, -59, 125, -85, 99, -111, 73, -137, 47, -163, 21, -189, -5, 179, -31, 153, -57, 127, -83, 101, -109, 75, -135, 49, -161, 23, -187, -3, 181, -29, 155, -55, -- (+90 chars; full line in the Zenodo source)
[-11, 175, -33, 153, -55, 131, -77, 109, -99, 87, -121, 65, -143, 43, -165, 21, -187, -1, 185, -23, 163, -45, 141, -67, 119, -89, 97, -111, 75, -133, 53, -155, 31, -177, 9, 195, -13, 173, -35, 151, -57, 129, -79, 107, -101, 85, -123, 63, -145, 41, -167, 19, -189, -3, 183, -25, 161, -47, 139, -69, 117, -91, 95, -113, 73, -135, 51, -157, 29, -179, 7, 193, -15, 171, -37, 149, -59, 127, -81, 105, -1 -- (+88 chars; full line in the Zenodo source)
[-9, 179, -27, 161, -45, 143, -63, 125, -81, 107, -99, 89, -117, 71, -135, 53, -153, 35, -171, 17, -189, -1, 187, -19, 169, -37, 151, -55, 133, -73, 115, -91, 97, -109, 79, -127, 61, -145, 43, -163, 25, -181, 7, 195, -11, 177, -29, 159, -47, 141, -65, 123, -83, 105, -101, 87, -119, 69, -137, 51, -155, 33, -173, 15, -191, -3, 185, -21, 167, -39, 149, -57, 131, -75, 113, -93, 95, -111, 77, -129, 5 -- (+87 chars; full line in the Zenodo source)
[-7, 183, -21, 169, -35, 155, -49, 141, -63, 127, -77, 113, -91, 99, -105, 85, -119, 71, -133, 57, -147, 43, -161, 29, -175, 15, -189, 1, 191, -13, 177, -27, 163, -41, 149, -55, 135, -69, 121, -83, 107, -97, 93, -111, 79, -125, 65, -139, 51, -153, 37, -167, 23, -181, 9, -195, -5, 185, -19, 171, -33, 157, -47, 143, -61, 129, -75, 115, -89, 101, -103, 87, -117, 73, -131, 59, -145, 45, -159, 31, -1 -- (+87 chars; full line in the Zenodo source)
[-5, 187, -15, 177, -25, 167, -35, 157, -45, 147, -55, 137, -65, 127, -75, 117, -85, 107, -95, 97, -105, 87, -115, 77, -125, 67, -135, 57, -145, 47, -155, 37, -165, 27, -175, 17, -185, 7, -195, -3, 189, -13, 179, -23, 169, -33, 159, -43, 149, -53, 139, -63, 129, -73, 119, -83, 109, -93, 99, -103, 89, -113, 79, -123, 69, -133, 59, -143, 49, -153, 39, -163, 29, -173, 19, -183, 9, -193, -1, 191, -1 -- (+88 chars; full line in the Zenodo source)
[-3, 191, -9, 185, -15, 179, -21, 173, -27, 167, -33, 161, -39, 155, -45, 149, -51, 143, -57, 137, -63, 131, -69, 125, -75, 119, -81, 113, -87, 107, -93, 101, -99, 95, -105, 89, -111, 83, -117, 77, -123, 71, -129, 65, -135, 59, -141, 53, -147, 47, -153, 41, -159, 35, -165, 29, -171, 23, -177, 17, -183, 11, -189, 5, -195, -1, 193, -7, 187, -13, 181, -19, 175, -25, 169, -31, 163, -37, 157, -43, 15 -- (+88 chars; full line in the Zenodo source)
[-1, 195, -3, 193, -5, 191, -7, 189, -9, 187, -11, 185, -13, 183, -15, 181, -17, 179, -19, 177, -21, 175, -23, 173, -25, 171, -27, 169, -29, 167, -31, 165, -33, 163, -35, 161, -37, 159, -39, 157, -41, 155, -43, 153, -45, 151, -47, 149, -49, 147, -51, 145, -53, 143, -55, 141, -57, 139, -59, 137, -61, 135, -63, 133, -65, 131, -67, 129, -69, 127, -71, 125, -73, 123, -75, 121, -77, 119, -79, 117, -8 -- (+87 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
def B : List (List Int) := [
[47714567908694981221893209686466399, -83351135997002682611639211697427978, -27172422157135472776520824950188298, 47413242965349081483623331803878971, -2776122777634264891551174594153118, 4229845489135337359185146041329041, -37082373529963543605498271714273814, -51979951367272852061908943107083967, -82080820132291919169501738692647624, -3950122018283286141244807738541564, -3603949843531772855298 -- (+3325 chars; full line in the Zenodo source)
[-83351135997002682611639211697427978, 47413242965349081483623331803878971, 4229845489135337359185146041329041, -51979951367272852061908943107083967, -3950122018283286141244807738541564, -31532398123233180765100196501711152, -42529753098547134813334417252472567, -2176815503566772061486779154052581, 13580811967063344370153637242886338, -67481731945022389674658467712351297, -2831527709275747543608 -- (+3278 chars; full line in the Zenodo source)
[-27172422157135472776520824950188298, 4229845489135337359185146041329041, -82080820132291919169501738692647624, -31532398123233180765100196501711152, -41235575330615899912723526288238339, 13580811967063344370153637242886338, -53642882500615282669008698842809722, -37220056322109677107664258280581411, -55455458940495234400175530206267947, -63131699675821514887711959996017572, -6351811663629995260 -- (+3294 chars; full line in the Zenodo source)
[47413242965349081483623331803878971, -51979951367272852061908943107083967, -31532398123233180765100196501711152, -2176815503566772061486779154052581, -67481731945022389674658467712351297, -37220056322109677107664258280581411, -13803535980192744547728570557373116, -109434427463797767917722388491092448, -51971866568585043871363780645536091, -3386511224358446316238122569585886, -119658083845315604 -- (+3293 chars; full line in the Zenodo source)
[-2776122777634264891551174594153118, -3950122018283286141244807738541564, -41235575330615899912723526288238339, -67481731945022389674658467712351297, -63757000733069583570725775131008219, -63131699675821514887711959996017572, -114309354952162054442003491168641907, -3386511224358446316238122569585886, -90742531996244536910794335610327697, -120637749090918754282265602890366157, -10084412237083513 -- (+3292 chars; full line in the Zenodo source)
[4229845489135337359185146041329041, -31532398123233180765100196501711152, 13580811967063344370153637242886338, -37220056322109677107664258280581411, -63131699675821514887711959996017572, -51971866568585043871363780645536091, -75143563537390177727263310673118876, 1841398206965804912347262639673137, -61194911119570347058732194538005136, -24158045177619130571345837374725906, -317949033896043046224 -- (+3289 chars; full line in the Zenodo source)
[-37082373529963543605498271714273814, -42529753098547134813334417252472567, -53642882500615282669008698842809722, -13803535980192744547728570557373116, -114309354952162054442003491168641907, -75143563537390177727263310673118876, -145047875532710663721170644616225306, -91916801786760080369555009964826663, -79095546097057980834435094240681501, -5328260265847555303368355690437716, -117236117444943 -- (+3291 chars; full line in the Zenodo source)
[-51979951367272852061908943107083967, -2176815503566772061486779154052581, -37220056322109677107664258280581411, -109434427463797767917722388491092448, -3386511224358446316238122569585886, 1841398206965804912347262639673137, -91916801786760080369555009964826663, -40016749994405061381602120512950994, -19689300446204699664046290698079818, -52009579054573263743034757951013133, 65417265524193262406 -- (+3290 chars; full line in the Zenodo source)
[-82080820132291919169501738692647624, 13580811967063344370153637242886338, -55455458940495234400175530206267947, -51971866568585043871363780645536091, -90742531996244536910794335610327697, -61194911119570347058732194538005136, -79095546097057980834435094240681501, -19689300446204699664046290698079818, -48898286462731760173994119557494141, 76196506038821776122196492202181899, -525412270521652598 -- (+3291 chars; full line in the Zenodo source)
[-3950122018283286141244807738541564, -67481731945022389674658467712351297, -63131699675821514887711959996017572, -3386511224358446316238122569585886, -120637749090918754282265602890366157, -24158045177619130571345837374725906, -5328260265847555303368355690437716, -52009579054573263743034757951013133, 76196506038821776122196492202181899, 94658294314649436397526139218919874, 388041567946505270328 -- (+3293 chars; full line in the Zenodo source)
[-36039498435317728552985930116739708, -28315277092757475436082079432681899, -63518116636299952604522568792116709, -119658083845315604933942636508306677, -100844122370835133202480089573809024, -31794903389604304622476814882933682, -117236117444943858643655974861261247, 65417265524193262406610442752136469, -52541227052165259819756185061422052, 38804156794650527032831598224694843, -228757178268610 -- (+3292 chars; full line in the Zenodo source)
[-31532398123233180765100196501711152, -37220056322109677107664258280581411, -51971866568585043871363780645536091, 1841398206965804912347262639673137, -24158045177619130571345837374725906, -19689300446204699664046290698079818, -2468829953063118139586703483034933, 59369631376080226762373428117196031, 68035770931077979532802281808641642, 117236117444943858643655974861261247, 1382978915308317841444 -- (+3292 chars; full line in the Zenodo source)
[-10080128265225784520240335059562803, -99206802795508858109976767492760444, -134540547181144247454858694301642209, -62402112809144426396073591972256642, -138297891530831784144427706576342539, 21737426472258225169575499828388513, -42531912779256902425821799140629957, 39224815312495262387055755721323469, 52009579054573263743034757951013133, 134307869861721421219426151787251063, 611949111195703470 -- (+3292 chars; full line in the Zenodo source)
[-42529753098547134813334417252472567, -13803535980192744547728570557373116, -75143563537390177727263310673118876, -91916801786760080369555009964826663, -5328260265847555303368355690437716, -2468829953063118139586703483034933, 52541227052165259819756185061422052, 82288873067919355380737805007795021, 144392220781546724323418935889959492, 111430483374927659832682385422145372, 114402182036309190428 -- (+3294 chars; full line in the Zenodo source)
[-41235575330615899912723526288238339, -63131699675821514887711959996017572, -90742531996244536910794335610327697, -24158045177619130571345837374725906, -77775121368731271504887319297261527, 76196506038821776122196492202181899, 41175297450706207479954627312341459, 117236117444943858643655974861261247, 98428204984700559679321544701122079, 149774409240769696719218575069869479, 10943442746379776791 -- (+3289 chars; full line in the Zenodo source)
[-2176815503566772061486779154052581, -109434427463797767917722388491092448, 1841398206965804912347262639673137, -40016749994405061381602120512950994, -52009579054573263743034757951013133, 59369631376080226762373428117196031, 82288873067919355380737805007795021, 94007184038304076309830630008798203, 92966731393639599469652969441605401, 127109248742405848562772406432877311, 53642882500615282669008 -- (+3289 chars; full line in the Zenodo source)
[-81936163477527240254925066573384242, -3593837269056033068245639884810566, -124226651591782612830715727163930711, -49889247540462283876613401600647293, -82288873067919355380737805007795021, 83478045513862408290158677767329132, -21737426472258225169575499828388513, 104379114567519413217847939787369166, 119658083845315604933942636508306677, 55455458940495234400175530206267947, 3950122018283286141 -- (+3288 chars; full line in the Zenodo source)
[13580811967063344370153637242886338, -51971866568585043871363780645536091, -61194911119570347058732194538005136, -19689300446204699664046290698079818, 76196506038821776122196492202181899, 68035770931077979532802281808641642, 144392220781546724323418935889959492, 92966731393639599469652969441605401, 114309354952162054442003491168641907, 81936163477527240254925066573384242, 4771456790869498122189 -- (+3286 chars; full line in the Zenodo source)
[-63390740468758912125174344527275179, -59921785299121547752756314710308472, -111430483374927659832682385422145372, 22875717826861019581952363989015639, -83478045513862408290158677767329132, 74262483216443321667663466389699599, 40016749994405061381602120512950994, 90742531996244536910794335610327697, 99206802795508858109976767492760444, 37082373529963543605498271714273814, -315323981232331807651 -- (+3293 chars; full line in the Zenodo source)
[-67481731945022389674658467712351297, -3386511224358446316238122569585886, -24158045177619130571345837374725906, -52009579054573263743034757951013133, 94658294314649436397526139218919874, 117236117444943858643655974861261247, 111430483374927659832682385422145372, 127109248742405848562772406432877311, 81936163477527240254925066573384242, -27172422157135472776520824950188298, -1016513230572487295 -- (+3290 chars; full line in the Zenodo source)
[-53642882500615282669008698842809722, -75143563537390177727263310673118876, -79095546097057980834435094240681501, -2468829953063118139586703483034933, 41175297450706207479954627312341459, 144392220781546724323418935889959492, 120637749090918754282265602890366157, 137988822292942890658633311155725336, 51979951367272852061908943107083967, -10080128265225784520240335059562803, -3593837269056033068 -- (+3292 chars; full line in the Zenodo source)
[-28315277092757475436082079432681899, -119658083845315604933942636508306677, -31794903389604304622476814882933682, 65417265524193262406610442752136469, 38804156794650527032831598224694843, 138297891530831784144427706576342539, 114402182036309190428658935931249064, 53642882500615282669008698842809722, 47714567908694981221893209686466399, -101651323057248729581307151391516526, -907425319962445369 -- (+3289 chars; full line in the Zenodo source)
[-101651323057248729581307151391516526, -6760850190284203375101652766891053, -94007184038304076309830630008798203, -41175297450706207479954627312341459, -10767226946685662306611275638174208, 136244365762119641523619015239054416, 51971866568585043871363780645536091, 10080128265225784520240335059562803, -3950122018283286141244807738541564, -63518116636299952604522568792116709, -9191680178676008036 -- (+3293 chars; full line in the Zenodo source)
[-37220056322109677107664258280581411, 1841398206965804912347262639673137, -19689300446204699664046290698079818, 59369631376080226762373428117196031, 117236117444943858643655974861261247, 92966731393639599469652969441605401, 137988822292942890658633311155725336, 2776122777634264891551174594153118, -63390740468758912125174344527275179, -114402182036309190428658935931249064, -134307869861721421219 -- (+3289 chars; full line in the Zenodo source)
[-63757000733069583570725775131008219, -120637749090918754282265602890366157, -77775121368731271504887319297261527, 94658294314649436397526139218919874, 19689300446204699664046290698079818, 149774409240769696719218575069869479, 28315277092757475436082079432681899, -27172422157135472776520824950188298, -13803535980192744547728570557373116, -92966731393639599469652969441605401, 2173742647225822516 -- (+3293 chars; full line in the Zenodo source)
[-99206802795508858109976767492760444, -62402112809144426396073591972256642, 21737426472258225169575499828388513, 39224815312495262387055755721323469, 134307869861721421219426151787251063, 125161188633208733547434581280823764, 41235575330615899912723526288238339, -36039498435317728552985930116739708, -127109248742405848562772406432877311, -79095546097057980834435094240681501, -680357709310779795 -- (+3289 chars; full line in the Zenodo source)
[-55455458940495234400175530206267947, -61194911119570347058732194538005136, -48898286462731760173994119557494141, 68035770931077979532802281808641642, 98428204984700559679321544701122079, 114309354952162054442003491168641907, 51979951367272852061908943107083967, -63390740468758912125174344527275179, -6760850190284203375101652766891053, -131104745084821626907116948911417623, 94658294314649436397 -- (+3290 chars; full line in the Zenodo source)
[-13803535980192744547728570557373116, -91916801786760080369555009964826663, -2468829953063118139586703483034933, 82288873067919355380737805007795021, 111430483374927659832682385422145372, 137988822292942890658633311155725336, -47714567908694981221893209686466399, -55455458940495234400175530206267947, -100844122370835133202480089573809024, -74262483216443321667663466389699599, 594473031414220981 -- (+3287 chars; full line in the Zenodo source)
[-137988822292942890658633311155725336, 3038926973432008270758401076533777, -38804156794650527032831598224694843, 48898286462731760173994119557494141, 62402112809144426396073591972256642, 101651323057248729581307151391516526, 4229845489135337359185146041329041, -114309354952162054442003491168641907, -40016749994405061381602120512950994, -39224815312495262387055755721323469, 777751213687312715048 -- (+3285 chars; full line in the Zenodo source)
[-63131699675821514887711959996017572, -24158045177619130571345837374725906, 76196506038821776122196492202181899, 117236117444943858643655974861261247, 149774409240769696719218575069869479, 81936163477527240254925066573384242, -10080128265225784520240335059562803, -114402182036309190428658935931249064, -131104745084821626907116948911417623, -20221692111374969977615905019842953, 40016749994405061 -- (+3288 chars; full line in the Zenodo source)
[-67735983526684098133623226439279808, -98428204984700559679321544701122079, -39224815312495262387055755721323469, 131104745084821626907116948911417623, 75143563537390177727263310673118876, 36039498435317728552985930116739708, -67481731945022389674658467712351297, -124226651591782612830715727163930711, 10767226946685662306611275638174208, 2468829953063118139586703483034933, 929667313936395994696 -- (+3288 chars; full line in the Zenodo source)
[-109434427463797767917722388491092448, -40016749994405061381602120512950994, 59369631376080226762373428117196031, 94007184038304076309830630008798203, 127109248742405848562772406432877311, 2776122777634264891551174594153118, -55455458940495234400175530206267947, -136244365762119641523619015239054416, -42531912779256902425821799140629957, 67323972106556871144162572576081153, 75143563537390177727 -- (+3288 chars; full line in the Zenodo source)
[-63518116636299952604522568792116709, -31794903389604304622476814882933682, -52541227052165259819756185061422052, 138297891530831784144427706576342539, 109434427463797767917722388491092448, 47714567908694981221893209686466399, -3593837269056033068245639884810566, -134307869861721421219426151787251063, 94658294314649436397526139218919874, 40016749994405061381602120512950994, 67735983526684098133 -- (+3291 chars; full line in the Zenodo source)
[-3593837269056033068245639884810566, -49889247540462283876613401600647293, 83478045513862408290158677767329132, 104379114567519413217847939787369166, 55455458940495234400175530206267947, -37082373529963543605498271714273814, -125161188633208733547434581280823764, -77775121368731271504887319297261527, -65417265524193262406610442752136469, 61194911119570347058732194538005136, 67481731945022389674 -- (+3289 chars; full line in the Zenodo source)
[-114309354952162054442003491168641907, -5328260265847555303368355690437716, 41175297450706207479954627312341459, 111430483374927659832682385422145372, 28315277092757475436082079432681899, -10080128265225784520240335059562803, 1841398206965804912347262639673137, -74262483216443321667663466389699599, 112194657705244244327070824730181097, 119658083845315604933942636508306677, 820808201322919191695 -- (+3292 chars; full line in the Zenodo source)
[-51971866568585043871363780645536091, -19689300446204699664046290698079818, 68035770931077979532802281808641642, 92966731393639599469652969441605401, 81936163477527240254925066573384242, -63390740468758912125174344527275179, -100844122370835133202480089573809024, -42531912779256902425821799140629957, 5328260265847555303368355690437716, 3593837269056033068245639884810566, -8335113599700268261163 -- (+3289 chars; full line in the Zenodo source)
[-127109248742405848562772406432877311, -67323972106556871144162572576081153, 59447303141422098173448068413788577, 145047875532710663721170644616225306, 31532398123233180765100196501711152, -63757000733069583570725775131008219, -98428204984700559679321544701122079, -52541227052165259819756185061422052, 104379114567519413217847939787369166, 37220056322109677107664258280581411, -100801282652257845 -- (+3289 chars; full line in the Zenodo source)
[-59921785299121547752756314710308472, 22875717826861019581952363989015639, 74262483216443321667663466389699599, 90742531996244536910794335610327697, 37082373529963543605498271714273814, -67735983526684098133623226439279808, -94007184038304076309830630008798203, -76196506038821776122196492202181899, 62402112809144426396073591972256642, 42529753098547134813334417252472567, -3722005632210967710766 -- (+3288 chars; full line in the Zenodo source)
[-134540547181144247454858694301642209, 21737426472258225169575499828388513, 52009579054573263743034757951013133, 125161188633208733547434581280823764, 83351135997002682611639211697427978, -127109248742405848562772406432877311, 22875717826861019581952363989015639, -10767226946685662306611275638174208, 114402182036309190428658935931249064, -47413242965349081483623331803878971, -114309354952162054 -- (+3295 chars; full line in the Zenodo source)
[-3386511224358446316238122569585886, -52009579054573263743034757951013133, 117236117444943858643655974861261247, 127109248742405848562772406432877311, -27172422157135472776520824950188298, -114402182036309190428658935931249064, -74262483216443321667663466389699599, 67323972106556871144162572576081153, 3593837269056033068245639884810566, 4229845489135337359185146041329041, -676085019028420337510 -- (+3289 chars; full line in the Zenodo source)
[-125161188633208733547434581280823764, 10767226946685662306611275638174208, 67323972106556871144162572576081153, 63518116636299952604522568792116709, -51979951367272852061908943107083967, -145047875532710663721170644616225306, 76196506038821776122196492202181899, 31794903389604304622476814882933682, 63757000733069583570725775131008219, -2176815503566772061486779154052581, -111430483374927659832 -- (+3289 chars; full line in the Zenodo source)
[-75143563537390177727263310673118876, -2468829953063118139586703483034933, 144392220781546724323418935889959492, 137988822292942890658633311155725336, -10080128265225784520240335059562803, -100844122370835133202480089573809024, -94658294314649436397526139218919874, -3038926973432008270758401076533777, 2176815503566772061486779154052581, -99206802795508858109976767492760444, -4988924754046228387 -- (+3291 chars; full line in the Zenodo source)
[-114402182036309190428658935931249064, -59447303141422098173448068413788577, 49889247540462283876613401600647293, 63757000733069583570725775131008219, 13580811967063344370153637242886338, -104379114567519413217847939787369166, 39224815312495262387055755721323469, 120637749090918754282265602890366157, 37082373529963543605498271714273814, -51971866568585043871363780645536091, -1121946577052442443 -- (+3287 chars; full line in the Zenodo source)
[-119658083845315604933942636508306677, 65417265524193262406610442752136469, 138297891530831784144427706576342539, 53642882500615282669008698842809722, -101651323057248729581307151391516526, -134307869861721421219426151787251063, 59447303141422098173448068413788577, 75143563537390177727263310673118876, -83351135997002682611639211697427978, -6760850190284203375101652766891053, 7619650603882177612 -- (+3284 chars; full line in the Zenodo source)
[-90742531996244536910794335610327697, 76196506038821776122196492202181899, 98428204984700559679321544701122079, 81936163477527240254925066573384242, -13803535980192744547728570557373116, -131104745084821626907116948911417623, 112194657705244244327070824730181097, 3593837269056033068245639884810566, -36039498435317728552985930116739708, -91916801786760080369555009964826663, -59369631376080226762 -- (+3288 chars; full line in the Zenodo source)
[-6760850190284203375101652766891053, -41175297450706207479954627312341459, 136244365762119641523619015239054416, 10080128265225784520240335059562803, -63518116636299952604522568792116709, -112194657705244244327070824730181097, 19689300446204699664046290698079818, 99206802795508858109976767492760444, -67481731945022389674658467712351297, -31794903389604304622476814882933682, 82288873067919355380 -- (+3294 chars; full line in the Zenodo source)
[-149774409240769696719218575069869479, 20221692111374969977615905019842953, 91916801786760080369555009964826663, 82080820132291919169501738692647624, -59921785299121547752756314710308472, -82288873067919355380737805007795021, 138297891530831784144427706576342539, -13580811967063344370153637242886338, -137988822292942890658633311155725336, 22875717826861019581952363989015639, 6732397210655687114 -- (+3287 chars; full line in the Zenodo source)
[1841398206965804912347262639673137, 59369631376080226762373428117196031, 92966731393639599469652969441605401, 2776122777634264891551174594153118, -114402182036309190428658935931249064, -42531912779256902425821799140629957, -3038926973432008270758401076533777, 3950122018283286141244807738541564, -59921785299121547752756314710308472, -59447303141422098173448068413788577, 7909554609705798083443509 -- (+3288 chars; full line in the Zenodo source)
[-145047875532710663721170644616225306, 52541227052165259819756185061422052, 120637749090918754282265602890366157, -47714567908694981221893209686466399, 1841398206965804912347262639673137, -94658294314649436397526139218919874, 124226651591782612830715727163930711, 83351135997002682611639211697427978, -149774409240769696719218575069869479, 59369631376080226762373428117196031, 62402112809144426396 -- (+3287 chars; full line in the Zenodo source)
[-120637749090918754282265602890366157, 94658294314649436397526139218919874, 149774409240769696719218575069869479, -27172422157135472776520824950188298, -92966731393639599469652969441605401, -20221692111374969977615905019842953, 119658083845315604933942636508306677, 4229845489135337359185146041329041, -91916801786760080369555009964826663, 42531912779256902425821799140629957, 12516118863320873354 -- (+3292 chars; full line in the Zenodo source)
[-124226651591782612830715727163930711, 83478045513862408290158677767329132, 119658083845315604933942636508306677, -37082373529963543605498271714273814, 3038926973432008270758401076533777, -65417265524193262406610442752136469, 127109248742405848562772406432877311, -42529753098547134813334417252472567, -138297891530831784144427706576342539, 48898286462731760173994119557494141, 6313169967582151488 -- (+3295 chars; full line in the Zenodo source)
[-62402112809144426396073591972256642, 39224815312495262387055755721323469, 125161188633208733547434581280823764, -36039498435317728552985930116739708, -79095546097057980834435094240681501, -10767226946685662306611275638174208, 63131699675821514887711959996017572, -28315277092757475436082079432681899, -67323972106556871144162572576081153, 144392220781546724323418935889959492, 6339074046875891212 -- (+3290 chars; full line in the Zenodo source)
[-92966731393639599469652969441605401, 42531912779256902425821799140629957, 59921785299121547752756314710308472, -41235575330615899912723526288238339, -49889247540462283876613401600647293, -22875717826861019581952363989015639, 101651323057248729581307151391516526, -63131699675821514887711959996017572, -74262483216443321667663466389699599, 104379114567519413217847939787369166, 5197995136727285206 -- (+3289 chars; full line in the Zenodo source)
[-61194911119570347058732194538005136, 68035770931077979532802281808641642, 114309354952162054442003491168641907, -63390740468758912125174344527275179, -131104745084821626907116948911417623, 5328260265847555303368355690437716, 2176815503566772061486779154052581, -59921785299121547752756314710308472, -41175297450706207479954627312341459, 124226651591782612830715727163930711, -27172422157135472776 -- (+3289 chars; full line in the Zenodo source)
[-100844122370835133202480089573809024, 38804156794650527032831598224694843, 109434427463797767917722388491092448, -101651323057248729581307151391516526, 21737426472258225169575499828388513, 40016749994405061381602120512950994, 82080820132291919169501738692647624, -6760850190284203375101652766891053, -59369631376080226762373428117196031, 125161188633208733547434581280823764, -4252975309854713481 -- (+3293 chars; full line in the Zenodo source)
[-91916801786760080369555009964826663, 82288873067919355380737805007795021, 137988822292942890658633311155725336, -55455458940495234400175530206267947, -74262483216443321667663466389699599, -3038926973432008270758401076533777, 83351135997002682611639211697427978, -61194911119570347058732194538005136, 38804156794650527032831598224694843, 67735983526684098133623226439279808, -637570007330695835707 -- (+3290 chars; full line in the Zenodo source)
[-111430483374927659832682385422145372, 74262483216443321667663466389699599, 99206802795508858109976767492760444, -67735983526684098133623226439279808, 65417265524193262406610442752136469, 62402112809144426396073591972256642, -2776122777634264891551174594153118, -98428204984700559679321544701122079, -21737426472258225169575499828388513, 53642882500615282669008698842809722, -519718665685850438713 -- (+3294 chars; full line in the Zenodo source)
[3038926973432008270758401076533777, 48898286462731760173994119557494141, 101651323057248729581307151391516526, -114309354952162054442003491168641907, -39224815312495262387055755721323469, 6760850190284203375101652766891053, -31532398123233180765100196501711152, -5328260265847555303368355690437716, 94007184038304076309830630008798203, 36039498435317728552985930116739708, -14977440924076969671921 -- (+3290 chars; full line in the Zenodo source)
[-136244365762119641523619015239054416, 112194657705244244327070824730181097, 67481731945022389674658467712351297, -134540547181144247454858694301642209, 52541227052165259819756185061422052, 3386511224358446316238122569585886, -63390740468758912125174344527275179, 21737426472258225169575499828388513, 24158045177619130571345837374725906, -47714567908694981221893209686466399, 303892697343200827075 -- (+3289 chars; full line in the Zenodo source)
[-24158045177619130571345837374725906, 117236117444943858643655974861261247, 81936163477527240254925066573384242, -114402182036309190428658935931249064, -20221692111374969977615905019842953, 3593837269056033068245639884810566, -99206802795508858109976767492760444, -59447303141422098173448068413788577, 124226651591782612830715727163930711, -82080820132291919169501738692647624, -940071840383040763 -- (+3291 chars; full line in the Zenodo source)
[-104379114567519413217847939787369166, 77775121368731271504887319297261527, 42529753098547134813334417252472567, -149774409240769696719218575069869479, 68035770931077979532802281808641642, 13803535980192744547728570557373116, -63518116636299952604522568792116709, 20221692111374969977615905019842953, 75143563537390177727263310673118876, -63390740468758912125174344527275179, -52009579054573263743 -- (+3287 chars; full line in the Zenodo source)
[-98428204984700559679321544701122079, 131104745084821626907116948911417623, 36039498435317728552985930116739708, -124226651591782612830715727163930711, 2468829953063118139586703483034933, 28315277092757475436082079432681899, -3386511224358446316238122569585886, 83478045513862408290158677767329132, 63518116636299952604522568792116709, -137988822292942890658633311155725336, -425319127792569024258 -- (+3289 chars; full line in the Zenodo source)
[-79095546097057980834435094240681501, 144392220781546724323418935889959492, 51979951367272852061908943107083967, -100844122370835133202480089573809024, 112194657705244244327070824730181097, 2176815503566772061486779154052581, -149774409240769696719218575069869479, 38804156794650527032831598224694843, 37220056322109677107664258280581411, -134540547181144247454858694301642209, 8347804551386240829 -- (+3293 chars; full line in the Zenodo source)
[-40016749994405061381602120512950994, 94007184038304076309830630008798203, 2776122777634264891551174594153118, -136244365762119641523619015239054416, 67323972106556871144162572576081153, 3950122018283286141244807738541564, -61194911119570347058732194538005136, 112194657705244244327070824730181097, 41235575330615899912723526288238339, -145047875532710663721170644616225306, 2468829953063118139586 -- (+3285 chars; full line in the Zenodo source)
[-138297891530831784144427706576342539, 134307869861721421219426151787251063, 83351135997002682611639211697427978, -79095546097057980834435094240681501, 94007184038304076309830630008798203, -47413242965349081483623331803878971, -104379114567519413217847939787369166, 144392220781546724323418935889959492, -4229845489135337359185146041329041, -136244365762119641523619015239054416, 13110474508482162 -- (+3287 chars; full line in the Zenodo source)
[-31794903389604304622476814882933682, 138297891530831784144427706576342539, 47714567908694981221893209686466399, -134307869861721421219426151787251063, 40016749994405061381602120512950994, -83351135997002682611639211697427978, -49889247540462283876613401600647293, 79095546097057980834435094240681501, -27172422157135472776520824950188298, -94007184038304076309830630008798203, 9842820498470055967 -- (+3296 chars; full line in the Zenodo source)
[-134307869861721421219426151787251063, 79095546097057980834435094240681501, 47413242965349081483623331803878971, -144392220781546724323418935889959492, 136244365762119641523619015239054416, -51979951367272852061908943107083967, -77775121368731271504887319297261527, 100844122370835133202480089573809024, -31532398123233180765100196501711152, -112194657705244244327070824730181097, 1242266515917826 -- (+3292 chars; full line in the Zenodo source)
[-49889247540462283876613401600647293, 104379114567519413217847939787369166, -37082373529963543605498271714273814, -77775121368731271504887319297261527, 61194911119570347058732194538005136, -42529753098547134813334417252472567, 10767226946685662306611275638174208, 149774409240769696719218575069869479, -53642882500615282669008698842809722, -68035770931077979532802281808641642, 3386511224358446316 -- (+3290 chars; full line in the Zenodo source)
[-94007184038304076309830630008798203, 136244365762119641523619015239054416, -3950122018283286141244807738541564, -112194657705244244327070824730181097, 145047875532710663721170644616225306, -67481731945022389674658467712351297, -68035770931077979532802281808641642, 134540547181144247454858694301642209, -63131699675821514887711959996017572, -52541227052165259819756185061422052, 13798882229294289 -- (+3296 chars; full line in the Zenodo source)
[-5328260265847555303368355690437716, 111430483374927659832682385422145372, -10080128265225784520240335059562803, -74262483216443321667663466389699599, 119658083845315604933942636508306677, -99206802795508858109976767492760444, 59369631376080226762373428117196031, 67735983526684098133623226439279808, -134540547181144247454858694301642209, -65417265524193262406610442752136469, -135808119670633443 -- (+3291 chars; full line in the Zenodo source)
[-144392220781546724323418935889959492, 100844122370835133202480089573809024, -2176815503566772061486779154052581, -38804156794650527032831598224694843, 134540547181144247454858694301642209, -109434427463797767917722388491092448, -20221692111374969977615905019842953, 101651323057248729581307151391516526, 1841398206965804912347262639673137, -21737426472258225169575499828388513, 370823735299635436 -- (+3290 chars; full line in the Zenodo source)
[-19689300446204699664046290698079818, 92966731393639599469652969441605401, -63390740468758912125174344527275179, -42531912779256902425821799140629957, 3593837269056033068245639884810566, -59921785299121547752756314710308472, 38804156794650527032831598224694843, 41235575330615899912723526288238339, -111430483374927659832682385422145372, 49889247540462283876613401600647293, 4741324296534908148362 -- (+3292 chars; full line in the Zenodo source)
[-131104745084821626907116948911417623, 124226651591782612830715727163930711, -28315277092757475436082079432681899, -83478045513862408290158677767329132, 137988822292942890658633311155725336, -119658083845315604933942636508306677, 52009579054573263743034757951013133, 37082373529963543605498271714273814, -31794903389604304622476814882933682, -3038926973432008270758401076533777, -41235575330615899 -- (+3290 chars; full line in the Zenodo source)
[-67323972106556871144162572576081153, 145047875532710663721170644616225306, -63757000733069583570725775131008219, -52541227052165259819756185061422052, 37220056322109677107664258280581411, -120637749090918754282265602890366157, 131104745084821626907116948911417623, 47714567908694981221893209686466399, -77775121368731271504887319297261527, -1841398206965804912347262639673137, -992068027955088581 -- (+3290 chars; full line in the Zenodo source)
[-77775121368731271504887319297261527, 149774409240769696719218575069869479, -13803535980192744547728570557373116, -20221692111374969977615905019842953, 63390740468758912125174344527275179, -91916801786760080369555009964826663, 31794903389604304622476814882933682, -82080820132291919169501738692647624, -2468829953063118139586703483034933, 59921785299121547752756314710308472, -12710924874240584856 -- (+3294 chars; full line in the Zenodo source)
[22875717826861019581952363989015639, 90742531996244536910794335610327697, -67735983526684098133623226439279808, -76196506038821776122196492202181899, 42529753098547134813334417252472567, -98428204984700559679321544701122079, 136244365762119641523619015239054416, -81936163477527240254925066573384242, -39224815312495262387055755721323469, 13803535980192744547728570557373116, 184139820696580491234 -- (+3285 chars; full line in the Zenodo source)
[-117236117444943858643655974861261247, 114402182036309190428658935931249064, -3593837269056033068245639884810566, 59447303141422098173448068413788577, 82080820132291919169501738692647624, -49889247540462283876613401600647293, 62402112809144426396073591972256642, -63757000733069583570725775131008219, 83478045513862408290158677767329132, -13580811967063344370153637242886338, -13624436576211964152 -- (+3292 chars; full line in the Zenodo source)
[21737426472258225169575499828388513, 125161188633208733547434581280823764, -127109248742405848562772406432877311, -10767226946685662306611275638174208, -47413242965349081483623331803878971, -67323972106556871144162572576081153, 90742531996244536910794335610327697, -63518116636299952604522568792116709, 59447303141422098173448068413788577, 51979951367272852061908943107083967, -5328260265847555303 -- (+3290 chars; full line in the Zenodo source)
[-112194657705244244327070824730181097, 134540547181144247454858694301642209, -3386511224358446316238122569585886, -21737426472258225169575499828388513, 47714567908694981221893209686466399, -52009579054573263743034757951013133, 59921785299121547752756314710308472, -125161188633208733547434581280823764, 117236117444943858643655974861261247, -83351135997002682611639211697427978, -48898286462731760 -- (+3290 chars; full line in the Zenodo source)
[-52009579054573263743034757951013133, 127109248742405848562772406432877311, -114402182036309190428658935931249064, 67323972106556871144162572576081153, 4229845489135337359185146041329041, -59447303141422098173448068413788577, 67735983526684098133623226439279808, -145047875532710663721170644616225306, 49889247540462283876613401600647293, -31532398123233180765100196501711152, -4117529745070620747 -- (+3288 chars; full line in the Zenodo source)
[-48898286462731760173994119557494141, 114309354952162054442003491168641907, -6760850190284203375101652766891053, 5328260265847555303368355690437716, -36039498435317728552985930116739708, -41175297450706207479954627312341459, 37220056322109677107664258280581411, -111430483374927659832682385422145372, 136244365762119641523619015239054416, -28315277092757475436082079432681899, -2022169211137496997 -- (+3293 chars; full line in the Zenodo source)
[10767226946685662306611275638174208, 63518116636299952604522568792116709, -145047875532710663721170644616225306, 31794903389604304622476814882933682, -2176815503566772061486779154052581, 52541227052165259819756185061422052, 81936163477527240254925066573384242, -138297891530831784144427706576342539, 120637749090918754282265602890366157, -109434427463797767917722388491092448, 74262483216443321667 -- (+3288 chars; full line in the Zenodo source)
[-74262483216443321667663466389699599, 67735983526684098133623226439279808, -62402112809144426396073591972256642, 98428204984700559679321544701122079, -53642882500615282669008698842809722, 39224815312495262387055755721323469, 3950122018283286141244807738541564, -131104745084821626907116948911417623, 125161188633208733547434581280823764, -75143563537390177727263310673118876, 196893004462046996640 -- (+3293 chars; full line in the Zenodo source)
[-2468829953063118139586703483034933, 137988822292942890658633311155725336, -100844122370835133202480089573809024, -3038926973432008270758401076533777, -99206802795508858109976767492760444, 38804156794650527032831598224694843, 27172422157135472776520824950188298, -48898286462731760173994119557494141, 109434427463797767917722388491092448, -62402112809144426396073591972256642, 10437911456751941321 -- (+3296 chars; full line in the Zenodo source)
[-82288873067919355380737805007795021, 55455458940495234400175530206267947, 3038926973432008270758401076533777, 61194911119570347058732194538005136, -67735983526684098133623226439279808, 48898286462731760173994119557494141, 47413242965349081483623331803878971, -68035770931077979532802281808641642, 101651323057248729581307151391516526, -98428204984700559679321544701122079, 12063774909091875428226 -- (+3287 chars; full line in the Zenodo source)
[-59447303141422098173448068413788577, 63757000733069583570725775131008219, -104379114567519413217847939787369166, 120637749090918754282265602890366157, -51971866568585043871363780645536091, 77775121368731271504887319297261527, -36039498435317728552985930116739708, -94658294314649436397526139218919874, 42529753098547134813334417252472567, -19689300446204699664046290698079818, 1345405471811442474 -- (+3294 chars; full line in the Zenodo source)
[-38804156794650527032831598224694843, 101651323057248729581307151391516526, -40016749994405061381602120512950994, 6760850190284203375101652766891053, -125161188633208733547434581280823764, 94007184038304076309830630008798203, 13580811967063344370153637242886338, 41175297450706207479954627312341459, 2776122777634264891551174594153118, 10767226946685662306611275638174208, 138035359801927445477285 -- (+3288 chars; full line in the Zenodo source)
[65417265524193262406610442752136469, 53642882500615282669008698842809722, -134307869861721421219426151787251063, 75143563537390177727263310673118876, -6760850190284203375101652766891053, 79095546097057980834435094240681501, -63757000733069583570725775131008219, 2468829953063118139586703483034933, 47413242965349081483623331803878971, -41175297450706207479954627312341459, 819361634775272402549250 -- (+3291 chars; full line in the Zenodo source)
[-68035770931077979532802281808641642, 63390740468758912125174344527275179, -5328260265847555303368355690437716, 59921785299121547752756314710308472, -124226651591782612830715727163930711, 111430483374927659832682385422145372, -109434427463797767917722388491092448, -22875717826861019581952363989015639, -10080128265225784520240335059562803, 83478045513862408290158677767329132, -422984548913533735 -- (+3294 chars; full line in the Zenodo source)
[76196506038821776122196492202181899, 81936163477527240254925066573384242, -131104745084821626907116948911417623, 3593837269056033068245639884810566, -91916801786760080369555009964826663, 124226651591782612830715727163930711, -134540547181144247454858694301642209, 49889247540462283876613401600647293, -28315277092757475436082079432681899, 82288873067919355380737805007795021, -27761227776342648915 -- (+3287 chars; full line in the Zenodo source)
[-42531912779256902425821799140629957, 41235575330615899912723526288238339, 22875717826861019581952363989015639, 63131699675821514887711959996017572, -104379114567519413217847939787369166, 90742531996244536910794335610327697, -6760850190284203375101652766891053, 24158045177619130571345837374725906, -67735983526684098133623226439279808, 77775121368731271504887319297261527, -2176815503566772061486 -- (+3286 chars; full line in the Zenodo source)
[-41175297450706207479954627312341459, 10080128265225784520240335059562803, -112194657705244244327070824730181097, 99206802795508858109976767492760444, -31794903389604304622476814882933682, 134540547181144247454858694301642209, -92966731393639599469652969441605401, 62402112809144426396073591972256642, -3386511224358446316238122569585886, 138297891530831784144427706576342539, -5545545894049523440 -- (+3289 chars; full line in the Zenodo source)
[-39224815312495262387055755721323469, 36039498435317728552985930116739708, 10767226946685662306611275638174208, 28315277092757475436082079432681899, -144392220781546724323418935889959492, 63518116636299952604522568792116709, -24158045177619130571345837374725906, 119658083845315604933942636508306677, -145047875532710663721170644616225306, 100844122370835133202480089573809024, -599217852991215477 -- (+3291 chars; full line in the Zenodo source)
[20221692111374969977615905019842953, 82080820132291919169501738692647624, -82288873067919355380737805007795021, -13580811967063344370153637242886338, 22875717826861019581952363989015639, 55455458940495234400175530206267947, -134307869861721421219426151787251063, 51971866568585043871363780645536091, 3038926973432008270758401076533777, 90742531996244536910794335610327697, -14504787553271066372117 -- (+3290 chars; full line in the Zenodo source)
[-83478045513862408290158677767329132, 37082373529963543605498271714273814, 65417265524193262406610442752136469, 42529753098547134813334417252472567, -48898286462731760173994119557494141, 53642882500615282669008698842809722, -67323972106556871144162572576081153, 13803535980192744547728570557373116, -134307869861721421219426151787251063, 114309354952162054442003491168641907, -24158045177619130571 -- (+3288 chars; full line in the Zenodo source)
[59369631376080226762373428117196031, 2776122777634264891551174594153118, -42531912779256902425821799140629957, 3950122018283286141244807738541564, -59447303141422098173448068413788577, 41235575330615899912723526288238339, -48898286462731760173994119557494141, 67481731945022389674658467712351297, 22875717826861019581952363989015639, 63757000733069583570725775131008219, -1443922207815467243234189 -- (+3287 chars; full line in the Zenodo source)
[-94658294314649436397526139218919874, 27172422157135472776520824950188298, 20221692111374969977615905019842953, -4229845489135337359185146041329041, -42531912779256902425821799140629957, 82080820132291919169501738692647624, 65417265524193262406610442752136469, 31532398123233180765100196501711152, -82288873067919355380737805007795021, 41235575330615899912723526288238339, 107672269466856623066112 -- (+3289 chars; full line in the Zenodo source)
[52541227052165259819756185061422052, -47714567908694981221893209686466399, -94658294314649436397526139218919874, 83351135997002682611639211697427978, 59369631376080226762373428117196031, 27172422157135472776520824950188298, -83478045513862408290158677767329132, -47413242965349081483623331803878971, 20221692111374969977615905019842953, 2776122777634264891551174594153118, -39224815312495262387055 -- (+3286 chars; full line in the Zenodo source)
set_option maxRecDepth 100000 in
theorem A_def : A = (rng 1 98).map (fun t => rowA (196 + 1) t (rng 1 98)) := rfl
set_option maxRecDepth 100000 in
theorem len : allLen 98 A = true := rfl
set_option maxRecDepth 100000 in
theorem cert : lcs 98 B A = sid 544981018543289669550455380759127224420 98 := rfl
theorem d_ne : (544981018543289669550455380759127224420 : Int) ≠ 0 := by
intro h
have h' : false = true := congrArg (fun z : Int => Nat.beq z.natAbs 0) h
exact Bool.noConfusion h'
/-- Every g of length 98 with A g = 0 is zero. -/
theorem kernel (g : List Int) (hg : g.length = 98) (h0 : mv A g = zeros 98) : g = zeros 98 :=
kernel_zero 98 544981018543289669550455380759127224420 d_ne A B len cert g hg h0
set_option maxRecDepth 100000 in
theorem delta : deltaOK 196 98 = true := rfl
/-- **Balanced ⇒ pairs for p = 197.** A list with entries in (0, 197) that is balanced for 1 ≤ t ≤ 98
has as many copies of x as of 197 − x for every 1 ≤ x ≤ 98 (any length). -/
theorem pairs (c : List Nat) (hr : ∀ y, y ∈ c → 0 < y ∧ y < 197)
(hb : ∀ t, 1 ≤ t → t < 1 + 98 → tsum 197 t c + tsum 197 t c = c.length * 197) :
(rng 1 98).all (fun x => Nat.beq (cnt x c) (cnt (197 - x) c)) = true :=
pairs_of_bal 196 98 544981018543289669550455380759127224420 d_ne A B len cert A_def delta c hr hb
end MailletCert197
#print axioms MailletCert197.A_def
#print axioms MailletCert197.len
#print axioms MailletCert197.cert
#print axioms MailletCert197.d_ne
#print axioms MailletCert197.kernel
#print axioms MailletCert197.delta
#print axioms MailletCert197.pairs