@@ -43,8 +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 α) := Numbering s
47- --def NumberingOn {α : Type*} (s : Finset α) := {x // x ∈ s} ≃ Fin s.card
46+ def NumberingOn {α : Type *} (s : Finset α) := {x // x ∈ s} ≃ Fin s.card
4847
4948variable {α : Type *} [Fintype α] [DecidableEq α]
5049
@@ -53,7 +52,7 @@ theorem card_Numbering : card (Numbering α) = (card α).factorial := by
5352
5453omit [Fintype α] in
5554theorem card_NumberingOn (s : Finset α) : card (NumberingOn s) = s.card.factorial := by
56- simp only [NumberingOn, Numbering ]
55+ simp only [NumberingOn]
5756 have h1 : card {x // x ∈ s} = card (Fin s.card) := by simp
5857 have h2 : {x // x ∈ s} ≃ Fin s.card := by exact Fintype.equivOfCardEq h1
5958 simp [Fintype.card_equiv h2]
@@ -69,23 +68,21 @@ theorem subset_IsPrefix_IsPrefix {s1 s2 : Finset α} {f : Numbering α}
6968 intro a h_as1
7069 exact (h_s2 a).mpr (lt_of_lt_of_le ((h_s1 a).mp h_as1) h_card)
7170
72- def equiv_IsPrefix_NumberingOn2 (s : Finset α) :
73- {f // IsPrefix s f} ≃ NumberingOn s × NumberingOn sᶜ where
71+ def equiv_IsPrefix_NumberingOn2 (s : Finset α) : {f // IsPrefix s f} ≃ NumberingOn s × NumberingOn sᶜ where
7472 toFun := fun ⟨f, hf⟩ ↦
7573 ({
76- toFun := fun ⟨x, hx⟩ ↦ ⟨f x, by rwa [card_coe, ← hf x]⟩
77- invFun := fun ⟨n, hn⟩ ↦ ⟨f.symm ⟨n, by rw [card_coe] at hn ; have := s.card_le_univ; omega⟩,
78- by rw [hf]; rw [card_coe] at hn; simpa⟩
74+ toFun := fun ⟨x, hx⟩ ↦ ⟨f x, by rwa [← hf x]⟩
75+ invFun := fun ⟨n, hn⟩ ↦ ⟨f.symm ⟨n, by have := s.card_le_univ; omega⟩, by rw [hf]; simpa⟩
7976 left_inv := by rintro ⟨x, hx⟩; simp
8077 right_inv := by rintro ⟨n, hn⟩; simp
8178 },
8279 {
8380 toFun := fun ⟨x, hx⟩ ↦ ⟨f x - s.card, by
8481 rw [s.mem_compl, hf] at hx
85- rw [card_coe, s.card_compl]
82+ rw [s.card_compl]
8683 exact Nat.sub_lt_sub_right (by omega) (by omega)
8784 ⟩
88- invFun := fun ⟨n, hn⟩ ↦ ⟨f.symm ⟨n + s.card, by rw [card_coe, s.card_compl] at hn; omega⟩,
85+ invFun := fun ⟨n, hn⟩ ↦ ⟨f.symm ⟨n + s.card, by rw [s.card_compl] at hn; omega⟩,
8986 by rw [s.mem_compl, hf]; simp⟩
9087 left_inv := by
9188 rintro ⟨x, hx⟩
@@ -99,14 +96,12 @@ def equiv_IsPrefix_NumberingOn2 (s : Finset α) :
9996 if hx : x ∈ s then
10097 g ⟨x, hx⟩ |>.castLE s.card_le_univ
10198 else
102- g' ⟨x, by simpa⟩ |>.addNat s.card |>.cast (
103- by simp [card_coe] ; have := s.card_le_univ ; omega
104- )
99+ g' ⟨x, by simpa⟩ |>.addNat s.card |>.cast (by simp)
105100 invFun := fun ⟨n, hn⟩ ↦
106101 if hn' : n < s.card then
107102 g.symm ⟨n, hn'⟩
108103 else
109- g'.symm ⟨n - s.card, by rw [card_coe, s.card_compl]; omega⟩
104+ g'.symm ⟨n - s.card, by rw [s.card_compl]; omega⟩
110105 left_inv := by intro x; by_cases hx : x ∈ s <;> simp [hx]
111106 right_inv := by
112107 rintro ⟨n, hn⟩
0 commit comments