1. naloga ========= a) X = tomi, Qty = 6, P = 1.9, Value = 11.4 ; X = tina, Qty = 2, P = 1.9, Value = 3.8. b) ?- bought(X, A, _), bought(X, B, _), A \= B. c) ?- bought(Y, A, QA), price(A, PA), \+ (bought(_, B, QB), price(B, PB), QA*PA < QB*PB). 2. naloga ========= a) WP2(x,y,z) ≡ x² + (y+2)² ≥ z b) Exp ≡ z - 2x - 1 3. naloga ========= a) true. b) false. c) Sc = []. d) Sd = [1,2,3,4]. e) Gramatika deluje le s podanimi argumenti Min in Max. Prolog ne bo dal odgovora na poizvedbo ?- seq(1,Y,[1,2,3],[]). 4. naloga ========= table(X, Xmax, DX) --> {X > Xmax}, []. table(X, Xmax, DX) --> {X =< Xmax, X1 is X + DX, f(X, Y)}, [(X, Y)], table(X1, Xmax, DX). 5. naloga ========= a) all(X, chess_player(X) and famous(X) ==> beat(john, X)). b) all(P, professor(P) and all(C, course(C) and teach(P, C) ==> easy(C)) ==> likes(mary, P)). all(P, professor(P) and \+ exists(C, course(C) and \+ easy(C) and teach(P, C)) ==> likes(mary, P)). c) exists(S, student(S) and exists(C1, computer(C1) and brought(S, C1) and exists(C2, computer(C2) and brought(S, C2) and C1 \= C2))).