From sandy@TIS.COM  Mon Nov 12 07:15:47 1990
Received: by iris.eecs.ucdavis.edu (5.57/UCD.EECS.3.0)
        id AA15346; Mon, 12 Nov 90 07:15:47 -0800
Received: from TIS.COM by clover.eecs.ucdavis.edu (5.59/UCD.EECS.1.11)
        id AA13887; Mon, 12 Nov 90 07:18:01 PST
Received: from frodo ([192.33.112.94]) by TIS.COM (4.1/SUN-5.64)
        id AA02863; Mon, 12 Nov 90 10:15:57 EST
Date: Mon, 12 Nov 90 10:15:57 EST
From: Sandy Murphy <sandy@TIS.COM>
Message-Id: <9011121515.AA02863@TIS.COM>
To: info-hol@clover.ucdavis.edu
Subject: recursive functions

I have a question concerning the range of recursive functions that one may
define (easily) in HOL.

It appears to me that the ML function "new_prim_rec_definition" will work
only for primitive recursive functions of the form:

      f(0,...) = g1(...)
      f(SUC(n),...) = g2(f(n),...)

This makes it difficult to define "course-of-values" recursion such as
our good friend the Fibonacci sequence (f(n) = f(n-1)+f(n-2)) or the recursion
formulas for divide-and-conquer techniques (i.e. f(n)=f(n-k)+f(k)).  But these
things ARE primitive recursive.

I am interested in recursive functions that are something like:

      f(SUC(n)...) = g2(f(h(n))...)

where h is (num --> num), and is guaranteed to be non-increasing.

I am also interested in similar definitions for other recursive types.
For general recursive types, h must be (recursive type --> recursive type) and
must get you "closer" to a base value of the recursive type (the null list, a
leaf, etc.).  In terms of the tree defined by the recursive type constructors,
h must get you closer to the root.  (Actually, it's not "closer to" that is
required, but rather "not farther from".)


The ability to define recursive functions comes from the theorem you get after
defining a recursive type (the theorem returned by define_type), which says:

 |- !f1...fn. ?!fn:op->*.
    !x11...x1k. fn(C1 x11...x1k) = f1 (fn x11) ... (fn x1k) x11 ... x1k

    !xm1...xmn. fn(Cm xm1...xmn) = fm (fn xm1) ... (fn xmn) xm1 ... xmn

To get "course-of-values" recursion, the theorem needs to say something like:

               .... = f1 (fn h1(x11)) ... (fn hn(x1k)) x11 ... x1k ...

where the hi satisfy the constraints mentioned above for h.
The only other alternative I can see is to go through the tedium of proving
that a function defined by course-of-values does indeed have a definition in
the "define_type" form.

If any of this is wrong, I would like to know.
If anyone has a proof of such a modified theorem, or a way to do this sort of
recursion, I would like to know.  (Maybe you could approach this by being
extremely clever about the recursive type you define?  (I doubt this.)  Maybe
what is needed is a theorem of strong induction over the recursive type?)


         Thanks.


         Sandy Murphy       (murphy@tis.com)


