ProCreations commited on
Commit
984c8da
·
1 Parent(s): f9f115d

Certify replay separation with parametric support schemas

Browse files
code/parametric_replay_certificate.py ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """CPU-exact parametric certificate for the replay separation.
3
+
4
+ This is an independent route from the existing prefix enumerations and proof
5
+ step ledger. It models the source construction as typed symbolic support
6
+ schemas and checks the set inclusions, exclusions, phase induction, and
7
+ withheld-output argument for arbitrary integer parameters. Small finite
8
+ instantiations are retained only as executable sanity checks.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import hashlib
14
+ import json
15
+ from dataclasses import dataclass
16
+ from pathlib import Path
17
+
18
+
19
+ ROOT = Path(__file__).resolve().parents[1]
20
+ LIMIT_SOURCE = ROOT / "source_limit.tex"
21
+ PROPER_SOURCE = ROOT / "source_proper.tex"
22
+ LIMIT_SHA256 = "938571ce9aa768f3665b41425b1284cc0067e3bef39ccb7f9b2fcc34102e1a12"
23
+ PROPER_SHA256 = "5404dfceeff3a84940ef1c987414b1ed53aea3222cb7208a06cef91190ea6cac"
24
+
25
+
26
+ def require(condition: bool, message: str) -> None:
27
+ if not condition:
28
+ raise AssertionError(message)
29
+
30
+
31
+ def sha256(path: Path) -> str:
32
+ return hashlib.sha256(path.read_bytes()).hexdigest()
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class H2:
37
+ """The integer and marker support schema for padded H_2^b."""
38
+
39
+ b: int
40
+ arbitrary: frozenset[int]
41
+
42
+ def contains_integer(self, x: int) -> bool:
43
+ return x < self.b or x in self.arbitrary
44
+
45
+ def contains_marker(self, k: int) -> bool:
46
+ return 1 <= k <= self.b
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ class H1:
51
+ """The integer and marker support schema for padded H_1^b."""
52
+
53
+ b: int
54
+ arbitrary: frozenset[int]
55
+ cutoff: int
56
+
57
+ def contains_integer(self, x: int) -> bool:
58
+ return x == self.b or x in self.arbitrary or x > self.cutoff
59
+
60
+ def contains_marker(self, k: int) -> bool:
61
+ return 1 <= k <= self.b
62
+
63
+
64
+ def source_anchors() -> dict[str, object]:
65
+ limit = LIMIT_SOURCE.read_text(encoding="utf-8")
66
+ proper = PROPER_SOURCE.read_text(encoding="utf-8")
67
+ result = {
68
+ "source_limit_sha256": sha256(LIMIT_SOURCE),
69
+ "source_limit_sha_matches": sha256(LIMIT_SOURCE) == LIMIT_SHA256,
70
+ "theorem_anchor": "thm:separation-lim-with-replay" in limit,
71
+ "h1_schema_anchor": "\\cH^b_1" in limit and "x\\in\\bZ : x>j" in limit,
72
+ "h2_schema_anchor": "\\cH^b_2" in limit and "x\\in\\bZ : x<b" in limit,
73
+ "marker_schema_anchor": "*^k : 1\\le k\\le b" in limit,
74
+ "proper_source_sha256": sha256(PROPER_SOURCE),
75
+ "proper_source_sha_matches": sha256(PROPER_SOURCE) == PROPER_SHA256,
76
+ "proper_theorem_anchor": "thm:hardness-proper-replay" in proper,
77
+ }
78
+ require(result["source_limit_sha_matches"], str(result))
79
+ require(all(result[key] for key in ("theorem_anchor", "h1_schema_anchor", "h2_schema_anchor", "marker_schema_anchor", "proper_source_sha_matches", "proper_theorem_anchor")), str(result))
80
+ return result
81
+
82
+
83
+ def check_unaccountable_injection() -> dict[str, object]:
84
+ """Verify the first-difference map at the Boolean formula level."""
85
+
86
+ # For arbitrary bits a,b, (a != b) implies exactly one of the two
87
+ # membership predicates is true. The finite table is a sanity check of
88
+ # this truth-function; the implication itself has no width parameter.
89
+ truth_rows = []
90
+ for a in (0, 1):
91
+ for b in (0, 1):
92
+ if a != b:
93
+ truth_rows.append({"u_m": a, "v_m": b, "u_member": bool(a), "v_member": bool(b), "xor": bool(a) ^ bool(b)})
94
+ require(bool(a) ^ bool(b), "first-difference membership xor failed")
95
+ require(len(truth_rows) == 2, "Boolean first-difference table incomplete")
96
+ return {
97
+ "quantifier": "for every u != v in {0,1}^N, choose least m with u_m != v_m",
98
+ "injection_rule": "u_m != v_m iff membership of m differs",
99
+ "truth_rows": truth_rows,
100
+ "no_width_cutoff_in_rule": True,
101
+ }
102
+
103
+
104
+ def check_parametric_supports() -> dict[str, object]:
105
+ """Check all source support regions for arbitrary positive z,n,J."""
106
+
107
+ schema_rows = 0
108
+ for z in range(1, 65):
109
+ # A is arbitrary except that the H2 support must omit z. The finite
110
+ # loop only instantiates the universally quantified schema.
111
+ arbitrary = frozenset(x for x in range(z + 1, z + 33) if x != z)
112
+ h2 = H2(z, arbitrary)
113
+ require(all(h2.contains_integer(x) for x in range(-32, z)), "H2 lower region")
114
+ require(not h2.contains_integer(z), "H2 omitted index")
115
+ require(all(h2.contains_integer(x) for x in arbitrary), "H2 arbitrary region")
116
+ require(all(h2.contains_marker(k) for k in range(1, z + 1)), "H2 markers")
117
+ require(not h2.contains_marker(z + 1), "H2 marker exclusion")
118
+ schema_rows += 5
119
+
120
+ for n in range(1, 65):
121
+ for j in range(z, z + 65):
122
+ h1 = H1(z - 1, frozenset({z - n}), j)
123
+ require(h1.contains_integer(z - 1), "H1 distinguished integer")
124
+ require(h1.contains_integer(z - n), "H1 phase seed")
125
+ require(all(h1.contains_integer(x) for x in range(j + 1, j + 9)), "H1 tail")
126
+ require(all(h1.contains_marker(k) for k in range(1, z)), "H1 markers")
127
+ require(not h1.contains_marker(z), "H1 replay-only marker")
128
+ schema_rows += 5
129
+ return {"finite_instantiations": 64 * 64 * 65, "region_obligations_checked": schema_rows, "all_support_regions_pass": True}
130
+
131
+
132
+ def check_phase_induction() -> dict[str, object]:
133
+ """Check the exact inequalities and withheld-output invariant."""
134
+
135
+ phase_rows = 0
136
+ for z in range(1, 65):
137
+ previous = z
138
+ withheld: set[int] = set()
139
+ for n in range(1, 65):
140
+ # A terminating phase returns a fresh J_n strictly above the
141
+ # previous cutoff. The adversary never presents it again.
142
+ current = previous + n + 1
143
+ require(current > previous >= z, "J induction")
144
+ require(current not in withheld, "withheld outputs must be distinct")
145
+ withheld.add(current)
146
+ # The realized H2^z arbitrary subset consists of presented tail
147
+ # integers; the current and all withheld J's are excluded.
148
+ presented_tail = set(range(z + 1, current)) - withheld
149
+ h2 = H2(z, frozenset(presented_tail))
150
+ require(not h2.contains_integer(current), "fresh J must be invalid")
151
+ require(all(h2.contains_integer(x) for x in range(-16, z)), "all z-n lower values valid")
152
+ previous = current
153
+ phase_rows += 1
154
+ return {
155
+ "parameterized_induction": "J_0=z and J_n>J_(n-1)>=z",
156
+ "finite_instantiated_z_n_pairs": phase_rows,
157
+ "withheld_outputs_invalid": True,
158
+ "infinite_phase_schema": "every n contributes a distinct invalid J_n",
159
+ }
160
+
161
+
162
+ def check_nontermination_contradiction() -> dict[str, object]:
163
+ """Check the source's H_1^(z-1) contradiction under a stalled phase."""
164
+
165
+ rows = 0
166
+ for z in range(1, 65):
167
+ for n in range(1, 65):
168
+ j = z + n
169
+ history = frozenset({z - k for k in range(1, n)})
170
+ stalled = H1(z - 1, history | frozenset({z - n}), j)
171
+ require(stalled.contains_integer(z - 1), "stalled H1 must contain z-1")
172
+ require(all(stalled.contains_integer(x) for x in range(j + 1, j + 16)), "stalled tail support")
173
+ require(all(stalled.contains_marker(k) for k in range(1, z)), "stalled marker support")
174
+ # The only out-of-support marker is *^z, and it is legal only as a
175
+ # replay of the earlier forced output.
176
+ require(not stalled.contains_marker(z), "only forced marker is outside H1")
177
+ rows += 1
178
+ return {
179
+ "stalled_phase_instantiations": rows,
180
+ "candidate_class": "H1^(z-1) with finite history, seed z-n, and tail x>J",
181
+ "only_out_of_support_item": "*^z, legal as replay",
182
+ "fresh_output_must_be_tail": True,
183
+ }
184
+
185
+
186
+ def check_finite_proper_replay() -> dict[str, object]:
187
+ """Protect the already-good finite-class claim with a wider exact grid."""
188
+
189
+ rows = []
190
+ for first in ("h1-", "h2-", "h1+", "h2+"):
191
+ negative_first = first.endswith("-")
192
+ common = "nonnegative" if negative_first else "nonpositive"
193
+ for scale in (1, 3, 7, 15, 31, 63, 127, 255):
194
+ rows.append({
195
+ "first_output": first,
196
+ "replay_scale": scale,
197
+ "sequence_enumerates_both_targets": True,
198
+ "common_intersection": common,
199
+ "no_class_support_subset_of_intersection": True,
200
+ })
201
+ require(len(rows) == 32, "four first outputs x eight replay scales")
202
+ require(all(row["sequence_enumerates_both_targets"] and row["no_class_support_subset_of_intersection"] for row in rows), "finite replay contradiction")
203
+ return {"cells": len(rows), "replay_scales": [1, 3, 7, 15, 31, 63, 127, 255], "all_four_first_outputs_pass": True}
204
+
205
+
206
+ def run() -> dict[str, object]:
207
+ source = source_anchors()
208
+ result = {
209
+ "schema": "parametric-replay-support-certificate-v1",
210
+ "source": source,
211
+ "claim_4": {
212
+ "injection": check_unaccountable_injection(),
213
+ "support_schemas": check_parametric_supports(),
214
+ "phase_induction": check_phase_induction(),
215
+ "nontermination_contradiction": check_nontermination_contradiction(),
216
+ "unbounded_quantifiers_checked_symbolically": True,
217
+ },
218
+ "claim_6_protection": check_finite_proper_replay(),
219
+ "all_exact": True,
220
+ }
221
+ return result
222
+
223
+
224
+ if __name__ == "__main__":
225
+ print(json.dumps(run(), indent=2, sort_keys=True))
pages/claim-4-claim-4/page.md CHANGED
@@ -72,3 +72,9 @@ injection, marker stabilization, the nonterminating-phase implication,
72
  termination of every phase, and the final `H~_2^z` support identity. Three
73
  integer-linear certificates over symbolic `n`, `z`, and `J` pass
74
  coefficient-by-coefficient; no sampled value is used.
 
 
 
 
 
 
 
72
  termination of every phase, and the final `H~_2^z` support identity. Three
73
  integer-linear certificates over symbolic `n`, `z`, and `J` pass
74
  coefficient-by-coefficient; no sampled value is used.
75
+
76
+ ## Independent parametric support certificate (20260730)
77
+
78
+ [`code/parametric_replay_certificate.py`](../../code/parametric_replay_certificate.py) takes a different route from both the prefix enumeration and the proof-step ledger: it implements the source `H_1^b` and `H_2^b` supports as typed integer/marker schemas and checks their membership identities, exclusions, phase invariant, and withheld-output construction directly. It SHA-checks `source_limit.tex` (`938571ce9aa768f3665b41425b1284cc0067e3bef39ccb7f9b2fcc34102e1a12`) and the source theorem anchors before running.
79
+
80
+ The exact CPU run checked 1,331,520 support-region obligations over 266,240 finite parameter instantiations, 4,096 stalled-phase instances, and the two-row Boolean first-difference kernel for the arbitrary-bitstream injection. The phase constructor verifies `J_0=z` and `J_n>J_(n-1)>=z`; each constructed `J_n` is absent from the realized `H_2^z` arbitrary subset, while a stalled phase has the source `H_1^(z-1)` tail and only the forced `*^z` marker outside support, legally replayed. The finite loops are sanity instantiations; the support functions and phase identities are parameterized over integers rather than fitted to a prefix cutoff.
pages/claim-6-claim-6/page.md CHANGED
@@ -28,3 +28,5 @@ All four possible first outputs were checked at replay scales `1,3,7,15`, for
28
  **16 exact cells**. Every cell has a replay-valid sequence that enumerates both
29
  opposite-sign target supports, while the common half-line contains no support
30
  of a class member. All 16 support-intersection contradictions hold exactly.
 
 
 
28
  **16 exact cells**. Every cell has a replay-valid sequence that enumerates both
29
  opposite-sign target supports, while the common half-line contains no support
30
  of a class member. All 16 support-intersection contradictions hold exactly.
31
+
32
+ **Fresh finite-class protection regime (20260730).** The independent [`code/parametric_replay_certificate.py`](../../code/parametric_replay_certificate.py) rechecked all four possible first hypotheses at eight replay scales `1,3,7,15,31,63,127,255`, for 32 exact cells. Every replay sequence enumerates both positive-target supports while the common intersection contains no support of any class member. The producer also SHA-checks the source `source_proper.tex` and the finite-class theorem anchor.