Structural laws for the existing framed list decoder
TheoremParsing a framed head leaves the raw remainder#✓fully proved
Parsing a framed head leaves exactly the raw remainder, including any later framing failure. The decoder's fuel does not alter this law.
theorem blocks_delimit (p r : List Bool) :
undelimitBlocks (delimit p ++ r) =
(undelimitBlocks r).map (p :: ·)
def undelimitBlocks (input : List Bool) : Option (List (List Bool)) :=
undelimitBlocksAux input.length input
MathlibExt/Computability/Complexity.lean:102
def delimit : List Bool → List Bool
| [] => [false]
| b :: l => true :: b :: delimit l
MathlibExt/Computability/Complexity.lean:68
Uses 5 · Used by 1
TheoremList decoder consumes one raw payload at a time#✓fully proved
The canonical list decoder consumes one raw payload at a time. Both element failure and later framing failure are retained exactly.
theorem decode_list_delimit {α : Type} [MetaMathlibExt.BitstringEncoding α]
(p r : List Bool) :
bitDecode (α := List α) (delimit p ++ r) =
(bitDecode (α := α) p).bind (fun a =>
(bitDecode (α := List α) r).map (a :: ·))
class BitstringEncoding α extends Computability.Encoding α Bool
MathlibExt/Computability/Complexity.lean:48
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
def delimit : List Bool → List Bool
| [] => [false]
| b :: l => true :: b :: delimit l
MathlibExt/Computability/Complexity.lean:68
Uses 9 · Used by 3
TheoremMalformed first frame makes list decoding fail#✓fully proved
A nonempty input with a malformed first frame fails list decoding. Empty input is excluded because it is the valid empty list.
theorem decode_list_none_of_undelimit_none {α : Type}
[MetaMathlibExt.BitstringEncoding α] {x : List Bool}
(hx : x ≠ []) (h : undelimit x = none) :
bitDecode (α := List α) x = none
class BitstringEncoding α extends Computability.Encoding α Bool
MathlibExt/Computability/Complexity.lean:48
def undelimit : List Bool → Option (List Bool × List Bool)
| false :: rest => some ([], rest)
| true :: b :: input => (undelimit input).map fun p => (b :: p.1, p.2)
| _ => none
MathlibExt/Computability/Complexity.lean:74
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
Uses 8
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.