# Homework 19. April-2-2012. Pat Devlin # # I have no preferrence about keeping my work private. # Help:=proc(): print(`SFP(d, n, blank:=B), NdnC(d,n)`): print(`WnX(A, FP, B, n), WnGX(A,FP,B,n,x)`): print(`adnC(d,n)`): print(`WnR(A, FP, B, N)`): print(`Type HelpAll() for all functions`): end proc: HelpAll:=proc(): print(`Adn(d,n), IsBad(d,S),adnS(d,n)`): print(`NdnS(d,n) , AdnM(d,n), adnM(d,n), NdnM(d,n) `): print(`GuessRec(L)`): print(`AdjustBFP(a,B,FP,BFP) , Wn(A,FP,B,n), WGn(A,FP,B,n,BFP)`): end: ############# # Problem 1 # ############# # The forbidden patterns are exactly those forbidden sets found in homework 18::problem 4, reproduced below # The choice of FP to make it so that Wn({0,1}, FP, B, n) is the same as # Ndn(d,n) is just avoiding all patterns of the form # [1, B$k, 1, B$k, 1, B$k, ... , B$k, 1] (a total of d 1's), where k ranges # from 0 to infinity. # To make this finite, note that we actually only need to go until d + # k*(d-1) [which is the length of this forbidden string] is greater than n. # So we just need k > (n-d) / (d-1). SFP:=proc(d,n, blank:=B) local k, i: return {[1$d], seq([op([1, seq(op([blank$k, 1]), i=1..d-1)])], k=0..((n-d)/(d-1)+1))}: end proc: NdnC:=proc(d,n) local B: return Wn({0,1}, SFP(d,n,B), B, n): end proc: ############# # Problem 2 # ############# WnX:=proc(A, FP, B, n, x) option remember: return WGnX(A,FP,B,n,{}, x): end proc: WGnX:=proc(A,FP,B,n,BFP, x) option remember: local co,a,BFP1: if member([],BFP union FP) then RETURN(0): fi: if n=0 then RETURN(1): fi: co:=0: for a in A do BFP1:=AdjustBFP(a,B,FP,BFP): co:=co+x[a]*WGnX(A,FP,B,n-1,BFP1, x): od: return co: end proc: ############# # Problem 3 # ############# adnC:=proc(d,n) local x, B: return degree(WnX({0,1}, SFP(d,n,B), B, n, x), x[1]): end proc: ############# # Problem 4 # ############# # The sequence [seq(Wn(A,FP,B,n), n=1..infinity)] is C-finite because it is # the linear combination of sequences of the form WGn(A, FP, B, n, BFP). # Moreover, we claim each such WGn is C-finite, which will complete the proof. # # To see that each WGn is C-finite, note that by conditioning on at most # the first max |b|, for b in BFP elements of a word, we can write WGn(...) as a linear combination of the sum # of at most this many terms of the form WGn(A, FP, B, n2, BFP2), where n2FAIL then RETURN(ans): fi: od: FAIL: end: ################# # From Class 19 # ################# #Dedicated to Endre Szemeredi on the occaison of the Abel Prize 2012 with(combinat): #Let a_d(n) be the largest size of a subset of {1, ...,n} #avoiding arthmetical pogressions of length d #(Szemeredi's famous theorem says that a_d(n)/n->0) #d=3 is it the already deep Roth theorem who proved that #a_3(n)/n<=C/log(log(n)) #Adn(d,n): Inputs positive integers d and n and outputs #the set of all subsets of {1, ...,n} that DO NOT have #an arithmetical progression of length d Adn:=proc(d,n) local S,s1,i,T: S:=powerset(n): T:={}: for s1 in S do if not IsBad(d,s1) then #T:=T union {s1}: T:={op(T), s1}: fi: od: T: end: #IsBad(d,S): Does the set of pos. integers S contain #an AP of length d? IsBad:=proc(d,S) local m,S1,dif,PTM,j: option remember: if nops(S)