rat_self_delimiting_code_neg_half
The code of -1/2: sign true, numerator 1 as true,true,false, denominator 2 as true,false,true,true,false.
Statement
theorem rat_self_delimiting_code_neg_half :
rat_self_delimiting_code (-1/2) = [true, true, true, false, true, false, true, true, false]- Source
- Sanity check of rat_self_delimiting_code.
- Verified
- 23 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- rat_self_delimiting_codeThe binary word encoding a rational number q: the bit true if q < 0 and false otherwise, followed by the self-delimiting code…
The proof, explained
The theorem establishes the self-delimiting code of the rational number $-1/2$ by direct computation. The code consists of a sign bit (`true`), followed by the delimited binary encodings of the numerator magnitude $1$ (`[true, true, false]`) and the denominator $2$ (`[true, false, true, true, false]`). Concatenating these components yields the 9-element Boolean list, which Lean's kernel confirms via `decide +kernel`.
rat_self_delimiting_code (-1/2) = [true, true, true, false, true, false, true, true, false] automation
The claim is a decidable equality between two concrete, finite values. Evaluating the definition on $-1/2$ produces: a sign bit of `true` since $-1/2 < 0$; a self-delimited code for the numerator $|-1| = 1$, which has binary representation `[true]` and expands to `[true, true, false]`; and a self-delimited code for the denominator $2$, which has binary bits `[false, true]` and expands to `[true, false, true, true, false]`. Concatenating these three pieces yields the 9-element list on the right-hand side. Lean's kernel verifies this equality by direct computation.
decide +kernel
- The proof relies entirely on kernel computation via `decide +kernel`, which evaluates the computable functions in the definition rather than producing symbolic deduction steps.
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 rat_self_delimiting_code_neg_half : rat_self_delimiting_code (-1/2) = [true, true, true, false, true, false, true, true, false] := by decide +kernel