Theorem: Fintype.all_card_le_filter_rel_iff_exists_injective
File: Mathlib/Combinatorics/Hall/Basic.lean

Proof steps:
state_before: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: haveI := Classical.decEq β
state_before: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: let r' a := univ.filter fun b => r a b
state_before: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
h : ∀ (A : Finset α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: have h : ∀ A : Finset α, (univ.filter fun b : β => ∃ a ∈ A, r a b) = A.biUnion r' := by
    intro A
    ext b
    simp [r']
state_before: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
h : ∀ (A : Finset α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
h : ∀ (A : Finset α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
h' : ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: have h' : ∀ (f : α → β) (x), r x (f x) ↔ f x ∈ r' x := by simp [r']
state_before: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
h : ∀ (A : Finset α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
h' : ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
⊢ (∀ (A : Finset α), A.card ≤ (filter (fun b => ∃ a ∈ A, r a b) univ).card) ↔
    ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
h : ∀ (A : Finset α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
h' : ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
⊢ (∀ (A : Finset α), A.card ≤ (A.biUnion r').card) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), f x ∈ r' x
tactic: simp_rw [h, h']
state_before: α : Type u
β : Type v
inst✝¹ : Fintype β
r : α → β → Prop
inst✝ : (a : α) → DecidablePred (r a)
this : DecidableEq β
r' : α → Finset β := fun a => filter (fun b => r a b) univ
h : ∀ (A : Finset α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
h' : ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
⊢ (∀ (A : Finset α), A.card ≤ (A.biUnion r').card) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), f x ∈ r' x
state_after: no goals
tactic: apply Finset.all_card_le_biUnion_card_iff_exists_injective