Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Recursive functions

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Recursive functions


chronological Thread 
  • From: Benjamin Werner <werner AT pauillac.inria.fr>
  • To: lionel AT mamane.lu (Lionel Elie Mamane)
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club] Recursive functions
  • Date: Wed, 27 Nov 2002 13:21:48 +0100 (MET)
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

> Hi,
> 
> I'm trying to define a function of the following shape
> 
> f (Tcons a) (Tcons b) = g (f a (Tcons b)) (f (Tcons a) b)
> 
> (plus adequate terminating cases)
> 
> where
>  - Tcons is the constructor of the type T
>  - g is a simple expression of type T->T->T
> 
> I have read the papers of Venanzio Capretta and Ana Bove about
> modelling general recursion in type theory, but their accessibility
> predicate will here have the shape:
[...]

Hi,

Your function seems to have a form similar to Ackermann's function. I
do not think it is a good idea to use general well-founded recursion
here, but rahter stay inside structural recursion.

all you have to do is use two embeded fixpoints.

To illustrate, here is a definition of Ackermann's function in Coq :

Fixpoint Ack [n:nat] : nat -> nat :=
 Cases n of 
  O => [m:nat](S m)
| (S n') => Fix aux {aux [m:nat] : nat :=
             Cases m of
              O => (Ack n' (S O))
           | (S m') => (Ack n' (aux m'))
end}
end.



Hope this helps, cheers,


Benjamin





Archive powered by MhonArc 2.6.16.

Top of Page