Logic & kernel theory

Conversion

This page proves that the kernel's canonical construction and definitional equality are correct. Every checked term is in a canonical form that is unique for its class modulo β, associativity, commutativity, units, and literal arithmetic (Theorems C-6 and C-7), so the kernel can compare terms by identity. Definitional equality, adding δ and ζ, is decided by normalization (Theorem C-8), and every identification it makes is valid in every model of the theory (Theorem C-10). Finally, conversion can be eliminated: every judgment the kernel derives, read plainly, has a derivation without ACU conversion and literal kinds, from the laws they cite (Theorem C-12).

A theory \(T\) with canonical signature \(\Sigma\) is fixed. All terms are well typed. The relations below, and canonical forms, depend on \(\Sigma\); where two signatures meet, we write \(=_{E_\Sigma}\) and \(N_\Sigma\) and say canonical for \(\Sigma\).

The equations

Definition C-1 (conversion equations). For every ACU instance \(c = c[\bar\tau] \in \mathrm{ACU}(\Sigma)\) with carrier \(C\) and unit \(e\) (Definition T-6), and all terms \(x, y, z, x_i\) of type \(C\):

\[ \begin{aligned} &(\mathrm A)\quad c(c(x, y), z) = c(x, c(y, z)) \qquad (\mathrm C)\quad c(x, y) = c(y, x) \qquad (\mathrm U)\quad c(e, x) = x\\ &(\mathrm V)\quad c(x_1, x_2, \dots, x_n) = c(x_1, c(x_2, \dots, x_n)) \quad (n \ge 3) \end{aligned} \]

For every literal kind \(k\), every operation \(\mathit{op}\) of \(k\), of arity \(n\), bound to an instance \(f\), and all values \(\bar v\) on which the implementation evaluates (does not decline):

\[ (\mathrm L)\quad f(\underline{v_1}, \dots, \underline{v_n}) = \underline{\mathit{op}(\bar v)}, \]

where \(\underline v\) is the literal of kind \(k\) that represents \(v\): the instance bound to ZERO or ONE for the values \(0\) and \(1\), and the atom \(\mathsf{lit}_k(v)\) otherwise (Definition T-7). For the comparison and equality operations the right side is \(\mathsf{True}\) or \(\mathsf{False}\). The β-equation is \((\lambda{:}\tau.\, b)(a, \bar a) = \mathrm{app}(b\{0:= a\}, \bar a)\).

  • \(=_A\) is the least congruence on well-typed terms (compatible with every term constructor, including under binders) that contains every instance of (A), (C), (U), (V), and (L).
  • \(=_E\) is the least such congruence that also contains β.
  • \(\equiv\), definitional equality, is the least such congruence that also contains ζ (\(\mathsf{let}{:}\tau = v \;\mathsf{in}\; b = b\{0:= v\}\)) and δ (\(c[\bar\tau] = b[\bar\alpha_c:= \bar\tau]\) for every transparent definition \(c:= b\)).
  • For a set \(U\) of transparent definitions, \(\equiv_U\) is the least such congruence that contains \(=_E\), ζ, and δ for the definitions in \(U\) only. \(\equiv_U \subseteq \equiv\), with equality when \(U\) contains every transparent definition.

An A-step is one application of (A), (C), (U), (V), or (L), in either direction, at one position.

Literal kinds

A literal kind is justified by theorems of its theory. Its implementation enters the trusted base through requirements L1 to L5, tested by the differential tests (V13) and listed in the inventory; its meaning is fixed by the literal laws below, which are theorems or axioms of the theory.

Requirement Statement
L1 (canonical encoding) Two literals of a kind are identical exactly when their values are equal: the encoding is injective, every value has one encoding, and the values 0 and 1 are represented only by the instances bound to ZERO and ONE.
L2 (exactness) Where the implementation evaluates an operation, it returns the value the literal laws determine (L5): exactly the mathematical result on \(V_k\) (\(\mathbb Z\), \(\mathbb Q\), or formal polynomials).
L3 (determinism) Whether an operation declines depends only on its input values. The set of (L) equations is therefore well defined.
L4 (total ring operations) Addition and multiplication never decline, and are associative and commutative on \(V_k\) with identities \(0\) and \(1\). A result above the kernel's size ceiling, including an intermediate result of a fold of literal arguments taken in the spine's canonical order, is a capacity error, which builds no term; it is not a decline.
L5 (evaluation only where determined) An implementation evaluates an operation only on inputs where the literal laws (Definition C-5) determine its value, and declines elsewhere: INV only on nonzero values; POW on \((a, n)\) only for an integer exponent \(n\) with \(a \ne 0\), or with \(a = 0\) and \(n > 0\), and, for the integer kind, only \(n \ge 0\). ADD, MUL, and NEG are determined on all values, and so are EQ, LT, and LE. It may decline in more cases, as L3 allows.

The literal scheme is established from the declared laws: by L2 and L5, every (L) equation holds in every model of the literal laws (Theorem C-11). L5 is what makes this so: evaluating \(0^0 = 1\), a common convention, would state a value the laws leave open, and would make the scalar profile inconsistent, where \(0^0\) is indeterminate.

Definition C-5 (literal laws). Let \(k\) have carrier \(C\), domain \(D\) (the constant predicate \(\mathsf{True}\) when none is given; the guards \(D\,x \to\) are then omitted, and so are the laws whose conclusion is a statement \(D\,t\), R1–R5, F1, and E4, which would state only \(\mathsf{True}\)), and bound instances \(0, 1, +, \cdot, -, <, \le\), and, if bound, \({}^{-1}\) and \(\hat{}\) (power) with its exponent predicate \(E: C \to \mathsf{Prop}\), which marks the integer exponents and may be an instance of a definition. Addition and multiplication are ACU instances with units \(0\) and \(1\) (Definition T-6), which provides their associativity, commutativity, and unit laws. The literal laws are the following closed statements, all variables of type \(C\):

Law Statement Required for
R1, R2 \(D\,0\); \(\quad D\,1\) a domain given
R3, R4 \(\forall x\,y.\; D\,x \to D\,y \to D(x + y)\); \(\quad \forall x\,y.\; D\,x \to D\,y \to D(x \cdot y)\) a domain given
R5 \(\forall x.\; D\,x \to D(-x)\) a domain given
R6 \(\forall x.\; D\,x \to x + (-x) = 0\) every kind
R7 \(\forall x\,y\,w.\; D\,x \to D\,y \to D\,w \to x \cdot (y + w) = x \cdot y + x \cdot w\) every kind
O1, O2 \(\forall x.\; D\,x \to \neg(x < x)\); \(\quad \forall x\,y\,w.\; D\,x \to D\,y \to D\,w \to x < y \to y < w \to x < w\) every kind
O3 \(\forall x\,y.\; D\,x \to D\,y \to x < y \lor x = y \lor y < x\) every kind
O4 \(\forall x\,y\,w.\; D\,x \to D\,y \to D\,w \to x < y \to x + w < y + w\) every kind
O5, O6 \(\forall x\,y.\; D\,x \to D\,y \to 0 < x \to 0 < y \to 0 < x \cdot y\); \(\quad 0 < 1\) every kind
O7 \(\forall x\,y.\; D\,x \to D\,y \to (x \le y \leftrightarrow x < y \lor x = y)\) every kind
F1 \(\forall x.\; D\,x \to \neg(x = 0) \to D(x^{-1})\) EXACT_RATIONAL, a domain given
F2 \(\forall x.\; D\,x \to \neg(x = 0) \to x \cdot x^{-1} = 1\) EXACT_RATIONAL
E1–E3 \(E\,0\); \(\quad \forall n.\; E\,n \to E(n + 1)\); \(\quad \forall n.\; E\,n \to E(-n)\) POW bound
E4 \(\forall n.\; E\,n \to D\,n\) POW bound, a domain given
P1 \(\forall x.\; D\,x \to \neg(x = 0) \to x \mathbin{\hat{}} 0 = 1\) POW bound
P2 \(\forall x\,n.\; D\,x \to E\,n \to \neg(x = 0) \to 0 \le n \to x \mathbin{\hat{}} (n + 1) = x \cdot x \mathbin{\hat{}} n\) POW bound
P3 \(\forall n.\; E\,n \to 0 < n \to 0 \mathbin{\hat{}} n = 0\) POW bound
P4 \(\forall x\,n.\; D\,x \to E\,n \to \neg(x = 0) \to 0 < n \to x \mathbin{\hat{}} (-n) = (x \mathbin{\hat{}} n)^{-1}\) POW bound, EXACT_RATIONAL

Laws R1–R7 and O1–O7 say that \(D\), with these operations, is an ordered commutative ring with \(0 < 1\); F1 and F2 make it an ordered field. Without a domain, \(D\) is all of \(C\), which the operations preserve trivially, so the omitted laws R1–R5, F1, and E4 hold in every interpretation and are not cited. The statements are compared literally, after canonical construction, as the ACU laws are (Definition T-6).

Theorem C-11 (literal kinds are definitional). Let \(M\) be an interpretation of the theory, without its literals, in which the literal laws of \(k\) hold. There is exactly one map \(\iota_M: V_k \to \sem{C}\) with \(\iota_M(0) = \sem{0}\) and \(\iota_M(1) = \sem{1}\) that commutes with addition, multiplication, and negation; its image lies in \(\sem{D}\), it is injective, it preserves and reflects \(<\) and \(\le\), it commutes with inverse on nonzero values (rational kind), and \(\iota_M(a^n) = \iota_M(a) \mathbin{\hat{}} \iota_M(n)\) whenever the implementation evaluates \(a^n\). Interpreting \(\mathsf{lit}_k(v)\) as \(\iota_M(v)\), for \(v \ne 0, 1\), makes every literal \(\underline v\) denote \(\iota_M(v)\), and therefore satisfies every (L) equation, and it is the only interpretation that does. Hence every model of the theory expands, in exactly one way, to an interpretation of its literals satisfying the literal scheme: a literal kind is a conservative extension.

Proof. By the laws, \(R = \{x \in \sem{C} \mid \sem{D}(x) = 1\}\) is a subring of \(\sem C\) under the bound operations (R1–R7, with the ACU laws; without a domain, \(R = \sem C\), and closure under the operations, which R1–R5 state, is immediate), totally and strictly ordered by \(<\) (O1–O3), compatibly with addition and multiplication (O4, O5), with \(0 < 1\) (O6). An ordered ring has characteristic 0: by O4 and O6, induction gives \(0 < 1 + \cdots + 1\). The unique ring homomorphism \(\iota: \mathbb Z \to R\) is therefore injective, and it is strictly monotone: for \(m < n\), \(\iota(n) = \iota(m) + \iota(n - m)\) with \(0 < \iota(n - m)\), so \(\iota(m) < \iota(n)\) by O4. Uniqueness is induction on \(|n|\). For the rational kind, F1 and F2 make \(R\) an ordered field (F1 holds trivially without a domain); \(\iota\) extends uniquely to \(\mathbb Q\) by \(\iota(p/q) = \iota(p) \cdot \iota(q)^{-1}\), well defined by cross-multiplication, a field homomorphism, and strictly monotone because \(0 < x\) implies \(0 < x^{-1}\) in an ordered field (from \(x \cdot x^{-1} = 1\), O3, and O5). \(\le\) follows by O7, and equality by injectivity, which gives the \(\mathsf{False}\) results of EQ. For powers, E1–E3 give \(\iota(n) \in E\) for every integer \(n\), by induction; then induction on the exponent: P1 and P2 give \(\iota(a)^{n} = \iota(a^n)\) for \(a \ne 0\), \(n \ge 0\); P3 covers \(a = 0\), \(n > 0\); P4 covers \(n < 0\) for the rational kind. By L5, every case the implementation evaluates is among these, and by L2 it returns the value computed here, so every (L) equation holds.

Uniqueness: let the literals denote any values satisfying the (L) equations, and write \(x_v = \sem{\underline v}\). ADD and MUL never decline (L4), and each equation below has a result no longer than its operands, so none reaches the size ceiling. For \(n \ge 2\), the equation \(\underline{n - 1} + \underline 1 = \underline n\) gives \(x_n = \iota(n)\) by induction from the fixed \(\underline 0\) and \(\underline 1\). For \(n \ge 1\), \(\underline{-n} + \underline n = \underline 0\) gives \(x_{-n} = x_{-n} + (\iota(n) + \iota(-n)) = (x_{-n} + \iota(n)) + \iota(-n) = \iota(-n)\), by the associativity, commutativity, and unit laws of \(+\), which the ACU declaration states for all of \(\sem C\), not only for \(D\). For a reduced \(p/q\) with \(q \ge 2\), \(\underline{p/q} \cdot \underline q = \underline p\) gives, in the same way with the ACU laws of \(\cdot\) and F1 for \(\iota(q) \ne 0\), \(x_{p/q} = x_{p/q} \cdot (\iota(q) \cdot \iota(q)^{-1}) = (x_{p/q} \cdot \iota(q)) \cdot \iota(q)^{-1} = \iota(p) \cdot \iota(q)^{-1} = \iota(p/q)\). \(\square\)

The power laws quantify over \(E\), not over all of \(D\), so a literal kind says nothing about non-integer exponents: for scalar, real and complex powers stay with the branch-cut conventions of the profile.

The laws are first-order statements true in \(\mathbb Z\) (respectively \(\mathbb Q\)), and the literal equations are true closed statements about numerals; each (L) instance is also derivable from the laws by a finite computation that follows \(\iota\) (Lemma C-12a). A conversion-eliminating export, which replaces each conversion step by inference steps (for the OpenTheory and Isabelle audits), produces these derivations (Theorem C-12).

For the scalar profile, \(D\) is "finite and real", and the laws hold in \(\hat S\) because the finite reals are an ordered field (Theorem X-8); the literals denote \(\mathbb Q \subset \mathbb R \subset \hat S\).

β-normalization

Theorem C-1 (cited). On well-typed terms, β-reduction (and ζ-reduction) is strongly normalizing and confluent. Every term \(t\) has a unique β-normal form \(\operatorname{nf}_\beta(t)\).

These are the classical results for the simply typed λ-calculus [Tait 1967; Girard, Lafont and Taylor 1989, ch. 6; Barendregt 1984]. They apply unchanged: type variables occur only in types and behave as base types, since terms never abstract over types; constants and literals are inert for β; and a let is a β-redex in disguise.

A-steps and β

Lemma C-2 (A-steps neither create nor destroy β-redexes). If \(t\) and \(u\) differ by one A-step, then \(t\) is β-normal if and only if \(u\) is. More precisely, the β-redexes of \(u\) are those of \(t\), moved.

Proof. A β-redex is a spine whose head is a λ. An A-step replaces a subterm \(p\) by \(q\), where \(p\) and \(q\) both have type \(C\) (the carrier of an ACU instance) or are a literal-operation spine and its value (of the carrier type or \(\mathsf{Prop}\)). By Definitions T-6 and T-7 these types are not arrow types, so neither \(p\) nor \(q\) is a λ or the head of a spine. The step moves arguments (A, C, V), removes or inserts the unit \(e\) (U), or removes or inserts literal arguments (L). The unit is atomic by Definition T-6, so it contains no redex, and literals contain none. Every other subterm is carried along unchanged. \(\square\)

This is where the restriction of ACU carriers to constructor types (Definition T-6) is used: it makes the algebraic part and the λ-calculus part independent. Without it, removing a unit from a function-typed spine in head position could create a β-redex.

Lemma C-3 (β commutes with A-equality). If \(t =_A t'\) and \(t \to_\beta s\), then \(t' \to_\beta s'\) for some \(s'\) with \(s =_A s'\).

Proof. It suffices to treat one A-step from \(t\) to \(t'\) and then chain. Let the β-redex be \(r = (\lambda{:}\tau.\, b)(a, \bar a)\) in \(t\). By Lemma C-2, \(t'\) contains the corresponding redex \(r'\), possibly moved. Contract it. The A-step is in one of three places relative to \(r\):

  1. Outside \(r\): the contracted terms differ by the same A-step.
  2. Inside \(b\) or \(\bar a\), with \(b =_A b'\): then \(b\{0:= a\} =_A b'\{0:= a\}\), because an A-step inside \(b\) stays an A-step after substitution. Its side conditions (a nested \(c\)-spine, the unit \(e\), literal arguments) are not affected by substituting for a bound variable: \(e\) and literals are closed.
  3. Inside \(a\), with \(a =_A a'\): then \(b\{0:= a\}\) and \(b\{0:= a'\}\) differ by one A-step at each copy of \(a\) (shifted), of which there may be any number, including none. So they are \(=_A\)-equal.

In each case \(s =_A s'\). \(\square\)

Corollary C-4. If \(t =_A t'\), then \(\operatorname{nf}_\beta(t) =_A \operatorname{nf}_\beta(t')\).

Proof. Follow a β-reduction of \(t\) to its normal form and transport each step to \(t'\) by Lemma C-3, obtaining \(t' \to_\beta^* t''\) with \(\operatorname{nf}_\beta(t) =_A t''\). By Lemma C-2, every term on an \(=_A\)-chain from a β-normal term is β-normal, so \(t''\) is β-normal, and by Theorem C-1 it is \(\operatorname{nf}_\beta(t')\). \(\square\)

Canonical forms modulo A

Definition C-2 (atoms and the canonical multiset). Fix an ACU instance \(c\) with unit \(e\) (possibly none) and, possibly, a bound literal kind \(k\) whose addition or multiplication is \(c\); by Definition T-7 there is at most one, and literals are folded only in spines of ADD and MUL. The literals of kind \(k\) are the terms \(\underline v\), including the instances bound to ZERO and ONE (Definition T-7). For a term \(X\):

  • \(\operatorname{atoms}_c(X)\) is the multiset of arguments of \(X\) if \(X\) is a spine of \(c\) with at least two arguments, and \(\{X\}\) otherwise;
  • for a multiset \(M\), \(\kappa_c(M)\) removes every occurrence of \(e\), replaces the literals of kind \(k\) by the single literal of their combined value (by \(k\)'s operation), and drops that literal if it equals \(e\);
  • \(\operatorname{mk}_c(\emptyset) = e\), \(\operatorname{mk}_c(\{X\}) = X\), and \(\operatorname{mk}_c(M) = c(\operatorname{sort}(M))\) when \(\lvert M\rvert \ge 2\), sorting by the kernel's structural order.

Definition C-3 (A-normalization). On β-normal terms, \(\mathcal A\) is defined bottom-up. It is the identity on variables, locals, constants, and literals, and commutes with \(\lambda\) and \(\mathsf{let}\). For a spine it first normalizes the head and arguments to \(F, A_1, \dots, A_n\) and then:

  1. if \(F\) is an ACU instance \(c\) and \(n \ge 2\), returns \(\operatorname{mk}_c\big(\kappa_c(\biguplus_i \operatorname{atoms}_c(A_i))\big)\);
  2. otherwise, if \(F\) is bound to a literal operation, \(n\) is the operation's arity, every \(A_i\) is a literal of its kind, and the operation evaluates, returns the result;
  3. otherwise returns \(F(A_1, \dots, A_n)\).

This is exactly steps 3 to 5 of the kernel's mk_app (C1.1).

Requirement O (structural order). The order used by \(\operatorname{sort}\) is a strict total order on terms. Theorem C-5 needs only that. The kernel's order (T1.6, defined pair by pair) also depends only on content (declaration names, payloads, structure): locals are ordered by their structural hashes, then their binding depths and names; two locals that tie on these lie on different chains and never meet in one term; a commit keeps depths, names and types (Lemma S-6, TD1.12); and the last tie-break of a pair, the head indices, separates only same-named declarations of sibling theories. Lemma S-6 shows that the id translation of a commit preserves the order.

Lemma C-4a (the key identity). Let \(M\) be a multiset in the image of \(\kappa_c\) whose elements are A-canonical and are not spines of \(c\), and let \(R\) be any multiset of such terms. Then

\[ \kappa_c\big(\operatorname{atoms}_c(\operatorname{mk}_c(M)) \uplus R\big) \;=\; \kappa_c(M \uplus R). \]

Proof. If \(\lvert M\rvert \ge 2\), \(\operatorname{atoms}_c(\operatorname{mk}_c(M)) = M\). If \(M = \{X\}\), \(X\) is not a spine of \(c\), so its atoms are \(\{X\}\). If \(M = \emptyset\), the atoms are \(\{e\}\), and \(\kappa_c\) removes \(e\) (if \(e\) is a literal, it is the identity of \(k\)'s operation by Definition T-7 and requirement L4, so including it in the fold changes nothing). Finally \(\kappa_c(\kappa_c(M) \uplus R) = \kappa_c(M \uplus R)\), because combining literals is associative and commutative with identity \(e\) (L4). \(\square\)

Theorem C-5 (A-canonical forms). For β-normal terms \(t\) and \(u\):

  1. \(t =_A \mathcal A(t)\);
  2. \(\mathcal A(\mathcal A(t)) = \mathcal A(t)\);
  3. \(t =_A u\) if and only if \(\mathcal A(t) = \mathcal A(u)\).

Proof. (1) Each operation of Definition C-3 is a composition of A-steps: flattening uses (A) and (V); sorting uses (A) and (C); removing units uses (U) and (C); combining literals uses (L), with (A) and (C) to bring them together; evaluating a literal operation is (L).

(2) The output of \(\mathcal A\) is A-canonical: in every spine of an ACU instance \(c\) there are at least two arguments, none is itself a spine of \(c\) or equal to \(e\), at most one is a literal of \(k\) and it is not \(e\), the arguments are sorted, and no literal operation is left that would evaluate. On such a term, every step of Definition C-3 returns its input.

(3, "if") By (1): \(t =_A \mathcal A(t) = \mathcal A(u) =_A u\).

(3, "only if") It suffices to show that \(\mathcal A\) is unchanged by a single A-step at any position. Since \(\mathcal A\) of a node depends only on \(\mathcal A\) of its children, it suffices to check each equation at the root, with \(X = \mathcal A(x)\) and so on:

  • (A), (V): both sides normalize to \(\operatorname{mk}_c(\kappa_c(\operatorname{atoms}_c(X) \uplus \operatorname{atoms}_c(Y) \uplus \operatorname{atoms}_c(Z)))\) by Lemma C-4a, applied to the inner spine.
  • (C): multiset union is commutative.
  • (U): \(\mathcal A(c(e, x)) = \operatorname{mk}_c(\kappa_c(\operatorname{atoms}_c(X)))\), which equals \(X\) for A-canonical \(X\): if \(X\) is a spine of \(c\), its arguments are already a \(\kappa_c\)-image and sorted; if not, \(\kappa_c\) keeps \(X\) unless \(X = e\), and then \(\operatorname{mk}_c(\emptyset) = e\).
  • (L) for \(c\) itself: \(\mathcal A(c(\underline a, \underline b))\) is the literal \(\underline{a \oplus b}\), or, if that value is the identity, \(\operatorname{mk}_c(\emptyset) = e\), which by Definition T-7 is that same literal.
  • (L) for another operation: step 2 of Definition C-3 evaluates it.

Hence every A-step preserves \(\mathcal A\), and so does \(=_A\). \(\square\)

The proof is the standard flattening argument for AC theories [Baader and Nipkow 1998], extended by units and literal folding; units are treated as in normalized rewriting modulo ACU [Marché 1996]. Its two inputs are Lemma C-4a, which needs the unit to be atomic and literal folding to be associative and commutative, and Requirement O.

That a first-order equational theory at base types combines with typed β in this modular way is a classical result: adding simply typed β to a many-sorted algebraic theory preserves confluence, and equational provability in the combined system reduces to the algebraic one [Breazu-Tannen 1988; Breazu-Tannen and Gallier 1991]. Lemma C-2 is where the restriction of ACU carriers and literal carriers to constructor types makes the ACU and literal equations such a theory.

Canonical forms modulo β and A

Definition C-4. \(N(t):= \mathcal A(\operatorname{nf}_\beta(t))\). A term is canonical when \(N(t) = t\). \(\mathcal A\), and so \(N\), depends on the canonical signature \(\Sigma\), through its ACU instances, their units, and its literal kinds; where it matters we write \(N_\Sigma\), and a term with \(N_\Sigma(t) = t\) is canonical for \(\Sigma\).

Theorem C-6 (canonical forms). For well-typed terms \(t\) and \(u\):

  1. \(t =_E N(t)\), and \(N(t)\) is β-normal and A-canonical;
  2. \(t =_E u\) if and only if \(N(t) = N(u)\);
  3. the canonical terms are exactly the β-normal, A-canonical terms, and each \(=_E\)-class contains exactly one.

Proof. (1) \(t =_\beta \operatorname{nf}_\beta(t) =_A N(t)\); \(\mathcal A\) preserves β-normality (Lemma C-2). (2, "if") by (1). (2, "only if"): \(=_E\) is generated by β-steps and A-steps. For a β-step, \(\operatorname{nf}_\beta\) is unchanged (Theorem C-1). For an A-step, Corollary C-4 gives \(\operatorname{nf}_\beta(t) =_A \operatorname{nf}_\beta(u)\), and Theorem C-5(3) gives equal \(\mathcal A\). (3) follows from (1), (2), and Theorem C-5(2). \(\square\)

Theorem C-7 (the constructors compute canonical forms). Let a constructor build in a theory with canonical signature \(\Sigma\). If all its arguments are canonical for \(\Sigma\), it returns terms canonical for \(\Sigma\): mk_app\((f, \bar a) = N_\Sigma(f(\bar a))\), and likewise for mk_lam, mk_let, mk_const, mk_lit, and the substitution operations of C1.2: instantiate\((b, s) = N_\Sigma(b\{0:= s\})\), abstract yields \(N_\Sigma(\operatorname{abs}^0_\ell\, t)\), and subst_types\((t, \theta) = N_\Sigma(t\theta)\). The constructors terminate.

Proof. The constructors implement hereditary substitution [Watkins et al. 2002; Keller and Altenkirch 2010], extended with \(\mathcal A\)'s step at every rebuilt node. Termination: when instantiate meets the substituted variable in the head of a spine, it calls mk_app on the substituted term, which may β-reduce; each such reduction substitutes at a type that is a proper part of the type of the variable being substituted. Induction on the pair (type size, term size) bounds the recursion. The ACU step neither creates β-redexes (Lemma C-2) nor recurses. Correctness: by the same induction, every call returns a term that is \(=_{E_\Sigma}\) to the term it represents (each step is a β-step or an A-step of \(\Sigma\)) and canonical for \(\Sigma\) (β-normal by construction of hereditary substitution; A-canonical because \(\mathcal A\)'s step is applied at every node whose children changed, and unchanged subterms, skipped by Lemma S-1, are canonical for \(\Sigma\) by assumption). By Theorem C-6(3), it is that term's \(N_\Sigma\). \(\square\)

An argument canonical only for another signature must be lifted first (Corollary C-9a): \(\mathcal A\)'s step at a rebuilt node assumes that the children it leaves alone are already canonical for \(\Sigma\).

Corollary. Every term the kernel uses in a theory is canonical for that theory's canonical signature, and two such terms are \(=_E\)-equal, for that signature, exactly when they are the same node. This justifies comparing canonical terms by identity in the inference rules.

Definitional equality

Theorem C-8 (deciding \(\equiv\)). Define \(\operatorname{unfold}\) by structural recursion on terms:

\[ \operatorname{unfold}(\mathsf{let}{:}\tau = v \;\mathsf{in}\; b) = \operatorname{unfold}(b)\{0:= \operatorname{unfold}(v)\}, \qquad \operatorname{unfold}(c[\bar\tau]) = \hat b_c[\bar\alpha_c:= \bar\tau] \]

for every transparent definition \(c:= b\), where \(\hat b_c:= \operatorname{unfold}(b)\), and homomorphically on every other form: \(\operatorname{unfold}(f(a_1, \dots, a_n)) = \mathrm{app}(\operatorname{unfold}(f), \operatorname{unfold}(a_1), \dots, \operatorname{unfold}(a_n))\), λ is unfolded in its body, and bound variables, locals, other constants, and literals are fixed. Let \(D(t):= N(\operatorname{unfold}(t))\). Then \(\operatorname{unfold}\) is well defined, its results contain no \(\mathsf{let}\) and no transparent definition, and \(t \equiv u\) if and only if \(D(t) = D(u)\).

Proof. Well defined. \(\hat b_c\) is defined by well-founded induction on \(\operatorname{par}(c)\) under strict inclusion: the body \(b\) mentions only declarations of \(\operatorname{par}(c)\) (Definition T-1), and every definition \(d\) it mentions lies in \(\operatorname{par}(c)\), so \(\operatorname{par}(d) \subsetneq \operatorname{par}(c)\) (Definition T-1). Given these bodies, \(\operatorname{unfold}\) is a structural recursion. It does not iterate ζ, whose value may contain lets and is copied by the substitution: the let clause copies only \(\operatorname{unfold}(v)\), which is already free of lets and definitions, and instantiating or type substituting such terms creates none. Two facts follow by induction on \(b\): \(\operatorname{unfold}(b\{j:= s\}) = \operatorname{unfold}(b)\{j:= \operatorname{unfold}(s)\}\), using Theorem S-3 at a let; and \(\operatorname{unfold}(t\theta) = \operatorname{unfold}(t)\theta\), using Lemma S-5.

"If." \(t \equiv \operatorname{unfold}(t)\), by induction along the recursion: each clause is a ζ- or δ-step, under congruence and the closure properties of Lemma C-9(1) and (3); and \(\operatorname{unfold}(t) =_E D(t)\) by Theorem C-6(1).

"Only if." \(D\) is unchanged by each generator instance \(l = r\). ζ: \(\operatorname{unfold}(\mathsf{let}{:}\tau = v \;\mathsf{in}\; b) = \operatorname{unfold}(b\{0:= v\})\) by the first fact. δ: \(\operatorname{unfold}(c[\bar\tau]) = \operatorname{unfold}(b[\bar\alpha_c:= \bar\tau])\) by the second. β: \(\operatorname{unfold}(l)\) β-reduces to \(\operatorname{unfold}(r)\), by the first fact. (A), (C), (U), (V), (L): \(\operatorname{unfold}(l) = \operatorname{unfold}(r)\) is an instance of the same equation, because its head, unit, and literal operation are not transparent definitions (Definitions T-6 and T-7) and are left in place, which is Lemma C-9(2). So \(\operatorname{unfold}(l) =_E \operatorname{unfold}(r)\), and \(N\) agrees by Theorem C-6(2). A generator step inside a larger term becomes zero or more steps of the same kind inside the unfolded term (a step inside a let's value is copied, shifted, wherever the value is substituted; Lemma C-9(1)), so \(D\) is unchanged along every chain of steps. \(\square\)

The kernel's defeq (C1.5) first compares canonical forms, which suffices when they are equal, and otherwise computes \(D\). An implementation may unfold lazily, but it must return the same answers as \(D\). Unfolding can grow terms exponentially, so it runs under a budget; running out is reported as such and never as "different".

Corollary C-8a (restricted unfolding). For a set \(U\) of transparent definitions, let \(\operatorname{unfold}_U\) be defined as \(\operatorname{unfold}\), with the δ clause for the definitions in \(U\) only, and \(D_U:= N \circ \operatorname{unfold}_U\). Then \(t \equiv_U u\) if and only if \(D_U(t) = D_U(u)\). The proof of Theorem C-8 applies unchanged: \(\operatorname{unfold}_U\) replaces only constants that satisfy the condition of Lemma C-9(2), and Lemma C-9 holds for \(\equiv_U\). A conversion step that names \(U\) is therefore decided exactly, and its dependencies are \(U\), whatever order an implementation unfolds in.

The lazy procedure of the kernel (C1.5) computes \(D_U\) by unfolding the definitions of \(U\) a height at a time, in decreasing order of height: each round unfolds every occurrence of every definition of \(U\) of the greatest height present. A definition's body mentions only definitions of smaller height, so after a round no definition of its height reappears, and at most as many rounds remain as \(U\) has heights. Each intermediate pair is \(\equiv_U\) to the original, so stopping early on identical terms is sound, and the procedure answers "different" only on the pair \(D_U(t), D_U(u)\) itself.

Closure properties

Lemma C-9. The following hold for \(=_E\), for \(\equiv\), and for \(\equiv_U\) for every set \(U\) of transparent definitions; they are used for \(\equiv_U\) in Corollary C-8a and Theorem D-6.

  1. They are closed under substitution for bound variables and for locals: if \(t =_E u\), then \(t\{j:= s\} =_E u\{j:= s\}\) and \(t[\ell:= s] =_E u[\ell:= s]\).
  2. Let \(c\) be a constant that is neither an ACU instance, nor bound to a literal operation other than EXPONENT, nor an ACU unit, and \(s\) a closed term of its type. Replacing every instance \(c[\bar\tau]\) by \(s[\bar\alpha_c:= \bar\tau]\) maps every instance of β, ζ, (A), (C), (U), (V), and (L), and every δ-instance for a definition other than \(c\) whose body does not mention \(c\), to an instance of the same equation. Hence \(=_E\) is closed under the replacement, and so are \(\equiv\) and \(\equiv_U\) when no definition to be unfolded is \(c\) or mentions \(c\). By Definitions T-6 and T-7, every transparent definition is such a constant.
  3. They are closed under type substitution: \(t =_E u\) implies \(t\theta =_E u\theta\), when \(\theta\) moves no carrier of a class-level ACU declaration to a function type. Such a \(\theta\) takes an instance of (A), (C), or (U) to an equation at a function type, where the declaration does not apply (Definition Y-15); it holds there by the laws the declaration cites, not by conversion.
  4. They grow with the signature: if \(\Sigma \subseteq \Sigma'\), then \(=_{E_\Sigma} \subseteq\; =_{E_{\Sigma'}}\), and \(N_{\Sigma'}(N_\Sigma(t)) = N_{\Sigma'}(t)\).

Proof. (1) and (2): an instance of a generating equation remains an instance after the substitution or replacement, because the equations are schematic in their variables, and their side conditions mention only the unit, literals, and ACU heads, which are closed and untouched; an (L) instance mentions only literals and the instance of an operation that is evaluated, never the instance bound to EXPONENT, which only the literal laws mention; a δ-instance contains no bound variable or local, and for (2) its body is unchanged; a ζ- or β-instance maps to one by Theorem S-3. (3): β and ζ instances map to β and ζ instances (Lemma S-5); a δ-instance at \(c[\bar\tau]\) maps to the δ-instance at \(c[\bar\tau\theta]\); an instance at an ACU instance \(c[\bar\tau]\) maps to one at \(c[\bar\tau\theta]\), an ACU instance with unit \(e\theta\) (Definition T-6); literal carriers are ground and unaffected. (4): more generators give a larger congruence; the identity for \(N\) then follows from Theorem C-6(2) in \(\Sigma'\). \(\square\)

Corollary C-9a (lifting). Let \(t\) be canonical for a signature \(\Sigma\) and well typed in a theory \(T'\) with canonical signature \(\Sigma'\), as it is when \(T'\) includes its home theory (K1.6). Its lift \(N_{\Sigma'}(t)\) is canonical for \(\Sigma'\), and \(t =_{E_{\Sigma'}} N_{\Sigma'}(t)\), so \(t \equiv N_{\Sigma'}(t)\) in \(T'\). If \(\Sigma \subseteq \Sigma'\), the lift depends only on the \(=_{E_\Sigma}\)-class of \(t\): \(N_{\Sigma'}(u) = N_{\Sigma'}(t)\) for every \(u =_{E_\Sigma} t\).

Proof. Theorem C-6(1) in \(\Sigma'\). For the second statement, \(N_{\Sigma'}(u) = N_{\Sigma'}(N_\Sigma(u)) = N_{\Sigma'}(t)\) by Lemma C-9(4) and Theorem C-6(2) in \(\Sigma\). \(\square\)

Lifting is how the kernel uses stored contents in a theory whose canonical signature differs from the one they were built for (K1.3): declaration statements in (Use), definition bodies in δ-unfolding, the hypotheses of frames under a later rebase, and Proven statements. Contexts are never rebuilt; hypotheses and stored contents are lifted when used, and every term a rule receives is canonical for the signature of the theory where the rule applies.

Soundness of conversion

Theorem C-10. If \(t \equiv u\), then \(\sem{t} = \sem{u}\) in every model of \(T\) (Definition M-3), under every valuation.

Proof. The generators are valid: β and ζ by Lemma M-L1; (A), (C), and (U) because the cited ACU laws hold in every model of \(T\), an axiom by Definition M-3, clause 3, and a theorem by Theorem M-1 for its parent, a theory strictly included in \(T\), with Lemma M-L2 for the instance at \(c[\bar\rho\theta]\) (Theorems M-1 and C-10 are proved together, by induction on theories under strict inclusion: see Theorem M-1); (V) by the denotation of variadic spines (Definition M-2); (L) by Definition M-3, clause 4, which holds by Theorem C-11, whose hypothesis, the literal laws, holds for the same reason as the ACU laws; δ because definitions denote their bodies. Validity is preserved by congruence, because denotations are compositional; under a binder, equal values for every value of the bound variable give equal functions. \(\square\)

Conversion therefore proves nothing that the theory's declared laws do not make true. It shortens proofs; it does not strengthen the logic.

Eliminating conversion

Theorems C-10 and C-11 show that conversion is sound in every model. The stronger, proof-theoretic statement is that conversion can be eliminated: whatever the kernel derives, read plainly, has a derivation that uses no ACU conversion and no literal kind, only ordinary inference steps from the cited laws, so that ACU declarations and literal kinds add no theorems at all, even though the standard semantics of HOL is incomplete. Every rule takes part, not only (Conv), because every rule canonicalizes the terms it builds. The same construction exports kernel proofs to systems without AC conversion, such as Lean.

Definition C-6 (plain reading). The plain reading \(\langle t\rangle\) of a well-typed term reads every ACU spine as right-nested binary application (Definition S-6) and replaces every literal atom by its numeral: \(\nu(2m) = \nu(m) + \nu(m)\) and \(\nu(2m+1) = (\nu(m) + \nu(m)) + 1\) for \(m \ge 1\), with \(\nu(0) = 0\), \(\nu(1) = 1\), \(\nu(-n) = -\nu(n)\), and \(\nu(p/q) = \nu(p) \cdot \nu(q)^{-1}\) for \(q > 1\), where \(0\), \(1\), \(+\), \(\cdot\), \(-\), and \({}^{-1}\) are the instances the kind binds; with sharing, a numeral has \(O(\log \lvert v\rvert)\) nodes. The plain reading of a context reads each of its hypotheses. The plain reading preserves types (Theorem T-2; a numeral has the carrier's type), maps β-normal terms to β-normal terms, and commutes with instantiation, abstraction, substitution for locals, and type substitution, because numerals are closed and the ACU instances are closed under type substitution. A plain derivation is a derivation by the rules of the deduction page, in a theory without ACU declarations and literal kinds, whose (Conv) steps use only β and ζ.

Definition C-7 (the plain theory). For a declaration \(d\) that is neither an ACU declaration nor a literal kind, \(d^-\) is the declaration with the same name and form and with parent \(\operatorname{par}(d)^-\), whose content is the plain reading of \(d\)'s content as it was checked in \(\operatorname{par}(d)\): a type constructor or a constant is unchanged; a definition \(c:= b\) becomes \(c:= \langle b\rangle\), transparent when \(d\) is; an axiom \(A\) becomes the axiom \(\langle A\rangle\); and a theorem \(A\) becomes the theorem \(\langle A\rangle\). For a theory \(T\),

\[ T^-:= \{\, d^- \mid d \in T,\ d \text{ neither an ACU declaration nor a literal kind} \,\}. \]

The definition is by induction on theories under strict inclusion (Definition T-1), together with Theorem C-12, which supplies, for a theorem \(d\), the derivation of \(\langle A\rangle\) in \(\operatorname{par}(d)^-\).

\(T^-\) is a theory without ACU declarations and literal kinds. It contains \(\operatorname{par}(d)^-\) for each \(d^-\); its names are names of \(T\), each declared once; its other global conditions are vacuous; and each \(d^-\) is well formed in its parent, because the plain reading of a closed, well-typed term is closed and well typed, has the same type variables, and mentions the same declarations, except that a literal atom becomes a numeral over the instances its kind binds to \(0\), \(1\), \(+\), \(-\), \(\cdot\), and \({}^{-1}\), which are plain constants declared before the kind. The ACU laws and literal laws that \(T\) cites are theorems or axioms of \(T^-\), with the plain readings of the statements they had when they were checked. The canonical signature of \(T^-\) is empty, so its canonical terms are the β-normal terms, and the plain reading of a term canonical for \(\Sigma(T)\) is one. The logic core is its own plain theory, so propositional extensionality is in every \(T^-\).

Lemma C-12a (numerals). Let \(k\) be a literal kind of \(T\). For every (L) equation of \(k\) whose result is a value (ADD, MUL, NEG, INV, POW), the equation between the plain readings of its sides has a plain derivation in \(T^-\). For the comparisons (EQ, LT, LE), the plain reading of the comparison has one when the result is \(\mathsf{True}\), and its negation has one when the result is \(\mathsf{False}\); with propositional extensionality, so does the equation between the plain reading and \(\mathsf{True}\) or \(\mathsf{False}\).

Proof. The literal laws of \(k\), and the ACU laws of its \(+\) and \(\cdot\), are theorems or axioms of \(T^-\) (Definition C-7). Their statements there are the plain readings of their canonical forms in \(\operatorname{par}(k)\), which differ from the forms displayed in Definition C-5 only by the associativity, commutativity, and units of \(+\) and \(\cdot\); the ACU laws move between the two, as in the proof of Theorem C-12, so we use the laws as displayed. Write \(\nu\) for numerals, and say that \(x\) is in \(D\) when \(D\,x\) has a plain derivation, which discharges the guards \(D\,x \to\) of the laws. Without a domain every \(x\) is in \(D\), the guards are absent, and the uses of R1–R5, F1, and E4 below are vacuous (Definition C-5). The steps come in this order because step 4 needs step 3.

  1. Integer numerals are in \(D\): R1, R2, R3, and R5, by induction on the binary structure.
  2. Integer arithmetic. For integers \(a\) and \(b\): \(\nu(a) + \nu(b) = \nu(a + b)\), \(-\nu(a) = \nu(-a)\), and \(\nu(a) \cdot \nu(b) = \nu(ab)\). Addition is by induction on the binary structure of the arguments, using the ACU laws of \(+\) (a carry is a regrouping, as in \((\nu(m) + 1) + (\nu(m) + 1) = \nu(2m + 2)\)); negative values use R6 and the uniqueness of additive inverses that it gives with the ACU laws (\(y = y + (x + (-x)) = (y + x) + (-x) = -x\) when \(y + x = 0\)). Multiplication is the same, using R7 to distribute \(\nu(a) \cdot (\nu(m) + \nu(m))\), with \(x \cdot 0 = 0\) and \(x \cdot (-y) = -(x \cdot y)\), both derived from R6 and R7 for elements of \(D\).
  3. Integer order. First, \(0 < \nu(n)\) for \(n \ge 1\), by induction on the binary structure: \(0 < 1\) is O6, and from \(0 < x\), O4 gives \(x < x + x\) and \(x < x + 1\) (adding \(x\) to \(0 < x\) and to \(0 < 1\)), so O2 gives \(0 < x + x\) and \(0 < x + 1\). For \(a < b\), \(\nu(b) = \nu(a) + \nu(b - a)\) by step 2, and O4, adding \(\nu(a)\) to \(0 < \nu(b - a)\), gives \(\nu(a) < \nu(b)\): the \(\mathsf{True}\) results of LT. Its \(\mathsf{False}\) results: for \(a = b\), \(\neg(\nu(a) < \nu(a))\) is O1; for \(a > b\), \(\nu(b) < \nu(a)\), so \(\nu(a) < \nu(b)\) would give \(\nu(a) < \nu(a)\) by O2, against O1. EQ: for \(a = b\) the numerals are one term, and (Refl) applies; for \(a \ne b\), say \(a < b\), \(\nu(a) = \nu(b)\) would turn \(\nu(a) < \nu(b)\) into \(\nu(a) < \nu(a)\) by (Subst), against O1, so distinct integers have provably distinct numerals. LE: O7 reduces it to the results of LT and EQ; for \(a > b\) both disjuncts are refuted.
  4. Rationals. For \(q \ge 2\), step 3 gives \(\neg(\nu(q) = 0)\), which discharges the guard of F1: \(\nu(q)^{-1}\) is in \(D\), and so, by R4 and R5, is every rational numeral. From F1, F2, and R1–R7 follow, for nonzero elements of \(D\), the uniqueness of inverses, \((x \cdot y)^{-1} = x^{-1} \cdot y^{-1}\), and the absence of zero divisors. With them, addition, multiplication, and negation of rationals reduce to step 2 by multiplying out the denominators, and a common factor \(g\) cancels because \(\nu(g) \cdot \nu(g)^{-1} = 1\). INV, which L5 allows only on nonzero values, gives \(\nu(p/q)^{-1} = \nu(q/p)\), with the sign moved to the numerator and the guard \(\neg(\nu(p) = 0)\) from step 3. For the order, \(0 < x\) implies \(0 < x^{-1}\): by O3, \(x^{-1} = 0\) would give \(1 = x \cdot x^{-1} = x \cdot 0 = 0\), against O6 and O1, and \(x^{-1} < 0\) would give \(0 < -x^{-1}\) by O4, then \(0 < x \cdot (-x^{-1}) = -1\) by O5, then \(1 < 0\) by O4, against O6 by O2 and O1. So for rationals \(a < b\), \(\nu(b) + (-\nu(a)) = \nu(m) \cdot \nu(n)^{-1}\) with \(m, n \ge 1\) is positive by O5, and \(\nu(a) < \nu(b)\) by O4; the \(\mathsf{False}\) results, EQ, and LE follow as in step 3.
  5. Powers. \(E\,\nu(n)\) holds for every integer \(n\): E1 for \(0\), E2 with \(\nu(n) + 1 = \nu(n + 1)\) (step 2) and (Subst) for the successors, and E3 for the negatives. By L5, the implementation evaluates \(a^n\) only when \(a \ne 0\), or \(a = 0\) and \(n > 0\), and, for the integer kind, \(n \ge 0\). For \(a \ne 0\), with the guard \(\neg(\nu(a) = 0)\) from step 3 or 4 and \(0 \le \nu(n)\) from step 3 and O7, P1 and P2, unfolded \(n\) times, give \(\nu(a) \mathbin{\hat{}} \nu(n) = \nu(a^n)\) for \(n \ge 0\), with the products of step 2 or 4; P3 gives \(0 \mathbin{\hat{}} \nu(n) = 0\) for \(n > 0\); and P4, for the rational kind, gives \(\nu(a) \mathbin{\hat{}} \nu(-n) = (\nu(a) \mathbin{\hat{}} \nu(n))^{-1} = \nu(a^{-n})\) for \(n > 0\), by step 4.

Each step uses only (Use) of the laws and the rules of the deduction page, with (Conv) only for β, so the derivations are plain. The equations with \(\mathsf{True}\) and \(\mathsf{False}\) follow by propositional extensionality, as stated on the deduction page. \(\square\)

Theorem C-12 (conversion elimination). For every theory \(T\): if \(\Gamma \vdash A\) is derivable in \(T\) by the kernel's rules, then \(\langle\Gamma\rangle \vdash \langle A\rangle\) has a plain derivation in \(T^-\) (Definition C-7).

Proof. By induction on theories under strict inclusion, together with Definition C-7, and, for a fixed \(T\), by induction on the derivation.

Equations. Let \(t\) and \(u\) be terms of a context \(\Delta\) of \(T\) with \(t \equiv_U u\) for the canonical signature of \(T\) and a set \(U\) of transparent definitions; in particular, \(t =_E u\). Then \(\langle\Delta\rangle \vdash \langle t\rangle = \langle u\rangle\) has a plain derivation in \(T^-\). It suffices to treat one generator instance \(l = r\) at one position, and to chain the steps by (Sym) and (Trans). At the root:

  • β and ζ: the plain reading commutes with instantiation, so \(\langle l\rangle\) and \(\langle r\rangle\) are related by β or ζ; use (Refl) and (Conv).
  • (A), (C), and (U), at an ACU instance \(c[\bar\tau]\): one-way matching finds the declaration at \(\bar\rho\) with \(\bar\rho\theta = \bar\tau\) (Definition T-6). Use its cited law by (Use) at \(\theta\), then \((\forall\mathrm E)\) with the plain readings of \(x\), \(y\), and \(z\). The law is used as it was stated when it was checked, in the parent of the ACU declaration, where \(c[\bar\rho]\) is not yet ACU: there its statement is the binary equation itself, its own plain reading, and it is a theorem or axiom of \(T^-\) (Definition C-7). In \(T\), the same statement, lifted, would collapse to an identity.
  • (V): both sides have the same plain reading; use (Refl).
  • (L): Lemma C-12a, weakened to \(\langle\Delta\rangle\) (Theorem D-3).
  • δ, for \(c:= b\) in \(U\): (Use) of the equation of \(c^-\), \(c[\bar\alpha_c] = \langle b\rangle\), at \(\bar\tau\); since \(\langle b[\bar\alpha_c:= \bar\tau]\rangle = \langle b\rangle[\bar\alpha_c:= \bar\tau]\), this is the equation between the plain readings.

A step inside a spine is carried to the whole spine by (Cong), following the right nesting of the plain reading at an ACU spine of three or more arguments; a step under a λ by \((\xi)\), with a fresh local for the bound variable, after which the step is still an instance of its equation (Lemma C-9(1)); and a step inside a let by first ζ-reducing both sides with (Conv).

Moving judgments. From \(\langle\Delta\rangle \vdash \langle t\rangle = \langle u\rangle\) and \(\langle\Delta\rangle \vdash \langle t\rangle\), for propositions, (Subst) with \(P:= \lambda x{:}\mathsf{Prop}.\, x\) gives \(\langle\Delta\rangle \vdash \langle u\rangle\).

Rules. The kernel applies each rule of the deduction page up to \(=_E\): it identifies each premise's proposition with the canonical form of the term the rule expects (lifting a premise or a hypothesis from a smaller signature is such an identification), and it returns the canonical form of the term it builds. Each rule instance is therefore the plain rule, preceded and followed by implicit \(=_E\) steps. Translate it accordingly: move the plain readings of the premises across the \(=_E\) steps that identify them with the terms the rule expects; apply the same rule to the plain readings; and move the result across the \(=_E\) step from the term the rule builds to the canonical form it returns. The same rule applies to the plain readings because the plain reading commutes with instantiation, abstraction, and type substitution, with one change: (Cong) at an ACU spine of three or more arguments becomes nested instances of (Cong), following the right nesting. In particular:

  • (Hyp) becomes (Hyp) in \(\langle\Gamma\rangle\), followed by the \(=_E\) step of lifting.
  • (Use) of a declaration \(d\) becomes (Use) of \(d^-\), whose statement is the plain reading of \(d\)'s statement as checked; the kernel's statement, instantiated and lifted to the canonical signature of \(T\), is \(=_E\)-equal to it. ACU declarations and literal kinds are never used by (Use).
  • (Conv) with \(A \equiv_U B\) becomes the equation \(\langle A\rangle = \langle B\rangle\) above, then (Subst).
  • A certificate step: the admitted checker's obligation (the deduction page) makes the plain reading of its claim derivable in \(T^-\) by a plain derivation.

Every (Conv) step introduced uses only β or ζ, and \(T^-\) has no ACU declaration or literal kind, so the result is a plain derivation. Propositional extensionality, which Lemma C-12a uses for comparisons inside larger terms, is a declaration of the logic core, hence of \(T^-\). \(\square\)

Corollary C-12b (proof-theoretic conservativity). ACU declarations and literal kinds add no theorems beyond their cited laws. If \(d\) is an ACU declaration or a literal kind, then \((T + d)^- = T^-\), so every judgment derivable in \(T + d\) has its plain reading derivable in \(T^-\) by a plain derivation. In particular, let \(H\) be a theory without ACU declarations and literal kinds, and \(T \sqsupseteq H\) a theory whose declarations outside \(H\) are all ACU declarations and literal kinds. Then \(T^- = H\), up to the derivations attached to theorems, and every judgment of the language of \(H\) that is derivable in \(T\) is derivable in \(H\).

Proof. \(T^-\) omits exactly the ACU declarations and literal kinds of \(T\) (Definition C-7). Every content of \(H\) is canonical for the empty canonical signature and contains no literal atom, so it is its own plain reading, and \(H^- = H\). Let \(\Gamma \vdash A\) be of the language of \(H\); the kernel derives it in \(T\) as \(\Gamma \vdash A'\) with \(A' = N_{\Sigma(T)}(A)\). By Theorem C-12, \(\Gamma \vdash \langle A'\rangle\) has a plain derivation in \(H\); by the equations in its proof, so does \(\Gamma \vdash \langle A\rangle = \langle A'\rangle\), since \(A =_E A'\); and (Subst) gives \(\Gamma \vdash \langle A\rangle\), where \(\langle A\rangle = A\). \(\square\)

The proof needs propositional extensionality for literal comparisons inside larger terms, which is why the logic core has it: a theory without it could prove more with such comparisons than its plain derivations do. With it in the core, Theorem C-12 and Corollary C-12b hold in every theory, without a hypothesis.

Why distributivity and annihilation are excluded

Conversion adds an equation to every model's obligations. Distributivity \(a \cdot (b + d) = a \cdot b + a \cdot d\) and annihilation \(0 \cdot x = 0\) are false in the scalar carrier for infinite values (Theorem X-4), so including them would make the scalar profile inconsistent. They are guarded theorems instead (Theorem X-5).

judgment v1.0.0 for Mojo 1.2 · Apache License 2.0 with LLVM Exceptions · Source on GitHub