l3lab/ntp-mathlib huggingface dataset:
theorem IsIntegral.fg_adjoin_singleton {x : B} (hx : IsIntegral R x) :
    (Algebra.adjoin R {x}).toSubmodule.FG := by
  rcases hx with ⟨f, hfm, hfx⟩
  

Proof state:
case intro.intro
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝ : R →+* S
x : B
f : R[X]
hfm : Monic f
hfx : eval₂ (algebraMap R B) x f = 0
⊢ FG (Subalgebra.toSubmodule (Algebra.adjoin R {x}))

Next tactic:
use (Finset.range <| f.natDegree).image (x ^ ·)
theorem IsIntegral.fg_adjoin_singleton {x : B} (hx : IsIntegral R x) :
    (Algebra.adjoin R {x}).toSubmodule.FG := by
  rcases hx with ⟨f, hfm, hfx⟩
  use (Finset.range <| f.natDegree).image (x ^ ·)
  

Proof state:
case h
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝ : R →+* S
x : B
f : R[X]
hfm : Monic f
hfx : eval₂ (algebraMap R B) x f = 0
⊢ span R ↑(Finset.image (fun x_1 => x ^ x_1) (Finset.range (natDegree f))) =
    Subalgebra.toSubmodule (Algebra.adjoin R {x})

Next tactic:
exact span_range_natDegree_eq_adjoin hfm (by rwa [aeval_def])
theorem IsIntegral.fg_adjoin_singleton {x : B} (hx : IsIntegral R x) :
    (Algebra.adjoin R {x}).toSubmodule.FG := by
  rcases hx with ⟨f, hfm, hfx⟩
  use (Finset.range <| f.natDegree).image (x ^ ·)
  exact span_range_natDegree_eq_adjoin hfm (by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝ : R →+* S
x : B
f : R[X]
hfm : Monic f
hfx : eval₂ (algebraMap R B) x f = 0
⊢ (aeval x) f = 0

Next tactic:
rwa [aeval_def]
theorem fg_adjoin_of_finite {s : Set A} (hfs : s.Finite) (his : ∀ x ∈ s, IsIntegral R x) :
    (Algebra.adjoin R s).toSubmodule.FG :=
  Set.Finite.induction_on hfs
    (fun _ =>
      ⟨{1},
        Submodule.ext fun x => by
          

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
s : Set A
hfs : Set.Finite s
his : ∀ x ∈ s, IsIntegral R x
x✝ : ∀ x ∈ ∅, IsIntegral R x
x : A
⊢ x ∈ span R ↑{1} ↔ x ∈ Subalgebra.toSubmodule (Algebra.adjoin R ∅)

Next tactic:
rw [Algebra.adjoin_empty, Finset.coe_singleton, ← one_eq_span, Algebra.toSubmodule_bot]
theorem fg_adjoin_of_finite {s : Set A} (hfs : s.Finite) (his : ∀ x ∈ s, IsIntegral R x) :
    (Algebra.adjoin R s).toSubmodule.FG :=
  Set.Finite.induction_on hfs
    (fun _ =>
      ⟨{1},
        Submodule.ext fun x => by
          rw [Algebra.adjoin_empty, Finset.coe_singleton, ← one_eq_span, Algebra.toSubmodule_bot]⟩)
    (fun {a s} _ _ ih his => by
      

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
s✝ : Set A
hfs : Set.Finite s✝
his✝ : ∀ x ∈ s✝, IsIntegral R x
a : A
s : Set A
x✝¹ : a ∉ s
x✝ : Set.Finite s
ih : (∀ x ∈ s, IsIntegral R x) → FG (Subalgebra.toSubmodule (Algebra.adjoin R s))
his : ∀ x ∈ insert a s, IsIntegral R x
⊢ FG (Subalgebra.toSubmodule (Algebra.adjoin R (insert a s)))

Next tactic:
rw [← Set.union_singleton, Algebra.adjoin_union_coe_submodule]
theorem fg_adjoin_of_finite {s : Set A} (hfs : s.Finite) (his : ∀ x ∈ s, IsIntegral R x) :
    (Algebra.adjoin R s).toSubmodule.FG :=
  Set.Finite.induction_on hfs
    (fun _ =>
      ⟨{1},
        Submodule.ext fun x => by
          rw [Algebra.adjoin_empty, Finset.coe_singleton, ← one_eq_span, Algebra.toSubmodule_bot]⟩)
    (fun {a s} _ _ ih his => by
      rw [← Set.union_singleton, Algebra.adjoin_union_coe_submodule]
      

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
s✝ : Set A
hfs : Set.Finite s✝
his✝ : ∀ x ∈ s✝, IsIntegral R x
a : A
s : Set A
x✝¹ : a ∉ s
x✝ : Set.Finite s
ih : (∀ x ∈ s, IsIntegral R x) → FG (Subalgebra.toSubmodule (Algebra.adjoin R s))
his : ∀ x ∈ insert a s, IsIntegral R x
⊢ FG (Subalgebra.toSubmodule (Algebra.adjoin R s) * Subalgebra.toSubmodule (Algebra.adjoin R {a}))

Next tactic:
exact
        FG.mul (ih fun i hi => his i <| Set.mem_insert_of_mem a hi)
          (his a <| Set.mem_insert a s).fg_adjoin_singleton
/-- Suppose `A` is an `R`-algebra, `M` is an `A`-module such that `a • m ≠ 0` for all non-zero `a`
and `m`. If `x : A` fixes a nontrivial f.g. `R`-submodule `N` of `M`, then `x` is `R`-integral. -/
theorem isIntegral_of_smul_mem_submodule {M : Type*} [AddCommGroup M] [Module R M] [Module A M]
    [IsScalarTower R A M] [NoZeroSMulDivisors A M] (N : Submodule R M) (hN : N ≠ ⊥) (hN' : N.FG)
    (x : A) (hx : ∀ n ∈ N, x • n ∈ N) : IsIntegral R x := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : Ring B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_5
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ n ∈ N, x • n ∈ N
⊢ IsIntegral R x

Next tactic:
let A' : Subalgebra R A :=
    { carrier := { x | ∀ n ∈ N, x • n ∈ N }
      mul_mem' := fun {a b} ha hb n hn => smul_smul a b n ▸ ha _ (hb _ hn)
      one_mem' := fun n hn => (one_smul A n).symm ▸ hn
      add_mem' := fun {a b} ha hb n hn => (add_smul a b n).symm ▸ N.add_mem (ha _ hn) (hb _ hn)
      zero_mem' := fun n _hn => (zero_smul A n).symm ▸ N.zero_mem
      algebraMap_mem' := fun r n hn => (algebraMap_smul A r n).symm ▸ N.smul_mem r hn }
/-- The [Kurosh problem](https://en.wikipedia.org/wiki/Kurosh_problem) asks to show that
  this is still true when `A` is not necessarily commutative and `R` is a field, but it has
  been solved in the negative. See https://arxiv.org/pdf/1706.02383.pdf for criteria for a
  finitely generated algebraic (= integral) algebra over a field to be finite dimensional. -/
theorem Algebra.IsIntegral.finite (h : Algebra.IsIntegral R A) [h' : Algebra.FiniteType R A] :
    Module.Finite R A :=
  have ⟨s, hs⟩ := h'
  ⟨by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
h : Algebra.IsIntegral R A
h' : FiniteType R A
s : Finset A
hs : adjoin R ↑s = ⊤
⊢ FG ⊤

Next tactic:
apply hs ▸ fg_adjoin_of_finite s.finite_toSet fun x _ ↦ h x
theorem RingHom.IsIntegralElem.of_mem_closure {x y z : S} (hx : f.IsIntegralElem x)
    (hy : f.IsIntegralElem y) (hz : z ∈ Subring.closure ({x, y} : Set S)) : f.IsIntegralElem z := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
x y z : S
hx : IsIntegralElem f x
hy : IsIntegralElem f y
hz : z ∈ Subring.closure {x, y}
⊢ IsIntegralElem f z

Next tactic:
letI : Algebra R S := f.toAlgebra
theorem RingHom.IsIntegralElem.of_mem_closure {x y z : S} (hx : f.IsIntegralElem x)
    (hy : f.IsIntegralElem y) (hz : z ∈ Subring.closure ({x, y} : Set S)) : f.IsIntegralElem z := by
  letI : Algebra R S := f.toAlgebra
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
x y z : S
hx : IsIntegralElem f x
hy : IsIntegralElem f y
hz : z ∈ Subring.closure {x, y}
this : Algebra R S := toAlgebra f
⊢ IsIntegralElem f z

Next tactic:
have := (IsIntegral.fg_adjoin_singleton hx).mul (IsIntegral.fg_adjoin_singleton hy)
theorem RingHom.IsIntegralElem.of_mem_closure {x y z : S} (hx : f.IsIntegralElem x)
    (hy : f.IsIntegralElem y) (hz : z ∈ Subring.closure ({x, y} : Set S)) : f.IsIntegralElem z := by
  letI : Algebra R S := f.toAlgebra
  have := (IsIntegral.fg_adjoin_singleton hx).mul (IsIntegral.fg_adjoin_singleton hy)
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
x y z : S
hx : IsIntegralElem f x
hy : IsIntegralElem f y
hz : z ∈ Subring.closure {x, y}
this✝ : Algebra R S := toAlgebra f
this : FG (Subalgebra.toSubmodule (Algebra.adjoin R {x}) * Subalgebra.toSubmodule (Algebra.adjoin R {y}))
⊢ IsIntegralElem f z

Next tactic:
rw [← Algebra.adjoin_union_coe_submodule, Set.singleton_union] at this
theorem RingHom.IsIntegralElem.of_mem_closure {x y z : S} (hx : f.IsIntegralElem x)
    (hy : f.IsIntegralElem y) (hz : z ∈ Subring.closure ({x, y} : Set S)) : f.IsIntegralElem z := by
  letI : Algebra R S := f.toAlgebra
  have := (IsIntegral.fg_adjoin_singleton hx).mul (IsIntegral.fg_adjoin_singleton hy)
  rw [← Algebra.adjoin_union_coe_submodule, Set.singleton_union] at this
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : R →+* S
x y z : S
hx : IsIntegralElem f x
hy : IsIntegralElem f y
hz : z ∈ Subring.closure {x, y}
this✝ : Algebra R S := toAlgebra f
this : FG (Subalgebra.toSubmodule (Algebra.adjoin R {x, y}))
⊢ IsIntegralElem f z

Next tactic:
exact
    IsIntegral.of_mem_of_fg (Algebra.adjoin R {x, y}) this z
      (Algebra.mem_adjoin_iff.2 <| Subring.closure_mono (Set.subset_union_right _ _) hz)
theorem RingHom.IsIntegralElem.sub {x y : S} (hx : f.IsIntegralElem x) (hy : f.IsIntegralElem y) :
    f.IsIntegralElem (x - y) := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x y : S
hx : IsIntegralElem f x
hy : IsIntegralElem f y
⊢ IsIntegralElem f (x - y)

Next tactic:
simpa only [sub_eq_add_neg] using hx.add f (hy.neg f)
theorem IsIntegral.smul {R} [CommSemiring R] [CommRing S] [Algebra R B] [Algebra S B] [Algebra R S]
    [IsScalarTower R S B] {x : B} (r : R)(hx : IsIntegral S x) : IsIntegral S (r • x) :=
  .of_mem_of_fg _ hx.fg_adjoin_singleton _ <| by
    

Proof state:
R✝ : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝¹¹ : CommRing R✝
inst✝¹⁰ : CommRing A
inst✝⁹ : Ring B
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R✝ A
inst✝⁶ : Algebra R✝ B
f✝¹ : R✝ →+* S
f✝ : R✝ →+* B
f : R✝ →+* S
R : Type u_5
inst✝⁵ : CommSemiring R
inst✝⁴ : CommRing S
inst✝³ : Algebra R B
inst✝² : Algebra S B
inst✝¹ : Algebra R S
inst✝ : IsScalarTower R S B
x : B
r : R
hx : IsIntegral S x
⊢ r • x ∈ Algebra.adjoin S {x}

Next tactic:
rw [← algebraMap_smul S]
theorem IsIntegral.smul {R} [CommSemiring R] [CommRing S] [Algebra R B] [Algebra S B] [Algebra R S]
    [IsScalarTower R S B] {x : B} (r : R)(hx : IsIntegral S x) : IsIntegral S (r • x) :=
  .of_mem_of_fg _ hx.fg_adjoin_singleton _ <| by
    rw [← algebraMap_smul S]; 

Proof state:
R✝ : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝¹¹ : CommRing R✝
inst✝¹⁰ : CommRing A
inst✝⁹ : Ring B
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R✝ A
inst✝⁶ : Algebra R✝ B
f✝¹ : R✝ →+* S
f✝ : R✝ →+* B
f : R✝ →+* S
R : Type u_5
inst✝⁵ : CommSemiring R
inst✝⁴ : CommRing S
inst✝³ : Algebra R B
inst✝² : Algebra S B
inst✝¹ : Algebra R S
inst✝ : IsScalarTower R S B
x : B
r : R
hx : IsIntegral S x
⊢ (algebraMap R S) r • x ∈ Algebra.adjoin S {x}

Next tactic:
apply Subalgebra.smul_mem
theorem IsIntegral.smul {R} [CommSemiring R] [CommRing S] [Algebra R B] [Algebra S B] [Algebra R S]
    [IsScalarTower R S B] {x : B} (r : R)(hx : IsIntegral S x) : IsIntegral S (r • x) :=
  .of_mem_of_fg _ hx.fg_adjoin_singleton _ <| by
    rw [← algebraMap_smul S]; apply Subalgebra.smul_mem; 

Proof state:
case hx
R✝ : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝¹¹ : CommRing R✝
inst✝¹⁰ : CommRing A
inst✝⁹ : Ring B
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R✝ A
inst✝⁶ : Algebra R✝ B
f✝¹ : R✝ →+* S
f✝ : R✝ →+* B
f : R✝ →+* S
R : Type u_5
inst✝⁵ : CommSemiring R
inst✝⁴ : CommRing S
inst✝³ : Algebra R B
inst✝² : Algebra S B
inst✝¹ : Algebra R S
inst✝ : IsScalarTower R S B
x : B
r : R
hx : IsIntegral S x
⊢ x ∈ Algebra.adjoin S {x}

Next tactic:
exact Algebra.subset_adjoin rfl
theorem IsIntegral.of_pow {x : B} {n : ℕ} (hn : 0 < n) (hx : IsIntegral R <| x ^ n) :
    IsIntegral R x := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : B
n : ℕ
hn : 0 < n
hx : IsIntegral R (x ^ n)
⊢ IsIntegral R x

Next tactic:
rcases hx with ⟨p, hmonic, heval⟩
theorem IsIntegral.of_pow {x : B} {n : ℕ} (hn : 0 < n) (hx : IsIntegral R <| x ^ n) :
    IsIntegral R x := by
  rcases hx with ⟨p, hmonic, heval⟩
  

Proof state:
case intro.intro
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : B
n : ℕ
hn : 0 < n
p : R[X]
hmonic : Monic p
heval : eval₂ (algebraMap R B) (x ^ n) p = 0
⊢ IsIntegral R x

Next tactic:
exact ⟨expand R n p, hmonic.expand hn, by rwa [← aeval_def, expand_aeval]⟩
theorem IsIntegral.of_pow {x : B} {n : ℕ} (hn : 0 < n) (hx : IsIntegral R <| x ^ n) :
    IsIntegral R x := by
  rcases hx with ⟨p, hmonic, heval⟩
  exact ⟨expand R n p, hmonic.expand hn, by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : B
n : ℕ
hn : 0 < n
p : R[X]
hmonic : Monic p
heval : eval₂ (algebraMap R B) (x ^ n) p = 0
⊢ eval₂ (algebraMap R B) x ((expand R n) p) = 0

Next tactic:
rwa [← aeval_def, expand_aeval]
theorem adjoin_le_integralClosure {x : A} (hx : IsIntegral R x) :
    Algebra.adjoin R {x} ≤ integralClosure R A := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : A
hx : IsIntegral R x
⊢ Algebra.adjoin R {x} ≤ integralClosure R A

Next tactic:
rw [Algebra.adjoin_le_iff]
theorem adjoin_le_integralClosure {x : A} (hx : IsIntegral R x) :
    Algebra.adjoin R {x} ≤ integralClosure R A := by
  rw [Algebra.adjoin_le_iff]
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : A
hx : IsIntegral R x
⊢ {x} ⊆ ↑(integralClosure R A)

Next tactic:
simp only [SetLike.mem_coe, Set.singleton_subset_iff]
theorem adjoin_le_integralClosure {x : A} (hx : IsIntegral R x) :
    Algebra.adjoin R {x} ≤ integralClosure R A := by
  rw [Algebra.adjoin_le_iff]
  simp only [SetLike.mem_coe, Set.singleton_subset_iff]
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : A
hx : IsIntegral R x
⊢ x ∈ integralClosure R A

Next tactic:
exact hx
theorem Algebra.isIntegral_sup {S T : Subalgebra R A} :
    Algebra.IsIntegral R (S ⊔ T : Subalgebra R A) ↔
      Algebra.IsIntegral R S ∧ Algebra.IsIntegral R T := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S✝ : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S✝
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S✝
f✝ : R →+* B
f : R →+* S✝
S T : Subalgebra R A
⊢ Algebra.IsIntegral R ↥(S ⊔ T) ↔ Algebra.IsIntegral R ↥S ∧ Algebra.IsIntegral R ↥T

Next tactic:
simp only [← le_integralClosure_iff_isIntegral, sup_le_iff]
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
⊢ Subalgebra.map (↑f) (integralClosure R A) = integralClosure R S

Next tactic:
ext y
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  

Proof state:
case h
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
y : S
⊢ y ∈ Subalgebra.map (↑f) (integralClosure R A) ↔ y ∈ integralClosure R S

Next tactic:
rw [Subalgebra.mem_map]
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  rw [Subalgebra.mem_map]
  

Proof state:
case h
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
y : S
⊢ (∃ x ∈ integralClosure R A, ↑f x = y) ↔ y ∈ integralClosure R S

Next tactic:
constructor
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  rw [Subalgebra.mem_map]
  constructor
  · 

Proof state:
case h.mp
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
y : S
⊢ (∃ x ∈ integralClosure R A, ↑f x = y) → y ∈ integralClosure R S

Next tactic:
rintro ⟨x, hx, rfl⟩
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  rw [Subalgebra.mem_map]
  constructor
  · rintro ⟨x, hx, rfl⟩
    

Proof state:
case h.mp.intro.intro
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
x : A
hx : x ∈ integralClosure R A
⊢ ↑f x ∈ integralClosure R S

Next tactic:
exact hx.map f
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  rw [Subalgebra.mem_map]
  constructor
  · rintro ⟨x, hx, rfl⟩
    exact hx.map f
  · 

Proof state:
case h.mpr
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
y : S
⊢ y ∈ integralClosure R S → ∃ x ∈ integralClosure R A, ↑f x = y

Next tactic:
intro hy
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  rw [Subalgebra.mem_map]
  constructor
  · rintro ⟨x, hx, rfl⟩
    exact hx.map f
  · intro hy
    

Proof state:
case h.mpr
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
y : S
hy : y ∈ integralClosure R S
⊢ ∃ x ∈ integralClosure R A, ↑f x = y

Next tactic:
use f.symm y, hy.map (f.symm : S →ₐ[R] A)
/-- Mapping an integral closure along an `AlgEquiv` gives the integral closure. -/
theorem integralClosure_map_algEquiv [Algebra R S] (f : A ≃ₐ[R] S) :
    (integralClosure R A).map (f : A →ₐ[R] S) = integralClosure R S := by
  ext y
  rw [Subalgebra.mem_map]
  constructor
  · rintro ⟨x, hx, rfl⟩
    exact hx.map f
  · intro hy
    use f.symm y, hy.map (f.symm : S →ₐ[R] A)
    

Proof state:
case right
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : Ring B
inst✝³ : CommRing S
inst✝² : Algebra R A
inst✝¹ : Algebra R B
f✝² : R →+* S
f✝¹ : R →+* B
f✝ : R →+* S
inst✝ : Algebra R S
f : A ≃ₐ[R] S
y : S
hy : y ∈ integralClosure R S
⊢ ↑f ((AlgEquiv.symm f) y) = y

Next tactic:
simp
theorem integralClosure.isIntegral (x : integralClosure R A) : IsIntegral R x :=
  let ⟨p, hpm, hpx⟩ := x.2
  ⟨p, hpm,
    Subtype.eq <| by
      

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x : ↥(integralClosure R A)
p : R[X]
hpm : Monic p
hpx : eval₂ (algebraMap R A) (↑x) p = 0
⊢ ↑(eval₂ (algebraMap R ↥(integralClosure R A)) x p) = ↑0

Next tactic:
rwa [← aeval_def, ← Subalgebra.val_apply, aeval_algHom_apply] at hpx
theorem IsIntegral.of_mul_unit {x y : B} {r : R} (hr : algebraMap R B r * y = 1)
    (hx : IsIntegral R (x * y)) : IsIntegral R x := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x y : B
r : R
hr : (algebraMap R B) r * y = 1
hx : IsIntegral R (x * y)
⊢ IsIntegral R x

Next tactic:
obtain ⟨p, p_monic, hp⟩ := hx
theorem IsIntegral.of_mul_unit {x y : B} {r : R} (hr : algebraMap R B r * y = 1)
    (hx : IsIntegral R (x * y)) : IsIntegral R x := by
  obtain ⟨p, p_monic, hp⟩ := hx
  

Proof state:
case intro.intro
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x y : B
r : R
hr : (algebraMap R B) r * y = 1
p : R[X]
p_monic : Monic p
hp : eval₂ (algebraMap R B) (x * y) p = 0
⊢ IsIntegral R x

Next tactic:
refine ⟨scaleRoots p r, (monic_scaleRoots_iff r).2 p_monic, ?_⟩
theorem IsIntegral.of_mul_unit {x y : B} {r : R} (hr : algebraMap R B r * y = 1)
    (hx : IsIntegral R (x * y)) : IsIntegral R x := by
  obtain ⟨p, p_monic, hp⟩ := hx
  refine ⟨scaleRoots p r, (monic_scaleRoots_iff r).2 p_monic, ?_⟩
  

Proof state:
case intro.intro
R : Type u_1
A : Type u_2
B : Type u_3
S : Type u_4
inst✝⁵ : CommRing R
inst✝⁴ : CommRing A
inst✝³ : Ring B
inst✝² : CommRing S
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f✝¹ : R →+* S
f✝ : R →+* B
f : R →+* S
x y : B
r : R
hr : (algebraMap R B) r * y = 1
p : R[X]
p_monic : Monic p
hp : eval₂ (algebraMap R B) (x * y) p = 0
⊢ eval₂ (algebraMap R B) x (scaleRoots p r) = 0

Next tactic:
convert scaleRoots_aeval_eq_zero hp