Basic Vocabulary



next up previous
Next: Function and Relation Up: Functions and Relations Previous: Functions and Relations

Basic Vocabulary

As described in chapter 3, a relation is an arbitrary set of lists. A collection of objects satisfies a relation if and only if the list of those objects is a member of this set.

(defrelation relation (?r) := (and (set ?r) (forall (?x) (=> (member ?x ?r) (list ?x)))))

Since KIF allows for n-ary relations, the lists in the set need not be of the same length. For example, the < relation is defined on 2-lists, 3-lists, 4-lists, and so forth.

A function is a set of lists in which the items in every list except for the last determine the last item, i.e. there cannot be two lists that agree on all but the last item and disagree on the last item.

(defrelation function (?f) := (and (relation ?f) (forall (?l ?m) (=> (member ?l ?f) (member ?m ?f) (= (butlast ?l) (butlast ?m)) (= (last ?l) (last ?m))))))

As with relations in general, the lists of a function need not be of the same length, to allow for functions of variable arity. For example, associative functions like + and functions can be applied to arbitrary numbers of arguments.

An important difference between our treatment of functions and the traditional treatment is that functions need not contain lists for every possible combination of arguments. If a function is undefined for a particular combination of objects (i.e. if its value is ), then we omit that list from the set. Thus, even though our universe of discourse is infinite, it is possible for a function to have a finite number of lists.



Vishal I. Sikka
Wed Dec 7 13:23:42 PST 1994