case inl
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = 0 ∨ card x = 0 + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ 0) ∧
        card (filter (fun i => card i = 0 + 1) Q.parts) = b

case inr
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
m_pos : m > 0
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
obtain rfl | m_pos := m.eq_zero_or_pos
case inr.H
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case inr
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
m_pos : m > 0
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
induction' s using Finset.strongInduction with s ih generalizing a b
case pos
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : a = 0 ∧ b = 0
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b

case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : ¬(a = 0 ∧ b = 0)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case inr.H
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
by_cases hab : a = 0 ∧ b = 0
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : ¬(a = 0 ∧ b = 0)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
simp_rw [not_and_or, ← Ne.def, ← pos_iff_ne_zero] at hab
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
set n := if 0 < a then m else m + 1 with hn
case pos
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b

case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ¬∀ (u : Finset α), u ∈ P.parts → card u < m + 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
by_cases h : ∀ u ∈ P.parts, card u < m + 1
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∃ u, u ∈ P.parts ∧ m + 1 ≤ card u
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ¬∀ (u : Finset α), u ∈ P.parts → card u < m + 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
push_neg  at h
case neg.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∃ u, u ∈ P.parts ∧ m + 1 ≤ card u
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
obtain ⟨u, hu₁, hu₂⟩ := h
case neg.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
obtain ⟨t, htu, htn⟩ := exists_smaller_set _ _ (hn₁.trans hu₂)
case neg.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
have ht : t.Nonempty := by rwa [← card_pos, htn]
case neg.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
have hcard : ite (0 < a) (a - 1) a * m + ite (0 < a) b (b - 1) * (m + 1) = (s \ t).card := by
  rw [card_sdiff (htu.trans <| P.le hu₁), htn, hn₃]
case neg.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case neg.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
obtain ⟨R, hR₁, hR₂, hR₃⟩ :=
  @ih (s \ t) (sdiff_ssubset (htu.trans <| P.le hu₁) ht) (if 0 < a then a - 1 else a)
    (if 0 < a then b else b - 1) (P.avoid t) hcard
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts → card x = m ∨ card x = m + 1

case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ P.parts →
      card
          (x \
            Finset.biUnion
              (filter (fun y => y ⊆ x) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) id) ≤
        m

case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (filter (fun i => card i = m + 1) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) = b
case neg.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
refine' ⟨R.extend ht.ne_empty sdiff_disjoint (sdiff_sup_cancel <| htu.trans <| P.le hu₁), _, _, _⟩
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card
      (if ¬0 < a then insert t (filter (fun i => card i = m + 1) R.parts)
      else filter (fun i => card i = m + 1) R.parts) =
    b
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (filter (fun i => card i = m + 1) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) = b
simp only [extend_parts, filter_insert, htn, hn, m.succ_ne_self.symm.ite_eq_right_iff]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : 0 < a
⊢ card (filter (fun i => card i = m + 1) R.parts) = b

case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : ¬0 < a
⊢ card (insert t (filter (fun i => card i = m + 1) R.parts)) = b
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card
      (if ¬0 < a then insert t (filter (fun i => card i = m + 1) R.parts)
      else filter (fun i => card i = m + 1) R.parts) =
    b
split_ifs with h
case inl
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) ⊥.parts) id) ≤ 0
case inl
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = 0 ∨ card x = 0 + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ 0) ∧
        card (filter (fun i => card i = 0 + 1) Q.parts) = b
refine' ⟨⊥, by simp, _, by simpa using hs.symm⟩
case inl
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∀ (x : Finset α), x ∈ P.parts → ∀ ⦃x_1 : α⦄, x_1 ∈ x → ∃ a, a ∈ ⊥.parts ∧ (∀ ⦃x_2 : α⦄, x_2 ∈ a → x_2 ∈ x) ∧ x_1 ∈ a
case inl
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) ⊥.parts) id) ≤ 0
simp only [le_zero_iff, card_eq_zero, mem_biUnion, exists_prop, mem_filter, id.def, and_assoc,
  sdiff_eq_empty_iff_subset, subset_iff]
no goals
case inl
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∀ (x : Finset α), x ∈ P.parts → ∀ ⦃x_1 : α⦄, x_1 ∈ x → ∃ a, a ∈ ⊥.parts ∧ (∀ ⦃x_2 : α⦄, x_2 ∈ a → x_2 ∈ x) ∧ x_1 ∈ a
exact fun x hx a ha =>
  ⟨{a}, mem_map_of_mem _ (P.le hx ha), singleton_subset_iff.2 ha, mem_singleton_self _⟩
no goals
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ ∀ (x : Finset α), x ∈ ⊥.parts → card x = 0 ∨ card x = 0 + 1
simp
no goals
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
n a b : ℕ
P : Finpartition s
hs : a * 0 + b * (0 + 1) = card s
⊢ card (filter (fun i => card i = 0 + 1) ⊥.parts) = b
simpa using hs.symm
case pos
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hab : a = 0 ∧ b = 0
hs : s = ∅
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : a = 0 ∧ b = 0
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
simp only [hab.1, hab.2, add_zero, zero_mul, eq_comm, card_eq_zero, Finset.bot_eq_empty] at hs
case pos
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hab : a = 0 ∧ b = 0
hs : s = ∅
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
subst hs
case pos
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
this : P = Finpartition.empty (Finset α)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
have : P = Finpartition.empty _ := Unique.eq_default (α := Finpartition ⊥) P
no goals
case pos
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
this : P = Finpartition.empty (Finset α)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
exact ⟨Finpartition.empty _, by simp, by simp [this], by simp [hab.2]⟩
no goals
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
this : P = Finpartition.empty (Finset α)
⊢ ∀ (x : Finset α), x ∈ (Finpartition.empty (Finset α)).parts → card x = m ∨ card x = m + 1
simp
no goals
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
this : P = Finpartition.empty (Finset α)
⊢ ∀ (x : Finset α),
    x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) (Finpartition.empty (Finset α)).parts) id) ≤ m
simp [this]
no goals
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
m n a✝ b✝ : ℕ
P✝ : Finpartition s
hs : a✝ * m + b✝ * (m + 1) = card s
m_pos : m > 0
a b : ℕ
hab : a = 0 ∧ b = 0
ih :
  ∀ (t : Finset α),
    t ⊂ ∅ →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
P : Finpartition ∅
this : P = Finpartition.empty (Finset α)
⊢ card (filter (fun i => card i = m + 1) (Finpartition.empty (Finset α)).parts) = b
simp [hab.2]
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
⊢ (0 < if 0 < a then m else m + 1) ∧
    (if 0 < a then m else m + 1) ≤ m + 1 ∧
      (if 0 < a then m else m + 1) ≤ a * m + b * (m + 1) ∧
        (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) =
          a * m + b * (m + 1) - if 0 < a then m else m + 1
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
⊢ 0 < n ∧
    n ≤ m + 1 ∧
      n ≤ a * m + b * (m + 1) ∧ (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
rw [hn, ← hs]
case inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : 0 < a
⊢ 0 < m ∧ m ≤ m + 1 ∧ m ≤ a * m + b * (m + 1) ∧ a * m - m + b * (m + 1) = a * m + b * (m + 1) - m

case inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : ¬0 < a
⊢ 0 < m + 1 ∧
    m + 1 ≤ m + 1 ∧ m + 1 ≤ a * m + b * (m + 1) ∧ a * m + (b * (m + 1) - (m + 1)) = a * m + b * (m + 1) - (m + 1)
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
⊢ (0 < if 0 < a then m else m + 1) ∧
    (if 0 < a then m else m + 1) ≤ m + 1 ∧
      (if 0 < a then m else m + 1) ≤ a * m + b * (m + 1) ∧
        (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) =
          a * m + b * (m + 1) - if 0 < a then m else m + 1
split_ifs with h <;> rw [tsub_mul, one_mul]
case inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : 0 < a
⊢ a * m - m + b * (m + 1) = a * m + b * (m + 1) - m
case inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : 0 < a
⊢ 0 < m ∧ m ≤ m + 1 ∧ m ≤ a * m + b * (m + 1) ∧ a * m - m + b * (m + 1) = a * m + b * (m + 1) - m
refine' ⟨m_pos, le_succ _, le_add_right (le_mul_of_pos_left ‹0 < a›), _⟩
no goals
case inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : 0 < a
⊢ a * m - m + b * (m + 1) = a * m + b * (m + 1) - m
rw [tsub_add_eq_add_tsub (le_mul_of_pos_left h)]
case inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : ¬0 < a
⊢ a * m + (b * (m + 1) - (m + 1)) = a * m + b * (m + 1) - (m + 1)
case inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : ¬0 < a
⊢ 0 < m + 1 ∧
    m + 1 ≤ m + 1 ∧ m + 1 ≤ a * m + b * (m + 1) ∧ a * m + (b * (m + 1) - (m + 1)) = a * m + b * (m + 1) - (m + 1)
refine' ⟨succ_pos', le_rfl, le_add_left (le_mul_of_pos_left <| hab.resolve_left ‹¬0 < a›), _⟩
no goals
case inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
h : ¬0 < a
⊢ a * m + (b * (m + 1) - (m + 1)) = a * m + b * (m + 1) - (m + 1)
rw [← add_tsub_assoc_of_le (le_mul_of_pos_left <| hab.resolve_left ‹¬0 < a›)]
case pos.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
obtain ⟨t, hts, htn⟩ := exists_smaller_set s n (hn₂.trans_eq hs)
case pos.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
have ht : t.Nonempty := by rwa [← card_pos, htn]
case pos.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
have hcard : ite (0 < a) (a - 1) a * m + ite (0 < a) b (b - 1) * (m + 1) = (s \ t).card := by
  rw [card_sdiff ‹t ⊆ s›, htn, hn₃]
case pos.intro.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
case pos.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
obtain ⟨R, hR₁, _, hR₃⟩ :=
  @ih (s \ t) (sdiff_ssubset hts ‹t.Nonempty›) (if 0 < a then a - 1 else a)
    (if 0 < a then b else b - 1) (P.avoid t) hcard
case pos.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts → card x = m ∨ card x = m + 1

case pos.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ P.parts →
      card
          (x \
            Finset.biUnion
              (filter (fun y => y ⊆ x) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) id) ≤
        m

case pos.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (filter (fun i => card i = m + 1) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) = b
case pos.intro.intro.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∃ Q,
    (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
      (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
        card (filter (fun i => card i = m + 1) Q.parts) = b
refine' ⟨R.extend ht.ne_empty sdiff_disjoint (sdiff_sup_cancel hts), _, _, _⟩
case pos.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card
      (if ¬0 < a then insert t (filter (fun i => card i = m + 1) R.parts)
      else filter (fun i => card i = m + 1) R.parts) =
    b
case pos.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (filter (fun i => card i = m + 1) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) = b
simp_rw [extend_parts, filter_insert, htn, m.succ_ne_self.symm.ite_eq_right_iff]
case pos.intro.intro.intro.intro.intro.refine'_3.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : 0 < a
⊢ card (filter (fun i => card i = m + 1) R.parts) = b

case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
⊢ card (insert t (filter (fun i => card i = m + 1) R.parts)) = b
case pos.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card
      (if ¬0 < a then insert t (filter (fun i => card i = m + 1) R.parts)
      else filter (fun i => card i = m + 1) R.parts) =
    b
split_ifs with ha
case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
⊢ 1 ≤ b

case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
⊢ ¬t ∈ filter (fun i => card i = m + 1) R.parts
case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
⊢ card (insert t (filter (fun i => card i = m + 1) R.parts)) = b
rw [card_insert_of_not_mem, hR₃, if_neg ha, tsub_add_cancel_of_le]
no goals
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
⊢ Finset.Nonempty t
rwa [← card_pos, htn]
no goals
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
⊢ (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
rw [card_sdiff ‹t ⊆ s›, htn, hn₃]
case pos.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ (if 0 < a then m else m + 1) = m ∨ (if 0 < a then m else m + 1) = m + 1
case pos.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts → card x = m ∨ card x = m + 1
simp only [extend_parts, mem_insert, forall_eq_or_imp, and_iff_left hR₁, htn, hn]
no goals
case pos.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ (if 0 < a then m else m + 1) = m ∨ (if 0 < a then m else m + 1) = m + 1
exact ite_eq_or_eq _ _ _
no goals
case pos.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ P.parts →
      card
          (x \
            Finset.biUnion
              (filter (fun y => y ⊆ x) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) id) ≤
        m
exact fun x hx => (card_le_of_subset <| sdiff_subset _ _).trans (lt_succ_iff.1 <| h _ hx)
no goals
case pos.intro.intro.intro.intro.intro.refine'_3.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : 0 < a
⊢ card (filter (fun i => card i = m + 1) R.parts) = b
rw [hR₃, if_pos ha]
no goals
case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
⊢ 1 ≤ b
exact hab.resolve_left ha
case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
H : t ∈ filter (fun i => card i = m + 1) R.parts
⊢ False
case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
⊢ ¬t ∈ filter (fun i => card i = m + 1) R.parts
intro H
no goals
case pos.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
h : ∀ (u : Finset α), u ∈ P.parts → card u < m + 1
t : Finset α
hts : t ⊆ s
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
left✝ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
ha : ¬0 < a
H : t ∈ filter (fun i => card i = m + 1) R.parts
⊢ False
exact ht.ne_empty (le_sdiff_iff.1 <| R.le <| filter_subset _ _ H)
no goals
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
⊢ Finset.Nonempty t
rwa [← card_pos, htn]
no goals
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
⊢ (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
rw [card_sdiff (htu.trans <| P.le hu₁), htn, hn₃]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ (if 0 < a then m else m + 1) = m ∨ (if 0 < a then m else m + 1) = m + 1
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts → card x = m ∨ card x = m + 1
simp only [mem_insert, forall_eq_or_imp, extend_parts, and_iff_left hR₁, htn, hn]
no goals
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ (if 0 < a then m else m + 1) = m ∨ (if 0 < a then m else m + 1) = m + 1
exact ite_eq_or_eq _ _ _
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ insert u (erase P.parts u) →
      card
          (x \
            Finset.biUnion
              (filter (fun y => y ⊆ x) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) id) ≤
        m
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ P.parts →
      card
          (x \
            Finset.biUnion
              (filter (fun y => y ⊆ x) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) id) ≤
        m
conv in _ ∈ _ => rw [← insert_erase hu₁]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ Finset.biUnion (filter (fun y => y ⊆ u) (insert t R.parts)) id) ≤ m ∧
    ∀ (a : Finset α),
      a ∈ erase P.parts u → card (a \ Finset.biUnion (filter (fun y => y ⊆ a) (insert t R.parts)) id) ≤ m
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ ∀ (x : Finset α),
    x ∈ insert u (erase P.parts u) →
      card
          (x \
            Finset.biUnion
              (filter (fun y => y ⊆ x) (extend R (_ : t ≠ ∅) (_ : Disjoint (s \ t) t) (_ : s \ t ⊔ t = s)).parts) id) ≤
        m
simp only [and_imp, mem_insert, forall_eq_or_imp, Ne.def, extend_parts]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ Finset.biUnion (filter (fun y => y ⊆ u) (insert t R.parts)) id) ≤ m

case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ x \ Finset.biUnion (filter (fun y => y ⊆ x) (insert t R.parts)) id ⊆
    x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id

case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ x ∈ (avoid P t).parts
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ Finset.biUnion (filter (fun y => y ⊆ u) (insert t R.parts)) id) ≤ m ∧
    ∀ (a : Finset α),
      a ∈ erase P.parts u → card (a \ Finset.biUnion (filter (fun y => y ⊆ a) (insert t R.parts)) id) ≤ m
refine' ⟨_, fun x hx => (card_le_of_subset _).trans <| hR₂ x _⟩
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ x ≠ ∅ ∧ ∃ a, a ∈ P.parts ∧ a \ t = x
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ x ∈ (avoid P t).parts
simp only [avoid, ofErase, mem_erase, mem_image, bot_eq_empty]
no goals
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_3
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ x ≠ ∅ ∧ ∃ a, a ∈ P.parts ∧ a \ t = x
exact
  ⟨(nonempty_of_mem_parts _ <| mem_of_mem_erase hx).ne_empty, _, mem_of_mem_erase hx,
    (disjoint_of_subset_right htu <|
        P.disjoint (mem_of_mem_erase hx) hu₁ <| ne_of_mem_erase hx).sdiff_eq_left⟩
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ (t ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id)) ≤ m
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ Finset.biUnion (filter (fun y => y ⊆ u) (insert t R.parts)) id) ≤ m
simp only [filter_insert, if_pos htu, biUnion_insert, mem_erase, id.def]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
htu : u ⊆ u
htn : card u = n
ht : Finset.Nonempty u
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ u)
R : Finpartition (s \ u)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P u).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ (u ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id)) ≤ m

case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
hut : u ≠ t
⊢ card (u \ (t ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id)) ≤ m
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ (t ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id)) ≤ m
obtain rfl | hut := eq_or_ne u t
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
hut : u ≠ t
i : α
⊢ i ∈ u \ (t ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id) →
    i ∈ (u \ t) \ Finset.biUnion (filter (fun y => y ⊆ u \ t) R.parts) id
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
hut : u ≠ t
⊢ card (u \ (t ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id)) ≤ m
refine'
  (card_le_of_subset fun i => _).trans
    (hR₂ (u \ t) <| P.mem_avoid.2 ⟨u, hu₁, fun i => hut <| i.antisymm htu, rfl⟩)
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
hut : u ≠ t
i : α
⊢ i ∈ u →
    ¬i ∈ t →
      (∀ (x : Finset α), x ∈ R.parts → x ⊆ u → ¬i ∈ x) →
        (i ∈ u ∧ ¬i ∈ t) ∧ ∀ (x : Finset α), x ∈ R.parts → x ⊆ u \ t → ¬i ∈ x
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
hut : u ≠ t
i : α
⊢ i ∈ u \ (t ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id) →
    i ∈ (u \ t) \ Finset.biUnion (filter (fun y => y ⊆ u \ t) R.parts) id
simp only [not_exists, not_and, mem_biUnion, and_imp, mem_union, mem_filter, mem_sdiff,
  id.def, not_or]
no goals
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
hut : u ≠ t
i : α
⊢ i ∈ u →
    ¬i ∈ t →
      (∀ (x : Finset α), x ∈ R.parts → x ⊆ u → ¬i ∈ x) →
        (i ∈ u ∧ ¬i ∈ t) ∧ ∀ (x : Finset α), x ∈ R.parts → x ⊆ u \ t → ¬i ∈ x
exact fun hi₁ hi₂ hi₃ =>
  ⟨⟨hi₁, hi₂⟩, fun x hx hx' => hi₃ _ hx <| hx'.trans <| sdiff_subset _ _⟩
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
htu : u ⊆ u
htn : card u = n
ht : Finset.Nonempty u
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ u)
R : Finpartition (s \ u)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P u).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card ∅ ≤ m
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
htu : u ⊆ u
htn : card u = n
ht : Finset.Nonempty u
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ u)
R : Finpartition (s \ u)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P u).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card (u \ (u ∪ Finset.biUnion (filter (fun y => y ⊆ u) R.parts) id)) ≤ m
rw [sdiff_eq_empty_iff_subset.2 (subset_union_left _ _)]
no goals
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_1.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
htu : u ⊆ u
htn : card u = n
ht : Finset.Nonempty u
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ u)
R : Finpartition (s \ u)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P u).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
⊢ card ∅ ≤ m
exact bot_le
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ filter (fun y => y ⊆ x) R.parts ⊆ filter (fun y => y ⊆ x) (insert t R.parts)
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_2.refine'_2
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ x \ Finset.biUnion (filter (fun y => y ⊆ x) (insert t R.parts)) id ⊆
    x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id
apply sdiff_subset_sdiff Subset.rfl (biUnion_subset_biUnion_of_subset_left _ _)
no goals
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
x : Finset α
hx : x ∈ erase P.parts u
⊢ filter (fun y => y ⊆ x) R.parts ⊆ filter (fun y => y ⊆ x) (insert t R.parts)
exact filter_subset_filter _ (subset_insert _ _)
no goals
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inl
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : 0 < a
⊢ card (filter (fun i => card i = m + 1) R.parts) = b
rw [hR₃, if_pos h]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : ¬0 < a
⊢ ¬t ∈ filter (fun i => card i = m + 1) R.parts
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : ¬0 < a
⊢ card (insert t (filter (fun i => card i = m + 1) R.parts)) = b
rw [card_insert_of_not_mem, hR₃, if_neg h, Nat.sub_add_cancel (hab.resolve_left h)]
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : ¬0 < a
H : t ∈ filter (fun i => card i = m + 1) R.parts
⊢ False
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : ¬0 < a
⊢ ¬t ∈ filter (fun i => card i = m + 1) R.parts
intro H
no goals
case neg.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ : Finset α
m n✝ a✝ b✝ : ℕ
P✝ : Finpartition s✝
hs✝ : a✝ * m + b✝ * (m + 1) = card s✝
m_pos : m > 0
s : Finset α
ih :
  ∀ (t : Finset α),
    t ⊂ s →
      ∀ {a b : ℕ} {P : Finpartition t},
        a * m + b * (m + 1) = card t →
          ∃ Q,
            (∀ (x : Finset α), x ∈ Q.parts → card x = m ∨ card x = m + 1) ∧
              (∀ (x : Finset α), x ∈ P.parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) Q.parts) id) ≤ m) ∧
                card (filter (fun i => card i = m + 1) Q.parts) = b
a b : ℕ
P : Finpartition s
hs : a * m + b * (m + 1) = card s
hab : 0 < a ∨ 0 < b
n : ℕ := if 0 < a then m else m + 1
hn : n = if 0 < a then m else m + 1
hn₀ : 0 < n
hn₁ : n ≤ m + 1
hn₂ : n ≤ a * m + b * (m + 1)
hn₃ : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card s - n
u : Finset α
hu₁ : u ∈ P.parts
hu₂ : m + 1 ≤ card u
t : Finset α
htu : t ⊆ u
htn : card t = n
ht : Finset.Nonempty t
hcard : (if 0 < a then a - 1 else a) * m + (if 0 < a then b else b - 1) * (m + 1) = card (s \ t)
R : Finpartition (s \ t)
hR₁ : ∀ (x : Finset α), x ∈ R.parts → card x = m ∨ card x = m + 1
hR₂ : ∀ (x : Finset α), x ∈ (avoid P t).parts → card (x \ Finset.biUnion (filter (fun y => y ⊆ x) R.parts) id) ≤ m
hR₃ : card (filter (fun i => card i = m + 1) R.parts) = if 0 < a then b else b - 1
h : ¬0 < a
H : t ∈ filter (fun i => card i = m + 1) R.parts
⊢ False
exact ht.ne_empty (le_sdiff_iff.1 <| R.le <| filter_subset _ _ H)