Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Module types with definitions which refer to parameters

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Module types with definitions which refer to parameters


chronological Thread 
  • From: Brian Aydemir <baydemir AT cis.upenn.edu>
  • To: Elnatan Reisner <elnatan AT cs.umd.edu>
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club] Module types with definitions which refer to parameters
  • Date: Mon, 7 Jul 2008 10:50:17 -0400
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

On Jul 6, 2008, at 01:49, Elnatan Reisner wrote:

If I want to define a module type with parameters and definitions, where the definitions depend on the parameters, is there a way to do this without having to copy and paste the definitions in modules which instantiate the module type? And beyond that, can I prove things about a module type (without instantiating the parameters), and then refer to those lemmas within a module where I *have* instantiated the parameters?

I don't know about copying definitions, but here's one idea for "proving things about a module type": write a functor that abstracts over the module type and provides all the facts that you want. The pattern is similar to what's found in the (Coq 8.1pl3) FSets library. I haven't run the following code sketch through Coq, but hopefully it gives a flavor of the idea.

<<
Require Import List.

Module Type MY_SIG.
  Parameter aList : list nat.
  Inductive sublist : list nat -> Prop :=
     | sl : forall L n, In n L -> In n aList -> sublist L.
End MY_SIG.

Module MY_SIG_Facts (Import X : MY_SIG).
  (* Prove stuff any MY_SIG here. *)
End MY_SIG_Facts.

(* Instantiate MY_SIG_Facts as needed for each instance of MY_SIG. *)
>>

Cheers,
Brian





Archive powered by MhonArc 2.6.16.

Top of Page