#!/usr/bin/env python3 """Generate the deterministic, exact research-record collection. No external dependencies. This constructs analytic records; it does not run an empirical benchmark or establish the manuscript's all-rank theorems. The single 'train' split is a Hub collection partition, not a claim that this is a training corpus or that an evaluation protocol exists. """ from __future__ import annotations import argparse from fractions import Fraction import hashlib import itertools import json from math import comb, isqrt from pathlib import Path VERSION = "1.0.0" SOURCE_PDF = "manuscript/Elyxune_Manuscript.pdf" SOURCE_TEX = "manuscript/Elyxune_Manuscript.tex" STATUS = "proved_in_manuscript" PRIORITY = "not_exhaustively_established" def fraction_text(x: Fraction) -> str: return f"{x.numerator}/{x.denominator}" def family_weight(rank: int, s: Fraction, lam: Fraction, basis: tuple[int, ...]) -> Fraction: """Ordinary multi-affine coefficient mu(C), Eq. (9), one-based labels.""" j = sum(i <= rank for i in basis) h = (s * lam) ** (j * (j - 1) // 2) return (j + 1) * s**j * h / comb(rank, j) if 2*rank in basis else h / comb(rank, j) def claim_records(source_hash: str) -> list[dict]: bh = "https://web.math.princeton.edu/~huh/Lorentzian.pdf" algvv = "https://arxiv.org/pdf/2004.07220" bhkl = "https://arxiv.org/abs/2607.15375" items = [ ("sharp_exchange_chain", 1, "theorem", "main", "Sharp root, sum and maximum exchange", "P <= (2^(d-1)/d)*(sum_j sqrt(E_j))^2 <= 2^(d-1)*sum_j E_j <= d*2^(d-1)*max_j E_j.", ["The generating polynomial is homogeneous, multi-affine and Lorentzian with nonnegative coefficients.", "S,T have positive weights; i is prescribed in S\\T; d=|S\\T|; E_j=mu(S-i+j)*mu(T+i-j)."], "Contract the common intersection, aggregate variables with arbitrary positive weights into a ternary polynomial, telescope quadratic Hessian determinants, and optimize the weights. An explicit interior family proves optimality.", ["Optimality is a supremum statement; attainment by one polynomial is not asserted.", "The input class and prescribed-element quantifier are essential."], [bh]), ("exact_max_exchange_constant", 2, "corollary", "constant", "Exact universal approximate-exchange constant", "C_r = r*2^(r-1); the exact constant at exchange distance d is d*2^(d-1).", ["C_r is universal over all ground sets, supports, positive-weight pairs and prescribed differing elements in the rank-r homogeneous multi-affine log-concave class."], "The sharp chain gives the upper bound; equal-exchange rational families approach it with exchange distance r.", ["This is an intrinsic inequality constant, not a lower bound for an optimization algorithm."], [algvv,bh]), ("sharp_lq_exchange_profile", 3, "theorem", "lq", "Complete sharp l_q exchange profile", "P <= K_(d,q)*||E||_q, with K_(d,q)=2^(d-1)*d^(1-1/q), for 1/2<=q<=infinity and 1/infinity=0.", ["Use the unnormalized profile ||E||_q=(sum_j E_j^q)^(1/q), and the maximum at q=infinity.", "The assumptions and exchange products are those of Theorem 1."], "Apply finite-dimensional Holder to the sharp root-sum bound. Equal exchange products in the construction prove sharpness for every q simultaneously.", ["For q<1 this profile is a quasi-norm.", "No claim is made for q<1/2."], [bh]), ("ternary_telescoping", 4, "lemma", "telescoping", "Ternary telescoping endpoint bound", "h_d*g_0 <= 2^(d-1)*h_1*g_(d-1) for the normalized nonnegative Lorentzian polynomial F=H(x,y)+u*G(x,y) of degree d.", ["F is affine in u, H has degree d and G has degree d-1.", "Coefficients h_j,g_j use the factorial-normalized monomial convention in the manuscript."], "The 3x3 quadratic Hessian determinant gives h_(j+2)/h_(j+1)<=2*g_(j+1)/g_j in the positive case. Telescope; handle zeros by binary epsilon mixing and continuity.", ["Nonnegative linear-substitution closure is a standard structural input."], [bh]), ("rational_near_extremizers", 5, "corollary", "rational", "Finite rational near-extremizers", "For each d>=2 and 0=max(2,(d-1)/(2*epsilon)), lambda=2-1/N and s=1/(2*N)."], "The ratio to the supremal constant is (1-1/(2*N))^(d-1), bounded below by Bernoulli's inequality. Coefficients have an explicit rational formula.", ["These are constructed mathematical coefficients, not empirical measurements.", "Sharpness is approached; exact equality in the interior is not claimed."], [bh]), ("polynomial_exchange_negative_answer", 6, "corollary", "refutation", "Negative answer to polynomial approximate exchange", "No universal polynomial p(r) guarantees prescribed-element symmetric exchange for every rank-r homogeneous multi-affine log-concave generating polynomial.", ["The prescribed-element definition is Definition 24 in arXiv:2004.07220v2.", "Fix lambda=3/2, s=1/4, t=3/8 in the geometric family."], "For S=B+u, T=A and prescribed i=u, every possible exchange has ratio r*(3/2)^(r-1), which exceeds every fixed polynomial for large r.", ["The mathematical implication targets the unnumbered Section 4 conjecture as printed.", "Historical priority is not exhaustively established.", "Weak exchange notions with different quantifiers are separate."], [algvv]), ("ternary_local_criterion", 7, "proposition", "ternarycriterion", "Exact positive ternary local criterion", "For positive h_j,g_j, F=H+u*G is Lorentzian iff g_j*g_(j+2)<=g_(j+1)^2 and G_j/H_j + H_(j+1)/G_j <=2, with H_j=h_(j+1)/h_j and G_j=g_(j+1)/g_j.", ["F has degree d>=2, is affine in u, and its normalized binary coefficient sequences are strictly positive.", "Index ranges are as in Proposition 7."], "Exhaust the quadratic derivatives. Those containing u give binary log-concavity; the other 3x3 Hessians give the displayed determinant condition.", ["The positive-coefficient assumption is part of this local characterization."], [bh]), ("ternary_transfer_region", 8, "theorem", "transferregion", "Exact transfer region and realizers", "For a=2 and M-convex support, Lorentzianity is equivalent to g Lorentzian and A_alpha restricted to ker(v_alpha^T) negative semidefinite when v_alpha!=0; when v_alpha=0, A_alpha has at most one positive eigenvalue.", ["h has degree r, g degree r-1, and coefficients are nonnegative.", "A_alpha=Hessian(partial^alpha h), v_alpha=gradient(partial^alpha g), |alpha|=r-2."], "A bordered Hessian is congruent to one hyperbolic plane plus the restriction of A_alpha to ker(v_alpha^T). For fixed g the restrictions are linear matrix inequalities in h.", ["The convex description is on a fixed full positive support stratum.", "Arbitrary support changes are not declared convex."], [bh]), ("strong_hyperfield_parameter_lower_bound", None, "derived_consequence", "Hyperfield and phase-completion consequences", "Necessary growing strong hyperfield parameter", "A parameter representing every Lorentzian coefficient vector on U_(d,2d) strongly over T_p must satisfy p>=1+(d-1)*log(2)/log(d).", ["d>=2; strong relations use polygon closure of p-th roots.", "Use the family relation with products proportional to (d*lambda^(d-1),1,...,1)."], "The one displayed strong relation requires (d*lambda^(d-1))^(1/p)<=d; let lambda increase to 2.", ["This is necessary, not a sufficient parameter for all coefficients on a fixed support.", "Question 8.6 is excluded."], [bhkl]), ("integer_strong_T2_obstruction", None, "explicit_witness", "Hyperfield and phase-completion consequences", "Six-element integer obstruction", "The rank-3 integer cubic specified in the manuscript is Lorentzian with active inertia (1,4,0), but its relation products (154,16,16,16) fail strong T_2 because 154>144.", ["A={1,2,3}, B={4,5}, u=6; coefficient types are 14,11,4,8 as specified in the manuscript."], "Exact characteristic polynomials certify the six active Hessian signatures; the explicit four-product inequality certifies failure.", ["This is a finite mathematical witness, not a benchmark measurement."], []), ("minimality_strong_T2_six_elements", None, "derived_consequence", "Hyperfield and phase-completion consequences", "Minimal ground-set size for strong T_2 failure", "Six is the smallest ground-set size of a matroid supporting a multi-affine Lorentzian coefficient vector that fails strong T_2 representability.", ["The input is a multi-affine Lorentzian coefficient vector on a matroid."], "Lorentzianity implies weak T_2. For n<=5 every strong relation has at most three potential terms, so it is trivial or weak. The integer cubic supplies the six-element counterexample.", ["This minimum concerns strong T_2 representability, not actual complex squared-minor completion."], [bhkl]), ] return [{ "record_id": cid, "title": title, "statement_number": number, "statement_kind": kind, "source_anchor": anchor, "statement": statement, "assumptions": assumptions, "proof_summary": proof, "limitations": limits, "proof_status": STATUS, "historical_priority": PRIORITY, "proof_assistant_verified": False, "source_pdf": SOURCE_PDF, "source_tex": SOURCE_TEX, "source_tex_sha256": source_hash, "context_references": refs, "record_provenance": "research_statement_from_included_manuscript", "dataset_version": VERSION, } for cid,number,kind,anchor,title,statement,assumptions,proof,limits,refs in items] def family_records(source_hash: str) -> list[dict]: rows=[] for rank in range(2,7): specs=[ ("polynomial_exchange_counterexample", Fraction(1,4), Fraction(3,2), None), ("strict_reference", Fraction(1,10), Fraction(9,5), None), ("near_optimal_N_100r", Fraction(1,200*rank), Fraction(2)-Fraction(1,100*rank), 100*rank), ] for family_id,s,lam,N in specs: assert 1 < lam < 2 and 0 < s < 2-lam t=s*lam assert 00 rows.append({ "record_id": f"{family_id}_r{rank}_"+"-".join(map(str,basis)), "family_id": family_id,"rank":rank,"ground_set_size":2*rank, "matroid_support":f"U_({rank},{2*rank})","basis":list(basis), "a_count":sum(i<=rank for i in basis),"u_in_basis":u in basis, "label_convention":"one_based_A_1_to_r_B_rplus1_to_2rminus1_u_2r", "s_numerator":str(s.numerator),"s_denominator":str(s.denominator), "lambda_numerator":str(lam.numerator),"lambda_denominator":str(lam.denominator), "t_numerator":str(t.numerator),"t_denominator":str(t.denominator), "near_optimal_N":N, "coefficient_numerator":str(w.numerator),"coefficient_denominator":str(w.denominator), "coefficient_exact":fraction_text(w), "target_to_each_exchange_numerator":str(expected.numerator), "target_to_each_exchange_denominator":str(expected.denominator), "target_to_each_exchange_exact":fraction_text(expected), "coefficient_convention":"ordinary_multi_affine_weight_mu_C_manuscript_equation_9", "generation_check":"exact_formula_parameter_bounds_and_equal_exchange_ratios_passed", "global_property_status":"Lorentzian_interior_property_proved_in_manuscript", "proof_assistant_verified":False,"source_tex":SOURCE_TEX, "source_tex_sha256":source_hash,"dataset_version":VERSION, "record_provenance":"analytically_constructed_rational_coefficient_not_observation", }) return rows def extract_square(n: int) -> tuple[int,int]: """Return a,b with sqrt(n)=a*sqrt(b), b squarefree.""" a=1;b=n;p=2 while p*p<=b: while b%(p*p)==0: a*=p;b//=p*p p+=1 return a,b def profile_records(source_hash: str) -> list[dict]: rows=[] for d in range(1,129): for label,q in [("1/2",Fraction(1,2)),("1",Fraction(1)),("2",Fraction(2)),("infinity",None)]: rational=None if label=="1/2":rational=Fraction(2**(d-1),d) elif label=="1":rational=Fraction(2**(d-1)) elif label=="infinity":rational=Fraction(d*2**(d-1)) else: a,b=extract_square(d) if b==1:rational=Fraction(2**(d-1)*a) if rational is not None: expression=fraction_text(rational) else: a,b=extract_square(d) expression=f"{2**(d-1)*a}*sqrt({b})" rows.append({ "record_id":f"d{d}_q{label.replace('/','_')}","exchange_distance":d, "q_label":label,"q_is_infinite":q is None, "q_numerator":None if q is None else str(q.numerator), "q_denominator":None if q is None else str(q.denominator), "profile_kind":"quasi_norm" if label=="1/2" else "norm", "constant_is_rational":rational is not None, "constant_rational_numerator":None if rational is None else str(rational.numerator), "constant_rational_denominator":None if rational is None else str(rational.denominator), "constant_expression":expression, "general_formula":"2^(d-1)*d^(1-1/q); 1/infinity=0", "inequality":"mu(S)*mu(T) <= K_(d,q)*unnormalized_lq_exchange_profile", "sharpness_status":"optimal_supremum_proved_in_manuscript", "proof_status":STATUS,"historical_priority":PRIORITY, "proof_assistant_verified":False,"source_theorem":"Theorem 3", "source_pdf":SOURCE_PDF,"source_tex":SOURCE_TEX, "source_tex_sha256":source_hash,"dataset_version":VERSION, "record_provenance":"exact_analytic_constant_not_empirical_measurement", }) return rows def infer_field_schema(rows: list[dict]) -> dict: out={} keys=list(rows[0]) assert all(list(r)==keys for r in rows) for key in keys: values=[r[key] for r in rows] nonnull=[v for v in values if v is not None] sample=nonnull[0] if nonnull else None if isinstance(sample,bool):typ="boolean" elif isinstance(sample,int):typ="integer" elif isinstance(sample,str):typ="string" elif isinstance(sample,list):typ="array" if sample and isinstance(sample[0],int) else "array" else:raise TypeError((key,type(sample))) out[key]={"type":typ,"nullable":any(v is None for v in values)} return out def main(repository: Path, manuscript: Path): data=repository/"data" source=manuscript.read_bytes();source_hash=hashlib.sha256(source).hexdigest() text=source.decode("utf-8") for anchor in ["main","constant","lq","telescoping","rational","refutation","ternarycriterion","transferregion","extension"]: assert "\\label{"+anchor+"}" in text configs={"claims":claim_records(source_hash),"family_coefficients":family_records(source_hash),"exchange_profiles":profile_records(source_hash)} outputs={} for name,rows in configs.items(): assert len({r['record_id'] for r in rows})==len(rows) target=data/name/"train.jsonl";target.parent.mkdir(parents=True,exist_ok=True) target.write_text("".join(json.dumps(r,ensure_ascii=False,separators=(',',':'))+"\n" for r in rows),encoding="utf-8") for line in target.read_text().splitlines():json.loads(line) outputs[name]={"path":f"data/{name}/train.jsonl","split":"train","rows":len(rows),"sha256":hashlib.sha256(target.read_bytes()).hexdigest(),"features":infer_field_schema(rows)} schema={ "dataset_version":VERSION, "collection_kind":"machine_readable_mathematical_research_records", "split_semantics":"train is a Hub collection partition only; no training/evaluation split or model benchmark is claimed", "source_tex":SOURCE_TEX,"source_pdf":SOURCE_PDF,"source_tex_sha256":source_hash, "configs":outputs, "exact_number_encoding":{ "rational":"A reduced rational uses base-10 string numerator and positive base-10 string denominator; exact strings are numerator/denominator, including /1.", "large_integers":"Numerators and denominators are strings to avoid 64-bit overflow and float rounding.", "irrational_profile_constant":"For q=2 and nonsquare d, constant_expression is an exact integer times sqrt(squarefree_integer); rational numerator and denominator are null.", "infinite_q":"q_is_infinite is true and q_numerator/q_denominator are null; use q_label=infinity.", }, "family_formula":"Let j=|C intersect A|, t=s*lambda, h_j=t^(j*(j-1)/2), g_j=s^j*h_j. mu(C)=h_j/binom(r,j) if u notin C, otherwise (j+1)*g_j/binom(r,j).", "family_parameters":["polynomial_exchange_counterexample: s=1/4, lambda=3/2","strict_reference: s=1/10, lambda=9/5","near_optimal_N_100r: N=100*r, s=1/(2*N), lambda=2-1/N"], "labels":"Family records are one-based: A=1..r, B=r+1..2r-1, u=2r.", "status":"The all-rank theorem is established by the included manuscript proof; generation checks verify formulas and finite identities only. No proof-assistant formalization or exhaustive novelty claim.", "generation_script":"scripts/generate_dataset.py", } (data/"dataset_schema.json").write_text(json.dumps(schema,indent=2,ensure_ascii=False)+"\n",encoding="utf-8") print(json.dumps({"configs":{k:{"rows":v['rows'],"path":v['path']} for k,v in outputs.items()},"schema":"data/dataset_schema.json","source_tex_sha256":source_hash},indent=2)) if __name__=="__main__": parser=argparse.ArgumentParser() parser.add_argument("--repository",type=Path,default=Path(__file__).resolve().parents[1]) parser.add_argument("--manuscript-source",type=Path,default=None) args=parser.parse_args() manuscript=args.manuscript_source or args.repository/SOURCE_TEX main(args.repository,manuscript)