1 Intro
1 Intro
Rajat Mittal
IIT Kanpur
The use and importance of binary numbers is clear to any student of computer science. We represent
data (numbers, images, files) in computers as a string from {0, 1}n . Here, the numbers 0, 1 can have multiple
interpretations:
– as part of a number base 2,
– as encoding of TRUE (1) and False (0), and
– as elements of the field F2 .
Exercise 1. What is the field F2 ?
An operation on these strings can be viewed as a function which takes a string from {0, 1}n to {0, 1} or
a sequence of such functions. A Boolean function takes as an input a string from {0, 1}n and outputs either
a 0 or a 1. Given that we use binary representation to store information in the computer, these functions
and their study has been a central part of theoretical computer science. They are the basic objects of study
in circuit design, complexity theory, logic, cryptography and many more branches of computer science.
The main objective of the course is to introduce you to the analysis of Boolean functions. Through the
course, we will try to answer following questions.
– What tools do we have to study Boolean functions?
– What are the properties of Boolean functions? How are they special ?
– How to measure the complexity of Boolean functions? We will study one of the first and simplest way,
called decision tree complexity.
– What are other mathematical notions of complexity for a Boolean function? How are these measures
related to each other and to decision tree complexity?
We will see techniques to analyze these functions, this is known as Fourier analysis on Boolean hypercube.
The analysis is very natural and interesting on its own; though, we will see applications in different domains.
Later in the course, our focus will be on many complexity measures (combinatorial, computational, algebraic)
which allow us to capture the complexity of these Boolean functions. In this course, we restrict ourselves to
decision tree complexity and measures related to decision tree complexity. The relationship between these
measures will also be studied in this course. Depending on time, we will cover some of the ways in which the
lower bounds on these complexity measures impact computer science.
Through out the course, we will see that Boolean functions are special. They have nice structure and
properties. This makes the study of Boolean functions not just interesting mathematically, but also gives
rise to many applications in computer science. Next section will illustrate a very simple application in the
field of cryptography.
1 Application(s)
In cryptography, one of the main problem studied is to transmit a message under the presence of an adversary,
who can potentially intercept the message. This problem is tackled by encrypting the message at the sender’s
end and then decrypting the message at receiver’s end. The encryption-decryption protocols for this problem
can be broadly divided into two classes: symmetric key encryption and asymmetric key encryption.
– Symmetric key encryption: In this case, the encryption and decryption key are essentially the same (they
are same or related by a simple transformation). One standard example is one time pad where a secret
key is shared between the two parties. One time pad is a simple protocol and relies on the properties of
the Boolean representation. We will look at it in detail below.
– Asymmetric key encryption: Not surprisingly, the encryption and decryption key are different in this
case. They are known as public and private key. The sender encrypts the message using the public key
of the receiver and only the receiver can decrypt the message using her own private key. This is also
known as public-key encryption. The security of such protocols are dependent upon some computational
problem being hard to solve. One example is the famous RSA algorithm. What is the computational
assumption behind RSA algorithm?
The protocol for one time pad will use the Boolean function called XOR. The XOR of two bits x and y,
denoted by x ⊕ y, is 1 if and only if x, y are different. We can generalize this to bitwise XOR, where x, y are
n bit strings and x ⊕ y denotes the n bit string which results from taking XOR at every position separately.
If your answer is not same as 10111110, then please look at the definition of bitwise XOR again.
Let us take a look at the protocol for one time pad. Let us call the two parties Alice and Bob, as is
standard in cryptographic literature. Suppose, Alice wants to transmit a secret message M ∈ {0, 1}n to Bob.
We assume that Alice and Bob share a secret key R ∈ {0, 1}n (symmetric key encryption) between them.
Notice that the key R is obtained/shared by both parties before Alice receives M . That means, R does not
have any relation to M .
Note 1. In general, this need for secret key is a major weakness of symmetric key encryption. We will talk
about it later. At this point, let us assume its existence.
The protocol is very simple, Alice encodes the message into a code C by the operation C = M ⊕ R (here
⊕ denotes bitwise XOR). The decoding is straightforward too, M = C ⊕ R.
We need to show that this protocol is secure. What about an adversary who can intercept the commu-
nication between Alice and Bob? Can we say that adversary does not get any information about M from C
(given that it has no information about R)?
Adversary has access to all the bits of the codeword C, say the i-th bit is ci . We know that ci = mi ⊕ ri
(let mi , ri be i-th bits of M, R respectively).
Exercise 4. Suppose mi = 1, what is the probability that ci = 1? What about the other combinations?
From the above exercise, bit ci has equal probability of being 0 or 1 irrespective of mi being 0 or 1.
In other words, the bits ci = mi ⊕ ri are completely random, and provide no information about mi . This
shows that the one time pad protocol is unconditionally secure. It does not depend on any computational
assumption. It only relies on the fact that the bitwise XOR completely shuffles the codeword, irrespective of
the initial message.
Exercise 5. Suppose the message M ∈ {0, 1}n is 000 · · · 0, what is the probability that the codeword sent is
111 · · · 1?
Unfortunately, the demand of having a secret key is big issue with this kind of encryption. This is the
reason that many of the current cryptographic protocols use asymmetric key cryptography. Though, we
also know that factoring can be solved in polynomial time on a quantum computer. This will result in the
breakdown of many asymmetric key encryptions if a quantum computer (of decent size) comes into picture.
One option is to go back to symmetric key encryption. Fortunately, there exist a quantum protocol to
generate a secret key between the two parties. This protocol was given by Bennett and Brassard, and is
known as BB84 quantum key distribution protocol.
2
This was indeed a very simple example. We will see in this course that Boolean functions provide a very
useful framework to capture and manipulate information. We have already seen an example in cryptography.
We use Boolean functions to represent operations in circuits and Logic. A graph (in graph theory) can be
represented as a binary string of length n2 , where n is the number of vertices. The properties of graphs
(connectedness, existence of perfect matching, bipartite-ness etc.) can be viewed as a Boolean function. As
mentioned before, the complexity of these functions play a central role in complexity theory. These functions
can also be used to represent voting rules in social choice theory.
To understand these different fields, where information is represented by these functions, it is important to
understand the structure and properties of Boolean functions. On the other hand, these properties/structure
gives rise to many applications. The main objective of this course is to make you familiar with these special
objects.
2 Boolean functions
We start by defining the Boolean function formally.
Definition 1. A Boolean function is a function f from domain {0, 1}n to range {0, 1}. The number n
(number of inputs) is also called the arity of the function. The most natural way to represent it is in terms
of a truth table, where we explicitly write down the value of the function on all 2n possible inputs.
To take an example, let us take a function on {0, 1}2 which output 1 if and only if both inputs are 1.
You might know it already, it is the AND function. The truth table for this function will be,
Input 1 Input 2 Answer
0 0 0
0 1 0
1 0 0
1 1 1
You might have seen other Boolean functions like OR, majority and parity. If not, we will define them later
in this section. You might have seen them defined on a different domain, having a different representation.
Exercise 7. What is the number of distinct Boolean functions with arity n?
Notice that the representation in terms of a string of 0 and 1 is not unique; many a times 1 and −1 are
used to represent and analyse Boolean functions. These representations are similar, most of the time we can
move from one representation to another with some simple and natural transformations.
Exercise 8. When we generally switch from {0, 1} to {−1, 1} representation, 0 is mapped to 1 and 1 is
mapped to −1. Can you think of a reason? (Hint: Group theory)
For n variables, let us keep the domain of our functions to be {0, 1}n for now. A general element of this
domain (an input for a Boolean function) will mostly be denoted by lower case alphabets (x, y or z). With
such a representation, we will use xi to denote the i-th “co-ordinate” (position) of the input/element x.
One of the important concept for this Boolean domain is known as Hamming distance. For two strings
x, y ∈ {0, 1}n , the Hamming distance between them is defined to be the number of places where they differ.
The Hamming weight of a string x is the number of 1’s in the string. In {−1, 1} representation, it becomes
the number of −1’s.
The Boolean domain, {0, 1}n , with edges connecting elements at Hamming distance 1 is called the Boolean
hypercube. (It is called Hamming cube too.)
Using the definition of Hamming weight, we can generalize the definition of AND function. Function
AND : {0, 1}n → {0, 1} is defined to be 1 if and only if the Hamming weight of the input is n.
In general, a Boolean function needs an n to be specified before it is defined. Though, most of the time,
we will be interested in functions which can be generalized to any n, like the case of AND function. In such
a situation, the function name (say AND) will refer to the set of these functions for all n. By the complexity
of these kind of functions, we would mean the asymptotic complexity of these functions in terms of n.
3
2.1 Representations of Boolean functions
We have seen the truth table representation of a Boolean function. If the ordering of inputs is fixed, the
Boolean function can be thought of as a list of length 2n . Depending on the situation, this list can be taken
as a vector with real elements or a vector with elements in F2 .
Similar to AND function, we can define OR, it is 0 if and only if the Hamming weight is 0. Considering
the OR function for two bits, and taking the order of inputs to be 00, 01, 10, 11, the vector corresponding to
it is,
0
1
1
1
Notice the difference between OR function and the usual English meaning of the term or. The function
corresponding to the English term is the XOR of two bits.
We will denote the negation of a string by x̄,
∀i : xi = 1 − x̄i .
Another similar representation would be to just list the 1 inputs of a function, e.g., AND will be repre-
sented by 111 · · · 1.
You might already be familiar with the notation used in logic, AND(x1 , x2 , · · · , xn ) is denoted by x1 ∧
x2 · · · ∧ xn and OR(x1 , x2 , · · · , xn ) is denoted by x1 ∨ x2 · · · ∨ xn . Every Boolean function can be written
as an OR of AND, this is called the DNF (disjunctive normal form) representation. You will show in the
exercise that every Boolean function can be written in the DNF representation.
You can also represent Boolean functions as polynomials (over reals and F2 ). We will study this repre-
sentation in detail later.
Notice that the truth table representation and the vector representation always required around 2n size.
On the other hand, list, DNF and polynomial representation might be quite short for some functions.
Exercise 10. Show that any representation of a Boolean function will require 2n size in the worst case.
The size of a particular representation for a function in itself is a measure of its complexity. We will study
some of these measures later.
Even though we have listed many representations, the most convenient one is the description of a function
in natural language. For example, MAJORITY function outputs 1 if the number of 0’s are smaller than
number of 1’s in the input. You might be worried about the case when number of 0’s is same as number of
1’s. Since we are mostly interested in asymptotic complexity, this question can be ignored.
Exercise 11. Suppose n is odd, what is the number of inputs which output 1 for MAJORITY?
Another interesting function is called PARITY, it is 1 if the number of 1’s in the input are odd. PARITY
generalizes the It has a very simple representation as a polynomial in the {−1, 1} world,
PARITY(x) = x1 x2 · · · xn .
Note 2. In this case, function will be −1 if the number of −1’s in the input are odd.
Have you already seen a function like parity, what about n = 2? Let us see a lower bound on the size of
a representation for the parity function.
Exercise 12. What will be the minimum number of clauses needed to represent PARITY in DNF represen-
tation?
4
We will show that at least 2n−1 clauses are needed. The proof requires two claims:
– Any clause in the representation of PARITY will require all n variables. Assume that there are only n − 1
variables in the clause (say xn is not present). Then there is an assignment of x1 , x2 , · · · , xn−1 such that
the function value is 1 irrespective of the value of xn . This is a contradiction, because you can always
set xn in a different way to get different function value.
– A clause with n variable can only cover one true assignment.
Exercise 13. Prove this.
It is an easy exercise to finish the proof using the two claims (parity has 2n−1 true assignments).
This was a toy example, where we gave a lower bound on a certain complexity measure (size of DNF).
We will see many such lower bounds throughout this course.
Hamming weight
n-1 inputs
Hamming weight
n/2 inputs
Hamming weight
1 inputs
Fig. 1. A graphical representation of Boolean hypercube. Two vertices are joined iff they are at Hamming distance
1.
The class of symmetric functions is not just important because many interesting functions belong to it,
but also because it is arguably much simpler to study. We will see that many of the complexity measures
are easier to figure out in case of symmetric functions.
5
Given the discussion up to this point, you might be tempted to believe that all interesting functions are
symmetric. Let us introduce a very natural non-symmetric function, called addressing function.
For a parameter m, the function ADDRm is defined on an input of size n = m + 2m . The first m bits
should be considered as an address, hence the name, out of 2m positions. The output of the function is the
value of the position (out of last 2m bits) referred by the address.
Exercise 15. Say m = 2, what is the value of ADDR(101001)? (assume the lexicographic ordering of ad-
dresses)
Notice that all subsets (on which g is applied) are disjoint and have the same size. Sometimes we will
denote the composition as fm ◦ gn to clarify that f is function with arity m and g with n.
A standard example of composition is called tribes. It is defined as OR ◦ AND. You can think of it as
inputs divided into tribes (over which AND is taken). Then tribes can be thought of as a voting scheme
where the object is chosen if and only if one tribe unanimously selects the object.
3 Assignment
Exercise 17. Read about the DNF and CNF representation. Show that every function can be written as a
DNF with at most 2n terms (using truth table).
Exercise 19. Construct two inputs to show that ADD is not symmetric.
Exercise 20. Construct two inputs to show that tribes is not symmetric.
Exercise 21. Read about group theory and characters of finite Abelian groups.
References