Original JavaScript The final combining form is called lisp-value. When lisp-value is the first element of a pattern, it specifies that the next element is a Lisp predicate to be applied to the rest of the (instantiated) elements as arguments. In general, (lisp-value $\langle \textit{predicate}\rangle$ $\langle \textit{arg}_{1}\rangle$ $\ldots$ $\langle \textit{arg}_{n} \rangle$) will be satisfied by assignments to the pattern variables for which the $\langle \textit{predicate} \rangle$ applied to the instantiated $\langle \textit{arg}_{1} \rangle, \ldots, \langle \textit{arg}_{n}\rangle$ is true. For example, to find all people whose salary is greater than $30,000 we could write[3] (and (salary ?person ?amount) (lisp-value > ?amount 30000)) The final combining form starts with javascript_predicate and contains a JavaScript predicate. In general, javascript_predicate($predicate$) will be satisfied by assignments to the pattern variables in the$predicate$for which the instantiated$predicate$is true. For example, to find all people whose salary is greater than$50,000 we could write[4] and(salary($person,$amount), javascript_predicate($amount > 50000)) [1] This uses the dotted-tail notation introduced in exercise 2.20. [2] Actually, this description of not is valid only for simple cases. The real behavior of not is more complex. We will examine not's peculiarities in sections 4.4.2 and 4.4.3. [3] Lisp-value should be used only to perform an operation not provided in the query language. In particular, it should not be used to test equality (since that is what the matching in the query language is designed to do) or inequality (since that can be done with the same rule shown below). [4] A query should use javascript_predicate only to perform an operation not provided in the query language. In particular, javascript_predicate should not be used to test equality (since that is what the matching in the query language is designed to do) or inequality (since that can be done with the same rule shown below). [5] Notice that we do not need same in order to make two things be the same: We just use the same pattern variable for each—in effect, we have one thing instead of two things in the first place. For example, see ?town$town in the lives-near lives_near rule and ?middle-manager $middle_manager in the wheel rule below. Same The same relation is useful when we want to force two things to be different, such as ?person-1$person_1 and ?person-2 \$person_2 in the lives-near lives_near rule. Although using the same pattern variable in two parts of a query forces the same value to appear in both places, using different pattern variables does not force different values to appear. (The values assigned to different pattern variables may be the same or different.)
[6] We will also allow rules without bodies, as in same, and we will interpret such a rule to mean that the rule conclusion is satisfied by any values of the variables.
[7] We will also allow rules without bodies, as in same, and we will interpret such a rule to mean that the rule conclusion is satisfied by any values of the variables.
4.4.1   Deductive Information Retrieval