AFTD Auto-Formalizing Theoretical Domains

op75_positive_rat_bit_encoding

theoremverified

The encoding of a nonnegative integer as a rational is its nonnegative sign bit, canonical natural encoding, and denominator-one encoding.

Statement

theorem op75_positive_rat_bit_encoding (a : ℕ) :
    relu_encode_rat (a : ℚ) = false :: relu_encode_nat a ++ relu_encode_nat 1
Source
OP-75: fixed binary output fragments for the subset-sum to width-three ReLU compiler.
Verified
15 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • relu_encode_ratEncoding of a rational in lowest terms as a Bool word: its numerator and denominator in binary.
  • relu_encode_intEncoding of an integer as a Bool word: a sign bit followed by the binary encoding of its absolute value.
  • relu_encode_natBinary encoding of a natural number as a self-delimiting Bool word: each base-2 digit, least significant first, is preceded by a true…

Lean source view module on GitHub

theorem op75_positive_rat_bit_encoding (a : ℕ) :
    relu_encode_rat (a : ℚ) = false :: relu_encode_nat a ++ relu_encode_nat 1 := by
  have ha : ¬ ((a : ℤ) < 0) := by omega
  simp [relu_encode_rat, relu_encode_int, ha]
See it in the graphDiscuss this resultChallenge it