MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / SetUnion

Function SetUnion

lean_py/z3/core.py:3638–3650  ·  view source on GitHub ↗

Set union via lambda.

(a: ArrayRef, b: ArrayRef, ctx: Context | None = None)

Source from the content-addressed store, hash-verified

3636
3637
3638def SetUnion(a: ArrayRef, b: ArrayRef, ctx: Context | None = None) -> ArrayRef:
3639 """Set union via lambda."""
3640 sort = a._sort
3641 if not isinstance(sort, ArraySortRef):
3642 raise TypeError("SetUnion requires set (array) arguments")
3643 dom = sort.domain()
3644 i = Const("__su_i", dom)
3645 a_i = BoolRef(SelectNode(a._ast, i._ast), _merge(a._vars, i._vars))
3646 b_i = BoolRef(SelectNode(b._ast, i._ast), _merge(b._vars, i._vars))
3647 body = Or(a_i, b_i)
3648 lam = Lambda(i, body)
3649 merged = a._vars | b._vars
3650 return ArrayRef(lam._ast, sort, merged)
3651
3652
3653def SetIntersect(a: ArrayRef, b: ArrayRef, ctx: Context | None = None) -> ArrayRef:

Callers 2

test_set_unionMethod · 0.90
test_set_unionMethod · 0.90

Calls 8

SelectNodeClass · 0.90
ConstFunction · 0.85
BoolRefClass · 0.85
_mergeFunction · 0.85
OrFunction · 0.85
LambdaFunction · 0.85
ArrayRefClass · 0.85
domainMethod · 0.45

Tested by 2

test_set_unionMethod · 0.72
test_set_unionMethod · 0.72