aboutsummaryrefslogblamecommitdiff
path: root/Math/Combinatorics/.RootSystem.hs.swp
blob: b31575fc0de4c34e3b9194a49cc601a62a1b85e9 (plain) (tree)


































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
b0VIM 8.0�ifY7�\#baconoffice~bacon/codes/Mathkell/Math/Combinatorics/RootSystem.hsutf-83210#"! Utp\	W_^la�$!adW�\���WV0/������A�
�
�
�

e
d
1
0
/

����NM��u �
�
Y
<
�	�	�	w	$		��X2���B)���po_1����yxQ��o:�mlJ<(�zgA����mIndex rootIndex allRootIndices = mIndex :: [Q] -> [[Q]] -> [Q]pIn    where     where go :: [Q] -> [Int] -> Int -> [[Q]]newRootIndices ri pi = (ri <+>) <$> (go pi [] 1)newRootIndices :: [Q] -> [Q] -> [[Q]]                          where cm = cartanMatrix (simpleSystem G 2)    | otherwise = test'' (pr ++ npr) (S.toList . S.fromList $ mconcat $ zipWith newRootIndices npr (pIndex pr cm <$> npr))    | null npr = prtest'' pr nprtest'' :: [[Q]] -> [[Q]] -> [[Q]]              | otherwise = positiveRoots'' (pr ++ npr) (S.toList . S.fromList $ mconcat $ zipWith newRootIndices npr (pIndex pr cm <$> npr))              | null npr = pr          positiveRoots'' pr npr    where positiveRoots'' :: [[Q]] -> [[Q]] -> [[Q]]positiveRoots' cm = positiveRoots'' [] ((basisElt $ length cm) <$> [1..length cm])positiveRoots' :: [[Q]] -> [[Q]]-- |return root indices of all positive rootspositiveRoots ss = (positiveRoots' $ cartanMatrix ss) <<*>> sspositiveRoots :: SimpleSystem -> [[Q]]--cartanRows ss = cartanRows' --cartanRows :: SimpleSystem -> [[Q]]s alpha beta = beta <-> (dynkinIndex alpha beta) *> alphas :: [Q] -> [Q] -> [Q]-- s alpha beta = s_\alpha \beta-- Weyl group element corresponding to a root-- Humphreys p3-- Calculating the full root system from the fundamental roots-- ROOT SYSTEMSsimpleSystem t n = error $ "Invalid root system of type " ++ (show t) ++ " and rank " ++ (show n) ++ "."    where e = basisElt 3simpleSystem G 2 = [e 1 <-> e 2, ((-2) *> e 1) <+> e 2 <+> e 3]    where e = basisElt 4simpleSystem F 4 = [e 2 <-> e 3, e 3 <-> e 4, e 4, (1/2) *> (e 1 <-> e 2 <-> e 3 <-> e 4)]                      : [e (i-1) <-> e (i-2) | i <- [3..8]]                      : (e 1 <+> e 2)          simpleroots = ((1/2) *> (e 1 <-> e 2 <-> e 3 <-> e 4 <-> e 5 <-> e 6 <-> e 7 <+> e 8))    where e = basisElt 8simpleSystem E n | n `elem` [6,7,8] = take n simpleroots    where e = basisElt nsimpleSystem D n | n >= 4 = [e i <-> e (i+1) | i <- [1..n-1]] ++ [e (n-1) <+> e n]    where e = basisElt nsimpleSystem C n | n >= 2 = [e i <-> e (i+1) | i <- [1..n-1]] ++ [2 *> e n]    where e = basisElt nsimpleSystem B n | n >= 2 = [e i <-> e (i+1) | i <- [1..n-1]] ++ [e n]    where e = basisElt (n+1)simpleSystem A n | n >= 1 = [e i <-> e (i+1) | i <- [1..n]]simpleSystem :: Type -> Int -> SimpleSystem-- A simple system is like a basis for the root system (see Humphreys p8 for full definition)-- So long as our simple systems are rational, then reflection matrices are rational-- We need to work over the rationals to ensure that arithmetic is exact--basisElt' n i = replicate (i-1) 0 ++ 1 : replicate (n-i) 0--basisElt' :: Int -> Int -> [Int] -- this type signature determines all the restbasisElt n i = replicate (i-1) 0 ++ 1 : replicate (n-i) 0basisElt :: Int -> Int -> [Q] -- this type signature determines all the rest-- The ith basis vector in K^n-- sometimes called fundamental systems-- SIMPLE SYSTEMS-- Humphreys, Reflection Groups and Coxeter Groupstype SimpleSystem = [[Q]]data Type = A | B | C | D | E | F | G deriving Showimport Math.Algebra.Field.Base (Q)-- for Q--import Math.Algebra.Group.StringRewriting as SG--import Math.Algebra.Group.SchreierSims as SSimport Math.Algebra.Group.PermutationGroup hiding (elts, order, closure)import Math.Algebra.LinearAlgebraimport qualified Data.Set as Simport qualified Data.List as Limport Data.Listimport Data.Ratioimport Prelude hiding ( (*>) )module Math.Projects.RootSystem where-- Copyright (c) David Amos, 2008-2015. All rights reserved.---- Released under the GNU General Public License version 3 or later.-- Copyright (c) Yuchen Pei, 2017. adm$����o]J3!����_9�
�
�
�
�
�
}
|
{
x
\

��z --}-}    [(A,3),(A,4),(A,5),(B,3),(B,4),(B,5),(C,3),(C,4),(C,5),(D,4),(D,5),(E,6),(F,4),(G,2)]test2 = all (\(t,n) -> orderWeyl t n == SS.order (weylPerms t n))    [(A,3),(A,4),(A,5),(B,3),(B,4),(B,5),(C,3),(C,4),(C,5),(D,4),(D,5),(F,4),(G,2)]test1 = all (\(t,n) -> orderWeyl t n == L.genericLength (eltsCoxeter t n))-- now moved to TRootSystem{-factorial n = product [1..toInteger n]orderWeyl G 2 = 12orderWeyl F 4 = 2^7 * 3^2orderWeyl E 8 = 2^14 * 3^5 * 5^2 * 7orderWeyl E 7 = 2^10 * 3^4 * 5 * 7orderWeyl E 6 = 2^7 * 3^4 * 5orderWeyl D n = 2^(n-1) * factorial norderWeyl C n = 2^n * factorial norderWeyl B n = 2^n * factorial norderWeyl A n = factorial (n+1)-- orderWeyl t n == S.order (weylPerms t n)-- The order of the Weyl groupnumRoots G 2 = 12numRoots F 4 = 48numRoots E 8 = 240    numRoots E 7 = 126numRoots E 6 = 72numRoots D n = 2*n*(n-1)numRoots C n = 2*n*nnumRoots B n = 2*n*nnumRoots A n = n*(n+1)-- numRoots t n == length (closure $ simpleSystem t n)ad%�a���j0����?�
�
�
�
�
i
U
A
�qpon.-���gfeUT�
�
�
�
�
�
�
h
%
$

�	�	�	�	h	G	.		
			���RQ>=%��vY'��o-��iP ��c���V����A����          longRoots = concatMap (\r-> [r,[] <-> r]) [2 *> e i <-> e j <-> e k | i <- [1..3], [j,k] <- [[1..3] L.\\ [i]] ]          shortRoots = [e i <-> e j | i <- [1..3], j <- [1..3], i /= j]    where e = basisElt 3rootSystem G 2 = shortRoots ++ longRoots    where e = basisElt n    ++ [[] <-> e i <-> e j | i <- [1..n], j <- [i+1..n]]    ++ [[] <-> e i <+> e j | i <- [1..n], j <- [i+1..n]]    ++ [e i <-> e j | i <- [1..n], j <- [i+1..n]]    [e i <+> e j | i <- [1..n], j <- [i+1..n]]rootSystem D n | n >= 4 =                    ++ [[] <-> e i <-> e j | i <- [1..n], j <- [i+1..n]]                    ++ [[] <-> e i <+> e j | i <- [1..n], j <- [i+1..n]]                    ++ [e i <-> e j | i <- [1..n], j <- [i+1..n]]          shortRoots = [e i <+> e j | i <- [1..n], j <- [i+1..n]]                    ++ [[] <-> (2 *> e i) | i <- [1..n]]          longRoots  = [2 *> e i | i <- [1..n]]    where e = basisElt nrootSystem C n | n >= 2 = longRoots ++ shortRoots                    ++ [[] <-> e i <-> e j | i <- [1..n], j <- [i+1..n]]                    ++ [[] <-> e i <+> e j | i <- [1..n], j <- [i+1..n]]                    ++ [e i <-> e j | i <- [1..n], j <- [i+1..n]]          longRoots  = [e i <+> e j | i <- [1..n], j <- [i+1..n]]                    ++ [[] <-> e i | i <- [1..n]]          shortRoots = [e i | i <- [1..n]]    where e = basisElt nrootSystem B n | n >= 2 = shortRoots ++ longRoots    where e = basisElt (n+1)rootSystem A n | n >= 1 = [e i <-> e j | i <- [1..n+1], j <- [1..n+1], i /= j]-- rootSystem :: Type -> Int -> [[QQ]]-- L.sort (rootSystem t n) == closure (simpleSystem t n)-- The full root system-- Humphreys p41ff-- !! Not yet got root systems for E6,7,8, F4-- for comparison against the calculated values-- The expected values of the root system, number of roots, order of Weyl group-- TESTING               (id'  +|+ zMx n)                     +-+           in (zMx n +|+ idMx n)form B n = let id' = (-1) *>> idMx n           (map (0:) (form D n))form C n = (2 : replicate (2*n) 0) :          (idMx n +|+ zMx n)                  +-+form D n = (zMx n +|+ idMx n)(+-+) = (++)         -- glue two matrices together above and below(+|+) = zipWith (++) -- glue two matrices together side by side-- for gluing matrices togetherlieMult x y = x*y - y*x          e = basisElt n    where z = replicate n 0elemMx n i j = replicate (i-1) z ++ e j : replicate (n-i) z-- LIE ALGEBRASpoincarePoly t n = map length $ L.group $ map length $ eltsCoxeter t n-- it's just slightly faster to use the braid presentationeltsCoxeter t n = SG.elts $ fromCoxeterMatrix2 $ coxeterMatrix t ncoxeterPresentation t n = fromCoxeterMatrix $ coxeterMatrix t n    braidRelation i j m = (take m $ cycle [s_ j, s_ i], take m $ cycle [s_ i, s_ j])    rules ((1:xs):rs) i = ([s_ i, s_ i],[]) : [braidRelation i j m | (j,m) <- zip [i+1..] xs] ++ rules (map tail rs) (i+1)    rules [] _ = []    rs = rules mx 1    gs = map s_ [1..n]    n = length mxfromCoxeterMatrix2 mx = (gs,rs) where-- Another presentation for the Coxeter group, using braid relations    powerRelation i j m = (concat $ replicate m [s_ i, s_ j],[])    rules ((1:xs):rs) i = ([s_ i, s_ i],[]) : [powerRelation i j m | (j,m) <- zip [i+1..] xs] ++ rules (map tail rs) (i+1)    rules [] _ = []    rs = rules mx 1    gs = map s_ [1..n]    n = length mxfromCoxeterMatrix mx = (gs,rs) where-- We assume but don't check that mii == 1 and mij == mji-- Given the matrix of coefficients mij, return the Coxeter group <si | si^2, (sisj)^mij>coxeterMatrix t n = coxeterFromDynkin $ dynkinDiagram t nad�3��wvX3K3����zyQ+*�
�
�
�
�
c
1

���t>����j+�
�
�
S
6
&
%
!

�	�	�	�	f	N				���T���n$#"���|<��@?����m���on����b,���-- The mij coefficients of the Coxeter group <si | si^2, (sisj)^mij>, as a matrix    where f 0 = 2; f 1 = 3; f 2 = 4; f 3 = 6coxeterFromDynkin nij = setDiag 1 $ (map . map) f nij-- nij == 3 <=> theta = pi/6-- nij == 2 <=> theta = pi/4-- nij == 1 <=> theta = pi/3-- nij == 0 <=> theta = pi/2-- using nij = 4 cos^2 theta_ij-- given the Dynkin diagram nij, derive the coefficients mij of the Coxeter group <si | si^2, (sisj)^mij> (so mii == 1)dynkinDiagram t n = dynkinFromCartan $ cartanMatrix t ndynkinFromCartan aij = setDiag 0 $ (zipWith . zipWith) (*) aij (L.transpose aij)-- nij = Aij * Aji, nii = 0-- given a Cartan matrix, derive the corresponding matrix describing the Dynkin diagram-- Carter, Segal, Macdonald p17-18setDiag _ [[]] = [[]]setDiag c mx@((x:xs):rs) = (c:xs) : zipWith (:) (map head rs) (setDiag c $ map tail rs)-- set the diagonal entries of (square) matrix mx to constant c-- (So probably Carter defines the roots of G2 the other way round to Humphreys)-- They agree with our answers except for G2, which is the transpose-- Carter, Simple Groups of Lie Type, p44-5 gives the expected answers-- Those of B, C, F, G are not-- Note: The Cartan matrices for A, D, E systems are symmetric.    where roots = simpleSystem t ncartanMatrix t n = [[2 * (ai <.> aj) / (ai <.> ai) | aj <- roots] | ai <- roots]-- CARTAN MATRIX, DYNKIN DIAGRAM, COXETER SYSTEM-- however, reflection matrices are symmetric, so they also form the rows-- the images of the basis elts form the columns of the matrix          e = basisElt d    where d = length r -- dimension of the spacewMx r = map (w r) [e i | i <- [1..d]] -- matrix for reflection in hyperplane orthogonal to r-- The Weyl group element corresponding to a root, represented as a matrixweylMatrices t n = map wMx (simpleSystem t n)-- Generators of the Weyl group as a matrix group        in map toPerm rs        toPerm r = fromPairs [(x, w r x) | x <- xs]        xs = closure rs    let rs = simpleSystem t nweylPerms t n =-- Generators of the Weyl group as permutation group on the roots-- The finite reflection group generated by the root system-- WEYL GROUP{--            --}            in go pr' newPr'                newPr' = S.fromList [s alpha (negate <$> beta) | alpha <- ss, beta <- S.toList newPr] S.\\ pr'            let pr' = S.union pr newPr        | otherwise =        | S.null newPr = pr    go pr newPrpositiveRoots ss = S.toList $ go S.empty (S.fromList ss) where{--positiveRoots :: SimpleSystem -> [[Q]]            --}            in closure interior' boundary'                boundary' = S.fromList [s alpha beta | alpha <- ss, beta <- S.toList boundary] S.\\ interior'            let interior' = S.union interior boundary        | otherwise =        | S.null boundary = interior    closure interior boundaryallRoots ss = S.toList $ closure S.empty (S.fromList ss) where{--allRoots :: SimpleSystem -> [[Q]]-- The closure of a set of roots under reflection-- Given a simple system, return the full root systemdynkinIndex' ri cm = ri <*>> cmdynkinIndex' :: [Q] -> [[Q]] -> [Q]dynkinIndex r s = 2 * (r <.> s) / (r <.> r)dynkinIndex :: [Q] -> [Q] -> QdynkinRow r ss = dynkinIndex r <$> ssdynkinRow :: [Q] -> SimpleSystem -> [Q]isMultBasis v = (length $ filter (/=0) v) == 1isMultBasis :: [Q] -> BoolcartanMatrix ss = [dynkinIndex r <$> ss | r <- ss]cartanMatrix :: SimpleSystem -> [[Q]]sumV = foldl1 (<+>)maxV xs = maximum <$> (transpose xs)maxV :: Ord a => [[a]] -> [a]        else maxV $ filter isMultBasis [rootIndex <-> r | r <- allRootIndices]        then 2 *> rootIndex    if isMultBasis rootIndex ady�	����b�����mImIndex rootIndexmIndex rootIndex allRootIndices = mIndex :: [Q] -> [[Q]] -> [Q]pIndex allRootIndices cm rootIndex = (mIndex rootIndex allRootIndices) <-> (dynkinIndex' rootIndex cm)pIndex :: [[Q]] -> [[Q]] -> [Q] -> [Q]          go (x:xs) ys k = go xs (if x == 0 then ys else ys ++ [k]) (k + 1)          go [] ys n = basisElt n <$> ysad�Z^�����srW('������hHG�
�
{
]
8
"
�~SCB����p�
�
�
�
�
�
�
B
2

�	�	�	�	|	N	M		�t[�����M*���?���U?>��VU��gJ-���Z-- The mij coefficients of the Coxeter group <si | si^2, (sisj)^mij>, as a matrix    where f 0 = 2; f 1 = 3; f 2 = 4; f 3 = 6coxeterFromDynkin nij = setDiag 1 $ (map . map) f nij-- nij == 3 <=> theta = pi/6-- nij == 2 <=> theta = pi/4-- nij == 1 <=> theta = pi/3-- nij == 0 <=> theta = pi/2-- using nij = 4 cos^2 theta_ij-- given the Dynkin diagram nij, derive the coefficients mij of the Coxeter group <si | si^2, (sisj)^mij> (so mii == 1)dynkinDiagram t n = dynkinFromCartan $ cartanMatrix t ndynkinFromCartan aij = setDiag 0 $ (zipWith . zipWith) (*) aij (L.transpose aij)-- nij = Aij * Aji, nii = 0-- given a Cartan matrix, derive the corresponding matrix describing the Dynkin diagram-- Carter, Segal, Macdonald p17-18setDiag _ [[]] = [[]]setDiag c mx@((x:xs):rs) = (c:xs) : zipWith (:) (map head rs) (setDiag c $ map tail rs)-- set the diagonal entries of (square) matrix mx to constant c-- (So probably Carter defines the roots of G2 the other way round to Humphreys)-- They agree with our answers except for G2, which is the transpose-- Carter, Simple Groups of Lie Type, p44-5 gives the expected answers-- Those of B, C, F, G are not-- Note: The Cartan matrices for A, D, E systems are symmetric.    where roots = simpleSystem t ncartanMatrix t n = [[2 * (ai <.> aj) / (ai <.> ai) | aj <- roots] | ai <- roots]-- CARTAN MATRIX, DYNKIN DIAGRAM, COXETER SYSTEM-- however, reflection matrices are symmetric, so they also form the rows-- the images of the basis elts form the columns of the matrix          e = basisElt d    where d = length r -- dimension of the spacewMx r = map (w r) [e i | i <- [1..d]] -- matrix for reflection in hyperplane orthogonal to r-- The Weyl group element corresponding to a root, represented as a matrixweylMatrices t n = map wMx (simpleSystem t n)-- Generators of the Weyl group as a matrix group        in map toPerm rs        toPerm r = fromPairs [(x, w r x) | x <- xs]        xs = closure rs    let rs = simpleSystem t nweylPerms t n =-- Generators of the Weyl group as permutation group on the roots-- The finite reflection group generated by the root system-- WEYL GROUP{--            --}            in go pr' newPr'                newPr' = S.fromList [s alpha (negate <$> beta) | alpha <- ss, beta <- S.toList newPr] S.\\ pr'            let pr' = S.union pr newPr        | otherwise =        | S.null newPr = pr    go pr newPrpositiveRoots ss = S.toList $ go S.empty (S.fromList ss) where{--positiveRoots :: SimpleSystem -> [[Q]]            --}            in closure interior' boundary'                boundary' = S.fromList [s alpha beta | alpha <- ss, beta <- S.toList boundary] S.\\ interior'            let interior' = S.union interior boundary        | otherwise =        | S.null boundary = interior    closure interior boundaryallRoots ss = S.toList $ closure S.empty (S.fromList ss) where{--allRoots :: SimpleSystem -> [[Q]]-- The closure of a set of roots under reflection-- Given a simple system, return the full root systemdynkinIndex' ri cm = ri <*>> cmdynkinIndex' :: [Q] -> [[Q]] -> [Q]dynkinIndex r s = 2 * (r <.> s) / (r <.> r)dynkinIndex :: [Q] -> [Q] -> QdynkinRow r ss = dynkinIndex r <$> ssdynkinRow :: [Q] -> SimpleSystem -> [Q]isMultBasis v = (length $ filter (/=0) v) == 1isMultBasis :: [Q] -> BoolcartanMatrix ss = [dynkinIndex r <$> ss | r <- ss]cartanMatrix :: SimpleSystem -> [[Q]]sumV = foldl1 (<+>)sumV :: Num a => [[a]] -> [a]