Skip to content

Commit 5868a94

Browse files
hyperpolymathclaude
andcommitted
feat(er): Cap'n Proto schema for VeriSim E-R
crates/echidna-wire/schemas/verisim_er.capnp ships the wire format companion to docs/architecture/VERISIM-ER-SCHEMA.md. 12 structs (Octad + 8 modality payloads + ProofAttempt + CertificateBlob + ProverBinaryIntegrity), 4 enums (DeclKind, ChangeKind, Verdict, CertificateFormat), and 3 bulk-transport envelopes (OctadBatch, ProofAttemptBatch, CrossProverCluster materialised view). @0xe4dc7b1f01a06001 — fresh schema-file ID; consumers will auto-generate types via existing build.rs. Closes the "Cap'n Proto schema concrete struct IDs" open migration in the E-R doc. Lane: prover-corpus-saturation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3ce40bf commit 5868a94

1 file changed

Lines changed: 189 additions & 0 deletions

File tree

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
2+
# SPDX-License-Identifier: MPL-2.0
3+
#
4+
# VeriSim ↔ ECHIDNA E-R schema (wire format).
5+
# Companion to docs/architecture/VERISIM-ER-SCHEMA.md.
6+
7+
@0xe4dc7b1f01a06001;
8+
9+
using Common = import "common.capnp";
10+
11+
# --- E1 — Octad ---
12+
struct Octad {
13+
key @0 :Text; # UUIDv7
14+
createdAt @1 :UInt64; # epoch millis
15+
adapter @2 :Text; # "agda" / "coq" / "lean" / "idris2" / "isabelle" / "metamath" / "mizar" / "hol_light" / "hol4" / "dafny" / "why3" / "fstar" / "acl2_books" / "tptp" / "smtlib" / "proofnet" / "minif2f"
16+
moduleQualified @3 :Text; # CorpusEntry.qualified
17+
semantic @4 :Semantic;
18+
temporal @5 :Temporal;
19+
provenance @6 :Provenance;
20+
document @7 :Document;
21+
graph @8 :Graph;
22+
vector @9 :Vector;
23+
tensor @10 :Tensor;
24+
spatial @11 :Spatial;
25+
}
26+
27+
# --- E2 — Semantic ---
28+
enum DeclKind {
29+
function @0;
30+
data @1;
31+
record @2;
32+
postulate @3;
33+
module @4;
34+
}
35+
36+
struct Semantic {
37+
octadKey @0 :Text;
38+
kind @1 :DeclKind;
39+
name @2 :Text;
40+
statement @3 :Text;
41+
proof @4 :Text; # empty string if no proof (postulate / data)
42+
}
43+
44+
# --- E3 — Temporal ---
45+
enum ChangeKind {
46+
created @0;
47+
edited @1;
48+
renamed @2;
49+
refactored @3;
50+
deleted @4;
51+
}
52+
53+
struct VersionEntry {
54+
timestamp @0 :UInt64;
55+
changeKind @1 :ChangeKind;
56+
parentKey @2 :Text; # UUIDv7 of parent, empty for created
57+
}
58+
59+
struct Temporal {
60+
octadKey @0 :Text;
61+
versions @1 :List(VersionEntry);
62+
parentOctadKey @2 :Text; # empty = chain head
63+
}
64+
65+
# --- E4 — Provenance ---
66+
struct Provenance {
67+
octadKey @0 :Text;
68+
sourceHash @1 :Text; # SHA-256 hex of source file
69+
ingestActor @2 :Text; # CI job id / user agent
70+
ingestTs @3 :UInt64;
71+
chainPrevHash @4 :Text; # empty = chain head
72+
}
73+
74+
# --- E5 — Document ---
75+
struct Document {
76+
octadKey @0 :Text;
77+
searchableText @1 :Text;
78+
aspects @2 :List(Text);
79+
}
80+
81+
# --- E6 — Graph ---
82+
struct Graph {
83+
octadKey @0 :Text;
84+
dependsOn @1 :List(Text); # UUIDv7 list
85+
dependedOnBy @2 :List(Text);
86+
crossProverIdentityKey @3 :Text;
87+
}
88+
89+
# --- E7 — Vector ---
90+
struct Vector {
91+
octadKey @0 :Text;
92+
goalEmbedding @1 :List(Float32);
93+
embedder @2 :Text; # "hash-v1" / "gnn-v1"
94+
embedderDim @3 :UInt32;
95+
}
96+
97+
# --- E8 — Tensor ---
98+
struct Tensor {
99+
octadKey @0 :Text;
100+
proofDepth @1 :UInt32;
101+
statementSizeTokens @2 :UInt32;
102+
hazardBitmap @3 :UInt32;
103+
# bit 0 = postulate, 1 = believe_me, 2 = admitted, 3 = sorry,
104+
# 4 = trustme, 5+ = adapter-specific other flags
105+
axiomCount @4 :UInt32;
106+
}
107+
108+
# --- E9 — Spatial ---
109+
struct Spatial {
110+
octadKey @0 :Text;
111+
filePath @1 :Text;
112+
line @2 :UInt32;
113+
column @3 :UInt32; # 0 if unknown
114+
}
115+
116+
# --- E10 — ProofAttempt ---
117+
enum Verdict {
118+
proven @0;
119+
refuted @1;
120+
timeout @2;
121+
unknown @3;
122+
error @4;
123+
}
124+
125+
struct ProofAttempt {
126+
attemptId @0 :Text; # UUIDv7
127+
octadKey @1 :Text; # FK -> Octad.key
128+
prover @2 :Text; # ProverKind string
129+
verdict @3 :Verdict;
130+
startedAt @4 :UInt64;
131+
latencyMs @5 :UInt64;
132+
axiomCost @6 :UInt32;
133+
certificateBlobKey @7 :Text; # FK -> CertificateBlob.blobKey, empty if none
134+
proverBinaryHash @8 :Text; # FK -> ProverBinaryIntegrity.binaryHash
135+
confidenceSelfReported @9 :Float64; # NaN if not reported
136+
}
137+
138+
# --- E11 — CertificateBlob ---
139+
enum CertificateFormat {
140+
alethe @0;
141+
drat @1;
142+
lrat @2;
143+
tstp @3;
144+
openTheory @4;
145+
dedukti @5;
146+
lambdapi @6;
147+
smtCoq @7;
148+
other @8;
149+
}
150+
151+
struct CertificateBlob {
152+
blobKey @0 :Text; # SHAKE3-512 hex of content
153+
format @1 :CertificateFormat;
154+
bytes @2 :Data; # raw certificate
155+
createdAt @3 :UInt64;
156+
}
157+
158+
# --- E12 — ProverBinaryIntegrity ---
159+
struct ProverBinaryIntegrity {
160+
prover @0 :Text;
161+
binaryHash @1 :Text; # SHAKE3-512 + BLAKE3
162+
versionLabel @2 :Text; # e.g. "z3-4.13.0-ubuntu22-x64"
163+
firstSeenTs @3 :UInt64;
164+
}
165+
166+
# --- Bulk transport envelopes ---
167+
168+
# Used when streaming many octads in one wire message (e.g. corpus
169+
# ingest emit). One per producer batch.
170+
struct OctadBatch {
171+
batchId @0 :Text;
172+
producer @1 :Text;
173+
octads @2 :List(Octad);
174+
}
175+
176+
# Used when streaming many attempts (e.g. nightly learning daemon).
177+
struct ProofAttemptBatch {
178+
batchId @0 :Text;
179+
producer @1 :Text;
180+
attempts @2 :List(ProofAttempt);
181+
}
182+
183+
# --- E-R cross-prover cluster (materialised view) ---
184+
# Read-mostly: produced by VeriSimDB-side join, consumed by ECHIDNA.
185+
struct CrossProverCluster {
186+
identityKey @0 :Text; # e.g. "nat-add-commutativity"
187+
octadKeys @1 :List(Text); # all octads sharing this identity
188+
adapters @2 :List(Text); # distinct adapter names in this cluster
189+
}

0 commit comments

Comments
 (0)