The killed walk, as an algorithm #
The walk length and the killing denominator are constants of a round, so the walk is a constant-depth unrolling of the preprocessed rotation map, and the stopping index is chosen by a constant-depth chain of comparisons.
Main definitions #
Complexity.selectAt— choose among constantly many functions by a unary keyComplexity.walkFn— the vertex a walk reaches after a constant number of steps
Main results #
Complexity.walkFn_mem_FP,Complexity.walkFn_eq— it is anFPfunction, and it computesConstraintGraph.walkNum
Every code in a cloud is below twice the edge count.
The rotation map keeps a vertex number in range.
A walk stays in range.
The preprocessed graph has 2 + 2 · deg darts at a vertex.
Choosing by a unary key #
Choose among n + 1 functions by a unary key.
Equations
- Complexity.selectAt f key 0 x✝ = f 0 x✝
- Complexity.selectAt f key n.succ x✝ = Complexity.ifEqLen (key x✝) (List.replicate (n + 1) true) (f (n + 1) x✝) (Complexity.selectAt f key n x✝)
Instances For
Walking #
The vertex a walk reaches after k steps, on
pair (graph) (pair (unary vertex) (unary steps)).
Equations
- One or more equations did not get rendered due to their size.
- Complexity.walkFn F pol deg P 0 x✝ = Complexity.pairFst (Complexity.pairSnd x✝)
Instances For
The walk algorithm computes the walk.
Where the walk stops #
The first zero digit at or after i, among the next n digits.
Equations
- Complexity.stopFromNum q c x✝ 0 = x✝
- Complexity.stopFromNum q c x✝ n.succ = if c / q ^ x✝ % q = 0 then x✝ else Complexity.stopFromNum q c (x✝ + 1) n
Instances For
Where the walk stops, from a unary reading co of the coins.
Equations
- Complexity.stopFn q co x✝¹ 0 x✝ = List.replicate x✝¹ true
- Complexity.stopFn q co x✝¹ n.succ x✝ = Complexity.ifEqLen (Complexity.modC q (Complexity.divC (q ^ x✝¹) (co x✝))) [] (List.replicate x✝¹ true) (Complexity.stopFn q co (x✝¹ + 1) n x✝)
Instances For
The dart the walk comes back by #
The label the walk's i-th step points back along.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The back-label algorithm reads the label off the rotation map.
The reversed dart's digits, for a fixed stopping index k, over the first
n places.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.revSum F pol deg P k 0 x✝ = []
Instances For
The digit sum has the reversed dart's number as its length.
The reversed dart's number, for a fixed stopping index.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The powered graph's rotation map #
The coins of a killed dart.
Equations
- Complexity.coinsOf q T z = Complexity.modC (q ^ T) (Complexity.pairSnd (Complexity.pairSnd z))
Instances For
The dart a killed walk comes back by, on pair (graph) (pair (unary vertex) (unary dart)).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The powered graph's rotation map, on pair (graph) (pair (unary vertex) (unary dart)): walk to the end, come back by the reversed labels, and keep the
coins.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The return-dart algorithm computes the dart the walk comes back by.
The rotation algorithm runs the powered graph's rotation map.