Lean / Reader
Lean reader

Erdos311Certificates.lean

34 lines1 declarationsno sorryimports Erdos311Lower Erdos311Digits Erdos311Residues Erdos311Witnesses

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports Erdos311Lower, Erdos311Digits, Erdos311Residues, Erdos311Witnesses, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import Erdos311Lower
  2. import Erdos311Digits
  3. import Erdos311Residues
  4. import Erdos311Witnesses
  5. open Finset
  6. namespace Erdos311Certificates
  7. /-- An arithmetic residue certificate for strict minimality transfers to the rational minimum.
  8. The transfer quantifies over every candidate numerator; it does not enumerate subsets. -/
  9. theorem exact_of_gap (N : ℕ) (d : ℚ) (hd : 0 < d)
  10. (attains : ∃ x ∈ Erdos311Residues.subsetSums N, |x-1|=d)
  11. (exclude : ∀ u : ℕ, Erdos311Residues.locallyAdmissible N u →
  12. (u : ℚ) / Erdos311Residues.commonDen N ≠ 1 → d ≤ |(u : ℚ)/Erdos311Residues.commonDen N-1|) :
  13. IsLeast {y : ℚ | ∃ x ∈ Erdos311Residues.subsetSums N, x ≠ 1 ∧ y=|x-1|} d := by
  14. obtain ⟨x,hx,hv⟩ := attains
  15. refine ⟨⟨x,hx,?_,hv.symm⟩,?_⟩
  16. · intro h; rw [h] at hv; simp at hv; linarith
  17. · intro y hy
  18. obtain ⟨z,hz,hz',rfl⟩ := hy
  19. obtain ⟨A,hA,hval⟩ := Finset.mem_image.mp hz
  20. have he := Erdos311Residues.weight_sum_eq N A (Finset.mem_powerset.mp hA)
  21. let u := ∑ j ∈ A, Erdos311Residues.commonDen N/j
  22. have hL : (Erdos311Residues.commonDen N : ℚ) ≠ 0 := by exact_mod_cast Erdos311Residues.commonDen_ne_zero N
  23. have hfrac : (u : ℚ)/Erdos311Residues.commonDen N=z := by
  24. apply (div_eq_iff hL).mpr
  25. change (∑ j ∈ A, (j : ℚ)⁻¹)=z at hval
  26. simpa [u,hval,mul_comm] using he
  27. have hloc := Erdos311Residues.necessary N u (by rwa [hfrac])
  28. simpa [hfrac] using exclude u hloc (by simpa [hfrac] using hz')
  29. #print axioms exact_of_gap
  30. end Erdos311Certificates