########################################################################## ## TransMethodZeck: Save this file as TransMethodZeck to use it, # ## stay in the same directory, get into Maple # ## (by typing: maple ) # ## and then type: read TransMethodZeck: # ## Then follow the instructions given there # ## # ## Written by Philip Matchett Wood, Rutgers University, # ## matchett@math.rutgers.edu. # ########################################################################## ##-------------------------------------------------------------------------## # Loading ZeckFibBijections # print(`######################################################################`): print(`##-------LOADING ZeckFibBijections----------------------------------##`): read `ZeckFibBijections`: print(`##----FINISHED LOADING ZeckFibBijections----------------------------##`): print(`######################################################################`): ##-------------------------------------------------------------------------## # Loading BijTools # print(`######################################################################`): print(`##-------LOADING BijTools-------------------------------------------##`): read `BijTools`: print(`##----FINISHED LOADING BijTools-------------------------------------##`): print(`######################################################################`): ##-------------------------------------------------------------------------## # Loading Fibonacci # print(`######################################################################`): print(`##-------LOADING Fibonacci------------------------------------------##`): read `Fibonacci`: print(`##----FINISHED LOADING Fibonacci------------------------------------##`): print(`######################################################################`): with(ListTools): print(`First Written: Jan. 09, 2007: tested for Maple 10 `): print(`Version of Jan. 09, 2007: `): print(): print(`This is TransMethodZeck, A Maple package`): print(`accompanying the article: `): print(`A translation method for finding combinatorial bijections`): print(` by Philip Matchett Wood and Doron Zeilberger`): print(`Available from:`): print(`http://www.math.rutgers.edu/~matchett/Publications/`): print( ): print(`The most current version of this program is available on WWW at:`): print(`http://www.math.rutgers.edu/~matchett/Publications/`): print(`Please report all bugs to: matchett at math dot rutgers dot edu .`): print(): print(`For general help, and a list of the MAIN functions,`): print(`type "Help();". For specific help type "Help(procedure_name);" `): print(): ## NOTE: the Help function is defined at the end of this file. # the function Hlp lists the main functions Hlp:=proc(): print(`phi5rec(n), phi6rec(n), ..., phi12rec(n)`): print(`phi5direct(n), phi6direct(n), ..., phi12direct(n)`): print(`###############################################`): print(`#### ALSO INCLUDED (from Bijtools): #####`): print(`IndicesSeq(B), EntriesSeq(B), MultSet(S1,S2),`): print(`IdBij(S), BuildBij(L1,L2), InvBij(B)`): print(`ComposeBij(B1,B2), MultBij(B1,B2), AddBij(B1,B2), SumBij(L), SubtBij(B1,B 2),`): print(`BijOut(B,a,b,AnOrder), BijEqual(B1,B2), IsBij(B,Domain,Range),`): print(`SplitProdBij(B1xB2), SwitchProdBij(B1xB2)`): print(`###############################################`): print(`##### ALSO INCLUDED (from Fibonacci): ######`): print(`Fn(n), FibDef(n), FibLex(A,B), ZeckSort(A,B)`): print(`###############################################`): print(`### ALSO INCLUDED (from ZeckFibBijections): ###`): print(`F(n), MtimesF(m,n), phi5(n,X), phi6(n,X), ..., phi12(n,X)`): print(`Checkphi5(n), Checkphi6(n), ..., Checkphi12(n)`): print(`phi5inv(n,Y), Checkphi5phi5inv(n), Checkphi5invpih5(n) `): print(`phi5prime(n,X), Checkphi5prime(n)`): end: ###..................................### ## BIJECTIONS from TRANSLATION METHOD ## #----------- phi5rec ------------------------------------ #-- Bijection for 5f_n = f_{n+3} + f_{n-1} + f_{n-4} #-- matches phi5 from ZeckFibBijections phi5recBase_1a:=proc() local B: B:=table( [[-2, -1, -1, -1] = [-2], [-2, -1, -2] = [1,1], [-2, -2, -1] = [2] ] ): B: end: phi5recBase0:=proc() local B: B:=table( [[1,[]] = [1, 1, 1], [2,[]] = [1, 2], [3,[]] = [2, 1], [4,[]] = [-2, -2], [5,[]] = [-2, -1, -1] ] ): B: end: phi5recBase1:=proc() local B1,B1p,B2,B2p,B3p,B3pp,B3,B4: B1:=MultBij(IdBij([1,2,3,4,5]),FibDef(1)): B1p:=AddBij(IdBij(Fn(-5)),B1): B2:= AddBij(phi5recBase0(),phi5recBase_1a()): B2p:= ComposeBij(B2,B1p): B3:= AddBij(IdBij(Fn(-3)),B2p): B3p:= InvBij(AddBij(AddBij(FibDef(4),FibDef(0)),FibDef(-3))): B3pp:=ComposeBij(B3p,B3): B4:=SubtBij(B3pp,IdBij(Fn(-5))): return B4: end: phi5recBase2:=proc() local B1,B1p,B1pp,B2,B2p,B3,B4: B1:=MultBij(IdBij([1,2,3,4,5]),FibDef(2)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi5recBase1(),phi5recBase0()): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(AddBij(AddBij(FibDef(5),FibDef(1)),FibDef(-2))): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): B4: end: phi5recBase3:=proc() local B1,B1p,B1pp,B2,B2p,B3,B4: B1:=MultBij(IdBij([1,2,3,4,5]), FibDef(3)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi5recBase2(),phi5recBase1()): B2:=ComposeBij(B1pp,B1p): B2p:=InvBij(AddBij(AddBij(FibDef(6),FibDef(2)),FibDef(-1))): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): B4: end: # phi5rec(n): this returns the general bijection for 3a, allowing numbers down # to the base cases of -1 and 0 for n. phi5rec:=proc(n) local B1,B2,B3,B4: #Base case 1, for 3a, setting n= -1. # Formula: 0 = 2 + 1 - 3 if n = -1 then return phi5recBase_1a(): elif n=0 then return phi5recBase0(): elif n=1 then return phi5recBase1(): elif n=2 then return phi5recBase2(): elif n=3 then return phi5recBase3(): fi: B1:= MultBij(IdBij([1,2,3,4,5]),FibDef(n)): B2:= AddBij(phi5rec(n-1),phi5rec(n-2)): B3:= InvBij(AddBij(AddBij(FibDef(n+3),FibDef(n-1)),FibDef(n-4))): B4:= ComposeBij(B3,ComposeBij(B2,B1)): B4: end: #----------- phi6rec ------------------------------------ #-- Bijection for 6f_n = f_{n+3} + f_{n+1} + f_{n-4} #-- matches phi6 from ZeckFibBijections # We will now define base cases for the formula 3b for n=0 and n=-1 (both of # these will require the use of negative sets). Also, we will have to use # subtraction of bijections, and so we will implement this first (Check!). # returns the bijection for the case n= -1 of the bijection. Note that this # base case should define the whole bijection (with the other base case). ## in FILE B phi6recBase_1:=proc() local B: B:=table( [[-2, -1, -1, -1] = [], [-2, -1, -2] = [1,1], [-2, -2, -1] = [2] ] ): B: end: # ALTERNATIVE BASE CASE for 0 # returns the bijection for the case n= 0 of the bijection. Note that this # bijection will define the whole thing (with the other base case). phi6recBase0:=proc() local B: B:=table( [[1,[]] = [1], [2,[]] = [1, 1, 1], [3,[]] = [1, 2], [4,[]] = [2, 1], [5,[]] = [-2, -2], [6,[]] = [-2, -1, -1] ] ): B: end: # computes the bijection for n=1 based on the two base cases of n=0 and n=-1 phi6recBase1:=proc() local B1,B1p,B2,B2p,B3p,B3pp,B3,B4: B1:=MultBij(IdBij([1,2,3,4,5,6]),FibDef(1)): B1p:=AddBij(IdBij(Fn(-5)),B1): B2:= AddBij(phi6recBase0(),phi6recBase_1()): B2p:= ComposeBij(B2,B1p): B3:= AddBij(IdBij(Fn(-3)),B2p): B3p:= InvBij(AddBij(AddBij(FibDef(4),FibDef(2)),FibDef(-3))): B3pp:=ComposeBij(B3p,B3): B4:=SubtBij(B3pp,IdBij(Fn(-5))): return B4: end: # computes the bijection for n=1 based on the two base cases of n=0 and n=-1 phi6recBase2:=proc() local B1,B1p,B1pp,B2,B2p,B3,B4: B1:=MultBij(IdBij([1,2,3,4,5,6]),FibDef(2)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi6recBase1(),phi6recBase0()): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(AddBij(AddBij(FibDef(5),FibDef(3)),FibDef(-2))): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): B4: end: # computes the bijection for n=1 based on the two base cases of n=0 and n=-1 phi6recBase3:=proc() local B1,B1p,B1pp,B2,B2p,B3,B4: B1:=MultBij(IdBij([1,2,3,4,5,6]), FibDef(3)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi6recBase2(),phi6recBase1()): B2:=ComposeBij(B1pp,B1p): B2p:=InvBij(AddBij(AddBij(FibDef(6),FibDef(4)),FibDef(-1))): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): B4: end: # phi6rec(n): this returns the general bijection, allowing numbers down to the # base cases of -1 and 0 for n. phi6rec:=proc(n) local B1,B2,B3,B4: #Base case 1, for 3b, setting n= -1. # Formula: 0 = 2 + 1 - 3 if n = -1 then return phi6recBase_1(): elif n=0 then return phi6recBase0(): elif n=1 then return phi6recBase1(): elif n=2 then return phi6recBase2(): elif n=3 then return phi6recBase3(): fi: B1:= MultBij(IdBij([1,2,3,4,5,6]),FibDef(n)): B2:= AddBij(phi6rec(n-1),phi6rec(n-2)): B3:= InvBij(AddBij(AddBij(FibDef(n+3),FibDef(n+1)),FibDef(n-4))): B4:= ComposeBij(B3,ComposeBij(B2,B1)): B4: end: #----------- phi7rec ------------------------------------ #-- Bijection for 7f_n = f_{n+4} + f_{n-4} #-- matches phi7 from ZeckFibBijections # phi7rec(n): this returns the general bijection for 3c, allowing numbers down # to the base cases of -1 and 0 for n. phi7rec:=proc(n) local B1,B1p,B1pp,B2,B2p,B3,B3p,B3pp,B4, phi7recBase_1,phi7recBase0,phi7recBase1,phi7recBase2,phi7recBase3: #Base case 1, for 3a, setting n= -1. # Formula: 0 = 2 + 1 - 3 if n = -1 then phi7recBase_1:=table( [[-2, -1, -2] = [1,1,1], [-2, -2, -1] = [1,2], [-2, -1, -1, -1] = [2,1] ]): return phi7recBase_1: elif n=0 then phi7recBase0:=table( [[1,[]] = [1,1,1,1], [2,[]] = [1,1,2], [3,[]] = [1,2,1], [4,[]] = [2,1,1], [5,[]] = [2,2], [6,[]] = [-2,-2], [7,[]] = [-2, -1, -1] ] ): return phi7recBase0: elif n=1 then B1:=MultBij(IdBij([1,2,3,4,5,6,7]),FibDef(1)): B1p:=AddBij(IdBij(Fn(-5)),B1): B2:= AddBij(phi7rec(0),phi7rec(-1)): B2p:= ComposeBij(B2,B1p): B3:= AddBij(IdBij(Fn(-3)),B2p): B3p:= InvBij(AddBij(FibDef(5),FibDef(-3))): B3pp:=ComposeBij(B3p,B3): phi7recBase1:=SubtBij(B3pp,IdBij(Fn(-5))): return phi7recBase1: elif n=2 or n = 3 then B1:=MultBij(IdBij([1,2,3,4,5,6,7]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi7rec(n-1),phi7rec(n-2)): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(AddBij(FibDef(n+4),FibDef(n-4))): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): return B4: fi: # cases n >= 4. B1:= MultBij(IdBij([1,2,3,4,5,6,7]),FibDef(n)): B2:= AddBij(phi7rec(n-1),phi7rec(n-2)): B3:= InvBij(AddBij(FibDef(n+4),FibDef(n-4))): B4:= ComposeBij(B3,ComposeBij(B2,B1)): B4: end: #----------- phi8rec ------------------------------------ #-- Bijection for 8f_n = f_{n+4} + f_n + f_{n-4} #-- matches phi8 from ZeckFibBijections # phi8rec(n): this returns the general bijection for 3d, allowing numbers down # to the base cases of -1 and 0 for n. phi8rec:=proc(n) local B1,B1p,B1pp,B2,B2p,B3,B3p,B3pp,B4: #Base case 1, for 3a, setting n= -1. # Formula: 0 = 2 + 1 - 3 if n = -1 then B1:=table( [[-2, -1, -2] = [1,1,1], [-2, -2, -1] = [1,2], [-2, -1, -1, -1] = [2,1] ]): return B1: elif n=0 then B1:=table( [[1,[]] = [1,1,1,1], [2,[]] = [1,1,2], [3,[]] = [1,2,1], [4,[]] = [2,1,1], [5,[]] = [2,2], [6,[]] = [], [7,[]] = [-2,-2], [8,[]] = [-2, -1, -1] ] ): return B1: elif n=1 then B1:=MultBij(IdBij([1,2,3,4,5,6,7,8]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-5)),B1): B2:= AddBij(phi8rec(n-1),phi8rec(n-2)): B2p:= ComposeBij(B2,B1p): B3:= AddBij(IdBij(Fn(-3)),B2p): B3p:= InvBij(AddBij(AddBij(FibDef(n+4),FibDef(n)),FibDef(n-4))): B3pp:=ComposeBij(B3p,B3): B4:=SubtBij(B3pp,IdBij(Fn(-5))): return B4: elif n=2 or n = 3 then B1:=MultBij(IdBij([1,2,3,4,5,6,7,8]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi8rec(n-1),phi8rec(n-2)): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(AddBij(AddBij(FibDef(n+4),FibDef(n)),FibDef(n-4))): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): return B4: fi: # cases n >= 4. B1:= MultBij(IdBij([1,2,3,4,5,6,7,8]),FibDef(n)): B2:= AddBij(phi8rec(n-1),phi8rec(n-2)): B3:= InvBij(AddBij(AddBij(FibDef(n+4),FibDef(n)),FibDef(n-4))): B4:= ComposeBij(B3,ComposeBij(B2,B1)): B4: end: #----------- phi9rec ------------------------------------ #-- Bijection for 9f_n = f_{n+4} + f_{n+1} + f_{n-2} + f_{n-4} #-- matches phi9 from ZeckFibBijections phi9rec:=proc(n) local B: B:=phi9to11rec(9,n): return B: end: #----------- phi10rec ------------------------------------ #-- Bijection for 10f_n = f_{n+4} + f_{n+2} + f_{n-2} + f_{n-4} #-- matches phi10 from ZeckFibBijections phi10rec:=proc(n) local B: B:=phi9to11rec(10,n): return B: end: #----------- phi11rec ------------------------------------ #-- Bijection for 11f_n = f_{n+4} + f_{n+2} + f_n + f_{n-2} + f_{n-4} #-- matches phi11 from ZeckFibBijections phi11rec:=proc(n) local B: B:=phi9to11rec(11,n): return B: end: #----------- phi9to11rec ------------------------------------ # This function is called by phi9rec, phi10rec, and phi11rec above. # phi9to11rec(s,n): this returns the general bijections for 3e through 3g, # allowing numbers down to the base cases of -1 and 0 for n. # NOTE THE CHART: # s = F3e = 9 # s = F3f = 10 # s = F3g = 11 # where s is the switch phi9to11rec:=proc(s,n) local i,B1,B1p,B1pp,B2,B2p,B3,B3p,B3pp,B4, F3e, F3f,F3g: F3e:= 9: F3f:= 10: F3g:= 11: #Base case, setting n= -1. # Formula: 0 = 2 + 1 - 3 if n = -1 then B1:=table( [[-2, -1, -2] = [1,1,1], [-2, -2, -1] = [1,2], [-2, -1, -1, -1] = [2,1] ]): if s = F3e then B1[[-2, -1]]:=[]: elif s = F3f or s = F3g then B1[[-2, -1]]:=[1]: else print(`ERROR---first argument must be 9,10, or 11`): fi: return B1: elif n=0 then if s = F3e then B1:= BuildBij([seq([i,[]],i=1..s)], [op(sort([op(Fn(n+4))],FibLex)), op(sort([op(Fn(n+1))],FibLex)), op(sort([op(Fn(n-2))],FibLex)), op(sort([op(Fn(n-4))],FibLex)) ]): elif s = F3f then B1:= BuildBij([seq([i,[]],i=1..s)], [op(sort([op(Fn(n+4))],FibLex)), op(sort([op(Fn(n+2))],FibLex)), op(sort([op(Fn(n-2))],FibLex)), op(sort([op(Fn(n-4))],FibLex)) ]): elif s = F3g then B1:= BuildBij([seq([i,[]],i=1..s)], [op(sort([op(Fn(n+4))],FibLex)), op(sort([op(Fn(n+2))],FibLex)), op(sort([op(Fn(n))],FibLex)), op(sort([op(Fn(n-2))],FibLex)), op(sort([op(Fn(n-4))],FibLex)) ]): fi: return B1: elif n=1 then B1:=MultBij(IdBij([seq(i,i=1..s)]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3)),AddBij(IdBij(Fn(-5)),B1)): B2:= AddBij(phi9to11rec(s,n-1),phi9to11rec(s,n-2)): B2p:= ComposeBij(B2,B1p): if s = F3e then B3:= AddBij( InvBij(AddBij(AddBij(FibDef(n+4),FibDef(n+1)),FibDef(n-2))), IdBij(Fn(-4))): B3p:= AddBij( AddBij(AddBij(IdBij(Fn(n+4)),IdBij(Fn(n+1))),IdBij(Fn(n-2))), InvBij(FibDef(n-4))): elif s = F3f then B3:= AddBij( InvBij(AddBij(AddBij(FibDef(n+4),FibDef(n+2)),FibDef(n-2))), IdBij(Fn(-4))): B3p:= AddBij( AddBij(AddBij(IdBij(Fn(n+4)),IdBij(Fn(n+2))),IdBij(Fn(n-2))), InvBij(FibDef(n-4))): elif s = F3g then B3:= AddBij( InvBij( AddBij( AddBij(AddBij(FibDef(n+4),FibDef(n+2)),FibDef(n)),FibDef(n-2))), IdBij(Fn(-4))): B3p:= AddBij( AddBij(AddBij(AddBij( IdBij(Fn(n+4)),IdBij(Fn(n+2))),IdBij(Fn(n))),IdBij(Fn(n-2))), InvBij(FibDef(n-4))): else print(`Bad input!`): return FAIL: fi: B3pp:= ComposeBij(B3p,B3): B4:=SubtBij( ComposeBij(B3pp,B2p), IdBij(Fn(-5))): return B4: elif n=2 or n = 3 then B1:=MultBij(IdBij([seq(i,i=1..s)]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=AddBij(phi9to11rec(s,n-1),phi9to11rec(s,n-2)): B2:=ComposeBij(B1pp,B1p): if s = F3e then B2p:= InvBij(AddBij( AddBij(AddBij(FibDef(n+4),FibDef(n+1)),FibDef(n-2)),FibDef(n-4))): elif s = F3f then B2p:= InvBij(AddBij( AddBij(AddBij(FibDef(n+4),FibDef(n+2)),FibDef(n-2)),FibDef(n-4))): elif s = F3g then B2p:= InvBij(AddBij(AddBij(AddBij(AddBij( FibDef(n+4),FibDef(n+2)),FibDef(n)),FibDef(n-2)),FibDef(n-4))): else print(`this part not written yet!`): return FAIL: fi: B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): return B4: fi: # cases n >= 4. B1:= MultBij(IdBij([seq(i,i=1..s)]),FibDef(n)): B2:= AddBij(phi9to11rec(s,n-1),phi9to11rec(s,n-2)): if s = F3e then B3:= InvBij( AddBij(AddBij(AddBij(FibDef(n+4),FibDef(n+1)),FibDef(n-2)),FibDef(n-4)) ): elif s = F3f then B3:= InvBij( AddBij(AddBij(AddBij(FibDef(n+4),FibDef(n+2)),FibDef(n-2)),FibDef(n-4)) ): elif s = F3g then B3:= InvBij(AddBij(AddBij(AddBij(AddBij( FibDef(n+4),FibDef(n+2)),FibDef(n)),FibDef(n-2)),FibDef(n-4)) ): else print(`this part not written yet!`): return FAIL: fi: B4:= ComposeBij(B3,ComposeBij(B2,B1)): B4: end: #----------- phi12rec ------------------------------------ #-- Bijection for 12f_n = f_{n+5} + f_{n-1} + f_{n-3} + f_{n-6} #-- matches phi12 from ZeckFibBijections # phi12rec(n): this returns the general bijection for 3h, allowing numbers down # to the base cases of -1 and 0 for n. phi12rec:=proc(n) local B1,B1p,B1pp,B2,B2p,B3,B3p,B3pp,B4,i: #Base case 1, for 3h, setting n= -1. # Formula: 0 = 2 + 1 - 3 if n = -1 then B1:= table([ [-2, -2, -2, -1] = [1, 1, 2], [-2, -2, -1, -2] = [-2, -1, -1], [-2, -2, -1, -1, -1] = [-2, -2], [-2, -1, -2, -2] = [-2], [-2, -1, -2, -1, -1] = [1, 2, 1], [-2, -1, -1, -2, -1] = [1, 1, 1, 1], [-2, -1, -1, -1, -2] = [2, 2], [-2, -1, -1, -1, -1, -1] = [2, 1, 1] ]): return B1: elif n=0 then B1:= table( [ [1, []] = [1, 1, 1, 1, 1], [2, []] = [1, 1, 1, 2], [3, []] = [1, 1, 2, 1], [4, []] = [1, 2, 1, 1], [5, []] = [2, 1, 1, 1], [6, []] = [1, 2, 2], [7, []] = [2, 1, 2], [8, []] = [2, 2, 1], [9, []] = [-2, -2, -2], [10, []] = [-2, -2, -1, -1], [11, []] = [-2, -1, -2, -1], [12, []] = [-2, -1, -1, -2], [-2, -1] =[-2, -1, -1, -1, -1] ]): return B1: elif n=1 then B1:=MultBij(IdBij([seq(i,i=1..12)]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-7) union Fn(-3)),B1): B2:= AddBij(phi12rec(n-1),phi12rec(n-2)): B2p:= ComposeBij(B2,B1p): B3:= AddBij(IdBij(Fn(-5)),B2p): B3p:= InvBij(SumBij( [FibDef(n+5),FibDef(n-1),FibDef(n-3),FibDef(n-6)])): B3pp:=ComposeBij(B3p,B3): B4:=SubtBij(B3pp,IdBij(Fn(-3) union Fn(-7))): return B4: elif n=2 then B1:=MultBij(IdBij([seq(i,i=1..12)]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3) union Fn(-5)),B1): B1pp:=AddBij(phi12rec(n-1),phi12rec(n-2)): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(SumBij([FibDef(n+5),FibDef(n-1),FibDef(n-3),FibDef(n-6)])): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3) union Fn(-5))): return B4: elif n=3 then B1:=MultBij(IdBij([seq(i,i=1..12)]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3) union Fn(-5)),B1): B1pp:=SumBij([phi12rec(n-1),phi12rec(n-2),IdBij(Fn(-3))]): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(SumBij([FibDef(n+5),FibDef(n-1),FibDef(n-3),FibDef(n-6)])): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-5))): return B4: elif n=4 or n=5 then B1:=MultBij(IdBij([seq(i,i=1..12)]),FibDef(n)): B1p:=AddBij(IdBij(Fn(-3)),B1): B1pp:=SumBij([phi12rec(n-1),phi12rec(n-2)]): B2:=ComposeBij(B1pp,B1p): B2p:= InvBij(SumBij([FibDef(n+5),FibDef(n-1),FibDef(n-3),FibDef(n-6)])): B3:= ComposeBij(B2p,B2): B4:=SubtBij(B3,IdBij(Fn(-3))): return B4: fi: # cases n >= 6. B1:= MultBij(IdBij([seq(i,i=1..12)]),FibDef(n)): B2:= AddBij(phi12rec(n-1),phi12rec(n-2)): B3:= InvBij(SumBij([FibDef(n+5),FibDef(n-1),FibDef(n-3),FibDef(n-6)])): B4:= ComposeBij(B3,ComposeBij(B2,B1)): B4: end: ## CONVERTING BIJECTIONS FROM ZeckFibBijections from functions to ## tables. # This is so we can compare the bijections defined directly in # ZeckFibBijections with those generated in the current file # (TransMethod_Zeck) # phi5direct(n): generates a table representing the bijection phi5 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi5direct:=proc(n) local B, Domain, P: Domain:=MtimesF(5,n): B:=table(): if n<3 then print(`phi5direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi5(n,P): od: return B: end: # phi6direct(n): generates a table representing the bijection phi6 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi6direct:=proc(n) local B, Domain, P: Domain:=MtimesF(6,n): B:=table(): if n<3 then print(`phi6direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi6(n,P): od: return B: end: # phi7direct(n): generates a table representing the bijection phi7 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi7direct:=proc(n) local B, Domain, P: Domain:=MtimesF(7,n): B:=table(): if n<3 then print(`phi7direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi7(n,P): od: return B: end: # phi8direct(n): generates a table representing the bijection phi8 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi8direct:=proc(n) local B, Domain, P: Domain:=MtimesF(8,n): B:=table(): if n<3 then print(`phi8direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi8(n,P): od: return B: end: # phi9direct(n): generates a table representing the bijection phi9 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi9direct:=proc(n) local B, Domain, P: Domain:=MtimesF(9,n): B:=table(): if n<3 then print(`phi9direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi9(n,P): od: return B: end: # phi10direct(n): generates a table representing the bijection phi10 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi10direct:=proc(n) local B, Domain, P: Domain:=MtimesF(10,n): B:=table(): if n<3 then print(`phi10direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi10(n,P): od: return B: end: # phi11direct(n): generates a table representing the bijection phi11 in # ZeckFibBijections (note bijections from the translation method are stored as # tables). phi11direct:=proc(n) local B, Domain, P: Domain:=MtimesF(11,n): B:=table(): if n<3 then print(`phi11direct(n): only works for n>=3`): return FAIL: fi: for P in Domain do B[P]:= phi11(n,P): od: return B: end: # phi12direct(n): generates a table representing the bijection phi12new which # is *not* the same as the bijection phi12 implemented in # ZeckFibBijections. In particular the bijection here is NOT the same as the # one described in the paper "Bijective proofs for Fibonacci identities # related to Zeckendorf's Theorem" by Philip Matchett Wood. # Recall that there are 8! bijections for the 12th Zeckendorf Family Identity # that are _not_ formally equivalent, and phi12 and phi12new happen to be two # of those. Though distinct in the sense of formal equivalence, the two # directly definied bijections phi12 and phi12new are structurally similar. # # ALSO, note that phi12direct (which is the table defined by phi12new) *does* # match the recursively defined bijection phi12rec, thus showing that phi12rec # can be defined in a direct, non-recursive way. # phi12direct:=proc(n) local B, Domain, P: Domain:=MtimesF(12,n): B:=table(): if n<5 then print(`phi12direct(n): only works for n>=5`): return FAIL: fi: for P in Domain do B[P]:= phi12new(n,P): od: return B: end: ####################### phi12new -------------------------- # this bijection is similar to phi12 from ZeckFibBijections; however phi12 # does *not* match the recursively constructed bijection phi12rec above. # phi12new (below) *does* match with phi12rec. The reason for this # discrepancy is that there are 8!=40320 distinct and equally valid ways to # construct the recursive bijection, and phi12 and phi12rec happen to be # derived form different choices. phi12new:=proc(n,P) local i,X: i:=P[1]: X:=P[2]: if not n= convert(X,`+`) then return FAIL: fi: if i=1 then return [1,1,1,1,1,op(X)]: elif i=2 then return [1,1,1,2,op(X)]: elif i=3 then return [1,1,2,1,op(X)]: elif i=4 then return [1,2,1,1,op(X)]: elif i=5 then return [2,1,1,1,op(X)]: elif i=6 then return [1,2,2,op(X)]: elif i=7 then return [2,1,2,op(X)]: elif i=8 then return [2,2,1,op(X)]: elif i=9 then if [op(1..1,X)]=[1] then return [1,1,2,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [2,1,1,2,2,op(3..nops(X),X)]: elif [op(1..3,X)]=[2,2,1] then return [2,2,op(4..nops(X),X)]: elif [op(1..3,X)]=[2,2,2] then return [op(4..nops(X),X)]: else return FAIL: fi: elif i=10 then if [op(1..2,X)]=[1,1] then return [2,2,2,1,op(3..nops(X),X)]: elif [op(1..2,X)]=[1,2] then return [op(3..nops(X),X)]: elif [op(1..1,X)]=[2] then return [2,1,1,2,1,op(2..nops(X),X)]: else return FAIL: fi: elif i=11 then if [op(1..1,X)]=[1] then return [1,2,1,2,op(2..nops(X),X)]: elif [op(1..1,X)]=[2] then return [1,op(2..nops(X),X)]: else return FAIL: fi: elif i=12 then if [op(1..1,X)]=[1] then return [1,1,1,1,2,op(2..nops(X),X)]: elif [op(1..2,X)]=[2,1] then return [2,2,2,2,op(3..nops(X),X)]: elif [op(1..2,X)]=[2,2] then return [2,1,op(3..nops(X),X)]: else return FAIL: fi: else return FAIL: fi: end: ############################################################################### ########## Help function defined below # ###################################### Help:=proc() if args=NULL then print(` ZeckFibBijections: A Maple package implementing the`): print(`the Zeckendorf Family Bijections described in `): print(`A translation method for finding combinatorial bijections`): print(`by Philip Matchett Wood and Doron Zeilberger.`): print(`The MAIN procedures are`): print(`phi5rec, phi6rec, ..., phi12rec,`): print(`phi5direct, phi6direct, ..., phi12direct,`): print(`###############################################`): print(`#### ALSO INCLUDED (from Bijtools): ######`): print(`IndicesSeq,EntriesSeq,MultSet,IdBij,BuildBij,InvBij,ComposeBij,MultBij`): print(`AddBij,SumBij,SubtBij,BijOut,BijEqual,IsBij,SplitProdBij,SwitchProdBij`): print(`###############################################`): print(`##### ALSO INCLUDED (from Fibonacci): ######`): print(`Fn, FibDef, FibLex, ZeckSort`): print(`###############################################`): print(`### ALSO INCLUDED (from ZeckFibBijections) ###:`): print(`F,MtimesF,phi5,phi6,...,phi12,Chechphi5,Checkphi6,...,Checkphi12,`): print(`phi5inv, Chechphi5phi5inv, Checkphi5invphi5, phi5prime, Checkphi5prime`): print(): print(`For help with a specific procedure, type Help(Procedure);`): print(`For example, for help with phi5rec, type: Help(phi5rec);`): elif nargs=1 and args[1]=phi5rec then print(`phi5rec(n): for each n >= -1, phi5rec(n) is a bijection for the`): print(`5th Zeckendorf Family Identity: 5f_n = f_{n+3} + f_{n-1} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi5rec,-1,3,ZeckSort);`): print(`phi5rec is constructed by recursion, and it is identical to`): print(`phi5direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi5rec(4),phi5direct(4));`): elif nargs=1 and args[1]=phi6rec then print(`phi6rec(n): for each n >= -1, phi6rec(n) is a bijection for the`): print(`6th Zeckendorf Family Identity: 6f_n = f_{n+3} + f_{n+1} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi6rec,-1,3,ZeckSort);`): print(`phi6rec is constructed by recursion, and it is identical to`): print(`phi6direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi6rec(4),phi6direct(4));`): elif nargs=1 and args[1]=phi7rec then print(`phi7rec(n): for each n >= -1, phi7rec(n) is a bijection for the`): print(`7th Zeckendorf Family Identity: 7f_n = f_{n+4} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi7rec,-1,3,ZeckSort);`): print(`phi7rec is constructed by recursion, and it is identical to`): print(`phi7direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi7rec(4),phi7direct(4));`): elif nargs=1 and args[1]=phi8rec then print(`phi8rec(n): for each n >= -1, phi8rec(n) is a bijection for the`): print(`8th Zeckendorf Family Identity: 8f_n = f_{n+4} + f_{n} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi8rec,-1,3,ZeckSort);`): print(`phi8rec is constructed by recursion, and it is identical to`): print(`phi8direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi8rec(4),phi8direct(4));`): elif nargs=1 and args[1]=phi9rec then print(`phi9rec(n): for each n >= -1, phi9rec(n) is a bijection for the`): print(`9th Zeckendorf Family Identity:`): print(`9f_n = f_{n+4} + f_{n+1} + f_{n-2} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi9rec,-1,3,ZeckSort);`): print(`phi9rec is constructed by recursion, and it is identical to`): print(`phi9direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi9rec(4),phi9direct(4));`): elif nargs=1 and args[1]=phi10rec then print(`phi10rec(n): for each n >= -1, phi10rec(n) is a bijection for the`): print(`10th Zeckendorf Family Identity:`): print(`10f_n = f_{n+4} + f_{n+2} + f_{n-2} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi10rec,-1,3,ZeckSort);`): print(`phi10rec is constructed by recursion, and it is identical to`): print(`phi10direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi10rec(4),phi10direct(4));`): elif nargs=1 and args[1]=phi11rec then print(`phi11rec(n): for each n >= -1, phi11rec(n) is a bijection for the`): print(`11th Zeckendorf Family Identity:`): print(`11f_n = f_{n+4} + f_{n+2} + f_n + f_{n-2} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi11rec,-1,3,ZeckSort);`): print(`phi11rec is constructed by recursion, and it is identical to`): print(`phi11direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi11rec(4),phi11direct(4));`): elif nargs=1 and args[1]=phi12rec then print(`phi12rec(n): for each n >= -1, phi12rec(n) is a bijection for the`): print(`12th Zeckendorf Family Identity:`): print(`12f_n = f_{n+5} + f_{n-1} + f_{n-3} + f_{n-6}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi12rec,-1,3,ZeckSort);`): print(`phi12rec is constructed by recursion, and it is identical to`): print(`phi12direct, which is directly defined (and non-recursive).`): print(`To check that the two bijections (i.e. tables in Maple) are equal, try`): print(`BijEqual(phi12rec(6),phi12direct(6));`): elif nargs=1 and args[1]=phi5direct then print(`phi5direct(n): for each n >= 4, phi5direct(n) is a bijection for the`): print(`5th Zeckendorf Family Identity: 5f_n = f_{n+3} + f_{n-1} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi5direct,4,4,ZeckSort);`): print(`phi5direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi5direct is the same as phi5rec, try`): print(`BijEqual(phi5direct(4),phi5rec(4));`): elif nargs=1 and args[1]=phi6direct then print(`phi6direct(n): for each n >= 4, phi6direct(n) is a bijection for the`): print(`6th Zeckendorf Family Identity: 6f_n = f_{n+3} + f_{n+1} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi6direct,4,4,ZeckSort);`): print(`phi6direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi6direct is the same as phi6rec, try`): print(`BijEqual(phi6direct(4),phi6rec(4));`): elif nargs=1 and args[1]=phi7direct then print(`phi7direct(n): for each n >= 4, phi7direct(n) is a bijection for the`): print(`7th Zeckendorf Family Identity: 7f_n = f_{n+4} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi7direct,4,4,ZeckSort);`): print(`phi7direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi7direct is the same as phi7rec, try`): print(`BijEqual(phi7direct(4),phi7rec(4));`): elif nargs=1 and args[1]=phi8direct then print(`phi8direct(n): for each n >= 4, phi8direct(n) is a bijection for the`): print(`8th Zeckendorf Family Identity: 8f_n = f_{n+4} + f_{n} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi8direct,4,4,ZeckSort);`): print(`phi8direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi8direct is the same as phi8rec, try`): print(`BijEqual(phi8direct(4),phi8rec(4));`): elif nargs=1 and args[1]=phi9direct then print(`phi9direct(n): for each n >= 4, phi9direct(n) is a bijection for the`): print(`9th Zeckendorf Family Identity:`): print(`9f_n = f_{n+4} + f_{n+1} + f_{n-2} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi9direct,4,4,ZeckSort);`): print(`phi9direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi9direct is the same as phi9rec, try`): print(`BijEqual(phi9direct(4),phi9rec(4));`): elif nargs=1 and args[1]=phi10direct then print(`phi10direct(n): for each n >= 4, phi10direct(n) is a bijection for the`): print(`10th Zeckendorf Family Identity:`): print(`10f_n = f_{n+4} + f_{n+2} + f_{n-2} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi10direct,4,4,ZeckSort);`): print(`phi10direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi10direct is the same as phi10rec, try`): print(`BijEqual(phi10direct(4),phi10rec(4));`): elif nargs=1 and args[1]=phi11direct then print(`phi11direct(n): for each n >= 4, phi11direct(n) is a bijection for the`): print(`11th Zeckendorf Family Identity:`): print(`11f_n = f_{n+4} + f_{n+2} + f_n + f_{n-2} + f_{n-4}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi11direct,4,4,ZeckSort);`): print(`phi11direct defined in a direct, non-recursive way, and is identical to`): print(`the corresponding bijection defined in the file ZeckFibBijections,`): print(`which accompanies the paper:`): print(`Bijective proofs for Fibonacci identities related to Zeckendorf's Theorem`): print(`by Philip Matchett Wood.`): print(`To check that the phi11direct is the same as phi11rec, try`): print(`BijEqual(phi11direct(4),phi11rec(4));`): elif nargs=1 and args[1]=phi12direct then print(`phi12direct(n): for each n >= 6, phi12direct(n) is a bijection for the`): print(`12th Zeckendorf Family Identity:`): print(`12f_n = f_{n+5} + f_{n-1} + f_{n-3} + f_{n-6}.`): print(`The bijection is stored as a table in Maple. To see the table, try`): print(`BijOut(phi12direct,4,4,ZeckSort);`): print(`phi12direct defined in a direct, non-recursive way in this file.`): print(`NOTE: in this one exception phi12direct is *not* the same bijection as`): print(`the corresponding bijection defined in the file ZeckFibBijections.`): print(`The reason for this discrepancy is that there are 8!=40320 distinct`): print(` and equally valid ways to construct the recursive bijection,`): print(`and phi12rec the bijection in ZeckFibBijections happen to be`): print(`derived from different choices.`): print(`However, phi12rec *is* the same as phi12direct, defined in this file.`): print(`To check that the phi12direct is the same as phi12rec, try`): print(`BijEqual(phi12direct(4),phi12rec(4));`): #########--INCLUDED FROM BijTools-----------------############################# elif nargs=1 and args[1]=IndicesSeq then print(`IndicesSeq(B): outputs the domain of a bijection B as a sequence`): print(`Note that a bijection is simply a table in Maple.`): elif nargs=1 and args[1]=EntriesSeq then print(`EntriesSeq(B): outputs the range of a bijection B as a sequence`): print(`Note that a bijection is simply a table in Maple.`): elif nargs=1 and args[1]=MultSet then print(`MultSet(S1,S2): given two set S1 and S2, returns the Cartesian product`): print(`$ S1 \\cross S2 $. For example, try typing S1:={1,2}; S2:={a,b}; `): print(`followed by S1xS2:=MultSet(S1,S2);`): elif nargs=1 and args[1]=IdBij then print(`IdBij(S): given a set S, returns the bijection sending x |-> x`): print(` for every x in S`): print(`For example, try B:= IdBij({1,2,3}):`): print(`Note that a bijection is just a table, so to see how B is defined`): print(`try typing op(B): or B[2]:`): elif nargs=1 and args[1]=BuildBij then print(`BuildBij(L1,L2): given two lists L1 and L2, returns a bijection`): print(`sending the k-th element of L1 to teh k-th element of L2.`): print(`For example, try B:=BuildBij([a,b,c], [1,2,3]):`): print(`Note that a bijection is just a table, so to see how B is defined`): print(`try typing op(B): or B[c]:`): elif nargs=1 and args[1]=InvBij then print(`InvBij(B): given a bijection B returns the inverse bijection.`): print(`For example, try B:=BuildBij([a,b,c], [1,2,3]): followed by`): print(`Binv:=InvBij(B):`): print(`Note that a bijection is just a table, so to see how Binv is defined`): print(`try typing op(Binv): or Binv[2]:`): elif nargs=1 and args[1]=ComposeBij then print(`ComposeBij(B1,B2): given two bijections B1 and B2, this function`): print(`checks that the range of B2 equals the domain of B1 and then`): print(`returns the bijection B1 applied to B2.`): print(`For example, try B1:=BuildBij([1,2,3], [a,b,c]): followed by`): print(`B2:=BuildBij([a,b,c],[101,102,103]): followed by`): print(`B1ofB2:= ComposeBij(B1,B2):`): print(`Note that a bijection is just a table, so to see how B1ofB2 is defined`): print(`try typing op(B1ofB2): or B1ofB2[2]:`): elif nargs=1 and args[1]=MultBij then print(`MultBij(B1,B2): given two bijections B1: S1->T1 and B2: S2->T2,`): print(`this function returns the natural bijection F: S1 x S2 -> T1 x T2`): print(`where x denotes Cartesian product.`): print(`For example, try B1:=BuildBij([1,2,3], [a,b,c]): followed by`): print(`B2:=BuildBij([w,y,z],[23,25,26]): followed by`): print(`B1xB2:= MultBij(B1,B2):`): print(`Note that a bijection is just a table, so to see how B1xB2 is defined`): print(`try typing op(B1xB2): or B1xB2[[2,t]]:`): elif nargs=1 and args[1]=AddBij then print(`AddBij(B1,B2): given two bijections B1: S1->T1 and B2: S2->T2,`): print(`this function returns the natural bijection F: S1 union S2 -> T1 union T2`): print(`where union denotes disjoint union. If S1 intersects S2 or`): print(`T1 intersects T2, the function returns FAIL`): print(`For example, try B1:=BuildBij([1,2,3], [a,b,c]): followed by`): print(`B2:=BuildBij([w,y,z],[23,25,26]): followed by`): print(`B1uB2:= AddBij(B1,B2):`): print(`Note that a bijection is just a table, so to see how B1uB2 is defined`): print(`try typing op(B1uB2); or B1uB2[2]; or B1uB2[z]; `): elif nargs=1 and args[1]=SumBij then print(`SumBij(L): Given a list of bijections L, successively applies the`): print(`function AddBij. For example, if B1, B2, and B3 are bijections,`): print(`then SumBij([B1,B2,B3]); returns AddBij(AddBij(B3,B2),B1).`): elif nargs=1 and args[1]=SubtBij then print(`SubtBij(B1,B2): given two bijections B1 and B2, this function`): print(`uses combinatorial inversion to find the bijection B1-B2.`): print(`here $B1: A \to B$ and $B2: C \to D$ where`): print(`$C \subset A$ and $D \subset B$, and so SubtBij returns the`): print(`bijection sending $A\setminus C \to B\setminus D$ given by `): print(`the "alternating pairs algorithm".`): elif nargs=1 and args[1]=BijOut then print(`BijOut(B,a,b,AnOrder): A general output function for bijecions that`): print(`depend on a single parameter. Outputs the bijection for n=a to n=b.`): print(`AnOrder is a total order relation defined on the domain of the bijection.`): print(`For example, type Help(phi5rec) and follow the instuructions`): print(`after typing read TransMethodZeck: `): elif nargs=1 and args[1]=BijEqual then print(`BijEqual(B1,B2): given two bijections B1 and B2, returns `): print(`true if the bijections are the same and false otherwise.`): elif nargs=1 and args[1]=IsBij then print(`IsBij(B,Domain,Range): given a bijection B and two sets Domain and Range`): print(`this function returns true if B is a bijection from Domain to Range`): print(`and returns false otherwise`): elif nargs=1 and args[1]=SplitProdBij then print(`SplitProdBij(B1xB2): separates the two component bijections B1 and B2`): print(`of a bijection that is the product of B1 and B2.`): print(`NOTE: this function checks to make sure that B1xB2 is indeed`): print(`a product bijection to start with.`): elif nargs=1 and args[1]=SwitchProdBij then print(`SwitchProdBij(B1xB2): given a product bijection,`): print(`say B1:A --> B and B2:C-->D, returns the corresponding bijection`): print(`from A x C to D x B`): print(`NOTICE the switch: the range of the returned bijection is _not_ B x D.`): ###### END INCLUDED FROM BijTOols-----------------############################# #########--INCLUDED FROM Fibonacci----------------############################# elif nargs=1 and args[1]=Fn then print(`Fn(n): given an integer n (possibly negative), returns a set that is`): print(`an interpretation for the n-th Fibonacci number.`): print(`For example, Fn(3): returns the set`): print(`{ [1,1,1], [1,2], [2,1] }`): elif nargs=1 and args[1]=FibDef then print(`FibDef(n): returns the defining bijection for the Fibonacci numbers`): print(`as defined in the paper `): print(`A translation method for finding combinatorial bijections`): print(`by Philip Matchett Wood and Doron Zeilberger.`): print(`For example, try B:= FibDef(3): and the op(B): `): elif nargs=1 and args[1]=FibLex then print(`FibLex(A,B): given two lists A and B, each consisting only of 1's and 2's`): print(`this function returns true if`): print(`(1) the sum of elements in A is smaller than the sum of elements in B, or`): print(`(2) the two sums are equal and A preceeds B lexicographically.`): print(`Otherwise FibLex returns false.`): print(`For example, try FibLex([1,1,1],[2,1]); or FibLex([2],[1,1,1]); `) elif nargs=1 and args[1]=ZeckSort then print(`ZeckSort(A,B): Gives a total order on elements in {1,2,...,k} X F_n`): print(`to make the output of the bijection nice when calling`): print(`BijOut(phi5rec,3,5,ZeckSort);`): print(`First it sorts by the first argument (which is an int from 1 to k),`): print(`then it uses FibLex on the second argument.`): ###### END INCLUDED FROM Fibonacci----------------############################# #########--INCLUDED FROM ZeckFibBijections--------############################# elif nargs=1 and args[1]=Checkphi5 then print(`Checkphi5(k): For an integer k, checks that`): print(` phi5 is a bijection from MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi5 gives a bijective proof of the identity`): print(`$5f_n= f_{n+3} + f_{n-1} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi5(10);`): elif nargs=1 and args[1]=Checkphi5prime then print(`Checkphi5prime(k): For an integer k, checks that`): print(` phi5prime is a bijection from MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi5prime gives an alternate bijective proof of the identity`): print(`$5f_n= f_{n+3} + f_{n-1} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi5prime(10);`): elif nargs=1 and args[1]=Checkphi6 then print(`Checkphi6(k): For an integer k, checks that`): print(` phi6 is a bijection from MtimesF(6,n) to F(n+3) union F(n+1) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi6 gives a bijective proof of the identity`): print(`$6f_n= f_{n+3} + f_{n+1} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi6(10);`): elif nargs=1 and args[1]=Checkphi7 then print(`Checkphi7(k): For an integer k, checks that`): print(` phi7 is a bijection from MtimesF(7,n) to F(n+4) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi7 gives a bijective proof of the identity`): print(`$7f_n= f_{n+4} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi7(10);`): elif nargs=1 and args[1]=Checkphi8 then print(`Checkphi8(k): For an integer k, checks that`): print(` phi8 is a bijection from MtimesF(8,n) to F(n+4) union F(n) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi8 gives a bijective proof of the identity`): print(`$8f_n= f_{n+4} + f_n + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi8(10);`): elif nargs=1 and args[1]=Checkphi9 then print(`Checkphi9(k): For an integer k, checks that`): print(` phi9 is a bijection from MtimesF(9,n) to F(n+4) union F(n+1) union F(n-2) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi9 gives a bijective proof of the identity`): print(`$9f_n= f_{n+4} + f_{n+1} + f_{n-2} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi9(10);`): elif nargs=1 and args[1]=Checkphi10 then print(`Checkphi10(k): For an integer k, checks that`): print(` phi10 is a bijection from MtimesF(10,n) to F(n+4) union F(n+2) union F(n-2) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi10 gives a bijective proof of the identity`): print(`$9f_n= f_{n+4} + f_{n+2} + f_{n-2} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi10(10);`): elif nargs=1 and args[1]=Checkphi11 then print(`Checkphi11(k): For an integer k, checks that`): print(` phi11 is a bijection from MtimesF(11,n) to F(n+4) union F(n+2) union F(n) union F(n-2) union F(n-4),`): print(`for n = 4,5,6,...,k.`): print(`Thus phi11 gives a bijective proof of the identity`): print(`$9f_n= f_{n+4} + f_{n+2} + f_n + f_{n-2} + f_{n-4}$`): print(`for n = 4,5,6,...,k.`): print(`For example, try: Checkphi11(10);`): elif nargs=1 and args[1]=Checkphi12 then print(`Checkphi12(k): For an integer k, checks that`): print(` phi12 is a bijection from MtimesF(12,n) to F(n+5) union F(n-1) union F(n-3) union F(n-6),`): print(`for n = 6,7,8...,k.`): print(`Thus phi12 gives a bijective proof of the identity`): print(`$9f_n= f_{n+5} + f_{n-1} + f_{n-3} + f_{n-6}$`): print(`for n = 6,7,8,...,k.`): print(`For example, try: Checkphi12(13);`): elif nargs=1 and args[1]=phi5 then print(`phi5(n,X): For an integer n > 3, phi5 is a mapping from `): print(`MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4)`): print(`For example, try: phi5(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi5prime then print(`phi5prime(n,X): For an integer n > 3, phi5prime is a mapping from `): print(`MtimesF(5,n) to F(n+3) union F(n-1) union F(n-4)`): print(`For example, try: phi5prime(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi5inv then print(`phi5inv(n,Y): For an integer n > 3, phi5inv is a mapping from `): print(`F(n+3) union F(n-1) union F(n-4) to MtimesF(5,n)`): print(`For example, try: phi5inv(4,[2,1,2,1,1]]);`): elif nargs=1 and args[1]=phi6 then print(` phi6 is a bijection from MtimesF(6,n) to F(n+3) union F(n+1) union F(n-4),`): print(`For example, try: phi6(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi7 then print(` phi7 is a bijection from MtimesF(7,n) to F(n+4) union F(n-4),`): print(`For example, try: phi7(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi8 then print(` phi8 is a bijection from MtimesF(8,n) to F(n+4) union F(n) union F(n-4),`): print(`For example, try: phi8(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi9 then print(` phi9 is a bijection from MtimesF(9,n) to F(n+4) union F(n+1) union F(n-2) union F(n-4),`): print(`For example, try: phi9(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi10 then print(` phi10 is a bijection from MtimesF(10,n) to F(n+4) union F(n+2) union F(n-2) union F(n-4),`): print(`For example, try: phi10(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi11 then print(` phi11 is a bijection from MtimesF(11,n) to F(n+4) union F(n+2) union F(n) union F(n-2) union F(n-4),`): print(`For example, try: phi11(4,[2,[2,1,1]]);`): elif nargs=1 and args[1]=phi12 then print(` phi12 is a bijection from MtimesF(12,n) to F(n+5) union F(n-1) union F(n-3) union F(n-6),`): print(`For example, try: phi12(6,[2,[2,2,1,1]]);`): elif nargs=1 and args[1]=Checkphi5phi5inv then print(`Checkphi5phi5inv(n): For an integer n > 3, checks that`): print(` phi5 composed with phi5inv is the identity mapping `): print(`For example, try: Checkphi5phi5inv(7);`): elif nargs=1 and args[1]=Checkphi5invphi5 then print(`Checkphi5invphi5(n): For an integer n > 3, checks that`): print(` phi5inv composed with phi5 is the identity mapping `): print(`For example, try: Checkphi5invphi5(7);`): elif nargs=1 and args[1]=MtimesF then print(`MtimesF(m,n): For integers m>=0 and n>=0, returns the set`): print(`$\\{1,2,...,m\\} \\times F(n)$`): print(`The cardinality of MtimesF(m,n) is equal to`): print(`m times the n-th Fibonacci number.`): print(`For example, try: MtimesF(2,3);`): elif nargs=1 and args[1]=F then print(`F(n): For an integer n >= 0, returns the set of `): print(`ordered lists of 1's and 2's, each of which sums to n`): print(`The cardinality of F(n) is the n-th Fibonacci number.`): print(`For example, try: F(3);`): ###### END INCLUDED FROM ZeckFibBijections--------############################# else print(`There is no such thing as`, args): fi: end: #EOF