Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club]automatically entering proof mode and inlining proofs

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club]automatically entering proof mode and inlining proofs


chronological Thread 
  • From: "Ryan J. Wisnesky" <ryan AT eecs.harvard.edu>
  • To: fr�d�ric BESSON <fbesson AT irisa.fr>
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club]automatically entering proof mode and inlining proofs
  • Date: Tue, 27 Feb 2007 16:55:43 -0500
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

The Program tactic commands seem to be exactly what we want.  From the
reference manual for 8.1:

"The goal of Program is to program as in a regular functional
programming language whilst using as rich a specification as desired and
proving that the code meets the specification using the whole Coq proof
apparatus."

Perfect.  Thanks to everyone for their help.  

Cheers,
Ryan

On Tue, 2007-02-27 at 11:54 +0100, frédéric BESSON wrote:
> Hello,
> 
> As already shown by Laurent Thery, refine does the job.
> Personnaly, I have just discovered Program and like it very much!
> I cannot resist; here is the script.
> 
> (Note that Program does not require a dependant match to accept hd -  
> very nice.)
> 
> Program Definition hd (A:Set) (l : list A) : forall (H : (length l >  
> 0)%nat), A :=
>    fun H =>
>      match l with
>        | nil    => _ (* Here a proof that it cannot happen *)
>        | a :: _ =>  a
>      end.
> Next Obligation.
> apply False_rec.
> compute in H ; omega.
> Qed.
> 
> Program Definition head (l: list nat) : option nat :=
> if zerop (length l) then None else
>    Some (hd nat l _).
> (* Trivial proof obligation discharged by auto *)
> 
> --
> Frédéric Besson





Archive powered by MhonArc 2.6.16.

Top of Page