Theorem: Finset.powersetCard_map
File: Mathlib/Data/Finset/Powerset.lean

tactic: simp only [card_map, mem_powersetCard, le_eq_subset, gt_iff_lt, mem_map, mapEmbedding_apply]
state_before: α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ t ∈ powersetCard n (map f s) ↔ t ∈ map (mapEmbedding f).toEmbedding (powersetCard n s)
state_after: α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ t ⊆ map f s ∧ t.card = n ↔ ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t

tactic: constructor
state_before: α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ t ⊆ map f s ∧ t.card = n ↔ ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t
state_after: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ t ⊆ map f s ∧ t.card = n → ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t

case mpr
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ (∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t) → t ⊆ map f s ∧ t.card = n

tactic: classical
intro h
have : map f (filter (fun x => (f x ∈ t)) s) = t := by
  ext x
  simp only [mem_map, mem_filter, decide_eq_true_eq]
  exact ⟨fun ⟨_y, ⟨_hy₁, hy₂⟩, hy₃⟩ => hy₃ ▸ hy₂,
    fun hx => let ⟨y, hy⟩ := mem_map.1 (h.1 hx); ⟨y, ⟨hy.1, hy.2 ▸ hx⟩, hy.2⟩⟩
refine ⟨_, ?_, this⟩
rw [← card_map f, this, h.2]; simp
state_before: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ t ⊆ map f s ∧ t.card = n → ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t
state_after: no goals

tactic: intro h
state_before: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ t ⊆ map f s ∧ t.card = n → ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t
state_after: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
⊢ ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t

tactic: have : map f (filter (fun x => (f x ∈ t)) s) = t := by
  ext x
  simp only [mem_map, mem_filter, decide_eq_true_eq]
  exact ⟨fun ⟨_y, ⟨_hy₁, hy₂⟩, hy₃⟩ => hy₃ ▸ hy₂,
    fun hx => let ⟨y, hy⟩ := mem_map.1 (h.1 hx); ⟨y, ⟨hy.1, hy.2 ▸ hx⟩, hy.2⟩⟩
state_before: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
⊢ ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t
state_after: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
this : map f (filter (fun x => f x ∈ t) s) = t
⊢ ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t

tactic: refine ⟨_, ?_, this⟩
state_before: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
this : map f (filter (fun x => f x ∈ t) s) = t
⊢ ∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t
state_after: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
this : map f (filter (fun x => f x ∈ t) s) = t
⊢ filter (fun x => f x ∈ t) s ⊆ s ∧ (filter (fun x => f x ∈ t) s).card = n

tactic: rw [← card_map f, this, h.2]
state_before: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
this : map f (filter (fun x => f x ∈ t) s) = t
⊢ filter (fun x => f x ∈ t) s ⊆ s ∧ (filter (fun x => f x ∈ t) s).card = n
state_after: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
this : map f (filter (fun x => f x ∈ t) s) = t
⊢ filter (fun x => f x ∈ t) s ⊆ s ∧ n = n

tactic: simp
state_before: case mp
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
this : map f (filter (fun x => f x ∈ t) s) = t
⊢ filter (fun x => f x ∈ t) s ⊆ s ∧ n = n
state_after: no goals

tactic: ext x
state_before: α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
⊢ map f (filter (fun x => f x ∈ t) s) = t
state_after: case a
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
x : β
⊢ x ∈ map f (filter (fun x => f x ∈ t) s) ↔ x ∈ t

tactic: simp only [mem_map, mem_filter, decide_eq_true_eq]
state_before: case a
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
x : β
⊢ x ∈ map f (filter (fun x => f x ∈ t) s) ↔ x ∈ t
state_after: case a
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
x : β
⊢ (∃ a, (a ∈ s ∧ f a ∈ t) ∧ f a = x) ↔ x ∈ t

tactic: exact ⟨fun ⟨_y, ⟨_hy₁, hy₂⟩, hy₃⟩ => hy₃ ▸ hy₂,
  fun hx => let ⟨y, hy⟩ := mem_map.1 (h.1 hx); ⟨y, ⟨hy.1, hy.2 ▸ hx⟩, hy.2⟩⟩
state_before: case a
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
h : t ⊆ map f s ∧ t.card = n
x : β
⊢ (∃ a, (a ∈ s ∧ f a ∈ t) ∧ f a = x) ↔ x ∈ t
state_after: no goals

tactic: rintro ⟨a, ⟨has, rfl⟩, rfl⟩
state_before: case mpr
α : Type u_1
s✝¹ t✝¹ : Finset α
n✝ : ?m.33023
s✝ t✝ : Finset α
β : Type u_2
f : α ↪ β
n : ℕ
s : Finset α
t : Finset β
⊢ (∃ a, (a ⊆ s ∧ a.card = n) ∧ (mapEmbedding f).toEmbedding a = t) → t ⊆ map f s ∧ t.card = n
state_after: case mpr.intro.intro.intro
α : Type u_1
s✝¹ t✝ : Finset α
n : ?m.33023
s✝ t : Finset α
β : Type u_2
f : α ↪ β
s a : Finset α
has : a ⊆ s
⊢ (mapEmbedding f).toEmbedding a ⊆ map f s ∧ ((mapEmbedding f).toEmbedding a).card = a.card

tactic: dsimp [RelEmbedding.coe_toEmbedding]
state_before: case mpr.intro.intro.intro
α : Type u_1
s✝¹ t✝ : Finset α
n : ?m.33023
s✝ t : Finset α
β : Type u_2
f : α ↪ β
s a : Finset α
has : a ⊆ s
⊢ (mapEmbedding f).toEmbedding a ⊆ map f s ∧ ((mapEmbedding f).toEmbedding a).card = a.card
state_after: case mpr.intro.intro.intro
α : Type u_1
s✝¹ t✝ : Finset α
n : ?m.33023
s✝ t : Finset α
β : Type u_2
f : α ↪ β
s a : Finset α
has : a ⊆ s
⊢ (mapEmbedding f) a ⊆ map f s ∧ ((mapEmbedding f) a).card = a.card

tactic: rw [mapEmbedding_apply]
state_before: case mpr.intro.intro.intro
α : Type u_1
s✝¹ t✝ : Finset α
n : ?m.33023
s✝ t : Finset α
β : Type u_2
f : α ↪ β
s a : Finset α
has : a ⊆ s
⊢ (mapEmbedding f) a ⊆ map f s ∧ ((mapEmbedding f) a).card = a.card
state_after: case mpr.intro.intro.intro
α : Type u_1
s✝¹ t✝ : Finset α
n : ?m.33023
s✝ t : Finset α
β : Type u_2
f : α ↪ β
s a : Finset α
has : a ⊆ s
⊢ map f a ⊆ map f s ∧ (map f a).card = a.card

tactic: simp [has]
state_before: case mpr.intro.intro.intro
α : Type u_1
s✝¹ t✝ : Finset α
n : ?m.33023
s✝ t : Finset α
β : Type u_2
f : α ↪ β
s a : Finset α
has : a ⊆ s
⊢ map f a ⊆ map f s ∧ (map f a).card = a.card
state_after: no goals