{
 "item": "joint-nulls",
 "batch": "e02-model-register",
 "approach": "Register one finite joint Z13/Z32 null-substitution counting model before any observed or shuffled fit: shared printed-order homophonic key on the union of resolved glyph identities, emitting A-Z or empty, <=3 null identities; Z13 must decode to a frozen 13-letter given+surname; Z32 after deletion must equal one of the 840 section-6 G strings. Crosswalk branches primary/shortHooks/crossedRings and anchor cases free/unchangedZ340/unchangedZ408/both are reused from the pinned prior registration. Only vocabulary generation, the control stream and tiny synthetic tests were run here.",
 "protocol": {
  "version": "joint-nulls-v1",
  "status": "exploratory widening of a known empty-marginal experiment (printed-order G strings gave 0/10 at length 32); not confirmation",
  "messages": {
   "z13": "AENz0K0M0[NAM",
   "z32Rows": [
    "C9J|#Ok[AMf8?ORTG",
    "X6FDVj%HCELzPW9"
   ],
   "z32Source": "https://api.imd.fun/artifacts/e254764c1c80b74fc17aca82f660f81d84da8e959073169b0995bddc7d4f6304 section 2",
   "order": "printed order only; no edits, no routes, no transpositions"
  },
  "crosswalk": {
   "source": "https://api.imd.fun/artifacts/6262429733357009532501273176da5477cac8738d5b6bd0e74fc39533222bdd",
   "sha256": "6262429733357009532501273176da5477cac8738d5b6bd0e74fc39533222bdd",
   "reused": "literalData.ids, anchorLinks, historical keys, branches; anchor_map and alias resolution exactly as in its generatorCode.countAndGenerate",
   "branches": [
    "primary",
    "shortHooks",
    "crossedRings"
   ],
   "anchorCases": {
    "free": [],
    "unchangedZ340": [
     "340"
    ],
    "unchangedZ408": [
     "408"
    ],
    "both": [
     "340",
     "408"
    ]
   },
   "conflicts": "a union identity anchored to two letters makes the whole branch/case cell zero for observed and every control; no repair or voting"
  },
  "key": "One shared total function from the union of resolved Z13/Z32 identities (per branch) to {A..Z} or EMPTY. Homophones allowed. An EMPTY (null) identity emits nothing at every occurrence in both messages. At most 3 union identities are null. An identity with a fixed historical letter in the active anchor case cannot be null. No edits, insertions, routes or positional key changes.",
  "z13Constraint": "Z13 decoded must equal a 13-letter concatenation given+surname from the frozen lists. Derived and frozen consequence: any null identity occurring in Z13 shortens the output below 13, so only Z32-only, unanchored identities are null-eligible; shared identities are never null.",
  "z32Constraint": "Z32 after deleting null occurrences must equal one of the 840 G strings (report section 6 templates x angles ZERO..SIX x distances ONE..TWELVE, singular RADIAN/INCH at ONE, spaces removed); length is checked after deletion. With <=3 nulls and Z32 multiplicities, reachable lengths are 26..32 only.",
  "nameVocabulary": {
   "given": "SSA yob1880..yob1950, both sexes, all years summed; name must match [A-Za-z]+ before ranking, then uppercase; rank by descending count then ASCII; retain 10000",
   "surname": "2010 Census CSV (CFPB copy); drop the rank 0 aggregate row; same regex/uppercase/sum; rank descending count then ASCII; retain 50000",
   "z13Texts": "all given+surname concatenations of length 13, deduplicated by full string (not split label); no cipher-based screening of names"
  },
  "serialization": {
   "unionKey": "compact JSON array of strings over resolved union IDs in Python ASCII sort order, \"\" for null, letter otherwise",
   "nullSet": "sorted list of null IDs",
   "textPair": "[Z13 text, Z32 text]",
   "hash": "sha256 hex of UTF-8 of json.dumps(sort_keys=True, separators=(\",\",\":\"), ensure_ascii=True)"
  },
  "counts": {
   "vector": [
    "keys",
    "textPairs",
    "z13Projection",
    "z32Projection",
    "numericPairs"
   ],
   "definitions": "keys = distinct union keys incl. null pattern (= distinct (nullSet, Z13 text, Z32 text) triples); textPairs = distinct (Z13 text, Z32 text); z13Projection/z32Projection = distinct texts of each message among joint solutions; numericPairs = distinct (angle, distance) integer pairs among all G expansions producing a joint Z32 text",
   "method": "Z13 local survivors via given-name scan plus surname position/equality bitset index per split length; Z32 local survivors per null set via G-string bitsets per length; join on letters of shared IDs by bucket; counts by exact bucket multiplication (each Z13 text lies in exactly one bucket), no pair materialization",
   "preJoinMarginals": [
    "z13LocalTexts",
    "z32LocalTriples",
    "z32LocalTexts",
    "z32LocalStillRepeatedTriples"
   ],
   "parameterCounts": [
    "unionTypes",
    "z13Types",
    "z32Types",
    "sharedTypes",
    "anchoredUnionTypes",
    "nullEligibleTypes",
    "nullSets",
    "z32RepeatedTypes"
   ],
   "strata": {
    "all": "every key with 0..3 nulls",
    "z32StillRepeated": "only keys whose Z32 after deletion still contains a repeated identity (at least one equality constraint survives)"
   },
   "budgets": "exact-null budgets k=0,1,2,3 per cell for both strata (observed reported; every control kept in the indexed record)"
  },
  "cells": "3 branches x 4 anchor cases = 12 cells, reported separately, never pooled; no winner selection",
  "controls": {
   "n": 199,
   "rng": "one CPython 3.12 random.Random(1313203) for the whole run",
   "draw": "per draw: fresh list(Z13 aliases), fresh list(Z32 aliases); shuffle Z13 then Z32 in place; keep duplicates and draws equal to observed",
   "reuse": "the same 199 draws for all 12 cells; aliases resolved through the cell branch after shuffling",
   "tail": "inclusive: GE = #controls with count >= observed, per cell, stratum and count; p = (1+GE)/200; descriptive only",
   "controlsSha256Definition": "sha256 of canonical JSON of the 199 ordered [Z13 alias list, Z32 alias list] pairs, observed excluded"
  },
  "indexedCounts": "per cell: sha256 of canonical JSON of [[drawIndex, cellRecord], ...] with drawIndex 0 = observed; produced by the count run, not here",
  "runtime": "CPython 3.12 stdlib. Save generatorSource as joint_nulls.py; python3 -I joint_nulls.py toy; python3 -I joint_nulls.py generate PRIOR RAWDIR must reproduce frozen; python3 -I joint_nulls.py count PRIOR RAWDIR is the later registered count"
 },
 "protocolSha256": "16b5bad2742033561ca1334f09b97910bfb5fc58ab209be08c56a3141c41711e",
 "protocolHashRule": "sha256 of canonical JSON of the protocol object",
 "sources": {
  "z32Report": "https://api.imd.fun/artifacts/e254764c1c80b74fc17aca82f660f81d84da8e959073169b0995bddc7d4f6304",
  "z13Report": "https://api.imd.fun/artifacts/ffaf03d067cab45edbd7d13667554edf02e5f049cf00a0f0ce37488c27944079",
  "crosswalk": "https://api.imd.fun/artifacts/6262429733357009532501273176da5477cac8738d5b6bd0e74fc39533222bdd",
  "ssaAnnualUrlPattern": "https://raw.githubusercontent.com/hackerb9/ssa-baby-names/0b1a1316457d55447d1a1f7bfe57ee15e53cc2f0/raw-data/yob{year}.txt",
  "ssaReadme": "https://raw.githubusercontent.com/hackerb9/ssa-baby-names/0b1a1316457d55447d1a1f7bfe57ee15e53cc2f0/raw-data/NationalReadMe.txt",
  "census": "https://raw.githubusercontent.com/cfpb/proxy-methodology/22056bdc52cfefb92e29bd811315b1da17d7f06e/input_files/Names_2010Census.csv",
  "rawHashes": {
   "census": "6b4933178060b4e5ac8dd9a611ec15472d35eab98fe9027474bc5ccc5b7a8708",
   "ssaReadme": "0454fd3b8e4375e6849e64f667ee87cf2ff484320a3e76d5e7e8f8678ee0c529",
   "ssaAnnual": "the 71 per-year SHA-256 values in the crosswalk artifact literalData.inputPins.ssa.annualSha256InYearOrder; all 71 matched on download",
   "crosswalk": "6262429733357009532501273176da5477cac8738d5b6bd0e74fc39533222bdd",
   "z32Report": "e254764c1c80b74fc17aca82f660f81d84da8e959073169b0995bddc7d4f6304",
   "z13Report": "ffaf03d067cab45edbd7d13667554edf02e5f049cf00a0f0ce37488c27944079"
  }
 },
 "section9Certificate": "rerun here from the Z32 report: PASS (71/20000 and 5374/20000 shuffle counts reproduced)",
 "frozen": {
  "nameLists": {
   "given": {
    "cap": 10000,
    "distinctNormalized": 22223,
    "lastCount": 82,
    "lengthHistogram": {
     "10": 134,
     "11": 20,
     "13": 1,
     "2": 20,
     "3": 214,
     "4": 1005,
     "5": 2087,
     "6": 2868,
     "7": 2173,
     "8": 1066,
     "9": 412
    },
    "rankedNameCountRowsSha256": "ceeb46a6c64e8693e3940c6bff8611f3db14d4be907a39753ed7f9edd8901cd8",
    "rankedNamesSha256": "fb9f57e07a40aa6edddbc88888abf863a84b0dff3c3e5887fe24049c6c0d5bf4",
    "retained": 10000,
    "rows": 472256,
    "tiedAtCutoffRetained": 12
   },
   "surname": {
    "cap": 50000,
    "distinctNormalized": 162253,
    "lastCount": 419,
    "lengthHistogram": {
     "10": 2006,
     "11": 783,
     "12": 278,
     "13": 88,
     "14": 60,
     "15": 2,
     "2": 105,
     "3": 797,
     "4": 3932,
     "5": 8517,
     "6": 11686,
     "7": 10806,
     "8": 6956,
     "9": 3984
    },
    "rankedNameCountRowsSha256": "759f32aad8adf34b71f451f44d77cba8a092ae6ca80f0693672fce30a176faa0",
    "rankedNamesSha256": "92b42a15a89178c43ed9699dbdc2e7bba022f4a240cf8729c5108ce42b08d3b8",
    "retained": 50000,
    "rows": 162254,
    "rowsDroppedAggregateRank0": 1,
    "tiedAtCutoffRetained": 2
   }
  },
  "nameListPriorCheck": "first 1000 of each new ranked list hash-equal the prior artifact literal given/surname payloads (asserted in build)",
  "z13Vocabulary": {
   "length13Pairs": 86159326,
   "distinctConcatenations": 86114651,
   "materialized": false,
   "note": "cardinalities computed exactly by shortest-split counting (z13_cardinality), checked against materialized sets on 300 random toys; texts are not materialized, the ranked-list hashes and generator commit them; the single 13-letter given name has no 0-letter surname"
  },
  "z32Vocabulary": {
   "baseExpansions": 840,
   "distinctTexts": 840,
   "lengthHistogram": {
    "16": 2,
    "17": 4,
    "18": 12,
    "19": 22,
    "20": 40,
    "21": 53,
    "22": 54,
    "23": 60,
    "24": 56,
    "25": 54,
    "26": 50,
    "27": 40,
    "28": 45,
    "29": 42,
    "30": 33,
    "31": 20,
    "32": 10,
    "33": 10,
    "34": 18,
    "35": 21,
    "36": 19,
    "37": 17,
    "38": 18,
    "39": 28,
    "40": 38,
    "41": 36,
    "42": 25,
    "43": 11,
    "44": 2
   },
   "numericMapSha256": "ce59e1e1c9831ba53b371c98e9cb69812a11ee48adc09ba860812e2b57cccad8",
   "sortedTextsSha256": "888b3af7732993aadde76cf6e7e36f1fd3abee393407c9110936550df11dfb75",
   "textsOfLength26to32": 240
  },
  "z32VocabularyNote": "all 840 expansions are distinct texts; only lengths 26..32 (240 texts) are reachable; the ten length-32 texts reproduce digest f64b62d0... (asserted)",
  "controls": {
   "controlsSha256": "e394dac52b5f073497db970d5deb2908a66772202e9668e8627a4b55bf7e7de5",
   "draws": 199,
   "firstDraw": [
    [
     "A",
     "E",
     "M",
     "K",
     "N",
     "0",
     "0",
     "M",
     "A",
     "N",
     "0",
     "[",
     "z"
    ],
    [
     "9",
     "T",
     "|",
     "W",
     "G",
     "J",
     "R",
     "X",
     "O",
     "D",
     "C",
     "C",
     "8",
     "H",
     "A",
     "k",
     "E",
     "F",
     "L",
     "[",
     "?",
     "6",
     "f",
     "P",
     "%",
     "#",
     "O",
     "9",
     "z",
     "j",
     "M",
     "V"
    ]
   ],
   "lastDraw": [
    [
     "M",
     "A",
     "K",
     "A",
     "0",
     "N",
     "E",
     "0",
     "N",
     "0",
     "z",
     "[",
     "M"
    ],
    [
     "9",
     "9",
     "z",
     "D",
     "|",
     "C",
     "V",
     "W",
     "%",
     "O",
     "J",
     "F",
     "L",
     "k",
     "6",
     "j",
     "M",
     "R",
     "O",
     "[",
     "f",
     "C",
     "T",
     "?",
     "G",
     "H",
     "X",
     "A",
     "#",
     "P",
     "8",
     "E"
    ]
   ],
   "seed": 1313203
  },
  "cellParameters": {
   "crossedRings/both": {
    "anchorConflicts": {
     "A": "DW",
     "E": "ER",
     "F": "FS",
     "H": "IT",
     "J": "FS",
     "K": "AS",
     "L": "GT",
     "M": "HO",
     "O": "AN",
     "R": "GO",
     "T": "OR",
     "V": "BO",
     "W": "EW",
     "X": "OR",
     "cross13": "AD",
     "dotRing": "DE",
     "mirrorF": "BD",
     "squareSolid": "LT",
     "triangleOpen": "IN",
     "triangleSolid": "AP"
    },
    "anchors": {
     "A": "D",
     "C": "Y",
     "D": "N",
     "E": "E",
     "F": "F",
     "H": "I",
     "J": "F",
     "K": "A",
     "L": "G",
     "M": "H",
     "N": "E",
     "O": "A",
     "P": "I",
     "R": "G",
     "T": "O",
     "V": "B",
     "W": "E",
     "X": "O",
     "bar": "E",
     "cross13": "A",
     "dotRing": "D",
     "mirrorF": "B",
     "mirrorK": "I",
     "squareSolid": "L",
     "tau": "P",
     "triangleOpen": "I",
     "triangleSolid": "A"
    },
    "nullEligibleIds": [
     "G32",
     "halfSquare32",
     "hook32",
     "omega"
    ],
    "nullSets": 15,
    "reachableZ32Lengths": [
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "cross13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "crossedRings/free": {
    "anchorConflicts": {},
    "anchors": {},
    "nullEligibleIds": [
     "C",
     "D",
     "F",
     "G32",
     "H",
     "J",
     "L",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "dotRing",
     "halfSquare32",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ],
    "nullSets": 2626,
    "reachableZ32Lengths": [
     26,
     27,
     28,
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "cross13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "crossedRings/unchangedZ340": {
    "anchorConflicts": {},
    "anchors": {
     "A": "D",
     "C": "Y",
     "D": "N",
     "E": "R",
     "F": "F",
     "H": "I",
     "J": "S",
     "K": "A",
     "L": "G",
     "M": "O",
     "N": "E",
     "O": "A",
     "P": "I",
     "R": "O",
     "T": "R",
     "V": "O",
     "W": "W",
     "X": "R",
     "bar": "E",
     "cross13": "A",
     "dotRing": "D",
     "mirrorF": "B",
     "mirrorK": "I",
     "squareSolid": "T",
     "tau": "P",
     "triangleOpen": "N",
     "triangleSolid": "P"
    },
    "nullEligibleIds": [
     "G32",
     "halfSquare32",
     "hook32",
     "omega"
    ],
    "nullSets": 15,
    "reachableZ32Lengths": [
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "cross13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "crossedRings/unchangedZ408": {
    "anchorConflicts": {},
    "anchors": {
     "A": "W",
     "D": "N",
     "E": "E",
     "F": "S",
     "H": "T",
     "J": "F",
     "K": "S",
     "L": "T",
     "M": "H",
     "N": "E",
     "O": "N",
     "P": "I",
     "R": "G",
     "T": "O",
     "V": "B",
     "W": "E",
     "X": "O",
     "cross13": "D",
     "dotRing": "E",
     "mirrorF": "D",
     "mirrorK": "I",
     "squareSolid": "L",
     "triangleOpen": "I",
     "triangleSolid": "A"
    },
    "nullEligibleIds": [
     "C",
     "G32",
     "bar",
     "halfSquare32",
     "hook32",
     "omega",
     "tau"
    ],
    "nullSets": 64,
    "reachableZ32Lengths": [
     28,
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "cross13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "primary/both": {
    "anchorConflicts": {
     "A": "DW",
     "E": "ER",
     "F": "FS",
     "H": "IT",
     "J": "FS",
     "K": "AS",
     "L": "GT",
     "M": "HO",
     "O": "AN",
     "R": "GO",
     "T": "OR",
     "V": "BO",
     "W": "EW",
     "X": "OR",
     "cross13": "AD",
     "dotRing": "DE",
     "mirrorF": "BD",
     "squareSolid": "LT",
     "triangleOpen": "IN",
     "triangleSolid": "AP"
    },
    "anchors": {
     "A": "D",
     "C": "Y",
     "D": "N",
     "E": "E",
     "F": "F",
     "H": "I",
     "J": "F",
     "K": "A",
     "L": "G",
     "M": "H",
     "N": "E",
     "O": "A",
     "P": "I",
     "R": "G",
     "T": "O",
     "V": "B",
     "W": "E",
     "X": "O",
     "bar": "E",
     "cross13": "A",
     "dotRing": "D",
     "mirrorF": "B",
     "mirrorK": "I",
     "squareSolid": "L",
     "tau": "P",
     "triangleOpen": "I",
     "triangleSolid": "A"
    },
    "nullEligibleIds": [
     "G32",
     "cross32",
     "halfSquare32",
     "hook32",
     "omega"
    ],
    "nullSets": 26,
    "reachableZ32Lengths": [
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "primary/free": {
    "anchorConflicts": {},
    "anchors": {},
    "nullEligibleIds": [
     "C",
     "D",
     "F",
     "G32",
     "H",
     "J",
     "L",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ],
    "nullSets": 2952,
    "reachableZ32Lengths": [
     26,
     27,
     28,
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "primary/unchangedZ340": {
    "anchorConflicts": {},
    "anchors": {
     "A": "D",
     "C": "Y",
     "D": "N",
     "E": "R",
     "F": "F",
     "H": "I",
     "J": "S",
     "K": "A",
     "L": "G",
     "M": "O",
     "N": "E",
     "O": "A",
     "P": "I",
     "R": "O",
     "T": "R",
     "V": "O",
     "W": "W",
     "X": "R",
     "bar": "E",
     "cross13": "A",
     "dotRing": "D",
     "mirrorF": "B",
     "mirrorK": "I",
     "squareSolid": "T",
     "tau": "P",
     "triangleOpen": "N",
     "triangleSolid": "P"
    },
    "nullEligibleIds": [
     "G32",
     "cross32",
     "halfSquare32",
     "hook32",
     "omega"
    ],
    "nullSets": 26,
    "reachableZ32Lengths": [
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "primary/unchangedZ408": {
    "anchorConflicts": {},
    "anchors": {
     "A": "W",
     "D": "N",
     "E": "E",
     "F": "S",
     "H": "T",
     "J": "F",
     "K": "S",
     "L": "T",
     "M": "H",
     "N": "E",
     "O": "N",
     "P": "I",
     "R": "G",
     "T": "O",
     "V": "B",
     "W": "E",
     "X": "O",
     "cross13": "D",
     "dotRing": "E",
     "mirrorF": "D",
     "mirrorK": "I",
     "squareSolid": "L",
     "triangleOpen": "I",
     "triangleSolid": "A"
    },
    "nullEligibleIds": [
     "C",
     "G32",
     "bar",
     "cross32",
     "halfSquare32",
     "hook32",
     "omega",
     "tau"
    ],
    "nullSets": 93,
    "reachableZ32Lengths": [
     28,
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "hook32",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "shortHooks/both": {
    "anchorConflicts": {
     "A": "DW",
     "E": "ER",
     "F": "FS",
     "H": "IT",
     "J": "FS",
     "K": "AS",
     "L": "GT",
     "M": "HO",
     "O": "AN",
     "R": "GO",
     "T": "OR",
     "V": "BO",
     "W": "EW",
     "X": "OR",
     "cross13": "AD",
     "dotRing": "DE",
     "mirrorF": "BD",
     "squareSolid": "LT",
     "triangleOpen": "IN",
     "triangleSolid": "AP"
    },
    "anchors": {
     "A": "D",
     "C": "Y",
     "D": "N",
     "E": "E",
     "F": "F",
     "H": "I",
     "J": "F",
     "K": "A",
     "L": "G",
     "M": "H",
     "N": "E",
     "O": "A",
     "P": "I",
     "R": "G",
     "T": "O",
     "V": "B",
     "W": "E",
     "X": "O",
     "bar": "E",
     "cross13": "A",
     "dotRing": "D",
     "mirrorF": "B",
     "mirrorK": "I",
     "squareSolid": "L",
     "tau": "P",
     "triangleOpen": "I",
     "triangleSolid": "A"
    },
    "nullEligibleIds": [
     "G32",
     "cross32",
     "halfSquare32",
     "omega"
    ],
    "nullSets": 15,
    "reachableZ32Lengths": [
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "hook13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "shortHooks/free": {
    "anchorConflicts": {},
    "anchors": {},
    "nullEligibleIds": [
     "C",
     "D",
     "F",
     "G32",
     "H",
     "J",
     "L",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross32",
     "dotRing",
     "halfSquare32",
     "mirrorF",
     "mirrorK",
     "omega",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ],
    "nullSets": 2626,
    "reachableZ32Lengths": [
     26,
     27,
     28,
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "hook13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "shortHooks/unchangedZ340": {
    "anchorConflicts": {},
    "anchors": {
     "A": "D",
     "C": "Y",
     "D": "N",
     "E": "R",
     "F": "F",
     "H": "I",
     "J": "S",
     "K": "A",
     "L": "G",
     "M": "O",
     "N": "E",
     "O": "A",
     "P": "I",
     "R": "O",
     "T": "R",
     "V": "O",
     "W": "W",
     "X": "R",
     "bar": "E",
     "cross13": "A",
     "dotRing": "D",
     "mirrorF": "B",
     "mirrorK": "I",
     "squareSolid": "T",
     "tau": "P",
     "triangleOpen": "N",
     "triangleSolid": "P"
    },
    "nullEligibleIds": [
     "G32",
     "cross32",
     "halfSquare32",
     "omega"
    ],
    "nullSets": 15,
    "reachableZ32Lengths": [
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "hook13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   },
   "shortHooks/unchangedZ408": {
    "anchorConflicts": {},
    "anchors": {
     "A": "W",
     "D": "N",
     "E": "E",
     "F": "S",
     "H": "T",
     "J": "F",
     "K": "S",
     "L": "T",
     "M": "H",
     "N": "E",
     "O": "N",
     "P": "I",
     "R": "G",
     "T": "O",
     "V": "B",
     "W": "E",
     "X": "O",
     "cross13": "D",
     "dotRing": "E",
     "mirrorF": "D",
     "mirrorK": "I",
     "squareSolid": "L",
     "triangleOpen": "I",
     "triangleSolid": "A"
    },
    "nullEligibleIds": [
     "C",
     "G32",
     "bar",
     "cross32",
     "halfSquare32",
     "omega",
     "tau"
    ],
    "nullSets": 64,
    "reachableZ32Lengths": [
     28,
     29,
     30,
     31,
     32
    ],
    "sharedIds": [
     "A",
     "E",
     "M",
     "hook13"
    ],
    "unionIdOrder": [
     "A",
     "C",
     "D",
     "E",
     "F",
     "G32",
     "H",
     "J",
     "K",
     "L",
     "M",
     "N",
     "O",
     "P",
     "R",
     "T",
     "V",
     "W",
     "X",
     "bar",
     "cross13",
     "cross32",
     "dotRing",
     "halfSquare32",
     "hook13",
     "mirrorF",
     "mirrorK",
     "omega",
     "pinched13",
     "squareSolid",
     "tau",
     "triangleOpen",
     "triangleSolid"
    ]
   }
  },
  "cellParameterNote": "structural only (no fit). both-case cells conflict in all three branches and are zero by rule. Free cells: 26 (primary) / 25 null-eligible IDs, giving 2952 / 2626 null sets with <=3 nulls."
 },
 "generator": {
  "file": "joint_nulls.py",
  "sha256": "38eea82d0280a4ae3ad7c668f2675985653d3fd3a365f5ce0583925cdae8ff75",
  "bytes": 21882
 },
 "generatorSource": "\"\"\"joint-nulls v1: joint Z13/Z32 null-substitution counting model (CPython 3.12, stdlib only).\nUsage: python3 -I joint_nulls.py generate PRIOR_JSON RAWDIR   (vocabularies, controls, parameters; no fits)\n       python3 -I joint_nulls.py toy                          (synthetic known-answer/contradiction/brute tests)\n       python3 -I joint_nulls.py count PRIOR_JSON RAWDIR      (observed + 199 controls; registered, NOT run here)\nPRIOR_JSON = bytes of https://api.imd.fun/artifacts/<PRIOR_SHA>; RAWDIR holds yob1880.txt..yob1950.txt and\nNames_2010Census.csv, all checked against pinned SHA-256.\"\"\"\nimport csv, hashlib, json, random, re, sys\nfrom collections import Counter\nfrom itertools import combinations, product\nfrom math import comb\nfrom pathlib import Path\n\nPRIOR_SHA = '6262429733357009532501273176da5477cac8738d5b6bd0e74fc39533222bdd'\nCENSUS_SHA = '6b4933178060b4e5ac8dd9a611ec15472d35eab98fe9027474bc5ccc5b7a8708'\nGIVEN_CAP, SURNAME_CAP, NAME_LEN = 10000, 50000, 13\nSEED, DRAWS, MAXNULL = 1313203, 199, 3\nBRANCHES = ('primary', 'shortHooks', 'crossedRings')\nCASES = (('free', ()), ('unchangedZ340', ('340',)), ('unchangedZ408', ('408',)), ('both', ('340', '408')))\nZ13 = 'AENz0K0M0[NAM'\nZ32 = 'C9J|#Ok[AMf8?ORTG' + 'X6FDVj%HCELzPW9'\nCOUNT_NAMES = ['keys', 'textPairs', 'z13Projection', 'z32Projection', 'numericPairs']\n\ndef canonical(v):\n    return json.dumps(v, sort_keys=True, separators=(',', ':'), ensure_ascii=True)\n\ndef digest(s):\n    return hashlib.sha256(s.encode('utf-8')).hexdigest()\n\ndef filehash(p):\n    return hashlib.sha256(Path(p).read_bytes()).hexdigest()\n\ndef load_prior(path):\n    assert filehash(path) == PRIOR_SHA, 'prior crosswalk artifact hash mismatch'\n    reg = json.loads(Path(path).read_text(encoding='utf-8'))\n    d = reg['literalData']\n    assert d['z13'] == Z13 and ''.join(d['z32Rows']) == Z32\n    assert reg['protocol']['anchorCases'] == {c: list(s) for c, s in CASES}\n    return reg\n\n# ---------- vocabularies ----------\ndef normalized(name):\n    return name.upper() if re.fullmatch('[A-Za-z]+', name) else None\n\ndef ranked(counts, cap):\n    return sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))[:cap]\n\ndef given_names(rawdir, pins):\n    counts, audit = Counter(), Counter()\n    for year, want in zip(range(1880, 1951), pins['annualSha256InYearOrder'].split()):\n        p = Path(rawdir) / f'yob{year}.txt'\n        assert filehash(p) == want, p\n        with p.open(encoding='utf-8', newline='') as src:\n            for name, sex, count in csv.reader(src):\n                assert sex in ('M', 'F')\n                audit['rows'] += 1\n                t = normalized(name)\n                if t is None:\n                    audit['rowsDroppedNonAlpha'] += 1\n                else:\n                    counts[t] += int(count)\n    audit['distinctNormalized'] = len(counts)\n    return ranked(counts, GIVEN_CAP), dict(audit)\n\ndef surnames(rawdir):\n    p = Path(rawdir) / 'Names_2010Census.csv'\n    assert filehash(p) == CENSUS_SHA\n    counts, audit = Counter(), Counter()\n    with p.open(encoding='utf-8-sig', newline='') as src:\n        for row in csv.DictReader(src):\n            audit['rows'] += 1\n            if row['rank'] == '0':\n                audit['rowsDroppedAggregateRank0'] += 1\n                continue\n            t = normalized(row['name'])\n            if t is None:\n                audit['rowsDroppedNonAlpha'] += 1\n            else:\n                counts[t] += int(row['count'])\n    audit['distinctNormalized'] = len(counts)\n    return ranked(counts, SURNAME_CAP), dict(audit)\n\ndef list_audit(rows, cap):\n    names = [n for n, _ in rows]\n    return dict(retained=len(rows), cap=cap, lastCount=rows[-1][1],\n                tiedAtCutoffRetained=sum(c == rows[-1][1] for _, c in rows),\n                rankedNameCountRowsSha256=digest('\\n'.join(f'{n} {c}' for n, c in rows)),\n                rankedNamesSha256=digest('\\n'.join(names)),\n                lengthHistogram={str(k): v for k, v in sorted(Counter(map(len, names)).items())})\n\ndef z13_cardinality(given, sur):\n    \"\"\"Exact count of length-13 given+surname pairs and of distinct concatenations (unmaterialized):\n    a string is counted at its shortest valid split only.\"\"\"\n    gset, sset = set(given), set(sur)\n    sur_len = Counter(map(len, sur))\n    pairs = sum(sur_len[NAME_LEN - len(g)] for g in given if 0 < len(g) < NAME_LEN)\n    tails = {}\n    for s in sur:\n        for j in range(1, len(s)):\n            tails.setdefault((s[:j], len(s)), []).append(s[j:])\n    dup = 0\n    for g in given:\n        L = len(g)\n        if not 0 < L < NAME_LEN:\n            continue\n        bad = set()\n        for j in range(1, L):\n            if g[:j] in gset:\n                for t in tails.get((g[j:], NAME_LEN - j), ()):\n                    if len(t) == NAME_LEN - L and t in sset:\n                        bad.add(t)\n        dup += len(bad)\n    return pairs, pairs - dup\n\ndef g_strings(d):\n    \"\"\"All 840 G expansions of report section 6, spaces removed; text -> sorted [angle, distance] pairs.\"\"\"\n    numeric, n = {}, 0\n    for a, dist, tpl in product(range(7), range(1, 13), d['templates']):\n        A = d['numberWords'][a] + (' RADIAN' if a == 1 else ' RADIANS')\n        D = d['numberWords'][dist] + (' INCH' if dist == 1 else ' INCHES')\n        text = tpl.format(A=A, D=D).replace(' ', '')\n        numeric.setdefault(text, set()).add((a, dist))\n        n += 1\n    assert n == 840\n    ten = sorted(t for t in numeric if len(t) == 32)\n    assert digest('\\n'.join(ten)) == 'f64b62d0764290fe042b908e34ed11d48f9bdd8274c2426d59d4510442f7b8b3'\n    return {t: sorted(v) for t, v in numeric.items()}\n\n# ---------- crosswalk (reused verbatim in meaning from the prior registration) ----------\ndef branch_of(d, name):\n    return next(b for b in d['branches'] if b['name'] == name)\n\ndef resolve(d, sample, branch):\n    return [tuple(branch['merge'].get(f + c, d['ids'][f + c]) for c in s) for f, s in zip(('13', '32'), sample)]\n\ndef anchor_map(d, branch, mode):\n    anchors = {}\n    for short, o340, o408 in d['anchorLinks'] + branch['historicalAdd']:\n        if short in branch['removeLinks']:\n            continue\n        glyph = branch['merge'].get(short, d['ids'][short])\n        for src, old in (('340', o340), ('408', o408)):\n            if old is None or src not in mode or (src == '408' and old in branch['free408']):\n                continue\n            anchors.setdefault(glyph, set()).add(d['historical'][src]['key'][old])\n    conflicts = {g: ''.join(sorted(s)) for g, s in anchors.items() if len(s) > 1}\n    return {g: min(s) for g, s in anchors.items()}, conflicts\n\n# ---------- indexes ----------\nclass Bits:\n    \"\"\"Position/equality bitset index over one sorted word list of a single length.\"\"\"\n    def __init__(self, words):\n        self.words, self.cache, self.all = words, {}, (1 << len(words)) - 1\n    def mask(self, i, cond):\n        key = (i, cond)\n        if key not in self.cache:\n            m = 0\n            for idx, w in enumerate(self.words):\n                if w[i] == (w[cond] if isinstance(cond, int) else cond):\n                    m |= 1 << idx\n            self.cache[key] = m\n        return self.cache[key]\n    def members(self, bits):\n        while bits:\n            b = bits & -bits\n            yield self.words[b.bit_length() - 1]\n            bits ^= b\n\ndef by_length(words):\n    out = {}\n    for w in sorted(set(words)):\n        out.setdefault(len(w), []).append(w)\n    return out\n\ndef make_indexes(given, sur, gnumeric):\n    return dict(given=by_length(given), sur={m: Bits(w) for m, w in by_length(sur).items()},\n                g={n: Bits(w) for n, w in by_length(gnumeric).items()}, numeric=gnumeric)\n\n# ---------- one cell ----------\ndef z13_local(r13, anchors, shared, ix):\n    n, first = len(r13), {}\n    for i, g in enumerate(r13):\n        first.setdefault(g, i)\n    out = {}\n    for L in range(1, n):\n        B, G = ix['sur'].get(n - L), ix['given'].get(L)\n        if not B or not G:\n            continue\n        base, cross = B.all, []\n        for j in range(L, n):\n            g, f = r13[j], first[r13[j]]\n            if f >= L:\n                if f != j:\n                    base &= B.mask(j - L, f - L)\n                elif g in anchors:\n                    base &= B.mask(j - L, anchors[g])\n            else:\n                cross.append((j - L, f))\n        if not base:\n            continue\n        pre = [(i, first[r13[i]], anchors.get(r13[i]) if first[r13[i]] == i else None) for i in range(L)]\n        for name in G:\n            if any(name[i] != name[f] or (c is not None and name[i] != c) for i, f, c in pre):\n                continue\n            poss = base\n            for k, f in cross:\n                poss &= B.mask(k, name[f])\n                if not poss:\n                    break\n            for s in B.members(poss):\n                x = name + s\n                out.setdefault(tuple(x[first[g]] for g in shared), set()).add(x)\n    return out\n\ndef z32_local(r32, anchors, shared, eligible, ix, maxnull=MAXNULL):\n    res = []\n    for k in range(maxnull + 1):\n        for N in combinations(eligible, k):\n            seq = [g for g in r32 if g not in N]\n            B = ix['g'].get(len(seq))\n            if not B:\n                continue\n            first, poss = {}, B.all\n            for i, g in enumerate(seq):\n                if g in first:\n                    poss &= B.mask(i, first[g])\n                else:\n                    first[g] = i\n                    if g in anchors:\n                        poss &= B.mask(i, anchors[g])\n                if not poss:\n                    break\n            still = len(first) < len(seq)\n            for y in B.members(poss):\n                res.append((k, N, y, tuple(y[first[g]] for g in shared), still))\n    return res\n\ndef join_counts(X, Y, numeric):\n    buckets = {}\n    for k, N, y, b, still in Y:\n        if b in X:\n            buckets.setdefault(b, []).append(y)\n    keys = sum(len(X[b]) * len(ys) for b, ys in buckets.items())\n    pairs = sum(len(X[b]) * len(set(ys)) for b, ys in buckets.items())\n    z13 = sum(len(X[b]) for b in buckets)\n    ys = set().union(*buckets.values()) if buckets else set()\n    nums = {tuple(p) for y in ys for p in numeric[y]}\n    return [keys, pairs, z13, len(ys), len(nums)]\n\ndef cell(r13, r32, anchors, conflicts, ix, maxnull=MAXNULL):\n    union = sorted(set(r13) | set(r32))\n    shared = sorted(set(r13) & set(r32))\n    eligible = sorted(set(r32) - set(r13) - set(anchors))\n    params = dict(unionTypes=len(union), z13Types=len(set(r13)), z32Types=len(set(r32)), sharedTypes=len(shared),\n                  anchoredUnionTypes=len(set(anchors) & set(union)), nullEligibleTypes=len(eligible),\n                  nullSets=sum(comb(len(eligible), k) for k in range(maxnull + 1)),\n                  z32RepeatedTypes=sum(r32.count(g) > 1 for g in set(r32)))\n    zero = [0] * len(COUNT_NAMES)\n    rec = dict(anchorConflicts=conflicts, parameters=params)\n    if conflicts:\n        rec.update(marginals=dict(z13LocalTexts=0, z32LocalTriples=0, z32LocalTexts=0, z32LocalStillRepeatedTriples=0),\n                   all=zero, z32StillRepeated=zero, budgetAll={str(k): zero for k in range(maxnull + 1)},\n                   budgetStillRepeated={str(k): zero for k in range(maxnull + 1)})\n        return rec\n    X = z13_local(r13, anchors, shared, ix)\n    Y = z32_local(r32, anchors, shared, eligible, ix, maxnull)\n    num = ix['numeric']\n    rec['marginals'] = dict(z13LocalTexts=sum(map(len, X.values())), z32LocalTriples=len(Y),\n                            z32LocalTexts=len({t[2] for t in Y}), z32LocalStillRepeatedTriples=sum(t[4] for t in Y))\n    still = [t for t in Y if t[4]]\n    rec['all'] = join_counts(X, Y, num)\n    rec['z32StillRepeated'] = join_counts(X, still, num)\n    rec['budgetAll'] = {str(k): join_counts(X, [t for t in Y if t[0] == k], num) for k in range(maxnull + 1)}\n    rec['budgetStillRepeated'] = {str(k): join_counts(X, [t for t in still if t[0] == k], num) for k in range(maxnull + 1)}\n    return rec\n\n# ---------- controls and full run ----------\ndef control_draws(z13=Z13, z32=Z32, seed=SEED, draws=DRAWS):\n    rng, out = random.Random(seed), []\n    for _ in range(draws):\n        x, y = list(z13), list(z32)\n        rng.shuffle(x)\n        rng.shuffle(y)\n        out.append([x, y])\n    return out\n\ndef run(d, ix, samples, branches=BRANCHES, cases=CASES):\n    \"\"\"samples[0] is observed; the rest are controls. Same draws for every cell.\"\"\"\n    results = {}\n    for bname in branches:\n        branch = branch_of(d, bname)\n        for cname, mode in cases:\n            anchors, conflicts = anchor_map(d, branch, mode)\n            recs = []\n            for s in samples:\n                r13, r32 = resolve(d, s, branch)\n                recs.append(cell(r13, r32, anchors, conflicts, ix))\n            obs, ctrl = recs[0], recs[1:]\n            ge = {st: [sum(c[st][i] >= obs[st][i] for c in ctrl) for i in range(len(COUNT_NAMES))]\n                  for st in ('all', 'z32StillRepeated')}\n            results[f'{bname}/{cname}'] = dict(observed=obs, controlGE=ge,\n                                               tailP={st: [f'{1 + g}/{len(ctrl) + 1}' for g in v] for st, v in ge.items()},\n                                               indexedCountsSha256=digest(canonical([[i, r] for i, r in enumerate(recs)])))\n    return results\n\ndef build(prior_path, rawdir):\n    reg = load_prior(prior_path)\n    d = reg['literalData']\n    grows, gaud = given_names(rawdir, d['inputPins']['ssa'])\n    srows, saud = surnames(rawdir)\n    given, sur = [n for n, _ in grows], [n for n, _ in srows]\n    assert digest('\\n'.join(given[:1000])) == reg['protocol']['dataSha256']['given']\n    assert digest('\\n'.join(sur[:1000])) == reg['protocol']['dataSha256']['surname']\n    gnum = g_strings(d)\n    return reg, d, given, sur, gnum, dict(given=dict(gaud, **list_audit(grows, GIVEN_CAP)),\n                                          surname=dict(saud, **list_audit(srows, SURNAME_CAP)))\n\ndef generate(prior_path, rawdir):\n    reg, d, given, sur, gnum, aud = build(prior_path, rawdir)\n    pairs, distinct = z13_cardinality(given, sur)\n    draws = control_draws()\n    cells = {}\n    for bname in BRANCHES:\n        branch = branch_of(d, bname)\n        r13, r32 = resolve(d, (Z13, Z32), branch)\n        for cname, mode in CASES:\n            anchors, conflicts = anchor_map(d, branch, mode)\n            union = sorted(set(r13) | set(r32))\n            elig = sorted(set(r32) - set(r13) - set(anchors))\n            cells[f'{bname}/{cname}'] = dict(\n                unionIdOrder=union, sharedIds=sorted(set(r13) & set(r32)), anchors=dict(sorted(anchors.items())),\n                anchorConflicts=conflicts, nullEligibleIds=elig,\n                nullSets=sum(comb(len(elig), k) for k in range(MAXNULL + 1)),\n                reachableZ32Lengths=sorted({len([g for g in r32 if g not in N]) for k in range(MAXNULL + 1)\n                                            for N in combinations(elig, k)}))\n    glen = Counter(map(len, gnum))\n    out = dict(names=aud, z13=dict(length13Pairs=pairs, distinctConcatenations=distinct, materialized=False),\n               z32=dict(baseExpansions=840, distinctTexts=len(gnum), lengthHistogram={str(k): v for k, v in sorted(glen.items())},\n                        sortedTextsSha256=digest('\\n'.join(sorted(gnum))),\n                        numericMapSha256=digest(canonical(dict(sorted(gnum.items())))),\n                        textsOfLength26to32=sum(v for k, v in glen.items() if 26 <= k <= 32)),\n               controls=dict(seed=SEED, draws=DRAWS, controlsSha256=digest(canonical(draws)),\n                             firstDraw=draws[0], lastDraw=draws[-1]),\n               cellParameters=cells)\n    print(canonical(out))\n\ndef count(prior_path, rawdir):\n    reg, d, given, sur, gnum, aud = build(prior_path, rawdir)\n    ix = make_indexes(given, sur, gnum)\n    samples = [[list(Z13), list(Z32)]] + control_draws()\n    print(canonical(dict(version='joint-nulls-v1', results=run(d, ix, samples))))\n\n# ---------- toys ----------\ndef brute(r13, r32, anchors, conflicts, names13, gnum, maxnull=MAXNULL):\n    \"\"\"Independent enumerator: every null set over ALL union types, every materialized text pair.\"\"\"\n    zero = [0] * 5\n    if conflicts:\n        return zero, zero\n    union = sorted(set(r13) | set(r32))\n    keys, keys_s, num = set(), set(), {}\n    for k in range(maxnull + 1):\n        for N in combinations(union, k):\n            if any(g in anchors for g in N):\n                continue\n            s13 = [g for g in r13 if g not in N]\n            s32 = [g for g in r32 if g not in N]\n            for x in names13:\n                if len(x) != len(r13) or len(x) != len(s13):\n                    continue\n                for y in gnum:\n                    if len(y) != len(s32):\n                        continue\n                    key, ok = {g: '' for g in N}, True\n                    for g, c in list(zip(s13, x)) + list(zip(s32, y)):\n                        if key.setdefault(g, c) != c:\n                            ok = False\n                    if ok and all(key.get(g, c) == c for g, c in anchors.items()):\n                        vec = tuple(key[g] for g in union)\n                        keys.add((vec, x, y))\n                        if len(set(s32)) < len(s32):\n                            keys_s.add((vec, x, y))\n    def summ(S):\n        ys = {y for _, _, y in S}\n        return [len({v for v, _, _ in S}), len({(x, y) for _, x, y in S}), len({x for _, x, _ in S}), len(ys),\n                len({tuple(p) for y in ys for p in gnum[y]})]\n    return summ(keys), summ(keys_s)\n\ndef toy_ix(given, sur, gnum):\n    return make_indexes(given, sur, gnum)\n\ndef toy():\n    report = {}\n    # Known answer. Toy \"13\" length 3 = a b a; toy Z32 = a c d c; d and c are null-eligible.\n    given, sur = ['X', 'XY'], ['YX', 'X', 'Z']\n    gnum = {'XQRQ': [(1, 1)], 'XQQ': [(1, 2)], 'XZ': [(1, 1)], 'YQQ': [(2, 2)]}\n    r13, r32 = ('a', 'b', 'a'), ('a', 'c', 'd', 'c')\n    ix = toy_ix(given, sur, gnum)\n    rec = cell(r13, r32, {}, {}, ix)\n    exp = dict(all=[3, 3, 1, 3, 2], z32StillRepeated=[2, 2, 1, 2, 2], z13LocalTexts=1, z32LocalTriples=4,\n               budgetAll={'0': [1, 1, 1, 1, 1], '1': [2, 2, 1, 2, 2], '2': [0] * 5, '3': [0] * 5})\n    got = dict(all=rec['all'], z32StillRepeated=rec['z32StillRepeated'], z13LocalTexts=rec['marginals']['z13LocalTexts'],\n               z32LocalTriples=rec['marginals']['z32LocalTriples'], budgetAll=rec['budgetAll'])\n    assert got == exp, got\n    report['knownAnswer'] = 'pass'\n    # Contradictions.\n    assert cell(r13, r32, {'a': 'X'}, {'a': 'XY'}, ix)['all'] == [0] * 5           # conflicting anchors give zero\n    assert cell(r13, r32, {'d': 'R'}, {}, ix)['all'] == [1, 1, 1, 1, 1]               # fixed d cannot be null\n    assert cell(r13, r32, {'d': 'S'}, {}, ix)['all'] == [0] * 5                       # fixed letter incompatible\n    ix2 = toy_ix(['X'], ['X'], {'XQRQ': [(1, 1)]})                                    # only 2-letter name: a Z13 null\n    assert cell(r13, r32, {}, {}, ix2)['all'] == [0] * 5                              # would be needed -> zero\n    assert cell(r13, r32, {}, {}, ix, maxnull=0)['all'] == [1, 1, 1, 1, 1]            # budget 0 = no-null model\n    report['contradictions'] = 'pass'\n    # Randomized agreement with the brute-force enumerator.\n    rng, trials, nonzero = random.Random(20261203), 400, 0\n    for _ in range(trials):\n        al = 'PQR'\n        g = sorted({''.join(rng.choice(al) for _ in range(rng.randint(1, 3))) for _ in range(6)})\n        s = sorted({''.join(rng.choice(al) for _ in range(rng.randint(1, 3))) for _ in range(6)})\n        n13 = rng.randint(3, 4)\n        names13 = {a + b for a in g for b in s if len(a + b) == n13}\n        gn = {}\n        for _ in range(12):\n            gn.setdefault(''.join(rng.choice(al) for _ in range(rng.randint(2, 6))), set()).add((rng.randint(0, 2), rng.randint(1, 2)))\n        gn = {t: sorted(v) for t, v in gn.items()}\n        t13 = [rng.choice('abcd') for _ in range(n13)]\n        t32 = [rng.choice('cdefgh') for _ in range(rng.randint(3, 7))]\n        anchors = {gl: rng.choice(al) for gl in rng.sample('abcdefgh', rng.randint(0, 2))}\n        conflicts = {'a': 'PQ'} if rng.random() < 0.05 else {}\n        ixr = toy_ix(g, s, gn)\n        rec = cell(tuple(t13), tuple(t32), anchors, conflicts, ixr)\n        ball, bstill = brute(t13, t32, anchors, conflicts, names13, gn)\n        assert rec['all'] == ball and rec['z32StillRepeated'] == bstill, (t13, t32, anchors, rec['all'], ball)\n        nonzero += ball[0] > 0\n    report['bruteAgreement'] = f'{trials}/{trials} random toys agree; {nonzero} with nonzero keys'\n    # Wiring of the full run on a toy registration (two cells, observed + 3 draws).\n    td = dict(ids={'13a': 'a', '13b': 'b', '32a': 'a', '32c': 'c', '32d': 'd'},\n              branches=[dict(name='primary', merge={}, historicalAdd=[], removeLinks=[], free408=[])],\n              anchorLinks=[['32d', 'D', None]], historical={'340': {'key': {'D': 'R'}}, '408': {'key': {}}})\n    samples = [[list('aba'), list('acdc')]] + control_draws('aba', 'acdc', SEED, 3)\n    res = run(td, ix, samples, branches=('primary',), cases=(('free', ()), ('unchangedZ340', ('340',))))\n    assert res['primary/free']['observed']['all'] == [3, 3, 1, 3, 2]\n    assert res['primary/unchangedZ340']['observed']['all'] == [1, 1, 1, 1, 1]\n    report['runWiring'] = 'pass'\n    report['toyRunSha256'] = digest(canonical(res))\n    print(canonical(report))\n\nif __name__ == '__main__':\n    if sys.version_info[:2] != (3, 12) or sys.implementation.name != 'cpython':\n        raise SystemExit('Use CPython 3.12 for the registered random stream.')\n    cmd = sys.argv[1] if len(sys.argv) > 1 else ''\n    if cmd == 'toy':\n        toy()\n    elif cmd in ('generate', 'count') and len(sys.argv) == 4:\n        (generate if cmd == 'generate' else count)(sys.argv[2], sys.argv[3])\n    else:\n        raise SystemExit(__doc__)\n",
 "toys": {
  "result": {
   "bruteAgreement": "400/400 random toys agree; 184 with nonzero keys",
   "contradictions": "pass",
   "knownAnswer": "pass",
   "runWiring": "pass",
   "toyRunSha256": "5a96933956334750f8bd2a792423afeadc3bebcec3456c73a34eaffb6c298187"
  },
  "expectations": {
   "knownAnswer": "Z13 toy a b a, Z32 toy a c d c, given [X, XY], surnames [YX, X, Z], G {XQRQ:(1,1), XQQ:(1,2), XZ:(1,1), YQQ:(2,2)}: all=[3,3,1,3,2], z32StillRepeated=[2,2,1,2,2], budgets k0=[1,1,1,1,1], k1=[2,2,1,2,2]; XYX counted once although it has two splits; YQQ survives locally but not jointly",
   "contradictions": "conflicting anchors -> zero; anchor d=R removes N={d} and leaves [1,1,1,1,1]; anchor d=S -> zero; a fit that needs a Z13 null -> zero; maxnull 0 -> [1,1,1,1,1]",
   "bruteForce": "indexed counts equal an independent enumerator over all union null sets and materialized text pairs on 400 seeded random toys (Random(20261203))",
   "wiring": "run() on a toy registration with 3 draws reproduces the known answer in free and anchored cells"
  }
 },
 "fits": {
  "observed": "not_run",
  "controls": "not_run",
  "candidateReadings": "none proposed"
 },
 "limitations": [
  "Literal reading of the brief: Z13 must emit exactly 13 letters, so nulls never touch Z13; the joint-null freedom acts only on Z32-only identities. A registration letting Z13 nulls shorten the name would be a different model.",
  "both-case cells are zero by the anchor-conflict rule in every branch; they are structural zeros, not evidence.",
  "Name lists (SSA births 1880-1950, Census 2010 surnames) and the G grammar are experimental restrictions; true name format, numbers, units and phrasing may differ.",
  "Exploratory widening of an experiment whose length-32 marginal was already empty; any nonzero count is a fit, not a decipherment.",
  "The full count run (observed + 199 controls x 12 cells) was not executed here, by instruction; an independent second-agent check of the count is still required."
 ],
 "changeConclusion": "Only an authenticated key or worksheet, a demonstrably linked second message with independent constraints, or a prehashed external prediction verified by a second agent could distinguish a decipherment. Counts from this model can show whether joint constraints leave zero, one or many readings relative to shuffles, but cannot select a plaintext. Z32 stays unsolved.",
 "gates": {
  "ready": "pass",
  "why": "protocol, vocabularies (ranked-list hashes, exact cardinalities), crosswalk pins, control stream digest, serialization, counts, strata, budgets and generator source/hash are frozen; toys pass"
 }
}