import os import pyboolector from pyboolector import Boolector if __name__ == "__main__": b = Boolector() print("Boolector version " + b.Version()) print() print(b.Copyright()) ### Creating Boolector nodes # Sorts _boolsort = b.BoolSort() _bvsort = b.BitVecSort(128) _arrsort = b.ArraySort(_bvsort, _bvsort) _funsort = b.FunSort([_boolsort, _boolsort, _bvsort, _bvsort], _boolsort) # Constants _const = b.Const("10010101") _zero = b.Const(0, 128) _ones = b.Const(-1, 129) _true = b.Const(True) _false = b.Const(False) _one = b.Const(1, 128) _uint = b.Const(77, 128) _int = b.Const(-77, 128) # Variables _var = b.Var(_bvsort, "var_symbol") _param = b.Param(_bvsort, "param_symbol") # used as function parameters
try: b.Set_opt(pyboolector.BTOR_OPT_INCREMENTAL, True) print("Expect exception to be raised (no context pushed).") b.Pop() except BoolectorException as e: print("Caught exception: " + str(e)) ### Creating Boolector nodes # Sorts _boolsort = b.BoolSort() # Try creating a bit-vector sort of size 0, # raises Exception try: print("Expect exception to be raised (bit-vector size of 0).") _bvsort = b.BitVecSort(0) except BoolectorException as e: print("Caught exception: " + str(e)) _bvsort = b.BitVecSort(128) _arrsort = b.ArraySort(_bvsort, _bvsort) _funsort = b.FunSort([_boolsort, _boolsort, _bvsort, _bvsort], _boolsort) # Constants _const = b.Const("10010101") _zero = b.Const(0, 128) _ones = b.Const(-1, 129) _true = b.Const(True) _false = b.Const(False) _one = b.Const(1, 128) _uint = b.Const(77, 128) _int = b.Const(-77, 128)
import os import pyboolector from pyboolector import Boolector, BoolectorException if __name__ == "__main__": try: # Create Boolector instance btor = Boolector() # Enable model generation btor.Set_opt(pyboolector.BTOR_OPT_MODEL_GEN, True) # Create bit-vector sort of size 8 bvsort8 = btor.BitVecSort(8) # Create expressions x = btor.Var(bvsort8, "x") y = btor.Var(bvsort8, "y") zero = btor.Const(0, 8) hundred = btor.Const(100, 8) # 0 < x ult_x = btor.Ult(zero, x) btor.Assert(ult_x) # x <= 100 ulte_x = btor.Ulte(x, hundred) btor.Assert(ulte_x) # 0 < y ult_y = btor.Ult(zero, y) btor.Assert(ult_y) # y <= 100 ulte_y = btor.Ulte(y, hundred) btor.Assert(ulte_y) # x * y mul = btor.Mul(x, y)