Guards and supports¶
A guard is the condition under which a theorem applies. Guards are propositions, but engines manipulate them as formulas: they combine, simplify, and compare them, and record which sets of obligations suffice. These operations must never claim more than they prove.
Guard formulas¶
Definition G-1 (guard). Guard formulas are \(g ::= \top \mid \bot \mid \mathrm{Atom}(A) \mid \mathrm{All}(g_1, \dots, g_k) \mid \mathrm{Any}(g_1, \dots, g_k)\), with \(A\) a proposition. Their meaning is the proposition \(\sem{\top} = \mathsf{True}\), \(\sem{\bot} = \mathsf{False}\), \(\sem{\mathrm{Atom}(A)} = A\), \(\sem{\mathrm{All}(g_1, \dots, g_k)} = \sem{g_1} \land (\sem{g_2} \land (\cdots))\) (right-nested; \(\mathsf{True}\) for \(k = 0\); \(\sem{g_1}\) for \(k = 1\)), and likewise \(\mathrm{Any}\) with \(\lor\) and \(\mathsf{False}\).
Definition G-2 (normalization). \(\operatorname{norm}\) rewrites a guard bottom-up by:
- flattening: \(\mathrm{All}(\dots, \mathrm{All}(\bar h), \dots) \to \mathrm{All}(\dots, \bar h, \dots)\), likewise \(\mathrm{Any}\);
- identities: dropping \(\top\) from \(\mathrm{All}\) and \(\bot\) from \(\mathrm{Any}\);
- annihilators: \(\mathrm{All}\) containing \(\bot\) becomes \(\bot\), \(\mathrm{Any}\) containing \(\top\) becomes \(\top\);
- duplicates: keeping one copy of equal children;
- order: sorting children by the kernel's structural order of their propositions;
- collapse: \(\mathrm{All}()\) is \(\top\), \(\mathrm{Any}()\) is \(\bot\), and a one-child node is its child.
It does not distribute \(\land\) over \(\lor\), and it does not simplify \(A \lor \neg A\) to \(\top\) (no classical principle is used).
Theorem G-1 (normalization is an equivalence, constructively). For every guard \(g\), both \(\sem g \to \sem{\operatorname{norm}(g)}\) and \(\sem{\operatorname{norm}(g)} \to \sem g\) are derivable from the kernel's rules without any axiom.
Proof. Each rule of Definition G-2 replaces a subformula by one that is intuitionistically equivalent: associativity and commutativity of \(\land\) and \(\lor\), their units and absorbing elements, and idempotence are all derivable by introduction and elimination rules alone. A derivation for the whole guard composes these, through the congruence of \(\land\) and \(\lor\) (each direction of an equivalence of subformulas lifts to the enclosing formula by the introduction and elimination rules of the connective). \(\square\)
Proposition G-2 (normal forms are canonical). \(\operatorname{norm}\) is idempotent, and two guards that are equal modulo associativity, commutativity, idempotence, units, and absorbing elements of \(\land\) and \(\lor\) have the same normal form.
Proof. The same flattening argument as the kernel's Theorem C-5, with duplicates removed (idempotence) and the absorbing elements handled by step 3: after flattening, a node is determined by the set of its children's normal forms. \(\square\)
Supports¶
A theorem's guard may be satisfied in several ways. A support records one sufficient set of obligations and the theorem that proves the conclusion from them.
Definition G-3 (support entry and bucket). For a fixed conclusion \(C\) (with a fixed parameter interface), a support entry is a pair \((S, w)\) of a finite set \(S\) of propositions and a checked theorem \(w : \bigwedge S \to C\). A bucket is a finite set of entries.
Algorithm G-4 (insertion). To insert \((S, w)\) into a bucket:
- reject it unless \(w\)'s statement is \(\bigwedge S \to C\) (read from the kernel, with \(S\) in the normalized order);
- if some entry \((T, w')\) has \(T \subseteq S\), keep the bucket's applicability unchanged (the new entry may still be kept as an alternative proof, for cost or trust);
- otherwise remove every entry \((U, w'')\) with \(S \subsetneq U\) from the applicability set, and add \((S, w)\);
- if the bucket exceeds its bound, drop entries in a deterministic order (largest \(S\) first, then by the structural order).
Theorem G-5 (the invariants of a bucket). After any sequence of insertions:
- every retained entry's witness proves \(\bigwedge S \to C\);
- no retained obligation set contains another (an antichain);
- without the bound of step 4, every inserted set contains a retained set;
- the disjunction \(\bigvee_{(S, w)} \bigwedge S\) of the retained entries implies \(C\), with a proof built from the witnesses.
Proof. (1) by step 1. (2) by steps 2 and 3, by induction on insertions. (3) an inserted set is either retained, or contains a retained one (step 2), or was removed in favor of a strict subset (step 3) that is retained or itself contains a retained one, by induction. (4) by disjunction elimination over the entries, each case closed by its witness. \(\square\)
The retained family is a sufficient under-approximation of the ways to apply the theorem: dropping an entry (step 4) loses an opportunity, never soundness, and no obligation is ever removed from an entry without proof.
Activation¶
Definition G-6 (activation). For a guard instance in a context, an
activation record holds, for each child, either a checked proof of it or
nothing. A conjunction activates when every child has a proof; a
disjunction when some child has a proof, or when a proof of the whole
disjunction arrives. Activation produces a checked proof of the guard: by
and_intro from the children, by or_left or or_right from one child,
or the whole-disjunction proof itself.
Activation never sets a flag without a proof, so a guard is reported active only with a kernel judgment of its proposition. This is the architecture note's section 21.5, and the acceptance test A13: a proof of \(P \lor Q\) activates a guard \(\mathrm{Any}(P, Q)\) although neither disjunct is known.