Skip to content

Commit dd5782f

Browse files
hyperpolymathclaude
andcommitted
feat: kategoria bridge — conformance suite, real proof gate, ABI proofs completed
Receives the kategoria feed (kategoria PR #44's companion change): - fix(build): propagate the typell_vql -> typell_vcl crate rename to crates/typell-vcl/tests/vcl_bridge_tests.rs and crates/typell-server/src/handlers.rs. The whole workspace had failed to compile since >=2026-07-06 (Rust CI red on main); now 422 tests pass. - feat(conformance): crates/typell-core/tests/kategoria_conformance.rs — kategoria's 10 feature-levels as executable accept/reject tests against typell-core (25 pass; 3 honest #[ignore] gap markers for type classes / GADTs / cubical that panic if force-run). - fix(proofs): the Idris 2 ABI modules had NEVER been run through idris2 — 5 of 6 failed --check. Completed for real: * Soundness.idr: define-before-use for Step; canonical forms take the term relevantly (QTT erasure); subst was substituting the WRONG de Bruijn variable under binders — replaced with parallel substitution; renaming + substitution lemmas fully proven (were two named holes); progress/preservation/typeSafety all check. * LevelMonotonicity.idr: Fin 11/Fin 10 off-by-one in SafeUp (the monotonicity model itself); circular SafeL1 base; vanished stdlib lemma names; and the silent ?featureMonoGeneral hole — the central feature-subsumption theorem was only proven for L1. featuresAtLevel is now cumulative (featN) and featNMono proves ALL level pairs. * Types.idr: fake %runElab 'platform detection' replaced by an honest constant; missing import; exhaustive DecEq; So-guarded handles via choose; Type-matching size functions and vacuous HasSize/ HasAlignment replaced by a closed CTy universe with definitional layout lemmas. * InferenceSoundness.idr: eqRefl/neqEqFalse lemmas; applySubst made total (single-pass, idempotent-substitution model); statement quantification fixed. * Layout.idr QUARANTINED (3 named holes, Refl-unprovable claims, fake verifiers; nothing imports it) — reported loudly by the gate, not hidden. - feat(gate): scripts/check-idris2-proofs.sh (hard-fails without the prover; rejects postulate/believe_me/assert_total/%hint/holes) + .github/workflows/proof-gate.yml + real Justfile build/test recipes (cargo + proof gate; were TODO echo stubs). - docs: PROOF-STATUS.adoc (measured, with history), docs/KATEGORIA-BRIDGE.adoc (the two-hierarchy reconciliation), ROADMAP corrected (kategoria does NOT use typell's L1-L10 progression), STATE.a2ml refreshed with measured verification state. Verified: just test green end-to-end (proof gate 5/5 + Layout quarantine report + axiom/hole scan, then cargo test --workspace: 447 tests incl. conformance, 0 failures). Gate negative-tested (exits 1 without idris2); proofs verified under Idris 2 0.7.0 AND 0.8.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c7408a7 commit dd5782f

14 files changed

Lines changed: 1102 additions & 256 deletions

File tree

‎.github/workflows/proof-gate.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Proof Gate — type-checks the Idris 2 ABI proof modules on every push
3+
# and PR. Pattern imported from kategoria.
4+
#
5+
# Until 2026-07-21 these modules had NEVER been run through idris2:
6+
# 5 of 6 failed --check (and one carried a silent hole). The gate
7+
# hard-fails when the prover is missing (scripts/check-idris2-proofs.sh
8+
# refuses to skip) and rejects postulate/believe_me/%hint/holes in the
9+
# pass-required set. Layout.idr is quarantined — see PROOF-STATUS.adoc.
10+
#
11+
# Verified locally under Idris 2 0.7.0 (system) and 0.8.0 (nixpkgs):
12+
# 5/5 required modules PASS.
13+
name: Proof Gate
14+
15+
on:
16+
push:
17+
branches: [main]
18+
pull_request:
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
idris2-proofs:
25+
name: idris2 --check (ABI proof modules)
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 30
28+
steps:
29+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30+
31+
- uses: cachix/install-nix-action@a49548c11d9846ad46ecc0115273879b045f001c # v31.10.7
32+
33+
- name: Run proof gate
34+
run: nix shell nixpkgs#idris2 -c ./scripts/check-idris2-proofs.sh

‎.machine_readable/6a2/STATE.a2ml‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[metadata]
77
project = "typell"
88
version = "0.1.0-alpha"
9-
last-updated = "2026-03-14"
9+
last-updated = "2026-07-27"
1010
status = "active"
1111

1212
[project-context]
@@ -23,13 +23,24 @@ maturity = "early-alpha"
2323
crates = 14
2424
kernel-modules = 11
2525
bridge-crates = 13
26-
total-tests = 221
27-
kernel-tests = 87
26+
total-tests = 447 # 422 workspace + 25 kategoria conformance (2026-07-27, cargo test --workspace)
27+
kernel-tests = 225
2828
bridge-tests = 134
29-
idris2-abi-files = 3
29+
idris2-abi-files = 6
3030
zig-ffi-files = 1
3131
languages = ["Rust", "Idris2", "Zig"]
3232

33+
[verification]
34+
# Enforced by scripts/check-idris2-proofs.sh (Proof Gate workflow) —
35+
# hard-fails when idris2 is absent; rejects postulate/believe_me/%hint/holes.
36+
# History: before 2026-07-21 the ABI proof modules had NEVER been checked
37+
# (5/6 failed; one silent hole). See PROOF-STATUS.adoc.
38+
idris2-proof-modules-passing = 5
39+
idris2-proof-modules-quarantined = ["Layout.idr"]
40+
provers-verified = ["Idris 2 0.7.0", "Idris 2 0.8.0 (nixpkgs)"]
41+
kategoria-conformance = "crates/typell-core/tests/kategoria_conformance.rs: 25 pass, 3 honest-ignore (type classes, GADTs, cubical absent)"
42+
last-verified = "2026-07-27"
43+
3344
[kernel-modules]
3445
modules = [
3546
{ name = "types.rs", lines = 920, purpose = "Unified type representation (HM + dependent + linear + effects + sessions + dimensional + refinement)" },

‎Justfile‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,7 @@ init:
263263

264264
# Build the project (debug mode)
265265
build *args:
266-
@echo "Building typell (debug)..."
267-
# TODO: Replace with your build command
268-
# Examples:
269-
# cargo build {{args}} # Rust
270-
# mix compile {{args}} # Elixir
271-
# zig build {{args}} # Zig
272-
# deno task build {{args}} # Deno/ReScript
273-
@echo "Build complete"
266+
cargo build --workspace --locked {{args}}
274267

275268
# Build in release mode with optimizations
276269
build-release *args:
@@ -305,16 +298,16 @@ clean-all: clean
305298
# TEST & QUALITY
306299
# ═══════════════════════════════════════════════════════════════════════════════
307300

308-
# Run all tests
309-
test *args:
310-
@echo "Running tests..."
311-
# TODO: Replace with your test command
312-
# Examples:
313-
# cargo test {{args}}
314-
# mix test {{args}}
315-
# zig build test {{args}}
316-
# deno test {{args}}
317-
@echo "Tests passed!"
301+
# Run all tests: the Rust workspace (incl. the kategoria conformance
302+
# suite) and the Idris 2 ABI proof gate.
303+
test *args: proof-check
304+
cargo test --workspace --locked {{args}}
305+
306+
# Type-check the Idris 2 ABI proof modules (5 required + Layout
307+
# quarantined). Hard-fails when idris2 is absent — a gate that skips is
308+
# not a gate. See PROOF-STATUS.adoc.
309+
proof-check:
310+
./scripts/check-idris2-proofs.sh
318311

319312
# Run tests with verbose output
320313
test-verbose:

‎PROOF-STATUS.adoc‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// SPDX-License-Identifier: CC-BY-SA-4.0
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
= Proof Status — typell Idris 2 ABI modules
4+
:toc:
5+
6+
*Measured 2026-07-27 under Idris 2 0.7.0 (system) and 0.8.0 (nixpkgs).
7+
Format and discipline imported from kategoria's PROOF-STATUS.adoc: this
8+
file records what `idris2 --check` actually says, not what comments
9+
claim.*
10+
11+
== Verified modules (5 / 5 required PASS)
12+
13+
[cols="2,1,4",options="header"]
14+
|===
15+
| Module (src/abi/) | Status | What it proves
16+
17+
| Soundness.idr | PASS
18+
| Progress + preservation + type safety for the STLC core modelling
19+
check.rs/infer.rs/unify.rs. Renaming and PARALLEL-substitution lemmas
20+
fully proven — no holes.
21+
22+
| InferenceSoundness.idr | PASS
23+
| Occurs-check/substitution lemmas, unifier soundness statements,
24+
substitution idempotence for the inference model of unify.rs.
25+
26+
| LevelMonotonicity.idr | PASS
27+
| The safety-level hierarchy (initial set L1–L10) is monotone:
28+
`featNMono`/`featureMonotonicity` — higher levels' feature sets
29+
subsume lower levels' — now proven for ALL level pairs.
30+
31+
| Types.idr | PASS
32+
| ABI type definitions; decidable equality for Result; So-guarded
33+
non-null handles; computable C-type sizes over a closed universe with
34+
definitional layout lemmas.
35+
36+
| Foreign.idr | PASS
37+
| FFI surface declarations matching ffi/zig.
38+
|===
39+
40+
Gate: `just proof-check` → `scripts/check-idris2-proofs.sh` (also run in
41+
CI by `.github/workflows/proof-gate.yml`). The gate HARD-FAILS when
42+
idris2 is absent and rejects `postulate` / `believe_me` / `assert_total`
43+
/ `%hint` / holes (`?name`) outside comments in the required modules.
44+
45+
== Quarantined (1)
46+
47+
`Layout.idr` — RSR-template scaffolding, excluded from the pass-required
48+
set and reported by the gate on every run. Why: three named holes
49+
(`?fieldsAlignedProof`, `?exampleFieldsAligned`, `?offsetInBoundsProof`),
50+
a divisibility "proof" attempted via `Refl` on abstract arithmetic
51+
(unprovable as stated), `verifyAllPlatforms` returning `Right ()` while
52+
checking nothing, and `Nat` subtraction/`Divides` machinery that does not
53+
compile. No module imports it. Disposition (owner): rewrite honestly
54+
against real mod/div lemmas, or delete.
55+
56+
== History — read this before trusting old claims
57+
58+
Until 2026-07-21 these modules had NEVER been run through idris2:
59+
60+
- 5 of 6 failed `--check` outright. `Soundness.idr` referenced `Step`
61+
before its definition, returned erased implicits relevantly in its
62+
canonical-forms lemmas, hid two NAMED HOLES in the substitution lemma
63+
behind a comment insisting they were "not believe_me or postulate" —
64+
and its `subst` function was semantically WRONG under binders
65+
(substituted the lambda's own bound variable; the de Bruijn bug is why
66+
the original proof could not be completed). `LevelMonotonicity.idr`
67+
had a `Fin 11`-vs-`Fin 10` off-by-one in the `SafeUp` constructor of
68+
the monotonicity model itself, a circular (uninhabitable) `SafeL1`
69+
base case, and stdlib lemma names that no longer exist.
70+
- The one thing `--check` DID accept silently was a hole:
71+
`?featureMonoGeneral` — the central feature-subsumption theorem was
72+
only proven for L1. Holes pass `idris2 --check`; that is exactly why
73+
the gate scans for them.
74+
- `applySubst` in InferenceSoundness.idr recursed through the
75+
substitution's range and was non-terminating on cyclic substitutions;
76+
it is now single-pass, modelling idempotent (MGU-form) substitutions,
77+
with the invariant documented.
78+
79+
== Reproduce
80+
81+
[source,sh]
82+
----
83+
just proof-check
84+
# or directly:
85+
./scripts/check-idris2-proofs.sh
86+
# or with the same prover CI uses:
87+
nix shell nixpkgs#idris2 -c ./scripts/check-idris2-proofs.sh
88+
----

‎ROADMAP.adoc‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
== Overview
88

9-
TypeLL is the unified type system verification kernel for the hyperpolymath ecosystem. It is to PanLL what LLVM is to Clang: the formal verification substrate that multiple language frontends compile _types_ into. TypeLL is an *open-ended progressive* type safety framework: it works through increasingly strong type properties with no fixed upper bound. New levels are added as the theory demands. The initial progression (L1-L10) is defined below and used by VCL-total, 007, Kategoria, PanLL, and the nextgen-languages suite; this is a starting point, not a ceiling.
9+
TypeLL is the unified type system verification kernel for the hyperpolymath ecosystem. It is to PanLL what LLVM is to Clang: the formal verification substrate that multiple language frontends compile _types_ into. TypeLL is an *open-ended progressive* type safety framework: it works through increasingly strong type properties with no fixed upper bound. New levels are added as the theory demands. The initial progression (L1-L10) is defined below and used by VCL-total, 007, PanLL, and the nextgen-languages suite; this is a starting point, not a ceiling. (Correction 2026-07-27: Kategoria does NOT use this progression — its L1-L10 are language-FEATURE levels, a different hierarchy that happens to share the numbering. The mapping between the two is enablement, not identity: see docs/KATEGORIA-BRIDGE.adoc.)
1010

1111
== Current State (2026-03-29)
1212

@@ -115,7 +115,11 @@ new levels are added as the type theory demands. L1-L10 is a starting point, no
115115
* **007** — Agent meta-language type system (tropical types, Five Facets);
116116
Isabelle foundation complete in `tropical-resource-typing` (2026-04-11):
117117
star equation, Floyd-Warshall, least prefixpoint, CNO — all proved, zero sorry.
118-
* **Kategoria** — Category theory verification; Route alpha achieved L9 (session types via Brady indexed monad);
118+
* **Kategoria** — The Type Safety Challenge (its OWN feature-level L1-L10
119+
hierarchy; route α has 9/10 verified in Idris 2, L10 cubical documented
120+
as its wall). Bridged 2026-07-21: kategoria's levels run here as
121+
`crates/typell-core/tests/kategoria_conformance.rs` and its proof
122+
discipline became this repo's Proof Gate — see docs/KATEGORIA-BRIDGE.adoc;
119123
`research/tropical/` research prototype added referencing `tropical-resource-typing` proofs.
120124
* **PanLL** — Cross-panel type intelligence (TypeLLService + TypeLLEngine in src/core/)
121125
* **typed-wasm** — TypeLL progressive type safety applied to WASM memory (current application: L1-L10), multi-module convergence infrastructure for AffineScript + Ephapax

0 commit comments

Comments
 (0)