3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00

allow coercion from Boolean to Int/Real, fixes #78

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-05-07 21:36:37 -07:00
parent dc52ebd312
commit ad39811dc0

View file

@ -1229,13 +1229,13 @@ class BoolSortRef(SortRef):
return val
def subsort(self, other):
return isinstance(other, ArithSortRef)
return isinstance(other, ArithSortRef)
def is_int(self):
return True
return True
def is_bool(self):
return True
return True
class BoolRef(ExprRef):
@ -1910,10 +1910,10 @@ class ArithSortRef(SortRef):
return val
if val_s.is_int() and self.is_real():
return ToReal(val)
if val_s.is_bool() and self.is_int():
return If(val, 1, 0)
if val_s.is_bool() and self.is_real():
return ToReal(If(val, 1, 0))
if val_s.is_bool() and self.is_int():
return If(val, 1, 0)
if val_s.is_bool() and self.is_real():
return ToReal(If(val, 1, 0))
if __debug__:
_z3_assert(False, "Z3 Integer/Real expression expected" )
else: