Skip to Content.
Sympa Menu

ssreflect - Re: [ssreflect] card_set

Subject: Ssreflect Users Discussion List

List archive

Re: [ssreflect] card_set


Chronological Thread 
  • From: Christian Doczkal <>
  • To:
  • Subject: Re: [ssreflect] card_set
  • Date: Thu, 14 Jan 2016 10:43:16 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:fTaj7BwtzPqY/KLXCy+O+j09IxM/srCxBDY+r6Qd0e8eIJqq85mqBkHD//Il1AaPBtWFraIVwLKL+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStCU35X8j7360qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD884motVbS6j0e6kzUZRdFy5jMmYv5cSttB/ZTALJ6GFPfH8Rl09jAxLE9w37V5G5nizxpOl03GHOMcr9X7M9XRy69OF2Th6tky4OLTow9m2RhsEm3/ETmw6ouxEqm92cW4qSLvcrJq4=

Thanks, this is about the proof length I had expected. I missed cardsT
and its interaction with powersetT. -- Cheers Christian.

On 01/13/2016 07:20 PM, Maxime Dénès wrote:
> Lemma card_set (T:finType) : #|{set T}| = 2^#|T|.
> by rewrite -!cardsT -powersetT -card_powerset.
> Qed.
>
> Cheers,
>
> Maxime.
>
> On 01/13/16 18:42, Christian Doczkal wrote:
>> 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.
>



Archive powered by MHonArc 2.6.18.

Top of Page