Artificial Intelligence - Solved Exam Problems | CSE 571, Study notes of Computer Science

Material Type: Notes; Class: Artificial Intelligence; Subject: Computer Science and Engineering; University: Arizona State University - Tempe; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-sdn
koofers-user-sdn 🇺🇸

9 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE571 Class Notes for Sept. 17 Geoff Beerbower
Problem: Refuse admission to an applicant if he/she has not taken any honors course.
refuse_admission(X).
applicant(X).
taken_honors_course(X,Y).
refuse_admission(X) ← applicant(X), not taken_honors_course(X,Y).
applicant (john).
applicant (george).
taken_honors_course(john, chemistry).
taken_honors_course(george, physics).
Side Note: If we go by mathematical semantics, variables can go anywhere, so there would be
many instantiations. However, in “smodels” there is implicit typing. So in this example,
chemistry and physics can only appear in the Y position in the
taken_honors_course(X,Y).” rule.
The above rules lead to the following instantiations:
1) refuse_admission(john) ← applicant(john), not
taken_honors_course(john, physics).
2) refuse_admission(john) ← applicant(john), not
taken_honors_course(john, chemistry).
3) refuse_admission(george) ← applicant(george), not
taken_honors_course(george, physics).
4) refuse_admission(george) ← applicant(george), not
taken_honors_course(george, chemistry).
Remember, the head of a rule is true if there is some combination of variables that make the
body true. Here, instantiation 2 causes john to be refused, even though he has taken an honors
course. Likewise, instantiation 4 causes george to be refused. The point is:
When using variables and not, be very careful what not means.
Solution: replace the first rule:
refuse_admission(X) ← applicant(X), not taken_honors_course(X,Y).
with the following two rules:
taken_honors_course(X)← taken_honors_course(X,Y).
refuse_admission(X) ← applicant(X), not taken_honors_course(X).
Side Note: If the original problem had been “Refuse admission to an applicant if he/she has not
taken all honors courses”, then the original solution would have been correct.
pf3
pf4
pf5

Partial preview of the text

Download Artificial Intelligence - Solved Exam Problems | CSE 571 and more Study notes Computer Science in PDF only on Docsity!

Problem: Refuse admission to an applicant if he/she has not taken any honors course. refuse_admission(X). applicant(X). taken_honors_course(X,Y). refuse_admission(X) ← applicant(X), not taken_honors_course(X,Y). applicant (john). applicant (george). taken_honors_course(john, chemistry). taken_honors_course(george, physics). Side Note: If we go by mathematical semantics, variables can go anywhere, so there would be many instantiations. However, in “smodels” there is implicit typing. So in this example, chemistry and physics can only appear in the Y position in the “taken_honors_course(X,Y).” rule. The above rules lead to the following instantiations:

  1. refuse_admission(john) ← applicant(john), not taken_honors_course(john, physics).
  2. refuse_admission(john) ← applicant(john), not taken_honors_course(john, chemistry).
  3. refuse_admission(george) ← applicant(george), not taken_honors_course(george, physics).
  4. refuse_admission(george) ← applicant(george), not taken_honors_course(george, chemistry). Remember, the head of a rule is true if there is some combination of variables that make the body true. Here, instantiation 2 causes john to be refused, even though he has taken an honors course. Likewise, instantiation 4 causes george to be refused. The point is: When using variables and not, be very careful what not means. Solution: replace the first rule: refuse_admission(X) ← applicant(X), not taken_honors_course(X,Y). with the following two rules: taken_honors_course(X)← taken_honors_course(X,Y). refuse_admission(X) ← applicant(X), not taken_honors_course(X). Side Note: If the original problem had been “Refuse admission to an applicant if he/she has not taken all honors courses”, then the original solution would have been correct.

AnsProlog ¬ Note: The ¬ symbol is useful for writing programs. However, it is not needed. The program can always be written some other way. Consider: fly(X) ← bird(X), not abnormal(X). abnormal(X) ← penguin(X). bird(X) ← penguin(X). bird(tweety). tweety is a bird. Since we cannot prove that he is abnormal, it follows that tweety flies. However, suppose we observe that he does not fly. How can we represent this? We could add: abnormal(tweety). or ← fly(tweety). Unfortunately, this will eliminate models where tweety can fly. One solution would be to write the first rule of the program with the following two rules: fly(X) ← bird(X), ¬ fly(X). ¬ fly(X) ← abnormal(X). Then if we observe that tweety does not fly, we can simply add the fact: ¬ fly(tweety).


Problem: Cross the tracks if no train is coming. Solution using default negation : cross ← not train(X). This solution is dangerous, since it will lead to crossing the tracks if nothing is known about the train. If we instead use explicit negation , then we only cross if we know that there is no train:

Now consider the program ∏+: n_a ← b. b ←. The answer S+^ is {n_a, b}. Since S maps to S+, S is an answer set of ∏.


Consider the program ∏: a ← b. ¬a. b. We derive the set S: {a,¬a, b}, which is inconsistent. Therefore the answer set for ∏ is Lit {a,¬a, b, ¬b}. Notice that the answer set for ∏+: a ← b. n_a. b. is S+: {a, n_a, b}, which does not map to S.


Note: The following two programs are equivalent in terms of propositional logic, but they have different answer sets. ∏^1 ∏^2 ¬a ← ¬b. (equivalent to: b v ¬a) b. b ← a. (equivalent to: ¬a v b) b. Answer set: {¬b, ¬a} Answer set: {¬b }


Consider the following program. eligible(X) ← highGPA(X). eligible(X) ← special(X), fairGPA(X). ¬eligible(X) ← ¬special(X), ¬highGPA(X). interview(X) ← not eligible(X), not ¬eligible(X). fairGPA(john). ¬highGPA(john). Will this program grant john an interview? Assigned as take home exercise.


END OF CLASS