-- Module: Mathlib.RingTheory.Invariant.Basic
Goal:
A : Type u_1
B : Type u_2
inst : CommRing A
inst_1 : CommRing B
inst_2 : Algebra A B
G : Type u_3
inst_3 : Group G
inst_4 : Finite G
inst_5 : MulSemiringAction G B
inst_6 : SMulCommClass G A B
P : Ideal A
Q : Ideal B
inst_7 : Q.IsPrime
inst_8 : Q.LiesOver P
K : Type u_4
L : Type u_5
inst_9 : Field K
inst_10 : Field L
inst_11 : Algebra.{u_1, u_4} (A ⧸ P) K
inst_12 : Algebra.{u_2, u_5} (B ⧸ Q) L
inst_13 : Algebra.{u_1, u_5} (A ⧸ P) L
inst_14 : IsScalarTower.{u_1, u_2, u_5} (A ⧸ P) (B ⧸ Q) L
inst_15 : Algebra K L
inst_16 : IsScalarTower.{u_1, u_4, u_5} (A ⧸ P) K L
inst_17 : Algebra.IsInvariant A B G
inst_18 : Module.IsTorsionFree.{u_2, u_5} (B ⧸ Q) L
f : Gal(L/K)
val : Fintype G
b₀ : B
hx :
  ∀ (g : ↥(MulAction.stabilizer G Q)),
    Eq (α := B ⧸ Q)
      (((((Ideal.Quotient.stabilizerHom Q P G :
                    MonoidHom.{u_3, u_2} (↥(MulAction.stabilizer G Q))
                      (AlgEquiv.{u_1, u_2, u_2} (A ⧸ P) (B ⧸ Q) (B ⧸ Q))) :
                  (a : ↥(MulAction.stabilizer G Q)) → (B ⧸ Q) ≃ₐ[A ⧸ P] B ⧸ Q)
                g :
              AlgEquiv.{u_1, u_2, u_2} (A ⧸ P) (B ⧸ Q) (B ⧸ Q)) :
            (a : B ⧸ Q) → B ⧸ Q)
          ((Ideal.Quotient.mk Q : (a : B) → B ⧸ Q) b₀) :
        B ⧸ Q)
      ((Ideal.Quotient.mk Q : (a : B) → B ⧸ Q) b₀ : B ⧸ Q)
a b : B
ha1 : ∀ (g : G), g • a = a
ha2 : a ∉ Q
hb :
  ∀ (g : G),
    Eq (α := B ⧸ Q) ((algebraMap B (B ⧸ Q) : (a : B) → B ⧸ Q) (g • b) : B ⧸ Q)
      ((algebraMap B (B ⧸ Q) : (a : B) → B ⧸ Q) (if g • Q = Q then a * b₀ else 0) : B ⧸ Q)
M : A[X]
key₀ :
  ∀ (g : G),
    map (algebraMap B (B ⧸ Q)) (HSub.hSub (α := B[X]) (β := B[X]) X ((C : (a : B) → B[X]) (g • b) : B[X])) =
      if g • Q = Q then
        HSub.hSub (α := (B ⧸ Q)[X]) (β := (B ⧸ Q)[X]) X
          ((C : (a : B ⧸ Q) → (B ⧸ Q)[X]) ((algebraMap B (B ⧸ Q) : (a : B) → B ⧸ Q) (a * b₀)) : (B ⧸ Q)[X])
      else X
key :
  Eq (α := L[X])
    (map.{u_2, u_5} (R := B ⧸ Q) (algebraMap (B ⧸ Q) L)
      (map (R := A ⧸ P) (algebraMap (A ⧸ P) (B ⧸ Q)) (map (algebraMap A (A ⧸ P)) M)))
    (map (algebraMap (B ⧸ Q) L)
      (HSub.hSub (α := (B ⧸ Q)[X]) (β := (B ⧸ Q)[X]) X
            ((C : (a : B ⧸ Q) → (B ⧸ Q)[X]) ((algebraMap B (B ⧸ Q) : (a : B) → B ⧸ Q) (a * b₀)) : (B ⧸ Q)[X]) ^
          Finset.card.{u_3} (α := G) {x : G | x • Q = Q} *
        HPow.hPow (α := (B ⧸ Q)[X]) X (Finset.card.{u_3} (α := G) {x : G | ¬x • Q = Q})))
⊢ map (algebraMap K L) (map (R := A ⧸ P) (algebraMap (A ⧸ P) K) (map (algebraMap A (A ⧸ P)) M)) =
    HSub.hSub (α := L[X]) (β := L[X]) X
          ((C : (a : L) → L[X])
              ((algebraMap (B ⧸ Q) L : (a : B ⧸ Q) → L) ((algebraMap B (B ⧸ Q) : (a : B) → B ⧸ Q) (a * b₀) : B ⧸ Q)) :
            L[X]) ^
        Finset.card.{u_3} (α := G) {x : G | x • Q = Q} *
      HPow.hPow (α := L[X]) X (Finset.card.{u_3} (α := G) {x : G | ¬x • Q = Q})

Tactic:
rw [map_map, ← algebraMap_eq, algebraMap_eq (A ⧸ P) K L,
      ← map_map, Polynomial.map_mul, Polynomial.map_pow, Polynomial.map_pow, Polynomial.map_sub,
      map_X, map_C] at key

Premises used: Polynomial.map_mul, Polynomial.map_pow, Polynomial.map_X, HasQuotient.Quotient, IsScalarTower.algebraMap_eq, Polynomial.map_sub, Polynomial.map_C, Polynomial.map_map