Skip to content

Commit e7f373e

Browse files
hyperpolymathclaude
andcommitted
feat: add GNN integration for proof search guidance (v2.1.0)
Implement Graph Neural Network integration across Rust core, Julia ML server, and Idris2 ABI. The GNN module enables neural-guided proof search by converting proof states into typed directed graphs, computing local embeddings, and ranking premises via GNN inference. Rust GNN module (src/rust/gnn/): - graph.rs: ProofGraphBuilder with 7 node kinds, 8 edge kinds, recursive term expansion, constant deduplication, shared-structure detection - embeddings.rs: 32-dim feature vectors with node/term kind one-hot, symbol frequency, structural complexity; cosine similarity - client.rs: HTTP client for Julia GNN server with graceful degradation - guided_search.rs: hybrid GNN+symbolic scoring (70/30 default weights), tactic inference, embedding cache, search statistics Julia GNN endpoint (src/julia/api/gnn_endpoint.jl): - POST /gnn/rank with sparse graph parsing and cosine fallback - GET /gnn/health for model availability checks Idris2 formal proofs (src/abi/EchidnaABI/Gnn.idr): - 7 proven properties: feature dim positivity, adjacency consistency, node/edge kind injectivity, depth monotonicity, DependsOn/UsefulFor duality, combined score boundedness - 0 believe_me, 0 postulates 28 new tests (556 total), 0 clippy warnings, #![forbid(unsafe_code)]. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 706556f commit e7f373e

12 files changed

Lines changed: 3111 additions & 7 deletions

File tree

CLAUDE.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document provides guidelines and context for working with Claude Code on th
77
**ECHIDNA** (Extensible Cognitive Hybrid Intelligence for Deductive Neural Assistance) is a trust-hardened neurosymbolic theorem proving platform supporting 48 prover backends with a comprehensive verification pipeline.
88

99
**Repository**: https://github.com/hyperpolymath/echidna
10-
**Version**: 2.0.0
10+
**Version**: 2.1.0
1111
**License**: PMPL-1.0-or-later
1212

1313
## Repository Structure
@@ -23,7 +23,8 @@ echidna/
2323
│ │ ├── exchange/ # Cross-prover proof exchange (OpenTheory, Dedukti)
2424
│ │ ├── dispatch.rs # Full trust-hardening dispatch pipeline
2525
│ │ ├── agent/ # Agentic proof search (actor model)
26-
│ │ ├── neural.rs # Neural premise selection
26+
│ │ ├── gnn/ # GNN integration (graph construction, embeddings, client, guided search)
27+
│ │ ├── neural.rs # Neural premise selection (text-based, complements GNN)
2728
│ │ ├── aspect.rs # Aspect tagging
2829
│ │ ├── core.rs # Core types (Term, ProofState, Tactic, Goal)
2930
│ │ ├── parsers/ # Proof file parsers
@@ -107,6 +108,7 @@ The v1.5 trust hardening added:
107108
- `src/rust/executor/`: Sandboxed solver execution
108109
- `src/rust/exchange/`: OpenTheory, Dedukti proof exchange
109110
- `src/rust/core.rs`: Core types (Term, ProofState, Tactic, Goal, Context, Theorem)
111+
- `src/rust/gnn/`: GNN integration (graph construction, embeddings, inference client, guided search)
110112
- `src/rust/agent/`: Agentic proof search (actor model)
111113

112114
### Current Status
@@ -125,8 +127,16 @@ The v1.5 trust hardening added:
125127
- Idris2 ABI formal proofs (16 modules, zero believe_me)
126128
- 0 clippy warnings, 0 compiler errors on stable Rust
127129

128-
**Next (v2.1+)**:
129-
- Deep learning models (Transformers via Flux.jl)
130+
**v2.1 (GNN Integration)**:
131+
- GNN proof graph construction (7 node kinds, 8 edge kinds)
132+
- 32-dim local term embeddings + GNN inference client
133+
- GNN-guided proof search (hybrid GNN + symbolic scoring)
134+
- Julia /gnn/rank endpoint with cosine fallback
135+
- Idris2 formal proofs: 7 GNN properties (0 believe_me)
136+
- 28 new tests, 0 clippy warnings
137+
138+
**Next (v2.2+)**:
139+
- Train GNN/Transformer on larger corpus (Flux.jl)
130140
- Chapel → Rust C FFI bridge
131141
- Tamarin/ProVerif bridge
132142

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "echidna"
5-
version = "2.0.0"
5+
version = "2.1.0"
66
edition = "2021"
77
authors = ["Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"]
88
license = "PMPL-1.0-or-later"

ROADMAP.adoc

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,64 @@ Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
151151
* [x] 528 unit tests (was 232), 38 integration, 21 property-based
152152
* [x] 0 clippy warnings, 0 compiler errors on stable Rust
153153

154-
=== Remaining (v2.1+)
154+
== v2.1 -- GNN Integration (IN PROGRESS)
155+
156+
=== GNN Proof Graph Construction (COMPLETE)
157+
* [x] Proof graph builder (`src/rust/gnn/graph.rs`): converts ProofState to typed directed graph
158+
* [x] 7 node kinds (Goal, Hypothesis, Premise, Subterm, TypeExpr, Binder, Constant)
159+
* [x] 8 edge kinds (Contains, References, Implies, HasType, BindsOver, SharedStructure, DependsOn, UsefulFor)
160+
* [x] Recursive term expansion with configurable depth limit
161+
* [x] Constant deduplication across terms
162+
* [x] Shared-structure edge detection between premises (Jaccard similarity)
163+
* [x] Sparse adjacency matrix export for Julia GNN encoder
164+
165+
=== GNN Term Embeddings (COMPLETE)
166+
* [x] Local feature extraction (`src/rust/gnn/embeddings.rs`): 32-dim feature vectors
167+
* [x] Node kind one-hot + term kind one-hot + structural features
168+
* [x] Symbol frequency counting (normalised across graph)
169+
* [x] Standalone term embedding with cosine similarity
170+
* [x] Two-pass feature extraction (frequency counting then encoding)
171+
172+
=== GNN Inference Client (COMPLETE)
173+
* [x] HTTP client (`src/rust/gnn/client.rs`) for Julia ML server
174+
* [x] JSON serialisation matching Julia TheoremGraph format
175+
* [x] Graceful degradation when server unavailable
176+
* [x] Health check, rank, and embed endpoints
177+
178+
=== GNN-Guided Proof Search (COMPLETE)
179+
* [x] Hybrid search strategy (`src/rust/gnn/guided_search.rs`)
180+
* [x] GNN + symbolic score combination with configurable weights (default 70/30)
181+
* [x] Tactic inference from premise names (Apply, Rewrite, Induction, Cases)
182+
* [x] Premise embedding cache for repeated queries
183+
* [x] Search statistics tracking (total calls, GNN vs fallback)
184+
185+
=== Julia GNN Server Endpoints (COMPLETE)
186+
* [x] POST /gnn/rank endpoint (`src/julia/api/gnn_endpoint.jl`)
187+
* [x] GET /gnn/health endpoint
188+
* [x] Cosine similarity fallback when model not trained
189+
* [x] Route registration for existing API server
190+
191+
=== Idris2 Formal Proofs for GNN (COMPLETE)
192+
* [x] `src/abi/EchidnaABI/Gnn.idr`: 7 proven properties
193+
* [x] Feature dimension positivity proof
194+
* [x] Sparse adjacency length consistency
195+
* [x] Node/edge kind index injectivity (no collisions)
196+
* [x] Depth expansion monotonicity (termination)
197+
* [x] DependsOn/UsefulFor duality
198+
* [x] Combined score boundedness
199+
* [x] 0 believe_me, 0 postulates
200+
201+
=== Testing (COMPLETE)
202+
* [x] 28 new unit tests for GNN module
203+
* [x] 0 clippy warnings on GNN code
204+
* [x] `#![forbid(unsafe_code)]` on all GNN modules
205+
206+
=== Remaining (v2.1)
155207
* [ ] Train GNN encoder on proof graphs (Flux.jl)
156208
* [ ] Train Transformer premise selector
209+
* [ ] Wire GNN scores into ProverDispatcher confidence
210+
211+
=== Remaining (v2.2+)
157212
* [ ] Chapel -> Rust C FFI bridge
158213
* [ ] OpenCyc domain knowledge integration
159214
* [ ] Tamarin/ProVerif bridge for cipherbot

0 commit comments

Comments
 (0)