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








































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
b0VIM 8.0nggY��\kbaconoffice~bacon/codes/Mathkell/Math/Combinatorics/RootSystem.hsutf-83210#"! Utp`Hb4�f�81ad�,`�onHG('�����G�
�
�
�
�
k
j
7
6
5
#
����TS�{&%�
�
_
B
�	�	�	r	Y	5	���lS���5��ZYI
	����YXW*����ynJ���x?�������m-,��positiveRoots ss = (positiveRoots' $ cartanMatrix' ss) <<*>> sspositiveRoots :: SimpleSystem -> [[Q]]-- |all positive roots--positiveRoots ss = (positiveRoots' $ cartanMatrix' ss) <<*>> sspositiveRoots :: SimpleSystem -> [[Q]]-- |all positive roots--negateM = fmap (fmap negate)--negateM :: Num a => [[a]] -> [[a]]                                 longestElement' (alpha:xs) (s alpha <$> rs)                else let alpha = (head (S.toList ys)) in                then xs                if S.null ys            let ys = (S.fromList ss) `S.intersection` (S.fromList rs) in        longestElement' xs rs =         longestElement' :: [[Q]] -> [[Q]] -> [[Q]]        posRoots = positiveRoots ss    where longestElement ss = longestElement' [] posRootslongestElement :: SimpleSystem -> [[Q]]longestElementIndex ss = (+1) <$> fromJust <$> flip elemIndex ss <$> longestElement sslongestElementIndex :: SimpleSystem -> [Int]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 simplerootssimpleSystem D 3 = simpleSystem A 3    where e = basisElt nsimpleSystem D n | n >= 4 = [e i <-> e (i+1) | i <- [1..n-1]] ++ [e (n-1) <+> e n]simpleSystem C 1 = simpleSystem A 1    where e = basisElt nsimpleSystem C n | n >= 2 = [e i <-> e (i+1) | i <- [1..n-1]] ++ [2 *> e n]simpleSystem B 1 = simpleSystem A 1    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.Maybeimport Data.Listimport Data.Ratioimport Prelude hiding ( (*>) )module Math.Projects.RootSystem where-- Copyright (c) David Amos, 2008-2015. All rights reserved.-- Copyright (c) Yuchen Pei, 2017. (Added positive roots and highest elements etc.)ad
8��bI��h�
�
�
[
"
��U���X�
�
|



�	�	�	�	r	P	*		������nmliM��k
	--}-}    [(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 group          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]ad�f�wvuDC���p)�
�
�
R
����hL����I)�
�
�

R
Q
�	�	�	�	i	/	
	����>����hT@�ponm-,���fedTS�������g$#����gF-
��QP=<$���-- 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 n-- 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 matrixad*fH��xC"vuO�
�
|
{
z
S
�����p! ������PO(�
�
�
�
�
�
_
^
?


�	�	�	�		j	U	<	*			������Z?+�����f����<;��rT/�uJIHD6�����q=(#���w��          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 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) whereallRoots :: SimpleSystem -> [[Q]]-- The closure of a set of roots under reflection-- Given a simple system, return the full root systemprop_positiveRoots' t n = (length $ positiveRoots (simpleSystem t n)) * 2 == numRoots t nprop_positiveRoots' :: Typ  | otherwise =  | otherwise = p    | otherwise = prop  | otherwise = prop  | otherwise = prop  | otherwise = prop  | otherwise = prop  | otherwise = prop    | otherwise = positiveRo  | otherwise = positiveRoots_transform (n `mod` 108 + 1)  | n > 0 = (A, n)  | n > 20 = (B, n - 20)  | n > 40 = (C, n - 40)  | n > 62 = (D, n - 60)  | n > 85 = (E, n - 80)  | n > 88 = (F, 4)  | n > 96 = (G, 2)  | n > 105 = (E, n - 100)  | n > 108 = positiveRoots_transform (n `mod` 108 + 1)positiveRoots_transform npositiveRoots_transform :: Int -> (Type, Int)numRoots 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)dynkinIndex' 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 = transpose $ cartanMatrix sscartanMatrix' :: SimpleSystem -> [[Q]]cartanMatrix ss = [dynkinIndex r <$> ss | r <- ss]cartanMatrix :: SimpleSystem -> [[Q]]sumV = foldl1 (<+>)sumV :: Num a => [[a]] -> [a]maxV xs = maximum <$> (transpose xs)maxV :: Ord a => [[a]] -> [a]        else maxV $ filter isMultBasis [rootIndex <-> r | r <- allRootIndices]        then 2 *> rootIndex    if isMultBasis rootIndex mIndex 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 <$> ys    where go :: [Q] -> [Int] -> Int -> [[Q]]newRootIndices ri pi = (ri <+>) <$> (go pi [] 1)newRootIndices :: [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'' [] (iMx $ length cm)positiveRoots' :: [[Q]] -> [[Q]]-- |return root indices of all positive rootsad��4����l?>���tQ �
�
�
�
�
y
 

���V8��Y.-,(�
�
�
�
m
U
!


�	�	�	[	������T1            e = basisElt d    where d = len          e = basisElt d    where           e = basisElt d    where d = length r -          e = basisElt d    where d = length            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 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) whereallRoots :: SimpleSystem -> [[Q]]-- The closure of a set of roots under reflection-- Given a simple system, return the full root system        (S.fromList $ pr ++ ((-1) *>> pr)) == (S.fromList $ allRoots (simpleSystem t n))    let pr = positiveRoots (simpleSystem t n) inprop_positiveRoots1' t n =prop_positiveRoots1' :: Type -> Int -> Bool    where (t, m) = positiveRoots_transform nprop_positiveRoots1 n = prop_positiveRoots1' t mprop_positiveRoots1 :: Int -> Bool-- | test the positive roots and negative roots form all the rootsprop_positiveRoots' t n = (length $ positiveRoots (simpleSystem t n)) * 2 == numRoots t nprop_positiveRoots' :: Type -> Int -> Bool    where (t, m) = positiveRoots_transform nprop_positiveRoots n = prop_positiveRoots' t mprop_positiveRoots :: Int -> Bool-- | test the number of positive roots is half that of all roots