nLab two-valued type

Contents

Context

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
cut elimination for implicationcounit for hom-tensor adjunctionbeta reduction
introduction rule for implicationunit for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction setinternal homfunction type
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian productdependent productdependent product type
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijectionisomorphism/adjoint equivalenceequivalence of types
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Contents

Idea

The two-valued type is an axiomatization of the two-valued object in the context of homotopy type theory.

Definition

As an inductive type, the two-valued type is given by

Inductive Two : Type
  | zero : Two
  | one : Two

This says that the type is inductively constructed from two terms in the type Two, whose interpretation is as the two points of the type; hence the name two-valued type.

Boolean logic

The two-valued type is also called the booleans type or the type of booleans. One could recursively define the logical functions on 2\mathbf{2} as follows

  • For negation ¬\neg
    • ¬0:=1\neg 0 := 1
    • ¬1:=0\neg 1 := 0
  • For conjunction \wedge
    • 0a:=00 \wedge a := 0
    • 1a:=a1 \wedge a := a
  • For disjunction \vee
    • 0a:=a0 \vee a := a
    • 1a:=11 \vee a := 1
  • For implication \implies
    • 0a:=10 \implies a := 1
    • 1a:=a1 \implies a := a
  • For the biconditional \iff
    • 0a:=¬a0 \iff a := \neg a
    • 1a:=a1 \iff a := a

One could prove that (2,0,1,¬,,,)(\mathbf{2}, 0, 1, \neg, \wedge, \vee, \implies) form a Boolean algebra. The poset structure is given by implication.

One could also inductively define observational equality on the booleans Eq 𝟚(x,y)\mathrm{Eq}_\mathbb{2}(x, y) as an indexed inductive type on the boolean type 𝟚\mathbb{2} with the following constructors

eq 0:Eq 𝟚(0,0)\mathrm{eq}_0: \mathrm{Eq}_\mathbb{2}(0, 0)
eq 1:Eq 𝟚(1,1)\mathrm{eq}_1: \mathrm{Eq}_\mathbb{2}(1, 1)

A boolean predicate valued in a type TT is a function P:T2P: T \rightarrow \mathbf{2}, and the type T2T \to \mathbf{2} is a boolean function algebra for finite types TT, and if path types exist, for all types TT. Thus the functor F:UBoolAlgF: U \to BoolAlg, F(T)=T2F(T) = T \to \mathbf{2} for a type universe UU is a Boolean hyperdoctrine, and one could do classical first-order logic inside UU if 2\mathbf{2} and path types exist in UU.

In fact, just with dependent sum types, dependent product types, empty type, unit type, and the two-valued type in a type universe UU, any two-valued logic could be done inside UU. Furthermore, since binary disjoint coproducts exist when 2\mathbf{2} exists, all finite types exist in UU, and any finitely-valued logic?, such as the internal logic of a finite cartesian power of Set, could be done inside UU.

For finite types, one could also inductively define specific functions

aA.()(a):(A2)2\forall a \in A.(-)(a):(A \to \mathbf{2}) \to \mathbf{2}
aA.()(a):(A2)2\exists a \in A.(-)(a):(A \to \mathbf{2}) \to \mathbf{2}

from the type of boolean predicates on AA and 2\mathbf{2} such that they behave like existential quantification and universal quantification.

Bi-pointed types

A bi-pointed type is a type AA with a function 2A\mathbf{2}\to A. Examples include the interval type and the function type of the natural numbers type.

Properties

𝟚 P:𝒰isProp(P)×isDecidable(P)\mathbb{2} \cong \sum_{P:\mathcal{U}} isProp(P) \times isDecidable(P)

As a result, sometimes the two-valued type is called a decidable subset classifier.

See also

References

For discussion of booleans types in the context of homotopy type theory:

Last revised on December 1, 2022 at 15:03:18. See the history of this page for a list of all contributions to it.