Documentation

CatCryptCore.Bridge.MonoidalBridge

Monoidal Bridge: DeepPackage ↔ PkgInterface SMC #

This file connects the concrete package operations (DeepPackage.par, link) to the symmetric monoidal category on PkgInterface (from SemPkg.lean).

Main Results #

Architecture #

The PkgInterface SMC (from SemPkg.lean) uses Sum-indexed families with definitional coherence (funext + cases + rfl). The concrete DeepInterface uses List-indexed families with diAppend = List.append as tensor.

The key difficulty: Fin (m + n) vs Fin m ⊕ Fin n. The tensorAppendIso bridges this gap using castKl' (proof-irrelevant transport on Kleisli arrows) with the roundtrip proofs handled by castKl'_castKl'_symm and castKl'_dep_fn (dependent function transport).

Family Correspondence #

Type-level cast for operation families #

Tensor-Append Isomorphism #

Inverse: handler for toPI I ⊗ toPI J → handler for diAppend I J.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    The tensor-append isomorphism in the PkgInterface category.

    This is the fundamental bridge between DeepInterface.append (list concat, Fin-indexed) and PkgInterface.tensor (Sum-indexed).

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Unit Correspondence #

      The empty deep interface maps to the monoidal unit.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Structural Properties of diAppend #

        diAppend is associative: (I ++ J) ++ K = I ++ (J ++ K) as DeepInterfaces.

        The PkgInterface iso induced by associativity of diAppend.

        Equations
        Instances For

          Coherence #

          The associator pentagon: the two paths from toPI((I++J)++K) to toPI I ⊗ (toPI J ⊗ toPI K) commute.

          Note: The proof requires unfolding eqToHom (from appendAssocIso) into explicit castKl' form. The approach is:

          1. Define appendAssocIso explicitly via castKl' (like tensorAppendIso)
          2. Use castKl'_trans + castKl'_dep_fn + proof irrelevance Both paths compute castKl' at the same Fin.val index with propositionally equal operation triples, so the casts agree by proof irrelevance.

          Linking = Categorical Composition #

          toSemPkg maps DeepPackage.link to composition in Category DeepInterface. This is the fundamental functoriality theorem connecting the concrete package operation to the categorical structure.

          Note: toSemPkg is NOT a strict functor — it does not preserve identity exactly. toSemPkg(DeepPackage.id I) returns fail on non-interface operations, while 𝟙 I = SemPkg.id I passes them through. Identity is only preserved on interface operations (see toSemPkg_id_mem and evalImpl_link_id_left/right).

          Unitor Coherence #

          The unitor bridges: the two paths from toPI(I ++ ⟨[]⟩) to toPI(I) via (1) the append-empty iso, or (2) tensor-append iso + unitIso + monoidal unitor, are equal. Similarly for the left unitor.

          Right unitor coherence: the two paths from toPI(I ++ ⟨[]⟩) to toPI(I) agree. Path 1: toPI(I++⟨[]⟩) → toPI(I) ⊗ toPI(⟨[]⟩) → toPI(I) ⊗ 𝟙_ → toPI(I) Path 2: toPI(I++⟨[]⟩) → toPI(I) directly via appendEmptyRightIso.

          Left unitor coherence: the two paths from toPI(⟨[]⟩ ++ I) to toPI(I) agree. Path 1: toPI(⟨[]⟩++I) → toPI(⟨[]⟩) ⊗ toPI(I) → 𝟙_ ⊗ toPI(I) → toPI(I) Path 2: toPI(⟨[]⟩++I) → toPI(I) directly via appendEmptyLeftIso.

          Braiding Bridge #

          Braiding bridge: composing the tensor-append iso with braiding and the inverse tensor-append iso gives the concrete swap.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For