Packages

The Dan Programming Language

Current section

Files

Jump to
dan README.md
Raw

README.md

Dan Kan: Simplicial HoTT
========================
Groupoid Infinity Simplicial HoTT Computer Algebra System is a pure algebraΡ—c implementation
with explicit syntaxt for fastest type checking. It supports following extensions: `Chain`,
`Cochain`, `Simplex`, `Simplicial`, `Category`, `Monoid`, `Group`, `Ring`.
Simplicial HoTT is a Rezk/GAP replacement incorporated into CCHM/CHM/HTS Agda-like Anders/Dan
with Kan, Rezk and Segal simplicial modes for computable ∞-categories.
<img src="styles/Daniel_Kan.JPG"/>
## Abstract
We present a domain-specific language (DSL), the extension to Cubical Homotopy Type Theory (CCHM) for simplicial structures,
designed as a fast type checker with a focus on algebraic purity. Built on the Cohen-Coquand-Huber-MΓΆrtberg (CCHM)
framework, our DSL employs a Lean/Anders-like sequent syntax `П (context) ⊒ k (vβ‚€, ..., vβ‚– | fβ‚€, ..., fβ‚— | ... )` to define
k-dimensional `0, ..., n, ∞` simplices via explicit contexts, vertex lists, and face relations, eschewing geometric coherence terms
in favor of compositional constraints (e.g., `f = g ∘ h`). The semantics, formalized as inference rules in a Martin-Lâf
Type Theory MLTT-like setting, include Formation, Introduction, Elimination, Composition, Computational, and
Uniqueness rules, ensuring a lightweight, deterministic computational model with linear-time type checking (O(k + m + n),
where k is vertices, m is faces, and n is relations). Inspired by opetopic purity, our system avoids cubical
path-filling (e.g., `PathP`), aligning with syntactic approaches to higher structures while retaining CCHM’s
type-theoretic foundation. Compared to opetopic sequent calculi and the Rzk prover, our DSL balances algebraic
simplicity with practical efficiency, targeting simplicial constructions over general ∞-categories,
and achieves a fast, pure checker suitable for formal proofs and combinatorial reasoning.
## Setup
```
$ ocamlopt -o dan src/simplicity.ml && ./dan
```
## Syntax
Incorporating into CCHM/CHM/HTS Anders/Dan core.
### Definition
New sequent contruction:
```
def <name> : <type> := П (context), conditions ⊒ <n> (elements | constraints)
```
Instances:
```
def chain : Chain := П (context), conditions ⊒ n (Cβ‚€, C₁, ..., Cβ‚™ | βˆ‚β‚€, βˆ‚β‚, ..., βˆ‚β‚™β‚‹β‚)
def simplicial : Simplicial := П (context), conditions ⊒ n (sβ‚€, s₁, ..., sβ‚™ | facemaps, degeneracies)
def group : Group := П (context), conditions ⊒ n (generators | relations)
def cat : Category := П (context), conditions ⊒ n (objects | morphisms | coherence)
```
### BNF
```
<program> ::= <definition> | <definition> <program>
<definition> ::= "def" <id> ":" <type-name> ":=" <type-term>
<type-name> ::= "Simplex" | "Simplicial" | "Chain" | "Cochain"
| "Category" | "Group" | "Monoid" | "Ring" | "Field"
<type-term> ::= "П" "(" <context> ")" "⊒" <n> "(" <elements> "|" <constraints> ")"
<digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
<superscript> ::= "¹" | "²" | "³" | "⁴" | "⁡" | "⁢" | "⁷" | "⁸" | "⁹"
<n> ::= <digit> | <digit> <n> | "∞"
<context> ::= <hypothesis> | <hypothesis> "," <context>
<hypothesis> ::= <id> ":" <type-term> % Single declaration, e.g., a : Simplex
| "(" <id-list> ":" <type-term> ")" % Grouped declaration, e.g., (a b c : Simplex)
| <id> "=" <t> "<" <t> % Map, e.g., βˆ‚β‚ = Cβ‚‚ < C₃
| <id> "=" <t> % Equality, e.g., x = 2
| <id> "=" <t> "∘" <t> % Monoid composition, e.g., ac = ab ∘ bc
| <id> "=" <t> "+" <t> % Ring addition, e.g., x + y = s
| <id> "=" <t> "β‹…" <t> % Ring multiplication, e.g., x β‹… y = p
| <id> "=" <t> "/" <t> % Field division, e.g., x / y = d
<id-list> ::= <id> | <id> <id-list> % e.g., a b c
<elements> ::= <element-list> | Ξ΅
<element-list> ::= <id> | <id> "," <element-list>
<constraints> ::= <constraint-list> | Ξ΅
<constraint-list> ::= <constraint> | <constraint> "," <constraint-list>
<constraint> ::= <t> "=" <t> % Equality, e.g., a = 2
| <t> "∘" <t> "=" <t> % Monoid composition, e.g., a ∘ a = e
| <t> "+" <t> "=" <t> % Ring addition, e.g., x + y = s
| <t> "β‹…" <t> "=" <t> % Ring multiplication, e.g., x β‹… y = p
| <t> "/" <t> "=" <t> % Field division, e.g., x / y = d
| <id> "<" <id> % Map, e.g., βˆ‚β‚ < Cβ‚‚
<t> ::= <id> % e.g., a
| <t> "∘" <t> % e.g., a ∘ b
| <t> "+" <t> % e.g., x + y
| <t> "β‹…" <t> % e.g., x β‹… y
| <t> "/" <t> % e.g., x / y
| <t> "^-1" % e.g., a^-1
| <t> "^" <superscript> % e.g., aΒ³
| "e" % identity
| <number> % e.g., 2
| <matrix> % e.g., [[1,2],[3,4]]
<number> ::= <digit> | <digit> <number> % e.g., 123
<matrix> ::= "[" <row-list> "]" % e.g., [[1,2],[3,4]]
<row-list> ::= <row> | <row> "," <row-list>
<row> ::= "[" <number-list> "]" % e.g., [1,2]
<number-list> ::= <number> | <number> "," <number-list> % e.g., 1,2
```
Meaning of `<n>` Across Types:
* Simplex: Dimension of the simplexβ€”e.g., n=2 for a triangle (2-simplex).
* Group: Number of generatorsβ€”e.g., n=1 for Z/3Z (one generator a).
* Simplicial: Maximum dimension of the simplicial setβ€”e.g., n=1 for S1 (up to 1-simplices).
* Chain: Length of the chain (number of levels minus 1)β€”e.g., n=2 for a triangle chain (0, 1, 2 levels).
* Category: Number of objectsβ€”e.g., n=2 for a path category (two objects x,y).
* Monoid: Number of generatorsβ€”e.g., n=2 for N (zero and successor).
## Semantics
### Chain
* Formation. Ξ“ ⊒ Chain : Set
* Intro. Ξ“ ⊒ n (S `|` R) : Chain if Ξ“ = s₀₁, …, sβ‚™β‚˜β‚™ : Simplex, r₁, …, rβ‚š ∧ Sβ‚€, S₁, …, Sβ‚™ = (s₀₁, …, sβ‚€β‚˜β‚€), …, (sₙ₁, …, sβ‚™β‚˜β‚™) ∧ βˆ€ rβ±Ό = tβ±Ό = tβ±Ό', Ξ“ ⊒ rβ±Ό : tβ±Ό = tβ±Ό' ∧ βˆ€ βˆ‚α΅’β±Ό < sβ‚–β‚—, Ξ“ ⊒ βˆ‚α΅’β±Ό : sβ‚–β‚— β†’ sₖ₋₁,β‚˜
* Elim Face. Ξ“ ⊒ βˆ‚α΅’β±Ό s : Simplex if Ξ“ ⊒ n (S `|` R) : Chain ∧ r = βˆ‚α΅’β±Ό < s ∧ r ∈ R ∧ s ∈ S
* Comp Face. βˆ‚α΅’β±Ό (n (S `|` R)) β†’ s' if r = βˆ‚α΅’β±Ό < s' ∧ r ∈ R ∧ s' ∈ S
* Uniq Face. Ξ“ ⊒ βˆ‚α΅’β±Ό s ≑ βˆ‚α΅’β±Ό s' if Ξ“ ⊒ n (S `|` R) : Chain ∧ n (S' `|` R') : Chain ∧ s ∈ S ∧ s' ∈ S' ∧ βˆ€ r = βˆ‚α΅’β±Ό < s ∈ R ∧ r' = βˆ‚α΅’β±Ό < s' ∈ R'
### Cochain
* Formation. Ξ“ ⊒ Cochain : Set
* Intro. Ξ“ ⊒ n (S `|` R) : Cochain if Ξ“ = s₀₁, …, sβ‚™β‚˜β‚™ : Simplex, r₁, …, rβ‚š ∧ Sβ‚€, S₁, …, Sβ‚™ = (s₀₁, …, sβ‚€β‚˜β‚€), …, (sₙ₁, …, sβ‚™β‚˜β‚™) ∧ βˆ€ rβ±Ό = tβ±Ό = tβ±Ό', Ξ“ ⊒ rβ±Ό : tβ±Ό = tβ±Ό' ∧ βˆ€ Οƒα΅’β±Ό < sβ‚–β‚—, Ξ“ ⊒ Οƒα΅’β±Ό : sβ‚–β‚— β†’ sβ‚–β‚Šβ‚,β‚˜
* Elim Degeneracy. Ξ“ ⊒ Οƒα΅’β±Ό s : Simplex if Ξ“ ⊒ n (S `|` R) : Cochain ∧ r = Οƒα΅’β±Ό < s ∧ r ∈ R ∧ s ∈ S
* Comp Degeneracy. Οƒα΅’β±Ό (n (S `|` R)) β†’ s' if r = Οƒα΅’β±Ό < s' ∧ r ∈ R ∧ s' ∈ S
* Uniq Degeneracy. Ξ“ ⊒ Οƒα΅’β±Ό s ≑ Οƒα΅’β±Ό s' if Ξ“ ⊒ n (S `|` R) : Cochain ∧ n (S' `|` R') : Cochain ∧ s ∈ S ∧ s' ∈ S' ∧ βˆ€ r = Οƒα΅’β±Ό < s ∈ R ∧ r' = Οƒα΅’β±Ό < s' ∈ R'
### Category
* Formation. Ξ“ ⊒ Category : Set
* Intro. Ξ“ ⊒ n (O `|` M `|` R) : Category if Ξ“ = o₁, …, oβ‚™, m₁, …, mβ‚– : Simplex, r₁, …, rβ‚š ∧ O = (o₁, …, oβ‚™) ∧ M = (m₁, …, mβ‚™) ∧ βˆ€ rβ±Ό = tβ±Ό = tβ±Ό', Ξ“ ⊒ rβ±Ό : tβ±Ό = tβ±Ό' ∧ βˆ€ tβ±Ό = mₐ ∘ mᡦ, mₐ, mᡦ ∈ Ξ“
* Elim Comp. Ξ“ ⊒ c : Simplex if Ξ“ ⊒ n (O `|` M `|` R) : Category ∧ r = c = m₁ ∘ mβ‚‚ ∧ r ∈ R ∧ m₁, mβ‚‚ ∈ Ξ“
* Comp Comp. (m₁ ∘ mβ‚‚) (n (O `|` M `|` R)) β†’ c if r = c = m₁ ∘ mβ‚‚ ∧ r ∈ R ∧ m₁, mβ‚‚ ∈ Ξ“
* Uniq Comp. Ξ“ ⊒ c ≑ c' if Ξ“ ⊒ n (O `|` M `|` R) : Category ∧ n (O' `|` M' `|` R') : Category ∧ r = c = m₁ ∘ mβ‚‚ ∈ R ∧ r' = c' = m₁' ∘ mβ‚‚' ∈ R' ∧ m₁, mβ‚‚ ∈ Ξ“ ∧ m₁', mβ‚‚' ∈ Ξ“'
### Monoid
* Formation. Ξ“ ⊒ Monoid : Set
* Intro. Ξ“ ⊒ n (M `|` R) : Monoid if Ξ“ = m₁, …, mβ‚™ : Simplex, r₁, …, rβ‚š ∧ M = (m₁, …, mβ‚™) ∧ βˆ€ rβ±Ό = tβ±Ό = tβ±Ό', Ξ“ ⊒ rβ±Ό : tβ±Ό = tβ±Ό' ∧ βˆ€ tβ±Ό = mₐ ∘ mᡦ, mₐ, mᡦ ∈ M
* Elim Comp. Ξ“ ⊒ c : Simplex if Ξ“ ⊒ n (M `|` R) : Monoid ∧ r = c = m₁ ∘ mβ‚‚ ∧ r ∈ R ∧ m₁, mβ‚‚ ∈ M
* Comp Comp. (m₁ ∘ mβ‚‚) (n (M `|` R)) β†’ c if r = c = m₁ ∘ mβ‚‚ ∧ r ∈ R ∧ m₁, mβ‚‚ ∈ M
* Uniq Comp. Ξ“ ⊒ c ≑ c' if Ξ“ ⊒ n (M `|` R) : Monoid ∧ n (M' `|` R') : Monoid ∧ r = c = m₁ ∘ mβ‚‚ ∈ R ∧ r' = c' = m₁' ∘ mβ‚‚' ∈ R' ∧ m₁, mβ‚‚ ∈ M ∧ m₁', mβ‚‚' ∈ M'
### Simplex
* Formation. Ξ“ ⊒ Simplex : Set
* Intro. Ξ“ ⊒ n (S `|` R) : Simplex if Ξ“ = sβ‚€, …, sβ‚™ : Simplex, r₁, …, rβ‚š ∧ `|`S`|` = n + 1 ∧ βˆ€ rβ±Ό = tβ±Ό = tβ±Ό', Ξ“ ⊒ rβ±Ό : tβ±Ό = tβ±Ό' ∧ βˆ€ βˆ‚α΅’ < sβ‚–, Ξ“ ⊒ βˆ‚α΅’ : sβ‚– β†’ sₖ₋₁ ∧ βˆ€ Οƒα΅’ < sβ‚–, Ξ“ ⊒ Οƒα΅’ : sβ‚– β†’ sβ‚–β‚Šβ‚
* Elim Face. Ξ“ ⊒ βˆ‚α΅’ s : Simplex if Ξ“ ⊒ n (S `|` R) : Simplex ∧ r = βˆ‚α΅’ < s ∧ r ∈ R ∧ s ∈ S
* Elim Degeneracy. Ξ“ ⊒ Οƒα΅’ s : Simplex if Ξ“ ⊒ n (S `|` R) : Simplex ∧ r = Οƒα΅’ < s ∧ r ∈ R ∧ s ∈ S
* Comp Face. βˆ‚α΅’ (n (S `|` R)) β†’ s' if r = βˆ‚α΅’ < s' ∧ r ∈ R ∧ s' ∈ S
* Comp Degeneracy. Οƒα΅’ (n (S `|` R)) β†’ s' if r = Οƒα΅’ < s' ∧ r ∈ R ∧ s' ∈ S
* Uniq Face. Ξ“ ⊒ βˆ‚α΅’ s ≑ βˆ‚α΅’ s' if Ξ“ ⊒ n (S `|` R) : Simplex ∧ n (S' `|` R') : Simplex ∧ s ∈ S ∧ s' ∈ S' ∧ βˆ€ r = βˆ‚α΅’ < s ∈ R ∧ r' = βˆ‚α΅’ < s' ∈ R'
* Uniq Degeneracy. Ξ“ ⊒ Οƒα΅’ s ≑ Οƒα΅’ s' if Ξ“ ⊒ n (S `|` R) : Simplex ∧ n (S' `|` R') : Simplex ∧ s ∈ S ∧ s' ∈ S' ∧ βˆ€ r = Οƒα΅’ < s ∈ R ∧ r' = Οƒα΅’ < s' ∈ R'
### Simplicial
#### Simplicial Modes
* Ξ“ ⊒ Ξ”β‚™ : Type (Simplex)
* Ξ“ ⊒ Δₙᡏᡃⁿ : Type
* Ξ“ ⊒ Δₙʳᡉᢻᡏ : Type
* Ξ“ ⊒ Δₙ˒ᡉᡍᡃˑ : Type
#### Formation
The simplicial type is declared as a set within the context Ξ“ without any premises.
```
Ξ“ ⊒ Ξ” : Type
```
#### Introduction
A simplicial set of rank n with elements S and constraints R is formed from context Ξ“ if simplices, equalities, face maps, and degeneracy maps are properly defined.
```
Ξ“ ⊒ n (S | R) : Simplicial if
Ξ“ = s₀₁, …, sβ‚™β‚˜β‚™ : Simplex, r₁, …, rβ‚š ∧
Sβ‚€, S₁, …, Sβ‚™ = (s₀₁, …, sβ‚€β‚˜β‚€), …, (sₙ₁, …, sβ‚™β‚˜β‚™) ∧
rβ±Ό = tβ±Ό = tβ±Ό',
Ξ“ ⊒ rβ±Ό : tβ±Ό = tβ±Ό' ∧
βˆ‚α΅’β±Ό < sβ‚–β‚—,
Ξ“ ⊒ βˆ‚α΅’β±Ό : sβ‚–β‚— β†’ sₖ₋₁,β‚˜ ∧
Οƒα΅’β±Ό < sβ‚–β‚—,
Ξ“ ⊒ Οƒα΅’β±Ό : sβ‚–β‚— β†’ sβ‚–β‚Šβ‚,β‚˜
```
#### Elim Face
The face map βˆ‚α΅’β±Ό extracts a simplex from s in a simplicial set if the constraint r defines the face relation.
```
Ξ“ ⊒ βˆ‚α΅’β±Ό s : Simplex if
Ξ“ ⊒ n (S | R) : Simplicial ∧
r = βˆ‚α΅’β±Ό < s ∧
r ∈ R ∧
s ∈ S
```
#### Elim Composition
The composition s₁ ∘ sβ‚‚ yields a simplex c in a simplicial set if the constraint r defines it and s1 and s2 are composable.
```
Ξ“ ⊒ c : Simplex if
Ξ“ ⊒ n (S | R) : Simplicial ∧
r = c = s₁ ∘ sβ‚‚ ∧
r ∈ R ∧ s₁, sβ‚‚ ∈ S ∧
Ξ“ ⊒ βˆ‚α΅’α΅’β‚‹β‚ s₁ = βˆ‚α΅’β‚€ sβ‚‚
```
#### Elim Degeneracy
The degeneracy map Οƒα΅’β±Ό lifts a simplex s to a higher simplex in a simplicial set if the constraint r defines the degeneracy relation.
```
Ξ“ ⊒ Οƒα΅’β±Ό s : Simplex if
Ξ“ ⊒ n (S | R) : Simplicial ∧
r = Οƒα΅’β±Ό < s,
r ∈ R,
s ∈ S
```
#### Face Computation
The face map βˆ‚α΅’β±Ό applied to a simplicial set reduces to the simplex sβ€² specified by the constraint r in R.
```
βˆ‚α΅’β±Ό (n (S | R)) β†’ s' if
r = βˆ‚α΅’β±Ό < s' ∧
r ∈ R ∧
s' ∈ S
```
#### Composition Computation.
The composition s₁ ∘ sβ‚‚ applied to a simplicial set reduces to the simplex c specified by the constraint r in R, given s1 and s2 are composable.
```
(s₁ ∘ sβ‚‚) (n (S | R)) β†’ c if
r = c = s₁ ∘ sβ‚‚ ∧
r ∈ R ∧
s₁, sβ‚‚ ∈ S ∧
Ξ“ ⊒ βˆ‚α΅’α΅’β‚‹β‚ s₁ = βˆ‚α΅’β‚€ sβ‚‚
```
#### Degeneracy Computation.
The degeneracy map Οƒα΅’β±Ό applied to a simplicial set reduces to the simplex sβ€² specified by the constraint r in R.
```
Οƒα΅’β±Ό (n (S | R)) β†’ s' if
r = Οƒα΅’β±Ό < s' ∧
r ∈ R ∧
s' ∈ S
```
#### Face Uniqueness
Two face maps βˆ‚α΅’β±Ό s and βˆ‚α΅’β±Ό sβ€² are equal if they are defined by constraints r and rβ€² across two simplicial sets with matching elements.
```
Ξ“ ⊒ βˆ‚α΅’β±Ό s ≑ βˆ‚α΅’β±Ό s' if
Ξ“ ⊒ n (S | R) : Simplicial ∧
n (S' | R') : Simplicial ∧
s ∈ S ∧ s' ∈ S' ∧
r = βˆ‚α΅’β±Ό < s ∈ R ∧
r' = βˆ‚α΅’β±Ό < s' ∈ R'
```
#### Uniqueness of Composition.
Two composed simplices c and cβ€² are equal if their constraints r and rβ€² define compositions of matching pairs s₁, sβ‚‚ and s₁′, sβ‚‚β€² across two simplicial sets with composability conditions.
```
Ξ“ ⊒ c ≑ c' if
Ξ“ ⊒ n (S | R) : Simplicial ∧
n (S' | R') : Simplicial ∧
r = c = s₁ ∘ sβ‚‚ ∈ R ∧
r' = c' = s₁' ∘ sβ‚‚' ∈ R' ∧
s₁, sβ‚‚ ∈ S ∧
s₁', sβ‚‚' ∈ S' ∧
Ξ“ ⊒ βˆ‚α΅’α΅’β‚‹β‚ s₁ = βˆ‚α΅’β‚€ sβ‚‚ ∧
Ξ“ ⊒ βˆ‚α΅’α΅’β‚‹β‚ s₁' = βˆ‚α΅’β‚€ sβ‚‚'
```
#### Uniqueness of Degeneracy.
Two degeneracy maps Οƒα΅’β±Ό s and Οƒα΅’β±Ό sβ€² are equal if they are defined by constraints r and rβ€² across two simplicial sets with matching elements.
```
Ξ“ ⊒ Οƒα΅’β±Ό s ≑ Οƒα΅’β±Ό s' if
Ξ“ ⊒ n (S | R) : Simplicial ∧
n (S' | R') : Simplicial ∧
s ∈ S ∧
s' ∈ S' ∧
r = Οƒα΅’β±Ό < s ∈ R ∧
r' = Οƒα΅’β±Ό < s' ∈ R'
```
## Examples
### N-Monoid
```
def nat_monoid : Monoid
:= П (z s : Simplex),
s ∘ z = s, z ∘ s = s
⊒ 2 (z s | s ∘ z = s, z ∘ s = s)
```
O(5).
### Category with Group (Path Category with Z/2Z)
```
def path_z2_category : Category
:= П (x y : Simplex),
(f g h : Simplex),
(z2 : Group(П (e a : Simplex), a² = e ⊒ 1 (a | a² = e))),
f ∘ g = h
⊒ 2 (x y | f g h | f ∘ g = h)
```
O(8)β€”5 context + 2 nested group + 1 constraintβ€”linear with nesting.
### Triangle Chain
```
def triangle_chain : Chain
:= П (vβ‚€ v₁ vβ‚‚ e₀₁ eβ‚€β‚‚ e₁₂ t : Simplex),
βˆ‚β‚β‚€ = e₀₁, βˆ‚β‚β‚ = eβ‚€β‚‚, βˆ‚β‚β‚‚ = e₁₂, βˆ‚β‚‚ < e₀₁ eβ‚€β‚‚ e₁₂
⊒ 2 (vβ‚€ v₁ vβ‚‚, e₀₁ eβ‚€β‚‚ e₁₂, t | βˆ‚β‚β‚€ βˆ‚β‚β‚ βˆ‚β‚β‚‚, βˆ‚β‚‚)
```
O(11).
### Simplicial Circle
```
def circle : Simplicial
:= П (v e : Simplex),
βˆ‚β‚β‚€ = v, βˆ‚β‚β‚ = v, sβ‚€ < v
⊒ 1 (v, e | βˆ‚β‚β‚€ βˆ‚β‚β‚, sβ‚€)
```
O(5).
### Z/3Z
```
def z3 : Group
:= П (e a : Simplex),
aΒ³ = e
⊒ 1 (a | a³ = e)
```
O(4).
### Triangle
```
def triangle : Simplex := П (a b c : Simplex),
(ab bc ca : Simplex), ac = ab ∘ bc
⊒ 2 (a b c | ab bc ca)
```
O(7).
### Singular Cone
```
def singular_cone : Simplex
:= П (p q r s : Simplex),
(qrs prs pqs : Simplex), pqr = pqs ∘ qrs
⊒ 3 (p q r s | qrs prs pqs pqr)
```
Context: p, q, r, s: Simplex (vertices), qrs, prs, pqs : Simplex (faces), pqr = pqs ∘ qrs.
Simplex: Dimension 3, 4 faces.
### MΓΆbius Piece
```
def MΓΆbius : Simplex
:= П (a b c : Simplex),
(bc ac : Simplex), ab = bc ∘ ac
⊒ 2 (a b c | bc ac ab)
```
Context: a, b, c : Simplex (vertices), bc, ac : Simplex (faces), ab = bc ∘ ac (relation).
Simplex: Dimension 2, 3 faces.
### Degenerate Tetrahedron
```
def degen_tetra : Simplex
:= П (p q r s : Simplex, q = r),
(qrs prs pqs : Simplex), pqr = pqs ∘ qrs
⊒ 3 (p q r s | qrs prs pqs pqr)
```
Context: p, q, r, s : Simplex, q = r (degeneracy), qrs, prs, pqs : Simplex, pqr = pqs ∘ qrs.
Simplex: Dimension 3, 4 facesβ€”degeneracy implies a collapsed edge.
Non-Triviality: q = r flattens the structure algebraically, testing composition under equality.
### Twisted Annulus
```
def twisted_annulus : Simplex
:= П (a b c d : Simplex),
(bc ac bd : Simplex), ab = bc ∘ ac, cd = ac ∘ bd
⊒ 2 (a b c | bc ac ab), 2 (b c d | bc bd cd)
```
Context:
* Vertices: a, b, c, d.
* Faces: bc, ac, bd.
* Relations: ab = bc ∘ ac, cd = ac ∘ bd (twist via composition).
Simplices:
* (a b c `|` bc, ac, ab ): First triangle.
* (b c d `|` bc, bd, cd ): Second triangle, sharing bc.
Checking:
* Vertices: a, b, c, d ∈ Ξ“ β€” O(4).
* Faces: bc, ac, ab (O(3)), bc, bd, cd (O(3)) β€” total O(6).
* Relations: ab = bc ∘ ac (O(1)), cd = ac ∘ bd (O(1)) β€” O(2).
* Total: O(12) β€” linear, fast.
### Degenerate Triangle (Collapsed Edge)
```
def degen_triangle : Simplex
:= П (a b c : Simplex, b = c),
(bc ac : Simplex), ab = bc ∘ ac
⊒ 2 (a b c | bc ac ab)
```
Context:
* Vertices: a, b, c, with b = c.
* Faces: bc, ac.
* Relation: ab = bc ∘ ac.
Simplex:
* (a b c `|` bc, ac, ab ) β€” 3 faces, despite degeneracy.
Checking:
* Vertices: a, b, c ∈ Ξ“, b = c β€” O(3).
* Faces: bc, ac, ab ∈ Ξ“ β€” O(3).
* Relation: ab = bc ∘ ac β€” O(1).
* Total: O(7)β€”efficient, handles degeneracy cleanly.
### Singular Prism (Degenerate Face)
```
def singular_prism : Simplex
:= П (p q r s t : Simplex),
(qrs prs pqt : Simplex, qrs = qrs), pqr = pqt ∘ qrs
⊒ 3 (p q r s | qrs prs pqt pqr)
```
Context:
* Vertices: p, q, r, s, t.
* Faces: qrs, prs, pqt.
* Relations: qrs = qrs (degenerate identity), pqr = pqt ∘ qrs.
Simplex:
* (p q r s `|` qrs, prs, pqt, pqr ) β€” 4 faces, one degenerate.
Checking:
* Vertices: p, q, r, s ∈ Ξ“ (t unused, valid) β€” O(4).
* Faces: qrs, prs, pqt, pqr ∈ Ξ“ β€” O(4).
* Relations: qrs = qrs (O(1)), pqr = pqt ∘ qrs (O(1)) β€” O(2).
* Total: O(10) β€” linear, fast despite degeneracy.
### S¹ as ∞-Groupoid
```
def s1_infty : Simplicial
:= П (v e : Simplex),
βˆ‚β‚β‚€ = v, βˆ‚β‚β‚ = v, sβ‚€ < v,
βˆ‚β‚‚β‚€ = e ∘ e, s₁₀ < βˆ‚β‚‚β‚€
⊒ ∞ (v, e, βˆ‚β‚‚β‚€ | βˆ‚β‚β‚€ βˆ‚β‚β‚, sβ‚€, βˆ‚β‚‚β‚€, s₁₀)
```
AST:
```
(* Infinite S¹ ∞-groupoid *)
let s1_infty = {
name = "s1_infty";
typ = Simplicial;
context = [
Decl (["v"; "e"], Simplex); (* Base point and loop *)
Equality ("βˆ‚β‚β‚€", Id "v", Id "βˆ‚β‚β‚€");
Equality ("βˆ‚β‚β‚", Id "v", Id "βˆ‚β‚β‚");
Equality ("sβ‚€", Id "e", Id "sβ‚€");
Equality ("βˆ‚β‚‚β‚€", Comp (Id "e", Id "e"), Id "βˆ‚β‚‚β‚€"); (* 2-cell: e ∘ e *)
Equality ("s₁₀", Id "βˆ‚β‚‚β‚€", Id "s₁₀") (* Degeneracy for 2-cell *)
];
rank = Infinite; (* Unbounded dimensions *)
elements = ["v"; "e"; "βˆ‚β‚‚β‚€"]; (* Finite truncation: 0-, 1-, 2-cells *)
constraints = [
Eq (Id "βˆ‚β‚β‚€", Id "v");
Eq (Id "βˆ‚β‚β‚", Id "v");
Map ("sβ‚€", ["v"]);
Eq (Id "βˆ‚β‚‚β‚€", Comp (Id "e", Id "e"));
Map ("s₁₀", ["βˆ‚β‚‚β‚€"])
]
}
```
### ∞-Category with cube fillers
```
def cube_infty : Category := П (a b c : Simplex),
(f g h : Simplex), cube2 = g ∘ f, cube2 : Simplex,
cube3 = cube2 ∘ f, cube3 : Simplex
⊒ ∞ (a b c | cube2 cube3)
```
### Matrix Ring Spectrum
```
def matrix_ring_spectrum : Ring
:= П (a b s p : Simplex),
a + b = s, a β‹… b = p,
a = [[1,2],[3,4]], b = [[0,1],[1,0]], s = [[1,3],[4,4]], p = [[2,1],[4,3]]
⊒ 4 (a b s p | a + b = s, a β‹… b = p, a = [[1,2],[3,4]], b = [[0,1],[1,0]],
s = [[1,3],[4,4]], p = [[2,1],[4,3]])
```
### HZ spectrum
```
def hz_spectrum : Ring
:= П (x y p : Simplex),
x β‹… y = p,
x = 2, y = 3, p = 6
⊒ 3 (x y p | x β‹… y = p, x = 2, y = 3, p = 6)
```
### Poly Ring spectrum
```
def poly_ring_zx : Ring
:= П (f g s p : Simplex),
f + g = s, f β‹… g = p,
f = x + 1, g = 2 β‹… x, s = 3 β‹… x + 1, p = 2 β‹… x β‹… x + 2 β‹… x
⊒ 4 (f g s p | f + g = s, f β‹… g = p, f = x + 1, g = 2 β‹… x,
s = 3 β‹… x + 1, p = 2 β‹… x β‹… x + 2 β‹… x)
```
### GF(2⁴) Finite Field
```
def gf16 : Field
:= П (x y s p d : Simplex),
x + y = s, x β‹… y = p, x / y = d,
x = Z(2^4), y = Z(2^4)^2,
s = Z(2^4) + Z(2^4)^2,
p = Z(2^4)^3, d = Z(2^4)^14
⊒ 5 (x y s p d | x + y = s, x β‹… y = p, x / y = d,
x = Z(2^4), y = Z(2^4)^2,
s = Z(2^4) + Z(2^4)^2,
p = Z(2^4)^3,
d = Z(2^4)^14)
```
### GF(7) Prime Field
```
def gf7 : Field
:= П (x y s p d : Simplex),
x + y = s, x β‹… y = p, x / y = d,
x = 2, y = 3, s = 5, p = 6, d = 3
⊒ 5 (x y s p d | x + y = s, x β‹… y = p,
x / y = d, x = 2, y = 3,
s = 5, p = 6, d = 3)
```
## Bibliography
* Daniel Kan. Abstract Homotopy I. 1955.
* Daniel Kan. Abstract Homotopy II. 1956.
* Daniel Kan. On c.s.s. Complexes. 1957.
* Daniel Kan. A Combinatorial Definition of Homotopy Groups. 1958.
* Daniel Kan, W. G. Dwyer. Adjoint functors. 1958.
* Daniel Kan, W. G. Dwyer. Simplicial Localizations of Categories. 1980.
* Graeme Segal. Classifying spaces and spectral sequences. 1968.
* Graeme Segal. Categories and cohomology theories. 1974.
* Graeme Segal, R. Bott. Loop groups and their classifying spaces. 1988.
* Charles Rezk. A model for the homotopy theory of homotopy theory. 2001.
* Charles Rezk. A cartesian presentation of weak n-categories". 2010.
* Charles Rezk, S. Schwede, B. Shipley. Simplicial structures on model categories and functors. 2001.
* Charles Rezk, J. Bergner. Comparison of models for (∞,n)-categories. 2013.
## Conclusion
Dan Kan Simplicity HoTT, hosted at groupoid/dan, is a lightweight, pure type checker
built on Cubical Homotopy Type Theory (CCHM), named in tribute to Daniel Kan for
his foundational work on simplicial sets. With a unified syntax β€”
`П (context) ⊒ n (elements | constraints)` β€” Dan supports a rich type
system `Simplex`, `Group`, `Simplicial`, `Chain`, `Category`, `Monoid`, now extended with
∞-categories featuring cube fillers.