First Oder Logic - Assignment 2 Solution - Artificial Intelligence | CPSC 420, Assignments of Computer Science

Material Type: Assignment; Professor: Choe; Class: ARTIFICIAL INTELLIGENCE; Subject: COMPUTER SCIENCE; University: Texas A&M University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 02/10/2009

koofers-user-4wt
koofers-user-4wt 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CPSC 420-500 Homework #2
SOLUTION
Total: 130 pts
Yoonsuck Choe
November 1, 2007
1 First-Order Logic
Important: In this section, assume that w, x, y, z are variables; A, B, C, D are constants; and f(·), g(·), h(·)
are functions; and P(·), Q(·), R(·)are predicates.
1.1 Standard Forms
To do automatic theorem proving in first-order logic, you need to go through three steps to convert your
initial first-order logic expression into a standard form. These are:
1. Prenex normal form,
2. Conjunctive normal form, and
3. Skolemization.
Question 1 (12 pts): Convert to prenex normal form (4 points each):
1. x, ¬(y, ¬P(x, y))
2. ¬∀x(P(x) ¬(y, ¬Q(x, y)))
3. ¬∀x(y, Q(x, y) ¬P(x))
SOLUTION:
1. x, ¬(y, ¬P(x, y))
x, (y, ¬¬P(x, y))
x, (y, P (x, y ))
x, y, P (x, y )
2. ¬∀x(P(x) ¬(y, ¬Q(x, y)))
x¬(P(x) ¬(y, ¬Q(x, y)))
x(¬P(x) ¬¬(y, ¬Q(x, y)))
x(¬P(x)(y, ¬Q(x, y)))
x, y, ¬P(x) ¬Q(x, y)
1
pf3
pf4
pf5

Partial preview of the text

Download First Oder Logic - Assignment 2 Solution - Artificial Intelligence | CPSC 420 and more Assignments Computer Science in PDF only on Docsity!

CPSC 420-500 Homework

SOLUTION

Total: 130 pts

Yoonsuck Choe

November 1, 2007

1 First-Order Logic

Important: In this section, assume that w, x, y, z are variables; A, B, C, D are constants; and f (·), g(·), h(·) are functions; and P (·), Q(·), R(·) are predicates.

1.1 Standard Forms

To do automatic theorem proving in first-order logic, you need to go through three steps to convert your initial first-order logic expression into a standard form. These are:

  1. Prenex normal form,
  2. Conjunctive normal form, and
  3. Skolemization.

Question 1 (12 pts): Convert to prenex normal form (4 points each):

  1. ∀x, ¬ (∃y, ¬P (x, y))
  2. ¬∀x (P (x) ∨ ¬(∃y, ¬Q(x, y)))
  3. ¬∀x (∃y, Q(x, y) → ¬P (x))

SOLUTION:

  1. ∀x, ¬ (∃y, ¬P (x, y)) ∀x, (∀y, ¬¬P (x, y)) ∀x, (∀y, P (x, y)) ∀x, ∀y, P (x, y)
  2. ¬∀x (P (x) ∨ ¬(∃y, ¬Q(x, y))) ∃x¬ (P (x) ∨ ¬(∃y, ¬Q(x, y))) ∃x (¬P (x) ∧ ¬¬(∃y, ¬Q(x, y))) ∃x (¬P (x) ∧ (∃y, ¬Q(x, y))) ∃x, ∃y, ¬P (x) ∧ ¬Q(x, y)
  1. ¬∀x (∃y, Q(x, y) → ¬P (x)) ∃x¬ (¬(∃y, Q(x, y)) ∨ ¬P (x)) ∃x (¬¬(∃y, Q(x, y)) ∧ ¬¬P (x)) ∃x (∃y, Q(x, y) ∧ P (x)) ∃x, ∃y, Q(x, y) ∧ P (x)

Question 2 (20 pts): Skolemize the expressions (4 points each):

  1. ∃xP (x)
  2. ∀x∃yP (x, y)
  3. ∃x, ∃y, ∀zP (x, y) ∧ Q(y, z)
  4. ∀x, ∃y, ∃zP (x, y) ∧ Q(y, z)
  5. ∀x, ∀y, ∃zP (x, y) ∧ Q(y, z)

SOLUTION:

1. P (A)

  1. P (x, f (x))
  2. P (A, B) ∧ Q(B, z)
  3. P (x, f (x)) ∧ Q(f (x), g(x)) The question was ambiguous, so you will get full points for this one if your answer was reasonable. The qeustion was supposed to be ∀x, ∃y, ∃zP (x, y) ∧ Q(y, z)
  4. P (x, y) ∧ Q(y, f (x, y))

Question 3 (9 pts): Convert the following into a standard form:

∀x, [¬P (x) → ¬(∃y, Q(x, y))]

SOLUTION: ∀x, [¬P (x) → ¬(∃y, Q(x, y))] ∀x, [¬¬P (x) ∨ ¬(∃y, Q(x, y))] ∀x, [P (x) ∨ (∀y, ¬Q(x, y))] ∀x, ∀y, [P (x) ∨ ¬Q(x, y)] P (x) ∨ ¬Q(x, y)

  1. ∀x, ∀y, (¬P (x) → (Q(x, y) ∨ R(y))) ∀x, ∀y, (¬¬P (x) ∨ (Q(x, y) ∨ R(y))) ∀x, ∀y, (P (x) ∨ Q(x, y) ∨ R(y)) P (x) ∨ Q(x, y) ∨ R(y)
  2. ∃x, ¬P (x) ¬P (A)
  3. ∀w, ∀z, (¬Q(w, z) ∨ R(w)) ¬Q(w, z) ∨ R(w)
  4. Negated conclusion: ¬R(v)
  5. Q(A, y) ∨ R(y) (1 and 2), σ = {x/A}
  6. Q(A, y) (4 and 5), σ = {v/y}
  7. ¬Q(w, z) (3 and 4), σ = {v/w}
  8. False (6 and 7), σ = {w/A, y/z}

2 Uncertainty and Probabilistic Reasoning

B T^ T^ F^  F^ 

E T  F T  F

P(A) . . .

.

P(B) .

P(E)

Alarm



Earthquake

JohnCalls MaryCalls 

Burglary

A P(J) T^ F  .90. A P(M) T^ F  .70.

.

Figure 1: Belief Network. See problem 1.

Question 1 (10 pts): Given the Belief network as shown in figure 1, calculate the two joint probability values and answer the question. Note that in this section P (·) denotes the probability of the event. (5 points each):

  1. P (M aryCalls ∧ JohnCalls ∧ Alarm ∧ ¬Earthquake ∧ Burglary)
  2. P (¬M aryCalls ∧ ¬JohnCalls ∧ ¬Alarm ∧ ¬Earthquake ∧ Burglary)

SOLUTION:

  1. P (M aryCalls ∧ JohnCalls ∧ Alarm ∧ ¬Earthquake ∧ Burglary) = P (M |A)P (J|A)P (A|¬E, B)P (¬E)P (B) = 0. 7 × 0. 9 × 0. 94 × (1 − 0 .002) × 0. 001
  1. P (¬M aryCalls ∧ ¬JohnCalls ∧ ¬Alarm ∧ ¬Earthquake ∧ Burglary) = P (¬M |¬A)P (¬J|¬A)P (¬A|¬E, B)P (¬E)P (B) = (1 − 0 .01) × (1 − 0 .05) × (1 − 0 .94) × (1 − 0 .002) × 0. 001

Question 2 (5 pts): Why do belief networks give a much more compact representation of the joint proba- bility distribution, compared to a full joint probability table?

SOLUTION: Because the joint probability can be represented as a product of conditional probabilities where each node is conditioned on only a small number of other nodes (their parents) in the network due to the conditional independence structure of the domain, and thus much smaller probability tables for each node.

3 Learning

3.1 Decision Tree Learning

Consider the following set of examples where you are trying to make a decision whether to take a course or not.

Example# Usefulness in life Toughness Fun Decision (Take course?) 1 Stellar Okay Medium Yes 2 Not bad Very tough High Yes 3 Zero Light Medium No 4 Not bad Light Low No 5 Not bad Light High Yes 6 Not bad Very tough Low No 7 Zero Okay Medium No 8 Stellar Very tough Low Yes 9 Stellar Okay Medium Yes 10 Zero Light High No

Question 1 (12 pts): For each of the three attributes above, draw a decision tree rooted at that attribute with a single depth. See slide06, page 12, (a) and (b) which show some examples. (4 points each)

SOLUTION:

  1. Usefulness Stellar: (+: 1, 8, 9) (-: None) Not bad: (+: 2, 5) (-: 4, 6) Zero: (+: None) (-: 3, 7, 10)
  2. Toughness Okay: (+: 1, 9) (-: 7) Very tough: (+: 2, 8) (-: 6) Light: (+: 5) (-: 3, 4, 10)
  3. Fun Low: (+: 8) (-: 4, 6) Medium: (+: 1, 9) (-: 3, 7) High: (+: 2, 5) (-: 10)