l3lab/ntp-mathlib huggingface dataset:
theorem SpanEqTop.localization_localization {v : Set A} (hv : span R v = ⊤) :
    span Rₛ (algebraMap A Aₛ '' v) = ⊤ := by
  rw [eq_top_iff]
  rintro a' -
  obtain ⟨a, ⟨_, s, hs, rfl⟩, rfl⟩ :=
    IsLocalization.mk'_surjective (Algebra.algebraMapSubmonoid A S) a'
  rw [IsLocalization.mk'_eq_mul_mk'_one, mul_comm, ← map_one (algebraMap R A)]
  erw [← IsLocalization.algebraMap_mk' A Rₛ Aₛ (1 : R) ⟨s, hs⟩]
  -- `erw` needed to unify `⟨s, hs⟩`
  rw [← Algebra.smul_def]
  refine' smul_mem _ _ (span_subset_span R Rₛ _ _)
  rw [← Algebra.coe_linearMap, ← LinearMap.coe_restrictScalars R, ← LinearMap.map_span]
  

Proof state:
case intro.intro.mk.intro.intro
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
v : Set A
hv : span R v = ⊤
a : A
s : R
hs : s ∈ ↑S
⊢ (↑R (Algebra.linearMap A Aₛ)) a ∈ ↑(map (↑R (Algebra.linearMap A Aₛ)) (span R v))

Next tactic:
exact mem_map_of_mem (hv.symm ▸ mem_top)
/-- If `A` has an `R`-basis, then localizing `A` at `S` has a basis over `R` localized at `S`.

A suitable instance for `[Algebra A Aₛ]` is `localizationAlgebra`.
-/
noncomputable def Basis.localizationLocalization {ι : Type*} (b : Basis ι R A) : Basis ι Rₛ Aₛ :=
  Basis.mk (b.linearIndependent.localization_localization _ S _)
    (by 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
⊢ ⊤ ≤ span Rₛ (Set.range (⇑(algebraMap A Aₛ) ∘ ⇑b))

Next tactic:
rw [Set.range_comp, SpanEqTop.localization_localization Rₛ S Aₛ b.span_eq]
@[simp]
theorem Basis.localizationLocalization_repr_algebraMap {ι : Type*} (b : Basis ι R A) (x i) :
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
      algebraMap R Rₛ (b.repr x i) :=
  calc
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
        (b.localizationLocalization Rₛ S Aₛ).repr
          ((b.repr x).sum fun j c => algebraMap R Rₛ c • algebraMap A Aₛ (b j)) i := by
      

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
x : A
i : ι
⊢ ((localizationLocalization Rₛ S Aₛ b).repr ((algebraMap A Aₛ) x)) i =
    ((localizationLocalization Rₛ S Aₛ b).repr
        (Finsupp.sum (b.repr x) fun j c => (algebraMap R Rₛ) c • (algebraMap A Aₛ) (b j)))
      i

Next tactic:
simp_rw [IsScalarTower.algebraMap_smul, Algebra.smul_def,
        IsScalarTower.algebraMap_apply R A Aₛ, ← _root_.map_mul, ← map_finsupp_sum, ←
        Algebra.smul_def, ← Finsupp.total_apply, Basis.total_repr]
@[simp]
theorem Basis.localizationLocalization_repr_algebraMap {ι : Type*} (b : Basis ι R A) (x i) :
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
      algebraMap R Rₛ (b.repr x i) :=
  calc
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
        (b.localizationLocalization Rₛ S Aₛ).repr
          ((b.repr x).sum fun j c => algebraMap R Rₛ c • algebraMap A Aₛ (b j)) i := by
      simp_rw [IsScalarTower.algebraMap_smul, Algebra.smul_def,
        IsScalarTower.algebraMap_apply R A Aₛ, ← _root_.map_mul, ← map_finsupp_sum, ←
        Algebra.smul_def, ← Finsupp.total_apply, Basis.total_repr]
    _ = (b.repr x).sum fun j c => algebraMap R Rₛ c • Finsupp.single j (1 : Rₛ) i := by
      

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
x : A
i : ι
⊢ ((localizationLocalization Rₛ S Aₛ b).repr
        (Finsupp.sum (b.repr x) fun j c => (algebraMap R Rₛ) c • (algebraMap A Aₛ) (b j)))
      i =
    Finsupp.sum (b.repr x) fun j c => (algebraMap R Rₛ) c • (fun₀ | j => 1) i

Next tactic:
simp_rw [← b.localizationLocalization_apply Rₛ S Aₛ, map_finsupp_sum, LinearEquiv.map_smul,
        Basis.repr_self, Finsupp.sum_apply, Finsupp.smul_apply]
@[simp]
theorem Basis.localizationLocalization_repr_algebraMap {ι : Type*} (b : Basis ι R A) (x i) :
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
      algebraMap R Rₛ (b.repr x i) :=
  calc
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
        (b.localizationLocalization Rₛ S Aₛ).repr
          ((b.repr x).sum fun j c => algebraMap R Rₛ c • algebraMap A Aₛ (b j)) i := by
      simp_rw [IsScalarTower.algebraMap_smul, Algebra.smul_def,
        IsScalarTower.algebraMap_apply R A Aₛ, ← _root_.map_mul, ← map_finsupp_sum, ←
        Algebra.smul_def, ← Finsupp.total_apply, Basis.total_repr]
    _ = (b.repr x).sum fun j c => algebraMap R Rₛ c • Finsupp.single j (1 : Rₛ) i := by
      simp_rw [← b.localizationLocalization_apply Rₛ S Aₛ, map_finsupp_sum, LinearEquiv.map_smul,
        Basis.repr_self, Finsupp.sum_apply, Finsupp.smul_apply]
    _ = _ :=
      (Finset.sum_eq_single i (fun j _ hj => by 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
x : A
i j : ι
x✝ : j ∈ (b.repr x).support
hj : j ≠ i
⊢ (fun j c => (algebraMap R Rₛ) c • (fun₀ | j => 1) i) j ((b.repr x) j) = 0

Next tactic:
simp [hj]
@[simp]
theorem Basis.localizationLocalization_repr_algebraMap {ι : Type*} (b : Basis ι R A) (x i) :
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
      algebraMap R Rₛ (b.repr x i) :=
  calc
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
        (b.localizationLocalization Rₛ S Aₛ).repr
          ((b.repr x).sum fun j c => algebraMap R Rₛ c • algebraMap A Aₛ (b j)) i := by
      simp_rw [IsScalarTower.algebraMap_smul, Algebra.smul_def,
        IsScalarTower.algebraMap_apply R A Aₛ, ← _root_.map_mul, ← map_finsupp_sum, ←
        Algebra.smul_def, ← Finsupp.total_apply, Basis.total_repr]
    _ = (b.repr x).sum fun j c => algebraMap R Rₛ c • Finsupp.single j (1 : Rₛ) i := by
      simp_rw [← b.localizationLocalization_apply Rₛ S Aₛ, map_finsupp_sum, LinearEquiv.map_smul,
        Basis.repr_self, Finsupp.sum_apply, Finsupp.smul_apply]
    _ = _ :=
      (Finset.sum_eq_single i (fun j _ hj => by simp [hj]) fun hi => by
        

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
x : A
i : ι
hi : i ∉ (b.repr x).support
⊢ (fun j c => (algebraMap R Rₛ) c • (fun₀ | j => 1) i) i ((b.repr x) i) = 0

Next tactic:
simp [Finsupp.not_mem_support_iff.mp hi]
@[simp]
theorem Basis.localizationLocalization_repr_algebraMap {ι : Type*} (b : Basis ι R A) (x i) :
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
      algebraMap R Rₛ (b.repr x i) :=
  calc
    (b.localizationLocalization Rₛ S Aₛ).repr (algebraMap A Aₛ x) i =
        (b.localizationLocalization Rₛ S Aₛ).repr
          ((b.repr x).sum fun j c => algebraMap R Rₛ c • algebraMap A Aₛ (b j)) i := by
      simp_rw [IsScalarTower.algebraMap_smul, Algebra.smul_def,
        IsScalarTower.algebraMap_apply R A Aₛ, ← _root_.map_mul, ← map_finsupp_sum, ←
        Algebra.smul_def, ← Finsupp.total_apply, Basis.total_repr]
    _ = (b.repr x).sum fun j c => algebraMap R Rₛ c • Finsupp.single j (1 : Rₛ) i := by
      simp_rw [← b.localizationLocalization_apply Rₛ S Aₛ, map_finsupp_sum, LinearEquiv.map_smul,
        Basis.repr_self, Finsupp.sum_apply, Finsupp.smul_apply]
    _ = _ :=
      (Finset.sum_eq_single i (fun j _ hj => by simp [hj]) fun hi => by
        simp [Finsupp.not_mem_support_iff.mp hi])
    _ = algebraMap R Rₛ (b.repr x i) := by 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
x : A
i : ι
⊢ (fun j c => (algebraMap R Rₛ) c • (fun₀ | j => 1) i) i ((b.repr x) i) = (algebraMap R Rₛ) ((b.repr x) i)

Next tactic:
simp [Algebra.smul_def]
theorem Basis.localizationLocalization_span {ι : Type*} (b : Basis ι R A) :
    Submodule.span R (Set.range (b.localizationLocalization Rₛ S Aₛ)) =
      LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) :=
  calc span R (Set.range ↑(localizationLocalization Rₛ S Aₛ b))
    _ = span R (↑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ↑b) := by 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
⊢ span R (Set.range ⇑(localizationLocalization Rₛ S Aₛ b)) = span R (⇑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ⇑b)

Next tactic:
congr
theorem Basis.localizationLocalization_span {ι : Type*} (b : Basis ι R A) :
    Submodule.span R (Set.range (b.localizationLocalization Rₛ S Aₛ)) =
      LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) :=
  calc span R (Set.range ↑(localizationLocalization Rₛ S Aₛ b))
    _ = span R (↑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ↑b) := by congr; 

Proof state:
case e_s
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
⊢ Set.range ⇑(localizationLocalization Rₛ S Aₛ b) = ⇑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ⇑b

Next tactic:
ext
theorem Basis.localizationLocalization_span {ι : Type*} (b : Basis ι R A) :
    Submodule.span R (Set.range (b.localizationLocalization Rₛ S Aₛ)) =
      LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) :=
  calc span R (Set.range ↑(localizationLocalization Rₛ S Aₛ b))
    _ = span R (↑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ↑b) := by congr; ext; 

Proof state:
case e_s.h
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
x✝ : Aₛ
⊢ x✝ ∈ Set.range ⇑(localizationLocalization Rₛ S Aₛ b) ↔ x✝ ∈ ⇑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ⇑b

Next tactic:
simp
theorem Basis.localizationLocalization_span {ι : Type*} (b : Basis ι R A) :
    Submodule.span R (Set.range (b.localizationLocalization Rₛ S Aₛ)) =
      LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) :=
  calc span R (Set.range ↑(localizationLocalization Rₛ S Aₛ b))
    _ = span R (↑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ↑b) := by congr; ext; simp
    _ = map (IsScalarTower.toAlgHom R A Aₛ) (span R (Set.range b)) := by 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
⊢ span R (⇑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ⇑b) =
    map (IsScalarTower.toAlgHom R A Aₛ) (span R (Set.range ⇑b))

Next tactic:
rw [Submodule.map_span]
theorem Basis.localizationLocalization_span {ι : Type*} (b : Basis ι R A) :
    Submodule.span R (Set.range (b.localizationLocalization Rₛ S Aₛ)) =
      LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) :=
  calc span R (Set.range ↑(localizationLocalization Rₛ S Aₛ b))
    _ = span R (↑(IsScalarTower.toAlgHom R A Aₛ) '' Set.range ↑b) := by congr; ext; simp
    _ = map (IsScalarTower.toAlgHom R A Aₛ) (span R (Set.range b)) := by rw [Submodule.map_span]
    _ = LinearMap.range (IsScalarTower.toAlgHom R A Aₛ) := by 

Proof state:
R : Type u_1
Rₛ : Type u_2
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing Rₛ
inst✝⁸ : Algebra R Rₛ
S : Submonoid R
hT : IsLocalization S Rₛ
A : Type u_3
inst✝⁷ : CommRing A
inst✝⁶ : Algebra R A
Aₛ : Type u_4
inst✝⁵ : CommRing Aₛ
inst✝⁴ : Algebra A Aₛ
inst✝³ : Algebra Rₛ Aₛ
inst✝² : Algebra R Aₛ
inst✝¹ : IsScalarTower R Rₛ Aₛ
inst✝ : IsScalarTower R A Aₛ
hA : IsLocalization (Algebra.algebraMapSubmonoid A S) Aₛ
ι : Type u_5
b : Basis ι R A
⊢ map (IsScalarTower.toAlgHom R A Aₛ) (span R (Set.range ⇑b)) = LinearMap.range (IsScalarTower.toAlgHom R A Aₛ)

Next tactic:
rw [b.span_eq, Submodule.map_top]
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
⊢ ∀ (r : A) (x : M),
    AddHom.toFun { toFun := ⇑f, map_add' := (_ : ∀ (x y : M), f (x + y) = f x + f y) } (r • x) =
      (RingHom.id A) r • AddHom.toFun { toFun := ⇑f, map_add' := (_ : ∀ (x y : M), f (x + y) = f x + f y) } x

Next tactic:
intro r m
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
r : A
m : M
⊢ AddHom.toFun { toFun := ⇑f, map_add' := (_ : ∀ (x y : M), f (x + y) = f x + f y) } (r • m) =
    (RingHom.id A) r • AddHom.toFun { toFun := ⇑f, map_add' := (_ : ∀ (x y : M), f (x + y) = f x + f y) } m

Next tactic:
simp only [RingHom.id_apply]
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
r : A
m : M
⊢ f (r • m) = r • f m

Next tactic:
rcases mk'_surjective S r with ⟨r, s, rfl⟩
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    rcases mk'_surjective S r with ⟨r, s, rfl⟩
    

Proof state:
case intro.intro
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
m : M
r : R
s : ↥S
⊢ f (mk' A r s • m) = mk' A r s • f m

Next tactic:
calc f (mk' A r s • m)
        = ((s : R) • mk' A 1 s) • f (mk' A r s • m) := by simp
      _ = (mk' A 1 s) • (s : R) • f (mk' A r s • m) := by rw [smul_comm, smul_assoc]
      _ = (mk' A 1 s) • f ((s : R) • mk' A r s • m) := by simp
      _ = (mk' A 1 s) • f (r • m) := by rw [← smul_assoc, smul_mk'_self, algebraMap_smul]
      _ = (mk' A 1 s) • r • f m := by simp
      _ = mk' A r s • f m := by rw [smul_comm, ← smul_assoc, smul_mk'_one]
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    rcases mk'_surjective S r with ⟨r, s, rfl⟩
    calc f (mk' A r s • m)
        = ((s : R) • mk' A 1 s) • f (mk' A r s • m) := by 

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
m : M
r : R
s : ↥S
⊢ f (mk' A r s • m) = (↑s • mk' A 1 s) • f (mk' A r s • m)

Next tactic:
simp
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    rcases mk'_surjective S r with ⟨r, s, rfl⟩
    calc f (mk' A r s • m)
        = ((s : R) • mk' A 1 s) • f (mk' A r s • m) := by simp
      _ = (mk' A 1 s) • (s : R) • f (mk' A r s • m) := by 

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
m : M
r : R
s : ↥S
⊢ (↑s • mk' A 1 s) • f (mk' A r s • m) = mk' A 1 s • ↑s • f (mk' A r s • m)

Next tactic:
rw [smul_comm, smul_assoc]
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    rcases mk'_surjective S r with ⟨r, s, rfl⟩
    calc f (mk' A r s • m)
        = ((s : R) • mk' A 1 s) • f (mk' A r s • m) := by simp
      _ = (mk' A 1 s) • (s : R) • f (mk' A r s • m) := by rw [smul_comm, smul_assoc]
      _ = (mk' A 1 s) • f ((s : R) • mk' A r s • m) := by 

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
m : M
r : R
s : ↥S
⊢ mk' A 1 s • ↑s • f (mk' A r s • m) = mk' A 1 s • f (↑s • mk' A r s • m)

Next tactic:
simp
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    rcases mk'_surjective S r with ⟨r, s, rfl⟩
    calc f (mk' A r s • m)
        = ((s : R) • mk' A 1 s) • f (mk' A r s • m) := by simp
      _ = (mk' A 1 s) • (s : R) • f (mk' A r s • m) := by rw [smul_comm, smul_assoc]
      _ = (mk' A 1 s) • f ((s : R) • mk' A r s • m) := by simp
      _ = (mk' A 1 s) • f (r • m) := by 

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
m : M
r : R
s : ↥S
⊢ mk' A 1 s • f (↑s • mk' A r s • m) = mk' A 1 s • f (r • m)

Next tactic:
rw [← smul_assoc, smul_mk'_self, algebraMap_smul]
/-- An `R`-linear map between two `S⁻¹R`-modules is actually `S⁻¹R`-linear. -/
def LinearMap.extendScalarsOfIsLocalization (f : M →ₗ[R] N) : M →ₗ[A] N where
  toFun := f
  map_add' := f.map_add
  map_smul' := by
    intro r m
    simp only [RingHom.id_apply]
    rcases mk'_surjective S r with ⟨r, s, rfl⟩
    calc f (mk' A r s • m)
        = ((s : R) • mk' A 1 s) • f (mk' A r s • m) := by simp
      _ = (mk' A 1 s) • (s : R) • f (mk' A r s • m) := by rw [smul_comm, smul_assoc]
      _ = (mk' A 1 s) • f ((s : R) • mk' A r s • m) := by simp
      _ = (mk' A 1 s) • f (r • m) := by rw [← smul_assoc, smul_mk'_self, algebraMap_smul]
      _ = (mk' A 1 s) • r • f m := by 

Proof state:
R : Type u_1
inst✝¹¹ : CommRing R
S : Submonoid R
A : Type u_2
inst✝¹⁰ : CommRing A
inst✝⁹ : Algebra R A
inst✝⁸ : IsLocalization S A
M : Type u_3
N : Type u_4
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : Module A M
inst✝⁴ : IsScalarTower R A M
inst✝³ : AddCommMonoid N
inst✝² : Module R N
inst✝¹ : Module A N
inst✝ : IsScalarTower R A N
f : M →ₗ[R] N
m : M
r : R
s : ↥S
⊢ mk' A 1 s • f (r • m) = mk' A 1 s • r • f m

Next tactic:
simp