Expand description
Committed-lemma consumption — the proof-side “sink” for auxiliary helper lemmas.
A normal aver proof parses a committed DiscoveredLemmas.lean (hash-gated
for staleness via discovery_surface_hash), re-pins each in-scope
Induction law to ProofStrategy::SimpOverLemmas(names), and the Lean
backend embeds the lemma texts before the law theorem — re-proving them in
the same lake build — and simps over their names. So a law that needs an
auxiliary lemma closes universally once that lemma is committed in scope.
Re-verification in lake build, NOT the hash, is the soundness guard: a
stale or hand-edited file is ignored, never trusted.
The committed lemmas are produced EXTERNALLY — by hand or by the Method
agent loop (the the-method skill: an agent proposes auxiliary laws, the
kernel certifies them) — not by an in-tree enumerator. The brute-force
equation enumerator that previously populated DiscoveredLemmas.lean
(aver proof --discover / --emit-laws) was removed; its full source is
archived at the git tag archive/lemma-discovery-enumerator.
Structs§
- Committed
Lemma - A lemma available to a law’s proof: its theorem name plus Lean text (statement, and for embedded ones the tactic too). Two provenances flow through the same orientation / loop-exclusion / simp-selection machinery:
Enums§
- Lemma
Provenance - Who PROPOSED a lemma — the ORIGIN axis, orthogonal to the verification
STRENGTH axis (the sidecar’s “verified (bounded), kernel proof pending” vs
proven header). The proof system has several lemma proposers; each lands on
a different point of the discovery-vs-plumbing map, so the artifacts carry
the origin honestly instead of letting one proposer’s name (the
--discoverenumerator) stand in for all of them. - Simp
Direction - How a committed lemma may join a
simpset. Discovery commits equations in enumeration orientation, so usability as a rewrite rule is a property to RECOVER, not assume.
Functions§
- apply_
simp_ over_ lemma_ pins - Apply a
plan_simp_over_lemma_pinsplan to the lowered IR. - discovery_
surface_ hash - Staleness key for a committed
DiscoveredLemmas.lean: an FNV-1a hash over the sorted signatures of the program’s pure-fn proof surface. A normalaver proofre-pins committed lemmas only when this matches the hash the file was tagged with — a changed surface means the committed lemmas may be stale, so they are ignored (the re-pin behaves exactly as if none existed). The hash gates staleness only; re-verification inlake buildis the soundness guard, never the hash. - forbidden_
token_ in_ lemma - Soundness validation for a parsed committed lemma: the embed path writes
textVERBATIM into the generated entry root, where lake compiles it as top-level Lean — so a block absorbing anything beyond its owntheorem … := by+ tactic lines (the parser takes every non-theoremline as-is, and Lean accepts indented top-level commands) could smuggle a declaration likeaxiom cheat : Falseinto the proof environment. Returns the first forbidden declaration keyword found outside--line comments (skipping the block’s own leadingtheorem), orNonewhen the block is clean. The CLI rejects the WHOLE artifact on any hit — a discovery-emitted file never contains these, so a hit means hand-edited or corrupted content that must not join a kernel-trust pipeline. (The axiom WHITELIST in the universal metric is the backstop; this check makes the failure loud and early instead.) - lemma_
lhs_ fns - Program fns a lemma’s LEFT-HAND SIDE mentions — the rewrite rule’s pattern,
projected through
lean_indexlikementioned_fns. A Forward lemma fires against the consumer goal only through its LHS shape (length (append x y) = plus …matches a goal containinglength (append …)), so a sibling whose LHS sits entirely inside the consumer’s proof cone is RELEVANT even when its RHS introduces an out-of-cone combinator (plus) — that combinator’s= a + bbridge is synthesized downstream, and loop safety is handled bysimp_entries. Falls back to the whole statement when there is no top-level=(an invariant-shaped lemma, which is inert as a rewrite anyway). - mentioned_
fns - Program fns a lemma’s Lean text mentions, projected through
lean_index(Lean name → caller-chosen value, e.g. the source name). Token scan over identifier-shaped chunks; builtin lemma names (List.append_assoc, …) and binder names simply miss the index. - parse_
committed_ lemmas - Parse a committed
DiscoveredLemmas.leaninto its theorem blocks. A block starts at a column-0theoremline and runs until the next one (proof lines are indented, so this never splits a tactic). Header comments before the first theorem are dropped; comment/blank lines between theorems are absorbed into the preceding block’s text (harmless Lean comments). - plan_
simp_ over_ lemma_ pins - Decide which laws get the committed lemmas. A lemma is in-scope for a law
when every program fn its text mentions is inside the law’s proof cone
(plus the law’s subject fn) — the same scope discovery enumerated over, so
the embedded text can only reference fns already emitted before the law’s
theorem. Only laws the lowerer pinned
Inductionare re-pinned: that is the strategy the discovery cluster (list/Peano homomorphisms) lands on, and the Lean renderer forSimpOverLemmasreuses the same induction ladder, so the swap can only ADD proving power. - simp_
entries - Ready-to-emit
simpset entries for a pinned lemma selection: a Forward lemma joins asname, a Reversed one as← name— minus the loop-prone combinations. A Forward rule whose RHS mentions a program fn that some Reversed rule in the SAME set unfolds (its RHS head) would compose into a rewrite cycle — e.g.length (x0 ++ x1) = length (append x0 x1)(forward) against← ((x0 ++ x1) = append x0 x1)ping-pongs++ ↔ appendunderlengthforever.simploops are NOT a caught failure: they abort the build with a deterministic maxHeartbeats ERROR thatfirstcannot recover from, so the exclusion is a build-safety requirement, not a quality preference. - simp_
orientation - Classify a committed lemma as a usable
simprewrite rule, orNone(e.g. a0 <= …invariant, or an equation connecting nothing to a program fn head). ANonelemma stays EMBEDDED (other committed lemmas’ proofs may depend on it) but joins no simp set — a builtin-headed equation used left-to-right re-folds the very structure the induction ladder needs peeled, and loops against the fn’s own def unfold.