module Math.Projects.ChevalleyGroup.Classical where
import Prelude hiding ( (*>) )
import Math.Algebra.Field.Base
import Math.Algebra.Field.Extension hiding ( (<+>), (<*>) )
import Math.Algebra.LinearAlgebra
import Math.Algebra.Group.PermutationGroup
import Math.Algebra.Group.SchreierSims as SS
import Math.Combinatorics.FiniteGeometry
numPtsAG n q = q^n
numPtsPG n q = (q^(n+1)-1) `div` (q-1)
sl :: FiniteField k => Int -> [k] -> [[[k]]]
sl n fq = [elemTransvection n (r,c) l | r <- [1..n], c <- [1..n], r /= c, l <- fq']
where fq' = basisFq undefined
elemTransvection n (r,c) l = fMatrix n (\i j -> if i == j then 1 else if (i,j) == (r,c) then l else 0)
l :: (FiniteField k, Ord k) => Int -> [k] -> [Permutation [k]]
l n fq = [fromPairs $ [(p, pnf (p <*>> m)) | p <- ps] | m <- sl n fq]
where ps = ptsPG (n-1) fq
orderL n q = ( q^(n*(n-1) `div` 2) * product [ q^i-1 | i <- [n,n-1..2] ] )
`div` gcd (q-1) n
sp2 :: FiniteField k => Int -> [k] -> [[[k]]]
sp2 n fq =
[_I <<+>> t *>> (e i j <<->> e (-j) (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) (-j) <<->> e j i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> (e i (-j) <<+>> e j (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> (e (-i) j <<+>> e (-j) i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> e i (-i) | i <- [1..n], t <- fq' ] ++
[_I <<+>> t *>> e (-i) i | i <- [1..n], t <- fq' ]
where
fq' = basisFq undefined
_I = idMx (2*n)
e i j = e' (if i > 0 then i else n-i) (if j > 0 then j else n-j)
e' i j = fMatrix (2*n) (\k l -> if (k,l) == (i,j) then 1 else 0)
s2 :: (FiniteField k, Ord k) => Int -> [k] -> [Permutation [k]]
s2 n fq = [fromPairs $ [(p, pnf (p <*>> m)) | p <- ps] | m <- sp2 n fq]
where ps = ptsPG (2*n-1) fq
s n fq | even n = s2 (n `div` 2) fq
orderS2 n q = (q^n^2 * product [ q^i-1 | i <- [2*n,2*n-2..2] ]) `div` gcd (q-1) 2
orderS n q | even n = orderS2 (n `div` 2) q
omegaeven n fq =
[_I <<+>> t *>> (e i j <<->> e (-j) (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) (-j) <<->> e j i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> (e i (-j) <<->> e j (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) j <<->> e (-j) i) | i <- [1..n], j <- [i+1..n], t <- fq' ]
where
fq' = basisFq undefined
_I = idMx (2*n)
e i j = e' (if i > 0 then i else n-i) (if j > 0 then j else n-j)
e' i j = fMatrix (2*n) (\k l -> if (k,l) == (i,j) then 1 else 0)
d n fq = [fromPairs $ [(p, pnf (p <*>> m)) | p <- ps] | m <- omegaeven n fq]
where ps = ptsPG (2*n-1) fq
omegaodd n fq
| char fq /= 2 =
[_I <<+>> t *>> (e i j <<->> e (-j) (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) (-j) <<->> e j i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> (e i (-j) <<->> e j (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) j <<->> e (-j) i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> (2 *>> e i 0 <<->> e 0 (-i)) <<->> (t^2) *>> e i (-i) | i <- [1..n], t <- fq' ] ++
[_I <<->> t *>> (2 *>> e (-i) 0 <<->> e 0 i) <<->> (t^2) *>> e (-i) i | i <- [1..n], t <- fq' ]
| char fq == 2 =
[_I <<+>> t *>> (e i j <<->> e (-j) (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) (-j) <<->> e j i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> t *>> (e i (-j) <<->> e j (-i)) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<->> t *>> (e (-i) j <<->> e (-j) i) | i <- [1..n], j <- [i+1..n], t <- fq' ] ++
[_I <<+>> (t^2) *>> e i (-i) | i <- [1..n], t <- fq' ] ++
[_I <<+>> (t^2) *>> e (-i) i | i <- [1..n], t <- fq' ]
where
fq' = basisFq undefined
_I = idMx (2*n+1)
e i j = e' (if i >= 0 then i else n-i) (if j >= 0 then j else n-j)
e' i j = fMatrix' (2*n+1) (\k l -> if (k,l) == (i,j) then 1 else 0)
b n fq = [fromPairs $ [(p, pnf (p <*>> m)) | p <- ps] | m <- omegaodd n fq]
where ps = ptsPG (2*n) fq
o n fq | even n = d (n `div` 2) fq
| odd n = b (n `div` 2) fq