Documentation

CslibFrontier.Computability.WordRAM.PointerMachine.Input

Finite AVL keys for the word-RAM input convention #

The source input occupies address zero (the length) and addresses one through the input length. This construction supplies a valid AVL tree containing precisely that finite interval.

A valid AVL key tree for the first n addresses, built by the existing insertion algorithm.

The canonical input key tree has correct heights, ordering and balance.

@[simp]

Exactly the first n addresses occur in the canonical input key tree.

theorem Cslib.WordRAM.PointerMachine.init_memory_support (input : List ℕ) {r a : ℕ} (nonzero : (Data.init input).mem a ≠ 0) :
a ∈ (inputKeys (input.length + 1)).elements

The source's initial memory is zero outside its length cell and input cells.

Store each AVL node's key, cached height, and memory value in fields zero, one, and two.

Canonical initial dictionary: preorder-labelled input cells, including the length cell.

Encode a word-RAM input as a linked AVL heap, with zeroed scalar registers and the root in pointer register one. As with WordRAM.Data.init, input encoding is outside execution cost.

theorem Cslib.WordRAM.PointerMachine.inputState_represents (w r : ℕ) (input : List ℕ) :
Represents (Data.init input) (inputState w r input) (inputTree w input) (inputKeys (input.length + 1))

The explicitly encoded input satisfies the complete compiler representation invariant.

@[simp]

The input heap has one node per input cell, plus its length cell.

Every pointer in the encoded input names an allocated node.