Law bundles¶
Engines do not import theories (the system's package rule 1): an engine works with any theory that supplies the constants and laws it needs, and the application passes them in a law bundle.
Definition B-1 (bundle schema). A bundle schema is a list of named constant slots, each with a type pattern, and a list of named law slots, each with a statement pattern over the constant slots. A bundle fills the constant slots with declarations (at type arguments) and the law slots with declarations (theorems or axioms) of a theory.
Definition B-2 (validity). A bundle is valid in a theory \(T\) when every filled declaration is visible in \(T\), every constant has the type its slot requires, and every law's statement is identical, as a canonical term, to its slot's pattern with the constants substituted, built by the kernel's constructors in the concrete form the kernel uses for literal laws (quantifiers nested with the first-listed variable outermost, implications nested to the right, guards first).
Theorem B-1 (an engine using a valid bundle adds nothing). If an
engine's derivations use only the theorems of a valid bundle (by use
and the derived rules), every judgment it produces depends, beyond its
premises, only on those theorems; its label shows their classes.
Proof. The kernel computes dependency summaries from the rules applied;
use adds exactly the declaration it cites. \(\square\)
Proposition B-2 (validation is a convenience, not a guarantee). Validity (Definition B-2) is checked by the library, which is untrusted; an invalid bundle makes the engine's derivations fail at the kernel (the cited law does not have the statement the engine assumed), never succeed wrongly. \(\square\)
The standard schemas¶
| Schema | Constant slots | Law slots | Intended consumers |
|---|---|---|---|
CommutativeRing |
carrier \(C\), domain \(D\) (optional), \(0, 1, +, \cdot, -\) | the ACU declarations of \(+\) and \(\cdot\); additive inverse and distributivity on \(D\); closure of \(D\) | polynomial normalization engines |
OrderedField |
a CommutativeRing, \({}^{-1}\), \(<\), \(\le\) |
the literal laws R1–R7, O1–O7, F1–F2 on \(D\) (the kernel's Definition C-5) | linear arithmetic engines |
PolynomialEvaluation |
the polynomial kind's carrier and bound constants, peval, X, pconst |
the evaluation axioms and the homomorphism laws on finite environments | polynomial normalization engines |
Generic |
named slots | named slots | any engine; validated only for visibility and types |
scalar fills these for its profile (contract L-bundles).
Proposition B-3 (bundles from class instances). Let \(c\) be a class of
the kernel (K2.8) whose class theorems include, for each law slot of a
schema, a theorem whose statement is that slot's pattern over the class's
parameters, and let \(\tau : \{c\}\). Instantiating each such theorem at
\(\tau\) (by use, an admissible substitution) fills the schema with a
bundle valid at \(\tau\), with no domain.
Proof. use at an admissible substitution yields the slot's pattern
with the parameters at \(\tau\), which is Definition B-2's requirement; the
domain slot is empty because class laws hold on the whole type. \(\square\)
Classes give bundles for structures whose laws hold everywhere, such as
Isabelle's real and complex as fields. Structures whose laws hold only
on a domain, such as scalar's carrier, where the field laws hold for
finite values, are still filled by hand with their domain; they reach
the class library through scalar's bridges instead.