Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Finite set to list

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Finite set to list


Chronological Thread 
  • From: Pierre Courtieu <pierre.courtieu AT gmail.com>
  • To: Vincent BENAYOUN <benayoun.vincent AT gmail.com>
  • Cc: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Finite set to list
  • Date: Thu, 25 Apr 2013 18:09:25 +0200

Hello Vincent, your definition is not accepted because Finite is a predicate in Prop. It is accepted with a version of Finite in Type instead. However if you describe what you want to do with them people in this list may suggest more pertinent definitions of finite sets.

Best regards,
P.


2013/4/25 Vincent BENAYOUN <benayoun.vincent AT gmail.com>
Hi everybody,

I am using the Coq standard library for set.
I consider :
- Coq.Sets.Ensembles
- Coq.Sets.Finite_sets

How can I write a function which take a finite set and return a list of its elements ?
I have written the following code which obviously doesn't work.
How can I fix it ?


Require Import Ensembles.
Require Import Finite_sets.

Fixpoint finite_set_to_list (s:Ensemble label) (P:Finite _ s) : list label :=
  match P with
    | Empty_is_finite => nil
    | Union_is_finite s' P' x H => cons x (finite_set_to_list s' P')
  end.


Thanks in advance,
Vincent




Archive powered by MHonArc 2.6.18.

Top of Page