Theorem: WeierstrassCurve.Ψ_odd
File: Mathlib/AlgebraicGeometry/EllipticCurve/DivisionPolynomial/Basic.lean

tactic: repeat erw [Ψ_ofNat]
state_before: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ W.Ψ (2 * (↑m + 2) + 1) =
    W.Ψ (↑m + 4) * W.Ψ (↑m + 2) ^ 3 - W.Ψ (↑m + 1) * W.Ψ (↑m + 3) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)
state_after: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ (C (W.preΨ' (2 * (m + 2) + 1)) * if Even (2 * (m + 2) + 1) then W.ψ₂ else 1) =
    (C (W.preΨ' (m + 4)) * if Even (m + 4) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 2)) * if Even (m + 2) then W.ψ₂ else 1) ^ 3 -
        (C (W.preΨ' (m + 1)) * if Even (m + 1) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 3)) * if Even (m + 3) then W.ψ₂ else 1) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)

tactic: simp_rw [preΨ'_odd, if_neg (m + 2).not_even_two_mul_add_one, Nat.even_add_one, ite_not]
state_before: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ (C (W.preΨ' (2 * (m + 2) + 1)) * if Even (2 * (m + 2) + 1) then W.ψ₂ else 1) =
    (C (W.preΨ' (m + 4)) * if Even (m + 4) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 2)) * if Even (m + 2) then W.ψ₂ else 1) ^ 3 -
        (C (W.preΨ' (m + 1)) * if Even (m + 1) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 3)) * if Even (m + 3) then W.ψ₂ else 1) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)
state_after: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ C
        ((W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 * if Even m then W.Ψ₂Sq ^ 2 else 1) -
          W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3 * if Even m then 1 else W.Ψ₂Sq ^ 2) *
      1 =
    (C (W.preΨ' (m + 4)) * if Even m then W.ψ₂ else 1) * (C (W.preΨ' (m + 2)) * if Even m then W.ψ₂ else 1) ^ 3 -
        (C (W.preΨ' (m + 1)) * if Even m then 1 else W.ψ₂) * (C (W.preΨ' (m + 3)) * if Even m then 1 else W.ψ₂) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)

tactic: split_ifs <;> C_simp <;> rw [C_Ψ₂Sq] <;> ring1
state_before: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ C
        ((W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 * if Even m then W.Ψ₂Sq ^ 2 else 1) -
          W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3 * if Even m then 1 else W.Ψ₂Sq ^ 2) *
      1 =
    (C (W.preΨ' (m + 4)) * if Even m then W.ψ₂ else 1) * (C (W.preΨ' (m + 2)) * if Even m then W.ψ₂ else 1) ^ 3 -
        (C (W.preΨ' (m + 1)) * if Even m then 1 else W.ψ₂) * (C (W.preΨ' (m + 3)) * if Even m then 1 else W.ψ₂) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)
state_after: no goals

tactic: erw [Ψ_ofNat]
state_before: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ (C (W.preΨ' (2 * (m + 2) + 1)) * if Even (2 * (m + 2) + 1) then W.ψ₂ else 1) =
    (C (W.preΨ' (m + 4)) * if Even (m + 4) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 2)) * if Even (m + 2) then W.ψ₂ else 1) ^ 3 -
        (C (W.preΨ' (m + 1)) * if Even (m + 1) then W.ψ₂ else 1) * W.Ψ (↑m + 3) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)
state_after: R : Type r
S : Type s
inst✝¹ : CommRing R
inst✝ : CommRing S
W : WeierstrassCurve R
m : ℕ
⊢ (C (W.preΨ' (2 * (m + 2) + 1)) * if Even (2 * (m + 2) + 1) then W.ψ₂ else 1) =
    (C (W.preΨ' (m + 4)) * if Even (m + 4) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 2)) * if Even (m + 2) then W.ψ₂ else 1) ^ 3 -
        (C (W.preΨ' (m + 1)) * if Even (m + 1) then W.ψ₂ else 1) *
          (C (W.preΨ' (m + 3)) * if Even (m + 3) then W.ψ₂ else 1) ^ 3 +
      W.toAffine.polynomial * (16 * W.toAffine.polynomial - 8 * W.ψ₂ ^ 2) *
        C (if Even m then W.preΨ' (m + 4) * W.preΨ' (m + 2) ^ 3 else -W.preΨ' (m + 1) * W.preΨ' (m + 3) ^ 3)