Mirrored from https://github.com/SNAPKITTYWEST/icp-dag-crystallizer at commit
27bf225. Part of the SnapKitty October 2026 main drop.
ICP-DAG Crystallizer β Integrity Constraint Protocol as Deterministic Logic
License: GPL-3.0-or-later OR Apache-2.0 (dual-licensed)
Formalizes the ICP-DAG v1.0 governance protocol across multiple logic languages and provides a multi-language relational lattice kernel for constraint-based reasoning, path refinement, and FSM verification.
Repository Map
icp-dag-crystallizer/
βββ src/
β βββ datalog/ # SoufflΓ© Datalog β primary ICP-DAG formalization
β βββ prolog/ # SWI-Prolog reference + miniKanren kernel
β β βββ kernels/ # compiler-00: 6 crystallization kernels
β βββ asp/ # Clingo ASP integrity constraints
β βββ mumps/ # MUMPS governance kernel
β βββ xslt/ # XSLT 3.0 submission normalizer
β βββ lattice-kernel/ # 8-language relational lattice kernel (NEW)
β βββ validators/ # Rust + Go governance protocol enforcement
βββ spec/ # Agent submissions + ICP-DAG analysis JSON
βββ tests/ # SoufflΓ© test cases + Prolog tests
βββ CLONE_GATE.md
βββ README.md
ICP-DAG Governance Protocol
10 Invariants (all FATAL)
| ID | Invariant |
|---|---|
| I1 | Every edge has existing endpoints |
| I2 | No self-edges |
| I3 | Unknown claims cannot authorize decisions |
| I4 | Contradicted claims cannot authorize decisions |
| I5 | Execution needs authorized decision with proven claim |
| I6 | Every proof references a claim |
| I7 | Every policy references a constraint |
| I8 | Constraint failure propagates to proofs |
| I9 | No simultaneous unknown + verified state |
| I10 | DAG must be acyclic (cycle = halt) |
DAG Dependency Chain
EVIDENCE ββsupportsβββ CLAIM ββproven-byβββ PROOF ββdecidesβββ DECISION ββexecutesβββ EXECUTION
β
POLICY ββenforcesβββ CONSTRAINT ββsatisfiesβββ
ICP-DAG Implementation Stack
src/
βββ datalog/
β βββ facts.dl # Base relations, type/state/edge declarations
β βββ rules.dl # Derivation rules (proven, authorized, reachable)
β βββ invariants.dl # 10 invariants as violation-emitting rules
β βββ kernels.dl # 6 kernel candidates (node_create β seal_dag)
β βββ sgmt_model.dl # SGMT semantic model
βββ asp/
β βββ icp_dag.lp # Clingo integrity constraints (unsat = invalid DAG)
βββ mumps/
β βββ ICP_DAG.m # Hierarchical globals, BFS reachability
βββ xslt/
β βββ sgmt_normalize.xsl # agent-submission β canonical sgmt:submission
βββ prolog/
βββ icp_dag.pl # Full ICP-DAG module (all invariants + kernels)
βββ formulog_minikanren_kernel.pl # miniKanren relational kernel (Prolog)
βββ kernels/ # compiler-00 crystallization pipeline
βββ reachability_closure.pl # K1: transitive closure, cycle-safe
βββ cycle_rejector.pl # K2: cycle detection + rejection nodes
βββ fail_closed_gate.pl # K3: 12-condition admission gate
βββ structural_digest.pl # K4: SHA-256 content addressing
βββ semantic_dedup.pl # K5: digest-based deduplication
βββ egg_packer.pl # K6: immutable EGG packaging
βββ pipeline.pl # Orchestrates K1βK6
6 Kernel Candidates
| Kernel | Domain | Purity |
|---|---|---|
| K1: reachability_closure | graph-reachability | Pure |
| K2: cycle_rejector | dag-validation | Pure |
| K3: fail_closed_gate | admission-control (12 conditions) | Pure |
| K4: structural_digest | content-addressing | Pure |
| K5: semantic_dedup | deduplication | Pure |
| K6: egg_packer | packaging | Side-effect |
SGMT Crystallization Pipeline (compiler-00)
XML submission β XSLT normalize β Prolog/Datalog resolve β constraint discharge
β proof obligations β structural digest β semantic dedup β EGG pack β SEALED
Lattice Kernel β 8-Language Relational Batch
src/lattice-kernel/ is a coherent multi-language implementation of a
relational lattice kernel covering: unification, list relations, Peano
arithmetic, full-adder, relational interpreter (evalo), SMT stub,
parameterized path/reachability, FSM relations, and interval refinement.
See src/lattice-kernel/README.md for full details.
| File | Language | Toolchain |
|---|---|---|
mu_kanren.scm |
Scheme ΞΌKanren | Chez / Guile / Racket |
lattice_kernel.pl |
ISO Prolog | SWI-Prolog / GNU Prolog |
path_refine.flg |
Formulog | HarvardPL Formulog |
path_refine.dl |
SoufflΓ© Datalog | SoufflΓ© |
lattice_kernel.pi |
Picat | Picat |
LatticeKernel.lean |
Lean 4 | lake / lean |
lattice_kernel.m |
Mercury | mmc |
LatticeKernel.v |
Coq | coqc / coqtop |
Formulog miniKanren Kernel
src/prolog/formulog_minikanren_kernel.pl β a dense miniKanren relational core
ported to pure SWI-Prolog, collapsing 40+ copy-pasted numbered functions from
the Python original into single parameterized predicates.
Covers: walk/unify, list relations (appendo/membero/rembero/β¦), Peano arithmetic, evalo relational interpreter, SMT stub, 50-relation parameterized EDB, 12 FSM instances, refinement lattice.
swipl src/prolog/formulog_minikanren_kernel.pl
?- kernel_demo.
Governance Validators
src/validators/ contains Rust and Go implementations of the ICP-DAG governance
protocol enforcement layer.
| File | Language | Role |
|---|---|---|
governance-validator.rs |
Rust | Compile-time invariant enforcement (714 LOC) |
governance-validator.go |
Go | Runtime governance protocol enforcement (726 LOC) |
Run
# SoufflΓ© Datalog
souffle tests/valid_dag.dl
souffle tests/invalid_cycle.dl
souffle tests/invalid_self_edge.dl
souffle tests/invalid_unknown_decides.dl
souffle tests/invalid_unauthorized_exec.dl
# SWI-Prolog
swipl tests/prolog_tests.pl
swipl src/prolog/formulog_minikanren_kernel.pl -g "kernel_demo, halt."
# Clingo ASP
clingo src/asp/icp_dag.lp tests/valid_dag_facts.lp
# Lattice kernel
chez --script src/lattice-kernel/mu_kanren.scm
swipl src/lattice-kernel/lattice_kernel.pl -g "demo, halt."
souffle src/lattice-kernel/path_refine.dl -D.
picat src/lattice-kernel/lattice_kernel.pi
lean src/lattice-kernel/LatticeKernel.lean
mmc --make src/lattice-kernel/lattice_kernel
coqc src/lattice-kernel/LatticeKernel.v
Agent Submissions
spec/submissions/:
icp-dag-gen1.xmlβ ICP-DAG crystallizer (Datalog, 10 invariants)compiler-00-gen1.xmlβ compiler-00 (SWI-Prolog, 6 kernels, 12-condition gate)
πΌ Commercial License
This repository is published under GPL-3.0-or-later or Apache-2.0. Building a commercial product or service? A proprietary commercial license from Snapkitty Collective LLC lets you ship this code on terms other than GPL-3.0-or-later or Apache-2.0.