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: fr�d�ric BESSON <fbesson AT irisa.fr>
  • To: "Ryan J Wisnesky." <ryan AT eecs.harvard.edu>
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club]automatically entering proof mode and inlining proofs
  • Date: Tue, 27 Feb 2007 11:54:46 +0100
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

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