Expand description
Loop-sensitivity planning for the staged verifier.
The planner runs before path extraction in verify --postfix-repeat auto.
It keeps the decision about loop depth separate from individual safety-tag
checkers: tags still describe what must hold, while this module decides
whether the checked value depends on loop-carried MIR state.
§Pipeline role
VerifyTargetCollector ──► LoopSensitivityAnalyzer ──► VerifyDriver
(sinks) (repeat plan) (paths + checks)The normal verifier is path-bounded: PathExtractor receives a numeric
allow_repeat and enumerates only that many extra SCC postfix repetitions.
In auto mode, this module chooses that number from MIR structure instead of
from an already-failed tag-specific retry loop.
§Current abstraction
The planner now has two internal hint streams:
DataflowDistanceHint: a sink depends on loop-carried state, and the planner estimates how many loop backedges are needed for that state to reach the sink.NumericRangeHint: a numeric/index obligation depends on induction-style state, and the planner estimates the first iteration that can witness a range violation.
RepeatPlan is the single product consumed by the driver. It calibrates
both hint kinds into the PathEnumerator’s allow_repeat budget and picks
the maximum, so detector-specific details stay inside this module.
Structs§
- Comparison
Fact 🔒 - A MIR comparison that feeds a boolean branch.
- Dataflow
Distance 🔒Hint - A loop-carried dataflow hint.
- Local
Dependency 🔒Index - Whole-function local dependency index.
- Loop
Component 🔒 - A non-trivial SCC in the MIR control-flow graph.
- Loop
Local 🔒Summary - Local assignment and transfer summary for one loop SCC.
- Loop
Numeric 🔒Summary - Numeric induction summary for one loop SCC.
- Loop
Sensitivity 🔒Analyzer - Computes the repeat plan for one verification target.
- Numeric
Range 🔒Hint - A numeric/index range hint.
- Repeat
Plan 🔒 - Unified product of the auto loop-sensitivity pass for one function target.
- Safety
Sink 🔒 - One safety obligation whose arguments have been bound to caller MIR locals.
- Switch
Successor 🔒 - Switch successor annotated with the boolean value that selects it.
Enums§
- Numeric
Term 🔒 - Small numeric term language for loop guards.
- Repeat
Strategy - User-selected policy for SCC postfix repetition.
Constants§
- BRANCH_
SENSITIVE_ 🔒BACKEDGES - Backedge budget used when an internally branched SCC has loop-carried assignments into a checked sink.
- DEFAULT_
LOOP_ 🔒CARRIED_ BACKEDGES - Fallback loop-carried distance used when a sink is loop-sensitive but the local transfer graph is too imprecise to calculate a better distance.
- DEFAULT_
NUMERIC_ 🔒WITNESS_ ITERATION - Conservative first numeric witness when an index obligation is known to be induction-sensitive but the current summary cannot yet recover a concrete symbolic bound.
- MAX_
AUTO_ 🔒REPEAT - Upper bound for repeat selected by auto mode.
- MIN_
DATAFLOW_ 🔒REPEAT - The first repeat depth that reliably exposes the existing delayed loop-carried pointer/state fixtures.
Functions§
- block_
reaches_ 🔒component - Return whether
startcan reach any block incomponent. - ceil_
div_ 🔒i128 - Integer ceil-div for positive operands.
- collect_
assigned_ 🔒locals - Collect locals directly redefined by statements or call destinations.
- collect_
entry_ 🔒lower_ bounds - Collect numeric lower bounds that hold on paths entering this SCC.
- collect_
loop_ 🔒guard_ upper_ bounds - Collect loop-guard upper bounds for induction locals.
- collect_
operand_ 🔒sources - Add the local read by a MIR operand, if any.
- collect_
rvalue_ 🔒sources - Add local operands referenced by an rvalue to
out. - comparison_
fact 🔒 - Extract a simple comparison from an rvalue.
- component_
has_ 🔒internal_ branch - Return true when a component contains a real in-loop branch.
- component_
reaches_ 🔒checkpoint - Returns true if any block in
componentcan reachcheckpointvia CFG edges. - estimate_
branch_ 🔒sensitive_ backedges - Estimate extra budget needed when a loop-carried sink is controlled by internal SCC branches.
- estimate_
dataflow_ 🔒backedges - Estimate how far loop-carried state must travel before reaching a sink.
- estimate_
inbound_ 🔒witness - Estimate an index-range witness for
InBound. - estimate_
valid_ 🔒num_ witness - Estimate the first violating iteration for a simple
ValidNumsink. - expr_
const_ 🔒i128 - Extract a contract integer constant small enough for the planner model.
- expr_
is_ 🔒place - Return true when a contract expression is a plain numeric place.
- first_
field_ 🔒projection - Return the first field projected from a place.
- flatten_
or_ 🔒property - Collect the non-
Orleaf properties of a (possibly compound) property tree. - graph_
reaches_ 🔒any - Return whether a loop SCC can reach a given checkpoint block.
- increment_
source_ 🔒and_ step - Extract
local +/- constfrom an arithmetic rvalue. - local_
is_ 🔒argument - Return true if
localis a function argument local. - loop_
components 🔒 - Extract loop SCCs from
PathGraph. - lower_
bound_ 🔒from_ branch - Infer a local lower bound from taking one boolean branch of a comparison.
- max_
state_ 🔒distance_ from - DFS over dependency edges, counting only loop-carried state locals.
- numeric_
term_ 🔒from_ operand - Convert a MIR operand into the planner’s small numeric term language.
- numeric_
term_ 🔒lower_ bound - Resolve a known lower bound for a numeric term.
- operand_
const_ 🔒i128 - Return the local used by an operand when the operand is a plain local place. Extract an integer constant from an operand.
- place_
is_ 🔒indirect_ write - Return true when an assignment writes through a pointer/reference.
- plain_
copy_ 🔒source - Return the source local for a plain local copy/move rvalue.
- repeat_
for_ 🔒backedges - Convert loop backedge distance to
PathEnumerator::allow_repeat. - repeat_
for_ 🔒witness_ iteration - Convert a 1-based loop-body witness iteration to
allow_repeat. - resolve_
local_ 🔒copy - Follow plain copy chains for a local.
- resolve_
numeric_ 🔒term - Follow copy chains inside a numeric term.
- rvalue_
const_ 🔒i128 - Extract a direct constant assignment from an rvalue.
- rvalue_
projection_ 🔒source - Return the source temp for
tmp.field_index. - simple_
upper_ 🔒bound_ violation_ value - Match
x < C,x <= C, and their constant-on-left equivalents. - switch_
successors 🔒 - Return all explicit and
otherwisesuccessors of a bool-like switch. - valid_
num_ 🔒violation_ value - Extract the lowest value that violates a simple upper-bound
ValidNum. - witness_
iteration_ 🔒for_ threshold - Compute the first 1-based iteration where
init + step * iterationreachesviolation_value.