Expand description
Proof Serializer
Serializes and deserializes distributed backward-chaining proof trees for storage in IPLD and transmission over the network.
A ProofTreeInput (logical tree) is flattened in DFS order into a
SerializedProof whose proof_id is the FNV-1a hex digest of the
sorted, concatenated node IDs. Round-trip fidelity is guaranteed: every
field, binding, and topology is reconstructed by ProofSerializer::deserialize.
§Examples
use ipfrs_tensorlogic::proof_serializer::{
ProofNodeInput, ProofSerializer, ProofTreeInput,
};
use std::collections::HashMap;
// Build a trivial single-node proof.
let mut nodes = HashMap::new();
nodes.insert(
"n0".to_string(),
ProofNodeInput {
rule_id: None,
bindings: HashMap::new(),
children: vec![],
peer_id: None,
},
);
let input = ProofTreeInput {
root_goal: "n0".to_string(),
nodes,
proved: true,
};
let ser = ProofSerializer::default();
let proof = ser.serialize(&input).expect("example: should succeed in docs");
assert!(proof.proved);
assert_eq!(proof.depth, 0);
assert_eq!(proof.edge_count, 0);Structs§
- Proof
Node Input - A single node as provided by the caller prior to serialization.
- Proof
Node Record - A flattened representation of one node, suitable for storage and transmission.
- Proof
Serializer - Serializes and deserializes distributed proof trees.
- Proof
Serializer Stats - Atomic counters tracking
ProofSerializeractivity. - Proof
Serializer Stats Snapshot - A point-in-time snapshot of
ProofSerializerStatscounters. - Proof
Tree Input - Full proof tree as produced by the distributed backward chainer.
- Serialized
Proof - A fully serialized proof tree, ready for IPLD storage or network transmission.
Enums§
- Proof
SerError - Errors produced by
ProofSerializer.