AFTD Auto-Formalizing Theoretical Domains

BooleanAnalysis.boolToSign_sq

theoremverifiedimported Lean

Sign encoding of false. Under the sign encoding $\sigma\colon\mathrm{Bool}\to\{-1,1\}$, the Boolean value $\mathrm{false}$ is sent to $1$; that is, $\sigma(\mathrm{false}) = 1$. Under the sign encoding $\sigma\colon \mathrm{Bool}\to\{-1,1\}$, which sends the truth value false to $1$ and true to $-1$, the truth value true is mapped to $-1$; that is, $\sigma(\text{true}) = -1$. For every Boolean value $b$, the sign encoding satisfies $\sigma(b)^2 = 1$. For every $b \in \mathrm{Bool}$, the sign encoding $\sigma(b) \in \{-1,1\}$ satisfies $\sigma(b)\cdot\sigma(b) = 1$; that is, $\sigma(b)^2 = 1$. Let $\sigma\colon\mathrm{Bool}\to\{-1,1\}$ be the sign encoding, so that $\sigma(\mathrm{false})=1$ and $\sigma(\mathrm{true})=-1$. Then for every Boolean value $b$, negating $b$ flips the sign of its encoding: \[ \sigma(\lnot b) \;=\; -\,\sigma(b). \]

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.boolToSign_sq (b : Bool) : boolToSign b ^ 2 = 1
Source
TCSlib, `BooleanAnalysis.boolToSign_sq`
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
Classical.choiceQuot.soundpropext
Built on 3
Used by 13

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.boolToSign_sq (b : Bool) : boolToSign b ^ 2 = 1 := by  cases b <;> simp [boolToSign]
See it in the graphDiscuss this resultChallenge it