Inductive.lean (new module): schema combinators (mkSchema, mkCtor,
mkPath) and canonical schema instances:
- Plain inductives: natSchema, boolSchema, listSchema
- HITs: s1Schema, intervalSchema, propTruncSchema
Plus type-level helpers (CType.natC, listC, s1C, …) and term-level
ergonomic builders (zeroC, succC, nilC, consC, baseC, loopC, …,
natLit, natElim, boolElim, listElim).
Rust kernel (native/cubical/src/):
· tags.rs — TY_IND, TERM_DIMEXPR/CTOR/INDELIM, VAL_VCTOR/VDIMEXPR,
NEU_NINDELIM tag constants per docs/INDUCTIVE_TYPES.md §6.
· value.rs — mk_vctor, mk_vdimexpr, mk_nindelim builders.
· eval.rs — TERM_DIMEXPR / TERM_CTOR / TERM_INDELIM dispatch
arms; full β-reduction on canonical vctor target
(find matching branch by name, vapp chain over
ctor args); stuck nIndElim build for vneu target;
eval_term_list / eval_branches / find_branch_body
helpers (recursive list walking).
· readback.rs — VAL_VCTOR / VAL_VDIMEXPR readback arms;
readback_val_list, map_readback_branches helpers;
NEU_NINDELIM neutral readback; mk_term_dimexpr,
mk_term_ctor, mk_term_indelim builders.
Tests (CubicalTransport/FFITest.lean): nine new smoke arms exercising
canonical-form eval (zero, succ-of-succ, false, cons-true-nil, base,
loop@r), readback round-trip on succ zero, and indElim β on Bool with
both branch directions. Result: 25/25 smoke + 46/46 properties =
71/71 passing.
Existing tests untouched (constructor tags preserved per REL1 freeze).
Rust ABI version is now de facto v2 (new tags); update the
TOPOLEI_FFI_ABI_VERSION constant in a follow-up commit.
Remaining REL1 work (per task list):
- #4 HasType arms for ctor / indElim
- #8 transport over .ind axioms
- #9 composition over .ind axioms
- Path-ctor boundary firing (REL1.1)
- Recursive-arg IH wiring in indElim β (REL1.1)
- Topolei migration (sibling repo) per docs/INDUCTIVE_TYPES.md §9.1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .forgejo/workflows | ||
| CubicalTransport | ||
| docs | ||
| native/cubical | ||
| .gitignore | ||
| build.sh | ||
| CubicalBench.lean | ||
| CubicalTest.lean | ||
| CubicalTransport.lean | ||
| lake-manifest.json | ||
| lakefile.toml | ||
| lean-toolchain | ||
| LICENSE | ||
| NOTICE | ||
| README.md | ||
cubical-transport-hott-lean4
A Lean 4 implementation of cubical-transport homotopy type theory (CCHM-flavor), with a fast Rust kernel exposed through C ABI.
The Lean side defines the syntax, semantics, and soundness theorems.
The Rust side discharges the per-step β-rules of the evaluator.
Lean axioms are routed through @[implemented_by] to Rust functions
that return Lean objects in the same shape Lean would have produced;
the soundness layer (CubicalTransport/Soundness.lean) certifies the
backend at the boundary, so the kernel speed of the Rust code
preserves the Lean-level proofs.
What's here
CubicalTransport/— 22 Lean modules for syntax, substitution, dimensional structure, faces, typing, evaluation (eval / value / readback), transport, Glue, composition, and the soundness theorems.native/cubical/— Rust kernel (#![no_std], dual-target native staticlib + cdylib, wasm32 cdylib).CubicalTest.lean,CubicalBench.lean— engine smoke + property tests (62/62 passing) and microbenchmarks.
Consuming the engine (with permission)
This Software is proprietary. See LICENSE — no use is granted
by virtue of the repository being public. The instructions below
are for the copyright holder and any party with prior written consent
from mgorog@gmail.com.
Add as a Lake dependency from another Lean 4 project:
[[require]]
name = "cubicalTransport"
path = "../cubical-transport-hott-lean4" # or git = "..."
Then import CubicalTransport.Syntax, import CubicalTransport.Eval,
etc. Link against native/cubical/target/release/libtopolei_cubical.a
in your own moreLinkArgs so the FFI symbols resolve.
Build
(cd native/cubical && cargo build --release)
lake build
./.lake/build/bin/cubical-test # 62/62 tests pass
Reference
docs/FFI_DESIGN.md— C ABI contract between Lean and the Rust kernel.docs/FFI_COMPLETENESS.md— per-function axiom audit.docs/KERNEL_BOUNDARY.md— what this delivers in unmodified Lean 4 vs. what would need upstream Lean kernel work.docs/NUMERICAL.md— numerical implementation principles.docs/PHASE1_HISTORY.md— original transport/composition formalisation plan (archived; Phase 1 closed; preserved as methodology template for future phases).docs/ZIGZAG_PORT.md— step-by-step Lean port plan for the n-category combinatorial engine (Phase 2+ higher-cell backend). Lands here in the engine. Read the cascade caveat at the top before editing: changes in the ported zigzag layer cascade to the siblingtopoleirepo.native/cubical/README.md— Rust crate build + dev guide.native/cubical/WASM.md— wasm32 ABI integration contract.
Used by
max/topolei— the cells-spec workspace interface, built on this engine. See itsdocs/cells-spec.mdanddocs/STATUS.mdfor the application-side picture.