deglex : (PI,PI) -> List(List(INT)) deglex(n,h) == lista : List(List(INT)) := [] for i in 0..n^h-1 repeat l : List(INT) := [1 for j in 1..h] q := i for j in h..1 by -1 repeat r := divide(q,n).remainder q := divide(q,n).quotient l(j) := r+1 if q = 0 then break lista := append(lista,[l]) lista n2deglex : (PI,PI,PI) -> List(INT) n2deglex(i,n,h) == if i > n^h then error("Numero troppo grande") l : List(INT) := [1 for j in 1..h] q := i-1 for j in h..1 by -1 repeat r := divide(q,n).remainder q := divide(q,n).quotient l(j) := r+1 if q = 0 then break l deglex2n : (List(INT),PI,PI) -> PI deglex2n(l,n,h) == if #l ~= h then error("La lista non ha la dimensione giusta") i := 0 for j in h..1 by -1 repeat c := l(j)-1 e : NNI := h-j i := i+c*n^e i := i+1 i degrevlex : (PI,PI) -> List(List(INT)) degrevlex(n,h) == lista : List(List(INT)) := [] for i in 0..n^h-1 repeat l : List(INT) := [1 for j in 1..h] q := i for j in 1..h repeat r := divide(q,n).remainder q := divide(q,n).quotient l(j) := r+1 if q = 0 then break lista := append(lista,[l]) lista n2degrevlex : (PI,PI,PI) -> List(INT) n2degrevlex(i,n,h) == if i > n^h then error("Numero troppo grande") l : List(INT) := [1 for j in 1..h] q := i-1 for j in 1..h repeat r := divide(q,n).remainder q := divide(q,n).quotient l(j) := r+1 if q = 0 then break l degrevlex2n : (List(INT),PI,PI) -> PI degrevlex2n(l,n,h) == if #l ~= h then error("La lista non ha la dimensione giusta") i := 0 for j in 1..h repeat c := l(j)-1 e : NNI := j-1 i := i+c*n^e i := i+1 i Sigma : (PI,PI,PI) -> INT Sigma(n,h,j) == l := (j-1)*(n^h) + 1 + (1-n^(h+1))* wholePart((j-1)/n) BasisChange : (NNI,NNI) -> Matrix(INT) BasisChange(n,h) == m : Matrix(INT) := new(n^(h+1),n^(h+1),0) for j in 1..n^(h+1) repeat i := Sigma(n,h,j) m(i,j) := 1 m MFPI ==> Matrix(FRAC(POLY(INT))) FPI ==> FRAC(POLY(INT)) cOk? : MFPI -> Boolean cOk?(c) == if ~( square? c ) then return(false) if ~( perfectSquare? (ncols c) ) then return(false) true bOk? : MFPI -> Boolean bOk?(b) == if ( ncols(b) ~= nrows(b)^2 ) then return(false) true bcOk? : (MFPI,MFPI) -> Boolean bcOk?(b,c) == if ~( cOk?(c) ) then return(false) if ~( bOk?(b) ) then return(false) if ( ncols(b) ~= nrows(c) ) then return(false) true BlockMatrix : (MFPI,NNI) -> MFPI BlockMatrix(m,n) == r := nrows m c := ncols m mat : MFPI := new(n*r,n*c,0) i : NNI i := 0 while i < n repeat setsubMatrix!(mat,1+i*r,1+i*c,m) i := i+1 mat B1 : MFPI -> MFPI B1(b) == if ~( bOk?(b) ) then (error("Wrong input")) BlockMatrix(b,nrows(b)) C1 : MFPI -> MFPI C1(c) == if ~( cOk? c ) then (error("Wrong input")) BlockMatrix(c,perfectSqrt (ncols c)) B2 : MFPI -> MFPI B2(b) == if ~( bOk?(b) ) then (error("Wrong input")) m1 : MFPI m1 := inverse BasisChange(nrows(b),1) m2 := BlockMatrix(b,nrows(b)) m3 := BasisChange(nrows(b),2) m1*m2*m3 C2 : MFPI -> MFPI C2(c) == if ~( cOk? c ) then (error("Wrong input")) m1 : MFPI m1 := inverse BasisChange(perfectSqrt (ncols c),2) m2 := BlockMatrix(c,perfectSqrt (ncols c)) m3 := BasisChange(perfectSqrt (ncols c),2) m1*m2*m3 YoungBaxter : MFPI -> MFPI YoungBaxter(c) == if ~( cOk? c ) then (error("Wrong input")) c1 := C1(c) c2 := C2(c) c1*c2*c1-c2*c1*c2 YoungBaxter? : MFPI -> Boolean YoungBaxter?(c) == n : NNI := perfectSqrt(ncols(c)) zero : MFPI := new(n^3,n^3,0) if ( YoungBaxter(c) = zero ) then return(true) false Hecke : (MFPI,FPI) -> MFPI Hecke(c,p) == if ~( cOk? c ) then (error("Wrong input")) uno : MFPI uno := diagonalMatrix([1 for i in 1..nrows c]) (c+uno)*(c-p*uno) Hecke? : (MFPI,FPI) -> Boolean Hecke?(c,p) == zero : MFPI zero := new((nrows c)^3,(nrows c)^3,0) if ( Hecke(c,p) = zero ) then return(true) false Naturality1 : (MFPI,MFPI) -> MFPI Naturality1(b,c) == if ~( bcOk?(b,c) ) then (error("Wrong input")) b1 := B1(b) b2 := B2(b) c1 := C1(c) c2 := C2(c) c*b1 - b2*c1*c2 Naturality1? : (MFPI,MFPI) -> Boolean Naturality1?(b,c) == zero : MFPI zero := new((nrows b)^2,(nrows b)^3,0) if ( Naturality1(b,c) = zero ) then return(true) false Naturality2 : (MFPI,MFPI) -> MFPI Naturality2(b,c) == if ~( bcOk?(b,c) ) then (error("Wrong input")) b1 := B1(b) b2 := B2(b) c1 := C1(c) c2 := C2(c) c*b2 - b1*c2*c1 Naturality2? : (MFPI,MFPI) -> Boolean Naturality2?(b,c) == zero : MFPI zero := new((nrows b)^2,(nrows b)^3,0) if ( Naturality2(b,c) = zero ) then return(true) false Antisymmetric : (MFPI,MFPI) -> MFPI Antisymmetric(b,c) == if ~( bcOk?(b,c) ) then (error("Wrong input")) b*c + b Antisymmetric? : (MFPI,MFPI) -> Boolean Antisymmetric?(b,c) == zero : MFPI := new(nrows b,(nrows b)^2,0) if Antisymmetric(b,c) = zero then return(true) false Jacobi : (MFPI,MFPI,FPI) -> MFPI Jacobi(b,c,p) == if ~( bcOk?(b,c) ) then (error("Wrong input")) uno : MFPI := diagonalMatrix([1 for i in 1..(nrows b)^3]) b1 := B1(b) c1 := C1(c) c2 := C2(c) b*b1*((p^2)*uno-p*c2+c2*c1) Jacobi? : (MFPI,MFPI,FPI) -> Boolean Jacobi?(b,c,p) == zero : MFPI := new(nrows b,(nrows b)^3,0) if Jacobi(b,c,p) = zero then return(true) false QuantumBinomial : (INT,INT) -> FPI QuantumBinomial(n,i) == binomiale : FPI if (n < 0) or (i > n) or (i < 0) then error("parametri sbagliati") if (i = 0) or (i = n) then return(1) rigavecchia : LIST(FPI) riganuova : LIST(FPI) rigavecchia := [1] for j in 1..n repeat riganuova := [1] k := 1 while k <= j-1 repeat binomiale := elt(rigavecchia,k)+q^(k)*elt(rigavecchia,k+1) riganuova := append(riganuova,[binomiale]) k := k+1 riganuova := append(riganuova,[1]) rigavecchia := riganuova binomiale := elt(rigavecchia,i+1) binomiale QuantumBinomial : (NNI,NNI) -> FPI QuantumBinomial(n,i) == binomiale : FPI if (n < 0) or (i > n) or (i < 0) then error("parametri sbagliati") if (i = 0) or (i = n) then return(1) if 2*i > n then i := n-i rigavecchia : LIST(FPI) riganuova : LIST(FPI) rigavecchia := [1] j := 1 while j <= i repeat riganuova := [1] k := 1 while k <= j-1 repeat binomiale := elt(rigavecchia,k)+q^(k)*elt(rigavecchia,k+1) riganuova := append(riganuova,[binomiale]) k := k+1 riganuova := append(riganuova,[1]) rigavecchia := riganuova j := j+1 while j <= n-i repeat riganuova := [1] k := 1 while k <= i repeat binomiale := elt(rigavecchia,k)+q^(k)*elt(rigavecchia,k+1) riganuova := append(riganuova,[binomiale]) k := k+1 rigavecchia := riganuova j := j+1 while j <= n repeat riganuova := [] k := 1 while k <= n-j+1 repeat ++exp : NNI := k+n-j exp : NNI := k+j+i-1-n binomiale := elt(rigavecchia,k)+q^(exp)*elt(rigavecchia,k+1) riganuova := append(riganuova,[binomiale]) k := k+1 rigavecchia := riganuova j := j+1 binomiale X : List(Symbol) X := [%A,%B,%C,%D,%E,%F,%G,%H,%I,%J,%K,%L,%M,%N,%O,%P,%Q,%R,%S,%T,%U,%V,%W,%X,%Y,%Z] q:=X(17) CCC : (Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol) -> Matrix((FRAC(POLY(INT)))) CCC(%A,%B,%C,%D,%E,%F,%G,%H,%I,%J,%K,%L,%M,%N,%O,%P) == [[%A,%B,%C,%D],[%E,%F,%G,%H],[%I,%J,%K,%L],[%M,%N,%O,%P]] c := CCC(%A,%B,%C,%D,%E,%F,%G,%H,%I,%J,%K,%L,%M,%N,%O,%P) BBB : (Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol,Symbol) -> Matrix((FRAC(POLY(INT)))) BBB(%R,%S,%T,%U,%V,%W,%X,%Y) == [[%R,%S,%T,%U],[%V,%W,%X,%Y]] b := BBB(%R,%S,%T,%U,%V,%W,%X,%Y) m2l : Matrix(FRAC(POLY(INT))) -> List(FRAC(POLY(INT))) m2l(m) == l : List(FRAC(POLY(INT))) := [] for i in 1..nrows(m) repeat for j in 1..ncols(m) repeat l := append(l,[m(i,j)]) l eqns : List(FRAC(POLY(INT))) := [%B,%C,%D,%E,%I,%M] eqns := append(eqns,m2l(YoungBaxter(c))) eqns := append(eqns,m2l(Hecke(c,q))) eqns := append(eqns,m2l(Naturality1(b,c))) eqns := append(eqns,m2l(Naturality2(b,c))) eqns := append(eqns,m2l(Antisymmetric(b,c))) eqns := append(eqns,m2l(Jacobi(b,c,q)))