Bioinformatics Tutorial Questions 1 – 15th January 2003

websterhissBiotechnology

Oct 1, 2013 (4 years and 3 months ago)

181 views

Artificial Intelligence Tutorial 3
-

Answers


1a) Translate the following sentences into first order logic.


(i)


All dogs are mammals

(ii)


Fido is a dog

(iii)

Fido is a mammal

(iv)


All mammals produce milk


1b) U
se the Modus Ponens deduction rule to deduce sentence (iii)
from (i) and (ii). What did you
unify in order to use Modus Ponens, and what substitution made the unification possible?


1c) Write the answers from part (a) in conjunctive normal form.


1d) Translate the following sentence into CNF: “There exists a dog w
hich doesn’t produce milk.”

[You will have to use
skolemisation
for this


see the lecture notes. Also Russell & Norvig give a
good explanation.]


1e)

Explain, in English, why this new sentence contradict sentences (i) to (iv) from part (a).



1a) The tra
nslation into first order logic is fairly straightforward:

(i)




堠X摯g⡘⤠


浡浭慬⡘⤩.

⡩椩


dog(fido).

(iii)

mammal(fido).

(iv)




堠X浡浭慬m堩


浩汫⡘⤩.


ㅢ⤠1漠畳e⁍潤畳⁐潮on猬⁷seed⁡⁳ 湴敮ne⁴桡琠䄠業灬pe猠BⰠ,湤⁡⁳ 湴e湣e⁳瑡瑩湧⁴桡琠t⁩猠 牵e⸠
We will then deduce B from it. Our “A implies B” sentence will be (i) abo
ve and our “A is true
sentence” will be (ii) above. However, the left hand side of (i) is: dog(X), whereas (ii) is: dog(fido),
獯Ⱐa猠楴 獴慮摳Ⱐ睥 ca湮n琠畳u 䵯摵猠m潮o湳⸠p漬o睥 浵獴 畮楦y 摯木g⤠an搠摯dE晩摯f⸠周楳q楳i摯湥
by 獵扳s楴畴u湧 瑨t c潮獴a湴nf
楤漠景f 堮ute ca渠n潷oa灰py 瑨t猠獵扳s楴畴uo渠a猠灡牴r潦o瑨t 摥摵d瑩o渠
獴数⸠呯⁳桯s⁴桡琠瑨攠摥摵d瑩潮⁨o猠潣c畲牥搬⁷e⁷ 楴e⁩ ⁡猠景汬潷猺




堠X摯g⡘⤠


浡浭慬m堩⤠Ⱐ††
摯g⡦楤i⤮


浡浭慬m晩摯f


Beca畳u 浡浭慬m晩摯f a灰pa牳r扥汯眠瑨攠汩湥Ⱐwe 桡癥 摥摵ce搠瑨t猠獥湴敮ne 畳楮g 潵爠獵扳s楴畴u潮o
a湤⁴桥⁍潤畳⁐潮o湳⁲n汥l


ㅣ⤠Re浥浢m爠瑨慴tC乆N獥湴敮ne猠a牥 摩獪畮u瑩潮猠潦o汩瑥ta汳Ⱐ睨w牥 a 汩
te牡氠ca渠扥 a 灲p摩ca瑥to爠
湥条瑥搠 灲p摩da瑥⸠ We a汳漠 湥e搠 瑯t 牥浥浢m爠 瑨攠 牥睲楴e 牵汥猠 瑨攠 汥lt畲u 湯瑥猠 灲p獣物扥搠 景爠
瑵牮楮t a 湯牭n氠晩f獴so牤e爠獥湴敮ce 楮i漠a C乆 se湴敮ne. F潲 瑨敳t pa牴楣畬慲 獥湴敮ce猬swe 湥e搠to
牥浥浢m爠瑨e⁲ w物瑥⁲畬e


R㨠:



夠Ya渠扥 牥
-
睲楴瑥渠t猠s堠


夠Y湤⁶楣e⁶ 牳r


䅬獯A牥浥浢m爠瑨慴t睥 a獳畭e 畮楶敲獡氠煵q湴nf楣i瑩潮景f C乆 獴慴s浥湴献n周T 景畲 獥湴敮ne猠a牥
瑨敲e景fe⁥x灲p獳敤⁩渠s乆⁡猺

⡩(


¬ dog(X)


浡浭慬m堩

⡩椩


dog(fido)

(iii)

mammal(fido)

(iv)


¬ mammal(X)


milk(X)


1d) This
new sentence is a little trickier to translate into CNF. Firstly, we need to write it in standard
first order logic. We see that it is an existence statement, therefore requires an existential quantifier.
Also, there is a conjunction in there (an object wh
ich is a dog
and

doesn’t produce milk) and the
doesn’t

will be modelled with a negate sign. Thus, we get:



X (dog(X)


¬milk(X))


Now, our first problem is that we cannot have existentially quantified variables in CNF, because
variables are assumed to be
universally quantified, and we can’t have any exceptions. Remember the
existential elimination rule? We can do something similar here: if we know that some animal exists
which is a non
-
milk
-
producing dog, then why don’t we just give it a name? We have to b
e careful
not to use a constant name which has been used already (so, lets avoid fido), but that is the only
restriction. Lets use the name: some_animal. This means we can remove the existential quantifier
and simply write:


dog(some_animal)


¬ milk(some_
animal)


Note that the process of introducing a new constant or function in order to remove the existential
quantification is known as Skolemisation, although the full Skolemisation process is a little more
complicated. Don’t think we’ve finished, however:

we have a conjunction, so our sentence is not in
conjunctive normal form. In fact, we need to think of this as two clauses, both of which will be in
CNF:


dog(some_animal)


¬ milk(some_animal)


As CNF is taken to be a big conjunction of all the disjunctio
ns, we haven’t lost anything by thinking
of our single sentence as two others. In English, we’re saying that there is some animal which is a
dog and that the same some animal does not drink milk. It should be clear that this is equivalent to
the original s
entence.


1e) Dogs are mammals and mammals produce milk, so dogs produce milk. That means there can’t
be a dog which doesn’t produce milk, but our answer from part (d) says there is. So (d) must be
contradicting (i) to (iv).



2a) Write down a substitutio
n which unifies the following sentences:


(i)

likes(homer, dinner(X))


(today(A)


dinner(X)).

(ii)

likes(homer, dinner(cooked_by(Y)))


(today(Z)


dinner(cooked_by(marge))).


[Universal quantification of variables is assumed.]


2b) What are the compound operator
s in sentence (i) from part (a)? For each compound expression
X, write down the results of the functions args(X) and op(X). [Refer to the unification algorithm
given in lecture 8 for the explanation of these functions].


2c) Explain why these two sentences

cannot be unified:


(i)

p(X)


(q(f(X))


r(Y)).

(ii)

p(X)


(q(X)


r(s)).



2a) We are looking to replace variables with terms which make the two sentences look the same.
For these sentences, if we replace X by cooked_by(Y), then the sentences become:


likes(homer, dinner(cooked_by(Y)))


(today(A)


dinner(cooked_by(Y))).

likes(homer, dinner(cooked_by(Y)))


(today(Z)


dinner(cooked_by(marge))).


These sentences look more similar, but, looking at the end of sentence 2, we see that Y will need to
be r
eplaced by marge. This gives us:


likes(homer, dinner(cooked_by(marge)))


(today(A)


dinner(cooked_by(marge))).

likes(homer, dinner(cooked_by(marge)))


(today(Z)


dinner(cooked_by(marge))).


Now we simply have to substitute A for Z (or vice versa). Thi
s gives us:


likes(homer, dinner(cooked_by(marge)))


(today(A)


dinner(cooked_by(marge))).

likes(homer, dinner(cooked_by(marge)))


(today(A)


dinner(cooked_by(marge))).


Which are exactly the same. Hence the substitution is {X/cooked_by(Y), Y/marge, Z/
A}. As we are
substituting Y by marge, we should do this in the cooked_by replacement for X. Hence, we should
write the substitution as: {X/cooked_by(marge), Y/marge, Z/A}.


2b) Firstly, the compound operators (as described in the unification algorithm) a
re either predicates,
functions or connectives. Hence in the sentence (i) from part (a), the following are compound
operators: likes, dinner, today,

,

. These symbols would also be returned by the op function, by
definition (see the lecture notes).


Th
e args function returns a list of arguments for a predicate, function or connective. Hence, for the
predicates and functions, the args function would calculate:


args(likes(homer, dinner(X))) = [homer, dinner(X)]

args(dinner(X)) = [X]

args(today(A)) = [A]

args(dinner(Y)) = [Y]


and for the connectives, the args function would calculate:


args(today(A)


dinner(Y)) = [today(A), dinner(Y)]

args(likes(homer, dinner(X))


(today(A)


dinner(Y))) =



[likes(homer, dinner(X)), (today(A)


dinner(Y))]


2c) Here, we see that substituting ground symbol s for variable Y doesn’t cause a problem. It
appears, however, that we also need to substitute f(X) for X. If we do this to both sentences, w
e get:


p(X)


(q(f(f(X)))


r(s))

p(X)


(q(f(X))


r(s))


So, the substitution has not unified the two sentences. If we continued trying to substitute X by f(X),
we would just get longer sentences, not a unification. This is called an
occurs
-
check error
. The
unification algorithm is designed to check that something which is being substituted for something
else does not contain the thing it is being substituted for (as above), and when this is the case, it fails,
as the occurs
-
check error would happen.




3) Rewrite the following propositional sentence to be in conjunctive normal form:


(P


Q)


¬(Q


¬R)



We are going to use the propositional rewrite rules to turn the sentence into conjunctive normal
form, i.e., a conjunction of bracketed disjunctiones
, e.g., (X








(䄠


B⤬ e瑣t 周T牥 楳i獯浥
瑲楡氠a湤ner牯r 楮癯i癥搠he牥


don’t be surprised if some re
-
睲楴楮g c桯楣e猠y潵o浡me 瑵牮t潵琠瑯tbe
扡搠d桯楣h献†周e牥⁩猠a⁳歩汬⁴漠畳楮i⁴桥獥⁲ w物瑥⁲畬 猬⁷桩s栠ha渠扥 a牮e搠潶d爠瑩re.


te⁳瑡 琠
睩瑨w


⡐E





¬⡑


¬R)


Whenever you see an implication, it’s a good idea to get rid of it straight away. So, using the
e煵楶慬q湣e⁴桡琠 m


儩⁣a渠扥⁲e睲楴瑥渠a猠sP


儠Qe ge琺


⢬P





¬⡑


¬R)


S業楬a牬yⰠ睨e湥ve爠y潵獥e⁡ 条瑩潮⁡牯畮r a
bracket (which isn’t allowed in CNF), it’s a good
idea to get rid of this as soon as possible. Hence, using one of de Morgan’s laws, we see that

¬⡑


¬R⤠)a渠ne⁷ 楴瑥t⁡猠⢬儠


¬¬R⤮⁗e⁷楬 灲潢p扬y 睡湴⁴漠牥浯me⁴桥⁤潵扬  ga瑩潮⁩渠
瑨攠獡浥⁳瑥瀬p
g楶i湧⁵猺


⢬P





⢬儠





Introducing the conjunction sign seems to be a step backwards, but it’s not a problem if we move it
潵瑳o摥 潦o瑨攠扲bc步琮tte ca渠畳u 瑨攠摩獴物扵瑩癩vy 潦oo爠潶o爠a湤n瑯td漠瑨t猺s堠





Z⤠ca渠扥
睲楴瑥渠a猠⡘









Z⤮)I映睥 浡me 堠扥 ⢬P


儩Ⱐ夠扥 ¬儠a湤nZ 扥 RⰠ瑨敮t瑨攠牥睲楴瑥渠
獥湴敮ne⁩猺


⠨¬P





¬Q⤠)


(⢬P








If⁷ 潷 晬f瑴e渠瑨攠摩獪畮u瑩潮猬⁷ ge琺


⢬P





¬儩†


⢬P








扵琬⁷b⁣a渠ne灬慣e⁑


¬儠楮⁴桥⁦楲獴⁣污畳e⁴漠杩癥⁵猺


⢬P


呲略⤠)


(¬P








a湤n⢬P


呲略⤠楳ia汷ay猠瑲略⸠䡥nce 瑨e 汥l琠han搠c污畳l 楳ia汷ly猠瑲略, s漠瑨攠瑲畴栠潦瑨攠se湴敮ne
潮y⁤ pe湤猠潮⁴桥⁲ g桴⁨ 湤⁣污畳l⸠䡥湣eⰠ睥 ca渠牥睲楴e⁴桥⁳ 湴e湣eⰠ晩湡汬yⰠ,猺


⢬P