Skip to content
Discussion options

You must be logged in to vote
from z3 import *
SomeType = Datatype('SomeType')
SomeTypeS = DatatypeSort('SomeType')
SomeType.declare('nil')
SomeType.declare('some', ('someof', SeqSort(SomeTypeS), ))
SomeType = SomeType.create()
print(SomeType)
print(SomeTypeS)
print(SomeType.eq(SomeTypeS))

Background: the function "Datatype" creates a "builder" object where you can attach the constructors of a data-type.
The function "DatatypeSort" accesses the sort object of name 'SomeType'. Z3 does not have information about the accessors/constructors until you called the "create()" method on the builder, but it is possible to use it as a sort as you like.
In fact the sort SomeType that is returned will be identical to SomeTypeS.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by NikolajBjorner
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #6519 on January 04, 2023 20:06.