Proof library & interchange theory

Eliminating conversion

The kernel's definitional equality identifies terms modulo associativity, commutativity, units, and literal arithmetic. Checkers outside the kernel (OpenTheory's HOL kernels, Lean) have no such conversion. The conversion-eliminating export produces derivations they can check.

Definition EL-1 (the theory without signature). For a theory \(T\), let \(T^-\) be \(T\) without its ACU declarations and literal kinds, with each literal replaced by its numeral (the kernel's Lemma C-12a, and Lemma C-12aP for polynomial literals) and each ACU spine read as its right-nested binary application (the kernel's Definition S-6). The cited ACU and literal laws remain, as the theorems or axioms they are in \(T\).

Theorem EL-1 (cited: conversion elimination). For every derivation of \(\Gamma \vdash A\) in \(T\) there is a derivation of \(\Gamma^- \vdash A^-\) in \(T^-\), where \(X^-\) is the reading of Definition EL-1, that uses no ACU or literal identification: every such identification is replaced by inference steps citing the ACU laws and literal laws. This is the kernel's Theorem C-12, with Lemmas C-12a and C-12aP for the literal steps; comparisons of literals inside larger terms use propext.

Algorithm EL-2 (the export).

  1. Take the result's derivation as a proof DAG: its proof rows.
  2. For each node, compute the \(T^-\) reading of its proposition.
  3. Where two readings that the kernel identified differ (a premise's proposition and a rule's expectation, or a convert step's two sides), insert an equality proof between them:
  4. for ACU rearrangements, a sequence of associativity and commutativity steps that sorts the right-nested spine (one step per transposition of an insertion sort, or \(O(n \log n)\) with a merge sort expressed by associativity), with unit laws for inserted or removed units;
  5. for literal evaluations, the numeral derivation of Lemma C-12a (or C-12aP);
  6. for β, ζ, and δ, the systems that receive the export have their own rules (HOL's BETA_CONV and definitions), so these are kept.
  7. Rewrite each premise into the form its rule expects with the inserted equalities (by the library's DR-4), and emit the derivation.
  8. Re-check the emitted derivation in a second kernel holding \(T^-\), as the kernel's test-only eliminator does.

Theorem EL-3. If step 5 succeeds, the emitted derivation is a derivation of \(\Gamma^- \vdash A^-\) in \(T^-\) without ACU or literal conversion.

Proof. Step 5 checks it with a kernel in which no ACU declaration or literal kind exists, so no such identification is available. \(\square\)

Proposition EL-4 (size). Each ACU rearrangement of a spine of \(n\) arguments costs \(O(n \log n)\) inference steps with merge sorting; each literal evaluation costs steps polynomial in the size of the literals (Lemma C-12a's derivations follow the arithmetic). The export's size is measured against the size of the expanded proof under RECORD. \(\square\)

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