Path: blob/main/frontier/07-pairings/sage/07b-weil-pairing-intuition.ipynb
483 views
Notebook 07b: Weil Pairing Intuition
Module 07. Bilinear Pairings
Motivating Question. In Notebook 07a we defined bilinear maps abstractly and used SageMath's weil_pairing() as a black box. But where does this map actually come from? The answer involves divisors, formal sums of points on curves, and rational functions. Understanding divisors gives geometric meaning to the pairing and explains why bilinearity holds. We won't prove everything rigorously, but we'll build enough intuition to see the pairing as a natural construction, not magic.
Prerequisites. You should be comfortable with:
The definition and properties of bilinear maps (Notebook 07a)
Elliptic curve point addition and the group law (Module 06)
Polynomial evaluation and roots (Module 02)
Learning objectives. By the end of this notebook you will be able to:
Understand divisors as formal sums of points and compute their degree and sum.
Relate rational functions on curves to their divisors (zeros and poles).
Sketch how the Weil pairing is constructed from rational functions.
Understand Miller's algorithm at a high level.
Compute the Weil and Tate pairings in SageMath and compare them.
1. Divisors: Formal Sums of Points
Bridge from Module 06. In Module 06 we thought of points on as group elements. Now we need a new perspective: treating points as places where functions have zeros and poles. The language for this is divisors.
A divisor on an elliptic curve is a formal sum of points:
where and only finitely many . Think of it as a "bookkeeping device" that records a list of points with integer multiplicities.
Two key quantities:
Degree: (sum of all multiplicities)
Sum: (add the points using the group law, weighted by multiplicity)
Checkpoint 1. A divisor with and is called principal. An important theorem (Abel's theorem for elliptic curves) states: a divisor is the divisor of a rational function if and only if it is principal. This connects the algebra of divisors to the geometry of functions on curves.
2. Rational Functions and Their Divisors
A rational function on is a ratio of polynomials , where we consider points on the curve.
For example, the line through and (used in point addition) is a rational function . Its divisor records where it meets the curve:
The line meets the curve at three points (, , and the third intersection which becomes ), and has a pole of order 3 at .
Notice: and . So this divisor is principal.
3. The Weil Pairing Construction (Sketch)
Here's the key idea behind the Weil pairing, simplified:
Given: Two points of order on (linearly independent in ).
Step 1. Find a rational function whose divisor is: Such a function exists because , so this divisor has degree 0 and sum .
Step 2. Similarly find with .
Step 3. The Weil pairing is:
where are auxiliary divisors equivalent to and (with support disjoint from 's zeros/poles).
The bilinearity comes from how divisors add: .
Misconception alert. "You need to understand every detail of the Weil pairing construction to use it." Not true, for using pairings in protocols (BLS, IBE, SNARKs), you only need to know the bilinearity property. The construction matters for (a) trusting that the pairing exists, (b) understanding Miller's algorithm, and (c) advanced cryptanalysis. We aim for intuition, not a full proof.
4. Miller's Algorithm: Computing the Pairing
The function with can be built iteratively using Miller's algorithm. The idea is analogous to double-and-add for scalar multiplication:
Start with (trivial function).
For each bit of , update using the line functions from the group law.
After processing all bits, .
The key identity: if , then we can compute from and the line through and .
Miller's algorithm runs in steps, making pairing computation efficient.
Checkpoint 2. Miller's algorithm computes the pairing in field operations, similar to double-and-add. Each step involves evaluating a line function at a point. This makes pairings practical: on a 256-bit curve, the pairing takes a few milliseconds, more expensive than a scalar multiplication, but still efficient.
5. The Tate Pairing
The Weil pairing is the classical construction, but in practice the Tate pairing (and its variants: ate, optimal ate) is more commonly used because it's faster.
The key difference:
Weil pairing: Evaluate at and at , then divide → two Miller loops.
Tate pairing: Only evaluate at , then raise to a power ("final exponentiation") → one Miller loop.
SageMath provides tate_pairing() as well.
6. Comparing Weil and Tate Pairings
| Property | Weil Pairing | Tate Pairing |
|---|---|---|
| Miller loops | 2 | 1 |
| Final exponentiation | No | Yes () |
| Alternating? | Yes: | No |
| Speed | Slower | Faster (in practice) |
| Output | Primitive -th root of unity | -th root of unity |
In production systems (BLS signatures, SNARKs), the optimal ate pairing is used, a variant of Tate that minimizes the Miller loop length.
Checkpoint 3. The Weil pairing is alternating: , and . This means we can't get a non-trivial pairing from a single point, we need two linearly independent -torsion points. This is why pairings require either:
A supersingular curve (where naturally has independent points from and ), or
A twist (an isomorphic curve that provides a second independent subgroup).
7. A Larger Example
Let's work with a slightly larger curve to see pairings in a more realistic setting.
8. Pairings as Isomorphisms
An important fact: for fixed , the map is a group homomorphism from to . If is a generator of and the pairing is non-degenerate, this map is an isomorphism.
This means the pairing gives a "dictionary" between the additive group (curve points) and the multiplicative group (field elements).
Crypto foreshadowing. This isomorphism is exactly what makes BLS signatures work (Notebook 07d). Signing is done in (efficient point arithmetic), but verification uses the pairing to "translate" the check into (where we can compare products). The Tate pairing variant is preferred in practice because it requires only one Miller loop.
9. Exercises
Exercise 1 (Worked): Principal Divisors
Problem. For over , let and . Compute . Write the divisor of the line through and , and verify it is principal.
Solution:
Exercise 2 (Guided): Weil vs Tate
Problem. Using the curve over with :
Compute the Weil pairing and the Tate pairing .
Verify that both are -th roots of unity.
Check bilinearity for both with .
Fill in the TODOs:
Exercise 3 (Independent): Anti-Symmetry Exploration
Problem.
Compute and and verify that their product is 1 (anti-symmetry).
Show that if you swap the arguments of the Tate pairing, in general. Why?
Using the Weil pairing on the larger curve (), verify anti-symmetry for all pairs of multiples of and .
Summary
| Concept | Key Fact |
|---|---|
| Divisor | Formal sum ; has degree and sum |
| Principal divisor | and ; = divisor of a rational function |
| Weil pairing | Built from rational functions evaluated at auxiliary divisors |
| Miller's algorithm | Computes iteratively in , like double-and-add |
| Tate pairing | One Miller loop + final exponentiation; faster in practice |
| Alternating (Weil) | , |
| Isomorphism | For fixed : is a group isomorphism |
We now understand where pairings come from. The next question: which curves have efficient pairings?