reset; param bits=3; set B ordered = setof{i in 1..bits} char(96+i); param subs=2^bits-1; set F{i in 1..subs} within B = union{b in 0..bits-1} if i div 2^b mod 2 then {member(b+1,B)} else {}; display B, bits, subs, F; set S{n in 1..subs^bits,i in 1..bits} within B = F[(n-1) div subs^(bits-i) mod subs + 1]; display subs^bits; set Binomial ordered = { n in 1..subs^bits: forall{b in 1..bits, bb in b+1..bits} S[n,b] symdiff S[n,bb] not within {} }; display card(Binomial); #for more bits there are more cleaning steps between Binomial and Reversible set Reversible ordered = { n in Binomial: S[n,1] symdiff S[n,2] symdiff S[n,3] not within {} }; display card(Reversible); set reverse_set{n in Reversible,b in 1..3} = {sset in 1..subs: (if sset div 2^0 mod 2 then S[n,3] else {}) symdiff (if sset div 2^1 mod 2 then S[n,2] else {}) symdiff (if sset div 2^2 mod 2 then S[n,1] else {}) symdiff {member(b,B)} within {} }; for{n in {15..18} inter Reversible}{ print n; for{b in 1..3} display S[n,b]; for{b in 1..3} display reverse_set[n,b]}; display min {n in Reversible, b in 1..3} card(reverse_set[n,b]); display max {n in Reversible, b in 1..3} card(reverse_set[n,b]); param reverse{n in Reversible,b in 1..3} = sum{sset in reverse_set[n,b]} sset; set Normalize_prod {n in Reversible, m in Reversible, b in 1..3} = (if reverse[n,b] div 2^0 mod 2 then S[m,3] else {}) symdiff (if reverse[n,b] div 2^1 mod 2 then S[m,2] else {}) symdiff (if reverse[n,b] div 2^2 mod 2 then S[m,1] else {}); #for{i in {40..40} inter Reversible, j in {11..12} inter Reversible} for{i in {40..40} inter Reversible, j in {141..141} inter Reversible} { for{b in 1..3} display S[i,b]; for{b in 1..3} display S[j,b]; for{b in 1..3} display Normalize_prod[i,j,b]; } set Reliable = {n in Reversible, m in Reversible: exists{k in Reversible} forall{b in 1..3} S[k,b] symdiff Normalize_prod[n,m,b] within {} }; display card(Reliable); display card(Reversible)^2; param op_reverse{n in Reversible, m in Reversible} = sum {k in Reversible: forall{b in 1..3} S[k,b] symdiff Normalize_prod[n,m,b] within {} } k; display op_reverse[11,11],op_reverse[11,40],op_reverse[40,11]; param op_xor{n in Reversible, m in Reversible} = sum {k in Reversible: forall{i in 1..bits} S[n,i] symdiff S[m,i] symdiff S[k,i] within {} } k; display {n in {11,73,140}, m in {11,73,140}} op_xor[n,m]; set Graph dimen 2 within Reversible cross Reversible = {n in Reversible, m in Reversible: m>n and op_xor[op_reverse[n,m],11] != 0 }; display card(Graph); set Codes3 dimen 3 = { (n1,n2) in Graph, n3 in Reversible: n3>n2 and op_xor[op_reverse[n1,n3],11] != 0 and op_xor[op_reverse[n2,n3],11] != 0 }; display card(Codes3); set Codes4 dimen 4 = { (n1,n2,n3) in Codes3, n4 in Reversible: n4>n3 and (n1,n4) in Graph and (n2,n4) in Graph and (n3,n4) in Graph }; display card(Codes4); set Codes5 dimen 5 = { (n1,n2,n3,n4) in Codes4, n5 in Reversible: n5>n4 and (n1,n5) in Graph and (n2,n5) in Graph and (n3,n5) in Graph and (n4,n5) in Graph }; display card(Codes5); set Codes6 dimen 6 = { (n1,n2,n3,n4,n5) in Codes5, n6 in Reversible: n5>n4 and (n1,n6) in Graph and (n2,n6) in Graph and (n3,n6) in Graph and (n4,n6) in Graph and (n5,n6) in Graph }; display card(Codes6); set Codes7 dimen 7 = { (n1,n2,n3,n4,n5,n6) in Codes6, n7 in Reversible: n7>n6 and (n1,n7) in Graph and (n2,n7) in Graph and (n3,n7) in Graph and (n4,n7) in Graph and (n5,n7) in Graph and (n6,n7) in Graph }; display card(Codes7); set Codes8 dimen 8 = { (n1,n2,n3,n4,n5,n6,n7) in Codes7, n8 in Reversible: n8>n7 and (n1,n8) in Graph and (n2,n8) in Graph and (n3,n8) in Graph and (n4,n8) in Graph and (n5,n8) in Graph and (n6,n8) in Graph and (n7,n8) in Graph }; display card(Codes8); set Codes7set{1..192}; param codes7vec{1..192,1..7}; param index; let index:=0; for{(n1,n2,n3,n4,n5,n6,n7) in Codes7} { let index:=index+1; let Codes7set[index] := {n1,n2,n3,n4,n5,n6,n7}; let codes7vec[index,1] := n1; let codes7vec[index,2] := n2; let codes7vec[index,3] := n3; let codes7vec[index,4] := n4; let codes7vec[index,5] := n5; let codes7vec[index,6] := n6; let codes7vec[index,7] := n7; } set Codewords{1..192,1..192} dimen 7 default {}; set Codewords_strict{1..192,1..192} dimen 7 default {}; param f{1..7}; param g{1..7}; param h{1..7}; set Whichslaves{1..192} default {}; param Codewords_vec{1..192,1..1680,1..7} default 0; set Codewords_fgh dimen 3 default {}; data a22_2-out-Codewords-i=1.txt; data a22_3-out-Codewords_strict-i=1.txt; data a22_4-out-Codewords_fgh-i=1.txt;