Theorem: HallMarriageTheorem.hall_cond_of_compl
File: Mathlib/Combinatorics/Hall/Finite.lean

tactic: haveI := Classical.decEq ι
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
⊢ card s' ≤ card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: have disj : Disjoint s (s'.image fun z => z.1) := by
  simp only [disjoint_left, not_exists, mem_image, exists_prop, SetCoe.exists, exists_and_right,
    exists_eq_right, Subtype.coe_mk]
  intro x hx hc _
  exact absurd hx hc
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this : DecidableEq ι
⊢ card s' ≤ card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: have : s'.card = (s ∪ s'.image fun z => z.1).card - s.card := by
  simp [disj, card_image_of_injective _ Subtype.coe_injective]
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
⊢ card s' ≤ card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: rw [this, hus]
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ card s' ≤ card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: refine' (tsub_le_tsub_right (ht _) _).trans _
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ card (s ∪ image (fun z => ↑z) s') - card (Finset.biUnion s t) ≤
    card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: rw [← card_sdiff]
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ card (Finset.biUnion (s ∪ image (fun z => ↑z) s') t) - card (Finset.biUnion s t) ≤
    card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: simp only [disjoint_left, not_exists, mem_image, exists_prop, SetCoe.exists, exists_and_right,
  exists_eq_right, Subtype.coe_mk]
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this : DecidableEq ι
⊢ Disjoint s (image (fun z => ↑z) s')

tactic: intro x hx hc _
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this : DecidableEq ι
⊢ ∀ ⦃a : ι⦄, a ∈ s → ∀ (x : a ∈ ↑sᶜ), ¬{ val := a, property := (_ : a ∈ ↑sᶜ) } ∈ s'

tactic: exact absurd hx hc
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this : DecidableEq ι
x : ι
hx : x ∈ s
hc : x ∈ ↑sᶜ
a✝ : { val := x, property := (_ : x ∈ ↑sᶜ) } ∈ s'
⊢ False

tactic: simp [disj, card_image_of_injective _ Subtype.coe_injective]
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
⊢ card s' = card (s ∪ image (fun z => ↑z) s') - card s

tactic: refine' (card_le_of_subset _).trans le_rfl
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ card (Finset.biUnion (s ∪ image (fun z => ↑z) s') t \ Finset.biUnion s t) ≤
    card (Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t)

tactic: intro t
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ Finset.biUnion (s ∪ image (fun z => ↑z) s') t \ Finset.biUnion s t ⊆
    Finset.biUnion s' fun x' => t ↑x' \ Finset.biUnion s t

tactic: simp only [mem_biUnion, mem_sdiff, not_exists, mem_image, and_imp, mem_union, exists_and_right,
  exists_imp]
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝¹ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t✝ : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t✝)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t✝)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
t : α
⊢ t ∈ Finset.biUnion (s ∪ image (fun z => ↑z) s') t✝ \ Finset.biUnion s t✝ →
    t ∈ Finset.biUnion s' fun x' => t✝ ↑x' \ Finset.biUnion s t✝

tactic: rintro x (hx | ⟨x', hx', rfl⟩) rat hs
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝¹ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t✝ : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t✝)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t✝)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
t : α
⊢ ∀ (x : ι),
    (x ∈ s ∨ ∃ a, a ∈ s' ∧ ↑a = x) →
      t ∈ t✝ x → (∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)) → ∃ a, a ∈ s' ∧ t ∈ t✝ ↑a ∧ ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)

tactic: exact False.elim <| (hs x) <| And.intro hx rat
state_before: case inl
ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝¹ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t✝ : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t✝)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t✝)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
t : α
x : ι
hx : x ∈ s
rat : t ∈ t✝ x
hs : ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)
⊢ ∃ a, a ∈ s' ∧ t ∈ t✝ ↑a ∧ ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)

tactic: use x'
state_before: case inr.intro.intro
ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝¹ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t✝ : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t✝)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t✝)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
t : α
x' : ↑(↑sᶜ)
hx' : x' ∈ s'
rat : t ∈ t✝ ↑x'
hs : ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)
⊢ ∃ a, a ∈ s' ∧ t ∈ t✝ ↑a ∧ ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)

tactic: exact And.intro hx' (And.intro rat hs)
state_before: case inr.intro.intro
ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝¹ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t✝ : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t✝)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t✝)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
t : α
x' : ↑(↑sᶜ)
hx' : x' ∈ s'
rat : t ∈ t✝ ↑x'
hs : ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)
⊢ x' ∈ s' ∧ t ∈ t✝ ↑x' ∧ ∀ (x : ι), ¬(x ∈ s ∧ t ∈ t✝ x)

tactic: apply biUnion_subset_biUnion_of_subset_left
state_before: ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ Finset.biUnion s t ⊆ Finset.biUnion (s ∪ image (fun z => ↑z) s') t

tactic: apply subset_union_left
state_before: case h
ι✝ : Type u
α : Type v
inst✝¹ : DecidableEq α
t✝ : ι✝ → Finset α
inst✝ : Fintype ι✝
ι : Type u
t : ι → Finset α
s : Finset ι
hus : card s = card (Finset.biUnion s t)
ht : ∀ (s : Finset ι), card s ≤ card (Finset.biUnion s t)
s' : Finset ↑(↑sᶜ)
this✝ : DecidableEq ι
disj : Disjoint s (image (fun z => ↑z) s')
this : card s' = card (s ∪ image (fun z => ↑z) s') - card s
⊢ s ⊆ s ∪ image (fun z => ↑z) s'