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

tactic: haveI := Classical.decEq β
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: 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 β
⊢ (∀ (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: 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
⊢ (∀ (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' : ∀ (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'
⊢ (∀ (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: 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 ≤ (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: apply Finset.all_card_le_biUnion_card_iff_exists_injective
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: intro A
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 α), filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
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 α
⊢ filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'

tactic: ext 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 α
⊢ filter (fun b => ∃ a ∈ A, r a b) univ = A.biUnion r'
state_after: case a
α : 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 α
b : β
⊢ b ∈ filter (fun b => ∃ a ∈ A, r a b) univ ↔ b ∈ A.biUnion r'

tactic: simp [r']
state_before: case a
α : 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 α
b : β
⊢ b ∈ filter (fun b => ∃ a ∈ A, r a b) univ ↔ b ∈ A.biUnion r'
state_after: no goals

tactic: 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'
⊢ ∀ (f : α → β) (x : α), r x (f x) ↔ f x ∈ r' x
state_after: no goals