diff --git a/.github/workflows/rhd03-main-proof.yml b/.github/workflows/rhd03-main-proof.yml new file mode 100644 index 00000000..aa86a586 --- /dev/null +++ b/.github/workflows/rhd03-main-proof.yml @@ -0,0 +1,95 @@ +name: RHD-03 actual Main source and literature interface + +on: + push: + paths: + - 'MathCan/RHMainLogic.lean' + - 'MathCan.lean' + - 'research/rh_proof_distillation/main_character_dependency_audit.py' + - 'tests/test_rhd03_main_source.py' + - 'research/rh_proof_distillation/MAIN_PROOF_SOURCE.md' + - '.github/workflows/rhd03-main-proof.yml' + pull_request: + paths: + - 'MathCan/RHMainLogic.lean' + - 'MathCan.lean' + - 'research/rh_proof_distillation/main_character_dependency_audit.py' + - 'tests/test_rhd03_main_source.py' + - 'research/rh_proof_distillation/MAIN_PROOF_SOURCE.md' + - '.github/workflows/rhd03-main-proof.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + main-source-audit: + runs-on: ubuntu-latest + timeout-minutes: 25 + steps: + - uses: actions/checkout@v4 + with: + path: mathcan + persist-credentials: false + - uses: actions/checkout@v4 + with: + repository: leanprover-community/riemann-hypothesis + ref: f150e02623b1e2bbe1f1da8eab5ffee5e930a6a3 + path: upstream + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: | + src/Main.lean + src/Supplements/Kernels/MainTheorems.lean + src/Development/AutomorphicArithmetic/CharacterBoxes/MainConclusion.lean + src/Development/AutomorphicArithmetic/Foundations/GaloisRepresentations/IntegralStructures/RowSrc.lean + src/Development/AutomorphicArithmetic/AutomorphicVarieties/ModularityArgument/ThresholdArguments/DenseThresholdCases/VwinOfRow.lean + src/Development/AutomorphicArithmetic/ThetaCorrespondence/ThetaPairLifts/ThirdPlaceSeries/EveryCharacterOfLiteratureOfVWin.lean + src/Formalism/GammaFactorNonvanishing/CritLine.lean + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Run source-census mutation tests + working-directory: mathcan + run: python -m unittest tests.test_rhd03_main_source -v + - name: Pinned Main route and 195-wrapper source call graph + working-directory: mathcan + run: | + mkdir -p rhd03 + python -m research.rh_proof_distillation.main_character_dependency_audit \ + --source-root ../upstream \ + --output rhd03/main-actual-source-graph.json + - uses: actions/upload-artifact@v4 + if: always() + with: + name: rhd03-pinned-main-source-graph + path: mathcan/rhd03/ + if-no-files-found: ignore + + lean-source-logic: + runs-on: ubuntu-latest + timeout-minutes: 40 + steps: + - uses: actions/checkout@v4 + - uses: leanprover/lean-action@v1 + with: + auto-config: false + build: true + build-args: MathCan + test: false + lint: false + use-mathlib-cache: false + - name: Axiom inventory for independent source-interface proofs + shell: bash + run: | + set -euo pipefail + lake env lean MathCan/RHMainLogic.lean | tee rhd03-axioms.txt + if grep -Eq 'sorryAx|ofReduceBool|^error:|admit' rhd03-axioms.txt; then + exit 1 + fi + - uses: actions/upload-artifact@v4 + if: always() + with: + name: rhd03-source-interface-axioms + path: rhd03-axioms.txt + if-no-files-found: ignore diff --git a/MathCan.lean b/MathCan.lean index 654a8d3d..a5131d09 100644 --- a/MathCan.lean +++ b/MathCan.lean @@ -149,3 +149,4 @@ import MathCan.NOR45AuthorizedProgram import MathCan.NOR46ExactIntegerTrace import MathCan.RHWindowExponents import MathCan.RHFamilyWitnesses +import MathCan.RHMainLogic diff --git a/MathCan/RHMainLogic.lean b/MathCan/RHMainLogic.lean new file mode 100644 index 00000000..6cbff015 --- /dev/null +++ b/MathCan/RHMainLogic.lean @@ -0,0 +1,64 @@ +import Init + +/-! +# RHD-03: direct logical interface of the Main -> EveryCharacter -> RH route. + +The published source's OpenLiteratureStatements has two fields of the +same Row proposition, and a third RecTExists field. We formalize its +exact propositional structure in Init without importing original +Mathlib proofs or identifying the mathematical Row and RecTExists types +with these abstract parameters. +-/ + +namespace MathCan.RHMainLogic + +/-- Two copies of Row and one RecTExists proof, matching the source +interface's three fields at the level of propositions. -/ +structure OpenLiteratureProxy (Row RecTExists : Prop) : Prop where + caraianiLocalGlobalDual : Row + localLanglandsExists : RecTExists + galoisRepOfPolarizedPairLit : Row + +/-- The duplicated Row interface is equivalent to exactly one Row +proposition together with the RecTExists proposition. -/ +theorem open_literature_is_row_and_recT + (Row RecTExists : Prop) : + OpenLiteratureProxy Row RecTExists ↔ Row ∧ RecTExists := by + constructor + · intro h + exact ⟨h.caraianiLocalGlobalDual, h.localLanglandsExists⟩ + · rintro ⟨hRow, hRec⟩ + exact ⟨hRow, hRec, hRow⟩ + +/-- Constructing a second Row field from the first is proof duplication +in the interface; both fields have precisely the same proposition. -/ +theorem row_proof_reused + {Row RecTExists : Prop} (hRow : Row) (hRec : RecTExists) : + OpenLiteratureProxy Row RecTExists := + ⟨hRow, hRec, hRow⟩ + +/-- Purely structural abstract form of the source's final route. +The substantive published results remain explicit arguments. -/ +theorem final_rh_route_from_supplied_mathematical_bridges + {Row RecTExists VWin EveryCharacter RH : Prop} + (hRow : Row) (hRec : RecTExists) + (windowOfRow : Row → VWin) + (everyCharacterOfLiterature : OpenLiteratureProxy Row RecTExists → VWin → EveryCharacter) + (rhOfEvery : EveryCharacter → RH) : RH := + rhOfEvery (everyCharacterOfLiterature + (row_proof_reused hRow hRec) (windowOfRow hRow)) + +/-- A formal literature theorem whose proof is supplied independently +can be presented with an unused O parameter. This explains the +distinction between lexical O usage and semantic dependence. -/ +theorem independent_theorem_with_literature_parameter + {Row RecTExists P : Prop} + (p : P) (O : OpenLiteratureProxy Row RecTExists) : P := + p + +#print axioms open_literature_is_row_and_recT +#print axioms row_proof_reused +#print axioms final_rh_route_from_supplied_mathematical_bridges +#print axioms independent_theorem_with_literature_parameter + +end MathCan.RHMainLogic diff --git a/research/rh_proof_distillation/MAIN_PROOF_SOURCE.md b/research/rh_proof_distillation/MAIN_PROOF_SOURCE.md new file mode 100644 index 00000000..f06a1a1d --- /dev/null +++ b/research/rh_proof_distillation/MAIN_PROOF_SOURCE.md @@ -0,0 +1,76 @@ +# RHD-03 | Actual Main proof route and OpenLiteratureStatements + +Source pin: `leanprover-community/riemann-hypothesis` commit +`f150e02623b1e2bbe1f1da8eab5ffee5e930a6a3`. This is a +source-text dependency audit; mathematical and kernel verification of +the full claimed RH proof remain separate. + +## Which RH route is used by Main? + +The original [`src/Main.lean`](https://github.com/leanprover-community/riemann-hypothesis/blob/f150e02623b1e2bbe1f1da8eab5ffee5e930a6a3/src/Main.lean) +states `riemannHypothesis := rhOfAll`. The theorem +`rhOfAll` in `src/Supplements/Kernels/MainTheorems.lean` calls +`Formalism.VW.rh_of_every allChi`. Here `allChi` is supplied by +`UpperTheory.FinalTheorems.everyCharacter`. + +The final-character theorem in +`src/Development/AutomorphicArithmetic/CharacterBoxes/MainConclusion.lean` +constructs `everyCharacter_of_row` from an integral Galois row +and an automorphic window. The literature theorem applies +`every_character_of_theta_integrals_local_matching`, a +`topCovolSlim2_use_alt_alt` covolume bound, and +`local_langlands_gl_recT_exists_of_literature`. + +This identifies the direct theorem route relevant to the actual +statement in Main. The conditional family theorem `rh_of` in the +`ZetaZeroFreeRegion` formalism is a separate source route. The +source audit does not establish whether it is present among the +original Main proof's transitive imported artifacts. + +## The published OpenLiteratureStatements interface + +The source defines three fields: + +- `caraianiLocalGlobalDual : UpperTheory.One.M.Row` +- `localLanglandsExists : UpperTheory.Zero.LLC.RecTExists` +- `galoisRepOfPolarizedPairLit : UpperTheory.One.M.Row` + +At the proposition level this is equivalent to a single `Row` +witness and a `RecTExists` witness. The result is proved in +`MathCan/RHMainLogic.lean` under Lean 4.35 with Init. + +## Wrapper census from source bodies + +The pinned literature source contains 195 theorem wrappers taking +an explicit `O : OpenLiteratureStatements` parameter. A lexical +source scan finds no occurrence of the identifier `O` in 152 of +their displayed theorem-value bodies; 43 do mention `O`. +Four wrapper bodies directly select one of the three O fields +(two the same Row type, one local Langlands field). + +A graph of *named wrapper-to-wrapper calls in the source bodies* +has 311 observed edges and visits all 195 wrappers when traversed +from `every_character_of_literature_of_vWin`. These are +source-text observations under the pinned Git blob identity. + +The unused-parameter count does not establish that the theorem is +mathematically vacuous or that a Lean proof is invalid. A wrapper can +have an explicitly present but unused parameter because its conclusion +has been established elsewhere. For full kernel semantics we would +need to inspect the elaborated proof terms, their axioms and the +construction of the imported theorem constants. + +## Where further mathematical effort belongs + +Directly audit `galoisRepresentations_of_thetaLift tLiftK`, +`automorphic_window_of_inputs`, the local Langlands witness, and +the covolume bound that feeds the final every-character theorem. +Preserve the distinction between independently established input +lemmas, copied proof parameters, imported compiled artifacts, and +unverified mathematical premises. + +## Reproduced source graph + +The [pinned CI run](https://github.com/patrickdugan/MathCan/actions/runs/44915161411) passed four source-audit mutation tests and four native Init Lean proofs. The uploaded [original JSON graph](https://github.com/patrickdugan/MathCan/actions/runs/44915161411/artifacts/14711581539) is SHA-256 `b00378b34fa738fd2eecd176dfb3fc9977ab02ad84e3eaacf56f8ada4804994f` (unzipped JSON bytes). The [compact receipt](main_source_census_receipt.json) retains the verified node/edge counts and four direct parameter-field consumers. + +Direct `O` projections are found only in `literature_automorphy`, `carU_local_global_of_literature`, `pair_u_of_literature`, and `local_langlands_recT_exists_of_literature`. This statement concerns the 195 wrapper theorem values within the exact archived source file. Indirect dependencies through other wrapper constants and external imported theorems require separate examination. diff --git a/research/rh_proof_distillation/main_character_dependency_audit.py b/research/rh_proof_distillation/main_character_dependency_audit.py new file mode 100644 index 00000000..7249ef81 --- /dev/null +++ b/research/rh_proof_distillation/main_character_dependency_audit.py @@ -0,0 +1,227 @@ +"""RHD-03: pinned source audit of the live RH/GRH Main proof interface. + +A source-text census of 195 literature wrapper theorems and direct proof +entrypoints. It does not extract elaborated Lean Expr dependencies; its source +and exact Git blob pins must agree with the archived upstream checkout. +""" +from __future__ import annotations + +import argparse +from collections import Counter, deque +import hashlib +import json +from pathlib import Path +import re +import subprocess + +PIN = "f150e02623b1e2bbe1f1da8eab5ffee5e930a6a3" +PATHS = { + "main": ("src/Main.lean", "dbd5db70bc11b35f18fa5751216ab335321e7bfc"), + "kernel": ("src/Supplements/Kernels/MainTheorems.lean", "6a542d7ce969a791fd12ce575f587e6bc29044bf"), + "conclusion": ("src/Development/AutomorphicArithmetic/CharacterBoxes/MainConclusion.lean", "ee340012ab19713a8acfecf8adc6a331cbc2f1a4"), + "row": ("src/Development/AutomorphicArithmetic/Foundations/GaloisRepresentations/IntegralStructures/RowSrc.lean", "f769999ac5e49241993e5efbf81e4d2cded18acd"), + "window": ("src/Development/AutomorphicArithmetic/AutomorphicVarieties/ModularityArgument/ThresholdArguments/DenseThresholdCases/VwinOfRow.lean", "4cba179acd45ac08d3cad21f51c9b9d62715a9a4"), + "literature": ("src/Development/AutomorphicArithmetic/ThetaCorrespondence/ThetaPairLifts/ThirdPlaceSeries/EveryCharacterOfLiteratureOfVWin.lean", "a13ba1f8c38d4dbf2ddd809fbf9610a007936c24"), + "zeta_bridge": ("src/Formalism/GammaFactorNonvanishing/CritLine.lean", "95fa4da5c50119db164aa93944d106f22fdb576d"), +} +CHECKS = { + "main": ("theorem riemannHypothesis : RiemannHypothesis := rhOfAll",), + "kernel": ( + "theorem allChi : UpperTheory.EveryCharacter := UpperTheory.FinalTheorems.everyCharacter", + "theorem rhOfAll : RiemannHypothesis := Formalism.VW.rh_of_every allChi", + ), + "conclusion": ( + "UpperTheory.FinalTheorems.everyCharacter_of_row", + "UpperTheory.FinalTheorems.everyCharacter : UpperTheory.EveryCharacter :=", + "UpperTheory.Gal.Int.galoisLocalGlobalStrong_recParameter", + ), + "row": ("galoisRepresentations_of_thetaLift UpperTheory.TP.K.tLiftK",), + "window": ( + "automorphic_window_of_inputs", + "OpenImageCondition.mk h", + "baseChangeN h", + ), + "literature": ( + "every_character_of_literature_of_vWin", + "every_character_of_theta_integrals_local_matching", + "topCovolSlim2_use_alt_alt", + "local_langlands_gl_recT_exists_of_literature", + ), + "zeta_bridge": ("theorem Formalism.VW.rh_of_every",), +} +OPEN_FIELDS = ( + "caraianiLocalGlobalDual", + "localLanglandsExists", + "galoisRepOfPolarizedPairLit", +) +WRAPPER = re.compile(r"theorem\s+UpperTheory\.LiteratureTheorems\.([^\s(:]+)") +QUALIFIED = re.compile(r"UpperTheory\.LiteratureTheorems\.([A-Za-z0-9_']+)") +DIRECT_FIELD = re.compile(r"\bO\.(caraianiLocalGlobalDual|localLanglandsExists|galoisRepOfPolarizedPairLit)\b") +O_USE = re.compile(r"\bO\b") + + +def git_blob_sha(raw: bytes) -> str: + return hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest() + + +def verify_sources(root: Path) -> tuple[dict, dict]: + head = subprocess.check_output( + ["git", "-C", str(root), "rev-parse", "HEAD"], text=True + ).strip() + if head != PIN: + raise ValueError(f"upstream mirror commit mismatch: {head}") + texts, evidence = {}, {} + for key, (path, expected) in PATHS.items(): + raw = (root / path).read_bytes() + actual = git_blob_sha(raw) + if actual != expected: + raise ValueError(f"{key} source blob differs: {actual}") + body = raw.decode("utf-8") + absent = [fragment for fragment in CHECKS[key] if fragment not in body] + if absent: + raise ValueError(f"{key} required source route missing: {absent}") + texts[key] = body + evidence[key] = { + "path": path, "git_blob": actual, + "sha256": hashlib.sha256(raw).hexdigest(), + "bytes": len(raw), + } + return texts, {"head": head, "source_files": evidence} + + +def parse_open_fields(text: str) -> dict: + start = text.find("structure UpperTheory.LiteratureTheorems.OpenLiteratureStatements : Prop where") + if start < 0: + raise ValueError("pinned literature interface missing") + next_theorem = text.find("\ntheorem ", start) + if next_theorem < 0: + raise ValueError("pinned literature interface is unterminated") + block = text[start:next_theorem] + result = {} + for line in block.splitlines()[1:]: + match = re.match(r"\s+(\w+)\s*:\s*(.*)", line) + if match: + result[match[1]] = match[2].strip() + if set(result) != set(OPEN_FIELDS): + raise ValueError(f"OpenLiteratureStatements fields changed: {sorted(result)}") + if result["caraianiLocalGlobalDual"] != result["galoisRepOfPolarizedPairLit"]: + raise ValueError("published duplicate Row propositions no longer coincide") + if "RecTExists" not in result["localLanglandsExists"]: + raise ValueError("local-Langlands field type changed") + return result + + +def wrapper_graph(text: str) -> dict: + starts = list(WRAPPER.finditer(text)) + if not starts: + raise ValueError("source contains no literature wrapper declarations") + nodes = {} + for ix, match in enumerate(starts): + name = match[1] + block = text[match.start():(starts[ix + 1].start() if ix + 1 < len(starts) else len(text))] + equals = block.find(":=") + if equals < 0: + raise ValueError(f"wrapper declaration missing body: {name}") + header, value = block[:equals], block[equals + 2:] + if not re.search(r"\bO\s*:", header): + raise ValueError(f"wrapper lacks explicit O parameter: {name}") + if name in nodes: + raise ValueError("duplicate literature wrapper: " + name) + nodes[name] = { + "name": name, "line": text[:match.start()].count("\n") + 1, + "body_text_uses_O": bool(O_USE.search(value)), + "direct_fields": sorted(set(DIRECT_FIELD.findall(value))), + "body_sha256": hashlib.sha256(value.encode()).hexdigest(), + "body": value, + } + known = set(nodes) + for name, info in nodes.items(): + info["wrapper_calls"] = sorted( + {p for p in QUALIFIED.findall(info["body"]) if p in known and p != name} + ) + del info["body"] + root = "every_character_of_literature_of_vWin" + if root not in nodes: + raise ValueError("missing live EveryCharacter wrapper") + visited, queue = set(), deque([root]) + edges = [] + while queue: + name = queue.popleft() + if name in visited: + continue + visited.add(name) + for next_name in nodes[name]["wrapper_calls"]: + edges.append({"caller": name, "callee": next_name}) + if next_name not in visited: + queue.append(next_name) + direct_users = { + field: sorted(name for name, item in nodes.items() if field in item["direct_fields"]) + for field in OPEN_FIELDS + } + return { + "root": root, + "total_wrappers": len(nodes), + "source_bodies_without_literal_O": sum(not v["body_text_uses_O"] for v in nodes.values()), + "source_bodies_with_literal_O": sum(v["body_text_uses_O"] for v in nodes.values()), + "reachable_wrapper_count": len(visited), + "reachable_direct_call_edges": len(edges), + "all_wrappers_reachable_from_root": len(visited) == len(nodes), + "field_direct_users": direct_users, + "nodes": [nodes[name] for name in sorted(nodes)], + "edges": edges, + "traversal_limited": False, + "caveat": ( + "Lexical matches do not establish semantic independence from O, " + "minimal proof dependencies, or actual kernel proof-term references." + ), + } + + +def audit(root: Path) -> dict: + sources, identity = verify_sources(root) + fields = parse_open_fields(sources["literature"]) + wrappers = wrapper_graph(sources["literature"]) + return { + "schema_version": 1, + "evidence": "exact upstream Git blobs and Lean source text", + "proof_term_data": False, + "upstream": identity, + "root_source_chain": [ + {"theorem": "riemannHypothesis", "via": "rhOfAll"}, + {"theorem": "rhOfAll", "via": "Formalism.VW.rh_of_every allChi"}, + {"theorem": "allChi", "via": "UpperTheory.FinalTheorems.everyCharacter"}, + {"theorem": "UpperTheory.FinalTheorems.everyCharacter", + "via": "UpperTheory.FinalTheorems.everyCharacter_of_row"}, + {"theorem": "UpperTheory.FinalTheorems.everyCharacter_of_row", + "via": "UpperTheory.LiteratureTheorems.every_character_of_literature_of_vWin"}, + ], + "open_literature_fields": fields, + "literature_wrappers": wrappers, + "validity_limit": ( + "This is an original-source dependency map. It does not reprove " + "the original GRH/RH theorem or independently check its published .olean artifacts." + ), + } + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--source-root", required=True, type=Path) + parser.add_argument("--output", required=True, type=Path) + args = parser.parse_args() + report = audit(args.source_root.resolve()) + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(json.dumps(report, sort_keys=True, indent=2) + "\n", encoding="utf-8") + w = report["literature_wrappers"] + print(json.dumps({ + "source_pin": PIN, "source_files": len(report["upstream"]["source_files"]), + "wrapper_count": w["total_wrappers"], + "no_direct_O_mentions": w["source_bodies_without_literal_O"], + "reached": w["reachable_wrapper_count"], + "direct_field_uses": {k: len(v) for k, v in w["field_direct_users"].items()}, + "proof_term_data": False, + }, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/rh_proof_distillation/main_source_census_receipt.json b/research/rh_proof_distillation/main_source_census_receipt.json new file mode 100644 index 00000000..8faf4ebc --- /dev/null +++ b/research/rh_proof_distillation/main_source_census_receipt.json @@ -0,0 +1,33 @@ +{ + "schema_version": 1, + "kind": "source_lexical_wrapper_census", + "source_ref": "leanprover-community/riemann-hypothesis@f150e02623b1e2bbe1f1da8eab5ffee5e930a6a3", + "source_blob": "a13ba1f8c38d4dbf2ddd809fbf9610a007936c24", + "run": "https://github.com/patrickdugan/MathCan/actions/runs/44915161411", + "artifact": "https://github.com/patrickdugan/MathCan/actions/runs/44915161411/artifacts/14711581539", + "artifact_unzipped_json_sha256": "b00378b34fa738fd2eecd176dfb3fc9977ab02ad84e3eaacf56f8ada4804994f", + "pin_checked_source_files": 7, + "wrapper_nodes": 195, + "wrapper_edges": 311, + "wrappers_lexically_reachable_from_final_literature_theorem": 195, + "wrapper_proof_bodies_without_literal_O": 152, + "wrapper_proof_bodies_with_literal_O": 43, + "direct_parameter_field_access_nodes": { + "caraianiLocalGlobalDual": [ + "carU_local_global_of_literature", + "literature_automorphy" + ], + "galoisRepOfPolarizedPairLit": [ + "pair_u_of_literature" + ], + "localLanglandsExists": [ + "local_langlands_recT_exists_of_literature" + ] + }, + "provenance": "Git SHA-pinned source lexical analysis; no transitive Lean proof-term expansion", + "epistemic_limits": [ + "O unused in displayed theorem value is not the same as an unnecessary theorem hypothesis", + "The 311 edges are source-lexical named wrapper calls, not elaborated kernel dependencies", + "The actual published compiled proof bodies remain unreviewed in this MathCan experiment" + ] +} diff --git a/tests/test_rhd03_main_source.py b/tests/test_rhd03_main_source.py new file mode 100644 index 00000000..7e52419f --- /dev/null +++ b/tests/test_rhd03_main_source.py @@ -0,0 +1,45 @@ +import unittest +from research.rh_proof_distillation.main_character_dependency_audit import ( + git_blob_sha, parse_open_fields, wrapper_graph, verify_sources, OPEN_FIELDS +) + + +class MainCharacterAuditTests(unittest.TestCase): + def test_git_blob_of_empty_file(self): + self.assertEqual(git_blob_sha(b""), "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391") + + def test_duplicate_row_contract(self): + source = ( + "structure UpperTheory.LiteratureTheorems.OpenLiteratureStatements : Prop where\n" + " caraianiLocalGlobalDual : Row\n" + " localLanglandsExists : RecTExists\n" + " galoisRepOfPolarizedPairLit : Row\n" + "theorem UpperTheory.LiteratureTheorems.foo (O : OpenLiteratureStatements) := trivial\n" + ) + fields = parse_open_fields(source) + self.assertEqual(set(fields), set(OPEN_FIELDS)) + self.assertEqual(fields["caraianiLocalGlobalDual"], fields["galoisRepOfPolarizedPairLit"]) + with self.assertRaisesRegex(ValueError, "duplicate Row"): + parse_open_fields(source.replace("galoisRepOfPolarizedPairLit : Row", "galoisRepOfPolarizedPairLit : Different")) + + def test_proof_body_usage_and_transitive_wrapper_edges(self): + text = ( + "theorem UpperTheory.LiteratureTheorems.helper (O : OL) : True := True.intro\n" + "theorem UpperTheory.LiteratureTheorems.every_character_of_literature_of_vWin (O : OL) : True := " + "UpperTheory.LiteratureTheorems.helper O\n" + ) + graph = wrapper_graph(text) + self.assertEqual(graph["total_wrappers"], 2) + self.assertEqual(graph["source_bodies_without_literal_O"], 1) + self.assertTrue(graph["all_wrappers_reachable_from_root"]) + + def test_pin_rejects_missing_repository(self): + import tempfile + from pathlib import Path + with tempfile.TemporaryDirectory() as td: + with self.assertRaises(Exception): + verify_sources(Path(td)) + + +if __name__ == "__main__": + unittest.main()