Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Program Fixpoint and Nested fix expressions

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Program Fixpoint and Nested fix expressions


Chronological Thread 
  • From: Jim Fehrle <jim.fehrle AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Program Fixpoint and Nested fix expressions
  • Date: Mon, 14 Sep 2020 12:41:13 -0700
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jim.fehrle AT gmail.com; spf=Pass smtp.mailfrom=jim.fehrle AT gmail.com; spf=None smtp.helo=postmaster AT mail-il1-f172.google.com
  • Ironport-phdr: 9a23:VtT7jxK0iLy5RYgxsNmcpTZWNBhigK39O0sv0rFitYgeKPvxwZ3uMQTl6Ol3ixeRBMOHsqwC0rCK+PC5EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe8bL9oMRm6swrcusYVjId/N6081gbHrnxUdupM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02QaRXAzo6PW814tbrtQTYQguU+nQcSGQWnQFWDAXD8Rr3Q43+sir+tup6xSmaIcj7Rq06VDi+86tmTgLjhSEaPDA77W7XkNR9g61VoB2jpxJxzY3abpyLOvViZa7SZ88WSHBbU8pNSyBMAIWxZJYPAeobOuZYqpHwqV8PrRu7GAKiBP3gyj9Shn/yw6IxzuMsEQPH3AwlBd4OvmrbrNXvNKcWT++416bIzTDZYPNX3Tfx8pTHchckofyVW797bMXex1U1GQzfklWQtZLqPymT1ukVsWWW8eptWOOghmApqAx9vzyiy8QshITVmo4Y10zJ+Cp9zYg6O9C1SUx2b9C4HZZftCyXNIV4T8MsTmxmpSo21LsLsoO1cigNzZQo3R/fa/qffoiJ5BLjTueRLi1iiHJrYrKygQu5/0u4yuDkSMW4zFJHojBGn9TMrHwByh3e58mdRvdg/EqtxzCC3B3J5O5eO0A7j6/bJoYhwrEukpoTtlzOHirsl0X3iK+ab0Qk+uy15+j+bLXqu52RO5FuhgHxNaQuncO/AeAmPQQUQ2eb/uG82KXi/U3/XrpKkuU7nrfFvJ3eP8gWpa60DxVI3osi6huzFSqq3dYGkXUfKVJKYhOHj4znO1HUJ/D4CO+yg1atkDdu3fzGMKPuApXXLnjHjrjsZrl960tGxwoyydBT/Y5bCrYEIP7rQE/+qMTYDgMlMwyz2+voFNJ91poHVW2TBq+ZLbjdvEST5uMvJumMfJUatCz8K/gj/f7ujGU2lUUTfamzjtMrbyWzGe0jKEGEa1LthM0AGCEEpFkQVuvv3X+DVHZ9anaoW690sjM6DcSoAIfZQo2Fj7mI3SP9FZpTMDMVQmuQGGvlIt3XE8wHbzifd5c4w240EIO5Qopk7imA8Qrzyr5pNO3Ro3RKupfq1dwz7OrWx0hrqG5ESv+F2mTIdFla22MFQzhsgvJ6qE15j1aHiO122qMCU9NU4PxNX0ExMpuOl7UmWeC3YRrIe5KycHjjWs+vWGhjQdc4wttIaEF4SY2v

What you are referring to is the guard condition, which was extended over the years but never documented.
Anyway, nested inductive types (e.g., rose trees) are impossible without the extended guard condition.

> BTW, someone should delete the reference to Giménez in the reference Manual:
"Before accepting a fixpoint definition as being correctly typed, we check that the definition is “guarded”. A precise analysis of this notion can be found in [Gimenez94].”
At this point there was only a minimal guard condition.

Hi Gert,

How about submitting an issue mentioning these points?  And mentioning why the Giménez reference should be removed.  Or, if you know the information needed to update the documentation, consider submitting a pull request.  Your observations are very likely to be overlooked otherwise.

Jim


On Mon, Sep 14, 2020 at 11:16 AM Gert Smolka <smolka AT ps.uni-saarland.de> wrote:

On 14. Sep 2020, at 18:42, Christian Doczkal <christian.doczkal AT inria.fr> wrote:

Unfortunately, I don't remember the precise rules that make this definition okay. It's something along the lines of "l" being structurally smaller than "a" and "flatten_list" applying flatten only to arguments that are "structurally no greater than y". However, this seems to not be covered by relevant section of the current manual: https://coq.inria.fr/refman/language/core/inductive.html#id10

Maybe someone can chime in and provide the precise rules making this legal.

Smiley!  What you are referring to is the guard condition, which was extended over the years but never documented.
Anyway, nested inductive types (e.g., rose trees) are impossible without the extended guard condition.

BTW, someone should delete the reference to Giménez in the reference Manual:
"Before accepting a fixpoint definition as being correctly typed, we check that the definition is “guarded”. A precise analysis of this notion can be found in [Gimenez94].”
At this point there was only a minimal guard condition.

I’m intrigued by Dominique’s idea to define the eliminator for rose trees with ACC.  Below is a minimal version.  
It shows that the extended guard condition can be quite nice.

Cheers, Gert


Inductive tree := T (A: list tree).
Implicit Type s t: tree.

Definition dst s t := let (A) := t in In s A.

Fixpoint tree_Acc t: Acc dst t.
Proof.
 destruct t as [A].
 constructor.
 induction A as [| t A IH]; cbn.
 - intros t [].
 - intros s [[]|H].
   + apply tree_Acc.
   + apply IH, H.
Defined.

Eval cbv -[dst] in tree_Acc.





Archive powered by MHonArc 2.6.19+.

Top of Page