northroot-proof-engine 0.3.2

Core proof computation and validation library for PoSH (Proof of Shape) and PoX (Proof of Execution)
Documentation

Proof-of-Shape (PoSH) — v0.2 Mini Spec

Purpose (How): Prove the transformation contract—independent of any specific run or data values. Enables routing, plan caching, method equivalence, and reproducible packaging.

Out of scope: data values, timestamps, identity, spend, outputs.

1) Objects

1.1 Span Shape
	•	Definition: Operator contract (tool + version + parameter schema).
	•	Canonical fields (unordered map, canonicalized):
	•	tool_id: string (e.g., io.read_csv)
	•	tool_version: string (e.g., 1)
	•	param_schema: object (types/defaults only; no values)
	•	checker_ref?: string
	•	Hash: span_shape_hash = sha256(JCS(shape_object))

1.2 Method Shape (DAG)
	•	Definition: Composition of span shapes into a workflow.
	•	Canonical fields:
	•	nodes: [{id, span_shape_hash}]
	•	edges: [{from, to}] (optional in v0.2—may omit if using multiset root only)
	•	Roots:
	•	Multiset root (required):
method_shape_root = sha256(join_sorted(span_shape_hash_i, "|"))
	•	DAG root (optional v0.2, recommended v0.2.1):
method_dag_hash = sha256(JCS({nodes,edges}))

1.3 Method Manifest (publish once)

{
  "schema_version": "method.v1",
  "method_id": "com.acme/normalize-ledger",
  "version": "1.0.0",
  "method_shape_root": "sha256:...",
  "method_dag_hash": "sha256:...",        // optional in v0.2
  "runtime": {
    "image_digest": "sha256:oci-image-...",
    "method_fingerprint": "git:deadbeef"
  },
  "checker_refs": ["chk:ledger-balance@1"],
  "default_policy_id": "pol:standard-v1",
  "publisher_sig": { "alg":"ed25519","kid":"did:key:...","sig":"..." }
}

2) Canonicalization & Hashing
	•	Canonicalization: JSON Canonicalization Scheme (JCS) or lexicographically sorted keys.
	•	Hash: sha256:<64hex>.

3) API (PoSH)
	•	POST /methods — register manifest; verify publisher_sig; persist method_id@version.
	•	GET /methods/{id}@{version} — fetch manifest.
	•	GET /methods?shape_root=… — lookup by shape (optional).

4) Validation Rules
	•	tool_id, tool_version, and param_schema are required for span_shape_hash.
	•	method_shape_root must be recomputable from provided nodes’ span_shape_hash.
	•	image_digest and method_fingerprint are required pins for reproducibility.

5) Acceptance (PoSH)
	•	Equal operator contracts → equal span_shape_hash.
	•	Same node multiset → equal method_shape_root (even if edges omitted).
	•	Manifest is immutable once published (changes → new version).

⸻