Problem in Magma regarding truth table and ANF

2018-10-06 17:40:16

So, I am trying to solve a problem in Magma, that is implement a program which gives me the ANF of a Boolean function if the input is given with the truth table. There is a really nice algorithm to do that but I cannot implement it in Magma in its completeness because I am still learning how to work in it. This is my code:


for k:=2 to 7 do

if k lt 4 then


print k,"---->",s;




print k,"---->",s;


end if;

end for;

m:=Matrix(3,list1); // matrix of binary representations of numbers 0 to 7

print m;

f:=[0,0,1,0,1,1,0,1]; // my Boolean function

function g(x1,x2,x3)

return f[1]; // initial value for the function g which will be the AFN

end function;

for k:=1 to 7 do

if g(m[k,1],m[k,2],m[k,3]) ne f[k] then


//updating the function