Lean / Reader
Lean reader

SquarePencilDegree.lean

66 lines2 declarationsno sorryimports Mathlib.RingTheory.Polynomial.Wronskian Mathlib.RingTheory.Coprime.Lemmas Mathlib.RingTheory.PrincipalIdealDomain Mathlib.Algebra.Polynomial.BigOperators Mathlib.Tactic
  1. import Mathlib.RingTheory.Polynomial.Wronskian
  2. import Mathlib.RingTheory.Coprime.Lemmas
  3. import Mathlib.RingTheory.PrincipalIdealDomain
  4. import Mathlib.Algebra.Polynomial.BigOperators
  5. import Mathlib.Tactic
  6. namespace SquarePencil
  7. open Polynomial
  8. theorem common {A B D : ℚ[X]} {x y : ℚ} (hne : y ≠ x)
  9. (hx : D ∣ A+C x*B) (hy : D ∣ A+C y*B) : D ∣ A ∧ D ∣ B := by
  10. have h := dvd_sub hy hx
  11. have hf : (A+C y*B)-(A+C x*B) = C (y-x)*B := by rw [map_sub]; ring
  12. rw [hf] at h
  13. have hu : IsUnit (C (y-x) : ℚ[X]) := isUnit_C.mpr (sub_ne_zero.mpr hne).isUnit
  14. have hB := hu.dvd_mul_left.mp h
  15. refine ⟨?_,hB⟩
  16. simpa using dvd_sub hx (dvd_mul_of_dvd_right hB (C x))
  17. theorem four_constant {A B : ℚ[X]} (hAB : IsCoprime A B)
  18. (c : Fin 4 → ℚ) (hc : Function.Injective c) (y : Fin 4 → ℚ[X])
  19. (hy : ∀ i, y i^2=A+C (c i)*B) : A.derivative=0 ∧ B.derivative=0 := by
  20. apply hAB.wronskian_eq_zero_iff.mp
  21. by_contra hw
  22. let W := wronskian A B
  23. have we (i j : Fin 4) : wronskian (y i^2) (y j^2) = C (c j-c i)*W := by
  24. rw [hy,hy]
  25. simp [W,wronskian,derivative_add,derivative_mul] <;> ring
  26. have nz (i : Fin 4) : y i ≠ 0 := by
  27. intro h
  28. have he := congrArg (fun q : ℚ[X] => wronskian q B) (hy i)
  29. simp [h,wronskian,derivative_mul] at he
  30. apply hw; unfold wronskian
  31. linear_combination -he
  32. have co : Pairwise (fun i j => IsCoprime (y i) (y j)) := by
  33. intro i j hij
  34. apply isCoprime_of_dvd _ _ (fun h => nz i h.1)
  35. intro d hd _ hi hj
  36. have hi' := dvd_pow hi (by decide : 2 ≠ 0)
  37. have hj' := dvd_pow hj (by decide : 2 ≠ 0)
  38. rw [hy] at hi' hj'
  39. obtain ⟨hda,hdb⟩ := common (hc.ne hij.symm) hi' hj'
  40. exact hd (hAB.isUnit_of_dvd' hda hdb)
  41. have hd (i : Fin 4) : y i ∣ W := by
  42. have h : W = wronskian (y i^2) B := by
  43. rw [hy]; simp [W,wronskian,derivative_mul]; ring
  44. rw [h,wronskian,derivative_pow]
  45. use y i*derivative B-C 2*(y i).derivative*B
  46. simp; ring
  47. have hp := natDegree_le_of_dvd (Fintype.prod_dvd_of_coprime co hd) hw
  48. rw [Polynomial.natDegree_prod _ _ (fun i _ => nz i)] at hp
  49. simp only [Fin.sum_univ_four] at hp
  50. have upper (i j : Fin 4) (hij : i ≠ j) :
  51. W.natDegree < 2*(y i).natDegree+2*(y j).natDegree := by
  52. have hne : c j-c i ≠ 0 := sub_ne_zero.mpr (hc.ne hij.symm)
  53. have h : wronskian (y i^2) (y j^2) ≠ 0 := by
  54. rw [we]; exact mul_ne_zero (C_ne_zero.mpr hne) hw
  55. have hh := natDegree_wronskian_lt_add h
  56. rw [we,natDegree_C_mul hne,natDegree_pow,natDegree_pow] at hh
  57. simpa [Nat.mul_comm] using hh
  58. have he := upper 0 1 (by decide)
  59. have hf := upper 2 3 (by decide)
  60. change _ ≤ W.natDegree at hp
  61. omega
  62. end SquarePencil