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 (source ids / citations), following the same dict shape
mixle.substrate.core.SubstrateItem.provenanceandmixle.substrate.context.ContextPacketcitations already use.
Any of the four may be absent (a thin-shell System answer has no ledger yet);
verify_receipt() only checks what is present and marks the rest "absent" – it never invents a
pass for a claim the receipt does not make.
- class Receipt(answer, produced_by='', ledger=None, trace=None, calibration=None, provenance=<factory>)[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>)[source]
Bases:
objectWhich of the receipt’s claims hold.
passedis True only if every present claim checks out – an absent claim never counts as a pass or a failure, it is just not a claim this receipt makes.- property passed: bool
Whether no recorded verification check failed.
- verify_receipt(receipt, *, tools=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).