AFTD Auto-Formalizing Theoretical Domains

low_half_mul3_bit

def

The function taking index k : Fin 3 and vector v : Fin 6 → ZMod 2 and returning the element of ZMod 2 obtained by computing the product (a * b) % 8 where a = (v 0).val + 2 * (v 1).val + 4 * (v 2).val and b = (v 3).val + 2 * (v 4).val + 4 * (v 5).val, taking the k-th bit (prod / 2 ^ k.val) % 2, and coercing to ZMod 2.

Statement

def low_half_mul3_bit (k : Fin 3) (v : Fin 6 → ZMod 2) : ZMod 2
Defined in
arXiv:2611.15992 Section 1
Verified
16 Nov 2026
Axioms
none listed
Used by 1

Read back from the Lean

low_half_mul3_bit is a definition taking an index $k \in \{0, 1, 2\}$ (k : Fin 3) and a 6-bit input vector $v : \mathrm{Fin}\ 6 \to \mathbb{Z}/2\mathbb{Z}$, and returning an element of $\mathbb{Z}/2\mathbb{Z}$. It interprets the first three bits of $v$ as a 3-bit unsigned integer $a = v(0) + 2 v(1) + 4 v(2)$ (using the integer representative in $\{0, 1\}$ of each element in $\mathbb{Z}/2\mathbb{Z}$) and the next three bits as a 3-bit unsigned integer $b = v(3) + 2 v(4) + 4 v(5)$. It then computes the product modulo 8, namely $\mathrm{prod} = (a \cdot b) \bmod 8$, extracts its $k$-th bit $\lfloor \mathrm{prod} / 2^k \rfloor \bmod 2$, and returns this bit coerced to $\mathbb{Z}/2\mathbb{Z}$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The k-th bit in ZMod 2 of the 3-bit low-half integer multiplication modulo 8. -/
def low_half_mul3_bit (k : Fin 3) (v : Fin 6 → ZMod 2) : ZMod 2 :=
  let a := (v 0).val + 2 * (v 1).val + 4 * (v 2).val
  let b := (v 3).val + 2 * (v 4).val + 4 * (v 5).val
  let prod := (a * b) % 8
  ((prod / 2 ^ k.val) % 2 : ℕ)
See it in the graphDiscuss this resultChallenge it