Skip to content

feat(Complexity): Query Complexity of Boolean Functions (aka Decision… - #923

Open
Lsonic233 wants to merge 4 commits into
leanprover:mainfrom
Lsonic233:query-complexity-measures
Open

Lsonic233 wants to merge 4 commits into
leanprover:mainfrom
Lsonic233:query-complexity-measures

Conversation

@Lsonic233

@Lsonic233 Lsonic233 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Defines three Boolean function complexity measures : sensitivity s(f), block sensitivity bs(f) and certificate complexity C(f) with the inequality chain : s(f) ≤ bs(f) ≤ C(f).

  • Defs.lean sets up the boolean hypercube and boolean functions which is defined as a function from {0,1}^n to {0,1}.
  • Measures.lean defines the above three measures and proves the inequality chain.
  • Deterministic Decision Trees and D(f) : the decision tree complexity of boolean function f will follow in a second PR.

AI usage : Used claude to help me fill in proofs in a few places and refactor my handwritten proofs.

… Tree Complexity). Defines sensitivity, block sensitivity and certificate complexity.
Comment thread references.bib Outdated
abbrev Cube (n : ℕ) : Type := Fin n → Bool

/-- `f : {0,1}ⁿ → {0,1}`. -/
abbrev BoolFunc (n : ℕ) : Type := Cube n → Bool

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 mean it's kind of trivial but maybe you should sync some of the definitions here with #890 ?


## Main definitions

- `Cube n`: bit strings of length `n`, i.e. `Fin n → Bool`.

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.

Do you have a reference for naming this object Cube? Wouldn't "Assignment" be easier to understand?

@Lsonic233 Lsonic233 Sep 18, 2026

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.

Cube is short for the boolean hypercube (or hamming cube) which views {0,1}^n as vertices of a graph such that two strings are connected by an edge if their hamming distance is 1. Analysis of Boolean Functions by O'Donnell also calls it that.
If you prefer not to have Cube, then would something like "Input" or "BooleanInput" be better than "Assignment"?
"Assignment" is the term used for partial assignments in the survey by BuhrmanDeWolf. See the section Certificate Complexity.

- `BoolFunc n`: Boolean functions `Cube n → Bool`.
- `Block n`: a set of coordinates.
- `flipBit`, `flipBlock`: flipping one coordinate, or every coordinate of a block.
- `Assignment n`: a partial assignment, fixing some coordinates and leaving others free.

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.

If you rename Cube to Assignment, then this could be PartialAssignment (and also could be in general)

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.

My bad, my main reference and the place I studied this topic from is the Buhrman and de Wolf survey so most of my naming choices match that rather than Arora-Barak. I've addressed this in my previous comment.

/-- `f : {0,1}ⁿ → {0,1}`. -/
abbrev BoolFunc (n : ℕ) : Type := Cube n → Bool

/-- A block: a set of coordinates. -/

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.

Sorry that I have so many remarks about terminology and please push back, but Arora-Bark talks about "bit position". I know it makes sense when talking about hypercubes and so on, but currently, "index" would be equally valid and understandable, right?

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.

I agree, "index" and "coordinate" are interchangeable. I'd keep "coordinate" because thats what most of the definitions about blocks use in the file.

Comment thread Cslib/Computability/QueryComplexity/Measures.lean Outdated
Comment thread Cslib/Computability/QueryComplexity/Measures.lean Outdated
Comment thread Cslib/Computability/QueryComplexity/Defs.lean Outdated
Comment thread Cslib/Computability/QueryComplexity/Measures.lean Outdated
∀ P ∈ F, ∀ Q ∈ F, P ≠ Q → Disjoint P Q) Iff.rfl

/-- All sensitive families. -/
def sensitiveFamilies (f : BoolFunc n) (x : Cube n) : Finset (Finset (Block n)) :=

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.

Do we really need this definition?

@crei

crei commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Sorry for the many comments! In general, this is a good contribution, it just has so many definitions :)
Feel free to push back and we can also talk about in the chat or in a call.
Another final comment: Shouldn't this be "CommunicationComplexity" instead of "QueryComplexity"?

@Lsonic233

Copy link
Copy Markdown
Contributor Author

Sorry for the many comments! In general, this is a good contribution, it just has so many definitions :) Feel free to push back and we can also talk about in the chat or in a call. Another final comment: Shouldn't this be "CommunicationComplexity" instead of "QueryComplexity"?

Sure, I'll send you a zulip dm and make a thread about this topic in a bit.
"Communication Complexity" refers to a completely different model of computation where two parties (where the inputs are distributed between them ) try to compute a boolean function by communicating bits of info.
"Query Complexity" or Decision Tree Complexity is the boolean decision tree model of computation (I have a second PR ready defining boolean decision trees and the decision tree complexity D(f) and proving that C(f) <= D(f)).

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