#!/usr/bin/env python3 """Exact source-excerpt and arithmetic audit for C275; standard library only. Classification in PREMISE_ASSESSMENT.json is authored. This verifier binds inspectable passages and checks arithmetic; it does not machine-prove intent, historical necessity, or theological claims. """ import argparse import hashlib import json from fractions import Fraction as F from pathlib import Path ROOT = Path(__file__).resolve().parent.parent checks = [] def sha(data): return hashlib.sha256(data).hexdigest() def check(label, value): if not value: raise AssertionError(label) checks.append(label) def load(name): return json.loads((ROOT / name).read_text()) def source(name): return (ROOT / "sources" / name).read_text() def row(source_name, line): return [s.strip().strip("*").strip() for s in source(source_name).splitlines()[line - 1].strip("|").split("|")] def vector(*values): return tuple(F(v) for v in values) def add(a, b): return tuple(x + y for x, y in zip(a, b)) def mul(k, a): return tuple(F(k) * x for x in a) def sub(a, b): return add(a, mul(-1, b)) def as_json(v): return [str(x) for x in v] def main(out): manifest = load("SOURCE_MANIFEST.json") for name, entry in manifest.items(): data = (ROOT / "sources" / name).read_bytes() check("frozen input: " + name, sha(data) == entry["sha256"] and len(data) == entry["bytes"]) cert = load("sources/C274_CERTIFICATE.json") check("C274 predecessor digest", manifest["C274_CERTIFICATE.json"]["sha256"] == "23ab41af374a05812d024b1be7ef9b141086b11bbf9ca456b2255efd8b5968f6") for field, filename in [ ("report_sha256", "C274_REPORT.md"), ("checkpoint_sha256", "C274_CHECKPOINT.md"), ("results_sha256", "C274_RESULTS.json"), ]: check("C274 certificate binds " + filename, cert[field] == manifest[filename]["sha256"]) prior_artifacts = { r["path"]: r for r in load("sources/C274_ARTIFACT_MANIFEST.json")["files"] } check("C274 solution ledger bound to retained manifest", prior_artifacts["evidence/EQUATION_SOLUTIONS.json"]["sha256"] == manifest["C274_EQUATION_SOLUTIONS.json"]["sha256"]) previous_solutions = load("sources/C274_EQUATION_SOLUTIONS.json")["cases"] check("retained C274 outcome, without rerunning its campaign", [r["rank"] for r in previous_solutions] == [3, 2, 2, 2] and [r["degrees_of_freedom"] for r in previous_solutions] == [0, 1, 1, 1]) extraction = load("sources/C266_PROVENANCE_EXTRACTION.json") for filename in ["MIRROR_COMPREHENSIVE.md", "MIRROR_BILATERAL.md", "BRANCH_3PLUS7.md"]: digest = manifest[filename]["sha256"] check("retained extraction provenance: " + filename, any(r["sha256"] == digest for r in extraction)) spec = load("PASSAGE_SPEC.json") passages = [] excerpts_md = ["# C275 exact passage ledger", "", "Line numbers refer to the included, hash-bound source copies. " "Classifications are authored; excerpt identity is machine checked.", ""] for item in spec: lines = source(item["source"]).splitlines(keepends=True) a, b = item["start_line"], item["end_line"] check("passage range and sentinel: " + item["id"], 1 <= a <= b <= len(lines) and item["required_substring"] in "".join(lines[a - 1:b])) excerpt = "".join(lines[a - 1:b]) passages.append({ **item, "source_sha256": manifest[item["source"]]["sha256"], "excerpt_sha256": sha(excerpt.encode()), "excerpt": excerpt, }) excerpts_md.extend([ "## " + item["id"] + " — " + item["section"], "", f"Source: {item['source']}, lines {a}–{b}.", "", "Purpose: " + item["purpose"] + ".", "", "Classification: " + item["documentary_class"] + ".", "", "\n".join(" " + line for line in excerpt.splitlines()), "", ]) ids = {r["id"] for r in passages} assessment = load("PREMISE_ASSESSMENT.json") for premise in ["A", "B", "C"]: refs = [] for key, value in assessment[premise].items(): if isinstance(value, list): refs.extend(value) check("assessment references resolve: " + premise, bool(refs) and set(refs) <= ids and all(r.startswith("P") for r in refs)) check("supplement kept outside premise evidence", all(r["use_in_C275_premise_audit"] == r["id"].startswith("P") for r in passages) and not assessment["supplement_used_as_premise_evidence"]) # Read the fixed coordinate inputs from the cited table rows. mt = [int(x) for x in row("FILE_18.md", 1997)[4].split("–")] sp = [int(x) for x in row("FILE_18.md", 2027)[3].replace(" BC", "").split("–")] lxx = [int(x)-460 for x in row("FILE_18.md", 2063)[3].replace(" BC", "").split("–")] check("source bounds from canonical table rows", mt == [5296, 5289] and sp == [4716, 4709] and lxx == [5290, 5283]) check("source width and corresponding source gaps", mt[0]-mt[1] == sp[0]-sp[1] == lxx[0]-lxx[1] == 7 and mt[0]-lxx[0] == mt[1]-lxx[1] == 6 and mt[0]-sp[0] == mt[1]-sp[1] == 580) # Linear forms use coefficients (m,l,s,constant). mt_close = vector(1, 0, 0, -mt[1]) rh_close = vector(-1, 0, 0, mt[1]+600-598) A = sub(mt_close, rh_close) B = vector(-1, 1, 0, 0) C_low = vector(1, 0, 1, -mt[1]-sp[0]) C_high = vector(1, 0, 1, -mt[0]-sp[1]) D = vector(0, 1, 0, -lxx[0]) mt_target = vector(1, 0, 0, -mt[0]+6) check("A recovered from closing-source pair and held598", A == vector(2, 0, 0, -10580)) check("C endpoint equations are the same constraint", C_low == C_high == vector(1, 0, 1, -10005)) check("A plus twice B equals twice LXX-origin condition D", add(A, mul(2, B)) == mul(2, D)) check("MT opening at retained minus6 is equivalent to A", mul(2, mt_target) == A) check("SP reflection gives4715 once MT5290 is held", mt[1]+sp[0]-5290 == 4715) check("SP raw580 gap differs from selected575 translation gap", 5290-4715 == 575 and 580-575 == 5 and F(25, 23)*529 == 575) check("join theorem retains joining requirement", F(600-598, 2)-7 == -6 and F(600-598, 2) == 1) check("LXX opening source radius is10K and maps to ON by E", 5290 == 10*529 and F(25, 23)*5290 == 5750) a, n, target = 5296, 3709, 6 check("source-qualified3K+7K subdivision", a-n == 3*529 and n-target == 7*529 and a-target == 5290) check("S11 explicitly retains established span and target identity", "established 5290-year" in source("BRANCH_3PLUS7.md") and "SP regular, G3 companion Noah birth" in source("BRANCH_3PLUS7.md") and "6 BC Christ-birth anchor" in source("BRANCH_3PLUS7.md")) algebra = { "coefficient_order": ["m", "l", "s", "constant"], "fixed_source_Flood_BC_bounds": {"MT_ON": mt, "LXX_OFF": lxx, "SP_OFF": sp}, "forms": {"A": as_json(A), "B": as_json(B), "C": as_json(C_low), "D_LXX_opening_at_global_origin": as_json(D), "MT_opening_at_retained_minus6": as_json(mt_target)}, "identities": [ "A+2B=2D; under B, A=0 iff LXX OFF opening lands at global Mirror origin", "A=2*(m-5296+6); MT opening at retained minus6 restates the same placement", "Both SP-reflection endpoint equations equal m+s-10005=0", "When m=5290, C gives s=4715", "Raw source gap580 minus selected translation gap575 gives transformed gap5", ], "qualified_subdivision": { "BC_nodes": [5296, 3709, 6], "widths": [1587, 3703], "K_units": [3, 7], "total": 5290, "retained_target_required": True, "document_calls_span_already_established": True, }, "independent_historical_necessity_proof": False, "new_parameter_fit_or_source_search": False, } # Supplemental awareness only: table offsets and paired AD anchors. mt_c = int(row("FILE_18.md", 1228)[1])+215 mt_j = int(row("FILE_18.md", 1233)[1])+215 lxx_c = int(row("FILE_18.md", 1697)[1])+215 lxx_j = int(row("FILE_18.md", 1702)[1])+215 check("supplement row-specific full430 sources", (mt_c, mt_j, lxx_c, lxx_j) == (4114, 3654, 5494, 4534)) check("supplement Creation-to-Jared durations", lxx_c-lxx_j == 960 and mt_c-mt_j == 460) check("supplement MT/LXX offsets vary by source event", lxx_c-mt_c == 1380 and lxx_j-mt_j == 880 and 1380-880 == 960-460) supplement_rows = [] for label, b, d, landing_expected, gap_expected, multiple, expanded_expected in [ ("Creation", lxx_c, 1406, 2970, 1564, 68, 1700), ("Jared", lxx_j, 1446, 3930, 2484, 108, 2700), ]: W = 8464 landing = W-b gap = landing-d expanded = F(25, 23)*gap check("supplement landing and comparison: " + label, (landing, gap, expanded) == (landing_expected, gap_expected, expanded_expected) and gap == 23*multiple) check("supplement physical pair crossover: " + label, b+1+landing-1 == W == b+landing+1-1) check("supplement reflected same-season anchor comparison: " + label, landing-d == (landing+1)-(d+1) == gap) supplement_rows.append({ "event": label, "source_BC_base": b, "source_pair": f"{b+1}t/{b}n BC", "crossover": W, "landing_base": landing, "landing_pair": f"AD {landing}t/{landing+1}n", "reflected_anchor_base": d, "reflected_anchor_pair": f"AD {d}t/{d+1}n", "gap": gap, "units_of_23": multiple, "gap_times_E": str(expanded), }) check("supplement gap difference and expanded difference", (8464-lxx_j-1446)-(8464-lxx_c-1406) == 960-40 == 920 and F(25, 23)*920 == 1000 == 2700-1700) supplemental = { "status": "verified supplemental awareness; not C275 premise evidence", "user_intake_sha256": sha((ROOT/"USER_SUPPLEMENT_INTAKE.md").read_bytes()), "source_frame": "Full430, Terah+60 OFF; LXX native Cainan ON, MT OFF; existing rows only, no upstream Gear transport", "rows": supplement_rows, "LXX_Creation_to_Jared": 960, "MT_Creation_to_Jared": 460, "MT_LXX_offsets": {"Creation": 1380, "Jared": 880}, "gap_difference": 920, "expanded_gap_difference": 1000, "superseded_claim": {"landing": "AD3746", "gap": 2300, "active": False}, "canonical_files_changed": False, "comparison_expanded_not_crossover": True, "File18_heading_limit": "Introductory+1380 shorthand cannot be applied uniformly to every patriarch; the Jared rows give880.", "new_historical_event_at_generated_landings_asserted": False, } results = { "step": "C275", "status": "passed", "check_count": len(checks), "checks": checks, "frozen_existing_inputs": len(manifest), "premises_audited": 3, "provenance_passages": sum(r["use_in_C275_premise_audit"] for r in passages), "separate_supplement_passages": sum(not r["use_in_C275_premise_audit"] for r in passages), "classification_is_authored": True, "historical_necessity_machine_proved": False, "historical_campaigns_rerun": 0, "new_event_or_parameter_search": False, "canonical_or_graph_edits": False, "new_independent_review": False, "next_step_executed": False, } outputs = { "PASSAGE_LEDGER.json": passages, "ALGEBRAIC_RESTATEMENTS.json": algebra, "SUPPLEMENTAL_LXX_RESULTS.json": supplemental, "RESULTS.json": results, } out.mkdir(parents=True, exist_ok=True) for name, obj in outputs.items(): (out/name).write_text(json.dumps(obj, ensure_ascii=False, indent=2)+"\n") (out/"PASSAGE_LEDGER.md").write_text("\n".join(excerpts_md)+"\n") print(json.dumps({"status": "passed", "checks": len(checks), "passages": len(passages), "generated_outputs": 5})) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--out", type=Path, required=True) main(parser.parse_args().out)