python_domain_computation
CachedPythonEvaluation
dataclass
¶
Cached domain plus compressed trace bundle for one Python output request.
ComputedDomains
dataclass
¶
Cached compile2 domain-computation outputs for one grounding run.
expression_domain_symbols
¶
expression_domain_symbols() -> Iterable[Symbol]
Yield _se_domain/2 facts for all computed expressions.
expression_set_domain_symbol_symbols
¶
expression_set_domain_symbol_symbols(expr: Symbol) -> Iterable[Symbol]
Yield (Uid,SetValue) tuples for one set-valued expression.
expression_set_domain_symbols
¶
expression_set_domain_symbols() -> Iterable[Symbol]
Yield _se_set_domain(Expr,Uid) facts for all computed expressions.
expression_set_domain_value_symbols
¶
expression_set_domain_value_symbols() -> Iterable[Symbol]
Yield _se_set_domain(Uid,Sign,Value) facts across all set expressions.
python_evaluation_input_symbols
¶
python_evaluation_input_symbols() -> Iterable[Symbol]
Yield _python_evaluation_input/4 tuples for all computed Python traces.
python_evaluation_output_symbols
¶
python_evaluation_output_symbols() -> Iterable[Symbol]
Yield _python_evaluation_output/3 tuples for all computed Python traces.
python_evaluation_symbols
¶
python_evaluation_symbols() -> Iterable[Symbol]
Yield _python_evaluation/2 tuples for all computed Python traces.
python_value_reference_symbol
¶
python_value_reference_symbol(value: PythonEvaluationValue) -> Symbol
Return one export symbol for a Python trace value or set reference.
DomainComputation
¶
Compute compile2 expression domains directly from raw clingo symbols.
add_set_membership_export_request
classmethod
¶
add_set_membership_export_request(requests: set[SetMembershipExportRequest], expression_domains: Mapping[Symbol, Domain], reference_expr: Symbol, set_value: frozenset[DomainAtom]) -> None
Record one demanded _se_set_domain/3 export for a referenced concrete set.
collect_python_set_membership_export_requests
classmethod
¶
collect_python_set_membership_export_requests(requests: set[SetMembershipExportRequest], expression_domains: Mapping[Symbol, Domain], python_evaluation_inputs: Iterable[PythonEvaluationInputAtom], python_evaluation_outputs: Iterable[PythonEvaluationOutputAtom]) -> None
Add set membership exports required by one batch of Python traces.
collect_tuple_set_membership_export_requests
classmethod
¶
collect_tuple_set_membership_export_requests(requests: set[SetMembershipExportRequest], expression_domains: Mapping[Symbol, Domain], expr: Symbol) -> None
Add set membership exports required by one literal tuple expression.
compute
classmethod
¶
compute(top_level_expressions: Iterable[Symbol], solver_identifiers: tuple[Symbol, ...]) -> ComputedDomains
Compute compile2 expression domains and the derived set export metadata.
concrete_set_domain
classmethod
¶
concrete_set_domain(var: Symbol, expression_domains: Mapping[Symbol, Domain], set_sources: Mapping[Symbol, dict[str, list[Symbol]]]) -> Domain | None
Build the set-valued domain implied by one set variable and its sources.
debug_expression_total
classmethod
¶
debug_expression_total(ordered_expressions: tuple[Symbol, ...], skipped_python_extract_exprs: set[Symbol], python_extract_groups: Mapping[Symbol, tuple[Symbol, ...]]) -> int
Count the number of expression rows that will be written to the debug CSV.
debug_input_domain_formula
classmethod
¶
Render a stable multiplicative formula for one expression's input sizes.
debug_input_domain_sizes
classmethod
¶
debug_input_domain_sizes(expr: Symbol, expression_domains: Mapping[Symbol, Domain], variable_sources: Mapping[Symbol, list[Symbol]], set_sources: Mapping[Symbol, dict[str, list[Symbol]]]) -> tuple[int, ...]
Return the immediate input domain sizes used to derive one expression.
direct_subexpressions
classmethod
¶
direct_subexpressions(expr: Symbol) -> list[Symbol]
Return the immediate child expressions that influence one expression domain.
domain_values
classmethod
¶
Return all non-set runtime values stored in one domain.
evaluate_expression
classmethod
¶
evaluate_expression(expr: Symbol, expression_domains: Mapping[Symbol, Domain], solver_identifiers: tuple[Symbol, ...], evaluation_session: PythonEvaluationExporter, cached_compute_domain: Callable[[Symbol, tuple[Domain, ...], tuple[Symbol, ...]], Domain], cached_python_expression_evaluation: Callable[[str, tuple[Symbol, ...]], CachedPythonEvaluations], cached_python_callable_evaluation: Callable[[str, tuple[Domain, ...], tuple[Symbol, ...]], CachedPythonEvaluations], cached_python_extract_evaluation: Callable[[str, tuple[Domain, ...], tuple[Symbol, ...], tuple[str, ...]], CachedPythonEvaluations], grouped_exprs: tuple[Symbol, ...] | None = None) -> dict[Symbol, Domain]
Evaluate one raw compile2 expression symbol into one or more expression domains.
evaluate_tuple
classmethod
¶
Enumerate tuple values from already-computed child domains.
group_python_extract_expressions
classmethod
¶
group_python_extract_expressions(ordered_expressions: tuple[Symbol, ...]) -> tuple[dict[Symbol, tuple[Symbol, ...]], set[Symbol]]
Return representative PythonExtract groups and the redundant members to skip in the main loop.
is_function
classmethod
¶
Check whether one symbol is a function term with an optional signature.
is_tuple
classmethod
¶
Check whether one symbol is represented as an anonymous tuple term.
normalize_solver_identifiers
classmethod
¶
Flatten the _main_solverIdentifiers/1 list term into evaluator identifiers.
python_extract_group_key
classmethod
¶
python_extract_group_key(expr: Symbol) -> PythonExtractGroupKey | None
Return the grouping key for PythonExtract expressions that share one statement execution.
python_extract_output_code
classmethod
¶
python_extract_output_code(expr: Symbol) -> str | None
Return the PythonExtract output expression code for one operation symbol.
sequence_items
classmethod
¶
sequence_items(symbol: Symbol) -> list[Symbol] | None
Flatten one nested pair-list into a Python list when it ends in ().
sorted_expressions
classmethod
¶
sorted_expressions(top_level_expressions: Iterable[Symbol], variable_sources: Mapping[Symbol, list[Symbol]], set_sources: Mapping[Symbol, dict[str, list[Symbol]]]) -> Iterable[Symbol]
Yield expressions in a dependency-first order with variable sources expanded first.
ExportDebugProfiler
dataclass
¶
ExpressionDebugLogger
dataclass
¶
Stream per-expression compute timings to CSV as domains are derived.
PythonEvaluationCapture
dataclass
¶
Bases: PythonEvaluationSession
Capture reusable Python traces without binding them to compile2 expression ids.
compressed_results
¶
Return cached domains plus compressed traces keyed only by output code.
output_requests
¶
output_requests() -> tuple[PythonEvaluationOutputRequest, ...]
Return the requested reusable outputs for the current Python evaluation.
PythonEvaluationCompressedTrace
dataclass
¶
One wildcard-compressed Python trace for a family of input assignments.
PythonEvaluationExporter
dataclass
¶
Export cached Python traces into compile2 python-evaluation atoms.
replay_cached_evaluation
¶
replay_cached_evaluation(expr: Symbol, arg_exprs: tuple[Symbol, ...], compressed_evaluations: tuple[PythonEvaluationCompressedTrace, ...], *, is_extract: bool) -> None
Append one cached compressed Python trace bundle to the exported lists.
PythonEvaluationLeaf
dataclass
¶
Leaf node of one compressed Python evaluation trie.
PythonEvaluationNode
dataclass
¶
Interior node of one compressed Python evaluation trie.
PythonWarningOutput
dataclass
¶
Pre-encoded non-domain output emitted for Python evaluation warnings.
compress_python_evaluation_trie
¶
compress_python_evaluation_trie(trie: dict[Any, Any], ordered_domains: tuple[tuple[DomainAtom, ...], ...], depth: int = 0) -> PythonEvaluationLeaf | PythonEvaluationNode
Collapse trie levels when every value in one argument domain shares the same subtree.
compressed_python_evaluations
¶
compressed_python_evaluations(arg_domains: tuple[Domain, ...], outputs_by_assignment: Mapping[PythonEvaluationAssignment, PythonEvaluationOutputSignature]) -> tuple[PythonEvaluationCompressedTrace, ...]
Return wildcard-safe Python evaluation traces that still cover the full input product.
python_error_output
¶
python_error_output(message: str) -> PythonWarningOutput
Return the exported error(expression(pythonError), Message) symbol.
python_evaluation_trie
¶
python_evaluation_trie(outputs_by_assignment: Mapping[PythonEvaluationAssignment, PythonEvaluationOutputSignature]) -> dict[Any, Any]
Build a trie over concrete Python argument tuples.
python_trace_signature
¶
python_trace_signature(domain: Domain, error_messages: Iterable[str] = ()) -> PythonEvaluationOutputSignature
Return one stable trace signature including warning outputs when present.
record_compressed_python_evaluation
¶
record_compressed_python_evaluation(expr: Symbol, arg_exprs: tuple[Symbol, ...], compressed_evaluations: tuple[PythonEvaluationCompressedTrace, ...], python_evaluations: list[PythonEvaluationAtom], python_evaluation_inputs: list[PythonEvaluationInputAtom], python_evaluation_outputs: list[PythonEvaluationOutputAtom], *, is_extract: bool) -> None
Record one already-compressed family of Python input/output traces.