coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Abhishek Anand <abhishek.anand.iitg AT gmail.com>
- To: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Question about the formal definition of the guard condition
- Date: Wed, 11 Jan 2017 13:34:15 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=abhishek.anand.iitg AT gmail.com; spf=Pass smtp.mailfrom=abhishek.anand.iitg AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt0-f176.google.com
- Ironport-phdr: 9a23:xIhkXxYP314QYLc14Eg/zzf/LSx+4OfEezUN459isYplN5qZpsW+bnLW6fgltlLVR4KTs6sC0LuK9fqwEjVZut7B6ClEK8McEUddyI0/pE8JPo2sMQXDNvnkbig3ToxpdWRO2DWFC3VTA9v0fFbIo3e/vnY4ExT7MhdpdKyuQtaBx5f/6+fn8JrKJg5MmTD1Nbh1NVC9qRjbnsgQm4prbKgrnEjnuHxNLs1cxWJzJV+Q1z/678G8tMpq+SRRoPIs9IhJV6z8c+I5TKBXJDsjOmExosbssE+QHkO0+nIAXzBOwVJzCA/f4USiUw==
For a fix, can I ask Coq to give me the version of its body for which the guard conditions were checked?
Is it the same as doing "Eval compute in (fix ...)"?
I understand that this version may be excessively bloated (beyond the limits of human understanding) due to all the unfoldings.
Instead of blindly normalizing the body of a fixpoint, can Coq proceed lazily, only normalizing subterms of the body where the guard condition fails?
Suppose that Coq stored only the versions (of bodies of fix) on which guard checks were done, and discarded whatever the user wrote.
Would Coq then be strongly normalizing?
Another useful meta-theoretic property of interest is that all typing judgments are closed under definitional equality.
Thus, it seems that Coq's kernel (not what user writes) cannot accept
"fix F (n : nat) := 0" and reject "fix F (n : nat) := let x := F n in 0", as long as reductions are allowed inside bodies of fixpoints.
Do we also need to ban reductions inside bodies of fixpoints?
Thanks,
-- Abhishek
http://www.cs.cornell.edu/~aa755/On Mon, Dec 12, 2016 at 4:56 PM, Gabriel Scherer <gabriel.scherer AT gmail.com> wrote:
My understanding of what happens is that it breaks *strong*
normalization, in the sense that there exist reduction strategies that
loop, but it preserves *weak* normalization, namely the fact that
there exists a reduction path to a value -- and thus consistency.
Indeed, in the checking rule
Gamma, F : T |- M : T
M -beta*-> M'
M' \in Guard^F_k
-------------------------
Gamma |- (Fix F_k : T := M) : T
there *exists* a reduction path M -> M', and my understanding is that
reusing this specific reduction path each time you unfold the fixpoint
is a normalizing strategy.
Indeed in this specific example we have:
Coq < Fixpoint F (n : nat) := let x := F n in 0.
F is defined
F is recursively defined (decreasing on 1st argument)
Coq < Eval cbv in (F 1).
Stack overflow.
Coq < Eval cbn in (F 1).
= 0
: nat
On Mon, Dec 12, 2016 at 4:48 PM, William J. Bowman
<wjb AT williamjbowman.com> wrote:
> On Mon, Dec 12, 2016 at 04:44:05PM -0500, roux cody wrote:
>> I think the idea is that while this can lead to non-termination during the
>> checking of the guard condition, if this succeeds then the resulting
>> program is well-guarded,
> Is the example program non-terminating at run-time or when checking the guard condition? To me, it
> seems it would terminate when checking the guard condition, but fail to terminate at run-time.
> For reference, the example I'm referring to is:
> Fixpoint F n := let x = (F n) in 0.
>
> Since let x = (F n) in 0 reduces to 0, and 0 is well-guarded, so is the Fixpoint (according to the
> algorithm described in the slides). But F will not terminate at run-time.
>
> I agree that it is less concerning since I cannot see how it would allow deriving contradiction.
>
> --
> William J. Bowman
- Re: [Coq-Club] Question about the formal definition of the guard condition, Abhishek Anand, 01/11/2017
- Re: [Coq-Club] Question about the formal definition of the guard condition, Bruno Barras, 01/11/2017
Archive powered by MHonArc 2.6.18.