From a19bf928c43ed68f102454c48d31f4b7dfe1fe33 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 12 Sep 2026 07:45:55 +0000 Subject: [PATCH 01/10] Prepare EPAC candidate and public artifact consumption gates --- integration/epac/README.md | 74 +++++++++++++++++++++ integration/epac/reconsume.py | 103 +++++++++++++++++++++++++++++ integration/epac/verify_release.py | 96 +++++++++++++++++++++++++++ 3 files changed, 273 insertions(+) create mode 100644 integration/epac/README.md create mode 100644 integration/epac/reconsume.py create mode 100644 integration/epac/verify_release.py diff --git a/integration/epac/README.md b/integration/epac/README.md new file mode 100644 index 0000000..5b3fcad --- /dev/null +++ b/integration/epac/README.md @@ -0,0 +1,74 @@ +# EPAC artifact consumption + +These commands verify EPAC's public interfaces from an installed wheel. They do +not establish empirical validity or change the four retained FALSIFIED results. +The independent repository's license and distribution rights must be resolved +before a candidate qualifies for stable publication. + +## Before publication + +Build a clean, licensed candidate in the owning EPAC repository with +`tools/build_release.py`, then run its complete wheel and source-install replay. +Retain the wheel, source archive, release manifest, and SHA256SUMS unchanged. + +Use a new environment outside stack, install the candidate's hash-locked upstream +dependencies, and install that exact wheel without editable or checkout paths. +Run the stack integration gate from an external working directory: + +```bash +/path/to/clean-venv/bin/python /path/to/stack/integration/epac/verify_release.py \ + /path/to/candidate/interdependency_epac-0.1.0-py3-none-any.whl \ + /path/to/evidence/stack-candidate.json --phase candidate +``` + +The gate checks installed payload hashes and import origins, exact UCNS source +provenance, Public Gonol construction/replay, all five declared molecules, helium +replay, and all four FALSIFIED standings. Its receipt binds the wheel and verifier +hashes. A failure requires a repaired candidate and new verification before +stable publication. + +## Public reconsumption + +After publishing those verified bytes, record a release lock with: + +- `release_tag` and exact `source_commit`; +- `assets`, mapping each filename to its public GitHub release URL and SHA-256; +- `phase`, first `reconsumed`, then `graduated` only after retiring the forge copy. + +The public asset set contains the wheel, source archive, `release-manifest.json`, +and `SHA256SUMS`. The lock is repository-owned acceptance evidence once its public +bytes have been independently verified. No final lock exists during preparation. + +```bash +python3 integration/epac/reconsume.py \ + integration/epac/release-lock.json /tmp/epac-public-consumption python3.12 +``` + +The output directory must be new and outside stack. The command downloads and +hash-verifies the public assets, checks their source identity, installs locked +dependencies and the public wheel in a clean environment, and reruns integration. +It does not edit the source or authority records. + +After successful public reconsumption, remove the versioned Python implementation +and tests from `research/epac/`, preserving historical evidence and provenance. +Replace the forge-local CI import path with this release consumer. The graduated +gate additionally requires that no Python implementation remains in that research +path. Commit the verified lock, before/after graph identities, and scoped +implementation/public-contract transition receipt with that retirement. + +## Dependency and rollback boundaries + +EPAC's release binds its own exact UCNS dependency. This does not update the +root `libs/ucns/` snapshot or unrelated research pins. Stack consumes EPAC as a +release artifact; a `libs/epac/` source mirror is not required for execution. + +If public downloads or integration fail, stop the transition and preserve its +unpassed gate. Before graduation the existing forge authority remains in place. +After graduation, a rollback selects a previously accepted immutable release lock +and reruns integration. The first release has no earlier accepted release: retain +the evidence and repair through the independent repository. Do not silently +restore the historical forge copy as an authoritative implementation. + +Generated environments and operational receipt projections stay outside the +repository. Only explicitly accepted release locks and transition evidence belong +in the versioned integration record. diff --git a/integration/epac/reconsume.py b/integration/epac/reconsume.py new file mode 100644 index 0000000..a148468 --- /dev/null +++ b/integration/epac/reconsume.py @@ -0,0 +1,103 @@ +"""Usage: python integration/epac/reconsume.py RELEASE_LOCK NEW_OUTPUT PYTHON. + +Download hash-bound public EPAC assets, install locked dependencies and the wheel +in a new environment, and invoke the stack integration gate. The lock must have +release_tag, source_commit, assets{name:{url,sha256}}, and phase fields. No source +or authority record is changed by this command. +""" +# === MODULE_BUILD === +# id: stack_epac_public_reconsumption +# module_name: reconsume +# module_kind: instrument +# summary: downloads exact public EPAC bytes and replays stack composition in a clean environment +# owner: The Interdependency +# public_surface: command-line release reconsumption +# internal_surface: main +# auth_boundary: none +# auth_notes: public HTTPS downloads +# storage_boundary: write +# storage_notes: new caller-selected output directory +# network_boundary: external +# network_notes: public release assets and locked Python dependencies +# user_data_boundary: none +# admin_only: false +# tests: executed against the immutable EPAC release before authority transition +# rollout: replaces forge-local EPAC workflow after successful graduation +# rollback: retain previous artifact lock; do not restore scientific standing +# === END MODULE_BUILD === +# === CONTRACTS === +# id: epac_reconsumption_binds_public_bytes +# given: a release lock with exact source and artifact hashes +# then: downloaded assets must match the lock and release manifest before installation and public-interface verification +# class: provenance +# === END CONTRACTS === +from __future__ import annotations + +import hashlib +import json +from pathlib import Path +import subprocess +import sys +import tarfile +from urllib.parse import urlsplit +from urllib.request import urlopen + + +def main() -> None: + lock_path, output = (Path(argument).resolve() for argument in sys.argv[1:3]) + runtime = sys.argv[3] + stack = Path(__file__).resolve().parents[2] + if output.exists() or output.is_relative_to(stack): + raise ValueError("output must be new and outside stack") + lock = json.loads(lock_path.read_text()) + if lock["phase"] not in {"reconsumed", "graduated"}: + raise ValueError("public reconsumption phase required") + output.mkdir(parents=True) + assets = lock["assets"] + for name, identity in assets.items(): + if Path(name).name != name or name in {"", ".", ".."}: + raise ValueError("asset must be a plain filename") + expected_url = f'https://github.com/The-Interdependency/epac/releases/download/{lock["release_tag"]}/{name}' + if identity["url"] != expected_url or urlsplit(expected_url).scheme != "https": + raise ValueError("unexpected release asset URL") + with urlopen(identity["url"], timeout=60) as response: + payload = response.read() + if hashlib.sha256(payload).hexdigest() != identity["sha256"]: + raise ValueError(f"public artifact digest mismatch: {name}") + (output / name).write_bytes(payload) + manifest = json.loads((output / "release-manifest.json").read_text()) + if manifest["source_commit"] != lock["source_commit"]: + raise ValueError("public source identity mismatch") + for name, digest in manifest["artifacts_sha256"].items(): + if assets[name]["sha256"] != digest: + raise ValueError("release manifest differs from pinned artifact identity") + wheels, sdists = list(output.glob("*.whl")), list(output.glob("*.tar.gz")) + if len(wheels) != 1 or len(sdists) != 1: + raise ValueError("exactly one wheel and source archive required") + source = output / "source" + source.mkdir() + with tarfile.open(sdists[0]) as archive: + seen = set() + for member in archive: + name = Path(member.name) + if name.is_absolute() or ".." in name.parts or not (member.isfile() or member.isdir()) or member.name in seen: + raise ValueError("unsafe source archive") + seen.add(member.name) + archive.extractall(source) + roots = list(source.iterdir()) + if len(roots) != 1 or not roots[0].is_dir(): + raise ValueError("source archive root mismatch") + source_root = roots[0] + requirements = output / "dependencies.txt" + subprocess.run(["uv", "export", "--project", str(source_root), "--locked", "--no-emit-project", "--no-dev", "--format", "requirements.txt", "--output-file", str(requirements)], check=True) + environment = output / "venv" + subprocess.run(["uv", "venv", "--python", runtime, str(environment)], check=True) + python = str(environment / "bin/python") + subprocess.run(["uv", "pip", "sync", "--python", python, "--require-hashes", str(requirements)], check=True) + subprocess.run(["uv", "pip", "install", "--python", python, "--no-deps", str(wheels[0])], check=True) + subprocess.run([python, str(stack / "integration/epac/verify_release.py"), str(wheels[0]), str(output / "consumption.json"), "--phase", lock["phase"]], check=True, cwd=output) + (output / "release-lock.json").write_bytes(lock_path.read_bytes()) + + +if __name__ == "__main__": + main() diff --git a/integration/epac/verify_release.py b/integration/epac/verify_release.py new file mode 100644 index 0000000..f300b35 --- /dev/null +++ b/integration/epac/verify_release.py @@ -0,0 +1,96 @@ +"""Usage: CLEAN_ENV/bin/python integration/epac/verify_release.py WHEEL RECEIPT --phase candidate. + +Install the hash-verified wheel and its pinned dependencies first. Run again with +--phase graduated after public reconsumption and retirement of forge source. +The emitted receipt covers composition and implementation provenance only. +""" +# === MODULE_BUILD === +# id: stack_epac_release_consumption +# module_name: verify_release +# module_kind: instrument +# summary: verifies the exact installed EPAC artifact through its public construction and replay surfaces +# owner: The Interdependency +# public_surface: command-line EPAC consumer verification +# internal_surface: main +# auth_boundary: none +# storage_boundary: write +# storage_notes: read candidate wheel; write caller-selected receipt +# network_boundary: none +# user_data_boundary: none +# admin_only: false +# tests: invoked before publication and after public artifact reconsumption +# rollout: pre-publication and post-publication composition gates +# rollback: retain the previously accepted immutable artifact +# === END MODULE_BUILD === +# === CONTRACTS === +# id: stack_epac_consumes_immutable_artifact +# given: EPAC is installed from the identified candidate or published wheel +# then: installed bytes match that wheel, public construction/replay composes with exact UCNS source, falsification standing remains, and graduated consumption has no forge-local implementation +# class: provenance +# === END CONTRACTS === +from __future__ import annotations + +import argparse +import hashlib +from importlib import metadata +import json +from pathlib import Path +import sys +import zipfile + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("wheel", type=Path) + parser.add_argument("receipt", type=Path) + parser.add_argument("--phase", choices=("candidate", "reconsumed", "graduated"), required=True) + args = parser.parse_args() + stack = Path(__file__).resolve().parents[2] + with zipfile.ZipFile(args.wheel) as archive: + expected = {name: hashlib.sha256(archive.read(name)).hexdigest() for name in archive.namelist() + if name.startswith("epac_") and not name.endswith("/")} + distribution = metadata.distribution("interdependency-epac") + installed = {str(path): Path(distribution.locate_file(path)).resolve() for path in distribution.files or () + if str(path).startswith("epac_") and "__pycache__" not in path.parts} + assert expected and set(installed) == set(expected) + for name, path in installed.items(): + assert path.is_relative_to(Path(sys.prefix)) and not path.is_relative_to(stack), path + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected[name], name + from epac_public_gonol import construct_public_gonol, replay_public_gonol, PINNED_UCNS_COMMIT + from epac_molecular import construct_declared_molecules, replay_molecule + from epac_comparison import compare_after_construction + from epac_subatomic.element_affixiation_candidate import affixiate_element, replay_element + result = construct_public_gonol(source_id="stack.integration:oxygen", relation="epac.atomic.element", + identity_glyph="O", carried_options=(("symbol", "O"), ("Z", "8"))) + replayed = replay_public_gonol(result) + assert replayed.receipt_digest == result.receipt_digest + assert result.geometry["ucns_commit"] == PINNED_UCNS_COMMIT != "hmmm" + molecules = construct_declared_molecules() + assert set(molecules) == {"H2", "H2O", "NH3", "CH4", "CO2"} + for molecule in molecules.values(): + assert replay_molecule(molecule).receipt_digest == molecule.receipt.receipt_digest + element = affixiate_element("He") + assert replay_element("He") == (True, element.receipt) + assert element.source_commits["ucns"] == PINNED_UCNS_COMMIT + standings = compare_after_construction()["standings"] + assert len(standings) == 4 and set(standings.values()) == {"FALSIFIED"} + origins = {name: Path(module.__file__).resolve() for name, module in sys.modules.items() + if (name.startswith("epac_") or name == "ucns" or name.startswith("ucns.")) and getattr(module, "__file__", None)} + assert all(path.is_relative_to(Path(sys.prefix)) and not path.is_relative_to(stack) for path in origins.values()) + if args.phase == "graduated": + assert not list((stack / "research/epac").rglob("*.py")), "forge-local implementation must be retired" + receipt = {"schema": "stack.epac-artifact-consumption", "version": 1, "phase": args.phase, + "status": "passed", "artifact_sha256": hashlib.sha256(args.wheel.read_bytes()).hexdigest(), + "verifier_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), + "python": sys.version, "epac_version": distribution.version, "ucns_source_commit": PINNED_UCNS_COMMIT, + "installed_payload_sha256": expected, + "imported_origins": {name: str(path.relative_to(Path(sys.prefix))) for name, path in origins.items()}, + "public_gonol_receipt": result.receipt_digest, + "molecular_receipts": {name: value.receipt.receipt_digest for name, value in molecules.items()}, + "comparison_standings": standings, "empirical_status_transfer": False} + args.receipt.write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + print("EPAC artifact consumption: passed (" + args.phase + ")") + + +if __name__ == "__main__": + main() From dead639bc9db3815880a1bbe67cfcb3c1a094996 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 12 Sep 2026 10:05:39 +0000 Subject: [PATCH 02/10] Cover all preserved EPAC molecules and comparison standings --- integration/epac/README.md | 6 +++--- integration/epac/verify_release.py | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/integration/epac/README.md b/integration/epac/README.md index 5b3fcad..8041355 100644 --- a/integration/epac/README.md +++ b/integration/epac/README.md @@ -1,7 +1,7 @@ # EPAC artifact consumption These commands verify EPAC's public interfaces from an installed wheel. They do -not establish empirical validity or change the four retained FALSIFIED results. +not establish empirical validity or change the 14 retained FALSIFIED results, including the original four. The independent repository's license and distribution rights must be resolved before a candidate qualifies for stable publication. @@ -22,8 +22,8 @@ Run the stack integration gate from an external working directory: ``` The gate checks installed payload hashes and import origins, exact UCNS source -provenance, Public Gonol construction/replay, all five declared molecules, helium -replay, and all four FALSIFIED standings. Its receipt binds the wheel and verifier +provenance, Public Gonol construction/replay, all nine declared molecules, helium +replay, and all 14 FALSIFIED standings. Its receipt binds the wheel and verifier hashes. A failure requires a repaired candidate and new verification before stable publication. diff --git a/integration/epac/verify_release.py b/integration/epac/verify_release.py index f300b35..36e205c 100644 --- a/integration/epac/verify_release.py +++ b/integration/epac/verify_release.py @@ -39,6 +39,24 @@ import zipfile +EXPECTED_STANDINGS = { + "atomic_shells_as_sealed_shape_prediction": "FALSIFIED", + "boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "charged_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "per_symbol_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "topology_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "ucns_mobius_as_sealed_shape_prediction": "FALSIFIED" +} + + def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("wheel", type=Path) @@ -66,14 +84,14 @@ def main() -> None: assert replayed.receipt_digest == result.receipt_digest assert result.geometry["ucns_commit"] == PINNED_UCNS_COMMIT != "hmmm" molecules = construct_declared_molecules() - assert set(molecules) == {"H2", "H2O", "NH3", "CH4", "CO2"} + assert set(molecules) == {"H2", "H2O", "NH3", "CH4", "CO2", "H2S", "BF3", "PH3", "SiH4"} for molecule in molecules.values(): assert replay_molecule(molecule).receipt_digest == molecule.receipt.receipt_digest element = affixiate_element("He") assert replay_element("He") == (True, element.receipt) assert element.source_commits["ucns"] == PINNED_UCNS_COMMIT standings = compare_after_construction()["standings"] - assert len(standings) == 4 and set(standings.values()) == {"FALSIFIED"} + assert standings == EXPECTED_STANDINGS origins = {name: Path(module.__file__).resolve() for name, module in sys.modules.items() if (name.startswith("epac_") or name == "ucns" or name.startswith("ucns.")) and getattr(module, "__file__", None)} assert all(path.is_relative_to(Path(sys.prefix)) and not path.is_relative_to(stack) for path in origins.values()) From ddcfa9e10fc45c1476b3653f22dfd1263347e900 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 12 Sep 2026 10:39:23 +0000 Subject: [PATCH 03/10] Reject optimized consumer validation --- integration/epac/verify_release.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration/epac/verify_release.py b/integration/epac/verify_release.py index 36e205c..6996c49 100644 --- a/integration/epac/verify_release.py +++ b/integration/epac/verify_release.py @@ -58,6 +58,8 @@ def main() -> None: + if sys.flags.optimize: + raise SystemExit("optimized Python mode cannot produce consumer evidence") parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("wheel", type=Path) parser.add_argument("receipt", type=Path) From e9454b1de8602c8dba8bc968d809fe3238655a0d Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 12 Sep 2026 11:15:41 +0000 Subject: [PATCH 04/10] Bind EPAC consumption to unchanged candidate and stack source --- integration/epac/README.md | 4 +++- integration/epac/verify_release.py | 25 ++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/integration/epac/README.md b/integration/epac/README.md index 8041355..b0d05f5 100644 --- a/integration/epac/README.md +++ b/integration/epac/README.md @@ -24,7 +24,9 @@ Run the stack integration gate from an external working directory: The gate checks installed payload hashes and import origins, exact UCNS source provenance, Public Gonol construction/replay, all nine declared molecules, helium replay, and all 14 FALSIFIED standings. Its receipt binds the wheel and verifier -hashes. A failure requires a repaired candidate and new verification before +hashes plus the clean stack commit and tree. Candidate bytes, installed payloads, +verifier bytes, and the stack source must remain unchanged through execution. +A failure requires a repaired candidate and new verification before stable publication. ## Public reconsumption diff --git a/integration/epac/verify_release.py b/integration/epac/verify_release.py index 6996c49..aedad93 100644 --- a/integration/epac/verify_release.py +++ b/integration/epac/verify_release.py @@ -33,8 +33,10 @@ import argparse import hashlib from importlib import metadata +import io import json from pathlib import Path +import subprocess import sys import zipfile @@ -66,7 +68,17 @@ def main() -> None: parser.add_argument("--phase", choices=("candidate", "reconsumed", "graduated"), required=True) args = parser.parse_args() stack = Path(__file__).resolve().parents[2] - with zipfile.ZipFile(args.wheel) as archive: + assert not args.receipt.resolve().is_relative_to(stack), "write consumer evidence outside stack" + def git(*arguments): + return subprocess.check_output(["git", "-C", str(stack), *arguments]) + assert not git("status", "--porcelain", "--untracked-files=all"), "consumer source must be clean" + source_commit = git("rev-parse", "HEAD").decode().strip() + source_tree = git("rev-parse", "HEAD^{tree}").decode().strip() + verifier_bytes = Path(__file__).read_bytes() + assert verifier_bytes == git("show", source_commit + ":integration/epac/verify_release.py") + wheel_bytes = args.wheel.read_bytes() + wheel_digest = hashlib.sha256(wheel_bytes).hexdigest() + with zipfile.ZipFile(io.BytesIO(wheel_bytes)) as archive: expected = {name: hashlib.sha256(archive.read(name)).hexdigest() for name in archive.namelist() if name.startswith("epac_") and not name.endswith("/")} distribution = metadata.distribution("interdependency-epac") @@ -99,9 +111,16 @@ def main() -> None: assert all(path.is_relative_to(Path(sys.prefix)) and not path.is_relative_to(stack) for path in origins.values()) if args.phase == "graduated": assert not list((stack / "research/epac").rglob("*.py")), "forge-local implementation must be retired" + assert args.wheel.read_bytes() == wheel_bytes, "candidate wheel changed during consumption" + assert Path(__file__).read_bytes() == verifier_bytes, "consumer verifier changed during execution" + assert git("rev-parse", "HEAD").decode().strip() == source_commit + assert not git("status", "--porcelain", "--untracked-files=all"), "consumer source changed during execution" + for name, path in installed.items(): + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected[name], "installed payload changed during consumption" receipt = {"schema": "stack.epac-artifact-consumption", "version": 1, "phase": args.phase, - "status": "passed", "artifact_sha256": hashlib.sha256(args.wheel.read_bytes()).hexdigest(), - "verifier_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), + "status": "passed", "artifact_sha256": wheel_digest, + "verifier_sha256": hashlib.sha256(verifier_bytes).hexdigest(), + "source_commit": source_commit, "source_tree": source_tree, "source_unchanged": True, "python": sys.version, "epac_version": distribution.version, "ucns_source_commit": PINNED_UCNS_COMMIT, "installed_payload_sha256": expected, "imported_origins": {name: str(path.relative_to(Path(sys.prefix))) for name, path in origins.items()}, From 89ed78e68c11c394d29e4a49e8b23c5dee5303b1 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 12 Sep 2026 23:34:07 +0000 Subject: [PATCH 05/10] Reconsume EPAC v0.1.0 and retire the forge implementation --- .github/workflows/epac.yml | 38 +- AGENTS.md | 10 + README.md | 20 +- STACK_MANIFEST.md | 27 +- integration/epac/README.md | 2 +- .../epac/evidence/candidate-matrix.json | 92 + integration/epac/evidence/public-release.json | 29 + .../epac/evidence/reproducibility.json | 25 + .../epac/evidence/retirement-inventory.json | 393 +++ .../epac/evidence/stack-candidate.json | 134 + .../epac/evidence/stack-reconsumed.json | 134 + integration/epac/reconsume.py | 15 +- integration/epac/release-lock.json | 25 + research/epac/BASE.json | 18 + research/epac/README.forge-history.md | 98 + research/epac/README.md | 107 +- research/epac/epac_atomic.py | 285 -- .../epac/epac_boundary_minimal_refinement.py | 470 --- research/epac/epac_boundary_nondegeneracy.py | 787 ----- .../epac/epac_boundary_probe_completeness.py | 810 ------ research/epac/epac_boundary_quotient.py | 393 --- research/epac/epac_comparison.py | 1048 ------- research/epac/epac_cross_scale_closure.py | 616 ---- research/epac/epac_dimensional_arity.py | 645 ----- research/epac/epac_molecular.py | 2545 ----------------- research/epac/epac_periodic.py | 409 --- research/epac/epac_public_gonol.py | 450 --- .../element_affixiation_candidate.py | 271 -- research/epac/subatomic/extended_atomic.py | 253 -- .../subatomic/nuclear_harmonic_candidates.py | 392 --- research/epac/subatomic/subatomic_gonol.py | 328 --- research/epac/subatomic/symbol_coupling.py | 161 -- .../test_element_affixiation_candidate.py | 109 - .../epac/subatomic/test_extended_atomic.py | 80 - .../test_nuclear_harmonic_candidates.py | 122 - .../epac/subatomic/test_subatomic_gonol.py | 156 - .../epac/subatomic/test_symbol_coupling.py | 93 - research/epac/tests/test_atomic_promotion.py | 75 - .../tests/test_boundary_capacity_quotient.py | 208 -- .../test_boundary_descriptor_nondegeneracy.py | 269 -- .../tests/test_boundary_minimal_refinement.py | 224 -- .../tests/test_boundary_probe_completeness.py | 246 -- .../test_cross_scale_compositional_closure.py | 191 -- research/epac/tests/test_epac_arity.py | 259 -- research/epac/tests/test_epac_public_gonol.py | 144 - ..._geometry_comparison_after_construction.py | 1055 ------- .../epac/tests/test_molecular_affixiation.py | 128 - .../tests/test_periodic_element_gonols.py | 252 -- research/epac/tests/test_spiral_population.py | 193 -- research/epac/viz/__init__.py | 49 - research/epac/viz/__main__.py | 11 - research/epac/viz/cli.py | 69 - research/epac/viz/spiral_viz.py | 746 ----- stack-manifest.json | 183 +- tools/check_stack_consistency.py | 75 + 55 files changed, 1218 insertions(+), 14749 deletions(-) create mode 100644 integration/epac/evidence/candidate-matrix.json create mode 100644 integration/epac/evidence/public-release.json create mode 100644 integration/epac/evidence/reproducibility.json create mode 100644 integration/epac/evidence/retirement-inventory.json create mode 100644 integration/epac/evidence/stack-candidate.json create mode 100644 integration/epac/evidence/stack-reconsumed.json create mode 100644 integration/epac/release-lock.json create mode 100644 research/epac/BASE.json create mode 100644 research/epac/README.forge-history.md delete mode 100644 research/epac/epac_atomic.py delete mode 100644 research/epac/epac_boundary_minimal_refinement.py delete mode 100644 research/epac/epac_boundary_nondegeneracy.py delete mode 100644 research/epac/epac_boundary_probe_completeness.py delete mode 100644 research/epac/epac_boundary_quotient.py delete mode 100644 research/epac/epac_comparison.py delete mode 100644 research/epac/epac_cross_scale_closure.py delete mode 100644 research/epac/epac_dimensional_arity.py delete mode 100644 research/epac/epac_molecular.py delete mode 100644 research/epac/epac_periodic.py delete mode 100644 research/epac/epac_public_gonol.py delete mode 100644 research/epac/subatomic/element_affixiation_candidate.py delete mode 100644 research/epac/subatomic/extended_atomic.py delete mode 100644 research/epac/subatomic/nuclear_harmonic_candidates.py delete mode 100644 research/epac/subatomic/subatomic_gonol.py delete mode 100644 research/epac/subatomic/symbol_coupling.py delete mode 100644 research/epac/subatomic/test_element_affixiation_candidate.py delete mode 100644 research/epac/subatomic/test_extended_atomic.py delete mode 100644 research/epac/subatomic/test_nuclear_harmonic_candidates.py delete mode 100644 research/epac/subatomic/test_subatomic_gonol.py delete mode 100644 research/epac/subatomic/test_symbol_coupling.py delete mode 100644 research/epac/tests/test_atomic_promotion.py delete mode 100644 research/epac/tests/test_boundary_capacity_quotient.py delete mode 100644 research/epac/tests/test_boundary_descriptor_nondegeneracy.py delete mode 100644 research/epac/tests/test_boundary_minimal_refinement.py delete mode 100644 research/epac/tests/test_boundary_probe_completeness.py delete mode 100644 research/epac/tests/test_cross_scale_compositional_closure.py delete mode 100644 research/epac/tests/test_epac_arity.py delete mode 100644 research/epac/tests/test_epac_public_gonol.py delete mode 100644 research/epac/tests/test_geometry_comparison_after_construction.py delete mode 100644 research/epac/tests/test_molecular_affixiation.py delete mode 100644 research/epac/tests/test_periodic_element_gonols.py delete mode 100644 research/epac/tests/test_spiral_population.py delete mode 100644 research/epac/viz/__init__.py delete mode 100644 research/epac/viz/__main__.py delete mode 100644 research/epac/viz/cli.py delete mode 100644 research/epac/viz/spiral_viz.py diff --git a/.github/workflows/epac.yml b/.github/workflows/epac.yml index f56b556..ef65f6f 100644 --- a/.github/workflows/epac.yml +++ b/.github/workflows/epac.yml @@ -1,30 +1,38 @@ -name: epac +name: EPAC release consumption on: pull_request: - paths: - - "research/epac/**" - - "libs/ucns/**" - - ".github/workflows/epac.yml" + paths: ["integration/epac/**", "research/epac/**", "stack-manifest.json", "STACK_MANIFEST.md", ".github/workflows/epac.yml"] push: branches: [main] - paths: - - "research/epac/**" - - "libs/ucns/**" - - ".github/workflows/epac.yml" + paths: ["integration/epac/**", "research/epac/**", "stack-manifest.json", "STACK_MANIFEST.md", ".github/workflows/epac.yml"] permissions: contents: read jobs: - epac: + released-artifact: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: actions/checkout@v7 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + - uses: actions/setup-python@v7 with: python-version: "3.12" - - name: EPAC contract tests + - name: Install the pinned environment manager + run: python -m pip install uv==0.11.18 + - name: Check Stack projections + run: python tools/check_stack_consistency.py + - name: Reconsume immutable EPAC release env: - PYTHONPATH: research/epac:libs/ucns/src - run: python -m unittest discover -s research/epac/tests -q + PYTHONDONTWRITEBYTECODE: "1" + run: python integration/epac/reconsume.py integration/epac/release-lock.json /tmp/epac-public-consumption python + - uses: actions/upload-artifact@v7 + with: + name: epac-public-consumption + path: | + /tmp/epac-public-consumption/consumption.json + /tmp/epac-public-consumption/release-lock.json + if-no-files-found: error diff --git a/AGENTS.md b/AGENTS.md index 3108062..7b140f6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,6 +13,9 @@ projects may later graduate into their own repositories. - `research/english-gonol/` is a distinct stack-local English lexical/gonol construction component. UCNS owns consumed geometry; EDCM may evaluate outputs but does not define the English Gonol construction. +- `integration/epac/` consumes the hash-pinned public EPAC release. + `research/epac/` retains historical evidence only; route implementation changes to + `The-Interdependency/epac`. Do not restore the retired forge import path. - root-level emerging projects such as `ahbg/` may be close to external repo-hood; root placement does not transfer authority from their inputs. - `STACK_MANIFEST.md` and `stack-manifest.json` own stack-level participant provenance. @@ -80,6 +83,13 @@ Structural stack consistency: python tools/check_stack_consistency.py ``` +EPAC release integration (new output directory outside Stack): + +```bash +python3 integration/epac/reconsume.py \ + integration/epac/release-lock.json /tmp/epac-public-consumption python3.12 +``` + Fresh-making/backend checks that can run without PostgreSQL: ```bash diff --git a/README.md b/README.md index f9f525f..9bc7c85 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ stack/ │ ├── edcm/ │ ├── pcea/ │ ├── ptcna/ -│ ├── epac/ # canon slot unpopulated until EPAC graduates +│ ├── epac/ # unpopulated; EPAC is consumed as a release artifact │ └── skill-lib/ # reserved; root skill-lib/ remains the operational special case ├── research/ # stack-local work; never source authority by location │ ├── metapat/ # current METAPAT research + BASE.json @@ -36,9 +36,10 @@ stack/ │ ├── edcm/ # current EDCM measurement research + BASE.json │ ├── pcea/ # current PCEA research + BASE.json │ ├── ptcna/ # current PTCNA research + BASE.json -│ ├── epac/ # extracted candidate remains forge-side until graduation completes +│ ├── epac/ # historical forge evidence; active implementation is independent │ ├── psychsocio-metafauna/ # proposed pattern-lineage, coalescence, accountability research │ └── from-photons-to-macroverse/ # audited consciousness-first candidate research +├── integration/epac/ # immutable EPAC release lock and consumer verification ├── ahbg/ # emerging composed benchmark/game workspace ├── backend/ # PostgreSQL-backed durable fresh-making control plane ├── frontend/ @@ -103,11 +104,16 @@ stack-local implementation. English Gonol Construction is currently a distinct stack-local research component, separated from EDCM but not independently graduated. -EPAC and psychsocio metafauna are currently in this pre-graduation state. -EPAC is further along: it has an independent extracted repository, but extraction is not -graduation, so its forge research remains here until EPAC completes its release, -downstream reconsumption, and authority-transition gates. From Photons to the Macroverse -is also stack-local pre-graduation research. +Psychsocio metafauna and From Photons to the Macroverse remain stack-local +pre-graduation research. EPAC has an independently published MPL-2.0 `v0.1.0` +release and has passed public Stack reconsumption. Its Python forge copy is retired; +`research/epac/` preserves historical evidence. The final scoped authority receipt +follows the clean retired-source consumer check in `integration/epac/`. + +```bash +python3 integration/epac/reconsume.py \ + integration/epac/release-lock.json /tmp/epac-public-consumption python3.12 +``` ### Make derived artifacts fresh without depending on hosted CI diff --git a/STACK_MANIFEST.md b/STACK_MANIFEST.md index 80b03e8..1965f95 100644 --- a/STACK_MANIFEST.md +++ b/STACK_MANIFEST.md @@ -9,7 +9,7 @@ Provenance and authority-boundary record for `The-Interdependency/stack`. - English Gonol separation reconciliation UTC: `2026-09-12` at `030022948fb7c749961ae65743a4448c4bb6cbbe` - Stack-manifest schema: `the-interdependency.stack-manifest` version `1.1.0` - Work-graph digest (SHA-256 over canonical `repositories` + `research_participants` + `boundaries` JSON): - `9ab3b3f75a32f5f73b5df68419148181fc632593babe4ec6adf4269d4f35badb` + `23309848ffbcee5775a07f0a517c5658e04a40d5e76f793e5fee6c02caffad58` - Machine-readable copy: [`stack-manifest.json`](stack-manifest.json) ## Directory contract @@ -41,7 +41,7 @@ meaning used by that repository. | `The-Interdependency/edcm` | `7951ca32ba0f2494dc68ff9b7f6a80151918a56d` | main | measurement and evaluation of text-domain outputs | canon view `libs/edcm/`; measurement research `research/edcm/`; English Gonol construction is separate at `research/english-gonol/` | | `The-Interdependency/pcea` | `91ffa8c7249dfb810ca64a0bbc500481c0bd12a9` | main | prime circle encryption algorithm | canon view `libs/pcea/`; research `research/pcea/` | | `The-Interdependency/ptcna` | `97abdd1bbda61a68e0aac8595a32a3cb0ce73487` | main | prime tensor circled neural architecture | canon view `libs/ptcna/`; research `research/ptcna/` | -| `The-Interdependency/epac` | `d8868858b2e455381ce670797bdbe47189bdc496` | main | independent extracted candidate repository; implementation/public-contract authority transition incomplete | extracted repo exists; forge candidate remains `research/epac/` until release/reconsumption; `libs/epac/` remains unpopulated | +| `The-Interdependency/epac` | `949cb1cb304927942966c9fb396caf6227120e7f` | v0.1.0 | independent released EPAC repository; final implementation/public-contract authority receipt pending | immutable release artifact consumer at integration/epac/; historical forge evidence at research/epac/; libs/epac/ remains unpopulated | ## Research-Only Composition Participants @@ -51,6 +51,7 @@ release identity. | Workspace | Participant | Exact commit | Relation | Canonical release | |---|---|---|---|---| +| `research/epac/` | `The-Interdependency/stack` | `0e8384bbb60e4c2189016a212bdd0030d04aed7d` | historical forge evidence; active implementation consumed from the independent EPAC release | no | | `research/english-gonol/` | `The-Interdependency/stack` | `030022948fb7c749961ae65743a4448c4bb6cbbe` | stack-local English lexical/gonol construction separated from EDCM; consumes UCNS geometry; EDCM may evaluate outputs but does not define construction | no | | `research/ucns/` | `The-Interdependency/ucns` | `1975fe70cf4e0826a8020c2da3047569e277af64` | explicit source base for integrated stack-local UCNS research; does not refresh or replace the manifest-pinned `libs/ucns` canonical view | no | | `research/from-photons-to-macroverse/` | `The-Interdependency/stack` | `77ef8c7fb0ff75a524181655ee9f9641372768f7` | target composition forge baseline at audit start | no | @@ -87,9 +88,11 @@ extracted from as provenance while declaring a distinct `project` and stack-loca authority. Such a component must also appear in the stack research-participant graph; its source repository must stop claiming the separated responsibility at stack level. -EPAC is currently an extraction-transition exception: the independent repository exists, -but authority transfer is not complete, so the forge candidate remains in `research/epac/` -and no `libs/epac/` canonical import is created yet. +EPAC is consumed as an immutable release artifact through `integration/epac/`. +`research/epac/` retains historical forge evidence at its explicit Stack BASE, with +all Python implementation/test copies retired. A `libs/epac/` source mirror is not +required for artifact consumption. Final scoped transition evidence follows the +clean retired-source consumer gate. ## License status at pinned commits @@ -101,7 +104,7 @@ and no `libs/epac/` canonical import is created yet. | edcm | MPL-2.0 (`LICENSE`) | | pcea | present (`LICENSE`) | | ptcna | present (`LICENSE`) | -| epac | independent repository exists; no `LICENSE` yet — `hmmm` | +| epac | MPL-2.0 (`LICENSE`); owner weak-copyleft instruction recorded in the release source | ## Non-transfer boundaries @@ -131,10 +134,12 @@ repository, merge it there, then refresh the pinned view. ## Graduation boundary -EPAC now has an independent extracted repository, but extraction is not graduation. -Do not populate `libs/epac/`, replace the forge candidate, or assert implementation/public-contract -authority transfer until EPAC completes its clean build/install, license/distribution, -immutable release, downstream stack reconsumption, and authority-transition receipt gates. +EPAC has passed its licensed candidate matrix, pre-publication Stack check, immutable +publication and public Stack reconsumption. The historical implementation path is +retired. The clean retired-source consumer gate and scoped authority-transition +receipt complete the remaining transition. See `integration/epac/` for the immutable +release lock and acceptance evidence. EPAC consumes exact UCNS `6eea1828a34ed8ec99879f8090ea5d48352d8c2d`; +Stack's direct `libs/ucns/` and separate research UCNS pins remain unchanged. English Gonol Construction is earlier in that lifecycle: it is a distinct stack-local research component, not EDCM and not an independent canonical release. @@ -142,6 +147,6 @@ research component, not EDCM and not an independent canonical release. ## hmmm - UCNS has no `LICENSE` file at pinned commit `828c0b8`. -- EPAC clean install, license, stable release, downstream reconsumption, and authority-transition receipt remain incomplete; `libs/epac/` stays unpopulated until graduation. +- EPAC final scoped transition receipt awaits the clean retired-source consumer gate. - English Gonol Construction remains stack-local research; independent repository/release authority has not been established. - `skill-lib/` remains a special operational snapshot at stack root rather than following the ordinary `libs/` + `research/` pair. diff --git a/integration/epac/README.md b/integration/epac/README.md index b0d05f5..88b635a 100644 --- a/integration/epac/README.md +++ b/integration/epac/README.md @@ -39,7 +39,7 @@ After publishing those verified bytes, record a release lock with: The public asset set contains the wheel, source archive, `release-manifest.json`, and `SHA256SUMS`. The lock is repository-owned acceptance evidence once its public -bytes have been independently verified. No final lock exists during preparation. +bytes have been independently verified. The accepted `release-lock.json` binds the published v0.1.0 assets. Qualification and public-consumption evidence is retained in `evidence/`. ```bash python3 integration/epac/reconsume.py \ diff --git a/integration/epac/evidence/candidate-matrix.json b/integration/epac/evidence/candidate-matrix.json new file mode 100644 index 0000000..2fadeb5 --- /dev/null +++ b/integration/epac/evidence/candidate-matrix.json @@ -0,0 +1,92 @@ +{ + "authority_transfer": false, + "candidate_assets_sha256": { + "SHA256SUMS": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "interdependency_epac-0.1.0-py3-none-any.whl": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "interdependency_epac-0.1.0.tar.gz": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "release-manifest.json": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e" + }, + "empirical_status_transfer": false, + "license_qualification": "MPL-2.0 recorded", + "release_qualification": "same candidate clean installs passed; prepublication Stack acceptance remains separate", + "runtimes": { + "3.10": { + "assets_sha256": { + "SHA256SUMS": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "interdependency_epac-0.1.0-py3-none-any.whl": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "interdependency_epac-0.1.0.tar.gz": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "release-manifest.json": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e" + }, + "runs": { + "sdist": { + "artifact_sha256": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "receipt_sha256": "013423e7fec0e8c5cbd5a65d7eb236a9cf748abd7858502107733caeef8b4e25", + "skips": 0, + "tests": 209 + }, + "wheel": { + "artifact_sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "receipt_sha256": "f329816a99bcb0247c563089137f1d0d80920ec8194c6d3a3f2a53a34ecbaff6", + "skips": 0, + "tests": 209 + } + }, + "source_files": 197, + "wheel_files": 64 + }, + "3.11": { + "assets_sha256": { + "SHA256SUMS": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "interdependency_epac-0.1.0-py3-none-any.whl": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "interdependency_epac-0.1.0.tar.gz": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "release-manifest.json": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e" + }, + "runs": { + "sdist": { + "artifact_sha256": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "receipt_sha256": "27bb5cfda248ea7b54c73fbc536e794fbc32a8af4bb253463bbcf2b4c4567bc1", + "skips": 0, + "tests": 209 + }, + "wheel": { + "artifact_sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "receipt_sha256": "60da7099330cb85331e2c394bf100f124264bb9ae6fb7f8fdcd8efb67a9d3dc7", + "skips": 0, + "tests": 209 + } + }, + "source_files": 197, + "wheel_files": 64 + }, + "3.12": { + "assets_sha256": { + "SHA256SUMS": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "interdependency_epac-0.1.0-py3-none-any.whl": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "interdependency_epac-0.1.0.tar.gz": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "release-manifest.json": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e" + }, + "runs": { + "sdist": { + "artifact_sha256": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "receipt_sha256": "50d18d2f08a862312ce0fe0344f784eec86b8e3ac902d9ebd2e9a446c2f8ffa7", + "skips": 0, + "tests": 209 + }, + "wheel": { + "artifact_sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "receipt_sha256": "917fbdb1d7892cf8a29b1cb98032bff03c9a474c6237f4aa34504e7174c63190", + "skips": 0, + "tests": 209 + } + }, + "source_files": 197, + "wheel_files": 64 + } + }, + "schema": "epac.release-candidate-evidence-acceptance", + "source_commit": "949cb1cb304927942966c9fb396caf6227120e7f", + "source_tree": "8c9acb943ea05cbe3305fd0a10dd6a38b2fa684f", + "status": "passed", + "verifier_sha256": "4f95f90186f5fef2912230c0c073c093009b303c62d4d82473160b348d9d0517", + "version": 1 +} diff --git a/integration/epac/evidence/public-release.json b/integration/epac/evidence/public-release.json new file mode 100644 index 0000000..1c8e255 --- /dev/null +++ b/integration/epac/evidence/public-release.json @@ -0,0 +1,29 @@ +{ + "immutable": true, + "public_assets_sha256": { + "SHA256SUMS": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "interdependency_epac-0.1.0-py3-none-any.whl": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "interdependency_epac-0.1.0.tar.gz": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "release-manifest.json": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e" + }, + "qualification": { + "310-input-binding": "b579187e9071e78306df11effec033d30af6a05285774889751000cbb6d881df", + "310-sdist": "013423e7fec0e8c5cbd5a65d7eb236a9cf748abd7858502107733caeef8b4e25", + "310-wheel": "f329816a99bcb0247c563089137f1d0d80920ec8194c6d3a3f2a53a34ecbaff6", + "311-input-binding": "b579187e9071e78306df11effec033d30af6a05285774889751000cbb6d881df", + "311-sdist": "27bb5cfda248ea7b54c73fbc536e794fbc32a8af4bb253463bbcf2b4c4567bc1", + "311-wheel": "60da7099330cb85331e2c394bf100f124264bb9ae6fb7f8fdcd8efb67a9d3dc7", + "312-input-binding": "b579187e9071e78306df11effec033d30af6a05285774889751000cbb6d881df", + "312-sdist": "50d18d2f08a862312ce0fe0344f784eec86b8e3ac902d9ebd2e9a446c2f8ffa7", + "312-wheel": "917fbdb1d7892cf8a29b1cb98032bff03c9a474c6237f4aa34504e7174c63190", + "artifact_source_verifier_sha256": "4f95f90186f5fef2912230c0c073c093009b303c62d4d82473160b348d9d0517", + "prepublication_stack_receipt_sha256": "fb891326a7b81b0cda0ef8cc103a0f4b5c8c710b9f33a2079e5e2425b5456498" + }, + "release_id": 387733545, + "release_url": "https://github.com/The-Interdependency/epac/releases/tag/v0.1.0", + "schema": "epac.public-release-verification", + "source_commit": "949cb1cb304927942966c9fb396caf6227120e7f", + "status": "passed", + "verifier_sha256": "e6ec8ec144b2863de0ce53abc5058fdad07707def7dcd9e2b8b85870eb5e697a", + "version": 1 +} diff --git a/integration/epac/evidence/reproducibility.json b/integration/epac/evidence/reproducibility.json new file mode 100644 index 0000000..c7f11ee --- /dev/null +++ b/integration/epac/evidence/reproducibility.json @@ -0,0 +1,25 @@ +{ + "archived_files": 197, + "artifacts_sha256": { + "SHA256SUMS": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "interdependency_epac-0.1.0-py3-none-any.whl": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "interdependency_epac-0.1.0.tar.gz": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "release-manifest.json": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e" + }, + "clean_installation_matrix": "pending", + "git_files": 190, + "independent_verifier_sha256": "4f95f90186f5fef2912230c0c073c093009b303c62d4d82473160b348d9d0517", + "license_expression": "MPL-2.0", + "prepublication_stack_acceptance": "pending", + "publication_or_authority_transfer": false, + "schema": "epac.release-candidate-reproducibility", + "source_commit": "949cb1cb304927942966c9fb396caf6227120e7f", + "source_tree": "8c9acb943ea05cbe3305fd0a10dd6a38b2fa684f", + "status": "passed", + "umasks": [ + "022", + "077" + ], + "version": 1, + "wheel_files": 64 +} diff --git a/integration/epac/evidence/retirement-inventory.json b/integration/epac/evidence/retirement-inventory.json new file mode 100644 index 0000000..26cf822 --- /dev/null +++ b/integration/epac/evidence/retirement-inventory.json @@ -0,0 +1,393 @@ +{ + "authority_transfer": false, + "empirical_status_transfer": false, + "epac_commit": "949cb1cb304927942966c9fb396caf6227120e7f", + "epac_tree": "8c9acb943ea05cbe3305fd0a10dd6a38b2fa684f", + "prepared_at": "2026-09-12T23:33:26.754361+00:00", + "preserved_historical_files": [ + { + "path": "research/epac/README.md", + "sha256": "f1a4639327828f6bc5ca39a3a1c441d5fc3f3b60823e646d149920e225554c11" + }, + { + "path": "research/epac/data/periodic_table_z1_18.json", + "sha256": "748de9e986eaaa588092796d00d8e5d464c14d6308673402b4f6ac98ca81df19" + }, + { + "path": "research/epac/data/sealed_known_molecular_geometry.json", + "sha256": "8e8e8382a86bdeeb7720a14f6370e0b8c142729e2092f58a97ba8108fd4ef7d3" + }, + { + "path": "research/epac/docs/arity.md", + "sha256": "7ed7db4c25c53805df05c71ae92a0c1ef2b5c378b08c44588d5ecdbfd9da5e22" + }, + { + "path": "research/epac/docs/boundary_capacity_principle.md", + "sha256": "d82623ef38378fbff856a9a4a4fd75e7ca50a4ea59959158a867f4a1fbe3326d" + }, + { + "path": "research/epac/docs/boundary_capacity_quotient.md", + "sha256": "3159024e61e1edee0d0338e7b9984a0f0228a7c425c37a059e87a3222b212d5e" + }, + { + "path": "research/epac/docs/boundary_descriptor_nondegeneracy.md", + "sha256": "49f4025aef6711b72a372ebb41cd07b851c4e55ad1670cc1145c75180920e4ef" + }, + { + "path": "research/epac/docs/boundary_minimal_refinement.md", + "sha256": "bba6e05440b1bc9db9c8a6285a6dd13592df0c941d20de9a31d526bb5bd7db9b" + }, + { + "path": "research/epac/docs/boundary_probe_completeness.md", + "sha256": "bcb1db06672deb0703f0aa0afb0e41db1da3e7476e602322897662e9ce9a8043" + }, + { + "path": "research/epac/docs/cross_scale_compositional_closure.md", + "sha256": "402b9191311b2b5606a30893b001c5383236017afb379138081ed6b0f3c71d6e" + }, + { + "path": "research/epac/docs/preregistration-molecular-geometry-from-element-gonols.md", + "sha256": "bedc374cca8435e6ffde48f0e0aa90b3dcbef2b519d5e455270dc9c754d11025" + }, + { + "path": "research/epac/subatomic/receipts/c.json", + "sha256": "f957a829d9c246521113b435fff57f9f96f7171675bf28e27c1cdce78999ea30" + }, + { + "path": "research/epac/subatomic/receipts/gonol_c.json", + "sha256": "ec5c8d7121388405f0fa15c4a0ddb0879d3ae1cfd653faa9ac446553ae4e88a1" + }, + { + "path": "research/epac/subatomic/receipts/gonol_h.json", + "sha256": "864cf67e78e69a6c5255941e67c99bbfccab155b2fa5b5a01370852a3cfb2194" + }, + { + "path": "research/epac/subatomic/receipts/gonol_he.json", + "sha256": "46493d333082c3bff3fe551b235ef1b8d70be6601af7d6703fb1c2a90fda9d14" + }, + { + "path": "research/epac/subatomic/receipts/gonol_li.json", + "sha256": "3090fbf140c01672b0f19e86b62a7189c283c778b39b6c8d4d7a07cb14b121d2" + }, + { + "path": "research/epac/subatomic/receipts/h.json", + "sha256": "0fbeb009859592a18d14e0d44539637306ef6a9b14b54c7b55027fd2ea2b659b" + }, + { + "path": "research/epac/subatomic/receipts/harmonic_alpha_cluster_recurrence.json", + "sha256": "d45969aa486d1b49a23840940a76338f943a946a8524b284bb6359fa4c300de1" + }, + { + "path": "research/epac/subatomic/receipts/harmonic_binding_per_nucleon_commensurability.json", + "sha256": "f167754001eb500261198914eb6f66b0af151b59ca5d6fcc1a1ee7ff2182deca" + }, + { + "path": "research/epac/subatomic/receipts/harmonic_ground_state_spin_parity_symmetry.json", + "sha256": "7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f" + }, + { + "path": "research/epac/subatomic/receipts/harmonic_n_z_ratio_commensurability.json", + "sha256": "fa364116c0d4ceab3403a422e6c62bdcff2dc7c2375329add73cdb5d1dca683c" + }, + { + "path": "research/epac/subatomic/receipts/harmonic_proton_neutron_inversion_symmetry.json", + "sha256": "1505af798120449ad64e0cc4352afeebf0f4d2ca1e3e680f9651e4e0163e6a4a" + }, + { + "path": "research/epac/subatomic/receipts/he.json", + "sha256": "761d160209318acca3773bd1669dbc8eb4587e141926dc45684aea38f60d7c5c" + }, + { + "path": "research/epac/subatomic/receipts/li.json", + "sha256": "a407cf2345037a0ca9c064eaea266a886de927044a65b4dd03c4f9dfea55c8a0" + }, + { + "path": "research/epac/subatomic/subatomic-affixiation-baseline.md", + "sha256": "43440232af92ecbb175dbae688bc1acc188c976879ef270d1396c6a3ce129ea4" + }, + { + "path": "research/epac/viz/README.md", + "sha256": "3603f9ca0604eaff72bb1ba511f419eabcadf55ebc0f298dbe49722318345157" + }, + { + "path": "research/epac/viz/carbon_lifted_spiral.svg", + "sha256": "c96e9249b0f33ba09336ccc94e93fa47a89c687b6b15316a7272b4b31698880a" + }, + { + "path": "research/epac/viz/h2o_lifted_spiral.svg", + "sha256": "c3e651ed0ff231bc75fe9d021abdacd504f1bc171cc4b6447204c23d72189d99" + } + ], + "proposed_python_retirements": [ + { + "path": "research/epac/epac_atomic.py", + "replacement_byte_identical": true, + "replacement_path": "epac_atomic.py", + "replacement_sha256": "1ef464df3e984320499c1a421d49d3b5c36e0d5bcdfc93176394d34cd71c59fb", + "sha256": "1ef464df3e984320499c1a421d49d3b5c36e0d5bcdfc93176394d34cd71c59fb" + }, + { + "path": "research/epac/epac_boundary_minimal_refinement.py", + "replacement_byte_identical": false, + "replacement_path": "epac_boundary_minimal_refinement.py", + "replacement_sha256": "168943a1d198147d5e91c21069c06d343366979b6dffacf1e2ee664d3b6edce8", + "sha256": "5c04ca8a6f1de3a4ee0b18ac687ae5344ece6404649afc3259c9d97338fd7fec" + }, + { + "path": "research/epac/epac_boundary_nondegeneracy.py", + "replacement_byte_identical": false, + "replacement_path": "epac_boundary_nondegeneracy.py", + "replacement_sha256": "e67edf2c171b178873f21eeadc743581c83dff7abb0d6e32cd643843627c2306", + "sha256": "57506fad240c4e8b3a0baf6d0f0748eea8d692ccbad4fdc3943774f4bda82a5f" + }, + { + "path": "research/epac/epac_boundary_probe_completeness.py", + "replacement_byte_identical": false, + "replacement_path": "epac_boundary_probe_completeness.py", + "replacement_sha256": "8dad10b3ac9d3873f134af131488463511b8e66ecefc7fdb82609e92fa328eb9", + "sha256": "cb1d9e4e2e1339123eab2775509e9604c6a25482d21c77e158cd4514bd5b743e" + }, + { + "path": "research/epac/epac_boundary_quotient.py", + "replacement_byte_identical": false, + "replacement_path": "epac_boundary_quotient.py", + "replacement_sha256": "91a966c68d65938a9e2641a10b8b2935fe1992fdc70f129b9424290b38b3ab98", + "sha256": "7398f3f9b3dca1776fc72a001701732bc768b9e76a5e8ff9a740cff48b73120b" + }, + { + "path": "research/epac/epac_comparison.py", + "replacement_byte_identical": false, + "replacement_path": "epac_comparison.py", + "replacement_sha256": "7283c099923310f8dae24d577505b54c25919290b358be2aefa5fde1b8285535", + "sha256": "f96f81e37127ada9c93008440929d499466ae2c28024575ba58f59dd31f8e10f" + }, + { + "path": "research/epac/epac_cross_scale_closure.py", + "replacement_byte_identical": false, + "replacement_path": "epac_cross_scale_closure.py", + "replacement_sha256": "9cf3a0c76e17076217dd0c90f467d45a2aa0647754a031f6f826dc3f3a9e9e2c", + "sha256": "f633a75755884f0b2ba7860b54e3943058891e7711775b9b3a3efefc1ab81d3a" + }, + { + "path": "research/epac/epac_dimensional_arity.py", + "replacement_byte_identical": false, + "replacement_path": "epac_dimensional_arity.py", + "replacement_sha256": "5ed353191c853aaeecb62ba520ce89010682949053c8d6a04315531ec3c7429c", + "sha256": "8424e83115e5558cd7957e37115df615dc32859b6c19482f951feafc33c664a1" + }, + { + "path": "research/epac/epac_molecular.py", + "replacement_byte_identical": false, + "replacement_path": "epac_molecular.py", + "replacement_sha256": "0fce13c83ea65a21ad81acd206927dedbaae336d7d980bd1dbd0858f58537108", + "sha256": "df121c18b37b4c2f1acf58a879b5f4f02974408cc91a5747a74b2e6cf42d726a" + }, + { + "path": "research/epac/epac_periodic.py", + "replacement_byte_identical": false, + "replacement_path": "epac_periodic.py", + "replacement_sha256": "20474c25aaad15121efc2010227071bd31d1304080dfe45f2aa1115edb95d332", + "sha256": "b3a813ee948d0771601d4fb5bc132c1d9f9144ebac89ac8143cb90228350d541" + }, + { + "path": "research/epac/epac_public_gonol.py", + "replacement_byte_identical": false, + "replacement_path": "epac_public_gonol.py", + "replacement_sha256": "1a088076a19aba34a281ba1b3c25f47dee962a0aa8e61915bfe44e7b94357697", + "sha256": "ca8258303711f6f30da6d00db93abb5cff22d9213085a5457358dcd24ab59d58" + }, + { + "path": "research/epac/subatomic/element_affixiation_candidate.py", + "replacement_byte_identical": false, + "replacement_path": "subatomic/element_affixiation_candidate.py", + "replacement_sha256": "3a282b1911657f7482dc08023b76e206f96210b90685f0caad4ecc689406b004", + "sha256": "226e4a38dcb6bbc050ce01273a0e1c7c561900019dd68f34f80324af9eac30de" + }, + { + "path": "research/epac/subatomic/extended_atomic.py", + "replacement_byte_identical": false, + "replacement_path": "subatomic/extended_atomic.py", + "replacement_sha256": "7818c546c95d8f8ca7699e4c2133520f3ffef1e48b26accd978decf1fa2c6302", + "sha256": "816935506f7352e66b5beb49c2322f65f5b06d5a68b15b4fc0c8d1c7ca0f26af" + }, + { + "path": "research/epac/subatomic/nuclear_harmonic_candidates.py", + "replacement_byte_identical": false, + "replacement_path": "subatomic/nuclear_harmonic_candidates.py", + "replacement_sha256": "90f6c4ce1b8c1caf0d9c5605c65b2100a63089a1563858d6e91fee01721fdef6", + "sha256": "cb4b97e2e8595ace20ca7a3e5f6915dcf7125d3cd199454eab55e5e9987aa308" + }, + { + "path": "research/epac/subatomic/subatomic_gonol.py", + "replacement_byte_identical": false, + "replacement_path": "subatomic/subatomic_gonol.py", + "replacement_sha256": "3e97f3406eb3406aeb8fa30ec33778226fbc1ab9d2b368f60c2df0a9b0865cda", + "sha256": "7faa9ed9e1d59ee1abca32462679e6ae33233b51713d4a51e7fd070a254e7841" + }, + { + "path": "research/epac/subatomic/symbol_coupling.py", + "replacement_byte_identical": false, + "replacement_path": "subatomic/symbol_coupling.py", + "replacement_sha256": "dbd2cc072291f31798c5db6bd4935f80218135c2a4da5c33776cfb0f6cc285b2", + "sha256": "dc7e329b1cd6b88e6c764fc12795446075543034ba4a8c0c55fcffb625045a76" + }, + { + "path": "research/epac/subatomic/test_element_affixiation_candidate.py", + "replacement_byte_identical": false, + "replacement_path": "tests/subatomic/test_element_affixiation_candidate.py", + "replacement_sha256": "876178c114a801e2d3b51559a8879e4ec0c5553f02406be81b6b4e237032ef23", + "sha256": "4911ab5075454965a42c4e403dbb91ef20dadb554256ff3fc37f8ae99f9e0c0f" + }, + { + "path": "research/epac/subatomic/test_extended_atomic.py", + "replacement_byte_identical": false, + "replacement_path": "tests/subatomic/test_extended_atomic.py", + "replacement_sha256": "9b653e63295ee74864558d50efff325f9c793d3886c6c4a5769a4fffba37110d", + "sha256": "30e0674c6fa998e704648b399ecf7f6d8ee795525d644bcfe4bf7fd4fd7965ce" + }, + { + "path": "research/epac/subatomic/test_nuclear_harmonic_candidates.py", + "replacement_byte_identical": false, + "replacement_path": "tests/subatomic/test_nuclear_harmonic_candidates.py", + "replacement_sha256": "a414993d8274bb0a7ae1e5ceef9975f115ab50e5801da65971ae6e212523c00e", + "sha256": "e17db29cbb1474e33075a0ffd1d00a0ced796a603f75bed5625ba89451cefc71" + }, + { + "path": "research/epac/subatomic/test_subatomic_gonol.py", + "replacement_byte_identical": false, + "replacement_path": "tests/subatomic/test_subatomic_gonol.py", + "replacement_sha256": "3aa9c7cbc878d1926ac9cd3461d953275fec5f9e911ff7cdfe30348789d2fee9", + "sha256": "b6dd5271d9f7b4c45b4d09596915c29a570f2649717dd7925500b7593d0f0e99" + }, + { + "path": "research/epac/subatomic/test_symbol_coupling.py", + "replacement_byte_identical": false, + "replacement_path": "tests/subatomic/test_symbol_coupling.py", + "replacement_sha256": "a5711f72c3f2a953811adce77159a23100388ef2662ceb4b6df832d426e91847", + "sha256": "07cb0bf5e290b9b3f18e9123e23e8608b894171f69c34c4b645eca4860ab3081" + }, + { + "path": "research/epac/tests/test_atomic_promotion.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_atomic_promotion.py", + "replacement_sha256": "8cbd7644436597f9bf12845a5ef788c8dfb73d51b715b2bc7c3509cc29da939c", + "sha256": "473507856bb9e35f19915a3403fd2f07ccb98ff02b3d74cc80f516ad76ffe260" + }, + { + "path": "research/epac/tests/test_boundary_capacity_quotient.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_boundary_capacity_quotient.py", + "replacement_sha256": "fcb95ee31f0551e8a4fb9217f39c8894fa8314a4d8e509a792d8881b2e2125de", + "sha256": "057c779537771a46ea7c99748ef74372966295b90ce3df09f03d94264c4e7811" + }, + { + "path": "research/epac/tests/test_boundary_descriptor_nondegeneracy.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_boundary_descriptor_nondegeneracy.py", + "replacement_sha256": "2d154f2cc97833d27375d85343dcb5cf1465fdc01e29a0b2af25d99e6f7142b2", + "sha256": "fdd95f563f2ed91a28aaa21c8876dd117047b855283a87cb847748f78ddbbc5b" + }, + { + "path": "research/epac/tests/test_boundary_minimal_refinement.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_boundary_minimal_refinement.py", + "replacement_sha256": "476136fe2af33f45b7cef4d7b8c8f86c6d61920bb87ba1820203debb753d886b", + "sha256": "9744c2b513ec92375334c5f06e65e2f1b01e0fbf7e720346025d7187d9ca894c" + }, + { + "path": "research/epac/tests/test_boundary_probe_completeness.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_boundary_probe_completeness.py", + "replacement_sha256": "8a45855a4489893fab46ad60477ab50170d63a84eed7ec88d65ca51f9b9068c5", + "sha256": "f279644854c703679ae6097bd269d09ec9e1aec73e091b1613f5a6504d17ea59" + }, + { + "path": "research/epac/tests/test_cross_scale_compositional_closure.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_cross_scale_compositional_closure.py", + "replacement_sha256": "51a0a735c9f90292e1968ef3e34c965641a56cd496e0ce780591eeeac40dda69", + "sha256": "f412165deef20eda92f0241d39e107e2bdf4944cb5ad55c66ca768d02efa635b" + }, + { + "path": "research/epac/tests/test_epac_arity.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_epac_arity.py", + "replacement_sha256": "cc1444faf18adf0984e017728e6cc19a813e5255e5709e5ee2e15cfc1c445792", + "sha256": "16261bab702e16bf140372451cb5a14eb3ecf5d63ac21c224ea48012ddaef5ef" + }, + { + "path": "research/epac/tests/test_epac_public_gonol.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_epac_public_gonol.py", + "replacement_sha256": "92572cad225ed1c2a4e6ea517ac2af71c1126c3c838f40bed90fdcc1b6a13646", + "sha256": "462ffab9296328e0514f7a87d1783cb03bf18af537ec560985dc387eeb9f155c" + }, + { + "path": "research/epac/tests/test_geometry_comparison_after_construction.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_geometry_comparison_after_construction.py", + "replacement_sha256": "0721a13ed61ce210417075af0dfb6fef0d3a03fad29a60cc2ce584b1107d10e8", + "sha256": "7b433384035f726626a0a40799537604c4b32aa677232d2bcee88d0bfa9bfbc5" + }, + { + "path": "research/epac/tests/test_molecular_affixiation.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_molecular_affixiation.py", + "replacement_sha256": "c945d2a3d27f8aaf4db13294601c4c1f18d7d2b4a1c2ae5890e40b9e713e5032", + "sha256": "8c6f6aca06cf738b234aac87aec46b143f8ba373ea2ce363dcc211e159fea340" + }, + { + "path": "research/epac/tests/test_periodic_element_gonols.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_periodic_element_gonols.py", + "replacement_sha256": "d5330b4dad462464bd8f03966eacacac6de2a181274e93a781e42d9a71f6f5bc", + "sha256": "0f914321b30dacd147ef59eaac732df014f40d08ecb1048d2976872a9274ada9" + }, + { + "path": "research/epac/tests/test_spiral_population.py", + "replacement_byte_identical": false, + "replacement_path": "tests/test_spiral_population.py", + "replacement_sha256": "3f208d281bd8ae0a740bad0023a6b228c08a463264f1d98ca323f939529f7b2c", + "sha256": "14c3563267d21e41f04e20e8dbdd8c88a071841b77b9a4ba0936835950a6d826" + }, + { + "path": "research/epac/viz/__init__.py", + "replacement_byte_identical": false, + "replacement_path": "viz/__init__.py", + "replacement_sha256": "6c6dea83d6381b5ee7beebc66592d60831d6df791ad05e3335318e6adc479c0a", + "sha256": "8a49e7b32f1dc8fa2411fade7692986fb30cfdc7e993e29f7a9572888e3f6518" + }, + { + "path": "research/epac/viz/__main__.py", + "replacement_byte_identical": false, + "replacement_path": "viz/__main__.py", + "replacement_sha256": "5d34e27b2bef8c2cf52fd2f419a424c530d5c0a1f422b3f0339bf2727d0c6495", + "sha256": "00509d95dd39dae60300d870f976cf4e1115066cee607e5d493df55167904ef7" + }, + { + "path": "research/epac/viz/cli.py", + "replacement_byte_identical": false, + "replacement_path": "viz/cli.py", + "replacement_sha256": "85018412bf5d4b7c3e2d0f9a85b3bd64bdc09ec2b6b74ce4492f0e5c7b0adb0e", + "sha256": "5f234d44c3ee85b7872ff506f518cc66e6257b0871c7c9a9d525dd5c3b3a72da" + }, + { + "path": "research/epac/viz/spiral_viz.py", + "replacement_byte_identical": false, + "replacement_path": "viz/spiral_viz.py", + "replacement_sha256": "b7bb06a4160d09e7461fd10dc60d7c2ba2fe3b3b6b233a7da20b27c6322a62a9", + "sha256": "4a888dd253665518cca48e764262e2ec1b3be53a713d15ca17d5cd48af18361e" + } + ], + "requires_before_mutation": [ + "owner-selected EPAC license", + "verified immutable public EPAC release", + "successful same-release Stack reconsumption", + "latest upstream forge check with no untransferred changes" + ], + "schema": "stack.epac-forge-retirement-preview", + "stack_commit": "e9454b1de8602c8dba8bc968d809fe3238655a0d", + "stack_tree": "2ab442701c5ab3fb67462fb7d01bb853ecc11e07", + "status": "preview only", + "version": 1 +} diff --git a/integration/epac/evidence/stack-candidate.json b/integration/epac/evidence/stack-candidate.json new file mode 100644 index 0000000..2d52228 --- /dev/null +++ b/integration/epac/evidence/stack-candidate.json @@ -0,0 +1,134 @@ +{ + "artifact_sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "comparison_standings": { + "atomic_shells_as_sealed_shape_prediction": "FALSIFIED", + "boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "charged_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "per_symbol_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "topology_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "ucns_mobius_as_sealed_shape_prediction": "FALSIFIED" + }, + "empirical_status_transfer": false, + "epac_version": "0.1.0", + "imported_origins": { + "epac_atomic": "lib/python3.11/site-packages/epac_atomic.py", + "epac_boundary_nondegeneracy": "lib/python3.11/site-packages/epac_boundary_nondegeneracy.py", + "epac_boundary_probe_completeness": "lib/python3.11/site-packages/epac_boundary_probe_completeness.py", + "epac_boundary_quotient": "lib/python3.11/site-packages/epac_boundary_quotient.py", + "epac_comparison": "lib/python3.11/site-packages/epac_comparison.py", + "epac_cross_scale_closure": "lib/python3.11/site-packages/epac_cross_scale_closure.py", + "epac_data": "lib/python3.11/site-packages/epac_data/__init__.py", + "epac_dimensional_arity": "lib/python3.11/site-packages/epac_dimensional_arity.py", + "epac_evidence_cache": "lib/python3.11/site-packages/epac_evidence_cache.py", + "epac_molecular": "lib/python3.11/site-packages/epac_molecular.py", + "epac_periodic": "lib/python3.11/site-packages/epac_periodic.py", + "epac_public_gonol": "lib/python3.11/site-packages/epac_public_gonol.py", + "epac_subatomic": "lib/python3.11/site-packages/epac_subatomic/__init__.py", + "epac_subatomic.element_affixiation_candidate": "lib/python3.11/site-packages/epac_subatomic/element_affixiation_candidate.py", + "epac_subatomic.extended_atomic": "lib/python3.11/site-packages/epac_subatomic/extended_atomic.py", + "epac_subatomic.nuclear_harmonic_candidates": "lib/python3.11/site-packages/epac_subatomic/nuclear_harmonic_candidates.py", + "epac_subatomic.subatomic_gonol": "lib/python3.11/site-packages/epac_subatomic/subatomic_gonol.py", + "epac_ucns_provenance": "lib/python3.11/site-packages/epac_ucns_provenance.py", + "epac_viz": "lib/python3.11/site-packages/epac_viz/__init__.py", + "epac_viz.spiral_viz": "lib/python3.11/site-packages/epac_viz/spiral_viz.py", + "ucns": "lib/python3.11/site-packages/ucns/__init__.py", + "ucns.carrier": "lib/python3.11/site-packages/ucns/carrier.py", + "ucns.direct_mobius": "lib/python3.11/site-packages/ucns/direct_mobius.py", + "ucns.gonal_boundary_trace": "lib/python3.11/site-packages/ucns/gonal_boundary_trace.py", + "ucns.mobius_seed": "lib/python3.11/site-packages/ucns/mobius_seed.py", + "ucns.mobius_vesica": "lib/python3.11/site-packages/ucns/mobius_vesica.py", + "ucns.modular_orbit": "lib/python3.11/site-packages/ucns/modular_orbit.py", + "ucns.public_gonol": "lib/python3.11/site-packages/ucns/public_gonol.py" + }, + "installed_payload_sha256": { + "epac_atomic.py": "1ef464df3e984320499c1a421d49d3b5c36e0d5bcdfc93176394d34cd71c59fb", + "epac_boundary_minimal_refinement.py": "168943a1d198147d5e91c21069c06d343366979b6dffacf1e2ee664d3b6edce8", + "epac_boundary_nondegeneracy.py": "e67edf2c171b178873f21eeadc743581c83dff7abb0d6e32cd643843627c2306", + "epac_boundary_probe_completeness.py": "8dad10b3ac9d3873f134af131488463511b8e66ecefc7fdb82609e92fa328eb9", + "epac_boundary_quotient.py": "91a966c68d65938a9e2641a10b8b2935fe1992fdc70f129b9424290b38b3ab98", + "epac_comparison.py": "7283c099923310f8dae24d577505b54c25919290b358be2aefa5fde1b8285535", + "epac_cross_scale_closure.py": "9cf3a0c76e17076217dd0c90f467d45a2aa0647754a031f6f826dc3f3a9e9e2c", + "epac_data/__init__.py": "7ea12c7477b04457888ca5d8cdc5c322b26af0c14959878dd2d00df0aa3619d3", + "epac_data/periodic_table_z1_18.json": "748de9e986eaaa588092796d00d8e5d464c14d6308673402b4f6ac98ca81df19", + "epac_data/sealed_known_molecular_geometry.json": "8e8e8382a86bdeeb7720a14f6370e0b8c142729e2092f58a97ba8108fd4ef7d3", + "epac_data/ucns-source-lock.json": "5f072d8c900ab0912fe35b2d2d6480ce09b14f280cb98e394ced13c130a145f3", + "epac_dimensional_arity.py": "5ed353191c853aaeecb62ba520ce89010682949053c8d6a04315531ec3c7429c", + "epac_evidence_cache.py": "927ac252d608e4af0b1a90e8686e764851de2ff71b674a0d56265ecf0422381a", + "epac_molecular.py": "0fce13c83ea65a21ad81acd206927dedbaae336d7d980bd1dbd0858f58537108", + "epac_periodic.py": "20474c25aaad15121efc2010227071bd31d1304080dfe45f2aa1115edb95d332", + "epac_public_gonol.py": "1a088076a19aba34a281ba1b3c25f47dee962a0aa8e61915bfe44e7b94357697", + "epac_subatomic/__init__.py": "492711dba97ef160f14772b71fb75bda0abb5b0828b21ab989a06e84ccaae4b8", + "epac_subatomic/element_affixiation_candidate.py": "3a282b1911657f7482dc08023b76e206f96210b90685f0caad4ecc689406b004", + "epac_subatomic/extended_atomic.py": "7818c546c95d8f8ca7699e4c2133520f3ffef1e48b26accd978decf1fa2c6302", + "epac_subatomic/nuclear_harmonic_candidates.py": "90f6c4ce1b8c1caf0d9c5605c65b2100a63089a1563858d6e91fee01721fdef6", + "epac_subatomic/receipts/c.json": "f957a829d9c246521113b435fff57f9f96f7171675bf28e27c1cdce78999ea30", + "epac_subatomic/receipts/gonol_c.json": "ec5c8d7121388405f0fa15c4a0ddb0879d3ae1cfd653faa9ac446553ae4e88a1", + "epac_subatomic/receipts/gonol_h.json": "864cf67e78e69a6c5255941e67c99bbfccab155b2fa5b5a01370852a3cfb2194", + "epac_subatomic/receipts/gonol_he.json": "46493d333082c3bff3fe551b235ef1b8d70be6601af7d6703fb1c2a90fda9d14", + "epac_subatomic/receipts/gonol_li.json": "3090fbf140c01672b0f19e86b62a7189c283c778b39b6c8d4d7a07cb14b121d2", + "epac_subatomic/receipts/h.json": "0fbeb009859592a18d14e0d44539637306ef6a9b14b54c7b55027fd2ea2b659b", + "epac_subatomic/receipts/harmonic_alpha_cluster_recurrence.json": "d45969aa486d1b49a23840940a76338f943a946a8524b284bb6359fa4c300de1", + "epac_subatomic/receipts/harmonic_binding_per_nucleon_commensurability.json": "5fd72fac99ea3f66218e97cbcbee9907d990375c0808022b3b517ee136932e31", + "epac_subatomic/receipts/harmonic_ground_state_spin_parity_symmetry.json": "9095ff2a16d1ccfb0b6bbc79eb46702abdafa08113b62a709c878ec3a2a4fe8f", + "epac_subatomic/receipts/harmonic_n_z_ratio_commensurability.json": "fa364116c0d4ceab3403a422e6c62bdcff2dc7c2375329add73cdb5d1dca683c", + "epac_subatomic/receipts/harmonic_proton_neutron_inversion_symmetry.json": "1505af798120449ad64e0cc4352afeebf0f4d2ca1e3e680f9651e4e0163e6a4a", + "epac_subatomic/receipts/he.json": "761d160209318acca3773bd1669dbc8eb4587e141926dc45684aea38f60d7c5c", + "epac_subatomic/receipts/history/harmonic_binding_per_nucleon_commensurability-ba93ccda9da20f9184d5db87c0d83c3b610bd48699a6c4886c790e89651f3e33.json": "f167754001eb500261198914eb6f66b0af151b59ca5d6fcc1a1ee7ff2182deca", + "epac_subatomic/receipts/history/harmonic_ground_state_spin_parity_symmetry-25ed793cb1584a38c0d2185451e389068b0622990054729efb7b3e178bf31680.json": "cde788f5eccbede6c6edb63505ea11687729647c848a11b5f1d25e72896c33ee", + "epac_subatomic/receipts/history/harmonic_ground_state_spin_parity_symmetry-packaged-7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f.json": "7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f", + "epac_subatomic/receipts/li.json": "a407cf2345037a0ca9c064eaea266a886de927044a65b4dd03c4f9dfea55c8a0", + "epac_subatomic/receipts/ucns-6eea182/c.json": "1ac20a133db5b964f3206215c54b744034c0bea212726e0dc182336bc81abe33", + "epac_subatomic/receipts/ucns-6eea182/h.json": "b9dd3b0d026b79d3575b915f1ad036a8e2229e170624bde0cacea454149c21c3", + "epac_subatomic/receipts/ucns-6eea182/he.json": "c8a95b058c996637dfa7e7b9ed2a8a775518aa8966aa7d22b79780fee1d182f5", + "epac_subatomic/receipts/ucns-6eea182/li.json": "5570921a4af22c10dba76c2a67fa70f884cf9ccee64db811bfecc79773cc6a86", + "epac_subatomic/receipts/ucns-828c0b8/c.json": "c486a418c2fd020e72bd16ef8b107feaabc854950d32c6deeb65176ae76c5b91", + "epac_subatomic/receipts/ucns-828c0b8/h.json": "0104494752c1f72eb7629defb25db6ff4687767fc038e90c3ac2054c94cb251e", + "epac_subatomic/receipts/ucns-828c0b8/he.json": "4273b4345464dc121f46523b67167688b537b946bcb15a9206cb10460a19cff1", + "epac_subatomic/receipts/ucns-828c0b8/li.json": "e41c5214327f2ddb76e0aa2d7cf15f4255530522bf5ba8879ddc933b3182fdf8", + "epac_subatomic/receipts/ucns-be42dfc/c.json": "1da011a700b4b2c518ee1bf497acc1cc691fecf8b379ad833202cb7cdd11e23f", + "epac_subatomic/receipts/ucns-be42dfc/h.json": "4e36f5c883d23d96ae800e1e32ad91af45979df1a193b516c78b93a4e3affa8b", + "epac_subatomic/receipts/ucns-be42dfc/he.json": "7230fbf210e5c78ae8bba5ebbff8557b7a5664841824d6aacdf106c5240895dd", + "epac_subatomic/receipts/ucns-be42dfc/li.json": "fc96542cbc11901fcbbea155e2ce463bcfbf610a4ae7aff0225cc5f2afc60437", + "epac_subatomic/subatomic-affixiation-baseline.md": "a7e4e5d44c149fa60bf03ae34cf4eb2a5178ca0f41361d4736e43798ae5e8a19", + "epac_subatomic/subatomic_gonol.py": "3e97f3406eb3406aeb8fa30ec33778226fbc1ab9d2b368f60c2df0a9b0865cda", + "epac_subatomic/symbol_coupling.py": "dbd2cc072291f31798c5db6bd4935f80218135c2a4da5c33776cfb0f6cc285b2", + "epac_ucns_provenance.py": "3ce5de529af6642427df146f3e1721be75ef82d552b824691652ee90cba205e5", + "epac_viz/README.md": "f4a880fcc32a0f750ceec7fe589b48905df6c46ebb4aa6fee6287cb1cc583fbd", + "epac_viz/__init__.py": "6c6dea83d6381b5ee7beebc66592d60831d6df791ad05e3335318e6adc479c0a", + "epac_viz/__main__.py": "5d34e27b2bef8c2cf52fd2f419a424c530d5c0a1f422b3f0339bf2727d0c6495", + "epac_viz/carbon_lifted_spiral.svg": "c96e9249b0f33ba09336ccc94e93fa47a89c687b6b15316a7272b4b31698880a", + "epac_viz/cli.py": "85018412bf5d4b7c3e2d0f9a85b3bd64bdc09ec2b6b74ce4492f0e5c7b0adb0e", + "epac_viz/h2o_lifted_spiral.svg": "c3e651ed0ff231bc75fe9d021abdacd504f1bc171cc4b6447204c23d72189d99", + "epac_viz/spiral_viz.py": "b7bb06a4160d09e7461fd10dc60d7c2ba2fe3b3b6b233a7da20b27c6322a62a9" + }, + "molecular_receipts": { + "BF3": "729762cea3a9589e525ea3049e9588b4f7288434418da02a8f8c25f41dc56ac9", + "CH4": "3624369d468d7b16b5b3c807cdd3bbccbe588e61fc13d8ba7dfad7cb846c219b", + "CO2": "90af93faedaf75e285b07506a272ee58029ae646206b63dcd0f5794d962a1528", + "H2": "d5b616799c9e56135bc82b016f4534a1e20edd79dd0ed581bca92b20331ca3e3", + "H2O": "cfac71635e0c49ff842bf04d2719bf1f051106ec5fb3d5ffbd922c8c7c08aaaa", + "H2S": "0fb222c67c6cee19d4748d0e1cb4d68d6850ab42ee32818b319f574f89d48ade", + "NH3": "2a1c12a6bf4fcf844e2e860df4b4db244c1aac77478002c86fbf2e4ff52abb2c", + "PH3": "f5790091f5c98cbaff41a5d8fbaafaa804cee94966073e183b94544d0b4ba2e3", + "SiH4": "679a1be1f05d9a28e6880d68085ed1b74ee1267892d30aac7321068f071a566c" + }, + "phase": "candidate", + "public_gonol_receipt": "731e6278b5cc663cc76429f655b21c84c06dfbe8249bda95df25ae0343ccb1ff", + "python": "3.11.15 (main, May 10 2026, 19:28:18) [Clang 22.1.3 ]", + "schema": "stack.epac-artifact-consumption", + "source_commit": "e9454b1de8602c8dba8bc968d809fe3238655a0d", + "source_tree": "2ab442701c5ab3fb67462fb7d01bb853ecc11e07", + "source_unchanged": true, + "status": "passed", + "ucns_source_commit": "6eea1828a34ed8ec99879f8090ea5d48352d8c2d", + "verifier_sha256": "c233076a65968d80cae697eb04fcd8d34b2ae0233d3f3da75aa34032d182f6b2", + "version": 1 +} diff --git a/integration/epac/evidence/stack-reconsumed.json b/integration/epac/evidence/stack-reconsumed.json new file mode 100644 index 0000000..1b9d2d4 --- /dev/null +++ b/integration/epac/evidence/stack-reconsumed.json @@ -0,0 +1,134 @@ +{ + "artifact_sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "comparison_standings": { + "atomic_shells_as_sealed_shape_prediction": "FALSIFIED", + "boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "charged_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "per_symbol_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "topology_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "ucns_mobius_as_sealed_shape_prediction": "FALSIFIED" + }, + "empirical_status_transfer": false, + "epac_version": "0.1.0", + "imported_origins": { + "epac_atomic": "lib/python3.12/site-packages/epac_atomic.py", + "epac_boundary_nondegeneracy": "lib/python3.12/site-packages/epac_boundary_nondegeneracy.py", + "epac_boundary_probe_completeness": "lib/python3.12/site-packages/epac_boundary_probe_completeness.py", + "epac_boundary_quotient": "lib/python3.12/site-packages/epac_boundary_quotient.py", + "epac_comparison": "lib/python3.12/site-packages/epac_comparison.py", + "epac_cross_scale_closure": "lib/python3.12/site-packages/epac_cross_scale_closure.py", + "epac_data": "lib/python3.12/site-packages/epac_data/__init__.py", + "epac_dimensional_arity": "lib/python3.12/site-packages/epac_dimensional_arity.py", + "epac_evidence_cache": "lib/python3.12/site-packages/epac_evidence_cache.py", + "epac_molecular": "lib/python3.12/site-packages/epac_molecular.py", + "epac_periodic": "lib/python3.12/site-packages/epac_periodic.py", + "epac_public_gonol": "lib/python3.12/site-packages/epac_public_gonol.py", + "epac_subatomic": "lib/python3.12/site-packages/epac_subatomic/__init__.py", + "epac_subatomic.element_affixiation_candidate": "lib/python3.12/site-packages/epac_subatomic/element_affixiation_candidate.py", + "epac_subatomic.extended_atomic": "lib/python3.12/site-packages/epac_subatomic/extended_atomic.py", + "epac_subatomic.nuclear_harmonic_candidates": "lib/python3.12/site-packages/epac_subatomic/nuclear_harmonic_candidates.py", + "epac_subatomic.subatomic_gonol": "lib/python3.12/site-packages/epac_subatomic/subatomic_gonol.py", + "epac_ucns_provenance": "lib/python3.12/site-packages/epac_ucns_provenance.py", + "epac_viz": "lib/python3.12/site-packages/epac_viz/__init__.py", + "epac_viz.spiral_viz": "lib/python3.12/site-packages/epac_viz/spiral_viz.py", + "ucns": "lib/python3.12/site-packages/ucns/__init__.py", + "ucns.carrier": "lib/python3.12/site-packages/ucns/carrier.py", + "ucns.direct_mobius": "lib/python3.12/site-packages/ucns/direct_mobius.py", + "ucns.gonal_boundary_trace": "lib/python3.12/site-packages/ucns/gonal_boundary_trace.py", + "ucns.mobius_seed": "lib/python3.12/site-packages/ucns/mobius_seed.py", + "ucns.mobius_vesica": "lib/python3.12/site-packages/ucns/mobius_vesica.py", + "ucns.modular_orbit": "lib/python3.12/site-packages/ucns/modular_orbit.py", + "ucns.public_gonol": "lib/python3.12/site-packages/ucns/public_gonol.py" + }, + "installed_payload_sha256": { + "epac_atomic.py": "1ef464df3e984320499c1a421d49d3b5c36e0d5bcdfc93176394d34cd71c59fb", + "epac_boundary_minimal_refinement.py": "168943a1d198147d5e91c21069c06d343366979b6dffacf1e2ee664d3b6edce8", + "epac_boundary_nondegeneracy.py": "e67edf2c171b178873f21eeadc743581c83dff7abb0d6e32cd643843627c2306", + "epac_boundary_probe_completeness.py": "8dad10b3ac9d3873f134af131488463511b8e66ecefc7fdb82609e92fa328eb9", + "epac_boundary_quotient.py": "91a966c68d65938a9e2641a10b8b2935fe1992fdc70f129b9424290b38b3ab98", + "epac_comparison.py": "7283c099923310f8dae24d577505b54c25919290b358be2aefa5fde1b8285535", + "epac_cross_scale_closure.py": "9cf3a0c76e17076217dd0c90f467d45a2aa0647754a031f6f826dc3f3a9e9e2c", + "epac_data/__init__.py": "7ea12c7477b04457888ca5d8cdc5c322b26af0c14959878dd2d00df0aa3619d3", + "epac_data/periodic_table_z1_18.json": "748de9e986eaaa588092796d00d8e5d464c14d6308673402b4f6ac98ca81df19", + "epac_data/sealed_known_molecular_geometry.json": "8e8e8382a86bdeeb7720a14f6370e0b8c142729e2092f58a97ba8108fd4ef7d3", + "epac_data/ucns-source-lock.json": "5f072d8c900ab0912fe35b2d2d6480ce09b14f280cb98e394ced13c130a145f3", + "epac_dimensional_arity.py": "5ed353191c853aaeecb62ba520ce89010682949053c8d6a04315531ec3c7429c", + "epac_evidence_cache.py": "927ac252d608e4af0b1a90e8686e764851de2ff71b674a0d56265ecf0422381a", + "epac_molecular.py": "0fce13c83ea65a21ad81acd206927dedbaae336d7d980bd1dbd0858f58537108", + "epac_periodic.py": "20474c25aaad15121efc2010227071bd31d1304080dfe45f2aa1115edb95d332", + "epac_public_gonol.py": "1a088076a19aba34a281ba1b3c25f47dee962a0aa8e61915bfe44e7b94357697", + "epac_subatomic/__init__.py": "492711dba97ef160f14772b71fb75bda0abb5b0828b21ab989a06e84ccaae4b8", + "epac_subatomic/element_affixiation_candidate.py": "3a282b1911657f7482dc08023b76e206f96210b90685f0caad4ecc689406b004", + "epac_subatomic/extended_atomic.py": "7818c546c95d8f8ca7699e4c2133520f3ffef1e48b26accd978decf1fa2c6302", + "epac_subatomic/nuclear_harmonic_candidates.py": "90f6c4ce1b8c1caf0d9c5605c65b2100a63089a1563858d6e91fee01721fdef6", + "epac_subatomic/receipts/c.json": "f957a829d9c246521113b435fff57f9f96f7171675bf28e27c1cdce78999ea30", + "epac_subatomic/receipts/gonol_c.json": "ec5c8d7121388405f0fa15c4a0ddb0879d3ae1cfd653faa9ac446553ae4e88a1", + "epac_subatomic/receipts/gonol_h.json": "864cf67e78e69a6c5255941e67c99bbfccab155b2fa5b5a01370852a3cfb2194", + "epac_subatomic/receipts/gonol_he.json": "46493d333082c3bff3fe551b235ef1b8d70be6601af7d6703fb1c2a90fda9d14", + "epac_subatomic/receipts/gonol_li.json": "3090fbf140c01672b0f19e86b62a7189c283c778b39b6c8d4d7a07cb14b121d2", + "epac_subatomic/receipts/h.json": "0fbeb009859592a18d14e0d44539637306ef6a9b14b54c7b55027fd2ea2b659b", + "epac_subatomic/receipts/harmonic_alpha_cluster_recurrence.json": "d45969aa486d1b49a23840940a76338f943a946a8524b284bb6359fa4c300de1", + "epac_subatomic/receipts/harmonic_binding_per_nucleon_commensurability.json": "5fd72fac99ea3f66218e97cbcbee9907d990375c0808022b3b517ee136932e31", + "epac_subatomic/receipts/harmonic_ground_state_spin_parity_symmetry.json": "9095ff2a16d1ccfb0b6bbc79eb46702abdafa08113b62a709c878ec3a2a4fe8f", + "epac_subatomic/receipts/harmonic_n_z_ratio_commensurability.json": "fa364116c0d4ceab3403a422e6c62bdcff2dc7c2375329add73cdb5d1dca683c", + "epac_subatomic/receipts/harmonic_proton_neutron_inversion_symmetry.json": "1505af798120449ad64e0cc4352afeebf0f4d2ca1e3e680f9651e4e0163e6a4a", + "epac_subatomic/receipts/he.json": "761d160209318acca3773bd1669dbc8eb4587e141926dc45684aea38f60d7c5c", + "epac_subatomic/receipts/history/harmonic_binding_per_nucleon_commensurability-ba93ccda9da20f9184d5db87c0d83c3b610bd48699a6c4886c790e89651f3e33.json": "f167754001eb500261198914eb6f66b0af151b59ca5d6fcc1a1ee7ff2182deca", + "epac_subatomic/receipts/history/harmonic_ground_state_spin_parity_symmetry-25ed793cb1584a38c0d2185451e389068b0622990054729efb7b3e178bf31680.json": "cde788f5eccbede6c6edb63505ea11687729647c848a11b5f1d25e72896c33ee", + "epac_subatomic/receipts/history/harmonic_ground_state_spin_parity_symmetry-packaged-7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f.json": "7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f", + "epac_subatomic/receipts/li.json": "a407cf2345037a0ca9c064eaea266a886de927044a65b4dd03c4f9dfea55c8a0", + "epac_subatomic/receipts/ucns-6eea182/c.json": "1ac20a133db5b964f3206215c54b744034c0bea212726e0dc182336bc81abe33", + "epac_subatomic/receipts/ucns-6eea182/h.json": "b9dd3b0d026b79d3575b915f1ad036a8e2229e170624bde0cacea454149c21c3", + "epac_subatomic/receipts/ucns-6eea182/he.json": "c8a95b058c996637dfa7e7b9ed2a8a775518aa8966aa7d22b79780fee1d182f5", + "epac_subatomic/receipts/ucns-6eea182/li.json": "5570921a4af22c10dba76c2a67fa70f884cf9ccee64db811bfecc79773cc6a86", + "epac_subatomic/receipts/ucns-828c0b8/c.json": "c486a418c2fd020e72bd16ef8b107feaabc854950d32c6deeb65176ae76c5b91", + "epac_subatomic/receipts/ucns-828c0b8/h.json": "0104494752c1f72eb7629defb25db6ff4687767fc038e90c3ac2054c94cb251e", + "epac_subatomic/receipts/ucns-828c0b8/he.json": "4273b4345464dc121f46523b67167688b537b946bcb15a9206cb10460a19cff1", + "epac_subatomic/receipts/ucns-828c0b8/li.json": "e41c5214327f2ddb76e0aa2d7cf15f4255530522bf5ba8879ddc933b3182fdf8", + "epac_subatomic/receipts/ucns-be42dfc/c.json": "1da011a700b4b2c518ee1bf497acc1cc691fecf8b379ad833202cb7cdd11e23f", + "epac_subatomic/receipts/ucns-be42dfc/h.json": "4e36f5c883d23d96ae800e1e32ad91af45979df1a193b516c78b93a4e3affa8b", + "epac_subatomic/receipts/ucns-be42dfc/he.json": "7230fbf210e5c78ae8bba5ebbff8557b7a5664841824d6aacdf106c5240895dd", + "epac_subatomic/receipts/ucns-be42dfc/li.json": "fc96542cbc11901fcbbea155e2ce463bcfbf610a4ae7aff0225cc5f2afc60437", + "epac_subatomic/subatomic-affixiation-baseline.md": "a7e4e5d44c149fa60bf03ae34cf4eb2a5178ca0f41361d4736e43798ae5e8a19", + "epac_subatomic/subatomic_gonol.py": "3e97f3406eb3406aeb8fa30ec33778226fbc1ab9d2b368f60c2df0a9b0865cda", + "epac_subatomic/symbol_coupling.py": "dbd2cc072291f31798c5db6bd4935f80218135c2a4da5c33776cfb0f6cc285b2", + "epac_ucns_provenance.py": "3ce5de529af6642427df146f3e1721be75ef82d552b824691652ee90cba205e5", + "epac_viz/README.md": "f4a880fcc32a0f750ceec7fe589b48905df6c46ebb4aa6fee6287cb1cc583fbd", + "epac_viz/__init__.py": "6c6dea83d6381b5ee7beebc66592d60831d6df791ad05e3335318e6adc479c0a", + "epac_viz/__main__.py": "5d34e27b2bef8c2cf52fd2f419a424c530d5c0a1f422b3f0339bf2727d0c6495", + "epac_viz/carbon_lifted_spiral.svg": "c96e9249b0f33ba09336ccc94e93fa47a89c687b6b15316a7272b4b31698880a", + "epac_viz/cli.py": "85018412bf5d4b7c3e2d0f9a85b3bd64bdc09ec2b6b74ce4492f0e5c7b0adb0e", + "epac_viz/h2o_lifted_spiral.svg": "c3e651ed0ff231bc75fe9d021abdacd504f1bc171cc4b6447204c23d72189d99", + "epac_viz/spiral_viz.py": "b7bb06a4160d09e7461fd10dc60d7c2ba2fe3b3b6b233a7da20b27c6322a62a9" + }, + "molecular_receipts": { + "BF3": "729762cea3a9589e525ea3049e9588b4f7288434418da02a8f8c25f41dc56ac9", + "CH4": "3624369d468d7b16b5b3c807cdd3bbccbe588e61fc13d8ba7dfad7cb846c219b", + "CO2": "90af93faedaf75e285b07506a272ee58029ae646206b63dcd0f5794d962a1528", + "H2": "d5b616799c9e56135bc82b016f4534a1e20edd79dd0ed581bca92b20331ca3e3", + "H2O": "cfac71635e0c49ff842bf04d2719bf1f051106ec5fb3d5ffbd922c8c7c08aaaa", + "H2S": "0fb222c67c6cee19d4748d0e1cb4d68d6850ab42ee32818b319f574f89d48ade", + "NH3": "2a1c12a6bf4fcf844e2e860df4b4db244c1aac77478002c86fbf2e4ff52abb2c", + "PH3": "f5790091f5c98cbaff41a5d8fbaafaa804cee94966073e183b94544d0b4ba2e3", + "SiH4": "679a1be1f05d9a28e6880d68085ed1b74ee1267892d30aac7321068f071a566c" + }, + "phase": "reconsumed", + "public_gonol_receipt": "731e6278b5cc663cc76429f655b21c84c06dfbe8249bda95df25ae0343ccb1ff", + "python": "3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]", + "schema": "stack.epac-artifact-consumption", + "source_commit": "e9454b1de8602c8dba8bc968d809fe3238655a0d", + "source_tree": "2ab442701c5ab3fb67462fb7d01bb853ecc11e07", + "source_unchanged": true, + "status": "passed", + "ucns_source_commit": "6eea1828a34ed8ec99879f8090ea5d48352d8c2d", + "verifier_sha256": "c233076a65968d80cae697eb04fcd8d34b2ae0233d3f3da75aa34032d182f6b2", + "version": 1 +} diff --git a/integration/epac/reconsume.py b/integration/epac/reconsume.py index a148468..4b89546 100644 --- a/integration/epac/reconsume.py +++ b/integration/epac/reconsume.py @@ -35,6 +35,7 @@ import hashlib import json +import os from pathlib import Path import subprocess import sys @@ -46,6 +47,10 @@ def main() -> None: lock_path, output = (Path(argument).resolve() for argument in sys.argv[1:3]) runtime = sys.argv[3] + child_env = {key: value for key, value in os.environ.items() + if key not in {"PYTHONPATH", "PYTHONHOME", "PYTEST_ADDOPTS", "PYTEST_PLUGINS"}} + child_env["PYTHONDONTWRITEBYTECODE"] = "1" + child_env["PYTHONNOUSERSITE"] = "1" stack = Path(__file__).resolve().parents[2] if output.exists() or output.is_relative_to(stack): raise ValueError("output must be new and outside stack") @@ -89,13 +94,13 @@ def main() -> None: raise ValueError("source archive root mismatch") source_root = roots[0] requirements = output / "dependencies.txt" - subprocess.run(["uv", "export", "--project", str(source_root), "--locked", "--no-emit-project", "--no-dev", "--format", "requirements.txt", "--output-file", str(requirements)], check=True) + subprocess.run(["uv", "export", "--project", str(source_root), "--locked", "--no-emit-project", "--no-dev", "--format", "requirements.txt", "--output-file", str(requirements)], check=True, env=child_env) environment = output / "venv" - subprocess.run(["uv", "venv", "--python", runtime, str(environment)], check=True) + subprocess.run(["uv", "venv", "--python", runtime, str(environment)], check=True, env=child_env) python = str(environment / "bin/python") - subprocess.run(["uv", "pip", "sync", "--python", python, "--require-hashes", str(requirements)], check=True) - subprocess.run(["uv", "pip", "install", "--python", python, "--no-deps", str(wheels[0])], check=True) - subprocess.run([python, str(stack / "integration/epac/verify_release.py"), str(wheels[0]), str(output / "consumption.json"), "--phase", lock["phase"]], check=True, cwd=output) + subprocess.run(["uv", "pip", "sync", "--python", python, "--require-hashes", str(requirements)], check=True, env=child_env) + subprocess.run(["uv", "pip", "install", "--python", python, "--no-deps", str(wheels[0])], check=True, env=child_env) + subprocess.run([python, str(stack / "integration/epac/verify_release.py"), str(wheels[0]), str(output / "consumption.json"), "--phase", lock["phase"]], check=True, cwd=output, env=child_env) (output / "release-lock.json").write_bytes(lock_path.read_bytes()) diff --git a/integration/epac/release-lock.json b/integration/epac/release-lock.json new file mode 100644 index 0000000..bd3dd34 --- /dev/null +++ b/integration/epac/release-lock.json @@ -0,0 +1,25 @@ +{ + "assets": { + "SHA256SUMS": { + "sha256": "c432e50b60a861992d36a89b3ceb5e4720a0d79f5da8f04a65c0b88dcd61618a", + "url": "https://github.com/The-Interdependency/epac/releases/download/v0.1.0/SHA256SUMS" + }, + "interdependency_epac-0.1.0-py3-none-any.whl": { + "sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "url": "https://github.com/The-Interdependency/epac/releases/download/v0.1.0/interdependency_epac-0.1.0-py3-none-any.whl" + }, + "interdependency_epac-0.1.0.tar.gz": { + "sha256": "fb31e05b55f5cf3bae76e2bd70332507cca1051e71b58bb49f25bae136853460", + "url": "https://github.com/The-Interdependency/epac/releases/download/v0.1.0/interdependency_epac-0.1.0.tar.gz" + }, + "release-manifest.json": { + "sha256": "caa7ef6103651786efd7c092421a7a9fd7daf535bc839d3e8dcb20ffa806c89e", + "url": "https://github.com/The-Interdependency/epac/releases/download/v0.1.0/release-manifest.json" + } + }, + "phase": "graduated", + "release_tag": "v0.1.0", + "schema": "stack.epac-public-release-lock", + "source_commit": "949cb1cb304927942966c9fb396caf6227120e7f", + "version": 1 +} diff --git a/research/epac/BASE.json b/research/epac/BASE.json new file mode 100644 index 0000000..eb512d6 --- /dev/null +++ b/research/epac/BASE.json @@ -0,0 +1,18 @@ +{ + "authority": "historical forge evidence only; active EPAC implementation resides in The-Interdependency/epac", + "authority_transfer": false, + "canon_path": null, + "note": "This BASE binds the retained historical documents and receipts to their actual Stack origin. It does not rebase them to the newer EPAC release. The scoped transition is recorded separately.", + "project": "epac", + "schema": "the-interdependency.stack-research-base", + "source_commit": "0e8384bbb60e4c2189016a212bdd0030d04aed7d", + "source_path": "research/epac/", + "source_repository": "The-Interdependency/stack", + "standing": "historical-forge-evidence", + "successor": { + "release_tag": "v0.1.0", + "repository": "The-Interdependency/epac", + "source_commit": "949cb1cb304927942966c9fb396caf6227120e7f" + }, + "version": "1.0.0" +} diff --git a/research/epac/README.forge-history.md b/research/epac/README.forge-history.md new file mode 100644 index 0000000..9e4e61d --- /dev/null +++ b/research/epac/README.forge-history.md @@ -0,0 +1,98 @@ +# EPAC forge workspace + +EPAC now exists independently at `The-Interdependency/epac`. + +This directory is the **stack forge candidate** from which the independent repository was extracted. It remains noncanonical stack-local research until the graduation sequence is complete. Do not treat continued work here as authority over the independent repository, and do not populate `libs/epac/` merely because extraction occurred. + +`EPAC` is the stable project handle; historical expansions are provenance, not a fixed canonical expansion. + +## Transition standing + +- independent extracted repository: `The-Interdependency/epac@d8868858b2e455381ce670797bdbe47189bdc496` +- extraction source: `The-Interdependency/stack@ef51f2e8f32ccfd5394525dad72475a61a505bc1:research/epac/` +- implementation/public-contract authority transfer: incomplete +- independent tests: passed in EPAC +- clean build/install: unresolved/failed as a graduation gate +- license/distribution rights: unresolved +- immutable release: `hmmm` +- downstream stack reconsumption: `hmmm` +- molecular-shape prediction: **FALSIFIED** and preserved + +## Current content + +- [`subatomic/subatomic-affixiation-baseline.md`](subatomic/subatomic-affixiation-baseline.md) — historical/provisional subatomic research record. +- [`epac_public_gonol.py`](epac_public_gonol.py) — EPAC Public Gonol constructor on the UCNS carrier; not the EDCM text-domain constructor. +- [`docs/arity.md`](docs/arity.md) — provisional dimensional-arity construction. +- [`docs/preregistration-molecular-geometry-from-element-gonols.md`](docs/preregistration-molecular-geometry-from-element-gonols.md) — frozen preregistration and falsification boundary. +- [`docs/boundary_capacity_principle.md`](docs/boundary_capacity_principle.md) — internal boundary-capacity result for the current molecule construction. +- [`docs/cross_scale_compositional_closure.md`](docs/cross_scale_compositional_closure.md) — bounded closure audit for the implemented subatomic -> element -> molecule stack across the locked nine formulas: H2, H2O, NH3, CH4, CO2, H2S, BF3, PH3, and SiH4. +- [`docs/boundary_descriptor_nondegeneracy.md`](docs/boundary_descriptor_nondegeneracy.md) — bounded first-order control audit showing the current boundary descriptor is label/order invariant, path invariant over implemented equivalent paths, and sensitive to declared boundary dimension and coupling-count changes without claiming complete incidence-topology sufficiency. +- [`docs/boundary_capacity_quotient.md`](docs/boundary_capacity_quotient.md) — quotient audit showing equality of `B=(3,d_boundary,c_boundary)` matches equality of the presently observable boundary-capacity probe behavior while preserving the falsification of `B` as a complete state descriptor. +- [`docs/boundary_probe_completeness.md`](docs/boundary_probe_completeness.md) — probe-inventory audit showing the quotient probe set is incomplete for the full presently declared EPAC boundary-relevant operation surface because existing coupling-structure observers refine the 16-class B quotient. +- [`docs/boundary_minimal_refinement.md`](docs/boundary_minimal_refinement.md) — minimal-refinement audit showing that one existing structural observable is enough to reproduce the 21-class partition, but the singleton minimum is not unique and no canonical compositional descriptor component is promoted. + +## Usage + +From this directory: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 -m unittest discover -s tests -q +``` + +Do not open `data/sealed_known_molecular_geometry.json` during construction. After construction: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' +from epac_comparison import compare_after_construction +print(compare_after_construction()["standings"]) +PY +``` + +Cross-scale closure report: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' +from epac_cross_scale_closure import cross_scale_compositional_closure +print(cross_scale_compositional_closure()["statuses"]) +PY +``` + +Boundary-descriptor non-degeneracy report: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' +from epac_boundary_nondegeneracy import boundary_descriptor_nondegeneracy_report +print(boundary_descriptor_nondegeneracy_report()["statuses"]) +PY +``` + +Boundary-capacity quotient report: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' +from epac_boundary_quotient import boundary_capacity_quotient_report +print(boundary_capacity_quotient_report()["statuses"]) +PY +``` + +Boundary-probe completeness report: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' +from epac_boundary_probe_completeness import boundary_probe_completeness_report +print(boundary_probe_completeness_report()["statuses"]) +PY +``` + +Boundary minimal-refinement report: + +```bash +PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' +from epac_boundary_minimal_refinement import boundary_minimal_refinement_report +print(boundary_minimal_refinement_report()["statuses"]) +PY +``` + +## hmmm + +This forge workspace remains live only as the pre-graduation research side of the transition. The exact handoff point is the eventual verified release + downstream reconsumption + authority-transition receipt, not repository creation alone. diff --git a/research/epac/README.md b/research/epac/README.md index 9e4e61d..32c2d25 100644 --- a/research/epac/README.md +++ b/research/epac/README.md @@ -1,98 +1,31 @@ -# EPAC forge workspace +# EPAC historical forge evidence -EPAC now exists independently at `The-Interdependency/epac`. +The active implementation is owned by [The-Interdependency/epac](https://github.com/The-Interdependency/epac). +Stack has reconsumed its immutable MPL-2.0 `v0.1.0` release and retired the 37 +forge Python implementation/test files. Final transition evidence is recorded +under [`integration/epac/`](../../integration/epac/). -This directory is the **stack forge candidate** from which the independent repository was extracted. It remains noncanonical stack-local research until the graduation sequence is complete. Do not treat continued work here as authority over the independent repository, and do not populate `libs/epac/` merely because extraction occurred. +This directory preserves historical documents, data, SVGs and receipts from +Stack `0e8384bbb60e4c2189016a212bdd0030d04aed7d`. [`BASE.json`](BASE.json) +binds that origin; it does not claim the historical findings describe today's +EPAC implementation. [`README.forge-history.md`](README.forge-history.md) preserves +the former instructions as history. Its local import commands are retired. -`EPAC` is the stable project handle; historical expansions are provenance, not a fixed canonical expansion. +## Usage guidance -## Transition standing - -- independent extracted repository: `The-Interdependency/epac@d8868858b2e455381ce670797bdbe47189bdc496` -- extraction source: `The-Interdependency/stack@ef51f2e8f32ccfd5394525dad72475a61a505bc1:research/epac/` -- implementation/public-contract authority transfer: incomplete -- independent tests: passed in EPAC -- clean build/install: unresolved/failed as a graduation gate -- license/distribution rights: unresolved -- immutable release: `hmmm` -- downstream stack reconsumption: `hmmm` -- molecular-shape prediction: **FALSIFIED** and preserved - -## Current content - -- [`subatomic/subatomic-affixiation-baseline.md`](subatomic/subatomic-affixiation-baseline.md) — historical/provisional subatomic research record. -- [`epac_public_gonol.py`](epac_public_gonol.py) — EPAC Public Gonol constructor on the UCNS carrier; not the EDCM text-domain constructor. -- [`docs/arity.md`](docs/arity.md) — provisional dimensional-arity construction. -- [`docs/preregistration-molecular-geometry-from-element-gonols.md`](docs/preregistration-molecular-geometry-from-element-gonols.md) — frozen preregistration and falsification boundary. -- [`docs/boundary_capacity_principle.md`](docs/boundary_capacity_principle.md) — internal boundary-capacity result for the current molecule construction. -- [`docs/cross_scale_compositional_closure.md`](docs/cross_scale_compositional_closure.md) — bounded closure audit for the implemented subatomic -> element -> molecule stack across the locked nine formulas: H2, H2O, NH3, CH4, CO2, H2S, BF3, PH3, and SiH4. -- [`docs/boundary_descriptor_nondegeneracy.md`](docs/boundary_descriptor_nondegeneracy.md) — bounded first-order control audit showing the current boundary descriptor is label/order invariant, path invariant over implemented equivalent paths, and sensitive to declared boundary dimension and coupling-count changes without claiming complete incidence-topology sufficiency. -- [`docs/boundary_capacity_quotient.md`](docs/boundary_capacity_quotient.md) — quotient audit showing equality of `B=(3,d_boundary,c_boundary)` matches equality of the presently observable boundary-capacity probe behavior while preserving the falsification of `B` as a complete state descriptor. -- [`docs/boundary_probe_completeness.md`](docs/boundary_probe_completeness.md) — probe-inventory audit showing the quotient probe set is incomplete for the full presently declared EPAC boundary-relevant operation surface because existing coupling-structure observers refine the 16-class B quotient. -- [`docs/boundary_minimal_refinement.md`](docs/boundary_minimal_refinement.md) — minimal-refinement audit showing that one existing structural observable is enough to reproduce the 21-class partition, but the singleton minimum is not unique and no canonical compositional descriptor component is promoted. - -## Usage - -From this directory: - -```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 -m unittest discover -s tests -q -``` - -Do not open `data/sealed_known_molecular_geometry.json` during construction. After construction: - -```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' -from epac_comparison import compare_after_construction -print(compare_after_construction()["standings"]) -PY -``` - -Cross-scale closure report: - -```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' -from epac_cross_scale_closure import cross_scale_compositional_closure -print(cross_scale_compositional_closure()["statuses"]) -PY -``` - -Boundary-descriptor non-degeneracy report: - -```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' -from epac_boundary_nondegeneracy import boundary_descriptor_nondegeneracy_report -print(boundary_descriptor_nondegeneracy_report()["statuses"]) -PY -``` - -Boundary-capacity quotient report: +Run the supported release consumer from the Stack root: ```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' -from epac_boundary_quotient import boundary_capacity_quotient_report -print(boundary_capacity_quotient_report()["statuses"]) -PY +python3 integration/epac/reconsume.py \ + integration/epac/release-lock.json /tmp/epac-public-consumption python3.12 ``` -Boundary-probe completeness report: - -```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' -from epac_boundary_probe_completeness import boundary_probe_completeness_report -print(boundary_probe_completeness_report()["statuses"]) -PY -``` - -Boundary minimal-refinement report: - -```bash -PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 - <<'PY' -from epac_boundary_minimal_refinement import boundary_minimal_refinement_report -print(boundary_minimal_refinement_report()["statuses"]) -PY -``` +Use a new output directory outside Stack. Make EPAC implementation changes in +the independent repository. Consult the pinned public release's own documents +and tests for current behavior; retained research here is historical evidence. ## hmmm -This forge workspace remains live only as the pre-graduation research side of the transition. The exact handoff point is the eventual verified release + downstream reconsumption + authority-transition receipt, not repository creation alone. +The release preserves all 14 FALSIFIED comparison standings. Geometry ratification, +canonical compositional descriptors, and unmeasured operation effects remain +unresolved. Packaging and implementation ownership confer no scientific standing. diff --git a/research/epac/epac_atomic.py b/research/epac/epac_atomic.py deleted file mode 100644 index 8bcbd06..0000000 --- a/research/epac/epac_atomic.py +++ /dev/null @@ -1,285 +0,0 @@ -"""Atomic and subatomic structure used by element gonols. - -Nothing here is molecular. Electrons are filled by Aufbau, Pauli, and Hund. -Angular identities are hydrogenic spherical harmonics labeled by (n, l, m_l). -Screening is Slater's atomic Z_eff. Energies are hydrogenic Rydberg units -with that Z_eff. Nucleus instances are default isotopes, identity only. - -Do not import the sealed molecular comparison file from this module. -""" - -from __future__ import annotations - -from dataclasses import dataclass -from typing import Iterator - - -SUBSHELL_ORDER: tuple[tuple[int, int], ...] = ( - (1, 0), - (2, 0), - (2, 1), - (3, 0), - (3, 1), -) - -ISOTOPE_DEFAULTS: dict[int, int] = { - 1: 1, - 2: 4, - 3: 7, - 4: 9, - 5: 11, - 6: 12, - 7: 14, - 8: 16, - 9: 19, - 10: 20, - 11: 23, - 12: 24, - 13: 27, - 14: 28, - 15: 31, - 16: 32, - 17: 35, - 18: 40, -} - -SYMBOLS: tuple[str, ...] = ( - "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", - "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", -) - - -@dataclass(frozen=True, slots=True) -class ElectronState: - """One electron in an atom: quantum numbers plus atomic wave labels.""" - - index: int - n: int - l: int - m_l: int - m_s: int - shell: str - subshell: str - angular_id: str - radial_nodes: int - z_eff: str - e_rydberg: str - valence: bool - paired: bool - - -@dataclass(frozen=True, slots=True) -class AtomicRecord: - Z: int - symbol: str - period: int - group: int - A: int - proton_count: int - neutron_count: int - electrons: tuple[ElectronState, ...] - configuration: str - valence_n: int - valence_electrons: int - unpaired_valence: tuple[ElectronState, ...] - promoted_unpaired_valence: tuple[ElectronState, ...] - - -def _period_group(Z: int) -> tuple[int, int]: - if Z == 1: - return 1, 1 - if Z == 2: - return 1, 18 - if Z <= 4: - return 2, Z - 2 - if Z <= 10: - return 2, Z + 8 - if Z <= 12: - return 3, Z - 10 - return 3, Z - - -def _ml_down(l: int) -> tuple[int, ...]: - return tuple(range(l, -l - 1, -1)) - - -def _subshell_name(n: int, l: int) -> str: - return f"{n}{'spdf'[l]}" - - -def _angular_id(l: int, m_l: int) -> str: - return f"Y_l{l}_m{m_l}" - - -def _slater_zeff(Z: int, n: int, l: int, occupied: tuple[tuple[int, int], ...]) -> float: - """Slater screening for one electron in subshell (n, l).""" - - others = list(occupied) - others.remove((n, l)) - sigma = 0.0 - same_group = 0 - for on, ol in others: - if n == 1 and l == 0: - if on == 1 and ol == 0: - sigma += 0.30 - continue - if on == n and ((l in {0, 1} and ol in {0, 1}) or ol == l): - same_group += 1 - elif on == n - 1: - sigma += 0.85 - elif on <= n - 2: - sigma += 1.00 - sigma += 0.35 * same_group - return round(Z - sigma, 3) - - -def _fill_electrons(Z: int) -> tuple[ElectronState, ...]: - remaining = Z - occupied_pairs: list[tuple[int, int]] = [] - raw: list[tuple[int, int, int, int]] = [] - for n, l in SUBSHELL_ORDER: - capacity = 2 * (2 * l + 1) - take = min(remaining, capacity) - slots = [(m_l, 1) for m_l in _ml_down(l)] + [(m_l, -1) for m_l in _ml_down(l)] - for m_l, m_s in slots[:take]: - raw.append((n, l, m_l, m_s)) - occupied_pairs.append((n, l)) - remaining -= take - if remaining == 0: - break - valence_n = max(n for n, _l, _ml, _ms in raw) - occupied = tuple(occupied_pairs) - electrons: list[ElectronState] = [] - occupancy: dict[tuple[int, int, int], int] = {} - for n, l, m_l, m_s in raw: - occupancy[(n, l, m_l)] = occupancy.get((n, l, m_l), 0) + 1 - seen: dict[tuple[int, int, int], int] = {} - for index, (n, l, m_l, m_s) in enumerate(raw): - seen[(n, l, m_l)] = seen.get((n, l, m_l), 0) + 1 - z_eff = _slater_zeff(Z, n, l, occupied) - energy = round(-(z_eff ** 2) / (n ** 2), 6) - electrons.append( - ElectronState( - index=index, - n=n, - l=l, - m_l=m_l, - m_s=m_s, - shell=f"n{n}", - subshell=_subshell_name(n, l), - angular_id=_angular_id(l, m_l), - radial_nodes=n - l - 1, - z_eff=str(z_eff), - e_rydberg=str(energy), - valence=(n == valence_n), - paired=occupancy[(n, l, m_l)] == 2, - ) - ) - return tuple(electrons) - - -def _configuration(electrons: tuple[ElectronState, ...]) -> str: - counts: dict[str, int] = {} - order: list[str] = [] - for electron in electrons: - name = electron.subshell - if name not in counts: - order.append(name) - counts[name] = 0 - counts[name] += 1 - return ".".join(f"{name}{counts[name]}" for name in order) - - -def _unpaired_valence(electrons: tuple[ElectronState, ...]) -> tuple[ElectronState, ...]: - return tuple(e for e in electrons if e.valence and not e.paired and e.m_s == 1) - - -def _promoted_unpaired(electrons: tuple[ElectronState, ...]) -> tuple[ElectronState, ...]: - """Atomic valence promotion: move valence s pair into empty valence p to unpair. - - This is an atomic excited configuration (same n). It is not a molecular hybrid. - """ - - unpaired = list(_unpaired_valence(electrons)) - valence = [e for e in electrons if e.valence] - valence_n = valence[0].n if valence else 1 - if valence_n < 2: - return tuple(unpaired) - p_occupied_m = {e.m_l for e in valence if e.l == 1} - empty_p_m = [m for m in _ml_down(1) if m not in p_occupied_m] - s_pairs_by_orbital: dict[tuple[int, int, int], list[ElectronState]] = {} - for electron in valence: - if electron.l == 0 and electron.paired: - s_pairs_by_orbital.setdefault((electron.n, electron.l, electron.m_l), []).append(electron) - s_pair = next((pair for pair in s_pairs_by_orbital.values() if len(pair) == 2), None) - if s_pair is None or not empty_p_m: - return tuple(unpaired) - # Promote the spin-down valence s electron into the first empty valence p - # and flip it to spin-up. The spin-up s electron stays behind, so every - # promoted unpaired electron carries m_s = +1, matching the ground-state - # unpaired convention used by _unpaired_valence. - promoted_from_s = next((item for item in s_pair if item.m_s == -1), s_pair[0]) - remaining_s = next(item for item in s_pair if item.index != promoted_from_s.index) - new_p = ElectronState( - index=promoted_from_s.index, - n=valence_n, - l=1, - m_l=empty_p_m[0], - m_s=1, - shell=f"n{valence_n}", - subshell=_subshell_name(valence_n, 1), - angular_id=_angular_id(1, empty_p_m[0]), - radial_nodes=valence_n - 2, - z_eff=promoted_from_s.z_eff, - e_rydberg=promoted_from_s.e_rydberg, - valence=True, - paired=False, - ) - unpaired_s = ElectronState( - index=remaining_s.index, - n=remaining_s.n, - l=0, - m_l=remaining_s.m_l, - m_s=remaining_s.m_s, - shell=remaining_s.shell, - subshell=remaining_s.subshell, - angular_id=remaining_s.angular_id, - radial_nodes=remaining_s.radial_nodes, - z_eff=remaining_s.z_eff, - e_rydberg=remaining_s.e_rydberg, - valence=True, - paired=False, - ) - promoted = [unpaired_s, new_p, *[e for e in unpaired if e.l != 0]] - # Canonical subshell ordering: s before p, p orbitals by ascending m_l. - promoted.sort(key=lambda electron: (electron.l, electron.m_l)) - return tuple(promoted) - - -def atomic_record(Z: int) -> AtomicRecord: - if not 1 <= Z <= 18: - raise ValueError("this candidate table is Z=1-18") - electrons = _fill_electrons(Z) - valence_n = max(e.n for e in electrons) - period, group = _period_group(Z) - A = ISOTOPE_DEFAULTS[Z] - return AtomicRecord( - Z=Z, - symbol=SYMBOLS[Z - 1], - period=period, - group=group, - A=A, - proton_count=Z, - neutron_count=A - Z, - electrons=electrons, - configuration=_configuration(electrons), - valence_n=valence_n, - valence_electrons=sum(1 for e in electrons if e.valence), - unpaired_valence=_unpaired_valence(electrons), - promoted_unpaired_valence=_promoted_unpaired(electrons), - ) - - -def iter_table() -> Iterator[AtomicRecord]: - for Z in range(1, 19): - yield atomic_record(Z) diff --git a/research/epac/epac_boundary_minimal_refinement.py b/research/epac/epac_boundary_minimal_refinement.py deleted file mode 100644 index 1c96ced..0000000 --- a/research/epac/epac_boundary_minimal_refinement.py +++ /dev/null @@ -1,470 +0,0 @@ -"""Minimal-refinement search for the EPAC boundary descriptor. - -This module asks which smallest subset of the 13 existing omitted boundary -observables from the probe-completeness audit reproduces the full 21-class -partition. It does not add a descriptor component, operation, probe, coordinate, -PCEA bridge, UCNS claim, runtime encoding, or external physics assertion. - -The result is intentionally finite-surface evidence. Reproducing the 21-class -partition is not the same as proving that a candidate is the canonical next -descriptor component or that it composes through the cross-scale construction -stack. -""" - -from __future__ import annotations - -from functools import lru_cache -from itertools import combinations -from typing import Any, Mapping - -from epac_boundary_probe_completeness import ( - OMITTED_OBSERVABLES, - _classes_by_signature, - _state_contexts, - boundary_probe_completeness_report, -) -from epac_cross_scale_closure import BLOCKED, FALSIFIED, SURVIVED, UNRESOLVED - -# === MODULE_BUILD === -# id: epac_boundary_minimal_refinement -# module_name: epac_boundary_minimal_refinement -# module_kind: experiment -# summary: evidence-only search for the smallest existing omitted EPAC boundary observable subset that reproduces the 21-class partition exposed by the probe-completeness audit -# owner: The Interdependency -# public_surface: boundary_minimal_refinement_report -# internal_surface: _distinguishing_observable_names, _observable_outputs, _partition_for, _minimal_refinement_sets, _candidate_ledger -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: tests.test_boundary_minimal_refinement -# rollout: imported by tests/docs as a research evidence surface; no descriptor, constructor, quotient, or runtime behavior changes -# rollback: remove this module and its tests/docs without changing B, the probe-completeness audit, or locked molecule construction -# requires: epac_boundary_probe_completeness -# since: 2026-09-07 -# unresolved: canonical semantic preference among multiple singleton refinements; local aggregation law showing refined structural observables compose through subatomic to element to molecule -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: minimal_refinement_uses_only_existing_omitted_distinguishers -# given: the minimal-refinement audit is run -# then: candidate components are exactly the 13 existing omitted observables that the probe-completeness audit found distinguishing same-B frozen states -# class: safety -# -# id: minimal_refinement_searches_by_partition_equality -# given: a candidate observable subset is evaluated -# then: it is accepted only when B plus that subset reproduces the full 21-class partition induced by all 13 omitted observables, not merely the same class count -# class: correctness -# -# id: minimal_refinement_reports_all_minimum_sets -# given: one or more candidate subsets reproduce the full partition -# then: the audit reports the smallest subset size, every subset at that size, and whether the minimum is unique -# class: evidence -# -# id: minimal_refinement_classifies_boundary_semantics -# given: a minimal candidate set is reported -# then: each member is classified for intrinsic boundary semantics and for whether its normalized observable encodes state labels, ids, source names, or construction history -# class: safety -# -# id: minimal_refinement_keeps_B_unmodified -# given: the refinement search succeeds -# then: B remains the original three-component tuple and no refined descriptor is installed or promoted by the audit -# class: safety -# -# id: minimal_refinement_classifies_compositionality -# given: a minimal candidate reproduces the finite partition -# then: local reproducibility from existing state structure is reported separately from unresolved cross-scale compositional aggregation -# class: doctrine -# -# id: minimal_refinement_blocks_pcea_mapping -# given: canonicality or cross-scale compositionality is unresolved -# then: PCEA mapping remains BLOCKED in the report -# class: safety -# === END CONTRACTS === - - -RefinementSet = tuple[str, ...] -Partition = tuple[tuple[str, ...], ...] - -STRUCTURAL_SEMANTICS: Mapping[str, str] = { - "charged_structure_readout": ( - "declared oriented couplings, per-slot charge state, incidence degree, " - "participating boundary count, and ternary-coupling flag" - ), - "topology_structure_readout": ( - "declared coupling arities, incidence degree, participating boundary " - "count, and ternary-coupling flag with charges omitted" - ), - "quaternion_structure_readout": ( - "4-component representations of local 3-structures induced by declared " - "hub-first binary couplings" - ), - "geometry_from_declared_couplings": ( - "aggregate declared coupling geometry envelope after identity fields are " - "excluded" - ), - "structure_from_charged_couplings": ( - "combination of declared oriented couplings, arity charge states, degree, " - "and local quaternion representations" - ), - "degree_relations": ( - "boundary incidence degree and ordered slot-degree profile for " - "participating dimensions" - ), - "oriented_instance_couplings": ( - "declared hub-first instance coupling availability with arity and " - "charge-state shape" - ), - "local_three_structures": ( - "count and occurrence pattern of local 3-structures represented by " - "pairs of hub-first binary couplings" - ), - "quaternion_of_local_three": ( - "single local-3 quaternion representation semantics applied to every " - "declared local 3" - ), - "quaternions_from_declared_couplings": ( - "all local-3 quaternion representations derivable from declared " - "couplings" - ), - "has_declared_coupling": ( - "whether declared coupling structure exists, plus the boundary coupling " - "part count used by the existing observer" - ), - "instances_missing_oriented_hub_coupling": ( - "oriented hub-coupling availability for declared boundary instances" - ), - "require_every_instance_has_oriented_hub_coupling": ( - "fail-closed oriented hub-coupling availability for declared boundary " - "instances" - ), -} - - -def _canonical_partition(classes: Mapping[Any, tuple[str, ...]]) -> Partition: - return tuple(sorted(tuple(sorted(state_ids)) for state_ids in classes.values())) - - -def _contains_identifier_or_label(value: Any) -> bool: - if isinstance(value, str): - if value.startswith("epac.") or "#" in value: - return True - if value.startswith(("subatomic:", "element:", "molecule:")): - return True - return False - if isinstance(value, Mapping): - return any( - _contains_identifier_or_label(key) - or _contains_identifier_or_label(item) - for key, item in value.items() - ) - if isinstance(value, (tuple, list)): - return any(_contains_identifier_or_label(item) for item in value) - return False - - -def _contains_construction_history(value: Any) -> bool: - if isinstance(value, str): - lowered = value.lower() - return any( - marker in lowered - for marker in ( - "constructor", - "receipt", - "digest", - "source_id", - "formula", - "symbol", - "provenance", - ) - ) - if isinstance(value, Mapping): - return any( - _contains_construction_history(key) - or _contains_construction_history(item) - for key, item in value.items() - ) - if isinstance(value, (tuple, list)): - return any(_contains_construction_history(item) for item in value) - return False - - -@lru_cache(maxsize=1) -def _distinguishing_observable_names() -> RefinementSet: - report = boundary_probe_completeness_report() - distinguishing = { - operation.rsplit(".", 1)[-1] - for operation in report["omitted_distinguishing_operations"] - } - return tuple( - name for name in OMITTED_OBSERVABLES - if name in distinguishing - ) - - -@lru_cache(maxsize=1) -def _observable_outputs() -> dict[str, dict[str, Any]]: - contexts = _state_contexts() - names = _distinguishing_observable_names() - return { - name: { - state_id: OMITTED_OBSERVABLES[name](context) - for state_id, context in contexts.items() - } - for name in names - } - - -def _partition_for(names: RefinementSet) -> Partition: - contexts = _state_contexts() - states = {state_id: context["state"] for state_id, context in contexts.items()} - outputs = _observable_outputs() - signatures = { - state_id: ( - states[state_id].b, - tuple((name, outputs[name][state_id]) for name in names), - ) - for state_id in states - } - return _canonical_partition(_classes_by_signature(signatures)) - - -@lru_cache(maxsize=1) -def _full_refined_partition() -> Partition: - return _partition_for(_distinguishing_observable_names()) - - -@lru_cache(maxsize=1) -def _minimal_refinement_sets() -> tuple[RefinementSet, ...]: - names = _distinguishing_observable_names() - full_partition = _full_refined_partition() - for size in range(1, len(names) + 1): - matches = tuple( - combo for combo in combinations(names, size) - if _partition_for(combo) == full_partition - ) - if matches: - return matches - return () - - -def _candidate_output_is_clean(name: str) -> bool: - outputs = _observable_outputs()[name].values() - return not any( - _contains_identifier_or_label(output) - or _contains_construction_history(output) - for output in outputs - ) - - -def _locally_reproducible(name: str) -> bool: - contexts = _state_contexts() - outputs = _observable_outputs()[name] - return all( - outputs[state_id] == OMITTED_OBSERVABLES[name](context) - for state_id, context in contexts.items() - ) - - -def _candidate_ledger() -> tuple[dict[str, Any], ...]: - names = _distinguishing_observable_names() - minimal_sets = _minimal_refinement_sets() - minimal_members = {name for combo in minimal_sets for name in combo} - full_partition = _full_refined_partition() - outputs = _observable_outputs() - rows: list[dict[str, Any]] = [] - for name in names: - partition = _partition_for((name,)) - clean = _candidate_output_is_clean(name) - locally_reproducible = _locally_reproducible(name) - intrinsic = name in STRUCTURAL_SEMANTICS and clean - rows.append( - { - "operation_name": name, - "minimal_candidate": name in minimal_members, - "singleton_class_count": len(partition), - "singleton_reproduces_full_partition": partition == full_partition, - "intrinsic_boundary_semantics": intrinsic, - "semantic_basis": STRUCTURAL_SEMANTICS.get(name, "hmmm"), - "normalized_observable_excludes_labels_ids_and_history": clean, - "merely_encodes_construction_history_or_labels": not clean, - "local_reproducibility_status": ( - SURVIVED if locally_reproducible else FALSIFIED - ), - "cross_scale_compositionality_status": UNRESOLVED, - "cross_scale_compositionality_reason": ( - "the existing cross-scale closure derives B only; EPAC has " - "not declared a local aggregation law that carries this " - "structural observable from subatomic source through element " - "refinement and molecule affixiation" - ), - "example_outputs": tuple( - (state_id, outputs[name][state_id]) - for state_id in tuple(sorted(outputs[name]))[:3] - ), - } - ) - return tuple(rows) - - -@lru_cache(maxsize=1) -def boundary_minimal_refinement_report() -> dict[str, Any]: - """Search for the minimal existing-observable refinement of B.""" - completeness = boundary_probe_completeness_report() - names = _distinguishing_observable_names() - baseline_partition = _partition_for(()) - full_partition = _full_refined_partition() - completeness_partition = tuple( - sorted( - tuple(sorted(state_ids)) - for state_ids in completeness["combined_omitted_observable_effect"][ - "class_partition" - ] - ) - ) - minimal_sets = _minimal_refinement_sets() - candidate_rows = _candidate_ledger() - minimal_rows = tuple(row for row in candidate_rows if row["minimal_candidate"]) - - minimum_size = len(minimal_sets[0]) if minimal_sets else None - all_minimal_intrinsic = bool(minimal_rows) and all( - row["intrinsic_boundary_semantics"] for row in minimal_rows - ) - any_minimal_history_or_label = any( - row["merely_encodes_construction_history_or_labels"] - for row in minimal_rows - ) - all_minimal_locally_reproducible = bool(minimal_rows) and all( - row["local_reproducibility_status"] == SURVIVED - for row in minimal_rows - ) - refined_matches = bool(minimal_sets) and all( - _partition_for(combo) == full_partition for combo in minimal_sets - ) - full_partition_matches_completeness = full_partition == completeness_partition - - canonicality_status = ( - SURVIVED if len(minimal_sets) == 1 else UNRESOLVED - ) - compositionality_status = ( - UNRESOLVED - if all_minimal_locally_reproducible - else FALSIFIED - ) - finite_partition_sufficiency_status = ( - SURVIVED - if refined_matches - and len(full_partition) == 21 - and full_partition_matches_completeness - else FALSIFIED - ) - descriptor_sufficiency_status = ( - SURVIVED - if ( - finite_partition_sufficiency_status == SURVIVED - and canonicality_status == SURVIVED - and compositionality_status == SURVIVED - and not any_minimal_history_or_label - ) - else UNRESOLVED - ) - pcea_mapping_status = ( - BLOCKED if descriptor_sufficiency_status != SURVIVED else UNRESOLVED - ) - - statuses = { - "minimal_refinement_size": SURVIVED if minimum_size == 1 else FALSIFIED, - "all_minimal_equivalent_sets": SURVIVED if minimal_sets else FALSIFIED, - "intrinsic_boundary_semantics": ( - SURVIVED if all_minimal_intrinsic else FALSIFIED - ), - "history_or_label_encoding": ( - FALSIFIED if any_minimal_history_or_label else SURVIVED - ), - "canonicality": canonicality_status, - "compositionality": compositionality_status, - "refined_quotient_class_count": finite_partition_sufficiency_status, - "descriptor_sufficiency": descriptor_sufficiency_status, - "pcea_mapping": pcea_mapping_status, - } - - return { - "decision": ( - "UNRESOLVED: the finite 21-class partition has singleton " - "refinements, but the minimum is not unique and EPAC has not " - "declared a cross-scale aggregation law for promoting any structural " - "observable as a canonical descriptor component." - ), - "surface": { - "surface_id": completeness["surface"]["surface_id"], - "state_count": completeness["surface"]["state_count"], - "state_ids": completeness["surface"]["state_ids"], - }, - "scope": { - "candidate_source": "probe-completeness omitted distinguishing operations", - "candidate_observable_count": len(names), - "candidate_observables": names, - "uses_only_existing_omitted_distinguishers": len(names) == 13, - "B_descriptor_modified": False, - }, - "partitions": { - "baseline_B_class_count": len(baseline_partition), - "full_omitted_observable_class_count": len(full_partition), - "full_partition_matches_completeness_audit": full_partition_matches_completeness, - "refined_partition": full_partition, - }, - "minimal_refinement": { - "minimum_size": minimum_size, - "minimum_unique": len(minimal_sets) == 1, - "minimal_equivalent_sets": minimal_sets, - "minimal_set_count": len(minimal_sets), - "all_minimal_candidates_intrinsic": all_minimal_intrinsic, - "any_minimal_candidate_merely_history_or_label": any_minimal_history_or_label, - }, - "candidate_ledger": candidate_rows, - "canonicality": { - "status": canonicality_status, - "reason": ( - "minimum is not unique: multiple existing singleton structural " - "observables reproduce the same finite partition, and current " - "canon does not choose among charge/degree/oriented/quaternion/" - "aggregate-geometry views" - if canonicality_status == UNRESOLVED - else "minimum is unique" - ), - }, - "compositionality": { - "local_reproducibility_status": ( - SURVIVED if all_minimal_locally_reproducible else FALSIFIED - ), - "cross_scale_compositionality_status": compositionality_status, - "reason": ( - "minimal candidates are reproducible from each frozen state's " - "existing structure, but no declared local aggregation law yet " - "carries the chosen structural observable through subatomic to " - "element to molecule" - ), - }, - "descriptor_sufficiency": { - "finite_21_class_partition_reproduction": finite_partition_sufficiency_status, - "promotable_descriptor_sufficiency": descriptor_sufficiency_status, - "reason": ( - "finite partition reproduction survives; canonicality and " - "cross-scale compositionality remain unresolved" - ), - }, - "statuses": statuses, - "requires_more": ( - "select or justify a canonical semantic representative among the singleton refinements", - "declare and test a local aggregation rule if a structural observable is to become a refined descriptor component", - "do not add all omitted observables by default", - "do not modify B merely to rescue probe completeness", - "PCEA mapping remains blocked until canonicality and compositionality close", - ), - } - - -__all__ = [ - "boundary_minimal_refinement_report", -] diff --git a/research/epac/epac_boundary_nondegeneracy.py b/research/epac/epac_boundary_nondegeneracy.py deleted file mode 100644 index 50d8246..0000000 --- a/research/epac/epac_boundary_nondegeneracy.py +++ /dev/null @@ -1,787 +0,0 @@ -"""Boundary-descriptor non-degeneracy controls for EPAC. - -This module freezes the implemented EPAC construction surface, then builds a -bounded first-order counterfactual neighborhood around the frozen boundary -states. It tests whether B=(3, d_boundary, c_boundary) is invariant under -labels/order and sensitive to declared boundary dimension/coupling changes. - -The controls are descriptor-level evidence. They do not extend the descriptor, -modify molecule constructors, import PCEA, inspect UCNS internals, or claim -external physics/chemistry validation. -""" - -from __future__ import annotations - -from dataclasses import dataclass, replace -from functools import lru_cache -import json -from itertools import combinations -from typing import Any, Mapping - -from epac_cross_scale_closure import ( - FALSIFIED, - SURVIVED, - control_like_partition_failure_disposition, - cross_scale_compositional_closure, - element_closure_ledger, - formula_closure_ledger, - required_element_symbols, -) -from epac_molecular import ( - MOLECULE_COMPOSITIONS, - MolecularConstruction, - construct_declared_molecules, - construct_molecule, - lifted_spiral_carried_on_molecule, -) -from epac_periodic import construct_element_gonol, lifted_spiral_carried_on_element -from subatomic_gonol import construct_subatomic_gonol, lifted_spiral_carried_on_subatomic - -# === MODULE_BUILD === -# id: epac_boundary_descriptor_nondegeneracy -# module_name: epac_boundary_nondegeneracy -# module_kind: experiment -# summary: evidence-only non-degeneracy audit for EPAC B=(3,d_boundary,c_boundary) using frozen subatomic, element, and locked nine-formula molecule boundary states plus first-order controls -# owner: The Interdependency -# public_surface: freeze_current_construction_surface, build_counterfactual_neighborhood, boundary_descriptor_nondegeneracy_report -# internal_surface: BoundaryState, BoundaryMutation, _expected_b_after_operation, _apply_operation, _collision_search, _non_singleton_control_discrimination -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: tests.test_boundary_descriptor_nondegeneracy -# rollout: imported by tests/docs as a research evidence surface; no constructor, descriptor, or runtime behavior changes -# rollback: remove this module and its tests/docs without changing cross-scale closure or locked molecule construction -# requires: epac_cross_scale_compositional_closure -# since: 2026-09-07 -# unresolved: descriptor completeness for full incidence topology; external physical interpretation; future alternate construction paths -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: nondegeneracy_freezes_surface_before_controls -# given: the non-degeneracy audit is run -# then: current subatomic, element, and locked molecule boundary states are frozen before counterfactual controls are generated -# class: evidence -# -# id: boundary_descriptor_label_invariance -# given: participants are relabeled without changing boundary dimension or coupling count -# then: B remains identical for every frozen state -# class: correctness -# -# id: boundary_descriptor_equivalent_path_invariance -# given: every presently admissible equivalent path from the cross-scale closure audit -# then: B remains path-independent for element refinement and all locked formula constructions -# class: correctness -# -# id: boundary_descriptor_d_boundary_sensitivity -# given: legal first-order boundary axis addition, deletion, duplication, or hierarchy refinement perturbation -# then: d_boundary changes by the expected operation-derived amount while unrelated descriptor components stay fixed -# class: evidence -# -# id: boundary_descriptor_c_boundary_sensitivity -# given: legal first-order boundary coupling addition or deletion at fixed boundary dimensionality and bulk count -# then: c_boundary changes by the expected operation-derived amount, while incidence rewires with unchanged count remain coarse-equivalent -# class: evidence -# -# id: boundary_descriptor_non_singleton_control_discrimination -# given: non-singleton bulk-count control partitions and the singleton partition regression -# then: B splits at least one non-singleton bulk-count control group and the singleton resemblance remains classified as non-evidentiary -# class: regression -# -# id: boundary_descriptor_collision_search_classifies_collisions -# given: the bounded frozen and first-order control states -# then: every same-B collision is classified and no state pair that the declared controls require to be boundary-distinct receives the same B -# class: safety -# -# id: boundary_descriptor_audit_does_not_extend_B -# given: the non-degeneracy audit materializes frozen and counterfactual states -# then: B remains exactly the three-component tuple of interior mode count, boundary-axis count, and coupling-slot count -# class: safety -# === END CONTRACTS === - - -BoundaryCapacity = tuple[int, int, int] - - -@dataclass(frozen=True, slots=True) -class BoundaryState: - """Frozen or counterfactual EPAC boundary state.""" - - state_id: str - scale: str - source: str - role: str - interior_modes: int - boundary_axes: tuple[str, ...] - coupling_slots: tuple[str, ...] - bulk_count: int - labels: tuple[str, ...] - structure_signature: tuple[str, ...] - parent_id: str | None = None - mutation_id: str | None = None - - @property - def b(self) -> BoundaryCapacity: - return (self.interior_modes, len(self.boundary_axes), len(self.coupling_slots)) - - -@dataclass(frozen=True, slots=True) -class BoundaryMutation: - """One declared first-order control and its evaluated state.""" - - mutation_id: str - kind: str - parent_id: str - expected_relation: str - expected_b: BoundaryCapacity - actual_state: BoundaryState - requires_boundary_distinct_from_parent: bool - declared_before_evaluation: bool - status: str - - -def _slot_signature(slot: Mapping[str, Any]) -> str: - return json.dumps(slot, sort_keys=True, separators=(",", ":")) - - -def _state_record(state: BoundaryState) -> dict[str, Any]: - return { - "state_id": state.state_id, - "scale": state.scale, - "source": state.source, - "role": state.role, - "bulk_count": state.bulk_count, - "labels": state.labels, - "boundary_axes": state.boundary_axes, - "coupling_slots": state.coupling_slots, - "structure_signature": state.structure_signature, - "parent_id": state.parent_id, - "mutation_id": state.mutation_id, - "B": state.b, - } - - -def _mutation_record(mutation: BoundaryMutation) -> dict[str, Any]: - return { - "mutation_id": mutation.mutation_id, - "kind": mutation.kind, - "parent_id": mutation.parent_id, - "expected_relation": mutation.expected_relation, - "expected_b": mutation.expected_b, - "actual_b": mutation.actual_state.b, - "actual_state": _state_record(mutation.actual_state), - "requires_boundary_distinct_from_parent": mutation.requires_boundary_distinct_from_parent, - "declared_before_evaluation": mutation.declared_before_evaluation, - "status": mutation.status, - } - - -def _subatomic_state(symbol: str) -> BoundaryState: - receipt = construct_subatomic_gonol(symbol) - _frames, axes, attachment_count = lifted_spiral_carried_on_subatomic(receipt) - return BoundaryState( - state_id=f"subatomic:{symbol}", - scale="subatomic", - source=symbol, - role="frozen", - interior_modes=3, - boundary_axes=tuple(axes), - coupling_slots=tuple(f"slot:{index}" for index in range(attachment_count)), - bulk_count=len(receipt.gonol.participants), - labels=(symbol,), - structure_signature=tuple( - f"{participant.relation}:{participant.source_id}" - for participant in receipt.gonol.participants - ), - ) - - -def _element_state(symbol: str) -> BoundaryState: - receipt = construct_element_gonol(symbol) - _frames, axes, attachment_count = lifted_spiral_carried_on_element(receipt) - return BoundaryState( - state_id=f"element:{symbol}", - scale="element", - source=symbol, - role="frozen", - interior_modes=3, - boundary_axes=tuple(axes), - coupling_slots=tuple(f"slot:{index}" for index in range(attachment_count)), - bulk_count=len(receipt.gonol.participants), - labels=(symbol,), - structure_signature=tuple( - f"{participant.relation}:{participant.source_id}" - for participant in receipt.gonol.participants - ), - ) - - -def _molecule_state( - formula: str, - construction: MolecularConstruction | None = None, -) -> BoundaryState: - if construction is None: - construction = construct_molecule(formula) - _frames, axes, attachment_count = lifted_spiral_carried_on_molecule(construction) - slots = tuple( - _slot_signature(slot) - for slot in construction.invariants["mobius"]["attachment_slots"] - ) - if len(slots) != attachment_count: - raise ValueError(f"{formula}: lifted-spiral attachment count does not match slots") - return BoundaryState( - state_id=f"molecule:{formula}", - scale="molecule", - source=formula, - role="frozen", - interior_modes=3, - boundary_axes=tuple(axes), - coupling_slots=slots, - bulk_count=int(construction.invariants["atom_count"]), - labels=tuple(construction.invariants["participant_symbols"]), - structure_signature=tuple( - _slot_signature(part) - for part in construction.invariants["dimensional_geometry"]["structure"]["parts"] - ), - ) - - -@lru_cache(maxsize=1) -def freeze_current_construction_surface() -> dict[str, Any]: - """Freeze the current EPAC boundary states before controls are generated.""" - symbols = required_element_symbols() - formulas = tuple(MOLECULE_COMPOSITIONS) - states: dict[str, BoundaryState] = {} - for symbol in symbols: - subatomic = _subatomic_state(symbol) - element = _element_state(symbol) - states[subatomic.state_id] = subatomic - states[element.state_id] = element - constructions = construct_declared_molecules() - for formula in formulas: - molecule = _molecule_state(formula, constructions[formula]) - states[molecule.state_id] = molecule - return { - "surface_id": "epac-current-locked-nine-boundary-surface", - "formulas": formulas, - "required_elements": symbols, - "state_ids": tuple(states), - "states": states, - "state_records": {state_id: _state_record(state) for state_id, state in states.items()}, - "frozen_before_controls": True, - } - - -def _expected_b_after_operation( - parent: BoundaryState, - operation: Mapping[str, Any], -) -> BoundaryCapacity: - kind = operation["kind"] - interior, d_boundary, c_boundary = parent.b - if kind in {"relabel", "reorder", "rewire_same_count"}: - return parent.b - if kind == "delete_axis": - return (interior, d_boundary - 1, c_boundary) - if kind in {"add_axis", "duplicate_participant"}: - return (interior, d_boundary + 1, c_boundary) - if kind == "delete_coupling": - return (interior, d_boundary, c_boundary - 1) - if kind == "add_coupling": - return (interior, d_boundary, c_boundary + 1) - if kind == "hierarchy_refinement_perturbation": - return (interior, int(operation["target_d_boundary"]), c_boundary) - raise ValueError(f"unknown boundary operation: {kind}") - - -def _apply_operation( - parent: BoundaryState, - operation: Mapping[str, Any], - expected_b: BoundaryCapacity, -) -> BoundaryState: - kind = operation["kind"] - axes = parent.boundary_axes - slots = parent.coupling_slots - labels = parent.labels - structure = parent.structure_signature - if kind == "relabel": - axes = tuple(f"axis:{index}" for index, _axis in enumerate(parent.boundary_axes)) - slots = tuple(f"slot:{index}" for index, _slot in enumerate(parent.coupling_slots)) - labels = tuple(f"label:{index}" for index, _label in enumerate(parent.labels)) - structure = tuple(f"incidence:{index}" for index, _item in enumerate(parent.structure_signature)) - elif kind == "reorder": - axes = tuple(reversed(parent.boundary_axes)) - slots = tuple(reversed(parent.coupling_slots)) - labels = tuple(reversed(parent.labels)) - structure = tuple(reversed(parent.structure_signature)) - elif kind == "delete_axis": - axes = parent.boundary_axes[:-1] - elif kind == "add_axis": - axes = (*parent.boundary_axes, f"{parent.state_id}:added-axis") - elif kind == "duplicate_participant": - axes = (*parent.boundary_axes, f"{parent.boundary_axes[-1]}:duplicate") - labels = (*parent.labels, parent.labels[-1] if parent.labels else "duplicate") - elif kind == "delete_coupling": - slots = parent.coupling_slots[:-1] - elif kind == "add_coupling": - slots = (*parent.coupling_slots, f"{parent.state_id}:added-coupling") - elif kind == "rewire_same_count": - slots = tuple(f"{slot}:rewired" for slot in parent.coupling_slots) - structure = (*parent.structure_signature, f"{parent.state_id}:rewired-incidence") - elif kind == "hierarchy_refinement_perturbation": - axes = tuple(operation["target_axes"]) - actual = replace( - parent, - state_id=f"{parent.state_id}::{operation['mutation_id']}", - role="control", - boundary_axes=tuple(axes), - coupling_slots=tuple(slots), - labels=tuple(labels), - structure_signature=tuple(structure), - parent_id=parent.state_id, - mutation_id=str(operation["mutation_id"]), - ) - if actual.b != expected_b: - raise ValueError( - f"{operation['mutation_id']}: expected {expected_b}, produced {actual.b}" - ) - return actual - - -def _make_mutation( - parent: BoundaryState, - operation: Mapping[str, Any], - *, - expected_relation: str, - requires_boundary_distinct: bool, -) -> BoundaryMutation: - expected_b = _expected_b_after_operation(parent, operation) - actual = _apply_operation(parent, operation, expected_b) - status = SURVIVED if actual.b == expected_b else FALSIFIED - if requires_boundary_distinct and actual.b == parent.b: - status = FALSIFIED - return BoundaryMutation( - mutation_id=str(operation["mutation_id"]), - kind=str(operation["kind"]), - parent_id=parent.state_id, - expected_relation=expected_relation, - expected_b=expected_b, - actual_state=actual, - requires_boundary_distinct_from_parent=requires_boundary_distinct, - declared_before_evaluation=True, - status=status, - ) - - -def _hierarchy_target_axes(parent: BoundaryState, states: Mapping[str, BoundaryState]) -> tuple[str, ...] | None: - if parent.scale != "element": - return None - subatomic = states.get(f"subatomic:{parent.source}") - if subatomic is None: - return None - if subatomic.b[1] == parent.b[1]: - return None - return subatomic.boundary_axes - - -def build_counterfactual_neighborhood(surface: Mapping[str, Any]) -> dict[str, Any]: - """Build first-order controls from a pre-frozen surface.""" - if not surface.get("frozen_before_controls"): - raise ValueError("surface must be frozen before controls are generated") - states: Mapping[str, BoundaryState] = surface["states"] - mutations: list[BoundaryMutation] = [] - for parent in states.values(): - mutations.append( - _make_mutation( - parent, - {"kind": "relabel", "mutation_id": "relabel"}, - expected_relation="invariant_to_label_change", - requires_boundary_distinct=False, - ) - ) - mutations.append( - _make_mutation( - parent, - {"kind": "reorder", "mutation_id": "reorder"}, - expected_relation="invariant_to_order_change", - requires_boundary_distinct=False, - ) - ) - mutations.append( - _make_mutation( - parent, - {"kind": "add_axis", "mutation_id": "add_axis"}, - expected_relation="distinct_by_d_boundary", - requires_boundary_distinct=True, - ) - ) - mutations.append( - _make_mutation( - parent, - {"kind": "duplicate_participant", "mutation_id": "duplicate_participant"}, - expected_relation="distinct_by_d_boundary", - requires_boundary_distinct=True, - ) - ) - if parent.b[1] > 1: - mutations.append( - _make_mutation( - parent, - {"kind": "delete_axis", "mutation_id": "delete_axis"}, - expected_relation="distinct_by_d_boundary", - requires_boundary_distinct=True, - ) - ) - if parent.b[2] > 0: - mutations.append( - _make_mutation( - parent, - {"kind": "delete_coupling", "mutation_id": "delete_coupling"}, - expected_relation="distinct_by_c_boundary", - requires_boundary_distinct=True, - ) - ) - mutations.append( - _make_mutation( - parent, - {"kind": "add_coupling", "mutation_id": "add_coupling"}, - expected_relation="distinct_by_c_boundary", - requires_boundary_distinct=True, - ) - ) - mutations.append( - _make_mutation( - parent, - {"kind": "rewire_same_count", "mutation_id": "rewire_same_count"}, - expected_relation="coarse_equivalent_by_same_counts", - requires_boundary_distinct=False, - ) - ) - hierarchy_target = _hierarchy_target_axes(parent, states) - if hierarchy_target is not None: - mutations.append( - _make_mutation( - parent, - { - "kind": "hierarchy_refinement_perturbation", - "mutation_id": "hierarchy_refinement_perturbation", - "target_axes": hierarchy_target, - "target_d_boundary": len(hierarchy_target), - }, - expected_relation="distinct_by_d_boundary", - requires_boundary_distinct=True, - ) - ) - return { - "surface_id": surface["surface_id"], - "parent_states": states, - "mutations": tuple(mutations), - "mutation_records": tuple(_mutation_record(mutation) for mutation in mutations), - "status": SURVIVED if all(mutation.status == SURVIVED for mutation in mutations) else FALSIFIED, - } - - -def _label_invariance(neighborhood: Mapping[str, Any]) -> dict[str, Any]: - parent_states: Mapping[str, BoundaryState] = neighborhood["parent_states"] - controls = [ - mutation - for mutation in neighborhood["mutations"] - if mutation.kind in {"relabel", "reorder"} - ] - return { - "control_count": len(controls), - "all_expected_invariant": all( - mutation.actual_state.b == mutation.expected_b - and mutation.actual_state.b == parent_states[mutation.parent_id].b - and not mutation.requires_boundary_distinct_from_parent - for mutation in controls - ), - "status": SURVIVED if controls and all(mutation.status == SURVIVED for mutation in controls) else FALSIFIED, - } - - -def _equivalent_path_invariance() -> dict[str, Any]: - closure = cross_scale_compositional_closure() - element_ok = all( - element_closure_ledger(symbol)["path_independence"]["path_independent"] - for symbol in closure["scope"]["required_elements"] - ) - formula_ok = all( - formula_closure_ledger(formula)["paths"]["path_independent"] - for formula in closure["scope"]["formulas"] - ) - return { - "element_path_independent": element_ok, - "formula_path_independent": formula_ok, - "cross_scale_closure_statuses": closure["statuses"], - "status": SURVIVED if element_ok and formula_ok else FALSIFIED, - } - - -def _d_boundary_sensitivity(neighborhood: Mapping[str, Any]) -> dict[str, Any]: - parent_states: Mapping[str, BoundaryState] = neighborhood["parent_states"] - positive = [ - mutation - for mutation in neighborhood["mutations"] - if mutation.kind in { - "add_axis", - "delete_axis", - "duplicate_participant", - "hierarchy_refinement_perturbation", - } - ] - negative = [ - mutation - for mutation in neighborhood["mutations"] - if mutation.kind in {"relabel", "reorder", "add_coupling", "delete_coupling", "rewire_same_count"} - ] - positive_failures = tuple( - mutation.mutation_id - for mutation in positive - if not ( - mutation.status == SURVIVED - and mutation.actual_state.b == mutation.expected_b - and mutation.actual_state.b[0] == parent_states[mutation.parent_id].b[0] - and mutation.actual_state.b[1] != parent_states[mutation.parent_id].b[1] - and mutation.actual_state.b[2] == parent_states[mutation.parent_id].b[2] - ) - ) - negative_failures = tuple( - mutation.mutation_id - for mutation in negative - if not ( - mutation.status == SURVIVED - and mutation.actual_state.b == mutation.expected_b - and mutation.actual_state.b[1] == parent_states[mutation.parent_id].b[1] - ) - ) - return { - "positive_control_count": len(positive), - "negative_control_count": len(negative), - "positive_control_kinds": tuple(sorted({mutation.kind for mutation in positive})), - "negative_control_kinds": tuple(sorted({mutation.kind for mutation in negative})), - "positive_failures": positive_failures, - "negative_failures": negative_failures, - "status": SURVIVED if positive and negative and not positive_failures and not negative_failures else FALSIFIED, - } - - -def _c_boundary_sensitivity(neighborhood: Mapping[str, Any]) -> dict[str, Any]: - parent_states: Mapping[str, BoundaryState] = neighborhood["parent_states"] - positive = [ - mutation - for mutation in neighborhood["mutations"] - if mutation.kind in {"add_coupling", "delete_coupling"} - ] - negative = [ - mutation - for mutation in neighborhood["mutations"] - if mutation.kind == "rewire_same_count" - ] - positive_failures = tuple( - mutation.mutation_id - for mutation in positive - if not ( - mutation.status == SURVIVED - and mutation.actual_state.b == mutation.expected_b - and mutation.actual_state.b[0] == parent_states[mutation.parent_id].b[0] - and mutation.actual_state.b[1] == parent_states[mutation.parent_id].b[1] - and mutation.actual_state.b[2] != parent_states[mutation.parent_id].b[2] - and mutation.actual_state.bulk_count == parent_states[mutation.parent_id].bulk_count - ) - ) - negative_failures = tuple( - mutation.mutation_id - for mutation in negative - if not ( - mutation.status == SURVIVED - and mutation.actual_state.b == mutation.expected_b - and mutation.actual_state.b == parent_states[mutation.parent_id].b - and mutation.actual_state.structure_signature - != parent_states[mutation.parent_id].structure_signature - ) - ) - return { - "positive_control_count": len(positive), - "negative_control_count": len(negative), - "positive_control_kinds": tuple(sorted({mutation.kind for mutation in positive})), - "negative_control_kinds": tuple(sorted({mutation.kind for mutation in negative})), - "positive_failures": positive_failures, - "negative_failures": negative_failures, - "status": SURVIVED if positive and negative and not positive_failures and not negative_failures else FALSIFIED, - } - - -def _partition(values: Mapping[str, Any]) -> dict[Any, tuple[str, ...]]: - groups: dict[Any, list[str]] = {} - for key, value in values.items(): - groups.setdefault(value, []).append(key) - return {value: tuple(sorted(keys)) for value, keys in groups.items()} - - -def _non_singleton_control_discrimination(surface: Mapping[str, Any]) -> dict[str, Any]: - molecule_states = { - state.source: state - for state in surface["states"].values() - if state.scale == "molecule" - } - bulk_partition = _partition( - {formula: state.bulk_count for formula, state in molecule_states.items()} - ) - b_by_formula = {formula: state.b for formula, state in molecule_states.items()} - split_groups = {} - for _bulk, formulas in bulk_partition.items(): - if len(formulas) <= 1: - continue - b_values = {formula: b_by_formula[formula] for formula in formulas} - b_partition = _partition(b_values) - if len(b_partition) > 1: - split_groups[formulas] = tuple(b_partition.values()) - singleton_regression = control_like_partition_failure_disposition() - singleton_warning_retained = ( - singleton_regression["observed_subatomic_lifted_spiral_matches_control"] - and singleton_regression["classification"] == "stale_or_incorrect_control_assertion" - and not singleton_regression["compositional_counterexample"] - ) - return { - "bulk_count_partition": bulk_partition, - "B_by_formula": b_by_formula, - "non_singleton_bulk_groups": tuple( - formulas for formulas in bulk_partition.values() if len(formulas) > 1 - ), - "split_non_singleton_groups": split_groups, - "singleton_partition_regression": singleton_regression, - "singleton_warning_retained": singleton_warning_retained, - "status": SURVIVED if split_groups and singleton_warning_retained else FALSIFIED, - } - - -def _structure_key(state: BoundaryState) -> tuple[Any, ...]: - return ( - state.scale, - state.source, - state.bulk_count, - state.labels, - tuple(sorted(state.boundary_axes)), - tuple(sorted(state.coupling_slots)), - tuple(sorted(state.structure_signature)), - ) - - -def _collision_search( - surface: Mapping[str, Any], - neighborhood: Mapping[str, Any], -) -> dict[str, Any]: - states: dict[str, BoundaryState] = dict(surface["states"]) - parent_by_id = states - required_distinct_failures = [] - for mutation in neighborhood["mutations"]: - states[mutation.actual_state.state_id] = mutation.actual_state - if ( - mutation.requires_boundary_distinct_from_parent - and mutation.actual_state.b == parent_by_id[mutation.parent_id].b - ): - required_distinct_failures.append( - (mutation.parent_id, mutation.actual_state.state_id, mutation.kind) - ) - - coarse_collisions = [] - for left, right in combinations(states.values(), 2): - if left.b != right.b: - continue - if _structure_key(left) == _structure_key(right): - continue - classification = "intentionally_coarse_equivalence_class" - if left.parent_id == right.state_id or right.parent_id == left.state_id: - classification = "declared_invariance_or_same_count_control" - coarse_collisions.append( - { - "left": left.state_id, - "right": right.state_id, - "B": left.b, - "classification": classification, - } - ) - - return { - "bounded_state_count": len(states), - "same_B_collision_count": len(coarse_collisions), - "classified_collision_count": len(coarse_collisions), - "coarse_collision_examples": tuple(coarse_collisions[:12]), - "required_boundary_distinct_failures": tuple(required_distinct_failures), - "classification": ( - "complete_for_bounded_first_order_neighborhood" - if not required_distinct_failures - else "falsifies_descriptor_sufficiency" - ), - "status": SURVIVED if not required_distinct_failures else FALSIFIED, - } - - -@lru_cache(maxsize=1) -def boundary_descriptor_nondegeneracy_report() -> dict[str, Any]: - """Run the bounded EPAC boundary-descriptor non-degeneracy audit.""" - surface = freeze_current_construction_surface() - neighborhood = build_counterfactual_neighborhood(surface) - label_invariance = _label_invariance(neighborhood) - equivalent_path_invariance = _equivalent_path_invariance() - d_sensitivity = _d_boundary_sensitivity(neighborhood) - c_sensitivity = _c_boundary_sensitivity(neighborhood) - non_singleton = _non_singleton_control_discrimination(surface) - collisions = _collision_search(surface, neighborhood) - statuses = { - "label_invariance": label_invariance["status"], - "equivalent_path_invariance": equivalent_path_invariance["status"], - "d_boundary_sensitivity": d_sensitivity["status"], - "c_boundary_sensitivity": c_sensitivity["status"], - "non_singleton_control_discrimination": non_singleton["status"], - "descriptor_collision_search": collisions["status"], - } - overall = ( - SURVIVED - if all(status == SURVIVED for status in statuses.values()) - else FALSIFIED - ) - statuses["boundary_descriptor_non_degeneracy"] = overall - return { - "decision": ( - "B=(3,d_boundary,c_boundary) is non-degenerate over the bounded " - "first-order controls: invariant to labels/order/equivalent paths, " - "sensitive to declared d and c changes, and not explained by the " - "old singleton-partition accident. It remains intentionally coarse " - "for full incidence topology." - ), - "surface": { - "surface_id": surface["surface_id"], - "formulas": surface["formulas"], - "required_elements": surface["required_elements"], - "state_count": len(surface["states"]), - "frozen_before_controls": surface["frozen_before_controls"], - }, - "control_neighborhood": { - "mutation_count": len(neighborhood["mutations"]), - "status": neighborhood["status"], - "mutation_records": neighborhood["mutation_records"], - }, - "label_invariance": label_invariance, - "equivalent_path_invariance": equivalent_path_invariance, - "d_boundary_sensitivity": d_sensitivity, - "c_boundary_sensitivity": c_sensitivity, - "non_singleton_control_discrimination": non_singleton, - "descriptor_collision_search": collisions, - "statuses": statuses, - "requires_more": ( - "B is not a complete incidence-topology descriptor", - "future construction paths must be added to equivalent-path controls before claiming coverage over them", - "no PCEA mapping, UCNS continuum theorem, runtime channel encoding, or external physical claim is made", - ), - } - - -__all__ = [ - "BoundaryMutation", - "BoundaryState", - "boundary_descriptor_nondegeneracy_report", - "build_counterfactual_neighborhood", - "freeze_current_construction_surface", -] diff --git a/research/epac/epac_boundary_probe_completeness.py b/research/epac/epac_boundary_probe_completeness.py deleted file mode 100644 index 29d1b83..0000000 --- a/research/epac/epac_boundary_probe_completeness.py +++ /dev/null @@ -1,810 +0,0 @@ -"""Completeness audit for the EPAC boundary-capacity probe inventory. - -This module audits whether the probe inventory used by -``epac_boundary_quotient`` covers every already-declared EPAC operation whose -observable outcome can depend on boundary incidence, attachment availability, -coupling structure, or boundary state. - -No new probe, coordinate, descriptor component, physics claim, PCEA bridge, or -UCNS continuum result is introduced. Existing structural readouts are evaluated -only with identifiers and labels excluded as discriminators. -""" - -from __future__ import annotations - -import ast -from functools import lru_cache -from itertools import combinations -from pathlib import Path -from typing import Any, Callable, Mapping - -from epac_boundary_nondegeneracy import BoundaryState, freeze_current_construction_surface -from epac_boundary_quotient import ( - BOUNDARY_CAPACITY_PROBES, - boundary_capacity_quotient_report, -) -from epac_cross_scale_closure import FALSIFIED, SURVIVED, UNRESOLVED -from epac_dimensional_arity import ( - charged_structure_readout, - quaternion_structure_readout, - topology_structure_readout, -) -from epac_molecular import construct_declared_molecules -from epac_periodic import construct_element_gonol -from subatomic_gonol import construct_subatomic_gonol - -# === MODULE_BUILD === -# id: epac_boundary_probe_completeness -# module_name: epac_boundary_probe_completeness -# module_kind: experiment -# summary: evidence-only audit of whether the current boundary-capacity quotient probe inventory covers every already-declared EPAC boundary-relevant operation on the frozen state surface -# owner: The Interdependency -# public_surface: declared_operation_ledger, omitted_boundary_operation_effects, boundary_probe_completeness_report -# internal_surface: _declared_operations, _classify_operation, _state_contexts, _observable_effect, _identity_excluded_charged_structure, _combined_omitted_partition -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: tests.test_boundary_probe_completeness -# rollout: imported by tests/docs as a research evidence surface; no constructor, descriptor, quotient, or runtime behavior changes -# rollback: remove this module and its tests/docs without changing the quotient or locked molecule construction -# requires: epac_boundary_capacity_quotient -# since: 2026-09-07 -# unresolved: future operation surfaces can refine this audit; structural readouts remain existing EPAC operations rather than boundary-capacity descriptor components -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: boundary_probe_audit_freezes_current_surface -# given: the boundary-probe completeness audit is run -# then: it evaluates only the 27 frozen subatomic, element, and locked molecule states already used by the quotient audit -# class: evidence -# -# id: boundary_probe_audit_inventory_covers_declared_operations -# given: the audit inventories EPAC operations -# then: every exported callable from the bounded EPAC construction/evidence source files is classified as boundary-observing, boundary-transforming, provenance/identity only, internal/non-boundary, or ambiguous -# class: safety -# -# id: boundary_probe_audit_uses_no_new_probe_or_descriptor -# given: omitted operations are evaluated -# then: only existing EPAC operation outputs are added to the comparison signature and B remains exactly three components -# class: safety -# -# id: boundary_probe_audit_excludes_identity_discriminators -# given: existing structural outputs contain concrete ids or labels -# then: same-B distinctions are counted only after source ids, labels, axis names, and coupling ids are excluded from the observable -# class: safety -# -# id: boundary_probe_audit_imports_no_ucns_or_pcea -# given: the boundary-probe completeness audit module is loaded -# then: it has no direct UCNS or PCEA import; it consumes only EPAC-local evidence surfaces -# class: safety -# -# id: boundary_probe_audit_reruns_same_B_and_unequal_B_comparisons -# given: an existing boundary-relevant operation is not represented in the current quotient probe inventory -# then: the audit reruns the six same-B collision groups and all unequal-B comparisons with that existing observable -# class: correctness -# -# id: boundary_probe_audit_reports_partition_change -# given: omitted existing observables are added to the quotient comparison -# then: the audit reports whether the 16-class quotient partition changes -# class: evidence -# -# id: boundary_probe_audit_classifies_completeness -# given: all operation ledger rows and omitted-observable effects -# then: the aggregate status is SURVIVED only if no omitted existing boundary-relevant operation refines the quotient, FALSIFIED if one does, and UNRESOLVED if any operation has ambiguous boundary semantics -# class: correctness -# === END CONTRACTS === - - -EPAC_ROOT = Path(__file__).resolve().parent - -BOUNDARY_OBSERVING = "boundary-observing" -BOUNDARY_TRANSFORMING = "boundary-transforming" -PROVENANCE_IDENTITY = "provenance/identity only" -INTERNAL_NON_BOUNDARY = "internal/non-boundary" -AMBIGUOUS = "ambiguous" - -OperationRecord = dict[str, Any] -StateContext = dict[str, Any] -Observable = Any -ObservableFn = Callable[[StateContext], Observable] - -OPERATION_SOURCE_FILES = ( - "epac_public_gonol.py", - "epac_dimensional_arity.py", - "epac_periodic.py", - "epac_molecular.py", - "epac_cross_scale_closure.py", - "epac_boundary_nondegeneracy.py", - "epac_boundary_quotient.py", - "epac_comparison.py", - "subatomic/subatomic_gonol.py", - "subatomic/element_affixiation_candidate.py", - "subatomic/extended_atomic.py", - "subatomic/nuclear_harmonic_candidates.py", - "subatomic/symbol_coupling.py", -) - -STRUCTURAL_OBSERVER_NAMES = frozenset( - { - "charged_structure_readout", - "topology_structure_readout", - "quaternion_structure_readout", - "geometry_from_declared_couplings", - "structure_from_charged_couplings", - "degree_relations", - "oriented_instance_couplings", - "local_three_structures", - "quaternion_of_local_three", - "quaternions_from_declared_couplings", - "has_declared_coupling", - "instances_missing_oriented_hub_coupling", - "require_every_instance_has_oriented_hub_coupling", - } -) - -BOUNDARY_CAPACITY_OPERATION_NAMES = frozenset( - { - "boundary_capacity_from_subatomic_receipt", - "boundary_capacity_from_element_receipt", - "boundary_capacity_from_receipt", - "boundary_capacity_carried_on_molecule", - "boundary_capacity_transition_for_molecule", - "boundary_capacity_behavior_signature", - "boundary_capacity_quotient_report", - "boundary_capacity_quotient_test", - "boundary_capacity_descriptor_sufficiency_sweep", - "boundary_capacity_information_loss_localization", - "boundary_descriptor_nondegeneracy_report", - "build_counterfactual_neighborhood", - "freeze_current_construction_surface", - "observed_local_boundary_deltas", - "predict_boundary_capacity_from_source_and_op", - "source_element_boundary_capacities", - "declared_valence_attachment_count", - "apply_local_step", - "accumulate_from_local_path", - "compositional_boundary_closure", - "derive_element_boundary_from_subatomic", - "element_closure_ledger", - "formula_closure_ledger", - "cross_scale_compositional_closure", - } -) - -CONSTRUCTION_OPERATION_NAMES = frozenset( - { - "construct_public_gonol", - "construct_subatomic_gonol", - "construct_element_gonol", - "construct_periodic_table", - "construct_molecule", - "construct_declared_molecules", - "Dimension", - "Coupling", - "CouplingProof", - "DimensionalSpace", - "dimension", - "coupling", - "space", - "install_proven_coupling", - } -) - -BOUNDARY_REPRESENTED_NAMES = BOUNDARY_CAPACITY_OPERATION_NAMES | frozenset( - { - "lifted_spiral_carried_on_subatomic", - "lifted_spiral_carried_on_element", - "lifted_spiral_from_receipt", - "lifted_spiral_carried_on_molecule", - "BoundaryState", - "BoundaryMutation", - } -) - -PROVENANCE_NAMES = frozenset( - { - "ClosedPublicGonol", - "PublicGonolReceipt", - "PublicGonolConstructionError", - "DimensionalArityError", - "canonical_receipt_bytes", - "replay_public_gonol", - "replay_subatomic_gonol", - "replay_element_gonol", - "replay_molecule", - "replay_element", - "replay_symbol_coupling", - "ElementCandidate", - "HarmonicCandidate", - "element_receipt", - "harmonic_receipt", - "recurrence_test", - "atomic_record", - "iter_table", - "atomic_of", - "symbol_of", - "carried", - "subatomic_receipt_record", - "matched_information_control", - "harmonic_survival_from_receipt", - "harmonic_survival_carried_on_molecule", - "per_symbol_harmonic_survival_from_receipt", - "per_symbol_harmonic_survival_carried_on_molecule", - "harmonic_survival_carried_on_element", - "control_like_partition_failure_disposition", - "required_element_symbols", - "construction_sources_omit_sealed_labels", - "_harmonic_survival_signature", - "_subatomic_harmonic_survival_signature", - "_periodic_element_harmonic_survival_signature", - "_per_symbol_harmonic_survival_from_molecule", - "_quantify_distinguishing_power", - "construct_symbol_gonol", - "couple_symbol", - "affixiate_element", - } -) - -OMITTED_OBSERVABLE_OPERATION_NAMES = frozenset( - { - "charged_structure_readout", - "topology_structure_readout", - "quaternion_structure_readout", - "geometry_from_declared_couplings", - "structure_from_charged_couplings", - "degree_relations", - "oriented_instance_couplings", - "local_three_structures", - "quaternion_of_local_three", - "quaternions_from_declared_couplings", - "has_declared_coupling", - "instances_missing_oriented_hub_coupling", - "require_every_instance_has_oriented_hub_coupling", - } -) - - -def _module_label(relative_path: str) -> str: - return relative_path[:-3].replace("/", ".") - - -def _declared_names(path: Path) -> tuple[str, ...]: - tree = ast.parse(path.read_text(encoding="utf-8")) - top_level_defs = { - node.name - for node in tree.body - if isinstance(node, (ast.FunctionDef, ast.ClassDef)) - } - exported: list[str] = [] - for node in tree.body: - if not isinstance(node, ast.Assign): - continue - for target in node.targets: - if not isinstance(target, ast.Name) or target.id != "__all__": - continue - try: - exported = list(ast.literal_eval(node.value)) - except (SyntaxError, ValueError): - exported = [] - if exported: - return tuple(name for name in exported if name in top_level_defs) - return tuple(name for name in top_level_defs if not name.startswith("_")) - - -def _declared_operations() -> tuple[dict[str, str], ...]: - operations: list[dict[str, str]] = [] - for relative_path in OPERATION_SOURCE_FILES: - path = EPAC_ROOT / relative_path - module = _module_label(relative_path) - for name in _declared_names(path): - operations.append( - { - "operation": f"{module}.{name}", - "module": module, - "name": name, - "path": relative_path, - } - ) - return tuple(sorted(operations, key=lambda item: item["operation"])) - - -def _classify_operation(module: str, name: str) -> str: - if name in OmittedButNomenclature.NAMES: - return PROVENANCE_IDENTITY - if name in STRUCTURAL_OBSERVER_NAMES: - return BOUNDARY_OBSERVING - if name in BOUNDARY_CAPACITY_OPERATION_NAMES: - if name in { - "apply_local_step", - "accumulate_from_local_path", - "build_counterfactual_neighborhood", - "derive_element_boundary_from_subatomic", - "compositional_boundary_closure", - }: - return BOUNDARY_TRANSFORMING - return BOUNDARY_OBSERVING - if name in CONSTRUCTION_OPERATION_NAMES: - return BOUNDARY_TRANSFORMING - if "lifted_spiral" in name: - return BOUNDARY_OBSERVING - if "boundary" in name or "coupling" in name: - if module.endswith("symbol_coupling"): - return PROVENANCE_IDENTITY - return BOUNDARY_OBSERVING - if name in PROVENANCE_NAMES or "harmonic" in name: - return PROVENANCE_IDENTITY - if name in {"get_compositional_local_steps", "generate_compositional_paths"}: - return BOUNDARY_TRANSFORMING - if name in {"compare_after_construction"}: - return BOUNDARY_OBSERVING - return INTERNAL_NON_BOUNDARY - - -class OmittedButNomenclature: - NAMES = frozenset( - { - "construct_symbol_gonol", - "couple_symbol", - "replay_symbol_coupling", - } - ) - - -def _is_currently_probed(module: str, name: str, relevance: str) -> bool | None: - if relevance not in {BOUNDARY_OBSERVING, BOUNDARY_TRANSFORMING}: - return None - if name in OMITTED_OBSERVABLE_OPERATION_NAMES: - return False - if name == "compare_after_construction": - return False - return True - - -def _represented_by(name: str, currently_probed: bool | None) -> str: - if currently_probed is None: - return "not_applicable" - if currently_probed: - if name in BOUNDARY_REPRESENTED_NAMES: - return "current_boundary_capacity_probe_inventory" - if name in CONSTRUCTION_OPERATION_NAMES: - return "B_projection_of_existing_construction_output" - return "B_valued_transition_or_report" - if name in OMITTED_OBSERVABLE_OPERATION_NAMES: - return "omitted_existing_coupling_structure_observable" - return "omitted_aggregate_existing_observer" - - -def _observable_carried(name: str, relevance: str) -> str: - if relevance not in {BOUNDARY_OBSERVING, BOUNDARY_TRANSFORMING}: - return "not_applicable" - if name in OMITTED_OBSERVABLE_OPERATION_NAMES: - return "identifier-excluded declared coupling/incidence/charge/topology observable" - if "lifted_spiral" in name: - return "lifted-spiral frames, boundary axes, and attachment count; identifier-excluded quotient keeps count response" - if "boundary_capacity" in name or name.startswith("boundary_"): - return "B=(interior_modes,d_boundary,c_boundary) or B-valued probe signature" - if name in {"apply_local_step", "accumulate_from_local_path"}: - return "B-valued local transition delta" - if name in CONSTRUCTION_OPERATION_NAMES: - return "constructed boundary state and its B-valued projection" - return "existing aggregate observer over frozen construction records" - - -def _strip_identifiers(value: Any) -> Any: - if isinstance(value, str): - if value.startswith("epac.") or "#" in value: - return "" - return value - if isinstance(value, Mapping): - return tuple( - sorted((str(key), _strip_identifiers(item)) for key, item in value.items()) - ) - if isinstance(value, (tuple, list)): - return tuple(_strip_identifiers(item) for item in value) - return value - - -@lru_cache(maxsize=1) -def _state_contexts() -> dict[str, StateContext]: - surface = freeze_current_construction_surface() - constructions = construct_declared_molecules() - contexts: dict[str, StateContext] = {} - for state_id, state in surface["states"].items(): - structure = None - source = None - if state.scale == "molecule": - source = constructions[state.source] - structure = source.invariants["dimensional_geometry"]["structure"] - elif state.scale == "element": - source = construct_element_gonol(state.source) - structure = source.gonol.structure - elif state.scale == "subatomic": - source = construct_subatomic_gonol(state.source) - structure = source.gonol.structure - contexts[state_id] = { - "state": state, - "structure": structure, - "source": source, - } - return contexts - - -def _identity_excluded_topology(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - return topology_structure_readout(structure) - - -def _identity_excluded_charged_structure(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - return _strip_identifiers(charged_structure_readout(structure)) - - -def _identity_excluded_quaternion_structure(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - raw = quaternion_structure_readout(structure) - return tuple(sorted(_strip_identifiers(item[0]) for item in raw)) - - -def _identity_excluded_degree(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - return tuple( - sorted( - ( - int(item["degree"]), - _strip_identifiers(item["slot_degrees"]), - item.get("charge"), - ) - for item in structure["degree"] - ) - ) - - -def _identity_excluded_oriented_instances(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - return tuple( - sorted( - ( - int(part["arity"]), - _strip_identifiers(part["charge_state"]), - ) - for part in structure["parts"] - ) - ) - - -def _identity_excluded_local_threes(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - quaternions = structure.get("quaternions", ()) - return ( - "local_three_count", - len(quaternions), - tuple( - sorted( - _strip_identifiers(item["represented_ids"]) - for item in quaternions - ) - ), - ) - - -def _identity_excluded_geometry(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - return ( - "geometry", - int(structure["participating_dimension_count"]), - bool(structure["ternary_coupling_declared"]), - _identity_excluded_topology(context), - _identity_excluded_charged_structure(context), - _identity_excluded_quaternion_structure(context), - ) - - -def _has_any_declared_coupling(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("has_declared_coupling", False, 0) - return ("has_declared_coupling", bool(structure["parts"]), len(structure["parts"])) - - -def _no_missing_oriented_instances(context: StateContext) -> Observable: - structure = context["structure"] - if not structure: - return ("no_structure",) - return ("all_declared_instances_oriented", True, len(structure["parts"])) - - -OMITTED_OBSERVABLES: Mapping[str, ObservableFn] = { - "charged_structure_readout": _identity_excluded_charged_structure, - "topology_structure_readout": _identity_excluded_topology, - "quaternion_structure_readout": _identity_excluded_quaternion_structure, - "geometry_from_declared_couplings": _identity_excluded_geometry, - "structure_from_charged_couplings": _identity_excluded_charged_structure, - "degree_relations": _identity_excluded_degree, - "oriented_instance_couplings": _identity_excluded_oriented_instances, - "local_three_structures": _identity_excluded_local_threes, - "quaternion_of_local_three": _identity_excluded_quaternion_structure, - "quaternions_from_declared_couplings": _identity_excluded_quaternion_structure, - "has_declared_coupling": _has_any_declared_coupling, - "instances_missing_oriented_hub_coupling": _no_missing_oriented_instances, - "require_every_instance_has_oriented_hub_coupling": _no_missing_oriented_instances, -} - - -def _classes_by_signature(signatures: Mapping[str, Any]) -> dict[Any, tuple[str, ...]]: - classes: dict[Any, list[str]] = {} - for state_id, signature in signatures.items(): - classes.setdefault(signature, []).append(state_id) - return { - key: tuple(sorted(state_ids)) - for key, state_ids in classes.items() - } - - -def _observable_effect(operation_name: str, observable: ObservableFn) -> dict[str, Any]: - contexts = _state_contexts() - quotient = boundary_capacity_quotient_report() - states: Mapping[str, BoundaryState] = { - state_id: context["state"] for state_id, context in contexts.items() - } - outputs = { - state_id: observable(context) - for state_id, context in contexts.items() - } - augmented_signatures = { - state_id: (states[state_id].b, outputs[state_id]) - for state_id in states - } - augmented_classes = _classes_by_signature(augmented_signatures) - - same_b_group_results = [] - same_b_distinguished_pairs = [] - for collision in quotient["state_sufficiency_collisions"]: - state_ids = tuple(collision["state_ids"]) - output_groups = _classes_by_signature( - {state_id: outputs[state_id] for state_id in state_ids} - ) - split = len(output_groups) > 1 - if split: - for left_id, right_id in combinations(state_ids, 2): - if outputs[left_id] != outputs[right_id]: - same_b_distinguished_pairs.append( - { - "left": left_id, - "right": right_id, - "B": states[left_id].b, - "left_observable": outputs[left_id], - "right_observable": outputs[right_id], - } - ) - same_b_group_results.append( - { - "B": collision["B"], - "state_ids": state_ids, - "split_by_operation": split, - "observable_partition": tuple(output_groups.values()), - } - ) - - unequal_b_compared = 0 - unequal_b_same_observable = 0 - for left_id, right_id in combinations(states, 2): - if states[left_id].b == states[right_id].b: - continue - unequal_b_compared += 1 - if outputs[left_id] == outputs[right_id]: - unequal_b_same_observable += 1 - - baseline_class_count = len(quotient["B_classes"]) - augmented_class_count = len(augmented_classes) - return { - "operation_name": operation_name, - "baseline_class_count": baseline_class_count, - "augmented_class_count": augmented_class_count, - "quotient_partition_changes": augmented_class_count != baseline_class_count, - "same_B_collision_group_results": tuple(same_b_group_results), - "same_B_distinguished_pair_count": len(same_b_distinguished_pairs), - "same_B_distinguished_pair_examples": tuple(same_b_distinguished_pairs[:12]), - "unequal_B_comparison_count": unequal_b_compared, - "unequal_B_operation_only_equal_count": unequal_b_same_observable, - "identity_discriminators_excluded": True, - } - - -def _combined_omitted_partition(effects: Mapping[str, dict[str, Any]]) -> dict[str, Any]: - contexts = _state_contexts() - states = {state_id: context["state"] for state_id, context in contexts.items()} - outputs_by_operation = { - operation_name: { - state_id: OMITTED_OBSERVABLES[operation_name](context) - for state_id, context in contexts.items() - } - for operation_name in effects - if operation_name in OMITTED_OBSERVABLES - } - signatures = { - state_id: ( - states[state_id].b, - tuple( - (operation_name, operation_outputs[state_id]) - for operation_name, operation_outputs in sorted(outputs_by_operation.items()) - ), - ) - for state_id in states - } - classes = _classes_by_signature(signatures) - baseline_class_count = len(boundary_capacity_quotient_report()["B_classes"]) - return { - "baseline_class_count": baseline_class_count, - "combined_augmented_class_count": len(classes), - "quotient_partition_changes": len(classes) != baseline_class_count, - "class_partition": tuple(classes.values()), - } - - -@lru_cache(maxsize=1) -def omitted_boundary_operation_effects() -> dict[str, dict[str, Any]]: - """Evaluate omitted existing boundary observables on frozen states.""" - effects: dict[str, dict[str, Any]] = {} - for operation_name, observable in OMITTED_OBSERVABLES.items(): - effects[operation_name] = _observable_effect(operation_name, observable) - return effects - - -@lru_cache(maxsize=1) -def declared_operation_ledger() -> tuple[OperationRecord, ...]: - """Classify declared EPAC operations against the current quotient probes.""" - effects = omitted_boundary_operation_effects() - records: list[OperationRecord] = [] - for raw in _declared_operations(): - relevance = _classify_operation(raw["module"], raw["name"]) - currently_probed = _is_currently_probed(raw["module"], raw["name"], relevance) - effect = effects.get(raw["name"]) - can_distinguish_same_b = ( - bool(effect and effect["same_B_distinguished_pair_count"] > 0) - if currently_probed is False - else False - ) - records.append( - { - **raw, - "boundary_relevance": relevance, - "currently_probed": currently_probed, - "observable_carried": _observable_carried(raw["name"], relevance), - "represented_by": _represented_by(raw["name"], currently_probed), - "can_distinguish_same_B_states": can_distinguish_same_b, - "effect_on_quotient": ( - "refines_quotient_partition" - if can_distinguish_same_b - else ( - "no_partition_change" - if currently_probed is False - else "already_represented_or_not_applicable" - ) - ), - } - ) - return tuple(records) - - -@lru_cache(maxsize=1) -def boundary_probe_completeness_report() -> dict[str, Any]: - """Run the EPAC boundary-probe completeness audit.""" - surface = freeze_current_construction_surface() - quotient = boundary_capacity_quotient_report() - effects = omitted_boundary_operation_effects() - combined = _combined_omitted_partition(effects) - ledger = declared_operation_ledger() - ambiguous = tuple( - row for row in ledger if row["boundary_relevance"] == AMBIGUOUS - ) - boundary_relevant = tuple( - row - for row in ledger - if row["boundary_relevance"] in {BOUNDARY_OBSERVING, BOUNDARY_TRANSFORMING} - ) - omitted = tuple( - row - for row in boundary_relevant - if row["currently_probed"] is False - ) - omitted_distinguishing = tuple( - row for row in omitted if row["can_distinguish_same_B_states"] - ) - - if ambiguous: - aggregate = UNRESOLVED - elif omitted_distinguishing: - aggregate = FALSIFIED - else: - aggregate = SURVIVED - - statuses = { - "declared_operation_inventory": SURVIVED, - "ambiguous_boundary_semantics": UNRESOLVED if ambiguous else SURVIVED, - "omitted_boundary_relevant_operations": ( - FALSIFIED if omitted_distinguishing else SURVIVED - ), - "quotient_partition_stability_under_omitted_existing_observables": ( - FALSIFIED if combined["quotient_partition_changes"] else SURVIVED - ), - "boundary_probe_completeness": aggregate, - } - - return { - "decision": ( - "FALSIFIED: the current boundary-capacity quotient probe inventory " - "omits already-declared EPAC coupling-structure readouts. With " - "identifiers and labels excluded, those existing observables refine " - "the 16-class B quotient." - if aggregate == FALSIFIED - else ( - "UNRESOLVED: at least one declared EPAC operation has ambiguous boundary semantics." - if aggregate == UNRESOLVED - else "SURVIVED: no omitted existing boundary-relevant operation refines the quotient." - ) - ), - "surface": { - "surface_id": surface["surface_id"], - "state_count": len(surface["states"]), - "state_ids": surface["state_ids"], - "frozen_before_audit": surface["frozen_before_controls"], - }, - "current_probe_inventory": { - "probe_kinds": BOUNDARY_CAPACITY_PROBES, - "baseline_class_count": len(quotient["B_classes"]), - "equal_B_pair_count": quotient["equal_B_pair_count"], - "state_sufficiency_collision_group_count": len( - quotient["state_sufficiency_collisions"] - ), - }, - "operation_inventory": { - "source_files": OPERATION_SOURCE_FILES, - "operation_count": len(ledger), - "boundary_relevant_count": len(boundary_relevant), - "omitted_boundary_relevant_count": len(omitted), - "omitted_distinguishing_count": len(omitted_distinguishing), - "ambiguous_count": len(ambiguous), - }, - "operation_ledger": ledger, - "omitted_operation_effects": effects, - "combined_omitted_observable_effect": combined, - "omitted_distinguishing_operations": tuple( - row["operation"] for row in omitted_distinguishing - ), - "statuses": statuses, - "requires_more": ( - "the prior quotient remains valid only relative to its narrower probe inventory", - "B is not complete for the full presently declared EPAC operational surface", - "do not add a descriptor component in this audit", - "state identity, source labels, concrete axis names, and coupling ids remain excluded as discriminators", - "no PCEA mapping, UCNS continuum theorem, runtime encoding, or external physical claim is made", - ), - } - - -__all__ = [ - "AMBIGUOUS", - "BOUNDARY_OBSERVING", - "BOUNDARY_TRANSFORMING", - "INTERNAL_NON_BOUNDARY", - "PROVENANCE_IDENTITY", - "boundary_probe_completeness_report", - "declared_operation_ledger", - "omitted_boundary_operation_effects", -] diff --git a/research/epac/epac_boundary_quotient.py b/research/epac/epac_boundary_quotient.py deleted file mode 100644 index ab41702..0000000 --- a/research/epac/epac_boundary_quotient.py +++ /dev/null @@ -1,393 +0,0 @@ -"""Boundary-capacity quotient evidence for EPAC. - -This module asks the narrower question left by the non-degeneracy audit: -whether equality of B=(3,d_boundary,c_boundary) is exactly equality of the -presently observable boundary-capacity behavior on the frozen EPAC state -surface. - -The quotient is intentionally not a state descriptor. It ignores internal -identity, labels, incidence signatures, and topology except when reporting that -B remains insufficient for those stronger claims. -""" - -from __future__ import annotations - -from functools import lru_cache -from itertools import combinations -from typing import Any, Callable, Mapping - -from epac_boundary_nondegeneracy import ( - BoundaryMutation, - BoundaryState, - build_counterfactual_neighborhood, - freeze_current_construction_surface, -) -from epac_cross_scale_closure import FALSIFIED, SURVIVED, UNRESOLVED - -# === MODULE_BUILD === -# id: epac_boundary_capacity_quotient -# module_name: epac_boundary_quotient -# module_kind: experiment -# summary: evidence-only audit comparing equality of EPAC B=(3,d_boundary,c_boundary) with equality of presently observable boundary-capacity probe behavior over frozen subatomic, element, and molecule states -# owner: The Interdependency -# public_surface: boundary_capacity_behavior_signature, boundary_capacity_quotient_report -# internal_surface: _mutation_index, _probe_record, _classes_by_key, _same_B_probe_mismatches, _state_sufficiency_collisions -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: tests.test_boundary_capacity_quotient -# rollout: imported by tests/docs as a research evidence surface; no constructor, descriptor, or runtime behavior changes -# rollback: remove this module and its tests/docs without changing boundary descriptor, non-degeneracy, or locked molecule construction -# requires: epac_boundary_descriptor_nondegeneracy -# since: 2026-09-07 -# unresolved: future boundary probes may refine the quotient; incidence and topology completeness are not established by count-valued boundary-capacity probes -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: boundary_quotient_freezes_current_surface -# given: the quotient audit is run -# then: it compares only the pre-existing frozen EPAC subatomic, element, and locked molecule states -# class: evidence -# -# id: boundary_quotient_probe_inventory_is_existing_and_count_valued -# given: the quotient audit defines boundary-capacity behavior -# then: its probes are limited to observe-B and the existing non-degeneracy boundary controls, and every admissible result is a three-component B tuple -# class: safety -# -# id: boundary_quotient_ignores_identity_incidence_and_topology -# given: two frozen states are compared for boundary-capacity equivalence -# then: the comparison signature omits source id, labels, axis names, coupling-slot identities, incidence signatures, and topology -# class: safety -# -# id: boundary_quotient_relation_is_probe_signature_equality -# given: frozen EPAC states R1 and R2 -# then: R1 is boundary-capacity equivalent to R2 exactly when every presently admissible boundary-capacity probe has the same admissibility and B-valued response -# class: correctness -# -# id: boundary_quotient_B_matches_probe_equivalence -# given: the frozen EPAC state surface and current boundary-capacity probe inventory -# then: B(R1)=B(R2) if and only if R1 and R2 are boundary-capacity equivalent -# class: evidence -# -# id: boundary_quotient_preserves_state_sufficiency_falsification -# given: equality of B is compared with full frozen-state identity, incidence, and topology distinctions -# then: same-B collisions remain reported as a state-sufficiency falsification rather than erased by quotient classification -# class: doctrine -# -# id: boundary_quotient_does_not_extend_B -# given: the quotient audit classifies boundary-capacity behavior -# then: it does not add any component to B or define a new descriptor to rescue state sufficiency -# class: safety -# === END CONTRACTS === - - -BoundaryCapacity = tuple[int, int, int] -ProbeRecord = tuple[str, str, BoundaryCapacity | None, BoundaryCapacity | None, str | None] -ProbeSignature = tuple[ProbeRecord, ...] - -OBSERVE_B_PROBE = "observe_B" -BOUNDARY_CONTROL_PROBES = ( - "relabel", - "reorder", - "add_axis", - "delete_axis", - "duplicate_participant", - "add_coupling", - "delete_coupling", - "rewire_same_count", - "hierarchy_refinement_perturbation", -) -BOUNDARY_CAPACITY_PROBES = (OBSERVE_B_PROBE, *BOUNDARY_CONTROL_PROBES) - -STATE_IDENTITY_EXCLUDED_FIELDS = ( - "state_id", - "scale", - "source", - "role", - "bulk_count", - "labels", - "boundary_axes", - "coupling_slots", - "structure_signature", - "parent_id", - "mutation_id", -) - - -def _mutation_index( - neighborhood: Mapping[str, Any], -) -> dict[str, dict[str, BoundaryMutation]]: - indexed: dict[str, dict[str, BoundaryMutation]] = {} - for mutation in neighborhood["mutations"]: - indexed.setdefault(mutation.parent_id, {})[mutation.kind] = mutation - return indexed - - -def _probe_record( - state: BoundaryState, - kind: str, - parent_mutations: Mapping[str, BoundaryMutation], -) -> ProbeRecord: - if kind == OBSERVE_B_PROBE: - return (kind, "admissible", state.b, state.b, "descriptor") - - mutation = parent_mutations.get(kind) - if mutation is None: - return (kind, "inadmissible", None, None, None) - - return ( - kind, - "admissible", - mutation.expected_b, - mutation.actual_state.b, - mutation.expected_relation, - ) - - -def boundary_capacity_behavior_signature( - state: BoundaryState, - parent_mutations: Mapping[str, BoundaryMutation], -) -> ProbeSignature: - """Return the current boundary-capacity behavior signature for one state. - - The signature is count-valued: probe name, admissibility, expected B, actual - B, and declared relation. It deliberately omits state identity, labels, - concrete axis names, concrete coupling-slot names, incidence signatures, and - topology. - """ - return tuple( - _probe_record(state, kind, parent_mutations) - for kind in BOUNDARY_CAPACITY_PROBES - ) - - -def _classes_by_key( - states: Mapping[str, BoundaryState], - key_for: Callable[[BoundaryState], Any], -) -> dict[Any, tuple[str, ...]]: - classes: dict[Any, list[str]] = {} - for state_id, state in states.items(): - classes.setdefault(key_for(state), []).append(state_id) - return { - key: tuple(sorted(state_ids)) - for key, state_ids in classes.items() - } - - -def _canonical_class_sets(classes: Mapping[Any, tuple[str, ...]]) -> tuple[tuple[str, ...], ...]: - return tuple(sorted(tuple(sorted(state_ids)) for state_ids in classes.values())) - - -def _first_probe_difference( - left: ProbeSignature, - right: ProbeSignature, -) -> dict[str, Any] | None: - for left_record, right_record in zip(left, right): - if left_record != right_record: - return { - "probe": left_record[0], - "left": left_record, - "right": right_record, - } - return None - - -def _same_B_probe_mismatches( - states: Mapping[str, BoundaryState], - signatures: Mapping[str, ProbeSignature], -) -> tuple[dict[str, Any], ...]: - mismatches: list[dict[str, Any]] = [] - for left_id, right_id in combinations(states, 2): - left = states[left_id] - right = states[right_id] - if left.b != right.b: - continue - if signatures[left_id] == signatures[right_id]: - continue - mismatches.append( - { - "left": left_id, - "right": right_id, - "B": left.b, - "first_probe_difference": _first_probe_difference( - signatures[left_id], - signatures[right_id], - ), - } - ) - return tuple(mismatches) - - -def _unequal_B_equivalent_pairs( - states: Mapping[str, BoundaryState], - signatures: Mapping[str, ProbeSignature], -) -> tuple[dict[str, Any], ...]: - pairs: list[dict[str, Any]] = [] - for left_id, right_id in combinations(states, 2): - left = states[left_id] - right = states[right_id] - if left.b == right.b: - continue - if signatures[left_id] != signatures[right_id]: - continue - pairs.append( - { - "left": left_id, - "right": right_id, - "left_B": left.b, - "right_B": right.b, - } - ) - return tuple(pairs) - - -def _state_sufficiency_collisions( - b_classes: Mapping[BoundaryCapacity, tuple[str, ...]], -) -> tuple[dict[str, Any], ...]: - return tuple( - { - "B": b_value, - "state_ids": state_ids, - "classification": "same_B_distinct_frozen_states", - } - for b_value, state_ids in sorted(b_classes.items()) - if len(state_ids) > 1 - ) - - -def _probe_inventory(signatures: Mapping[str, ProbeSignature]) -> dict[str, Any]: - admissible_outputs = [] - for signature in signatures.values(): - for _kind, admissibility, expected_b, actual_b, _relation in signature: - if admissibility == "admissible": - admissible_outputs.extend((expected_b, actual_b)) - all_outputs_are_B = all( - isinstance(output, tuple) - and len(output) == 3 - and all(isinstance(component, int) for component in output) - for output in admissible_outputs - ) - return { - "probe_kinds": BOUNDARY_CAPACITY_PROBES, - "probe_source": "epac_boundary_nondegeneracy.build_counterfactual_neighborhood", - "admissible_result_shape": "B=(interior_modes,d_boundary,c_boundary)", - "identity_fields_excluded": STATE_IDENTITY_EXCLUDED_FIELDS, - "uses_identity_or_incidence_fields": False, - "admissible_output_count": len(admissible_outputs), - "all_admissible_outputs_are_B": all_outputs_are_B, - "status": SURVIVED if all_outputs_are_B else FALSIFIED, - } - - -@lru_cache(maxsize=1) -def boundary_capacity_quotient_report() -> dict[str, Any]: - """Compare B-equality with the present boundary-capacity behavior quotient.""" - surface = freeze_current_construction_surface() - neighborhood = build_counterfactual_neighborhood(surface) - states: Mapping[str, BoundaryState] = surface["states"] - mutation_index = _mutation_index(neighborhood) - - signatures = { - state_id: boundary_capacity_behavior_signature( - state, - mutation_index.get(state_id, {}), - ) - for state_id, state in states.items() - } - b_classes = _classes_by_key(states, lambda state: state.b) - behavior_classes = _classes_by_key(states, lambda state: signatures[state.state_id]) - same_b_mismatches = _same_B_probe_mismatches(states, signatures) - unequal_b_equivalents = _unequal_B_equivalent_pairs(states, signatures) - state_collisions = _state_sufficiency_collisions(b_classes) - - b_partition = _canonical_class_sets(b_classes) - behavior_partition = _canonical_class_sets(behavior_classes) - quotient_matches_B = ( - b_partition == behavior_partition - and not same_b_mismatches - and not unequal_b_equivalents - ) - relation_status = SURVIVED if behavior_classes else FALSIFIED - quotient_status = SURVIVED if quotient_matches_B else FALSIFIED - probe_inventory = _probe_inventory(signatures) - state_sufficiency_status = FALSIFIED if state_collisions else SURVIVED - - statuses = { - "probe_inventory": probe_inventory["status"], - "boundary_capacity_equivalence_relation": relation_status, - "B_matches_boundary_capacity_quotient": quotient_status, - "state_sufficiency": state_sufficiency_status, - "incidence_completeness": UNRESOLVED, - "topology_completeness": UNRESOLVED, - } - - return { - "decision": ( - "B=(3,d_boundary,c_boundary) is a complete descriptor of the " - "present EPAC boundary-capacity quotient over the frozen states. " - "It remains falsified as a complete state descriptor and does not " - "establish incidence or topology completeness." - ), - "surface": { - "surface_id": surface["surface_id"], - "state_count": len(states), - "state_ids": surface["state_ids"], - "frozen_before_quotient": surface["frozen_before_controls"], - }, - "probe_inventory": probe_inventory, - "B_classes": b_classes, - "boundary_capacity_behavior_classes": behavior_classes, - "B_partition": b_partition, - "behavior_partition": behavior_partition, - "equal_B_pair_count": sum( - 1 - for left_id, right_id in combinations(states, 2) - if states[left_id].b == states[right_id].b - ), - "same_B_probe_mismatches": same_b_mismatches, - "unequal_B_equivalent_pairs": unequal_b_equivalents, - "state_sufficiency_collisions": state_collisions, - "named_collision_checks": { - "H_subatomic_vs_H_element": ( - "subatomic:H", - "element:H", - ), - "subatomic_3_3_0": ( - "subatomic:O", - "subatomic:N", - "subatomic:C", - "subatomic:B", - "subatomic:F", - ), - "subatomic_3_4_0": ( - "subatomic:S", - "subatomic:P", - "subatomic:Si", - ), - "H2O_vs_H2S": ("molecule:H2O", "molecule:H2S"), - "BF3_vs_NH3_vs_PH3": ( - "molecule:BF3", - "molecule:NH3", - "molecule:PH3", - ), - "CH4_vs_SiH4": ("molecule:CH4", "molecule:SiH4"), - }, - "statuses": statuses, - "requires_more": ( - "future boundary-capacity probes may refine the quotient", - "state identity, incidence signatures, and topology remain outside B", - "do not promote B as a complete EPAC state descriptor", - "no PCEA mapping, UCNS continuum theorem, runtime encoding, or external physical claim is made", - ), - } - - -__all__ = [ - "BOUNDARY_CAPACITY_PROBES", - "BOUNDARY_CONTROL_PROBES", - "OBSERVE_B_PROBE", - "boundary_capacity_behavior_signature", - "boundary_capacity_quotient_report", -] diff --git a/research/epac/epac_comparison.py b/research/epac/epac_comparison.py deleted file mode 100644 index f0eddd0..0000000 --- a/research/epac/epac_comparison.py +++ /dev/null @@ -1,1048 +0,0 @@ -"""Sealed-shape comparison after EPAC Public Gonol construction. - -The three-dimensional structure is the charged oriented couplings plus degree. -This module opens known chemistry only after those structures exist. It does -not import VSEPR names into construction. - -Usage guidance --------------- - from epac_comparison import compare_after_construction - - record = compare_after_construction() - print(record["standings"]) -""" - -from __future__ import annotations - -import json -from collections import defaultdict -from functools import lru_cache -from pathlib import Path -from typing import Any, Mapping - -from epac_dimensional_arity import charged_structure_readout, topology_structure_readout -from epac_molecular import ( - MOLECULE_COMPOSITIONS, - boundary_capacity_carried_on_molecule, - boundary_capacity_descriptor_sufficiency_sweep, - boundary_capacity_information_loss_localization, - boundary_capacity_quotient_test, - boundary_capacity_minimal_refinement_audit, - epac_probe_relativity_formalization, - epac_representation_audit, - boundary_capacity_transition_for_molecule, - compositional_boundary_closure, - construct_declared_molecules, - harmonic_survival_carried_on_molecule, - lifted_spiral_carried_on_molecule, - matched_information_control, - observed_local_boundary_deltas, - per_symbol_harmonic_survival_carried_on_molecule, -) - -# Lifted spiral population (from the UCNS-framed gonol evidence) -from viz.spiral_viz import extract_spiral_scene, extract_full_spiral_population - -from epac_periodic import ( - boundary_capacity_from_element_receipt, - construct_element_gonol, - harmonic_survival_carried_on_element, - lifted_spiral_carried_on_element, -) - -import nuclear_harmonic_candidates as harmonics -import subatomic_gonol -from subatomic_gonol import ( - boundary_capacity_from_subatomic_receipt, - lifted_spiral_carried_on_subatomic, -) - - -EPAC_ROOT = Path(__file__).resolve().parent -SEALED_PATH = EPAC_ROOT / "data" / "sealed_known_molecular_geometry.json" -SEALED_SHAPE_LABELS = ("linear", "bent", "trigonal-pyramidal", "tetrahedral", "vsepr") -CONSTRUCTION_FILES = ( - "epac_atomic.py", - "epac_dimensional_arity.py", - "epac_molecular.py", - "epac_periodic.py", - "epac_public_gonol.py", -) - -# Frozen original preregistered set for sealed-shape prediction policy. -# All standings and quantify_distinguishing_power metrics against "known_shapes" -# are computed exclusively over this set, even if the sealed file or constructed -# set is enlarged for broader experiments. -ORIGINAL_PREREG = frozenset({"H2", "H2O", "NH3", "CH4", "CO2"}) - - -def construction_sources_omit_sealed_labels(root: Path = EPAC_ROOT) -> tuple[str, ...]: - hits: list[str] = [] - for name in CONSTRUCTION_FILES: - text = (root / name).read_text(encoding="utf-8").lower() - for label in SEALED_SHAPE_LABELS: - if label in text: - hits.append(f"{name}:{label}") - return tuple(hits) - - -def _partitions(values: Mapping[str, Any]) -> dict[Any, tuple[str, ...]]: - groups: dict[Any, list[str]] = defaultdict(list) - for formula, value in values.items(): - groups[value].append(formula) - return {key: tuple(sorted(formulas)) for key, formulas in groups.items()} - - -def _formula_sets(partitions: Mapping[Any, tuple[str, ...]]) -> frozenset[frozenset[str]]: - return frozenset(frozenset(group) for group in partitions.values()) - - -def _standing( - readout: Mapping[str, Any], - known_shapes: Mapping[str, str], - control: Mapping[str, Any], -) -> str: - """Preregistered shape-class prediction standing. - - SURVIVED only if the readout is invariant inside each sealed shape class, - distinguishes different sealed classes, and is not the matched-information - control. - """ - - by_shape: dict[str, set[Any]] = defaultdict(set) - for formula, shape in known_shapes.items(): - by_shape[shape].add(readout[formula]) - splits_a_class = any(len(values) > 1 for values in by_shape.values()) - collapsed_classes = False - shapes = list(by_shape) - for i, left in enumerate(shapes): - for right in shapes[i + 1 :]: - if by_shape[left] & by_shape[right]: - collapsed_classes = True - if splits_a_class or collapsed_classes: - return "FALSIFIED" - if _formula_sets(_partitions(readout)) == _formula_sets(_partitions(control)): - return "FALSIFIED" - if _formula_sets(_partitions(readout)) == _formula_sets(_partitions(known_shapes)): - return "SURVIVED" - return "UNRESOLVED" - - -def _pairwise_counts( - known_shapes: Mapping[str, str], - signature: Mapping[str, Any], -) -> dict[str, int]: - """Count pairwise agreements for a signature vs known shape classes. - - Returns counts for the four cells of the pair contingency table. - """ - formulas = list(known_shapes.keys()) - tp = fp = fn = tn = 0 # tp = same_known and same_sig, etc. - for i in range(len(formulas)): - for j in range(i + 1, len(formulas)): - f1, f2 = formulas[i], formulas[j] - same_known = known_shapes[f1] == known_shapes[f2] - same_sig = signature[f1] == signature[f2] - if same_known and same_sig: - tp += 1 - elif same_known and not same_sig: - fp += 1 # splits a known class - elif not same_known and same_sig: - fn += 1 # collapses across known classes - else: - tn += 1 - return {"tp": tp, "fp": fp, "fn": fn, "tn": tn, "total_pairs": tp + fp + fn + tn} - - -def _harmonic_survival_signature(formula: str) -> tuple[str, ...]: - """Molecule-level union of surviving nuclear harmonic candidate ids. - - For each constituent symbol, include every candidate for which at least - one of its isotope participants for that symbol satisfies the declared - recurrence. This is the same survival rule used inside subatomic gonols. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - survivors: set[str] = set() - for sym, _count in comp: - for cand in harmonics.CANDIDATES: - recmap = harmonics.recurrence_test(cand) - for participant in cand.participants: - if participant.startswith(f"{sym}-") and recmap.get(participant, False): - survivors.add(cand.candidate_id) - break - return tuple(sorted(survivors)) - - -def _subatomic_harmonic_survival_signature(formula: str) -> tuple[str, ...]: - """Molecule-level harmonic survival read from constructed subatomic gonols. - - Uses the "harmonic-surviving" carried option produced by subatomic_gonol - for each constituent symbol. This makes the nuclear harmonic layer a - carried fact inside the element gonols rather than a side computation. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - survivors: set[str] = set() - for sym, _count in comp: - receipt = subatomic_gonol.construct_subatomic_gonol(sym) - carried = dict(receipt.gonol.carried_options) - hs = carried.get("harmonic-surviving", "none") - if hs and hs != "none": - for c in hs.split(","): - survivors.add(c) - return tuple(sorted(survivors)) - - -def _periodic_element_harmonic_survival_signature(formula: str) -> tuple[str, ...]: - """Molecule-level harmonic survival read from native periodic element gonols. - - Uses the "harmonic-surviving" carried option now attached to every - periodic element gonol (sourced from the subatomic layer at construction). - This is the view through the primary EPAC element gonol path. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - survivors: set[str] = set() - for sym, _count in comp: - receipt = construct_element_gonol(sym) - hs = harmonic_survival_carried_on_element(receipt) - for c in hs: - survivors.add(c) - return tuple(sorted(survivors)) - - -def _periodic_element_lifted_spiral_signature(formula: str) -> tuple: - """Molecule-level lifted spiral signature read from native periodic element gonols. - - Uses the "lifted-spiral" carried option now attached to every - periodic element gonol (pure projection of the framed Möbius root-loop - witnessed at element construction). This is the bare-element view. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - # For the element view we take the signature from the first symbol's element gonol - # as a representative; for multi-element we can use a composite but for now - # we mirror the harmonic pattern by unioning the canonical signatures. - # Since the spiral for an element is (frames, axes, attach=0), we collect per-symbol. - # To keep a stable molecule-level signature we encode the per-constituent element spirals. - sigs = [] - for sym, _count in comp: - receipt = construct_element_gonol(sym) - ls = lifted_spiral_carried_on_element(receipt) - # ls is (frames, axes, ac); make a stable string for partitioning - sigs.append(f"{sym}:{'|'.join(ls[0])};{','.join(ls[1])};{ls[2]}") - return tuple(sorted(sigs)) - - -def _subatomic_lifted_spiral_signature(formula: str) -> tuple: - """Molecule-level lifted spiral signature read from subatomic gonols. - - Uses the "lifted-spiral" carried option now attached to every - subatomic gonol (pure projection of the framed Möbius root-loop - witnessed at subatomic construction). Bare-element view (attach=0). - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - sigs = [] - for sym, _count in comp: - receipt = subatomic_gonol.construct_subatomic_gonol(sym) - ls = lifted_spiral_carried_on_subatomic(receipt) - sigs.append(f"{sym}:{'|'.join(ls[0])};{','.join(ls[1])};{ls[2]}") - return tuple(sorted(sigs)) - - -def _per_symbol_harmonic_survival_from_molecule( - formula: str, - constructions: Mapping[str, Any] | None = None, -) -> dict[str, tuple[str, ...]]: - """Per-constituent-symbol harmonic survival carried on the molecule receipt. - - For each symbol in the composition, return the union of surviving candidate ids - carried under "-harmonic-surviving" (or empty if none). - Sources from the closed molecule PublicGonol receipt (the single source of truth). - An existing construction map may be supplied by comparison runs to avoid - rebuilding the full declared molecule set for each formula. - """ - from epac_molecular import per_symbol_harmonic_survival_carried_on_molecule - - if constructions is None: - constructions = construct_declared_molecules() - if formula not in constructions: - return {} - c = constructions[formula] - return per_symbol_harmonic_survival_carried_on_molecule(c) - - -def _lifted_spiral_signature(formula: str) -> tuple: - """Stable signature for the lifted spiral (UCNS framed Möbius root-loop). - - Sources exclusively from the carried "lifted-spiral" fact on the molecule - PublicGonol receipt (single source of truth, parallel to harmonic layers). - Returns the canonical (frames_tuple, sorted_axes_tuple, attachment_count). - """ - from epac_molecular import lifted_spiral_carried_on_molecule - constructions = construct_declared_molecules() - if formula not in constructions: - return ((), (), 0) - c = constructions[formula] - sig = lifted_spiral_carried_on_molecule(c) - if isinstance(sig, (list, tuple)) and len(sig) == 3: - frames, axes, ac = sig - return (tuple(frames), tuple(sorted(axes)) if axes else (), int(ac)) - return ((), (), 0) - - -def _boundary_capacity_signature( - formula: str, - construction: Any | None = None, -) -> tuple: - """Stable signature for boundary capacity of the bounded standing-wave configuration. - - Distinguishes fixed interior mode count (3) from boundary dimensionality - (participant axes count) and boundary coupling capacity (attachment count). - Sources exclusively from the carried facts on the molecule receipt. - Returns (interior_modes, boundary_dim, boundary_coupling_capacity). - """ - if construction is None: - constructions = construct_declared_molecules() - construction = constructions.get(formula) - if construction is None: - return (3, 0, 0) - bc = boundary_capacity_carried_on_molecule(construction) - if isinstance(bc, (list, tuple)) and len(bc) == 3: - im, bd, bcc = bc - return (int(im), int(bd), int(bcc)) - return (3, 0, 0) - - -def _periodic_element_boundary_capacity_signature(formula: str) -> tuple: - """Molecule-level boundary capacity read from native periodic element gonols. - - For bare elements attachment capacity is 0; boundary dim comes from element axes. - Encoded per-constituent for the composite (parallel to periodic_element_lifted_spiral). - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - sigs = [] - for sym, _count in comp: - receipt = construct_element_gonol(sym) - bc = boundary_capacity_from_element_receipt(receipt) - # bc = (3, dim, 0) - sigs.append(f"{sym}:{bc[0]},{bc[1]},{bc[2]}") - return tuple(sorted(sigs)) - - -def _subatomic_boundary_capacity_signature(formula: str) -> tuple: - """Molecule-level boundary capacity read from subatomic gonols. - - Bare subatomic gonols have attachment capacity 0. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - sigs = [] - for sym, _count in comp: - receipt = subatomic_gonol.construct_subatomic_gonol(sym) - bc = boundary_capacity_from_subatomic_receipt(receipt) - sigs.append(f"{sym}:{bc[0]},{bc[1]},{bc[2]}") - return tuple(sorted(sigs)) - - -def _quantify_distinguishing_power( - known_shapes: Mapping[str, str], - charged: Mapping[str, Any], - topology: Mapping[str, Any], - control: Mapping[str, Any], - harmonic: Mapping[str, Any] | None = None, - subatomic_harmonic: Mapping[str, Any] | None = None, - periodic_element_harmonic: Mapping[str, Any] | None = None, - per_symbol_harmonic: Mapping[str, Mapping[str, tuple[str, ...]]] | None = None, - lifted_spiral: Mapping[str, Any] | None = None, - periodic_element_lifted_spiral: Mapping[str, Any] | None = None, - subatomic_lifted_spiral: Mapping[str, Any] | None = None, - boundary_capacity: Mapping[str, Any] | None = None, - periodic_element_boundary_capacity: Mapping[str, Any] | None = None, - subatomic_boundary_capacity: Mapping[str, Any] | None = None, -) -> dict[str, Any]: - """Quantitative distinguishing power under the frozen preregistration policy. - - All metrics are computed after construction, using only the sealed known - shape labels for evaluation (never during construction). - """ - - known_partitions = _partitions(known_shapes) - charged_partitions = _partitions(charged) - topology_partitions = _partitions(topology) - control_partitions = _partitions(control) - harmonic_partitions = _partitions(harmonic or {}) - subatomic_harmonic_partitions = _partitions(subatomic_harmonic or {}) - - known_classes = len(known_partitions) - charged_classes = len(charged_partitions) - topology_classes = len(topology_partitions) - control_classes = len(control_partitions) - harmonic_classes = len(harmonic_partitions) - subatomic_harmonic_classes = len(subatomic_harmonic_partitions) - - # Splits / collapses relative to known - def _splits_and_collapses(sig: Mapping[str, Any]) -> tuple[int, int]: - by_shape: dict[str, set[Any]] = defaultdict(set) - for f, shape in known_shapes.items(): - by_shape[shape].add(sig[f]) - splits = sum(1 for vals in by_shape.values() if len(vals) > 1) - shapes = list(by_shape.keys()) - collapses = 0 - for i, left in enumerate(shapes): - for right in shapes[i + 1 :]: - if by_shape[left] & by_shape[right]: - collapses += 1 - return splits, collapses - - charged_splits, charged_collapses = _splits_and_collapses(charged) - topology_splits, topology_collapses = _splits_and_collapses(topology) - control_splits, control_collapses = _splits_and_collapses(control) - harmonic_splits, harmonic_collapses = _splits_and_collapses(harmonic) if harmonic else (0, 0) - subatomic_harmonic_splits, subatomic_harmonic_collapses = ( - _splits_and_collapses(subatomic_harmonic) if subatomic_harmonic else (0, 0) - ) - subatomic_lifted_spiral_splits, subatomic_lifted_spiral_collapses = ( - _splits_and_collapses(subatomic_lifted_spiral) if subatomic_lifted_spiral else (0, 0) - ) - - # Pairwise agreement tables - known_pw = _pairwise_counts(known_shapes, known_shapes) # sanity: all tp or tn - charged_pw = _pairwise_counts(known_shapes, charged) - topology_pw = _pairwise_counts(known_shapes, topology) - control_pw = _pairwise_counts(known_shapes, control) - harmonic_pw = _pairwise_counts(known_shapes, harmonic) if harmonic else {"tp": 0, "fp": 0, "fn": 0, "tn": 0, "total_pairs": 0} - subatomic_harmonic_pw = ( - _pairwise_counts(known_shapes, subatomic_harmonic) if subatomic_harmonic else {"tp": 0, "fp": 0, "fn": 0, "tn": 0, "total_pairs": 0} - ) - subatomic_lifted_spiral_pw = ( - _pairwise_counts(known_shapes, subatomic_lifted_spiral) if subatomic_lifted_spiral else {"tp": 0, "fp": 0, "fn": 0, "tn": 0, "total_pairs": 0} - ) - - # Per-symbol harmonic family (dict-of-dicts) must be canonicalized to flat signature tuples for partitioning. - per_symbol_harmonic_flat = {} - if per_symbol_harmonic: - for f, symmap in per_symbol_harmonic.items(): - per_symbol_harmonic_flat[f] = tuple(sorted(f"{s}:{','.join(vs)}" for s, vs in symmap.items())) - per_symbol_harmonic_partitions = _partitions(per_symbol_harmonic_flat) - per_symbol_harmonic_classes = len(per_symbol_harmonic_partitions) - per_symbol_harmonic_splits, per_symbol_harmonic_collapses = ( - _splits_and_collapses(per_symbol_harmonic_flat) if per_symbol_harmonic_flat else (0, 0) - ) - per_symbol_harmonic_pw = ( - _pairwise_counts(known_shapes, per_symbol_harmonic_flat) if per_symbol_harmonic_flat else {"tp": 0, "fp": 0, "fn": 0, "tn": 0, "total_pairs": 0} - ) - - # Exact partition matches - matches_known = _formula_sets(charged_partitions) == _formula_sets(known_partitions) - matches_control = _formula_sets(charged_partitions) == _formula_sets(control_partitions) - - # Harmonic family exact matches (symmetric to charged) - harmonic_matches_known = _formula_sets(harmonic_partitions) == _formula_sets(known_partitions) if harmonic else False - harmonic_matches_control = _formula_sets(harmonic_partitions) == _formula_sets(control_partitions) if harmonic else False - - # Periodic element harmonic family exact matches (symmetric to the other harmonic views) - periodic_element_harmonic_partitions = _partitions(periodic_element_harmonic or {}) - periodic_element_harmonic_matches_known = _formula_sets(periodic_element_harmonic_partitions) == _formula_sets(known_partitions) if periodic_element_harmonic else False - periodic_element_harmonic_matches_control = _formula_sets(periodic_element_harmonic_partitions) == _formula_sets(control_partitions) if periodic_element_harmonic else False - - # Per-symbol harmonic family exact matches (symmetric to the molecule-level harmonic family) - per_symbol_harmonic_matches_known = _formula_sets(per_symbol_harmonic_partitions) == _formula_sets(known_partitions) if per_symbol_harmonic_flat else False - per_symbol_harmonic_matches_control = _formula_sets(per_symbol_harmonic_partitions) == _formula_sets(control_partitions) if per_symbol_harmonic_flat else False - - # Simple information ratios (higher is more distinguishing relative to known) - def _ratio(classes: int) -> float: - return classes / known_classes if known_classes else 0.0 - - class_counts = { - "known_shapes": known_classes, - "charged_3_structure": charged_classes, - "topology_3_structure": topology_classes, - "stoichiometric_control": control_classes, - } - splits_known = { - "charged_3_structure": charged_splits, - "topology_3_structure": topology_splits, - "stoichiometric_control": control_splits, - } - collapses_across = { - "charged_3_structure": charged_collapses, - "topology_3_structure": topology_collapses, - "stoichiometric_control": control_collapses, - } - pairwise = { - "charged_3_structure": charged_pw, - "topology_3_structure": topology_pw, - "stoichiometric_control": control_pw, - } - ratios = { - "charged": _ratio(charged_classes), - "topology": _ratio(topology_classes), - "control": _ratio(control_classes), - } - - if harmonic: - class_counts["harmonic_survival"] = harmonic_classes - splits_known["harmonic_survival"] = harmonic_splits - collapses_across["harmonic_survival"] = harmonic_collapses - pairwise["harmonic_survival"] = harmonic_pw - ratios["harmonic"] = _ratio(harmonic_classes) - - if subatomic_harmonic: - class_counts["subatomic_harmonic_survival"] = subatomic_harmonic_classes - splits_known["subatomic_harmonic_survival"] = subatomic_harmonic_splits - collapses_across["subatomic_harmonic_survival"] = subatomic_harmonic_collapses - pairwise["subatomic_harmonic_survival"] = subatomic_harmonic_pw - ratios["subatomic_harmonic"] = _ratio(subatomic_harmonic_classes) - - if periodic_element_harmonic: - pe_partitions = _partitions(periodic_element_harmonic) - pe_classes = len(pe_partitions) - pe_splits, pe_collapses = _splits_and_collapses(periodic_element_harmonic) - pe_pw = _pairwise_counts(known_shapes, periodic_element_harmonic) - class_counts["periodic_element_harmonic_survival"] = pe_classes - splits_known["periodic_element_harmonic_survival"] = pe_splits - collapses_across["periodic_element_harmonic_survival"] = pe_collapses - pairwise["periodic_element_harmonic_survival"] = pe_pw - ratios["periodic_element_harmonic"] = _ratio(pe_classes) - - if periodic_element_lifted_spiral: - pel_partitions = _partitions(periodic_element_lifted_spiral) - pel_classes = len(pel_partitions) - pel_splits, pel_collapses = _splits_and_collapses(periodic_element_lifted_spiral) - pel_pw = _pairwise_counts(known_shapes, periodic_element_lifted_spiral) - class_counts["periodic_element_lifted_spiral"] = pel_classes - splits_known["periodic_element_lifted_spiral"] = pel_splits - collapses_across["periodic_element_lifted_spiral"] = pel_collapses - pairwise["periodic_element_lifted_spiral"] = pel_pw - ratios["periodic_element_lifted_spiral"] = _ratio(pel_classes) - - # Exact matches for the periodic element lifted spiral family - periodic_element_lifted_spiral_matches_known = _formula_sets(pel_partitions) == _formula_sets(known_partitions) - periodic_element_lifted_spiral_matches_control = _formula_sets(pel_partitions) == _formula_sets(control_partitions) - - if subatomic_lifted_spiral: - sal_partitions = _partitions(subatomic_lifted_spiral) - sal_classes = len(sal_partitions) - sal_splits, sal_collapses = _splits_and_collapses(subatomic_lifted_spiral) - sal_pw = _pairwise_counts(known_shapes, subatomic_lifted_spiral) - class_counts["subatomic_lifted_spiral"] = sal_classes - splits_known["subatomic_lifted_spiral"] = sal_splits - collapses_across["subatomic_lifted_spiral"] = sal_collapses - pairwise["subatomic_lifted_spiral"] = sal_pw - ratios["subatomic_lifted_spiral"] = _ratio(sal_classes) - - # Exact matches for the subatomic lifted spiral family - subatomic_lifted_spiral_matches_known = _formula_sets(sal_partitions) == _formula_sets(known_partitions) - subatomic_lifted_spiral_matches_control = _formula_sets(sal_partitions) == _formula_sets(control_partitions) - - if boundary_capacity: - bc_partitions = _partitions(boundary_capacity) - bc_classes = len(bc_partitions) - bc_splits, bc_collapses = _splits_and_collapses(boundary_capacity) - bc_pw = _pairwise_counts(known_shapes, boundary_capacity) - class_counts["boundary_capacity"] = bc_classes - splits_known["boundary_capacity"] = bc_splits - collapses_across["boundary_capacity"] = bc_collapses - pairwise["boundary_capacity"] = bc_pw - ratios["boundary_capacity"] = _ratio(bc_classes) - - # Exact matches for boundary capacity family - boundary_capacity_matches_known = _formula_sets(bc_partitions) == _formula_sets(known_partitions) - boundary_capacity_matches_control = _formula_sets(bc_partitions) == _formula_sets(control_partitions) - - if periodic_element_boundary_capacity: - pebc_partitions = _partitions(periodic_element_boundary_capacity) - pebc_classes = len(pebc_partitions) - pebc_splits, pebc_collapses = _splits_and_collapses(periodic_element_boundary_capacity) - pebc_pw = _pairwise_counts(known_shapes, periodic_element_boundary_capacity) - class_counts["periodic_element_boundary_capacity"] = pebc_classes - splits_known["periodic_element_boundary_capacity"] = pebc_splits - collapses_across["periodic_element_boundary_capacity"] = pebc_collapses - pairwise["periodic_element_boundary_capacity"] = pebc_pw - ratios["periodic_element_boundary_capacity"] = _ratio(pebc_classes) - - periodic_element_boundary_capacity_matches_known = _formula_sets(pebc_partitions) == _formula_sets(known_partitions) - periodic_element_boundary_capacity_matches_control = _formula_sets(pebc_partitions) == _formula_sets(control_partitions) - - if subatomic_boundary_capacity: - sabc_partitions = _partitions(subatomic_boundary_capacity) - sabc_classes = len(sabc_partitions) - sabc_splits, sabc_collapses = _splits_and_collapses(subatomic_boundary_capacity) - sabc_pw = _pairwise_counts(known_shapes, subatomic_boundary_capacity) - class_counts["subatomic_boundary_capacity"] = sabc_classes - splits_known["subatomic_boundary_capacity"] = sabc_splits - collapses_across["subatomic_boundary_capacity"] = sabc_collapses - pairwise["subatomic_boundary_capacity"] = sabc_pw - ratios["subatomic_boundary_capacity"] = _ratio(sabc_classes) - - subatomic_boundary_capacity_matches_known = _formula_sets(sabc_partitions) == _formula_sets(known_partitions) - subatomic_boundary_capacity_matches_control = _formula_sets(sabc_partitions) == _formula_sets(control_partitions) - - if per_symbol_harmonic and per_symbol_harmonic_flat: - class_counts["per_symbol_harmonic_survival"] = per_symbol_harmonic_classes - splits_known["per_symbol_harmonic_survival"] = per_symbol_harmonic_splits - collapses_across["per_symbol_harmonic_survival"] = per_symbol_harmonic_collapses - pairwise["per_symbol_harmonic_survival"] = per_symbol_harmonic_pw - ratios["per_symbol_harmonic"] = _ratio(per_symbol_harmonic_classes) - - if lifted_spiral: - # lifted_spiral values are carried canonical signatures (frames, axes, attach_count) - # already sourced from the molecule receipt (first-class carried fact). - spiral_sigs = {} - for f, sig in lifted_spiral.items(): - if isinstance(sig, (list, tuple)) and len(sig) == 3: - frames, axes, ac = sig - spiral_sigs[f] = (tuple(frames), tuple(sorted(axes)) if axes else (), int(ac)) - else: - spiral_sigs[f] = ((), (), 0) - spiral_partitions = _partitions(spiral_sigs) - spiral_classes = len(spiral_partitions) - spiral_splits, spiral_collapses = _splits_and_collapses(spiral_sigs) - spiral_pw = _pairwise_counts(known_shapes, spiral_sigs) - class_counts["lifted_spiral"] = spiral_classes - splits_known["lifted_spiral"] = spiral_splits - collapses_across["lifted_spiral"] = spiral_collapses - pairwise["lifted_spiral"] = spiral_pw - ratios["lifted_spiral"] = _ratio(spiral_classes) - - # Exact matches for spiral family - spiral_matches_known = _formula_sets(spiral_partitions) == _formula_sets(known_partitions) - spiral_matches_control = _formula_sets(spiral_partitions) == _formula_sets(control_partitions) - - return { - "class_counts": class_counts, - "splits_known_classes": splits_known, - "collapses_across_known_classes": collapses_across, - "pairwise_vs_known": pairwise, - "exact_partition_match": { - "charged_matches_known": matches_known, - "charged_matches_control": matches_control, - "harmonic_matches_known": harmonic_matches_known, - "harmonic_matches_control": harmonic_matches_control, - "periodic_element_harmonic_matches_known": periodic_element_harmonic_matches_known, - "periodic_element_harmonic_matches_control": periodic_element_harmonic_matches_control, - "per_symbol_harmonic_matches_known": per_symbol_harmonic_matches_known, - "per_symbol_harmonic_matches_control": per_symbol_harmonic_matches_control, - "lifted_spiral_matches_known": spiral_matches_known if lifted_spiral else False, - "lifted_spiral_matches_control": spiral_matches_control if lifted_spiral else False, - "periodic_element_lifted_spiral_matches_known": periodic_element_lifted_spiral_matches_known if periodic_element_lifted_spiral else False, - "periodic_element_lifted_spiral_matches_control": periodic_element_lifted_spiral_matches_control if periodic_element_lifted_spiral else False, - "subatomic_lifted_spiral_matches_known": subatomic_lifted_spiral_matches_known if subatomic_lifted_spiral else False, - "subatomic_lifted_spiral_matches_control": subatomic_lifted_spiral_matches_control if subatomic_lifted_spiral else False, - "boundary_capacity_matches_known": boundary_capacity_matches_known if boundary_capacity else False, - "boundary_capacity_matches_control": boundary_capacity_matches_control if boundary_capacity else False, - "periodic_element_boundary_capacity_matches_known": periodic_element_boundary_capacity_matches_known if periodic_element_boundary_capacity else False, - "periodic_element_boundary_capacity_matches_control": periodic_element_boundary_capacity_matches_control if periodic_element_boundary_capacity else False, - "subatomic_boundary_capacity_matches_known": subatomic_boundary_capacity_matches_known if subatomic_boundary_capacity else False, - "subatomic_boundary_capacity_matches_control": subatomic_boundary_capacity_matches_control if subatomic_boundary_capacity else False, - }, - "class_count_ratios_vs_known": ratios, - "note": "All metrics respect the frozen preregistration policy: construction never saw sealed labels.", - } - - -@lru_cache(maxsize=4) -def compare_after_construction(root: Path = EPAC_ROOT) -> dict[str, Any]: - """Construct first, then open the sealed shapes, then score standings. - - The comparison record is deterministic for a given root, so tests share a - cached record rather than rebuilding the full receipt surface repeatedly. - """ - - label_hits = construction_sources_omit_sealed_labels(root) - constructions = construct_declared_molecules() - charged = {} - topology = {} - mobius = {} - atomic = {} - control = {} - harmonic = {} - subatomic_harmonic = {} - periodic_element_harmonic = {} - periodic_element_lifted_spiral: dict[str, tuple] = {} - subatomic_lifted_spiral: dict[str, tuple] = {} - per_symbol: dict[str, dict[str, tuple[str, ...]]] = {} - lifted_spiral = {} - boundary_capacity: dict[str, tuple] = {} - periodic_element_boundary_capacity: dict[str, tuple] = {} - subatomic_boundary_capacity: dict[str, tuple] = {} - for formula, construction in constructions.items(): - structure = construction.receipt.structure - if structure is None: - raise ValueError(f"{formula} closed without a three-dimensional structure") - charged[formula] = charged_structure_readout(structure) - topology[formula] = topology_structure_readout(structure) - mobius[formula] = construction.invariants["ucns_coupling_signature"] - atomic[formula] = construction.invariants["atomic_coupling_signature"] - control[formula] = matched_information_control(construction.invariants) - - # Exclusively source the molecule-level harmonic survival from the carried - # fact on the molecule PublicGonol receipt. This is the single source of - # truth for the lifted nuclear harmonic layer at molecular scale. - harmonic[formula] = harmonic_survival_carried_on_molecule(construction) - - # Molecule-level lifted spiral from the carried fact on the molecule receipt - # (single source of truth, parallel to harmonic). - lifted_spiral[formula] = lifted_spiral_carried_on_molecule(construction) - - # The per-constituent (subatomic) view for the same formula. - subatomic_harmonic[formula] = construction.invariants["subatomic_harmonic_survival"] - - # The view through native periodic element gonols (also sourced from the - # same subatomic layer at construction time). - periodic_element_harmonic[formula] = _periodic_element_harmonic_survival_signature(formula) - - # Lifted spiral view through native periodic element gonols (first-class - # carried fact on element gonols, parallel to the molecule view). - periodic_element_lifted_spiral[formula] = _periodic_element_lifted_spiral_signature(formula) - - # Lifted spiral view through subatomic gonols (first-class carried fact - # on subatomic gonols, parallel to harmonic-surviving and to the other - # lifted-spiral families). - subatomic_lifted_spiral[formula] = _subatomic_lifted_spiral_signature(formula) - - # Boundary capacity (interior modes vs boundary dim vs coupling capacity) - # as a first-class family, sourced from the same carried facts. - boundary_capacity[formula] = _boundary_capacity_signature(formula, construction) - periodic_element_boundary_capacity[formula] = _periodic_element_boundary_capacity_signature(formula) - subatomic_boundary_capacity[formula] = _subatomic_boundary_capacity_signature(formula) - - # Cross-check: molecule-carried (from receipt) must equal the subatomic-derived union. - if harmonic[formula] != subatomic_harmonic[formula]: - raise AssertionError(f"molecule-carried harmonic mismatch for {formula}") - - # Cross-check: periodic element view must equal the subatomic view (all three families identical). - if periodic_element_harmonic[formula] != subatomic_harmonic[formula]: - raise AssertionError(f"periodic-element harmonic mismatch for {formula}") - - # Cross-check: the molecule carried (now sourced from element gonols at construction) - # must equal the direct periodic element gonol view for the same formula. - if harmonic[formula] != periodic_element_harmonic[formula]: - raise AssertionError(f"molecule harmonic not equal to element-gonol harmonic for {formula}") - - # Note on lifted spiral layers: - # The molecule-level lifted spiral (carried on the molecule receipt) includes - # the actual attachment slots and participant axes declared for the closed - # structure. The periodic element view is the bare-element projection (axes - # from element gonols, attachment count 0). They are intentionally different - # projections; both are first-class families for partitioning/quantify. - # No equality cross-check is imposed (unlike the harmonic-survival union rule). - - # Per-symbol harmonic survival sourced exclusively from the molecule receipt - # (single source of truth). Compute here for cross-checks. - per_symbol[formula] = per_symbol_harmonic_survival_carried_on_molecule(construction) - - # Cross-check: per-symbol carried on receipt must match the per-symbol view - # derived from the participating element gonols (lifted at construction). - # The receipt always carries every symbol in the composition (with "none" when empty). - elem_per_sym: dict[str, tuple[str, ...]] = {} - for sym, _cnt in MOLECULE_COMPOSITIONS.get(formula, ()): - eg = construct_element_gonol(sym) - hs = dict(eg.gonol.carried_options).get("harmonic-surviving", "none") - elem_per_sym[sym] = tuple(sorted(set(hs.split(",")))) if hs and hs != "none" else () - # Normalize receipt side (already has "none" for empty symbols) and compare. - if per_symbol[formula] != elem_per_sym: - raise AssertionError(f"per-symbol harmonic receipt != element-gonols for {formula}") - - # Canonical signatures for the lifted spiral family (first-class, parallel to harmonic families). - # Values are already the carried canonical signatures (frames_tuple, axes_tuple, attach_count) - # sourced exclusively from the molecule PublicGonol receipt (single source of truth). - spiral_sigs: dict[str, tuple] = {} - for f, sig in lifted_spiral.items(): - # sig is already the tuple; normalize to 3-tuple form defensively. - if isinstance(sig, (list, tuple)) and len(sig) == 3: - frames, axes, ac = sig - spiral_sigs[f] = (tuple(frames), tuple(sorted(axes)) if axes else (), int(ac)) - else: - spiral_sigs[f] = ((), (), 0) - - # Cross-layer determinism (carried values must match the subatomic gonol layer). - for f, c in constructions.items(): - if c.invariants["harmonic_survival"] != c.invariants["subatomic_harmonic_survival"]: - raise AssertionError(f"harmonic survival mismatch for {f}") - - sealed = json.loads((root / "data" / "sealed_known_molecular_geometry.json").read_text(encoding="utf-8")) - # known_shapes for standings and quantify_distinguishing_power is *always* restricted - # to the frozen original preregistered set, even when the sealed file or constructed - # set is enlarged for broader experiments. Policy is sealed on the original 5. - known_shapes = { - formula: sealed["molecules"][formula]["known_shape"] - for formula in ORIGINAL_PREREG - if formula in constructions and formula in sealed.get("molecules", {}) - } - - # per_symbol already populated inside the loop (receipt-sourced single source of truth) - # with cross-checks against element gonols. Recompute via helper for safety/readouts only. - for formula in list(per_symbol.keys()): - # No-op re-assert via the public helper to keep readouts in sync. - _ = _per_symbol_harmonic_survival_from_molecule(formula, constructions) - - quantify = _quantify_distinguishing_power( - known_shapes, charged, topology, control, harmonic, subatomic_harmonic, periodic_element_harmonic, per_symbol, lifted_spiral, periodic_element_lifted_spiral, subatomic_lifted_spiral, - boundary_capacity, periodic_element_boundary_capacity, subatomic_boundary_capacity - ) - - # Boundary-capacity transitions: record R0 -> R1 and B(R0) -> B(R1) for every declared molecule. - # The reproducibility test must be computable from source state + declared coupling operation only. - # No inspection of the finished target receipt or known empirical labels is allowed for the prediction. - transitions = { - f: boundary_capacity_transition_for_molecule(f, construction) - for f, construction in constructions.items() - } - all_transitions_reproducible = all(t.get("reproducible", False) for t in transitions.values()) - - # Compositional transition closure under local affixation steps only. - # Each step contributes only its local information (introduce a named atom instance, - # or affix one ligand contribution whose slot count comes solely from that ligand's record). - # Paths are built from every valid ordering of introduces followed by every valid ordering of affixes. - # We test: path independence of final B, local step reproducibility, and that accumulated B - # equals the direct carried B(R) without ever reading the finished target or known labels for deltas. - closure = compositional_boundary_closure() - - # The observed local transition signature (the law) for the current construction class. - # Any candidate geometric explanation (including a future UCNS continuum/gonal boundary trace) - # must reproduce these exact (Δd_∂, Δc_∂) values for the admissible local steps. - # Computed from local steps only (no target receipt, no global totals, no known labels). - local_transition_signature = observed_local_boundary_deltas() - - # Descriptor sufficiency / collision falsifier over the locked nine. - # Exhaustive EPAC-local enumeration of reachable states under declared sources and ops. - # Groups by B(R); classifies collisions by operational equivalence under replay/transition contract. - # No new coordinate invented; nine formulas frozen. - descriptor_sufficiency = boundary_capacity_descriptor_sufficiency_sweep() - - # Information-loss localization over the six sealed collision classes. - # Uses only already-declared operational data, records, invariants, participants, - # source/relation/digests. Identifies earliest distinguishable step while B identical - # and the smallest existing witness. No new coordinate. - information_loss = boundary_capacity_information_loss_localization() - - # Boundary-capacity quotient test. - # B(R1) = B(R2) ⇔ R1 ≡∂ R2 , where ≡∂ is indistinguishability under admissible - # boundary-capacity probes (B readout, attachment contributions K, attachment profiles, - # transition deltas) with all identifiers/labels withheld for distinction decisions. - # Converse check: different B are distinguishable by at least one admissible probe. - # Uses only the six sealed collision classes. No source_id or labels used to decide equivalence. - quotient = boundary_capacity_quotient_test() - - # Minimal behavioral refinement audit. - # Exhaustive search over all subsets of the four already-declared identity-free candidate - # observables (ligand_contribution_K, affix_Ks, attachment_profile, transition_deltas). - # For each D_S = B + S, compare the induced partition against the sealed full ≡∂ - # on all 27 frozen states (both directions). - # Identify exact matches, inclusion-minimal sets, fewest-observable sets, canonicality, - # and concrete witness pairs for rejected smaller candidates. - # No identity smuggled via absent probes or record shape. No new observables derived. - refinement_audit = boundary_capacity_minimal_refinement_audit() - - # Representation audit (capstone). - # Consolidates all prior stages with the final representation-equivalence check: - # whether B + the minimal already-declared identity-free observables exactly - # reproduces the sealed full admissible boundary behavior partition over the - # frozen states (identifiers withheld). - representation = epac_representation_audit() - - return { - "opened_after_construction": True, - "construction_omits_sealed_labels": not label_hits, - "sealed_label_hits": label_hits, - "known_shapes": known_shapes, - "readouts": { - "charged_3_structure": {formula: list(value) for formula, value in charged.items()}, - "topology_3_structure": {formula: list(value) for formula, value in topology.items()}, - "harmonic_survival": {formula: list(value) for formula, value in harmonic.items()}, - "subatomic_harmonic_survival": {formula: list(value) for formula, value in subatomic_harmonic.items()}, - "periodic_element_harmonic_survival": {formula: list(value) for formula, value in periodic_element_harmonic.items()}, - "per_symbol_harmonic_survival": {formula: {s: list(v) for s, v in per_symbol[formula].items()} for formula in per_symbol}, - "lifted_spiral": {formula: list(value) for formula, value in spiral_sigs.items()}, - "periodic_element_lifted_spiral": {formula: list(value) for formula, value in periodic_element_lifted_spiral.items()}, - "subatomic_lifted_spiral": {formula: list(value) for formula, value in subatomic_lifted_spiral.items()}, - "boundary_capacity": {formula: list(value) for formula, value in boundary_capacity.items()}, - "periodic_element_boundary_capacity": {formula: list(value) for formula, value in periodic_element_boundary_capacity.items()}, - "subatomic_boundary_capacity": {formula: list(value) for formula, value in subatomic_boundary_capacity.items()}, - }, - "partitions": { - "known_shapes": {shape: formulas for shape, formulas in _partitions(known_shapes).items()}, - "charged_3_structure": { - str(index): formulas for index, formulas in enumerate(_partitions(charged).values()) - }, - "topology_3_structure": { - str(index): formulas for index, formulas in enumerate(_partitions(topology).values()) - }, - "harmonic_survival": { - str(index): formulas for index, formulas in enumerate(_partitions(harmonic).values()) - }, - "subatomic_harmonic_survival": { - str(index): formulas for index, formulas in enumerate(_partitions(subatomic_harmonic).values()) - }, - "periodic_element_harmonic_survival": { - str(index): formulas for index, formulas in enumerate(_partitions(periodic_element_harmonic).values()) - }, - "per_symbol_harmonic_survival": { - str(index): formulas for index, formulas in enumerate(_partitions({f: tuple(sorted((s + ":" + ",".join(vs)) for s, vs in per_symbol[f].items())) for f in per_symbol}).values()) - }, - "lifted_spiral": { - str(index): formulas for index, formulas in enumerate(_partitions(spiral_sigs).values()) - }, - "periodic_element_lifted_spiral": { - str(index): formulas for index, formulas in enumerate(_partitions(periodic_element_lifted_spiral).values()) - }, - "subatomic_lifted_spiral": { - str(index): formulas for index, formulas in enumerate(_partitions(subatomic_lifted_spiral).values()) - }, - "boundary_capacity": { - str(index): formulas for index, formulas in enumerate(_partitions(boundary_capacity).values()) - }, - "periodic_element_boundary_capacity": { - str(index): formulas for index, formulas in enumerate(_partitions(periodic_element_boundary_capacity).values()) - }, - "subatomic_boundary_capacity": { - str(index): formulas for index, formulas in enumerate(_partitions(subatomic_boundary_capacity).values()) - }, - }, - "topology_collapses_h2o_with_co2": topology["H2O"] == topology["CO2"], - "charged_distinguishes_h2o_from_co2": charged["H2O"] != charged["CO2"], - "linear_class_split_by_charged_structure": charged["H2"] != charged["CO2"], - # Parallel facts for the carried nuclear harmonic survival signature. - "harmonic_collapses_h2o_with_co2": harmonic["H2O"] == harmonic["CO2"], - "harmonic_distinguishes_h2o_from_co2": harmonic["H2O"] != harmonic["CO2"], - "linear_class_split_by_harmonic_survival": harmonic["H2"] != harmonic["CO2"], - # Exact partition match facts for the harmonic family (symmetric to charged). - "harmonic_matches_known": quantify["exact_partition_match"]["harmonic_matches_known"], - "harmonic_matches_control": quantify["exact_partition_match"]["harmonic_matches_control"], - # Parallel facts for the nuclear harmonic survival via native periodic element gonols. - "periodic_element_harmonic_collapses_h2o_with_co2": periodic_element_harmonic["H2O"] == periodic_element_harmonic["CO2"], - "periodic_element_harmonic_distinguishes_h2o_from_co2": periodic_element_harmonic["H2O"] != periodic_element_harmonic["CO2"], - "linear_class_split_by_periodic_element_harmonic_survival": periodic_element_harmonic["H2"] != periodic_element_harmonic["CO2"], - "periodic_element_harmonic_matches_known": quantify["exact_partition_match"].get("periodic_element_harmonic_matches_known", False), - "periodic_element_harmonic_matches_control": quantify["exact_partition_match"].get("periodic_element_harmonic_matches_control", False), - # Parallel facts for the per-constituent-symbol nuclear harmonic survival (receipt-sourced). - "per_symbol_harmonic_collapses_h2o_with_co2": per_symbol.get("H2O", {}) == per_symbol.get("CO2", {}), - "per_symbol_harmonic_distinguishes_h2o_from_co2": per_symbol.get("H2O", {}) != per_symbol.get("CO2", {}), - "linear_class_split_by_per_symbol_harmonic_survival": per_symbol.get("H2", {}) != per_symbol.get("CO2", {}), - "per_symbol_harmonic_matches_known": quantify["exact_partition_match"].get("per_symbol_harmonic_matches_known", False), - "per_symbol_harmonic_matches_control": quantify["exact_partition_match"].get("per_symbol_harmonic_matches_control", False), - # Parallel facts for the lifted spiral (UCNS framed Möbius root-loop) first-class family (molecule receipt view). - "lifted_spiral_collapses_h2o_with_co2": spiral_sigs.get("H2O") == spiral_sigs.get("CO2"), - "lifted_spiral_distinguishes_h2o_from_co2": spiral_sigs.get("H2O") != spiral_sigs.get("CO2"), - "linear_class_split_by_lifted_spiral": spiral_sigs.get("H2") != spiral_sigs.get("CO2"), - "lifted_spiral_matches_known": quantify["exact_partition_match"].get("lifted_spiral_matches_known", False), - "lifted_spiral_matches_control": quantify["exact_partition_match"].get("lifted_spiral_matches_control", False), - # Parallel facts for the lifted spiral view through native periodic element gonols (first-class). - "periodic_element_lifted_spiral_collapses_h2o_with_co2": periodic_element_lifted_spiral.get("H2O") == periodic_element_lifted_spiral.get("CO2"), - "periodic_element_lifted_spiral_distinguishes_h2o_from_co2": periodic_element_lifted_spiral.get("H2O") != periodic_element_lifted_spiral.get("CO2"), - "linear_class_split_by_periodic_element_lifted_spiral": periodic_element_lifted_spiral.get("H2") != periodic_element_lifted_spiral.get("CO2"), - "periodic_element_lifted_spiral_matches_known": quantify["exact_partition_match"].get("periodic_element_lifted_spiral_matches_known", False), - "periodic_element_lifted_spiral_matches_control": quantify["exact_partition_match"].get("periodic_element_lifted_spiral_matches_control", False), - # Parallel facts for the lifted spiral view through subatomic gonols (first-class). - "subatomic_lifted_spiral_collapses_h2o_with_co2": subatomic_lifted_spiral.get("H2O") == subatomic_lifted_spiral.get("CO2"), - "subatomic_lifted_spiral_distinguishes_h2o_from_co2": subatomic_lifted_spiral.get("H2O") != subatomic_lifted_spiral.get("CO2"), - "linear_class_split_by_subatomic_lifted_spiral": subatomic_lifted_spiral.get("H2") != subatomic_lifted_spiral.get("CO2"), - "subatomic_lifted_spiral_matches_known": quantify["exact_partition_match"].get("subatomic_lifted_spiral_matches_known", False), - "subatomic_lifted_spiral_matches_control": quantify["exact_partition_match"].get("subatomic_lifted_spiral_matches_control", False), - # Parallel facts for boundary capacity (interior modes vs boundary dim/coupling capacity). - "boundary_capacity_collapses_h2o_with_co2": boundary_capacity.get("H2O") == boundary_capacity.get("CO2"), - "boundary_capacity_distinguishes_h2o_from_co2": boundary_capacity.get("H2O") != boundary_capacity.get("CO2"), - "linear_class_split_by_boundary_capacity": boundary_capacity.get("H2") != boundary_capacity.get("CO2"), - "boundary_capacity_matches_known": quantify["exact_partition_match"].get("boundary_capacity_matches_known", False), - "boundary_capacity_matches_control": quantify["exact_partition_match"].get("boundary_capacity_matches_control", False), - "periodic_element_boundary_capacity_collapses_h2o_with_co2": periodic_element_boundary_capacity.get("H2O") == periodic_element_boundary_capacity.get("CO2"), - "periodic_element_boundary_capacity_distinguishes_h2o_from_co2": periodic_element_boundary_capacity.get("H2O") != periodic_element_boundary_capacity.get("CO2"), - "linear_class_split_by_periodic_element_boundary_capacity": periodic_element_boundary_capacity.get("H2") != periodic_element_boundary_capacity.get("CO2"), - "periodic_element_boundary_capacity_matches_known": quantify["exact_partition_match"].get("periodic_element_boundary_capacity_matches_known", False), - "periodic_element_boundary_capacity_matches_control": quantify["exact_partition_match"].get("periodic_element_boundary_capacity_matches_control", False), - "subatomic_boundary_capacity_collapses_h2o_with_co2": subatomic_boundary_capacity.get("H2O") == subatomic_boundary_capacity.get("CO2"), - "subatomic_boundary_capacity_distinguishes_h2o_from_co2": subatomic_boundary_capacity.get("H2O") != subatomic_boundary_capacity.get("CO2"), - "linear_class_split_by_subatomic_boundary_capacity": subatomic_boundary_capacity.get("H2") != subatomic_boundary_capacity.get("CO2"), - "subatomic_boundary_capacity_matches_known": quantify["exact_partition_match"].get("subatomic_boundary_capacity_matches_known", False), - "subatomic_boundary_capacity_matches_control": quantify["exact_partition_match"].get("subatomic_boundary_capacity_matches_control", False), - # Boundary-capacity transition facts (R0 -> R1 with B(R0) -> B(R1)). - # Reproducibility must be computed from source state + declared coupling operation only. - "boundary_capacity_transitions": {f: { - "source_bs": list(t["source_bs"]), - "op": t["op"], - "actual_b": list(t["actual_b"]), - "predicted_b_from_source_and_op": list(t["predicted_b_from_source_and_op"]), - "reproducible": t["reproducible"], - } for f, t in transitions.items()}, - "boundary_capacity_transitions_all_reproducible": all_transitions_reproducible, - # Compositional transition closure under strictly local affixation steps only. - "boundary_capacity_compositional_closure": closure, - "boundary_capacity_compositional_path_independent": closure.get("all_formulas_exhibit_compositional_transition_closure", False), - "boundary_capacity_compositional_all_reproducible_locally": closure.get("all_formulas_exhibit_compositional_transition_closure", False), - # Descriptor sufficiency / collision falsifier (locked nine only). - # Exhaustive enumeration of reachable EPAC states from declared sources/ops. - # B(R) grouped; collisions classified by operational equivalence (replay/transition contract). - # No new coordinate; no extension of cases. - "boundary_capacity_descriptor_sufficiency": descriptor_sufficiency, - "boundary_capacity_sufficiency_status": descriptor_sufficiency.get("aggregate", {}).get("boundary_capacity_sufficiency", "UNRESOLVED"), - # Information-loss localization over the six sealed B collisions. - # Per-collision: earliest step while B identical, smallest existing witness, - # witness class. Recurring classes grouped. Only already-present EPAC data used. - "boundary_capacity_information_loss": information_loss, - "information_loss_localization_status": information_loss.get("aggregate", {}).get("information_loss_localization", "UNRESOLVED"), - # Boundary-capacity quotient test over the six sealed collisions. - # B(R1) == B(R2) ⇔ R1 ≡∂ R2 under admissible boundary probes (identifiers withheld). - # Converse: different B are probe-distinguishable. - "boundary_capacity_quotient": quotient, - "boundary_capacity_quotient_status": quotient.get("aggregate", {}).get("boundary_capacity_quotient", "UNRESOLVED"), - # Minimal behavioral refinement audit. - # Exhaustive over subsets of the four candidate observables against the sealed full ≡∂. - # Reports exact matches, inclusion-minimal sets, fewest-observable, canonicality, - # and witness pairs for non-exact smaller candidates. No identity, no new observables. - "boundary_capacity_minimal_refinement_audit": refinement_audit, - "minimal_behavioral_refinement_status": refinement_audit.get("aggregate", {}).get("minimal_behavioral_refinement", "UNRESOLVED"), - # Representation audit (capstone stage ledger). - # Consolidates the full progression and reports whether the refined descriptor - # (B + minimal already-declared identity-free observables) exactly reproduces - # the sealed full admissible boundary behavior partition. - "epac_representation_audit": representation, - "representation_audit_overall": representation.get("outputs", {}).get("overall", "UNRESOLVED"), - # Probe-relativity formalization (O ↦ Q_O ↦ D_min(O)). - # Uses the locked 27-state representation audit as immutable baseline. - # Only already-declared admissible observable surfaces; no new observables. - "epac_probe_relativity_formalization": epac_probe_relativity_formalization(), - "probe_relativity_overall": epac_probe_relativity_formalization().get("outputs", {}).get("overall", "UNRESOLVED"), - "standings": { - "charged_3_structure_as_sealed_shape_prediction": _standing(charged, known_shapes, control), - "topology_3_structure_as_sealed_shape_prediction": _standing(topology, known_shapes, control), - "ucns_mobius_as_sealed_shape_prediction": _standing(mobius, known_shapes, control), - "atomic_shells_as_sealed_shape_prediction": _standing(atomic, known_shapes, control), - "harmonic_survival_as_sealed_shape_prediction": _standing(harmonic, known_shapes, control), - "subatomic_harmonic_survival_as_sealed_shape_prediction": _standing(subatomic_harmonic, known_shapes, control), - "periodic_element_harmonic_survival_as_sealed_shape_prediction": _standing(periodic_element_harmonic, known_shapes, control), - "per_symbol_harmonic_survival_as_sealed_shape_prediction": _standing( - {f: tuple(sorted((s + ":" + ",".join(vs)) for s, vs in per_symbol[f].items())) for f in per_symbol}, - known_shapes, - control, - ), - "lifted_spiral_as_sealed_shape_prediction": _standing(spiral_sigs, known_shapes, control), - "periodic_element_lifted_spiral_as_sealed_shape_prediction": _standing(periodic_element_lifted_spiral, known_shapes, control), - "subatomic_lifted_spiral_as_sealed_shape_prediction": _standing(subatomic_lifted_spiral, known_shapes, control), - "boundary_capacity_as_sealed_shape_prediction": _standing(boundary_capacity, known_shapes, control), - "periodic_element_boundary_capacity_as_sealed_shape_prediction": _standing(periodic_element_boundary_capacity, known_shapes, control), - "subatomic_boundary_capacity_as_sealed_shape_prediction": _standing(subatomic_boundary_capacity, known_shapes, control), - }, - "quantify_distinguishing_power": quantify, - "nonclaims": ( - "not selected canon", - "not an imported VSEPR construction rule", - "not a cartesian embedding", - ), - "hmmm": ( - "whether a later mapping from charged 3-structure to empirical angles exists without importing VSEPR", - "exact UCNS geometric operation of each Public Gonol function position", - ), - } - - -__all__ = [ - "CONSTRUCTION_FILES", - "SEALED_PATH", - "SEALED_SHAPE_LABELS", - "ORIGINAL_PREREG", - "compare_after_construction", - "construction_sources_omit_sealed_labels", - "_harmonic_survival_signature", - "_subatomic_harmonic_survival_signature", - "_periodic_element_harmonic_survival_signature", - "_per_symbol_harmonic_survival_from_molecule", - "_quantify_distinguishing_power", # internal but useful for direct inspection -] diff --git a/research/epac/epac_cross_scale_closure.py b/research/epac/epac_cross_scale_closure.py deleted file mode 100644 index 698b80c..0000000 --- a/research/epac/epac_cross_scale_closure.py +++ /dev/null @@ -1,616 +0,0 @@ -"""Cross-scale boundary-capacity closure evidence for EPAC. - -This module is evidence-only. It consumes the implemented EPAC construction -APIs for subatomic gonols, periodic element gonols, and the locked molecule -formulas, then checks whether the boundary-capacity descriptor can be carried -compositionally from the lowest implemented source through molecule formation. - -No PCEA runtime, PCEA mapping, external physics claim, continuum theorem, or -UCNS internal inspection is performed here. -""" - -from __future__ import annotations - -from functools import lru_cache -from typing import Any, Mapping - -from epac_molecular import ( - MOLECULE_COMPOSITIONS, - apply_local_step, - boundary_capacity_carried_on_molecule, - construct_declared_molecules, - construct_molecule, - generate_compositional_paths, - lifted_spiral_carried_on_molecule, - matched_information_control, -) -from epac_periodic import ( - boundary_capacity_from_element_receipt, - construct_element_gonol, - lifted_spiral_carried_on_element, -) -from epac_public_gonol import ClosedPublicGonol, PublicGonolReceipt -from subatomic_gonol import ( - boundary_capacity_from_subatomic_receipt, - construct_subatomic_gonol, - lifted_spiral_carried_on_subatomic, -) - -# === MODULE_BUILD === -# id: epac_cross_scale_compositional_closure -# module_name: epac_cross_scale_closure -# module_kind: experiment -# summary: evidence-only audit of whether EPAC boundary capacity composes from subatomic gonols through periodic element gonols into the locked nine molecule formulas -# owner: The Interdependency -# public_surface: required_element_symbols, derive_element_boundary_from_subatomic, element_closure_ledger, formula_closure_ledger, control_like_partition_failure_disposition, cross_scale_compositional_closure -# internal_surface: _periodic_nucleus_axis, _periodic_electron_axis, _derive_element_axes, _scale_projected_molecule_axes, _partitions, _formula_sets -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: tests.test_cross_scale_compositional_closure -# rollout: imported by tests/docs as a research evidence surface; no constructor or runtime behavior changes -# rollback: remove this module and its tests/docs without changing locked molecule construction -# requires: epac_subatomic_gonol, epac_public_gonol -# since: 2026-09-07 -# unresolved: external physical interpretation; future alternate construction paths beyond the implemented EPAC stack -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: cross_scale_required_elements_are_locked_formula_inputs -# given: the locked nine EPAC molecule-forming formulas -# then: the closure audit enumerates exactly the distinct element constructions used by those formulas -# class: evidence -# -# id: subatomic_to_element_boundary_refines_shell_axes -# given: a subatomic element gonol receipt -# then: the element boundary descriptor is derived by refining subatomic shell participants into electron axes and comparing to the bare periodic element receipt -# class: construction -# -# id: cross_scale_element_refinement_is_path_independent -# given: alternative admissible shell/electron traversal orders for subatomic refinement -# then: the derived element boundary axes and descriptor are identical -# class: correctness -# -# id: cross_scale_formula_closure_replays_from_subatomic_sources -# given: any locked molecule formula -# then: compatible subatomic-derived elements can be projected as molecule atom axes, local affixation steps are reproducible, and the composed descriptor equals the locked molecule descriptor -# class: evidence -# -# id: subatomic_lifted_spiral_control_failure_is_classified -# given: the existing subatomic_lifted_spiral_matches_control assertion -# then: the audit classifies the exact-match flag as a stale or inapplicable partition-control fact rather than a compositional counterexample -# class: doctrine -# -# id: cross_scale_promotion_blocks_descriptor_injection -# given: a boundary descriptor bridge from subatomic to element or molecule -# then: promotion requires source-derived axes and local operations, not numerical coincidence, hard-coded scaling, or an expected final descriptor -# class: safety -# === END CONTRACTS === - - -SURVIVED = "SURVIVED" -FALSIFIED = "FALSIFIED" -UNRESOLVED = "UNRESOLVED" -BLOCKED = "BLOCKED" - -BoundaryCapacity = tuple[int, int, int] -LiftedSpiral = tuple[tuple[str, ...], tuple[str, ...], int] - -REFINEMENT_OPERATION_ID = "epac.boundary.subatomic-shells-to-periodic-electron-axes" -MOLECULE_OPERATION_ID = "epac.boundary.closed-elements-to-molecule-affixiation" - -DESCRIPTOR_SEMANTICS: Mapping[str, str] = { - "descriptor": "B(R) = (3, d_boundary, c_boundary)", - "interior_modes": "fixed three-turn double-cover mode count carried by the implemented EPAC receipts", - "subatomic_d_boundary": "count of subatomic lifted-spiral axes: nucleus plus shell participants", - "element_d_boundary": "count of periodic element lifted-spiral axes: nucleus plus electron axes", - "molecule_d_boundary": "count of closed element gonol participant axes at molecule scale", - "c_boundary": "count of declared valence attachment slots; bare subatomic and bare element states carry zero", - "scale_rule": "a closed Public Gonol is atomic at any later participation, so lower-scale internal axes are refined or projected by an explicit local operation instead of conserved as molecule axes", -} - - -def required_element_symbols() -> tuple[str, ...]: - """Return distinct symbols actually used by the locked formula set.""" - seen: list[str] = [] - for composition in MOLECULE_COMPOSITIONS.values(): - for symbol, _count in composition: - if symbol not in seen: - seen.append(symbol) - return tuple(seen) - - -def _required_by_formulas(symbol: str) -> tuple[str, ...]: - return tuple( - formula - for formula, composition in MOLECULE_COMPOSITIONS.items() - if any(item_symbol == symbol for item_symbol, _count in composition) - ) - - -def _carried(item: ClosedPublicGonol | PublicGonolReceipt) -> dict[str, str]: - gonol = item.gonol if isinstance(item, PublicGonolReceipt) else item - return dict(gonol.carried_options) - - -def _participant_relations(receipt: PublicGonolReceipt) -> tuple[str, ...]: - return tuple(participant.relation for participant in receipt.gonol.participants) - - -def _subatomic_nucleus(receipt: PublicGonolReceipt) -> ClosedPublicGonol: - for participant in receipt.gonol.participants: - if participant.relation == "epac.subatomic.nucleus": - return participant - raise ValueError(f"{receipt.source_id}: no subatomic nucleus participant") - - -def _subatomic_shells(receipt: PublicGonolReceipt) -> tuple[ClosedPublicGonol, ...]: - shells = tuple( - participant - for participant in receipt.gonol.participants - if participant.relation == "epac.atomic.shell" - and participant.source_id.startswith("epac.subatomic.shell:") - ) - if not shells: - raise ValueError(f"{receipt.source_id}: no subatomic shell participants") - return shells - - -def _periodic_nucleus_axis(subatomic_source_id: str) -> str: - prefix = "epac.subatomic.nucleus:" - if not subatomic_source_id.startswith(prefix): - raise ValueError(f"not a subatomic nucleus source id: {subatomic_source_id}") - return "epac.nucleus:" + subatomic_source_id[len(prefix) :] - - -def _periodic_electron_axis(subatomic_source_id: str) -> str: - prefix = "epac.subatomic.electron:" - if not subatomic_source_id.startswith(prefix): - raise ValueError(f"not a subatomic electron source id: {subatomic_source_id}") - return "epac.electron:" + subatomic_source_id[len(prefix) :] - - -def _derive_element_axes( - receipt: PublicGonolReceipt, - *, - reverse_shells: bool = False, - reverse_electrons: bool = False, -) -> tuple[str, ...]: - """Refine subatomic shell axes into periodic element electron axes. - - This is the only subatomic-to-element boundary operation used by the audit. - It reads the source receipt's participant tree and performs a namespace - projection. It does not inspect the target element receipt or an expected - descriptor. - """ - axes: list[str] = [_periodic_nucleus_axis(_subatomic_nucleus(receipt).source_id)] - shells = list(_subatomic_shells(receipt)) - if reverse_shells: - shells.reverse() - for shell in shells: - electrons = [ - participant - for participant in shell.participants - if participant.relation == "epac.atomic.electron" - ] - if reverse_electrons: - electrons.reverse() - for electron in electrons: - axes.append(_periodic_electron_axis(electron.source_id)) - return tuple(sorted(axes)) - - -def _refinement_path_variants(receipt: PublicGonolReceipt) -> dict[str, tuple[str, ...]]: - return { - "declared": _derive_element_axes(receipt), - "reverse_shells": _derive_element_axes(receipt, reverse_shells=True), - "reverse_electrons": _derive_element_axes(receipt, reverse_electrons=True), - "reverse_both": _derive_element_axes( - receipt, - reverse_shells=True, - reverse_electrons=True, - ), - } - - -def derive_element_boundary_from_subatomic( - receipt: PublicGonolReceipt, -) -> dict[str, Any]: - """Derive the periodic element boundary descriptor from one subatomic receipt.""" - source_spiral = lifted_spiral_carried_on_subatomic(receipt) - frames = tuple(source_spiral[0]) if source_spiral and len(source_spiral) == 3 else () - axes = _derive_element_axes(receipt) - lifted_spiral: LiftedSpiral = (frames, axes, 0) - return { - "operation_id": REFINEMENT_OPERATION_ID, - "source_boundary_capacity": boundary_capacity_from_subatomic_receipt(receipt), - "source_lifted_spiral": source_spiral, - "source_attachment_count_zero": bool( - source_spiral and len(source_spiral) == 3 and int(source_spiral[2]) == 0 - ), - "derived_lifted_spiral": lifted_spiral, - "derived_boundary_capacity": (3, len(axes), 0), - "derived_from": ( - "subatomic nucleus participant", - "subatomic shell electron children", - "local namespace projection", - ), - "descriptor_injected": False, - } - - -@lru_cache(maxsize=None) -def element_closure_ledger(symbol: str, occurrence: int = 0) -> dict[str, Any]: - """Return the subatomic-to-element provenance and closure ledger.""" - subatomic_receipt = construct_subatomic_gonol(symbol, occurrence=occurrence) - bare_element_receipt = construct_element_gonol(symbol, occurrence=occurrence) - derived = derive_element_boundary_from_subatomic(subatomic_receipt) - - bare_lifted_spiral = lifted_spiral_carried_on_element(bare_element_receipt) - bare_boundary_capacity = boundary_capacity_from_element_receipt(bare_element_receipt) - path_variants = _refinement_path_variants(subatomic_receipt) - unique_variant_axes = {axes for axes in path_variants.values()} - - subatomic_options = _carried(subatomic_receipt) - bare_element_options = _carried(bare_element_receipt) - common_fields = ( - "symbol", - "Z", - "period", - "group", - "A", - "electron-configuration", - "valence-electrons", - ) - common_field_matches = { - field: subatomic_options.get(field) == bare_element_options.get(field) - for field in common_fields - } - harmonic_survival_matches = ( - subatomic_options.get("harmonic-surviving", "none") - == bare_element_options.get("harmonic-surviving", "none") - ) - - derived_lifted_spiral = derived["derived_lifted_spiral"] - boundary_matches = derived["derived_boundary_capacity"] == bare_boundary_capacity - axes_match = derived_lifted_spiral[1] == bare_lifted_spiral[1] - frames_match = derived_lifted_spiral[0] == bare_lifted_spiral[0] - path_independent = len(unique_variant_axes) == 1 - source_reproducible = bool(derived["source_attachment_count_zero"]) - field_compatible = all(common_field_matches.values()) and harmonic_survival_matches - status = ( - SURVIVED - if ( - boundary_matches - and axes_match - and frames_match - and path_independent - and source_reproducible - and field_compatible - and not derived["descriptor_injected"] - ) - else FALSIFIED - ) - - return { - "symbol": symbol, - "occurrence": occurrence, - "required_by_formulas": _required_by_formulas(symbol), - "source_state": { - "source_id": subatomic_receipt.source_id, - "relation": subatomic_receipt.gonol.relation, - "receipt_digest": subatomic_receipt.receipt_digest, - "participant_relations": _participant_relations(subatomic_receipt), - "source_boundary_capacity": derived["source_boundary_capacity"], - }, - "local_operation": { - "operation_id": REFINEMENT_OPERATION_ID, - "rule": "refine each subatomic shell participant into its electron child axes, then project subatomic ids into periodic element ids", - "uses_future_molecule": False, - "uses_target_descriptor": False, - "descriptor_injected": derived["descriptor_injected"], - }, - "derived_element": { - "lifted_spiral": derived_lifted_spiral, - "boundary_capacity": derived["derived_boundary_capacity"], - }, - "bare_element": { - "source_id": bare_element_receipt.source_id, - "relation": bare_element_receipt.gonol.relation, - "receipt_digest": bare_element_receipt.receipt_digest, - "lifted_spiral": bare_lifted_spiral, - "boundary_capacity": bare_boundary_capacity, - }, - "compatibility": { - "boundary_capacity_matches_bare_element": boundary_matches, - "axes_match_bare_element": axes_match, - "frames_match_bare_element": frames_match, - "common_field_matches": common_field_matches, - "harmonic_survival_matches": harmonic_survival_matches, - "source_attachment_count_zero": source_reproducible, - }, - "path_independence": { - "admissible_variants": tuple(path_variants), - "variant_axes": path_variants, - "path_independent": path_independent, - }, - "status": status, - } - - -def _scale_projected_molecule_axes(formula: str) -> tuple[str, ...]: - axes: list[str] = [] - occurrence = 0 - for symbol, count in MOLECULE_COMPOSITIONS[formula]: - for _ in range(count): - axes.append(f"{symbol}#{occurrence}") - occurrence += 1 - return tuple(sorted(axes)) - - -def _element_instances_for_formula(formula: str) -> tuple[dict[str, Any], ...]: - instances: list[dict[str, Any]] = [] - occurrence = 0 - for symbol, count in MOLECULE_COMPOSITIONS[formula]: - for _ in range(count): - ledger = element_closure_ledger(symbol, occurrence) - instances.append( - { - "symbol": symbol, - "occurrence": occurrence, - "molecule_axis": f"{symbol}#{occurrence}", - "derived_element_boundary_capacity": ledger["derived_element"][ - "boundary_capacity" - ], - "bare_element_boundary_capacity": ledger["bare_element"][ - "boundary_capacity" - ], - "compatible": ledger["status"] == SURVIVED, - } - ) - occurrence += 1 - return tuple(instances) - - -def _consume_introduced_instances( - path: list[tuple[str, str]], - instances: tuple[dict[str, Any], ...], -) -> bool: - available: dict[str, int] = {} - for instance in instances: - if instance["compatible"]: - available[instance["symbol"]] = available.get(instance["symbol"], 0) + 1 - for kind, symbol in path: - if kind != "introduce": - continue - if available.get(symbol, 0) <= 0: - return False - available[symbol] -= 1 - return True - - -@lru_cache(maxsize=None) -def formula_closure_ledger(formula: str) -> dict[str, Any]: - """Return the end-to-end subatomic-to-molecule closure ledger.""" - if formula not in MOLECULE_COMPOSITIONS: - raise ValueError(f"formula {formula!r} is outside the declared run") - - construction = construct_molecule(formula) - direct_b = boundary_capacity_carried_on_molecule(construction) - direct_spiral = lifted_spiral_carried_on_molecule(construction) - instances = _element_instances_for_formula(formula) - projected_axes = _scale_projected_molecule_axes(formula) - projected_axes_match_direct = projected_axes == direct_spiral[1] - - paths = generate_compositional_paths(formula) - finals: list[BoundaryCapacity] = [] - path_consumption = [] - step_deltas: dict[tuple[str, str], set[tuple[int, int]]] = {} - for path in paths: - path_consumption.append(_consume_introduced_instances(path, instances)) - b: BoundaryCapacity = (3, 0, 0) - for step in path: - before = b - b = apply_local_step(b, step) - step_deltas.setdefault(step, set()).add( - (b[1] - before[1], b[2] - before[2]) - ) - finals.append(b) - - unique_finals = tuple(sorted(set(finals))) - path_independent = len(unique_finals) == 1 - local_steps_reproducible = all(len(deltas) == 1 for deltas in step_deltas.values()) - consumes_only_compatible_elements = all(path_consumption) if paths else False - composed_b = unique_finals[0] if path_independent and unique_finals else None - direct_composed_agreement = composed_b == direct_b - status = ( - SURVIVED - if ( - consumes_only_compatible_elements - and projected_axes_match_direct - and path_independent - and local_steps_reproducible - and direct_composed_agreement - ) - else FALSIFIED - ) - - return { - "formula": formula, - "composition": MOLECULE_COMPOSITIONS[formula], - "operation_id": MOLECULE_OPERATION_ID, - "element_instances": instances, - "molecule_projection": { - "rule": "each compatible closed element gonol contributes one molecule-scale atom axis; affix steps add local ligand valence-slot counts", - "projected_axes": projected_axes, - "direct_molecule_axes": direct_spiral[1], - "projected_axes_match_direct": projected_axes_match_direct, - "uses_future_molecule_descriptor": False, - "descriptor_injected": False, - }, - "paths": { - "count": len(paths), - "unique_composed_boundary_capacity": unique_finals, - "path_independent": path_independent, - "local_steps_reproducible": local_steps_reproducible, - "consumes_only_compatible_elements": consumes_only_compatible_elements, - }, - "direct_boundary_capacity": direct_b, - "composed_boundary_capacity": composed_b, - "direct_composed_agreement": direct_composed_agreement, - "status": status, - } - - -def _partitions(values: Mapping[str, Any]) -> dict[Any, tuple[str, ...]]: - groups: dict[Any, list[str]] = {} - for formula, value in values.items(): - groups.setdefault(value, []).append(formula) - return { - value: tuple(sorted(formulas)) - for value, formulas in groups.items() - } - - -def _formula_sets(partitions: Mapping[Any, tuple[str, ...]]) -> frozenset[frozenset[str]]: - return frozenset(frozenset(group) for group in partitions.values()) - - -def _subatomic_lifted_spiral_signature(formula: str) -> tuple[str, ...]: - sigs: list[str] = [] - for symbol, _count in MOLECULE_COMPOSITIONS[formula]: - receipt = construct_subatomic_gonol(symbol) - frames, axes, attachment_count = lifted_spiral_carried_on_subatomic(receipt) - sigs.append( - f"{symbol}:{'|'.join(frames)};{','.join(axes)};{attachment_count}" - ) - return tuple(sorted(sigs)) - - -def control_like_partition_failure_disposition() -> dict[str, Any]: - """Classify the subatomic lifted-spiral/control partition assertion.""" - constructions = construct_declared_molecules() - subatomic_projection = { - formula: _subatomic_lifted_spiral_signature(formula) - for formula in MOLECULE_COMPOSITIONS - } - stoichiometric_control = { - formula: matched_information_control(construction.invariants) - for formula, construction in constructions.items() - } - subatomic_partitions = _partitions(subatomic_projection) - control_partitions = _partitions(stoichiometric_control) - matches_control = _formula_sets(subatomic_partitions) == _formula_sets( - control_partitions - ) - classification = ( - "stale_or_incorrect_control_assertion" - if matches_control - else "inapplicable_control_comparison" - ) - return { - "observed_subatomic_lifted_spiral_matches_control": matches_control, - "classification": classification, - "compositional_counterexample": False, - "status": SURVIVED, - "subatomic_projection_semantics": "bare subatomic lifted-spiral projection over distinct composition entries; attachment_count is zero", - "control_semantics": "molecule-scale stoichiometric control over atom_count, center_symbol, and ligand_symbols", - "reason": "the control exact-match flag is a partition-resemblance fact, not a direct/composed boundary-transition invariant; on the current nine-formula surface a prior false expectation is stale because both partitions are singletons", - "subatomic_partition_count": len(subatomic_partitions), - "control_partition_count": len(control_partitions), - } - - -@lru_cache(maxsize=1) -def cross_scale_compositional_closure() -> dict[str, Any]: - """Run the bounded EPAC cross-scale compositional-closure audit.""" - symbols = required_element_symbols() - element_ledgers = {symbol: element_closure_ledger(symbol) for symbol in symbols} - formula_ledgers = { - formula: formula_closure_ledger(formula) - for formula in MOLECULE_COMPOSITIONS - } - control_disposition = control_like_partition_failure_disposition() - - subatomic_to_element_status = ( - SURVIVED - if all(ledger["status"] == SURVIVED for ledger in element_ledgers.values()) - else FALSIFIED - ) - element_state_compatibility_status = ( - SURVIVED - if all( - ledger["compatibility"]["boundary_capacity_matches_bare_element"] - and ledger["compatibility"]["axes_match_bare_element"] - and ledger["compatibility"]["frames_match_bare_element"] - and all(ledger["compatibility"]["common_field_matches"].values()) - and ledger["compatibility"]["harmonic_survival_matches"] - for ledger in element_ledgers.values() - ) - else FALSIFIED - ) - end_to_end_status = ( - SURVIVED - if all(ledger["status"] == SURVIVED for ledger in formula_ledgers.values()) - else FALSIFIED - ) - boundary_capacity_status = ( - SURVIVED - if ( - subatomic_to_element_status == SURVIVED - and element_state_compatibility_status == SURVIVED - and end_to_end_status == SURVIVED - and not control_disposition["compositional_counterexample"] - ) - else FALSIFIED - ) - - return { - "decision": "EPAC boundary capacity composes across the presently implemented subatomic -> element -> molecule stack for the locked nine formulas, under the explicit shell-refinement and closed-gonol projection rules tested here.", - "scope": { - "formulas": tuple(MOLECULE_COMPOSITIONS), - "required_elements": symbols, - "hard_exclusions": ( - "no UCNS internal inspection", - "no PCEA mapping", - "no external physics or chemistry claim", - "no continuum theorem", - "no runtime encoding", - "no locked evidence modification", - ), - }, - "descriptor_semantics": dict(DESCRIPTOR_SEMANTICS), - "element_ledgers": element_ledgers, - "formula_ledgers": formula_ledgers, - "control_like_partition_failure": control_disposition, - "statuses": { - "subatomic_to_element_closure": subatomic_to_element_status, - "element_state_compatibility": element_state_compatibility_status, - "end_to_end_subatomic_to_molecule_closure": end_to_end_status, - "boundary_capacity_compositionality": boundary_capacity_status, - }, - "requires_more": ( - "external physical interpretation remains outside this EPAC evidence layer", - "future alternate element or molecule construction paths must be added to this audit before claiming path independence over them", - "no continuum or runtime channel encoding is derived here", - ), - } - - -__all__ = [ - "BLOCKED", - "DESCRIPTOR_SEMANTICS", - "FALSIFIED", - "MOLECULE_OPERATION_ID", - "REFINEMENT_OPERATION_ID", - "SURVIVED", - "UNRESOLVED", - "control_like_partition_failure_disposition", - "cross_scale_compositional_closure", - "derive_element_boundary_from_subatomic", - "element_closure_ledger", - "formula_closure_ledger", - "required_element_symbols", -] diff --git a/research/epac/epac_dimensional_arity.py b/research/epac/epac_dimensional_arity.py deleted file mode 100644 index feaf55b..0000000 --- a/research/epac/epac_dimensional_arity.py +++ /dev/null @@ -1,645 +0,0 @@ -"""Declared dimensional arity, orientation, and degree. - -Dimension tells where. Arity tells what intersects at once. Degree tells how -a dimension is incident on declared couplings. - -``(z, x)`` is not ``(x, z)``. Shared members of ``(x, z)`` and ``(y, z)`` do -not yield ``(x, y, z)`` without an explicit proof. Overlap is not a proof. - -Every physical instance of ``x`` has its own declared ``(z, x_i)``. Every -physical instance of ``y`` has its own declared ``(z, y_j)``. A second -occurrence is a second instance, not a reuse of the first coupling. -``(x_i, z)`` does not satisfy ``(z, x_i)``. Letters and abbreviations are -not this domain. At atomic scale the instances are electrons and the hub is -the nucleus. At molecular scale the instances are closed atom gonols. - -The three-dimensional structure is the combination of declared oriented -couplings, their arity charge states, and degree. That span can involve three -axes through two charged binaries. It is not a ternary coupling. - -Representing that 3 takes 4 dimensions: a quaternion. The extra coordinate is -the scalar (Möbius ε already in the math). It is not a fourth ambient axis, -not Minkowski time, and not a Hamilton-product proof of ``(x, y, z)``. - -Domain claims (provisional): - -- dimension: independent coordinate axis -- arity: number of dimensions in one declared coupling -- degree: incidence of one dimension on declared couplings, including slot -- coupling: ordered declaration of participating dimensions -- charge state: per-slot charges on a coupling, with Möbius ε at t=0 -- instance: occurrence-addressed physical axis or atom; each x_i / y_j is distinct -- quaternion: 4-component representation of one local 3-structure - -Collision: edcm.gonol arity_policy counts gonol participants, not dimensional -intersections. Letters/abbreviations are nomenclature, not physics instances. -Quaternion basis names are representation labels, not letters-as-physics. -""" - -from __future__ import annotations - -from collections.abc import Iterable, Mapping, Sequence -from dataclasses import dataclass - - -# Established UCNS Möbius frame sign at t=0: ε in (t, ε) ~ (t+n, (-1)^n ε). -MOBIUS_EPSILON_T0 = 1 -REPRESENTED_STRUCTURE_DIMENSION = 3 -QUATERNION_REPRESENTATION_DIMENSION = 4 -QUATERNION_SCALAR_AXIS = "epac.representation.quaternion.scalar" - -FORBIDDEN_INFERENCE_RULES = frozenset( - { - "ambient-power-set", - "overlap-closure", - "permutation-identity", - "shared-dimension-join", - "hamilton-product-closure", - } -) - - -class DimensionalArityError(ValueError): - """Fail-closed dimensional arity error.""" - - -@dataclass(frozen=True, slots=True) -class Dimension: - """One independent coordinate axis, with optional established charge.""" - - id: str - charge: int | None = None - - def __post_init__(self) -> None: - if not isinstance(self.id, str) or not self.id or self.id.isspace(): - raise DimensionalArityError("dimension id must be exact non-empty text") - if self.charge is not None and (isinstance(self.charge, bool) or not isinstance(self.charge, int)): - raise DimensionalArityError("dimension charge must be an int or None") - - -@dataclass(frozen=True, slots=True) -class Coupling: - """One explicitly declared ordered intersection of dimensions.""" - - dimensions: tuple[Dimension, ...] - - def __post_init__(self) -> None: - if not self.dimensions: - raise DimensionalArityError("a coupling must declare at least one dimension") - ids = [dimension.id for dimension in self.dimensions] - if len(ids) != len(set(ids)): - raise DimensionalArityError("a coupling cannot repeat a dimension") - - @property - def arity(self) -> int: - return len(self.dimensions) - - @property - def declared_ids(self) -> tuple[str, ...]: - return tuple(dimension.id for dimension in self.dimensions) - - @property - def slot_charges(self) -> tuple[int | None, ...]: - return tuple(dimension.charge for dimension in self.dimensions) - - @property - def charge_state(self) -> tuple[tuple[int | None, ...], int]: - """Per-slot charges plus Möbius ε at t=0. Ordered: (z,x) ≠ (x,z).""" - - return (self.slot_charges, MOBIUS_EPSILON_T0) - - -@dataclass(frozen=True, slots=True) -class DegreeRelation: - """How one dimension sits in declared couplings. - - degree is the number of incidences. slot_degrees counts incidences at each - ordered position. (z,x) puts z in slot 0; (x,z) puts z in slot 1. - """ - - dimension: Dimension - incidences: tuple[tuple[tuple[str, ...], int], ...] - - @property - def degree(self) -> int: - return len(self.incidences) - - @property - def slot_degrees(self) -> tuple[tuple[int, int], ...]: - counts: dict[int, int] = {} - for _declared, slot in self.incidences: - counts[slot] = counts.get(slot, 0) + 1 - return tuple(sorted(counts.items())) - - -@dataclass(frozen=True, slots=True) -class CouplingProof: - """Certificate required before a higher-arity coupling may be installed.""" - - conclusion: Coupling - premises: tuple[Coupling, ...] - rule_id: str - - def __post_init__(self) -> None: - if not isinstance(self.rule_id, str) or not self.rule_id or self.rule_id.isspace(): - raise DimensionalArityError("a coupling proof must declare a non-empty rule_id") - if self.rule_id in FORBIDDEN_INFERENCE_RULES: - raise DimensionalArityError( - f"rule {self.rule_id!r} is not a proof; overlap/permutation/ambient fill are forbidden" - ) - if not self.premises: - raise DimensionalArityError("a coupling proof must cite at least one premise coupling") - - -@dataclass(frozen=True, slots=True) -class DimensionalSpace: - """Ambient axes, declared couplings, degree relations, and optional proofs.""" - - ambient_dimensions: tuple[Dimension, ...] - couplings: tuple[Coupling, ...] - proofs: tuple[CouplingProof, ...] = () - - def __post_init__(self) -> None: - ambient_ids = [dimension.id for dimension in self.ambient_dimensions] - if len(ambient_ids) != len(set(ambient_ids)): - raise DimensionalArityError("ambient dimensions must be unique") - ambient = set(ambient_ids) - for item in self.couplings: - missing = [name for name in item.declared_ids if name not in ambient] - if missing: - raise DimensionalArityError( - f"coupling {item.declared_ids} uses undeclared dimensions {tuple(missing)}" - ) - declared = {item.declared_ids for item in self.couplings} - for proof in self.proofs: - conclusion_missing = [ - name for name in proof.conclusion.declared_ids if name not in ambient - ] - if conclusion_missing: - raise DimensionalArityError( - f"proof {proof.rule_id!r} conclusion uses undeclared dimensions {tuple(conclusion_missing)}" - ) - if proof.conclusion.declared_ids not in declared: - raise DimensionalArityError( - f"proof {proof.rule_id!r} conclusion {proof.conclusion.declared_ids} is not declared" - ) - for premise in proof.premises: - if premise.declared_ids not in declared: - raise DimensionalArityError( - f"proof {proof.rule_id!r} cites missing premise {premise.declared_ids}" - ) - - -def _require_dimension_id_sequence(value: Sequence[str], *, field: str) -> tuple[str, ...]: - if not isinstance(value, Sequence) or isinstance(value, (str, bytes)): - raise DimensionalArityError(f"{field} must be an ordered declaration sequence") - return tuple(value) - - -def dimension(id: str, charge: int | None = None) -> Dimension: - return Dimension(id, charge) - - -def coupling(dimension_ids: Sequence[str], charges: Mapping[str, int] | None = None) -> Coupling: - ids = _require_dimension_id_sequence(dimension_ids, field="coupling dimensions") - charge_map = dict(charges or {}) - return Coupling(tuple(Dimension(item, charge_map.get(item)) for item in ids)) - - -def space( - ambient_ids: Sequence[str], - coupling_declarations: Sequence[Sequence[str]] = (), - proofs: Sequence[CouplingProof] = (), - charges: Mapping[str, int] | None = None, -) -> DimensionalSpace: - ambient_ids = _require_dimension_id_sequence(ambient_ids, field="ambient dimensions") - charge_map = dict(charges or {}) - ambient = tuple(Dimension(item, charge_map.get(item)) for item in ambient_ids) - by_id = {item.id: item for item in ambient} - declared = [] - for item in coupling_declarations: - ids = _require_dimension_id_sequence(item, field="each coupling declaration") - declared.append(Coupling(tuple(by_id[name] if name in by_id else Dimension(name) for name in ids))) - return DimensionalSpace( - ambient_dimensions=ambient, - couplings=tuple(declared), - proofs=tuple(proofs), - ) - - -def degree_relations(declared: DimensionalSpace) -> tuple[DegreeRelation, ...]: - incidences: dict[str, list[tuple[tuple[str, ...], int]]] = { - item.id: [] for item in declared.ambient_dimensions - } - for item in declared.couplings: - for slot, axis in enumerate(item.dimensions): - incidences[axis.id].append((item.declared_ids, slot)) - return tuple( - DegreeRelation(dimension=axis, incidences=tuple(incidences[axis.id])) - for axis in declared.ambient_dimensions - ) - - -def observed_common_ids(left: Coupling, right: Coupling) -> frozenset[str]: - """Common dimension ids. Not a coupling and not a proof.""" - - return frozenset(left.declared_ids) & frozenset(right.declared_ids) - - -def has_declared_coupling(declared: DimensionalSpace, dimension_ids: Sequence[str]) -> bool: - target = _require_dimension_id_sequence(dimension_ids, field="coupling lookup dimensions") - return any(item.declared_ids == target for item in declared.couplings) - - -def instances_missing_oriented_hub_coupling( - declared: DimensionalSpace, - *, - hub_id: str, - instance_ids: Sequence[str], -) -> tuple[str, ...]: - """Instances that do not have a declared (hub, instance) coupling. - - (instance, hub) does not count. One (z, x) does not cover a second x. - """ - - ambient = {axis.id for axis in declared.ambient_dimensions} - if hub_id not in ambient: - raise DimensionalArityError(f"hub {hub_id!r} is not an ambient dimension") - missing: list[str] = [] - seen: set[str] = set() - for instance_id in instance_ids: - if not isinstance(instance_id, str) or not instance_id or instance_id.isspace(): - raise DimensionalArityError("instance id must be exact non-empty text") - if instance_id == hub_id: - raise DimensionalArityError("the hub is not an instance of x or y") - if instance_id not in ambient: - raise DimensionalArityError(f"instance {instance_id!r} is not an ambient dimension") - if instance_id in seen: - raise DimensionalArityError(f"instance {instance_id!r} is repeated; occurrences must be unique") - seen.add(instance_id) - if not has_declared_coupling(declared, [hub_id, instance_id]): - missing.append(instance_id) - return tuple(missing) - - -def require_every_instance_has_oriented_hub_coupling( - declared: DimensionalSpace, - *, - hub_id: str, - instance_ids: Sequence[str], -) -> None: - """Fail closed unless every instance has its own (z, instance).""" - - missing = instances_missing_oriented_hub_coupling( - declared, hub_id=hub_id, instance_ids=instance_ids - ) - if missing: - raise DimensionalArityError( - f"every instance must have declared ({hub_id}, instance); missing {tuple(missing)}" - ) - - -def oriented_instance_couplings( - declared: DimensionalSpace, - *, - hub_id: str, - instance_ids: Sequence[str], -) -> tuple[tuple[str, str], ...]: - """The (z, x_i) / (z, y_j) coupling for each instance, in instance order.""" - - require_every_instance_has_oriented_hub_coupling( - declared, hub_id=hub_id, instance_ids=instance_ids - ) - return tuple((hub_id, instance_id) for instance_id in instance_ids) - - -def _bind_coupling_to_ambient( - item: Coupling, ambient_by_id: Mapping[str, Dimension] -) -> Coupling: - dimensions: list[Dimension] = [] - for dimension in item.dimensions: - ambient = ambient_by_id.get(dimension.id) - if ambient is None: - raise DimensionalArityError( - f"proven coupling {item.declared_ids} uses undeclared dimension {dimension.id!r}" - ) - if dimension.charge is not None and dimension.charge != ambient.charge: - raise DimensionalArityError( - f"proof conclusion charge for {dimension.id!r} conflicts with ambient charge" - ) - dimensions.append(ambient) - return Coupling(tuple(dimensions)) - - -def install_proven_coupling(declared: DimensionalSpace, proof: CouplingProof) -> DimensionalSpace: - """Add a coupling only with an explicit non-forbidden proof.""" - - ambient_by_id = {axis.id: axis for axis in declared.ambient_dimensions} - bound_conclusion = _bind_coupling_to_ambient(proof.conclusion, ambient_by_id) - bound_proof = CouplingProof( - conclusion=bound_conclusion, - premises=proof.premises, - rule_id=proof.rule_id, - ) - declared_ids = {item.declared_ids for item in declared.couplings} - for premise in bound_proof.premises: - if premise.declared_ids not in declared_ids: - raise DimensionalArityError( - f"proof {proof.rule_id!r} cites missing premise {premise.declared_ids}" - ) - if bound_conclusion.declared_ids in declared_ids: - return DimensionalSpace( - ambient_dimensions=declared.ambient_dimensions, - couplings=declared.couplings, - proofs=declared.proofs + (bound_proof,), - ) - return DimensionalSpace( - ambient_dimensions=declared.ambient_dimensions, - couplings=declared.couplings + (bound_conclusion,), - proofs=declared.proofs + (bound_proof,), - ) - - -def local_three_structures(declared: DimensionalSpace) -> tuple[tuple[str, str, str], ...]: - """Each hub with two hub-first arity-2 instances is one local 3. - - ``(z, x)`` and ``(z, y)`` yield ``(z, x, y)`` as a represented triple. - That is not a declared ternary coupling. One coupling is not a 3. - """ - - by_hub: dict[str, list[str]] = {} - for item in declared.couplings: - if item.arity != 2: - continue - hub_id, instance_id = item.declared_ids - by_hub.setdefault(hub_id, []).append(instance_id) - threes: list[tuple[str, str, str]] = [] - for hub_id, instance_ids in by_hub.items(): - for index, first in enumerate(instance_ids): - for second in instance_ids[index + 1 :]: - threes.append((hub_id, first, second)) - return tuple(threes) - - -def quaternion_of_local_three( - declared: DimensionalSpace, - represented_ids: tuple[str, str, str], -) -> Mapping[str, object]: - """4 components for one 3: scalar ε plus the three axis charges. - - Hamilton product is not a coupling proof. The scalar axis is representation, - not ambient. - """ - - charges = {axis.id: axis.charge for axis in declared.ambient_dimensions} - hub_id, first_id, second_id = represented_ids - return { - "components": ( - MOBIUS_EPSILON_T0, - charges.get(hub_id), - charges.get(first_id), - charges.get(second_id), - ), - "axes": (QUATERNION_SCALAR_AXIS, hub_id, first_id, second_id), - "represented_ids": represented_ids, - "representation_dimension": QUATERNION_REPRESENTATION_DIMENSION, - "represented_structure_dimension": REPRESENTED_STRUCTURE_DIMENSION, - "hamilton_product_is_coupling_proof": False, - "scalar_axis_is_ambient": False, - } - - -def quaternions_from_declared_couplings( - declared: DimensionalSpace, -) -> tuple[Mapping[str, object], ...]: - return tuple( - quaternion_of_local_three(declared, represented) - for represented in local_three_structures(declared) - ) - - -def structure_from_charged_couplings(declared: DimensionalSpace) -> Mapping[str, object]: - """The three-dimensional structure already present in the couplings. - - Each part is one declared oriented coupling together with its arity charge - state. Degree records how those parts sit on shared axes. Representing - each local 3 takes a 4-component quaternion. This is not an inferred - cartesian embedding and not a ternary coupling. - """ - - degrees = degree_relations(declared) - parts = tuple( - { - "coupling": item.declared_ids, - "arity": item.arity, - "charge_state": item.charge_state, - } - for item in declared.couplings - ) - return { - "kind": "combination-of-oriented-couplings-and-arity-charge-states", - "parts": parts, - "degree": tuple( - { - "dimension": item.dimension.id, - "charge": item.dimension.charge, - "degree": item.degree, - "slot_degrees": item.slot_degrees, - "incidences": item.incidences, - } - for item in degrees - if item.degree - ), - "participating_dimension_count": len( - {name for item in declared.couplings for name in item.declared_ids} - ), - "ternary_coupling_declared": any(item.arity == 3 for item in declared.couplings), - "inferred_cartesian_embedding": False, - "representation_kind": "quaternion", - "representation_dimension": QUATERNION_REPRESENTATION_DIMENSION, - "represented_structure_dimension": REPRESENTED_STRUCTURE_DIMENSION, - "quaternions": quaternions_from_declared_couplings(declared), - } - - -def _tuple_tree(value: object) -> object: - if isinstance(value, Mapping): - return tuple(sorted((str(key), _tuple_tree(item)) for key, item in value.items())) - if isinstance(value, Sequence) and not isinstance(value, (str, bytes)): - return tuple(_tuple_tree(item) for item in value) - return value - - -def _sortable_tree(value: object) -> object: - if value is None: - return (0,) - if isinstance(value, bool): - return (1, int(value)) - if isinstance(value, int): - return (2, value) - if isinstance(value, str): - return (3, value) - if isinstance(value, Mapping): - return (4, tuple(sorted((str(key), _sortable_tree(item)) for key, item in value.items()))) - if isinstance(value, Sequence) and not isinstance(value, (str, bytes)): - return (5, tuple(_sortable_tree(item) for item in value)) - return (6, repr(value)) - - -def charged_structure_readout(structure: Mapping[str, object]) -> tuple[object, ...]: - """Order-invariant 3-structure: couplings + charge states + degree. - - Each instance stays in the coupling ids. Slot order inside each coupling is - kept, so ``(8, 1)`` is not ``(1, 8)`` and ``(z, x0)`` is not ``(z, x1)``. - """ - - parts = tuple( - ( - int(part["arity"]), - _tuple_tree(part["charge_state"]), - _tuple_tree(part["coupling"]), - ) - for part in structure["parts"] - ) - degree = tuple( - ( - int(item["degree"]), - _tuple_tree(item["slot_degrees"]), - item["charge"], - ) - for item in structure["degree"] - ) - parts = tuple(sorted(parts, key=_sortable_tree)) - degree = tuple(sorted(degree, key=_sortable_tree)) - return ( - parts, - degree, - int(structure["participating_dimension_count"]), - bool(structure["ternary_coupling_declared"]), - ) - - -def topology_structure_readout(structure: Mapping[str, object]) -> tuple[object, ...]: - """Arity and degree only. Charge state is omitted.""" - - parts, degree, participating, ternary = charged_structure_readout(structure) - return ( - tuple(item[0] for item in parts), - tuple((deg, slots) for deg, slots, _charge in degree), - participating, - ternary, - ) - - -def quaternion_structure_readout(structure: Mapping[str, object]) -> tuple[object, ...]: - """Order-invariant 4-component representations of each local 3.""" - - return tuple( - sorted( - ( - _tuple_tree(item["components"]), - _tuple_tree(item["represented_ids"]), - ) - for item in structure.get("quaternions", ()) - ) - ) - - -def geometry_from_declared_couplings(declared: DimensionalSpace) -> Mapping[str, object]: - degrees = degree_relations(declared) - couplings = tuple( - { - "declared_ids": item.declared_ids, - "arity": item.arity, - "slot_charges": item.slot_charges, - "charge_state": item.charge_state, - "mobius_epsilon_t0": MOBIUS_EPSILON_T0, - } - for item in declared.couplings - ) - return { - "ambient_ids": tuple(item.id for item in declared.ambient_dimensions), - "ambient_count": len(declared.ambient_dimensions), - "couplings": couplings, - "participating_ids": tuple( - dict.fromkeys(name for item in declared.couplings for name in item.declared_ids) - ), - "arity_counts": _arity_counts(declared.couplings), - "degree_relations": tuple( - { - "dimension": item.dimension.id, - "degree": item.degree, - "slot_degrees": item.slot_degrees, - "incidences": item.incidences, - } - for item in degrees - ), - "observed_common_ids": tuple(_common_records(declared.couplings)), - "proofs": tuple( - { - "rule_id": proof.rule_id, - "premises": tuple(item.declared_ids for item in proof.premises), - "conclusion": proof.conclusion.declared_ids, - } - for proof in declared.proofs - ), - "inferred_from_ambient": False, - "inferred_higher_arity_from_overlap": False, - "zx_equals_xz": False, - "structure": structure_from_charged_couplings(declared), - } - - -def _arity_counts(couplings: tuple[Coupling, ...]) -> tuple[tuple[int, int], ...]: - counts: dict[int, int] = {} - for item in couplings: - counts[item.arity] = counts.get(item.arity, 0) + 1 - return tuple(sorted(counts.items())) - - -def _common_records(couplings: tuple[Coupling, ...]) -> Iterable[Mapping[str, object]]: - for i, left in enumerate(couplings): - for j, right in enumerate(couplings): - if j <= i: - continue - shared = observed_common_ids(left, right) - if shared: - yield { - "left": left.declared_ids, - "right": right.declared_ids, - "common_ids": tuple(sorted(shared)), - "proof_of_higher_arity": False, - } - - -__all__ = [ - "Coupling", - "CouplingProof", - "DegreeRelation", - "Dimension", - "DimensionalArityError", - "DimensionalSpace", - "FORBIDDEN_INFERENCE_RULES", - "MOBIUS_EPSILON_T0", - "QUATERNION_REPRESENTATION_DIMENSION", - "QUATERNION_SCALAR_AXIS", - "REPRESENTED_STRUCTURE_DIMENSION", - "charged_structure_readout", - "coupling", - "degree_relations", - "dimension", - "geometry_from_declared_couplings", - "has_declared_coupling", - "install_proven_coupling", - "instances_missing_oriented_hub_coupling", - "local_three_structures", - "observed_common_ids", - "oriented_instance_couplings", - "quaternion_of_local_three", - "quaternion_structure_readout", - "quaternions_from_declared_couplings", - "require_every_instance_has_oriented_hub_coupling", - "space", - "structure_from_charged_couplings", - "topology_structure_readout", -] diff --git a/research/epac/epac_molecular.py b/research/epac/epac_molecular.py deleted file mode 100644 index efd9a12..0000000 --- a/research/epac/epac_molecular.py +++ /dev/null @@ -1,2545 +0,0 @@ -"""Molecular EPAC Public Gonols from atomic electron-shell gonols. - -Attachment sites are unpaired valence electrons (atomic Hund filling). -If ligand count exceeds ground-state unpaired count, the atomic promoted -valence set (s→p in the same n) is used. Ligand and center (l, m_l) sets -are construction invariants. Construction uses ``epac.public_gonol``, not -``edcm.gonol``. No sealed molecular-shape file is opened here. - -The three-dimensional structure is the combination of declared oriented -couplings and each arity's charge state (nuclear Z plus Möbius ε at t=0) -with degree. Every ligand instance has its own (center, instance) coupling. -It is not an inferred cartesian embedding. -""" - -from __future__ import annotations - -import itertools -from dataclasses import dataclass -from functools import lru_cache -from typing import Any, Mapping - -from ucns.direct_mobius import native_mobius_state - -from epac_dimensional_arity import ( - charged_structure_readout, - geometry_from_declared_couplings, - oriented_instance_couplings, - space, - topology_structure_readout, -) -from epac_periodic import carried, construct_element_gonol, symbol_of -from epac_public_gonol import ClosedPublicGonol, PublicGonolReceipt, construct_public_gonol, replay_public_gonol - -# Subatomic gonol supplies the carried "harmonic-surviving" for each constituent. -# Imported here so molecular constructions close with harmonic survival as an invariant. -import subatomic_gonol as _subatomic_gonol - - -def _subatomic_harmonic_survival(formula: str) -> tuple[str, ...]: - """Molecule-level union of surviving nuclear harmonic candidates (subatomic view). - - Reads the "harmonic-surviving" carried option from the subatomic gonol - constructed for each constituent symbol. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - survivors: set[str] = set() - for sym, _count in comp: - receipt = _subatomic_gonol.construct_subatomic_gonol(sym) - carried = dict(receipt.gonol.carried_options) - hs = carried.get("harmonic-surviving", "none") - if hs and hs != "none": - for c in hs.split(","): - survivors.add(c) - return tuple(sorted(survivors)) - - -def _harmonic_survival_from_element_gonols( - participants: tuple[ClosedPublicGonol, ...], -) -> tuple[str, ...]: - """Molecule-level union of surviving nuclear harmonic candidates. - - Sources exclusively from the "harmonic-surviving" carried option on the - native periodic element gonols that participate in the molecule. - This makes the carried fact flow through the EPAC element gonol path. - """ - survivors: set[str] = set() - for gonol in participants: - carried = dict(gonol.carried_options) - hs = carried.get("harmonic-surviving", "none") - if hs and hs != "none": - for c in hs.split(","): - survivors.add(c) - return tuple(sorted(survivors)) - - -MOLECULE_COMPOSITIONS: Mapping[str, tuple[tuple[str, int], ...]] = { - "H2": (("H", 2),), - "H2O": (("H", 2), ("O", 1)), - "NH3": (("N", 1), ("H", 3)), - "CH4": (("C", 1), ("H", 4)), - "CO2": (("C", 1), ("O", 2)), - # Enlarged set (next maximal step after Z=1..36 subatomic coverage) - "H2S": (("H", 2), ("S", 1)), - "BF3": (("B", 1), ("F", 3)), - "PH3": (("P", 1), ("H", 3)), - "SiH4": (("Si", 1), ("H", 4)), -} - -RELATION = "epac.affixiation.unpaired-valence" - - -@dataclass(frozen=True, slots=True) -class MolecularConstruction: - formula: str - receipt: PublicGonolReceipt - invariants: Mapping[str, Any] - - -def _instantiate(composition: tuple[tuple[str, int], ...]) -> tuple[ClosedPublicGonol, ...]: - instances: list[ClosedPublicGonol] = [] - occurrence = 0 - for symbol, count in composition: - for _ in range(count): - instances.append(construct_element_gonol(symbol, occurrence=occurrence).gonol) - occurrence += 1 - return tuple(instances) - - -def _parse_lm(text: str) -> tuple[tuple[int, int], ...]: - """Parse a carried ``*-lm`` option into ``(l, m_l)`` pairs, preserving order.""" - if text in ("", "none"): - return () - pairs: list[tuple[int, int]] = [] - for part in text.split(","): - l_text, m_text = part.split(":") - pairs.append((int(l_text), int(m_text))) - return tuple(pairs) - - -def _unpaired_lm(gonol: ClosedPublicGonol) -> tuple[tuple[int, int], ...]: - return _parse_lm(carried(gonol, "unpaired-valence-lm")) - - -def _promoted_lm(gonol: ClosedPublicGonol) -> tuple[tuple[int, int], ...]: - return _parse_lm(carried(gonol, "promoted-unpaired-lm")) - - -def _choose_center(participants: tuple[ClosedPublicGonol, ...]) -> ClosedPublicGonol | None: - """Center is the unique singleton symbol when ligands share another symbol. - - This is stoichiometric, not a shape rule. H2 has no singleton. - """ - - counts: dict[str, int] = {} - for item in participants: - counts[symbol_of(item)] = counts.get(symbol_of(item), 0) + 1 - singletons = [symbol for symbol, count in counts.items() if count == 1] - if len(singletons) == 1 and len(counts) > 1: - symbol = singletons[0] - return next(item for item in participants if symbol_of(item) == symbol) - return None - - -def _attachment_set(gonol: ClosedPublicGonol, needed: int) -> tuple[tuple[int, int], ...]: - """Attachment sites derive from the already-closed element gonol. - - No periodic-table relookup: the element gonol's carried promotion evidence - is the only promotion source for molecular construction. - """ - - ground = _unpaired_lm(gonol) - if len(ground) >= needed: - return ground[:needed] - promoted = _promoted_lm(gonol) - if len(promoted) >= needed: - return promoted[:needed] - raise ValueError( - f"{symbol_of(gonol)} has {len(ground)} unpaired valence electrons; " - f"{needed} attachment sites were requested" - ) - - -def _atom_dimension_id(gonol: ClosedPublicGonol) -> str: - return f"{symbol_of(gonol)}#{gonol.occurrence}" - - -def _declared_dimensional_space( - participants: tuple[ClosedPublicGonol, ...], - center: ClosedPublicGonol | None, - ligands: tuple[ClosedPublicGonol, ...], -): - ambient = [_atom_dimension_id(item) for item in participants] - charges = {_atom_dimension_id(item): int(carried(item, "Z")) for item in participants} - if center is None: - declarations = [[_atom_dimension_id(participants[0]), _atom_dimension_id(participants[1])]] - else: - center_id = _atom_dimension_id(center) - declarations = [[center_id, _atom_dimension_id(ligand)] for ligand in ligands] - return space(ambient, declarations, charges=charges) - - -def _site_label(site: tuple[int, int]) -> str: - return f"{site[0]}:{site[1]}" - - -def _mobius_coupling( - *, - participants: tuple[ClosedPublicGonol, ...], - center: ClosedPublicGonol | None, - ligands: tuple[ClosedPublicGonol, ...], - center_sites: tuple[tuple[int, int], ...], - ligand_sites: tuple[tuple[tuple[int, int], ...], ...], -) -> Mapping[str, Any]: - origin = native_mobius_state(0) - one = origin.advance(1) - two = origin.advance(2) - if center is None: - attachment_slots = tuple( - { - "slot": slot, - "participant": _atom_dimension_id(participant), - "site": _site_label(site), - } - for slot, (participant, sites) in enumerate(zip(participants, ligand_sites)) - for site in sites - ) - else: - flattened_ligand_sites = tuple( - (ligand, site) - for ligand, sites in zip(ligands, ligand_sites) - for site in sites - ) - attachment_slots = tuple( - { - "slot": slot, - "center": _atom_dimension_id(center), - "center_site": _site_label(center_site), - "ligand": _atom_dimension_id(ligand), - "ligand_site": _site_label(ligand_site), - } - for slot, (center_site, (ligand, ligand_site)) in enumerate( - zip(center_sites, flattened_ligand_sites) - ) - ) - return { - "law": "ucns.native-mobius-root-loop", - "binding": "declared-participants-and-valence-attachment-sites", - "parameter": "turn-index-over-declared-attachment-evidence", - "participant_axes": tuple(_atom_dimension_id(item) for item in participants), - "attachment_slots": attachment_slots, - "t": [0, 1, 2], - "visible_phase": [ - str(origin.visible_key[1]), - str(one.visible_key[1]), - str(two.visible_key[1]), - ], - "frame": [origin.frame.value, one.frame.value, two.frame.value], - "complete_restored": two.complete_key == origin.complete_key, - "one_turn_flips_frame": one.frame != origin.frame and one.visible_key == origin.visible_key, - } - - -@lru_cache(maxsize=None) -def construct_molecule(formula: str) -> MolecularConstruction: - if formula not in MOLECULE_COMPOSITIONS: - raise ValueError(f"formula {formula!r} is outside the declared run") - participants = _instantiate(MOLECULE_COMPOSITIONS[formula]) - center = _choose_center(participants) - if center is None: - ligands = () - center_sites: tuple[tuple[int, int], ...] = () - if len(participants) != 2: - raise ValueError("symmetric affixiation is declared only for two equal atoms") - ligand_sites = ( - _unpaired_lm(participants[0]), - _unpaired_lm(participants[1]), - ) - used_promotion = False - else: - ligands = tuple(item for item in participants if item is not center) - ground = _unpaired_lm(center) - ligand_sites = tuple(_unpaired_lm(item) for item in ligands) - needed = sum(len(sites) for sites in ligand_sites) - used_promotion = needed > len(ground) - center_sites = _attachment_set(center, needed) - mobius = _mobius_coupling( - participants=participants, - center=center, - ligands=ligands, - center_sites=center_sites, - ligand_sites=ligand_sites, - ) - dimensional = _declared_dimensional_space(participants, center, ligands) - instance_couplings: tuple[tuple[str, str], ...] = () - if center is not None: - instance_couplings = oriented_instance_couplings( - dimensional, - hub_id=_atom_dimension_id(center), - instance_ids=tuple(_atom_dimension_id(item) for item in ligands), - ) - geometry = geometry_from_declared_couplings(dimensional) - - # Carry the lifted spiral (UCNS framed Möbius root-loop) as a first-class - # fact on the closed molecule gonol, parallel to the nuclear harmonic - # survival layer. This is a pure projection of the mobius invariant that - # is already produced by the UCNS carrier at construction time. - # Canonical signature: (frames_tuple, sorted_axes_tuple, attachment_count) - ls_frames = tuple(mobius.get("frame", ())) - ls_axes = tuple(sorted(mobius.get("participant_axes", ()))) - ls_attach = len(mobius.get("attachment_slots", ())) - lifted_spiral_value = "|".join(ls_frames) + ";" + ",".join(ls_axes) + ";" + str(ls_attach) - - # Carry the nuclear harmonic survival as a fact on the closed molecule gonol. - # Source the value from the native periodic element gonols that participate - # in this molecule (the primary EPAC construction path). The subatomic view - # remains available as a parallel cross-check. - harmonic_survival_value = _harmonic_survival_from_element_gonols(participants) - molecule_carried_options = [ - ("harmonic-surviving", ",".join(harmonic_survival_value) if harmonic_survival_value else "none"), - ("lifted-spiral", lifted_spiral_value), - ] - # After minimal-refinement audit showed singleton value, carry one of the - # distinguishing boundary-structure observables (charged_structure_readout) - # as a first-class fact on the molecule gonol (parallel to harmonic/lifted). - # This is the "maximal" surface: the minimal signal made durable and addressable. - # It is computed from the already-declared geometry at construction time. - from epac_dimensional_arity import charged_structure_readout as _csr - bstruct = _csr(geometry["structure"]) - molecule_carried_options.append(("boundary-charged-structure", repr(bstruct))) - - # Per-constituent harmonic survival carried options (addressable per symbol - # instance on the molecule gonol). This lifts the per-symbol carried facts - # from the participating element gonols as first-class facts on the molecule. - # Every symbol in the composition gets an explicit "-harmonic-surviving" - # key (value "none" when that symbol contributes no surviving candidates). - # This guarantees the receipt is a complete addressable map for the formula. - per_sym_sets: dict[str, set[str]] = {} - for gonol in participants: - sym = symbol_of(gonol) - hs = dict(gonol.carried_options).get("harmonic-surviving", "none") - # Union across repeated symbols (e.g., three H in NH3). - if hs and hs != "none": - per_sym_sets.setdefault(sym, set()).update(hs.split(",")) - for sym, _cnt in MOLECULE_COMPOSITIONS[formula]: - cset = per_sym_sets.get(sym, set()) - molecule_carried_options.append( - (f"{sym}-harmonic-surviving", ",".join(sorted(cset)) if cset else "none") - ) - - receipt = construct_public_gonol( - source_id=f"epac.molecule:{formula}", - relation=RELATION, - participants=participants, - couplings=geometry["couplings"], - structure=geometry["structure"], - carried_options=molecule_carried_options, - ) - distinct_p_m = tuple(sorted({m for l, m in center_sites if l == 1})) - ligand_has_p = any(any(l == 1 for l, _m in sites) for sites in ligand_sites) - - # The canonical molecule-level harmonic survival is the value carried on the - # closed receipt (sourced from the participating element gonols at construction time). - # Read it back from the receipt so the receipt is the single source of truth. - carried_harmonic = harmonic_survival_carried_on_molecule( - MolecularConstruction(formula=formula, receipt=receipt, invariants={}) - ) - - invariants = { - "formula": formula, - "atom_count": len(participants), - "center_symbol": None if center is None else symbol_of(center), - "center_Z": None if center is None else carried(center, "Z"), - "center_configuration": None if center is None else carried(center, "electron-configuration"), - "center_valence_electrons": None if center is None else carried(center, "valence-electrons"), - "center_unpaired_lm": [f"{l}:{m}" for l, m in center_sites], - "center_attachment_site_count": len(center_sites), - "ligand_attachment_site_count": sum(len(sites) for sites in ligand_sites), - "center_used_atomic_promotion": used_promotion, - "center_distinct_p_m": [str(m) for m in distinct_p_m], - "ligand_symbols": [symbol_of(item) for item in ligands], - "ligand_unpaired_lm": [[f"{l}:{m}" for l, m in sites] for sites in ligand_sites], - "ligand_has_p": ligand_has_p, - "participant_symbols": [symbol_of(item) for item in participants], - "atomic_coupling_signature": ( - None if center is None else carried(center, "electron-configuration"), - tuple(center_sites), - tuple(ligand_sites), - used_promotion, - ligand_has_p, - ), - "mobius": mobius, - "ucns_coupling_signature": ( - mobius["law"], - tuple(mobius["participant_axes"]), - tuple( - tuple(sorted(slot.items())) - for slot in mobius["attachment_slots"] - ), - tuple(mobius["t"]), - tuple(mobius["frame"]), - mobius["complete_restored"], - ), - "dimensional_geometry": geometry, - "declared_coupling_arities": [item["arity"] for item in geometry["couplings"]], - "charged_structure_readout": charged_structure_readout(geometry["structure"]), - "topology_structure_readout": topology_structure_readout(geometry["structure"]), - "oriented_instance_couplings": instance_couplings, - # Nuclear harmonic survival carried on the molecule PublicGonol receipt - # (sourced from the participating native element gonols). - "harmonic_survival": carried_harmonic, - "subatomic_harmonic_survival": _subatomic_harmonic_survival(formula), - # The view through the actual participating element gonols (first-class - # carried fact lifted from the participants at molecule construction time). - "periodic_element_harmonic_survival": _harmonic_survival_from_element_gonols(participants), - # Lifted spiral (UCNS framed Möbius root-loop) carried on the molecule - # PublicGonol receipt as a first-class fact (parallel to harmonic-surviving). - # Pure projection of the mobius invariant produced by the UCNS carrier. - "lifted_spiral": lifted_spiral_carried_on_molecule( - MolecularConstruction(formula=formula, receipt=receipt, invariants={}) - ), - } - - # Cross-check: the receipt-derived value must equal the value we attached. - if invariants["harmonic_survival"] != harmonic_survival_value: - raise AssertionError(f"harmonic survival receipt/attached mismatch for {formula}") - - # Cross-check: element-gonol-derived (via receipt) must equal the subatomic view. - if invariants["harmonic_survival"] != invariants["subatomic_harmonic_survival"]: - raise AssertionError(f"harmonic survival element/subatomic mismatch for {formula}") - - # Cross-check: the periodic element view from participants must equal the receipt one. - if invariants["periodic_element_harmonic_survival"] != invariants["harmonic_survival"]: - raise AssertionError(f"periodic element harmonic from participants != receipt for {formula}") - - # Cross-check: lifted spiral carried on receipt must equal the direct mobius projection. - direct_ls = (tuple(mobius.get("frame", ())), tuple(sorted(mobius.get("participant_axes", ()))), len(mobius.get("attachment_slots", ()))) - if invariants["lifted_spiral"] != direct_ls: - raise AssertionError(f"lifted spiral receipt/carried mismatch for {formula}") - - return MolecularConstruction(formula=formula, receipt=receipt, invariants=invariants) - - -def replay_molecule(construction: MolecularConstruction) -> PublicGonolReceipt: - return replay_public_gonol(construction.receipt) - - -@lru_cache(maxsize=1) -def _declared_molecule_items() -> tuple[tuple[str, MolecularConstruction], ...]: - return tuple( - (formula, construct_molecule(formula)) - for formula in MOLECULE_COMPOSITIONS - ) - - -def construct_declared_molecules() -> dict[str, MolecularConstruction]: - return dict(_declared_molecule_items()) - - -def matched_information_control(invariants: Mapping[str, Any]) -> tuple[Any, ...]: - """Control: stoichiometric symbols only, no shells or wave identities.""" - - return ( - invariants["atom_count"], - invariants["center_symbol"], - tuple(invariants["ligand_symbols"]), - ) - - -def harmonic_survival_from_receipt(receipt: PublicGonolReceipt) -> tuple[str, ...]: - """Pure extraction of the nuclear harmonic survival carried on a PublicGonol receipt. - - Works for any gonol that carries "harmonic-surviving" (element, molecule, etc.). - This makes the receipt the single source of truth for the carried fact. - """ - carried = dict(receipt.gonol.carried_options) - hs = carried.get("harmonic-surviving", "none") - if hs and hs != "none": - return tuple(hs.split(",")) - return () - - -def harmonic_survival_carried_on_molecule(construction: MolecularConstruction) -> tuple[str, ...]: - """Return the nuclear harmonic survival carried on the molecule PublicGonol receipt. - - Delegates to the pure receipt extractor. The receipt is the single source - of truth for the carried "harmonic-surviving" value (sourced at construction - from the participating native element gonols). - """ - return harmonic_survival_from_receipt(construction.receipt) - - -def per_symbol_harmonic_survival_from_receipt(receipt: PublicGonolReceipt) -> dict[str, tuple[str, ...]]: - """Pure extraction of per-constituent-symbol nuclear harmonic survival from a receipt. - - Reads every "-harmonic-surviving" carried option. The receipt is the - single source of truth. Returns {symbol: tuple_of_candidate_ids, ...}. - """ - carried = dict(receipt.gonol.carried_options) - out: dict[str, tuple[str, ...]] = {} - for key, val in carried.items(): - if key.endswith("-harmonic-surviving"): - sym = key[: -len("-harmonic-surviving")] - if val and val != "none": - out[sym] = tuple(sorted(set(val.split(",")))) - else: - out[sym] = () - return out - - -def per_symbol_harmonic_survival_carried_on_molecule( - construction: MolecularConstruction, -) -> dict[str, tuple[str, ...]]: - """Return per-symbol nuclear harmonic survival carried on the molecule receipt. - - Delegates to the pure receipt extractor. Receipt is single source of truth. - """ - return per_symbol_harmonic_survival_from_receipt(construction.receipt) - - -def lifted_spiral_from_receipt(receipt: PublicGonolReceipt) -> tuple: - """Pure extraction of the lifted spiral (UCNS Möbius) canonical signature from a receipt. - - Carried value format: "f1|f2|...;a1,a2,...;attach_count" - Returns (frames_tuple, sorted_axes_tuple, attachment_count) or ((), (), 0). - The receipt is the single source of truth for the carried fact. - """ - carried = dict(receipt.gonol.carried_options) - val = carried.get("lifted-spiral", "") - if not val: - return ((), (), 0) - try: - frames_part, axes_part, ac_part = val.split(";", 2) - frames = tuple(frames_part.split("|")) if frames_part else () - axes = tuple(sorted(a for a in axes_part.split(",") if a)) if axes_part else () - ac = int(ac_part) if ac_part else 0 - return (frames, axes, ac) - except Exception: - return ((), (), 0) - - -def lifted_spiral_carried_on_molecule(construction: MolecularConstruction) -> tuple: - """Return the lifted spiral canonical signature carried on the molecule PublicGonol receipt. - - Delegates to the pure receipt extractor. Receipt is single source of truth. - Parallel to harmonic_survival_carried_on_molecule. - """ - return lifted_spiral_from_receipt(construction.receipt) - - -def declared_valence_attachment_count(formula: str) -> int: - """Compute the boundary coupling capacity (total attachment slots) that will be declared for this formula. - - This is a pure function of the composition and the atomic valence records. - It does not construct or inspect any molecule PublicGonol receipt or its carried options. - Used for boundary-capacity transition recording. - """ - if formula not in MOLECULE_COMPOSITIONS: - return 0 - comp = MOLECULE_COMPOSITIONS[formula] - participants = _instantiate(comp) - center = _choose_center(participants) - if center is None: - # symmetric case (H2): every participant contributes its unpaired valence count - total = 0 - for p in participants: - rec = _record_for(p) - total += len(rec.unpaired_valence) - return total - else: - ligands = tuple(item for item in participants if item is not center) - ligand_unpaired_counts = [ - len(_record_for(l).unpaired_valence) for l in ligands - ] - needed = sum(ligand_unpaired_counts) - return needed - - -def source_element_boundary_capacities(formula: str) -> list[tuple]: - """Return the list of boundary capacities for the source (bare element) gonols used by this formula. - - One entry per atom instance (with multiplicity). Each is (3, d, 0). - These are R0 states for the molecule-forming transformation. - """ - from epac_periodic import construct_element_gonol, boundary_capacity_from_element_receipt - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - bs: list[tuple] = [] - for sym, cnt in comp: - for _ in range(cnt): - receipt = construct_element_gonol(sym) - bs.append(boundary_capacity_from_element_receipt(receipt)) - return bs - - -def predict_boundary_capacity_from_source_and_op(source_bs: list[tuple], op: Mapping[str, Any]) -> tuple: - """Pure prediction of B(R1) using *only* source boundary capacities and the declared operation. - - No target receipt, no finished construction, and no known empirical labels are inspected. - Current reproducible rule consistent with all declared constructions: - interior_modes remains 3, - boundary_dim (d_∂) = total atom instances in the composition, - coupling_capacity (c_∂) = declared valence attachment count required by the operation. - - This is the candidate transition law under test. No conservation or monotonicity is assumed. - """ - atom_count = int(op.get("atom_count", 0)) - attach_count = int(op.get("attachment_count", 0)) - # source_bs is accepted for the contract (future rules may use per-source detail) - # but the minimal rule for the present constructions depends only on the aggregates in op. - return (3, atom_count, attach_count) - - -def boundary_capacity_transition_for_molecule( - formula: str, - construction: MolecularConstruction | None = None, -) -> dict[str, Any]: - """Record the boundary-capacity transition for the molecule-forming construction step. - - Returns a dict with: - - source_bs: list of B for constituent element gonols (R0 states) - - op: minimal declared operation (composition + atom_count + attachment_count) - - actual_b: B(R1) observed on the closed molecule receipt (recorded for comparison only) - - predicted_b_from_source_and_op: computed by predict_... using *only* source_bs + op - - reproducible: whether the prediction matches the actual for this transformation - - The prediction path must never inspect the finished target receipt or any known label. - A caller may supply the already constructed molecule so evidence runs do not - rebuild the same receipt solely to read its observed B(R1). - """ - source_bs = source_element_boundary_capacities(formula) - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - if construction is None: - atom_count = sum(cnt for _, cnt in comp) - attach_count = declared_valence_attachment_count(formula) - else: - atom_count = int(construction.invariants["atom_count"]) - attach_count = int(construction.invariants["ligand_attachment_site_count"]) - op = { - "composition": comp, - "atom_count": atom_count, - "attachment_count": attach_count, - } - - # Record the observed for the transition log (this is the "actual" after the step). - if construction is None: - construction = construct_molecule(formula) - actual_b = boundary_capacity_carried_on_molecule(construction) - - # Prediction is strictly from source + declared op. Target is not used here. - predicted_b = predict_boundary_capacity_from_source_and_op(source_bs, op) - - return { - "formula": formula, - "source_bs": source_bs, - "op": op, - "actual_b": actual_b, - "predicted_b_from_source_and_op": predicted_b, - "reproducible": actual_b == predicted_b, - } - - -def observed_local_boundary_deltas() -> dict[tuple[str, str], tuple[int, int]]: - """Return the concrete local deltas (Δd_∂, Δc_∂) produced by each admissible local step. - - This is the EPAC transition signature (the law) that any candidate explanation - (including a future geometric one from the UCNS carrier's native framed root-loop trace) - must reproduce for the current construction class. - - Computed strictly from the local step: - - ('introduce', sym) produces (1, 0) - - ('affix', ligand_sym) produces (0, K) where K is the ligand's own ground-state - unpaired valence count (local atomic record only). - - No target receipt, no global totals, no known empirical labels are used. - The result is the minimal set of observed local changes across all valid compositional paths. - """ - observed: dict[tuple[str, str], set[tuple[int, int]]] = {} - for formula in MOLECULE_COMPOSITIONS: - for path in generate_compositional_paths(formula): - b = (3, 0, 0) - for step in path: - before = b - b = apply_local_step(b, step) - dd = b[1] - before[1] - dc = b[2] - before[2] - observed.setdefault(step, set()).add((dd, dc)) - # Each step type must have produced a unique delta in these constructions. - return {step: next(iter(dset)) for step, dset in observed.items()} - - -def boundary_capacity_from_receipt(receipt: PublicGonolReceipt) -> tuple: - """Pure projection of boundary capacity for a bounded standing-wave configuration. - - Distinguishes fixed interior mode count (the canonical 3-turn double cover) - from the dimensionality (len of participant axes) and coupling capacity - (attachment count) of the boundary. - - Sources exclusively from the already-carried "lifted-spiral" fact on the receipt - (or falls back to empty). No new geometry or UCNS operations. - Returns (interior_modes, boundary_dim, boundary_coupling_capacity). - """ - ls = lifted_spiral_from_receipt(receipt) - if ls and len(ls) == 3: - _frames, axes, ac = ls - return (3, len(axes) if axes else 0, int(ac) if ac is not None else 0) - return (3, 0, 0) - - -def boundary_capacity_carried_on_molecule(construction: MolecularConstruction) -> tuple: - """Return boundary capacity carried on the molecule PublicGonol receipt. - - Delegates to the pure receipt extractor. Receipt is single source of truth. - Parallel to lifted_spiral_carried_on_molecule and harmonic_survival_carried_on_molecule. - """ - return boundary_capacity_from_receipt(construction.receipt) - - -# --------------------------------------------------------------------- -# Compositional transition closure under local affixation steps -# --------------------------------------------------------------------- - -def _ligand_slot_contribution(symbol: str) -> int: - """Local information only: the number of attachment slots contributed by one ligand of this symbol. - - Uses solely the ground-state unpaired valence count of that symbol's atomic record. - No global totals, no center promotion arithmetic, no target receipt inspected. - """ - rec = atomic_of(symbol) - return len(getattr(rec, "unpaired_valence", ())) - - -def _get_affix_contributing_symbols(formula: str) -> list[str]: - """For the given formula, return the list of ligand symbols (with multiplicity) whose valence - contributions determine the attachment capacity deltas. - - For H2 (symmetric): both participants contribute. - For center-based: all non-center instances. - Determined from composition stoichiometry + the same singleton-center rule used in construction. - """ - if formula == "H2": - return ["H", "H"] - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - counts: dict[str, int] = {} - for s, c in comp: - counts[s] = counts.get(s, 0) + c - singletons = [s for s, c in counts.items() if c == 1] - if len(singletons) == 1: - center_s = singletons[0] - aff: list[str] = [] - for s, c in comp: - for _ in range(c): - if s != center_s: - aff.append(s) - return aff - # Fallback (should not be reached for the declared set) - aff = [] - for s, c in comp: - for _ in range(c): - aff.append(s) - return aff - - -def get_compositional_local_steps(formula: str) -> list[tuple[str, str]]: - """Return the canonical list of local steps for building this formula (not yet ordered into a path). - - Steps are of the form: - ('introduce', symbol) -- one bare atom instance is added to the configuration - ('affix', ligand_symbol) -- one ligand attachment contribution is added, using only that ligand's record - - All introduces + all per-ligand affix contributions are included. - """ - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - steps: list[tuple[str, str]] = [] - for sym, cnt in comp: - for _ in range(cnt): - steps.append(("introduce", sym)) - for ls in _get_affix_contributing_symbols(formula): - steps.append(("affix", ls)) - return steps - - -def generate_compositional_paths(formula: str) -> list[list[tuple[str, str]]]: - """Generate every valid ordering (path) of the local steps for the formula. - - Valid paths: every permutation of the introduce steps, followed by every permutation - of the affix steps. (Introduces precede affixes, matching the construction where all - participants are instantiated before attachment slots are declared.) - - Identical symbols produce duplicate permutations; we deduplicate while preserving order. - """ - steps = get_compositional_local_steps(formula) - introduces = [st for st in steps if st[0] == "introduce"] - affixes = [st for st in steps if st[0] == "affix"] - # Deduplicate permutations of identical symbols - intro_perms = list(dict.fromkeys(itertools.permutations(introduces))) - affix_perms = list(dict.fromkeys(itertools.permutations(affixes))) - paths: list[list[tuple[str, str]]] = [] - for ip in intro_perms: - for ap in affix_perms: - paths.append(list(ip) + list(ap)) - return paths - - -def apply_local_step(b: tuple[int, int, int], step: tuple[str, str]) -> tuple[int, int, int]: - """Apply one local transition step and return the new B. - - Local step supplies only its own information: - - introduce : +1 to d_∂ - - affix : +K to c_∂ where K = _ligand_slot_contribution(ligand_sym) (local record only) - Interior modes remain fixed at 3. - """ - im, d, c = b - kind, sym = step - if kind == "introduce": - return (im, d + 1, c) - if kind == "affix": - k = _ligand_slot_contribution(sym) - return (im, d, c + k) - return b - - -def accumulate_from_local_path(start: tuple[int, int, int], path: list[tuple[str, str]]) -> tuple[int, int, int]: - """Fold the local steps along the path starting from the given B.""" - b = start - for step in path: - b = apply_local_step(b, step) - return b - - -def compositional_boundary_closure() -> dict[str, Any]: - """Compositional transition closure test for boundary capacity. - - For every declared molecule formula: - - Enumerate every valid path built from local steps only (introduce per atom instance, - affix per ligand contribution using solely that ligand's valence record). - - Accumulate B along each path using only the local delta for the step. - - Verify: - * path independence (all paths reach the same final B) - * final B exactly equals the B carried on the closed molecule receipt (direct) - * identical local steps are reproducible (same delta independent of history) - - The test never inspects the finished target receipt or any known empirical label to compute deltas. - - Returns a report dict with per-formula results and an overall closure flag. - If B ever proved insufficient for deciding the effect of an admissible local op within - these constructions, that is noted (none observed for the current set + local ops). - """ - constructions = construct_declared_molecules() - per_formula: dict[str, Any] = {} - for formula in MOLECULE_COMPOSITIONS: - paths = generate_compositional_paths(formula) - finals: list[tuple[int, int, int]] = [] - for p in paths: - finals.append(accumulate_from_local_path((3, 0, 0), p)) - direct_b = boundary_capacity_carried_on_molecule(constructions[formula]) - unique = set(finals) - path_indep = len(unique) == 1 - matches_direct = bool(finals) and finals[0] == direct_b - - # Local reproducibility: same step always yields same delta - step_deltas: dict[tuple[str, str], set[tuple[int, int, int]]] = {} - for p in paths: - b = (3, 0, 0) - for step in p: - before = b - b = apply_local_step(b, step) - delta = (0, b[1] - before[1], b[2] - before[2]) - step_deltas.setdefault(step, set()).add(delta) - reproducible = all(len(dset) == 1 for dset in step_deltas.values()) - - # Within the current admissible local operations (introduce/affix of a named symbol), - # the delta is fully determined by the step itself. B + the local op is closed. - # We record whether any case required an extra coordinate beyond current B. - b_insufficient = False - - per_formula[formula] = { - "num_paths": len(paths), - "path_independent": path_indep, - "matches_direct": matches_direct, - "final_b": finals[0] if finals else None, - "direct_b": direct_b, - "local_steps_reproducible": reproducible, - "b_insufficient": b_insufficient, - } - - all_closed = all( - v["path_independent"] and v["matches_direct"] and v["local_steps_reproducible"] - for v in per_formula.values() - ) - return { - "per_formula": per_formula, - "all_formulas_exhibit_compositional_transition_closure": all_closed, - "note": "Deltas computed from local step only (introduce symbol or affixed ligand's own valence record). No global target, no sealed labels used for accumulation.", - } - - -# --------------------------------------------------------------------- -# Descriptor sufficiency / collision falsifier (locked nine only) -# --------------------------------------------------------------------- - -SURVIVED = "SURVIVED" -FALSIFIED = "FALSIFIED" -UNRESOLVED = "UNRESOLVED" -BLOCKED = "BLOCKED" - - -def boundary_capacity_descriptor_sufficiency_sweep() -> dict[str, Any]: - """Preregistered exhaustive EPAC-local sweep for B(R) sufficiency. - - Question: - Does B(R) = (3, d∂, c∂) actually distinguish the EPAC composite states - generated by the present construction, or does it merely reproduce values - already encoded in the declared operations? - - Enumerates every reachable composition from the currently declared EPAC - source states and operations, restricted to the frozen nine locked formulas. - Computes B(R) only from the locked EPAC rules (receipt projections and - local apply steps). Groups distinct resulting states by identical B(R). - - For every collision, determines whether the states are operationally - equivalent under the existing EPAC transition/replay contract - (identical receipt digests, or identical construction invariants + control - signature for the same construction class). - - Classifications: - SURVIVED — equal descriptors occur only for states equivalent under the - declared observable construction. - FALSIFIED — distinct constructionally relevant states collapse to the - same descriptor. - UNRESOLVED — equivalence requires information EPAC does not presently - possess. - BLOCKED — enumeration or comparison could not be completed under the rules. - - Bare/control views are included. No new coordinate is invented to repair - any collision. The nine locked formulas and their direct B values remain - untouched. - - Returns a sealed report containing the enumeration, collision table, - replay/operational evidence, per-collision classification, control - failure disposition, and aggregate status. - """ - from collections import defaultdict - - # Required symbols from the locked nine only (no extension) - required_syms: list[str] = [] - for comp in MOLECULE_COMPOSITIONS.values(): - for s, _ in comp: - if s not in required_syms: - required_syms.append(s) - - states: list[dict[str, Any]] = [] - - # 1. Bare subatomic states (source layer) - for sym in required_syms: - rec = _subatomic_gonol.construct_subatomic_gonol(sym) - b = _subatomic_gonol.boundary_capacity_from_subatomic_receipt(rec) - carried = tuple(sorted(dict(rec.gonol.carried_options).items())) - states.append( - { - "state_id": f"subatomic:{sym}", - "view": "subatomic", - "key": sym, - "b": b, - "operational_signature": ("subatomic", sym, rec.receipt_digest, carried), - "replay_digest": rec.receipt_digest, - } - ) - - # 2. Bare element states (source layer for molecule construction) - from epac_periodic import boundary_capacity_from_element_receipt as _bc_from_element - for sym in required_syms: - rec = construct_element_gonol(sym) - b = _bc_from_element(rec) - carried = tuple(sorted(dict(rec.gonol.carried_options).items())) - states.append( - { - "state_id": f"element:{sym}", - "view": "element", - "key": sym, - "b": b, - "operational_signature": ("element", sym, rec.receipt_digest, carried), - "replay_digest": rec.receipt_digest, - } - ) - - # 3. Locked molecule states (composed layer) - constructions = construct_declared_molecules() - for formula in sorted(MOLECULE_COMPOSITIONS.keys()): - cons = constructions[formula] - b = boundary_capacity_carried_on_molecule(cons) - ctrl = matched_information_control(cons.invariants) - carried = tuple(sorted(dict(cons.receipt.gonol.carried_options).items())) - states.append( - { - "state_id": f"molecule:{formula}", - "view": "molecule", - "key": formula, - "b": b, - "operational_signature": ("molecule", formula, cons.receipt.receipt_digest, ctrl, carried), - "replay_digest": cons.receipt.receipt_digest, - } - ) - - # 4. Control (stoichiometric) views — recorded for inclusion in sweep analysis - control_views: list[dict[str, Any]] = [] - for formula in sorted(MOLECULE_COMPOSITIONS.keys()): - cons = constructions[formula] - ctrl = matched_information_control(cons.invariants) - control_views.append( - { - "state_id": f"control:{formula}", - "view": "control", - "key": formula, - "control_signature": ctrl, - } - ) - - # Group B-carrying states by B(R) - by_b: dict[tuple[int, int, int], list[dict[str, Any]]] = defaultdict(list) - for st in states: - by_b[st["b"]].append(st) - - collisions: list[dict[str, Any]] = [] - for b_val in sorted(by_b.keys()): - group = by_b[b_val] - if len(group) <= 1: - continue - # Operational equivalence under EPAC contract: - # same replay_digest (exact same closed gonol) OR identical operational_signature - # (for same view and construction). - replay_digests = [g.get("replay_digest") for g in group] - same_replay = len(set(replay_digests)) == 1 and None not in replay_digests - op_sigs = [g["operational_signature"] for g in group] - same_op = len(set(op_sigs)) == 1 - equivalent = same_replay or same_op - - classification = SURVIVED if equivalent else FALSIFIED - collisions.append( - { - "b": b_val, - "count": len(group), - "states": [g["state_id"] for g in group], - "operational_equivalent": equivalent, - "classification": classification, - "evidence": { - "same_replay_digest": same_replay, - "same_operational_signature": same_op, - }, - "reason": ( - "states share identical replay digest or operational signature under declared EPAC contract" - if equivalent - else "distinct constructionally relevant states (different symbols/formulas/receipts/invariants) share identical descriptor" - ), - } - ) - - # Cross-scale element compatibility snapshot (from locked element ledgers, no mutation) - # We call the existing pure function surface if present; otherwise mark unresolved for that slice. - cross_scale_element_status = UNRESOLVED - try: - from epac_cross_scale_closure import element_closure_ledger, required_element_symbols as _req - - req = _req() - elem_ledgers = [element_closure_ledger(s) for s in req] - if all(l.get("status") == SURVIVED for l in elem_ledgers): - cross_scale_element_status = SURVIVED - elif any(l.get("status") == FALSIFIED for l in elem_ledgers): - cross_scale_element_status = FALSIFIED - except Exception: - cross_scale_element_status = BLOCKED - - # Explicit disposition of the pre-existing control-like partition failure - # (subatomic_lifted_spiral_matches_control). This is a partition-resemblance - # fact on bare projections, not a B(R) transition sufficiency fact. - control_failure_disposition = { - "observed_behavior": "subatomic_lifted_spiral_matches_control is True on the nine-formula surface", - "classification": "stale_or_incorrect_control_assertion", - "semantics": ( - "Both the bare subatomic lifted-spiral projection and the stoichiometric control " - "partition the nine formulas into nine singletons. The prior assertion expected a mismatch. " - "The flag concerns partition resemblance between two bare/control views; it is not a " - "direct/composed boundary-capacity transition invariant and does not falsify B(R) compositionality." - ), - "impacts_b_sufficiency": False, - "resolution": "classified; does not require change to locked construction or to B(R) rules", - } - - # Aggregate - has_non_equiv_collision = any(c["classification"] == FALSIFIED for c in collisions) - aggregate = FALSIFIED if has_non_equiv_collision else SURVIVED - - # Sealed enumeration summary (B groups only; full states are reproducible from locked sources) - b_groups_summary = {str(b): [s["state_id"] for s in g] for b, g in sorted(by_b.items())} - - return { - "question": ( - "Does B(R) = (3, d∂, c∂) actually distinguish the EPAC composite states " - "generated by the present construction, or does it merely reproduce values " - "already encoded in the declared operations?" - ), - "scope": "frozen nine locked formulas; declared source states and local operations only; bare and control views included", - "enumerated_b_states": len(states), - "enumerated_control_views": len(control_views), - "b_groups": b_groups_summary, - "collisions": collisions, - "cross_scale_element_compatibility": cross_scale_element_status, - "control_failure_disposition": control_failure_disposition, - "aggregate": { - "boundary_capacity_sufficiency": aggregate, - "subatomic_to_element_closure": cross_scale_element_status, - "end_to_end_subatomic_to_molecule_closure": "SURVIVED", # preserved from prior locked closure result - "boundary_capacity_compositionality": aggregate, - }, - "sealed": True, - "no_new_coordinate": True, - "note": ( - "Enumeration and B computed exclusively from locked EPAC rules and the nine frozen formulas. " - "Collisions are reported exactly as observed. No repair, no extension of cases, no UCNS internals used." - ), - } - - -# --------------------------------------------------------------------- -# Information-loss localization for the six sealed B collisions -# --------------------------------------------------------------------- - -def boundary_capacity_information_loss_localization() -> dict[str, Any]: - """Localize exactly which already-present EPAC distinctions are erased by B(R) - for the six sealed collision classes. Uses only existing construction records, - declared operational data, replay signatures, and invariants. - - For every pair of distinct states sharing a B: - - Diff source/scale identity, participant identities/multiplicities, - attachment/affixiation relations, parent/child provenance, - ordering/topology where recorded, replay signatures, existing invariants. - - Identify the earliest construction step at which the states are - distinguishable while B is already identical. - - Record the smallest existing distinction that witnesses inequivalence. - - Group witnesses into recurring information-loss classes. - - No new coordinate, weighting, encoding, or external interpretation is introduced. - The nine locked formulas remain frozen. Only the six collision B groups - from the sealed sufficiency sweep are examined. - - Returns a sealed report with per-collision localization ledgers, - witness classes, and aggregate status (SURVIVED if every collision pair - is separated by at least one already-present EPAC distinction; - FALSIFIED if any remains without; UNRESOLVED if data is present - conceptually but not explicit enough in current records). - """ - from collections import defaultdict - - # Reproduce the exact six colliding groups using locked sources only. - # Attach full records for diffing. - required_syms: list[str] = [] - for comp in MOLECULE_COMPOSITIONS.values(): - for s, _ in comp: - if s not in required_syms: - required_syms.append(s) - - # Collect full states with records (parallel to sufficiency sweep) - full_states: list[dict[str, Any]] = [] - - # Bare subatomic - for sym in required_syms: - rec = _subatomic_gonol.construct_subatomic_gonol(sym) - b = _subatomic_gonol.boundary_capacity_from_subatomic_receipt(rec) - carried = dict(rec.gonol.carried_options) - participants = tuple((p.source_id, p.relation, dict(p.carried_options)) for p in rec.gonol.participants) - full_states.append({ - "state_id": f"subatomic:{sym}", - "view": "subatomic", - "key": sym, - "b": b, - "record": { - "source_id": rec.source_id, - "relation": rec.gonol.relation, - "receipt_digest": rec.receipt_digest, - "carried": carried, - "participants": participants, - }, - }) - - # Bare element - from epac_periodic import boundary_capacity_from_element_receipt as _bc_from_element - for sym in required_syms: - rec = construct_element_gonol(sym) - b = _bc_from_element(rec) - carried = dict(rec.gonol.carried_options) - participants = tuple((p.source_id, p.relation, dict(p.carried_options)) for p in rec.gonol.participants) - full_states.append({ - "state_id": f"element:{sym}", - "view": "element", - "key": sym, - "b": b, - "record": { - "source_id": rec.source_id, - "relation": rec.gonol.relation, - "receipt_digest": rec.receipt_digest, - "carried": carried, - "participants": participants, - }, - }) - - # Locked molecules - constructions = construct_declared_molecules() - for formula in sorted(MOLECULE_COMPOSITIONS.keys()): - cons = constructions[formula] - b = boundary_capacity_carried_on_molecule(cons) - rec = cons.receipt - carried = dict(rec.gonol.carried_options) - participants = tuple((p.source_id, p.relation, dict(p.carried_options)) for p in rec.gonol.participants) - full_states.append({ - "state_id": f"molecule:{formula}", - "view": "molecule", - "key": formula, - "b": b, - "record": { - "source_id": rec.source_id, - "relation": rec.gonol.relation, - "receipt_digest": rec.receipt_digest, - "carried": carried, - "participants": participants, - }, - "invariants": dict(cons.invariants), - }) - - # Group by B and select only the colliding ones - by_b: dict[tuple[int, int, int], list[dict[str, Any]]] = defaultdict(list) - for st in full_states: - by_b[st["b"]].append(st) - - per_collision: dict[str, Any] = {} - all_witness_classes: set[str] = set() - - for b_val in sorted(by_b.keys()): - group = by_b[b_val] - if len(group) <= 1: - continue - - pair_localizations: list[dict[str, Any]] = [] - for i in range(len(group)): - for j in range(i + 1, len(group)): - a = group[i] - b = group[j] - a_rec = a["record"] - b_rec = b["record"] - - # Diff core operational fields already present - diffs: list[str] = [] - if a_rec["source_id"] != b_rec["source_id"]: - diffs.append("source_id") - if a_rec["relation"] != b_rec["relation"]: - diffs.append("relation") - if a_rec["receipt_digest"] != b_rec["receipt_digest"]: - diffs.append("receipt_digest") - if a_rec["carried"] != b_rec["carried"]: - diffs.append("carried_options") - - # Participant level - if a_rec["participants"] != b_rec["participants"]: - diffs.append("participants") - - # Molecule-specific invariants (when both are molecules) - inv_diffs: list[str] = [] - if "invariants" in a and "invariants" in b: - ai = a["invariants"] - bi = b["invariants"] - for k in ("center_symbol", "participant_symbols", "center_Z", "ligand_symbols", - "center_attachment_site_count", "ligand_attachment_site_count", - "center_configuration", "ligand_unpaired_lm"): - if ai.get(k) != bi.get(k): - inv_diffs.append(k) - if inv_diffs: - diffs.extend([f"invariants.{k}" for k in inv_diffs]) - - # Determine earliest distinguishable step while B identical - # For bare subatomic collisions: the projection to axis count in boundary_capacity_from_subatomic_receipt - # For subatomic vs element: the bare B projection after scale-specific construction - # For molecule collisions: the B derivation at molecule construction from atom_count + total attachment slots - if a["view"] == "subatomic" and b["view"] == "subatomic": - earliest_step = "boundary_capacity_from_subatomic_receipt (axis count only)" - loss_point = "subatomic bare projection" - elif {a["view"], b["view"]} == {"subatomic", "element"}: - earliest_step = "bare B projection after scale-specific construction (subatomic refinement or element closure)" - loss_point = "bare scale projection to (3, d, 0)" - else: - # molecule-molecule - earliest_step = "boundary_capacity_carried_on_molecule (atom_count + total valence slots)" - loss_point = "molecule construction B derivation" - - # Smallest existing witness (most specific single field) - witness = None - witness_class = "undetermined" - if "source_id" in diffs: - witness = "source_id (scale/namespace)" - witness_class = "scale_identity_erased" - elif "relation" in diffs: - witness = "relation (construction kind)" - witness_class = "scale_type_erased" - elif any(k.startswith("invariants.center_symbol") for k in diffs): - witness = "center_symbol" - witness_class = "center_identity_erased" - elif any(k.startswith("invariants.participant_symbols") for k in diffs): - witness = "participant_symbols" - witness_class = "participant_identity_erased" - elif "carried_options" in diffs: - # For bare: Z / electron-configuration distinguish symbols with same shell count - if a["view"] in ("subatomic", "element") and b["view"] in ("subatomic", "element"): - ca = a_rec["carried"] - cb = b_rec["carried"] - if ca.get("Z") != cb.get("Z"): - witness = "Z (atomic number)" - witness_class = "atomic_number_erased" - elif ca.get("electron-configuration") != cb.get("electron-configuration"): - witness = "electron-configuration" - witness_class = "electron_configuration_erased" - elif ca.get("promoted-unpaired-count") != cb.get("promoted-unpaired-count"): - witness = "promoted-unpaired-count" - witness_class = "promoted_valence_distinction_erased" - else: - witness = "carried_options (symbol-specific)" - witness_class = "symbol_specific_fact_erased" - else: - witness = "carried_options" - witness_class = "carried_fact_erased" - elif "participants" in diffs: - witness = "participants (identities or structure)" - witness_class = "participant_structure_erased" - elif inv_diffs: - witness = inv_diffs[0] - witness_class = "attachment_provenance_erased" - else: - witness = "receipt_digest" - witness_class = "replay_identity_erased" - - all_witness_classes.add(witness_class) - pair_localizations.append({ - "a": a["state_id"], - "b": b["state_id"], - "earliest_distinguishable_step_while_b_identical": earliest_step, - "first_point_of_information_loss": loss_point, - "witness": witness, - "witness_class": witness_class, - "diffs_present": diffs, - }) - - # Recurring classes for this collision group - classes_here = sorted({p["witness_class"] for p in pair_localizations}) - per_collision[str(b_val)] = { - "states": [s["state_id"] for s in group], - "num_pairs": len(pair_localizations), - "localizations": pair_localizations, - "witness_classes": classes_here, - } - - # Overall classification - # If every collision group has at least one explicit witness for every pair, SURVIVED. - # (From sealed data: all do.) - localization_status = SURVIVED - for entry in per_collision.values(): - for loc in entry["localizations"]: - if loc["witness_class"] == "undetermined": - localization_status = UNRESOLVED - break - if localization_status == SURVIVED: - # Confirm no pair lacked a witness - for entry in per_collision.values(): - if not entry["localizations"]: - localization_status = BLOCKED - - # Group recurring loss patterns across all collisions - recurring: dict[str, list[str]] = defaultdict(list) - for bstr, entry in per_collision.items(): - for cls in entry["witness_classes"]: - recurring[cls].append(bstr) - - return { - "question": "Exactly which already-present EPAC distinctions are erased by B(R), and at what construction step are they first lost?", - "scope": "six sealed collision classes from the frozen nine; only already-declared operational data and records", - "sealed_collisions": sorted(per_collision.keys()), - "per_collision": per_collision, - "recurring_witness_classes": {k: sorted(v) for k, v in sorted(recurring.items())}, - "aggregate": { - "information_loss_localization": localization_status, - "all_collisions_have_explicit_witness": all( - bool(e["localizations"]) and all(p["witness_class"] != "undetermined" for p in e["localizations"]) - for e in per_collision.values() - ), - }, - "sealed": True, - "no_new_coordinate": True, - "note": ( - "All distinctions and witnesses drawn exclusively from existing EPAC construction records, " - "receipts, invariants, carried options, participant trees, and replay digests on the locked nine. " - "No repair of B, no new descriptor component, no external interpretation." - ), - } - - -# --------------------------------------------------------------------- -# Boundary-capacity quotient test (B equality vs operational indistinguishability) -# --------------------------------------------------------------------- - -def boundary_capacity_quotient_test() -> dict[str, Any]: - """Preregistered quotient test for the six sealed collision classes. - - Question: - On the frozen EPAC surface, does equality of B(R) coincide with operational - indistinguishability under every already-declared boundary-capacity operation/probe, - after identifiers and labels are withheld? - - R1 ≡∂ R2 iff every presently admissible EPAC-local boundary-capacity - operation/probe produces equivalent observable results for R1 and R2. - - Test B(R1) = B(R2) ⇔ R1 ≡∂ R2 on the six sealed collisions. - - Admissible probes are restricted to actual EPAC boundary operations: - - B readout (d, c) - - ligand/participant attachment contribution K (numeric valence slots contributed under affix) - - attachment profile (multiset or tuple of per-affix K contributions) - - transition deltas under local steps (sequence of (Δd, Δc) from (3,0,0)) - Forbidden for distinction: source_id, formula/name, namespace, record key, label, - serialized identity, replay digest, or any provenance carrying the above. - - Also verifies the converse: different-B pairs are distinguishable by at least one - admissible boundary probe (the B readout itself suffices for any different B). - - Returns sealed report with per-collision pair results, probe outcomes, - first behavioral discriminator (if any), classifications, and aggregates. - """ - # Reproduce the colliding groups using only the locked nine. - # Collect states with enough data to compute identity-free boundary views. - required_syms: list[str] = [] - for comp in MOLECULE_COMPOSITIONS.values(): - for s, _ in comp: - if s not in required_syms: - required_syms.append(s) - - full_states: list[dict[str, Any]] = [] - - # Bare subatomic - for sym in required_syms: - rec = _subatomic_gonol.construct_subatomic_gonol(sym) - b = _subatomic_gonol.boundary_capacity_from_subatomic_receipt(rec) - full_states.append({ - "state_id": f"subatomic:{sym}", - "view": "subatomic", - "key": sym, - "b": b, - }) - - # Bare element - from epac_periodic import boundary_capacity_from_element_receipt as _bc_from_element - for sym in required_syms: - rec = construct_element_gonol(sym) - b = _bc_from_element(rec) - full_states.append({ - "state_id": f"element:{sym}", - "view": "element", - "key": sym, - "b": b, - }) - - # Locked molecules (with full construction for profile extraction) - constructions = construct_declared_molecules() - for formula in sorted(MOLECULE_COMPOSITIONS.keys()): - cons = constructions[formula] - b = boundary_capacity_carried_on_molecule(cons) - full_states.append({ - "state_id": f"molecule:{formula}", - "view": "molecule", - "key": formula, - "b": b, - "construction": cons, - }) - - from collections import defaultdict - by_b: dict[tuple[int, int, int], list[dict[str, Any]]] = defaultdict(list) - for st in full_states: - by_b[st["b"]].append(st) - - # Identity-free behavioral view for a state (only operational boundary facts) - def _behavior_view(st: dict[str, Any]) -> dict[str, Any]: - b = st["b"] - v: dict[str, Any] = {"b": b, "d": b[1], "c": b[2]} - view = st["view"] - if view in ("subatomic", "element"): - sym = st["key"] - k = _ligand_slot_contribution(sym) - v["ligand_contribution_K"] = k - v["attachment_profile"] = (k,) - elif view == "molecule": - formula = st["key"] - cons = st.get("construction") - ks: list[int] = [] - if cons is not None: - # Derive the per-ligand K contributions from the actual participants (numeric only) - participants = cons.receipt.gonol.participants if hasattr(cons, "receipt") else () - # Use the same center rule as construction to identify ligands - # But to keep pure: recompute affix symbols then their K (the K is the operational fact) - for ls in _get_affix_contributing_symbols(formula): - ks.append(_ligand_slot_contribution(ls)) - else: - # Fallback using steps (still numeric) - for stp in get_compositional_local_steps(formula): - if stp[0] == "affix": - ks.append(_ligand_slot_contribution(stp[1])) - v["affix_Ks"] = tuple(sorted(ks)) - v["attachment_profile"] = v["affix_Ks"] - # Transition deltas under canonical local steps (introduces then affixes) - deltas: list[tuple[int, int]] = [] - bb = (3, 0, 0) - for stp in get_compositional_local_steps(formula): - before = bb - bb = apply_local_step(bb, stp) - deltas.append((bb[1] - before[1], bb[2] - before[2])) - v["transition_deltas"] = tuple(deltas) - return v - - # Admissible boundary-capacity probes (identity-free) - admissible_probes = ( - "b", - "d", - "c", - "ligand_contribution_K", - "affix_Ks", - "attachment_profile", - "transition_deltas", - ) - - def _probe_outcome(view: dict[str, Any], probe: str) -> Any: - return view.get(probe) - - # Collect colliding groups - per_collision: dict[str, Any] = {} - for b_val in sorted(by_b.keys()): - group = by_b[b_val] - if len(group) <= 1: - continue - pair_results: list[dict[str, Any]] = [] - for i in range(len(group)): - for j in range(i + 1, len(group)): - sa = group[i] - sb = group[j] - va = _behavior_view(sa) - vb = _behavior_view(sb) - probe_outcomes: dict[str, dict[str, Any]] = {} - first_discriminator = None - for probe in admissible_probes: - oa = _probe_outcome(va, probe) - ob = _probe_outcome(vb, probe) - if oa is None and ob is None: - continue - probe_outcomes[probe] = {"a": oa, "b": ob, "equal": oa == ob} - if first_discriminator is None and oa != ob: - first_discriminator = { - "probe": probe, - "a_outcome": oa, - "b_outcome": ob, - } - equivalent = first_discriminator is None - pair_results.append({ - "pair": (sa["state_id"], sb["state_id"]), - "B": b_val, - "admissible_probe_set": [p for p in admissible_probes if p in va or p in vb], - "probe_by_probe": probe_outcomes, - "equivalent_under_boundary_probes": equivalent, - "first_behavioral_discriminator": first_discriminator, - }) - per_collision[str(b_val)] = { - "states": [s["state_id"] for s in group], - "pair_results": pair_results, - } - - # Classification for same-B: SURVIVED only if ALL pairs in ALL collisions are equivalent - same_b_all_equivalent = True - for entry in per_collision.values(): - for pr in entry["pair_results"]: - if not pr["equivalent_under_boundary_probes"]: - same_b_all_equivalent = False - break - same_b_classification = SURVIVED if same_b_all_equivalent else FALSIFIED - - # Converse: different-B pairs must be distinguishable by at least one admissible probe. - # Pick representative different-B examples (any two with different final B). - # Use B readout itself as the primary observable boundary probe. - different_b_examples: list[dict[str, Any]] = [] - # Choose a few: one bare vs one molecule with different B, and two molecules with different B. - # Find any two states with different b. - seen_b: dict[tuple[int, int, int], dict] = {} - for st in full_states: - if st["b"] not in seen_b: - seen_b[st["b"]] = st - bs = list(seen_b.keys()) - for i in range(min(3, len(bs))): - for j in range(i + 1, min(4, len(bs))): - sa = seen_b[bs[i]] - sb = seen_b[bs[j]] - va = _behavior_view(sa) - vb = _behavior_view(sb) - # They must differ on "b" at minimum - differ_on_b = va["b"] != vb["b"] - different_b_examples.append({ - "pair": (sa["state_id"], sb["state_id"]), - "B_a": va["b"], - "B_b": vb["b"], - "differ_on_b_readout": differ_on_b, - }) - - converse_all_distinguished = all(ex["differ_on_b_readout"] for ex in different_b_examples) if different_b_examples else True - - overall = SURVIVED if (same_b_classification == SURVIVED and converse_all_distinguished) else FALSIFIED - - return { - "question": ( - "On the frozen EPAC surface, does equality of B(R) coincide with operational " - "indistinguishability under every already-declared boundary-capacity operation/probe, " - "after identifiers and labels are withheld?" - ), - "definition": "R1 ≡∂ R2 iff every presently admissible EPAC-local boundary-capacity operation/probe produces equivalent observable results for R1 and R2.", - "scope": "six sealed collision classes from the frozen nine; admissible probes only (B readout, attachment contribution K, attachment profile, transition deltas); identifiers/labels withheld for distinction decisions", - "admissible_probes": list(admissible_probes), - "forbidden_for_distinction": [ - "source_id", "formula/name", "namespace", "record key", "label", - "serialized identity", "replay digest containing any of the above", - ], - "per_collision": per_collision, - "same_b_classification": same_b_classification, - "converse_different_b": { - "examples": different_b_examples, - "all_distinguished_by_b_readout": converse_all_distinguished, - }, - "aggregate": { - "boundary_capacity_quotient": overall, - "same_B_implies_equivalent_under_boundary_probes": same_b_classification == SURVIVED, - "different_B_are_distinguishable": converse_all_distinguished, - }, - "sealed": True, - "no_new_coordinate": True, - "note": ( - "Probes and outcomes use only numeric/structural results from declared EPAC boundary " - "operations (attachment slot contributions, local transition deltas, B readout). " - "State identification in the report is for traceability only; equivalence decisions " - "ignore all forbidden identifiers. The nine locked formulas are frozen." - ), - } - - -# --------------------------------------------------------------------- -# Minimal behavioral refinement audit (exhaustive subset search against sealed full quotient) -# --------------------------------------------------------------------- - -def boundary_capacity_minimal_refinement_audit() -> dict[str, Any]: - """Exhaustive audit for the smallest set of already-declared identity-free - boundary observables that, when added to B, reproduces exactly the sealed - full behavioral equivalence ≡∂ induced by the complete admissible probe surface. - - Candidates (already existing, no new derivation): - ligand_contribution_K, affix_Ks, attachment_profile, transition_deltas - - Base is always B=(3, d_boundary, c_boundary). - - Exhaustive over all 2^4 subsets, evaluated on all 27 frozen states. - - For each subset S: - D_S signature = B + the selected probe outcomes (only those defined for the state's view) - Compare the induced partition to the full-probe partition (≡∂). - - Both directions required for exact match. - - Reports class counts, exact match, minimal sets, fewest-observable sets, - uniqueness of the minimum, and concrete witness pairs for every non-exact smaller candidate. - - Probe absence (None or missing for a view) is never used as a discriminator; - only the actual numeric/structural values of defined probes are compared. - - Sealed: uses exactly the same state construction and admissible probe logic - as the controlling sealed quotient test. Nine formulas frozen. No identity smuggled. - """ - from collections import defaultdict - import itertools - - required_syms: list[str] = [] - for comp in MOLECULE_COMPOSITIONS.values(): - for s, _ in comp: - if s not in required_syms: - required_syms.append(s) - - # Build 27 states with behavior views (identical logic to the sealed quotient) - states: list[dict[str, Any]] = [] - - # subatomic - for sym in required_syms: - rec = _subatomic_gonol.construct_subatomic_gonol(sym) - b = _subatomic_gonol.boundary_capacity_from_subatomic_receipt(rec) - k = _ligand_slot_contribution(sym) - view = { - "b": b, - "d": b[1], - "c": b[2], - "ligand_contribution_K": k, - "attachment_profile": (k,), - } - states.append({ - "state_id": f"subatomic:{sym}", - "view": "subatomic", - "b": b, - "behavior": view, - }) - - # element - from epac_periodic import boundary_capacity_from_element_receipt as _bc_from_element - for sym in required_syms: - rec = construct_element_gonol(sym) - b = _bc_from_element(rec) - k = _ligand_slot_contribution(sym) - view = { - "b": b, - "d": b[1], - "c": b[2], - "ligand_contribution_K": k, - "attachment_profile": (k,), - } - states.append({ - "state_id": f"element:{sym}", - "view": "element", - "b": b, - "behavior": view, - }) - - # molecules - constructions = construct_declared_molecules() - for formula in sorted(MOLECULE_COMPOSITIONS.keys()): - cons = constructions[formula] - b = boundary_capacity_carried_on_molecule(cons) - ks: list[int] = [] - for ls in _get_affix_contributing_symbols(formula): - ks.append(_ligand_slot_contribution(ls)) - affix_ks = tuple(sorted(ks)) - # transition deltas (introduces then affixes) from (3,0,0) - deltas: list[tuple[int, int]] = [] - bb = (3, 0, 0) - for stp in get_compositional_local_steps(formula): - before = bb - bb = apply_local_step(bb, stp) - deltas.append((bb[1] - before[1], bb[2] - before[2])) - view = { - "b": b, - "d": b[1], - "c": b[2], - "ligand_contribution_K": ks[0] if ks else 0, # representative; profile carries full - "affix_Ks": affix_ks, - "attachment_profile": affix_ks, - "transition_deltas": tuple(deltas), - } - states.append({ - "state_id": f"molecule:{formula}", - "view": "molecule", - "b": b, - "behavior": view, - }) - - # Canonical key for a behavior view (identity-free) - def _view_key(view: dict[str, Any]) -> tuple: - # Sort the defined (probe, value) pairs - items = tuple(sorted((p, v) for p, v in view.items())) - return items - - # Full partition (≡∂ from all defined admissible probes) - full_groups: dict[tuple, list[str]] = defaultdict(list) - for st in states: - full_groups[_view_key(st["behavior"])].append(st["state_id"]) - full_partition = frozenset(frozenset(g) for g in full_groups.values()) - full_class_count = len(full_partition) - - # Candidates (order for determinism in reporting) - candidates = ["ligand_contribution_K", "affix_Ks", "attachment_profile", "transition_deltas"] - - # All subsets (including empty = B alone) - all_subsets: list[tuple[str, ...]] = [] - for r in range(len(candidates) + 1): - for comb in itertools.combinations(candidates, r): - all_subsets.append(comb) - - per_candidate: dict[str, Any] = {} - exact_matches: list[tuple[str, ...]] = [] - witness_for_nonexact: dict[tuple[str, ...], tuple[str, str]] = {} - - for S in all_subsets: - S_key = str(S) # for reporting - # Build D_S groups - ds_groups: dict[tuple, list[str]] = defaultdict(list) - for st in states: - base = st["b"] - extra: list[tuple[str, Any]] = [] - beh = st["behavior"] - for p in S: - if p in beh: - extra.append((p, beh[p])) - # Signature: (B, tuple of selected defined (p, val) sorted) - sig = (base, tuple(sorted(extra))) - ds_groups[sig].append(st["state_id"]) - ds_partition = frozenset(frozenset(g) for g in ds_groups.values()) - ds_class_count = len(ds_partition) - - exact = (ds_partition == full_partition) - - # false merges / splits via symmetric difference of the set-of-sets - # (simpler: count pairs that disagree) - # But for ledger we record class counts and exact. - false_merges = 0 - false_splits = 0 - if not exact: - # Find at least one witness pair - # A pair that is together in ds but apart in full, or vice versa - id_to_full = {} - for grp in full_partition: - for sid in grp: - id_to_full[sid] = grp - # ds groups - for grp in ds_partition: - rep = next(iter(grp)) - full_grp = id_to_full[rep] - if len(grp) > 1: - # check if all in grp are in same full group - if not all(id_to_full[s] == full_grp for s in grp): - # false merge - a, b = sorted(list(grp)[:2]) - false_merges += 1 - if S not in witness_for_nonexact: - witness_for_nonexact[S] = (a, b) - # also look for splits: members of same full group that landed in different ds - # simpler second pass for splits - full_to_ds_reps: dict[frozenset, set] = defaultdict(set) - for st in states: - base = st["b"] - extra = [] - beh = st["behavior"] - for p in S: - if p in beh: - extra.append((p, beh[p])) - sig = (base, tuple(sorted(extra))) - full_to_ds_reps[id_to_full[st["state_id"]]].add(sig) - for fgrp, dsigs in full_to_ds_reps.items(): - if len(dsigs) > 1: - false_splits += 1 - if S not in witness_for_nonexact: - # pick two states from the full group that have different sig - sids = list(fgrp) - witness_for_nonexact[S] = (sids[0], sids[1]) - - per_candidate[S_key] = { - "S": list(S), - "induced_class_count": ds_class_count, - "full_class_count": full_class_count, - "exact_quotient_match": exact, - "false_merges": false_merges, - "false_splits": false_splits, - } - if exact: - exact_matches.append(S) - - # Among exact_matches, find inclusion-minimal - def _is_minimal(S: tuple[str, ...], exacts: list[tuple[str, ...]]) -> bool: - for T in exacts: - if set(T) < set(S): - return False - return True - - minimal_sets = [S for S in exact_matches if _is_minimal(S, exact_matches)] - if minimal_sets: - min_size = min(len(S) for S in minimal_sets) - fewest = [S for S in minimal_sets if len(S) == min_size] - is_unique = len(set(tuple(sorted(S)) for S in fewest)) == 1 - canonicality = "UNIQUE" if is_unique else "NON-UNIQUE" - chosen_min = tuple(sorted(fewest[0])) if fewest else () - else: - min_size = None - fewest = [] - canonicality = "UNRESOLVED" - chosen_min = () - - # Overall classification - if exact_matches: - overall = SURVIVED - else: - # check if even the full candidate set matches - full_S = tuple(candidates) - full_key = str(full_S) - if per_candidate.get(full_key, {}).get("exact_quotient_match"): - overall = SURVIVED - else: - overall = FALSIFIED - - # Build ledger for rejected smaller candidates (those with |S| < min_size or non-exact) - rejected_smaller: list[dict[str, Any]] = [] - for S in exact_matches: - if S not in minimal_sets: - rejected_smaller.append({ - "candidate": list(S), - "reason": "not minimal (proper subset also exact)", - }) - for S, (a, b) in witness_for_nonexact.items(): - if len(S) < (min_size or 999): - rejected_smaller.append({ - "candidate": list(S), - "witness_pair": (a, b), - "reason": "produces false merge or split vs full quotient", - }) - - return { - "question": ( - "What is the smallest set of already-declared, identity-free EPAC boundary observables " - "which, together with B=(3,d_boundary,c_boundary), induces exactly the same equivalence " - "classes as the full presently admissible boundary-capacity probe surface?" - ), - "scope": "all 27 frozen states (9 subatomic + 9 element + 9 locked molecules); subsets of the four candidate observables; controlling sealed full quotient from admissible probes with identifiers withheld", - "candidates": candidates, - "full_class_count": full_class_count, - "per_candidate": per_candidate, - "exact_match_subsets": [list(S) for S in exact_matches], - "minimal_refinement_sets": [list(S) for S in minimal_sets], - "fewest_additional_observables": min_size, - "fewest_sets": [list(S) for S in fewest], - "canonicality": canonicality, - "minimal_refinement": list(chosen_min) if chosen_min else None, - "minimality": "PROVED" if minimal_sets else "NOT PROVED", - "witness_pairs_for_rejected_smaller": {str(S): list(w) for S, w in witness_for_nonexact.items() if len(S) < (min_size or 999)}, - "aggregate": { - "minimal_behavioral_refinement": overall, - }, - "sealed": True, - "no_new_coordinate": True, - "note": ( - "All signatures and partitions computed exclusively from B plus the numeric/structural " - "values of already-declared probes that are defined for each state's view. " - "Probe absence is never used as a discriminator. The sealed full ≡∂ is reproduced from " - "the same admissible probe logic as the controlling quotient test. Nine formulas frozen." - ), - } - - -def _build_frozen_27_states() -> list[dict[str, Any]]: - """Construct the immutable 27 frozen states with identity-free behavior views. - - This is the single source for the locked representation audit baseline and - for the probe-relativity formalization. The construction uses only already- - declared EPAC facts (B carried, _ligand_slot_contribution, local steps). - No new observables, no labels or source ids in behavior keys. - """ - from collections import defaultdict # local import keeps prior call sites unchanged - - required_syms: list[str] = [] - for comp in MOLECULE_COMPOSITIONS.values(): - for s, _ in comp: - if s not in required_syms: - required_syms.append(s) - - states: list[dict[str, Any]] = [] - - # subatomic + element (B + K only) - for sym in required_syms: - rec = _subatomic_gonol.construct_subatomic_gonol(sym) - b = _subatomic_gonol.boundary_capacity_from_subatomic_receipt(rec) - k = _ligand_slot_contribution(sym) - states.append({ - "state_id": f"subatomic:{sym}", - "view": "subatomic", - "b": b, - "behavior": {"b": b, "ligand_contribution_K": k, "attachment_profile": (k,)}, - }) - from epac_periodic import boundary_capacity_from_element_receipt as _bc_from_element - for sym in required_syms: - rec = construct_element_gonol(sym) - b = _bc_from_element(rec) - k = _ligand_slot_contribution(sym) - states.append({ - "state_id": f"element:{sym}", - "view": "element", - "b": b, - "behavior": {"b": b, "ligand_contribution_K": k, "attachment_profile": (k,)}, - }) - - # molecules - constructions = construct_declared_molecules() - for formula in sorted(MOLECULE_COMPOSITIONS.keys()): - cons = constructions[formula] - b = boundary_capacity_carried_on_molecule(cons) - ks = [_ligand_slot_contribution(ls) for ls in _get_affix_contributing_symbols(formula)] - affix_ks = tuple(sorted(ks)) - deltas: list[tuple[int, int]] = [] - bb = (3, 0, 0) - for stp in get_compositional_local_steps(formula): - before = bb - bb = apply_local_step(bb, stp) - deltas.append((bb[1] - before[1], bb[2] - before[2])) - states.append({ - "state_id": f"molecule:{formula}", - "view": "molecule", - "b": b, - "behavior": { - "b": b, - "ligand_contribution_K": ks[0] if ks else 0, - "affix_Ks": affix_ks, - "attachment_profile": affix_ks, - "transition_deltas": tuple(deltas), - }, - }) - return states - - -# --------------------------------------------------------------------- -# Representation audit — capstone equivalence of refined descriptor to full admissible surface -# --------------------------------------------------------------------- - -def epac_representation_audit() -> dict[str, Any]: - """Representation-audit: final stage that asks whether the refined descriptor - (B + minimal already-declared identity-free observables) exactly represents - the boundary-relevant behavior of the full declared admissible observable surface - over the frozen states, after all identity exclusions. - - Inputs (as specified): - - frozen states (the 27) - - declared operations (the admissible boundary-relevant ones) - - candidate descriptor (B + the minimal addition from the refinement audit) - - admissible observables (the full set used for the sealed full quotient) - - identity exclusions (source_id, labels, names, record keys, replay digests, etc.) - - Stages executed (in order, with their controlling sealed results): - closure, non-degeneracy, sufficiency, collision localization, - behavioral equivalence, probe completeness, minimal refinement, - representation equivalence. - - Outputs the structured ledger requested: - overall status (SURVIVED/FALSIFIED/UNRESOLVED/BLOCKED), - witnesses, partitions, counterexamples, provenance, hmmm. - """ - from collections import defaultdict - - # === Inputs (frozen) === - states = _build_frozen_27_states() - - # === Prior stage results (sealed) === - # We re-invoke the sealed surfaces for provenance (they are cached / deterministic). - cross = compositional_boundary_closure() # closure stage (molecule-level, plus cross-scale ledger) - nondeg = None - try: - from epac_boundary_nondegeneracy import boundary_descriptor_nondegeneracy_report as _nd - nondeg = _nd() - except Exception: - nondeg = {"statuses": {"boundary_descriptor_non_degeneracy": "UNRESOLVED"}} - - suff = boundary_capacity_descriptor_sufficiency_sweep() - loss = boundary_capacity_information_loss_localization() - quot = boundary_capacity_quotient_test() - minref = boundary_capacity_minimal_refinement_audit() - - # Probe completeness (best effort; may be heavy) - probe_comp_status = "UNRESOLVED" - try: - from epac_boundary_probe_completeness import boundary_probe_completeness_report as _pc - pc = _pc() - probe_comp_status = pc.get("statuses", {}).get("boundary_probe_completeness", "UNRESOLVED") if isinstance(pc, dict) else "UNRESOLVED" - except Exception: - probe_comp_status = "UNRESOLVED" - - # === Representation equivalence computation === - # Full admissible identity-free boundary observables for representation: - # the same set the minimal refinement was proven against (B + K/profile/deltas + attachment facts). - # Refined descriptor = B + the reported minimal addition (ligand_contribution_K or attachment_profile). - - def _full_rep_key(st: dict[str, Any]) -> tuple: - beh = st["behavior"] - # identity-free tuple of all defined admissible values - items = [] - for p in ("b", "ligand_contribution_K", "affix_Ks", "attachment_profile", "transition_deltas"): - if p in beh: - items.append((p, beh[p])) - return tuple(sorted(items)) - - def _refined_key(st: dict[str, Any]) -> tuple: - # B + minimal observable(s). We use the fewest (size 1) that were proven minimal. - # Both ligand_contribution_K and attachment_profile are minimal and equivalent here. - beh = st["behavior"] - b = beh["b"] - # Choose the representative minimal: ligand_contribution_K (primary reported) - extra = [] - if "ligand_contribution_K" in beh: - extra.append(("ligand_contribution_K", beh["ligand_contribution_K"])) - elif "attachment_profile" in beh: - extra.append(("attachment_profile", beh["attachment_profile"])) - return (b, tuple(sorted(extra))) - - full_groups: dict[tuple, list[str]] = defaultdict(list) - refined_groups: dict[tuple, list[str]] = defaultdict(list) - for st in states: - full_groups[_full_rep_key(st)].append(st["state_id"]) - refined_groups[_refined_key(st)].append(st["state_id"]) - - full_partition = frozenset(frozenset(g) for g in full_groups.values()) - refined_partition = frozenset(frozenset(g) for g in refined_groups.values()) - - exact = full_partition == refined_partition - full_n = len(full_partition) - refined_n = len(refined_partition) - - # Witnesses / counterexamples - witnesses: list[dict[str, Any]] = [] - if not exact: - # Find a pair that differs - id_to_full = {} - for grp in full_partition: - for sid in grp: - id_to_full[sid] = grp - for grp in refined_partition: - rep = next(iter(grp)) - fgrp = id_to_full.get(rep) - if fgrp is not None and not all(s in fgrp for s in grp): - witnesses.append({"type": "false_merge_under_refined", "group_under_refined": sorted(grp), "full_groups": [sorted(fgrp)]}) - break - # Also splits - full_to_ref: dict[frozenset, set] = defaultdict(set) - for st in states: - full_to_ref[id_to_full[st["state_id"]]].add(_refined_key(st)) - for fgrp, rsigs in full_to_ref.items(): - if len(rsigs) > 1: - witnesses.append({"type": "false_split_under_refined", "full_group": sorted(fgrp)}) - break - - # === Stage ledger (as specified) === - stages = { - "closure": { - "status": "SURVIVED" if cross.get("all_formulas_exhibit_compositional_transition_closure") else "FALSIFIED", - "note": "subatomic→element→molecule compositional closure (local steps only)", - }, - "non_degeneracy": { - "status": nondeg.get("statuses", {}).get("boundary_descriptor_non_degeneracy", "UNRESOLVED"), - "note": "label/order/equivalent-path invariance + d/c sensitivity + no singleton accident", - }, - "sufficiency": { - "status": suff.get("aggregate", {}).get("boundary_capacity_sufficiency", "UNRESOLVED"), - "note": "B alone is many-to-one on the declared surface", - }, - "collision_localization": { - "status": loss.get("aggregate", {}).get("information_loss_localization", "UNRESOLVED"), - "note": "earliest loss points and existing witnesses identified without new coordinates", - }, - "behavioral_equivalence": { - "status": quot.get("aggregate", {}).get("boundary_capacity_quotient", "UNRESOLVED"), - "note": "B == behavior under admissible probes (identifiers withheld) — FALSIFIED on full surface", - }, - "probe_completeness": { - "status": probe_comp_status, - "note": "whether current probe inventory covers all declared boundary-relevant operations", - }, - "minimal_refinement": { - "status": minref.get("aggregate", {}).get("minimal_behavioral_refinement", "UNRESOLVED"), - "minimal": minref.get("minimal_refinement"), - "canonicality": minref.get("canonicality"), - "note": "B + smallest already-declared identity-free observables that reproduce the sealed full behavior partition", - }, - "representation_equivalence": { - "status": "SURVIVED" if exact else "FALSIFIED", - "refined_descriptor": "B + ligand_contribution_K (or attachment_profile)", - "full_observable_classes": full_n, - "refined_classes": refined_n, - "exact_match": exact, - }, - } - - overall = "SURVIVED" if stages["representation_equivalence"]["status"] == "SURVIVED" else "FALSIFIED" - - # Partitions (canonical) - partitions = { - "full_admissible_identity_free": [sorted(list(s)) for s in sorted(full_partition, key=lambda x: sorted(x))], - "refined_descriptor": [sorted(list(s)) for s in sorted(refined_partition, key=lambda x: sorted(x))], - } - - # Counterexamples (when not exact) - counterexamples = witnesses if not exact else [] - - provenance = ( - "All stages computed from the same 27 frozen states and the same admissible identity-free " - "boundary observables used by the sealed quotient and minimal-refinement audits. " - "No UCNS/PCEA, no new coordinates, no identity used for equivalence." - ) - - hmmm = ( - "A refined descriptor that exactly reproduces the observable boundary behavior on the frozen surface " - "has been earned for the current admissible probe set. It remains silent on the broader declared operation " - "surface once omitted structural observables are admitted (probe completeness). " - "Representation equivalence is therefore relative to the sealed admissible surface used for the audit." - ) - - return { - "inputs": { - "frozen_states": 27, - "declared_operations": "admissible boundary-relevant (B readout, attachment contributions, transition deltas, identity-excluded structural)", - "candidate_descriptor": "B=(3,d_boundary,c_boundary) + minimal addition (ligand_contribution_K or attachment_profile)", - "admissible_observables": "the full set used for the sealed full quotient partition (19 classes)", - "identity_exclusions": ["source_id", "formula/name", "namespace", "record key", "label", "serialized identity", "replay digest"], - }, - "stages": stages, - "outputs": { - "overall": overall, - "witnesses": witnesses, - "partitions": partitions, - "counterexamples": counterexamples, - "provenance": provenance, - "hmmm": hmmm, - }, - "sealed": True, - "no_new_coordinate": True, - } - - -# --------------------------------------------------------------------- -# Probe-relativity formalization: O ↦ Q_O ↦ D_min(O) -# Treats the locked 27-state representation audit as immutable baseline. -# Only already-declared admissible observable surfaces are considered. -# --------------------------------------------------------------------- - -def epac_probe_relativity_formalization() -> dict[str, Any]: - """Formalize EPAC probe-relativity over already-declared admissible observable surfaces. - - Mapping: O ↦ Q_O ↦ D_min(O) - O : an admissible observable set drawn from sealed prior audits - Q_O : the behavioral quotient (partition of the 27 frozen state_ids) induced by B plus O - D_min(O) : the smallest already-declared identity-free addition S to B such that - the descriptor (B + S) induces exactly Q_O on the frozen 27. - - Baseline: the locked epac_representation_audit 19-class admissible quotient - (produced by the admissible boundary probes used in the representation audit). - - Surfaces considered (no invention): - - O_B : B alone (empty addition) — baseline from quotient test - - O_admissible : the admissible set used for the sealed 19-class partition - (b + ligand_contribution_K + affix_Ks + attachment_profile + transition_deltas) - - O_struct : the 13 omitted distinguishing structural observables identified - by the sealed probe-completeness audit (plus B) - - Properties tested (on the immutable 27-state surface only): - - Monotonicity of |Q|: if O ⊆ O' then |Q_O| ≤ |Q_O'| - - Monotonicity of |D_min|: size of minimal S does not increase under enlargement of O - - Canonicality of D_min (UNIQUE vs NON-UNIQUE) - - Explicit counterexamples / witnesses for violations - - Relation of each Q_O to the locked 19-class reference partition - - Stop at first unresolved definition or prerequisite violation. - Never adds observables, never mutates frozen states, never promotes any Q to canon. - - Returns a sealed ledger with overall SURVIVED / FALSIFIED / UNRESOLVED, - per-surface records, witnesses, provenance, hmmm. - """ - from collections import defaultdict - import itertools - - # --- Immutable baseline surface (27 frozen states) --- - try: - states = _build_frozen_27_states() - except Exception as e: - return { - "status": "UNRESOLVED", - "reason": "failed to obtain immutable 27-state baseline", - "error": str(e), - "sealed": True, - "no_new_coordinate": True, - } - - if len(states) != 27: - return { - "status": "UNRESOLVED", - "reason": "baseline state count is not 27", - "count": len(states), - "sealed": True, - "no_new_coordinate": True, - } - - state_ids = [s["state_id"] for s in states] - id_to_state = {s["state_id"]: s for s in states} - - # Reference 19-class partition from the locked representation audit (immutable) - ref = epac_representation_audit() - ref_partitions = ref.get("outputs", {}).get("partitions", {}) - ref_full = ref_partitions.get("full_admissible_identity_free", []) - # Normalize to frozenset of frozensets for equality checks - def _norm_partition(p): - if not p: - return frozenset() - return frozenset(frozenset(sorted(g)) for g in p) - ref_Q = _norm_partition(ref_full) - ref_class_count = len(ref_Q) - - # --- Declared admissible observable surfaces (only from prior sealed work) --- - # O_B: pure B (the baseline used by sufficiency/quotient) - O_B = frozenset() - - # O_admissible: the set used to produce the sealed 19-class in representation audit - # (keys that appear in the behavior dicts for the 27 states in the representation code path) - O_admissible = frozenset([ - "b", "ligand_contribution_K", "affix_Ks", "attachment_profile", "transition_deltas" - ]) - - # O_struct: the 13 omitted distinguishing + B (from sealed probe-completeness + minimal refinement) - O_struct_names = None - try: - from epac_boundary_probe_completeness import OMITTED_OBSERVABLES as _OMITTED - O_struct_names = tuple(sorted(_OMITTED.keys())) - except Exception: - O_struct_names = None - - if O_struct_names is None: - # Prerequisite not met: cannot obtain the declared omitted structural set - return { - "status": "UNRESOLVED", - "reason": "could not import sealed OMITTED_OBSERVABLES from probe-completeness", - "sealed": True, - "no_new_coordinate": True, - "hmmm": "Definition of the structural observable surface is unresolved because the sealed completeness surface is not importable in this context.", - } - - O_struct = frozenset(["b"] + list(O_struct_names)) - - declared_surfaces = { - "O_B": O_B, - "O_admissible": O_admissible, - "O_struct": O_struct, - } - - # --- Uniform signature builder for any O on a state --- - # For the 4 K-family observables we read from the already-built behavior view. - # For structural names we evaluate via the sealed omitted functions (identity-excluded). - _structural_fns = None - try: - from epac_boundary_probe_completeness import OMITTED_OBSERVABLES as _OMITTED_FNS - _structural_fns = _OMITTED_FNS - except Exception: - _structural_fns = None - - # We also need state contexts for structural evaluation. Reuse the sealed helper if available. - _state_contexts_fn = None - try: - from epac_boundary_probe_completeness import _state_contexts as _sc - _state_contexts_fn = _sc - except Exception: - _state_contexts_fn = None - - # Precompute structural outputs per state_id for the 13 (if contexts available) - structural_outputs: dict[str, dict[str, Any]] = {} - if _structural_fns is not None and _state_contexts_fn is not None: - try: - contexts = _state_contexts_fn() - for sid in state_ids: - if sid in contexts: - ctx = contexts[sid] - structural_outputs[sid] = { - name: fn(ctx) for name, fn in _structural_fns.items() - } - else: - structural_outputs[sid] = {} - except Exception: - structural_outputs = {} - - def _observable_value(st: dict[str, Any], name: str) -> Any: - beh = st.get("behavior", {}) - if name in beh: - return beh[name] - if name == "b": - return st.get("b") - # structural (only if precomputed) - sid = st["state_id"] - if sid in structural_outputs and name in structural_outputs[sid]: - return structural_outputs[sid][name] - return None # absent probe is never a discriminator (per prior sealed convention) - - def _quotient_for(O: frozenset[str]) -> frozenset[frozenset[str]]: - groups: dict[tuple, list[str]] = defaultdict(list) - for st in states: - base = st["b"] - extra: list[tuple[str, Any]] = [] - for p in sorted(O): - val = _observable_value(st, p) - if val is not None: - extra.append((p, val)) - sig = (base, tuple(extra)) - groups[sig].append(st["state_id"]) - return frozenset(frozenset(g) for g in groups.values()) - - # --- Compute Q_O for each declared surface --- - surface_Q: dict[str, frozenset[frozenset[str]]] = {} - surface_class_count: dict[str, int] = {} - for sname, O in declared_surfaces.items(): - Q = _quotient_for(O) - surface_Q[sname] = Q - surface_class_count[sname] = len(Q) - - # --- D_min computation: smallest S from the already-declared candidate pool --- - # Candidate pool = the 4 used in the sealed minimal refinement audit + the 13 structural names - # (all already declared; we never invent new names). - candidate_pool: list[str] = ["ligand_contribution_K", "affix_Ks", "attachment_profile", "transition_deltas"] - if O_struct_names: - for nm in O_struct_names: - if nm not in candidate_pool: - candidate_pool.append(nm) - - def _D_min_for(target_Q: frozenset[frozenset[str]]) -> dict[str, Any]: - """Return minimal S (as tuple) that make (B + S) reproduce target_Q exactly. - Also return all minimal sets and canonicality. - """ - exact_matches: list[tuple[str, ...]] = [] - per_size: dict[int, list[tuple[str, ...]]] = defaultdict(list) - for r in range(0, len(candidate_pool) + 1): - for comb in itertools.combinations(candidate_pool, r): - S = tuple(sorted(comb)) - ds_groups: dict[tuple, list[str]] = defaultdict(list) - for st in states: - base = st["b"] - extra: list[tuple[str, Any]] = [] - for p in S: - val = _observable_value(st, p) - if val is not None: - extra.append((p, val)) - sig = (base, tuple(sorted(extra))) - ds_groups[sig].append(st["state_id"]) - ds_part = frozenset(frozenset(g) for g in ds_groups.values()) - if ds_part == target_Q: - exact_matches.append(S) - per_size[len(S)].append(S) - if not exact_matches: - return {"status": "NO_MINIMAL", "minimal_sets": [], "fewest_size": None, "canonicality": "UNRESOLVED"} - min_size = min(len(s) for s in exact_matches) - fewest = per_size[min_size] - is_unique = len(set(fewest)) == 1 - canonicality = "UNIQUE" if is_unique else "NON-UNIQUE" - # Choose a deterministic representative - chosen = tuple(sorted(fewest[0])) if fewest else () - return { - "status": "FOUND", - "minimal_sets": [list(s) for s in sorted(set(fewest), key=lambda t: (len(t), t))], - "fewest_size": min_size, - "canonicality": canonicality, - "representative": list(chosen), - "all_exact_match_sizes": sorted(per_size.keys()), - } - - # Compute D_min for each surface - surface_D: dict[str, dict[str, Any]] = {} - for sname in declared_surfaces: - target_Q = surface_Q[sname] - surface_D[sname] = _D_min_for(target_Q) - - # --- Monotonicity checks under probe addition (O ⊆ O') --- - # |Q_O| must be non-decreasing (more admissible observables can only refine or preserve partitions). - # |D_min| size is allowed to change; a finer quotient typically requires a (different) minimal addition. - # Increase in |D_min| size is not a violation but evidence of probe-relativity. - # Only O_B ⊆ O_admissible and O_B ⊆ O_struct are checked for inclusion here. - # O_admissible and O_struct are treated as distinct algebras (no forced inclusion). - - monotonicity: list[dict[str, Any]] = [] - # O_B ⊆ O_admissible - if surface_class_count["O_B"] > surface_class_count["O_admissible"]: - monotonicity.append({ - "pair": ("O_B", "O_admissible"), - "violation": "|Q| decreased on enlargement", - "from": surface_class_count["O_B"], - "to": surface_class_count["O_admissible"], - }) - # (D_min size change is recorded in surfaces but not treated as monotonicity violation) - - # O_B ⊆ O_struct (by construction O_struct contains "b") - if surface_class_count["O_B"] > surface_class_count.get("O_struct", 0): - monotonicity.append({ - "pair": ("O_B", "O_struct"), - "violation": "|Q| decreased on enlargement", - "from": surface_class_count["O_B"], - "to": surface_class_count.get("O_struct"), - }) - - # Record observed |D_min| behavior for documentation (no violation asserted). - - # --- Relation to the locked 19-class reference --- - relations: dict[str, Any] = {} - for sname in declared_surfaces: - Q = surface_Q[sname] - exact_ref = (Q == ref_Q) - relations[sname] = { - "class_count": surface_class_count[sname], - "matches_locked_19_class_reference": exact_ref, - "D_min": surface_D[sname], - } - - # --- Overall classification and stopping condition --- - # Monotonicity requirement: |Q| must be non-decreasing under probe addition (O ⊆ O' ⇒ |Q_O| ≤ |Q_O'|). - # |D_min| size is expected to be able to change when the quotient is refined; that change is - # positive evidence of probe-relativity, not a violation. - q_violations = [m for m in monotonicity if "violation" in m and "|Q|" in m.get("violation", "")] - any_no_minimal = any(d.get("status") != "FOUND" for d in surface_D.values()) - - if any_no_minimal: - overall = "UNRESOLVED" - hmmm = "At least one declared surface has no minimal descriptor addition that reproduces its Q_O from the candidate pool. Definition of D_min is unresolved for that surface on the current admissible candidates." - elif q_violations: - overall = "FALSIFIED" - hmmm = "Monotonicity of |Q| under probe addition is violated for at least one pair of already-declared surfaces." - else: - # All defined surfaces have D_min; |Q| is non-decreasing on checked inclusions. - # Different O produce different Q and different (or differently-sized) minimal descriptors. - # This is the formal demonstration of probe-relativity on the locked baseline. - overall = "SURVIVED" - hmmm = "On the locked 27-state surface, distinct admissible observable sets induce distinct quotients, each with its own (possibly non-unique) minimal descriptor. |Q| is non-decreasing under the checked probe additions. Boundary representation remains probe-relative: D_min changes with the observable algebra. The 19-class reference is one specific Q for one specific O; it is not canonical across all declared surfaces." - - # --- Witnesses / counterexamples (minimal) --- - witnesses: list[dict[str, Any]] = [] - if violations: - witnesses.extend(violations) - # Record the three Q cardinalities and the reference match status as primary evidence - for sname in declared_surfaces: - witnesses.append({ - "surface": sname, - "Q_class_count": surface_class_count[sname], - "D_min_size": surface_D[sname].get("fewest_size"), - "D_min_canonicality": surface_D[sname].get("canonicality"), - "matches_ref_19": relations[sname]["matches_locked_19_class_reference"], - }) - - # Explicit partitions are large; we report only class counts + the reference match. - # The full partitions remain available inside the sealed representation audit for the admissible case. - - provenance = ( - "All surfaces, quotients, and D_min computations are derived exclusively from the locked 27 frozen states " - "produced by _build_frozen_27_states() and the already-declared observable sets and functions exported by " - "the sealed quotient, probe-completeness, minimal-refinement, and representation-audit surfaces. " - "No new observables, no mutation of frozen states, no promotion of any Q_O to canonical status. " - "The 19-class partition from epac_representation_audit is used only as the immutable reference baseline." - ) - - return { - "inputs": { - "frozen_states": 27, - "baseline": "locked epac_representation_audit (19-class admissible quotient)", - "declared_surfaces": {k: sorted(list(v)) for k, v in declared_surfaces.items()}, - "candidate_pool_for_D_min": candidate_pool, - "identity_exclusions": ["source_id", "formula/name", "namespace", "record key", "label", "serialized identity", "replay digest"], - }, - "surfaces": { - sname: { - "O": sorted(list(declared_surfaces[sname])), - "Q_class_count": surface_class_count[sname], - "D_min": surface_D[sname], - "matches_locked_19_reference": relations[sname]["matches_locked_19_class_reference"], - } - for sname in declared_surfaces - }, - "monotonicity_checks": monotonicity, - "relations_to_reference": relations, - "outputs": { - "overall": overall, - "witnesses": witnesses, - "reference_19_class_count": ref_class_count, - "provenance": provenance, - "hmmm": hmmm, - }, - "sealed": True, - "no_new_coordinate": True, - } diff --git a/research/epac/epac_periodic.py b/research/epac/epac_periodic.py deleted file mode 100644 index 6dde893..0000000 --- a/research/epac/epac_periodic.py +++ /dev/null @@ -1,409 +0,0 @@ -"""Element gonols closed as EPAC Public Gonols from nucleon then electron structure. - -Precursors: each proton and each neutron is a closed gonol. The nucleus is -their affixiation. Electrons then couple to that closed nucleus. Molecular -construction must not reopen nucleons or electrons. Letters are not axes. - -Usage guidance --------------- -Each nucleon, nucleus, electron, shell, and element is an EPAC Public Gonol -on the UCNS carrier. This module does not use ``edcm.gonol``. - - from epac_periodic import construct_element_gonol, construct_periodic_table - - helium = construct_element_gonol("He") - nucleus = helium.gonol.participants[0] - assert [p.relation for p in nucleus.participants] == [ - "epac.atomic.proton", "epac.atomic.proton", - "epac.atomic.neutron", "epac.atomic.neutron", - ] -""" - -from __future__ import annotations - -from typing import Iterable - -from epac_atomic import AtomicRecord, ElectronState, iter_table -from epac_dimensional_arity import ( - geometry_from_declared_couplings, - oriented_instance_couplings, - space, -) -from epac_public_gonol import ( - ClosedPublicGonol, - PublicGonolReceipt, - construct_public_gonol, - replay_public_gonol, -) - -# Subatomic gonol supplies the carried "harmonic-surviving" for the element symbol. -# We attach the identical value on the periodic (native element) gonol so the -# nuclear harmonic layer is a first-class carried fact on the primary element -# construction path, parallel to subatomic_gonol. -import subatomic_gonol as _subatomic_gonol - -# Elementary charge in units of e. Nuclear Z is the proton-count sum. -PROTON_CHARGE = 1 -NEUTRON_CHARGE = 0 -ELECTRON_CHARGE = -1 -NUCLEUS_RELATION = "epac.atomic.nucleus" -PROTON_RELATION = "epac.atomic.proton" -NEUTRON_RELATION = "epac.atomic.neutron" - - -def _carrier_glyph(text: str) -> str | None: - if len(text) == 1: - return text - return None - - -def _electron_options(electron: ElectronState) -> tuple[tuple[str, str], ...]: - return ( - ("n", str(electron.n)), - ("l", str(electron.l)), - ("m_l", str(electron.m_l)), - ("m_s", str(electron.m_s)), - ("shell", electron.shell), - ("subshell", electron.subshell), - ("angular-id", electron.angular_id), - ("radial-nodes", str(electron.radial_nodes)), - ("z-eff", electron.z_eff), - ("e-rydberg", electron.e_rydberg), - ("valence", "true" if electron.valence else "false"), - ("paired", "true" if electron.paired else "false"), - ) - - -def _construct_electron( - electron: ElectronState, *, symbol: str, atom_occurrence: int -) -> ClosedPublicGonol: - return construct_public_gonol( - source_id=f"epac.electron:{symbol}#{atom_occurrence}:{electron.index}", - relation="epac.atomic.electron", - identity_glyph="e", - carried_options=_electron_options(electron), - occurrence=electron.index, - ).gonol - - -def _construct_shell( - n: int, - electrons: Iterable[ElectronState], - *, - symbol: str, - atom_occurrence: int, -) -> ClosedPublicGonol: - members = tuple( - _construct_electron(e, symbol=symbol, atom_occurrence=atom_occurrence) for e in electrons - ) - return construct_public_gonol( - source_id=f"epac.shell:{symbol}#{atom_occurrence}:n{n}", - relation="epac.atomic.shell", - identity_glyph=_carrier_glyph(str(n)), - participants=members, - occurrence=n, - carried_options=(("n", str(n)),), - ).gonol - - -def _proton_dimension_id(symbol: str, atom_occurrence: int, index: int) -> str: - return f"epac.proton:{symbol}#{atom_occurrence}:{index}" - - -def _neutron_dimension_id(symbol: str, atom_occurrence: int, index: int) -> str: - return f"epac.neutron:{symbol}#{atom_occurrence}:{index}" - - -def _construct_proton( - *, symbol: str, atom_occurrence: int, index: int -) -> ClosedPublicGonol: - return construct_public_gonol( - source_id=_proton_dimension_id(symbol, atom_occurrence, index), - relation=PROTON_RELATION, - occurrence=index, - carried_options=( - ("charge", str(PROTON_CHARGE)), - ("symbol", symbol), - ("kind", "proton"), - ), - ).gonol - - -def _construct_neutron( - *, symbol: str, atom_occurrence: int, index: int -) -> ClosedPublicGonol: - return construct_public_gonol( - source_id=_neutron_dimension_id(symbol, atom_occurrence, index), - relation=NEUTRON_RELATION, - occurrence=index, - carried_options=( - ("charge", str(NEUTRON_CHARGE)), - ("symbol", symbol), - ("kind", "neutron"), - ), - ).gonol - - -def _declared_nuclear_space(record: AtomicRecord, *, atom_occurrence: int): - """Neutrons couple to protons. Proton-proton and neutron-neutron are not inferred. - - Hydrogen-1 has one proton and no neutrons, so no nuclear 3. - """ - - if record.proton_count != record.Z: - raise ValueError(f"{record.symbol}: proton count must equal Z") - if record.neutron_count != record.A - record.Z: - raise ValueError(f"{record.symbol}: neutron count must equal A-Z") - proton_ids = [ - _proton_dimension_id(record.symbol, atom_occurrence, index) - for index in range(record.proton_count) - ] - neutron_ids = [ - _neutron_dimension_id(record.symbol, atom_occurrence, index) - for index in range(record.neutron_count) - ] - charges = { - **{proton_id: PROTON_CHARGE for proton_id in proton_ids}, - **{neutron_id: NEUTRON_CHARGE for neutron_id in neutron_ids}, - } - declarations = [ - [proton_id, neutron_id] for proton_id in proton_ids for neutron_id in neutron_ids - ] - declared = space([*proton_ids, *neutron_ids], declarations, charges=charges) - for proton_id in proton_ids: - if neutron_ids: - oriented_instance_couplings( - declared, hub_id=proton_id, instance_ids=neutron_ids - ) - return declared - - -def _construct_nucleus(record: AtomicRecord, *, atom_occurrence: int) -> ClosedPublicGonol: - protons = tuple( - _construct_proton(symbol=record.symbol, atom_occurrence=atom_occurrence, index=index) - for index in range(record.proton_count) - ) - neutrons = tuple( - _construct_neutron(symbol=record.symbol, atom_occurrence=atom_occurrence, index=index) - for index in range(record.neutron_count) - ) - if len(protons) != record.Z or len(neutrons) != record.neutron_count: - raise ValueError(f"{record.symbol}: nucleon gonols must match Z and A-Z") - geometry = geometry_from_declared_couplings( - _declared_nuclear_space(record, atom_occurrence=atom_occurrence) - ) - couplings = geometry["couplings"] - structure = geometry["structure"] if couplings else None - return construct_public_gonol( - source_id=f"epac.nucleus:{record.symbol}#{atom_occurrence}", - relation=NUCLEUS_RELATION, - participants=(*protons, *neutrons), - carried_options=( - ("Z", str(record.Z)), - ("A", str(record.A)), - ("protons", str(record.proton_count)), - ("neutrons", str(record.neutron_count)), - ("symbol", record.symbol), - ), - occurrence=0, - couplings=couplings, - structure=structure, - ).gonol - - -def _nucleus_dimension_id(symbol: str, atom_occurrence: int) -> str: - return f"epac.nucleus:{symbol}#{atom_occurrence}" - - -def _electron_dimension_id(symbol: str, atom_occurrence: int, index: int) -> str: - return f"epac.electron:{symbol}#{atom_occurrence}:{index}" - - -def _declared_atomic_space(record: AtomicRecord, *, atom_occurrence: int): - """One ``(nucleus, electron_i)`` coupling for every electron instance. - - Closed shells still participate as instances. Letters do not. - """ - - hub = _nucleus_dimension_id(record.symbol, atom_occurrence) - electron_ids = [ - _electron_dimension_id(record.symbol, atom_occurrence, electron.index) - for electron in record.electrons - ] - charges = {hub: record.Z, **{electron_id: ELECTRON_CHARGE for electron_id in electron_ids}} - declared = space( - [hub, *electron_ids], - [[hub, electron_id] for electron_id in electron_ids], - charges=charges, - ) - oriented_instance_couplings(declared, hub_id=hub, instance_ids=electron_ids) - return declared - - -def construct_element_gonol(symbol: str, *, occurrence: int = 0) -> PublicGonolReceipt: - """Close one element Public Gonol whose participants are nucleus + electron shells.""" - - record = None - for item in iter_table(): - if item.symbol == symbol: - record = item - break - if record is None: - raise ValueError(f"no atomic record for symbol {symbol!r}") - shells: list[ClosedPublicGonol] = [] - by_n: dict[int, list[ElectronState]] = {} - for electron in record.electrons: - by_n.setdefault(electron.n, []).append(electron) - for n in sorted(by_n): - shells.append(_construct_shell(n, by_n[n], symbol=symbol, atom_occurrence=occurrence)) - nucleus = _construct_nucleus(record, atom_occurrence=occurrence) - unpaired = record.unpaired_valence - promoted = record.promoted_unpaired_valence - - # Nuclear harmonic survival carried from the subatomic layer (first-class - # fact on the primary periodic element gonol, parallel to subatomic_gonol - # and to the molecule PublicGonol carry). - sub_rec = _subatomic_gonol.construct_subatomic_gonol(record.symbol) - harmonic_survival = dict(sub_rec.gonol.carried_options).get("harmonic-surviving", "none") - - # Lifted spiral (UCNS framed Möbius root-loop) carried as a first-class fact - # on the native periodic element gonol (parallel to harmonic-surviving). - # Pure projection of the framed root-loop evidence witnessed by the gonol. - # For bare elements: standard double-cover frames, axes = element participants, - # attachment count 0 (attachments are declared at molecule valence sites). - element_axes = [_nucleus_dimension_id(record.symbol, occurrence)] - for e in record.electrons: - element_axes.append(_electron_dimension_id(record.symbol, occurrence, e.index)) - ls_axes = tuple(sorted(element_axes)) - ls_frames = ("positive-local-frame", "reversed-local-frame", "positive-local-frame") - lifted_spiral_value = "|".join(ls_frames) + ";" + ",".join(ls_axes) + ";0" - - carried = ( - ("symbol", record.symbol), - ("Z", str(record.Z)), - ("period", str(record.period)), - ("group", str(record.group)), - ("A", str(record.A)), - ("electron-configuration", record.configuration), - ("valence-n", str(record.valence_n)), - ("valence-electrons", str(record.valence_electrons)), - ("unpaired-valence-count", str(len(unpaired))), - ("unpaired-valence-lm", ",".join(f"{e.l}:{e.m_l}" for e in unpaired) or "none"), - ("promoted-unpaired-count", str(len(promoted))), - ("promoted-unpaired-lm", ",".join(f"{e.l}:{e.m_l}" for e in promoted) or "none"), - ("valence-angular-ids", ",".join(e.angular_id for e in record.electrons if e.valence)), - ("harmonic-surviving", harmonic_survival or "none"), - ("lifted-spiral", lifted_spiral_value), - ) - geometry = geometry_from_declared_couplings( - _declared_atomic_space(record, atom_occurrence=occurrence) - ) - # After minimal-refinement audit showed singleton value, carry one of the - # distinguishing boundary-structure observables (charged_structure_readout) - # as a first-class fact on the element gonol (parallel to harmonic/lifted). - # This is the "maximal" surface: the minimal signal made durable and addressable. - from epac_dimensional_arity import charged_structure_readout as _csr - bstruct = _csr(geometry["structure"]) - carried = carried + (("boundary-charged-structure", repr(bstruct)),) - return construct_public_gonol( - source_id=f"epac.periodic:{symbol}#{occurrence}", - relation="epac.atomic.element", - identity_glyph=_carrier_glyph(symbol), - participants=(nucleus, *shells), - carried_options=carried, - occurrence=occurrence, - couplings=geometry["couplings"], - structure=geometry["structure"], - ) - - -def harmonic_survival_carried_on_element(receipt: PublicGonolReceipt) -> tuple[str, ...]: - """Return the nuclear harmonic survival carried on a periodic element gonol receipt. - - Sources exclusively from the "harmonic-surviving" carried_option (the - single source of truth attached at construction from the subatomic layer). - """ - carried = dict(receipt.gonol.carried_options) - hs = carried.get("harmonic-surviving", "none") - if hs and hs != "none": - return tuple(hs.split(",")) - return () - - -def lifted_spiral_carried_on_element(receipt: PublicGonolReceipt) -> tuple: - """Return the lifted spiral (UCNS framed Möbius) canonical signature carried on an element gonol receipt. - - Sources exclusively from the "lifted-spiral" carried_option (pure projection - of the framed root-loop evidence witnessed at construction). - Returns (frames_tuple, sorted_axes_tuple, attachment_count) or ((), (), 0). - Parallel to harmonic_survival_carried_on_element. - """ - carried = dict(receipt.gonol.carried_options) - val = carried.get("lifted-spiral", "") - if not val: - return ((), (), 0) - try: - frames_part, axes_part, ac_part = val.split(";", 2) - frames = tuple(frames_part.split("|")) if frames_part else () - axes = tuple(sorted(a for a in axes_part.split(",") if a)) if axes_part else () - ac = int(ac_part) if ac_part else 0 - return (frames, axes, ac) - except Exception: - return ((), (), 0) - - -def boundary_capacity_from_element_receipt(receipt: PublicGonolReceipt) -> tuple: - """Pure projection of boundary capacity for a bare periodic element gonol. - - Interior modes fixed at 3 (canonical double cover). Boundary dim = len(axes) - from the carried lifted-spiral. Boundary coupling capacity = 0 (bare element). - """ - ls = lifted_spiral_carried_on_element(receipt) - if ls and len(ls) == 3: - _frames, axes, _ac = ls - return (3, len(axes) if axes else 0, 0) - return (3, 0, 0) - - -def construct_periodic_table() -> dict[str, PublicGonolReceipt]: - return {record.symbol: construct_element_gonol(record.symbol) for record in iter_table()} - - -def replay_element_gonol(receipt: PublicGonolReceipt) -> PublicGonolReceipt: - return replay_public_gonol(receipt) - - -def atomic_of(symbol: str) -> AtomicRecord: - for record in iter_table(): - if record.symbol == symbol: - return record - raise ValueError(symbol) - - -def symbol_of(gonol: ClosedPublicGonol) -> str: - for key, value in gonol.carried_options: - if key == "symbol": - return value - if gonol.identity_glyph: - return gonol.identity_glyph - raise KeyError("symbol") - - -def carried(gonol: ClosedPublicGonol, key: str) -> str: - for item_key, value in gonol.carried_options: - if item_key == key: - return value - raise KeyError(key) - - -__all__ = [ - "construct_element_gonol", - "construct_periodic_table", - "replay_element_gonol", - "atomic_of", - "symbol_of", - "carried", - "harmonic_survival_carried_on_element", - "lifted_spiral_carried_on_element", - "boundary_capacity_from_element_receipt", -] diff --git a/research/epac/epac_public_gonol.py b/research/epac/epac_public_gonol.py deleted file mode 100644 index 1eb8176..0000000 --- a/research/epac/epac_public_gonol.py +++ /dev/null @@ -1,450 +0,0 @@ -"""EPAC Public Gonol constructor. - -EPAC closes gonols on the UCNS Public Gonol carrier. This is not the EDCM -text-domain constructor. Glyphs are identity coordinates only; Public Gonol -function operations and a Möbius coupling law remain hmmm. - -Charge state is already in the math: per-slot nuclear Z with Möbius ε at t=0 -from ``(t, ε) ~ (t+n, (-1)^n ε)``. Oriented couplings plus those charge -states plus degree are the three-dimensional structure. Representing that 3 -takes a 4-component quaternion; the extra coordinate is the scalar ε. No -cartesian embedding, ternary coupling, or Hamilton-product coupling is inferred. - -Usage guidance --------------- - from epac_public_gonol import construct_public_gonol, replay_public_gonol - - oxygen = construct_public_gonol( - source_id="epac.atomic.element:O#0", - relation="epac.atomic.element", - identity_glyph="O", - carried_options=(("Z", "8"), ("symbol", "O")), - ) - assert oxygen.constructor_id == "epac.public_gonol" - assert replay_public_gonol(oxygen).receipt_digest == oxygen.receipt_digest -""" - -# === MODULE_BUILD === -# id: epac_public_gonol -# module_name: epac_public_gonol -# module_kind: experiment -# summary: EPAC candidate constructor that closes gonols on the UCNS Public Gonol carrier with oriented couplings and arity charge states; not the EDCM text-domain constructor -# owner: The Interdependency -# public_surface: CONSTRUCTOR_ID, CONSTRUCTOR_VERSION, PINNED_PUBLIC_GONOL_SHA256, ClosedPublicGonol, PublicGonolReceipt, PublicGonolConstructionError, construct_public_gonol, replay_public_gonol, canonical_receipt_bytes -# internal_surface: _require_text, _identity_position, _geometry, _participant_payload, _atomic_payload, _receipt_payload, _digest -# auth_boundary: EPAC owns particle/energy gonol closure; UCNS owns Public Gonol carrier identity and native Möbius ε; EDCM text-domain constructor is not used; METAPAT affixiation is consumed, not redefined -# storage_boundary: none; receipts remain caller-owned in-memory objects -# network_boundary: none -# user_data_boundary: caller-supplied source_id, relation, participants, and carried options remain in memory -# admin_only: false -# tests: tests.test_epac_public_gonol, tests.test_periodic_element_gonols, tests.test_molecular_affixiation -# rollout: explicit EPAC candidate constructor; no canon selection, no EDCM scale option sets, no invented position operation -# rollback: remove this module; do not fall back to edcm.gonol for EPAC construction -# requires: ucns_public_gonol_geometry, ucns_native_mobius_geometry -# since: 2026-08-22 -# unresolved: exact UCNS geometric operation of Public Gonol function positions; UCNS Möbius-carrier affixiation/coupling law; two-letter element symbols have no single carrier glyph -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: epac_public_gonol_is_not_edcm_gonol -# given: an EPAC gonol is constructed -# then: constructor_id is epac.public_gonol and edcm.gonol is not imported or invoked -# class: doctrine -# since: 2026-08-22 -# -# id: epac_public_gonol_binds_ucns_carrier_identity -# given: identity_glyph is an admitted Public Gonol glyph -# then: the closed gonol carries the exact UCNS index/glyph pair and the pinned carrier digest -# class: construction -# since: 2026-08-22 -# -# id: epac_public_gonol_replays_byte_identical -# given: a PublicGonolReceipt -# then: replay_public_gonol reproduces the same receipt_digest -# class: correctness -# since: 2026-08-22 -# -# id: charged_oriented_couplings_are_the_structure -# given: declared oriented couplings with per-slot charges -# then: receipt.structure is the combination of those couplings, arity charge states, and degree; no (x,y,z) coupling is inferred -# class: construction -# since: 2026-08-22 -# === END CONTRACTS === - -from __future__ import annotations - -from collections.abc import Mapping as MappingABC -from collections.abc import Sequence as SequenceABC -from dataclasses import dataclass -from hashlib import sha256 -import json -from types import MappingProxyType -from typing import Any, Mapping, Sequence - -from ucns import ( - PUBLIC_GONOL_SHA256, - native_mobius_state, - public_gonol_function, - public_gonol_sha256, -) - - -CONSTRUCTOR_ID = "epac.public_gonol" -CONSTRUCTOR_VERSION = "v1" -PINNED_PUBLIC_GONOL_SHA256 = PUBLIC_GONOL_SHA256 -STANDING = "implemented-candidate" -SELECTION_EFFECT = "none" - -NONCLAIMS: tuple[str, ...] = ( - "not selected canon", - "not EDCM text-domain gonol construction", - "not a UCNS geometric function operation", - "not a UCNS Möbius coupling law", - "not METAPAT canon promotion", - "not imported chemistry shape names", -) - -HMMM: tuple[str, ...] = ( - "exact UCNS geometric operation of each Public Gonol function position", - "UCNS Möbius-carrier affixiation/coupling law", - "two-letter element symbols have no single Public Gonol glyph", -) - - -class PublicGonolConstructionError(RuntimeError): - """Fail-closed EPAC Public Gonol constructor error.""" - - -@dataclass(frozen=True, slots=True) -class ClosedPublicGonol: - """One closed EPAC gonol. Atomic at any later declared participation.""" - - source_id: str - occurrence: int - relation: str - identity_glyph: str | None - carrier_index: int | None - participants: tuple["ClosedPublicGonol", ...] - carried_options: tuple[tuple[str, str], ...] - couplings: tuple[Mapping[str, Any], ...] - structure: Mapping[str, Any] | None - atomic_id: str - receipt_digest: str - geometry_digest: str - - -@dataclass(frozen=True, slots=True) -class PublicGonolReceipt: - """Deterministic construction receipt for one EPAC Public Gonol.""" - - constructor_id: str - constructor_version: str - standing: str - selection_effect: str - source_id: str - gonol: ClosedPublicGonol - receipt_digest: str - structure: Mapping[str, Any] | None - nonclaims: tuple[str, ...] - hmmm: tuple[str, ...] - - -def _require_text(value: str, *, field: str) -> str: - if not isinstance(value, str) or not value or value.isspace(): - raise PublicGonolConstructionError(f"{field} must be exact non-empty text") - return value - - -def _identity_position(identity_glyph: str | None) -> tuple[str | None, int | None]: - if identity_glyph is None: - return (None, None) - if not isinstance(identity_glyph, str) or len(identity_glyph) != 1: - raise PublicGonolConstructionError( - "identity_glyph must be one admitted Public Gonol scalar or None" - ) - try: - position = public_gonol_function(identity_glyph) - except (TypeError, ValueError) as exc: - raise PublicGonolConstructionError(str(exc)) from exc - return (position.glyph, position.index) - - -def _geometry(identity_glyph: str | None, carrier_index: int | None) -> dict[str, Any]: - digest = public_gonol_sha256() - if digest != PINNED_PUBLIC_GONOL_SHA256: - raise PublicGonolConstructionError( - "UCNS Public Gonol digest mismatch: " - f"constructor pins {PINNED_PUBLIC_GONOL_SHA256}, computed {digest}" - ) - origin = native_mobius_state(0) - identity: dict[str, Any] | None = None - if identity_glyph is not None and carrier_index is not None: - identity = {"index": carrier_index, "glyph": identity_glyph} - return { - "state": "bound", - "authority": "ucns.public_gonol", - "authority_binding": "explicit", - "carrier_digest": digest, - "identity_position": identity, - "mobius_epsilon_t0": origin.frame.sign, - "position_operation": "hmmm", - } - - -def _freeze_json(value: Any) -> Any: - if value is None or isinstance(value, (str, int, float, bool)): - return value - if isinstance(value, MappingABC): - return MappingProxyType({str(key): _freeze_json(item) for key, item in value.items()}) - if isinstance(value, SequenceABC) and not isinstance(value, (str, bytes)): - return tuple(_freeze_json(item) for item in value) - raise PublicGonolConstructionError(f"value is not JSON-stable: {type(value)!r}") - - -def _json_ready(value: Any) -> Any: - if isinstance(value, MappingABC): - return {str(key): _json_ready(item) for key, item in value.items()} - if isinstance(value, SequenceABC) and not isinstance(value, (str, bytes)): - return [_json_ready(item) for item in value] - return value - - -def _tuple_tree(value: Any) -> Any: - if isinstance(value, MappingABC): - return tuple(sorted((str(key), _tuple_tree(item)) for key, item in value.items())) - if isinstance(value, SequenceABC) and not isinstance(value, (str, bytes)): - return tuple(_tuple_tree(item) for item in value) - return value - - -def _coupling_signature(item: Mapping[str, Any]) -> tuple[Any, int, Any]: - declared = item.get("declared_ids", item.get("coupling")) - charge_state = item.get("charge_state") - if charge_state is None: - charge_state = (item.get("slot_charges"), item.get("mobius_epsilon_t0")) - return (_tuple_tree(declared), int(item.get("arity", -1)), _tuple_tree(charge_state)) - - -def _structure_part_signature(item: Mapping[str, Any]) -> tuple[Any, int, Any]: - return ( - _tuple_tree(item.get("coupling")), - int(item.get("arity", -1)), - _tuple_tree(item.get("charge_state")), - ) - - -def _validate_structure_matches_couplings( - couplings: Sequence[Mapping[str, Any]], - structure: Mapping[str, Any] | None, -) -> None: - if not couplings and structure is None: - return - if not couplings or structure is None: - raise PublicGonolConstructionError( - "couplings and structure must be supplied together" - ) - parts = structure.get("parts") - if not isinstance(parts, SequenceABC) or isinstance(parts, (str, bytes)): - raise PublicGonolConstructionError("structure parts must be a sequence") - expected = tuple(sorted((_coupling_signature(item) for item in couplings), key=repr)) - actual = tuple(sorted((_structure_part_signature(item) for item in parts), key=repr)) - if expected != actual: - raise PublicGonolConstructionError( - "structure must match the supplied declared couplings before closure" - ) - - -def _participant_payload(item: ClosedPublicGonol) -> dict[str, Any]: - return { - "source_id": item.source_id, - "occurrence": item.occurrence, - "relation": item.relation, - "identity_glyph": item.identity_glyph, - "carrier_index": item.carrier_index, - "atomic_id": item.atomic_id, - "receipt_digest": item.receipt_digest, - "geometry_digest": item.geometry_digest, - "carried_options": [list(pair) for pair in item.carried_options], - "couplings": _freeze_json(item.couplings), - "structure": _freeze_json(item.structure), - "participants": [_participant_payload(child) for child in item.participants], - } - - -def _atomic_payload( - *, - source_id: str, - occurrence: int, - relation: str, - identity_glyph: str | None, - carrier_index: int | None, - participants: tuple[ClosedPublicGonol, ...], - carried_options: tuple[tuple[str, str], ...], - couplings: tuple[Mapping[str, Any], ...], - structure: Mapping[str, Any] | None, -) -> dict[str, Any]: - return { - "constructor_id": CONSTRUCTOR_ID, - "constructor_version": CONSTRUCTOR_VERSION, - "standing": STANDING, - "selection_effect": SELECTION_EFFECT, - "source_id": source_id, - "occurrence": occurrence, - "relation": relation, - "identity_glyph": identity_glyph, - "carrier_index": carrier_index, - "participants": [_participant_payload(item) for item in participants], - "carried_options": [list(pair) for pair in carried_options], - "couplings": _freeze_json(couplings), - "structure": _freeze_json(structure), - "closure_invariant": "once closed, a gonol is atomic at any later participation", - } - - -def _receipt_payload( - *, - source_id: str, - gonol_payload: Mapping[str, Any], - geometry: Mapping[str, Any], - atomic_id: str, - geometry_digest: str, -) -> dict[str, Any]: - return { - "constructor_id": CONSTRUCTOR_ID, - "constructor_version": CONSTRUCTOR_VERSION, - "standing": STANDING, - "selection_effect": SELECTION_EFFECT, - "source_id": source_id, - "gonol": gonol_payload, - "atomic_id": atomic_id, - "geometry": _freeze_json(geometry), - "geometry_digest": geometry_digest, - "nonclaims": list(NONCLAIMS), - "hmmm": list(HMMM), - } - - -def canonical_receipt_bytes(payload: Mapping[str, Any]) -> bytes: - return json.dumps( - _json_ready(payload), - ensure_ascii=False, - sort_keys=True, - separators=(",", ":"), - ).encode("utf-8") - - -def _digest(payload: Mapping[str, Any]) -> str: - return sha256(canonical_receipt_bytes(payload)).hexdigest() - - -def construct_public_gonol( - *, - source_id: str, - relation: str, - participants: Sequence[ClosedPublicGonol] = (), - identity_glyph: str | None = None, - occurrence: int = 0, - carried_options: Sequence[tuple[str, str]] = (), - couplings: Sequence[Mapping[str, Any]] = (), - structure: Mapping[str, Any] | None = None, -) -> PublicGonolReceipt: - """Close one EPAC gonol on the UCNS Public Gonol carrier.""" - - source_id = _require_text(source_id, field="source_id") - relation = _require_text(relation, field="relation") - if isinstance(occurrence, bool) or not isinstance(occurrence, int) or occurrence < 0: - raise PublicGonolConstructionError("occurrence must be a non-negative int") - closed_participants = tuple(participants) - for item in closed_participants: - if not isinstance(item, ClosedPublicGonol): - raise PublicGonolConstructionError("participants must already be closed EPAC public gonols") - options = tuple( - ( - _require_text(key, field="carried option key"), - _require_text(value, field="carried option value"), - ) - for key, value in carried_options - ) - frozen_couplings = tuple(_freeze_json(item) for item in couplings) - frozen_structure = None if structure is None else _freeze_json(structure) - _validate_structure_matches_couplings(frozen_couplings, frozen_structure) - glyph, index = _identity_position(identity_glyph) - geometry = _geometry(glyph, index) - gonol_payload = _atomic_payload( - source_id=source_id, - occurrence=occurrence, - relation=relation, - identity_glyph=glyph, - carrier_index=index, - participants=closed_participants, - carried_options=options, - couplings=frozen_couplings, - structure=frozen_structure, - ) - atomic_id = _digest({"atomic": gonol_payload}) - geometry_digest = _digest({"geometry": geometry}) - receipt_payload = _receipt_payload( - source_id=source_id, - gonol_payload=gonol_payload, - geometry=geometry, - atomic_id=atomic_id, - geometry_digest=geometry_digest, - ) - receipt_digest = _digest(receipt_payload) - gonol = ClosedPublicGonol( - source_id=source_id, - occurrence=occurrence, - relation=relation, - identity_glyph=glyph, - carrier_index=index, - participants=closed_participants, - carried_options=options, - couplings=frozen_couplings, - structure=frozen_structure, - atomic_id=atomic_id, - receipt_digest=receipt_digest, - geometry_digest=geometry_digest, - ) - return PublicGonolReceipt( - constructor_id=CONSTRUCTOR_ID, - constructor_version=CONSTRUCTOR_VERSION, - standing=STANDING, - selection_effect=SELECTION_EFFECT, - source_id=source_id, - gonol=gonol, - receipt_digest=receipt_digest, - structure=frozen_structure, - nonclaims=NONCLAIMS, - hmmm=HMMM, - ) - - -def replay_public_gonol(receipt: PublicGonolReceipt) -> PublicGonolReceipt: - """Replay one receipt from its closed gonol. Reproduces construction identity.""" - - gonol = receipt.gonol - return construct_public_gonol( - source_id=gonol.source_id, - relation=gonol.relation, - participants=gonol.participants, - identity_glyph=gonol.identity_glyph, - occurrence=gonol.occurrence, - carried_options=gonol.carried_options, - couplings=gonol.couplings, - structure=gonol.structure, - ) - - -__all__ = [ - "CONSTRUCTOR_ID", - "CONSTRUCTOR_VERSION", - "ClosedPublicGonol", - "HMMM", - "NONCLAIMS", - "PINNED_PUBLIC_GONOL_SHA256", - "PublicGonolConstructionError", - "PublicGonolReceipt", - "canonical_receipt_bytes", - "construct_public_gonol", - "replay_public_gonol", -] diff --git a/research/epac/subatomic/element_affixiation_candidate.py b/research/epac/subatomic/element_affixiation_candidate.py deleted file mode 100644 index f8d0f30..0000000 --- a/research/epac/subatomic/element_affixiation_candidate.py +++ /dev/null @@ -1,271 +0,0 @@ -"""Identity-only subatomic element affixiation candidate. - -This module implements the provisional baseline from -``subatomic-affixiation-baseline.md``: hydrogen, helium, lithium, and carbon -element-gonol candidates over the established UCNS carrier identity surfaces -(Public Gonol 157) and the native Möbius root-loop quotient, using the Möbius -turn index as the time-agnostic ordered parameter. - -It consumes exactly two UCNS public surfaces: - -- ``ucns.public_gonol_function`` for carrier identity positions; -- ``ucns.native_mobius_state`` for the established Möbius framing. - -No Public Gonol position operation is defined, inferred, or asserted here. -Status: CROSS-DOMAIN-HYPOTHESIS / provisional. Not org canon. - -Usage guidance: - - PYTHONPATH=/src python3 - <<'PY' - from element_affixiation_candidate import affixiate_element, replay_element - - he = affixiate_element("He") - print(he.receipt) - ok, replay_receipt = replay_element("He") - print("replay byte-identical:", ok and replay_receipt == he.receipt) - PY -""" - -# === MODULE_BUILD === -# id: epac_subatomic_element_affixiation_candidate -# module_name: element_affixiation_candidate -# module_kind: experiment -# summary: identity-only H/He/Li/C element-gonol candidates over established UCNS carrier identity and native Möbius framing; no position operation invented -# owner: The Interdependency -# public_surface: ISOTOPE_DEFAULTS, CONSTRUCTION_IDS, ElementCandidate, affixiate_element, replay_element, element_receipt -# internal_surface: _canonical_record, _t_states -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: subatomic.test_element_affixiation_candidate -# rollout: local candidate module under stack/research/epac/subatomic/ -# rollback: remove module, tests, and generated receipts -# requires: ucns_public_gonol_geometry, ucns_native_mobius_geometry -# since: 2026-08-22 -# unresolved: Public Gonol position operations; harmonic notation; isotope defaults are instance-resolved; epac canonical repository absent -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: candidate_uses_only_established_ucns_surfaces -# given: the candidate module is imported and executed -# then: only ucns.public_gonol_function and ucns.native_mobius_state are consumed; no position operation is defined, inferred, or called -# class: safety -# -# id: element_identity_positions_exact -# given: an element symbol with default isotope (Z, A) -# then: proton positions are exactly 1..Z and neutron positions are exactly Z+1..A on the 157-position carrier, as identity coordinates only -# class: correctness -# -# id: mobius_parameter_sequence_exact -# given: the Möbius turn index t in {0, 1, 2} is traversed -# then: visible phase is unchanged, the local frame sequence is POSITIVE -> REVERSED -> POSITIVE, and complete_key differs only at t=1 -# class: correctness -# -# id: receipt_deterministic_and_replayable -# given: the same element and the same pinned source identities -# then: the receipt is byte-identical across independent constructions -# class: correctness -# -# id: no_physics_or_canon_claim -# given: any constructed candidate -# then: status remains CROSS-DOMAIN-HYPOTHESIS and no empirical validity, theorem status, measurement validity, or canon promotion is claimed -# class: doctrine -# === END CONTRACTS === - -from __future__ import annotations - -from dataclasses import dataclass -from fractions import Fraction -import hashlib -import json - -from ucns import native_mobius_state, public_gonol_function - -SOURCE_COMMITS = { - "metapat": "34d954aa1e2092e615b03a180500f6b6977f501e", - "ucns": "1975fe70cf4e0826a8020c2da3047569e277af64", -} - -CONSTRUCTION_IDS = { - "relation": "metapat.affixiation_harmonics.affixiation", - "ordered_parameter": "ucns.native-mobius-turn-index", - "closure_scale": "epac.subatomic.atomic", - "status": "CROSS-DOMAIN-HYPOTHESIS", -} - -# Default isotope instances are instance-resolved, not canonical admission law. -# Broadened subatomic coverage: Z=1..36 (K through Kr) for the subatomic gonol program. -ISOTOPE_DEFAULTS = { - "H": (1, 1), "He": (2, 4), "Li": (3, 7), "Be": (4, 9), - "B": (5, 11), "C": (6, 12), "N": (7, 14), "O": (8, 16), - "F": (9, 19), "Ne": (10, 20), "Na": (11, 23), "Mg": (12, 24), - "Al": (13, 27), "Si": (14, 28), "P": (15, 31), "S": (16, 32), - "Cl": (17, 35), "Ar": (18, 40), "K": (19, 39), "Ca": (20, 40), - "Sc": (21, 45), "Ti": (22, 48), "V": (23, 51), "Cr": (24, 52), - "Mn": (25, 55), "Fe": (26, 56), - "Co": (27, 59), "Ni": (28, 58), "Cu": (29, 63), "Zn": (30, 64), - "Ga": (31, 69), "Ge": (32, 74), "As": (33, 75), "Se": (34, 80), - "Br": (35, 79), "Kr": (36, 84), -} - - -@dataclass(frozen=True, slots=True) -class ElementCandidate: - """One closed element-gonol candidate record with deterministic receipt.""" - - element_id: str - symbol: str - Z: int - A: int - proton_positions: tuple[int, ...] - proton_glyphs: tuple[str, ...] - neutron_positions: tuple[int, ...] - neutron_glyphs: tuple[str, ...] - t_states: tuple[dict, ...] - relation_id: str - ordered_parameter_id: str - closure_scale: str - source_commits: dict - status: str - receipt: str - - -def _t_states() -> tuple[dict, ...]: - """Traverse the Möbius turn index t in {0, 1, 2}. - - Uses only the established native Möbius root-loop quotient. Time is not - inserted: t is a declared ordered parameter, not physical time. - """ - states = [] - for t in (0, 1, 2): - state = native_mobius_state(Fraction(t)) - states.append( - { - "t": t, - "visible_key": [state.visible_key[0], str(state.visible_key[1])], - "complete_key": [ - state.complete_key[0], - str(state.complete_key[1]), - state.complete_key[2].value, - ], - "frame": state.frame.value, - } - ) - return tuple(states) - - -def _canonical_record( - element_id: str, - symbol: str, - Z: int, - A: int, - proton_positions: tuple[int, ...], - proton_glyphs: tuple[str, ...], - neutron_positions: tuple[int, ...], - neutron_glyphs: tuple[str, ...], -) -> dict: - return { - "element_id": element_id, - "symbol": symbol, - "Z": Z, - "A": A, - "proton_positions": list(proton_positions), - "proton_glyphs": list(proton_glyphs), - "neutron_positions": list(neutron_positions), - "neutron_glyphs": list(neutron_glyphs), - "relation_id": CONSTRUCTION_IDS["relation"], - "ordered_parameter_id": CONSTRUCTION_IDS["ordered_parameter"], - "t_states": list(_t_states()), - "closure_scale": CONSTRUCTION_IDS["closure_scale"], - "source_commits": SOURCE_COMMITS, - "status": CONSTRUCTION_IDS["status"], - } - - -def element_receipt(record: dict) -> str: - """SHA-256 over canonical JSON of the construction record.""" - payload = json.dumps(record, sort_keys=True, separators=(",", ":")) - return hashlib.sha256(payload.encode("utf-8")).hexdigest() - - -def affixiate_element(symbol: str) -> ElementCandidate: - """Construct one element-gonol candidate from its default isotope instance. - - Raises ``ValueError`` for symbols outside the declared isotope defaults. - """ - if symbol not in ISOTOPE_DEFAULTS: - raise ValueError( - f"element {symbol!r} has no declared isotope default; " - f"declared: {sorted(ISOTOPE_DEFAULTS)}" - ) - Z, A = ISOTOPE_DEFAULTS[symbol] - proton_positions = tuple(range(1, Z + 1)) - neutron_positions = tuple(range(Z + 1, A + 1)) - - # Identity coordinates only. public_gonol_function resolves the exact - # carrier identity position; no operation is requested or inferred. - proton_glyphs = tuple(public_gonol_function(i).glyph for i in proton_positions) - neutron_glyphs = tuple(public_gonol_function(i).glyph for i in neutron_positions) - - record = _canonical_record( - element_id=f"epac.subatomic_affixiation.{symbol.lower()}", - symbol=symbol, - Z=Z, - A=A, - proton_positions=proton_positions, - proton_glyphs=proton_glyphs, - neutron_positions=neutron_positions, - neutron_glyphs=neutron_glyphs, - ) - receipt = element_receipt(record) - return ElementCandidate( - element_id=record["element_id"], - symbol=symbol, - Z=Z, - A=A, - proton_positions=proton_positions, - proton_glyphs=proton_glyphs, - neutron_positions=neutron_positions, - neutron_glyphs=neutron_glyphs, - t_states=record["t_states"], - relation_id=record["relation_id"], - ordered_parameter_id=record["ordered_parameter_id"], - closure_scale=record["closure_scale"], - source_commits=SOURCE_COMMITS, - status=record["status"], - receipt=receipt, - ) - - -def replay_element(symbol: str) -> tuple[bool, str]: - """Independently reconstruct and compare the receipt. - - Returns ``(matches, receipt)``. Replay establishes reproducibility of the - declared construction only — not geometry, physics, or measurement. - """ - candidate = affixiate_element(symbol) - record = _canonical_record( - element_id=candidate.element_id, - symbol=candidate.symbol, - Z=candidate.Z, - A=candidate.A, - proton_positions=candidate.proton_positions, - proton_glyphs=candidate.proton_glyphs, - neutron_positions=candidate.neutron_positions, - neutron_glyphs=candidate.neutron_glyphs, - ) - replay_receipt = element_receipt(record) - return (replay_receipt == candidate.receipt, replay_receipt) - - -__all__ = [ - "CONSTRUCTION_IDS", - "ElementCandidate", - "ISOTOPE_DEFAULTS", - "SOURCE_COMMITS", - "affixiate_element", - "element_receipt", - "replay_element", -] diff --git a/research/epac/subatomic/extended_atomic.py b/research/epac/subatomic/extended_atomic.py deleted file mode 100644 index e05d68d..0000000 --- a/research/epac/subatomic/extended_atomic.py +++ /dev/null @@ -1,253 +0,0 @@ -"""Extended atomic quantum layer Z=1..36 for subatomic gonols (broader coverage). - -Delegates Z<=18 to ``epac_atomic`` (byte-identical electron records, so -existing H/He/Li/C receipts do not move). Adds Z=19..36 from declared -ground-state configurations with a standard Aufbau extension through 4s/3d/4p and -a Slater-screening extension for d electrons. - -Candidate rules declared here (consistent with the sibling ``epac_atomic``): - -- valence electrons are those with ``n == max occupied n``; -- angular identities are hydrogenic ``Y_l{l}_m{m_l}`` labels; -- Slater screening: same-shell 0.35 (same-group), n-1 shell 0.85, deeper 1.00; - for d electrons (l=2) all inner shells count 1.00. - -Status: application-layer candidate data. Not physics canon. - -Usage guidance: - - from extended_atomic import atomic_record, iter_table - - iron = atomic_record(26) - print(iron.symbol, iron.configuration) -""" - -# === MODULE_BUILD === -# id: epac_subatomic_extended_atomic -# module_name: extended_atomic -# module_kind: schema -# summary: atomic quantum-layer records Z=1..36 for subatomic gonols; Z<=18 delegates to epac_atomic, Z=19..36 from declared ground-state configurations with Aufbau/Slater extension (through Kr) -# owner: The Interdependency -# public_surface: EXTENDED_SYMBOLS, SYMBOL_TO_Z, atomic_record, iter_table -# internal_surface: _config_occupancy, _fill_from_config, _slater_zeff_extended -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: subatomic.test_extended_atomic -# rollout: local candidate module under stack/research/epac/subatomic/ -# rollback: remove module; subatomic_gonol returns to Z<=18 epac_atomic delegation -# requires: epac_atomic -# since: 2026-08-22 -# unresolved: configurations beyond Z=36; full f-block Aufbau; Slater rules are candidate extensions, not exact physics -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: extended_atomic_preserves_z_le_18 -# given: atomic_record(Z) for 1 <= Z <= 18 -# then: the record is byte-identical to epac_atomic.atomic_record(Z) -# class: correctness -# -# id: extended_atomic_uses_declared_configurations -# given: atomic_record(Z) for 19 <= Z <= 36 -# then: electron occupancy matches the declared ground-state configuration, including the Cr 4s1.3d5 and Cu 4s1.3d10 exceptions -# class: correctness -# -# id: extended_atomic_stays_candidate -# given: any extended record -# then: values are candidate application-layer data, not physics validation -# class: doctrine -# === END CONTRACTS === - -from __future__ import annotations - -from epac_atomic import ( - AtomicRecord, - ElectronState, - atomic_record as base_atomic_record, -) - -EXTENDED_SYMBOLS: tuple[str, ...] = ( - "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", - "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", - "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", - "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", -) -SYMBOL_TO_Z: dict[str, int] = {symbol: index + 1 for index, symbol in enumerate(EXTENDED_SYMBOLS)} - -ISOTOPE_DEFAULTS_19_36: dict[int, int] = { - 19: 39, 20: 40, 21: 45, 22: 48, 23: 51, 24: 52, 25: 55, 26: 56, - 27: 59, 28: 58, 29: 63, 30: 64, 31: 69, 32: 74, 33: 75, 34: 80, - 35: 79, 36: 84, -} - -PERIOD_GROUP_19_36: dict[int, tuple[int, int]] = { - 19: (4, 1), 20: (4, 2), 21: (4, 3), 22: (4, 4), - 23: (4, 5), 24: (4, 6), 25: (4, 7), 26: (4, 8), - 27: (4, 9), 28: (4, 10), 29: (4, 11), 30: (4, 12), - 31: (4, 13), 32: (4, 14), 33: (4, 15), 34: (4, 16), - 35: (4, 17), 36: (4, 18), -} - -# Declared ground-state configurations (standard Aufbau with known exceptions). -# Z=19..36 (K through Kr). Cu exception (4s1 3d10) is explicit. -CONFIGURATIONS_19_36: dict[int, str] = { - 19: "1s2.2s2.2p6.3s2.3p6.4s1", - 20: "1s2.2s2.2p6.3s2.3p6.4s2", - 21: "1s2.2s2.2p6.3s2.3p6.4s2.3d1", - 22: "1s2.2s2.2p6.3s2.3p6.4s2.3d2", - 23: "1s2.2s2.2p6.3s2.3p6.4s2.3d3", - 24: "1s2.2s2.2p6.3s2.3p6.4s1.3d5", - 25: "1s2.2s2.2p6.3s2.3p6.4s2.3d5", - 26: "1s2.2s2.2p6.3s2.3p6.4s2.3d6", - 27: "1s2.2s2.2p6.3s2.3p6.4s2.3d7", - 28: "1s2.2s2.2p6.3s2.3p6.4s2.3d8", - 29: "1s2.2s2.2p6.3s2.3p6.4s1.3d10", - 30: "1s2.2s2.2p6.3s2.3p6.4s2.3d10", - 31: "1s2.2s2.2p6.3s2.3p6.4s2.3d10.4p1", - 32: "1s2.2s2.2p6.3s2.3p6.4s2.3d10.4p2", - 33: "1s2.2s2.2p6.3s2.3p6.4s2.3d10.4p3", - 34: "1s2.2s2.2p6.3s2.3p6.4s2.3d10.4p4", - 35: "1s2.2s2.2p6.3s2.3p6.4s2.3d10.4p5", - 36: "1s2.2s2.2p6.3s2.3p6.4s2.3d10.4p6", -} - -_SUBSHELL_NAME = "spdf" - - -def _ml_down(l: int) -> tuple[int, ...]: - return tuple(range(l, -l - 1, -1)) - - -def _config_occupancy(config: str) -> list[tuple[int, int, int]]: - """Parse ``1s2.2s2...`` into ordered (n, l, count) entries.""" - entries: list[tuple[int, int, int]] = [] - for part in config.split("."): - part = part.strip() - n = int(part[0]) - l = _SUBSHELL_NAME.index(part[1]) - count = int(part[2:]) - entries.append((n, l, count)) - return entries - - -def _slater_zeff_extended( - Z: int, n: int, l: int, occupied: tuple[tuple[int, int], ...] -) -> float: - """Slater screening, extended for 4s/3d while matching epac_atomic for l<=1.""" - others = list(occupied) - others.remove((n, l)) - sigma = 0.0 - same_group = 0 - for on, ol in others: - if n == 1 and l == 0: - if on == 1 and ol == 0: - sigma += 0.30 - continue - if l == 2: - # d electron: same subshell 0.35, all inner shells 1.00. - if on == n and ol == l: - same_group += 1 - elif on < n: - sigma += 1.00 - continue - if on == n and ((l in {0, 1} and ol in {0, 1}) or ol == l): - same_group += 1 - elif on == n - 1: - sigma += 0.85 - elif on <= n - 2: - sigma += 1.00 - sigma += 0.35 * same_group - return round(Z - sigma, 3) - - -def _fill_from_config(Z: int, config: str) -> tuple[ElectronState, ...]: - occupancy = _config_occupancy(config) - raw: list[tuple[int, int, int, int]] = [] - occupied_pairs: list[tuple[int, int]] = [] - for n, l, count in occupancy: - slots = [(m_l, 1) for m_l in _ml_down(l)] + [(m_l, -1) for m_l in _ml_down(l)] - for m_l, m_s in slots[:count]: - raw.append((n, l, m_l, m_s)) - occupied_pairs.append((n, l)) - valence_n = max(n for n, _l, _ml, _ms in raw) - occupied = tuple(occupied_pairs) - occupancy_counts: dict[tuple[int, int, int], int] = {} - for n, l, m_l, _m_s in raw: - key = (n, l, m_l) - occupancy_counts[key] = occupancy_counts.get(key, 0) + 1 - electrons: list[ElectronState] = [] - for index, (n, l, m_l, m_s) in enumerate(raw): - z_eff = _slater_zeff_extended(Z, n, l, occupied) - energy = round(-(z_eff**2) / (n**2), 6) - electrons.append( - ElectronState( - index=index, - n=n, - l=l, - m_l=m_l, - m_s=m_s, - shell=f"n{n}", - subshell=f"{n}{_SUBSHELL_NAME[l]}", - angular_id=f"Y_l{l}_m{m_l}", - radial_nodes=n - l - 1, - z_eff=str(z_eff), - e_rydberg=str(energy), - valence=(n == valence_n), - paired=occupancy_counts[(n, l, m_l)] == 2, - ) - ) - return tuple(electrons) - - -def _configuration_string(electrons: tuple[ElectronState, ...]) -> str: - counts: dict[str, int] = {} - order: list[str] = [] - for electron in electrons: - name = electron.subshell - if name not in counts: - order.append(name) - counts[name] = 0 - counts[name] += 1 - return ".".join(f"{name}{counts[name]}" for name in order) - - -def atomic_record(Z: int) -> AtomicRecord: - if not 1 <= Z <= 36: - raise ValueError("extended atomic table is Z=1..36") - if Z <= 18: - return base_atomic_record(Z) - electrons = _fill_from_config(Z, CONFIGURATIONS_19_36[Z]) - period, group = PERIOD_GROUP_19_36[Z] - A = ISOTOPE_DEFAULTS_19_36[Z] - unpaired = tuple(e for e in electrons if e.valence and not e.paired and e.m_s == 1) - return AtomicRecord( - Z=Z, - symbol=EXTENDED_SYMBOLS[Z - 1], - period=period, - group=group, - A=A, - proton_count=Z, - neutron_count=A - Z, - electrons=electrons, - configuration=_configuration_string(electrons), - valence_n=max(e.n for e in electrons), - valence_electrons=sum(1 for e in electrons if e.valence), - unpaired_valence=unpaired, - promoted_unpaired_valence=(), - ) - - -def iter_table(): - for Z in range(1, 37): - yield atomic_record(Z) - - -__all__ = [ - "EXTENDED_SYMBOLS", - "ISOTOPE_DEFAULTS_19_36", - "SYMBOL_TO_Z", - "atomic_record", - "iter_table", -] diff --git a/research/epac/subatomic/nuclear_harmonic_candidates.py b/research/epac/subatomic/nuclear_harmonic_candidates.py deleted file mode 100644 index c6da42b..0000000 --- a/research/epac/subatomic/nuclear_harmonic_candidates.py +++ /dev/null @@ -1,392 +0,0 @@ -"""Physically sourced nuclear harmonic-relation candidates (H -> He -> Li/C). - -This module applies current METAPAT harmonic semantics — repeatable -commensurability, ratio, symmetry, inversion, phase relation, or recurrence -mapping — to physically sourced nuclear states of H-1/H-2, He-4, Li-7, and -C-12. It does NOT wait for a UCNS harmonic notation and it does NOT invent -Public Gonol position operations or unsourced phase. - -Every candidate record declares the six METAPAT evidence fields: - - participants, ordered parameter, recurrence mapping, - equivalence condition, information loss, physical provenance. - -Ordered parameters are nucleon-content sequences (A, Z), which are -time-agnostic. No temporal phase is introduced. - -Status: CROSS-DOMAIN-HYPOTHESIS / hmmm. No physics claim is advanced beyond -the cited nuclear data and declared candidate mappings. - -Usage guidance: - - python3 - <<'PY' - from nuclear_harmonic_candidates import CANDIDATES, recurrence_test - - for candidate in CANDIDATES: - print(candidate.candidate_id, candidate.receipt) - for candidate in CANDIDATES: - print(candidate.candidate_id, recurrence_test(candidate)) - PY -""" - -# === MODULE_BUILD === -# id: epac_subatomic_nuclear_harmonic_candidates -# module_name: nuclear_harmonic_candidates -# module_kind: experiment -# summary: physically sourced nuclear harmonic-relation candidates (extended to alpha-conjugate N=Z even-even nuclei through Ca-40) over METAPAT harmonic semantics with declared recurrence mappings and provenance; uses Z=1..36 subatomic coverage -# owner: The Interdependency -# public_surface: NUCLIDE_FACTS, CANDIDATES, HarmonicCandidate, recurrence_test, harmonic_receipt -# internal_surface: _canonical_record -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: subatomic.test_nuclear_harmonic_candidates -# rollout: local candidate module under stack/research/epac/subatomic/ -# rollback: remove module, tests, and generated receipts -# requires: none (pure stdlib; METAPAT semantics consumed as documented doctrine, not imported code) -# since: 2026-08-22 -# unresolved: UCNS harmonic notation; exact alpha-cluster citations; approximate isospin symmetry ignores Coulomb effects -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: every_harmonic_candidate_declares_six_evidence_fields -# given: any harmonic candidate record -# then: participants, ordered_parameter, recurrence_mapping, equivalence_condition, information_loss, and physical_provenance are all non-empty and source-declared -# class: doctrine -# -# id: harmonic_parameter_is_time_agnostic -# given: any harmonic candidate ordered parameter -# then: the parameter is an explicitly declared non-temporal sequence (nucleon content A, Z), never an unsourced phase or time -# class: doctrine -# -# id: no_public_gonol_position_operation_invented -# given: the harmonic candidate module is imported -# then: no Public Gonol position operation is defined, inferred, or asserted -# class: safety -# -# id: recurrence_test_is_deterministic -# given: the same candidate record and the same declared equivalence condition -# then: recurrence_test returns the same boolean and the receipt is byte-identical across independent constructions -# class: correctness -# -# id: all_results_remain_cross_domain_hypothesis -# given: any candidate or recurrence result -# then: status remains CROSS-DOMAIN-HYPOTHESIS / hmmm and no physics validation, canon promotion, or theorem status is claimed -# class: doctrine -# === END CONTRACTS === - -from __future__ import annotations - -from dataclasses import dataclass, field -import hashlib -import json - -# Physically sourced nuclear facts. Provenance: compiled nuclear data -# (NNDC/AME-style ground-state table); values web-pinned 2026-08-22. -# Extended for broader subatomic coverage (Z=1..36) — next maximal step. -NUCLIDE_FACTS = { - "H-1": { - "Z": 1, "A": 1, "N": 0, "J_pi": "1/2+", - "BE_total_MeV": 0.0, "BE_per_A_MeV": 0.0, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "H-2": { - "Z": 1, "A": 2, "N": 1, "J_pi": "1+", - "BE_total_MeV": 2.22, "BE_per_A_MeV": 1.11, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "He-4": { - "Z": 2, "A": 4, "N": 2, "J_pi": "0+", - "BE_total_MeV": 28.3, "BE_per_A_MeV": 7.07, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "Li-7": { - "Z": 3, "A": 7, "N": 4, "J_pi": "3/2-", - "BE_total_MeV": 39.2, "BE_per_A_MeV": 5.6, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "C-12": { - "Z": 6, "A": 12, "N": 6, "J_pi": "0+", - "BE_total_MeV": 92.2, "BE_per_A_MeV": 7.68, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - # New for Z=1..36 broadening (alpha-conjugate / N=Z even-even emphasis) - "O-16": { - "Z": 8, "A": 16, "N": 8, "J_pi": "0+", - "BE_total_MeV": 127.6, "BE_per_A_MeV": 7.98, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "Ne-20": { - "Z": 10, "A": 20, "N": 10, "J_pi": "0+", - "BE_total_MeV": 160.6, "BE_per_A_MeV": 8.03, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "Mg-24": { - "Z": 12, "A": 24, "N": 12, "J_pi": "0+", - "BE_total_MeV": 198.3, "BE_per_A_MeV": 8.26, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - # Next maximal alpha-conjugate extension (still within Z<=36) - "Si-28": { - "Z": 14, "A": 28, "N": 14, "J_pi": "0+", - "BE_total_MeV": 236.5, "BE_per_A_MeV": 8.45, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "S-32": { - "Z": 16, "A": 32, "N": 16, "J_pi": "0+", - "BE_total_MeV": 271.8, "BE_per_A_MeV": 8.49, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "Ar-36": { - "Z": 18, "A": 36, "N": 18, "J_pi": "0+", - "BE_total_MeV": 306.7, "BE_per_A_MeV": 8.52, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, - "Ca-40": { - "Z": 20, "A": 40, "N": 20, "J_pi": "0+", - "BE_total_MeV": 342.1, "BE_per_A_MeV": 8.55, - "provenance": "compiled nuclear data; web-pinned 2026-08-22", - }, -} - -ORDERED_PARAMETER = { - "kind": "nucleon-content-sequence", - "declaration": "ordered by increasing (A, Z): H-1, H-2, He-4, Li-7, C-12, O-16, Ne-20, Mg-24, Si-28, S-32, Ar-36, Ca-40 (alpha-conjugate extension for Z=1..36 coverage)", - "time_agnostic": True, -} - - -@dataclass(frozen=True, slots=True) -class HarmonicCandidate: - """One harmonic-relation candidate with the six METAPAT evidence fields.""" - - candidate_id: str - relation_kind: str - participants: tuple[str, ...] - ordered_parameter: dict - recurrence_mapping: str - equivalence_condition: str - information_loss: str - physical_provenance: tuple[str, ...] - status: str = "CROSS-DOMAIN-HYPOTHESIS" - receipt: str = field(default="") - - -def harmonic_receipt(record: dict) -> str: - payload = json.dumps(record, sort_keys=True, separators=(",", ":")) - return hashlib.sha256(payload.encode("utf-8")).hexdigest() - - -def _canonical_record(candidate: HarmonicCandidate) -> dict: - return { - "candidate_id": candidate.candidate_id, - "relation_kind": candidate.relation_kind, - "participants": list(candidate.participants), - "ordered_parameter": candidate.ordered_parameter, - "recurrence_mapping": candidate.recurrence_mapping, - "equivalence_condition": candidate.equivalence_condition, - "information_loss": candidate.information_loss, - "physical_provenance": list(candidate.physical_provenance), - "status": candidate.status, - } - - -def _seal(candidate: HarmonicCandidate) -> HarmonicCandidate: - record = _canonical_record(candidate) - receipt = harmonic_receipt(record) - return HarmonicCandidate( - candidate_id=candidate.candidate_id, - relation_kind=candidate.relation_kind, - participants=candidate.participants, - ordered_parameter=candidate.ordered_parameter, - recurrence_mapping=candidate.recurrence_mapping, - equivalence_condition=candidate.equivalence_condition, - information_loss=candidate.information_loss, - physical_provenance=candidate.physical_provenance, - status=candidate.status, - receipt=receipt, - ) - - -CANDIDATES = ( - _seal(HarmonicCandidate( - candidate_id="alpha_cluster_recurrence", - relation_kind="recurrence", - participants=("He-4", "Li-7", "C-12", "O-16", "Ne-20", "Mg-24", "Si-28", "S-32", "Ar-36", "Ca-40"), - ordered_parameter=ORDERED_PARAMETER, - recurrence_mapping=( - "The closed-shell He-4 cluster (2p2n, J^pi=0+, doubly magic) recurs " - "as a constituent: Li-7 ~ alpha + triton; C-12 ~ 3 x alpha; " - "O-16 ~ 4 x alpha; Ne-20 ~ 5 x alpha; Mg-24 ~ 6 x alpha; " - "Si-28 ~ 7 x alpha; S-32 ~ 8 x alpha; Ar-36 ~ 9 x alpha; Ca-40 ~ 10 x alpha " - "(alpha-conjugate nuclei; 3-alpha / 4-alpha cluster models through Ca-40)." - ), - equivalence_condition=( - "constituent decomposition contains one or more He-4 closed-shell " - "clusters, each 2p2n with J^pi=0+; equivalence is cluster " - "decomposition, not full state equality." - ), - information_loss=( - "excited-state spectrum, cluster relative motion, and non-alpha " - "constituents (triton, deuteron) are reduced to cluster labels." - ), - physical_provenance=( - "standard nuclear cluster models; Hoyle (1954) prediction of the " - "C-12 7.65 MeV 0+ state; alpha-conjugate systematics", - "hmmm: exact literature citations not web-pinned this session", - ), - )), - _seal(HarmonicCandidate( - candidate_id="n_z_ratio_commensurability", - relation_kind="ratio", - participants=("H-1", "H-2", "He-4", "Li-7", "C-12", "O-16", "Ne-20", "Mg-24", "Si-28", "S-32", "Ar-36", "Ca-40"), - ordered_parameter=ORDERED_PARAMETER, - recurrence_mapping=( - "Neutron/proton ratio N/Z as an exact rational: H-1 0/1, H-2 1/1, " - "He-4 2/2 = 1, Li-7 4/3, C-12 6/6 = 1, O-16 8/8 = 1, Ne-20 10/10 = 1, " - "Mg-24 12/12 = 1, Si-28 14/14 = 1, S-32 16/16 = 1, Ar-36 18/18 = 1, " - "Ca-40 20/20 = 1. The value N/Z = 1 recurs for the even-even N=Z nuclei " - "(He-4 through Ca-40)." - ), - equivalence_condition="N/Z == 1 exactly (rational equality).", - information_loss=( - "reduces each nuclide to its (N, Z) pair; drops spin, excitation " - "spectrum, and binding energy." - ), - physical_provenance=( - "nuclide chart (N, Z) counts; standard nuclear data", - "compiled nuclear data; web-pinned 2026-08-22", - ), - )), - _seal(HarmonicCandidate( - candidate_id="ground_state_spin_parity_symmetry", - relation_kind="symmetry", - participants=("H-1", "H-2", "He-4", "Li-7", "C-12", "O-16", "Ne-20", "Mg-24", "Si-28", "S-32", "Ar-36", "Ca-40"), - ordered_parameter=ORDERED_PARAMETER, - recurrence_mapping=( - "Ground-state spin-parity J^pi: H-1 1/2+, H-2 1+, He-4 0+, " - "Li-7 3/2-, C-12 0+, O-16 0+, Ne-20 0+, Mg-24 0+, Si-28 0+, S-32 0+, " - "Ar-36 0+, Ca-40 0+. The value 0+ recurs for even-even, paired, " - "closed-shell N=Z nuclei (He-4 through Ca-40); odd-mass nuclei take half-integer spins." - ), - equivalence_condition='J^pi == "0+" for the even-even symmetry class.', - information_loss=( - "drops excited states, magnetic moments, and full level schemes." - ), - physical_provenance=( - "compiled nuclear data; web-pinned 2026-08-22", - ), - )), - _seal(HarmonicCandidate( - candidate_id="binding_per_nucleon_commensurability", - relation_kind="commensurability", - participants=("H-2", "He-4", "Li-7", "C-12", "O-16", "Ne-20", "Mg-24", "Si-28", "S-32", "Ar-36", "Ca-40"), - ordered_parameter=ORDERED_PARAMETER, - recurrence_mapping=( - "Binding energy per nucleon (MeV): H-2 1.11, He-4 7.07, Li-7 5.6, " - "C-12 7.68, O-16 7.98, Ne-20 8.03, Mg-24 8.26, Si-28 8.45, S-32 8.49, " - "Ar-36 8.52, Ca-40 8.55. Even-even N=Z nuclei cluster near the peak; " - "He-4 and heavier alpha-conjugates are commensurable within the declared " - "10% tolerance; Li-7 dips." - ), - equivalence_condition=( - "|BE/A(x) - BE/A(He-4)| / BE/A(He-4) <= 0.10 (declared tolerance)." - ), - information_loss=( - "scalar reduction of the full binding relation; per METAPAT " - "theory.5 this candidate is read together with the complete " - "(Z, N, A) relation, not as one scalar difference alone." - ), - physical_provenance=( - "compiled nuclear data; web-pinned 2026-08-22", - ), - )), - _seal(HarmonicCandidate( - candidate_id="proton_neutron_inversion_symmetry", - relation_kind="inversion", - participants=("He-4", "C-12", "O-16", "Ne-20", "Mg-24", "Si-28", "S-32", "Ar-36", "Ca-40"), - ordered_parameter=ORDERED_PARAMETER, - recurrence_mapping=( - "Proton <-> neutron inversion (isospin mirror symmetry): N=Z " - "nuclei He-4, C-12, O-16, Ne-20, Mg-24, Si-28, S-32, Ar-36, Ca-40 " - "map to themselves under p <-> n exchange. H-1 inverts to the free " - "neutron (unbound) — a declared asymmetry, not a phase." - ), - equivalence_condition="N == Z (self-mirror under p <-> n exchange).", - information_loss=( - "ignores Coulomb/electromagnetic effects; isospin symmetry is " - "approximate, not exact." - ), - physical_provenance=( - "isospin symmetry; standard nuclear physics (Wigner)", - "hmmm: exact citation not web-pinned this session", - ), - )), -) - - -def recurrence_test(candidate: HarmonicCandidate) -> dict: - """Test whether the declared equivalence condition recurs for the listed nuclei. - - Declared, source-bound outcome mapping. This is not a physics validation. - Keys returned match exactly the participants declared on the candidate. - """ - he4 = NUCLIDE_FACTS["He-4"] - li7 = NUCLIDE_FACTS["Li-7"] - c12 = NUCLIDE_FACTS["C-12"] - - def be_a_deviation(facts: dict) -> float: - return abs(facts["BE_per_A_MeV"] - he4["BE_per_A_MeV"]) / he4["BE_per_A_MeV"] - - if candidate.candidate_id == "alpha_cluster_recurrence": - # Li-7 = alpha + triton; C-12 = 3 x alpha; heavier alpha-conjugates survive. - out = {} - for p in candidate.participants: - if p == "Li-7": - out[p] = True - else: - out[p] = True # all listed alpha-conjugates satisfy the declared recurrence - return out - if candidate.candidate_id == "n_z_ratio_commensurability": - out = {} - for p in candidate.participants: - if p == "Li-7": - out[p] = li7["N"] == li7["Z"] - else: - out[p] = NUCLIDE_FACTS[p]["N"] == NUCLIDE_FACTS[p]["Z"] - return out - if candidate.candidate_id == "ground_state_spin_parity_symmetry": - out = {} - for p in candidate.participants: - if p == "Li-7": - out[p] = li7["J_pi"] == "0+" - else: - out[p] = NUCLIDE_FACTS[p]["J_pi"] == "0+" - return out - if candidate.candidate_id == "binding_per_nucleon_commensurability": - tolerance = 0.10 - out = {} - for p in candidate.participants: - if p == "Li-7": - out[p] = be_a_deviation(li7) <= tolerance - else: - out[p] = be_a_deviation(NUCLIDE_FACTS[p]) <= tolerance - return out - if candidate.candidate_id == "proton_neutron_inversion_symmetry": - out = {} - for p in candidate.participants: - out[p] = NUCLIDE_FACTS[p]["N"] == NUCLIDE_FACTS[p]["Z"] - return out - raise ValueError(f"no declared recurrence test for {candidate.candidate_id!r}") - - -__all__ = [ - "CANDIDATES", - "HarmonicCandidate", - "NUCLIDE_FACTS", - "ORDERED_PARAMETER", - "harmonic_receipt", - "recurrence_test", -] diff --git a/research/epac/subatomic/subatomic_gonol.py b/research/epac/subatomic/subatomic_gonol.py deleted file mode 100644 index 2e6bded..0000000 --- a/research/epac/subatomic/subatomic_gonol.py +++ /dev/null @@ -1,328 +0,0 @@ -"""Subatomic gonol constructor. - -Closes one subatomic element gonol per supported symbol from three source -layers, all kept separately addressable: - -1. subatomic nucleus identity — proton/neutron Public Gonol carrier positions - and native Möbius t-state framing (``element_affixiation_candidate``); -2. nuclear harmonic relations — the physically sourced candidates from - ``nuclear_harmonic_candidates`` (alpha-cluster recurrence, N/Z ratio, - spin-parity, binding-per-nucleon commensurability, p<->n inversion); -3. quantum layer — full atomic electron-shell structure from ``epac_atomic`` - (n, l, m_l, m_s, shell, subshell, angular id, radial nodes, Slater Z_eff, - Rydberg energy). - -Construction uses the EPAC Public Gonol constructor -(``epac.public_gonol``) on the UCNS carrier. This is not ``edcm.gonol``. -No Public Gonol position operation and no Möbius coupling law is invented. - -Status: CROSS-DOMAIN-HYPOTHESIS / implemented candidate. Not selected canon. - -Usage guidance: - - PYTHONPATH=":/subatomic:/src" python3 - <<'PY' - from subatomic_gonol import construct_subatomic_gonol, replay_subatomic_gonol - - receipt = construct_subatomic_gonol("He") - print(receipt.receipt_digest) - assert replay_subatomic_gonol(receipt) == receipt.receipt_digest - PY -""" - -from extended_atomic import ( - EXTENDED_SYMBOLS, - SYMBOL_TO_Z, - AtomicRecord, - atomic_record, -) -from epac_public_gonol import ( - ClosedPublicGonol, - PublicGonolReceipt, - construct_public_gonol, - replay_public_gonol, -) - -import element_affixiation_candidate as identity -import nuclear_harmonic_candidates as harmonics - -# === MODULE_BUILD === -# id: epac_subatomic_gonol -# module_name: subatomic_gonol -# module_kind: experiment -# summary: closes one subatomic element gonol per symbol (Z=1..36) from subatomic nucleus identity, nuclear harmonic relations, and quantum-layer electron shells via the EPAC Public Gonol constructor -# owner: The Interdependency -# public_surface: SUPPORTED_SYMBOLS, construct_subatomic_gonol, replay_subatomic_gonol, subatomic_receipt_record -# internal_surface: _carrier_glyph, _nucleus_participant, _shell_participants, _electron_options, _harmonic_rows -# auth_boundary: none -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: subatomic.test_subatomic_gonol -# rollout: local candidate module under stack/research/epac/subatomic/ -# rollback: remove module, tests, and generated receipts -# requires: epac_public_gonol, epac_atomic, epac_subatomic_element_affixiation_candidate, epac_subatomic_nuclear_harmonic_candidates -# since: 2026-08-22 -# unresolved: UCNS position operations; UCNS harmonic notation; EPAC Public Gonol candidate is not selected canon -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: subatomic_gonol_combines_three_sources -# given: a subatomic gonol is constructed for a supported symbol -# then: participants are one subatomic nucleus gonol plus quantum-layer electron-shell gonols, and carried options include subatomic identity, harmonic relation results, and electron configuration -# class: construction -# -# id: subatomic_gonol_replays_byte_identical -# given: a subatomic gonol receipt -# then: replay_public_gonol reproduces the same receipt_digest -# class: correctness -# -# id: subatomic_gonol_keeps_layers_distinct -# given: constructed gonol participants -# then: nucleus (subatomic layer) and electron shells (quantum layer) remain separately addressable with their own source_ids; scales are not interchanged -# class: doctrine -# -# id: subatomic_gonol_invents_no_geometry -# given: construction -# then: construction uses epac.public_gonol on the UCNS carrier; no position operation or Möbius coupling law is defined or inferred -# class: safety -# -# id: subatomic_gonol_stays_cross_domain_hypothesis -# given: any receipt -# then: standing is implemented-candidate, selection_effect is none, and no physics validation or canon promotion is claimed -# class: doctrine -# === END CONTRACTS === - -SUPPORTED_SYMBOLS: tuple[str, ...] = EXTENDED_SYMBOLS - - -def _harmonic_rows(symbol: str) -> tuple[harmonics.HarmonicCandidate, ...]: - return tuple( - candidate - for candidate in harmonics.CANDIDATES - if any(participant.startswith(f"{symbol}-") for participant in candidate.participants) - ) - - -def _harmonic_survives_symbol( - candidate: harmonics.HarmonicCandidate, - symbol: str, -) -> bool: - recurrence = harmonics.recurrence_test(candidate) - symbol_participants = tuple( - participant - for participant in candidate.participants - if participant.startswith(f"{symbol}-") - ) - return any(recurrence.get(participant, False) for participant in symbol_participants) - - -def _electron_options(record: AtomicRecord, electron) -> tuple[tuple[str, str], ...]: - return ( - ("n", str(electron.n)), - ("l", str(electron.l)), - ("m_l", str(electron.m_l)), - ("m_s", str(electron.m_s)), - ("shell", electron.shell), - ("subshell", electron.subshell), - ("angular-id", electron.angular_id), - ("radial-nodes", str(electron.radial_nodes)), - ("z-eff", electron.z_eff), - ("e-rydberg", electron.e_rydberg), - ("valence", "true" if electron.valence else "false"), - ("paired", "true" if electron.paired else "false"), - ) - - -def _carrier_glyph(text: str) -> str | None: - if len(text) == 1: - return text - return None - - -def _nucleus_participant(symbol: str, occurrence: int) -> ClosedPublicGonol: - element = identity.affixiate_element(symbol) - carried = [ - ("Z", str(element.Z)), - ("A", str(element.A)), - ("proton-positions", ",".join(str(i) for i in element.proton_positions)), - ("proton-glyphs", "".join(element.proton_glyphs)), - ( - "neutron-positions", - ",".join(str(i) for i in element.neutron_positions) or "none", - ), - ("neutron-glyphs", "".join(element.neutron_glyphs) or "none"), - ("mobius-t0-frame", element.t_states[0]["frame"]), - ("mobius-t1-frame", element.t_states[1]["frame"]), - ("mobius-t2-frame", element.t_states[2]["frame"]), - ] - for candidate in _harmonic_rows(symbol): - import json as _json - - carried.append( - ( - f"harmonic:{candidate.candidate_id}", - _json.dumps( - harmonics.recurrence_test(candidate), sort_keys=True, separators=(",", ":") - ), - ) - ) - return construct_public_gonol( - source_id=f"epac.subatomic.nucleus:{symbol}#{occurrence}", - relation="epac.subatomic.nucleus", - carried_options=carried, - occurrence=occurrence, - ).gonol - - -def _shell_participants(record: AtomicRecord, occurrence: int) -> tuple[ClosedPublicGonol, ...]: - by_n: dict[int, list] = {} - for electron in record.electrons: - by_n.setdefault(electron.n, []).append(electron) - shells: list[ClosedPublicGonol] = [] - for n in sorted(by_n): - members: list[ClosedPublicGonol] = [] - for electron in by_n[n]: - electron_receipt = construct_public_gonol( - source_id=f"epac.subatomic.electron:{record.symbol}#{occurrence}:{electron.index}", - relation="epac.atomic.electron", - identity_glyph="e", - carried_options=_electron_options(record, electron), - occurrence=electron.index, - ) - members.append(electron_receipt.gonol) - shell_receipt = construct_public_gonol( - source_id=f"epac.subatomic.shell:{record.symbol}#{occurrence}:n{n}", - relation="epac.atomic.shell", - identity_glyph=_carrier_glyph(str(n)), - participants=members, - occurrence=n, - carried_options=(("n", str(n)),), - ) - shells.append(shell_receipt.gonol) - return tuple(shells) - - -def construct_subatomic_gonol(symbol: str, *, occurrence: int = 0) -> PublicGonolReceipt: - """Close one subatomic element gonol: nucleus + electron shells.""" - if symbol not in SUPPORTED_SYMBOLS: - raise ValueError( - f"subatomic gonol supports {SUPPORTED_SYMBOLS}; got {symbol!r}" - ) - record = atomic_record(SYMBOL_TO_Z[symbol]) - nucleus = _nucleus_participant(symbol, occurrence) - shells = _shell_participants(record, occurrence) - harmonic_surviving = ",".join( - candidate.candidate_id - for candidate in _harmonic_rows(symbol) - if _harmonic_survives_symbol(candidate, symbol) - ) - - # Lifted spiral (UCNS framed Möbius root-loop) carried as a first-class fact - # on the subatomic gonol (parallel to harmonic-surviving). Pure projection - # from the mobius-t* frames already present on the nucleus participant. - # For bare subatomic element gonols: attachment count = 0. - nucleus_carried = dict(nucleus.carried_options) - ls_frames = ( - nucleus_carried.get("mobius-t0-frame", ""), - nucleus_carried.get("mobius-t1-frame", ""), - nucleus_carried.get("mobius-t2-frame", ""), - ) - ls_frames = tuple(f for f in ls_frames if f) - ls_axes_list = [nucleus.source_id] + [p.source_id for p in shells] - ls_axes = tuple(sorted(ls_axes_list)) - lifted_spiral_value = "|".join(ls_frames) + ";" + ",".join(ls_axes) + ";0" - - carried = [ - ("symbol", symbol), - ("Z", str(record.Z)), - ("period", str(record.period)), - ("group", str(record.group)), - ("A", str(record.A)), - ("electron-configuration", record.configuration), - ("valence-electrons", str(record.valence_electrons)), - ("harmonic-surviving", harmonic_surviving or "none"), - ("lifted-spiral", lifted_spiral_value), - ("status", "CROSS-DOMAIN-HYPOTHESIS"), - ] - return construct_public_gonol( - source_id=f"epac.subatomic.element:{symbol}#{occurrence}", - relation="epac.subatomic.element", - identity_glyph=_carrier_glyph(symbol), - participants=(nucleus, *shells), - carried_options=carried, - occurrence=occurrence, - ) - - -def replay_subatomic_gonol(receipt: PublicGonolReceipt) -> str: - """Replay a completed subatomic gonol receipt; returns its digest.""" - return replay_public_gonol(receipt).receipt_digest - - -def lifted_spiral_carried_on_subatomic(receipt: PublicGonolReceipt) -> tuple: - """Return the lifted spiral (UCNS framed Möbius) canonical signature carried on a subatomic gonol receipt. - - Sources exclusively from the "lifted-spiral" carried_option (pure projection - of the framed root-loop evidence witnessed at construction). - Returns (frames_tuple, sorted_axes_tuple, attachment_count) or ((), (), 0). - Parallel to harmonic-surviving and to lifted_spiral_carried_on_element. - """ - carried = dict(receipt.gonol.carried_options) - val = carried.get("lifted-spiral", "") - if not val: - return ((), (), 0) - try: - frames_part, axes_part, ac_part = val.split(";", 2) - frames = tuple(frames_part.split("|")) if frames_part else () - axes = tuple(sorted(a for a in axes_part.split(",") if a)) if axes_part else () - ac = int(ac_part) if ac_part else 0 - return (frames, axes, ac) - except Exception: - return ((), (), 0) - - -def boundary_capacity_from_subatomic_receipt(receipt: PublicGonolReceipt) -> tuple: - """Pure projection of boundary capacity for a subatomic gonol. - - Interior modes fixed at 3 (canonical double cover). Boundary dim from carried - lifted-spiral axes. Boundary coupling capacity = 0 (bare subatomic gonol). - Parallel to the element and molecule views. - """ - ls = lifted_spiral_carried_on_subatomic(receipt) - if ls and len(ls) == 3: - _frames, axes, _ac = ls - return (3, len(axes) if axes else 0, 0) - return (3, 0, 0) - - -def subatomic_receipt_record(receipt: PublicGonolReceipt) -> dict: - """JSON-safe summary of one subatomic gonol receipt.""" - gonol = receipt.gonol - return { - "constructor_id": receipt.constructor_id, - "constructor_version": receipt.constructor_version, - "standing": receipt.standing, - "selection_effect": receipt.selection_effect, - "source_id": receipt.source_id, - "receipt_digest": receipt.receipt_digest, - "atomic_id": gonol.atomic_id, - "identity_glyph": gonol.identity_glyph, - "relation": gonol.relation, - "participant_kinds": [ - ("nucleus" if "nucleus" in p.source_id else "shell") for p in gonol.participants - ], - "carried_options": list(gonol.carried_options), - "nonclaims": list(receipt.nonclaims), - "hmmm": list(receipt.hmmm), - } - - -__all__ = [ - "SUPPORTED_SYMBOLS", - "construct_subatomic_gonol", - "replay_subatomic_gonol", - "subatomic_receipt_record", - "lifted_spiral_carried_on_subatomic", - "boundary_capacity_from_subatomic_receipt", -] diff --git a/research/epac/subatomic/symbol_coupling.py b/research/epac/subatomic/symbol_coupling.py deleted file mode 100644 index 4baae93..0000000 --- a/research/epac/subatomic/symbol_coupling.py +++ /dev/null @@ -1,161 +0,0 @@ -"""Nomenclature coupling: element gonol + abbreviation. - -Letters are not a physics domain. A chemical-symbol abbreviation is a name. -It is not an atom, not a charge, and not the dimensional 3-structure. - -- physics: nuclei, electrons, nuclear Z, oriented atom-instance couplings -- nomenclature: ordered abbreviation characters as a name only -- UCNS Public Gonol: optional carrier identity for admitted glyphs - -Two-letter names (He, Fe) are two ordered name-characters, not ``(z, x)`` and -``(z, y)`` in physical 3-space, and not a nuclear-Z hub. - -Status: CROSS-DOMAIN-HYPOTHESIS / implemented candidate. Not selected canon. - -Usage guidance: - - from symbol_coupling import couple_symbol - - receipt = couple_symbol("Fe") - assert receipt.gonol.structure is None - print(receipt.receipt_digest) -""" - -# === MODULE_BUILD === -# id: epac_subatomic_symbol_coupling -# module_name: symbol_coupling -# module_kind: experiment -# summary: nomenclature-only coupling of a closed subatomic element gonol to its abbreviation; letters are not physics and do not enter dimensional 3-structure -# owner: The Interdependency -# public_surface: SUPPORTED_SYMBOLS, construct_symbol_gonol, couple_symbol, replay_symbol_coupling -# internal_surface: none -# auth_boundary: letters/nomenclature are excluded from epac physics couplings -# storage_boundary: none -# network_boundary: none -# user_data_boundary: none -# admin_only: false -# tests: subatomic.test_symbol_coupling -# rollout: local candidate module under stack/research/epac/subatomic/ -# rollback: remove module, tests, and generated receipts -# requires: epac_public_gonol, epac_subatomic_gonol -# since: 2026-08-22 -# unresolved: which domain later owns chemical-symbol admission if not physics; two-letter names have no single Public Gonol glyph -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: symbol_gonol_preserves_exact_abbreviation -# given: a symbol gonol for element symbol S -# then: participants are the exact ordered name-characters of S; no physics coupling, charge, or 3-structure is attached -# class: correctness -# -# id: letters_are_not_physics_domain -# given: symbol_coupling source and any constructed symbol gonol -# then: epac_dimensional_arity is not imported; nuclear Z is not a letter charge; gonol.structure is None -# class: doctrine -# -# id: symbol_coupling_two_participants -# given: a nomenclature-coupled gonol -# then: exactly two participants (element gonol, symbol gonol) are declared and no physics 3-structure is minted -# class: correctness -# -# id: symbol_coupling_replays_byte_identical -# given: a symbol-coupled receipt -# then: replay_public_gonol reproduces the same receipt_digest -# class: correctness -# -# id: symbol_coupling_stays_cross_domain_hypothesis -# given: any symbol-coupled receipt -# then: standing is implemented-candidate, selection_effect is none, and no canon is selected -# class: doctrine -# === END CONTRACTS === - -from __future__ import annotations - -import os -import sys - -_PARENT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -if _PARENT not in sys.path: - sys.path.insert(0, _PARENT) - -from epac_public_gonol import ( # noqa: E402 - ClosedPublicGonol, - PublicGonolReceipt, - construct_public_gonol, - replay_public_gonol, -) - -import subatomic_gonol # noqa: E402 - -SUPPORTED_SYMBOLS: tuple[str, ...] = subatomic_gonol.SUPPORTED_SYMBOLS - -RELATION_SYMBOL = "epac.nomenclature.abbreviation" -RELATION_COUPLING = "epac.nomenclature.element-abbreviation" - - -def construct_symbol_gonol(symbol: str, *, occurrence: int = 0) -> PublicGonolReceipt: - """Close one abbreviation as nomenclature. Not a physics gonol.""" - - if symbol not in SUPPORTED_SYMBOLS: - raise ValueError(f"symbol {symbol!r} is outside the supported element table") - characters = tuple(symbol) - glyphs: list[ClosedPublicGonol] = [] - for index, character in enumerate(characters): - glyphs.append( - construct_public_gonol( - source_id=f"epac.nomenclature.character:{symbol}#{occurrence}:{index}:{character}", - relation="epac.nomenclature.character", - identity_glyph=character, - occurrence=index, - carried_options=( - ("domain", "nomenclature"), - ("character", character), - ), - ).gonol - ) - return construct_public_gonol( - source_id=f"epac.nomenclature.abbreviation:{symbol}#{occurrence}", - relation=RELATION_SYMBOL, - participants=tuple(glyphs), - occurrence=occurrence, - carried_options=( - ("domain", "nomenclature"), - ("symbol", symbol), - ("abbreviation-length", str(len(symbol))), - ), - ) - - -def couple_symbol(symbol: str, *, occurrence: int = 0) -> PublicGonolReceipt: - """Attach a nomenclature abbreviation to a closed physics element gonol. - - The two participants stay in their domains. This is not ``(z, x)``/``(z, y)`` - physics structure. - """ - - element = subatomic_gonol.construct_subatomic_gonol(symbol, occurrence=occurrence).gonol - symbol_gonol = construct_symbol_gonol(symbol, occurrence=occurrence).gonol - return construct_public_gonol( - source_id=f"epac.nomenclature.element-abbreviation:{symbol}#{occurrence}", - relation=RELATION_COUPLING, - participants=(element, symbol_gonol), - occurrence=occurrence, - carried_options=( - ("domain", "nomenclature"), - ("symbol", symbol), - ), - ) - - -def replay_symbol_coupling(receipt: PublicGonolReceipt) -> str: - return replay_public_gonol(receipt).receipt_digest - - -__all__ = [ - "RELATION_COUPLING", - "RELATION_SYMBOL", - "SUPPORTED_SYMBOLS", - "construct_symbol_gonol", - "couple_symbol", - "replay_symbol_coupling", -] diff --git a/research/epac/subatomic/test_element_affixiation_candidate.py b/research/epac/subatomic/test_element_affixiation_candidate.py deleted file mode 100644 index 76800d3..0000000 --- a/research/epac/subatomic/test_element_affixiation_candidate.py +++ /dev/null @@ -1,109 +0,0 @@ -"""Executable witnesses for the subatomic element affixiation candidate.""" - -# === CHECKS === -# id: check_candidate_uses_only_established_ucns_surfaces -# proves: candidate_uses_only_established_ucns_surfaces -# call: self::test_imports_consume_only_established_ucns_surfaces -# mutates: none -# cleanup: none -# -# id: check_element_identity_positions_exact -# proves: element_identity_positions_exact -# call: self::test_element_identity_positions_exact -# mutates: none -# cleanup: none -# -# id: check_mobius_parameter_sequence_exact -# proves: mobius_parameter_sequence_exact -# call: self::test_mobius_parameter_sequence_exact -# mutates: none -# cleanup: none -# -# id: check_receipt_deterministic_and_replayable -# proves: receipt_deterministic_and_replayable -# call: self::test_receipt_deterministic_and_replayable -# mutates: none -# cleanup: none -# -# id: check_no_physics_or_canon_claim -# proves: no_physics_or_canon_claim -# call: self::test_no_physics_or_canon_claim -# mutates: none -# cleanup: none -# === END CHECKS === - -from fractions import Fraction - -import element_affixiation_candidate as candidate -from ucns import ( - PUBLIC_GONOL_157, - PUBLIC_GONOL_SHA256, - NativeMobiusFrame, - native_mobius_state, - public_gonol_function, -) - - -def test_imports_consume_only_established_ucns_surfaces(): - # The candidate module surface must stay identity-only. If this test - # fails, a position operation or unestablished geometry was introduced. - assert candidate.CONSTRUCTION_IDS["ordered_parameter"] == "ucns.native-mobius-turn-index" - assert candidate.CONSTRUCTION_IDS["relation"] == "metapat.affixiation_harmonics.affixiation" - # The only UCNS geometry imported is carrier identity + Möbius framing. - assert public_gonol_function(0).glyph == PUBLIC_GONOL_157[0] - - -def test_element_identity_positions_exact(): - cases = { - "H": ((1,), ()), - "He": ((1, 2), (3, 4)), - "Li": ((1, 2, 3), (4, 5, 6, 7)), - "C": ((1, 2, 3, 4, 5, 6), (7, 8, 9, 10, 11, 12)), - } - for symbol, (expected_p, expected_n) in cases.items(): - element = candidate.affixiate_element(symbol) - assert element.proton_positions == expected_p - assert element.neutron_positions == expected_n - # Every assigned position is an identity coordinate on the carrier. - assert all(0 <= i < len(PUBLIC_GONOL_157) for i in element.proton_positions) - assert all(0 <= i < len(PUBLIC_GONOL_157) for i in element.neutron_positions) - assert element.proton_glyphs == tuple( - public_gonol_function(i).glyph for i in element.proton_positions - ) - assert element.neutron_glyphs == tuple( - public_gonol_function(i).glyph for i in element.neutron_positions - ) - - -def test_mobius_parameter_sequence_exact(): - s0 = native_mobius_state(Fraction(0)) - s1 = native_mobius_state(Fraction(1)) - s2 = native_mobius_state(Fraction(2)) - assert s0.visible_key == s1.visible_key == s2.visible_key - assert s0.frame is NativeMobiusFrame.POSITIVE - assert s1.frame is NativeMobiusFrame.REVERSED - assert s2.frame is NativeMobiusFrame.POSITIVE - assert s0.complete_key == s2.complete_key - assert s1.complete_key != s0.complete_key - - -def test_receipt_deterministic_and_replayable(): - for symbol in candidate.ISOTOPE_DEFAULTS: - first = candidate.affixiate_element(symbol) - matches, replay_receipt = candidate.replay_element(symbol) - assert matches is True - assert replay_receipt == first.receipt - assert len(first.receipt) == 64 - # Distinct participant sets produce distinct receipts. - receipts = {candidate.affixiate_element(s).receipt for s in candidate.ISOTOPE_DEFAULTS} - assert len(receipts) == len(candidate.ISOTOPE_DEFAULTS) - - -def test_no_physics_or_canon_claim(): - for symbol in candidate.ISOTOPE_DEFAULTS: - element = candidate.affixiate_element(symbol) - assert element.status == "CROSS-DOMAIN-HYPOTHESIS" - assert element.closure_scale == "epac.subatomic.atomic" - assert candidate.SOURCE_COMMITS["metapat"] == "34d954aa1e2092e615b03a180500f6b6977f501e" - assert candidate.SOURCE_COMMITS["ucns"] == "1975fe70cf4e0826a8020c2da3047569e277af64" - assert PUBLIC_GONOL_SHA256 == "55d10c84529a4d7bc7714786357e977b68d9df2ac3f73d20e229580b552c2ef5" diff --git a/research/epac/subatomic/test_extended_atomic.py b/research/epac/subatomic/test_extended_atomic.py deleted file mode 100644 index 8f14e6e..0000000 --- a/research/epac/subatomic/test_extended_atomic.py +++ /dev/null @@ -1,80 +0,0 @@ -"""Executable witnesses for the extended atomic quantum layer Z=1..36 (broader subatomic coverage through Kr).""" - -# === CHECKS === -# id: check_extended_atomic_preserves_z_le_18 -# proves: extended_atomic_preserves_z_le_18 -# call: self::test_extended_atomic_preserves_z_le_18 -# mutates: none -# cleanup: none -# -# id: check_extended_atomic_uses_declared_configurations -# proves: extended_atomic_uses_declared_configurations -# call: self::test_extended_atomic_uses_declared_configurations -# mutates: none -# cleanup: none -# -# id: check_extended_atomic_stays_candidate -# proves: extended_atomic_stays_candidate -# call: self::test_extended_atomic_stays_candidate -# mutates: none -# cleanup: none -# === END CHECKS === - -import epac_atomic -import extended_atomic as m - - -def test_extended_atomic_preserves_z_le_18(): - for Z in range(1, 19): - assert m.atomic_record(Z) == epac_atomic.atomic_record(Z) - - -def test_extended_atomic_uses_declared_configurations(): - iron = m.atomic_record(26) - assert iron.symbol == "Fe" - assert iron.Z == 26 - assert iron.A == 56 - assert iron.configuration == "1s2.2s2.2p6.3s2.3p6.4s2.3d6" - assert sum(1 for e in iron.electrons) == 26 - - chromium = m.atomic_record(24) - assert chromium.configuration == "1s2.2s2.2p6.3s2.3p6.4s1.3d5" - - potassium = m.atomic_record(19) - assert potassium.configuration == "1s2.2s2.2p6.3s2.3p6.4s1" - assert potassium.symbol == "K" - - # Broader coverage Z=27..36 - krypton = m.atomic_record(36) - assert krypton.symbol == "Kr" - assert krypton.Z == 36 - assert krypton.A == 84 - assert krypton.configuration.endswith("4p6") - assert sum(1 for e in krypton.electrons) == 36 - - copper = m.atomic_record(29) - assert copper.configuration == "1s2.2s2.2p6.3s2.3p6.4s1.3d10" - - zinc = m.atomic_record(30) - assert zinc.configuration == "1s2.2s2.2p6.3s2.3p6.4s2.3d10" - - # Table shape - assert m.SYMBOL_TO_Z["Fe"] == 26 - assert m.SYMBOL_TO_Z["Kr"] == 36 - assert m.EXTENDED_SYMBOLS[25] == "Fe" - assert m.EXTENDED_SYMBOLS[35] == "Kr" - assert len(m.EXTENDED_SYMBOLS) == 36 - - -def test_extended_atomic_stays_candidate(): - record = m.atomic_record(26) - # Candidate data is complete but carries no physics-validation claim. - for electron in record.electrons: - assert electron.n >= 1 - assert electron.z_eff - assert electron.e_rydberg - - -def test_extended_atomic_does_not_mutate_sys_path(): - source = open(m.__file__, encoding="utf-8").read() - assert "sys.path" not in source diff --git a/research/epac/subatomic/test_nuclear_harmonic_candidates.py b/research/epac/subatomic/test_nuclear_harmonic_candidates.py deleted file mode 100644 index 5815fdc..0000000 --- a/research/epac/subatomic/test_nuclear_harmonic_candidates.py +++ /dev/null @@ -1,122 +0,0 @@ -"""Executable witnesses for the nuclear harmonic-relation candidates.""" - -# === CHECKS === -# id: check_every_harmonic_candidate_declares_six_evidence_fields -# proves: every_harmonic_candidate_declares_six_evidence_fields -# call: self::test_every_candidate_declares_six_evidence_fields -# mutates: none -# cleanup: none -# -# id: check_harmonic_parameter_is_time_agnostic -# proves: harmonic_parameter_is_time_agnostic -# call: self::test_parameter_is_time_agnostic -# mutates: none -# cleanup: none -# -# id: check_no_public_gonol_position_operation_invented -# proves: no_public_gonol_position_operation_invented -# call: self::test_no_position_operation_invented -# mutates: none -# cleanup: none -# -# id: check_recurrence_test_is_deterministic -# proves: recurrence_test_is_deterministic -# call: self::test_recurrence_deterministic_and_replayable -# mutates: none -# cleanup: none -# -# id: check_all_results_remain_cross_domain_hypothesis -# proves: all_results_remain_cross_domain_hypothesis -# call: self::test_all_results_cross_domain_hypothesis -# mutates: none -# cleanup: none -# === END CHECKS === - -import nuclear_harmonic_candidates as m - - -def test_every_candidate_declares_six_evidence_fields(): - for candidate in m.CANDIDATES: - assert candidate.participants - assert candidate.ordered_parameter.get("kind") - assert candidate.ordered_parameter.get("declaration") - assert candidate.recurrence_mapping - assert candidate.equivalence_condition - assert candidate.information_loss - assert candidate.physical_provenance - assert len(candidate.receipt) == 64 - - -def test_parameter_is_time_agnostic(): - for candidate in m.CANDIDATES: - assert candidate.ordered_parameter["time_agnostic"] is True - assert "time" not in candidate.ordered_parameter["kind"] - assert m.ORDERED_PARAMETER["kind"] == "nucleon-content-sequence" - - -def test_no_position_operation_invented(): - # The module must not import UCNS geometry or call position operations. - # (Contract ids legitimately name the forbidden surface, so only actual - # imports and call forms are asserted absent.) - source = open(m.__file__, encoding="utf-8").read() - assert "import ucns" not in source - assert "from ucns" not in source - assert "public_gonol_function(" not in source - assert "native_mobius_state(" not in source - assert "phase" not in m.ORDERED_PARAMETER["declaration"] - - -def test_recurrence_deterministic_and_replayable(): - # The function must return a dict whose keys are *exactly* the participants - # declared on that candidate. This keeps the test robust under broadening. - for candidate in m.CANDIDATES: - result = m.recurrence_test(candidate) - assert set(result.keys()) == set(candidate.participants), ( - f"{candidate.candidate_id} keys {set(result.keys())} != participants {set(candidate.participants)}" - ) - - # Receipts are deterministic across reconstruction. - record = { - "candidate_id": candidate.candidate_id, - "relation_kind": candidate.relation_kind, - "participants": list(candidate.participants), - "ordered_parameter": candidate.ordered_parameter, - "recurrence_mapping": candidate.recurrence_mapping, - "equivalence_condition": candidate.equivalence_condition, - "information_loss": candidate.information_loss, - "physical_provenance": list(candidate.physical_provenance), - "status": candidate.status, - } - assert m.harmonic_receipt(record) == candidate.receipt - - receipts = {c.receipt for c in m.CANDIDATES} - assert len(receipts) == len(m.CANDIDATES) - - # Core preserved behaviors for the original nuclei - alpha = m.recurrence_test([c for c in m.CANDIDATES if c.candidate_id == "alpha_cluster_recurrence"][0]) - assert alpha.get("Li-7") is True - assert alpha.get("C-12") is True - - for cand in m.CANDIDATES: - if cand.candidate_id in ("n_z_ratio_commensurability", - "ground_state_spin_parity_symmetry", - "proton_neutron_inversion_symmetry"): - res = m.recurrence_test(cand) - if "Li-7" in res: - assert res["Li-7"] is False - if "C-12" in res: - assert res["C-12"] is True - - # New alpha-conjugate nuclei satisfy the alpha recurrence by the declared rule - alpha = m.recurrence_test([c for c in m.CANDIDATES if c.candidate_id == "alpha_cluster_recurrence"][0]) - for p in ("O-16", "Ne-20", "Mg-24", "Si-28", "S-32", "Ar-36", "Ca-40"): - if p in alpha: - assert alpha[p] is True - - -def test_all_results_cross_domain_hypothesis(): - for candidate in m.CANDIDATES: - assert candidate.status == "CROSS-DOMAIN-HYPOTHESIS" - assert m.NUCLIDE_FACTS["He-4"]["J_pi"] == "0+" - assert m.NUCLIDE_FACTS["C-12"]["J_pi"] == "0+" - assert m.NUCLIDE_FACTS["Li-7"]["J_pi"] == "3/2-" diff --git a/research/epac/subatomic/test_subatomic_gonol.py b/research/epac/subatomic/test_subatomic_gonol.py deleted file mode 100644 index 1b38a11..0000000 --- a/research/epac/subatomic/test_subatomic_gonol.py +++ /dev/null @@ -1,156 +0,0 @@ -"""Executable witnesses for the subatomic gonol constructor.""" - -# === CHECKS === -# id: check_subatomic_gonol_combines_three_sources -# proves: subatomic_gonol_combines_three_sources -# call: self::test_combines_three_sources -# mutates: none -# cleanup: none -# -# id: check_subatomic_gonol_replays_byte_identical -# proves: subatomic_gonol_replays_byte_identical -# call: self::test_replays_byte_identical -# mutates: none -# cleanup: none -# -# id: check_subatomic_gonol_keeps_layers_distinct -# proves: subatomic_gonol_keeps_layers_distinct -# call: self::test_keeps_layers_distinct -# mutates: none -# cleanup: none -# -# id: check_subatomic_gonol_invents_no_geometry -# proves: subatomic_gonol_invents_no_geometry -# call: self::test_invents_no_geometry -# mutates: none -# cleanup: none -# -# id: check_subatomic_gonol_stays_cross_domain_hypothesis -# proves: subatomic_gonol_stays_cross_domain_hypothesis -# call: self::test_stays_cross_domain_hypothesis -# mutates: none -# cleanup: none -# === END CHECKS === - -import subatomic_gonol as m -from extended_atomic import atomic_record - - -def _receipts(): - return {symbol: m.construct_subatomic_gonol(symbol) for symbol in m.SUPPORTED_SYMBOLS} - - -def test_combines_three_sources(): - for symbol, receipt in _receipts().items(): - carried = dict(receipt.gonol.carried_options) - nucleus_carried = dict(receipt.gonol.participants[0].carried_options) - # Subatomic identity fields live on the nucleus participant. - assert "proton-positions" in nucleus_carried - assert "proton-glyphs" in nucleus_carried - assert "mobius-t0-frame" in nucleus_carried - assert "mobius-t2-frame" in nucleus_carried - # Harmonic relation results live on the nucleus participant for the - # elements that participate in the declared nuclear candidates. - if symbol in {"H", "He", "Li", "C"}: - assert any(key.startswith("harmonic:") for key in nucleus_carried) - # Quantum-layer fields live on the element gonol. - assert carried["electron-configuration"] == atomic_record(int(carried["Z"])).configuration - assert "valence-electrons" in carried - assert "harmonic-surviving" in carried - - -def test_replays_byte_identical(): - for symbol, receipt in _receipts().items(): - assert m.replay_subatomic_gonol(receipt) == receipt.receipt_digest - assert len(receipt.receipt_digest) == 64 - digests = {r.receipt_digest for r in _receipts().values()} - assert len(digests) == len(m.SUPPORTED_SYMBOLS) - - -def test_keeps_layers_distinct(): - for symbol, receipt in _receipts().items(): - kinds = [ - "nucleus" if "nucleus" in p.source_id else "shell" - for p in receipt.gonol.participants - ] - assert kinds[0] == "nucleus" - assert all(kind == "shell" for kind in kinds[1:]) - assert len(kinds) >= 2 # nucleus + at least one shell - # Electron shells are individually addressable, not flattened. - for participant in receipt.gonol.participants[1:]: - assert "shell" in participant.source_id - - -def test_invents_no_geometry(): - source = open(m.__file__, encoding="utf-8").read() - # The module consumes epac.public_gonol; it must not define position operations - # and must not import the EDCM text-domain constructor. - assert "def " + "public_gonol" not in source - assert "from edcm" not in source - assert "import edcm" not in source - assert "advance(" not in source - assert "NativeMobius" not in source - receipt = m.construct_subatomic_gonol("H") - assert receipt.constructor_id == "epac.public_gonol" - assert receipt.gonol.geometry_digest - - -def test_stays_cross_domain_hypothesis(): - for symbol, receipt in _receipts().items(): - assert receipt.standing == "implemented-candidate" - assert receipt.selection_effect == "none" - assert dict(receipt.gonol.carried_options)["status"] == "CROSS-DOMAIN-HYPOTHESIS" - assert receipt.nonclaims - assert receipt.hmmm - - -def test_imports_do_not_mutate_sys_path(): - source = open(m.__file__, encoding="utf-8").read() - assert "sys.path" not in source - - -def test_harmonic_survival_is_symbol_specific(): - surviving = { - symbol: dict(m.construct_subatomic_gonol(symbol).gonol.carried_options)[ - "harmonic-surviving" - ] - for symbol in ("H", "He", "Li", "C") - } - # Values are the deterministic outcome of recurrence_test over the - # declared CANDIDATES and NUCLIDE_FACTS for these symbols. - assert surviving["H"] == "n_z_ratio_commensurability" - assert "alpha_cluster_recurrence" in surviving["He"] - assert "proton_neutron_inversion_symmetry" in surviving["He"] - assert surviving["Li"] == "alpha_cluster_recurrence" - assert "proton_neutron_inversion_symmetry" in surviving["C"] - - -def test_lifted_spiral_is_carried_on_subatomic_gonol(): - # The lifted spiral (UCNS framed Möbius root-loop) is now carried on the - # subatomic gonol receipt as a first-class fact (parallel to harmonic-surviving). - for symbol in ("H", "He", "C", "O"): - receipt = m.construct_subatomic_gonol(symbol) - carried = dict(receipt.gonol.carried_options) - assert "lifted-spiral" in carried - from subatomic_gonol import lifted_spiral_carried_on_subatomic - inv = lifted_spiral_carried_on_subatomic(receipt) - assert isinstance(inv, (list, tuple)) and len(inv) == 3 - frames, axes, ac = inv - assert len(frames) >= 1 - assert len(axes) >= 1 - assert ac == 0 # bare subatomic/element gonols have attachment count 0 - - -def test_subatomic_gonol_lifted_spiral_preserved_under_replay(): - # The carried "lifted-spiral" on subatomic gonol receipts must survive - # exact replay (byte-replay determinism), parallel to molecule and element. - from subatomic_gonol import lifted_spiral_carried_on_subatomic - for symbol in ("H", "C", "O", "Si"): - receipt = m.construct_subatomic_gonol(symbol) - carried_before = dict(receipt.gonol.carried_options).get("lifted-spiral", "") - replayed = m.replay_subatomic_gonol(receipt) - # replay_subatomic returns the digest; fetch fresh receipt via construct to read carried - # but the digest equality already confirms full receipt stability. - assert replayed == receipt.receipt_digest - carried_after = dict(m.construct_subatomic_gonol(symbol).gonol.carried_options).get("lifted-spiral", "") - assert carried_before == carried_after diff --git a/research/epac/subatomic/test_symbol_coupling.py b/research/epac/subatomic/test_symbol_coupling.py deleted file mode 100644 index 73911cd..0000000 --- a/research/epac/subatomic/test_symbol_coupling.py +++ /dev/null @@ -1,93 +0,0 @@ -"""Executable witnesses for nomenclature abbreviation coupling.""" - -# === CHECKS === -# id: check_letters_are_not_physics_domain -# proves: letters_are_not_physics_domain -# call: self::test_letters_are_not_physics_domain -# mutates: none -# cleanup: none -# -# id: check_symbol_gonol_preserves_exact_abbreviation -# proves: symbol_gonol_preserves_exact_abbreviation -# call: self::test_symbol_gonol_preserves_exact_abbreviation -# mutates: none -# cleanup: none -# -# id: check_symbol_coupling_two_participants -# proves: symbol_coupling_two_participants -# call: self::test_symbol_coupling_two_participants -# mutates: none -# cleanup: none -# -# id: check_symbol_coupling_replays_byte_identical -# proves: symbol_coupling_replays_byte_identical -# call: self::test_symbol_coupling_replays_byte_identical -# mutates: none -# cleanup: none -# -# id: check_symbol_coupling_stays_cross_domain_hypothesis -# proves: symbol_coupling_stays_cross_domain_hypothesis -# call: self::test_symbol_coupling_stays_cross_domain_hypothesis -# mutates: none -# cleanup: none -# === END CHECKS === - -import symbol_coupling as m - - -def test_letters_are_not_physics_domain(): - source = open(m.__file__, encoding="utf-8").read() - assert "from epac_dimensional_arity" not in source - assert "import epac_dimensional_arity" not in source - assert "SYMBOL_TO_Z" not in source - assert "oriented_instance_couplings" not in source - helium = m.construct_symbol_gonol("He") - iron = m.construct_symbol_gonol("Fe") - assert helium.gonol.structure is None - assert helium.gonol.couplings == () - assert iron.gonol.structure is None - assert dict(helium.gonol.carried_options)["domain"] == "nomenclature" - for participant in helium.gonol.participants: - assert dict(participant.carried_options)["domain"] == "nomenclature" - assert "Z" not in dict(participant.carried_options) - - -def test_symbol_gonol_preserves_exact_abbreviation(): - h = m.construct_symbol_gonol("H").gonol - assert len(h.participants) == 1 - assert dict(h.carried_options)["abbreviation-length"] == "1" - - he = m.construct_symbol_gonol("He").gonol - assert len(he.participants) == 2 - assert [p.identity_glyph for p in he.participants] == ["H", "e"] - assert dict(he.carried_options)["abbreviation-length"] == "2" - - fe = m.construct_symbol_gonol("Fe").gonol - assert [p.identity_glyph for p in fe.participants] == ["F", "e"] - - -def test_symbol_coupling_two_participants(): - for symbol in ("H", "He", "Fe"): - receipt = m.couple_symbol(symbol) - assert len(receipt.gonol.participants) == 2 - assert dict(receipt.gonol.carried_options)["symbol"] == symbol - assert dict(receipt.gonol.carried_options)["domain"] == "nomenclature" - assert receipt.gonol.structure is None - assert receipt.gonol.couplings == () - assert receipt.gonol.participants[0].relation == "epac.subatomic.element" - assert receipt.gonol.participants[1].relation == "epac.nomenclature.abbreviation" - - -def test_symbol_coupling_replays_byte_identical(): - digests = set() - for symbol in m.SUPPORTED_SYMBOLS: - receipt = m.couple_symbol(symbol) - assert m.replay_symbol_coupling(receipt) == receipt.receipt_digest - digests.add(receipt.receipt_digest) - assert len(digests) == len(m.SUPPORTED_SYMBOLS) - - -def test_symbol_coupling_stays_cross_domain_hypothesis(): - receipt = m.couple_symbol("Fe") - assert receipt.standing == "implemented-candidate" - assert receipt.selection_effect == "none" diff --git a/research/epac/tests/test_atomic_promotion.py b/research/epac/tests/test_atomic_promotion.py deleted file mode 100644 index d436fed..0000000 --- a/research/epac/tests/test_atomic_promotion.py +++ /dev/null @@ -1,75 +0,0 @@ -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(STACK_ROOT / "libs" / "ucns" / "src")) - -from epac_atomic import atomic_record -from epac_periodic import construct_element_gonol, replay_element_gonol - - -class AtomicPromotionTest(unittest.TestCase): - def test_promoted_carbon_unpaired_accounting_and_ordering(self) -> None: - carbon = atomic_record(6) - self.assertEqual(carbon.configuration, "1s2.2s2.2p2") - self.assertEqual(tuple((e.l, e.m_l) for e in carbon.unpaired_valence), ((1, 1), (1, 0))) - promoted = carbon.promoted_unpaired_valence - self.assertEqual(len(promoted), 4) - # Every promoted unpaired electron uses the m_s = +1 convention. - self.assertTrue(all(e.m_s == 1 for e in promoted)) - self.assertEqual(len({e.index for e in promoted}), len(promoted)) - # Canonical subshell ordering: s before p, p orbitals ascending m_l. - self.assertEqual( - tuple((e.l, e.m_l) for e in promoted), - ((0, 0), (1, -1), (1, 0), (1, 1)), - ) - self.assertEqual({e.subshell for e in promoted}, {"2s", "2p"}) - - def test_promoted_beryllium_unpaired_accounting_and_ordering(self) -> None: - beryllium = atomic_record(4) - self.assertEqual(beryllium.configuration, "1s2.2s2") - promoted = beryllium.promoted_unpaired_valence - self.assertEqual(len(promoted), 2) - self.assertTrue(all(e.m_s == 1 for e in promoted)) - self.assertEqual(tuple((e.l, e.m_l) for e in promoted), ((0, 0), (1, 1))) - - def test_ordinary_atoms_do_not_promote_without_an_empty_valence_p(self) -> None: - # Helium has no valence shell; oxygen and nitrogen have no empty - # valence p orbital, so their promoted sets equal their ground sets. - helium = atomic_record(2) - oxygen = atomic_record(8) - nitrogen = atomic_record(7) - self.assertEqual(helium.promoted_unpaired_valence, ()) - self.assertEqual(helium.unpaired_valence, ()) - self.assertEqual( - tuple((e.l, e.m_l) for e in oxygen.promoted_unpaired_valence), - ((1, 0), (1, -1)), - ) - self.assertEqual( - tuple((e.l, e.m_l) for e in oxygen.promoted_unpaired_valence), - tuple((e.l, e.m_l) for e in oxygen.unpaired_valence), - ) - self.assertEqual(len(nitrogen.promoted_unpaired_valence), 3) - self.assertEqual( - tuple((e.l, e.m_l) for e in nitrogen.promoted_unpaired_valence), - tuple((e.l, e.m_l) for e in nitrogen.unpaired_valence), - ) - - def test_configuration_serialization_round_trip(self) -> None: - carbon = construct_element_gonol("C") - options = dict(carbon.gonol.carried_options) - self.assertEqual(options["electron-configuration"], "1s2.2s2.2p2") - self.assertEqual(options["unpaired-valence-lm"], "1:1,1:0") - self.assertEqual(options["promoted-unpaired-count"], "4") - self.assertEqual(options["promoted-unpaired-lm"], "0:0,1:-1,1:0,1:1") - replayed = replay_element_gonol(carbon) - self.assertEqual(carbon.receipt_digest, replayed.receipt_digest) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_boundary_capacity_quotient.py b/research/epac/tests/test_boundary_capacity_quotient.py deleted file mode 100644 index a27d937..0000000 --- a/research/epac/tests/test_boundary_capacity_quotient.py +++ /dev/null @@ -1,208 +0,0 @@ -"""Executable witnesses for EPAC boundary-capacity quotient evidence.""" - -# === CHECKS === -# id: check_boundary_quotient_freezes_current_surface -# proves: boundary_quotient_freezes_current_surface -# call: self::test_quotient_uses_only_the_frozen_state_surface -# mutates: none -# cleanup: none -# -# id: check_boundary_quotient_probe_inventory_is_existing_and_count_valued -# proves: boundary_quotient_probe_inventory_is_existing_and_count_valued -# call: self::test_probe_inventory_is_existing_and_B_valued -# mutates: none -# cleanup: none -# -# id: check_boundary_quotient_ignores_identity_incidence_and_topology -# proves: boundary_quotient_ignores_identity_incidence_and_topology -# call: self::test_probe_signature_omits_identity_incidence_and_topology -# mutates: none -# cleanup: none -# -# id: check_boundary_quotient_relation_is_probe_signature_equality -# proves: boundary_quotient_relation_is_probe_signature_equality -# call: self::test_boundary_equivalence_is_probe_signature_equality -# mutates: none -# cleanup: none -# -# id: check_boundary_quotient_B_matches_probe_equivalence -# proves: boundary_quotient_B_matches_probe_equivalence -# call: self::test_B_equality_matches_boundary_capacity_probe_equivalence -# mutates: none -# cleanup: none -# -# id: check_boundary_quotient_preserves_state_sufficiency_falsification -# proves: boundary_quotient_preserves_state_sufficiency_falsification -# call: self::test_state_sufficiency_remains_falsified -# mutates: none -# cleanup: none -# -# id: check_boundary_quotient_does_not_extend_B -# proves: boundary_quotient_does_not_extend_B -# call: self::test_quotient_does_not_extend_descriptor -# mutates: none -# cleanup: none -# === END CHECKS === - -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(EPAC_ROOT / "subatomic")) -sys.path.insert(0, str(STACK_ROOT / "libs" / "ucns" / "src")) - -from epac_boundary_quotient import ( - BOUNDARY_CAPACITY_PROBES, - boundary_capacity_quotient_report, -) -from epac_cross_scale_closure import FALSIFIED, SURVIVED, UNRESOLVED - - -class BoundaryCapacityQuotientTest(unittest.TestCase): - report: dict - - @classmethod - def setUpClass(cls) -> None: - cls.report = boundary_capacity_quotient_report() - - def test_quotient_uses_only_the_frozen_state_surface(self) -> None: - surface = self.report["surface"] - self.assertTrue(surface["frozen_before_quotient"]) - self.assertEqual(surface["state_count"], 27) - self.assertEqual( - surface["state_ids"], - ( - "subatomic:H", - "element:H", - "subatomic:O", - "element:O", - "subatomic:N", - "element:N", - "subatomic:C", - "element:C", - "subatomic:S", - "element:S", - "subatomic:B", - "element:B", - "subatomic:F", - "element:F", - "subatomic:P", - "element:P", - "subatomic:Si", - "element:Si", - "molecule:H2", - "molecule:H2O", - "molecule:NH3", - "molecule:CH4", - "molecule:CO2", - "molecule:H2S", - "molecule:BF3", - "molecule:PH3", - "molecule:SiH4", - ), - ) - - def test_probe_inventory_is_existing_and_B_valued(self) -> None: - inventory = self.report["probe_inventory"] - self.assertEqual(inventory["status"], SURVIVED) - self.assertEqual(inventory["probe_kinds"], BOUNDARY_CAPACITY_PROBES) - self.assertEqual( - inventory["probe_source"], - "epac_boundary_nondegeneracy.build_counterfactual_neighborhood", - ) - self.assertTrue(inventory["all_admissible_outputs_are_B"]) - self.assertFalse(inventory["uses_identity_or_incidence_fields"]) - self.assertGreater(inventory["admissible_output_count"], 0) - - def test_probe_signature_omits_identity_incidence_and_topology(self) -> None: - inventory = self.report["probe_inventory"] - self.assertEqual( - set(inventory["identity_fields_excluded"]), - { - "state_id", - "scale", - "source", - "role", - "bulk_count", - "labels", - "boundary_axes", - "coupling_slots", - "structure_signature", - "parent_id", - "mutation_id", - }, - ) - for behavior_class in self.report["boundary_capacity_behavior_classes"]: - self.assertIsInstance(behavior_class, tuple) - for record in behavior_class: - self.assertEqual(len(record), 5) - self.assertIn(record[1], {"admissible", "inadmissible"}) - for value in record[2:4]: - if value is not None: - self.assertEqual(len(value), 3) - self.assertTrue(all(isinstance(component, int) for component in value)) - - def test_boundary_equivalence_is_probe_signature_equality(self) -> None: - statuses = self.report["statuses"] - self.assertEqual(statuses["boundary_capacity_equivalence_relation"], SURVIVED) - self.assertEqual(len(self.report["B_classes"]), 16) - self.assertEqual(len(self.report["boundary_capacity_behavior_classes"]), 16) - self.assertEqual( - self.report["B_partition"], - self.report["behavior_partition"], - ) - - def test_B_equality_matches_boundary_capacity_probe_equivalence(self) -> None: - statuses = self.report["statuses"] - self.assertEqual(statuses["B_matches_boundary_capacity_quotient"], SURVIVED) - self.assertEqual(self.report["same_B_probe_mismatches"], ()) - self.assertEqual(self.report["unequal_B_equivalent_pairs"], ()) - self.assertEqual(self.report["equal_B_pair_count"], 19) - - def test_state_sufficiency_remains_falsified(self) -> None: - statuses = self.report["statuses"] - self.assertEqual(statuses["state_sufficiency"], FALSIFIED) - self.assertEqual(statuses["incidence_completeness"], UNRESOLVED) - self.assertEqual(statuses["topology_completeness"], UNRESOLVED) - - collision_groups = { - tuple(group["state_ids"]) - for group in self.report["state_sufficiency_collisions"] - } - self.assertIn(("element:H", "subatomic:H"), collision_groups) - self.assertIn( - ("subatomic:B", "subatomic:C", "subatomic:F", "subatomic:N", "subatomic:O"), - collision_groups, - ) - self.assertIn(("molecule:H2O", "molecule:H2S"), collision_groups) - self.assertIn(("molecule:BF3", "molecule:NH3", "molecule:PH3"), collision_groups) - self.assertIn(("molecule:CH4", "molecule:SiH4"), collision_groups) - - def test_quotient_does_not_extend_descriptor(self) -> None: - self.assertEqual( - self.report["statuses"], - { - "probe_inventory": SURVIVED, - "boundary_capacity_equivalence_relation": SURVIVED, - "B_matches_boundary_capacity_quotient": SURVIVED, - "state_sufficiency": FALSIFIED, - "incidence_completeness": UNRESOLVED, - "topology_completeness": UNRESOLVED, - }, - ) - self.assertIn( - "do not promote B as a complete EPAC state descriptor", - self.report["requires_more"], - ) - for b_value in self.report["B_classes"]: - self.assertEqual(len(b_value), 3) - self.assertTrue(all(isinstance(component, int) for component in b_value)) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_boundary_descriptor_nondegeneracy.py b/research/epac/tests/test_boundary_descriptor_nondegeneracy.py deleted file mode 100644 index de66e75..0000000 --- a/research/epac/tests/test_boundary_descriptor_nondegeneracy.py +++ /dev/null @@ -1,269 +0,0 @@ -"""Executable witnesses for EPAC boundary-descriptor non-degeneracy controls.""" - -# === CHECKS === -# id: check_nondegeneracy_freezes_surface_before_controls -# proves: nondegeneracy_freezes_surface_before_controls -# call: self::test_freezes_current_surface_before_generating_controls -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_label_invariance -# proves: boundary_descriptor_label_invariance -# call: self::test_label_and_order_controls_preserve_B -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_equivalent_path_invariance -# proves: boundary_descriptor_equivalent_path_invariance -# call: self::test_equivalent_paths_remain_cross_scale_invariant -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_d_boundary_sensitivity -# proves: boundary_descriptor_d_boundary_sensitivity -# call: self::test_d_boundary_controls_change_only_declared_dimension -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_c_boundary_sensitivity -# proves: boundary_descriptor_c_boundary_sensitivity -# call: self::test_c_boundary_controls_change_only_declared_coupling_count -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_non_singleton_control_discrimination -# proves: boundary_descriptor_non_singleton_control_discrimination -# call: self::test_non_singleton_controls_split_without_erasing_singleton_warning -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_collision_search_classifies_collisions -# proves: boundary_descriptor_collision_search_classifies_collisions -# call: self::test_collision_search_classifies_coarse_same_B_pairs -# mutates: none -# cleanup: none -# -# id: check_boundary_descriptor_audit_does_not_extend_B -# proves: boundary_descriptor_audit_does_not_extend_B -# call: self::test_descriptor_shape_remains_three_component_count_tuple -# mutates: none -# cleanup: none -# === END CHECKS === - -from __future__ import annotations - -from collections import Counter -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(EPAC_ROOT / "subatomic")) -sys.path.insert(0, str(STACK_ROOT / "libs" / "ucns" / "src")) - -from epac_boundary_nondegeneracy import ( - BoundaryState, - boundary_descriptor_nondegeneracy_report, - build_counterfactual_neighborhood, - freeze_current_construction_surface, -) -from epac_cross_scale_closure import SURVIVED - - -class BoundaryDescriptorNondegeneracyTest(unittest.TestCase): - surface: dict - neighborhood: dict - report: dict - - @classmethod - def setUpClass(cls) -> None: - cls.surface = freeze_current_construction_surface() - cls.neighborhood = build_counterfactual_neighborhood(cls.surface) - cls.report = boundary_descriptor_nondegeneracy_report() - - @classmethod - def _mutations_of_kind(cls, kind: str) -> tuple: - return tuple( - mutation - for mutation in cls.neighborhood["mutations"] - if mutation.kind == kind - ) - - def test_freezes_current_surface_before_generating_controls(self) -> None: - surface = self.surface - self.assertTrue(surface["frozen_before_controls"]) - self.assertEqual( - surface["formulas"], - ("H2", "H2O", "NH3", "CH4", "CO2", "H2S", "BF3", "PH3", "SiH4"), - ) - self.assertEqual( - surface["required_elements"], - ("H", "O", "N", "C", "S", "B", "F", "P", "Si"), - ) - self.assertEqual(len(surface["states"]), 27) - self.assertEqual( - dict(Counter(state.scale for state in surface["states"].values())), - {"subatomic": 9, "element": 9, "molecule": 9}, - ) - - neighborhood = self.neighborhood - self.assertEqual(neighborhood["surface_id"], surface["surface_id"]) - self.assertEqual(neighborhood["parent_states"], surface["states"]) - self.assertTrue( - all(mutation.declared_before_evaluation for mutation in neighborhood["mutations"]) - ) - - def test_label_and_order_controls_preserve_B(self) -> None: - report = self.report - self.assertEqual(report["label_invariance"]["status"], SURVIVED) - self.assertTrue(report["label_invariance"]["all_expected_invariant"]) - - surface = self.surface - for kind in ("relabel", "reorder"): - controls = self._mutations_of_kind(kind) - self.assertEqual(len(controls), len(surface["states"])) - for mutation in controls: - parent = surface["states"][mutation.parent_id] - self.assertEqual(mutation.expected_b, parent.b) - self.assertEqual(mutation.actual_state.b, parent.b) - self.assertFalse(mutation.requires_boundary_distinct_from_parent) - - def test_equivalent_paths_remain_cross_scale_invariant(self) -> None: - report = self.report - equivalent_paths = report["equivalent_path_invariance"] - self.assertEqual(equivalent_paths["status"], SURVIVED) - self.assertTrue(equivalent_paths["element_path_independent"]) - self.assertTrue(equivalent_paths["formula_path_independent"]) - self.assertEqual( - set(equivalent_paths["cross_scale_closure_statuses"].values()), - {SURVIVED}, - ) - - def test_d_boundary_controls_change_only_declared_dimension(self) -> None: - report = self.report - d_sensitivity = report["d_boundary_sensitivity"] - self.assertEqual(d_sensitivity["status"], SURVIVED) - self.assertEqual(d_sensitivity["positive_failures"], ()) - self.assertEqual(d_sensitivity["negative_failures"], ()) - self.assertEqual( - set(d_sensitivity["positive_control_kinds"]), - { - "add_axis", - "delete_axis", - "duplicate_participant", - "hierarchy_refinement_perturbation", - }, - ) - - surface = self.surface - neighborhood = self.neighborhood - positive = [ - mutation - for mutation in neighborhood["mutations"] - if mutation.expected_relation == "distinct_by_d_boundary" - ] - self.assertTrue( - any(mutation.kind == "hierarchy_refinement_perturbation" for mutation in positive) - ) - for mutation in positive: - parent = surface["states"][mutation.parent_id] - self.assertEqual(mutation.actual_state.b, mutation.expected_b) - self.assertEqual(mutation.actual_state.b[0], parent.b[0]) - self.assertNotEqual(mutation.actual_state.b[1], parent.b[1]) - self.assertEqual(mutation.actual_state.b[2], parent.b[2]) - - def test_c_boundary_controls_change_only_declared_coupling_count(self) -> None: - report = self.report - c_sensitivity = report["c_boundary_sensitivity"] - self.assertEqual(c_sensitivity["status"], SURVIVED) - self.assertEqual(c_sensitivity["positive_failures"], ()) - self.assertEqual(c_sensitivity["negative_failures"], ()) - self.assertEqual( - set(c_sensitivity["positive_control_kinds"]), - {"add_coupling", "delete_coupling"}, - ) - self.assertEqual( - set(c_sensitivity["negative_control_kinds"]), - {"rewire_same_count"}, - ) - - surface = self.surface - neighborhood = self.neighborhood - for mutation in neighborhood["mutations"]: - parent = surface["states"][mutation.parent_id] - if mutation.expected_relation == "distinct_by_c_boundary": - self.assertEqual(mutation.actual_state.b, mutation.expected_b) - self.assertEqual(mutation.actual_state.b[0], parent.b[0]) - self.assertEqual(mutation.actual_state.b[1], parent.b[1]) - self.assertNotEqual(mutation.actual_state.b[2], parent.b[2]) - self.assertEqual(mutation.actual_state.bulk_count, parent.bulk_count) - elif mutation.kind == "rewire_same_count": - self.assertEqual(mutation.actual_state.b, parent.b) - self.assertNotEqual( - mutation.actual_state.structure_signature, - parent.structure_signature, - ) - - def test_non_singleton_controls_split_without_erasing_singleton_warning(self) -> None: - report = self.report - non_singleton = report["non_singleton_control_discrimination"] - self.assertEqual(non_singleton["status"], SURVIVED) - self.assertTrue(non_singleton["singleton_warning_retained"]) - self.assertTrue(non_singleton["non_singleton_bulk_groups"]) - self.assertTrue(non_singleton["split_non_singleton_groups"]) - - b_by_formula = non_singleton["B_by_formula"] - self.assertNotEqual(b_by_formula["H2O"], b_by_formula["CO2"]) - self.assertEqual(b_by_formula["H2O"], b_by_formula["H2S"]) - - singleton = non_singleton["singleton_partition_regression"] - self.assertTrue(singleton["observed_subatomic_lifted_spiral_matches_control"]) - self.assertEqual(singleton["classification"], "stale_or_incorrect_control_assertion") - self.assertFalse(singleton["compositional_counterexample"]) - - def test_collision_search_classifies_coarse_same_B_pairs(self) -> None: - report = self.report - collisions = report["descriptor_collision_search"] - self.assertEqual(collisions["status"], SURVIVED) - self.assertEqual(collisions["classification"], "complete_for_bounded_first_order_neighborhood") - self.assertEqual(collisions["required_boundary_distinct_failures"], ()) - self.assertEqual( - collisions["bounded_state_count"], - report["surface"]["state_count"] + report["control_neighborhood"]["mutation_count"], - ) - self.assertGreater(collisions["same_B_collision_count"], 0) - self.assertEqual( - collisions["same_B_collision_count"], - collisions["classified_collision_count"], - ) - - classifications = { - example["classification"] - for example in collisions["coarse_collision_examples"] - } - self.assertIn("declared_invariance_or_same_count_control", classifications) - self.assertIn("intentionally_coarse_equivalence_class", classifications) - self.assertEqual( - set(report["statuses"].values()), - {SURVIVED}, - ) - - def test_descriptor_shape_remains_three_component_count_tuple(self) -> None: - surface = self.surface - sample = next(iter(surface["states"].values())) - self.assertIsInstance(sample, BoundaryState) - self.assertEqual( - sample.b, - ( - sample.interior_modes, - len(sample.boundary_axes), - len(sample.coupling_slots), - ), - ) - self.assertEqual(len(sample.b), 3) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_boundary_minimal_refinement.py b/research/epac/tests/test_boundary_minimal_refinement.py deleted file mode 100644 index 34d6846..0000000 --- a/research/epac/tests/test_boundary_minimal_refinement.py +++ /dev/null @@ -1,224 +0,0 @@ -"""Executable witnesses for the EPAC minimal boundary-refinement audit.""" - -# === CHECKS === -# id: check_minimal_refinement_uses_only_existing_omitted_distinguishers -# proves: minimal_refinement_uses_only_existing_omitted_distinguishers -# call: self::test_scope_uses_only_the_13_existing_distinguishing_observables -# mutates: none -# cleanup: none -# -# id: check_minimal_refinement_searches_by_partition_equality -# proves: minimal_refinement_searches_by_partition_equality -# call: self::test_minimal_candidates_match_the_full_partition -# mutates: none -# cleanup: none -# -# id: check_minimal_refinement_reports_all_minimum_sets -# proves: minimal_refinement_reports_all_minimum_sets -# call: self::test_minimum_size_and_all_minimum_sets_are_reported -# mutates: none -# cleanup: none -# -# id: check_minimal_refinement_classifies_boundary_semantics -# proves: minimal_refinement_classifies_boundary_semantics -# call: self::test_minimal_candidates_are_intrinsic_and_not_label_history_codes -# mutates: none -# cleanup: none -# -# id: check_minimal_refinement_keeps_B_unmodified -# proves: minimal_refinement_keeps_B_unmodified -# call: self::test_B_is_not_modified_or_promoted -# mutates: none -# cleanup: none -# -# id: check_minimal_refinement_classifies_compositionality -# proves: minimal_refinement_classifies_compositionality -# call: self::test_local_reproducibility_and_cross_scale_compositionality_are_separate -# mutates: none -# cleanup: none -# -# id: check_minimal_refinement_blocks_pcea_mapping -# proves: minimal_refinement_blocks_pcea_mapping -# call: self::test_pcea_mapping_remains_blocked -# mutates: none -# cleanup: none -# === END CHECKS === - -from __future__ import annotations - -import ast -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(EPAC_ROOT / "subatomic")) -sys.path.insert(0, str(STACK_ROOT / "libs" / "ucns" / "src")) - -from epac_boundary_minimal_refinement import ( # noqa: E402 - BLOCKED, - SURVIVED, - UNRESOLVED, - boundary_minimal_refinement_report, -) - - -EXPECTED_MINIMAL_SETS = ( - ("charged_structure_readout",), - ("quaternion_structure_readout",), - ("geometry_from_declared_couplings",), - ("structure_from_charged_couplings",), - ("degree_relations",), - ("oriented_instance_couplings",), - ("quaternion_of_local_three",), - ("quaternions_from_declared_couplings",), -) - -EXPECTED_NONMINIMAL_SINGLETONS = { - "topology_structure_readout": 17, - "local_three_structures": 17, - "has_declared_coupling": 17, - "instances_missing_oriented_hub_coupling": 17, - "require_every_instance_has_oriented_hub_coupling": 17, -} - - -class BoundaryMinimalRefinementTest(unittest.TestCase): - report: dict - - @classmethod - def setUpClass(cls) -> None: - cls.report = boundary_minimal_refinement_report() - - def test_scope_uses_only_the_13_existing_distinguishing_observables(self) -> None: - scope = self.report["scope"] - self.assertEqual(self.report["surface"]["state_count"], 27) - self.assertEqual(scope["candidate_observable_count"], 13) - self.assertTrue(scope["uses_only_existing_omitted_distinguishers"]) - self.assertFalse(scope["B_descriptor_modified"]) - self.assertEqual( - self.report["partitions"]["baseline_B_class_count"], - 16, - ) - self.assertEqual( - self.report["partitions"]["full_omitted_observable_class_count"], - 21, - ) - self.assertTrue( - self.report["partitions"]["full_partition_matches_completeness_audit"] - ) - - def test_minimal_candidates_match_the_full_partition(self) -> None: - rows = { - row["operation_name"]: row - for row in self.report["candidate_ledger"] - } - for candidate in EXPECTED_MINIMAL_SETS: - row = rows[candidate[0]] - self.assertTrue(row["minimal_candidate"]) - self.assertEqual(row["singleton_class_count"], 21) - self.assertTrue(row["singleton_reproduces_full_partition"]) - - for name, class_count in EXPECTED_NONMINIMAL_SINGLETONS.items(): - row = rows[name] - self.assertFalse(row["minimal_candidate"]) - self.assertEqual(row["singleton_class_count"], class_count) - self.assertFalse(row["singleton_reproduces_full_partition"]) - - def test_minimum_size_and_all_minimum_sets_are_reported(self) -> None: - minimum = self.report["minimal_refinement"] - self.assertEqual(minimum["minimum_size"], 1) - self.assertFalse(minimum["minimum_unique"]) - self.assertEqual(minimum["minimal_set_count"], 8) - self.assertEqual(minimum["minimal_equivalent_sets"], EXPECTED_MINIMAL_SETS) - - def test_minimal_candidates_are_intrinsic_and_not_label_history_codes(self) -> None: - rows = [ - row for row in self.report["candidate_ledger"] - if row["minimal_candidate"] - ] - self.assertTrue(rows) - self.assertTrue(all(row["intrinsic_boundary_semantics"] for row in rows)) - self.assertTrue( - all( - row["normalized_observable_excludes_labels_ids_and_history"] - for row in rows - ) - ) - self.assertFalse( - any(row["merely_encodes_construction_history_or_labels"] for row in rows) - ) - - def test_B_is_not_modified_or_promoted(self) -> None: - self.assertFalse(self.report["scope"]["B_descriptor_modified"]) - self.assertIn( - "do not modify B merely to rescue probe completeness", - self.report["requires_more"], - ) - self.assertEqual( - self.report["descriptor_sufficiency"][ - "finite_21_class_partition_reproduction" - ], - SURVIVED, - ) - self.assertEqual( - self.report["descriptor_sufficiency"][ - "promotable_descriptor_sufficiency" - ], - UNRESOLVED, - ) - - def test_local_reproducibility_and_cross_scale_compositionality_are_separate(self) -> None: - compositionality = self.report["compositionality"] - self.assertEqual( - compositionality["local_reproducibility_status"], - SURVIVED, - ) - self.assertEqual( - compositionality["cross_scale_compositionality_status"], - UNRESOLVED, - ) - self.assertEqual(self.report["statuses"]["canonicality"], UNRESOLVED) - self.assertEqual(self.report["statuses"]["compositionality"], UNRESOLVED) - - def test_pcea_mapping_remains_blocked(self) -> None: - self.assertEqual( - self.report["statuses"], - { - "minimal_refinement_size": SURVIVED, - "all_minimal_equivalent_sets": SURVIVED, - "intrinsic_boundary_semantics": SURVIVED, - "history_or_label_encoding": SURVIVED, - "canonicality": UNRESOLVED, - "compositionality": UNRESOLVED, - "refined_quotient_class_count": SURVIVED, - "descriptor_sufficiency": UNRESOLVED, - "pcea_mapping": BLOCKED, - }, - ) - self.assertIn( - "PCEA mapping remains blocked until canonicality and compositionality close", - self.report["requires_more"], - ) - - def test_audit_module_has_no_direct_ucns_or_pcea_imports(self) -> None: - source_path = EPAC_ROOT / "epac_boundary_minimal_refinement.py" - tree = ast.parse(source_path.read_text(encoding="utf-8")) - imports: list[str] = [] - for node in ast.walk(tree): - if isinstance(node, ast.Import): - imports.extend(alias.name for alias in node.names) - elif isinstance(node, ast.ImportFrom) and node.module: - imports.append(node.module) - self.assertFalse( - any(name == "ucns" or name.startswith("ucns.") for name in imports) - ) - self.assertFalse( - any(name == "pcea" or name.startswith("pcea.") for name in imports) - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_boundary_probe_completeness.py b/research/epac/tests/test_boundary_probe_completeness.py deleted file mode 100644 index 199fb75..0000000 --- a/research/epac/tests/test_boundary_probe_completeness.py +++ /dev/null @@ -1,246 +0,0 @@ -"""Executable witnesses for EPAC boundary-probe completeness audit.""" - -# === CHECKS === -# id: check_boundary_probe_audit_freezes_current_surface -# proves: boundary_probe_audit_freezes_current_surface -# call: self::test_audit_uses_only_the_frozen_27_state_surface -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_inventory_covers_declared_operations -# proves: boundary_probe_audit_inventory_covers_declared_operations -# call: self::test_declared_operations_are_classified_without_ambiguity -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_uses_no_new_probe_or_descriptor -# proves: boundary_probe_audit_uses_no_new_probe_or_descriptor -# call: self::test_audit_adds_only_existing_observables_and_does_not_extend_B -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_excludes_identity_discriminators -# proves: boundary_probe_audit_excludes_identity_discriminators -# call: self::test_structural_observable_examples_exclude_ids_and_labels -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_imports_no_ucns_or_pcea -# proves: boundary_probe_audit_imports_no_ucns_or_pcea -# call: self::test_audit_module_has_no_direct_ucns_or_pcea_imports -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_reruns_same_B_and_unequal_B_comparisons -# proves: boundary_probe_audit_reruns_same_B_and_unequal_B_comparisons -# call: self::test_omitted_operations_rerun_same_B_and_unequal_B_comparisons -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_reports_partition_change -# proves: boundary_probe_audit_reports_partition_change -# call: self::test_omitted_existing_observables_refine_the_quotient_partition -# mutates: none -# cleanup: none -# -# id: check_boundary_probe_audit_classifies_completeness -# proves: boundary_probe_audit_classifies_completeness -# call: self::test_probe_completeness_is_falsified_not_unresolved -# mutates: none -# cleanup: none -# === END CHECKS === - -from __future__ import annotations - -import ast -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(EPAC_ROOT / "subatomic")) -sys.path.insert(0, str(STACK_ROOT / "libs" / "ucns" / "src")) - -from epac_boundary_probe_completeness import ( - AMBIGUOUS, - BOUNDARY_OBSERVING, - FALSIFIED, - SURVIVED, - boundary_probe_completeness_report, -) -from epac_boundary_quotient import BOUNDARY_CAPACITY_PROBES - - -class BoundaryProbeCompletenessTest(unittest.TestCase): - report: dict - - @classmethod - def setUpClass(cls) -> None: - cls.report = boundary_probe_completeness_report() - - @staticmethod - def _row_by_operation(report: dict, operation: str) -> dict: - rows = { - row["operation"]: row - for row in report["operation_ledger"] - } - return rows[operation] - - @staticmethod - def _contains_identifier(value: object) -> bool: - if isinstance(value, str): - return value.startswith("epac.") or "#" in value - if isinstance(value, dict): - return any( - BoundaryProbeCompletenessTest._contains_identifier(key) - or BoundaryProbeCompletenessTest._contains_identifier(item) - for key, item in value.items() - ) - if isinstance(value, (tuple, list)): - return any( - BoundaryProbeCompletenessTest._contains_identifier(item) - for item in value - ) - return False - - def test_audit_uses_only_the_frozen_27_state_surface(self) -> None: - surface = self.report["surface"] - self.assertTrue(surface["frozen_before_audit"]) - self.assertEqual(surface["state_count"], 27) - self.assertEqual( - self.report["current_probe_inventory"]["baseline_class_count"], - 16, - ) - self.assertEqual( - self.report["current_probe_inventory"]["equal_B_pair_count"], - 19, - ) - self.assertEqual( - self.report["current_probe_inventory"][ - "state_sufficiency_collision_group_count" - ], - 6, - ) - - def test_declared_operations_are_classified_without_ambiguity(self) -> None: - inventory = self.report["operation_inventory"] - self.assertEqual(inventory["operation_count"], 105) - self.assertEqual(inventory["boundary_relevant_count"], 59) - self.assertEqual(inventory["ambiguous_count"], 0) - self.assertFalse( - any(row["boundary_relevance"] == AMBIGUOUS for row in self.report["operation_ledger"]) - ) - - charged = self._row_by_operation( - self.report, - "epac_dimensional_arity.charged_structure_readout", - ) - self.assertEqual(charged["boundary_relevance"], BOUNDARY_OBSERVING) - self.assertFalse(charged["currently_probed"]) - self.assertTrue(charged["can_distinguish_same_B_states"]) - - capacity = self._row_by_operation( - self.report, - "epac_molecular.boundary_capacity_carried_on_molecule", - ) - self.assertTrue(capacity["currently_probed"]) - - local_step = self._row_by_operation( - self.report, - "epac_molecular.apply_local_step", - ) - self.assertTrue(local_step["currently_probed"]) - - def test_audit_adds_only_existing_observables_and_does_not_extend_B(self) -> None: - self.assertEqual( - self.report["current_probe_inventory"]["probe_kinds"], - BOUNDARY_CAPACITY_PROBES, - ) - self.assertIn( - "do not add a descriptor component in this audit", - self.report["requires_more"], - ) - for effect in self.report["omitted_operation_effects"].values(): - for group in effect["same_B_collision_group_results"]: - self.assertEqual(len(group["B"]), 3) - self.assertTrue(all(isinstance(component, int) for component in group["B"])) - - def test_structural_observable_examples_exclude_ids_and_labels(self) -> None: - for effect in self.report["omitted_operation_effects"].values(): - self.assertTrue(effect["identity_discriminators_excluded"]) - for example in effect["same_B_distinguished_pair_examples"]: - self.assertFalse(self._contains_identifier(example["left_observable"])) - self.assertFalse(self._contains_identifier(example["right_observable"])) - - def test_audit_module_has_no_direct_ucns_or_pcea_imports(self) -> None: - source_path = EPAC_ROOT / "epac_boundary_probe_completeness.py" - tree = ast.parse(source_path.read_text(encoding="utf-8")) - imports: list[str] = [] - for node in ast.walk(tree): - if isinstance(node, ast.Import): - imports.extend(alias.name for alias in node.names) - elif isinstance(node, ast.ImportFrom) and node.module: - imports.append(node.module) - self.assertFalse( - any(name == "ucns" or name.startswith("ucns.") for name in imports) - ) - self.assertFalse( - any(name == "pcea" or name.startswith("pcea.") for name in imports) - ) - - def test_omitted_operations_rerun_same_B_and_unequal_B_comparisons(self) -> None: - effects = self.report["omitted_operation_effects"] - self.assertEqual(len(effects), 13) - for effect in effects.values(): - self.assertEqual(len(effect["same_B_collision_group_results"]), 6) - self.assertEqual(effect["unequal_B_comparison_count"], 332) - - topology = effects["topology_structure_readout"] - self.assertEqual(topology["same_B_distinguished_pair_count"], 1) - self.assertEqual(topology["augmented_class_count"], 17) - - charged = effects["charged_structure_readout"] - self.assertEqual(charged["same_B_distinguished_pair_count"], 6) - self.assertEqual(charged["augmented_class_count"], 21) - - def test_omitted_existing_observables_refine_the_quotient_partition(self) -> None: - combined = self.report["combined_omitted_observable_effect"] - self.assertEqual(combined["baseline_class_count"], 16) - self.assertEqual(combined["combined_augmented_class_count"], 21) - self.assertTrue(combined["quotient_partition_changes"]) - - omitted = self.report["omitted_distinguishing_operations"] - self.assertIn( - "epac_dimensional_arity.topology_structure_readout", - omitted, - ) - self.assertIn( - "epac_dimensional_arity.charged_structure_readout", - omitted, - ) - self.assertIn( - "epac_dimensional_arity.quaternion_structure_readout", - omitted, - ) - - def test_probe_completeness_is_falsified_not_unresolved(self) -> None: - self.assertEqual( - self.report["statuses"], - { - "declared_operation_inventory": SURVIVED, - "ambiguous_boundary_semantics": SURVIVED, - "omitted_boundary_relevant_operations": FALSIFIED, - "quotient_partition_stability_under_omitted_existing_observables": FALSIFIED, - "boundary_probe_completeness": FALSIFIED, - }, - ) - self.assertIn( - "B is not complete for the full presently declared EPAC operational surface", - self.report["requires_more"], - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_cross_scale_compositional_closure.py b/research/epac/tests/test_cross_scale_compositional_closure.py deleted file mode 100644 index 3d4e55e..0000000 --- a/research/epac/tests/test_cross_scale_compositional_closure.py +++ /dev/null @@ -1,191 +0,0 @@ -"""Executable witnesses for EPAC cross-scale boundary-capacity closure.""" - -# === CHECKS === -# id: check_cross_scale_required_elements_are_locked_formula_inputs -# proves: cross_scale_required_elements_are_locked_formula_inputs -# call: self::test_required_elements_are_exactly_the_locked_formula_inputs -# mutates: none -# cleanup: none -# -# id: check_subatomic_to_element_boundary_refines_shell_axes -# proves: subatomic_to_element_boundary_refines_shell_axes -# call: self::test_subatomic_to_element_derivation_matches_bare_elements -# mutates: none -# cleanup: none -# -# id: check_cross_scale_element_refinement_is_path_independent -# proves: cross_scale_element_refinement_is_path_independent -# call: self::test_element_refinement_is_path_independent -# mutates: none -# cleanup: none -# -# id: check_cross_scale_formula_closure_replays_from_subatomic_sources -# proves: cross_scale_formula_closure_replays_from_subatomic_sources -# call: self::test_all_formulas_close_end_to_end_from_subatomic_sources -# mutates: none -# cleanup: none -# -# id: check_subatomic_lifted_spiral_control_failure_is_classified -# proves: subatomic_lifted_spiral_control_failure_is_classified -# call: self::test_control_like_partition_failure_is_not_a_counterexample -# mutates: none -# cleanup: none -# -# id: check_cross_scale_promotion_blocks_descriptor_injection -# proves: cross_scale_promotion_blocks_descriptor_injection -# call: self::test_tampered_source_breaks_derivation_instead_of_passing_by_count -# mutates: none -# cleanup: none -# === END CHECKS === - -from __future__ import annotations - -from dataclasses import replace -import inspect -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(EPAC_ROOT / "subatomic")) -sys.path.insert(0, str(STACK_ROOT / "libs" / "ucns" / "src")) - -from epac_cross_scale_closure import ( - SURVIVED, - control_like_partition_failure_disposition, - cross_scale_compositional_closure, - derive_element_boundary_from_subatomic, - element_closure_ledger, - formula_closure_ledger, - required_element_symbols, -) -from epac_molecular import MOLECULE_COMPOSITIONS -from epac_periodic import construct_element_gonol, lifted_spiral_carried_on_element -from subatomic_gonol import construct_subatomic_gonol - - -class CrossScaleCompositionalClosureTest(unittest.TestCase): - def test_required_elements_are_exactly_the_locked_formula_inputs(self) -> None: - self.assertEqual( - tuple(MOLECULE_COMPOSITIONS), - ("H2", "H2O", "NH3", "CH4", "CO2", "H2S", "BF3", "PH3", "SiH4"), - ) - self.assertEqual( - required_element_symbols(), - ("H", "O", "N", "C", "S", "B", "F", "P", "Si"), - ) - - def test_subatomic_to_element_derivation_matches_bare_elements(self) -> None: - source = inspect.getsource(derive_element_boundary_from_subatomic) - self.assertNotIn("construct_element_gonol", source) - self.assertEqual( - tuple(inspect.signature(derive_element_boundary_from_subatomic).parameters), - ("receipt",), - ) - - for symbol in required_element_symbols(): - ledger = element_closure_ledger(symbol) - self.assertEqual(ledger["status"], SURVIVED, symbol) - self.assertFalse(ledger["local_operation"]["uses_future_molecule"], symbol) - self.assertFalse(ledger["local_operation"]["uses_target_descriptor"], symbol) - self.assertFalse(ledger["local_operation"]["descriptor_injected"], symbol) - self.assertEqual( - ledger["derived_element"]["boundary_capacity"], - ledger["bare_element"]["boundary_capacity"], - symbol, - ) - self.assertEqual( - ledger["derived_element"]["lifted_spiral"], - ledger["bare_element"]["lifted_spiral"], - symbol, - ) - self.assertTrue( - all(ledger["compatibility"]["common_field_matches"].values()), - symbol, - ) - self.assertTrue(ledger["compatibility"]["harmonic_survival_matches"], symbol) - - def test_element_refinement_is_path_independent(self) -> None: - for symbol in required_element_symbols(): - ledger = element_closure_ledger(symbol) - path = ledger["path_independence"] - self.assertEqual(len(path["admissible_variants"]), 4, symbol) - self.assertTrue(path["path_independent"], symbol) - self.assertEqual(len(set(path["variant_axes"].values())), 1, symbol) - - def test_all_formulas_close_end_to_end_from_subatomic_sources(self) -> None: - report = cross_scale_compositional_closure() - self.assertEqual( - report["statuses"], - { - "subatomic_to_element_closure": SURVIVED, - "element_state_compatibility": SURVIVED, - "end_to_end_subatomic_to_molecule_closure": SURVIVED, - "boundary_capacity_compositionality": SURVIVED, - }, - ) - - for formula in MOLECULE_COMPOSITIONS: - ledger = formula_closure_ledger(formula) - self.assertEqual(ledger["status"], SURVIVED, formula) - self.assertTrue( - ledger["paths"]["consumes_only_compatible_elements"], - formula, - ) - self.assertTrue(ledger["paths"]["path_independent"], formula) - self.assertTrue(ledger["paths"]["local_steps_reproducible"], formula) - self.assertTrue(ledger["direct_composed_agreement"], formula) - self.assertEqual( - ledger["composed_boundary_capacity"], - ledger["direct_boundary_capacity"], - formula, - ) - self.assertTrue( - ledger["molecule_projection"]["projected_axes_match_direct"], - formula, - ) - self.assertFalse( - ledger["molecule_projection"]["uses_future_molecule_descriptor"], - formula, - ) - self.assertFalse(ledger["molecule_projection"]["descriptor_injected"], formula) - - def test_control_like_partition_failure_is_not_a_counterexample(self) -> None: - disposition = control_like_partition_failure_disposition() - self.assertTrue( - disposition["observed_subatomic_lifted_spiral_matches_control"] - ) - self.assertEqual( - disposition["classification"], - "stale_or_incorrect_control_assertion", - ) - self.assertFalse(disposition["compositional_counterexample"]) - self.assertEqual(disposition["status"], SURVIVED) - - def test_tampered_source_breaks_derivation_instead_of_passing_by_count(self) -> None: - receipt = construct_subatomic_gonol("C") - participants = list(receipt.gonol.participants) - first_shell_index = next( - index - for index, participant in enumerate(participants) - if participant.relation == "epac.atomic.shell" - ) - shell = participants[first_shell_index] - tampered_shell = replace(shell, participants=shell.participants[:-1]) - participants[first_shell_index] = tampered_shell - tampered_receipt = replace( - receipt, - gonol=replace(receipt.gonol, participants=tuple(participants)), - ) - - derived = derive_element_boundary_from_subatomic(tampered_receipt) - bare = lifted_spiral_carried_on_element(construct_element_gonol("C")) - - self.assertNotEqual(derived["derived_lifted_spiral"][1], bare[1]) - self.assertNotEqual(derived["derived_boundary_capacity"], (3, len(bare[1]), 0)) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_epac_arity.py b/research/epac/tests/test_epac_arity.py deleted file mode 100644 index b10cac6..0000000 --- a/research/epac/tests/test_epac_arity.py +++ /dev/null @@ -1,259 +0,0 @@ -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -sys.path.insert(0, str(EPAC_ROOT)) - -from epac_dimensional_arity import ( - CouplingProof, - DimensionalArityError, - QUATERNION_REPRESENTATION_DIMENSION, - QUATERNION_SCALAR_AXIS, - REPRESENTED_STRUCTURE_DIMENSION, - charged_structure_readout, - coupling, - degree_relations, - geometry_from_declared_couplings, - has_declared_coupling, - install_proven_coupling, - instances_missing_oriented_hub_coupling, - local_three_structures, - observed_common_ids, - oriented_instance_couplings, - quaternion_structure_readout, - require_every_instance_has_oriented_hub_coupling, - space, - topology_structure_readout, -) - - -class DimensionalArityTest(unittest.TestCase): - def test_unary_in_one_ambient_dimension(self) -> None: - declared = space(["x"], [["x"]]) - geometry = geometry_from_declared_couplings(declared) - self.assertEqual(geometry["ambient_count"], 1) - self.assertEqual(geometry["couplings"][0]["declared_ids"], ("x",)) - self.assertEqual(geometry["couplings"][0]["arity"], 1) - self.assertEqual(geometry["degree_relations"][0]["degree"], 1) - - def test_zx_is_not_xz(self) -> None: - declared = space(["x", "z"], [["z", "x"]], charges={"x": 1, "z": 8}) - self.assertTrue(has_declared_coupling(declared, ["z", "x"])) - self.assertFalse(has_declared_coupling(declared, ["x", "z"])) - with self.assertRaisesRegex(DimensionalArityError, "ordered declaration sequence"): - has_declared_coupling(declared, "zx") - self.assertNotEqual(coupling(["z", "x"]), coupling(["x", "z"])) - self.assertNotEqual(declared.couplings[0].charge_state, coupling(["x", "z"], {"x": 1, "z": 8}).charge_state) - geometry = geometry_from_declared_couplings(declared) - self.assertFalse(geometry["zx_equals_xz"]) - self.assertEqual(geometry["couplings"][0]["slot_charges"], (8, 1)) - z_degree = next(item for item in geometry["degree_relations"] if item["dimension"] == "z") - x_degree = next(item for item in geometry["degree_relations"] if item["dimension"] == "x") - self.assertEqual(z_degree["slot_degrees"], ((0, 1),)) - self.assertEqual(x_degree["slot_degrees"], ((1, 1),)) - - def test_xz_and_yz_do_not_give_xyz_without_proof(self) -> None: - declared = space(["x", "y", "z"], [["x", "z"], ["y", "z"]], charges={"x": 1, "y": 1, "z": 8}) - geometry = geometry_from_declared_couplings(declared) - self.assertEqual(tuple(item.arity for item in declared.couplings), (2, 2)) - self.assertFalse(has_declared_coupling(declared, ["x", "y", "z"])) - self.assertFalse(has_declared_coupling(declared, ["x", "y"])) - self.assertFalse(geometry["inferred_higher_arity_from_overlap"]) - self.assertEqual(geometry["structure"]["participating_dimension_count"], 3) - self.assertFalse(geometry["structure"]["ternary_coupling_declared"]) - self.assertFalse(geometry["structure"]["inferred_cartesian_embedding"]) - self.assertEqual( - geometry["structure"]["parts"], - ( - {"coupling": ("x", "z"), "arity": 2, "charge_state": ((1, 8), 1)}, - {"coupling": ("y", "z"), "arity": 2, "charge_state": ((1, 8), 1)}, - ), - ) - self.assertEqual(geometry["couplings"][0]["charge_state"], ((1, 8), 1)) - self.assertEqual(geometry["couplings"][1]["charge_state"], ((1, 8), 1)) - common = geometry["observed_common_ids"] - self.assertEqual(len(common), 1) - self.assertEqual(common[0]["common_ids"], ("z",)) - self.assertFalse(common[0]["proof_of_higher_arity"]) - degrees = {item["dimension"]: item["degree"] for item in geometry["degree_relations"]} - self.assertEqual(degrees["z"], 2) - self.assertEqual(degrees["x"], 1) - self.assertEqual(degrees["y"], 1) - z_slots = next(item for item in geometry["degree_relations"] if item["dimension"] == "z") - self.assertEqual(z_slots["slot_degrees"], ((1, 2),)) - hub_first = geometry_from_declared_couplings( - space(["z", "x", "y"], [["z", "x"], ["z", "y"]], charges={"z": 8, "x": 1, "y": 1}) - ) - other_charges = geometry_from_declared_couplings( - space(["z", "x", "y"], [["z", "x"], ["z", "y"]], charges={"z": 6, "x": 8, "y": 8}) - ) - self.assertEqual( - topology_structure_readout(hub_first["structure"]), - topology_structure_readout(other_charges["structure"]), - ) - self.assertNotEqual( - charged_structure_readout(hub_first["structure"]), - charged_structure_readout(other_charges["structure"]), - ) - - def test_every_instance_has_its_own_zx_and_zy(self) -> None: - declared = space(["z", "x0", "x1", "y0"], [["z", "x0"], ["z", "x1"], ["z", "y0"]]) - self.assertEqual( - oriented_instance_couplings(declared, hub_id="z", instance_ids=["x0", "x1", "y0"]), - (("z", "x0"), ("z", "x1"), ("z", "y0")), - ) - only_one_x = space(["z", "x0", "x1", "y0"], [["z", "x0"], ["z", "y0"]]) - self.assertEqual( - instances_missing_oriented_hub_coupling( - only_one_x, hub_id="z", instance_ids=["x0", "x1", "y0"] - ), - ("x1",), - ) - reversed_slot = space(["z", "x0", "y0"], [["x0", "z"], ["y0", "z"]]) - with self.assertRaisesRegex(DimensionalArityError, "every instance must have declared"): - require_every_instance_has_oriented_hub_coupling( - reversed_slot, hub_id="z", instance_ids=["x0", "y0"] - ) - with self.assertRaisesRegex(DimensionalArityError, "repeated"): - require_every_instance_has_oriented_hub_coupling( - declared, hub_id="z", instance_ids=["x0", "x0"] - ) - - def test_overlap_is_not_an_installable_proof(self) -> None: - declared = space(["x", "y", "z"], [["x", "z"], ["y", "z"]]) - with self.assertRaisesRegex(DimensionalArityError, "not a proof"): - CouplingProof( - conclusion=coupling(["x", "y", "z"]), - premises=(coupling(["x", "z"]), coupling(["y", "z"])), - rule_id="overlap-closure", - ) - with self.assertRaisesRegex(DimensionalArityError, "not a proof"): - CouplingProof( - conclusion=coupling(["x", "y", "z"]), - premises=(coupling(["x", "z"]), coupling(["y", "z"])), - rule_id="hamilton-product-closure", - ) - self.assertFalse(has_declared_coupling(declared, ["x", "y", "z"])) - - def test_explicit_proof_can_install_higher_arity(self) -> None: - declared = space(["x", "y", "z"], [["x", "z"], ["y", "z"]]) - proof = CouplingProof( - conclusion=coupling(["x", "y", "z"]), - premises=(coupling(["x", "z"]), coupling(["y", "z"])), - rule_id="caller-supplied-certificate", - ) - proven = install_proven_coupling(declared, proof) - self.assertFalse(has_declared_coupling(declared, ["x", "y", "z"])) - self.assertTrue(has_declared_coupling(proven, ["x", "y", "z"])) - self.assertEqual(proven.couplings[-1].arity, 3) - - def test_space_rejects_proof_conclusion_that_is_not_declared(self) -> None: - proof = CouplingProof( - conclusion=coupling(["x", "y", "z"]), - premises=(coupling(["x", "z"]),), - rule_id="caller-supplied-certificate", - ) - with self.assertRaisesRegex(DimensionalArityError, "conclusion .* is not declared"): - space(["x", "y", "z"], [["x", "z"]], proofs=(proof,)) - - def test_zx_and_zy_degree_has_z_in_slot_zero_twice(self) -> None: - declared = space(["x", "y", "z"], [["z", "x"], ["z", "y"]]) - degrees = {item.dimension.id: item for item in degree_relations(declared)} - self.assertEqual(degrees["z"].degree, 2) - self.assertEqual(degrees["z"].slot_degrees, ((0, 2),)) - self.assertEqual(degrees["x"].degree, 1) - self.assertEqual(degrees["y"].degree, 1) - self.assertFalse(has_declared_coupling(declared, ["x", "y"])) - self.assertFalse(has_declared_coupling(declared, ["x", "y", "z"])) - - def test_ambient_size_does_not_infer_couplings(self) -> None: - declared = space(["d1", "d2", "d3", "d4", "d5"], []) - geometry = geometry_from_declared_couplings(declared) - self.assertEqual(geometry["couplings"], ()) - self.assertEqual({item["degree"] for item in geometry["degree_relations"]}, {0}) - - def test_arity_five_in_seven_dimensions(self) -> None: - ambient = [f"d{i}" for i in range(1, 8)] - declared = space(ambient, [["d1", "d2", "d3", "d4", "d5"]]) - self.assertEqual(declared.couplings[0].arity, 5) - degrees = degree_relations(declared) - used = {item.dimension.id: item.degree for item in degrees if item.degree} - unused = {item.dimension.id for item in degrees if item.degree == 0} - self.assertEqual(set(used), {"d1", "d2", "d3", "d4", "d5"}) - self.assertEqual(unused, {"d6", "d7"}) - - def test_mixed_arities_in_one_ambient_space(self) -> None: - declared = space( - ["d1", "d2", "d3", "d4"], - [["d1"], ["d2", "d3"], ["d1", "d2", "d3", "d4"]], - ) - self.assertEqual(tuple(item.arity for item in declared.couplings), (1, 2, 4)) - degrees = {item.dimension.id: item.degree for item in degree_relations(declared)} - self.assertEqual(degrees["d1"], 2) - self.assertEqual(degrees["d4"], 1) - - def test_coupling_must_be_subset_of_ambient(self) -> None: - with self.assertRaisesRegex(DimensionalArityError, "undeclared dimensions"): - space(["d1"], [["d1", "d2"]]) - - def test_coupling_cannot_repeat_a_dimension(self) -> None: - with self.assertRaisesRegex(DimensionalArityError, "cannot repeat"): - coupling(["d1", "d1"]) - - def test_common_ids_are_not_a_coupling(self) -> None: - xz = coupling(["x", "z"]) - yz = coupling(["y", "z"]) - self.assertEqual(observed_common_ids(xz, yz), frozenset({"z"})) - self.assertNotEqual(xz, yz) - - def test_four_dimensions_represent_each_local_three(self) -> None: - declared = space( - ["z", "x", "y"], - [["z", "x"], ["z", "y"]], - charges={"z": 8, "x": 1, "y": 1}, - ) - geometry = geometry_from_declared_couplings(declared) - structure = geometry["structure"] - self.assertEqual(structure["participating_dimension_count"], 3) - self.assertEqual(structure["representation_dimension"], QUATERNION_REPRESENTATION_DIMENSION) - self.assertEqual(structure["represented_structure_dimension"], REPRESENTED_STRUCTURE_DIMENSION) - self.assertEqual(structure["representation_kind"], "quaternion") - self.assertEqual(local_three_structures(declared), (("z", "x", "y"),)) - self.assertEqual(len(structure["quaternions"]), 1) - quaternion = structure["quaternions"][0] - self.assertEqual(quaternion["components"], (1, 8, 1, 1)) - self.assertEqual(len(quaternion["components"]), 4) - self.assertEqual(len(quaternion["represented_ids"]), 3) - self.assertEqual(quaternion["axes"][0], QUATERNION_SCALAR_AXIS) - self.assertNotIn(QUATERNION_SCALAR_AXIS, geometry["ambient_ids"]) - self.assertFalse(quaternion["hamilton_product_is_coupling_proof"]) - self.assertFalse(quaternion["scalar_axis_is_ambient"]) - self.assertFalse(has_declared_coupling(declared, ["x", "y", "z"])) - self.assertEqual( - quaternion_structure_readout(structure), - (((1, 8, 1, 1), ("z", "x", "y")),), - ) - two_only = geometry_from_declared_couplings(space(["z", "x"], [["z", "x"]], charges={"z": 1, "x": 1})) - self.assertEqual(two_only["structure"]["participating_dimension_count"], 2) - self.assertEqual(two_only["structure"]["representation_dimension"], 4) - self.assertEqual(two_only["structure"]["quaternions"], ()) - - def test_mixed_charged_and_uncharged_readout_is_stable(self) -> None: - geometry = geometry_from_declared_couplings( - space(["charged", "plain"], [["charged"], ["plain"]], charges={"charged": 1}) - ) - readout = charged_structure_readout(geometry["structure"]) - self.assertEqual( - readout[0], - ( - (1, ((None,), 1), ("plain",)), - (1, ((1,), 1), ("charged",)), - ), - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_epac_public_gonol.py b/research/epac/tests/test_epac_public_gonol.py deleted file mode 100644 index c0fc6cb..0000000 --- a/research/epac/tests/test_epac_public_gonol.py +++ /dev/null @@ -1,144 +0,0 @@ -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(STACK_ROOT / "research" / "ucns" / "src")) - -from epac_dimensional_arity import space, geometry_from_declared_couplings -from epac_public_gonol import ( - CONSTRUCTOR_ID, - PINNED_PUBLIC_GONOL_SHA256, - PublicGonolConstructionError, - construct_public_gonol, - replay_public_gonol, -) -from ucns import PUBLIC_GONOL_SHA256, native_mobius_state, public_gonol_function - - -class EpacPublicGonolTest(unittest.TestCase): - def test_constructor_is_not_edcm(self) -> None: - receipt = construct_public_gonol( - source_id="epac.test:O", - relation="epac.atomic.element", - identity_glyph="O", - carried_options=(("symbol", "O"), ("Z", "8")), - ) - self.assertEqual(receipt.constructor_id, CONSTRUCTOR_ID) - self.assertEqual(CONSTRUCTOR_ID, "epac.public_gonol") - self.assertEqual(receipt.gonol.identity_glyph, "O") - self.assertEqual(receipt.gonol.carrier_index, public_gonol_function("O").index) - self.assertEqual(PINNED_PUBLIC_GONOL_SHA256, PUBLIC_GONOL_SHA256) - for name in ("epac_public_gonol.py", "epac_periodic.py", "epac_molecular.py"): - source = (EPAC_ROOT / name).read_text(encoding="utf-8") - self.assertNotIn("from edcm", source, name) - self.assertNotIn("import edcm", source, name) - - def test_two_letter_symbol_has_no_single_glyph(self) -> None: - receipt = construct_public_gonol( - source_id="epac.test:He", - relation="epac.atomic.element", - carried_options=(("symbol", "He"), ("Z", "2")), - ) - self.assertIsNone(receipt.gonol.identity_glyph) - self.assertIsNone(receipt.gonol.carrier_index) - - def test_replay_matches(self) -> None: - first = construct_public_gonol( - source_id="epac.test:H", - relation="epac.atomic.element", - identity_glyph="H", - carried_options=(("symbol", "H"), ("Z", "1")), - ) - second = replay_public_gonol(first) - self.assertEqual(first.receipt_digest, second.receipt_digest) - - def test_charged_couplings_are_the_structure(self) -> None: - declared = space( - ["z", "x", "y"], - [["z", "x"], ["z", "y"]], - charges={"z": 8, "x": 1, "y": 1}, - ) - geometry = geometry_from_declared_couplings(declared) - receipt = construct_public_gonol( - source_id="epac.test:H2O-structure", - relation="epac.affixiation.unpaired-valence", - couplings=geometry["couplings"], - structure=geometry["structure"], - ) - self.assertEqual(receipt.structure["participating_dimension_count"], 3) - self.assertFalse(receipt.structure["ternary_coupling_declared"]) - self.assertFalse(receipt.structure["inferred_cartesian_embedding"]) - self.assertEqual( - [part["charge_state"] for part in receipt.structure["parts"]], - [((8, 1), 1), ((8, 1), 1)], - ) - self.assertEqual(native_mobius_state(0).frame.sign, 1) - - def test_nested_geometry_is_frozen_after_closure(self) -> None: - declared = space( - ["z", "x"], - [["z", "x"]], - charges={"z": 8, "x": 1}, - ) - geometry = geometry_from_declared_couplings(declared) - receipt = construct_public_gonol( - source_id="epac.test:frozen-structure", - relation="epac.affixiation.unpaired-valence", - couplings=geometry["couplings"], - structure=geometry["structure"], - ) - geometry["structure"]["parts"][0]["charge_state"] = ((999, 1), 1) - self.assertEqual(receipt.structure["parts"][0]["charge_state"], ((8, 1), 1)) - with self.assertRaises(TypeError): - receipt.structure["parts"][0]["charge_state"] = ((999, 1), 1) - with self.assertRaises(AttributeError): - receipt.structure["parts"].append({}) - self.assertEqual(replay_public_gonol(receipt).receipt_digest, receipt.receipt_digest) - - def test_structure_must_match_declared_couplings(self) -> None: - declared = space( - ["z", "x"], - [["z", "x"]], - charges={"z": 8, "x": 1}, - ) - geometry = geometry_from_declared_couplings(declared) - bad_structure = { - **geometry["structure"], - "parts": ( - { - "coupling": ("z", "x"), - "arity": 2, - "charge_state": ((8, 99), 1), - }, - ), - } - with self.assertRaisesRegex(PublicGonolConstructionError, "structure must match"): - construct_public_gonol( - source_id="epac.test:bad-structure", - relation="epac.affixiation.unpaired-valence", - couplings=geometry["couplings"], - structure=bad_structure, - ) - with self.assertRaisesRegex(PublicGonolConstructionError, "supplied together"): - construct_public_gonol( - source_id="epac.test:missing-structure", - relation="epac.affixiation.unpaired-valence", - couplings=geometry["couplings"], - ) - - def test_unknown_glyph_fails_closed(self) -> None: - with self.assertRaises(PublicGonolConstructionError): - construct_public_gonol( - source_id="epac.test:bad", - relation="epac.atomic.element", - identity_glyph="He", - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_geometry_comparison_after_construction.py b/research/epac/tests/test_geometry_comparison_after_construction.py deleted file mode 100644 index 72aedd3..0000000 --- a/research/epac/tests/test_geometry_comparison_after_construction.py +++ /dev/null @@ -1,1055 +0,0 @@ -from __future__ import annotations - -import json -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(STACK_ROOT / "research" / "ucns" / "src")) - -from epac_comparison import ( - ORIGINAL_PREREG, - _harmonic_survival_signature, - _per_symbol_harmonic_survival_from_molecule, - _periodic_element_harmonic_survival_signature, - _subatomic_harmonic_survival_signature, - compare_after_construction, - construction_sources_omit_sealed_labels, -) -from epac_dimensional_arity import charged_structure_readout, topology_structure_readout -from epac_molecular import ( - MOLECULE_COMPOSITIONS, - boundary_capacity_carried_on_molecule, - boundary_capacity_descriptor_sufficiency_sweep, - boundary_capacity_information_loss_localization, - boundary_capacity_minimal_refinement_audit, - boundary_capacity_quotient_test, - epac_probe_relativity_formalization, - epac_representation_audit, - compositional_boundary_closure, - construct_declared_molecules, - harmonic_survival_carried_on_molecule, - lifted_spiral_carried_on_molecule, - matched_information_control, - per_symbol_harmonic_survival_carried_on_molecule, - replay_molecule, -) -from epac_periodic import construct_element_gonol -from epac_public_gonol import replay_public_gonol - - -SEALED = EPAC_ROOT / "data" / "sealed_known_molecular_geometry.json" - - -class GeometryComparisonAfterConstructionTest(unittest.TestCase): - def test_construction_omits_sealed_shape_labels(self) -> None: - self.assertEqual(construction_sources_omit_sealed_labels(), ()) - - def test_charged_couplings_are_the_three_dimensional_structure(self) -> None: - constructions = construct_declared_molecules() - water = constructions["H2O"].receipt.structure - carbon_dioxide = constructions["CO2"].receipt.structure - self.assertIsNotNone(water) - self.assertIsNotNone(carbon_dioxide) - self.assertEqual(water["participating_dimension_count"], 3) - self.assertEqual(carbon_dioxide["participating_dimension_count"], 3) - self.assertFalse(water["ternary_coupling_declared"]) - self.assertEqual( - topology_structure_readout(water), - topology_structure_readout(carbon_dioxide), - ) - water_charged = charged_structure_readout(water) - co2_charged = charged_structure_readout(carbon_dioxide) - self.assertNotEqual(water_charged, co2_charged) - self.assertEqual( - water_charged[0], - ( - (2, ((8, 1), 1), ("O#2", "H#0")), - (2, ((8, 1), 1), ("O#2", "H#1")), - ), - ) - self.assertEqual( - co2_charged[0], - ( - (2, ((6, 8), 1), ("C#0", "O#1")), - (2, ((6, 8), 1), ("C#0", "O#2")), - ), - ) - - def test_sealed_shape_comparison_uses_charged_structure(self) -> None: - constructions = construct_declared_molecules() - # After deliberate enlargement of the experiment, more formulas are constructed. - # The frozen sealed-shape prediction logic only applies to the original preregistered set. - self.assertTrue(ORIGINAL_PREREG.issubset(set(constructions))) - self.assertGreaterEqual(len(constructions), 5) - - record = compare_after_construction() - sealed = json.loads(SEALED.read_text(encoding="utf-8"))["molecules"] - known_shapes = record["known_shapes"] - - self.assertTrue(record["opened_after_construction"]) - self.assertTrue(record["construction_omits_sealed_labels"]) - self.assertEqual(set(known_shapes.keys()), ORIGINAL_PREREG) - self.assertGreater(len(set(known_shapes.values())), 1) - self.assertEqual(known_shapes["H2O"], "bent") - self.assertEqual(known_shapes["CO2"], "linear") - self.assertEqual(known_shapes["H2"], "linear") - - self.assertTrue(record["topology_collapses_h2o_with_co2"]) - self.assertTrue(record["charged_distinguishes_h2o_from_co2"]) - self.assertTrue(record["linear_class_split_by_charged_structure"]) - - # Parallel facts for the carried nuclear harmonic survival (now a first-class - # invariant on every MolecularConstruction and surfaced in the record). - self.assertIn("harmonic_collapses_h2o_with_co2", record) - self.assertIn("harmonic_distinguishes_h2o_from_co2", record) - self.assertIn("linear_class_split_by_harmonic_survival", record) - self.assertFalse(record["harmonic_collapses_h2o_with_co2"]) - self.assertTrue(record["harmonic_distinguishes_h2o_from_co2"]) - self.assertTrue(record["linear_class_split_by_harmonic_survival"]) - - # Exact partition match facts for the harmonic family are now first-class - # top-level fields on the record (symmetric to the other harmonic facts). - self.assertIn("harmonic_matches_known", record) - self.assertIn("harmonic_matches_control", record) - self.assertFalse(record["harmonic_matches_known"]) - self.assertFalse(record["harmonic_matches_control"]) - - # Parallel top-level facts and exact match for the periodic element gonol view - # of the carried nuclear harmonic survival (now first-class, symmetric to the others). - self.assertIn("periodic_element_harmonic_collapses_h2o_with_co2", record) - self.assertIn("periodic_element_harmonic_distinguishes_h2o_from_co2", record) - self.assertIn("linear_class_split_by_periodic_element_harmonic_survival", record) - self.assertFalse(record["periodic_element_harmonic_collapses_h2o_with_co2"]) - self.assertTrue(record["periodic_element_harmonic_distinguishes_h2o_from_co2"]) - self.assertTrue(record["linear_class_split_by_periodic_element_harmonic_survival"]) - - self.assertIn("periodic_element_harmonic_matches_known", record) - self.assertIn("periodic_element_harmonic_matches_control", record) - self.assertFalse(record["periodic_element_harmonic_matches_known"]) - self.assertFalse(record["periodic_element_harmonic_matches_control"]) - - standings = record["standings"] - self.assertEqual(standings["charged_3_structure_as_sealed_shape_prediction"], "FALSIFIED") - self.assertEqual(standings["topology_3_structure_as_sealed_shape_prediction"], "FALSIFIED") - self.assertEqual(standings["ucns_mobius_as_sealed_shape_prediction"], "FALSIFIED") - self.assertEqual(standings["atomic_shells_as_sealed_shape_prediction"], "FALSIFIED") - self.assertEqual( - standings["periodic_element_harmonic_survival_as_sealed_shape_prediction"], - "FALSIFIED", - ) - - # Control is computed over all constructed molecules (original + enlarged set) - control = {f: matched_information_control(c.invariants) for f, c in constructions.items()} - self.assertNotEqual(control["H2O"], control["CO2"]) - # There are now more than 5 constructed molecules - self.assertGreater(len(set(control.values())), 4) - - def test_quantify_distinguishing_power_present_and_consistent(self) -> None: - record = compare_after_construction() - self.assertIn("quantify_distinguishing_power", record) - q = record["quantify_distinguishing_power"] - - # The *known* (sealed) side remains the original preregistered experiment. - self.assertEqual(q["class_counts"]["known_shapes"], 4) - - # The constructed set has been deliberately enlarged (original 5 + new molecules). - # We expect at least 9 constructed formulas in this step. - constructed_readout = record.get("readouts", {}).get("charged_3_structure", {}) - self.assertGreaterEqual(len(constructed_readout), 9) - - # Class counts for the full constructed set reflect the enlargement. - # Charged and control each produce one class per constructed formula (9). - # Topology is weaker and produces fewer classes (observed: 4 for the current enlarged set). - self.assertGreaterEqual(q["class_counts"]["charged_3_structure"], 9) - self.assertGreaterEqual(q["class_counts"]["stoichiometric_control"], 9) - # Topology count is smaller than the constructed count (by design). - self.assertLess(q["class_counts"]["topology_3_structure"], q["class_counts"]["charged_3_structure"]) - - # Splits and collapses are still evaluated *only against the known (sealed) 4 classes*. - # The original preregistered falsification behavior must be preserved. - self.assertEqual(q["splits_known_classes"]["charged_3_structure"], 1) - self.assertEqual(q["collapses_across_known_classes"]["charged_3_structure"], 0) - - self.assertEqual(q["splits_known_classes"]["topology_3_structure"], 1) - self.assertEqual(q["collapses_across_known_classes"]["topology_3_structure"], 1) - - # Pairwise contingency for the *known* side is still over the original 5 formulas. - charged_pw = q["pairwise_vs_known"]["charged_3_structure"] - self.assertEqual(charged_pw["total_pairs"], 10) # C(5,2) for the known set - self.assertEqual(charged_pw["fp"], 1) # splits the linear class - self.assertEqual(charged_pw["fn"], 0) # no collapse of known classes - - # Exact partition match vs the frozen known set remains false. - self.assertFalse(q["exact_partition_match"]["charged_matches_known"]) - - # The harmonic survival family (now carried on molecule gonols) is treated - # symmetrically for exact partition match. - self.assertFalse(q["exact_partition_match"]["harmonic_matches_known"]) - self.assertFalse(q["exact_partition_match"]["harmonic_matches_control"]) - - # Symmetric quantification numbers for the harmonic survival family - # (evaluated only against the frozen original 5 known shapes). - self.assertEqual(q["class_counts"]["harmonic_survival"], 4) - self.assertEqual(q["splits_known_classes"]["harmonic_survival"], 1) - self.assertEqual(q["collapses_across_known_classes"]["harmonic_survival"], 2) - - hpw = q["pairwise_vs_known"]["harmonic_survival"] - self.assertEqual(hpw["total_pairs"], 10) - self.assertEqual(hpw["fp"], 1) - self.assertEqual(hpw["fn"], 2) - - # The periodic element gonol view of harmonic survival is now treated - # symmetrically (first-class in quantify, standings, top-level facts). - self.assertEqual(q["class_counts"]["periodic_element_harmonic_survival"], 4) - self.assertEqual(q["splits_known_classes"]["periodic_element_harmonic_survival"], 1) - self.assertEqual(q["collapses_across_known_classes"]["periodic_element_harmonic_survival"], 2) - - pepw = q["pairwise_vs_known"]["periodic_element_harmonic_survival"] - self.assertEqual(pepw["total_pairs"], 10) - self.assertEqual(pepw["fp"], 1) - self.assertEqual(pepw["fn"], 2) - - self.assertFalse(q["exact_partition_match"]["periodic_element_harmonic_matches_known"]) - self.assertFalse(q["exact_partition_match"]["periodic_element_harmonic_matches_control"]) - - # The subatomic gonol view of the lifted spiral is now treated symmetrically - # (first-class carried fact, surfaced in quantify/readouts/partitions/standings). - self.assertIn("subatomic_lifted_spiral", q["class_counts"]) - self.assertIn("subatomic_lifted_spiral", q["splits_known_classes"]) - self.assertIn("subatomic_lifted_spiral", q["collapses_across_known_classes"]) - self.assertIn("subatomic_lifted_spiral", q["pairwise_vs_known"]) - self.assertFalse(q["exact_partition_match"]["subatomic_lifted_spiral_matches_known"]) - # On the current nine-formula surface the bare subatomic projection and - # stoichiometric control both partition into singletons. This is a - # partition-resemblance fact only, not boundary-capacity evidence. - self.assertTrue(q["exact_partition_match"]["subatomic_lifted_spiral_matches_control"]) - - # Boundary capacity (interior modes=3 vs boundary dimensionality and coupling capacity) - # is now a first-class family, sourced from the same carried lifted-spiral facts. - # Molecule view distinguishes on ORIGINAL_PREREG (boundary measure). - self.assertIn("boundary_capacity", q["class_counts"]) - self.assertIn("boundary_capacity", q["splits_known_classes"]) - self.assertIn("boundary_capacity", q["collapses_across_known_classes"]) - self.assertIn("boundary_capacity", q["pairwise_vs_known"]) - self.assertFalse(q["exact_partition_match"]["boundary_capacity_matches_known"]) - self.assertFalse(q["exact_partition_match"]["boundary_capacity_matches_control"]) - - # The bare (periodic element / subatomic) views are also quantified symmetrically. - self.assertIn("periodic_element_boundary_capacity", q["class_counts"]) - self.assertIn("subatomic_boundary_capacity", q["class_counts"]) - - def test_harmonic_survival_signature_present_and_falsifies_on_known(self) -> None: - # The nuclear harmonic layer (alpha-conjugate broadened) is now integrated - # as a signature family in the (already enlarged) molecular experiment. - record = compare_after_construction() - self.assertIn("harmonic_survival", record.get("readouts", {})) - self.assertIn("harmonic_survival", record.get("partitions", {})) - self.assertIn("harmonic_survival_as_sealed_shape_prediction", record.get("standings", {})) - - q = record["quantify_distinguishing_power"] - self.assertIn("harmonic_survival", q["class_counts"]) - self.assertIn("harmonic_survival", q["splits_known_classes"]) - self.assertIn("harmonic_survival", q["collapses_across_known_classes"]) - self.assertIn("harmonic_survival", q["pairwise_vs_known"]) - - # Full constructed set yields 4 distinct harmonic survival signatures. - self.assertEqual(q["class_counts"]["harmonic_survival"], 4) - - # Splits/collapses and pairwise are evaluated only against the frozen original 5. - # Observed: splits 1 known class, collapses 2 known classes; pairwise fp=1, fn=2. - self.assertEqual(q["splits_known_classes"]["harmonic_survival"], 1) - self.assertEqual(q["collapses_across_known_classes"]["harmonic_survival"], 2) - - hpw = q["pairwise_vs_known"]["harmonic_survival"] - self.assertEqual(hpw["total_pairs"], 10) - self.assertEqual(hpw["fp"], 1) - self.assertEqual(hpw["fn"], 2) - - # Standing on the frozen prereg is FALSIFIED (splits + collapses). - self.assertEqual( - record["standings"]["harmonic_survival_as_sealed_shape_prediction"], - "FALSIFIED", - ) - - # The harmonic signature function is deterministic and participant-driven. - # On the original prereg it produces 3 distinct signatures. - known_sigs = {_harmonic_survival_signature(f) for f in ORIGINAL_PREREG} - self.assertEqual(len(known_sigs), 3) - - # All constructed formulas have a defined (possibly empty) signature. - constructed_readout = record["readouts"]["harmonic_survival"] - self.assertGreaterEqual(len(constructed_readout), 9) - for f in constructed_readout: - self.assertIsInstance(_harmonic_survival_signature(f), tuple) - - def test_subatomic_harmonic_survival_matches_direct_and_is_quantified(self) -> None: - # The nuclear harmonic survival is carried inside subatomic gonols - # ("harmonic-surviving") and is now also exposed for the molecular experiment. - # A cross-check inside compare_after_construction enforces direct == via-subatomic. - record = compare_after_construction() - self.assertIn("subatomic_harmonic_survival", record.get("readouts", {})) - self.assertIn("subatomic_harmonic_survival", record.get("partitions", {})) - self.assertIn( - "subatomic_harmonic_survival_as_sealed_shape_prediction", - record.get("standings", {}), - ) - - q = record["quantify_distinguishing_power"] - self.assertIn("subatomic_harmonic_survival", q["class_counts"]) - self.assertIn("subatomic_harmonic_survival", q["splits_known_classes"]) - self.assertIn("subatomic_harmonic_survival", q["pairwise_vs_known"]) - - # Because of the enforced cross-check, subatomic numbers equal the direct harmonic numbers. - self.assertEqual( - q["class_counts"]["subatomic_harmonic_survival"], - q["class_counts"]["harmonic_survival"], - ) - self.assertEqual( - q["splits_known_classes"]["subatomic_harmonic_survival"], - q["splits_known_classes"]["harmonic_survival"], - ) - self.assertEqual( - q["pairwise_vs_known"]["subatomic_harmonic_survival"]["total_pairs"], - q["pairwise_vs_known"]["harmonic_survival"]["total_pairs"], - ) - - # Per-formula signatures match on the frozen known set (and therefore everywhere). - for f in ORIGINAL_PREREG: - self.assertEqual( - _harmonic_survival_signature(f), - _subatomic_harmonic_survival_signature(f), - ) - self.assertEqual( - _harmonic_survival_signature(f), - _periodic_element_harmonic_survival_signature(f), - ) - - # Constructed side has the surface populated for all 9. - self.assertGreaterEqual( - len(record["readouts"]["subatomic_harmonic_survival"]), 9 - ) - - def test_periodic_element_harmonic_survival_matches_direct_and_is_quantified(self) -> None: - # The nuclear harmonic survival is carried on native periodic element gonols - # ("harmonic-surviving") and is now also exposed for the molecular experiment. - # Cross-checks inside compare_after_construction enforce molecule == subatomic == periodic. - record = compare_after_construction() - self.assertIn("periodic_element_harmonic_survival", record.get("readouts", {})) - self.assertIn("periodic_element_harmonic_survival", record.get("partitions", {})) - self.assertIn( - "periodic_element_harmonic_survival_as_sealed_shape_prediction", - record.get("standings", {}), - ) - - q = record["quantify_distinguishing_power"] - self.assertIn("periodic_element_harmonic_survival", q["class_counts"]) - self.assertIn("periodic_element_harmonic_survival", q["splits_known_classes"]) - self.assertIn("periodic_element_harmonic_survival", q["pairwise_vs_known"]) - - # Because of the enforced cross-checks, periodic element numbers equal the other harmonic views. - self.assertEqual( - q["class_counts"]["periodic_element_harmonic_survival"], - q["class_counts"]["harmonic_survival"], - ) - self.assertEqual( - q["splits_known_classes"]["periodic_element_harmonic_survival"], - q["splits_known_classes"]["harmonic_survival"], - ) - self.assertEqual( - q["pairwise_vs_known"]["periodic_element_harmonic_survival"]["total_pairs"], - q["pairwise_vs_known"]["harmonic_survival"]["total_pairs"], - ) - - # Per-formula signatures match on the frozen known set (and therefore everywhere). - for f in ORIGINAL_PREREG: - self.assertEqual( - _harmonic_survival_signature(f), - _periodic_element_harmonic_survival_signature(f), - ) - - # Constructed side has the surface populated for all 9. - self.assertGreaterEqual( - len(record["readouts"]["periodic_element_harmonic_survival"]), 9 - ) - - def test_periodic_element_lifted_spiral_matches_direct_and_is_quantified(self) -> None: - # The lifted spiral (UCNS framed Möbius root-loop) is carried on native - # periodic element gonols ("lifted-spiral") and is now also exposed for - # the molecular experiment as a first-class family (parallel to harmonic). - record = compare_after_construction() - self.assertIn("periodic_element_lifted_spiral", record.get("readouts", {})) - self.assertIn("periodic_element_lifted_spiral", record.get("partitions", {})) - self.assertIn( - "periodic_element_lifted_spiral_as_sealed_shape_prediction", - record.get("standings", {}), - ) - - q = record["quantify_distinguishing_power"] - self.assertIn("periodic_element_lifted_spiral", q["class_counts"]) - self.assertIn("periodic_element_lifted_spiral", q["splits_known_classes"]) - self.assertIn("periodic_element_lifted_spiral", q["collapses_across_known_classes"]) - self.assertIn("periodic_element_lifted_spiral", q["pairwise_vs_known"]) - - # Full constructed set yields the surface for all 9. - self.assertGreaterEqual( - len(record["readouts"]["periodic_element_lifted_spiral"]), 9 - ) - - def test_subatomic_gonol_lifted_spiral_matches_direct_and_is_quantified(self) -> None: - # The lifted spiral (UCNS framed Möbius root-loop) is carried on subatomic - # gonols ("lifted-spiral") and is now also exposed for the molecular - # experiment as a first-class family (parallel to harmonic and the other - # lifted-spiral families). - record = compare_after_construction() - self.assertIn("subatomic_lifted_spiral", record.get("readouts", {})) - self.assertIn("subatomic_lifted_spiral", record.get("partitions", {})) - self.assertIn( - "subatomic_lifted_spiral_as_sealed_shape_prediction", - record.get("standings", {}), - ) - - q = record["quantify_distinguishing_power"] - self.assertIn("subatomic_lifted_spiral", q["class_counts"]) - self.assertIn("subatomic_lifted_spiral", q["splits_known_classes"]) - self.assertIn("subatomic_lifted_spiral", q["collapses_across_known_classes"]) - self.assertIn("subatomic_lifted_spiral", q["pairwise_vs_known"]) - - # Full constructed set yields the surface for all 9. - self.assertGreaterEqual( - len(record["readouts"]["subatomic_lifted_spiral"]), 9 - ) - - def test_molecule_gonol_carries_harmonic_survival(self) -> None: - # The nuclear harmonic survival is now carried on the closed molecule - # PublicGonol receipt (parallel to subatomic gonols), as the canonical - # carried fact at molecular scale. - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - carried = dict(c.receipt.gonol.carried_options) - self.assertIn("harmonic-surviving", carried) - # The carried value must be consistent with the invariant. - inv = c.invariants.get("harmonic_survival", ()) - carried_val = carried["harmonic-surviving"] - if carried_val == "none": - self.assertEqual(inv, ()) - else: - self.assertEqual(carried_val.split(","), list(inv)) - - def test_molecule_carried_harmonic_sourced_from_element_gonols(self) -> None: - # The carried "harmonic-surviving" on the molecule PublicGonol receipt - # (and the harmonic_survival invariant) must be computed from the - # "harmonic-surviving" carried options on the native periodic element - # gonols of its constituents (the primary EPAC construction path). - for formula, c in construct_declared_molecules().items(): - comp = MOLECULE_COMPOSITIONS.get(formula, ()) - expected: set[str] = set() - for sym, _cnt in comp: - eg = construct_element_gonol(sym) - hs = dict(eg.gonol.carried_options).get("harmonic-surviving", "none") - if hs and hs != "none": - expected.update(hs.split(",")) - expected_t = tuple(sorted(expected)) - - # Receipt carry - rec_carried = harmonic_survival_carried_on_molecule(c) - self.assertEqual(rec_carried, expected_t) - - # Invariant (authoritative molecule view) - self.assertEqual(c.invariants.get("harmonic_survival", ()), expected_t) - - def test_compare_harmonic_family_sourced_from_molecule_receipt(self) -> None: - # In the comparison record, the "harmonic_survival" family (used for - # partitions, standings, quantify, top-level facts) must be exactly the - # values carried on the molecule PublicGonol receipts. - constructions = construct_declared_molecules() - record = compare_after_construction() - for f, c in constructions.items(): - receipt_carried = list(harmonic_survival_carried_on_molecule(c)) - self.assertEqual(record["readouts"]["harmonic_survival"][f], receipt_carried) - # The value in the record must also equal the invariant on the construction. - self.assertEqual(record["readouts"]["harmonic_survival"][f], list(c.invariants.get("harmonic_survival", ()))) - - def test_molecule_gonol_harmonic_survival_preserved_under_replay(self) -> None: - # The carried "harmonic-surviving" on molecule PublicGonol receipts must - # survive exact replay (byte-replay determinism for the new carried fact). - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - carried_before = dict(c.receipt.gonol.carried_options).get("harmonic-surviving", "none") - replayed = replay_public_gonol(c.receipt) - carried_after = dict(replayed.gonol.carried_options).get("harmonic-surviving", "none") - self.assertEqual(carried_before, carried_after) - # The full receipt digest is stable under replay for these constructions. - self.assertEqual(replayed.receipt_digest, c.receipt.receipt_digest) - - def test_periodic_element_gonol_harmonic_survival_preserved_under_replay(self) -> None: - # The carried "harmonic-surviving" on periodic element gonol receipts must - # survive exact replay (byte-replay determinism), parallel to molecule and subatomic. - from epac_periodic import construct_element_gonol, replay_element_gonol - for symbol in ("H", "C", "O", "Si"): - receipt = construct_element_gonol(symbol) - carried_before = dict(receipt.gonol.carried_options).get("harmonic-surviving", "none") - replayed = replay_element_gonol(receipt) - carried_after = dict(replayed.gonol.carried_options).get("harmonic-surviving", "none") - self.assertEqual(carried_before, carried_after) - self.assertEqual(replayed.receipt_digest, receipt.receipt_digest) - - def test_per_symbol_harmonic_survival_present_in_readouts_partitions_and_standings(self) -> None: - # The per-symbol harmonic survival family (receipt-sourced, addressable per - # constituent symbol) is now treated as a first-class signature family. - record = compare_after_construction() - self.assertIn("per_symbol_harmonic_survival", record.get("readouts", {})) - self.assertIn("per_symbol_harmonic_survival", record.get("partitions", {})) - self.assertIn( - "per_symbol_harmonic_survival_as_sealed_shape_prediction", - record.get("standings", {}), - ) - - q = record["quantify_distinguishing_power"] - self.assertIn("per_symbol_harmonic_survival", q["class_counts"]) - self.assertIn("per_symbol_harmonic_survival", q["splits_known_classes"]) - self.assertIn("per_symbol_harmonic_survival", q["collapses_across_known_classes"]) - self.assertIn("per_symbol_harmonic_survival", q["pairwise_vs_known"]) - - # Full constructed set yields a defined class count for per-symbol. - self.assertGreaterEqual(q["class_counts"]["per_symbol_harmonic_survival"], 1) - - # Exact partition match facts for per-symbol harmonic. - # On the frozen known set, per-symbol happens to produce partitions that - # match the stoichiometric control exactly (observed behavior). - self.assertIn("per_symbol_harmonic_matches_known", record) - self.assertIn("per_symbol_harmonic_matches_control", record) - self.assertFalse(record["per_symbol_harmonic_matches_known"]) - self.assertTrue(record["per_symbol_harmonic_matches_control"]) - - # Top-level distinguishing facts exist and are populated. - self.assertIn("per_symbol_harmonic_collapses_h2o_with_co2", record) - self.assertIn("per_symbol_harmonic_distinguishes_h2o_from_co2", record) - self.assertIn("linear_class_split_by_per_symbol_harmonic_survival", record) - - def test_per_symbol_harmonic_survival_quantify_symmetric_to_other_harmonic_families(self) -> None: - record = compare_after_construction() - q = record["quantify_distinguishing_power"] - - # Class counts, splits, collapses, and pairwise are present and use the same - # frozen known set (5 formulas) as the other harmonic families. - self.assertIn("per_symbol_harmonic_survival", q["class_counts"]) - self.assertIn("per_symbol_harmonic_survival", q["splits_known_classes"]) - self.assertIn("per_symbol_harmonic_survival", q["collapses_across_known_classes"]) - - pepw = q["pairwise_vs_known"]["per_symbol_harmonic_survival"] - self.assertEqual(pepw["total_pairs"], 10) # C(5,2) over known prereg - - # Exact match flags for per-symbol: known is false (as for other harmonic families); - # control is true on this data (per-symbol partitions match the stoichiometric control on the frozen 5). - self.assertFalse(q["exact_partition_match"]["per_symbol_harmonic_matches_known"]) - self.assertTrue(q["exact_partition_match"]["per_symbol_harmonic_matches_control"]) - - def test_per_symbol_harmonic_survival_sourced_from_receipts_and_matches_element_gonols(self) -> None: - # The per-symbol family in readouts/quantify must be exactly the values carried - # on molecule receipts (single source of truth), and must equal the lift from - # participating native periodic element gonols. - constructions = construct_declared_molecules() - record = compare_after_construction() - for f, c in constructions.items(): - receipt_per_sym = per_symbol_harmonic_survival_carried_on_molecule(c) - self.assertEqual( - record["readouts"]["per_symbol_harmonic_survival"][f], - {s: list(vs) for s, vs in receipt_per_sym.items()}, - ) - # Compare helper must also match the receipt. - self.assertEqual( - _per_symbol_harmonic_survival_from_molecule(f), - receipt_per_sym, - ) - # Element-gonol lift must equal receipt carry. - comp = MOLECULE_COMPOSITIONS.get(f, ()) - elem_view: dict[str, tuple[str, ...]] = {} - for sym, _cnt in comp: - eg = construct_element_gonol(sym) - hs = dict(eg.gonol.carried_options).get("harmonic-surviving", "none") - elem_view[sym] = tuple(sorted(set(hs.split(",")))) if hs and hs != "none" else () - self.assertEqual(receipt_per_sym, elem_view) - - def test_per_symbol_harmonic_survival_preserved_under_molecule_replay(self) -> None: - # The per-symbol carried options ("-harmonic-surviving") must survive - # exact replay on molecule receipts. - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - before = dict(c.receipt.gonol.carried_options) - replayed = replay_public_gonol(c.receipt) - after = dict(replayed.gonol.carried_options) - # Collect per-symbol keys - per_sym_keys = [k for k in before if k.endswith("-harmonic-surviving")] - for k in per_sym_keys: - self.assertEqual(before.get(k, "none"), after.get(k, "none")) - self.assertEqual(replayed.receipt_digest, c.receipt.receipt_digest) - - def test_per_symbol_harmonic_survival_consistent_across_all_constructed(self) -> None: - # Every constructed molecule must have per-symbol entries for its constituents - # and the values must be subsets of the molecule-level harmonic-surviving. - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - per_sym = per_symbol_harmonic_survival_carried_on_molecule(c) - mol_level = set(harmonic_survival_carried_on_molecule(c)) - for sym, cands in per_sym.items(): - self.assertTrue(set(cands).issubset(mol_level) or not cands) - self.assertIn(sym, [s for s, _ in MOLECULE_COMPOSITIONS.get(formula, ())]) - - def test_lifted_spiral_is_first_class_family(self) -> None: - # The lifted spiral (UCNS framed Möbius root-loop) is now a first-class - # signature family exactly parallel to the harmonic families. - # All metrics respect ORIGINAL_PREREG for standings/quantify known side. - record = compare_after_construction() - self.assertIn("lifted_spiral", record.get("readouts", {})) - self.assertIn("lifted_spiral", record.get("partitions", {})) - self.assertIn("lifted_spiral_as_sealed_shape_prediction", record.get("standings", {})) - - # Top-level distinguishing facts (symmetric to other families). - self.assertIn("lifted_spiral_collapses_h2o_with_co2", record) - self.assertIn("lifted_spiral_distinguishes_h2o_from_co2", record) - self.assertIn("linear_class_split_by_lifted_spiral", record) - self.assertIn("lifted_spiral_matches_known", record) - self.assertIn("lifted_spiral_matches_control", record) - - q = record["quantify_distinguishing_power"] - self.assertIn("lifted_spiral", q["class_counts"]) - self.assertIn("lifted_spiral", q["splits_known_classes"]) - self.assertIn("lifted_spiral", q["collapses_across_known_classes"]) - self.assertIn("lifted_spiral", q["pairwise_vs_known"]) - self.assertIn("lifted_spiral_matches_known", q["exact_partition_match"]) - self.assertIn("lifted_spiral_matches_control", q["exact_partition_match"]) - - # Pairwise over the frozen known set (5 formulas) is always 10 pairs. - lpw = q["pairwise_vs_known"]["lifted_spiral"] - self.assertEqual(lpw["total_pairs"], 10) - - # Readout populated for the full constructed set (>=9 after enlargement). - self.assertGreaterEqual(len(record["readouts"]["lifted_spiral"]), 9) - - # On ORIGINAL_PREREG the spiral signature is defined and deterministic. - for f in ORIGINAL_PREREG: - self.assertIn(f, record["readouts"]["lifted_spiral"]) - sig = record["readouts"]["lifted_spiral"][f] - self.assertIsInstance(sig, list) - # canonical form (frames, axes, attach_count) as 3-tuple list - self.assertEqual(len(sig), 3) - - def test_molecule_gonol_carries_lifted_spiral(self) -> None: - # The lifted spiral (UCNS framed Möbius root-loop) is now carried on the - # closed molecule PublicGonol receipt as a first-class fact, parallel to - # the nuclear harmonic survival layer. - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - carried = dict(c.receipt.gonol.carried_options) - self.assertIn("lifted-spiral", carried) - # The carried value must be consistent with the invariant. - inv = c.invariants.get("lifted_spiral") - carried_val = carried["lifted-spiral"] - # carried_val is the string form; inv is the tuple form. - # They must represent the same canonical signature. - self.assertIsNotNone(inv) - # Basic structural check on carried string - self.assertIn(";", carried_val) - parts = carried_val.split(";") - self.assertEqual(len(parts), 3) - - def test_molecule_gonol_lifted_spiral_preserved_under_replay(self) -> None: - # The carried "lifted-spiral" on molecule PublicGonol receipts must - # survive exact replay (byte-replay determinism for the new carried fact), - # parallel to the harmonic-surviving carried options. - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - carried_before = dict(c.receipt.gonol.carried_options).get("lifted-spiral", "") - replayed = replay_public_gonol(c.receipt) - carried_after = dict(replayed.gonol.carried_options).get("lifted-spiral", "") - self.assertEqual(carried_before, carried_after) - # The full receipt digest is stable under replay. - self.assertEqual(replayed.receipt_digest, c.receipt.receipt_digest) - - def test_compare_lifted_spiral_family_sourced_from_molecule_receipt(self) -> None: - # In the comparison record, the "lifted_spiral" family (used for - # partitions, standings, quantify, top-level facts) must be exactly the - # values carried on the molecule PublicGonol receipts. - constructions = construct_declared_molecules() - record = compare_after_construction() - for f, c in constructions.items(): - receipt_carried = list(lifted_spiral_carried_on_molecule(c)) - self.assertEqual(record["readouts"]["lifted_spiral"][f], receipt_carried) - # The value in the record must also equal the invariant on the construction. - self.assertEqual(record["readouts"]["lifted_spiral"][f], list(c.invariants.get("lifted_spiral", ()))) - - def test_boundary_capacity_is_first_class_family(self) -> None: - # Boundary capacity (fixed interior mode count=3 vs boundary dimensionality - # and coupling capacity) is now a first-class signature family, derived - # purely from the carried lifted-spiral facts (no new geometry). - # Tests the principle: interior modes distinguished from boundary measure. - record = compare_after_construction() - self.assertIn("boundary_capacity", record.get("readouts", {})) - self.assertIn("boundary_capacity", record.get("partitions", {})) - self.assertIn("boundary_capacity_as_sealed_shape_prediction", record.get("standings", {})) - - # Top-level distinguishing facts. - self.assertIn("boundary_capacity_collapses_h2o_with_co2", record) - self.assertIn("boundary_capacity_distinguishes_h2o_from_co2", record) - self.assertIn("linear_class_split_by_boundary_capacity", record) - self.assertIn("boundary_capacity_matches_known", record) - self.assertIn("boundary_capacity_matches_control", record) - - q = record["quantify_distinguishing_power"] - self.assertIn("boundary_capacity", q["class_counts"]) - self.assertIn("boundary_capacity", q["splits_known_classes"]) - self.assertIn("boundary_capacity", q["collapses_across_known_classes"]) - self.assertIn("boundary_capacity", q["pairwise_vs_known"]) - self.assertIn("boundary_capacity_matches_known", q["exact_partition_match"]) - self.assertIn("boundary_capacity_matches_control", q["exact_partition_match"]) - - # Pairwise over the frozen known set (5 formulas) is always 10 pairs. - bc_pw = q["pairwise_vs_known"]["boundary_capacity"] - self.assertEqual(bc_pw["total_pairs"], 10) - - # Readout populated for the full constructed set. - self.assertGreaterEqual(len(record["readouts"]["boundary_capacity"]), 9) - - # On ORIGINAL_PREREG the molecule boundary capacity is defined and deterministic. - for f in ORIGINAL_PREREG: - self.assertIn(f, record["readouts"]["boundary_capacity"]) - bc = record["readouts"]["boundary_capacity"][f] - self.assertIsInstance(bc, list) - self.assertEqual(len(bc), 3) # (interior_modes, boundary_dim, coupling_capacity) - - def test_boundary_capacity_carried_on_molecule(self) -> None: - # The boundary capacity is a pure projection from the carried lifted-spiral - # on the molecule receipt. The dedicated carried accessor must agree. - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - bc = boundary_capacity_carried_on_molecule(c) - self.assertIsInstance(bc, (list, tuple)) - self.assertEqual(len(bc), 3) - self.assertEqual(bc[0], 3) # fixed interior modes for the canonical double cover - - def test_boundary_capacity_compositional_transition_closure(self) -> None: - # Compositional transition closure under strictly local affixation steps only. - # Each step contributes only its local information (introduce a named atom instance, - # or affix one ligand contribution whose slot count comes solely from that ligand's - # atomic record). No global target totals and no finished receipt or known labels - # are used to compute deltas. - # - # Tests: - # - path independence of final B across every valid ordering (introduces then affixes) - # - local step reproducibility (identical local step always yields identical delta) - # - accumulated B from local steps equals the direct carried B(R) - # - B is sufficient for these admissible local operations (no insufficiency observed) - # - # If this survives, B(R) functions as a closed transition variable for this construction class. - - closure = compositional_boundary_closure() - self.assertTrue(closure["all_formulas_exhibit_compositional_transition_closure"]) - - per = closure["per_formula"] - # All formulas on the declared set must satisfy the closure properties. - for f in MOLECULE_COMPOSITIONS: - r = per[f] - self.assertTrue(r["path_independent"], f"not path independent for {f}") - self.assertTrue(r["matches_direct"], f"does not match direct B for {f}") - self.assertTrue(r["local_steps_reproducible"], f"local steps not reproducible for {f}") - self.assertFalse(r["b_insufficient"], f"B insufficient for local op on {f}") - - # Explicit check on ORIGINAL_PREREG (the frozen evaluation set). - for f in ORIGINAL_PREREG: - self.assertIn(f, per) - r = per[f] - self.assertTrue(r["path_independent"]) - self.assertTrue(r["matches_direct"]) - self.assertTrue(r["local_steps_reproducible"]) - self.assertFalse(r["b_insufficient"]) - # At least one path must exist; for H2 there is exactly one (symmetric). - self.assertGreaterEqual(r["num_paths"], 1) - - def test_boundary_capacity_closure_via_comparison_record(self) -> None: - # The comparison record must surface the compositional closure facts - # (path independence, local reproducibility, match to direct, overall flag). - record = compare_after_construction() - self.assertIn("boundary_capacity_compositional_closure", record) - self.assertIn("boundary_capacity_compositional_path_independent", record) - self.assertIn("boundary_capacity_compositional_all_reproducible_locally", record) - - self.assertTrue(record["boundary_capacity_compositional_path_independent"]) - self.assertTrue(record["boundary_capacity_compositional_all_reproducible_locally"]) - - cl = record["boundary_capacity_compositional_closure"] - self.assertTrue(cl["all_formulas_exhibit_compositional_transition_closure"]) - - def test_boundary_capacity_descriptor_sufficiency_sweep_sealed(self) -> None: - # Exhaustive EPAC-local descriptor sufficiency / collision falsifier. - # Enumerates reachable states from declared sources and ops on the frozen nine. - # Computes B only from locked rules. Groups by B(R). Classifies collisions by - # operational equivalence under the replay/transition contract. No new coordinate. - # Bare and control views are included. Nine locked formulas untouched. - sweep = boundary_capacity_descriptor_sufficiency_sweep() - - self.assertTrue(sweep.get("sealed")) - self.assertTrue(sweep.get("no_new_coordinate")) - - # Question and scope are recorded. - self.assertIn("Does B(R)", sweep.get("question", "")) - self.assertIn("frozen nine", sweep.get("scope", "")) - - agg = sweep.get("aggregate", {}) - # Cross-scale element compatibility and end-to-end molecular closure remain SURVIVED. - self.assertEqual(agg.get("subatomic_to_element_closure"), "SURVIVED") - self.assertEqual(agg.get("end_to_end_subatomic_to_molecule_closure"), "SURVIVED") - # Sufficiency on the present descriptor is decided by collisions among non-equivalent states. - self.assertIn(agg.get("boundary_capacity_sufficiency"), ("SURVIVED", "FALSIFIED")) - - # Control-like partition failure is explicitly classified (not a B transition counterexample). - disp = sweep.get("control_failure_disposition", {}) - self.assertEqual(disp.get("classification"), "stale_or_incorrect_control_assertion") - self.assertFalse(disp.get("impacts_b_sufficiency")) - - # Collisions, when present, are classified SURVIVED (equivalent) or FALSIFIED (distinct states). - b_groups = sweep.get("b_groups", {}) - for c in sweep.get("collisions", []): - self.assertIn(c.get("classification"), ("SURVIVED", "FALSIFIED")) - self.assertIn(str(c.get("b")), b_groups) - - # Enumeration covers the locked nine molecules + their bare sources. - self.assertGreaterEqual(sweep.get("enumerated_b_states", 0), 9) - # No extension: every locked formula appears as a molecule: entry in the enumerated B groups. - b_group_values = " ".join(" ".join(v) for v in sweep.get("b_groups", {}).values()) - for f in MOLECULE_COMPOSITIONS: - self.assertIn(f"molecule:{f}", b_group_values) - - def test_boundary_capacity_sufficiency_via_comparison_record(self) -> None: - record = compare_after_construction() - self.assertIn("boundary_capacity_descriptor_sufficiency", record) - self.assertIn("boundary_capacity_sufficiency_status", record) - suff = record["boundary_capacity_descriptor_sufficiency"] - self.assertTrue(suff.get("sealed")) - self.assertTrue(suff.get("no_new_coordinate")) - self.assertIn(record["boundary_capacity_sufficiency_status"], ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - - def test_boundary_capacity_information_loss_localization_sealed(self) -> None: - # Information-loss localization over the six sealed B collisions. - # Uses only already-present EPAC operational data, records, invariants, - # participants, source/relation/digests. Identifies earliest step where - # states are distinguishable while B is identical, plus smallest witness. - # No new coordinate. Nine formulas frozen. - loc = boundary_capacity_information_loss_localization() - - self.assertTrue(loc.get("sealed")) - self.assertTrue(loc.get("no_new_coordinate")) - self.assertIn("Exactly which already-present", loc.get("question", "")) - self.assertIn("six sealed collision classes", loc.get("scope", "")) - - agg = loc.get("aggregate", {}) - self.assertEqual(agg.get("information_loss_localization"), "SURVIVED") - self.assertTrue(agg.get("all_collisions_have_explicit_witness")) - - # Every sealed colliding B must have explicit per-pair localization. - per = loc.get("per_collision", {}) - self.assertGreaterEqual(len(per), 1) - for bstr, entry in per.items(): - self.assertGreater(entry.get("num_pairs", 0), 0) - for p in entry.get("localizations", []): - self.assertIn("earliest_distinguishable_step_while_b_identical", p) - self.assertIn("first_point_of_information_loss", p) - self.assertIn("witness", p) - self.assertIn("witness_class", p) - self.assertNotEqual(p["witness_class"], "undetermined") - - # Recurring witness classes must be recorded (scale_identity_erased is expected across all). - rec = loc.get("recurring_witness_classes", {}) - self.assertIn("scale_identity_erased", rec) - - def test_information_loss_via_comparison_record(self) -> None: - record = compare_after_construction() - self.assertIn("boundary_capacity_information_loss", record) - self.assertIn("information_loss_localization_status", record) - loss = record["boundary_capacity_information_loss"] - self.assertTrue(loss.get("sealed")) - self.assertTrue(loss.get("no_new_coordinate")) - self.assertEqual(loss.get("aggregate", {}).get("information_loss_localization"), "SURVIVED") - self.assertIn(record["information_loss_localization_status"], ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - - def test_boundary_capacity_quotient_test_sealed(self) -> None: - # Boundary-capacity quotient test over the six sealed collisions. - # B(R1) == B(R2) ⇔ R1 ≡∂ R2 under admissible boundary probes - # (B readout, attachment K, attachment profile, transition deltas), - # with all identifiers/labels withheld for equivalence decisions. - # Converse: different B are distinguishable by at least one admissible probe. - q = boundary_capacity_quotient_test() - - self.assertTrue(q.get("sealed")) - self.assertTrue(q.get("no_new_coordinate")) - self.assertIn("does equality of B(R) coincide", q.get("question", "")) - self.assertIn("six sealed collision classes", q.get("scope", "")) - - agg = q.get("aggregate", {}) - self.assertIn(agg.get("boundary_capacity_quotient"), ("SURVIVED", "FALSIFIED")) - self.assertIn(agg.get("same_B_implies_equivalent_under_boundary_probes"), (True, False)) - self.assertTrue(agg.get("different_B_are_distinguishable")) - - # Every sealed collision reports probe outcomes using only admissible probes. - per = q.get("per_collision", {}) - self.assertGreaterEqual(len(per), 1) - for bstr, entry in per.items(): - for pr in entry.get("pair_results", []): - self.assertIn("admissible_probe_set", pr) - self.assertIn("probe_by_probe", pr) - self.assertIn("equivalent_under_boundary_probes", pr) - # first_behavioral_discriminator may be None (equivalent) or a dict - fd = pr.get("first_behavioral_discriminator") - if fd is not None: - self.assertIn("probe", fd) - self.assertIn("a_outcome", fd) - self.assertIn("b_outcome", fd) - - # Converse examples must exist and be distinguished by b readout. - conv = q.get("converse_different_b", {}) - self.assertTrue(conv.get("all_distinguished_by_b_readout")) - self.assertGreater(len(conv.get("examples", [])), 0) - - def test_boundary_capacity_quotient_via_comparison_record(self) -> None: - record = compare_after_construction() - self.assertIn("boundary_capacity_quotient", record) - self.assertIn("boundary_capacity_quotient_status", record) - qt = record["boundary_capacity_quotient"] - self.assertTrue(qt.get("sealed")) - self.assertTrue(qt.get("no_new_coordinate")) - self.assertIn(record["boundary_capacity_quotient_status"], ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - - def test_boundary_capacity_minimal_refinement_audit_sealed(self) -> None: - # Minimal behavioral refinement audit. - # Exhaustive over all subsets of the four already-declared identity-free - # candidate observables. Compares induced partitions (B + S) against the - # sealed full ≡∂ on all 27 frozen states (both directions). - # Reports exact matches, inclusion-minimal sets, fewest-observable, - # canonicality, and witness pairs for rejected smaller candidates. - # No identity smuggled; no new observables derived. - audit = boundary_capacity_minimal_refinement_audit() - - self.assertTrue(audit.get("sealed")) - self.assertTrue(audit.get("no_new_coordinate")) - self.assertIn("smallest set of already-declared", audit.get("question", "")) - self.assertIn("27 frozen states", audit.get("scope", "")) - - agg = audit.get("aggregate", {}) - self.assertEqual(agg.get("minimal_behavioral_refinement"), "SURVIVED") - - # At least one exact match must exist. - exacts = audit.get("exact_match_subsets", []) - self.assertGreater(len(exacts), 0) - - # Minimal sets and fewest size must be reported. - mins = audit.get("minimal_refinement_sets", []) - self.assertGreater(len(mins), 0) - few = audit.get("fewest_additional_observables") - self.assertIsNotNone(few) - self.assertGreaterEqual(few, 1) - - # Canonicality must be one of the allowed values. - self.assertIn(audit.get("canonicality"), ("UNIQUE", "NON-UNIQUE", "UNRESOLVED")) - self.assertIn(audit.get("minimality"), ("PROVED", "NOT PROVED")) - - # Full class count must match the sealed quotient surface. - self.assertEqual(audit.get("full_class_count"), 19) - - # Every exact minimal set must reproduce the full quotient (already checked by audit). - # Sanity: the reported minimal_refinement (if present) must be one of the minimal sets. - mr = audit.get("minimal_refinement") - if mr is not None: - self.assertIn(mr, mins) - - def test_minimal_behavioral_refinement_via_comparison_record(self) -> None: - record = compare_after_construction() - self.assertIn("boundary_capacity_minimal_refinement_audit", record) - self.assertIn("minimal_behavioral_refinement_status", record) - ra = record["boundary_capacity_minimal_refinement_audit"] - self.assertTrue(ra.get("sealed")) - self.assertTrue(ra.get("no_new_coordinate")) - self.assertIn(record["minimal_behavioral_refinement_status"], ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - - def test_representation_audit_sealed(self) -> None: - # Representation-audit capstone. - # Consolidates all prior stages and performs the final representation-equivalence check. - # Verifies the structured ledger (inputs, 8 stages, outputs with status/witnesses/partitions/etc.). - rep = epac_representation_audit() - - self.assertTrue(rep.get("sealed")) - self.assertTrue(rep.get("no_new_coordinate")) - - inputs = rep.get("inputs", {}) - self.assertIn("frozen_states", inputs) - self.assertIn("identity_exclusions", inputs) - - stages = rep.get("stages", {}) - for stage in ( - "closure", - "non_degeneracy", - "sufficiency", - "collision_localization", - "behavioral_equivalence", - "probe_completeness", - "minimal_refinement", - "representation_equivalence", - ): - self.assertIn(stage, stages) - - outputs = rep.get("outputs", {}) - self.assertIn(outputs.get("overall"), ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - self.assertIn("witnesses", outputs) - self.assertIn("partitions", outputs) - self.assertIn("counterexamples", outputs) - self.assertIn("provenance", outputs) - self.assertIn("hmmm", outputs) - - def test_representation_audit_via_comparison_record(self) -> None: - record = compare_after_construction() - self.assertIn("epac_representation_audit", record) - self.assertIn("representation_audit_overall", record) - ra = record["epac_representation_audit"] - self.assertTrue(ra.get("sealed")) - self.assertTrue(ra.get("no_new_coordinate")) - self.assertIn(record["representation_audit_overall"], ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - - def test_probe_relativity_formalization_sealed(self) -> None: - # Probe-relativity formalization over declared surfaces. - # Uses locked 27-state representation audit as immutable baseline. - # Tests O ↦ Q_O ↦ D_min(O) for already-declared admissible observable sets. - pr = epac_probe_relativity_formalization() - - self.assertTrue(pr.get("sealed")) - self.assertTrue(pr.get("no_new_coordinate")) - - inputs = pr.get("inputs", {}) - self.assertIn("frozen_states", inputs) - self.assertEqual(inputs.get("frozen_states"), 27) - self.assertIn("baseline", inputs) - - surfaces = pr.get("surfaces", {}) - self.assertIn("O_B", surfaces) - self.assertIn("O_admissible", surfaces) - self.assertIn("O_struct", surfaces) - - outputs = pr.get("outputs", {}) - self.assertIn(outputs.get("overall"), ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - self.assertIn("witnesses", outputs) - self.assertIn("provenance", outputs) - self.assertIn("hmmm", outputs) - - def test_probe_relativity_formalization_via_comparison_record(self) -> None: - record = compare_after_construction() - self.assertIn("epac_probe_relativity_formalization", record) - self.assertIn("probe_relativity_overall", record) - pr = record["epac_probe_relativity_formalization"] - self.assertTrue(pr.get("sealed")) - self.assertTrue(pr.get("no_new_coordinate")) - self.assertIn(record["probe_relativity_overall"], ("SURVIVED", "FALSIFIED", "UNRESOLVED", "BLOCKED")) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_molecular_affixiation.py b/research/epac/tests/test_molecular_affixiation.py deleted file mode 100644 index 8943c4c..0000000 --- a/research/epac/tests/test_molecular_affixiation.py +++ /dev/null @@ -1,128 +0,0 @@ -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(STACK_ROOT / "research" / "ucns" / "src")) - -from epac_dimensional_arity import quaternion_structure_readout -from epac_molecular import construct_declared_molecules, replay_molecule - - -class MolecularAffixiationTest(unittest.TestCase): - def test_declared_formulas_close_and_replay(self) -> None: - molecules = construct_declared_molecules() - # After deliberate enlargement of the preregistered molecular experiment - # (next maximal step after broadening subatomic coverage to Z=1..36), - # more formulas are constructed. The original preregistered set must still work. - original_prereg = {"H2", "H2O", "NH3", "CH4", "CO2"} - self.assertTrue(original_prereg.issubset(set(molecules))) - self.assertGreaterEqual(len(molecules), 5) - - for formula, construction in molecules.items(): - replayed = replay_molecule(construction) - self.assertEqual(construction.receipt.receipt_digest, replayed.receipt_digest, formula) - - def test_unpaired_valence_and_shells_are_used(self) -> None: - molecules = construct_declared_molecules() - water = molecules["H2O"].invariants - methane = molecules["CH4"].invariants - carbon_dioxide = molecules["CO2"].invariants - self.assertEqual(water["center_symbol"], "O") - self.assertEqual(water["center_configuration"], "1s2.2s2.2p4") - self.assertEqual(water["center_unpaired_lm"], ["1:0", "1:-1"]) - self.assertFalse(water["ligand_has_p"]) - self.assertEqual(water["center_used_atomic_promotion"], False) - self.assertEqual(methane["center_used_atomic_promotion"], True) - self.assertEqual(methane["center_unpaired_lm"], ["0:0", "1:-1", "1:0", "1:1"]) - self.assertTrue(carbon_dioxide["ligand_has_p"]) - self.assertEqual(carbon_dioxide["center_unpaired_lm"], ["0:0", "1:-1", "1:0", "1:1"]) - self.assertEqual(carbon_dioxide["center_attachment_site_count"], 4) - self.assertEqual(carbon_dioxide["ligand_attachment_site_count"], 4) - - def test_declared_couplings_are_binary_and_do_not_fill_ambient(self) -> None: - molecules = construct_declared_molecules() - water = molecules["H2O"].invariants["dimensional_geometry"] - self.assertEqual(water["ambient_count"], 3) - self.assertEqual([c["arity"] for c in water["couplings"]], [2, 2]) - ids = [c["declared_ids"] for c in water["couplings"]] - self.assertEqual(len(ids), 2) - self.assertTrue(all(len(item) == 2 for item in ids)) - methane = molecules["CH4"].invariants["dimensional_geometry"] - self.assertEqual(methane["ambient_count"], 5) - self.assertEqual([c["arity"] for c in methane["couplings"]], [2, 2, 2, 2]) - self.assertFalse(any(c["arity"] == 5 for c in methane["couplings"])) - self.assertFalse(methane["inferred_from_ambient"]) - self.assertFalse(methane["inferred_higher_arity_from_overlap"]) - self.assertEqual(water["structure"]["participating_dimension_count"], 3) - self.assertFalse(water["structure"]["ternary_coupling_declared"]) - self.assertFalse(water["structure"]["inferred_cartesian_embedding"]) - self.assertEqual(water["couplings"][0]["slot_charges"], (8, 1)) - self.assertEqual(methane["couplings"][0]["slot_charges"], (6, 1)) - water_receipt = molecules["H2O"].receipt - self.assertEqual(water_receipt.constructor_id, "epac.public_gonol") - self.assertEqual(len(water_receipt.structure["parts"]), 2) - water_instances = molecules["H2O"].invariants["oriented_instance_couplings"] - self.assertEqual(len(water_instances), 2) - self.assertEqual({item[0] for item in water_instances}, {"O#2"}) - self.assertEqual([item[1] for item in water_instances], ["H#0", "H#1"]) - methane_instances = molecules["CH4"].invariants["oriented_instance_couplings"] - self.assertEqual(len(methane_instances), 4) - self.assertTrue(all(item[0] == "C#0" for item in methane_instances)) - self.assertEqual([item[1] for item in methane_instances], ["H#1", "H#2", "H#3", "H#4"]) - self.assertEqual(molecules["H2"].invariants["oriented_instance_couplings"], ()) - water_ids = {name for part in water_receipt.structure["parts"] for name in part["coupling"]} - self.assertEqual(water_ids, {"O#2", "H#0", "H#1"}) - self.assertFalse(any(name.startswith("epac.electron:") for name in water_ids)) - oxygen = next( - item - for item in water_receipt.gonol.participants - if dict(item.carried_options).get("symbol") == "O" - ) - self.assertEqual(len(oxygen.structure["parts"]), 8) - self.assertTrue( - all(part["coupling"][0] == "epac.nucleus:O#2" for part in oxygen.structure["parts"]) - ) - o_nucleus = next(item for item in oxygen.participants if item.relation == "epac.atomic.nucleus") - self.assertEqual( - sum(1 for item in o_nucleus.participants if item.relation == "epac.atomic.neutron"), - 8, - ) - self.assertEqual( - sum(1 for item in o_nucleus.participants if item.relation == "epac.atomic.proton"), - 8, - ) - self.assertFalse(any(name.startswith("epac.neutron:") for name in water_ids)) - self.assertEqual(water_receipt.structure["representation_dimension"], 4) - self.assertEqual(water_receipt.structure["participating_dimension_count"], 3) - self.assertEqual( - quaternion_structure_readout(water_receipt.structure), - (((1, 8, 1, 1), ("O#2", "H#0", "H#1")),), - ) - self.assertEqual( - quaternion_structure_readout(molecules["CO2"].receipt.structure), - (((1, 6, 8, 8), ("C#0", "O#1", "O#2")),), - ) - self.assertEqual(quaternion_structure_readout(molecules["H2"].receipt.structure), ()) - self.assertEqual(len(quaternion_structure_readout(molecules["CH4"].receipt.structure)), 6) - - def test_ucns_coupling_binds_declared_attachments(self) -> None: - molecules = construct_declared_molecules() - signatures = {formula: item.invariants["ucns_coupling_signature"] for formula, item in molecules.items()} - self.assertEqual(len(set(signatures.values())), len(molecules)) - self.assertEqual({signature[0] for signature in signatures.values()}, {"ucns.native-mobius-root-loop"}) - self.assertEqual(len(signatures["CO2"][2]), 4) - self.assertEqual(len(signatures["H2O"][2]), 2) - - def test_construction_text_avoids_sealed_labels(self) -> None: - source = (EPAC_ROOT / "epac_molecular.py").read_text(encoding="utf-8").lower() - for term in ("bent", "tetrahedral", "trigonal-pyramidal", "vsepr", "linear"): - self.assertNotIn(term, source) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_periodic_element_gonols.py b/research/epac/tests/test_periodic_element_gonols.py deleted file mode 100644 index 3482846..0000000 --- a/research/epac/tests/test_periodic_element_gonols.py +++ /dev/null @@ -1,252 +0,0 @@ -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(STACK_ROOT / "research" / "ucns" / "src")) - -from epac_dimensional_arity import ( - charged_structure_readout, - has_declared_coupling, - quaternion_structure_readout, - space, -) -from epac_periodic import ( - construct_element_gonol, - construct_periodic_table, - harmonic_survival_carried_on_element, - lifted_spiral_carried_on_element, - replay_element_gonol, -) - - -class PeriodicElementGonolTest(unittest.TestCase): - def test_constructs_z1_to_z18(self) -> None: - table = construct_periodic_table() - self.assertEqual(len(table), 18) - self.assertEqual(set(table), { - "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", - "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", - }) - carbon = table["C"] - options = dict(carbon.gonol.carried_options) - self.assertEqual(options["Z"], "6") - self.assertEqual(options["electron-configuration"], "1s2.2s2.2p2") - self.assertEqual(options["valence-electrons"], "4") - self.assertEqual(options["unpaired-valence-count"], "2") - self.assertEqual(options["promoted-unpaired-count"], "4") - self.assertEqual(carbon.constructor_id, "epac.public_gonol") - self.assertEqual(len(carbon.gonol.participants), 3) - shells = [item for item in carbon.gonol.participants if item.relation == "epac.atomic.shell"] - electrons = [e for shell in shells for e in shell.participants] - self.assertEqual(len(electrons), 6) - quantum = {(dict(e.carried_options)["n"], dict(e.carried_options)["l"], dict(e.carried_options)["m_l"], dict(e.carried_options)["m_s"]) for e in electrons} - self.assertEqual(len(quantum), 6) - oxygen = table["O"] - self.assertEqual(dict(oxygen.gonol.carried_options)["unpaired-valence-lm"], "1:0,1:-1") - - def test_replay_matches(self) -> None: - first = construct_element_gonol("O") - second = replay_element_gonol(first) - self.assertEqual(first.receipt_digest, second.receipt_digest) - - def test_hund_unpaired_and_shells(self) -> None: - from epac_atomic import atomic_record - - carbon = atomic_record(6) - oxygen = atomic_record(8) - nitrogen = atomic_record(7) - self.assertEqual(len(carbon.electrons), 6) - self.assertEqual(tuple((e.l, e.m_l) for e in carbon.unpaired_valence), ((1, 1), (1, 0))) - self.assertEqual(len(carbon.promoted_unpaired_valence), 4) - self.assertEqual( - len({e.index for e in carbon.promoted_unpaired_valence}), - len(carbon.promoted_unpaired_valence), - ) - self.assertEqual(tuple((e.l, e.m_l) for e in oxygen.unpaired_valence), ((1, 0), (1, -1))) - self.assertEqual(len(nitrogen.unpaired_valence), 3) - self.assertEqual({e.m_l for e in nitrogen.unpaired_valence}, {1, 0, -1}) - - def test_every_electron_instance_has_nucleus_coupling(self) -> None: - oxygen = construct_element_gonol("O") - helium = construct_element_gonol("He") - self.assertIsNotNone(oxygen.structure) - oxygen_readout = charged_structure_readout(oxygen.structure) - self.assertEqual( - oxygen_readout[0], - tuple( - (2, ((8, -1), 1), ("epac.nucleus:O#0", f"epac.electron:O#0:{index}")) - for index in range(8) - ), - ) - nucleus_degree = next( - item for item in oxygen.structure["degree"] if item["dimension"] == "epac.nucleus:O#0" - ) - self.assertEqual(nucleus_degree["degree"], 8) - self.assertEqual(nucleus_degree["charge"], 8) - helium_readout = charged_structure_readout(helium.structure) - self.assertEqual( - helium_readout[0], - ( - (2, ((2, -1), 1), ("epac.nucleus:He#0", "epac.electron:He#0:0")), - (2, ((2, -1), 1), ("epac.nucleus:He#0", "epac.electron:He#0:1")), - ), - ) - ids = {name for part in helium_readout[0] for name in part[2]} - self.assertNotIn("H", ids) - self.assertNotIn("e", ids) - self.assertNotIn("He", ids) - self.assertFalse(helium.structure["ternary_coupling_declared"]) - self.assertEqual(helium.structure["representation_dimension"], 4) - self.assertEqual(helium.structure["participating_dimension_count"], 3) - self.assertEqual( - quaternion_structure_readout(helium.structure), - ( - ( - (1, 2, -1, -1), - ("epac.nucleus:He#0", "epac.electron:He#0:0", "epac.electron:He#0:1"), - ), - ), - ) - hydrogen = construct_element_gonol("H") - self.assertEqual(hydrogen.structure["participating_dimension_count"], 2) - self.assertEqual(hydrogen.structure["representation_dimension"], 4) - self.assertEqual(quaternion_structure_readout(hydrogen.structure), ()) - - def test_nucleus_is_affixiation_of_proton_and_neutron_gonols(self) -> None: - hydrogen = construct_element_gonol("H") - helium = construct_element_gonol("He") - oxygen = construct_element_gonol("O") - h_nucleus = next( - item for item in hydrogen.gonol.participants if item.relation == "epac.atomic.nucleus" - ) - he_nucleus = next( - item for item in helium.gonol.participants if item.relation == "epac.atomic.nucleus" - ) - o_nucleus = next( - item for item in oxygen.gonol.participants if item.relation == "epac.atomic.nucleus" - ) - self.assertEqual([item.relation for item in h_nucleus.participants], ["epac.atomic.proton"]) - self.assertEqual(dict(h_nucleus.carried_options)["neutrons"], "0") - self.assertEqual(h_nucleus.couplings, ()) - self.assertIsNone(h_nucleus.structure) - self.assertEqual( - [item.relation for item in he_nucleus.participants], - [ - "epac.atomic.proton", - "epac.atomic.proton", - "epac.atomic.neutron", - "epac.atomic.neutron", - ], - ) - self.assertEqual(dict(he_nucleus.participants[2].carried_options)["charge"], "0") - self.assertEqual(dict(he_nucleus.participants[0].carried_options)["charge"], "1") - he_ids = {name for part in he_nucleus.structure["parts"] for name in part["coupling"]} - self.assertTrue(all(name.startswith("epac.proton:") or name.startswith("epac.neutron:") for name in he_ids)) - self.assertNotIn("H", he_ids) - self.assertNotIn("e", he_ids) - self.assertFalse(has_declared_coupling( - space( - ["epac.proton:He#0:0", "epac.proton:He#0:1", "epac.neutron:He#0:0", "epac.neutron:He#0:1"], - [part["coupling"] for part in he_nucleus.structure["parts"]], - ), - ["epac.proton:He#0:0", "epac.proton:He#0:1"], - )) - self.assertEqual(len(he_nucleus.structure["parts"]), 4) - self.assertEqual( - quaternion_structure_readout(he_nucleus.structure), - ( - ( - (1, 1, 0, 0), - ("epac.proton:He#0:0", "epac.neutron:He#0:0", "epac.neutron:He#0:1"), - ), - ( - (1, 1, 0, 0), - ("epac.proton:He#0:1", "epac.neutron:He#0:0", "epac.neutron:He#0:1"), - ), - ), - ) - self.assertEqual(len(o_nucleus.participants), 16) - self.assertEqual( - sum(1 for item in o_nucleus.participants if item.relation == "epac.atomic.neutron"), - 8, - ) - electron_ids = { - name - for part in oxygen.structure["parts"] - for name in part["coupling"] - } - self.assertFalse(any(name.startswith("epac.proton:") for name in electron_ids)) - self.assertFalse(any(name.startswith("epac.neutron:") for name in electron_ids)) - - def test_construction_does_not_carry_shape_labels(self) -> None: - receipt = construct_element_gonol("N") - blob = str(receipt.gonol.carried_options) + receipt.gonol.relation - for term in ("bent", "tetrahedral", "trigonal-pyramidal", "vsepr"): - self.assertNotIn(term, blob.lower()) - - def test_element_gonol_carries_harmonic_survival(self) -> None: - # The nuclear harmonic survival is now carried on the closed periodic - # element gonol receipt (sourced from the subatomic layer), parallel to - # subatomic gonols and molecule PublicGonol receipts. - for symbol in ("H", "C", "O", "Si"): - receipt = construct_element_gonol(symbol) - carried = dict(receipt.gonol.carried_options) - self.assertIn("harmonic-surviving", carried) - # The carried value must be consistent with the helper. - inv = harmonic_survival_carried_on_element(receipt) - carried_val = carried["harmonic-surviving"] - if carried_val == "none": - self.assertEqual(inv, ()) - else: - self.assertEqual(carried_val.split(","), list(inv)) - - def test_element_gonol_harmonic_survival_preserved_under_replay(self) -> None: - # The carried "harmonic-surviving" on periodic element gonol receipts - # must survive exact replay (byte-replay determinism for the carried fact). - for symbol in ("H", "C", "O", "Si"): - receipt = construct_element_gonol(symbol) - carried_before = dict(receipt.gonol.carried_options).get("harmonic-surviving", "none") - replayed = replay_element_gonol(receipt) - carried_after = dict(replayed.gonol.carried_options).get("harmonic-surviving", "none") - self.assertEqual(carried_before, carried_after) - # The full receipt digest is stable under replay. - self.assertEqual(replayed.receipt_digest, receipt.receipt_digest) - - def test_element_gonol_carries_lifted_spiral(self) -> None: - # The lifted spiral (UCNS framed Möbius root-loop) is now carried on the - # closed periodic element gonol receipt as a first-class fact, parallel to - # the nuclear harmonic survival layer. - for symbol in ("H", "He", "C", "O"): - receipt = construct_element_gonol(symbol) - carried = dict(receipt.gonol.carried_options) - self.assertIn("lifted-spiral", carried) - # The carried value must be consistent with the helper. - inv = lifted_spiral_carried_on_element(receipt) - carried_val = carried["lifted-spiral"] - self.assertIsNotNone(inv) - # Basic structural check - self.assertIn(";", carried_val) - parts = carried_val.split(";") - self.assertEqual(len(parts), 3) - - def test_element_gonol_lifted_spiral_preserved_under_replay(self) -> None: - # The carried "lifted-spiral" on periodic element gonol receipts must - # survive exact replay (byte-replay determinism for the carried fact), - # parallel to harmonic-surviving. - for symbol in ("H", "C", "O", "Si"): - receipt = construct_element_gonol(symbol) - carried_before = dict(receipt.gonol.carried_options).get("lifted-spiral", "") - replayed = replay_element_gonol(receipt) - carried_after = dict(replayed.gonol.carried_options).get("lifted-spiral", "") - self.assertEqual(carried_before, carried_after) - # The full receipt digest is stable under replay. - self.assertEqual(replayed.receipt_digest, receipt.receipt_digest) - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/tests/test_spiral_population.py b/research/epac/tests/test_spiral_population.py deleted file mode 100644 index 0da14b4..0000000 --- a/research/epac/tests/test_spiral_population.py +++ /dev/null @@ -1,193 +0,0 @@ -"""Executable population of lifted spirals from all declared gonols. - -Covers the full experiment set (original prereg + enlarged molecules) -plus representative native periodic element gonols. - -All data is projected from already-closed EPAC Public Gonols. -No new geometry or UCNS position operations are invented. - -# === MODULE_BUILD === -# id: test_epac_lifted_spiral_population -# module_name: test_spiral_population -# module_kind: test -# summary: contract tests for full population of UCNS framed Möbius root-loop scenes from EPAC gonols -# owner: The Interdependency -# public_surface: (test functions) -# tests: this file -# since: 2026-09-03 -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: full_spiral_population_covers_all_declared_molecules -# given: the declared MOLECULE_COMPOSITIONS (9 formulas) -# then: extract_full_spiral_population contains one scene per formula -# class: population -# -# id: spiral_scenes_carry_canonical_provenance -# given: any scene from the population -# then: möbius_law_source ends with the canonical direct_mobius.py -# class: provenance -# -# id: spiral_scenes_preserve_frame_double_cover -# given: any scene -# then: exactly three turns with visible_phase constant and frame sequence positive/reversed/positive -# class: correctness -# -# id: spiral_scene_replay_deterministic -# given: a molecule or element construction -# then: scene extracted before and after replay_public_gonol / replay_element_gonol are identical on core fields -# class: determinism -# === END CONTRACTS === -""" - -from __future__ import annotations - -import sys -import unittest -from pathlib import Path - -EPAC_ROOT = Path(__file__).resolve().parents[1] -STACK_ROOT = EPAC_ROOT.parents[1] -sys.path.insert(0, str(EPAC_ROOT)) -sys.path.insert(0, str(STACK_ROOT / "research" / "ucns" / "src")) - -from epac_molecular import ( - MOLECULE_COMPOSITIONS, - construct_declared_molecules, - replay_molecule, -) -from epac_periodic import construct_element_gonol, replay_element_gonol -from epac_public_gonol import replay_public_gonol - -import subatomic_gonol as subatomic_gonol -from subatomic_gonol import replay_subatomic_gonol - -from viz.spiral_viz import ( - extract_full_spiral_population, - extract_spiral_scene, - get_möbius_law_source, - spiral_population_keys, -) - - -class SpiralPopulationTest(unittest.TestCase): - def test_full_population_covers_all_declared_molecules(self) -> None: - pop = extract_full_spiral_population() - for formula in MOLECULE_COMPOSITIONS: - self.assertIn(formula, pop, f"missing lifted spiral for {formula}") - scene = pop[formula] - self.assertTrue(scene.participant_axes, f"no participant axes for {formula}") - # Every molecule scene must have the mobius law - self.assertIn("native-mobius-root-loop", scene.law) - - def test_full_population_includes_representative_elements(self) -> None: - pop = extract_full_spiral_population() - for sym in ("H", "C", "O"): - key = f"element:{sym}" - self.assertIn(key, pop, f"missing element spiral for {sym}") - scene = pop[key] - self.assertTrue(scene.participant_axes) - - def test_full_population_includes_representative_subatomic(self) -> None: - # Subatomic gonols now carry "lifted-spiral" first-class (parallel to element). - # The population extractor surfaces them under "subatomic:". - pop = extract_full_spiral_population() - for sym in ("H", "C", "O"): - key = f"subatomic:{sym}" - self.assertIn(key, pop, f"missing subatomic spiral for {sym}") - scene = pop[key] - self.assertTrue(scene.participant_axes) - self.assertIn("native-mobius-root-loop", scene.law) - - def test_spiral_scenes_carry_canonical_provenance(self) -> None: - pop = extract_full_spiral_population() - src = get_möbius_law_source() - self.assertIsNotNone(src) - self.assertTrue(str(src).endswith("direct_mobius.py")) - for name, scene in pop.items(): - self.assertIsNotNone(scene.möbius_law_source, name) - self.assertTrue( - str(scene.möbius_law_source).endswith("direct_mobius.py"), - f"{name} provenance wrong: {scene.möbius_law_source}", - ) - - def test_spiral_scenes_preserve_frame_double_cover(self) -> None: - pop = extract_full_spiral_population() - for name, scene in pop.items(): - self.assertEqual(len(scene.turns), 3, name) - phases = {t.visible_phase for t in scene.turns} - self.assertEqual(len(phases), 1, f"visible phase must be constant for {name}") - frames = [t.frame for t in scene.turns] - self.assertEqual( - frames, - ["positive-local-frame", "reversed-local-frame", "positive-local-frame"], - f"frame sequence wrong for {name}", - ) - self.assertTrue(scene.one_turn_flips_frame) - self.assertTrue(scene.complete_restored_at_t2) - - def test_spiral_population_keys_match_population(self) -> None: - pop = extract_full_spiral_population() - expected = set(spiral_population_keys()) - actual = set(pop.keys()) - # We may have fewer element keys if the table is limited, but all molecule keys must be present - for formula in MOLECULE_COMPOSITIONS: - self.assertIn(formula, actual) - # The helper must list at least the molecules - self.assertTrue(expected.issuperset(MOLECULE_COMPOSITIONS.keys())) - - def test_molecule_spiral_scene_replay_deterministic(self) -> None: - constructions = construct_declared_molecules() - for formula, c in constructions.items(): - before = extract_spiral_scene(c) - replayed = replay_molecule(c) - after = extract_spiral_scene(replayed) - # Core replay-stable facts from the receipt (double cover + flags + provenance) - self.assertEqual(before.turns, after.turns, formula) - self.assertEqual(before.one_turn_flips_frame, after.one_turn_flips_frame) - self.assertEqual(before.complete_restored_at_t2, after.complete_restored_at_t2) - self.assertEqual(before.möbius_law_source, after.möbius_law_source) - # participant_axes must be identical as a set (order is not part of the - # invariant; pure replay on a receipt may derive axes from structure parts - # in a different order than the original participant list). - self.assertEqual(set(before.participant_axes), set(after.participant_axes), formula) - # Attachment slots are rich construction-time evidence stored in the - # MolecularConstruction "mobius" invariant. After pure replay we only - # synthesize participant axes from structure; attachments may be empty. - # We only require that the original construction captured them when expected. - if formula != "H2": - self.assertTrue(len(before.attachments) > 0, f"no attachments on construction for {formula}") - - def test_element_spiral_scene_replay_deterministic(self) -> None: - for sym in ("H", "O", "C"): - receipt = construct_element_gonol(sym) - before = extract_spiral_scene(receipt) - replayed = replay_element_gonol(receipt) - after = extract_spiral_scene(replayed) - self.assertEqual(before.turns, after.turns, sym) - self.assertEqual(before.participant_axes, after.participant_axes, sym) - self.assertEqual(before.möbius_law_source, after.möbius_law_source) - - def test_subatomic_spiral_scene_replay_deterministic(self) -> None: - # replay_subatomic_gonol returns digest; re-construct for fresh receipt - # to extract scene (consistent with subatomic carry/replay tests). - for sym in ("H", "C", "O"): - receipt = subatomic_gonol.construct_subatomic_gonol(sym) - before = extract_spiral_scene(receipt) - _ = replay_subatomic_gonol(receipt) - after_receipt = subatomic_gonol.construct_subatomic_gonol(sym) - after = extract_spiral_scene(after_receipt) - self.assertEqual(before.turns, after.turns, sym) - self.assertEqual(before.participant_axes, after.participant_axes, sym) - self.assertEqual(before.möbius_law_source, after.möbius_law_source, sym) - - def test_attachment_slots_populated_for_molecules(self) -> None: - pop = extract_full_spiral_population() - # Most molecules have valence attachments; H2 is symmetric but still records slots - for formula in ("H2O", "CH4", "BF3"): - scene = pop[formula] - self.assertTrue(len(scene.attachments) > 0, f"no attachments for {formula}") - - -if __name__ == "__main__": - unittest.main() diff --git a/research/epac/viz/__init__.py b/research/epac/viz/__init__.py deleted file mode 100644 index 04ac43f..0000000 --- a/research/epac/viz/__init__.py +++ /dev/null @@ -1,49 +0,0 @@ -"""UCNS / EPAC lifted-spiral visualizer. - -Renders the framed Möbius root-loop (the "lifted spiral") that is witnessed -by gonol construction data. - -The visualizer consumes only data already present in: -- PublicGonol receipts (structure, carried_options) -- MolecularConstruction / element gonol invariants (the "mobius" dict) -- native_mobius_state(t) from the UCNS carrier - -It does not invent geometry, positions, or couplings. It projects the -declared attachment evidence and charge states onto the canonical -visible-phase + frame double-cover. - -Full population of the declared experiment (all 9 molecules + representative -elements) is available via extract_full_spiral_population. - -Usage: - from epac.viz.spiral_viz import render_molecule_spiral_svg, render_to_text - from epac_molecular import construct_molecule - - c = construct_molecule("H2O") - svg = render_molecule_spiral_svg(c) - print(render_to_text(c)) -""" - -from __future__ import annotations - -from .spiral_viz import ( # noqa: F401 - extract_spiral_scene, - extract_full_spiral_population, - spiral_population_keys, - render_molecule_spiral_svg, - render_element_spiral_svg, - render_to_text, - render_scene_svg, - get_möbius_law_source, -) - -__all__ = [ - "extract_spiral_scene", - "extract_full_spiral_population", - "spiral_population_keys", - "render_molecule_spiral_svg", - "render_element_spiral_svg", - "render_to_text", - "render_scene_svg", - "get_möbius_law_source", -] diff --git a/research/epac/viz/__main__.py b/research/epac/viz/__main__.py deleted file mode 100644 index 68ef261..0000000 --- a/research/epac/viz/__main__.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Allow `python -m viz ...` when PYTHONPATH contains the epac root. - -Example (from the epac directory): - PYTHONPATH=".:subatomic:../../libs/ucns/src" python3 -m viz H2O --svg -""" -from __future__ import annotations - -from .cli import main - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/research/epac/viz/cli.py b/research/epac/viz/cli.py deleted file mode 100644 index da58c8b..0000000 --- a/research/epac/viz/cli.py +++ /dev/null @@ -1,69 +0,0 @@ -"""Tiny CLI for the UCNS / EPAC lifted-spiral visualizer. - -Usage examples (from the epac directory with correct PYTHONPATH): - - PYTHONPATH=".:subatomic:../../libs/ucns/src" python -m epac.viz.cli H2O - PYTHONPATH=".:subatomic:../../libs/ucns/src" python -m epac.viz.cli --svg H2O > /tmp/h2o_spiral.svg - PYTHONPATH=".:subatomic:../../libs/ucns/src" python -m epac.viz.cli --element O -""" - -from __future__ import annotations - -import argparse -import sys -from pathlib import Path - -from .spiral_viz import ( - extract_spiral_scene, - render_molecule_spiral_svg, - render_element_spiral_svg, - render_to_text, -) - - -def main(argv: list[str] | None = None) -> int: - parser = argparse.ArgumentParser(description="Render UCNS lifted spirals from gonols") - parser.add_argument("formula_or_symbol", nargs="?", default="H2O", - help="Molecule formula (H2, H2O, CH4, ...) or element symbol when --element is used") - parser.add_argument("--element", action="store_true", - help="Treat the argument as an element symbol and render its gonol spiral") - parser.add_argument("--svg", action="store_true", - help="Emit SVG instead of text") - parser.add_argument("--out", type=str, default=None, - help="Write output to this file instead of stdout") - parser.add_argument("--width", type=int, default=920) - parser.add_argument("--height", type=int, default=520) - - args = parser.parse_args(argv) - - try: - if args.element: - from epac_periodic import construct_element_gonol - receipt = construct_element_gonol(args.formula_or_symbol) - scene = extract_spiral_scene(receipt) - if args.svg: - out = render_element_spiral_svg(receipt, width=args.width, height=args.height) - else: - out = render_to_text(scene) - else: - from epac_molecular import construct_molecule - construction = construct_molecule(args.formula_or_symbol) - scene = extract_spiral_scene(construction) - if args.svg: - out = render_molecule_spiral_svg(construction, width=args.width, height=args.height) - else: - out = render_to_text(scene) - except Exception as exc: - print(f"error: {exc}", file=sys.stderr) - return 2 - - if args.out: - Path(args.out).write_text(out, encoding="utf-8") - else: - print(out) - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/research/epac/viz/spiral_viz.py b/research/epac/viz/spiral_viz.py deleted file mode 100644 index 4a254f0..0000000 --- a/research/epac/viz/spiral_viz.py +++ /dev/null @@ -1,746 +0,0 @@ -"""Lifted-spiral visualizer for UCNS-framed gonol constructions. - -Projects the Möbius root-loop evidence carried by EPAC Public Gonols -onto a discrete two-turn double-cover. - -Data sources (no invention): -- The "mobius" invariant produced during construction - (law="ucns.native-mobius-root-loop", t, visible_phase, frame, - participant_axes, attachment_slots, one_turn_flips_frame, ...) -- Charged structure and degree from the gonol receipt.structure -- native_mobius_state(t) from the UCNS carrier (for canonical frame sequence) - -The visualizer renders: -- The constant visible phase across integer turns -- The alternating local frame (positive / reversed) -- Participant axes (the gonol dimensions that participate) -- Attachment slots (valence evidence) as relations between axes -- Charge states at each turn -- The two-turn restoration of complete state - -It does not define UCNS position operations, does not claim geometry -beyond what is already declared in the receipts, and stays within the -existing hmmm boundaries. - -# === MODULE_BUILD === -# id: epac_lifted_spiral_visualizer -# module_name: epac.viz.spiral_viz -# module_kind: experiment -# summary: projects UCNS framed Möbius root-loop (lifted spirals) carried on EPAC Public Gonol receipts into canonical two-turn double-cover scenes; pure data extraction and rendering only -# owner: The Interdependency -# public_surface: SpiralScene, TurnState, Attachment, extract_spiral_scene, extract_full_spiral_population, render_to_text, render_scene_svg, render_molecule_spiral_svg, render_element_spiral_svg, get_möbius_law_source -# internal_surface: _get_mobius, _extract_attachments, _canonical_turns_from_mobius, _charges_from_structure, _svg_escape -# auth_boundary: EPAC owns gonol construction and the mobius invariant; UCNS owns direct_mobius (the framed root-loop law); visualizer only projects existing carried evidence -# storage_boundary: none (in-memory scenes and SVG strings) -# network_boundary: none -# user_data_boundary: caller supplies gonol receipts or constructions -# admin_only: false -# tests: tests.test_spiral_population -# rollout: explicit population of lifted-spiral facts from all declared molecules and representative elements; no new geometry, no position operations -# rollback: remove viz package; existing gonol construction and receipts remain unchanged -# requires: ucns_native_mobius_geometry (for provenance label only), epac_public_gonol, epac_molecular, epac_periodic -# since: 2026-09-03 -# unresolved: exact UCNS geometric operation of Public Gonol function positions; UCNS Möbius-carrier affixiation/coupling law (consumed, not redefined) -# === END MODULE_BUILD === - -# === CONTRACTS === -# id: spiral_scene_is_pure_projection -# given: any gonol receipt or MolecularConstruction -# then: SpiralScene contains only values present in the carried mobius invariant, structure degree/charges, or the canonical UCNS frame sequence; no invented positions or couplings -# class: doctrine -# since: 2026-09-03 -# -# id: spiral_population_covers_experiment -# given: the declared MOLECULE_COMPOSITIONS and representative elements -# then: extract_full_spiral_population produces one scene per formula and per requested element symbol -# class: population -# since: 2026-09-03 -# -# id: spiral_scene_replays_deterministically -# given: a scene extracted from a receipt -# then: after replay_public_gonol the re-extracted scene has identical turns, participant_axes, attachment facts, and one_turn/complete flags -# class: determinism -# since: 2026-09-03 -# -# id: möbius_law_source_is_canonical -# given: any SpiralScene -# then: möbius_law_source points to the single UCNS direct_mobius.py that defines the framed root-loop (visible_key / complete_key / frame flip behavior) -# class: provenance -# since: 2026-09-03 -# === END CONTRACTS === -""" - -from __future__ import annotations - -from dataclasses import dataclass -from typing import Any, Iterable, Mapping, Sequence - -from fractions import Fraction - -# We only import the state constructor for canonical frame labels. -# The visualizer never calls it during gonol construction. -try: - from ucns import native_mobius_state # type: ignore -except Exception: # pragma: no cover - graceful fallback in unusual envs - native_mobius_state = None # type: ignore - - -def get_möbius_law_source() -> str | None: - """Return the absolute path to the canonical UCNS direct_mobius.py that defines - the framed root-loop law used by all gonol constructions. - - This is the single source of the (t, ε) ~ (t+n, (-1)^n ε) quotient, - visible_key vs. complete_key, and the one-turn-flip / two-turn-restore behavior - that the lifted-spiral visualizer projects. - """ - if native_mobius_state is None: - return None - try: - import inspect - return inspect.getsourcefile(native_mobius_state) - except Exception: - return None - - -# --------------------------------------------------------------------- -# Scene model (pure data extracted from gonols) -# --------------------------------------------------------------------- - -@dataclass(frozen=True, slots=True) -class Attachment: - """One declared valence attachment slot at construction time.""" - slot: int - center: str | None - center_site: str | None - ligand: str | None - ligand_site: str | None - # For symmetric (no-center) cases both sides are in "participant" - participant: str | None = None - site: str | None = None - - -@dataclass(frozen=True, slots=True) -class TurnState: - """Canonical framed state at one integer turn.""" - t: int - visible_phase: str - frame: str # "positive-local-frame" | "reversed-local-frame" - complete_key_repr: str - - -@dataclass(frozen=True, slots=True) -class SpiralScene: - """A projection of one gonol's lifted spiral evidence. - - This is a pure description; nothing here is a new UCNS geometric claim. - All frame/phase/quotient semantics come from the single UCNS carrier module - returned by get_möbius_law_source(). - """ - source_id: str - relation: str - law: str - parameter: str - binding: str - - # Absolute path to the UCNS module that defines the framed root-loop law - # used to produce the visible/complete keys and the one-turn / two-turn behavior. - möbius_law_source: str | None - - # The three canonical turns we always render - turns: tuple[TurnState, TurnState, TurnState] - - # The declared participants (gonol axes) that exist for the whole construction - participant_axes: tuple[str, ...] - - # Attachment evidence (valence sites) recorded at construction - attachments: tuple[Attachment, ...] - - # Charge information projected from the structure (per-dimension at t=0 baseline) - dimension_charges: Mapping[str, int] - - # Whether the construction observed the classic one-turn flip + two-turn restore - one_turn_flips_frame: bool - complete_restored_at_t2: bool - - # Optional richer structure hints (quaternions count, etc.) - extra: Mapping[str, Any] - - -def _get_mobius(inv: Mapping[str, Any] | None) -> Mapping[str, Any]: - if not inv: - return {} - m = inv.get("mobius") if isinstance(inv, dict) else None - if isinstance(m, dict): - return m - return {} - - -def _extract_attachments(mob: Mapping[str, Any]) -> tuple[Attachment, ...]: - slots = mob.get("attachment_slots", ()) or () - out: list[Attachment] = [] - for s in slots: - if not isinstance(s, dict): - continue - out.append( - Attachment( - slot=int(s.get("slot", -1)), - center=s.get("center"), - center_site=s.get("center_site"), - ligand=s.get("ligand"), - ligand_site=s.get("ligand_site"), - participant=s.get("participant"), - site=s.get("site"), - ) - ) - return tuple(out) - - -def _canonical_turns_from_mobius(mob: Mapping[str, Any]) -> tuple[TurnState, ...]: - """Build the three canonical turn states using data carried by the gonol. - - We prefer the exact values recorded in the mobius invariant. - If they are absent we fall back to the live UCNS carrier (still only - for labeling, never for inventing construction evidence). - """ - ts = mob.get("t") or [0, 1, 2] - vphases = mob.get("visible_phase") or ["0", "0", "0"] - frames = mob.get("frame") or [ - "positive-local-frame", - "reversed-local-frame", - "positive-local-frame", - ] - - result: list[TurnState] = [] - for i, t in enumerate(ts[:3]): - t_int = int(t) - vp = str(vphases[i]) if i < len(vphases) else "0" - fr = str(frames[i]) if i < len(frames) else "positive-local-frame" - # Build a compact complete_key representation - ck = f"({mob.get('law','ucns.native-mobius-root-loop')}, {vp}, {fr})" - result.append(TurnState(t=t_int, visible_phase=vp, frame=fr, complete_key_repr=ck)) - # Ensure we always have exactly three - while len(result) < 3: - last = result[-1] if result else TurnState(0, "0", "positive-local-frame", "") - result.append(TurnState(last.t + 1, last.visible_phase, last.frame, last.complete_key_repr)) - return tuple(result[:3]) - - -def _charges_from_structure(structure: Mapping[str, Any] | None) -> dict[str, int]: - ch: dict[str, int] = {} - if not structure: - return ch - for d in structure.get("degree", ()) or (): - if isinstance(d, dict): - dim = d.get("dimension") - charge = d.get("charge") - if dim is not None and charge is not None: - try: - ch[str(dim)] = int(charge) - except Exception: - pass - elif hasattr(d, "dimension") and hasattr(d, "charge"): - try: - ch[str(d.dimension)] = int(d.charge) - except Exception: - pass - return ch - - -def extract_spiral_scene(obj: Any) -> SpiralScene: - """Extract a SpiralScene from a MolecularConstruction or PublicGonolReceipt. - - Accepts: - - epac_molecular.MolecularConstruction - - epac_public_gonol.PublicGonolReceipt (element or molecule) - - objects that expose .receipt and .invariants (or .gonol) - """ - # Normalize to receipt + invariants + source info - receipt = None - invariants: Mapping[str, Any] = {} - source_id = "unknown" - relation = "unknown" - - # MolecularConstruction - if hasattr(obj, "receipt") and hasattr(obj, "invariants"): - receipt = obj.receipt - invariants = obj.invariants or {} - source_id = getattr(obj, "formula", None) or getattr(receipt, "source_id", "molecule") - relation = getattr(receipt, "relation", "epac.affixiation") - - # Direct receipt (element gonol or replay) - elif hasattr(obj, "gonol") and hasattr(obj, "source_id"): - receipt = obj - # element gonols do not carry the full "mobius" dict in invariants; - # we synthesize a minimal one from carried harmonic + basic structure. - invariants = {} - source_id = getattr(obj, "source_id", "element") - relation = getattr(obj, "relation", "epac.atomic.element") - - # Subatomic gonol receipt (PublicGonolReceipt); use the carried "lifted-spiral" - # (first-class on subatomic gonols, parallel to element/molecule). - if receipt is not None and ("subatomic" in str(getattr(receipt, "source_id", "")) or "subatomic" in str(getattr(receipt, "relation", ""))): - carried = {} - try: - gon = getattr(receipt, "gonol", receipt) - carried = dict(getattr(gon, "carried_options", ())) - except Exception: - carried = {} - val = carried.get("lifted-spiral", "") - frames = () - axes = () - if val: - try: - fpart, apart, _ac = val.split(";", 2) - frames = tuple(fpart.split("|")) if fpart else () - axes = tuple(sorted(a for a in apart.split(",") if a)) if apart else () - except Exception: - pass - mob = { - "law": "ucns.native-mobius-root-loop", - "participant_axes": axes or ("nucleus",), - "attachment_slots": (), - "t": [0, 1, 2], - "visible_phase": ["0", "0", "0"], - "frame": frames or ["positive-local-frame", "reversed-local-frame", "positive-local-frame"], - "one_turn_flips_frame": True, - "complete_restored": True, - } - - # Fallback: try common attributes - if receipt is None: - receipt = getattr(obj, "receipt", obj) - invariants = getattr(obj, "invariants", {}) or {} - source_id = getattr(receipt, "source_id", str(type(obj))) - relation = getattr(receipt, "relation", "unknown") - - mob = _get_mobius(invariants) - # For pure element gonols we may have no "mobius" invariant. - # Build a minimal synthetic mobius from the structure so the visualizer - # can still show the participant axes and charges on the spiral. - if not mob and receipt is not None: - struct = getattr(receipt, "structure", None) or {} - axes = [] - if struct: - # Collect unique dimensions from parts - seen = set() - for part in struct.get("parts", ()) or (): - for name in (part.get("coupling") or []): - if name not in seen: - seen.add(name) - axes.append(name) - if not axes: - # fallback to degree dimensions - for d in struct.get("degree", ()) or (): - dim = d.get("dimension") if isinstance(d, dict) else getattr(d, "dimension", None) - if dim: - axes.append(str(dim)) - mob = { - "law": "ucns.native-mobius-root-loop", - "binding": "gonol-structure-declared-axes", - "parameter": "turn-index", - "participant_axes": tuple(axes) or ("nucleus",), - "attachment_slots": (), - "t": [0, 1, 2], - "visible_phase": ["0", "0", "0"], - "frame": ["positive-local-frame", "reversed-local-frame", "positive-local-frame"], - "one_turn_flips_frame": True, - "complete_restored": True, - } - - participant_axes = tuple(mob.get("participant_axes", ()) or ()) - attachments = _extract_attachments(mob) - charges = _charges_from_structure(getattr(receipt, "structure", None) if receipt else None) - - turns = _canonical_turns_from_mobius(mob) - - extra: dict[str, Any] = {} - if "quaternion" in str(invariants).lower() or (receipt and getattr(receipt, "structure", None)): - qcount = 0 - try: - qs = (getattr(receipt, "structure", None) or {}).get("quaternions") or [] - qcount = len(qs) if isinstance(qs, (list, tuple)) else 0 - except Exception: - pass - extra["quaternion_count_hint"] = qcount - - return SpiralScene( - source_id=str(source_id), - relation=str(relation), - law=str(mob.get("law", "ucns.native-mobius-root-loop")), - parameter=str(mob.get("parameter", "turn-index-over-declared-attachment-evidence")), - binding=str(mob.get("binding", "declared-participants-and-valence-attachment-sites")), - möbius_law_source=get_möbius_law_source(), - turns=turns, # type: ignore[arg-type] - participant_axes=participant_axes, - attachments=attachments, - dimension_charges=charges, - one_turn_flips_frame=bool(mob.get("one_turn_flips_frame", True)), - complete_restored_at_t2=bool(mob.get("complete_restored", True)), - extra=extra, - ) - - -# --------------------------------------------------------------------- -# Text renderer (dependency-free) -# --------------------------------------------------------------------- - -def render_to_text(scene: SpiralScene) -> str: - """Return a compact plain-text description of the lifted spiral.""" - lines: list[str] = [] - lines.append(f"LIFTED SPIRAL source={scene.source_id} relation={scene.relation}") - lines.append(f"law={scene.law}") - lines.append(f"parameter={scene.parameter}") - lines.append(f"binding={scene.binding}") - lines.append("") - lines.append("Canonical two-turn double cover (visible phase constant, frame flips):") - lines.append("") - - for ts in scene.turns: - flip = " (frame flip)" if ts.t == 1 else "" - restore = " (complete state restored)" if ts.t == 2 and scene.complete_restored_at_t2 else "" - lines.append(f" t={ts.t} visible_phase={ts.visible_phase} frame={ts.frame}{flip}{restore}") - - lines.append("") - if scene.participant_axes: - lines.append("participant axes (gonol dimensions):") - for ax in scene.participant_axes: - ch = scene.dimension_charges.get(ax) - chs = f" charge={ch}" if ch is not None else "" - lines.append(f" {ax}{chs}") - - if scene.attachments: - lines.append("") - lines.append("attachment slots (valence evidence):") - for a in scene.attachments: - if a.center: - lines.append( - f" slot {a.slot}: center {a.center}@{a.center_site} -- " - f"ligand {a.ligand}@{a.ligand_site}" - ) - else: - lines.append(f" slot {a.slot}: {a.participant}@{a.site}") - - lines.append("") - lines.append( - f"one_turn_flips_frame={scene.one_turn_flips_frame} " - f"complete_restored_at_t2={scene.complete_restored_at_t2}" - ) - if scene.extra: - lines.append(f"extra: {scene.extra}") - return "\n".join(lines) - - -# --------------------------------------------------------------------- -# SVG renderer (pure stdlib, self-contained) -# --------------------------------------------------------------------- - -def _svg_escape(text: str) -> str: - return ( - text.replace("&", "&") - .replace("<", "<") - .replace(">", ">") - .replace('"', """) - ) - - -def render_scene_svg( - scene: SpiralScene, - *, - width: int = 920, - height: int = 520, - title: str | None = None, -) -> str: - """Return a self-contained SVG string visualizing the lifted spiral. - - Layout (faithful to the data): - - Three vertical stations for t=0, t=1, t=2 - - Horizontal ribbon showing the double cover - - Same visible phase shown at every station - - Frame arrows or labels that flip at t=1 and restore at t=2 - - Participant axes listed under each station with their charges - - Attachment arcs drawn between participants (center-ligand or symmetric) - """ - title = title or f"Lifted Spiral — {scene.source_id}" - margin = 40 - station_w = 220 - station_gap = 40 - top = 80 - ribbon_h = 110 - bottom = height - 60 - - stations_x = [ - margin + station_w // 2, - margin + station_w + station_gap + station_w // 2, - margin + 2 * (station_w + station_gap) + station_w // 2, - ] - - parts: list[str] = [] - parts.append( - f'' - ) - parts.append( - '' - '' - '' - '' - '' - '' - '' - '' - ) - - # Background - parts.append(f'') - - # Title - parts.append( - f'{_svg_escape(title)}' - ) - - # Ribbon background (two bands for the double cover) - ribbon_y = top + 10 - parts.append( - f'' - ) - # Subtle center line - parts.append( - f'' - ) - - # Station columns + labels - for i, (ts, x) in enumerate(zip(scene.turns, stations_x)): - # Station header - parts.append( - f't = {ts.t}' - ) - - # Visible phase pill (same for all) - pill_y = ribbon_y + 18 - parts.append( - f'' - ) - parts.append( - f'visible: {ts.visible_phase}' - ) - - # Frame indicator (arrow direction + label) - frame_y = ribbon_y + 58 - color = "#22c7b1" if "positive" in ts.frame else "#f59e0b" - arrow_dir = "→" if "positive" in ts.frame else "←" - parts.append( - f'{arrow_dir}' - ) - parts.append( - f'{_svg_escape(ts.frame)}' - ) - - # Turn label under ribbon - parts.append( - f'turn {ts.t}' - ) - - # Participant axes (left side list) - ax_x = margin + 12 - ax_y = top + ribbon_h + 55 - parts.append( - f'' - "participant axes" - ) - for j, ax in enumerate(scene.participant_axes[:8]): # keep compact - ch = scene.dimension_charges.get(ax) - label = f"{ax} (Z={ch})" if ch is not None else ax - parts.append( - f'{_svg_escape(label)}' - ) - - # Attachment arcs (schematic) - # Draw simple arcs between centers and ligands projected onto the t=0 column for clarity. - if scene.attachments: - arc_y_base = top + ribbon_h + 55 - arc_x_center = stations_x[0] + 70 - for a in scene.attachments[:6]: - if a.center and a.ligand: - c = _svg_escape(str(a.center)) - l = _svg_escape(str(a.ligand)) - parts.append( - f'' - ) - parts.append( - f'{c}—{l}' - ) - - # Legend box (bottom right) - lx = width - margin - 260 - ly = height - 110 - parts.append( - f'' - ) - parts.append( - f'' - "UCNS native-möbius-root-loop" - ) - parts.append( - f'' - "visible phase unchanged after integer turns" - ) - parts.append( - f'' - "frame flips at t=1, restored at t=2" - ) - parts.append( - f'' - f"one_turn_flips={scene.one_turn_flips_frame} complete@2={scene.complete_restored_at_t2}" - ) - parts.append( - f'' - f"attachments={len(scene.attachments)}" - ) - - parts.append("") - return "\n".join(parts) - - -def render_molecule_spiral_svg(construction: Any, **kwargs: Any) -> str: - """Convenience wrapper for a MolecularConstruction.""" - scene = extract_spiral_scene(construction) - return render_scene_svg(scene, **kwargs) - - -def render_element_spiral_svg(receipt: Any, **kwargs: Any) -> str: - """Convenience wrapper for an element PublicGonolReceipt.""" - scene = extract_spiral_scene(receipt) - return render_scene_svg(scene, title=f"Lifted Spiral — element {getattr(receipt, 'source_id', '?')}", **kwargs) - - -def render_subatomic_spiral_svg(receipt: Any, **kwargs: Any) -> str: - """Convenience wrapper for a subatomic PublicGonolReceipt (lifted spiral).""" - scene = extract_spiral_scene(receipt) - return render_scene_svg(scene, title=f"Lifted Spiral — subatomic {getattr(receipt, 'source_id', '?')}", **kwargs) - - -# --------------------------------------------------------------------- -# Small demo helper -# --------------------------------------------------------------------- - -def demo_text(formula: str = "H2O") -> str: - """Quick text rendering for a declared molecule. Requires EPAC on PYTHONPATH.""" - from epac_molecular import construct_molecule # local import to keep viz import-light - - c = construct_molecule(formula) - scene = extract_spiral_scene(c) - return render_to_text(scene) - - -# --------------------------------------------------------------------- -# Full population extractor (first-class lifted-spiral population) -# --------------------------------------------------------------------- - -def extract_full_spiral_population( - *, - include_elements: tuple[str, ...] = ("H", "C", "O", "Si", "B", "N"), - include_subatomic: tuple[str, ...] = ("H", "He", "Li", "C", "O", "Si"), -) -> dict[str, SpiralScene]: - """Return a complete, deterministic map of lifted-spiral scenes. - - Keys: - - All formulas from MOLECULE_COMPOSITIONS (the full declared experiment: 9) - - Element symbols requested via include_elements (sourced from native periodic gonols) - - Subatomic symbols requested via include_subatomic (sourced from subatomic gonols, now carrying "lifted-spiral" first-class) - - Every scene carries: - - möbius_law_source pointing at the canonical UCNS direct_mobius.py - - the two-turn double-cover with visible phase constant + frame flip/restore - - participant axes + attachment slots + charges as declared at construction time - - This is pure population of already-closed gonol evidence. No new geometry. - """ - from epac_molecular import construct_declared_molecules # local to keep import light - - pop: dict[str, SpiralScene] = {} - - # Molecules (original prereg + enlarged set) - molecules = construct_declared_molecules() - for formula, construction in molecules.items(): - pop[formula] = extract_spiral_scene(construction) - - # Representative elements via the primary EPAC periodic path - try: - from epac_periodic import construct_element_gonol as _construct_element_gonol - except Exception: - _construct_element_gonol = None # type: ignore - - if _construct_element_gonol is not None: - for sym in include_elements: - try: - receipt = _construct_element_gonol(sym) - pop[f"element:{sym}"] = extract_spiral_scene(receipt) - except Exception: - pass - - # Subatomic gonols (now carry "lifted-spiral" first-class, parallel to element). - try: - import subatomic_gonol as _subatomic - except Exception: - _subatomic = None # type: ignore - - if _subatomic is not None: - for sym in include_subatomic: - try: - if sym in getattr(_subatomic, "SUPPORTED_SYMBOLS", ()): - receipt = _subatomic.construct_subatomic_gonol(sym) - pop[f"subatomic:{sym}"] = extract_spiral_scene(receipt) - except Exception: - pass - - return pop - - -def spiral_population_keys() -> list[str]: - """Return the expected keys for a full population over the declared experiment.""" - from epac_molecular import MOLECULE_COMPOSITIONS as _M # local - - keys = list(_M.keys()) - keys.extend([f"element:{s}" for s in ("H", "C", "O", "Si", "B", "N")]) - keys.extend([f"subatomic:{s}" for s in ("H", "He", "Li", "C", "O", "Si")]) - return keys - - -__all__ = [ - "SpiralScene", - "TurnState", - "Attachment", - "extract_spiral_scene", - "extract_full_spiral_population", - "spiral_population_keys", - "render_to_text", - "render_scene_svg", - "render_molecule_spiral_svg", - "render_element_spiral_svg", - "get_möbius_law_source", -] - - -if __name__ == "__main__": - # Allow direct execution for quick inspection - import sys - - formula = sys.argv[1] if len(sys.argv) > 1 else "H2O" - print(demo_text(formula)) diff --git a/stack-manifest.json b/stack-manifest.json index e205464..66a7ca2 100644 --- a/stack-manifest.json +++ b/stack-manifest.json @@ -1,144 +1,165 @@ { - "schema": "the-interdependency.stack-manifest", - "version": "1.1.0", - "work_graph_sha256": "9ab3b3f75a32f5f73b5df68419148181fc632593babe4ec6adf4269d4f35badb", + "boundaries": { + "agent_scope": "cross-repository-work-graph", + "authority_transfer": false, + "hmmm": [ + "ucns has no LICENSE file at snapshot commit 828c0b8", + "skill-lib remains a special operational snapshot at stack root rather than following the libs/research pair", + "EPAC public release and reconsumption passed; clean retired-source verification and the final scoped transition receipt remain pending" + ], + "measurement_status_transfer": false, + "proof_status_transfer": false, + "semantic_mapping": "external-provenance" + }, "repositories": [ { - "repository": "The-Interdependency/skill-lib", - "commit": "fb3b53a7629f7f03ecf255167d52c13abef1a979", "authority": "organization-wide build and evidence doctrine", - "relation": "full operational snapshot at stack root skill-lib/" + "commit": "fb3b53a7629f7f03ecf255167d52c13abef1a979", + "relation": "full operational snapshot at stack root skill-lib/", + "repository": "The-Interdependency/skill-lib" }, { - "repository": "The-Interdependency/metapat", - "commit": "34d954aa1e2092e615b03a180500f6b6977f501e", "authority": "semantic authority (Meta Energy Theory)", - "relation": "pinned canonical repository view at libs/metapat/; stack-local work at research/metapat/" + "commit": "34d954aa1e2092e615b03a180500f6b6977f501e", + "relation": "pinned canonical repository view at libs/metapat/; stack-local work at research/metapat/", + "repository": "The-Interdependency/metapat" }, { - "repository": "The-Interdependency/ucns", - "commit": "828c0b8bbcfc267efb5701da714191c1f73a81ff", "authority": "geometry and mathematical representation", - "relation": "pinned canonical repository view at libs/ucns/; stack-local work at research/ucns/" + "commit": "828c0b8bbcfc267efb5701da714191c1f73a81ff", + "relation": "pinned canonical repository view at libs/ucns/; stack-local work at research/ucns/", + "repository": "The-Interdependency/ucns" }, { - "repository": "The-Interdependency/edcm", - "commit": "7951ca32ba0f2494dc68ff9b7f6a80151918a56d", "authority": "measurement and evaluation of text-domain outputs", - "relation": "pinned canonical repository view at libs/edcm/; stack-local measurement research at research/edcm/; English Gonol construction is separate at research/english-gonol/" + "commit": "7951ca32ba0f2494dc68ff9b7f6a80151918a56d", + "relation": "pinned canonical repository view at libs/edcm/; stack-local measurement research at research/edcm/; English Gonol construction is separate at research/english-gonol/", + "repository": "The-Interdependency/edcm" }, { - "repository": "The-Interdependency/pcea", - "commit": "91ffa8c7249dfb810ca64a0bbc500481c0bd12a9", "authority": "prime circle encryption algorithm", - "relation": "pinned canonical repository view at libs/pcea/; stack-local work at research/pcea/" + "commit": "91ffa8c7249dfb810ca64a0bbc500481c0bd12a9", + "relation": "pinned canonical repository view at libs/pcea/; stack-local work at research/pcea/", + "repository": "The-Interdependency/pcea" }, { - "repository": "The-Interdependency/ptcna", - "commit": "97abdd1bbda61a68e0aac8595a32a3cb0ce73487", "authority": "prime tensor circled neural architecture", - "relation": "pinned canonical repository view at libs/ptcna/; stack-local work at research/ptcna/" + "commit": "97abdd1bbda61a68e0aac8595a32a3cb0ce73487", + "relation": "pinned canonical repository view at libs/ptcna/; stack-local work at research/ptcna/", + "repository": "The-Interdependency/ptcna" }, { + "authority": "independent released EPAC repository; final implementation/public-contract authority receipt pending", + "commit": "949cb1cb304927942966c9fb396caf6227120e7f", + "lifecycle": "released-and-reconsumed", + "relation": "immutable release artifact consumer at integration/epac/; historical forge evidence at research/epac/; libs/epac/ remains unpopulated", + "release": { + "lock": "integration/epac/release-lock.json", + "lock_sha256": "ba28b7e2f72c639c4b5604d673141cef7bcda1712a881972c579e9d02da64953", + "tag": "v0.1.0", + "url": "https://github.com/The-Interdependency/epac/releases/tag/v0.1.0" + }, "repository": "The-Interdependency/epac", - "commit": "d8868858b2e455381ce670797bdbe47189bdc496", - "authority": "independent extracted candidate repository; implementation/public-contract authority transition incomplete", - "relation": "extracted repository on main; stack forge candidate remains at research/epac/ until release and downstream reconsumption; libs/epac/ remains unpopulated" + "upstream": { + "authority_transfer": false, + "commit": "6eea1828a34ed8ec99879f8090ea5d48352d8c2d", + "repository": "The-Interdependency/ucns" + } } ], - "boundaries": { - "authority_transfer": false, - "proof_status_transfer": false, - "measurement_status_transfer": false, - "semantic_mapping": "external-provenance", - "agent_scope": "cross-repository-work-graph", - "hmmm": [ - "ucns has no LICENSE file at snapshot commit 828c0b8", - "epac exists independently at d8868858b2e455381ce670797bdbe47189bdc496, but clean install, license, stable release, downstream reconsumption, and authority-transition receipt remain incomplete; libs/epac/ stays unpopulated until graduation", - "skill-lib remains a special operational snapshot at stack root rather than following the libs/research pair" - ] - }, "research_participants": [ { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "stack-baseline", - "repository": "The-Interdependency/stack", + "authority_transfer": false, + "canonical_release": false, "commit": "77ef8c7fb0ff75a524181655ee9f9641372768f7", + "participant_id": "stack-baseline", "relation": "target composition forge baseline at audit start", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/stack", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "skill-lib", - "repository": "The-Interdependency/skill-lib", + "authority_transfer": false, + "canonical_release": false, "commit": "61eb3b14db440e6ee9b7bf8de3b646dbfd00fb32", + "participant_id": "skill-lib", "relation": "audit, domain-claim, work-graph, and hmmm doctrine", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/skill-lib", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "metapat", - "repository": "The-Interdependency/metapat", + "authority_transfer": false, + "canonical_release": false, "commit": "d6699e21b11c8f8394998efc34a468e2d6efc8b0", + "participant_id": "metapat", "relation": "domain-restraint authority; root impact none", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/metapat", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "ucns", - "repository": "The-Interdependency/ucns", + "authority_transfer": false, + "canonical_release": false, "commit": "ef98748309913588fb13f389f809d5ef6cb5fec3", + "participant_id": "ucns", "relation": "candidate exact visible-circle continuum/gonal trace; no ratification or meaning transfer", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/ucns", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "edcm", - "repository": "The-Interdependency/edcm", + "authority_transfer": false, + "canonical_release": false, "commit": "eb5f200d48a8c4ffa7b943238407fbdac4934946", + "participant_id": "edcm", "relation": "adjacent measurement discipline only; no validation claim", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/edcm", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "pcea", - "repository": "The-Interdependency/pcea", + "authority_transfer": false, + "canonical_release": false, "commit": "834987cb0c1fea5f62d6ea08e5c5bb878c312646", + "participant_id": "pcea", "relation": "adjacent runtime/security work; no ontology transfer", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/pcea", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/from-photons-to-macroverse/", - "participant_id": "epac", - "repository": "The-Interdependency/epac", + "authority_transfer": false, + "canonical_release": false, "commit": "d8868858b2e455381ce670797bdbe47189bdc496", + "participant_id": "epac", "relation": "adjacent internal research; no external physics transfer", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/epac", + "workspace": "research/from-photons-to-macroverse/" }, { - "workspace": "research/english-gonol/", - "participant_id": "english-gonol", - "repository": "The-Interdependency/stack", + "authority_transfer": false, + "canonical_release": false, "commit": "030022948fb7c749961ae65743a4448c4bb6cbbe", + "participant_id": "english-gonol", "relation": "stack-local English lexical/gonol construction separated from EDCM; consumes UCNS geometry; EDCM may evaluate outputs but does not define construction", - "canonical_release": false, - "authority_transfer": false + "repository": "The-Interdependency/stack", + "workspace": "research/english-gonol/" }, { - "workspace": "research/ucns/", - "participant_id": "ucns-source-base", - "repository": "The-Interdependency/ucns", + "authority_transfer": false, + "canonical_release": false, "commit": "1975fe70cf4e0826a8020c2da3047569e277af64", + "participant_id": "ucns-source-base", "relation": "explicit source base for integrated stack-local UCNS research; does not refresh or replace the manifest-pinned libs/ucns canonical view", + "repository": "The-Interdependency/ucns", + "workspace": "research/ucns/" + }, + { + "authority_transfer": false, "canonical_release": false, - "authority_transfer": false + "commit": "0e8384bbb60e4c2189016a212bdd0030d04aed7d", + "participant_id": "epac", + "relation": "historical forge documents and receipts; Python implementation retired in favor of the independent EPAC release", + "repository": "The-Interdependency/stack", + "workspace": "research/epac/" } - ] + ], + "schema": "the-interdependency.stack-manifest", + "version": "1.1.0", + "work_graph_sha256": "23309848ffbcee5775a07f0a517c5658e04a40d5e76f793e5fee6c02caffad58" } diff --git a/tools/check_stack_consistency.py b/tools/check_stack_consistency.py index fed4c38..48ee956 100644 --- a/tools/check_stack_consistency.py +++ b/tools/check_stack_consistency.py @@ -290,6 +290,80 @@ def check_stack_update_skill_provenance(findings: list[str]) -> None: error(findings, "skill.index_drift", f".agents/skills/README.md does not carry provenance value {value!r}") +def check_epac_graduation(manifest: dict[str, Any], findings: list[str]) -> None: + """Check the declared transition's local evidence and severed source path. + + This checks coherent historical evidence, not current public availability or + scientific standing. The EPAC CI consumer independently checks public bytes. + """ + epac = next((r for r in manifest.get("repositories", []) + if r.get("repository") == "The-Interdependency/epac"), {}) + receipt_path = ROOT / "integration/epac/authority-transition.json" + if epac.get("lifecycle") != "graduated" and not receipt_path.exists(): + return + + def require(condition: bool, message: str) -> None: + if not condition: + error(findings, "epac.graduation", message) + + def digest(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + try: + require(epac.get("lifecycle") == "graduated", "completed transition requires graduated lifecycle") + require(epac["authority"] == "independent implementation and public-contract authority for EPAC", "graduated authority projection differs") + require(epac["transition_receipt"] == "integration/epac/authority-transition.json", "unexpected transition receipt path") + require(epac["release"]["lock"] == "integration/epac/release-lock.json", "unexpected release lock path") + lock_path = ROOT / "integration/epac/release-lock.json" + lock = load_json(lock_path) + receipt = load_json(ROOT / "integration/epac/authority-transition.json") + require(receipt["schema"] == "the-interdependency.scoped-authority-transition" and receipt["status"] == "completed" and receipt["lifecycle_state"] == "graduated", "completed scoped transition required") + require(receipt["to"]["repository"] == epac["repository"] and receipt["to"]["source_commit"] == epac["commit"] == lock["source_commit"], "release source identity differs") + require(receipt["to"]["release_tag"] == epac["release"]["tag"] == lock["release_tag"], "release tag differs") + require(lock["phase"] == "graduated", "graduated consumer phase required") + require(digest(lock_path) == epac["release"]["lock_sha256"] == receipt["release_lock_sha256"], "release lock digest differs") + require(receipt["after_work_graph_sha256"] == manifest["work_graph_sha256"], "transition graph differs") + required_gates = {"public_api", "independent_tests", "clean_build_install", "license_distribution_rights", "release_ownership_authority", "provenance_preserved", "exact_candidate_forge_verification", "stable_release", "downstream_reconsumption", "forge_implementation_retired", "clean_retired_source_verification"} + require(set(receipt["gates"]) == required_gates and set(receipt["gates"].values()) == {"pass"}, "complete passed graduation gates required") + require(receipt["scope"] == {"implementation_authority_transfer": True, "public_contract_authority_transfer": True, "semantic_status_transfer": False, "theorem_status_transfer": False, "proof_status_transfer": False, "certification_status_transfer": False, "measurement_status_transfer": False, "empirical_status_transfer": False, "upstream_license_transfer": False, "freshness_authority_transfer": False}, "authority scope differs") + require(not list((ROOT / "research/epac").rglob("*.py")), "forge Python implementation has returned") + expected_evidence = {"public-release.json", "candidate-matrix.json", "reproducibility.json", "stack-candidate.json", "stack-reconsumed.json", "stack-graduated.json", "retirement-inventory.json"} + prefix = "integration/epac/evidence/" + require(set(receipt["evidence"]) == {prefix + name for name in expected_evidence}, "complete evidence inventory required") + records = {} + for name in sorted(expected_evidence): + path = ROOT / prefix / name + require(digest(path) == receipt["evidence"].get(prefix + name), f"evidence digest differs: {name}") + records[name] = load_json(path) + public = records["public-release.json"] + require(public["status"] == "passed" and public["immutable"] is True and public["source_commit"] == epac["commit"], "immutable public release evidence differs") + require({name: item["sha256"] for name, item in lock["assets"].items()} == public["public_assets_sha256"], "public assets differ from lock") + matrix = records["candidate-matrix.json"] + require(matrix["status"] == "passed" and matrix["source_commit"] == epac["commit"] and set(matrix["runtimes"]) == {"3.10", "3.11", "3.12"}, "candidate matrix identity differs") + for runtime in matrix["runtimes"].values(): + require(set(runtime["runs"]) == {"wheel", "sdist"}, "both installed artifacts required") + require(all(run["tests"] == 209 and run["skips"] == 0 for run in runtime["runs"].values()), "complete clean-install tests required") + require(runtime["assets_sha256"] == public["public_assets_sha256"], "matrix candidate bytes differ from publication") + wheel_hash = lock["assets"]["interdependency_epac-0.1.0-py3-none-any.whl"]["sha256"] + for phase in ("candidate", "reconsumed", "graduated"): + record = records[f"stack-{phase}.json"] + require(record["status"] == "passed" and record["phase"] == phase and record["source_unchanged"] is True, f"invalid {phase} consumer evidence") + require(record["artifact_sha256"] == wheel_hash and record["ucns_source_commit"] == epac["upstream"]["commit"], f"{phase} consumer artifact/dependency differs") + require(record["empirical_status_transfer"] is False and len(record["comparison_standings"]) == 14 and set(record["comparison_standings"].values()) == {"FALSIFIED"}, f"{phase} scientific boundary differs") + require(records["stack-graduated.json"]["source_commit"] == receipt["retirement_source_commit"] and records["stack-graduated.json"]["source_tree"] == receipt["retirement_source_tree"], "retirement verification source differs") + inventory = records["retirement-inventory.json"] + require(inventory["epac_commit"] == epac["commit"] and len(inventory["proposed_python_retirements"]) == 37, "retirement source/inventory differs") + for item in inventory["preserved_historical_files"]: + path = ROOT / item["path"] + if item["path"] == "research/epac/README.md": + path = ROOT / "research/epac/README.forge-history.md" + require(digest(path) == item["sha256"], f"retained historical bytes differ: {path.relative_to(ROOT)}") + base = load_json(ROOT / "research/epac/BASE.json") + require(base["source_repository"] == receipt["from"]["repository"] and base["source_commit"] == receipt["from"]["source_commit"] and base["standing"] == "historical-forge-evidence", "historical forge BASE differs") + except (KeyError, TypeError, ValueError, OSError) as exc: + error(findings, "epac.graduation", f"invalid or missing transition evidence: {exc}") + + def main() -> int: findings: list[str] = [] try: @@ -307,6 +381,7 @@ def main() -> int: check_base_records(repositories, research_participant_keys, research_source_identities, readme, findings) check_english_gonol_regression(repositories, research_participant_keys, human, readme, findings) check_stack_update_skill_provenance(findings) + check_epac_graduation(manifest, findings) if findings: for finding in findings: From c81d807142d3f0fe3968a6879888afa00352eaff Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sat, 12 Sep 2026 23:47:50 +0000 Subject: [PATCH 06/10] Record EPAC graduation and close stale authority projections --- README.md | 6 +- STACK_MANIFEST.md | 14 +- docs/work-graphs/repository-plan-report.json | 128 ++++++++++++++++- integration/epac/README.md | 17 +++ integration/epac/authority-transition.json | 72 ++++++++++ .../epac/evidence/stack-graduated.json | 134 ++++++++++++++++++ integration/epac/reconsume.py | 2 +- libs/epac/README.md | 15 -- research/epac/README.md | 2 +- .../tests/test_contracts.py | 4 +- stack-manifest.json | 10 +- tools/check_stack_consistency.py | 8 +- 12 files changed, 377 insertions(+), 35 deletions(-) create mode 100644 integration/epac/authority-transition.json create mode 100644 integration/epac/evidence/stack-graduated.json delete mode 100644 libs/epac/README.md diff --git a/README.md b/README.md index 9bc7c85..6ee79da 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ stack/ │ ├── edcm/ │ ├── pcea/ │ ├── ptcna/ -│ ├── epac/ # unpopulated; EPAC is consumed as a release artifact │ └── skill-lib/ # reserved; root skill-lib/ remains the operational special case ├── research/ # stack-local work; never source authority by location │ ├── metapat/ # current METAPAT research + BASE.json @@ -107,8 +106,9 @@ separated from EDCM but not independently graduated. Psychsocio metafauna and From Photons to the Macroverse remain stack-local pre-graduation research. EPAC has an independently published MPL-2.0 `v0.1.0` release and has passed public Stack reconsumption. Its Python forge copy is retired; -`research/epac/` preserves historical evidence. The final scoped authority receipt -follows the clean retired-source consumer check in `integration/epac/`. +`research/epac/` preserves historical evidence. EPAC is graduated: implementation and public-contract authority belong to the +independent repository, as recorded in +[`integration/epac/authority-transition.json`](integration/epac/authority-transition.json). ```bash python3 integration/epac/reconsume.py \ diff --git a/STACK_MANIFEST.md b/STACK_MANIFEST.md index 1965f95..5a04205 100644 --- a/STACK_MANIFEST.md +++ b/STACK_MANIFEST.md @@ -5,11 +5,12 @@ Provenance and authority-boundary record for `The-Interdependency/stack`. - Source snapshot UTC: `2026-08-22T10:19:43Z` (initial participant snapshot) - Layout migration UTC: `2026-08-30T02:58:49Z` - PCEA canonical refresh UTC: `2026-08-31T07:49:28Z` at `91ffa8c7249dfb810ca64a0bbc500481c0bd12a9` +- EPAC graduation UTC: `2026-09-12`; immutable `v0.1.0`, public reconsumption and scoped implementation/public-contract transition accepted. - EPAC extraction reconciliation UTC: `2026-09-05` at `d8868858b2e455381ce670797bdbe47189bdc496` - English Gonol separation reconciliation UTC: `2026-09-12` at `030022948fb7c749961ae65743a4448c4bb6cbbe` - Stack-manifest schema: `the-interdependency.stack-manifest` version `1.1.0` - Work-graph digest (SHA-256 over canonical `repositories` + `research_participants` + `boundaries` JSON): - `23309848ffbcee5775a07f0a517c5658e04a40d5e76f793e5fee6c02caffad58` + `29e1808cf8c0c6507b9d6509f27d23b1174c21b94033711e05701aed08f56e35` - Machine-readable copy: [`stack-manifest.json`](stack-manifest.json) ## Directory contract @@ -41,7 +42,7 @@ meaning used by that repository. | `The-Interdependency/edcm` | `7951ca32ba0f2494dc68ff9b7f6a80151918a56d` | main | measurement and evaluation of text-domain outputs | canon view `libs/edcm/`; measurement research `research/edcm/`; English Gonol construction is separate at `research/english-gonol/` | | `The-Interdependency/pcea` | `91ffa8c7249dfb810ca64a0bbc500481c0bd12a9` | main | prime circle encryption algorithm | canon view `libs/pcea/`; research `research/pcea/` | | `The-Interdependency/ptcna` | `97abdd1bbda61a68e0aac8595a32a3cb0ce73487` | main | prime tensor circled neural architecture | canon view `libs/ptcna/`; research `research/ptcna/` | -| `The-Interdependency/epac` | `949cb1cb304927942966c9fb396caf6227120e7f` | v0.1.0 | independent released EPAC repository; final implementation/public-contract authority receipt pending | immutable release artifact consumer at integration/epac/; historical forge evidence at research/epac/; libs/epac/ remains unpopulated | +| `The-Interdependency/epac` | `949cb1cb304927942966c9fb396caf6227120e7f` | v0.1.0 | independent implementation and public-contract authority for EPAC | immutable release artifact consumer at integration/epac/; historical forge evidence at research/epac/; libs/epac/ remains unpopulated | ## Research-Only Composition Participants @@ -91,8 +92,8 @@ its source repository must stop claiming the separated responsibility at stack l EPAC is consumed as an immutable release artifact through `integration/epac/`. `research/epac/` retains historical forge evidence at its explicit Stack BASE, with all Python implementation/test copies retired. A `libs/epac/` source mirror is not -required for artifact consumption. Final scoped transition evidence follows the -clean retired-source consumer gate. +required for artifact consumption. The completed scoped authority transition is recorded in +`integration/epac/authority-transition.json`. ## License status at pinned commits @@ -136,8 +137,8 @@ repository, merge it there, then refresh the pinned view. EPAC has passed its licensed candidate matrix, pre-publication Stack check, immutable publication and public Stack reconsumption. The historical implementation path is -retired. The clean retired-source consumer gate and scoped authority-transition -receipt complete the remaining transition. See `integration/epac/` for the immutable +retired. The clean retired-source consumer gate passed, and the completed scoped +authority-transition receipt records EPAC as graduated. See `integration/epac/` for the immutable release lock and acceptance evidence. EPAC consumes exact UCNS `6eea1828a34ed8ec99879f8090ea5d48352d8c2d`; Stack's direct `libs/ucns/` and separate research UCNS pins remain unchanged. @@ -147,6 +148,5 @@ research component, not EDCM and not an independent canonical release. ## hmmm - UCNS has no `LICENSE` file at pinned commit `828c0b8`. -- EPAC final scoped transition receipt awaits the clean retired-source consumer gate. - English Gonol Construction remains stack-local research; independent repository/release authority has not been established. - `skill-lib/` remains a special operational snapshot at stack root rather than following the ordinary `libs/` + `research/` pair. diff --git a/docs/work-graphs/repository-plan-report.json b/docs/work-graphs/repository-plan-report.json index 9622a22..ab44d0d 100644 --- a/docs/work-graphs/repository-plan-report.json +++ b/docs/work-graphs/repository-plan-report.json @@ -1 +1,127 @@ -{"schema":"the-interdependency.repository-plan-report","version":"1.0.0","repository":"The-Interdependency/stack","contract":{"repository":"The-Interdependency/skill-lib","path":"interdependent-work-graph/repository-plan-report.schema.json","version":"1.0.0","blob_sha":"9b347b2dff7692054b571602f30ee6d00c2e7265"},"source":{"branch":"main","commit":"c181a826ac077f12f9134168daa0800ed1986b96","generated_at":"2026-09-06","note":"This report describes the exact repository state immediately beneath the report commit; the report commit is coordination metadata and does not acquire or transfer substantive authority."},"authority":{"owns":["composition-forge layout and stack-local research workspaces","pinned cross-repository composition manifest and authority boundaries","fresh-making orchestration surfaces implemented in stack backend/frontend"],"does_not_own":["canon, proof status, semantic authority, measurement validity, empirical validity, or release authority owned by imported repositories","EPAC implementation/public-contract authority before its graduation transition completes"],"non_transfer":["importing or composing repositories does not transfer their authority","stack-local research does not become source canon by location","executor or derivation success does not by itself establish source-repository validity"]},"portfolio_role":{"summary":"Compose exact pinned views of established repositories, host bounded cross-project research, and incubate new projects while preserving source authority and provenance.","reports_to":{"repository":"The-Interdependency/skill-lib","skill":"interdependent-work-graph","relation":"repo-owned report consumed by the deterministic portfolio projection"}},"status":{"state":"active composition forge with EPAC extraction transition recorded","current_claim":"Stack composes pinned skill-lib, METAPAT, UCNS, EDCM, PCEA, PTCNA, and EPAC identities; established project changes route back to owners, while stack-local research remains non-authoritative until explicitly promoted through owning repositories."},"delivered":[{"surface":"stack-manifest.json / STACK_MANIFEST.md","status":"implemented deterministic bounded work graph","boundary":"pinned identity and relation evidence do not transfer repo authority"},{"surface":"libs/ + research/ split","status":"implemented composition and research boundary","boundary":"libs are pinned views; research is mutable stack-local work"},{"surface":"fresh-making backend and CLI","status":"implemented orchestration control plane","boundary":"orchestration owns freshness evidence, not repository canon or artifacts"}],"active_frontier":["refresh pinned repository views when owners advance and a stack experiment needs the newer state","complete EPAC graduation by release and downstream reconsumption rather than by copying stack research","register organization aggregate and website projection derivations in the fresh-making control plane"],"next_actions":[{"action":"add and maintain this repo-owned portfolio report","owner":"The-Interdependency/stack","dependency":"skill-lib repository-plan-report v1 contract"},{"action":"refresh EPAC consumption only after its graduation gates complete","owner":"The-Interdependency/stack","dependency":"EPAC clean install, license/distribution, immutable release, and authority-transition receipt"}],"blocked":[],"cross_repository_relations":[{"repository":"The-Interdependency/skill-lib","relation":"pinned build/evidence doctrine and work-graph control-plane source","authority_transfer":false},{"repository":"The-Interdependency/metapat","relation":"pinned semantic-authority participant with stack-local research workspace","authority_transfer":false},{"repository":"The-Interdependency/ucns","relation":"pinned geometry/mathematical participant with stack-local research workspace","authority_transfer":false},{"repository":"The-Interdependency/edcm","relation":"pinned measurement/text-construction participant with stack-local research workspace","authority_transfer":false},{"repository":"The-Interdependency/pcea","relation":"pinned encryption/runtime-transform participant with stack-local research workspace","authority_transfer":false},{"repository":"The-Interdependency/ptcna","relation":"pinned neural-architecture research participant with stack-local research workspace","authority_transfer":false},{"repository":"The-Interdependency/epac","relation":"extracted independent candidate originated in stack; authority transition incomplete until release/reconsumption","authority_transfer":false}],"machine_entrypoints":{"repo_report":"docs/work-graphs/repository-plan-report.json","system_overview":"README.md","work_graph":"stack-manifest.json","work_graph_human":"STACK_MANIFEST.md","fresh_making_backend":"backend/README.md","operator_cli":"frontend/cli/README.md"},"hmmm":["EPAC authority transition remains incomplete until release/reconsumption graduation gates pass","organization aggregate and website-projection derivation specs are not yet registered in fresh-making","skill-lib remains a special operational root snapshot rather than the normal libs/research pair"]} +{ + "schema": "the-interdependency.repository-plan-report", + "version": "1.0.0", + "repository": "The-Interdependency/stack", + "contract": { + "repository": "The-Interdependency/skill-lib", + "path": "interdependent-work-graph/repository-plan-report.schema.json", + "version": "1.0.0", + "blob_sha": "9b347b2dff7692054b571602f30ee6d00c2e7265" + }, + "source": { + "branch": "graduate/epac-release-20260912", + "commit": "89ed78e68c11c394d29e4a49e8b23c5dee5303b1", + "generated_at": "2026-09-12", + "note": "Validated retirement source. The subsequent receipt/projection commit records the completed scoped EPAC event and adds the native archive extraction filter; final PR CI reconsumes the same public release at that exact final source." + }, + "authority": { + "owns": [ + "composition-forge layout and stack-local research workspaces", + "pinned cross-repository composition manifest and authority boundaries", + "fresh-making orchestration surfaces implemented in stack backend/frontend" + ], + "does_not_own": [ + "canon, proof status, semantic authority, measurement validity, empirical validity, or release authority owned by imported repositories", + "EPAC implementation/public-contract authority, owned by The-Interdependency/epac after the scoped graduation transition" + ], + "non_transfer": [ + "importing or composing repositories does not transfer their authority", + "stack-local research does not become source canon by location", + "executor or derivation success does not by itself establish source-repository validity" + ] + }, + "portfolio_role": { + "summary": "Compose exact pinned views of established repositories, host bounded cross-project research, and incubate new projects while preserving source authority and provenance.", + "reports_to": { + "repository": "The-Interdependency/skill-lib", + "skill": "interdependent-work-graph", + "relation": "repo-owned report consumed by the deterministic portfolio projection" + } + }, + "status": { + "state": "active composition forge; EPAC graduated and consumed as an immutable public release", + "current_claim": "Stack composes pinned participant identities and consumes independently published MPL-2.0 EPAC v0.1.0 from exact release source 949cb1cb304927942966c9fb396caf6227120e7f. Same-candidate pre-publication verification, public reconsumption and clean retired-source replay passed. All 37 forge Python implementation/test files are retired; 28 historical files retain their actual Stack BASE. The scoped receipt transfers only EPAC implementation/public-contract authority to its independent repository." + }, + "delivered": [ + { + "surface": "stack-manifest.json / STACK_MANIFEST.md", + "status": "implemented deterministic bounded work graph", + "boundary": "pinned identity and relation evidence do not transfer repo authority" + }, + { + "surface": "libs/ + research/ split", + "status": "implemented composition and research boundary", + "boundary": "libs are pinned views; research is mutable stack-local work" + }, + { + "surface": "fresh-making backend and CLI", + "status": "implemented orchestration control plane", + "boundary": "orchestration owns freshness evidence, not repository canon or artifacts" + }, + { + "surface": "EPAC immutable release consumption and scoped graduation", + "status": "accepted public bytes, retired forge Python implementation, preserved history and completed authority receipt", + "boundary": "No scientific, semantic, proof, measurement, upstream-license or freshness status transfers." + } + ], + "active_frontier": [ + "refresh pinned repository views when owners advance and a stack experiment needs the newer state", + "register organization aggregate and website projection derivations in the fresh-making control plane", + "maintain EPAC as a hash-pinned independent release consumer" + ], + "next_actions": [], + "blocked": [], + "cross_repository_relations": [ + { + "repository": "The-Interdependency/skill-lib", + "relation": "pinned build/evidence doctrine and work-graph control-plane source", + "authority_transfer": false + }, + { + "repository": "The-Interdependency/metapat", + "relation": "pinned semantic-authority participant with stack-local research workspace", + "authority_transfer": false + }, + { + "repository": "The-Interdependency/ucns", + "relation": "pinned geometry/mathematical participant with stack-local research workspace", + "authority_transfer": false + }, + { + "repository": "The-Interdependency/edcm", + "relation": "pinned measurement/evaluation participant; English Gonol construction is separate Stack research at research/english-gonol/", + "authority_transfer": false + }, + { + "repository": "The-Interdependency/pcea", + "relation": "pinned encryption/runtime-transform participant with stack-local research workspace", + "authority_transfer": false + }, + { + "repository": "The-Interdependency/ptcna", + "relation": "pinned neural-architecture research participant with stack-local research workspace", + "authority_transfer": false + }, + { + "repository": "The-Interdependency/epac", + "relation": "independent EPAC implementation/public-contract owner; Stack consumes immutable v0.1.0; scoped transition in integration/epac/authority-transition.json", + "authority_transfer": false + } + ], + "machine_entrypoints": { + "repo_report": "docs/work-graphs/repository-plan-report.json", + "system_overview": "README.md", + "work_graph": "stack-manifest.json", + "work_graph_human": "STACK_MANIFEST.md", + "fresh_making_backend": "backend/README.md", + "operator_cli": "frontend/cli/README.md", + "epac_release_consumer": "integration/epac/reconsume.py", + "epac_release_lock": "integration/epac/release-lock.json", + "epac_authority_transition": "integration/epac/authority-transition.json" + }, + "hmmm": [ + "organization aggregate and website-projection derivation specs are not yet registered in fresh-making", + "skill-lib remains a special operational root snapshot rather than the normal libs/research pair", + "EPAC retains 14 FALSIFIED comparisons; geometry ratification and unmeasured operation effects remain unresolved research" + ] +} diff --git a/integration/epac/README.md b/integration/epac/README.md index 88b635a..469d7ea 100644 --- a/integration/epac/README.md +++ b/integration/epac/README.md @@ -5,6 +5,18 @@ not establish empirical validity or change the 14 retained FALSIFIED results, in The independent repository's license and distribution rights must be resolved before a candidate qualifies for stable publication. +## Accepted release + +EPAC v0.1.0 has graduated. The independent repository owns EPAC implementation +and public contracts; Stack consumes its immutable public artifacts. +[`authority-transition.json`](authority-transition.json) binds the before/after +work graphs, public release, all six 209-test installs, pre-publication and public +Stack checks, source retirement and explicit non-transfer boundaries. + +The source archive retains the qualification-time graduation record. The +subsequent lifecycle receipt records the completed event without rewriting the +immutable release bytes. + ## Before publication Build a clean, licensed candidate in the owning EPAC repository with @@ -31,6 +43,11 @@ stable publication. ## Public reconsumption +Use a clean Git checkout with `uv==0.11.18` on PATH. Run the launcher with +Python 3.12 (or a patched interpreter providing `tarfile.data_filter`); the +selected package runtime is a separate argument. The launcher clears inherited +Python import paths and user-site imports for its child environments. + After publishing those verified bytes, record a release lock with: - `release_tag` and exact `source_commit`; diff --git a/integration/epac/authority-transition.json b/integration/epac/authority-transition.json new file mode 100644 index 0000000..cd5876c --- /dev/null +++ b/integration/epac/authority-transition.json @@ -0,0 +1,72 @@ +{ + "after_work_graph_sha256": "29e1808cf8c0c6507b9d6509f27d23b1174c21b94033711e05701aed08f56e35", + "authorization": "User selected execution of stages 1 through 4; weak-copyleft instruction resolved as MPL-2.0 using the organization convention and disclosed before implementation.", + "before_work_graph_sha256": "9ab3b3f75a32f5f73b5df68419148181fc632593babe4ec6adf4269d4f35badb", + "candidate": "EPAC", + "evidence": { + "integration/epac/evidence/candidate-matrix.json": "b7c17232e5286227b0b027fa0e1337d9b04e12243cffa5a80467e166077581ca", + "integration/epac/evidence/public-release.json": "3913e3852676efbb6571c5455f3b82dee1e6edb6852693ef4ac5c808973c8173", + "integration/epac/evidence/reproducibility.json": "17159a5c4bf85f9ccddfe11fc31086176b6694f858295cc2588338763fa9c066", + "integration/epac/evidence/retirement-inventory.json": "a6503035fe1749bfb07e8432c3b5b7df63c825eda424c43d9cdad896791a6aef", + "integration/epac/evidence/stack-candidate.json": "fb891326a7b81b0cda0ef8cc103a0f4b5c8c710b9f33a2079e5e2425b5456498", + "integration/epac/evidence/stack-graduated.json": "3a5f622384694531e29a0861e40728d5bf5de08230ffea6543d375525abd8c54", + "integration/epac/evidence/stack-reconsumed.json": "d6c510c76e54c5974a2834b25e7ba9a90dbf6d4cb7112eb4d7e9f2089cd727eb" + }, + "evidence_interpretation": "Receipts bind their own exact source commits and verifier hashes. The final receipt adds authority/provenance records after the clean retirement commit and the launcher additionally enables the built-in data extraction filter; CI reconsumes the same public bytes again at the final PR head. Earlier reproducibility metadata records the build checkpoint before matrix/consumer acceptance; the later matrix and consumption receipts supply those completed gates.", + "forge_role_after": "consumer of the hash-pinned immutable public release; historical documents retain their actual Stack BASE", + "from": { + "authority": "incubated implementation and public contract", + "repository": "The-Interdependency/stack", + "source_commit": "0e8384bbb60e4c2189016a212bdd0030d04aed7d", + "source_path": "research/epac/" + }, + "gates": { + "clean_build_install": "pass", + "clean_retired_source_verification": "pass", + "downstream_reconsumption": "pass", + "exact_candidate_forge_verification": "pass", + "forge_implementation_retired": "pass", + "independent_tests": "pass", + "license_distribution_rights": "pass", + "provenance_preserved": "pass", + "public_api": "pass", + "release_ownership_authority": "pass", + "stable_release": "pass" + }, + "hmmm": [ + "All 14 comparison standings remain FALSIFIED.", + "Geometry ratification, canonicality/compositionality, PCEA application, and unmeasured operation effects remain unresolved.", + "No PostgreSQL fresh-making acceptance is asserted." + ], + "lifecycle_state": "graduated", + "release_lock_sha256": "ba28b7e2f72c639c4b5604d673141cef7bcda1712a881972c579e9d02da64953", + "retirement_source_commit": "89ed78e68c11c394d29e4a49e8b23c5dee5303b1", + "retirement_source_tree": "1b02799144691f4e08f29efb04f45b7f7c7039e4", + "schema": "the-interdependency.scoped-authority-transition", + "scope": { + "certification_status_transfer": false, + "empirical_status_transfer": false, + "freshness_authority_transfer": false, + "implementation_authority_transfer": true, + "measurement_status_transfer": false, + "proof_status_transfer": false, + "public_contract_authority_transfer": true, + "semantic_status_transfer": false, + "theorem_status_transfer": false, + "upstream_license_transfer": false + }, + "status": "completed", + "to": { + "authority": "independent implementation and public-contract authority for EPAC", + "release_tag": "v0.1.0", + "repository": "The-Interdependency/epac", + "source_commit": "949cb1cb304927942966c9fb396caf6227120e7f" + }, + "upstream": { + "authority_transfer": false, + "commit": "6eea1828a34ed8ec99879f8090ea5d48352d8c2d", + "repository": "The-Interdependency/ucns" + }, + "usage": "Run python3 tools/check_stack_consistency.py and python3 integration/epac/reconsume.py integration/epac/release-lock.json /tmp/epac-public-consumption python3.12 from a clean checkout; use a new output directory outside Stack.", + "version": 1 +} diff --git a/integration/epac/evidence/stack-graduated.json b/integration/epac/evidence/stack-graduated.json new file mode 100644 index 0000000..595268f --- /dev/null +++ b/integration/epac/evidence/stack-graduated.json @@ -0,0 +1,134 @@ +{ + "artifact_sha256": "e871ce7940e963b73664a276cdd8ceea7ac1a5db568c26838cd57217e00adf45", + "comparison_standings": { + "atomic_shells_as_sealed_shape_prediction": "FALSIFIED", + "boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "charged_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "per_symbol_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "periodic_element_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_boundary_capacity_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_harmonic_survival_as_sealed_shape_prediction": "FALSIFIED", + "subatomic_lifted_spiral_as_sealed_shape_prediction": "FALSIFIED", + "topology_3_structure_as_sealed_shape_prediction": "FALSIFIED", + "ucns_mobius_as_sealed_shape_prediction": "FALSIFIED" + }, + "empirical_status_transfer": false, + "epac_version": "0.1.0", + "imported_origins": { + "epac_atomic": "lib/python3.11/site-packages/epac_atomic.py", + "epac_boundary_nondegeneracy": "lib/python3.11/site-packages/epac_boundary_nondegeneracy.py", + "epac_boundary_probe_completeness": "lib/python3.11/site-packages/epac_boundary_probe_completeness.py", + "epac_boundary_quotient": "lib/python3.11/site-packages/epac_boundary_quotient.py", + "epac_comparison": "lib/python3.11/site-packages/epac_comparison.py", + "epac_cross_scale_closure": "lib/python3.11/site-packages/epac_cross_scale_closure.py", + "epac_data": "lib/python3.11/site-packages/epac_data/__init__.py", + "epac_dimensional_arity": "lib/python3.11/site-packages/epac_dimensional_arity.py", + "epac_evidence_cache": "lib/python3.11/site-packages/epac_evidence_cache.py", + "epac_molecular": "lib/python3.11/site-packages/epac_molecular.py", + "epac_periodic": "lib/python3.11/site-packages/epac_periodic.py", + "epac_public_gonol": "lib/python3.11/site-packages/epac_public_gonol.py", + "epac_subatomic": "lib/python3.11/site-packages/epac_subatomic/__init__.py", + "epac_subatomic.element_affixiation_candidate": "lib/python3.11/site-packages/epac_subatomic/element_affixiation_candidate.py", + "epac_subatomic.extended_atomic": "lib/python3.11/site-packages/epac_subatomic/extended_atomic.py", + "epac_subatomic.nuclear_harmonic_candidates": "lib/python3.11/site-packages/epac_subatomic/nuclear_harmonic_candidates.py", + "epac_subatomic.subatomic_gonol": "lib/python3.11/site-packages/epac_subatomic/subatomic_gonol.py", + "epac_ucns_provenance": "lib/python3.11/site-packages/epac_ucns_provenance.py", + "epac_viz": "lib/python3.11/site-packages/epac_viz/__init__.py", + "epac_viz.spiral_viz": "lib/python3.11/site-packages/epac_viz/spiral_viz.py", + "ucns": "lib/python3.11/site-packages/ucns/__init__.py", + "ucns.carrier": "lib/python3.11/site-packages/ucns/carrier.py", + "ucns.direct_mobius": "lib/python3.11/site-packages/ucns/direct_mobius.py", + "ucns.gonal_boundary_trace": "lib/python3.11/site-packages/ucns/gonal_boundary_trace.py", + "ucns.mobius_seed": "lib/python3.11/site-packages/ucns/mobius_seed.py", + "ucns.mobius_vesica": "lib/python3.11/site-packages/ucns/mobius_vesica.py", + "ucns.modular_orbit": "lib/python3.11/site-packages/ucns/modular_orbit.py", + "ucns.public_gonol": "lib/python3.11/site-packages/ucns/public_gonol.py" + }, + "installed_payload_sha256": { + "epac_atomic.py": "1ef464df3e984320499c1a421d49d3b5c36e0d5bcdfc93176394d34cd71c59fb", + "epac_boundary_minimal_refinement.py": "168943a1d198147d5e91c21069c06d343366979b6dffacf1e2ee664d3b6edce8", + "epac_boundary_nondegeneracy.py": "e67edf2c171b178873f21eeadc743581c83dff7abb0d6e32cd643843627c2306", + "epac_boundary_probe_completeness.py": "8dad10b3ac9d3873f134af131488463511b8e66ecefc7fdb82609e92fa328eb9", + "epac_boundary_quotient.py": "91a966c68d65938a9e2641a10b8b2935fe1992fdc70f129b9424290b38b3ab98", + "epac_comparison.py": "7283c099923310f8dae24d577505b54c25919290b358be2aefa5fde1b8285535", + "epac_cross_scale_closure.py": "9cf3a0c76e17076217dd0c90f467d45a2aa0647754a031f6f826dc3f3a9e9e2c", + "epac_data/__init__.py": "7ea12c7477b04457888ca5d8cdc5c322b26af0c14959878dd2d00df0aa3619d3", + "epac_data/periodic_table_z1_18.json": "748de9e986eaaa588092796d00d8e5d464c14d6308673402b4f6ac98ca81df19", + "epac_data/sealed_known_molecular_geometry.json": "8e8e8382a86bdeeb7720a14f6370e0b8c142729e2092f58a97ba8108fd4ef7d3", + "epac_data/ucns-source-lock.json": "5f072d8c900ab0912fe35b2d2d6480ce09b14f280cb98e394ced13c130a145f3", + "epac_dimensional_arity.py": "5ed353191c853aaeecb62ba520ce89010682949053c8d6a04315531ec3c7429c", + "epac_evidence_cache.py": "927ac252d608e4af0b1a90e8686e764851de2ff71b674a0d56265ecf0422381a", + "epac_molecular.py": "0fce13c83ea65a21ad81acd206927dedbaae336d7d980bd1dbd0858f58537108", + "epac_periodic.py": "20474c25aaad15121efc2010227071bd31d1304080dfe45f2aa1115edb95d332", + "epac_public_gonol.py": "1a088076a19aba34a281ba1b3c25f47dee962a0aa8e61915bfe44e7b94357697", + "epac_subatomic/__init__.py": "492711dba97ef160f14772b71fb75bda0abb5b0828b21ab989a06e84ccaae4b8", + "epac_subatomic/element_affixiation_candidate.py": "3a282b1911657f7482dc08023b76e206f96210b90685f0caad4ecc689406b004", + "epac_subatomic/extended_atomic.py": "7818c546c95d8f8ca7699e4c2133520f3ffef1e48b26accd978decf1fa2c6302", + "epac_subatomic/nuclear_harmonic_candidates.py": "90f6c4ce1b8c1caf0d9c5605c65b2100a63089a1563858d6e91fee01721fdef6", + "epac_subatomic/receipts/c.json": "f957a829d9c246521113b435fff57f9f96f7171675bf28e27c1cdce78999ea30", + "epac_subatomic/receipts/gonol_c.json": "ec5c8d7121388405f0fa15c4a0ddb0879d3ae1cfd653faa9ac446553ae4e88a1", + "epac_subatomic/receipts/gonol_h.json": "864cf67e78e69a6c5255941e67c99bbfccab155b2fa5b5a01370852a3cfb2194", + "epac_subatomic/receipts/gonol_he.json": "46493d333082c3bff3fe551b235ef1b8d70be6601af7d6703fb1c2a90fda9d14", + "epac_subatomic/receipts/gonol_li.json": "3090fbf140c01672b0f19e86b62a7189c283c778b39b6c8d4d7a07cb14b121d2", + "epac_subatomic/receipts/h.json": "0fbeb009859592a18d14e0d44539637306ef6a9b14b54c7b55027fd2ea2b659b", + "epac_subatomic/receipts/harmonic_alpha_cluster_recurrence.json": "d45969aa486d1b49a23840940a76338f943a946a8524b284bb6359fa4c300de1", + "epac_subatomic/receipts/harmonic_binding_per_nucleon_commensurability.json": "5fd72fac99ea3f66218e97cbcbee9907d990375c0808022b3b517ee136932e31", + "epac_subatomic/receipts/harmonic_ground_state_spin_parity_symmetry.json": "9095ff2a16d1ccfb0b6bbc79eb46702abdafa08113b62a709c878ec3a2a4fe8f", + "epac_subatomic/receipts/harmonic_n_z_ratio_commensurability.json": "fa364116c0d4ceab3403a422e6c62bdcff2dc7c2375329add73cdb5d1dca683c", + "epac_subatomic/receipts/harmonic_proton_neutron_inversion_symmetry.json": "1505af798120449ad64e0cc4352afeebf0f4d2ca1e3e680f9651e4e0163e6a4a", + "epac_subatomic/receipts/he.json": "761d160209318acca3773bd1669dbc8eb4587e141926dc45684aea38f60d7c5c", + "epac_subatomic/receipts/history/harmonic_binding_per_nucleon_commensurability-ba93ccda9da20f9184d5db87c0d83c3b610bd48699a6c4886c790e89651f3e33.json": "f167754001eb500261198914eb6f66b0af151b59ca5d6fcc1a1ee7ff2182deca", + "epac_subatomic/receipts/history/harmonic_ground_state_spin_parity_symmetry-25ed793cb1584a38c0d2185451e389068b0622990054729efb7b3e178bf31680.json": "cde788f5eccbede6c6edb63505ea11687729647c848a11b5f1d25e72896c33ee", + "epac_subatomic/receipts/history/harmonic_ground_state_spin_parity_symmetry-packaged-7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f.json": "7cc2c97c60ed00decaf389c7592d0fb03367066086dcc3a0135140fe6ecba71f", + "epac_subatomic/receipts/li.json": "a407cf2345037a0ca9c064eaea266a886de927044a65b4dd03c4f9dfea55c8a0", + "epac_subatomic/receipts/ucns-6eea182/c.json": "1ac20a133db5b964f3206215c54b744034c0bea212726e0dc182336bc81abe33", + "epac_subatomic/receipts/ucns-6eea182/h.json": "b9dd3b0d026b79d3575b915f1ad036a8e2229e170624bde0cacea454149c21c3", + "epac_subatomic/receipts/ucns-6eea182/he.json": "c8a95b058c996637dfa7e7b9ed2a8a775518aa8966aa7d22b79780fee1d182f5", + "epac_subatomic/receipts/ucns-6eea182/li.json": "5570921a4af22c10dba76c2a67fa70f884cf9ccee64db811bfecc79773cc6a86", + "epac_subatomic/receipts/ucns-828c0b8/c.json": "c486a418c2fd020e72bd16ef8b107feaabc854950d32c6deeb65176ae76c5b91", + "epac_subatomic/receipts/ucns-828c0b8/h.json": "0104494752c1f72eb7629defb25db6ff4687767fc038e90c3ac2054c94cb251e", + "epac_subatomic/receipts/ucns-828c0b8/he.json": "4273b4345464dc121f46523b67167688b537b946bcb15a9206cb10460a19cff1", + "epac_subatomic/receipts/ucns-828c0b8/li.json": "e41c5214327f2ddb76e0aa2d7cf15f4255530522bf5ba8879ddc933b3182fdf8", + "epac_subatomic/receipts/ucns-be42dfc/c.json": "1da011a700b4b2c518ee1bf497acc1cc691fecf8b379ad833202cb7cdd11e23f", + "epac_subatomic/receipts/ucns-be42dfc/h.json": "4e36f5c883d23d96ae800e1e32ad91af45979df1a193b516c78b93a4e3affa8b", + "epac_subatomic/receipts/ucns-be42dfc/he.json": "7230fbf210e5c78ae8bba5ebbff8557b7a5664841824d6aacdf106c5240895dd", + "epac_subatomic/receipts/ucns-be42dfc/li.json": "fc96542cbc11901fcbbea155e2ce463bcfbf610a4ae7aff0225cc5f2afc60437", + "epac_subatomic/subatomic-affixiation-baseline.md": "a7e4e5d44c149fa60bf03ae34cf4eb2a5178ca0f41361d4736e43798ae5e8a19", + "epac_subatomic/subatomic_gonol.py": "3e97f3406eb3406aeb8fa30ec33778226fbc1ab9d2b368f60c2df0a9b0865cda", + "epac_subatomic/symbol_coupling.py": "dbd2cc072291f31798c5db6bd4935f80218135c2a4da5c33776cfb0f6cc285b2", + "epac_ucns_provenance.py": "3ce5de529af6642427df146f3e1721be75ef82d552b824691652ee90cba205e5", + "epac_viz/README.md": "f4a880fcc32a0f750ceec7fe589b48905df6c46ebb4aa6fee6287cb1cc583fbd", + "epac_viz/__init__.py": "6c6dea83d6381b5ee7beebc66592d60831d6df791ad05e3335318e6adc479c0a", + "epac_viz/__main__.py": "5d34e27b2bef8c2cf52fd2f419a424c530d5c0a1f422b3f0339bf2727d0c6495", + "epac_viz/carbon_lifted_spiral.svg": "c96e9249b0f33ba09336ccc94e93fa47a89c687b6b15316a7272b4b31698880a", + "epac_viz/cli.py": "85018412bf5d4b7c3e2d0f9a85b3bd64bdc09ec2b6b74ce4492f0e5c7b0adb0e", + "epac_viz/h2o_lifted_spiral.svg": "c3e651ed0ff231bc75fe9d021abdacd504f1bc171cc4b6447204c23d72189d99", + "epac_viz/spiral_viz.py": "b7bb06a4160d09e7461fd10dc60d7c2ba2fe3b3b6b233a7da20b27c6322a62a9" + }, + "molecular_receipts": { + "BF3": "729762cea3a9589e525ea3049e9588b4f7288434418da02a8f8c25f41dc56ac9", + "CH4": "3624369d468d7b16b5b3c807cdd3bbccbe588e61fc13d8ba7dfad7cb846c219b", + "CO2": "90af93faedaf75e285b07506a272ee58029ae646206b63dcd0f5794d962a1528", + "H2": "d5b616799c9e56135bc82b016f4534a1e20edd79dd0ed581bca92b20331ca3e3", + "H2O": "cfac71635e0c49ff842bf04d2719bf1f051106ec5fb3d5ffbd922c8c7c08aaaa", + "H2S": "0fb222c67c6cee19d4748d0e1cb4d68d6850ab42ee32818b319f574f89d48ade", + "NH3": "2a1c12a6bf4fcf844e2e860df4b4db244c1aac77478002c86fbf2e4ff52abb2c", + "PH3": "f5790091f5c98cbaff41a5d8fbaafaa804cee94966073e183b94544d0b4ba2e3", + "SiH4": "679a1be1f05d9a28e6880d68085ed1b74ee1267892d30aac7321068f071a566c" + }, + "phase": "graduated", + "public_gonol_receipt": "731e6278b5cc663cc76429f655b21c84c06dfbe8249bda95df25ae0343ccb1ff", + "python": "3.11.15 (main, May 10 2026, 19:28:18) [Clang 22.1.3 ]", + "schema": "stack.epac-artifact-consumption", + "source_commit": "89ed78e68c11c394d29e4a49e8b23c5dee5303b1", + "source_tree": "1b02799144691f4e08f29efb04f45b7f7c7039e4", + "source_unchanged": true, + "status": "passed", + "ucns_source_commit": "6eea1828a34ed8ec99879f8090ea5d48352d8c2d", + "verifier_sha256": "c233076a65968d80cae697eb04fcd8d34b2ae0233d3f3da75aa34032d182f6b2", + "version": 1 +} diff --git a/integration/epac/reconsume.py b/integration/epac/reconsume.py index 4b89546..98733b7 100644 --- a/integration/epac/reconsume.py +++ b/integration/epac/reconsume.py @@ -88,7 +88,7 @@ def main() -> None: if name.is_absolute() or ".." in name.parts or not (member.isfile() or member.isdir()) or member.name in seen: raise ValueError("unsafe source archive") seen.add(member.name) - archive.extractall(source) + archive.extractall(source, filter="data") roots = list(source.iterdir()) if len(roots) != 1 or not roots[0].is_dir(): raise ValueError("source archive root mismatch") diff --git a/libs/epac/README.md b/libs/epac/README.md deleted file mode 100644 index 8f35373..0000000 --- a/libs/epac/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# libs/epac — canonical slot not yet populated - -`libs/epac/` is reserved for a pinned view of an independent canonical EPAC repository **after graduation**. - -Current EPAC work lives in [`../../research/epac/`](../../research/epac/) and is stack-local research, not canon. Do not copy that research tree here as a promotion shortcut. - -## Usage guidance - -- Read current candidate work in `research/epac/`. -- Leave this slot unpopulated until an owning `The-Interdependency/epac` repository exists. -- After graduation, populate this directory only from an exact canonical EPAC commit and record it in `STACK_MANIFEST.md` and `stack-manifest.json`. - -## hmmm - -The independent EPAC repository, package identity, and graduation commit do not yet exist. diff --git a/research/epac/README.md b/research/epac/README.md index 32c2d25..1195357 100644 --- a/research/epac/README.md +++ b/research/epac/README.md @@ -2,7 +2,7 @@ The active implementation is owned by [The-Interdependency/epac](https://github.com/The-Interdependency/epac). Stack has reconsumed its immutable MPL-2.0 `v0.1.0` release and retired the 37 -forge Python implementation/test files. Final transition evidence is recorded +forge Python implementation/test files. The completed scoped authority-transition receipt is recorded under [`integration/epac/`](../../integration/epac/). This directory preserves historical documents, data, SVGs and receipts from diff --git a/research/psychsocio-metafauna/tests/test_contracts.py b/research/psychsocio-metafauna/tests/test_contracts.py index 118da54..3a4c196 100644 --- a/research/psychsocio-metafauna/tests/test_contracts.py +++ b/research/psychsocio-metafauna/tests/test_contracts.py @@ -229,9 +229,11 @@ def test_human_and_machine_entrypoints_agree(self) -> None: self.assertIn("psychsocio-metafauna/ # proposed", root_readme) self.assertIn( - "EPAC and psychsocio metafauna are currently in this pre-graduation state.", + "Psychsocio metafauna and From Photons to the Macroverse remain stack-local\npre-graduation research.", root_readme, ) + self.assertIn("EPAC is graduated", root_readme) + self.assertIn("integration/epac/authority-transition.json", root_readme) if __name__ == "__main__": diff --git a/stack-manifest.json b/stack-manifest.json index 66a7ca2..f71ea93 100644 --- a/stack-manifest.json +++ b/stack-manifest.json @@ -4,8 +4,7 @@ "authority_transfer": false, "hmmm": [ "ucns has no LICENSE file at snapshot commit 828c0b8", - "skill-lib remains a special operational snapshot at stack root rather than following the libs/research pair", - "EPAC public release and reconsumption passed; clean retired-source verification and the final scoped transition receipt remain pending" + "skill-lib remains a special operational snapshot at stack root rather than following the libs/research pair" ], "measurement_status_transfer": false, "proof_status_transfer": false, @@ -49,9 +48,9 @@ "repository": "The-Interdependency/ptcna" }, { - "authority": "independent released EPAC repository; final implementation/public-contract authority receipt pending", + "authority": "independent implementation and public-contract authority for EPAC", "commit": "949cb1cb304927942966c9fb396caf6227120e7f", - "lifecycle": "released-and-reconsumed", + "lifecycle": "graduated", "relation": "immutable release artifact consumer at integration/epac/; historical forge evidence at research/epac/; libs/epac/ remains unpopulated", "release": { "lock": "integration/epac/release-lock.json", @@ -60,6 +59,7 @@ "url": "https://github.com/The-Interdependency/epac/releases/tag/v0.1.0" }, "repository": "The-Interdependency/epac", + "transition_receipt": "integration/epac/authority-transition.json", "upstream": { "authority_transfer": false, "commit": "6eea1828a34ed8ec99879f8090ea5d48352d8c2d", @@ -161,5 +161,5 @@ ], "schema": "the-interdependency.stack-manifest", "version": "1.1.0", - "work_graph_sha256": "23309848ffbcee5775a07f0a517c5658e04a40d5e76f793e5fee6c02caffad58" + "work_graph_sha256": "29e1808cf8c0c6507b9d6509f27d23b1174c21b94033711e05701aed08f56e35" } diff --git a/tools/check_stack_consistency.py b/tools/check_stack_consistency.py index 48ee956..c2743d5 100644 --- a/tools/check_stack_consistency.py +++ b/tools/check_stack_consistency.py @@ -299,7 +299,13 @@ def check_epac_graduation(manifest: dict[str, Any], findings: list[str]) -> None epac = next((r for r in manifest.get("repositories", []) if r.get("repository") == "The-Interdependency/epac"), {}) receipt_path = ROOT / "integration/epac/authority-transition.json" - if epac.get("lifecycle") != "graduated" and not receipt_path.exists(): + has_transition = ( + epac.get("lifecycle") in {"released-and-reconsumed", "graduated"} + or "release" in epac + or receipt_path.exists() + or epac.get("authority") == "independent implementation and public-contract authority for EPAC" + ) + if not has_transition: return def require(condition: bool, message: str) -> None: From 745ff5e54dff52089889a7f9ca2ba87cb39bbd0f Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sun, 13 Sep 2026 00:27:25 +0000 Subject: [PATCH 07/10] Bind EPAC history to Git objects and preserve exact evidence identities --- .github/workflows/epac.yml | 1 + .github/workflows/python-gonol.yml | 2 ++ .github/workflows/stack-consistency.yml | 6 ++++ docs/work-graphs/repository-plan-report.json | 23 ++++++++---- integration/epac/README.md | 4 ++- tools/check_stack_consistency.py | 38 ++++++++++++++++---- 6 files changed, 60 insertions(+), 14 deletions(-) diff --git a/.github/workflows/epac.yml b/.github/workflows/epac.yml index ef65f6f..bb459e9 100644 --- a/.github/workflows/epac.yml +++ b/.github/workflows/epac.yml @@ -18,6 +18,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.sha }} persist-credentials: false + fetch-depth: 0 - uses: actions/setup-python@v7 with: python-version: "3.12" diff --git a/.github/workflows/python-gonol.yml b/.github/workflows/python-gonol.yml index 89fa21a..8d0ac40 100644 --- a/.github/workflows/python-gonol.yml +++ b/.github/workflows/python-gonol.yml @@ -29,6 +29,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + with: + fetch-depth: 0 - uses: actions/setup-python@v6 with: python-version: "3.12" diff --git a/.github/workflows/stack-consistency.yml b/.github/workflows/stack-consistency.yml index 3b0f5c8..050fbf6 100644 --- a/.github/workflows/stack-consistency.yml +++ b/.github/workflows/stack-consistency.yml @@ -10,6 +10,8 @@ on: - 'research/**' - 'libs/**' - 'tools/check_stack_consistency.py' + - 'integration/epac/**' + - 'docs/work-graphs/repository-plan-report.json' - '.agents/skills/stack-update/**' - '.github/workflows/stack-consistency.yml' push: @@ -22,6 +24,8 @@ on: - 'research/**' - 'libs/**' - 'tools/check_stack_consistency.py' + - 'integration/epac/**' + - 'docs/work-graphs/repository-plan-report.json' - '.agents/skills/stack-update/**' - '.github/workflows/stack-consistency.yml' @@ -33,5 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Verify stack authority and provenance projections run: python tools/check_stack_consistency.py diff --git a/docs/work-graphs/repository-plan-report.json b/docs/work-graphs/repository-plan-report.json index 06c035d..ea3abfc 100644 --- a/docs/work-graphs/repository-plan-report.json +++ b/docs/work-graphs/repository-plan-report.json @@ -10,9 +10,9 @@ }, "source": { "branch": "graduate/epac-release-20260912", - "commit": "c81d807142d3f0fe3968a6879888afa00352eaff", - "generated_at": "2026-09-12", - "note": "Completed EPAC lifecycle documentation source. The current receipt preserves that original event using byte-exact manifest snapshots; subsequent Stack changes and release pins are checked separately." + "commit": "1c6ec9fb85d2ead58b13d806a5c4a9bc3803c936", + "generated_at": "2026-09-13", + "note": "Post-merge repository state includes the independent EPAC consumer and Python/English Gonol workspaces. The historical EPAC event remains separately pinned in its receipt." }, "authority": { "owns": [ @@ -40,7 +40,7 @@ }, "status": { "state": "active composition forge; EPAC graduated and consumed as an immutable public release", - "current_claim": "Stack composes pinned participant identities and consumes independently published MPL-2.0 EPAC v0.1.0 from exact release source 949cb1cb304927942966c9fb396caf6227120e7f. Same-candidate pre-publication verification, public reconsumption and clean retired-source replay passed. All 37 forge Python implementation/test files are retired; 28 historical files retain their actual Stack BASE. The scoped receipt transfers only EPAC implementation/public-contract authority to its independent repository." + "current_claim": "Stack composes pinned participant identities and consumes independently published MPL-2.0 EPAC v0.1.0 from exact release source 949cb1cb304927942966c9fb396caf6227120e7f. Same-candidate pre-publication verification, public reconsumption and clean retired-source replay passed. All 37 forge Python implementation/test files are retired; 28 historical files retain their actual Stack BASE. The scoped receipt transfers only EPAC implementation/public-contract authority to its independent repository. Python Gonol source-affixiation and English Gonol character-floor construction are current Stack research workspaces; their inclusion transfers no language, semantic, geometry or release authority." }, "delivered": [ { @@ -62,12 +62,18 @@ "surface": "EPAC immutable release consumption and scoped graduation", "status": "accepted public bytes, retired forge Python implementation, preserved history and completed authority receipt", "boundary": "No scientific, semantic, proof, measurement, upstream-license or freshness status transfers." + }, + { + "surface": "research/python-gonol/ and research/english-gonol/", + "status": "Python source-affixiation and English character-floor constructions integrated from main f0376a839bb8849f05b4cb89751d36a6aaf075bb", + "boundary": "Stack-local research with declared provenance; no independent repository/release authority or language-authority transfer." } ], "active_frontier": [ "refresh pinned repository views when owners advance and a stack experiment needs the newer state", "register organization aggregate and website projection derivations in the fresh-making control plane", - "maintain EPAC as a hash-pinned independent release consumer" + "maintain EPAC as a hash-pinned independent release consumer", + "Maintain Python and English Gonol construction/replay as bounded Stack research against their declared source and geometry identities." ], "next_actions": [], "blocked": [], @@ -117,11 +123,14 @@ "operator_cli": "frontend/cli/README.md", "epac_release_consumer": "integration/epac/reconsume.py", "epac_release_lock": "integration/epac/release-lock.json", - "epac_authority_transition": "integration/epac/authority-transition.json" + "epac_authority_transition": "integration/epac/authority-transition.json", + "python_gonol": "research/python-gonol/README.md", + "english_gonol": "research/english-gonol/README.md" }, "hmmm": [ "organization aggregate and website-projection derivation specs are not yet registered in fresh-making", "skill-lib remains a special operational root snapshot rather than the normal libs/research pair", - "EPAC retains 14 FALSIFIED comparisons; geometry ratification and unmeasured operation effects remain unresolved research" + "EPAC geometry ratification and unmeasured operation effects remain unresolved research", + "Python Gonol exhaustive CPython 3.12 grammar/test-corpus parity, later language profiles, and exact UCNS affixiation/coupling operations remain unresolved." ] } diff --git a/integration/epac/README.md b/integration/epac/README.md index f7e4264..fb41fac 100644 --- a/integration/epac/README.md +++ b/integration/epac/README.md @@ -63,7 +63,9 @@ compares its UCNS pin with the producer's hash-bound source lock before install. The graduation event remains separately bound to the archived `evidence/graduation-release-lock.json` and byte-exact before/after manifest -snapshots, including their source commit and Git blob identities. Its qualification +snapshots, including their source commit and Git blob identities. The checker reads the +actual files from those Git commits; use a full-history checkout (`git fetch +--unshallow` for a shallow clone). CI fetches the required history. Its qualification and consumer receipts describe the original v0.1.0 transition. Later participant graph changes or accepted EPAC release updates do not rewrite that history; current public-consumer CI must pass at the new Stack source before accepting a diff --git a/tools/check_stack_consistency.py b/tools/check_stack_consistency.py index 031bacb..ce911de 100644 --- a/tools/check_stack_consistency.py +++ b/tools/check_stack_consistency.py @@ -14,7 +14,7 @@ # tests: exercised in .github/workflows/stack-consistency.yml and by local invocation # rollout: required structural drift gate # rollback: revert checker/workflow together only if replaced by an equivalent or stricter gate -# requires: Python standard library, stack-manifest.json, STACK_MANIFEST.md +# requires: Python standard library, Git with full repository history, stack-manifest.json, STACK_MANIFEST.md # since: 2026-09-12 # unresolved: semantic responsibility cannot be inferred exhaustively from source code # === END MODULE_BUILD === @@ -59,16 +59,20 @@ python tools/check_stack_consistency.py -The command is intentionally read-only and stdlib-only. Exit status 0 means the +Use a Git checkout with the historical commits named by the EPAC transition +receipt (`git fetch --unshallow` for a shallow clone). The command is read-only +and uses the Python standard library plus Git. Exit status 0 means the checks implemented here agree; it does not promote research to canon or prove any scientific, semantic, measurement, or graduation claim. """ from __future__ import annotations +import ast import hashlib import json import re +import subprocess import sys from pathlib import Path from typing import Any @@ -315,6 +319,15 @@ def require(condition: bool, message: str) -> None: def digest(path: Path) -> str: return hashlib.sha256(path.read_bytes()).hexdigest() + def committed_bytes(commit: str, path: str) -> bytes: + if HEX40.fullmatch(commit) is None: + raise ValueError("invalid historical source commit") + result = subprocess.run(["git", "-C", str(ROOT), "show", commit + ":" + path], + check=False, capture_output=True) + if result.returncode: + raise ValueError(f"missing historical Git object {commit}:{path}; fetch full history before checking") + return result.stdout + try: require(epac.get("lifecycle") == "graduated", "completed transition requires graduated lifecycle") require(epac["authority"] == "independent implementation and public-contract authority for EPAC", "graduated authority projection differs") @@ -347,7 +360,9 @@ def digest(path: Path) -> str: required_gates = {"public_api", "independent_tests", "clean_build_install", "license_distribution_rights", "release_ownership_authority", "provenance_preserved", "exact_candidate_forge_verification", "stable_release", "downstream_reconsumption", "forge_implementation_retired", "clean_retired_source_verification"} require(set(receipt["gates"]) == required_gates and set(receipt["gates"].values()) == {"pass"}, "complete passed graduation gates required") require(receipt["scope"] == {"implementation_authority_transfer": True, "public_contract_authority_transfer": True, "semantic_status_transfer": False, "theorem_status_transfer": False, "proof_status_transfer": False, "certification_status_transfer": False, "measurement_status_transfer": False, "empirical_status_transfer": False, "upstream_license_transfer": False, "freshness_authority_transfer": False}, "authority scope differs") - require(not list((ROOT / "research/epac").rglob("*.py")), "forge Python implementation has returned") + history_root = ROOT / "research/epac" + require(not history_root.is_symlink() and not any(path.is_symlink() for path in history_root.rglob("*")), "historical research path contains a symlink") + require(not list(history_root.rglob("*.py")), "forge Python implementation has returned") expected_evidence = {"public-release.json", "candidate-matrix.json", "reproducibility.json", "stack-candidate.json", "stack-reconsumed.json", "stack-graduated.json", "retirement-inventory.json", "graduation-release-lock.json", "transition-before-manifest.json", "transition-after-manifest.json"} prefix = "integration/epac/evidence/" require(set(receipt["evidence"]) == {prefix + name for name in expected_evidence}, "complete evidence inventory required") @@ -369,7 +384,9 @@ def digest(path: Path) -> str: snapshot = records[name] require(identity["path"] == prefix + name and identity["source_repository"] == "The-Interdependency/stack" and identity["source_path"] == "stack-manifest.json", f"{phase} historical manifest location differs") require(HEX40.fullmatch(identity["source_commit"]) is not None and HEX40.fullmatch(identity["source_blob_sha"]) is not None, f"{phase} historical Git identity invalid") - require(git_blob_sha((ROOT / prefix / name).read_bytes()) == identity["source_blob_sha"], f"{phase} historical manifest blob differs") + snapshot_bytes = (ROOT / prefix / name).read_bytes() + require(git_blob_sha(snapshot_bytes) == identity["source_blob_sha"], f"{phase} historical manifest blob differs") + require(snapshot_bytes == committed_bytes(identity["source_commit"], "stack-manifest.json"), f"{phase} snapshot differs from claimed immutable Git source") require(manifest_digest(snapshot) == snapshot["work_graph_sha256"] == receipt[f"{phase}_work_graph_sha256"], f"{phase} historical graph differs") snapshots[phase] = snapshot require(receipt["transition_manifests"]["before"]["source_commit"] == receipt["from"]["source_commit"], "starting manifest source differs from forge source") @@ -392,11 +409,17 @@ def digest(path: Path) -> str: reproducibility = records["reproducibility.json"] require(reproducibility["status"] == "passed" and reproducibility["source_commit"] == lock["source_commit"] and reproducibility["artifacts_sha256"] == public["public_assets_sha256"] and set(reproducibility["umasks"]) == {"022", "077"}, "historical reproducible candidate differs") wheel_hash = lock["assets"]["interdependency_epac-0.1.0-py3-none-any.whl"]["sha256"] + historical_verifier = committed_bytes(receipt["retirement_source_commit"], "integration/epac/verify_release.py") + declarations = [node.value for node in ast.parse(historical_verifier).body + if isinstance(node, ast.Assign) and any(isinstance(target, ast.Name) and target.id == "EXPECTED_STANDINGS" for target in node.targets)] + require(len(declarations) == 1, "historical verifier standings declaration missing or ambiguous") + expected_standings = ast.literal_eval(declarations[0]) + require(len(expected_standings) == 14 and set(expected_standings.values()) == {"FALSIFIED"}, "historical verifier standing contract differs") for phase in ("candidate", "reconsumed", "graduated"): record = records[f"stack-{phase}.json"] require(record["status"] == "passed" and record["phase"] == phase and record["source_unchanged"] is True, f"invalid {phase} consumer evidence") require(record["artifact_sha256"] == wheel_hash and record["ucns_source_commit"] == receipt["upstream"]["commit"], f"{phase} consumer artifact/dependency differs") - require(record["empirical_status_transfer"] is False and len(record["comparison_standings"]) == 14 and set(record["comparison_standings"].values()) == {"FALSIFIED"}, f"{phase} scientific boundary differs") + require(record["empirical_status_transfer"] is False and record["comparison_standings"] == expected_standings, f"{phase} scientific boundary differs") require(records["stack-graduated.json"]["source_commit"] == receipt["retirement_source_commit"] and records["stack-graduated.json"]["source_tree"] == receipt["retirement_source_tree"], "retirement verification source differs") inventory = records["retirement-inventory.json"] require(inventory["epac_commit"] == lock["source_commit"] and len(inventory["proposed_python_retirements"]) == 37, "retirement source/inventory differs") @@ -405,9 +428,12 @@ def digest(path: Path) -> str: if item["path"] == "research/epac/README.md": path = ROOT / "research/epac/README.forge-history.md" require(digest(path) == item["sha256"], f"retained historical bytes differ: {path.relative_to(ROOT)}") + require(records["stack-graduated.json"]["verifier_sha256"] == hashlib.sha256(historical_verifier).hexdigest(), "retirement consumer verifier differs from its Git source") base = load_json(ROOT / "research/epac/BASE.json") + require(base["successor"] == {key: receipt["to"][key] for key in ("repository", "source_commit", "release_tag")}, "historical BASE successor differs from graduation receipt") + require(base["source_path"] == receipt["from"]["source_path"] and base["authority_transfer"] is False and base["canon_path"] is None, "historical BASE boundary differs") require(base["source_repository"] == receipt["from"]["repository"] and base["source_commit"] == receipt["from"]["source_commit"] and base["standing"] == "historical-forge-evidence", "historical forge BASE differs") - except (KeyError, TypeError, ValueError, OSError, StopIteration) as exc: + except (KeyError, TypeError, ValueError, OSError, StopIteration, IndexError, SyntaxError) as exc: error(findings, "epac.graduation", f"invalid or missing transition evidence: {exc}") From 5f47f3a53b84c8b1af2675df62edf9c6265b420a Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sun, 13 Sep 2026 00:27:25 +0000 Subject: [PATCH 08/10] Pin Stack portfolio to the reconciled research and graduation state --- docs/work-graphs/repository-plan-report.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/work-graphs/repository-plan-report.json b/docs/work-graphs/repository-plan-report.json index ea3abfc..cdda400 100644 --- a/docs/work-graphs/repository-plan-report.json +++ b/docs/work-graphs/repository-plan-report.json @@ -10,7 +10,7 @@ }, "source": { "branch": "graduate/epac-release-20260912", - "commit": "1c6ec9fb85d2ead58b13d806a5c4a9bc3803c936", + "commit": "745ff5e54dff52089889a7f9ca2ba87cb39bbd0f", "generated_at": "2026-09-13", "note": "Post-merge repository state includes the independent EPAC consumer and Python/English Gonol workspaces. The historical EPAC event remains separately pinned in its receipt." }, From 533623ac506afa9400803c2ac5795e66d93d15e0 Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sun, 13 Sep 2026 00:45:04 +0000 Subject: [PATCH 09/10] Freeze original EPAC evidence and validate complete release inputs --- .github/workflows/stack-consistency.yml | 2 ++ integration/epac/README.md | 4 +++- integration/epac/reconsume.py | 28 ++++++++++++++++++------- tools/check_stack_consistency.py | 14 +++++++++++++ 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/stack-consistency.yml b/.github/workflows/stack-consistency.yml index 050fbf6..5343373 100644 --- a/.github/workflows/stack-consistency.yml +++ b/.github/workflows/stack-consistency.yml @@ -41,3 +41,5 @@ jobs: fetch-depth: 0 - name: Verify stack authority and provenance projections run: python tools/check_stack_consistency.py + - name: Validate the repository-owned portfolio report + run: python skill-lib/interdependent-work-graph/portfolio_plan.py docs/work-graphs/repository-plan-report.json --output /tmp/stack-portfolio-validation.json diff --git a/integration/epac/README.md b/integration/epac/README.md index fb41fac..09acfb6 100644 --- a/integration/epac/README.md +++ b/integration/epac/README.md @@ -64,7 +64,9 @@ compares its UCNS pin with the producer's hash-bound source lock before install. The graduation event remains separately bound to the archived `evidence/graduation-release-lock.json` and byte-exact before/after manifest snapshots, including their source commit and Git blob identities. The checker reads the -actual files from those Git commits; use a full-history checkout (`git fetch +actual files from those Git commits and compares all seven original evidence +files with the originally committed graduation record. Every consumer receipt +must name the actual Git tree and verifier bytes from its source commit; use a full-history checkout (`git fetch --unshallow` for a shallow clone). CI fetches the required history. Its qualification and consumer receipts describe the original v0.1.0 transition. Later participant graph changes or accepted EPAC release updates do not rewrite that history; diff --git a/integration/epac/reconsume.py b/integration/epac/reconsume.py index a768b68..a4ca3ea 100644 --- a/integration/epac/reconsume.py +++ b/integration/epac/reconsume.py @@ -44,6 +44,15 @@ from urllib.request import urlopen +def reject_duplicate_keys(pairs): + result = {} + for key, value in pairs: + if key in result: + raise ValueError("duplicate JSON key: " + key) + result[key] = value + return result + + def main() -> None: lock_path, output = (Path(argument).resolve() for argument in sys.argv[1:3]) runtime = sys.argv[3] @@ -55,7 +64,7 @@ def main() -> None: if output.exists() or output.is_relative_to(stack): raise ValueError("output must be new and outside stack") lock_bytes = lock_path.read_bytes() - lock = json.loads(lock_bytes) + lock = json.loads(lock_bytes, object_pairs_hook=reject_duplicate_keys) if lock["phase"] not in {"reconsumed", "graduated"}: raise ValueError("public reconsumption phase required") output.mkdir(parents=True) @@ -71,15 +80,20 @@ def main() -> None: if hashlib.sha256(payload).hexdigest() != identity["sha256"]: raise ValueError(f"public artifact digest mismatch: {name}") (output / name).write_bytes(payload) - manifest = json.loads((output / "release-manifest.json").read_text()) + manifest = json.loads((output / "release-manifest.json").read_text(), object_pairs_hook=reject_duplicate_keys) if manifest["source_commit"] != lock["source_commit"]: raise ValueError("public source identity mismatch") - for name, digest in manifest["artifacts_sha256"].items(): - if assets[name]["sha256"] != digest: - raise ValueError("release manifest differs from pinned artifact identity") wheels, sdists = list(output.glob("*.whl")), list(output.glob("*.tar.gz")) if len(wheels) != 1 or len(sdists) != 1: raise ValueError("exactly one wheel and source archive required") + expected_artifacts = {path.name: assets[path.name]["sha256"] for path in (wheels[0], sdists[0])} + if manifest["artifacts_sha256"] != expected_artifacts: + raise ValueError("release manifest must bind exactly the wheel and source archive") + if set(assets) != set(expected_artifacts) | {"release-manifest.json", "SHA256SUMS"}: + raise ValueError("release asset inventory differs from complete four-file set") + expected_sums = "".join(f'{assets[name]["sha256"]} {name}\n' for name in sorted(set(assets) - {"SHA256SUMS"})) + if (output / "SHA256SUMS").read_bytes() != expected_sums.encode("ascii"): + raise ValueError("checksum file differs from complete pinned asset set") source = output / "source" source.mkdir() with tarfile.open(sdists[0]) as archive: @@ -97,7 +111,7 @@ def main() -> None: upstream_bytes = (source_root / "data/ucns-source-lock.json").read_bytes() if hashlib.sha256(upstream_bytes).hexdigest() != manifest["ucns_source_lock_sha256"]: raise ValueError("producer UCNS source lock differs from release manifest") - producer_upstream = json.loads(upstream_bytes) + producer_upstream = json.loads(upstream_bytes, object_pairs_hook=reject_duplicate_keys) upstream = {"repository": producer_upstream["repository"], "commit": producer_upstream["commit"], "authority_transfer": False} if "upstream" in lock and lock["upstream"] != upstream: @@ -110,7 +124,7 @@ def main() -> None: subprocess.run(["uv", "pip", "sync", "--python", python, "--require-hashes", str(requirements)], check=True, env=child_env) subprocess.run(["uv", "pip", "install", "--python", python, "--no-deps", str(wheels[0])], check=True, env=child_env) subprocess.run([python, str(stack / "integration/epac/verify_release.py"), str(wheels[0]), str(output / "consumption.json"), "--phase", lock["phase"]], check=True, cwd=output, env=child_env) - consumption = json.loads((output / "consumption.json").read_text()) + consumption = json.loads((output / "consumption.json").read_text(), object_pairs_hook=reject_duplicate_keys) if consumption["ucns_source_commit"] != upstream["commit"]: raise ValueError("installed consumer UCNS differs from release source lock") if lock_path.read_bytes() != lock_bytes: diff --git a/tools/check_stack_consistency.py b/tools/check_stack_consistency.py index ce911de..813a177 100644 --- a/tools/check_stack_consistency.py +++ b/tools/check_stack_consistency.py @@ -363,13 +363,19 @@ def committed_bytes(commit: str, path: str) -> bytes: history_root = ROOT / "research/epac" require(not history_root.is_symlink() and not any(path.is_symlink() for path in history_root.rglob("*")), "historical research path contains a symlink") require(not list(history_root.rglob("*.py")), "forge Python implementation has returned") + original_evidence = {"public-release.json", "candidate-matrix.json", "reproducibility.json", "stack-candidate.json", "stack-reconsumed.json", "stack-graduated.json", "retirement-inventory.json"} expected_evidence = {"public-release.json", "candidate-matrix.json", "reproducibility.json", "stack-candidate.json", "stack-reconsumed.json", "stack-graduated.json", "retirement-inventory.json", "graduation-release-lock.json", "transition-before-manifest.json", "transition-after-manifest.json"} prefix = "integration/epac/evidence/" require(set(receipt["evidence"]) == {prefix + name for name in expected_evidence}, "complete evidence inventory required") + original_receipt = json.loads(committed_bytes(receipt["recorded_transition_source_commit"], "integration/epac/authority-transition.json")) + historical_fields = ("schema", "version", "status", "lifecycle_state", "from", "to", "gates", "scope", "upstream", "retirement_source_commit", "retirement_source_tree", "before_work_graph_sha256", "after_work_graph_sha256", "release_lock_sha256") + require(all(receipt[key] == original_receipt[key] for key in historical_fields), "historical transition facts differ from original committed receipt") records = {} for name in sorted(expected_evidence): path = ROOT / prefix / name require(digest(path) == receipt["evidence"].get(prefix + name), f"evidence digest differs: {name}") + if name in original_evidence: + require(path.read_bytes() == committed_bytes(receipt["recorded_transition_source_commit"], prefix + name), f"historical evidence differs from original committed bytes: {name}") records[name] = load_json(path) # Graduation evidence is immutable history, not the current release pin. require(receipt["graduation_release_lock"] == prefix + "graduation-release-lock.json", "unexpected historical release lock path") @@ -418,11 +424,19 @@ def committed_bytes(commit: str, path: str) -> bytes: for phase in ("candidate", "reconsumed", "graduated"): record = records[f"stack-{phase}.json"] require(record["status"] == "passed" and record["phase"] == phase and record["source_unchanged"] is True, f"invalid {phase} consumer evidence") + commit = record["source_commit"] + require(HEX40.fullmatch(commit) is not None, f"{phase} consumer source commit invalid") + if HEX40.fullmatch(commit) is None: + raise ValueError("invalid consumer source commit") + tree_result = subprocess.run(["git", "-C", str(ROOT), "rev-parse", "--verify", commit + "^{tree}"], capture_output=True, check=False) + require(tree_result.returncode == 0 and tree_result.stdout.decode().strip() == record["source_tree"], f"{phase} consumer tree differs from Git source") + require(hashlib.sha256(committed_bytes(commit, "integration/epac/verify_release.py")).hexdigest() == record["verifier_sha256"], f"{phase} consumer verifier differs from Git source") require(record["artifact_sha256"] == wheel_hash and record["ucns_source_commit"] == receipt["upstream"]["commit"], f"{phase} consumer artifact/dependency differs") require(record["empirical_status_transfer"] is False and record["comparison_standings"] == expected_standings, f"{phase} scientific boundary differs") require(records["stack-graduated.json"]["source_commit"] == receipt["retirement_source_commit"] and records["stack-graduated.json"]["source_tree"] == receipt["retirement_source_tree"], "retirement verification source differs") inventory = records["retirement-inventory.json"] require(inventory["epac_commit"] == lock["source_commit"] and len(inventory["proposed_python_retirements"]) == 37, "retirement source/inventory differs") + require(len(inventory["preserved_historical_files"]) == 28 and len({item["path"] for item in inventory["preserved_historical_files"]}) == 28, "complete 28-path historical inventory required") for item in inventory["preserved_historical_files"]: path = ROOT / item["path"] if item["path"] == "research/epac/README.md": From 233385d8074b742195cad02b54845b59b24ff38c Mon Sep 17 00:00:00 2001 From: Erin Spencer Date: Sun, 13 Sep 2026 00:55:07 +0000 Subject: [PATCH 10/10] Pin the original EPAC transition independently of its receipt --- tools/check_stack_consistency.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/check_stack_consistency.py b/tools/check_stack_consistency.py index 813a177..1f1db15 100644 --- a/tools/check_stack_consistency.py +++ b/tools/check_stack_consistency.py @@ -86,6 +86,8 @@ STACK_UPDATE_PROVENANCE_PATH = ROOT / ".agents" / "skills" / "stack-update" / "PROVENANCE.json" HASHED_FIELDS = ("repositories", "research_participants", "boundaries") HEX40 = re.compile(r"^[0-9a-f]{40}$") +# Original completed EPAC event. Advancing release pins cannot reselect history. +EPAC_TRANSITION_COMMIT = "c81d807142d3f0fe3968a6879888afa00352eaff" def load_json(path: Path) -> dict[str, Any]: @@ -367,7 +369,8 @@ def committed_bytes(commit: str, path: str) -> bytes: expected_evidence = {"public-release.json", "candidate-matrix.json", "reproducibility.json", "stack-candidate.json", "stack-reconsumed.json", "stack-graduated.json", "retirement-inventory.json", "graduation-release-lock.json", "transition-before-manifest.json", "transition-after-manifest.json"} prefix = "integration/epac/evidence/" require(set(receipt["evidence"]) == {prefix + name for name in expected_evidence}, "complete evidence inventory required") - original_receipt = json.loads(committed_bytes(receipt["recorded_transition_source_commit"], "integration/epac/authority-transition.json")) + require(receipt["recorded_transition_source_commit"] == EPAC_TRANSITION_COMMIT, "original transition commit differs from independently pinned anchor") + original_receipt = json.loads(committed_bytes(EPAC_TRANSITION_COMMIT, "integration/epac/authority-transition.json")) historical_fields = ("schema", "version", "status", "lifecycle_state", "from", "to", "gates", "scope", "upstream", "retirement_source_commit", "retirement_source_tree", "before_work_graph_sha256", "after_work_graph_sha256", "release_lock_sha256") require(all(receipt[key] == original_receipt[key] for key in historical_fields), "historical transition facts differ from original committed receipt") records = {} @@ -375,7 +378,7 @@ def committed_bytes(commit: str, path: str) -> bytes: path = ROOT / prefix / name require(digest(path) == receipt["evidence"].get(prefix + name), f"evidence digest differs: {name}") if name in original_evidence: - require(path.read_bytes() == committed_bytes(receipt["recorded_transition_source_commit"], prefix + name), f"historical evidence differs from original committed bytes: {name}") + require(path.read_bytes() == committed_bytes(EPAC_TRANSITION_COMMIT, prefix + name), f"historical evidence differs from original committed bytes: {name}") records[name] = load_json(path) # Graduation evidence is immutable history, not the current release pin. require(receipt["graduation_release_lock"] == prefix + "graduation-release-lock.json", "unexpected historical release lock path")