python_domain
Domain
dataclass
¶
Compact domain model for compile2 without using expression wrappers.
Set-valued domains are modeled by their candidate atoms plus either an
explicit subset collection or None to mean that every subset of the
candidate atoms is valid.
set_uids
cached
property
¶
Return cached global ids for all possible concrete set values.
sets
cached
property
¶
Return all concrete set values represented by this domain.
all_subsets
classmethod
¶
all_subsets(*values: DomainAtom) -> Domain
Return a domain where every subset of the candidate atoms is valid.
apply
classmethod
¶
Dispatch one operator name to the matching domain transfer function.
arithmetic_values
¶
Yield numeric values with booleans coerced to their integer form.
booleans
classmethod
¶
Return a domain seeded with boolean values.
coarse_boolean_output_domain
classmethod
¶
Return the old shortcut domain for expensive boolean-valued operators.
compute_domain
classmethod
¶
compute_domain(operation: Symbol, *domains: Domain, solver_identifiers: tuple[Symbol, ...] = (), evaluation_session: PythonEvaluationSession) -> Domain
Compute one operation domain from its symbolic operator and child domains.
evaluate_python_callable
classmethod
¶
evaluate_python_callable(code: str, domains: tuple[Domain, ...], solver_identifiers: tuple[Symbol, ...], evaluation_session: PythonEvaluationSession) -> Domain
Evaluate one Python callable and optionally expose per-input outputs.
evaluate_python_expression
classmethod
¶
evaluate_python_expression(code: str, solver_identifiers: tuple[Symbol, ...], evaluation_session: PythonEvaluationSession) -> Domain
Evaluate one bare Python expression and optionally expose the concrete output.
evaluate_python_extract
classmethod
¶
evaluate_python_extract(stmt: str, expr_code: str, domains: tuple[Domain, ...], solver_identifiers: tuple[Symbol, ...], evaluation_session: PythonEvaluationSession) -> Domain
Evaluate one PythonExtract operator and optionally expose per-input outputs.
evaluate_python_extract_output
classmethod
¶
evaluate_python_extract_output(expr_code: str, execution: PythonExtractExecution) -> tuple[Domain, tuple[str, ...]]
Evaluate one PythonExtract output expression against a cached statement execution.
execute_python_extract_statement
cached
classmethod
¶
execute_python_extract_statement(stmt: str, arg_values: tuple[DomainAtom, ...], solver_identifiers: tuple[Symbol, ...]) -> PythonExtractExecution
Execute one PythonExtract statement for one concrete input assignment.
expression_domain_symbols
¶
Yield _se_domain/2 tuples for one expression.
expression_set_domain_symbol_symbols
¶
expression_set_domain_symbol_symbols(global_set_uids: Mapping[frozenset[DomainAtom], int] | None = None) -> Iterable[Symbol]
Yield (Uid, SetValue) tuples for this domain's concrete sets.
expression_set_domain_symbols
¶
expression_set_domain_symbols(expr: Symbol, global_set_uids: Mapping[frozenset[DomainAtom], int] | None = None) -> Iterable[Symbol]
Yield _se_set_domain/2 tuples for this domain's concrete sets.
floats_only
classmethod
¶
Return a domain seeded with float values.
from_runtime
classmethod
¶
Lift one direct Python runtime result into a domain.
from_symbol
classmethod
¶
from_symbol(symbol: Symbol) -> Domain
Lift one compile2 value symbol into a runtime domain.
from_value
classmethod
¶
from_value(value: DomainAtom) -> Domain
Lift one concrete runtime value into a domain.
has_boolean_output
classmethod
¶
Report whether an operator always returns a boolean-like domain.
has_possible_sets
¶
has_possible_sets() -> bool
Report whether this domain includes any concrete or symbolic set value.
merge
classmethod
¶
Return one domain containing the union of all inputs.
numeric_values
¶
Yield numeric values while preserving int/float deduplication.
op_ceil
classmethod
¶
Apply ceil to all numeric values in the domain.
op_concat
classmethod
¶
Compute all string concatenations from two string domains.
op_conj
classmethod
¶
Compute the logical-conjunction domain.
op_default
classmethod
¶
Return the primary domain, falling back when it is only none-like.
op_diff
classmethod
¶
Compute the pairwise set difference of all candidate sets.
op_disj
classmethod
¶
Compute the logical-disjunction domain.
op_eq
classmethod
¶
Compute the equality domain using overlap shortcuts.
op_float_div
classmethod
¶
Compute the floating-division domain.
op_floor
classmethod
¶
Apply floor to all numeric values in the domain.
op_geq
classmethod
¶
Compute the greater-or-equal comparison domain.
op_gt
classmethod
¶
Compute the strict-greater-than comparison domain.
op_hasValue
classmethod
¶
Return whether the domain can hold a concrete non-none value.
op_if
classmethod
¶
Compute the guarded-value domain for the two-argument if operator.
op_int_div
classmethod
¶
Compute the integer-division domain.
op_inter
classmethod
¶
Compute the pairwise intersection of all candidate sets.
op_ite
classmethod
¶
Compute the if-then-else domain from the possible condition values.
op_length
classmethod
¶
Compute lengths for strings, tuples, and concrete sets.
op_leq
classmethod
¶
Compute the less-or-equal comparison domain.
op_leqv
classmethod
¶
Compute the logical-equivalence domain.
op_limp
classmethod
¶
Compute the logical-implication domain.
op_lt
classmethod
¶
Compute the strict-less-than comparison domain.
op_lxor
classmethod
¶
Compute the logical-exclusive-or domain.
op_max
classmethod
¶
Compute all max results across the argument cross-product.
op_min
classmethod
¶
Compute all min results across the argument cross-product.
op_mult
classmethod
¶
Compute the multiplication domain.
op_neq
classmethod
¶
Compute the inequality domain from the equality domain.
op_pow
classmethod
¶
Compute the exponentiation domain.
op_set_isin
classmethod
¶
Compute whether scalar members can occur in candidate sets.
op_set_make
classmethod
¶
Build all concrete sets produced by choosing one scalar from each input domain.
op_set_notin
classmethod
¶
Compute whether scalar members can be absent from candidate sets.
op_snot
classmethod
¶
Compute strong negation, where none collapses to false.
op_subset
classmethod
¶
Compute the subset relation over all candidate set pairs.
op_union
classmethod
¶
Compute the pairwise union of all candidate sets.
op_wnot
classmethod
¶
Compute weak negation, where none collapses to true.
operation_name
classmethod
¶
Normalize a symbolic operator representation to its name.
operation_spec
classmethod
¶
operation_spec(operation: Any) -> OperationSpec
Return the uniform dispatch spec for one non-Python operator.
options
¶
options() -> tuple[DomainAtom, ...]
Return one stable enumeration of domain alternatives, including bad when present.
register_set_uid
classmethod
¶
Assign a stable global uid to one concrete set value.
runtime_to_value
classmethod
¶
runtime_to_value(value: Any) -> DomainAtom
Normalize one direct Python runtime value into the internal domain representation.
scalar_values
¶
Yield only scalar values, excluding tuples and concrete sets.
set_count
¶
set_count() -> int
Count concrete set values without materializing symbolic all-subset domains.
set_domain_value_symbols
¶
set_domain_value_symbols(global_set_uids: Mapping[frozenset[DomainAtom], int] | None = None, candidate_values: Iterable[DomainAtom] = ()) -> Iterable[Symbol]
Yield _se_set_domain/3 tuples for concrete set memberships.
set_sort_key
classmethod
¶
set_sort_key(value: frozenset[DomainAtom])
Build a deterministic structural ordering key for one concrete set value.
set_uid_sort_key
classmethod
¶
set_uid_sort_key(value: object)
Build a deterministic structural ordering key for set-uid assignment.
set_value_domain_symbols
classmethod
¶
set_value_domain_symbols(set_value: frozenset[DomainAtom], *, global_set_uids: Mapping[frozenset[DomainAtom], int] | None = None, candidate_values: Iterable[DomainAtom] = ()) -> Iterable[Symbol]
Yield _se_set_domain/3 tuples for one concrete set value.
set_values
classmethod
¶
Return a domain seeded with concrete set values.
strings_only
classmethod
¶
Return a domain seeded with string values.
symbols_only
classmethod
¶
symbols_only(*values: Symbol) -> Domain
Return a domain seeded with symbol values.
to_symbols
¶
Yield compile2 symbols while preserving native-value ordering and filtering.
truth_values
¶
Yield the truthy lattice used by logical operations.
tuple_values
classmethod
¶
Return a domain seeded with tuple values.
value_count
¶
Count represented values for threshold heuristics without materializing sets.
value_set
¶
Materialize the represented values when set operations are required.
value_to_runtime
classmethod
¶
value_to_runtime(value: DomainAtom) -> Any
Convert one internal domain value into direct Python runtime data.
value_to_symbol
classmethod
¶
value_to_symbol(value: DomainAtom) -> Symbol
Convert one runtime domain value into the compile2 value encoding.
OperationSpec
dataclass
¶
Describe how one operator should be dispatched over child domains.
PythonEvaluationOutputRequest
dataclass
¶
Describe one requested Python output for a concrete input assignment.
PythonEvaluationSession
¶
Bidirectional interface used while enumerating Python evaluation traces.
output_requests
¶
output_requests() -> tuple[PythonEvaluationOutputRequest, ...]
Return the outputs the current Python evaluation should produce.
cached_function
cached
¶
Return one interned clingo function symbol for the given signature.
cached_number
cached
¶
cached_number(value: int) -> Symbol
Return one interned clingo number symbol for the provided value.