l3lab/ntp-mathlib huggingface dataset:
/-- Multivariate formal power series over a local ring form a local ring. -/
instance [LocalRing R] : LocalRing (MvPowerSeries σ R) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self <| by
    intro φ
    rcases LocalRing.isUnit_or_isUnit_one_sub_self (constantCoeff σ R φ) with (⟨u, h⟩ | ⟨u, h⟩) <;>
        [left; right] <;>
      · refine' isUnit_of_mul_eq_one _ _ (mul_invOfUnit _ u _)
        

Proof state:
case inr.intro.h
σ : Type u_1
R : Type u_2
inst✝¹ : CommRing R
inst✝ : LocalRing R
φ : MvPowerSeries σ R
u : Rˣ
h : ↑u = 1 - (constantCoeff σ R) φ
⊢ (constantCoeff σ R) (1 - φ) = ↑u

Next tactic:
simpa using h.symm
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    

Proof state:
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
⊢ ∀ (a : MvPowerSeries σ R), IsUnit ((map σ f) a) → IsUnit a

Next tactic:
rintro φ ⟨ψ, h⟩
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    rintro φ ⟨ψ, h⟩
    

Proof state:
case intro
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
φ : MvPowerSeries σ R
ψ : (MvPowerSeries σ S)ˣ
h : ↑ψ = (map σ f) φ
⊢ IsUnit φ

Next tactic:
replace h := congr_arg (constantCoeff σ S) h
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    rintro φ ⟨ψ, h⟩
    replace h := congr_arg (constantCoeff σ S) h
    

Proof state:
case intro
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
φ : MvPowerSeries σ R
ψ : (MvPowerSeries σ S)ˣ
h : (constantCoeff σ S) ↑ψ = (constantCoeff σ S) ((map σ f) φ)
⊢ IsUnit φ

Next tactic:
rw [constantCoeff_map] at h
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    rintro φ ⟨ψ, h⟩
    replace h := congr_arg (constantCoeff σ S) h
    rw [constantCoeff_map] at h
    

Proof state:
case intro
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
φ : MvPowerSeries σ R
ψ : (MvPowerSeries σ S)ˣ
h : (constantCoeff σ S) ↑ψ = f ((constantCoeff σ R) φ)
⊢ IsUnit φ

Next tactic:
have : IsUnit (constantCoeff σ S ↑ψ) := isUnit_constantCoeff (↑ψ) ψ.isUnit
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    rintro φ ⟨ψ, h⟩
    replace h := congr_arg (constantCoeff σ S) h
    rw [constantCoeff_map] at h
    have : IsUnit (constantCoeff σ S ↑ψ) := isUnit_constantCoeff (↑ψ) ψ.isUnit
    

Proof state:
case intro
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
φ : MvPowerSeries σ R
ψ : (MvPowerSeries σ S)ˣ
h : (constantCoeff σ S) ↑ψ = f ((constantCoeff σ R) φ)
this : IsUnit ((constantCoeff σ S) ↑ψ)
⊢ IsUnit φ

Next tactic:
rw [h] at this
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    rintro φ ⟨ψ, h⟩
    replace h := congr_arg (constantCoeff σ S) h
    rw [constantCoeff_map] at h
    have : IsUnit (constantCoeff σ S ↑ψ) := isUnit_constantCoeff (↑ψ) ψ.isUnit
    rw [h] at this
    

Proof state:
case intro
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
φ : MvPowerSeries σ R
ψ : (MvPowerSeries σ S)ˣ
h : (constantCoeff σ S) ↑ψ = f ((constantCoeff σ R) φ)
this : IsUnit (f ((constantCoeff σ R) φ))
⊢ IsUnit φ

Next tactic:
rcases isUnit_of_map_unit f _ this with ⟨c, hc⟩
/-- The map `A[[X]] → B[[X]]` induced by a local ring hom `A → B` is local -/
instance map.isLocalRingHom : IsLocalRingHom (map σ f) :=
  ⟨by
    rintro φ ⟨ψ, h⟩
    replace h := congr_arg (constantCoeff σ S) h
    rw [constantCoeff_map] at h
    have : IsUnit (constantCoeff σ S ↑ψ) := isUnit_constantCoeff (↑ψ) ψ.isUnit
    rw [h] at this
    rcases isUnit_of_map_unit f _ this with ⟨c, hc⟩
    

Proof state:
case intro.intro
σ : Type u_1
R : Type u_2
S : Type u_3
inst✝² : CommRing R
inst✝¹ : CommRing S
f : R →+* S
inst✝ : IsLocalRingHom f
φ : MvPowerSeries σ R
ψ : (MvPowerSeries σ S)ˣ
h : (constantCoeff σ S) ↑ψ = f ((constantCoeff σ R) φ)
this : IsUnit (f ((constantCoeff σ R) φ))
c : Rˣ
hc : ↑c = (constantCoeff σ R) φ
⊢ IsUnit φ

Next tactic:
exact isUnit_of_mul_eq_one φ (invOfUnit φ c) (mul_invOfUnit φ c hc.symm)
@[simp]
theorem constantCoeff_inv (φ : MvPowerSeries σ k) :
    constantCoeff σ k φ⁻¹ = (constantCoeff σ k φ)⁻¹ := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
⊢ (constantCoeff σ k) φ⁻¹ = ((constantCoeff σ k) φ)⁻¹

Next tactic:
classical
  rw [← coeff_zero_eq_constantCoeff_apply, coeff_inv, if_pos rfl]
@[simp]
theorem constantCoeff_inv (φ : MvPowerSeries σ k) :
    constantCoeff σ k φ⁻¹ = (constantCoeff σ k φ)⁻¹ := by
  classical
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
⊢ (constantCoeff σ k) φ⁻¹ = ((constantCoeff σ k) φ)⁻¹

Next tactic:
rw [← coeff_zero_eq_constantCoeff_apply, coeff_inv, if_pos rfl]
theorem inv_eq_zero {φ : MvPowerSeries σ k} : φ⁻¹ = 0 ↔ constantCoeff σ k φ = 0 :=
  ⟨fun h => by 

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : φ⁻¹ = 0
⊢ (constantCoeff σ k) φ = 0

Next tactic:
simpa using congr_arg (constantCoeff σ k) h
theorem inv_eq_zero {φ : MvPowerSeries σ k} : φ⁻¹ = 0 ↔ constantCoeff σ k φ = 0 :=
  ⟨fun h => by simpa using congr_arg (constantCoeff σ k) h, fun h =>
    ext fun n => by
      

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0
n : σ →₀ ℕ
⊢ (coeff k n) φ⁻¹ = (coeff k n) 0

Next tactic:
classical
      rw [coeff_inv]
      split_ifs <;>
        simp only [h, map_zero, zero_mul, inv_zero, neg_zero]
theorem inv_eq_zero {φ : MvPowerSeries σ k} : φ⁻¹ = 0 ↔ constantCoeff σ k φ = 0 :=
  ⟨fun h => by simpa using congr_arg (constantCoeff σ k) h, fun h =>
    ext fun n => by
      classical
      

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0
n : σ →₀ ℕ
⊢ (coeff k n) φ⁻¹ = (coeff k n) 0

Next tactic:
rw [coeff_inv]
theorem inv_eq_zero {φ : MvPowerSeries σ k} : φ⁻¹ = 0 ↔ constantCoeff σ k φ = 0 :=
  ⟨fun h => by simpa using congr_arg (constantCoeff σ k) h, fun h =>
    ext fun n => by
      classical
      rw [coeff_inv]
      

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0
n : σ →₀ ℕ
⊢ (if n = 0 then ((constantCoeff σ k) φ)⁻¹
    else
      -((constantCoeff σ k) φ)⁻¹ * ∑ x in antidiagonal n, if x.2 < n then (coeff k x.1) φ * (coeff k x.2) φ⁻¹ else 0) =
    (coeff k n) 0

Next tactic:
split_ifs
theorem inv_eq_zero {φ : MvPowerSeries σ k} : φ⁻¹ = 0 ↔ constantCoeff σ k φ = 0 :=
  ⟨fun h => by simpa using congr_arg (constantCoeff σ k) h, fun h =>
    ext fun n => by
      classical
      rw [coeff_inv]
      split_ifs <;>
        

Proof state:
case pos
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0
n : σ →₀ ℕ
h✝ : n = 0
⊢ ((constantCoeff σ k) φ)⁻¹ = (coeff k n) 0

Next tactic:
simp only [h, map_zero, zero_mul, inv_zero, neg_zero]
theorem inv_eq_zero {φ : MvPowerSeries σ k} : φ⁻¹ = 0 ↔ constantCoeff σ k φ = 0 :=
  ⟨fun h => by simpa using congr_arg (constantCoeff σ k) h, fun h =>
    ext fun n => by
      classical
      rw [coeff_inv]
      split_ifs <;>
        

Proof state:
case neg
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0
n : σ →₀ ℕ
h✝ : ¬n = 0
⊢ (-((constantCoeff σ k) φ)⁻¹ * ∑ x in antidiagonal n, if x.2 < n then (coeff k x.1) φ * (coeff k x.2) φ⁻¹ else 0) =
    (coeff k n) 0

Next tactic:
simp only [h, map_zero, zero_mul, inv_zero, neg_zero]
@[simp]
theorem zero_inv : (0 : MvPowerSeries σ k)⁻¹ = 0 := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
⊢ 0⁻¹ = 0

Next tactic:
rw [inv_eq_zero, constantCoeff_zero]
@[simp]
theorem invOfUnit_eq' (φ : MvPowerSeries σ k) (u : Units k) (h : constantCoeff σ k φ = u) :
    invOfUnit φ u = φ⁻¹ := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
u : kˣ
h : (constantCoeff σ k) φ = ↑u
⊢ invOfUnit φ u = φ⁻¹

Next tactic:
rw [← invOfUnit_eq φ (h.symm ▸ u.ne_zero)]
@[simp]
theorem invOfUnit_eq' (φ : MvPowerSeries σ k) (u : Units k) (h : constantCoeff σ k φ = u) :
    invOfUnit φ u = φ⁻¹ := by
  rw [← invOfUnit_eq φ (h.symm ▸ u.ne_zero)]
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
u : kˣ
h : (constantCoeff σ k) φ = ↑u
⊢ invOfUnit φ u = invOfUnit φ (Units.mk0 ((constantCoeff σ k) φ) (_ : (constantCoeff σ k) φ ≠ 0))

Next tactic:
apply congrArg (invOfUnit φ)
@[simp]
theorem invOfUnit_eq' (φ : MvPowerSeries σ k) (u : Units k) (h : constantCoeff σ k φ = u) :
    invOfUnit φ u = φ⁻¹ := by
  rw [← invOfUnit_eq φ (h.symm ▸ u.ne_zero)]
  apply congrArg (invOfUnit φ)
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
u : kˣ
h : (constantCoeff σ k) φ = ↑u
⊢ u = Units.mk0 ((constantCoeff σ k) φ) (_ : (constantCoeff σ k) φ ≠ 0)

Next tactic:
rw [Units.ext_iff]
@[simp]
theorem invOfUnit_eq' (φ : MvPowerSeries σ k) (u : Units k) (h : constantCoeff σ k φ = u) :
    invOfUnit φ u = φ⁻¹ := by
  rw [← invOfUnit_eq φ (h.symm ▸ u.ne_zero)]
  apply congrArg (invOfUnit φ)
  rw [Units.ext_iff]
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
u : kˣ
h : (constantCoeff σ k) φ = ↑u
⊢ ↑u = ↑(Units.mk0 ((constantCoeff σ k) φ) (_ : (constantCoeff σ k) φ ≠ 0))

Next tactic:
exact h.symm
@[simp]
protected theorem mul_inv_cancel (φ : MvPowerSeries σ k) (h : constantCoeff σ k φ ≠ 0) :
    φ * φ⁻¹ = 1 := by 

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ ≠ 0
⊢ φ * φ⁻¹ = 1

Next tactic:
rw [← invOfUnit_eq φ h, mul_invOfUnit φ (Units.mk0 _ h) rfl]
@[simp]
protected theorem inv_mul_cancel (φ : MvPowerSeries σ k) (h : constantCoeff σ k φ ≠ 0) :
    φ⁻¹ * φ = 1 := by 

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ : MvPowerSeries σ k
h : (constantCoeff σ k) φ ≠ 0
⊢ φ⁻¹ * φ = 1

Next tactic:
rw [mul_comm, φ.mul_inv_cancel h]
protected theorem eq_mul_inv_iff_mul_eq {φ₁ φ₂ φ₃ : MvPowerSeries σ k}
    (h : constantCoeff σ k φ₃ ≠ 0) : φ₁ = φ₂ * φ₃⁻¹ ↔ φ₁ * φ₃ = φ₂ :=
  ⟨fun k => by 

Proof state:
σ : Type u_1
R : Type u_2
k✝ : Type u_3
inst✝ : Field k✝
φ₁ φ₂ φ₃ : MvPowerSeries σ k✝
h : (constantCoeff σ k✝) φ₃ ≠ 0
k : φ₁ = φ₂ * φ₃⁻¹
⊢ φ₁ * φ₃ = φ₂

Next tactic:
simp [k, mul_assoc, MvPowerSeries.inv_mul_cancel _ h]
protected theorem eq_mul_inv_iff_mul_eq {φ₁ φ₂ φ₃ : MvPowerSeries σ k}
    (h : constantCoeff σ k φ₃ ≠ 0) : φ₁ = φ₂ * φ₃⁻¹ ↔ φ₁ * φ₃ = φ₂ :=
  ⟨fun k => by simp [k, mul_assoc, MvPowerSeries.inv_mul_cancel _ h], fun k => by
    

Proof state:
σ : Type u_1
R : Type u_2
k✝ : Type u_3
inst✝ : Field k✝
φ₁ φ₂ φ₃ : MvPowerSeries σ k✝
h : (constantCoeff σ k✝) φ₃ ≠ 0
k : φ₁ * φ₃ = φ₂
⊢ φ₁ = φ₂ * φ₃⁻¹

Next tactic:
simp [← k, mul_assoc, MvPowerSeries.mul_inv_cancel _ h]
protected theorem eq_inv_iff_mul_eq_one {φ ψ : MvPowerSeries σ k} (h : constantCoeff σ k ψ ≠ 0) :
    φ = ψ⁻¹ ↔ φ * ψ = 1 := by 

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) ψ ≠ 0
⊢ φ = ψ⁻¹ ↔ φ * ψ = 1

Next tactic:
rw [← MvPowerSeries.eq_mul_inv_iff_mul_eq h, one_mul]
protected theorem inv_eq_iff_mul_eq_one {φ ψ : MvPowerSeries σ k} (h : constantCoeff σ k ψ ≠ 0) :
    ψ⁻¹ = φ ↔ φ * ψ = 1 := by 

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) ψ ≠ 0
⊢ ψ⁻¹ = φ ↔ φ * ψ = 1

Next tactic:
rw [eq_comm, MvPowerSeries.eq_inv_iff_mul_eq_one h]
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
⊢ (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹

Next tactic:
by_cases h : constantCoeff σ k (φ * ψ) = 0
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · 

Proof state:
case pos
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) (φ * ψ) = 0
⊢ (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹

Next tactic:
rw [inv_eq_zero.mpr h]
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    

Proof state:
case pos
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) (φ * ψ) = 0
⊢ 0 = ψ⁻¹ * φ⁻¹

Next tactic:
simp only [map_mul, mul_eq_zero] at h
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    simp only [map_mul, mul_eq_zero] at h
    -- we don't have `NoZeroDivisors (MvPowerSeries σ k)` yet,
    

Proof state:
case pos
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0 ∨ (constantCoeff σ k) ψ = 0
⊢ 0 = ψ⁻¹ * φ⁻¹

Next tactic:
cases' h with h h
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    simp only [map_mul, mul_eq_zero] at h
    -- we don't have `NoZeroDivisors (MvPowerSeries σ k)` yet,
    cases' h with h h <;> 

Proof state:
case pos.inl
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) φ = 0
⊢ 0 = ψ⁻¹ * φ⁻¹

Next tactic:
simp [inv_eq_zero.mpr h]
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    simp only [map_mul, mul_eq_zero] at h
    -- we don't have `NoZeroDivisors (MvPowerSeries σ k)` yet,
    cases' h with h h <;> 

Proof state:
case pos.inr
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : (constantCoeff σ k) ψ = 0
⊢ 0 = ψ⁻¹ * φ⁻¹

Next tactic:
simp [inv_eq_zero.mpr h]
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    simp only [map_mul, mul_eq_zero] at h
    -- we don't have `NoZeroDivisors (MvPowerSeries σ k)` yet,
    cases' h with h h <;> simp [inv_eq_zero.mpr h]
  · 

Proof state:
case neg
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : ¬(constantCoeff σ k) (φ * ψ) = 0
⊢ (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹

Next tactic:
rw [MvPowerSeries.inv_eq_iff_mul_eq_one h]
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    simp only [map_mul, mul_eq_zero] at h
    -- we don't have `NoZeroDivisors (MvPowerSeries σ k)` yet,
    cases' h with h h <;> simp [inv_eq_zero.mpr h]
  · rw [MvPowerSeries.inv_eq_iff_mul_eq_one h]
    

Proof state:
case neg
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : ¬(constantCoeff σ k) (φ * ψ) = 0
⊢ ψ⁻¹ * φ⁻¹ * (φ * ψ) = 1

Next tactic:
simp only [not_or, map_mul, mul_eq_zero] at h
@[simp]
protected theorem mul_inv_rev (φ ψ : MvPowerSeries σ k) :
    (φ * ψ)⁻¹ = ψ⁻¹ * φ⁻¹ := by
  by_cases h : constantCoeff σ k (φ * ψ) = 0
  · rw [inv_eq_zero.mpr h]
    simp only [map_mul, mul_eq_zero] at h
    -- we don't have `NoZeroDivisors (MvPowerSeries σ k)` yet,
    cases' h with h h <;> simp [inv_eq_zero.mpr h]
  · rw [MvPowerSeries.inv_eq_iff_mul_eq_one h]
    simp only [not_or, map_mul, mul_eq_zero] at h
    

Proof state:
case neg
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
φ ψ : MvPowerSeries σ k
h : ¬(constantCoeff σ k) φ = 0 ∧ ¬(constantCoeff σ k) ψ = 0
⊢ ψ⁻¹ * φ⁻¹ * (φ * ψ) = 1

Next tactic:
rw [← mul_assoc, mul_assoc _⁻¹, MvPowerSeries.inv_mul_cancel _ h.left, mul_one,
      MvPowerSeries.inv_mul_cancel _ h.right]
instance : InvOneClass (MvPowerSeries σ k) :=
  { inferInstanceAs (One (MvPowerSeries σ k)),
    inferInstanceAs (Inv (MvPowerSeries σ k)) with
    inv_one := by
      

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
src✝¹ : One (MvPowerSeries σ k) := inferInstanceAs (One (MvPowerSeries σ k))
src✝ : Inv (MvPowerSeries σ k) := inferInstanceAs (Inv (MvPowerSeries σ k))
⊢ 1⁻¹ = 1

Next tactic:
rw [MvPowerSeries.inv_eq_iff_mul_eq_one, mul_one]
instance : InvOneClass (MvPowerSeries σ k) :=
  { inferInstanceAs (One (MvPowerSeries σ k)),
    inferInstanceAs (Inv (MvPowerSeries σ k)) with
    inv_one := by
      rw [MvPowerSeries.inv_eq_iff_mul_eq_one, mul_one]
      

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
src✝¹ : One (MvPowerSeries σ k) := inferInstanceAs (One (MvPowerSeries σ k))
src✝ : Inv (MvPowerSeries σ k) := inferInstanceAs (Inv (MvPowerSeries σ k))
⊢ (constantCoeff σ k) 1 ≠ 0

Next tactic:
simp
@[simp]
theorem C_inv (r : k) : (C σ k r)⁻¹ = C σ k r⁻¹ := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
r : k
⊢ ((C σ k) r)⁻¹ = (C σ k) r⁻¹

Next tactic:
rcases eq_or_ne r 0 with (rfl | hr)
@[simp]
theorem C_inv (r : k) : (C σ k r)⁻¹ = C σ k r⁻¹ := by
  rcases eq_or_ne r 0 with (rfl | hr)
  · 

Proof state:
case inl
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
⊢ ((C σ k) 0)⁻¹ = (C σ k) 0⁻¹

Next tactic:
simp
@[simp]
theorem C_inv (r : k) : (C σ k r)⁻¹ = C σ k r⁻¹ := by
  rcases eq_or_ne r 0 with (rfl | hr)
  · simp
  

Proof state:
case inr
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
r : k
hr : r ≠ 0
⊢ ((C σ k) r)⁻¹ = (C σ k) r⁻¹

Next tactic:
rw [MvPowerSeries.inv_eq_iff_mul_eq_one, ← map_mul, inv_mul_cancel hr, map_one]
@[simp]
theorem C_inv (r : k) : (C σ k r)⁻¹ = C σ k r⁻¹ := by
  rcases eq_or_ne r 0 with (rfl | hr)
  · simp
  rw [MvPowerSeries.inv_eq_iff_mul_eq_one, ← map_mul, inv_mul_cancel hr, map_one]
  

Proof state:
case inr
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
r : k
hr : r ≠ 0
⊢ (constantCoeff σ k) ((C σ k) r) ≠ 0

Next tactic:
simpa using hr
@[simp]
theorem X_inv (s : σ) : (X s : MvPowerSeries σ k)⁻¹ = 0 := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
s : σ
⊢ (X s)⁻¹ = 0

Next tactic:
rw [inv_eq_zero, constantCoeff_X]
@[simp]
theorem smul_inv (r : k) (φ : MvPowerSeries σ k) : (r • φ)⁻¹ = r⁻¹ • φ⁻¹ := by
  

Proof state:
σ : Type u_1
R : Type u_2
k : Type u_3
inst✝ : Field k
r : k
φ : MvPowerSeries σ k
⊢ (r • φ)⁻¹ = r⁻¹ • φ⁻¹

Next tactic:
simp [smul_eq_C_mul, mul_comm]
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
⊢ (MvPowerSeries.coeff R m) ↑((monomial n) a) = (MvPowerSeries.coeff R m) ((MvPowerSeries.monomial R n) a)

Next tactic:
classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |rfl|subst m; contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
⊢ (MvPowerSeries.coeff R m) ↑((monomial n) a) = (MvPowerSeries.coeff R m) ((MvPowerSeries.monomial R n) a)

Next tactic:
rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
⊢ (if n = m then a else 0) = if m = n then a else 0

Next tactic:
split_ifs with h₁ h₂
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> 

Proof state:
case pos
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : n = m
h₂ : m = n
⊢ a = a

Next tactic:
first |rfl|subst m; contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |

Proof state:
case pos
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : n = m
h₂ : m = n
⊢ a = a

Next tactic:
rfl
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> 

Proof state:
case neg
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : n = m
h₂ : ¬m = n
⊢ a = 0

Next tactic:
first |rfl|subst m; contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |

Proof state:
case neg
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : n = m
h₂ : ¬m = n
⊢ a = 0

Next tactic:
rfl
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |rfl|

Proof state:
case neg
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : n = m
h₂ : ¬m = n
⊢ a = 0

Next tactic:
subst m
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |rfl|subst m; 

Proof state:
case neg
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
h₂ : ¬n = n
⊢ a = 0

Next tactic:
contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> 

Proof state:
case pos
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : ¬n = m
h✝ : m = n
⊢ 0 = a

Next tactic:
first |rfl|subst m; contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |

Proof state:
case pos
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : ¬n = m
h✝ : m = n
⊢ 0 = a

Next tactic:
rfl