coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Peter E Schmidt-Nielsen <snp AT mit.edu>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] run recursive programs in coq
- Date: Thu, 1 Nov 2018 12:09:33 -0400 (EDT)
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=snp AT mit.edu; spf=Pass smtp.mailfrom=snp AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-4.mit.edu
- Ironport-phdr: 9a23:CajnYx9+LhC+gv9uRHKM819IXTAuvvDOBiVQ1KB41+kcTK2v8tzYMVDF4r011RmVBdqds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+55/ebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRhHohikZKjA28mLZisJ+g61UvB2svBl/z5LObYyPKPZzZKHQcNUHTmRBRMZRUClBD5umYYQRE+oOI/xYpJTyqVATsBWxGQmsBObuyjBVmn/6xLU00+U/HgHCxwwvAdQOu2nTodXuMqcSSfu4zKzJzTXfdf9Zxyry6JXRfx0nvPqCU7Vwcc/LxkkuEQPIllqQqY35PzOVy+QCqHKX4PZnVeKqjWMstgJ/oiC3y8sxiYTFnIYYxkra+Sh52oo5ON21RFZmbdOnCpddszuWOop5T884XW1luSA3waAct5GhZigF0pEnygbfa/OZd4iI5QruW/uUITZ5nX5lfaiwhxe28Ui71OLzStC40E1WoSVflNnMsG4C1wbK5sWIUPd9+0ah2SqV2w/N9+5EPFg4lavdK5E/3r49jocfvEfZEiLygkn6kq+bel859uWo8+jnZ6/ppp6YN496kAH+NaEul9SkAeQ+KggDRG2b+eWg1LH540L2XahKguUskqbFqJDaOdgbpqmhDgBJ1YYj8g+zACui0NQFhnYKN0lFeRKCj4jxIV7COvH4DfGlg1Stijhn3f7GPqeySqnKe3PEifLqeat3w09a0gs6i95FtLxODbRUGP/vV1W5mZTjBR88MgCohsDmBdFm24VWDXmJGoecMb+UvFOVsLF8a9KQbZMY7W6uY8Mu4OTj2CdgyA0tOJKx1J5SU0iWW/FvIkGXe33p04UEEHtMswYjHrWz1A+yFAVLbnP3ZJoSoykhAdP0CIbfAI2hne7ZhXrpLthtfmlDT2u0PzLoeoGDAK5eZCeAZ8pokzgfWLPkUIQo0xejrkqmjb9mMqzZ9jBK7Z8=
Using a fuel quantity seems like a reasonable solution whenever you can easily produce a default value when you run out of fuel. Here's an example of performing this transformation generically on a recursive function, using a nat to track the fuel:
https://gist.github.com/petersn/361c40b3394a3ad9721b738ac61d48b1
Of course, if we switched to using a binary number for the fuel then we could trivially just pass in 2^300 for the fuel and get a definition which won't run out of fuel before the heat death of the universe.
However, some library theorems (N.lt_pred_l and N.lt_wf_0) are opaque, blocking the binary version in the above gist from computing. I'm wondering if anyone more experienced here knows if there're some transparent versions elsewhere I don't know about, or if I'm missing something silly?
-snp
On Thu, 1 Nov 2018, Klaus Ostermann wrote:
It's maybe not particularly elegant or sophisticated, but what about
just adding "fuel" as an additional argument
and initializing with a sufficient amout of fuel?
Klaus
Am 01.11.18 um 12:21 schrieb Thorsten Altenkirch:
Is there a way to run possibly non-terminating programs in the coq
type checker. In Agda you can just switch off the termination checker.
I think this is useful if you want to use something whose termination
you haven't yet proven but want to exploit reduction.
Hence it is not enough to add the assumption that it terminates as an
axiom because this won't reduce.
Thorsten
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.
Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.
- [Coq-Club] run recursive programs in coq, Thorsten Altenkirch, 11/01/2018
- <Possible follow-up(s)>
- [Coq-Club] run recursive programs in coq, Thorsten Altenkirch, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Klaus Ostermann, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Peter E Schmidt-Nielsen, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Bas Spitters, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Li-yao Xia, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Daniel Schepler, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Peter E Schmidt-Nielsen, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Gaëtan Gilbert, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Jean-Christophe Léchenet, 11/09/2018
- Re: [Coq-Club] run recursive programs in coq, Peter E Schmidt-Nielsen, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Daniel Schepler, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Peter E Schmidt-Nielsen, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Anton Trunov, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Gaëtan Gilbert, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Jan Bessai, 11/01/2018
- Re: [Coq-Club] run recursive programs in coq, Klaus Ostermann, 11/01/2018
Archive powered by MHonArc 2.6.18.