A fixed-width encoding has its width
ProvedBitcoinSer.leBytes_lengthFor all : .
import Definitions.Def_BitcoinSer
theorem BitcoinSer.leBytes_length (k n : Nat) : (BitcoinSer.leBytes k n).length = k := by sorry
Read-back
What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: BitcoinSer.leBytes_length
Binders and hypothesis. Two natural numbers and are universally quantified, with no restriction whatsoever on either: may be , and may be any natural number, including values at or above . There are no hypotheses.
Conclusion. The byte string has length exactly :
Unfolding. is the little-endian fixed-width encoder from the definitions file: for it returns the empty list; for it returns the single byte followed by . The statement therefore says that this recursion produces one byte per unit of , regardless of the value being encoded. In particular:
- for the claim is that the empty list has length ;
- for the encoder truncates modulo (the discarded high bits do not add bytes), and the claim is still that exactly bytes come out;
- for the result is zero bytes, of length .
Because , , , are defined as with , and is the reversal of , the statement entails (though it does not itself state) that those encoders produce bytes and that has length . Likewise and are with applied to a reduced natural number, so they would have lengths 8 and 4; again, this is a consequence, not the statement.
What is not said. The theorem says nothing about the content of the bytes: it does not say the value decodes back to (that is the separate statement readLE_leBytes, which carries the hypothesis ), and it does not say what happens to the high bits of an over-large beyond the fact that the length is unaffected. It does not state that , nor anything about , , etc. by name. It does not assert injectivity of on , nor that two different below encode differently. It is purely a length statement for all .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.