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

From: Boley, Harold <Harold.Boley@nrc-cnrc.gc.ca>
Date: Tue, 10 Jun 2008 11:04:27 -0400
Message-ID: <E4D07AB09F5F044299333C8D0FEB45E904FFE13E@nrccenexb1.nrc.ca>
To: "Public-Rif-Wg (E-mail)" <public-rif-wg@w3.org>
```
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:07:45 UTC