Positional deletion removes the segment at the position from the in-order sequence
ProvedCentralStrQ.posDelete_toListaugmented-treesdata-structureshoare-logicred-black-treesverified-programmingword-ram
For every position tree and position , the in-order list of segments of posDelete t i is segDelete t.toList i.
Preamble
import Mathlib import Definitions.Def_CentralStrQ_PosTrees import Definitions.Def_CentralStrQ_PosDelete set_option autoImplicit false
Formal statement
namespace CentralStrQ
/-- **Positional deletion deletes from the sequence of segments**: the in-order list of
`posDelete t i` is `segDelete t.toList i`. -/
theorem posDelete_toList (t : RBTree.RBNode (ℕ × ℕ)) (i : ℕ) :
(posDelete t i).toList = segDelete t.toList i := by sorry
end CentralStrQ
Source
Positional deletion from balanced trees of segments ordered by position (order-statistic trees; T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, 3rd ed., MIT Press 2009, Chapter 14 Augmenting Data Structures), following the functional red-black deletion of the Lean library Batteries (module Batteries.Recycling.RBTree: RBNode.del, RBNode.erase, RBNode.append, RBNode.balLeft, RBNode.balRight, balLeft_toList, balRight_toList, setBlack_toList, RBNode.DelProp, Balanced.del, Balanced.erase, Balanced.append, Balanced.balLeft, Balanced.balRight, DelProp.redred, RedRed.setBlack; authors L. de Moura, M. Carneiro, https://github.com/leanprover-community/batteries). Used to maintain the phrases of a parsing of a dynamic string (Boneh, Fried, Golan, Kraus, Dynamic LZ77: No Space for Improvement, STOC 2027 submission, Section 4.1, p. 16, dynamic algorithms and edit operations). Builds on the published position trees Def_CentralStrQ_PosTrees and wsum_eq_sum.