/***
!Test
expected:
- !Result
  solution: !Solution
    assignment:
    - true
    - true
    - true
***/

%
% SAT instance based on a DIMACS SAT problem generated by ./dimacs2minizinc.pl
%
% boolean variables
array [1..3] of var bool : assignment;
% formula
array [1..21] of int: Formula = [ 1, 2, 3, 1, 2, -3, 1, -2, 3, 1, -2, -3, -1, 2, 3, -1, 2, -3, -1, -2, 3 ];

%
% constraints
%

% clause 1
constraint (
  ( ( Formula[1] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[2] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[3] > 0 ) == assignment[3] )
);
% clause 2
constraint (
  ( ( Formula[4] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[5] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[6] > 0 ) == assignment[3] )
);
% clause 3
constraint (
  ( ( Formula[7] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[8] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[9] > 0 ) == assignment[3] )
);
% clause 4
constraint (
  ( ( Formula[10] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[11] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[12] > 0 ) == assignment[3] )
);
% clause 5
constraint (
  ( ( Formula[13] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[14] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[15] > 0 ) == assignment[3] )
);
% clause 6
constraint (
  ( ( Formula[16] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[17] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[18] > 0 ) == assignment[3] )
);
% clause 7
constraint (
  ( ( Formula[19] > 0 ) == assignment[1] ) \/ 
  ( ( Formula[20] > 0 ) == assignment[2] ) \/ 
  ( ( Formula[21] > 0 ) == assignment[3] )
);

solve satisfy;

output [
	"simple sat: ",
	show(assignment[1]), " ",
	show(assignment[2]), " ",
	show(assignment[3]), "\n"
];
