set(arithmetic).
assign(domain_size,11).            %max n(n+1)/2 for nxn grid
assign(max_models,-1).

formulas(kakurasu2).
  all x all y f(x,y) < 2.
  all x  (f(x,0) + f(x,1)*2 + f(x,2)*3 + f(x,3)*4 = right(x)).
  all y  (f(0,y) + f(1,y)*2 + f(2,y)*3 + f(3,y)*4 = bottom(y)).
  all x (x > 3 -> right(x) = 0 & bottom(x)= 0).
  all x all y (x > 3 | y > 3 -> f(x,y)=0).
end_of_list.

formulas(puzzle).
  right(0)  = 4 & right(1)  = 6  & right(2)  = 8 & right(3)  = 9.
  bottom(0) = 5 & bottom(1) = 6  & bottom(2) = 9 & bottom(3) = 8.
end_of_list.
