# Certificate format

`certificate.json` describes one Gauss-Legendre rule at which the upper bounds of
Conjecture 3 and Conjecture 7 of Lopez Pouso and Segura (arXiv:2305.19128v3) fail.

Fields:

- `n`: the number of quadrature points (here 2). kappa = n + 1/2.
- `d`: a squarefree positive integer. Every number below lies in the field Q(sqrt(d)).
- A **number** is a pair `[a, b]` meaning `a + b*sqrt(d)`, where `a` and `b` are
  each a rational written as a pair of decimal-integer strings `[numerator, denominator]`.
  Example with d = 3: `[["0","1"],["1","3"]]` is `0 + (1/3)*sqrt(3) = 1/sqrt(3)`.
- `nodes`: the n nodes x_1 < ... < x_n, each a number as above.
- `weights`: the n weights w_1, ..., w_n, in the same order, each a number as above.
- `conjecture3_index`: a 1-based index i (1 <= i <= n) at which
  `x_i/z_i - 1 < pi^2/(12 kappa^2)` is claimed to fail (with z_i > 0).
- `conjecture7_index`: a 1-based interior index i (1 <= i <= n-1) at which
  `alpha_i/(1 - zbar_i^2) - 1 < pi^2/(12 kappa^2)` is claimed to fail.
- `statement`: free text, ignored by the verifier.

Here: n = 2, nodes -1/sqrt(3), 1/sqrt(3), weights 1, 1. Then zbar_1 = 0, z_2 = 1/2,
alpha_1 = 2/sqrt(3), and both left-hand sides equal 2/sqrt(3) - 1 = 0.1547...,
while pi^2/(12 kappa^2) = pi^2/75 = 0.1316...

What `verify.py` does (exact arithmetic only, no floats):

1. Builds the Legendre polynomial P_n from Bonnet's recurrence with rational coefficients,
   and checks that the given nodes are strictly increasing and are all zeros of P_n
   (n distinct zeros of a degree-n polynomial are all of its zeros).
2. Checks that the weights make the rule exact: sum_i w_i x_i^k = integral of x^k over
   [-1,1] for every k = 0..2n-1. This identifies them as the Gauss-Legendre weights.
3. Computes zbar_i, z_i, alpha_i from the definitions in statement.md (and cross-checks the
   two equivalent definitions of alpha_i, and zbar_n = 1).
4. Computes a rigorous rational upper bound U > pi from Machin's formula
   pi = 16 arctan(1/5) - 4 arctan(1/239) using truncated alternating series, hence a
   rational B = U^2/(12 kappa^2) > pi^2/(12 kappa^2).
5. Checks exactly in Q(sqrt(d)) (signs of a + b*sqrt(d) decided by integer comparisons)
   that x_i/z_i - 1 > B and alpha_i/(1 - zbar_i^2) - 1 > B at the given indices.
   Both must hold for VERIFIED.
