pub struct ProofVerifier {
pub rules: HashMap<String, RuleSpec>,
pub memo: HashMap<u64, bool>,
pub in_progress: HashSet<u64>,
}Expand description
Verifies serialized proof trees by re-checking each node’s rule application.
Maintains a memoization cache so that shared sub-proofs (DAG structure) are
not re-verified on subsequent traversals. A fresh ProofVerifier starts
with an empty rule registry and an empty memo cache.
Fields§
§rules: HashMap<String, RuleSpec>Registered inference rules, keyed by rule ID.
memo: HashMap<u64, bool>Memoized verification results: node_id → verified.
in_progress: HashSet<u64>Nodes currently on the DFS stack — used for cycle detection.
Implementations§
Source§impl ProofVerifier
impl ProofVerifier
Sourcepub fn register_rule(&mut self, spec: RuleSpec)
pub fn register_rule(&mut self, spec: RuleSpec)
Register an inference rule. Replaces any existing rule with the same ID.
Sourcepub fn verify(&mut self, nodes: &[ProofNode]) -> VerificationResult
pub fn verify(&mut self, nodes: &[ProofNode]) -> VerificationResult
Verify a slice of ProofNodes.
Identifies the root as the node whose ID does not appear as any other node’s premise. If there is no unique root, the first node is used.
DFS from the root re-checks every rule application. Results are memoized so shared sub-proofs are counted as cache hits.
Sourcepub fn clear_memo(&mut self)
pub fn clear_memo(&mut self)
Reset memo cache and in-progress set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProofVerifier
impl RefUnwindSafe for ProofVerifier
impl Send for ProofVerifier
impl Sync for ProofVerifier
impl Unpin for ProofVerifier
impl UnsafeUnpin for ProofVerifier
impl UnwindSafe for ProofVerifier
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more