Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Qed opacity and Coq standard library

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Qed opacity and Coq standard library


Chronological Thread 
  • From: Pierre Courtieu <pierre.courtieu AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Qed opacity and Coq standard library
  • Date: Fri, 23 Apr 2021 11:15:16 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=pierre.courtieu AT gmail.com; spf=Pass smtp.mailfrom=pierre.courtieu AT gmail.com; spf=None smtp.helo=postmaster AT mail-io1-f54.google.com
  • Ironport-hdrordr: A9a23:A7/1W6/15l7MSqTouNNuk+GIdb1zdoIgy1knxilNYDZSddGVkN3rufwd2wP9hjp5YgBFpfmrPq6cTXTAsaNk+IV5B8bBYCDKsHalRbsC0aLM2DvlcheVysd80uNaf7F6GJnMCzFB4vrSxCmdP5IezMKc8Kau7N2urEtFaQ1xcalv40NYJ2+gcnFefwVNCZonGJf03KMuzAaIQngZYt+2AXMIRYH4y+Hjro7sYhINGncchjWmsDXA0tPHOind+h8fVj9VqI1SlFTtokjB/aO9u/+gjj/wvlWjiah+qZ/a09NGQOOIgsZ9EESUti+YILhAH5ufoXQboOSz5E0wnMPRpgo7Vv4Dk0/5Y2CvrRPhnwnm3To+gkWSrmOlvQ==
  • Ironport-phdr: A9a23:udsU7h8K9NnJc/9uWVS7ngc9DhMPi/DPJgcQr6AfoPdwSMyLwZ3uMQTl6Ol3ixeRBMOHsqMC0bOM+Pm5EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe5bL9oMhm6sBvdusYLjYd/N6081gbHrnxUdupM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02QaRXAzo6PW814tbrtQTYQguU+nQcSGQWnQFWDAXD8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KzEWTYUYU6E9LzE

Hi
Yes choosing good definitions is where a lot of coq expertise lies.

Be careful though True and False (with capitals) are properties, not booleans. For instance don’t expect to be able to do match x with True=>...

I am curious what others think. I would advise a novice not to use this first definition but instead its boolean version + a proof that it returns true iff the second definition holds.

The second could also be replaced by something like:
Inductive isempty l : Prop :=
Cisempty: isempty nil.
That can be used by tactics like inversion or destruct. 
Best 
Pierre

Le ven. 23 avr. 2021 à 09:02, Jerome Hugues <jhugues AT andrew.cmu.edu> a écrit :

Hi

 

Thanks for the links,

 

I created issue https://github.com/coq/coq/issues/14149 about NoDup_dec being Qed instead of Defined.

 

About my own problem, I finally found a work-around that puzzles me as a Coq novice: I need to check that a list is empty as part of some more complex verifications on my data structures, nothing fancy but …

 

this definition allows me to do nice evaluation using Compute, you will note it matches an equivalent bool version. It is not that elegant but works

 

  Definition Is_Empty (q : queue) : Prop :=

   match q with

    | nil => True

    | _ => False

    end.

 

The more direct

 

                Definition Is_Empty (q : queue) : Prop := q = empty.  

 

where empty is defined as nil, returns an _expression_ of 400+ lines. Coding style definitely matters to help the evaluation process I presume, a topic for further readings on my end.

 

Regards,

 

 

From: <coq-club-request AT inria.fr> on behalf of Xavier Leroy <xavier.leroy AT college-de-france.fr>
Reply-To: "coq-club AT inria.fr" <coq-club AT inria.fr>
Date: Wednesday, April 21, 2021 at 1:14 PM
To: "coq-club AT inria.fr" <coq-club AT inria.fr>
Subject: Re: [Coq-Club] Qed opacity and Coq standard library

 

On Tue, Apr 20, 2021 at 3:54 PM Jerome Hugues <jhugues AT andrew.cmu.edu> wrote:

Hi,

 

At some point in my project, I use Defined rather than Qed to have transparent proofs and use the Compute mechanisms to evaluate some statements. This works nicely for my own theorems, but I am stuck when this involves theorems provided by the Coq standard library, NoDup_dec in my case, but ultimately this might extend to more situations.

 

My rule of thumb is that every definition that is in Prop should be Qed and every definition that is in Type should be Defined.  Most of the time, there's enough of a phase distinction for this heuristic to work well.  See http://gallium.inria.fr/blog/coq-eval/ for more examples, including one that used to violate the phase distinction but was fixed since.

 

In this respect, NoDup_dec in the Coq standard library is a bug, and so is incl_decl in the same file, while In_dec correctly uses Defined.  Why don't you file a bug report at https://github.com/coq/coq/issues ?

 

Regards,

 

- Xavier Leroy

 

 

One quick and dirty work-around is to copy/paste the code, change Qed into Defined and voila! But this is not satisfactory.

 

I could find some blog posts like this one https://plv.csail.mit.edu/blog/computing-with-opaque-proofs.html by Clément Pit-Claudel on this topic, but again it seems this imposes some rework.

 

I understand Qed and Defined are different for a reason, I am just curious whether there is a systematic way to change Qed into Defined on a case by case basis, or if we are forced to this type of modifications.

 

Is there some suggested readings on this topic?

 

Thanks




Archive powered by MHonArc 2.6.19+.

Top of Page