Assignment2 SOLUTIONFINAL
Assignment2 SOLUTIONFINAL
ASSIGNMENT 2
SOLUTION
(There can be many different answers to each question, the solutions shows only
one of the correct answer)
1. Translate the following English sentences into first-order logic formulas. Invent a
suitable vocabulary
a)
X((student(X) ^ takes_ADB(X))
b)
X((student(X)^takes_ADB(Xpasses(X))
c)
X((good_student(X) ^ flunks_exam(X))
d)
Brothers are siblings (express the fact that sibling is a symmetric
relation)
XY(brother(X,Y)^bother(Y,X) siblings(X,Y))
e)
XY(cousin (X,Y)
N M( parent_of (M,Y) ^ sibling (N,M) ^ parent_of (N,X) ^
(N=M)))
h)
j)
If one or more lives are lost then all lives are lost
Y X isFor(X,Y) ) ^ YX isFor(X,Y))
n)
Y X isFor(X,Y) Y X isAgainst(X,Y)
o)
X Y F(X, Y) means that there exists a particular X for ALL Y. That is, there is
some one who is the mother of everyone.
On the other hand, Y X F(X, Y) means that for ALL Y there exists some X. That
is, everyone has a mother.
4. Hanging Basket Problem
We have a basket hanger with three hooks (a top, middle, and bottom hook). We have a
green, blue, and yellow basket, and we can hang one on each hook. Each of the
baskets can contain one kind of fruit: apples, peaches, and lemons. The following should
hold true:
The top basket holds lemons.
The blue basket is hanging somewhere
below the basket containing the peaches.
The yellow basket is hanging somewhere
above the green basket.
Specify the representation of the states, operators, goal, start state and cost function.
States: There is possibility to hang the basket in 3! ways on the various hooks.
Also the fruits can be present in 3! ways in the different baskets. Therefore, total
number of possible states 3! X 3! = 6 X 6 = 36
Operators: Hanging a basket on a particular hook, moving up / down a basket,
putting / taking out fruit
Goal:
Placing
Top
Middle
Bottom
Start State:
Basket
Yellow
Green
Blue
Fruit
Lemons
Peaches
Apples
There are three missionaries and three cannibals on the left bank of a river.
They wish to cross over to the right bank using a boat that can only carry two at a
time.
The number of cannibals on either bank must never exceed the number of
missionaries on the same bank, otherwise the missionaries will become the
cannibals' dinner!
a) Specify the representation of the states, operators, goal, start state and cost
function.
b) Plan a sequence of crossings that will take everyone safely across.
T
T
F
F
T
F
T
F
Q
F
T
T
F
T
T
F
F
T
F
T
F
F
T
T
F
P ^ Q
P ^ Q
(P ^ Q) V (P ^ Q)
F
F
T
T
F
T
F
T
F
T
F
F
F
F
T
F
F
T
T
F
(P
Q) = ((P ^ Q) V (P ^ Q))
7. Prove that implication is transitive in the propositional calculus, that is, that
((PQ) ^ (Q R)) (P R)
PQ QR
((PQ) ^ (Q
R))
PQ
((PQ) ^ (Q R))
(P R)
T
T
T
T
F
F
F
F
T
T
F
F
T
T
F
F
T
F
T
F
T
F
T
F
T
T
F
F
T
T
T
T
T
F
F
F
T
F
T
T
T
F
T
F
T
T
T
T
T
T
T
T
T
T
T
T
T
F
T
T
T
F
T
T
11. I married a widow (lets call her W) who has a grown-up daughter (call her D). My
father (F), who visited us quite often, fell in love with my step daughter and married her.
Hence, my father became my son-in-law and my step-daughter became my mother.
Some months later, my wife gave birth to a son (S1), who became the brother-in-law of
my father, as well as my uncle. The wife of my father, that is, my step daughter, also had
a son (S2).
Using predicate calculus create a series of expressions that represent the situation in the
above story. Add expressions defining basic family relations such as the definition of
father-in-law and use modus ponens on this system to prove the conclusion that I am
my own grand daughter.
1. father (X,Y) ^ father (Y,Z) grandfather (X,Z)
2. father (X,Y) ^ married (Y,Z) father-in-law (X,Z)
3. father (X,Y) ^ mother (Y,Z) grandfather (X,Z)
4. father (X,Y) ^ father (X,Z) brother (Y,Z)
5. brother (X,Y) ^ grandfather (Z,Y) grandfather (Z,X)
6. married (I,W)
7. married (F,D)
8. father (I,S1)
9. father (I,D)
10.father (F,S2)
11.father (F,I)
12.mother (D,S2)
13.grandfather(I,S2)
USING 3:
9 ^ 12 grandfather (I, S2) (RESULT 1)
USING 4:
10 ^ 11 brother (S2,I) (RESULT 2)
USING 5: brother (X,Y) ^ grandfather (Z,Y) grandfather (Z,X)
Result2 ^ Result1
brother (I , S2) ^ grandfather (I, S2) grandfather (I, I)
THEREFORE, I AM MY OWN GRANDFATHER
Note:- Each question can have various answers, the solution has only shown one
of them!