#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Combine the capladder evidence into one record: gates, the eight folds, the grid. Inputs (all written by the instruments served beside this file): job1493-flat.json flat folds, grid, streamed gate, gates (HEAVY=none run) job1493-heavy-T31by37.json streamed fold 31 -> 37 (old word T_31) job1493-heavy-T37by41.json streamed fold 37 -> 41 (old word T_37, three partials merged) job1493-grid.json the wide free-vs-anchored ladder grid job1493-trunc-ladder.json the python/numpy instrument's independent flat answer Usage: python job1493-summarize.py """ import json import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) def load(name): with open(os.path.join(HERE, name), encoding="utf-8") as fh: return json.load(fh) def main(): mjs = load("job1493-flat.json") py = load("job1493-trunc-ladder.json") m = load("job1493-heavy-T31by37.json") M = load("job1493-heavy-T37by41.json") grid = load("job1493-grid.json") out = {"tool": "trunc-capladder", "question": "the refined transport sum's truncation length at every fold #159 ran: " "anchored ladder, or anchored ladder plus one?"} out["GATES"] = { "tiles_D": mjs["G1_tiles"], "tiles_G2_vs_159": mjs["G1_g2_check"], "streamed_vs_flat_T23_by_31": mjs["G2_stream_vs_flat"], "D_T31_streamed": {"computed": m["D_old"], "published": m["D_old_published"], "agrees": m["D_agrees"]}, "D_T37_streamed": {"computed": M["D_old"], "published": M["D_old_published"], "agrees": M["D_agrees"]}, } # python/numpy instrument, keyed the same way pyrows = {} for r in py["TABLE"]: pyrows[r["fold"]] = r agree = [] for r in mjs["FLAT"]: p = pyrows.get(r["fold"]) agree.append({"fold": r["fold"], "node_L_anch": r["L_anch"], "python_L_anch": p["L_anch"], "node_L_star": r["L_star_alt"], "python_L_star": p["L_star_alt"], "node_L_loose": r["L_star_loose"], "python_L_loose": p["L_star_loose"], "agree": bool(p["L_anch"] == r["L_anch"] and p["L_star_alt"] == r["L_star_alt"] and p["L_star_loose"] == r["L_star_loose"])}) out["GATES"]["python_vs_node_flat"] = agree out["GATES"]["python_scalar_vs_vector_Lstar"] = py["G4_gate_vector_vs_scalar_Lstar"] out["GATES"]["python_census"] = py["G1_census"] folds = [] for r in mjs["FLAT"]: folds.append({ "fold": r["fold"], "old_word": "T" + str(r["x"]), "q": r["q"], "D_old": r["D_old"], "L_anch": r["L_anch"], "L_free": r["L_free"], "attaining_translate": r["aStar"], "L_star_alt": r["L_star_alt"], "L_star_loose": r["L_star_loose"], "verdict": ("= anchored" if r["L_star_alt"] == r["L_anch"] else "= anchored + 1" if r["L_star_alt"] == r["L_anch"] + 1 else "neither"), "loose_extends_to_anchored_plus_1": r["loose_equals_anch_plus_1"], "source": "flat python+numpy and flat node"}) for name, s in (("T31 by 37", m), ("T37 by 41", M)): folds.append({ "fold": name, "old_word": name.split(" ")[0], "q": s["q"], "D_old": s["D_old"], "L_anch": s["L_anch"], "L_free": s["L_free"], "attaining_translate": s["aStar"], "L_star_alt": None, "L_star_loose": None, "verdict": "= anchored (L_star = L_free by the identity checked on the six " "enumerable folds)", "best_by_translate": s["best"], "segments": s["segments"], "seconds": s.get("seconds"), "partials": s.get("partials"), "source": "streamed, per-copy automaton, merged"}) out["FOLDS"] = folds out["GRID"] = {"cells": grid["cells"], "L_free_exceeds_L_anch": grid["free_bigger_than_anchored"], "largest_gap": grid["largest_gap"], "cells_with_a_gap": grid["cells_with_gap"], "q_range": [13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97], "table": grid["grid"]} out["CLAIM"] = { "at_every_fold_159_ran": "L_star = L_anch (never L_anch + 1); L_free = L_anch at " "all eight, the augmenting translate being a = 0", "in_general": "L_star = L_free, the longest run of consecutive old-word slots in a " "single translate of {0, q-2}; L_free = L_anch + 1 at 25 of the 110 " "grid cells, never more, so the free ladder is the general object", "loose_form": "the loose sum's own truncation is L_anch or L_anch + 1 (it extends one " "level past the anchored ladder at folds 23->29 and 23->37) and the " "alternation refinement deletes exactly those levels' terms", } with open(os.path.join(HERE, "job1493-summary.json"), "w", encoding="utf-8", newline="\n") as fh: json.dump(out, fh, indent=1, sort_keys=True) fh.write("\n") print(json.dumps({k: out[k] for k in ("GATES", "CLAIM")}, indent=1)[:1500]) print("\nFOLDS") for r in out["FOLDS"]: print(" ", r["fold"], "D_old", r["D_old"], "L_anch", r["L_anch"], "L_free", r["L_free"], "a*", r["attaining_translate"], "L*", r["L_star_alt"], "|", r["verdict"]) return 0 if __name__ == "__main__": sys.exit(main())