id stringlengths 18 18 | type stringclasses 1
value | topic stringlengths 16 28 | subtopic stringlengths 58 92 | difficulty stringclasses 1
value | problem_statement stringlengths 584 3.07k | solution_proof stringlengths 1.25k 4.98k | final_answer stringlengths 5 1.14k | python_verification stringlengths 611 4.63k |
|---|---|---|---|---|---|---|---|---|
MATH-CRYPTO-000049 | math_competition_problem | Block Cipher Cryptanalysis | Differential cryptanalysis: difference distribution tables (DDT) and truncated differentials | Research Level | Let n ≥ 2 and let GF(2^n) be the finite field of order 2^n. Define the inverse S-box F_n: GF(2^n) → GF(2^n) by F_n(0)=0 and F_n(x)=x^{-1} for x ≠ 0. For a,b ∈ GF(2^n), define the DDT entry D_n(a,b) = #{x ∈ GF(2^n): F_n(x+a)+F_n(x)=b}, where + is field addition (equivalently XOR). Let Tr: GF(2^n) → GF(2) be the absolute... | 1. Edge cases. If a=0, then F_n(x+0)+F_n(x)=0 for every x, so D_n(0,0)=2^n and D_n(0,b)=0 for b≠0. If a≠0 and b=0, suppose F_n(x+a)=F_n(x). For x=0 the left side is F_n(a)+F_n(0)=a^{-1}≠0; for x=a it is F_n(0)+F_n(a)=a^{-1}≠0; for x not in {0,a}, 1/(x+a)=1/x implies a=0, contradiction. Hence D_n(a,0)=0.
2. Nonzero a,b... | For a=0: D_n(0,0)=2^n and D_n(0,b)=0 for b≠0. For a≠0: D_n(a,0)=0, and for b≠0, D_n(a,b)=2([b=a^{-1}]+[Tr(1/(ab))=0]). For a≠0 and T_a={b∈GF(2^n)^×: Tr(1/(ab))=0}, P_n(a,T_a)=1 if n is even, and 1-2^{1-n} if n is odd. Hence P_n(a,T_a)→1 as n→∞. Direct row enumeration: O(2^n) field operations; full DDT: O(2^{2n}) time a... | import sys
POLY = {2:0b111, 3:0b1011, 4:0b10011, 5:0b100101}
def mul(a,b,n):
mod = POLY[n]
res = 0
while b:
if b & 1:
res ^= a
b >>= 1
a <<= 1
if a & (1 << n):
a ^= mod
return res & ((1 << n) - 1)
def pow_gf(a,e,n):
res = 1
base = a
... |
MATH-CRYPTO-000066 | math_competition_problem | Analytic Number Theory | Hardy-Littlewood circle method for ternary Goldbach and Waring problems | Research Level | For a positive integer $q$ and an integer $n$, define the Ramanujan sum $c_q(n)=\sum_{\substack{1\le a\le q\\ \gcd(a,q)=1}} e^{2\pi i a n/q}$ and the major-arc factor of the ternary Goldbach problem
$$A(q,n)=\frac{\mu(q)^3\,c_q(-n)}{\varphi(q)^3},$$
where $\mu$ is the M\"obius function and $\varphi$ is Euler's totient.... | Step 1 (Ramanujan sums). Since $a\mapsto -a$ permutes the reduced residues mod $q$, we have $c_q(-n)=c_q(n)$. For a prime $p$, $c_p(n)=\sum_{a=1}^{p-1}e^{2\pi i an/p}$ equals $p-1$ if $p\mid n$ and $-1$ otherwise, because the full sum over $a=0,\dots,p-1$ is $p\cdot[p\mid n]$ and the term $a=0$ contributes $1$.
Step 2... | $\mathfrak{S}(n)=\prod_{p\mid n}(1-(p-1)^{-2})\prod_{p\nmid n}(1+(p-1)^{-3})$; it vanishes for even $n$ and is $\ge 2C_3>0$ for odd $n$; $\mathfrak{S}(15)/\mathfrak{S}(1)=8/13$. | from fractions import Fraction
import cmath, math
def primes(N):
s=[True]*(N+1);s[0]=s[1]=False
for i in range(2,int(N**0.5)+1):
if s[i]:
for j in range(i*i,N+1,i):s[j]=False
return [i for i in range(N+1) if s[i]]
def mu(q):
r=1;x=q;p=2
while p*p<=x:
if x%p==0:
... |
MATH-CRYPTO-000053 | math_competition_problem | Protocol Security | ProVerif applied pi-calculus modeling of TLS 1.3 handshake secrecy and forward secrecy | Research Level | Consider a symbolic (Dolev-Yao) abstraction of the TLS 1.3 (EC)DHE handshake in the applied pi-calculus, as analyzed by ProVerif.
Signature. Constructors: $g$ (constant), $\exp(x,y)$, $\mathsf{pk}(k)$, $\mathsf{sign}(m,k)$, $\mathsf{hkdf}(x,y)$, $\mathsf{senc}(m,k)$, $\mathsf{pair}(x,y)$. Equational theory $E$: $\exp(... | Step 1 (Frame, ephemeral). After the honest run, $\phi_a=\{g,\mathsf{pk}(sk_S),X,Y,\sigma,c=\mathsf{senc}(s,K)\}$ and phase 1 adds $sk_S$. The names $x,y,s$ remain restricted.
Step 2 (Locality). For this theory (subterm convergent destructors plus DH commutation), deduction is decidable by saturation: closing the know... | (a) ephemeral (EC)DHE TLS 1.3 core: s not derivable — forward secrecy holds; (b) static DH: s derivable after sk_S compromise. Result: (False, True). | import itertools
def norm(t):
# canonical DH: ('exp', frozenset of exponents) over g
if isinstance(t,tuple) and t[0]=='exp':
b=norm(t[1]);e=t[2]
if b=='g': return ('dh',frozenset([e]))
if isinstance(b,tuple) and b[0]=='dh': return ('dh',b[1]|frozenset([e]))
return ('exp',b,e)
... |
MATH-CRYPTO-000127 | math_competition_problem | Algebraic Geometry | Grothendieck duality and Serre duality on coherent sheaves | Research Level | Let $k$ be a field and $X\subset \mathbb{P}^4_k$ a smooth complete intersection of two cubic hypersurfaces, so $X$ is a smooth projective surface. (a) Using Grothendieck duality for the closed immersion $i:X\hookrightarrow \mathbb{P}^4$, i.e. $\omega_X\cong \mathcal{E}xt^{2}_{\mathbb{P}^4}(\mathcal{O}_X,\omega_{\mathbb... | Step 1 (Koszul). Let $f,g$ be the cubics; they form a regular sequence, giving the exact Koszul resolution $0\to\mathcal{O}(-6)\to\mathcal{O}(-3)^2\to\mathcal{O}\to\mathcal{O}_X\to0$ on $P=\mathbb{P}^4$.
Step 2 (Grothendieck duality). Apply $\mathcal{H}om(-,\omega_P)$ with $\omega_P=\mathcal{O}(-5)$ to obtain the comp... | $\omega_X\cong\mathcal{O}_X(1)$; $(h^0,h^1,h^2)(\mathcal{O}_X)=(1,0,5)$, $(h^0,h^1,h^2)(\omega_X)=(5,0,1)$ (Serre dual); $\chi(\mathcal{O}_X)=6$, $K_X^2=9$, $c_2(X)=63$. | from math import comb
def h(i,m,n=4):
if i==0: return comb(m+n,n) if m>=0 else 0
if i==n: return h(0,-m-n-1,n)
return 0
def coh_ci(t,degs=(3,3),n=4):
# Koszul for CI of two hypersurfaces: terms O(t-a-b) -> O(t-a)+O(t-b) -> O(t)
a,b=degs
T0=[h(i,t) for i in range(5)]
T1=[h(i,t-a)+h(i,t-b) for... |
MATH-CRYPTO-000191 | math_competition_problem | Differential Geometry | Bochner-Weitzenbock formulas and Lichnerowicz-Obata eigenvalue bounds | Research Level | Let $(M^n,g)$ be a closed (compact, boundaryless) connected smooth Riemannian manifold of dimension $n\ge 2$. Assume $\mathrm{Ric}\ge (n-1)k\,g$ for some constant $k>0$. Let $\Delta = \mathrm{tr}\,\nabla^2$ be the (non-positive) Laplace-Beltrami operator, and let $\lambda_1>0$ be the first nonzero eigenvalue, so $\Delt... | (a) Work in normal coordinates at $p$ (so $g_{ij}=\delta_{ij}$, $\Gamma^k_{ij}(p)=0$). Then $\tfrac12\Delta|\nabla f|^2 = \sum_{i,j}\big(f_{ij}f_{ij} + f_j f_{jii}\big)$. By the Ricci identity, commuting covariant derivatives: $f_{jii}=f_{iji}$ (Hessian symmetric) and $f_{iji} = f_{iij} + R_{jl}f_l$ (since $f_{ijk}-f_{... | $\lambda_1\ge nk$, with equality forcing $\nabla^2 f=-kfg$ and $|\nabla f|^2+kf^2=k$; on $S^n(r)$, $\lambda_1=n/r^2$, so for $n=4,r=2$: $\lambda_1=1$. | import sympy as sp
# Verify spherical-harmonic eigenvalue on S^n(r) via radial decomposition in R^{n+1}
def check(n, r):
xs = sp.symbols('x0:%d' % (n + 1))
rho = sp.sqrt(sum(x**2 for x in xs))
# degree-1 homogeneous harmonic x0; Delta_S(phi) = r^2*(Lap(u) - u_rr - n/rho u_r) at rho=r
# For homogeneous ... |
MATH-CRYPTO-000005 | math_competition_problem | Analytic Number Theory | Selberg trace formula and spectral theory of Maass waveforms | Research Level | Let $\mathbb{H}=\{z=x+iy: y>0\}$ carry the hyperbolic metric $ds^2=(dx^2+dy^2)/y^2$, area measure $d\mu=dx\,dy/y^2$, and Laplacian $\Delta=-y^2(\partial_x^2+\partial_y^2)$. Let $\Gamma=\mathrm{PSL}_2(\mathbb{Z})$ act by M\"obius transformations. The standard fundamental domain is $\mathcal{F}=\{z\in\mathbb{H}: |x|\le 1... | **(a) Area of the fundamental domain.**
For fixed $x\in[-1/2,1/2]$, the domain $\mathcal{F}$ contains exactly those $y$ with $y\ge\sqrt{1-x^2}$. Hence
$$\mu(\mathcal{F})=\int_{-1/2}^{1/2}\int_{\sqrt{1-x^2}}^{\infty}\frac{dy}{y^2}\,dx=\int_{-1/2}^{1/2}\frac{dx}{\sqrt{1-x^2}}.$$
Evaluating the arcsine integral gives $2\... | $\mu(\mathcal{F})=\pi/3$; $I(t)=\dfrac{1}{12t}-\dfrac{1}{144}+O(t)$ as $t\to0^+$; and $N(T)\sim T^2/12$. | import math
def simpson(f, a, b, n=200000):
if n % 2:
n += 1
h = (b - a) / n
s = f(a) + f(b)
for k in range(1, n):
s += (4 if k % 2 else 2) * f(a + k * h)
return s * h / 3
# (a) area of fundamental domain: integrate 1/sqrt(1-x^2) over [-1/2,1/2]
area = simpson(lambda x: 1.0 / math.... |
MATH-CRYPTO-000193 | math_competition_problem | Complex Analysis | Nevanlinna defect relations and value distribution of meromorphic functions | Research Level | Let $q\ge 2$ be an integer and $f_q(z)=\int_0^z e^{-t^q}\,dt$, an entire function of order $q$. For $a\in\mathbb{C}$ define the proximity function $m(r,a)=\frac{1}{2\pi}\int_0^{2\pi}\log^+\frac{1}{|f(re^{i\theta})-a|}d\theta$, $m(r,\infty)=\frac{1}{2\pi}\int_0^{2\pi}\log^+|f(re^{i\theta})|d\theta$, the characteristic $... | Step 1 (asymptotic values). Let $\omega=e^{2\pi i/q}$ and $S_k=\{|\arg z-2\pi k/q|<\pi/(2q)\}$. On the ray $\arg t=2\pi k/q$ we have $t^q=|t|^q$, so $a_k:=\int_0^{\infty\omega^k}e^{-t^q}dt=\omega^k\Gamma(1+1/q)$. In $S_k$, $\mathrm{Re}(z^q)>0$; deforming the contour, $f(z)-a_k=-\int_z^{\infty}e^{-t^q}dt$. Integrating b... | $T(r,f_q)\sim r^q/\pi$; $\delta(\infty)=1$, $\delta(\omega^k\Gamma(1+1/q))=1/q$ for $k=0,\dots,q-1$, all other values non-deficient; $\sum\delta=2$. For $q=4$: $\delta(i^k\Gamma(5/4))=1/4$, total $2$. | import mpmath as mp
mp.mp.dps=30
q=4
G=mp.gamma(1+mp.mpf(1)/q)
def f(z):
return mp.quad(lambda s: z*mp.e**(-(s*z)**q),[0,0.5,1])
def prox(r,a,n=400):
tot=0
for j in range(n):
th=2*mp.pi*(j+0.5)/n
z=r*mp.e**(1j*th)
if a is None:
v=abs(f(z)); tot+=max(0,mp.log(v))
e... |
MATH-CRYPTO-000118 | math_competition_problem | Side-Channel Resistance | Constant-time cryptographic arithmetic: avoiding timing leaks in field inversions | Research Level | Let p=2^{255}-19, a known prime, and let F_p be the field with p elements. For x in F_p define Inv_0(x)=x^{p-2} mod p. For x not equal to 0 this equals x^{-1}; also Inv_0(0)=0. Treat F_p multiplication and squaring as atomic operations of unit cost in a leakage model where the observable trace is the ordered list of op... | 1. Reduction to fixed exponentiation. Since p is prime, Fermat's little theorem gives a^{p-1}=1 for every nonzero a in F_p. Hence a^{p-2}=a^{-1} for a nonzero. For a=0, a^{p-2}=0. Therefore Inv_0 is a total function and is computed by the single fixed public exponent e=p-2, with no secret-dependent branch or exception.... | Inv_0(x)=x^{2^{255}-21} mod p. The constant-time Montgomery ladder processes 255 public exponent bits; each iteration performs exactly one multiplication and one squaring, so the fixed trace has 255 multiplications plus 255 squarings = 510 F_p operations, independent of x. It returns x^{-1} for x not equal to 0 and ret... | import random
p = (1 << 255) - 19
e = p - 2
bits = [int(c) for c in bin(e)[2:]]
def inv0_ladder(x):
x %= p
r0 = 1
r1 = x
ops = 0
for b in bits:
if b == 0:
r1 = (r0 * r1) % p
r0 = (r0 * r0) % p
else:
r0 = (r0 * r1) % p
r1 = (r1 * r1) %... |
MATH-CRYPTO-000144 | math_competition_problem | Combinatorics & Graph Theory | Lovász Local Lemma: algorithmic Moser-Tardos constructive formulations | Research Level | Let $\mathcal{X}=\{x_1,\dots,x_n\}$ be mutually independent random variables, each uniform on $\{0,1\}$. Let $\mathcal{A}=\{A_1,\dots,A_m\}$ be bad events. Each $A_i$ is determined by a variable set $\mathrm{vbl}(A_i)\subseteq\mathcal{X}$ of size exactly $k\ge 2$, and $A_i$ is the event that a fixed $k$-clause (a disju... | (a) Witness trees.
Fix a log $C:\mathbb{N}\to\mathcal{A}$ recording the event resampled at each step. For step $t$, build the witness tree $\tau(t)$ as follows:
- Start with a root labelled $C(t)$.
- For $s=t-1$ down to $1$, if some vertex $v$ has label $[v]$ with $C(s)\in\Gamma^+([v])$, attach a new child labelled $C... | Expected number of resamplings is at most $\sum_A x(A)/(1-x(A))$. Under $e2^{-k}(d+1)\le1$ this is at most $m/d$, or exactly $m/(2^k-1)$ when $d=0$. Expected time is $O(k(n+m))$. The $2^k$ clauses on $k$ variables (unsatisfiable, $d=2^k-1$) show tightness up to the factor $e$. | import random, itertools, math
def mt(n, clauses, rng):
a = [rng.randint(0, 1) for _ in range(n)]
viol = lambda c: all(a[v] != s for v, s in c)
cnt = 0
while True:
bad = [c for c in clauses if viol(c)]
if not bad:
return a, cnt
for v, _ in bad[0]:
a[v] = ... |
MATH-CRYPTO-000204 | math_competition_problem | Combinatorics & Graph Theory | Lovász Local Lemma: algorithmic Moser-Tardos constructive formulations | Research Level | Let $\Phi$ be a $k$-CNF formula ($k\ge 2$) on Boolean variables $x_1,\dots,x_n$ with $m$ clauses. Each clause contains exactly $k$ literals on $k$ distinct variables. Two distinct clauses $C\ne C'$ are neighbors, written $C\sim C'$, if they share a variable, regardless of sign. Let $\Gamma(C)$ be the set of neighbors o... | Setup. Index the resampling steps $t=1,2,\dots$ and let $C_t$ be the clause resampled at step $t$.
Witness trees. For step $t$, the witness tree $\tau_t$ is built backward from $C_t$. Its root is labeled $C_t$. For $s=t-1,\dots,1$, look for nodes whose label $L$ satisfies $C_s\in\Gamma^+(L)$. If such nodes exist, atta... | Under $e2^{-k}(d+1)\le1$ with $d\ge1$: $\mathbb{E}[\text{total resamplings}]\le m/d$. For $d=0$, the bound is $m/(2^k-1)$, which is tight. The largest admissible $d$ is $d_{\max}(k)=\lfloor 2^k/e\rfloor-1$, giving $1,4,10,375$ for $k=3,4,5,10$. | import math, random
def dmax(k):
return math.floor(2**k/math.e)-1
assert [dmax(k) for k in (3,4,5,10)]==[1,4,10,375]
for k in range(2,20):
d=dmax(k)
assert math.e*(d+1)<=2**k and math.e*(d+2)>2**k
if d>=1:
assert (1/(d+1))*(1-1/(d+1))**d>=2**-k
def mt(clauses,n,rng):
x=[rng.randint(0,1) f... |
MATH-CRYPTO-000189 | math_competition_problem | Algebraic Geometry | Intersection theory, Chow rings, and Riemann-Roch-Hirzebruch theorem | Research Level | Let $k$ be an algebraically closed field and $e\ge 0$ an integer. Let $\pi:\mathbb{F}_e=\mathbb{P}(\mathcal{O}_{\mathbb{P}^1}\oplus\mathcal{O}_{\mathbb{P}^1}(-e))\to\mathbb{P}^1$ be the Hirzebruch surface. Use the Grothendieck convention $\pi_*\mathcal{O}(1)=\mathcal{O}\oplus\mathcal{O}(-e)$. Let $C_0$ be the section w... | **Step 1 (intersection numbers).** In $A^*$ we have $C_0^2=-e$, $C_0f=1$ and $f^2=0$. For $D=aC_0+bf$ this gives $D^2=-ea^2+2ab$.
**Step 2 (canonical class).** The relative Euler sequence gives $K_{\mathbb{F}_e}=\pi^*(K_{\mathbb{P}^1}+\det\mathcal{E})-2C_0$ with $\det\mathcal{E}=\mathcal{O}(-e)$. Hence $K=-2C_0-(e+2)f... | $K=-2C_0-(e+2)f$, $K^2=8$, $\mathrm{td}=1+C_0+\tfrac{e+2}{2}f+[\mathrm{pt}]$, and for all $(a,b)\in\mathbb{Z}^2$: $\chi(\mathbb{F}_e,\mathcal{O}(aC_0+bf))=(a+1)(b+1)-\tfrac{e\,a(a+1)}{2}$. Edge case: $\chi=0$ for $a=-1$. Asymptotics: $\chi(nL)\sim\tfrac{2ab-ea^2}{2}n^2$. The closed form costs $O(1)$ ring operations ver... | from fractions import Fraction as F
def inter(D1, D2, e):
a1, b1 = D1; a2, b2 = D2
return a1*a2*(-e) + a1*b2 + a2*b1
def chi_hrr(a, b, e):
D = (a, b); K = (-2, -(e+2))
return F(inter(D, D, e), 2) - F(inter(D, K, e), 2) + 1
def closed(a, b, e):
return (a+1)*(b+1) - e*a*(a+1)//2
def chi_P1(k):
... |
MATH-CRYPTO-000026 | math_competition_problem | Post-Quantum Cryptography | Module-LWE and Ring-LWE error distribution parameter tuning (ML-KEM/Kyber) | Research Level | Let $\eta\ge 1$ be an integer. The centered binomial distribution $B_\eta$ is the law of $X=\sum_{i=1}^{\eta}(a_i-b_i)$, where $a_1,\dots,a_\eta,b_1,\dots,b_\eta$ are independent and uniform on $\{0,1\}$. Let $n\ge 1$ and $R=\mathbb{Z}[x]/(x^n+1)$. For $k\ge 1$, let $\mathbf{s}=(s^{(1)},\dots,s^{(k)})\in R^k$ and $\mat... | Step 1 (moments of $B_\eta$). Write $Y_i=a_i-b_i$. Then $Y_i$ takes the values $-1,0,1$ with probabilities $1/4,1/2,1/4$. Hence $\mathbb{E}[Y_i]=\mathbb{E}[Y_i^3]=0$ and $\mathbb{E}[Y_i^2]=\mathbb{E}[Y_i^4]=1/2$. The $Y_i$ are independent, and $X=\sum_i Y_i$ is symmetric, so all odd moments of $X$ vanish. In particular... | $\mathrm{Var}(W)=N\eta^2/4$ and $\mathbb{E}[W^4]=N\left(\frac{3\eta^2-\eta}{4}\right)^2+\frac{3N(N-1)\eta^4}{16}$ with $N=kn$. For ML-KEM-768 ($n=256$, $k=3$, $\eta=2$): $\mathrm{Var}(W)=768$, $\mathbb{E}[W^4]=1771968$, and excess kurtosis $\kappa=13/3072$. | from fractions import Fraction as F
from itertools import product
import random
def cbd(eta):
d = {}
for bits in product([0, 1], repeat=2 * eta):
x = sum(bits[:eta]) - sum(bits[eta:])
d[x] = d.get(x, 0) + F(1, 4 ** eta)
return d
def mom(d, p):
return sum(v * x ** p for x, v in d.items(... |
MATH-CRYPTO-000162 | math_competition_problem | Homomorphic Encryption | CKKS approximate arithmetic homomorphic encryption and rescaling analysis | Research Level | Let $N$ be a power of two, $R=\mathbb{Z}[X]/(X^N+1)$, and $R_q=R/qR$. Let $q=p\cdot q'$, where $p\ge 3$ is odd. For $a\in\mathbb{Z}$, let $[a]_p$ denote the centered residue of $a$ modulo $p$. It is the unique integer in $\{-\tfrac{p-1}{2},\dots,\tfrac{p-1}{2}\}$ congruent to $a$ modulo $p$. Extend $[\cdot]_p$ coeffici... | **(a) The rescaling error.**
Write $r_i=[c_i]_p\in R$. By definition, $p c_i' = c_i - r_i$ over $\mathbb{Z}$ coefficient-wise. Hence
$$p(c_0'+c_1's)=(c_0+c_1s)-(r_0+r_1s)$$
holds in $R$. Reducing modulo $q=pq'$ and dividing by $p$ is legitimate, since $p\cdot(\cdot)$ maps $q'R$ onto $qR$. This gives
$$c_0'+c_1's\equiv... | $e_{\mathrm{rs}}=-([c_0]_p+[c_1]_p s)/p$, and $\mathbb{E}\|\sigma(e_{\mathrm{rs}})\|_2^2=\dfrac{N^2(h+1)(p^2-1)}{12p^2}$. | import itertools, cmath, random
from fractions import Fraction
def negamul(a,b,N):
c=[0]*N
for i in range(N):
for j in range(N):
k=i+j
if k<N: c[k]+=a[i]*b[j]
else: c[k-N]-=a[i]*b[j]
return c
def emb(a,N):
return [sum(a[j]*cmath.exp(1j*cmath.pi*(2*k+1)*j/N) ... |
MATH-CRYPTO-000117 | math_competition_problem | Side-Channel Resistance | Higher-order boolean masking schemes against Differential Power Analysis (DPA) | Research Level | Let n,d\in\mathbb{Z}_{>0} with d\ge 1 and set F=\mathbb{F}_2^n. For y\in F let \operatorname{wt}(y)=\sum_{j=1}^n y_j and \psi(y)=(-1)^{\operatorname{wt}(y)}. A (d+1)-share Boolean d-th order masking of a secret X\in F is the following joint distribution: choose U_0,\ldots,U_{d-1} i.i.d. uniform on F, independent of X; ... | 1. Conditional law. Fix x\in F. The map \Phi_x:F^d\to H_x, (u_0,\ldots,u_{d-1})\mapsto(u_0,\ldots,u_{d-1},x\oplus u_0\oplus\cdots\oplus u_{d-1}), is a bijection because the last coordinate is forced by the xor relation. Hence, under the masking distribution conditioned on X=x, every element of H_x has probability 2^{-n... | For every A\subseteq\{0,\ldots,d\}, \rho_A=1 if A=\{0,\ldots,d\}, and \rho_A=0 otherwise. Hence any subset of at most d shares is independent of X, so all lower-order centered Hamming-weight products have zero signed correlation with \psi(X); the full d+1-share product satisfies D_{\{0,\ldots,d\}}=\psi(X) and has unit ... | import itertools
from collections import Counter
from fractions import Fraction
def wt(y):
return bin(y).count('1')
def psi(y):
return 1 if wt(y) % 2 == 0 else -1
def make_ys(x, u_tuple):
y = list(u_tuple)
z = 0
for u in u_tuple:
z ^= u
y.append(x ^ z)
return y
def check(n, d):
... |
MATH-CRYPTO-000123 | math_competition_problem | Algebraic Number Theory | Chebotarev density theorem applications to Galois group determination | Research Level | Let $f(x) = x^5 - x - 1 \in \mathbb{Z}[x]$. Let $K$ be the splitting field of $f$ over $\mathbb{Q}$, and let $G = \mathrm{Gal}(K/\mathbb{Q})$. View $G$ as a subgroup of $S_5$ through its action on the five roots of $f$.
For a prime $p \nmid \mathrm{disc}(f)$, let $\lambda_p$ denote the factorization pattern of $f \bmo... | Step 0 (Irreducibility and the discriminant).
For a trinomial $x^5 + ax + b$, the discriminant is $\mathrm{disc} = 5^5 b^4 + 4^4 a^5$.
With $a = b = -1$ this gives $\mathrm{disc}(f) = 3125 - 256 = 2869 = 19 \cdot 151$.
This value is squarefree and positive, but it is not a perfect square. Hence $f$ is separable, and th... | $G = \mathrm{Gal}(K/\mathbb{Q}) \cong S_5$, certified by the following witnesses: $\mathrm{disc}(f) = 2869 = 19 \cdot 151$ (not a square), $\mathrm{Frob}_5$ is a 5-cycle, and $\mathrm{Frob}_2$ has type $(2,3)$. The Chebotarev densities are $\delta(\mathcal{P}_{\mathrm{root}}) = 19/30$, $\delta(\mathcal{P}_{\mathrm{irr}... | import itertools
from fractions import Fraction
from collections import Counter
def norm(a):
while a and a[-1] == 0:
a.pop()
return a
def dm(a, b, p):
a = norm([x % p for x in a]); b = norm([x % p for x in b])
q = [0] * max(len(a) - len(b) + 1, 1)
inv = pow(b[-1], p - 2, p)
while a and... |
MATH-CRYPTO-000112 | math_competition_problem | Formal Verification | Dafny / Separation Logic for heap-manipulating program memory safety verification | Research Level | Consider a first-order imperative language with variables \(\mathrm{Var}\), locations \(\mathrm{Loc}=\mathbb{N}\), values \(\mathrm{Val}=\mathrm{Loc}\cup\{\mathrm{nil}\}\), and a finite partial heap \(h:\mathrm{Loc}\rightharpoonup\mathrm{Val}\). A state is \((\sigma,h)\). Separation conjunction \(P\ast Q\) denotes disj... | We prove partial correctness, memory safety, and termination.
Definitions and elementary lemmas. The predicate \(ll\) is well founded on the length of the finite sequence \(\alpha\). Lemma 1 (unfolding): \(ll(x,\varepsilon)\) holds iff \(x=\mathrm{nil}\) and the heap is \(\mathrm{emp}\); and \(ll(x,a::\alpha')\) holds... | The procedure is total-correct and memory-safe. The valid verification triple is \[\{ll(x_0,\alpha)\land x=x_0\}\ \mathrm{reverse}(x)\ \{ll(r,\mathrm{rev}\,\alpha)\}.\] A sufficient inductive loop invariant is \[I\equiv \exists \alpha_1,\alpha_2.\; ll(p,\mathrm{rev}\,\alpha_1)\ast ll(x,\alpha_2)\land \alpha=\alpha_1{+}... | from itertools import permutations
def make_heap(order):
heap = {}
for i, node in enumerate(order):
nxt = order[i+1] if i+1 < len(order) else None
heap[node] = nxt
return heap, (order[0] if order else None)
def to_list(heap, head):
out = []
seen = set()
cur = head
while cur... |
MATH-CRYPTO-000203 | math_competition_problem | Combinatorics & Graph Theory | Szemerédi regularity lemma and graph limit theory (graphons) | Research Level | Let $W:[0,1]^2\to[0,1]$ be a symmetric measurable graphon, i.e. $W(x,y)=W(y,x)$ for a.e. $(x,y)$, with Lebesgue measure $\mu$ on $[0,1]$. For a finite measurable partition $P=\{V_1,\dots,V_k\}$ of $[0,1]$ into positive-measure sets, define the step graphon $W_P$ by
$$ W_P(x,y)=\frac{1}{\mu(V_a)\mu(V_b)}\int_{V_a\times ... | Proof. Identify $L^2([0,1]^2)=L^2(\mu\times\mu)$. For a partition $P$, let $\mathcal{B}_P$ be the sigma-algebra generated by the rectangles $V_a\times V_b$. Then $W_P=\mathbb{E}[W\mid\mathcal{B}_P]$ is the orthogonal projection of $W$ onto $L^2(\mathcal{B}_P)$. Put $E_t=\|W-W_{P_t}\|_2^2$. Since $0\le W\le1$ and $0\le ... | For every $\varepsilon\in(0,1)$, the refinement algorithm terminates with a partition $P$ satisfying $\operatorname{disc}_P(W)\le\varepsilon$, using at most $\lfloor\varepsilon^{-2}\rfloor$ refinement steps and producing at most $4^{\lfloor\varepsilon^{-2}\rfloor}$ parts. The finite-graph version with normalized cut di... | import math, random
def make_graph(n, seed=12345, p=0.5):
rng = random.Random(seed)
A = [[0.0] * n for _ in range(n)]
for i in range(n):
for j in range(i + 1, n):
if rng.random() < p:
A[i][j] = A[j][i] = 1.0
return A
def block_average(A, P):
n = len(A)
AP = ... |
MATH-CRYPTO-000008 | math_competition_problem | Algebraic Geometry | Moduli spaces of algebraic curves and Deligne-Mumford compactification | Research Level | Let \(n=6\) and let \(\overline{\mathcal M}_{0,6}\) be the Deligne--Mumford moduli stack of stable genus-zero curves with six ordered marked points. For a subset \(A\subset \{1,\dots,6\}\) with \(2\le |A|\le 4\), let \(D_A=D_{A|A^c}\) denote the boundary divisor in \(\overline{\mathcal M}_{0,6}\) whose generic point ha... | Let \(U=\{1,\dots,6\}\). Since \(\dim\overline{\mathcal M}_{0,6}=6-3=3\), and both \(D_S\) and \(D_T\) are boundary divisors of codimension one, the class \(\psi_3 D_S D_T\) has total codimension three and may be evaluated as an integer.
The partitions satisfy \(S=\{1,2\}\subsetneq T=\{1,2,3,4\}\subsetneq U\). For suc... | I = 1 | from fractions import Fraction
from math import factorial
def psi_integral_0(k, exps):
deg = sum(exps.values())
if k < 3:
return Fraction(1, 1) if deg == 0 else Fraction(0, 1)
if deg != k - 3:
return Fraction(0, 1)
num = factorial(k - 3)
den = 1
for a in exps.values():
... |
MATH-CRYPTO-000128 | math_competition_problem | Algebraic Geometry | Moduli spaces of algebraic curves and Deligne-Mumford compactification | Research Level | Work over $\mathbb{C}$. For $n \geq 3$, let $\overline{M}_{0,n}$ be the Deligne-Mumford-Knudsen moduli space of stable $n$-pointed genus-0 curves. Such a curve is a connected nodal curve $C$ of arithmetic genus $0$. It carries distinct smooth marked points $p_1,\dots,p_n$, and every irreducible component has at least $... | **Step 0: the string equation.** Let $\pi:\overline{M}_{0,n+1}\to\overline{M}_{0,n}$ forget the point $p_{n+1}$ and stabilize. Let $D_{i,n+1}$ be the boundary divisor where $p_i$ and $p_{n+1}$ lie alone on a rational tail. Then $\psi_i=\pi^*\psi_i+D_{i,n+1}$. Moreover $\psi_i\cdot D_{i,n+1}=0$, because $\mathbb{L}_i$ i... | $\int_{\overline{M}_{0,n}}\prod\psi_i^{a_i}=\binom{n-3}{a_1,\dots,a_n}$ and #boundary divisors $=2^{n-1}-n-1$; for $n=7$: $\int\psi_1^2\psi_2^2=6$ and $56$ boundary divisors. | from functools import lru_cache
from math import factorial
from itertools import combinations
@lru_cache(maxsize=None)
def F(a):
n = len(a)
assert sum(a) == n - 3
if n == 3:
return 1
k = a.index(0)
b = a[:k] + a[k+1:]
tot = 0
for j in range(len(b)):
if b[j] >= 1:
... |
MATH-CRYPTO-000194 | math_competition_problem | Complex Analysis | Bieberbach conjecture, de Branges theorem, and Loewner evolution | Research Level | Let $\kappa:[0,\infty)\to\partial\mathbb{D}$ be measurable (the driving function). For $z\in\mathbb{D}$ let $w(z,t)$ solve the radial Loewner ODE
$$\frac{\partial w}{\partial t}=-w\,\frac{1+\kappa(t)w}{1-\kappa(t)w},\qquad w(z,0)=z.$$
It is classical (Loewner, Pommerenke) that $f(z)=\lim_{t\to\infty}e^{t}w(z,t)=z+a_2z^... | Step 1 (coefficient ODEs). Expand $\frac{1+\kappa w}{1-\kappa w}=1+2\kappa w+2\kappa^2w^2+O(w^3)$. Write $w=e^{-t}v$ with $v=z+b_2(t)z^2+b_3(t)z^3+\cdots$ and $b_n(0)=0$. Then $w_t=e^{-t}(v_t-v)$. The ODE becomes
$$v_t=-2\kappa e^{-t}v^2-2\kappa^2e^{-2t}v^3+\cdots.$$
Compare coefficients. For $z^2$: $b_2'=-2\kappa e^{-... | (a) $a_2=-2\int_0^\infty e^{-t}\kappa\,dt$ and $a_3=4\big(\int_0^\infty e^{-t}\kappa\,dt\big)^2-2\int_0^\infty e^{-2t}\kappa^2\,dt$.
(b) $|a_2|\le2$ and $|a_3|\le3$, with $|a_3|=3$ iff $\kappa$ is a.e. a constant $c$ (rotated Koebe function $z/(1+cz)^2$, $a_3=3c^2$). By density, $|a_3|\le3$ on all of $\mathcal{S}$.
(c)... | import numpy as np
def coeffs_ode(kappa, T=40.0, N=200000):
# RK4 on b2' = -2 k e^{-t}, b3' = -4 k e^{-t} b2 - 2 k^2 e^{-2t}
h = T / N
b2 = 0j
b3 = 0j
def F(t, b2):
k = kappa(t)
return -2*k*np.exp(-t), -4*k*np.exp(-t)*b2 - 2*k*k*np.exp(-2*t)
t = 0.0
for _ in range(N):
... |
MATH-CRYPTO-000081 | math_competition_problem | Topology & Dynamics | Thurston geometrization of 3-manifolds and Mostow rigidity | Research Level | Let $M$ be the complement of the figure-eight knot in $S^3$. It is known that $M$ admits a complete hyperbolic structure obtained by gluing two regular ideal tetrahedra. An ideal tetrahedron in $\mathbb{H}^3$ is determined up to isometry by a shape parameter $z \in \mathbb{C} \setminus \{0,1\}$ with $\operatorname{Im} ... | (a) From $z(1-z) = w(1-w)$, we obtain $z - z^2 = w - w^2$, hence $z^2 - w^2 - z + w = 0$, i.e., $(z-w)(z+w-1) = 0$. Thus either $z = w$ or $z + w = 1$.
Case 1: $z = w$. Then the first equation becomes $z^2 (1-z)^2 = 1$, so $z(1-z) = \pm 1$. Since $\operatorname{Im} z > 0$, the equation $z(1-z) = 1$ gives $z^2 - z + 1 ... | The unique solution is $z = w = e^{i\pi/3}$. The volume is $\operatorname{Vol}(M) = 2 \mathrm{Cl}_2(\pi/3) \approx 2.029883212819$ (to 12 decimal places). By Mostow rigidity, this volume is a topological invariant of the figure-eight knot complement. | import mpmath as mp
mp.mp.dps = 50
def clausen2(theta):
return mp.nsum(lambda n: mp.sin(n*theta)/n**2, [1, mp.inf])
cl2_pi3 = clausen2(mp.pi/3)
known_cl2_pi3 = mp.mpf('1.0149416064096536250212025542745202859416893075303')
assert abs(cl2_pi3 - known_cl2_pi3) < mp.mpf('1e-40'), f'Cl2(pi/3) mismatch: {cl2_pi3} vs {... |
MATH-CRYPTO-000159 | math_competition_problem | Threshold Cryptography | FROST Schnorr threshold signatures and distributed key generation (DKG) | Research Level | Let $\mathbb{G}=\langle g\rangle$ be a cyclic group of prime order $q$, written multiplicatively. Let $H_1,H_2$ be hash functions with outputs in $\mathbb{Z}_q$. Fix integers $1\le t\le n<q$. Participants are indexed by $P_1,\dots,P_n$, and participant $P_i$ has public index $i\in\mathbb{Z}_q^{*}$.
**DKG (Pedersen/Fel... | **1. DKG consistency.**
For every pair $(j,i)$ the accepted check reads $g^{s_{j,i}}=\prod_k g^{a_{j,k}i^k}=g^{f_j(i)}$ by definition of the commitments. Since $g$ has order $q$, the exponents agree modulo $q$. (In the honest case $s_{j,i}=f_j(i)$ holds by construction.)
Summing over $j$ gives $s_i=\sum_j f_j(i)=F(i)$.... | 1. $s_i=F(i)$, $Y_i=g^{s_i}$ and $Y=g^{F(0)}$.
2. $\sum_{i\in S}\lambda_i^S i^k=\delta_{k,0}$ for $0\le k<t$, so $\sum_{i\in S}\lambda_i^S s_i=x$; for $t=1$, $\lambda=1$.
3. $g^{z_i}=D_iE_i^{\rho_i}Y_i^{\lambda_ic}$ and $g^z=RY^c$.
4. DKG verification costs $\Theta(n^2t)$ exponentiations, the broadcast is $nt$ group el... | import hashlib, random
p = 2039
q = 1019
g = 4
assert pow(g, q, p) == 1 and g != 1
def H(*a):
return int(hashlib.sha256(repr(a).encode()).hexdigest(), 16) % q
def lag(i, S):
num = den = 1
for j in S:
if j != i:
num = num * j % q
den = den * (j - i) % q
return num * pow... |
MATH-CRYPTO-000111 | math_competition_problem | Formal Verification | Hoare logic, loop invariants, and automated verification with Z3 SMT bitvectors | Research Level | Fix an integer $w\ge 1$ and set $\mathbb B_w=\{0,1,\ldots,2^w-1\}$. Identify each $a\in\mathbb B_w$ with its $w$-bit binary expansion. Let $\operatorname{popcount}_w(a)$ be the number of $1$ bits in that expansion. All program arithmetic is modulo $2^w$; bitwise $\&$ acts on $w$-bit expansions. Consider the imperative ... | Let $x_0$ denote the initial value of $x$. Since $x$ is never modified, the postcondition is equivalently $c=\operatorname{popcount}_w(x_0)$.\n\nClaim 1 (clearing the least significant $1$). For every nonzero $y\in\mathbb B_w$,\n\n$\qquad \operatorname{popcount}_w(y\,\&\,(y-1))=\operatorname{popcount}_w(y)-1.$\n\nProof... | For every $w\ge 1$ and every input $x\in\mathbb B_w$, the program $P_w$ terminates after exactly $\operatorname{popcount}_w(x)$ loop iterations and outputs $c=\operatorname{popcount}_w(x)$. The inductive loop invariant is $\operatorname{popcount}_w(x_0)=c+\operatorname{popcount}_w(y)$, where $x_0$ is the initial value ... | #!/usr/bin/env python3\nfrom z3 import *\n\nW = 8\n\ndef popcount_int(x, w=W):\n return bin(x & ((1 << w) - 1)).count('1')\n\ndef popcount_bv(v, w):\n res = BitVecVal(0, w)\n for i in range(w):\n res = res + ZeroExt(w - 1, Extract(i, i, v))\n return res\n\ndef run_program(x, w=W):\n mask = (1 << w... |
MATH-CRYPTO-000067 | math_competition_problem | Algebraic Geometry | Grothendieck duality and Serre duality on coherent sheaves | Research Level | Let $k$ be a field and let $X \subset \mathbb{P}^3_k$ be a smooth complete intersection of two hypersurfaces of degrees $d_1, d_2 \geq 1$, so that $X$ is a smooth projective curve. Let $i: X \hookrightarrow \mathbb{P}^3$ be the closed immersion.\n\n(a) Using Grothendieck duality for the finite morphism $i$, i.e. $i_*\m... | Step 1 (Koszul resolution). Let $f_1,f_2$ be the defining forms, a regular sequence. Let $E = \mathcal{O}(-d_1)\oplus\mathcal{O}(-d_2)$ and $P=\mathbb{P}^3$. The Koszul complex $0\to \mathcal{O}_P(-d_1-d_2)\to E \to \mathcal{O}_P \to i_*\mathcal{O}_X\to 0$ is exact.\n\nStep 2 (Grothendieck duality for $i$). For finite ... | $\omega_X \cong \mathcal{O}_X(d_1+d_2-4)$, $g = \tfrac12 d_1d_2(d_1+d_2-4)+1$; for $(3,4)$: $g=19$ and $h^1(X,\mathcal{O}_X(1)) = 10$. | from math import comb\n\ndef hP(n):\n return comb(n+3,3) if n>=0 else 0\n\ndef h3P(n):\n # h^3(O_P3(n)) = h^0(O(-n-4))\n return hP(-n-4)\n\ndef chiP(n):\n return comb(n+3,3) if n>=-3 else -comb(-n-1,3)\n\ndef chiX(n,d1,d2):\n return chiP(n)-chiP(n-d1)-chiP(n-d2)+chiP(n-d1-d2)\n\ndef genus(d1,d2):\n re... |
MATH-CRYPTO-000206 | math_competition_problem | Post-Quantum Cryptography | Module-LWE and Ring-LWE error distribution parameter tuning (ML-KEM/Kyber) | Research Level | Let η be a positive integer. Let A_i,B_i (1≤i≤η) be independent Bernoulli(1/2) random variables. Define X=Σ_{i=1}^{η}(A_i-B_i); its law is the centered binomial distribution CBD_η. In ML-KEM/Kyber parameter tuning, the secret/error and secondary-error centered binomial parameters (η1,η2) are certified by tail criteria ... | Step 1: Exact PMF. Write S_+=Σ_{i=1}^{η}A_i and S_-=Σ_{i=1}^{η}B_i. Then S_+ and S_- are independent Binomial(η,1/2) variables, so Pr[S_+=a]=C(η,a)/2^η and similarly for S_-. Since X=S_+-S_-, Pr[X=x]=Σ_{a-b=x} [C(η,a)/2^η][C(η,b)/2^η]=4^{-η}Σ_{b} C(η,b+x)C(η,b). Put j=b. We need the identity Σ_j C(η,j+x)C(η,j)=C(2η,η+x... | m(1/32)=3, with equality Pr[|CBD_3|≥3]=1/32; m(1/4)=2, with Pr[|CBD_2|≥2]=1/8. Hence the ML-KEM/Kyber centered-binomial tuning pair is (η1,η2)=(3,2). | from fractions import Fraction
from math import comb
def pmf(eta, x):
if x < -eta or x > eta:
return Fraction(0, 1)
return Fraction(comb(2 * eta, eta + x), 4 ** eta)
def tail_boundary(eta):
return Fraction(2, 4 ** eta)
for eta in range(1, 10):
total = sum((pmf(eta, x) for x in range(-eta, eta... |
MATH-CRYPTO-000221 | math_competition_problem | Homomorphic Encryption | BGV and BFV leveled homomorphic schemes: noise growth and modulus switching | Research Level | Let $n$ be a power of two and let $R=\mathbb{Z}[x]/(x^n+1)$. For $a=\sum_i a_i x^i\in R$, write $\|a\|_\infty=\max_i|a_i|$. Let $t\ge 2$ be the plaintext modulus. Let $p$ be an odd prime with $p\equiv 1\pmod t$ and $p\nmid t$. Let $q$ be a modulus coprime to $p$, and set $Q=qp$.
The secret key is a ternary polynomial ... | **Existence and uniqueness.** Since $p\nmid t$, $t$ is invertible mod $p$. Because $p$ is odd, the interval $[-(p-1)/2,(p-1)/2]$ contains exactly $p$ consecutive integers. These form a complete residue system mod $p$, so each $u_{k,i}$ exists and is unique.
Consequently $t u_{k,i}\equiv -c_{k,i}\pmod p$, so $\delta_k\... | $M=\dfrac{t(p-1)(1+h)}{2}$; for $t=17$, $p=103$, $h=5$: $M=5202$. | import itertools
def negamul(a,b,n):
r=[0]*n
for i in range(n):
for j in range(n):
k=i+j
if k<n: r[k]+=a[i]*b[j]
else: r[k-n]-=a[i]*b[j]
return r
def bal(x,p):
x%=p
return x-p if x>(p-1)//2 else x
def switch_delta(c,t,p):
tinv=pow(t,-1,p)
return... |
MATH-CRYPTO-000151 | math_competition_problem | Lattice Cryptanalysis | Kannan's embedding technique vs Babai's nearest plane algorithm for CVP | Research Level | Let $q = 10007$ and $N = 1000$. Let $L = q\mathbb{Z}^2 \subset \mathbb{R}^2$, equipped with the ordered (deliberately skewed) basis $\mathbf{b}_1 = (qN, q)$ and $\mathbf{b}_2 = (q, 0)$. This is a basis of $L$, since $\det\begin{pmatrix} N & 1 \\ 1 & 0 \end{pmatrix} = -1$.
For an integer $s$ with $1 \le s \le \lfloor q... | **Step 0 (Gram–Schmidt data).**
- $\mathbf{b}_1^* = \mathbf{b}_1 = q(N, 1)$, so $\|\mathbf{b}_1^*\|^2 = q^2(N^2+1)$.
- $\mathbf{b}_2^* = \mathbf{b}_2 - \mu \mathbf{b}_1$ with $\mu = \langle \mathbf{b}_2, \mathbf{b}_1 \rangle / \|\mathbf{b}_1\|^2 = N/(N^2+1)$. This gives $\mathbf{b}_2^* = \frac{q}{N^2+1}(1, -N)$ and $\|... | (a) Babai's nearest plane succeeds exactly for $s \in \{1, 2, 3, 4, 5\}$. The condition is $Ns \le q/2$, i.e. $s \le \lfloor 10007/2000 \rfloor = 5$; it fails for $6 \le s \le 5003$. (b) Kannan's embedding with $M = 1$ makes $\pm(\mathbf{e}_s, 1)$ the unique shortest vectors of $L'$ for all $1 \le s \le 70$. This follo... | from fractions import Fraction as F
import math
q, N = 10007, 1000
b1 = (q * N, q)
b2 = (q, 0)
def dot(u, v):
return u[0] * v[0] + u[1] * v[1]
# Gram-Schmidt
mu = F(dot(b2, b1), dot(b1, b1))
b1s = (F(b1[0]), F(b1[1]))
b2s = (b2[0] - mu * b1[0], b2[1] - mu * b1[1])
def rnd(x):
# rounding convention: floor(x ... |
MATH-CRYPTO-000216 | math_competition_problem | Zero-Knowledge Proofs | Bulletproofs: inner product arguments without trusted setup and range proofs | Research Level | Let $p$ be a prime and let $n=2^k$ with $k\ge 1$. For $\mathbf{v}\in\mathbb{Z}_p^{m}$ with $m$ even, write $\mathbf{v}_L=(v_0,\dots,v_{m/2-1})$ and $\mathbf{v}_R=(v_{m/2},\dots,v_{m-1})$. Write $\langle\cdot,\cdot\rangle$ for the standard inner product over $\mathbb{Z}_p$.
Let $\mathbf{a}^{(0)}=\mathbf{a}$ and $\mathb... | **(a) Cross-term identity.** Fix $j$ and write $\mathbf{a}=\mathbf{a}^{(j-1)}$, $\mathbf{b}=\mathbf{b}^{(j-1)}$ and $x=x_j$. Expand by bilinearity:
$$\langle x\mathbf{a}_L+x^{-1}\mathbf{a}_R,\;x^{-1}\mathbf{b}_L+x\mathbf{b}_R\rangle=\langle\mathbf{a}_L,\mathbf{b}_L\rangle+x^2\langle\mathbf{a}_L,\mathbf{b}_R\rangle+x^{-... | The scalars satisfy $a^*=\sum_i a_i\prod_{t=1}^k x_t^{(-1)^{\beta_t(i)}}$ and $b^*=\sum_i b_i\prod_{t=1}^k x_t^{-(-1)^{\beta_t(i)}}$. Their product is $a^*b^*=\langle\mathbf{a},\mathbf{b}\rangle+\sum_{j=1}^{k}(x_j^2L_j+x_j^{-2}R_j)$. The proof size is $2\log_2 n$ group elements plus $2$ field elements. | import random
p = 2**61 - 1
inv = lambda x: pow(x, p - 2, p)
ip = lambda u, v: sum(a * b for a, b in zip(u, v)) % p
def run(k):
n = 2**k
a = [random.randrange(p) for _ in range(n)]
b = [random.randrange(p) for _ in range(n)]
xs = [random.randrange(1, p) for _ in range(k)]
A, B = a[:], b[:]
acc... |
MATH-CRYPTO-000119 | math_competition_problem | Differential Privacy | Laplace and Gaussian mechanisms: privacy budget (epsilon, delta) composition theorems | Research Level | Let $\mathcal{D}$ be a data universe and $f:\mathcal{D}\to\mathbb{R}$ a real-valued query. For $\Delta>0$ and $b>0$ the scalar Laplace mechanism is $M^{\mathrm{Lap}}_{f,b}(D)=f(D)+W$ with $W\sim\mathrm{Lap}(b)$; for $\sigma>0$ the scalar Gaussian mechanism is $M^{\mathrm{Gau}}_{f,\sigma}(D)=f(D)+Z$ with $Z\sim N(0,\sig... | Part 1: Laplace composition. For one scalar Laplace mechanism with scale $b$, the density is $p_D(y)=\frac{1}{2b}e^{-|y-f(D)|/b}$. If $|f(D)-f(D')|\le\Delta$, then for all $y$, $p_D(y)/p_{D'}(y)=\exp((|y-f(D')|-|y-f(D)|)/b)\le e^{\Delta/b}$. Hence the mechanism is $(\Delta/b,0)$-DP. For independent composition, densiti... | Laplace: the $k$-fold independent composition of Laplace mechanisms with equal sensitivity $\Delta$ and scale $b$ is exactly $(k\Delta/b,0)$-DP, and the bound is attained by taking the product of lower-tail sets. Gaussian: with $\mu=\Delta^2/(2\sigma^2)$ and $k\mu>0$, the exact composed privacy curve is\n$$\delta_k(\ep... | import math, random
def Phi(x):
return 0.5 * math.erfc(-x / math.sqrt(2.0))
def gaussian_delta(k, eps, Delta, sigma):
if k == 0 or Delta == 0.0 or sigma == math.inf:
return 0.0
mu = Delta * Delta / (2.0 * sigma * sigma)
if mu == 0.0:
return 0.0
s = math.sqrt(2.0 * k * mu)
a = (... |
MATH-CRYPTO-000057 | math_competition_problem | Side-Channel Resistance | Higher-order boolean masking schemes against Differential Power Analysis (DPA) | Research Level | Let $p\in(0,1/2)$ and $n\ge 2$. Let $S\in\mathbb{F}_2$ be a uniform secret bit. An $n$-share Boolean masking of $S$ is the random vector $X=(X_1,\ldots,X_n)\in\mathbb{F}_2^n$ generated by independent uniform masks $R_1,\ldots,R_{n-1}\in\mathbb{F}_2$ via $X_i=R_i$ for $1\le i<n$ and $X_n=S\oplus R_1\oplus\cdots\oplus R_... | Put $q=1-2p$. First consider a proper subset $A\subset[n]$. Conditioned on $S=s$, $X$ is uniform on $H_s=\{x\in\mathbb{F}_2^n: x_1\oplus\cdots\oplus x_n=s\}$. Fix $a\in\mathbb{F}_2^A$. Since $n-|A|\ge1$, exactly $2^{n-|A|-1}$ vectors $x\in H_s$ extend $a$. Therefore $P(X_A=a\mid S=s)=2^{n-|A|-1}/2^{n-1}=2^{-|A|}$, inde... | For $0<p<1/2$, put $q=1-2p$. For $1\le d\le n-1$, $\mathrm{Adv}_d=0$ and $I(S;Y_A)=0$ for every $|A|\le d$. For $d\ge n$, $\mathrm{Adv}_d=q^n/2$; the Bayes-optimal full-share guess is $\hat S=\oplus_{i=1}^n Y_i$, with $P_{\mathrm{succ}}=(1+q^n)/2$, and $I(S;Y_{[n]})=1-H_2((1-q^n)/2)$. Thus an $n$-share Boolean masking ... | import math
from fractions import Fraction
from itertools import product, combinations
from collections import defaultdict
def h2(t):
t = float(t)
if t == 0.0 or t == 1.0:
return 0.0
return -t * math.log2(t) - (1.0 - t) * math.log2(1.0 - t)
def joint_dist(n, p):
dist = defaultdict(Fraction)
... |
MATH-CRYPTO-000050 | math_competition_problem | Block Cipher Cryptanalysis | Integral and boomerang attacks on reduced-round substitution-permutation networks | Research Level | Let $\mathbb{F}=\mathbb{F}_{2^8}$ be the AES field with irreducible polynomial $m(x)=x^8+x^4+x^3+x+1$ (0x11b). Identify a 16-byte state with a $4\times 4$ matrix $A=(a_{r,c})\in\mathbb{F}^{4\times 4}$ in row-major order. Let $S:\mathbb{F}\to\mathbb{F}$ be any bijection. Let $\mathrm{SR}$ denote AES ShiftRows: row $r$ i... | First establish three elementary facts. (1) In $\mathbb{F}_{2^8}$, $\bigoplus_{y\in\mathbb{F}} y=0$: for each bit position, exactly 128 of the 256 field elements have that bit equal to 1, so the XOR of that bit over all elements is $128\bmod 2=0$. (2) If $f:\mathbb{F}\to\mathbb{F}$ is bijective, $a\in\mathbb{F}^\times$... | Integral: For any bijective $S$, any round keys, any active byte position, and any fixed values of the other 15 bytes, the 256 chosen plaintexts with the active byte running through $\mathbb{F}_{2^8}$ satisfy $\bigoplus_{x\in\mathbb{F}} \pi_{r,c}(E_3(P^x))=0$ for every output byte $(r,c)$. Thus $E_3$ has a 3-round inte... | import random
def xtime(a):
a &= 0xff
if a & 0x80:
return ((a << 1) ^ 0x1b) & 0xff
return (a << 1) & 0xff
def gmul(a, b):
p = 0
a &= 0xff
b &= 0xff
for _ in range(8):
if b & 1:
p ^= a
hi = a & 0x80
a = (a << 1) & 0xff
if hi:
a... |
MATH-CRYPTO-000130 | math_competition_problem | Differential Geometry | Ricci flow with surgery and Perelman W-entropy monotonicity | Research Level | Let $(M^n,g(t))_{t\in[a,b]}$ be a smooth closed Ricci flow, $n\ge 2$, satisfying $\partial_t g=-2\operatorname{Ric}(g)$. Let $\tau>0$ satisfy $\dot\tau=-1$ and let $f\in C^\infty(M)$ evolve by the conjugate heat equation $\partial_t f=-R-\Delta f+|\nabla f|^2+\frac{n}{2\tau}$. Define the Perelman $W$-entropy with respe... | Let $u=(4\pi\tau)^{-n/2}e^{-f}$, so that $d\mu=u\,dV_g$ and $\int_M u\,dV_g=1$. Since $\partial_t dV_g=-R\,dV_g$, the normalization condition gives the conjugate heat equation $\partial_t u=-\Delta u+Ru$. Expanding $u=(4\pi\tau)^{-n/2}e^{-f}$ yields $\partial_t f=-R-\Delta f+|\nabla f|^2+\frac{n}{2\tau}$. Put $S=R+|\na... | For a smooth Ricci flow with $\dot\tau=-1$ and $\partial_t f=-R-\Delta f+|\nabla f|^2+\frac{n}{2\tau}$, Perelman's $W$-entropy satisfies \[ \frac{d}{dt}\mathcal W(g,f,\tau)=2\tau\int_M\left|\operatorname{Ric}+\nabla^2 f-\frac{1}{2\tau}g\right|^2d\mu\ge0, \] where $d\mu=(4\pi\tau)^{-n/2}e^{-f}dV_g$. Equality holds iff $... | import math, random
def trace_sq(A):
n=len(A)
return sum(A[i][j]*A[i][j] for i in range(n) for j in range(n))
def mat_add(A,B):
n=len(A)
return [[A[i][j]+B[i][j] for j in range(n)] for i in range(n)]
def mat_sub_scaled_identity(C,tau):
n=len(C)
return [[C[i][j]-(1.0/(2.0*tau) if i==j else 0.0... |
MATH-CRYPTO-000164 | math_competition_problem | Elliptic Curve Theory | Schoof-Elkies-Atkin (SEA) point counting algorithm on elliptic curves over F_p | Research Level | Let $p>3$ be prime and let $E/\mathbb{F}_p: y^2=x^3+ax+b$ with $\Delta=-16(4a^3+27b^2)\neq 0$. Let $\pi$ denote the $p$-power Frobenius endomorphism. Write $\#E(\mathbb{F}_p)=p+1-t$, where $t$ is the trace of Frobenius, so $\pi^2-t\pi+p=0$ in $\mathrm{End}(E)$. For a prime $\ell\neq p$, let $\rho_\ell:\mathrm{Gal}(\ove... | (a) Restricted to $E[\ell]\cong\mathbb{F}_\ell^2$, the Frobenius $\pi$ satisfies $\chi_\ell(\pi)=0$, because $\pi^2-t\pi+p=0$ holds in $\mathrm{End}(E)$ and $\ell\neq p$. Hence $\chi_\ell$ is the characteristic polynomial of $\rho_\ell(\pi)$.
Since $\ell$ is odd, $2$ is invertible in $\mathbb{F}_\ell$. Completing the ... | (a) For an odd prime $\ell\neq p$, $\ell$ is Elkies iff $\left(\frac{t^2-4p}{\ell}\right)\neq-1$; if $\ell\mid t^2-4p$, Frobenius has the double eigenvalue $t/2 \bmod \ell$ and $\ell$ is Elkies.
(b) $t$ is even iff $\gcd(x^p-x,x^3+ax+b)\neq1$.
(c) For $p=11$, $E:y^2=x^3+x+6$: $\#E=13$, $t=-1$ (odd, so the cubic has no ... | p,a,b=11,1,6
assert (4*a**3+27*b**2)%p!=0
f=lambda x:(x**3+a*x+b)%p
sq={(y*y)%p for y in range(1,p)}
N=1+sum(2 if f(x) in sq else (1 if f(x)==0 else 0) for x in range(p))
t=p+1-N
assert N==13 and t==-1 and t*t<=4*p
# mod 2 step
has_root=any(f(x)==0 for x in range(p))
assert (t%2==0)==has_root
def leg(n,l):
n%=l
... |
MATH-CRYPTO-000131 | math_competition_problem | Differential Geometry | Bochner-Weitzenbock formulas and Lichnerowicz-Obata eigenvalue bounds | Research Level | Let $(M^n,g)$ be a closed, connected, smooth Riemannian manifold without boundary, with $n\ge 2$. Let $\nabla$ denote the Levi-Civita connection, $\operatorname{Hess} f=\nabla df$, and let the Laplace-Beltrami operator be $\Delta=\operatorname{tr}_g\operatorname{Hess}$ with sign convention $\Delta f=-\lambda f$ for eig... | Use the sign convention $\Delta=\operatorname{tr}_g\operatorname{Hess}$ and $\Delta f=-\lambda f$. Let $f$ be a nonconstant eigenfunction for $\lambda_1$, so that
$$\Delta f=-\lambda f,\qquad \int_M f\,d\mathrm{vol}_g=0,\qquad \lambda=\lambda_1.$$
The Bochner-Weitzenbock identity states
$$\frac12\Delta |\nabla f|^2=|\o... | For every closed connected Riemannian $n$-manifold with $\operatorname{Ric}\ge (n-1)K\,g$, $K>0$, one has $\lambda_1\ge nK$. Equality $\lambda_1=nK$ occurs exactly for the round sphere $S^n(1/\sqrt K)$ of constant sectional curvature $K$. | import math
import random
def dot(u, v):
return sum(a * b for a, b in zip(u, v))
def norm(u):
return math.sqrt(dot(u, u))
def unit_vector(dim):
while True:
v = [random.uniform(-1.0, 1.0) for _ in range(dim)]
s = norm(v)
if s > 1e-8:
return [x / s for x in v]
def check... |
MATH-CRYPTO-000212 | math_competition_problem | Zero-Knowledge Proofs | KZG polynomial commitments, batch opening proofs, and BLS12-381 pairings | Research Level | Let r = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001 be the BLS12-381 scalar-field modulus and let \mathbb{F}_r be the field with r elements. Let G_1 = \langle g_1 \rangle and G_2 = \langle g_2 \rangle be cyclic groups of order r, and let e : G_1 \times G_2 \to G_T be the nondegenerate bilinear BL... | Completeness. Since I_S interpolates the asserted values, if they are correct then P-I_S is divisible by Z_S by the factor theorem, and the quotient Q_S is a polynomial with deg Q_S <= d-m when deg P <= d. Commitment linearity gives C_P-I_S(\tau)g_1=(P(\tau)-I_S(\tau))g_1=(Q_S(\tau)Z_S(\tau))g_1. Bilinearity of e yield... | Over \mathbb{F}_r, Z_S(X)=X^3-6X^2+11X-6, I_S(X)=8X^2-8X+10, Q_S(X)=1. At \tau=5, C_P=194, I_S(5)=170, Z_S(5)=24, Q_S(5)=1; the verification check is e(g_1,24g_2)=e(24g_1,g_2). Exact final pair: (I_S,Q_S)=(8X^2-8X+10,1). | import math
r = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
def norm(p):
return [c % r for c in p]
def add_poly(a,b):
n=max(len(a),len(b))
res=[0]*n
for i in range(n):
av=a[i] if i<len(a) else 0
bv=b[i] if i<len(b) else 0
res[i]=(av+bv)%r
return res
... |
MATH-CRYPTO-000091 | math_competition_problem | Lattice Cryptanalysis | Kannan's embedding technique vs Babai's nearest plane algorithm for CVP | Research Level | Let \(\lfloor x\rceil\) denote the nearest integer to \(x\) (there will be no ties below). Put \(b_1=(3,0)\), \(b_2=(1,1)\), \(L=\mathbb Z b_1\oplus\mathbb Z b_2\subset\mathbb R^2\), and \(t=(7/5,2/5)\). For an ordered basis \(B=(b_1,\ldots,b_n)\) with Gram-Schmidt vectors \(b_i^*=b_i-\sum_{j<i}\mu_{i,j}b_j^*\), Babai'... | (a) The Gram-Schmidt vectors are \(b_1^*=(3,0)\) and \(b_2^*=b_2-\frac{\langle b_2,b_1^*\rangle}{\|b_1^*\|^2}b_1^*=(1,1)-\frac{3}{9}(3,0)=(0,1)\). For \(t=(7/5,2/5)\), the Babai coefficients are computed from \(i=2\) down to \(1\). First, \(\langle t,b_2^*\rangle/\|b_2^*\|^2=2/5\), whose nearest integer is \(0\). Thus ... | Babai returns \((0,0)\) with squared error \(53/25\), whereas the unique closest vector is \(b_2=(1,1)\) with distance \(d(t,L)=\sqrt{13}/5\), so Babai is not optimal. For \(M=1\), \(\lambda_1(L_1)^2=38/25\), and the shortest nonzero vectors are \(\pm(-2/5,3/5,-1)\); they certify the CVP solution \(b_2\). The certifyin... | from fractions import Fraction as F
def dot(u, v):
return sum(x * y for x, y in zip(u, v))
def sqnorm(u):
return dot(u, u)
def round_frac(x):
if x >= 0:
return (2 * x.numerator + x.denominator) // (2 * x.denominator)
return -round_frac(-x)
def babai(B, t):
n = len(B)
bstar = []
m... |
MATH-CRYPTO-000032 | math_competition_problem | Zero-Knowledge Proofs | KZG polynomial commitments, batch opening proofs, and BLS12-381 pairings | Research Level | Let $r$ denote the prime order of the scalar field of BLS12-381, $r=0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001$. Let $\mathbb{G}_1,\mathbb{G}_2,\mathbb{G}_T$ be cyclic groups of order $r$ with generators $g_1,g_2$ and a nondegenerate bilinear pairing $e:\mathbb{G}_1\times\mathbb{G}_2\to\mathbb{G... | (a) Since $I(z_i)=y_i=f(z_i)$, the polynomial $f-I$ vanishes at each $z_i$, so $Z\mid f-I$ and $q\in\mathbb{F}_r[X]$ with $\deg q\le d-m$. Evaluating at $\tau$ gives $f(\tau)-I(\tau)=q(\tau)Z(\tau)$. Thus $C_f/C_I=g_1^{f(\tau)-I(\tau)}=g_1^{q(\tau)Z(\tau)}$, and bilinearity gives $e(C_f/C_I,g_2)=e(g_1^{q(\tau)Z(\tau)},... | The multi-point batch KZG verification equation is $e(C_f/C_I,g_2)=e(\pi,D_Z)$, equivalently $e(C_f/C_I,g_2)=e(\pi,g_2^{Z(\tau)})$, where $Z(X)=\prod_{i=1}^{m}(X-z_i)$ and $I(X)=\sum_{k=0}^{m-1}a_kX^k$ is the interpolation polynomial with $I(z_i)=y_i$. The verifier computes $C_I=\prod_{k=0}^{m-1}(g_1^{\tau^k})^{a_k}$ a... | # Simulated KZG over the BLS12-381 scalar field; group exponents replace pairings.
r = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
def trim(a):
a = [x % r for x in a]
while len(a) > 1 and a[-1] == 0:
a.pop()
return a
def poly_add(a, b):
n = max(len(a), len(b))
c = [0... |
MATH-CRYPTO-000147 | math_competition_problem | Post-Quantum Cryptography | Falcon NTRU-lattice fast Fourier orthogonalization and trapdoor sampling | Research Level | Let \(n=2^k\), let \(R=\mathbb{Z}[x]/(x^n+1)\), and let \(q\) be an odd prime. Let \(f,g\in R_q\) with \(f\in R_q^\times\), and define the public NTRU key \(h=g f^{-1}\bmod q\). Let \(F,G\in R\) satisfy the Falcon NTRU equation
\[ fG-gF=q \]
as an identity in \(R\). Define
\[ B=\begin{pmatrix} g & -f \\ G & -F \end{... | 1. The row inclusion is immediate in \(R_q\): for \(b_0=(g,-f)\),
\[ g+(-f)h=g-f(g f^{-1})=0\pmod q; \]
and for \(b_1=(G,-F)\), using \(fG-gF=q\),
\[ G+(-F)h=G-Fg f^{-1}=\frac{Gf-Fg}{f}=\frac{fG-gF}{f}=q f^{-1}\equiv 0\pmod q. \]
Thus the rows of \(B\) lie in \(\Lambda_{h,q}\). The reduction map \((u,v)\mapsto u+v ... | For every \(\zeta\in\mu_{2n}\setminus\mu_n\),
\[ f_\zeta G_\zeta-g_\zeta F_\zeta=q,\qquad \det B(\zeta)=q, \]
\[ \mu_\zeta=\frac{G_\zeta\overline{g_\zeta}+F_\zeta\overline{f_\zeta}}{|g_\zeta|^2+|f_\zeta|^2}, \]
\[ \|b_1^*(\zeta)\|^2=\frac{q^2}{|g_\zeta|^2+|f_\zeta|^2}. \]
The aggregate Falcon fast-Fourier orthogona... | import math, cmath
from fractions import Fraction
def ring_mul(a,b,n):
c=[0]*n
for i,ai in enumerate(a):
if ai==0:
continue
for j,bj in enumerate(b):
if bj==0:
continue
k=i+j
if k<n:
c[k]+=ai*bj
else:
... |
MATH-CRYPTO-000176 | math_competition_problem | Memory Safety Theory | Control Flow Integrity (CFI): forward-edge label verification and shadow stack bounds | Research Level | Let $\mathcal{F}_A,\mathcal{F}_B,\mathcal{F}_C$ be pairwise disjoint sets with $|\mathcal{F}_X|=2$ for $X\in\{A,B,C\}$. The successor map is $A^+=B$, $B^+=C$, $C^+=A$. Every function $f\in\mathcal{F}_X$ contains exactly one indirect call site whose forward-edge CFI label is $X^+$, and every function $g\in\mathcal{F}_Y$... | Identify a legal trace with a walk of length $N$ on the rooted complete binary tree $\mathcal{T}_3$ of height $3$: the root represents the initial function (depth $d=0$); each node at depth $d<3$ has two children, corresponding to the two legal indirect-call targets; moving to a child is a call and has two choices, whi... | $T(10)=4608$. | from functools import lru_cache
def count_traces(N, S=3, m=2):
dp = [0] * (S + 1)
dp[0] = 1
for _ in range(N):
ndp = [0] * (S + 1)
for d, c in enumerate(dp):
if c == 0:
continue
if d > 0:
ndp[d - 1] += c
if d < S:
... |
MATH-CRYPTO-000183 | math_competition_problem | Algebraic Number Theory | Chebotarev density theorem applications to Galois group determination | Research Level | Let $f(x)=x^4-x-1\in\mathbb{Z}[x]$, let $L$ be the splitting field of $f$ over $\mathbb{Q}$, and let $G=\operatorname{Gal}(L/\mathbb{Q})$ acting on the four roots of $f$. For a rational prime $p$ with $p\nmid\operatorname{disc}(f)$, write the factorization of $f$ modulo $p$ as $\bar f(x)=\prod_{i=1}^{r} \bar f_i(x)$ wi... | Step 1: Compute the discriminant. For $x^4+px+q$ the discriminant is $\Delta=-27p^4+256q^3$. Here $p=-1$ and $q=-1$, hence $\Delta=-27-256=-283$. Since $-283$ is not a square in $\mathbb{Q}$, the Galois group $G$ is not contained in $A_4$; this is a useful consistency check, although the explicit $4$-cycle below alread... | The Galois group is $G\cong S_4$. The discriminant is $\operatorname{disc}(f)=-283$. The Chebotarev densities for factorization types are: $(1,1,1,1)$: $1/24$; $(1,1,2)$: $1/4$; $(2,2)$: $1/8$; $(1,3)$: $1/3$; $(4)$: $1/4$. Finite certificate: $p=2$ gives type $(4)$, so $G$ contains a $4$-cycle; $p=7$ gives type $(1,3)... | import math
def primes_upto(N):
sieve=[True]*(N+1)
if N>=0:
sieve[0]=False
if N>=1:
sieve[1]=False
for i in range(2,int(math.isqrt(N))+1):
if sieve[i]:
for j in range(i*i,N+1,i):
sieve[j]=False
return [i for i in range(2,N+1) if sieve[i]]
def pol... |
MATH-CRYPTO-000136 | math_competition_problem | Harmonic Analysis | Bilinear restriction estimates for paraboloids and cone conjectures | Research Level | For $f\in L^2(\mathbb{R})$ with compact support, define the extension operator for the parabola $P=\{(\xi,\xi^2):\xi\in\mathbb{R}\}\subset\mathbb{R}^2$ by
$$Ef(x,t)=\int_{\mathbb{R}} f(\xi)\,e^{i(x\xi+t\xi^2)}\,d\xi,\qquad (x,t)\in\mathbb{R}^2.$$
Let $I,J\subset\mathbb{R}$ be compact intervals with $\delta=\operatornam... | Step 0 (Plancherel convention). For $F\in L^1\cap L^2(\mathbb{R}^2)$ put $\check F(x,t)=\int_{\mathbb{R}^2}F(u,v)e^{i(xu+tv)}\,du\,dv$. Plancherel's theorem with this normalization gives $\|\check F\|_{L^2}^2=(2\pi)^2\|F\|_{L^2}^2$.
Step 1 (Writing the product as one integral). Since $f\in L^2(I)\subset L^1$ and $g\in... | $\|EfEg\|_2^2=2\pi^2\iint|f(a)|^2|g(b)|^2|a-b|^{-1}\,db\,da\le (2\pi^2/\delta)\|f\|_2^2\|g\|_2^2$. For $f=\mathbf 1_{[0,1]}$, $g=\mathbf 1_{[2,3]}$ the value is $2\pi^2\ln(27/16)=2\pi^2(3\ln 3-4\ln 2)\approx 10.3277$. | import math, random
# 1) Double integral K = int_0^1 int_2^3 db da/(b-a) via 2D midpoint rule
N = 800
h = 1.0 / N
K = 0.0
for i in range(N):
a = (i + 0.5) * h
for j in range(N):
b = 2 + (j + 0.5) * h
K += 1.0 / (b - a)
K *= h * h
K_exact = 3 * math.log(3) - 4 * math.log(2)
assert abs(K - K_exac... |
MATH-CRYPTO-000205 | math_competition_problem | Combinatorics & Graph Theory | Tutte polynomial evaluations, chromatic polynomials, and matroids | Research Level | Let G=K_4 be the complete graph on V={1,2,3,4} with edge set E=binom(V,2), so |E|=6. For A subset E let c(A) be the number of connected components of the spanning subgraph (V,A), including isolated vertices, and set r(A)=|V|-c(A). Put r(E)=|V|-c(E)=3. The Tutte polynomial of G is T_G(x,y)=sum_{A subset E} (x-1)^{r(E)-r... | Write N_{i,j} for the number of edge sets A subset E with i=|A|-r(A) and j=r(E)-r(A). For K_4, n=4, m=6, r(E)=3. If s=|A| and k=c(A), then i=s-4+k and j=k-1. Enumerating by s gives: s=0: k=4, count 1, (i,j)=(0,3). s=1: k=3, count 6, (0,2). s=2: all 15 two-edge sets are forests with k=2, so count 15, (0,1). s=3: the 16 ... | T_{K_4}(x,y)=x^3+3x^2+2x+4xy+2y+3y^2+y^3. P_{K_4}(q)=q(q-1)(q-2)(q-3). F_{K_4}(q)=(q-1)(q-2)(q-3). tau(K_4)=T(1,1)=16. alpha(K_4)=T(2,0)=24. T(2,1)=38 (number of forests). F_{K_4}(4)=6. The matroid M(K_4) is self-dual because T_{K_4}(x,y) is symmetric in x and y. | import itertools, collections
n = 4
vertices = list(range(n))
edges = [(i, j) for i in range(n) for j in range(i + 1, n)]
m = len(edges)
def components(A):
parent = list(range(n))
def find(x):
while parent[x] != x:
parent[x] = parent[parent[x]]
x = parent[x]
return x
... |
MATH-CRYPTO-000252 | math_competition_problem | Symplectic Geometry | Gromov-Witten invariants, quantum cohomology, and pseudoholomorphic curves | Research Level | Let $X=\mathbb{CP}^2$ with Fubini-Study form, $H^*(X;\mathbb{Q})=\mathbb{Q}[h]/(h^3)$, basis $T_0=1,T_1=h,T_2=h^2$, and $\int_X h^2=1$. For $d\ge1$ let $N_d=\mathrm{GW}^X_{0,3d-1,d[L]}(h^2,\dots,h^2)$ be the genus-zero Gromov-Witten invariant with $3d-1$ point insertions. It is enumerative: it counts rational degree-$d... | Step 1 (metric). $g_{ij}=1$ iff $i+j=2$, so $g^{kl}=g_{kl}$ and $T_i*T_j=\sum_k\Phi_{ijk}T_{2-k}$.
Step 2 (third derivatives). Write $\Phi=\Phi_{cl}+\Gamma(t_1,t_2)$ with $\Phi_{cl}=\tfrac12(t_0^2t_2+t_0t_1^2)$. Then $\Phi_{002}=1$, $\Phi_{011}=1$, and every other classical third derivative vanishes. $\Gamma$ does not... | Recursion: $N_d=\sum_{a+b=d}N_aN_b\,a^2b\left[b\binom{3d-4}{3a-2}-a\binom{3d-4}{3a-1}\right]$ with $N_1=1$. This gives $N_2=1$, $N_3=12$, and $N_4=620$. | from math import comb
import sympy as sp
def N(dmax):
n={1:1}
for d in range(2,dmax+1):
n[d]=sum(n[a]*n[d-a]*(a*a*(d-a)**2*comb(3*d-4,3*a-2)-a**3*(d-a)*comb(3*d-4,3*a-1)) for a in range(1,d))
return n
n=N(6)
assert n[2]==1 and n[3]==12 and n[4]==620 and n[5]==87304
# Independent check: verify WDV... |
MATH-CRYPTO-000211 | math_competition_problem | Lattice Cryptanalysis | Kannan's embedding technique vs Babai's nearest plane algorithm for CVP | Research Level | Let $N\ge 2$ be an integer and set $D=N^2+1$. In $\mathbb R^2$, let $L_N$ be the lattice with column basis $B_N=(b_1,b_2)$, where $b_1=(N,1)^{T}$ and $b_2=(N+1,1)^{T}$. Let $t_N=(N+1-1/D,\,1+N/D)^{T}$. Define Babai's nearest-plane algorithm for a basis with Gram-Schmidt vectors $b_i^{*}$ and coefficients $\mu_{i,j}$: s... | Proof. Since $\det B_N=N\cdot 1-(N+1)\cdot1=-1$, the lattice generated by the columns of $B_N$ is all of $\mathbb Z^2$. Write $b_1=(N,1)^T$, $b_2=(N+1,1)^T$. The first Gram-Schmidt vector is $b_1^{*}=b_1$, and $\|b_1^{*}\|^2=N^2+1=D$. Also $\langle b_1,b_2\rangle=N(N+1)+1=N^2+N+1$, hence $\mu=\mu_{2,1}=\langle b_1,b_2\... | For every integer $N\ge2$: Babai returns $b_1=(N,1)^T$ with squared error $N^2/(N^2+1)$; the exact CVP vector is $b_2=(N+1,1)^T$ with squared error $1/(N^2+1)$. Kannan embedding with $\tau=1/2$ has shortest nonzero vectors $\pm(((N+1,1)^T-t_N)^T,1/2)$, squared norm $1/4+1/(N^2+1)$, and recovers $b_2$ from the shortest ... | from fractions import Fraction
def round_fraction(x):
n = x.numerator
d = x.denominator
q = n // d
r = n - q * d
if 2 * r >= d:
return q + 1
return q
def dist2(a, b):
return (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
def babai(B, t):
n = len(B)
dim = len(B[0])
bs = []
... |
MATH-CRYPTO-000235 | math_competition_problem | Memory Safety Theory | Information-theoretic entropy limits of Address Space Layout Randomization (ASLR) | Research Level | Model an ASLR-protected service as follows. A secret base offset $L$ is drawn from a distribution $p$ on $\mathcal{A}=\{0,1,\dots,N-1\}$, where $N=2^n$ and $n$ is the number of entropy bits. An attacker issues probes $g_1,g_2,\dots\in\mathcal{A}$. Probe $t$ succeeds iff $g_t$ equals the offset currently in force. A fai... | Step 1 (R1 reduces to a deterministic order). In R1 every failed probe returns the same observation, namely 'crash'. So until the first success, the history is constant. A deterministic strategy is therefore just a fixed sequence $g_1,g_2,\dots$. A randomized strategy is a mixture of such sequences, and $\mathbb{E}[T]$... | (a) $\min\mathbb{E}[T]=G(p)=\sum_i i\,p_{(i)}$. For uniform $p$ this is $\frac{2^n+1}{2}$, and $\Pr[T\le t]=t/2^n$. (b) $\Pr[T\le t]=1-(1-2^{-n})^t$ and $\mathbb{E}[T]=2^n$ for every strategy. (c) $t^*_1=2^{n-1}$ and $t^*_2=\lceil \ln 2/(-\ln(1-2^{-n}))\rceil\in(2^n\ln2-1,\,2^n\ln2+1]$. For $n=28$: $G=134217728.5$, $t^... | import math, itertools, random
from fractions import Fraction
def expected_T_perm(p, perm):
return sum(Fraction(i+1)*p[a] for i,a in enumerate(perm))
def guessing_entropy(p):
s = sorted(p, reverse=True)
return sum(Fraction(i+1)*x for i,x in enumerate(s))
# (a) brute force over all permutations for random... |
MATH-CRYPTO-000172 | math_competition_problem | Formal Verification | Dafny / Separation Logic for heap-manipulating program memory safety verification | Research Level | Work in the standard heap model of separation logic. A heap is a finite partial function $h : \mathbb{N}_{>0} \rightharpoonup_{fin} \mathbb{Z}$. Two heaps $h_1,h_2$ are disjoint ($h_1 \perp h_2$) if $\mathrm{dom}(h_1)\cap\mathrm{dom}(h_2)=\emptyset$, and then $h_1 \uplus h_2$ is their union. The address $0$ is $\mathsf... | (a) We use induction on $|\mathrm{dom}(h)|$.
Base case: $\mathrm{dom}(h)=\emptyset$. The second disjunct requires $x\mapsto z$, which needs a nonempty heap, so it cannot hold. Hence the first disjunct holds, $s(x)=s(y)$, and $h=\emptyset$ is unique. Moreover $y\notin\emptyset$.
Inductive step: $|\mathrm{dom}(h)|=k+1$... | (a) Models of $\mathsf{ls}(x,y)$ are unique given $x$, $y$ and the domain, and they are acyclic with $y\notin\mathrm{dom}(h)$. (b) $N(n)=\sum_{k=0}^{n} n!/k! = \lfloor e\, n!\rfloor$ for $n\ge1$, with $N(0)=1$; the first values are $1,2,5,16,65,326$. (c) The triple $\{\mathsf{ls}(x,\mathsf{nil})\}\mathsf{Free}(x)\{\mat... | import itertools, math
def ls(h, x, y, seen=frozenset()):
# returns True iff heap h (dict) exactly satisfies ls(x,y)
if x == y:
return len(h) == 0
if x not in h:
return False
z = h[x]
h2 = {k: v for k, v in h.items() if k != x}
return ls(h2, z, y)
def N_brute(n):
A = list(r... |
MATH-CRYPTO-000006 | math_competition_problem | Analytic Number Theory | Hardy-Littlewood circle method for ternary Goldbach and Waring problems | Research Level | For an integer $q\ge 1$ and an integer $N$, let $c_q(N)=\sum_{1\le a\le q,\ \gcd(a,q)=1} e(aN/q)$ be the Ramanujan sum, where $e(x)=e^{2\pi i x}$. Let $\mu$ be the M\u00f6bius function and $\varphi$ Euler's totient function. The ternary Goldbach singular series is\n$$\mathfrak{S}(N)=\sum_{q=1}^{\infty}\frac{\mu(q)\,c_q... | Step 1 (Ramanujan sums at primes). The full sum $\sum_{a=0}^{p-1}e(aN/p)$ equals $p$ if $p\mid N$ and $0$ otherwise. Removing the term $a=0$, which contributes $1$, gives $c_p(N)=p-1$ if $p\mid N$ and $c_p(N)=-1$ if $p\nmid N$.\n\nStep 2 (part (a)). By orthogonality, $\frac1p\sum_{t=0}^{p-1}e(tm/p)=[p\mid m]$. Hence\n$... | $T_p(N)=(p-1)(p-2)$ if $p\mid N$, and $T_p(N)=p^2-3p+3$ if $p\nmid N$. The singular series is $\mathfrak{S}(N)=\prod_{p\mid N}\big(1-\frac{1}{(p-1)^2}\big)\prod_{p\nmid N}\big(1+\frac{1}{(p-1)^3}\big)$. Hence $\mathfrak{S}(N)=0$ for even $N$. For odd $N$, $\mathfrak{S}(N)\ge 2C_2\approx 1.3203>C_2\approx 0.6601618$. | import cmath, math\n\ndef primes(n):\n s=[True]*(n+1); s[0]=s[1]=False\n for i in range(2,int(n**0.5)+1):\n if s[i]:\n for j in range(i*i,n+1,i): s[j]=False\n return [i for i in range(n+1) if s[i]]\n\ndef T(p,N):\n return sum(1 for a in range(1,p) for b in range(1,p) for c in range(1,p) if... |
MATH-CRYPTO-000076 | math_competition_problem | Harmonic Analysis | Bilinear restriction estimates for paraboloids and cone conjectures | Research Level | Let \(I,J\subset[-1,1]\) be measurable sets with \(\delta:=\inf\{|\eta-\xi|:\xi\in I,\ \eta\in J\}>0\). For \(f\in L^2(I)\) and \(g\in L^2(J)\), define the one-dimensional paraboloid extension operators
\[
(Ef)(x,t)=\int_I f(\xi)e^{2\pi i(x\xi+t\xi^2)}\,d\xi,\qquad
(Eg)(x,t)=\int_J g(\eta)e^{2\pi i(x\eta+t\eta^2)}\,d\e... | Proof. Assume first that \(I,J\) are compact intervals with \(\eta>\xi\) for all \(\xi\in I,\eta\in J\); the general measurable case follows by approximation and monotone convergence. Define the bilinear phase map
\[
\Phi(\xi,\eta)=(u,v)=(\xi+\eta,\xi^2+\eta^2),\qquad (\xi,\eta)\in I\times J.
\]
Its Jacobian is
\[
\det... | The sharp bilinear \(L^2\) extension estimate for the separated one-dimensional paraboloid caps is
\[
\int_{B_R} |(Ef)(Eg)|^2\,dx\,dt
\le \frac{1}{2\delta}\|f\|_{L^2(I)}^2\|g\|_{L^2(J)}^2,
\]
with best uniform constant \(C(\delta)=1/(2\delta)\), where \(\delta={\rm dist}(I,J)\). In fact the exact global identity is
\[
... | import math
import random
def check_inequality():
delta = 1.0
I = (-1.0, -0.5)
J = (0.5, 1.0)
n = 160
dxi = (I[1] - I[0]) / n
deta = (J[1] - J[0]) / n
xi = [I[0] + (i + 0.5) * dxi for i in range(n)]
eta = [J[0] + (j + 0.5) * deta for j in range(n)]
random.seed(12345)
f = [rando... |
MATH-CRYPTO-000268 | math_competition_problem | Post-Quantum Cryptography | SPHINCS+ stateless hash-based signatures, WOTS+, and FORS tree structures | Research Level | Consider the following simplified but faithful verification-cost model for a SPHINCS+-style stateless hash-based signature. Let n=32 bytes and let H:{0,1}^{8n}\to{0,1}^{8n} be an ideal random oracle; each invocation of H costs one hash evaluation. Let w=16 and v=\log_2(w)=4. For a WOTS+ instance define len_1=\lceil 8n/... | Proof. 1. FORS verification. A FORS tree of height a contains a selected leaf and an authentication path of a siblings. The verifier first hashes the revealed leaf secret to get the leaf value, costing 1 call. Then at each of the a levels it hashes the current node with the appropriate sibling to obtain its parent, cos... | \boxed{\mathbb{E}[C_{\mathrm{ver}}]=98+8\left(525-\frac{1}{16^{64}}\sum_{s=0}^{960}N_s\left(\left\lfloor\frac{960-s}{256}\right\rfloor+\left\lfloor\frac{(960-s)\bmod 256}{16}\right\rfloor+((960-s)\bmod 16)\right)\right)} where N_s=[x^s](1+x+\cdots+x^{15})^{64}. Equivalently, with G(x)=\lfloor x/256\rfloor+\lfloor(x\bmo... | import random
from fractions import Fraction
n = 32
w = 16
v = 4
len1 = (8*n + v - 1)//v
x = len1*(w-1)
len2 = 0
p = 1
while p <= x:
p *= w
len2 += 1
L = len1 + len2
def digit_sum_base(x, base, length):
s = 0
for _ in range(length):
s += x % base
x //= base
return s
assert n == 32... |
MATH-CRYPTO-000046 | math_competition_problem | Cryptographic Hash Functions | Keccak sponge capacity, rate, and resistance against multi-collision attacks | Research Level | Let $r,c\ge 1$ and $b=r+c$. Identify $\{0,1\}^b$ with pairs $(x,y)\in\{0,1\}^r\times\{0,1\}^c$. Call $x=\mathrm{rate}(s)$ the outer part and $y=\mathrm{cap}(s)$ the inner (capacity) part of $s=(x,y)$. Let $f:\{0,1\}^b\to\{0,1\}^b$ be a permutation.
For a message $M=(m_1,\dots,m_n)$ of $n$ blocks $m_i\in\{0,1\}^r$ (pad... | Notation: write $\hat m=m\|0^c$. Note that $\mathrm{cap}(s\oplus\hat m)=\mathrm{cap}(s)$ and $\mathrm{rate}(s\oplus\hat m)=\mathrm{rate}(s)\oplus m$.
(a) Let $M\neq M'$ have length $n$, with traces $(s_i)$, $(s'_i)$ and $s_n=s'_n$.
Step 1 (choosing an index). Define $J=\{i\in\{1,\dots,n\}: s_{i-1}\neq s'_{i-1}\text{ ... | Every equal-length full-state collision contains an inner collision. Conversely, each inner collision $(u,u')$ is completed by the unique correction block $\beta'=\beta\oplus\mathrm{rate}(u)\oplus\mathrm{rate}(u')$. Chaining $t$ inner collisions gives a $2^t$-multicollision of $2t$-block messages. Hence a $K$-multicoll... | import random, itertools
r, c = 4, 4
b = r + c
RM = (1 << r) - 1
def cap(s):
return s >> r
def rate(s):
return s & RM
def trace(f, M):
s = [0]
for m in M:
s.append(f[s[-1] ^ m]) # m||0^c is m in the low (rate) bits
return s
def build(seed, t):
rng = random.Random(seed)
f = list... |
MATH-CRYPTO-000256 | math_competition_problem | Harmonic Analysis | Bilinear restriction estimates for paraboloids and cone conjectures | Research Level | For $h \in L^2(\mathbb{R})$ with compact support, define the extension operator for the parabola $P=\{(\xi,\xi^2):\xi\in\mathbb{R}\}$ by
$$Eh(x,t)=\int_{\mathbb{R}} h(\xi)\,e^{i(x\xi+t\xi^2)}\,d\xi,\qquad (x,t)\in\mathbb{R}^2.$$
Fix $D>0$. Let $f,g\in L^2(\mathbb{R})$ be compactly supported, with $\operatorname{supp} f... | **(a) Change of variables.**
Since $f,g$ are compactly supported and in $L^2$, they are in $L^1$, so we may write
$$Ef(x,t)\,Eg(x,t)=\int\!\!\int_{\xi\le a,\ \eta\ge a+D} f(\xi)g(\eta)\,e^{i(x(\xi+\eta)+t(\xi^2+\eta^2))}\,d\xi\,d\eta.$$
The integrand vanishes outside the region $R=\{\xi\le a,\ \eta\ge a+D\}$.
Conside... | (a) $\|Ef\,Eg\|_{L^2}^2=2\pi^2\iint |f(\xi)|^2|g(\eta)|^2/|\eta-\xi|\,d\xi\,d\eta$. (b) $C(D)=\pi\sqrt{2/D}$; it is sharp but not attained by nonzero functions. (c) $\|Ef\,Eg\|_2^2=2\pi^2(3\ln3-4\ln2)=2\pi^2\ln(27/16)\approx 10.33$. | import math, random
# 1) Jacobian of (xi,eta)->(xi+eta, xi^2+eta^2) equals 2(eta-xi), checked by finite differences
for _ in range(100):
x = random.uniform(-3, 0); y = random.uniform(1, 4); h = 1e-6
U = lambda a, b: (a + b, a * a + b * b)
ux = [(U(x + h, y)[k] - U(x - h, y)[k]) / (2 * h) for k in range(2)]... |
MATH-CRYPTO-000124 | math_competition_problem | Analytic Number Theory | Zero-free regions of the Riemann zeta function and PNT error bounds | Research Level | Let \zeta(s) denote the Riemann zeta function. A nontrivial zero is a zero \rho=\beta+i\gamma with 0<\beta<1. Let \Lambda(n) be the von Mangoldt function and \psi(x)=\sum_{n\le x}\Lambda(n), right-continuous at prime powers. Assume the classical zero-free region: there exists c>0 such that for every t\in\mathbb{R}, \ze... | Proof. Put L=\log x and T=e^{\sqrt L}. We assume x large, L\ge L_0; the finite range 3\le x<e^{L_0} is handled at the end. If T equals an ordinate of a zero, replace T by T+1/2; this changes the explicit formula by a single zero term O(x^\beta), which is absorbed below, and changes constants only.
Lemma (truncated exp... | With L=\log x, the zero-free region \zeta(\sigma+it)\ne0 for \sigma\ge1-c/\log(|t|+2) implies
\psi(x)=x+O\left(x e^{-C_2\sqrt{\log x}}\right)
for all x\ge3, where C_2=C_2(c)>0. For sufficiently large x one may take C_2=c/8 (and enlarge the implied constant to cover all x\ge3). Equivalently, |\psi(x)-x|\le C_1 x e^{-C_2... | import math
C = 0.01
C2 = C / 8.0
C1 = 1000.0
gammas = [14.134725141734693, 21.022039638771555, 25.010857580145688, 30.424876125859513, 32.93506158773919, 37.58617815882567, 40.9187190121475, 43.32707328091499, 48.00515088116716, 49.7738324776723]
for gamma in gammas:
beta = 0.5
rhs = 1.0 - C / math.log(abs(gam... |
MATH-CRYPTO-000199 | math_competition_problem | Homological Algebra | Derived categories, triangulated categories, and tilting complexes | Research Level | Let $k$ be a field and $n \geq 1$. Let $Q = \vec{A}_n$ be the linearly oriented quiver $1 \to 2 \to \cdots \to n$. Let $A = kQ$ be its path algebra, which is finite-dimensional and hereditary. Hence $D^b(\mathrm{mod}\,A)$ has a Serre functor $\mathbb{S} = - \otimes^{\mathbf{L}}_A DA$, and $A$ is a tilting object in it.... | Step 1 (Cartan matrix). The paths starting at $i$ are the trivial path $e_i$ and the paths $i \to \cdots \to j$ for $j > i$. Hence $\underline{\dim}\,P(i) = \sum_{j \geq i} e_j$, so $C_{ji} = 1$ if $j \geq i$ and $C_{ji} = 0$ otherwise. Thus $C$ is the lower unitriangular all-ones matrix. Dually, $I(i)$ is supported on... | $C$ is the lower unitriangular all-ones matrix and $C^{-1} = I - N$. $\Phi = -C^{T}C^{-1}$ is the companion matrix: $\Phi e_i = e_{i+1}$ for $i < n$ and $\Phi e_n = -\sum_j e_j$. Its characteristic polynomial is $\chi_\Phi(t) = 1 + t + \cdots + t^n$. The order of $\Phi$ is exactly $n+1$; for $n = 1$, $\Phi = (-1)$ has ... | from fractions import Fraction
def cartan(n):
return [[1 if j>=i else 0 for i in range(n)] for j in range(n)]
def matmul(A,B):
n=len(A);m=len(B[0]);p=len(B)
return [[sum(A[i][k]*B[k][j] for k in range(p)) for j in range(m)] for i in range(n)]
def inv(M):
n=len(M);A=[[Fraction(x) for x in r]+[Fraction... |
MATH-CRYPTO-000084 | math_competition_problem | Combinatorics & Graph Theory | Lovász Local Lemma: algorithmic Moser-Tardos constructive formulations | Research Level | Let K_7=(V,E) be the complete graph on 7 vertices, so |V|=7 and |E|=21. Fix q=29 and let \Omega=[q]^V be equipped with the uniform product measure. For every edge e=\{u,v\}\in E define the bad event B_e=\{\omega\in\Omega: \omega(u)=\omega(v)\}. Consider the Moser-Tardos resampling algorithm: initialize \omega\sim\Omega... | Formal setup. Let H be the dependency graph on E: distinct e,f\in E are adjacent iff e\cap f\neq\emptyset. Since K_7 is complete, each edge e has 2(7-2)=10 neighboring edges, so \Delta(H)=10. For each e, \Pr[B_e]=1/q, since the two endpoint colors agree with probability 1/q. Set x=1/(\Delta(H)+1)=1/11 and x_e=x for all... | For K_7 with q=29 and symmetric witness x_e=1/11, the Moser-Tardos algorithm terminates almost surely and \mathbb{E}[T]\leq 21/10=2.1. The witness inequality holds exactly because 11^{11}=285,311,670,611\leq 290,000,000,000=29\cdot 10^{10}. For q=28 the same witness fails since 11^{11}=285,311,670,611>280,000,000,000=2... | import random
from fractions import Fraction
n = 7
q = 29
m = n * (n - 1) // 2
D = 2 * (n - 2)
x = Fraction(1, D + 1)
p = Fraction(1, q)
rhs = x * (1 - x) ** D
assert p <= rhs
assert 11 ** 11 <= 29 * 10 ** 10
assert Fraction(1, 28) > rhs
bound = m * x / (1 - x)
assert bound == Fraction(21, 10)
edges = [(i, j) for i i... |
MATH-CRYPTO-000279 | math_competition_problem | Threshold Cryptography | FROST Schnorr threshold signatures and distributed key generation (DKG) | Research Level | Let q be prime, let G=⟨g⟩ be a cyclic group of prime order q, written multiplicatively. Let n≥1 and t with 1≤t≤n<q. Let F_q be the field of exponents. FROST-DKG: each dealer i∈[n] samples f_i(X)=a_{i,0}+a_{i,1}X+...+a_{i,t-1}X^{t-1}∈F_q[X]; broadcasts A_{i,k}=g^{a_{i,k}} for k=0,...,t-1; sends s_{i,j}=f_i(j) to party j... | 1. Closed-form Lagrange coefficients. For S={1,...,s} and i∈S, λ_i^S=∏_{j=1,j≠i}^s (0-j)/(i-j). The numerator is ∏_{j≠i}(-j)=(-1)^{s-1}s!/i. The denominator is ∏_{j≠i}(i-j)=(i-1)!·(-1)^{s-i}(s-i)!. Therefore λ_i^S=(-1)^{i-1}s!/(i!(s-i)!)=(-1)^{i-1}C(s,i) mod q. Also Σ_{i=1}^s (-1)^{i-1}C(s,i)=1, because (1-1)^s=Σ_{i=0}... | For S={1,...,s}, λ_i^S=(-1)^{i-1}C(s,i) mod q for 1≤i≤s. If f has degree at most t-1 and s≥t, then f(0)=Σ_{i=1}^s λ_i^S f(i). In FROST, with R=∏_{i∈S}D_iE_i^{ρ_i}, r=Σ_{i∈S}(d_i+ρ_i e_i), and z=Σ_{i∈S}z_i, one has z=r+c f(0) mod q and hence g^z=R Y^c. Edge cases: t=1 gives λ_1=1 for a single signer; t=n forces S=[n] an... | import math, random, hashlib
def inv_mod(x, q):
x %= q
assert x != 0, 'division by zero in modular inverse'
return pow(x, q-2, q)
def lagrange_naive(S, i, q):
assert len(set(S)) == len(S), 'duplicate index in signer set'
num = 1
den = 1
for j in S:
if j == i:
continue
... |
MATH-CRYPTO-000231 | math_competition_problem | Formal Verification | Hoare logic, loop invariants, and automated verification with Z3 SMT bitvectors | Research Level | Let \mathbb{B}_{32} = \{0,1,\ldots,2^{32}-1\} with arithmetic modulo 2^{32}. For an odd integer a \in \mathbb{B}_{32}, consider the following algorithm:
x := 1
for k = 0 to 4 do
x := (x \cdot (2 - a \cdot x)) \bmod 2^{32}
end for
(a) Prove the loop invariant: after k iterations (0 \le k \le 5), the current value ... | Let a \in \mathbb{B}_{32} be odd. Define x_0 = 1 and for k \ge 0, x_{k+1} \equiv x_k (2 - a x_k) \pmod{2^{32}}. We prove by induction that for all k \ge 0, x_k a \equiv 1 \pmod{2^{2^k}}.
Base case (k=0): x_0 a = a \equiv 1 \pmod{2} since a is odd.
Inductive step: Assume x_k a \equiv 1 \pmod{2^{2^k}}. Let y = x_k a. T... | 5 iterations. The loop invariant is x_k \cdot a \equiv 1 \pmod{2^{2^k}} for k=0,\ldots,5. For a=3, x_4 = 4294945451, and 3 \cdot x_4 \equiv 4294901761 \not\equiv 1 \pmod{2^{32}}. | from z3 import *
def verify_step(k):
exp_in = 2**k
exp_out = 2**(k+1)
mod_in = 2**exp_in
mod_out = 2**exp_out
a = BitVec('a', 32)
x = BitVec('x', 32)
xp = x * (BitVecVal(2, 32) - a * x)
odd = (a & 1) == 1
if exp_in < 32:
mod_in_mask = BitVecVal(mod_in - 1, 32)
inv_in... |
MATH-CRYPTO-000018 | math_competition_problem | Representation Theory | Characters of compact Lie groups and Weyl-Kac character formulas | Research Level | Let $G=SU(3)$ with maximal torus $T$ of diagonal matrices. Let $\mathfrak{g}=\mathfrak{sl}_3(\mathbb{C})$ have simple roots $\alpha_1,\alpha_2$, positive roots $\Phi^+=\{\alpha_1,\alpha_2,\theta=\alpha_1+\alpha_2\}$, fundamental weights $\omega_1,\omega_2$, Weyl vector $\rho=\omega_1+\omega_2=\theta$ and Weyl group $W\... | Step 1 (partition function). Write $\nu=x\alpha_1+y\alpha_2$. A decomposition $\nu=a\alpha_1+b\alpha_2+c\theta$ with $a,b,c\ge0$ forces $a=x-c$ and $b=y-c$. Hence $\mathcal{P}(\nu)=\min(x,y)+1$ if $x,y\ge0$ are integers, and $\mathcal{P}(\nu)=0$ otherwise. Here $\min(x,y)+1$ counts the admissible values $c=0,\dots,\min... | $m_{n\omega_1+n\omega_2}(0)=n+1$ | def P(x,y):
if x<0 or y<0: return 0
return min(x,y)+1
def kostant_zero(n):
k=n+1
# (coords of w(theta) in simple roots, sign)
orbit=[((1,1),1),((0,1),-1),((1,0),-1),((-1,0),1),((0,-1),1),((-1,-1),-1)]
return sum(s*P(k*a-1,k*b-1) for (a,b),s in orbit)
def gt_zero(n):
top=(2*n,n,0); cnt=0
... |
MATH-CRYPTO-000250 | math_competition_problem | Differential Geometry | Ricci flow with surgery and Perelman W-entropy monotonicity | Research Level | Let $M$ be a closed oriented $n$-manifold, $n\ge 2$, with a smooth time-dependent Riemannian metric $g(t)$ on $[0,T)$. Let $\operatorname{Ric}$, $R$, $\nabla$, $\Delta$, and $dV_g$ denote the Ricci tensor, scalar curvature, gradient, Laplace-Beltrami operator, and volume measure. For a smooth function $f$ and a positiv... | 1. Variation of the weighted measure. Under $\partial_t g=-2\operatorname{Ric}$ one has $\partial_t dV_g=R\,dV_g$. Also $\partial_t(4\pi\tau)^{-n/2}=\frac{n}{2\tau}(4\pi\tau)^{-n/2}$ because $\partial_t\tau=-1$. Hence $$ \partial_t d\mu=\left(R+\Delta f-|\nabla f|^2\right)d\mu. $$
2. Entropy variation. Set $Q=\tau(|\n... | Between surgeries, $$ \frac{d}{dt}W(g,f,\tau)=2\tau\int_M\left|\operatorname{Ric}+\operatorname{Hess}f-\frac{1}{2\tau}g\right|^2d\mu\ge 0. $$ For the round shrinking $S^2$ solution with $r(t)^2=r_0^2-2t$, $\tau(t)=r(t)^2/2$, and $f(t)=\log 2$, one has $W(t)=\log 2-1$ for all $t\in[0,T)$. Consequently $W$ is constant in... | import math
import random
def entropy_round_sphere(t, r0=1.0):
r2 = r0*r0 - 2.0*t
assert r2 > 0.0
tau = r2/2.0
f = math.log(2.0)
R = 2.0/r2
vol = 4.0*math.pi*r2
norm = vol/(4.0*math.pi*tau)*math.exp(-f)
integrand = tau*R + f - 2.0
W = integrand*norm
ric_eigen = 1.0/r2
cap = ... |
MATH-CRYPTO-000223 | math_competition_problem | Homomorphic Encryption | TFHE bitwise bootstrapping via external products over Torus polynomials | Research Level | Work over the discretized torus $\mathbb{T}_q = \mathbb{Z}/q\mathbb{Z}$ with $q = 2^{32}$, identified with $q^{-1}\mathbb{Z}/\mathbb{Z} \subset \mathbb{R}/\mathbb{Z}$.
Let $N$ be a power of two and set
- $\mathcal{R} = \mathbb{Z}[X]/(X^N+1)$, and
- $\mathcal{T}_q = \mathbb{T}_q[X]/(X^N+1)$.
Note that $X^{2N} = 1$ and... | **(a) External-product phase identity.**
Row $r$ of $Z$ is a TRLWE sample $(\alpha_r, \alpha_r z + e_r)$, so its phase is $e_r$.
Adding $\mu g_j$ to the $A$-component of row $j$ changes the phase by $-\mu g_j z$. Adding $\mu g_j$ to the $B$-component of row $\ell + j$ changes the phase by $+\mu g_j$.
The phase map i... | The constant coefficient of $X^{-t}v$ is $q/8$ for $t \in [0, N)$ and $-q/8$ for $t \in [N, 2N)$.
If $|e|\cdot 2N/q + (n+1)/2 < N/2$ (and the blind-rotation noise stays below $q/16$), the bootstrapped LWE sample has phase $\tfrac{q}{8}(1-2m) + \text{noise}$. In other words, it is a fresh encryption of $\neg m$ in $\pm... | import random
q = 1 << 32
N = 64; n = 8; L = 3; BB = 8; Bg = 1 << BB
random.seed(1)
def pmul(a, b):
r = [0]*N
for i in range(N):
ai = a[i]
if ai == 0: continue
for j in range(N):
k = i + j
if k < N: r[k] += ai*b[j]
else: r[k-N] -= ai*b[j]
return [x... |
MATH-CRYPTO-000239 | math_competition_problem | Differential Privacy | Laplace and Gaussian mechanisms: privacy budget (epsilon, delta) composition theorems | Research Level | Let $\mathcal{X}$ be a data universe. Datasets $D, D' \in \mathcal{X}^n$ are neighbors, written $D\sim D'$, if they differ in exactly one record. A randomized mechanism $M$ is $(\varepsilon,\delta)$-DP if for all $D\sim D'$ and all measurable $S$, $\Pr[M(D)\in S]\le e^{\varepsilon}\Pr[M(D')\in S]+\delta$. Equivalently,... | Step 1 (one-dimensional hockey-stick divergence). Let $P=\mathcal{N}(m,1)$ and $Q=\mathcal{N}(0,1)$ with $m>0$. The log-likelihood ratio is $\ln(p/q)(x)=mx-m^2/2$. Hence $p-e^{\varepsilon}q>0$ if and only if $x>x^*:=\varepsilon/m+m/2$. Therefore
$$H_{e^\varepsilon}(P\|Q)=P(x>x^*)-e^\varepsilon Q(x>x^*)=\Phi(m-x^*)-e^{\... | With $\mu=\sqrt{k}\Delta/\sigma$, the tight privacy profile is $\delta(\varepsilon)=\Phi(-\varepsilon/\mu+\mu/2)-e^{\varepsilon}\Phi(-\varepsilon/\mu-\mu/2)$. This bound holds under adaptivity and is attained when every step has full sensitivity. Edge cases: $\delta(0)=2\Phi(\mu/2)-1$; $\delta\to0$ as $\varepsilon\to\i... | import math, random
def Phi(x):
return 0.5*math.erfc(-x/math.sqrt(2))
def delta_formula(eps, mu):
return Phi(-eps/mu+mu/2) - math.exp(eps)*Phi(-eps/mu-mu/2)
def npdf(x, m):
return math.exp(-(x-m)**2/2)/math.sqrt(2*math.pi)
def delta_numeric(eps, m, N=200000, L=40.0):
# direct integration of hockey-s... |
MATH-CRYPTO-000155 | math_competition_problem | Zero-Knowledge Proofs | STARKs: Algebraic Intermediate Representation (AIR) and FRI low-degree testing | Research Level | Let $p = 97$ and $\mathbb{F} = \mathbb{F}_{97}$. Note $96 = 2^5\cdot 3$, and $g = 5$ generates $\mathbb{F}^*$.
(a) AIR. Let $n = 8$ and $\omega = g^{96/8} = 5^{12} \bmod 97$, a primitive 8th root of unity, with $H = \langle\omega\rangle$. Consider the Fibonacci-type trace $t_0 = 1$, $t_1 = 1$, $t_{i+2} = t_{i+1}^2 + t... | Step 0 (setup). The value is $\omega = 5^{12} \bmod 97 = 64$. Its order is exactly 8: $64^2 = 4096 \equiv 22$, $22^2 = 484 \equiv 96 = -1$, so $\omega^4 = -1 \neq 1$ and $\omega^8 = 1$.
Step 1 (trace). Working modulo 97:
- $t_2 = 1+1 = 2$.
- $t_3 = 4+1 = 5$.
- $t_4 = 25+2 = 27$.
- $t_5 = 729+5 = 734 \equiv 734-679 = 5... | (a) $Z_D \mid C$, $\deg Q \le 8$, and $t_7 = 43$ (trace: 1,1,2,5,27,55,45,43). (b) $\mathrm{Fold}_\beta(f)(x^2) = \frac{f(x)+f(-x)}{2}+\beta\frac{f(x)-f(-x)}{2x}$, and each fold halves the degree bound. (c) The final FRI constant is $46$. | p=97
w=pow(5,12,p)
assert pow(w,8,p)==1 and pow(w,4,p)!=1
t=[1,1]
for i in range(6): t.append((t[-1]**2+t[-2])%p)
assert t[7]==43
def mul(a,b):
r=[0]*(len(a)+len(b)-1)
for i,x in enumerate(a):
for j,y in enumerate(b): r[i+j]=(r[i+j]+x*y)%p
return r
def add(a,b):
n=max(len(a),len(b));a=a+[0]*(n-l... |
MATH-CRYPTO-000254 | math_competition_problem | Complex Analysis | Bieberbach conjecture, de Branges theorem, and Loewner evolution | Research Level | Let $\mathbb{D}=\{|z|<1\}$. Let $\kappa:[0,\infty)\to\partial\mathbb{D}$ be measurable, and write $\kappa(t)=e^{i\theta(t)}$. A radial Loewner chain driven by $\kappa$ is a family $f(z,t)=e^{t}\big(z+\sum_{n\ge 2}a_n(t)z^n\big)$ of univalent maps on $\mathbb{D}$. It satisfies the Loewner PDE
$$\partial_t f(z,t)=z\,\par... | **(a) Derivation of the coefficient formulas.**
Expand the kernel: $\frac{1+\kappa z}{1-\kappa z}=1+2\kappa z+2\kappa^2z^2+O(z^3)$.
We also have $z\partial_z f=e^t(z+2a_2z^2+3a_3z^3+\dots)$.
The right-hand side of the PDE is therefore
$$e^t\big[z+(2a_2+2\kappa)z^2+(3a_3+4\kappa a_2+2\kappa^2)z^3+\dots\big].$$
The le... | $a_2=-2\int_0^\infty e^{-t}\kappa\,dt$ and $a_3=4\big(\int_0^\infty e^{-t}\kappa\,dt\big)^2-2\int_0^\infty e^{-2t}\kappa^2dt$. Moreover $\operatorname{Re}a_3\le3$ (hence $|a_3|\le3$), with equality iff $\kappa\equiv\pm1$ a.e. (the Koebe functions $z/(1\mp z)^2$). For $\kappa=e^{i\omega t}$: $a_2=-2/(1-i\omega)$ and $a_... | import cmath, math, random
def coeffs_piecewise(ts, ks):
# kappa = ks[j] on [ts[j], ts[j+1]); last piece extends to infinity
A = 0j; B = 0j
for j, k in enumerate(ks):
t0 = ts[j]
if j + 1 < len(ks):
t1 = ts[j+1]
e1, e2 = math.exp(-t1), math.exp(-2*t1)
else:
... |
MATH-CRYPTO-000219 | math_competition_problem | Threshold Cryptography | FROST Schnorr threshold signatures and distributed key generation (DKG) | Research Level | Let $\mathbb{G}=\langle g\rangle$ be a cyclic group of prime order $q$, written multiplicatively. A Pedersen-style DKG, as used in FROST, runs among $n$ parties with threshold $t$ ($1\le t\le n<q$). Each party $i\in[n]$ samples $f_i(x)=\sum_{k=0}^{t-1}a_{i,k}x^k\in\mathbb{Z}_q[x]$, broadcasts the commitments $C_{i,k}=g... | (a) Fix $i$. If party $i$ is honest, $g^{f_i(j)}=g^{\sum_k a_{i,k}j^k}=\prod_k C_{i,k}^{j^k}$, so every honest share is accepted. Summing over dealers gives $x_j=F(j)$, where $F$ has degree at most $t-1$ and $F(0)=\sum_i a_{i,0}$. Hence $Y=g^{F(0)}$.
Take any $S$ with $|S|=m\ge t$. The Lagrange basis polynomials over ... | (a) $g^z=R\,Y^c$, since $\sum_{i\in S}\lambda_ix_i=F(0)$ whenever $|S|\ge t$.
(b) The identity also holds trivially when $t=1$ ($\lambda_i=1$, $x_i=F(0)$). For $t\ge 2$ and $|S|=t-1$, the shares are independent of $F(0)$, and the identity holds with probability only $1/q$.
(c) DKG share verification costs $(n-1)t=\Th... | import random, hashlib
# Schnorr group: p=2q+1, both prime
q=1019; p=2*q+1
assert all(q%d for d in range(2,32)) and all(p%d for d in range(2,46))
g=4 # quadratic residue, so it has order q
assert pow(g,q,p)==1 and g!=1
def H(*a):
return int(hashlib.sha256(repr(a).encode()).hexdigest(),16)%q
def ev(f,x):
return... |
MATH-CRYPTO-000237 | math_competition_problem | Side-Channel Resistance | Higher-order boolean masking schemes against Differential Power Analysis (DPA) | Research Level | **Setting (Boolean masking of order $d$).** Let $d \ge 0$ and $n = d+1$. A secret bit $X \in \{0,1\}$ is encoded by an $n$-share Boolean sharing $(X_1,\dots,X_n) \in \{0,1\}^n$ generated as follows. Draw $X_1,\dots,X_{n-1}$ independently and uniformly from $\{0,1\}$, independently of $X$. Then set
$$X_n = X \oplus X_1 ... | **Step 0 (spin variables).** Put $Y_i = 1 - 2X_i \in \{\pm 1\}$ and $s = (-1)^X$. Then:
- $\prod_{i=1}^n Y_i = (-1)^{\sum_i X_i} = (-1)^{X} = s$;
- $\sum_i X_i = (n - S)/2$, where $S = \sum_{i=1}^n Y_i$.
Writing $L_0 = \sum_i X_i$, we get $L_0 - n/2 = -S/2$.
**Step 1 (monomial lemma).** For $T \subseteq [n]$ write $Y... | Results:
- For $1 \le k \le d$: $M_k(0) = M_k(1)$ for every $\sigma$.
- Order $d+1$: $\Delta_{d+1} = \dfrac{(-1)^{d+1}(d+1)!}{2^{d}}$, independent of $\sigma$.
- Noise-free, all $k$: $\Delta_k(n,0) = \dfrac{(-1)^k}{2^{n+k-1}}\sum_{j=0}^n(-1)^j\binom{n}{j}(n-2j)^k$, which vanishes if $k < n$ or $k \not\equiv n \pmod 2$.... | import itertools
import math
from fractions import Fraction
def sharings(n, x):
for t in itertools.product([0, 1], repeat=n - 1):
last = x ^ (sum(t) % 2)
yield tuple(t) + (last,)
def nf_moment(n, k, x):
tot = Fraction(0)
cnt = 0
for sh in sharings(n, x):
tot += (Fraction(sum(sh... |
MATH-CRYPTO-000140 | math_competition_problem | Homological Algebra | Spectral sequences: Serre, Grothendieck, and Adams spectral sequences | Research Level | Let $S^3$ be the 3-sphere with basepoint $*$. Let $PS^3=\{\omega:[0,1]\to S^3 : \omega(0)=*\}$ be the path space, let $\pi:PS^3\to S^3$ be $\pi(\omega)=\omega(1)$, and let $\Omega S^3=\pi^{-1}(*)$ be the loop space. Then $\Omega S^3\to PS^3\to S^3$ is a Serre fibration, $PS^3$ is contractible, and $S^3$ is simply conne... | **Step 0: the shape of the $E_2$ page.**
$H^*(S^3;\mathbb{Z})$ is free. It equals $\mathbb{Z}$ in degrees $0$ and $3$ and vanishes otherwise. Since the base is simply connected, the local coefficients are trivial. By the universal coefficient theorem,
$$E_2^{p,q}\cong H^p(S^3)\otimes H^q(\Omega S^3).$$
For any $M$, $\... | (a) $H^n(\Omega S^3;\mathbb{Z})\cong\mathbb{Z}$ for $n$ even and $0$ for $n$ odd. (b) $H^*(\Omega S^3;\mathbb{Z})\cong\Gamma_{\mathbb{Z}}[x]$ with $|x|=2$, $\gamma_a\gamma_b=\binom{a+b}{a}\gamma_{a+b}$, and $x^k=k!\,\gamma_k$. (c) $H^{10}/\langle x^5\rangle\cong\mathbb{Z}/120$, so the order is $120$. | from fractions import Fraction
from math import comb, factorial
# Model the E_3 page over Q: column 0 has basis g_k (degree 2k),
# column 3 has basis u*g_k. Realize g_k = x^k / k! inside Q[x].
# The derivation d3 sends x^k to k * u * x^(k-1), i.e. d3 = u * d/dx.
N = 12
def gamma(k):
# polynomial in x as {exponent... |
MATH-CRYPTO-000247 | math_competition_problem | Algebraic Geometry | Grothendieck duality and Serre duality on coherent sheaves | Research Level | Let $k$ be a field and let $X \subset \mathbb{P}^n_k$ be a smooth complete intersection of hypersurfaces of degrees $d_1,\dots,d_c$, with $\dim X = r = n-c \geq 1$. Write $\mathcal{O}_X(m)$ for the restriction of $\mathcal{O}_{\mathbb{P}^n}(m)$.\n\n(a) Using Grothendieck duality for the closed immersion $i: X \hookrigh... | (a) Since $i$ is finite, $i^!\mathcal{G} = \overline{i^*} R\mathcal{H}om(i_*\mathcal{O}_X,\mathcal{G})$. Take $\mathcal{G} = \omega_{\mathbb{P}^n}[n] = \mathcal{O}(-n-1)[n]$; then $\omega_X^\bullet = i^!\omega_{\mathbb{P}^n}[n]$. Locally $X$ is cut out by a regular sequence $f_1,\dots,f_c$, so $i_*\mathcal{O}_X$ is res... | (a) $\omega_X \cong \mathcal{O}_X(\sum_j d_j - n - 1)$. (b) For a quartic K3 surface: $h^2(\mathcal{O}_X(m)) = 0$ if $m>0$, $1$ if $m=0$, $2m^2+2$ if $m<0$; in particular $h^2(\mathcal{O}_X(-3)) = 20$. | from math import comb\nfrom itertools import product\n\ndef b3(a):\n return comb(a,3) if a>=3 else 0\n\ndef h0_P3(t):\n return b3(t+3)\n\ndef h0_X(t):\n return h0_P3(t)-h0_P3(t-4) if t>=0 else 0\n\ndef count_monomials(t):\n if t<0: return 0\n return sum(1 for e in product(range(t+1),repeat=4) if sum(e)==... |
MATH-CRYPTO-000142 | math_competition_problem | Topology & Dynamics | Furstenberg multiple recurrence theorem and Szemerédi's theorem | Research Level | Let \(E \subset \mathbb{Z}\) be a set of positive upper Banach density, i.e.,
\[
d^*(E) := \limsup_{N\to\infty} \sup_{a\in\mathbb{Z}} \frac{|E \cap \{a+1,\dots,a+N\}|}{N} > 0.
\]
Prove Szemerédi's theorem: For every integer \(k\ge 1\), there exist \(a\in\mathbb{Z}\) and \(n\ge 1\) such that
\[
\{a, a+n, \dots, a+(k-1... | We prove Szemerédi's theorem assuming Furstenberg's multiple recurrence theorem.
Step 1: Furstenberg correspondence principle.
Let \(E \subset \mathbb{Z}\) with \(d^*(E) > 0\). Set \(\delta = d^*(E)\). By definition of upper Banach density, there exists a sequence of integers \(a_N\) and \(N \to \infty\) such that
\[
... | Szemerédi's theorem holds: every subset of the integers with positive upper Banach density contains arbitrarily long arithmetic progressions. | import itertools
import math
import random
N = 10
E_base = {0,1,2,3,4,5}
E_per = set()
for m in range(-10, 11):
for x in E_base:
E_per.add(x + m*N)
v = [1 if i in E_base else 0 for i in range(N)]
orbit = set()
for shift in range(N):
shifted = tuple(v[(i+shift)%N] for i in range(N))
orbit.add(shift... |
MATH-CRYPTO-000241 | math_competition_problem | Algebraic Number Theory | Dedekind zeta functions, ideal class groups, and the analytic class number formula | Research Level | Let $K=\mathbb{Q}(\sqrt{-23})$, let $\mathcal O_K$ be its ring of integers, let $\mathrm{Cl}_K$ be the ideal class group of $\mathcal O_K$, and set $h_K=|\mathrm{Cl}_K|$. Let $w_K$ be the number of roots of unity in $K$, and let $D_K$ be the discriminant of $K$. For $\Re s>1$ define
$$\zeta_K(s)=\sum_{\mathfrak a\subse... | 1. Because $-23\equiv1\pmod4$, the ring of integers is $\mathcal O_K=\mathbb Z[\omega]$ with $\omega=\frac{1+\sqrt{-23}}2$. Its minimal polynomial is $x^2-x+6$, and the discriminant of the basis $\{1,\omega\}$ is $(\omega-\bar\omega)^2=(\sqrt{-23})^2=-23$; hence $D_K=-23$.
2. Write a unit as $\alpha=\frac{a+b\sqrt{-23}... | For $K=\mathbb Q(\sqrt{-23})$: $D_K=-23$, $w_K=2$, $\mathrm{Cl}_K\cong\mathbb Z/3\mathbb Z$, $h_K=3$, $\zeta_K(0)=-3/2$, and $\operatorname{Res}_{s=1}\zeta_K(s)=3\pi/\sqrt{23}$. | import math
D = -23
assert D == -23
# Count reduced primitive positive definite binary quadratic forms of discriminant D.
forms = []
limit = int(math.isqrt(-D)) + 2
for a in range(1, limit + 1):
for b in range(-a, a + 1):
if (b*b - D) % (4*a) != 0:
continue
c = (b*b - D) // (4*a)
... |
MATH-CRYPTO-000214 | math_competition_problem | Zero-Knowledge Proofs | Plonk arithmetization: grand product permutation arguments and copy constraints | Research Level | Let $\mathbb{F}=\mathbb{F}_p$ be a prime field. Let $H=\{\omega^0,\dots,\omega^{n-1}\}$ be a multiplicative subgroup of order $n$. Let $k_1=1,k_2,\dots,k_m\in\mathbb{F}^*$ be chosen so that the cosets $k_jH$ are pairwise disjoint. Put $D=\bigsqcup_j k_jH$, so $|D|=N=mn$.
A witness is given by $m$ columns $f_j:H\to\mat... | **Product formula.** First note that the prefactors telescope. Hence $Z(\omega^n)=\prod_{i=0}^{n-1}\prod_j\frac{f_j(\omega^i)+\beta k_j\omega^i+\gamma}{f_j(\omega^i)+\beta\sigma_j(\omega^i)+\gamma}$.
Writing $d=k_j\omega^i$ and taking the product over all $d\in D$, this is
$$Z(\omega^n)=\frac{A(\beta,\gamma)}{B(\beta,... | Completeness holds. Soundness error is $\le N/p$ with $N=mn$. The identity permutation is always accepted when denominators are nonzero. The prover needs $O(mn)$ multiplications plus one inversion. In the concrete instance, exactly 95 of the 9409 pairs are accepted (those with $\beta=0$ and $\gamma\notin\{93,94\}$). | p=97;n=4;w=22
assert pow(w,4,p)==1 and pow(w,2,p)!=1
ks=[1,5]
H=[pow(w,i,p) for i in range(n)]
D=[k*h%p for k in ks for h in H]
assert len(set(D))==8
f={D[0]:3,D[5]:4}
f={d:f.get(d,0) for d in D}
sig={d:d for d in D};a,b=1,5*w%p;sig[a],sig[b]=b,a
def acc(be,ga):
Z=1
for i in range(n):
num=den=1
... |
MATH-CRYPTO-000002 | math_competition_problem | Algebraic Number Theory | Artin reciprocity and class field theory over global function fields | Research Level | Let $q$ be an odd prime power, $A=\mathbb{F}_q[T]$, $K=\mathbb{F}_q(T)$, and let $m\in A$ be monic irreducible of degree $d\ge 1$. Let $K(\Lambda_m)$ be the $m$-th Carlitz cyclotomic function field, obtained by adjoining the $m$-torsion $\Lambda_m$ of the Carlitz module $C_T(x)=Tx+x^q$. Recall the Artin isomorphism $\s... | (a) $(A/m)^\times\cong\mathbb{F}_{q^d}^\times$ is cyclic of even order $q^d-1$, so by Galois theory and $\sigma$ there is a unique index-2 subgroup $H=((A/m)^\times)^2$, hence a unique quadratic subfield $L=K(\Lambda_m)^H$. $P$ splits completely in $L$ iff $\mathrm{Frob}_P|_L=1$ iff $\sigma_{P\bmod m}\in H$ iff $P$ is ... | (a),(b) $L=K(\sqrt{m^*})$ with $m^*=(-1)^{d(q-1)/2}m$; (c) $\left(\frac{P}{Q}\right)\left(\frac{Q}{P}\right)=(-1)^{\frac{q-1}{2}\deg P\deg Q}$; (d) $N=4$. | import itertools
p=3
def trim(a):
a=list(a)
while a and a[-1]%p==0: a.pop()
return a
def mod(a,b):
a=trim(a);b=trim(b)
inv=pow(b[-1],p-2,p)
while len(a)>=len(b):
c=a[-1]*inv%p;s=len(a)-len(b)
for i in range(len(b)): a[s+i]=(a[s+i]-c*b[i])%p
a=trim(a)
return a
def mul(... |
MATH-CRYPTO-000300 | math_competition_problem | Differential Privacy | Renyi differential privacy and privacy amplification by subsampling | Research Level | Definitions. For probability measures $P \ll Q$ on $\mathbb{R}$ with densities $p,q$ and order $\alpha>1$, the Renyi divergence is $D_\alpha(P\|Q)=\frac{1}{\alpha-1}\log \mathbb{E}_{x\sim Q}\left[\left(\frac{p(x)}{q(x)}\right)^{\alpha}\right]$. A mechanism $M$ satisfies $(\alpha,\varepsilon)$-RDP if $D_\alpha(M(D)\|M(D... | Step 1 (likelihood ratio). Let $\varphi_\mu$ denote the $\mathcal{N}(\mu,\sigma^2)$ density. Then $\frac{p(x)}{q(x)}=(1-q)+qL(x)$, where $L(x)=\frac{\varphi_1(x)}{\varphi_0(x)}=\exp\left(\frac{x^2-(x-1)^2}{2\sigma^2}\right)=\exp\left(\frac{2x-1}{2\sigma^2}\right)$.
Step 2 (binomial expansion). For integer $\alpha$, th... | $D_\alpha(P\|Q)=\frac{1}{\alpha-1}\log\sum_{k=0}^{\alpha}\binom{\alpha}{k}(1-q)^{\alpha-k}q^k e^{k(k-1)/(2\sigma^2)}$. For $q=1/2$, $\sigma=1$, $\alpha=3$: $D_3=\frac{1}{2}\ln\frac{4+3e+e^3}{8}\approx 0.69689$. | import math
def A_closed(alpha, q, s):
return sum(math.comb(alpha, k) * (1 - q) ** (alpha - k) * q ** k * math.exp(k * (k - 1) / (2 * s * s)) for k in range(alpha + 1))
def A_numeric(alpha, q, s, lo=-40.0, hi=40.0, n=200000):
h = (hi - lo) / n
tot = 0.0
for i in range(n + 1):
x = lo + i * h
... |
MATH-CRYPTO-000310 | math_competition_problem | Differential Geometry | Ricci flow with surgery and Perelman W-entropy monotonicity | Research Level | Let $(M^n,g)$ be a closed Riemannian manifold, $f\in C^\infty(M)$, $\tau>0$. Perelman's W-entropy is
$$\mathcal{W}(g,f,\tau)=\int_M\left[\tau(R+|\nabla f|^2)+f-n\right](4\pi\tau)^{-n/2}e^{-f}\,dV_g.$$
Under the coupled system $\partial_t g=-2\,\mathrm{Ric}$, $\partial_t f=-\Delta f+|\nabla f|^2-R+\frac{n}{2\tau}$, $\pa... | (a) Under $\partial_t g=-2\mathrm{Ric}$, $\partial_t dV=\frac12\mathrm{tr}_g(\partial_t g)dV=-R\,dV$. Then
$\partial_t\left[(4\pi\tau)^{-n/2}e^{-f}dV\right]=\left(-\frac n2\frac{\dot\tau}{\tau}-\partial_t f-R\right)dm=\left(\frac{n}{2\tau}+\Delta f-|\nabla f|^2+R-\frac n{2\tau}-R\right)dm=(\Delta f-|\nabla f|^2)dm.$
Si... | $\mathcal W_n=\frac n2\ln\frac{n-1}{2\pi}+\ln\frac{2\pi^{(n+1)/2}}{\Gamma((n+1)/2)}-\frac n2$, constant in $t$; for $n=3$: $\mathcal W=\ln 2+\frac12\ln\pi-\frac32\approx-0.23480$. | import math
def omega(n):
return 2*math.pi**((n+1)/2)/math.gamma((n+1)/2)
def W(n, t):
tau = 1/(2*(n-1)) - t
vol = (2*(n-1)*tau)**(n/2)*omega(n)
c = math.log(vol*(4*math.pi*tau)**(-n/2))
mass = (4*math.pi*tau)**(-n/2)*math.exp(-c)*vol
assert abs(mass-1) < 1e-12
R = n*(n-1)/(2*(n-1)*tau)
... |
MATH-CRYPTO-000244 | math_competition_problem | Analytic Number Theory | Zero-free regions of the Riemann zeta function and PNT error bounds | Research Level | Let \( \zeta(s) \) denote the Riemann zeta function and let \( \psi(x)=\sum_{n\le x}\Lambda(n) \) be the Chebyshev function. Fix constants \( c>0 \) and \( T_0\ge 2 \), and assume the zero-free region
\[ \zeta(\sigma+it)\ne 0 \qquad\text{whenever } |t|\ge T_0 \text{ and } \sigma\ge 1-\frac{c}{\log(|t|+2)}. \]
Prove tha... | Put \( L=\log x \) and, for large \( x \), set
\[ y=\frac{\sqrt c}{4}\sqrt L,\qquad T=e^y,\qquad \sigma_0=1-\frac{c}{2y}. \]
Write \( A=\sqrt c/8 \) and \( B=\sqrt c/4 \), so \( y=B\sqrt L \) and \( B=2A \). For \( x\le x_0(c,T_0) \) there are only finitely many values to check, so after replacing \( C \) by a larger c... | Under the zero-free region \( \zeta(\sigma+it)\ne 0 \) for \( |t|\ge T_0 \) and \( \sigma\ge 1-c/\log(|t|+2) \), there exists \( C=C(c,T_0)>0 \) such that for all \( x\ge 3 \),
\[ |\psi(x)-x|\le C x\exp\!\left(-\frac{\sqrt c}{8}\sqrt{\log x}\right). \]
Equivalently,
\[ \psi(x)=x+O_{c,T_0}\!\left(x\exp\!\left(-\frac{\sq... | import math
c = 1.0
T0 = 2.0
A = math.sqrt(c) / 8.0
B = math.sqrt(c) / 4.0
C = 1000.0
def psi_table(N):
spf = list(range(N + 1))
if N >= 1:
spf[1] = 1
for i in range(2, int(N ** 0.5) + 1):
if spf[i] == i:
for j in range(i * i, N + 1, i):
if spf[j] == j:
... |
MATH-CRYPTO-000246 | math_competition_problem | Analytic Number Theory | Hardy-Littlewood circle method for ternary Goldbach and Waring problems | Research Level | Notation. For $q\in\mathbb{Z}_{\ge1}$ and $x\in\mathbb{R}$ put $e(x)=e^{2\pi i x}$. The Ramanujan sum is $c_q(n)=\sum_{a=1,\,(a,q)=1}^{q} e(an/q)$. Let $\mu$ be the M\"obius function and $\varphi$ Euler's totient function. In the Hardy-Littlewood treatment of the ternary Goldbach problem, the major arcs contribute $\ma... | Step 1 (exponential sum over units). For a prime $p$ and $a\in\mathbb{Z}$, $\sum_{x=1}^{p-1}e(ax/p)=c_p(a)$, which equals $p-1$ if $p\mid a$ and $-1$ otherwise, because $\sum_{x=0}^{p-1}e(ax/p)$ equals $p$ if $p\mid a$ and $0$ otherwise.
Step 2 (part (a)). By orthogonality, $\frac1p\sum_{a=0}^{p-1}e(a(x_1+x_2+x_3-N)/p... | $T_p(N)=(p-1)(p-2)$ if $p\mid N$, and $T_p(N)=p^2-3p+3$ if $p\nmid N$. Moreover $\mathfrak{S}(N)=\prod_{p\mid N}(1-(p-1)^{-2})\prod_{p\nmid N}(1+(p-1)^{-3})$. Hence $\mathfrak{S}(N)=0$ if and only if $N$ is even, and $\mathfrak{S}(N)\ge2C_2\approx1.3203236$ for odd $N$. | from fractions import Fraction
from itertools import product
import cmath, math
def primes(n):
s=[True]*(n+1); s[0]=s[1]=False
for i in range(2,int(n**0.5)+1):
if s[i]:
for j in range(i*i,n+1,i): s[j]=False
return [i for i in range(n+1) if s[i]]
def T(p,N):
return sum(1 for x in pr... |
MATH-CRYPTO-000276 | math_competition_problem | Zero-Knowledge Proofs | Bulletproofs: inner product arguments without trusted setup and range proofs | Research Level | Let q be a prime and \mathbb{F}=\mathbb{F}_q. Fix n=2^m and write 1^n=(1,\ldots,1), 0^n=(0,\ldots,0). For x,y\in\mathbb{F}^n put \langle x,y\rangle=\sum_{i=0}^{n-1}x_i y_i, x\circ y=(x_0y_0,\ldots,x_{n-1}y_{n-1}), and y^n=(1,y,\ldots,y^{n-1}). Let P=(1,2,\ldots,2^{n-1}). Let \mathcal G be an additive cyclic group of pr... | Proof of Part A.
First, since every a_i is a bit, a_i(a_i-1)=0 in \mathbb{F}; hence \langle a_L,a_R\rangle=\sum_i a_i(a_i-1)=0. Also v=\langle a_L,P\rangle=\sum_i a_i2^i, which is exactly the binary integer represented by the bits a_i. Because 0\le a_i\le1 and q>2^n, this integer lies in [0,2^n-1]=\{0,\ldots,2^n-1\}.
L... | For Part A, with S_y=\sum_{i=0}^{n-1}y^i,
t_0=z^2v+(z-z^2)S_y-z^3(2^n-1),
t_1=\langle s_L, y^n\circ(a_R+z1^n)+z^2P\rangle+\langle s_R, y^n\circ(a_L-z1^n)\rangle,
t_2=\langle s_L, y^n\circ s_R\rangle,
and if a_L\in\{0,1\}^n then v=\sum_i a_i2^i\in\{0,1,\ldots,2^n-1\}. For Part B,
\langle a,G\rangle+\langle b,H\rangle+\l... | import random
random.seed(276)
q = 2**61 - 1
n = 8
def dot(x,y):
return sum((xi*yi)%q for xi,yi in zip(x,y))%q
a = [random.randint(0,1) for _ in range(n)]
aR = [(x-1)%q for x in a]
Ppow = [pow(2,i,q) for i in range(n)]
v_int = sum(a[i]*2**i for i in range(n))
v_mod = v_int % q
assert dot(a,Ppow) == v_mod
assert d... |
MATH-CRYPTO-000295 | math_competition_problem | Memory Safety Theory | Information-theoretic entropy limits of Address Space Layout Randomization (ASLR) | Research Level | Let an ASLR implementation draw a secret base offset $X \in \Omega = \{0,1\}^n$ from a distribution $p$ on $\Omega$. An attacker submits probes $g_1, g_2, \dots \in \Omega$. Probe $t$ either succeeds, if $g_t$ equals the current secret, or crashes the target. The only feedback is success or failure.\n\nTwo restart mode... | **Step 0: reduction of adaptivity.**\nIn either model, the only information available before probe $t$ is the event that probes $1,\dots,t-1$ all failed. Hence an adaptive deterministic strategy is equivalent to a fixed sequence $(g_t)$.\nA randomized strategy is a mixture of deterministic ones. Its expected $T$ is the... | $G_F(p) = \sum_i i\, p_{[i]}$ and $G_R(p) = 1/p_{\max}$.\n\nFor $n=4$, $q=3/4$:\n- $G_F = 137/32 = 4.28125$\n- $G_R = 256/81 \approx 3.1605$\n- $H = 8 - 3\log_2 3 \approx 3.245$ bits\n- Massey bound: $91/27 \le 137/32$\n\nFor uniform $4$-bit ASLR: $G_F = 17/2$ and $G_R = 16$. | from fractions import Fraction as F
from itertools import product, permutations
import math, random
def dist(n, q):
d = {}
for x in product([0, 1], repeat=n):
pr = F(1)
for b in x:
pr *= q if b else 1 - q
d[x] = pr
return d
def GF(d):
s = sorted(d.values(), reverse=... |
MATH-CRYPTO-000303 | math_competition_problem | Algebraic Number Theory | Chebotarev density theorem applications to Galois group determination | Research Level | Let $f(x)=x^4+x+1\in\mathbb{Z}[x]$. Let $K$ be its splitting field over $\mathbb{Q}$ and let $G=\mathrm{Gal}(K/\mathbb{Q})$. We regard $G$ as a subgroup of $S_4$ through its action on the four roots of $f$.
For a prime $p\nmid \mathrm{disc}(f)$, define the factorization type $\lambda_p$ as the multiset of degrees of t... | Step 1 (Discriminant). For $x^4+ax+b$ we have $\mathrm{disc}=-27a^4+256b^3$. With $a=b=1$ this gives $\mathrm{disc}(f)=229$. This number is prime, so it is not a rational square. Hence $G\not\subseteq A_4$.
Step 2 (Irreducibility). Work modulo $2$. We have $f(0)=f(1)=1$ in $\mathbb{F}_2$, so $f$ has no roots there. Th... | $G=S_4$, since $\mathrm{disc}(f)=229$ is not a square, $f$ is irreducible mod 2, and the resolvent cubic $x^3-4x-1$ is irreducible. Densities of factorization types: $\delta(1^4)=1/24$, $\delta(2\,1^2)=1/4$, $\delta(2^2)=1/8$, $\delta(3\,1)=1/3$, $\delta(4)=1/4$. Densities of root counts: $N_p=0$ with density $3/8$, $N... | from fractions import Fraction
def primes_upto(n):
s = bytearray([1]) * (n + 1); s[0] = s[1] = 0
for i in range(2, int(n ** 0.5) + 1):
if s[i]: s[i*i::i] = bytearray(len(s[i*i::i]))
return [i for i in range(n + 1) if s[i]]
def trim(a, p):
a = [c % p for c in a]
while a and a[-1] == 0: a.po... |
MATH-CRYPTO-000312 | math_competition_problem | Symplectic Geometry | Gromov-Witten invariants, quantum cohomology, and pseudoholomorphic curves | Research Level | Let $X=\mathbb{CP}^2$ with its Fubini-Study symplectic form. Let $T_0=1$, $T_1=H$, $T_2=H^2$ be the basis of $H^*(X;\mathbb{Q})$, where $H$ is the hyperplane class. The Poincar\'e pairing is $g_{ij}=\int_X T_i\cup T_j$, so $g_{02}=g_{20}=g_{11}=1$ and all other entries are $0$. For $d\ge 1$, let $N_d=\mathrm{GW}^{X}_{0... | **Step 1: Third derivatives.**
Let $\Gamma=\sum_d N_d e^{dt_1}t_2^{3d-1}/(3d-1)!$. The classical part $\tfrac12(t_0^2t_2+t_0t_1^2)$ has only two nonzero third derivatives:
- $\Phi_{002}=1$,
- $\Phi_{011}=1$.
Furthermore, $\Gamma$ is independent of $t_0$, which reflects the fundamental class axiom. Hence every third de... | WDVV is equivalent to $\Phi_{222}=\Phi_{112}^2-\Phi_{111}\Phi_{122}$. This gives $N_d=\sum_{a+b=d}N_aN_ba^2b[b\binom{3d-4}{3a-2}-a\binom{3d-4}{3a-1}]$, and hence $N_1=1$, $N_2=1$, $N_3=12$, $N_4=620$, $N_5=87304$. | from math import comb, factorial
from fractions import Fraction
D = 7
N = {1: 1}
for d in range(2, D + 1):
s = 0
for a in range(1, d):
b = d - a
s += N[a] * N[b] * a * a * b * (b * comb(3*d - 4, 3*a - 2) - a * comb(3*d - 4, 3*a - 1))
N[d] = s
assert [N[i] for i in range(1, 6)] == [1, 1, 12... |
MATH-CRYPTO-000309 | math_competition_problem | Algebraic Geometry | Intersection theory, Chow rings, and Riemann-Roch-Hirzebruch theorem | Research Level | Let $k$ be an algebraically closed field and $n \geq 0$ an integer. Let $X = \mathbb{F}_n = \mathbb{P}(\mathcal{O}_{\mathbb{P}^1} \oplus \mathcal{O}_{\mathbb{P}^1}(-n)) \xrightarrow{\pi} \mathbb{P}^1$ be the Hirzebruch surface. Let $C \subset X$ be the section with $C^2 = -n$ and let $F$ be the class of a fibre of $\pi... | (a) Chow ring.
By the projective bundle formula, $A^*(\mathbb{P}(E)) = A^*(\mathbb{P}^1)[\xi]/(\xi^2 + c_1(E)\xi + c_2(E))$. Here $A^*(\mathbb{P}^1) = \mathbb{Z}[F]/(F^2)$, where $F = \pi^*[\mathrm{pt}]$. Since $c_2(E) = 0$, the ring is generated by $F$ and one tautological divisor, subject to one quadratic relation.
... | $A^*(\mathbb{F}_n) = \mathbb{Z}[C,F]/(F^2,\, C^2 + nCF)$, with $K = -2C - (n+2)F$, $K^2 = 8$ and $c_2 = 4$. For all $(a,b) \in \mathbb{Z}^2$, $\chi(\mathcal{O}(aC + bF)) = (a+1)(b+1) - \frac{n\,a(a+1)}{2}$. This vanishes for $a = -1$, is Serre-symmetric under $(a,b) \mapsto (-2-a,\, -n-2-b)$, and equals $h^0$ when $a \... | from fractions import Fraction
def dot(x, y, n):
# intersection of x=(a,b), y=(c,d) meaning aC+bF, cC+dF
a, b = x; c, d = y
return a*c*(-n) + a*d + b*c
def K(n):
return (-2, -(n+2))
def chi_hrr(a, b, n):
L = (a, b); k = K(n)
LmK = (a - k[0], b - k[1])
v = Fraction(dot(L, LmK, n), 2) + 1
... |
MATH-CRYPTO-000266 | math_competition_problem | Post-Quantum Cryptography | Module-LWE and Ring-LWE error distribution parameter tuning (ML-KEM/Kyber) | Research Level | Let $n=128$, $q=3329$, and let $R_q = \mathbb{Z}_q[x]/(x^n+1)$. For an integer $\eta \ge 1$, define the centered binomial distribution $\text{CBD}_\eta$ as the distribution of $\sum_{i=1}^{\eta} (X_i - Y_i)$, where $X_i, Y_i$ are independent Bernoulli$(1/2)$ random variables. Thus its support is $\{-\eta, -\eta+1, \ldo... | Step 1: Fix a coefficient index $j \in \{0,\ldots,n-1\}$. The $j$-th coefficient of $E = s\cdot e + e_2$ is given by \[ E_j = \sum_{i=0}^{n-1} s_i e_{j-i \bmod n} \cdot (-1)^{\lfloor (i + (j-i \bmod n))/n \rfloor} + (e_2)_j \pmod q. \] Let $X_i = s_i e_{j-i \bmod n} \cdot (-1)^{\cdots}$. The sign is irrelevant for the ... | $\eta_{\max} = 2$. The Hoeffding bound guarantees decryption failure probability at most $2^{-64}$ for $\eta \le 2$, but not for $\eta=3$ (since $256\cdot 3^4 + 2\cdot 3^2 = 20754 > 13878.7275$). | import math
n = 128
q = 3329
delta = 2**-64
t = q / 4.0
# Compute the threshold C = t^2 / ln(2n/delta)
C = (t**2) / math.log(2*n / delta)
print(f"C = {C}")
def lhs(eta):
return 2*n * eta**4 + 2 * eta**2
eta_max = None
for eta in range(1, 5):
val = lhs(eta)
ok = val <= C
print(f"eta={eta}: LHS={val},... |
MATH-CRYPTO-000267 | math_competition_problem | Post-Quantum Cryptography | Falcon NTRU-lattice fast Fourier orthogonalization and trapdoor sampling | Research Level | Let \(n=2\), \(R=\mathbb{Z}[x]/(x^2+1)\), and \(q=17\). For \(u=u_0+u_1x\in R\) identify \(\operatorname{vec}(u)=(u_0,u_1)\in\mathbb{Z}^2\), and for \((u,v)\in R^2\) identify it with \((u_0,u_1,v_0,v_1)\in\mathbb{Z}^4\). Set \(f=1\), \(g=x\), \(F=1\), \(G=17+x\), and \(h=g f^{-1}\bmod q\). Define \(\Lambda_{h,q}=\{(u,v... | For (a), compute in \(R\): \(fG-gF=1\cdot(17+x)-x\cdot1=17=q\). Hence \(h=g f^{-1}=x\bmod17\). The row \((g,-f)=(x,-1)\) satisfies \(u+v h=x-x=0\), and \((G,-F)=(17+x,-1)\) satisfies \(u+v h=17+x-x=17\equiv0\pmod q\), so the \(R\)-module they generate lies in \(\Lambda_{h,q}\). The map \(\varphi:R^2\to R/qR\), \((u,v)\... | The NTRU identity is \(fG-gF=17\), and the ordered rows \(r_1=(0,1,-1,0)\), \(r_2=(-1,0,0,-1)\), \(r_3=(17,1,-1,0)\), \(r_4=(-1,17,0,-1)\) form a \(\mathbb{Z}\)-basis of \(\Lambda_{h,q}\) with covolume \(289\). The Gram matrix is \(M=((2,0,2,17),(0,2,-17,2),(2,-17,291,0),(17,2,0,291))\), with exact LDL^T decomposition ... | from fractions import Fraction
from math import sqrt
def mul(a,b):
a0,a1=a; b0,b1=b
return (a0*b0-a1*b1, a0*b1+a1*b0)
def sub(a,b):
return (a[0]-b[0], a[1]-b[1])
def xmul(v):
u0,u1,v0,v1=v
return (-u1,u0,-v1,v0)
f=(1,0); g=(0,1); F=(1,0); G=(17,1); q=17
assert sub(mul(f,G), mul(g,F)) == (q,0)
b... |
MATH-CRYPTO-000263 | math_competition_problem | Combinatorics & Graph Theory | Szemerédi regularity lemma and graph limit theory (graphons) | Research Level | Let k=10. Partition [0,1) into ten equal intervals I_1,\ldots,I_{10}. Define u(x)=1 for x\in I_1\cup\cdots\cup I_6 and u(x)=-1 for x\in I_7\cup\cdots\cup I_{10}. Define the signed graphon W(x,y)=u(x)u(y). The cut norm of a graphon W is \|W\|_{\square}=\sup_{S,T\subseteq[0,1]}\left|\int_{S\times T}W(x,y)\,dx\,dy\right|,... | Write |I_i|=1/k and for measurable S,T set x_i=|S\cap I_i|/|I_i| and y_i=|T\cap I_i|/|I_i|. Then x_i,y_i\in[0,1] and \int_{S\times T}W_A = \frac{1}{k^2}\sum_{i,j}a_{ij}x_i y_j. Let f(x,y)=\sum_{i,j}a_{ij}x_i y_j. For fixed y, f is affine in x, so its maximum over the cube [0,1]^k is attained at a vertex x\in\{0,1\}^k; ... | \|W\|_{\square}=\frac{9}{25}=0.36. The maximum is attained by S=T=[0,3/5), the union of the six positive blocks, for which \int_{S\times T}W=(3/5)^2=9/25. The finite reduction is \|W_A\|_{\square}=\frac{1}{k^2}\max_{S,T\subseteq[k]}|\sum_{i\in S}\sum_{j\in T}a_{ij}|. | import itertools, random, math
k = 10
u = [1]*6 + [-1]*4
assert len(u) == k
max_abs_sum = 0
for mask in range(1 << k):
s = 0
for i in range(k):
if (mask >> i) & 1:
s += u[i]
if abs(s) > max_abs_sum:
max_abs_sum = abs(s)
assert max_abs_sum == 6
cut_norm = max_abs_sum * max_abs_... |
MATH-CRYPTO-000291 | math_competition_problem | Formal Verification | Hoare logic, loop invariants, and automated verification with Z3 SMT bitvectors | Research Level | Let N\ge 1 and M=2^N. Identify an N-bit unsigned bitvector with an element of R_N=\mathbb{Z}/M\mathbb{Z}. For a\in R_N write |a|_N for its representative in \{0,1,\ldots,M-1\}. All bitvector additions, subtractions and multiplications below are performed modulo M, i.e. with wraparound at N bits. For N\ge 1 set C_N=\lce... | For i=0,1,\ldots,C_N let x_i denote the value of x after i loop iterations. Define e_i=\min(2^i,N). We prove the invariant\n\nP(i):\quad 0\le i\le C_N \;\wedge\; a x_i\equiv 1 \pmod{2^{e_i}}.\n\nInitialization: i=0, x_0=1 and e_0=\min(1,N)=1. Since a is odd, a x_0=a\equiv 1 \pmod 2, so P(0) holds.\n\nPreservation: Assu... | C_N=\lceil\log_2 N\rceil for N\ge 1, with C_1=0. For every odd a, INV_N(a)\equiv a^{-1} \pmod{2^N}; this bound is exact and minimal in the worst case. For N=16 and a=167, INV_{16}(167)=42775=0xA717. | from z3 import *
import math
def C(N):
return (N - 1).bit_length()
def inv_iter_py(a, N, steps):
M = 1 << N
x = 1 % M
a = a % M
for _ in range(steps):
x = (x * (2 - a * x)) % M
return x
def inv_iter_bv(a_bv, N, steps):
x = BitVecVal(1, N)
two = BitVecVal(2, N)
for _ in ran... |
MATH-CRYPTO-000271 | math_competition_problem | Lattice Cryptanalysis | Kannan's embedding technique vs Babai's nearest plane algorithm for CVP | Research Level | Let $L\subset\mathbb{R}^n$ be a full-rank lattice with ordered basis $B=(b_1,\ldots,b_n)$ and Gram--Schmidt vectors $b_i^*$. For a target $t\in\mathbb{R}^n$, let $\operatorname{round}(x)$ denote a nearest integer to $x$. Babai's nearest plane algorithm computes a lattice point as follows: set $x\leftarrow t$, and for $... | Proof of the Kannan embedding theorem. Put $d=d(t,L)$. If $v$ and $v'$ were two distinct closest lattice vectors, then $v-v'$ is a nonzero lattice vector and $\|v-v'\|\le\|v-t\|+\|t-v'\|=2d<\lambda_1(L)$, a contradiction. Hence the closest vector $v_0$ is unique. Write $e=t-v_0$, so $\|e\|=d$, and choose $z_0\in\mathbb... | The theorem holds: if d=dist(t,L)<λ1(L)/2 and d/√3<M<√(λ1(L)^2-d^2), then the shortest nonzero vectors of Kannan's embedding Λ_M(t,L) are exactly ±(v0-t,-M), where v0 is the unique closest lattice vector. In the explicit instance, Babai returns (-1,0) with squared error 221/400, while the exact CVP solution is v0=(0,0)... | from fractions import Fraction
from itertools import product
from math import floor
def add(u,v): return tuple(a+b for a,b in zip(u,v))
def sub(u,v): return tuple(a-b for a,b in zip(u,v))
def mul(a,u): return tuple(a*x for x in u)
def dot(u,v): return sum((a*b for a,b in zip(u,v)), Fraction(0,1))
def norm2(u): return ... |
MATH-CRYPTO-000240 | math_competition_problem | Differential Privacy | Renyi differential privacy and privacy amplification by subsampling | Research Level | Let $(\mathcal{X},\mathcal{F})$ be a measurable output space. Fix $\varepsilon\ge 0$, $q\in[0,1]$, and $\alpha>1$. A randomized mechanism $M$ is $(\varepsilon,0)$-differentially private if for every adjacent pair of datasets $D,D'$ and every measurable $S\in\mathcal{F}$,
$$M(D)(S)\le e^{\varepsilon}M(D')(S).$$
Let $\ma... | Write $a=e^{-\varepsilon}$ and $b=e^{\varepsilon}$, so $0<a\le 1\le b$ and $ab=1$. For an $(\varepsilon,0)$-DP pair $(P_0,P_1)$, define the Radon--Nikodym derivative
$$R=\frac{dP_1}{dP_0}.$$
First prove the invariant $R\in[a,b]$ $P_0$-almost surely. The upper bound $R\le b$ follows from $(\varepsilon,0)$-DP by taking $... | For every $\alpha>1$, $\varepsilon\ge 0$, and $q\in[0,1]$, let
$$b=e^{\varepsilon},\qquad w=\frac{1}{1+b}=\frac{1}{1+e^{\varepsilon}},$$
$$L_+=1-q+qe^{\varepsilon},\qquad L_-=1-q+qe^{-\varepsilon}.$$
Then the tight worst-case Renyi differential privacy parameter of the Poisson-subsampled class of $(\varepsilon,0)$-DP m... | import math
def rdp(P, Q, alpha):
assert alpha > 1.0
assert abs(sum(P) - 1.0) < 1e-12
assert abs(sum(Q) - 1.0) < 1e-12
total = 0.0
for p, q in zip(P, Q):
assert p > 0.0 and q > 0.0
total += p ** alpha * q ** (1.0 - alpha)
return math.log(total) / (alpha - 1.0)
def formula(eps... |
MATH-CRYPTO-000283 | math_competition_problem | Homomorphic Encryption | TFHE bitwise bootstrapping via external products over Torus polynomials | Research Level | Let q=64 and N=4, and let R_q = \mathbb{Z}_q[X]/(X^N+1) with q=64. Identify the torus polynomial ring T_N = \mathbb{T}[X]/(X^N+1), \mathbb{T}=\mathbb{R}/\mathbb{Z}, with the q-grid R_q/q embedded by c/q mod 1. Let S(X)=1+X \in R_q. Define a zero-error TRLWE ciphertext under S of a message m \in R_q as a pair (a,b) \in ... | 1. External product correctness. Write a=\sum_i \alpha_i g_i and b=\sum_i \beta_i g_i, and let (A,B)=C\boxdot(a,b). Using commutativity and distributivity of R_q, we compute B-S A = \sum_i [\beta_i(B_i-S A_i)+\alpha_i(B_i'-S A_i')] = \sum_i [\beta_i(\mu g_i)+\alpha_i(-\mu g_i S)] = \mu(\sum_i \beta_i g_i - S\sum_i \alp... | The external product satisfies Dec_S(C\boxdot(a,b))=\mu Dec_S(a,b). For the given instance the final accumulator plaintext is M_3(X)=F(X)X^{7-(3+0+2)}=F(X)X^2=61+60X+X^2+2X^3 in \mathbb{Z}_{64}[X]/(X^4+1), equivalently the coefficient vector (61,60,1,2) from constant coefficient to X^3. | import random
MOD = 64
N = 4
L = 6
B = 2
random.seed(12345)
def add(u,v):
return [(x+y) % MOD for x,y in zip(u,v)]
def sub(u,v):
return [(x-y) % MOD for x,y in zip(u,v)]
def neg(u):
return [(-x) % MOD for x in u]
def smul(c,u):
return [(c*x) % MOD for x in u]
def mul(u,v):
w = [0]*N
for i,... |
MATH-CRYPTO-000325 | math_competition_problem | Combinatorics & Graph Theory | Tutte polynomial evaluations, chromatic polynomials, and matroids | Research Level | Let $n\ge 1$ and $k\ge 1$ be integers.
**The graph.** Let $C_n^{(k)}$ be the multigraph obtained from the $n$-cycle $C_n$ by replacing every edge with a bundle of $k$ parallel edges. Its vertex set is $V=\mathbb{Z}_n$. For $n=1$ the bundle consists of $k$ loops; for $n=2$ the graph has two bundles between the same two... | **Step 1 (Fortuin–Kasteleyn form).**
Set $q=(x-1)(y-1)$ and $v=y-1$. Since $r(A)=|V|-k(A)$, each term of the defining sum becomes
$$(x-1)^{k(A)-k(E)}(y-1)^{|A|-|V|+k(A)}=(x-1)^{-k(E)}(y-1)^{-|V|}\,q^{k(A)}v^{|A|}.$$
Hence
$$T(G;x,y)=(x-1)^{-k(E)}(y-1)^{-|V|}\,Z_G(q,v),\qquad Z_G(q,v)=\sum_{A\subseteq E}q^{k(A)}v^{|A|}.... | $$T(C_n^{(k)};x,y)=\frac{((x-1)(y-1)+y^k-1)^n+(xy-x-y)(y^k-1)^n}{(x-1)(y-1)^n}.$$
Consequences: $T(2,2)=2^{nk}$, $T(1,1)=n\,k^{n-1}$, and $P(\lambda)=(\lambda-1)^n+(-1)^n(\lambda-1)$. | from fractions import Fraction as F
from itertools import product
def graph(n,k):
E=[]
for i in range(n):
for _ in range(k):
E.append((i,(i+1)%n))
return E
def comps(n,A):
p=list(range(n))
def f(a):
while p[a]!=a:
p[a]=p[p[a]]; a=p[a]
return a
c=... |
MATH-CRYPTO-000154 | math_competition_problem | Zero-Knowledge Proofs | Plonk arithmetization: grand product permutation arguments and copy constraints | Research Level | Let \mathbb{F} be a finite field, n=2^k, H=\langle \omega \rangle a subgroup of \mathbb{F}^* of order n. Let a: H \to \mathbb{F} be a wire assignment and \sigma: H \to H a permutation. Define the grand product polynomial Z: H \to \mathbb{F} by Z(\omega^0)=1 and Z(\omega^{i+1}) = Z(\omega^i) \cdot \frac{a(\omega^i)+\bet... | 1. Define the polynomial F(\beta,\gamma) = \prod_{x \in H} (a(x)+\beta x+\gamma) - \prod_{x \in H} (a(x)+\beta \sigma(x)+\gamma). Each product has n linear factors in (\beta,\gamma), so \deg F \leq n.
2. Claim: F \equiv 0 \iff a(x)=a(\sigma(x)) for all x \in H. If a is invariant, then a(x)=a(\sigma(x)) for all x, so t... | Soundness error \leq n/|\mathbb{F}| (or \leq 2n/|\mathbb{F}| with nonzero denominators). Prover time \mathcal{O}(n \log n), verifier time \mathcal{O}(1), proof size \mathcal{O}(1) group elements. Edge case \beta=0: identity holds trivially with probability 1/|\mathbb{F}|. Formal verification via Schwartz-Zippel and uni... | import itertools
def mod_inv(a, p):
return pow(a, p-2, p)
def main():
p = 101
n = 4
omega = 10
H = [pow(omega, i, p) for i in range(n)]
H_set = set(H)
assert len(H_set) == n
assert pow(omega, 4, p) == 1
assert pow(omega, 2, p) != 1
a = {H[0]: 3, H[1]: 5, H[2]: 7, H[3]: 11}
... |
MATH-CRYPTO-000137 | math_competition_problem | Representation Theory | Kazhdan-Lusztig conjectures and intersection cohomology of Schubert varieties | Research Level | Let $W=S_4$ with simple reflections $s_i=(i\;i+1)$ for $i=1,2,3$. Let $\ell$ be the Coxeter length (the number of inversions) and let $\le$ be the Bruhat order. Write permutations in one-line notation $w=w(1)w(2)w(3)w(4)$. Left multiplication $s_iw$ interchanges the values $i$ and $i+1$ in the one-line notation of $w$.... | **Step 1: Set-up.**
We have $\ell(w)=4$, and $w=s_2v$ with $v=s_1s_3s_2$ of length 3. Check this: applying $s_2$ to $3412$ swaps the values 2 and 3, giving $2413$. The permutation $2413$ has the 3 inversions $(2,1),(4,1),(4,3)$, and $2413=s_1s_3s_2$. So $s=s_2$ is a left descent of $w$.
**Step 2: The correction terms ... | $P_{x,3412}=1+q$ for $x\in\{1234,1324\}$ (i.e. $x\in\{e,s_2\}$), and $P_{x,3412}=1$ for all other $x\le 3412$. The non-rationally-smooth points are exactly the $T$-fixed points of $X_{1324}\cong\mathbb P^1$, which is the singular locus. At $eB$ the stalk has $\dim\mathcal H^0=\dim\mathcal H^2=1$, with total dimension $... | from itertools import permutations
from functools import lru_cache
n = 4
W = list(permutations(range(1, n + 1)))
e = tuple(range(1, n + 1))
def length(w):
return sum(1 for i in range(n) for j in range(i + 1, n) if w[i] > w[j])
def leq(x, w):
# tableau criterion for Bruhat order
for k in range(1, n):
... |
MATH-CRYPTO-000255 | math_competition_problem | Harmonic Analysis | Carleson theorem on almost-everywhere convergence of Fourier series | Research Level | Let \mathbb{T}=\mathbb{R}/2\pi\mathbb{Z} with normalized Lebesgue measure. For f\in L^2(\mathbb{T}) define \hat f(n)=\frac{1}{2\pi}\int_{-\pi}^{\pi} f(t)e^{-int}\,dt and S_N f(x)=\sum_{|n|\le N}\hat f(n)e^{inx}. Define the Carleson maximal operator C f(x)=\sup_{N\ge0}|S_N f(x)|. Assume the Carleson-Hunt L^2 maximal est... | Step 1 (density invariant). Trigonometric polynomials are dense in L^2(\mathbb{T}). If P is a trigonometric polynomial, then S_N P=P for all N\ge\deg P, hence S_N P(x)\to P(x) everywhere.\nStep 2 (maximal exceptional set). Fix f\in L^2(\mathbb{T}) and \lambda>0. Put E_\lambda(f)=\{x\in\mathbb{T}:\limsup_{N\to\infty}|S_... | Carleson-Hunt implies S_N f\to f a.e. for every f\in L^2(\mathbb{T}). For f_0(x)=x on (-\pi,\pi), \hat f_0(0)=0 and \hat f_0(n)=\frac{i(-1)^n}{n} for n\ne0. Thus f_0(x)=2\sum_{n=1}^{\infty}(-1)^{n+1}\frac{\sin(nx)}{n} for x\in(-\pi,\pi), and the 2\pi-periodic Fourier series converges to f_0(x) for almost every x, with ... | import math
def S_N(x, N):
s = 0.0
for n in range(1, N + 1):
sign = 1.0 if (n % 2 == 1) else -1.0
s += 2.0 * sign * math.sin(n * x) / n
return s
test_points = [-2.5, -1.0, 0.3, 1.7, 2.9]
N1 = 2000
N2 = 50000
for x in test_points:
e1 = abs(S_N(x, N1) - x)
e2 = abs(S_N(x, N2) - x)
... |
MATH-CRYPTO-000215 | math_competition_problem | Zero-Knowledge Proofs | STARKs: Algebraic Intermediate Representation (AIR) and FRI low-degree testing | Research Level | Let p=17 and let H_8=\langle 2\rangle\subset\mathbb{F}_{17}^{\times} be the multiplicative subgroup of order 8. Let f\in\mathbb{F}_{17}[X] be f(X)=3X^7+7X^5+11X^2+5. In the FRI low-degree test, for a challenge \alpha\in\mathbb{F}_{17} one defines the fold F_\alpha(f)(Y)=E(Y)+\alpha O(Y), where f(X)=E(X^2)+X O(X^2) is t... | 1. Let f(X)=\sum_{i=0}^{d}a_iX^i. Define E(Y)=\sum_i a_{2i}Y^i and O(Y)=\sum_i a_{2i+1}Y^i. Then f(X)=E(X^2)+X O(X^2). Set f_1(Y)=F_\alpha(f)(Y)=E(Y)+\alpha O(Y). For x\in H_8, y=x^2, we have f(x)=E(y)+xO(y) and f(-x)=E(y)-xO(y). Since 2 and x are invertible in \mathbb{F}_{17}, E(y)=(f(x)+f(-x))/2 and O(y)=(f(x)-f(-x))... | FRI folding identity: if f(X)=E(X^2)+X O(X^2), then F_\alpha(f)(Y)=E(Y)+\alpha O(Y). If \deg f<2^m, then after k folds \deg(F_{\alpha_k}\circ\cdots\circ F_{\alpha_1})(f)\le\left\lfloor(2^m-1)/2^k\right\rfloor, hence after m folds it is constant. For f(X)=3X^7+7X^5+11X^2+5 over \mathbb{F}_{17} and (\alpha_1,\alpha_2,\al... | import itertools
p=17
g=2
n=8
H=[pow(g,i,p) for i in range(n)]
assert len(set(H))==n
assert all(pow(x,n,p)==1 for x in H)
f=[5,0,11,0,0,7,0,3]
alphas=[5,9,4]
def trim(a):
a=[c%p for c in a]
while len(a)>1 and a[-1]%p==0:
a.pop()
return a
def fold(poly, alpha):
even=poly[0::2]
odd=poly[1::2]
... |
MATH-CRYPTO-000238 | math_competition_problem | Side-Channel Resistance | Constant-time cryptographic arithmetic: avoiding timing leaks in field inversions | Research Level | Let $p$ be an odd prime and set $\mathbb{F}_p=\mathbb{Z}/p\mathbb{Z}$. The target primitive is $\operatorname{Inv}_p:\mathbb{F}_p\to\mathbb{F}_p$ satisfying $\operatorname{Inv}_p(0)=0$ and $a\operatorname{Inv}_p(a)\equiv1\pmod p$ for every $a\in\mathbb{F}_p^\times$. Let $e=p-2=\sum_{i=0}^{L-1}e_i2^i$, $e_i\in\{0,1\}$, ... | 1. Exponentiation invariant. Let $R_i$ be the value of $r$ after the iteration with index $i$ (indices descend from $L-1$ to $0$). Before iteration $i$, we have $r=a^{\lfloor e/2^{i+1}\rfloor}$. Initially, before $i=L-1$, $\lfloor e/2^L\rfloor=0$, so $r=1=a^0$. During the iteration, $q=r^2=a^{2\lfloor e/2^{i+1}\rfloor}... | $\operatorname{InvCT}_p(a)=a^{p-2}$ for all $a\in\mathbb{F}_p$, so it is field inversion on $\mathbb{F}_p^\times$ and sends $0$ to $0$; its execution trace is independent of $a$. For $p=2^{255}-19$, $e=p-2=2^{255}-21$, $L=255$, and $\operatorname{wt}(e)=253$. The specified branchless algorithm executes $S=255$ squaring... | def ct_select(bit, x, y):
mask = -int(bit)
return y ^ ((x ^ y) & mask)
def ct_mul(a, b, p):
return (a * b) % p
def inv_ct(a, p):
e = p - 2
L = e.bit_length()
r = 1
S = 0
M = 0
for i in range(L - 1, -1, -1):
q = ct_mul(r, r, p)
S += 1
t = ct_mul(q, a, p)
... |
MATH-CRYPTO-000322 | math_competition_problem | Topology & Dynamics | Furstenberg multiple recurrence theorem and Szemerédi's theorem | Research Level | Let k\ge 1. For E\subset\mathbb{Z} define the upper Banach density by
\[d^*(E)=\limsup_{N\to\infty}\sup_{M\in\mathbb{Z}}\frac{|E\cap\{M+1,\dots,M+N\}|}{N}.\]
A set E is AP-rich if for every \ell\ge 1 there exist a\in\mathbb{Z} and q\ge 1 such that \{a,a+q,\dots,a+(\ell-1)q\}\subset E.
State Furstenberg's Multiple Recu... | Proof. We use the following notation. For y\in\{0,1\}^{\mathbb{Z}} let (Ty)_j=y_{j+1} be the left shift, and put 1_E(j)=1 if j\in E and 0 otherwise.
Step 1: Furstenberg correspondence. Let \alpha=d^*(E)>0. By definition of d^*, choose N_j\to\infty and M_j\in\mathbb{Z} such that
\[\frac{1}{N_j}|E\cap\{M_j+1,\dots,M_j+N... | Every E\subset\mathbb{Z} with d^*(E)>0 contains arithmetic progressions of every finite length. More precisely, if \alpha=d^*(E)>0, the Furstenberg correspondence produces a probability-preserving system (X,T,\mu) and clopen A with \mu(A)=\alpha; FMR gives n\ge 1 with \mu(\bigcap_{i=0}^kT^{-in}A)>0, and clopen continui... | import math
def has_ap(S, length, diff=None, start=None):
if length <= 0:
return True
if diff is not None and start is not None:
return all(start + i*diff in S for i in range(length))
S = set(S)
if not S:
return False
if length == 1:
return True
maxv = max(S)
... |
MATH-CRYPTO-000341 | math_competition_problem | Homomorphic Encryption | BGV and BFV leveled homomorphic schemes: noise growth and modulus switching | Research Level | Throughout, for an integer modulus $r\ge 2$ and $x\in\mathbb{Z}$, let $[x]_r$ be the unique integer with $[x]_r\equiv x \pmod r$ and $-r/2<[x]_r\le r/2$.\n\n(Scalar BGV.) Let $t\ge 2$ be the plaintext modulus. Let $q>p>t$ be odd integers with $q\equiv p\equiv 1\pmod t$. A secret key is $s\in\{-1,0,1\}$. A pair $(c_0,c_... | Step 0 (well-definedness). Since $q\equiv 1\pmod t$, we have $\gcd(t,q)=1$, so $t^{-1}\bmod q$ exists. Because $q$ is odd, $[x]_q\in\{-(q-1)/2,\dots,(q-1)/2\}$, hence $|u_i|\le (q-1)/2$ and $|\delta_i|\le t(q-1)/2$.\n\n(a) Modulo $q$, $\delta_i=t u_i\equiv t\cdot(-p c_i t^{-1})\equiv -p c_i$. Hence $q\mid p c_i+\delta_... | The switched ciphertext satisfies $c_i'\equiv c_i \pmod t$ and has noise $v'\equiv m \pmod t$ with $|v'|\le \dfrac{pB+(1+|s|)t(q-1)/2}{q}<\dfrac{p}{q}B+\dfrac{(1+|s|)t}{2}$. It decrypts correctly modulo $p$ whenever $pB+(1+|s|)t(q-1)/2<pq/2$. | def centered(x, r):\n y = x % r\n return y - r if y > r // 2 else y\n\ndef modswitch(c, q, p, t):\n tinv = pow(t, -1, q)\n u = centered(-p * c * tinv, q)\n d = t * u\n assert (p * c + d) % q == 0\n assert abs(d) <= t * (q - 1) // 2\n return (p * c + d) // q, d\n\nparams = [(2, 13, 7), (3, 31, 7)... |
MATH-CRYPTO-000342 | math_competition_problem | Homomorphic Encryption | CKKS approximate arithmetic homomorphic encryption and rescaling analysis | Research Level | Let \(N=2^n\) and consider the negacyclic polynomial ring \(R=\mathbb Z[X]/(X^N+1)\), with \(R_q=R/qR\). For \(a=\sum_{j=0}^{N-1} a_j X^j\) identify \(a\) with its coefficient vector and write \(\|a\|_\infty=\max_j |a_j|\), \(\|a\|_1=\sum_j |a_j|\). Fix positive integers \(p,q'\), set \(q=pq'\). Let \(s\in R\) be a sec... | Step 1: Rescaling remainders. For each coefficient, \(c_{i,j}'=\left\lfloor c_{i,j}/p+1/2\right\rfloor\), hence \(|c_{i,j}/p-c_{i,j}'|\le 1/2\). Therefore \(r_i=c_i-p c_i'\) satisfies \(c_i=p c_i'+r_i\) and \(\|r_i\|_\infty\le p/2\).
Step 2: Substitute into the decryption relation. Since \(c_i=p c_i'+r_i\) and \(q=pq'... | The CKKS rescaling error propagates exactly as \[e'=\frac{e-(r_0+r_1s)}{p}\pmod{q'},\qquad c_0'+c_1's=\frac{m}{p}+e'+q'k'.\] Consequently, with \(E=\|e\|_\infty\) and \(H=\|s\|_1\), \[\|e'\|_\infty\le \frac{E}{p}+\frac{1+H}{2}.\] The sharper data-dependent bound is \[\|e'\|_\infty\le \frac{E}{p}+\frac{\|r_0\|_\infty+\|... | from fractions import Fraction
from random import Random
N = 8
def mul(a, b):
res = [0] * N
for i, ai in enumerate(a):
for j, bj in enumerate(b):
deg = i + j
if deg < N:
res[deg] += ai * bj
else:
res[deg - N] -= ai * bj
return res... |
MATH-CRYPTO-000233 | math_competition_problem | Protocol Security | ProVerif applied pi-calculus modeling of TLS 1.3 handshake secrecy and forward secrecy | Research Level | Let N≥1. We work in the applied pi-calculus with an active Dolev-Yao attacker and the standard ProVerif semantics. The signature has sorts Exp, Pub, Key, Nonce, Sig, Cipher. For each session i∈{1,...,N} let x_i and y_i be fresh private ephemeral exponents and let g^{x_i}, g^{y_i} be the corresponding public ephemeral k... | Proof. Define the dependency relation →_N on the finite fact set F_N = Pub_N ∪ {x_i,y_i,dh_i,k_i,hs_i,ltk_A,ltk_B,sig_A,sig_B | 1≤i≤N} by the four rules (D)-(S). Cl_N(R,L) is the least fixed point of the monotone operator T(S)=S ∪ ... . Lemma 1 (fixed-point correctness). For any finite trace of P_N(R,L), the attacker's... | The simplified TLS 1.3 applied-pi model is secure under the stated ideal assumptions: for every N≥1, every long-term-key reveal set R⊆{A,B}, every ephemeral-leak set L⊆{1,...,N}, and every i∉L, k_i∉Cl_N(R,L). Hence ProVerif's query attacker(k_i) is false and forward secrecy holds even after revealing ltk_A and ltk_B. T... | def closure(n, revealed_ltk=True, leaked_sessions=()):
know=set()
for i in range(n):
know.add(f'gx{i}')
know.add(f'gy{i}')
know.add(f'nonce{i}')
for ident in ('A','B'):
know.add(f'vk{ident}')
if revealed_ltk:
for ident in ('A','B'):
know.add(f'ltk{iden... |
MATH-CRYPTO-000336 | math_competition_problem | Zero-Knowledge Proofs | Bulletproofs: inner product arguments without trusted setup and range proofs | Research Level | Let p=101, n=8, and work in \mathbb{F}_p. For vectors x,w in \mathbb{F}_p^n write \langle x,w\rangle=\sum_{i=0}^{n-1}x_iw_i and let \circ denote componentwise multiplication. Put \mathbf{1}=(1,\ldots,1), u=(1,2,4,\ldots,2^{7}), and y^n=(1,y,\ldots,y^{7}). Choose y=3, z=5, and v=173<2^8. Let a_L=(a_0,\ldots,a_7) be the ... | For a binary vector a_L we have a_i\in\{0,1\}. At X=0, t(0)=\langle a_L-z\mathbf{1}, y^n\circ(a_R+z\mathbf{1})+z^2u\rangle. Since a_R=a_L-\mathbf{1}, we have a_R+z\mathbf{1}=a_L+(z-1)\mathbf{1}. Thus the first part of the inner product is \sum_{i=0}^{n-1} y^i(a_i-z)(a_i+z-1). If a_i=1 this term equals (1-z)z=z-z^2; if ... | t(0)=73 in \mathbb{F}_{101}. Equivalently, z^2v=25\cdot 173\equiv 83, Delta=(z-z^2)\sum_{i=0}^{7}y^i-z^3\sum_{i=0}^{7}2^i\equiv 91, and \langle l(0),r(0)\rangle\equiv 73\pmod{101}. | def dot(a,b,p):
return sum(x*y for x,y in zip(a,b)) % p
def main():
p = 101
n = 8
y = 3
z = 5
v_int = 173
bits = [(v_int >> i) & 1 for i in range(n)]
assert bits == [1,0,1,1,0,1,0,1]
u = [pow(2,i,p) for i in range(n)]
v = sum(bits[i]*u[i] for i in range(n)) % p
assert v == 1... |
MATH-CRYPTO-000327 | math_competition_problem | Post-Quantum Cryptography | Falcon NTRU-lattice fast Fourier orthogonalization and trapdoor sampling | Research Level | Let $n$ be a power of two, $\mathcal{R}=\mathbb{Z}[x]/(x^n+1)$ and $\mathcal{K}=\mathbb{Q}[x]/(x^n+1)$. For $a\in\mathcal{K}$ define the adjoint $a^{*}(x)=a(x^{-1})$, computed in $\mathcal{K}$. Let $\Omega=\{\zeta\in\mathbb{C}:\zeta^n=-1\}$ and let $\mathrm{FFT}(a)=(a(\zeta))_{\zeta\in\Omega}$. A Falcon NTRU trapdoor i... | Step 1 (adjoint is conjugation). Write $a=\sum_k a_k x^k$ with $a_k\in\mathbb{Q}$. For $\zeta\in\Omega$ we have $|\zeta|=1$, so $\zeta^{-1}=\overline{\zeta}$. Since $x^n=-1$ holds at $\zeta$, evaluation is a ring homomorphism $\mathcal{K}\to\mathbb{C}$, and $x^{-1}=-x^{n-1}$ is well defined in $\mathcal{K}$. Hence $a^{... | In general, $D_{00}=ff^*+gg^*$, $L_{10}=(Ff^*+Gg^*)/(ff^*+gg^*)$ and $D_{11}=q^2/(ff^*+gg^*)$, so $D_{00}D_{11}=q^2$. For the toy instance at $\zeta=\pm i$: $D_{00}=15$, $D_{11}=48/5$ and $L_{10}=3/5\mp 2i$, i.e. $L_{10}=3/5-2x$. The lattice volume is $q^n=144$. | from fractions import Fraction
# Negacyclic polynomial multiplication in Z[x]/(x^n+1)
def mul(a, b):
n = len(a)
r = [0] * n
for i in range(n):
for j in range(n):
k = i + j
if k < n:
r[k] += a[i] * b[j]
else:
r[k - n] -= a[i] * b[j]... |
MATH-CRYPTO-000333 | math_competition_problem | Zero-Knowledge Proofs | Groth16 Quadratic Arithmetic Programs (QAP) and knowledge soundness | Research Level | Let $p=97$ and $\mathbb{F}=\mathbb{F}_p$. Consider the relation $\mathcal{R}=\{(y;x)\in\mathbb{F}\times\mathbb{F} : x^3+x+5=y\}$. Arithmetize it with the variable vector $z=(z_0,z_1,z_2,z_3,z_4)=(1,\,y,\,x,\,v_1,\,v_2)$. The variables $z_0,z_1$ are public and $z_2,z_3,z_4$ are private. Use the three R1CS constraints $(... | Step 1 (witness values). For $x=3$ we get $v_1=9$, $v_2=27$ and $y=27+3+5=35$. So $z=(1,35,3,9,27)$. The products $A_jz$, $B_jz$, $C_jz$ for $j=1,2,3$ are:
- $A_jz=(3,\,9,\,35)$, since $A_3z=5+3+27$;
- $B_jz=(3,\,3,\,1)$;
- $C_jz=(9,\,27,\,35)$.
Step 2 (interpolation). By linearity of interpolation, $A(X):=\sum z_iu_i... | (a) $h(X)=-10X-6\equiv 87X+91 \pmod{97}$, with interpolants $A=10X^2-24X+17$, $B=-X^2+3X+1$, $C=-5X^2+33X-19$. (b) $W=\{3,18,76\}$, i.e. exactly 3 witnesses. (c) Given the trapdoor, the proof $(a,\,b,\,(ab-\alpha\beta-L_0-y'L_1)/\delta)$ with $L_i=\beta u_i(\tau)+\alpha v_i(\tau)+w_i(\tau)$ is accepted for every $y'$, ... | import random
p=97
xs=[1,2,3]
def padd(a,b):
n=max(len(a),len(b));a=a+[0]*(n-len(a));b=b+[0]*(n-len(b))
return [(x+y)%p for x,y in zip(a,b)]
def pmul(a,b):
r=[0]*(len(a)+len(b)-1)
for i,x in enumerate(a):
for j,y in enumerate(b): r[i+j]=(r[i+j]+x*y)%p
return r
def pscale(a,c): return [(x*c)%... |
MATH-CRYPTO-000307 | math_competition_problem | Algebraic Geometry | Grothendieck duality and Serre duality on coherent sheaves | Research Level | Let $k$ be an algebraically closed field and let $X=\mathbb{P}^2_k$ with structure sheaf $\mathcal{O}_X$. Let $\Omega_X=\Omega_{X/k}$ be the cotangent sheaf and let $\omega_X=\Omega^2_{X/k}$ be the canonical sheaf. The Euler sequence on $X$ is
\[
0\longrightarrow \Omega_X\longrightarrow \mathcal{O}_X(-1)^{\oplus3}\long... | Step 1. Canonical sheaf. On $X=\mathbb{P}^2_k$, the canonical line bundle is $\omega_X\cong\mathcal{O}_X(-3)$; this is the standard formula $\omega_{\mathbb{P}^n}=\mathcal{O}_{\mathbb{P}^n}(-n-1)$. Thus the target of the Ext group is fixed.
Step 2. Serre duality. For a smooth projective variety $X$ of dimension $n$ ov... | \[
\operatorname{Ext}^i_{\mathcal{O}_X}(\Omega_X,\omega_X)\cong
\begin{cases}
k, & i=1,\\
0, & i\ne1.
\end{cases}
\]
Equivalently, the dimension vector is $(0,1,0)$. The Serre duality pairing $\operatorname{Ext}^1(\Omega_X,\omega_X)\times H^1(X,\Omega_X)\to k$ is perfect, with both sides one-dimensional. | import math
def binom(n, k):
if n < 0 or k < 0 or k > n:
return 0
return math.comb(n, k)
def h0(d):
return binom(d + 2, 2) if d >= 0 else 0
def h1(d):
return 0
def h2(d):
if d <= -3:
return binom(-d - 1, 2)
return 0
def h_line(d):
return [h0(d), h1(d), h2(d)]
def chi_li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.