Help:=proc(): print(`Imply(R,L,W), ES(R,L,W,m)`): print(`Closure1(R,L,F,m) `): end: with(combinat): #Implementing p. 5 of the Alon-Boppana paper #Combinaorica 7(1) (1987) 1-22 #Imply(R,L,W): inputs pos. integers R and L #and a list of length R of sets (of integers) W #and outputs the set of all elements that belong #to AT LEAST two of the sets in the list W #If its cardinality <=L OR returs FAIL if it >L Imply:=proc(R,L,W) local S,i,j: if nops(W)<>R then ERROR(`Size of W should be equal to`, R): fi: if {seq(type(W[i],set),i=1..R)}<>{true} then ERROR(`W should be a list of sets`): fi: if {seq( evalb(nops(W[i])<=L),i=1..R)}<>{true} then ERROR(`W should be a list of sets of at most `, L, ` elements `): fi: S:= {seq(seq(op(W[i] intersect W[j]),j=i+1..R),i=1..R) }: if nops(S)>L then RETURN(FAIL): else RETURN(S): fi: end: #ES(R,L,W,m): inputs pos. integers R and L #and a list of length R of sets (of integers) W #and a positive integer m, #and outputs the set of sets of all elements that belong #to AT LEAST two of the sets in W and #all their supersets in {1, ..., m} #If its cardinality is <=L OR returs FAIL if it >L ES:=proc(R,L,W,m) local S,extra,i,F,susan,WCBI, susan1: S:=Imply(R,L,W): if S=FAIL then RETURN({}): fi: F:={S}: extra:=L-nops(S): WCBI:={seq(i,i=1..m)} minus S: for i from 1 to extra do susan:=choose(WCBI,i): F:= F union {seq(S union susan1, susan1 in susan)}: od: F: end: #Closure(R,L,F): Inputs pos. integers R and L #and a family of sets of integers, F #and outputs its closure (aS defined in page 5 of #the Alon-Boppana paper Closure:=proc(R,L,F) local F1: F1:=F: end: #Closure1(R,L,F,m): Inputs pos. integers R and L #and a family of sets of integers, F #and outputs ONE extra set implied by SOME #subfamily of R sets in F Closure1:=proc(R,L,F,m) local Jake,Clubs, club,tay: Clubs:=choose(F,R): for club in Clubs do tay:=ES(R,L,convert(club,list),m): if tay minus F<>{} then RETURN(F union tay): fi: od: FAIL: end: