l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem spanNorm_singleton {r : S} : spanNorm R (span ({r} : Set S)) = span {Algebra.norm R r} :=
  le_antisymm
    (span_le.mpr fun x hx =>
      mem_span_singleton.mpr
        (by
          

Proof state:
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
r : S
x : R
hx : x ∈ ⇑(Algebra.norm R) '' ↑(span {r})
⊢ (Algebra.norm R) r ∣ x

Next tactic:
obtain ⟨x, hx', rfl⟩ := (Set.mem_image _ _ _).mp hx
@[simp]
theorem spanNorm_singleton {r : S} : spanNorm R (span ({r} : Set S)) = span {Algebra.norm R r} :=
  le_antisymm
    (span_le.mpr fun x hx =>
      mem_span_singleton.mpr
        (by
          obtain ⟨x, hx', rfl⟩ := (Set.mem_image _ _ _).mp hx
          

Proof state:
case intro.intro
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
r x : S
hx' : x ∈ ↑(span {r})
hx : (Algebra.norm R) x ∈ ⇑(Algebra.norm R) '' ↑(span {r})
⊢ (Algebra.norm R) r ∣ (Algebra.norm R) x

Next tactic:
exact map_dvd _ (mem_span_singleton.mp hx')
@[simp]
theorem spanNorm_top : spanNorm R (⊤ : Ideal S) = ⊤ := by
  -- Porting note: was
  -- simp [← Ideal.span_singleton_one]
  

Proof state:
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
⊢ spanNorm R ⊤ = ⊤

Next tactic:
rw [← Ideal.span_singleton_one, spanNorm_singleton]
@[simp]
theorem spanNorm_top : spanNorm R (⊤ : Ideal S) = ⊤ := by
  -- Porting note: was
  -- simp [← Ideal.span_singleton_one]
  rw [← Ideal.span_singleton_one, spanNorm_singleton]
  

Proof state:
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
⊢ span {(Algebra.norm R) 1} = ⊤

Next tactic:
simp
theorem map_spanNorm (I : Ideal S) {T : Type*} [CommRing T] (f : R →+* T) :
    map f (spanNorm R I) = span (f ∘ Algebra.norm R '' (I : Set S)) := by
  

Proof state:
R : Type u_1
inst✝³ : CommRing R
S : Type u_2
inst✝² : CommRing S
inst✝¹ : Algebra R S
I : Ideal S
T : Type u_3
inst✝ : CommRing T
f : R →+* T
⊢ map f (spanNorm R I) = span (⇑f ∘ ⇑(Algebra.norm R) '' ↑I)

Next tactic:
rw [spanNorm, map_span, Set.image_image]
theorem map_spanNorm (I : Ideal S) {T : Type*} [CommRing T] (f : R →+* T) :
    map f (spanNorm R I) = span (f ∘ Algebra.norm R '' (I : Set S)) := by
  rw [spanNorm, map_span, Set.image_image]
  -- Porting note: `Function.comp` reducibility
  

Proof state:
R : Type u_1
inst✝³ : CommRing R
S : Type u_2
inst✝² : CommRing S
inst✝¹ : Algebra R S
I : Ideal S
T : Type u_3
inst✝ : CommRing T
f : R →+* T
⊢ span ((fun x => f ((Algebra.norm R) x)) '' ↑I) = span (⇑f ∘ ⇑(Algebra.norm R) '' ↑I)

Next tactic:
rfl
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  

Proof state:
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)

Next tactic:
cases h : subsingleton_or_nontrivial R
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · 

Proof state:
case inl
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Subsingleton R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)

Next tactic:
haveI := IsLocalization.unique R Rₘ M
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    

Proof state:
case inl
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Subsingleton R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
this : Unique Rₘ
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)

Next tactic:
simp [eq_iff_true_of_subsingleton]
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  

Proof state:
case inr
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)

Next tactic:
let b := Module.Free.chooseBasis R S
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  

Proof state:
case inr
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)

Next tactic:
rw [map_spanNorm]
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  

Proof state:
case inr
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = span (⇑(algebraMap R Rₘ) ∘ ⇑(Algebra.norm R) '' ↑I)

Next tactic:
refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
  · 

Proof state:
case inr.refine_1
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ ↑(map (algebraMap S Sₘ) I) ⊆
    ⇑(Algebra.norm Rₘ) ⁻¹' ↑(Submodule.span Rₘ (⇑(algebraMap R Rₘ) ∘ ⇑(Algebra.norm R) '' ↑I))

Next tactic:
rintro a' ha'
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
  · rintro a' ha'
    

Proof state:
case inr.refine_1
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
ha' : a' ∈ ↑(map (algebraMap S Sₘ) I)
⊢ a' ∈ ⇑(Algebra.norm Rₘ) ⁻¹' ↑(Submodule.span Rₘ (⇑(algebraMap R Rₘ) ∘ ⇑(Algebra.norm R) '' ↑I))

Next tactic:
simp only [Set.mem_preimage, submodule_span_eq, ← map_spanNorm, SetLike.mem_coe,
      IsLocalization.mem_map_algebraMap_iff (Algebra.algebraMapSubmonoid S M) Sₘ,
      IsLocalization.mem_map_algebraMap_iff M Rₘ, Prod.exists] at ha' ⊢
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
  · rintro a' ha'
    simp only [Set.mem_preimage, submodule_span_eq, ← map_spanNorm, SetLike.mem_coe,
      IsLocalization.mem_map_algebraMap_iff (Algebra.algebraMapSubmonoid S M) Sₘ,
      IsLocalization.mem_map_algebraMap_iff M Rₘ, Prod.exists] at ha' ⊢
    

Proof state:
case inr.refine_1
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
ha' : ∃ a b, a' * (algebraMap S Sₘ) ↑b = (algebraMap S Sₘ) ↑a
⊢ ∃ a b, (Algebra.norm Rₘ) a' * (algebraMap R Rₘ) ↑b = (algebraMap R Rₘ) ↑a

Next tactic:
obtain ⟨⟨a, ha⟩, ⟨_, ⟨s, hs, rfl⟩⟩, has⟩ := ha'
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
  · rintro a' ha'
    simp only [Set.mem_preimage, submodule_span_eq, ← map_spanNorm, SetLike.mem_coe,
      IsLocalization.mem_map_algebraMap_iff (Algebra.algebraMapSubmonoid S M) Sₘ,
      IsLocalization.mem_map_algebraMap_iff M Rₘ, Prod.exists] at ha' ⊢
    obtain ⟨⟨a, ha⟩, ⟨_, ⟨s, hs, rfl⟩⟩, has⟩ := ha'
    

Proof state:
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has :
  a' *
      (algebraMap S Sₘ)
        ↑{ val := (algebraMap R S) s, property := (_ : ∃ a ∈ ↑M, (algebraMap R S) a = (algebraMap R S) s) } =
    (algebraMap S Sₘ) ↑{ val := a, property := ha }
⊢ ∃ a b, (Algebra.norm Rₘ) a' * (algebraMap R Rₘ) ↑b = (algebraMap R Rₘ) ↑a

Next tactic:
refine ⟨⟨Algebra.norm R a, norm_mem_spanNorm _ _ ha⟩,
      ⟨s ^ Fintype.card (Module.Free.ChooseBasisIndex R S), pow_mem hs _⟩, ?_⟩
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
  · rintro a' ha'
    simp only [Set.mem_preimage, submodule_span_eq, ← map_spanNorm, SetLike.mem_coe,
      IsLocalization.mem_map_algebraMap_iff (Algebra.algebraMapSubmonoid S M) Sₘ,
      IsLocalization.mem_map_algebraMap_iff M Rₘ, Prod.exists] at ha' ⊢
    obtain ⟨⟨a, ha⟩, ⟨_, ⟨s, hs, rfl⟩⟩, has⟩ := ha'
    refine ⟨⟨Algebra.norm R a, norm_mem_spanNorm _ _ ha⟩,
      ⟨s ^ Fintype.card (Module.Free.ChooseBasisIndex R S), pow_mem hs _⟩, ?_⟩
    

Proof state:
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has :
  a' *
      (algebraMap S Sₘ)
        ↑{ val := (algebraMap R S) s, property := (_ : ∃ a ∈ ↑M, (algebraMap R S) a = (algebraMap R S) s) } =
    (algebraMap S Sₘ) ↑{ val := a, property := ha }
⊢ (Algebra.norm Rₘ) a' *
      (algebraMap R Rₘ)
        ↑{ val := s ^ Fintype.card (Module.Free.ChooseBasisIndex R S),
            property := (_ : s ^ Fintype.card (Module.Free.ChooseBasisIndex R S) ∈ M) } =
    (algebraMap R Rₘ) ↑{ val := (Algebra.norm R) a, property := (_ : (Algebra.norm R) a ∈ spanNorm R I) }

Next tactic:
simp only [Submodule.coe_mk, Subtype.coe_mk, map_pow] at has ⊢
theorem spanNorm_localization (I : Ideal S) [Module.Finite R S] [Module.Free R S] (M : Submonoid R)
    {Rₘ : Type*} (Sₘ : Type*) [CommRing Rₘ] [Algebra R Rₘ] [CommRing Sₘ] [Algebra S Sₘ]
    [Algebra Rₘ Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
    [IsLocalization M Rₘ] [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ] :
    spanNorm Rₘ (I.map (algebraMap S Sₘ)) = (spanNorm R I).map (algebraMap R Rₘ) := by
  cases h : subsingleton_or_nontrivial R
  · haveI := IsLocalization.unique R Rₘ M
    simp [eq_iff_true_of_subsingleton]
  let b := Module.Free.chooseBasis R S
  rw [map_spanNorm]
  refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
  · rintro a' ha'
    simp only [Set.mem_preimage, submodule_span_eq, ← map_spanNorm, SetLike.mem_coe,
      IsLocalization.mem_map_algebraMap_iff (Algebra.algebraMapSubmonoid S M) Sₘ,
      IsLocalization.mem_map_algebraMap_iff M Rₘ, Prod.exists] at ha' ⊢
    obtain ⟨⟨a, ha⟩, ⟨_, ⟨s, hs, rfl⟩⟩, has⟩ := ha'
    refine ⟨⟨Algebra.norm R a, norm_mem_spanNorm _ _ ha⟩,
      ⟨s ^ Fintype.card (Module.Free.ChooseBasisIndex R S), pow_mem hs _⟩, ?_⟩
    simp only [Submodule.coe_mk, Subtype.coe_mk, map_pow] at has ⊢
    

Proof state:
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has : a' * (algebraMap S Sₘ) ((algebraMap R S) s) = (algebraMap S Sₘ) a
⊢ (Algebra.norm Rₘ) a' * (algebraMap R Rₘ) s ^ Fintype.card (Module.Free.ChooseBasisIndex R S) =
    (algebraMap R Rₘ) ((Algebra.norm R) a)

Next tactic:
apply_fun Algebra.norm Rₘ at has