Lean / Reader
Lean readerSquarePencil.lean
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.
import SquarePencilDegreeimport Mathlib.RingTheory.EuclideanDomainimport Mathlib.RingTheory.IntegralClosure.IntegrallyClosednamespace SquarePencilopen Polynomial/-- Five independent affine arguments cannot simultaneously be squares if oneargument remains variable and the other four are distinct constants. -/theorem no_five (A B : ℚ[X]) (hB : B ≠ 0)(c : Fin 4 → ℚ) (hc : Function.Injective c) (y : Fin 4 → ℚ[X])(hy : ∀ i, y i ^ 2 = A + C (c i) * B) (z : ℚ[X]) (hz : z^2 = A+X*B) : False := bylet g := GCDMonoid.gcd (y 0) (y 1)have hdiff : c 1 ≠ c 0 := hc.ne (by decide)have hA₀ : g^2 ∣ A+C (c 0)*B := (hy 0) ▸ pow_dvd_pow_of_dvd (gcd_dvd_left (y 0) (y 1)) 2have hA₁ : g^2 ∣ A+C (c 1)*B := (hy 1) ▸ pow_dvd_pow_of_dvd (gcd_dvd_right (y 0) (y 1)) 2obtain ⟨⟨a,ha⟩,b,hb⟩ := common hdiff hA₀ hA₁have hg : g ≠ 0 := by rintro h; exact hB (by simp [hb,h])have hgn : g^2 ≠ 0 := pow_ne_zero 2 hghave hb' : b ≠ 0 := by rintro rfl; simp [hb] at hBhave reduce (q t : ℚ[X]) (he : q^2=A+t*B) :(q/g)^2=a+t*b := byhave hmult : q^2 = g^2*(a+t*b) := by rw [he,ha,hb]; ringhave hdiv : g ∣ q := (IsIntegrallyClosed.pow_dvd_pow_iff (by decide : 2 ≠ 0)).mp ⟨_,hmult⟩have heq := EuclideanDomain.mul_div_cancel' hg hdivchange g*(q/g)=q at heqapply mul_left_cancel₀ hgnrw [←mul_pow,heq,hmult]let Y (i : Fin 4) := y i / ghave hY (i : Fin 4) : (Y i)^2=a+C (c i)*b := reduce _ _ (hy i)have hco : IsCoprime (Y 0) (Y 1) := isCoprime_div_gcd_div_gcd_of_gcd_ne_zero hghave hab : IsCoprime a b := byapply isCoprime_of_dvd _ _ (fun h => hb' h.2)intro d hd _ hda hdbhave H (i : Fin 4) : d ∣ (Y i)^2 := byrw [hY]; exact dvd_add hda (dvd_mul_of_dvd_right hdb _)exact hd ((hco.pow (m:=2) (n:=2)).isUnit_of_dvd' (H 0) (H 1))obtain ⟨hca,hcb⟩ := four_constant hab c hc Y hYhave hlast := reduce _ _ hzhave hnorm : (a+X*b).natDegree=1 := byhave ea := eq_C_of_derivative_eq_zero hcahave eb := eq_C_of_derivative_eq_zero hcbhave hn : b.coeff 0 ≠ 0 := by rintro h; rw [eb,h,map_zero] at hb'; contradictionconv_lhs => rw [ea,eb,mul_comm X]rw [natDegree_add_eq_right_of_natDegree_lt]· exact natDegree_C_mul_X _ hn· rw [natDegree_C,natDegree_C_mul_X _ hn]; decidehave he := congrArg natDegree hlastrw [natDegree_pow,hnorm] at heomega#print axioms no_fiveend SquarePencil