engine.derivation¶
Engine-native derivation logging, contradiction recording, and proof reconstruction.
Exceptions¶
Warning emitted when a contradiction is detected. |
|
Error raised when a contradiction is detected. |
Classes¶
Interface for sinks of engine-native derivation records. |
|
Interface for sinks of engine-native contradiction records. |
|
Simple in-memory sink for engine-native derivation records. |
|
Drop-all sink for derivation records (no retention). |
|
Append-all sink for contradiction diagnostics (unbounded retention). |
|
Append each contradiction then raise |
|
Discard contradiction diagnostics after optional warning (zero retention). |
|
Interface for rebuilding DirectProof values from derivation records. |
|
Rebuild a DirectProof tree from engine-native trace records. |
Functions¶
|
Format one contradiction diagnostic for logs, warnings, or exceptions. |
Module Contents¶
- engine.derivation.format_contradiction_record(record: engine.proof.ContradictionRecord) str¶
Format one contradiction diagnostic for logs, warnings, or exceptions.
- exception engine.derivation.ContradictionWarning¶
Bases:
UserWarningWarning emitted when a contradiction is detected.
- class engine.derivation.DerivationLogger¶
Bases:
ProtocolInterface for sinks of engine-native derivation records.
These records are engine provenance artifacts, not user-facing proof steps.
- record(record: engine.proof.DerivationRecord) None¶
Append one engine-native derivation record.
- iter_records() collections.abc.Iterable[engine.proof.DerivationRecord]¶
Yield derivation records currently held by the sink.
- class engine.derivation.ContradictionRecorder¶
Bases:
ProtocolInterface for sinks of engine-native contradiction records.
- record(record: engine.proof.ContradictionRecord) None¶
Append one engine-native contradiction record.
- iter_records() collections.abc.Iterable[engine.proof.ContradictionRecord]¶
Yield contradiction records currently held by the sink.
- class engine.derivation.InMemoryDerivationLogger¶
Simple in-memory sink for engine-native derivation records.
- records: collections.abc.MutableSequence[engine.proof.DerivationRecord] = []¶
- record(record: engine.proof.DerivationRecord) None¶
Append one derivation record to the in-memory log.
- iter_records() collections.abc.Iterable[engine.proof.DerivationRecord]¶
Return a snapshot of all logged derivation records.
- class engine.derivation.DropDerivationLogger¶
Drop-all sink for derivation records (no retention).
- record(record: engine.proof.DerivationRecord) None¶
Discard
recordwithout retaining it.
- iter_records() collections.abc.Iterable[engine.proof.DerivationRecord]¶
Return an empty sequence because no records are retained.
- class engine.derivation.InMemoryContradictionRecorder¶
Append-all sink for contradiction diagnostics (unbounded retention).
When
warnis true (default), each contradiction also emitsContradictionWarningviawarnings.warn().- records: collections.abc.MutableSequence[engine.proof.ContradictionRecord] = []¶
- record(record: engine.proof.ContradictionRecord) None¶
Append one contradiction record to the in-memory log.
- iter_records() collections.abc.Iterable[engine.proof.ContradictionRecord]¶
Return a snapshot of all logged contradiction records.
- exception engine.derivation.ContradictionDetectedError(record: engine.proof.ContradictionRecord)¶
Bases:
RuntimeErrorError raised when a contradiction is detected.
- class engine.derivation.RaiseOnContradictionRecorder¶
Append each contradiction then raise
ContradictionDetectedError.Retention is unbounded (same list semantics as
InMemoryContradictionRecorder) unlessclear()is called.- records: collections.abc.MutableSequence[engine.proof.ContradictionRecord] = []¶
- record(record: engine.proof.ContradictionRecord) None¶
Append
recordand raiseContradictionDetectedError.
- iter_records() collections.abc.Iterable[engine.proof.ContradictionRecord]¶
Return a snapshot of contradiction records logged before any raise.
- class engine.derivation.DropContradictionRecorder¶
Discard contradiction diagnostics after optional warning (zero retention).
iter_records()is always empty—there is nothing forcontradiction_records()or explanation reconstruction to read from this recorder alone.- record(record: engine.proof.ContradictionRecord) None¶
Optionally warn about
recordand discard it without retention.
- iter_records() collections.abc.Iterable[engine.proof.ContradictionRecord]¶
Return an empty sequence because no records are retained.
- class engine.derivation.ExplanationReconstructor¶
Bases:
ProtocolInterface for rebuilding DirectProof values from derivation records.
- reconstruct(goal: engine.proof.ProofPayload, records: collections.abc.Iterable[engine.proof.DerivationRecord | engine.proof.ContradictionRecord]) engine.proof.DirectProof¶
Rebuild a
DirectProofforgoalfrom engine trace records.
- class engine.derivation.DerivationProofReconstructor¶
Rebuild a DirectProof tree from engine-native trace records.
Triple goals are reconstructed from
DerivationRecordvalues. Contradiction goals are reconstructed fromContradictionRecordvalues.- reconstruct(goal: engine.proof.ProofPayload, records: collections.abc.Iterable[engine.proof.DerivationRecord | engine.proof.ContradictionRecord]) engine.proof.DirectProof¶
Build a
DirectProoftree forgoalfrom derivation and contradiction records.