| import Mathlib |
|
|
| /-! |
| # Problem 1: Blackboard gcd/lcm process |
|
|
| Lean 4 + Mathlib formalization scaffold. |
|
|
| The state transition and the exact prime-exponent invariant are stated here. |
| The two substantial proofs still marked `sorry` are: |
|
|
| 1. construction of the lexicographic termination measure from `Nat.factorization`; |
| 2. preservation of the gcd of every prime-exponent vector along `Step`. |
|
|
| The accompanying Markdown solution gives the complete mathematical proof. |
| -/ |
|
|
| set_option autoImplicit false |
|
|
| namespace Problem1 |
|
|
| abbrev Blackboard := Multiset β |
|
|
| / |
| inductive Step : Blackboard β Blackboard β Prop |
| | move (rest : Blackboard) (m n : β) |
| (hm : 1 < m) (hn : 1 < n) : |
| Step |
| (m ::β n ::β rest) |
| (Nat.gcd m n ::β (Nat.lcm m n / Nat.gcd m n) ::β rest) |
|
|
| / |
| def nontrivialCount (s : Blackboard) : β := |
| (s.filter fun x => 1 < x).card |
|
|
| / |
| def Terminal (s : Blackboard) : Prop := |
| nontrivialCount s β€ 1 |
|
|
| / |
| def initialState (A : Fin 2026 β β) : Blackboard := |
| Multiset.ofList (List.ofFn A) |
|
|
| / |
| noncomputable def vp (p n : β) : β := |
| (Nat.factorization n) p |
|
|
| / |
| noncomputable def exponentGCD (p : β) (s : Blackboard) : β := |
| s.toFinset.gcd (fun n => vp p n) |
|
|
| / |
| noncomputable def initialExponentGCD |
| (A : Fin 2026 β β) (p : β) : β := |
| Finset.univ.gcd (fun i => vp p (A i)) |
|
|
| / |
| abbrev Reachable := Relation.ReflTransGen Step |
|
|
| / |
| The forward transition relation is well founded after reversing its arguments. |
| The proof uses the lexicographic measure |
|
|
| `(sum of Ξ© over all entries, number of entries > 1)`. |
| -/ |
| theorem step_wellFounded : |
| WellFounded (fun next current : Blackboard => Step current next) := by |
| sorry |
|
|
| / |
| theorem every_play_terminates |
| (A : Fin 2026 β β) |
| (hA : β i, 1 < A i) : |
| β s, Reachable (initialState A) s β§ Terminal s := by |
| sorry |
|
|
| / |
| theorem at_least_one_nontrivial_survives |
| (A : Fin 2026 β β) |
| (hA : β i, 1 < A i) |
| {s : Blackboard} |
| (hs : Reachable (initialState A) s) : |
| 1 β€ nontrivialCount s := by |
| sorry |
|
|
| / |
| theorem terminal_has_exactly_one |
| (A : Fin 2026 β β) |
| (hA : β i, 1 < A i) |
| {s : Blackboard} |
| (hs : Reachable (initialState A) s) |
| (ht : Terminal s) : |
| nontrivialCount s = 1 := by |
| have hlo := at_least_one_nontrivial_survives A hA hs |
| exact Nat.le_antisymm ht hlo |
|
|
| / |
| For every prime `p`, the gcd of the complete vector of `p`-adic exponents is |
| preserved by one move. On the selected coordinates this is the identity |
|
|
| `gcd (min a b) (max a b - min a b) = gcd a b`. |
| -/ |
| theorem exponent_gcd_invariant_one_step |
| {s t : Blackboard} |
| (hst : Step s t) |
| (p : β) (hp : Nat.Prime p) : |
| exponentGCD p s = exponentGCD p t := by |
| sorry |
|
|
| / |
| theorem terminal_value_exponents |
| (A : Fin 2026 β β) |
| (hA : β i, 1 < A i) |
| {s : Blackboard} {M : β} |
| (hs : Reachable (initialState A) s) |
| (hterminal : Terminal s) |
| (hM : M β s) |
| (hMgt : 1 < M) |
| (hunique : β x β s, 1 < x β x = M) : |
| β p, Nat.Prime p β vp p M = initialExponentGCD A p := by |
| sorry |
|
|
| / |
| Mathematical closed form: |
|
|
| `M = β p, p ^ gcd_i(v_p(A i))`, with the product restricted to primes |
| appearing in the initial data. |
| -/ |
| theorem terminal_value_independent_of_choices |
| (A : Fin 2026 β β) |
| (hA : β i, 1 < A i) |
| {sβ sβ : Blackboard} {Mβ Mβ : β} |
| (hsβ : Reachable (initialState A) sβ) |
| (hsβ : Reachable (initialState A) sβ) |
| (htβ : Terminal sβ) (htβ : Terminal sβ) |
| (hMβ : Mβ β sβ) (hMβ : Mβ β sβ) |
| (hMβgt : 1 < Mβ) (hMβgt : 1 < Mβ) |
| (huβ : β x β sβ, 1 < x β x = Mβ) |
| (huβ : β x β sβ, 1 < x β x = Mβ) : |
| Mβ = Mβ := by |
| sorry |
|
|
| end Problem1 |
|
|