function X = saturate(U,alf) N = length(U); X = {}; fprintf('U = {%s} \n',cell2str(U,',')); PROGstart(2^N-1,'saturating...'); %fprintf('saturating...'); for i=1:2^N-1 setstr = dec2bin(i,N); ii1 = find(setstr=='1'); A = U(ii1); %fprintf('%d of %d: A = {%s} \n',i,2^N-1,cell2str(A,',')); MA = AB2M(A,alf); B = setdiff(U,subs(A)); %fprintf('%d of %d: B = {%s} \n',i,2^N-1,,cell2str(B,',')); MB = AB2M(B,alf); % x must contain all the features of A % and none of B Minter = intersects(MA,alf); Munion = unions(MB,alf); MAlessB = diff_dfsa(Minter,Munion); [b,x] = accept_str(MAlessB); %fprintf('b = %d, x = [%s] \n',b,x); if b X{end+1} = x; end PROGupdate(i); end PROGend return function M = unions(MM,alf) M = null_dfsa(alf); for i=1:length(MM) M = union_dfsa(M,MM{i}); end return function MM = AB2M(AB,alf) MM = {}; for i=1:length(AB) MM{i} = shuf2dfsa(AB{i},alf); end return function M = intersects(MM,alf) M = all_dfsa(alf); for i=1:length(MM) M = intersect_dfsa(M,MM{i}); end return function S = subs(A) S = {}; for i=1:length(A) Si = all_subseq(A{i}); S = unique([S(:); Si(:)]); end return