Manuscript XVI-O1-ST@5 · XVI-O1-ST-v5.tex · listing · dd45e0d1
Listing: Listing
Proposed v5 exact regression with retained discrepancy · lines 2795–3413
#!/usr/bin/env python3
"""
XVI-O1-ST-v5: exact finite regression with a retained discrepancy.
No loop engine, original scientific matrix, or R archive is read.
Exit 2 means regression contracts satisfied WITH known inconsistent
data. It is not release acceptance or phase reconciliation.
"""
import hashlib
import json
import platform
import sys
from pathlib import Path
import sympy as sp
from sympy import Matrix, Rational as Q, eye, zeros, I
CHECKS = 0
DISCREPANCIES = {}
class CheckFailure(RuntimeError):
pass
def require(condition, message):
global CHECKS
CHECKS += 1
if condition is not True and condition is not sp.S.true:
raise CheckFailure(message)
def same(X, Y, message):
require(X.shape == Y.shape, message + ": shape")
require(all(sp.simplify(z) == 0 for z in X-Y),
message + ": nonzero difference")
def reject(name, action, expected):
try:
action()
except CheckFailure as exc:
require(str(exc) == expected,
name + ": unexpected rejection reason")
return
raise CheckFailure("invalid control accepted: " + name)
def gaussian_entries(X):
for z in X:
re, im = sp.expand_complex(z).as_real_imag()
require(re.is_Rational is True
and im.is_Rational is True,
"entry is not an exact Gaussian rational")
def verify_rank(M, r, rows, cols, L):
gaussian_entries(M)
gaussian_entries(L)
n, p = M.shape
rows, cols = list(rows), list(cols)
require(type(r) is int and 0 <= r <= min(n,p),
"invalid rank parameter")
require(len(rows) == r and len(cols) == r, "minor size")
require(all(type(j) is int for j in rows+cols),
"minor index type")
require(len(set(rows)) == r and len(set(cols)) == r,
"duplicate minor index")
require(all(0 <= j < n for j in rows), "minor row range")
require(all(0 <= j < p for j in cols), "minor column range")
require(L.shape == (n-r,n), "left-kernel shape")
delta = sp.Integer(1) if r == 0 else \
sp.simplify(M.extract(rows,cols).det())
require(delta != 0, "original minor is zero")
same(L*M, zeros(n-r,p), "left-kernel identity")
require(L.rank() == n-r, "left kernel is incomplete")
return delta
def verify_solution(M, y, c):
for X in (M,y,c):
gaussian_entries(X)
require(y.shape == (M.rows,1), "target shape")
require(c.shape == (M.cols,1), "candidate shape")
same(M*c,y,"candidate solution")
def verify_right(M, r, Z):
# Precondition: rank(M)=r has a separate certificate.
gaussian_entries(M)
gaussian_entries(Z)
require(type(r) is int and 0 <= r <= min(M.shape),
"invalid right-kernel rank parameter")
require(Z.shape == (M.cols,M.cols-r), "right-kernel shape")
same(M*Z,zeros(M.rows,Z.cols),"right-kernel identity")
require(Z.rank() == M.cols-r, "right kernel is incomplete")
def reduce_rational(x, p):
x = sp.sympify(x)
require(x.is_Rational is True,
"modular input is not rational")
num, den = map(int,x.as_numer_denom())
require(den % p != 0, "denominator is not invertible")
return (num % p)*pow(den % p,-1,p) % p
def rank_mod(M, p):
require(type(p) is int and bool(sp.isprime(p)),
"modulus is not prime")
A = [[reduce_rational(M[i,j],p)
for j in range(M.cols)] for i in range(M.rows)]
r = 0
for col in range(M.cols):
pivot = next((j for j in range(r,M.rows)
if A[j][col] != 0),None)
if pivot is None:
continue
A[r],A[pivot] = A[pivot],A[r]
inv = pow(A[r][col],-1,p)
A[r] = [(x*inv) % p for x in A[r]]
for j in range(M.rows):
if j != r:
f = A[j][col]
A[j] = [(A[j][k]-f*A[r][k]) % p
for k in range(M.cols)]
r += 1
if r == M.rows:
break
return r
def unit(d,j):
v = zeros(d,1)
v[j,0] = 1
return v
def channel(Ks,X):
require(len(Ks) > 0,"empty Kraus list")
out = zeros(Ks[0].rows,Ks[0].rows)
for K in Ks:
out += K*X*K.H
return out.applyfunc(sp.simplify)
def trace_first(X,d,rest):
require(X.shape == (d*rest,d*rest),"partial-trace shape")
out = zeros(rest,rest)
for j in range(d):
out += X[j*rest:(j+1)*rest,j*rest:(j+1)*rest]
return out.applyfunc(sp.simplify)
def rats(text):
return [Q(s) for s in text.split()]
def printed_data():
# Both original literals are retained; neither is overwritten.
f_tex = rats(
"-27/80 19/60 -11/48 -71/120 11/10 -4/3 "
"19/60 -13/15 1/6 4/3 -11/48 1/6 -1/8 -3/4")
f_reg = rats(
"-27/80 19/60 -11/48 -71/120 11/10 4/3 "
"19/60 -13/15 1/6 4/3 -11/48 1/6 -1/8 -3/4")
fm = rats(
"-871/120 911/120 -229/48 56/15 -829/30 17/3 "
"911/120 -99/10 91/12 -65/3 -229/48 91/12 -21/8 5/4")
g = rats(
"7/48 -1/8 5/48 1/12 -1/12 1/3 -1/8 "
"1/6 -1/24 -1/3 5/48 -1/24 1/16 1/4")
gm = rats(
"-1/48 -7/24 1/48 5/12 7/12 2/3 -7/24 "
"1/6 -5/24 1/3 1/48 -5/24 1/16 1/4")
h = rats("-3/8 1/4 -1/2")
hm = rats("-19/24 -7/12 -1/2")
a0 = rats(
"27/80 -19/60 11/48 71/120 -11/10 4/3 "
"-19/60 13/15 -1/6 -4/3 11/48 -1/6 1/8 3/4")
a1 = rats(
"1/2 -2/3 1 1/2 -1 1/2 -2/3 4/3 "
"-5/4 -1/2 1 -5/4 3/2 0")
a2 = rats(
"1/2 -1/2 5/6 1/6 -1/3 0 -1/2 2/3 "
"-5/6 0 5/6 -5/6 5/4 0")
return f_tex,f_reg,fm,g,gm,h,hm,a0,a1,a2
def test_rank_affine():
M = Matrix([[1,2,3,4],[2,4,6,8],[1,1,1,1],
[3,5,7,9],[0,0,0,0]])
L = Matrix([[-2,1,0,0,0],[-2,0,-1,1,0],[0,0,0,0,1]])
Z = Matrix([[1,2],[-2,-3],[1,0],[0,1]])
y,c = Matrix([1,2,1,3,0]),Matrix([1,0,0,0])
require(verify_rank(M,2,[0,2],[0,1],L) == -1,
"rank-two original minor")
verify_solution(M,y,c)
verify_right(M,2,Z)
same(L*y,zeros(3,1),"target membership")
alpha,beta = sp.symbols("alpha beta")
same(M*(c+Z*Matrix([alpha,beta])),y,"affine family")
reject("incomplete left kernel",
lambda: verify_rank(M,2,[0,2],[0,1],zeros(3,5)),
"left kernel is incomplete")
reject("zero chosen minor",
lambda: verify_rank(M,2,[0,1],[0,1],L),
"original minor is zero")
verify_rank(zeros(2,3),0,[],[],eye(2))
verify_right(zeros(2,3),0,eye(3))
verify_rank(eye(3),3,[0,1,2],[0,1,2],zeros(0,3))
verify_right(eye(3),3,zeros(3,0))
Ma = Matrix([[1,2,1],[2,4,2],[1,1,0]])
ya,ca = Matrix([3,6,1]),Matrix([1,0,2])
La,Za = Matrix([[-2,1,0]]),Matrix([1,-1,1])
verify_rank(Ma,2,[0,2],[0,1],La)
verify_solution(Ma,ya,ca)
verify_right(Ma,2,Za)
old = Matrix([1,1,0])
same(Ma*old-ya,Matrix([0,0,1]),"old residual")
reject("old unchecked fallback",
lambda: verify_solution(Ma,ya,old),
"candidate solution: nonzero difference")
sol,params = Ma.gauss_jordan_solve(ya)
same(Ma*sol,ya,"parametric solver residual")
require(len(params) == 1,"free parameter count")
verify_solution(Ma,ya,sol.subs({t:0 for t in params}))
Mu = Matrix([[1,2],[2,4],[0,0]])
Lu = Matrix([[-2,1,0],[0,0,1]])
yu = Matrix([1,1,1])
verify_rank(Mu,1,[0],[0],Lu)
same(Lu*yu,Matrix([-1,1]),"inconsistency separator")
require(Matrix.hstack(Mu,yu).rank() == 2,
"inconsistent augmented rank")
def test_fields_modular():
M = Matrix([[Q(1,2),Q(1,3)],[Q(2,3),Q(1,2)],[1,1]])
red = M.applyfunc(lambda z: reduce_rational(z,5))
same(red,Matrix([[3,2],[4,3],[1,1]]),"rational reduction")
require(M.extract([0,1],[0,1]).det() == Q(1,36),
"separate rational minor")
require(int(red.extract([0,1],[0,1]).det()) % 5 == 1,
"finite-field minor")
require(rank_mod(M,5) == 2 and M.rank() == 2,
"rational and modular rank")
require(Matrix([[5]]).rank() == 1,"rank over Q")
require(rank_mod(Matrix([[5]]),5) == 0,"rank over F5")
reject("bad denominator",
lambda: rank_mod(Matrix([[Q(1,5)]]),5),
"denominator is not invertible")
reject("composite modulus",
lambda: rank_mod(eye(2),6),"modulus is not prime")
reject("floating certificate",
lambda: gaussian_entries(Matrix([[sp.Float("0.5")]])),
"entry is not an exact Gaussian rational")
G = Matrix([[1,I],[I,-1],[0,0]])
L = Matrix([[-I,1,0],[0,0,1]])
Z = Matrix([-I,1])
verify_rank(G,1,[0],[0],L)
verify_right(G,1,Z)
verify_solution(G,Matrix([1,I,0]),Matrix([1,0]))
GR,GI = G.applyfunc(sp.re),G.applyfunc(sp.im)
realified = Matrix.vstack(Matrix.hstack(GR,-GI),
Matrix.hstack(GI,GR))
require(realified.rank() == 2,"realification rank")
def test_quotient_enlargement():
T = Matrix([[1,0,2],[0,1,1],[1,1,3],[0,0,0]])
L = Matrix([[-1,-1,1,0],[0,0,0,1]])
F = Matrix([[1,2],[0,1],[1,3],[0,0]])
R = Matrix([2,-1])
verify_rank(T,2,[0,1],[0,1],L)
same(L*F,zeros(2,2),"nonfeedback")
same(F*R,Matrix([0,-1,-1,0]),"relation response")
same(L*F*R,zeros(2,1),"quotient descent")
Fd = Matrix([[1,2],[0,1],[1,3],[1,2]])
same(L*Fd,Matrix([[0,0],[1,2]]),"descended obstruction")
same(L*Fd*R,zeros(2,1),"descent without vanishing")
require(Matrix.hstack(T,Fd).rank() == 3,"outside-span rank")
reject("descent is not nonfeedback",
lambda: same(L*Fd,zeros(2,2),"nonfeedback"),
"nonfeedback: nonzero difference")
Fb = Matrix([[1,0],[0,1],[1,1],[1,0]])
reject("bad descent",
lambda: same(L*Fb*R,zeros(2,1),"descent"),
"descent: nonzero difference")
H = Matrix([1,0,0])
LH = Matrix([[0,1,0],[0,0,1]])
E,b = Matrix([0,1,0]),Matrix([1,2,0])
verify_rank(H,1,[0],[0],LH)
same(LH*b,LH*E*Matrix([2]),"projected enlargement")
same(H*Matrix([1])+E*Matrix([2]),b,"enlarged solution")
QE = Matrix([[0,1]])
D = QE*LH
same(D*H,zeros(1,1),"separator old image")
same(D*E,zeros(1,1),"separator new image")
require((D*Matrix([1,2,1]))[0] == 1,
"enlarged obstruction")
# Same old ranks, opposite enlargement outcomes.
H15 = eye(15)[:,:7]
b15 = unit(15,7)
require(H15.rank() == 7,"old rank seven")
require(Matrix.hstack(H15,b15).rank() == 8,
"augmented rank eight")
require(Matrix.hstack(H15,unit(15,7),b15).rank() == 8,
"resolving enlargement")
require(Matrix.hstack(H15,unit(15,8),b15).rank() == 9,
"nonresolving enlargement")
def test_free_complex_family():
S = Matrix([[1,0],[0,1],[1,1]])
B0 = Matrix([[-1,-1,1]])
A = Matrix([[1,0,0],[0,1,0]])
verify_rank(S,2,[0,1],[0,1],B0)
same(B0*S,zeros(1,2),"free complex")
xi = sp.symbols("xi",real=True)
c,d = xi*Matrix([1,-1,0]),Matrix([-xi,xi])
same(A*c+d,zeros(2,1),"gauge cancellation")
same(c.diff(xi),S*Matrix([1,-1]),"primitive")
same(A*S,eye(2),"surjective tangent")
reject("nonexact vector",
lambda: same(B0*Matrix([0,0,1]),zeros(1,1),"exactness"),
"exactness: nonzero difference")
Ast = Matrix([[1,0,0],[0,0,1],[1,0,1]])
HH,LH = Ast*S,Matrix([[-1,-1,1]])
verify_rank(HH,2,[0,1],[0,1],LH)
same(LH*Ast*c.diff(xi),zeros(1,1),"feasible tangent")
reject("infeasible tangent",
lambda: same(LH*Matrix([1,0,0]),zeros(1,1),"tangent"),
"tangent: nonzero difference")
S0,B1,z = Matrix([1,0,0]),Matrix([[0,0,1]]),Matrix([0,1,0])
same(B1*S0,zeros(1,1),"second complex")
same(B1*z,zeros(1,1),"closed vector")
require(Matrix.hstack(S0,z).rank() == 2,"closed nonexact")
M,L = S,B0
zeta = sp.symbols("zeta")
coeffs = [Matrix([1,0]),Matrix([0,2]),Matrix([3,-1])]
cp,yp = zeros(2,1),zeros(3,1)
for j,a in enumerate(coeffs):
b = M*a
same(L*b,zeros(1,1),"coefficient membership")
cp += zeta**j*a
yp += zeta**j*b
same(M*cp,yp,"constant-response polynomial lift")
same(yp.subs(zeta,0),M*coeffs[0],"base point")
def test_table_arithmetic():
ft,fr,fm,g,gm,h,hm,a0,a1,a2 = printed_data()
for name,arr in [("ft",ft),("fr",fr),("fm",fm),("g",g),
("gm",gm),("a0",a0),("a1",a1),("a2",a2)]:
require(len(arr) == 14,"table length "+name)
gaussian_entries(Matrix(arr))
for a,b,count,delta in [
(ft,fm,14,Q(431,30)),(fr,fm,14,Q(431,30)),
(g,gm,11,Q(1,3)),(h,hm,2,Q(5,12))
]:
require(len(a) == len(b),"mutation array lengths")
require(sum(x != y for x,y in zip(a,b)) == count,
"mutation count")
require(max(abs(x-y) for x,y in zip(a,b))/2 == delta,
"mutation discrepancy")
require(max(abs(x) for x in a+b) <= 32,
"common report bound")
# Independent from the known phase-failure suite.
require(sum(x != 0 or y != 0 for x,y in zip(a1,a2)) == 13,
"D01 varying structure count")
require(a1[13] == 0 and a2[13] == 0,
"constant D01 structure")
zeta = sp.symbols("zeta")
for j in range(14):
p = a0[j]+zeta*a1[j]+zeta**2*a2[j]
require(sp.diff(p,zeta) == a1[j]+2*zeta*a2[j],
"printed derivative")
def test_phase_integrity():
ft,fr,fm,g,gm,h,hm,a0,a1,a2 = printed_data()
FT,FR,A0 = Matrix(ft),Matrix(fr),Matrix(a0)
expected = Q(8,3)*unit(14,5)
same(A0+FT,zeros(14,1),"typeset phase relation")
same(FR-FT,expected,"cross-artifact transcription witness")
same(A0+FR,expected,"retained phase residual")
require([j for j,z in enumerate(A0+FR) if z != 0] == [5],
"unique phase mismatch index")
require(ft[5] == -Q(4,3) and fr[5] == Q(4,3)
and a0[5] == Q(4,3),"retained coefficient literals")
reject("legacy phase equality",
lambda: same(A0+FR,zeros(14,1),"legacy D01 phase"),
"legacy D01 phase: nonzero difference")
require("2a_phase_integrity" not in DISCREPANCIES,
"duplicate discrepancy record")
DISCREPANCIES["2a_phase_integrity"] = {
"status":"DISCREPANCY_RECORDED",
"python_index":5,
"displayed_structure":"B_6",
"residual":[str(z) for z in A0+FR],
"phase_consistent":False,
"physical_sign_selected":False
}
require(max(abs(z) for z in A0+FR)/2 == Q(4,3),
"integrity coefficient discrepancy")
require(max(abs(z) for z in A0+FR)/64 == Q(1,24),
"integrity report distance at B32")
def bounded_probabilities(v):
v = [sp.sympify(x) for x in v]
require(len(v) > 0,"empty report")
require(all(x.is_Rational is True for x in v),
"report not exact rational")
require(all(-1 <= x <= 1 for x in v),
"report outside [-1,1]")
return [[(1+b*x)/2 for b in (-1,1)] for x in v]
def test_report():
v = rats("3/10 -1/2 4/5 1/10")
vt = rats("3/10 -2/5 7/10 1/10")
P,PT = bounded_probabilities(v),bounded_probabilities(vt)
distances = []
for j in range(4):
require(sum(P[j]) == 1 and sum(PT[j]) == 1,
"report normalization")
tv = sum(abs(P[j][b]-PT[j][b]) for b in range(2))/2
require(tv == abs(v[j]-vt[j])/2,"basis TV distance")
distances.append(tv)
require(max(distances) == Q(1,20),"attaining task")
reject("bad report range",
lambda: bounded_probabilities([2]),
"report outside [-1,1]")
XP,YP = Matrix([[0,1],[1,0]]),Matrix([[0,-I],[I,0]])
B = Q(2)
z,w = Q(3,5)+I*Q(4,5),-Q(1,5)+I*Q(2,5)
def tau(a):
return (eye(2)+sp.re(a)*XP/B+sp.im(a)*YP/B)/2
D = tau(z)-tau(w)
m2 = sp.expand_complex((z-w)*sp.conjugate(z-w))
same(D*D,m2*eye(2)/(4*B**2),"qubit difference square")
require(sp.trace(D) == 0,"qubit difference trace")
def test_instrument():
D,a,e = 4,2,2
U = Q(1,2)*Matrix([[1,1,1,1],[1,-1,1,-1],
[1,1,-1,-1],[1,-1,-1,1]])
same(U.H*U,eye(D),"clock calibration")
Ds = [sp.kronecker_product(U[:,j].H,eye(a)) for j in range(D)]
Ks = [sp.kronecker_product(unit(D,j),Ds[j]) for j in range(D)]
total = zeros(D*a,D*a)
for K in Ks:
total += K.H*K
same(total,eye(D*a),"Kraus completeness")
psi = (sp.kronecker_product(U[:,0],unit(a,0),unit(e,0))
+ sp.kronecker_product(U[:,1],unit(a,1),unit(e,1))) \
/ sp.sqrt(2)
rho = psi*psi.H
out = channel([sp.kronecker_product(K,eye(e)) for K in Ks],rho)
expected = sp.diag(Q(1,2),0,0,Q(1,2))
same(trace_first(out,D,a*e),expected,"discard record")
same(trace_first(rho,D,a*e),expected,"discard clock")
same(trace_first(expected,a,e),eye(e)/2,"reference marginal")
for j in range(D):
Dj = sp.kronecker_product(Ds[j],eye(e))
sigma = (Dj*rho*Dj.H).applyfunc(sp.simplify)
target = zeros(a*e,a*e)
if j in (0,1):
v = unit(a*e,0 if j == 0 else 3)
target = v*v.H/2
same(sigma/(Q(1,2)),v*v.H,"positive conditional state")
same(sigma,target,"actual reference branch")
if sp.trace(sigma) == 0:
same(sigma,zeros(a*e,a*e),"zero branch")
ap = unit(a,0)
vp = sp.kronecker_product((U[:,0]+U[:,1])/sp.sqrt(2),ap)
vm = sp.kronecker_product((U[:,0]-U[:,1])/sp.sqrt(2),ap)
same(channel(Ks,vp*vp.H),channel(Ks,vm*vm.H),
"clock coherence loss")
def test_grading_parity():
verify_rank(zeros(21,10),0,[],[],eye(21))
h,c,K,cb,cs = sp.symbols("h c K cb cs")
for monomial in (K*c*h,cb*c*h,cs*c*c,h*h*h):
require(sp.Poly(monomial,h,c,K,cb,cs).total_degree() == 3,
"formal cubic slot count")
even,odd = Matrix([[2,0],[0,2]]),eye(2)
require(rank_mod(even,2) == 0,"even blindness")
require(rank_mod(odd,2) == 2,"odd occurrence rank")
for x in (0,1):
for y in (0,1):
s = Matrix([x,y])
require(all(int(z)%2 == 0 for z in even*s),
"bubble sign blindness")
if x or y:
require(any(int(z)%2 for z in odd*s),
"odd control missed sign")
def test_propagator():
# Finite-component regression, not a loop/DRED implementation.
pairs = [(a,b) for a in range(4) for b in range(a,4)]
eta = sp.diag(1,-1,-1,-1)
k = Matrix([3,1,1,1])
kc = eta*k
k2 = (k.T*eta*k)[0]
require(k2 == 6,"test momentum")
basis = []
for a,b in pairs:
E = zeros(4,4)
E[a,b] = 1
E[b,a] = 1
basis.append(E)
def coords(E):
return Matrix([E[a,b] for a,b in pairs])
A,F = zeros(10,10),zeros(4,10)
for j,E in enumerate(basis):
tr = sp.trace(eta*E)
A[:,j] = coords(E-eta*tr/2)
F[:,j] = E*k-kc*tr/2
R = zeros(10,4)
for j in range(4):
v = unit(4,j)
R[:,j] = coords((kc*v.T+v*kc.T)/2)
same(A*A,eye(10),"trace reversal")
same(F*R,k2*eye(4)/2,"F R identity")
G,S4 = 2*A*R*F,R*F*A
xi = sp.symbols("xi",nonzero=True)
Kxi = k2*A+(1/xi-1)*G
Pxi = A/k2+2*(xi-1)*S4/k2**2
same(Kxi*Pxi,eye(10),"propagator left inverse")
same(Pxi*Kxi,eye(10),"propagator right inverse")
wrong = A/k2+(xi-1)*S4/k2**2
reject("wrong longitudinal coefficient",
lambda: same(Kxi*wrong,eye(10),"propagator"),
"propagator: nonzero difference")
def main():
print("XVI-O1-ST-v5: FINITE REGRESSION, NOT A LOOP GATE")
print("Python:",sys.version.replace("\n"," "))
print("Platform:",platform.platform())
print("SymPy:",sp.__version__)
print("Source SHA256:",
hashlib.sha256(Path(__file__).read_bytes()).hexdigest())
print("The v4 D01 regression coefficient is retained unchanged.")
reject("checker false",
lambda: require(False,"deliberate rejection"),
"deliberate rejection")
reject("truthy integer",
lambda: require(1,"non-boolean predicate"),
"non-boolean predicate")
reject("undecided predicate",
lambda: require(sp.Symbol("unknown"),"undecided predicate"),
"undecided predicate")
tests = [
("rank / affine repair",test_rank_affine),
("fields / genuine modular rank",test_fields_modular),
("quotient / primitive enlargement",test_quotient_enlargement),
("free complex / polynomial family",test_free_complex_family),
("printed table arithmetic",test_table_arithmetic),
("permanent phase-integrity witness",test_phase_integrity),
("bounded report witnesses",test_report),
("complete instrument / reference",test_instrument),
("direct grading / sign parity",test_grading_parity),
("finite propagator regression",test_propagator),
]
failures = []
for name,test in tests:
before = CHECKS
try:
test()
require(CHECKS > before,"vacuous test")
except Exception as exc:
failures.append((name,type(exc).__name__,str(exc)))
print("FAIL_REGRESSION:",name,type(exc).__name__,str(exc))
else:
print("PASS_REGRESSION_CONTRACT:",name)
report = {
"evaluated_predicates":CHECKS,
"unexpected_failures":failures,
"known_discrepancies":DISCREPANCIES,
"phase_consistent":False,
"scientific_release_accepted":False,
"loop_evaluated":False,
"formal_verification":False
}
print(json.dumps(report,indent=2,allow_nan=False))
if failures:
print("REGRESSION FAILED")
return 1
if DISCREPANCIES:
print("REGRESSION CONTRACTS SATISFIED WITH KNOWN DISCREPANCY")
print("DATA INTEGRITY NOT CLEARED; EXIT 2; NO LOOP RELEASE")
return 2
print("REGRESSION CONTRACTS SATISFIED WITHOUT KNOWN DISCREPANCY")
print("Still not a loop release or formal verification.")
return 0
if __name__ == "__main__":
sys.exit(main())