Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Dependant Match Example

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Dependant Match Example


Chronological Thread 
  • From: Adam Chlipala <adamc AT csail.mit.edu>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Dependant Match Example
  • Date: Tue, 21 Jun 2016 08:59:39 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=adamc AT csail.mit.edu; spf=Pass smtp.mailfrom=adamc AT csail.mit.edu; spf=None smtp.helo=postmaster AT outgoing-tmp.csail.mit.edu
  • Ironport-phdr: 9a23:hFkqyhBrR2oEzadP/e1nUyQJP3N1i/DPJgcQr6AfoPdwSP74ocbcNUDSrc9gkEXOFd2CrakV06yO6+u6AiQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JXvkbjqsMeIKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46FppIZ8VvDxeL19RrhFBhwnNXo07Yvlr0rtVwyKs1IQW2BeuRpMAhDM6BiyCp79uy7xnuFm0Siee8j3UfY5VSn0vPQjcwPhlCpSb21xy2rQkMEl1K8=

Have you read the chapters of Certified Programming with Dependent Types <http://adam.chlipala.net/cpdt/> about programming with dependent types?  I have a feeling that you'll find all or most of your answers there.

On 06/21/2016 08:50 AM, Mwyann wrote:
Dear Michael,
Thanks a lot for your fast and complete answer. Indeed, I think I’m still confused with types and values. What I’m really looking after is to match the type of a value, for example we would like to make this work as you would imagine:
Inductive some_type := A | B | C.
Definition type (t:Type): nat := match t with | bool => 0 | nat => 1 (* error: redundant *) | some_type => 2 | _ => 99 (* any other type *) end.
Compute type 1. (* would return “1” as “nat” *)
I don’t know what mechanism we can use to determine the type of a term (apart from the internal Coq’s type checking).
Do you know if any lectures on the subject exists somewhere? (especially courses that contains examples, which help learning efficiently).
Best regards,
Yann

2016-06-21 10:48 GMT+02:00 Soegtrop, Michael <michael.soegtrop AT intel.com>:

Dear Yann,

 

 [...]





Archive powered by MHonArc 2.6.18.

Top of Page