Supported Predicates and Functions in PAL
PAL supports mostly predicates that test the
properties of frame arguments; PAL also includes a limited number of arithmetic and string
predicates, plus miscellaneous predicates.
In addition, any slot of a knowledge base can be used as a unary predicate, the first
argument being the class to which the slot is attached and the second argument being a
slot value (see example).
Note on the strategy for evaluating predicates:
- Evaluation is lazy
- Evaluation is entirethe domain of predicates is the entire universe
- Inappropriate arguments are simply false
- There is no such thing as a list. Iteration is a procedural concept which maps to either
forall or exists
Frame-level predicates
Class-level predicates
Slot-level predicates
Facet-level predicates
Instance-level predicates
- even (1 argument: an integer)
- negative (1 argument: a number)
- odd (1 argument: an integer)
- positive (1 argument: a number)
- prime (1 argument: an integer)
- < (2 arguments, both numbers)
- > (2 arguments, both numbers)
- zero
- prefix-of (2 arguments: the smaller string and
the larger string)
- substring-of (2 arguments: the smaller string
and the larger string)
- suffix-of (2 arguments: the smaller string and
the larger string)
PAL supports functions that test argument frames,
as well as type-coercion functions and a few arithmetic functions.
In addition, any slot of a knowledge base can be used as a function, the only argument
being the class to which the slot is attached, and the return type being the value-type of
the slot (see example).
Note on the strategy for evaluating predicates:
- Evaluation is lazy
- Validation is entirely on number of arguments
- Types are cast, not coerced
- Type checking is, in general, impossible
- + (2 arguments: both numbers. Return type is number.)
- - (2 arguments: both numbers. Return type is
number.)
- * (2 arguments: both numbers. Return type is
number.)
- / (2 arguments: both numbers. Return type is
number.)
- round (1 arguments: a number. Return type is
integer.)
- truncate (1 arguments: a number. Return type is
integer.)
Extending PAL with additional predicates and functions.