l3lab/ntp-mathlib huggingface dataset:
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        

Proof state:
case inr.hl
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
x : S
h✝ : Nontrivial R
i : ℕ
hi : natDegree f ≤ i
⊢ coeff
      ({ toFun := fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f,
          map_add' :=
            (_ :
              ∀ (x y : S),
                (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) (x + y) =
                  (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) x +
                    (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) y) }
        x)
      i =
    0

Next tactic:
by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · 

Proof state:
case pos
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
x : S
h✝ : Nontrivial R
i : ℕ
hi : natDegree f ≤ i
hx : IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f = 0
⊢ coeff
      ({ toFun := fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f,
          map_add' :=
            (_ :
              ∀ (x y : S),
                (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) (x + y) =
                  (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) x +
                    (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) y) }
        x)
      i =
    0

Next tactic:
simp [hx]
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        

Proof state:
case neg
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
x : S
h✝ : Nontrivial R
i : ℕ
hi : natDegree f ≤ i
hx : ¬IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f = 0
⊢ coeff
      ({ toFun := fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f,
          map_add' :=
            (_ :
              ∀ (x y : S),
                (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) (x + y) =
                  (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) x +
                    (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) y) }
        x)
      i =
    0

Next tactic:
refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        

Proof state:
case neg
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
x : S
h✝ : Nontrivial R
i : ℕ
hi : natDegree f ≤ i
hx : ¬IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f = 0
⊢ natDegree
      ({ toFun := fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f,
          map_add' :=
            (_ :
              ∀ (x y : S),
                (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) (x + y) =
                  (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) x +
                    (fun x => IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) y) }
        x) <
    natDegree f

Next tactic:
dsimp
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        

Proof state:
case neg
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
x : S
h✝ : Nontrivial R
i : ℕ
hi : natDegree f ≤ i
hx : ¬IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f = 0
⊢ natDegree (IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) < natDegree f

Next tactic:
rw [natDegree_lt_natDegree_iff hx]
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · 

Proof state:
case neg
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
x : S
h✝ : Nontrivial R
i : ℕ
hi : natDegree f ≤ i
hx : ¬IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f = 0
⊢ degree (IsAdjoinRoot.repr h.toIsAdjoinRoot x %ₘ f) < degree f

Next tactic:
exact degree_modByMonic_lt _ h.Monic
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ coeff ({ toFinsupp := Finsupp.mapDomain Fin.val g } %ₘ f) ↑i = g i

Next tactic:
rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ (match (motive := R[X] → ℕ → R) { toFinsupp := Finsupp.mapDomain Fin.val g } with
      | { toFinsupp := p } => ⇑p)
      ↑i =
    g i
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ degree { toFinsupp := Finsupp.mapDomain Fin.val g } < degree f

Next tactic:
dsimp only
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
        dsimp only -- Porting note: added
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ (Finsupp.mapDomain Fin.val g) ↑i = g i
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ degree { toFinsupp := Finsupp.mapDomain Fin.val g } < degree f

Next tactic:
rw [Finsupp.mapDomain_apply Fin.val_injective]
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
        dsimp only -- Porting note: added
        rw [Finsupp.mapDomain_apply Fin.val_injective]
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ degree { toFinsupp := Finsupp.mapDomain Fin.val g } < degree f

Next tactic:
rw [degree_eq_natDegree h.Monic.ne_zero, degree_lt_iff_coeff_zero]
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
        dsimp only -- Porting note: added
        rw [Finsupp.mapDomain_apply Fin.val_injective]
        rw [degree_eq_natDegree h.Monic.ne_zero, degree_lt_iff_coeff_zero]
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
⊢ ∀ (m : ℕ), natDegree f ≤ m → coeff { toFinsupp := Finsupp.mapDomain Fin.val g } m = 0

Next tactic:
intro m hm
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
        dsimp only -- Porting note: added
        rw [Finsupp.mapDomain_apply Fin.val_injective]
        rw [degree_eq_natDegree h.Monic.ne_zero, degree_lt_iff_coeff_zero]
        intro m hm
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
m : ℕ
hm : natDegree f ≤ m
⊢ coeff { toFinsupp := Finsupp.mapDomain Fin.val g } m = 0

Next tactic:
rw [Polynomial.coeff]
/-- The basis on `S` generated by powers of `h.root`.

Auxiliary definition for `IsAdjoinRootMonic.powerBasis`. -/
def basis (h : IsAdjoinRootMonic S f) : Basis (Fin (natDegree f)) R S :=
  Basis.ofRepr
    { toFun := fun x => (h.modByMonicHom x).toFinsupp.comapDomain _ (Fin.val_injective.injOn _)
      invFun := fun g => h.map (ofFinsupp (g.mapDomain _))
      left_inv := fun x => by
        cases subsingleton_or_nontrivial R
        · haveI := h.subsingleton
          exact Subsingleton.elim _ _
        simp only
        rw [Finsupp.mapDomain_comapDomain, Polynomial.eta, h.map_modByMonicHom x]
        · exact Fin.val_injective
        intro i hi
        refine Set.mem_range.mpr ⟨⟨i, ?_⟩, rfl⟩
        contrapose! hi
        simp only [Polynomial.toFinsupp_apply, Classical.not_not, Finsupp.mem_support_iff, Ne.def,
          modByMonicHom, LinearMap.coe_mk, Finset.mem_coe]
        by_cases hx : h.toIsAdjoinRoot.repr x %ₘ f = 0
        · simp [hx]
        refine coeff_eq_zero_of_natDegree_lt (lt_of_lt_of_le ?_ hi)
        dsimp -- Porting note: added
        rw [natDegree_lt_natDegree_iff hx]
        · exact degree_modByMonic_lt _ h.Monic
      right_inv := fun g => by
        nontriviality R
        ext i
        simp only [h.modByMonicHom_map, Finsupp.comapDomain_apply, Polynomial.toFinsupp_apply]
        rw [(Polynomial.modByMonic_eq_self_iff h.Monic).mpr, Polynomial.coeff]
        dsimp only -- Porting note: added
        rw [Finsupp.mapDomain_apply Fin.val_injective]
        rw [degree_eq_natDegree h.Monic.ne_zero, degree_lt_iff_coeff_zero]
        intro m hm
        rw [Polynomial.coeff]
        

Proof state:
case h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : Ring S
f : R[X]
inst✝ : Algebra R S
h : IsAdjoinRootMonic S f
g : Fin (natDegree f) →₀ R
✝ : Nontrivial R
i : Fin (natDegree f)
m : ℕ
hm : natDegree f ≤ m
⊢ (match (motive := R[X] → ℕ → R) { toFinsupp := Finsupp.mapDomain Fin.val g } with
      | { toFinsupp := p } => ⇑p)
      m =
    0

Next tactic:
dsimp only