-- Mathlib/NumberTheory/RamificationInertia/Basic.lean
theorem finrank_quotient_map [IsDomain S] [IsDedekindDomain R] [Algebra K L]
    [Algebra R L] [IsScalarTower R K L] [IsScalarTower R S L]
    [hp : p.IsMaximal] [Module.Finite R S] :
    finrank (R ⧸ p) (S ⧸ map (algebraMap R S) p) = finrank K L

Proof state:
case refine_2
R : Type u
inst✝¹⁴ : CommRing R
S : Type v
inst✝¹³ : CommRing S
p : Ideal R
inst✝¹² : Algebra R S
K : Type u_1
inst✝¹¹ : Field K
inst✝¹⁰ : Algebra R K
L : Type u_2
inst✝⁹ : Field L
inst✝⁸ : Algebra S L
inst✝⁷ : IsFractionRing S L
hRK : IsFractionRing R K
inst✝⁶ : IsDomain S
inst✝⁵ : IsDedekindDomain R
inst✝⁴ : Algebra K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsScalarTower R S L
hp : p.IsMaximal
inst✝ : Module.Finite R S
ι : Type v := Free.ChooseBasisIndex (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b : Basis ι (R ⧸ p) (S ⧸ map (algebraMap R S) p) := Free.chooseBasis (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b' : ι → S := fun i => ⋯.choose
b_eq_b' : ⇑b = ⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b'
b'' : ι → L := ⇑(algebraMap S L) ∘ b'
b''_li : LinearIndependent K b''
⊢ finrank (R ⧸ p) (S ⧸ map (algebraMap R S) p) = finrank K L

Tactic:
have b''_sp : Submodule.span K (Set.range b'') = ⊤ := ?_

Result:
case refine_2.refine_2
R : Type u
inst✝¹⁴ : CommRing R
S : Type v
inst✝¹³ : CommRing S
p : Ideal R
inst✝¹² : Algebra R S
K : Type u_1
inst✝¹¹ : Field K
inst✝¹⁰ : Algebra R K
L : Type u_2
inst✝⁹ : Field L
inst✝⁸ : Algebra S L
inst✝⁷ : IsFractionRing S L
hRK : IsFractionRing R K
inst✝⁶ : IsDomain S
inst✝⁵ : IsDedekindDomain R
inst✝⁴ : Algebra K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsScalarTower R S L
hp : p.IsMaximal
inst✝ : Module.Finite R S
ι : Type v := Free.ChooseBasisIndex (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b : Basis ι (R ⧸ p) (S ⧸ map (algebraMap R S) p) := Free.chooseBasis (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b' : ι → S := fun i => ⋯.choose
b_eq_b' : ⇑b = ⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b'
b'' : ι → L := ⇑(algebraMap S L) ∘ b'
b''_li : LinearIndependent K b''
b''_sp : Submodule.span K (Set.range b'') = ⊤
⊢ finrank (R ⧸ p) (S ⧸ map (algebraMap R S) p) = finrank K L

case refine_2.refine_1
R : Type u
inst✝¹⁴ : CommRing R
S : Type v
inst✝¹³ : CommRing S
p : Ideal R
inst✝¹² : Algebra R S
K : Type u_1
inst✝¹¹ : Field K
inst✝¹⁰ : Algebra R K
L : Type u_2
inst✝⁹ : Field L
inst✝⁸ : Algebra S L
inst✝⁷ : IsFractionRing S L
hRK : IsFractionRing R K
inst✝⁶ : IsDomain S
inst✝⁵ : IsDedekindDomain R
inst✝⁴ : Algebra K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsScalarTower R S L
hp : p.IsMaximal
inst✝ : Module.Finite R S
ι : Type v := Free.ChooseBasisIndex (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b : Basis ι (R ⧸ p) (S ⧸ map (algebraMap R S) p) := Free.chooseBasis (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b' : ι → S := fun i => ⋯.choose
b_eq_b' : ⇑b = ⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b'
b'' : ι → L := ⇑(algebraMap S L) ∘ b'
b''_li : LinearIndependent K b''
⊢ Submodule.span K (Set.range b'') = ⊤

Proof state:
case refine_2.refine_2
R : Type u
inst✝¹⁴ : CommRing R
S : Type v
inst✝¹³ : CommRing S
p : Ideal R
inst✝¹² : Algebra R S
K : Type u_1
inst✝¹¹ : Field K
inst✝¹⁰ : Algebra R K
L : Type u_2
inst✝⁹ : Field L
inst✝⁸ : Algebra S L
inst✝⁷ : IsFractionRing S L
hRK : IsFractionRing R K
inst✝⁶ : IsDomain S
inst✝⁵ : IsDedekindDomain R
inst✝⁴ : Algebra K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsScalarTower R S L
hp : p.IsMaximal
inst✝ : Module.Finite R S
ι : Type v := Free.ChooseBasisIndex (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b : Basis ι (R ⧸ p) (S ⧸ map (algebraMap R S) p) := Free.chooseBasis (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b' : ι → S := fun i => ⋯.choose
b_eq_b' : ⇑b = ⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b'
b'' : ι → L := ⇑(algebraMap S L) ∘ b'
b''_li : LinearIndependent K b''
b''_sp : Submodule.span K (Set.range b'') = ⊤
⊢ finrank (R ⧸ p) (S ⧸ map (algebraMap R S) p) = finrank K L

Tactic:
let c : Basis ι K L := Basis.mk b''_li b''_sp.ge

Result:
case refine_2.refine_2
R : Type u
inst✝¹⁴ : CommRing R
S : Type v
inst✝¹³ : CommRing S
p : Ideal R
inst✝¹² : Algebra R S
K : Type u_1
inst✝¹¹ : Field K
inst✝¹⁰ : Algebra R K
L : Type u_2
inst✝⁹ : Field L
inst✝⁸ : Algebra S L
inst✝⁷ : IsFractionRing S L
hRK : IsFractionRing R K
inst✝⁶ : IsDomain S
inst✝⁵ : IsDedekindDomain R
inst✝⁴ : Algebra K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsScalarTower R S L
hp : p.IsMaximal
inst✝ : Module.Finite R S
ι : Type v := Free.ChooseBasisIndex (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b : Basis ι (R ⧸ p) (S ⧸ map (algebraMap R S) p) := Free.chooseBasis (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b' : ι → S := fun i => ⋯.choose
b_eq_b' : ⇑b = ⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b'
b'' : ι → L := ⇑(algebraMap S L) ∘ b'
b''_li : LinearIndependent K b''
b''_sp : Submodule.span K (Set.range b'') = ⊤
c : Basis ι K L := Basis.mk b''_li ⋯
⊢ finrank (R ⧸ p) (S ⧸ map (algebraMap R S) p) = finrank K L

Proof state:
case refine_1.convert_2
R : Type u
inst✝¹⁴ : CommRing R
S : Type v
inst✝¹³ : CommRing S
p : Ideal R
inst✝¹² : Algebra R S
K : Type u_1
inst✝¹¹ : Field K
inst✝¹⁰ : Algebra R K
L : Type u_2
inst✝⁹ : Field L
inst✝⁸ : Algebra S L
inst✝⁷ : IsFractionRing S L
hRK : IsFractionRing R K
inst✝⁶ : IsDomain S
inst✝⁵ : IsDedekindDomain R
inst✝⁴ : Algebra K L
inst✝³ : Algebra R L
inst✝² : IsScalarTower R K L
inst✝¹ : IsScalarTower R S L
hp : p.IsMaximal
inst✝ : Module.Finite R S
ι : Type v := Free.ChooseBasisIndex (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b : Basis ι (R ⧸ p) (S ⧸ map (algebraMap R S) p) := Free.chooseBasis (R ⧸ p) (S ⧸ map (algebraMap R S) p)
b' : ι → S := fun i => ⋯.choose
b_eq_b' : ⇑b = ⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b'
b'' : ι → L := ⇑(algebraMap S L) ∘ b'
this : LinearIndependent (R ⧸ p) (⇑(↑R (Submodule.mkQ (map (algebraMap R S) p))) ∘ b')
⊢ Function.Injective ⇑(↑R (Algebra.linearMap S L))

Tactic:
exact IsFractionRing.injective S L

Result:
no goals