l3lab/ntp-mathlib huggingface dataset:
lemma derivative_addPolynomial_slope {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    derivative (W.addPolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) =
      -((X - C x₁) * (X - C x₂) + (X - C x₁) * (X - C (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)) +
          (X - C x₂) * (X - C (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂))) := by
  rw [addPolynomial_slope h₁ h₂ hxy]
  derivative_simp
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
⊢ -(((1 - 0) * (Y - C x₂) + (Y - C x₁) * (1 - 0)) * (Y - C (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))) +
        (Y - C x₁) * (Y - C x₂) * (1 - 0)) =
    -((Y - C x₁) * (Y - C x₂) + (Y - C x₁) * (Y - C (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))) +
        (Y - C x₂) * (Y - C (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))))

Next tactic:
ring1
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · 

Proof state:
case pos
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
rwa [addY', hx₁, sub_self, mul_zero, zero_add]
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · 

Proof state:
case neg
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · 

Proof state:
case pos
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
by_cases hx : x₁ = x₂
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · 

Proof state:
case pos
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
hx : x₁ = x₂
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
subst hx
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · subst hx
        

Proof state:
case pos
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₁ y₂
hxy : x₁ = x₁ → y₁ ≠ W.negY x₁ y₂
hx₁ : ¬W.addX x₁ x₁ (W.slope x₁ x₁ y₁ y₂) = x₁
hx₂ : W.addX x₁ x₁ (W.slope x₁ x₁ y₁ y₂) = x₁
⊢ W.nonsingular (W.addX x₁ x₁ (W.slope x₁ x₁ y₁ y₂)) (W.addY' x₁ x₁ y₁ (W.slope x₁ x₁ y₁ y₂))

Next tactic:
contradiction
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · subst hx
        contradiction
      · 

Proof state:
case neg
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
hx : ¬x₁ = x₂
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
rwa [addY', ← neg_sub, mul_neg, hx₂, slope_of_Xne hx,
          div_mul_cancel _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · subst hx
        contradiction
      · rwa [addY', ← neg_sub, mul_neg, hx₂, slope_of_Xne hx,
          div_mul_cancel _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]
    · 

Proof state:
case neg
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
⊢ W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY' x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
apply nonsingular_add_of_eval_derivative_ne_zero <| equation_add' h₁.1 h₂.1 hxy
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · subst hx
        contradiction
      · rwa [addY', ← neg_sub, mul_neg, hx₂, slope_of_Xne hx,
          div_mul_cancel _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]
    · apply nonsingular_add_of_eval_derivative_ne_zero <| equation_add' h₁.1 h₂.1 hxy
      

Proof state:
case neg
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
⊢ eval (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (derivative (W.addPolynomial x₁ y₁ (W.slope x₁ x₂ y₁ y₂))) ≠ 0

Next tactic:
rw [derivative_addPolynomial_slope h₁.left h₂.left hxy]
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · subst hx
        contradiction
      · rwa [addY', ← neg_sub, mul_neg, hx₂, slope_of_Xne hx,
          div_mul_cancel _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]
    · apply nonsingular_add_of_eval_derivative_ne_zero <| equation_add' h₁.1 h₂.1 hxy
      rw [derivative_addPolynomial_slope h₁.left h₂.left hxy]
      

Proof state:
case neg
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
⊢ eval (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))
      (-((Y - C x₁) * (Y - C x₂) + (Y - C x₁) * (Y - C (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))) +
          (Y - C x₂) * (Y - C (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))))) ≠
    0

Next tactic:
eval_simp
/-- The addition of two nonsingular affine points in `W` on a sloped line,
before applying the final negation that maps $Y$ to $-Y - a_1X - a_3$, is nonsingular. -/
lemma nonsingular_add' {x₁ x₂ y₁ y₂ : F} (h₁ : W.nonsingular x₁ y₁) (h₂ : W.nonsingular x₂ y₂)
    (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    W.nonsingular (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)
      (W.addY' x₁ x₂ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  by_cases hx₁ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
  · rwa [addY', hx₁, sub_self, mul_zero, zero_add]
  · by_cases hx₂ : W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
    · by_cases hx : x₁ = x₂
      · subst hx
        contradiction
      · rwa [addY', ← neg_sub, mul_neg, hx₂, slope_of_Xne hx,
          div_mul_cancel _ <| sub_ne_zero_of_ne hx, neg_sub, sub_add_cancel]
    · apply nonsingular_add_of_eval_derivative_ne_zero <| equation_add' h₁.1 h₂.1 hxy
      rw [derivative_addPolynomial_slope h₁.left h₂.left hxy]
      eval_simp
      

Proof state:
case neg
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx₁ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₁
hx₂ : ¬W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) = x₂
⊢ -((W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - x₁) * (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - x₂) +
          (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - x₁) *
            (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) +
        (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - x₂) *
          (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂) - W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))) ≠
    0

Next tactic:
simpa only [neg_ne_zero, sub_self, mul_zero, add_zero] using
        mul_ne_zero (sub_ne_zero_of_ne hx₁) (sub_ne_zero_of_ne hx₂)
instance : InvolutiveNeg W.Point :=
  ⟨by 

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
⊢ ∀ (x : Point W), - -x = x

Next tactic:
rintro (_ | _)
instance : InvolutiveNeg W.Point :=
  ⟨by rintro (_ | _) <;> 

Proof state:
case zero
R : Type u
inst✝ : CommRing R
W : Affine R
⊢ - -zero = zero

Next tactic:
simp [zero_def]
instance : InvolutiveNeg W.Point :=
  ⟨by rintro (_ | _) <;> 

Proof state:
case some
R : Type u
inst✝ : CommRing R
W : Affine R
x✝ y✝ : R
h✝ : W.nonsingular x✝ y✝
⊢ - -some h✝ = some h✝

Next tactic:
simp [zero_def]
instance : InvolutiveNeg W.Point :=
  ⟨by rintro (_ | _) <;> simp [zero_def]; 

Proof state:
case some
R : Type u
inst✝ : CommRing R
W : Affine R
x✝ y✝ : R
h✝ : W.nonsingular x✝ y✝
⊢ W.a₃ - (-y✝ - W.a₁ * x✝) - W.a₁ * x✝ - W.a₃ = y✝

Next tactic:
ring1
noncomputable instance instAddZeroClassPoint : AddZeroClass W.Point :=
  ⟨by 

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
⊢ ∀ (a : Point W), 0 + a = a

Next tactic:
rintro (_ | _)
noncomputable instance instAddZeroClassPoint : AddZeroClass W.Point :=
  ⟨by rintro (_ | _) <;> 

Proof state:
case zero
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
⊢ 0 + zero = zero

Next tactic:
rfl
noncomputable instance instAddZeroClassPoint : AddZeroClass W.Point :=
  ⟨by rintro (_ | _) <;> 

Proof state:
case some
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x✝ y✝ : F
h✝ : W.nonsingular x✝ y✝
⊢ 0 + some h✝ = some h✝

Next tactic:
rfl
noncomputable instance instAddZeroClassPoint : AddZeroClass W.Point :=
  ⟨by rintro (_ | _) <;> rfl, by 

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
⊢ ∀ (a : Point W), a + 0 = a

Next tactic:
rintro (_ | _)
noncomputable instance instAddZeroClassPoint : AddZeroClass W.Point :=
  ⟨by rintro (_ | _) <;> rfl, by rintro (_ | _) <;> 

Proof state:
case zero
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
⊢ zero + 0 = zero

Next tactic:
rfl
noncomputable instance instAddZeroClassPoint : AddZeroClass W.Point :=
  ⟨by rintro (_ | _) <;> rfl, by rintro (_ | _) <;> 

Proof state:
case some
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x✝ y✝ : F
h✝ : W.nonsingular x✝ y✝
⊢ some h✝ + 0 = some h✝

Next tactic:
rfl
@[simp]
lemma some_add_some_of_Yeq {x₁ x₂ y₁ y₂ : F} {h₁ : W.nonsingular x₁ y₁} {h₂ : W.nonsingular x₂ y₂}
    (hx : x₁ = x₂) (hy : y₁ = W.negY x₂ y₂) : some h₁ + some h₂ = 0 := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hx : x₁ = x₂
hy : y₁ = W.negY x₂ y₂
⊢ some h₁ + some h₂ = 0

Next tactic:
simp only [← add_def, add, dif_pos hx, dif_pos hy]
@[simp]
lemma some_add_some_of_Yne {x₁ x₂ y₁ y₂ : F} {h₁ : W.nonsingular x₁ y₁} {h₂ : W.nonsingular x₂ y₂}
    (hx : x₁ = x₂) (hy : y₁ ≠ W.negY x₂ y₂) :
    some h₁ + some h₂ = some (nonsingular_add h₁ h₂ fun _ => hy) := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hx : x₁ = x₂
hy : y₁ ≠ W.negY x₂ y₂
⊢ some h₁ + some h₂ =
    some (_ : W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂)))

Next tactic:
simp only [← add_def, add, dif_pos hx, dif_neg hy]
@[simp]
lemma some_add_some_of_Xne {x₁ x₂ y₁ y₂ : F} {h₁ : W.nonsingular x₁ y₁} {h₂ : W.nonsingular x₂ y₂}
    (hx : x₁ ≠ x₂) : some h₁ + some h₂ = some (nonsingular_add h₁ h₂ fun h => (hx h).elim) := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ x₂ y₁ y₂ : F
h₁ : W.nonsingular x₁ y₁
h₂ : W.nonsingular x₂ y₂
hx : x₁ ≠ x₂
⊢ some h₁ + some h₂ =
    some (_ : W.nonsingular (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)) (W.addY x₁ x₂ y₁ (W.slope x₁ x₂ y₁ y₂)))

Next tactic:
simp only [← add_def, add, dif_neg hx]
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  

Proof state:
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
⊢ W.equation x y ↔ (W.baseChange A).toAffine.equation ((algebraMap R A) x) ((algebraMap R A) y)

Next tactic:
simpa only [equation_iff]
    using ⟨fun h => by convert congr_arg (algebraMap R A) h <;> map_simp <;> rfl,
      fun h => by apply NoZeroSMulDivisors.algebraMap_injective R A; map_simp; exact h⟩
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  simpa only [equation_iff]
    using ⟨fun h => by 

Proof state:
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
h : y ^ 2 + W.a₁ * x * y + W.a₃ * y = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆
⊢ (algebraMap R A) y ^ 2 + (W.baseChange A).toAffine.a₁ * (algebraMap R A) x * (algebraMap R A) y +
      (W.baseChange A).toAffine.a₃ * (algebraMap R A) y =
    (algebraMap R A) x ^ 3 + (W.baseChange A).toAffine.a₂ * (algebraMap R A) x ^ 2 +
        (W.baseChange A).toAffine.a₄ * (algebraMap R A) x +
      (W.baseChange A).toAffine.a₆

Next tactic:
convert congr_arg (algebraMap R A) h
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  simpa only [equation_iff]
    using ⟨fun h => by convert congr_arg (algebraMap R A) h <;> 

Proof state:
case h.e'_2
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
h : y ^ 2 + W.a₁ * x * y + W.a₃ * y = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆
⊢ (algebraMap R A) y ^ 2 + (W.baseChange A).toAffine.a₁ * (algebraMap R A) x * (algebraMap R A) y +
      (W.baseChange A).toAffine.a₃ * (algebraMap R A) y =
    (algebraMap R A) (y ^ 2 + W.a₁ * x * y + W.a₃ * y)

Next tactic:
map_simp
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  simpa only [equation_iff]
    using ⟨fun h => by convert congr_arg (algebraMap R A) h <;> 

Proof state:
case h.e'_3
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
h : y ^ 2 + W.a₁ * x * y + W.a₃ * y = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆
⊢ (algebraMap R A) x ^ 3 + (W.baseChange A).toAffine.a₂ * (algebraMap R A) x ^ 2 +
        (W.baseChange A).toAffine.a₄ * (algebraMap R A) x +
      (W.baseChange A).toAffine.a₆ =
    (algebraMap R A) (x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆)

Next tactic:
map_simp
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  simpa only [equation_iff]
    using ⟨fun h => by convert congr_arg (algebraMap R A) h <;> map_simp <;> 

Proof state:
case h.e'_2
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
h : y ^ 2 + W.a₁ * x * y + W.a₃ * y = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆
⊢ (algebraMap R A) y ^ 2 + (W.baseChange A).toAffine.a₁ * (algebraMap R A) x * (algebraMap R A) y +
      (W.baseChange A).toAffine.a₃ * (algebraMap R A) y =
    (algebraMap R A) y ^ 2 + (algebraMap R A) W.a₁ * (algebraMap R A) x * (algebraMap R A) y +
      (algebraMap R A) W.a₃ * (algebraMap R A) y

Next tactic:
rfl
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  simpa only [equation_iff]
    using ⟨fun h => by convert congr_arg (algebraMap R A) h <;> map_simp <;> 

Proof state:
case h.e'_3
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
h : y ^ 2 + W.a₁ * x * y + W.a₃ * y = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆
⊢ (algebraMap R A) x ^ 3 + (W.baseChange A).toAffine.a₂ * (algebraMap R A) x ^ 2 +
        (W.baseChange A).toAffine.a₄ * (algebraMap R A) x +
      (W.baseChange A).toAffine.a₆ =
    (algebraMap R A) x ^ 3 + (algebraMap R A) W.a₂ * (algebraMap R A) x ^ 2 +
        (algebraMap R A) W.a₄ * (algebraMap R A) x +
      (algebraMap R A) W.a₆

Next tactic:
rfl
lemma equation_iff_baseChange [Nontrivial A] [NoZeroSMulDivisors R A] (x y : R) :
    W.equation x y ↔ (W.baseChange A).toAffine.equation (algebraMap R A x) (algebraMap R A y) := by
  simpa only [equation_iff]
    using ⟨fun h => by convert congr_arg (algebraMap R A) h <;> map_simp <;> rfl,
      fun h => by 

Proof state:
R : Type u
inst✝⁸ : CommRing R
W : Affine R
A : Type v
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
B : Type w
inst✝⁵ : CommRing B
inst✝⁴ : Algebra R B
inst✝³ : Algebra A B
inst✝² : IsScalarTower R A B
inst✝¹ : Nontrivial A
inst✝ : NoZeroSMulDivisors R A
x y : R
h :
  (algebraMap R A) y ^ 2 + (W.baseChange A).toAffine.a₁ * (algebraMap R A) x * (algebraMap R A) y +
      (W.baseChange A).toAffine.a₃ * (algebraMap R A) y =
    (algebraMap R A) x ^ 3 + (W.baseChange A).toAffine.a₂ * (algebraMap R A) x ^ 2 +
        (W.baseChange A).toAffine.a₄ * (algebraMap R A) x +
      (W.baseChange A).toAffine.a₆
⊢ y ^ 2 + W.a₁ * x * y + W.a₃ * y = x ^ 3 + W.a₂ * x ^ 2 + W.a₄ * x + W.a₆

Next tactic:
apply NoZeroSMulDivisors.algebraMap_injective R A