l3lab/ntp-mathlib huggingface dataset:
theorem Real.sInf_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sInf (a • s) = a • sSup s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sInf_empty, Real.sSup_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    

Proof state:
case inr.inl
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
s : Set ℝ
hs : Set.Nonempty s
ha : 0 ≤ 0
⊢ sInf 0 = 0

Next tactic:
exact csInf_singleton 0
theorem Real.sInf_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sInf (a • s) = a • sSup s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sInf_empty, Real.sSup_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    exact csInf_singleton 0
  

Proof state:
case inr.inr
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
ha' : a < 0
⊢ sInf (a • s) = a • sSup s

Next tactic:
by_cases h : BddAbove s
theorem Real.sInf_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sInf (a • s) = a • sSup s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sInf_empty, Real.sSup_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    exact csInf_singleton 0
  by_cases h : BddAbove s
  · 

Proof state:
case pos
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
ha' : a < 0
h : BddAbove s
⊢ sInf (a • s) = a • sSup s

Next tactic:
exact ((OrderIso.smulLeftDual ℝ ha').map_csSup' hs h).symm
theorem Real.sInf_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sInf (a • s) = a • sSup s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sInf_empty, Real.sSup_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    exact csInf_singleton 0
  by_cases h : BddAbove s
  · exact ((OrderIso.smulLeftDual ℝ ha').map_csSup' hs h).symm
  · 

Proof state:
case neg
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
ha' : a < 0
h : ¬BddAbove s
⊢ sInf (a • s) = a • sSup s

Next tactic:
rw [Real.sInf_of_not_bddBelow (mt (bddBelow_smul_iff_of_neg ha').1 h),
        Real.sSup_of_not_bddAbove h, smul_zero]
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
⊢ sSup (a • s) = a • sInf s

Next tactic:
obtain rfl | hs := s.eq_empty_or_nonempty
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · 

Proof state:
case inl
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
⊢ sSup (a • ∅) = a • sInf ∅

Next tactic:
rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
  

Proof state:
case inr
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
⊢ sSup (a • s) = a • sInf s

Next tactic:
obtain rfl | ha' := ha.eq_or_lt
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · 

Proof state:
case inr.inl
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
s : Set ℝ
hs : Set.Nonempty s
ha : 0 ≤ 0
⊢ sSup (0 • s) = 0 • sInf s

Next tactic:
rw [zero_smul_set hs, zero_smul]
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    

Proof state:
case inr.inl
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
s : Set ℝ
hs : Set.Nonempty s
ha : 0 ≤ 0
⊢ sSup 0 = 0

Next tactic:
exact csSup_singleton 0
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    exact csSup_singleton 0
  

Proof state:
case inr.inr
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
ha' : a < 0
⊢ sSup (a • s) = a • sInf s

Next tactic:
by_cases h : BddBelow s
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    exact csSup_singleton 0
  by_cases h : BddBelow s
  · 

Proof state:
case pos
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
ha' : a < 0
h : BddBelow s
⊢ sSup (a • s) = a • sInf s

Next tactic:
exact ((OrderIso.smulLeftDual ℝ ha').map_csInf' hs h).symm
theorem Real.sSup_smul_of_nonpos (ha : a ≤ 0) (s : Set ℝ) : sSup (a • s) = a • sInf s := by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · rw [smul_set_empty, Real.sSup_empty, Real.sInf_empty, smul_zero]
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_smul_set hs, zero_smul]
    exact csSup_singleton 0
  by_cases h : BddBelow s
  · exact ((OrderIso.smulLeftDual ℝ ha').map_csInf' hs h).symm
  · 

Proof state:
case neg
ι : Sort u_1
α : Type u_2
inst✝² : LinearOrderedField α
inst✝¹ : Module α ℝ
inst✝ : OrderedSMul α ℝ
a : α
ha : a ≤ 0
s : Set ℝ
hs : Set.Nonempty s
ha' : a < 0
h : ¬BddBelow s
⊢ sSup (a • s) = a • sInf s

Next tactic:
rw [Real.sSup_of_not_bddAbove (mt (bddAbove_smul_iff_of_neg ha').1 h),
        Real.sInf_of_not_bddBelow h, smul_zero]
theorem Real.iInf_mul_of_nonneg (ha : 0 ≤ r) (f : ι → ℝ) : (⨅ i, f i) * r = ⨅ i, f i * r := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : LinearOrderedField α
r : ℝ
ha : 0 ≤ r
f : ι → ℝ
⊢ (⨅ i, f i) * r = ⨅ i, f i * r

Next tactic:
simp only [Real.mul_iInf_of_nonneg ha, mul_comm]
theorem Real.iSup_mul_of_nonneg (ha : 0 ≤ r) (f : ι → ℝ) : (⨆ i, f i) * r = ⨆ i, f i * r := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : LinearOrderedField α
r : ℝ
ha : 0 ≤ r
f : ι → ℝ
⊢ (⨆ i, f i) * r = ⨆ i, f i * r

Next tactic:
simp only [Real.mul_iSup_of_nonneg ha, mul_comm]
theorem Real.iInf_mul_of_nonpos (ha : r ≤ 0) (f : ι → ℝ) : (⨅ i, f i) * r = ⨆ i, f i * r := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : LinearOrderedField α
r : ℝ
ha : r ≤ 0
f : ι → ℝ
⊢ (⨅ i, f i) * r = ⨆ i, f i * r

Next tactic:
simp only [Real.mul_iInf_of_nonpos ha, mul_comm]
theorem Real.iSup_mul_of_nonpos (ha : r ≤ 0) (f : ι → ℝ) : (⨆ i, f i) * r = ⨅ i, f i * r := by
  

Proof state:
ι : Sort u_1
α : Type u_2
inst✝ : LinearOrderedField α
r : ℝ
ha : r ≤ 0
f : ι → ℝ
⊢ (⨆ i, f i) * r = ⨅ i, f i * r

Next tactic:
simp only [Real.mul_iSup_of_nonpos ha, mul_comm]
@[simp]
theorem eta (f : R[X]) : Polynomial.ofFinsupp f.toFinsupp = f := by 

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q f : R[X]
⊢ { toFinsupp := f.toFinsupp } = f

Next tactic:
cases f
@[simp]
theorem eta (f : R[X]) : Polynomial.ofFinsupp f.toFinsupp = f := by cases f; 

Proof state:
case ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
toFinsupp✝ : R[ℕ]
⊢ { toFinsupp := { toFinsupp := toFinsupp✝ }.toFinsupp } = { toFinsupp := toFinsupp✝ }

Next tactic:
rfl
@[simp]
theorem ofFinsupp_add {a b} : (⟨a + b⟩ : R[X]) = ⟨a⟩ + ⟨b⟩ :=
  show _ = add _ _ by 

Proof state:
R : Type u
a✝ b✝ : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
a b : R[ℕ]
⊢ { toFinsupp := a + b } = Polynomial.add { toFinsupp := a } { toFinsupp := b }

Next tactic:
rw [add_def]
@[simp]
theorem ofFinsupp_neg {R : Type u} [Ring R] {a} : (⟨-a⟩ : R[X]) = -⟨a⟩ :=
  show _ = neg _ by 

Proof state:
R✝ : Type u
a✝ b : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
a : R[ℕ]
⊢ { toFinsupp := -a } = Polynomial.neg { toFinsupp := a }

Next tactic:
rw [neg_def]
@[simp]
theorem ofFinsupp_sub {R : Type u} [Ring R] {a b} : (⟨a - b⟩ : R[X]) = ⟨a⟩ - ⟨b⟩ := by
  

Proof state:
R✝ : Type u
a✝ b✝ : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
a b : R[ℕ]
⊢ { toFinsupp := a - b } = { toFinsupp := a } - { toFinsupp := b }

Next tactic:
rw [sub_eq_add_neg, ofFinsupp_add, ofFinsupp_neg]
@[simp]
theorem ofFinsupp_sub {R : Type u} [Ring R] {a b} : (⟨a - b⟩ : R[X]) = ⟨a⟩ - ⟨b⟩ := by
  rw [sub_eq_add_neg, ofFinsupp_add, ofFinsupp_neg]
  

Proof state:
R✝ : Type u
a✝ b✝ : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
a b : R[ℕ]
⊢ { toFinsupp := a } + -{ toFinsupp := b } = { toFinsupp := a } - { toFinsupp := b }

Next tactic:
rfl
@[simp]
theorem ofFinsupp_mul (a b) : (⟨a * b⟩ : R[X]) = ⟨a⟩ * ⟨b⟩ :=
  show _ = mul _ _ by 

Proof state:
R : Type u
a✝ b✝ : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
a b : R[ℕ]
⊢ { toFinsupp := a * b } = Polynomial.mul { toFinsupp := a } { toFinsupp := b }

Next tactic:
rw [mul_def]
@[simp]
theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by
  

Proof state:
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
n : ℕ
⊢ { toFinsupp := a ^ n } = { toFinsupp := a } ^ n

Next tactic:
change _ = npowRec n _
@[simp]
theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by
  change _ = npowRec n _
  

Proof state:
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
n : ℕ
⊢ { toFinsupp := a ^ n } = npowRec n { toFinsupp := a }

Next tactic:
induction n with
  | zero        => simp [npowRec]
  | succ n n_ih => simp [npowRec, n_ih, pow_succ]
@[simp]
theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by
  change _ = npowRec n _
  induction n with
  

Proof state:
case zero
R : Type u
a✝ b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
⊢ { toFinsupp := a ^ Nat.zero } = npowRec Nat.zero { toFinsupp := a }

Next tactic:
| zero        => simp [npowRec]
@[simp]
theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by
  change _ = npowRec n _
  induction n with
  | zero        => 

Proof state:
case zero
R : Type u
a✝ b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
⊢ { toFinsupp := a ^ Nat.zero } = npowRec Nat.zero { toFinsupp := a }

Next tactic:
simp [npowRec]
@[simp]
theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by
  change _ = npowRec n _
  induction n with
  | zero        => simp [npowRec]
  

Proof state:
case succ
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
n : ℕ
n_ih : { toFinsupp := a ^ n } = npowRec n { toFinsupp := a }
⊢ { toFinsupp := a ^ Nat.succ n } = npowRec (Nat.succ n) { toFinsupp := a }

Next tactic:
| succ n n_ih => simp [npowRec, n_ih, pow_succ]
@[simp]
theorem ofFinsupp_pow (a) (n : ℕ) : (⟨a ^ n⟩ : R[X]) = ⟨a⟩ ^ n := by
  change _ = npowRec n _
  induction n with
  | zero        => simp [npowRec]
  | succ n n_ih => 

Proof state:
case succ
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
n : ℕ
n_ih : { toFinsupp := a ^ n } = npowRec n { toFinsupp := a }
⊢ { toFinsupp := a ^ Nat.succ n } = npowRec (Nat.succ n) { toFinsupp := a }

Next tactic:
simp [npowRec, n_ih, pow_succ]
@[simp]
theorem toFinsupp_add (a b : R[X]) : (a + b).toFinsupp = a.toFinsupp + b.toFinsupp := by
  

Proof state:
R : Type u
a✝ b✝ : R
m n : ℕ
inst✝ : Semiring R
p q a b : R[X]
⊢ (a + b).toFinsupp = a.toFinsupp + b.toFinsupp

Next tactic:
cases a
@[simp]
theorem toFinsupp_add (a b : R[X]) : (a + b).toFinsupp = a.toFinsupp + b.toFinsupp := by
  cases a
  

Proof state:
case ofFinsupp
R : Type u
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q b : R[X]
toFinsupp✝ : R[ℕ]
⊢ ({ toFinsupp := toFinsupp✝ } + b).toFinsupp = { toFinsupp := toFinsupp✝ }.toFinsupp + b.toFinsupp

Next tactic:
cases b
@[simp]
theorem toFinsupp_add (a b : R[X]) : (a + b).toFinsupp = a.toFinsupp + b.toFinsupp := by
  cases a
  cases b
  

Proof state:
case ofFinsupp.ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
toFinsupp✝¹ toFinsupp✝ : R[ℕ]
⊢ ({ toFinsupp := toFinsupp✝¹ } + { toFinsupp := toFinsupp✝ }).toFinsupp =
    { toFinsupp := toFinsupp✝¹ }.toFinsupp + { toFinsupp := toFinsupp✝ }.toFinsupp

Next tactic:
rw [← ofFinsupp_add]
@[simp]
theorem toFinsupp_neg {R : Type u} [Ring R] (a : R[X]) : (-a).toFinsupp = -a.toFinsupp := by
  

Proof state:
R✝ : Type u
a✝ b : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
a : R[X]
⊢ (-a).toFinsupp = -a.toFinsupp

Next tactic:
cases a
@[simp]
theorem toFinsupp_neg {R : Type u} [Ring R] (a : R[X]) : (-a).toFinsupp = -a.toFinsupp := by
  cases a
  

Proof state:
case ofFinsupp
R✝ : Type u
a b : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
toFinsupp✝ : R[ℕ]
⊢ (-{ toFinsupp := toFinsupp✝ }).toFinsupp = -{ toFinsupp := toFinsupp✝ }.toFinsupp

Next tactic:
rw [← ofFinsupp_neg]
@[simp]
theorem toFinsupp_sub {R : Type u} [Ring R] (a b : R[X]) :
    (a - b).toFinsupp = a.toFinsupp - b.toFinsupp := by
  

Proof state:
R✝ : Type u
a✝ b✝ : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
a b : R[X]
⊢ (a - b).toFinsupp = a.toFinsupp - b.toFinsupp

Next tactic:
rw [sub_eq_add_neg, ← toFinsupp_neg, ← toFinsupp_add]
@[simp]
theorem toFinsupp_sub {R : Type u} [Ring R] (a b : R[X]) :
    (a - b).toFinsupp = a.toFinsupp - b.toFinsupp := by
  rw [sub_eq_add_neg, ← toFinsupp_neg, ← toFinsupp_add]
  

Proof state:
R✝ : Type u
a✝ b✝ : R✝
m n : ℕ
inst✝¹ : Semiring R✝
p q : R✝[X]
R : Type u
inst✝ : Ring R
a b : R[X]
⊢ (a - b).toFinsupp = (a + -b).toFinsupp

Next tactic:
rfl
@[simp]
theorem toFinsupp_mul (a b : R[X]) : (a * b).toFinsupp = a.toFinsupp * b.toFinsupp := by
  

Proof state:
R : Type u
a✝ b✝ : R
m n : ℕ
inst✝ : Semiring R
p q a b : R[X]
⊢ (a * b).toFinsupp = a.toFinsupp * b.toFinsupp

Next tactic:
cases a
@[simp]
theorem toFinsupp_mul (a b : R[X]) : (a * b).toFinsupp = a.toFinsupp * b.toFinsupp := by
  cases a
  

Proof state:
case ofFinsupp
R : Type u
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q b : R[X]
toFinsupp✝ : R[ℕ]
⊢ ({ toFinsupp := toFinsupp✝ } * b).toFinsupp = { toFinsupp := toFinsupp✝ }.toFinsupp * b.toFinsupp

Next tactic:
cases b
@[simp]
theorem toFinsupp_mul (a b : R[X]) : (a * b).toFinsupp = a.toFinsupp * b.toFinsupp := by
  cases a
  cases b
  

Proof state:
case ofFinsupp.ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
toFinsupp✝¹ toFinsupp✝ : R[ℕ]
⊢ ({ toFinsupp := toFinsupp✝¹ } * { toFinsupp := toFinsupp✝ }).toFinsupp =
    { toFinsupp := toFinsupp✝¹ }.toFinsupp * { toFinsupp := toFinsupp✝ }.toFinsupp

Next tactic:
rw [← ofFinsupp_mul]
@[simp]
theorem toFinsupp_pow (a : R[X]) (n : ℕ) : (a ^ n).toFinsupp = a.toFinsupp ^ n := by
  

Proof state:
R : Type u
a✝ b : R
m n✝ : ℕ
inst✝ : Semiring R
p q a : R[X]
n : ℕ
⊢ (a ^ n).toFinsupp = a.toFinsupp ^ n

Next tactic:
cases a
@[simp]
theorem toFinsupp_pow (a : R[X]) (n : ℕ) : (a ^ n).toFinsupp = a.toFinsupp ^ n := by
  cases a
  

Proof state:
case ofFinsupp
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
n : ℕ
toFinsupp✝ : R[ℕ]
⊢ ({ toFinsupp := toFinsupp✝ } ^ n).toFinsupp = { toFinsupp := toFinsupp✝ }.toFinsupp ^ n

Next tactic:
rw [← ofFinsupp_pow]
@[simp]
theorem toFinsupp_eq_zero {a : R[X]} : a.toFinsupp = 0 ↔ a = 0 := by
  

Proof state:
R : Type u
a✝ b : R
m n : ℕ
inst✝ : Semiring R
p q a : R[X]
⊢ a.toFinsupp = 0 ↔ a = 0

Next tactic:
rw [← toFinsupp_zero, toFinsupp_inj]
@[simp]
theorem toFinsupp_eq_one {a : R[X]} : a.toFinsupp = 1 ↔ a = 1 := by
  

Proof state:
R : Type u
a✝ b : R
m n : ℕ
inst✝ : Semiring R
p q a : R[X]
⊢ a.toFinsupp = 1 ↔ a = 1

Next tactic:
rw [← toFinsupp_one, toFinsupp_inj]
@[simp]
theorem ofFinsupp_eq_zero {a} : (⟨a⟩ : R[X]) = 0 ↔ a = 0 := by
  

Proof state:
R : Type u
a✝ b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
⊢ { toFinsupp := a } = 0 ↔ a = 0

Next tactic:
rw [← ofFinsupp_zero, ofFinsupp_inj]
@[simp]
theorem ofFinsupp_eq_one {a} : (⟨a⟩ : R[X]) = 1 ↔ a = 1 := by 

Proof state:
R : Type u
a✝ b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
a : R[ℕ]
⊢ { toFinsupp := a } = 1 ↔ a = 1

Next tactic:
rw [← ofFinsupp_one, ofFinsupp_inj]
instance smulCommClass {S₁ S₂} [SMulZeroClass S₁ R] [SMulZeroClass S₂ R] [SMulCommClass S₁ S₂ R] :
  SMulCommClass S₁ S₂ R[X] :=
  ⟨by
    

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝³ : Semiring R
p q : R[X]
S₁ : Type ?u.541577
S₂ : Type ?u.541744
inst✝² : SMulZeroClass S₁ R
inst✝¹ : SMulZeroClass S₂ R
inst✝ : SMulCommClass S₁ S₂ R
⊢ ∀ (m : S₁) (n : S₂) (a : R[X]), m • n • a = n • m • a

Next tactic:
rintro m n ⟨f⟩
instance smulCommClass {S₁ S₂} [SMulZeroClass S₁ R] [SMulZeroClass S₂ R] [SMulCommClass S₁ S₂ R] :
  SMulCommClass S₁ S₂ R[X] :=
  ⟨by
    rintro m n ⟨f⟩
    

Proof state:
case ofFinsupp
R : Type u
a b : R
m✝ n✝ : ℕ
inst✝³ : Semiring R
p q : R[X]
S₁ : Type ?u.541577
S₂ : Type ?u.541744
inst✝² : SMulZeroClass S₁ R
inst✝¹ : SMulZeroClass S₂ R
inst✝ : SMulCommClass S₁ S₂ R
m : S₁
n : S₂
f : R[ℕ]
⊢ m • n • { toFinsupp := f } = n • m • { toFinsupp := f }

Next tactic:
simp_rw [← ofFinsupp_smul, smul_comm m n f]
instance isScalarTower {S₁ S₂} [SMul S₁ S₂] [SMulZeroClass S₁ R] [SMulZeroClass S₂ R]
  [IsScalarTower S₁ S₂ R] : IsScalarTower S₁ S₂ R[X] :=
  ⟨by
    

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝⁴ : Semiring R
p q : R[X]
S₁ : Type ?u.544609
S₂ : Type ?u.544608
inst✝³ : SMul S₁ S₂
inst✝² : SMulZeroClass S₁ R
inst✝¹ : SMulZeroClass S₂ R
inst✝ : IsScalarTower S₁ S₂ R
⊢ ∀ (x : S₁) (y : S₂) (z : R[X]), (x • y) • z = x • y • z

Next tactic:
rintro _ _ ⟨⟩
instance isScalarTower {S₁ S₂} [SMul S₁ S₂] [SMulZeroClass S₁ R] [SMulZeroClass S₂ R]
  [IsScalarTower S₁ S₂ R] : IsScalarTower S₁ S₂ R[X] :=
  ⟨by
    rintro _ _ ⟨⟩
    

Proof state:
case ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝⁴ : Semiring R
p q : R[X]
S₁ : Type ?u.544609
S₂ : Type ?u.544608
inst✝³ : SMul S₁ S₂
inst✝² : SMulZeroClass S₁ R
inst✝¹ : SMulZeroClass S₂ R
inst✝ : IsScalarTower S₁ S₂ R
x✝ : S₁
y✝ : S₂
toFinsupp✝ : R[ℕ]
⊢ (x✝ • y✝) • { toFinsupp := toFinsupp✝ } = x✝ • y✝ • { toFinsupp := toFinsupp✝ }

Next tactic:
simp_rw [← ofFinsupp_smul, smul_assoc]
instance isScalarTower_right {α K : Type*} [Semiring K] [DistribSMul α K] [IsScalarTower α K K] :
    IsScalarTower α K[X] K[X] :=
  ⟨by
    

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝³ : Semiring R
p q : R[X]
α : Type u_1
K : Type u_2
inst✝² : Semiring K
inst✝¹ : DistribSMul α K
inst✝ : IsScalarTower α K K
⊢ ∀ (x : α) (y z : K[X]), (x • y) • z = x • y • z

Next tactic:
rintro _ ⟨⟩ ⟨⟩
instance isScalarTower_right {α K : Type*} [Semiring K] [DistribSMul α K] [IsScalarTower α K K] :
    IsScalarTower α K[X] K[X] :=
  ⟨by
    rintro _ ⟨⟩ ⟨⟩;
      

Proof state:
case ofFinsupp.ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝³ : Semiring R
p q : R[X]
α : Type u_1
K : Type u_2
inst✝² : Semiring K
inst✝¹ : DistribSMul α K
inst✝ : IsScalarTower α K K
x✝ : α
toFinsupp✝¹ toFinsupp✝ : K[ℕ]
⊢ (x✝ • { toFinsupp := toFinsupp✝¹ }) • { toFinsupp := toFinsupp✝ } =
    x✝ • { toFinsupp := toFinsupp✝¹ } • { toFinsupp := toFinsupp✝ }

Next tactic:
simp_rw [smul_eq_mul, ← ofFinsupp_smul, ← ofFinsupp_mul, ← ofFinsupp_smul, smul_mul_assoc]
instance isCentralScalar {S} [SMulZeroClass S R] [SMulZeroClass Sᵐᵒᵖ R] [IsCentralScalar S R] :
  IsCentralScalar S R[X] :=
  ⟨by
    

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝³ : Semiring R
p q : R[X]
S : Type ?u.556422
inst✝² : SMulZeroClass S R
inst✝¹ : SMulZeroClass Sᵐᵒᵖ R
inst✝ : IsCentralScalar S R
⊢ ∀ (m : S) (a : R[X]), MulOpposite.op m • a = m • a

Next tactic:
rintro _ ⟨⟩
instance isCentralScalar {S} [SMulZeroClass S R] [SMulZeroClass Sᵐᵒᵖ R] [IsCentralScalar S R] :
  IsCentralScalar S R[X] :=
  ⟨by
    rintro _ ⟨⟩
    

Proof state:
case ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝³ : Semiring R
p q : R[X]
S : Type ?u.556422
inst✝² : SMulZeroClass S R
inst✝¹ : SMulZeroClass Sᵐᵒᵖ R
inst✝ : IsCentralScalar S R
m✝ : S
toFinsupp✝ : R[ℕ]
⊢ MulOpposite.op m✝ • { toFinsupp := toFinsupp✝ } = m✝ • { toFinsupp := toFinsupp✝ }

Next tactic:
simp_rw [← ofFinsupp_smul, op_smul_eq_smul]
instance unique [Subsingleton R] : Unique R[X] :=
  { Polynomial.inhabited with
    uniq := by
      

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q : R[X]
inst✝ : Subsingleton R
src✝ : Inhabited R[X] := inhabited
⊢ ∀ (a : R[X]), a = default

Next tactic:
rintro ⟨x⟩
instance unique [Subsingleton R] : Unique R[X] :=
  { Polynomial.inhabited with
    uniq := by
      rintro ⟨x⟩
      

Proof state:
case ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q : R[X]
inst✝ : Subsingleton R
src✝ : Inhabited R[X] := inhabited
x : R[ℕ]
⊢ { toFinsupp := x } = default

Next tactic:
refine' congr_arg ofFinsupp _
instance unique [Subsingleton R] : Unique R[X] :=
  { Polynomial.inhabited with
    uniq := by
      rintro ⟨x⟩
      refine' congr_arg ofFinsupp _
      

Proof state:
case ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝¹ : Semiring R
p q : R[X]
inst✝ : Subsingleton R
src✝ : Inhabited R[X] := inhabited
x : R[ℕ]
⊢ x = 0

Next tactic:
simp [eq_iff_true_of_subsingleton]
@[simp]
theorem support_ofFinsupp (p) : support (⟨p⟩ : R[X]) = p.support := by 

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p✝ q : R[X]
p : R[ℕ]
⊢ support { toFinsupp := p } = p.support

Next tactic:
rw [support]
theorem support_toFinsupp (p : R[X]) : p.toFinsupp.support = p.support := by 

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p✝ q p : R[X]
⊢ p.toFinsupp.support = support p

Next tactic:
rw [support]
@[simp]
theorem support_eq_empty : p.support = ∅ ↔ p = 0 := by
  

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
⊢ support p = ∅ ↔ p = 0

Next tactic:
rcases p with ⟨⟩
@[simp]
theorem support_eq_empty : p.support = ∅ ↔ p = 0 := by
  rcases p with ⟨⟩
  

Proof state:
case ofFinsupp
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
q : R[X]
toFinsupp✝ : R[ℕ]
⊢ support { toFinsupp := toFinsupp✝ } = ∅ ↔ { toFinsupp := toFinsupp✝ } = 0

Next tactic:
simp [support]
theorem card_support_eq_zero : p.support.card = 0 ↔ p = 0 := by 

Proof state:
R : Type u
a b : R
m n : ℕ
inst✝ : Semiring R
p q : R[X]
⊢ Finset.card (support p) = 0 ↔ p = 0

Next tactic:
simp
/-- `monomial s a` is the monomial `a * X^s` -/
def monomial (n : ℕ) : R →ₗ[R] R[X] where
  toFun t := ⟨Finsupp.single n t⟩
  -- Porting note: Was `simp`.
  map_add' x y := by 

Proof state:
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
n : ℕ
x y : R
⊢ (fun t => { toFinsupp := fun₀ | n => t }) (x + y) =
    (fun t => { toFinsupp := fun₀ | n => t }) x + (fun t => { toFinsupp := fun₀ | n => t }) y

Next tactic:
simp
/-- `monomial s a` is the monomial `a * X^s` -/
def monomial (n : ℕ) : R →ₗ[R] R[X] where
  toFun t := ⟨Finsupp.single n t⟩
  -- Porting note: Was `simp`.
  map_add' x y := by simp; 

Proof state:
R : Type u
a b : R
m n✝ : ℕ
inst✝ : Semiring R
p q : R[X]
n : ℕ
x y : R
⊢ { toFinsupp := (fun₀ | n => x) + fun₀ | n => y } = { toFinsupp := fun₀ | n => x } + { toFinsupp := fun₀ | n => y }

Next tactic:
rw [ofFinsupp_add]