Theorem: IsLocalization.isLocalization_of_base_ringEquiv
File: Mathlib/RingTheory/Localization/Basic.lean

tactic: letI : Algebra P S := ((algebraMap R S).comp h.symm.toRingHom).toAlgebra
state_before: R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
⊢ IsLocalization (Submonoid.map (RingEquiv.toMonoidHom h) M) S

tactic: constructor
state_before: R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
⊢ IsLocalization (Submonoid.map (RingEquiv.toMonoidHom h) M) S

tactic: rintro ⟨_, ⟨y, hy, rfl⟩⟩
state_before: case map_units'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
⊢ ∀ (y : { x // x ∈ Submonoid.map (RingEquiv.toMonoidHom h) M }), IsUnit (↑(algebraMap P S) ↑y)

tactic: convert IsLocalization.map_units S ⟨y, hy⟩
state_before: case map_units'.mk.intro.intro
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : R
hy : y ∈ ↑M
⊢ IsUnit
    (↑(algebraMap P S)
      ↑{ val := ↑(RingEquiv.toMonoidHom h) y,
          property := (_ : ∃ a, a ∈ ↑M ∧ ↑(RingEquiv.toMonoidHom h) a = ↑(RingEquiv.toMonoidHom h) y) })

tactic: dsimp only [RingHom.algebraMap_toAlgebra, RingHom.comp_apply]
state_before: case h.e'_3
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : R
hy : y ∈ ↑M
⊢ ↑(algebraMap P S)
      ↑{ val := ↑(RingEquiv.toMonoidHom h) y,
          property := (_ : ∃ a, a ∈ ↑M ∧ ↑(RingEquiv.toMonoidHom h) a = ↑(RingEquiv.toMonoidHom h) y) } =
    ↑(algebraMap R S) ↑{ val := y, property := hy }

tactic: exact congr_arg _ (h.symm_apply_apply _)
state_before: case h.e'_3
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : R
hy : y ∈ ↑M
⊢ ↑(algebraMap R S) (↑(RingEquiv.toRingHom (RingEquiv.symm h)) (↑(RingEquiv.toMonoidHom h) y)) = ↑(algebraMap R S) y

tactic: intro y
state_before: case surj'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
⊢ ∀ (z : S), ∃ x, z * ↑(algebraMap P S) ↑x.snd = ↑(algebraMap P S) x.fst

tactic: obtain ⟨⟨x, s⟩, e⟩ := IsLocalization.surj M y
state_before: case surj'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : S
⊢ ∃ x, y * ↑(algebraMap P S) ↑x.snd = ↑(algebraMap P S) x.fst

tactic: refine' ⟨⟨h x, _, _, s.prop, rfl⟩, _⟩
state_before: case surj'.intro.mk
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : S
x : R
s : { x // x ∈ M }
e : y * ↑(algebraMap R S) ↑(x, s).snd = ↑(algebraMap R S) (x, s).fst
⊢ ∃ x, y * ↑(algebraMap P S) ↑x.snd = ↑(algebraMap P S) x.fst

tactic: dsimp only [RingHom.algebraMap_toAlgebra, RingHom.comp_apply] at e⊢
state_before: case surj'.intro.mk
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : S
x : R
s : { x // x ∈ M }
e : y * ↑(algebraMap R S) ↑(x, s).snd = ↑(algebraMap R S) (x, s).fst
⊢ y *
      ↑(algebraMap P S)
        ↑(↑h x,
              { val := ↑(RingEquiv.toMonoidHom h) ↑s,
                property := (_ : ∃ a, a ∈ ↑M ∧ ↑(RingEquiv.toMonoidHom h) a = ↑(RingEquiv.toMonoidHom h) ↑s) }).snd =
    ↑(algebraMap P S)
      (↑h x,
          { val := ↑(RingEquiv.toMonoidHom h) ↑s,
            property := (_ : ∃ a, a ∈ ↑M ∧ ↑(RingEquiv.toMonoidHom h) a = ↑(RingEquiv.toMonoidHom h) ↑s) }).fst

tactic: convert e <;> exact h.symm_apply_apply _
state_before: case surj'.intro.mk
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
y : S
x : R
s : { x // x ∈ M }
e : y * ↑(algebraMap R S) ↑s = ↑(algebraMap R S) x
⊢ y * ↑(algebraMap R S) (↑(RingEquiv.toRingHom (RingEquiv.symm h)) (↑(RingEquiv.toMonoidHom h) ↑s)) =
    ↑(algebraMap R S) (↑(RingEquiv.toRingHom (RingEquiv.symm h)) (↑h x))

tactic: intro x y
state_before: case eq_iff_exists'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
⊢ ∀ {x y : P}, ↑(algebraMap P S) x = ↑(algebraMap P S) y ↔ ∃ c, ↑c * x = ↑c * y

tactic: rw [RingHom.algebraMap_toAlgebra, RingHom.comp_apply, RingHom.comp_apply,
  IsLocalization.eq_iff_exists M S]
state_before: case eq_iff_exists'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
x y : P
⊢ ↑(algebraMap P S) x = ↑(algebraMap P S) y ↔ ∃ c, ↑c * x = ↑c * y

tactic: simp_rw [← h.toEquiv.apply_eq_iff_eq]
state_before: case eq_iff_exists'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
x y : P
⊢ (∃ c, ↑c * ↑(RingEquiv.toRingHom (RingEquiv.symm h)) x = ↑c * ↑(RingEquiv.toRingHom (RingEquiv.symm h)) y) ↔
    ∃ c, ↑c * x = ↑c * y

tactic: change (∃ c : M, h (c * h.symm x) = h (c * h.symm y)) ↔ _
state_before: case eq_iff_exists'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
x y : P
⊢ (∃ c,
      ↑h.toEquiv (↑c * ↑(RingEquiv.toRingHom (RingEquiv.symm h)) x) =
        ↑h.toEquiv (↑c * ↑(RingEquiv.toRingHom (RingEquiv.symm h)) y)) ↔
    ∃ c, ↑c * x = ↑c * y

tactic: simp only [RingEquiv.apply_symm_apply, RingEquiv.map_mul]
state_before: case eq_iff_exists'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
x y : P
⊢ (∃ c, ↑h (↑c * ↑(RingEquiv.symm h) x) = ↑h (↑c * ↑(RingEquiv.symm h) y)) ↔ ∃ c, ↑c * x = ↑c * y

tactic: exact
  ⟨fun ⟨c, e⟩ => ⟨⟨_, _, c.prop, rfl⟩, e⟩, fun ⟨⟨_, c, h, e₁⟩, e₂⟩ => ⟨⟨_, h⟩, e₁.symm ▸ e₂⟩⟩
state_before: case eq_iff_exists'
R : Type u_1
inst✝⁴ : CommSemiring R
M : Submonoid R
S : Type u_2
inst✝³ : CommSemiring S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommSemiring P
inst✝ : IsLocalization M S
h : R ≃+* P
this : Algebra P S := RingHom.toAlgebra (RingHom.comp (algebraMap R S) (RingEquiv.toRingHom (RingEquiv.symm h)))
x y : P
⊢ (∃ c, ↑h ↑c * x = ↑h ↑c * y) ↔ ∃ c, ↑c * x = ↑c * y