nLab higher-order logic as a dependent type theory

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
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity 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 set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
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

Constructivism, Realizability, Computability

(0,1)(0,1)-Category theory

Foundations

foundations

The basis of it all

 Set theory

set theory

Foundational axioms

foundational axioms

Removing axioms

Contents

Idea

Higher-order logic is a logic which contains the notion of higher-order predicates, which are functions between predicates. Traditionally, higher-order logic, such as HOL4 or Isabelle, is presented as a simple type theory. In addition, intuitionistic higher-order logic is said to be the internal logic of an elementary topos, and classical higher-order logic is said to be the internal logic of a Boolean topos. However, an elementary topos or Boolean topos is a locally cartesian closed category, whose internal logic is a dependent type theory. This implies that higher-order logic can be presented as a dependent type theory.

Dependent type theory already has the ability to form higher-order functions via iterated function types. The only thing that is missing in dependent type theory is the ability to construct predicates, which are functions into a set of truth values. This is represented by an impredicative type of all propositions Prop\mathrm{Prop} in dependent type theory. The idea behind the type of all propositions in dependent type theory is the principle of propositions as codes for subsingletons, and so for each proposition P:PropP:\mathrm{Prop}, it is possible to construct a type El(P)\mathrm{El}(P) and a witness that El(P)\mathrm{El}(P) is a subsingleton or h-propositions.

Adding a type of all propositions to dependent type theory is sufficient to construct all the usual first-order logical operations and values that are also required for higher-order logic, such as truth, falsehood, disjunction, conjunction, implication, negation, exclusive disjunction, the existential quantifier, the uniqueness quantifier, and the universal quantifier. This is in contrast to higher-order logic presented as a simple type theory, where each of the logical operations have to be added to the theory using axioms.

There are usually two ways to present a dependent type theory: one which uses a hierarchy of universes and either no type judgments or an infinite number of type judgments to define types, and a second which uses no universes and a single type judgment to define types. Higher-order logic such as HOL or Isabelle has no infinite hierarchy of universes, so the only way to present higher-order logic as a dependent type theory is using a single type judgment.

Presentation

Judgments and contexts

The syntax of higher-order logic as dependent type theory can be constructed in two stages:

  • The first is the raw or untyped syntax of the theory consisting of expressions that are readable but not necessarily meaningful.

  • The second stage consists of defining the derivable judgements of the type theory inductively which then pick out the meaningful contexts, types and terms.

A context is a list of succesively dependent types. The variables may be defined as de Bruijn indices, in which case the type of a variable nn is given by nnth type in a context.

One may also define contexts as coming with a variable name, in which case one needs a notion of α\alpha-equivalence (syntactic identity modulo renaming of bound variables) and of capture-free substitution. De Bruijn indices avoid this step but can be more obfuscating.

Types and terms are built inductively from various constructors. Types, terms and contexts are defined mutually.

We have the basic judgement forms:

  • Γctx\Gamma \; \mathrm{ctx}

    saying that: “Γ\Gamma is a well-formed context”;

  • ΓAtype\Gamma \vdash A\; \mathrm{type}

    saying that “AA is a well-typed dependent type in context Γ\Gamma”;

  • Γa:A\Gamma \vdash a : A

    saying that “aa is a well-typed term of type AA in context Γ\Gamma”;

We work in the logical framework of natural deduction, where everything is given by inference rules.

To start with, contexts are built from dependent types by the following rules (cf. type telescope):

()ctxΓctxΓAtype(Γ,a:A)ctx \frac{}{() \; \mathrm{ctx}} \qquad \frac{\Gamma \; \mathrm{ctx} \quad \Gamma \vdash A \; \mathrm{type}}{(\Gamma, a:A) \; \mathrm{ctx}}

Structural rules

Among the structural rules of dependent type theory are (e.g. Jacobs (1998), p. 122, Rijke (2022), Sec. 1.4):

The weakening and substitution rules are admissible rules: they do not need to be explicitly included in the type theory as they could be proven by induction on the structure of all possible derivations.

Judgmental equality

In addition, there are judgments for judgmental equality of types and of terms:

  • ΓAAtype\Gamma \vdash A \equiv A' \; \mathrm{type} - AA and AA' are judgementally equal well-typed types in context Γ\Gamma.
  • Γaa:A\Gamma \vdash a \equiv a' : A - aa and aa' are judgementally equal well-typed terms of type AA in context Γ\Gamma.

Judgmental equality has its own structural rules: reflexivity, symmetry, transitivity, the principle of substitution, and the variable conversion rule.

  • Reflexivity of judgmental equality
ΓAtypeΓAAtype\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash A \equiv A \; \mathrm{type}}
ΓAtypeΓa:AΓaa:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a:A}{\Gamma \vdash a \equiv a:A}
  • Symmetry of judgmental equality

    ΓABtypeΓBAtype\frac{\Gamma \vdash A \equiv B \; \mathrm{type}}{\Gamma \vdash B \equiv A \; \mathrm{type}}
    ΓAtypeΓab:AΓba:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b:A}{\Gamma \vdash b \equiv a:A}
  • Transitivity of judgmental equality

    ΓABtypeΓBCtypeΓACtype\frac{\Gamma \vdash A \equiv B \; \mathrm{type} \quad \Gamma \vdash B \equiv C \; \mathrm{type} }{\Gamma \vdash A \equiv C \; \mathrm{type}}
    ΓAtypeΓab:Abc:AΓac:A\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b:A \quad b \equiv c:A }{\Gamma \vdash a \equiv c:A}
  • Principle of substitution of judgmentally equal terms:

    ΓAtypeΓab:AΓ,x:A,Δ(x)B(x)typeΓ,Δ(b)B(a)B(b)type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta(x) \vdash B(x) \; \mathrm{type}}{\Gamma, \Delta(b) \vdash B(a) \equiv B(b) \; \mathrm{type}}
    ΓAtypeΓab:AΓ,x:A,Δc(x):B(x)Γ,Δ(b)c(a)c(b):B(b)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash a \equiv b : A \quad \Gamma, x:A, \Delta \vdash c(x):B(x)}{\Gamma, \Delta(b) \vdash c(a) \equiv c(b): B(b)}
  • Variable conversion rule:

    ΓABtypeΓ,x:A,Δ𝒥Γ,x:B,Δ𝒥\frac{\Gamma \vdash A \equiv B \; \mathrm{type} \quad \Gamma, x:A, \Delta \vdash \mathcal{J}}{\Gamma, x:B, \Delta \vdash \mathcal{J}}

Definitions

In addition, there are judgments for the initialization operator for types and for terms:

  • ΓAAtype\Gamma \vdash A' \coloneqq A \; \mathrm{type} - AA' is defined to be the type AA in context Γ\Gamma.
  • Γaa:A\Gamma \vdash a' \coloneqq a : A - aa' is defined to be the term a:Aa:A of type AA in context Γ\Gamma.

The initialization operator has its own structural rules: type formation, term introduction, and equality reflection.

  • Formation and judgmental equality reflection rules for type definition:

    ΓBAtypeΓBtypeΓBAtypeΓBAtype\frac{\Gamma \vdash B \coloneqq A \; \mathrm{type}}{\Gamma \vdash B \; \mathrm{type}} \qquad \frac{\Gamma \vdash B \coloneqq A \; \mathrm{type}}{\Gamma \vdash B \equiv A \; \mathrm{type}}
  • Introduction and judgmental equality reflection rules for term definition:

    Γba:AΓb:AΓba:AΓba:A\frac{\Gamma \vdash b \coloneqq a:A}{\Gamma \vdash b:A} \qquad \frac{\Gamma \vdash b \coloneqq a:A}{\Gamma \vdash b \equiv a:A}

Rules for types

Each type in Martin-Löf dependent type theory comes with a type formation rule, a term introduction rule, a term elimination rule, a computation rule, and an optional uniqueness rule. The elimination rules we give here are not contextual elimination rules, and the conversion rules given here are not contextual conversion rules. In addition, there are judgmental congruence rules which says that each of the natural deduction rules preserve judgmental equality, but for the sake of brevity the congruence rules are not included here.

Dependent product types

  • Formation rules for dependent product types:
ΓAtypeΓ,x:AB(x)typeΓ x:AB(x)type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma \vdash \prod_{x:A} B(x) \; \mathrm{type}}
  • Introduction rules for dependent product types:
Γ,x:Ab(x):B(x)Γλ(x:A).b(x): x:AB(x)\frac{\Gamma, x:A \vdash b(x):B(x)}{\Gamma \vdash \lambda(x:A).b(x):\prod_{x:A} B(x)}
  • Elimination rules for dependent product types:
Γf: x:AB(x)Γa:AΓf(a):B(a)\frac{\Gamma \vdash f:\prod_{x:A} B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash f(a):B(a)}
  • Computation rules for dependent product types:
Γ,x:Ab(x):B(x)Γa:AΓλ(x:A).b(x)(a)b(a):B(a)\frac{\Gamma, x:A \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash \lambda(x:A).b(x)(a) \equiv b(a):B(a)}
  • Uniqueness rules for dependent product types:
Γf: x:AB(x)Γfλ(x).f(x): x:AB(x)\frac{\Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma \vdash f \equiv \lambda(x).f(x):\prod_{x:A} B(x)}

Dependent sum types

  • Formation rules for dependent sum types:
ΓAtypeΓ,x:AB(x)typeΓ x:AB(x)type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma \vdash \sum_{x:A} B(x) \; \mathrm{type}}
  • Introduction rules for dependent sum types:
Γa:AΓb:B(a)Γ(a,b): x:AB(x)\frac{\Gamma \vdash a:A \quad \Gamma \vdash b:B(a)}{\Gamma \vdash (a, b):\sum_{x:A} B(x)}
  • Elimination rules for dependent sum types:
Γz: x:AB(x)Γπ 1(z):AΓz: x:AB(x)Γπ 2(z):B(π 1(z))\frac{\Gamma \vdash z:\sum_{x:A} B(x)}{\Gamma \vdash \pi_1(z):A} \qquad \frac{\Gamma \vdash z:\sum_{x:A} B(x)}{\Gamma \vdash \pi_2(z):B(\pi_1(z))}
  • Computation rules for dependent sum types:
Γa:AΓb:B(a)Γπ 1(a,b)a:AΓa:AΓb:B(a)Γπ 2(a,b)b:B(π 1(a,b))\frac{\Gamma \vdash a:A \quad \Gamma \vdash b:B(a)}{\Gamma \vdash \pi_1(a, b) \equiv a:A} \qquad \frac{\Gamma \vdash a:A \quad \Gamma \vdash b:B(a)}{\Gamma \vdash \pi_2(a, b) \equiv b:B(\pi_1(a, b))}
  • Uniqueness rules for dependent sum types:
Γz: x:AB(x)Γz(π 1(z),π 2(z)): x:AB(x)\frac{\Gamma \vdash z:\sum_{x:A} B(x)}{\Gamma \vdash z \equiv (\pi_1(z), \pi_2(z)):\sum_{x:A} B(x)}

Identity types

There is another version of equality, called the identity type or typal equality, because this equality is a type. The identity type is only be used for equality between terms of a type, and unless one is using Russell universes where types are represented by terms of a Russell universe, identity types cannot be used for equality of types.

  • Formation rule for identity types:
ΓAtypeΓ,a:A,b:Aa= Abtype\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, a:A, b:A \vdash a =_A b \; \mathrm{type}}
  • Introduction rule for identity types:
ΓAtypeΓ,a:Arefl A(a):a= Aa\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, a:A \vdash \mathrm{refl}_A(a) : a =_A a}
  • Elimination rule for identity types:

    Γ,a:A,b:A,p:a= AbC(a,b,p)typeΓt: x:AC(x,x,refl A(x))Γ,a:A,b:A,p:a= AbJ(t,a,b,p):C(a,b,p)\frac{\Gamma, a:A, b:A, p:a =_A b \vdash C(a, b, p) \; \mathrm{type} \quad \Gamma \vdash t:\prod_{x:A} C(x, x, \mathrm{refl}_A(x))}{\Gamma, a:A, b:A, p:a =_A b \vdash J(t, a, b, p):C(a, b, p)}
  • Computation rules for identity types:

    Γ,a:A,b:A,p:a= AbC(a,b,p)typeΓt: x:AC(x,x,refl A(x))Γ,x:AJ(t,x,x,refl(x))t(x):C(x,x,refl A(x))\frac{\Gamma, a:A, b:A, p:a =_A b \vdash C(a, b, p) \; \mathrm{type} \quad \Gamma \vdash t:\prod_{x:A} C(x, x, \mathrm{refl}_A(x))}{\Gamma, x:A \vdash J(t, x, x, \mathrm{refl}(x)) \equiv t(x):C(x, x, \mathrm{refl}_A(x))}

Type of all propositions

In dependent type theory, a type AA is a subsingleton or h-proposition if for all x:Ax:A and y:Ay:A there is p(x,y):x= Ayp(x, y):x =_A y. This is usually represented as a term pp of a dependent function type

ishProp(A) x:A y:Ax= Ay\mathrm{ishProp}(A) \coloneqq \prod_{x:A} \prod_{y:A} x =_A y

The type of all propositions is given by the following natural deduction inference rules:

  • Formation rules for the type of all propositions:

    ΓctxΓProptype\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash \mathrm{Prop} \; \mathrm{type}}
  • Introduction rules for the type of all propositions:

    ΓAtypeΓtoProp A:ishProp(A)Prop\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash \mathrm{toProp}_A:\mathrm{ishProp}(A) \to \mathrm{Prop}}
  • Elimination rules for the type of all propositions:

    ΓA:PropΓEl(A)typeΓA:PropΓproptrunc(A):ishProp(El(A))\frac{\Gamma \vdash A:\mathrm{Prop}}{\Gamma \vdash \mathrm{El}(A) \; \mathrm{type}} \qquad \frac{\Gamma \vdash A:\mathrm{Prop}}{\Gamma \vdash \mathrm{proptrunc}(A):\mathrm{ishProp}(\mathrm{El}(A))}
  • Computation rules for the type of all propositions:

ΓAtypeΓp:ishProp(A)ΓEl(toProp A(p))Atype\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash p:\mathrm{ishProp}(A)}{\Gamma \vdash \mathrm{El}(\mathrm{toProp}_A(p)) \equiv A \; \mathrm{type}}
ΓAtypeΓp:ishProp(A)Γproptrunc(toProp A(p))p:isProp(A)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash p:\mathrm{ishProp}(A)}{\Gamma \vdash \mathrm{proptrunc}(\mathrm{toProp}_A(p)) \equiv p:\mathrm{isProp}(A)}
  • Uniqueness rules for the type of all propositions:
ΓA:PropΓAtoProp El(A)(proptrunc(A)):Prop\frac{\Gamma \vdash A:\mathrm{Prop}}{\Gamma \vdash A \equiv \mathrm{toProp}_{\mathrm{El}(A)}(\mathrm{proptrunc}(A)):\mathrm{Prop}}

Weak function extensionality and propositional extensionality

  • Extensionality principle of the type of all propositions:
ΓA:PropΓB:PropΓext Prop(A,B):isEquiv(transport El(A,B))\frac{\Gamma \vdash A:\mathrm{Prop} \quad \Gamma \vdash B:\mathrm{Prop}} {\Gamma \vdash \mathrm{ext}_\mathrm{Prop}(A, B):\mathrm{isEquiv}(\mathrm{transport}^\mathrm{El}(A, B))}
  • Weak function extensionality:
ΓAtypeΓB:APropΓwfunext A(B):ishProp( x:AEl(B(x)))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B:A \to \mathrm{Prop}}{\Gamma \vdash \mathrm{wfunext}_A(B):\mathrm{ishProp}\left(\prod_{x:A} \mathrm{El}(B(x))\right)}

Constructing the logical operators

In this section we construct truth, falsehood, disjunction, conjunction, implication, negation, the existential quantifier, and the universal quantifier from dependent product types, dependent sum types, identity types, and the type of all propositions.

Universal quantification

Given any type AA and predicate P:APropP:A \to \mathrm{Prop} by weak function extensionality, the dependent function type x:AEl(P(x))\prod_{x:A} \mathrm{El}(P(x)) is an h-proposition:

wfunext A(P):ishProp( x:AEl(P(x)))\mathrm{wfunext}_A(P):\mathrm{ishProp}\left(\prod_{x:A} \mathrm{El}(P(x))\right)

This means that the universal quantifier can be defined via the introduction rules of the type of all propositions as

x:A.P(x)toProp x:AEl(P(x))(wfunext A(P))\forall x:A.P(x) \coloneqq \mathrm{toProp}_{\prod_{x:A} \mathrm{El}(P(x))}(\mathrm{wfunext}_A(P))

Falsehood

By weak function extensionality, the dependent product type P:PropEl(P)\prod_{P:\mathrm{Prop}} \mathrm{El}(P) is a h-proposition with witness

wfunext(Prop,id Prop):ishProp( P:PropEl(P))\mathrm{wfunext}(\mathrm{Prop}, \mathrm{id}_\mathrm{Prop}):\mathrm{ishProp}\left(\prod_{P:\mathrm{Prop}} \mathrm{El}(P)\right)

This dependent product type is the empty type, since the definition implies that if the type has an element, then every proposition has an element and is thus a contractible type. Since the empty type is the subsingleton / h-proposition representation of falsehood, this means that falsehood :Prop\bot:\mathrm{Prop} can be defined via the introduction rules of the type of all propositions as

toProp P:PropEl(P)(wfunext Prop(id Prop))\bot \coloneqq \mathrm{toProp}_{\prod_{P:\mathrm{Prop}} \mathrm{El}(P)}(\mathrm{wfunext}_\mathrm{Prop}(\mathrm{id}_\mathrm{Prop}))

Implication and negation

Given any proposition Q:PropQ:\mathrm{Prop} and P:PropP:\mathrm{Prop}, one can define the constant predicate λx:El(Q).P:El(Q)Prop\lambda x:\mathrm{El}(Q).P:\mathrm{El}(Q) \to \mathrm{Prop}. By definition of function type in dependent type theory, the function type El(Q)El(P)\mathrm{El}(Q) \to \mathrm{El}(P) is defined as the dependent function type

El(Q)El(P) x:El(Q)El(P) x:El(Q)El((λx:El(Q).P)(x))\mathrm{El}(Q) \to \mathrm{El}(P) \coloneqq \prod_{x:\mathrm{El}(Q)} \mathrm{El}(P) \equiv \prod_{x:\mathrm{El}(Q)} \mathrm{El}((\lambda x:\mathrm{El}(Q).P)(x))

which is an h-proposition by weak function extensionality:

wfunext El(Q)(λx:El(Q).P):ishProp( x:El(Q)El((λx:El(Q).P)(x)))\mathrm{wfunext}_{\mathrm{El}(Q)}(\lambda x:\mathrm{El}(Q).P):\mathrm{ishProp}\left(\prod_{x:\mathrm{El}(Q)} \mathrm{El}((\lambda x:\mathrm{El}(Q).P)(x))\right)

This means that implication QPQ \Rightarrow P can be defined as the following proposition:

QPtoProp x:El(Q)El((λx:El(Q).P)(x))(wfunext El(Q)(λx:El(Q).P))Q \Rightarrow P \coloneqq \mathrm{toProp}_{\prod_{x:\mathrm{El}(Q)} \mathrm{El}((\lambda x:\mathrm{El}(Q).P)(x))}(\mathrm{wfunext}_{\mathrm{El}(Q)}(\lambda x:\mathrm{El}(Q).P))

The negation ¬P\neg P of a proposition P:PropP:\mathrm{Prop} is given by implication into falsehood:

¬PP\neg P \coloneqq P \Rightarrow \bot

Truth

There are many different ways of defining truth :Prop\top:\mathrm{Prop}. One definition is defining truth as false implying false, i.e. the negation of false:

\top \coloneqq \bot \Rightarrow \bot

Conjunction

Given two h-propositions AA and BB, the product type A×BA \times B is also an h-proposition by the binary action on identifications:

apbinary pair A,B: x:A y:B x:A y:B((x= Ax)×(y= By))(pair A,B(x,y)= A×Bpair A,B(x,y))\mathrm{apbinary}_{\mathrm{pair}_{A, B}}:\prod_{x:A} \prod_{y:B} \prod_{x':A} \prod_{y:B'} ((x =_A x') \times (y =_B y')) \to (\mathrm{pair}_{A, B}(x, y) =_{A \times B} \mathrm{pair}_{A, B}(x', y'))

Given p A: x:A x:Ax= Axp_A:\prod_{x:A} \prod_{x':A} x =_A x' and p B: y:B y:By= Byp_B:\prod_{y:B} \prod_{y':B} y =_B y', we have

apbinary pair A,B(x,y,x,y,p A(x,x),p B(y,y)):pair A,B(x,y)= A×Bpair A,B(x,y)\mathrm{apbinary}_{\mathrm{pair}_{A, B}}(x, y, x', y', p_A(x, x'), p_B(y, y')):\mathrm{pair}_{A, B}(x, y) =_{A \times B} \mathrm{pair}_{A, B}(x', y')

and by the elimination rules of product types, we have for z:A×Bz:A \times B, z:A×Bz':A \times B,

apbinary pair A,B(π A,B A(z),π A,B B(z),π A,B A(z),π A,B B(z),p A(π A,B A(z),π A,B A(z)),p B(π A,B B(z),π A,B A(z))):z= A×Bz\mathrm{apbinary}_{\mathrm{pair}_{A, B}}(\pi_{A, B}^A(z), \pi_{A, B}^B(z), \pi_{A, B}^A(z'), \pi_{A, B}^B(z'), p_A(\pi_{A, B}^A(z), \pi_{A, B}^A(z')), p_B(\pi_{A, B}^B(z), \pi_{A, B}^A(z'))):z =_{A \times B} z'

and thus a dependent function

λz:A×B.λz:A×B.apbinary pair A,B(π A,B A(z),π A,B B(z),π A,B A(z),π A,B B(z),p A(π A,B A(z),π A,B A(z)),p B(π A,B B(z),π A,B A(z))):ishProp(A×B)\lambda z:A \times B.\lambda z':A \times B.\mathrm{apbinary}_{\mathrm{pair}_{A, B}}(\pi_{A, B}^A(z), \pi_{A, B}^B(z), \pi_{A, B}^A(z'), \pi_{A, B}^B(z'), p_A(\pi_{A, B}^A(z), \pi_{A, B}^A(z')), p_B(\pi_{A, B}^B(z), \pi_{A, B}^A(z'))):\mathrm{ishProp}(A \times B)

As a result, the conjunction PQ:PropP \wedge Q:\mathrm{Prop} of two propositions P:PropP:\mathrm{Prop} and Q:PropQ:\mathrm{Prop} can be defined as

PQtoProp El(P)×El(Q)(λz:El(P)×El(Q).λz:El(P)×El(Q).apbinary pair El(P),El(Q)(π El(P),El(Q) El(P)(z),π El(P),El(Q) El(Q)(z),π El(P),El(Q) El(P)(z),π El(P),El(Q) El(Q)(z),proptrunc(P)(π El(P),El(Q) El(P)(z),π El(P),El(Q) El(P)(z)),proptrunc(Q)(π El(P),El(Q) El(Q)(z),π El(P),El(Q) El(Q)(z))))P \wedge Q \coloneqq \mathrm{toProp}_{\mathrm{El}(P) \times \mathrm{El}(Q)}(\lambda z:\mathrm{El}(P) \times \mathrm{El}(Q).\lambda z':\mathrm{El}(P) \times \mathrm{El}(Q).\mathrm{apbinary}_{\mathrm{pair}_{\mathrm{El}(P), \mathrm{El}(Q)}}(\pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(P)}(z), \pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(Q)}(z), \pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(P)}(z'), \pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(Q)}(z'), \mathrm{proptrunc}(P)(\pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(P)}(z), \pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(P)}(z')), \mathrm{proptrunc}(Q)(\pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(Q)}(z), \pi_{\mathrm{El}(P), \mathrm{El}(Q)}^{\mathrm{El}(Q)}(z'))))

Existential quantifier

In dependent type theory which uses the propositions as subsingletons interpretation, given a type AA and a family of h-propositions (P(x)) x:A(P(x))_{x:A}, the existential quantifier is defined as the propositional truncation of the dependent sum type x:AP(x)\sum_{x:A} P(x). Given a type of all propositions, the propositional truncation [A][A] of a type AA is defined as the dependent product type

Q:Prop(AEl(Q))El(Q)\prod_{Q:\mathrm{Prop}} (A \to \mathrm{El}(Q)) \to \mathrm{El}(Q)

Assuming that we have a predicate P:APropP:A \to \mathrm{Prop}, substituting the dependent sum type x:AEl(P(x))\sum_{x:A} \mathrm{El}(P(x)) in for AA, we get the following type

Q:Prop(( x:AEl(P(x)))El(Q))El(Q)\prod_{Q:\mathrm{Prop}} \left(\left(\sum_{x:A} \mathrm{El}(P(x))\right) \to \mathrm{El}(Q)\right) \to \mathrm{El}(Q)

which by currying is equivalent to the type

Q:Prop( x:A(El(P(x))El(Q)))El(Q)\prod_{Q:\mathrm{Prop}} \left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)

This type is an h-proposition by repeated applications of weak function extensionality and the introduction rule of the type of all propositions:

wfunext ( x:A(El(P(x))El(Q)))(λx:( x:A(El(P(x))El(Q))).Q):ishProp(( x:A(El(P(x))El(Q)))El(Q))\mathrm{wfunext}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right)}\left(\lambda x:\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right).Q\right):\mathrm{ishProp}\left(\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)\right)
toProp ( x:A(El(P(x))El(Q)))El(Q)(wfunext ( x:A(El(P(x))El(Q)))(λx:( x:A(El(P(x))El(Q))).Q)):Prop\mathrm{toProp}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right)}\left(\lambda x:\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right).Q\right)\right):\mathrm{Prop}
wfunext Q:Prop( x:A(El(P(x))El(Q)))El(Q)(λQ:Prop.toProp ( x:A(El(P(x))El(Q)))El(Q)(wfunext ( x:A(El(P(x))El(Q)))(λx:( x:A(El(P(x))El(Q))).Q))):ishProp( Q:Prop( x:A(El(P(x))El(Q)))El(Q))\mathrm{wfunext}_{\prod_{Q:\mathrm{Prop}} \left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)}\left(\lambda Q:\mathrm{Prop}.\mathrm{toProp}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right)}\left(\lambda x:\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right).Q\right)\right)\right):\mathrm{ishProp}\left(\prod_{Q:\mathrm{Prop}} \left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)\right)

As a result, the existential quantifier x:A.P(x)\exists x:A.P(x) of the predicate P:APropP:A \to \mathrm{Prop} can be defined as the proposition

x:A.P(x)toProp Q:Prop( x:A(El(P(x))El(Q)))El(Q))(wfunext Q:Prop( x:A(El(P(x))El(Q)))El(Q)(λQ:Prop.toProp ( x:A(El(P(x))El(Q)))El(Q)(wfunext ( x:A(El(P(x))El(Q)))(λx:( x:A(El(P(x))El(Q))).Q))))\exists x:A.P(x) \coloneqq \mathrm{toProp}_{\prod_{Q:\mathrm{Prop}} \left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q))}\left(\mathrm{wfunext}_{\prod_{Q:\mathrm{Prop}} \left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)}\left(\lambda Q:\mathrm{Prop}.\mathrm{toProp}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right)}\left(\lambda x:\left(\prod_{x:A} (\mathrm{El}(P(x)) \to \mathrm{El}(Q))\right).Q\right)\right)\right)\right)

Disjunction

In dependent type theory which uses the propositions as subsingletons interpretation, given two h-propositions AA and BB, the existential quantifier is defined as the propositional truncation of the sum type A+BA + B. Given a type of all propositions, the propositional truncation [A][A] of a type AA is defined as the dependent product type

Q:Prop(AEl(Q))El(Q)\prod_{Q:\mathrm{Prop}} (A \to \mathrm{El}(Q)) \to \mathrm{El}(Q)

Assuming that we have two propositions P:PropP:\mathrm{Prop} and P:PropP':\mathrm{Prop}, substituting the sum type El(P)+El(P)\mathrm{El}(P) + \mathrm{El}(P') in for AA, we get the following type

Q:Prop((El(P)+El(P))El(Q))El(Q)\prod_{Q:\mathrm{Prop}} \left((\mathrm{El}(P) + \mathrm{El}(P')) \to \mathrm{El}(Q)\right) \to \mathrm{El}(Q)

which is equivalent to the type

Q:Prop(El(P)El(Q))×(El(P)El(Q))El(Q)\prod_{Q:\mathrm{Prop}} (\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)

The latter type still makes sense if the dependent type theory doesn’t have any pre-defined sum types, such as is the case for higher-order logic.

This type is an h-proposition by repeated applications of weak function extensionality and the introduction rule of the type of all propositions:

wfunext (El(P)El(Q))×(El(P)El(Q))(λx:(El(P)El(Q))×(El(P)El(Q)).Q):ishProp((El(P)El(Q))×(El(P)El(Q))El(Q))\mathrm{wfunext}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q))}\left(\lambda x:(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)).Q\right):\mathrm{ishProp}\left((\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)\right)
toProp (El(P)El(Q))×(El(P)El(Q))El(Q)(wfunext (El(P)El(Q))×(El(P)El(Q))(λx:(El(P)El(Q))×(El(P)El(Q)).Q)):Prop\mathrm{toProp}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q))}\left(\lambda x:(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)).Q\right)\right):\mathrm{Prop}
wfunext Q:Prop(El(P)El(Q))×(El(P)El(Q))El(Q)(toProp (El(P)El(Q))×(El(P)El(Q))El(Q)(wfunext (El(P)El(Q))×(El(P)El(Q))(λx:(El(P)El(Q))×(El(P)El(Q)).Q))):ishProp( Q:Prop(El(P)El(Q))×(El(P)El(Q))El(Q))\mathrm{wfunext}_{\prod_{Q:\mathrm{Prop}} (\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)}\left(\mathrm{toProp}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q))}\left(\lambda x:(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)).Q\right)\right)\right):\mathrm{ishProp}\left(\prod_{Q:\mathrm{Prop}} (\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)\right)

As a result, the disjunction PP:PropP \vee P':\mathrm{Prop} of the two propositions P:PropP:\mathrm{Prop} and P:PropP':\mathrm{Prop} can be defined as the proposition

PPtoProp Q:Prop(El(P)El(Q))×(El(P)El(Q))El(Q)(wfunext Q:Prop(El(P)El(Q))×(El(P)El(Q))El(Q)(toProp (El(P)El(Q))×(El(P)El(Q))El(Q)(wfunext (El(P)El(Q))×(El(P)El(Q))(λx:(El(P)El(Q))×(El(P)El(Q)).Q))))P \vee P' \coloneqq \mathrm{toProp}_{\prod_{Q:\mathrm{Prop}} (\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{\prod_{Q:\mathrm{Prop}} (\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)}\left(\mathrm{toProp}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)) \to \mathrm{El}(Q)}\left(\mathrm{wfunext}_{(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q))}\left(\lambda x:(\mathrm{El}(P) \to \mathrm{El}(Q)) \times (\mathrm{El}(P') \to \mathrm{El}(Q)).Q\right)\right)\right)\right)

Excluded middle

The above rules are sufficient for intuitionistic higher-order logic. However, higher-order logics like HOL and Isabelle are classical logics, and so require an additional axiom: the law of excluded middle, which says that the proposition PP is either true or false:

ΓctxΓlem: P:PropEl(P¬P)\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash \mathrm{lem}:\prod_{P:\mathrm{Prop}} \mathrm{El}(P \vee \neg P)}

References

Last revised on December 19, 2024 at 18:50:13. See the history of this page for a list of all contributions to it.