AFTD Auto-Formalizing Theoretical Domains

BooleanAnalysis.flipBit_flipBit

theoremverifiedimported Lean

Bit-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 $x$ twice returns the original point: $(x^i)^i = x$.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
set_option maxHeartbeats 400000 in
open scoped BigOperators in
variable {n : ℕ} in
@[simp]
lemma BooleanAnalysis.flipBit_flipBit (x : BoolCube n) (i : Fin n) : flipBit (flipBit x i) i = x
Source
TCSlib, `BooleanAnalysis.flipBit_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
Quot.soundpropext
Built on 3
  • BooleanAnalysis.chiS_singletonValue of a singleton Walsh character. Fix a dimension $n$, a coordinate $i \in [n]$, and a point $x$ of the Boolean hypercube $\{0,1\}^n$.…
  • BooleanAnalysis.flipBitThe point $x^i\in\{0,1\}^n$ obtained from $x$ by flipping the $i$-th coordinate.
  • BooleanAnalysis.BoolCubeThe Boolean hypercube of dimension $n$ is $\{0,1\}^n$, represented as the function type $\mathrm{Fin}\,n \to \mathrm{Bool}$.
Used by 20

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inset_option maxHeartbeats 400000 inopen scoped BigOperators invariable {n : ℕ} in@[simp]lemma BooleanAnalysis.flipBit_flipBit (x : BoolCube n) (i : Fin n) : flipBit (flipBit x i) i = x := by  ext j  simp [flipBit, Function.update]  split_ifs with h  · subst h; simp  · rfl
See it in the graphDiscuss this resultChallenge it