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

Function EnumSort

lean_py/z3/core.py:1277–1287  ·  view source on GitHub ↗

Create an enumeration sort. Returns (sort, list_of_enum_constants).

(name: str, values: list[str] | tuple[str, ...])

Source from the content-addressed store, hash-verified

1275
1276
1277def EnumSort(name: str, values: list[str] | tuple[str, ...]) -> tuple:
1278 """Create an enumeration sort.
1279
1280 Returns (sort, list_of_enum_constants).
1281 """
1282 b = _DatatypeBuilder(name)
1283 for v in values:
1284 b.declare(v)
1285 sort = b.create()
1286 consts = [getattr(sort, v) for v in values]
1287 return sort, consts
1288
1289
1290def TupleSort(name: str, sorts: list[SortRef] | tuple[SortRef, ...]) -> tuple:

Callers 4

test_create_enumMethod · 0.90
test_enum_constantsMethod · 0.90
test_enum_distinctMethod · 0.90

Calls 3

_DatatypeBuilderClass · 0.85
declareMethod · 0.80
createMethod · 0.80

Tested by 4

test_create_enumMethod · 0.72
test_enum_constantsMethod · 0.72
test_enum_distinctMethod · 0.72