Semantic fingerprint layer of the KRL stack — extracts quandle presentations from knot diagrams, computes canonical hashes, and indexes them for equivalence search, built as a polyglot stack (Julia + Idris2 + Zig + V + Elixir).
This project does the following:
-
Julia HTTP server wrapping Skein.jl + KnotTheory.jl for knot storage/query
-
QuandleSemanticJulia module extracting quandle presentations fromPlanarDiagramand producing canonical fingerprints -
Maintains a separate SQLite sidecar index (
quandle_semantic_index) specifically for semantic queries, keeping raw-diagram storage in Skein -
Idris2 ABI type layer for the semantic API
-
Zig FFI layer for the semantic API (C-compatible)
-
zig API wrappers
-
Elixir BEAM NIF bindings
This project does NOT do the following:
-
Compute invariants (Jones, Alexander, etc. — that’s KnotTheory.jl’s job)
-
Store raw diagrams (that’s Skein.jl’s job)
-
Parse KRL or any knot-specific resolution language
-
Implement Reidemeister moves
Quandle presentations are a complete invariant for many knot families under isotopy: two knots with different fundamental quandles are provably distinct. Unlike polynomial invariants (Jones, Alexander) which can fail to discriminate, quandle-based fingerprints provide semantic identity — equivalence search rather than just property lookup.
Structurally: Skein stores raw diagrams; KnotTheory computes polynomial invariants; QuandleDB computes algebraic fingerprints derived from the fundamental quandle. Each layer enforces its own boundary.
| Layer | Language | Purpose |
|---|---|---|
ABI |
Idris2 |
Dependently-typed interface definitions + layout proofs |
FFI |
Zig |
C-compatible implementation of semantic API |
API |
V |
Typed API triples |
Service |
Julia |
|
Compute |
Julia |
|
Client |
Elixir/BEAM |
NIFs for BEAM-ecosystem consumers |
This matches the hyperpolymath estate standard (Idris2 ABI + Zig FFI
V API triples + Julia/Elixir service layer).
-
Raw diagrams live in Skein. QuandleDB’s sidecar SQLite is for semantic fingerprints only. Do not duplicate Skein’s
knotstable here. -
Quandle computation is deterministic. Identical input diagrams must produce identical fingerprints, regardless of platform or run.
-
ABI layer never leaks Julia types. Idris2/Zig/V see only C-compatible structures.
-
Never modify KnotTheory.jl or Skein.jl. They’re community libraries consumed by this project, not targets for modification.
| Concern | Where it belongs |
|---|---|
Crossings, PD codes, Reidemeister moves |
KnotTheory.jl |
Raw diagram storage + invariant cache (Jones, Alexander, determinant) |
Skein.jl |
Quandle presentation extraction from PlanarDiagram |
|
Canonical quandle fingerprint hashing |
|
Coloring counts into finite quandles |
|
TangleIR definition + adapters |
|
KRL resolution language |
|
-
21 tests passing (9 quandle extraction + 12 semantic index integration)
-
panic-attack assail0 findings -
Idris2 ABI types defined
-
BEAM NIFs build and load
-
CRG grade D — tests present but thin coverage, no per-layer READMEs
-
No full-stack integration test spanning Idris2 → Zig → V → Julia → BEAM
-
No benchmark suite
-
No fuzz harness
-
TEST-NEEDS.mdandPROOF-NEEDS.mdjust added as scaffolding; content is thin -
Colouring count implementation not yet wired
-
No OpenAPI / contract spec for HTTP endpoints
See READINESS.md for the path from D to C.
-
README.adoc — public overview
-
READINESS.md — CRG grade D assessment + path to C
-
../../Skein.jl/— knot persistence layer -
../../KnotTheory.jl/— combinatorial engine -
../../KRLAdapter.jl/— TangleIR adapter package -
../../krl/— KRL surface language (scaffolded)