Mathematical Background on Lattices - A Deep Dive on Lattice-Based Cryptography
Table of Contents
This is the first post in the series: A Deep Dive on Lattice-Based Cryptography. We focus on lattices as an independent mathematical concept and its properties. However, we focus on aspects that would be useful in the study of Lattice-based Cryptography.
Throughout this series, we use 2-dimensions and 3-dimensions because they are easy to work with. In practice we use sufficiently higher dimensions.
The only prequisite to start this series is to understand the following:
- represents the set of all real numbers.
- represents the set of all integers.
- represents the set of all rational numbers.
- represents the set of all n-dimensional real vectors
- represents the set of all n-dimensional integer vectors
What is a Lattice?
A Lattice is an infinite set of vectors constructed based two condition: discreteness and additivity.
Formally, an -dimensional lattice is a discrete additive subgroup of generated by a basis as an integer linear combination:
where is an arbitrary integer
- discrete: This means that every vector point has some “neighborhood” in which is the only lattice point. Loosely speaking, this means that, for every point there is “good space” around it. By using an integer linear combination and not just linear combination we have achieve reasonable discreteness between vector points. This is shown below using rationals as a counter example.
- additive subgroup: a lattice is an additive subgroup if it contains identity element (the zero vector), and if for any , we have and
Below, we will see what a lattice is and what it is not.
- The singleton set is a lattice (for any positive integer ). That is, the zero vector in any dimension is a lattice.
- The integers form a 1-dimensional lattice .
- The integer grid is an n-dimensional lattice
The set is a lattice; it is often called the “checkerboard” or “chessboard” lattice, especially in two dimensions. It contains all -vectors of integers such that the sum of the components of , i.e , is an even integer. That is, the sum of elements in the vector is an even integer.
The opposite is not true. That is is not a lattice. Although it is discrete, it is not an additive subgroup of mainly because it doesn’t contain the identity element (the all-zeros vector) as shown in non-example diagram below. Recall, that a lattice is an additive subgroup if it contains identity element , and if any , we have and .
Example:
Non-example(opposite):
Example 1: Just even integers
- Example 2: random 2-tuples and 3-tuples with sum of even integer
- Non-example: random 2-tuples and 3-tuples with sum of odd integer
The rationals do not form a lattice, because although they form a subgroup, it is not discrete: there exist rational numbers that are arbitrarily close to zero.
For two arbitrary rational numbers and , where there are inifinitely many rational numbers between them therefore making it impossible for either and to be discrete.
For example, below is a graph of points in between 1 and 2.
The odd integers do not form a lattice, because although they are discrete, they do not form a subgroup of .
The odd integers do not contain 0
Basis
A basis of a lattice is a set of linearly independent vector whose integer linear combinations generate the lattice:
Recall two vectors and are said to be linearly independent if and where is an arbitrary integers.
For example, and are linearly independent while and are not. Why? and where and are and respectively. But, we can’t find any for which and vice versa.
In general, the vectors are said to be linearly independent if for any vector in the set, it cannot be generated by the linear combination of one, some or all of the other vectors in the set. That is, where is an arbitrary natural number.
We can also represent a basis as a matrix. This is an matrix where the basis vectors are the ordered columns of the matrix. This is a non-singular matrix.
With this we can represent a lattice
For example, given a basis where , and respectively, we have a matrix and the finite set of integer vectors where , and respectively, we can generate a lattice with three points , and .
This way of representing the basis is instrumental in understanding the next topic: unimodular matrix
Unimodular Matrix
Bases , generate the same lattice if and only if there exists a unimodular such that .
An integer matrix is said to be unimodular if it determinant is .
This property of two bases being able to generate the same lattice and some bases been better than others is what makes lattice-based cryptography possible. We will take about good and bad bases below.
We can efficiently test whether two given matrices , generate the same lattice, by checking whether is unimodular.
Norms
A norm or vector norm is a generalization of what we would normally call the length or magnitude of a vector.
Recall, , the magnitude or length or size of a vector . This is a type of norm called the Euclidean norm .
Formally, a norm on a vector space over or is a function that satisfies the properties for all vectors , and all scalars :
Non-negativity: , and
Homogeneity:
Triangle Inequality:
For example, the Euclidean norm for the vector is .
The graphical representation is displayed below. The length of the arrow is .
This graph would help us understand the next topic: -th successive minimum
Other norms include the Manhattan Norm, Maximum Norm and p-norm. For now, we only care about Euclidean norms.
Successive Minimum
The Euclidean Norm of any vector in a lattice can be interpreted as the radius of a circle (or sphere in higher dimensions) where the origin of the graph is the centre of the circle as shown in the diagram below.
Given a lattice and a norm(i.e. the Euclidean norm), the -th successive minimum is the smallest radius such that contains at least linearly independent lattice vectors of norm at most within a ball of radius centered at the origin.
In other words, what is the smallest radius such that we can find linearly independent vectors inside the circle(or sphere) with radius ? Recall, that we interpret the norm of a vector as a radius when the centre is at the origin .
For example, if we generate the vectors , and given the basis points and creating a lattice , what is the 1st successive minimum ? Or, What is -th successive minimum when is 1?
We start by finding the norm of the vectors(including the basis vectors):
The smallest norm is and if we draw a circle using this norm as the radius, we find the linearly independent vector within the circle. Therefore, is the the 1st successive minimum.
Notice how it is the closest vector to the origin. It is called the smallest nonzero vector in the lattice. Take note of this, we discuss this later in the series.
Good and Bad Bases
Given two bases and that generate the same lattice(see unimodular matrix), below they are labelled on the lattice they generate respectively.
If you are given basis and this lattice, and you are asked to find the first successive minimum , it’s very easy to see that is the answer because it obviously has the smallest norm. But then, what if you are given only and this lattice and you asked to find the first successive minimum , how hard could this be?
You can already see that this is a search problem and it gets harder to solve as the dimension increases. This is in two dimensions so it’s easy to solve but in practice we work in extremely higher dimensions.
That is the point of good and bad bases. Given a good basis it’s easy to find but it’s extremely hard to find given a bad basis.
Formally, we check that a basis is good or bad using the following:
- Good bases are close to being orthogonal: Two vectors are orthogonal if their dot product is zero (i.e ). For example:
- For , . This is called perfect orthogonality.
- For and , . This is not the “best basis” but it’s nothing close to a bad basis. Wait until you see that of
- For , . Now, this is not close to being orthogonal.
- Bad bases have large Gram-Schmidt Norms: I won’t go into details of Gram-Schmidt Norms but keep this in mind.
Back to understanding successive minimum.
Successive Minimum (Cont’d)
Again, what is the 2nd successive minimum? We are looking for the smallest radius(i.e norm) that creates a circle containing two linearly independent vectors.
From the computed norms, we know that the second smallest vector is with norm of . Drawing a circle using this norm as the radius, the circle contains and . Therefore, is the 2nd successive minimum.
Thirdly, what is the 3rd successive minimum?
Probably , the third smallest norm. It turns out this is not the case. They are not linearly independent because was generated by and therefore there are only two linearly independent vectors(i.e and ) in the circle with radius .
How about ? The fourth smallest norm. This is still not the 3rd successive minimum for the same reason as before, was generated by and therefore the circle with radius contains only two linearly independent vectors.
And, lastly, how about ? The largest norm. Is it the 3rd successive minimum? No, it’s not. For the same reason as before.
With this, it is safe to say the 3rd successive minimum and above does not exist because all other vectors were generated by the basis points and .
In general, the maximum in the -th successive minimum is the number of basis vectors.
It’s important to point out that a lattice might have multiple basis vectors and this is an instrumental property of lattices that makes certain types of lattice-based cryptography possible.
Fundamental domains and parallelepipeds
In order to understand fundamental domain and parallelepipeds, here’s a quick crash course on abstract algebra.
A group is a set with an operation that satisfies four properties:
- Closure: if , , then
- Associativity: for all
- Identity Element: There exists an element such that for all
- Inverse Element: For every , there exists an element such that (the identity element)
Example of a group:
- The set of integers under the operation, addition forms a group:
- Closure: if , then . For example,
- Associativity: . For example,
- Identity: The number satisfies . is the identity element.
- Inverses: Each has an inverse , since . For example,
A subgroup of a group is a subset of that is itself a group under the same operation. That is:
- Closure: if , , then
- Identity Element: The identity element of the group is in
- Inverse Element: If , then
Example of a subgroup:
- The set of integers divisible by (i.e multipling by all integers) is a subgroup of under addition because:
- Closure: The sum of two numbers divisible by is divisible by making it closed under addition.
- Identity: is in
- Inverses: Every has an inverse . For example,
Note: Associativity is automatically holds for subgroups. Ponder on why this is the case.
Let’s do a little experiment!
Imagine we added the numbers to to the elements in to create new sets and displayed them in two halves. That is:
First half:
Second half:
Do you notice anything about these sets!? Here are some observations:
- The sets in the second half are a repetition of the sets in the first half so we will only focus on the first half moving on. Try creating more sets with numbers greater than or less than .
- The sets are disjoint(i.e, they have no elements in common). Every element appears in only one set.
- The “combination” of the sets makes up the set of integers . That is, where represents union.
- Each set contains element with the same remainder when divided by . For example, every element in would result in a remainder of when divided by . These sets are called equivalent classes in modulo arithmetic. In this case, they are equivalent because they share the same remainders but equivalence relations can be of different forms as we will see later.
- If we add any element from a set to any element from another set, you get an element from a set. For example, if we add any number in to any number in , we get a number in and if we add any number in to any number in , we get a number in .
- If we add any number from a set to any number in , we get back a number in the same set. For example, if we add from to from , we get from .
- If we add any number from to any number from , we get a number from , if we add any number from to any number from , we get a number from and if we add any number from to any number from itself, we get a number from .
- The last three observations implies closure, presence of an identity element and presence of an inverse element respectively. The sets are called cosets and they form a group called the quotient group . We call it a quotient group because we use a subgroup to divide the group into cosets. Not all subgroups create cosets that form a quotient group like , but when they do we call them normal subgroups. Our observations doesn’t show associativity but it holds and I urge you to try it out
Formally, a coset is formed when you take a subgroup of a group and partition into sets of the form where and is an operation.
Note: The cosets from to are not subgroups of under addition. They don’t contain the identity element, they are not closed under addition and they don’t contain their inverses. Using as an example:
- identity element: , the identity element is not in the set.
- inverse element: It doesn’t contain the identity element so it cannot have an inverse element.
- closure: but is not in .
Now, back to lattices. How does all these help in understanding fundamental domain and parallelepipeds?
The above example shows we could take any arbitrary integer and we must be able to represent it using one of the elements of the quotient group . A fundamental domain is synonymous to this in lattices.
Since a lattice is a subgroup of , we can define the quotient group , which divides into cosets of in . A quotient group of this form corresponds to a fundamental domain of . A fundamental domain is a region in that contains exactly one representative from each coset just like . Similar to how encompasses the set of integers using five cosets, the fundamental domain encompasses all the elements of by having a representative for each coset.
Formally, a coset of in is a set of the form where is a vector in . If , then and are either the same set or disjoint. The set of all such cosets forms the quotient group .
For example, given a lattice and , and , we can form the following cosets:
An example of a fundamental domain is the set generated by where is the basis of the a lattice and is a real number not an integer . This fundamental domain is called a fundamental parallelepiped.
We are saying that is for any vector , we would be able to find its representative in the fundamental parallelepipeds.
Let’s look at an example using basis and .
First, the diagram below shows the lattice generate by this basis.
Next, let’s create the fundamental parallelepiped and show it.
As stated above, the fundamental parallelepiped would be generated using . There are infinitely many real numbers in the interval so we will show generate a few and show more in the diagram.
- , then
- , then
- , then
- , then
That is, the fundamental parallelepiped .
Below is the what it looks like on a graph.
Notice how it looks like a scaled down and compressed version of the lattice.
Now, let’s verify our claim that we can find a representative of any vector in the fundamental domain. We will pick .
This means that there exists and such that and we want to find them. Recall that to create an element of an fundamental parallelepiped in we compute . Here, we know , we know and (the basis) but we don’t know and hence we are finding them.
Expanding the expression, we have that and . Solving this we have that and (i.e using any of the methods for solving simultaneous equations like gaussian elimination).
Recall that and are supposed to be in the interval . We would have to wrap and around this interval. In other words, we would have to compute and . Doing that we have that and .
To get to representative of in the fundamental parallelepiped, we compute . Therefore, is the representative of in the fundamental parallelepiped.
We are not done yet.
Do you see any similarity between and ? You would notice they both end in the same decimals and . That means their difference is an integer vector. That is, .
Using our basis and , we can generate the lattice: Recall that, a coset of in is a set of the form . Setting , we have that: Notice how is part of the lattice and is part of the coset .
This shows that every vector in this coset has the representative in the fundamental parallelepiped and this is their equivalence relation.
Lastly, note that a fundamental domain is not a lattice.
The goal of this material was to introduce these concepts independently; appreciating their beauty without drawing parallels to their applications in lattice-based cryptography; we will do that in the other posts in this series.
In the next post, we will be looking into Hard Problems in Lattice-Based Cryptography. See you there!