Oct 11
practice
chap 9 material : inference
Main points :
- variables assumed to have universal quantifiers
- existential variables replaced by skolem functions (of exterior universal variables)
- clauses resolved with "unification" of variable & constant names
theorem provers
See west.lisp attached; snark example.
prolog
"
Prolog is a general purpose logic programming language ..."
$ swipl
?- assert(cat(tom)). % new fact : tom is a cat
?- assert(animal(X) :- cat(X)). % :- is "if", backwards implies
?- animal(Y). % is there an animal ?
Y = tom.
?-
If we have the facts in a file (facts.pl), then assert() isn't needed.
The file is loaded with
$ swipl
?- [facts].
?- cat(Y). % Note that unbound variables must be uppercase.
The "goal" seeking becomes program execution :
factorial(0, 1).
factorial(N, FactN) :-
N > 0,
Nminus1 is N - 1,
factorial(Nminus1, FactNminus1),
FactN is N * FactNminus1.
Or using the example from the text : see west.pl, attached.
ai-class.com
... kicked off this week. Hmmm. Thoughts?
asides