Skip to content

lawref.counterfactual

Finite, offline counterfactual solver for the Core 0.1 §186 errata.

This module intentionally mirrors law-eval/src/counterfactual.rs. It enumerates only supplied candidate patches, returns every success in the first exact-cost tier, and treats any fatal/incomplete candidate before the cutoff as an incomplete search rather than publishing a partial minimum.

Attributes

NameDescription
INPUT_VERSIONNo description.
RESULT_VERSIONNo description.
SOLVER_PROFILENo description.

Classes

NameDescription
CounterfactualErrorStable machine-readable counterfactual input/search failure.

Functions

NameDescription
evaluate_counterfactualEvaluate all candidates through the first complete successful tier.
verify_counterfactual_resultReplay and verify the complete canonical certificate and solution set.

INPUT_VERSIONattributemodule attribute#

INPUT_VERSION = 'law.core.counterfactual-input/0.1'

RESULT_VERSIONattributemodule attribute#

RESULT_VERSION = 'law.core.counterfactual-result/0.1'

SOLVER_PROFILEattributemodule attribute#

SOLVER_PROFILE = 'law.solver.finite-enumeration/0.1'

CounterfactualErrorclass#

class CounterfactualError(code: str, message: str)

Bases: ValueError

Stable machine-readable counterfactual input/search failure.

codeattributeinstance attribute#

code = code

messageattributeinstance attribute#

message = message

evaluate_counterfactualfunction#

def evaluate_counterfactual(ir: dict, case: dict, input_: dict, options: dict | None = None, external_snapshots: list[dict] | None = None) -> dict

Evaluate all candidates through the first complete successful tier.

Options внутренних прогонов §186 берутся из case["options"], если вызывающий не назвал свои: DECISION-0111 §2.2 объявляет case.options ЕДИНСТВЕННЫМ местом семантических опций, а EvaluationRequest.build затирает их переданным словарём. До errata E-0135 (06.09.2026) умолчание {} молча выбрасывало выбор прочтения §152 и календарь дела: кандидаты считались в мире без опций, а caseHash входа — по делу с ними.

verify_counterfactual_resultfunction#

def verify_counterfactual_result(ir: dict, case: dict, input_: dict, claimed: dict, options: dict | None = None, external_snapshots: list[dict] | None = None) -> None

Replay and verify the complete canonical certificate and solution set.

Documentation for Arxo. Writings — blog.arxo.io.

Anonymous visit counts on stats.arxo.io, no cookies.