Skip to content

Commit 6d7bd28

Browse files
committed
Use Numbering to define NumberingOn
1 parent 0bc5775 commit 6d7bd28

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

LeanCamCombi/ProbLYM.lean

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ in mathlib because we need the special property `set_prefix_subset` below. -/
4343
def 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

4848
variable {α : Type*} [Fintype α] [DecidableEq α]
4949

@@ -52,10 +52,7 @@ theorem card_Numbering : card (Numbering α) = (card α).factorial := by
5252

5353
omit [Fintype α] in
5454
theorem 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ᶜ`
6158
in 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+
144147
instance (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

Comments
 (0)