Skip to Content.
Sympa Menu

ssreflect - RE: [ssreflect] count of subsequence (different lists)

Subject: Ssreflect Users Discussion List

List archive

RE: [ssreflect] count of subsequence (different lists)


Chronological Thread 
  • From: Georges Gonthier <>
  • To: Felipe Cerqueira <>, "" <>
  • Subject: RE: [ssreflect] count of subsequence (different lists)
  • Date: Tue, 19 Jan 2016 11:29:46 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
  • Ironport-phdr: 9a23:ICMHNRKv8FcZLUkp09mcpTZWNBhigK39O0sv0rFitYgVLvTxwZ3uMQTl6Ol3ixeRBMOAu6wC2rud6viocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC0YLmhqvro9X6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFmrPHs4DfOSQqX6zM3X38PjxdJGQGNuB/3WpbpvyDSs/J8nTKFJovxV79iHXzo9LxxRRHshSwbHzsi6iTWjNZxheRapgigrlpx2cScNJqOLvdweq7WYfsfXnAEX8BLViUHA4WmboJJAfBXbshCqIyoiFYJtxSzHkGDA+Xzyj5FnDei0qo8z+QgHBvu2Q0rBdUVt3rI6t7yMfFBAqiO0KDUwGCbPLtt0jDn5d2NK0h5rA==
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:23

The lemma you're looking for is count_filter, which doesn't have count in
its name but does show up in
Search count filter.
This give the following script:
rewrite -!size_filter uniq_leq_size ?filter_uniq // => x.
by rewrite !mem_filter => /andP[-> /SUB].
Also note you can state your SUB assumption more elegantly as {subset l1 <=
l2}, and that your lemma name should include an "r" suffix to indicate the
inclusion is for the right argument (suffixless lemmas in the library are for
predicate inclusion, e.g., has_sub, all_sub, etc; right inclusions are not
well covered).
Cheers,
Georges

-----Original Message-----
From:


[mailto:]
On Behalf Of Felipe Cerqueira
Sent: 19 January 2016 10:59
To:

Subject: [ssreflect] count of subsequence (different lists)

Hi,

I'm having troubles to prove the following lemma about count.
Could you point me to the right direction?

Lemma count_sub_uniq :
forall (T: eqType) (l1 l2: seq T) P,
uniq l1 ->
subpred (mem l1) (mem l2) ->
count P l1 <= count P l2.

The closest I got to the proof was this:

UNIQ : uniq l1
SUB : subpred (T:=T) (mem l1) (mem l2)
============================
count (fun x : T => P x && (mem l2) x) l1 <= count P l2

At this point, I though about using the subseq/filter lemmas, but I didn't
know what to do.

Thanks,
Felipe



Archive powered by MHonArc 2.6.18.

Top of Page