The walk's state on a bitstring #
⚠️ Unreviewed by Bolton
Complexitylib.Classes.Containments.Internal.IPSem walks the game tree on an inductive state.
A machine has to hold that state on a tape, so this file writes it as a bitstring — a frame is
five blocks, the stack a right-nested chain of pairs — and records the invariant the encoding
needs: a returning value is a count, so it is never empty, which is what tells some from
none.
Main definitions #
Complexity.IPM.encFrm,Complexity.IPM.encStk,Complexity.IPM.encSst— the encodingComplexity.IPM.EncOk— the invariant the encoding relies on
Main results #
Complexity.IPM.step_encOk— the invariant is preserved
The encoding #
A frame on the tape: five blocks.
Equations
- Complexity.IPM.encFrm f = Complexity.pair f.lvl (Complexity.pair f.v (Complexity.pair f.a (Complexity.pair f.sum (Complexity.pair f.best f.body))))
Instances For
The stack on the tape: a right-nested chain of pairs, empty stack being the empty string.
Equations
Instances For
A returning value on the tape. A count is never empty, so the empty string means nothing is returning.
Equations
Instances For
The state on the tape.
Equations
Instances For
The invariant the encoding relies on #
Every frame carries the body of the rounds below it.
Equations
Instances For
The stack descends exactly one level per frame, so its depth is the level it started at.
Equations
Instances For
The encoding is faithful when nothing is returning while the stack is empty, and every count on the state has the width a count is held in — so that a returning value is never empty.
Nothing returns to an empty stack.
A returning value is a count.
So are the accumulators on the stack.
Every frame carries the body of the rounds below it.
The stack is no deeper than the level it started at.
Instances For
How long an encoded state is #
Every frame's counters are within the widths the walk uses.
Equations
- Complexity.IPM.SizeOk P [] = True
- Complexity.IPM.SizeOk P (f :: fs) = (f.v.length ≤ P.m ∧ f.a.length ≤ Complexity.IPM.msgW P ∧ Complexity.IPM.SizeOk P fs)
Instances For
The width the encoded state stays inside.
Equations
- One or more equations did not get rendered due to their size.