coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Théo Zimmermann <theo.zimmi AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Reading material on "Program Fixpoint"
- Date: Mon, 22 Jan 2018 13:21:09 +0000
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=theo.zimmi AT gmail.com; spf=Pass smtp.mailfrom=theo.zimmi AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk0-f44.google.com
- Ironport-phdr: 9a23:y1lwTB0C3OFSb6UFsmDT+DRfVm0co7zxezQtwd8Zse0WKPad9pjvdHbS+e9qxAeQG9mDsrQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPfglEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLnhykHODw5/m/ZicJ+kbxVrw66qhNl34LZepuYOOZicq7fe94RWGpPXtxWVyxEGo6ycYsPCPAGPelArIb9pl4OrR6gCgm2AePg0DlIhnnr1qA9z+QhER/J3As6E9MPsXTUqdD1NKYJXOC6yanH1zTDb/dM1Tjh74jIdwksrPeRVrxzacrc0VcjGx/Bg1mKqoHoPymZ2voQv2WV9eZtWu2ihmg6oA9ruDev3N0jiozRi4IV1F/E8SJ5zZ4wJdKiSU57ZceoEIVTty2GLod2TMwvTm5ytCY1zb0GvpG7fCwUx5g92xHfbPmHf5CJ4hLlSumRPS91iGx5dL+7nRq/8kitxvfiWsWp3ltGtCVIn9bUunAIzRPT68yHSvVn/kem3DaCzxzT6uFaLkAzj6baKp8hwrs1lpoSqknDESr2l1/3jK+SbEkr5u+o6+H/brX8upCcL5N0ih35Mqk2hsO/Bv04PhESUGif5OSzz6bu/Vb5QbVPlv05iLPVsJHcJcQBp662GRVZ0og560X3MzDz29MB2HIDMVhteRSdjoGvNUudDur/CKKDg9WrpwVqwvXLJLjoBJOFemTDnbCnb7d47k90xw86zNQZ7JVRXOJSaMnvU1P84YSLRiQyNBa5lr6+WYdNk7gGUGfKOZe3dabbsFuG/OUqerDea4ocuTK7IP8gtae30S0J3GQFdKzs5qM5LWiiF60/cUqcaHvoxNwGFDVS51dsfKnRkFSHFAVrSTOyUqY7vGxpDYunCcLdRdjojuDdmii8GZJSayZNDVXeSXo=
The following piece of code accomplishes the same thing as my example with tactics, using Program:
Require Program.Tactics.
Unset Transparent Obligations.
Program Definition positive : { n : nat | n > 0 } := exist _ 1 _.
(* Solving obligations automatically... *)
Compute proj1_sig positive. (* 1 *)
About positive. (* ... positive is transparent *)
Print positive.
(* positive =
exist (fun n : nat => n > 0) 1 positive_obligation_1
: {n : nat | n > 0} *)
About positive_obligation_1. (* ... positive_obligation_1 is opaque *)
Require Program.Tactics.
Unset Transparent Obligations.
Program Definition positive : { n : nat | n > 0 } := exist _ 1 _.
(* Solving obligations automatically... *)
Compute proj1_sig positive. (* 1 *)
About positive. (* ... positive is transparent *)
Print positive.
(* positive =
exist (fun n : nat => n > 0) 1 positive_obligation_1
: {n : nat | n > 0} *)
About positive_obligation_1. (* ... positive_obligation_1 is opaque *)
Le lun. 22 janv. 2018 à 11:18, Siddharth Bhat <siddu.druid AT gmail.com> a écrit :
That is interesting information, thank you.
When one uses Program, what happens to the proof obligations one provides? Do those "leak out" as well? (The impression I got from some cursory use is that it does not). If not, how does that work?
I left trying to dependent type my code for a while now, because I don't deally understand how to control proof terms with dependent types.
Cheers
SiddharthOn Mon 22 Jan, 2018, 15:03 Théo Zimmermann, <theo.zimmi AT gmail.com> wrote:That being said, I'm not aware of any clear advantage of this method over using Program.There are on-going debates whether programming definitions using tactics is OK or not but what is agreed on is that building transparent terms (definitions) using automated tactics is not a good idea (you should have a clear idea of what the tactic is doing).When you want to use an automated tactic to prove a proof obligation as part of a definition, you may encapsulate it into "abstract" to make this part of the term opaque :
Require Import Omega.
Definition positive : { n : nat | n > 0 }.
exists 1.
abstract omega.
Defined.
Compute proj1_sig positive. (* 1 *)
About positive. (* ... positive is transparent *)Print positive.(* positive =positive_subproof is opaque *)
exist (fun n : nat => n > 0) 1 positive_subproof
: {n : nat | n > 0} *)
About positive_subproof.
(* positive_subproof : 1 > 0ThéoLe sam. 20 janv. 2018 à 14:27, Siddharth Bhat <siddu.druid AT gmail.com> a écrit :SiddharthThanks,3. Use Program to delay obligations, so write "normal" code and fulfil obligations later.2. Directly "implement" stuff with dependent types (like Idris)1. Use tactics to fill in Definition blocks.I've been trying to learn how to write dependently typed code in Coq.As far as I can tell, there are three styles:The problem I face with #1 is that _proving_ things about Definitions encoded this way is impossible for me. For example, if I use omega in some Definition D, I cannot prove anything about D, because on unfolding D, I see the mess that is the omega implementation, I assume.So, for proving things about definitions, #1 is out.#2 is.. challenging, and as a newbie, I find that I often do not know how to express the things I want to say, or do not know how to convince Coq that certain things are impossible (eg: safe indexing into a vector)So, for now, #3 seems easiest.I would like references on the third style of implementing things. Could someone please recommend reading material?
--Sending this from my phone, please excuse any typos!--Sending this from my phone, please excuse any typos!
- [Coq-Club] Reading material on "Program Fixpoint", Siddharth Bhat, 01/20/2018
- Re: [Coq-Club] Reading material on "Program Fixpoint", Merlin Göttlinger, 01/20/2018
- Re: [Coq-Club] Reading material on "Program Fixpoint", Théo Zimmermann, 01/22/2018
- Re: [Coq-Club] Reading material on "Program Fixpoint", Siddharth Bhat, 01/22/2018
- Re: [Coq-Club] Reading material on "Program Fixpoint", Théo Zimmermann, 01/22/2018
- Re: [Coq-Club] Reading material on "Program Fixpoint", Siddharth Bhat, 01/22/2018
Archive powered by MHonArc 2.6.18.