Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Trying examples in formalized programming languages

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Trying examples in formalized programming languages


Chronological Thread 
  • From: Greg Morrisett <morrisett AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Trying examples in formalized programming languages
  • Date: Fri, 30 Sep 2016 08:51:02 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=morrisett AT gmail.com; spf=Pass smtp.mailfrom=morrisett AT gmail.com; spf=None smtp.helo=postmaster AT mail-ua0-f182.google.com
  • Ironport-phdr: 9a23:4CED+R/f4C8/Lf9uRHKM819IXTAuvvDOBiVQ1KB90OscTK2v8tzYMVDF4r011RmSDN+dsasP17qempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47AblHf6ke/8SQVUk2mc1EkfKKvQ8WO34ye7KObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicuVSwn50dxrIx06vrpT4wJk2+CNJ/vkl6sRoUKPgfq1+Q6YLIi4hNjUa/sDk/TzEVxGO/XYATi1Clx1SGQne4Q3mdpj0uyr+8OF63X/JboXNUbkoVGH6vO9QQxjyhXJfOg==

Personally, I prefer to write a step function (as opposed to inductive definition) precisely because I can use it for testing.  Even if you have a non-deterministic language, you can usually model this as a function from terms to finite sets of terms.  
There are other advantages:  For instance, pattern matching in a function tells you if you've forgotten a case for a term, whereas it's all too easy to leave out a case in an inductive definition.  That is, you get input coverage this way.  Also, when you truly have a (partial) function, you have to re-establish this fact when you use an inductive definition, but it falls out for free when you define the function.    

Of course, if it's too painful to use the step function for reasoning directly, you can relate it to an inductive definition.  But I rarely find that I need to do that, once I've defined the right set of tactics.  

-Greg

On Fri, Sep 30, 2016 at 5:51 AM, Klaus Ostermann <klaus.ostermann AT uni-tuebingen.de> wrote:
Never mind. I just found out that the "Software Foundations" contains
a section on just this problem. Sorry for the noise on the mailing list.


Am 30/09/16 um 09:39 schrieb Klaus Ostermann:
> I have formalized a small programming language in the style proposed by
> the "Software Foundations" book.
>
> I have defined an inductive type "tm" of Terms and
> an inductive type
>
> Inductive step : tm -> tm -> Prop
>
> to formalize the small-step reduction semantics of the language:
>
> I'd like to test the definitions with some examples. Let's say I have an
> example term t1. I want to find the term t2 such that "step t1 t2" holds.
>
> What is the best way to formalize such tests? Should one use an
> existential type, like
>
> exists t2, step t1 t2
>
> If so, how can one extract the witness t2 from such a theorem for
> inspection?
>
> Is there a way to automate the proof search such that the derivation does
> not have to be built by hand for every example?
>
> Klaus
>





Archive powered by MHonArc 2.6.18.

Top of Page