BoolFourier.BoolToPM1_xor
theoremverifiedimported Lean
XOR as multiplication under the $\pm 1$ embedding. Let $\mathrm{BoolToPM1} : \mathrm{Bool} \to \bbr$ be the map sending $\mathtt{false}$ to $1$ and $\mathtt{true}$ to $-1$. Then for all Booleans $a$ and $b$, \[ \mathrm{BoolToPM1}(a \oplus b) = \mathrm{BoolToPM1}(a)\cdot\mathrm{BoolToPM1}(b), \] so the exclusive-or $a \oplus b$ is carried to the ordinary product in $\{-1,1\}\subset\bbr$.
Statement
set_option relaxedAutoImplicit false in set_option autoImplicit false in open Finset BooleanAnalysis in lemma BoolFourier.BoolToPM1_xor (a b : Bool) : BoolToPM1 (Bool.xor a b) = BoolToPM1 a * BoolToPM1 b
- Source
- TCSlib, `BoolFourier.BoolToPM1_xor`
- 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.BoolFourier.BoolToPM1_xor← BoolFourier.BoolToPM1_xor (TCSlib/BooleanAnalysis/BLR/BoolFourier.lean:106): verbatim
- Verified
- 07 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- BooleanAnalysis.boolToSignThe sign encoding maps $\mathrm{Bool}$ to $\{-1,1\}\subset\bbr$:…
- BoolFourier.BoolToPM1The map $\mathrm{BoolToPM1} : \mathrm{Bool} \to \mathbb{R}$ sends $\mathtt{false}$ to $1$ and $\mathtt{true}$ to $-1$, realising the…
- Used by 3
- BoolBLR.BLR_completeness_aux_h_lift_linearMultiplicativity of the sign lift of an XOR-homomorphism. Let $f : \{0,1\}^n \to \{0,1\}$ be a function that respects componentwise XOR,…
- BoolBLR.linear_bool_iff_character_aux_h_charMultiplicativity of the Walsh characters. Fix $n$ and a subset $S \subseteq [n]$, and let $\chi_S(x) = \prod_{i \in S}(-1)^{x_i}$ be the…
- BoolBLR.linear_bool_iff_character_aux_h_eqXOR-additivity of a Boolean function whose lift is a character. Let $f : \{0,1\}^n \to \{0,1\}$ be a Boolean-valued function whose $\pm 1$…
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option relaxedAutoImplicit false inset_option autoImplicit false inopen Finset BooleanAnalysis in/-- Shows that the `{±1}` encoding converts XOR into multiplication. **Source:** [OD14, §1.3]. -/lemma BoolFourier.BoolToPM1_xor (a b : Bool) : BoolToPM1 (Bool.xor a b) = BoolToPM1 a * BoolToPM1 b := by cases a <;> cases b <;> simp [BoolToPM1, boolToSign, Bool.xor]