Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Mathlib/Algebra/MvPolynomial/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,15 @@ theorem coeff_C [DecidableEq σ] (m) (a) :
coeff m (C a : MvPolynomial σ R) = if 0 = m then a else 0 :=
Finsupp.single_apply

theorem coeff_C_of_ne_zero {m : σ →₀ ℕ} (h : m ≠ 0) (a : R) : coeff m (C a) = 0 := by
classical rw [coeff_C, if_neg h.symm]

-- The intended use case of this theorem is for `n = 1` (often useful for `pderiv`).
@[simp]
theorem coeff_add_single_C {n : ℕ} [NeZero n] {m : σ →₀ ℕ} (a : R) (i : σ) :
coeff (m + Finsupp.single i n) (C a) = 0 :=
coeff_C_of_ne_zero (fun H ↦ by simpa [NeZero.ne] using congr($(H) i)) a

lemma eq_C_of_isEmpty [IsEmpty σ] (p : MvPolynomial σ R) :
p = C (p.coeff 0) := by
obtain ⟨x, rfl⟩ := C_surjective σ p
Expand Down
9 changes: 9 additions & 0 deletions Mathlib/RingTheory/MvPowerSeries/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ theorem coeff_C [DecidableEq σ] (n : σ →₀ ℕ) (a : R) :
theorem coeff_zero_C (a : R) : coeff (0 : σ →₀ ℕ) (C a) = a :=
coeff_monomial_same 0 a

theorem coeff_C_of_ne_zero {n : σ →₀ ℕ} (h : n ≠ 0) (a : R) : coeff n (C a) = 0 := by
classical rw [coeff_C, if_neg h]

-- The intended use case of this theorem is for `m = 1` (often useful for `pderiv`).
@[simp]
theorem coeff_add_single_C {m : ℕ} [NeZero m] {n : σ →₀ ℕ} (a : R) (i : σ) :
coeff (n + single i m) (C a) = 0 :=
coeff_C_of_ne_zero (fun H ↦ by simpa [NeZero.ne] using congr($(H) i)) a

@[grind inj]
theorem C_injective : Function.Injective (C : R → MvPowerSeries σ R) := by
intro a b h
Expand Down
Loading