Checks
opulse.generation.checks ¶
Acceptance checks for a compiled candidate operator.
Each check returns None when the candidate passes, or a short reason.
The pipeline counts reasons so rejection rates are visible in the run summary.
uses_all_parameters ¶
uses_all_parameters(draft: Draft) -> str | None
Every parameter must influence the definition somewhere (body or condition).
not_a_renaming ¶
not_a_renaming(draft: Draft) -> str | None
Reject f(a, b) = { g(x, y) }: one call of the same arity is just g again.
body_fingerprint ¶
body_fingerprint(operator: Operator) -> str
Hash of the generated code with the operator's own id blanked out.
agrees_with_reference ¶
agrees_with_reference(
operator: Operator,
runtime,
oracle,
rng: Random,
random_trials: int = 60,
) -> str | None
Compiled code == reference interpreter (value, base_ops, calls) on every probe.
defined_somewhere ¶
defined_somewhere(
operator: Operator,
runtime,
rng: Random,
trials: int = 60,
) -> str | None
Reject operators that are undefined on every probe (small, boundary and random inputs).
varied_outputs ¶
varied_outputs(
operator: Operator,
runtime,
rng: Random,
trials: int = 30,
min_distinct: int = 5,
max_echo_ratio: float = 0.8,
) -> str | None
Optional: the operator should not be nearly constant or mostly echo an input.
intentionally_partial ¶
intentionally_partial(
draft: Draft, recursion_style: str
) -> bool
Definitions meant to be undefined on part of the domain: no else branch, or a
recursion bounded by |v| <= T (templates B, C and D).
defined_share ¶
defined_share(
operator: Operator,
runtime,
rng: Random,
min_share: float,
value_range: tuple[int, int],
trials: int = 80,
) -> str | None
The operator must be defined on at least min_share of inputs drawn from the range
expressions use, so that sampled expressions are not mostly NaN.
degenerate_subexpression ¶
degenerate_subexpression(
draft: Draft,
operator: Operator,
oracle,
encoder,
budget: int,
safety_timeout_ms: int = 30000,
) -> str | None
Reject a subexpression that uses a parameter yet takes at most one defined value,
such as a - a (always 0) or a % a (0 wherever defined). Used as a divisor, such a
subexpression makes the operator NaN almost everywhere.
Concrete inputs pick the suspects; a suspect is rejected only when z3 proves it (no two inputs give two different defined values). Undecided suspects are accepted.