Theorem: Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne
File: Mathlib/RingTheory/DedekindDomain/PID.lean

tactic: letI := Classical.decEq (Ideal R)
state_before: R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
⊢ P = span {x}

tactic: have hx0 : x ≠ 0 := by
  rintro rfl
  exact hxP2 (zero_mem _)
state_before: R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
⊢ P = span {x}

tactic: by_cases hP0 : P = ⊥
state_before: R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
⊢ P = span {x}

tactic: have hspan0 : span ({x} : Set R) ≠ ⊥ := mt Ideal.span_singleton_eq_bot.mp hx0
state_before: case neg
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
⊢ P = span {x}

tactic: have span_le := (Ideal.span_singleton_le_iff_mem _).mpr x_mem
state_before: case neg
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
⊢ P = span {x}

tactic: refine'
  associated_iff_eq.mp
    ((associated_iff_normalizedFactors_eq_normalizedFactors hP0 hspan0).mpr
      (le_antisymm ((dvd_iff_normalizedFactors_le_normalizedFactors hP0 hspan0).mp _) _))
state_before: case neg
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
⊢ P = span {x}

tactic: simp only [normalizedFactors_irreducible (Ideal.prime_of_isPrime hP0 hP).irreducible,
  normalize_eq, Multiset.le_iff_count, Multiset.count_singleton]
state_before: case neg.refine'_2
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
⊢ normalizedFactors (span {x}) ≤ normalizedFactors P

tactic: intro Q
state_before: case neg.refine'_2
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
⊢ ∀ (a : Ideal R), Multiset.count a (normalizedFactors (span {x})) ≤ if a = P then 1 else 0

tactic: split_ifs with hQ
state_before: case neg.refine'_2
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ if Q = P then 1 else 0

tactic: by_cases hQp : IsPrime Q
state_before: case neg.refine'_2.inr
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
hQ : ¬Q = P
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ 0

tactic: rintro rfl
state_before: R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
⊢ x ≠ 0

tactic: exact hxP2 (zero_mem _)
state_before: R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
x_mem : 0 ∈ P
hxP2 : ¬0 ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬0 ∈ Q
⊢ False

tactic: subst hP0
state_before: case pos
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : P = ⊥
⊢ P = span {x}

tactic: rwa [eq_comm, span_singleton_eq_bot, ← mem_bot]
state_before: case pos
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP : IsPrime ⊥
x_mem : x ∈ ⊥
hxP2 : ¬x ∈ ⊥ ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ ⊥ → ¬x ∈ Q
⊢ ⊥ = span {x}

tactic: rwa [Ideal.dvd_iff_le, Ideal.span_singleton_le_iff_mem]
state_before: case neg.refine'_1
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
⊢ P ∣ span {x}

tactic: subst hQ
state_before: case neg.refine'_2.inl
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
hQ : Q = P
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ 1

tactic: refine' (Ideal.count_normalizedFactors_eq _ _).le <;>
    simp only [Ideal.span_singleton_le_iff_mem, pow_one] <;>
  assumption
state_before: case neg.refine'_2.inl
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hspan0 : span {x} ≠ ⊥
Q : Ideal R
hP : IsPrime Q
x_mem : x ∈ Q
hxP2 : ¬x ∈ Q ^ 2
hxQ : ∀ (Q_1 : Ideal R), IsPrime Q_1 → Q_1 ≠ Q → ¬x ∈ Q_1
hP0 : ¬Q = ⊥
span_le : span {x} ≤ Q
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ 1

tactic: skip
state_before: case pos
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
hQ : ¬Q = P
hQp : IsPrime Q
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ 0

tactic: refine' (Ideal.count_normalizedFactors_eq _ _).le <;>
  simp only [Ideal.span_singleton_le_iff_mem, zero_add, pow_one, pow_zero, one_eq_top,
             Submodule.mem_top]
state_before: case pos
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
hQ : ¬Q = P
hQp : IsPrime Q
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ 0

tactic: exact hxQ _ hQp hQ
state_before: case pos.refine'_2
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
hQ : ¬Q = P
hQp : IsPrime Q
⊢ ¬x ∈ Q

tactic: exact
  (Multiset.count_eq_zero.mpr fun hQi =>
      hQp
        (isPrime_of_prime
          (irreducible_iff_prime.mp (irreducible_of_normalized_factor _ hQi)))).le
state_before: case neg
R : Type u_1
inst✝² : CommRing R
P : Ideal R
hP : IsPrime P
inst✝¹ : IsDomain R
inst✝ : IsDedekindDomain R
x : R
x_mem : x ∈ P
hxP2 : ¬x ∈ P ^ 2
hxQ : ∀ (Q : Ideal R), IsPrime Q → Q ≠ P → ¬x ∈ Q
this : DecidableEq (Ideal R) := Classical.decEq (Ideal R)
hx0 : x ≠ 0
hP0 : ¬P = ⊥
hspan0 : span {x} ≠ ⊥
span_le : span {x} ≤ P
Q : Ideal R
hQ : ¬Q = P
hQp : ¬IsPrime Q
⊢ Multiset.count Q (normalizedFactors (span {x})) ≤ 0