AFTD Auto-Formalizing Theoretical Domains

binary_digit_sum

def

The sum of the digits in the binary representation of a natural number k.

Statement

def binary_digit_sum (k : ℕ) : ℕ
Defined in
arXiv:2611.26953, Section 1.1
Verified
23 Nov 2026
Axioms
none listed
Used by 2

Read back from the Lean

binary_digit_sum is defined as a function taking a natural number k and returning the sum of the digits in the base-$2$ (binary) representation of k (computed as (Nat.digits 2 k).sum).

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 sum of the binary digits of a natural number. -/
def binary_digit_sum (k : ℕ) : ℕ := (Nat.digits 2 k).sum
See it in the graphDiscuss this resultChallenge it