l3lab/ntp-mathlib huggingface dataset:
theorem smul_eq_map [MulSemiringAction M R] (m : M) :
    HSMul.hSMul m = map (MulSemiringAction.toRingHom M R m) := by
  suffices DistribMulAction.toAddMonoidHom R[X] m =
      (mapRingHom (MulSemiringAction.toRingHom M R m)).toAddMonoidHom by
    ext1 r
    exact FunLike.congr_fun this r
  ext n r : 2
  change m • monomial n r = map (MulSemiringAction.toRingHom M R m) (monomial n r)
  

Proof state:
case h.h
M : Type u_1
inst✝² : Monoid M
R : Type u_2
inst✝¹ : Semiring R
inst✝ : MulSemiringAction M R
m : M
n : ℕ
r : R
⊢ m • (monomial n) r = map (MulSemiringAction.toRingHom M R m) ((monomial n) r)

Next tactic:
rw [Polynomial.map_monomial, Polynomial.smul_monomial, MulSemiringAction.toRingHom_apply]
theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m • f).eval (m • x) = m • f.eval x :=
  Polynomial.induction_on f (fun r ↦ by 

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
R : Type u_2
inst✝³ : Semiring R
inst✝² : MulSemiringAction M R
S : Type u_3
inst✝¹ : CommSemiring S
inst✝ : MulSemiringAction M S
m : M
f : S[X]
x r : S
⊢ eval (m • x) (m • C r) = m • eval x (C r)

Next tactic:
rw [smul_C, eval_C, eval_C]
theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m • f).eval (m • x) = m • f.eval x :=
  Polynomial.induction_on f (fun r ↦ by rw [smul_C, eval_C, eval_C])
    (fun f g ihf ihg ↦ by 

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
R : Type u_2
inst✝³ : Semiring R
inst✝² : MulSemiringAction M R
S : Type u_3
inst✝¹ : CommSemiring S
inst✝ : MulSemiringAction M S
m : M
f✝ : S[X]
x : S
f g : S[X]
ihf : eval (m • x) (m • f) = m • eval x f
ihg : eval (m • x) (m • g) = m • eval x g
⊢ eval (m • x) (m • (f + g)) = m • eval x (f + g)

Next tactic:
rw [smul_add, eval_add, ihf, ihg, eval_add, smul_add]
theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m • f).eval (m • x) = m • f.eval x :=
  Polynomial.induction_on f (fun r ↦ by rw [smul_C, eval_C, eval_C])
    (fun f g ihf ihg ↦ by rw [smul_add, eval_add, ihf, ihg, eval_add, smul_add]) fun n r _ ↦ by
    

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
R : Type u_2
inst✝³ : Semiring R
inst✝² : MulSemiringAction M R
S : Type u_3
inst✝¹ : CommSemiring S
inst✝ : MulSemiringAction M S
m : M
f : S[X]
x : S
n : ℕ
r : S
x✝ : eval (m • x) (m • (C r * X ^ n)) = m • eval x (C r * X ^ n)
⊢ eval (m • x) (m • (C r * X ^ (n + 1))) = m • eval x (C r * X ^ (n + 1))

Next tactic:
rw [smul_mul', smul_pow', smul_C, smul_X, eval_mul, eval_C, eval_pow, eval_X, eval_mul, eval_C,
      eval_pow, eval_X, smul_mul', smul_pow']
theorem eval_smul' [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) :
    f.eval (g • x) = g • (g⁻¹ • f).eval x := by
  

Proof state:
M : Type u_1
inst✝⁶ : Monoid M
R : Type u_2
inst✝⁵ : Semiring R
inst✝⁴ : MulSemiringAction M R
S : Type u_3
inst✝³ : CommSemiring S
inst✝² : MulSemiringAction M S
G : Type u_4
inst✝¹ : Group G
inst✝ : MulSemiringAction G S
g : G
f : S[X]
x : S
⊢ eval (g • x) f = g • eval x (g⁻¹ • f)

Next tactic:
rw [← smul_eval_smul, smul_inv_smul]
theorem smul_eval [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) :
    (g • f).eval x = g • f.eval (g⁻¹ • x) := by
  

Proof state:
M : Type u_1
inst✝⁶ : Monoid M
R : Type u_2
inst✝⁵ : Semiring R
inst✝⁴ : MulSemiringAction M R
S : Type u_3
inst✝³ : CommSemiring S
inst✝² : MulSemiringAction M S
G : Type u_4
inst✝¹ : Group G
inst✝ : MulSemiringAction G S
g : G
f : S[X]
x : S
⊢ eval x (g • f) = g • eval (g⁻¹ • x) f

Next tactic:
rw [← smul_eval_smul, smul_inv_smul]
theorem prodXSubSMul.eval (x : R) : (prodXSubSMul G R x).eval x = 0 :=
  letI := Classical.decEq R
  (map_prod ((Polynomial.aeval x).toRingHom.toMonoidHom : R[X] →* R) _ _).trans <|
    Finset.prod_eq_zero (Finset.mem_univ <| QuotientGroup.mk 1) <| by 

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
G : Type u_2
inst✝³ : Group G
inst✝² : Fintype G
R : Type u_3
inst✝¹ : CommRing R
inst✝ : MulSemiringAction G R
x : R
this : DecidableEq R := Classical.decEq R
⊢ ↑↑(aeval x) (X - C (ofQuotientStabilizer G x ↑1)) = 0

Next tactic:
simp
theorem prodXSubSMul.smul (x : R) (g : G) : g • prodXSubSMul G R x = prodXSubSMul G R x :=
  letI := Classical.decEq R
  Finset.smul_prod.trans <|
    Fintype.prod_bijective _ (MulAction.bijective g) _ _ fun g' ↦ by
      

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
G : Type u_2
inst✝³ : Group G
inst✝² : Fintype G
R : Type u_3
inst✝¹ : CommRing R
inst✝ : MulSemiringAction G R
x : R
g : G
this : DecidableEq R := Classical.decEq R
g' : G ⧸ stabilizer G x
⊢ g • (X - C (ofQuotientStabilizer G x g')) = X - C (ofQuotientStabilizer G x (g • g'))

Next tactic:
rw [ofQuotientStabilizer_smul, smul_sub, Polynomial.smul_X, Polynomial.smul_C]
theorem prodXSubSMul.coeff (x : R) (g : G) (n : ℕ) :
    g • (prodXSubSMul G R x).coeff n = (prodXSubSMul G R x).coeff n := by
  

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
G : Type u_2
inst✝³ : Group G
inst✝² : Fintype G
R : Type u_3
inst✝¹ : CommRing R
inst✝ : MulSemiringAction G R
x : R
g : G
n : ℕ
⊢ g • Polynomial.coeff (prodXSubSMul G R x) n = Polynomial.coeff (prodXSubSMul G R x) n

Next tactic:
rw [← Polynomial.coeff_smul, prodXSubSMul.smul]
/-- An equivariant map induces an equivariant map on polynomials. -/
protected noncomputable def polynomial (g : P →+*[M] Q) : P[X] →+*[M] Q[X] where
  toFun := map g
  map_smul' m p :=
    Polynomial.induction_on p
      (fun b ↦ by 

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
P : Type u_2
inst✝³ : CommSemiring P
inst✝² : MulSemiringAction M P
Q : Type u_3
inst✝¹ : CommSemiring Q
inst✝ : MulSemiringAction M Q
g : P →+*[M] Q
m : M
p : P[X]
b : P
⊢ map (↑g) (m • C b) = m • map (↑g) (C b)

Next tactic:
rw [smul_C, map_C, coe_fn_coe, g.map_smul, map_C, coe_fn_coe, smul_C]
/-- An equivariant map induces an equivariant map on polynomials. -/
protected noncomputable def polynomial (g : P →+*[M] Q) : P[X] →+*[M] Q[X] where
  toFun := map g
  map_smul' m p :=
    Polynomial.induction_on p
      (fun b ↦ by rw [smul_C, map_C, coe_fn_coe, g.map_smul, map_C, coe_fn_coe, smul_C])
      (fun p q ihp ihq ↦ by
        

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
P : Type u_2
inst✝³ : CommSemiring P
inst✝² : MulSemiringAction M P
Q : Type u_3
inst✝¹ : CommSemiring Q
inst✝ : MulSemiringAction M Q
g : P →+*[M] Q
m : M
p✝ p q : P[X]
ihp : map (↑g) (m • p) = m • map (↑g) p
ihq : map (↑g) (m • q) = m • map (↑g) q
⊢ map (↑g) (m • (p + q)) = m • map (↑g) (p + q)

Next tactic:
rw [smul_add, Polynomial.map_add, ihp, ihq, Polynomial.map_add, smul_add]
/-- An equivariant map induces an equivariant map on polynomials. -/
protected noncomputable def polynomial (g : P →+*[M] Q) : P[X] →+*[M] Q[X] where
  toFun := map g
  map_smul' m p :=
    Polynomial.induction_on p
      (fun b ↦ by rw [smul_C, map_C, coe_fn_coe, g.map_smul, map_C, coe_fn_coe, smul_C])
      (fun p q ihp ihq ↦ by
        rw [smul_add, Polynomial.map_add, ihp, ihq, Polynomial.map_add, smul_add])
      fun n b _ ↦ by
      

Proof state:
M : Type u_1
inst✝⁴ : Monoid M
P : Type u_2
inst✝³ : CommSemiring P
inst✝² : MulSemiringAction M P
Q : Type u_3
inst✝¹ : CommSemiring Q
inst✝ : MulSemiringAction M Q
g : P →+*[M] Q
m : M
p : P[X]
n : ℕ
b : P
x✝ : map (↑g) (m • (C b * X ^ n)) = m • map (↑g) (C b * X ^ n)
⊢ map (↑g) (m • (C b * X ^ (n + 1))) = m • map (↑g) (C b * X ^ (n + 1))

Next tactic:
rw [smul_mul', smul_C, smul_pow', smul_X, Polynomial.map_mul, map_C, Polynomial.map_pow,
        map_X, coe_fn_coe, g.map_smul, Polynomial.map_mul, map_C, Polynomial.map_pow, map_X,
        smul_mul', smul_C, smul_pow', smul_X, coe_fn_coe]
instance instIsDomainCoordinateRing [IsDomain R] [NormalizedGCDMonoid R] :
    IsDomain W.CoordinateRing :=
  (Quotient.isDomain_iff_prime _).mpr <| by
    

Proof state:
R : Type u
inst✝² : CommRing R
W : Affine R
inst✝¹ : IsDomain R
inst✝ : NormalizedGCDMonoid R
⊢ IsPrime (span {W.polynomial})

Next tactic:
simpa only [span_singleton_prime W.polynomial_ne_zero, ← GCDMonoid.irreducible_iff_prime]
      using W.irreducible_polynomial
instance instIsDomainCoordinateRing_of_Field {F : Type u} [Field F] (W : Affine F) :
    IsDomain W.CoordinateRing := by
  

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
⊢ IsDomain W.CoordinateRing

Next tactic:
classical exact instIsDomainCoordinateRing W
instance instIsDomainCoordinateRing_of_Field {F : Type u} [Field F] (W : Affine F) :
    IsDomain W.CoordinateRing := by
  classical 

Proof state:
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
⊢ IsDomain W.CoordinateRing

Next tactic:
exact instIsDomainCoordinateRing W
lemma XClass_ne_zero [Nontrivial R] (x : R) : XClass W x ≠ 0 :=
  AdjoinRoot.mk_ne_zero_of_natDegree_lt W.monic_polynomial (C_ne_zero.mpr <| X_sub_C_ne_zero x) <|
    by 

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
x : R
⊢ natDegree (C (Y - C x)) < natDegree W.polynomial

Next tactic:
rw [natDegree_polynomial, natDegree_C]
lemma XClass_ne_zero [Nontrivial R] (x : R) : XClass W x ≠ 0 :=
  AdjoinRoot.mk_ne_zero_of_natDegree_lt W.monic_polynomial (C_ne_zero.mpr <| X_sub_C_ne_zero x) <|
    by rw [natDegree_polynomial, natDegree_C]; 

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
x : R
⊢ 0 < 2

Next tactic:
norm_num1
lemma YClass_ne_zero [Nontrivial R] (y : R[X]) : YClass W y ≠ 0 :=
  AdjoinRoot.mk_ne_zero_of_natDegree_lt W.monic_polynomial (X_sub_C_ne_zero y) <|
    by 

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
y : R[X]
⊢ natDegree (Y - C y) < natDegree W.polynomial

Next tactic:
rw [natDegree_polynomial, natDegree_X_sub_C]
lemma YClass_ne_zero [Nontrivial R] (y : R[X]) : YClass W y ≠ 0 :=
  AdjoinRoot.mk_ne_zero_of_natDegree_lt W.monic_polynomial (X_sub_C_ne_zero y) <|
    by rw [natDegree_polynomial, natDegree_X_sub_C]; 

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : Nontrivial R
y : R[X]
⊢ 1 < 2

Next tactic:
norm_num1
lemma C_addPolynomial (x y L : R) : mk W (C (W.addPolynomial x y L)) =
    mk W ((Y - C (linePolynomial x y L)) * (W.negPolynomial - C (linePolynomial x y L))) :=
  AdjoinRoot.mk_eq_mk.mpr ⟨1, by 

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x y L : R
⊢ C (W.addPolynomial x y L) - (Y - C (x.linePolynomial y L)) * (W.negPolynomial - C (x.linePolynomial y L)) =
    W.polynomial * 1

Next tactic:
rw [W.C_addPolynomial, add_sub_cancel', mul_one]
lemma XYIdeal_eq₁ (x y L : R) : XYIdeal W x (C y) = XYIdeal W x (linePolynomial x y L) := by
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x y L : R
⊢ XYIdeal W x (C y) = XYIdeal W x (x.linePolynomial y L)

Next tactic:
simp only [XYIdeal, XClass, YClass, linePolynomial]
lemma XYIdeal_eq₁ (x y L : R) : XYIdeal W x (C y) = XYIdeal W x (linePolynomial x y L) := by
  simp only [XYIdeal, XClass, YClass, linePolynomial]
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x y L : R
⊢ span {(mk W) (C (Y - C x)), (mk W) (Y - C (C y))} =
    span {(mk W) (C (Y - C x)), (mk W) (Y - C (C L * (Y - C x) + C y))}

Next tactic:
rw [← span_pair_add_mul_right <| mk W <| C <| C <| -L, ← _root_.map_mul, ← map_add]
lemma XYIdeal_eq₁ (x y L : R) : XYIdeal W x (C y) = XYIdeal W x (linePolynomial x y L) := by
  simp only [XYIdeal, XClass, YClass, linePolynomial]
  rw [← span_pair_add_mul_right <| mk W <| C <| C <| -L, ← _root_.map_mul, ← map_add]
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x y L : R
⊢ span {(mk W) (C (Y - C x)), (mk W) (Y - C (C y) + C (Y - C x) * C (C (-L)))} =
    span {(mk W) (C (Y - C x)), (mk W) (Y - C (C L * (Y - C x) + C y))}

Next tactic:
apply congr_arg (_ ∘ _ ∘ _ ∘ _)
lemma XYIdeal_eq₁ (x y L : R) : XYIdeal W x (C y) = XYIdeal W x (linePolynomial x y L) := by
  simp only [XYIdeal, XClass, YClass, linePolynomial]
  rw [← span_pair_add_mul_right <| mk W <| C <| C <| -L, ← _root_.map_mul, ← map_add]
  apply congr_arg (_ ∘ _ ∘ _ ∘ _)
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x y L : R
⊢ Y - C (C y) + C (Y - C x) * C (C (-L)) = Y - C (C L * (Y - C x) + C y)

Next tactic:
C_simp
lemma XYIdeal_eq₁ (x y L : R) : XYIdeal W x (C y) = XYIdeal W x (linePolynomial x y L) := by
  simp only [XYIdeal, XClass, YClass, linePolynomial]
  rw [← span_pair_add_mul_right <| mk W <| C <| C <| -L, ← _root_.map_mul, ← map_add]
  apply congr_arg (_ ∘ _ ∘ _ ∘ _)
  C_simp
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x y L : R
⊢ Y - C (C y) + (C Y - C (C x)) * -C (C L) = Y - (C (C L) * (C Y - C (C x)) + C (C y))

Next tactic:
ring1
lemma XYIdeal_add_eq (x₁ x₂ y₁ L : R) : XYIdeal W (W.addX x₁ x₂ L) (C <| W.addY x₁ x₂ y₁ L) =
    span {mk W <| W.negPolynomial - C (linePolynomial x₁ y₁ L)} ⊔ XIdeal W (W.addX x₁ x₂ L) := by
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x₁ x₂ y₁ L : R
⊢ XYIdeal W (W.addX x₁ x₂ L) (C (W.addY x₁ x₂ y₁ L)) =
    span {(mk W) (W.negPolynomial - C (x₁.linePolynomial y₁ L))} ⊔ XIdeal W (W.addX x₁ x₂ L)

Next tactic:
simp only [XYIdeal, XIdeal, XClass, YClass, addY, addY', negY, negPolynomial, linePolynomial]
lemma XYIdeal_add_eq (x₁ x₂ y₁ L : R) : XYIdeal W (W.addX x₁ x₂ L) (C <| W.addY x₁ x₂ y₁ L) =
    span {mk W <| W.negPolynomial - C (linePolynomial x₁ y₁ L)} ⊔ XIdeal W (W.addX x₁ x₂ L) := by
  simp only [XYIdeal, XIdeal, XClass, YClass, addY, addY', negY, negPolynomial, linePolynomial]
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x₁ x₂ y₁ L : R
⊢ span
      {(mk W) (C (Y - C (W.addX x₁ x₂ L))),
        (mk W) (Y - C (C (-(L * (W.addX x₁ x₂ L - x₁) + y₁) - W.a₁ * W.addX x₁ x₂ L - W.a₃)))} =
    span {(mk W) (-Y - C (C W.a₁ * Y + C W.a₃) - C (C L * (Y - C x₁) + C y₁))} ⊔
      span {(mk W) (C (Y - C (W.addX x₁ x₂ L)))}

Next tactic:
rw [sub_sub <| -Y, neg_sub_left Y, map_neg, span_singleton_neg, sup_comm, ← span_insert,
    ← span_pair_add_mul_right <| mk W <| C <| C <| W.a₁ + L, ← _root_.map_mul, ← map_add]
lemma XYIdeal_add_eq (x₁ x₂ y₁ L : R) : XYIdeal W (W.addX x₁ x₂ L) (C <| W.addY x₁ x₂ y₁ L) =
    span {mk W <| W.negPolynomial - C (linePolynomial x₁ y₁ L)} ⊔ XIdeal W (W.addX x₁ x₂ L) := by
  simp only [XYIdeal, XIdeal, XClass, YClass, addY, addY', negY, negPolynomial, linePolynomial]
  rw [sub_sub <| -Y, neg_sub_left Y, map_neg, span_singleton_neg, sup_comm, ← span_insert,
    ← span_pair_add_mul_right <| mk W <| C <| C <| W.a₁ + L, ← _root_.map_mul, ← map_add]
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x₁ x₂ y₁ L : R
⊢ span
      {(mk W) (C (Y - C (W.addX x₁ x₂ L))),
        (mk W)
          (Y - C (C (-(L * (W.addX x₁ x₂ L - x₁) + y₁) - W.a₁ * W.addX x₁ x₂ L - W.a₃)) +
            C (Y - C (W.addX x₁ x₂ L)) * C (C (W.a₁ + L)))} =
    span {(mk W) (C (Y - C (W.addX x₁ x₂ L))), (mk W) (C (C W.a₁ * Y + C W.a₃) + C (C L * (Y - C x₁) + C y₁) + Y)}

Next tactic:
apply congr_arg (_ ∘ _ ∘ _ ∘ _)
lemma XYIdeal_add_eq (x₁ x₂ y₁ L : R) : XYIdeal W (W.addX x₁ x₂ L) (C <| W.addY x₁ x₂ y₁ L) =
    span {mk W <| W.negPolynomial - C (linePolynomial x₁ y₁ L)} ⊔ XIdeal W (W.addX x₁ x₂ L) := by
  simp only [XYIdeal, XIdeal, XClass, YClass, addY, addY', negY, negPolynomial, linePolynomial]
  rw [sub_sub <| -Y, neg_sub_left Y, map_neg, span_singleton_neg, sup_comm, ← span_insert,
    ← span_pair_add_mul_right <| mk W <| C <| C <| W.a₁ + L, ← _root_.map_mul, ← map_add]
  apply congr_arg (_ ∘ _ ∘ _ ∘ _)
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x₁ x₂ y₁ L : R
⊢ Y - C (C (-(L * (W.addX x₁ x₂ L - x₁) + y₁) - W.a₁ * W.addX x₁ x₂ L - W.a₃)) +
      C (Y - C (W.addX x₁ x₂ L)) * C (C (W.a₁ + L)) =
    C (C W.a₁ * Y + C W.a₃) + C (C L * (Y - C x₁) + C y₁) + Y

Next tactic:
C_simp
lemma XYIdeal_add_eq (x₁ x₂ y₁ L : R) : XYIdeal W (W.addX x₁ x₂ L) (C <| W.addY x₁ x₂ y₁ L) =
    span {mk W <| W.negPolynomial - C (linePolynomial x₁ y₁ L)} ⊔ XIdeal W (W.addX x₁ x₂ L) := by
  simp only [XYIdeal, XIdeal, XClass, YClass, addY, addY', negY, negPolynomial, linePolynomial]
  rw [sub_sub <| -Y, neg_sub_left Y, map_neg, span_singleton_neg, sup_comm, ← span_insert,
    ← span_pair_add_mul_right <| mk W <| C <| C <| W.a₁ + L, ← _root_.map_mul, ← map_add]
  apply congr_arg (_ ∘ _ ∘ _ ∘ _)
  C_simp
  

Proof state:
R : Type u
inst✝ : CommRing R
W : Affine R
x₁ x₂ y₁ L : R
⊢ Y - (-(C (C L) * (C (C (W.addX x₁ x₂ L)) - C (C x₁)) + C (C y₁)) - C (C W.a₁) * C (C (W.addX x₁ x₂ L)) - C (C W.a₃)) +
      (C Y - C (C (W.addX x₁ x₂ L))) * (C (C W.a₁) + C (C L)) =
    C (C W.a₁) * C Y + C (C W.a₃) + (C (C L) * (C Y - C (C x₁)) + C (C y₁)) + Y

Next tactic:
ring1
lemma C_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₂) : mk W (C <| W.addPolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) =
      -(XClass W x₁ * XClass W x₂ * XClass W (W.addX x₁ x₂ <| 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.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
⊢ (mk W) (C (W.addPolynomial x₁ y₁ (W.slope x₁ x₂ y₁ y₂))) =
    -(XClass W x₁ * XClass W x₂ * XClass W (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)))

Next tactic:
simp only [addPolynomial_slope h₁ h₂ hxy, C_neg, mk, map_neg, neg_inj, _root_.map_mul]
lemma C_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₂) : mk W (C <| W.addPolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) =
      -(XClass W x₁ * XClass W x₂ * XClass W (W.addX x₁ x₂ <| W.slope x₁ x₂ y₁ y₂)) := by
  simp only [addPolynomial_slope h₁ h₂ hxy, C_neg, mk, map_neg, neg_inj, _root_.map_mul]
  

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₂
⊢ (AdjoinRoot.mk W.polynomial) (C (Y - C x₁)) * (AdjoinRoot.mk W.polynomial) (C (Y - C x₂)) *
      (AdjoinRoot.mk W.polynomial) (C (Y - C (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂)))) =
    XClass W x₁ * XClass W x₂ * XClass W (W.addX x₁ x₂ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
rfl
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial 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.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
⊢ XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    by_cases hx : x₁ = x₂
    · rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
      field_simp [linePolynomial, sub_ne_zero_of_ne (hxy rfl)]
    · field_simp [linePolynomial, slope_of_Xne hx, sub_ne_zero_of_ne hx]
      ring1
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := 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.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
⊢ y₂ = eval x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
by_cases hx : x₁ = x₂
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    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.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx : x₁ = x₂
⊢ y₂ = eval x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    by_cases hx : x₁ = x₂
    · rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
      

Proof state:
case pos
R : Type u
inst✝¹ : CommRing R
W✝ : Affine R
F : Type u
inst✝ : Field F
W : Affine F
x₁ y₁ : F
h₁ h₂ : W.equation x₁ y₁
hxy : x₁ = x₁ → y₁ ≠ W.negY x₁ y₁
⊢ y₁ = eval x₁ (x₁.linePolynomial y₁ (W.slope x₁ x₁ y₁ y₁))

Next tactic:
field_simp [linePolynomial, sub_ne_zero_of_ne (hxy rfl)]
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    by_cases hx : x₁ = x₂
    · rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
      field_simp [linePolynomial, sub_ne_zero_of_ne (hxy rfl)]
    · 

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.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx : ¬x₁ = x₂
⊢ y₂ = eval x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
field_simp [linePolynomial, slope_of_Xne hx, sub_ne_zero_of_ne hx]
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    by_cases hx : x₁ = x₂
    · rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
      field_simp [linePolynomial, sub_ne_zero_of_ne (hxy rfl)]
    · field_simp [linePolynomial, slope_of_Xne hx, sub_ne_zero_of_ne hx]
      

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.equation x₁ y₁
h₂ : W.equation x₂ y₂
hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂
hx : ¬x₁ = x₂
⊢ y₂ * (x₁ - x₂) = (y₁ - y₂) * (x₂ - x₁) + y₁ * (x₁ - x₂)

Next tactic:
ring1
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    by_cases hx : x₁ = x₂
    · rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
      field_simp [linePolynomial, sub_ne_zero_of_ne (hxy rfl)]
    · field_simp [linePolynomial, slope_of_Xne hx, sub_ne_zero_of_ne hx]
      ring1
  

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₂
hy₂ : y₂ = eval x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))
⊢ XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
nth_rw 1 [hy₂]
lemma XYIdeal_eq₂ {x₁ x₂ y₁ y₂ : F} (h₁ : W.equation x₁ y₁)
    (h₂ : W.equation x₂ y₂) (hxy : x₁ = x₂ → y₁ ≠ W.negY x₂ y₂) :
    XYIdeal W x₂ (C y₂) = XYIdeal W x₂ (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂) := by
  have hy₂ : y₂ = (linePolynomial x₁ y₁ <| W.slope x₁ x₂ y₁ y₂).eval x₂ := by
    by_cases hx : x₁ = x₂
    · rcases hx, Yeq_of_Yne h₁ h₂ hx <| hxy hx with ⟨rfl, rfl⟩
      field_simp [linePolynomial, sub_ne_zero_of_ne (hxy rfl)]
    · field_simp [linePolynomial, slope_of_Xne hx, sub_ne_zero_of_ne hx]
      ring1
  nth_rw 1 [hy₂]
  

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₂
hy₂ : y₂ = eval x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))
⊢ XYIdeal W x₂ (C (eval x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂)))) =
    XYIdeal W x₂ (x₁.linePolynomial y₁ (W.slope x₁ x₂ y₁ y₂))

Next tactic:
simp only [XYIdeal, XClass, YClass, linePolynomial]