Skip to content

feat(Foundations/Combinatorics/BooleanFunctions): Fourier expansion, Plancherel, and Parseval#596

Open
SamuelSchlesinger wants to merge 1 commit into
leanprover:mainfrom
SamuelSchlesinger:samuelschlesinger/analysis-of-boolean-functions
Open

feat(Foundations/Combinatorics/BooleanFunctions): Fourier expansion, Plancherel, and Parseval#596
SamuelSchlesinger wants to merge 1 commit into
leanprover:mainfrom
SamuelSchlesinger:samuelschlesinger/analysis-of-boolean-functions

Conversation

@SamuelSchlesinger
Copy link
Copy Markdown
Contributor

Formalizes Chapter 1 of O'Donnell's "Analysis of Boolean Functions" through Plancherel and Parseval.

Defines HammingCube n = Fin n → ZMod 2 and the space BooleanFunction n of real-valued functions on the cube, carrying the uniform-measure L² inner product ⟪f, g⟫ = 𝔼[f·g] as an InnerProductSpace ℝ.

Defines the parity functions χ S and Fourier coefficients 𝓕 f S = ⟪f, χ S⟫, then proves the Fourier expansion theorem (Theorem 1.1, existence and uniqueness) and orthonormality of the parity functions (Theorem 1.5). Plancherel and Parseval follow from packaging the parity functions as an OrthonormalBasis and applying Mathlib's sum_inner_mul_inner.

Ported from my SamuelSchlesinger/analysis-of-boolean-functions repo. The rest of Chapter 1 from that repository is left for a follow-up, this first PR felt rightsized.

Claude Code (with Opus 4.7 xHigh) was used as a coding assistant in the original repository, and in the port as well.

…Plancherel, and Parseval

Formalize Chapter 1 of O'Donnell's "Analysis of Boolean Functions"
through Plancherel and Parseval.

Sets up `HammingCube n = Fin n → ZMod 2` and the space
`BooleanFunction n` of real-valued functions on the cube, carrying the
uniform-measure L² inner product `⟪f, g⟫ = 𝔼[f·g]` as an
`InnerProductSpace ℝ`. `BooleanFunction` is a `def` (not `abbrev`) to
keep typeclass resolution from seeing through to the Pi-type sup norm.

Defines the parity functions `χ S` and Fourier coefficients
`𝓕 f S = ⟪f, χ S⟫`, then proves the Fourier expansion theorem
(Theorem 1.1, existence and uniqueness) and orthonormality of the
parity functions (Theorem 1.5). Plancherel and Parseval follow from
packaging the parity functions as an `OrthonormalBasis` and applying
Mathlib's `sum_inner_mul_inner`.

Ported from the standalone `SamuelSchlesinger/analysis-of-boolean-functions`
repo; downstream content (variance, convolution, BLR, density theorems)
is left for follow-up.
Copy link
Copy Markdown
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small questions about definitions before I look closer at the proofs that follow.

theorem ext {f g : BooleanFunction n} (h : ∀ x, f x = g x) : f = g :=
DFunLike.ext f g h

@[simp] theorem zero_apply (x : HammingCube n) : (0 : BooleanFunction n) x = 0 := rfl
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new way to get these kind of theorems is via the classes added in leanprover-community/mathlib4#37779. I've just merged a Mathlib bump so that you can try this out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh neat, thanks for pointing it out.

/-! ### The Hamming cube and the space of Boolean functions -/

/-- The Hamming cube `𝔽₂ⁿ`, modelled as `Fin n → ZMod 2`. -/
abbrev HammingCube (n : ℕ) := Fin n → ZMod 2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why this representation is the most convenient? Both for my own understanding reviewing and the sake of documentation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another natural representation would be Fin n -> Bool, which I initially used in my first draft. However, the book uses F_2 and the additive group structure on F_2 is the right one to be thinking about when we think about parities, etc. Thus, you end up translating back and forth anyways.

Further, when you get to the later chapters, we begin to generalize to arbitrary characters of abelian groups, so starting there is more illustrative for when we go to lift some of these definitions and theorems to characters of arbitrary Abelian groups.

@SamuelSchlesinger
Copy link
Copy Markdown
Contributor Author

A couple of small questions about definitions before I look closer at the proofs that follow.

Responded! My one thought is that as a definition in the standalone formalization, HammingCube using F_2 makes sense, but perhaps in CSLib we want HammingCube to use Bool, define it in a more general place, and eat the translation costs here.

@SamuelSchlesinger
Copy link
Copy Markdown
Contributor Author

SamuelSchlesinger commented May 24, 2026

I'm realizing now that a lot of this stuff is in Mathlib under names I didn't know to look for, already in the arbitrary Abelian group generality. I think it would still be nice to have the O'Donnell interface, but maybe re-deriving it from the Mathlib work is a better approach.

Going to make a PR targeting this one in my personal repo to try and understand how much better that ends up being.

Edit: didn't end up helping, maybe a bridge to AddChar would be useful for folks downstream though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants