11// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
22// SPDX-License-Identifier: PMPL-1.0-or-later
33
4- //! VQL -UT: Cross-Prover Query Language for ECHIDNA
4+ //! VCL -UT: Cross-Prover Query Language for ECHIDNA
55//!
66//! Typed query builder and executor for querying proof state across all 30
77//! prover backends via VeriSimDB's octad storage. Implements a subset of
8- //! VQL -UT with progressive type safety enforcement.
8+ //! VCL -UT with progressive type safety enforcement.
99//!
1010//! Query types:
1111//! - `FindProof` — retrieve a specific proof by theorem + prover
@@ -26,10 +26,10 @@ use tracing::{debug, info};
2626
2727use crate :: provers:: ProverKind ;
2828
29- #[ cfg( feature = "verisimdb " ) ]
29+ #[ cfg( feature = "verisim " ) ]
3030use crate :: proof_encoding;
31- #[ cfg( feature = "verisimdb " ) ]
32- use crate :: verisimdb_bridge :: { OctadPayload , VeriSimDBClient } ;
31+ #[ cfg( feature = "verisim " ) ]
32+ use crate :: verisim_bridge :: { OctadPayload , VeriSimDBClient } ;
3333
3434// ═══════════════════════════════════════════════════════════════════════
3535// Type Safety Levels
@@ -300,7 +300,7 @@ impl CrossProverQueryBuilder {
300300 // Level 7: Cardinality — must have a limit
301301 if level >= 7 && self . query . limit . is_none ( ) {
302302 anyhow:: bail!(
303- "VQL -UT Level {} requires a cardinality limit (use .with_limit())" ,
303+ "VCL -UT Level {} requires a cardinality limit (use .with_limit())" ,
304304 level
305305 ) ;
306306 }
@@ -311,7 +311,7 @@ impl CrossProverQueryBuilder {
311311 // Level 9: Temporal safety — must have a version constraint
312312 if level >= 9 && self . query . min_version . is_none ( ) {
313313 anyhow:: bail!(
314- "VQL -UT Level {} requires a version constraint (use .with_min_version())" ,
314+ "VCL -UT Level {} requires a version constraint (use .with_min_version())" ,
315315 level
316316 ) ;
317317 }
@@ -320,7 +320,7 @@ impl CrossProverQueryBuilder {
320320 // (enforced by VeriSimDB's provenance modality)
321321
322322 debug ! (
323- "VQL -UT query built: {:?} at level {} for {:?}" ,
323+ "VCL -UT query built: {:?} at level {} for {:?}" ,
324324 self . query. operation, level, self . query. theorem_name,
325325 ) ;
326326
@@ -332,37 +332,37 @@ impl CrossProverQueryBuilder {
332332// Query Executor
333333// ═══════════════════════════════════════════════════════════════════════
334334
335- /// Executes VQL -UT queries against VeriSimDB.
335+ /// Executes VCL -UT queries against VeriSimDB.
336336///
337- /// Uses the VeriSimDBClient from the verisimdb_bridge module when
338- /// the `verisimdb ` feature is enabled. Falls back to a no-op executor
337+ /// Uses the VeriSimDBClient from the verisim_bridge module when
338+ /// the `verisim ` feature is enabled. Falls back to a no-op executor
339339/// when VeriSimDB is not available.
340340pub struct QueryExecutor {
341- #[ cfg( feature = "verisimdb " ) ]
341+ #[ cfg( feature = "verisim " ) ]
342342 client : VeriSimDBClient ,
343343
344- #[ cfg( not( feature = "verisimdb " ) ) ]
344+ #[ cfg( not( feature = "verisim " ) ) ]
345345 _phantom : std:: marker:: PhantomData < ( ) > ,
346346}
347347
348348impl QueryExecutor {
349349 /// Create a new query executor.
350- #[ cfg( feature = "verisimdb " ) ]
351- pub fn new ( verisimdb_url : & str ) -> Self {
350+ #[ cfg( feature = "verisim " ) ]
351+ pub fn new ( verisim_url : & str ) -> Self {
352352 QueryExecutor {
353- client : VeriSimDBClient :: new ( verisimdb_url ) ,
353+ client : VeriSimDBClient :: new ( verisim_url ) ,
354354 }
355355 }
356356
357357 /// Create a new query executor (no VeriSimDB — stub mode).
358- #[ cfg( not( feature = "verisimdb " ) ) ]
358+ #[ cfg( not( feature = "verisim " ) ) ]
359359 pub fn new ( _verisimdb_url : & str ) -> Self {
360360 QueryExecutor {
361361 _phantom : std:: marker:: PhantomData ,
362362 }
363363 }
364364
365- /// Validate a query against TypeLL's VQL -UT 10-level type checker.
365+ /// Validate a query against TypeLL's VCL -UT 10-level type checker.
366366 ///
367367 /// Calls the TypeLL server at localhost:7800 to verify that the query
368368 /// meets its declared safety level. Returns the verified level and any
@@ -383,7 +383,7 @@ impl QueryExecutor {
383383 . context ( "Failed to create HTTP client for TypeLL" ) ?;
384384
385385 match client
386- . post ( format ! ( "{}/api/v1/vql -ut/check" , typell_url) )
386+ . post ( format ! ( "{}/api/v1/vcl -ut/check" , typell_url) )
387387 . json ( & check_body)
388388 . send ( )
389389 . await
@@ -409,11 +409,11 @@ impl QueryExecutor {
409409 . join ( "; " )
410410 } )
411411 . unwrap_or_default ( ) ;
412- anyhow:: bail!( "TypeLL VQL -UT validation failed: {}" , errors) ;
412+ anyhow:: bail!( "TypeLL VCL -UT validation failed: {}" , errors) ;
413413 }
414414
415415 info ! (
416- "TypeLL verified VQL -UT level {}/10 for {:?}" ,
416+ "TypeLL verified VCL -UT level {}/10 for {:?}" ,
417417 max_level, query. operation,
418418 ) ;
419419
@@ -459,7 +459,7 @@ impl QueryExecutor {
459459 /// execution. Falls back to local validation if TypeLL is unreachable.
460460 pub async fn execute ( & self , query : & ProofQuery ) -> Result < QueryResult > {
461461 info ! (
462- "Executing VQL -UT query: {:?} at level {:?}" ,
462+ "Executing VCL -UT query: {:?} at level {:?}" ,
463463 query. operation, query. level,
464464 ) ;
465465
@@ -493,7 +493,7 @@ impl QueryExecutor {
493493 async fn execute_find_proof ( & self , query : & ProofQuery ) -> Result < QueryResult > {
494494 let _theorem = query. theorem_name . as_deref ( ) . unwrap_or ( "" ) ;
495495
496- #[ cfg( feature = "verisimdb " ) ]
496+ #[ cfg( feature = "verisim " ) ]
497497 if let Some ( prover) = query. prover {
498498 // Generate the octad key and look it up directly
499499 if let Some ( ref goal_display) = query. goal_display {
@@ -529,7 +529,7 @@ impl QueryExecutor {
529529 let limit = query. limit . unwrap_or ( 10 ) ;
530530 let goal_display = query. goal_display . as_deref ( ) . unwrap_or ( "" ) ;
531531
532- #[ cfg( feature = "verisimdb " ) ]
532+ #[ cfg( feature = "verisim " ) ]
533533 {
534534 // Request a goal embedding from the Julia inference service
535535 let embedding = self
@@ -582,7 +582,7 @@ impl QueryExecutor {
582582 let theorem = query. theorem_name . as_deref ( ) . unwrap_or ( "" ) ;
583583 let limit = query. limit . unwrap_or ( 100 ) ;
584584
585- #[ cfg( feature = "verisimdb " ) ]
585+ #[ cfg( feature = "verisim " ) ]
586586 {
587587 let url = format ! (
588588 "{}/api/v1/search/text?q={}&limit={}" ,
@@ -624,7 +624,7 @@ impl QueryExecutor {
624624 /// Get the provenance trace for a proof.
625625 /// Calls VeriSimDB GET /api/v1/octads/{key} and extracts provenance modality.
626626 async fn execute_provenance ( & self , query : & ProofQuery ) -> Result < QueryResult > {
627- #[ cfg( feature = "verisimdb " ) ]
627+ #[ cfg( feature = "verisim " ) ]
628628 if let Some ( ref theorem) = query. theorem_name {
629629 if let Some ( ref goal_display) = query. goal_display {
630630 if let Some ( prover) = query. prover {
@@ -668,7 +668,7 @@ impl QueryExecutor {
668668 async fn execute_dependency ( & self , query : & ProofQuery ) -> Result < QueryResult > {
669669 let limit = query. limit . unwrap_or ( 50 ) ;
670670
671- #[ cfg( feature = "verisimdb " ) ]
671+ #[ cfg( feature = "verisim " ) ]
672672 if let Some ( ref theorem) = query. theorem_name {
673673 if let Some ( ref goal_display) = query. goal_display {
674674 if let Some ( prover) = query. prover {
@@ -736,7 +736,7 @@ impl QueryExecutor {
736736
737737 /// Fetch a goal embedding from the Julia inference service (port 8090).
738738 /// Returns a 512-dim f32 vector, or empty vec on failure.
739- #[ cfg( feature = "verisimdb " ) ]
739+ #[ cfg( feature = "verisim " ) ]
740740 async fn fetch_goal_embedding ( & self , goal_display : & str ) -> Result < Vec < f32 > > {
741741 let julia_url = std:: env:: var ( "ECHIDNA_JULIA_URL" )
742742 . unwrap_or_else ( |_| "http://localhost:8090" . to_string ( ) ) ;
@@ -774,7 +774,7 @@ impl QueryExecutor {
774774}
775775
776776/// Convert a VeriSimDB search result JSON value to a QueryResultEntry.
777- #[ cfg( feature = "verisimdb " ) ]
777+ #[ cfg( feature = "verisim " ) ]
778778fn search_result_to_entry ( value : & serde_json:: Value ) -> Option < QueryResultEntry > {
779779 Some ( QueryResultEntry {
780780 key : value. get ( "key" ) ?. as_str ( ) ?. to_string ( ) ,
@@ -852,7 +852,7 @@ mod urlencoding {
852852}
853853
854854/// Convert an OctadPayload to a QueryResultEntry.
855- #[ cfg( feature = "verisimdb " ) ]
855+ #[ cfg( feature = "verisim " ) ]
856856fn octad_to_entry ( octad : & OctadPayload ) -> QueryResultEntry {
857857 QueryResultEntry {
858858 key : octad. key . clone ( ) ,
0 commit comments