-- Mathlib/RingTheory/DedekindDomain/Ideal.lean
theorem exists_multiset_prod_cons_le_and_prod_not_le [IsDedekindDomain A] (hNF : ¬IsField A)
    {I M : Ideal A} (hI0 : I ≠ ⊥) (hIM : I ≤ M) [hM : M.IsMaximal] :
    ∃ Z : Multiset (PrimeSpectrum A),
      (M ::ₘ Z.map PrimeSpectrum.asIdeal).prod ≤ I ∧
        ¬Multiset.prod (Z.map PrimeSpectrum.asIdeal) ≤ I

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
Z : Multiset (PrimeSpectrum A)
h_eraseZ :
  ∀ x ∈ {Z | (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥}, ¬x < Z
hZI : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I
hprodZ : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥
P : PrimeSpectrum A
hPZ : P ∈ Z
hPZ' : P.asIdeal ∈ Multiset.map PrimeSpectrum.asIdeal Z
hPM : P.asIdeal ≤ M
this : Multiset.map PrimeSpectrum.asIdeal (Z.erase P) = (Multiset.map PrimeSpectrum.asIdeal Z).erase P.asIdeal
hP0 : P.asIdeal ≠ ⊥
hZP0 : (Multiset.map PrimeSpectrum.asIdeal (Z.erase P)).prod ≠ ⊥
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Tactic:
have hPM' := (P.isPrime.isMaximal hP0).eq_of_le hM.ne_top hPM

Result:
case intro.intro.intro.intro.intro.intro.intro.intro.intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
Z : Multiset (PrimeSpectrum A)
h_eraseZ :
  ∀ x ∈ {Z | (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥}, ¬x < Z
hZI : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I
hprodZ : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥
P : PrimeSpectrum A
hPZ : P ∈ Z
hPZ' : P.asIdeal ∈ Multiset.map PrimeSpectrum.asIdeal Z
hPM : P.asIdeal ≤ M
this : Multiset.map PrimeSpectrum.asIdeal (Z.erase P) = (Multiset.map PrimeSpectrum.asIdeal Z).erase P.asIdeal
hP0 : P.asIdeal ≠ ⊥
hZP0 : (Multiset.map PrimeSpectrum.asIdeal (Z.erase P)).prod ≠ ⊥
hPM' : P.asIdeal = M
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Proof state:
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Tactic:
obtain ⟨Z₀, hZ₀⟩ := PrimeSpectrum.exists_primeSpectrum_prod_le_and_ne_bot_of_domain hNF hI0

Result:
case intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.refine_2
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I : Ideal A
hI0 : I ≠ ⊥
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
Z : Multiset (PrimeSpectrum A)
h_eraseZ :
  ∀ x ∈ {Z | (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥}, ¬x < Z
hZI : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I
hprodZ : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥
P : PrimeSpectrum A
hPZ : P ∈ Z
hPZ' : P.asIdeal ∈ Multiset.map PrimeSpectrum.asIdeal Z
this : Multiset.map PrimeSpectrum.asIdeal (Z.erase P) = (Multiset.map PrimeSpectrum.asIdeal Z).erase P.asIdeal
hP0 : P.asIdeal ≠ ⊥
hZP0 : (Multiset.map PrimeSpectrum.asIdeal (Z.erase P)).prod ≠ ⊥
hIM : I ≤ P.asIdeal
hM : P.asIdeal.IsMaximal
hPM : P.asIdeal ≤ P.asIdeal
h : (Multiset.map PrimeSpectrum.asIdeal (Z.erase P)).prod ≤ I
⊢ (Multiset.map PrimeSpectrum.asIdeal (Z.erase P)).prod ≠ ⊥

Tactic:
exact hZP0

Result:
no goals

Proof state:
case intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Tactic:
obtain ⟨Z, ⟨hZI, hprodZ⟩, h_eraseZ⟩ :=
  wellFounded_lt.has_min
    {Z | (Z.map PrimeSpectrum.asIdeal).prod ≤ I ∧ (Z.map PrimeSpectrum.asIdeal).prod ≠ ⊥}
    ⟨Z₀, hZ₀.1, hZ₀.2⟩

Result:
case intro.intro.intro.intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
Z : Multiset (PrimeSpectrum A)
h_eraseZ :
  ∀ x ∈ {Z | (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥}, ¬x < Z
hZI : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I
hprodZ : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Proof state:
case intro.intro.intro.intro.intro.intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
Z : Multiset (PrimeSpectrum A)
h_eraseZ :
  ∀ x ∈ {Z | (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥}, ¬x < Z
hZI : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I
hprodZ : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥
w✝ : Ideal A
hPZ' : w✝ ∈ Multiset.map PrimeSpectrum.asIdeal Z
hPM : w✝ ≤ M
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I

Tactic:
obtain ⟨P, hPZ, rfl⟩ := Multiset.mem_map.mp hPZ'

Result:
case intro.intro.intro.intro.intro.intro.intro.intro
A : Type u_2
inst✝¹ : CommRing A
inst✝ : IsDedekindDomain A
hNF : ¬IsField A
I M : Ideal A
hI0 : I ≠ ⊥
hIM : I ≤ M
hM : M.IsMaximal
Z₀ : Multiset (PrimeSpectrum A)
hZ₀ : (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z₀).prod ≠ ⊥
Z : Multiset (PrimeSpectrum A)
h_eraseZ :
  ∀ x ∈ {Z | (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥}, ¬x < Z
hZI : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I
hprodZ : (Multiset.map PrimeSpectrum.asIdeal Z).prod ≠ ⊥
P : PrimeSpectrum A
hPZ : P ∈ Z
hPZ' : P.asIdeal ∈ Multiset.map PrimeSpectrum.asIdeal Z
hPM : P.asIdeal ≤ M
⊢ ∃ Z, (M ::ₘ Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I ∧ ¬(Multiset.map PrimeSpectrum.asIdeal Z).prod ≤ I