constructive set theory

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

\tableofcontents

## Idea

Constructive set theory is [[set theory]] in the spirit of [[constructive mathematics]].

[[Algebraic set theory]] is a categorical presentation of such set theories.

Some more information can be found at [[ZFC]]. Perhaps this should be moved here.

## Axiom systems

There are a number of axiom systems:

### Impredicative set theories

All of these set theories can be interpreted in a [[set-level type theory]] with a [[type of all propositions]].

* The impredicative IZF which includes the [[power set]] or [[power object]] axiom.
* [[SEAR|ISEAR]] - the [[allegorical set theory]] version of IZF.
* [[ETCS|IETCSR]] - the [[categorical set theory]] version of IZF.

### Weakly predicative set theories

All of these set theories can be interpreted in [[set-level type theory]] with no [[type of all propositions]], but with [[function types]] and [[dependent function types]]

* The variant CZF for [[predicative mathematics]].
* [[SEAR|CSEAR]] - the [[allegorical set theory]] version of CZF.
* [[ETCS|CETCSR]] - the [[categorical set theory]] version of CZF.

### Strongly predicative set theories

All of these set theories can be interpreted in [[set-level type theory]] with only dependent function types for families of [[subsingletons]].

* [[SEAR|PSEAR]]

## Related concepts

* [[constructive analysis]]

* [[constructive algebraic topology]]

* [[taboo]]

## References

* {#AczelRathjen01} [[Peter Aczel]], [[Michael Rathjen]], _Notes on Constructive Set theory_, 2001 ([pdf](https://events.math.unipd.it/3wftop/pdf/AczelRathjen.pdf), [[AczelRathjenCST.pdf:file]])

See also

* Wikipedia, _[Constructive set theory](http://en.wikipedia.org/wiki/Constructive_set_theory)_

On [[constructive set theory]] in [[homotopy type theory]]:

* [[Håkon Robbestad Gylterud]], [[Elisabeth Bonnevier]], *Non-wellfounded sets in HoTT* [[arXiv:2001.06696](https://arxiv.org/abs/2001.06696), talk video:[YT](https://www.youtube.com/watch?v=ALj5hOmwXps)]

[[!redirects CZF]]
[[!redirects IZF]]
[[!redirects CST]]


constructivism - contents

**[[constructive mathematics]]**, **[[realizability]]**, **[[computability]]**

[[intuitionistic mathematics]]

[[propositions as types]], [[proofs as programs]], [[computational trinitarianism]]

### Constructive mathematics

* [[topos]], [[(infinity,1)-topos|homotopy topos]]

* [[type theory]], [[homotopy type theory]]

* [[canonical form]], [[univalence]]

* [[Bishop set]], [[h-set]]

* [[decidable equality]], [[decidable subset]], [[inhabited set]], [[subsingleton]]

### Realizability

* [[realizability topos]]

* [[realizability model]]

* [[realizability interpretation]]

* [[effective topos]]

* [[Kleene's first algebra]], [[Kleene's second algebra]]

* [[function realizability]]

### Computability

* [[computability]]

* [[computation]], [[computational type theory]]

* [[computable function]], [[partial recursive function]]

* [[computable analysis]], [[constructive analysis]]

  * [[Type Two Theory of Effectivity]]

  * [[computable function (analysis)]]

  * [[exact real computer arithmetic]]

* [[computable set]]

* [[persistent homology]], [[effective homology]]

* [[computable physics]]

* [[Church-Turing thesis]]


constructivism > history

< [[constructivism]]
[[!redirects constructivism -- history]]


contact geometry > history

See at _[[contact manifold]]_


contact manifold

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

#Contents#
* table of contents
{:toc}

## Idea

A _contact manifold_ is a [[smooth manifold]] $P$ of odd [[dimension]] $2n+1$ which is equipped with a [[differential form|differential 1-form]] $A$ that is non-degenerate in the sense that the [[wedge product]] $A \wedge (d_{dR} A)^{\wedge^n}$ does not vanish.

The special case of [[closed manifold|closed]] _regular_ contact manifolds $(P,A)$ are essentially equivalent to the total spaces of [[circle bundles]] $P \to X$ over an $2n$-dimensional manifold equipped with a [[connection on a bundle|connection]] such that $A$ is the corresponding [[Ehresmann connection]] 1-form on the total space ([BoothbyWang (1958)](#BoothbyWang)).

If in this case the [[curvature]] 2-form $\omega$ on $X$ makes the base space $X$ into a [[symplectic manifold]], then $(P,A)$ is a corresponding [[prequantum circle bundle]] that provides a [[geometric prequantization]] of $(X,\omega)$.

A [[diffeomorphism]] $f : P \to P$ of a contact manifold $(P,A)$ is called a _contactomorphism_ (in analogy with _[[symplectomorphism]]_) if it preserves the 1-form $A$ up to multiplication by a function. If $(P,A)$ is regular and hence a [[prequantum line bundle]] a contactomorphism that strictly preserves the connection 1-form is called a _[[quantomorphism]]_. The [[Lie algebra]] of the [[quantomorphism group]] is that of the [[Poisson algebra]] of the base symplectic manifold $(X,\omega)$.

## Properties

### Darboux theorem

There is a [[Darboux theorem]] for contact structures, stating how they are locally equivalent to a standard contact structure (e.g. [Arnold 78, page 362](#Arnold78))

### Relation to $U(1)$-principal connections
+-- {: .num_theorem}
###### Theorem

If $X$ is a [[closed manifold|closed]] [[smooth manifold]], $P \to X$ a smooth [[circle bundle]] ($U(1)$-[[principal bundle]]) and $\omega \in \Omega^2(X)$ a [[differential 2-form]] representing its [[Chern class]] in [[de Rham cohomology]], then there is a corresponding [[Ehresmann connection]] 1-form $A \in \Omega^1(P)$ with [[curvature]] $\omega$ and such that

1. $A$ is a regular contact form on $P$;

1. the [[Reeb vector field]] of $A$ generates the given $U(1)$-[[action]] on $P$.

Moreover, every regular contact form $A$ on a closed manifold $P$ arises this way, up to rescaling by a constant.

=--

This is due to ([Boothby-Wang 58](#BoothbyWang)). The proof is recalled (and completed) in ([Geiges 08, theorem 7.2.4, 7.2.5](#Geiges)).

## History
 {#History}

> The following is taken from ([Lin](#Lin)).

Originating in [[Hamiltonian mechanics]] and [[geometric optics]], contact geometry caught geometers' attention much earlier. In 1953, [[Shiing-shen Chern]] showed that the structure group of a contact manifold $M^{2n+1}$ can be reduced to the [[unitary group]] $U(n)$ and therefore all
of its odd [[characteristic classes]] vanish. Since all the characteristic classes of a closed, orientable 3-manifold vanish, Chern in 1966 posed the questions of whether such a manifold always admits a contact structure and whether there are non-isomorphic contact structures on
one manifold.

One of the milestones in the study of contact geometry is [[Daniel Bennequin|Bennequin]]'s proof of the existence of exotic contact structures (i. e., contact structures not isomorphic to the standard one) on $\mathbb{R}^3$ ([Bennequin 83](#Bennequin83)). Bennequin recognized that the induced singular [[foliation]] on a [[surface]] [[embedding|embedded]] in a contact 3-manifold plays a crucial role for the classification of contact structures. This role was further explored in the work of Eliashberg, who distinguished two classes of contact structures in dimension 3, overtwisted and tight, and gave a homotopy classification for overtwisted contact structures on 3-manifolds ([Eliashberg 89](#Eliashberg89)). Eliashberg also proved that on $\mathbb{R}^3$ and $S^3$, the standard contact structure is the only tight contact structure.

## Related concepts

* [[Reeb vector field]]

* [[Legendrean submanifold]]

* [[symplectic manifold]]

* [[symplectic field theory]]

* [[generalized contact geometry]]

* [[Sasakian manifold]]

## References

### General

Monographs and introductions:

* [[Hansjörg Geiges]], *Contact geometry*, in F. J. E. Dillen and L. C. A. Verstraelen, (eds.), *Handbook of Differential Geometry* vol. 2  North-Holland, Amsterdam (2006) 315-382 [[arXiv:math/0307242](http://arxiv.org/abs/math/0307242), [ISBN:978-0-444-52052-4](https://www.sciencedirect.com/handbook/handbook-of-differential-geometry/vol/2/suppl/C)]

* {#Geiges} [[Hansjörg Geiges]], *An Introduction to Contact Topology*, Cambridge Studies in Advanced Mathematics **109**, Cambridge University Press (2008) [[doi:10.1017/CBO9780511611438](https://doi.org/10.1017/CBO9780511611438)]

* {#Lin} Xiao-Song Lin, _An introduction to 3-dimensional contact geometry_ [[pdf](http://math.ucr.edu/~xl/contact.pdf)]

* John Etnyre, _Introductory lectures on contact geometry_ Proc. Sympos. Pure Math. **71** (2003) 81-107  [[pdf](http://people.math.gatech.edu/~etnyre/preprints/papers/contlect.pdf)]

Discussion in terms of (a modification of) [[G-structures]]:

* Alfonso Giuseppe Tortorella, Luca Vitagliano & Ori Yudilevich, _Homogeneous G-structures_, Annali di Matematica (2020) [[doi:10.1007/s10231-020-00972-9](https://doi.org/10.1007/s10231-020-00972-9)]

A [[higher differential geometry]]-generalization of contact geometry in line with [[multisymplectic geometry]]/[[n-plectic geometry]] is discussed in

* Luca Vitagliano, _L-infinity Algebras From Multicontact Geometry_ ([arXiv.1311.2751](http://arxiv.org/abs/1311.2751))

* {#Arnold78} [[Vladimir Arnol'd]], _[[Mathematical methods of classical mechanics]]_, Graduate texts in Mathematics 60 (1978)

### Characterization

The observation that regular contact manifolds are prequantum circle bundles is due to

* {#BoothbyWang} W. M. Boothby and H. C. Wang, _On contact manifolds_, Ann. of Math. (2) 68 (1958) 721–734. ([jstor:10.2307/1970165](http://www.jstor.org/stable/10.2307/1970165))

A modern review of this is in ([Geiges, section 7.2](#Geiges)).

An analogous result for a weaker form of regularity is discussed in

* C. Thomas, _Almost regular contact manifolds_, J. Diff. Geom. 11 (1976) ([euclid:jdg/1214433722](http://projecteuclid.org/euclid.jdg/1214433722))

A characterization of $S^1$-invariant contact structures on [[circle bundles]] is in

* {#DingGeiges} Fan Ding, [[Hansjörg Geiges]], _Contact structures on principal circle bundle_, Bull. London Math. Soc, ([arXiv:1107.4948](http://arxiv.org/abs/1107.4948))

For the special case of 2-dimensional base manifolds ($n = 1$) this was obtained before in

* R. Lutz, _Structures de contact sur les fibrés principaux en cercles de dimension trois_, Ann. Inst. Fourier (Grenoble) 27 (1977) no. 3, 1–15.

See also

* John Bland, Tom Duchamp, _The Group of Contact Diffeomorphisms for Compact Contact Manifolds_ ([arXiv:1007.2036](http://arxiv.org/abs/1007.2036))

### Further

* {#Bennequin83} [[Daniel Bennequin]], _Entrelacements et equations de Pfaff_, Astérique, 107-108 (1983), 87-161. ([pdf](http://www.numdam.org/article/AST_1983__107-108__87_0.pdf))

* {#Eliashberg89} [[Yakov Eliashberg]], _Classification of overtwisted contact structures on 3-manifolds_, Invent. Math. 98 (1989), 623-637. ([pdf](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.465.8237&rep=rep1&type=pdf))

* {#Eliashberg92} [[Yakov Eliashberg]], _Contact 3-manifolds twenty years since J Martinet’s work_, Ann. Inst. Fourier, 42 (1992), 165-192. ([pdf](http://www.numdam.org/item/10.5802/aif.1288.pdf))

* [[Hansjörg Geiges]], _Contact structures on 1-connected 5-manifolds_, Mathematika 38 (1991), 303-311;

* [[Hansjörg Geiges]], _Contact structures on $(n-1)$-connected $(2n+1)$-manifolds_, Pacific J. Math. 161 (1993), 129-137;

* [[Hansjörg Geiges]], _Constructions of contact manifolds_, Math. Proc. Cambridge Philos. Soc. 121 (1997), 455-464;

* [[Hansjörg Geiges]], _Normal contact structures on 3-manifolds_,
Tôhoku Math. J. 49 (1997), 415-422.

* [[Hansjörg Geiges]], J. Gonzalo, _Moduli of contact circles_, J. Reine Angew. Math. 551 (2002), 41-85; _Contact geometry and complex surfaces_, Invent. Math. 121 (1995), 147-209.

[[!redirects contact manifolds]]

[[!redirects contactomorphism]]
[[!redirects contactomorphisms]]

[[!redirects contact structure]]
[[!redirects contact structures]]

[[!redirects regular contact manifold]]
[[!redirects regular contact manifolds]]

[[!redirects contact geometry]]
[[!redirects contact geometries]]

[[!redirects contactomorphism]]
[[!redirects contactomorphisms]]

[[!redirects contact form]]
[[!redirects contact forms]]

[[!redirects contact 1-form]]
[[!redirects contact 1-forms]]


content

* in [[measure theory]]:

  *[[content (measure theory)]]*

* in [[algebra]]/[[ring theory]]:

  *[[content (ring theory)]]*

* in [[combinatorics]]/[[representation theory]]:

  *[[hook-content formula]]*

\linebreak

(For the *contents of this wiki* see at *[[contents]]*.)

category: disambiguation


content (measure theory)

> This entry is about the notion of "content" in [[measure theory]]. For the notion in ring theory, see [[content (ring theory)]] and for the notion in [[combinatorics]]/[[representation theory]] set at *[[hook-content formula]]*. For the contents sidebar of this wiki, see *[[contents]]*.  For more disambiguation see *[[content]]*.

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Measure and probability theory
+-- {: .hide}
[[!include measure theory - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Definition ##
In [[measure theory]], a __content__ on a [[distributive lattice]] $(L, \leq, \bot, \vee, \top, \wedge)$ is a [[valuation (measure theory)|valuation]] $\mu:L \to [0, \infty]$ to the non-negative [[one-sided real number|lower reals]] such that the valuation of the bottom element is zero and additive if the pair of elements is disjoint.

$$\forall a\in L. \forall b \in L. \mu(\bot) = 0$$
$$\forall a\in L. \forall b \in L. (a \wedge b = \bot) \implies (\mu(a \vee b) = \mu(a) + \mu(b))$$

## See also ##

* [[valuation (measure theory)]]

* [[sigma-continuous valuation]]

* [[probability content]]

* [[measure]]

* [[Jordan content]]

## References ##

* Wikipedia, *Content (measure theory)*


content (ring theory)

> This entry is about the notion of "content" in [[ring theory]]. For the notion in [[measure theory]], see *[[content (measure theory)]]*. For the notion in [[combinatorics]]/[[representation theory]] see *[[hook-content formula]]*. For the contents sidebar of this wiki, see *[[contents]]*. For more disambiguation see *[[content]]*.

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

#Contents#
* table of contents
{:toc}

## Definition

Let $R$ be a [[unique factorization domain]] with [[decidable equality]]. The **content** of a [[polynomial]] $p \in R[x]$ is the [[greatest common divisor]] of the coefficients
$$\gcd_{i \leq d(p)} p_i$$
where $d(p)$ is the [[degree]] of the polynomial.

## See also

* [[polynomial]]

* [[Gauss's lemma for polynomials]]

* [[rational root theorem]]

## References

* Wikipedia, [Primitive part and content](https://en.wikipedia.org/wiki/Primitive_part_and_content)


Content > history


contents

**[[HomePage|nLab]]**

* Content

  * [[mathematics|Mathematics]]
  * [[physics|Physics]]
  * [[philosophy|Philosophy]]

* Resources

  * [[mathematics resources|Mathematics Resources]]
  * [[physics resources|Physics Resources]]
  * [[philosophy resources|Philosophy Resources]]

* Community

  * [nForum](http://nforum.ncatlab.org/)
    * [Latest Changes](https://nforum.ncatlab.org/5/)
  * [[HowTo|HowTo]]
  * [[FAQ|FAQ]]
  * [[Contributors]]

  * [Uploaded Files](http://ncatlab.org/nlab/file_list)
  * [[Sandbox|Sandbox]]

[Edit this sidebar](/nlab/edit/contents)

[[!redirects contents]]
[[!redirects Contents]]


contents of contents

# Contents of Contents

These are the various "contents" pages on the nLab, generated from the database on 2011-08-10 (not in any particular order).

+-- {: .toc .clickDown tabindex="0"}
#### Mathematics ####
+--{: .hide}
[[!include mathematicscontents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Cohomology ####
+--{: .hide}
[[!include cohomology - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Differential Graded Objects ####
+--{: .hide}
[[!include differential graded objects - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Higher Geometry ####
+--{: .hide}
[[!include higher geometry - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### (infinity,1)-topos ####
+--{: .hide}
[[!include (infinity,1)-topos - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Higher Algebra ####
+--{: .hide}
[[!include higher algebra - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Higher Category Theory ####
+--{: .hide}
[[!include higher category theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Stable Homotopy Theory ####
+--{: .hide}
[[!include stable homotopy theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Category Theory ####
+--{: .hide}
[[!include category theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Topos Theory ####
+--{: .hide}
[[!include topos theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Functorial Quantum Field Theory ####
+--{: .hide}
[[!include functorial quantum field theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Supergeometry ####
+--{: .hide}
[[!include supergeometry - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Synthetic Differential Geometry ####
+--{: .hide}
[[!include synthetic differential geometry - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Homotopy ####
+--{: .hide}
[[!include homotopy - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Compact Object ####
+--{: .hide}
[[!include compact object - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Model Category Theory ####
+--{: .hide}
[[!include model category theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Categorification ####
+--{: .hide}
[[!include categorification - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
####  ####
+--{: .hide}
[[!include contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Infinity-lie Theory ####
+--{: .hide}
[[!include infinity-Lie theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Infinity-limits ####
+--{: .hide}
[[!include infinity-limits - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Categorytheory ####
+--{: .hide}
[[!include categorytheorycontents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Type Theory ####
+--{: .hide}
[[!include type theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Quasi-category Theory ####
+--{: .hide}
[[!include quasi-category theory contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Topology ####
+--{: .hide}
[[!include topology - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Functional Analysis ####
+--{: .hide}
[[!include functional analysis - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Monoidal Categories ####
+--{: .hide}
[[!include monoidal categories - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### 2-category Theory ####
+--{: .hide}
[[!include 2-category theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Yoneda Lemma ####
+--{: .hide}
[[!include Yoneda lemma - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Enriched Category Theory ####
+--{: .hide}
[[!include enriched category theory contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Aqft And Operator Algebra ####
+--{: .hide}
[[!include AQFT and operator algebra contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Manifolds And Cobordisms ####
+--{: .hide}
[[!include manifolds and cobordisms - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Homological Algebra ####
+--{: .hide}
[[!include homological algebra - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Differential Cohomology ####
+--{: .hide}
[[!include differential cohomology - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Infinity-chern-weil Theory ####
+--{: .hide}
[[!include infinity-Chern-Weil theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Gravity ####
+--{: .hide}
[[!include gravity contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Knot Theory ####
+--{: .hide}
[[!include knot theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Riemannian Geometry ####
+--{: .hide}
[[!include Riemannian geometry - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Infinity-chern-simons Theory ####
+--{: .hide}
[[!include infinity-Chern-Simons theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Foundations ####
+--{: .hide}
[[!include foundations - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Cohesive Infinity-toposes ####
+--{: .hide}
[[!include cohesive infinity-toposes - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Group Theory ####
+--{: .hide}
[[!include group theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Variational Calculus ####
+--{: .hide}
[[!include variational calculus - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Mapping Space ####
+--{: .hide}
[[!include mapping space - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Measure Theory ####
+--{: .hide}
[[!include measure theory - contents]]
=--
=--
+-- {: .toc .clickDown tabindex="0"}
#### Physics ####
+--{: .hide}
[[!include physicscontents]]
=--
=--

category: meta


context

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

# Contents
* table of contents
{:toc}

## Idea

In [[logic]] and [[type theory]], the **context** of a [[judgement]] (or _[[hypothetical judgement]]_, with [[dependent type|dependence]] on the context) consists of all of the assumptions that are made when that assertion is claimed to be valid; whether an assertion is in fact valid (or even meaningful) may depend on the context.  The precise definition depends on the [[theory]] (or [[doctrine]]) that one is working in.

Generally, a context is thought of as relative to some underlying logical theory.  This underlying theory will contain most of the assumptions of what constitutes validity; the context of an assertion in this theory will then include only those extra assumptions that may be used by that assertion.  On the other hand, one could also think of the entire base theory as part of the context.

## Examples

### Theory of a group

In the theory of a [[group]], it is understood that there is a group $G$, that $G$ has various elements, that two elements of $G$ may be [[equality|equal]], that any two elements of $G$ have as product an element of $G$, and that various equational laws are satisfied (which we will not list here).  That is all taken for granted when discussing a group.  However, the validity and meaningfulness of an assertion that two elements of $G$ commute will depend on (the rest of) the context.

To be more explicit, the assertion that $a$ and $b$ commute does not make sense without the additional context that $a$ and $b$ are elements of $G$.  Even in that context, this assertion, while at least meaningful, is not valid.  However, if we add to the context the assumption that $(a b)^2 = a^2 b^2$, then the assertion is valid.  Written symbolically,
$$ \vdash\; a b = b a $$
is meaningless;
$$ a\colon G,\; b\colon G \;\vdash\; a b = b a $$
is meaningful but invalid; and
\[\label{valid} a\colon G,\; b\colon G,\; (a b)^2 = a^2 b^2 \;\vdash\; a b = b a \]
is valid.

In a sufficiently rich logical language, contexts are unnecessary, which is why contexts are not usually explained in accounts of logic for ordinary reasoning (including in ordinary mathematics).  For example, the two meaningful assertions above may be rewritten thus:
$$ \vdash\; \forall (a\colon G),\; \forall (b\colon G),\; a b = b a$$
and
$$ \vdash\; \forall (a\colon G),\; \forall (b\colon G),\; (a b)^2 = a^2 b^2 \;\Rightarrow\; a b = b a$$
Here the context on the left side is the **[[empty context]]**, consisting of no assumptions whatsoever (beyond those underlying the base theory).

However, these versions involve $\forall$ and $\Rightarrow$, while the previous versions work in weaker logics.  In fact, these assertions make sense (and the valid one may be proved) in the [[internal logic]] of a [[group object]] in a [[finitely complete category]] (and somewhat more generally than that).  Accordingly, they can be interpreted as statements about any group object in any finitely complete category (and the valid one will then be interpreted as a true statement), exactly as they do for groups (which are group objects in the finitely complete category [[Set]]).

Even if one is completely uninterested in [[internalization]] or weak logics, a basic familiarity with contexts may help drive home a point that is important throughout reasoning:  **What you can state and prove depends on your assumptions.**

## Split contexts
 {#SplitContexts}

Sometimes contexts are [[split context|split]], where one has two different collection of contexts $\Gamma$ and $\Delta$ whose individual [[judgments]] are required to be listed separate from each other as $\Gamma \vert \Delta$. This commonly occurs in [[modal type theory]] such as [[spatial type theory]] and [[cohesive homotopy type theory]] (specifically in [[real-cohesive homotopy type theory]] and [[linear homotopy type theory]]).

## Properties

### Category of contexts

The [[category of contexts]] in a [[theory]] forms its [[syntactic category]], which is a [[split model of type theory]] and is important in the [[relation between type theory and category theory]]. See _[Categorical semantics](#CategoricalSemantics)_ below.

### Categorical semantics
 {#CategoricalSemantics}

The [[categorical semantics]] of a context $\Gamma$ in [[type theory]]
is as the [[slice category]] $\mathcal{C}_{/[\Gamma]}$ over the object that interprets $\Gamma$. See at _[categorical semantics -- Definition -- Of dependent type theory -- Contexts and type judgements](http://ncatlab.org/nlab/show/categorical+semantics#ContextsAndTypeJudgements)_.

## Related concepts

* [[antecedent]]

* [[context extension]]

* [[telescope]]

* [[split context]]

## References

A comprehensive definition of [[categorical semantics]] of contexts in [[homotopy type theory]] in [[type-theoretic model categories]] is in section 2 of

* [[Mike Shulman]], _The univalence axiom for inverse diagrams_ ([arXiv:1203.3253](http://arxiv.org/abs/1203.3253))
 {#Shulman}

[[!redirects context]]
[[!redirects contexts]]

[[!redirects context enlargement]]


context extension

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

#Contents#
* table of contents
{:toc}

## Idea

In [[dependent type theory]],
_context extension_ introduces new [[free variables]] into the [[context]].

## Definition

If $T$ is a [[type]] in a [[context]] $\Gamma$, then the __extension__ of $\Gamma$ by (a [[free variable]] of) the [[type]] $T$ is the context denoted

$$ \Gamma, x\colon T $$

(where $x$ is a new [[variable]]).

(We have said 'the' extension of $\Gamma$ by $T$ using the [[generalised the]]; but it may literally be unique using certain conventions for handling [[alpha equivalence]].)

## Categorical semantics

The [[categorical semantics]] of context extension is the [[inverse image]] of the [[base change geometric morphism]] (or its analog for [[hyperdoctrines]]) along the [[projection]] morphism $T \to \Gamma$ in the [[slice topos|slice]] $\mathbf{H}_{/\Gamma}$

$$
  (\mathbf{H}_{/\Gamma})_{/T}
    \stackrel{\overset{\prod_{x : T}}{\longrightarrow}}{\stackrel{\overset{(-)\times T}{\longleftarrow}}{\underset{\sum_{x : T}}{\longrightarrow}}}
  \mathbf{H}_{/\Gamma}
$$

Generally speaking, a [[morphism]] $\Delta \to \Gamma$ in the [[category of contexts]] (an [[interpretation]] of $\Gamma$ in $\Delta$) is a [[display morphism]] iff there is an [[isomorphism]] $\Delta \leftrightarrow \Theta$ where $\Theta$ is an extension of $\Gamma$.  (This might not actually be true in all type theories, or maybe it should be taken as the *definition* of 'display morphism'; I\'m not sure.)

## Related concepts

* [[substitution]]

[[!include notions of pullback -- contents]]

## References

The observation that context extension forms an [[adjoint pair]]/[[adjoint triple]] with [[quantifiers]] is due to

* [[Bill Lawvere]], _Adjointness in Foundations_, ([TAC](http://www.emis.de/journals/TAC/reprints/articles/16/tr16abs.html)), Dialectica 23 (1969), 281-296

and further developed in

* [[Bill Lawvere]], _Equality in hyperdoctrines and
comprehension schema as an adjoint functor_, Proceedings of the AMS Symposium on Pure Mathematics XVII (1970), 1-14.

[[!redirects context extension]]
[[!redirects context extensions]]


context lock

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

\tableofcontents

\section{Idea}

In [[modal type theory]], a *context lock* is an operation on [[contexts]] used to define the [[syntax|syntactical]] [[inference rules]] for [[modalities]], and is an alternative to [[split contexts]] or [[left division]] for that purpose.

\section{Related concepts}

* [[modality]]

* [[modal type theory]]

* [[split context]]

* [[left division in modal type theory]]

\section{References}

* [[Daniel Gratzer]], [[G. Alex Kavvos]], [[Andreas Nuyts]], [[Lars Birkedal]]: _Multimodal Dependent Type Theory_, Logical Methods in Computer Science **17** 3 (2021) lmcs:7713 [[arXiv:2011.15021](https://arxiv.org/abs/2011.15021), doi:10.46298/lmcs-17(3:11)2021]

* [[Mike Shulman]], *Semantics of multimodal adjoint type theory* ([arXiv:2303.02572](https://arxiv.org/abs/2303.02572))

[[!redirects context lock]]
[[!redirects context locks]]


context-free grammar

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

# Contents
* table of contents
{:toc}

## Idea

The notion of context-free grammar, now used in [[linguistics]], [[computer science]] and [[mathematics]], was introduced in the works of [[Noam Chomsky]].

## Traditional definition

We write $X + Y$ for the [[disjoint union]] of two sets and use vector notation and the Kleene star $\vec{v} \in X^\star$ to denote sequences in the [[free monoid]].

A context-free grammar is a tuple $(\Sigma, X, R, s)$ where $\Sigma$ and $X$ are finite sets called the _vocabulary_ (also called the _terminals_) and the _non-terminals_ respectively, $R \subseteq X \times (X + \Sigma)^\star$ is a finite set of _production rules_ and $s \in X$ is called the _start symbol_.

The _language_ of a context-free grammar is given by $L(G) = \{ \vec{u} \in V^\star \vert s \to_R \vec{u} \}$ where the rewriting relation $(\to_R) \subseteq (V + X)^\star \times (V + X)^\star$ is traditionally defined as the transitive closure of the following directed graph:

$$
\big\{ (\vec{u} x \vec{w}, \vec{u v w}) \quad \vert \quad \vec{u}, \vec{w} \in (V + X)^\star, (x, \vec{v}) \in R \big\}
$$

## With string diagrams

One may redefine $L(G) = \big\{ \vec{u} \in \Sigma^\star \vert \C_G(s, \vec{u}) \neq \emptyset \big\}$ where $C_G$ is the free [[monoidal category]] with:

* generating objects the [[disjoint union]] $\Sigma + X$,
* generating arrows the production rules $(x, \vec{v}) \in R$ with $dom(x, \vec{v}) = x$ and $cod(x, \vec{v}) = \vec{v}$.

That is, a string $\vec{u} \in \Sigma^\star$ is _grammatical_ whenever there exists an arrow from the start symbol $s$ to $\vec{u}$ in $C_G$. Arrows in $C_G$ may be encoded as a _syntax tree_, seen as a special case of a [[string diagram]], e.g.:

![syntax tree for "Colorless green ideas sleep furiously"](https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Syntax_tree.svg/280px-Syntax_tree.svg.png)

Note that context-free grammar is weakly equivalent to [[Lambek|Lambek's]] [[pregroup grammar]] i.e. they generate the same class of languages, see:

*  {#BuszkowskiMoroz08} Wojciech Buszkowski, Katarzyna Moroz, _Pregroup Grammars and Context-free Grammars_, Computational Algebraic Approaches to Natural Language, Polimetrica (2008) ([pdf](https://pdfs.semanticscholar.org/1924/30f2252b6e0a7f982a3ae69a3ccf9c2981c0.pdf))

## Early sources

Here is list of some of the original references in English and also of their Russian translations.

* N. Chomsky, _Three models for the description of language, I. R. E.
Trans. PGIT 2 (1956), 113—124. (Русский перевод: Хомский Н., Три
модели для описания языка, Кибернетический сборник, вып. 2, ИЛ 1961, 237-266)
* N. Chomsky, _On certain formal properties of grammars_, Information
and Control __2__ (1959), 137—267; _A note on phrase structure grammars_, Information andControl __2__ 1959_, 393—395. (Хомский К, Заметки o грамматиках непосредственных составляющих. Кибернетический
сборник, вып. 5, ИЛ, 1962, 312—315.)
* N. Chomsky, _On the notion «Rule of Grammar»_, Proc. Symp. Applied
Math., 12. Amer. Math. Soc. (1961). (Хомский Н.,
О понятии «правило грамматики», сб. Новое в лингвистике, вып. 4,
«Прогресс», 1965, стр. 34—65.)
* N. Chomsky, _Context-free grammars and pushdown storage_, Quarterly
Progress Reports, № 65, Research Laboratory of Electronics, M. I. T.,
1962.
* N. Chomsky, _Formal properties of grammars_, in Handbook of Mathemati-
Mathematical Psychology, 2, ch. 12, Wiley, 1963, p. 323—418. (Хомский Н., Формальные свойства грамматик, Кибернетический
сборник, вып. 2, «Мир», 1966, 121—-230.)
* N. Chomsky, The logical basis for linguistic theory, Proc. IX-th Int.
Cong. Linguists (1962). (Хомский Н" Логические
основы лингвистической теории, сб. Новое в лингвистике, вып. 4,
«Прогресс», 1965, 465—-575.)
* N. Сhоmskу, G. A. Miller G. A.. Finite state languages, Information and
Control __1__ (1958), 91—-112. (Хомский Н., Миллер Д., Языки с конечным числом состояний, Кибернетический сборник, вып. 4, ИЛ, 1962, 231—-255.), _Introduction to the formal analysis of natural languages_. Handbook of Mathematical Psychology __2__, Ch. 12, Wiley, 1963, 269—-322 (Введение в формальный анализ естественных языков, Кибернетический сборник, вып. 1, «Мир», 1965, стр. 229—-290.)
* N. Chomsky, M. P. Schützenberger, _The algebraic theory of
context-free languages_, in: Computer programming and formal systems, 118–161 North-Holland 1963, Amsterdam [MR152391](http://www.ams.org/mathscinet-getitem?mr=152391) (Кибернетический сборник __3__, 195--242, 1966)

## Modern literature

* wikipedia: [context-free language](http://en.wikipedia.org/wiki/Context-free_language)
* A. V. Aho, J. D. Ullman, _The theory of parsing, translation, and compiling_, vol 1, Parsing; vol. 2, Compiling. Prentice Hall, 1972.
* A. V. Aho, J. D. Ullman, _Principles of compiler design_, Addison-Wesley, 1977.

Some chapters in "Handbook of formal language theory" (3 vols.), G. Rozenberg, A. Salomaa (eds.), Springer 1997:

* Jean-Michel Autebert, Jean Berstel, Luc Boasson, _Context-free languages and push-down automata_, vol. 1, ch. 3

## Related entries

* [[formal grammar]]
* [[context-sensitive grammar]]
* [[mildly context-sensitive grammar]]
* [[pregroup grammar]]
* [[dependency grammar]]

[[!redirects context-free grammar]]
[[!redirects context-free grammars]]
[[!redirects context free grammar]]
[[!redirects context free grammars]]
[[!redirects context-free language]]
[[!redirects context-free languages]]
[[!redirects context free language]]
[[!redirects context free languages]]


context-sensitive grammar

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

# Contents
* table of contents
{:toc}

## Idea

Context-sensitive grammar is a kind of [[formal grammar]] with an expressive power between that of [[context-free grammar]] and [[formal grammar#unrestrictedgrammar|unrestricted grammar]], they are at the second level of [[Chomsky hierarchy]].

## Definition

A context-sensitive grammar is a tuple $(V, X, R, s)$ where $V$ and $X$ are disjoint finite sets of terminal and non-terminal symbols with $s \in X$, $R$ is a finite set of rules $\alpha x \gamma \to \alpha \beta \gamma$ for a non-terminal symbol $x \in X$, strings of symbols $\alpha, \gamma \in (V + X)^\star$ and a non-empty string $\beta \in (V + X)^+$.

In order to make the [[context-free language|context-free languages]] a proper subset of the context-sensitive languages, the rule $s \to 1$ is allowed for $1$ the empty string.

## Example

Any [[context-free language]] is also context-sensitive. The language $L=\{a^m b^m c^m| m\geq 1\}$ is context-sensitive but a classical application of the [[pumping lemma]] shows that $L$  is not context-free.

## Properties

The parsing problem, i.e. given a grammar $G$ and a string $\alpha \in V^\star$ decide whether $\alpha \in L(G)$ is [[PSPACE]]-complete. Thus, it is suspected to be infeasible to solve efficiently. This motivated the definition of [[mildly context-sensitive grammar]].

## Related entries

* [[context-free grammar]]

* [[mildly context-sensitive grammar]]

[[!redirects context-sensitive grammars]]
[[!redirects context sensitive grammar]]
[[!redirects context sensitive grammars]]


contextual fibrancy

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

\linebreak

\tableofcontents

## Idea

In a [[categorical model of dependent type theory]], a [[type]] $T$ in [[context]] $\Gamma$ is called [[fibrant type|fibrant]] if the [[projection]] morphism $p : \Gamma.T \to \Gamma$ from the [[context extension|extended context]], is a [[fibration]].

When we want to study or use fibrancy within type theory, we may be interested in the following properties, which do not necessarily hold:

1. The [[dependent product type|Π-type]] is fibrant if its [[codomain]] is,

2. The [[fibrant replacement]] [[monad]] commutes with substitution,

3. A type in context $\Gamma$ is fibrant if and only if its [pullback]] (substitution) along any morphism/cell $\gamma : y W \to \Gamma$ from a representable context $y W$, is fibrant.

The first property is just practical.
The second property allows the fibrant replacement to be internalized as a [[monad]] on types, so that fibrancy can be defined internally as being an [[algebra over a monad | algebra for that monad]].
The third property allows a direct construction of a [[Hofmann-Streicher universe]] ([Hofmann and Streicher](#HofmannStreicher)) of fibrant types.
It should be straightforward to prove that this is equivalent with the second property, and with the property that the fibrant replacement can be taken cellwise.

One way to guarantee that properties 1-2 hold, is by defining fibrations as the right class of an [[algebraic weak factorization system]] generated by a class of *generating left maps* whose pullback is again a left map ([Nuyts 2020](#Nuyts2020)). (So a fibration is any morphism that right-lifts any generating left map, and a left map is any morphism that left-lifts any fibration.)

Important notions of fibrancy violate the properties above:

* Kan fibrancy as used in models of HoTT. The problem is that a filling of a horn or open box takes place above a cell that is not part of that horn or open box.
* [[Segal condition | Segal]] fibrancy as one would like to use in models of directed type theory, for the same reason.

For this reason, [Boulier and Tabareau](#BoulierTabareau2021) introduced contextual Kan fibrancy. A type $T$ in a context $\Gamma.\Theta$ is contextually Kan fibrant in context $\Gamma$ if it has fillers for open boxes whose "open" dimension is $\Gamma$-homogeneous, i.e. if it lifts diagrams of the following shape:
\begin{xymatrix}
\sqcup
\ar[r] \ar[d]
& \Gamma.\Theta.T
\ar[d]
\\
\square
\ar[r] \ar[d] \ar@{.>}[ru]
& \Gamma.\Theta
\ar[d]
\\
{-}
\ar[r]
& \Gamma
\end{xymatrix}

This is an instance of a _damped_ algebraic weak factorization system ([Nuyts 2020](#Nuyts2020)).
We can also build a damped AWFS for the Segal condition, where at most one of the morphisms-to-be-composed can be $\Gamma$-heterogeneous:
\begin{xymatrix}
\Lambda_n
\ar[r] \ar[d]
& \Gamma.\Theta.T
\ar[d]
\\
\Delta_n
\ar[r] \ar[d] \ar@{.>}[ru]
& \Gamma.\Theta
\ar[d]
\\
\Delta_1
\ar[r]
& \Gamma
\end{xymatrix}
Both damped AWFSs have the property that they are generated by a class of generating left "damped arrows" (which are just sequences of two composable arrows) whose pullbacks are again left damped arrows, and the result is that we get a form of properties 1-2 (Nuyts [2018](#Nuyts2018), [2020](#Nuyts2020)) for these notions of contextual fibrancy.

## References

* {#Nuyts2020} [[Andreas Nuyts]], _Contributions to Multimode and Presheaf Type Theory, chapter 8: Fibrancy_, [PhD thesis](https://lirias.kuleuven.be/retrieve/581985), KU Leuven, Belgium, 2020

* {#Nuyts2018} [[Andreas Nuyts]], [_Robust Notions of Contextual Fibrancy_](https://anuyts.github.io/files/abstract-robust.pdf), HoTT/UF, 2018

* {#HofmannStreicher} [[Martin Hofmann]], [[Thomas Streicher]], _Lifting Grothendieck Universes_ , ms. University of Darmstadt (unpublished). ([pdf](http://www.mathematik.tu-darmstadt.de/~streicher/NOTES/lift.pdf))

* {#BoulierTabareau2021} [[Simon Boulier]], [[Nicolas Tabareau]], _Model structure on the universe of all types in interval type theory_, MSCS, vol. 31, 2021 ([doi:10.1017/S0960129520000213](https://doi.org/10.1017/S0960129520000213))


continuation monad

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

#Contents#
* table of contents
{:toc}

## Idea

In a [[category]] with [[internal homs]] $[-,-]$, given an [[object]] $S$, the _continuation monad_ is the [[endofunctor]] $X \mapsto [[X, S], S]$.

In [[computer science]] this [[monad (in computer science)]] is used to model [[continuation-passing style]] of programming, and therefore this is called the _continuation monad_. The idea here is that a morphism $f \colon X \to Y$ in the [[Kleisli category]] of the continuation monad, hence a morphism in the original category of the form $X\longrightarrow [[Y,S],S]$ is much like a map from $X$ to $Y$ only that instead of "returning" its output directly it instead feeds it into a given function $Y \to S$ which hence _continues_ the computation.

## Algebras

\begin{proposition}
On the [[category of sets]], the functor $[-,S] \colon\mathbf{Set}^{op}\to \mathbf{Set}$ is [[monadic]] (with left adjoint $[-, S]^{op} \colon \mathbf{Set} \to \mathbf{Set}^{op}$) whenever ${|S|}\geq 2$.
\end{proposition}

Thus the [[Eilenberg-Moore algebras]] of the continuation monad are equivalent to [[complete atomic Boolean algebras]], as the category of these is equivalent to the opposite of the category of sets.

(This incidentally illustrates the fact that a category can be monadic over $\mathbf{Set}$ in multiple ways. In other words, one should not refer to a *category* $C$ as monadic over $Set$, unless everyone agrees to which "forgetful functor" $U\colon C \to \mathbf{Set}$ is being considered -- better is to refer to a *functor* as monadic.)

+-- {: .proof}
###### Proof
This boils down to the assertion that such an $S$ is an injective [[cogenerator]] in the category of sets. It is injective because it is a [[retract]] of an [[injective object]] $2^S$ (using the fact that the subobject classifier $2$ is injective), and it cogenerates because there is an injection $2 \to S$ and $2$ cogenerates.

In more detail: an object $S$ is (internally) *injective* if $[-, S]: Set^{op} \to Set$ takes (coreflexive) [[equalizers]] in $Set$ to [[coequalizers]] in $Set$. The subobject classifier $2$ is injective (by, for example, the proof of Paré’s theorem for constructing finite colimits in an elementary topos). Since $S \times -: Set \to Set$ preserves [[connected limits]] such as equalizers, we have that $[S \times -, 2] \cong [-, 2^S]$ takes equalizers to coequalizers, i.e., $2^S$ is injective for any $S$. Then $S$, being a retract of $2^S$, has the property that $[-, S]$ takes equalizers in $Set$ to coequalizers, i.e., preserves coequalizers $Set^{op} \to Set$.

Also $[-, S]$ reflects isomorphisms. This is because isomorphisms in $Set$ are precisely epi-monos, and $S$ being an internal cogenerator means exactly that $[-, S]$ is faithful, and faithful functors reflect monos and epis.

Since $[-, S]$ preserves coequalizers and reflects isomorphisms, we conclude that it is monadic by Beck's crude [[monadicity theorem]].
=--

## Examples

* [[double negation monad]]

* [[dualizing object in a closed category]]

* [[extensive quantity]]

## Related concepts

* [[selection monad]]

* [[continuation-passing style]]

* [[maybe monad]]

* [[state monad]]

## References

As a [[monad in computer science]]:

* {#Moggi91} [[Eugenio Moggi]], Exp. 1.1 in: *Notions of computation and monads*, Information and Computation, **93** 1 (1991) [doi:10.1016/0890-5401(91)90052-4, [pdf](http://www.disi.unige.it/person/MoggiE/ftp/ic91.pdf)]

* {#Milewski19} [[Bartosz Milewski]], §21.2.7 in: *Category Theory for Programmers*, Blurb (2019) [[pdf](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.3.0/category-theory-for-programmers.pdf), [github](https://github.com/hmemcpy/milewski-ctfp-pdf), [webpage](https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/), [ISBN:9780464243878](https://www.blurb.com/b/9621951-category-theory-for-programmers-new-edition-hardco)]

* [[Tarmo Uustalu]], p.27 of: *Monads and Interaction Lecture 1* [[pdf](https://cs.ioc.ee/~tarmo/mgs21/mgs1.pdf), [[Uustalu-Monads1.pdf:file]]], lecture notes for [MGS 2021](https://staffwww.dcs.shef.ac.uk/people/G.Struth/mgs21.html) (2021):

The continuation monad is discussed in the generality of [[linear type theory]] as the linear [[double negation monad]] in

* [[Paul-André Melliès]], Nicolas Tabareau, _Linear continuation and duality_, 2008 ([pdf](http://hal.inria.fr/docs/00/33/91/56/PDF/linear-control.pdf))

* [[Paul-André Melliès]], _The parametric continuation monad_, Mathematical Structures in Computer Science, Festschrift in honor of Corrado Böhm for his 90th birthday (2013). ([[MelliesContinuation.pdf:file]])

The characterization of algebras is Proposition 10 of

* [[Martin Hyland]], [[Paul Blain Levy]], [[Gordon Plotkin]] and [[John Power]], _Combining algebraic effects with continuations_, Theoretical Computer Science, 2007. ([pdf](https://homepages.inf.ed.ac.uk/gdp/publications/comb_cont_journal.pdf))

A characterisation of ([[enriched monad|enriched]]) monads isomorphic to continuation monads is given in:

* Christopher Townsend, _When are enriched strong monads double exponential monads?_, Bulletin of the Belgian Mathematical Society-Simon Stevin 23.2 (2016): 311-319.

[[!redirects continuation monads]]


continuation-passing style

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

#Contents#
* table of contents
{:toc}

## Idea

In the theory of [[programming languages]], the idea that procedures may be modelled as mathematical [[functions]] is useful for compositional reasoning, but at first seems to rule out programming with more sophisticated [[monad in computer science|control structures]] which can actually be very useful in practice.  For example, we might want to write an integer division routine which raises an [[exception]] on division-by-zero, or a procedure that lazily computes the first satisfying assignment to a boolean formula while giving the user the ability to query to obtain additional ones.

Now, an "impure" functional language such as OCaml lets us do some of this directly.  For example, we can write the following code for integer division:

    let divide : int -> int -> int =
      fun x y -> if y == 0 then raise Division_by_zero else x / y

However, it should be said that the type ascription "int -> int -> int" is a bit misleading here (or at least open to misinterpretation), since divide cannot actually be modelled as a set-theoretic function of type $\mathbb{Z} \to \mathbb{Z} \to \mathbb{Z}$.

_Continuation-passing style_ (or CPS) is a very general technique that allows one to express many different seemingly "non-functional" patterns of control flow within the confines of pure functional programming.  The basic idea is that a procedure in CPS takes an additional argument (often named "$k$") representing the _continuation_, a functional abstraction of the context in which the procedure is used (or "the rest of the computation").  Whenever a procedure in "direct style" would return a value ($v$), the corresponding procedure in CPS instead invokes the continuation with that value ($k(v)$).  However, it is the fact that the procedure has explicit access to the continuation which also allows for the possibility of exceptional behaviors, typically by throwing away the continuation or by invoking it more than once.

To transform the example above into continuation-passing style, first we must fix an "answer type", that is, the return type of the continuation. In this case, to allow for the possibility of raising a division-by-zero error, the answer type should be a [[pointed type]].  For example, we could take

    type ans = int option

Now, our division routine can be written as follows in CPS:

    let divide_cps : int -> int -> (int -> ans) -> ans =
      fun x y k -> if y == 0 then None else k (x / y)

Observe that we have replaced the (somewhat misleading) original type

    divide : int -> int -> int

by the more complicated type

    divide_cps : int -> int -> (int -> ans) -> ans

This may be recognized as a form of [[double negation translation]], and indeed under [[propositions as types]], the classical negative translations correspond to different forms of continuation-passing style transformations.  Under this correspondence, the "answer type" corresponds to the type of [[false|absurdity]] $\bot$, but as the above example shows, we almost never want the answer type to be [[empty type|empty]].  As such, CPS translation is best understood in terms of the negative translations from [[classical logic]] into [[minimal logic]], where the type of falsehood $\bot$ behaves like a fixed atomic proposition.

## Continuation semantics

Whereas "continuation-passing style" refers to a programming technique, the term "continuation semantics" refers to a certain way of assigning [[denotational semantics]] to programs, originally in the context of [[domain theory]] [(Strachey & Wadsworth 1974)](#StracheyWadsworth74).  The two are very closely related, though, especially if one views the meaning function ⟦-⟧ in a denotational semantics as a "definitional interpreter" in the sense of [(Reynolds 1972)](#Reynolds72).  In that case, giving a continuation semantics for a language corresponds to writing the definitional interpreter in continuation-passing style.

## Related concepts

* [[Response category]]

* [[continuation monad]]

* [[programming language]]

* [[functional programming]]

* [[Yoneda lemma]]

* [[negative translation]]

* [double-negated principle of excluded middle](excluded+middle#DoubleNegatedPEM)

* [[monad (in computer science)]]

* [[defunctionalization]], often used in conjunction with continuation-passing style

## References

Some early and historical references for continuations and continuation-passing style include:

* {#Reynolds72} [[John C. Reynolds]]. Definitional interpreters for higher-order programming languages. In _Proceedings of the ACM National Conference_, 1972. ([pdf](http://surface.syr.edu/cgi/viewcontent.cgi?article=1012&context=lcsmith_other))

* {#StracheyWadsworth74} Christopher Strachey and C. P. Wadsworth. Continuations: A Mathematical Semantics for Handling Full Jumps, Technical Monograph PRG-11, Oxford, 1974. ([pdf](http://repository.readscheme.org/ftp/papers/plsemantics/oxford/strachey-continuations.PDF))

* {#Reynolds74} [[John C. Reynolds]]. On the Relation Between Direct and Continuation Semantics.  Second Colloquium on Automata, Languages, and Programming, Saarbrucken, July 29 - August 2, 1974. ([pdf](http://repository.cmu.edu/cgi/viewcontent.cgi?article=2287&context=compsci))

* {#Plotkin75} [[Gordon Plotkin]]. Call-by-name, call-by-value, and the lambda-calculus. _Theoretical Computer Science_ 1 (1975), 125-159. ([pdf](http://homepages.inf.ed.ac.uk/gdp/publications/cbn_cbv_lambda.pdf))

* [[John C. Reynolds]]. The Discoveries of Continuations. _LISP and Symbolic Computation_ 6 (1993), 233-247. ([pdf](http://www.math.bas.bg/bantchev/place/iswim/conti-disco.pdf))

Other references include:

* [[Hayo Thielecke]]. _Categorical Structure of Continuation Passing Style_. PhD thesis, University of Edinburgh, 1997. ([pdf](http://www.lfcs.inf.ed.ac.uk/reports/97/ECS-LFCS-97-376/ECS-LFCS-97-376.pdf))

* [[Josh Berdine]], [[Peter O'Hearn]], [[Uday Reddy]], [[Hayo Thielecke]]. Linear Continuation-Passing. _Higher-Order and Symbolic Computation_ 15 (2002), 181-208. ([pdf](http://research.microsoft.com/pubs/64171/LinCP.pdf))

* [[Ulrich Schöpp]]. On the Relation of Interaction Semantics to Continuations and Defunctionalization. _Logical Methods in Computer Science_ Vol.10(4:10)2014, 1-41. ([pdf](http://arxiv.org/pdf/1410.4980.pdf))

* Wikipedia, _[Continuation-passing style](http://en.wikipedia.org/wiki/Continuation-passing_style)_

For the connection between CPS and the [[Yoneda lemma]], see

* Ralf Hinze, Daniel W. H. James, _Reason Isomorphically!_, sections 3-4, [pdf](http://www.cs.ox.ac.uk/ralf.hinze/publications/WGP10.pdf)

* Mike Stay, _The Continuation Passing Transform and the Yoneda Embedding_, [blog post](https://golem.ph.utexas.edu/category/2008/01/the_continuation_passing_trans.html)

[[!redirects continuation passing style]]

[[!redirects continuation-passing]]
[[!redirects continuation passing]]

[[!redirects continuation semantics]]


continued fraction

# Contents #
* table of contents
{: toc}

## Idea

A _continued fraction_ (*Kettenbrüche* in German) is a finite or infinite expression of the form

$$x = a_0 + \frac{b_1}{a_1 + \frac{b_2}{a_2 + \frac{b_3}{a_3 + \cdots}}} $$

with convergence under appropriate conditions. The most commonly used form is where $b_i = 1$ for all $i$; such is called a _regular_ continued fraction.

Every real number may be (more or less[^fine]) uniquely expressed as a finite or infinite regular continued fraction for which all the $a_i$ are [[integers]] and $a_i \gt 0$ for $i \gt 0$. The expression is an infinite continued fraction if and only if the real number is [[irrational number|irrational]], so that there is a [[bijection]]

$$\mathbb{Z} \times (\mathbb{N}_+)^{\mathbb{N}_+} \to \{irrationals\}$$

$$(a_0; a_1, a_2, \ldots) \mapsto x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + \cdots}}}.$$

[^fine]: For rational numbers, there are two continued fraction representations, agreeing up to say $a_{n-1}$, but ending with $a_n \gt 1$ in one case and $a_n - 1, a_{n+1} = 1$ in the other (since after all $a_n = (a_n - 1) + 1/1$). This can be an annoyance, but there are various workarounds.

This is in fact a [[homeomorphism]] if we endow the left side with the [[product topology]] and the right side with the [[subspace]] topology, regarding the set of irrationals as a subset of the real line (with its standard [[topological space|topology]]). (The space of irrationals becomes in this way a kind of prototypical chaotic dynamical system, where the dynamics on the product space is given by a shift map.)

## Coalgebraic formulation

We can describe the basic theory of continued fractions for real numbers in terms of dynamics of [[fractional linear transformations]] on the real [[projective line]] $\mathbb{P}^1(\mathbb{R})$, with the point at infinity playing a special role. From an nPOV, it is useful to cast this in [[coalgebra of an endofunctor|coalgebraic]] terms.

Let us denote by $\mathbf{R}$ the [[interval]] $[1, \infty]$ (considered as a subset of the projective line $\mathbb{P}^1(\mathbb{R})$); if $1 \leq x \lt \infty$, we let $fl(x)$ be the floor of $x$ (the greatest integer such that $fl(x) \leq x$). We denote by $\mathbb{N}_+$ the set of positive integers (so, excluding $0$). Put $\mathbf{1} = \{\ast\}$, and define a map

$$\alpha: \mathbf{R} \to \mathbf{1} + \mathbf{R} \times \mathbb{N}_+$$

where $\alpha(x) = ((x - fl(x))^{-1}, fl(x))$ if $x \lt \infty$, and $\alpha(\infty) = \ast$. This defines a coalgebra of the functor $F: Set \to Set$ defined by the formula

$$F(X) = \mathbf{1} + X \times \mathbb{N}_+.$$

Let us define $x \in \mathbf{R}$ to be _rational_ if it is a quotient of two integers (including $0$, so $1/0 = \infty$ is here considered "rational"). Define $\tau: \mathbf{R} \to \mathbf{R}$ by $\tau(x) = (x - fl(x))^{-1}$ if $x \lt \infty$, and $\tau(\infty) = \infty$.

+-- {: .num_lemma #rational}
###### Lemma
An element $x \in \mathbf{R}$ is rational if and only if there exists $n \geq 0$ such that $\tau^n(x) = \infty$.
=--

+-- {: .proof}
###### Proof
Only if: this is clear for $x = \infty$. Otherwise, write $x = p/q$ in lowest terms, so that $p, q \gt 0$ and $\gcd(p, q) = 1$. We argue by strong induction on $q$, where we have $p = n q + r$ for which $n = fl(p/q)$ and $0 \leq r \lt q$ by the Euclidean algorithm. If $r = 0$, then $\tau(x) = \infty$ and we are done; otherwise $\tau(p/q) = q/r$ where $q \gt r \gt 0$ and $\gcd(q, r) = 1$, whence $\tau^n (q/r) = \infty$ for some $n$ by inductive hypothesis, and then $\tau^{n+1}(p/q) = \infty$.

If: argue by induction on the least $n$ such that $\tau^n(x) = \infty$. If $n = 0$, then $x = \tau^0(x) = \infty$ is rational. Otherwise, we have

$$x = fl(x) + 1/\tau(x)$$

and since $\tau^{n-1}(\tau(x)) = \infty$, we have that $\tau(x)$ is rational by inductive hypothesis, and therefore $x$ is also rational.
=--

+-- {: .num_lemma #converge}
###### Lemma
If $(a_0, a_1, a_2, \ldots) \in (\mathbb{N}_+)^{\mathbb{N}}$ is any sequence of positive integers, then there is a unique $x \in \mathbf{R}$ such that $a_n = fl(\tau^n(x))$ for all $n \geq 0$. (This $x$ must be irrational by Lemma \ref{rational}.)
=--

+-- {: .proof}
###### Proof
In a nutshell, $x$ is given by the continued fraction

$$x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + \cdots}}} $$

and so it is really only a matter of proving that this continued fraction converges, i.e., that its truncations $p_n/q_n = [a_0, a_1, \ldots, a_n]$, namely the rational numbers $p_n/q_n$ with $\tau^{n+1}(p_n/q_n) = \infty$ and $fl(\tau^k(p_n/q_n)) = a_k$ for $0 \leq k \leq n$, form a [[Cauchy sequence]].

For $a \in \mathbb{N}_+$, let $a \cdot -: \mathbf{R} \to \mathbf{R}$ denote the fractional linear transformation $x \mapsto a + \frac1{x}$. We have

$$[a] = a \cdot \infty, \qquad [a_0, a_1, \ldots, a_n] = a_0 \cdot [a_1, \ldots, a_n]$$

and since $a \cdot -: \mathbf{R} \to \mathbf{R}$ is monotone decreasing, we have that $a_0 \cdot (a_1 \cdot -)$ is monotone increasing. Thus some easy inductions establish

* $$[a_0] \lt [a_0, a_1, a_2] \lt [a_0, a_1, a_2, a_3, a_4] \lt \ldots$$

* $$[a_0, a_1] \gt [a_0, a_1, a_2, a_3] \gt [a_0, a_1, a_2, a_3, a_4, a_5] \gt \ldots$$

* $$[a_0, \ldots, a_{2n}] \lt [a_0, \ldots, a_{2n}, a_{2n+1}]$$

so that $\sup_n [a_0, \ldots, a_{2n}] \leq \inf_n [a_0, \ldots, a_{2n+1}]$, and all that remains is to show $lim_{m\to \infty} {|p_m/q_m - p_{m+1}/q_{m+1}|} = 0$.

In fact we have

$$\left|\frac{p_m}{q_m} - \frac{p_{m+1}}{q_{m+1}}\right| = \frac{{|p_m q_{m+1} - p_{m+1}q_m|}}{q_m q_{m+1}} = \frac1{q_m q_{m+1}}$$

The second equation is proved by induction on the length $j$ of continued fraction representations $[x_1, \ldots, x_j]$. Put $[a_1, \ldots, a_m] = \frac{q_m}{r_m}$ and $[a_1, \ldots, a_{m+1}] = \frac{q_{m+1}}{r_{m+1}}$, with all fractions in reduced form, and suppose as induction hypothesis that ${|q_m r_{m+1} - q_{m+1}r_m|} = 1$. The fractional linear transformation $a_0 \cdot -$, being represented by the integral [[matrix]]

$$A_0 = \left(
\array{
a_0 & 1 \\
1 & 0
}\right)$$

with [[determinant]] $-1$, takes $(\pm 1)$-determinant matrices to $(\pm 1)$-determinant matrices. In particular it takes the determinant of absolute value $1$ on the left to one on the right,

$$\left(
\array{
q_m & q_{m+1} \\
r_m & r_{m+1}
}\right) \; \; \stackrel{A_0}{\mapsto} \; \; \left(
\array{
p_m & p_{m+1} \\
q_m & q_{m+1}
}\right),$$

and this completes the induction.

Here $p_m = a_0 q_m + r_m \gt 2r_m$ and $p_{m+1} = a_0 q_{m+1} + r_{m+1} \gt 2r_{m+1}$. Similarly, if

$$[a_2, \ldots, a_m] = \frac{r_m}{s_m}, \qquad [a_2, \ldots, a_{m+1}] = \frac{r_{m+1}}{s_{m+1}},$$

then $q_m \gt 2s_m$ and $q_{m+1} \gt 2s_{m+1}$. Thus we have

* $${|[a_2, \ldots, a_m] - [a_2, \ldots, a_{m+1}]|} = \frac1{s_m s_{m+1}}$$

* $${[a_0, \ldots, a_m] - [a_0, \ldots, a_{m+1}]|} = \frac1{q_m q_{m+1}} \lt \frac1{(2s_m)(2s_{m+1})} = \frac1{4s_m s_{m+1}}$$

so that by induction, ${|p_{2m}/q_{2m} - p_{2m+1}/q_{2m+1}|} \leq \frac1{4^m}$, completing the proof that the infinite continued fraction converges.
=--

+-- {: .num_remark}
###### Remark
It may be tempting to believe that this $F$-coalgebra structure makes $\mathbf{R}$ the terminal coalgebra. That is unfortunately not correct because the coalgebra structure $\xi: \mathbf{R} \to F(\mathbf{R})$ is not an isomorphism (it fails to be surjective because no element maps to $(1, 1, \infty)$ under $\xi$; this is the fact that the standard continued fraction for $2$ is just $2$ and not $1 + 1/1$). However, [below](#half-open) we will exhibit a different kind of coalgebra making half-open intervals a terminal coalgebra.
=--

## Topology of infinite continued fractions

Let $\mathbf{I}$ be the set of irrational elements $x \in \mathbf{R}$. The results above imply that $\mathbf{I}$ equipped with the map

$$\mathbf{I} \to \mathbf{I} \times \mathbb{N}_+: x \stackrel{\alpha}{\mapsto} ((x - fl(x))^{-1}, fl(x))$$

is a terminal coalgebra for the functor $- \times \mathbb{N}_+: Set \to Set$, isomorphic to $(\mathbb{N}_+)^{\mathbb{N}}$ under the coalgebra structure

$$(\mathbb{N}_+)^{\mathbb{N}} \stackrel{(\mathbb{N}_+)^{\langle s, o\rangle}}{\to} (\mathbb{N}_+)^{\mathbb{N} + \mathbf{1}} \cong (\mathbb{N}_+)^\mathbb{N} \times \mathbb{N}_+.$$

Endow $\mathbf{I}$ with the subspace topology coming from $\mathbf{R}$ (as one-point [[compactification]] of $[1, \infty)$), and $(\mathbb{N}_+)^{\mathbb{N}}$ with the topology of the [[product]] of countably many [[discrete spaces]] $\mathbb{N}$.

+-- {: .num_lemma}
###### Lemma
The coalgebra isomorphism $\mathbf{I} \to (\mathbb{N}_+)^{\mathbb{N}}$ is a [[continuous map]].
=--

+-- {: .proof}
###### Proof
It suffices to check that each composite

$$\mathbf{I} \to (\mathbb{N}_+)^{\mathbb{N}} \stackrel{\pi_n}{\to} \mathbb{N}_+$$

is continuous. Following the notation $\tau(x) = (x - fl(x))^{-1}$ above, this composite map is $x \mapsto fl(\tau^n(x))$, so it suffices to check that $fl: \mathbf{I} \to \mathbb{N}_+$ is continuous, or in other words that

$$\{x \in \mathbf{I}: fl(x) = m\}$$

is [[open set|open]] for every $m$. This set is clearly open, being the intersection $(m, m+1) \cap \mathbf{I}$ (noting that of course $m \notin \mathbf{I}$!).
=--

+-- {: .num_lemma}
###### Lemma
The coalgebra isomorphism $\psi: (\mathbb{N}_+)^{\mathbb{N}} \to \mathbf{I}$ is continuous.
=--

+-- {: .proof}
###### Proof
This merely says that for each sequence of positive integers $(a_0, a_1, \ldots)$ and for a given $\epsilon \gt 0$, that there exists $N$ such that
${|\psi(a_0, a_1, \ldots) - \psi(b_0, b_1, \ldots)|} \lt \epsilon$ provided
$a_i = b_i$ for $i = 0, \ldots, N$. But this just follows the proof of convergence of continued fractions given in the proof of Lemma \ref{converge}.
=--

+-- {: .num_corollary}
###### Corollary
The coalgebra isomorphism $\psi$ is a homeomorphism.
=--

This makes the space of irrationals $\mathbf{I}$ the terminal coalgebra for the endofunctor $- \times \mathbb{N}_{+}: Top \to Top$.

## Examples and further results

+-- {: .num_example}
###### Example
A continued fraction $[a_0, a_1, \ldots]$ is periodic, i.e., satisfies $a_i = a_{k+i}$ for some fixed $k$ and all $i$, only if it is the root of a quadratic equation $a_0 \cdot (a_1 \cdot \ldots (a_{k-1} \cdot x)\ldots ) = x$ (where the operator on the left can be written as a fractional linear transformation). Every quadratic irrational is _eventually_ periodic (i.e., for some $k$ and $N$ we have $a_i = a_{k+i}$ for all $i \geq N$): the proof is part of the theory of [[Pell's equation]].
=--

This example shows that periodic points are [[dense subset|dense]] in the discrete [[dynamical system]] $\alpha^{-1}: \mathbf{I} \times \mathbb{N}_+ \to \mathbf{I}$, since quadratic surds are dense among all irrationals.

Part of the story of Pell's equation is that an integer solution to $x^2 - D y^2 = \pm 1$, with $D$ is a square-free integer, is a pair $(x, y) = (p, q)$ where $p/q$ is a reduced form fraction (a rational approximant) represented by a finite truncation of the continued fraction of $\sqrt{D}$.

+-- {: .num_example}
###### Example
The quadratic irrational represented by $[1, 1, 1, \ldots]$ is the [[golden ratio]] $\Phi = \frac1{2}(1 + \sqrt{5}) \approx 1.618\ldots$. Many properties of this constant (as manifested both mathematically and physically) are due to this fact and the fact that of all infinite continued fractions, the convergence rate of its rational approximants is slowest for this number.
=--

+-- {: .num_remark}
###### Remark
Were the Pythagoreans the first to do coalgebra? John Baez remarks in [Week 265](http://math.ucr.edu/home/baez/week265.html) that the Pythagoreans were fascinated by pentagrams, and drops hints that they may have been aware of the continued fraction for the golden ratio and also the fact that $\Phi$ is irrational. The Pythagorean pentagram on display in Baez's page clearly indicates an infinite stream of pentagons which can be viewed as a coalgebraic behavior stream. And indeed if $\Phi$ were a rational number $p/q$ with $p, q$ as small as possible, then we would also have $\Phi = q/(p-q)$, with numerator and denominator even smaller, contradiction. This is analogous to one of the famous proofs of irrationality of $\sqrt{2}$: if $\sqrt{2} = p/q$, then also $\sqrt{2} = (2q - p)/(p-q)$, which generates an infinite descending stream of positive numerators and denominators, contradiction.
=--

+-- {: .num_example}
###### Example
The continued fraction for [[Euler's number]] [[e]] is given by

$$[2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, \ldots].$$

A proof may be found [here](http://topologicalmusings.wordpress.com/2008/08/04/continued-fraction-for-e/).
=--

+-- {: .num_example}
###### Example
The regular continued fraction for [[pi|Ludolph's number]] $\pi$ displays no regularity, but other types of continued fractions do. See [Wikipedia](http://en.wikipedia.org/wiki/Pi#Continued_fractions).
=--

The popularity of certain rational approximations to [[pi]] such as $\frac{22}{7}$ or $\frac{355}{113}$ can be explained by the fact that these are rational approximants obtained by truncating the regular continued fraction for $\pi$, coupled with the following result.

+-- {: .num_theorem}
###### Theorem
The truncation $p/q = [a_0, a_1, \ldots, a_n]$ is a "best" rational approximant to the irrational number $\beta = [a_0, a_1, \ldots]$, in the sense that it minimizes the distance to $\beta$ among all rational numbers $r/s$ whose denominators $s$ are less than or equal to $q$.
=--

The space of irrationals $\mathbf{I}$ may be identified with the space of irrationals in the interval $(0, 1)$ (by taking their reciprocals). Here the action $\alpha^{-1}: Irr(0, 1) \times \mathbb{N} \to Irr(0, 1)$ is generated by the shift map $\tau: x \mapsto x^{-1} \; mod \; 1$.

+-- {: .num_theorem}
###### Theorem
The map $\tau$ is topologically mixing. Moreover, if $Irr(0, 1)$ is equipped with the [[probability measure]]

$$\mu(I) = \frac1{\log 2} \int_I \frac{d x}{1+x},$$

then $\tau$ is an [[ergodic transformation]] with respect to $\mu$, making $(Irr(0, 1), \tau, \mu)$ an ergodic system.
=--

A proof may be found [here](http://www.mathematik.uni-wuerzburg.de/~christ/nihon.pdf).

### Reals as terminal coalgebra {#half-open}

Returning to the theme of coalgebras, an alternative form of continued fractions may be used to exhibit a half-open real interval as a terminal coalgebra. The alternative continued fractions are of the form

$$x = a_0 - \frac{1}{a_1 - \frac{1}{a_2 - \frac{1}{a_3 - \cdots}}} $$

where the $a_i$ are suitable integers; for now we will call them _antiregular_ continued fractions (not knowing what others call them), or acf's for short. These acf's correspond to [[fractional linear transformations]] belonging to $PSL_2(\mathbb{Z})$, generated by the transformations $z \mapsto -1/z$, $z \mapsto z-n$.

Consider the linear order $\mathbb{R}_{\geq 1}$ (this time excluding $\infty$); let $\beta(x)$ be the smallest integer _strictly_ greater than $x$.

Consider the endofunctor $G$ on the category of [[linearly ordered sets]] $X$ where $G(X)$ is the set $\mathbb{N} \times X$ equipped with the ordinal product or [[lexicographic order]]. (Actually we replace $\mathbb{N}$ with the set of integers greater than or equal to $2$.) Define a map

$$\xi: \mathbb{R}_{\geq 1} \to \mathbb{N}_{\geq 2} \times \mathbb{R}_{\geq 1}$$

where $\xi(x) = (\beta(x), -\frac1{x - \beta(x)})$.

+-- {: .num_theorem #PavPratt}
###### Theorem
**([Pavlovic-Pratt](#PP))**
The map $\xi$ defines a $G$-coalgebra structure $\xi: \mathbb{R}_{\geq 1} \to G(\mathbb{R}_{\geq 1})$, making $\mathbb{R}_{\geq 1}$ the terminal $G$-coalgebra.
=--

### Rationals as initial algebra

Now let $\mathbf{Q} = \{r \in \mathbb{Q}: r \gt 1\} \cup \{\infty\}$, the set of rational elements of $\mathbf{R}$. On the category of linear orders, let $H$ be the endofunctor $H(X) = G(X) + 1$, the [[ordinal sum]] where $G$ was defined [above](#half-open).

The initial $H$-algebra is the free monoid $\mathbb{N}_+^\ast$, [[lexicographic order|lexicographically ordered]] according to the convention given in this [remark](/nlab/show/lexicographic+order#antidictionary) (where initial segments of words $w$ are _greater_ than $w$).

On the other hand, we have an $H$-algebra structure on $\mathbb{Q}$, a function

$$\xi:\; (\mathbb{N}_+ \times \mathbf{Q}) + 1 \to \mathbf{Q}$$

where for $\ast \in 1$, $\xi(\ast) = \infty$, otherwise $\xi(n, r) = n+1-1/r$. Observe that this is indeed a monotone map between the linear orders $H(\mathbf{Q}) \to \mathbf{Q}$.

+-- {: .num_theorem #initial}
###### Theorem
$(\mathbf{Q}, \xi)$ is the initial $H$-algebra.
=--

The inverse map $\xi^{-1}: \mathbf{Q} \to H(\mathbf{Q})$ is in essence another form of the acf (see above): if $ceil(s)$ denotes the least integer greater than or equal to $s$, then $\xi^{-1}(\infty) = \ast$, and otherwise

$$\xi^{-1}(r) = (ceil(r) - 1, -1/(r - ceil(r)).$$

The $H$-algebra isomorphism $\mathbb{N}_+^\ast \to \mathbf{Q}$ takes a finite word $a_0 a_1 \ldots a_n$ to the rational number to which the acf

$$a_0 + 1 - \frac{1}{a_1 + 1 - \frac{1}{a_2 + 1 - \frac{1}{a_3 + 1 - \cdots}}}$$

evaluates.

## Rational tangles

Among the many uses of continued fractions, we mention a quite remarkable one due to John H. Conway.

+-- {: .num_defn}
###### Definition
A _rational tangle_ is a subspace $T$ of the 3-disk $D^3$ obtained by embedding two arcs

$$(\alpha_1, \alpha_2): I + I \to D^3,$$

with endpoints on the boundary $\partial D^3$, such that the pair of spaces $(D^3, T = \alpha_1(I) + \alpha_2(I))$ is homeomorphic to the pair $(D^2 \times I, \{x, y\} \times I)$, with $x, y \in D^2$ distinct points. Two rational tangles $S, T$ are _isotopic_ if there exists an orientation-preserving homeomorphism $(D^3, S) \to (D^3, T)$ that is the identity on $\partial D^3$.
=--

Conventionally, rational tangles (or more general 2-tangles) are exhibited by tangle diagrams placed within a disk (with appropriate over- and under-crossings), say a unit disk ${|z|} \leq 1$ in the complex plane, with endpoints situated at primitive $8^{th}$ roots of unity $\exp((2k+1)i\pi/8)$; these endpoints are indicated by their directions NE, NW, SW, SE. There is a trivial 2-tangle with a chord from NE to NW and another from SE to SW; this is denoted $[0]$. Two operations that can be used to generate further 2-tangles are

* "Turn" (rotate the disk through 90 degrees counterclockwise),

* "Twist" (insert a "horizontal" twist that interchanges NE and SE, which can be a positive twist or a negative twist depending on convention).

+-- {: .num_theorem}
###### Theorem
**(Conway)**
The set of isotopy classes of rational tangles is in bijection with the set of rational elements $q \in \mathbb{Q} \cup \{\infty\}$, in such a way that if $[q]$ is the isotopy class corresponding to $q$, then $[-1/q]$ is the class corresponding to a turn of $[q]$, and $[1+q]$ is the class corresponding to a positive twist of $[q]$.
=--

In particular, every rational tangle can be brought back to the trivial tangle $[0]$ by a series of (positive) twists and turns, and every rational tangle is isotopic to the tangle obtained by applying a 180 degree counterclockwise turn to it. A very readable account of this result may be found in an article by Kauffman and Lambropoulou, [here](http://arxiv.org/pdf/math/0311499.pdf).

It should be remarked that the twist and turn operations correspond to group elements in $PSL_2(\mathbb{Z})$ (cf. the article [[Moebius transformation]], in particular the remarks on the surjective homomorphism $B_3 \to PSL_2(\mathbb{Z})$ where $B_3$ is the braid group on $3$ strands):

$$turn = \left(
\array{
0 & 1 \\
-1 & 0
}\right), \qquad pos.twist = \left(
\array{
1 & 1 \\
0 & 1
}\right)$$

John Baez asks a question about this in [TWF228](http://math.ucr.edu/home/baez/week228.html), and reports on an answer in [TWF229](http://math.ucr.edu/home/baez/week229.html). He returns to this topic in an illuminating comment [here](http://golem.ph.utexas.edu/category/2014/04/the_modular_flow_on_the_space.html#c046316).

David Corfield speculates at the [Café](http://golem.ph.utexas.edu/category/2011/01/coalgebraic_tangles.html) that the infinite tangles mentioned by [Kauffman and Lambropoulou](#KL), as limits of rational tangles, might be viewed as belonging to a coalgebraic completion of the collection of rational tangles (along the lines of seeing the terminal coalgebra $\mathbf{R}$ as a coalgebraic completion of the initial algebra $\mathbf{Q}$, as in Theorem \ref{initial}).

## The Calkin-Wilf and Stern-Brocot trees

The Calkin-Wilf tree is an infinite complete binary tree whose vertices are in 1-to-1 correspondence with the positive rational numbers.  The tree may be defined inductively by the following very simple recipe (Calkin & Wilf, 2000):

* $1/1$ is at the top of the tree, and
* each vertex $i/j$ has two children: its left child is $i/(i+j)$ and its right child is $(i+j)/j$

For example, the first four levels of the Calkin-Wilf tree are:

$$
\frac{1/1}{
 \frac{1/2}{
  \frac{1/3}{1/4\quad 4/3}
  \quad
  \frac{3/2}{3/5\quad 5/2}}
 \quad
 \frac{2/1}{
  \frac{2/3}{2/5\quad 5/3}
  \quad
  \frac{3/1}{3/4\quad 4/1}}}
$$

Remarkably, every positive rational number appears exactly once in the tree, and so performing a breadth-first traversal ($1/1, 1/2, 2/1, 1/3, 3/2, \dots$) gives an enumeration of the positive rationals with no double-counting.  In fact, Calkin and Wilf proved that the $n$th number in this sequence is equal to

$$\frac{b(n)}{b(n+1)}$$

where $b(n)$ is the number of ways of writing the integer $n$ as a sum of powers of 2, each power being used at most twice.

By locating a positive rational $q$ in the Calkin-Wilf tree and describing the path to $q$ from the root as a sequence of binary choices, one generates a string of bits which may be interpreted as an "uncompressed" representation of the continued fraction of $q$.  In turn, compressing this path by counting the number of repeated bits (i.e., by performing a "run-length encoding") is a way of reconstructing the continued fraction.  This is perhaps easier to see if we first express the two operations returning the left and right children of a vertex $x$ equivalently as

$$
\begin{aligned}
L(x) &= \frac{1}{1 + \frac{1}{x}} \\
R(x) &= 1 + x
\end{aligned}
$$

from which it follows that

$$
\begin{aligned}
L^a(x) &= \frac{1}{a + \frac{1}{x}} \\
R^a(x) &= a + x
\end{aligned}
$$

Now, suppose a positive rational $q$ has continued fraction $[a_0,\dots,a_n]$, assuming without loss of generality that $n$ is odd (we allow for $a_n = 1$).  Then the path from 1 to $q$ in the Calkin-Wilf tree begins by taking $a_n - 1$ steps to the left, followed by $a_{n-1}$ steps to the right, $a_{n-2}$ steps to the left, and so on, ending with $a_0$ steps to the right.  In other words,

$$q = R^{a_0}L^{a_1}\dots R^{a_{n-1}} L^{a_n-1} 1$$

For example:

$$
\begin{aligned}
2/5 & = LLR(1) = \frac{1}{2 + \frac{1}{1 + 1}} \\
12/7 &= RLRRL(1) = 1 + \frac{1}{1 + \frac{1}{2 + \frac{1}{1 + \frac{1}{1}}}}
\end{aligned}
$$

Finally, the Calkin-Wilf tree gives a simple algebraic characterization of the positive rationals, namely as an initial object in the category of pointed modules for the free monoid on two elements $\{L,R\}$.  Given any such module $X$ and point $x \in X$, there is a unique module homomorphism $\mathbb{Q}^+ \to X$ sending $1$ to $x$, defined as follows: given a positive rational $q$, locate $q$ on the Calkin-Wilf tree, and then retrace the path from $1$ to $q$ in $X$, beginning at $x$ and applying the actions $L : X \to X$ and $R : X \to X$ as appropriate.

The Calkin-Wilf tree was first described in a 2000 paper by Neil Calkin and Herbert Wilf, "Recounting the rationals", but is closely related to the much older Stern-Brocot tree, another arrangement of the positive rationals with the special property that the values are ordered from left to right.  Here are the first four levels of the Stern-Brocot tree:

$$
\frac{1/1}{
 \frac{1/2}{
  \frac{1/3}{1/4\quad 2/5}
  \quad
  \frac{2/3}{3/5\quad 3/4}}
 \quad
 \frac{2/1}{
  \frac{3/2}{4/3\quad 5/3}
  \quad
  \frac{3/1}{5/2\quad 4/1}}}
$$

In fact, each tree may be obtained from the other by reversing the paths from the root (e.g., $2/5 = LLR(1)$ is reached from the root of the Stern-Brocot tree by going down left twice and then right once).

## Constructive aspects

The construction of a continued fraction from an arbitrary [[real number]] relies on the [[limited principle of omniscience]] to define the [[floor]]; it is not acceptable in [[constructive mathematics]].  Nevertheless, using the usual constructive meaning of [[rational number]] and [[irrational number]] (as well as [[convergence]] in the real numbers), we have that a continued fraction (involving [[natural numbers]]) represents a rational number iff it is finite and an irrational number iff it is infinite; and every rational or irrational number (if positive) is so representable.  Constructively, we simply cannot say that every real number is either rational or irrational.

Now, just because a real number has an expansion as a continued fraction, that doesn\'t mean that it must be rational or irrational.  In general, a continued fraction expansion (according to the coalgebraic formulation) is given by a [[stream]] of natural numbers, and a stream is not necessarily finite (so a [[list]]) or infinite (so a [[sequence]]).  However, a stream that is not finite must be infinite; accordingly, a real number that is not rational must be irrational *if* it has a continued fraction; even this is not constructively valid without the continued fraction.

## References

* Wikipedia, _[Continued fraction](http://en.wikipedia.org/wiki/Continued_fraction)_

* Claude Brezinski, _Continued fractions and Padé approximants_, North-Holland 1991. ([vendor](http://www.amazon.com/Continued-Fractions-Pade-Approximants-Brezinski/dp/0444881697))

* A. Ya. Khinchin, _Continued fractions_, U. Chicago Press 1964.

* Ilan Vardi, _Continued fractions from Euclid to the present day_, unpublished manuscript ([web](http://chronomaitre.org/ContinuedFractions.pdf))

* [[Louis Kauffman]] and Sofia Lambropoulou, _On the classification of rational tangles_, arXiv ([web](http://arxiv.org/pdf/math/0311499.pdf)).
 {#KL}

Dan Piponi wrote a series of posts on his blog "A Neighborhood of Infinity", using the programming language Haskell to illustrate some of the connections between continued fractions, rational tangles and linear operators:

* Dan Piponi, "Untangling with Continued Fractions" ([Part 0](http://blog.sigfpe.com/2008/08/untangling-with-continued-fractions.html), [Part 1](http://blog.sigfpe.com/2008/08/untangling-with-continued-fractions_16.html), [Part 2](http://blog.sigfpe.com/2008/08/untangling-with-continued-fractions_23.html), [Part 3](http://blog.sigfpe.com/2008/08/untangling-with-continued-fractions_31.html), [Part 4](http://blog.sigfpe.com/2008/09/untangling-with-continued-fractions.html), [Part 5](http://blog.sigfpe.com/2008/10/untangling-with-continued-fractions.html)).

The material on half-open intervals as terminal coalgebras was first given by Pavlović and Pratt,

* [[Dusko Pavlovic]] and [[Vaughan Pratt]], _On coalgebras of real numbers_, Electronic Notes in Theoretical Computer Science, Volume 19 (1999), 103–117. ([web](http://www.sciencedirect.com/science/article/pii/S1571066105802725?np=y))
 {#PP}

A type-theoretic formalization of the rationals in [[Coq]] based on the Stern-Brocot/Calkin-Wilf representation is described in:

* Milad Niqui and Yves Bertot, _QArith: Coq Formalisation of Lazy Rational Arithmetic_, INRIA report RR-5004, November 2003. ([web](http://hal.inria.fr/inria-00077041/))

Their library includes two implementations of the field operations: 1. a "strict" implementation (in the programming languages sense) in which the operations are performed by first converting continued fractions to ordinary fractions, applying the usual algorithms for arithmetic, and then converting back, and 2. a "lazy" implementation operating directly on continued fractions, in which the operations only need to inspect a portion of the input stream in order to determine a portion of the output stream.  This latter approach is based on ideas originally due to Gosper:

* Bill Gosper, ["Continued fraction arithmetic"](http://hack.org/mc/writings/hackerdom/hakmem/cf.html), MIT AI, Memo 239 HAKMEM, 1972.  (Also described in more detail in [this unpublished note](http://www.tweedledum.com/rwg/cfup.htm).)

[[!redirects continued fractions]]


continuous algebra

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

# Continuous algebras

* automatic table of contents goes here
{:toc}

## Definition

Let $T$ be a [[lax-idempotent 2-monad]] or pseudo 2-monad on a 2-category $K$, and $A$ a pseudo $T$-algebra witnessed by a [[left adjoint]] $a : T A \to A$ to the unit $\eta_A : A \to T A$.  We say that $A$ is a **continuous $T$-algebra** if $a : T A \to A$ has a further left adjoint, forming an [[adjoint triple]].

Note that every free $T$-algebra $T B$ is continuous: it is a property of lax-idempotent 2-monads that the multiplication $\mu_B:T T B \to T B$ has left adjoint $T\eta_B$.

For the rest of this page we will say "$T$-algebra" to mean "pseudo $T$-algebra".

## Examples

* If $T A = Ind(A)$ is the [[ind-completion]] monad on [[Cat]], whose algebras are categories with [[filtered colimits]], then a continuous $T$-algebra is precisely a [[continuous category]].  This is the origin of the name.

* Specializing the previous example, if $T A = Idl(A)$ is the [[ideal]] completion monad on [[Poset]], whose algebras are posets with [[directed joins]], then a continuous $T$-algebra is a [[continuous poset]].

Note also that if an [[adjoint functor theorem]] applies (such as if $A$ and $T A$ are [[complete lattices]], or [[locally presentable categories]]), then $A$ is continuous if and only if $T A \to A$ is a [[continuous functor]].  This provides another justification for the name.

* For instance, if $T$ is the downset monad on [[Poset]], whose algebras are [[suplattices]], then continuous algebras are called [[constructive completely distributive lattices]].  Assuming the [[axiom of choice]], these are equivalent to [[completely distributive lattices]].  See ([WoodFawcett](#WoodFawcett)).

* If $T$ is the free small-cocompletion monad on $Cat$, whose algebras are [[cocomplete categories]], then continuous algebras are in particular [[completely distributive categories]].  The converse only holds if an adjoint functor theorem applies.

* If $T$ is the [[presheaf category]] "monad", whose "algebras" are [[total categories]], then the "continuous algebras" are [[totally distributive categories]].  The scare quotes are because this example is not really a monad for size reasons.

* If $T$ is the [[free cocompletion]] monad under coproducts, then continuous algebras are "locally connected" in a sense: the extra left adjoint $A \to T A$ decomposes every object as a coproduct of connected ones.

* If $T$ is a "filter monad" on topological spaces, which can be regarded as a "presheaf category" type construction with topological spaces thought of as [[generalized multicategories]] (specifically, as [[relational beta-modules]]), then continuous $T$-algebras are called "distributive spaces" in ([Hofmann](#Hofmann)).

## Characterizations

+--{: .num_theorem #Retract}
###### Theorem
Consider the following conditions on a $T$-algebra $A$:

1. $A$ is a continuous algebra.
1. $A$ is a [[coreflective subcategory|coreflective]] sub-$T$-algebra of a free $T$-algebra.
1. $A$ is a retract (up to isomorphism) of a free $T$-algebra.

Then (1) $\Rightarrow$ (2) $\Rightarrow$ (3), and both converses hold if idempotent 2-cells split in the underlying 2-category.
=--
+--{: .proof}
###### Proof
This is B1.1.15 in the [[Elephant]].  If the algebra structure $a : T A \to A$ has a left adjoint $\ell$, then $\ell \dashv a$ is an adjunction in the 2-category of $T$-algebras (since any left adjoint between $T$-algebras is a $T$-morphism).  And since the counit of $a\dashv \eta_A$ is an isomorphism, the unit of $\ell \dashv a$ is an isomorphism, by the theorem on [fully faithful adjoint triples](adjoint+triple#FullyFaithFulAdjointTriples).  This shows (1) $\Rightarrow$ (2), and (2) $\Rightarrow$ (3) is obvious.  For the converse, see the [[Elephant]].
=--

+--{: .num_theorem #Comonadicity}
###### Theorem
Let $G$ be the pseudo [[2-comonad]] on the 2-category $T Alg$ of $T$-algebras induced by the free-forgetful adjunction.  Then $G$ is lax-idempotent, and a $T$-algebra $A$ is continuous if and only if it is a $G$-coalgebra.
=--
+--{: .proof}
###### Proof
Lax-idempotence of $G$ follows from the fact that the adjunction $K \rightleftarrows T Alg$ is a [[lax-idempotent 2-adjunction]].  Therefore, the $G$-coalgebras are those $T$-algebras for which the counit $G A \to A$ has a left adjoint in $T Alg$.  However, this counit is just the structure map $T A \to A$ of $A$, and since $T$ is lax-idempotent, any left adjoint between $T$-algebras is automatically a (pseudo) $T$-morphism.
=--

This theorem is proven in ([Kock](#Kock)) in the special case when the base 2-category is a [[(1,2)-category]] (the result is due to [[Bart Jacobs]]).

## Related pages

* [[lax-idempotent 2-monad]]
* [[adjoint triple]]

## References

* [[Richard Wood]] and Barry Fawcett, "Constructive complete distributivity. I". Math. Proc. Camb. Phil. Soc. (1990), 107, 81
 {#WoodFawcett}

* [[Anders Kock]], "Monads for which structures are adjoint to units", JPAA 104 (1992).
 {#Kock}

* [[Dirk Hofmann]], "Duality for distributive spaces".  Theory Appl. Categ. 28 (3) (2013), 66–122, [web site](http://sweet.ua.pt/dirk/).
 {#Hofmann}

[[!redirects continuous algebras]]


continuous category

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

# Continuous categories
* table of contents
{: toc}

## Idea

The notion of _continuous category_ is a [[categorification]] of the notion of _[[continuous poset]]_.  It can be further categorified to a notion of continuous [[(∞,1)-category]].

## Definition

Let $C$ be a [[category]] and $Ind(C)$ its category of [[ind-objects]].  We assume that $C$ has [[filtered colimits]], which is equivalently to say that the restricted [[Yoneda embedding]] $\hat{(-)} : C\to Ind(C)$ has a [[left adjoint]] $\colim$.

+-- {: .num_defn}
###### Definition
A category $C$ with filtered colimits is a **continuous category** if $\colim: Ind(C) \to C$ has a left adjoint.
=--

If $C$ is a [[poset]], then $Ind(C) = Idl(C)$ is its category of [[ideals]].  Thus, a poset is a continuous category exactly when it is a [[continuous poset]].  This definition can be extended to $(\infty,1)$-categories essentially verbatim.

## Examples

* Any finitely [[accessible category]], and hence any [[locally finitely presentable category]], is a continuous category.

* A [[Grothendieck topos]] is a continuous category if and only if it is an [[exponentiable object]] in the 2-category of Grothendieck toposes and [[geometric morphisms]], i.e. an [[exponentiable topos]].

  * If $X$ is a [[stably locally compact locale]] (or more generally a [[metastably locally compact locale]]), then $Sh(X)$ is continuous and hence exponentiable.  It does *not* suffice for $X$ to be locally compact (i.e. for its [[frame of opens]] to be a continuous poset).

  * Similarly, a [[Grothendieck (∞,1)-topos]] is a continuous $(\infty,1)$-category if and only if it is an exponentiable object, in the appropriate sense, in the $(\infty,1)$-category of $(\infty,1)$-toposes and geometric morphisms.

* In general, a [[locally small category]] $C$ is continuous if and only if it is a [[retract]] of a category $Ind(D)$ of [[ind-objects]], where the functors exhibiting the retract preserve [[filtered colimits]] ([Johnstone-Joyal 82, Theorem 2.8](#JohnstoneJoyal82)).

## Wavy arrows

If $C$ is continuous, with $L:C\to Ind(C)$ the left adjoint of $\colim$, and $x,y\in C$, we define a **wavy arrow** $x\rightsquigarrow y$ to be a morphism $\hat{x} \to L(y)$ in $Ind(C)$.  This is a categorification of the [[way-below relation]] on a continuous poset: when $C$ is a poset we have a wavy arrow $x\rightsquigarrow y$ just when $x\ll y$.  But unlike in the posetal case, it is not clear how to define wavy arrows unless $C$ is continuous (whereas $\ll$ can be defined in any poset with directed joins).  However, see [[totally distributive category]].

Since $\colim \hat{x} = x$ and $\colim L(y)=y$, the functor $\colim$ assigns to every wavy arrow a "straight" arrow $x\to y$ in $C$.  Moreover, wavy arrows can be composed: the composite of $f:\hat{x} \to L(y)$ and $g:\hat{y} \to L(z)$ is the composite
$$ \hat{x} \xrightarrow{f} L(y) \xrightarrow{i} \hat{y} \xrightarrow{g} L(z) $$
where $i$ is the [[adjunct]] of the identity $y = \colim \hat{y}$ (or of the identity $\colim L(y) = y$).  This composition is associative.  Thus, we _almost_ have a category whose objects are those of $C$ and whose morphism are wavy arrows --- but it does not have identities.

However, if $\tilde{C}(x,y)$ denotes the set of wavy arrows, then the composition defines a map of [[profunctors]] $\tilde{C} \otimes_C \tilde{C} \to \tilde{C}$ which is in fact an isomorphism.  Combined with the map from wavy arrows to straight ones, this makes $\tilde{C}$ into an idempotent [[comonad]] on $C$ in the bicategory [[Prof]].

## Remark

* Continuous categories can be generalized to [[continuous algebras]] for any [[lax-idempotent 2-monad]].

## The setting of (∞,1)-categories

Continuous [[(∞,1)-categories]] are introduced under the name of __compactly assembled ∞-categories__ in Lurie [SAG](#SAG), §21.1.2.

## Related entries

* [[totally distributive category]]

* [[injective topos]]

* [[domain theory]]

* [[Scott topos]]

## References

* [[Jiří Adámek]], [[F. William Lawvere]], [[Jiří Rosický]], _Continuous categories revisited_ , TAC **11** no.11 (2003) pp.252-282. ([abstract](http://www.tac.mta.ca/tac/volumes/11/11/11-11abs.html))

* {#JohnstoneJoyal82} [[Peter Johnstone]], [[Andre Joyal]], *Continuous categories and exponentiable toposes*, JPAA 25 (1982), [doi (free PDF)](http://dx.doi.org/10.1016/0022-4049%2882%2990083-4)

* [[Mathieu Anel]], Damien Lejay, _Exponentiable Higher Toposes_ , arXiv:1802.10425 (2018). ([abstract](https://arxiv.org/abs/1802.10425))

* {#SAG} [[Jacob Lurie]], _[[Spectral Algebraic Geometry]]_.

[[!redirects continuous category]]
[[!redirects continuous categories]]
[[!redirects wavy arrow]]
[[!redirects wavy arrows]]


continuous cohomology

#Contents#
* table of contents
{:toc}

## Idea

The term "continuous cohomology" is often used as shorthand for the "naive" version of [[group cohomology]] of [[topological groups]] which uses [[cocycles]] of the form known for [[discrete groups]] and just requires them to be [[continuous functions]]. For "actual" group cohomology of topological groups one needs to in addition perform certain [[resolutions]] before considering continuous cocycles.

See at _[Lie group cohomology -- Topological group cohomology](Lie+group+cohomology#TopologicalGroupCohomology)_ for details and references.

## Related concepts

* [[real homotopy theory]]

## References

On [[real homotopy theory]] ([[rational homotopy theory]] over the [[real numbers]]) using [[continuous cohomology|continuous]] [[real cohomology]]:

* {#BrownSzczarba95} [[Edgar Brown]], [[Robert H. Szczarba]], _Real and Rational Homotopy Theory_, Chapter 17 in: *[[Handbook of Algebraic Topology]]*,  Elsevier, 1995 869-915 ([doi:10.1016/B978-044481779-2/50018-3](https://doi.org/10.1016/B978-044481779-2/50018-3), [ZB](http://mirrors.library.cornell.edu/ZMATH/zmath/en/zmath/search/?an=0865.55009))

* {#BrownSzczarba90} [[Edgar Brown]], [[Robert H. Szczarba]], _Continuous cohomology and Real homotopy type II_ Asterisque 191, Societe Mathematique De France (1990) ([numdam:AST_1990__191__45_0](http://www.numdam.org/book-part/AST_1990__191__45_0))

with emphasis on globally [[Kan complex|Kan fibrant]] [[simplicial topological spaces]] (such as [[simplicial topological groups]]);

* {#BrownSzczarba89} [[Edgar H. Brown]], [[Robert H. Szczarba]], *Continuous cohomology and real homotopy type* , Trans. Amer. Math. Soc. 311 (1989), no. 1, 57 ([doi:10.1090/S0002-9947-1989-0929667-6](https://doi.org/10.1090/S0002-9947-1989-0929667-6),  [pdf](http://www.ams.org/journals/tran/1989-311-01/S0002-9947-1989-0929667-6/S0002-9947-1989-0929667-6.pdf))

with arbitrary [[fundamental group]]:

* [[Edgar Brown]], [[Robert H. Szczarba]], *Real and rational homotopy theory for spaces with arbitrary fundamental group*, Duke Mathematical Journal 71. (1993): 229-316 ([doi:10.1215/S0012-7094-93-07111-6](https://projecteuclid.org/journals/duke-mathematical-journal/volume-71/issue-1/Rational-and-real-homotopy-theory-with-arbitrary-fundamental-groups/10.1215/S0012-7094-93-07111-6.short))

[[!redirects continuous group cohomology]]


continuous field of C*-algebras

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Topology
+--{: .hide}
[[!include topology - contents]]
=--
#### Operator algebra
+--{: .hide}
[[!include AQFT and operator algebra contents]]
=--
#### Bundles
+-- {: .hide}
[[!include bundles - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

A _continous field of $C^\ast$-algebras_ is a kind of topological [[bundle]] of $C^\ast$-algebras: A [[topological space]] $X$ and a [[C*-algebra]] $A_x$ for each point $ x \in X$, such that these algebras vary continuously, in some sense,  as $x$ varies in $X$. When $X$ is thought of as a [[topological groupoid]] with only [[identity morphisms]], this may be understaood as a special case of [[Fell bundles]] over $X$.

## Applications

### In strict deformation quantization

In [[C* algebraic deformation quantization]] continuous fields of $C^\ast$-algebras over subspaces of the standard [[interval]] (tyically $\{1 , \frac{1}{2}, \frac{1}{3}, \cdots, 0\} \hookrightarrow [0,1]$) which at $\hbar = 0$ are [[Poisson algebras]] constitute [[non-perturbative quantum field theory|non-perturbative]] [[deformation quantizations]] of this Poisson algebra (hence of the [[phase space]] of some [[physical system]] that it represents).

## References

The notion originates with:

* {#Dixmier77} [[Jacques Dixmier]], §10 in: *$C^\ast$-algebras*, North Holland (1977)

An efficient reformulation is due to:

* [[Eberhard Kirchberg]], [[Simon Wassermann]], Def. 1.1 in: *Operations on continuous bundles of $C^\ast$-algebras*, Mathematische Annalen **303** 4 (1995) 677-698 [[eudml:165387](https://eudml.org/doc/165387), [[KirchbergWassermann-ContBndlsOfCStarAlgs.pdf:file]]]

See also:

* [[Marius Dadarlat]], *Continuous fields of $C^\ast$-algebras over finite dimensional spaces*, Advances in Mathematics **222** 5 (2009) 1850-1881 [[arXiv:math/0611405](http://arxiv.org/abs/math/0611405), [doi:10.1016/j.aim.2009.06.019](https://doi.org/10.1016/j.aim.2009.06.019)]

[[!redirects continuous fields of C*-algebras]]
[[!redirects continuous field of C-star algebras]]
[[!redirects continuous fields of C-star algebras]]

[[!redirects field of C*-algebras]]
[[!redirects fields of C*-algebras]]
[[!redirects field of C-star algebras]]
[[!redirects fields of C-star algebras]]

[[!redirects continuous bundle of C*-algebras]]
[[!redirects continuous bundles of C*-algebras]]
[[!redirects continuous bundle of C-star algebras]]
[[!redirects continuous bundles of C-star algebras]]

[[!redirects bundle of C*-algebras]]
[[!redirects bundles of C*-algebras]]
[[!redirects bundle of C-star algebras]]
[[!redirects bundles of C-star algebras]]