高速化
アルゴリズムを「簡約」し,コストを半減させました.
nns(f):= block([cl,L,fk],cl(f,g):=length(f)<=length(g), L:sort(rest(full_listify(powerset(setify(args(f))))),cl), if op(f)="%and" then for k:1 thru length(L) do (fk:substpart("%and",part(L,k),0), if qe([],(fk)%implies(f))=true then return(fk)) elseif op(f)="%or" then for k:1 thru length(L) do (fk:substpart("%or",part(L,k),0), if qe([],(f)%implies(fk))=true then return(fk)) else f)$