Lean / Reader
Lean readerTriangleCounterexample.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports TriangleCertificate, TriangleSequence, TriangleFit, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import TriangleCertificateimport TriangleSequenceimport TriangleFitnamespace HuberTriangleprivate theorem agree (s : ℕ → Triple) (hs : SourceSequence s) (n : ℕ) (hn : n ≤ 94) :s n = greedyRow n := byinduction n with| zero => exact hs.1.trans prefix0.symm| succ i ih =>have h := hs.2 irw [ih (by omega)] at hhave g := prefix_step i (by omega)exact (g.2.2 _ h.1 h.2.1).resolve_right(h.2.2 _ g.1 g.2.1)def semiperimeter (t : Triple) : ℕ := perimeter t / 2def countertriangle : Triple := ⟨5676,6307,8485⟩/-- Statement of Huber’s geometric conjecture for the sequence s.The index i is the zero-based index of the enclosed triangle. -/def SourceConjecture (s : ℕ → Triple) : Prop :=∀ i t, Primitive t → semiperimeter t < semiperimeter (s (i+1)) →¬ TriangleFit.fits (s i).x (s i).y t.x t.y/-- The explicit witness refutes the geometric prediction at source index 95,regardless of how ambiguities in the selection rule are broken. -/theorem counterexample_at_95 (s : ℕ → Triple) (hs : SourceSequence s) :s 93 = ⟨5445,6308,8333⟩ ∧ s 94 = ⟨5568,6545,8593⟩ ∧Primitive countertriangle ∧ semiperimeter countertriangle = 10234 ∧semiperimeter (s 94) = 10353 ∧TriangleFit.fits (s 93).x (s 93).y countertriangle.x countertriangle.y := byhave ha := (agree s hs 93 (by decide)).trans prefix93have hb := (agree s hs 94 (by decide)).trans prefix94refine ⟨ha,hb,by decide +kernel,by decide +kernel,?_,?_⟩· rw [hb]; decide +kernel· rw [ha]; exact TriangleFit.pythagorean_triangle_fitstheorem refutes_geometric_conjecture {s : ℕ → Triple} (hs : SourceSequence s) :¬ SourceConjecture s := byobtain ⟨_,_,hc,hp,hq,hfit⟩ := counterexample_at_95 s hsintro claimexact claim 93 countertriangle hc (show semiperimeter countertriangle < semiperimeter (s 94) by omega) hfittheorem source_conjecture_false : ¬ SourceConjecture sourceRow :=refutes_geometric_conjecture sourceRow_valid#print axioms source_conjecture_falseend HuberTriangle