AFTD Auto-Formalizing Theoretical Domains

BooleanAnalysis.flipBit

defimported Lean

The point $x^i\in\{0,1\}^n$ obtained from $x$ by flipping the $i$-th coordinate.

Statement

set_option maxHeartbeats 400000 in
open scoped BigOperators in
variable {n : ℕ} in
def BooleanAnalysis.flipBit (x : BoolCube n) (i : Fin n) : BoolCube n
Defined in
TCSlib, `BooleanAnalysis.flipBit`
Lean proof
By Jingzhen Sha, Allan Li, Hydroxyi, Mina, Owen McGinty (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (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 1
  • BooleanAnalysis.BoolCubeThe Boolean hypercube of dimension $n$ is $\{0,1\}^n$, represented as the function type $\mathrm{Fin}\,n \to \mathrm{Bool}$.
Used by 4
  • BooleanAnalysis.chiS_flipBitWalsh character under a single bit flip. Fix a subset $S\subseteq[n]$ of coordinates. For every point $x$ of the Boolean hypercube…
  • BooleanAnalysis.influenceThe influence of coordinate $i$ on $f$ measures how often flipping bit $i$ changes the output:…
  • BooleanAnalysis.influence_eq_sum_fourierInfluence via Fourier coefficients. Let $f:\{0,1\}^n\to\bbr$ be a Boolean function and fix a coordinate $i\in[n]$. Then the influence of…
  • BooleanAnalysis.flipBit_flipBitBit-flip is an involution. For a point $x$ in the Boolean hypercube $\{0,1\}^n$ and a coordinate $i$, flipping the $i$-th coordinate of…

Lean source view module on GitHub

set_option maxHeartbeats 400000 in
open scoped BigOperators in
variable {n : ℕ} in
/-- Flip the `i`-th bit of `x : {0,1}ⁿ`. -/
def BooleanAnalysis.flipBit (x : BoolCube n) (i : Fin n) : BoolCube n :=
  Function.update x i (!x i)
See it in the graphDiscuss this resultChallenge it