lock
Creating axiom scopes for theorems
Overview
The lock() command creates a scope for axioms. Axioms defined within a lock act as parameters that must be "realized" when the theorem is called (T[… | R]).
+lockLabel: lock() { ... }+lockLabel: lock(); // a declaration to the end of the enclosing blocklockLabel- The label
axiom(| lockLabel, …)adds axioms through. The lock takes no arguments. { … }- Where the axioms hold: everything proved inside is a theorem under them, and a call applies it elsewhere only with a realization of each axiom.
Command Properties
- Group
- Context
- Produces
- Nothing itself — axiom adds statements to it
- Delivery & Label
- A label is required (
+𝒜: lock()):axiom(… | 𝒜)names the lock by it. - Creates scope
- Yes.
- Mechanism
- Opens a scope whose axioms are parameters of everything proved inside: a call of such a theorem from outside the lock needs a realization of each axiom it rests on — a proved statement of the same form — after
|. Inside the lock the axioms are visible facts.
Basic examples
Lock with axioms
Why Lock?
A lock is a scope whose internal rules are defined by its axioms. Each axiom command registers a statement in the lock's axiom list — a record of all conditions that must be satisfied when the theorem is applied. You cannot create statements "from thin air"; every axiom belongs to a specific lock.
When someone calls a theorem, the interpreter inspects each lock's axiom list and requires a realization for every axiom written before the theorem — a proof in the current context that the axiom's statement holds. The realization is checked by signature: it may rely on the same conditions the axiom did, or on fewer (a realization proved under fewer premises is still sound), but never on more. If any axiom cannot be realized this way, the call fails. This is what makes theorems trustworthy: they cannot be applied in contexts that don't satisfy their premises. See signature matching for the precise rule.
Axioms hold within their lock. Closing the lock does not make them facts outside it. A realization used outside a lock keeps that lock's full contract; every premise must match the required scheme. An unconditional result needs a proof of its premises. For assumptions used throughout a file, keep their lock open to the end of the file.
The axiom Command
Inside a lock, use axiom to declare conditional axioms:
axiom(expression -> expression | lockLabel)The lock label must be passed as the first argument. Axiom statements follow the same syntax as if statements.
Axiom requires lock label
Using Theorems with do
When you call a theorem proved in a lock, the interpreter checks that all axioms can be realized from the current proof context. See calls and Peano Arithmetic for full examples.
Nested Locks
A lock can contain another lock. This is a common technique for creating theorems that require axiom realizations containing their own inner axioms:
Nested locks
An inner lock inside an outer lock is a valid pattern for creating theorem templates.
lock() nodes. The interpreter will verify, by comparing signatures, that every axiom of every lock on the realization's path is matched by a corresponding lock axiom on the theorem's side. See Lock axioms: signature matching for details.Sealing a Lock
After all axioms have been defined, you can undeclare the lock label to prevent any further axioms from being added. Existing axioms and theorems built on them remain fully functional — only the ability to call axiom with this label is removed.
Sealing a lock with undeclaration
After -𝒜;, the lock is sealed — no new axioms can reference it.
Boundary Rules
Locks act as boundaries for calls that take the blocks their proof stands in: such a call takes for and if blocks only, never a lock (or a type / rule) — a result proved under a lock leaves it only as a theorem whose axioms a call realizes.