dan

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.

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:

Semantics

Chain

Cochain

Category

Monoid

Simplex

Simplicial

Simplicial Modes

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:

Simplices:

Checking:

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:

Simplex:

Checking:

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:

Simplex:

Checking:

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

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.