









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Artificial Intelligence; Subject: Computer Science and Engineering; University: Arizona State University - Tempe; Term: Fall 2003;
Typology: Study notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!










Andrew Davis
September 17, 2003
Our problem from the previous class was to try to write an implementation in AnsProlog for the following rule: Refuse admission to an applicant if he/she has not taken any (at least one) honors class.
We were given the following predicates to use:
ref use admission(X) applicant(X) taken honor class(X, Y )
One idea suggested in class was the rule:
ref use admission(X) ← applicant(X), not taken honor class(X, Y ).
However, this rule fails in the following instance:
applicant(john). applicant(george). taken honor class(john, chemistry). taken honor class(george, physics).
For example, in the rules
parent(X) ← f (Y, X). parent(X) ← m(Y, X).
if there exists a Y , then X is a parent. X is a parent if there exists a Y such that X is a f of Y or X is a m of Y. Any variable that doesn’t appear in the head acts as a ”there exists.”
The correct answer to the problem is:
taken an honor class(X) ← taken honor class(X, Y ).
ref use admission(X) ← applicant(X), not taken an honor class(X).
The lesson here is, if a variable appears only after a not, and nowhere else, it means ”there exists.”
As a technical sidenote, in smodels we would need a domain specifier for the classes – i.e. we would need to say class(chemistry) and class(physics), and that predicate would need to be present in every rule that referenced a class.
This concept regarding variables and ”there exists” is important for the current homework assignment. Any variable that appears only in the body of a rule acts as a ”there exists.”
Another use for the ¬ notation is in the following example
Cross the track if no train is coming.
However, the rule
cross ← not train.
is dangerous because it means to cross if we cannot prove that a train is coming. We want to say
Do not cross the track unless we KNOW that no train is coming.
We can say
cross ← ¬train.
to mean that we cross if we are sure there is no train.
In the following example:
anc(X, Y ) ← par(X, Y ). anc(X, Y ) ← par(X, Z), anc(Z, Y ).
par(a, b). par(b, c). par(d, e).
this is ”closed world assumption.” Everything we know about parents is here.
But suppose we found old DNA samples, so complete information is not available. Suppose we only know
par(a, b). ¬par(b, c). ¬par(a, d).
this is an open world assumption where some things are known and some are unknown. We can still use the ancestor rules from above, but we need rules for ”not ancestor.”
¬anc(X, Y ) ← not has par(X). has par(Y ) ← par(Y, X).
would only work for only a small set of cases.
The solution to this problem is left as an exercise for the next class. Students are asked not to look in the book for the solution to it.
There are two kinds of AnsProlog¬^ – AnsProlog¬^ and AnsProlog¬,−not. AnsProlog¬^ rules are of the form
L 0 ← L 1 , ..., Lm, notLm+1, ..., notLn.
AnsProlog¬,−not^ rules are of the form
L 0 ← L 1 , ..., Lm.
where the Li’s are literals, e.g. p or ¬p. These can be done in the same manner as AnsProlog¬,−not^ programs:
The program π is:
¬a ← b. b ←.
The answer set is S = {¬a, b}.
For the program π+
n a ← b. b ←.
the answer set is S+^ = {b, n a}.
If S is a consistent set of literals, then S is an answer set of π iff S+^ is an answer set of π+.
In other words n can replace ¬, but only if the answer set is consistent.
Consider the program
a ← b. ¬a ←. b ←.
The answer set for the above program is lit = {b, ¬a a, ¬b}. (There is currently a debate in the community that this is not an answer set – that there is no answer set at all for this program.)
Contrast this with the program
a ← b. n a ←. b ←.
whose answer set is {b, n a, a}.
The main point of this discussion is that not is false by default – we can’t prove it true. But ¬ means that we know it’s not true.
eligible(X) ← highGP A(X). eligible(X) ← special(X), f airGP A(X). ¬eligible(X) ← ¬special(X), ¬highGP A(X). interview(X) ← not eligible(X), not ¬eligible(X).
f airGP A(john). ¬highGP A(john).
From these rules, we cannot determine if john is eligible or not. So we recommend that he be interviewed.