{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
module OAlg.Entity.Diagram.Quiver
(
Quiver(..), qvOrientations
, coQuiver, coQuiverInv
) where
import Data.Typeable
import OAlg.Prelude
import OAlg.Structure.Oriented
import OAlg.Entity.Natural
import OAlg.Entity.FinList
data Quiver n m = Quiver (Any n) (FinList m (Orientation N))
deriving (Int -> Quiver n m -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (n :: N') (m :: N'). Int -> Quiver n m -> ShowS
forall (n :: N') (m :: N'). [Quiver n m] -> ShowS
forall (n :: N') (m :: N'). Quiver n m -> String
showList :: [Quiver n m] -> ShowS
$cshowList :: forall (n :: N') (m :: N'). [Quiver n m] -> ShowS
show :: Quiver n m -> String
$cshow :: forall (n :: N') (m :: N'). Quiver n m -> String
showsPrec :: Int -> Quiver n m -> ShowS
$cshowsPrec :: forall (n :: N') (m :: N'). Int -> Quiver n m -> ShowS
Show, Quiver n m -> Quiver n m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (n :: N') (m :: N'). Quiver n m -> Quiver n m -> Bool
/= :: Quiver n m -> Quiver n m -> Bool
$c/= :: forall (n :: N') (m :: N'). Quiver n m -> Quiver n m -> Bool
== :: Quiver n m -> Quiver n m -> Bool
$c== :: forall (n :: N') (m :: N'). Quiver n m -> Quiver n m -> Bool
Eq)
qvOrientations :: Quiver n m -> FinList m (Orientation N)
qvOrientations :: forall (n :: N') (m :: N'). Quiver n m -> FinList m (Orientation N)
qvOrientations (Quiver Any n
_ FinList m (Orientation N)
os) = FinList m (Orientation N)
os
instance Validable (Quiver n m) where
valid :: Quiver n m -> Statement
valid (Quiver Any n
wn FinList m (Orientation N)
os) = forall (m :: N'). N -> N -> FinList m (Orientation N) -> Statement
vld N
0 (forall x. LengthN x => x -> N
lengthN Any n
wn) FinList m (Orientation N)
os where
vld :: N -> N -> FinList m (Orientation N) -> Statement
vld :: forall (m :: N'). N -> N -> FinList m (Orientation N) -> Statement
vld N
_ N
_ FinList m (Orientation N)
Nil = Statement
SValid
vld N
j N
n ((N
s :> N
e):|FinList n (Orientation N)
os)
= [Statement] -> Statement
And [ (N
s forall a. Ord a => a -> a -> Bool
< N
n) Bool -> Message -> Statement
:?> [Parameter] -> Message
Params [String
"(j,s,n)"String -> String -> Parameter
:= forall a. Show a => a -> String
show (N
j,N
s,N
n)]
, (N
e forall a. Ord a => a -> a -> Bool
< N
n) Bool -> Message -> Statement
:?> [Parameter] -> Message
Params [String
"(j,e,n)"String -> String -> Parameter
:= forall a. Show a => a -> String
show (N
j,N
e,N
n)]
, forall (m :: N'). N -> N -> FinList m (Orientation N) -> Statement
vld (forall a. Enum a => a -> a
succ N
j) N
n FinList n (Orientation N)
os
]
instance (Typeable n, Typeable m) => Entity (Quiver n m)
type instance Dual (Quiver n m) = Quiver n m
coQuiver :: Quiver n m -> Dual (Quiver n m)
coQuiver :: forall (n :: N') (m :: N'). Quiver n m -> Dual (Quiver n m)
coQuiver (Quiver Any n
wn FinList m (Orientation N)
os) = forall (n :: N') (m :: N').
Any n -> FinList m (Orientation N) -> Quiver n m
Quiver Any n
wn (forall (h :: * -> * -> *) (f :: * -> *) a b.
Applicative1 h f =>
h a b -> f a -> f b
amap1 forall p. Orientation p -> Orientation p
opposite FinList m (Orientation N)
os)
coQuiverInv :: Dual (Quiver n m) -> Quiver n m
coQuiverInv :: forall (n :: N') (m :: N'). Dual (Quiver n m) -> Quiver n m
coQuiverInv = forall (n :: N') (m :: N'). Quiver n m -> Dual (Quiver n m)
coQuiver