-- Module: Mathlib.RingTheory.Spectrum.Prime.ChevalleyComplexity
Goal:
R : Type u_2
inst : CommRing R
m n : ℕ
f : MvPolynomial (Fin n) R →ₐ[R] MvPolynomial (Fin m) R
k : ℕ
d : Multiset (Fin m)
S : ConstructibleSetData (MvPolynomial (Fin m) R)
hSn : ∀ C ∈ S, C.n ≤ k
hS : ∀ C ∈ S, ∀ (j : Fin C.n), (C.g j).degrees ≤ d
hf :
  ∀ (i : Fin n),
    degrees.{u_2, 0} (R := R) ((f : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) R) (MvPolynomial.X i)) ≤ d
g : MvPolynomial (Fin m) (MvPolynomial (Fin n) R) →+* MvPolynomial (Fin m) R := eval₂Hom f.toRingHom MvPolynomial.X
hg :
  Eq (α := MvPolynomial (Fin n) R →+* MvPolynomial (Fin m) R)
    (g.comp (algebraMap (MvPolynomial (Fin n) R) (MvPolynomial (Fin m) (MvPolynomial (Fin n) R))))
    (↑f : MvPolynomial (Fin n) R →+* MvPolynomial (Fin m) R)
σ : MvPolynomial (Fin m) R →+* MvPolynomial (Fin m) (MvPolynomial (Fin n) R) :=
  MvPolynomial.map (algebraMap R (MvPolynomial (Fin n) R))
hσ : g.comp σ = RingHom.id (MvPolynomial (Fin m) R)
hσ' :
  ∀ (x : MvPolynomial (Fin m) R),
    (g : (a : MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) → MvPolynomial (Fin m) R)
        ((σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) x) =
      x
hg' :
  Surjective (α := MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) (β := MvPolynomial (Fin m) R)
    (⇑g : (a : MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) → MvPolynomial (Fin m) R)
S' : ConstructibleSetData (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) :=
  Finset.image
    (fun (x : BasicConstructibleSetData (MvPolynomial (Fin m) R)) ↦
      match (motive :=
        BasicConstructibleSetData (MvPolynomial (Fin m) R) →
          BasicConstructibleSetData (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
        x with
      | { f := fk, n := k, g := gk } =>
        { f := (σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) fk, n := k + n,
          g := fun (s : Fin (k + n)) ↦
            Sum.elim ((⇑σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) ∘ gk)
              (fun (i : Fin n) ↦
                HSub.hSub (α := MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) (β :=
                  MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                  ((MvPolynomial.C : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                      (MvPolynomial.X i) :
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                  ((σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                      ((f : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) R) (MvPolynomial.X i)) :
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
              ((Equiv.symm finSumFinEquiv : (a : Fin (k + n)) → Fin k ⊕ Fin n) s) })
    S
s₀ : Set (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) :=
  Set.range fun (i : Fin n) ↦
    HSub.hSub (α := MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) (β := MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
      ((MvPolynomial.C : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
          (MvPolynomial.X i) :
        MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
      ((σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
          ((f : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) R) (MvPolynomial.X i)) :
        MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
hs : zeroLocus s₀ = Set.range (comap g)
hg'' : ∀ (t : Set (PrimeSpectrum (MvPolynomial (Fin m) R))), comap g '' t = comap σ ⁻¹' t ∩ zeroLocus s₀
hS' : comap g '' S.toSet = S'.toSet
x : BasicConstructibleSetData (MvPolynomial (Fin m) R)
hx : x ∈ S
j :
  Fin
    (BasicConstructibleSetData.n.{u_2} (R := MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
      (match (motive :=
        BasicConstructibleSetData (MvPolynomial (Fin m) R) →
          BasicConstructibleSetData (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
        x with
      | { f := fk, n := k, g := gk } =>
        { f := (σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) fk, n := k + n,
          g := fun (s : Fin (k + n)) ↦
            Sum.elim ((⇑σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) ∘ gk)
              (fun (i : Fin n) ↦
                HSub.hSub (α := MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) (β :=
                  MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                  ((MvPolynomial.C : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                      (MvPolynomial.X i) :
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                  ((σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                      ((f : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) R) (MvPolynomial.X i)) :
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
              ((Equiv.symm finSumFinEquiv : (a : Fin (k + n)) → Fin k ⊕ Fin n) s) }))
obtain :
  ∀ (j : Fin x.n ⊕ Fin n),
    Membership.mem (γ := Submodule ℤ (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
      (coeffsIn (Fin m) (Submodule.restrictScalars ℤ (degreesLE R (Fin n) (Finset.val Finset.univ))) ⊓
        Submodule.restrictScalars ℤ (degreesLE (MvPolynomial (Fin n) R) (Fin m) d))
      (BasicConstructibleSetData.g
        (match (motive :=
          BasicConstructibleSetData (MvPolynomial (Fin m) R) →
            BasicConstructibleSetData (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
          x with
        | { f := fk, n := k, g := gk } =>
          { f := (σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) fk, n := k + n,
            g := fun (s : Fin (k + n)) ↦
              Sum.elim ((⇑σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) ∘ gk)
                (fun (i : Fin n) ↦
                  HSub.hSub (α := MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) (β :=
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                    ((MvPolynomial.C : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                        (MvPolynomial.X i) :
                      MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                    ((σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                        ((f : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) R) (MvPolynomial.X i)) :
                      MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
                ((Equiv.symm finSumFinEquiv : (a : Fin (k + n)) → Fin k ⊕ Fin n) s) })
        ((finSumFinEquiv : (a : Fin x.n ⊕ Fin n) → Fin (x.n + n)) j))
⊢ Membership.mem (γ := Submodule ℤ (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
    (coeffsIn (Fin m) (Submodule.restrictScalars ℤ (degreesLE R (Fin n) (Finset.val Finset.univ))) ⊓
      Submodule.restrictScalars ℤ (degreesLE (MvPolynomial (Fin n) R) (Fin m) d))
    (BasicConstructibleSetData.g
      (match (motive :=
        BasicConstructibleSetData (MvPolynomial (Fin m) R) →
          BasicConstructibleSetData (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
        x with
      | { f := fk, n := k, g := gk } =>
        { f := (σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) fk, n := k + n,
          g := fun (s : Fin (k + n)) ↦
            Sum.elim ((⇑σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) ∘ gk)
              (fun (i : Fin n) ↦
                HSub.hSub (α := MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) (β :=
                  MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                  ((MvPolynomial.C : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                      (MvPolynomial.X i) :
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                  ((σ : (a : MvPolynomial (Fin m) R) → MvPolynomial (Fin m) (MvPolynomial (Fin n) R))
                      ((f : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin m) R) (MvPolynomial.X i)) :
                    MvPolynomial (Fin m) (MvPolynomial (Fin n) R)))
              ((Equiv.symm finSumFinEquiv : (a : Fin (k + n)) → Fin k ⊕ Fin n) s) :
          BasicConstructibleSetData (MvPolynomial (Fin m) (MvPolynomial (Fin n) R)) })
      j)

Tactic:
obtain ⟨j, rfl⟩ := finSumFinEquiv.surjective j

Premises used: finSumFinEquiv, Equiv.surjective, rfl