from pathlib import Path root = Path(__file__).parent / "source" files = [ "Erdos1112.lean", "Erdos1112Proof/Basic.lean", "Erdos1112Proof/Existence/Beatty.lean", "Erdos1112Proof/Existence/Reciprocal.lean", ] imports = """import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Algebra.BigOperators.Ring.Finset import Mathlib.Algebra.Order.Floor.Ring import Mathlib.Data.Fintype.Card import Mathlib.Data.Nat.Find import Mathlib.Data.Nat.Pairing import Mathlib.Data.Real.Archimedean import Mathlib.Order.ConditionallyCompleteLattice.Indexed import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Linarith import Mathlib.Tactic.NormNum import Mathlib.Tactic.Positivity import Mathlib.Tactic.Push import Mathlib.Tactic.Ring open scoped BigOperators """ parts = [] for filename in files: content = (root / filename).read_text() parts.append("\n".join(line for line in content.splitlines() if not line.startswith("import "))) kit = (root / "Erdos1112Proof/Short/Kit.lean").read_text() covering = "def TailCoveringN" + kit.split("def TailCoveringN", 1)[1].split("\n\n/-- Normalized", 1)[0] certificate = (root / "Erdos1112Proof/Short/Certificate.lean").read_text() certificate = "\n".join(line for line in certificate.splitlines() if not line.startswith("import ")) parts.append("namespace Erdos1112.Proof\n\n" + covering + "\n\nend Erdos1112.Proof") parts.append(certificate) final = (root / "Erdos1112Proof/Final.lean").read_text() positive = "theorem erdos_1112_existence_bound" + final.split("theorem erdos_1112_existence_bound", 1)[1].split("\n\n/-- Non-existence", 1)[0] check = """ namespace Erdos1112 """ + positive + """ /-- Relate the additive Lean inequalities to the site's difference formulation. -/ theorem desk_gap_clause {d₁ d₂ : ℕ} {a : ℕ → ℕ} (hd₁ : 1 ≤ d₁) : HasGapsIn d₁ d₂ a ↔ (0 < a 0 ∧ StrictMono a ∧ ∀ i, d₁ ≤ a (i + 1) - a i ∧ a (i + 1) - a i ≤ d₂) := by constructor · intro h refine ⟨h.1, h.strictMono hd₁, ?_⟩ intro i have hgap := h.2 i omega · rintro ⟨h0, hmono, h⟩ refine ⟨h0, ?_⟩ intro i have hgap := h i have hle := (hmono (Nat.lt_succ_self i)).le omega #print axioms erdos_1112_existence_bound #print axioms question_iff_questionInt #print axioms desk_gap_clause #print axioms Proof.strong_nonexistence_of_tailCovering end Erdos1112 """ (root / "DeskPositiveAudit.lean").write_text(imports + "\n\n".join(parts) + check)