#C4.txt, 9/19/2016 Help:=proc(): print(` ChildOf(Dict,Dict1,a) `): end: #CWGF(A,Dict,t): Inputs a finite set of letters A (the alphabet), a finite set #set of "dirty words", Dict (set of lists of words in the alphabet A) #(we assume that none is properly contained another), and a variable t #outputs a rational function that is the generating function for #all CLEAN words (words in A not containing ANY of the members of Dict) CWGF:=proc(A,Dict,t) CWGF1(A,Dict, {}, t): end: #ChildOf(Dict,Dict1,a):If you have a word in the alphabet A and a list of #"dirty words" Dict, and another list Dict1, and you look at a typical #word avoiding any of the dirty words AND avoiding words in Dict1 at the start #and starting with a, what is the new Dict1? ChildOf:=proc(Dict,Dict1,a) local S,w: S:={}: for w in Dict union Dict1 do if w[1]=a then S:=S union {w[2..nops(w)]}: fi: od: S: end: #BuildEqs(A,Dict,t): inputs an alphabet A, a set of "dirty words" , Dict, and a variable t #returns a seq of equations and a set of variables for the various Dict1 that shows up BuildEqs:=proc(A,Dict,t,J) local var,eq, StillToDo, AlreadyDone,Dict1,eq1,a,yonah: var:={J[{}]}: eq:={}: StillToDo:={{}}: while StillToDo<>{} do Dict1:=StillToDo[1]: AlreadyDone:=AlreadyDone union {Dict1}: StillToDo:=StillToDo minus {Dict1}: var:=var union {J[Dict1]}: eq1:=J[Dict1]: for a in A do yonah:=ChildOf(Dict,Dict1,a): od: od: end: