
# Test NATURALLY labeled ENRICHED W-polynomials
# of ALL (connected) posets for non-real zeros.
#
# Here, we cannot eliminate P-dual after testing P.
#
# Example: testall(8);

read allrealzeros;
read fastW;
read traverse;
read ideals;
read `posets2.2.1v.txt`;

# If P is connected compute its enriched W-polynomial
# and test it for non-real zeros.

test:=proc(ct,P,down,n,t) local X,g;
  if posets['connected'](P,n) then
    X:={$1..n};
    g:=fastW(P,X,t,ideals(down,X),'enriched');
    if not allrealzeros(g,t) then print(`Counterexample:`,P) fi;
    RETURN([ct[1]+1,ct[2]+1])
  fi;
  [ct[1],ct[2]+1]
end;

# Test all enriched W-polynomials on n points for non-real zeros.

testall:=proc(n) local st,res;
  st:=time(); printf(`\n`);
  res:=traverse(n,[0,0],test,t);
  if `+`(0)=0 then st:=time()-st,kernelopts(bytesalloc)
    else st:=time()-st,4*status[2] fi;
  printf(`all_nat_e  n=%-2d  tot=[%8d,%8d]  time=%10.2f  space=%7d\n`,
    n,op(res),st);
end;

