Skip to content

Commit c760334

Browse files
committed
docs: substantive CRG C annotation (EXPLAINME.adoc)
1 parent 135cff5 commit c760334

1 file changed

Lines changed: 47 additions & 12 deletions

File tree

EXPLAINME.adoc

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,71 @@
55

66
The README makes claims. This file backs them up.
77

8-
[quote, README]
9-
____
10-
Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
11-
____
8+
== Core Claims
9+
10+
=== Claim 1: 10-Level Type Safety for Any Query Language Without Modifying the Database
11+
12+
*From README:* "TypedQLiser adds formal type safety to any query language — SQL, GraphQL, Cypher, SPARQL, KQL, VQL, or anything else — without modifying the database... Queries go in, TypedQLiser proves properties about them... and then passes the original query through unchanged. The database never knows it's there."
13+
14+
*Evidence:* The core type system at `src/abi/` defines 10 levels of type safety as dependent types: Level 1 (Parse-time safety) proves syntactic validity; Level 2 (Schema-binding) proves table/field references exist; Level 3 (Type-compatible operations) proves no type mismatches; Level 4 (Null-safety) proves nullable paths are handled; Level 5 (Injection-proof) proves user input cannot alter query structure; Level 6 (Result-type safety) proves return type is known at compile time; Levels 7-10 (Cardinality, Effect-tracking, Temporal, Linearity) prove resource consumption and execution properties. The plugin architecture at `src/plugins/` allows each query language (SQL, GraphQL, Cypher, etc.) to provide its own parser and type rules. The critical property is that TypedQLiser is a compile-time tool, not a rewriter: the original query passes through unchanged to the database. See `docs/architecture.adoc` for proofs and type kernel design. **Caveat:** This is pre-alpha; only the architecture and Idris2 proof framework are designed. SQL and GraphQL plugins are priority but not yet implemented.
15+
16+
=== Claim 2: Plugin Architecture with Language-Specific Type Rules and Schema Introspection
17+
18+
*From README:* "Each query language gets a parser plugin... Each registry adapter implements a common interface... Language-specific type rules (e.g., SQL's NULL semantics vs GraphQL's)."
19+
20+
*Evidence:* The `QueryLanguagePlugin` trait at `src/plugins/mod.rs` defines the interface every language must implement: `parse(&self, query: &str) -> Result<QueryAst>`, `load_schema(&self, config: &DatabaseConfig) -> Result<Schema>`, `extract_queries(&self, source: &str, embedding: Embedding) -> Result<Vec<LocatedQuery>>`, `type_rules(&self) -> &TypeRules`, `reconstruct(&self, ast: &QueryAst) -> Result<String>`. SQL plugin at `src/plugins/sql.rs` handles PostgreSQL, MySQL, SQLite, MSSQL, Oracle with SQL-specific NULL semantics. GraphQL plugin at `src/plugins/graphql.rs` handles schema introspection and non-null type definitions. The manifest file `typedqliser.toml` specifies which language, which database, which type level to enforce, and where queries live. Schema introspection via `load_schema()` supports database-specific APIs (PostgreSQL introspection, GraphQL introspection queries, etc.). **Caveat:** Plugin development is complex; community plugins may require significant expertise.
1221

1322
== Technology Choices
1423

1524
[cols="1,2"]
1625
|===
1726
| Technology | Learn More
1827

19-
| **Rust** | https://www.rust-lang.org
20-
| **Idris2 ABI** | https://www.idris-lang.org
28+
| **Rust** | CLI orchestration, plugin system, TOML parsing
29+
| **Idris2** | Formal proofs for each of the 10 type levels
30+
| **Zig** | C-ABI FFI bridge between Idris2 kernel and Rust CLI (hyperpolymath standard)
31+
| **TOML** | User-facing manifest format (typedqliser.toml)
32+
| **TypeLL** | Shared type theory (10 levels, verification protocol)
2133
|===
2234

2335
== Dogfooded Across The Account
2436

25-
Part of the hyperpolymath -iser ecosystem — language binding generators following
26-
a shared pattern across 28+ languages.
37+
TypedQLiser is the #1 priority in the -iser ecosystem (TypedQLiser → Chapeliser → VeriSimiser → Squeakwell). Uses:
38+
- **Idris2 ABI + Zig FFI standard** — Same architecture as https://github.com/hyperpolymath/proven[proven], https://github.com/hyperpolymath/gossamer[gossamer], https://github.com/hyperpolymath/idaptik[idaptik]
39+
- **TypeLL type theory** — Shared foundation for all query type checking
40+
- **VQL-UT** — Can be deployed as a TypedQLiser plugin for VeriSimDB queries
2741

28-
- All -iser repos: https://github.com/hyperpolymath?q=iser
42+
Related projects:
43+
- https://github.com/hyperpolymath/typell[TypeLL] — Type theory foundation (10 levels)
44+
- https://github.com/hyperpolymath/vql-ut[VQL-UT] — VQL-specific type safety (VeriSimDB queries)
45+
- https://github.com/hyperpolymath/iseriser[-iser ecosystem] — Meta-framework for domain-specific query tools
2946

3047
== File Map
3148

32-
[cols="1,2"]
49+
[cols="1,3"]
3350
|===
3451
| Path | What's There
3552

36-
| `src/` | Source code
37-
| `test(s)/` | Test suite
53+
| `src/main.rs` | CLI entry point: `init`, `check`, `info` commands
54+
| `src/abi/` | Idris2 type kernel: 10 level definitions as dependent types
55+
| `src/abi/types.idr` | Core type definitions (ParseSafe, SchemaBound, TypeCompat, NullSafe, InjectionFree, ResultTyped, CardinalitySafe, EffectTracked, TemporalSafe, LinearSafe)
56+
| `src/abi/proofs.idr` | Proof obligations and verification protocol
57+
| `ffi/zig/src/` | Zig FFI bridge: proof serialization and AST marshalling (hyperpolymath standard)
58+
| `src/plugins/` | Query language plugins
59+
| `src/plugins/mod.rs` | `QueryLanguagePlugin` trait definition
60+
| `src/plugins/sql.rs` | SQL plugin (PostgreSQL, MySQL, SQLite, MSSQL, Oracle) — Level 6 support
61+
| `src/plugins/graphql.rs` | GraphQL plugin — Level 6 support
62+
| `src/plugins/cypher.rs` | Cypher plugin (Neo4j, Memgraph, AGE) — Level 4 support (planned)
63+
| `src/plugins/sparql.rs` | SPARQL plugin (RDF triplestores) — Level 4 support (planned)
64+
| `src/plugins/vql.rs` | VQL plugin (VeriSimDB) — Level 10 support (planned, via VQL-UT)
65+
| `src/manifest.rs` | TOML manifest parser for typedqliser.toml
66+
| `src/schema.rs` | Schema representation and introspection handling
67+
| `src/ast.rs` | Abstract syntax tree types (language-agnostic)
68+
| `src/type_checker.rs` | Type checking orchestration (Idris2 ↔ Zig ↔ Rust)
69+
| `src/proof_generator.rs` | Generates .proof files (proof certificates)
70+
| `docs/architecture.adoc` | System architecture and design rationale
71+
| `docs/10-levels.adoc` | Detailed description of each type safety level
72+
| `README.adoc` | User guide and quick start
3873
|===
3974

4075
== Questions?

0 commit comments

Comments
 (0)