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.
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.
$ ocamlopt -o dan src/simplicity.ml && ./dan
Incorporating into CCHM/CHM/HTS Anders/Dan core.
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)
<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:
|
R) : Chain if Ī = sāā, ā¦, sāāā : Simplex, rā, ā¦, rā ā§ Sā, Sā, ā¦, Sā = (sāā, ā¦, sāāā), ā¦, (sāā, ā¦, sāāā) ā§ ā rā±¼ = tā±¼ = tā±¼ā, Ī ā¢ rā±¼ : tā±¼ = tā±¼ā ā§ ā āįµ¢ā±¼ < sāā, Ī ā¢ āįµ¢ā±¼ : sāā ā sāāā,ā|
R) : Chain ā§ r = āįµ¢ā±¼ < s ā§ r ā R ā§ s ā S|
R)) ā sā if r = āįµ¢ā±¼ < sā ā§ r ā R ā§ sā ā S|
R) : Chain ā§ n (Sā |
Rā) : Chain ā§ s ā S ā§ sā ā Sā ā§ ā r = āįµ¢ā±¼ < s ā R ā§ rā = āįµ¢ā±¼ < sā ā Rā|
R) : Cochain if Ī = sāā, ā¦, sāāā : Simplex, rā, ā¦, rā ā§ Sā, Sā, ā¦, Sā = (sāā, ā¦, sāāā), ā¦, (sāā, ā¦, sāāā) ā§ ā rā±¼ = tā±¼ = tā±¼ā, Ī ā¢ rā±¼ : tā±¼ = tā±¼ā ā§ ā Ļįµ¢ā±¼ < sāā, Ī ā¢ Ļįµ¢ā±¼ : sāā ā sāāā,ā|
R) : Cochain ā§ r = Ļįµ¢ā±¼ < s ā§ r ā R ā§ s ā S|
R)) ā sā if r = Ļįµ¢ā±¼ < sā ā§ r ā R ā§ sā ā S|
R) : Cochain ā§ n (Sā |
Rā) : Cochain ā§ s ā S ā§ sā ā Sā ā§ ā r = Ļįµ¢ā±¼ < s ā R ā§ rā = Ļįµ¢ā±¼ < sā ā Rā|
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įµ¦ ā Ī|
M |
R) : Category ā§ r = c = mā ā mā ā§ r ā R ā§ mā, mā ā Ī|
M |
R)) ā c if r = c = mā ā mā ā§ r ā R ā§ mā, mā ā Ī|
M |
R) : Category ā§ n (Oā |
Mā |
Rā) : Category ā§ r = c = mā ā mā ā R ā§ rā = cā = māā ā māā ā Rā ā§ mā, mā ā Ī ā§ māā, māā ā Īā|
R) : Monoid if Ī = mā, ā¦, mā : Simplex, rā, ā¦, rā ā§ M = (mā, ā¦, mā) ā§ ā rā±¼ = tā±¼ = tā±¼ā, Ī ā¢ rā±¼ : tā±¼ = tā±¼ā ā§ ā tā±¼ = mā ā mįµ¦, mā, mįµ¦ ā M|
R) : Monoid ā§ r = c = mā ā mā ā§ r ā R ā§ mā, mā ā M|
R)) ā c if r = c = mā ā mā ā§ r ā R ā§ mā, mā ā M|
R) : Monoid ā§ n (Mā |
Rā) : Monoid ā§ r = c = mā ā mā ā R ā§ rā = cā = māā ā māā ā Rā ā§ mā, mā ā M ā§ māā, māā ā Mā|
R) : Simplex if Ī = sā, ā¦, sā : Simplex, rā, ā¦, rā ā§ |
S|
= n + 1 ā§ ā rā±¼ = tā±¼ = tā±¼ā, Ī ā¢ rā±¼ : tā±¼ = tā±¼ā ā§ ā āįµ¢ < sā, Ī ā¢ āįµ¢ : sā ā sāāā ā§ ā Ļįµ¢ < sā, Ī ā¢ Ļįµ¢ : sā ā sāāā|
R) : Simplex ā§ r = āįµ¢ < s ā§ r ā R ā§ s ā S|
R) : Simplex ā§ r = Ļįµ¢ < s ā§ r ā R ā§ s ā S|
R)) ā sā if r = āįµ¢ < sā ā§ r ā R ā§ sā ā S|
R)) ā sā if r = Ļįµ¢ < sā ā§ r ā R ā§ sā ā S|
R) : Simplex ā§ n (Sā |
Rā) : Simplex ā§ s ā S ā§ sā ā Sā ā§ ā r = āįµ¢ < s ā R ā§ rā = āįµ¢ < sā ā Rā|
R) : Simplex ā§ n (Sā |
Rā) : Simplex ā§ s ā S ā§ sā ā Sā ā§ ā r = Ļįµ¢ < s ā R ā§ rā = Ļįµ¢ < sā ā RāThe simplicial type is declared as a set within the context Ī without any premises.
Ī ā¢ Ī : Type
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āāā,ā
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
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ā
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
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
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ā
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
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'
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ā'
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'
def nat_monoid : Monoid
:= Š (z s : Simplex),
s ā z = s, z ā s = s
ā¢ 2 (z s | s ā z = s, z ā s = s)
O(5).
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.
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).
def circle : Simplicial
:= Š (v e : Simplex),
āāā = v, āāā = v, sā < v
ā¢ 1 (v, e | āāā āāā, sā)
O(5).
def z3 : Group
:= Š (e a : Simplex),
aĀ³ = e
ā¢ 1 (a | aĀ³ = e)
O(4).
def triangle : Simplex := Š (a b c : Simplex),
(ab bc ca : Simplex), ac = ab ā bc
ā¢ 2 (a b c | ab bc ca)
O(7).
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.
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.
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.
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:
|
bc, ac, ab ): First triangle.|
bc, bd, cd ): Second triangle, sharing bc.Checking:
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:
|
bc, ac, ab ) ā 3 faces, despite degeneracy.Checking:
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:
|
qrs, prs, pqt, pqr ) ā 4 faces, one degenerate.Checking:
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āā", ["āāā"])
]
}
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)
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]])
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)
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)
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)
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)
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.