Context
Type theory
Constructivism, Realizability, Computability
-Category theory
Foundations
foundations
The basis of it all
-
mathematical logic
-
deduction system, natural deduction, sequent calculus, lambda-calculus, judgment
-
type theory, simple type theory, dependent type theory
-
collection, object, type, term, set, element
-
equality, judgmental equality, typal equality
-
universe, size issues
-
higher-order logic
Set theory
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 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 , it is possible to construct a type and a witness that 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 is given by th type in a context.
One may also define contexts as coming with a variable name, in which case one needs a notion of -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:
-
saying that: “ is a well-formed context”;
-
saying that “ is a well-typed dependent type in context ”;
-
saying that “ is a well-typed term of type in context ”;
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):
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:
- - and are judgementally equal well-typed types in context .
- - and are judgementally equal well-typed terms of type in context .
Judgmental equality has its own structural rules: reflexivity, symmetry, transitivity, the principle of substitution, and the variable conversion rule.
- Reflexivity of judgmental equality
-
Symmetry of judgmental equality
-
Transitivity of judgmental equality
-
Principle of substitution of judgmentally equal terms:
-
Variable conversion rule:
Definitions
In addition, there are judgments for the initialization operator for types and for terms:
- - is defined to be the type in context .
- - is defined to be the term of type in context .
The initialization operator has its own structural rules: type formation, term introduction, and equality reflection.
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:
- Introduction rules for dependent product types:
- Elimination rules for dependent product types:
- Computation rules for dependent product types:
- Uniqueness rules for dependent product types:
Dependent sum types
- Formation rules for dependent sum types:
- Introduction rules for dependent sum types:
- Elimination rules for dependent sum types:
- Computation rules for dependent sum types:
- Uniqueness rules for dependent sum types:
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:
- Introduction rule for identity types:
Type of all propositions
In dependent type theory, a type is a subsingleton or h-proposition if for all and there is . This is usually represented as a term of a dependent function type
The type of all propositions is given by the following natural deduction inference rules:
-
Formation rules for the type of all propositions:
-
Introduction rules for the type of all propositions:
-
Elimination rules for the type of all propositions:
-
Computation rules for the type of all propositions:
- Uniqueness rules for the type of all propositions:
Weak function extensionality and propositional extensionality
- Extensionality principle of the type of all propositions:
- Weak function extensionality:
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 and predicate by weak function extensionality, the dependent function type is an h-proposition:
This means that the universal quantifier can be defined via the introduction rules of the type of all propositions as
Falsehood
By weak function extensionality, the dependent product type is a h-proposition with witness
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 can be defined via the introduction rules of the type of all propositions as
Implication and negation
Given any proposition and , one can define the constant predicate . By definition of function type in dependent type theory, the function type is defined as the dependent function type
which is an h-proposition by weak function extensionality:
This means that implication can be defined as the following proposition:
The negation of a proposition is given by implication into falsehood:
Truth
There are many different ways of defining truth . One definition is defining truth as false implying false, i.e. the negation of false:
Conjunction
Given two h-propositions and , the product type is also an h-proposition by the binary action on identifications:
Given and , we have
and by the elimination rules of product types, we have for , ,
and thus a dependent function
As a result, the conjunction of two propositions and can be defined as
Existential quantifier
In dependent type theory which uses the propositions as subsingletons interpretation, given a type and a family of h-propositions , the existential quantifier is defined as the propositional truncation of the dependent sum type . Given a type of all propositions, the propositional truncation of a type is defined as the dependent product type
Assuming that we have a predicate , substituting the dependent sum type in for , we get the following type
which by currying is equivalent to the type
This type is an h-proposition by repeated applications of weak function extensionality and the introduction rule of the type of all propositions:
As a result, the existential quantifier of the predicate can be defined as the proposition
Disjunction
In dependent type theory which uses the propositions as subsingletons interpretation, given two h-propositions and , the existential quantifier is defined as the propositional truncation of the sum type . Given a type of all propositions, the propositional truncation of a type is defined as the dependent product type
Assuming that we have two propositions and , substituting the sum type in for , we get the following type
which is equivalent to the type
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:
As a result, the disjunction of the two propositions and can be defined as the proposition
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 is either true or false:
References
-
Bart Jacobs, Chapter 10 in: Categorical Logic and Type Theory, Studies in Logic and the Foundations of Mathematics 141, Elsevier (1998) [ISBN:978-0-444-50170-7, pdf]
-
Univalent Foundations Project, Homotopy Type Theory – Univalent Foundations of Mathematics (2013) [web, pdf]
-
Egbert Rijke, Introduction to Homotopy Type Theory, Cambridge Studies in Advanced Mathematics, Cambridge University Press (arXiv:2212.11082)
-
Michael Norrish and Konrad Slind, The HOL System LOGIC (pdf)