#This Sage code verifies the expansion of the polynomial c(x1,x2,x3,x4,x5,x6,x7) #as a sum of 218 terms, each of which is a product of symmetric polynomials. #It uses fairly minimalist Sage functionality: polynomial rings over GF(2). R.=PolynomialRing(GF(2)) varlist=[x1,x2,x3,x4,x5,x6,x7] def productofpairsumsexceptone(L,i,j): prod=R(1) for u in range(len(L)): for v in range(u+1,len(L)): if((u!=i) or (v!=j)): prod*=(L[u]+L[v]) return prod def cpoly(L): total=R(0) for i in range(len(L)): for j in range(i+1,len(L)): total+=(L[i]*L[j]*((productofpairsumsexceptone(L,i,j))**2)) return total #This gives c(x1,x2,x3,x4,x5,x6,x7) according to the definition of the paper. #It avoids the use of non-polynomial rational functions. cfromdef=cpoly(varlist) def symfunc(L,n): if(0==n): return R(1) if(0==len(L)): return R(0) Lshortened=L[:-1] return symfunc(Lshortened,n)+L[-1]*symfunc(Lshortened,n-1) def productofsymfuncs(L,indices): prod=R(1) for j in range(len(indices)): prod*=(symfunc(L,j+1)**indices[j]) return prod def LambdaList(index): if(1==index): return [2,2,2,2,3,0,1] if(2==index): return [2,2,2,3,0,3,0] if(3==index): return [2,2,2,3,1,1,1] if(4==index): return [2,2,2,4,0,0,2] if(5==index): return [2,2,3,0,3,2,0] if(6==index): return [2,2,3,1,1,3,0] if(7==index): return [2,2,4,0,0,4,0] if(8==index): return [2,3,0,3,2,2,0] if(9==index): return [2,3,0,5,0,0,2] if(10==index): return [2,3,1,1,3,2,0] if(11==index): return [2,3,1,3,1,0,2] if(12==index): return [2,3,2,1,1,2,1] if(13==index): return [2,4,0,0,4,2,0] if(14==index): return [2,4,0,0,5,0,1] if(15==index): return [2,4,0,1,3,1,1] if(16==index): return [2,4,0,3,0,1,2] if(17==index): return [2,4,1,0,3,0,2] if(18==index): return [2,4,1,1,1,1,2] if(19==index): return [2,5,0,1,1,0,3] if(20==index): return [2,6,0,0,0,0,4] if(21==index): return [3,0,3,2,2,2,0] if(22==index): return [3,0,3,4,0,0,2] if(23==index): return [3,0,5,0,0,4,0] if(24==index): return [3,1,1,3,2,2,0] if(25==index): return [3,1,1,5,0,0,2] if(26==index): return [3,1,3,1,0,4,0] if(27==index): return [3,2,1,1,2,3,0] if(28==index): return [3,2,1,3,0,1,2] if(29==index): return [3,2,2,0,2,2,1] if(30==index): return [3,2,2,1,0,3,1] if(31==index): return [3,3,0,1,2,2,1] if(32==index): return [3,3,0,3,0,0,3] if(33==index): return [3,3,1,1,0,2,2] if(34==index): return [3,4,0,0,2,0,3] if(35==index): return [3,4,0,1,0,1,3] if(36==index): return [3,4,1,0,0,0,4] if(37==index): return [4,0,0,4,2,2,0] if(38==index): return [4,0,0,4,3,0,1] if(39==index): return [4,0,0,5,0,3,0] if(40==index): return [4,0,0,5,1,1,1] if(41==index): return [4,0,1,3,1,3,0] if(42==index): return [4,0,1,4,1,0,2] if(43==index): return [4,0,3,0,1,4,0] if(44==index): return [4,1,0,3,0,4,0] if(45==index): return [4,1,0,3,1,2,1] if(46==index): return [4,1,1,1,1,4,0] if(47==index): return [4,2,0,1,1,3,1] if(48==index): return [4,2,0,2,1,0,3] if(49==index): return [4,2,1,0,1,2,2] if(50==index): return [5,0,0,3,0,3,1] if(51==index): return [5,0,0,4,0,0,3] if(52==index): return [5,0,1,1,0,5,0] if(53==index): return [5,0,1,2,0,2,2] if(54==index): return [5,0,2,0,0,4,1] if(55==index): return [5,1,0,1,0,4,1] if(56==index): return [5,2,0,0,0,2,3] if(57==index): return [6,0,0,0,0,6,0] if(58==index): return [6,0,0,0,1,4,1] if(59==index): return [0,3,2,2,2,2,0] if(60==index): return [0,3,2,4,0,0,2] if(61==index): return [0,3,4,0,0,4,0] if(62==index): return [0,5,0,0,4,2,0] if(63==index): return [0,5,0,2,2,0,2] if(64==index): return [0,7,0,0,0,0,4] if(65==index): return [1,1,3,2,2,2,0] if(66==index): return [1,1,3,4,0,0,2] if(67==index): return [1,1,5,0,0,4,0] if(68==index): return [1,3,1,0,4,2,0] if(69==index): return [1,3,1,2,2,0,2] if(70==index): return [1,5,1,0,0,0,4] if(71==index): return [2,1,1,2,3,2,0] if(72==index): return [2,1,1,4,1,0,2] if(73==index): return [2,1,3,0,1,4,0] if(74==index): return [2,2,0,2,2,3,0] if(75==index): return [2,2,0,4,0,1,2] if(76==index): return [2,2,1,0,3,3,0] if(77==index): return [2,2,1,2,1,1,2] if(78==index): return [2,2,2,0,1,3,1] if(79==index): return [2,3,0,0,3,2,1] if(80==index): return [2,3,0,2,1,0,3] if(81==index): return [2,3,1,0,1,2,2] if(82==index): return [2,4,0,0,1,1,3] if(83==index): return [3,0,1,2,2,3,0] if(84==index): return [3,0,1,4,0,1,2] if(85==index): return [3,0,3,0,0,5,0] if(86==index): return [3,1,0,2,2,2,1] if(87==index): return [3,1,0,4,0,0,3] if(88==index): return [3,1,1,0,2,4,0] if(89==index): return [3,1,1,2,0,2,2] if(90==index): return [3,1,2,0,0,4,1] if(91==index): return [3,2,0,0,2,3,1] if(92==index): return [3,2,0,2,0,1,3] if(93==index): return [3,2,1,0,0,3,2] if(94==index): return [3,3,0,0,0,2,3] if(95==index): return [4,0,0,2,0,5,0] if(96==index): return [4,0,0,2,1,3,1] if(97==index): return [4,0,1,0,1,5,0] if(98==index): return [4,1,0,0,0,6,0] if(99==index): return [4,1,0,0,1,4,1] if(100==index): return [5,0,0,0,0,5,1] if(101==index): return [0,0,4,2,2,2,0] if(102==index): return [0,0,4,2,3,0,1] if(103==index): return [0,0,4,3,0,3,0] if(104==index): return [0,0,4,3,1,1,1] if(105==index): return [0,0,5,0,3,2,0] if(106==index): return [0,0,5,1,1,3,0] if(107==index): return [0,1,3,1,3,2,0] if(108==index): return [0,1,3,3,1,0,2] if(109==index): return [0,1,4,1,0,4,0] if(110==index): return [0,1,4,1,1,2,1] if(111==index): return [0,2,2,0,5,0,1] if(112==index): return [0,2,2,1,3,1,1] if(113==index): return [0,2,2,2,2,0,2] if(114==index): return [0,2,2,3,0,1,2] if(115==index): return [0,2,3,0,3,0,2] if(116==index): return [0,2,3,1,1,1,2] if(117==index): return [0,3,0,1,4,2,0] if(118==index): return [0,3,0,3,2,0,2] if(119==index): return [0,3,2,1,1,0,3] if(120==index): return [0,5,0,1,0,0,4] if(121==index): return [1,0,3,0,4,2,0] if(122==index): return [1,0,3,1,2,3,0] if(123==index): return [1,0,3,2,2,0,2] if(124==index): return [1,0,3,3,0,1,2] if(125==index): return [1,0,4,0,2,2,1] if(126==index): return [1,0,4,1,0,3,1] if(127==index): return [1,1,1,1,4,2,0] if(128==index): return [1,1,1,3,2,0,2] if(129==index): return [1,1,2,1,2,2,1] if(130==index): return [1,1,2,3,0,0,3] if(131==index): return [1,1,3,1,0,2,2] if(132==index): return [1,2,2,0,2,0,3] if(133==index): return [1,2,2,1,0,1,3] if(134==index): return [1,3,1,1,0,0,4] if(135==index): return [2,0,1,1,3,3,0] if(136==index): return [2,0,1,3,1,1,2] if(137==index): return [2,0,2,1,0,5,0] if(138==index): return [2,0,2,1,1,3,1] if(139==index): return [2,0,2,2,0,2,2] if(140==index): return [2,0,2,2,1,0,3] if(141==index): return [2,0,3,0,1,2,2] if(142==index): return [2,1,0,1,2,4,0] if(143==index): return [2,1,0,1,3,2,1] if(144==index): return [2,1,0,3,0,2,2] if(145==index): return [2,1,0,3,1,0,3] if(146==index): return [2,2,0,0,3,0,3] if(147==index): return [2,2,0,1,0,3,2] if(148==index): return [2,2,0,1,1,1,3] if(149==index): return [2,2,0,2,0,0,4] if(150==index): return [2,2,1,0,1,0,4] if(151==index): return [3,0,0,1,2,3,1] if(152==index): return [3,0,0,3,0,1,3] if(153==index): return [3,0,1,0,2,2,2] if(154==index): return [3,0,1,2,0,0,4] if(155==index): return [3,0,2,0,0,2,3] if(156==index): return [3,2,0,0,0,0,5] if(157==index): return [0,0,3,0,3,3,0] if(158==index): return [0,0,3,2,1,1,2] if(159==index): return [0,0,4,0,0,5,0] if(160==index): return [0,0,4,0,1,3,1] if(161==index): return [0,1,1,0,5,2,0] if(162==index): return [0,1,1,2,3,0,2] if(163==index): return [0,1,2,0,2,4,0] if(164==index): return [0,1,2,0,3,2,1] if(165==index): return [0,1,2,2,0,2,2] if(166==index): return [0,1,2,2,1,0,3] if(167==index): return [0,1,3,0,1,2,2] if(168==index): return [0,2,0,0,4,3,0] if(169==index): return [0,2,0,2,2,1,2] if(170==index): return [0,2,2,0,1,1,3] if(171==index): return [0,3,0,0,2,2,2] if(172==index): return [0,3,0,2,0,0,4] if(173==index): return [0,3,1,0,1,0,4] if(174==index): return [0,4,0,0,0,1,4] if(175==index): return [1,0,1,0,4,3,0] if(176==index): return [1,0,1,2,2,1,2] if(177==index): return [1,0,2,0,2,3,1] if(178==index): return [1,0,2,2,0,1,3] if(179==index): return [1,0,3,0,0,3,2] if(180==index): return [1,1,0,0,4,2,1] if(181==index): return [1,1,0,2,2,0,3] if(182==index): return [1,1,1,0,2,2,2] if(183==index): return [1,1,1,2,0,0,4] if(184==index): return [1,1,2,0,0,2,3] if(185==index): return [1,2,1,0,0,1,4] if(186==index): return [1,3,0,0,0,0,5] if(187==index): return [2,0,0,0,2,5,0] if(188==index): return [2,0,0,0,3,3,1] if(189==index): return [2,0,0,2,0,3,2] if(190==index): return [2,0,0,2,1,1,3] if(191==index): return [0,0,0,0,6,2,0] if(192==index): return [0,0,0,0,7,0,1] if(193==index): return [0,0,0,1,4,3,0] if(194==index): return [0,0,0,1,5,1,1] if(195==index): return [0,0,1,0,5,0,2] if(196==index): return [0,0,1,1,3,1,2] if(197==index): return [0,0,2,0,2,2,2] if(198==index): return [0,0,2,0,3,0,3] if(199==index): return [0,0,2,1,0,3,2] if(200==index): return [0,0,2,1,1,1,3] if(201==index): return [0,1,0,1,2,2,2] if(202==index): return [0,1,0,1,3,0,3] if(203==index): return [0,1,1,1,1,0,4] if(204==index): return [0,2,0,0,2,0,4] if(205==index): return [0,2,0,1,0,1,4] if(206==index): return [1,0,0,0,4,0,3] if(207==index): return [1,0,0,1,2,1,3] if(208==index): return [1,0,1,0,2,0,4] if(209==index): return [1,0,1,1,0,1,4] if(210==index): return [1,1,0,1,0,0,5] if(211==index): return [2,0,0,0,0,2,4] if(212==index): return [2,0,0,0,1,0,5] if(213==index): return [0,0,0,0,2,3,2] if(214==index): return [0,0,0,0,3,1,3] if(215==index): return [0,0,1,0,1,1,4] if(216==index): return [0,1,0,0,0,2,4] if(217==index): return [0,1,0,0,1,0,5] if(218==index): return [1,0,0,0,0,1,5] #This gives our proposed expression for c(x1,x2,x3,x4,x5,x6,x7) as a sum of 218 products of symmetric functions. cfromsymfuncs=sum(productofsymfuncs(varlist,LambdaList(j)) for j in range(1,219)) #This verifies that our proposed expression for c(x1,x2,x3,x4,x5,x6,x7) matches the original definition. print "The difference between the original definition and the expansion is:", cfromdef-cfromsymfuncs #This verifies that each of the 218 terms has at least one factor of the 1st, 2nd, 5th, or 6th symmetric function. for j in range(1,219): verified=True index=LambdaList(j) if((index[0]+index[1]+index[4]+index[5])<=0): print "Term ", j, "has no factor that is a 1st, 2nd, 5th, or 6th symmetric function" verified=False print "It is", verified, "that each of the terms has at least one factor of the 1st, 2nd, 5th, or 6th symmetric function."