Documentation

Examples.Language.Splay.CorrectnessLeft

Left-going recursive cases of the actual splay program #

The recursive subtree contract composes through shared parent-link and rotation rules. Each source store and call retains its actual intermediate heap. The mathematical certificate records a single zig for an empty grandchild and the appropriate double rotation otherwise, without changing the executed program.

theorem Complexity.Language.Examples.Splay.AccessResult.zig_zig_left {query : ℕ} (key : ℕ → ℕ) (keys left right : Buffer CellTy.nat) (z y : ℕ) (inner c d : Tree ℕ) {heap : Heap} (represented : BufferTree.Rep key keys left right heap (Tree.node z (Tree.node y inner c) d)) (unique : (Tree.node z (Tree.node y inner c) d).inorder.Nodup) (keysLeft : keys.Disjoint left) (keysRight : keys.Disjoint right) (leftRight : left.Disjoint right) (queryLtRoot : query < key z) (queryLtChild : query < key y) (recursive : AccessResult key keys left right query inner heap) :
AccessResult key keys left right query (Tree.node z (Tree.node y inner c) d) heap

Left-left descent reattaches its recursive result and performs the actual one- or two-rotation branch selected by the returned subtree.

theorem Complexity.Language.Examples.Splay.AccessResult.zig_zag_left {query : ℕ} (key : ℕ → ℕ) (keys left right : Buffer CellTy.nat) (z y : ℕ) (a inner d : Tree ℕ) {heap : Heap} (represented : BufferTree.Rep key keys left right heap (Tree.node z (Tree.node y a inner) d)) (unique : (Tree.node z (Tree.node y a inner) d).inorder.Nodup) (keysLeft : keys.Disjoint left) (keysRight : keys.Disjoint right) (leftRight : left.Disjoint right) (queryLtRoot : query < key z) (childLtQuery : key y < query) (recursive : AccessResult key keys left right query inner heap) :
AccessResult key keys left right query (Tree.node z (Tree.node y a inner) d) heap

Left-right descent rotates the returned child when nonempty and reconnects it before the final root rotation; every write is a source-program write.