Theorem: WeierstrassCurve.expDegree_cast
File: Mathlib/AlgebraicGeometry/EllipticCurve/DivisionPolynomial/Degree.lean

tactic: rcases n.even_or_odd' with ⟨n, rfl | rfl⟩
state_before: R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : n ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree n) = ↑n ^ 2 - if Even n then 4 else 1
state_after: case intro.inl
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * n)) = ↑(2 * n) ^ 2 - if Even (2 * n) then 4 else 1

case intro.inr
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n + 1 ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * n + 1)) = ↑(2 * n + 1) ^ 2 - if Even (2 * n + 1) then 4 else 1

tactic: rcases n with _ | n
state_before: case intro.inl
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * n)) = ↑(2 * n) ^ 2 - if Even (2 * n) then 4 else 1
state_after: case intro.inl.zero
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
hn : 2 * 0 ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * 0)) = ↑(2 * 0) ^ 2 - if Even (2 * 0) then 4 else 1

case intro.inl.succ
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * (n + 1))) = ↑(2 * (n + 1)) ^ 2 - if Even (2 * (n + 1)) then 4 else 1

tactic: contradiction
state_before: case intro.inl.zero
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
hn : 2 * 0 ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * 0)) = ↑(2 * 0) ^ 2 - if Even (2 * 0) then 4 else 1

case intro.inl.succ
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * (n + 1))) = ↑(2 * (n + 1)) ^ 2 - if Even (2 * (n + 1)) then 4 else 1
state_after: case intro.inl.succ
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * (n + 1))) = ↑(2 * (n + 1)) ^ 2 - if Even (2 * (n + 1)) then 4 else 1

tactic: push_cast [expDegree, show (2 * (n + 1)) ^ 2 = 2 * (2 * n * (n + 2)) + 4 by ring1, even_two_mul,
  Nat.add_sub_cancel, Nat.mul_div_cancel_left _ two_pos]
state_before: case intro.inl.succ
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * (n + 1))) = ↑(2 * (n + 1)) ^ 2 - if Even (2 * (n + 1)) then 4 else 1
state_after: case intro.inl.succ
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ 2 * (2 * ↑n * (↑n + 2)) = (2 * (↑n + 1)) ^ 2 - 4

tactic: ring1
state_before: case intro.inl.succ
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ 2 * (2 * ↑n * (↑n + 2)) = (2 * (↑n + 1)) ^ 2 - 4
state_after: no goals

tactic: ring1
state_before: R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * (n + 1) ≠ 0
⊢ (2 * (n + 1)) ^ 2 = 2 * (2 * n * (n + 2)) + 4
state_after: no goals

tactic: push_cast [expDegree, show (2 * n + 1) ^ 2 = 2 * (2 * n * (n + 1)) + 1 by ring1,
  n.not_even_two_mul_add_one, Nat.add_sub_cancel, Nat.mul_div_cancel_left _ two_pos]
state_before: case intro.inr
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n + 1 ≠ 0
⊢ 2 * ↑(WeierstrassCurve.expDegree (2 * n + 1)) = ↑(2 * n + 1) ^ 2 - if Even (2 * n + 1) then 4 else 1
state_after: case intro.inr
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n + 1 ≠ 0
⊢ 2 * (2 * ↑n * (↑n + 1)) = (2 * ↑n + 1) ^ 2 - 1

tactic: ring1
state_before: case intro.inr
R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n + 1 ≠ 0
⊢ 2 * (2 * ↑n * (↑n + 1)) = (2 * ↑n + 1) ^ 2 - 1
state_after: no goals

tactic: ring1
state_before: R : Type u
inst✝ : CommRing R
W : WeierstrassCurve R
n : ℕ
hn : 2 * n + 1 ≠ 0
⊢ (2 * n + 1) ^ 2 = 2 * (2 * n * (n + 1)) + 1
state_after: no goals