coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Ben Lippmeier <benl AT ouroborus.net>
- To: AUGER Cédric <sedrikov AT gmail.com>
- Cc: Marco Servetto <marco.servetto AT gmail.com>, coq-club AT inria.fr
- Subject: Re: [Coq-Club] Easy and hard tasks in Coq
- Date: Fri, 7 Jun 2013 11:01:05 +1000
>
>>> I do not understand what you mean by "in-place".
>> For example stuff like
>> Inductive tree : Set :=
>> | Leaf: something -> tree
>> | Node: treeChildren -> something -> tree
>> with treeChildren : Set :=
>> | empty: treeChildren
>> | Cons: tree -> treeChildren ->treeChildren
>>
>> If I understand correctly is common wisdom in the coq community that
>> the mutually recursive definition defined over is easier to manage
>> then an "equivalent"
>>
>> Inductive tree : Set :=
>> | Leaf: something -> tree
>> | Node: list tree -> something -> tree
>
> Yes, that is often the case.
> But in both cases you will have pros and cons.
> Some people tend to prefer to use first solution and others to use the
> second.
The second definition of 'tree' above is using "indirect mutual recursion" --
the recursive use of 'tree' in 'Node' is via another type 'list' that isn't
defined in the same recursive group. You end up with the same problem when
trying to define language grammars that contain lists of case alternatives.
It's not too hard to deal with once you know how to define the induction
principles. There is an example for a simple lambda language with 'case' in
the Iron Lambda collection here:
http://code.ouroborus.net/iron/iron-head/done/Iron/Language/SimpleData/ExpBase.v
and uses of it here:
http://code.ouroborus.net/iron/iron-head/done/Iron/Language/SimpleData/ExpLift.v
Ben.
- [Coq-Club] Easy and hard tasks in Coq, Marco Servetto, 06/03/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, AUGER Cédric, 06/05/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, Marco Servetto, 06/06/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, AUGER Cédric, 06/07/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, Ben Lippmeier, 06/07/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, AUGER Cédric, 06/07/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, gallais, 06/07/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, Marco Servetto, 06/06/2013
- Re: [Coq-Club] Easy and hard tasks in Coq, AUGER Cédric, 06/05/2013
Archive powered by MHonArc 2.6.18.