Selecting distinct list entries by a mask #
Cslib.Complexity.selectDistinct l w keeps the entry at position i of l when bit i of w
is true and i is the first occurrence of that entry in l. Missing bits are false, and bits
beyond the length of l are ignored. Unlike Cslib.Complexity.maskSelect, which keeps every
selected position and so selects sub-multisets, a repeated entry is selected at most once, so the
selection is duplicate-free (nodup_selectDistinct) and describes a set. Selecting with a full mask
of true bits lists the distinct entries of l in the order of their first occurrences
(mem_selectDistinct_replicate, length_selectDistinct_replicate).
Main definitions #
Cslib.Complexity.selectDistinct: the distinct entries of a list selected by a mask.
Main results #
Cslib.Complexity.mem_selectDistinct,Cslib.Complexity.nodup_selectDistinct: membership and duplicate-freeness of the selected entries.Cslib.Complexity.mem_selectDistinct_replicate,Cslib.Complexity.length_selectDistinct_replicate: the full mask selects every distinct entry oflonce.
The distinct entries of l selected by the mask w: position i of l is kept when bit i
of w is true and i is the first occurrence of its entry in l. Missing bits are false, and
bits beyond the length of l are ignored. Unlike Cslib.Complexity.maskSelect, which keeps every
selected position and so selects sub-multisets, a repeated entry is selected at most once, so the
selection describes a set.
Instances For
An entry v belongs to selectDistinct l w iff v ∈ l and the mask bit at the first
occurrence l.idxOf v is true.
selectDistinct l w contains no duplicate entries.
The full mask selects every entry of l, at its first occurrence.
The full mask selects as many entries as l has distinct entries.