The VCGenM monad: its read-only Context (a fixed bundle of pre-built
BackwardRules + user-customisable simp methods) and its mutable State
(rule caches, accumulated invariants/VCs, simp cache).
A single elaborated frames alternative: its program pattern, the binder name of each pattern
variable (none for _, index-aligned with pat.varTypes), the raw frame term (elaborated in the
matched goal's context), the source position (a precedence tiebreak among matches, and its index
into FrameDB.entries), and whether it has already been applied.
- pat : Meta.Sym.Pattern
- frameStx : Syntax
- srcIdx : Nat
- retired : Bool
Set once this alternative has been applied, so it frames at most one occurrence.
Instances For
The frame database: program patterns keyed in a discrimination tree to the srcIdx of the
matching alternative, alongside the alternatives themselves in source order. Held in State.frameDB;
the discrimination tree is fixed, and only the retired flags of entries change.
- tree : Meta.DiscrTree Nat
- entries : Array FrameEntry
Instances For
Pre-built backward rules used by solve.
- tripleIntro : Meta.Sym.BackwardRule
The backward rule for
Triple.intro. Unfolds⦃P⦄ x ⦃Q; E⦄intoP ⊑ wp x Q E. - stateArgIntro : Meta.Sym.BackwardRule
The backward rule for
Lean.Order.le_of_forall_le. Peels one excess state argument from a function-lattice entailment. - propPreIntro : Meta.Sym.BackwardRule
The backward rule for
Lean.Order.le_of_imp_top_le. Introduces a bare pure precondition on theProplattice. - ofPropPreIntro : Meta.Sym.BackwardRule
The backward rule for
Lean.Order.ofProp_le. Introduces an embedded pure precondition⌜p⌝on any complete lattice. - truePreIntro : Meta.Sym.BackwardRule
The backward rule for
Lean.Order.true_le_of_top_le. Replaces aTrueprecondition with⊤on theProplattice. - elimPre : Meta.Sym.BackwardRule
The backward rule for
Lean.Order.top_le_prop. Strips a(⊤ : Prop) ⊑ ·wrapper from a VC before it is emitted. - andIntro : Meta.Sym.BackwardRule
The backward rule for
And.intro. - refl : Meta.Sym.BackwardRule
The backward rule for
Lean.Order.PartialOrder.rel_refl. Closes a reflexive entailmentpre ⊑ pre. - meetTop : Meta.Sym.BackwardRule
The backward rule for
meet_top_le_of_le. Cancels a redundant⊓ ⊤on the left of an entailment, turningP ⊓ ⊤ ⊑ QintoP ⊑ Q.
Instances For
Build the backward rules used by solve from their underlying lemmas.
Equations
- One or more equations did not get rendered due to their size.
Instances For
- backwardRules : BackwardRules
Pre-built backward rules used by
solve. - frameProcs : FrameProcs
The
@[frameproc]registry snapshot taken at frontend init.solveselects a procedure per program node by the node's monad. - latticeOps : Std.HashMap Name LatticeOp
Lattice splits keyed by operator head, merging the built-in connectives with the registered frame operators. Built once at frontend init;
splitLatticeOp?looks a head up here. - hypSimpMethods : Option Meta.Sym.Simp.Methods
User-customizable simp methods used to pre-simplify hypotheses.
- trivial : Bool
- useJP : Bool
The
jpconfig option: whentrue,tryLetIntrorecognises__do_jplets whose body is a splitter and sets up shared-continuation handling instead of zeta-unfolding. Whenfalse(default, matching originalmvcgen), every call site of the JP zeta-unfolds, leading to exponential blow-up on nested splits. - errorOnMissingSpec : Bool
The
errorOnMissingSpecconfig option: whentrue(default), a program with no matching spec raises a hard error. Whenfalse, the goal is emitted as an unsolved VC for the user to discharge — useful withvcgen [-some_spec]patterns where the user knows the spec is intentionally removed and wants to handle the residual goal by hand. - debug : Bool
The
debugconfig option: whentrue,tryApplyRuleretries failedBackwardRule.applycalls afterunfoldReducibleand reports an error when the retry succeeds, pinpointing missing normalization steps invcgen. - internalize : Bool
The
internalizeconfig option: whentrue(default),emitVCand the multi-subgoal fork inDriver.workcallGrind.processHypotheses. The tactic-mode entry point disables this when there is nowithclause. - invariantAlts : Std.HashMap Nat Syntax
Pre-parsed
invariants/invariants?alternatives, indexed by 1-based invariant number. Bullet form maps positions to entries (bullet n+1 → alt); labelled form maps the parsedinv<n>numbers (out-of-order labels are supported). Empty when noinvariantsclause is provided or ininvariants?(suggest) mode (handled separately). - untilPat? : Option Meta.Sym.Pattern
Instances For
- specs : SpecAttr.SpecTheorems
Spec database in scope: globals plus locals from in-scope hypotheses.
- jps : FVarIdMap JumpSiteInfo
__do_jpfvars currently in scope. The most recently lifted pure precondition.
tryLiftedHypcloses handoff VCs against it without walking the local context.- nextDeclIdx : Nat
Index of the next local declaration to consider for local specs.
Instances For
- specBackwardRuleCache : Std.HashMap (Name × Meta.Sym.ExprPtr × Nat) Meta.Sym.BackwardRule
A cache mapping registered SpecThms to their backward rule to apply. The particular rule depends on the theorem name, the
WPMonadinstance and the number of excess state arguments that the weakest precondition target is applied to.The instance is keyed by
ExprPtr, so lookups compare it by pointer rather than structurally. This is sound because the instance is a subterm of the hash-consed goal target. - splitBackwardRuleCache : Std.HashMap (Name × Meta.Sym.ExprPtr × Nat) Meta.Sym.BackwardRule
A cache mapping matchers to their splitting backward rule to apply. The particular rule depends on the matcher name, the monad and the number of excess state arguments that the weakest precondition target is applied to.
The instance is keyed by
ExprPtr, so lookups compare it by pointer rather than structurally. This is sound because the instance is a subterm of the hash-consed goal target. - latticeBackwardRuleCache : Std.HashMap (Meta.Sym.ExprPtr × Nat) Meta.Sym.BackwardRule
A cache mapping lattice connectives to their backward rule to apply, keyed by the
head … cₙprefix of constant arguments the rule bakes in verbatim and the total argument count that fixes the schematic operand and state count.The prefix is keyed by
ExprPtr, so lookups compare it by pointer rather than structurally. This is sound because it is a subterm of the hash-consed goal target. - frameBackwardRuleCache : Std.HashMap (Meta.Sym.ExprPtr × Nat) Meta.Sym.BackwardRule
Caches the
F-abstract upper-adjoint frame rule (op_wp_upperAdjoint_le_wp), keyed by theWPMonadinstance and the number of excess state arguments. - frameDB : FrameDB
The frame database from the
framesclause. Holes of type
Invariantthat have been generated so far.- vcs : Array Meta.Grind.Goal
The verification conditions that have been generated so far. Each entry shares the parent
Grind.Goal's state. - simpState : Meta.Sym.Simp.State
Persistent cache for the
Sym.Simpsimplifier used to pre-simplify hypotheses before grind internalization. Threading this cache across VCGen iterations avoids re-simplifying shared subexpressions (e.g.,s + 1 + 1 + ...chains). - fuel : Fuel
Remaining VC-generation steps. Initialized from
Context.config.stepLimit(or.unlimitedwhen no limit is set). Decremented at each successful program-shape step (tryLetHoist,trySplit,tryFvarZeta,applySpec). When exhausted,solveshort-circuits and emits the current goal as a VC. - inlineHandledInvariants : Std.HashSet Nat
Set of invariant numbers that have been inline-elaborated by
Driver.emitVCviatryInlineInvariant. The post-hoc invariant elaboration inFrontendconsults this to know which user-provided alts have already been consumed (so it doesn't warn about them).
Instances For
Equations
Instances For
Equations
- s.registerJP fv info = { specs := s.specs, jps := s.jps.insert fv info, lastLiftedPre? := s.lastLiftedPre?, nextDeclIdx := s.nextDeclIdx }
Instances For
Equations
- s.knownJP? fv = Std.TreeMap.get? s.jps fv
Instances For
Equations
- s.insertSpec thm = { specs := s.specs.insert thm, jps := s.jps, lastLiftedPre? := s.lastLiftedPre?, nextDeclIdx := s.nextDeclIdx }
Instances For
Walk goal's local context from scope.nextDeclIdx onward, registering any
spec-shaped hypotheses as local specs. Advances nextDeclIdx to the current
context size so siblings share work.
Equations
- One or more equations did not get rendered due to their size.
Instances For
True iff fuel has been exhausted (Fuel.limited 0).
Equations
- Lean.Elab.Tactic.Do.Internal.VCGen.outOfFuel = do let __do_lift ← get pure (match __do_lift.fuel with | Lean.Elab.Tactic.Do.Fuel.limited 0 => true | x => false)
Instances For
Decrement remaining fuel by one. No-op when fuel is .unlimited or already at zero.
Equations
- One or more equations did not get rendered due to their size.