mixle.inference.receipt module¶
Receipt – bind an answer’s ledger, trace, calibration state, and provenance into one artifact
that a third party can re-verify offline, without re-running the teacher or
touching the substrate.
A receipt makes four claims, each independently checkable from data the receipt itself carries:
ledger – an
Explanation;is_exact()re-checks the additive identity (sum(parts) + correction == total) that is the evidence, not a summary of it.trace – an
ExecutionTrace; replaying it against the same tool registry must reproduce every step bit-for-bit (mixle.task.replay.is_bit_identical_replay()).calibration – the
alpha/qhat(or density-gate) state the answer was served under; a receipt with unknown calibration is flagged, never assumed calibrated.provenance – where the evidence came from:
{"sources": [{"id": ..., "digest": ..., "content": ...}, ...]}, each source’sdigestthecanonical_digest()of itscontent(contentmay be omitted and supplied toverify_receipt()asevidence={id: content}). A source without content to check against is"unobserved".
A receipt that carries a trace must also carry executables: {tool name:
:func:`~mixle.inference.integrity.implementation_digest`(tool)} for every tool the trace calls, so a
verifier can tell the registry it replays against is the one the answer was produced with.
Any of the four may be absent (a thin-shell System answer has no ledger yet);
verify_receipt() marks missing claims "absent" but does not promote an evidence-free receipt.
A declared trace without its exact executable registry, a calibration claim without observations, or a
provenance source without matching content is "unobserved" and cannot pass.
- class Receipt(answer, produced_by='', ledger=None, trace=None, calibration=None, provenance=<factory>, policy=<factory>, executables=<factory>, bindings=<factory>, receipt_digest='', schema_version='mixle-answer-receipt-v1')[source]
Bases:
objectThe bound artifact: an answer plus everything needed to re-verify it offline.
- Parameters:
- to_knowledge_dict(*, id, project_id, task)[source]
A plain dict shaped like
mixle_knowledge.contracts.AnswerReceipt(id/project_id/task/ produced_by/answer/ledger/trace/calibration/provenance), aligned with the mixle-knowledge receipt contracts. Distinct frommixle_knowledge.contracts.ArtifactReceipt, which certifies a trained model/artifact, not one served answer – this is the per-answer evidence trail an offline consumer re-verifies (recompute the ledger, replay the trace, resolve the citations).Stays a plain dict on purpose: mixle core carries no dependency on mixle-knowledge (platform contract packages depend on core, never the other way); constructing the validated pydantic object (
AnswerReceipt(**receipt.to_knowledge_dict(...))) is the receiving side’s job.
- class VerificationReport(checks=<factory>, required=())[source]
Bases:
objectWhich claims were observed and which required observations determine the verdict.
- property passed: bool
Whether at least one evidence claim was observed and every required check passed.
- verify_receipt(receipt, *, tools=None, evidence=None, tol=1e-9)[source]
Re-check every claim the receipt actually makes, using only the receipt’s own bound data (plus the
toolsregistry needed to re-execute a trace – the one piece that cannot be inlined into the receipt itself, since a tool is a function, not data).