l3lab/ntp-mathlib huggingface dataset:
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
  ext x
  simp only [mem_coeIdeal]
  constructor
  · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩
    

Proof state:
case a.mp.intro.intro.intro.intro
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Ideal R
y : R
hy : y ∈ ↑I
⊢ ∃ x' ∈ I, (algebraMap R P') x' = (AlgHom.toLinearMap g) ((Algebra.linearMap R P) y)

Next tactic:
exact ⟨y, hy, (g.commutes y).symm⟩
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
  ext x
  simp only [mem_coeIdeal]
  constructor
  · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩
    exact ⟨y, hy, (g.commutes y).symm⟩
  · 

Proof state:
case a.mpr
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Ideal R
x : P'
⊢ (∃ x' ∈ I, (algebraMap R P') x' = x) → x ∈ map g ↑I

Next tactic:
rintro ⟨y, hy, rfl⟩
@[simp, norm_cast]
theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by
  ext x
  simp only [mem_coeIdeal]
  constructor
  · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩
    exact ⟨y, hy, (g.commutes y).symm⟩
  · rintro ⟨y, hy, rfl⟩
    

Proof state:
case a.mpr.intro.intro
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Ideal R
y : R
hy : y ∈ I
⊢ (algebraMap R P') y ∈ map g ↑I

Next tactic:
exact ⟨_, ⟨y, hy, rfl⟩, g.commutes y⟩
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
⊢ map g (I * J) = map g I * map g J

Next tactic:
simp only [mul_def]
@[simp]
theorem map_mul : (I * J).map g = I.map g * J.map g := by
  simp only [mul_def]
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
⊢ map g { val := ↑I * ↑J, property := (_ : IsFractional S (↑I * ↑J)) } =
    { val := ↑(map g I) * ↑(map g J), property := (_ : IsFractional S (↑(map g I) * ↑(map g J))) }

Next tactic:
exact coeToSubmodule_injective (Submodule.map_mul _ _ _)
@[simp]
theorem map_map_symm (g : P ≃ₐ[R] P') : (I.map (g : P →ₐ[R] P')).map (g.symm : P' →ₐ[R] P) = I := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g✝ : P →ₐ[R] P'
g : P ≃ₐ[R] P'
⊢ map (↑(AlgEquiv.symm g)) (map (↑g) I) = I

Next tactic:
rw [← map_comp, g.symm_comp, map_id]
@[simp]
theorem map_symm_map (I : FractionalIdeal S P') (g : P ≃ₐ[R] P') :
    (I.map (g.symm : P' →ₐ[R] P)).map (g : P →ₐ[R] P') = I := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g✝ : P →ₐ[R] P'
I : FractionalIdeal S P'
g : P ≃ₐ[R] P'
⊢ map (↑g) (map (↑(AlgEquiv.symm g)) I) = I

Next tactic:
rw [← map_comp, g.comp_symm, map_id]
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ≃ₐ[R] P') : FractionalIdeal S P ≃+* FractionalIdeal S P' where
  toFun := map g
  invFun := map g.symm
  map_add' I J := map_add I J _
  map_mul' I J := map_mul I J _
  left_inv I := by 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g✝ : P →ₐ[R] P'
g : P ≃ₐ[R] P'
I : FractionalIdeal S P
⊢ map (↑(AlgEquiv.symm g)) (map (↑g) I) = I

Next tactic:
rw [← map_comp, AlgEquiv.symm_comp, map_id]
/-- If `g` is an equivalence, `map g` is an isomorphism -/
def mapEquiv (g : P ≃ₐ[R] P') : FractionalIdeal S P ≃+* FractionalIdeal S P' where
  toFun := map g
  invFun := map g.symm
  map_add' I J := map_add I J _
  map_mul' I J := map_mul I J _
  left_inv I := by rw [← map_comp, AlgEquiv.symm_comp, map_id]
  right_inv I := by 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g✝ : P →ₐ[R] P'
g : P ≃ₐ[R] P'
I : FractionalIdeal S P'
⊢ map (↑g) (map (↑(AlgEquiv.symm g)) I) = I

Next tactic:
rw [← map_comp, AlgEquiv.comp_symm, map_id]
@[simp]
theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) :=
  RingEquiv.ext fun x => by 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
x : FractionalIdeal S P
⊢ (mapEquiv AlgEquiv.refl) x = (RingEquiv.refl (FractionalIdeal S P)) x

Next tactic:
simp
theorem isFractional_span_iff {s : Set P} :
    IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) :=
  ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ =>
    ⟨a, a_mem, fun b hb =>
      span_induction hb h
        (by
          

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
s : Set P
x✝ : ∃ a ∈ S, ∀ b ∈ s, IsInteger R (a • b)
a : R
a_mem : a ∈ S
h : ∀ b ∈ s, IsInteger R (a • b)
b : P
hb : b ∈ span R s
⊢ IsInteger R (a • 0)

Next tactic:
rw [smul_zero]
theorem isFractional_span_iff {s : Set P} :
    IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) :=
  ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ =>
    ⟨a, a_mem, fun b hb =>
      span_induction hb h
        (by
          rw [smul_zero]
          

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
s : Set P
x✝ : ∃ a ∈ S, ∀ b ∈ s, IsInteger R (a • b)
a : R
a_mem : a ∈ S
h : ∀ b ∈ s, IsInteger R (a • b)
b : P
hb : b ∈ span R s
⊢ IsInteger R 0

Next tactic:
exact isInteger_zero
theorem isFractional_span_iff {s : Set P} :
    IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) :=
  ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ =>
    ⟨a, a_mem, fun b hb =>
      span_induction hb h
        (by
          rw [smul_zero]
          exact isInteger_zero)
        (fun x y hx hy => by
          

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
s : Set P
x✝ : ∃ a ∈ S, ∀ b ∈ s, IsInteger R (a • b)
a : R
a_mem : a ∈ S
h : ∀ b ∈ s, IsInteger R (a • b)
b : P
hb : b ∈ span R s
x y : P
hx : IsInteger R (a • x)
hy : IsInteger R (a • y)
⊢ IsInteger R (a • (x + y))

Next tactic:
rw [smul_add]
theorem isFractional_span_iff {s : Set P} :
    IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) :=
  ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ =>
    ⟨a, a_mem, fun b hb =>
      span_induction hb h
        (by
          rw [smul_zero]
          exact isInteger_zero)
        (fun x y hx hy => by
          rw [smul_add]
          

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
s : Set P
x✝ : ∃ a ∈ S, ∀ b ∈ s, IsInteger R (a • b)
a : R
a_mem : a ∈ S
h : ∀ b ∈ s, IsInteger R (a • b)
b : P
hb : b ∈ span R s
x y : P
hx : IsInteger R (a • x)
hy : IsInteger R (a • y)
⊢ IsInteger R (a • x + a • y)

Next tactic:
exact isInteger_add hx hy
theorem isFractional_span_iff {s : Set P} :
    IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) :=
  ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ =>
    ⟨a, a_mem, fun b hb =>
      span_induction hb h
        (by
          rw [smul_zero]
          exact isInteger_zero)
        (fun x y hx hy => by
          rw [smul_add]
          exact isInteger_add hx hy)
        fun s x hx => by
        

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
s✝ : Set P
x✝ : ∃ a ∈ S, ∀ b ∈ s✝, IsInteger R (a • b)
a : R
a_mem : a ∈ S
h : ∀ b ∈ s✝, IsInteger R (a • b)
b : P
hb : b ∈ span R s✝
s : R
x : P
hx : IsInteger R (a • x)
⊢ IsInteger R (a • s • x)

Next tactic:
rw [smul_comm]
theorem isFractional_span_iff {s : Set P} :
    IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) :=
  ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ =>
    ⟨a, a_mem, fun b hb =>
      span_induction hb h
        (by
          rw [smul_zero]
          exact isInteger_zero)
        (fun x y hx hy => by
          rw [smul_add]
          exact isInteger_add hx hy)
        fun s x hx => by
        rw [smul_comm]
        

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
s✝ : Set P
x✝ : ∃ a ∈ S, ∀ b ∈ s✝, IsInteger R (a • b)
a : R
a_mem : a ∈ S
h : ∀ b ∈ s✝, IsInteger R (a • b)
b : P
hb : b ∈ span R s✝
s : R
x : P
hx : IsInteger R (a • x)
⊢ IsInteger R (s • a • x)

Next tactic:
exact isInteger_smul hx
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Submodule R P
hI : FG I
⊢ IsFractional S I

Next tactic:
rcases hI with ⟨I, rfl⟩
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
  rcases hI with ⟨I, rfl⟩
  

Proof state:
case intro
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Finset P
⊢ IsFractional S (span R ↑I)

Next tactic:
rcases exist_integer_multiples_of_finset S I with ⟨⟨s, hs1⟩, hs⟩
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
  rcases hI with ⟨I, rfl⟩
  rcases exist_integer_multiples_of_finset S I with ⟨⟨s, hs1⟩, hs⟩
  

Proof state:
case intro.intro.mk
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Finset P
s : R
hs1 : s ∈ S
hs : ∀ a ∈ I, IsInteger R (↑{ val := s, property := hs1 } • a)
⊢ IsFractional S (span R ↑I)

Next tactic:
rw [isFractional_span_iff]
theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by
  rcases hI with ⟨I, rfl⟩
  rcases exist_integer_multiples_of_finset S I with ⟨⟨s, hs1⟩, hs⟩
  rw [isFractional_span_iff]
  

Proof state:
case intro.intro.mk
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : Finset P
s : R
hs1 : s ∈ S
hs : ∀ a ∈ I, IsInteger R (↑{ val := s, property := hs1 } • a)
⊢ ∃ a ∈ S, ∀ b ∈ ↑I, IsInteger R (a • b)

Next tactic:
exact ⟨s, hs1, hs⟩
theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x ∈ I * J) :
    ∃ T T' : Finset P, (T : Set P) ⊆ I ∧ (T' : Set P) ⊆ J ∧ x ∈ span R (T * T' : Set P) :=
  Submodule.mem_span_mul_finite_of_mem_mul (by 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J✝ : FractionalIdeal S P
g : P →ₐ[R] P'
I J : FractionalIdeal S P
x : P
hx : x ∈ I * J
⊢ x ∈ ↑I * ↑J

Next tactic:
simpa using mem_coe.mpr hx
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
    (h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
inj : Function.Injective ⇑(algebraMap R P)
I : Ideal R
h : IsUnit ↑I
⊢ Ideal.FG I

Next tactic:
rw [← coeIdeal_fg S inj I]
theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R)
    (h : IsUnit (I : FractionalIdeal S P)) : I.FG := by
  rw [← coeIdeal_fg S inj I]
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
inj : Function.Injective ⇑(algebraMap R P)
I : Ideal R
h : IsUnit ↑I
⊢ FG ↑↑I

Next tactic:
exact FractionalIdeal.fg_of_isUnit I h
/-- `canonicalEquiv f f'` is the canonical equivalence between the fractional
ideals in `P` and in `P'`, which are both localizations of `R` at `S`. -/
noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P ≃+* FractionalIdeal S P' :=
  mapEquiv
    { ringEquivOfRingEquiv P P' (RingEquiv.refl R)
        (show S.map _ = S by 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I J : FractionalIdeal S P
g : P →ₐ[R] P'
⊢ Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S

Next tactic:
rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
    x ∈ canonicalEquiv S P P' I ↔
      ∃ y ∈ I,
        IsLocalization.map P' (RingHom.id R) (fun y (hy : y ∈ S) => show RingHom.id R y ∈ S from hy)
            (y : P) =
          x := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : FractionalIdeal S P
x : P'
⊢ x ∈ (canonicalEquiv S P P') I ↔
    ∃ y ∈ I, (IsLocalization.map P' (RingHom.id R) (_ : ∀ y ∈ S, (RingHom.id R) y ∈ S)) y = x

Next tactic:
rw [canonicalEquiv, mapEquiv_apply, mem_map]
@[simp]
theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} :
    x ∈ canonicalEquiv S P P' I ↔
      ∃ y ∈ I,
        IsLocalization.map P' (RingHom.id R) (fun y (hy : y ∈ S) => show RingHom.id R y ∈ S from hy)
            (y : P) =
          x := by
  rw [canonicalEquiv, mapEquiv_apply, mem_map]
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : FractionalIdeal S P
x : P'
⊢ (∃ x_1 ∈ I,
      ↑(let src :=
              ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S);
            { toEquiv := src.toEquiv,
              map_mul' :=
                (_ :
                  ∀ (x y : P),
                    Equiv.toFun
                        (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                            (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S)).toEquiv
                        (x * y) =
                      Equiv.toFun
                          (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                              (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S)).toEquiv
                          x *
                        Equiv.toFun
                          (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                              (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S)).toEquiv
                          y),
              map_add' :=
                (_ :
                  ∀ (x y : P),
                    Equiv.toFun
                        (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                            (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S)).toEquiv
                        (x + y) =
                      Equiv.toFun
                          (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                              (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S)).toEquiv
                          x +
                        Equiv.toFun
                          (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                              (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S)).toEquiv
                          y),
              commutes' :=
                (_ :
                  ∀ (r : R),
                    (ringEquivOfRingEquiv P P' (RingEquiv.refl R)
                          (_ : Submonoid.map (RingEquiv.toMonoidHom (RingEquiv.refl R)) S = S))
                        ((algebraMap R P) r) =
                      (algebraMap R P') ((RingEquiv.refl R) r)) })
          x_1 =
        x) ↔
    ∃ y ∈ I, (IsLocalization.map P' (RingHom.id R) (_ : ∀ y ∈ S, (RingHom.id R) y ∈ S)) y = x

Next tactic:
exact ⟨fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩, fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩⟩
@[simp]
theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P :=
  RingEquiv.ext fun I =>
    SetLike.ext_iff.mpr fun x => by
      

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
S : Submonoid R
P : Type u_2
inst✝⁵ : CommRing P
inst✝⁴ : Algebra R P
loc : IsLocalization S P
P' : Type u_3
inst✝³ : CommRing P'
inst✝² : Algebra R P'
loc' : IsLocalization S P'
P'' : Type u_4
inst✝¹ : CommRing P''
inst✝ : Algebra R P''
loc'' : IsLocalization S P''
I✝ J : FractionalIdeal S P
g : P →ₐ[R] P'
I : FractionalIdeal S P'
x : P
⊢ x ∈ (RingEquiv.symm (canonicalEquiv S P P')) I ↔ x ∈ (canonicalEquiv S P' P) I

Next tactic:
rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply,
        mem_map]