1. naloga ========= a) La = [[]]. b) Lb = [[],[3]]. c) Lc = [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]. Potenčna množica. d) Ld = [[3],[1,3],[2,3],[1,2,3]]. Rez ne spremeni rešitve. e) subset(L, S) :- p(L, [], PS), memb(S, PS). 2. naloga ========= a) s --> []. s --> [_]. s --> [X], s, [X]. b) pal(L, P) :- conc(L, _, P), s(P, []). 3. naloga ========= a) true. false. true. b) S = 210. true. X = 125. c) Z uporabo CLP(R) zna prolog izračunati vrednost spremenljivke X v zadnjem vprašanju prejšnje točke. d) c1(L) :- all_different(L), \+ (member(X, L), \+ member(X, [1,2,5,10,20,50,100,200])). 4. naloga ========= a) wp(INV, invariant INV while B do S, PostCond) :- wp(Cond, S, INV), theorem(B and INV => Cond), theorem(not B and INV => PostCond). b) INV1 and wp(Cond2, S2, INV2) and (B2 and INV2 => Cond2) and (not B2 and INV2 => INV1) and (B1 and INV1 => INV2) and (not B1 and INV1 => PostCond1) -ali- wp(INV1, INV1 while B1 do (INV2 while B2 do S2), PostCond1):- wp(Cond2, S2, INV2), theorem(B2 and INV2 => Cond2), theorem(not B2 and INV2 => INV1), theorem(B1 and INV1 => INV2), theorem(not B1 and INV1 => PostCond1).