1#!/usr/bin/env python32"""Agent G — builds manuscript/references_part07a.bib and manuscript/references_verification_part07a.csv from single live3lookups (Crossref for DOIs, DataCite for LIPIcs/OASIcs DOIs, arXiv export API for preprints). Nothing is typed from memory:4authors, titles, venues and years come from the resolved record. Keys: surname + Crossref/DataCite issued year + keyword."""5import json, urllib.request, urllib.parse, re, time, csv, os, sys6R = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))); M = "mailto=spbou4@icloud.com"7CR = {"czerwinski2019petri": "10.1145/3313276.3316369", "czerwinski2021ackermann": "10.1109/FOCS52979.2021.00120", "leroux2021notprimitive": "10.1109/FOCS52979.2021.00121",8 "wang2024llmtesting": "10.1109/tse.2024.3368208", "zhang2022mltesting": "10.1109/tse.2019.2962027", "cui2026genaiwork": "10.1287/mnsc.2025.00535", "li2024llift": "10.1145/3649828",9 "yang2024whitefox": "10.1145/3689736", "baghdadi2019tiramisu": "10.1109/cgo.2019.8661197", "wang2018mlcompiler": "10.1109/jproc.2018.2817118", "ashouri2018autotuning": "10.1145/3197978",10 "cummins2025llmcompiler": "10.1145/3708493.3712691", "munley2024llm4vv": "10.1016/j.future.2024.05.034", "barbosa2022cvc5": "10.1007/978-3-030-99524-9_24", "beyer2024svcomp": "10.1007/978-3-031-57256-2_15",11 "katz2019marabou": "10.1007/978-3-030-25540-4_26", "singh2019deeppoly": "10.1145/3290354", "permenev2020verx": "10.1109/sp40000.2020.00024", "willsey2021egg": "10.1145/3434304", "kalra2018zeus": "10.14722/ndss.2018.23082",12 "papadakis2019mutation": "10.1016/bs.adcom.2018.03.015", "abualigah2021aoa": "10.1016/j.cma.2020.113609", "abualigah2021aquila": "10.1016/j.cie.2021.107250", "biere2021handbook": "10.3233/faia336",13 "li2019kolmogorov": "10.1007/978-3-030-11298-1", "sorensen2013metaphor": "10.1111/itor.12001", "aranha2021metaphor": "10.1007/s11721-021-00202-9", "camachovillalon2022exposing": "10.1111/itor.13176",14 "mitzenmacher2022predictions": "10.1145/3528087", "mankowitz2023alphadev": "10.1038/s41586-023-06004-9", "lopes2021alive2": "10.1145/3453483.3454030", "yang2011csmith": "10.1145/1993498.1993532",15 "xia2024fuzz4all": "10.1145/3597503.3639121", "xia2023apr": "10.1109/ICSE48619.2023.00129", "kang2023fewshottesters": "10.1109/icse48619.2023.00194", "lattuada2024verus": "10.1145/3694715.3695952",16 "brix2023vnncomp": "10.1007/s10009-023-00703-4", "katz2017reluplex": "10.1007/978-3-319-63387-9_5", "cygan2015parameterized": "10.1007/978-3-319-21275-3", "vassilevskawilliams2019finegrained": "10.1142/9789813272880_0188",17 "lykouris2021caching": "10.1145/3447579", "chen2018metamorphicsurvey": "10.1145/3143561", "perry2023insecure": "10.1145/3576915.3623157", "ragankelley2013halide": "10.1145/2491956.2462176",18 "merrill2023parallelism": "10.1162/tacl_a_00562", "strobl2024survey": "10.1162/tacl_a_00663", "willsey2026eggcacm": "10.1145/3815481", "lynch2026ioautomata": "10.1145/3788687",19 "bernstein2022negative": "10.1109/focs54457.2022.00063", "duan2025sorting": "10.1145/3717823.3718179", "williams2025sqrtspace": "10.1145/3717823.3718225", "farachcolton2024openaddressing": "10.1109/focs61266.2024.00045"}20DC = {"jakubuv2023mizar": "10.4230/lipics.itp.2023.19", "chen2025apiss": "10.4230/lipics.ecoop.2025.6", "pham2025kdtree": "10.4230/lipics.wads.2025.45", "langedal2024mis": "10.4230/lipics.sea.2024.20",21 "naqvi2026bigger": "10.4230/lipics.esem.2026.34", "klampfl2024asp": "10.4230/oasics.dx.2024.10", "gasparlopes2025vuln": "10.4230/oasics.icpec.2025.4", "awadid2025robust": "10.4230/oasics.saia.2024.1"}22AX = {"becker2025metr": "2507.09089", "yang2023leandojo": "2306.15626", "xin2024deepseekprover": "2405.14333", "yang2024sweagent": "2405.15793", "novikov2025alphaevolve": "2506.13131"}23TITLE_FIX = {"vassilevskawilliams2019finegrained": "On some fine-grained questions in algorithms and complexity", "ragankelley2013halide": "Halide: a language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines"}24def get(u):25 req = urllib.request.Request(u, headers={"User-Agent": "wp44-agentG (mailto:spbou4@icloud.com)"}); return urllib.request.urlopen(req, timeout=60).read().decode()26def tex(s): return s.replace("&", "\\&").replace("%", "\\%").replace("_", "\\_").replace("#", "\\#").replace("—", "---").replace("–", "--").replace("‐", "-")27entries = []; ver = []28def add(kind, key, fields):29 body = ",\n".join(f" {k} = {{{tex(str(v))}}}" for k, v in fields.items() if v not in ("", None))30 entries.append(f"@{kind}{{{key},\n{body}\n}}")31for key, doi in CR.items():32 j = json.loads(get(f"https://api.crossref.org/works/{urllib.parse.quote(doi)}?{M}"))["message"]; time.sleep(0.25)33 au = " and ".join(f"{a.get('family','')}, {a.get('given','')}".strip(", ") for a in j.get("author", [])) or " and ".join(f"{a.get('family','')}, {a.get('given','')}" for a in j.get("editor", []))34 title = TITLE_FIX.get(key, (j.get("title") or [""])[0]); cont = (j.get("container-title") or [""])[0]; year = j["issued"]["date-parts"][0][0]; t = j.get("type")35 f = {"author": au, "title": "{" + title + "}", "year": year, "doi": doi}36 if t == "journal-article": kind = "article"; f.update(journal=cont, volume=j.get("volume", ""), number=j.get("issue", ""), pages=j.get("page", ""))37 elif t in ("proceedings-article", "proceedings"): kind = "inproceedings"; f.update(booktitle=cont, pages=j.get("page", ""), publisher=j.get("publisher", ""))38 elif t == "book-chapter": kind = "incollection"; f.update(booktitle=cont, pages=j.get("page", ""), publisher=j.get("publisher", ""))39 else: kind = "book"; f.update(publisher=j.get("publisher", ""), series=cont)40 if key == "vassilevskawilliams2019finegrained": f["booktitle"] = "Proceedings of the International Congress of Mathematicians (ICM 2018)"41 add(kind, key, f); ver.append((key, doi, "crossref", title, "yes"))42for key, doi in DC.items():43 j = json.loads(get(f"https://api.datacite.org/dois/{urllib.parse.quote(doi)}"))["data"]["attributes"]; time.sleep(0.25)44 au = " and ".join(c.get("name", "") for c in j.get("creators", [])); title = j["titles"][0]["title"]; cont = (j.get("container") or {}).get("title", "")45 add("inproceedings", key, {"author": au, "title": "{" + title + "}", "booktitle": cont, "year": j.get("publicationYear"), "publisher": "Schloss Dagstuhl -- Leibniz-Zentrum f{\\\"u}r Informatik", "doi": doi})46 ver.append((key, doi, "datacite", title, "yes"))47for key, i in AX.items():48 for attempt in range(4):49 try: x = get(f"https://export.arxiv.org/api/query?id_list={i}"); break50 except Exception: time.sleep(4)51 e = x.split("<entry>")[1]; title = re.sub(r"\s+", " ", re.search(r"<title>(.*?)</title>", e, re.S).group(1)).strip(); year = re.search(r"<published>(\d{4})", e).group(1)52 au = " and ".join(re.findall(r"<name>(.*?)</name>", e)); time.sleep(1)53 add("misc", key, {"author": au, "title": "{" + title + "}", "year": year, "eprint": i, "archiveprefix": "arXiv", "note": "arXiv preprint arXiv:" + i + " (not peer-reviewed)", "url": "https://arxiv.org/abs/" + i})54 ver.append((key, "arXiv:" + i, "arxiv", title, "yes"))55hdr = "% references_part07a.bib — Part VII-a (theory half), Agent G, 2026-11-03. Every entry resolved by a single live lookup\n% (Crossref / DataCite / arXiv); see references_verification_part07a.csv. Generated by literature_synthesis/agent_G/make_bib_part07a.py.\n\n"56open(f"{R}/manuscript/references_part07a.bib", "w").write(hdr + "\n\n".join(entries) + "\n")57with open(f"{R}/manuscript/references_verification_part07a.csv", "w", newline="") as fh:58 w = csv.writer(fh); w.writerow(["key", "doi_or_arxiv", "verified_via", "verified_title", "match"]); w.writerows(ver)59print(len(entries), "entries")60