internal logic

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

# Contents
* automatic table of contents goes here
{: toc}

## Idea

One of the most important observations of [[category theory]] is that large parts of mathematics can be [[internalization|internalized]] in any [[category]] with sufficient structure.  The most basic examples of this involve algebraic structures; for instance, a [[group]] can be defined in any category with finite products, and an [[internal category|internal]] [[strict category]] can be defined in any ambient category with [[pullback]]s. For such [[algebraic theory|algebraic]] (or even [[essentially algebraic theory|essentially algebraic]]) structures, which are defined by _operations_ with _equational axioms_ imposed, it suffices for the ambient category to have (usually finite) limits.

However, if we assume that the ambient category has additional structure, then much more of mathematics can be internalized, potentially including [[field]]s, [[local ring]]s, [[finite set]]s, [[topological space]]s, even the field of [[real number]]s.  The idea is to exploit the fact that all mathematics can be written in the language of [[logic]], and seek a way to internalize logic in a category with sufficient structure.

The basic ideas of the internal logic induced by a given [[category]] $C$ are:

* the [[object]]s $A$ of $C$ are regarded as collections of things of a given [[type]] $A$

* the [[morphisms]] $A\to B$ of $C$ are regarded as terms of type $B$ containing a free [[variable]] of type $A$ (i.e. in a [[context]] $x:A$)

* a [[subobject]] $\phi \hookrightarrow A$ is regarded as a _proposition_ ([[predicate]]): by thinking of it as the sub-collection of all those things of type $A$ for which the statement $\phi$ is [[true]]

  * the maximal subobject is hence the proposition that is always true; this is the logical object of [[truth]] $\top \hookrightarrow A$

  * the minimal subobject is hence the proposition that is always false; this is the logical object of [[falsity]] $\bottom \hookrightarrow A$

  * one proposition [[implication|implies]] another if as subobjects of $A$ they are connected by a morphism in the [[poset]] of subobjects: $\phi \Rightarrow \psi$ means $\phi \hookrightarrow \psi$

* Logical operations are implemented by [[universal construction]]s on [[subobject]]s.

  * the conjunction [[and]] is the [[product]] of subobjects (their [[meet]])

  * the [[disjunction]] [[or]] is the [[coproduct]] of subobjects (their [[join]])

  * the [[existential quantifier]] is the [[support]] of the [[dependent sum]] of subobjects

  * the [[universal quantifier]] is the [[dependent product]] of subobjects

and so on.

* A [[dependent type]] over an object $A$ of $C$ may be interpreted as a morphism $B\to A$ whose "fibers" represent the types $B(x)$ for $x:A$.  This morphism might be restricted to be a [[display map]] or a [[fibration]].

Once we formalize the notion of "logical [[theory]]", the construction of the internal logic can be interpreted as a [[functor]] $Lang$ from suitably structured categories to theories.  The morphisms of theories are "interpretations", and so an internalization of some theory $T$ (such as the "theory of groups") into a category $C$ is a morphism of theories $T\to Lang(C)$.

Moreover, the functor $Lang$ has a left [[adjoint functor]]: the [[syntactic category]] $Syn$ of a theory.  Thus, a model of $T$ in $C$ is equally well a functor $Syn(T)\to C$.  Frequently, this adjunction is even an [[equivalence of categories]]; see [[relation between type theory and category theory]].

### Kinds of internal logics in different categories

There are many different kinds of of "logical theories", each of which corresponds to a type of category in which such theories can be internalized (and yields a corresponding adjunction $Syn \dashv Lang$).

|Theory| |Category|
|------|-|--------|
|[[Lawvere theory|Lawvere]] (or "finite product")| |category with [[finite products]]|
|[[cartesian logic|cartesian]]/[[essentially algebraic theory|essentially algebraic]] (or "left exact" or "finite limit")| |[[finitely complete category]]|
|[[minimal logic]]| |[[cartesian closed category]]
|[[regular logic|regular]]| |[[regular category]]|
|[[coherent logic|coherent]]| |[[coherent category]]|
|[[disjunctive logic|disjunctive]]| |[[pre-lextensive category]]|
|[[geometric logic|geometric]]| |[[coherent category|infinitary coherent category]] (aka [[geometric category]])|
|[[constructive logic|constructive]] [[first-order logic|first-order]]| |[[Heyting category]]|
|[[classical logic|classical]] [[first-order logic|first-order]]| |[[Boolean category]]|
|[[extensional type theory|extensional]] [[dependent types]]| |[[locally cartesian closed category]]|
|[[constructive logic|constructive]] [[higher order logic|higher order]]| |[[topos|elementary topos]]|
|[[classical logic|classical]] [[higher order logic|higher order]]| |[[Boolean topos]]|
|[[linear logic]]| |[[symmetric monoidal category]]|
|[[cohesive homotopy type theory|cohesive modal logic]]| |[[cohesive topos]]|

Each type of logic up to and including "geometric" can also be described in terms of [[sketch|sketches]].  Not coincidentally, the corresponding types of category up to and including "geometric" fit into the framework of [[familial regularity and exactness]].  Sketches can also describe theories applicable to categories not even having finite products, such as finite sum sketches, but the type-theoretic approach taken on this page requires at least finite products (or else something closely akin, such as a [[cartesian multicategory]]).

However, there are other sorts of [[internalization]] that do not fit in this framework.  For instance, to describe a [[monoid]] internal to a [[monoidal category]], one needs an internal [[linear logic]].  See [[internalization]] for a discussion of the more  general notion in the context of [[doctrine]]s.

## Internal first-order logic

We begin with the interpretation of internal first-order logic, which is the most used in [[toposes]] and related categories.

### Theories

In this section, what we mean by a _theory_ is a _[[type theory]]_ without dependent types, but with a dependent logic.  This entails the following.

* The [[signature (in logic)|signature]] of the theory consists of

  * Various _[[types]]_ $A,B,C$.  For example, the theory of a group has only one type (group elements), but the theory of a-ring-and-a-module has two types (ring elements and module elements).  There are also generally _type constructors_ that build new types from basic ones, such as product types $A\times B$ and the unit type $1$.

  * The theory will also generally contain _[[function symbol]]s_ such as $f:A\to B$, each with a source and target that are types.  For example, the theory of a monoid has one type $M$, one function symbol $m:M\times M\to M$, and one function symbol $e:1\to M$.  Function symbols of source $1$ are also called _constants_.

  * The theory may also contain _[[relation symbol]]s_ $R:A$, each equipped with a type.  For example, the theory of a [[partial order|poset]] has one type $P$ and one relation $\le:P\times P$.  The most basic relation symbol, which most theories contain, is _[[equality]]_ $=_A:A\times A$ on a type $A$.

* Finally the theory may contain _logical [[axiom]]s_ of the form $\Gamma | \varphi  \vdash \psi$.  Here $\varphi$ and $\psi$ are first-order formulas built up from terms and relation symbols using logical connectives and quantifiers such as $\top,\bot,\wedge,\vee,\Rightarrow,\neg,\forall,\exists$, and $\Gamma$ is a _[[context]]_ which declares the type of every variable occurring in $\varphi$ and $\psi$.

For example, the theory of a group has one type $G$, three function symbols $m:G\times G\to G$, $i:G\to G$, and $e:1\to G$, and axioms
$$\array{
  x:G,y:G,z:G |  \top \vdash m(m(x,y),z) = m(x,m(y,z))\\
  x:G | \top \vdash m(x,i(x)) = e \;\wedge\; m(i(x),x) = e\\
  x:G | \top \vdash m(x,e) = x \;\wedge\; m(e,x) = x.
}$$
This is an _[[equational theory]]_, meaning that each axiom is just one or more equations between terms that must hold in a given context.  For a different sort of example, the theory of a poset has one type $P$, one relation $\le:P\times P$, and axioms
$$\array{
  x:P | \top \vdash x\le x\\
  x:P,y:P | x\le y \;\wedge\; y\le x \vdash x=y\\
  x:P,y:P,z:P | x\le y \;\wedge\; y\le z \vdash x\le z.
}$$

### Categorical semantics {#CategoricalSemantics}

Now suppose that we have a category $C$ with [[finite limit]]s and we want to interpret such a theory internally in $C$. We identify the aspects of the theory with structures in the category by what is called [[categorical semantics]]:

First, for each _type_ in the theory we choose an [[object]] of $C$.  Then for each _function symbol_ in the theory we choose a [[morphism]] in $C$.  And finally, for each _relation_ in the theory we choose a [[subobject]] in $C$. (We always interpret the relation of _equality_ on a type $A$ by the diagonal $A\hookrightarrow A\times A$ in $C$.)  Thus, for example, to interpret the theory of a group in $C$ we must choose an object $G$ and morphisms $m:G\times G\to G$, $i:G\to G$, and $e:1\to G$, while to interpret the theory of a poset, we must choose an object $P$ and a subobject $[\le] \hookrightarrow P\times P$.

Of course, this is not enough; we need to say somehow that _the axioms are satisfied_.  We first define, inductively, an interpretation of every _term_ that can be constructed from the theory by a morphism in $C$.  For example, given an object $G$ and a morphism $m:G\times G\to G$, there are two evident morphisms $G\times G\times G \to G$ which are the interpretations of the two terms $m(m(x,y),z)$ and $m(x,m(y,z))$.

We then define, inductively, an interpretation of every _[[logical formula]]_ that can be constructed from the theory by a _subobject_ in $C$.  The idea is that if $x:A$ is a variable of type $A$ and $\varphi(x)$ is a formula with $x$ as its free variable, then the interpretation of $\varphi(x)$ should be the "subset" $\{x\in A | \varphi(x)\}$ of $A$.  The base case of this induction is that if $t$ is a term interpreted by a morphism $A\to B$ and $R:B$ is a relation symbol, then $R(t)$ is interpreted by the pullback of the chosen subobject $R\hookrightarrow B$ representing $R$ along the morphism $t:A\to B$.  The building blocks of logical formulas then correspond to operations on the posets $Sub(A)$ of subobjects in $C$, as follows.

|Logical operator| |Operation on $Sub(A)$|
|----------------|-|---------------------|
|[[logical conjunction|conjunction]]: $\wedge$| |[[intersection]] (pullback)|
|[[truth]]: $\top$| |[[top element]] ($A$ itself)|
|[[disjunction]]: $\vee$| |[[union]]|
|[[falsity]]: $\bot$| |[[bottom element]] ([[initial object|strict initial object]])|
|[[implication]]: $\Rightarrow$| |[[Heyting algebra|Heyting implication]]|
|[[existential quantification]]: $\exists$| |[[left adjoint]] to [[pullback]]|
|[[universal quantification]]: $\forall$| |[[right adjoint]] to [[pullback]]|

The fact that existential and universal quantifiers can be interpreted as left and right adjoints to pullbacks was first realized by [[Bill Lawvere]].  One way to realize that it makes sense is to notice that in [[Set]], the image of a subset $R\subset A$ under a function $f:A\to B$ can be defined as
$$\{b\in B | (\exists a\in A)(a\in R \;\wedge\; f(a)=b)\},$$
while its "dual image" (the right adjoint to pullback) can be defined as
$$\{b\in B | (\forall a \in A)(f(a)=b \Rightarrow a\in R)\}.$$

Of course, not in all finitely complete categories $C$ do all these operations on subobjects exist.  Moreover, in order for the relationship with logic to be well-behaved, any of the operations we make use of must be *[[pullback stability|stable]] under* (preserved by) pullbacks.  (Pullbacks of subobjects correspond to "innocuous" logical operations such as adding extra unused variables, duplicating variables, and so on, so they should definitely not affect the meaning of the logical connectives.  However, in [[linear logic]] such operations become less innocuous.)

In any category with finite limits, the posets $Sub(A)$ always have finite intersections (given by pullback), including a top element (given by $A$ itself).  Thus in any such category, we can interpret logical theories that use only the connectives $\wedge$ and $\top$.  This includes both the theories of groups and posets considered above.
In a [[regular category]], the existence of pullback-stable [[image]]s implies that the [[base change]] functor $f^*:Sub(B)\to Sub(A)$ along any map $f:A\to B$ has a left adjoint, usually written $\exists_f$, and that these adjoints "commute with pullbacks" in an appropriate sense (given by the [[Beck-Chevalley condition]]).  Thus, in a regular category we can interpret any theory in so-called _[[regular logic]]_, which uses only $\wedge$, $\top$, and $\exists$.

Actually, some instances of $\exists$ can be interpreted in any category with finite limits: if $f$ is itself a monomorphism, then $f^*$ always has a left adjoint, given simply by composition with $f$. On the logical side, this means that we can interpret "provably unique existence" in any category with finite limits.  Logic with $\wedge$, $\top$, and "provably unique existence" is called _cartesian logic_ or _finite-limit logic_.

A [[coherent category]] is basically defined to be a [[regular category]] in which the subobject posets additionally have pullback-stable finite unions.  Thus, in a coherent category we can interpret so-called _coherent logic_, which adds $\vee$ and $\bot$ to [[regular logic]].  Likewise, in an infinitary-coherent (or "geometric") category we can interpret _geometric logic_, which adds infinitary disjunctions $\bigvee_i \varphi_i$ to coherent logic.  Geometric logic is especially important because it is preserved by the inverse image parts of [[geometric morphism]]s, and because any geometric theory has a [[classifying topos]].

On the other hand, in a [[extensive category|lextensive category]], we do not have images or all unions, but if we have two subobjects of $A$ which are _disjoint_ (their intersection is initial), then their coproduct is also their union in $Sub(A)$.  Therefore, in a lextensive category we can interpret _disjunctive logic_, which is cartesian logic plus $\bot$ and "provably disjoint disjunction."  Likewise, in an infinitary-lextensive category we can interpret "infinitary-disjunctive logic."

Finally, in a [[Heyting category]] the base change functors $f^*:Sub(B)\to Sub(A)$ also have right adjoints, usually written $\forall_f$, and it is easy to see that this implies that each $Sub(A)$ is also a [[Heyting algebra]], hence has an "implication" $\Rightarrow$ as well.  (We define "negation" by $\neg \varphi \equiv \varphi \Rightarrow \bot$.)  Thus, in a Heyting category we can interpret all of (finitary, first-order) [[intuitionistic logic]].

Now that we know how to interpret logic, we can say that a **model** of a given theory in $C$ consists of a choice of objects, morphisms, and subobjects for the types, function symbols, and relation symbols as above, such that for each axiom $\Gamma | \varphi \vdash \psi$, we have $[\varphi]\le [\psi]$ in $Sub([\Gamma])$.  Here, $[\Gamma]$ is the product of the objects that correspond to the types of the variables in $\Gamma$, $[\varphi]$ and $[\psi]$ are the interpretations of the formulas $\varphi$ and $\psi$ as subobjects of $[\Gamma]$, and $\leq$ is the relation of subobject inclusion.

It is easy to verify that a model of the theory of a group in $C$ is precisely an internal [[group]] object in $C$, as usually defined.  For instance, the validity of the axiom
$$x:G,y:G,z:G | \top \vdash m(m(x,y),z) = m(x,m(y,z))$$
 means that the [[equalizer]] of the two morphisms $G\times G\times G \to G$ must be all of $G\times G\times G$, or equivalently that those two morphisms must be equal.  The same happens in most other cases.

### The internal logic as a functor

As described above, a model of a given theory $T$ in a category $C$ consists of an assignment

| | | |
|---------------- |-| ---------------------|
|types of $T$|$\to$|objects of $C$|
|function symbols of $T$|$\to$|morphisms of $C$|
|relation symbols of $T$|$\to$|subobjects in $C$|
|axioms of $T$|$\to$|containments in $C$|

This is a sort of [[heteromorphism]] in that it changes the name of things as it operates on them.  We can describe it more simply as a "translation of theories" as follows.

Given a category $C$ (which may be regular, coherent, geometric, Heyting, etc.), we define its **internal type theory (with first-order logic)** $Lang(C)$ to be the theory whose

* types are the objects of $C$;
* function symbols are the morphisms on $C$;
* relation symbols are the subobjects in $C$;
* axioms are the containments in $C$.

Now a model of $T$ in $C$ can be described simply as a morphism of theories (a "translation" or "interpretation")

$$T \to Lang(C).$$

The functor $Lang : Categories \to Theories$ has a left adjoint, the [[syntactic category]] of a theory.  Thus we have a chain of natural isomorphisms

$$ Theories(T,Lang(C)) \cong Models(T,C) \cong Categories(Syn(T),C)). $$

## Soundness and internal reasoning

Internal logic is not just a way to concisely describe internal structures in a category, but also gives us a way to _prove_ things about them by "internal reasoning."  We simply need to verify that the "usual" methods of logical reasoning (for example, from $\varphi\vdash \psi$ and $\psi\vdash \chi$ deduce $\varphi\vdash\chi$) are _internally valid_, in the sense that if the premises are satisfied in some model $C$ (in the example, if $[\varphi]\le [\psi]$ and $[\psi]\le [\chi]$) then so is the conclusion (in the example, $[\varphi]\le [\chi]$).  This is called the _Soundness Theorem_.

It then follows that if we start from the axioms of a theory and "reason normally" within type theory, which in practice amounts to pretending that the types are sets, the function symbols are functions, and the relation symbols are subsets, then anything we prove will still be true when the theory is interpreted in an _arbitrary_ category, not just [[Set]].  For example, by easy equational reasoning from the theory of a group, we can prove that inverses are unique, which is expressed by the logical sequent
$$x:G,y:G,z:G | m(x,y)=e \;\wedge\; m(x,z)=e \vdash y=z.$$
It follows that this is also true, suitably interpreted, as a statement about internal group objects in _any_ category.

There are (at least) three caveats.  Firstly, we must take care to use only the rules appropriate to the fragment of logic that is valid in the particular categories we are interested in.  For example, if we want our conclusions to be valid in any [[regular category]], we must restrict ourselves to reasoning "within regular logic."  Most mathematicians are not familiar with making such distinctions in their reasoning, but in practice most things one would want to say about a regular theory turn out to be provable in regular logic.  (We will not spell out the details of what this means.)  And once we are in a Heyting category, and in particular in a topos, this problem goes away and we can use full first-order logic.

The second, more important, caveat is that the internal logic of all these categories is, in general, [[constructive mathematics|constructive]]. This means that, among other things, the interpretation of $\neg\neg\varphi$ is, in general, distinct from that of $\varphi$, and that $\varphi\vee \neg\varphi$ is not always valid.  So even if we believe that [[classical logic]] (including the principle of [[excluded middle]] and even the [[axiom of choice]]) is "true," as many mathematicians do, there is still a reason to look for proofs that are constructively acceptable, since it is only these which are valid in the internal logic of most categories.  If the category is [[Boolean category|Boolean]] and/or satisfies the internal [[axiom of choice]], however, then this problem goes away, but these fail in many categories in which one wants to internalize (such as many [[Grothendieck topos]]es).

The third caveat is that one must take care to distinguish the _internal_ logic of a category from what is _externally_ true about it.  In general, internal validity is "local" truth, meaning things which become true "after passing to a [[cover]]."  This is particularly important for formulas involving _disjunction_ and _existence_.  For example, an object's being [[projective object|projective]] in the category $C$ is a different statement from its being _internally_ projective, meaning that "$X$ is projective" is true in the internal logic.  Another good example can be found in the different notions of [[finite object]] in a topos.  This problem goes away if the ambient category is [[well-pointed topos|well-pointed]], but well-pointed categories are even rarer than Boolean ones satisfying choice; the only well-pointed Grothendieck topos is [[Set]] itself.

## Completeness, syntactic categories, and Morita equivalence
{#syntactic_categories}

The converse of the Soundness Theorem is called the _Completeness Theorem_, and states that if a sequent $\varphi\vdash\psi$ is valid in every model of a theory, then it is _provable_ from that theory.  This is noticeably less trivial.  In classical first-order logic, where the only models considered are set-valued ones, the completeness theorem is usually proven using [[ultraproduct]]s.  However, in categorical logic there is a more elegant approach (which additionally no longer depends on any form of the [[axiom of choice]]).

The **[[syntactic category]]** $C_T = Syn(T)$ of a theory $T$ was mentioned above, as the left adjoint to the "internal logic functor" $Lang$.  By the [[Yoneda lemma]], the syntactic category $C_T$ contains a "generic" model of the theory.  Moreover, by the construction of $C_T$ (see [[syntactic category]]), the valid sequents in this model are *precisely* those provable from the theory.  Therefore, if a sequent is valid in all models, it is in particular valid in the generic model in $C_T$, and hence provable from $T$.

The universal property of $C_T$ is also sometimes useful for semantic conclusions.  For instance, sometimes one can prove something about the generic model and then carry it over to all models.

Furthermore, if $T$ lives in a sub-fragment of geometric logic (such as regular, coherent, lextensive, or geometric logic), then the [[Grothendieck topos]] of [[sheaf|sheaves]] on $C_T$ for its appropriate (regular, coherent, extensive, or geometric) [[coverage]] contains a $T$-model which is generic for models in Grothendieck toposes: any $T$-model in a Grothendieck topos is its image under the inverse image of a unique [[geometric morphism]].  This topos is called the **[[classifying topos]]** of the theory.

The [[syntactic category]] of a theory can be considered as the "extensional essence" of that theory, since functors out of $C_T$ completely determine the $T$-models in any category $D$ with suitable structure.  It therefore makes sense, in some contexts, to define a _morphism_ of theories to be a functor between their [[syntactic categories]], and an _equivalence_ of theories (sometimes called a _Morita equivalence_) to be an equivalence between their syntactic categories.

A morphism $T\to T'$ between theories, in this sense, induces a functor from $T'$-models in $D$ to $T$-models in $D$, for any category $D$ with suitable structure, in a way which is natural in $D$.  In particular, theories which are "Morita equivalent" in this sense have naturally equivalent categories of models in all categories $D$ with suitable structure; so they have the same "meaning" even though they may be presented quite differently.  (Note that this is a much stronger sort of equivalence than merely having equivalent categories of models in some particular category, such as $Set$.)  Moreover, the fact that the syntactic category is defined "syntactically" means that a morphism $T\to T'$ actually induces a "translation" of the types, functions, and relations of $T$ into those of $T'$.

By first applying various "completion" processes to syntactic categories before asking about equivalence, we obtain coarser notions of equivalence, which only induce equivalences of models in more restricted sorts of categories.  For instance, if we compare the [[exact completion]]s of syntactic categories of regular theories, we obtain a notion of equivalence that induces equivalences of categories of models in all exact categories (not necessarily all regular ones).  Likewise for coherent theories and [[pretopos]]es, and for geometric theories and infinitary pretoposes.  Note, though, that the infinitary-pretopos completion of a (small) geometric theory is in fact already a (Grothendieck) topos, and coincides with the classifying topos considered above.  Thus, passage to classifying toposes is also an instance of this construction, and an equivalence of classifying toposes means that two theories have equivalent categories of models in all toposes.  (This is still much stronger than just having equivalent categories of models in $Set$.)

## Kripke--Joyal semantics

To be written, but see [[Kripke-Joyal semantics]].

## Dependent type theory

We now consider the internal language of a [[locally cartesian closed category]] as a [[dependent type theory]].

+--{: .standout}
Material to be moved here from [[relation between type theory and category theory]].
=--

## Higher-order logic

To be written, but see [[Mitchell–Bénabou language]] for the version in a [[topos]].

## Examples

### Internal logic in $Set$ {#LogicOfSet}

The [[topos]] [[Set]] in [[classical mathematics]] of course has as its internal logic the "ordinary" logic. This is reproduced by following the abstract nonsense as follows:

the [[terminal object]] of [[Set]] is [[generalized the|the]] one-element set ${*}$, the [[subobject classifier]] in [[Set]] is the two-element set $\Omega = \{true, false\}$ equipped with the map

$$
  T : {*} \to \Omega
$$

that picks the element $true$ in $\Omega$. The [[Heyting algebra]] of [[subobject]]s of the [[terminal object]] is the [[poset]]

$$
  L = \{  \emptyset \hookrightarrow {*} \}
$$

consisting only of the two trivial subobjects of $*$, the point itself and the empty set, and the unique inclusion morphism between them. These are classified, respectively, by the [[truth value]]s ${*} \stackrel{true}{\to} \Omega$ and ${*} \stackrel{false}{\to} \Omega$, so that we can also write our [[poset]] of [[subobject]]s of the [[terminal object]] as

$$
  L = \{  false \to true \}
  \,.
$$

The logical operation $\wedge = AND$ is the [[product]] in the [[poset]] $L$. Indeed we find pullback diagrams in $L$

$$
  \array{
    true \times \true = true &\to& true
    \\
    \downarrow
    \\
    true
  }
  \;\;\;
  \;\;\;
  \;\;\;
  \array{
    true \times false = false &\to& false
    \\
    \downarrow
    \\
    true
  }
  \;\;\;
  \;\;\;
  \;\;\;
  \array{
    false \times false = false &\to& false
    \\
    \downarrow
    \\
    false
  }
  \,.
$$

The logical operation $\vee = OR$ is the [[coproduct]] in the [[poset]] $L$. Indeed we find [[pushout]] diagrams in $L$

$$
  \array{
    && true
    \\
    && \downarrow
    \\
    true
    &\to&
    true \coprod \true = true
  }
  \;\;\;\;
  \;\;\;
  \;\;\;
   \array{
    && false
    \\
    && \downarrow
    \\
    true
    &\to&
    true \coprod false = true
  }
  \;\;\;\;
  \;\;\;
  \;\;\;
   \array{
    && false
    \\
    && \downarrow
    \\
    false
    &\to&
    false \coprod false = false
  }
 \,.
$$

The logical operation $\not = NOT$ is given by the [[internal hom]] into the [[initial object]] in $L$:

$$
  \not = hom(-, false) : L^{op} \to L
  \,.
$$

We find the value of the [[internal hom]] by its defining [[adjunction]]. For $hom(true,false)$ we have

$$
  Hom_L(true, hom(true,false)) \simeq Hom_L(true \times true, false) = Hom_L(true, false) = \emptyset
$$

and

$$
  Hom_L(false, hom(true,false)) \simeq Hom_L(false \times true, false) = Hom_L(false, false) = {*}
$$

from which we deduce that

$$
  hom(true,false) = false\,.
$$

Similarly for $hom(false,false)$ we have

$$
  Hom_L(true, hom(false,false)) \simeq
  Hom_L(true \times false, false)
  = Hom_L(false, false) = {*}
$$

and

$$
  Hom_L(false, hom(false,false)) \simeq
  Hom_L(false \times false, false)
  = Hom_L(false, false) = {*}
$$

from which we deduce that

$$
  hom(false,false) = true
  \,.
$$

This way all the familiar logical operations are recovered from the internal logic of the [[topos]] [[Set]].

### Internal logic in a sheaf topos on open subsets
 {#LogicOfPresheaves}

Let $X$ be a [[topological space]] and $Op(X)$ its [[category of open subsets]] and $Sh(X) := Sh(Op(X))$ the [[Grothendieck topos]] of [[category of sheaves|sheaves]] on $X$.

We discuss the internal logic of this sheaf topos (originally [Tarski, 1938 ](#Tarski)).

The [[terminal object]] is the sheaf [[representable functor|represented by]] $X$: the one that is constant on the one-element set

$$
  X : U \mapsto {*}
  \,.
$$

The [[subobject]]s of this object are the [[representable functor|representable presheaves]]

$$
  hom(-,V) : U \mapsto
  \left\{
    \array{
      {*} & | if U \subset V
      \\
      \emptyset & otherwise
    }
  \right.
$$

for $V \in Op(X)$.

+-- {: .num_remark}
###### Remark
In the *[[presheaf]]* topos $PSh(Op(X))= Func(Op(X)^{op},Set)$, the subobjects of $1$ are arbitrary [[sieves]] in $Op(X)$, not just representables.  For instance, for any two open sets $U$ and $V$ there is a sieve consisting of all open sets contained in either $U$ or $V$, which doesn't necessarily contain $U\cup V$.  It's only in the *sheaf* topos $Sh(X)$ that the representables are precisely the subobjects of $1$.
=--

The [[poset]] of [[subobject]]s formed by these is just the [[category of open subsets]] itself:

$$
  L = Op(X)
  \,.
$$

* The logical operation $AND$ is the [[product]] in $Op(X)$: this is the **intersection** of open subsets.

* The logical operation $OR$ is the [[coproduct]] in $Op(X)$: this is the **union** of open subsets.

* The [[internal hom]] in $Op(X)$ is given by

  $$
    hom(U,V) = (U^c \vee V)^\circ
  $$

  (the interior of the union of the complement of $U$
  with V).

  So **negation** is given by sending an open subset
  to the interior of its complement:

  $$
    \not U = hom(U,\emptyset)
    = (U^c \vee \emptyset)^\circ = (U^c)^\circ
    \,.
  $$

In particular we find that in the internal logic of $PSh(X)$ the law of the [[excluded middle]] fails in general, as in general we do not have that

$$
  (\not U) \vee U = true
$$

because $\not U \vee U = (U^c)^\circ \cup U = X \backslash \partial U$ is the total space $X$ without the boundary (frontier) of $U$, and not $true = X$, all of the total space.

Thus, the internal logic of this [[Grothendieck topos|sheaf topos]] is (in general) [[intuitionistic logic]].  As remarked above, this is the case in many toposes.

## Related concepts

* [[internal logic of set theory]]

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

* [[relation between category theory and type theory]]

## References

### General

Most books on topos theory develop some internal logic, at least in the context of a topos.  For example:

* [[Saunders Mac Lane]] [[Ieke Moerdijk]], _[[Sheaves in Geometry and Logic]]_

* Goldblatt, _Topoi: the categorial analysis of logic_

* [[Francis Borceux]], Section 6 of: _[[Handbook of Categorical Algebra]]_, Vol 3: _Categories of Sheaves_, Encyclopedia of Mathematics and its Applications **50**

* [[Peter Johnstone]], Part D of: _[[Sketches of an Elephant]]_

is comprehensive.

Phoa has a presentation of the internal logic of a topos over a dependent type theory, as opposed to other systems which use simple type theory. This is system is not minimal, but close to what is used in practice [PS](http://www.lfcs.inf.ed.ac.uk/reports/92/ECS-LFCS-92-208/ECS-LFCS-92-208.ps.gz).

The book

* [[Bart Jacobs]], _Categorical Logic and Type Theory_

works in the even more general context of [[Grothendieck fibration|fibrations]], allowing us to associate to each object $A$ an arbitrary poset instead of $Sub(A)$.

The book

* [[Paul Taylor]], _[[Practical Foundations of Mathematics]]_

is arguably all about this subject (although you wouldn\'t know it until about Chapter VIII), but from a different perspective.  In particular, Taylor allows us to replace having *all* pullbacks with pullbacks along a pullback-stable class of [[display morphisms]].

A discussion of [[dependent type theory]] as the [[internal language]] of [[locally cartesian closed categories]] is in

* [[R. A. G. Seely]], _Locally cartesian closed categories and type theory_, Math. Proc. Camb. Phil. Soc. (1984) 95 ([pdf](http://www.math.mcgill.ca/rags/LCCC/LCCC.pdf))

The observation that the poset of open subsets of a topological space serve as a model for [[intuitionistic logic]] is apparently originally due to

* {#Tarski} [[Alfred Tarski]], _Der Aussagenkalkül und die Topologie_, Fundamenta Mathemeticae 31 (1938), pp. 103–134.

### Applications
 {#Applications}

Discussion of fundamental constructions of [[algebraic geometry]] from the perspective of the internal logic of the [[sheaf topos]] over a [[scheme]] ([[Zariski topos]], [[etale topos]]) is in

* {#Blechschmidt15} [[Ingo Blechschmidt]], _Using the internal language of toposes in algebraic geometry_, talk at [Toposes at IHES](https://indico.math.cnrs.fr/event/747/), November 2015 ([pdf](https://github.com/iblech/internal-methods/blob/master/slides-ihes2015.pdf), [recording](https://www.youtube.com/watch?v=7S8--bIKaWQ))

* {#Blechschmidt16} [[Ingo Blechschmidt]], _Using the internal language of toposes in algebraic geometry_, thesis ([pdf](http://rawgit.com/iblech/internal-methods/master/notes.pdf))

* [[Ingo Blechschmidt]], _Internal methods_ [github repository](https://github.com/iblech/internal-methods)

[[!redirects internal logic]]
[[!redirects internal logics]]
[[!redirects internal language]]
[[!redirects internal languages]]


internal logic of an (infinity,1)-topos

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Type theory
+-- {: .hide}
[[!include type theory - contents]]
=--
#### $(\infty,1)$-Topos Theory
+-- {: .hide}
[[!include (infinity,1)-topos - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

Just as an ordinary [[elementary topos]] comes with its [[internal logic]] formalized by [[type theory]], an [[elementary (∞,1)-topos]] should come with its _internal "$(\infty,1)$-logic"_ formalized by [[homotopy type theory]].

## Type theory versus logic
 {#TypeTheoryVersusLogic}

As remarked at [[type theory]], it is useful to distinguish between the internal type theory of a category and the internal logic which sits on top of that type theory.  The type theory is about constructing objects, while the logic is about constructing [[subobjects]].  For instance, [[limits]] and [[colimits]], [[exponential object|exponentials]], and [[object classifiers]] belong to the type theory, while [[images]], [[dual image|dual images]], [[intersections]], [[unions]], and [[subobject classifiers]] belong to the logic.  Thus, the semantics of (extensional) type theory naturally lies in a category with appropriate structure, while the semantics of logic over that type theory naturally lies in some indexed [[poset]] over that category.  However, we commonly take this indexed poset to consist of the [[subobjects]] in the category in question, in which case additional "logical" structure on the category is required, for instance that it be a [[Heyting category]].

In an elementary 1-topos, all of the "logical" structure is not usually included in the definition, because it comes for free once you have [[power objects]].  But object classifiers may not be as powerful as power objects in this respect, so for purposes of studying the internal logic (and not just the internal type theory) of an $(\infty,1)$-topos, it's good to keep in mind both the type-theoretic structure and the logical structure, and in particular both the object classifier and the subobject classifier.

## The type theory of an $(\infty,1)$-category

Amazingly, a variant of type theory that seems appropriate for interpretation in an $(\infty,1)$-category already exists, namely *intensional type theory* with [[identity type]]s.

### Intensional identity types in $(\infty,1)$-categories

The usual sort of type theory that one interprets in a 1-category is *extensional type theory*.  To explain what this means, consider how the categorical structure of finite limits is represented in the type theory.  On the one hand, we have product types $A\times B$, which of course represent categorical [[products]]; thus to obtain finite limits it suffices to have [[equalizers]].  We can obtain these from *identity types*, which supply for each type $A$ and each pair of terms $x,y:A$, a dependent type $Id_A(x,y)$, whose intended interpretation is that it is inhabited precisely when $x=y$.  In terms of 1-categorical semantics, it is natural to require that any two elements of $Id_A(x,y)$ be equal, i.e. that $Id_A(x,y)$ be essentially a [[truth value]]/[[subsingleton]].  Then if we have two terms $x:A\vdash f(x):B$ and $x:A\vdash g(x):B$ representing morphisms $f,g\colon A\to B$, their equalizer is represented by the type $\Sigma_{x:A} Id_B(f(x),g(x))$.

However, for semantics in an $(\infty,1)$-category, it makes sense to use the same identity types, but now interpreted as a [[path space]].  Now it will no longer be true that $Id_A(x,y)$ is a subsingleton, since two points can be connected by more than one path, so we must drop that axiom.  This *intensional type theory* has been widely studied by type-theorists, although from a different point of view: assuming the [[propositions as types]] approach, $Id_A(x,y)$ should be the type of *proofs* or *reasons* why $x=y$, which can also of course have many different elements.

Thus we suspect that intensional type theory may be a natural sort of type theory to have semantics in an $(\infty,1)$-category.  According to the general framework of syntax/semantics, we would hope that

1. From any intensional type theory, we can construct a syntactic $(\infty,1)$-category, and
1. In any $(\infty,1)$-category, we can model an intensional type theory.

Some work in both of these directions has been done.  On the one hand, it is known that in any intensional type theory with identity types, for any type $A$ the [[globular set]] (or more accurately globular [[context]]) given by

$$ A \leftleftarrows Id_A \leftleftarrows Id_{Id_A} \leftleftarrows \dots $$

has the structure of a [[Batanin ∞-groupoid]].  This can be found in:

* [[Peter Lumsdaine]], *Weak omega-categories from intensional type theory*, [arXiv:0812.0409](http://arxiv.org/abs/0812.0409), and independently
* [[Richard Garner]] and [[Benno van den Berg]], *Types are weak omega-groupoids*, [arXiv:0812.0298](http://arxiv.org/abs/0812.0298)).

Moreover, the syntactic category of such a theory carries a natural [[weak factorization system]], the [[identity type weak factorization system]].  However, there seems as yet to be no published work constructing a full syntactic $(\infty,1)$-category.

On the other hand, it is known that in any nice enough [[model category]] (and in fact, in any category with a nice enough [[weak factorization system]]), one can model intensional type theory.  This is studied in

* [[Steve Awodey]] and [[Michael Warren]], *Homotopy theoretic models of identity types*, [arXiv:0709.0248](http://arxiv.org/abs/0709.0248)
* [[Michael Warren]], *Homotopy theoretic aspects of constructive type theory*, [Ph.D. thesis](http://aix1.uottawa.ca/~mwarren/Papers/phd.pdf).

[[Vladimir Voevodsky]] has also studied the particular model of intensional type theory in simplicial sets, which he calls the *univalent model*; see his [website](http://www.math.ias.edu/~vladimir/Site3/home.html).

### Additional axioms

Although intensional type theory has semantics in $(\infty,1)$-categories, one can naturally expect that these models will all satisfy additional axioms.  This is especially true if we want to add additional structure to our $(\infty,1)$-categories.

* Exponential (and dependent product) types can probably be modeled by (locally) cartesian closed $(\infty,1)$-categories.  However, although exponentials in an $(\infty,1)$-category are not strictly extensional the way they are in a 1-category, they are still extensional "up to coherent higher homotopies," which (unlike the case for identity types) is seemingly not guaranteed by the type-theoretic structure.  Thus, there may be an $\infty$-extensionality axiom to be added.

* Disjoint sum types may be expected to correspond to coproducts in an $(\infty,1)$-category.

* The usual notions of *quotient type* make little sense without extensional identity types.  In the 1-categorical world, quotient types correspond to [[exact categories]], while the appropriate notion of "exactness" for an $(\infty,1)$-category deals with [[groupoid objects in an (∞,1)-category]].  It remains to be seen how to phrase a corresponding axiom in the type theory.

* The [[object classifier]] in an $(\infty,1)$-topos does in fact correspond to a well-known concept in type theory, namely that of a *universe* such as the type $Type$.  However, as a universe, the object classifier in an $(\infty,1)$-topos has the special property that the *paths* between two types $A$ and $B$ as elements of $Type$ (that is, the path space $Id_{Type}(A,B)$) is equivalent to the space of equivalences between $A$ and $B$ as types (an appropriate subspace of the exponential $B^A$).  A type-theoretic axiom asserting this equivalence was introduced by [[Vladimir Voevodsky|Voevodsky]] under the name of the *equivalence axiom*.

## Logic over type theory in an $(\infty,1)$-category

Now when we go to add *logic* to the type theory of an $(\infty,1)$-category, it seems natural by analogy that it will deal with *subobjects*, i.e. with [[monomorphisms in an (∞,1)-category]].  That is, a proposition $\varphi(x)$ with a variable $x:A$ will be interpreted by a monomorphism $[\varphi] \rightarrowtail [A]$.  Just as in the [[internal logic]] of a 1-category and of a [[michaelshulman:2-categorical logic|2-category]], in order to interpret the logical connectives and quantifiers we will then need suitable structure on the posets of subobjects in our $(\infty,1)$-category.  It is naturally to be expected that any $(\infty,1)$-topos will have this necessary structure.

Again, the requisite type theory more or less exists, namely intensional type theory together with a sort of propositions that can depend on types.  In fact, this type theory is very closely related to the [[calculus of constructions]] used in the proof assistant [Coq](http://coq.inria.fr/), making Coq a very convenient place to play around with the type theory that ought to be valid in an $(\infty,1)$-topos.  In particular, Voevodsky has written out a Coq script up to the statement of his equivalence axiom, to be found on his [website](http://www.math.ias.edu/~vladimir/Site3/home.html).

## The problem of finiteness

In describing the internal type theory and logic of an $(\infty,1)$-category we encounter the problem that many structures in an $(\infty,1)$-category require a (countably) infinite amount of data to describe.  For instance, when looking for a way to state the "exactness" property one has to say what is meant by a groupoid object, but since this really means a "coherent" or "$A_\infty$" groupoid object, it involves an infinite amount of data.  By contrast, the most common type theories are purely finitary systems.

There is the one amazing fact that the entire complicated infinitary structure of a Batanin $\omega$-groupoid can be recovered from the simple finitary rules of identity types.  It is not clear, however, whether we can expect this happy occurrence to continue.  We might have to bite the bullet and work with an infinitary type theory, i.e. one allowing derivation rules taking as input an infinite list of hypotheses.  In fact, this is almost certainly what we will need if we want a good notion of a [[geometric theory]] in the $(\infty,1)$-case, since that involves infinitary logic even in the 1-categorical case.

However, such a type theory would obviously no longer have "computational content" and couldn't be modeled in a proof assistant such as Coq, and also wouldn't provide a fully "elementary," i.e. finitary first-order, theory such as [[ETCS]] provides in the 1-categorical case.  It might be helpful to note that infinitary structures can at least sometimes be finitarily described using [[inductive type]]s and/or [[coinductive type]]s, but it is not clear yet whether this is useful in the $(\infty,1)$-categorical context.

## Examples

### Internal logic in $\infty Grpd$ {#OfInfGrpd}

The archetypical [[(∞,1)-topos]] is [[∞Grpd]]. This is to be thought of as the [[vertical categorification|(∞,1)-categorification]] of the archetypical 1-[[topos]] [[Set]].

At [internal logic - in Set](http://ncatlab.org/nlab/show/internal+logic#LogicOfSet) is a step-by-step discussion of how ordinary logic is recovered from the point of view of the [[internal logic]] of a topos $\mathcal{T}$ when  choosing $\mathcal{T} := Set$.

Here we look at the $(\infty,1)$-categorical analog of that discussion,  step-by-step, now everything internal to [[∞Grpd]].

* The [[terminal object]] of $\infty Grpd$ is [[generalized the|the]] [[contractible]] $\infty$-groupoid $*$.

  This _generates_ $\infty Grpd$ under [[colimit]]s: every small $\infty$-groupoid is a colimit over a small diagram consisting only of copies of the terminal $\infty$-groupoid.

* The _subobject classifier_ of $\infty Grpd$ is

  $\Omega = \{\top, \bottom\}$

  The _object_ classifier should be the [[core]] of the
  [[universal fibration of (infinity,1)-categories|universal left fibration]].

  See [[(sub)object classifier in an (∞,1)-topos]].

Now...

...

## Related concepts

* [[internal logic]], [[type theory]], [[homotopy type theory]]

* [[relation between type theory and category theory]]

* [[Awodey's conjecture]]

* [[model of type theory in an (infinity,1)-topos|model of type theory in an $(\infty,1)$-topos]]

## References

* [[Chris Kapulkin]], _Internal Languages of Higher Categories_, [blog post](https://golem.ph.utexas.edu/category/2015/07/internal_languages_of_higher_c.html)

* [[Chris Kapulkin]], _Internal Languages of Higher Categories II_, [blog post](https://golem.ph.utexas.edu/category/2017/11/internal_languages_of_higher_c_1.html)
[[!redirects internal logic of an (∞,1)-topos]]


internal logic of set theory

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

\tableofcontents

\section{Ideas}

In any [[foundations|foundational]] [[set theory]] out there, the [[sets]] and [[functions]], however defined, form a [[category]]. As a result, the set theory should have an internalization of the [[predicate logic]] used to define the [[set theory]], the [[internal logic]] of the resulting [[category of sets]] induced by the [[subsingletons]], the [[injections]], and the [[support sets]] of the set theory. This article will describe the internal logic of set theory, in the language of [[type theory#logic over type theory|predicate logic over set theory]].

\section{Families of sets}

We begin with the definition of [[families of sets]] and [[indexed sets]]. Recall that a [[fiber]] or [[preimage]] of a [[function]] $f$ with [[domain]] $A$ and [[codomain]] $B$ at an element $b \in B$ is the set of all elements $a \in A$ such that $f(a) = b$:

$$\{a \in A \vert f(a) = b\}$$

This could be thought of in turn as a set $S_b$ indexed by the element $b \in B$.

$$S_b \coloneqq \{a \in A \vert f(a) = b\}$$

The whole [[collection]] of sets $(S_b)_{b \in B}$ is then the family of sets.

\section{Indexed disjoint unions and cartesian products}

Given a family of sets $(S_i)_{i \in I}$ indexed by the set $I$, the indexed disjoint union is defined as the set of all pairs $(i, a)$ consisting of an element $i \in I$ and an element $a \in S_i$
$$\biguplus_{i \in I} S_i \coloneqq \{(i, a) \vert i \in I, a \in S_i\}$$
The indexed cartesian product is defined as the set of all pairs $(i, f)$ consisting of an element $i \in I$ and a [[function]] $f:I \to S_i$
$$\prod_{i \in I} S_i \coloneqq \{(i, f) \vert i \in I, f:I \to S_i\}$$

\section{Subsingletons and singletons}

A [[subsingleton]] is a set $S$ which has at most one element: every two elements $a \in S$ and $b \in S$ are equal to each other
$$\mathrm{isSubsingleton}(S) \coloneqq \forall a \in S.\forall b \in S. a = b$$

A [[singleton]] is a [[pointed set|pointed]] subsingleton. Equivalently, a [[singleton]] is a [[pointed set]] $S$ with specified element $a \in S$ such that every element $b \in S$ is equal to $a$, or a set $S$ where there exists an element $a \in S$ such that every element $b \in S$ is equal to $a$.
$$\mathrm{isSingleton}(S) \coloneqq \exists a \in S.\forall b \in S. a = b$$

Every subsingleton is a [[subset]] of a [[singleton]].

In the internal logic of set theory, subsingletons represent the internal [[propositions]], families of subsingletons represent the internal [[predicates]], the [[empty set]] represents the internal [[truth value]] [[false]], and [[singletons]] represent the internal [[truth value]] [[true]].

Since any family of sets is defined by the fibers of a function $f:A \to B$, every family of subsingletons is defined such that the fibers of the function $f:A \to B$ are all subsingletons. However, that is just the requirement that the function $f:A \to B$ be an [[injection]]. Similarly, every family of singletons is equivalently just a [[bijection]] $f:A \simeq B$.

\section{Support of a set}

Every set $S$ has a unique function $u:S \to 1$ into any [[singleton]] $1$ with point $* \in 1$, defined by $u(a) = *$ for all elements $a \in S$.

Recall that the [[image]] of a function $f:A \to B$ is the subset of all elements $b \in B$ which are of the form $f(a)$ for all elements $a \in A$
$$\mathrm{image}(f) \coloneqq \{f(a) \vert a \in A, f:A \to B\}$$

The [[support]] of the set is defined as the [[image]] of the unique function $u:S \to 1$.
$$[S] \coloneqq \{u(a) \vert a \in S, u:S \to 1\}$$

Since the [[image]] is always a [[subset]] of the [[codomain]] of the [[function]], the [[support]] of a set is thus a [[subsingleton]]. The support enables us to make every set $S$ into a [[subsingleton]].

One could also apply the support to any family of sets $(S_b)_{b \in S}$, resulting in the family of subsingletons $([S_b])_{b \in S}$. Since every family of subsingletons is equivalently an [[injection]], this is the same as the usual [[image factorization]] of every function into an [[injection]] and a [[surjection]].

\section{Internal logical operators}

Supports are important because they will allow us to define the logical operators [[conjunction]], [[disjunction]], [[implication]], [[logical equivalence]], [[negation]], [[existential quantification]], and [[universal quantification]] internal to the set theory:

The logical [[conjunction]] of two subsingletons is defined as the [[support]] of the [[cartesian product]] of the two subsingletons:

$$A \wedge B \coloneqq [A \times B]$$

The logical [[disjunction]] of two subsingletons is defined as the [[support]] of the [[disjoint union]] of the two subsingletons:

$$A \vee B \coloneqq [A \uplus B]$$

The logical [[implication]] of two subsingletons is defined as the [[support]] of the [[function set]] of the two subsingletons:

$$A \implies B \coloneqq [B^A]$$

The logical [[equivalence]] of two subsingletons is defined as the [[support]] of the set of [[bijections]] of the two subsingletons:

$$A \iff B \coloneqq [A \simeq B]$$

The logical [[negation]] of a subsingleton is defined as the [[support]] of the [[function set]] into the [[empty set]]:

$$\neg A \coloneqq [\emptyset^A]$$

The logical [[existential quantification]] of a family of subsingletons $(S_b)_{b \in B}$ ranging over the set $B$ is defined as the [[support]] of the indexed [[disjoint union]] of the family of subsingletons:

$$\exists b \in B.S_b \coloneqq \left[\biguplus_{b \in B} S_b\right]$$

The logical [[universal quantification]] of a family of subsingletons $(S_b)_{b \in B}$ ranging over the set $B$ is defined as the [[support]] of the indexed [[cartesian product]] of the family of subsingletons:

$$\forall b \in B.S_b \coloneqq \left[\prod_{b \in B} S_b\right]$$

All these operations are not restricted only to [[subsingletons]], they are also defined over general [[sets]]. However, by definition, these operations result in a [[subsingleton]].

\section{Internal equality}

The internal equality relation in a set $S$ is represented by the initial reflexive graph structure on $S$. By a *graph structure* on $S$ we mean a set $R$ and a pair of function $s:R \to S$ and $t:R \to S$. The set $S$ is called the *carrier set* of the graph structure. We do not assume the two functions are [[jointly monic|jointly injective]], so the graph structures are really [[directed pseudograph]] structures. By a *reflexive graph structure*, we mean that every element of the carrier set has a loop: there is a function $\mathrm{refl}:S \to R$ such that $s(\mathrm{refl}(a)) = a$ and $t(\mathrm{refl}(a)) = a$.

A *graph structure homomorphism* between two graph structures on the carrier set $S$, $(R, s, t)$ and $(R,', s', t')$ is a function $f: R \to R'$, such that for all $p \in R$, $s'(f(p)) = s(p)$ and $t'(f(p)) = t(p)$.

A *reflexive graph structure homomorphism* is a graph structure homomorphism $f:R \to R'$ between two graph structures $(R, s, t, \mathrm{refl})$ and $(R', s', t', \mathrm{refl}')$ on a carrier set $S$ where additionally, for every element $a \in S$ of the carrier set, $f(\mathrm{refl}(a)) = \mathrm{refl}'(f(a))$.

A reflexive graph structure $(\mathrm{Id}_S, s_{\mathrm{Id}}, t_{ \mathrm{Id}}, \mathrm{refl}_S)$ on a carrier set $S$ is an *initial reflexive graph structure* on $S$ if for every other reflexive graph structure $(R, s, t, \mathrm{refl})$ on $S$, there exists a unique reflexive graph structure homomorphism $f:\mathrm{Id}_S \to R$.

Every set $S$ has an initial reflexive graph structure given by the [[diagonal function]] of $S$.

It could be shown from this [[universal property]] that the functions $s_\mathrm{Id}$ and $t_\mathrm{Id}$ are [[jointly monic|jointly injective]], and thus that [[axiom K]] holds internally in set theory.

\section{Internal and external axioms}

Since every logical operation in [[predicate logic]] have been internalized in the set theory itself, one then has to distinguish between the axioms written in the external predicate logic used to define the set theory, and the axioms written in the predicate logic internal to the set theory.

For example, the external [[law of double negation]] states that for any proposition $P$ the double negation of $P$ implies $P$, $\neg \neg P \implies P$. The **internal law of double negation** would say that for every [[subsingleton]] $S$, the subsingleton $\neg \neg S \implies S$ is a [[singleton]], or equivalently, that for every set $S$ there is an element $\mathrm{doubleneg}_S \in \neg \neg [S] \implies [S]$.

Similarly, the external [[law of excluded middle]] states that for any proposition $P$ it is possible to derive that $P \vee \neg P$. The **internal law of excluded middle** would say that for every for every [[subsingleton]] $S$, the [[subsingleton]] $S \vee \neg S$ is a singleton, or equivalently, that for every set $S$, there is a element $\mathrm{lem}_S \in[S] \vee \neg [S]$.

\section{See also}

* [[split support]]
* [[internal logic]]
* [[dependent type theory]]
* [[propositions as types]]
* [[Trimble on ETCS II]]

[[!include types and logic - table]]


internal profunctor

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Internal categories
+--{: .hide}
[[!include internal infinity-categories contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

For any [[category]] $S$ with pullbacks, it is easy to define the notion of [[internal category|category in]] $S$, and the definition of an internal [[functor]] between such is similarly straightforward.  But it is not so obvious how to define [[presheaf|presheaves]] on internal categories, because they must land in the ambient category $S$.

The solution lies in thinking of presheaves on an ordinary category $C$, and more generally [[profunctor]]s $C ⇸ D$, as giving sets equipped with an _action_ of the arrows of $C,D$, i.e. as their [[category of elements|categories of elements]].

## Definition

Here is the slick definition: let $S$ be a category with pullbacks. Then the bicategory $Prof(S)$ of internal categories, profunctors and transformations in $S$ is defined to be $Mod(Span(S))$, the category of [[monad]]s and [[module over a monad|bimodules]] in $Span(S)$, the [[bicategory]] of [[span]]s in $S$.

So an **internal profunctor** $C ⇸ D$ between internal categories $C$ and $D$ is a bimodule from $C$ to $D$.  An **internal presheaf** on $C$ is a right $C$-module, or equivalently a bimodule $C ⇸ 1$, where $1$ is the discrete category on the terminal object of $S$ (as long as $S$ has one, of course).

An internal presheaf in $S$ is the same thing as an [[internal diagram]] in $S$.

### Details

Recall that an [[internal category]] $C$ in $S$ is a monad in $Span(S)$, and so has an underlying span $(s,t) : C_1 \rightrightarrows C_0$.  Given $C,D \in Cat(S)$, a bimodule $H : C ⇸ D$ must be given by a span $H : C_0 \leftarrow H \to D_0$, together with a right action $H \circ C \to H$ of $C$ and a left action $D \circ H \to H$ of $D$ that are compatible in the sense described at [[module over a monad]].

Composition of spans is given by pullback, so the action of $C$ on $H$ is given by a morphism of spans $H_r : C_1 \times_{C_0} H \to H$, where the pullback is
$$
\array{
C_1 \times_{C_0} H & \to & H \\
\downarrow & & \downarrow \\
C_1 & \underset{t}{\to} & C_0
}
$$
To say that $H_r$ is a morphism of spans is to require that
$$
\array{
C_1 \times_{C_0} H & \to & H \\
\downarrow & & \downarrow \\
C_1 & \underset{s}{\to} & C_0
}
$$
commutes.  This action must satisfy unit and associativity axioms expressing functoriality of the corresponding presheaf.  Similarly, $H_\ell : H \times_{D_0} D_1 \to H$, where the pullback is along $s$, so that this represents a copresheaf.  Finally, compatibility of the two actions represents bifunctoriality of the profunctor.


internal pseudo-equivalence relation

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

\tableofcontents

## Definition

In a [[category]] $C$ with [[pullbacks]], an **[[internalization|internal]] [[pseudo-equivalence relation]]** on an object $X$ is an object $R$ with morphisms $p_1:R \to X$ and $p_2:R \to X$, along with the following [[morphisms]]:

* internal [[reflexive relation|reflexivity]]: $r \colon X \to R$ which is a [[section]] both of $p_1$ and of $p_2$, i.e., $p_1 r = p_2 r = 1_X$;

* internal [[symmetric relation|symmetry]]: $s \colon R \to R$ which interchanges $p_1$ and $p_2$, i.e., $p_1\circ s = p_2$ and $p_2\circ s = p_1$;

* internal [[transitive relation|transitivity]]: $t: R \times_X R \to R$ which factors the left/right projection map $R \times_X R \to X \times X$ through $R$, i.e., the following diagram commutes
  $$\array{
    && R \\
    & {}^{\mathllap{t}}\nearrow & \downarrow \\
    R \times_X R & \stackrel{(p_1 q_1,p_2 q_2)}\rightarrow & X \times X
  }
  $$
where $q_1$ and $q_2$ are the projections defined by the [[pullback | pullback diagram]]
  $$\array{
    R \times_X R & \stackrel{q_2}\rightarrow & R
    \\
    \downarrow^{\mathrlap{q_1}} && \downarrow^{\mathrlap{p_1}}
    \\
    R & \stackrel{p_2}\rightarrow & X
  }
  $$

An object with an internal pseudo-equivalence relation is sometimes called a *[[setoid object]]*, but those are also used for objects with an internal equivalence relation; i.e. a [[congruence]].

## See also

* [[pseudo-equivalence relation]]
* [[congruence]]
* [[category object]]

[[!redirects internal pseudo-equivalence relation]]
[[!redirects internal pseudo-equivalence relations]]


internal pseudocategory

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Categorical algebra
+-- {: .hide}
[[!include categorical algebra -- contents]]
=--
#### Internal categories
+--{: .hide}
[[!include internal infinity-categories contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

The notion of an **internal pseudocategory** in a [[2-category]] $K$ with [[pullbacks]] is a generalisation of the notion of an [[internal category]] in a [[1-category]], where one requires [[composition]] to be [[associativity|associative]] and [[unitality|unital]] only up to [[coherence|coherent]] [[isomorphism]] of [[2-morphisms|2-cells]] in $K$.

This is distinct from the concept of an [[internal bicategory]], which additionally specifies the data of an object of 2-cells.

## Examples

- A [[pseudo double category]] is pseudocategory internal to the 2-category [[Cat]] (while a [[strict double category]] is a category internal to the underlying 1-category of [[Cat]]).

## Related concepts

* [[internalization]]

* [[category object in an (infinity,1)-category|internal category in an $(\infty,1)$-category]]

## References

- N. Martins-Ferreira. _Pseudo-categories_ Journal of Homotopy and Related Structures 1.1 (2006): 47-78. ([arXiv:math/0604549](https://arxiv.org/abs/math/0604549)

[[!redirects internal pseudocategory]]
[[!redirects internal pseudocategories]]

[[!redirects pseudocategory]]
[[!redirects pseudocategories]]


internal relation

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

#Contents#
* table of contents
{:toc}

## Idea

The concept of internal relation is an [[internalization]] of the concept of a [[relation]] from [[Set]] to more general [[categories]] and it is often called just a __relation__ in the category $C$.

If $C$ is a [[regular category]], then its category of internal binary relations is an [[allegory]]. The objects of an allegory may, but do not need to be, internal relations in some ambient category.

## Definitions

Let $C$ be a category.  An __internal binary relation__ from an object $X$ to an object $Y$ is an object $R$ and a pair of maps $d_0: R \to X$ and $d_1: R \to Y$ that are [[jointly monic]], that is such that, given any object $G$ and morphism $e, e': G \to R$, if $d_0 \circ e = d_0 \circ e'$ and $d_1 \circ e = d_1 \circ e'$, then it must be that $e = e'$.

Now suppose that $C$ has binary [[products]]. Then we can simplify the definition; an internal binary relation from $X$ to $Y$ is simply a [[subobject]] $r: R\hookrightarrow X\times Y$. The $d_0$ and $d_1$ above may be recovered as the [[composites]]
$$ d_0 = p_X\circ r : R\hookrightarrow X\times Y\to X,\quad d_1 = p_Y\circ r : T\hookrightarrow X\times Y\to Y ,$$
called the _projections_ of the relation $R$.

A relation from $X$ to $X$ is also said to be an __internal binary relation on $X$__, and an object $X$ with an internal binary relation is a [[loop digraph object]].

As with [[relations]] in general, we can extend from binary to arbitrary internal relations by generalising from the pair $(X,Y)$ to an arbitrary family of objects.  If this family has a [[product]] in $C$, then the internal relation is simply a subobject of that product; in general, the internal relation is given by a jointly monic family of morphisms.

## Kinds of internal relations

The various kinds of relations described at [[relation]] can often be interpreted internally.

For example, an internal relation $R$ on $X$ is said to be __[[reflexive relation|reflexive]]__ if it contains the [[diagonal subobject]] $X\hookrightarrow X\times X$ of $X$; this can even be stated if $X \times X$ does not exist in the category.

An internal [[equivalence relation]] is often called a [[congruence]].

## See also

* [[loop digraph object]]

* [[preordered object]]

* [[opposite internal relation]]

[[!redirects internal relations]]


internal set

An __internal set__ is a basic object of internal set theory, which is a model of [[nonstandard analysis]]. The idea for analysis is that in addition to usual numbers one may have also infinitesimals with which the rules of manipulating are somewhat restricted, so that one does not get into inconsistencies.

*(Note that this usage of "internal" is very different from that of [[internalization]].  In that usage, an internal set would be simply an [[object]] --- or perhaps some kind of [[setoid]], depending on the sort of category one is internalizing in.)*

Among internal sets there is a subclass of __standard sets__; ZFC axiom schemes apply to the standard sets; every internal set has its standard part which is a standard set. This operation is called *standardization*. Using theory of internal sets one can implement [[transfer principle]] which is one of the basic principles of nonstandard analysis.

There exists a model with a further extension, where even larger class is introduced, so-called external sets containing internal sets containing standard sets. Internal sets are introduced by Nelson.

Nelson's internal set approach is used in these references

* Edward Nelson, Internal set theory: a new approach to nonstandard analysis.  Bull. Amer. Math. Soc.  83  (1977), no. 6, 1165--1198.

* Nelson was writing a book on nonstandard analysis in this approach: [draft first chapter](http://www.math.princeton.edu/~nelson/books/1.pdf)

* A. G. Kusraev, S. S. Kutateladze, Nonstandard Methods of Analysis. Mathematics and Its Applications 291, Kluwer 1994 (has also short excursion into external sets)

* Sergio Albeverio, Jens Erik Fenstad, Raphael Hoegh-Krohn, Nonstandard Methods in Stochastic Analysis and Mathematical Physics, Academic Press 1986 (there  are also Dover 2009 edition and a Russian translation)

[[!redirects internal sets]]


internal set theory

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

# Contents
* automatic table of contents goes here
{: toc}

## Idea

Just as one could define an [[internal logic]], such as [[first order logic]], [[higher order logic]], or [[geometric logic]] in a [[(1,1)-category]] with sufficient structure, in a [[(2,1)-category]], one should be able to define an _internal set theory_.

Defining a [[set theory]] internal to a (1,1)-category is not possible, unless one is talking about [[material set theories]] such as [[ZFC]], because any groupoid or category internal to an ambient (1,1)-category is necessarily a [[strict category|strict]] groupoid or category, which violates the [[principle of equivalence]]. Instead, in order to construct an internal set theory, an internal notion of [[weak category]] is needed.

The basic ideas of the internal set theory induced by a given category C are:

* the objects $A$ of $C$ are regarded as collections of things of a given type $A$

* the morphisms $A\rightarrow B$ of $C$ are regarded as terms of type $B$ containing a free variable of type $A$ (i.e. in a context $x:A$)

* A [[faithful morphism]] $F:A \rightarrow B$ is regarded as a set [[family of sets]] by thinking of it as the discrete collection of all those things of type $B$ for which the type $A$ is inhabited. $B$ is regarded as an [[index set]]. If $B$ is a [[terminal object]] $*$ in $C$, then $A$ and $F$ are equivalent as discrete objects and are regarded as sets.

  * The [[hom-set]] of morphisms in the weak category of discrete objects of $A$ and faithful morphisms are regarded as the collection of functions between two sets $X:A \rightarrow *$ and $Y:A \rightarrow *$. In particular, functions have set-theoretic equality.

* Set theoretic operations are implemented by universal constructions on discrete objects.

  * The [[empty set]] is an [[initial object|initial]] discrete object.

  * The [[singleton]] is a [[terminal object|terminal]] discrete object and a (2,1)-[[generator]].

  * The [[Cartesian product]] is a [[2-limit|(2,1)-product]] of discrete objects

  * The [[solution set]] of a set-theoretic [[equation]] is a [[2-pullback|(2,1)-pullback]] of discrete objects

  * The [[disjoint union]] is a [[disjoint coproduct|disjoint]] and [[pullback stability|(2,1)-pullback stable]] [[2-colimit|(2,1)-coproduct]] of discrete objects.

and so on.

* A dependent type over an object $A$ of $C$ may be interpreted as a morphism $B \rightarrow A$ whose “fibres” represent the types $B(x)$ for $x:A$. This morphism might be restricted to be a [[display map]] or a [[fibration]].

## See also

* [[internal logic]]

* [[syntactic category]]

* [[category of sets]]


internal sheaf

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Topos Theory
+-- {: .hide}
[[!include topos theory - contents]]
=--
#### Internal category theory
+--{: .hide}
[[!include internal infinity-categories contents]]
=--
#### $(\infty,2)$-Topos theory
+--{: .hide}
[[!include (infinity,2)-topos theory - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

The notions of _[[presheaf]]_, _[[site]]_ and _[[sheaf]]_ can be formulated [[internalization|internal]] to any [[topos]]. The ordinary such notions are recovered by internalization into [[Set]].

More precisely, the direct internalization of these notions is into the [[universe enlargement|very large]] [[2-topos]] $\hat Sh_2(\mathcal{S},can)$ of the given ambient topos $\mathcal{S}$, since an internal presheaf is to be an $\mathcal{S}$-valued internal functor, but $\mathcal{S}$ does not quite sit inside itself. It does, however, sit inside $\hat Sh_2(\mathcal{S},can)$, incarnated as the [[2-sheaf]] $\bar \mathcal{S}$ corresponding to its [[codomain fibration]].

Therefore, regarding $\hat Sh_2(\mathcal{S}, can)$ as the [[2-category]] of [[internal categories]] in $\mathcal{S}$, an [[internal site]] in $\mathcal{S}$ is an object $\bar \mathbb{C}$ of $\hat Sh_2(\mathcal{S}, can)$ and an internal presheaf is a morphism $F : \bar \mathbb{C}^{op} \to \bar \mathcal{S}$.

## Definition

While it is straightforward to define an [[internal site]], hence the [[domain]] of an internal (pre)sheaf, the definition of the codomain is slightly more subtle, for that needs to be a copy of the ambient [[universe]] internalized into itself. One way to naturally say this is by passing to the _external_ [[2-sheaves]] [[2-topos]]. This version of the definition we state in

* _[In terms of external 2-sheaves](#InTermsOf2Sheaves)_.

But the resulting notion can of course be expressed entirely in terms of data in the ambient topos. This we spell out in

* _[Explicit definition](#ExplicitDefinition)_.

### In terms of external 2-sheaves
 {#InTermsOf2Sheaves}

Let  $\mathcal{S}$ be a [[topos]] and let $\mathbb{C}$ be an [[internal category]] in $\mathcal{S}$:

$$
  \mathbb{C} =
  \left(
    C_1 \stackrel{\overset{s}{\to}}{\underset{t}{\to}}
    C_0
  \right)
  \in \mathcal{S}
  \,.
$$

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

Write $\bar \mathbb{C}$ for the [[2-sheaf]] on $\mathcal{S}$

$$
  \bar \mathbb{C} : \mathcal{S}^{op} \to Cat
$$

that is [[representable functor|represented]] by $\mathbb{C}$. More explicitly, this is the [[pseudofunctor]] which to an [[object]] $X \in \mathcal{S}$ assigns

$$
  \bar \mathbb{C} : X
    \mapsto
  \left(
    \mathcal{S}(X,C_1)
    \stackrel{\overset{\mathcal{S}(X,s)}{\to}}{\underset{\mathcal{S}(X,t)}{\to}}
    \mathcal{S}(X,C_0)
  \right)
  \,.
$$

=--

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

Write

$$
  \bar \mathcal{S} : \mathcal{S}^{op} \to Cat
$$

for the [[2-sheaf]] that [[Grothendieck construction|classifies]] the [[codomain fibration]] of $\mathcal{S}$, the [[pseudofunctor]] which sends an object to the corresponding [[slice topos]] and morphisms to [[base change]]

$$
  \bar \mathcal{S} : X \mapsto \mathcal{S}_{/X}
$$

(also called the "[[indexed category|self-indexing]] of $\mathcal{S}$").

=--

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

This is the incarnation of $\mathcal{S}$ itself, regard internal to its [[2-sheaf]] [[2-topos]] $\hat Sh_{2}(\mathcal{T}, can)$.

=--

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

An **internal presheaf** on $\mathbb{C}$ (internal to $\mathcal{T}$) is a morphism

$$
  F : \bar \mathbb{C}^{op} \to \bar \mathcal{S}
$$

of [[2-sheaves]] on $\mathcal{S}$. (Also called an "[[indexed functor]]" between [[indexed categories]]".)

Suppose moreover that $\mathbb{C}$ is equipped with the structure of an [[internal site]]. Then $F$ above is an **internal sheaf** on $\mathbb{C}$ if it satisfies the evident [[descent]] condition.

A [[morphism]] of internal presheaves is simply a [[2-morphism]] in $\hat Sh_2(\mathcal{S}, can)$ (also called an "[[indexed functor|indexed natural transformation]]"). This yields a [[category]]

$$
  PSh(\mathbb{C})
$$

of internal presheaves. Accordingly we have the
[[full subcategory]]

$$
  Sh(\mathbb{C}, \mathcal{S})
  \hookrightarrow PSh(\mathbb{C}, \mathcal{S})
$$

of internal sheaves.

=--

### Explicit definition
 {#ExplicitDefinition}

We unwind what the above amounts to more explicitly.

Let $(\mathbb{C},J)$ be an [[internal site]] in $\mathcal{S}$, i.e. an [[internal category]] $\mathbb{C}$ equipped with an internal [[coverage]] $J$. Let $\mathcal{S}^{\mathbb{C}^{op}}$ be the topos of [[internal diagram|internal diagrams]] on $\mathbb{C}^{op}$.

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

1. An **internal presheaf** on $\mathbb{C}$ is an internal diagram $F \in \mathcal{S}^{\mathbb{C}^{op}}$.

1. An **internal sheaf** on $\mathbb{C}$ (with respect to $J$) is an internal presheaf on $\mathbb{C}$ satisfying one of the following equivalent conditions:
    1. $F$ satisfies the [usual sheaf condition](/nlab/show/sheaf#GeneralComponentwiseDefinition) interpreted in the [[internal language]] of $\mathcal{S}$.
    1. $F$ is a $j$-sheaf for the [[Lawvere-Tierney topology]] on $\mathcal{S}^{\mathbb{C}^{op}}$ induced by $J$.
(The equivalence is because the usual proof for $\mathcal{S} = $[[Set]] is constructive and can thus be internalized in an arbitrary topos.)

=--

## Properties

Let $\mathcal{S}$ and $\mathbb{C}$ be as above.

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

The category of internal presheaves $PSh(\mathbb{C}, \mathcal{S})$ is a [[topos]].

=--

This appears as ([Johnstone, cor. B.2.3.17](#Johnstone)).

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

Let $f : \mathbb{C} \to \mathbb{D}$ be an [[internal functor]]. Write $\bar f : \bar \mathbb{C} \to \bar \mathbb{D}$ for the corresponding morphism in $\hat Sh_2(\mathcal{S}, can)$. Precomposition with this morphism induces a [[functor]] of internal presheaf catgeories

$$
  f^* \colon PSh(\mathbb{D}, \mathcal{S})
    \to
   PSh(\mathbb{C}, \mathcal{S})
  \,.
$$

This is the [[inverse image]] of a [[geometric morphism]] of [[toposes]]

$$
  f \colon PSh(\mathbb{C}, \mathcal{S})
   \to
  PSh(\mathbb{D}, \mathcal{S})
  \,.
$$

=--

This appears as ([Johnstone, cor. B.2.3.22](#Johnstone)).

The global section functors of internal sheaf toposes in $\mathcal{S}$ are [[bounded geometric morphisms]] over $\mathcal{S}$.

## Related concepts

* [[internal diagram]]

## References

On internal presheaves in [[elementary toposes]]:

* [[Marta Bunge]], *Internal Presheaf Toposes*, [[Cahiers,Cahiers de topologie et géométrie différentielle catégoriques]] **18** 3 (1977) 291-330 [[numdam:CTGDC_1977__18_3_291_0](http://www.numdam.org/item/?id=CTGDC_1977__18_3_291_0)]

On internal presheaves in a [[Grothendieck toposes]]:

* [[Saunders MacLane]], [[Ieke Moerdijk]], Section V.7 of _[[Sheaves in Geometry and Logic]]_ (1992)

and in section B2.3 of

* {#Johnstone} [[Peter Johnstone]], _[[Sketches of an Elephant]]_

In these references internal presheaves are introduced in components as in the [explicit definition](#ExplicitDefinition) above. The equivalence to the [abstract formulation](#InTermsOf2Sheaves) above, in terms of morphisms between 2-sheaves, follows for instance with ([Johnstone, lemma B.2.3.13](#Johnstone)).

category: sheaf theory
[[!redirects internal sheaves]]
[[!redirects internal presheaf]]
[[!redirects internal presheaves]]
[[!redirects category of internal sheaves]]
[[!redirects category of internal presheaves]]
[[!redirects categories of internal sheaves]]
[[!redirects categories of internal presheaves]]
[[!redirects internal presheaf topos]]
[[!redirects internal sheaf topos]]

[[!redirects internal presheaf toposes]]
[[!redirects internal sheaf toposes]]


internal site

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Categorical algebra
+-- {: .hide}
[[!include categorical algebra -- contents]]
=--
#### Topos Theory
+-- {: .hide}
[[!include topos theory - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

The notion of [[site]] may be [[internalization|internalized]] in any [[topos]] to yield a notion of _internal site_.

## Definition

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

For $\mathcal{E}$ a [[topos]], an **internal site** in $\mathcal{E}$ is an [[internal category]] $\mathbb{C} = C_1 \rightrightarrows C_0$ equipped with an internal [[coverage]].

=--

Spelled out in components, this means the following (as in ([Johnstone](#Johnstone)), we shall only define _sifted_ coverages). First, we define the [[subobject]] $Sv(\mathbb{C}) \hookrightarrow PC_1$ of _[[sieves]]_, where a subobject $S \hookrightarrow C_1$ is a sieve if the composite
$$
S\times_{C_0} C_1 \to C_1\times_{C_0} C_1 \to C_1
$$
factors through $S$. Also recall the usual membership relation $\in_{C_1} \stackrel{(n,e)}{\to} PC_1 \times C_1$.

+-- {: .num_defn}
###### Definition
An _internal sifted coverage_ is given by a span $C_0 \stackrel{b}{\leftarrow} T \stackrel{c}{\to} Sv(\mathbb{C})$ subject to:

* The square
$$
\array{
T \times_{PC_1} \in_{C_1} & \stackrel{e pr_2}{\to} & C_1 \\
{}^{pr_1}\downarrow   & {}                & \downarrow^{s} \\
T                  & \stackrel{b}{\to} & C_0
}
$$
commutes, where the pullback in the top left corner is of the map $\in_{C_1} \to PC_1$ along $T \to Sv(\mathbb{C}) \hookrightarrow PC_1$.

* If we define the subobject $Q\hookrightarrow T\times_{C_0} C_1 \times_{C_0} T$ as
$$
  Q := \{(t',a,t) | aa' \in t \forall a'\in t'\}
$$
(in the internal language), the composite $Q \hookrightarrow T\times_{C_0} C_1 \times_{C_0} T \stackrel{pr_{23}}{\to} C_1 \times_{C_0} T$ is required to be an epimorphism.

=--

We can additionally ask that more saturation conditions (as discussed at [[coverage]]) hold.

(...)

## Properties

### Externalization

We discuss how to every internal site there is a corresponding external site such that the [[internal sheaf topos]] on the former agrees with the external sheaf topos on the latter.

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

Let $\mathcal{C}$ be a [[small category]] and let $\mathcal{E} := [\mathcal{C}^{op}, Set]$ be its [[presheaf topos]]. Let $\mathbb{D} \in \mathcal{E}$ be an internal site. Regarded, by the [[Yoneda lemma]], as a functor $\mathbb{D} : \mathcal{C}^{op} \to Cat$, this induces via the [[Grothendieck construction]] a [[fibered category]] which we denote

$$
  \mathcal{C} \rtimes \mathbb{D} \to \mathcal{C}
  \,.
$$

=--

This is reviewed for instance in ([Johnstone, p. 596](#Johnstone)).

The notation is motivated from the following example.

+-- {: .num_example}
###### Example

Let $G$ be a [[group]] (in [[Set]], hence a [[discrete group]]) and let $\mathcal{C} := \mathbf{B}G$ be its [[delooping]] [[groupoid]]. Then

$$
  \mathcal{E} \simeq [\mathbf{B}G , Set]
$$

is the topos of [[permutation representation]]s of $G$. Let $H \in \mathcal{E}$ be a [[group object]]. This is equivalently a group in $Set$ equipped with a $G$-[[action]]. Its internal delooping gives the [[internal groupoid]] $\mathbb{D} := \mathcal{B}H$  in $\mathcal{E}$.

In this case we have that

$$
  \mathcal{C} \rtimes \mathbb{D} \simeq \mathbf{B}(G \rtimes H)
$$

is the delooping groupoid of the [[semidirect product]] group of the $G$-action on $H$.

=--

Generally we have

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

The category $\mathcal{C} \rtimes \mathbb{D}$ from def. \ref{TheExternalizedSite} is described as follows:

* [[object]]s are pairs $(U,V)$ with $U \in Ob \mathcal{C}$ and $V \in Ob \mathbb{D}(U)$;

* [[morphism]]s $(U',V') \to (U,V)$ are pairs $(a,b)$ where $a : U' \to U$ is in $\mathcal{C}$ and $b : V' \to \mathbb{D}(a)(V)$ in $\mathbb{D}(U')$.

=--

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

We have an [[equivalence of categories]]

$$
  [\mathbb{D}^{op}, [\mathcal{C}^{op}, Set]]
   \simeq
  [(\mathcal{C} \rtimes \mathbb{D})^{op}, Set]
$$

between the [[category of internal presheaves]] in $\mathcal{E}$ over the internal category $\mathbb{D}$, and external presheaves over the semidirect product site $\mathcal{C} \rtimes \mathbb{D}$.

=--

This appears as ([Johnstone, lemma C2.5.3](#Johnstone)).

This result generalizes straightforwardly to an analogous statement for internal sheaves.

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

If $\mathcal{C}$ is equipped with a [[coverage]] $J$ and $\mathbb{D}$ is equipped with an internal coverage $K$ , define a coverage $J \rtimes K$ on $\mathcal{C} \rtimes \mathbb{D}$ by declaring that a [[sieve]] on an object $(U,V)$ is $(J \times K)$-covering if there exists an element $S \in K(U)$ with $b(S) = V$, ...

=--

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

Let $\mathcal{E} = Sh_J(\mathcal{C})$ be a [[sheaf topos]] and $(\mathbb{D}, K)$ an internal site in $\mathcal{E}$. Then with def. \ref{CoverageOnTheExternalizedSite} we have an [[equivalence of categories]]

$$
  Sh_{K}(\mathbb{D})
  \simeq
  Sh_{J \rtimes K}(\mathcal{C} \rtimes \mathbb{D})
$$

between [[internal sheaves]] in $\mathcal{E}$ on $\mathbb{D}$ and [[sheaf|external sheaves]] on the semidirect product site $J \rtimes K$.

Moreover, the [[projection]] [[functor]] $P : \mathcal{C} \rtimes \mathbb{D}$ is [[cover-reflecting]] and induces a [[geometric morphism]]

$$
  \Gamma
   \colon
  Sh_K(\mathbb{D})
  \stackrel{}{\to}
  \mathcal{E}
  \,.
$$

=--

This appears as ([Johnstone, prop. C2.5.4](#Johnstone)).

## Related concepts

* [[site]]

* [[internal locale]], [[internal sheaf]]

* [[internalization]], [[internal logic]]

## References

Section C2.4 and C2.5 of

* [[Peter Johnstone]], _[[Sketches of an Elephant]]_
 {#Johnstone}

The semidirect product externalization of internal sites is due to

* [[Ieke Moerdijk]], _Continuous fibrations and inverse limits of toposes_, Composition Math. 68 (1986) ([NUMDAM](http://www.numdam.org/item?id=CM_1986__58_1_45_0))
 {#Moerdijk}

[[!redirects internal sites]]


internal subcategory

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

#Contents#
* table of contents
{:toc}

## Idea

A notion of [[subcategory]] formulated from within the [[internal logic]] of the ambient category.

## Related concepts

* [[internal category]]

## References

A certain internal subcategory of the [[effective topos]] is discussed in

* [[Martin Hyland]], _A small complete category_, Annals of Pure and Applied Logic 40 (1988) 135-165 ([pdf](http://www.dpmms.cam.ac.uk/~martin/Research/Oldpapers/smallcomplete88.pdf))

[[!redirects internal subcategories]]


internal symmetry

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

#Contents#
* table of contents
{:toc}

## Idea

In [[physics]] by an "internal symmetry" one broadly means a [[symmetry]] *other* than spacetime symmetry, i.e. a symmetry not due to nor reflecting movement in space and time, but due to "internal degrees of freedom".

### In high energy physics

Notably [[gauge symmetry]] is counted as internal symmetry.

Or a [[spinor]] field, in the absence of any [[magnetic field]] or [[spin-orbit interaction]] or any other [[interaction]] involving the spin will have a [[dynamics]] which is invariant under transformations that just flips the spin, and this is then an internal symmetry.

### In solid state physics

In [[condensed matter theory]], internal symmetries are also referred to as "on-site" symmetries, this referring to the sites of the atomic nuclei in the [[crystal]] lattice.

For example, the [[Ising model]] has an on-site "spin flip"-[[cyclic group of order 2|$\mathbb{Z}/2$]]symmetry $\vert \uparrow \rangle \xleftrightarrow{S} \vert \downarrow \rangle$, while the [[Heisenberg model]] has the full [[Spin(3)]]=[[SU(2)]]-group acting as an on-site symmetry on the electron spins (cf. [CGW11, p. 5](#CGW11)).

(table from SS 22)

## Related concepts

* [[symmetry group]]

* [[Coleman-Mandula theorem]]

* [[symmetry protected topological phase]]

* [[crystallographic group]]

## References

Explicit definition of internal symmetry [[condensed matter theory]]:

* [[Charles Zhaoxi Xiong]], p. 13 of: *Classification and Construction of Topological Phases of Quantum Matter* $[$[arXiv:1906.02892](https://arxiv.org/abs/1906.02892)$]$

Beware that old historical articles (eg. [Barlow 1883](crystal#Barlow1883)) used "internal symmetry" to refer to [[crystallographic group|crystallographic symmetry]] which now is referred to as "spatial symmetry" and regarded as non-internal.

See also:

* {#CGW11} [[Xie Chen]], [[Zheng-Cheng Gu]], [[Xiao-Gang Wen]], *Classification of gapped symmetric phases in one-dimensional spin systems*, Phys. Rev. B **83** 035107 (2011) $[$[doi:10.1103/PhysRevB.83.035107](https://doi.org/10.1103/PhysRevB.83.035107)$]$

[[!redirects internal symmetries]]

[[!redirects internal symmetry group]]
[[!redirects internal symmetry groups]]


internal tensor product

# Internal tensor product of Hilbert C$^*$-modules
* table of contents
{: toc}

## Definition ##

The internal tensor product of Hilbert $C^*$-[[Hilbert C*-module|modules]] is a generalisation of the algebraic notion of a [[tensor product of modules]].

Let $A$ and $B$ be $C^*$-[[C*-algebra|algebras]], and let $E$ be a right Hilbert $A$-[[Hilbert C*-module|module]] and $F$ be a right Hilbert $B$-[[Hilbert C*-module|module]], and finally let $\varphi \colon A\to \mathcal{L}_B(F)$ be a $*$-homomorphism.

Form the algebraic tensor product $E \otimes_A F$ which is the quotient of the vector space tensor product $E\otimes F$ by the subspace $N$ spanned by elements of the form $ x a \otimes y - x \otimes \varphi(a)(y) $ for $a\in A, x\in E, y\in F$.  We define a $B$-valued inner product by
$$ \langle x_1\otimes y_1, x_2\otimes y_2 \rangle
= \langle y_1, \varphi(\langle x_1,x_2\rangle) y_2 \rangle. $$
It is easy to check that this respects the quotient by $N$.  Less obvious is:

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

If $z\in E\otimes F$ is such that $\langle z,z \rangle=0$ then $z\in N$.
=--

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

To do.
=--

It follows that we have a $B$-valued inner product on $E \otimes_A F$ which turns $E \otimes_A F$ into a Hilbert C$^*$-module over $B$, which is denoted by $E \otimes_\varphi F$.  This is the internal tensor product of $E$ and $F$ (using $\varphi$).

## Properties ##

### As a right $B$ module ###

### Action of adjointable operators on $E$ ###

To do.

## References ##

Lance's book, Chapter 4.


internal type theory

\tableofcontents

## Internal Type Theory ##

### Idea ###

In [[set theory]], it is common to build non-standard models of set theory inside an existing model of set theory. The same can be done in [[topos theory]]. It is natural to consider a similar construction in [[type theory]], or perhaps in [[homotopy type theory]].

### Question ###
Mike Shulman, in his blog-post [HoTT should eat itself](https://homotopytypetheory.org/2014/03/03/hott-should-eat-itself/) gives a good overview of the state of the art.
There is later work by [Altenkirch and Kaposi](#AltenkirchKaprosi)
which treats the set level case. This makes progress over earlier work in standard type theory.

### References ###

* [[Peter Dybjer]], *Internal type theory*, in:  *Types for Proofs and Programs*, Lecture Notes in Computer Science **1158** (1996) 120-134 [[doi:10.1007/3-540-61780-9_66](https://doi.org/10.1007/3-540-61780-9_66), [pdf](http://www.cse.chalmers.se/~peterd/papers/InternalTT.pdf)]

 * Alexandre Buisse and Peter Dybjer, _Towards Formalizing Categorical Models of Type Theory in Type Theory_ (2008). [PDF](http://publications.lib.chalmers.se/records/fulltext/212424/local_212424.pdf)
* James Chapman, _Type theory should eat itself_, Electronic Notes in Theoretical Computer Science 228 (2009): 21-36, [html](http://www.sciencedirect.com/science/article/pii/S157106610800577X).
* {#AltenkirchKaprosi} [[Thorsten Altenkirch]], Ambrus Kaposi, _Type Theory in Type Theory using Quotient Inductive Types_, POPL17, 2017 [PDF](http://www.cs.nott.ac.uk/~psztxa/publ/tt-in-tt.pdf)