home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / b / binprolog / !BinPro330 / progs / subset < prev    next >
Encoding:
Text File  |  1994-02-11  |  753 b   |  38 lines

  1. subset([],[]).
  2. subset([_|Xs],Ys):-subset(Xs,Ys).
  3. subset([X|Xs],[X|Ys]):-subset(Xs,Ys).
  4.  
  5. gen_list(0,[]).
  6. gen_list(N,[_|L]):-
  7.         N>0, M is N-1,
  8.         gen_list(M,L).
  9.  
  10. test(S):-gen_list(14,L),subset(L,S).
  11.  
  12. nondet:-gen_list(16,L),subset(L,_),fail.
  13. nondet.
  14.  
  15. t:-
  16.     statistics(runtime,_),all,fail
  17. ;    statistics(runtime,[_,T]),write(time=T),nl.
  18.  
  19.  
  20. pow(S,Xs):-findall(X,subset(S,X),Xs).
  21.  
  22. pow2(S,XXs):-findall(Xs,(pow(S,P),member(X,P),pow(X,Xs)),XXs).
  23.  
  24. g(N):-gen_list(N,Xs),pow2(Xs,S),length(S,L),write(L),nl.
  25.  
  26. go(Mes):-write('use bp -h20000'),nl,
  27.     statistics(runtime,_),
  28.     nondet,
  29.     statistics(runtime,[_,T0]),
  30.     findall(Q,test(Q),Qs),
  31.     statistics(runtime,[_,T]),
  32.     length(Qs,L),
  33.     write(Mes=[nondet^16=T0,findall(L)=T]),nl.
  34.  
  35. go:-go('BMARK_subset').
  36.  
  37. p:-[subset].
  38.