l3lab/ntp-mathlib huggingface dataset:
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · 

Proof state:
case neg.some.none
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • degree q + 3
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + degree q + 1
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
hq' : degree q = none
⊢ degree (p ^ 2 - p * q * (C W.a₁ * Y + C W.a₃) - q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) =
    max (2 • some dp) (2 • none + 3)

Next tactic:
exact (hq hq').elim
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · 

Proof state:
case neg.some.some
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • degree q + 3
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + degree q + 1
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hq' : degree q = some dq
⊢ degree (p ^ 2 - p * q * (C W.a₁ * Y + C W.a₃) - q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) =
    max (2 • some dp) (2 • some dq + 3)

Next tactic:
rw [hq'] at hdpq hdq
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          

Proof state:
case neg.some.some
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
⊢ degree (p ^ 2 - p * q * (C W.a₁ * Y + C W.a₃) - q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) =
    max (2 • some dp) (2 • some dq + 3)

Next tactic:
rcases le_or_lt dp (dq + 1) with hpq | hpq
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · 

Proof state:
case neg.some.some.inl
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ degree (p ^ 2 - p * q * (C W.a₁ * Y + C W.a₃) - q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) =
    max (2 • some dp) (2 • some dq + 3)

Next tactic:
convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> 

Proof state:
case h.e'_3.h.e'_4
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ 2 • some dq + 3 = degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆))

Next tactic:
rw [hdq]
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> 

Proof state:
case neg.some.some.inl.convert_2
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ 2 • some dp < degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆))

Next tactic:
rw [hdq]
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> 

Proof state:
case neg.some.some.inl.convert_3
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ some dp + some dq + 1 < degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆))

Next tactic:
rw [hdq]
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> 

Proof state:
case neg.some.some.inl.convert_5
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ 2 • some dp < degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆))

Next tactic:
rw [hdq]
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> rw [hdq] <;>
                

Proof state:
case neg.some.some.inl.convert_2
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ 2 • some dp < 2 • some dq + 3

Next tactic:
exact WithBot.coe_lt_coe.mpr <| by linarith only [hpq]
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> rw [hdq] <;>
                exact WithBot.coe_lt_coe.mpr <| by 

Proof state:
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ (fun x x_1 => x + x_1) dp ((fun x x_1 => x + x_1) dp 0) <
    (fun x x_1 => x + x_1) ((fun x x_1 => x + x_1) dq ((fun x x_1 => x + x_1) dq 0)) ↑3

Next tactic:
linarith only [hpq]
lemma degree_norm_smul_basis [IsDomain R] (p q : R[X]) :
    (Algebra.norm R[X] <| p • (1 : W.CoordinateRing) + q • mk W Y).degree =
      max (2 • p.degree) (2 • q.degree + 3) := by
  have hdp : (p ^ 2).degree = 2 • p.degree := degree_pow p 2
  have hdpq : (p * q * (C W.a₁ * X + C W.a₃)).degree ≤ p.degree + q.degree + 1 := by
    simpa only [degree_mul] using add_le_add_left degree_linear_le (p.degree + q.degree)
  have hdq :
      (q ^ 2 * (X ^ 3 + C W.a₂ * X ^ 2 + C W.a₄ * X + C W.a₆)).degree = 2 • q.degree + 3 := by
    rw [degree_mul, degree_pow, ← one_mul <| X ^ 3, ← C_1, degree_cubic <| one_ne_zero' R]
  rw [norm_smul_basis]
  by_cases hp : p = 0
  · simpa only [hp, hdq, neg_zero, zero_sub, zero_mul, zero_pow zero_lt_two, degree_neg] using
      (max_bot_left _).symm
  · by_cases hq : q = 0
    · simpa only [hq, hdp, sub_zero, zero_mul, mul_zero, zero_pow zero_lt_two] using
        (max_bot_right _).symm
    · rw [← not_congr degree_eq_bot] at hp hq
      -- porting note: BUG `cases` tactic does not modify assumptions in `hp'` and `hq'`
      rcases hp' : p.degree with _ | dp -- `hp' : ` should be redundant
      · exact (hp hp').elim -- `hp'` should be `rfl`
      · rw [hp'] at hdp hdpq -- line should be redundant
        rcases hq' : q.degree with _ | dq -- `hq' : ` should be redundant
        · exact (hq hq').elim -- `hq'` should be `rfl`
        · rw [hq'] at hdpq hdq -- line should be redundant
          rcases le_or_lt dp (dq + 1) with hpq | hpq
          · convert (degree_sub_eq_right_of_degree_lt <| (degree_sub_le _ _).trans_lt <|
                      max_lt_iff.mpr ⟨hdp.trans_lt _, hdpq.trans_lt _⟩).trans
              (max_eq_right_of_lt _).symm <;> rw [hdq] <;>
                

Proof state:
case neg.some.some.inl.convert_3
R : Type u
inst✝¹ : CommRing R
W : Affine R
inst✝ : IsDomain R
p q : R[X]
hp : ¬degree p = ⊥
hq : ¬degree q = ⊥
dp : ℕ
hdp : degree (p ^ 2) = 2 • some dp
hp' : degree p = some dp
dq : ℕ
hdq : degree (q ^ 2 * (Y ^ 3 + C W.a₂ * Y ^ 2 + C W.a₄ * Y + C W.a₆)) = 2 • some dq + 3
hdpq : degree (p * q * (C W.a₁ * Y + C W.a₃)) ≤ some dp + some dq + 1
hq' : degree q = some dq
hpq : dp ≤ dq + 1
⊢ some dp + some dq + 1 < 2 • some dq + 3

Next tactic:
exact WithBot.coe_lt_coe.mpr <| by linarith only [hpq]