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. When multi-valued slots are used as predicates,
then the predicate will be tested with each value of the slot.
Note on the strategy for evaluating predicates:
- Evaluation is lazy
- Evaluation is entire - the 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
Note: When using a class or slot name that contains a space, you must
enclose the name in single quotes. For example, my class must be written
as 'my class'.
Frame-level predicates
- is-frame
(1 argument: any type)
Class-level predicates
- direct-subclass-of
(2 arguments: the subclass and the superclass)
- direct-superclass-of
(2 arguments: the superclass and the subclass)
- is-class
(1 argument: any type)
- is-concrete-class
(1 argument: any type)
- subclass-of
(2 arguments: the subclass and the superclass)
- superclass-of
(2 arguments: the superclass and the subclass)
Slot-level predicates
- allowed-slot-value
(3 arguments: slot, class that slot is attached to, a value)
- allowed-slot-value-type
(3 arguments: slot, class that slot is attached to, class which defines
value type)
- direct-template-slot-of
(2 arguments: a slot and a class)
- own-slot-has-duplicate-values
(2 arguments: a slot and a frame)
- own-slot-not-null
(2 arguments: a slot and a frame)
- own-slot-of
(2 arguments: a slot and a frame)
- slot-at-class-is-boolean-valued
(2 arguments: a slot and a class)
- slot-at-class-is-class-valued
(2 arguments: a slot and a class)
- slot-at-class-is-float-valued
(2 arguments: a slot and a class)
- slot-at-class-is-frame-valued
(2 arguments: a slot and a class)
- slot-at-class-is-instance-valued
(2 arguments: a slot and a class)
- slot-at-class-is-integer-valued
(2 arguments: a slot and a class)
- slot-at-class-is-primitive-valued
(2 arguments: a slot and a class)
- slot-at-class-is-single-valued
(2 arguments: a slot and a class)
- slot-at-class-is-string-valued
(2 arguments: a slot and a class)
- slot-at-class-is-symbol-valued
(2 arguments: a slot and a class)
- slot-has-duplicate-values
(2 arguments: a slot and a frame)
- slot-is-boolean-valued
(1 argument: the slot in question)
- slot-is-class-valued
(1 argument: the slot in question)
- slot-is-float-valued
(1 argument: the slot in question)
- slot-is-frame-valued
(1 argument: the slot in question)
- slot-is-instance-valued
(1 argument: the slot in question)
- slot-is-integer-valued
(1 argument: the slot in question)
- slot-is-primitive-valued
(1 argument: the slot in question)
- slot-is-single-valued
(1 argument: the slot in question)
- slot-is-string-valued (1
argument: the slot in question)
- slot-is-symbol-valued
(1 argument: the slot in question)
- slot-not-null
(2 arguments: a slot and a frame)
- slot-of
(2 arguments: a slot and a frame)
- template-slot-has-duplicate-values
(2 arguments: a slot and a frame)
- template-slot-not-null
(2 arguments: a slot and a class)
- template-slot-of
(2 arguments: a slot and a class)
Facet-level predicates
- facet-not-null
(3 arguments: a facet, a frame, and a slot)
- own-facet-not-null
(3 arguments: a facet, a frame, and a slot)
- template-facet-not-null
(3 arguments: a facet, a class, and a slot)
Instance-level predicates
- direct-instance-of
(2 arguments: a frame and a class)
- instance-of
(2 arguments: a frame and a class)
- 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)
- element-of
(2 arguments, currently broken)
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. However, multi-valued slots are not very
useful as functions, because in this case the element-of predicate is broken.
Note on the strategy for evaluating functions:
- Evaluation is lazy
- Validation is entirely on number of arguments
- Types are cast, not coerced
- Type checking is, in general, impossible
Note: When using a class or slot name that contains a space, you must
enclose the name in single quotes. For example, my class must be written
as 'my class'.
- get-class
(1 argument: a frame. Return type is class.)
- number-of-own-slot-values
(2 arguments: a slot and a frame. Return type is integer.)
- number-of-slot-values
(2 arguments: a slot and a frame. Return type is integer.)
- number-of-template-slot-values
(2 arguments: a slot and a frame. Return type is integer)
- coerce-to-class
(1 argument: anything will do. Return type is class.)
- coerce-to-facet
(1 argument: anything will do. Return type is facet.)
- coerce-to-frame
(1 argument: anything will do. Return type is frame.)
- coerce-to-instance
(1 argument: anything will do. Return type is instance.)
- coerce-to-integer
(1 argument: anything will do. Return type is integer.)
- coerce-to-number
(1 argument: anything will do. Return type is number.)
- coerce-to-slot
(1 argument: anything will do. Return type is slot.)
- coerce-to-string
(1 argument: anything will do. Return type is string.)
- coerce-to-symbol
(1 argument: anything will do. Return type is symbol.)
- +
(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.)
The PAL Language and Frames/Supported Predicates and Functions in PAL
Next: The User Interface/The PAL Constraints Tab
PAL Table of Contents