AFTD Auto-Formalizing Theoretical Domains

nat_self_delimiting_code_zero

theoremverified

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.

  1. 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]`.

    line 2

    uses nat_self_delimiting_code

      simp [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.

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

theorem nat_self_delimiting_code_zero : nat_self_delimiting_code 0 = [false] := by  simp [nat_self_delimiting_code]
See it in the graphDiscuss this resultChallenge it