Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Type classes and proof automation

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Type classes and proof automation


chronological Thread 
  • From: Matthieu Sozeau <mattam AT mattam.org>
  • To: Edsko de Vries <edskodevries AT gmail.com>
  • Cc: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Type classes and proof automation
  • Date: Tue, 10 Jan 2012 17:34:45 +0100


Le 10 janv. 2012 à 16:26, Edsko de Vries a écrit :

... in particular, I can't do something like

Fixpoint permute_term : Permute Term

because then now the fixpoint does not have any arguments; similar attempts using Program Fixpoint don't work either. Of course, I can define this like

Instance permute_term : Permute Term := fix ...

but still I cannot use permute in the body (it complains that no instance of Permute Term is known). The work around is the same as for the inductive definitions, I now have whole slews of lemmas of the form

permute p (pair t u) = pair (permute p t) (permute p u)

but it's tedious to write these and they make the proof script rather large.

Hi Edsko,

  the only way I see is to add a local alias for the instance, but I'm not sure it 
makes things more workable in the end:

(* Example, makes no computational sense *)

Definition Permutation T := (T -> T).

Class Permute A T := 
  permute : Permutation A -> T -> T.

Fixpoint permute_list {A} (p : Permutation A) (l : list A) : list A := 
  let permute_inst : Permute A (list A) := permute_list in
    match l with
      | nil => nil
      | cons a l => cons (p a) (permute p l)
    end.

Instance plist A : Permute A (list A) := permute_list.

-- Matthieu



Archive powered by MhonArc 2.6.16.

Top of Page