# Julia 1.10+, standard library only. Vertex numbers in the data are zero-based. using DelimitedFiles, LinearAlgebra, SHA const S = big(10)^15 const Q = big"339949771344778" const q = Q // S const inputs = joinpath(@__DIR__, "inputs") function graph_and_signs() file = joinpath(inputs, "graph-witness.tsv") @assert bytes2hex(sha256(read(file))) == "e51996d149f8b5a341190c74a8028c279e95b233504e837e0d5d4459db2c6f55" table = readdlm(file, '\t', Int) @assert size(table) == (120, 14) @assert table[:, 1] == 0:119 && all(x -> x in (0, 1), table[:, 2]) A = zeros(BigInt, 120, 120) for v in axes(table, 1), u in table[v, 3:end] A[v, u+1] = 1 end @assert issymmetric(A) && iszero(diag(A)) && all(==(12), sum(A; dims=2)) return A, BigInt.(2 .* table[:, 2] .- 1) end cut(A, s) = sum(A[i,j] for j in eachindex(s) for i in 1:j-1 if s[i] != s[j]; init=big(0)) function cut_and_mixing(A, published) M = 13I + A P = M .// 25 balanced = copy(published) flips = [2, 35] .+ 1 @assert sum(published) == 4 && all(==(1), published[flips]) @assert iszero(A[flips...]) && iszero((A * published)[flips]) balanced[flips] .*= -1 @assert count(==(1), balanced) == count(==(-1), balanced) == 60 for s in (published, balanced) C = cut(A, s) @assert C == 440 @assert dot(s, M*s) == 25*length(s) - 4*C == 1240 @assert dot(s, P*s) == big(248)//5 @assert dot(s, P*s)/dot(s,s) == big(31)//75 centered = s .- 1 updated = q .* (P * centered) @assert dot(centered, updated) == q*(dot(s,P*s) - 2*sum(s) + length(s)) end @assert dot(balanced .- 1, P*(balanced .- 1)) == big(848)//5 certificate = readlines(joinpath(inputs, "FULL_CERTIFICATE.txt")) pattern = r"^Anchor (\d+): excluded after (\d+) search nodes$" matches = [match(pattern, line) for line in certificate if startswith(line, "Anchor ")] @assert all(!isnothing, matches) @assert length(matches) == length(unique(m.captures[1] for m in matches)) == 21 @assert sum(parse(BigInt, m.captures[2]) for m in matches) == 671232310 @assert last(certificate) == "All full-graph anchors excluded" println("1 counted 440 cut edges on both labelings; flipped public IDs 2,35: 60/60.") println(" s'Ms=1240; s'Ps=248/5; quotient=31/75; balanced correlation factor=848/5.") println(" Supplied exclusion transcript: 21 anchors, 671232310 recorded nodes.") end function golden_transport() G = BigInt[2 1; 1 -2] # twice the matrix of the quadratic form B = BigInt[1 1; 1 2] L = BigInt[1 1 0; 1 2 0; 0 0 1] T = Diagonal([q, q, inv(q^2)]) @assert B'*G*B == G && tr(B) == 3 && det(Rational{BigInt}.(B)) == 1 @assert det(T) == det(Rational{BigInt}.(L)) == 1 && T*L == L*T scale = T[1:2,1:2] @assert scale'*G*scale == q^2 * G && T[3,3] * q^2 == 1 # (x,y) = (1-t,t) is v0 + t*v1. Check all three coefficients of 2N. v0, v1 = BigInt[1,0], BigInt[-1,1] @assert [dot(v0,G*v0), 2*dot(v0,G*v1), dot(v1,G*v1)] == [2,-2,-2] @assert 0 < q < big(1)//2 && 1-q-q^2 > big(1)//4 println("2 full quadratic-form coefficients, commuting matrices, determinant and cubic scaling verified.") end # Fraction-free symmetric elimination: the successive positive pivots are the # leading principal minors. Each update is a Bareiss step with exact division. function check_positive_definite(H) X = copy(H) previous = big(1) for k in axes(X,1) pivot = X[k,k] @assert pivot > 0 for j in k+1:size(X,1), i in j:size(X,1) a, r = divrem(pivot*X[i,j] - X[i,k]*X[k,j], previous) @assert iszero(r) X[i,j] = X[j,i] = a end previous = pivot end return size(H,1) end quantize(M, d) = fld.(Q .* (M*d), 25*S) function residue_moduli(A) @assert cld(25*S,Q) == 74 && 73*Q < 25*S < 74*Q <= 147*Q < 50*S B = zeros(BigInt, 120, 120) for i in 0:59, offset in 0:11 j = 60 + mod(i + offset, 60) B[i+1,j+1] = B[j+1,i+1] = 1 end @assert issymmetric(B) && all(==(12),sum(B; dims=2)) u = vcat(ones(BigInt,60), -ones(BigInt,60)) M = 13I+B @assert M*u == u d = 74*u terminal = quantize(M,d) @assert terminal == vcat(ones(BigInt,60), fill(big(-2),60)) for m in 1:73 other = (74+m)*u @assert d != other && mod.(d,m) == mod.(other,m) @assert quantize(M,other) == terminal end # Graph-specific hypothesis of Paper IX, Lemma 3.2, checked on the fixture. minors = check_positive_definite(4I+A) # M_600 - 9I @assert 8*10*Q > 25*S println("3 exact threshold=74; verified all 73 smaller moduli fail on one connected 120-vertex graph.") println(" 600-cell M-9I: all ", minors, " leading minors positive; separation 10 gives modulus 8.") end function numerical_coefficient() setprecision(BigFloat, 256) do phi = (1 + sqrt(BigFloat(5))) / 2 lambda = phi / (phi + BigFloat(pi)) delta = lambda-BigFloat(q) @assert 0 < delta < BigFloat(10)^(-15) println("INFO numerical only: lambda-q ≈ ", delta) end end println("Julia ", VERSION) A, signs = graph_and_signs() cut_and_mixing(A,signs) golden_transport() residue_moduli(A) numerical_coefficient()