166. Library contradictions resolved (structures) (2026-11-21)
Resolutions of the doc-note contradictions (spec/delta/doc-notes/) for the structure modules
that change behaviour or a public name. Prose-only fixes are marked in the notes and not repeated.
IntervalMap.replace,SparseIntervalMap.replaceremoved;assigntakeson_old:. Decision 67 already chose the callback: amut selfgenerator can be abandoned half-way. Reverse: restorereplace(...) -> yields (range, val)and drop theon_oldparameter.MinIdx/MaxIdxremoved fromstd.algebra.min(by:)keeps the left operand on ties, so a tree of it already returns the first minimum (lib/ops-ranges.md§2); one name per idea. Reverse: restore the two structs and theirjoin.Rope.query_pathremoved. Its result depended on which tags were still pending, i.e. on the random tree shape, so two implementations could disagree. Reverse: restore it with a rule that fixes the answer (e.g. the latest tag coveringi).PersistentSegTree.diff_kthandBucketCount.kthare 0-based, likenth,RangeKth.kthandWaveletMatrix.kth. Reverse: makek1-based again and trap onk < 1.SortedBag.drain(r)renameddrain_range(r). It shared a name withdrain(after:, before:, while:), which returns aList; one name per result shape. Reverse: rename it back.SortedBag.sum()returnsK, asSortedSet.sumdoes, instead ofIntfor everyK. Reverse: returnInt.Bitset.prev(i)countsiitself, the mirror ofnextand the same asDynBitset.prev. Reverse: make it strictly beforeiagain.Bitset.first(pred)split intofirst()andfind(pred)(decision 66.1;seq.find). Reverse: foldfindback intofirstwith a default predicate.Subset.empty/fullare@get(decision 62; O(1) on one word).Bitset.empty()/full()stay calls: they are O(K / 64), and decision 140 (later) puts work behind(). Reverse: make theSubsetpair plainfnagain.LinkedList.first/lastreturn?TandLinkedList.pop_backis gone, matchingDeque(Nonefor absence;popalready removes the back). Reverse: returnTwith an empty trap and restore the alias.Heap.of(xs, by:). Withoutby:there was no O(n) max-heap, andMaxHeap.of(an alias ofHeap) built a min-heap. Reverse: drop theby:parameter.Heap<T>(by:)kept against decisions 15.8 and 18, which rejected it. Round 5 (lib/ops-ranges.md, Heaps) made it the one heap type withMinHeap/MaxHeapas aliases, and named options are the library-wide rule; reverting would bring back the eight Min/Max types. Reverse: restoreMinHeap/MaxHeapand the Min/Max pairs of the other heaps withoutby:.Poly.deg()andPoly.is_zero()are calls: stored trailing zeros make them more than O(1), and@getis only for O(1). Reverse: trim trailing zeros on every write and make them@get.- Added
DsuOf.groups(),Subset.set/shiftedandDir8.from, cited by containers.md §2.4 and decisions 62, 16.8 and 16.5. Reverse: delete them.