cubical-transport-hott-lean4/README.md
Maximus Gorog 8561e19467
Some checks are pending
Lean Action CI / build (push) Waiting to run
Docs cleanup: archive PHASE1, accept ZIGZAG_PORT, fix stale paths
- TRANSPORT_PLAN.md → PHASE1_HISTORY.md with archival header.
  Path references updated from `Topolei/Cubical/*` to
  `CubicalTransport/*` to match the post-split namespace.
  Methodology preserved as a template for future formalisation phases.
- ZIGZAG_PORT.md moved here from topolei.  This is engine code: the
  port lands in `CubicalTransport/Zigzag/`, and an AI shortcut on
  normalisation, degeneracy, or signature-typechecking would
  cascade-corrupt every higher-cell proof in topolei.  Added a
  cascade caveat header explaining how engine-level zigzag changes
  ripple back into the topolei interface repo.  Body updated for
  split context.
- KERNEL_BOUNDARY.md: clarified that the planned `Eq ↔ Path` bridge
  module is distinct from the existing trace bridge
  (`Topolei/Cubical/Trace.lean` in topolei).
- README.md: refreshed Reference section with renames + new docs.
- native/cubical/README.md: path refs updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 22:52:14 -06:00

2.6 KiB

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.

Reusing this engine

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

  • FFI_DESIGN.md — C ABI contract between Lean and the Rust kernel.
  • FFI_COMPLETENESS.md — per-function axiom audit.
  • KERNEL_BOUNDARY.md — what this delivers in unmodified Lean 4 vs. what would need upstream Lean kernel work.
  • NUMERICAL.md — numerical implementation principles.
  • PHASE1_HISTORY.md — original transport/composition formalisation plan (archived; Phase 1 closed; preserved as methodology template for future phases).
  • 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 sibling topolei repo.
  • 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 its cells-spec.md and STATUS.md for the application-side picture.