mirror of
https://github.com/Z3Prover/z3
synced 2025-05-31 19:29:13 +00:00
allow coercion from Boolean to Int/Real, fixes #78
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
dc52ebd312
commit
ad39811dc0
1 changed files with 7 additions and 7 deletions
|
@ -1229,13 +1229,13 @@ class BoolSortRef(SortRef):
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def subsort(self, other):
|
def subsort(self, other):
|
||||||
return isinstance(other, ArithSortRef)
|
return isinstance(other, ArithSortRef)
|
||||||
|
|
||||||
def is_int(self):
|
def is_int(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_bool(self):
|
def is_bool(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class BoolRef(ExprRef):
|
class BoolRef(ExprRef):
|
||||||
|
@ -1910,10 +1910,10 @@ class ArithSortRef(SortRef):
|
||||||
return val
|
return val
|
||||||
if val_s.is_int() and self.is_real():
|
if val_s.is_int() and self.is_real():
|
||||||
return ToReal(val)
|
return ToReal(val)
|
||||||
if val_s.is_bool() and self.is_int():
|
if val_s.is_bool() and self.is_int():
|
||||||
return If(val, 1, 0)
|
return If(val, 1, 0)
|
||||||
if val_s.is_bool() and self.is_real():
|
if val_s.is_bool() and self.is_real():
|
||||||
return ToReal(If(val, 1, 0))
|
return ToReal(If(val, 1, 0))
|
||||||
if __debug__:
|
if __debug__:
|
||||||
_z3_assert(False, "Z3 Integer/Real expression expected" )
|
_z3_assert(False, "Z3 Integer/Real expression expected" )
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue