Lean / Reader
Lean readerPivot.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports Thresholds, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import Thresholdsimport Mathlib.Algebra.BigOperators.Associatednamespace FactorialThresholdsopen Finsetdef Representable (A : Finset ℕ) (t : ℕ) : Prop := ∃ S ⊆ A, ∏ a ∈ S, a = t/-- A certificate pivot need only test subsets of the eligible factors divisible by p.The remaining target is coprime to p and is itself representable if the original target is. -/theorem prime_pivot {A : Finset ℕ} {t p : ℕ} (hp : p.Prime) (repr : Representable A t) :∃ C ⊆ A.filter (fun a => p ∣ a ∧ a ∣ t), ∃ r, (∏ a ∈ C, a)*r=t ∧ ¬ p ∣ r ∧ Representable A r := byobtain ⟨S,sub,prod⟩ := reprlet C := S.filter fun a => p ∣ alet R := S.filter fun a => ¬ p ∣ arefine ⟨C,?_,∏ a ∈ R, a,?_,?_,R,?_,rfl⟩· intro a haobtain ⟨hs,dvd⟩ := mem_filter.mp hahave dt : a ∣ t := prod ▸ Finset.dvd_prod_of_mem id hsexact mem_filter.mpr ⟨sub hs,dvd,dt⟩· exact (prod_filter_mul_prod_filter_not S (fun a => p ∣ a) id).trans prod· intro dvdobtain ⟨a,ha,pa⟩ := ((Nat.prime_iff.mp hp).dvd_finset_prod_iff id).mp dvdexact (mem_filter.mp ha).2 pa· exact (filter_subset _ _).trans sub/-- Sound rule for verifying a stored negative node in a prime-pivot certificate. -/theorem pivot_excludes {A : Finset ℕ} {t p : ℕ} (hp : p.Prime)(test : ∀ C ⊆ A.filter (fun a => p ∣ a ∧ a ∣ t), ∀ r,(∏ a ∈ C, a)*r=t → ¬ p ∣ r → ¬ Representable A r) :¬ Representable A t := byintro yesobtain ⟨C,hC,r,eq,free,child⟩ := prime_pivot hp yesexact test C hC r eq free child#print axioms prime_pivot#print axioms pivot_excludesend FactorialThresholds