Skip to main content

omnibias.core.proof

0.5.0rc1Release candidatePython >=3.10Apache-2.0

Coefficient recurrences, activation contracts, jet algebra, and verified arithmetic shared by the numerical backends.

import omnibias.core.proof
Module contract & mathematical conventions

Numerical certificates with schema, replay, and formal-verification gates.

Concrete applications register their own provers. A successful verdict must pass the certificate schema and requested independent checks. Formal status is earned only by a successful kernel check.

Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.

Imports & aliases​

These names share a definition with another public module. Follow a name for its full contract, parameters, and examples.

Import from this moduleCanonical reference
ALL_CONDITION_SORTSomnibias.core.proof.ALL_CONDITION_SORTS
CERTIFICATE_SCHEMA_VERSIONomnibias.core.proof.CERTIFICATE_SCHEMA_VERSION
CatalogEntryomnibias.core.proof.CatalogEntry
Characterizationomnibias.core.proof.Characterization
ClassHitomnibias.core.proof.ClassHit
ClassMemoryomnibias.core.proof.ClassMemory
ClassSelectionomnibias.core.proof.ClassSelection
ConditionHypothesisomnibias.core.proof.ConditionHypothesis
ConditionSortomnibias.core.proof.ConditionSort
ConditionTokenomnibias.core.proof.ConditionToken
CoordinateNewtonomnibias.core.proof.CoordinateNewton
DiscoveredEquationomnibias.core.proof.DiscoveredEquation
DiscoveryResultomnibias.core.proof.DiscoveryResult
DomainSubdivisionCertificateomnibias.core.proof.DomainSubdivisionCertificate
ExactCheckomnibias.core.proof.ExactCheck
FEATURE_DIMomnibias.core.proof.FEATURE_DIM
FORMAL_CLAIM_KEYomnibias.core.proof.FORMAL_CLAIM_KEY
FiniteFamilyomnibias.core.proof.FiniteFamily
FrequencyGateomnibias.core.proof.FrequencyGate
GrammarGrowthFamilyomnibias.core.proof.GrammarGrowthFamily
GrammarSpecomnibias.core.proof.GrammarSpec
INEQUALITY_KINDomnibias.core.proof.INEQUALITY_KIND
InequalityBackendomnibias.core.proof.InequalityBackend
InequalitySortomnibias.core.proof.InequalitySort
InequalitySystemomnibias.core.proof.InequalitySystem
IntegerIntervalFamilyomnibias.core.proof.IntegerIntervalFamily
KindMetaFamilyomnibias.core.proof.KindMetaFamily
LeanCheckResultomnibias.core.proof.LeanCheckResult
LinearSpanFamilyomnibias.core.proof.LinearSpanFamily
Obligationomnibias.core.proof.Obligation
Observationomnibias.core.proof.Observation
OneHotAnnealomnibias.core.proof.OneHotAnneal
Proposalomnibias.core.proof.Proposal
RationalStencilomnibias.core.proof.RationalStencil
RationalSupportomnibias.core.proof.RationalSupport
RationalWitnessomnibias.core.proof.RationalWitness
ReplayCertificateReportomnibias.core.proof.ReplayCertificateReport
ReplayRecorderomnibias.core.proof.ReplayRecorder
ReplayStepomnibias.core.proof.ReplayStep
ReplayTraceomnibias.core.proof.ReplayTrace
SUPPORTED_SCHEMA_VERSIONSomnibias.core.proof.SUPPORTED_SCHEMA_VERSIONS
ScoreGuidedWalkomnibias.core.proof.ScoreGuidedWalk
Statementomnibias.core.proof.Statement
StencilCertificateReportomnibias.core.proof.StencilCertificateReport
SubdivisionLeafomnibias.core.proof.SubdivisionLeaf
apply_constructoromnibias.core.proof.apply_constructor
as_fractionomnibias.core.proof.as_fraction
bind_sortsomnibias.core.proof.bind_sorts
build_inequality_machineomnibias.core.proof.build_inequality_machine
canonical_jsonomnibias.core.proof.canonical_json
catalog_entryomnibias.core.proof.catalog_entry
certificate_digestomnibias.core.proof.certificate_digest
check_certificateomnibias.core.proof.check_certificate
class_hit_from_checkomnibias.core.proof.class_hit_from_check
condition_honestyomnibias.core.proof.condition_honesty
curated_rational_stencilsomnibias.core.proof.curated_rational_stencils
decode_intervalomnibias.core.proof.decode_interval
decode_interval_matrixomnibias.core.proof.decode_interval_matrix
decode_taylor_modelomnibias.core.proof.decode_taylor_model
default_inequality_honestyomnibias.core.proof.default_inequality_honesty
discoveromnibias.core.proof.discover
emit_conditionomnibias.core.proof.emit_condition
encode_intervalomnibias.core.proof.encode_interval
encode_interval_matrixomnibias.core.proof.encode_interval_matrix
encode_taylor_modelomnibias.core.proof.encode_taylor_model
generate_obligationomnibias.core.proof.generate_obligation
get_proposeromnibias.core.proof.get_proposer
grow_neighborsomnibias.core.proof.grow_neighbors
inequality_backendomnibias.core.proof.inequality_backend
inequality_proveromnibias.core.proof.inequality_prover
integer_null_spaceomnibias.core.proof.integer_null_space
interval_certificateomnibias.core.proof.interval_certificate
kernel_rootomnibias.core.proof.kernel_root
lean_check_availableomnibias.core.proof.lean_check_available
list_catalogomnibias.core.proof.list_catalog
list_condition_sortsomnibias.core.proof.list_condition_sorts
list_inequality_backendsomnibias.core.proof.list_inequality_backends
load_inequality_stackomnibias.core.proof.load_inequality_stack
locked_catalogomnibias.core.proof.locked_catalog
make_certificateomnibias.core.proof.make_certificate
poisedness_obligationomnibias.core.proof.poisedness_obligation
positive_definite_certificateomnibias.core.proof.positive_definite_certificate
prove_inequalityomnibias.core.proof.prove_inequality
rank_class_hitsomnibias.core.proof.rank_class_hits
record_ldlt_diagonal_traceomnibias.core.proof.record_ldlt_diagonal_trace
register_catalogomnibias.core.proof.register_catalog
register_condition_sortomnibias.core.proof.register_condition_sort
register_inequality_backendomnibias.core.proof.register_inequality_backend
replay_inequalityomnibias.core.proof.replay_inequality
residual_identically_zeroomnibias.core.proof.residual_identically_zero
run_discoveryomnibias.core.proof.run_discovery
run_inequality_pipelineomnibias.core.proof.run_inequality_pipeline
schema_errors_v1omnibias.core.proof.schema_errors_v1
seal_certificateomnibias.core.proof.seal_certificate
seal_domain_subdivision_certificateomnibias.core.proof.seal_domain_subdivision_certificate
seal_poisedness_certificateomnibias.core.proof.seal_poisedness_certificate
seal_replay_certificateomnibias.core.proof.seal_replay_certificate
seal_stencil_certificateomnibias.core.proof.seal_stencil_certificate
select_classomnibias.core.proof.select_class
solve_inequalityomnibias.core.proof.solve_inequality
stencil_consistency_obligationomnibias.core.proof.stencil_consistency_obligation
taylor_model_certificateomnibias.core.proof.taylor_model_certificate
verify_certificate_digestomnibias.core.proof.verify_certificate_digest
CONSTANT

Certificate​

omnibias.core.proof.CertificateSource ↗
Certificate = dict[str, Any]

A certificate is a plain JSON-serialisable mapping (the omnibias convention).

Regression example · honesty gate still ignores the formal claim

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_honesty_gate_still_ignores_the_formal_claim() -> None:
    """The conjecture-side rule and the artifact-side rule must agree."""
    cert: Certificate = {"honesty": {FORMAL_CLAIM_KEY: False}}
    conjecture = Conjecture("x", "k", {}, claims={FORMAL_CLAIM_KEY: True})
    # honesty_gate defers to ProofMachine.evaluate, which consults the kernel.
    assert honesty_gate(conjecture, cert) is True
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_honesty_gate_still_ignores_the_formal_claim -q
Regression example · honesty gate passes when no claims or supported

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_honesty_gate_passes_when_no_claims_or_supported() -> None:
    conj = Conjecture("x", "k", {})
    assert honesty_gate(conj, None) is True
    cert: Certificate = {"honesty": {"interval_verified": True}}
    conj2 = Conjecture("y", "k", {}, claims={"interval_verified": True})
    assert honesty_gate(conj2, cert) is True
    conj3 = Conjecture("z", "k", {}, claims={"unproven_claim": True})
    assert honesty_gate(conj3, cert) is False
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_honesty_gate_passes_when_no_claims_or_supported -q
Read the implementation
Certificate = dict[str, Any]
CLASS

Conjecture​

omnibias.core.proof.ConjectureSource ↗
class Conjecture

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

A statement to be adjudicated by the ProofMachine.

Parameters

name: Human-readable label (free text), e.g. "positive residual margin". kind: The dispatch key a prover matches on, e.g. "positive_residual_margin". data: Inputs forwarded to the prover (e.g. {"coeffs": [...], "scales": [...]}). claims: Honesty claims the conjecture *asserts*. Each True entry must be supported by the produced certificate's honesty flags or the verdict is downgraded to BLOCKED (the honesty gate). Leave empty for the normal "is this model statement certified?" question.

Parameters

NameType & defaultContract
namedataclass fieldstrRequiredHuman-readable label (free text), e.g. "positive residual margin".
kinddataclass fieldstrRequiredThe dispatch key a prover matches on, e.g. "positive_residual_margin".
datadataclass fieldMapping[str, Any]Default: field(default_factory=dict)Inputs forwarded to the prover (e.g. {"coeffs": [...], "scales": [...]}).
claimsdataclass fieldMapping[str, bool]Default: field(default_factory=dict)Honesty claims the conjecture *asserts*. Each True entry must be supported by the produced certificate's honesty flags or the verdict is downgraded to BLOCKED (the honesty gate). Leave empty for the normal "is this model statement certified?" question.
Regression example · machine accepts valid sealed certificate

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest packages/omnibias-core/tests/test_certificate_audit_regressions.py -k test_machine_accepts_valid_sealed_certificate -q
Regression example · machine blocks unknown kind

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_blocks_unknown_kind() -> None:
    machine = ProofMachine().register(_sign_prover())
    verdict = machine.evaluate(Conjecture("x", "unknown", {}))
    assert verdict.status == "BLOCKED"
    assert verdict.prover == "<none>"
    assert any("no registered prover" in o for o in verdict.obligations)
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_machine_blocks_unknown_kind -q

Fields & methods

namefield
name: str

Human-readable label (free text), e.g. "positive residual margin".

View source ↗
kindfield
kind: str

The dispatch key a prover matches on, e.g. "positive_residual_margin".

View source ↗
datafield
data: Mapping[str, Any] = field(default_factory=dict)

Inputs forwarded to the prover (e.g. {"coeffs": [...], "scales": [...]}).

View source ↗
claimsfield
claims: Mapping[str, bool] = field(default_factory=dict)

Honesty claims the conjecture *asserts*. Each True entry must be supported by the produced certificate's honesty flags or the verdict is downgraded to BLOCKED (the honesty gate). Leave empty for the normal "is this model statement certified?" question.

View source ↗
Read the implementation
class Conjecture:
    """A statement to be adjudicated by the :class:`ProofMachine`.

    Parameters
    ----------
    name:
        Human-readable label (free text), e.g. ``"positive residual margin"``.
    kind:
        The dispatch key a prover matches on, e.g. ``"positive_residual_margin"``.
    data:
        Inputs forwarded to the prover (e.g. ``{"coeffs": [...], "scales": [...]}``).
    claims:
        Honesty claims the conjecture *asserts*.  Each ``True`` entry must be
        supported by the produced certificate's ``honesty`` flags or the verdict
        is downgraded to ``BLOCKED`` (the honesty gate).  Leave empty for the
        normal "is this model statement certified?" question.
    """

    name: str
    kind: str
    data: Mapping[str, Any] = field(default_factory=dict)
    claims: Mapping[str, bool] = field(default_factory=dict)
CLASS

FunctionProver​

omnibias.core.proof.FunctionProverSource ↗
class FunctionProver

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

Adapter that builds a Prover from plain callables.

Lets a downstream package register an existing certificate generator without writing a class: supply the kinds it handles, a function mapping a Conjecture to a ProofAttempt, and (optionally) the schema validator and the independent replay twin.

Parameters

NameType & defaultContract
namedataclass fieldstrRequiredSee the operation contract and implementation below.
kindsdataclass fieldfrozenset[str]RequiredSee the operation contract and implementation below.
prove_fndataclass fieldCallable[[Conjecture], ProofAttempt]RequiredSee the operation contract and implementation below.
schema_fndataclass fieldCallable[[Certificate], list[str]] | NoneDefault: NoneSee the operation contract and implementation below.
replay_fndataclass fieldCallable[[Certificate], bool | None] | NoneDefault: NoneSee the operation contract and implementation below.
Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Regression example · machine records certificate schema version

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_records_certificate_schema_version() -> None:
    cert = interval_certificate("x in [0,1]", Interval(0.0, 1.0))

    def prove(_c: Conjecture) -> ProofAttempt:
        return ProofAttempt(status="PROVED", certificate=cert)

    machine = ProofMachine().register(
        FunctionProver(name="iv", kinds=frozenset({"iv_demo"}), prove_fn=prove)
    )
    verdict = machine.evaluate(Conjecture(name="demo", kind="iv_demo"))
    assert verdict.status == "PROVED"
    assert verdict.certificate_schema_version == CERTIFICATE_SCHEMA_VERSION
    assert verdict.theorem_prover_verified is False
python -m pytest packages/omnibias-core/tests/test_certificate.py -k test_machine_records_certificate_schema_version -q

Fields & methods

namefield
name: str

Declared str field on FunctionProver. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
kindsfield
kinds: frozenset[str]

Declared frozenset[str] field on FunctionProver. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
prove_fnfield
prove_fn: Callable[[Conjecture], ProofAttempt]

Declared Callable[[Conjecture], ProofAttempt] field on FunctionProver. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
schema_fnfield
schema_fn: Callable[[Certificate], list[str]] | None = None

Declared Callable[[Certificate], list[str]] | None field on FunctionProver. Default expression: None.

View source ↗
replay_fnfield
replay_fn: Callable[[Certificate], bool | None] | None = None

Declared Callable[[Certificate], bool | None] | None field on FunctionProver. Default expression: None.

View source ↗
handlesmethod
handles(self, conjecture: Conjecture) -> bool

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.

Returns: bool

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def handles(self, conjecture: Conjecture) -> bool:
        return conjecture.kind in self.kinds
View source ↗
attemptmethod
attempt(self, conjecture: Conjecture) -> ProofAttempt

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.

Returns: ProofAttempt

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def attempt(self, conjecture: Conjecture) -> ProofAttempt:
        return self.prove_fn(conjecture)
View source ↗
schema_errorsmethod
schema_errors(self, certificate: Certificate) -> list[str]

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
certificatepositional-or-keywordCertificateRequiredSee the operation contract and implementation below.

Returns: list[str]

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def schema_errors(self, certificate: Certificate) -> list[str]:
        return [] if self.schema_fn is None else list(self.schema_fn(certificate))
View source ↗
replaymethod
replay(self, certificate: Certificate) -> bool | None

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
certificatepositional-or-keywordCertificateRequiredSee the operation contract and implementation below.

Returns: bool | None

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def replay(self, certificate: Certificate) -> bool | None:
        return None if self.replay_fn is None else self.replay_fn(certificate)
View source ↗
Read the implementation
class FunctionProver:
    """Adapter that builds a :class:`Prover` from plain callables.

    Lets a downstream package register an existing certificate generator without
    writing a class: supply the kinds it handles, a function mapping a
    :class:`Conjecture` to a :class:`ProofAttempt`, and (optionally) the schema
    validator and the independent replay twin.
    """

    name: str
    kinds: frozenset[str]
    prove_fn: Callable[[Conjecture], ProofAttempt]
    schema_fn: Callable[[Certificate], list[str]] | None = None
    replay_fn: Callable[[Certificate], bool | None] | None = None

    def handles(self, conjecture: Conjecture) -> bool:
        return conjecture.kind in self.kinds

    def attempt(self, conjecture: Conjecture) -> ProofAttempt:
        return self.prove_fn(conjecture)

    def schema_errors(self, certificate: Certificate) -> list[str]:
        return [] if self.schema_fn is None else list(self.schema_fn(certificate))

    def replay(self, certificate: Certificate) -> bool | None:
        return None if self.replay_fn is None else self.replay_fn(certificate)
CLASS

ProofAttempt​

omnibias.core.proof.ProofAttemptSource ↗
class ProofAttempt

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

What a prover returns: its intrinsic verdict plus any artifact.

The machine still applies the schema gate, the replay check, and the honesty gate on top of this, so a prover may return PROVED and still be downgraded to BLOCKED by the machine if those checks fail.

Parameters

NameType & defaultContract
statusdataclass fieldVerdictStatusRequiredSee the operation contract and implementation below.
certificatedataclass fieldCertificate | NoneDefault: NoneSee the operation contract and implementation below.
obligationsdataclass fieldtuple[str, ...]Default: ()See the operation contract and implementation below.
detaildataclass fieldstrDefault: ''See the operation contract and implementation below.
Regression example · machine records certificate schema version

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_records_certificate_schema_version() -> None:
    cert = interval_certificate("x in [0,1]", Interval(0.0, 1.0))

    def prove(_c: Conjecture) -> ProofAttempt:
        return ProofAttempt(status="PROVED", certificate=cert)

    machine = ProofMachine().register(
        FunctionProver(name="iv", kinds=frozenset({"iv_demo"}), prove_fn=prove)
    )
    verdict = machine.evaluate(Conjecture(name="demo", kind="iv_demo"))
    assert verdict.status == "PROVED"
    assert verdict.certificate_schema_version == CERTIFICATE_SCHEMA_VERSION
    assert verdict.theorem_prover_verified is False
python -m pytest packages/omnibias-core/tests/test_certificate.py -k test_machine_records_certificate_schema_version -q
Regression example · strict mode does not change unsealed default behaviour

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_strict_mode_does_not_change_unsealed_default_behaviour() -> None:
    # Default (non-strict) verdicts are unaffected for unsealed certs without a twin.
    def prove(_conjecture: Conjecture) -> ProofAttempt:
        return ProofAttempt(
            status="PROVED", certificate={"value": 1.0, "honesty": {"unproven_claim": False}}
        )

    machine = ProofMachine().register(
        FunctionProver(name="plain", kinds=frozenset({"plain"}), prove_fn=prove)
    )
    verdict = machine.evaluate(Conjecture("x", "plain", {}))
    assert verdict.status == "PROVED"
    assert verdict.replay_ok is None
python -m pytest packages/omnibias-core/tests/test_certificate_audit_regressions.py -k test_strict_mode_does_not_change_unsealed_default_behaviour -q

Fields & methods

statusfield
status: VerdictStatus

Declared VerdictStatus field on ProofAttempt. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
certificatefield
certificate: Certificate | None = None

Declared Certificate | None field on ProofAttempt. Default expression: None.

View source ↗
obligationsfield
obligations: tuple[str, ...] = ()

Declared tuple[str, ...] field on ProofAttempt. Default expression: ().

View source ↗
detailfield
detail: str = ''

Declared str field on ProofAttempt. Default expression: ''.

View source ↗
Read the implementation
class ProofAttempt:
    """What a prover returns: its intrinsic verdict plus any artifact.

    The machine still applies the schema gate, the replay check, and the honesty
    gate on top of this, so a prover may return ``PROVED`` and still be
    downgraded to ``BLOCKED`` by the machine if those checks fail.
    """

    status: VerdictStatus
    certificate: Certificate | None = None
    obligations: tuple[str, ...] = ()
    detail: str = ""
CLASS

ProofMachine​

omnibias.core.proof.ProofMachineSource ↗
class ProofMachine

Dispatch a Conjecture to a prover and adjudicate a Verdict.

Pipeline: select prover -> attempt -> schema gate -> independent replay -> honesty gate. A prover's PROVED (or DISPROVED) is downgraded to BLOCKED whenever the schema is invalid, an independent replay disagrees, or (for PROVED) an asserted honesty claim is unsupported.

Parameters

NameType & defaultContract
registrypositional-or-keywordProverRegistry | NoneDefault: NoneSee the operation contract and implementation below.
Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Regression example · machine blocks unknown kind

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_blocks_unknown_kind() -> None:
    machine = ProofMachine().register(_sign_prover())
    verdict = machine.evaluate(Conjecture("x", "unknown", {}))
    assert verdict.status == "BLOCKED"
    assert verdict.prover == "<none>"
    assert any("no registered prover" in o for o in verdict.obligations)
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_machine_blocks_unknown_kind -q

Fields & methods

__init__method
__init__(self, registry: ProverRegistry | None=None) -> None

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
registrypositional-or-keywordProverRegistry | NoneDefault: NoneSee the operation contract and implementation below.

Returns: None

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def __init__(self, registry: ProverRegistry | None = None) -> None:
        self.registry: ProverRegistry = registry if registry is not None else ProverRegistry()
View source ↗
registermethod
register(self, prover: Prover) -> ProofMachine

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
proverpositional-or-keywordProverRequiredSee the operation contract and implementation below.

Returns: ProofMachine

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def register(self, prover: Prover) -> ProofMachine:
        self.registry.register(prover)
        return self
View source ↗
proversproperty
provers(self) -> tuple[Prover, ...]

See the class contract above and the exact method implementation below.

Returns: tuple[Prover, ...]

Method implementation
    def provers(self) -> tuple[Prover, ...]:
        return self.registry.provers
View source ↗
kindsmethod
kinds(self) -> tuple[str, ...]

See the class contract above and the exact method implementation below.

Returns: tuple[str, ...]

Executed regression · machine proves disproves and blocks

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_proves_disproves_and_blocks() -> None:
    machine = ProofMachine().register(_sign_prover())
    assert machine.kinds() == ("sign",)

    proved = machine.evaluate(Conjecture("pos", "sign", {"value": 3.0}))
    assert proved.status == "PROVED"
    assert proved.proved is True
    assert proved.schema_ok is True
    assert proved.replay_ok is True
    assert proved.honesty_ok is True

    disproved = machine.evaluate(Conjecture("neg", "sign", {"value": -3.0}))
    assert disproved.status == "DISPROVED"
    assert disproved.disproved is True

    blocked = machine.evaluate(Conjecture("zero", "sign", {"value": 0.0}))
    assert blocked.status == "BLOCKED"
    assert "value is zero" in blocked.obligations
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_machine_proves_disproves_and_blocks" -q
Method implementation
    def kinds(self) -> tuple[str, ...]:
        return self.registry.kinds()
View source ↗
evaluatemethod
evaluate(self, conjecture: Conjecture, *, replay: bool=True, lean_check: bool=False, strict: bool=False) -> Verdict

Adjudicate a single conjecture.

Two always-on gates run on any certificate (both non-breaking, because they only fire on certificates that opt into the relevant format):

  • **digest gate** -- if the certificate carries a digest it must match its body (~omnibias.core.proof.certificate.verify_certificate_digest), so a tampered or stale sealed certificate is downgraded to BLOCKED;
  • **v1 schema gate** -- a certificate whose schema_version is a supported v1 envelope is additionally validated with ~omnibias.core.proof.certificate.schema_errors_v1.

When strict is true a PROVED/DISPROVED verdict additionally requires (i) a certificate, (ii) a present *and* valid tamper-evident digest, and (iii) an independent replay twin that **agrees** (replay_ok is True; None or False blocks). This is the "treat the verdict as tamper-evident *and* independently replayed" mode; the default (non-strict) preserves graceful degradation when a replay twin or a digest is absent.

When lean_check is true (or the conjecture asserts the theorem_prover_verified claim) and a Lean toolchain is available, the produced certificate's finite obligation is re-checked by the Lean kernel (omnibias.core.proof.lean_check); the resulting Verdict.theorem_prover_verified flag is set only on a genuine kernel pass. Asserting the claim without a passing kernel downgrades a PROVED verdict to BLOCKED (the formal honesty gate).

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.
replaykeyword-onlyboolDefault: TrueSee the operation contract and implementation below.
lean_checkkeyword-onlyboolDefault: FalseSee the operation contract and implementation below.
strictkeyword-onlyboolDefault: FalseSee the operation contract and implementation below.

Returns: Verdict

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def evaluate(
        self,
        conjecture: Conjecture,
        *,
        replay: bool = True,
        lean_check: bool = False,
        strict: bool = False,
    ) -> Verdict:
        """Adjudicate a single conjecture.

        Two always-on gates run on any certificate (both non-breaking, because they
        only fire on certificates that opt into the relevant format):

        * **digest gate** -- if the certificate carries a ``digest`` it must match
          its body (:func:`~omnibias.core.proof.certificate.verify_certificate_digest`),
          so a tampered or stale sealed certificate is downgraded to ``BLOCKED``;
        * **v1 schema gate** -- a certificate whose ``schema_version`` is a
          supported v1 envelope is additionally validated with
          :func:`~omnibias.core.proof.certificate.schema_errors_v1`.

        When ``strict`` is true a ``PROVED``/``DISPROVED`` verdict additionally
        requires (i) a certificate, (ii) a present *and* valid tamper-evident
        digest, and (iii) an independent replay twin that **agrees**
        (``replay_ok is True``; ``None`` or ``False`` blocks).  This is the
        "treat the verdict as tamper-evident *and* independently replayed" mode;
        the default (non-strict) preserves graceful degradation when a replay twin
        or a digest is absent.

        When ``lean_check`` is true (or the conjecture asserts the
        ``theorem_prover_verified`` claim) and a Lean toolchain is available, the
        produced certificate's finite obligation is re-checked by the Lean kernel
        (:mod:`omnibias.core.proof.lean_check`); the resulting
        :attr:`Verdict.theorem_prover_verified` flag is set only on a genuine
        kernel pass.  Asserting the claim without a passing kernel downgrades a
        ``PROVED`` verdict to ``BLOCKED`` (the formal honesty gate).
        """
        prover = self.registry.select(conjecture)
        if prover is None:
            return Verdict(
                status="BLOCKED",
                conjecture=conjecture.name,
                kind=conjecture.kind,
                prover="<none>",
                certificate=None,
                obligations=(
                    f"no registered prover handles kind {conjecture.kind!r}",
                ),
                schema_ok=False,
                replay_ok=None,
                honesty_ok=honesty_gate(conjecture, None),
                detail="no prover registered for this kind",
            )

        attempt = prover.attempt(conjecture)
        certificate = attempt.certificate
        obligations: list[str] = list(attempt.obligations)

        schema_ok = True
        if certificate is not None:
            errors = prover.schema_errors(certificate)
            if errors:
                schema_ok = False
                obligations.extend(f"schema: {message}" for message in errors)
            # Tamper-evidence (always on): a certificate that carries a digest must
            # match its body (the same check the Lean bridge runs). Only fires on
            # sealed certs, so the many unsealed certified-evidence certs are unaffected.
            if "digest" in certificate and not verify_certificate_digest(certificate):
                schema_ok = False
                obligations.append(
                    "schema: certificate digest mismatch (tampered or stale)"
                )

        honesty_ok = honesty_gate(conjecture, certificate)

        replay_ok: bool | None = None
        if (replay or strict) and certificate is not None:
            replay_ok = prover.replay(certificate)

        status: VerdictStatus = attempt.status
        if status in ("PROVED", "DISPROVED"):
            if not schema_ok:
                status = "BLOCKED"
                obligations.append("schema validation failed")
            if replay_ok is False:
                status = "BLOCKED"
                obligations.append("independent replay disagreed with the certificate")
            if strict:
                if certificate is None:
                    status = "BLOCKED"
                    obligations.append("strict mode: no certificate to adjudicate")
                else:
                    if "digest" not in certificate:
                        status = "BLOCKED"
                        obligations.append(
                            "strict mode: an unsealed certificate (no tamper-evident "
                            "digest) cannot back a strict verdict"
                        )
                    # Require a well-formed v1 envelope (claim/payload/honesty/digest
                    # present and the digest valid).
                    v1_errors = schema_errors_v1(certificate)
                    if v1_errors:
                        status = "BLOCKED"
                        obligations.extend(
                            f"strict mode schema(v1): {message}" for message in v1_errors
                        )
                if replay_ok is not True:
                    status = "BLOCKED"
                    obligations.append(
                        "strict mode: requires an independent replay twin that "
                        "agrees (replay_ok must be True)"
                    )
        if status == "PROVED" and not honesty_ok:
            status = "BLOCKED"
            obligations.append(
                "honesty gate: an asserted claim is not supported by the "
                "certificate's honesty flags (no external evidence attached)"
            )

        schema_version: str | None = None
        if certificate is not None:
            candidate = certificate.get("schema_version")
            if isinstance(candidate, str):
                schema_version = candidate

        # Formal (Lean-kernel) gate: set theorem_prover_verified only on a genuine
        # kernel pass; an asserted-but-unbacked formal claim blocks a PROVED verdict.
        claims_formal = bool(conjecture.claims.get(FORMAL_CLAIM_KEY, False))
        theorem_prover_verified = False
        if (lean_check or claims_formal) and certificate is not None and status in (
            "PROVED",
            "DISPROVED",
        ):
            from omnibias.core.proof.lean_check import check_certificate

            theorem_prover_verified = check_certificate(certificate).verified
        if status == "PROVED" and claims_formal and not theorem_prover_verified:
            status = "BLOCKED"
            honesty_ok = False
            obligations.append(
                "honesty gate: 'theorem_prover_verified' asserted but the Lean "
                "kernel did not verify the certificate's obligation"
            )

        return Verdict(
            status=status,
            conjecture=conjecture.name,
            kind=conjecture.kind,
            prover=prover.name,
            certificate=certificate,
            obligations=tuple(obligations),
            schema_ok=schema_ok,
            replay_ok=replay_ok,
            honesty_ok=honesty_ok,
            detail=attempt.detail,
            certificate_schema_version=schema_version,
            theorem_prover_verified=theorem_prover_verified,
        )
View source ↗
evaluate_allmethod
evaluate_all(self, conjectures: Iterable[Conjecture], *, replay: bool=True, lean_check: bool=False, strict: bool=False) -> list[Verdict]

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
conjecturespositional-or-keywordIterable[Conjecture]RequiredSee the operation contract and implementation below.
replaykeyword-onlyboolDefault: TrueSee the operation contract and implementation below.
lean_checkkeyword-onlyboolDefault: FalseSee the operation contract and implementation below.
strictkeyword-onlyboolDefault: FalseSee the operation contract and implementation below.

Returns: list[Verdict]

Executed regression · evaluate all batches

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_evaluate_all_batches() -> None:
    machine = ProofMachine().register(_sign_prover())
    conjectures = [
        Conjecture("a", "sign", {"value": 1.0}),
        Conjecture("b", "sign", {"value": -1.0}),
    ]
    verdicts = machine.evaluate_all(conjectures)
    assert [v.status for v in verdicts] == ["PROVED", "DISPROVED"]
    assert verdicts[0].summary()["status"] == "PROVED"
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_evaluate_all_batches" -q
Method implementation
    def evaluate_all(
        self,
        conjectures: Iterable[Conjecture],
        *,
        replay: bool = True,
        lean_check: bool = False,
        strict: bool = False,
    ) -> list[Verdict]:
        return [
            self.evaluate(conjecture, replay=replay, lean_check=lean_check, strict=strict)
            for conjecture in conjectures
        ]
View source ↗
registryattribute
registry: ProverRegistry = registry if registry is not None else ProverRegistry()

Public instance attribute assigned by __init__. The source assignment is registry = registry if registry is not None else ProverRegistry(); it describes instance state, not a literal constructor default.

View source ↗
Read the implementation
class ProofMachine:
    """Dispatch a :class:`Conjecture` to a prover and adjudicate a :class:`Verdict`.

    Pipeline: select prover -> ``attempt`` -> schema gate -> independent replay
    -> honesty gate.  A prover's ``PROVED`` (or ``DISPROVED``) is downgraded to
    ``BLOCKED`` whenever the schema is invalid, an independent replay disagrees,
    or (for ``PROVED``) an asserted honesty claim is unsupported.
    """

    def __init__(self, registry: ProverRegistry | None = None) -> None:
        self.registry: ProverRegistry = registry if registry is not None else ProverRegistry()

    def register(self, prover: Prover) -> ProofMachine:
        self.registry.register(prover)
        return self

    @property
    def provers(self) -> tuple[Prover, ...]:
        return self.registry.provers

    def kinds(self) -> tuple[str, ...]:
        return self.registry.kinds()

    def evaluate(
        self,
        conjecture: Conjecture,
        *,
        replay: bool = True,
        lean_check: bool = False,
        strict: bool = False,
    ) -> Verdict:
        """Adjudicate a single conjecture.

        Two always-on gates run on any certificate (both non-breaking, because they
        only fire on certificates that opt into the relevant format):

        * **digest gate** -- if the certificate carries a ``digest`` it must match
          its body (:func:`~omnibias.core.proof.certificate.verify_certificate_digest`),
          so a tampered or stale sealed certificate is downgraded to ``BLOCKED``;
        * **v1 schema gate** -- a certificate whose ``schema_version`` is a
          supported v1 envelope is additionally validated with
          :func:`~omnibias.core.proof.certificate.schema_errors_v1`.

        When ``strict`` is true a ``PROVED``/``DISPROVED`` verdict additionally
        requires (i) a certificate, (ii) a present *and* valid tamper-evident
        digest, and (iii) an independent replay twin that **agrees**
        (``replay_ok is True``; ``None`` or ``False`` blocks).  This is the
        "treat the verdict as tamper-evident *and* independently replayed" mode;
        the default (non-strict) preserves graceful degradation when a replay twin
        or a digest is absent.

        When ``lean_check`` is true (or the conjecture asserts the
        ``theorem_prover_verified`` claim) and a Lean toolchain is available, the
        produced certificate's finite obligation is re-checked by the Lean kernel
        (:mod:`omnibias.core.proof.lean_check`); the resulting
        :attr:`Verdict.theorem_prover_verified` flag is set only on a genuine
        kernel pass.  Asserting the claim without a passing kernel downgrades a
        ``PROVED`` verdict to ``BLOCKED`` (the formal honesty gate).
        """
        prover = self.registry.select(conjecture)
        if prover is None:
            return Verdict(
                status="BLOCKED",
                conjecture=conjecture.name,
                kind=conjecture.kind,
                prover="<none>",
                certificate=None,
                obligations=(
                    f"no registered prover handles kind {conjecture.kind!r}",
                ),
                schema_ok=False,
                replay_ok=None,
                honesty_ok=honesty_gate(conjecture, None),
                detail="no prover registered for this kind",
            )

        attempt = prover.attempt(conjecture)
        certificate = attempt.certificate
        obligations: list[str] = list(attempt.obligations)

        schema_ok = True
        if certificate is not None:
            errors = prover.schema_errors(certificate)
            if errors:
                schema_ok = False
                obligations.extend(f"schema: {message}" for message in errors)
            # Tamper-evidence (always on): a certificate that carries a digest must
            # match its body (the same check the Lean bridge runs). Only fires on
            # sealed certs, so the many unsealed certified-evidence certs are unaffected.
            if "digest" in certificate and not verify_certificate_digest(certificate):
                schema_ok = False
                obligations.append(
                    "schema: certificate digest mismatch (tampered or stale)"
                )

        honesty_ok = honesty_gate(conjecture, certificate)

        replay_ok: bool | None = None
        if (replay or strict) and certificate is not None:
            replay_ok = prover.replay(certificate)

        status: VerdictStatus = attempt.status
        if status in ("PROVED", "DISPROVED"):
            if not schema_ok:
                status = "BLOCKED"
                obligations.append("schema validation failed")
            if replay_ok is False:
                status = "BLOCKED"
                obligations.append("independent replay disagreed with the certificate")
            if strict:
                if certificate is None:
                    status = "BLOCKED"
                    obligations.append("strict mode: no certificate to adjudicate")
                else:
                    if "digest" not in certificate:
                        status = "BLOCKED"
                        obligations.append(
                            "strict mode: an unsealed certificate (no tamper-evident "
                            "digest) cannot back a strict verdict"
                        )
                    # Require a well-formed v1 envelope (claim/payload/honesty/digest
                    # present and the digest valid).
                    v1_errors = schema_errors_v1(certificate)
                    if v1_errors:
                        status = "BLOCKED"
                        obligations.extend(
                            f"strict mode schema(v1): {message}" for message in v1_errors
                        )
                if replay_ok is not True:
                    status = "BLOCKED"
                    obligations.append(
                        "strict mode: requires an independent replay twin that "
                        "agrees (replay_ok must be True)"
                    )
        if status == "PROVED" and not honesty_ok:
            status = "BLOCKED"
            obligations.append(
                "honesty gate: an asserted claim is not supported by the "
                "certificate's honesty flags (no external evidence attached)"
            )

        schema_version: str | None = None
        if certificate is not None:
            candidate = certificate.get("schema_version")
            if isinstance(candidate, str):
                schema_version = candidate

        # Formal (Lean-kernel) gate: set theorem_prover_verified only on a genuine
        # kernel pass; an asserted-but-unbacked formal claim blocks a PROVED verdict.
        claims_formal = bool(conjecture.claims.get(FORMAL_CLAIM_KEY, False))
        theorem_prover_verified = False
        if (lean_check or claims_formal) and certificate is not None and status in (
            "PROVED",
            "DISPROVED",
        ):
            from omnibias.core.proof.lean_check import check_certificate

            theorem_prover_verified = check_certificate(certificate).verified
        if status == "PROVED" and claims_formal and not theorem_prover_verified:
            status = "BLOCKED"
            honesty_ok = False
            obligations.append(
                "honesty gate: 'theorem_prover_verified' asserted but the Lean "
                "kernel did not verify the certificate's obligation"
            )

        return Verdict(
            status=status,
            conjecture=conjecture.name,
            kind=conjecture.kind,
            prover=prover.name,
            certificate=certificate,
            obligations=tuple(obligations),
            schema_ok=schema_ok,
            replay_ok=replay_ok,
            honesty_ok=honesty_ok,
            detail=attempt.detail,
            certificate_schema_version=schema_version,
            theorem_prover_verified=theorem_prover_verified,
        )

    def evaluate_all(
        self,
        conjectures: Iterable[Conjecture],
        *,
        replay: bool = True,
        lean_check: bool = False,
        strict: bool = False,
    ) -> list[Verdict]:
        return [
            self.evaluate(conjecture, replay=replay, lean_check=lean_check, strict=strict)
            for conjecture in conjectures
        ]
CLASS

Prover​

omnibias.core.proof.ProverSource ↗
class Prover(Protocol)

Structural protocol every prover satisfies.

handles selects on Conjecture.kind; attempt produces a ProofAttempt; schema_errors validates a certificate (empty list == valid); replay runs an *independent* recomputation and returns True/False (or None when no twin exists).

name is declared **read-only**: a mutable name: str member would demand a settable attribute, which the frozen FunctionProver adapter cannot provide, so no frozen prover could satisfy this protocol under a strict type check. A read-only member accepts both plain attributes and properties.

Fields & methods

nameproperty
name(self) -> str

See the class contract above and the exact method implementation below.

Returns: str

Method implementation
    def name(self) -> str: ...
View source ↗
handlesmethod
handles(self, conjecture: Conjecture) -> bool

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.

Returns: bool

Method implementation
    def handles(self, conjecture: Conjecture) -> bool: ...
View source ↗
attemptmethod
attempt(self, conjecture: Conjecture) -> ProofAttempt

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.

Returns: ProofAttempt

Method implementation
    def attempt(self, conjecture: Conjecture) -> ProofAttempt: ...
View source ↗
schema_errorsmethod
schema_errors(self, certificate: Certificate) -> list[str]

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
certificatepositional-or-keywordCertificateRequiredSee the operation contract and implementation below.

Returns: list[str]

Method implementation
    def schema_errors(self, certificate: Certificate) -> list[str]: ...
View source ↗
replaymethod
replay(self, certificate: Certificate) -> bool | None

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
certificatepositional-or-keywordCertificateRequiredSee the operation contract and implementation below.

Returns: bool | None

Method implementation
    def replay(self, certificate: Certificate) -> bool | None: ...
View source ↗
Read the implementation
class Prover(Protocol):
    """Structural protocol every prover satisfies.

    ``handles`` selects on :attr:`Conjecture.kind`; ``attempt`` produces a
    :class:`ProofAttempt`; ``schema_errors`` validates a certificate (empty list
    == valid); ``replay`` runs an *independent* recomputation and returns
    ``True``/``False`` (or ``None`` when no twin exists).

    ``name`` is declared **read-only**: a mutable ``name: str`` member would demand
    a settable attribute, which the frozen :class:`FunctionProver` adapter cannot
    provide, so no frozen prover could satisfy this protocol under a strict type
    check.  A read-only member accepts both plain attributes and properties.
    """

    @property
    def name(self) -> str: ...

    def handles(self, conjecture: Conjecture) -> bool: ...

    def attempt(self, conjecture: Conjecture) -> ProofAttempt: ...

    def schema_errors(self, certificate: Certificate) -> list[str]: ...

    def replay(self, certificate: Certificate) -> bool | None: ...
CLASS

ProverRegistry​

omnibias.core.proof.ProverRegistrySource ↗
class ProverRegistry

An ordered collection of provers with kind-based selection.

Parameters

NameType & defaultContract
proverspositional-or-keywordIterable[Prover] | NoneDefault: NoneSee the operation contract and implementation below.
Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Regression example · registry select first match and replay none keeps verdict

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_registry_select_first_match_and_replay_none_keeps_verdict() -> None:
    def prove(conjecture: Conjecture) -> ProofAttempt:
        return ProofAttempt(status="PROVED", certificate={"honesty": {}})

    prover = FunctionProver(name="noreplay", kinds=frozenset({"k"}), prove_fn=prove)
    registry = ProverRegistry([prover])
    assert registry.select(Conjecture("a", "k", {})) is prover
    assert registry.select(Conjecture("a", "other", {})) is None

    machine = ProofMachine(registry)
    verdict = machine.evaluate(Conjecture("a", "k", {}))
    assert isinstance(verdict, Verdict)
    # No replay twin -> replay_ok is None and the PROVED verdict stands.
    assert verdict.replay_ok is None
    assert verdict.status == "PROVED"
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_registry_select_first_match_and_replay_none_keeps_verdict -q

Fields & methods

__init__method
__init__(self, provers: Iterable[Prover] | None=None) -> None

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
proverspositional-or-keywordIterable[Prover] | NoneDefault: NoneSee the operation contract and implementation below.

Returns: None

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def __init__(self, provers: Iterable[Prover] | None = None) -> None:
        self._provers: list[Prover] = list(provers) if provers is not None else []
View source ↗
registermethod
register(self, prover: Prover) -> ProverRegistry

Append prover (returns self for chaining).

Parameters

NameType & defaultContract
proverpositional-or-keywordProverRequiredSee the operation contract and implementation below.

Returns: ProverRegistry

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def register(self, prover: Prover) -> ProverRegistry:
        """Append ``prover`` (returns ``self`` for chaining)."""
        self._provers.append(prover)
        return self
View source ↗
extendmethod
extend(self, provers: Iterable[Prover]) -> ProverRegistry

See the class contract above and the exact method implementation below.

Parameters

NameType & defaultContract
proverspositional-or-keywordIterable[Prover]RequiredSee the operation contract and implementation below.

Returns: ProverRegistry

Method implementation
    def extend(self, provers: Iterable[Prover]) -> ProverRegistry:
        for prover in provers:
            self._provers.append(prover)
        return self
View source ↗
proversproperty
provers(self) -> tuple[Prover, ...]

See the class contract above and the exact method implementation below.

Returns: tuple[Prover, ...]

Method implementation
    def provers(self) -> tuple[Prover, ...]:
        return tuple(self._provers)
View source ↗
kindsmethod
kinds(self) -> tuple[str, ...]

All conjecture kinds handled by at least one registered prover.

Returns: tuple[str, ...]

Executed regression · machine proves disproves and blocks

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_proves_disproves_and_blocks() -> None:
    machine = ProofMachine().register(_sign_prover())
    assert machine.kinds() == ("sign",)

    proved = machine.evaluate(Conjecture("pos", "sign", {"value": 3.0}))
    assert proved.status == "PROVED"
    assert proved.proved is True
    assert proved.schema_ok is True
    assert proved.replay_ok is True
    assert proved.honesty_ok is True

    disproved = machine.evaluate(Conjecture("neg", "sign", {"value": -3.0}))
    assert disproved.status == "DISPROVED"
    assert disproved.disproved is True

    blocked = machine.evaluate(Conjecture("zero", "sign", {"value": 0.0}))
    assert blocked.status == "BLOCKED"
    assert "value is zero" in blocked.obligations
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_machine_proves_disproves_and_blocks" -q
Method implementation
    def kinds(self) -> tuple[str, ...]:
        """All conjecture kinds handled by at least one registered prover."""
        seen: dict[str, None] = {}
        for prover in self._provers:
            kinds = getattr(prover, "kinds", None)
            if kinds is not None:
                for kind in kinds:
                    seen[str(kind)] = None
        return tuple(seen)
View source ↗
selectmethod
select(self, conjecture: Conjecture) -> Prover | None

The first registered prover that handles conjecture (or None).

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.

Returns: Prover | None

Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Method implementation
    def select(self, conjecture: Conjecture) -> Prover | None:
        """The first registered prover that handles ``conjecture`` (or ``None``)."""
        for prover in self._provers:
            if prover.handles(conjecture):
                return prover
        return None
View source ↗
Read the implementation
class ProverRegistry:
    """An ordered collection of provers with kind-based selection."""

    def __init__(self, provers: Iterable[Prover] | None = None) -> None:
        self._provers: list[Prover] = list(provers) if provers is not None else []

    def register(self, prover: Prover) -> ProverRegistry:
        """Append ``prover`` (returns ``self`` for chaining)."""
        self._provers.append(prover)
        return self

    def extend(self, provers: Iterable[Prover]) -> ProverRegistry:
        for prover in provers:
            self._provers.append(prover)
        return self

    @property
    def provers(self) -> tuple[Prover, ...]:
        return tuple(self._provers)

    def kinds(self) -> tuple[str, ...]:
        """All conjecture kinds handled by at least one registered prover."""
        seen: dict[str, None] = {}
        for prover in self._provers:
            kinds = getattr(prover, "kinds", None)
            if kinds is not None:
                for kind in kinds:
                    seen[str(kind)] = None
        return tuple(seen)

    def select(self, conjecture: Conjecture) -> Prover | None:
        """The first registered prover that handles ``conjecture`` (or ``None``)."""
        for prover in self._provers:
            if prover.handles(conjecture):
                return prover
        return None
CLASS

Verdict​

omnibias.core.proof.VerdictSource ↗
class Verdict

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The machine's adjudication of a Conjecture.

Parameters

NameType & defaultContract
statusdataclass fieldVerdictStatusRequiredSee the operation contract and implementation below.
conjecturedataclass fieldstrRequiredSee the operation contract and implementation below.
kinddataclass fieldstrRequiredSee the operation contract and implementation below.
proverdataclass fieldstrRequiredSee the operation contract and implementation below.
certificatedataclass fieldCertificate | NoneRequiredSee the operation contract and implementation below.
obligationsdataclass fieldtuple[str, ...]RequiredSee the operation contract and implementation below.
schema_okdataclass fieldboolRequiredSee the operation contract and implementation below.
replay_okdataclass fieldbool | NoneRequiredSee the operation contract and implementation below.
honesty_okdataclass fieldboolRequiredSee the operation contract and implementation below.
detaildataclass fieldstrDefault: ''See the operation contract and implementation below.
certificate_schema_versiondataclass fieldstr | NoneDefault: NoneSee the operation contract and implementation below.
theorem_prover_verifieddataclass fieldboolDefault: FalseSee the operation contract and implementation below.
Executed regression · evaluate all batches

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_evaluate_all_batches() -> None:
    machine = ProofMachine().register(_sign_prover())
    conjectures = [
        Conjecture("a", "sign", {"value": 1.0}),
        Conjecture("b", "sign", {"value": -1.0}),
    ]
    verdicts = machine.evaluate_all(conjectures)
    assert [v.status for v in verdicts] == ["PROVED", "DISPROVED"]
    assert verdicts[0].summary()["status"] == "PROVED"
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_evaluate_all_batches" -q
Regression example · verdict has new fields with defaults

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_verdict_has_new_fields_with_defaults() -> None:
    v = Verdict(
        status="PROVED",
        conjecture="c",
        kind="k",
        prover="p",
        certificate=None,
        obligations=(),
        schema_ok=True,
        replay_ok=None,
        honesty_ok=True,
    )
    assert v.certificate_schema_version is None
    assert v.theorem_prover_verified is False
    assert v.summary()["theorem_prover_verified"] is False
python -m pytest packages/omnibias-core/tests/test_certificate.py -k test_verdict_has_new_fields_with_defaults -q

Fields & methods

statusfield
status: VerdictStatus

Declared VerdictStatus field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
conjecturefield
conjecture: str

Declared str field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
kindfield
kind: str

Declared str field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
proverfield
prover: str

Declared str field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
certificatefield
certificate: Certificate | None

Declared Certificate | None field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
obligationsfield
obligations: tuple[str, ...]

Declared tuple[str, ...] field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
schema_okfield
schema_ok: bool

Declared bool field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
replay_okfield
replay_ok: bool | None

Declared bool | None field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
honesty_okfield
honesty_ok: bool

Declared bool field on Verdict. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
detailfield
detail: str = ''

Declared str field on Verdict. Default expression: ''.

View source ↗
certificate_schema_versionfield
certificate_schema_version: str | None = None

The schema_version carried by the certificate.

Regression example · verdict has new fields with defaults

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_verdict_has_new_fields_with_defaults() -> None:
    v = Verdict(
        status="PROVED",
        conjecture="c",
        kind="k",
        prover="p",
        certificate=None,
        obligations=(),
        schema_ok=True,
        replay_ok=None,
        honesty_ok=True,
    )
    assert v.certificate_schema_version is None
    assert v.theorem_prover_verified is False
    assert v.summary()["theorem_prover_verified"] is False
python -m pytest packages/omnibias-core/tests/test_certificate.py -k test_verdict_has_new_fields_with_defaults -q
View source ↗
theorem_prover_verifiedfield
theorem_prover_verified: bool = False

True only when a formal theorem-prover kernel re-checked the certificate (set by the Lean bridge); False otherwise.

Regression example · verdict has new fields with defaults

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_verdict_has_new_fields_with_defaults() -> None:
    v = Verdict(
        status="PROVED",
        conjecture="c",
        kind="k",
        prover="p",
        certificate=None,
        obligations=(),
        schema_ok=True,
        replay_ok=None,
        honesty_ok=True,
    )
    assert v.certificate_schema_version is None
    assert v.theorem_prover_verified is False
    assert v.summary()["theorem_prover_verified"] is False
python -m pytest packages/omnibias-core/tests/test_certificate.py -k test_verdict_has_new_fields_with_defaults -q
View source ↗
provedproperty
proved(self) -> bool

See the class contract above and the exact method implementation below.

Returns: bool

Executed regression · machine proves disproves and blocks

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_proves_disproves_and_blocks() -> None:
    machine = ProofMachine().register(_sign_prover())
    assert machine.kinds() == ("sign",)

    proved = machine.evaluate(Conjecture("pos", "sign", {"value": 3.0}))
    assert proved.status == "PROVED"
    assert proved.proved is True
    assert proved.schema_ok is True
    assert proved.replay_ok is True
    assert proved.honesty_ok is True

    disproved = machine.evaluate(Conjecture("neg", "sign", {"value": -3.0}))
    assert disproved.status == "DISPROVED"
    assert disproved.disproved is True

    blocked = machine.evaluate(Conjecture("zero", "sign", {"value": 0.0}))
    assert blocked.status == "BLOCKED"
    assert "value is zero" in blocked.obligations
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_machine_proves_disproves_and_blocks" -q
Method implementation
    def proved(self) -> bool:
        return self.status == "PROVED"
View source ↗
disprovedproperty
disproved(self) -> bool

See the class contract above and the exact method implementation below.

Returns: bool

Executed regression · machine proves disproves and blocks

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_proves_disproves_and_blocks() -> None:
    machine = ProofMachine().register(_sign_prover())
    assert machine.kinds() == ("sign",)

    proved = machine.evaluate(Conjecture("pos", "sign", {"value": 3.0}))
    assert proved.status == "PROVED"
    assert proved.proved is True
    assert proved.schema_ok is True
    assert proved.replay_ok is True
    assert proved.honesty_ok is True

    disproved = machine.evaluate(Conjecture("neg", "sign", {"value": -3.0}))
    assert disproved.status == "DISPROVED"
    assert disproved.disproved is True

    blocked = machine.evaluate(Conjecture("zero", "sign", {"value": 0.0}))
    assert blocked.status == "BLOCKED"
    assert "value is zero" in blocked.obligations
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_machine_proves_disproves_and_blocks" -q
Method implementation
    def disproved(self) -> bool:
        return self.status == "DISPROVED"
View source ↗
blockedproperty
blocked(self) -> bool

See the class contract above and the exact method implementation below.

Returns: bool

Method implementation
    def blocked(self) -> bool:
        return self.status == "BLOCKED"
View source ↗
summarymethod
summary(self) -> dict[str, Any]

A small JSON-serialisable digest (omits the full certificate).

Returns: dict[str, Any]

Executed regression · evaluate all batches

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_evaluate_all_batches() -> None:
    machine = ProofMachine().register(_sign_prover())
    conjectures = [
        Conjecture("a", "sign", {"value": 1.0}),
        Conjecture("b", "sign", {"value": -1.0}),
    ]
    verdicts = machine.evaluate_all(conjectures)
    assert [v.status for v in verdicts] == ["PROVED", "DISPROVED"]
    assert verdicts[0].summary()["status"] == "PROVED"
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_evaluate_all_batches" -q
Method implementation
    def summary(self) -> dict[str, Any]:
        """A small JSON-serialisable digest (omits the full certificate)."""
        return {
            "status": self.status,
            "conjecture": self.conjecture,
            "kind": self.kind,
            "prover": self.prover,
            "schema_ok": self.schema_ok,
            "replay_ok": self.replay_ok,
            "honesty_ok": self.honesty_ok,
            "obligations": list(self.obligations),
            "detail": self.detail,
            "certificate_schema_version": self.certificate_schema_version,
            "theorem_prover_verified": self.theorem_prover_verified,
        }
View source ↗
Read the implementation
class Verdict:
    """The machine's adjudication of a :class:`Conjecture`."""

    status: VerdictStatus
    conjecture: str
    kind: str
    prover: str
    certificate: Certificate | None
    obligations: tuple[str, ...]
    schema_ok: bool
    replay_ok: bool | None
    honesty_ok: bool
    detail: str = ""
    #: The ``schema_version`` carried by the certificate.
    certificate_schema_version: str | None = None
    #: ``True`` only when a formal theorem-prover kernel re-checked the
    #: certificate (set by the Lean bridge); ``False`` otherwise.
    theorem_prover_verified: bool = False

    @property
    def proved(self) -> bool:
        return self.status == "PROVED"

    @property
    def disproved(self) -> bool:
        return self.status == "DISPROVED"

    @property
    def blocked(self) -> bool:
        return self.status == "BLOCKED"

    def summary(self) -> dict[str, Any]:
        """A small JSON-serialisable digest (omits the full certificate)."""
        return {
            "status": self.status,
            "conjecture": self.conjecture,
            "kind": self.kind,
            "prover": self.prover,
            "schema_ok": self.schema_ok,
            "replay_ok": self.replay_ok,
            "honesty_ok": self.honesty_ok,
            "obligations": list(self.obligations),
            "detail": self.detail,
            "certificate_schema_version": self.certificate_schema_version,
            "theorem_prover_verified": self.theorem_prover_verified,
        }
CONSTANT

VerdictStatus​

omnibias.core.proof.VerdictStatusSource ↗
VerdictStatus = Literal['PROVED', 'DISPROVED', 'BLOCKED']

The three terminal verdicts.

Read the implementation
VerdictStatus = Literal["PROVED", "DISPROVED", "BLOCKED"]
FUNCTION

formal_claim_forgery_errors​

omnibias.core.proof.formal_claim_forgery_errorsSource ↗
formal_claim_forgery_errors(honesty: Mapping[str, Any] | None, *, certificate: Certificate | None=None, context: str='honesty') -> list[str]

Reject a *self-declared* theorem_prover_verified.

FORMAL_CLAIM_KEY is **earned** by a genuine Lean kernel pass, never asserted by the artifact that benefits from it. ProofMachine.evaluate already enforces that for conjectures, but any consumer that reads the flag straight out of a *stored* bundle (a JSON file on disk, which anyone can edit) would trust the artifact's own word for it. That is the one shape in which the claim can be forged, so validators call this helper and treat a non-empty result as a schema error.

A truthy declaration is accepted only when certificate is supplied *and* the kernel genuinely verifies its obligation. With no Lean toolchain present the bridge reports unverified, so the flag stays refused -- graceful degradation must never become silent acceptance.

Parameters

honesty: The artifact's honesty mapping (None and non-mappings are treated as declaring nothing). certificate: The certificate whose finite obligation the kernel should re-check. Omit it to refuse every truthy declaration outright. context: Dotted prefix used in the message, so the caller's schema report points at the offending field.

Returns

list[str] Empty when nothing is declared or the declaration is kernel-backed; otherwise a single explanatory error.

Parameters

NameType & defaultContract
honestypositional-or-keywordMapping[str, Any] | NoneRequiredThe artifact's honesty mapping (None and non-mappings are treated as declaring nothing).
certificatekeyword-onlyCertificate | NoneDefault: NoneThe certificate whose finite obligation the kernel should re-check. Omit it to refuse every truthy declaration outright.
contextkeyword-onlystrDefault: 'honesty'Dotted prefix used in the message, so the caller's schema report points at the offending field.
Returnslist[str]
Executed regression · forgery error names the offending field

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_forgery_error_names_the_offending_field() -> None:
    (error,) = formal_claim_forgery_errors({FORMAL_CLAIM_KEY: True}, context="bundle.honesty")
    assert error.startswith(f"bundle.honesty.{FORMAL_CLAIM_KEY}")
python -m pytest "packages/omnibias-core/tests/test_proof_machine.py::test_forgery_error_names_the_offending_field" -q
Regression example · honest artifact declares nothing and passes

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_honest_artifact_declares_nothing_and_passes() -> None:
    assert formal_claim_forgery_errors({FORMAL_CLAIM_KEY: False}) == []
    assert formal_claim_forgery_errors({}) == []
    assert formal_claim_forgery_errors(None) == []
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_honest_artifact_declares_nothing_and_passes -q
Read the implementation
def formal_claim_forgery_errors(
    honesty: Mapping[str, Any] | None,
    *,
    certificate: Certificate | None = None,
    context: str = "honesty",
) -> list[str]:
    """Reject a *self-declared* ``theorem_prover_verified``.

    :data:`FORMAL_CLAIM_KEY` is **earned** by a genuine Lean kernel pass, never
    asserted by the artifact that benefits from it. :meth:`ProofMachine.evaluate`
    already enforces that for conjectures, but any consumer that reads the flag
    straight out of a *stored* bundle (a JSON file on disk, which anyone can edit)
    would trust the artifact's own word for it. That is the one shape in which the
    claim can be forged, so validators call this helper and treat a non-empty
    result as a schema error.

    A truthy declaration is accepted only when ``certificate`` is supplied *and*
    the kernel genuinely verifies its obligation. With no Lean toolchain present
    the bridge reports unverified, so the flag stays refused -- graceful
    degradation must never become silent acceptance.

    Parameters
    ----------
    honesty:
        The artifact's ``honesty`` mapping (``None`` and non-mappings are treated
        as declaring nothing).
    certificate:
        The certificate whose finite obligation the kernel should re-check. Omit
        it to refuse every truthy declaration outright.
    context:
        Dotted prefix used in the message, so the caller's schema report points at
        the offending field.

    Returns
    -------
    list[str]
        Empty when nothing is declared or the declaration is kernel-backed;
        otherwise a single explanatory error.
    """
    if not isinstance(honesty, Mapping) or not bool(honesty.get(FORMAL_CLAIM_KEY, False)):
        return []
    if certificate is not None:
        from omnibias.core.proof.lean_check import check_certificate

        if check_certificate(certificate).verified:
            return []
    return [
        f"{context}.{FORMAL_CLAIM_KEY} is declared true but no Lean kernel pass "
        "supports it; the flag is earned by a genuine `lake build`, never asserted "
        "by the artifact claiming it"
    ]
FUNCTION

honesty_gate​

omnibias.core.proof.honesty_gateSource ↗
honesty_gate(conjecture: Conjecture, certificate: Certificate | None) -> bool

True iff every asserted honesty claim is backed by the certificate.

An asserted claims[key] == True requires certificate["honesty"][key] to be truthy. No assertions (the default) always passes.

Parameters

NameType & defaultContract
conjecturepositional-or-keywordConjectureRequiredSee the operation contract and implementation below.
certificatepositional-or-keywordCertificate | NoneRequiredSee the operation contract and implementation below.
Returnsbool
Executed regression · machine accepts valid sealed certificate

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_machine_accepts_valid_sealed_certificate() -> None:
    machine = ProofMachine().register(_sealed_prover(tamper=False))
    verdict = machine.evaluate(Conjecture("x", "sealed", {}))
    assert verdict.status == "PROVED"
    assert verdict.schema_ok is True
python -m pytest "packages/omnibias-core/tests/test_certificate_audit_regressions.py::test_machine_accepts_valid_sealed_certificate" -q
Regression example · honesty gate still ignores the formal claim

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_honesty_gate_still_ignores_the_formal_claim() -> None:
    """The conjecture-side rule and the artifact-side rule must agree."""
    cert: Certificate = {"honesty": {FORMAL_CLAIM_KEY: False}}
    conjecture = Conjecture("x", "k", {}, claims={FORMAL_CLAIM_KEY: True})
    # honesty_gate defers to ProofMachine.evaluate, which consults the kernel.
    assert honesty_gate(conjecture, cert) is True
python -m pytest packages/omnibias-core/tests/test_proof_machine.py -k test_honesty_gate_still_ignores_the_formal_claim -q
Read the implementation
def honesty_gate(conjecture: Conjecture, certificate: Certificate | None) -> bool:
    """``True`` iff every asserted honesty claim is backed by the certificate.

    An asserted ``claims[key] == True`` requires ``certificate["honesty"][key]``
    to be truthy.  No assertions (the default) always passes.
    """
    if not conjecture.claims:
        return True
    honesty: Mapping[str, Any] = {}
    if certificate is not None:
        candidate = certificate.get("honesty", {})
        if isinstance(candidate, Mapping):
            honesty = candidate
    for key, asserted in conjecture.claims.items():
        if key == FORMAL_CLAIM_KEY:
            continue  # earned by the Lean kernel, not a certificate honesty flag
        if asserted and not bool(honesty.get(key, False)):
            return False
    return True
FUNCTION

kernel_earned_theorem_prover_verified​

omnibias.core.proof.kernel_earned_theorem_prover_verifiedSource ↗
kernel_earned_theorem_prover_verified(bundle: Mapping[str, Any]) -> bool

Whether a Lean kernel pass backs bundle -- never trust honesty self-claims.

Looks for a sealed v1 certificate under bundle["certificate"], or treats bundle itself as the certificate when it already carries a digest+payload. Calls ~omnibias.core.proof.lean_check.check_certificate in either case (degrades to False when Lean is absent or the digest is missing/mismatched).

Parameters

NameType & defaultContract
bundlepositional-or-keywordMapping[str, Any]RequiredSee the operation contract and implementation below.
Returnsbool
Read the implementation
def kernel_earned_theorem_prover_verified(bundle: Mapping[str, Any]) -> bool:
    """Whether a Lean kernel pass backs ``bundle`` -- never trust honesty self-claims.

    Looks for a sealed v1 certificate under ``bundle["certificate"]``, or treats
    ``bundle`` itself as the certificate when it already carries a digest+payload.
    Calls :func:`~omnibias.core.proof.lean_check.check_certificate` in either case
    (degrades to ``False`` when Lean is absent or the digest is missing/mismatched).
    """
    cert: Mapping[str, Any] | None = None
    nested = bundle.get("certificate")
    if isinstance(nested, Mapping):
        cert = nested
    elif isinstance(bundle.get("digest"), str) and isinstance(bundle.get("payload"), Mapping):
        cert = bundle
    if cert is None:
        return False
    return bool(check_certificate(cert).verified)