-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.psoa
39 lines (35 loc) · 1.1 KB
/
math.psoa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
RuleML
(
Prefix(func: <http://www.w3.org/2007/rif-builtin-function#>)
Prefix(pred: <http://www.w3.org/2007/rif-builtin-predicate#>)
Prefix(: <http://psoa.ruleml.org/lib/math#>)
Assert
(
% Arithmetic predicates invoked with External-less short names
Forall ?x ?y (
:lessThan(?x ?y) :- External(pred:numeric-less-than(?x ?y))
)
Forall ?x ?y (
:greaterThan(?x ?y) :- External(pred:numeric-greater-than(?x ?y))
)
Forall ?x ?y (
:lessEq(?x ?y) :- External(pred:numeric-less-than-or-equal(?x ?y))
)
Forall ?x ?y (
:greaterEq(?x ?y) :- External(pred:numeric-greater-than-or-equal(?x ?y))
)
% Arithmetic functions invoked as first-argument-result predicates
Forall ?r ?x ?y (
:sum(?r ?x ?y) :- ?r = External(func:numeric-add(?x ?y))
)
Forall ?r ?x ?y (
:diff(?r ?x ?y) :- ?r = External(func:numeric-subtract(?x ?y))
)
Forall ?r ?x ?y (
:prod(?r ?x ?y) :- ?r = External(func:numeric-multiply(?x ?y))
)
Forall ?r ?x ?y (
:quot(?r ?x ?y) :- ?r = External(func:numeric-divide(?x ?y))
)
)
)