AFTD Auto-Formalizing Theoretical Domains

BoolBLR.is_linear_bool

defimported Lean

A function $f : \{0,1\}^n \to \{0,1\}$ is linear if for all $x, y \in \{0,1\}^n$ we have \[ f(x \oplus y) = f(x) \oplus f(y), \] where $\oplus$ denotes bitwise XOR (i.e.\ Bool.xor).

Statement

open Finset BoolFourier in
def BoolBLR.is_linear_bool {n : ℕ} (f : hypercube n → Bool) : Prop
Defined in
TCSlib, `BoolBLR.is_linear_bool`
Lean proof
By Prastik Mohanraj, from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Copyright (c) 2026 Prastik Mohanraj. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Built on 2
  • BoolFourier.xor_vecFor $x, y \in \{0,1\}^n$, the vector $\mathrm{xor\_vec}(x,y)_i = x_i \oplus y_i$ is the componentwise XOR, giving the group operation on…
  • BoolFourier.hypercubeThe Boolean hypercube of dimension $n$ is the type $\{0,1\}^n$, defined as an abbreviation for BooleanAnalysis.BoolCube $n$.
Used by 8

Lean source view module on GitHub

open Finset BoolFourier in
/-- Defines a Boolean linear function by preservation of pointwise XOR. **Source:** [OD14, §1.6]. -/
def BoolBLR.is_linear_bool {n : ℕ} (f : hypercube n → Bool) : Prop :=
  ∀ x y, f (xor_vec x y) = Bool.xor (f x) (f y)
See it in the graphDiscuss this resultChallenge it