diff --git a/tracks/qmc/solutions/zhong-guo-ren-neng-fei/AGENTS.md b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/AGENTS.md new file mode 100644 index 000000000..865b1fe4a --- /dev/null +++ b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/AGENTS.md @@ -0,0 +1,149 @@ +# Verification instructions for AI reviewers + +These instructions apply to every file in this directory. + +## Purpose + +Act as a skeptical, read-only verifier of the proposed sign-free determinant +construction. Do not treat `results.json`, the prose in `README.md`, or a +successful randomized run as proof by itself. Do not edit the mathematical +claim, the verification code, or recorded results merely to make a check pass. + +The submission makes three different kinds of statements. Keep them separate: + +1. proved statements about products of exponentials of real tridiagonal + Metzler matrices; +2. computational evidence and exact finite-dimensional certificates; +3. literature-search and novelty statements, which are explicitly not claims + of worldwide priority. + +## Before running code + +State the setup that will be checked: + +- real `n`-by-`n` tridiagonal generators; +- nonnegative entries immediately above and below the diagonal; +- arbitrary real diagonal entries; +- arbitrary finite product depth; +- the grand-canonical weight `det(I + P)`; +- open-chain geometry for the interacting realization. + +Ask the user to confirm or correct this setup before starting computation, as +required by the repository-level instructions. The default verification is a +small local CPU run and should take only a few seconds. + +## Reproduce the computational checks + +From the repository root, run: + +```bash +python -m pip install -r tracks/qmc/solutions/zhong-guo-ren-neng-fei/requirements.txt +python tracks/qmc/solutions/zhong-guo-ren-neng-fei/verify.py +``` + +The second command must exit with status zero. Independently inspect the newly +written `results.json`; do not rely only on terminal text. At minimum require: + +- `tn_semigroup.samples` equals 8000; +- `tn_semigroup.negative_determinant_count` equals zero; +- `tn_semigroup.determinant_below_one_count` equals zero; +- `tn_semigroup.minor_violation_count` equals zero; +- `tn_semigroup.minimum_checked_minor` is nonnegative up to the declared + floating-point tolerance; +- the Fock-space trace and one-particle determinant agree to numerical + precision; +- `exact_closing_edge_counterexample.exact_integer_determinant` equals `-1`; +- all Kramers commutant dimensions equal one; +- all tested Majorana skew-`J2` nullities equal zero. + +Re-running the fixed-seed script should not produce an unexplained change in +the tracked `results.json`. A numerical failure is evidence against the +implementation or claim and must be reported, not patched around. + +## Audit the proof independently + +Check each logical implication in `README.md` rather than only its conclusion: + +1. For every exterior-power degree `k`, derive the additive compound + `A^[k]` and verify that tridiagonality prevents a negative wedge-reordering + sign on every allowed off-diagonal transition. +2. Verify that an exponential of a Metzler matrix is entrywise nonnegative. +3. Use `C_k(exp(A)) = exp(A^[k])` to conclude that every minor of `exp(A)` is + nonnegative. +4. Use Cauchy-Binet to check closure under arbitrary finite products. +5. Expand `det(I + P)` as the sum of principal minors, including the empty + minor, to obtain the lower bound one. +6. Multiply the seven integer shear factors in the boundary counterexample + directly and recompute `det(I + P) = -1`. + +Reject or qualify the theorem if any step silently assumes symmetry, strict +positivity, invertibility of minors, fixed product depth, or periodic boundary +conditions. None of those assumptions belongs to the stated theorem. + +## Audit the physical construction + +Check the auxiliary-field identity on all four occupations of two neighboring +spinless-fermion sites. Confirm that: + +- attractive nearest-neighbor density interaction gives a real Gaussian + field; +- each field value changes only real diagonal one-body terms; +- open-chain hopping produces nonnegative nearest-neighbor entries in the + imaginary-time generator under the sign convention stated in `README.md`; +- arbitrary chemical potentials do not spoil the tridiagonal Metzler + property; +- the conclusion concerns the determinant weight for each auxiliary-field + configuration, not the absence of every possible algorithmic difficulty. + +Do not extend the claim to a periodic chain. The exact directed closing-edge +certificate shows why such an extension requires a separate proof. + +## Audit independence from earlier sufficient conditions + +Treat this as a family-level question. An individual matrix may satisfy an +older condition even when the full family does not. + +Verify separately: + +- the nonscalar diagonal-matrix obstruction to a fixed positive-definite + conformal-orthogonal metric; +- the simultaneous presence of `I` and `-I` in the obstruction to a fixed + one-sided split-metric cone; +- the scalar commutant of the matrix units in the no-common-Kramers argument; +- the block calculation forcing a proposed fixed Majorana contraction + structure to vanish. + +If a prior construction is found that covers the complete family after an +allowed fixed change of basis, report the exact theorem and source. Do not +infer containment merely from overlap with one-dimensional, bipartite, or +worldline-sign-free models. + +## Literature and novelty discipline + +The total-nonnegative matrix theory, Vandermonde determinants, and +Karlin-McGregor noncrossing kernels are classical. The submission does not +claim otherwise. A literature search may support the statement that the +specific determinant-QMC formulation was not found, but absence from a search +is not proof of novelty. + +Any stronger priority assessment must: + +- search current primary literature; +- identify exact theorem statements rather than keyword similarities; +- provide links or bibliographic identifiers; +- classify each result as identical, containing, overlapping, or unrelated; +- state unresolved uncertainty explicitly. + +## Verification report + +Return a concise report with: + +1. `PASS`, `FAIL`, or `INCONCLUSIVE`; +2. separate verdicts for the theorem, implementation, physical mapping, + independence checks, and novelty search; +3. the first concrete failing equation, file line, or numerical field, if any; +4. commands run and their exit status; +5. remaining claims that require expert or literature review. + +A `PASS` means the stated bounded claims survived these checks. It must not be +reported as proof of worldwide publication priority. diff --git a/tracks/qmc/solutions/zhong-guo-ren-neng-fei/README.md b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/README.md new file mode 100644 index 000000000..c01d20cf8 --- /dev/null +++ b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/README.md @@ -0,0 +1,557 @@ +# Total positivity and ordered fermion propagation for sign-free determinants + +## Team + +| | | +|---|---| +| **Team name** | zhong-guo-ren-neng-fei | +| **Members** | Zong-yue Liu | + +## Challenge + +| Row | | +|---|---| +| **Challenge** | Test total nonnegativity and ordered one-dimensional fermion propagation as a determinant-QMC sign-free principle beyond fixed split-metric, Kramers, and Majorana constructions. | +| **Catalog issue** | `Addresses #121` — “Sign-problem free hunter,” released by Lei Wang, Institute of Physics, Chinese Academy of Sciences. | +| **Track** | `tracks/qmc/` — selected from the issue’s `Method: Quantum Monte Carlo` field. | + +## Status and scope + +We prove an arbitrary-depth determinant inequality for exponentials of real +tridiagonal Metzler matrices, supply a randomized and exact verification +harness, identify an interacting open-chain auxiliary-field realization, and +give algebraic obstructions to the fixed structures listed in issue #121. + +The underlying theory of totally nonnegative matrices is classical. We do not +claim to have invented total positivity, nor do we claim worldwide priority +for its use in determinant QMC. The research claim at this stage is narrower: + +1. the determinant theorem and physical auxiliary-field construction below + are proved; +2. the full generator family is not contained in the previous + conformal-orthogonal candidate or in the fixed split, Kramers, or 2024 + Majorana contraction conditions; +3. the surveyed sign-problem literature did not reveal this ordered + total-nonnegativity formulation as a DQMC guiding principle; +4. an independent expert novelty review remains necessary before making a + publication-priority claim. + +## 1. Candidate generator family + +Define + +\[ +\mathcal T_n= +\left\{ +A\in M_n(\mathbb R): +A_{ij}=0\ \text{when}\ |i-j|>1,\quad +A_{i,i+1}\geq0,\quad A_{i+1,i}\geq0 +\right\}. +\] + +The diagonal entries are arbitrary real numbers. Thus \(\mathcal T_n\) +consists of tridiagonal Metzler matrices. + +### Theorem + +For every depth \(L\geq1\) and every +\(A_1,\ldots,A_L\in\mathcal T_n\), let + +\[ +P=e^{A_1}e^{A_2}\cdots e^{A_L}. +\] + +Then every minor of \(P\) is nonnegative, and + +\[ +\boxed{\det(I+P)\geq1.} +\] + +In particular, the fermion determinant is strictly positive for every +configuration and every product depth. + +## 2. Proof + +### 2.1 Additive compounds + +For \(1\leq k\leq n\), let \(A^{[k]}\) be the generator induced by \(A\) +on the exterior-power space \(\bigwedge^k\mathbb R^n\). Let \(C_k(M)\) +be the \(k\)-th multiplicative compound matrix; its entries are all +\(k\)-by-\(k\) minors of \(M\), indexed by increasing row and column +subsets. Exterior-power functoriality gives + +\[ +C_k(e^A)=e^{A^{[k]}}. +\] + +### 2.2 Every additive compound is Metzler + +An off-diagonal entry of \(A^{[k]}\) replaces one index in an ordered +\(k\)-subset by another index. For a general dense matrix this replacement +may carry either sign because the resulting wedge basis must be reordered. + +For \(A\in\mathcal T_n\), a nonzero replacement can only move an index +between adjacent sites \(r\) and \(r+1\). If the replacement does not +create a repeated index, its position in the ordered subset is unchanged. +The wedge reordering sign is therefore positive. The corresponding entry +is \(A_{r,r+1}\) or \(A_{r+1,r}\), both nonnegative. + +Hence every \(A^{[k]}\) is Metzler. + +### 2.3 Metzler exponentials are entrywise nonnegative + +If \(M\) is Metzler, choose \(c\) large enough that \(M+cI\) is +entrywise nonnegative. Then + +\[ +e^M +=e^{-c}e^{M+cI} +=e^{-c}\sum_{r=0}^{\infty}\frac{(M+cI)^r}{r!} +\] + +is entrywise nonnegative. Therefore + +\[ +C_k(e^A)=e^{A^{[k]}}\geq0 +\] + +entrywise for every \(k\). Thus \(e^A\) is totally nonnegative. + +### 2.4 Arbitrary products + +The Cauchy–Binet formula expresses every minor of a product as a sum of +products of minors of the factors. Therefore totally nonnegative matrices +are closed under multiplication, and + +\[ +P=e^{A_1}\cdots e^{A_L} +\] + +is totally nonnegative. + +### 2.5 The fermion determinant + +For every square matrix \(P\), + +\[ +\det(I+P) += +\sum_{S\subseteq\{1,\ldots,n\}}\det P[S,S]. +\] + +The empty principal minor equals \(1\). All other terms are nonnegative +because \(P\) is totally nonnegative. Hence + +\[ +\det(I+P)\geq1. +\] + +## 3. Exact boundary counterexample + +The theorem does not extend to arbitrary directed graphs. Let \(E_{ij}\) +denote a three-dimensional matrix unit. Since \(E_{ij}^2=0\), + +\[ +e^{E_{ij}}=I+E_{ij}. +\] + +Adding the directed closing edge \(E_{31}\) yields the exact seven-slice word + +\[ +P=(I+E_{12})^3(I+E_{31})(I+E_{23})^3 += +\begin{pmatrix} +1&3&9\\ +0&1&3\\ +1&0&1 +\end{pmatrix}. +\] + +Consequently, + +\[ +I+P= +\begin{pmatrix} +2&3&9\\ +0&2&3\\ +1&0&2 +\end{pmatrix}, +\qquad +\boxed{\det(I+P)=-1}. +\] + +This is an exact integer certificate. It shows that the open ordered-chain +geometry is essential. The certificate excludes the enlarged class with an +independent directed closing edge; it does not by itself prove that every +Hermitian periodic-chain formulation has a sign problem. + +## 4. Reduction and novelty checks + +The claims below concern the whole family \(\mathcal T_n\). Individual +matrices or smaller subfamilies may of course satisfy older sufficient +conditions. + +### 4.1 Previous conformal-orthogonal candidate + +The previous candidate required a fixed positive-definite matrix \(H\) and + +\[ +A=\alpha I+K,\qquad K^{\mathsf T}H+HK=0. +\] + +The new class contains every nonscalar real diagonal matrix \(D\). If such a +\(D\) admitted the decomposition above, \(K=D-\alpha I\) would have real +eigenvalues. But an \(H\)-skew matrix is similar to a real skew-symmetric +matrix and therefore has purely imaginary eigenvalues. Both statements can +hold only when \(D-\alpha I=0\), contradicting the choice of \(D\). + +Thus \(\mathcal T_n\) is not contained in the previous candidate. + +### 4.2 Fixed split metric + +The split-orthogonal and split-semigroup conditions require a fixed +nondegenerate indefinite metric \(\eta\) satisfying + +\[ +A^{\mathsf T}\eta+\eta A=0 +\] + +or a common one-sided semidefinite inequality. + +The family \(\mathcal T_n\) contains \(I\) and \(-I\). Applying the same +one-sided inequality to both forces equality, while \(A=I\) then gives +\(2\eta=0\), a contradiction. Similarity transformations cannot remove +this obstruction because \(I\) remains \(I\). + +Even after allowing a central scalar to be removed from each generator, +all traceless diagonal matrices \(D\) and \(-D\) remain. For \(n\geq3\), + +\[ +D\eta+\eta D=0 +\] + +for every traceless diagonal \(D\) forces every entry of \(\eta\) to vanish. + +### 4.3 No common Kramers symmetry + +Suppose a common antiunitary symmetry \(\Theta=UK\) fixes every real +generator. Then \(U\) commutes with every generator. The family contains + +\[ +E_{ii},\qquad E_{i,i+1},\qquad E_{i+1,i}. +\] + +These matrix units generate the full real matrix algebra. Its complex +commutant consists only of scalars, so \(U=\lambda I\) and + +\[ +\Theta^2=U\overline U=|\lambda|^2I, +\] + +which cannot equal the Kramers value \(-I\). + +### 4.4 No 2024 Majorana contraction structure + +The 2024 contraction-semigroup condition requires a fixed real orthogonal +skew-symmetric matrix \(J_2\) such that + +\[ +i\left(J_2V-\overline VJ_2\right)\preceq0 +\] + +for every Majorana kernel \(V\), together with a separate \(J_1\) reality +condition. + +For a real diagonal number-conserving generator \(D\), the Majorana kernel, +up to a positive scalar Fock factor, is + +\[ +V(D)=iR(D),\qquad +R(D)= +\begin{pmatrix} +0&D\\ +-D&0 +\end{pmatrix}. +\] + +Because the family contains both \(D\) and \(-D\), the inequality must be an +equality: + +\[ +J_2R(D)+R(D)J_2=0 +\] + +for every real diagonal \(D\). + +Write + +\[ +J_2= +\begin{pmatrix} +X&Y\\ +Z&W +\end{pmatrix}. +\] + +Taking \(D=I\) gives \(Z=Y\) and \(W=-X\). Varying diagonal \(D\) +forces \(X\) and \(Y\) to be diagonal. Skew-symmetry then forces +\(X=Y=0\), hence \(J_2=0\), contradicting orthogonality. + +The obstruction also survives a fixed complex orthogonal Majorana change of +basis. Pulling back its antiunitary operator gives \(CK\), where +\(CR(D)+R(D)C=0\). On each orbital the general block has the form + +\[ +C_i= +\begin{pmatrix} +x_i&y_i\\ +y_i&-x_i +\end{pmatrix}. +\] + +The diagonal entries of \(C_i\overline{C_i}\) are +\(|x_i|^2+|y_i|^2\), so \(C\overline C=-I\) is impossible. + +Since the 2024 paper identifies its symmetric-\(J_1\) branch with Majorana +reflection positivity and its equality cases with the earlier +Majorana-symmetry constructions, this excludes a fixed old structure +covering the full family. + +## 5. Interacting determinant-QMC realization + +Consider an open chain of one-component spinless fermions: + +\[ +H= +-\sum_{i=1}^{n-1}t_i +\left(c_i^\dagger c_{i+1}+c_{i+1}^\dagger c_i\right) +-\sum_i\mu_i n_i +-\sum_{i=1}^{n-1}V_i n_i n_{i+1}, +\] + +with \(t_i\geq0\), \(V_i\geq0\), and arbitrary chemical potentials +\(\mu_i\). The final term is an attractive nearest-neighbor density +interaction. + +For \(a=\Delta\tau V_i\) and \(N_i=n_i+n_{i+1}\), + +\[ +n_i n_{i+1}=\frac{N_i^2-N_i}{2}, +\] + +and the real Gaussian identity gives + +\[ +e^{a n_i n_{i+1}} += +e^{-aN_i/2} +\int_{\mathbb R}\frac{d\phi}{\sqrt{2\pi}}\, +e^{-\phi^2/2} +e^{\sqrt a\,\phi N_i}. +\] + +The auxiliary-field measure is positive, and every field value contributes +only a real diagonal one-body generator. The kinetic imaginary-time +generator has adjacent off-diagonal entries +\(\Delta\tau t_i\geq0\). Thus every kinetic, chemical-potential, and +auxiliary-field factor lies in the semigroup generated by +\(\mathcal T_n\). + +For every auxiliary-field configuration, + +\[ +w(\phi) += +f(\phi) +\det\left(I+\prod_\ell e^{A_\ell(\phi)}\right) +\geq f(\phi)>0, +\] + +where \(f(\phi)\) is the positive Gaussian factor. + +The construction uses one fermion flavor and arbitrary chemical potential, +so it is not restricted to half filling. One-dimensional versions may also +admit worldline or Jordan–Wigner sign-free algorithms; the contribution here +is the determinant-level theorem. + +## 6. Vandermonde and the physical meaning of total positivity + +The total-positivity mechanism has a direct fermionic interpretation rather +than being an arbitrary matrix trick. + +### 6.1 Slater determinants + +For one-particle orbitals \(\phi_j(x)=x^j\), the \(N\)-fermion Slater +matrix is Vandermonde: + +\[ +\Phi_{ij}=x_i^{j-1},\qquad +\det\Phi=\prod_{i Arbitrary finite products of exponentials of real tridiagonal Metzler +> generators are totally nonnegative. Their grand-canonical fermion +> determinants are at least one. The generator family has an open-chain, +> off-half-filled interacting auxiliary-field realization and is not covered +> as a whole by the fixed split, Kramers, or 2024 Majorana contraction +> conditions tested here. diff --git a/tracks/qmc/solutions/zhong-guo-ren-neng-fei/requirements.txt b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/requirements.txt new file mode 100644 index 000000000..f861e4049 --- /dev/null +++ b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/requirements.txt @@ -0,0 +1,2 @@ +numpy>=1.26 +scipy>=1.11 diff --git a/tracks/qmc/solutions/zhong-guo-ren-neng-fei/results.json b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/results.json new file mode 100644 index 000000000..9850c7cff --- /dev/null +++ b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/results.json @@ -0,0 +1,138 @@ +{ + "exact_closing_edge_counterexample": { + "I_plus_product": [ + [ + 2, + 3, + 9 + ], + [ + 0, + 2, + 3 + ], + [ + 1, + 0, + 2 + ] + ], + "each_factor_is": "exp(Eij) = I + Eij because Eij^2 = 0", + "exact_integer_determinant": -1, + "product": [ + [ + 1, + 3, + 9 + ], + [ + 0, + 1, + 3 + ], + [ + 1, + 0, + 1 + ] + ], + "word": [ + "E12", + "E12", + "E12", + "E31", + "E23", + "E23", + "E23" + ] + }, + "fock_trace_check": { + "absolute_difference": 7.105427357601002e-15, + "determinant": 35.852592547734055, + "fock_dimension": 32, + "fock_trace_imag": 0.0, + "fock_trace_real": 35.85259254773405, + "one_particle_dimension": 5 + }, + "known_anchors": { + "component_controls": { + "O_minus_minus_determinant": -0.5, + "mixed_component_determinant": 0.0 + }, + "split_cone": { + "maximum_cone_violation": 0.0, + "minimum_determinant": 3.6150254149035583, + "negative_count": 0, + "samples": 600 + }, + "split_lie": { + "maximum_metric_residual": 8.87334158954865e-15, + "minimum_determinant": 4.000008416107035, + "negative_count": 0, + "samples": 600 + }, + "trials_per_dimension_depth_cell": 50 + }, + "novelty_obstruction_checks": { + "dimensions": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "dirac_commutant_dimensions": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "expected_for_no_2024_contraction_J2": "all nullities equal 0", + "expected_for_no_kramers": "all commutant dimensions equal 1", + "majorana_skew_J2_nullities": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "seed": 121, + "tn_semigroup": { + "depths": [ + 1, + 2, + 4, + 8 + ], + "determinant_below_one_count": 0, + "dimensions": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "exhaustive_all_minor_checks": 64, + "maximum_determinant": 156608.52410555657, + "maximum_generator_structure_violation": 0.0, + "maximum_principal_identity_error": 1.0186340659856796e-10, + "minimum_checked_minor": 5.881419941595498e-29, + "minimum_determinant": 1.0895854257783073, + "minor_violation_count": 0, + "negative_determinant_count": 0, + "principal_identity_checks": 96, + "samples": 8000, + "trials_per_dimension_depth_cell": 250 + } +} \ No newline at end of file diff --git a/tracks/qmc/solutions/zhong-guo-ren-neng-fei/verify.py b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/verify.py new file mode 100644 index 000000000..5a947e2a0 --- /dev/null +++ b/tracks/qmc/solutions/zhong-guo-ren-neng-fei/verify.py @@ -0,0 +1,500 @@ +#!/usr/bin/env python3 +"""Numerical and exact checks for the issue #121 TN-semigroup construction. + +The proof in README.md is the primary result. This program independently +checks known split-group anchors, total nonnegativity, the principal-minor +identity, the Fock-trace identity, novelty obstructions, and an exact +directed-closing-edge counterexample. +""" + +from __future__ import annotations + +import argparse +import json +from itertools import combinations +from pathlib import Path + +import numpy as np +from numpy.typing import NDArray +from scipy.linalg import expm + + +RealArray = NDArray[np.float64] +ComplexArray = NDArray[np.complex128] + + +def product_exponentials(generators: list[RealArray]) -> RealArray: + product = np.eye(generators[0].shape[0]) + for generator in generators: + product = product @ expm(generator) + return product + + +def det_i_plus(matrix: RealArray) -> float: + return float(np.linalg.det(np.eye(matrix.shape[0]) + matrix)) + + +def split_metric(n: int) -> RealArray: + return np.diag(np.r_[np.ones(n), -np.ones(n)]) + + +def split_lie_generator( + rng: np.random.Generator, n: int, scale: float +) -> RealArray: + eta = split_metric(n) + raw = rng.normal(size=(2 * n, 2 * n)) + return scale * 0.5 * (raw - eta @ raw.T @ eta) + + +def split_cone_generator( + rng: np.random.Generator, n: int, scale: float +) -> RealArray: + eta = split_metric(n) + lie_part = split_lie_generator(rng, n, scale) + raw = rng.normal(size=(2 * n, 2 * n)) + positive = raw.T @ raw + positive /= max(1.0, float(np.linalg.norm(positive, ord=2))) + return lie_part + 0.5 * scale * eta @ positive + + +def test_known_anchors( + rng: np.random.Generator, trials_per_cell: int +) -> dict[str, object]: + lie_values: list[float] = [] + cone_values: list[float] = [] + max_lie_residual = 0.0 + max_cone_violation = 0.0 + + for n in (1, 2, 3): + eta = split_metric(n) + for depth in (1, 2, 4, 8): + for _ in range(trials_per_cell): + lie_generators = [ + split_lie_generator(rng, n, scale=0.22) + for _ in range(depth) + ] + lie_product = product_exponentials(lie_generators) + lie_values.append(det_i_plus(lie_product)) + residual = np.linalg.norm( + lie_product.T @ eta @ lie_product - eta, ord=2 + ) + max_lie_residual = max(max_lie_residual, float(residual)) + + cone_generators = [ + split_cone_generator(rng, n, scale=0.14) + for _ in range(depth) + ] + for generator in cone_generators: + cone_matrix = generator.T @ eta + eta @ generator + minimum = float(np.linalg.eigvalsh(cone_matrix).min()) + max_cone_violation = max( + max_cone_violation, max(0.0, -minimum) + ) + cone_values.append( + det_i_plus(product_exponentials(cone_generators)) + ) + + tolerance = 1e-9 + return { + "trials_per_dimension_depth_cell": trials_per_cell, + "split_lie": { + "samples": len(lie_values), + "negative_count": sum(value < -tolerance for value in lie_values), + "minimum_determinant": min(lie_values), + "maximum_metric_residual": max_lie_residual, + }, + "split_cone": { + "samples": len(cone_values), + "negative_count": sum(value < -tolerance for value in cone_values), + "minimum_determinant": min(cone_values), + "maximum_cone_violation": max_cone_violation, + }, + "component_controls": { + "O_minus_minus_determinant": det_i_plus( + np.diag([-2.0, -0.5]) + ), + "mixed_component_determinant": det_i_plus( + np.diag([-1.0, 1.0]) + ), + }, + } + + +def random_tridiagonal_metzler( + rng: np.random.Generator, dimension: int, scale: float +) -> RealArray: + generator = np.diag(rng.normal(scale=scale, size=dimension)) + if dimension > 1: + upper = np.abs(rng.normal(scale=scale, size=dimension - 1)) + lower = np.abs(rng.normal(scale=scale, size=dimension - 1)) + generator += np.diag(upper, 1) + np.diag(lower, -1) + return generator + + +def minimum_minor(matrix: RealArray) -> float: + dimension = matrix.shape[0] + answer = float("inf") + indices = range(dimension) + for order in range(1, dimension + 1): + index_sets = list(combinations(indices, order)) + for rows in index_sets: + for columns in index_sets: + value = float( + np.linalg.det(matrix[np.ix_(rows, columns)]) + ) + answer = min(answer, value) + return answer + + +def principal_minor_sum(matrix: RealArray) -> float: + dimension = matrix.shape[0] + total = 1.0 + indices = range(dimension) + for order in range(1, dimension + 1): + for subset in combinations(indices, order): + total += float(np.linalg.det(matrix[np.ix_(subset, subset)])) + return total + + +def generator_structure_violation(generator: RealArray) -> float: + dimension = generator.shape[0] + violation = 0.0 + for row in range(dimension): + for column in range(dimension): + if abs(row - column) > 1: + violation = max(violation, abs(float(generator[row, column]))) + elif abs(row - column) == 1: + violation = max( + violation, max(0.0, -float(generator[row, column])) + ) + return violation + + +def test_tn_semigroup( + rng: np.random.Generator, + trials_per_cell: int, + minor_checks_per_cell: int, + identity_checks_per_cell: int, +) -> dict[str, object]: + determinants: list[float] = [] + minimum_checked_minor = float("inf") + minor_violations = 0 + minor_checks = 0 + identity_checks = 0 + max_identity_error = 0.0 + max_structure_violation = 0.0 + tolerance = 2e-8 + + for dimension in range(1, 9): + for depth in (1, 2, 4, 8): + for trial in range(trials_per_cell): + generators = [ + random_tridiagonal_metzler( + rng, dimension=dimension, scale=0.24 + ) + for _ in range(depth) + ] + max_structure_violation = max( + max_structure_violation, + *(generator_structure_violation(item) for item in generators), + ) + product = product_exponentials(generators) + determinant = det_i_plus(product) + determinants.append(determinant) + + if trial < minor_checks_per_cell: + checked_minimum = minimum_minor(product) + minimum_checked_minor = min( + minimum_checked_minor, checked_minimum + ) + minor_violations += int(checked_minimum < -tolerance) + minor_checks += 1 + + if trial < identity_checks_per_cell: + expansion = principal_minor_sum(product) + max_identity_error = max( + max_identity_error, abs(expansion - determinant) + ) + identity_checks += 1 + + return { + "dimensions": list(range(1, 9)), + "depths": [1, 2, 4, 8], + "trials_per_dimension_depth_cell": trials_per_cell, + "samples": len(determinants), + "determinant_below_one_count": sum( + value < 1.0 - tolerance for value in determinants + ), + "negative_determinant_count": sum( + value < -tolerance for value in determinants + ), + "minimum_determinant": min(determinants), + "maximum_determinant": max(determinants), + "exhaustive_all_minor_checks": minor_checks, + "minor_violation_count": minor_violations, + "minimum_checked_minor": minimum_checked_minor, + "principal_identity_checks": identity_checks, + "maximum_principal_identity_error": max_identity_error, + "maximum_generator_structure_violation": max_structure_violation, + } + + +def annihilation_operator(dimension: int, orbital: int) -> ComplexArray: + fock_dimension = 1 << dimension + operator = np.zeros((fock_dimension, fock_dimension), dtype=np.complex128) + lower_mask = (1 << orbital) - 1 + for state in range(fock_dimension): + if state & (1 << orbital): + target = state ^ (1 << orbital) + sign = -1 if (state & lower_mask).bit_count() % 2 else 1 + operator[target, state] = sign + return operator + + +def quadratic_lift(matrix: ComplexArray) -> ComplexArray: + dimension = matrix.shape[0] + annihilators = [ + annihilation_operator(dimension, orbital) for orbital in range(dimension) + ] + result = np.zeros((1 << dimension, 1 << dimension), dtype=np.complex128) + for row in range(dimension): + creator = annihilators[row].conj().T + for column in range(dimension): + result += matrix[row, column] * creator @ annihilators[column] + return result + + +def fock_trace_check(rng: np.random.Generator) -> dict[str, float | int]: + dimension = 5 + sequence = [ + random_tridiagonal_metzler(rng, dimension, scale=0.2) + for _ in range(5) + ] + one_particle_product = product_exponentials(sequence) + determinant = det_i_plus(one_particle_product) + + fock_product = np.eye(1 << dimension, dtype=np.complex128) + for generator in sequence: + lift = quadratic_lift(generator.astype(np.complex128)) + fock_product = fock_product @ expm(lift) + fock_trace = np.trace(fock_product) + + return { + "one_particle_dimension": dimension, + "fock_dimension": 1 << dimension, + "determinant": determinant, + "fock_trace_real": float(fock_trace.real), + "fock_trace_imag": float(fock_trace.imag), + "absolute_difference": float(abs(fock_trace - determinant)), + } + + +def matrix_unit(dimension: int, row: int, column: int) -> RealArray: + result = np.zeros((dimension, dimension)) + result[row, column] = 1.0 + return result + + +def numerical_rank(matrix: RealArray, tolerance: float = 1e-10) -> int: + singular_values = np.linalg.svd(matrix, compute_uv=False) + if singular_values.size == 0: + return 0 + threshold = tolerance * max(matrix.shape) * singular_values[0] + return int(np.sum(singular_values > threshold)) + + +def kramers_commutant_dimension(dimension: int) -> int: + identity = np.eye(dimension) + generators = [ + matrix_unit(dimension, index, index) + for index in range(dimension) + ] + for index in range(dimension - 1): + generators.append(matrix_unit(dimension, index, index + 1)) + generators.append(matrix_unit(dimension, index + 1, index)) + + constraints = [ + np.kron(generator.T, identity) + - np.kron(identity, generator) + for generator in generators + ] + stacked = np.vstack(constraints) + return dimension * dimension - numerical_rank(stacked) + + +def majorana_rotation(diagonal: RealArray) -> RealArray: + zero = np.zeros_like(diagonal) + return np.block([[zero, diagonal], [-diagonal, zero]]) + + +def majorana_j2_nullity(dimension: int) -> int: + """Dimension of skew J satisfying {J, R(D)} = 0 for all diagonal D.""" + doubled = 2 * dimension + skew_basis: list[RealArray] = [] + for row in range(doubled): + for column in range(row + 1, doubled): + basis = np.zeros((doubled, doubled)) + basis[row, column] = 1.0 + basis[column, row] = -1.0 + skew_basis.append(basis) + + rotations = [ + majorana_rotation( + np.diag( + [ + 1.0 if index == selected else 0.0 + for index in range(dimension) + ] + ) + ) + for selected in range(dimension) + ] + columns = [] + for basis in skew_basis: + image = np.concatenate( + [ + (basis @ rotation + rotation @ basis).reshape(-1) + for rotation in rotations + ] + ) + columns.append(image) + constraint = np.column_stack(columns) + return len(skew_basis) - numerical_rank(constraint) + + +def novelty_obstruction_checks() -> dict[str, object]: + dimensions = list(range(2, 9)) + return { + "dimensions": dimensions, + "dirac_commutant_dimensions": [ + kramers_commutant_dimension(item) for item in dimensions + ], + "majorana_skew_J2_nullities": [ + majorana_j2_nullity(item) for item in dimensions + ], + "expected_for_no_kramers": "all commutant dimensions equal 1", + "expected_for_no_2024_contraction_J2": "all nullities equal 0", + } + + +def det3_integer(matrix: NDArray[np.object_]) -> int: + a, b, c = matrix[0] + d, e, f = matrix[1] + g, h, i = matrix[2] + return int( + a * (e * i - f * h) + - b * (d * i - f * g) + + c * (d * h - e * g) + ) + + +def exact_closing_edge_counterexample() -> dict[str, object]: + identity = np.eye(3, dtype=object) + + def integer_unit(row: int, column: int) -> NDArray[np.object_]: + result = np.zeros((3, 3), dtype=object) + result[row, column] = 1 + return result + + e12 = integer_unit(0, 1) + e31 = integer_unit(2, 0) + e23 = integer_unit(1, 2) + elementary_factors = [ + identity + e12, + identity + e12, + identity + e12, + identity + e31, + identity + e23, + identity + e23, + identity + e23, + ] + product = identity.copy() + for factor in elementary_factors: + product = product @ factor + determinant = det3_integer(identity + product) + + return { + "word": ["E12", "E12", "E12", "E31", "E23", "E23", "E23"], + "each_factor_is": "exp(Eij) = I + Eij because Eij^2 = 0", + "product": [[int(value) for value in row] for row in product], + "I_plus_product": [ + [int(value) for value in row] for row in identity + product + ], + "exact_integer_determinant": determinant, + } + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument( + "--trials", + type=int, + default=250, + help="TN trials per dimension/depth cell (default: 250)", + ) + parser.add_argument( + "--anchor-trials", + type=int, + default=50, + help="known-class anchor trials per cell (default: 50)", + ) + parser.add_argument("--seed", type=int, default=121) + parser.add_argument( + "--output", + type=Path, + default=Path(__file__).with_name("results.json"), + ) + args = parser.parse_args() + + rng = np.random.default_rng(args.seed) + results = { + "seed": args.seed, + "known_anchors": test_known_anchors(rng, args.anchor_trials), + "tn_semigroup": test_tn_semigroup( + rng, + trials_per_cell=args.trials, + minor_checks_per_cell=2, + identity_checks_per_cell=3, + ), + "fock_trace_check": fock_trace_check(rng), + "novelty_obstruction_checks": novelty_obstruction_checks(), + "exact_closing_edge_counterexample": ( + exact_closing_edge_counterexample() + ), + } + args.output.write_text( + json.dumps(results, indent=2, sort_keys=True), encoding="utf-8" + ) + print(json.dumps(results, indent=2, sort_keys=True), flush=True) + + known = results["known_anchors"] + tn = results["tn_semigroup"] + fock = results["fock_trace_check"] + obstruction = results["novelty_obstruction_checks"] + counterexample = results["exact_closing_edge_counterexample"] + + failed = ( + known["split_lie"]["negative_count"] != 0 + or known["split_cone"]["negative_count"] != 0 + or known["component_controls"]["O_minus_minus_determinant"] >= 0 + or abs(known["component_controls"]["mixed_component_determinant"]) > 1e-12 + or tn["determinant_below_one_count"] != 0 + or tn["minor_violation_count"] != 0 + or tn["maximum_principal_identity_error"] > 2e-7 + or fock["absolute_difference"] > 2e-8 + or any( + value != 1 + for value in obstruction["dirac_commutant_dimensions"] + ) + or any( + value != 0 + for value in obstruction["majorana_skew_J2_nullities"] + ) + or counterexample["exact_integer_determinant"] != -1 + ) + if failed: + raise SystemExit(1) + + +if __name__ == "__main__": + main()