relu_encode_rat
def
Encoding of a rational in lowest terms as a Bool word: its numerator and denominator in binary.
Statement
def relu_encode_rat (q : ℚ) : List Bool- Source
- Helper encoding serving OP-75 (arXiv:2610.06092, Remark 5.15). Section 2.1 of the paper writes rational entries as pairs of integers in binary; the bit-level layout is a choice made here.
- Verified
- 09 Nov 2026
- Axioms
- none listed
- Built on 2
- 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…
- Used by 7
- op75_final_encoding_templateThe final target layer encoding is a fixed prefix followed by the negative and positive target coefficient encodings.
- relu_encode_vec3Encoding of a rational vector of length 3 as the concatenation of the encodings of its three entries.
- op75_block_encoding_templateThe seven-layer block encoding is a fixed prefix, the positive coefficient encoding, a fixed middle, the negative coefficient encoding,…
- relu_network3_encode_injectiveSanity check of the encoding: distinct width-3 ReLU networks have distinct Bool encodings.
- op75_negative_rat_bit_encodingThe encoding of the negative of a nonnegative integer has sign bit set exactly when that integer is nonzero, followed by its canonical…
- relu_network3_encodeEncoding of a width-3 ReLU network as a Bool word, of length linear in the total bit length of its rational entries: input weights, input…
- op75_positive_rat_bit_encodingThe encoding of a nonnegative integer as a rational is its nonnegative sign bit, canonical natural encoding, and denominator-one encoding.
Lean source view module on GitHub
def relu_encode_rat (q : ℚ) : List Bool :=
relu_encode_int q.num ++ relu_encode_nat q.den