pub struct DerivationTree {
pub conclusion: ProofExpr,
pub rule: InferenceRule,
pub premises: Vec<DerivationTree>,
pub depth: usize,
pub substitution: Substitution,
}Expand description
The “Euclidean Structure” - A recursive tree representing the proof.
This is the object returned by the Prover. It allows the UI to render a step-by-step explanation (Natural Language Generation).
§Structure
Each node contains:
conclusion: The proposition proved at this steprule: The logical rule applied (how we know the conclusion)premises: Sub-proofs justifying the rule’s requirementssubstitution: Variable bindings from unification
§See Also
BackwardChainer::prove- Creates derivation treesInferenceRule- The rules that justify each stepProofExpr- The conclusion typecertifier::certify- Converts trees to kernel termshints::suggest_hint- Suggests next steps when stuck
Fields§
§conclusion: ProofExprThe logical statement proved at this node.
rule: InferenceRuleThe rule applied to justify this conclusion.
premises: Vec<DerivationTree>The sub-proofs that validate the requirements of the rule. Example: ModusPonens will have 2 children (The Implication, The Antecedent).
depth: usizeThe depth of the tree (used for complexity limits).
substitution: SubstitutionThe bindings unification discovered at this step — SEARCH TELEMETRY, not part of the claim.
Ten sites in BackwardChainer write it and NOTHING in the repository reads it: not
certifier::certify, not verify::check_derivation, not the derivation-document writer. Only the two
eigenconstant-renaming walkers touch it, and they only carry it along. So a rule that
recorded a substitution INSTEAD of instantiating its own conclusion would be believed by
nobody and checked by nobody — the certified term would prove one proposition while the
node claimed another, and every rule that computes from its own conclusion (a motive, a
rewrite’s endpoints) would compute from the stale one.
What keeps that from happening is an invariant, not a checker: a node’s conclusion is a
fixed point of its own substitution. Every writer either applies it to the conclusion
first or binds only variables the conclusion does not carry. It is locked by
T_tactics_extra::no_certified_node_records_a_substitution_its_conclusion_has_not_taken,
which sweeps the chainer and checks it directly — keep that green, or give the field a
reader.
Implementations§
Source§impl DerivationTree
impl DerivationTree
Sourcepub fn new(
conclusion: ProofExpr,
rule: InferenceRule,
premises: Vec<DerivationTree>,
) -> Self
pub fn new( conclusion: ProofExpr, rule: InferenceRule, premises: Vec<DerivationTree>, ) -> Self
Constructs a new Proof Node. Automatically calculates depth based on children.
Sourcepub fn leaf(conclusion: ProofExpr, rule: InferenceRule) -> Self
pub fn leaf(conclusion: ProofExpr, rule: InferenceRule) -> Self
A leaf node (usually a Premise, Axiom, or Oracle result).
Sourcepub fn with_substitution(self, subst: Substitution) -> Self
pub fn with_substitution(self, subst: Substitution) -> Self
Set the substitution for this derivation step.
Sourcepub fn uncertifiable_rules(&self) -> Vec<(String, &'static str)>
pub fn uncertifiable_rules(&self) -> Vec<(String, &'static str)>
Every node of this tree whose rule certifier::certify cannot build, as
(rule, why) pairs in pre-order — empty when the whole tree is certifiable.
A proof PRODUCER runs this before handing the tree to
verify::check_derivation. A DerivationTree is an ordinary Rust value:
any rule can be put in any node, the result type-checks, and a dead rule is
discovered only when certification reaches it — as a verification_error
that reads like the kernel refusing a proof. Asking here instead makes the
answer structural and keeps it where the producer can act on it: rebuild the
node out of live rules, or reject the input.
The dead rule is usually not at the root. A root of ExFalso over a subtree
justified by TemporalUnfolding is well-formed everywhere except the one
node that matters, which is why this walks the whole tree rather than
answering about self.rule.
Sourcepub fn display_tree(&self) -> String
pub fn display_tree(&self) -> String
Renders the proof as a text-based tree (for debugging/CLI).
Trait Implementations§
Source§impl Clone for DerivationTree
impl Clone for DerivationTree
Source§fn clone(&self) -> DerivationTree
fn clone(&self) -> DerivationTree
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more