coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Michiel Helvensteijn <mhelvens AT gmail.com>
- To: Jacques-Henri Jourdan <jacques-henri.jourdan AT inria.fr>
- Cc: Pierre Casteran <pierre.casteran AT labri.fr>, coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Fixpoint definition
- Date: Mon, 15 Jul 2013 22:40:59 +0200
On Mon, Jul 15, 2013 at 10:37 PM, Michiel Helvensteijn
<mhelvens AT gmail.com>
wrote:
>> Well, but it does works when it is through pair then lst, but not through
>> lst then pair, which is really confusing.
>
> As I understand it, your first example works because it structurally
> decreases on a `lst` parameter. A `lst` can "contain itself" by
> definition.
>
> Your second example tries to decrease on a `pair`. As far as the type
> `pair` is concerned, the actual parameter is not structurally smaller
> than the formal parameter, it's just different.
With that in mind, what about the following solution?
Inductive lst :=
| Nil | Cons : nat_lst_pair -> lst
with nat_lst_pair :=
| Both: nat -> lst -> nat_lst_pair.
Fixpoint test2 p :=
match p with
| Both _ Nil => 0
| Both _ (Cons l) => test2 l
end.
--
www.mhelvens.net
- [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Pierre Casteran, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/16/2013
- Re: [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/16/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Daniel Schepler, 07/16/2013
- Re: [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/16/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Jacques-Henri Jourdan, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Michiel Helvensteijn, 07/15/2013
- Re: [Coq-Club] Fixpoint definition, Pierre Casteran, 07/15/2013
Archive powered by MHonArc 2.6.18.