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

Proof steps:
state_before: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: let r' a := (Rel.image r {a}).toFinset
state_before: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
h : ∀ (A : Finset α), card ↑(Rel.image r ↑A) = (A.biUnion r').card
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: have h : ∀ A : Finset α, Fintype.card (Rel.image r A) = (A.biUnion r').card := by
    intro A
    rw [← Set.toFinset_card]
    apply congr_arg
    ext b
    -- Porting note: added `Set.mem_toFinset`
    simp [Rel.image, (Set.mem_toFinset)]
state_before: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
h : ∀ (A : Finset α), card ↑(Rel.image r ↑A) = (A.biUnion r').card
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
h : ∀ (A : Finset α), card ↑(Rel.image r ↑A) = (A.biUnion r').card
h' : ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
tactic: have h' : ∀ (f : α → β) (x), r x (f x) ↔ f x ∈ r' x := by simp [Rel.image, (Set.mem_toFinset)]
state_before: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
h : ∀ (A : Finset α), card ↑(Rel.image r ↑A) = (A.biUnion r').card
h' : ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
⊢ (∀ (A : Finset α), A.card ≤ card ↑(Rel.image r ↑A)) ↔ ∃ f, Function.Injective f ∧ ∀ (x : α), r x (f x)
state_after: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
h : ∀ (A : Finset α), card ↑(Rel.image r ↑A) = (A.biUnion r').card
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 only [h, h']
state_before: α : Type u
β : Type v
inst✝¹ : DecidableEq β
r : α → β → Prop
inst✝ : (a : α) → Fintype ↑(Rel.image r {a})
r' : α → Finset β := fun a => (Rel.image r {a}).toFinset
h : ∀ (A : Finset α), card ↑(Rel.image r ↑A) = (A.biUnion r').card
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