Help:=proc(): print(`F(i,x,y), EvalB(SL1,L1), nCube(n) `): end: t:=true: f:=false: #F(i,x,y): inputs an integer i, 1<=i<=10 and #logical constants (i.e. true or false) and #outputs the value of the #i-GENUINE 2-variable #Boolean function F:=proc(i,x,y) : if i=1 then x or y: elif i=2 then not x or y : elif i=3 then x or not y : elif i=4 then not x or not y: elif i=5 then x and y: elif i=6 then not x and y : elif i=7 then x and not y : elif i=8 then not x and not y: elif i=9 then (not x and y) or (x and not y): elif i=10 then (not x and not y) or (x and y): else ERROR(`i has to be an integer between 1 and 10 `): fi: end: SL1:=[1,2,3,4,[5,1,2],[6,3,4],[10,5,6]]; #EvalB(n,SLP,L1): Inputs a pos. integer n #a "straight line program" SLP and a list #L1 of length n of true and false's (t and f) #outputs the values of the function computed #by this SLP for each of the gates #For example, #EvalB(SL1,[t,f,f,t]); EvalB:=proc(SLP,L1) local n,L2,i,inst: n:=nops(L1): L2:=L1: for i from n+1 to nops(SLP) do inst:=SLP[i]: L2:=[ op(L2), F(inst[1], L2[inst[2]],L2[inst[3]]) ]: od: L2: end: #nCube(n): The set of all n-vectors of t's and f's nCube:=proc(n) local S,s: option remember: if n=0 then RETURN({ [] }): fi: S:=nCube(n-1): { seq( [op(s),t], s in S), seq( [op(s),f], s in S) }: end: