# Exact certificate for Lemma lem:q81-reconstruction (q = 81). # Run in GAP 4.12 or later with the COCO2P package: # Read("verify_q81_isomorphisms_gap.g"); # No candidate matrices, external executables, or other input files are used. # Points (x,u) in C16 x C5 are numbered 5*x+u+1. # # Algebraic isomorphisms must fix each of the 14 named P-relations and # send the distinguished relation R1 to D. Exact simultaneous 2-WL # refinement determines the ONLY possible extension of this assignment. # An absent signature rejects the assignment immediately. A surviving # assignment is checked against the complete intersection-number tensor. # No hash digest is used as an invariant; all signatures are compared exactly. # There is no floating-point arithmetic or uncoloured shortcut. Q81Certificate := function() local Check, U, nonzero, point, base, blocks, supports, universe, eps, a, images, support, x, y, u, v, i, j, k, t, choices, orders, order, ids, row, rows, reps, candidates, extensionCounts, Extend, used, chosen, groupIndex, startCount, D, Mat, InitialColors, sourceInitial, orbit, orbitColors, residue, Signature, SourceStep, MatchStep, steps, source, step, target, counts, map, c, label, Tensor, sourceTensor, targetTensor, sourceGraph, targetGraph, h, H, translate, multiply, layerCycle, layerSwap, algebraic, ordinary, inH, weighted, witnesses, rejected, startTime, allMatrices, targetInitial; Check := function(condition, message) if not condition then Error(Concatenation("FAILED: ",message)); fi; end; Check(LoadPackage("COCO2P") <> fail, "COCO2P must be installed"); Print("GAP ",GAPInfo.Version,"; COCO2P ",PackageInfo("COCO2P")[1].Version,"\n"); startTime := Runtime(); U := [[0],[1,3,9,11],[2,6],[4,12],[5,7,13,15],[8],[10,14]]; nonzero := U[2]; point := function(xx,uu) return 5*xx+uu+1; end; base := List([0..15], xx -> List([0..15], yy -> PositionProperty(U, s -> (yy-xx) mod 16 in s))); # All eight blocks, independently checked to preserve every A-colour. blocks := []; supports := []; for eps in [1,9] do for a in nonzero do images := List([0..15], xx -> (eps*xx+a) mod 16); Check(Set(images)=[0..15], "block is a permutation"); Check(ForAll([0..15],xx -> (images[xx+1]-xx) mod 16 in nonzero), "block is contained in B"); Check(ForAll([0..15],xx -> ForAll([0..15],yy -> base[xx+1][yy+1]=base[images[xx+1]+1][images[yy+1]+1])), "block preserves A"); Add(blocks, rec(eps:=eps,a:=a,images:=images)); Add(supports, Set(List([0..15],xx -> 16*xx+images[xx+1]+1))); od; od; universe := Set(Concatenation(List([0..15],xx -> List(nonzero,aa -> 16*xx+(xx+aa) mod 16+1)))); orders := Arrangements([1..4],4); choices := []; for eps in [1,9] do for a in [1,9] do ids := [PositionProperty(blocks,b -> b.eps=eps and b.a=1), PositionProperty(blocks,b -> b.eps=eps and b.a=9), PositionProperty(blocks,b -> b.eps=a and b.a=3), PositionProperty(blocks,b -> b.eps=a and b.a=11)]; for order in orders do Add(choices,ids{order}); od; od; od; Check(Length(Set(choices))=96,"96 distinct row choices"); rows := List([1..5],function(diag) return List(choices,function(ch) local rr, vv, pos; rr:=[]; pos:=1; for vv in [1..5] do if vv=diag then rr[vv]:=0; else rr[vv]:=ch[pos]; pos:=pos+1; fi; od; return rr; end); end); # The first rows represent the (1,1), (9,9), and (1,9) orbits. reps := List([[1,1],[9,9],[1,9]], pair -> Concatenation([0], List([1,9],aa -> PositionProperty(blocks,b -> b.eps=pair[1] and b.a=aa)), List([3,11],aa -> PositionProperty(blocks,b -> b.eps=pair[2] and b.a=aa)))); candidates := []; extensionCounts := []; Extend := function(nextRow,partial,occupied,which) local rr, vv, newOccupied, remaining, lastRow, id; if nextRow=5 then lastRow:=[]; for vv in [1..5] do if vv=5 then if occupied[vv]<>universe then return; fi; lastRow[vv]:=0; else remaining:=Difference(universe,occupied[vv]); id:=Position(supports,remaining); if id=fail then return; fi; lastRow[vv]:=id; fi; od; if not lastRow in rows[5] then return; fi; Add(candidates,rec(group:=which,blocks:=Concatenation(partial,[lastRow]))); return; fi; for rr in rows[nextRow] do if ForAll([1..5],vv -> rr[vv]=0 or IsEmpty(Intersection(occupied[vv],supports[rr[vv]]))) then newOccupied:=List([1..5],function(vv) if rr[vv]=0 then return occupied[vv]; fi; return Union(occupied[vv],supports[rr[vv]]); end); Extend(nextRow+1,Concatenation(partial,[rr]),newOccupied,which); fi; od; end; for groupIndex in [1..3] do startCount:=Length(candidates); row:=reps[groupIndex]; used:=List([1..5],function(vv) if vv=1 then return []; fi; return supports[row[vv]]; end); Extend(2,[row],used,groupIndex); Add(extensionCounts,Length(candidates)-startCount); od; Check(extensionCounts=[96,96,96],"96 extensions of each first row"); Check(Length(Set(List(candidates,c -> c.blocks)))=288,"288 distinct matrices"); Print("First-row orbit sizes: [ 24, 24, 48 ]\n"); Print("Extensions of the three representatives: ",extensionCounts,"\n"); Print("Distinct normalized matrices constructed: ",Length(candidates),"\n"); Print("Total matrices before normalization: ",Sum([1..3],i -> [24,24,48][i]*extensionCounts[i]),"\n"); Mat := function(blockIds) local result, uu, vv, xx, id; result:=NullMat(80,80); for uu in [0..4] do for vv in [0..4] do id:=blockIds[uu+1][vv+1]; if id<>0 then for xx in [0..15] do result[point(xx,uu)][point(blocks[id].images[xx+1],vv)]:=1; od; fi; od; od; return result; end; allMatrices:=List(candidates,c -> Mat(c.blocks)); # Independently check the column and row covers for each stored matrix. for c in candidates do for i in [1..5] do Check(c.blocks[i][i]=0,"zero diagonal block"); Check(Set(Concatenation(List(Filtered(c.blocks[i],id -> id<>0), id -> supports[id])))=universe,"row cover"); ids:=Filtered(List([1..5],j -> c.blocks[j][i]),id -> id<>0); Check(Set(Concatenation(List(ids,id -> supports[id])))=universe, "column cover"); od; od; InitialColors := function(adjacency) return List([0..79],function(p) return List([0..79],function(q) local xx,yy,uu,vv,colour; xx:=QuoInt(p,5); uu:=p mod 5; yy:=QuoInt(q,5); vv:=q mod 5; colour:=2*base[xx+1][yy+1]-1; if uu<>vv then colour:=colour+1; fi; if adjacency[p+1][q+1]=1 then Check(colour=4,"distinguished arcs belong to s"); return 15; fi; return colour; end); end); end; D:=NullMat(80,80); for x in [0..15] do for u in [0..4] do for a in [1,3,9,27] do D[point(x,u)][point((x+a) mod 16,(u+a) mod 5)]:=1; od; od; od; sourceInitial:=InitialColors(D); Signature := function(M,xx,yy,rank) local sig, zz, pos; sig:=ListWithIdenticalEntries(2+rank*rank,0); sig[1]:=M[xx][yy]; sig[2]:=M[yy][xx]; for zz in [1..80] do pos:=2+(M[xx][zz]-1)*rank+M[zz][yy]; sig[pos]:=sig[pos]+1; od; return sig; end; SourceStep := function(M) local rank, signatures, distinct, dictionary, xx,yy,ii,out,sz; rank:=Maximum(Concatenation(M)); signatures:=List([1..80],xx -> List([1..80],yy -> Signature(M,xx,yy,rank))); distinct:=Set(Concatenation(signatures)); dictionary:=NewDictionary(distinct[1],true); for ii in [1..Length(distinct)] do AddDictionary(dictionary,distinct[ii],ii); od; out:=List(signatures,rr -> List(rr,sig -> LookupDictionary(dictionary,sig))); sz:=ListWithIdenticalEntries(Length(distinct),0); for xx in [1..80] do for yy in [1..80] do sz[out[xx][yy]]:=sz[out[xx][yy]]+1; od; od; return rec(rank:=rank,newrank:=Length(distinct),dictionary:=dictionary, matrix:=out,sizes:=sz); end; MatchStep := function(M,reference) local out,sz,xx,yy,col; out:=NullMat(80,80); sz:=ListWithIdenticalEntries(reference.newrank,0); for xx in [1..80] do for yy in [1..80] do col:=LookupDictionary(reference.dictionary,Signature(M,xx,yy,reference.rank)); if col=fail then return fail; fi; out[xx][yy]:=col; sz[col]:=sz[col]+1; od; od; if sz<>reference.sizes then return fail; fi; return out; end; source:=sourceInitial; steps:=[]; repeat step:=SourceStep(source); Add(steps,step); source:=step.matrix; until step.newrank=step.rank; Check(step.newrank=23,"source coherent closure has rank 23"); # Verify the source partition against all multiplication-by-3 orbits in C80. orbit:=[]; for residue in [0..79] do if not IsBound(orbit[residue+1]) then ids:=Set(List([0..3],i -> (residue*3^i) mod 80)); for a in ids do orbit[a+1]:=Minimum(ids)+1; od; fi; od; orbitColors:=[]; for x in [0..15] do for u in [0..4] do i:=point(x,u); orbitColors[i]:=[]; for y in [0..15] do for v in [0..4] do j:=point(y,v); a:=First([0..79],aa -> aa mod 16=(y-x) mod 16 and aa mod 5=(v-u) mod 5); orbitColors[i][j]:=orbit[a+1]; od; od; od; od; map:=[]; for i in [1..80] do for j in [1..80] do label:=source[i][j]; if IsBound(map[label]) then Check(map[label]=orbitColors[i][j],"source equals Y"); else map[label]:=orbitColors[i][j]; fi; od; od; Check(Length(Set(map))=23,"source partition equals the 23 orbit relations of Y"); Tensor := function(M) local rank,reps,xx,yy,cc,tt,zz; rank:=Maximum(Concatenation(M)); reps:=[]; for xx in [1..80] do for yy in [1..80] do cc:=M[xx][yy]; if not IsBound(reps[cc]) then reps[cc]:=[xx,yy]; fi; od; od; tt:=List([1..rank],cc -> NullMat(rank,rank)); for cc in [1..rank] do xx:=reps[cc][1]; yy:=reps[cc][2]; for zz in [1..80] do tt[cc][M[xx][zz]][M[zz][yy]]:= tt[cc][M[xx][zz]][M[zz][yy]]+1; od; od; return tt; end; sourceTensor:=Tensor(source); sourceGraph:=ColorGraphByMatrix(source); translate:=PermList(List([0..79],p -> point((QuoInt(p,5)+1) mod 16,p mod 5))); multiply:=PermList(List([0..79],p -> point((3*QuoInt(p,5)) mod 16,p mod 5))); layerCycle:=PermList(List([0..79],p -> point(QuoInt(p,5),(p+1) mod 5))); layerSwap:=PermList(List([0..79],function(p) local uu; uu:=p mod 5; if uu=0 then uu:=1; elif uu=1 then uu:=0; fi; return point(QuoInt(p,5),uu); end)); H:=Group(translate,multiply,layerCycle,layerSwap); Check(Size(H)=7680,"order of H"); algebraic:=0; ordinary:=0; inH:=0; weighted:=0; witnesses:=[]; rejected:=ListWithIdenticalEntries(Length(steps),0); for t in [1..Length(candidates)] do targetInitial:=InitialColors(allMatrices[t]); target:=targetInitial; for i in [1..Length(steps)] do target:=MatchStep(target,steps[i]); if target=fail then rejected[i]:=rejected[i]+1; break; fi; od; if target<>fail then targetTensor:=Tensor(target); Check(sourceTensor=targetTensor,"full intersection tensors coincide"); algebraic:=algebraic+1; targetGraph:=ColorGraphByMatrix(target); h:=IsomorphismColorGraphs(sourceGraph,targetGraph); Check(h<>fail,"algebraic isomorphism is induced by a point isomorphism"); ordinary:=ordinary+1; # Check the returned witness directly, independently of the search. Check(ForAll([1..80],xx -> ForAll([1..80],yy -> sourceInitial[xx][yy]=targetInitial[xx^h][yy^h])), "witness preserves original named colours"); Check(h in H,"point isomorphism belongs to H"); inH:=inH+1; weighted:=weighted+[24,24,48][candidates[t].group]; Add(witnesses,rec(candidate:=t,firstRowOrbit:=candidates[t].group,h:=h)); Print("Accepted candidate ",t,", first-row orbit ",candidates[t].group, ", witness h = ",h,"\n"); fi; od; Check(algebraic=1 and ordinary=1 and inH=1,"final certificate counts"); Check(weighted=24,"24 matrices before normalization pass the coloured test"); Print("Source refinement ranks: ",Concatenation([15],List(steps,s -> s.newrank)),"\n"); Print("Rejections at successive refinement steps: ",rejected,"\n"); Print("Algebraic isomorphisms respecting the prescribed colours: ",algebraic,"\n"); Print("Cases with a point isomorphism: ",ordinary,"\n"); Print("Cases with a checked witness in H: ",inH,"\n"); Print("Corresponding matrices before normalization: ",weighted,"\n"); Print("ALL CHECKS PASSED. GAP runtime (ms): ",Runtime()-startTime,"\n"); return rec(candidates:=candidates,matrices:=allMatrices,witnesses:=witnesses, extensionCounts:=extensionCounts,algebraic:=algebraic, ordinary:=ordinary,inH:=inH,weighted:=weighted); end; Q81Result := Q81Certificate();;