The emitter loop driver #
emitLoopTM body ctr fuel runs body once per mark of the fuel register,
incrementing the counter register ctr after each run. Its Hoare rule
(emitLoop_hoareTime) is the single lemma behind every runtime loop of the
reduction emitter: the t-loops over tableau rows and the position loops
over tape cells. The per-iteration emission is an arbitrary word family
E : ℕ → List Bool, so nested loops instantiate E with inner loop
outputs, and leaf bodies instantiate it with CNF.encode images.
Also here: the arithmetic cap lemma flatCaps (one bound 4·A·B·C·D ≤ M
discharges every LitDesc.Spec obligation) and the encode/flatMap
distribution lemma.
Peel the last iteration off a flatMap over List.range:
(range (i+1)).flatMap E = (range i).flatMap E ++ E i.
CNF.encode distributes over flatMap.
The emitter loop: run body once per mark of fuel, incrementing
ctr after each run.
Equations
- Complexity.SAT.emitLoopTM body ctr fuel = (body.seqTM (Complexity.TM.incRegTM ctr)).forRegTM fuel
Instances For
Uniform budget of an emitter loop with at most M iterations whose body
runs within inner.
Equations
- Complexity.SAT.loopBudget M inner = M * (inner + 1 + Complexity.TM.opBudget M + 2) + (M + 2)
Instances For
loopBudget M is monotone in the inner budget.
The raw loop bound rounds up to loopBudget.
clauseBudget · M is monotone in the literal count.
emitLoopTM Hoare rule. From fuel = v and ctr = 0, run the body
at every i < v; the body sees ctr = i (fuel tape parked mid-loop),
emits E i, and restores the work tapes. Afterwards ctr = v and the
output extends by (range v).flatMap E.
emitLoopTM Hoare rule, offset form: the counter starts at s and
ends at s + v; the body at iteration i < v sees ctr = s + i. Used
by the pairwise at-most-one families, whose inner position loops start
just past the outer position.
emitLoopTM Hoare rule, general form: the per-iteration work states
are an arbitrary ghost family u (so bodies may drift registers across
iterations — shrinking inner fuels, mirrored counters), and the counter
value is an arbitrary ghost ctrVal. The body at iteration i carries
u i to u (i + 1)-with-the-counter-still-old; the loop's own increment
finishes the move.