Lean / Reader
Lean readerRealProof.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports Bond8, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import Bond8import Mathlib.Algebra.Polynomial.Splitsimport Mathlib.Algebra.Polynomial.Derivativeimport Mathlib.Data.Real.Basicimport Mathlib.Tactic.Ringimport Mathlib.Tactic.NormNumimport Mathlib.Tactic.Linarithnamespace Bond8open Polynomialnoncomputable def realPoly : List Int → ℝ[X]| [] => 0| a::as => C (a : ℝ) + X * realPoly asnoncomputable def lag (p : ℝ[X]) (u : ℝ) : ℝ :=p.derivative.eval u ^ 2 - p.eval u * p.derivative.derivative.eval uprivate theorem lag_mul (p q : ℝ[X]) (u : ℝ) :lag (p*q) u = (p.eval u)^2 * lag q u + (q.eval u)^2 * lag p u := bysimp only [lag, derivative_mul, derivative_add, eval_mul, eval_add]ringprivate theorem lag_nonnegative (p : ℝ[X]) (u : ℝ) (hp : p.Splits (RingHom.id ℝ)) :0 ≤ lag p u := byobtain ⟨s,h⟩ := (splits_iff_exists_multiset _).1 hpsimp only [map_id, RingHom.id_apply] at hhave positive : ∀ l : Multiset ℝ, 0 ≤ lag ((l.map (fun r : ℝ => X - C r)).prod) u := byintro linduction l using Multiset.induction_on with| empty => simp [lag]| cons a l ih =>rw [Multiset.map_cons, Multiset.prod_cons, lag_mul]have lin : lag (X-C a) u = 1 := by simp [lag]rw [lin, mul_one]exact add_nonneg (mul_nonneg (sq_nonneg _) ih) (sq_nonneg _)conv_rhs => rw [h]rw [lag_mul]have hc : lag (C p.leadingCoeff) u = 0 := by simp [lag]rw [hc,mul_zero,add_zero]exact mul_nonneg (sq_nonneg _) (positive s)theorem witness_does_not_split : ¬ (realPoly difference).Splits (RingHom.id ℝ) := byintro hhave bad := lag_nonnegative _ (-3/2) hrw [coefficients_correct] at badnorm_num [realPoly,lag,derivative_mul,derivative_add] at bad-- Restrict a universal spanning-pair assertion to disjoint connected components-- of sizes 3 and 5. Proposition 2.2 of the source gives the component product.def valid (n : Nat) (g : Graph) : Prop :=(g.all (fun e => decide (e.1 < n ∧ e.2 < n ∧ e.1 ≠ e.2))) = true ∧connected g (List.range n) = truedef contained (a b : Graph) : Prop := a.all b.contains = truedef componentDifference (a b h k : Graph) : List Int :=List.zipWith (·-·) (product (coeffs 3 a) (coeffs 5 b))(product (coeffs 3 h) (coeffs 5 k))theorem not_all_spanning_pairs_split :¬ (∀ a b h k : Graph, valid 3 a → valid 5 b → valid 3 h → valid 5 k →contained h a → contained k b →(realPoly (componentDifference a b h k)).Splits (RingHom.id ℝ)) := byintro allPairsapply witness_does_not_splitapply allPairs triangle chorded path cycle <;>first | (unfold valid; constructor <;> decide) | (unfold contained; decide)end Bond8