ArticleslgStudy

computer science

Piling-up lemma

Piling-up lemma is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Piling-up lemma rather than just read about it. In short: In cryptanalysis, the piling-up lemma is a principle used in linear cryptanalysis to construct linear approximations to the action of block ciphers. It was introduced by Mitsuru Matsui (1993) as an analytical tool for linear cryptanalysis.

Key takeaways

  • Piling-up lemma belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Piling-up lemma to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Piling-up lemma from memory before moving on to harder problems.

Reference excerpt

In cryptanalysis, the piling-up lemma is a principle used in linear cryptanalysis to construct linear approximations to the action of block ciphers. It was introduced by Mitsuru Matsui (1993) as an analytical tool for linear cryptanalysis. The lemma states that the bias (deviation of the expected value from 1/2) of a linear Boolean function (XOR-clause) of independent binary random variables is related to the product of the input biases:

ε(X1⊕X2⊕⋯⊕Xn)=2n−1∏i=1nε(Xi) or

I(X1⊕X2⊕⋯⊕Xn)=∏i=1nI(Xi) where ε∈[−12,12] is the bias (towards zero) and I∈[−1,1] the imbalance:

ε(X)=P(X=0)−12 I(X)=P(X=0)−P(X=1)=2ε(X). Conversely, if the lemma does not hold, then the input variables are not independent.

Interpretation The lemma implies that XOR-ing independent binary variables always reduces the bias (or at least does not increase it); moreover, the output is unbiased if and only if there is at least one unbiased input variable. Note that for two variables the quantity I(X⊕Y) is a correlation measure of X and ⁠Y⁠, equal to ⁠P(X=Y)−P(X≠Y)⁠; I(X) can be interpreted as the correlation of X with ⁠0⁠.

Expected value formulation The piling-up lemma can be expressed more naturally when the random variables take values in ⁠{−1,1}⁠. If we introduce variables χi=1−2Xi=(−1)Xi (mapping ⁠0⁠ to ⁠1⁠ and ⁠1⁠ to ⁠−1⁠) then, by inspection, the XOR-operation transforms to a product:

χ1χ2⋯χn=1−2(X1⊕X2⊕⋯⊕Xn)=(−1)X1⊕X2⊕⋯⊕Xn and since the expected values are the imbalances, ⁠E(χi)=I(Xi)⁠, the lemma then states:

E(∏i=1nχi)=∏i=1nE(χi), which is a known property of the expected value for independent variables. For dependent variables the above formulation gains a (positive or negative) covariance term, thus the lemma does not hold. In fact, since two Bernoulli variables are independent if and only if they are uncorrelated (i.e. have zero covariance; see uncorrelatedness), we have the converse of the piling up lemma: if it does not hold, the variables are not independent (uncorrelated).

Boolean derivation The piling-up lemma allows the cryptanalyst to determine the probability that the equality:

X1⊕X2⊕⋯⊕Xn=0 holds, where the ⁠X⁠s are binary variables (that is, bits: either ⁠0⁠ or ⁠1⁠). Let ⁠P(A)⁠ denote "the probability that ⁠A⁠ is true". If it equals one, ⁠A⁠ is certain to happen, and if it equals zero, ⁠A⁠ cannot happen. First of all, we consider the piling-up lemma for two binary variables, where P(X1=0)=p1 and ⁠P(X2=0)=p2⁠. Now, we consider:

P(X1⊕X2=0). Due to the properties of the xor operation, this is equivalent to

P(X1=X2). ⁠X1=X2=0⁠ and ⁠X1=X2=1⁠ are mutually exclusive events, so we can say

P(X1=X2)=P(X1=X2=0)+P(X1=X2=1)=P(X1=0,X2=0)+P(X1=1,X2=1). Now, we must make the central assumption of the piling-up lemma: the binary variables we are dealing with are independent; that is, the state of one has no effect on the state of any of the others. Thus we can expand the probability function as follows:

Now we express the probabilities ⁠p1⁠ and ⁠p2⁠ as ⁠12+ε1⁠ and ⁠12+ε2⁠, where the ⁠ε⁠s are the probability biases – the amount the probability deviates from ⁠12⁠.

Thus the probability bias ⁠ε1,2⁠ for the XOR sum above is ⁠2ε1ε2⁠. This formula can be extended to more ⁠X⁠s as follows:

P(X1⊕X2⊕⋯⊕Xn=0)=1/2+2n−1∏i=1nεi Note that if any of the ⁠ε⁠s is zero; that is, one of the binary variables is unbiased, the entire probability function will be unbiased – equal to ⁠12⁠. A related slightly different definition of the bias is ⁠εi=P(Xi=1)−P(Xi=0)⁠, in fact minus twice the previous value. The advantage is that now with

εtotal=P(X1⊕X2⊕⋯⊕Xn=1)−P(X1⊕X2⊕⋯⊕Xn=0) we have

εtotal=(−1)n+1∏i=1nεi, adding random variables amounts to multiplying their (2nd definition) biases.

Practice In practice, the ⁠X⁠s are approximations to the S-boxes (substitution components) of block ciphers. Typically, ⁠X⁠ values are inputs to the S-box and ⁠Y⁠ values are the corresponding outputs. By simply looking at the S-boxes, the cryptanalyst can tell what the probability biases are. The trick is to find combinations of input and output values that have probabilities of zero or one. The closer the approximation is to zero or one, the more helpful the approximation is in linear cryptanalysis. However, in practice, the binary variables are not independent, as is assumed in the derivation of the piling-up lemma. This consideration has to be kept in mind when applying the lemma; it is not an automatic cryptanalysis formula.

See also Variance § Properties – Variance of a sum of independent real variables

References

Worked examples

Example 1 — a first encounter with Piling-up lemma

Start with the simplest possible case. Write down what Piling-up lemma claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Piling-up lemma before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Piling-up lemma ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Piling-up lemma

In research
Piling-up lemma appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Piling-up lemma in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Piling-up lemma is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cryptographic attacks, Lemmas, so understanding it makes those chapters shorter.
In everyday life
Look for Piling-up lemma outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Piling-up lemma” →

How to study Piling-up lemma in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Piling-up lemma means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Piling-up lemma out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Piling-up lemma in simple terms?

In cryptanalysis, the piling-up lemma is a principle used in linear cryptanalysis to construct linear approximations to the action of block ciphers. It was introduced by Mitsuru Matsui (1993) as an analytical tool for linear cryptanalysis.

Why does Piling-up lemma matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Piling-up lemma?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Piling-up lemma.

Tags

  • Cryptographic attacks
  • Lemmas

Keep exploring