l3lab/ntp-mathlib huggingface dataset:
theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]
    [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :
    ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by
  obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx
  obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h
  use T, T', hS, hS'
  have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast
  have h'' := span_mono h' hU
  

Proof state:
case right
ι : Sort uι
R✝ : Type u
inst✝⁶ : CommSemiring R✝
A✝ : Type v
inst✝⁵ : Semiring A✝
inst✝⁴ : Algebra R✝ A✝
S✝ T✝ : Set A✝
M N P Q : Submodule R✝ A✝
m n : A✝
R : Type u_1
A : Type u_2
inst✝³ : Semiring R
inst✝² : AddCommMonoid A
inst✝¹ : Mul A
inst✝ : Module R A
S S' : Set A
x : A
hx : x ∈ span R (S * S')
U : Finset A
h✝ : ↑U ⊆ S * S'
hU : x ∈ span R ↑U
T T' : Finset A
hS : ↑T ⊆ S
hS' : ↑T' ⊆ S'
h : U ⊆ T * T'
h' : ↑U ⊆ ↑T * ↑T'
h'' : x ∈ span R (↑T * ↑T')
⊢ x ∈ span R (↑T * ↑T')

Next tactic:
assumption
theorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :
    ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=
  Submodule.mem_span_mul_finite_of_mem_span_mul
    (by 

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P✝ Q✝ : Submodule R A
m n : A
P Q : Submodule R A
x : A
hx : x ∈ P * Q
⊢ x ∈ span R (↑P * ↑Q)

Next tactic:
rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx
theorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by
  --porting note: need both `*` and `Mul.mul`
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n x y : A
⊢ x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x

Next tactic:
simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]
theorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by
  --porting note: need both `*` and `Mul.mul`
  simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n x y : A
⊢ x ∈ map ((LinearMap.mul R A) y) P ↔ ∃ z ∈ P, Mul.mul y z = x

Next tactic:
rfl
theorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by
  --porting note: need both `*` and `Mul.mul`
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n x y : A
⊢ x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x

Next tactic:
simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]
theorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by
  --porting note: need both `*` and `Mul.mul`
  simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n x y : A
⊢ x ∈ map ((LinearMap.flip (LinearMap.mul R A)) y) P ↔ ∃ z ∈ P, Mul.mul z y = x

Next tactic:
rfl
lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}
    (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by
  

Proof state:
ι : Sort uι
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
S✝ T : Set A
M N P Q : Submodule R A
m n : A
S : Type u_1
inst✝¹ : Field S
inst✝ : Algebra R S
x : S
p : Submodule R S
y : S
hx : x ≠ 0
⊢ y ∈ x • p ↔ x⁻¹ * y ∈ p

Next tactic:
constructor
lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}
    (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by
  constructor
  · 

Proof state:
case mp
ι : Sort uι
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
S✝ T : Set A
M N P Q : Submodule R A
m n : A
S : Type u_1
inst✝¹ : Field S
inst✝ : Algebra R S
x : S
p : Submodule R S
y : S
hx : x ≠ 0
⊢ y ∈ x • p → x⁻¹ * y ∈ p

Next tactic:
rintro ⟨a, ha : a ∈ p, rfl⟩
lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}
    (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by
  constructor
  · rintro ⟨a, ha : a ∈ p, rfl⟩; 

Proof state:
case mp.intro.intro
ι : Sort uι
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
S✝ T : Set A
M N P Q : Submodule R A
m n : A
S : Type u_1
inst✝¹ : Field S
inst✝ : Algebra R S
x : S
p : Submodule R S
hx : x ≠ 0
a : S
ha : a ∈ p
⊢ x⁻¹ * (DistribMulAction.toLinearMap R S x) a ∈ p

Next tactic:
simpa [inv_mul_cancel_left₀ hx]
lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}
    (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by
  constructor
  · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]
  · 

Proof state:
case mpr
ι : Sort uι
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
S✝ T : Set A
M N P Q : Submodule R A
m n : A
S : Type u_1
inst✝¹ : Field S
inst✝ : Algebra R S
x : S
p : Submodule R S
y : S
hx : x ≠ 0
⊢ x⁻¹ * y ∈ p → y ∈ x • p

Next tactic:
exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩
lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}
    (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by
  constructor
  · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]
  · exact fun h ↦ ⟨_, h, by 

Proof state:
ι : Sort uι
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
S✝ T : Set A
M N P Q : Submodule R A
m n : A
S : Type u_1
inst✝¹ : Field S
inst✝ : Algebra R S
x : S
p : Submodule R S
y : S
hx : x ≠ 0
h : x⁻¹ * y ∈ p
⊢ (DistribMulAction.toLinearMap R S x) (x⁻¹ * y) = y

Next tactic:
simp [mul_inv_cancel_left₀ hx]
lemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}
    (hx : x ∈ nonZeroDivisors S) :
    x * y ∈ x • p ↔ y ∈ p :=
  show Exists _ ↔ _ by 

Proof state:
ι : Sort uι
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
S✝ T : Set A
M N P Q : Submodule R A
m n : A
S : Type u_1
inst✝¹ : CommRing S
inst✝ : Algebra R S
x : S
p : Submodule R S
y : S
hx : x ∈ nonZeroDivisors S
⊢ (∃ a ∈ ↑p, (DistribMulAction.toLinearMap R S x) a = x * y) ↔ y ∈ p

Next tactic:
simp [mul_cancel_left_mem_nonZeroDivisors hx]
/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/
instance idemSemiring : IdemSemiring (Submodule R A) :=
  { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,
    AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,
    (by 

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
src✝² : Semigroup (Submodule R A) :=
  Function.Injective.semigroup toAddSubmonoid (_ : Function.Injective toAddSubmonoid)
    (_ : ∀ (m n : Submodule R A), (m * n).toAddSubmonoid = m.toAddSubmonoid * n.toAddSubmonoid)
src✝¹ : AddMonoidWithOne (Submodule R A) := AddMonoidWithOne.unary
src✝ : AddCommMonoid (Submodule R A) := pointwiseAddCommMonoid
⊢ Lattice (Submodule R A)

Next tactic:
infer_instance
theorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)
  | 0 => by 

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
s : Set A
⊢ span R s ^ 0 = span R (s ^ 0)

Next tactic:
rw [pow_zero, pow_zero, one_eq_span_one_set]
theorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)
  | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]
  | n + 1 => by 

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
s : Set A
n : ℕ
⊢ span R s ^ (n + 1) = span R (s ^ (n + 1))

Next tactic:
rw [pow_succ, pow_succ, span_pow s n, span_mul_span]
theorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
⊢ M ^ n = span R (↑M ^ n)

Next tactic:
rw [← span_pow, span_eq]
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
h : n ≠ 0
⊢ (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n

Next tactic:
induction' n with n ih
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · 

Proof state:
case zero
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
h : Nat.zero ≠ 0
⊢ (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid ^ Nat.zero

Next tactic:
exact (h rfl).elim
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · exact (h rfl).elim
  · 

Proof state:
case succ
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
ih : n ≠ 0 → (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n
h : Nat.succ n ≠ 0
⊢ (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid ^ Nat.succ n

Next tactic:
rw [pow_succ, pow_succ, mul_toAddSubmonoid]
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · exact (h rfl).elim
  · rw [pow_succ, pow_succ, mul_toAddSubmonoid]
    

Proof state:
case succ
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
ih : n ≠ 0 → (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n
h : Nat.succ n ≠ 0
⊢ M.toAddSubmonoid * (M ^ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ n

Next tactic:
cases n with
    | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]
    | succ n => rw [ih n.succ_ne_zero]
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · exact (h rfl).elim
  · rw [pow_succ, pow_succ, mul_toAddSubmonoid]
    cases n with
    

Proof state:
case succ.zero
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
ih : Nat.zero ≠ 0 → (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid ^ Nat.zero
h : Nat.succ Nat.zero ≠ 0
⊢ M.toAddSubmonoid * (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.zero

Next tactic:
| zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · exact (h rfl).elim
  · rw [pow_succ, pow_succ, mul_toAddSubmonoid]
    cases n with
    | zero => 

Proof state:
case succ.zero
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
ih : Nat.zero ≠ 0 → (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid ^ Nat.zero
h : Nat.succ Nat.zero ≠ 0
⊢ M.toAddSubmonoid * (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.zero

Next tactic:
rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · exact (h rfl).elim
  · rw [pow_succ, pow_succ, mul_toAddSubmonoid]
    cases n with
    | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]
    

Proof state:
case succ.succ
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
ih : Nat.succ n ≠ 0 → (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid ^ Nat.succ n
h : Nat.succ (Nat.succ n) ≠ 0
⊢ M.toAddSubmonoid * (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.succ n

Next tactic:
| succ n => rw [ih n.succ_ne_zero]
theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by
  induction' n with n ih
  · exact (h rfl).elim
  · rw [pow_succ, pow_succ, mul_toAddSubmonoid]
    cases n with
    | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]
    | succ n => 

Proof state:
case succ.succ
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
ih : Nat.succ n ≠ 0 → (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid ^ Nat.succ n
h : Nat.succ (Nat.succ n) ≠ 0
⊢ M.toAddSubmonoid * (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.succ n

Next tactic:
rw [ih n.succ_ne_zero]
theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
⊢ M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid

Next tactic:
obtain rfl | hn := Decidable.eq_or_ne n 0
theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by
  obtain rfl | hn := Decidable.eq_or_ne n 0
  · 

Proof state:
case inl
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
⊢ M.toAddSubmonoid ^ 0 ≤ (M ^ 0).toAddSubmonoid

Next tactic:
rw [pow_zero, pow_zero]
theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by
  obtain rfl | hn := Decidable.eq_or_ne n 0
  · rw [pow_zero, pow_zero]
    

Proof state:
case inl
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
⊢ 1 ≤ 1.toAddSubmonoid

Next tactic:
exact le_one_toAddSubmonoid
theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by
  obtain rfl | hn := Decidable.eq_or_ne n 0
  · rw [pow_zero, pow_zero]
    exact le_one_toAddSubmonoid
  · 

Proof state:
case inr
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
n : ℕ
hn : n ≠ 0
⊢ M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid

Next tactic:
exact (pow_toAddSubmonoid M hn).ge
/-- Dependent version of `Submodule.pow_induction_on_left`. -/
@[elab_as_elim]
protected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A}
    (hx : x ∈ M ^ n) : C n x hx := by
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)
n : ℕ
x : A
hx : x ∈ M ^ n
⊢ C n x hx

Next tactic:
induction' n with n n_ih generalizing x
/-- Dependent version of `Submodule.pow_induction_on_left`. -/
@[elab_as_elim]
protected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A}
    (hx : x ∈ M ^ n) : C n x hx := by
  induction' n with n n_ih generalizing x
  · 

Proof state:
case zero
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)
x : A
hx : x ∈ M ^ Nat.zero
⊢ C Nat.zero x hx

Next tactic:
rw [pow_zero] at hx
/-- Dependent version of `Submodule.pow_induction_on_left`. -/
@[elab_as_elim]
protected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A}
    (hx : x ∈ M ^ n) : C n x hx := by
  induction' n with n n_ih generalizing x
  · rw [pow_zero] at hx
    

Proof state:
case zero
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)
x : A
hx✝ : x ∈ M ^ Nat.zero
hx : x ∈ 1
⊢ C Nat.zero x hx✝

Next tactic:
obtain ⟨r, rfl⟩ := hx
/-- Dependent version of `Submodule.pow_induction_on_left`. -/
@[elab_as_elim]
protected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A}
    (hx : x ∈ M ^ n) : C n x hx := by
  induction' n with n n_ih generalizing x
  · rw [pow_zero] at hx
    obtain ⟨r, rfl⟩ := hx
    

Proof state:
case zero.intro
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)
r : R
hx : (Algebra.linearMap R A) r ∈ M ^ Nat.zero
⊢ C Nat.zero ((Algebra.linearMap R A) r) hx

Next tactic:
exact hr r
/-- Dependent version of `Submodule.pow_induction_on_left`. -/
@[elab_as_elim]
protected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A}
    (hx : x ∈ M ^ n) : C n x hx := by
  induction' n with n n_ih generalizing x
  · rw [pow_zero] at hx
    obtain ⟨r, rfl⟩ := hx
    exact hr r
  

Proof state:
case succ
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)
n : ℕ
n_ih : ∀ {x : A} (hx : x ∈ M ^ n), C n x hx
x : A
hx : x ∈ M ^ Nat.succ n
⊢ C (Nat.succ n) x hx

Next tactic:
exact
    Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))
      (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx
/-- Dependent version of `Submodule.pow_induction_on_right`. -/
@[elab_as_elim]
protected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul :
      ∀ i x hx, C i x hx →
        ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by
  

Proof state:
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n✝ : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))
n : ℕ
x : A
hx : x ∈ M ^ n
⊢ C n x hx

Next tactic:
induction' n with n n_ih generalizing x
/-- Dependent version of `Submodule.pow_induction_on_right`. -/
@[elab_as_elim]
protected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}
    (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))
    (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))
    (hmul :
      ∀ i x hx, C i x hx →
        ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))
    -- porting note: swapped argument order to match order of `C`
    {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by
  induction' n with n n_ih generalizing x
  · 

Proof state:
case zero
ι : Sort uι
R : Type u
inst✝² : CommSemiring R
A : Type v
inst✝¹ : Semiring A
inst✝ : Algebra R A
S T : Set A
M N P Q : Submodule R A
m n : A
C : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop
hr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)
hadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)
hmul :
  ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),
    C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))
x : A
hx : x ∈ M ^ Nat.zero
⊢ C Nat.zero x hx

Next tactic:
rw [pow_zero] at hx