Skip to content

Commit

Permalink
Chore(Data/Set/Card): Remove unnecessary assumption for ncard eq of b…
Browse files Browse the repository at this point in the history
…ijective (#12108)

Drop redundant hypothesis `s.Finite` from `Set.ncard_eq_of_bijective`.
  • Loading branch information
Jun2M committed Apr 16, 2024
1 parent f47773f commit 07d4b27
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Mathlib/Data/Set/Card.lean
Expand Up @@ -738,12 +738,16 @@ theorem ncard_strictMono [Finite α] : @StrictMono (Set α) _ _ _ ncard :=

theorem ncard_eq_of_bijective {n : ℕ} (f : ∀ i, i < n → α)
(hf : ∀ a ∈ s, ∃ i, ∃ h : i < n, f i h = a) (hf' : ∀ (i) (h : i < n), f i h ∈ s)
(f_inj : ∀ (i j) (hi : i < n) (hj : j < n), f i hi = f j hj → i = j)
(hs : s.Finite := by toFinite_tac) :
s.ncard = n := by
rw [ncard_eq_toFinset_card _ hs]
apply Finset.card_eq_of_bijective
all_goals simpa
(f_inj : ∀ (i j) (hi : i < n) (hj : j < n), f i hi = f j hj → i = j) : s.ncard = n := by
let f' : Fin n → α := fun i ↦ f i.val i.is_lt
suffices himage : s = f' '' Set.univ by
rw [← Fintype.card_fin n, ← Nat.card_eq_fintype_card, ← Set.ncard_univ, himage]
exact ncard_image_of_injOn <| fun i _hi j _hj h ↦ Fin.ext <| f_inj i.val j.val i.is_lt j.is_lt h
ext x
simp only [image_univ, mem_range]
refine ⟨fun hx ↦ ?_, fun ⟨⟨i, hi⟩, hx⟩ ↦ hx ▸ hf' i hi⟩
obtain ⟨i, hi, rfl⟩ := hf x hx
use ⟨i, hi⟩
#align set.ncard_eq_of_bijective Set.ncard_eq_of_bijective

theorem ncard_congr {t : Set β} (f : ∀ a ∈ s, β) (h₁ : ∀ a ha, f a ha ∈ t)
Expand Down

0 comments on commit 07d4b27

Please sign in to comment.