Datatype expressions.
Definition at line 5534 of file z3py.py.
| def update_field |
( |
|
self, |
|
|
|
field_accessor, |
|
|
|
new_value |
|
) |
| |
Return a new datatype expression with the specified field updated.
Args:
field_accessor: The accessor function declaration for the field to update
new_value: The new value for the field
Returns:
A new datatype expression with the field updated, other fields unchanged
Example:
>>> Person = Datatype('Person')
>>> Person.declare('person', ('name', StringSort()), ('age', IntSort()))
>>> Person = Person.create()
>>> person_age = Person.accessor(0, 1) # age accessor
>>> p = Const('p', Person)
>>> p2 = p.update_field(person_age, IntVal(30))
Definition at line 5541 of file z3py.py.
5542 """Return a new datatype expression with the specified field updated.
5545 field_accessor: The accessor function declaration for the field to update
5546 new_value: The new value for the field
5549 A new datatype expression with the field updated, other fields unchanged
5552 >>> Person = Datatype('Person')
5553 >>> Person.declare('person', ('name', StringSort()), ('age', IntSort()))
5554 >>> Person = Person.create()
5555 >>> person_age = Person.accessor(0, 1) # age accessor
5556 >>> p = Const('p', Person)
5557 >>> p2 = p.update_field(person_age, IntVal(30))
5560 _z3_assert(
is_func_decl(field_accessor),
"Z3 function declaration expected")
5561 _z3_assert(
is_expr(new_value),
"Z3 expression expected")
5562 return _to_expr_ref(
def update_field(self, field_accessor, new_value)
Z3_ast Z3_API Z3_datatype_update_field(Z3_context c, Z3_func_decl field_access, Z3_ast t, Z3_ast value)
Update record field with a value.