Native observations of linked-list emptiness #
isEmptyEval calls the existing optional-root tag test. Its ordinary Boolean
result and unchanged heap follow from the same source total-correctness theorem.
The bridge reads no node and introduces no traversal, allocation or host callback.
noncomputable def
Complexity.Language.List.IsEmpty.isEmptyEval
(kind : CellTy)
(root : Option (NodeRef kind))
:
Invoke the existing source entry with the actual optional root.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.Language.List.IsEmpty.eval_exists_heap_eq
(kind : CellTy)
(values : List (CellValue kind))
(root : Option (NodeRef kind))
(heap : Heap)
(observed : (Representation.list kind).Rel values root heap)
:
The existing tag test returns ordinary list emptiness at exactly the same heap. The input observation relates the actual root to the mathematical list.
theorem
Complexity.Language.List.IsEmpty.eval_exists
(kind : CellTy)
(values : List (CellValue kind))
(root : Option (NodeRef kind))
(heap : Heap)
(observed : (Representation.list kind).Rel values root heap)
:
∃ (returned : Bool) (finish : Heap),
isEmptyEval kind root heap = Part.some (Except.ok returned, finish) ∧ Representation.bool.Rel values.isEmpty returned finish ∧ heap.ShapeExtends finish
The unchanged-heap observation also supplies the shared shape frame used to preserve other represented values across native calls.