Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] How do I convince Coq that my recursion is guarded?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] How do I convince Coq that my recursion is guarded?


Chronological Thread 
  • From: Li-yao Xia <lysxia AT gmail.com>
  • To: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] How do I convince Coq that my recursion is guarded?
  • Date: Sat, 8 Feb 2020 11:59:28 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=lysxia AT gmail.com; spf=Pass smtp.mailfrom=lysxia AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk1-f173.google.com
  • Ironport-phdr: 9a23:SzcJsRLUpXeLXCMmlNmcpTZWNBhigK39O0sv0rFitYgeK/vxwZ3uMQTl6Ol3ixeRBMOHsq4C1rWd4v+oGTRZp8rY6zZaKN0EfiRGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJ6KevvB4Hdkdm82fys9J3PeQVIgye2ba9vIBmsogjdq8YbjZFiJ6szxRfEpnlFcPlSyW90OF6fhRnx6tq+8ZJ57yhcp/ct/NNcXKvneKg1UaZWByk8PWAv483ruxjDTQ+R6XYZT24bjBlGDRXb4R/jRpv+vTf0ueR72CmBIM35Vqs0Vii476dqUxDnliEKPCMk/W7Ni8xwiKVboA+9pxF63oXZbp2ZOOZ4c6jAZt4RW3ZPUdhNWCxAGoO8bpUAD+wdPeZDsoLxo0ICoQaiCQWwAe/izCJDiH3r0q0gy+kvDB/I3AIgEdwNvnrbotr6O6UOXu6616TI0TfOYulK1Tvh5oXFcBYsquyMU7JqdsrRzFEiGQXEjlmJqY3qJTSV3fkMvGia9eVrSOWii2onqgFqrTmvx90jh5LGhoIQ0F/E9CF5zJwpKt2/TU52eNipG4ZTuSGCL4Z6XN8uTmVytCs5yrAKo4C3cDYXxJg92hLSafKKf5CW7h7/VeudOyp0iGxldb6lhhu+71KsxvP8W8SyzV1EtDBKksPWuXAIzxHT6taISv96/kq53DaAzQHT6uVdLUAqlqrXNoctwrAtmpcRv0nPBCD2mELxjK+ZckUr5PKk5PjgYrXjvpOcNol0hR/iMqk2hMCzHeA1PhINUmWb4+iwyqPv8VDjTLlXjPA7nLHVsJXAKsQaoq65DRVV0oEm6xunCzen0M8YnHYGLF1fYx+HgI3pNEvPIPD8F/uwn1OskDJzy/DcIrLhGonNLmTEkLr5Ybl97FdcxBMvwtBb+pJbEaoMIOnzW0/0rNzXFAU1Mw2yw+b9CdVyzJkSWWyVAvzRDKSHmFCO5/kvJOzET48cpCr6M/Ep5+/nnDdtkFAbfLKp2p4/Y3W5WP1tZUSfNynCmNAEREML+xs3S6TaiVTKBTpCfGazVooz4zg6DMStCoKVFdPlu6CIwCruRs4eXWtBEF3ZVC6wL9zZCcdJUzqbJ4paqhJBVbWlTNV/hxSntQu/1bk+a+SNpXZeupXk29x4oebUkENqrG0mP4Gmy2iIClpMsCYNTj4y0rp4pBUkmFiG2Kl8xfdfEI4Kvq8bYkIBLZfZitdCJZXqQAuYJ4WGTV+nRpOtBjRjFt8=

Hi Agnishom,

> but that does not seem to work. The definition intuitively seems to make
> sense. Also, if we unroll the definition of MonJustBefore, it appears
> (to me) that the recursive call is guarded within the mNext constructor
> in MonDelayWith. How do I make Coq believe this?

mNext is not a constructor, it's a projection (a destructor). That's why this definition is not guarded. It is productive, but the guardedness checker is too restrictive for one to encode a proof of that fact. You have to rewrite the definition altogether to make it guarded.

Your second attempt is basically correct. It's a small mistake: you wrote a period after the type instead of ":=". That's why you then enter proof mode. That period separates the CoFixpoint command from the following record "{| ... |}", which seems to get recognized as a tactic that does nothing.

(* You wrote *)
CoFixpoint MonSometime {A: Type} (mon: Monitor A) : Monitor A.
(* but it should be *)
CoFixpoint MonSometime {A: Type} (mon: Monitor A) : Monitor A :=

Your initial attempt is actually a common example of the limitations of the "guardedness" criterion. Other implementations of coinductive types based one sized types or clocked type theory make it possible to formalize the first definition directly.

Regards,
Li-yao



Archive powered by MHonArc 2.6.18.

Top of Page