Repository navigation
v0.53.0
Mutual definitions and theorems. Functions defined together on types
defined together (a tree's size calls its forest's, and back), and
theorems proved together by mutual induction, with Lean and without it.
The new forests example (example/lean_to_prooflang/forests) has 16
obligations: all verified by Lean and strictly by verify --offline, 11
by ProofLang's kernel without Lean (the automated module's 8 among them).
- The language:
mutual definitionandmutual theorem. A run of either in the
source is one group: any other declaration, aproofincluded, ends
it. A group's members may call each other, and each one declares its
result type. A group is one Leanmutual … endblock, whose recursion
Lean checks is structural.- Mutual induction.
strategy induction(on = t)on a theorem of a
group proves each constructor case with, for every field whose type
another theorem of the group is about, that theorem at the field. In
Lean it is amatch t withwhose arms state those hypotheses as calls
(have ih₁ := sizeF_doubleF children). A theorem so proved is about
one variable of a type without parameters or indices, and no two of a
group are about the same type: both are errors with the reason.
- Without Lean:
- Mutual definitions compile to the block recursor, one motive per
type, a call on a field being its induction hypothesis. Each set of
members that call each other (sizeandsizeF, notsumandsumF
written in the same run) is compiled on its own, and must define one
f(x: T) → R: match x:per type of the block,Rnot mentioningx. - Mutual induction is the block recursor into
Prop, the group's
statements its motives (λ _, Truefor a type no theorem is about).
It proves the whole group at once and cites none of it. - Linking. Lean's compilation of a mutual group (
brecOnover the
block) is proved equal to the native one, all members at once, by the
block recursor. So the forests example verifies strictly offline.
- Mutual definitions compile to the block recursor, one motive per
- Not yet: a hand-written recursive tactic proof (a
by:block that
calls its sibling) runs only in Lean; the native tactics run no
recursion, nor a tacticmatch. Nested types still have no native
matchor induction. - Hashes. A mutual definition group is hashed as one: each member's
hash depends on every member (a reference to one of them hashed as its
position), so editing one member changes all of theirs, and renaming
one changes none.