cubical-transport-hott-lean4/CubicalTransport.lean
Maximus Gorog 7152807b66
Some checks are pending
Lean Action CI / build (push) Waiting to run
REL2 Phase 2: Bridge.lean — Eq ↔ Path interop
Adds CubicalTransport/Bridge.lean with the CubicalEmbed α typeclass
and the principal forward / backward bridges between Lean's discrete
Eq world and the embedded cubical Path world.

CubicalEmbed α:
  · ctype          : CType — where embedded values live
  · toCTerm        : α → CTerm
  · fromCTerm      : CTerm → Option α
  · roundtrip      : ∀ a, fromCTerm (toCTerm a) = some a
  · toCTerm_typed  : ∀ a, HasType [] (toCTerm a) ctype

Default instances (REL2.0):
  · CubicalEmbed Bool          via boolSchema (true/false ctors)
  · CubicalEmbed Nat           via natSchema  (zero/succ tower; uses
                               natLit + fromCTermNat helper)
  · CubicalEmbed (List α)      parametric over [CubicalEmbed α], via
                               listSchema (nil/cons + listToCTerm /
                               listFromCTerm helpers)

Each instance ships a verified roundtrip proof and a typing witness
proof; all reduce by structural induction.

Forward bridge (always available):
  · Eq.toPath : (a = b) → CTerm  — produces a constant `.plam`.
  · Eq.toPath_endpoints — equational witness.

Backward bridge (REL2.0 canonical case):
  · CubicalEmbed.toCTerm_injective — direct corollary of roundtrip.
  · Path.toEq_canonical — for syntactically-equal toCTerm endpoints.
  · Full backward bridge over arbitrary well-typed paths is REL2.1
    (depends on full Glue NbE).

Prop-level coincidence: trivial via proof irrelevance.

Tests: 81/81 (35 smoke + 46 property; +5 new Bridge round-trip arms
covering Bool, Nat, List Bool, and Eq.toPath readback).

Doc: KERNEL_BOUNDARY.md §2.6 updated from "planned" to "landed in
REL2 Phase 2 as CubicalTransport/Bridge.lean".  Re-export from
CubicalTransport.lean.

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

24 lines
767 B
Text

import CubicalTransport.Interval
import CubicalTransport.Face
import CubicalTransport.Syntax
import CubicalTransport.Subst
import CubicalTransport.DimLine
import CubicalTransport.Typing
import CubicalTransport.Equiv
import CubicalTransport.Glue
import CubicalTransport.Value
import CubicalTransport.Transport
import CubicalTransport.Line
import CubicalTransport.Eval
import CubicalTransport.EvalTest
import CubicalTransport.Readback
import CubicalTransport.FFI
import CubicalTransport.FFITest
import CubicalTransport.ValueTyping
import CubicalTransport.TransportLaws
import CubicalTransport.System
import CubicalTransport.CompLaws
import CubicalTransport.Soundness
import CubicalTransport.Inductive
import CubicalTransport.Bridge
import CubicalTransport.PropertyTest