{-# LANGUAGE BangPatterns, TypeSynonymInstances, FlexibleInstances,
ScopedTypeVariables, Rank2Types, GADTs
#-}
module Math.RootLoci.CSM.Equivariant.Ordered
(
tangentChernClass
, j_star
, smallDiagonal
, computeOpenStratumCSM
, computeAnyStratumCSM
, computeClosureOfAnyStratumCSM
, QPow(..)
, umbralDistinctFormula
, umbralSubstQPow
, computeQPolys
, formulaQPoly
, formulaDistinctCSM
, formulaAnyStratumCSM
)
where
#if MIN_VERSION_base(4,11,0)
import Data.Foldable
import Data.Semigroup
#endif
import Math.Combinat.Classes
import Math.Combinat.Numbers
import Math.Combinat.Sign
import Math.Combinat.Partitions.Integer ( Partition(..) )
import Math.Combinat.Partitions.Set
import Math.Combinat.Sets
import Math.RootLoci.Algebra
import Math.RootLoci.Geometry
import Math.RootLoci.Misc
import qualified Data.Set as Set ; import Data.Set (Set)
import qualified Math.Algebra.Polynomial.FreeModule as ZMod
import Math.RootLoci.CSM.Equivariant.PushForward
tangentChernClass
:: ChernBase base
=> Int
-> ZMod (Omega base)
tangentChernClass :: Int -> ZMod (Omega base)
tangentChernClass Int
n = (FreeMod Integer (Omega AB), FreeMod Integer (Omega Chern))
-> ChernBase base => ZMod (Omega base)
forall (f :: * -> *) (g :: * -> *) base.
(f (g AB), f (g Chern)) -> ChernBase base => f (g base)
select2
( Int -> FreeMod Integer (Omega AB)
tangentChernClassAB Int
n
, Int -> FreeMod Integer (Omega Chern)
tangentChernClassChern Int
n
)
tangentChernClassAB
:: Int
-> ZMod (Omega AB)
tangentChernClassAB :: Int -> FreeMod Integer (Omega AB)
tangentChernClassAB Int
d = [FreeMod Integer (Omega AB)] -> FreeMod Integer (Omega AB)
forall b c.
(Ord b, Monoid b, Eq c, Num c) =>
[FreeMod c b] -> FreeMod c b
ZMod.product [ Int -> FreeMod Integer (Omega AB)
forall c. (Eq c, Num c) => Int -> FreeMod c (Omega AB)
entry Int
i | Int
i<-[Int
1..Int
d] ] where
entry :: Int -> FreeMod c (Omega AB)
entry Int
i = [(Omega AB, c)] -> FreeMod c (Omega AB)
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ([Int] -> AB -> Omega AB
forall ab. [Int] -> ab -> Omega ab
Omega [] (Int -> Int -> AB
AB Int
0 Int
0) , c
1)
, ([Int] -> AB -> Omega AB
forall ab. [Int] -> ab -> Omega ab
Omega [] (Int -> Int -> AB
AB Int
1 Int
0) , c
1)
, ([Int] -> AB -> Omega AB
forall ab. [Int] -> ab -> Omega ab
Omega [] (Int -> Int -> AB
AB Int
0 Int
1) , c
1)
, ([Int] -> AB -> Omega AB
forall ab. [Int] -> ab -> Omega ab
Omega [Int
i] (Int -> Int -> AB
AB Int
0 Int
0) , c
2)
]
tangentChernClassChern
:: Int
-> ZMod (Omega Chern)
tangentChernClassChern :: Int -> FreeMod Integer (Omega Chern)
tangentChernClassChern Int
d = [FreeMod Integer (Omega Chern)] -> FreeMod Integer (Omega Chern)
forall b c.
(Ord b, Monoid b, Eq c, Num c) =>
[FreeMod c b] -> FreeMod c b
ZMod.product [ Int -> FreeMod Integer (Omega Chern)
forall c. (Eq c, Num c) => Int -> FreeMod c (Omega Chern)
entry Int
i | Int
i<-[Int
1..Int
d] ] where
entry :: Int -> FreeMod c (Omega Chern)
entry Int
i = [(Omega Chern, c)] -> FreeMod c (Omega Chern)
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ([Int] -> Chern -> Omega Chern
forall ab. [Int] -> ab -> Omega ab
Omega [] (Int -> Int -> Chern
Chern Int
0 Int
0) , c
1)
, ([Int] -> Chern -> Omega Chern
forall ab. [Int] -> ab -> Omega ab
Omega [] (Int -> Int -> Chern
Chern Int
1 Int
0) , c
1)
, ([Int] -> Chern -> Omega Chern
forall ab. [Int] -> ab -> Omega ab
Omega [Int
i] (Int -> Int -> Chern
Chern Int
0 Int
0) , c
2)
]
j_star :: ChernBase base => [[Int]] -> ZMod (Omega base) -> ZMod (Omega base)
j_star :: [[Int]] -> ZMod (Omega base) -> ZMod (Omega base)
j_star [[Int]]
indices = FreeMod Integer (Eta base) -> ZMod (Omega base)
forall coeff ab.
(Eq coeff, Num coeff, Ord ab) =>
FreeMod coeff (Eta ab) -> FreeMod coeff (Omega ab)
unsafeEtaToOmega (FreeMod Integer (Eta base) -> ZMod (Omega base))
-> (ZMod (Omega base) -> FreeMod Integer (Eta base))
-> ZMod (Omega base)
-> ZMod (Omega base)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Int]] -> ZMod (Omega base) -> FreeMod Integer (Eta base)
forall base.
ChernBase base =>
[[Int]] -> ZMod (Omega base) -> ZMod (Eta base)
delta_star' [[Int]]
indices where
smallDiagonal :: forall base. ChernBase base => Int -> ZMod (Omega base)
smallDiagonal :: Int -> ZMod (Omega base)
smallDiagonal Int
n = [Int] -> ZMod (Omega base)
smallDiagonal' [Int
1..Int
n] where
smallDiagonal' :: [Int] -> ZMod (Omega base)
smallDiagonal' :: [Int] -> ZMod (Omega base)
smallDiagonal' [Int]
indices = [[Int]] -> ZMod (Omega base) -> ZMod (Omega base)
forall base.
ChernBase base =>
[[Int]] -> ZMod (Omega base) -> ZMod (Omega base)
j_star [[Int]
indices] (Int -> ZMod (Omega base)
forall base. ChernBase base => Int -> ZMod (Omega base)
tangentChernClass Int
1)
computeOpenStratumCSM :: ChernBase base => Int -> ZMod (Omega base)
computeOpenStratumCSM :: Int -> ZMod (Omega base)
computeOpenStratumCSM = (forall base. ChernBase base => Int -> ZMod (Omega base))
-> forall base. ChernBase base => Int -> ZMod (Omega base)
forall key (f :: * -> *) (g :: * -> *).
CacheKey key =>
(forall base. ChernBase base => key -> f (g base))
-> forall base. ChernBase base => key -> f (g base)
polyCache2 forall base. ChernBase base => Int -> ZMod (Omega base)
calcOpenStratumCSM where
calcOpenStratumCSM :: forall b. ChernBase b => Int -> ZMod (Omega b)
calcOpenStratumCSM :: Int -> ZMod (Omega b)
calcOpenStratumCSM Int
d
| Int
d Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = ZMod (Omega b)
forall b c. (Monoid b, Num c) => FreeMod c b
ZMod.one
| Int
d Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1 = Int -> ZMod (Omega b)
forall base. ChernBase base => Int -> ZMod (Omega base)
tangentChernClass Int
1
| Bool
otherwise = (Int -> ZMod (Omega b)
forall base. ChernBase base => Int -> ZMod (Omega base)
tangentChernClass Int
d) ZMod (Omega b) -> ZMod (Omega b) -> ZMod (Omega b)
forall b c.
(Ord b, Eq c, Num c) =>
FreeMod c b -> FreeMod c b -> FreeMod c b
`ZMod.sub` ([ZMod (Omega b)] -> ZMod (Omega b)
forall b c. (Ord b, Eq c, Num c) => [FreeMod c b] -> FreeMod c b
ZMod.sum [ZMod (Omega b)]
diagonals)
where
diagonals :: [ZMod (Omega b)]
diagonals =
[ SetPartition -> ZMod (Omega b)
forall base. ChernBase base => SetPartition -> ZMod (Omega base)
computeAnyStratumCSM SetPartition
setp
| SetPartition
setp <- Int -> [SetPartition]
setPartitions Int
d
, let k :: Int
k = SetPartition -> Int
forall a. HasNumberOfParts a => a -> Int
numberOfParts SetPartition
setp
, Int
k Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
d
]
computeAnyStratumCSM :: ChernBase base => SetPartition -> ZMod (Omega base)
computeAnyStratumCSM :: SetPartition -> ZMod (Omega base)
computeAnyStratumCSM (SetPartition [[Int]]
pps) = ([[Int]] -> ZMod (Omega base) -> ZMod (Omega base)
forall base.
ChernBase base =>
[[Int]] -> ZMod (Omega base) -> ZMod (Omega base)
j_star [[Int]]
pps (ZMod (Omega base) -> ZMod (Omega base))
-> ZMod (Omega base) -> ZMod (Omega base)
forall a b. (a -> b) -> a -> b
$ Int -> ZMod (Omega base)
forall base. ChernBase base => Int -> ZMod (Omega base)
computeOpenStratumCSM (Int -> ZMod (Omega base)) -> Int -> ZMod (Omega base)
forall a b. (a -> b) -> a -> b
$ [[Int]] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [[Int]]
pps)
computeClosureOfAnyStratumCSM :: ChernBase base => SetPartition -> ZMod (Omega base)
computeClosureOfAnyStratumCSM :: SetPartition -> ZMod (Omega base)
computeClosureOfAnyStratumCSM SetPartition
setp = [ZMod (Omega base)] -> ZMod (Omega base)
forall b c. (Ord b, Eq c, Num c) => [FreeMod c b] -> FreeMod c b
ZMod.sum
[ SetPartition -> ZMod (Omega base)
forall base. ChernBase base => SetPartition -> ZMod (Omega base)
computeAnyStratumCSM SetPartition
p | SetPartition
p <- Set SetPartition -> [SetPartition]
forall a. Set a -> [a]
Set.toList (SetPartition -> Set SetPartition
closureSetOfSetPartition SetPartition
setp) ]
newtype QPow = QPow Int deriving (QPow -> QPow -> Bool
(QPow -> QPow -> Bool) -> (QPow -> QPow -> Bool) -> Eq QPow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QPow -> QPow -> Bool
$c/= :: QPow -> QPow -> Bool
== :: QPow -> QPow -> Bool
$c== :: QPow -> QPow -> Bool
Eq,Eq QPow
Eq QPow
-> (QPow -> QPow -> Ordering)
-> (QPow -> QPow -> Bool)
-> (QPow -> QPow -> Bool)
-> (QPow -> QPow -> Bool)
-> (QPow -> QPow -> Bool)
-> (QPow -> QPow -> QPow)
-> (QPow -> QPow -> QPow)
-> Ord QPow
QPow -> QPow -> Bool
QPow -> QPow -> Ordering
QPow -> QPow -> QPow
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: QPow -> QPow -> QPow
$cmin :: QPow -> QPow -> QPow
max :: QPow -> QPow -> QPow
$cmax :: QPow -> QPow -> QPow
>= :: QPow -> QPow -> Bool
$c>= :: QPow -> QPow -> Bool
> :: QPow -> QPow -> Bool
$c> :: QPow -> QPow -> Bool
<= :: QPow -> QPow -> Bool
$c<= :: QPow -> QPow -> Bool
< :: QPow -> QPow -> Bool
$c< :: QPow -> QPow -> Bool
compare :: QPow -> QPow -> Ordering
$ccompare :: QPow -> QPow -> Ordering
$cp1Ord :: Eq QPow
Ord,Int -> QPow -> ShowS
[QPow] -> ShowS
QPow -> String
(Int -> QPow -> ShowS)
-> (QPow -> String) -> ([QPow] -> ShowS) -> Show QPow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QPow] -> ShowS
$cshowList :: [QPow] -> ShowS
show :: QPow -> String
$cshow :: QPow -> String
showsPrec :: Int -> QPow -> ShowS
$cshowsPrec :: Int -> QPow -> ShowS
Show)
#if MIN_VERSION_base(4,11,0)
instance Semigroup QPow where
<> :: QPow -> QPow -> QPow
(<>) (QPow Int
e) (QPow Int
f) = Int -> QPow
QPow (Int
eInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
f)
instance Monoid QPow where
mempty :: QPow
mempty = Int -> QPow
QPow Int
0
#else
instance Monoid QPow where
mempty = QPow 0
mappend (QPow e) (QPow f) = QPow (e+f)
#endif
instance Pretty QPow where
pretty :: QPow -> String
pretty (QPow Int
k) = String -> Int -> String
showVarPower String
"q" Int
k
umbralDistinctFormula :: Int -> ZMod (Omega QPow)
umbralDistinctFormula :: Int -> ZMod (Omega QPow)
umbralDistinctFormula Int
n
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
0 = String -> ZMod (Omega QPow)
forall a. HasCallStack => String -> a
error String
"umbralDistinct: n should be nonnegative"
| Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = Omega QPow -> ZMod (Omega QPow)
forall c b. Num c => b -> FreeMod c b
ZMod.generator (Omega QPow -> ZMod (Omega QPow))
-> Omega QPow -> ZMod (Omega QPow)
forall a b. (a -> b) -> a -> b
$ [Int] -> Int -> Omega QPow
monom [] (-Int
3)
| Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1 = [(Omega QPow, Integer)] -> ZMod (Omega QPow)
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ([Int] -> Int -> Omega QPow
monom [] (-Int
2) , Integer
1)
, ([Int] -> Int -> Omega QPow
monom [Int
1] (-Int
3) , Integer
2)
]
| Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
2 = [(Omega QPow, Integer)] -> ZMod (Omega QPow)
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ([Int] -> Int -> Omega QPow
monom [] (-Int
1) , Integer
1)
, ([Int] -> Int -> Omega QPow
monom [Int
1] (-Int
2) , Integer
1)
, ([Int] -> Int -> Omega QPow
monom [Int
2] (-Int
2) , Integer
1)
, ([Int] -> Int -> Omega QPow
monom [Int
1,Int
2] (-Int
3) , Integer
2)
]
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
3 = [ZMod (Omega QPow)] -> ZMod (Omega QPow)
forall b c. (Ord b, Eq c, Num c) => [FreeMod c b] -> FreeMod c b
ZMod.sum
[ Integer -> ZMod (Omega QPow) -> ZMod (Omega QPow)
forall b c. (Ord b, Eq c, Num c) => c -> FreeMod c b -> FreeMod c b
ZMod.scale Integer
coeff (ZMod (Omega QPow) -> ZMod (Omega QPow))
-> ZMod (Omega QPow) -> ZMod (Omega QPow)
forall a b. (a -> b) -> a -> b
$ (Int -> [Omega QPow] -> ZMod (Omega QPow)
forall a. (Ord a, Monoid a) => Int -> [a] -> ZMod a
symPoly (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
3Int -> Int -> Int
forall a. Num a => a -> a -> a
-Int
k) [Omega QPow]
us) ZMod (Omega QPow) -> ZMod (Omega QPow) -> ZMod (Omega QPow)
forall a. Num a => a -> a -> a
* (Omega QPow -> ZMod (Omega QPow)
forall c b. Num c => b -> FreeMod c b
ZMod.generator (Omega QPow -> ZMod (Omega QPow))
-> Omega QPow -> ZMod (Omega QPow)
forall a b. (a -> b) -> a -> b
$ [Int] -> Int -> Omega QPow
monom [] Int
k)
| Int
k<-[Int
0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
3]
, let coeff :: Integer
coeff = Int -> Integer -> Integer
forall a b. (Integral a, Num b) => a -> b -> b
negateIfOdd (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
3Int -> Int -> Int
forall a. Num a => a -> a -> a
+Int
k) (Int -> Integer
forall a. Integral a => a -> Integer
factorial (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
3) Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
`div` Int -> Integer
forall a. Integral a => a -> Integer
factorial Int
k)
]
where
monom :: [Int] -> Int -> Omega QPow
monom [Int]
xs Int
k = [Int] -> QPow -> Omega QPow
forall ab. [Int] -> ab -> Omega ab
Omega [Int]
xs (Int -> QPow
QPow Int
k)
us :: [Omega QPow]
us = [ [Int] -> Int -> Omega QPow
monom [Int
i] Int
0 | Int
i<-[Int
1..Int
n] ]
umbralSubstQPow :: (ChernBase base) => (QPow -> ZMod base) -> ZMod (Omega QPow) -> ZMod (Omega base)
umbralSubstQPow :: (QPow -> ZMod base) -> ZMod (Omega QPow) -> ZMod (Omega base)
umbralSubstQPow QPow -> ZMod base
subst1 ZMod (Omega QPow)
input = [ZMod (Omega base)] -> ZMod (Omega base)
forall b c. (Ord b, Eq c, Num c) => [FreeMod c b] -> FreeMod c b
ZMod.sum
[ [(Omega base, Integer)] -> ZMod (Omega base)
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ([Int] -> base -> Omega base
forall ab. [Int] -> ab -> Omega ab
Omega [Int]
us base
ab , Integer
cInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
*Integer
coeff)
| (base
ab,Integer
c) <- ZMod base -> [(base, Integer)]
forall c b. FreeMod c b -> [(b, c)]
ZMod.toList (QPow -> ZMod base
subst1 QPow
qpow)
]
| (Omega [Int]
us QPow
qpow , Integer
coeff) <- ZMod (Omega QPow) -> [(Omega QPow, Integer)]
forall c b. FreeMod c b -> [(b, c)]
ZMod.toList ZMod (Omega QPow)
input
]
computeQPolys :: Int -> ZMod AB
computeQPolys :: Int -> ZMod AB
computeQPolys = ZMod AB -> Int -> (Int -> ZMod AB) -> Int -> ZMod AB
forall a. a -> Int -> (Int -> a) -> Int -> a
icache' ZMod AB
forall c b. FreeMod c b
ZMod.zero (-Int
3) Int -> ZMod AB
calcComputeQPolys where
calcComputeQPolys :: Int -> ZMod AB
calcComputeQPolys :: Int -> ZMod AB
calcComputeQPolys Int
n
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< -Int
3 = String -> ZMod AB
forall a. HasCallStack => String -> a
error String
"computeQPolys: n >= -3 is required"
| Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== -Int
3 = ZMod AB
forall b c. (Monoid b, Num c) => FreeMod c b
ZMod.one
| Bool
otherwise = (Omega AB -> AB) -> FreeMod Integer (Omega AB) -> ZMod AB
forall a b c.
(Ord a, Ord b, Eq c, Num c) =>
(a -> b) -> FreeMod c a -> FreeMod c b
ZMod.mapBase Omega AB -> AB
project FreeMod Integer (Omega AB)
almost
where
almost :: FreeMod Integer (Omega AB)
almost = FreeMod Integer (Omega AB)
open FreeMod Integer (Omega AB)
-> FreeMod Integer (Omega AB) -> FreeMod Integer (Omega AB)
forall a. Num a => a -> a -> a
- FreeMod Integer (Omega AB)
smaller
open :: FreeMod Integer (Omega AB)
open = Int -> FreeMod Integer (Omega AB)
forall base. ChernBase base => Int -> ZMod (Omega base)
computeOpenStratumCSM (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
3)
umbSmaller :: ZMod (Omega QPow)
umbSmaller = Int -> ZMod (Omega QPow)
umbralDistinctFormula (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
3) ZMod (Omega QPow) -> ZMod (Omega QPow) -> ZMod (Omega QPow)
forall a. Num a => a -> a -> a
- ZMod (Omega QPow)
umbHighest
umbHighest :: ZMod (Omega QPow)
umbHighest = Omega QPow -> ZMod (Omega QPow)
forall c b. Num c => b -> FreeMod c b
ZMod.generator ([Int] -> QPow -> Omega QPow
forall ab. [Int] -> ab -> Omega ab
Omega [] (Int -> QPow
QPow Int
n))
smaller :: FreeMod Integer (Omega AB)
smaller = (QPow -> ZMod AB)
-> ZMod (Omega QPow) -> FreeMod Integer (Omega AB)
forall base.
ChernBase base =>
(QPow -> ZMod base) -> ZMod (Omega QPow) -> ZMod (Omega base)
umbralSubstQPow (\(QPow Int
k) -> Int -> ZMod AB
computeQPolys Int
k) ZMod (Omega QPow)
umbSmaller
project :: Omega AB -> AB
project (Omega [Int]
us AB
ab) = case [Int]
us of
[] -> AB
ab
[Int]
_ -> String -> AB
forall a. HasCallStack => String -> a
error (String -> AB) -> String -> AB
forall a b. (a -> b) -> a -> b
$ String
"computeQPolys: cannot project u terms:\n " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FreeMod Integer (Omega AB) -> String
forall a. Pretty a => a -> String
pretty FreeMod Integer (Omega AB)
almost
formulaQPoly :: ChernBase base => Int -> ZMod base
formulaQPoly :: Int -> ZMod base
formulaQPoly Int
n = (ZMod AB, FreeMod Integer Chern) -> ChernBase base => ZMod base
forall (f :: * -> *) base.
(f AB, f Chern) -> ChernBase base => f base
select1
( Int -> ZMod AB
formulaQPolyAB Int
n
, Int -> FreeMod Integer Chern
formulaQPolyChern Int
n
)
formulaQPolyAB :: Int -> ZMod AB
formulaQPolyAB :: Int -> ZMod AB
formulaQPolyAB = ZMod AB -> Int -> (Int -> ZMod AB) -> Int -> ZMod AB
forall a. a -> Int -> (Int -> a) -> Int -> a
icache' ZMod AB
forall c b. FreeMod c b
ZMod.zero (-Int
3) Int -> ZMod AB
calcQPoly where
calcQPoly :: Int -> ZMod AB
calcQPoly :: Int -> ZMod AB
calcQPoly Int
n
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< -Int
3 = ZMod AB
forall c b. FreeMod c b
ZMod.zero
| Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== -Int
3 = Integer -> ZMod AB
forall b c. (Monoid b, Eq c, Num c) => c -> FreeMod c b
ZMod.konst Integer
1
| Bool
otherwise = ZMod AB
mult1 ZMod AB -> ZMod AB -> ZMod AB
forall a. Num a => a -> a -> a
* ZMod AB
prev1 ZMod AB -> ZMod AB -> ZMod AB
forall a. Num a => a -> a -> a
+ ZMod AB
mult2 ZMod AB -> ZMod AB -> ZMod AB
forall a. Num a => a -> a -> a
* ZMod AB
prev2
where
prev1 :: ZMod AB
prev1 = Int -> ZMod AB
formulaQPolyAB (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)
prev2 :: ZMod AB
prev2 = Int -> ZMod AB
formulaQPolyAB (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
2)
Pair ZMod AB
mult1 ZMod AB
mult2 = Int -> Pair (ZMod AB)
forall base. ChernBase base => Int -> Pair (ZMod base)
qpolyRecursionCoeffs Int
n
formulaQPolyChern :: Int -> ZMod Chern
formulaQPolyChern :: Int -> FreeMod Integer Chern
formulaQPolyChern = FreeMod Integer Chern
-> Int
-> (Int -> FreeMod Integer Chern)
-> Int
-> FreeMod Integer Chern
forall a. a -> Int -> (Int -> a) -> Int -> a
icache' FreeMod Integer Chern
forall c b. FreeMod c b
ZMod.zero (-Int
3) Int -> FreeMod Integer Chern
calcQPoly where
calcQPoly :: Int -> ZMod Chern
calcQPoly :: Int -> FreeMod Integer Chern
calcQPoly Int
n
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< -Int
3 = FreeMod Integer Chern
forall c b. FreeMod c b
ZMod.zero
| Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== -Int
3 = Integer -> FreeMod Integer Chern
forall b c. (Monoid b, Eq c, Num c) => c -> FreeMod c b
ZMod.konst Integer
1
| Bool
otherwise = FreeMod Integer Chern
mult1 FreeMod Integer Chern
-> FreeMod Integer Chern -> FreeMod Integer Chern
forall a. Num a => a -> a -> a
* FreeMod Integer Chern
prev1 FreeMod Integer Chern
-> FreeMod Integer Chern -> FreeMod Integer Chern
forall a. Num a => a -> a -> a
+ FreeMod Integer Chern
mult2 FreeMod Integer Chern
-> FreeMod Integer Chern -> FreeMod Integer Chern
forall a. Num a => a -> a -> a
* FreeMod Integer Chern
prev2
where
nn :: Integer
nn = Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n :: Integer
prev1 :: FreeMod Integer Chern
prev1 = Int -> FreeMod Integer Chern
formulaQPolyChern (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)
prev2 :: FreeMod Integer Chern
prev2 = Int -> FreeMod Integer Chern
formulaQPolyChern (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
2)
Pair FreeMod Integer Chern
mult1 FreeMod Integer Chern
mult2 = Int -> Pair (FreeMod Integer Chern)
forall base. ChernBase base => Int -> Pair (ZMod base)
qpolyRecursionCoeffs Int
n
qpolyRecursionCoeffs :: ChernBase base => Int -> Pair (ZMod base)
qpolyRecursionCoeffs :: Int -> Pair (ZMod base)
qpolyRecursionCoeffs Int
n = (Pair (ZMod AB), Pair (FreeMod Integer Chern))
-> ChernBase base => Pair (ZMod base)
forall (f :: * -> *) (g :: * -> *) base.
(f (g AB), f (g Chern)) -> ChernBase base => f (g base)
select2
( ZMod AB -> ZMod AB -> Pair (ZMod AB)
forall a. a -> a -> Pair a
Pair ZMod AB
mult1_AB ZMod AB
mult2_AB
, FreeMod Integer Chern
-> FreeMod Integer Chern -> Pair (FreeMod Integer Chern)
forall a. a -> a -> Pair a
Pair FreeMod Integer Chern
mult1_Chern FreeMod Integer Chern
mult2_Chern
)
where
mult1_AB :: ZMod AB
mult1_AB = [(AB, Integer)] -> ZMod AB
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ( Int -> Int -> AB
AB Int
0 Int
0 , Integer
1 )
, ( Int -> Int -> AB
AB Int
1 Int
0 , -Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
-Integer
1 )
, ( Int -> Int -> AB
AB Int
0 Int
1 , -Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
-Integer
1 )
]
mult2_AB :: ZMod AB
mult2_AB = AB -> Integer -> ZMod AB
forall b c. (Ord b, Num c, Eq c) => b -> c -> FreeMod c b
ZMod.singleton (Int -> Int -> AB
AB Int
1 Int
1) (-(Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
-Integer
1)Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
*(Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
+Integer
2))
mult1_Chern :: FreeMod Integer Chern
mult1_Chern = [(Chern, Integer)] -> FreeMod Integer Chern
forall c b. (Eq c, Num c, Ord b) => [(b, c)] -> FreeMod c b
ZMod.fromList
[ ( Int -> Int -> Chern
Chern Int
0 Int
0 , Integer
1 )
, ( Int -> Int -> Chern
Chern Int
1 Int
0 , -Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
-Integer
1 )
]
mult2_Chern :: FreeMod Integer Chern
mult2_Chern = Chern -> Integer -> FreeMod Integer Chern
forall b c. (Ord b, Num c, Eq c) => b -> c -> FreeMod c b
ZMod.singleton (Int -> Int -> Chern
Chern Int
0 Int
1) (-(Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
-Integer
1)Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
*(Integer
nnInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
+Integer
2))
nn :: Integer
nn = Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n :: Integer
formulaDistinctCSM :: ChernBase base => Int -> ZMod (Omega base)
formulaDistinctCSM :: Int -> ZMod (Omega base)
formulaDistinctCSM Int
n
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
0 = String -> ZMod (Omega base)
forall a. HasCallStack => String -> a
error String
"formulaDistinctCSM: dimension should be nonnegative"
| Bool
otherwise = (QPow -> ZMod base) -> ZMod (Omega QPow) -> ZMod (Omega base)
forall base.
ChernBase base =>
(QPow -> ZMod base) -> ZMod (Omega QPow) -> ZMod (Omega base)
umbralSubstQPow QPow -> ZMod base
forall base. ChernBase base => QPow -> ZMod base
fun
(ZMod (Omega QPow) -> ZMod (Omega base))
-> ZMod (Omega QPow) -> ZMod (Omega base)
forall a b. (a -> b) -> a -> b
$ Int -> ZMod (Omega QPow)
umbralDistinctFormula Int
n
where
fun :: QPow -> ZMod base
fun (QPow Int
k) = Int -> ZMod base
forall base. ChernBase base => Int -> ZMod base
formulaQPoly Int
k
formulaAnyStratumCSM :: ChernBase base => SetPartition -> ZMod (Omega base)
formulaAnyStratumCSM :: SetPartition -> ZMod (Omega base)
formulaAnyStratumCSM SetPartition
setp = FreeMod Integer (Eta base) -> ZMod (Omega base)
forall coeff ab.
(Eq coeff, Num coeff, Ord ab) =>
FreeMod coeff (Eta ab) -> FreeMod coeff (Omega ab)
unsafeEtaToOmega (FreeMod Integer (Eta base) -> ZMod (Omega base))
-> FreeMod Integer (Eta base) -> ZMod (Omega base)
forall a b. (a -> b) -> a -> b
$ SetPartition -> ZMod (Omega base) -> FreeMod Integer (Eta base)
forall base.
ChernBase base =>
SetPartition -> ZMod (Omega base) -> ZMod (Eta base)
delta_star SetPartition
setp (Int -> ZMod (Omega base)
forall base. ChernBase base => Int -> ZMod (Omega base)
formulaDistinctCSM Int
k) where
k :: Int
k = SetPartition -> Int
forall a. HasNumberOfParts a => a -> Int
numberOfParts SetPartition
setp