nat_self_delimiting_code_zero
The self-delimiting code of 0 is the single bit false.
Statement
theorem nat_self_delimiting_code_zero : nat_self_delimiting_code 0 = [false]- Source
- Sanity check of nat_self_delimiting_code (OP-851 encoding).
- Verified
- 07 Nov 2026
- Axioms
Quot.soundpropext- Built on 1
- nat_self_delimiting_codeThe self-delimiting binary code of a natural number m: each bit b of the binary expansion of m (least significant bit first, as in…
The proof, explained
The theorem is proved by unfolding the definition of `nat_self_delimiting_code` at 0. Because 0 has no binary digits in its representation (`Nat.bits 0 = []`), mapping each bit produces an empty list, leaving only the terminating `false` bit.
nat_self_delimiting_code 0 = [false] automation
Simplify the goal by unfolding the definition of `nat_self_delimiting_code`. For m = 0, the binary expansion `Nat.bits 0` is the empty list `[]`. Transforming the empty list with `flatMap` yields `[]`, so the expression simplifies to `[] ++ [false]`, which evaluates to `[false]`.
uses
nat_self_delimiting_codesimp [nat_self_delimiting_code]
nat_self_delimiting_code- The self-delimiting binary code of a natural number, obtained by replacing each bit b with [true, b] and appending a terminating false.
- The simplifier automatically evaluates `Nat.bits 0` to the empty list, simplifies `List.flatMap` over the empty list, and appends `[false]`.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem nat_self_delimiting_code_zero : nat_self_delimiting_code 0 = [false] := by simp [nat_self_delimiting_code]