Sunteți pe pagina 1din 4

\f (GC r (~-7 ~(V'1 ( v i rJ ey) -7 Li X~( ,/,Y))1

j ') (\

University of Jordan

King Abdullah II School for Information Technology

Computer Information Systems Department

Summer Semester 2008/2009

Artificial Intelligence (1932341 )

Mid Term Exam 27/07/2009

~} 0 fj \Cf { (:~4-l 1 ~) '


~ (-- ..)~ ...) :U".).wIl""'1

ComputerJU.com
Question 1 [5 Points]

Express in First Order Predicate Calculus (FOPC) each of the following sentences

~ 1. Only frogs that like birds are gree,n , ~ )~

~ X J ts. t i[fT:=J:l.+-'P=r-X=fiH+-f} CX )~-~) ~


'f :(I;_ryLI~~a(;r:::(~~t6C~e)rs~r; x(ei)t: ents. s ( XI Y)J) (j)
_v:terY~I~
~ T~-s~ude~t
t~~n;pa;
~ s sled~hi
t e~hi~s~o~~e~
t ry x~m;;:
a~ n~med
a~ H
3. E
~ ¥ f (l,i C1<'') N xyJ
-\- -\­

4. John is smarter than every student that passed an IT exam.


~i-- ( 5( X ) i\ P(X 17~ 5 vnVt t ~ e ( ( S ~ M ~ ( X'-=1 l-\ '/
V
, 5. An IT student gets a gOM job if she/he does a good project. if
't f.. (:,C1/1\ Good -j (6 ) t cl- ( X) d
Good->o''<:A''f..
Questio.n 2 [5 Points] . /~ ¢
1. Consider the followmg argument r ~ ;. R~
r . From ,PI P3 CD -7 y \\d-- 51 I

. P3 --:} P2. Q) ~
,P2. Q) ~l
We can infer Pl .
Is this conclu sion valid? Answer with Y for Yes or N for No ye s
Explain: Why: b U ' ~ VS t o> ,2.. t-(\( us -I- V1C \ f-- ., ~ ) /
Ci AcJ 'r p ) h:>l"f5 u ~ ~- "' 0\ l- . 't (r 9\ z: \~ \/
o r V:; i .'\.") ~. ~ s ~ {)r
2. what is the answer to each of the following queries

(a) ?- X = := 3+5.
D (
( {)\ :, 't V
I)

/
U II
ev
(be
cy
; ",ch . \'~ '1'0, ?-el )

(b) ?- X = 2, Y = 3, Z = X+Y. irx 2(Jb...,


r
v

(c) ?-X= [2,3,4,5], X= [2,3IY]. t. =rrA./............


'1 J
../
ComputerJU.com
Question 3[6 Point]
(a) Consider the followin g FOPC sentences:

( l)(\ix) (M(x)VP (X) ~S(x) 1 ( (V\ (x) V f Cf ») V ) eX) =) ~;v' (x) ;,, -t Pex( V5 (;
(2) ("1 x)(K(x) ~ L(x)) . ' t< l X) V ~ t» )

,-(5) ("1 x)(U(x) ~ W(x.) ~ ( L ) V


(6)("1 x)(H(x) ~ L(x))
-t rc> ­
'-A J,
U ex.) v v.J J Sf'
:7
(3)(\ix)( L(x)/\ S(x) ~W(x)) f(LC-,x ) /\5C x
) ) \/ vJC)( ) "==') -tL- C;<. ) V' ) ( y ) y\J()
. (4) ("1 x)(R(x) ~ U(x)) - -, R' \

( H( 7'') L-- lr- )


(7) [M(Fadi)/\K(Fadi)]V {j(Fadi)
'. . '

Prov e using the resolution refutation method that


W(Fadi)
Note: your proof must be well structured with clear justified steps.
,/

..--,f\ ( 1- ) A~ PC X)'" 5> V) I

/
/ /
/ I

X ) 17~X )( LU))
./

\\

ComputerJU.com

Question 4 [6 Points]

What is the value of each of the Zi's in each of the following Prolog Clauses?

1. b([] ,l]).
b([XIY], [X1IL1J) :- X mod 3 =:= 2, Xl is X-1,b(Y, L1) .
b([XIY] , L1):- b(Y, L1) .
b([XIY] , L1) :- X mod 2 =:= 1, b(Y , L1).

?- b([ll , 41,32 ,33, 12,69, 103,62] , ZI) .

Zl=
. I) I '-.J ( R. I \.1

'"
'tv!
\/
I
/'

---r
/

R.
2. d(X , N, [], [D.
d(X , 0, L, L).
d(X, 1, [YIZ]' Z).
d(X,N,[XIL],L1) :- N1 is N-2, d(X, N1, L,L1).
d(X,N,[Y IL]'[YIL2J) :- N2 is N-1 , d(X , N2, L,L2).

?- d(l0,10 , [5,10 ,11 ,10 ,64 ,10 ,102 ,10 ,103], Z2) . <; / U

cA
Z2= - - - -' 7 - - - ­

3. f(X, [], X).


f(X, [YIL], Z) :- X > Y, f(Y , L, Z).
f(X, [YIL], Z) :- f(X, L, Z).

?- f{-81, ([6,42, 18

Z3= [ 60

ComputerJU.com

Question 5 [8 Points]
Write in prolog the following clauses.

I, split(L, L I, L2) that take s a list L and returns two lists LI and L2 where L I contains

the numbers of L, which are divisible by 3 and L2 contain s the numbers of L, which are

divisible by 7 and in the some order.

Example:
?split([11 ,12,13,14,24,26,49,18,69,lll], ZI ,Z2) yields

Zl = [12, 24, 18,69, Ill] and

Z2 = [14,49]

5' f (i t (l) r I: j i [ J ') 0

5F I ~ (, 1" L1 ( i» I L.!J" L- 1,) ; - >< ~o J '3 ~ : -;:o /

i'

c- ' 5'f" (\-(L- r [ ( r CL ) ../


S f L ~ ( [ X \ L-l ( L-l ( [ X \ L:Z) ') ;- X tv' D d 7 :::: ".-:::- 0 I
;;;pl '( \- ( L r L II L-Z- ).,
f~ C- L ( 2- '

2. del(A,K ,L, L I) where L I is the same as L except that the x" occurrence of A in L is
deleted.
Example:
?del(5,2,[11,5, 10,5,20,5,30,40], V) returns -CJ

h[;\5;O;2t;~~'\:~iLl . / (y

J-:-b~ I ~
~C)\fi=rr
­

d{ ( (P ( V\ / [~ \ L J t \):­ I

~ ~
K\ ~.; \{ - \ j

S p li ~ C!'/K\/ l-/ LJ )f)

S-ar putea să vă placă și