Skip to Content.
Sympa Menu

ssreflect - [ssreflect] ListSet in ssreflect

Subject: Ssreflect Users Discussion List

List archive

[ssreflect] ListSet in ssreflect


Chronological Thread 
  • From: Felipe Cerqueira <>
  • To:
  • Subject: [ssreflect] ListSet in ssreflect
  • Date: Thu, 21 Apr 2016 11:45:31 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:guJB2xeqcI+BMXHZt8C1B2u+lGMj4u6mDksu8pMizoh2WeGdxc6/ZB7h7PlgxGXEQZ/co6odzbGG4+a+CSdZut6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDivcODKFwTzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePEjVqZVAjArOHwd4dbx8BjFVwqGoHoaSGQf1BRSUCbf6xSvcJr1szP3/sFwwjCHMMzsRPhgVzmm7r9mQzftkCZCLCEitmbNhZoj3+pgvBu9qkknkMbva4aPOa8mcw==

Hello,

I was trying to build a simple ListSet in ssreflect on top of seq, as opposed to using finsets (since they only work with fintypes).
I'm used to working with seq, so it would be nice to have a "list that is uniq".
I tried the following code:

Section SeqSet.

  Context {T: eqType}.

  Record set (T : eqType) :=
  {
    _set_seq :> seq T ;
    _ : uniq _set_seq (* uniqueness property*)
  }.

  Canonical Structure setSubType T := [subType for _set_seq T by set_rect T].
  Definition set_eqMixin T := [eqMixin of set T by <:].
  Canonical Structure mySubType_eqType T := EqType (set T) (set_eqMixin T).

End SeqSet.
 
Even though the code above compiles, I'm not able to do the following:

  Variable s1: set nat.
  Variable s2: set 'I_10.

The problem is that nat is the Type, not the eqType.
I tried having a look at finset.v to see how it is done there, but there was something about
Phantom that I didn't understand.

Is there an easy way to do this? What I've been doing so far is to use lists everywhere
and add the hypothesis of uniqueness separately.

Thanks,
Felipe



Archive powered by MHonArc 2.6.18.

Top of Page