Proof authoring theory

Derived rules

Each derived rule below is a fixed pattern of kernel rule applications. The derivations use only the kernel's rules (K1.8) and the axioms named; the dependency summary of a derived step is therefore the union of its premises' and of those axioms (the kernel computes it). Notation is the kernel's: \(\Gamma \vdash A\) is a judgment; contexts grow to the right.

DR-1 (moving into a larger context). From \(p : \Gamma \vdash A\) and a context \(\Delta\) that extends \(\Gamma\): \(\Delta \vdash A\).

Derivation. and_left(and_intro(p, truth(Δ))): the kernel places the conjunction in the deepest context of its premises, which is \(\Delta\). This is the kernel's weakening idiom. \(\square\)

DR-2 (calculation chains). From \(a_0 = a_1, a_1 = a_2, \dots, a_{k-1} = a_k\): \(a_0 = a_k\). Derivation: eq_trans folded left to right. \(\square\)

DR-3 (congruence in a context). Let \(C[\cdot]\) be a term with one marked position at which \(a\) occurs, not under a binder that captures a variable of \(a\). From \(p : \Gamma \vdash a = b\): \(\Gamma \vdash C[a] = C[b]\).

Derivation. Fix a local \(z\) of the type of \(a\) over a frame where \(C[a]\), \(a\) and \(b\) are usable; by Lemma LC-27 it occurs in none of them. The session's replace_positions_at constructs \(C[z]\) from the original syntax path, before canonical rebuilding can reorder an ACU spine. Form the proposition-valued motive \(M = \lambda z.\, C[a] = C[z]\) using the session's constructors. Check that \(M(a)\) is the canonical reflexive equality on \(C[a]\). Then eq_subst(M, p, eq_refl(C[a])) proves \(C[a] = C[b]\). The replacement is bound-closed in its occurrence context; abstracting \(z\) with lambda_ is capture-free (Lemma S-4, Theorem C-7, Lemma LC-27). The library neither interprets bound indices nor reconstructs binder bodies. \(\square\)

DR-4 (rewriting a proposition). From \(p : \Gamma \vdash a = b\) and \(q : \Gamma \vdash P\), where \(P\) contains \(a\) at chosen positions: \(\Gamma \vdash P'\), with \(P'\) the result of replacing those occurrences by \(b\).

Derivation. Abstract the chosen occurrences of \(a\) in \(P\) by a local fixed over a frame where \(P\), \(a\) and \(b\) are usable, which by Lemma LC-27 occurs in none of them, and form the motive \(M = \lambda x.\, P[x]\) with the session's lambda_. Then \(M(a)\) is canonically \(P\) and \(M(b)\) is canonically \(P'\) (the kernel's Lemma S-4 and Theorem C-7), and eq_subst(M, p, q) gives \(\Gamma \vdash P'\). \(\square\)

DR-5 (applying a guarded theorem). From a closed theorem \(d : \forall \bar x.\, G(\bar x) \to C(\bar x)\), type arguments \(\bar\tau\), terms \(\bar t\), and \(e : \Gamma \vdash G(\bar t)\): \(\Gamma \vdash C(\bar t)\).

Derivation. use(Γ, d, τ̄, t̄) gives \(\Gamma \vdash G(\bar t) \to C(\bar t)\) (the kernel instantiates the leading quantifiers); imp_elim with \(e\). When \(G\) is a conjunction, \(e\) is built by and_intro from its components. \(\square\)

DR-6 (existential introduction and elimination). The kernel's Theorem D-1 derives \((\exists\mathrm I)\) and \((\exists\mathrm E)\) from the definition of \(\exists\); the library packages those derivations, with the unfolding of \(\exists\) by convert naming its definition. \(\square\)

DR-7 (biconditional). \(A \leftrightarrow B\) from \(A \to B\) and \(B \to A\) by and_intro after unfolding \(\leftrightarrow\); and the two directions back by and_left, and_right. \(\square\)

DR-8 (negation and contradiction). \(\neg A\) from \(\Gamma, h : A \vdash \mathsf{False}\) by imp_intro after unfolding \(\neg\); \(\mathsf{False}\) from \(\neg A\) and \(A\) by imp_elim; any \(Q\) from \(\mathsf{False}\) by false_elim. \(\square\)

DR-9 (case analysis). From \(d : \Gamma \vdash A \lor B\), \(\Gamma, h : A \vdash C\), and \(\Gamma, h' : B \vdash C\): \(\Gamma \vdash C\), by imp_intro on each branch and or_elim. \(\square\)

DR-10 (classical cases and contradiction). In a theory with the excluded-middle axiom \(\mathrm{em} : \forall P.\, P \lor \neg P\): case analysis on any \(A\) is DR-9 applied to use(Γ, em, [], [A]); proof by contradiction, \(A\) from \(\Gamma, h : \neg A \vdash \mathsf{False}\), is case analysis on \(A\) with the second branch closed by false_elim. The result depends on em, which its evidence label shows. \(\square\)

DR-11 (equivalent propositions are equal). From \(\Gamma \vdash A \leftrightarrow B\): \(\Gamma \vdash A = B\), by the logic core's axiom propext and imp_elim twice. With DR-4, any proved equivalence rewrites inside propositions. \(\square\)

DR-12 (function extensionality). In a theory with the axiom \(\mathrm{funext} : \forall f\, g.\, (\forall x.\, f(x) = g(x)) \to f = g\): \(f = g\) from \(\Gamma, x \vdash f(x) = g(x)\) by forall_intro and DR-5. Without the axiom, eq_abstract (the ξ-rule) gives \((\lambda x.\, s) = (\lambda x.\, t)\) from \(\Gamma, x \vdash s = t\), which suffices when both sides are λ-terms. \(\square\)

DR-13 (guarded results). From \(j : \Gamma, h_1 : G_1, \dots, h_k : G_k \vdash C\), export to \(\Gamma\) gives \(\Gamma \vdash G_1 \to \cdots \to G_k \to C\) (the kernel's export, its Theorem D-4); the library folds the implications into one guard \(G_1 \land \cdots \land G_k \to C\) when a single guard is wanted, by DR-7-style conjunction elimination under imp_intro. \(\square\)

DR-14 (conjunction and disjunction bookkeeping). Associativity, commutativity, and idempotence of \(\land\) and \(\lor\), and their units \(\mathsf{True}\) and \(\mathsf{False}\), are provable equivalences by constructive natural deduction; with DR-11 they rewrite inside propositions. These are the building blocks of guard normalization (guards). \(\square\)

Requirement

Requirement DR-R1. Each derived rule's expansion is deterministic (Definition R-2) and has a test that runs it against the kernel, and negative tests that give it premises of the wrong shape and expect the kernel's error.

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