l3lab/ntp-mathlib huggingface dataset:
/-- A (random) isomorphism between an algebraic closure of `R` and an algebraic closure of
  an algebraic extension of `R` -/
noncomputable def equivOfAlgebraic' [Nontrivial S] [NoZeroSMulDivisors R S]
    (hRL : Algebra.IsAlgebraic R L) : L ≃ₐ[R] M := by
  letI : NoZeroSMulDivisors R L := NoZeroSMulDivisors.of_algebraMap_injective <| by
    rw [IsScalarTower.algebraMap_eq R S L]
    exact (Function.Injective.comp (NoZeroSMulDivisors.algebraMap_injective S L)
            (NoZeroSMulDivisors.algebraMap_injective R S) : _)
  letI : IsAlgClosure R L :=
    { alg_closed := IsAlgClosure.alg_closed S
      algebraic := hRL }
  

Proof state:
k : Type u
inst✝²⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝²³ : Field K
inst✝²² : Field J
inst✝²¹ : CommRing R
inst✝²⁰ : CommRing S
inst✝¹⁹ : Field L
inst✝¹⁸ : Field M
inst✝¹⁷ : Algebra R M
inst✝¹⁶ : NoZeroSMulDivisors R M
inst✝¹⁵ : IsAlgClosure R M
inst✝¹⁴ : Algebra K M
inst✝¹³ : IsAlgClosure K M
inst✝¹² : Algebra S L
inst✝¹¹ : NoZeroSMulDivisors S L
inst✝¹⁰ : IsAlgClosure S L
inst✝⁹ : Algebra R S
inst✝⁸ : Algebra R L
inst✝⁷ : IsScalarTower R S L
inst✝⁶ : Algebra K J
inst✝⁵ : Algebra J L
inst✝⁴ : IsAlgClosure J L
inst✝³ : Algebra K L
inst✝² : IsScalarTower K J L
inst✝¹ : Nontrivial S
inst✝ : NoZeroSMulDivisors R S
hRL : Algebra.IsAlgebraic R L
this✝ : NoZeroSMulDivisors R L :=
  NoZeroSMulDivisors.of_algebraMap_injective
    (Eq.mpr (id (IsScalarTower.algebraMap_eq R S L ▸ Eq.refl (Function.Injective ⇑(algebraMap R L))))
      (Function.Injective.comp (NoZeroSMulDivisors.algebraMap_injective S L)
        (NoZeroSMulDivisors.algebraMap_injective R S)))
this : IsAlgClosure R L := { alg_closed := alg_closed S, algebraic := hRL }
⊢ L ≃ₐ[R] M

Next tactic:
exact IsAlgClosure.equiv _ _ _
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝¹ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝² : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝¹ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝³ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝² : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝¹ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁴ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝³ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝² : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝¹ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝ : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this : IsScalarTower R S L
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by simp [RingHom.algebraMap_toAlgebra])
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by 

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁴ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝³ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝² : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝¹ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝ : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this : IsScalarTower R S L
⊢ ∀ (x : S), (algebraMap S L) x = (algebraMap R L) ((algebraMap S R) x)

Next tactic:
simp [RingHom.algebraMap_toAlgebra]
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by simp [RingHom.algebraMap_toAlgebra])
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁵ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝⁴ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝³ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝² : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝¹ : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this✝ : IsScalarTower R S L
this : IsScalarTower S R L
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
haveI : NoZeroSMulDivisors R S := NoZeroSMulDivisors.of_algebraMap_injective hSR.symm.injective
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by simp [RingHom.algebraMap_toAlgebra])
  haveI : NoZeroSMulDivisors R S := NoZeroSMulDivisors.of_algebraMap_injective hSR.symm.injective
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁶ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝⁵ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝⁴ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝³ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝² : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this✝¹ : IsScalarTower R S L
this✝ : IsScalarTower S R L
this : NoZeroSMulDivisors R S
⊢ { e //
    RingHom.comp (RingEquiv.toRingHom e) (algebraMap S L) = RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR) }

Next tactic:
refine
    ⟨equivOfAlgebraic' R S L M
        (IsAlgClosure.algebraic.tower_top_of_injective
          (show Function.Injective (algebraMap S R) from hSR.injective)), ?_⟩
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by simp [RingHom.algebraMap_toAlgebra])
  haveI : NoZeroSMulDivisors R S := NoZeroSMulDivisors.of_algebraMap_injective hSR.symm.injective
  refine
    ⟨equivOfAlgebraic' R S L M
        (IsAlgClosure.algebraic.tower_top_of_injective
          (show Function.Injective (algebraMap S R) from hSR.injective)), ?_⟩
  

Proof state:
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁶ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝⁵ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝⁴ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝³ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝² : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this✝¹ : IsScalarTower R S L
this✝ : IsScalarTower S R L
this : NoZeroSMulDivisors R S
⊢ RingHom.comp (RingEquiv.toRingHom ↑(equivOfAlgebraic' R S L M (_ : Algebra.IsAlgebraic R L))) (algebraMap S L) =
    RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR)

Next tactic:
ext x
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by simp [RingHom.algebraMap_toAlgebra])
  haveI : NoZeroSMulDivisors R S := NoZeroSMulDivisors.of_algebraMap_injective hSR.symm.injective
  refine
    ⟨equivOfAlgebraic' R S L M
        (IsAlgClosure.algebraic.tower_top_of_injective
          (show Function.Injective (algebraMap S R) from hSR.injective)), ?_⟩
  ext x
  

Proof state:
case a
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁶ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝⁵ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝⁴ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝³ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝² : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this✝¹ : IsScalarTower R S L
this✝ : IsScalarTower S R L
this : NoZeroSMulDivisors R S
x : S
⊢ (RingHom.comp (RingEquiv.toRingHom ↑(equivOfAlgebraic' R S L M (_ : Algebra.IsAlgebraic R L))) (algebraMap S L)) x =
    (RingHom.comp (algebraMap R M) (RingEquiv.toRingHom hSR)) x

Next tactic:
simp only [RingEquiv.toRingHom_eq_coe, Function.comp_apply, RingHom.coe_comp,
    AlgEquiv.coe_ringEquiv, RingEquiv.coe_toRingHom]
/-- Used in the definition of `equivOfEquiv` -/
noncomputable def equivOfEquivAux (hSR : S ≃+* R) :
    { e : L ≃+* M // e.toRingHom.comp (algebraMap S L) = (algebraMap R M).comp hSR.toRingHom } := by
  letI : Algebra R S := RingHom.toAlgebra hSR.symm.toRingHom
  letI : Algebra S R := RingHom.toAlgebra hSR.toRingHom
  letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R M).isDomain _
  letI : IsDomain S := (NoZeroSMulDivisors.algebraMap_injective S L).isDomain _
  letI : Algebra R L := RingHom.toAlgebra ((algebraMap S L).comp (algebraMap R S))
  haveI : IsScalarTower R S L := IsScalarTower.of_algebraMap_eq fun _ => rfl
  haveI : IsScalarTower S R L :=
    IsScalarTower.of_algebraMap_eq (by simp [RingHom.algebraMap_toAlgebra])
  haveI : NoZeroSMulDivisors R S := NoZeroSMulDivisors.of_algebraMap_injective hSR.symm.injective
  refine
    ⟨equivOfAlgebraic' R S L M
        (IsAlgClosure.algebraic.tower_top_of_injective
          (show Function.Injective (algebraMap S R) from hSR.injective)), ?_⟩
  ext x
  simp only [RingEquiv.toRingHom_eq_coe, Function.comp_apply, RingHom.coe_comp,
    AlgEquiv.coe_ringEquiv, RingEquiv.coe_toRingHom]
  

Proof state:
case a
k : Type u
inst✝¹⁴ : Field k
K : Type u_1
J : Type u_2
R : Type u
S : Type u_3
L : Type v
M : Type w
inst✝¹³ : Field K
inst✝¹² : Field J
inst✝¹¹ : CommRing R
inst✝¹⁰ : CommRing S
inst✝⁹ : Field L
inst✝⁸ : Field M
inst✝⁷ : Algebra R M
inst✝⁶ : NoZeroSMulDivisors R M
inst✝⁵ : IsAlgClosure R M
inst✝⁴ : Algebra K M
inst✝³ : IsAlgClosure K M
inst✝² : Algebra S L
inst✝¹ : NoZeroSMulDivisors S L
inst✝ : IsAlgClosure S L
hSR : S ≃+* R
this✝⁶ : Algebra R S := RingHom.toAlgebra (RingEquiv.toRingHom (RingEquiv.symm hSR))
this✝⁵ : Algebra S R := RingHom.toAlgebra (RingEquiv.toRingHom hSR)
this✝⁴ : IsDomain R := Function.Injective.isDomain (algebraMap R M) (NoZeroSMulDivisors.algebraMap_injective R M)
this✝³ : IsDomain S := Function.Injective.isDomain (algebraMap S L) (NoZeroSMulDivisors.algebraMap_injective S L)
this✝² : Algebra R L := RingHom.toAlgebra (RingHom.comp (algebraMap S L) (algebraMap R S))
this✝¹ : IsScalarTower R S L
this✝ : IsScalarTower S R L
this : NoZeroSMulDivisors R S
x : S
⊢ (equivOfAlgebraic' R S L M (_ : Algebra.IsAlgebraic R L)) ((algebraMap S L) x) = (algebraMap R M) (hSR x)

Next tactic:
conv_lhs => rw [← hSR.symm_apply_apply x]