Public Member Functions | |
def | num_constructors |
def | constructor |
def | recognizer |
def | accessor |
![]() | |
def | as_ast |
def | get_id |
def | kind |
def | subsort |
def | cast |
def | name |
def | __eq__ |
def | __ne__ |
def | __hash__ |
![]() | |
def | __init__ |
def | __del__ |
def | __deepcopy__ |
def | __str__ |
def | __repr__ |
def | __eq__ |
def | __hash__ |
def | __nonzero__ |
def | __bool__ |
def | sexpr |
def | as_ast |
def | get_id |
def | ctx_ref |
def | eq |
def | translate |
def | __copy__ |
def | hash |
![]() | |
def | use_pp |
Additional Inherited Members | |
![]() | |
ast | |
ctx | |
def 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 4916 of file z3py.py.
def 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 4869 of file z3py.py.
Referenced by DatatypeSortRef.accessor().
def 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 4856 of file z3py.py.
Referenced by DatatypeSortRef.accessor(), and DatatypeSortRef.constructor().
def 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 4888 of file z3py.py.