Q0 (mathematical logic)

Q0 is Peter Andrews' formulation of the simply-typed lambda calculus, and provides a foundation for mathematics comparable to first-order logic plus set theory. It is a form of higher-order logic and closely related to the logics of the HOL theorem prover family.

The theorem proving systems TPS and ETPS are based on Q0. In August 2009, TPS won the first-ever competition among higher-order theorem proving systems.

Axioms of Q0
The system has just five axioms, which can be stated as:

$$(1)$$ $$g_{oo}T \land g_{oo}F = \forall x_o [g_{oo}x_o]$$

$$(2^\alpha)$$ $$[x_\alpha = y_\alpha] \supset [h_{o\alpha}x_\alpha = h_{o\alpha}y_\alpha]$$

$$(3^{\alpha\beta})$$ $$f_{\alpha \beta} = g_{\alpha \beta} = \forall x_\beta [f_{\alpha \beta}x_{\beta} = g_{\alpha \beta}x_\beta]$$

$$(4)$$ $$[\lambda \mathbf{x_\alpha} \mathbf{B}_\beta] \mathbf{A}_\alpha = \mathbf{S}^{\mathbf x_\alpha}_{A_\alpha}\mathbf{B}_\beta$$

$$(5)$$ ℩$$_{i(oi)}[\text{Q}_{oii}y_i] = y_i\,$$

(Axioms 2, 3, and 4 are axiom schemas—families of similar axioms. Instances of Axiom 2 and Axiom 3 vary only by the types of variables and constants, but instances of Axiom 4 can have any expression replacing A and B.)

The subscripted "o" is the type symbol for boolean values, and subscripted "i" is the type symbol for individual (non-boolean) values. Sequences of these represent types of functions, and can include parentheses to distinguish different function types. Subscripted Greek letters such as &alpha; and &beta; are syntactic variables for type symbols. Bold capital letters such as $A$, $B$, and $C$ are syntactic variables for WFFs, and bold lower case letters such as $x$, $y$ are syntactic variables for variables. $S$ indicates syntactic substitution at all free occurrences.

The only primitive constants are $Q_{((o&alpha;)&alpha;)}$, denoting equality of members of each type &alpha;, and $℩_{(i(oi))}$, denoting a description operator for individuals, the unique element of a set containing exactly one individual. The symbols &lambda; and brackets ("[" and "]") are syntax of the language. All other symbols are abbreviations for terms containing these, including quantifiers ∀ and ∃.

In Axiom 4, $x$ must be free for $A$ in $B$, meaning that the substitution does not cause any occurrences of free variables of $A$ to become bound in the result of the substitution.

About the axioms

 * Axiom 1 expresses the idea that $T$ and $F$ are the only boolean values.
 * Axiom schemas 2&alpha; and 3&alpha;&beta; express fundamental properties of functions.
 * Axiom schema 4 defines the nature of &lambda; notation.
 * Axiom 5 says that the selection operator is the inverse of the equality function on individuals. (Given one argument, $Q$ maps that individual to the set/predicate containing the individual.  In Q0, $x = y$ is an abbreviation for $Qxy$, which is an abbreviation for $(Qx)y$.) This operator is also known as the definite description operator.

In, Axiom 4 is developed in five subparts that break down the process of substitution. The axiom as given here is discussed as an alternative and proved from the subparts.

Extensions of the logical core
Andrews extends this logic with definitions of selection operators for collections of all types, so that

$$(5a)$$ ℩$$_{\alpha(o\alpha)}[\text{Q}_{o\alpha\alpha}y_i] = y_i\,$$

is a theorem (number 5309). In other words, all types have a definite description operator. This is a conservative extension, so the extended system is consistent if the core is consistent.

He also presents an additional Axiom 6, which states that there are infinitely many individuals, along with equivalent alternative axioms of infinity.

Unlike many other formulations of type theory and proof assistants based on type theory, Q0 does not provide for base types other than o and i, so the finite cardinal numbers for example are constructed as collections of individuals obeying the usual Peano postulates rather than a type in the sense of simple type theory.

Inference in Q0
Q0 has a single rule of inference.

Rule R. From $C$ and $A_{&alpha;} = B_{&alpha;}$ to infer the result of replacing one occurrence of $A_{&alpha;}$ in $C$ by an occurrence of $B_{&alpha;}$, provided that the occurrence of $A_{&alpha;}$ in $C$ is not (an occurrence of a variable) immediately preceded by $&lambda;$.

Derived rule of inference R&prime; enables reasoning from a set of hypotheses H.

Rule R&prime;. If $H ⊦ A_{&alpha;} = B_{&alpha;}$, and $H ⊦ C$, and $D$ is obtained from $C$ by replacing one occurrence of $A_{&alpha;}$ by an occurrence of $B_{&alpha;}$, then $H ⊦ D$, provided that:
 * The occurrence of $A_{&alpha;}$ in $C$ is not an occurrence of a variable immediately preceded by $&lambda;$, and
 * no variable free in $A_{&alpha;} = B_{&alpha;}$ and a member of $H$ is bound in $C$ at the replaced occurrence of $A_{&alpha;}$.

Note: The restriction on replacement of $A_{&alpha;}$ by $B_{&alpha;}$ in $C$ ensures that any variable free in both a hypothesis and $A_{&alpha;} = B_{&alpha;}$ continues to be constrained to have the same value in both after the replacement is done.

The Deduction Theorem for Q0 shows that proofs from hypotheses using Rule R&prime; can be converted into proofs without hypotheses and using Rule R.

Unlike some similar systems, inference in Q0 replaces a subexpression at any depth within a WFF with an equal expression. So for example given axioms:

1. $∃x Px$ 2. $Px ⊃ Qx$

and the fact that $A ⊃ B ≡ (A ≡ A ∧ B)$, we can proceed without removing the quantifier:

3. $Px ≡ (Px ∧ Qx)$  instantiating for A and B 4. $∃x (Px ∧ Qx)$   rule R substituting into line 1 using line 3.