Skip to content

Commit d0ade7f

Browse files
hyperpolymathclaude
andcommitted
feat: add V-lang API for theorem prover client
Multi-backend proof submission, backend validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3863630 commit d0ade7f

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

api/v/echidna.v

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
//
4+
// ECHIDNA V-lang API — Multi-backend theorem prover client.
5+
module echidna
6+
7+
pub enum ProverBackend {
8+
coq
9+
lean4
10+
idris2
11+
z3
12+
hol4
13+
hol_light
14+
isabelle
15+
mizar
16+
metamath
17+
pvs
18+
agda
19+
acl2
20+
}
21+
22+
pub enum ProofStatus {
23+
proven
24+
disproven
25+
timeout
26+
@error
27+
unknown
28+
}
29+
30+
pub struct ProofRequest {
31+
pub:
32+
goal string
33+
hypotheses []string
34+
backend ProverBackend
35+
timeout_ms int
36+
}
37+
38+
pub struct ProofResult {
39+
pub:
40+
status ProofStatus
41+
proof_text string
42+
backend ProverBackend
43+
time_ms int
44+
}
45+
46+
fn C.echidna_prove(goal_ptr &u8, backend int, timeout_ms int) int
47+
fn C.echidna_valid_backend(backend int) int
48+
fn C.echidna_backend_count() int
49+
50+
// prove submits a proof goal to the specified backend.
51+
pub fn prove(req ProofRequest) ProofResult {
52+
result := C.echidna_prove(req.goal.str, int(req.backend), req.timeout_ms)
53+
return ProofResult{
54+
status: unsafe { ProofStatus(result) }
55+
proof_text: ''
56+
backend: req.backend
57+
time_ms: 0
58+
}
59+
}
60+
61+
// is_valid_backend checks if a backend ID is supported.
62+
pub fn is_valid_backend(backend ProverBackend) bool {
63+
return C.echidna_valid_backend(int(backend)) == 1
64+
}
65+
66+
// backend_count returns the number of supported prover backends.
67+
pub fn backend_count() int {
68+
return C.echidna_backend_count()
69+
}

0 commit comments

Comments
 (0)