@@ -161,21 +161,24 @@ theorem card_congr {α β} [fintype α] [fintype β] (f : α ≃ β) : card α =
161
161
by rw ← of_equiv_card f; congr
162
162
163
163
theorem card_eq {α β} [F : fintype α] [G : fintype β] : card α = card β ↔ nonempty (α ≃ β) :=
164
- ⟨λ h, ⟨by classical;
164
+ ⟨λ h, ⟨by classical;
165
165
calc α ≃ fin (card α) : trunc.out (equiv_fin α)
166
166
... ≃ fin (card β) : by rw h
167
- ... ≃ β : (trunc.out (equiv_fin β)).symm⟩,
167
+ ... ≃ β : (trunc.out (equiv_fin β)).symm⟩,
168
168
λ ⟨f⟩, card_congr f⟩
169
169
170
170
def of_subsingleton (a : α) [subsingleton α] : fintype α :=
171
171
⟨finset.singleton a, λ b, finset.mem_singleton.2 (subsingleton.elim _ _)⟩
172
172
173
- @[simp] theorem fintype. univ_of_subsingleton (a : α) [subsingleton α] :
173
+ @[simp] theorem univ_of_subsingleton (a : α) [subsingleton α] :
174
174
@univ _ (of_subsingleton a) = finset.singleton a := rfl
175
175
176
- @[simp] theorem fintype. card_of_subsingleton (a : α) [subsingleton α] :
176
+ @[simp] theorem card_of_subsingleton (a : α) [subsingleton α] :
177
177
@fintype.card _ (of_subsingleton a) = 1 := rfl
178
178
179
+ lemma card_eq_sum_ones {α} [fintype α] : fintype.card α = (finset.univ : finset α).sum (λ _, 1 ) :=
180
+ finset.card_eq_sum_ones _
181
+
179
182
end fintype
180
183
181
184
lemma finset.card_univ [fintype α] : (finset.univ : finset α).card = fintype.card α :=
@@ -436,20 +439,20 @@ instance finset.fintype [fintype α] : fintype (finset α) :=
436
439
instance subtype.fintype [fintype α] (p : α → Prop ) [decidable_pred p] : fintype {x // p x} :=
437
440
set_fintype _
438
441
439
- instance psigma.fintype {α : Type *} {β : α → Type *} [fintype α] [∀ a, fintype (β a)] :
440
- fintype (Σ' a, β a) :=
442
+ instance psigma.fintype {α : Type *} {β : α → Type *} [fintype α] [∀ a, fintype (β a)] :
443
+ fintype (Σ' a, β a) :=
441
444
fintype.of_equiv _ (equiv.psigma_equiv_sigma _).symm
442
445
443
- instance psigma.fintype_prop_left {α : Prop } {β : α → Type *} [∀ a, fintype (β a)] [decidable α] :
446
+ instance psigma.fintype_prop_left {α : Prop } {β : α → Type *} [∀ a, fintype (β a)] [decidable α] :
444
447
fintype (Σ' a, β a) :=
445
- if h : α then fintype.of_equiv (β h) ⟨λ x, ⟨h, x⟩, psigma.snd, λ _, rfl, λ ⟨_, _⟩, rfl⟩
448
+ if h : α then fintype.of_equiv (β h) ⟨λ x, ⟨h, x⟩, psigma.snd, λ _, rfl, λ ⟨_, _⟩, rfl⟩
446
449
else ⟨∅, λ x, h x.1 ⟩
447
450
448
- instance psigma.fintype_prop_right {α : Type *} {β : α → Prop } [fintype α] [∀ a, decidable (β a)] :
451
+ instance psigma.fintype_prop_right {α : Type *} {β : α → Prop } [fintype α] [∀ a, decidable (β a)] :
449
452
fintype (Σ' a, β a) :=
450
453
fintype.of_equiv {a // β a} ⟨λ ⟨x, y⟩, ⟨x, y⟩, λ ⟨x, y⟩, ⟨x, y⟩, λ ⟨x, y⟩, rfl, λ ⟨x, y⟩, rfl⟩
451
454
452
- instance psigma.fintype_prop_prop {α : Prop } {β : α → Prop } [decidable α] [∀ a, decidable (β a)] :
455
+ instance psigma.fintype_prop_prop {α : Prop } {β : α → Prop } [decidable α] [∀ a, decidable (β a)] :
453
456
fintype (Σ' a, β a) :=
454
457
if h : ∃ a, β a then ⟨{⟨h.fst, h.snd⟩}, λ ⟨_, _⟩, by simp⟩ else ⟨∅, λ ⟨x, y⟩, h ⟨x, y⟩⟩
455
458
0 commit comments