/usr/share/axiom-20170501/src/algebra/TABLBUMP.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | )abbrev package TABLBUMP TableauxBumpers
++ Author: William H. Burge
++ Date Created: 1987
++ Date Last Updated: 23 Sept 1991
++ Description:
++ TableauBumpers implements the Schenstead-Knuth
++ correspondence between sequences and pairs of Young tableaux.
++ The 2 Young tableaux are represented as a single tableau with
++ pairs as components.
TableauxBumpers(S) : SIG == CODE where
S : OrderedSet
L==>List
ST==>Stream
B==>Boolean
ROW==>Record(fs:B,sd:L S,td:L L S)
RC==>Record(f1:L S,f2:L L L S,f3:L L S,f4:L L L S)
PAIR==>L S
SIG ==> with
bumprow : ((S,S)->B,PAIR,L PAIR)->ROW
++ bumprow(cf,pr,r) is an auxiliary function which
++ bumps a row r with a pair pr
++ using comparison function cf, and returns a record
bumptab : ((S,S)->B,PAIR,L L PAIR)->L L PAIR
++ bumptab(cf,pr,t) bumps a tableau t with a pair pr
++ using comparison function cf, returning a new tableau
bumptab1 : (PAIR,L L PAIR)->L L PAIR
++ bumptab1(pr,t) bumps a tableau t with a pair pr
++ using comparison function \spadfun{<},
++ returning a new tableau
untab : (L PAIR,L L PAIR)->L PAIR
++ untab(lp,llp) is an auxiliary function
++ which unbumps a tableau llp,
++ using lp to accumulate pairs
bat1 : L L PAIR->L PAIR
++ bat1(llp) unbumps a tableau llp.
++ Operation bat1 is the inverse of tab1.
bat : Tableau(L S)->L L S
++ bat(ls) unbumps a tableau ls
tab1 : L PAIR->L L PAIR
++ tab1(lp) creates a tableau from a list of pairs lp
tab : L S->Tableau(L S)
++ tab(ls) creates a tableau from ls by first creating
++ a list of pairs using slex,
++ then creating a tableau using tab1.
lex : L PAIR->L PAIR
++ lex(ls) sorts a list of pairs to lexicographic order
slex : L S->L PAIR
++ slex(ls) sorts the argument sequence ls, then zips (see map) the
++ original argument sequence with the sorted result to
++ a list of pairs
inverse : L S->L S
++ inverse(ls) forms the inverse of a sequence ls
maxrow : (PAIR,L L PAIR,L PAIR,L L PAIR,L L PAIR,L L PAIR)->RC
++ maxrow(a,b,c,d,e) is an auxiliary function for mr
mr : L L PAIR->RC
++ mr(t) is an auxiliary function which
++ finds the position of the maximum element of a tableau t
++ which is in the lowest row, producing a record of results
CODE ==> add
cf:(S,S)->B
bumprow(cf,x:(PAIR),lls:(L PAIR))==
if null lls
then [false,x,[x]]$ROW
else (y:(PAIR):=first lls;
if cf(x.2,y.2)
then [true,[x.1,y.2],cons([y.1,x.2],rest lls)]$ROW
else (rw:ROW:=bumprow(cf,x,rest lls);
[rw.fs,rw.sd,cons(first lls,rw.td)]$ROW ))
bumptab(cf,x:(PAIR),llls:(L L PAIR))==
if null llls
then [[x]]
else (rw:ROW:= bumprow(cf,x,first llls);
if rw.fs
then cons(rw.td, bumptab(cf,rw.sd,rest llls))
else cons(rw.td,rest llls))
bumptab1(x,llls)==bumptab((s1,s2) +-> s1<s2, x, llls)
rd==> reduce$StreamFunctions2(PAIR,L L PAIR)
tab1(lls:(L PAIR))== rd([],bumptab1,lls::(ST PAIR))
srt==>sort$(PAIR)
lexorder:(PAIR,PAIR)->B
lexorder(p1,p2)==if p1.1=p2.1 then p1.2<p2.2 else p1.1<p2.1
lex lp==(sort$(L PAIR))((s1,s2) +-> lexorder(s1,s2), lp)
slex ls==lex([[i,j] for i in srt((s1, s2) +-> s1<s2, ls) for j in ls])
inverse ls==[lss.2 for lss in
lex([[j,i] for i in srt((s1,s2) +-> s1<s2, ls)
for j in ls])]
tab(ls:(PAIR))==(tableau tab1 slex ls )
maxrow(n,a,b,c,d,llls)==
if null llls or null(first llls)
then [n,a,b,c]$RC
else (fst:=first first llls;rst:=rest first llls;
if fst.1>n.1
then maxrow(fst,d,rst,rest llls,cons(first llls,d),rest llls)
else maxrow(n,a,b,c,cons(first llls,d),rest llls))
mr llls==maxrow(first first llls,[],rest first llls,rest llls,
[],llls)
untab(lp, llls)==
if null llls
then lp
else (rc:RC:=mr llls;
rv:=reverse (bumptab((s1:S,s2:S):B +-> s2<s1, rc. f1, rc. f2));
untab(cons(first first rv,lp)
,append(rest rv,
if null rc.f3
then []
else cons(rc.f3,rc.f4))))
bat1 llls==untab([],[reverse lls for lls in llls])
bat tb==bat1(listOfLists tb)
|