decalage

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Homotopy theory
+--{: .hide}
[[!include homotopy - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

In [[simplicial homotopy theory]], *décalage* refers to a well-behaved model of [[path space objects]] for [[simplicial sets]]:

If you take a [[simplicial set]] and 'throw away' the last face and degeneracy, and relabel, shifting everything down one 'notch', you get a new simplicial set.  This is what is called the _décalage_ of a [[simplicial set]].

It is a model for the [[path space object]] of $X$, -- or rather: the union of all based path space objects for all basepoints $x \in X_0$ -- similar to, but a little smaller than, the model $X^I \times_X X_0$, which is discussed for instance at _[[factorization lemma]]_:

In the latter case an $n$-cell in the path space is a morphism to $X$ from the simplicial cone over the $n$-simplex modeled as the [[pushout]] $(\Delta[n] \times \Delta[1]) \coprod_{\Delta[n]} \Delta[0]$.
This is the simplicial set obtained by forming the simplicial [[cylinder]] over $\Delta[n]$ and then contracting one end to the point.

Contrary to that, an $n$-simplex in the décalage of $X$ is a morphism to $X$ from the cone over $\Delta[n]$ modeled simply by the [[join of simplicial sets]] $\Delta[n] \star \Delta[0]$.

This is a much smaller model for the cone. In fact $\Delta[n]\star \Delta[0] = \Delta[n+1]$ is just the $(n+1)$-simplex. On the other hand, the above pushout-construction produces simplicial sets with many $(n+1)$-simplices, the one that one "expects", but glued to others with some degenerate edges. Accordingly, there is, for $n \geq 1$, a proper inclusion

$$
  \Delta[n] \star \Delta[1] \hookrightarrow
  (\Delta[n] \times \Delta[1]) \coprod_{\Delta[n]} \Delta[0]
  \,.
$$

As a result, the décalage construction is often more convenient than forming $X^I \times_X X_0$.

## Definition

The plain definition of the décalage of a simplicial set is very simple, stated below in

* _[In components](#DefinitionInComponents)_

However, in order to appreciate and handle this definition, it is useful
to understand it as a special case of total décalage, stated below in

* _[As a restriction of total décalage](#AsARestrictionOfTotalDecalage)_ .

From this one sees more manifestly that the décalage of a simplicial set
is built from cones in the original simplicial set. This we discuss below in

* _[In terms of cones](#DefinitionInTermsOfCones)_.

In this last formulation it is clearest what the two canonical morphisms out of the décalage of a simplicial set mean. These we define in

* _[Morphisms out of décalage](#MorphismsOutOfIt)_.

### In components
 {#DefinitionInComponents}

Concretely, the décalage construction is the following.

+-- {: .num_defn #DecalageInComponents}
###### Definition

For $X$ a [[simplicial set]],
the **décalage** $Dec_0\, X \in sSet$ of $X$, is the simplicial set obtained by shifting every dimension down by one, 'forgetting' the last face and degeneracy  of $X$ in each dimension:

* $(Dec_0 \, X)_n \coloneqq X_{n+1}$;

* $d_k^{n,Dec_0 X}  \coloneqq d^{n+1,X}_{k}$;

* $s_k^{n,Dec_0 X}  \coloneqq s^{n+1,X}_{k}$.

=--

Analogously:

* $(Dec^0 \, X)_n \coloneqq X_{n+1}$;

* $d_k^{n,Dec^0 X}  \coloneqq d^{n+1,X}_{k+1}$;

* $s_k^{n,Dec^0 X}  \coloneqq s^{n+1,X}_{k+1}$.

([Illusie 72](#Illusie72), review in [Stevenson 11, Def. 2](#Stevenson11))

### As a restriction of total décalage
 {#AsARestrictionOfTotalDecalage}

It is often useful to understand this as a special case of the _[[total décalage]]_ construction:

+-- {: .num_defn}
###### Definition

Write $\sigma \colon \Delta_a \times \Delta_a \to \Delta_a$ for the [[ordinal sum]] operation on the [[asSet|augmented simplex category]]. The [[total décalage]] functor is precompositon with this

$$
  \sigma^* \colon sSet_a \to ssSet_a
$$

or rather its restriction from [[augmented simplicial sets]] to just [[simplicial sets]]/[[bisimplicial sets]].

$$
  \sigma^* : sSet \to ssSet
  \,.
$$

In terms of this the plain [[décalage]] is the functor induced from the restriction $\sigma(-,[0]) : \Delta \to \Delta$, of [[ordinal sum]] with $0$, i.e.

$$
  Dec_0 X := (\sigma(-,[0]))^* X
  \,.
$$

=--

### In terms of cones
 {#DefinitionInTermsOfCones}

The perspective from total décalage makes fairly manifest that décalage forms [[cones]] in $X$, as we discuss now. To this end, notice the relation of [[total décalage]] to [[join of simplicial sets]]:

+-- {: .num_defn}
###### Definition

Write

$$
  \Box : sSet \times sSet \to ssSet
$$

for the _box product functor_ that takes $X,Y \in sSet$ to the [[bisimplicial set]]

$$
  (X \Box Y) : ([k],[l]) \mapsto X_k \times X_l
  \,.
$$

=--

+-- {: .num_lemma}
###### Lemma

If $X, Y \in $ [[sSet]] are connected, then  their [[join of simplicial sets]] $X \star Y$ is expressed by the [[left adjoint]] to [[total décalage]] as

$$
  \sigma_!(X \Box Y) = X \star Y
  \,.
$$

=--

This appears as ([Stevenson 12, lemma 2.1](#Stevenson12)).

It follows that the left adjoint of plain décalage forms joins with the 0-simplex:

+-- {: .num_cor}
###### Corollary

The [[left adjoint]] to $Dec_0 : sSet \to sSet$ is

$$
  C := \sigma_!((-) \Box \Delta[0])
  \,.
$$

In particular for $S \in sSet$ connected we have

$$
  C(S) = S \star \Delta[0]
  \,.
$$

=--

This appears as ([Stevenson 12, cor. 2.1](#Stevenson12)).

+-- {: .num_remark}
###### Remark

The [[join of simplicial sets]] with the 0-simplex $X \star \Delta[0]$ forms a simplicial model for the [[cone]] over $X$.

=--

+-- {: .num_cor #InTermsOfCones}
###### Corollary

By [[adjunction]] we have for all $n \in \mathbb{N}$

$$
  (Dec_0 X)_n = Hom_{sSet}( \Delta[n] \star \Delta[0], X)
  \,.
$$

=--

So this exhibits the $n$-cells of $Dec_0 X$ as being the cones of $n$-simplices in $X$.

### Morphisms out of the décalage
 {#MorphismsOutOfIt}

+-- {: .num_prop #TheCanonicalMorphisms}
###### Proposition

For $X \in sSet$ its décalage $Dec_0 X$ comes with two canonical [[morphisms]] out of it

$$
  \array{
    Dec_0 X &\overset{\in Fib}{\longrightarrow}& X
    \\
    \big\downarrow {}^{\mathrlap{\in \mathrm{W}}}
    \\
    const X_0
    \mathrlap{\,.}
  }
$$

Here, in terms of the description [above](#DefinitionInTermsOfCones) of décalage by cones:

* the horizontal morphism is induced from the canonical inclusion
  $\Delta[n] \hookrightarrow \Delta[n]\star \Delta[0]$;

* the vertical morphism is given by the canonical inclusion
  $\Delta[0] \hookrightarrow \Delta[n]\star \Delta[0]$.

Or in terms of components, as discussed
[above](#DefinitionInComponents),

* the horizontal morphism is given by
  $d_{last} \colon Dec_0 Y \to Y$,
  hence in degree $n$ by the remaining face map
  $d_{n+1} \colon X_{n+1} \to X_n$;

* the vertical morphism is given in degree 0 by $s_0 \colon X_1 \to X_0$ and in every higher degree similarly by $s_0 \circ s_0 \circ \cdots \circ s_0$.

=--

(review in [Stevenson 11, Def. 2](#Stevenson11))

These morphisms are a [[Kan fibration]] and a [[simplicial weak equivalence]], respectively, by the [following](#FibrationResolution) discussion.

## Properties

### Fibration resolution
 {#FibrationResolution}

We discuss here how $Dec_0 X \to X$ is a [[resolution]] of $const X_0 \to X$ by a [[Kan fibration]].

+-- {: .num_prop}
###### Proposition

For $X$ a simplicial set, the two morphisms from prop. \ref{TheCanonicalMorphisms} have the following properties.

* the morphism $d_0 : Dec_0 X \to const X_0$ is a [[weak homotopy equivalence]], in fact a [[deformation retract]]; a weak inverse is given by the morphism which in degree 0 is the degeneracy $s_0 : X_0 \to X_1$, and so on.

If $X$ is a [[Kan complex]], then

* the morphism $d_{last} : Dec_0 X \to X$ is a [[Kan fibration]];

=--

+-- {: .proof}
###### Proof

The first statement is classical, it appears for instance as ([Stevenson 11, lemma 5](#Stevenson11)).

For the second, notice that by remark \ref{InTermsOfCones} the lifting problem

$$
  \array{
    \Lambda^n[n] &\to& Dec_0 X
    \\
    \downarrow && \downarrow
    \\
    \Delta[n] &\to& X
  }
$$

is equivalent to the lifting problem

$$
  \array{
    (\Lambda^n[n] \star \Delta[0]) \coprod_{\Lambda^i[n]} \Delta[n] &\to& X
    \\
    \downarrow && \downarrow
    \\
    \Delta[n] \star \Delta[0] &\to& *
  }
  \,.
$$

Here the left morphism is an [[anodyne morphism]], in fact is an  $(n+1)$-[[horn]] inclusion $\Lambda[n+1] \to \Delta[n+1]$. So a lift exists if $X$ is a [[Kan complex]].

=--

+-- {: .num_remark}
###### Remark

By the above, $Dec_0 X$ is the [[disjoint union]] of [[over quasi-categories]]

$$
  Dec_0 X  = \coprod_{x \in X_0} X_{/x}
  \,.
$$

For each of these the statement that the projection $X_{/x} \to X$ is a [[Kan fibration]] if $X$ is a [[Kan complex]], and moreover that it is a a [[right fibration]] if $X$ is a [[quasi-category]], is ([Joyal, theorem 3.19](#Joyal)), reproduced also as ([[Higher Topos Theory|HTT, prop. 2.1.2.1]]). Notice that left/right fibrations into a Kan complex are automatically Kan fibrations (by the discussion at _[Left fibration in ∞-groupoids](right%2Fleft+Kan+fibration#AsFibrationsInInfinityGroupoids)_).

=--

+-- {: .num_cor}
###### Corollary

For $X$ a [[Kan complex]], the décalage morphism $Dec_0 X \to X$ is a [[Kan fibration]] [[resolution]] of the inclusion $const X_0 \to X$ of the set of 0-cells of $X$, regarded as a [[discrete object|discrete]] simplicial set:

there is a [[commuting diagram]]

$$
  \array{
    const X_0 &\stackrel{\simeq}{\to}& Dec_0 X
    \\
    \downarrow && \downarrow
    \\
    X &\to& X
  }
  \,,
$$

where

* the top morphism

  * is given in degree $n$ by the $n$-fold degeneracy map $s_0 \circ s_0 \circ \cdots s_0$;

  * is a [[weak homotopy equivalence]];

* the right vertical morphism

  * is given in degree $n$ by $d_{n+1} : X_{n+1} \to X_n$

  * is a [[Kan fibration]].

=--

+-- {: .num_remark}
###### Remark

The inclusion $const X_0 \to X$ presents a canonical [[effective epimorphism in an (∞,1)-category]] in [[∞Grpd]] into $X$, out of a [[0-truncated]] object. By the above, the décalage is a natural fibration resolution of this canonical "[[atlas]]".

This is useful for instance in the discussion of [[homotopy pullbacks]] of this effective epimorphism: by the discussion there the homotopy pullback of $const X_0 \to X$ along any morphism $f : A \to X$ is presented by the ordinary pullback of any Kan fibration resolution, hence in particular of the décalage projection:

$$
  f^* Dec_0 X \simeq A \times_X^{h} const X_0
  \,.
$$

=--

### Décalage comonad
 {#DecalageComonad}

Décalage also has an abstract [[category theory|category theoretic]] description as follows. The [[augmented simplex category]] with the ordinal sum operation is a [[monoidal category]] $(\Delta_a, + = \sigma, 0 = [-1])$. This monoidal category carries a canonical [[monoid]], namely the terminal object $1 = [0]$ with its unique monoid structure. By duality, the monoidal category $\Delta_a^{op}$ has a comonoid, also denoted $[0]$.

As is the case for any comonoid in a monoidal category, the comonoid $[0]$ induces a comonad $D_0 = (-) + [0] = \sigma(-, [0])$ on $\Delta_a^{op}$. And, as is the case for any $2$-functor, exponentiation $Set^{-}$ as a $2$-functor (say of the form $cat^{op} \to Cat$, from small categories to locally small categories) takes the comonad $D_0: \Delta_a^{op} \to \Delta_a^{op}$ in $cat^{op}$ to a comonad $Set^{D_0}: Set^{\Delta_a^{op}} \to Set^{\Delta_a^{op}}$ in $Cat$. This comonad, mapping $F: \Delta_a^{op} \to Set$ to $F \circ D_0: \Delta_a^{op} \to Set$, is precisely the décalage comonad $Dec_0: SSet \to SSet$.

(By similar reasoning, there is a second comonad $D^0 = [0] + (-) = \sigma([0], -)$ on $\Delta_a^{op}$, which in turn induces a second comonad $Set^{D^0}: Set^{\Delta_a^{op}} \to Set^{\Delta_a^{op}}$. This second décalage comonad is denoted by [Stevenson](#Stevenson11) as $Dec^0: SSet \to SSet$.)

There are tautologically equivalent formulations. One formulation invokes the fact that $\Delta_a$ together with the terminal monoid $[0]$ constitute the "[[walking structure|walking]] [[monoid]]", i.e., $\Delta_a$ is initial among monoidal categories equipped with a monoid. Similarly, $\Delta_a^{op}$ is the walking [[comonoid]]: by initiality, strict monoidal functors $\Delta_a^{op}\to [C, C]$ are precisely in correspondence with comonoids in the endofunctor category $[C, C]$ (as a monoidal category under endofunctor composition), that is to say, with comonads on $C$.

Consider then the monoidal product
$$ \sigma : \Delta_a^{op} \times \Delta_a^{op} \to \Delta_a^{op}$$
Analogous to Cayley embeddings of monoids into endofunction monoids, either way of currying this product produces a strict monoidal functor $\Delta_a^{op}\to [\Delta_a^{op},\Delta_a^op]$ into an endofunctor category. By applying 2-functoriality as above, there is additionally a strict monoidal functor

$$[\Delta_a^{op}, \Delta_a^{op}] \to [\mathbf{SSet},\mathbf{SSet}]$$

given by precomposition. Composing these two strict monoidal functors, there is a strict monoidal functor

$$\Delta_a^{op}\to [\mathbf{SSet}, \mathbf{SSet}].$$

Hence by the "walking" correspondence, the value of $[0]$ under this monoidal functor is a comonad on simplicial sets whose underlying functor is décalage:

$$
  Dec_0 \colon Set^{\Delta_a^{op}} \to Set^{\Delta_a^{op}}
$$

(Tautologically, though, this is merely an elaborate way to rephrase the earlier description of this comonad.)

The map $d_{last} \colon Dec_0 \to Id$ is the counit of the comonad. The comonad itself is analogous to a kind of unbased [[path space object]] comonad $P$ on $Top$ whose value at a space $X$ is a pullback

$$
  \array{
    P X & \to & X^I
    \\
    \downarrow & & \downarrow \mathrlap{eval_0}
    \\
    |X| & \stackrel{i}{\to} & X
  }
$$

where $i$ is the set-theoretic identity inclusion of $X$ equipped with the discrete topology. Thus we have

$$
  P X
  \;=\;
  \sum_{x_0 \in X} P(X, x_0),

$$

the sum over all possible basepoints $x_0$ of path spaces based at $x_0$. The analogy is made precise by a canonical isomorphism

$$
  Dec_0 \circ Sing
  \;\cong\;
  Sing \circ P
  \,,
$$

where $Sing \;\colon\; Top \to Set^{\Delta^{op}}$ is the [[singular simplicial complex]]-[[functor]].

A $P$-coalgebra partitions $X$ into path components and exhibits contractibility of each component. Similarly, a coalgebra of the décalage comonad exhibits the acyclicity of the underlying simplicial set.

####Total Décalage####

 Using either the simplicial [[comonadic resolution]] generated by the above comonad or directly using [[ordinal sum]], we get a [[bisimplicial set]] known as the [[total decalage|total décalage]] of $Y$. See there for more details.

## Examples

### For simplicial classifying spaces
 {#ExampleForSimplicialClassifyingSpaces}

A central application is the special case where $X = \overline{W} G$ is the [[simplicial classifying space]] of a [[simplicial group]] $G$ (see at _[[simplicial principal bundle]]_). In this case $Dec_0 \overline{W} G$, called $W G$, is a standard model for the _[universal simplicial principal bundle](simplicial%20principal%20bundle#UniversalSimplicialBundle)_.

Or rather, with the conventions used at *[[simplicial classifying spaces]]* (which are those of [Goerss & Jardine, p. 269](simplicial+classifying+space#GoerssJardine09)) we have $W G \,=\, Dec^0(\overline{W}G)$ (Def. \ref{DecalageInComponents}).

### For simplicial groups
 {#ExampleForSimplicialGroups}

The case of $Dec_0 G$ for $G$ a [[simplicial group]] is important in the simplicial theory of algebraic models for [[homotopy n-types]].

In this case the morphism $d_{last} : Dec_0\, G \to G$, is an [[epimorphism]].  Taking the [[kernel]] of this and then applying $\pi_0$, yields a [[crossed module]] constructed from the [[Moore complex]] of $G$

$$N G_1/d_2(NG_2)\to N G_0,$$

which has kernel $\pi_1(G)$ and cokernel $\pi_0(G)$. This crossed module represents the [[homotopy 2-type]] of $G$. Applying the décalage  twice  leads to a [[crossed square]] which represents the 3-type of $G$, ... and so on.

## Related concepts

* [[bar construction]]

* [[diagonal of a bisimplicial set]]

* [[simplicial classifying space]]

## References

Original sources are

* {#Illusie72} [[Luc Illusie]], _Complexe cotangent et déformations I_, volume 239 of Lecture Notes in Maths ,  Springer-Verlag. and  1972, _Complexe cotangent et déformations II_, volume 283 of Lecture Notes in Maths , Springer-Verlag (1971)

and

* [[John Duskin]], _Simplicial methods and the interpretation of "triple" cohomology_, number  163 in Mem. Amer. Math. Soc., 3, Amer. Math. Soc (1975)

The notion of décalage has been widely used since the paper introducing the method of [[cohomological descent]] in [[Hodge theory]]:

* [[Pierre Deligne]], _Théorie de Hodge. III_, Inst. Hautes Études Sci. Publ. Math. __44__ (1974), 5--77.

Reviews are in

* [[Phil Ehlers]], _Algebraic Homotopy in Simplicially Enriched Groupoids_, 1993,  University of Wales Bangor, (pdf [[Ehlers-thesis.pdf|here:file]])

A detailed account of various technical aspects:

* {#Stevenson11} [[Danny Stevenson]], around Lemma 15 of: *Décalage and Kan's simplicial loop group functor*, Theory and Applications of Categories, Vol. 26, 2012, No. 28, pp 768-787 ([arXiv:1112.0474](https://arxiv.org/abs/1112.0474), [tac:26-28](http://www.tac.mta.ca/tac/volumes/26/28/26-28abs.html))

and

* {#Stevenson12} [[Danny Stevenson]], Section 2.2 of _Classifying theory for simplicial parametrized groups_ ([arXiv:1203.2461](http://arxiv.org/abs/1203.2461))

Closely related technical results are in section 3 of

* {#Joyal}  [[André Joyal]], _The theory of quasi-categories and its applications_ , lectures at CRM Barcelona (2008)

The link with simplicial groups and algebraic models of homotopy $n$-types is given in

* [[Tim Porter]], _n-types of simplicial groups and crossed n-cubes_, Topology, 32, (1993), 5--24.

* [[Tim Porter]], _[[Menagerie|The crossed menagerie]]_

An application in the theory of [[stacks]]:

* [[Anders Kock]], _The stack quotient of a groupoid_, Cahiers de Topologie et Géométrie Différentielle Catégoriques, __44__ no. 2 (2003), p. 85--104 [numdam](http://www.numdam.org/item?id=CTGDC_2003__44_2_85_0)

On the [[adjunction unit]] of [[total décalage]]:

* [[Viktoriya Ozornova]], [[Martina Rovelli]], *The unit of the total décalage adjunction*, Journal of Homotopy and Related Structures **15** (2020) 333–349 [[doi.org/10.1007/s40062-020-00257-1](https://doi.org/10.1007/s40062-020-00257-1)]

[[!redirects decalage]]
[[!redirects décalage]]
[[!redirects décalage]]

[[!redirects total decalage]]
[[!redirects total décalage]]
[[!redirects total décalage]]


decategorification

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Categorification
+-- {: .hide}
[[!include categorification - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea
 {#Idea}

In [[category theory]], by "decategorification" one means (see [below](#Definition)) the process which turns a [[category]] into a [[set]], namely into its set of [[isomorphism classes]].

Typically one is interested in the case where the category is equipped with extra [[higher structure|higher]] [[structure]] (see [further below](#ExtraStructure)), whence its set of isomorphism classes will carry the corresponding ordinary [[structure]]. For example: the decategorification of a [[monoidal category]] is canonically a [[monoid]], the decategorification of a [[rig category]] is canonically a [[rig]], the decategorification of a [[2-group]] is canonically a plain [[group]], etc.

(Combined with [[group completion]], decategorification of [[monoidal categories]] is often known as a form of [[K-theory]] in degree 0, see for instance at *[[K-theory of a permutative category]]*.)

In this sense decategorification is a "[[left inverse]]" to ([[vertical categorification|vertical]]) "[[categorification]]" (see there for more), namely to the process of asking for [[category theory|category theoretic]] [[higher structures]] analogous to given  [[set theory|set theoretic]] [[structures]].

Crucially, though, decategorification is a systematic process (in fact a [[2-functor]], see [below](#Definition)) while [[categorification]], being a (local) [[section]] of this functor involves making choices: There are in general several categorical structures which have the same decategorification. For instance, the [[rig category|rig]] [[monoidal categories]] [[FinSet]] (with its [[cartesian product]]) and [[FinDimVect]] (with its [[tensor product of vector spaces]]) both decategorify to the [[rig]] [[monoid]] of [[natural numbers]] (see further examples [below](#Examples)).

More generally, in [[higher category theory]] there are higher sequences of "higher decategorification" functors which incrementally discard non-invertible [[higher morphisms]] and [[quotient]] by remaining invertible [[higher morphisms]] up to some degree (see [below](#DefinitionForHigherCategories)).

In particular, in the [[homotopy theory]] of [[groupoids]], [[higher groupoids]] and [[infinity-groupoid|$\infty$-groupoids]], namely in [[(infinity,0)-category|$(\infty,0)$-category]]-theory, decategorification is nothing but [[truncated object in an (infinity,1)-category|truncation]] and the tower of decategorifications/[[n-truncation|$n$-truncations]] is known as the *[[Postnikov tower]]*.

## Definitions
 {#Definition}

### For categories
 {#DefinitionForCategories}

Given an ([[essentially small category|essentially]] [[small category|small]]) [[category]] $\mathcal{C}$, its decategorification is the [[set]] $K(C)$ of [[isomorphism classes]] of [[objects]] of $\mathcal{C}$.

This construction extends to a [[2-functor]]

\[
  \label{PlainDecategorification}
  \begin{array}{rcl}
  \mathllap{K \;\colon\; }
   Cat &\longrightarrow& Set
   \\
   \mathcal{C} &\mapsto& Obj(\mathcal{C})_{/iso}
  \end{array}
\]

from the ([[2-category|2-]])[[category]]  [[Cat]] of ([[essentially small categories|essentially]] [[small category|small]]) [[categories]] to the category (or [[locally discrete 2-category]]) [[Set]] of [[sets]].

Notice that we may think of [[sets]] as [[0-categories]], so that (eq:PlainDecategorification) may equivalently be thought of as being of the form

$$
  K \colon 1Cat \longrightarrow 0Cat
  \,,
$$

which makes manifest that and how decategorification indeed *decreases categorical degree*.

For generalization of decategorification to [[higher category theory]] ([below](#DefinitionForHigherCategories)) it is useful to make explicit that the decategorification 2-functor (eq:PlainDecategorification) factors as

\[
  \label{PlainDecategorificationFactoredThroughCore}
  K
  \,\colon\,
  Cat
    \overset{Core}{\longrightarrow}
  Grpd
    \overset{\tau_0}{\longrightarrow}
  Set
  \,,
\]

where

1. $Core$ assigns the "[[core]]" of a category, namely the maximal [[groupoid]] inside it, hence $Core$ "discards" all non-invertible morphisms;

2. $\tau_0$ is the [[0-truncation]] functor which turns a [[1-groupoid]] into its [[0-groupoid]] of [[connected components]].

It may be interesting to notice here that:

* [[core|Core]] is *[[right adjoint]]* to the [[fully faithful 2-functor|embedding]] $Grpd \hookrightarrow Cat$, hence is a [[coreflective subcategory|co-reflection]],

* [[0-truncation|$\tau_0$]] is *[[left adjoint]]* to the [[fully faithful functor|embedding]] $Set \hookrightarrow Grpd$, hence is a [[reflective subcategory|reflection]].

### For higher categories
 {#DefinitionForHigherCategories}

For any sensible notion of [[higher categories]] one will have corresponding analogs of the [[core]]- and the [[truncation]]-operations used in (eq:PlainDecategorificationFactoredThroughCore), which allows to define decategorification of higher categories.

For example, for [[2-categories]] there are the evident notions of *[[core in a 2-category]]*.

More generally, for any of the models of [[(infinity,n)-categories|$(\infty,n)$-categories]] we have a [[coreflection]]

$$
  (\infty,n) Cat
    \underoverset
      {\underset{Core_n}{\longleftarrow}}
      {\hookrightarrow}
      {\;\; \bot \;\;}
  (\infty,n+1)Cat
$$

which together with the [[truncated object in an (infinity,1)-category|$m$-truncation]]-operation to [[homotopy n-types|homotopy $m$-types]] yields towers of higher decategorification functors

$$
  (\infty,n+1)Cat
  \overset{Core_n}{\longrightarrow}
  (\infty,n)Cat
  \to
  \cdots
  \to
  (\infty,0)Cat
  \;\simeq\;
  \infty Grpd
  \overset{ \tau_m }{\longrightarrow}
  m Grpd
  \to
  \cdots
  \to
  0 Grpd
  \;\simeq\;
  Set
  \,,
$$

any stage of which may reasonably be addressed as an intermediate stage of higher decategorification.

## Extra structure
 {#ExtraStructure}

If the category in question has [[extra structure|extra]] [[higher structure|higher]] [[structure]], then this is usually inherited in some decategorified form by its decategorification. For instance if $C$ is a [[monoidal category]] then $K(C)$ is a [[monoid]].

A famous example are [[fusion category|fusion categories]] whose decategorifications are called _[[Verlinde ring]]s_.

There may also be extra structure induced more directly on $K(C)$. For instance the [[K-theory|K-group]] of an [[abelian category]] is the decategorification of its category of bounded [[chain complexes]] and this inherits a group structure from the fact that this is a [[triangulated category]] (a [[stable (∞,1)-category]]) in which there is a notion of [[fibration sequence|homotopy exact sequences]].

## Examples
 {#Examples}

* The decategorifications of [[finite sets]] and [[finite dimensional vector spaces]] (over any [[ground field]]) are [[natural numbers]]

  $$
    FinSet_{/\sim} \simeq \mathbb{N}
  $$

  $$
    FinDimVect_{/\sim} \simeq \mathbb{N}
  $$

  For instance the [[rank-nullity theorem]] is the decategorification of the [[splitting lemma]] in the category [[FinDimVect]].

* The decategorification of the 2-category [[Grpd]] of (small) [[groupoids]] is equivalent to the [[homotopy category]] of [[homotopy 1-types]].

* The decategorification in the same sense of the 2-category of ([[small category|small]]) [[categories]] is equivalent to the full [[homotopy category of topological spaces|homotopy category]]. (explain...)

## Parable ##
From John Baez, https://math.ucr.edu/home/baez/week121.html

 If one studies categorification one soon discovers an amazing fact: many deep-sounding results in mathematics are just categorifications of facts we learned in high school! There is a good reason for this. All along, we have been unwittingly "decategorifying" mathematics by pretending that categories are just sets. We "decategorify" a category by forgetting about the morphisms and pretending that isomorphic objects are equal. We are left with a mere set: the set of isomorphism classes of objects.

To understand this, the following parable may be useful. Long ago, when shepherds wanted to see if two herds of sheep were isomorphic, they would look for an explicit isomorphism. In other words, they would line up both herds and try to match each sheep in one herd with a sheep in the other. But one day, along came a shepherd who invented decategorification. She realized one could take each herd and "count" it, setting up an isomorphism between it and some set of "numbers", which were nonsense words like "one, two, three,..." specially designed for this purpose. By comparing the resulting numbers, she could show that two herds were isomorphic without explicitly establishing an isomorphism! In short, by decategorifying the category of finite sets, the set of natural numbers was invented.

According to this parable, decategorification started out as a stroke of mathematical genius. Only later did it become a matter of dumb habit, which we are now struggling to overcome by means of categorification. While the historical reality is far more complicated, categorification really has led to tremendous progress in mathematics during the 20th century. For example, Noether revolutionized algebraic topology by emphasizing the importance of homology groups. Previous work had focused on Betti numbers, which are just the dimensions of the rational homology groups. As with taking the cardinality of a set, taking the dimension of a vector space is a process of decategorification, since two vector spaces are isomorphic if and only if they have the same dimension. Noether noted that if we work with homology groups rather than Betti numbers, we can solve more problems, because we obtain invariants not only of spaces, but also of maps.

[[!redirects decategorifications]]

[[!redirects decategorification]]
[[!redirects decategorified]]
[[!redirects decategorifies]]
[[!redirects decategorify]]
[[!redirects decategorifying]]

[[!redirects de-categorification]]
[[!redirects de-categorifications]]

[[!redirects de-categorified]]
[[!redirects de-categorifies]]
[[!redirects de-categorify]]
[[!redirects de-categorifying]]


decidability

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

In [[logic]], _decidable_ refers to the question of whether there is an effective method for deciding membership in a set of formulas (or [[judgment]]s in [[type theory]]). Here we take an effective method to be given by any of the equivalent formal characterizations ([[general recursion]], [[Turing machine]]s, [[lambda calculus]]) that according to the [[Church-Turing thesis]] capture the informal notion.

Sometimes _decidable_ is also used in another sense, namely that of [[independent statement]], according to which a logical theory decides a formula if it proves the formula or its [[negation]] (see at _[[decidable proposition]]_), and according to which a formula is undecidable (independent) if the theory in question proves neither the formula nor its negation. This is the sense in which the [[continuum hypothesis]] is undecidable from the axioms of [[ZFC]] and in which the [[consistency statement]] of a sufficiently strong, recursively enumerated theory is undecidable in (independent of) that theory, according to Gödel's [[second incompleteness theorem]]. To avoid confusion, the preferred term to use here is [[independent]].

## Decidability of a logical system

A logical system is decidable if there is an algorithm deciding whether a given formula is a theorem of the system.

In this sense, [[propositional logic]] and [[monadic predicate logic]] are decidable, whereas [[first-order logic]] and [[higher-order logic]] are undecidable

## Decidability of a theory

A [[theory]] is a set of formulas closed under logical consequence (in some logical system, usually first order logic with a given [[signature]]). A theory is decidable if there is an algorithm (effective method) deciding whether a formula is a member of the theory of not. In the usual case where the theory is presented from a list of [[axiom]]s, the question is whether the formula is deducible from the axioms.

Examples of decidable theories include:

* [[Presburger arithmetic]]

* the first-order theory of [[Boolean algebra]]s

* the first-order theory of [[real closed field]]s

* the monadic second-order theory of the binary tree

Examples of undecidable theories include:

* [[Peano arithmetic]] (considered as either a first-order or a second-order theory)
* the first-order theory of [[groups]]

## In the context of type theory
 {#InTheContextOfTypeTheory}

[[type theory|Type theory]] gives rise a number of decision problems, and it is generally desirable that these are solvable.

### Type checking

In [[type theory]], [[type checking|Type checking]] refers to the problem whether the [[judgment]] $\Gamma\vdash a \colon A$ is derivable in a given type theory.

For instance, [[intensional type theory]] has [[decidability|decidable]] type checking, but [[extensional type theory]], which adds the rule of [[equality reflection]], does not. For an exposition of this result, see [Hofmann 1995](#Hofmann95).

In more expressive type theories, we can also ask whether [[judgmental equality]] (also called _computational_ or _definitional_ equality) is decidable. Since deciding the judgmental equality is often a prerequisite for deciding type checking, systems with decidable type checking often have decidable judgmental equality.

### Typability

[[Typeability]] refers to the problem of deciding for a given term whether it inhabits some type. [[simple type theory|Simple type theory]] has decidable typeability, and the programming language [[ML]], which features a weak form of polymorphism, [[let polymorphism]], also has decidable typeability.

[[dependent type theory]] has undecidable typeability.

### Type inhabitation

[[Type inhabitation]] refers to the problem of deciding for a given type whether there is a term that inhabits it. Under the propositions-as-types correspondence, this incorporates the question of the decidability of the corresponding logic since a proposition is provable if and only if the the type of its proofs is inhabited.

For [[simple type theory]], type inhabitation is  decidable, whereas it is undecidable for [[dependent type theory]].

## Related concepts

* **decidability**

  * [[decidable subset]]

  * [[decidable object]]

  * [[decidable equality]]

  * [[decidable proposition]]

* [[definability]]

* [[quantifier elimination]]

## References

* Wikipedia, _[Decidablility (logic)](http://en.wikipedia.org/wiki/Decidability_%28logic%29)_

* {#Hofmann95} [[Martin Hofmann]], _Extensional concepts in intensional type theory_, Ph.D. dissertation, University of Edinburgh (1995). ([link](http://www.lfcs.inf.ed.ac.uk/reports/95/ECS-LFCS-95-327/))

[[!redirects decidable]]


decidable choice

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Foundations
+-- {: .hide}
[[!include foundations - contents]]
=--
=--
=--

\tableofcontents

## Idea

In [[constructive mathematics]], the axiom of **decidable choice** ought to be a weak form of the [[axiom of choice]] which states that every [[set]] with [[decidable equality]] is a [[projective object]] in [[Set]].

Decidable choice implies [[countable choice]] because the [[natural numbers]] have decidable equality. Conversely, in the context of [[excluded middle]], decidable choice is the same as the full [[axiom of choice]], because every set has [[decidable equality]] in the context of excluded middle.

## See also

* [[axiom of choice]]
* [[countable choice]]

[[!redirects decidable choice]]
[[!redirects axiom of decidable choice]]


decidable equality

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Equality and Equivalence
+--{: .hide}
[[!include equality and equivalence - contents]]
=--
#### Foundations
+-- {: .hide}
[[!include foundations - contents]]
=--
=--
=--

# Contents
* table of contents
{: toc}

## Definitions

In [[constructive mathematics]], a [[set]] $X$ has __decidable equality__ if any two elements of $X$ are either [[equality|equal]] or [[negation|not]] equal.  Equivalently, $X$ has decidable equality if its [[equality]] [[relation]] is a [[decidable subset]] of $X \times X$.  Sometimes one says that such a set $X$ is _discrete_, although of course this term has many meanings.  Of course, in [[classical mathematics]], every set has decidable equality.  But the concept generalises in [[sheaf and topos theory|topos theory]] to the notion of [[decidable object]].

## Examples

* Every [[finite set]] has decidable equality (though the same is not true for finitely-indexed or subfinite sets).

* The [[natural numbers]] have decidable equality.

+--{: .un_remark}
###### Remark
In fact, these examples come close to to exhausting the sets than can be *proven* to have decidable equality in intuitionistic logic; by [BauerSwan18](#BauerSwan18) there is a [[topos]] (the [[function realizability]] topos, which moreover satisfies [[countable choice]], [[Markov's principle]], and other axioms) [[internal logic|in which]] all sets with decidable equality are [[countable set|countable]] (admit a surjection from a [[decidable subset]] of $\mathbb{N}$).  More precisely, although the statement "all sets with decidable equality are countable" is not true [[stack semantics|in]] that topos, every global object with decidable equality in that topos is countable.
=--

## Applications
 {#Applications}

Working with decidable subsets of sets with decidable equality makes [[constructive mathematics]] very much like [[classical mathematics]].  This is why constructivism has few consequences for basic [[combinatorics]] and [[algebra]] (although it does have important consequences for more advanced topics in those fields).  In [[analysis]], in contrast, [[constructivism]] matters right away, because constructively the set of [[real numbers]] may not have decidable equality.

## In type theory

In [[type theory|type-theoretic]] foundations, there are two different notions of decidable equality, depending on whether "or" is interpreted using [[sum types]] $\prod_{x,y\colon A} (x=y) + \neg (x=y)$ or [[disjunctions]] $\prod_{x,y\colon A} (x=y) \vee \neg (x=y)$, i.e. the [[bracket type]] of [[sum types]]. The former notion of decidable equality is called **untruncated decidable equality**, while the latter notion is called **truncated decidable equality**. Since every type maps to its bracket, untruncated decidable equality implies truncated decidable equality.

On the other hand, if truncated decidable equality holds and $A$ is an [[h-set]], i.e. it satisfies [[uniqueness of identity proofs]], then $(x=y)$ and $\neg (x=y)$ represent disjoint subobjects of $A\times A$.  Thus $(x=y) + \neg (x=y)$ is already a subobject of $A\times A$, so it is equivalent to its bracket, and untruncated decidable equality also holds.

The converse of this is also true: if untruncated decidable equality holds, then not only does truncated decidable equality also hold, but in fact $A$ is an h-set. This was first proven by Michael Hedberg; a proof can be found at [[Hedberg's theorem]] and in the references below. This fact is useful in [[homotopy type theory]] to show that many familiar types, such as the [[natural numbers]], are h-sets.

For non-h-sets, the difference between untruncated decidable equality and truncated decidable equality can be dramatic. For instance, if we model homotopy type theory in a [[Boolean topos|Boolean]] $(\infty,1)$-topos (such as $\infty Gpd$ constructed classically), then *every* type satisfies truncated decidable equality (which is what it means for the logic to be boolean), but only the h-sets satisfy untruncated decidable equality (in accordance with Hedberg\'s theorem).

### Using the boolean domain

There is also a few definitions of decidable equality in [[dependent type theory]], which rely on the [[boolean domain]] with its extensionality principle and the fact that that the decidable equality is always valued in the [[boolean domain]].

The first definition states that decidable equality on a type $A$ is a [[binary function]] $\mathrm{Eq}_A:A \times A \to \mathrm{Bit}$ which comes with a family of equivalences
$$x:A, y:A \vdash \delta(x, y):\mathrm{Id}_A(x, y) \simeq \mathrm{Id}_\mathbb{2}(\mathrm{Eq}_A(x, y), 1)$$

The second also relies on the fact that the [[boolean domain]] forms a [[univalent Tarski universe]] $(\mathrm{Bit}, \mathrm{El}_\mathrm{Bit})$. Here, decidable equality on a type $A$ is a [[binary function]] $\mathrm{Eq}_A:A \times A \to \mathrm{Bit}$ which comes with a family of equivalences
$$x:A, y:A \vdash \delta(x, y):\mathrm{El}_\mathrm{Bit}(\mathrm{Eq}_A(x, y)) \simeq (x =_A y)$$

Either way, this is typically how the [[natural numbers type]] is proven to have decidable equality, by defining a binary function into the boolean domain called [[observational equality]] and using the extensionality principle of the natural numbers.

### Properties

Every set with decidable equality is [[locally finite type|locally finite]].

## Related concepts

* [[decidability]]
* [[stable equality]]
* [[locally finite type]]

## References

* Michael Hedberg, *A coherence theorem for Martin-Löf's type theory*, J. Functional Programming, 1998

* Nicolai Kraus, *A direct proof of Hedberg's theorem*, [blog post](http://homotopytypetheory.org/2012/03/30/a-direct-proof-of-hedbergs-theorem/)

* {#BauerSwan18} [[Andrej Bauer]] and [[Andrew Swan]], *Every metric space is separable in function realizability*, 2018, [arxiv](https://arxiv.org/abs/1804.00427)

[[!redirects decidable set]]
[[!redirects decidable sets]]

[[!redirects decidable equality]]
[[!redirects truncated decidable equality]]
[[!redirects untruncated decidable equality]]


decidable function

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
=--
=--

\tableofcontents

## Definition

In [[dependent type theory]], a type $A$ is [[decidable]] if it comes with an element of type
$$\mathrm{isDecidable}(A) \coloneqq A + \neg A$$
where $\neg A \coloneqq A \to \emptyset$.
A [[function]] $f:A \to B$ is **decidable** if for all elements $b:B$ the [[fiber type|fiber]] of $f$ at $b$ is decidable
$$\mathrm{isDecidable}(f) \coloneqq \prod_{b:B} \mathrm{isDecidable}(\mathrm{fiber}(f, b))$$

The type of all decidable functions is represented as $A \to_d B$ and is defined as

$$A \to_d B \coloneqq \sum_{f:A \to B} \mathrm{isDecidable}(f)$$

## See also

* [[function]]

## References

Decidable maps are defined in proposition 17.6.1 of:

* {#Rijke22} [[Egbert Rijke]], *[[Introduction to Homotopy Type Theory]]*, Cambridge Studies in Advanced Mathematics, Cambridge University Press (2023) [[arXiv:2212.11082](https://arxiv.org/abs/2212.11082)[

[[!redirects decidable function]]
[[!redirects decidable functions]]
[[!redirects decidable map]]
[[!redirects decidable maps]]

[[!redirects decidable function type]]
[[!redirects decidable function types]]
[[!redirects type of decidable functions]]
[[!redirects types of decidable functions]]


decidable injection

\tableofcontents

## Idea

In [[classical mathematics]], a *[[subsingleton]]* could either be defined as

* a set $S$ such that for all elements $a \in S$ and $b \in S$, $a = b$

* a set $S$ which is either [[empty set|empty]] or a [[singleton]].

However, in [[constructive mathematics]], the two notions of subsingleton above are no longer the same, because the [[axiom of excluded middle]] no longer holds true. Instead, one usually defines a subsingleton as the first definition, and the second definition is then referred to as about *[[decidable subsingletons]]*.

Similarly, in [[classical mathematics]], an *[[injection]]* between two sets $A$ and $B$ is then a function $f:A \to B$ such that for all elements $b \in B$, the [[preimage]] or [[fiber]] of $f$ at $b$ is a subsingleton. However, in [[constructive mathematics]], there are two notions of [[injections]], resulting from the two notions of subsingletons:

* An [[injection]] between two sets $A$ and $B$ is a function $f:A \to B$ such that for all elements $b \in B$, the [[preimage]] or [[fiber]] of $f$ at $b$ is a [[subsingleton]].

* A **decidable injection** between two sets $A$ and $B$ is a function $f:A \to B$ such that for all elements $b \in B$, the [[preimage]] or [[fiber]] of $f$ at $b$ is a [[decidable subsingleton]]; i.e. either [[empty set|empty]] or a [[singleton]].

## Set of decidable injections

Suppose the [[set theory]] has [[function sets]] $B^A$. Then one could define the set of decidable injections from $A$ to $B$ as the set

$$\mathrm{Inj}_d(A, B) \coloneqq \{f \in B^A \vert \forall b \in B.(\exists!a \in A.a \in f^*(b)) \vee (\neg \exists a \in A.a \in f^*(b))\}$$

where $f^*(b)$ is the [[preimage]] or [[fiber]] of $f$ at $b$.

## Related concepts

* [[decidable subset]]
* [[decidable subsingleton]]
* [[injection]]
* [[binomial set]]

[[!redirects decidable injection]]
[[!redirects decidable injections]]

[[!redirects set of decidable injection]]
[[!redirects set of decidable injections]]


decidable judgment

A [[judgement]] that is [[decidable proposition|decidable]].

[[!redirects decidable judgement]]


decidable object

[[!redirects decidable objects]]
[[!redirects separable object]]
[[!redirects separable objects]]

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Category theory
+-- {: .hide}
[[!include category theory - contents]]
=--
#### Constructivism, Realizability, Computability
+-- {: .hide}
[[!include constructivism - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

##Idea

The concept of _decidable object_ is the generalization to [[category theory]] of the concept of a [[decidable set]] from [[computability theory]].

This corresponds to the algebraic and topological concepts _[[unramified morphism|unramified]]_, respectively _[[separable topological space|separable]]_ object, as pointed out by [[William Lawvere]].

## Definition

An [[object]] $X$ of a [[coherent category]] $\mathcal{C}$ is called _decidable_ if its [[equality relation]] (i.e. its [[diagonal morphism]])

$$
  \Delta_X
  \;\colon\;
  X
    \longrightarrow
  X \times X
$$

is [[complemented subobject|complemented]], as a [[subobject]] of the [[Cartesian product]] $X \times X$.

A [[morphism]] $f \colon A \to B$ is called _decidable_ if it is a decidable object in the [[slice category]] $\mathcal{C}/B$.

## Remarks

* For an object $X$ this means that in the [[internal logic]] of the category, it is true that "for any $x,y\in X$ , either $x=y$ or $x\neq y$".

* In [[constructive mathematics]], where [[Set]] is not assumed Boolean, one says that a set $X$ has _[[decidable equality]]_ if it is a decidable object of $\Set$.

* A _decidable subobject_ simply means a [[complemented subobject]].  Again, in constructive mathematics, a decidable subobject in $\Set$ is called a _[[decidable subset]]_.

* An object $X$ in a topos $\mathcal{E}$ is called _anti-decidable_ if $\neg\neg (x=y)$ in the internal language of $\mathcal{E}$ holds for all $x,y\in X$. A formula $\varphi$ is called _almost decidable_ iff $\neg\varphi\vee\neg\neg\varphi$ holds and an object $X$ is called _almost decidable_ if $x=y$ is almost decidable for $x\in X$.

## Examples

* An [[initial object]] and [[terminal object]] are always decidable, and so is every [[natural numbers object]] $N$ in a topos

* A [[subobject]] of a decidable object is decidable.

* Decidable [[morphisms]] $f:A\to B$ in the [[opposite category|opposite]] of the [[category of commutative rings]] $CommRing^{op}$ are precisely the [[separable algebra|separable]] $B$-algebras $A$.

* Of course, in a [[Boolean category]], every object is decidable. Conversely in a [[topos]] $\mathcal{E}$, or more generally a coherent category with a [[subobject classifier]], every object is decidable precisely if $\mathcal{E}$ is Boolean.

## Properties

The category of decidable objects in an [[topos]] is a [[Boolean pretopos]]. The category of decidable objects in a topos is only a [[topos]] when the original topos itself is a [[Boolean topos]].

## Related concepts

* [[theory of decidable objects]]

* [[locally decidable topos]]

* [[finite object]]

* [[separable algebra]]

## References

* B. P. Chisala, M.-M. Mawanda, _Counting Measure for Kuratowski Finite Parts and Decidability_ , Cah.Top.Géom.Diff.Cat. **XXXII** 4 (1991) pp.345-353. ([pdf](archive.numdam.org/article/CTGDC_1991__32_4_345_0.pdf))

* [[Aurelio Carboni|A. Carboni]], [[G. Janelidze]], _Decidable (=separable) objects and morphisms in lextensive categories_ , JPAA **110** (1996) pp.219-240.

* [[Peter Johnstone]], _Sketches of an Elephant_ vols. I,II, Oxford UP 2002.


decidable proposition

# Decidable propositions
* table of contents
{: toc}

## Idea

A [[proposition]] is decidable if we know whether it is [[true]] or [[false]].  This has (at least) two interpretations, which we will call 'internal' and 'external' (however, these adjectives are rarely used and must be guessed from the context).

* [External decidability](#ExternalDecidability): either $p$ or $\not p$ may be [[deduction|deduced]] in the theory.  This is a statement in the [[metalanguage]].

* [Internal decidability](#InternalDecidability): $p \vee \not p$ may be deduced in the theory; in other words "$p$ or not $p$" holds in the [[object language]].

## Externally decidable propositions in logic
 {#ExternalDecidability}

In [[logic]], a [[proposition]] $p$ in a given [[theory]] (or in a given [[context]] of a given theory) is __externally decidable__ if there is in that theory (or in that context) a [[proof]] of $p$ or a refutation of $p$ (a proof of the [[negation]] $\neg{p}$).  Of course, this only makes sense if the logic of the theory includes an operation of [[negation]].

Any statement that can be proved or refuted is decidable, and one might hope for a consistent [[foundation of mathematics]] in which every statement is decidable.  However, Gödel\'s [[incompleteness theorem]] dashes these hopes; any [[consistent theory]] strong enough to model [[arithmetic]] (actually a rather weak form of arithmetic) must contain undecidable statements.

For example, the [[continuum hypothesis]] is undecidable in [[ZFC]], assuming that $ZFC$ is consistent at all.

## Internally decidable propositions in constructive mathematics
 {#InternalDecidability}

In [[constructive mathematics]], a [[proposition]] $p$ is __internally decidable__ if the [[law of excluded middle]] applies to $p$; that is, if $p \vee \neg{p}$ holds.  Of course, in [[classical mathematics]], every statement is decidable in this sense.  Even in constructive mathematics, some statements are decidable and no statement is undecidable; that is, $\neg{(p \vee \neg{p})}$ is always false, but this is not enough to guarantee that $p \vee \neg{p}$ is true.

For example, consider the [[Riemann hypothesis]] (or any of the many unsolved $\Pi_1$-[[Pi-1-proposition|propositions]] in [[number theory]]).  This may be expressed as $\forall x, P(x)$ for $P$ some [[predicate]] on [[natural numbers]].  For each $x$, the statement $P(x)$ is decidable (that is, $\forall x, P(x) \vee \neg{P(x)}$ holds), and indeed one can in principle work out which with pencil and paper.  However, the Riemann hypothesis itself has not yet been proved (constructively) to be decidable.

A [[set]] $A$ has __[[decidable equality]]__ if every [[equality|equation]] between elements of $A$ (every proposition $x = y$ for $x, y$ in $A$) is decidable.  A [[subset]] $B$ of a set $C$ is a __[[decidable subset]]__ if every statement of membership in $B$ (every proposition $x \in B$ for $x$ in $A$) is decidable.

## Relation between these

In many foundations of constructive mathematics, the [[disjunction property]] holds (in the global context).  That is, if $p \vee q$ can be proved, then either $p$ can be proved or $q$ can be proved.  By Gödel\'s incompleteness theorem, no consistent foundation of classical arithmetic can have this property, but some consistent foundations of intuitionistic arithmetic (such as [[Heyting arithmetic]]) do.

In any consistent logic with the disjunction property, a proposition is externally decidable if and only if it can be proved to be internally decidable.  (Note that the claim that $p$ is externally decidable is a statement in the metalanguage, while the claim that $p$ is internally decidable is a statement in the object language.)

## Categorial interpretation

The [[internal logic]] of any [[Heyting category]] $C$ is a [[type theory]] in [[first-order logic|first-order]] [[intuitionistic logic]]; conversely, any such theory $T$ has a [[category of contexts]] which is a Heyting category.

Under this correspondence, the [[contexts]] of $T$ correspond to the [[objects]] of $C$, and the [[propositions]] in a given context correspond to the [[subobjects]] of that object.  Then a proposition in a context $X$ is externally decidable if and only if it is, as a subobject of $X$, either $X$ itself (corresponding to being provable) or the [[initial object]] (corresponding to being refutable).  And a proposition in the context $X$ is internally decidable if and only if, when thought of as a subobject $A$ of $X$, the [[union]] of $A$ and $\neg{A}$ is $X$.

The [[slice category]] $C/X$ is [[two-valued category|two-valued]] if and only if the context $X$ is consistent and every proposition in that context is externally decidable.  $C$ is a [[Boolean category]] if and only if every proposition in every context is internally decidable.
+-- {: .query}
This makes me think that we should define $p$ to be externally decidable iff $p$ is provable whenever it is not refutable, which in a constructive metalogic is weaker than the definition above.  But then we lose the relationship with the disjunction property.  I guess that we need intuitionistic, classical, and paraconsistent forms of external decidability, just as for two-valuedness.
=--

## In dependent type theory

In [[dependent type theory]], a decidable proposition is a [[mere proposition]] $P$ which comes with an element $\mathrm{lem}_P:P \vee \neg P$, where $A \vee B \coloneqq [A + B]$ is the [[disjunction]] of two types $A$ and $B$, $\neg A \coloneqq A \to \emptyset$ is the [[negation]] of type $A$, $A + B$ is the [[sum type]] of types $A$ and $B$, and $[A]$ is the [[propositional truncation]] of type $A$.

$$\mathrm{isDecidable}(P) \coloneqq \mathrm{isProp}(P) \times (P \vee \neg P)$$

## Related concepts

* [[type of decidable propositions]]
* [[decidable subsingleton]]
* [[semi-decidable proposition]]

[[!redirects decidable proposition]]
[[!redirects decidable propositions]]

[[!redirects undecidable proposition]]
[[!redirects undecidable propositions]]


decidable relation

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Relations
+-- {: .hide}
[[!include relations - contents]]
=--
#### Constructivism, Realizability, Computability
+-- {: .hide}
[[!include constructivism - contents]]
=--
=--
=--

\tableofcontents

## Idea

A relation in which either it or its negation is true.

## Definition

A decidable [[binary relation]] $R$ on a set $S$ is a relation such that for all elements $a \in S$ and $b \in S$, $R(a, b)$ or $\neg R(a, b)$.

## Examples

* Every set with [[decidable equality]] has a decidable equality relation.

* In the presence of [[excluded middle]], every relation is a decidable relation.

## See also

* [[decidable equality]]

* [[stable relation]]


decidable subset

\tableofcontents

## Idea

In [[constructive mathematics]], a [[subset]] $A$ of a set $X$ is called __decidable__ if it is classified by a function from $X$ to the [[Boolean domain]] $\mathbf{2} = \{\bot, \top\}$ of classical [[truth value]]s.  Of course, in [[classical mathematics]], $\mathbf{2}$ is the set of *all* truth values, so there every subset is decidable. (A decidable subset is alternatively called a __detachable__ subset, at least in [[Fred Richman]]'s school.)

Equivalently, $A$ is a decidable subset of $X$ if every element of $X$ either does or does not belong to $A$.

A set $X$ has [[decidable equality]] if the [[equality relation]] is decidable as a subset of $X \times X$.  This generalises in topos theory to the notion of [[decidable object]].

Working with decidable subsets of sets with decidable equality makes constructive mathematics very much like classical mathematics.  This is why constructivism has few consequences for basic combinatorics and algebra (although it does have important consequences for more advanced topics in those fields).  In analysis, in contrast, constructivism matters right away, because the set of [[real numbers]] may have very few decidable subsets.  (For example, in [[intuitionistic mathematics]], [[Russian constructivism]], and the [[topos of sheaves over the real line]], albeit for different reasons in each case, every function from $\mathbb{R}$ to $\mathbf{2}$ must be at least pointwise-[[continuous map|continuous]] and thus [[constant function|constant]], and therefore there are exactly two decidable subsets of $\mathbb{R}$: the [[empty subset]] and $\mathbb{R}$ [[improper subset|itself]].)

## Related concepts

* [[decidable equality]]
* [[subset]]
* [[decidable subsingleton]]
* [[decidable injection]]
* [[decidable subobject]]

[[!redirects decidable subset]]
[[!redirects decidable subsets]]
[[!redirects detachable subset]]
[[!redirects detachable subsets]]
[[!redirects detachable set]]
[[!redirects detachable sets]]


decidable subsingleton

\tableofcontents

## Idea

In [[classical mathematics]], a *[[subsingleton]]* could either be defined as

* a [[set]] $S$ such that for all [[elements]] $a \in S$ and $b \in S$, $a = b$

* a set $S$ which is either [[empty set|empty]] or a [[singleton]].

However, in [[constructive mathematics]], the two notions of subsingleton are no longer the same, because the [[axiom of excluded middle]] no longer holds true. Instead, one usually defines a subsingleton as the first definition, and the second definition is then referred to as about **decidable subsingletons**.

Every subsingleton $S$ comes with an [[injection]] $i \colon S \to 1$ into a [[singleton]] $1$, and is thus is a (structural) [[subset]] of $1$. A subsingleton is also decidable in the subset sense: defining the relation $x \in_1 S$ as
$$x \in_1 S \coloneqq \exists y \in 1.i(x) = y$$
for all elements $x \in 1$, $x \in_1 S$ or $\neg (x \in_1 S)$.

Decidable subsingletons could be generalized from [[Set]] to any [[coherent category]]: they are precisely the [[decidable object|decidable]] [[subterminal objects]] in a coherent category.

## Related concepts

* [[decidable proposition]]
* [[decidable subset]]
* [[decidable injection]]
* [[subsingleton]]

[[!redirects decidable subsingleton]]
[[!redirects decidable subsingletons]]


decimal interval coalgebra

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Algebra
+-- {: .hide}
[[!include higher algebra - contents]]
=--
=--
=--

# Contents
* table of contents
{: toc}

## Definition ##

A **decimal interval coalgebra** is a [[set]] $I$ with a [[linear order]] $\lt$, elements $0 \in I$, $1 \in I$, and a [[partial function]] from $\mathbb{N}$ to the set of [[endofunctions]] in $I$, $I \to I$

$$z:\{m \in \mathbb{N} \vert (m \lt 10)\} \to (I \to I)$$

such that

* for all elements $a \in I$, $0 \lt a$ or $a \lt 1$

* for all natural numbers $m \in \mathbb{N}$, if $m \lt 10$, then $z(m)(0) = 0$

* for all natural numbers $m \in \mathbb{N}$, if $m \lt 10$, then $z(m)(1) = 1$

* for all natural numbers $m \in \mathbb{N}$, if $m + 1 \lt 10$, then for all elements $a \in I$, it is not true that both $0 \lt z(m+1)(a)$ and $z(m)(a) \lt 1$

## Examples ##

* The initial decimal interval coalgebra is the [[unit interval]] on the [[decimal rational numbers]]

* The terminal decimal interval coalgebra is the [[unit interval]] on the [[Dedekind real numbers]]

## See also ##

* [[decimal rational numbers]]
* [[dyadic interval coalgebra]]
* [[rational interval coalgebra]]
* [[unit interval]]
* [[coalgebra]]


decimal number

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Arithmetic
+--{: .hide}
[[!include arithmetic geometry - contents]]
=--
#### Algebra
+--{: .hide}
[[!include higher algebra - contents]]
=--
#### Category theory
+--{: .hide}
[[!include category theory - contents]]
=--
#### Homological algebra
+--{: .hide}
[[!include homological algebra - contents]]
=--
#### Constructivism, Realizability, Computability
+-- {: .hide}
[[!include constructivism - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

Talk about the decimal number system for integers and decimal fractions, and then infinite sequences of decimals as a [[terminal coalgebra for an endofunctor]].

## Natural numbers

### As a free monoid

Define a set of digits $D$, and the [[free monoid]] $D^*$ on $D$ with unit $\epsilon$, quotiented by an equivalence relation. Then define a function $s$ on $D^*$ such that $D^*,\epsilon,s$ is a [[natural numbers object]].

### Long division algorithm

Let $[0, 9]^*$ be the [[free monoid]] on the [[closed interval]] $[0, 9]$, which represents the list of digits in the decimal numeral representation of the natural numbers, with length function $\mathrm{len}:[0, 9]^* \to \mathbb{N}$. There is a [[surjection]] $f:[0, 9]^* \to \mathbb{N}$ defined as

$$f(a) \coloneqq \sum_{i = 0}^{\mathrm{len}(a) - 1} a_i 10^{\mathrm{len}(a) - i - 1}$$

representing the numerical value of the list of digits.

The [[algorithm]] is as follows: Let $a:[0, 9]^*$ and $b:[0, 9]^*$ be lists of digits, with $f(a)$ the dividend and $f(b)$ the divisor. If $\mathrm{len}(a) \lt \mathrm{len}(b)$, then $f(a) \div f(b) = 0$ and $f(a)\ \%\ f(b) = f(a)$. Otherwise, we iterate for $\mathrm{len}(a)$ times before stopping:

For each iteration $i:[0, \mathrm{len}(a)]$, let $q_i$ be the quotient extracted from the algorithm at iteration $i$, let $d_i$ be the dividend at iteration $i$, let $r_i$ be the remainder at iteration $i$, and let $c_i$ be the next digit of the quotient, with the restriction that $0 \leq r_i$ and $r_i \lt f(b)$

We set initial conditions to be

$$q_{-1} \coloneqq 0$$

$$r_{-1} \coloneqq \sum_{i = 0}^{\mathrm{len}(b) - 2} a_i 10^{\mathrm{len}(b) - i - 2}$$

The successive conditions are defined inductively as

$$d_{i + 1} \coloneqq 10 r_i + a_{i + \len(b)}$$

$$r_{i + 1} \coloneqq d_{i + 1} - m c_{i + 1} =  10 r_i + a_{i + \len(b)} - m c_{i + 1}$$

$$q_{i + 1} \coloneqq 10 q_{i} - c_{i + 1}$$

## Order theoretic definitions

### Integers

work in progress...

### Finite decimals

See below, but define in terms of an initial algebra instead of a terminal coalgebra.

### Infinite decimals

Consider the [[category]] of [[intervals]] $Int$, i.e., linearly ordered sets with identified elements $1$ and $0$, and let

$$F: Int \to Int$$

be the endofunctor which takes an interval $X$ to $\bigvee_{0 \leq i \lt 10} X$, the the interval obtained by taking ten copies of $X$ and identifying the $1$ of the $(i-1)$-th copy with the $0$ of the $i$-th copy, for $0 \lt i \lt 10$. The real interval $[0, 1]$ becomes a coalgebra if we identify $\bigvee_{0 \leq i \lt 10} X$ with $[0, 10]$ and consider the multiplication-by-10 map $[0, 1] \to [0, 10]$ as giving a coalgebra structure.

+-- {: .num_theorem}
######Theorem
The interval $[0, 1]$ is terminal in the category of such coalgebras.
=--

+-- {: .proof}
######Proof (sketch)
Given any coalgebra structure $f: X \to \bigvee_{0 \leq i \lt 10} X$, any value $f(x)$ lands either in the $n$-th tenth (the $n$-th $X$ in $\bigvee_{0 \leq i \lt 10} X$) for $0\lt n \leq 10$, or at the precise spot between them, where the $1$ in the $n$-th copy is glued to the $0$ in the $(n+1)$-th for $0\lt n \lt 10$. Intuitively, one could think of a coalgebra structure $\theta: X \to \bigvee_{0 \leq i \lt 10}$ as giving an automaton where on input $x_0$ there is output of the form $(x_1, h_1)$, where $h_1$ is one of 19 states, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "either 0 or 1", "either 1 or 2", "either 2 or 3", "either 3 or 4", "either 4 or 5", "either 5 or 6", "either 6 or 7", "either 7 or 8", and "either 8 or 9". By iteration, this generates a behavior stream $(x_n, h_n)$. Let "0", "1", "2", "3", "4", "5", "6", "7", "8", and "9" be decimal digits $D$, the $h_n$ form a decimal expansion to give a number between 0 and 1, and therefore we have an interval map $X \to [0, 1]$ which sends $x_0$ to that number. Of course, if $h_n$ is ever one of the "either $d_l$ or $d_u$" states, for $d_l,d_u:D$ we have a choice to resolve it as either $(1_X, d_l)$ or $(0_X, d_u)$ and continue the stream, but these streams are identified, and this corresponds to the identifications of decimal expansions

$$h_1... h_{n-1} 100000... = .h_1... h_{n-1}099999...$$

$$h_1... h_{n-1} 200000... = .h_1... h_{n-1}199999...$$

$$h_1... h_{n-1} 300000... = .h_1... h_{n-1}299999...$$

$$h_1... h_{n-1} 400000... = .h_1... h_{n-1}399999...$$

$$h_1... h_{n-1} 500000... = .h_1... h_{n-1}499999...$$

$$h_1... h_{n-1} 600000... = .h_1... h_{n-1}599999...$$

$$h_1... h_{n-1} 700000... = .h_1... h_{n-1}699999...$$

$$h_1... h_{n-1} 800000... = .h_1... h_{n-1}799999...$$

$$h_1... h_{n-1} 900000... = .h_1... h_{n-1}899999...$$

as real numbers. In this way, we produce a unique well-defined interval map $X \to [0, 1]$, so that $[0, 1]$ is the terminal coalgebra.
=--

Let $(\mathbb{Z},0,s,n,\lt)$ be the set of integers, the initial set with an element $0$, a [[linear order]] $\lt$, a [[monotone]] $s$ such that $a \lt s(a)$ for all $a \in \mathbb{Z}$, and an [[antitone]] $n$ such that $n(0)=0$ and $n = s \circ n \circ s$. Let $\mathbb{R}$ be a set with a structure preserving function $g:\mathbb{Z}\to\mathbb{R}$ and a function into the [[monotone]] [[poset]] $f:\mathbb{Z} \to [0,1]\to \mathbb{R}$ such that $f(a)(0) = g(a)$ and $f(a)(1) = s(g(a))$ for all $a \in \mathbb{Z}$. The set $\mathbb{R}$ of __[[real numbers]]__ is the initial such system. By [[uncurrying]] the function $f$, one gets a function $i:\mathbb{Z} \times [0,1]\to \mathbb{R}$. An element $(a,b):\mathbb{Z} \times [0,1]$ is called an __infinite decimal representation__, where the comma used to represent [[pairs]] in [[set theory]] or [[type theory]] is literally the __decimal separator__ commonly seen in non-English speaking countries.

The arithmetic operations and topological properties on $\mathbb{R}$ can be defined by the properties of the [[function algebra]] of $\mathbb{R}$ and [[currying]].

## Rig theoretic definitions

### Integers

$$\mathbb{N} \cong \mathbb{N}[10] \coloneq \mathbb{N}[x]/(x=10)$$

### Finite decimals

Localisation of the [[rig]] of natural numbers at 10 $\mathbb{N}[1/10]$, finite decimals as canonical representatives of $\mathbb{N}[1/10]$, and then [[group completion]] of the additive monoid to $\mathbb{Z}[1/10]$.

### Infinite decimals

[[function algebra|Sequence algebra]] $\mathbb{N}\to\mathbb{Z}[1/10]$ and [[Cauchy sequences]]

## Doubly infinite decimals

Let $\mathbb{Z}/10\mathbb{Z}$ be the [[cyclic group]] consisting of 10 elements, and let $C_\bullet$ be a [[chain complex]] of [[abelian groups]] consisting of a sequence of $\mathbb{Z}/10\mathbb{Z}$ indexed by $\mathbb{Z}$. The indices $i:\mathbb{Z}$ are called __place values__, and $i$-[[cochains]] are called __digits__.

A __10-adic number__ is a cochain such that $c_i = 0$ for all $i \lt j$ or $c_i = 9$ for all $i \lt j$ for $i,j:\mathbb{Z}$. A __10-adic integer__ is a cochain such that $c_i = 0$ for all $i \lt 0$ or $c_ i = 9$ for all $i \lt 0$. A __real number__ is a cochain such that $c_i = c_j$ for all $i \gt k$ and $j \gt k$ for $i,j,k:\mathbb{Z}$. A __decimal rational__ is a real 10-adic number, and an __integer__ is a real 10-adic integer.

### 10-adic solenoids {#solenoid}

The cochain complex $C_\bullet$ defined in the previous section has a structure of an abelian group, making it into a __10-adic [[solenoid]]__.

A cyclic group $G$ has a canonical [[cyclic order]] $[(-),(-),(-)]:(G \times G \times G) \to \Omega$. We define the cyclic order on $\mathbb{Z}/10\mathbb{Z}$ such that $[0,n,1]$ is false for all $n:\mathbb{Z}/10\mathbb{Z}$.

For each $i:\mathbb{Z}$, there exists a [[cocycle]] $f_i: (C_i \times C_i) \to C_{i + 1}$ called the __digitwise carry__ function at place value $i$, defined such that for all $a,b:C_i$, $f_i(a,b) = 0$ if $[a,0,a+b]$ is false, and $f_i(a,b) = 1$ if $[a,0,a+b]$ is true.

We define the __addition without carry__ on the cochain complex $(-)\oplus(-): (C_\bullet \times C_\bullet) \to C_\bullet$ as the addition of all digits using the abelian group operation, and we define the __carry__ $carry: (C_\bullet \times C_\bullet) \to C_\bullet$ as the digitwise carry of all digits. Then, __addition__ $(-)+(-): (C_\bullet \times C_\bullet) \to C_\bullet$ is defined [[recursion|recursively]] as $a+b = (a\oplus b)+carry(a,b)$.

The cochains consisting of all $n$s for all $n:\mathbb{Z}/10\mathbb{Z}$ are additive [[identity elements]] of the addition operation defined above. As such, they are algebraically equal to the same chain $0$ __zero__, the chain consisting of all zeroes. We define __negation__ $-(-): C_\bullet \to C_\bullet$ such that for all chains $c:C_\bullet$, the digits in $-c$ are $(-c)_i = 9 + -c_i$. As a result, the chain complex itself is an abelian group.

### Analytic completion of Laurent series {#analytic_completion}

Let $1$ __one__ denote the cochain with all digits equal to zero except at place value $0$, where the digit is equal to $1$. The cochain with all digits equal to zero except at place value $i$ is called the __$i$-th power of ten__ and is denoted as $10^i$.

Let us define an $\mathbb{N}$-[[action]] $act: (\mathbb{N}^+\times C_\bullet) \to C_\bullet$ such that $act(0,0) = 0$ and $act(n + 1,c) = act(n,c) + c$ for all $n:\mathbb{N}^+$ and $c:C_\bullet$. This represents the $n$-fold sum of a cochain $c$.

One could also establish a [[ring]] structure on $\mathbb{Z}/10\mathbb{Z}$ and construct a multiplication operation on the chain complex such that the chain complex itself with the defined abelian group structure and multiplication should be equivalent to the [[quotient ring]] of the [[Laurent series]] $\mathbb{Z}[[x,x^{-1}]]/(x-10)\mathbb{Z}[[x,x^{-1}]]$.

## Related concepts

* [[decimal rational number]]

* [[numeral]]

## References

* Wikipedia, _[Decimal](https://en.wikipedia.org/wiki/Decimal)_

* Wikipedia, _[Decimal representation](https://en.wikipedia.org/wiki/Decimal_representation)_

[[!redirects decimal numbers]]

[[!redirects long division]]
[[!redirects long division algorithm]]


+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
#### Deduction and Induction
+-- {: .hide}
[[!include deduction and induction - contents]]
=--
#### Arithmetic
+-- {: .hide}
[[!include arithmetic geometry - contents]]
=--
=--
=--

# Contents
* table of contents
{: toc}

## Idea

The decimal numeral representation of the [[natural numbers]] as strings of digits as familiar from school mathematics, with mathematical operations directly defined on the strings of digits.

## Definition

### In type theory

Let $D$ be the [[type]] of decimal digits, [[inductive type|inductively]] generated by the terms $0:D$, $1:D$, $2:D$, $3:D$, $4:D$, $5:D$, $6:D$, $7:D$, $8:D$, and $9:D$. The **decimal numeral representation of the natural numbers** $\mathrm{Dec}$ is defined as the [[higher inductive type]] generated by the function

$$(-):D \to \mathrm{Dec}$$

the binary operation

$$(-)(-):\mathrm{Dec} \times \mathrm{Dec} \to \mathrm{Dec}$$

the [[dependent product type|dependent function]]

$$p:\prod_{a:\mathrm{Dec}} \prod_{b:\mathrm{Dec}} \prod_{c:\mathrm{Dec}} (a b) c = a (b c)$$

and the dependent function

$$q:\prod_{a:\mathrm{Dec}} a = 0 a$$

In [[Coq]]-[[syntax]] the decimal digits and the decimal representation of the natural numbers are the (higher) inductive types defined by

    Inductive DecDigits : Type :=
     | zero : DecDigits
     | one : DecDigits
     | two : DecDigits
     | three : DecDigits
     | four : DecDigits
     | five : DecDigits
     | six : DecDigits
     | seven : DecDigits
     | eight : DecDigits
     | nine : DecDigits

    Inductive Dec : Type :=
     | digit : DecDigits -> Dec
     | cat : Dec -> Dec -> Dec
     | assoc : forall (a,b,c : DecDigits) cat cat a b c == cat a cat b c
     | lead-zero : forall (a : Dec) a == cat digit zero a

### As a quotient set

Let

$$\mathbb{10} \coloneqq \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1} \uplus \mathbb{1}$$

be the [[disjoint union]] of 10 [[singletons]], with an element $0 \in \mathbb{10}$ and let $\mathbb{10}^+$ be the [[free object|free]] [[semigroup]] on $\mathbb{10}$. Then the set of decimal numeral representations of the natural numbers is the [[quotient set]] $\mathbb{10}^+/(a = 0 a)$.

## Properties

### Zero and successor

The decimal numeral representation of the natural numbers is a [[natural numbers object]] in [[Set]]: We define $0:\mathrm{Dec}$ to be $0$, and we inductively define the successor function $s:\mathrm{Dec} \to \mathrm{Dec}$ as

$$s(a 0) \coloneqq a 1$$
$$s(a 1) \coloneqq a 2$$
$$s(a 2) \coloneqq a 3$$
$$s(a 3) \coloneqq a 4$$
$$s(a 4) \coloneqq a 5$$
$$s(a 5) \coloneqq a 6$$
$$s(a 6) \coloneqq a 7$$
$$s(a 7) \coloneqq a 8$$
$$s(a 8) \coloneqq a 9$$
$$s(a 9) \coloneqq s(a) 0$$

### Inequalities

The [[denial inequality]] [[tight apartness relation]] $\neq$ called **not equal to** is inductively defined for decimal numeral representations of the natural numbers in the same way that it is inductively defined for natural numbers:

$$0 \neq 0 \coloneqq \mathbb{0}$$
$$0 \neq s(n) \coloneqq \mathbb{1}$$
$$s(m) \neq 0 \coloneqq \mathbb{1}$$
$$s(m) \neq s(n) \coloneqq m \neq n$$

The [[total order]] [[relation]] $\leq$ called **less than or equal to** is inductively defined for decimal numeral representations of the natural numbers in the same way that it is inductively defined for natural numbers:

$$0 \leq 0 \coloneqq \mathbb{1}$$
$$0 \leq s(n) \coloneqq \mathbb{1}$$
$$s(m) \leq 0 \coloneqq \mathbb{0}$$
$$s(m) \leq s(n) \coloneqq m \leq n$$

The [[opposite relation|opposite]] total order $\geq$ called **greater than or equal to** is inductively defined as

$$0 \geq 0 \coloneqq \mathbb{1}$$
$$0 \geq s(n) \coloneqq \mathbb{0}$$
$$s(m) \geq 0 \coloneqq \mathbb{1}$$
$$s(m) \geq s(n) \coloneqq m \geq n$$

The strict [[linear order]] relation $\lt$ called **less than** is inductively defined for decimal numeral representations of the natural numbers in the same way that it is inductively defined for natural numbers:

$$0 \lt 0 \coloneqq \mathbb{0}$$
$$0 \lt s(n) \coloneqq \mathbb{1}$$
$$s(m) \lt 0 \coloneqq \mathbb{0}$$
$$s(m) \lt s(n) \coloneqq m \lt n$$

The opposite strict linear order $\gt$ called **greater than** is inductively defined as

$$0 \gt 0 \coloneqq \mathbb{0}$$
$$0 \gt s(n) \coloneqq \mathbb{0}$$
$$s(m) \gt 0 \coloneqq \mathbb{1}$$
$$s(m) \gt s(n) \coloneqq m \gt n$$

### Number of digits

Each decimal numeral representation has an associated number of digits, a function $\mathrm{numDigits}:\mathrm{Dec} \to \mathrm{Dec}$ inductively defined as

$$\mathrm{numDigits}(0) \coloneqq 0$$
$$\mathrm{numDigits}(1) \coloneqq 1$$
$$\mathrm{numDigits}(2) \coloneqq 1$$
$$\mathrm{numDigits}(3) \coloneqq 1$$
$$\mathrm{numDigits}(4) \coloneqq 1$$
$$\mathrm{numDigits}(5) \coloneqq 1$$
$$\mathrm{numDigits}(6) \coloneqq 1$$
$$\mathrm{numDigits}(7) \coloneqq 1$$
$$\mathrm{numDigits}(8) \coloneqq 1$$
$$\mathrm{numDigits}(9) \coloneqq 1$$

and for every decimal numeral representation $a \neq 0$,

$$\mathrm{numDigits}(a 0) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 1) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 2) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 3) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 4) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 5) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 6) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 7) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 8) \coloneqq s(\mathrm{numDigits}(a))$$
$$\mathrm{numDigits}(a 9) \coloneqq s(\mathrm{numDigits}(a))$$

We define the type of decimal numeral representations with $n$-digits as the [[fiber]] of $\mathrm{numDigits}$ at $n$:

$$representationsWithNumDigits(n) \coloneqq \sum_{a:\mathrm{Dec}} \mathrm{numDigits}(a) = n$$

### Addition of single digits

Addition $(-)+(-):D \times D \to \mathrm{Dec}$ of two digits is inductively defined as

|+|0|1|2|3|4|5|6|7|8|9|
|-|-|-|-|-|-|-|-|-|-|-|
|0|$0 + 0 \coloneqq 0$|$0 + 1 \coloneqq 1$|$0 + 2 \coloneqq 2$|$0 + 3 \coloneqq 3$|$0 + 4 \coloneqq 4$|$0 + 5 \coloneqq 5$|$0 + 6 \coloneqq 6$|$0 + 7 \coloneqq 7$|$0 + 8 \coloneqq 8$|$0 + 9 \coloneqq 9$|
|1|$1 + 0 \coloneqq 1$|$1 + 1 \coloneqq 2$|$1 + 2 \coloneqq 3$|$1 + 3 \coloneqq 4$|$1 + 4 \coloneqq 5$|$1 + 5 \coloneqq 6$|$1 + 6 \coloneqq 7$|$1 + 7 \coloneqq 8$|$1 + 8 \coloneqq 9$|$1 + 9 \coloneqq 10$|
|2|$2 + 0 \coloneqq 2$|$2 + 1 \coloneqq 3$|$2 + 2 \coloneqq 4$|$2 + 3 \coloneqq 5$|$2 + 4 \coloneqq 6$|$2 + 5 \coloneqq 7$|$2 + 6 \coloneqq 8$|$2 + 7 \coloneqq 9$|$2 + 8 \coloneqq 10$|$2 + 9 \coloneqq 11$|
|3|$3 + 0 \coloneqq 3$|$3 + 1 \coloneqq 4$|$3 + 2 \coloneqq 5$|$3 + 3 \coloneqq 6$|$3 + 4 \coloneqq 7$|$3 + 5 \coloneqq 8$|$3 + 6 \coloneqq 9$|$3 + 7 \coloneqq 10$|$3 + 8 \coloneqq 11$|$3 + 9 \coloneqq 12$|
|4|$4 + 0 \coloneqq 4$|$4 + 1 \coloneqq 5$|$4 + 2 \coloneqq 6$|$4 + 3 \coloneqq 7$|$4 + 4 \coloneqq 8$|$4 + 5 \coloneqq 9$|$4 + 6 \coloneqq 10$|$4 + 7 \coloneqq 11$|$4 + 8 \coloneqq 12$|$4 + 9 \coloneqq 13$|
|5|$5 + 0 \coloneqq 5$|$5 + 1 \coloneqq 6$|$5 + 2 \coloneqq 7$|$5 + 3 \coloneqq 8$|$5 + 4 \coloneqq 9$|$5 + 5 \coloneqq 10$|$5 + 6 \coloneqq 11$|$5 + 7 \coloneqq 12$|$5 + 8 \coloneqq 13$|$5 + 9 \coloneqq 14$|
|6|$6 + 0 \coloneqq 6$|$6 + 1 \coloneqq 7$|$6 + 2 \coloneqq 8$|$6 + 3 \coloneqq 9$|$6 + 4 \coloneqq 10$|$6 + 5 \coloneqq 11$|$6 + 6 \coloneqq 12$|$6 + 7 \coloneqq 13$|$6 + 8 \coloneqq 14$|$6 + 9 \coloneqq 15$|
|7|$7 + 0 \coloneqq 7$|$7 + 1 \coloneqq 8$|$7 + 2 \coloneqq 9$|$7 + 3 \coloneqq 10$|$7 + 4 \coloneqq 11$|$7 + 5 \coloneqq 12$|$7 + 6 \coloneqq 13$|$7 + 7 \coloneqq 14$|$7 + 8 \coloneqq 15$|$7 + 9 \coloneqq 16$|
|8|$8 + 0 \coloneqq 8$|$8 + 1 \coloneqq 9$|$8 + 2 \coloneqq 10$|$8 + 3 \coloneqq 11$|$8 + 4 \coloneqq 12$|$8 + 5 \coloneqq 13$|$8 + 6 \coloneqq 14$|$8 + 7 \coloneqq 15$|$8 + 8 \coloneqq 16$|$8 + 9 \coloneqq 17$|
|9|$9 + 0 \coloneqq 9$|$9 + 1 \coloneqq 10$|$9 + 2 \coloneqq 11$|$9 + 3 \coloneqq 12$|$9 + 4 \coloneqq 13$|$9 + 5 \coloneqq 14$|$9 + 6 \coloneqq 15$|$9 + 7 \coloneqq 16$|$9 + 8 \coloneqq 17$|$9 + 9 \coloneqq 18$|

### Arithmetic left shifts

There is a [[binary operation]] $(-) \ll (-):\mathrm{Dec} \times \mathrm{Dec} \to \mathrm{Dec}$ called the **arithmetic left shift** inductively defined as

$$a \ll 0 \coloneqq a$$
$$a \ll s(b) \coloneqq (a \ll b) 0$$

This binary operation is also called **multiplication by a power of ten**.

Arithmetic left shifts of digits is left distributive over addition: given $a:D$, $b:D$, and $c:\mathrm{Dec}$, $a \ll c + b \ll c = (a + b) \ll c$.

### Digit decompositions

Given a decimal numeral representation $b$, there exists functions $\mathrm{digitsNotLast}:\mathrm{Dec} \to \mathrm{Dec}$ and $\mathrm{lastDigit}:\mathrm{Dec} \to D$ such that

$$b = \mathrm{digitsNotLast}(b) \mathrm{lastDigit}(b)$$

and

$$\mathrm{numDigits}(b) = s(\mathrm{digitsNotLast}(b))$$

### Addition of general decimal representations

Given a decimal numeral representation $b$ such that $\mathrm{lastDigit}(b) = 0$, the sum of $b$ and a digit $d$ is defined as

$$b + d \coloneqq \mathrm{digitsNotLast}(b) d$$

Given two decimal numeral representations of the natural numbers $a_0 d_0$ and $a_1 d_1$ with $d_0$ and $d_1$ being digits and $a_0$ and $a_1$ being decimal numeral representations, addition is inductively defined as

$$a_0 d_0 + a_1 d_1 \coloneqq (a_0 + a_1) 0 + (d_0 + d_1)$$

The decimal numeral representation of the natural numbers is a [[commutative monoid object]] in [[Set]]:

Addition is left unital:

$$0 + a d = 0 + a 0 + d = a 0 + d = a d$$

Addition is right unital:

$$a d + 0 = a 0 + d + 0 = a 0 + d = a d$$

## See also

* [[natural numbers]]

* [[natural numbers type]]

* [[inductive type]]

* [[higher inductive type]]

* [[infinite decimal representation of a unit interval]]