# Topolei — References Papers and code referenced for implementation. Organized by subsystem. --- ## Cubical Type Theory — Foundational Papers **CCHM — the primary reference for our cubical core.** Cohen, Coquand, Huber, Mörtberg (2016) "Cubical Type Theory: a constructive interpretation of the univalence axiom" arXiv:1611.02108 https://arxiv.org/abs/1611.02108 > De Morgan interval algebra, face formulas, hcomp, transport, Glue types, univalence. > This is the spec for Cells/Cubical/*.lean. **De Morgan Implementation Tutorial — how to actually build it.** Mörtberg (2022) "A tutorial on implementing De Morgan cubical type theory" arXiv:2210.08232 https://arxiv.org/abs/2210.08232 > Type-checking algorithms, cofibration handling, evaluator structure. > Closest thing to a recipe for our Eval.lean and Transport.lean. **ABCFHL — Cartesian cubical variant (alternative to de Morgan).** Angiuli, Brunerie, Coquand, Favonia, Harper, Licata "Syntax and Models of Cartesian Cubical Type Theory" https://www.cs.cmu.edu/~rwh/papers/uniform/uniform.pdf > Read if de Morgan interval causes problems with Lean's kernel; Cartesian > variant has different composition rules that may embed more cleanly. **Univalence in cubical sets.** Bezem, Coquand, Huber (2017) arXiv:1710.10941 https://arxiv.org/abs/1710.10941 **Axioms for cubical type theory in a topos.** Orton, Pitts (2017) arXiv:1712.04864 https://arxiv.org/abs/1712.04864 **Unifying cubical and multimodal type theory.** Aagaard, Kristensen, Gratzer, Birkedal (2022) arXiv:2203.13000 https://arxiv.org/abs/2203.13000 --- ## Cubical Type Theory — Reference Code **cubicaltt — original Haskell implementation by Mörtberg et al.** https://github.com/mortberg/cubicaltt > Reference for hcomp algorithm, face formula solver, evaluator structure. > Read the source, do not depend on it. **Agda Cubical Library — target architecture for our Lean embedding.** https://github.com/agda/cubical > Key files to read: > Cubical/Core/Primitives.agda — interval, face, transport primitives > Cubical/Foundations/Transport.agda — transport lemmas > Cubical/Core/Glue.agda — Glue type and univalence > We are reimplementing this structure in Lean 4 as a deep embedding. > Do not import; use as architectural reference only. **Ground Zero — Lean 4 synthetic HoTT library.** https://github.com/rzrn/ground_zero > Shows how to avoid Lean's native equality and build HoTT synthetically in Lean 4. > Read for: eliminator construction patterns, HIT techniques via quotients. > cells-spec constraint: do not take it as a dependency. --- ## EML — Exp-Minus-Log Binary Primitive **The EML paper. Primary computational reference for this project.** Odrzywolek, Andrzej (2026) "All elementary functions from a single operator" arXiv:2603.21852 https://arxiv.org/abs/2603.21852 Local copy: exp-log.pdf > eml(x,y) = exp(x) − ln(y) with constant 1 generates all elementary functions. > Grammar: S → 1 | eml(S,S). Constructive proof for sin, cos, +, ×, π, etc. > Foundation for H1. See HYPOTHESES.md. --- ## Factorization Homology — FM^fr Notation Layer **The primer — best entry point.** Ayala, Francis (2019) "A factorization homology primer" arXiv:1903.10961 https://arxiv.org/abs/1903.10961 > E_n-algebras, framed manifolds, ⊗-excision. Read this first for H4. **Original paper.** Ayala, Francis (2012) "Factorization homology of topological manifolds" arXiv:1206.5522 https://arxiv.org/abs/1206.5522 **Higher categories.** Ayala, Francis (2015) "Factorization homology I: higher categories" arXiv:1504.04007 https://arxiv.org/abs/1504.04007 **Stratified spaces (for mixed text/graph layouts).** Ayala, Francis, Tanaka (2014) "Factorization homology of stratified spaces" arXiv:1409.0848 https://arxiv.org/abs/1409.0848 > Relevant when notation mixes 1D (text) and 2D (diagram) regions. **Traces in dimension 1 (for linear/sequential syntax).** arXiv:2105.01143 https://arxiv.org/abs/2105.01143 > Circle-invariant traces; relevant for cyclic/recursive notation structures. --- ## Verified Compiler / Shader IR **Lean4Lean — verified Lean typechecker in Lean. Pattern reference.** Carneiro (2024) "Lean4Lean: Verifying a Typechecker for Lean, in Lean" arXiv:2403.14064 https://arxiv.org/abs/2403.14064 > Reference for: how to structure a verified evaluator/compiler in Lean 4. > Our EML → ShaderIR compiler should follow similar patterns. **SPIR-V specification.** Khronos Group https://www.khronos.org/spirv/ > Binary format target for native GPU path. Formal grammar maps onto our ShaderIR. **MLIR SPIR-V dialect — IR structure reference.** https://mlir.llvm.org/docs/Dialects/SPIR-V/ > Reference for what a typed shader IR looks like before binary encoding. > Informs the design of Topolei/Shader/IR.lean. --- ## Recommended Reading Order 1. CCHM (1611.02108) — understand the cubical core we are embedding 2. De Morgan tutorial (2210.08232) — implementation recipe 3. cubicaltt source — see the evaluator and hcomp in action 4. Agda Cubical library — see the Lean-side target architecture 5. EML paper (2603.21852) — already read; revisit Sect. 3 for derivation tables 6. Ayala-Francis primer (1903.10961) — FM^fr foundation for H4 7. Lean4Lean (2403.14064) — verified compiler patterns before writing ShaderIR