l3lab/ntp-mathlib huggingface dataset:
/-- `LinearMap.toAddMonoidHom` promoted to an `AddMonoidHom`. -/
@[simps]
def toAddMonoidHom' : (M →ₛₗ[σ₁₂] M₂) →+ M →+ M₂ where
  toFun := toAddMonoidHom
  map_zero' := by ext; rfl
  map_add' := by 

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
⊢ ∀ (x y : M →ₛₗ[σ₁₂] M₂),
    ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } (x + y) =
      ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } x +
        ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } y

Next tactic:
intros
/-- `LinearMap.toAddMonoidHom` promoted to an `AddMonoidHom`. -/
@[simps]
def toAddMonoidHom' : (M →ₛₗ[σ₁₂] M₂) →+ M →+ M₂ where
  toFun := toAddMonoidHom
  map_zero' := by ext; rfl
  map_add' := by intros; 

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
x✝ y✝ : M →ₛₗ[σ₁₂] M₂
⊢ ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } (x✝ + y✝) =
    ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } x✝ +
      ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } y✝

Next tactic:
ext
/-- `LinearMap.toAddMonoidHom` promoted to an `AddMonoidHom`. -/
@[simps]
def toAddMonoidHom' : (M →ₛₗ[σ₁₂] M₂) →+ M →+ M₂ where
  toFun := toAddMonoidHom
  map_zero' := by ext; rfl
  map_add' := by intros; ext; 

Proof state:
case h
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
x✝¹ y✝ : M →ₛₗ[σ₁₂] M₂
x✝ : M
⊢ (ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } (x✝¹ + y✝)) x✝ =
    (ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } x✝¹ +
        ZeroHom.toFun { toFun := toAddMonoidHom, map_zero' := (_ : toAddMonoidHom 0 = 0) } y✝)
      x✝

Next tactic:
rfl
instance [Nontrivial M] : Nontrivial (Module.End R M) := by
  

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹² : Semiring R
inst✝¹¹ : Semiring R₂
inst✝¹⁰ : Semiring R₃
inst✝⁹ : AddCommMonoid M
inst✝⁸ : AddCommMonoid M₁
inst✝⁷ : AddCommMonoid M₂
inst✝⁶ : AddCommMonoid M₃
inst✝⁵ : Module R M
inst✝⁴ : Module R M₁
inst✝³ : Module R₂ M₂
inst✝² : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝¹ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
inst✝ : Nontrivial M
⊢ Nontrivial (Module.End R M)

Next tactic:
obtain ⟨m, ne⟩ := exists_ne (0 : M)
instance [Nontrivial M] : Nontrivial (Module.End R M) := by
  obtain ⟨m, ne⟩ := exists_ne (0 : M)
  

Proof state:
case intro
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹² : Semiring R
inst✝¹¹ : Semiring R₂
inst✝¹⁰ : Semiring R₃
inst✝⁹ : AddCommMonoid M
inst✝⁸ : AddCommMonoid M₁
inst✝⁷ : AddCommMonoid M₂
inst✝⁶ : AddCommMonoid M₃
inst✝⁵ : Module R M
inst✝⁴ : Module R M₁
inst✝³ : Module R₂ M₂
inst✝² : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝¹ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
inst✝ : Nontrivial M
m : M
ne : m ≠ 0
⊢ Nontrivial (Module.End R M)

Next tactic:
exact nontrivial_of_ne 1 0 fun p => ne (LinearMap.congr_fun p m)
theorem submodule_pow_eq_zero_of_pow_eq_zero {N : Submodule R M} {g : Module.End R N}
    {G : Module.End R M} (h : G.comp N.subtype = N.subtype.comp g) {k : ℕ} (hG : G ^ k = 0) :
    g ^ k = 0 := by
  

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g✝ : M₂ →ₛₗ[σ₂₃] M₃
N : Submodule R M
g : Module.End R ↥N
G : Module.End R M
h : G ∘ₗ Submodule.subtype N = Submodule.subtype N ∘ₗ g
k : ℕ
hG : G ^ k = 0
⊢ g ^ k = 0

Next tactic:
ext m
theorem submodule_pow_eq_zero_of_pow_eq_zero {N : Submodule R M} {g : Module.End R N}
    {G : Module.End R M} (h : G.comp N.subtype = N.subtype.comp g) {k : ℕ} (hG : G ^ k = 0) :
    g ^ k = 0 := by
  ext m
  

Proof state:
case h.a
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g✝ : M₂ →ₛₗ[σ₂₃] M₃
N : Submodule R M
g : Module.End R ↥N
G : Module.End R M
h : G ∘ₗ Submodule.subtype N = Submodule.subtype N ∘ₗ g
k : ℕ
hG : G ^ k = 0
m : ↥N
⊢ ↑((g ^ k) m) = ↑(0 m)

Next tactic:
have hg : N.subtype.comp (g ^ k) m = 0 := by
    rw [← commute_pow_left_of_commute h, hG, zero_comp, zero_apply]
theorem submodule_pow_eq_zero_of_pow_eq_zero {N : Submodule R M} {g : Module.End R N}
    {G : Module.End R M} (h : G.comp N.subtype = N.subtype.comp g) {k : ℕ} (hG : G ^ k = 0) :
    g ^ k = 0 := by
  ext m
  have hg : N.subtype.comp (g ^ k) m = 0 := by
    

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g✝ : M₂ →ₛₗ[σ₂₃] M₃
N : Submodule R M
g : Module.End R ↥N
G : Module.End R M
h : G ∘ₗ Submodule.subtype N = Submodule.subtype N ∘ₗ g
k : ℕ
hG : G ^ k = 0
m : ↥N
⊢ (Submodule.subtype N ∘ₗ g ^ k) m = 0

Next tactic:
rw [← commute_pow_left_of_commute h, hG, zero_comp, zero_apply]
theorem submodule_pow_eq_zero_of_pow_eq_zero {N : Submodule R M} {g : Module.End R N}
    {G : Module.End R M} (h : G.comp N.subtype = N.subtype.comp g) {k : ℕ} (hG : G ^ k = 0) :
    g ^ k = 0 := by
  ext m
  have hg : N.subtype.comp (g ^ k) m = 0 := by
    rw [← commute_pow_left_of_commute h, hG, zero_comp, zero_apply]
  

Proof state:
case h.a
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g✝ : M₂ →ₛₗ[σ₂₃] M₃
N : Submodule R M
g : Module.End R ↥N
G : Module.End R M
h : G ∘ₗ Submodule.subtype N = Submodule.subtype N ∘ₗ g
k : ℕ
hG : G ^ k = 0
m : ↥N
hg : (Submodule.subtype N ∘ₗ g ^ k) m = 0
⊢ ↑((g ^ k) m) = ↑(0 m)

Next tactic:
simpa using hg
theorem pow_apply_mem_of_forall_mem {p : Submodule R M} (n : ℕ) (h : ∀ x ∈ p, f' x ∈ p) (x : M)
    (hx : x ∈ p) : (f' ^ n) x ∈ p := by
  

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
f' : M →ₗ[R] M
p : Submodule R M
n : ℕ
h : ∀ x ∈ p, f' x ∈ p
x : M
hx : x ∈ p
⊢ (f' ^ n) x ∈ p

Next tactic:
induction' n with n ih generalizing x
theorem pow_apply_mem_of_forall_mem {p : Submodule R M} (n : ℕ) (h : ∀ x ∈ p, f' x ∈ p) (x : M)
    (hx : x ∈ p) : (f' ^ n) x ∈ p := by
  induction' n with n ih generalizing x
  · 

Proof state:
case zero
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
f' : M →ₗ[R] M
p : Submodule R M
h : ∀ x ∈ p, f' x ∈ p
x : M
hx : x ∈ p
⊢ (f' ^ Nat.zero) x ∈ p

Next tactic:
simpa
theorem pow_apply_mem_of_forall_mem {p : Submodule R M} (n : ℕ) (h : ∀ x ∈ p, f' x ∈ p) (x : M)
    (hx : x ∈ p) : (f' ^ n) x ∈ p := by
  induction' n with n ih generalizing x
  · simpa
  · 

Proof state:
case succ
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
f' : M →ₗ[R] M
p : Submodule R M
h : ∀ x ∈ p, f' x ∈ p
n : ℕ
ih : ∀ x ∈ p, (f' ^ n) x ∈ p
x : M
hx : x ∈ p
⊢ (f' ^ Nat.succ n) x ∈ p

Next tactic:
simpa only [iterate_succ, coe_comp, Function.comp_apply, restrict_apply] using ih _ (h _ hx)
theorem pow_restrict {p : Submodule R M} (n : ℕ) (h : ∀ x ∈ p, f' x ∈ p)
    (h' := pow_apply_mem_of_forall_mem n h) :
    (f'.restrict h) ^ n = (f' ^ n).restrict h' := by
  

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
f' : M →ₗ[R] M
p : Submodule R M
n : ℕ
h : ∀ x ∈ p, f' x ∈ p
h' : optParam (∀ x ∈ p, (f' ^ n) x ∈ p) (_ : ∀ x ∈ p, (f' ^ n) x ∈ p)
⊢ restrict f' h ^ n = restrict (f' ^ n) h'

Next tactic:
ext x
theorem pow_restrict {p : Submodule R M} (n : ℕ) (h : ∀ x ∈ p, f' x ∈ p)
    (h' := pow_apply_mem_of_forall_mem n h) :
    (f'.restrict h) ^ n = (f' ^ n).restrict h' := by
  ext x
  

Proof state:
case h.a
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
f' : M →ₗ[R] M
p : Submodule R M
n : ℕ
h : ∀ x ∈ p, f' x ∈ p
h' : optParam (∀ x ∈ p, (f' ^ n) x ∈ p) (_ : ∀ x ∈ p, (f' ^ n) x ∈ p)
x : ↥p
⊢ ↑((restrict f' h ^ n) x) = ↑((restrict (f' ^ n) h') x)

Next tactic:
have : Semiconj (↑) (f'.restrict h) f' := fun _ ↦ restrict_coe_apply _ _ _
theorem pow_restrict {p : Submodule R M} (n : ℕ) (h : ∀ x ∈ p, f' x ∈ p)
    (h' := pow_apply_mem_of_forall_mem n h) :
    (f'.restrict h) ^ n = (f' ^ n).restrict h' := by
  ext x
  have : Semiconj (↑) (f'.restrict h) f' := fun _ ↦ restrict_coe_apply _ _ _
  

Proof state:
case h.a
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝¹¹ : Semiring R
inst✝¹⁰ : Semiring R₂
inst✝⁹ : Semiring R₃
inst✝⁸ : AddCommMonoid M
inst✝⁷ : AddCommMonoid M₁
inst✝⁶ : AddCommMonoid M₂
inst✝⁵ : AddCommMonoid M₃
inst✝⁴ : Module R M
inst✝³ : Module R M₁
inst✝² : Module R₂ M₂
inst✝¹ : Module R₃ M₃
σ₁₂ : R →+* R₂
σ₂₃ : R₂ →+* R₃
σ₁₃ : R →+* R₃
inst✝ : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃
f : M →ₛₗ[σ₁₂] M₂
g : M₂ →ₛₗ[σ₂₃] M₃
f' : M →ₗ[R] M
p : Submodule R M
n : ℕ
h : ∀ x ∈ p, f' x ∈ p
h' : optParam (∀ x ∈ p, (f' ^ n) x ∈ p) (_ : ∀ x ∈ p, (f' ^ n) x ∈ p)
x : ↥p
this : Semiconj Subtype.val ⇑(restrict f' h) ⇑f'
⊢ ↑((restrict f' h ^ n) x) = ↑((restrict (f' ^ n) h') x)

Next tactic:
simp [coe_pow, this.iterate_right _ _]
/-- Alternative version of `domRestrict` as a linear map. -/
def domRestrict' (p : Submodule R M) : (M →ₗ[R] M₂) →ₗ[R] p →ₗ[R] M₂ where
  toFun φ := φ.domRestrict p
  map_add' := by 

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝⁴ : CommSemiring R
inst✝³ : AddCommMonoid M
inst✝² : AddCommMonoid M₂
inst✝¹ : Module R M
inst✝ : Module R M₂
f g : M →ₗ[R] M₂
p : Submodule R M
⊢ ∀ (x y : M →ₗ[R] M₂), (fun φ => domRestrict φ p) (x + y) = (fun φ => domRestrict φ p) x + (fun φ => domRestrict φ p) y

Next tactic:
simp [LinearMap.ext_iff]
/-- Alternative version of `domRestrict` as a linear map. -/
def domRestrict' (p : Submodule R M) : (M →ₗ[R] M₂) →ₗ[R] p →ₗ[R] M₂ where
  toFun φ := φ.domRestrict p
  map_add' := by simp [LinearMap.ext_iff]
  map_smul' := by 

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
M : Type u_5
M₁ : Type u_6
M₂ : Type u_7
M₃ : Type u_8
ι : Type u_9
inst✝⁴ : CommSemiring R
inst✝³ : AddCommMonoid M
inst✝² : AddCommMonoid M₂
inst✝¹ : Module R M
inst✝ : Module R M₂
f g : M →ₗ[R] M₂
p : Submodule R M
⊢ ∀ (r : R) (x : M →ₗ[R] M₂),
    AddHom.toFun
        { toFun := fun φ => domRestrict φ p,
          map_add' := (_ : ∀ (a a_1 : M →ₗ[R] M₂), domRestrict (a + a_1) p = domRestrict a p + domRestrict a_1 p) }
        (r • x) =
      (RingHom.id R) r •
        AddHom.toFun
          { toFun := fun φ => domRestrict φ p,
            map_add' := (_ : ∀ (a a_1 : M →ₗ[R] M₂), domRestrict (a + a_1) p = domRestrict a p + domRestrict a_1 p) }
          x

Next tactic:
simp [LinearMap.ext_iff]
theorem subtype_comp_inclusion (p q : Submodule R M) (h : p ≤ q) :
    q.subtype.comp (inclusion h) = p.subtype := by
  

Proof state:
R : Type u_1
M : Type u_2
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p✝ p' p q : Submodule R M
h : p ≤ q
⊢ Submodule.subtype q ∘ₗ inclusion h = Submodule.subtype p

Next tactic:
ext ⟨b, hb⟩
theorem subtype_comp_inclusion (p q : Submodule R M) (h : p ≤ q) :
    q.subtype.comp (inclusion h) = p.subtype := by
  ext ⟨b, hb⟩
  

Proof state:
case h.mk
R : Type u_1
M : Type u_2
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
p✝ p' p q : Submodule R M
h : p ≤ q
b : M
hb : b ∈ p
⊢ (Submodule.subtype q ∘ₗ inclusion h) { val := b, property := hb } = (Submodule.subtype p) { val := b, property := hb }

Next tactic:
rfl
@[to_additive]
instance fintypeBot : Fintype (⊥ : Subgroup G) :=
  ⟨{1}, by
    

Proof state:
G : Type u_1
inst✝¹ : Group G
A : Type u_2
inst✝ : AddGroup A
H K : Subgroup G
⊢ ∀ (x : ↥⊥), x ∈ {1}

Next tactic:
rintro ⟨x, ⟨hx⟩⟩
@[to_additive]
instance fintypeBot : Fintype (⊥ : Subgroup G) :=
  ⟨{1}, by
    rintro ⟨x, ⟨hx⟩⟩
    

Proof state:
case mk.refl
G : Type u_1
inst✝¹ : Group G
A : Type u_2
inst✝ : AddGroup A
H K : Subgroup G
⊢ { val := 1, property := (_ : 1 = 1) } ∈ {1}

Next tactic:
exact Finset.mem_singleton_self _
@[to_additive]
theorem card_top [Fintype G] : Fintype.card (⊤ : Subgroup G) = Fintype.card G := by
  

Proof state:
G : Type u_1
inst✝² : Group G
A : Type u_2
inst✝¹ : AddGroup A
H K : Subgroup G
inst✝ : Fintype G
⊢ Fintype.card ↥⊤ = Fintype.card G

Next tactic:
rw [Fintype.card_eq]
@[to_additive]
theorem card_top [Fintype G] : Fintype.card (⊤ : Subgroup G) = Fintype.card G := by
  rw [Fintype.card_eq]
  

Proof state:
G : Type u_1
inst✝² : Group G
A : Type u_2
inst✝¹ : AddGroup A
H K : Subgroup G
inst✝ : Fintype G
⊢ Nonempty (↥⊤ ≃ G)

Next tactic:
exact Nonempty.intro Subgroup.topEquiv.toEquiv
@[to_additive]
theorem eq_top_of_card_eq [Fintype H] [Fintype G] (h : Fintype.card H = Fintype.card G) :
    H = ⊤ := by
  

Proof state:
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
H K : Subgroup G
inst✝¹ : Fintype ↥H
inst✝ : Fintype G
h : Fintype.card ↥H = Fintype.card G
⊢ H = ⊤

Next tactic:
letI : Fintype (H : Set G) := ‹Fintype H›
@[to_additive]
theorem eq_top_of_card_eq [Fintype H] [Fintype G] (h : Fintype.card H = Fintype.card G) :
    H = ⊤ := by
  letI : Fintype (H : Set G) := ‹Fintype H›
  

Proof state:
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
H K : Subgroup G
inst✝¹ : Fintype ↥H
inst✝ : Fintype G
h : Fintype.card ↥H = Fintype.card G
this : Fintype ↑↑H := inst✝¹
⊢ H = ⊤

Next tactic:
rw [SetLike.ext'_iff, coe_top, ← Finset.coe_univ, ← (H : Set G).coe_toFinset, Finset.coe_inj, ←
    Finset.card_eq_iff_eq_univ, ← h, Set.toFinset_card]
@[to_additive]
theorem eq_top_of_card_eq [Fintype H] [Fintype G] (h : Fintype.card H = Fintype.card G) :
    H = ⊤ := by
  letI : Fintype (H : Set G) := ‹Fintype H›
  rw [SetLike.ext'_iff, coe_top, ← Finset.coe_univ, ← (H : Set G).coe_toFinset, Finset.coe_inj, ←
    Finset.card_eq_iff_eq_univ, ← h, Set.toFinset_card]
  

Proof state:
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
H K : Subgroup G
inst✝¹ : Fintype ↥H
inst✝ : Fintype G
h : Fintype.card ↥H = Fintype.card G
this : Fintype ↑↑H := inst✝¹
⊢ Fintype.card ↑↑H = Fintype.card ↥H

Next tactic:
congr
@[to_additive (attr := simp)]
theorem card_eq_iff_eq_top [Fintype H] [Fintype G] : Fintype.card H = Fintype.card G ↔ H = ⊤ :=
  Iff.intro (eq_top_of_card_eq H) (fun h ↦ by 

Proof state:
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
H K : Subgroup G
inst✝¹ : Fintype ↥H
inst✝ : Fintype G
h : H = ⊤
⊢ Fintype.card ↥H = Fintype.card G

Next tactic:
simpa only [h] using card_top
@[to_additive card_le_one_iff_eq_bot]
theorem card_le_one_iff_eq_bot [Fintype H] : Fintype.card H ≤ 1 ↔ H = ⊥ :=
  ⟨fun h =>
    (eq_bot_iff_forall _).2 fun x hx => by
      

Proof state:
G : Type u_1
inst✝² : Group G
A : Type u_2
inst✝¹ : AddGroup A
H K : Subgroup G
inst✝ : Fintype ↥H
h : Fintype.card ↥H ≤ 1
x : G
hx : x ∈ H
⊢ x = 1

Next tactic:
simpa [Subtype.ext_iff] using Fintype.card_le_one_iff.1 h ⟨x, hx⟩ 1
@[to_additive card_le_one_iff_eq_bot]
theorem card_le_one_iff_eq_bot [Fintype H] : Fintype.card H ≤ 1 ↔ H = ⊥ :=
  ⟨fun h =>
    (eq_bot_iff_forall _).2 fun x hx => by
      simpa [Subtype.ext_iff] using Fintype.card_le_one_iff.1 h ⟨x, hx⟩ 1,
    fun h => by 

Proof state:
G : Type u_1
inst✝² : Group G
A : Type u_2
inst✝¹ : AddGroup A
H K : Subgroup G
inst✝ : Fintype ↥H
h : H = ⊥
⊢ Fintype.card ↥H ≤ 1

Next tactic:
simp [h]
@[to_additive] lemma eq_bot_iff_card [Fintype H] : H = ⊥ ↔ Fintype.card H = 1 :=
  ⟨by 

Proof state:
G : Type u_1
inst✝² : Group G
A : Type u_2
inst✝¹ : AddGroup A
H K : Subgroup G
inst✝ : Fintype ↥H
⊢ H = ⊥ → Fintype.card ↥H = 1

Next tactic:
rintro rfl
@[to_additive] lemma eq_bot_iff_card [Fintype H] : H = ⊥ ↔ Fintype.card H = 1 :=
  ⟨by rintro rfl; 

Proof state:
G : Type u_1
inst✝² : Group G
A : Type u_2
inst✝¹ : AddGroup A
K : Subgroup G
inst✝ : Fintype ↥⊥
⊢ Fintype.card ↥⊥ = 1

Next tactic:
exact card_bot
@[to_additive]
theorem pi_mem_of_mulSingle_mem_aux [DecidableEq η] (I : Finset η) {H : Subgroup (∀ i, f i)}
    (x : ∀ i, f i) (h1 : ∀ i, i ∉ I → x i = 1) (h2 : ∀ i, i ∈ I → Pi.mulSingle i (x i) ∈ H) :
    x ∈ H := by
  

Proof state:
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
η : Type u_3
f : η → Type u_4
inst✝¹ : (i : η) → Group (f i)
inst✝ : DecidableEq η
I : Finset η
H : Subgroup ((i : η) → f i)
x : (i : η) → f i
h1 : ∀ i ∉ I, x i = 1
h2 : ∀ i ∈ I, Pi.mulSingle i (x i) ∈ H
⊢ x ∈ H

Next tactic:
induction' I using Finset.induction_on with i I hnmem ih generalizing x
@[to_additive]
theorem pi_mem_of_mulSingle_mem_aux [DecidableEq η] (I : Finset η) {H : Subgroup (∀ i, f i)}
    (x : ∀ i, f i) (h1 : ∀ i, i ∉ I → x i = 1) (h2 : ∀ i, i ∈ I → Pi.mulSingle i (x i) ∈ H) :
    x ∈ H := by
  induction' I using Finset.induction_on with i I hnmem ih generalizing x
  · 

Proof state:
case empty
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
η : Type u_3
f : η → Type u_4
inst✝¹ : (i : η) → Group (f i)
inst✝ : DecidableEq η
H : Subgroup ((i : η) → f i)
x : (i : η) → f i
h1 : ∀ i ∉ ∅, x i = 1
h2 : ∀ i ∈ ∅, Pi.mulSingle i (x i) ∈ H
⊢ x ∈ H

Next tactic:
convert one_mem H
@[to_additive]
theorem pi_mem_of_mulSingle_mem_aux [DecidableEq η] (I : Finset η) {H : Subgroup (∀ i, f i)}
    (x : ∀ i, f i) (h1 : ∀ i, i ∉ I → x i = 1) (h2 : ∀ i, i ∈ I → Pi.mulSingle i (x i) ∈ H) :
    x ∈ H := by
  induction' I using Finset.induction_on with i I hnmem ih generalizing x
  · convert one_mem H
    

Proof state:
case h.e'_4
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
η : Type u_3
f : η → Type u_4
inst✝¹ : (i : η) → Group (f i)
inst✝ : DecidableEq η
H : Subgroup ((i : η) → f i)
x : (i : η) → f i
h1 : ∀ i ∉ ∅, x i = 1
h2 : ∀ i ∈ ∅, Pi.mulSingle i (x i) ∈ H
⊢ x = 1

Next tactic:
ext i
@[to_additive]
theorem pi_mem_of_mulSingle_mem_aux [DecidableEq η] (I : Finset η) {H : Subgroup (∀ i, f i)}
    (x : ∀ i, f i) (h1 : ∀ i, i ∉ I → x i = 1) (h2 : ∀ i, i ∈ I → Pi.mulSingle i (x i) ∈ H) :
    x ∈ H := by
  induction' I using Finset.induction_on with i I hnmem ih generalizing x
  · convert one_mem H
    ext i
    

Proof state:
case h.e'_4.h
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
η : Type u_3
f : η → Type u_4
inst✝¹ : (i : η) → Group (f i)
inst✝ : DecidableEq η
H : Subgroup ((i : η) → f i)
x : (i : η) → f i
h1 : ∀ i ∉ ∅, x i = 1
h2 : ∀ i ∈ ∅, Pi.mulSingle i (x i) ∈ H
i : η
⊢ x i = OfNat.ofNat 1 i

Next tactic:
exact h1 i (Finset.not_mem_empty i)
@[to_additive]
theorem pi_mem_of_mulSingle_mem_aux [DecidableEq η] (I : Finset η) {H : Subgroup (∀ i, f i)}
    (x : ∀ i, f i) (h1 : ∀ i, i ∉ I → x i = 1) (h2 : ∀ i, i ∈ I → Pi.mulSingle i (x i) ∈ H) :
    x ∈ H := by
  induction' I using Finset.induction_on with i I hnmem ih generalizing x
  · convert one_mem H
    ext i
    exact h1 i (Finset.not_mem_empty i)
  · 

Proof state:
case insert
G : Type u_1
inst✝³ : Group G
A : Type u_2
inst✝² : AddGroup A
η : Type u_3
f : η → Type u_4
inst✝¹ : (i : η) → Group (f i)
inst✝ : DecidableEq η
H : Subgroup ((i : η) → f i)
i : η
I : Finset η
hnmem : i ∉ I
ih : ∀ (x : (i : η) → f i), (∀ i ∉ I, x i = 1) → (∀ i ∈ I, Pi.mulSingle i (x i) ∈ H) → x ∈ H
x : (i : η) → f i
h1 : ∀ i_1 ∉ insert i I, x i_1 = 1
h2 : ∀ i_1 ∈ insert i I, Pi.mulSingle i_1 (x i_1) ∈ H
⊢ x ∈ H

Next tactic:
have : x = Function.update x i 1 * Pi.mulSingle i (x i) := by
      ext j
      by_cases heq : j = i
      · subst heq
        simp
      · simp [heq]