Lean / Reader
Lean reader

SquarePencil.lean

54 lines1 declarationsno sorryimports SquarePencilDegree Mathlib.RingTheory.EuclideanDomain Mathlib.RingTheory.IntegralClosure.IntegrallyClosed

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

  1. import SquarePencilDegree
  2. import Mathlib.RingTheory.EuclideanDomain
  3. import Mathlib.RingTheory.IntegralClosure.IntegrallyClosed
  4. namespace SquarePencil
  5. open Polynomial
  6. /-- Five independent affine arguments cannot simultaneously be squares if one
  7. argument remains variable and the other four are distinct constants. -/
  8. theorem no_five (A B : ℚ[X]) (hB : B ≠ 0)
  9. (c : Fin 4 → ℚ) (hc : Function.Injective c) (y : Fin 4 → ℚ[X])
  10. (hy : ∀ i, y i ^ 2 = A + C (c i) * B) (z : ℚ[X]) (hz : z^2 = A+X*B) : False := by
  11. let g := GCDMonoid.gcd (y 0) (y 1)
  12. have hdiff : c 1 ≠ c 0 := hc.ne (by decide)
  13. have hA₀ : g^2 ∣ A+C (c 0)*B := (hy 0) ▸ pow_dvd_pow_of_dvd (gcd_dvd_left (y 0) (y 1)) 2
  14. have hA₁ : g^2 ∣ A+C (c 1)*B := (hy 1) ▸ pow_dvd_pow_of_dvd (gcd_dvd_right (y 0) (y 1)) 2
  15. obtain ⟨⟨a,ha⟩,b,hb⟩ := common hdiff hA₀ hA₁
  16. have hg : g ≠ 0 := by rintro h; exact hB (by simp [hb,h])
  17. have hgn : g^2 ≠ 0 := pow_ne_zero 2 hg
  18. have hb' : b ≠ 0 := by rintro rfl; simp [hb] at hB
  19. have reduce (q t : ℚ[X]) (he : q^2=A+t*B) :
  20. (q/g)^2=a+t*b := by
  21. have hmult : q^2 = g^2*(a+t*b) := by rw [he,ha,hb]; ring
  22. have hdiv : g ∣ q := (IsIntegrallyClosed.pow_dvd_pow_iff (by decide : 2 ≠ 0)).mp ⟨_,hmult⟩
  23. have heq := EuclideanDomain.mul_div_cancel' hg hdiv
  24. change g*(q/g)=q at heq
  25. apply mul_left_cancel₀ hgn
  26. rw [←mul_pow,heq,hmult]
  27. let Y (i : Fin 4) := y i / g
  28. have hY (i : Fin 4) : (Y i)^2=a+C (c i)*b := reduce _ _ (hy i)
  29. have hco : IsCoprime (Y 0) (Y 1) := isCoprime_div_gcd_div_gcd_of_gcd_ne_zero hg
  30. have hab : IsCoprime a b := by
  31. apply isCoprime_of_dvd _ _ (fun h => hb' h.2)
  32. intro d hd _ hda hdb
  33. have H (i : Fin 4) : d ∣ (Y i)^2 := by
  34. rw [hY]; exact dvd_add hda (dvd_mul_of_dvd_right hdb _)
  35. exact hd ((hco.pow (m:=2) (n:=2)).isUnit_of_dvd' (H 0) (H 1))
  36. obtain ⟨hca,hcb⟩ := four_constant hab c hc Y hY
  37. have hlast := reduce _ _ hz
  38. have hnorm : (a+X*b).natDegree=1 := by
  39. have ea := eq_C_of_derivative_eq_zero hca
  40. have eb := eq_C_of_derivative_eq_zero hcb
  41. have hn : b.coeff 0 ≠ 0 := by rintro h; rw [eb,h,map_zero] at hb'; contradiction
  42. conv_lhs => rw [ea,eb,mul_comm X]
  43. rw [natDegree_add_eq_right_of_natDegree_lt]
  44. · exact natDegree_C_mul_X _ hn
  45. · rw [natDegree_C,natDegree_C_mul_X _ hn]; decide
  46. have he := congrArg natDegree hlast
  47. rw [natDegree_pow,hnorm] at he
  48. omega
  49. #print axioms no_five
  50. end SquarePencil