Public Member Functions | |
num_constructors (self) | |
constructor (self, idx) | |
recognizer (self, idx) | |
accessor (self, i, j) | |
Public Member Functions inherited from SortRef | |
as_ast (self) | |
get_id (self) | |
kind (self) | |
subsort (self, other) | |
cast (self, val) | |
name (self) | |
__eq__ (self, other) | |
__ne__ (self, other) | |
__hash__ (self) | |
Public Member Functions inherited from AstRef | |
__init__ (self, ast, ctx=None) | |
__del__ (self) | |
__deepcopy__ (self, memo={}) | |
__str__ (self) | |
__repr__ (self) | |
__eq__ (self, other) | |
__hash__ (self) | |
__nonzero__ (self) | |
__bool__ (self) | |
sexpr (self) | |
ctx_ref (self) | |
eq (self, other) | |
translate (self, target) | |
__copy__ (self) | |
hash (self) | |
py_value (self) | |
Public Member Functions inherited from Z3PPObject | |
use_pp (self) |
Additional Inherited Members | |
Data Fields inherited from AstRef | |
ast = ast | |
ctx = _get_ctx(ctx) | |
Protected Member Functions inherited from Z3PPObject | |
_repr_html_ (self) |
accessor | ( | self, | |
i, | |||
j ) |
In Z3, each constructor has 0 or more accessor. The number of accessors is equal to the arity of the constructor. >>> List = Datatype('List') >>> List.declare('cons', ('car', IntSort()), ('cdr', List)) >>> List.declare('nil') >>> List = List.create() >>> List.num_constructors() 2 >>> List.constructor(0) cons >>> num_accs = List.constructor(0).arity() >>> num_accs 2 >>> List.accessor(0, 0) car >>> List.accessor(0, 1) cdr >>> List.constructor(1) nil >>> num_accs = List.constructor(1).arity() >>> num_accs 0
Definition at line 5407 of file z3py.py.
constructor | ( | self, | |
idx ) |
Return a constructor of the datatype `self`. >>> List = Datatype('List') >>> List.declare('cons', ('car', IntSort()), ('cdr', List)) >>> List.declare('nil') >>> List = List.create() >>> # List is now a Z3 declaration >>> List.num_constructors() 2 >>> List.constructor(0) cons >>> List.constructor(1) nil
Definition at line 5360 of file z3py.py.
Referenced by accessor().
num_constructors | ( | self | ) |
Return the number of constructors in the given Z3 datatype. >>> List = Datatype('List') >>> List.declare('cons', ('car', IntSort()), ('cdr', List)) >>> List.declare('nil') >>> List = List.create() >>> # List is now a Z3 declaration >>> List.num_constructors() 2
Definition at line 5347 of file z3py.py.
Referenced by accessor(), constructor(), and recognizer().
recognizer | ( | self, | |
idx ) |
In Z3, each constructor has an associated recognizer predicate. If the constructor is named `name`, then the recognizer `is_name`. >>> List = Datatype('List') >>> List.declare('cons', ('car', IntSort()), ('cdr', List)) >>> List.declare('nil') >>> List = List.create() >>> # List is now a Z3 declaration >>> List.num_constructors() 2 >>> List.recognizer(0) is(cons) >>> List.recognizer(1) is(nil) >>> simplify(List.is_nil(List.cons(10, List.nil))) False >>> simplify(List.is_cons(List.cons(10, List.nil))) True >>> l = Const('l', List) >>> simplify(List.is_cons(l)) is(cons, l)
Definition at line 5379 of file z3py.py.