rule
Rules of the logic: definitions by unique existence, bijections
Overview
The rule command declares the two rules of the logic that generate axiom schemes: rule("define", ∃!, ✔) says which atom means «there exists a unique», so that define(f | T) may define an operation from a proved unique existence; rule("bijective", f) says that a function between two enumerated types takes every value once (rule("bijective")). Each is part of what you trust. Everything else that shapes a step is written in the file as theorems and named: an enumeration type(𝔹 = ❌ | ✔) carries the schemas of distinct values and of cases, and the library proves from them the lemma contradict that closes an assumption by a contradiction (logic/bool.fl); the axioms of a quantifier or an implication are ordinary axioms of a lock (A∀Apply, generalize in logic/quantifiers.fl), and the steps are calls of them — generalize[| H], deduce[| H], obtain[| H]; the theorem a call on a quantified fact or a hint uses is named by notation("apply" | A∀Apply) and notation("hint" | …), which generate nothing.
rule("define", quantifierExpression1, …; truthExpression)rule("bijective", functionAtom1, …)quantifierExpression1, …define: the quantifiers «there exists a unique» — atoms of type[[T -> V] -> V](∃!).truthExpression- The value of a true statement of the quantifier's type (
true,✔). functionAtom1, …bijective: functionsf: [D -> C]between enumerated types of one size, each declared a bijection.
Command Properties
- Group
- Context
- Produces
- Nothing —
ruleconfigures the proof system but does not produce statements - Delivery & Label
- Into itself. A label on
ruleholds the schemas the declaration generates (a package to pass to a call); only+Label:syntax is allowed (declaration),Label:(definition without+) is an error. - Creates scope
- Yes.
- Mechanism
- Parses the first string argument as the rule name, checks the types of the atoms given, and generates the axiom schemes of the rule in a lock of its own.
Basic examples
A bijection between enumerations
The rule says that color is a bijection: no two houses have one colour, and every colour is in some house. decide finds the values from the facts by the schemas of the enumerations and of the rule.
Details
Rules are part of what you trust — a false rule is as dangerous as a false axiom, and tools/trust.py lists the rules every theorem relies on. Everything that only changes how text is read (operators, abbreviations, default values, the theorems of steps) is notation, not a rule. Types and locks used to be rules too; they are now separate commands — type() and lock() — and they share the label and boundary behaviour described below.
Available Rules
| Rule | Purpose | Details |
|---|---|---|
define |
Quantifiers «there exists a unique» that allow define(f | T) |
rule("define") |
bijective |
Functions between enumerated types that take every value once | rule("bijective") |
Before step 189в the rules contradict, apply, generalize, deduce, obtain, witness and equality generated the axiom schemes of the steps of a proof. Now these axioms are written in the file, where a reader sees them (Command Reducibility), and the steps are calls; nothing is generated and nothing is hidden.
Labels on rule, type and lock
A label on rule (and likewise on type and lock) does not capture any statements proved under it. A label on a rule or an enumeration holds the schemas the declaration generates — a package, +ABijective: rule("bijective", color), +AColor: type(Color = red | green) — and a call takes from a given package the schema each lock axiom of the theorem needs (Rules on the theorem's path): contradict of the library is proved by A𝔹[| A𝔹[_, P, ❌ | AX]], the schemas of cases and of distinct values of +A𝔹: type(𝔹 = ❌ | ✔).
As a lock label for axiom
When a label is placed on lock(), it can be used as the first argument of axiom to register axioms within that lock. This is the only way to create axioms:
Label on lock for axiom
+Label: (declaration) is allowed on rule, type and lock. Using Label: (definition without +) is an error, because these commands produce nothing to define with.Boundary Role
Any rule, type or lock command acts as a boundary: a call that takes the blocks its proof stands in takes for and if blocks only, never one of these — a result proved under a rule or a lock rests on its schemas or axioms, and leaves it only as a theorem whose axioms a call realizes.