DTB and BLD Use Cases: User-Defined Functions -- factorial example, Equal in the head, oriented equations, left and right roles

Hi RIF WG,

User-defined functions on top of the DTB built-ins
will make for some interesting Use Cases. These can
lead to a better understanding of our work so far.

For example, the factorial function can be defined
in BLD presentation syntax based on DTB built-ins:

Document(

  Prefix(pred http://www.w3.org/2007/rif-builtin-predicate#)
  Prefix(func http://www.w3.org/2007/rif-builtin-function#)

  Group
  (
    factorial(0) = 1

    Forall ?N (
      factorial(?N) = func:numeric-multiply
                       (?N
                        factorial(func:numeric-subtract(?N 1)))
        :- pred:numeric-greater-than(?N 0)
    )
  )
)

Both Equals are oriented/directed from left to right here,
as often occurs in practice (so I think we should use
selective <side> roles, <left> and <right>, within <Equal>).
The Equal is the stand-alone head/conclusion of the base fact
and the head of the recursive rule (so I would 'lower' the
"at risk" of Equal-in-the-head for oriented equations).

Best,
Harold

Received on Tuesday, 10 June 2008 15:05:10 UTC