Subject: Ssreflect Users Discussion List
List archive
- From: Christian Doczkal <>
- To:
- Subject: [ssreflect] card_set
- Date: Wed, 13 Jan 2016 18:42:42 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:W26EhBLVA99s67aqENmcpTZWNBhigK39O0sv0rFitYgUL/TxwZ3uMQTl6Ol3ixeRBMOAu6wC27Wd4v+ocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC0YLniKvjpNX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVSr7gcqo8QLdEJDE9KSU04tfqvF/CSxGO7z0SSDY4iB1NViPF9hDhQpb4tGPWseFv2yCedZn6SrsmWj2mx79wDgLuiWIcPjcj9GjRhop8gfQI81qauxVjztuMM8muP/1kc/aFcA==
Hello
Today I needed the following lemma with, surprisingly, I could not find
in the ssreflect component:
Lemma card_set (T:finType) : #|{set T}| = 2^#|T|.
I have a proof (see below), but the proof seems overly complicated.
Specifically, I did not manage to exploit that {set T} is defined in
terms of finite function types for which a cardinality lemma exists.
Can someone show me a simpler proof that exploits the definition of
set_type?
Cheers
Christian
------------------------------------------------------------------------
Require Import mathcomp.ssreflect.ssreflect.
From mathcomp Require Import all_ssreflect.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Lemma inj_leq_card (T T' : finType) (f : T -> T') :
injective f -> #|T| <= #|T'|.
Proof. move => inj_f. by rewrite -(card_imset predT inj_f) max_card. Qed.
Lemma bij_card {X Y : finType} (f : X->Y): bijective f -> #|X| = #|Y|.
Proof.
case => g /can_inj Hf /can_inj Hg. apply/eqP.
by rewrite eqn_leq (inj_leq_card Hf) (inj_leq_card Hg).
Qed.
Lemma card_set (T:finType) : #|{set T}| = 2^#|T|.
Proof.
suff H: #|{set T}| = #|{ffun pred T}|
by rewrite H card_ffun card_bool.
pose f (X:{set T}) := [ffun x => x \in X].
pose g (F:{ffun pred T}) := [set x | F x].
apply : (bij_card (f := f)). apply: (Bijective (g := g)).
- move => X. rewrite /f /g. apply/setP => x. by rewrite inE ffunE.
- move => F. rewrite /f /g. apply/ffunP => x. by rewrite ffunE inE.
Qed.
- [ssreflect] card_set, Christian Doczkal, 01/13/2016
- Re: [ssreflect] card_set, Maxime Dénès, 01/13/2016
- Re: [ssreflect] card_set, Christian Doczkal, 01/14/2016
- RE: [ssreflect] card_set, Georges Gonthier, 01/19/2016
- Re: [ssreflect] card_set, Christian Doczkal, 01/14/2016
- Re: [ssreflect] card_set, Maxime Dénès, 01/13/2016
Archive powered by MHonArc 2.6.18.