This section uses ordinary Lean lists as the mathematical model of a linked
list. It captures the lookup, front insertion, and deletion-by-key behavior
that CLRS proves informally before one adds pointer fields and memory
allocation.
Main results:
Theorem listSearch_sound: a successful search returns an element from
the input list satisfying the predicate.
Theorem mem_listInsert_self: inserting at the front makes the inserted
element a member.
Theorem mem_listDeleteAll_iff: deleting all nodes with a key gives the
expected membership characterization.
Current gaps:
Pointer-level predecessor/successor updates and free-list allocation are
deferred to a future imperative-memory model.
namespaceCLRSnamespaceChapter10
Functional linked-list operations
Search a list for the first element satisfying a Boolean predicate.