l3lab/ntp-mathlib huggingface dataset:
/-- If `f` and `g` are commuting endomorphisms of a finite, free `R`-module `M`, such that `f`
is triangularizable, then to prove that the trace of `g ∘ f` vanishes, it is sufficient to prove
that the trace of `g` vanishes on each generalized eigenspace of `f`. -/
lemma trace_comp_eq_zero_of_commute_of_trace_restrict_eq_zero
    [IsDomain R] [IsPrincipalIdealRing R] [Module.Free R M] [Module.Finite R M]
    {f g : Module.End R M}
    (h_comm : Commute f g)
    (hf : ⨆ μ, ⨆ k, f.generalizedEigenspace μ k = ⊤)
    (hg : ∀ μ, trace R _ (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ)) = 0) :
    trace R _ (g ∘ₗ f) = 0 := by
  have hfg : ∀ μ,
      MapsTo (g ∘ₗ f) ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
    fun μ ↦ (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ).comp
      (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)
  suffices ∀ μ, trace R _ ((g ∘ₗ f).restrict (hfg μ)) = 0 by
    classical
    

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
N : ι → Submodule R M
inst✝⁶ : DecidableEq ι
h : IsInternal N
inst✝⁵ : ∀ (i : ι), Module.Finite R ↥(N i)
inst✝⁴ : ∀ (i : ι), Module.Free R ↥(N i)
inst✝³ : IsDomain R
inst✝² : IsPrincipalIdealRing R
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
f g : Module.End R M
h_comm : Commute f g
hf : ⨆ μ, ⨆ k, (Module.End.generalizedEigenspace f μ) k = ⊤
hg :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict g
          (_ :
            MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hfg :
  ∀ (μ : R),
    MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
this :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict (g ∘ₗ f)
          (_ :
            MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
⊢ (trace R M) (g ∘ₗ f) = 0

Next tactic:
have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
      f.independent_generalizedEigenspace hf
/-- If `f` and `g` are commuting endomorphisms of a finite, free `R`-module `M`, such that `f`
is triangularizable, then to prove that the trace of `g ∘ f` vanishes, it is sufficient to prove
that the trace of `g` vanishes on each generalized eigenspace of `f`. -/
lemma trace_comp_eq_zero_of_commute_of_trace_restrict_eq_zero
    [IsDomain R] [IsPrincipalIdealRing R] [Module.Free R M] [Module.Finite R M]
    {f g : Module.End R M}
    (h_comm : Commute f g)
    (hf : ⨆ μ, ⨆ k, f.generalizedEigenspace μ k = ⊤)
    (hg : ∀ μ, trace R _ (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ)) = 0) :
    trace R _ (g ∘ₗ f) = 0 := by
  have hfg : ∀ μ,
      MapsTo (g ∘ₗ f) ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
    fun μ ↦ (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ).comp
      (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)
  suffices ∀ μ, trace R _ ((g ∘ₗ f).restrict (hfg μ)) = 0 by
    classical
    have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
      f.independent_generalizedEigenspace hf
    

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
N : ι → Submodule R M
inst✝⁶ : DecidableEq ι
h : IsInternal N
inst✝⁵ : ∀ (i : ι), Module.Finite R ↥(N i)
inst✝⁴ : ∀ (i : ι), Module.Free R ↥(N i)
inst✝³ : IsDomain R
inst✝² : IsPrincipalIdealRing R
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
f g : Module.End R M
h_comm : Commute f g
hf : ⨆ μ, ⨆ k, (Module.End.generalizedEigenspace f μ) k = ⊤
hg :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict g
          (_ :
            MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hfg :
  ∀ (μ : R),
    MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
this :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict (g ∘ₗ f)
          (_ :
            MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hds : IsInternal fun μ => ⨆ k, (Module.End.generalizedEigenspace f μ) k
⊢ (trace R M) (g ∘ₗ f) = 0

Next tactic:
have h_fin : {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥}.Finite :=
      CompleteLattice.WellFounded.finite_ne_bot_of_independent
        (isNoetherian_iff_wellFounded.mp inferInstance) f.independent_generalizedEigenspace
/-- If `f` and `g` are commuting endomorphisms of a finite, free `R`-module `M`, such that `f`
is triangularizable, then to prove that the trace of `g ∘ f` vanishes, it is sufficient to prove
that the trace of `g` vanishes on each generalized eigenspace of `f`. -/
lemma trace_comp_eq_zero_of_commute_of_trace_restrict_eq_zero
    [IsDomain R] [IsPrincipalIdealRing R] [Module.Free R M] [Module.Finite R M]
    {f g : Module.End R M}
    (h_comm : Commute f g)
    (hf : ⨆ μ, ⨆ k, f.generalizedEigenspace μ k = ⊤)
    (hg : ∀ μ, trace R _ (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ)) = 0) :
    trace R _ (g ∘ₗ f) = 0 := by
  have hfg : ∀ μ,
      MapsTo (g ∘ₗ f) ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
    fun μ ↦ (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ).comp
      (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)
  suffices ∀ μ, trace R _ ((g ∘ₗ f).restrict (hfg μ)) = 0 by
    classical
    have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
      f.independent_generalizedEigenspace hf
    have h_fin : {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥}.Finite :=
      CompleteLattice.WellFounded.finite_ne_bot_of_independent
        (isNoetherian_iff_wellFounded.mp inferInstance) f.independent_generalizedEigenspace
    

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
N : ι → Submodule R M
inst✝⁶ : DecidableEq ι
h : IsInternal N
inst✝⁵ : ∀ (i : ι), Module.Finite R ↥(N i)
inst✝⁴ : ∀ (i : ι), Module.Free R ↥(N i)
inst✝³ : IsDomain R
inst✝² : IsPrincipalIdealRing R
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
f g : Module.End R M
h_comm : Commute f g
hf : ⨆ μ, ⨆ k, (Module.End.generalizedEigenspace f μ) k = ⊤
hg :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict g
          (_ :
            MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hfg :
  ∀ (μ : R),
    MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
this :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict (g ∘ₗ f)
          (_ :
            MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hds : IsInternal fun μ => ⨆ k, (Module.End.generalizedEigenspace f μ) k
h_fin : Set.Finite {μ | ⨆ k, (Module.End.generalizedEigenspace f μ) k ≠ ⊥}
⊢ (trace R M) (g ∘ₗ f) = 0

Next tactic:
simp [trace_eq_sum_trace_restrict' hds h_fin hfg, this]
/-- If `f` and `g` are commuting endomorphisms of a finite, free `R`-module `M`, such that `f`
is triangularizable, then to prove that the trace of `g ∘ f` vanishes, it is sufficient to prove
that the trace of `g` vanishes on each generalized eigenspace of `f`. -/
lemma trace_comp_eq_zero_of_commute_of_trace_restrict_eq_zero
    [IsDomain R] [IsPrincipalIdealRing R] [Module.Free R M] [Module.Finite R M]
    {f g : Module.End R M}
    (h_comm : Commute f g)
    (hf : ⨆ μ, ⨆ k, f.generalizedEigenspace μ k = ⊤)
    (hg : ∀ μ, trace R _ (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ)) = 0) :
    trace R _ (g ∘ₗ f) = 0 := by
  have hfg : ∀ μ,
      MapsTo (g ∘ₗ f) ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
    fun μ ↦ (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ).comp
      (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)
  suffices ∀ μ, trace R _ ((g ∘ₗ f).restrict (hfg μ)) = 0 by
    classical
    have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
      f.independent_generalizedEigenspace hf
    have h_fin : {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥}.Finite :=
      CompleteLattice.WellFounded.finite_ne_bot_of_independent
        (isNoetherian_iff_wellFounded.mp inferInstance) f.independent_generalizedEigenspace
    simp [trace_eq_sum_trace_restrict' hds h_fin hfg, this]
  

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
N : ι → Submodule R M
inst✝⁶ : DecidableEq ι
h : IsInternal N
inst✝⁵ : ∀ (i : ι), Module.Finite R ↥(N i)
inst✝⁴ : ∀ (i : ι), Module.Free R ↥(N i)
inst✝³ : IsDomain R
inst✝² : IsPrincipalIdealRing R
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
f g : Module.End R M
h_comm : Commute f g
hf : ⨆ μ, ⨆ k, (Module.End.generalizedEigenspace f μ) k = ⊤
hg :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict g
          (_ :
            MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hfg :
  ∀ (μ : R),
    MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
⊢ ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict (g ∘ₗ f)
          (_ :
            MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0

Next tactic:
intro μ
/-- If `f` and `g` are commuting endomorphisms of a finite, free `R`-module `M`, such that `f`
is triangularizable, then to prove that the trace of `g ∘ f` vanishes, it is sufficient to prove
that the trace of `g` vanishes on each generalized eigenspace of `f`. -/
lemma trace_comp_eq_zero_of_commute_of_trace_restrict_eq_zero
    [IsDomain R] [IsPrincipalIdealRing R] [Module.Free R M] [Module.Finite R M]
    {f g : Module.End R M}
    (h_comm : Commute f g)
    (hf : ⨆ μ, ⨆ k, f.generalizedEigenspace μ k = ⊤)
    (hg : ∀ μ, trace R _ (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ)) = 0) :
    trace R _ (g ∘ₗ f) = 0 := by
  have hfg : ∀ μ,
      MapsTo (g ∘ₗ f) ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
    fun μ ↦ (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ).comp
      (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)
  suffices ∀ μ, trace R _ ((g ∘ₗ f).restrict (hfg μ)) = 0 by
    classical
    have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
      f.independent_generalizedEigenspace hf
    have h_fin : {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥}.Finite :=
      CompleteLattice.WellFounded.finite_ne_bot_of_independent
        (isNoetherian_iff_wellFounded.mp inferInstance) f.independent_generalizedEigenspace
    simp [trace_eq_sum_trace_restrict' hds h_fin hfg, this]
  intro μ
  

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
N : ι → Submodule R M
inst✝⁶ : DecidableEq ι
h : IsInternal N
inst✝⁵ : ∀ (i : ι), Module.Finite R ↥(N i)
inst✝⁴ : ∀ (i : ι), Module.Free R ↥(N i)
inst✝³ : IsDomain R
inst✝² : IsPrincipalIdealRing R
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
f g : Module.End R M
h_comm : Commute f g
hf : ⨆ μ, ⨆ k, (Module.End.generalizedEigenspace f μ) k = ⊤
hg :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict g
          (_ :
            MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hfg :
  ∀ (μ : R),
    MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
μ : R
⊢ (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
      (restrict (g ∘ₗ f)
        (_ :
          MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
            ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
    0

Next tactic:
replace h_comm : Commute (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ))
      (f.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)) :=
    restrict_commute h_comm.symm _ _
/-- If `f` and `g` are commuting endomorphisms of a finite, free `R`-module `M`, such that `f`
is triangularizable, then to prove that the trace of `g ∘ f` vanishes, it is sufficient to prove
that the trace of `g` vanishes on each generalized eigenspace of `f`. -/
lemma trace_comp_eq_zero_of_commute_of_trace_restrict_eq_zero
    [IsDomain R] [IsPrincipalIdealRing R] [Module.Free R M] [Module.Finite R M]
    {f g : Module.End R M}
    (h_comm : Commute f g)
    (hf : ⨆ μ, ⨆ k, f.generalizedEigenspace μ k = ⊤)
    (hg : ∀ μ, trace R _ (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ)) = 0) :
    trace R _ (g ∘ₗ f) = 0 := by
  have hfg : ∀ μ,
      MapsTo (g ∘ₗ f) ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
    fun μ ↦ (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ).comp
      (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)
  suffices ∀ μ, trace R _ ((g ∘ₗ f).restrict (hfg μ)) = 0 by
    classical
    have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
      f.independent_generalizedEigenspace hf
    have h_fin : {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥}.Finite :=
      CompleteLattice.WellFounded.finite_ne_bot_of_independent
        (isNoetherian_iff_wellFounded.mp inferInstance) f.independent_generalizedEigenspace
    simp [trace_eq_sum_trace_restrict' hds h_fin hfg, this]
  intro μ
  replace h_comm : Commute (g.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm h_comm μ))
      (f.restrict (f.mapsTo_iSup_generalizedEigenspace_of_comm rfl μ)) :=
    restrict_commute h_comm.symm _ _
  

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
inst✝⁹ : CommRing R
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R M
N : ι → Submodule R M
inst✝⁶ : DecidableEq ι
h : IsInternal N
inst✝⁵ : ∀ (i : ι), Module.Finite R ↥(N i)
inst✝⁴ : ∀ (i : ι), Module.Free R ↥(N i)
inst✝³ : IsDomain R
inst✝² : IsPrincipalIdealRing R
inst✝¹ : Module.Free R M
inst✝ : Module.Finite R M
f g : Module.End R M
h_comm✝ : Commute f g
hf : ⨆ μ, ⨆ k, (Module.End.generalizedEigenspace f μ) k = ⊤
hg :
  ∀ (μ : R),
    (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
        (restrict g
          (_ :
            MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
              ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
      0
hfg :
  ∀ (μ : R),
    MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
μ : R
h_comm :
  Commute
    (restrict g
      (_ : MapsTo ⇑g ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)))
    (restrict f
      (_ : MapsTo ⇑f ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)))
⊢ (trace R ↥(⨆ k, (Module.End.generalizedEigenspace f μ) k))
      (restrict (g ∘ₗ f)
        (_ :
          MapsTo ⇑(g ∘ₗ f) ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k)
            ↑(⨆ k, (Module.End.generalizedEigenspace f μ) k))) =
    0

Next tactic:
rw [restrict_comp, trace_comp_eq_mul_of_commute_of_isNilpotent μ h_comm
    (f.isNilpotent_restrict_iSup_sub_algebraMap μ), hg, mul_zero]
theorem apply_mem_map₂ (f : M →ₗ[R] N →ₗ[R] P) {m : M} {n : N} {p : Submodule R M}
    {q : Submodule R N} (hm : m ∈ p) (hn : n ∈ q) : f m n ∈ map₂ f p q :=
  (le_iSup _ ⟨m, hm⟩ : _ ≤ map₂ f p q) ⟨n, hn, by 

Proof state:
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
m : M
n : N
p : Submodule R M
q : Submodule R N
hm : m ∈ p
hn : n ∈ q
⊢ (f ↑{ val := m, property := hm }) n = (f m) n

Next tactic:
rfl
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  

Proof state:
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ map₂ f (span R s) (span R t) = span R (image2 (fun m n => (f m) n) s t)

Next tactic:
apply le_antisymm
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  apply le_antisymm
  · 

Proof state:
case a
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ map₂ f (span R s) (span R t) ≤ span R (image2 (fun m n => (f m) n) s t)

Next tactic:
rw [map₂_le]
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  apply le_antisymm
  · rw [map₂_le]
    

Proof state:
case a
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ m ∈ span R s, ∀ n ∈ span R t, (f m) n ∈ span R (image2 (fun m n => (f m) n) s t)

Next tactic:
apply @span_induction' R M _ _ _ s
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  apply le_antisymm
  · rw [map₂_le]
    apply @span_induction' R M _ _ _ s
    

Proof state:
case a.Hs
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ x ∈ s, ∀ n ∈ span R t, (f x) n ∈ span R (image2 (fun m n => (f m) n) s t)
case a.H0
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ n ∈ span R t, (f 0) n ∈ span R (image2 (fun m n => (f m) n) s t)
case a.H1
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ x ∈ span R s,
    ∀ y ∈ span R s,
      (∀ n ∈ span R t, (f x) n ∈ span R (image2 (fun m n => (f m) n) s t)) →
        (∀ n ∈ span R t, (f y) n ∈ span R (image2 (fun m n => (f m) n) s t)) →
          ∀ n ∈ span R t, (f (x + y)) n ∈ span R (image2 (fun m n => (f m) n) s t)
case a.H2
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ (a : R),
    ∀ x ∈ span R s,
      (∀ n ∈ span R t, (f x) n ∈ span R (image2 (fun m n => (f m) n) s t)) →
        ∀ n ∈ span R t, (f (a • x)) n ∈ span R (image2 (fun m n => (f m) n) s t)

Next tactic:
intro a ha
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  apply le_antisymm
  · rw [map₂_le]
    apply @span_induction' R M _ _ _ s
    intro a ha
    

Proof state:
case a.Hs
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
a : M
ha : a ∈ s
⊢ ∀ n ∈ span R t, (f a) n ∈ span R (image2 (fun m n => (f m) n) s t)
case a.H0
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ n ∈ span R t, (f 0) n ∈ span R (image2 (fun m n => (f m) n) s t)
case a.H1
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ x ∈ span R s,
    ∀ y ∈ span R s,
      (∀ n ∈ span R t, (f x) n ∈ span R (image2 (fun m n => (f m) n) s t)) →
        (∀ n ∈ span R t, (f y) n ∈ span R (image2 (fun m n => (f m) n) s t)) →
          ∀ n ∈ span R t, (f (x + y)) n ∈ span R (image2 (fun m n => (f m) n) s t)
case a.H2
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
⊢ ∀ (a : R),
    ∀ x ∈ span R s,
      (∀ n ∈ span R t, (f x) n ∈ span R (image2 (fun m n => (f m) n) s t)) →
        ∀ n ∈ span R t, (f (a • x)) n ∈ span R (image2 (fun m n => (f m) n) s t)

Next tactic:
apply @span_induction' R N _ _ _ t
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  apply le_antisymm
  · rw [map₂_le]
    apply @span_induction' R M _ _ _ s
    intro a ha
    apply @span_induction' R N _ _ _ t
    intro b hb
    exact subset_span ⟨_, _, ‹_›, ‹_›, rfl⟩
    all_goals 

Proof state:
case a.Hs.H0
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
a : M
ha : a ∈ s
⊢ (f a) 0 ∈ span R (image2 (fun m n => (f m) n) s t)

Next tactic:
intros
theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N) :
    map₂ f (span R s) (span R t) = span R (Set.image2 (fun m n => f m n) s t) := by
  apply le_antisymm
  · rw [map₂_le]
    apply @span_induction' R M _ _ _ s
    intro a ha
    apply @span_induction' R N _ _ _ t
    intro b hb
    exact subset_span ⟨_, _, ‹_›, ‹_›, rfl⟩
    all_goals intros; 

Proof state:
case a.Hs.H0
ι : Sort uι
R : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : AddCommMonoid P
inst✝² : Module R M
inst✝¹ : Module R N
inst✝ : Module R P
f : M →ₗ[R] N →ₗ[R] P
s : Set M
t : Set N
a : M
ha : a ∈ s
⊢ (f a) 0 ∈ span R (image2 (fun m n => (f m) n) s t)

Next tactic:
simp only [*, add_mem, smul_mem, zero_mem, _root_.map_zero, map_add,
                                 LinearMap.zero_apply, LinearMap.add_apply, LinearMap.smul_apply,
                                 map_smul]