Skip to content

Commit 7b73e81

Browse files
hyperpolymathclaude
andcommitted
refactor(quandledb): rename KQL → KRL (Knot Resolution Language) throughout
- All spec files: KQL → KRL, "Knot Query Language" → "Knot Resolution Language" - Idris2 ABI: KqlTy → KrlTy (22 occurrences), module comment updated - WHITEPAPER: title, abstract, code fences (```kql → ```krl) - ROADMAP v0.2.0 section title updated - CHANGELOG, references.bib, 0-AI-MANIFEST.a2ml updated - File renames: kql-safety-model.adoc → krl-safety-model.adoc, KQL-SQL-LANDSCAPE-RESEARCH → KRL-SQL-LANDSCAPE-RESEARCH - Landscape research: preserves "KQL (Kusto / Azure)" as Microsoft's name, collision note updated to reflect KRL resolves the clash Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 413aa0b commit 7b73e81

14 files changed

Lines changed: 160 additions & 160 deletions

quandledb/0-AI-MANIFEST.a2ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ quandledb/
7979

8080
- **Skein.jl** is the database engine (Julia library)
8181
- **QuandleDB** is the application layer (HTTP API + web UI)
82-
- **KQL** (planned) will be the query language
82+
- **KRL** (planned) will be the resolution language
8383

8484
## SESSION STARTUP CHECKLIST
8585

quandledb/CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
2020

2121
### Changed
2222
- Absorbed into `nextgen-databases/` monorepo (removed nested .git dir)
23-
- KQL → renamed reference to align with KRL stack naming
23+
- KRL → renamed reference to align with KRL stack naming
2424

2525
## [Absorbed into monorepo] 2026-04-05
2626

@@ -40,5 +40,5 @@ History preserved in the absorption commit message.
4040
### Prior history (pre-absorption)
4141
- fix: replace Obj.magic with typed Fetch API bindings in Api.res
4242
- chore: batch RSR compliance
43-
- docs: KQL safety model — two-tier architecture with TypeLL levels
44-
- feat: KQL query language design — SQL compat + dependent type variants
43+
- docs: KRL safety model — two-tier architecture with TypeLL levels
44+
- feat: KRL query language design — SQL compat + dependent type variants

quandledb/ROADMAP.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
* [x] Semantic descriptor sidecar index (`quandle_semantic_index`)
1818
* [x] Semantic equivalence candidate endpoint (`/api/semantic-equivalents/:name`)
1919

20-
== v0.2.0 - Query Language (KQL)
20+
== v0.2.0 - Resolution Language (KRL)
2121

22-
* [ ] KQL (Knot Query Language) parser
22+
* [ ] KRL (Knot Resolution Language) parser
2323
* [ ] Query DSL for topological predicates
2424
* [ ] Query editor in frontend with syntax highlighting
2525
* [ ] Composable predicates via text interface

quandledb/WHITEPAPER.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33

4-
# KQL: A Knot-Theoretic Query Language for Topological Data
4+
# KRL: A Knot-Theoretic Query Language for Topological Data
55

66
**Author:** Jonathan D.A. Jewell
77
**Version:** 1.0
@@ -12,13 +12,13 @@
1212

1313
## Abstract
1414

15-
We present KQL (Knot Query Language), a domain-specific query language for
15+
We present KRL (Knot Resolution Language), a domain-specific query language for
1616
QuandleDB that treats mathematical equivalence as a first-class query primitive.
1717
Traditional database query languages (SQL, GraphQL, Cypher) model equality as a
1818
binary predicate: two values are either equal or not. This model is fundamentally
1919
inadequate for topological data, where two objects (e.g., knot diagrams) may be
2020
equivalent via multiple distinct paths (Reidemeister moves), and the space of
21-
equivalences itself has mathematical structure. KQL addresses this by grounding
21+
equivalences itself has mathematical structure. KRL addresses this by grounding
2222
its semantics in Homotopy Type Theory (HoTT), where equality is not a boolean
2323
but a *type*—the type of paths between two objects. The result is a query language
2424
where equivalence queries return not just matching objects but the *derivations*
@@ -73,7 +73,7 @@ SQL's relational model fails for knot data in several fundamental ways:
7373

7474
This paper presents:
7575

76-
1. **KQL's semantic model** grounded in HoTT identity types, where equivalence
76+
1. **KRL's semantic model** grounded in HoTT identity types, where equivalence
7777
queries return types, not booleans (Section 3).
7878
2. **E-graph-backed execution** using equality saturation (egglog) to compactly
7979
represent equivalence classes (Section 4).
@@ -137,14 +137,14 @@ structure.
137137

138138
---
139139

140-
## 3. KQL Semantic Model
140+
## 3. KRL Semantic Model
141141

142142
### 3.1 Equivalence as a Type
143143

144-
KQL's fundamental departure from SQL is that equivalence queries return *types*,
144+
KRL's fundamental departure from SQL is that equivalence queries return *types*,
145145
not booleans:
146146

147-
```kql
147+
```krl
148148
from knots
149149
| where equivalent_to("3_1")
150150
| return equivalences
@@ -164,9 +164,9 @@ matching knot K, the *equivalence evidence*:
164164
}
165165
```
166166

167-
### 3.2 Identity Types in KQL
167+
### 3.2 Identity Types in KRL
168168

169-
KQL models three levels of identity:
169+
KRL models three levels of identity:
170170

171171
1. **Definitional equality** (`==`): Identical representations (same Gauss code).
172172
Decidable, trivial.
@@ -177,15 +177,15 @@ KQL models three levels of identity:
177177
3. **Path equality** (`~`): Equivalent via explicit isotopy (sequence of
178178
Reidemeister moves). Returns the path itself.
179179

180-
```kql
180+
```krl
181181
from knots
182182
| where K ≅ "3_1" via [jones, genus, crossing_number]
183183
| return K, proof
184184
```
185185

186186
### 3.3 Quotient Types
187187

188-
KQL represents equivalence classes as quotient types:
188+
KRL represents equivalence classes as quotient types:
189189

190190
```
191191
Knot / ≅ = { [K] | K ∈ Knot }
@@ -201,12 +201,12 @@ data.
201201

202202
### 4.1 Equality Saturation
203203

204-
KQL queries are executed against an *e-graph* (equivalence graph), a data
204+
KRL queries are executed against an *e-graph* (equivalence graph), a data
205205
structure that compactly represents equivalence classes. Following the egglog
206-
paradigm (Willsey et al., PLDI 2023), KQL combines Datalog-style recursive
206+
paradigm (Willsey et al., PLDI 2023), KRL combines Datalog-style recursive
207207
queries with equality saturation:
208208

209-
```kql
209+
```krl
210210
# Define equivalence rules
211211
rule jones_equivalent(K1, K2) :-
212212
knot(K1), knot(K2),
@@ -226,7 +226,7 @@ from knots
226226

227227
### 4.2 Stratified Invariant Evaluation
228228

229-
Not all invariants are equally expensive to compute. KQL's query planner
229+
Not all invariants are equally expensive to compute. KRL's query planner
230230
evaluates invariants in order of increasing cost:
231231

232232
| Stratum | Invariants | Cost |
@@ -248,7 +248,7 @@ evidence for equivalence.
248248

249249
### 5.1 Semiring Annotations
250250

251-
Following the provenance semiring framework (Green et al., 2007), KQL annotates
251+
Following the provenance semiring framework (Green et al., 2007), KRL annotates
252252
every result with provenance information recording how the result was derived:
253253

254254
```
@@ -277,15 +277,15 @@ Provenance = Semiring(
277277

278278
### 6.1 Schema as Category
279279

280-
Following Spivak (2014), KQL models the database schema as a category C:
280+
Following Spivak (2014), KRL models the database schema as a category C:
281281

282282
- **Objects:** Entity types (Knot, Invariant, Isotopy, Diagram).
283283
- **Morphisms:** Relationships (has_invariant, has_diagram, isotopy_between).
284284
- **Functors:** Data instances (I : C → Set) mapping schema to data.
285285

286286
### 6.2 Queries as Functors
287287

288-
A KQL query is a functor Q : C → C' between schema categories. This provides:
288+
A KRL query is a functor Q : C → C' between schema categories. This provides:
289289

290290
- **Compositionality:** Queries compose as functors compose.
291291
- **Type safety:** Functors preserve categorical structure, preventing ill-typed
@@ -298,9 +298,9 @@ A KQL query is a functor Q : C → C' between schema categories. This provides:
298298

299299
### 7.1 Pipeline Syntax
300300

301-
KQL adopts PRQL's pipeline approach for readability:
301+
KRL adopts PRQL's pipeline approach for readability:
302302

303-
```kql
303+
```krl
304304
from knots
305305
| filter crossing_number <= 10
306306
| filter genus == 1
@@ -311,7 +311,7 @@ from knots
311311

312312
### 7.2 Equivalence Queries
313313

314-
```kql
314+
```krl
315315
from knots
316316
| find_equivalent "3_1" via [jones, genus]
317317
| return equivalences with provenance
@@ -322,7 +322,7 @@ from knots
322322
For navigating relationships between knots (e.g., knots related by specific
323323
operations like connected sum):
324324

325-
```kql
325+
```krl
326326
from knots as K1
327327
| match (K1)-[:CONNECTED_SUM]->(K2)
328328
| where K2.crossing_number < K1.crossing_number
@@ -331,7 +331,7 @@ from knots as K1
331331

332332
### 7.4 Reidemeister Move Queries
333333

334-
```kql
334+
```krl
335335
from diagrams as D1
336336
| find_path D1 ~> "3_1" via reidemeister
337337
| return path, move_count
@@ -346,7 +346,7 @@ from diagrams as D1
346346
| Layer | Language | Purpose |
347347
|-------|----------|---------|
348348
| Engine | Julia (Skein.jl) | Knot storage, invariant computation |
349-
| Query Parser | Julia | KQL parsing and AST construction |
349+
| Query Parser | Julia | KRL parsing and AST construction |
350350
| E-graph Engine | Julia | Equality saturation, equivalence classes |
351351
| API | Julia (HTTP.jl) | REST API for queries |
352352
| Frontend | ReScript + React | Interactive query interface |
@@ -379,39 +379,39 @@ end
379379
structured equivalences.
380380
- **Cypher** (Robinson et al., 2015): Graph pattern matching. Useful for
381381
navigating knot relationships but no equivalence semantics.
382-
- **PRQL** (PRQL Project, 2022): Pipeline syntax for SQL. KQL adopts its
382+
- **PRQL** (PRQL Project, 2022): Pipeline syntax for SQL. KRL adopts its
383383
ergonomics but not its relational semantics.
384384
- **HoTTSQL** (Chu et al., PLDI 2017): SQL semantics via HoTT. Proves
385-
equivalence of SQL queries, not of data. KQL adapts HoTT for data equivalence.
385+
equivalence of SQL queries, not of data. KRL adapts HoTT for data equivalence.
386386
- **egglog** (Willsey et al., PLDI 2023): Equality saturation + Datalog.
387-
KQL's execution engine.
388-
- **CQL** (Spivak, 2014): Categorical Query Language. KQL's schema model.
387+
KRL's execution engine.
388+
- **CQL** (Spivak, 2014): Categorical Query Language. KRL's schema model.
389389

390390
### 9.2 Knot Theory Software
391391

392392
- **SnapPy** (Culler et al.): 3-manifold topology. Computations, not queries.
393-
- **KnotInfo** (Livingston & Moore): Web database. SQL backend, no KQL.
393+
- **KnotInfo** (Livingston & Moore): Web database. SQL backend, no KRL.
394394
- **Knot Atlas**: Wiki-based. No structured query language.
395-
- **Skein.jl** (hyperpolymath): Julia knot engine. KQL's computation backend.
395+
- **Skein.jl** (hyperpolymath): Julia knot engine. KRL's computation backend.
396396

397397
### 9.3 Type Theory and Equality
398398

399-
- **HoTT** (Univalent Foundations, 2013): Identity types as paths. KQL's
399+
- **HoTT** (Univalent Foundations, 2013): Identity types as paths. KRL's
400400
semantic foundation.
401401
- **Cubical Agda** (Vezzosi et al., 2019): Computational HoTT. Potential
402402
future implementation target.
403-
- **Lean 4 mathlib** (mathlib Community): Formal quandle definitions. KQL's
403+
- **Lean 4 mathlib** (mathlib Community): Formal quandle definitions. KRL's
404404
proof library.
405405

406406
---
407407

408408
## 10. Conclusion
409409

410-
KQL demonstrates that domain-specific query languages can and should respect
410+
KRL demonstrates that domain-specific query languages can and should respect
411411
the mathematical structure of their data. For topological data, binary equality
412412
is the wrong abstraction. By grounding query semantics in HoTT identity types,
413413
executing queries via equality saturation, and carrying provenance through
414-
results, KQL provides a query language that is mathematically honest about
414+
results, KRL provides a query language that is mathematically honest about
415415
what it means for two knots to be "the same."
416416

417417
The broader lesson is that the choice of equality model is a fundamental design

quandledb/docs/design/KQL-SQL-LANDSCAPE-RESEARCH-2026-02-22.md renamed to quandledb/docs/design/KRL-SQL-LANDSCAPE-RESEARCH-2026-02-22.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# KQL Design: SQL Landscape Research — 2026-02-22
1+
# KRL Design: SQL Landscape Research — 2026-02-22
22
## Comprehensive Survey for QuandleDB Query Language Design
33

44
**Date:** 2026-02-22
@@ -17,7 +17,7 @@
1717
3. **HoTT identity types** — paths = equivalences (from HoTTSQL paper)
1818
4. **Surfaced through:** PRQL-style pipeline syntax + Cypher-style graph pattern matching
1919

20-
The closest existing system is **egglog** (PLDI 2023). The theoretical foundation is **HoTTSQL's univalent semantics**. KQL should build on both.
20+
The closest existing system is **egglog** (PLDI 2023). The theoretical foundation is **HoTTSQL's univalent semantics**. KRL should build on both.
2121

2222
---
2323

@@ -112,10 +112,10 @@ The closest existing system is **egglog** (PLDI 2023). The theoretical foundatio
112112
- **Good:** Multi-model with SQL-like syntax
113113
- **Bad:** Lack of type safety, SDK limitations, limited maturity
114114

115-
### KQL (Kusto / Azure) — NAME COLLISION
115+
### KQL (Kusto / Azure) — NAME COLLISION [Resolved]
116116
- **Good:** Pipeline syntax for log analytics
117117
- **Bad:** Read-only, can't INSERT/UPDATE, Azure lock-in
118-
- **Note:** Shares our acronym. Context disambiguates, but consider alternate naming.
118+
- **Note:** Previously shared acronym with our language. Resolved by renaming our language to KRL (Knot Resolution Language).
119119

120120
### DuckDB SQL Extensions
121121
- **Right:** Community extensions (6M downloads/week), SQL-only extensions, SQL/PGQ graph queries outperform Neo4j 10-100x
@@ -151,7 +151,7 @@ SQL departs from Codd's relational model: bags not sets, NULLs, ordering, duplic
151151
- SQL semantics formalized via homotopy type theory
152152
- Relations as functions from tuples to univalent types
153153
- Bag equality proved via univalence axiom (700+ lines Coq → 40 lines)
154-
- **Critical insight for KQL:** Equality is not binary. Multiple distinct paths (proofs of equality) between objects. The space of equivalences has structure. THIS IS EXACTLY KNOT EQUIVALENCE.
154+
- **Critical insight for KRL:** Equality is not binary. Multiple distinct paths (proofs of equality) between objects. The space of equivalences has structure. THIS IS EXACTLY KNOT EQUIVALENCE.
155155

156156
### egglog (PLDI 2023)
157157
- Merges Datalog with equality saturation
@@ -203,7 +203,7 @@ QuandleDB stores mathematical structures where the fundamental operation is *equ
203203

204204
---
205205

206-
## Part 6: What KQL Should Borrow vs Avoid
206+
## Part 6: What KRL Should Borrow vs Avoid
207207

208208
### Borrow
209209
| Source | What |
@@ -230,7 +230,7 @@ QuandleDB stores mathematical structures where the fundamental operation is *equ
230230

231231
---
232232

233-
## Part 7: Proposed KQL Architecture
233+
## Part 7: Proposed KRL Architecture
234234

235235
1. **Foundation:** Category-theoretic data model (Spivak). Schema = category, instance = functor.
236236
2. **Equality model:** HoTT identity types. `x == y` returns a *type* (possibly empty, possibly inhabited, possibly multiply inhabited). "These knots are equivalent, and here are the equivalences."

0 commit comments

Comments
 (0)