Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Fixpoint "decreasing on 1st argument" notification

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Fixpoint "decreasing on 1st argument" notification


Chronological Thread 
  • From: Morrisett <morrisett AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Fixpoint "decreasing on 1st argument" notification
  • Date: Thu, 8 Jun 2017 09:21:03 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=morrisett AT gmail.com; spf=Pass smtp.mailfrom=morrisett AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt0-f175.google.com
  • Ironport-phdr: 9a23:lO4C4hYPGD0nRVNbiOSA2zT/LSx+4OfEezUN459isYplN5qZoM2zbnLW6fgltlLVR4KTs6sC0LuJ9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQtFiT6/bL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjA57G7ZhcN/gqxGrhyiqRxwwZDaboaOOfVkfK7deMkXRWpdUstTUSFKH4Oyb5EID+oEJetWqI79p0EUrRu/HgmjGv/vyiNVjXLx2K061P4hERvH3Aw7Ad0OrGjUoc76NKcXS++1za3IwS/fYPNR3Dfw8Y7FeQ0ir/GURb98b9bdxE01Gw7Gjlics5LpMy6U2+gXrmSW7eptWfqyh2Mmqgx9uCWjy8UxhoXTho8Yy0rI+Tt3zYopI9CzVVR1bsS+EJRKsiGXL4t2Td0mQ2FvoCs6z6cJuZ+/fCQT0ZQn2wLTZ+WJc4SV4B/uVPydITh/hHJid7K/gwi9/VK8xe37U8m4yFdKrixbndnQrn0ByQDf58ydRvZ+/kqtwyiD2x3S5+1ePEw5l6rWJ4YkwrEql5oTtUrDHjXxmEXzlKKWc0Ik+vKy6+TmebXpuIOcN5NvhwHxN6QhgM2/AeAiPgcSWGib/Pyw1Kf/8k3hXLVKkvo2n7HFv5DdPMQXv7K2AwtI0ok48Bu/FDen0NEAnXYdNl5FeRSHj5LoO17UOvz4A+2/0ByQl2JgwOmDNbn8CL3MKGLCmfHvZ+VT8UlZnS8018pe/J9IFvlVJfXpQE7qucDEJhA8Og2whe3gDYMuhcslRWuTD/rBY+vpuliS67d3Lg==

But it breaks extraction to CBV languages such as Ocaml. Consider this more insidious example:

Fixpoint f(x:nat):nat:= 
  let x := f x in 0.

This extracts to:

letrec f x = let z = f x in 0

Which diverges. 

-Greg

On Jun 8, 2017, at 8:56 AM, Beta Ziliani <beta AT mpi-sws.org> wrote:



On Thu, Jun 8, 2017 at 9:52 AM, <raffaello.giulietti AT supsi.ch> wrote:
I agree on both your observation about evaluation strategies as well as
your (and my) surprise that Coq tries to be smart.

I think Coq should reject the definition.


Greetings
Raffaello


The problem is that it should then reject many good definitions (take division, for instance).
 

On 08/06/17 14:41, Gaetan Gilbert wrote:
> Some evaluation strategies terminate. eg
>
>
> Fixpoint z (n: nat): nat := 0 * z n.
>
> Lemma foo n : z n = 0.
> unfold z. cbn.
> (* (fix z (n0 : nat) : nat := 0) n = 0 *)
>
>
> I don't know why Coq tries to be smart with this though.
>
> Gaëtan Gilbert
>
> On 08/06/2017 14:38, raffaello.giulietti AT supsi.ch wrote:
>> Hello,
>>
>> consider the following z function
>>
>> Fixpoint z (n: nat): nat := 0 * z n.
>>
>> which Coq accepts with the usual notification "decreasing on 1st
>> argument".
>>
>> Well, I don't see that this recursive definition is "decreasing on 1st
>> argument". Indeed, an invocation results in an infinite recursion, as
>> witnessed by the Out of memory message:
>>
>> Compute z 0.
>> Out of memory.
>>
>> I'd expect Coq to reject the definition (even if the smallest
>> mathematical fixpoint is the unary function 0).
>>
>> What is really happening? Any clarification would help.
>>
>> Greetings
>> Raffaello
>





Archive powered by MHonArc 2.6.18.

Top of Page