#Prob 2 MetaZKP3:=proc(n,E,C,K) local B1,B2,i,j,c,sig,B1iV, B1iC, B1jV, B1jC, B1v,B1c,S,k: sig:=randperm(3*n): B1:=[seq(seq([c,i],c=1..3),i=1..n)]: B1:=[seq(B1[sig[i]],i=1..nops(B1))]: for i from 1 to 3*n do for j from 1 to 3*n do B1iC:=B1[i][1]: B1iV:=B1[i][2]: B1jC:=B1[j][1]: B1jV:=B1[j][2]: if C[B1iV]=B1iC and C[B1jV]=B1jC and member({B1iV,B1jV},E) then B2[i,j]:=1: else B2[i,j]:=0: fi: od: od: B2:=[seq([seq(B2[i,j],j=1..3*n)],i=1..3*n)]: for k from 1 to K do if rand(0..1)()=1 then B1v:=[seq(B1[i][2],i=1..3*n)]: if Verify1(n,E,B1v,B2) = false then RETURN(false): fi: else B1c:=[seq(B1[i][1],i=1..3*n)]: S:={}: for i from 1 to 3*n do #for j from 1 to 3*n do for j from i+1 to 3*n do if B1[i][1]=B1[j][1] then S:=S union {[[i,j],B2[i][j]]}: fi: od: od: if Verify2(B1c,S) = false then RETURN(false): fi: fi: od: RETURN(true): end: #Test run n, E, C := RGC3(100); MetaZKP3(n,E,C,20); true n, E, C := RGC3(50): MetaZKP3(n,E,C,20); true n, E, C := RGC3(59): MetaZKP3(n,E,C,20); true n, E, C := RGC3(77): MetaZKP3(n,E,C,20); true n, E, C := RGC3(89): MetaZKP3(n,E,C,20); true #Changing color randomly n, E, C := RGC3(10): MetaZKP3(n,E,C,20); true C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false n, E, C := RGC3(50): C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false n, E, C := RGC3(37): MetaZKP3(n,E,C,20); true C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); true C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); true C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false n, E, C := RGC3(77): MetaZKP3(n,E,C,20); true C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false n, E, C := RGC3(87): MetaZKP3(n,E,C,20); true C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false C[rand(1..nops(C))()]:=1: MetaZKP3(n,E,C,20); false