You are on page 1of 6

Problem 1.

Find CNF for the following formula:


(∀x)(∃y)[ Q(x,y) ∧ ¬P(x,y)] ∨ (∃y) (∀x )[Q(x,y) ∧ ¬R(x,y)].
Solution:
1) Eliminate implication symbols. 2) Reduce scopes of negation symbols (negation
symbol can be applied to at most one atomic formula) 3) Standardize variables 4)
Eliminate existential quantifiers 5) Convert to prenex form (Skolemization) 6)
Convert to conjunctive normal form 7) Eliminate universal quantifiers 8) Eliminate
∧ symbol 9) Rename variables

(∀x)(∃y)[ Q(x,y) ∧ ¬P(x,y)] ∨ (∃w) (∀z)[Q(z,w) ∧ ¬R(z,w)]


(∀x)[Q(x,f(x)) ∧ ¬P(x,f(x))] ∨ (∀z)[Q(z,A) ∧ ¬R(z,A)]
[Q(x,f(x)) ∧ ¬P(x,f(x))] ∨ [Q(z,A) ∧ ¬R(z,A)]
[Q(x,f(x)) ∨ Q(z,A)] ∧ [Q(x,f(x)) ∨ ¬R(z,A)] ∧ [¬P(x,f(x)) ∨ Q(z,A)] ∧ [¬P(x,f(x)) ∨ ¬R(z,A)].

Problem 2. In what order A*-algorithm will visit the nodes in the graph below (h(x) is the
heuristic estimation of the distance from node x to one of the final nodes).
f(n)=g(n)+h(n) /g(n) – distance to node n from the initial node/

Node g(n) f(n) → Node Edge → Node Edge Node


s 0 1 → b 2 → a 3
a 6 → c 1 → d 3 → b 3
b 2 5 → d 3 → c 5
c → d 2 →
d 5

Problem 3. Formalize the following arguments and verify whether they are correct:
3.1) “If Carlo won the competition, then either Mario came second or Sergio came third. Mario
didn’t come second. Thus, if Carlo won the competition, then Sergio didn’t come third.”
C - Carlo won the competition, M – Marion came second, S- Sergio came third.

3.2) “If you play and you study you’ll pass the exams, while if you play and don’t study you won’t
pass. Thus, if you play, either you study and you’ll pass the exams, or you don’t study and you
won’t pass.”
P- you play, S- you study, E- you pass the exam
Problem 4.

Use the truth tables method to determine whether (¬p ∨ q) ∧ (q → (¬r ∧ ¬p)) ∧ (p → r) is satisfiable.

p q r ¬p ¬q ¬r ¬p ∨ q ¬r ∧ ¬p q → (¬r ∧ ¬p) p→r ¬p ∨ q Final formula

Problem 5. Follow RS method to check if (a → b) → ((b → c) → (a → c)) is a tautology.


RS-Tree has to be constructed.
(a → b) → ((b → c) → (a → c))
¬(a → b), ((b → c) → (a → c))
a, ((b → c) → (a → c)) ; ¬b, ((b → c) → (a → c))
a, ¬ (b → c), (a → c)); ¬b, ¬ (b → c), (a → c))
a, b, (a → c); a, ¬ c, (a → c); ¬b, (a → c) ; ¬b, c, (a → c)
a, b, ¬ a, c; a, ¬ c, ¬a, c; ¬b, ¬a, c ; ¬b, c, (a → c)
fundamental fundamental no
Problem 6. Consider the following sentences: 1. All actors and journalists invited to the party
are late. 2. There is at least a person who is on time. 3. There is at least an invited person who
is neither a journalist nor an actor.
Formalize the sentences and prove that 3. is not a logical consequence of 1 and 2.
Predicates: I(x) – x invited to party, L(x) – x is late, A(x) – x is actor, J(x) – x is journalist
I(x) ^ (A(x) v J(x)) -> L(x) is equivalent to: ¬L(x) -> ¬I(x) v ¬(A(x) v J(x))

We know that (x) ¬L(x) it means that ¬L(P) is true for some person P
and the same ¬I(P) v ¬(A(P) v J(P)) is true.
It shows that non invited journalists/actors can be on time.
Problem 7. Convert the following formulas to CNF and check if they are satisfiable:
(1) ¬((((a → b)) → a) → a)
(2) ¬((p → (q → r))) → ((p → q) → (p → r))

(3) (x)(y)[p(x) → q(x,y)]  (x)(y)q(x,y)

(4) (x)(y)[[pq   r(x,y)  s(x)] → ( q  s(x))


Solution:
Number (3)

(x)(y)[p(x) v q(x,y)]  (w)(z)q(w,z)

(x)(y)[ p(x) ^ q(x,y)]  (w)(z)q(w,z)

(y)[ p(B) ^ q(B,y)]  (z)q(A,z)

p(B) ^ q(B,y)  q(A,z)

Problem 8. Consider the following facts:


Anyone whom Mary loves is a football star. Any student who does not pass does not play. John
is a student. Any student who does not study does not pass. Anyone who does not play is not a
football star.
Predicates: M(x) – [Mary loves x], F(x)- [x is a football star], P(X) – [x passed the exam], G(x)
– [x play football], S(x) – [x is a student], St(x) – [x studies].
Prove that: If John does not study, then Mary does not love John.
Formulas:
M(x) → F(x)

[S(x)  𝑃(𝑥)] → 𝐺(𝑥)


S(J)

[S(x)  𝑆𝑡(𝑥)] → 𝑃(𝑥)

G(x) → F(x)

Prove that: St(J) → M(J)


After conversion to the set of clauses, we get:

(1) M(x)  F(x)

(2) S(x)  𝑃(𝑥)  𝐺(𝑥)


(3) S(J)
(4) S(x)  𝑆𝑡(𝑥)  𝑃(𝑥)

(5) 𝐺(x)  F(x)

Negation of the goal:  [St(J)  M(J)] which is

(6)  St(J)
(7) M(J)
Resolution Steps:
(1)+(7) gives (8) F(J)
(8)+(5) gives (9) G(J)

(3)+(4)+(6) gives (10) P(J)

(10)+(2)+(3) gives (11) 𝐺(𝐽)


(11)+(9) gives NIL
Problem 9. Consider the following axioms:
Every coyote chases some roadrunner. Every roadrunner who says ``beep-beep'' is smart. No
coyote catches any smart roadrunner. Any coyote who chases some roadrunner but does not
catch it is frustrated.
Prove that: If all roadrunners say ``beep-beep'', then all coyotes are frustrated.
Predicates: Ch(x,y) – [x chases y], Cat(x,y) – [x catches y], S(x) – [x says “beep-beep”],
Sm(x) – [x is smart], F(x) – [x is frustrated].
Functors: Co(x) – [x is coyote], R(x) – [x is roadrunner]
Formulas:

(x)(y)Ch(Co(x),R(y)) , S(R(y)) → Sm(R(y)), (x)[Cat(Co(x), R(y))  Sm(R(y))],

[Ch(Co(x), R(y))  cat(Co(x)), R(y))] → F(Co(x))

Prove that: (y)S(R(y)) → (x)F(Co(x))

Negation of the goal:  [(y)S(R(y)) → (x)F(Co(x))] which is S(R(y))  F(Co(fo))]


After conversion to the set of clauses, we get:

(1) Ch(Co(x),R(f1(x))) (2) S(R(y))  Sm(R(y)) (3) Cat(Co(x), R(y))  Sm(R(y))

(5) Ch(Co(x), R(y))  cat(Co(x), R(y))  F(Co(x))

Prove that:  (y)S(R(y))  (x)F(Co(x))

Its negation: (6) S(R(y)) (7) F(Co(fo))


Resolution steps: (1)+(5)+(7) gives (8): cat(Co(fo), R(f1(x)))
(8) + (3) gives (9): Sm(R(f1(x)))
(2) + (6) gives (10): Sm(R(y))
(10) + (9) gives NIL

Problem 10. Consider the following axioms: Every child loves every candy. Anyone who loves
some candy is not a nutrition fanatic. Anyone who eats any pumpkin is a nutrition fanatic.
Anyone who buys any pumpkin either carves it or eats it. John buys a pumpkin. Lifesavers is a
candy.
Prove that: If John is a child, then John carves some pumpkin.
Functors:
ca(y) – y is candy; p(y) – y is pumpkin; J- John; Life – Lifesavers
Predicates:
nf(x) – x is nutrition fanatic; L(x,y) – x loves y; Et(x,y) – x eats y;
Car(x,y) – x carves y; B(x,y) – x buys y ; C(x) – x is a child
Formulas:
C(x) → L(x, ca(y))

(y)L(x, ca(y)) → nf(x)


Et(x,p(y)) → nf(x)

B(x, p(y)) → Et(x,p(y))  Car(x, p(y))


B(J, p(y))

Prove that: C(J) → (y)Car(J,p(y))


After conversion to the set of clauses, we get:

(1) C(x)  L(x, ca(y)) (2)  L(x, ca(y))  nf(x) (3) Et(x,p(y))  nf(x)

(4) B(x, p(y))  Et(x,p(y))  Car(x, p(y)) (5) B(J, p(y))

Negation of the goal:  [C(J)  (y)Car(J,p(y))] which is:

(7) C(J) (8)  Car(J,p(y))


Resolution steps:

(1)+(7) gives (9): L(J, ca(y)) (9)+(2) gives (10): nf(J)

(10)+(3) gives (11): Et(J,p(y)) (4) + (11) + (5) + (8) = NIL

You might also like