mixle.experimental.typed_runtime.compiler module

Side-effect-free compiler from a model tree to a typed update graph.

class ContractRegistry[source]

Bases: object

Explicit contract adapters for models that cannot declare a hook.

Registries are caller-owned rather than process-global. Compiling a test or plugin therefore cannot silently change another run’s semantics.

register(model_type, contract, *, estimator_type=None)[source]

Register one immutable, already constructed contract for a model/estimator pair.

Parameters:
  • model_type (type[Any])

  • contract (UpdateContract)

  • estimator_type (type[Any] | None)

Return type:

None

resolve(model, estimator)[source]

Resolve the most recently registered matching adapter.

Parameters:
  • model (Any)

  • estimator (Any | None)

Return type:

UpdateContract | None

compile_update_graph(model, estimator=None, *, nobs=1.0, backend='local', registry=None, bindings=None, contract_overrides=None, measurements=None)[source]

Compile a model into an immutable typed update and invalidation graph.

Compilation reads inert instance/class dictionaries only. It never calls factories, descriptors, capability predicates, contract hooks, parameters(), scoring/sampling methods, estimators, or accumulators. Child estimators are aligned from the supplied estimator’s stored child objects where the binding is unambiguous; otherwise the child contract is UNKNOWN/frozen unless an explicit path binding is supplied.

Parameters:
  • model (ProbabilityDistribution)

  • estimator (ParameterEstimator | None)

  • nobs (float)

  • backend (str)

  • registry (ContractRegistry | None)

  • bindings (Mapping[str, ParameterEstimator] | None)

  • contract_overrides (Mapping[str, UpdateContract] | None)

  • measurements (MeasurementCatalog | None)

Return type:

UpdateGraph

infer_update_contract(model, estimator)[source]

Return a static/audited contract or an explicit UNKNOWN contract.

No factories, descriptors, methods, capability predicates, scoring functions, or estimator hooks are called. Names and method presence are not semantic evidence.

Parameters:
  • model (Any)

  • estimator (Any | None)

Return type:

UpdateContract