@@ -43,7 +43,7 @@ in mathlib because we need the special property `set_prefix_subset` below. -/
4343def Numbering (α : Type *) [Fintype α] := α ≃ Fin (card α)
4444
4545@[reducible]
46- def NumberingOn {α : Type *} (s : Finset α) := {x // x ∈ s} ≃ Fin s.card
46+ def NumberingOn {α : Type *} (s : Finset α) := Numbering s
4747
4848variable {α : Type *} [Fintype α] [DecidableEq α]
4949
@@ -52,10 +52,7 @@ theorem card_Numbering : card (Numbering α) = (card α).factorial := by
5252
5353omit [Fintype α] in
5454theorem card_NumberingOn (s : Finset α) : card (NumberingOn s) = s.card.factorial := by
55- simp only [NumberingOn]
56- have h1 : card {x // x ∈ s} = card (Fin s.card) := by simp
57- have h2 : {x // x ∈ s} ≃ Fin s.card := by exact Fintype.equivOfCardEq h1
58- simp [Fintype.card_equiv h2]
55+ simp only [NumberingOn, card_Numbering, card_coe]
5956
6057/-- `IsPrefix s f` means that the elements of `s` precede the elements of `sᶜ`
6158in the numbering `f`. -/
@@ -68,7 +65,8 @@ theorem subset_IsPrefix_IsPrefix {s1 s2 : Finset α} {f : Numbering α}
6865 intro a h_as1
6966 exact (h_s2 a).mpr (lt_of_lt_of_le ((h_s1 a).mp h_as1) h_card)
7067
71- def equiv_IsPrefix_NumberingOn2 (s : Finset α) : {f // IsPrefix s f} ≃ NumberingOn s × NumberingOn sᶜ where
68+ def equiv_IsPrefix_NumberingOn2' (s : Finset α) :
69+ {f // IsPrefix s f} ≃ ({x // x ∈ s} ≃ Fin s.card) × ({x // x ∈ sᶜ} ≃ Fin sᶜ.card) where
7270 toFun := fun ⟨f, hf⟩ ↦
7371 ({
7472 toFun := fun ⟨x, hx⟩ ↦ ⟨f x, by rwa [← hf x]⟩
@@ -141,6 +139,11 @@ def equiv_IsPrefix_NumberingOn2 (s : Finset α) : {f // IsPrefix s f} ≃ Number
141139 rw [Finset.mem_compl] at hx
142140 simp [hx]
143141
142+ def equiv_IsPrefix_NumberingOn2 (s : Finset α) :
143+ {f // IsPrefix s f} ≃ NumberingOn s × NumberingOn sᶜ := by
144+ simp only [NumberingOn, Numbering, card_coe]
145+ exact equiv_IsPrefix_NumberingOn2' s
146+
144147instance (s : Finset α) :
145148 DecidablePred fun f ↦ (IsPrefix s f) := by
146149 intro f ; exact Classical.propDecidable ((fun f ↦ IsPrefix s f) f)
0 commit comments