Opgave 1 2.4 ------------------------------- crosswd(V1,V2,V3,H1,H2,H3) :- word(H1,_,A,_,B,_,C,_), word(H2,_,D,_,E,_,F,_), word(H3,_,G,_,H,_,I,_), word(V1,_,A,_,D,_,G,_), word(V2,_,B,_,E,_,H,_), word(V3,_,C,_,F,_,I,_). ------------------------------- explanation: The following variables have to match: _ _ _ _A_B_C_ _D_E_F_ _G_H_I_ _ _ _ Where _ is a character which doesn't have to match and a letter is a character which does have to match. The letters are read both vertically and horizontally, thus ABC, DEF and ADG BEH etc. 3.2 greater_than(suc(1),0). greater_than(suc(X),0) :- greater_than(X,0). greater_than(suc(X),suc(Y)) :- greater_than(X,Y). 4.3 twice([], []). twice([H|T],[H,H|Y]) :- twice(T,Y). 5.3 addone([], []). addone([H|T],[K|Y]) :- addone(T,Y), K is H + 1. Opgave 2 trans1(0,0). trans1(suc(X),K) :- trans1(X,Y), K is Y + 1.