Skip to content

Instantly share code, notes, and snippets.

@fnordomat
Created July 20, 2020 10:51
Show Gist options
  • Save fnordomat/2fc84a46fd83af03f9d5decdcb259f93 to your computer and use it in GitHub Desktop.
Save fnordomat/2fc84a46fd83af03f9d5decdcb259f93 to your computer and use it in GitHub Desktop.
# for some reason this was missing from Z3py:
def Sequence(name, ctx=None):
"""Return a sequence constant named `name`. If `ctx=None`, then the global context is used.
>>> x = Sequence('x')
"""
ctx = z3.get_ctx(ctx)
int_sort = z3.IntSort(ctx)
return z3.SeqRef(
z3.Z3_mk_const(ctx.ref(),
z3.to_symbol(name, ctx),
z3.SeqSortRef(z3.Z3_mk_seq_sort(int_sort.ctx_ref(), int_sort.ast)).ast),
ctx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment