Evidence

common representation architecture.py

Download source fileOpen in research workspace
"""Bounded preparation checks; never executes or edits a root research step.

Run in a fresh output directory if reproduction must preserve the frozen JSON.
"""
import hashlib
import json
from pathlib import Path

ROOT = Path(__file__).resolve().parents[2]
BASE = ROOT / "c1132_c1431"
OUT = Path(__file__).with_suffix(".diagnostics.json")


def read(relative):
    return json.loads((ROOT / relative).read_text())


def binding(relative):
    data = (ROOT / relative).read_bytes()
    return {"path": relative, "sha256": hashlib.sha256(data).hexdigest(), "bytes": len(data)}


checks = []


def check(name, actual, expected):
    checks.append({"name": name, "actual": actual, "expected": expected, "pass": actual == expected})


def q(n):
    quotient, remainder = divmod(n, 5)
    return 5 * (quotient + (remainder >= 3))


source_paths = [
    "c1132_c1431/prep/common_representation_architecture.questions.json",
    "c1132_c1431/model/Moses_MT_complete_path.json",
    "c1132_c1431/model/Moses_five_source_blocks.json",
    "c1132_c1431/inherited/model/completed_path_inputs.json",
    "c1132_c1431/inherited/model/completed_path_prefix_field.json",
    "upload/File_52c.Rounded_Whole_Span_Inverse_Detailed_Study_Draft (2)(1).md",
]
mt = read(source_paths[1])
blocks = read(source_paths[2])["blocks"]
inverse = read(source_paths[3])
prefixes = read(source_paths[4])
lookup = {row["name"]: row for row in mt["rows"]}
controller = (ROOT / source_paths[5]).read_text()

# Values imported from the current controlling source, not selected from a scan.
check("File52c explicit Flood/Arphaxad role statement",
      "Arphaxad and the Flood occupy one admitted numerical date, 2456 BC." in controller, True)
check("File52c explicit transformed first-leg distinction",
      "The first endpoint shares the label of regular Creation, but its role here is the rebuilt inverse of the Conquest leg." in controller, True)
check("File52c inherited source hash", binding(source_paths[5])["sha256"], inverse["source_sha256"])
check("MT base source state", mt["source_state"], "strictShem+2excluded;Terah70;CainanOFF")
check("MT source Creation", lookup["Adam"]["rounded_BC"], 4106)
check("MT source Noah", lookup["Noah"]["rounded_BC"], 3056)
check("MT source Arphaxad", lookup["Arphaxad"]["rounded_BC"], 2456)

nodes = {
    "nativity_source": {"BC": inverse["anchor"], "role": "held Nativity anchor", "source": "File52c §§1.4,3.4"},
    "conquest_source": {"BC": 1406, "role": "Conquest source anchor", "source": "File52c §§1.4,3.4"},
    "flood_source": {"BC": 2456, "role": "selected Rounded Flood event", "source": "File52c §§2.1,3.3–3.4"},
    "noah_source": {"BC": lookup["Noah"]["rounded_BC"], "role": "Noah birth", "source": "C1234; File51a §3.1"},
    "creation_source": {"BC": lookup["Adam"]["rounded_BC"], "role": "source Adam/Creation", "source": "C1234; File51a §3.1"},
    "arphaxad_source": {"BC": lookup["Arphaxad"]["rounded_BC"], "role": "Arphaxad birth", "source": "C1234; File51a §3.1"},
}
check("selected Noah-to-Flood source relation", nodes["noah_source"]["BC"] - nodes["flood_source"]["BC"], 600)
words = {
    "regular_Flood": ["nativity_source", "conquest_source", "flood_source", "creation_source"],
    "regular_Noah": ["nativity_source", "conquest_source", "noah_source", "creation_source"],
    "regular_Flood_Noah": ["nativity_source", "conquest_source", "flood_source", "noah_source", "creation_source"],
}
interfaces = []
for name, word in words.items():
    coordinates = [nodes[k]["BC"] for k in word]
    spans = [b - a for a, b in zip(coordinates, coordinates[1:])]
    check(name + " complete original component word", spans, inverse["original_paths"][name])
    old = next(x for x in prefixes if x["path"] == name)
    interfaces.append({"path": name, "node_ids": word, "coordinates_BC": coordinates,
                       "derived_original_spans": spans,
                       "inherited_one_pass_parts": old["one_pass_parts"],
                       "inherited_prefixes": old["prefixes"],
                       "status": "Source-word compatibility verified; prior one-pass results reused, not discovered anew"})

check("cumulative path remains separately supplied", inverse["original_paths"]["cumulative_primary"], [1400, 3430, 9170])
first = next(x for x in prefixes if x["path"] == "regular_Flood")["prefixes"][0]
nodes["transformed_conquest_leg"] = {
    "BC": inverse["anchor"] + first,
    "role": "generated first inverse leg endpoint, not source Creation",
    "source": "File52c §3.4; inherited C1058–C1068",
}
check("2456 coordinate equality", nodes["arphaxad_source"]["BC"], nodes["flood_source"]["BC"])
check("2456 roles remain different", nodes["arphaxad_source"]["role"] != nodes["flood_source"]["role"], True)
check("4106 coordinate equality", nodes["creation_source"]["BC"], nodes["transformed_conquest_leg"]["BC"])
check("4106 roles remain different", nodes["creation_source"]["role"] != nodes["transformed_conquest_leg"]["role"], True)

block_records = []
for block in blocks:
    actual_parts = [lookup[name]["actual"] for name in block["rows"]]
    rounded_parts = [lookup[name]["rounded"] for name in block["rows"]]
    residuals = [x-y for x, y in zip(actual_parts, rounded_parts)]
    actual, rounded, residual = sum(actual_parts), sum(rounded_parts), sum(residuals)
    check(block["start"] + " block row-rounding", [q(x) for x in actual_parts], rounded_parts)
    check(block["start"] + " stored block total", rounded, block["span"])
    check(block["start"] + " exact block reconstruction", rounded + residual, actual)
    check(block["start"] + " normalized aggregate identity", rounded + q(residual), q(actual))
    block_records.append({"start": block["start"], "end": block["end"],
                          "rows": block["rows"], "actual_parts": actual_parts,
                          "rounded_parts": rounded_parts, "row_residuals_actual_minus_rounded": residuals,
                          "exact_block": actual, "source_row_rounded_block": rounded,
                          "aggregate_residual": residual, "once_rounded_exact_block": q(actual),
                          "row_round_minus_block_round": rounded-q(actual)})

check("all five exact blocks", [x["exact_block"] for x in block_records], [130, 492, 1034, 129, 801])
check("all five source Rounded blocks", [x["source_row_rounded_block"] for x in block_records], [130, 490, 1030, 130, 800])
check("all five aggregate residuals", [x["aggregate_residual"] for x in block_records], [0, 2, 4, -1, 1])
check("all five block-normalization defects", [x["row_round_minus_block_round"] for x in block_records], [0, 0, -5, 0, 0])
check("MT exact total", sum(x["exact_block"] for x in block_records), mt["actual_total"])
check("MT source Rounded total", sum(x["source_row_rounded_block"] for x in block_records), mt["rounded_total"])
check("total path residual", mt["actual_total"] - mt["rounded_total"], 6)
check("once-rounded whole span differs", q(mt["actual_total"]), 2585)
check("source Rounded whole span retained", mt["rounded_total"], 2580)

# Every named path coordinate, not merely the selected outer span.
field = []
for i, row in enumerate(mt["rows"]):
    tail = mt["rows"][i:-1]
    residual = sum(x["actual"]-x["rounded"] for x in tail)
    recovered = row["rounded_BC"] + residual
    check(row["name"] + " complete-field residual recovery", recovered, row["actual_BC"])
    field.append({"name": row["name"], "rounded_BC": row["rounded_BC"],
                  "aggregate_residual": residual, "recovered_actual_BC": recovered})

result = {
    "status": "PASS" if all(c["pass"] for c in checks) else "FAIL",
    "check_count": len(checks), "passing": sum(c["pass"] for c in checks),
    "method": "Three fixed source-word interfaces and all five fixed Moses blocks; no endpoint scan or second inversion",
    "interpretation": "Preparation verification for a common presentation; all chronological values and rules remain inherited source/model inputs",
    "source_bindings": [binding(p) for p in source_paths],
    "interface_nodes": nodes, "regular_inverse_interfaces": interfaces,
    "Moses_block_records": block_records, "Moses_complete_residual_field": field,
    "checks": checks,
}
assert result["status"] == "PASS", [c for c in checks if not c["pass"]]
with OUT.open("x") as f:
    json.dump(result, f, indent=2)
    f.write("\n")
print(json.dumps({"status": result["status"], "checks": len(checks), "output": str(OUT)}))

Linked sources and evidence

Edition and provenance

common_representation_architecture.py

SHA-256 51840729b6801780849087cd66fd554cc7beeb4c3d4f40607a73aac711c821c0

C480–C1634/Research_Cycles/C1132_C1431_Recovered/prep/common_representation_architecture.py