Documentation

CslibFrontier.Algorithms.WordRAM.PPSZ.Odometer

The odometer order of sections #

A section of a list of lists L = [l₀, l₁, …] picks one entry from each list (List.sections). List.sections lists them in odometer order, with the first entry running fastest. Cslib.Algorithms.WordRAM.PPSZ.nextSection is the odometer step: advance the first entry to its successor in its list, or, at the end of that list, return it to the start and carry into the rest. Cslib.Algorithms.WordRAM.PPSZ.nextSection_sections proves that it steps through List.sections L in order and stops after the last section, when every list is duplicate-free. A word-RAM program that keeps a section in an array and steps it with nextSection therefore visits every section exactly once.

Main definitions #

Main results #

The entry after the first occurrence of a in the list l, if any.

The odometer step: the section after t among the sections of L, if any. The first entry advances to its successor in its list; at the end of its list, it returns to the start of the list and the rest of the section advances.

theorem Cslib.Algorithms.WordRAM.PPSZ.succIn_getElem {l : List ℕ} (hl : l.Nodup) {i : ℕ} (hi : i < l.length) :
succIn l l[i] = l[i + 1]?

In a duplicate-free list, the successor of the i-th entry is the i + 1-st, if any.

The list xs lists sections of L in odometer order: the odometer leads from each entry to the next one, and from the last entry nowhere.

The first step of an enumeration.

The rest of an enumeration.

The odometer enumerates the sections. When every list of L is duplicate-free, the odometer step leads from each section of L to the next one in List.sections L, and from the last one nowhere.