bv1.c
#include "../../include/boolector.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#define BV1_EXAMPLE_NUM_BITS 8
int
main (void)
{
Btor *btor;
BtorExp *x, *y, *temp, *old_x, *old_y, *eq1, *eq2, *and, *formula;
int result;
btor = boolector_new ();
x = boolector_var (btor, BV1_EXAMPLE_NUM_BITS, NULL);
y = boolector_var (btor, BV1_EXAMPLE_NUM_BITS, NULL);
old_x = boolector_copy (btor, x);
old_y = boolector_copy (btor, y);
temp = boolector_xor (btor, x, y);
boolector_release (btor, x);
x = temp;
temp = boolector_xor (btor, x, y);
boolector_release (btor, y);
y = temp;
temp = boolector_xor (btor, x, y);
boolector_release (btor, x);
x = temp;
eq1 = boolector_eq (btor, old_x, y);
eq2 = boolector_eq (btor, old_y, x);
and = boolector_and (btor, eq1, eq2);
formula = boolector_not (btor, and);
boolector_assert (btor, formula);
result = boolector_sat (btor);
if (result == BOOLECTOR_UNSAT)
printf ("Formula is unsatisfiable\n");
else
abort ();
boolector_release (btor, x);
boolector_release (btor, old_x);
boolector_release (btor, y);
boolector_release (btor, old_y);
boolector_release (btor, eq1);
boolector_release (btor, eq2);
boolector_release (btor, and);
boolector_release (btor, formula);
assert (boolector_get_refs (btor) == 0);
boolector_delete (btor);
return 0;
}