-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Algebraic structures on oriented entities and limits as a tool kit to solve algebraic problems.
--
-- Basic definition of algebraic structures on oriented entities.
--
-- First of all we define entities
-- (OAlg.Entity.Definition). Based on them and since we look at
-- algebra through the lens of categories, we define oriented
-- (OAlg.Structure.Oriented.Definition) structures on which, by
-- means of a suitable partially defined multiplication,
-- multiplicative
-- (OAlg.Structure.Multiplicative.Definition) structures are
-- defined. If one provides such a multiplicative structure with a
-- matching additive (OAlg.Structure.Additive.Definition)
-- structure, one obtains distributive
-- (OAlg.Structure.Distributive.Definition) structures on which
-- matrices (OAlg.Entity.Matrix.Definition) are build. If
-- an additive structure is provided with a matching scalar
-- multiplication, vectorial
-- (OAlg.Structure.Vectorial.Definition) structures are obtained,
-- which then form - together with the distributive structures - the
-- basis for algebraic
-- (OAlg.Structure.Algebraic.Definition) structures
--
-- Limits (OAlg.Limes.Limits) - in context of categories -
-- serve as a backbone for solving algebraic problems, e. g. finding all
-- solutions of the equation a * x == 0 is given by the
-- kernel (OAlg.Limes.KernelsAndCokernels) of a.
--
-- Particular attention is paid to the duality
-- (OAlg.Data.Dualisable) of concepts - viewed through the lens of
-- categories - so that the implementation of the dual concept could be
-- traced back to the original one to avoid duplicate or redundant
-- implementation efforts.
--
-- A central feature in this package is that all functions defined here -
-- unless otherwise stated - are total and means if the input values
-- are valid (OAlg.Data.Validable) then the resulting value
-- is also valid. Most functions do not check their preconditions.
-- Therefore, all data structures defined here are provided with a
-- property section that is translated into a corresponding
-- statement (OAlg.Data.Statement.Definition) so that they
-- can be validated (OAlg.Control.Validate) as needed. If
-- there is an exception to this rule - such as for partially defined
-- algebraic operators - the rule is extended by if the input values
-- are valid and fulfill the additional required properties, then the
-- resulting value is also valid. Most of the algebraic operators do
-- check there additional required preconditions.
--
-- Since the algebraic operators - such as (*), (+),
-- (.)... - have been redefined here, one should exclude the
-- standard Prelude when using this package, to avoid ambiguity, and use
-- the Prelude (OAlg.Prelude) provided here.
--
-- Throughout the descripitions in this package we denote type variables
-- in bold lower case letters to distinguishing them from
-- variables for values of a type.
--
-- Since we take the view that a value of a data structure or an instance
-- of a class must strictly fulfill the required properties to be valid,
-- Double, for example, has not been implemented as a numerical type.
--
-- Please see also the README on GitHub at
-- https://github.com/zErichGut/oalg-main/blob/main/oalg-base/README.md
@package oalg-base
@version 1.1.4.0
-- | Actions over a state type, i.e. statefull evaluation.
module OAlg.Control.Action
-- | action over a state s.
newtype Action s x
Action :: (s -> (x, s)) -> Action s x
-- | running an action on the gicen state.
run :: Action s x -> s -> (x, s)
-- | gets the state.
getState :: Action s s
-- | sets the state.
setState :: s -> Action s s
instance GHC.Base.Functor (OAlg.Control.Action.Action s)
instance GHC.Base.Applicative (OAlg.Control.Action.Action s)
instance GHC.Base.Monad (OAlg.Control.Action.Action s)
-- | General algebraic exceptions.
module OAlg.Control.Exception
-- | embedding an exception into SomeOAlgException.
oalgExceptionToException :: Exception e => e -> SomeException
-- | casting an exception to SomeOAlgException.
oalgExceptionFromException :: Exception e => SomeException -> Maybe e
-- | The root exception for all algebraic exceptions.
data SomeOAlgException
SomeOAlgException :: e -> SomeOAlgException
-- | general algebraic exception which are sub exceptions of
-- SomeOAlgException.
data AlgebraicException
AlgebraicException :: String -> AlgebraicException
Undefined :: String -> AlgebraicException
ImplementationError :: String -> AlgebraicException
NoPredecor :: AlgebraicException
InvalidData :: String -> AlgebraicException
-- | message for implementation errors. Mainly used for non-permissible or
-- unreachable patterns.
implementation :: String
-- | Any type that you wish to throw or catch as an exception must be an
-- instance of the Exception class. The simplest case is a new
-- exception type directly below the root:
--
--
-- data MyException = ThisException | ThatException
-- deriving Show
--
-- instance Exception MyException
--
--
-- The default method definitions in the Exception class do what
-- we need in this case. You can now throw and catch
-- ThisException and ThatException as exceptions:
--
--
-- *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
-- Caught ThisException
--
--
-- In more complicated examples, you may wish to define a whole hierarchy
-- of exceptions:
--
--
-- ---------------------------------------------------------------------
-- -- Make the root exception type for all the exceptions in a compiler
--
-- data SomeCompilerException = forall e . Exception e => SomeCompilerException e
--
-- instance Show SomeCompilerException where
-- show (SomeCompilerException e) = show e
--
-- instance Exception SomeCompilerException
--
-- compilerExceptionToException :: Exception e => e -> SomeException
-- compilerExceptionToException = toException . SomeCompilerException
--
-- compilerExceptionFromException :: Exception e => SomeException -> Maybe e
-- compilerExceptionFromException x = do
-- SomeCompilerException a <- fromException x
-- cast a
--
-- ---------------------------------------------------------------------
-- -- Make a subhierarchy for exceptions in the frontend of the compiler
--
-- data SomeFrontendException = forall e . Exception e => SomeFrontendException e
--
-- instance Show SomeFrontendException where
-- show (SomeFrontendException e) = show e
--
-- instance Exception SomeFrontendException where
-- toException = compilerExceptionToException
-- fromException = compilerExceptionFromException
--
-- frontendExceptionToException :: Exception e => e -> SomeException
-- frontendExceptionToException = toException . SomeFrontendException
--
-- frontendExceptionFromException :: Exception e => SomeException -> Maybe e
-- frontendExceptionFromException x = do
-- SomeFrontendException a <- fromException x
-- cast a
--
-- ---------------------------------------------------------------------
-- -- Make an exception type for a particular frontend compiler exception
--
-- data MismatchedParentheses = MismatchedParentheses
-- deriving Show
--
-- instance Exception MismatchedParentheses where
-- toException = frontendExceptionToException
-- fromException = frontendExceptionFromException
--
--
-- We can now catch a MismatchedParentheses exception as
-- MismatchedParentheses, SomeFrontendException or
-- SomeCompilerException, but not other types, e.g.
-- IOException:
--
--
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
-- *** Exception: MismatchedParentheses
--
class (Typeable e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e
-- | Render this exception value in a human-friendly manner.
--
-- Default implementation: show.
displayException :: Exception e => e -> String
-- | Throw an exception. Exceptions may be thrown from purely functional
-- code, but may only be caught within the IO monad.
throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a
instance GHC.Show.Show OAlg.Control.Exception.AlgebraicException
instance GHC.Exception.Type.Exception OAlg.Control.Exception.AlgebraicException
instance GHC.Show.Show OAlg.Control.Exception.SomeOAlgException
instance GHC.Exception.Type.Exception OAlg.Control.Exception.SomeOAlgException
-- | reducing a value to head normal form. This is much weaker then
-- Control.DeepSeq.
module OAlg.Control.HNFData
-- | values in head normal form.
data HNFValue x
HNFValue :: x -> HNFValue x
Failure :: e -> HNFValue x
-- | from head normal form.
--
-- Property Let x' be in HNFValue
-- x then holds:
--
--
-- - If x' matches HNFValue x then the result
-- of fromHNFValue x' is x.
-- - If x' matches Failure e then evaluation
-- fromHNFValue x' will end up in a throwing
-- e.
--
fromHNFValue :: HNFValue x -> x
-- | data reducible to head normal form.
class HNFData x
-- | tries to reduce a value to its head normal form, throwing an
-- Exception for undefined values.
rhnf :: HNFData x => x -> ()
-- | tries to reduce a value x to its head normal form. If the
-- reduction ends up in a SomeException e then this will
-- be catched and Failure e will be returned, otherwise
-- @HNFValue will be returned.
hnfValue :: HNFData x => x -> IO (HNFValue x)
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Control.HNFData.HNFValue x)
instance OAlg.Control.HNFData.HNFData ()
instance OAlg.Control.HNFData.HNFData GHC.Types.Bool
instance OAlg.Control.HNFData.HNFData [x]
instance GHC.Base.Functor OAlg.Control.HNFData.HNFValue
-- | A monad to express solving algebraic problems which may fail.
--
-- Note To express algebraic unsolvable - e.g determine the
-- multiplicative inverse of 0 - one should only use the
-- failure mechanism from this module (see examples in
-- solvable).
module OAlg.Control.Solver
-- | monad to solve algebraic problems which may fail because it is not
-- solvable or ...
data Solver x
-- | throwing exception in to Solver to express unsolvable.
failure :: Exception e => e -> Solver x
-- | handling exception.
--
-- Note Only exceptions expressed via the failure
-- mechanism can be handled by handle!
handle :: Exception e => Solver x -> (e -> Solver x) -> Solver x
-- | extracting the solution from the solver. If during solving an
-- exception e occurs, then e will be thrown via the
-- regular throw mechanism of Exception.
--
-- Note solve extracts the solution lazy!
solve :: Solver x -> x
-- | checks for solvability of a algebraic problem represented be a solver
-- s (see also solve).
solvable :: Solver r -> Bool
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Control.Solver.Solver x)
instance GHC.Base.Functor OAlg.Control.Solver.Solver
instance GHC.Base.Applicative OAlg.Control.Solver.Solver
instance GHC.Base.Monad OAlg.Control.Solver.Solver
-- | constructing values by there Form..
module OAlg.Data.Constructable
-- | types with an associated form, which serves as a
-- blueprint to construct a corresponding value.
--
-- A common setting for this structure is a module with a reducible type
-- f (see Reducible) with public
-- constructors - which serves as a form to be filled out - and in the
-- same module a type e with a private constructor - lets say
-- E - to hold the reduced f. Than an
-- implementation would be
--
--
-- make f = E (reduce f)
--
--
-- and
--
--
-- form (E f) = f
--
--
-- Property Let x be an instance of the class
-- Constructable than holds: For all x in
-- x holds: make (form x) ==
-- x.
class Exposable x => Constructable x
-- | constructor.
make :: Constructable x => Form x -> x
-- | restriction of a f in Form x ->
-- Form y.
cmap :: (Constructable x, Constructable y) => (Form x -> Form y) -> x -> y
-- | types with an associated form type and a function form
-- which exposes its values to its form.
class Exposable x where {
-- | the form.
type Form x;
}
-- | the associated form.
form :: Exposable x => x -> Form x
-- | restriction of a f in Form x -> y.
restrict :: Exposable x => (Form x -> y) -> x -> y
-- | data admitting a kind of duality.
module OAlg.Data.Dualisable
-- | the assigned dual kind.
type family Dual (x :: k) :: k
-- | admitting a duality.
--
-- Property Let x be Dualisable, than
-- holds: toDual is a bijection with its inverse fromDual.
class Dualisable x
toDual :: Dualisable x => x -> Dual x
fromDual :: Dualisable x => Dual x -> x
-- | fromDual enriched with a parameterized type p
-- which serves as a proxy - e.g. Proxy or Id will serve -
-- and will not be evaluated. It serves for the type checker to pick the
-- right fromDual.
fromDual' :: Dualisable x => p x -> Dual x -> x
-- | admitting reflection.
--
-- Property Let x be Reflexive, than holds:
--
--
-- - toBidual is a bijection with its inverse
-- fromBidual.
--
class Reflexive x
toBidual :: Reflexive x => x -> Dual (Dual x)
fromBidual :: Reflexive x => Dual (Dual x) -> x
-- | fromBidual enriched with a parameterized type p
-- which serves as a proxy - e.g. Proxy or Id will serve
-- - and will not be evaluated. It serves for the type checker to pick
-- the right fromBidual.
fromBidual' :: Reflexive x => p x -> Dual (Dual x) -> x
-- | transposable types..
--
-- Property Let x be a Transposable, then
-- holds: For all x in x holds:
-- transpose (transpose x) == x.
class Transposable x
transpose :: Transposable x => x -> x
-- | concept of the sites From and To.
data Site
From :: Site
To :: Site
-- | concept of sides LeftSide and RightSide
data Side
LeftSide :: Side
RightSide :: Side
-- | concept of the directions LeftToRight and RightToLeft.
data Direction
LeftToRight :: Direction
RightToLeft :: Direction
instance GHC.Enum.Bounded OAlg.Data.Dualisable.Site
instance GHC.Enum.Enum OAlg.Data.Dualisable.Site
instance GHC.Classes.Ord OAlg.Data.Dualisable.Site
instance GHC.Classes.Eq OAlg.Data.Dualisable.Site
instance GHC.Show.Show OAlg.Data.Dualisable.Site
instance GHC.Enum.Bounded OAlg.Data.Dualisable.Side
instance GHC.Enum.Enum OAlg.Data.Dualisable.Side
instance GHC.Classes.Ord OAlg.Data.Dualisable.Side
instance GHC.Classes.Eq OAlg.Data.Dualisable.Side
instance GHC.Show.Show OAlg.Data.Dualisable.Side
instance GHC.Enum.Bounded OAlg.Data.Dualisable.Direction
instance GHC.Enum.Enum OAlg.Data.Dualisable.Direction
instance GHC.Classes.Ord OAlg.Data.Dualisable.Direction
instance GHC.Classes.Eq OAlg.Data.Dualisable.Direction
instance GHC.Show.Show OAlg.Data.Dualisable.Direction
instance OAlg.Data.Dualisable.Transposable OAlg.Data.Dualisable.Direction
instance OAlg.Data.Dualisable.Transposable OAlg.Data.Dualisable.Side
instance OAlg.Data.Dualisable.Transposable OAlg.Data.Dualisable.Site
-- | equality on values.
module OAlg.Data.Equal
-- | The Eq class defines equality (==) and inequality
-- (/=). All the basic datatypes exported by the Prelude
-- are instances of Eq, and Eq may be derived for any
-- datatype whose constituents are also instances of Eq.
--
-- The Haskell Report defines no laws for Eq. However, instances
-- are encouraged to follow these properties:
--
--
-- - Reflexivity x == x = True
-- - Symmetry x == y = y == x
-- - Transitivity if x == y && y == z =
-- True, then x == z = True
-- - Extensionality if x == y = True and
-- f is a function whose return type is an instance of
-- Eq, then f x == f y = True
-- - Negation x /= y = not (x ==
-- y)
--
--
-- Minimal complete definition: either == or /=.
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
infix 4 ==
infix 4 /=
-- | equal.
eql :: (a -> a -> Ordering) -> a -> a -> Bool
-- | not greater than.
ngt :: (a -> a -> Ordering) -> a -> a -> Bool
-- | equality on values for one parameterized types.
class Eq1 p
eq1 :: Eq1 p => p x -> p x -> Bool
eq1 :: (Eq1 p, Eq (p x)) => p x -> p x -> Bool
-- | equality on values for two parameterized types.
--
-- Note We use this class meanly in the context of Path.
class Eq2 h
eq2 :: Eq2 h => h x y -> h x y -> Bool
eq2 :: (Eq2 h, Eq (h x y)) => h x y -> h x y -> Bool
instance OAlg.Data.Equal.Eq1 Data.Proxy.Proxy
-- | identical predicate.
module OAlg.Data.Identity
-- | identical predicate.
newtype Id x
Id :: x -> Id x
-- | deconstructs Id.
fromId :: Id x -> x
-- | transforming a f :: x -> Id y to a f' :: x
-- -> i z.
trafoFromId :: (y -> i z) -> (x -> Id y) -> x -> i z
-- | transforming a f :: x -> y to a f' :: x -> Id
-- y.
trafoToId :: (x -> y) -> x -> Id y
instance Data.Foldable.Foldable OAlg.Data.Identity.Id
instance GHC.Base.Functor OAlg.Data.Identity.Id
instance GHC.Enum.Bounded x => GHC.Enum.Bounded (OAlg.Data.Identity.Id x)
instance GHC.Enum.Enum x => GHC.Enum.Enum (OAlg.Data.Identity.Id x)
instance GHC.Classes.Ord x => GHC.Classes.Ord (OAlg.Data.Identity.Id x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (OAlg.Data.Identity.Id x)
instance GHC.Read.Read x => GHC.Read.Read (OAlg.Data.Identity.Id x)
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Data.Identity.Id x)
-- | Maybe.
module OAlg.Data.Maybe
-- | just p a == Just a if and only if p a.
just :: (a -> Bool) -> a -> Maybe a
-- | gets all the Justs - if there are any.
exstJust :: [Maybe v] -> Maybe [v]
-- | Data.Ord enriched with some additional elements.
module OAlg.Data.Ord
-- | comparing according to the mapped values.
fcompare :: Ord i => (a -> i) -> a -> a -> Ordering
-- | comparing according to the given ordering relation on the mapped
-- values.
wcompare :: (w -> w -> Ordering) -> (a -> w) -> a -> a -> Ordering
-- | the reverse ordering
coCompare :: (a -> a -> Ordering) -> a -> a -> Ordering
-- | comparing of pairs.
compare2 :: (a -> a -> Ordering) -> (b -> b -> Ordering) -> (a, b) -> (a, b) -> Ordering
-- | sorting according to the first component.
sortFst :: Ord a => [(a, b)] -> [(a, b)]
-- | sorting according to the first component.
sortFstBy :: (a -> a -> Ordering) -> [(a, b)] -> [(a, b)]
-- | sorting according to the second component.
sortSnd :: Ord b => [(a, b)] -> [(a, b)]
-- | sorting according to the second component.
sortSndBy :: (b -> b -> Ordering) -> [(a, b)] -> [(a, b)]
-- | the closer of a linear ordered x.
data Closer x
NegInf :: Closer x
It :: x -> Closer x
PosInf :: Closer x
-- | the minimum of the items of a list, i.e. the biggest lower bound.
--
-- Property Let xs be in [x] for a linear
-- ordered x, then holds: For all x in
-- xs holds: cmin xs <= It x.
cmin :: Ord x => [x] -> Closer x
-- | the maximum of the items of a list, i.e. the smallest upper bound.
--
-- Property Let xs be in [x] for a linear
-- ordered x, then holds: For all x in
-- xs holds: It x <= cmax xs.
cmax :: Ord x => [x] -> Closer x
-- | (l,u) = cspan xs where l is the minimum and
-- u the maximum of the items in xs.
--
-- Example
--
--
-- >>> cspan "aeb"
-- (It 'a',It 'e')
--
--
--
-- >>> cspan ""
-- (PosInf,NegInf)
--
cspan :: Ord x => [x] -> Span x
-- | the span type.
type Span x = (Closer x, Closer x)
-- | enumSpan i0 h enumerates the index, starting by
-- i0 to h.
enumSpan :: (Enum i, Ord i) => i -> Closer i -> [i]
-- | partially ordered types.
--
-- Properties Let a be an instance of POrd,
-- then holds:
--
--
-- - For all x in a holds: x
-- <<= x.
-- - For all x, y in a holds: If
-- x <<= y and y <<= x then
-- x == y.
-- - For all x, y, z in a
-- holds: If x <<= y and y <<=
-- z then x <<= z.
--
class Eq a => POrd a
(<<=) :: POrd a => a -> a -> Bool
infix 4 <<=
instance GHC.Classes.Ord x => GHC.Classes.Ord (OAlg.Data.Ord.Closer x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (OAlg.Data.Ord.Closer x)
instance GHC.Read.Read x => GHC.Read.Read (OAlg.Data.Ord.Closer x)
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Data.Ord.Closer x)
-- | reducing values to there canonical value.
module OAlg.Data.Reducible
-- | types admitting reducible values.
--
-- Definition reduce e is called the
-- algebraic value of e.
--
-- Reducing an e twice yield the 'same' value and the idea is
-- that in an algebraic calculation it will be 'safe' to substitute any
-- occurrence of e by its reduced value, i.e. both calculations
-- will yield the same result.
--
-- Property Let e be a reducible type admitting
-- equality, then for all e in e holds:
-- reduce (reduce e) == reduce e.
class Reducible e
-- | reducing e to its algebraic value.
--
-- Note The default implementation is reduce =
-- id.
reduce :: Reducible e => e -> e
-- | reduces x by the given rules until no more reductions are
-- applicable.
reduceWith :: (x -> Rdc x) -> x -> x
-- | composition of two reductions.
(>>>=) :: (x -> Rdc x) -> (x -> Rdc x) -> x -> Rdc x
infixr 1 >>>=
-- | Action according to the state type RdcState.
type Rdc = Action RdcState
-- | reduction state.
data RdcState
-- | no reduction has been applied.
Unchanged :: RdcState
-- | a reduction has been applied.
Changed :: RdcState
-- | indicates that a term has the given reduction step, i.e. returns the
-- given value and sets the state to Changed.
reducesTo :: x -> Rdc x
instance GHC.Enum.Bounded OAlg.Data.Reducible.RdcState
instance GHC.Enum.Enum OAlg.Data.Reducible.RdcState
instance GHC.Classes.Ord OAlg.Data.Reducible.RdcState
instance GHC.Classes.Eq OAlg.Data.Reducible.RdcState
instance GHC.Read.Read OAlg.Data.Reducible.RdcState
instance GHC.Show.Show OAlg.Data.Reducible.RdcState
-- | showing data with some auxiliary functions.
module OAlg.Data.Show
-- | Conversion of values to readable Strings.
--
-- Derived instances of Show have the following properties, which
-- are compatible with derived instances of Read:
--
--
-- - The result of show is a syntactically correct Haskell
-- expression containing only constants, given the fixity declarations in
-- force at the point where the type is declared. It contains only the
-- constructor names defined in the data type, parentheses, and spaces.
-- When labelled constructor fields are used, braces, commas, field
-- names, and equal signs are also used.
-- - If the constructor is defined to be an infix operator, then
-- showsPrec will produce infix applications of the
-- constructor.
-- - the representation will be enclosed in parentheses if the
-- precedence of the top-level constructor in x is less than
-- d (associativity is ignored). Thus, if d is
-- 0 then the result is never surrounded in parentheses; if
-- d is 11 it is always surrounded in parentheses,
-- unless it is an atomic expression.
-- - If the constructor is defined using record syntax, then
-- show will produce the record-syntax form, with the fields given
-- in the same order as the original declaration.
--
--
-- For example, given the declarations
--
--
-- infixr 5 :^:
-- data Tree a = Leaf a | Tree a :^: Tree a
--
--
-- the derived instance of Show is equivalent to
--
--
-- instance (Show a) => Show (Tree a) where
--
-- showsPrec d (Leaf m) = showParen (d > app_prec) $
-- showString "Leaf " . showsPrec (app_prec+1) m
-- where app_prec = 10
--
-- showsPrec d (u :^: v) = showParen (d > up_prec) $
-- showsPrec (up_prec+1) u .
-- showString " :^: " .
-- showsPrec (up_prec+1) v
-- where up_prec = 5
--
--
-- Note that right-associativity of :^: is ignored. For example,
--
--
-- - show (Leaf 1 :^: Leaf 2 :^: Leaf 3) produces the
-- string "Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
--
class Show a
-- | Convert a value to a readable String.
--
-- showsPrec should satisfy the law
--
--
-- showsPrec d x r ++ s == showsPrec d x (r ++ s)
--
--
-- Derived instances of Read and Show satisfy the
-- following:
--
--
--
-- That is, readsPrec parses the string produced by
-- showsPrec, and delivers the value that showsPrec started
-- with.
showsPrec :: Show a => Int -> a -> ShowS
-- | A specialised variant of showsPrec, using precedence context
-- zero, and returning an ordinary String.
show :: Show a => a -> String
-- | The method showList is provided to allow the programmer to give
-- a specialised way of showing lists of values. For example, this is
-- used by the predefined Show instance of the Char type,
-- where values of type String should be shown in double quotes,
-- rather than between square brackets.
showList :: Show a => [a] -> ShowS
-- | inserting the given value in between the elements of the given list.
--
-- Examples
--
--
-- >>> tween ',' "12345"
-- "1,2,3,4,5"
--
--
--
-- >>> tween ',' ""
-- ""
--
--
--
-- >>> tween ',' "1"
-- "1"
--
tween :: a -> [a] -> [a]
-- | inserting the given list in between the elements of the given list and
-- joining the result.
--
-- Example
--
--
-- >>> jtween ";" ["abcd","efg"]
-- "abcd;efg"
--
jtween :: [a] -> [[a]] -> [a]
-- | showable for one parameterized types.
class Show1 p
show1 :: Show1 p => p x -> String
show1 :: (Show1 p, Show (p x)) => p x -> String
-- | showable for two parameterized types.
--
-- Note We use this class mearly in the context of Path.
class Show2 h
show2 :: Show2 h => h a b -> String
show2 :: (Show2 h, Show (h a b)) => h a b -> String
-- | A String is a list of characters. String constants in Haskell
-- are values of type String.
--
-- See Data.List for operations on lists.
type String = [Char]
-- | The character type Char is an enumeration whose values
-- represent Unicode (or equivalently ISO/IEC 10646) code points (i.e.
-- characters, see http://www.unicode.org/ for details). This set
-- extends the ISO 8859-1 (Latin-1) character set (the first 256
-- characters), which is itself an extension of the ASCII character set
-- (the first 128 characters). A character literal in Haskell has type
-- Char.
--
-- To convert a Char to or from the corresponding Int value
-- defined by Unicode, use toEnum and fromEnum from the
-- Enum class respectively (or equivalently ord and
-- chr).
data Char
-- | Parsing of Strings, producing values.
--
-- Derived instances of Read make the following assumptions, which
-- derived instances of Show obey:
--
--
-- - If the constructor is defined to be an infix operator, then the
-- derived Read instance will parse only infix applications of the
-- constructor (not the prefix form).
-- - Associativity is not used to reduce the occurrence of parentheses,
-- although precedence may be.
-- - If the constructor is defined using record syntax, the derived
-- Read will parse only the record-syntax form, and furthermore,
-- the fields must be given in the same order as the original
-- declaration.
-- - The derived Read instance allows arbitrary Haskell
-- whitespace between tokens of the input string. Extra parentheses are
-- also allowed.
--
--
-- For example, given the declarations
--
--
-- infixr 5 :^:
-- data Tree a = Leaf a | Tree a :^: Tree a
--
--
-- the derived instance of Read in Haskell 2010 is equivalent to
--
--
-- instance (Read a) => Read (Tree a) where
--
-- readsPrec d r = readParen (d > app_prec)
-- (\r -> [(Leaf m,t) |
-- ("Leaf",s) <- lex r,
-- (m,t) <- readsPrec (app_prec+1) s]) r
--
-- ++ readParen (d > up_prec)
-- (\r -> [(u:^:v,w) |
-- (u,s) <- readsPrec (up_prec+1) r,
-- (":^:",t) <- lex s,
-- (v,w) <- readsPrec (up_prec+1) t]) r
--
-- where app_prec = 10
-- up_prec = 5
--
--
-- Note that right-associativity of :^: is unused.
--
-- The derived instance in GHC is equivalent to
--
--
-- instance (Read a) => Read (Tree a) where
--
-- readPrec = parens $ (prec app_prec $ do
-- Ident "Leaf" <- lexP
-- m <- step readPrec
-- return (Leaf m))
--
-- +++ (prec up_prec $ do
-- u <- step readPrec
-- Symbol ":^:" <- lexP
-- v <- step readPrec
-- return (u :^: v))
--
-- where app_prec = 10
-- up_prec = 5
--
-- readListPrec = readListPrecDefault
--
--
-- Why do both readsPrec and readPrec exist, and why does
-- GHC opt to implement readPrec in derived Read instances
-- instead of readsPrec? The reason is that readsPrec is
-- based on the ReadS type, and although ReadS is mentioned
-- in the Haskell 2010 Report, it is not a very efficient parser data
-- structure.
--
-- readPrec, on the other hand, is based on a much more efficient
-- ReadPrec datatype (a.k.a "new-style parsers"), but its
-- definition relies on the use of the RankNTypes language
-- extension. Therefore, readPrec (and its cousin,
-- readListPrec) are marked as GHC-only. Nevertheless, it is
-- recommended to use readPrec instead of readsPrec
-- whenever possible for the efficiency improvements it brings.
--
-- As mentioned above, derived Read instances in GHC will
-- implement readPrec instead of readsPrec. The default
-- implementations of readsPrec (and its cousin, readList)
-- will simply use readPrec under the hood. If you are writing a
-- Read instance by hand, it is recommended to write it like so:
--
--
-- instance Read T where
-- readPrec = ...
-- readListPrec = readListPrecDefault
--
class Read a
-- | The read function reads input from a string, which must be
-- completely consumed by the input process. read fails with an
-- error if the parse is unsuccessful, and it is therefore
-- discouraged from being used in real applications. Use readMaybe
-- or readEither for safe alternatives.
--
--
-- >>> read "123" :: Int
-- 123
--
--
--
-- >>> read "hello" :: Int
-- *** Exception: Prelude.read: no parse
--
read :: Read a => String -> a
instance OAlg.Data.Show.Show1 Data.Proxy.Proxy
-- | predicate for the opposite.
module OAlg.Data.Opposite
-- | Predicate for the opposite of a type x.
newtype Op x
Op :: x -> Op x
-- | from Op x.
fromOp :: Op x -> x
-- | from Op (Op x).
fromOpOp :: Op (Op x) -> x
-- | Predicat for the opposite of a two parametrized type h
-- where the two parameters x and y are
-- switched
newtype Op2 h x y
Op2 :: h y x -> Op2 h x y
instance GHC.Classes.Eq x => GHC.Classes.Eq (OAlg.Data.Opposite.Op x)
instance GHC.Read.Read x => GHC.Read.Read (OAlg.Data.Opposite.Op x)
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Data.Opposite.Op x)
instance OAlg.Data.Show.Show2 h => OAlg.Data.Show.Show2 (OAlg.Data.Opposite.Op2 h)
instance OAlg.Data.Equal.Eq2 h => OAlg.Data.Equal.Eq2 (OAlg.Data.Opposite.Op2 h)
-- | disjoint union of data.
module OAlg.Data.Either
-- | The Either type represents values with two possibilities: a
-- value of type Either a b is either Left
-- a or Right b.
--
-- The Either type is sometimes used to represent a value which is
-- either correct or an error; by convention, the Left constructor
-- is used to hold an error value and the Right constructor is
-- used to hold a correct value (mnemonic: "right" also means "correct").
--
-- Examples
--
-- The type Either String Int is the type
-- of values which can be either a String or an Int. The
-- Left constructor can be used only on Strings, and the
-- Right constructor can be used only on Ints:
--
--
-- >>> let s = Left "foo" :: Either String Int
--
-- >>> s
-- Left "foo"
--
-- >>> let n = Right 3 :: Either String Int
--
-- >>> n
-- Right 3
--
-- >>> :type s
-- s :: Either String Int
--
-- >>> :type n
-- n :: Either String Int
--
--
-- The fmap from our Functor instance will ignore
-- Left values, but will apply the supplied function to values
-- contained in a Right:
--
--
-- >>> let s = Left "foo" :: Either String Int
--
-- >>> let n = Right 3 :: Either String Int
--
-- >>> fmap (*2) s
-- Left "foo"
--
-- >>> fmap (*2) n
-- Right 6
--
--
-- The Monad instance for Either allows us to chain
-- together multiple actions which may fail, and fail overall if any of
-- the individual steps failed. First we'll write a function that can
-- either parse an Int from a Char, or fail.
--
--
-- >>> import Data.Char ( digitToInt, isDigit )
--
-- >>> :{
-- let parseEither :: Char -> Either String Int
-- parseEither c
-- | isDigit c = Right (digitToInt c)
-- | otherwise = Left "parse error"
--
-- >>> :}
--
--
-- The following should work, since both '1' and '2'
-- can be parsed as Ints.
--
--
-- >>> :{
-- let parseMultiple :: Either String Int
-- parseMultiple = do
-- x <- parseEither '1'
-- y <- parseEither '2'
-- return (x + y)
--
-- >>> :}
--
--
--
-- >>> parseMultiple
-- Right 3
--
--
-- But the following should fail overall, since the first operation where
-- we attempt to parse 'm' as an Int will fail:
--
--
-- >>> :{
-- let parseMultiple :: Either String Int
-- parseMultiple = do
-- x <- parseEither 'm'
-- y <- parseEither '2'
-- return (x + y)
--
-- >>> :}
--
--
--
-- >>> parseMultiple
-- Left "parse error"
--
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b
-- | disjoint union of two parameterized data types.
data Either2 f g a b
[Left2] :: f a b -> Either2 f g a b
[Right2] :: g a b -> Either2 f g a b
instance (OAlg.Data.Show.Show2 f, OAlg.Data.Show.Show2 g) => OAlg.Data.Show.Show2 (OAlg.Data.Either.Either2 f g)
instance (OAlg.Data.Show.Show2 f, OAlg.Data.Show.Show2 g) => GHC.Show.Show (OAlg.Data.Either.Either2 f g x y)
instance (OAlg.Data.Equal.Eq2 f, OAlg.Data.Equal.Eq2 g) => OAlg.Data.Equal.Eq2 (OAlg.Data.Either.Either2 f g)
-- | application on values.
module OAlg.Category.Applicative
-- | family of types having a representation in (->).
class Applicative h
-- | application.
amap :: Applicative h => h a b -> a -> b
-- | right associative application on values.
($) :: Applicative h => h a b -> a -> b
infixr 0 $
-- | family of types having a representation in f a -> f b.
class Applicative1 h f
-- | application.
amap1 :: Applicative1 h f => h a b -> f a -> f b
instance GHC.Base.Functor f => OAlg.Category.Applicative.Applicative1 (->) f
instance OAlg.Category.Applicative.Applicative (->)
instance (OAlg.Category.Applicative.Applicative f, OAlg.Category.Applicative.Applicative g) => OAlg.Category.Applicative.Applicative (OAlg.Data.Either.Either2 f g)
-- | verbosity on showing.
module OAlg.Control.Verbose
-- | shows a in the context of verbosity.
class Show a => Verbose a
-- | the default implementation is: vshow v a = vshowStr
-- (mnString v) (show a)
vshow :: Verbose a => Verbosity -> a -> String
-- | kinds of verbosity.
data Verbosity
Low :: Verbosity
Middle :: Verbosity
High :: Verbosity
Full :: Verbosity
Pretty :: Verbosity
-- | verbosely showing a string by the given length.
--
-- Example
--
--
-- >>> vshowStr (Just 3) "123456789"
-- "123.."
--
--
--
-- >>> vshowStr Nothing "123456789"
-- "123456789"
--
vshowStr :: Maybe Int -> String -> String
-- | default length for a string representation in context of verbosity.
mnString :: Verbosity -> Maybe Int
-- | verbosely showing a list by the given length.
--
-- Examples
--
--
-- >>> vshowList Full (Just 3) "[" "]" "abcdef"
-- "['a','b','c'..]"
--
--
--
-- >>> vshowList Low (Just 3) "{" "}" ["abcdef","ghijklmn","op","qrst","uvwxyz"]
-- "{['a','b'..],['g','h'..],['o','p']..}"
--
vshowList :: Verbose a => Verbosity -> Maybe Int -> String -> String -> [a] -> String
-- | default number of entries for a list representation in context of
-- verbosity.
mnList :: Verbosity -> Maybe Int
-- | tagging for showing percentage of a Double.
newtype Percent x
Percent :: x -> Percent x
-- | showing a double as percent with the given precision.
--
-- Example
--
--
-- >>> showPercent 2 0.912837
-- " 91.28%"
--
showPercent :: Int -> Double -> String
instance GHC.Enum.Bounded OAlg.Control.Verbose.Verbosity
instance GHC.Enum.Enum OAlg.Control.Verbose.Verbosity
instance GHC.Classes.Ord OAlg.Control.Verbose.Verbosity
instance GHC.Classes.Eq OAlg.Control.Verbose.Verbosity
instance GHC.Show.Show OAlg.Control.Verbose.Verbosity
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Control.Verbose.Percent x)
instance OAlg.Control.Verbose.Verbose (OAlg.Control.Verbose.Percent GHC.Types.Double)
instance OAlg.Control.Verbose.Verbose GHC.Types.Char
instance OAlg.Control.Verbose.Verbose GHC.Types.Int
instance OAlg.Control.Verbose.Verbose GHC.Num.Integer.Integer
instance OAlg.Control.Verbose.Verbose a => OAlg.Control.Verbose.Verbose [a]
instance OAlg.Control.Verbose.Verbose GHC.Types.Double
instance OAlg.Control.Verbose.Verbose ()
instance (OAlg.Control.Verbose.Verbose a, OAlg.Control.Verbose.Verbose b) => OAlg.Control.Verbose.Verbose (a, b)
instance (OAlg.Control.Verbose.Verbose a, OAlg.Control.Verbose.Verbose b, OAlg.Control.Verbose.Verbose c) => OAlg.Control.Verbose.Verbose (a, b, c)
instance (OAlg.Control.Verbose.Verbose a, OAlg.Control.Verbose.Verbose b, OAlg.Control.Verbose.Verbose c, OAlg.Control.Verbose.Verbose d) => OAlg.Control.Verbose.Verbose (a, b, c, d)
instance (OAlg.Control.Verbose.Verbose a, OAlg.Control.Verbose.Verbose b, OAlg.Control.Verbose.Verbose c, OAlg.Control.Verbose.Verbose d, OAlg.Control.Verbose.Verbose e) => OAlg.Control.Verbose.Verbose (a, b, c, d, e)
instance (OAlg.Control.Verbose.Verbose a, OAlg.Control.Verbose.Verbose b, OAlg.Control.Verbose.Verbose c, OAlg.Control.Verbose.Verbose d, OAlg.Control.Verbose.Verbose e, OAlg.Control.Verbose.Verbose f) => OAlg.Control.Verbose.Verbose (a, b, c, d, e, f)
-- | singleton types having exactly one value.
module OAlg.Data.Singleton
-- | types s with exactly one value which is called the
-- unit of s.
class Singleton s
unit :: Singleton s => s
-- | one parameterized types s with exactly one element for
-- each x which is called the unit1 of
-- s x.
class Singleton1 s
unit1 :: Singleton1 s => s x
instance OAlg.Data.Singleton.Singleton1 Data.Proxy.Proxy
instance OAlg.Data.Singleton.Singleton ()
instance OAlg.Data.Singleton.Singleton (Data.Proxy.Proxy t)
instance OAlg.Data.Singleton.Singleton u => OAlg.Data.Singleton.Singleton (a -> u)
-- | parameterized types with at most on constructor.
module OAlg.Data.Singular
-- | parameterized types with at most on constructor.
--
-- Definition A type function p is called
-- singular if and only if for each type x
-- there is at most one constructor for p x.
class Eq1 p => Singular p
-- | equivalence of witnesses in p x.
--
-- Note p <==> q returns either True
-- or an ImplementationError will be thrown.
(<==>) :: Singular p => p x -> p x -> Bool
instance OAlg.Data.Singular.Singular Data.Proxy.Proxy
-- | a tool kit for making statistics.
module OAlg.Data.Statistics
-- | makes the statistics of the given list of wight, value pairs.
mkStatisticW :: Ord x => [x -> String] -> [(Int, x)] -> (Int, [(Double, [String], x)])
-- | makes the statistics of the given list of values.
mkStatistic :: Ord x => [x -> String] -> [x] -> (Int, [(Double, [String], x)])
-- | puts the statistics of the given list of wight, values pairs.
putStatisticW :: (Show x, Ord x) => [x -> String] -> [(Int, x)] -> IO ()
-- | puts the statistics of the given list of values.
putStatistic :: (Show x, Ord x) => [x -> String] -> [x] -> IO ()
-- | binary trees for lookup.
module OAlg.Data.Tree
-- | binary tree with node element in i and leaf element in
-- x.
data Tree i x
Node :: i -> Tree i x -> Tree i x -> Tree i x
Leaf :: x -> Tree i x
-- | lookup a value in a binary tree.
lookup :: Ord i => Tree i x -> i -> x
module OAlg.Data.TypeLits
-- | introducing the idiom Hom.
module OAlg.Hom.Definition
-- | parameterized constraint that the values of the type h
-- x y admit the constraints of a homomorphisms
-- between the structures given by s.
type family Hom s (h :: Type -> Type -> Type) :: Constraint
-- | introducing the idiom of Structures as parameterized
-- constraints.
module OAlg.Structure.Definition
-- | parameterized constraint for a type x.
type family Structure s x :: Constraint
-- | attest that the type x admits the constrains given by
-- the parameter s.
data Struct s x
[Struct] :: Structure s x => Struct s x
-- | transforming structural attests.
class Transformable s t
tau :: Transformable s t => Struct s x -> Struct t x
-- | transforming structural attests.
class Transformable1 f s
tau1 :: Transformable1 f s => Struct s x -> Struct s (f x)
-- | helper class to avoid undecidable instances.
class Transformable1 Op s => TransformableOp s
-- | helper class to avoid undecidable instances.
class Transformable s Typ => ForgetfulTyp s
-- | Typeable structures.
data Typ
-- | type for ordered structures.
data Ord'
instance GHC.Show.Show (OAlg.Structure.Definition.Struct s x)
instance GHC.Classes.Eq (OAlg.Structure.Definition.Struct s x)
instance OAlg.Structure.Definition.Transformable s s
instance OAlg.Structure.Definition.Transformable s (*)
instance OAlg.Structure.Definition.Transformable s OAlg.Structure.Definition.Typ => Data.Type.Equality.TestEquality (OAlg.Structure.Definition.Struct s)
instance OAlg.Data.Show.Show1 (OAlg.Structure.Definition.Struct s)
instance OAlg.Data.Equal.Eq1 (OAlg.Structure.Definition.Struct s)
instance OAlg.Data.Singular.Singular (OAlg.Structure.Definition.Struct s)
-- | boolean structure for multivalent logic.
module OAlg.Data.Boolean.Definition
-- | types with a Boolean structure, allowing multivalent logic.
--
-- Note Every Enum type which is also Bounded has a
-- natural implementation as false = minBound,
-- true = maxBound, (||) =
-- max, (&&) = min (as there
-- are min and max bounds the operator (||) and
-- (&&) should be implemented with a lazy variant
-- of min and max) and not b = toEnum
-- (fromEnum maxBound - fromEnum t).
class Boolean b
false :: Boolean b => b
true :: Boolean b => b
not :: Boolean b => b -> b
(||) :: Boolean b => b -> b -> b
or :: Boolean b => [b] -> b
(&&) :: Boolean b => b -> b -> b
and :: Boolean b => [b] -> b
(~>) :: Boolean b => b -> b -> b
(<~>) :: Boolean b => b -> b -> b
eqvl :: Boolean b => [b] -> b
infixr 2 ||
infixr 3 &&
infixr 1 ~>
infixr 1 <~>
data Bool
False :: Bool
True :: Bool
-- | otherwise is defined as the value True. It helps to make
-- guards more readable. eg.
--
--
-- f x | x < 0 = ...
-- | otherwise = ...
--
otherwise :: Bool
-- | type representing Boolean structures.
data Bol
instance OAlg.Data.Boolean.Definition.Boolean GHC.Types.Bool
-- | canonical mappings between two types.
module OAlg.Data.Canonical
-- | canonical embedding from a in to b.
--
-- Property
--
--
-- - inj is injective.
-- - if the two types a and b are also
-- Projectible a b then prj
-- . inj is the identical mapping.
--
class Embeddable a b
-- | canonical injetion from a in to b.
inj :: Embeddable a b => a -> b
-- | canonical projection from b on to a.
--
-- Property
--
--
-- - prj is surjective.
-- - if the two types a and b are also
-- Projectible a b then prj
-- . inj is the identical mapping.
--
class Projectible a b
-- | canonical projection from b on to a
prj :: Projectible a b => b -> a
instance (OAlg.Data.Canonical.Projectible a a', OAlg.Data.Canonical.Projectible b b') => OAlg.Data.Canonical.Projectible (a, b) (a', b')
instance (OAlg.Data.Canonical.Projectible a a', OAlg.Data.Canonical.Projectible b b', OAlg.Data.Canonical.Projectible c c') => OAlg.Data.Canonical.Projectible (a, b, c) (a', b', c')
instance (OAlg.Data.Canonical.Embeddable a a', OAlg.Data.Canonical.Embeddable b b') => OAlg.Data.Canonical.Embeddable (a, b) (a', b')
instance (OAlg.Data.Canonical.Embeddable a a', OAlg.Data.Canonical.Embeddable b b', OAlg.Data.Canonical.Embeddable c c') => OAlg.Data.Canonical.Embeddable (a, b, c) (a', b', c')
instance OAlg.Data.Boolean.Definition.Boolean b => OAlg.Data.Canonical.Embeddable GHC.Types.Bool b
-- | basic number types.
module OAlg.Data.Number
-- | natural numbers 0, 1, 2...
data N
-- | a >- b = a - b if b <= a, otherwise a
-- Undefined SubtrahendToBig exception will be
-- thrown.
(>-) :: N -> N -> N
infixl 6 >-
-- | types admitting a length.
class LengthN x
lengthN :: LengthN x => x -> N
-- | takes the first n elements of the list.
takeN :: N -> [a] -> [a]
-- | splits a list in left and right part according to the given number.
splitAtN :: N -> [x] -> ([x], [x])
-- | integers ..-1, 0, 1, 2.. .
data Z
-- | Arbitrary precision integers. In contrast with fixed-size integral
-- types such as Int, the Integer type represents the
-- entire infinite range of integers.
--
-- Integers are stored in a kind of sign-magnitude form, hence do not
-- expect two's complement form when using bit operations.
--
-- If the value is small (fit into an Int), IS constructor
-- is used. Otherwise Integer and IN constructors are used
-- to store a BigNat representing respectively the positive or the
-- negative value magnitude.
--
-- Invariant: Integer and IN are used iff value doesn't fit
-- in IS
data Integer
-- | A fixed-precision integer type with at least the range [-2^29 ..
-- 2^29-1]. The exact range for a given implementation can be
-- determined by using minBound and maxBound from the
-- Bounded class.
data Int
-- | modulo for Int.
modInt :: Int -> Int -> Int
-- | division for Int
divInt :: Int -> Int -> Int
-- | rational numbers q = z%n with numerator q
-- == z and denominator q == n.
data Q
-- | Forms the ratio of two integral numbers.
(%) :: Z -> N -> Q
infix 7 %
-- | numerator of a rational.
--
-- Example
--
--
-- >>> denominator (3/2)
-- 3
--
numerator :: Q -> Z
-- | denominator of a rational.
--
-- Example
--
--
-- >>> denominator (3/2)
-- 2
--
denominator :: Q -> N
-- | Class Enum defines operations on sequentially ordered types.
--
-- The enumFrom... methods are used in Haskell's translation of
-- arithmetic sequences.
--
-- Instances of Enum may be derived for any enumeration type
-- (types whose constructors have no fields). The nullary constructors
-- are assumed to be numbered left-to-right by fromEnum from
-- 0 through n-1. See Chapter 10 of the Haskell
-- Report for more details.
--
-- For any type that is an instance of class Bounded as well as
-- Enum, the following should hold:
--
--
--
--
-- enumFrom x = enumFromTo x maxBound
-- enumFromThen x y = enumFromThenTo x y bound
-- where
-- bound | fromEnum y >= fromEnum x = maxBound
-- | otherwise = minBound
--
class Enum a
-- | the successor of a value. For numeric types, succ adds 1.
succ :: Enum a => a -> a
-- | the predecessor of a value. For numeric types, pred subtracts
-- 1.
pred :: Enum a => a -> a
-- | Convert from an Int.
toEnum :: Enum a => Int -> a
-- | Convert to an Int. It is implementation-dependent what
-- fromEnum returns when applied to a value that is too large to
-- fit in an Int.
fromEnum :: Enum a => a -> Int
-- | Used in Haskell's translation of [n..] with [n..] =
-- enumFrom n, a possible implementation being enumFrom n = n :
-- enumFrom (succ n). For example:
--
--
-- enumFrom 4 :: [Integer] = [4,5,6,7,...]
-- enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound ::
-- Int]
--
enumFrom :: Enum a => a -> [a]
-- | Used in Haskell's translation of [n,n'..] with [n,n'..] =
-- enumFromThen n n', a possible implementation being
-- enumFromThen n n' = n : n' : worker (f x) (f x n'),
-- worker s v = v : worker s (s v), x = fromEnum n' -
-- fromEnum n and f n y | n > 0 = f (n - 1) (succ y) | n <
-- 0 = f (n + 1) (pred y) | otherwise = y For example:
--
--
-- enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
-- enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound ::
-- Int]
--
enumFromThen :: Enum a => a -> a -> [a]
-- | Used in Haskell's translation of [n..m] with [n..m] =
-- enumFromTo n m, a possible implementation being enumFromTo n
-- m | n <= m = n : enumFromTo (succ n) m | otherwise = []. For
-- example:
--
--
-- enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
-- enumFromTo 42 1 :: [Integer] = []
--
enumFromTo :: Enum a => a -> a -> [a]
-- | Used in Haskell's translation of [n,n'..m] with [n,n'..m]
-- = enumFromThenTo n n' m, a possible implementation being
-- enumFromThenTo n n' m = worker (f x) (c x) n m, x =
-- fromEnum n' - fromEnum n, c x = bool (>=) ((x
-- 0) f n y | n > 0 = f (n - 1) (succ y) | n < 0 = f (n +
-- 1) (pred y) | otherwise = y and worker s c v m | c v m = v :
-- worker s c (s v) m | otherwise = [] For example:
--
--
-- enumFromThenTo 4 2 -6 :: [Integer] =
-- [4,2,0,-2,-4,-6]
-- enumFromThenTo 6 8 2 :: [Int] = []
--
enumFromThenTo :: Enum a => a -> a -> a -> [a]
-- | enumeration.
--
--
-- >>> enum 3 6 :: [N]
-- [3,4,5,6]
--
enum :: (Ord i, Enum i) => i -> i -> [i]
instance Control.DeepSeq.NFData OAlg.Data.Number.N
instance GHC.Real.Integral OAlg.Data.Number.N
instance GHC.Real.Real OAlg.Data.Number.N
instance GHC.Ix.Ix OAlg.Data.Number.N
instance GHC.Classes.Ord OAlg.Data.Number.N
instance GHC.Classes.Eq OAlg.Data.Number.N
instance Control.DeepSeq.NFData OAlg.Data.Number.Z
instance GHC.Real.Real OAlg.Data.Number.Z
instance GHC.Real.Integral OAlg.Data.Number.Z
instance GHC.Enum.Enum OAlg.Data.Number.Z
instance GHC.Num.Num OAlg.Data.Number.Z
instance GHC.Ix.Ix OAlg.Data.Number.Z
instance GHC.Classes.Ord OAlg.Data.Number.Z
instance GHC.Classes.Eq OAlg.Data.Number.Z
instance Control.DeepSeq.NFData OAlg.Data.Number.Q
instance GHC.Real.Fractional OAlg.Data.Number.Q
instance GHC.Real.RealFrac OAlg.Data.Number.Q
instance GHC.Real.Real OAlg.Data.Number.Q
instance GHC.Enum.Enum OAlg.Data.Number.Q
instance GHC.Num.Num OAlg.Data.Number.Q
instance GHC.Classes.Ord OAlg.Data.Number.Q
instance GHC.Classes.Eq OAlg.Data.Number.Q
instance GHC.Show.Show OAlg.Data.Number.Q
instance OAlg.Data.Canonical.Embeddable OAlg.Data.Number.Z OAlg.Data.Number.Q
instance OAlg.Data.Canonical.Projectible OAlg.Data.Number.Z OAlg.Data.Number.Q
instance OAlg.Data.Canonical.Embeddable OAlg.Data.Number.N OAlg.Data.Number.Q
instance OAlg.Data.Canonical.Projectible OAlg.Data.Number.N OAlg.Data.Number.Q
instance OAlg.Data.Dualisable.Transposable OAlg.Data.Number.Q
instance GHC.Show.Show OAlg.Data.Number.Z
instance OAlg.Data.Canonical.Embeddable GHC.Types.Int OAlg.Data.Number.Z
instance OAlg.Data.Canonical.Projectible GHC.Types.Int OAlg.Data.Number.Z
instance OAlg.Data.Canonical.Embeddable GHC.Num.Integer.Integer OAlg.Data.Number.Z
instance OAlg.Data.Canonical.Projectible GHC.Num.Integer.Integer OAlg.Data.Number.Z
instance OAlg.Data.Canonical.Embeddable OAlg.Data.Number.N OAlg.Data.Number.Z
instance OAlg.Data.Canonical.Projectible OAlg.Data.Number.N OAlg.Data.Number.Z
instance OAlg.Data.Dualisable.Transposable OAlg.Data.Number.Z
instance OAlg.Data.Number.LengthN [x]
instance GHC.Show.Show OAlg.Data.Number.N
instance OAlg.Data.Canonical.Embeddable OAlg.Data.Number.N GHC.Num.Integer.Integer
instance OAlg.Data.Canonical.Projectible OAlg.Data.Number.N GHC.Num.Integer.Integer
instance GHC.Num.Num OAlg.Data.Number.N
instance GHC.Enum.Enum OAlg.Data.Number.N
instance OAlg.Data.Dualisable.Transposable OAlg.Data.Number.N
-- | Random variables for stochastical validation.
module OAlg.Data.X
-- | random variable over x, possibly XEmpty. Let
-- x be a type and xx in X
-- x, then we use the idiom x is in the range
-- of xx if there exist a o in Omega
-- such that x is an element of samples xx o.
--
-- Note
--
--
-- - For the empty set O there is exactly one sigma algebra,
-- i.e. the power set of the empty set O, and for every set
-- X there is exactly one measurable function O ->
-- X, i.e. the empty function, and hence exactly one random variable
-- over O.
-- - To not run into non terminating programs, we restrict the
-- implementation of xa >>= f to a maximal number
-- of iterations to find a suitable sample in xa for which f
-- a is not empty. If the iterations exceed this maximum number, a
-- ProbablyEmpty exception will be thrown.
--
data X x
XEmpty :: X x
-- | infinite list of randomly picked samples of xx according to a
-- initial omega o. If xx is empty then the result will
-- be '[]'.
samples :: X x -> Omega -> [x]
-- | gets a list of randomly picked samples.
getSamples :: N -> X x -> IO [x]
-- | the first element of samples xx o. If xx is
-- empty then a IsEmpty exception will be thrown.
sample :: X x -> Omega -> x
-- | the mean value of n-samples according the state s.
meanValue :: Fractional x => Int -> X x -> Omega -> x
-- | A possible state of the world. It is used for
-- run or samples to generate randomly
-- values.
data Omega
-- | makes a state.
mkOmega :: Int -> Omega
-- | gets randomly a state.
getOmega :: IO Omega
-- | random variable of Omega.
xOmega :: X Omega
-- | uniformly distributed random variable of Ints.
xInt :: X Int
-- | uniformly distributed random variable of Ints in the given
-- range. If the lower bound is greater then the upper bound the result
-- will be XEmpty.
xIntB :: Int -> Int -> X Int
-- | uniformly distributed random variable of Words.
xWord :: X Word
-- | uniformly distributed random variable of Words in the given
-- range. If the lower bound is greater then the upper bound the result
-- will be XEmpty.
xWordB :: Word -> Word -> X Word
-- | uniformly distributed random variable of Integers.
xInteger :: X Integer
-- | uniformly distributed random variable of Integers in the given
-- range. If the lower bound is greater then the upper bound the result
-- will be XEmpty.
xIntegerB :: Integer -> Integer -> X Integer
-- | uniformly distributed random variable of Chars.
xChar :: X Char
-- | uniformly distributed random variable of Chars in the given
-- range. If the lower bound is greater then the upper bound the result
-- will be XEmpty.
xCharB :: Char -> Char -> X Char
-- | uniformly distributed random variable of Doubles.
xDouble :: X Double
-- | uniformly distributed random variable of Doubles in the given
-- range. If the lower bound is greater then the upper bound the result
-- will be XEmpty.
xDoubleB :: Double -> Double -> X Double
-- | uniformly distributed random variable of a Bounded Enum
-- in the range minBound to maxBound.
xEnum :: (Enum a, Bounded a) => X a
-- | uniformly distributed random variable of a Enum in the given
-- range. If the lower bound is greater then the upper bound the result
-- will be XEmpty.
xEnumB :: Enum a => a -> a -> X a
-- | uniformly distributed random variable of Bools.
xBool :: X Bool
-- | random variable for pairs.
xTupple2 :: X a -> X b -> X (a, b)
-- | random variable for triples.
xTupple3 :: X a -> X b -> X c -> X (a, b, c)
-- | random variable of list with the given length for non empty random
-- variables. Otherwise the result will be XEmpty.
xTakeN :: N -> X x -> X [x]
-- | random variable of lists with a length between the given bounds.
xTakeB :: N -> N -> X x -> X [x]
-- | random variable of list.
xList :: [X x] -> X [x]
-- | xOneOf xs is the random variable of xs in
-- xs with a uniformly distribution of the xis, where
-- 0 < length xs. If xs == [] then XEmpty
-- will be the result.
xOneOf :: [a] -> X a
-- | as xOneOf.
xOneOfX :: [X a] -> X a
-- | xOneOfW [(w1,x1)..(wn,xn)] is the random variable of
-- xs in [x1,x2,..xn] with a distribution of the
-- xis of pi = wi/s, where 0 < n, s =
-- w1+w2+..+wn and 0 <= wi for i = 1..n. If
-- n == 0 then XEmpty will be the result.
xOneOfW :: [(Q, a)] -> X a
-- | as xOneOfW.
xOneOfXW :: [(Q, X a)] -> X a
-- | uniformly distributed random variable in the given range.
xN :: X N
-- | uniformly distributed random variable in the given range. If the lower
-- bound is greater then the upper bound the result will be
-- XEmpty.
xNB :: N -> N -> X N
-- | uniformly distributed random variable of Z.
xZ :: X Z
-- | uniformly distributed random variable of Z in the given bounds.
-- If the lower bound is greater then the upper bound the result will be
-- XEmpty.
xZB :: Z -> Z -> X Z
-- | uniformly distributed random variable of Q.
xQ :: X Q
-- | a strict and head recursive version of sum.
sum' :: Num x => [x] -> x
-- | puts the distribution according of the given number of samples.
putDistribution :: (Show x, Ord x) => Int -> X x -> Omega -> IO ()
-- | puts the distribution according to the given aspects and the
-- given number of samples.
putDistribution' :: (Show x, Ord x) => [x -> String] -> Int -> X x -> Omega -> IO ()
-- | puts the distribution of according the given number of samples.
putDistributionIO :: (Show x, Ord x) => Int -> X (IO x) -> Omega -> IO ()
-- | puts the distribution according of the given number of samples.
putDstr :: (x -> [String]) -> Int -> X x -> IO ()
-- | showing the constructor as an aspect.
aspCnstr :: Show x => x -> String
-- | Exceptions for random variables.
data XException
ProbablyEmpty :: String -> XException
IsEmpty :: XException
instance GHC.Show.Show OAlg.Data.X.XException
instance GHC.Show.Show OAlg.Data.X.Omega
instance OAlg.Control.HNFData.HNFData (OAlg.Data.X.X x)
instance GHC.Base.Functor OAlg.Data.X.X
instance GHC.Base.Applicative OAlg.Data.X.X
instance GHC.Base.Monad OAlg.Data.X.X
instance Control.Monad.Fail.MonadFail OAlg.Data.X.X
instance GHC.Base.Alternative OAlg.Data.X.X
instance GHC.Base.MonadPlus OAlg.Data.X.X
instance GHC.Classes.Eq OAlg.Data.X.Omega
instance GHC.Exception.Type.Exception OAlg.Data.X.XException
-- | categories of morphisms. We adapted the concept of categories form
-- Category to better cover our needs.
module OAlg.Category.Definition
-- | category of morphisms.
--
-- Properties Let c be a type instance of the
-- class Category, then holds:
--
--
-- - For all types x, y and f
-- in c x y holds:
-- cOne (range f) . f = f and f
-- . cOne (domain f) = f.
-- - For all types w, x,
-- y, z and f in
-- c x w, g in
-- c y x, h in
-- c z y holds: f
-- . (g . h) = (f . g) . h.
--
class Morphism c => Category c
-- | the identity morphism for an eligible x.
cOne :: Category c => Struct (ObjectClass c) x -> c x x
(.) :: Category c => c y z -> c x y -> c x z
infixr 9 .
-- | the cOne to a given Struct (ObjectClass
-- c). The type p c serves only as proxy and
-- cOne' is lazy in it.
--
-- Note As ObjectClass may be a non-injective type family,
-- the type checker needs some times a little bit more information to pic
-- the right cOne.
cOne' :: Category c => p c -> Struct (ObjectClass c) x -> c x x
-- | the identity map.
id :: x -> x
-- | the constant map given by a value in b.
--
-- Property Let y be in b then for all
-- x in a holds: const y x is
-- identical to y.
const :: b -> a -> b
-- | currying a map.
curry :: ((a, b) -> c) -> a -> b -> c
-- | uncurrying a map.
uncurry :: (a -> b -> c) -> (a, b) -> c
-- | the first component of the pair.
fst :: (a, b) -> a
-- | the second component of the pair.
snd :: (a, b) -> b
-- | currying a map.
curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
-- | uncurrying a map.
uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
-- | category of isomorphisms.
--
-- Property Let c be a type instance of
-- Cayleyan2, then holds: For all types x,
-- y and f in c
-- x y holds: (invert2 f
-- . f) == cOne (domain f) and (f .
-- invert2 f) == cOne (range f) where (==)
-- = eq2.
class (Category c, Eq2 c) => Cayleyan2 c
invert2 :: Cayleyan2 c => c x y -> c y x
-- | morphism.
class Morphism m where {
-- | the object class.
type ObjectClass m;
}
-- | attests, that the types x and y
-- fulfill the constraints given by Homomorphous
-- (ObjectClass m) x y, i.e both fulfill
-- the constraints given by Structure (ObjectClass
-- m) x and Structure (ObjectClass
-- m) y respectively.
homomorphous :: Morphism m => m x y -> Homomorphous (ObjectClass m) x y
-- | attests that the domain type x fulfills the
-- constraints given by Structure (ObjectClass
-- m) x.
domain :: Morphism m => m x y -> Struct (ObjectClass m) x
-- | attests that the range type y fulfills the constraints
-- given by Structure (ObjectClass m)
-- y.
range :: Morphism m => m x y -> Struct (ObjectClass m) y
-- | attest that both x and y have
-- homomorphous structures, i.e. both admit the same constraints given by
-- the parameter s.
data Homomorphous s x y
(:>:) :: Struct s x -> Struct s y -> Homomorphous s x y
infix 5 :>:
-- | transforming homomorphous structural attests.
tauHom :: Transformable s t => Homomorphous s x y -> Homomorphous t x y
-- | transforming homomorphous structural attests.
tau1Hom :: Transformable1 f s => Homomorphous s x y -> Homomorphous s (f x) (f y)
-- | gets for two Typeable types x and
-- x' and for two parameterized types maybe an attest
-- that the domain types are equal.
eqlDomain :: Struct Typ x -> Struct Typ x' -> m x y -> m x' y -> Maybe (x :~: x')
-- | gets for two Typeable types y and
-- y' and for two parameterized types maybe an attest
-- that the range types are equal.
eqlRange :: Struct Typ y -> Struct Typ y' -> m x y -> m x y' -> Maybe (y :~: y')
-- | gets maybe an attest that the two given morphisms types are equal.
eqlMorphism :: Typeable m => Struct Typ x -> Struct Typ x' -> Struct Typ y -> Struct Typ y' -> m x y -> m x' y' -> Maybe (m x y :~: m x' y')
-- | family of types having a representation in (->).
class Applicative h
-- | application.
amap :: Applicative h => h a b -> a -> b
-- | right associative application on values.
($) :: Applicative h => h a b -> a -> b
infixr 0 $
-- | family of types having a representation in f a -> f b.
class Applicative1 h f
-- | application.
amap1 :: Applicative1 h f => h a b -> f a -> f b
-- | representable categories, i.e. covariant functors from an
-- Applicative category c to (->).
--
-- Properties Let c be a type instance of the
-- class Functorial then holds:
--
--
-- - For all types x and d in
-- Struct (ObjectClass c) x holds:
-- amap (cOne d) = id.
-- - For all types x, y,
-- z and f in c
-- y z, g in c
-- x y holds: amap (f .
-- g) = amap f . amap g.
--
class (Applicative c, Category c) => Functorial c
-- | forgets the ObjectClass of m and sets it to
-- t, under the condition that the ObjectClass of
-- m is Transformable to t.
data Forget t m x y
[Forget] :: Transformable (ObjectClass m) t => m x y -> Forget t m x y
-- | morphism for which its object class can be embedded into the given
-- structure.
class (Morphism m, Transformable (ObjectClass m) t) => EmbeddableMorphism m t
-- | helper class to avoid undecidable instances.
class EmbeddableMorphism m Typ => EmbeddableMorphismTyp m
instance GHC.Classes.Eq (OAlg.Category.Definition.Homomorphous s x y)
instance GHC.Show.Show (OAlg.Category.Definition.Homomorphous s x y)
instance (OAlg.Category.Definition.Morphism m, OAlg.Structure.Definition.ForgetfulTyp t) => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Category.Definition.Forget t m)
instance OAlg.Category.Definition.EmbeddableMorphismTyp m => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Data.Opposite.Op2 m)
instance (OAlg.Category.Definition.Morphism m, OAlg.Structure.Definition.Transformable s t) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Category.Definition.Forget s m) t
instance OAlg.Category.Definition.EmbeddableMorphism m t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Data.Opposite.Op2 m) t
instance OAlg.Data.Show.Show2 m => OAlg.Data.Show.Show2 (OAlg.Category.Definition.Forget t m)
instance OAlg.Data.Show.Show2 m => GHC.Show.Show (OAlg.Category.Definition.Forget t m x y)
instance OAlg.Data.Equal.Eq2 m => OAlg.Data.Equal.Eq2 (OAlg.Category.Definition.Forget t m)
instance OAlg.Data.Equal.Eq2 m => GHC.Classes.Eq (OAlg.Category.Definition.Forget t m x y)
instance OAlg.Category.Definition.Morphism m => OAlg.Category.Definition.Morphism (OAlg.Category.Definition.Forget t m)
instance OAlg.Category.Applicative.Applicative m => OAlg.Category.Applicative.Applicative (OAlg.Category.Definition.Forget t m)
instance OAlg.Category.Definition.Cayleyan2 (OAlg.Category.Definition.Homomorphous m)
instance OAlg.Category.Definition.Cayleyan2 c => OAlg.Category.Definition.Cayleyan2 (OAlg.Data.Opposite.Op2 c)
instance OAlg.Category.Definition.Category (OAlg.Category.Definition.Homomorphous s)
instance OAlg.Category.Definition.Category (->)
instance OAlg.Category.Definition.Category c => OAlg.Category.Definition.Category (OAlg.Data.Opposite.Op2 c)
instance OAlg.Category.Definition.Morphism (OAlg.Category.Definition.Homomorphous s)
instance OAlg.Category.Definition.Morphism (->)
instance OAlg.Category.Definition.Morphism h => OAlg.Category.Definition.Morphism (OAlg.Data.Opposite.Op2 h)
instance (OAlg.Category.Definition.Morphism f, OAlg.Category.Definition.Morphism g, OAlg.Category.Definition.ObjectClass f GHC.Types.~ OAlg.Category.Definition.ObjectClass g) => OAlg.Category.Definition.Morphism (OAlg.Data.Either.Either2 f g)
instance OAlg.Data.Show.Show2 (OAlg.Category.Definition.Homomorphous m)
instance OAlg.Data.Equal.Eq2 (OAlg.Category.Definition.Homomorphous m)
-- | Statements on properties which can be validated via
-- validateStoch. They serve to implement automatic testing (see
-- OAlg.Control.Validate).
--
-- Examples Deterministic
--
-- Validation of the valid and invalid statement
--
--
-- >>> getOmega >>= validateStoch SValid 10
-- Valid
--
--
--
-- >>> getOmega >>= validateStoch SInvalid 5
-- Invalid
--
--
-- As no stochastic was used to evaluate the two examples, the result is
-- Valid and Invalid respectively!
--
-- Examples Stochastic
--
-- Validation of a Forall and Exist statement
--
--
-- >>> getOmega >>= validateStoch (Forall (xIntB 0 10) (\i -> (0 <= i && i <= 10):?>Params["i":=show i]-- )) 100
-- ProbablyValid
--
--
--
-- >>> getOmega >>= validateStoch (Exist (xIntB 0 10) (\i -> (11 <= i):?>Params["i":=show i])) 100
-- ProbablyInvalid
--
--
-- The valuation of these two examples uses the given Omega and
-- Wide of 100 to pick randomly 100 samples of
-- the given random variable xIntB 0 10 and applies these
-- samples to the given test function. The result is ProbablyValid
-- and ProbablyInvalid respectively!
module OAlg.Data.Statement.Definition
-- | statement on properties..
data Statement
-- | the invalid statement.
[SInvalid] :: Statement
-- | the valid statement.
[SValid] :: Statement
-- | checking a boolean.
[:?>] :: Bool -> Message -> Statement
-- | catching an exception.
[Catch] :: Exception e => Statement -> (e -> Statement) -> Statement
-- | not
[Not] :: Statement -> Statement
-- | and
[:&&] :: Statement -> Statement -> Statement
-- | and
[And] :: [Statement] -> Statement
-- | or
[:||] :: Statement -> Statement -> Statement
-- | or
[Or] :: [Statement] -> Statement
-- | implication
[:=>] :: Statement -> Statement -> Statement
-- | implication
[Impl] :: [Statement] -> Statement -> Statement
-- | efinitional equivalence
[:<=>:] :: Label -> Statement -> Statement
-- | equivalence
[:<=>] :: Statement -> Statement -> Statement
-- | equivalence
[Eqvl] :: [Statement] -> Statement
-- | the for all constructor
[Forall] :: X x -> (x -> Statement) -> Statement
-- | the exist constructor.
[Exist] :: X x -> (x -> Statement) -> Statement
infix 4 :?>
infixr 3 :&&
infixr 2 :||
infixr 1 :=>
infixr 1 :<=>
infixr 0 :<=>:
-- | checking for equality.
(.==.) :: Eq a => a -> a -> Statement
infix 4 .==.
-- | checking for inequality.
(./=.) :: Eq a => a -> a -> Statement
infix 4 ./=.
-- | implication without resulting in denied premises for a false
-- premises. This is useful for switch cases.
(|~>) :: Statement -> Statement -> Statement
infixr 1 |~>
-- | convenient catcher for SomeException.
someException :: Statement -> SomeException -> Statement
-- | a labels.
data Label
Label :: String -> Label
Prp :: String -> Label
-- | a message.
data Message
-- | used for relations where no further information is desired or possible
-- to give (see relRelation as an example).
MInvalid :: Message
-- | a message
Message :: String -> Message
-- | a list of parameters
Params :: [Parameter] -> Message
-- | type of variables.
type Variable = String
-- | showing the involved parameters of a statement.
data Parameter
[:=] :: Variable -> String -> Parameter
-- | validates the statement according to a given Wide and
-- Omega. For deterministic statements better use
-- validateDet and for non deterministic or to get more
-- information validate.
validateStoch :: Statement -> Wide -> Omega -> IO Valid
-- | the wide for a Forall and Exist resolution.
type Wide = Int
-- | evaluates the value of a statement according a given Wide and
-- Omega.
--
-- Note
--
--
-- - The only reason to valuate a statement in the IO monad is
-- to be able to catch exceptions. Other interactions with the real
-- world during the valuation are not performed.
-- - During the evaluation process the given wide and omega will not be
-- changed and as such all same random variables will produce
-- exactly the same samples. This restricts the stochastic, but it is
-- necessary for the sound behavior of the validation of statements.
--
value :: Statement -> Wide -> Omega -> IO V
-- | the value of a statement resulting from its validation.
-- Forall and Exist are resolved by finite samples.
data V
-- | determines whether the value is deterministic, i.e. dose not contain a
-- VForall or VExist constructor.
valDeterministic :: V -> Bool
-- | validating a value v.
valT :: V -> T
-- | the truth type of a value v.
type T = HNFValue Valid
-- | weak form of classical boolean values arising from stochastically
-- performed valuation of Statements.
--
-- Definition Let a, b be in Valid, then
-- we define:
--
--
-- - not a = toEnum (fromEnum Valid
-- - fromEnum a).
-- - a || b = max a b.
-- - a && b = min a b.
-- - a ~> b = not a || b.
--
--
-- Note min and max are implemented lazy as
-- Valid is bounded. This is important that ~> behaves
-- as desired, i.e. for a ~> b and a =
-- Invalid then b has not to be evaluated, because
-- the maximum is already reached..
data Valid
Invalid :: Valid
ProbablyInvalid :: Valid
ProbablyValid :: Valid
Valid :: Valid
-- | pretty showing a value with the given indentation.
showV :: Indent -> V -> String
-- | the initial indentation given by a indentation string.
indent0 :: String -> Indent
-- | pretty showing the value of a statement according to the given
-- Wide and randomly given Omega.
showVStatement :: Wide -> Statement -> IO ()
-- | validation for deterministic statements.
--
-- Definition A statement s is called deterministic
-- if and only if it dose not depend on the stochastic nor on the state
-- of the machine.
--
-- Examples
--
--
-- >>> validateDet SValid
-- True
--
--
--
-- >>> validateDet (Forall xBool (\_ -> SValid))
-- *** Exception: NonDeterministic
--
--
--
-- >>> validateDet (SValid || Exist xInt (\i -> (i==0):?>MInvalid))
-- True
--
validateDet :: Statement -> Bool
-- | the list of all relevant tests - i.e 'VDedEqvl l _ where
-- l = Label _ - together with the number of tests.
tests :: V -> [(Int, SPath)]
-- | path of strings.
type SPath = [String]
-- | number of tests.
cntTests :: V -> Int
-- | reduces true valus to its relevant part.
rdcTrue :: V -> Maybe V
-- | number of tests for true values. Note Before counting
-- the tests they will be first reduced to there relevant part (see
-- rdcTrue).
cntTestsRdcTrue :: V -> Int
-- | reduces false valus to its relevant part.
rdcFalse :: V -> Maybe V
-- | number of tests for false values. Note Before counting
-- the tests they will be first reduced to there relevant part (see
-- rdcFalse).
cntTestsRdcFalse :: V -> Int
-- | reduces ture values - having implications with no conclusions, i.e.
-- denied premises - to its relevant part.
rdcDndPrms :: V -> Maybe V
-- | number of tests for values containing denied premises.
-- Note Before counting the tests they will be first reduced to
-- there relevant part (see rdcDndPrms).
cntTestsRdcDndPrms :: V -> Int
-- | reduces failed values to its relevant part.
rdcFailed :: V -> Maybe V
-- | number of tests for failed values. Note Before counting
-- the tests they will be first reduced to there relevant part (see
-- rdcFailed).
cntTestsRdcFailed :: V -> Int
-- | random variable of valuation values according to the randomly given
-- Wide and Omega.
xValue :: Statement -> X (Wide, Omega) -> X (IO V)
-- | xWO l h is the random variable over wide and omgea, where the
-- wide is bounded between l and h.
xWO :: Wide -> Wide -> X (Wide, Omega)
-- | uniformly distributed random variable of Valid.
xValid :: X Valid
-- | validating exceptions which are sub exceptions from
-- SomeOAlgException.
data ValidateingException
NonDeterministic :: ValidateingException
instance GHC.Show.Show OAlg.Data.Statement.Definition.ValidateingException
instance GHC.Classes.Eq OAlg.Data.Statement.Definition.ValidateingException
instance GHC.Show.Show OAlg.Data.Statement.Definition.Message
instance GHC.Enum.Bounded OAlg.Data.Statement.Definition.Valid
instance GHC.Enum.Enum OAlg.Data.Statement.Definition.Valid
instance GHC.Classes.Ord OAlg.Data.Statement.Definition.Valid
instance GHC.Classes.Eq OAlg.Data.Statement.Definition.Valid
instance GHC.Show.Show OAlg.Data.Statement.Definition.Valid
instance GHC.Show.Show OAlg.Data.Statement.Definition.Parameter
instance GHC.Show.Show OAlg.Data.Statement.Definition.V
instance OAlg.Control.Verbose.Verbose OAlg.Data.Statement.Definition.V
instance Control.DeepSeq.NFData OAlg.Data.Statement.Definition.Valid
instance OAlg.Data.Boolean.Definition.Boolean OAlg.Data.Statement.Definition.Valid
instance OAlg.Data.Canonical.Projectible GHC.Types.Bool OAlg.Data.Statement.Definition.Valid
instance OAlg.Data.Boolean.Definition.Boolean OAlg.Data.Statement.Definition.Statement
instance OAlg.Control.HNFData.HNFData OAlg.Data.Statement.Definition.Statement
instance OAlg.Control.Verbose.Verbose OAlg.Data.Statement.Definition.Message
instance OAlg.Control.Verbose.Verbose OAlg.Data.Statement.Definition.Parameter
instance GHC.Show.Show OAlg.Data.Statement.Definition.Label
instance OAlg.Control.Verbose.Verbose OAlg.Data.Statement.Definition.Label
instance GHC.Exception.Type.Exception OAlg.Data.Statement.Definition.ValidateingException
-- | propositions on boolean structures which must always be true, i.e.
-- tautologies. They serve also to describe the semantic of the boolean
-- operators.
module OAlg.Data.Boolean.Proposition
-- | validity of the Boolean structure of Bool.
prpBool :: Statement
-- | tautologies for Bool.
prpBoolTautologies :: Statement
-- | tautologies on boolean structures.
prpTautologies :: Boolean b => (b -> Statement) -> X b -> X [b] -> Statement
-- | for all p holds: not (not p)
-- <~> p.
prpNotNot :: Boolean b => b -> b
-- | for all a, b and c holds: (a
-- && b) && c <~> a
-- && (b && c).
prpAndAssoc :: Boolean b => b -> b -> b -> b
-- | for all a, b and c holds: (a
-- && b) || c <~> (a || c)
-- && (b || c).
prpAndOr :: Boolean b => b -> b -> b -> b
-- | for all p holds: true && p
-- <~> p.
prpAndTrue :: Boolean b => b -> b
-- | and [] <~> true.
prpAnd0 :: Boolean b => b
-- | for all a and as holds: and
-- (a:as) <~> a && and
-- as.
prpAnds :: Boolean b => b -> [b] -> b
-- | for all a, b and c holds: (a ||
-- b) || c <~> a || (b || c).
prpOrAssoc :: Boolean b => b -> b -> b -> b
-- | for all a, b and c holds: (a ||
-- b) && c <~> (a && c)
-- || (b && c).
prpOrAnd :: Boolean b => b -> b -> b -> b
-- | or [] <~> false.
prpOr0 :: Boolean b => b
-- | for all a and as holds: or
-- (a:as) <~> a || or as.
prpOrs :: Boolean b => b -> [b] -> b
-- | for all p holds: p ~> p.
prpImplRefl :: Boolean b => b -> b
-- | for all p holds: false ~> (p
-- <~> true).
--
-- i.e. a false premisis implies everithing.
prpImplFalseEverything :: Boolean b => b -> b
-- | for all a, b and c holds: ((a
-- && b) ~> c) <~> (a ~>
-- b ~> c).
prpImplCurry :: Boolean b => b -> b -> b -> b
-- | for all a, b and c holds: (a
-- ~> b) && (b ~> c) ~> (a
-- ~> c).
prpImplTransitive :: Boolean b => b -> b -> b -> b
-- | for all a and b holds: (a <~> b)
-- <~> ((a ~> b) && (b ~>
-- a)).
prpEqvlAnd :: Boolean b => b -> b -> b
-- | laziness of and, or and (~>).
prpLazy :: Boolean b => (b -> Statement) -> Statement
-- | lazy evaluation of &&, i.e. false
-- && undefined <~> false.
--
-- Note (undefined && false)
-- evaluates to an exception!
prpLazyAnd :: Boolean b => b
-- | lazy evaluationof ||, i.e. true ||
-- undefined.
prpLazyOr :: Boolean b => b
-- | lazy evaluation of ~>, i.e. false :=>
-- undefined.
prpLazyImpl :: Boolean b => b
-- | boolean structure and propositions on them.
module OAlg.Data.Boolean
-- | Propositions on statements.
module OAlg.Data.Statement.Proposition
-- | validity of the logic of Statement..
prpStatement :: Statement
-- | logical tautologies of Statement.
--
-- Note Validating this proposition produces about 15% denied
-- premises, which is OK.
prpStatementTautologies :: Statement
-- | logical tautologies of Valid.
prpValidTautologies :: Statement
-- | true :?> MInvalid.
prpCheckTrue :: Statement
-- | false :?> MInvalid <~>
-- false.
prpCheckFalse :: Statement
-- | catch algebraic exceptions.
prpCatch :: Statement
-- | prj :: Valid -> Bool is a
-- homomorphism between Boolean structures.
prpPrjHom :: Statement
-- | random variable of statements with the maximal given depth.
xStatement :: Int -> X Statement
module OAlg.Data.Statement
-- | validable values x, which can be validated via
-- validate (valid x).
module OAlg.Data.Validable
-- | validation of a value of a.
class Validable a
valid :: Validable a => a -> Statement
-- | validation of being reducible to normal form.
rnfValid :: NFData x => x -> Statement
-- | validation of a value of p x.
class Validable1 p
valid1 :: Validable1 p => p x -> Statement
valid1 :: (Validable1 p, Validable (p x)) => p x -> Statement
-- | validation of a value of h x y.
class Validable2 h
valid2 :: Validable2 h => h x y -> Statement
valid2 :: (Validable2 h, Validable (h x y)) => h x y -> Statement
-- | standard random variable for x.
--
-- Property For all x in the range of xStandard
-- holds: valid x.
class Validable x => XStandard x
xStandard :: XStandard x => X x
-- | validity of the standard random variable associated to
-- x (p x just serves as proxy and will
-- not be evaluated).
relXStandard :: XStandard x => p x -> Statement
instance OAlg.Data.Validable.Validable x => OAlg.Data.Validable.Validable (OAlg.Data.Opposite.Op x)
instance OAlg.Data.Validable.Validable2 h => OAlg.Data.Validable.Validable2 (OAlg.Data.Opposite.Op2 h)
instance (OAlg.Data.Validable.Validable2 f, OAlg.Data.Validable.Validable2 g) => OAlg.Data.Validable.Validable2 (OAlg.Data.Either.Either2 f g)
instance OAlg.Data.Validable.Validable2 m => OAlg.Data.Validable.Validable2 (OAlg.Category.Definition.Forget t m)
instance OAlg.Data.Validable.Validable2 m => OAlg.Data.Validable.Validable (OAlg.Category.Definition.Forget t m x y)
instance OAlg.Data.Validable.Validable1 Data.Proxy.Proxy
instance OAlg.Data.Validable.Validable1 (OAlg.Structure.Definition.Struct s)
instance OAlg.Data.Validable.XStandard ()
instance OAlg.Data.Validable.XStandard OAlg.Data.Number.N
instance OAlg.Data.Validable.XStandard OAlg.Data.Number.Z
instance OAlg.Data.Validable.XStandard OAlg.Data.Number.Q
instance (OAlg.Data.Validable.XStandard x, OAlg.Data.Validable.Validable y) => OAlg.Data.Validable.Validable (x -> y)
instance OAlg.Data.Validable.Validable ()
instance OAlg.Data.Validable.Validable GHC.Types.Bool
instance OAlg.Data.Validable.Validable OAlg.Data.Statement.Definition.Valid
instance OAlg.Data.Validable.Validable GHC.Types.Char
instance OAlg.Data.Validable.Validable GHC.Types.Int
instance OAlg.Data.Validable.Validable GHC.Num.Integer.Integer
instance OAlg.Data.Validable.Validable (GHC.Real.Ratio GHC.Num.Integer.Integer)
instance OAlg.Data.Validable.Validable OAlg.Data.Number.N
instance OAlg.Data.Validable.Validable OAlg.Data.Number.Z
instance OAlg.Data.Validable.Validable OAlg.Data.Number.Q
instance OAlg.Data.Validable.Validable (Data.Proxy.Proxy x)
instance OAlg.Data.Validable.Validable (OAlg.Structure.Definition.Struct s x)
instance OAlg.Data.Validable.Validable a => OAlg.Data.Validable.Validable (GHC.Maybe.Maybe a)
instance OAlg.Data.Validable.Validable a => OAlg.Data.Validable.Validable [a]
instance (OAlg.Data.Validable.Validable a, OAlg.Data.Validable.Validable b) => OAlg.Data.Validable.Validable (Data.Either.Either a b)
instance (OAlg.Data.Validable.Validable a, OAlg.Data.Validable.Validable b) => OAlg.Data.Validable.Validable (a, b)
instance (OAlg.Data.Validable.Validable a, OAlg.Data.Validable.Validable b, OAlg.Data.Validable.Validable c) => OAlg.Data.Validable.Validable (a, b, c)
instance (OAlg.Data.Validable.Validable a, OAlg.Data.Validable.Validable b, OAlg.Data.Validable.Validable c, OAlg.Data.Validable.Validable d) => OAlg.Data.Validable.Validable (a, b, c, d)
instance (OAlg.Data.Validable.Validable a, OAlg.Data.Validable.Validable b, OAlg.Data.Validable.Validable c, OAlg.Data.Validable.Validable d, OAlg.Data.Validable.Validable e) => OAlg.Data.Validable.Validable (a, b, c, d, e)
instance OAlg.Data.Validable.Validable a => OAlg.Data.Validable.Validable (OAlg.Data.X.X a)
-- | symbols from A to Z. They are mainly used to validate
-- the algebraic structure of Orientation.
module OAlg.Data.Symbol
-- | symbols from A to Z.
data Symbol
A :: Symbol
B :: Symbol
C :: Symbol
D :: Symbol
E :: Symbol
F :: Symbol
G :: Symbol
H :: Symbol
I :: Symbol
J :: Symbol
K :: Symbol
L :: Symbol
M :: Symbol
N :: Symbol
O :: Symbol
P :: Symbol
Q :: Symbol
R :: Symbol
S :: Symbol
T :: Symbol
U :: Symbol
V :: Symbol
W :: Symbol
X :: Symbol
Y :: Symbol
Z :: Symbol
-- | uniformly distributed random variable of Symbol.
xSymbol :: X Symbol
instance GHC.Enum.Bounded OAlg.Data.Symbol.Symbol
instance GHC.Enum.Enum OAlg.Data.Symbol.Symbol
instance GHC.Classes.Ord OAlg.Data.Symbol.Symbol
instance GHC.Classes.Eq OAlg.Data.Symbol.Symbol
instance GHC.Read.Read OAlg.Data.Symbol.Symbol
instance GHC.Show.Show OAlg.Data.Symbol.Symbol
instance Control.DeepSeq.NFData OAlg.Data.Symbol.Symbol
instance OAlg.Data.Validable.Validable OAlg.Data.Symbol.Symbol
instance OAlg.Data.Validable.XStandard OAlg.Data.Symbol.Symbol
-- | definition of entities. All algebraic structures defined here are
-- based on them. They are showable,
-- distinguishable, validable and
-- typeable.
module OAlg.Entity.Definition
-- | entity.
class (Show a, Eq a, Validable a, Typeable a) => Entity a
-- | indexing Entitys.
data Ent
-- | entity for parameterized types.
class (Show1 a, Eq1 a, Validable1 a, Typeable a) => Entity1 a
-- | entity for two parameterized types.
class (Show2 h, Eq2 h, Validable2 h, Typeable h) => Entity2 h
-- | the empty entity.
data Empty
-- | the empty function.
empty :: Empty -> x
-- | the empty entity2.
data Empty2 a b
-- | the empty function.
empty2 :: Empty2 a b -> x
instance GHC.Show.Show OAlg.Entity.Definition.Empty
instance GHC.Classes.Ord OAlg.Entity.Definition.Empty
instance GHC.Classes.Eq OAlg.Entity.Definition.Empty
instance GHC.Show.Show (OAlg.Entity.Definition.Empty2 a b)
instance GHC.Classes.Eq (OAlg.Entity.Definition.Empty2 a b)
instance OAlg.Entity.Definition.Entity x => OAlg.Entity.Definition.Entity (OAlg.Data.Opposite.Op x)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Definition.Empty2 x y)
instance OAlg.Data.Show.Show2 OAlg.Entity.Definition.Empty2
instance OAlg.Data.Equal.Eq2 OAlg.Entity.Definition.Empty2
instance OAlg.Data.Validable.Validable2 OAlg.Entity.Definition.Empty2
instance OAlg.Entity.Definition.Entity2 OAlg.Entity.Definition.Empty2
instance OAlg.Data.Validable.Validable OAlg.Entity.Definition.Empty
instance OAlg.Entity.Definition.Entity OAlg.Entity.Definition.Empty
instance (OAlg.Entity.Definition.Entity2 f, OAlg.Entity.Definition.Entity2 g) => OAlg.Entity.Definition.Entity2 (OAlg.Data.Either.Either2 f g)
instance (OAlg.Entity.Definition.Entity2 h, Data.Typeable.Internal.Typeable t) => OAlg.Entity.Definition.Entity2 (OAlg.Category.Definition.Forget t h)
instance OAlg.Entity.Definition.Entity1 Data.Proxy.Proxy
instance OAlg.Entity.Definition.Entity ()
instance OAlg.Entity.Definition.Entity GHC.Types.Int
instance OAlg.Entity.Definition.Entity GHC.Num.Integer.Integer
instance OAlg.Entity.Definition.Entity GHC.Types.Char
instance OAlg.Entity.Definition.Entity OAlg.Data.Symbol.Symbol
instance OAlg.Entity.Definition.Entity OAlg.Data.Number.N
instance OAlg.Entity.Definition.Entity OAlg.Data.Number.Z
instance OAlg.Entity.Definition.Entity OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity a => OAlg.Entity.Definition.Entity [a]
instance (OAlg.Entity.Definition.Entity a, OAlg.Entity.Definition.Entity b) => OAlg.Entity.Definition.Entity (a, b)
-- | Validation of Statements, based on a stochastic approach.
--
-- Example Deterministic statements
--
--
-- >>> validate (SValid && (SInvalid || SValid))
-- Valid
--
--
-- The validation shows the following output:
--
--
-- >> Omega (StdGen {unStdGen = SMGen 1872899651221430933 9051984386581193015})
-- >> --------------------------------------------------------------------------------
-- >> Summary
-- >> 1 sample tested where 0 tests are false, having 0 denied premises
-- >> 5 tests with a false ratio of 0% and a denied premises ratio of 0%
--
--
-- From the third line on the number of samples is shown and how many
-- tests over all have been performed to determine the result. As the
-- above statement is obviously deterministic, only one sample has been
-- tested, as the result is independent of the used stochastic.
--
-- Example Non deterministic statements
--
--
-- >>> validate (Forall (xIntB 0 100) (\i -> (i <= 100) :?> Params["i":=show i]))
-- ProbablyValid
--
--
-- The validation shows the following output:
--
--
-- >> Omega (StdGen {unStdGen = SMGen 8429292192981378265 11527977991108410805})
-- >> --------------------------------------------------------------------------------
-- >> Summary
-- >> 10 samples tested where 0 tests are false, having 0 denied premises
-- >> 94 tests with a false ratio of 0% and a denied premises ratio of
--
--
-- As this statement is non deterministic, the validation of it pics
-- randomly 10 samples of Omegas and Wides (see the number
-- of samples in the summery above) - starting from the shown
-- Omega - and uses validateStoch to determine for each
-- sample the result. All this results are combined with the
-- &&-operator to yield the final result.
--
-- Example Lazy validation
--
--
-- >>> validate (SValid || throw DivideByZero)
-- Valid
--
--
-- Example Denied premises
--
--
-- >>> let s = Forall xInt (\i -> (i == i+1):?>Params["i":=show i]) in validate (s :=> s)
-- Valid
--
--
-- The validation shows the following output:
--
--
-- >> Omega (StdGen {unStdGen = SMGen 1872899651221430933 9051984386581193015})
-- >> --------------------------------------------------------------------------------
-- >> Summary
-- >> 1 sample tested where 0 tests are false, having 4 denied premises
-- >> 7 tests with a false ratio of 0% and a denied premises ratio of 57%
--
--
-- The statement s is obviously invalid but the tautology s
-- :=> s is valid because of denied premises, which is
-- shown in the summery.
--
-- Example Invalid statements
--
--
-- >>> validate (Forall (xIntB 0 10) (\i -> (10 < i):?>Params["i":=show i]))
-- Invalid
--
--
-- The validation shows the following output:
--
--
-- >> Omega (StdGen {unStdGen = SMGen 8429292192981378265 11527977991108410805})
-- >> --------------------------------------------------------------------------------
-- for all Invalid
-- and Invalid
-- check Invalid
-- Invalid
-- parameters
-- i := 9
--
-- >> --------------------------------------------------------------------------------
-- >> Summary
-- >> 1 sample tested where 3 tests are false, having 0 denied premises
-- >> 3 tests with a false ratio of 100% and a denied premises ratio of 0%
--
--
-- where from the third line on the invalid test is shown and the summery
-- shows that in the first sample for Omega and Wide an
-- invalid test has been found.
--
-- Example Tracking of exceptions
--
--
-- >>> validate (SValid && (Label "bad" :<=>: throw DivideByZero))
-- *** Exception: FailedStatement divide by zero
--
--
-- The validation shows the following output:
--
--
-- >> Omega (StdGen {unStdGen = SMGen 3069986384088197145 15225250911862971905})
-- >> --------------------------------------------------------------------------------
-- >> failed sample
-- and divide by zero
-- (bad) divide by zero
-- failure divide by zero
--
-- >> --------------------------------------------------------------------------------
-- >> Summary
-- >> 1 sample tested where 0 tests are false, having 0 denied premises
-- >> 3 tests
--
--
-- The failed sample part of the output shows that in an and
-- construct the component - labeled by bad - has been throwing
-- an exception during the validation process.
--
-- Example Extended stochastic
--
-- If we validate the obviously false statement
--
--
-- > validate Forall (xIntB 0 1000) (\i -> (i < 1000) :?> Params["i":=show i])
--
--
-- the validation may nevertheless yield ProbablyValid - because
-- all randomly picked Omegas and Wides may produce only
-- values which are strict smaller then 1000. To overcome this
-- problem and to get more confidence of the result it is possible
-- to adapt the stochastic and use validateStochastic
-- Massive instead (validate is equivalent to
-- validateStochastic Sparse).
--
-- Note The here defined validation is highly inspired by the
-- QuickCheck package. But we have chosen to adopt the idea to fit more
-- our needs. For example, if a statement throws an exception, then the
-- occurrence can be tracked. Also we devoted special attention to the
-- logic of statements (as Statement is an instance
-- Boolean, they fulfill all the logical tautologies). For
-- example, the simple tautology s :=> s breaks, if
-- you don't take special care during the validating process or if you
-- allow user interactions.
module OAlg.Control.Validate
-- | validates a statement.
validate :: Statement -> IO Valid
-- | short cut for validateDet and should be used mainly in
-- interactiv mode.
validate' :: Statement -> Bool
-- | validates the statement with the configuration given by stdStc,
validateStochastic :: Stochastic -> Statement -> IO Valid
-- | defines the stochastic behavior of validateStochastic.
data Stochastic
Sparse :: Stochastic
Standard :: Stochastic
Massive :: Stochastic
-- | validates a statement according to the given stochastic with showing
-- the statistics.
validateStatistics :: Stochastic -> Statement -> IO Valid
-- | validates the proposition with the given configuration and stochastic.
validateWith :: Cnfg -> Statement -> IO Valid
-- | configuration of validating.
data Cnfg
Cnfg :: Maybe Omega -> Int -> (Int, Int) -> Int -> Int -> Bool -> Int -> Cnfg
-- | initial state.
[cnfOmega] :: Cnfg -> Maybe Omega
-- | number of samples to be validated.
[cnfSamples] :: Cnfg -> Int
-- | range of wide.
[cnfWide] :: Cnfg -> (Int, Int)
-- | maximal time for validateing in seconds.
[cnfMaxDuration] :: Cnfg -> Int
-- | duration between two log entires in seconds.
[cnfLogDuration] :: Cnfg -> Int
-- | True with statistics.
[cnfStatistics] :: Cnfg -> Bool
-- | number of labels to be shown for the statistics over all.
[cnfStcPathLength] :: Cnfg -> Int
-- | result of the validation.
data Result
Result :: Maybe Valid -> Int -> Int -> Int -> Int -> Result
[rsValid] :: Result -> Maybe Valid
[rsValidatedSamples] :: Result -> Int
-- | number of tests over all
[rsTests] :: Result -> Int
-- | number of false tests from a non valid sample
[rsTestsFalse] :: Result -> Int
-- | number of tests from reduced denied premises
[rsTestsRdcDndPrms] :: Result -> Int
-- | standard configuration
stdCnf :: Cnfg
-- | adapts the standard configuration stdCnf according to the given
-- stochastic.
stdStc :: Stochastic -> Cnfg
instance GHC.Show.Show OAlg.Control.Validate.ValidateException
instance GHC.Enum.Bounded OAlg.Control.Validate.Stochastic
instance GHC.Enum.Enum OAlg.Control.Validate.Stochastic
instance GHC.Classes.Ord OAlg.Control.Validate.Stochastic
instance GHC.Classes.Eq OAlg.Control.Validate.Stochastic
instance GHC.Read.Read OAlg.Control.Validate.Stochastic
instance GHC.Show.Show OAlg.Control.Validate.Stochastic
instance GHC.Show.Show OAlg.Control.Validate.Cnfg
instance GHC.Show.Show OAlg.Control.Validate.Result
instance GHC.Exception.Type.Exception OAlg.Control.Validate.ValidateException
-- | category of paths over morphisms.
module OAlg.Category.Path
-- | paths over morphisms.
data Path m x y
[IdPath] :: Struct (ObjectClass m) x -> Path m x x
[:.] :: m y z -> Path m x y -> Path m x z
infixr 9 :.
-- | the opposite path.
toOp2Path :: Morphism m => Path m x y -> Path (Op2 m) y x
-- | from the opposite path.
fromOp2Path :: Morphism m => Path (Op2 m) x y -> Path m y x
-- | composing the morphisms of a path.
compose :: Category m => Path m x y -> m x y
-- | embedding morphisms into paths.
mPath :: Morphism m => m x y -> Path m x y
-- | reversing a path given by the formal inverse function.
reverse :: (Morphism m, Morphism f) => (forall u. Struct (ObjectClass m) u -> Struct (ObjectClass f) u) -> (forall u v. m u v -> f v u) -> Path m x y -> Path f y x
-- | folding from the right.
pthFoldr :: (forall x y. m x y -> f x -> f y) -> f a -> Path m a b -> f b
-- | the length of a path.
pthLength :: Path m x y -> N
instance OAlg.Category.Definition.Morphism m => OAlg.Data.Dualisable.Dualisable (OAlg.Category.Path.Path m x y)
instance OAlg.Data.Show.Show2 m => OAlg.Data.Show.Show2 (OAlg.Category.Path.Path m)
instance OAlg.Data.Show.Show2 (OAlg.Category.Path.Path m) => GHC.Show.Show (OAlg.Category.Path.Path m x y)
instance (OAlg.Category.Definition.Morphism m, OAlg.Data.Validable.Validable2 m) => OAlg.Data.Validable.Validable2 (OAlg.Category.Path.Path m)
instance OAlg.Data.Validable.Validable2 (OAlg.Category.Path.Path m) => OAlg.Data.Validable.Validable (OAlg.Category.Path.Path m x y)
instance (OAlg.Category.Definition.EmbeddableMorphismTyp m, OAlg.Data.Equal.Eq2 m) => OAlg.Data.Equal.Eq2 (OAlg.Category.Path.Path m)
instance OAlg.Data.Equal.Eq2 (OAlg.Category.Path.Path m) => GHC.Classes.Eq (OAlg.Category.Path.Path m x y)
instance (OAlg.Entity.Definition.Entity2 h, OAlg.Category.Definition.EmbeddableMorphismTyp h) => OAlg.Entity.Definition.Entity2 (OAlg.Category.Path.Path h)
instance OAlg.Category.Definition.Morphism m => OAlg.Category.Definition.Morphism (OAlg.Category.Path.Path m)
instance OAlg.Category.Definition.EmbeddableMorphism m t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Category.Path.Path m) t
instance OAlg.Category.Definition.EmbeddableMorphismTyp m => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Category.Path.Path m)
instance OAlg.Category.Definition.Morphism m => OAlg.Category.Definition.Category (OAlg.Category.Path.Path m)
instance OAlg.Category.Applicative.Applicative m => OAlg.Category.Applicative.Applicative (OAlg.Category.Path.Path m)
instance (OAlg.Category.Applicative.Applicative m, OAlg.Category.Definition.Morphism m) => OAlg.Category.Definition.Functorial (OAlg.Category.Path.Path m)
instance (OAlg.Category.Definition.Cayleyan2 m, OAlg.Category.Definition.EmbeddableMorphismTyp m) => OAlg.Category.Definition.Cayleyan2 (OAlg.Category.Path.Path m)
-- | unification of categories, i.e. projecting morphisms by dropping the
-- parameterization by there domain and range.
module OAlg.Category.Unify
-- | some morphism.
data SomeMorphism m
[SomeMorphism] :: m x y -> SomeMorphism m
-- | some object class.
data SomeObjectClass m
[SomeObjectClass] :: Transformable (ObjectClass m) Typ => Struct (ObjectClass m) x -> SomeObjectClass m
-- | some morphism given by a Site.
data SomeMorphismSite s m x
[SomeMorphismDomain] :: m x y -> SomeMorphismSite From m x
[SomeMorphismRange] :: m x y -> SomeMorphismSite To m y
-- | some path
data SomePath m
[SomePath] :: Path m x y -> SomePath m
-- | embedding.
somePath :: SomePathSite s m x -> SomePath m
-- | some path parameterized either by its domain or range.
data SomePathSite s m x
[SomePathDomain] :: Path m x y -> SomePathSite From m x
[SomePathRange] :: Path m x y -> SomePathSite To m y
-- | some entity x in x having the given
-- ObjectClass m as structure.
data SomeEntity m
[SomeEntity] :: Entity x => Struct (ObjectClass m) x -> x -> SomeEntity m
-- | some application.
data SomeApplication h
[SomeApplication] :: h x y -> x -> SomeApplication h
instance GHC.Show.Show (OAlg.Category.Unify.SomeObjectClass m)
instance OAlg.Data.Dualisable.Dualisable (OAlg.Category.Unify.SomeMorphismSite 'OAlg.Data.Dualisable.To m y)
instance OAlg.Category.Definition.Morphism m => OAlg.Data.Dualisable.Dualisable (OAlg.Category.Unify.SomePathSite 'OAlg.Data.Dualisable.To m y)
instance OAlg.Data.Dualisable.Dualisable (OAlg.Category.Unify.SomeObjectClass m)
instance GHC.Classes.Eq (OAlg.Category.Unify.SomeObjectClass m)
instance OAlg.Data.Validable.Validable (OAlg.Category.Unify.SomeObjectClass m)
instance Data.Typeable.Internal.Typeable m => OAlg.Entity.Definition.Entity (OAlg.Category.Unify.SomeObjectClass m)
instance OAlg.Data.Show.Show2 m => GHC.Show.Show (OAlg.Category.Unify.SomePath m)
instance OAlg.Category.Definition.Morphism m => OAlg.Data.Dualisable.Dualisable (OAlg.Category.Unify.SomePath m)
instance OAlg.Data.Show.Show2 m => GHC.Show.Show (OAlg.Category.Unify.SomeMorphism m)
instance (OAlg.Category.Definition.EmbeddableMorphismTyp m, Data.Typeable.Internal.Typeable m, OAlg.Data.Equal.Eq2 m) => GHC.Classes.Eq (OAlg.Category.Unify.SomeMorphism m)
instance OAlg.Data.Validable.Validable2 m => OAlg.Data.Validable.Validable (OAlg.Category.Unify.SomeMorphism m)
instance (OAlg.Category.Definition.EmbeddableMorphismTyp m, OAlg.Entity.Definition.Entity2 m) => OAlg.Entity.Definition.Entity (OAlg.Category.Unify.SomeMorphism m)
-- | propositions on categories.
module OAlg.Category.Proposition
-- | validity of a Category.
prpCategory :: (Category c, Eq2 c, Show2 c) => XCat c -> Statement
-- | random variable for validating Category.
data XCat c
XCat :: X (SomeMorphism c) -> X (SomeCmpb3 c) -> XCat c
[xcSomeMrph] :: XCat c -> X (SomeMorphism c)
[xcSomeCmpb3] :: XCat c -> X (SomeCmpb3 c)
-- | validity according to OAlg.Category.Category#Cat1.
prpCategory1 :: (Category c, Show2 c, Eq2 c) => X (SomeMorphism c) -> Statement
-- | validity according to OAlg.Category.Category#Cat2.
prpCategory2 :: (Category c, Show2 c, Eq2 c) => X (SomeCmpb3 c) -> Statement
-- | some composable morphisms.
data SomeCmpb3 c
[SomeCmpb3] :: c x w -> c y x -> c z y -> SomeCmpb3 c
-- | random variable for some application.
type XAppl h = X (SomeApplication h)
-- | validity of a Functorial category.
prpFunctorial :: (Functorial c, Show2 c) => XFnct c -> Statement
-- | random variable for Functorial categories.
data XFnct c
[XFnct] :: X (SomeEntity c) -> X (SomeCmpbAppl c) -> XFnct c
-- | validity according to OAlg.Category.Category#Fnc1.
prpFunctorial1 :: (Functorial c, Show2 c) => X (SomeEntity c) -> Statement
-- | validity according to OAlg.Category.Category#Fnc2.
prpFunctorial2 :: (Functorial c, Show2 c) => X (SomeCmpbAppl c) -> Statement
-- | some composable morphisms with an applicable value.
data SomeCmpbAppl c
[SomeCmpbAppl] :: (Entity x, Eq z) => c y z -> c x y -> x -> SomeCmpbAppl c
-- | validity of Cayleyan2.
prpCayleyan2 :: (Cayleyan2 c, Show2 c) => X (SomeMorphism c) -> Statement
-- | random variable for validating Category.
xCat :: Category c => XMrphSite s c -> XCat c
-- | random variable of SomeObjectClass and SomeMorphismSite
-- with:
--
-- Note
--
--
-- - The random variable X (SomeObjectClass m)
-- should have a bias towards non terminal respectively initial object
-- classes. For an implementation see xIsoOpOrtFrom.
-- - It is the analogue to XStart at the level of
-- Categorys.
--
data XMrphSite (s :: Site) m
[XDomain] :: X (SomeObjectClass m) -> (forall x. Struct (ObjectClass m) x -> X (SomeMorphismSite From m x)) -> XMrphSite From m
[XRange] :: X (SomeObjectClass m) -> (forall y. Struct (ObjectClass m) y -> X (SomeMorphismSite To m y)) -> XMrphSite To m
-- | random variable of paths of Morphisms having maximal the given
-- length. If during the randomly build path no terminal respectively
-- initial object class has reached then the resulting path will have the
-- given length.
--
-- It is the analogue to xStartPathOrt at the level of
-- Categorys.
xSomePathSiteMax :: Morphism m => XMrphSite s m -> N -> Struct (ObjectClass m) x -> X (SomePathSite s m x)
-- | derived random variable for some paths.
xSomePathMax :: Morphism m => XMrphSite s m -> N -> X (SomePath m)
-- | constructing random variable for some path site.
xSomePathSite :: Category c => XMrphSite s c -> N -> Struct (ObjectClass c) x -> X (SomePathSite s c x)
-- | constructing random variable for some path.
xSomePath :: Category c => XMrphSite s c -> N -> X (SomePath c)
-- | random variable for Functorial Categorys.
xFnct :: (Category c, Transformable (ObjectClass c) Ent) => XFnctMrphSite s c -> XFnct c
-- | random variable for Morphisms for a given Site.
xMrphSite :: XFnctMrphSite s m -> XMrphSite s m
-- | random variable for Functorial Categorys.
data XFnctMrphSite s m
[XFnctMrphSite] :: XMrphSite s m -> (forall x. Struct (ObjectClass m) x -> X x) -> XFnctMrphSite s m
instance GHC.Show.Show OAlg.Category.Proposition.XMorphismException
instance GHC.Classes.Eq OAlg.Category.Proposition.XMorphismException
instance OAlg.Data.Dualisable.Dualisable (OAlg.Category.Proposition.XMrphSite 'OAlg.Data.Dualisable.To m)
instance GHC.Exception.Type.Exception OAlg.Category.Proposition.XMorphismException
-- | To avoid ambiguity for the algebraic operators on should
-- exclude the standard Prelude and use this one instead.
module OAlg.Prelude
-- | The Bounded class is used to name the upper and lower limits of
-- a type. Ord is not a superclass of Bounded since types
-- that are not totally ordered may also have upper and lower bounds.
--
-- The Bounded class may be derived for any enumeration type;
-- minBound is the first constructor listed in the data
-- declaration and maxBound is the last. Bounded may also
-- be derived for single-constructor datatypes whose constituent types
-- are in Bounded.
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
-- | A value of type IO a is a computation which, when
-- performed, does some I/O before returning a value of type a.
--
-- There is really only one way to "perform" an I/O action: bind it to
-- Main.main in your program. When your program is run, the I/O
-- will be performed. It isn't possible to perform I/O from an arbitrary
-- function, unless that function is itself in the IO monad and
-- called at some point, directly or indirectly, from Main.main.
--
-- IO is a monad, so IO actions can be combined using
-- either the do-notation or the >> and >>=
-- operations from the Monad class.
data IO a
-- | The same as putStr, but adds a newline character.
putStrLn :: String -> IO ()
-- | The value of seq a b is bottom if a is bottom, and
-- otherwise equal to b. In other words, it evaluates the first
-- argument a to weak head normal form (WHNF). seq is
-- usually introduced to improve performance by avoiding unneeded
-- laziness.
--
-- A note on evaluation order: the expression seq a b does
-- not guarantee that a will be evaluated before
-- b. The only guarantee given by seq is that the both
-- a and b will be evaluated before seq
-- returns a value. In particular, this means that b may be
-- evaluated before a. If you need to guarantee a specific order
-- of evaluation, you must use the function pseq from the
-- "parallel" package.
seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
infixr 0 `seq`
-- | A special case of error. It is expected that compilers will
-- recognize this and insert error messages which are more appropriate to
-- the context in which undefined appears.
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
-- | error stops execution and displays an error message.
error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
-- | concept of Projective and Injective.
module OAlg.Limes.Perspective
-- | concept of Projective and Injective.
data Perspective
Projective :: Perspective
Injective :: Perspective
instance GHC.Enum.Bounded OAlg.Limes.Perspective.Perspective
instance GHC.Enum.Enum OAlg.Limes.Perspective.Perspective
instance GHC.Classes.Ord OAlg.Limes.Perspective.Perspective
instance GHC.Classes.Eq OAlg.Limes.Perspective.Perspective
instance GHC.Show.Show OAlg.Limes.Perspective.Perspective
-- | arithmetic exceptions.
module OAlg.Structure.Exception
-- | arithmetic exceptions which are sub exceptions from
-- SomeOAlgException.
data ArithmeticException
NotAddable :: ArithmeticException
NotMultiplicable :: ArithmeticException
NotInvertible :: ArithmeticException
UndefinedScalarproduct :: ArithmeticException
NotExponential :: ArithmeticException
NotEndo :: ArithmeticException
NotTransformable :: ArithmeticException
NoMinusOne :: ArithmeticException
NotApplicable :: ArithmeticException
instance GHC.Show.Show OAlg.Structure.Exception.ArithmeticException
instance GHC.Classes.Eq OAlg.Structure.Exception.ArithmeticException
instance GHC.Exception.Type.Exception OAlg.Structure.Exception.ArithmeticException
-- | definition of Oriented structures.
module OAlg.Structure.Oriented.Definition
-- | types with a Oriented structure. The values of an
-- Oriented structure will be called arrows and the
-- values of the associated Point type points. To
-- each arrow there is a start and a
-- end point assigned.
--
-- Property Let q be a type instance of the class
-- Oriented, then holds:
--
--
-- - For all a in q holds:
-- orientation a == start a :>
-- end a.
--
--
-- Note
--
--
-- - If the types q and Point q
-- are interpreted as sets A and P and
-- start, end as functions from A to
-- P then this structure forms a quiver
-- with arrows in A and
-- points in P.
-- - Morphisms can be interpreted as Oriented structures
-- via SomeMorphism. The bad thing about this is that we lose the
-- check for composability of two Morphisms given by the
-- type checker, but we gain all the functionality of Oriented
-- structures, i.e we can define homomorphisms, limits etc on
-- Morphisms.
--
class (Entity q, Entity (Point q)) => Oriented q where {
-- | the associated type of points.
type Point q;
}
-- | the orientation of an arrow.
orientation :: Oriented q => q -> Orientation (Point q)
-- | the start point of an arrow.
start :: Oriented q => q -> Point q
-- | the end point of an arrow.
end :: Oriented q => q -> Point q
-- | structures where its associated Point type is singleton. They
-- yield globally defiend algebraic operations.
class Singleton (Point x) => Total x
-- | helper class to avoid undecidable instances.
class Entity (Point x) => EntityPoint x
-- | helper class to circumvent undecidable instances.
class Ord (Point x) => OrdPoint x
-- | check for being an endo.
--
-- Definition Let q be a Oriented
-- structure, then an arrow a in q is called
-- endo if and only if start a ==
-- end a.
isEndo :: Oriented q => q -> Bool
-- | check for being an endo at the given point.
isEndoAt :: Oriented a => Point a -> a -> Bool
-- | as Orientation p is an instance of almost every
-- structured class it serves as a standard type for validating.
type OS = Orientation Symbol
-- | type representing the class of Oriented structures.
data Ort
-- | attest that if x is Oriented then also
-- Op x is Oriented.
structOrtOp :: Struct Ort x -> Struct Ort (Op x)
-- | transformable to Oriented structure.
class Transformable s Ort => ForgetfulOrt s
-- | transposable oriented structures.
--
-- Property Let q be a TransposableOriented
-- structure, then holds: For all a in q holds:
-- orientation (transpose a) == opposite
-- (orientation a).
class (Transposable q, Oriented q) => TransposableOriented q
-- | orientation given by the start point as its first component and the
-- end point as its second.
--
-- Property For all o in Orientation
-- p holds: o == start o :>
-- end o.
--
-- Note As Orientations are instances of almost all
-- algebraic structures defined here, they serve as a proof that
-- this structures are instanceable.
data Orientation p
(:>) :: p -> p -> Orientation p
infix 5 :>
-- | the opposite orientation.
opposite :: Orientation p -> Orientation p
-- | a path in a Oriented structure q starting at a
-- given point.
--
-- Definition Let q be a Oriented structure
-- and p = Path s [a 0..a (n-1)] a path in
-- q, then p is valid if and only if
--
--
-- - s is valid and a i are valid for
-- all i = 0..n-1.
-- - start (a (n-1)) == s and start
-- (a i) == end (a (n+1)) for all i =
-- 0..n-2.
--
--
-- furthermore n is called the length of
-- p.
--
-- Note Paths admit a canonical embedding in to Product.
data Path q
Path :: Point q -> [q] -> Path q
-- | the length of a path.
pthLength :: Path q -> N
-- | path of length 0 at the given point.
pthOne :: Point q -> Path q
-- | composition of two paths.
pthMlt :: Oriented q => Path q -> Path q -> Path q
-- | random variables X q and X
-- (Point q) for Oriented structure
-- q.
--
-- Properties Let q be an instance of the class
-- Oriented, then holds:
--
--
-- - Let XStart xp xStart be in XOrtSite
-- From q, then holds: For all p in
-- Point q and x in the range of
-- xStart p holds: start x == p.
-- - Let XEnd xp xEnd be in XOrtSite
-- To q, then holds: For all p in
-- Point q and x in the range of xEnd
-- p holds: end x == p.
--
--
-- Note The random variables xp should have a bias to non
-- trivial random variables xp >>= xStart or xp
-- >>= xEnd.
data XOrtSite s q
[XStart] :: X (Point q) -> (Point q -> X q) -> XOrtSite From q
[XEnd] :: X (Point q) -> (Point q -> X q) -> XOrtSite To q
-- | standard random variable for XOrtSite.
class XStandardOrtSite s a
xStandardOrtSite :: XStandardOrtSite s a => XOrtSite s a
-- | standard random variable for XOrtSite To,
-- helper class to avoid undecidable instances.
class XStandardOrtSite To a => XStandardOrtSiteTo a
-- | standard random variable for XOrtSite From,
-- helper class to avoid undecidable instances.
class XStandardOrtSite From a => XStandardOrtSiteFrom a
-- | to the dual of a XOrtSite s q, with
-- inverse coXOrtSiteInv.
coXOrtSite :: XOrtSite s q -> Dual (XOrtSite s q)
-- | from the dual of a Dual (XOrtSite s
-- q), with inverse coXOrtSite.
coXOrtSiteInv :: (Dual (Dual s) :~: s) -> Dual (XOrtSite s q) -> XOrtSite s q
-- | from the bidual.
xosFromOpOp :: XOrtSite s (Op (Op q)) -> XOrtSite s q
-- | the random variable of arrows in q having all as
-- start the given point.
xosStart :: XOrtSite From q -> Point q -> X q
-- | the random variable of arrows in q having all as
-- end the given point.
xosEnd :: XOrtSite To q -> Point q -> X q
-- | tries to make a path at the given point with maximal length of the
-- given length.
--
-- Properties Let xPath = xosPathMaxAt xos n x,
-- then holds:
--
--
-- - If xos matches XStart _ xq then for all
-- p in the range of xPath
-- holds:
- start p == x.
- If
-- pthLength p < n then xq (end
-- p) matches XEmpty.
-- - If xos matches XEnd _ xq then for all
-- p in the range of xPath holds:
- end
-- p == x.
- If pthLength p <
-- n then xq (start p) matches
-- XEmpty.
--
xosPathMaxAt :: Oriented q => XOrtSite s q -> N -> Point q -> X (Path q)
-- | random variable of paths with maximal length of the given length.
xosPathMax :: Oriented q => XOrtSite s q -> N -> X (Path q)
-- | random variable of arrows given by an orientation.
--
-- Properties Let XOrtOrientation xo xArrow be in
-- XOrtOrientation q for a Oriented
-- structure q, then holds: For all o in
-- Orientation q and x in the range of
-- xArrow o holds: orientation x == o.
--
-- Note The random variable xo should have a bias to non
-- trivial random variables xo >>= xArrow and as
-- such the range of xo should be included in one connection
-- component of q.
data XOrtOrientation q
XOrtOrientation :: X (Orientation (Point q)) -> (Orientation (Point q) -> X q) -> XOrtOrientation q
-- | the underlying random variable of orientations.
xoOrientation :: XOrtOrientation q -> X (Orientation (Point q))
-- | the underlying random variable of arrow given by the orientation.
xoArrow :: XOrtOrientation q -> Orientation (Point q) -> X q
-- | the underlying random variable of points, i.e. the union of the
-- induced start and end random variable of
-- xoOrientation.
xoPoint :: Oriented q => XOrtOrientation q -> X (Point q)
-- | to the dual.
coXOrtOrientation :: XOrtOrientation q -> Dual (XOrtOrientation q)
-- | the induced XOrtSite To
xoTo :: Oriented q => XOrtOrientation q -> XOrtSite To q
-- | the induced XOrtSite From.
xoFrom :: Oriented q => XOrtOrientation q -> XOrtSite From q
-- | random variable of XOrtOrientation q for a
-- total q.
xoTtl :: Total q => X q -> XOrtOrientation q
-- | the induced random variable of Orientation q.
xoOrnt :: X p -> XOrtOrientation (Orientation p)
-- | standard random variable for XOrtOrientation.
class XStandardOrtOrientation q
xStandardOrtOrientation :: XStandardOrtOrientation q => XOrtOrientation q
-- | standard random variable of Points of a.
class XStandard (Point a) => XStandardPoint a
-- | the XOrtSite From for Orientation
-- p of the given random variable.
xStartOrnt :: X p -> XOrtSite From (Orientation p)
-- | the XOrtSite To of Orientation
-- p of the given random variable.
xEndOrnt :: X p -> XOrtSite To (Orientation p)
instance GHC.Classes.Ord p => GHC.Classes.Ord (OAlg.Structure.Oriented.Definition.Orientation p)
instance GHC.Classes.Eq p => GHC.Classes.Eq (OAlg.Structure.Oriented.Definition.Orientation p)
instance GHC.Show.Show p => GHC.Show.Show (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.Oriented q => GHC.Show.Show (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.Oriented q => GHC.Classes.Eq (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Data.Validable.XStandard p => OAlg.Structure.Oriented.Definition.XStandardOrtOrientation (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.XStandardOrtOrientation OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Data.Validable.Validable (OAlg.Structure.Oriented.Definition.XOrtOrientation q)
instance OAlg.Structure.Oriented.Definition.XStandardPoint OAlg.Data.Number.N
instance OAlg.Structure.Oriented.Definition.XStandardPoint OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.XStandardPoint OAlg.Data.Number.Q
instance OAlg.Data.Validable.XStandard p => OAlg.Structure.Oriented.Definition.XStandardPoint (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Data.Validable.XStandard p => OAlg.Structure.Oriented.Definition.XStandardOrtSiteFrom (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Data.Validable.XStandard p => OAlg.Structure.Oriented.Definition.XStandardOrtSiteTo (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Data.Validable.XStandard p => OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Data.Validable.XStandard p => OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From a => OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To (OAlg.Data.Opposite.Op a)
instance OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Oriented.Definition.XOrtSite 'OAlg.Data.Dualisable.To q)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Data.Validable.Validable (OAlg.Structure.Oriented.Definition.XOrtSite s q)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Oriented.Definition.Ort OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Oriented.Definition.Ort OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable1 OAlg.Data.Opposite.Op OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.TransformableOp OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Oriented.Definition.OrdPoint ()
instance OAlg.Structure.Oriented.Definition.OrdPoint GHC.Types.Int
instance OAlg.Structure.Oriented.Definition.OrdPoint GHC.Num.Integer.Integer
instance OAlg.Structure.Oriented.Definition.OrdPoint OAlg.Data.Number.N
instance OAlg.Structure.Oriented.Definition.OrdPoint OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.OrdPoint OAlg.Data.Number.Q
instance OAlg.Structure.Oriented.Definition.OrdPoint q => OAlg.Structure.Oriented.Definition.OrdPoint (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.EntityPoint ()
instance OAlg.Structure.Oriented.Definition.EntityPoint GHC.Types.Int
instance OAlg.Structure.Oriented.Definition.EntityPoint GHC.Num.Integer.Integer
instance OAlg.Structure.Oriented.Definition.EntityPoint OAlg.Data.Number.N
instance OAlg.Structure.Oriented.Definition.EntityPoint OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.EntityPoint OAlg.Data.Number.Q
instance OAlg.Structure.Oriented.Definition.EntityPoint q => OAlg.Structure.Oriented.Definition.EntityPoint (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.EntityPoint x => OAlg.Structure.Oriented.Definition.EntityPoint (OAlg.Data.Opposite.Op x)
instance OAlg.Structure.Oriented.Definition.Total ()
instance OAlg.Structure.Oriented.Definition.Total GHC.Types.Int
instance OAlg.Structure.Oriented.Definition.Total GHC.Num.Integer.Integer
instance OAlg.Structure.Oriented.Definition.Total OAlg.Data.Number.N
instance OAlg.Structure.Oriented.Definition.Total OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.Total OAlg.Data.Number.Q
instance OAlg.Structure.Oriented.Definition.Total q => OAlg.Structure.Oriented.Definition.Total (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.Total x => OAlg.Structure.Oriented.Definition.Total (OAlg.Data.Opposite.Op x)
instance Data.Foldable.Foldable OAlg.Structure.Oriented.Definition.Path
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Data.Validable.Validable (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Entity.Definition.Entity (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Data.Dualisable.Reflexive (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Data.Canonical.Embeddable q (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Data.Number.LengthN (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Oriented.Definition.TransposableOriented (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.TransposableOriented OAlg.Data.Number.N
instance OAlg.Structure.Oriented.Definition.TransposableOriented OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.TransposableOriented OAlg.Data.Number.Q
instance OAlg.Structure.Oriented.Definition.Oriented ()
instance OAlg.Structure.Oriented.Definition.Oriented GHC.Types.Int
instance OAlg.Structure.Oriented.Definition.Oriented GHC.Num.Integer.Integer
instance OAlg.Structure.Oriented.Definition.Oriented OAlg.Data.Number.N
instance OAlg.Structure.Oriented.Definition.Oriented OAlg.Data.Number.Z
instance OAlg.Structure.Oriented.Definition.Oriented OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Data.Opposite.Op q)
instance (OAlg.Category.Definition.EmbeddableMorphismTyp m, OAlg.Entity.Definition.Entity2 m) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Category.Unify.SomeMorphism m)
instance OAlg.Data.Validable.Validable p => OAlg.Data.Validable.Validable (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Entity.Definition.Entity p => OAlg.Entity.Definition.Entity (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Data.Singleton.Singleton u => OAlg.Data.Singleton.Singleton (OAlg.Structure.Oriented.Definition.Orientation u)
instance GHC.Base.Functor OAlg.Structure.Oriented.Definition.Orientation
instance OAlg.Data.Validable.XStandard p => OAlg.Data.Validable.XStandard (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Data.Dualisable.Transposable (OAlg.Structure.Oriented.Definition.Orientation p)
-- | Propositions on Oriented structure.
module OAlg.Structure.Oriented.Proposition
-- | validity of the Oriented structure of q.
prpOrt :: Oriented q => XOrt q -> Statement
-- | random variable for Oriented structures.
type XOrt = X
-- | validity of the functions orientation, start and
-- end.
prpOrt0 :: Oriented q => X q -> Statement
-- | validity of the relation between orientation, start and
-- end according to
-- OAlg.Structure.Oriented.Definition#Ort1.
prpOrt1 :: Oriented q => X q -> Statement
-- | the underlying random variable for Oriented structures.
xosOrt :: Oriented q => XOrtSite s q -> XOrt q
-- | the underlying random variable of Point g.
xosPoint :: XOrtSite s q -> X (Point q)
-- | the underlying random variable for Oriented structures.
xoOrt :: XOrtOrientation q -> XOrt q
-- | the induced random variable of Oriented structures for
-- Orientation p.
xOrtOrnt :: X p -> XOrt (Orientation p)
-- | Oriented structures.
module OAlg.Structure.Oriented
-- | multiplicative structures, i.e. structures with a partially
-- defined multiplication (*).
module OAlg.Structure.Multiplicative.Definition
-- | Oriented structures with a partially defined
-- multiplication and having one as the neutral
-- element of the multiplication. An entity of a
-- Multiplicative structure will be called a factor.
--
-- Properties Let c be a type instance of the
-- class Multiplicative, then holds:
--
--
-- - For all p in Point c holds:
-- orientation (one p) == p :>
-- p.
-- - For all f and g in c
-- holds:
- if start f == end g then
-- f * g is valid and start (f *
-- g) == start g and end (f * g)
-- == end f.
- if start f /=
-- end g then f * g is not valid and
-- its evaluation will end up in a NotMultiplicable
-- exception.
-- - For all f in c holds: one
-- (end f) * f == f and f *
-- one (start f) == f.
-- - For all f, g and h in c
-- with start g == end h and start f ==
-- end g holds: (f * g) * h == f
-- * (g * h).
-- - For all f in c
-- holds:
- npower f 1 == f.
- If
-- f is a endo than npower f 0 == one
-- (start f) and For all n in N holds:
-- npower f (succ n) == f * npower
-- f n.
--
--
-- Such a c will be called a multiplicative
-- structure and an entity f of c will
-- be called factor. The associated factor one
-- p to a p in Point c will be
-- called the one at p.
--
-- Note If the types c and Point
-- c are interpreted as sets M and
-- O and * as a partially defined
-- function from M x M -> M then this forms a
-- small category with objects in O and
-- morphisms in M.
class Oriented c => Multiplicative c
-- | the neutral element associated to each point. If there is no ambiguity
-- for one p we will briefly denote it by 1 r or
-- just 1.
one :: Multiplicative c => Point c -> c
-- | the multiplication of two factors.
(*) :: Multiplicative c => c -> c -> c
-- | n times the multiplication of a given factor f.
npower :: Multiplicative c => c -> N -> c
infixl 7 *
-- | the one to a given point. The type p c serves only as
-- proxy and one' is lazy in it.
--
-- Note As Point may be a non-injective type family, the
-- type checker needs some times a little bit more information to pic the
-- right one.
one' :: Multiplicative c => p c -> Point c -> c
-- | check for being equal to one.
isOne :: Multiplicative c => c -> Bool
-- | type representing the class of Multiplicative structures.
data Mlt
-- | transformable to Multiplicative structure.
class (ForgetfulOrt s, Transformable s Mlt) => ForgetfulMlt s
-- | transposable Multiplicative structures.
--
-- Property Let c be a
-- TransposableMultiplicative structure, then holds:
--
--
-- - For all p in Point c holds:
-- transpose (one p) = one p.
-- - For all f, g in c with
-- start f == end g holds:
-- transpose (f * g) == transpose g
-- * transpose f.
--
class (TransposableOriented c, Multiplicative c) => TransposableMultiplicative c
-- | commutative multiplicative structures.
--
-- Property Let c be a Commutative
-- structure, then holds: For all f and g in
-- c with start f == end f,
-- start g == end g and start f
-- == end g holds: f * g == g
-- * f.
class Multiplicative c => Commutative c
-- | multiplicative structures having a multiplicative
-- inverse.
--
-- Definition Let f and g be two factors in a
-- Multiplicative structure _c then we call
-- g a multiplicative inverse to f (or
-- short inverse) if and only if the following hold:
--
--
-- - start g == end f and end g ==
-- start f.
-- - f * g = one (end f) and g
-- * f == one (start f).
--
--
-- Properties For all f in a Invertible structure
-- c holds:
--
--
-- - isInvertible f is equivalent to
-- solvable (tryToInvert f).
-- - if isInvertible f holds, then invert
-- f is valid and it is the multiplicative inverse of
-- f. Furthermore invert f == solve
-- (tryToInvert m).
-- - if not isInvertible f holds, then
-- invert f is not valid and evaluating it will
-- end up in a NotInvertible-exception.
--
--
-- Note
--
--
-- - It is not required that every factor has a multiplicative inverse
-- (see Cayleyan for such structures).
-- - This structure is intended for multiplicative structures having a
-- known algorithm to evaluate for every invertible f its
-- inverse.
--
class Multiplicative c => Invertible c
-- | solver to evaluate the multiplicative inverse - if it exists.
tryToInvert :: Invertible c => c -> Solver c
-- | the inverse.
invert :: Invertible c => c -> c
-- | check for being invertible.
isInvertible :: Invertible c => c -> Bool
-- | if 0 <= z then n times the multiplication
-- for the given factor else prj z times the
-- multiplication of the inverse of the given factor.
zpower :: Invertible c => c -> Z -> c
-- | invertible factors within a Multiplicative structures
-- c, which forms a sub Multiplicative
-- structure on c, given by the canonical inclusion
-- inj which is given by \Inv f _ -> f.
--
-- Property Let Inv f f' be in Inv
-- c where c is a Multiplicative
-- structure, then holds:
--
--
-- - orientation f' == opposite
-- (orientation f).
-- - f' * f == one (start f).
-- - f * f' == one (end f).
--
--
-- Note The canonical inclusion is obviously not injective on the
-- set of all values of type Inv c to
-- c. But restricted to the valid ones it is
-- injective, because the inverses of a f in c
-- are uniquely determined by f.
data Inv c
Inv :: c -> c -> Inv c
-- | Invertible structures where every element is invertible.
--
-- Property Let c be a Cayleyan structure,
-- then holds: For all f in c holds:
-- isInvertible f == True.
--
-- Note
--
--
-- - If the type Point c is singleton, then the
-- mathematical interpretation of c is a
-- group.
-- - The name of this structures is given by Arthur Cayley who
-- introduced the concept (and the name) of an abstract group in 1854
-- (https://en.wikipedia.org/wiki/Arthur_Cayley).
-- - Usually in mathematics such a structure is called a
-- groupoid.
--
class Invertible c => Cayleyan c
-- | random variable of paths at the given point and the given length (see
-- xosPathMaxAt and as c is Multiplicative,
-- the underlying random variable for factors for a given point is not
-- empty).
xosPathAt :: Multiplicative c => XOrtSite s c -> N -> Point c -> X (Path c)
-- | random variable of paths with the given length.
xosPath :: Multiplicative c => XOrtSite s c -> N -> X (Path c)
-- | the induced random variable for paths.
xosXOrtSitePath :: Multiplicative c => XOrtSite s c -> N -> XOrtSite s (Path c)
instance GHC.Classes.Eq c => GHC.Classes.Eq (OAlg.Structure.Multiplicative.Definition.Inv c)
instance GHC.Show.Show c => GHC.Show.Show (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.ForgetfulMlt OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Multiplicative.Definition.Mlt OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Multiplicative.Definition.Mlt OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Multiplicative.Definition.Mlt OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.Transformable1 OAlg.Data.Opposite.Op OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Structure.Definition.TransformableOp OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Data.Canonical.Embeddable (OAlg.Structure.Multiplicative.Definition.Inv c) c
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Data.Validable.Validable (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Entity.Definition.Entity (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative c => OAlg.Data.Dualisable.Transposable (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative c => OAlg.Structure.Oriented.Definition.TransposableOriented (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative c => OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative (OAlg.Structure.Multiplicative.Definition.Inv c)
instance OAlg.Structure.Multiplicative.Definition.Cayleyan ()
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Multiplicative.Definition.Cayleyan c => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Data.Opposite.Op c)
instance OAlg.Structure.Multiplicative.Definition.Invertible ()
instance OAlg.Structure.Multiplicative.Definition.Invertible GHC.Types.Int
instance OAlg.Structure.Multiplicative.Definition.Invertible GHC.Num.Integer.Integer
instance OAlg.Structure.Multiplicative.Definition.Invertible OAlg.Data.Number.N
instance OAlg.Structure.Multiplicative.Definition.Invertible OAlg.Data.Number.Z
instance OAlg.Structure.Multiplicative.Definition.Invertible OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Multiplicative.Definition.Invertible c => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Data.Opposite.Op c)
instance OAlg.Structure.Multiplicative.Definition.Commutative ()
instance OAlg.Structure.Multiplicative.Definition.Commutative GHC.Types.Int
instance OAlg.Structure.Multiplicative.Definition.Commutative GHC.Num.Integer.Integer
instance OAlg.Structure.Multiplicative.Definition.Commutative OAlg.Data.Number.N
instance OAlg.Structure.Multiplicative.Definition.Commutative OAlg.Data.Number.Z
instance OAlg.Structure.Multiplicative.Definition.Commutative OAlg.Data.Number.Q
instance OAlg.Structure.Multiplicative.Definition.Commutative c => OAlg.Structure.Multiplicative.Definition.Commutative (OAlg.Data.Opposite.Op c)
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative OAlg.Data.Number.N
instance OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative OAlg.Data.Number.Z
instance OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative OAlg.Data.Number.Q
instance OAlg.Structure.Multiplicative.Definition.Multiplicative ()
instance OAlg.Structure.Multiplicative.Definition.Multiplicative GHC.Types.Int
instance OAlg.Structure.Multiplicative.Definition.Multiplicative GHC.Num.Integer.Integer
instance OAlg.Structure.Multiplicative.Definition.Multiplicative OAlg.Data.Number.N
instance OAlg.Structure.Multiplicative.Definition.Multiplicative OAlg.Data.Number.Z
instance OAlg.Structure.Multiplicative.Definition.Multiplicative OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Structure.Oriented.Definition.Path q)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Data.Opposite.Op c)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Data.Canonical.Projectible c (OAlg.Structure.Oriented.Definition.Path c)
-- | operations on entities by a Multiplicative structure.
module OAlg.Structure.Operational
-- | right operation of f on x. This class
-- is rather technical, because on this abstract level it is not possible
-- to define the exact behavior of the operation, i.e. for which values
-- f and x the expression x <* f is
-- valid. For a precise definition see for example TotalOpr
-- or OrientedOpr where the behavior can be stated.
class Opr f x
-- | right operation.
(<*) :: Opr f x => x -> f -> x
infixl 5 <*
-- | left operation of f on x. This class
-- is rather technical, because on this abstract level it is not possible
-- to define the exact behavior of the operation, i.e. for which values
-- f and x the expression f *> x is
-- valid. For a precise definition see for example TotalOpl
-- or OrientedOpl where the behavior can be stated.
class Opl f x
(*>) :: Opl f x => f -> x -> x
infixr 9 *>
-- | right operation of a Total Multiplicative structure
-- f on x.
--
-- Property Let f be a Total
-- Multiplicative structure and x an instance of
-- Entity, then holds:
--
--
-- - For all x in x holds: x <*
-- one u == x where u = unit is the
-- singleton element in Point f.
-- - For all x in x and f, g
-- in f holds: x <* f <* g
-- == x <* (f * g).
--
--
-- Note If f is invertible, then it gives rise of a
-- bijection <* f on x with
-- inverse <* invert f.
class (Opr f x, Multiplicative f, Total f, Entity x) => TotalOpr f x
-- | left operation of a Total Multiplicative structure
-- f on x.
--
-- Property Let f be a Total
-- Multiplicative structure and x an instance of
-- Entity, then holds:
--
--
-- - For all x in x holds: one u
-- *> x == x where u = unit is the
-- singleton element in Point f.
-- - For all x in x and f, g
-- in f holds: f *> g *> x
-- == (f * g) *> x.
--
--
-- Note If f is invertible, then it gives rise of a
-- bijection f *> on x with
-- inverse invert f *>.
class (Opr f x, Multiplicative f, Total f, Entity x) => TotalOpl f x
-- | right operation of a Multiplicative structure f
-- on a Oriented structure x.
--
-- Property Let f be a Multiplicative and
-- x a Oriented structure, then holds:
--
--
-- - For all f in f and x in
-- x holds.
- If start x ==
-- end f then x <* f is valid and
-- orientation (x <* f) == start f
-- :> end x.
- If start x
-- /= end f then x <* f is not
-- valid and its evaluation will end up in a NotApplicable
-- exception.
-- - For all x in x holds: x <*
-- one (start x) == x.
-- - For all x in x and f, g
-- in f with end f == start
-- x, end g == start f holds: x
-- <* f <* g == x <* (f *
-- g).
--
--
-- Note If f is invertible, then it rise of a
-- bijection <* f from all x in
-- x with start x == end f
-- to all y in x with start y
-- == start f. Its inverse is given by
-- <* invert f.
class (Opr f x, Multiplicative f, Oriented x) => OrientedOpr f x
-- | left operation of a Multiplicative structure f
-- on a Oriented structure x.
--
-- Property Let f be a Multiplicative and
-- x a Oriented structure, and f,
-- x an instance of OrientedOpl, then holds:
--
--
-- - For all f in f and x in
-- x holds.
- If end x ==
-- start f then f *> x is valid and
-- orientation (f *> x) == start x
-- :> end f.
- If end x /=
-- start f then f *> x is not valid
-- and its evaluation will end up in a NotApplicable
-- exception.
-- - For all x in x holds: one
-- (end x) *> x== x.
-- - For all x in x and f, g
-- in f with start g == end
-- x, start f == end g holds: f
-- *> g *> x == (f * g) *> x
-- .
--
--
-- Note If f is invertible, then it rise of a
-- bijection f *> from all x in
-- x with end x == start f
-- to all y in x with end y ==
-- end f. Its inverse is given by invert f
-- *>.
class (Opl f x, Multiplicative f, Oriented x) => OrientedOpl f x
-- | Propositions on Multiplicative structures.
module OAlg.Structure.Multiplicative.Proposition
-- | validity of the Multiplicative structure of c.
prpMlt :: Multiplicative c => XMlt c -> Statement
-- | random variable for Multiplicative structures.
--
-- Note As the multiplication could by costly, it is recommended
-- to use a bounded random variable for xMltN which serves to
-- validate npower.
data XMlt c
XMlt :: X N -> X (Point c) -> X c -> X (Endo c) -> X (Mltp2 c) -> X (Mltp3 c) -> XMlt c
[xMltN] :: XMlt c -> X N
[xMltPoint] :: XMlt c -> X (Point c)
[xMltFactor] :: XMlt c -> X c
[xMltEndo] :: XMlt c -> X (Endo c)
[xMltMltp2] :: XMlt c -> X (Mltp2 c)
[xMltMltp3] :: XMlt c -> X (Mltp3 c)
-- | predicate for endos.
newtype Endo q
Endo :: q -> Endo q
-- | predicate for two multiplicable factors.
data Mltp2 c
Mltp2 :: c -> c -> Mltp2 c
-- | predicate for three multiplicable factors.
data Mltp3 c
Mltp3 :: c -> c -> c -> Mltp3 c
-- | validity of one according to
-- OAlg.Structure.Multiplicative.Definition#Mlt1.
prpMlt1 :: Multiplicative c => p c -> X (Point c) -> Statement
-- | validity of * according to
-- OAlg.Structure.Multiplicative.Definition#Mlt2.
prpMlt2 :: Multiplicative c => X (c, c) -> Statement
-- | validity of * for two multiplicable factors according to
-- OAlg.Structure.Multiplicative.Definition#Mlt2_1.
prpMlt2_1 :: Multiplicative c => Mltp2 c -> Statement
-- | validity of * for two not multiplicable factors according to
-- OAlg.Structure.Multiplicative.Definition#Mlt2_2.
prpMlt2_2 :: Multiplicative c => c -> c -> Statement
-- | validity according to
-- OAlg.Structure.Multiplicative.Definition#Mlt3.
prpMlt3 :: Multiplicative c => X c -> Statement
-- | validity according to
-- OAlg.Structure.Multiplicative.Definition#Mlt4.
prpMlt4 :: Multiplicative c => X (Mltp3 c) -> Statement
-- | validity of npower according to
-- OAlg.Structure.Multiplicative.Definition#Mlt5.
--
-- Note As the multiplication can by very costly the random
-- variable for X N - which serves to check
-- OAlg.Structure.Multiplicative.Definition#Mlt5_2 - has to be
-- chosen carefully.
prpMlt5 :: Multiplicative c => X N -> X c -> X (Endo c) -> Statement
-- | standard random variable for Multiplicative structures.
class XStandardMlt c
xStandardMlt :: XStandardMlt c => XMlt c
-- | random variable for Multiplicative structures.
xMlt :: Multiplicative c => XOrtSite d c -> X N -> X (Endo c) -> XMlt c
-- | random variable of two multiplicable factors.
xMltp2 :: Multiplicative c => XOrtSite d c -> X (Mltp2 c)
-- | random variable of three multiplicable factors.
xMltp3 :: Multiplicative c => XOrtSite d c -> X (Mltp3 c)
-- | the induced random variable for multiplicable structures.
xoMlt :: Multiplicative c => X N -> XOrtOrientation c -> XMlt c
-- | random variable for total Multiplicative structures.
xMltTtl :: Singleton (Point c) => X N -> X c -> XMlt c
-- | random variable for the Multiplicative structure of
-- Orientation p.
xMltOrnt :: Entity p => X N -> X p -> XMlt (Orientation p)
instance GHC.Classes.Ord q => GHC.Classes.Ord (OAlg.Structure.Multiplicative.Proposition.Endo q)
instance GHC.Classes.Eq q => GHC.Classes.Eq (OAlg.Structure.Multiplicative.Proposition.Endo q)
instance GHC.Show.Show q => GHC.Show.Show (OAlg.Structure.Multiplicative.Proposition.Endo q)
instance GHC.Classes.Ord c => GHC.Classes.Ord (OAlg.Structure.Multiplicative.Proposition.Mltp2 c)
instance GHC.Classes.Eq c => GHC.Classes.Eq (OAlg.Structure.Multiplicative.Proposition.Mltp2 c)
instance GHC.Show.Show c => GHC.Show.Show (OAlg.Structure.Multiplicative.Proposition.Mltp2 c)
instance GHC.Classes.Ord c => GHC.Classes.Ord (OAlg.Structure.Multiplicative.Proposition.Mltp3 c)
instance GHC.Classes.Eq c => GHC.Classes.Eq (OAlg.Structure.Multiplicative.Proposition.Mltp3 c)
instance GHC.Show.Show c => GHC.Show.Show (OAlg.Structure.Multiplicative.Proposition.Mltp3 c)
instance OAlg.Structure.Multiplicative.Proposition.XStandardMlt OAlg.Data.Number.N
instance OAlg.Structure.Multiplicative.Proposition.XStandardMlt OAlg.Data.Number.Z
instance OAlg.Structure.Multiplicative.Proposition.XStandardMlt OAlg.Data.Number.Q
instance (OAlg.Entity.Definition.Entity p, OAlg.Data.Validable.XStandard p) => OAlg.Structure.Multiplicative.Proposition.XStandardMlt (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Validable.Validable (OAlg.Structure.Multiplicative.Proposition.XMlt c)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Validable.Validable (OAlg.Structure.Multiplicative.Proposition.Mltp3 c)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Multiplicative.Proposition.Mltp3 c)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Validable.Validable (OAlg.Structure.Multiplicative.Proposition.Mltp2 c)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Multiplicative.Proposition.Mltp2 c)
instance OAlg.Structure.Oriented.Definition.Oriented q => OAlg.Data.Validable.Validable (OAlg.Structure.Multiplicative.Proposition.Endo q)
-- | Multiplicative structures.
module OAlg.Structure.Multiplicative
-- | fibred structures, i.e. type f with an associated root
-- type Root f such that every value in
-- f has a root.
module OAlg.Structure.Fibred.Definition
-- | types with a Fibred structure. An entity of a Fibred
-- structure will be called a stalk.
--
-- Note
--
--
-- - On should accept the default for root only for
-- FibredOriented structures!
-- - For Distributive structures the only thing to be
-- implemented is the Root type and should be defined as
-- Root d = Orientation p where-- p =
-- Point d (see the default implementation of
-- root).
--
class (Entity f, Entity (Root f)) => Fibred f where {
-- | the type of roots.
type Root f;
}
-- | the root of a stalk in f.
root :: Fibred f => f -> Root f
-- | the root of a stalk in f.
root :: (Fibred f, Root f ~ Orientation (Point f), Oriented f) => f -> Root f
-- | type representing the class of Fibred structures.
data Fbr
-- | transformable to Fibred structure.
class Transformable s Fbr => ForgetfulFbr s
-- | Fibred and Oriented structure with matching root
-- and orientation.
--
-- Property Let d be a FibredOriented
-- structure, then holds: For all s in d holds:
-- root s == orientation s.
--
-- Note FibredOriented structures are required for
-- Distributive structures.
class (Fibred d, Oriented d, Root d ~ Orientation (Point d)) => FibredOriented d
-- | type representing the class of FibredOriented structures.
data FbrOrt
-- | transformable to FibredOriented structure.
class (ForgetfulFbr s, ForgetfulOrt s, Transformable s FbrOrt) => ForgetfulFbrOrt s
-- | type where the associated root type is ordered.
--
-- Note Helper class to circumvent undecidable instances.
class Ord (Root f) => OrdRoot f
-- | type where the associated root type is a singleton.
class Singleton (Root f) => TotalRoot f
-- | a list in a Fibred structure having all the same root.
--
-- Definition Let f be a Fibred structure
-- and s = Sheaf r [t 0 .. t (n-1)] a sheaf in
-- Sheaf f, then s is valid if and
-- only if
--
--
-- - r is valid and t i are valid for all
-- i = 0..n-1.
-- - root (t i) == r for all i =
-- 0..n-1.
--
--
-- furthermore n is called the length of
-- s.
--
-- If two sheafs have the same root then there stalks can be
-- composed - via (++) - to a new sheaf having the same
-- root. But as (++) is not commutative they are
-- equipped with a Multiplicative structure.
data Sheaf f
Sheaf :: Root f -> [f] -> Sheaf f
instance OAlg.Structure.Fibred.Definition.Fibred f => GHC.Show.Show (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.Fibred f => GHC.Classes.Eq (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Fibred.Definition.FbrOrt OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Fibred.Definition.FbrOrt OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Fibred.Definition.FbrOrt OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Fibred.Definition.FbrOrt OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Fibred.Definition.Fbr OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Fibred.Definition.Fbr OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Fibred.Definition.Fbr
instance Data.Foldable.Foldable OAlg.Structure.Fibred.Definition.Sheaf
instance OAlg.Structure.Fibred.Definition.Fibred f => OAlg.Data.Validable.Validable (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.Fibred f => OAlg.Entity.Definition.Entity (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.Fibred f => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.Fibred f => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.Fibred f => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.FibredOriented f => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.Fibred f => OAlg.Data.Canonical.Embeddable f (OAlg.Structure.Fibred.Definition.Sheaf f)
instance OAlg.Structure.Fibred.Definition.FibredOriented ()
instance OAlg.Structure.Fibred.Definition.FibredOriented GHC.Types.Int
instance OAlg.Structure.Fibred.Definition.FibredOriented GHC.Num.Integer.Integer
instance OAlg.Structure.Fibred.Definition.FibredOriented OAlg.Data.Number.N
instance OAlg.Structure.Fibred.Definition.FibredOriented OAlg.Data.Number.Z
instance OAlg.Structure.Fibred.Definition.FibredOriented OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Fibred.Definition.FibredOriented (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Fibred.Definition.FibredOriented f => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Data.Opposite.Op f)
instance OAlg.Structure.Fibred.Definition.FibredOriented f => OAlg.Structure.Fibred.Definition.FibredOriented (OAlg.Data.Opposite.Op f)
instance OAlg.Structure.Fibred.Definition.Fibred ()
instance OAlg.Structure.Fibred.Definition.Fibred GHC.Types.Int
instance OAlg.Structure.Fibred.Definition.Fibred GHC.Num.Integer.Integer
instance OAlg.Structure.Fibred.Definition.Fibred OAlg.Data.Number.N
instance OAlg.Structure.Fibred.Definition.Fibred OAlg.Data.Number.Z
instance OAlg.Structure.Fibred.Definition.Fibred OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Structure.Oriented.Definition.Orientation p)
-- | additive structures, i.e. structures with a partially defined
-- addition (+).
module OAlg.Structure.Additive.Definition
-- | Fibred structures with a partialy defined
-- addition and having zero as the neutral element
-- of the summation. An entity of a Additive structure will be
-- called a summand.
--
-- Properties Let a be a Additive
-- structure, then holds:
--
--
-- - For all r in Root a holds:
-- root (zero r) == r.
-- - For all f and g in a
-- holds:
- If root f == root g then
-- f + g is valid and root (f +
-- g) == root f.
- If root f
-- /= root g then f + g is not
-- valid and its evaluation will end up in a
-- NotAddable-exception.
-- - For all f, g in a with
-- root f == root g holds: f + g
-- == g + f.
-- - For all f in a holds: f +
-- zero (root f) == f
-- - For all f, g, h in a
-- with root f == root g == root
-- h holds: (f + g) + h == f + (g
-- + h).
-- - For all f in a and n in N
-- holds: ntimes 0 f == zero (root f) and
-- ntimes (n + 1) f == f + ntimes
-- n f.
--
class Fibred a => Additive a
-- | the neutral element associated to each root. If there is no
-- ambiguity for zero r we will briefly denote it by
-- 0 r or just 0.
zero :: Additive a => Root a -> a
-- | the addition for two summands.
(+) :: Additive a => a -> a -> a
-- | n times of a summand.
ntimes :: Additive a => N -> a -> a
infixl 6 +
-- | the zero to a given root. The type p c serves only as
-- proxy and zero' is lazy in it.
--
-- Note As Point may be a non-injective type family, the
-- type checker needs some times a little bit more information to pic the
-- right zero.
zero' :: Additive a => p a -> Root a -> a
-- | type representing the class of Additive structures.
data Add
-- | transformable to Additive structure.
class (ForgetfulFbr s, Transformable s Add) => ForgetfulAdd s
-- | Additive structures having for each summand an additve
-- inverse.
--
-- Properties Let a be a Additive
-- structure, then holds:
--
--
-- - For all f in a holds: root
-- (negate f) == root f.
-- - For all f in a holds: f +
-- negate f == zero (root f).
-- - For all f and g in a
-- holds:
- If root f == root g then
-- f - g is valid and root (f -
-- g) == root f.
- If root f
-- /= root g then f - g is not
-- valid and its evaluation will end up in a
-- NotAddable-exception.
-- - For f and g in a with
-- root f == root g holds: f - g
-- == f + negate g.
-- - For all z in Z and f in a
-- holds:
- If 0 <= z then ztimes z f
-- == ntimes (prj z) f.
- If z
-- < 0 then ztimes z f == negate
-- (ntimes (prj z) f).
--
class Additive a => Abelian a
-- | negation of a summand.
negate :: Abelian a => a -> a
-- | subtraction of two summands.
--
-- Properties
(-) :: Abelian a => a -> a -> a
-- | z times of a sumand.
ztimes :: Abelian a => Z -> a -> a
infixl 6 -
-- | check for beeing zero.
isZero :: Additive a => a -> Bool
-- | type representing the class of Abelian structures.
data Abl
-- | transformable to Abelian structure.
class (ForgetfulFbr s, ForgetfulAdd s, Transformable s Abl) => ForgetfulAbl s
instance OAlg.Structure.Additive.Definition.ForgetfulAbl OAlg.Structure.Additive.Definition.Abl
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Abl OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Abl OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Abl OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Abl OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Additive.Definition.Abl
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr OAlg.Structure.Additive.Definition.Abl
instance OAlg.Structure.Additive.Definition.ForgetfulAdd OAlg.Structure.Additive.Definition.Abl
instance OAlg.Structure.Additive.Definition.ForgetfulAdd OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Add OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Add OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Additive.Definition.Add OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Additive.Definition.Abelian ()
instance OAlg.Structure.Additive.Definition.Abelian GHC.Types.Int
instance OAlg.Structure.Additive.Definition.Abelian GHC.Num.Integer.Integer
instance OAlg.Structure.Additive.Definition.Abelian OAlg.Data.Number.Z
instance OAlg.Structure.Additive.Definition.Abelian OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Additive.Definition.Abelian (OAlg.Structure.Oriented.Definition.Orientation p)
instance (OAlg.Structure.Additive.Definition.Abelian a, OAlg.Structure.Fibred.Definition.FibredOriented a) => OAlg.Structure.Additive.Definition.Abelian (OAlg.Data.Opposite.Op a)
instance OAlg.Structure.Additive.Definition.Additive ()
instance OAlg.Structure.Additive.Definition.Additive GHC.Types.Int
instance OAlg.Structure.Additive.Definition.Additive GHC.Num.Integer.Integer
instance OAlg.Structure.Additive.Definition.Additive OAlg.Data.Number.N
instance OAlg.Structure.Additive.Definition.Additive OAlg.Data.Number.Z
instance OAlg.Structure.Additive.Definition.Additive OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Additive.Definition.Additive (OAlg.Structure.Oriented.Definition.Orientation p)
instance (OAlg.Structure.Additive.Definition.Additive a, OAlg.Structure.Fibred.Definition.FibredOriented a) => OAlg.Structure.Additive.Definition.Additive (OAlg.Data.Opposite.Op a)
instance OAlg.Structure.Additive.Definition.Additive a => OAlg.Data.Canonical.Projectible a (OAlg.Structure.Fibred.Definition.Sheaf a)
-- | distributive structures, i.e. multiplicative structures with a
-- suitable additive structure.
module OAlg.Structure.Distributive.Definition
-- | FibredOriented structures equipped with an Additive and
-- Multiplicative structure satisfying the laws of
-- distributivity.
--
-- Properties Let d be a Distributive
-- structure, then holds:
--
--
-- - For all g in d and r in
-- Root d with end g ==
-- start r holds: zero r * g ==
-- zero r' where r' == start g :>
-- end r.
-- - For all g, a and b in d
-- with root a == root b and
-- start a == end g holds: (a +
-- b) * g == a*g + b*g.
-- - For all f in d and r in
-- Root d with start f ==
-- end r holds: f * zero r ==
-- zero r' where r' = start r :>
-- end f.
-- - For all f, a and b in d
-- with root a == root b and
-- start f == end a holds: f*(a
-- + b) == f*a + f*b.
--
--
-- Note If d is interpreted as a small category
-- C then it is usually called preadditive. If
-- d is also Abelian then C is
-- also usually called abelian.
class (FibredOriented d, Additive d, Multiplicative d) => Distributive d
-- | type representing the class of Distributive structures.
data Dst
-- | transformable to Distributive structure.
class (ForgetfulOrt s, ForgetfulMlt s, ForgetfulFbr s, ForgetfulAdd s, ForgetfulFbrOrt s, Transformable s Dst) => ForgetfulDst s
-- | transposable distributive structures.
--
-- Property Let d be a
-- TransposableDistributive structure, then holds:
--
--
-- - For all r in Root d holds:
-- transpose (zero r) == zero
-- (transpose r)
-- - For all a, b in d with
-- root a == root b holds:
-- transpose (a + b) == transpose a
-- + transpose b.
--
class (TransposableMultiplicative d, Distributive d) => TransposableDistributive d
instance OAlg.Structure.Distributive.Definition.ForgetfulDst OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Structure.Definition.Transformable OAlg.Structure.Distributive.Definition.Dst OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Definition.Transformable1 OAlg.Data.Opposite.Op OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Definition.TransformableOp OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Definition.ForgetfulTyp OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Multiplicative.Definition.ForgetfulMlt OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Additive.Definition.ForgetfulAdd OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Distributive.Definition.TransposableDistributive (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Distributive.Definition.TransposableDistributive OAlg.Data.Number.N
instance OAlg.Structure.Distributive.Definition.TransposableDistributive OAlg.Data.Number.Z
instance OAlg.Structure.Distributive.Definition.TransposableDistributive OAlg.Data.Number.Q
instance OAlg.Structure.Distributive.Definition.Distributive ()
instance OAlg.Structure.Distributive.Definition.Distributive GHC.Types.Int
instance OAlg.Structure.Distributive.Definition.Distributive GHC.Num.Integer.Integer
instance OAlg.Structure.Distributive.Definition.Distributive OAlg.Data.Number.N
instance OAlg.Structure.Distributive.Definition.Distributive OAlg.Data.Number.Z
instance OAlg.Structure.Distributive.Definition.Distributive OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Distributive.Definition.Distributive (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Distributive.Definition.Distributive d => OAlg.Structure.Distributive.Definition.Distributive (OAlg.Data.Opposite.Op d)
-- | propositions on Fibred structures.
module OAlg.Structure.Fibred.Proposition
-- | validity for Fibred structures.
prpFbr :: Fibred f => XFbr f -> Statement
-- | random variable for validating Fibred structures.
type XFbr = X
-- | validity for FibredOriented structures.
prpFbrOrt :: FibredOriented f => XFbrOrt f -> Statement
-- | random variable type for validating FibredOriented structures.
type XFbrOrt = X
-- | random variable for the Fibred structure of
-- Orientation p.
xFbrOrnt :: X p -> XFbr (Orientation p)
-- | random variable for the FibredOriented structure of
-- Orientation p.
xFbrOrtOrnt :: X p -> XFbrOrt (Orientation p)
-- | random variable of XStalk on Orientation
-- p.
xStalkOrnt :: X p -> XStalk (Orientation p)
-- | random variable for stalks.
data XStalk x
XStalk :: X (Root x) -> (Root x -> X x) -> XStalk x
-- | the underlying random variable of roots.
xRoot :: XStalk x -> X (Root x)
-- | random variable of sheafs in a Fibred structure all rooted in
-- the given root and with a length of either 0 - for empty roots
-- - or with the given length.
xSheafRootMax :: Fibred f => XStalk f -> N -> Root f -> X (Sheaf f)
-- | random variable of sheafs, all based on the given root and with
-- the given length.
xSheafRoot :: Additive a => XStalk a -> N -> Root a -> X (Sheaf a)
-- | random variable of sheafs, based on the underlying random variable of
-- roots, with a length of either 0 - for empty roots - or with
-- the given length.
xSheafMax :: Fibred f => XStalk f -> N -> X (Sheaf f)
-- | random variable of sheafs with the given length.
xSheaf :: Additive a => XStalk a -> N -> X (Sheaf a)
-- | the associated random variable for validating Fibred
-- structures.
xoFbr :: XOrtOrientation f -> XFbr f
-- | the associated random variable for validation FibredOriented
-- structures.
xoFbrOrt :: XOrtOrientation f -> XFbrOrt f
-- | fibred structures.
module OAlg.Structure.Fibred
-- | propositions on Additive structures.
module OAlg.Structure.Additive.Proposition
-- | relation of isZero.
relIsZero :: Additive a => a -> Statement
-- | validity of the Additive structure of a.
--
-- Note For a good choice of X N see the
-- note of prpAdd6.
prpAdd :: Additive a => XAdd a -> Statement
-- | validtiy of root according to
-- OAlg.Structure.Additive.Definition#Add1.
prpAdd1 :: Additive a => p a -> X (Root a) -> Statement
-- | validtiy of two summands according to
-- OAlg.Structure.Additive.Definition#Add2.
prpAdd2 :: Additive a => X (a, a) -> Statement
-- | validity of + for two addable summands according to
-- OAlg.Structure.Additive.Definition#Add2_1.
prpAdd2_1 :: Additive a => Adbl2 a -> Statement
-- | validity of + for two not addable summands according to
-- OAlg.Structure.Additive.Definition#Add2_2.
prpAdd2_2 :: Additive a => a -> a -> Statement
-- | validtiy of two adable summands according to
-- OAlg.Structure.Additive.Definition#Add3.
prpAdd3 :: Additive a => X (Adbl2 a) -> Statement
-- | validtiy according to OAlg.Structure.Additive.Definition#Add4.
prpAdd4 :: Additive a => X a -> Statement
-- | validtiy of three adable summands according to
-- OAlg.Structure.Additive.Definition#Add5.
prpAdd5 :: Additive a => X (Adbl3 a) -> Statement
-- | validity of ntimes according to
-- OAlg.Structure.Additive.Definition#Add6.
prpAdd6 :: Additive a => X N -> X a -> Statement
-- | validity of the Abelian structure of a.
prpAbl :: Abelian a => XAbl a -> Statement
-- | validity according to OAlg.Structure.Additive.Definition#Abl1.
prpAbl1 :: Abelian a => X a -> Statement
-- | validity according to OAlg.Structure.Additive.Definition#Abl2.
prpAbl2 :: Abelian a => X a -> Statement
-- | validity of two summands according to
-- OAlg.Structure.Additive.Definition#Abl3.
prpAbl3 :: Abelian a => X (a, a) -> Statement
-- | validity of - for two addable summands according to
-- OAlg.Structure.Additive.Definition#Abl3_1.
prpAbl3_1 :: Abelian a => Adbl2 a -> Statement
-- | validity of - for two not addable summands according to
-- OAlg.Structure.Additive.Definition#Abl3_2.
prpAbl3_2 :: Abelian a => a -> a -> Statement
-- | validity of two summands according to
-- OAlg.Structure.Additive.Definition#Abl4.
prpAbl4 :: Abelian a => X (Adbl2 a) -> Statement
-- | validity of two summands according to
-- OAlg.Structure.Additive.Definition#Abl5.
prpAbl5 :: Abelian a => X Z -> X a -> Statement
-- | random variable for validating Additive structures.
data XAdd a
XAdd :: X N -> X (Root a) -> X a -> X (Adbl2 a) -> X (Adbl3 a) -> XAdd a
-- | predicate for two addable summands.
data Adbl2 a
Adbl2 :: a -> a -> Adbl2 a
-- | predicate for three addable summands.
data Adbl3 a
Adbl3 :: a -> a -> a -> Adbl3 a
-- | standard random variable for Additive structures.
class XStandardAdd a
xStandardAdd :: XStandardAdd a => XAdd a
-- | random variable for validating Abelian structures.
data XAbl a
XAbl :: X Z -> X a -> X (Adbl2 a) -> XAbl a
-- | random variable for total Additive structures.
xAddTtl :: Singleton (Root a) => X N -> X a -> XAdd a
-- | the induced random variable for Additive structures with the
-- given random variable to validate ntimes.
xoAdd :: FibredOriented a => X N -> XOrtOrientation a -> XAdd a
-- | the induced random variables for roots.
xoRoot :: FibredOriented a => XOrtOrientation a -> X (Root a)
-- | the induced random variable for two addable summands.
xoAdbl2 :: FibredOriented a => XOrtOrientation a -> X (Adbl2 a)
-- | the induced random variable for three addable summands.
xoAdbl3 :: FibredOriented a => XOrtOrientation a -> X (Adbl3 a)
-- | the induced random variable for Abelian structures with the
-- given random variable to validate ztimes.
xoAbl :: FibredOriented a => X Z -> XOrtOrientation a -> XAbl a
-- | the associated random variable for validating Fibred
-- structures.
xoFbr :: XOrtOrientation f -> XFbr f
-- | random variable for the Additive structure of
-- Orientation p.
xAddOrnt :: Entity p => X N -> X p -> XAdd (Orientation p)
-- | random variable for Additive structure.
xAddStalk :: Additive a => XStalk a -> X N -> XAdd a
-- | random variable of two addable summands rooted at the given root.
xStalkAdbl2 :: Additive a => XStalk a -> Root a -> X (Adbl2 a)
-- | random variable of three addable summands rooted in the given root.
xStalkAdbl3 :: Additive a => XStalk a -> Root a -> X (Adbl3 a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (OAlg.Structure.Additive.Proposition.Adbl2 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (OAlg.Structure.Additive.Proposition.Adbl2 a)
instance GHC.Show.Show a => GHC.Show.Show (OAlg.Structure.Additive.Proposition.Adbl2 a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (OAlg.Structure.Additive.Proposition.Adbl3 a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (OAlg.Structure.Additive.Proposition.Adbl3 a)
instance GHC.Show.Show a => GHC.Show.Show (OAlg.Structure.Additive.Proposition.Adbl3 a)
instance OAlg.Structure.Additive.Definition.Additive a => OAlg.Data.Validable.Validable (OAlg.Structure.Additive.Proposition.XAbl a)
instance OAlg.Structure.Additive.Proposition.XStandardAdd OAlg.Data.Number.N
instance OAlg.Structure.Additive.Proposition.XStandardAdd OAlg.Data.Number.Z
instance OAlg.Structure.Additive.Proposition.XStandardAdd OAlg.Data.Number.Q
instance (OAlg.Entity.Definition.Entity p, OAlg.Data.Validable.XStandard p) => OAlg.Structure.Additive.Proposition.XStandardAdd (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Additive.Definition.Additive a => OAlg.Data.Validable.Validable (OAlg.Structure.Additive.Proposition.XAdd a)
instance OAlg.Structure.Fibred.Definition.Fibred a => OAlg.Data.Validable.Validable (OAlg.Structure.Additive.Proposition.Adbl3 a)
instance OAlg.Structure.Fibred.Definition.FibredOriented a => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Additive.Proposition.Adbl3 a)
instance OAlg.Structure.Fibred.Definition.Fibred a => OAlg.Data.Validable.Validable (OAlg.Structure.Additive.Proposition.Adbl2 a)
instance OAlg.Structure.Fibred.Definition.FibredOriented a => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Additive.Proposition.Adbl2 a)
-- | Additive structures.
module OAlg.Structure.Additive
-- | propositions about Distributive structure.
module OAlg.Structure.Distributive.Proposition
-- | validity for the Distributive structure of the type a.
prpDst :: Distributive d => XDst d -> Statement
-- | random variable for validating Distributive structures.
data XDst d
XDst :: X (DstRootSide LeftSide d) -> X (DstSide LeftSide d) -> X (DstRootSide RightSide d) -> X (DstSide RightSide d) -> XDst d
-- | validity according to OAlg.Structure.Distributive#Dst1.
prpDst1 :: Distributive d => X (DstRootSide LeftSide d) -> Statement
-- | validity according to OAlg.Structure.Distributive#Dst2.
prpDst2 :: Distributive d => X (DstSide LeftSide d) -> Statement
-- | validity according to OAlg.Structure.Distributive#Dst3.
prpDst3 :: Distributive d => X (DstRootSide RightSide d) -> Statement
-- | validity according to OAlg.Structure.Distributive#Dst4.
prpDst4 :: Distributive d => X (DstSide RightSide d) -> Statement
-- | predicate for a root and a factor at the root.
--
-- Properties Let p be in DstRootSide s
-- d for a Distributive structure d,
-- then holds:
--
--
-- - If p matches LDstRoot r f then holds:
-- start r == end f.
-- - If p matches RDstRoot f r then holds:
-- start f == end r.
--
data DstRootSide (s :: Side) d
[LDstRoot] :: Root d -> d -> DstRootSide LeftSide d
[RDstRoot] :: d -> Root d -> DstRootSide RightSide d
-- | predicate for two addable summands together with a matching factor.
--
-- Properties Let p be in DstSide s
-- d for a Distributive structure, then holds:
--
--
-- - If p matches LDst (a,b) g then
-- holds:
- root a == root
-- b.
- start a == end
-- g.
-- - If p matches RDst f (a,b) then
-- holds:
- root a == root
-- b.
- start f == end
-- a.
--
data DstSide (s :: Side) d
[LDst] :: (d, d) -> d -> DstSide LeftSide d
[RDst] :: d -> (d, d) -> DstSide RightSide d
-- | standard random variable for Distributive structures.
class XStandardDst d
xStandardDst :: XStandardDst d => XDst d
-- | the induced random variable for Distributive structures.
xDstStalkStartEnd :: Distributive m => XStalk m -> XOrtSite From m -> XOrtSite To m -> XDst m
-- | random variable to validate Total Distributive
-- structures.
xDstTtl :: Singleton (Root m) => X m -> XDst m
-- | random variable for the Distributive structure of
-- Orientation p.
xDstOrnt :: Entity p => X p -> XDst (Orientation p)
-- | the induced random variable for Distributive structures.
xoDst :: Distributive d => XOrtOrientation d -> XOrtSite From d -> XOrtSite To d -> XDst d
-- | distribution of XDst d.
dstDst :: Distributive d => Int -> XDst d -> IO ()
instance OAlg.Structure.Distributive.Definition.Distributive d => GHC.Show.Show (OAlg.Structure.Distributive.Proposition.DstRootSide s d)
instance OAlg.Structure.Distributive.Definition.Distributive d => GHC.Show.Show (OAlg.Structure.Distributive.Proposition.DstSide s d)
instance OAlg.Structure.Distributive.Proposition.XStandardDst OAlg.Data.Number.N
instance OAlg.Structure.Distributive.Proposition.XStandardDst OAlg.Data.Number.Z
instance OAlg.Structure.Distributive.Proposition.XStandardDst OAlg.Data.Number.Q
instance (OAlg.Entity.Definition.Entity p, OAlg.Data.Validable.XStandard p) => OAlg.Structure.Distributive.Proposition.XStandardDst (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Distributive.Definition.Distributive d => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Distributive.Proposition.DstSide 'OAlg.Data.Dualisable.RightSide d)
instance OAlg.Structure.Distributive.Definition.Distributive d => OAlg.Data.Validable.Validable (OAlg.Structure.Distributive.Proposition.DstSide s d)
instance OAlg.Structure.Distributive.Definition.Distributive d => OAlg.Data.Dualisable.Dualisable (OAlg.Structure.Distributive.Proposition.DstRootSide 'OAlg.Data.Dualisable.RightSide d)
instance OAlg.Structure.Distributive.Definition.Distributive d => OAlg.Data.Validable.Validable (OAlg.Structure.Distributive.Proposition.DstRootSide s d)
-- | Distributive structures.
module OAlg.Structure.Distributive
-- | definition of homomorphisms between Oriented structures.
module OAlg.Hom.Oriented.Definition
-- | type family of homomorphisms between Oriented structures.
--
-- Property Let h be an instance of
-- HomOriented, then for all a, b
-- and f in h a
-- b and x in a holds:
-- start (amap f x) == pmap f
-- (start x) and end (amap f x) ==
-- pmap f (end x).
--
-- We call such a h a family of homomorphisms
-- between oriented structures and an entity f in
-- h a b a
-- covariant oriented homomorphism - or oriented
-- homomorphism for short - between
-- a and b. A covariant
-- oriented homomorphism f in h (Op a)
-- b or h a (Op b) will
-- be called a contravariant oriented homomorphism between
-- a and b.
--
-- Note
--
--
-- - As h is an instance of
-- EmbeddableMorphism h Ort it follows that
-- for all a, b and f in
-- h a b holds: tauHom (homomorphous f)
-- :: Homomorphous Ort a b and thus
-- a and b are Oriented
-- structures! How to work with this concretely see the implementation of
-- prpHomOrt where the property above is stated.
-- - The constraint EmbeddableMorphismTyp for a family
-- h of homomorphisms between Oriented structures
-- ensures that the type Path h is a instances of
-- Eq2.
--
class (EmbeddableMorphism h Ort, Applicative h, Entity2 h, EmbeddableMorphismTyp h, Transformable1 Op (ObjectClass h)) => HomOriented h
pmap :: HomOriented h => h a b -> Point a -> Point b
-- | the induced mapping of Orientation.
omap :: HomOriented h => h a b -> Orientation (Point a) -> Orientation (Point b)
-- | s-isomoprhisms.
type IsoOrt s h = (FunctorialHomOriented h, Cayleyan2 h, Hom s h)
-- | isomorphisms between Oriented structures.
type IsoOriented h = (FunctorialHomOriented h, Cayleyan2 h)
-- | functorial application on Oriented structures.
--
-- Properties Let h be an instance of the class
-- FunctorialHomOriented, then holds:
--
--
-- - For all types a and s in
-- Struct (ObjectClass h) a holds:
-- pmap (cOne s) = id.
-- - For all types a, b,
-- c and f in h
-- b c, g in h
-- a b holds: pmap (f .
-- g) = pmap f . pmap g.
--
class (Category h, Functorial h, HomOriented h) => FunctorialHomOriented h
-- | identity morphism.
data IdHom s a b
[IdHom] :: Structure s a => IdHom s a a
-- | induced homomorphism on Op.
data OpHom h x y
[OpHom] :: Transformable1 Op (ObjectClass h) => h x y -> OpHom h (Op x) (Op y)
-- | some basic contravariant isomorphisms between
-- s-structures with there invert2.
data HomOp s a b
[FromOpOp] :: (Structure s (Op (Op a)), Structure s a) => HomOp s (Op (Op a)) a
[ToOpOp] :: (Structure s (Op (Op a)), Structure s a) => HomOp s a (Op (Op a))
[OpPath] :: (Structure s a, Structure s (Op (Path a)), Structure s (Path (Op a))) => HomOp s (Op (Path a)) (Path (Op a))
[OpPathInv] :: (Structure s a, Structure s (Op (Path a)), Structure s (Path (Op a))) => HomOp s (Path (Op a)) (Op (Path a))
[Opposite] :: (Structure s (Op (Orientation p)), Structure s (Orientation p)) => HomOp s (Op (Orientation p)) (Orientation p)
[OppositeInv] :: (Structure s (Op (Orientation p)), Structure s (Orientation p)) => HomOp s (Orientation p) (Op (Orientation p))
-- | isomorphisms induced by paths of HomOp.
data IsoOp s a b
-- | paths of HomOp.
type PathHomOp s a b = Path (HomOp s) a b
-- | the induced isomorphism given by OpPath.
opPathOrt :: Oriented a => IsoOp Ort (Op (Path a)) (Path (Op a))
-- | the induced isomorphism of Oriented structures given by
-- FromOpOp.
--
-- Examples
--
--
-- let tOS = invert2 (isoFromOpOpOrt :: IsoOp Ort (Op (Op OS)) OS)
-- let f = isoFromOpOpOrt :: Oriented a =>IsoOp Ort (Op (Op a)) a
-- let t = invert2 f
--
--
--
-- >>> tOS
-- IsoOp Path[ToOpOp]
--
--
--
-- >>> t . t . tOS
-- IsoOp Path[ToOpOp,ToOpOp,ToOpOp]
--
--
--
-- >>> f . f . t . f . t . tOS
-- IsoOp Path[]
--
--
--
-- >>> f . f . t . f . t . tOS == cOne Struct
-- True
--
isoFromOpOpOrt :: Oriented a => IsoOp Ort (Op (Op a)) a
-- | isomorphisms induced by paths of OpMap.
data IsoOpMap f s a b
-- | paths of OpMap.
type PathOpMap f s = Path (OpMap f s)
-- | contravariant s-isomorphisms between f
-- x and f (Op x).
data OpMap f s a b
-- | contravariant s-isomorphism from f x
-- to f (Op x).
[ToOp1] :: (Structure s (Op (f x)), Structure s (f (Op x)), Structure s x) => OpMap f s (Op (f x)) (f (Op x))
-- | the inverse of ToOp1.
[FromOp1] :: (Structure s (Op (f x)), Structure s (f (Op x)), Structure s x) => OpMap f s (f (Op x)) (Op (f x))
-- | structural attest for ToOp1.
toOp1Struct :: OpMap f s (Op (f x)) (f (Op x)) -> Struct s x
-- | structural attest for FromOp1.
fromOp1Struct :: OpMap f s (f (Op x)) (Op (f x)) -> Struct s x
-- | contravariant isomorphism from Path x to
-- Path (Opx) .
isoCoPath :: Oriented x => IsoOpMap Path Ort (Op (Path x)) (Path (Op x))
instance (OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Entity.Definition.Entity2 (OAlg.Hom.Oriented.Definition.IsoOp s)
instance (OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b) => OAlg.Entity.Definition.Entity (OAlg.Hom.Oriented.Definition.IsoOp s a b)
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Data.Equal.Eq2 (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Structure.Definition.ForgetfulTyp s => GHC.Classes.Eq (OAlg.Hom.Oriented.Definition.IsoOp s a b)
instance OAlg.Data.Validable.Validable2 (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Data.Validable.Validable (OAlg.Hom.Oriented.Definition.IsoOp s a b)
instance OAlg.Data.Show.Show2 (OAlg.Hom.Oriented.Definition.IsoOp s)
instance GHC.Show.Show (OAlg.Hom.Oriented.Definition.IsoOp s a b)
instance (OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable s) => OAlg.Entity.Definition.Entity2 (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance (OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b) => OAlg.Entity.Definition.Entity (OAlg.Hom.Oriented.Definition.IsoOpMap f s a b)
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Data.Equal.Eq2 (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance OAlg.Structure.Definition.ForgetfulTyp s => GHC.Classes.Eq (OAlg.Hom.Oriented.Definition.IsoOpMap f s a b)
instance OAlg.Data.Validable.Validable2 (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance OAlg.Data.Validable.Validable (OAlg.Hom.Oriented.Definition.IsoOpMap f s a b)
instance OAlg.Data.Show.Show2 (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance GHC.Show.Show (OAlg.Hom.Oriented.Definition.IsoOpMap f s a b)
instance GHC.Show.Show (OAlg.Hom.Oriented.Definition.IdHom s a b)
instance GHC.Classes.Eq (OAlg.Hom.Oriented.Definition.IdHom s a b)
instance GHC.Show.Show (OAlg.Hom.Oriented.Definition.HomOp s a b)
instance GHC.Classes.Eq (OAlg.Hom.Oriented.Definition.HomOp s a b)
instance GHC.Show.Show (OAlg.Hom.Oriented.Definition.OpMap f s a b)
instance GHC.Classes.Eq (OAlg.Hom.Oriented.Definition.OpMap f s a b)
instance OAlg.Data.Show.Show2 h => OAlg.Data.Show.Show2 (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Data.Equal.Eq2 h => OAlg.Data.Equal.Eq2 (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Data.Validable.Validable2 h => OAlg.Data.Validable.Validable2 (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Entity.Definition.Entity2 h => OAlg.Entity.Definition.Entity2 (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Category.Definition.Morphism h => OAlg.Category.Definition.Morphism (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Category.Applicative.Applicative h => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Oriented.Definition.Ort => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Definition.Typ => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Definition.Typ
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Multiplicative.Definition.Mlt => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Fibred.Definition.Fbr => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Fibred.Definition.FbrOrt => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Additive.Definition.Add => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Additive.Definition.Add
instance OAlg.Category.Definition.EmbeddableMorphism h OAlg.Structure.Distributive.Definition.Dst => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpHom h) OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Category.Definition.EmbeddableMorphismTyp h => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Hom.Oriented.Definition.HomOriented h => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Data.Constructable.Exposable (OAlg.Hom.Oriented.Definition.IsoOpMap f s a b)
instance OAlg.Data.Constructable.Constructable (OAlg.Hom.Oriented.Definition.IsoOpMap f s a b)
instance OAlg.Category.Definition.Morphism (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance OAlg.Structure.Definition.Transformable s t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.IsoOpMap f s) t
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance OAlg.Category.Definition.Category (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.Cayleyan2 (OAlg.Hom.Oriented.Definition.IsoOpMap f s)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt s => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Structure.Oriented.Definition.Path s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Structure.Oriented.Definition.Path s)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt s => OAlg.Category.Definition.Functorial (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Structure.Oriented.Definition.Path s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.FunctorialHomOriented (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Structure.Oriented.Definition.Path s)
instance OAlg.Data.Reducible.Reducible (OAlg.Hom.Oriented.Definition.PathOpMap f s a b)
instance OAlg.Category.Definition.Morphism (OAlg.Hom.Oriented.Definition.OpMap f s)
instance OAlg.Structure.Definition.Transformable s t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.OpMap f s) t
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Hom.Oriented.Definition.OpMap f s)
instance OAlg.Data.Show.Show2 (OAlg.Hom.Oriented.Definition.OpMap f s)
instance OAlg.Data.Equal.Eq2 (OAlg.Hom.Oriented.Definition.OpMap f s)
instance OAlg.Data.Validable.Validable (OAlg.Hom.Oriented.Definition.OpMap f s a b)
instance OAlg.Data.Validable.Validable2 (OAlg.Hom.Oriented.Definition.OpMap f s)
instance (Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b) => OAlg.Entity.Definition.Entity (OAlg.Hom.Oriented.Definition.OpMap f s a b)
instance (Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable s) => OAlg.Entity.Definition.Entity2 (OAlg.Hom.Oriented.Definition.OpMap f s)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt s => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.OpMap OAlg.Structure.Oriented.Definition.Path s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.OpMap OAlg.Structure.Oriented.Definition.Path s)
instance OAlg.Data.Constructable.Exposable (OAlg.Hom.Oriented.Definition.IsoOp s a b)
instance OAlg.Data.Constructable.Constructable (OAlg.Hom.Oriented.Definition.IsoOp s a b)
instance OAlg.Category.Definition.Morphism (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Structure.Definition.Transformable s t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.IsoOp s) t
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Category.Definition.Category (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.Cayleyan2 (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt s => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.IsoOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt s => OAlg.Category.Definition.Functorial (OAlg.Hom.Oriented.Definition.IsoOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.FunctorialHomOriented (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Data.Reducible.Reducible (OAlg.Hom.Oriented.Definition.PathHomOp s a b)
instance OAlg.Category.Definition.Morphism (OAlg.Hom.Oriented.Definition.HomOp s)
instance OAlg.Structure.Definition.Transformable s t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.HomOp s) t
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Hom.Oriented.Definition.HomOp s)
instance OAlg.Data.Show.Show2 (OAlg.Hom.Oriented.Definition.HomOp s)
instance OAlg.Data.Equal.Eq2 (OAlg.Hom.Oriented.Definition.HomOp s)
instance OAlg.Data.Validable.Validable (OAlg.Hom.Oriented.Definition.HomOp s a b)
instance OAlg.Data.Validable.Validable2 (OAlg.Hom.Oriented.Definition.HomOp s)
instance (Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b) => OAlg.Entity.Definition.Entity (OAlg.Hom.Oriented.Definition.HomOp s a b)
instance Data.Typeable.Internal.Typeable s => OAlg.Entity.Definition.Entity2 (OAlg.Hom.Oriented.Definition.HomOp s)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt s => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.HomOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.HomOp s)
instance OAlg.Category.Definition.Morphism (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Structure.Definition.Transformable s t => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Hom.Oriented.Definition.IdHom s) t
instance OAlg.Structure.Definition.ForgetfulTyp s => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Data.Show.Show2 (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Data.Equal.Eq2 (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Data.Validable.Validable (OAlg.Hom.Oriented.Definition.IdHom s a b)
instance OAlg.Data.Validable.Validable2 (OAlg.Hom.Oriented.Definition.IdHom s)
instance (Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b) => OAlg.Entity.Definition.Entity (OAlg.Hom.Oriented.Definition.IdHom s a b)
instance Data.Typeable.Internal.Typeable s => OAlg.Entity.Definition.Entity2 (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Category.Definition.Category (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Category.Definition.Cayleyan2 (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Category.Definition.Functorial (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Oriented.Definition.ForgetfulOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.FunctorialHomOriented (OAlg.Hom.Oriented.Definition.IdHom s)
instance OAlg.Hom.Oriented.Definition.FunctorialHomOriented h => OAlg.Hom.Oriented.Definition.FunctorialHomOriented (OAlg.Category.Path.Path h)
instance OAlg.Hom.Oriented.Definition.HomOriented h => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Category.Path.Path h)
instance (OAlg.Hom.Oriented.Definition.HomOriented h, OAlg.Structure.Definition.Transformable1 OAlg.Data.Opposite.Op t, OAlg.Structure.Oriented.Definition.ForgetfulOrt t, OAlg.Structure.Definition.ForgetfulTyp t, Data.Typeable.Internal.Typeable t) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Category.Definition.Forget t h)
-- | propositions on homomorphisms between Oriented structures.
module OAlg.Hom.Oriented.Proposition
-- | validity of IdHom Ort to be a family of
-- Oriented homomorphisms between Orientation
-- Symbol and Z.
prpIdHomOrt :: Statement
-- | validity of HomOp Ort according to
-- HomOriented on Orientation Symbol.
prpHomOpOrt :: Statement
-- | validity of IsoOp Ort according to
-- Category on Orientation Symbol.
prpIsoOpOrtCategory :: Statement
-- | validity of IsoOp Ort according
-- Functorial.
prpIsoOpOrtFunctorial :: Statement
-- | validity of homomorphisms between Oriented structures based on
-- the given random variable.
prpHomOrt :: Hom Ort h => XHomOrt h -> Statement
-- | random variable to validate homomorphisms between Oriented
-- structures.
type XHomOrt h = XAppl h
-- | validity of homomorphisms between Oriented structures based on
-- the given random variable.
prpHomOrt' :: Hom Ort h => h a b -> XOrt a -> Statement
-- | validity of homomorphisms between Oriented structures based on
-- the given values.
prpHomOrt1 :: Hom Ort h => h a b -> a -> Statement
-- | validity of homomorphisms between Oriented for a given value in
-- the domain.
relHomOrtHomomorphous :: Hom Ort h => Homomorphous Ort a b -> h a b -> a -> Statement
-- | random variale of IsoOp Ort.
xIsoOpOrtFrom :: XFnctMrphSite From (IsoOp Ort)
-- | homomorphism between Oriented structures.
module OAlg.Hom.Oriented
-- | homomorphisms between Fibred structures
module OAlg.Hom.Fibred
-- | type family of homomorphisms between Fibred structures.
--
-- Property Let h be an instance of HomFibred then
-- for all a, b and f in
-- h a b and x in
-- a holds: root (amap f x) ==
-- rmap f (root x).
class (EmbeddableMorphism h Fbr, Applicative h, Entity2 h, EmbeddableMorphismTyp h) => HomFibred h
rmap :: HomFibred h => h a b -> Root a -> Root b
rmap :: (HomFibred h, EmbeddableMorphism h FbrOrt, HomOriented h) => h a b -> Root a -> Root b
-- | functorial application of Fibred homomorphisms.
class (Category h, Functorial h, HomFibred h) => FunctorialHomFibred h
-- | type family of homomorphisms between FibredOriented structures.
--
-- Property Let h be an instance of
-- HomFibredOriented then for all a,
-- b and f in h a
-- b and r in Root a holds:
-- rmap f r == omap f r.
class (EmbeddableMorphism h FbrOrt, HomFibred h, HomOriented h) => HomFibredOriented h
-- | validity according to HomFibredOriented.
prpHomFbrOrt :: HomFibredOriented h => h a b -> Root a -> Statement
instance OAlg.Hom.Fibred.HomFibredOriented h => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Category.Path.Path h)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Hom.Oriented.Definition.HomOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Hom.Fibred.HomFibredOriented h => OAlg.Hom.Fibred.HomFibred (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Hom.Fibred.HomFibredOriented h => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Hom.Oriented.Definition.OpHom h)
instance OAlg.Hom.Fibred.FunctorialHomFibred h => OAlg.Hom.Fibred.FunctorialHomFibred (OAlg.Category.Path.Path h)
instance OAlg.Hom.Fibred.HomFibred h => OAlg.Hom.Fibred.HomFibred (OAlg.Category.Path.Path h)
instance (OAlg.Structure.Fibred.Definition.ForgetfulFbr s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibred (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibred (OAlg.Hom.Oriented.Definition.HomOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibred (OAlg.Hom.Oriented.Definition.IsoOp s)
-- | homomorphisms between Additive structures
module OAlg.Hom.Additive
-- | type family of homomorphisms between Additive structures.
--
-- Property Let h be a type instance of the class
-- HomAdditive, then for all a, b
-- and f in h a
-- b holds:
--
--
-- - For all r in Root a holds:
-- amap f (zero r) == zero (rmap f
-- r).
-- - For all x and y in a with
-- root x == root y holds: amap
-- f (x + y) ) == amap f x + amap f
-- y.
--
--
-- Such a h will be called a family of
-- homomorphisms between additive structures and an entity
-- f of h a b a
-- additive homomorphism between a and
-- b.
class (EmbeddableMorphism h Add, HomFibred h) => HomAdditive h
-- | validity according to OAlg.Hom.Additive#HomAdd1.
prpHomAdd1 :: HomAdditive h => h a b -> Root a -> Statement
-- | validity according to OAlg.Hom.Additive#HomAdd2.
prpHomAdd2 :: HomAdditive h => h a b -> Adbl2 a -> Statement
instance OAlg.Hom.Additive.HomAdditive h => OAlg.Hom.Additive.HomAdditive (OAlg.Category.Path.Path h)
instance (OAlg.Structure.Additive.Definition.ForgetfulAdd s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Additive.HomAdditive (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Additive.Definition.ForgetfulAdd s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Additive.HomAdditive (OAlg.Hom.Oriented.Definition.HomOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt s, OAlg.Structure.Additive.Definition.ForgetfulAdd s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Additive.HomAdditive (OAlg.Hom.Oriented.Definition.IsoOp s)
instance (OAlg.Hom.Additive.HomAdditive h, OAlg.Hom.Fibred.HomFibredOriented h) => OAlg.Hom.Additive.HomAdditive (OAlg.Hom.Oriented.Definition.OpHom h)
-- | definition of homomorphisms between Multiplicative structures.
module OAlg.Hom.Multiplicative.Definition
-- | type family of homomorphisms between Multiplicative structures.
--
-- Propoerty Let h be a type instance of the class
-- HomMultiplicative, then for all a,
-- b and f in h
-- a b holds:
--
--
-- - For all p in Point a holds:
-- amap f (one p) == one (pmap f
-- p).
-- - For all x, y in a with
-- start x == end y holds: amap
-- f (x * y) == amap f x * amap f
-- y.
--
--
-- Such a h will be called a family of
-- homomorphisms between multiplicative structures and an entity
-- f of h a b a
-- multiplicative homomorphism between a
-- and b.
--
-- Note If we interpret the types a and
-- b as small categories (see note at
-- Multiplicative) then we can interpret the type family
-- h as a family of covariant functors.
class (EmbeddableMorphism h Mlt, HomOriented h) => HomMultiplicative h
-- | isomorphisms between Multiplicative structures.
type IsoMultiplicative h = (FunctorialHomOriented h, Cayleyan2 h, HomMultiplicative h)
-- | the induced isomorphism of Multiplicative structures given by
-- FromOpOp.
isoFromOpOpMlt :: Multiplicative a => IsoOp Mlt (Op (Op a)) a
-- | the induced isomorphism of Oriented structures given by
-- Opposite.
isoOppositeMlt :: Entity p => IsoOp Mlt (Op (Orientation p)) (Orientation p)
instance OAlg.Hom.Multiplicative.Definition.HomMultiplicative h => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Category.Path.Path h)
instance (OAlg.Hom.Multiplicative.Definition.HomMultiplicative h, OAlg.Structure.Definition.Transformable1 OAlg.Data.Opposite.Op t, OAlg.Structure.Multiplicative.Definition.ForgetfulMlt t, OAlg.Structure.Definition.ForgetfulTyp t, Data.Typeable.Internal.Typeable t) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Category.Definition.Forget t h)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Multiplicative.Definition.ForgetfulMlt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Multiplicative.Definition.ForgetfulMlt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Hom.Oriented.Definition.HomOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Multiplicative.Definition.ForgetfulMlt s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Hom.Multiplicative.Definition.HomMultiplicative h => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Hom.Oriented.Definition.OpHom h)
-- | propositions on homomorphisms between Multiplicative
-- structures.
module OAlg.Hom.Multiplicative.Proposition
-- | validity of HomOp Mlt to be a family of
-- Multiplicative homomorphisms.
prpHomOpMlt :: Statement
-- | validity of homomorphisms between Multiplicative structures
-- according to OAlg.Hom.Multiplicative#HomMlt.
prpHomMlt :: Hom Mlt h => XHomMlt h -> Statement
-- | random variable for validating a type family h
-- according to HomMultiplicative.
data XHomMlt h
XHomMlt :: X (SomeApplPnt h) -> X (SomeApplMltp2 h) -> XHomMlt h
-- | to the dual of XHomMlt h with its inverse
-- coXHomMltInv.
coXHomMlt :: HomMultiplicative h => XHomMlt h -> Dual (XHomMlt h)
-- | from the dual of Dual (XHomMlt h) with
-- its inverse coXHomMlt.
coXHomMltInv :: HomMultiplicative h => Dual (XHomMlt h) -> XHomMlt h
-- | some application on a point.
data SomeApplPnt h
[SomeApplPnt] :: h a b -> Point a -> SomeApplPnt h
-- | to the dual of SomeApplPnt h with its inverse
-- coSomeApplPntInv.
coSomeApplPnt :: Transformable1 Op (ObjectClass h) => SomeApplPnt h -> Dual (SomeApplPnt h)
-- | from the dual of Dual (SomeApplPnt h)
-- with its inverse coSomeApplPnt.
coSomeApplPntInv :: Dual (SomeApplPnt h) -> SomeApplPnt h
-- | some application on multiplicable factors.
data SomeApplMltp2 h
[SomeApplMltp2] :: h a b -> Mltp2 a -> SomeApplMltp2 h
-- | to the dual of SomeApplMltp2 h with its inverse
-- coSomeApplMltp2Inv.
coSomeApplMltp2 :: HomMultiplicative h => SomeApplMltp2 h -> Dual (SomeApplMltp2 h)
-- | from the dual of Dual (SomeApplMltp2 h)
-- with its inverse coSomeApplMltp2.
coSomeApplMltp2Inv :: HomMultiplicative h => Dual (SomeApplMltp2 h) -> SomeApplMltp2 h
-- | validity according to OAlg.Hom.Multiplicative#HomMlt1.
prpHomMlt1 :: Hom Mlt h => h a b -> Point a -> Statement
-- | validity according to OAlg.Hom.Multiplicative#HomMlt2.
prpHomMlt2 :: Hom Mlt h => h a b -> Mltp2 a -> Statement
-- | the induced random variable of XHomMlt, given by
-- SomeApplMlt.
xHomMlt :: Hom Mlt h => SomeApplMlt d h -> XHomMlt h
-- | the induced random variable of XHomMlt.
xHomMlt' :: h a b -> XMlt a -> XHomMlt h
-- | random variable for some application on a point given by a
-- SomeApplMlt.
xSomeApplPnt :: SomeApplMlt d h -> X (SomeApplPnt h)
-- | random variable for some application on multiplicable factors given by
-- a SomeApplMlt.
xSomeApplMltp2 :: Hom Mlt h => SomeApplMlt d h -> X (SomeApplMltp2 h)
-- | homomorphisms between Multiplicative structures.
module OAlg.Hom.Multiplicative
-- | propositions on homomorphisms between algerbaic structure.
module OAlg.Hom.Proposition
-- | validity of IdHom s according to
-- Category and HomOriented.
prpIdHom :: Statement
-- | validity of HomOp s according to
-- Category, HomOriented and HomMultiplicative.
prpHomOp :: Statement
-- | validity of IsoOp Ort according to
-- Category and Functorial.
prpIsoOpOrt :: Statement
-- | homomorphisms between Distributive structure.
module OAlg.Hom.Distributive
-- | type family of homomorphisms between Distributive structures.
class (EmbeddableMorphism h Dst, HomFibredOriented h, HomMultiplicative h, HomAdditive h) => HomDistributive h
-- | isomorphisms between Distributive structures.
type IsoDistributive h = (FunctorialHomOriented h, Cayleyan2 h, HomDistributive h)
-- | the induced isomorphism of Distributive structures given by
-- FromOpOp.
isoFromOpOpDst :: Distributive a => IsoOp Dst (Op (Op a)) a
instance OAlg.Hom.Distributive.HomDistributive h => OAlg.Hom.Distributive.HomDistributive (OAlg.Category.Path.Path h)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Distributive.HomDistributive (OAlg.Hom.Oriented.Definition.IdHom s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Distributive.HomDistributive (OAlg.Hom.Oriented.Definition.HomOp s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Distributive.HomDistributive (OAlg.Hom.Oriented.Definition.IsoOp s)
instance OAlg.Hom.Distributive.HomDistributive h => OAlg.Hom.Distributive.HomDistributive (OAlg.Hom.Oriented.Definition.OpHom h)
-- | natural numbers promotable to type-level. They serve to parameterize
-- the length of finite lists on type-level (see
-- OAlg.Entity.FinList).
--
-- Note We need the language extension
-- UndecidableInstances for type checking the definition
--
--
-- N0 * m = N0
-- S n * m = m + n * m
--
--
-- for the type family *.
--
-- Using UndecidableInstances could cause the type checker to
-- not terminate, but this will obviously not happen for the given
-- definition (we also use the same definition for the multiplicative
-- structure of N').
module OAlg.Entity.Natural
-- | natural number promotable to type-level.
data N'
N0 :: N'
S :: N' -> N'
-- | mapping a natural number in N to N'.
toN' :: N -> N'
-- | addition of natural numbers.
type family (+) (n :: N') (m :: k) :: N'
infixr 6 +
-- | multiplication of natural numbers.
type family (*) (n :: k) (m :: N') :: N'
infixr 7 *
-- | attest for any natural number.
class Typeable n => Attestable n
attest :: Attestable n => W n
-- | witness of being attestable.
data Ats n
[Ats] :: Attestable n => Ats n
-- | the corresponding natural number in N of a type parameterized
-- by n.
nValue :: Attestable n => p n -> N
-- | witness for a natural number and serves for inductively definable
-- elements (see induction).
data W n
[W0] :: W N0
[SW] :: W n -> W (n + 1)
-- | comparing of two witnesses.
cmpW :: W n -> W m -> Ordering
-- | addition of witnesses.
(++) :: W n -> W m -> W (n + m)
infixr 6 ++
-- | multiplication of witnesses.
(**) :: W n -> W m -> W (n * m)
infixr 7 **
-- | union of all witnesses, which is isomorphic to N and N'.
data W'
W' :: W n -> W'
-- | mapping a natural value in N to W'.
toW' :: N -> W'
-- | witnesse of some natural.
data SomeNatural
[SomeNatural] :: Attestable n => W n -> SomeNatural
-- | successor of some natural number.
succSomeNatural :: SomeNatural -> SomeNatural
-- | mapping N to SomeNatural.
--
-- Note The implementation of this mapping is quite inefficent for
-- high values of N.
someNatural :: N -> SomeNatural
-- | the infinite list of some naturals.
naturals :: [SomeNatural]
-- | induction for general type functions.
induction :: Any n -> f N0 -> (forall i. f i -> f (i + 1)) -> f n
-- | predicate for any natural number.
type Any = W
-- | some witness.
type Some = W'
-- | reflexivity.
refl :: Any x -> x :~: x
-- | well definition of parameterized types.
lemma1 :: (x :~: y) -> f x :~: f y
-- | substitution rule for addition.
sbstAdd :: (a :~: a') -> (b :~: b') -> (a + b) :~: (a' + b')
-- | 0 is right neural for the addition.
prpAdd0 :: (a + 0) :~: a
-- | adding 1 is equal to the successor.
prpAdd1 :: (a + 1) :~: S a
-- | adding 2 is equal to the successor of the successor.
prpAdd2 :: (a + 2) :~: S (S a)
-- | equality of the underlying natural number.
prpEqlAny :: (Any n :~: Any m) -> n :~: m
-- | Any is as parameterized type is well defined.
prpEqlAny' :: (n :~: m) -> Any n :~: Any m
-- | successor is injective.
prpSuccInjective :: (S n :~: S m) -> n :~: m
-- | N0 is left neutral for the addition.
prpAddNtrlL :: p a -> (N0 + a) :~: a
-- | N0 is the right neutral for the addition.
prpAddNtrlR :: Any a -> (a + N0) :~: a
-- | addition is associative.
prpAddAssoc :: Any a -> Any b -> Any c -> ((a + b) + c) :~: (a + (b + c))
-- | lemma 1 for the addition.
lemmaAdd1 :: Any a -> Any b -> (S a + b) :~: (a + S b)
-- | addition is commutative.
prpAddComm :: Any a -> Any b -> (a + b) :~: (b + a)
-- | N1 is left neutral for the multiplication.
prpMltNtrlL :: Any a -> (N1 * a) :~: a
-- | N1 is right neutral for the multiplication.
prpMltNtrlR :: Any a -> (a * N1) :~: a
-- | law of left distributivity holds.
prpDstrL :: Any a -> Any b -> Any c -> ((a + b) * c) :~: ((a * c) + (b * c))
-- | multiplication is associative.
prpMltAssoc :: Any a -> Any b -> Any c -> ((a * b) * c) :~: (a * (b * c))
-- | right multiplication of N0 is N0.
lemmaMlt1 :: Any a -> (a * N0) :~: N0
-- | lemma 2 for addition.
lemmaAdd2 :: Any a -> Any b -> Any c -> (a + (b + c)) :~: (b + (a + c))
-- | law of right distributivity holds.
prpDstrR :: Any a -> Any b -> Any c -> (a * (b + c)) :~: ((a * b) + (a * c))
-- | multiplication is commutative.
prpMltComm :: Any a -> Any b -> (a * b) :~: (b * a)
-- | codeW n m generates the haskell code for the witnesses
-- W of N' from n to m.
codeW :: N -> N -> String
-- | itfW n m generates the haskell interface for the witnesses
-- W from n to m.
itfW :: N -> N -> String
-- | 0.
type N0 = 'N0
-- | 1.
type N1 = S N0
-- | 2.
type N2 = S N1
-- | 3.
type N3 = S N2
-- | 4.
type N4 = S N3
-- | 5.
type N5 = S N4
-- | 6.
type N6 = S N5
-- | 7.
type N7 = S N6
-- | 8.
type N8 = S N7
-- | 9.
type N9 = S N8
-- | 10.
type N10 = S N9
-- | the induced random variable for some natural number.
xSomeNatural :: X N -> X SomeNatural
instance GHC.Show.Show OAlg.Entity.Natural.N'
instance GHC.Classes.Ord OAlg.Entity.Natural.N'
instance GHC.Classes.Eq OAlg.Entity.Natural.N'
instance GHC.Classes.Eq (OAlg.Entity.Natural.W n)
instance GHC.Show.Show OAlg.Entity.Natural.W'
instance GHC.Show.Show OAlg.Entity.Natural.SomeNatural
instance GHC.Classes.Eq OAlg.Entity.Natural.SomeNatural
instance OAlg.Data.Validable.Validable OAlg.Entity.Natural.SomeNatural
instance OAlg.Entity.Natural.Attestable OAlg.Entity.Natural.N0
instance OAlg.Entity.Natural.Attestable n => OAlg.Entity.Natural.Attestable ('OAlg.Entity.Natural.S n)
instance GHC.Classes.Eq OAlg.Entity.Natural.W'
instance GHC.Classes.Ord OAlg.Entity.Natural.W'
instance OAlg.Data.Number.LengthN OAlg.Entity.Natural.W'
instance GHC.Enum.Enum OAlg.Entity.Natural.W'
instance OAlg.Data.Validable.Validable OAlg.Entity.Natural.W'
instance OAlg.Entity.Definition.Entity OAlg.Entity.Natural.W'
instance OAlg.Structure.Oriented.Definition.Oriented OAlg.Entity.Natural.W'
instance OAlg.Structure.Multiplicative.Definition.Multiplicative OAlg.Entity.Natural.W'
instance OAlg.Structure.Fibred.Definition.Fibred OAlg.Entity.Natural.W'
instance OAlg.Structure.Fibred.Definition.FibredOriented OAlg.Entity.Natural.W'
instance OAlg.Structure.Additive.Definition.Additive OAlg.Entity.Natural.W'
instance OAlg.Structure.Distributive.Definition.Distributive OAlg.Entity.Natural.W'
instance OAlg.Structure.Multiplicative.Definition.Commutative OAlg.Entity.Natural.W'
instance OAlg.Structure.Oriented.Definition.Total OAlg.Entity.Natural.W'
instance GHC.Show.Show (OAlg.Entity.Natural.W n)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Natural.W n)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Natural.W n)
instance OAlg.Data.Number.LengthN OAlg.Entity.Natural.N'
instance GHC.Enum.Enum OAlg.Entity.Natural.N'
instance OAlg.Data.Validable.Validable OAlg.Entity.Natural.N'
instance OAlg.Entity.Definition.Entity OAlg.Entity.Natural.N'
instance OAlg.Structure.Oriented.Definition.Oriented OAlg.Entity.Natural.N'
instance OAlg.Structure.Multiplicative.Definition.Multiplicative OAlg.Entity.Natural.N'
instance OAlg.Structure.Fibred.Definition.Fibred OAlg.Entity.Natural.N'
instance OAlg.Structure.Fibred.Definition.FibredOriented OAlg.Entity.Natural.N'
instance OAlg.Structure.Additive.Definition.Additive OAlg.Entity.Natural.N'
instance OAlg.Structure.Distributive.Definition.Distributive OAlg.Entity.Natural.N'
instance OAlg.Structure.Multiplicative.Definition.Commutative OAlg.Entity.Natural.N'
instance OAlg.Structure.Oriented.Definition.Total OAlg.Entity.Natural.N'
-- | finite lists, parameterized by there length.
module OAlg.Entity.FinList
-- | finite lists, parameterized by there length.
data FinList (n :: N') a
[Nil] :: FinList N0 a
[:|] :: a -> FinList n a -> FinList (n + 1) a
infixr 5 :|
-- | the underlying witness.
toW :: FinList n a -> W n
-- | the head of a non empty finite list.
head :: FinList (n + 1) a -> a
-- | the tail of a non empty finite list.
tail :: FinList (n + 1) a -> FinList n a
-- | zips two sequences of the same length.
zip :: FinList n a -> FinList n b -> FinList n (a, b)
-- | zips three sequences of the same length.
zip3 :: FinList n a -> FinList n b -> FinList n c -> FinList n (a, b, c)
-- | appending an element at the end of the finite list.
(|:) :: FinList n a -> a -> FinList (n + 1) a
infixl 5 |:
-- | appending two finite lists.
(++) :: FinList n a -> FinList m a -> FinList (n + m) a
infixr 5 ++
-- | the product of two finite lists.
(**) :: FinList n a -> FinList m b -> FinList (n * m) (a, b)
-- | the constant sequence.
repeat :: Any n -> a -> FinList n a
-- | indexing finite lists, starting at the given natural number.
iFinList :: N -> FinList n a -> FinList n (a, N)
-- | adjoins to each element its index, starting from '0'.
iFinList0 :: FinList n a -> FinList n (a, N)
-- | the sequence 0,1 .. n-1.
iFinList' :: Any n -> FinList n N
-- | maps a sequnece as = a0..a(n-1) of length n to the
-- corresponding array a with ai == a$i
-- for i = 0..(n-1).
toArray :: FinList n a -> Array N a
-- | the associated finite list.
someFinList :: [a] -> SomeFinList a
-- | some finite list.
data SomeFinList a
SomeFinList :: FinList n a -> SomeFinList a
-- | concatenation.
(<++>) :: SomeFinList x -> SomeFinList x -> SomeFinList x
infixr 5 <++>
-- | induction for sequences.
inductionS :: Any n -> FinList N0 a -> (forall i. FinList i a -> FinList (i + 1) a) -> FinList n a
-- | Wrapper to switch the parameters.
newtype FinList' a n
FinList' :: FinList n a -> FinList' a n
instance GHC.Show.Show a => GHC.Show.Show (OAlg.Entity.FinList.FinList n a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (OAlg.Entity.FinList.FinList n a)
instance Data.Foldable.Foldable (OAlg.Entity.FinList.FinList n)
instance GHC.Classes.Ord x => GHC.Classes.Ord (OAlg.Entity.FinList.FinList n x)
instance GHC.Show.Show a => GHC.Show.Show (OAlg.Entity.FinList.SomeFinList a)
instance GHC.Base.Functor OAlg.Entity.FinList.SomeFinList
instance GHC.Base.Functor (OAlg.Entity.FinList.FinList n)
instance OAlg.Data.Validable.Validable a => OAlg.Data.Validable.Validable (OAlg.Entity.FinList.FinList n a)
instance (Data.Typeable.Internal.Typeable n, OAlg.Entity.Definition.Entity a) => OAlg.Entity.Definition.Entity (OAlg.Entity.FinList.FinList n a)
-- | the underlying Quiver of a Diagram.
module OAlg.Entity.Diagram.Quiver
-- | quiver of n points and m arrows.
--
-- Property Let Quiver w o be in Quiver
-- n m, then holds: For all 0 <= j
-- < m holds: s j < n and e j
-- < n where n = lengthN w, s j =
-- start (o j) and e j = end (o j).
data Quiver n m
Quiver :: Any n -> FinList m (Orientation N) -> Quiver n m
-- | the orientation of the arrows of a quiver.
qvOrientations :: Quiver n m -> FinList m (Orientation N)
-- | the dual of a quiver, with inverse coQuiverInv.
coQuiver :: Quiver n m -> Dual (Quiver n m)
-- | from the dual quiver, with inverse coQuiver.
coQuiverInv :: Dual (Quiver n m) -> Quiver n m
instance GHC.Classes.Eq (OAlg.Entity.Diagram.Quiver.Quiver n m)
instance GHC.Show.Show (OAlg.Entity.Diagram.Quiver.Quiver n m)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Diagram.Quiver.Quiver n m)
instance (Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Entity.Definition.Entity (OAlg.Entity.Diagram.Quiver.Quiver n m)
-- | definition of Diagrams on Oriented structures.
module OAlg.Entity.Diagram.Definition
-- | diagram for a Oriented structure a of type
-- t having n points and
-- m arrows.
--
-- Properties Let d be in Diagram t
-- n m a for a Oriented structure
-- a, then holds:
--
--
-- - If d matches DiagramChainTo e as then
-- holds: e == end a0 and start ai
-- == end ai+1 for all i = 0..m-2 where
-- a0:|..:|ai:|..:|am-1:|Nil
-- = as.
-- - If d matches DiagramChainFrom s as then
-- holds: s == start a0 and end ai
-- == start ai+1 for all i = 0..m-2 where
-- a0:|..:|ai:|..:|am-1:|Nil
-- = as.
-- - If d matches DiagramParallelLR l r as
-- then holds: orientation a == l:>r for
-- all a in as.
-- - If d matches DiagramParallelRL l r as
-- then holds: orientation a == r:>l for
-- all a in as.
-- - If d matches DiagramSink e as then holds:
-- e == end a for all a in
-- as.
-- - If d matches DiagramSource s as then
-- holds: s == start a for all a in
-- as.
-- - If d matches DiagramGeneral ps aijs then
-- holds pi == start aij and pj ==
-- end aij for all aij in aijs and ps =
-- p0..pn-1@.
--
data Diagram t n m a
[DiagramEmpty] :: Diagram 'Empty N0 N0 a
[DiagramDiscrete] :: FinList n (Point a) -> Diagram Discrete n N0 a
[DiagramChainTo] :: Point a -> FinList m a -> Diagram (Chain To) (m + 1) m a
[DiagramChainFrom] :: Point a -> FinList m a -> Diagram (Chain From) (m + 1) m a
[DiagramParallelLR] :: Point a -> Point a -> FinList m a -> Diagram (Parallel LeftToRight) N2 m a
[DiagramParallelRL] :: Point a -> Point a -> FinList m a -> Diagram (Parallel RightToLeft) N2 m a
[DiagramSink] :: Point a -> FinList m a -> Diagram (Star To) (m + 1) m a
[DiagramSource] :: Point a -> FinList m a -> Diagram (Star From) (m + 1) m a
[DiagramGeneral] :: FinList n (Point a) -> FinList m (a, Orientation N) -> Diagram General n m a
-- | the types of a Diagram.
data DiagramType
Empty :: DiagramType
Discrete :: DiagramType
Chain :: Site -> DiagramType
Parallel :: Direction -> DiagramType
Star :: Site -> DiagramType
General :: DiagramType
-- | Dual is well defined on diagram types.
rt' :: forall (t :: DiagramType). (Dual (Dual t) :~: t) -> Dual (Dual (Dual t)) :~: Dual t
-- | the type of a diagram.
dgType :: Diagram t n m a -> DiagramType
-- | reflexivity of the underlying diagram type.
dgTypeRefl :: Diagram t n m a -> Dual (Dual t) :~: t
-- | the points of a diagram.
dgPoints :: Oriented a => Diagram t n m a -> FinList n (Point a)
-- | the center point of a Star-diagram.
dgCenter :: Diagram (Star t) n m c -> Point c
-- | the arrows of a diagram.
dgArrows :: Diagram t n m a -> FinList m a
-- | mapping of a diagram via a homomorphism on Oriented structures.
dgMap :: Hom Ort h => h a b -> Diagram t n m a -> Diagram t n m b
-- | the underlying quiver of a diagram.
dgQuiver :: Diagram t n m a -> Quiver n m
-- | the last point of the chain.
chnToStart :: Oriented a => Diagram (Chain To) n m a -> Point a
-- | the first point of the chain.
chnFromStart :: Diagram (Chain From) n m a -> Point a
-- | adjoins a zero arrow as the first parallel arrow.
dgPrlAdjZero :: Distributive a => Diagram (Parallel LeftToRight) n m a -> Diagram (Parallel LeftToRight) n (m + 1) a
-- | the _tail__ of a parallel diagram.
dgPrlTail :: Diagram (Parallel d) n (m + 1) a -> Diagram (Parallel d) n m a
-- | subtracts to every arrow of the parallel diagram the first arrow.
dgPrlDiffHead :: Abelian a => Diagram (Parallel d) n (m + 1) a -> Diagram (Parallel d) n (m + 1) a
-- | subtracts the first arrow to all the others an drops it.
dgPrlDiffTail :: Abelian a => Diagram (Parallel d) n (m + 1) a -> Diagram (Parallel d) n m a
-- | to g (Op a).
dgToOp :: DiagramDuality f g a -> f a -> g (Op a)
-- | from g (Op a).
dgFromOp :: DiagramDuality f g a -> g (Op a) -> f a
-- | Op-duality between diagrams.
data DiagramDuality f g a
[DiagramDuality] :: Oriented a => (f a :~: Diagram t n m a) -> (g (Op a) :~: Dual (Diagram t n m a)) -> (Dual (Dual t) :~: t) -> DiagramDuality f g a
-- | the co diagram with its inverse coDiagramInv.
--
-- Property Let d be in Diagram t
-- n m a for a Oriented structure
-- a then holds: dgPoints (coDiagram d)
-- == dgPoints d.
coDiagram :: Diagram t n m a -> Dual (Diagram t n m a)
-- | from the dual diagram, with inverse of coDiagram.
coDiagramInv :: Oriented a => (Dual (Dual t) :~: t) -> Dual (Diagram t n m a) -> Diagram t n m a
-- | from Op . Op.
dgFromOpOp :: Oriented a => Diagram t n m (Op (Op a)) -> Diagram t n m a
-- | some diagram.
data SomeDiagram a
[SomeDiagram] :: Diagram t n m a -> SomeDiagram a
-- | mapping of some diagram via a homomorphism on Oriented
-- structures.
sdgMap :: Hom Ort h => h a b -> SomeDiagram a -> SomeDiagram b
-- | from Op . Op.
sdgFromOpOp :: Oriented a => SomeDiagram (Op (Op a)) -> SomeDiagram a
-- | the dual of some diagram, with inverse coSomeDiagramInv.
coSomeDiagram :: SomeDiagram a -> Dual (SomeDiagram a)
-- | from the dual of some diagram, with inverse coSomeDiagram.
coSomeDiagramInv :: Oriented a => Dual (SomeDiagram a) -> SomeDiagram a
-- | generator for random variables of diagrams.
data XDiagram t n m a
[XDiagramEmpty] :: XDiagram 'Empty N0 N0 a
[XDiagramDiscrete] :: Any n -> X (Point a) -> XDiagram Discrete n N0 a
[XDiagramChainTo] :: Any m -> XOrtSite To a -> XDiagram (Chain To) (m + 1) m a
[XDiagramChainFrom] :: Any m -> XOrtSite From a -> XDiagram (Chain From) (m + 1) m a
[XDiagramParallelLR] :: Any m -> XOrtOrientation a -> XDiagram (Parallel LeftToRight) N2 m a
[XDiagramParallelRL] :: Any m -> XOrtOrientation a -> XDiagram (Parallel RightToLeft) N2 m a
[XDiagramSink] :: Any m -> XOrtSite To a -> XDiagram (Star To) (m + 1) m a
[XDiagramSource] :: Any m -> XOrtSite From a -> XDiagram (Star From) (m + 1) m a
-- | the induced random variables of diagrams.
xDiagram :: Oriented a => (Dual (Dual t) :~: t) -> XDiagram t n m a -> X (Diagram t n m a)
-- | the induced random variable of some diagrams.
xSomeDiagram :: Oriented a => X SomeNatural -> XOrtSite To a -> XOrtSite From a -> XOrtOrientation a -> X (SomeDiagram a)
-- | distribution of a random variable of some diagrams.
dstSomeDiagram :: Oriented a => Int -> X (SomeDiagram a) -> IO ()
-- | random variable of some diagram of Orientation
-- p.
xSomeDiagramOrnt :: Entity p => X SomeNatural -> X p -> X (SomeDiagram (Orientation p))
instance GHC.Classes.Ord OAlg.Entity.Diagram.Definition.DiagramType
instance GHC.Classes.Eq OAlg.Entity.Diagram.Definition.DiagramType
instance GHC.Show.Show OAlg.Entity.Diagram.Definition.DiagramType
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Entity.Diagram.Definition.Diagram t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Classes.Eq (OAlg.Entity.Diagram.Definition.Diagram t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Entity.Diagram.Definition.SomeDiagram a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Entity.Diagram.Definition.SomeDiagram a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, n GHC.Types.~ OAlg.Entity.Natural.N0, m GHC.Types.~ OAlg.Entity.Natural.N0) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram 'OAlg.Entity.Diagram.Definition.Empty n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, m GHC.Types.~ OAlg.Entity.Natural.N0, OAlg.Structure.Oriented.Definition.XStandardPoint a, OAlg.Entity.Natural.Attestable n) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram 'OAlg.Entity.Diagram.Definition.Discrete n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To a, OAlg.Entity.Natural.Attestable m) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Chain 'OAlg.Data.Dualisable.To) ('OAlg.Entity.Natural.S m) m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From a, OAlg.Entity.Natural.Attestable m) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Chain 'OAlg.Data.Dualisable.From) ('OAlg.Entity.Natural.S m) m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, n GHC.Types.~ OAlg.Entity.Natural.N2, OAlg.Structure.Oriented.Definition.XStandardOrtOrientation a, OAlg.Entity.Natural.Attestable m) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Parallel 'OAlg.Data.Dualisable.LeftToRight) n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, n GHC.Types.~ OAlg.Entity.Natural.N2, OAlg.Structure.Oriented.Definition.XStandardOrtOrientation a, OAlg.Entity.Natural.Attestable m) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Parallel 'OAlg.Data.Dualisable.RightToLeft) n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To a, OAlg.Entity.Natural.Attestable m) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Star 'OAlg.Data.Dualisable.To) ('OAlg.Entity.Natural.S m) m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From a, OAlg.Entity.Natural.Attestable m) => OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Star 'OAlg.Data.Dualisable.From) ('OAlg.Entity.Natural.S m) m a)
instance OAlg.Hom.Oriented.Definition.HomOriented h => OAlg.Category.Applicative.Applicative1 h (OAlg.Entity.Diagram.Definition.Diagram t n m)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Entity.Diagram.Definition.Diagram t n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Entity.Definition.Entity (OAlg.Entity.Diagram.Definition.Diagram t n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, Data.Typeable.Internal.Typeable d, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Parallel d) n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Diagram.Definition.Diagram ('OAlg.Entity.Diagram.Definition.Chain t) n m a)
-- | propositions on diagrams on Oriented structures.
module OAlg.Entity.Diagram.Proposition
-- | validity of diagrams on Symbols.
prpDiagramOrntSymbol :: Statement
-- | the point list is stable under coDiagram.
prpCoDiagram :: Oriented a => Diagram t n m a -> Statement
-- | propositions on basic algebraic structures.
module OAlg.Structure.Proposition
-- | validity of the algebraic structure of N.
prpStructureN :: Statement
-- | validity of the algebraic structure of Z.
prpStructureZ :: Statement
-- | validity of the algebraic structure of Q.
prpStructureQ :: Statement
-- | validity of the algebraic structure of OS.
prpStructureOS :: Statement
-- | definition of Rings.
module OAlg.Structure.Ring.Definition
-- | distributive structure where * and + are total.
--
-- Note If r is Total and
-- Distributive then Root r is
-- Singleton.
type Semiring r = (Distributive r, Total r)
-- | the neutral element according to *, i.e. rOne == one
-- unit.
rOne :: Semiring r => r
-- | the neutral element according to +, i.e. rZero ==
-- zero unit.
rZero :: Semiring r => r
-- | check being the additive inverse of rOne.
isMinusOne :: Semiring r => r -> Bool
-- | abelian semi rings.
type Ring r = (Semiring r, Abelian r)
-- | Note Not every element not equal to zero has to be
-- invertible. As such Z is Galoisian.
type Galoisian r = (Ring r, Commutative r, Invertible r)
-- | not degenerated commutative rings where every element not equal to
-- zero has a multiplicative inverse.
--
-- Properties
--
--
-- - rZero /= rOne.
-- - For all x and y in r
-- holds:
- If y /= rZero then x / y
-- is valid
- If y == rZero then
-- x / y is not valid and its evaluation will end
-- up in a NotInvertible-exception.
-- - For all x and y in r with y
-- /= rZero holds: y * (x / y) ==
-- x.
--
class Galoisian r => Field r
-- | division.
(/) :: Field r => r -> r -> r
infixl 7 /
instance OAlg.Structure.Ring.Definition.Field OAlg.Data.Number.Q
-- | Rings.
module OAlg.Structure.Ring
-- | definition of numbers as ordered Semiring with infinitely many
-- elements.
module OAlg.Structure.Number.Definition
-- | ordered commutative semi ring where + and * respect the
-- given ordering.
--
-- Definitions
--
--
-- - A number x is called positive if 0 <
-- x and negative if x < 0.
-- - A number structure is called positive if it contains
-- no negative elements.
--
--
-- Properties
--
--
-- - 1 is positive.
-- - For all x < y and z holds: x + z
-- < y + z
-- - For all 0 < x, 0 < y holds: 0 < x
-- * y.
-- - For all x holds: x == signum x *
-- abs x.
-- - For all x holds: floor x +
-- fraction x == x.
--
--
-- Note
--
--
-- - A not positive structure of numbers contain always also the
-- additive inverse of 1 which is negative.
-- - Structures of numbers have infinitely many values, because from
-- the properties above follows that 0 < 1 < 2 < .. <
-- ntimes n 1 < ntimes (n + 1) 1 < ..
-- for all 0 <= n.
--
class (Semiring r, Commutative r, Ord r) => Number r
-- | the additive inverse of 1 - if it exists - and will be
-- denoted by -1 (see the note above).
minusOne :: Number r => Maybe r
-- | sign of a number.
--
-- Property For all x holds: if 0 < x then
-- signum x == 1 and if x == 0 then signum x ==
-- 0 and if x < 0 then signum x == -1 (for
-- -1 see minusOne).
--
-- Note The default implementation is:
--
--
-- signum x = case rZero compare x of
-- GT -> rOne
-- EQ -> rZero
-- LT -> e where Just e = minusOne
--
signum :: Number r => r -> r
-- | absolute value of a number.
--
-- Definition The absolute value of a x is
-- defined by abs x = signum x * x (which serves
-- as the default implementation).
--
-- Properties For all x holds:
--
--
-- - 0 <= abs x.
-- - if 0 <= x then abs x == x.
--
abs :: Number r => r -> r
-- | floor of a value of a number.
--
-- Properties
--
--
-- - floor 0 == 0.
-- - For all x holds: floor (x + 1) = floor x
-- + 1.
--
floor :: Number r => r -> r
-- | fractional part of a number.
--
-- Property For all x holds: 0 <= fraction x < 1.
fraction :: Number r => r -> r
-- | simultaneous evaluation of floor - represented as an
-- integer - and its fraction.
--
-- Properties For all x holds:
--
--
-- - floor x == ntimes (prj $ fst
-- $ zFloorFraction $ x) (signum
-- x).
-- - fraction x == snd .
-- zFloorFraction.
--
--
-- Note This properties are used for the default implementation of
-- floor and fraction.
zFloorFraction :: Number r => r -> (Z, r)
-- | floor to Z.
zFloor :: Number r => r -> Z
-- | the digital representation of x in the base b.
--
-- Let Digits s xs ys = toDigits r then
--
--
-- - s is the signum x.
-- - xs is the digital representation of abs
-- (floor x) .
-- - ys is the - possibly infinite - digital representation of
-- abs (fraction x) in the base b.
--
--
-- Examples
--
--
-- >>> toDigits (1/3) :: Digits 10 Q
-- Digits 1 [] [3,3,3..]
--
--
--
-- >>> toDigits (-4/3) :: Digits 3 Q
-- Digits (-1) [1] [1]
--
--
-- Note To get the first n digits of the fractional part
-- ys for the digital representation of x use
-- toDigitsFinite n x.
toDigits :: (Number r, KnownNat b, 2 <= b) => r -> Digits b r
-- | digital representation of numbers for the given base b.
--
-- Note
--
--
-- - dgsFlr is a finite list
-- - dgsFrc maybe a infinite list and as such valid could
-- end up in an infinite proposition!
--
data Digits (b :: Nat) r
[Digits] :: 2 <= b => r -> [N] -> [N] -> Digits b r
-- | toDigitsFinite n is like toDigits but the fractional
-- part is limited to the length of n and is given by
-- dgsFrcTake n . toDigits.
toDigitsFinite :: (Number r, KnownNat b, 2 <= b) => N -> r -> Digits b r
-- | fromDigits n dgs@(Digits s xs ys) is given by s
-- * (xm * b^m + .. + xi *
-- b^i + .. + x0 * b^0 + y1
-- * r^1 + .. + yj * r^j
-- + .. + yn * r^n where b =
-- dgsBase dgs, xs = [xm..xi..x0], ys =
-- [y1,y2..yj..yn..] and r = invert b.
--
-- Property Let 1 < b and dgs =
-- Digits s xs ys where s is either 1 or -1 and
-- 0 <= xi < b for all i and 0
-- <= yj < b for all j then for all
-- n holds: toDigits b n (fromDigits b n dgs)
-- == dgs.
--
-- Note
--
--
-- - All the elements of the above formula are lifted to the type
-- r via \x -> ntimes x rOne.
-- - Because the type r is acyclic, the expression
-- invert b - which is actually invert
-- (ntimes b rOne) - is regular.
-- - If b is not bigger then 1 then an exception
-- Undefined will be thrown.
--
fromDigits :: (Number r, Acyclic r, KnownNat b) => N -> Digits b r -> r
-- | the base of a digit, i.e. the corresponding natural number of the type
-- literal b.
dgsBase :: KnownNat b => Digits b r -> N
-- | the proxy with the same type b.
dgsProxy :: Digits b r -> Proxy b
-- | limits the fractional part dgsFrc to the length of n.
dgsFrcTake :: N -> Digits b r -> Digits b r
-- | discrete numbers.
--
-- Property For all x holds: fraction x
-- == 0.
class Number a => Integral a
divMod :: Integral a => a -> a -> (a, a)
div :: Integral a => a -> a -> a
mod :: Integral a => a -> a -> a
-- | the list of prime numbers.
primes :: [N]
-- | distributive structure with entities scaleable by Q.
--
-- Property For every 0 < n and point
-- p holds: ntimes n (one p) is
-- invertible.
--
-- Note
--
--
-- - The cyclic rings Mod n for 2 <= n are
-- not scaleable by Q, because 1 /= 0 and
-- ntimes n 1 == 0!
-- - If for every point p holds that zero
-- (p:>p) == one p then the structure is
-- scaleable by Q (e.g. Orientation p).
--
class (Distributive a, Abelian a, Invertible a) => Acyclic a
-- | qtimes q a == ztimes z a *
-- invert (ntimes n (one (start a))).
-- where z = numerator q and n = denominator
-- q.
qtimes :: Acyclic a => Q -> a -> a
-- | continuous numbers, i.e acyclic and negateable numbers. They induce a
-- sub Q-vectorial structures of the real numbers.
--
-- Note We will distinguish here instances of
-- Fractional and the mathematical entities of real
-- numbers!
type Fractional r = (Number r, Abelian r, Acyclic r)
-- | measurable entities.
class (Entity a, Number r) => Measurable a r
-- | distance of two points.
--
-- Properties Let a r be
-- Measurable, then holds:
--
--
-- - For all x and y in a holds:
-- 0 <= dist x y
-- - For all x and y in a holds:
-- dist x y == 0 if and only if x == y.
-- - For all x and y in a holds:
-- dist x y == dist y x.
-- - For all x, y and z in a
-- holds: dist x z <= dist x y + dist y
-- z
--
dist :: Measurable a r => a -> a -> r
instance GHC.Show.Show r => GHC.Show.Show (OAlg.Structure.Number.Definition.Digits b r)
instance GHC.Classes.Eq r => GHC.Classes.Eq (OAlg.Structure.Number.Definition.Digits b r)
instance GHC.Classes.Ord r => GHC.Classes.Ord (OAlg.Structure.Number.Definition.Digits b r)
instance OAlg.Data.Validable.Validable r => OAlg.Data.Validable.Validable (OAlg.Structure.Number.Definition.Digits b r)
instance (GHC.TypeNats.KnownNat b, OAlg.Entity.Definition.Entity r) => OAlg.Entity.Definition.Entity (OAlg.Structure.Number.Definition.Digits b r)
instance (OAlg.Structure.Number.Definition.Number r, OAlg.Structure.Additive.Definition.Abelian r) => OAlg.Structure.Number.Definition.Measurable r r
instance OAlg.Structure.Number.Definition.Measurable OAlg.Data.Number.N OAlg.Data.Number.Z
instance OAlg.Structure.Number.Definition.Acyclic ()
instance OAlg.Structure.Number.Definition.Acyclic OAlg.Data.Number.Q
instance OAlg.Structure.Number.Definition.Integral OAlg.Data.Number.N
instance OAlg.Structure.Number.Definition.Integral OAlg.Data.Number.Z
instance OAlg.Structure.Number.Definition.Number OAlg.Data.Number.N
instance OAlg.Structure.Number.Definition.Number GHC.Num.Integer.Integer
instance OAlg.Structure.Number.Definition.Number OAlg.Data.Number.Z
instance OAlg.Structure.Number.Definition.Number OAlg.Data.Number.Q
-- | numbers as ordered Semiring with infinitely many elements.
module OAlg.Structure.Number
-- | sets of ordered entities.
module OAlg.Entity.Sequence.Set
-- | set of ordered entities in x.
--
-- Property Let s = Set xs be in Set
-- x for a ordered Entity type x, then
-- holds:
--
--
-- - For all ..x:y.. in xs holds: x
-- < y.
-- - lengthN s == lengthN xs.
--
newtype Set x
Set :: [x] -> Set x
-- | makes a set from the given list.
set :: Ord x => [x] -> Set x
-- | the span of a set.
setSpan :: Set x -> Span x
-- | the elements of a set.
setxs :: Set x -> [x]
-- | mapping a set.
setSqc :: Ord x => (i -> Maybe x) -> Set i -> Set x
-- | mapping of sets.
--
-- Note This works only for finite sets!
setMap :: Ord y => (x -> y) -> Set x -> Set y
-- | checks for being a sub set.
isSubSet :: Ord x => Set x -> Set x -> Bool
-- | the empty set.
setEmpty :: Set x
-- | the union of two sets.
setUnion :: Ord x => Set x -> Set x -> Set x
-- | the index of an element, where the elements of the given set are
-- indexed from 0.
--
-- Examples
--
--
-- >>> setIndex (Set ['a'..'x']) 'c'
-- Just 2
--
setIndex :: Ord x => Set x -> x -> Maybe N
-- | random variable of sets with maximal the given length.
xSet :: Ord x => N -> X x -> X (Set x)
-- | validity for the union operator of sets.
prpSetUnion :: (Ord x, Show x) => X (Set x) -> Statement
instance Data.Foldable.Foldable OAlg.Entity.Sequence.Set.Set
instance OAlg.Data.Number.LengthN (OAlg.Entity.Sequence.Set.Set x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (OAlg.Entity.Sequence.Set.Set x)
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Entity.Sequence.Set.Set x)
instance (OAlg.Data.Validable.Validable x, GHC.Classes.Ord x, GHC.Show.Show x) => OAlg.Data.Validable.Validable (OAlg.Entity.Sequence.Set.Set x)
instance (OAlg.Entity.Definition.Entity x, GHC.Classes.Ord x) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sequence.Set.Set x)
instance GHC.Classes.Ord x => OAlg.Data.Ord.POrd (OAlg.Entity.Sequence.Set.Set x)
-- | graphs of entities in x.
module OAlg.Entity.Sequence.Graph
-- | mapping from an ordered index type i to a
-- Entity type x.
--
-- Property Let g = Graph ixs be in
-- Graph i x for a ordered Entity
-- type i and Entity type x, then
-- holds:
--
--
-- - For all ..(i,_):(j,_).. in ixs holds:
-- i < j.
-- - lengthN g == lengthN ixs.
--
newtype Graph i x
Graph :: [(i, x)] -> Graph i x
-- | the length of a graph.
gphLength :: Graph i x -> N
-- | the underlying associations.
gphxs :: Graph i x -> [(i, x)]
-- | the induced graph given by a set of indices and a mapping.
gphSqc :: (i -> Maybe x) -> Set i -> Graph i x
-- | looks up the mapping of an index.
gphLookup :: Ord i => Graph i x -> i -> Maybe x
instance OAlg.Data.Number.LengthN (OAlg.Entity.Sequence.Graph.Graph i x)
instance (GHC.Classes.Eq i, GHC.Classes.Eq x) => GHC.Classes.Eq (OAlg.Entity.Sequence.Graph.Graph i x)
instance (GHC.Show.Show i, GHC.Show.Show x) => GHC.Show.Show (OAlg.Entity.Sequence.Graph.Graph i x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Data.Validable.Validable (OAlg.Entity.Sequence.Graph.Graph i x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sequence.Graph.Graph i x)
instance GHC.Base.Functor (OAlg.Entity.Sequence.Graph.Graph i)
-- | basic definitions for sequences as mappings of an index to an entity.
module OAlg.Entity.Sequence.Definition
-- | sequences as mappings of an index.
--
-- Definition Let s, i,
-- x be an instance of Sequence and xs be
-- in s x, then we call xs
-- finite if and only if the evaluation of
-- lengthN xs terminates and will not end up in an
-- exception.
--
-- Property Let s, i,
-- x be an instance of Sequence, then holds:
--
--
-- - For all xs in s x
-- holds:
- graph is constant in its first
-- parameter.
- If xs is finite, then lengthN
-- xs == lengthN (graph p xs) for any
-- p.
-- - For all xs in s x
-- holds:
- list is constant in its first
-- parameter.
- For all ..(x,i):(x,j).. in
-- xs holds: i < j.
- If xs is
-- finite, then lengthN xs == lengthN
-- (list p xs) for any p.
-- - Let xs be in s x and i in
-- i, then holds: there exists an x in
-- x with xs ? i matches Just
-- x if and only if there exists an (i',x) in
-- graph (Just i) xs such that i ==
-- i'.
--
--
-- Note The first parameter of graph - respectively
-- list - serves only as a proxy and as such it is only
-- relevant on the type level.
class (LengthN (s x), Ord i) => Sequence s i x
-- | the associated graph of a sequence
graph :: Sequence s i x => p i -> s x -> Graph i x
-- | the associated list of its items together with there index.
list :: Sequence s i x => p i -> s x -> [(x, i)]
-- | the i-th item.
(??) :: Sequence s i x => s x -> i -> Maybe x
-- | the indexed list of the sequence.
listN :: Sequence s N x => s x -> [(x, N)]
-- | the i-th element of the sequence.
--
-- Property Let xs be in s x and
-- i in i for a instance of Sequence
-- s i x, then holds: If i is in the
-- support of xs then xs ? i is the
-- i-th item of xs, else its evaluation will end up by
-- throwing a IndexOutOfSupport-exception.
(?) :: Sequence s i x => s x -> i -> x
-- | checks for being empty.
isEmpty :: Sequence s i x => p i -> s x -> Bool
-- | the span of a sequence.
span :: Sequence s i x => p i -> s x -> Span i
-- | the support of a sequence, i.e. all the indices which are not mapped
-- to Nothing.
support :: Sequence s i x => p i -> s x -> Set i
-- | the image of a sequence, i.e. all the entities are hit by the mapping.
image :: (Sequence s i x, Ord x) => p i -> s x -> Set x
-- | constructable sequences.
class (Entity x, Entity i, Sequence s i x) => ConstructableSequence s i x
-- | constructs a sequence.
sequence :: ConstructableSequence s i x => (i -> Maybe x) -> Set i -> s x
-- | restricts a sequence.
(<&) :: ConstructableSequence s i x => s x -> Set i -> s x
infixl 7 <&
-- | mapping the indices according to the given set.
sqcIndexMap :: (ConstructableSequence s i x, Sequence s j x) => Set i -> (i -> j) -> s x -> s x
-- | sequence exceptions which are sub exceptions from
-- SomeOAlgException.
data SequenceException
IndexOutOfSupport :: SequenceException
instance GHC.Show.Show OAlg.Entity.Sequence.Definition.SequenceException
instance GHC.Classes.Eq OAlg.Entity.Sequence.Definition.SequenceException
instance (OAlg.Structure.Number.Definition.Integral r, GHC.Enum.Enum r, OAlg.Entity.Definition.Entity x) => OAlg.Entity.Sequence.Definition.ConstructableSequence [] r x
instance (OAlg.Structure.Number.Definition.Integral r, GHC.Enum.Enum r, OAlg.Entity.Definition.Entity x, GHC.Classes.Ord x) => OAlg.Entity.Sequence.Definition.ConstructableSequence OAlg.Entity.Sequence.Set.Set r x
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Sequence.Definition.ConstructableSequence (OAlg.Entity.Sequence.Graph.Graph i) i x
instance (OAlg.Structure.Number.Definition.Integral r, GHC.Enum.Enum r) => OAlg.Entity.Sequence.Definition.Sequence [] r x
instance (OAlg.Structure.Number.Definition.Integral r, GHC.Enum.Enum r) => OAlg.Entity.Sequence.Definition.Sequence OAlg.Entity.Sequence.Set.Set r x
instance GHC.Classes.Ord i => OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Sequence.Graph.Graph i) i x
instance GHC.Exception.Type.Exception OAlg.Entity.Sequence.Definition.SequenceException
-- | partially defined sequences of items in x with a
-- totally ordered index type i.
module OAlg.Entity.Sequence.PSequence
-- | partially defined sequences (x0,i0),(x1,i1).. of index items
-- in x with a totally ordered index type
-- i.
--
-- Property Let PSequence xis be in
-- PSequence i x then holds: i
-- < j for all ..(_,i):(_,j).. in
-- xis.
--
-- Examples
--
--
-- >>> PSequence [('a',3),('b',7),('c',12)] :: PSequence N Char
-- PSequence [('a',3),('b',7),('c',12)]
--
--
-- and
--
--
-- >>> validate (valid (PSequence [('a',3),('b',7),('c',12)] :: PSequence N Char))
-- Valid
--
--
-- but
--
--
-- >>> validate (valid (PSequence [('a',3),('b',15),('c',12)] :: PSequence N Char))
-- Invalid
--
--
-- as Char is a totally ordered type it can serve as index type
--
--
-- >>> validate (valid (PSequence [(12,'c'),(3,'e'),(8,'x')] :: PSequence Char Z))
-- Valid
--
--
-- and they admit a total right operation <* of
-- Permutation i
--
--
-- >>> (PSequence [(12,'c'),(3,'e'),(8,'x')] :: PSequence Char Z) <* pmtSwap 'e' 'x'
-- PSequence [(12,'c'),(8,'e'),(3,'x')]
--
--
-- Note As we keep the constructor public, it is crucial for there
-- further use to ensure that they are valid!
newtype PSequence i x
PSequence :: [(x, i)] -> PSequence i x
-- | proxy of the second type valiable i.
iProxy :: s i x -> Proxy i
-- | the span.
psqSpan :: Ord i => PSequence i x -> Span i
-- | the empty partially defined sequence.
psqEmpty :: PSequence i x
-- | checks of being empty.
psqIsEmpty :: PSequence i x -> Bool
-- | the underlying list of indexed values.
psqxs :: PSequence i x -> [(x, i)]
-- | the partial sequenc given by a aggregation function an a list of value
-- index pairs, which will be sorted and accordingly aggregated by
-- thegiven aggregation function.
psequence :: Ord i => (x -> x -> x) -> [(x, i)] -> PSequence i x
-- | the head of a partial sequence.
psqHead :: PSequence i x -> (x, i)
-- | the tail.
psqTail :: PSequence i x -> PSequence i x
-- | maps the entries, where the indices are preserved.
psqMap :: (x -> y) -> PSequence i x -> PSequence i y
-- | maps and shifts a partial sequence.
psqMapShift :: Number i => i -> ((x, i) -> y) -> PSequence i x -> PSequence i y
-- | filters the partially defiend sequence accordingly the given
-- predicate.
psqFilter :: (x -> Bool) -> PSequence i x -> PSequence i x
-- | splits the sequence as long as the given predicate holds.
psqSplitWhile :: ((x, i) -> Bool) -> PSequence i x -> (PSequence i x, PSequence i x)
-- | interlaces the tow partially defined sequences according to the given
-- mappings.
psqInterlace :: Ord i => (x -> y -> z) -> (x -> z) -> (y -> z) -> PSequence i x -> PSequence i y -> PSequence i z
-- | composition of the two partially defined sequences.
--
-- Property Let f be in PSequence i
-- x and g be in PSequence j
-- i then f `psqCompose` g is given by
-- join . fmap ((??) f) .
-- (??) g.
psqCompose :: (Ord i, Ord j) => PSequence i x -> PSequence j i -> PSequence j x
-- | appends the second partially defined sequence to the first.
--
-- Property Let zs = psqAppend xs ys where
-- ..(x,l) = xs and (y,f).. = ys then holds:
--
--
-- - If l < f
-- - Then zs is valid.
--
psqAppend :: PSequence i x -> PSequence i x -> PSequence i x
-- | shears the two entries at the given position and leafs the others
-- untouched.
--
-- Property Let x' = psqShear (sk,k) (sl,l) x, then holds
--
--
--
--
-- - x' k == sk (x k) (x l) and x' l == sl
-- (x k) (x l).
-- - x' i == x i for all i /= k,
-- l.
--
psqShear :: Ord i => (Maybe a -> Maybe a -> Maybe a, i) -> (Maybe a -> Maybe a -> Maybe a, i) -> PSequence i a -> PSequence i a
-- | swaps the the k-th and the l-th entry.
--
-- Property Let x' = psqSwap k l x, then holds:
--
--
--
--
-- - x' k == x l and x' l == x k.
-- - x' i == x i for all i /= k,
-- l.
--
psqSwap :: Ord i => i -> i -> PSequence i a -> PSequence i a
-- | xPSequence n m random variable of partially defined
-- sequences with maximal length min n m.
xPSequence :: Ord i => N -> N -> X x -> X i -> X (PSequence i x)
instance Data.Foldable.Foldable (OAlg.Entity.Sequence.PSequence.PSequence i)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance (GHC.Classes.Ord x, GHC.Classes.Ord i) => GHC.Classes.Ord (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance (GHC.Classes.Eq x, GHC.Classes.Eq i) => GHC.Classes.Eq (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance (GHC.Show.Show x, GHC.Show.Show i) => GHC.Show.Show (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance OAlg.Data.Canonical.Embeddable [x] (OAlg.Entity.Sequence.PSequence.PSequence OAlg.Data.Number.N x)
instance OAlg.Data.Canonical.Projectible [x] (OAlg.Entity.Sequence.PSequence.PSequence OAlg.Data.Number.N x)
instance GHC.Classes.Ord i => OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Sequence.PSequence.PSequence i) i x
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Sequence.Definition.ConstructableSequence (OAlg.Entity.Sequence.PSequence.PSequence i) i x
instance GHC.Base.Functor (OAlg.Entity.Sequence.PSequence.PSequence i)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Data.Validable.Validable (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sequence.PSequence.PSequence i x)
-- | Multiplicative structures with a power function
-- (^).
module OAlg.Structure.Exponential
-- | Multiplicative structures with a partially defined power
-- function with numbers as exponents.
--
-- Properties
--
--
-- - For all f and a holds:
- If
-- start f == end f or a is an
-- element of [-1,1] then f^a is
-- valid.
- If start f /= end
-- f and a is not an element of [-1,1] then
-- f^a is not valid and its evaluation will end up
-- in a NotExponential-exception.
-- - For all f holds: f^1 == f.
-- - For all f holds: f^(-1) ==
-- invert f.
-- - For all f and a with start f
-- == end f and a not in [-1,1]
-- holds: start (f^a) == start f and
-- end (f^a) == end f.
-- - For all f, a and b with
-- start f == end f holds:
-- f^(a*b) == (f^a)^ b.
-- - For all f with start f == end
-- f holds: f^0 == one (end f).
-- - For all f, a and b with
-- start f == end f holds: f^(a
-- + b) == f^a * f^b.
-- - For all a and p holds: (one
-- p)^a == one p.
-- - For all f, g and a with
-- start f == end f, start g
-- == end g start f == start
-- g and f * g == g * f holds: (f
-- * g)^a == f^a *
-- g^a.
--
--
-- Note
--
--
-- - The phrase ..a is an element of [-1,1]..
-- for the properties of ^ is meant to be: isOne a
-- or isMinusOne a.
-- - If -1 is an instance of Exponent f (see
-- minusOne) then f has to be Cayleyan.
--
class (Multiplicative f, Number (Exponent f)) => Exponential f where {
-- | the exponent.
type Exponent f;
}
-- | the power of a factor to an exponent.
(^) :: Exponential f => f -> Exponent f -> f
infixl 9 ^
-- | the power of an orientation by an number.
--
-- Note opower fulfill the properties of Exponential
-- for any number structure.
opower :: (Entity p, Number r) => Orientation p -> r -> Orientation p
-- | reals.
class Multiplicative f => Real f
power :: (Real f, Number r) => f -> r -> f
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Exponential.Real (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative c => OAlg.Structure.Exponential.Exponential (OAlg.Structure.Multiplicative.Definition.Inv c)
-- | definition of vectorial structures, i.e. Additive structures
-- with a scalar multiplication (!).
module OAlg.Structure.Vectorial.Definition
-- | Additive structures with a total defined scalar
-- multiplication from the left by a commutative semi ring.
-- The entities of v are called vector.
--
-- Properties Let v b a Vectorial
-- structure, then holds:
--
--
-- - For all s in Scalar v and
-- v in v holds: s!v is
-- valid and root (s!v) == root
-- v.
-- - For all v in v holds: 0!v
-- == zero (root v).
-- - For all s in Scalar v and
-- r in Root v holds
-- s!zero r == zero r.
-- - For all r, s in Scalar v
-- and v in v holds: (r + s)!v
-- == r!v + s!v.
-- - For all s in Scalar v and
-- v, w in v with root v
-- == root w holds: s!(v + w)
-- == s!v + s!w.
-- - For all v in v holds: 1!v
-- == v.
-- - For all r, s in Scalar v
-- and v in v holds: (r*s)!v
-- == r!(s!v).
--
class (Semiring (Scalar v), Commutative (Scalar v), Additive v) => Vectorial v where {
-- | the type of scalars.
type Scalar v;
}
-- | scalar multiplication of a vector.
(!) :: Vectorial v => Scalar v -> v -> v
infixr 8 !
-- | type representing the class of k-Vectorial
-- structures.
data Vec k
-- | transformable to k-Vectorial structure.
class (ForgetfulFbr (s k), ForgetfulAdd (s k), Transformable (s k) (Vec k)) => ForgetfulVec k s
-- | Vectorial structures with a partially defined scalar
-- product.
--
-- Properties
--
--
-- - For all v, w holds: if root v
-- == root w then v <!> w is
-- valid, otherwise a UndefinedScalarproduct-exception will
-- be thrown.
-- - For all u holds: u <!> zero
-- (root u) == rZero.
-- - For all u, v and w with root
-- u == root w and root w ==
-- root v holds: u <!> (v + w)
-- == u <!> v + u <!>
-- w.
-- - For all w holds: zero (root w)
-- <!> w == rZero.
-- - For all u, v and w with root
-- w == root u and root u ==
-- root v holds: (u + v) <!> w
-- == u <!> w + v' !' w.
--
class Vectorial v => Euclidean v
-- | the scalar product of two vectors.
() :: Euclidean v => v -> v -> Scalar v
infix 7
instance OAlg.Structure.Vectorial.Definition.ForgetfulVec k OAlg.Structure.Vectorial.Definition.Vec
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Vectorial.Definition.Vec k) OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Vectorial.Definition.Vec k) OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Vectorial.Definition.Vec k) OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Vectorial.Definition.Vec k) OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Definition.ForgetfulTyp (OAlg.Structure.Vectorial.Definition.Vec k)
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr (OAlg.Structure.Vectorial.Definition.Vec k)
instance OAlg.Structure.Additive.Definition.ForgetfulAdd (OAlg.Structure.Vectorial.Definition.Vec k)
instance OAlg.Structure.Vectorial.Definition.Euclidean OAlg.Data.Number.N
instance OAlg.Structure.Vectorial.Definition.Euclidean OAlg.Data.Number.Z
instance OAlg.Structure.Vectorial.Definition.Euclidean OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Vectorial.Definition.Euclidean (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Vectorial.Definition.Vectorial ()
instance OAlg.Structure.Vectorial.Definition.Vectorial GHC.Types.Int
instance OAlg.Structure.Vectorial.Definition.Vectorial GHC.Num.Integer.Integer
instance OAlg.Structure.Vectorial.Definition.Vectorial OAlg.Data.Number.N
instance OAlg.Structure.Vectorial.Definition.Vectorial OAlg.Data.Number.Z
instance OAlg.Structure.Vectorial.Definition.Vectorial OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Structure.Oriented.Definition.Orientation p)
instance (OAlg.Structure.Vectorial.Definition.Vectorial v, OAlg.Structure.Fibred.Definition.FibredOriented v) => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Data.Opposite.Op v)
-- | definition of algebraic structures, i.e. Distributive
-- structures with a suitable Vectorial structure.
module OAlg.Structure.Algebraic.Definition
-- | Distributive structures with a suitable Vectorial
-- structure.
--
-- Property Let a be a Algebraic structure,
-- then holds:
--
--
-- - For all r in Scalar a and
-- a, b in a with start a
-- == end b holds: r!(a*b) ==
-- (r!a)*b and r!(a*b) ==
-- a*(r!b).
--
class (Distributive a, Vectorial a) => Algebraic a
-- | type representing the class of k-Algebraic
-- structures.
data Alg k
-- | transformable to k-Algebraic structure.
class (ForgetfulOrt (s k), ForgetfulMlt (s k), ForgetfulFbr (s k), ForgetfulFbrOrt (s k), ForgetfulAdd (s k), ForgetfulDst (s k), ForgetfulVec k s, Transformable (s k) (Alg k)) => ForgetfulAlg k s
instance OAlg.Structure.Algebraic.Definition.ForgetfulAlg k OAlg.Structure.Algebraic.Definition.Alg
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Definition.Typ
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Entity.Definition.Ent
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Fibred.Definition.Fbr
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Fibred.Definition.FbrOrt
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Additive.Definition.Add
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) OAlg.Structure.Distributive.Definition.Dst
instance OAlg.Structure.Definition.Transformable (OAlg.Structure.Algebraic.Definition.Alg k) (OAlg.Structure.Vectorial.Definition.Vec k)
instance OAlg.Structure.Definition.Transformable1 OAlg.Data.Opposite.Op (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Definition.ForgetfulTyp (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Oriented.Definition.ForgetfulOrt (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Multiplicative.Definition.ForgetfulMlt (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Fibred.Definition.ForgetfulFbr (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Fibred.Definition.ForgetfulFbrOrt (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Additive.Definition.ForgetfulAdd (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Distributive.Definition.ForgetfulDst (OAlg.Structure.Algebraic.Definition.Alg k)
instance OAlg.Structure.Vectorial.Definition.ForgetfulVec k OAlg.Structure.Algebraic.Definition.Alg
instance OAlg.Structure.Algebraic.Definition.Algebraic ()
instance OAlg.Structure.Algebraic.Definition.Algebraic GHC.Types.Int
instance OAlg.Structure.Algebraic.Definition.Algebraic GHC.Num.Integer.Integer
instance OAlg.Structure.Algebraic.Definition.Algebraic OAlg.Data.Number.N
instance OAlg.Structure.Algebraic.Definition.Algebraic OAlg.Data.Number.Z
instance OAlg.Structure.Algebraic.Definition.Algebraic OAlg.Data.Number.Q
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Algebraic.Definition.Algebraic (OAlg.Structure.Oriented.Definition.Orientation p)
instance OAlg.Structure.Algebraic.Definition.Algebraic a => OAlg.Structure.Algebraic.Definition.Algebraic (OAlg.Data.Opposite.Op a)
-- | propositions on Algebraic structures.
module OAlg.Structure.Algebraic.Proposition
-- | validity of the Algebraic structure of a.
prpAlg :: Algebraic a => XAlg a -> Statement
-- | validity according to OAlg.Structure.Algebraic.Definition#Alg1.
prpAlg1 :: Algebraic a => X (Scalar a) -> X (Mltp2 a) -> Statement
-- | random variable to validate Algebraic structures.
data XAlg a
XAlg :: X (Scalar a) -> X (Mltp2 a) -> XAlg a
-- | the induces random variable.
xoAlg :: Algebraic a => X (Scalar a) -> XOrtSite d a -> XAlg a
instance OAlg.Structure.Algebraic.Definition.Algebraic a => OAlg.Data.Validable.Validable (OAlg.Structure.Algebraic.Proposition.XAlg a)
-- | Algebraic structures.
module OAlg.Structure.Algebraic
-- | propositions on Vectorial structures.
module OAlg.Structure.Vectorial.Proposition
-- | validity of the Vectorial structure of v.
prpVec :: Vectorial v => XVec v -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec1.
prpVec1 :: Vectorial v => X (Scalar v) -> X v -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec2.
prpVec2 :: Vectorial v => X v -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec3.
prpVec3 :: Vectorial v => p v -> X (Scalar v) -> X (Root v) -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec4.
prpVec4 :: Vectorial v => X (Scalar v) -> X v -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec5.
prpVec5 :: Vectorial v => X (Scalar v) -> X (Adbl2 v) -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec6.
prpVec6 :: Vectorial v => X v -> Statement
-- | validity according to OAlg.Structure.Vectorial.Definition#Vec7.
prpVec7 :: Vectorial v => X (Scalar v) -> X v -> Statement
-- | random variable to validate Vectorial structures.
data XVec v
XVec :: X (Scalar v) -> X (Root v) -> X v -> X (Adbl2 v) -> XVec v
-- | the induced random variable.
xoVec :: FibredOriented v => X (Scalar v) -> XOrtOrientation v -> XVec v
instance OAlg.Structure.Vectorial.Definition.Vectorial v => OAlg.Data.Validable.Validable (OAlg.Structure.Vectorial.Proposition.XVec v)
-- | Vectorial structures.
module OAlg.Structure.Vectorial
-- | homomorphisms between Vectorial structures having the same
-- associated Scalar.
module OAlg.Hom.Vectorial
-- | type family of homomorphisms between Vectorial structures
-- having the same associated 'Scalar.
--
-- Property Let h be a type instance of the class
-- HomVectorial k, then for all a,
-- b, v in h a b
-- and x in k holds: amap h (x
-- ! v) == x ! amap h v.
class (EmbeddableMorphism h (Vec k), HomAdditive h) => HomVectorial k h
instance OAlg.Hom.Vectorial.HomVectorial k h => OAlg.Hom.Vectorial.HomVectorial k (OAlg.Category.Path.Path h)
instance (OAlg.Structure.Vectorial.Definition.ForgetfulVec k s, OAlg.Structure.Definition.ForgetfulTyp (s k), Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable k) => OAlg.Hom.Vectorial.HomVectorial k (OAlg.Hom.Oriented.Definition.IdHom (s k))
-- | homomorphisms between Algebraic structures having the same
-- associated Scalar.
module OAlg.Hom.Algebraic
-- | type family of homomorphisms between Algebraic structures
-- having the same associated Scalar.
class (EmbeddableMorphism h (Alg k), HomDistributive h, HomVectorial k h) => HomAlgebraic k h
instance OAlg.Hom.Algebraic.HomAlgebraic k h => OAlg.Hom.Algebraic.HomAlgebraic k (OAlg.Category.Path.Path h)
instance (OAlg.Structure.Definition.TransformableOp (s k), OAlg.Structure.Algebraic.Definition.ForgetfulAlg k s, OAlg.Structure.Definition.ForgetfulTyp (s k), Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable k) => OAlg.Hom.Algebraic.HomAlgebraic k (OAlg.Hom.Oriented.Definition.IdHom (s k))
-- | homomorphisms between algebraic structures.
module OAlg.Hom
-- | defintion of free products over Oriented symbols with exponents
-- in a Number.
--
-- Note On Oriented structures the canonical injection
-- inj and projection prj are bijections between the
-- valid entities of Path and Product
-- N. This is not true betwenn Path and
-- ProductForm N as
--
--
-- >>> prj (P 3 :^ 2 :: ProductForm N Q) :: Path Q
-- Path () [3,3]
--
--
-- and
--
--
-- >>> prj (P 3 :* P 3 :: ProductForm N Q) :: Path Q
-- Path () [3,3]
--
--
-- both map to the same Path! But
--
--
-- >>> let p = make (P 3) :: Product N Q in p * p == p ^ 2
-- True
--
module OAlg.Entity.Product.Definition
-- | free product over Oriented symbols in a with
-- exponents in a Integral r.
--
-- Definition A Product p is valid if and
-- only if its underlying ProductForm pf is valid
-- and pf is reduced, i.e. pf == reduce pf.
data Product r a
-- | number of primary factors where where all simple factors are expanded
-- according to there exponent.
prLength :: Product N a -> N
-- | the n-th primary factor where all simple factors are expanded
-- according to there exponent.
prFactor :: Product N a -> N -> a
-- | the list of primary factors.
prFactors :: Product N a -> [a]
-- | restriction of prfwrd.
prwrd :: (Integral r, Oriented a) => Product r a -> Word r a
-- | mapping a product with exponents in N into a
-- Multiplicative structure applying a homomorphism between
-- Oriented structures.
nProduct :: (Hom Ort h, Multiplicative x) => h a x -> Product N a -> x
-- | mapping a product with exponents in Z into a Cayleyan
-- structure applying a homomorphism between Oriented structures.
zProduct :: (Hom Ort h, Cayleyan x) => h a x -> Product Z a -> x
-- | mapping a product.
prdMapTotal :: (Singleton (Point y), Oriented y, Integral r) => (x -> y) -> Product r x -> Product r y
-- | from Op symbols.
--
-- Property For every Oriented structure a
-- and Integral r the resulting map
-- prFromOp is a contravariant homomorphisms between
-- Multiplicative structures.
prFromOp :: Product r (Op a) -> Product r a
-- | list of symbols in a together with an exponent in
-- r.
newtype Word r a
Word :: [(a, r)] -> Word r a
-- | the underlying list of a's with their exponent.
fromWord :: Word r a -> [(a, r)]
-- | transforming a ProductForm to its corresponding Word.
prfwrd :: Integral r => ProductForm r a -> Word r a
-- | transforming a Word to it corresponding ProductForm.
--
-- Note the Point is needed for empty Words.
wrdprf :: Semiring r => Point a -> Word r a -> ProductForm r a
-- | reducing a Word by adding the exponents of consecutive equal
-- symbols and eliminating symbols with zero exponents.
wrdPrfGroup :: (Eq a, Semiring r) => Word r a -> Rdc (Word r a)
-- | factorization of a natural number to powers of primes. For 0
-- there will be thrown Undefined.
nFactorize :: N -> Word N N
-- | factorization of a natural number to powers of primes smaller then the
-- given bound. For 0 there will be thrown Undefined.
nFactorize' :: N -> N -> Word N N
-- | form for a free product over Oriented symbols in
-- a with exponents in r.
--
-- Definition Let r be a Number. A
-- ProductForm pf is valid if and only if
-- orientation pf is valid (see definition below)
-- and all its symbols x - where P x occurs in
-- pf - are valid.
--
-- The orientation of pf is defined according:
--
--
-- orientation pf = case pf of
-- One p -> one p
-- P a -> orientation a
-- f :^ r -> orientation f ^ r where (^) = power
-- f :* g -> orientation f * orientation g
--
--
-- Note Number is required for -1, 0 and
-- 1 are not degenerated as in Z/2 or Z/1.
data ProductForm r a
One :: Point a -> ProductForm r a
P :: a -> ProductForm r a
(:^) :: ProductForm r a -> r -> ProductForm r a
(:*) :: ProductForm r a -> ProductForm r a -> ProductForm r a
infixr 7 :*
infixl 9 :^
-- | length.
prfLength :: Number r => ProductForm r a -> N
-- | depth.
prfDepth :: ProductForm r a -> N
-- | list of elementary factors.
prfFactors :: ProductForm N a -> [a]
-- | mapping a product form with exponents in N into a
-- Multiplicative structure applying a homomorphism between
-- Oriented structures.
nProductForm :: (Hom Ort h, Multiplicative x) => h a x -> ProductForm N a -> x
-- | mapping a product form with exponents in Z into a
-- Cayleyan structure applying a homomorphism between
-- Oriented structures.
zProductForm :: (Hom Ort h, Cayleyan x) => h a x -> ProductForm Z a -> x
-- | formal inverse
--
-- Let p in ProductForm r a then:
--
-- Pre If p contains a factor P a then
-- minusOne /= Nothing.
--
-- Post the formal inverse.
prfInverse :: Number r => ProductForm r a -> ProductForm r a
-- | from Op symbols.
prfFromOp :: ProductForm r (Op a) -> ProductForm r a
-- | mapping a product form
prfMapTotal :: Singleton (Point y) => (x -> ProductForm r y) -> ProductForm r x -> ProductForm r y
-- | reducing a ProductForm according to prfReduceWith
-- return.
prfReduce :: (Oriented a, Integral r) => ProductForm r a -> ProductForm r a
-- | reduces a product form by the given reduction rules for words until no
-- more reductions are applicable.
prfReduceWith :: (Oriented a, Integral r) => (Word r a -> Rdc (Word r a)) -> ProductForm r a -> ProductForm r a
-- | applicative operation from the right.
prfopr :: (x -> t -> x) -> x -> ProductForm N t -> x
-- | partially strict version of prfopr, i.e. every n-th
-- application will be reduced to head normal form.
--
-- Let x' = prfopr' n op x p.
--
-- Pre 0 < n.
--
-- Post x' == prfopr op x p.
prfopr' :: N -> (x -> t -> x) -> x -> ProductForm N t -> x
-- | applicative operation from the left.
prfopl :: (t -> x -> x) -> ProductForm N t -> x -> x
-- | partially strict version of prfopl, i.e. every n-th
-- application will be reduced to head normal form.
--
-- Let x' = prfopl' n op p x.
--
-- Pre 0 < n.
--
-- Post x' == prfopl op p x.
prfopl' :: N -> (t -> x -> x) -> ProductForm N t -> x -> x
instance (OAlg.Data.Validable.Validable a, OAlg.Data.Validable.Validable r) => OAlg.Data.Validable.Validable (OAlg.Entity.Product.Definition.Word r a)
instance (GHC.Classes.Eq a, GHC.Classes.Eq r) => GHC.Classes.Eq (OAlg.Entity.Product.Definition.Word r a)
instance (GHC.Show.Show a, GHC.Show.Show r) => GHC.Show.Show (OAlg.Entity.Product.Definition.Word r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Oriented.Definition.OrdPoint a, GHC.Classes.Ord a, GHC.Classes.Ord r, OAlg.Entity.Definition.Entity r) => GHC.Classes.Ord (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Entity.Definition.Entity r) => GHC.Classes.Eq (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Entity.Definition.Entity r) => GHC.Show.Show (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Entity.Definition.Entity r) => GHC.Show.Show (OAlg.Entity.Product.Definition.ProductForm r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Entity.Definition.Entity r) => GHC.Classes.Eq (OAlg.Entity.Product.Definition.ProductForm r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Entity.Definition.Entity r, GHC.Classes.Ord a, OAlg.Structure.Oriented.Definition.OrdPoint a, GHC.Classes.Ord r) => GHC.Classes.Ord (OAlg.Entity.Product.Definition.ProductForm r a)
instance Data.Foldable.Foldable (OAlg.Entity.Product.Definition.Product OAlg.Data.Number.N)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Product.Definition.Product OAlg.Data.Number.N a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Data.Validable.Validable (OAlg.Entity.Product.Definition.Product r a)
instance OAlg.Data.Constructable.Exposable (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Data.Constructable.Constructable (OAlg.Entity.Product.Definition.Product r a)
instance OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Product.Definition.Product OAlg.Data.Number.N) OAlg.Data.Number.N a
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Data.Canonical.Embeddable a (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Data.Canonical.Embeddable (OAlg.Structure.Oriented.Definition.Path a) (OAlg.Entity.Product.Definition.Product r a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Canonical.Projectible (OAlg.Structure.Oriented.Definition.Path a) (OAlg.Entity.Product.Definition.Product OAlg.Data.Number.N a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Entity.Definition.Entity (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r, OAlg.Structure.Ring.Definition.Ring r) => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r, OAlg.Structure.Ring.Definition.Ring r) => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Product.Definition.Product r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Number r) => OAlg.Data.Validable.Validable (OAlg.Entity.Product.Definition.ProductForm r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Number r) => OAlg.Entity.Definition.Entity (OAlg.Entity.Product.Definition.ProductForm r a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Number r) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Product.Definition.ProductForm r a)
instance Data.Foldable.Foldable (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N)
instance OAlg.Data.Canonical.Embeddable (OAlg.Structure.Oriented.Definition.Path a) (OAlg.Entity.Product.Definition.ProductForm r a)
instance OAlg.Data.Canonical.Embeddable a (OAlg.Entity.Product.Definition.ProductForm r a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Canonical.Projectible (OAlg.Structure.Oriented.Definition.Path a) (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N a)
instance OAlg.Structure.Number.Definition.Integral r => OAlg.Data.Canonical.Embeddable (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N a) (OAlg.Entity.Product.Definition.ProductForm r a)
instance OAlg.Structure.Number.Definition.Integral r => OAlg.Data.Canonical.Projectible (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N a) (OAlg.Entity.Product.Definition.ProductForm r a)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N a)
instance OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N) OAlg.Data.Number.N x
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Number.Definition.Integral r) => OAlg.Data.Reducible.Reducible (OAlg.Entity.Product.Definition.ProductForm r a)
-- | propositions on free products over Oriented symbols with
-- exponents in a Number.
module OAlg.Entity.Product.Proposition
-- | validity of Product r (Orientation
-- Symbol) for r equal to N and
-- Z respectively
prpProduct :: Statement
-- | validity of Product N (Orientation
-- Symbol) being Oriented.
prpOrtProductNOrntSymbol :: Statement
-- | validity of Product Z (Orientation
-- Symbol) being Oriented.
prpOrtProductZOrntSymbol :: Statement
-- | validity of Product N (Orientation
-- Symbol) being Multiplicative.
prpMltProductNOrntSymbol :: Statement
-- | validity of Product Z (Orientation
-- Symbol) being Multiplicative.
prpMltProductZOrntSymbol :: Statement
-- | random variable of products generated from product forms with a
-- maximal given depth (:^ dose not increases the depth).
xStartProduct :: (Oriented a, Integral r) => XOrtSite From a -> X r -> N -> XOrtSite From (Product r a)
-- | random variable of product forms with maximal depth d
-- (a :^ constructor dose not increases the depth).
xStartProductForm :: (Oriented a, Number r) => XOrtSite From a -> X r -> N -> XOrtSite From (ProductForm r a)
-- | the induced random variable on Orientation
-- Symbol).
xPrdSymStart :: Integral r => N -> X r -> XOrtSite From (Product r (Orientation Symbol))
-- | the induced random variable for validating Multiplicative
-- structures.
xPrdSymMlt :: Integral r => N -> X r -> XMlt (Product r (Orientation Symbol))
-- | example of a XStart for the quiver having two points 'a' and
-- 'b' and two arrows 'a':>'a' and 'a':>'b'.
xT :: XOrtSite From (Orientation Char)
-- | its distribution
dstT :: Int -> N -> IO ()
-- | free products of symbols in x with index type
-- N.
module OAlg.Entity.Product.ProductSymbol
-- | free product of symbols in x with index type N.
--
-- Example
--
-- The expression sy 'a' constructs a free product of
-- exactly one symbol in Char consisting just of the character
-- 'a'.
--
--
-- >>> sy 'a'
-- ProductSymbol['a']
--
--
-- they are Total Multiplicative
--
--
-- >>> sy 'a' * sy 'b' * sy 'c'
-- ProductSymbol['a'*'b'*'c']
--
--
-- and admit a listing
--
--
-- >>> list (Proxy :: Proxy N) (sy 'a' * sy 'b' * sy 'c')
-- [('a',0),('b',1),('c',2)]
--
--
-- they have a compact representation for repetitions
--
--
-- >>> sy 'a' * sy 'b' * sy 'b' * sy 'a' * sy 'c'
-- ProductSymbol['a'*'b'^2*'a'*'c']
--
--
--
-- >>> sy 'a' * sy 'b' * sy 'b' * sy 'a' * sy 'c' == sy 'a' * sy 'b' ^ 2 * sy 'a' * sy 'c'
-- True
--
--
-- but they are not Commutative
--
--
-- >>> sy 'a' * sy 'b' ^ 2 * sy 'a' * sy 'c' == sy 'a' ^ 2 * sy 'b' ^ 2 * sy 'c'
-- False
--
--
-- and they admit a total right operation <* of
-- Permutation N
--
--
-- >>> (sy 'a' * sy 'b' ^ 2 * sy 'a' * sy 'c') <* (pmtSwap 1 3 :: Permutation N)
-- ProductSymbol['a'^2*'b'^2*'c']
--
--
-- Note
--
--
-- - Free products of symbols are finite complete sequences and allow a
-- compact representation for repetitions and serve merely as dimensions
-- for matrices (see OAlg.Entity.Matrix.Dim).
-- - Possibly infinite complete sequences are represented by
-- [x].
--
newtype ProductSymbol x
ProductSymbol :: Product N (U x) -> ProductSymbol x
-- | symbol of an entity, i.e. the complete sequence of psyLength
-- one consisting just of it.
--
-- Example
--
--
-- >>> sy 'a'
-- ProductSymbol['a']
--
--
--
-- >>> sy 'a' * sy 'b' * sy 'b' ^ 5 * sy 'c'
-- ProductSymbol['a'*'b'^6*'c']
--
sy :: Entity x => x -> ProductSymbol x
-- | showing as a product of symbols.
psyShow :: Entity x => ProductSymbol x -> String
-- | the indexed listing of the symbols.
psyxs :: ProductSymbol x -> [(x, N)]
-- | the underlying word.
psywrd :: Entity x => ProductSymbol x -> Word N x
-- | from word.
wrdpsy :: Entity x => Word N x -> ProductSymbol x
-- | proxy for N.
nProxy :: Proxy N
-- | joining complete sequences.
psyJoin :: Entity x => ProductSymbol (ProductSymbol x) -> ProductSymbol x
-- | the induced product of symbols.
productSymbol :: Entity x => [x] -> ProductSymbol x
-- | the length of a complete sequence.
psyLength :: ProductSymbol x -> N
-- | the symbol for the given index.
psyFactor :: ProductSymbol x -> N -> x
-- | mapping free products of symbols.
psyMap :: Entity y => (x -> y) -> ProductSymbol x -> ProductSymbol y
-- | adjoins the point () to an entity.
--
-- Note Serves to build sums or products over symbols in
-- x.
newtype U x
U :: x -> U x
-- | deconstructor.
fromU :: U x -> x
-- | random variable of complete sequences with the given maximal length.
xProductSymbol :: Entity x => N -> X x -> X (ProductSymbol x)
instance Data.Foldable.Foldable OAlg.Entity.Product.ProductSymbol.U
instance OAlg.Data.Validable.Validable x => OAlg.Data.Validable.Validable (OAlg.Entity.Product.ProductSymbol.U x)
instance GHC.Base.Functor OAlg.Entity.Product.ProductSymbol.U
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Entity.Product.ProductSymbol.U x)
instance GHC.Classes.Ord x => GHC.Classes.Ord (OAlg.Entity.Product.ProductSymbol.U x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (OAlg.Entity.Product.ProductSymbol.U x)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance Data.Foldable.Foldable OAlg.Entity.Product.ProductSymbol.ProductSymbol
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => OAlg.Entity.Definition.Entity (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => OAlg.Data.Validable.Validable (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance (OAlg.Entity.Definition.Entity x, GHC.Classes.Ord x) => GHC.Classes.Ord (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => GHC.Classes.Eq (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => GHC.Show.Show (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Data.Constructable.Exposable (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Definition.Entity x => OAlg.Data.Constructable.Constructable (OAlg.Entity.Product.ProductSymbol.ProductSymbol x)
instance OAlg.Entity.Sequence.Definition.Sequence OAlg.Entity.Product.ProductSymbol.ProductSymbol OAlg.Data.Number.N x
instance OAlg.Entity.Definition.Entity x => OAlg.Entity.Sequence.Definition.ConstructableSequence OAlg.Entity.Product.ProductSymbol.ProductSymbol OAlg.Data.Number.N x
instance OAlg.Entity.Definition.Entity x => OAlg.Entity.Definition.Entity (OAlg.Entity.Product.ProductSymbol.U x)
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Product.ProductSymbol.U x)
instance OAlg.Structure.Oriented.Definition.OrdPoint (OAlg.Entity.Product.ProductSymbol.U x)
-- | completely defined sequences of items in x with index
-- type N.
module OAlg.Entity.Sequence.CSequence
-- | completely defined sequences of items, i.e. free products with index
-- type N.
type CSequence = ProductSymbol
-- | random variable for comletely defined sequences with the given maximal
-- length.
xCSequence :: Entity x => N -> X x -> X (CSequence x)
-- | free products on Oriented symbols with exponents in a
-- Number.
module OAlg.Entity.Product
-- | permutations on totally ordered index types i to
-- permute the items of sequences.
module OAlg.Entity.Sequence.Permutation
-- | permutation of a totally ordered index type i which
-- yield a bijection pmt on i. They are
-- constructed using
--
--
--
-- In the following the total right operation <* of a
-- permutation on several types of sequences will be defined to achieve
-- the permutation of there items.
--
-- Definitions
--
--
--
-- Note The given definitions are not very efficient and only
-- terminate for finite sequences (in fact, a more efficient
-- implementation has been chosen that also terminates for infinite
-- sequences (see example below)). However, they serve on the one hand to
-- define the semantic and to 'prove' the properties for TotalOpr
-- and on the other hand to verify the chosen implementation for finite
-- sequences (see prpOprPermutation).
--
-- Examples
--
--
-- >>> "abcdef" <* (swap 2 5 :: Permutation N)
-- "abfdec"
--
--
-- the support of a sequence and the relevant image of a permutation may
-- be disjoint which will leave the sequence untouched
--
--
-- >>> "abcdef" <* (swap 7 10 :: Permutation N)
-- "abcdef"
--
--
-- the intersection of the support of a sequence with the relevant image
-- of a permutation may be a non empty proper sub set
--
--
-- >>> "abcdef" <* swap 2 10 :: Permutation N)
-- "abdefc"
--
--
-- the result can be interpreted as: first, put c at position
-- 10 and Nothing (which is the item at position
-- 10) at position 2. Second, strip all nothings form
-- it.
--
-- Although the given definition of the permutation of sequences dose not
-- terminate for infinite sequences, its implementation will terminate
--
--
-- >>> takeN 5 $ (([0..] :: [N]) <* (swap 1 2 :: Permutation N)
-- [0,2,1,3,4]
--
data Permutation i
-- | the bijection on i for a given permutation and is
-- defined via restrict pmf.
pmt :: Ord i => Permutation i -> i -> i
-- | swapping.
--
-- Property Let p = swap n (i,j), then holds: If
-- i,j < n then p is the permutation given by
-- swapping i with j, otherwise a exception will be
-- thrown.
swap :: (Entity i, Ord i) => i -> i -> Permutation i
-- | total right operations of permutations on sequences, admitting the
-- following properties:
--
-- Property Let s, i,
-- x be an instance of PermutableSequence
-- s i x, then holds:
--
--
-- - Let xs be in s x, p in
-- Permutation i with image z p
-- <<= support z xs for some z in
-- z i, then holds: (xs <* p)
-- ?? i == ((xs ??) . pmt p) i
-- for all i in support z xs.
-- - Let xs be in s x, w in
-- x -> w, c in w ->
-- w -> Ordering and z in z
-- i, then holds: Let (xs',p) = permuteBy z c w
-- xs in
- xs' == xs <*
-- p.
- xs' is ordered according to c by
-- applying w to its items.
- image z p
-- <<= support z xs.
--
--
-- Examples
--
--
-- >>> fst $ permuteBy nProxy compare isUpper "abCd1eFgH"
-- "abd1egCFH"
--
--
-- as False < True
--
--
-- >>> fst $ permuteBy nProxy (coCompare compare) isUpper "abCd1eFgH"
-- "CFHabd1eg"
--
--
-- which orders it in the reverse ordering.
class (Sequence s i x, TotalOpr (Permutation i) (s x)) => PermutableSequence s i x
-- | a resulting permuation.
permuteBy :: PermutableSequence s i x => p i -> (w -> w -> Ordering) -> (x -> w) -> s x -> (s x, Permutation i)
-- | orders the permutable sequence according to the given ordering an
-- delivers the resulting permutation form.
permuteByN :: PermutableSequence s N x => (w -> w -> Ordering) -> (x -> w) -> s x -> (s x, Permutation N)
-- | form of a permutation from i to i
-- which is given by pmf.
--
-- Property Let p = PermutationForm jis be in
-- PermutationForm i, then holds:
-- support z p == image z p for some proxy
-- z in z i.
--
-- The partial sequence ijs is called the relevant
-- part of p.
newtype PermutationForm i
PermutationForm :: PSequence i i -> PermutationForm i
-- | the associated function i to i and is
-- given by:
--
-- Definition Let p = PermutationForm jis be in
-- PermutationForm i then pmf p i
-- is defined by: If there exists an (j,i') in psqxs
-- jis with i' == i then pmf p i = j
-- else pmf p i = i.
--
-- Note
--
--
-- - If the partial sequence ijs is valid, then for all
-- i in i there exists at most one
-- (_,i') in psqxs jis such that i'
-- == i. As such, the function pmf p is well
-- defined.
-- - If the permutation form p itself is valid than
-- pmf p is a bijection and as such a permutation of
-- i.
-- - The behavior of pmf differs from ?? as its
-- evaluation will not end up in a
-- IndexOutOfSupport-exception.
--
pmf :: Ord i => PermutationForm i -> i -> i
-- | random variable of permutations.
xPermutation :: (Entity i, Ord i) => N -> X i -> X (Permutation i)
-- | random variable of permutations within the given bounds.
xPermutationB :: (Ord i, Enum i) => i -> i -> X (Permutation i)
-- | random variable of permutations of the index set [0..prd n].
xPermutationN :: N -> X (Permutation N)
-- | random variable for validating the Multiplicative structure.
xMltPermutation :: (Entity i, Ord i) => N -> X i -> XMlt (Permutation i)
-- | validity of the functionality of the module Permutation.
prpPermutation :: Statement
-- | validity for PermutableSequence.
prpPermutableSequence :: (PermutableSequence s i x, Entity x, Entity i, Show w) => N -> z i -> (w -> w -> Ordering) -> (x -> w) -> X (s x) -> Statement
-- | validity of the total right operation <* of permutations on
-- sequences.
prpOprPermutation :: Statement
instance OAlg.Data.Number.LengthN (OAlg.Entity.Sequence.Permutation.PermutationForm i)
instance GHC.Classes.Eq i => GHC.Classes.Eq (OAlg.Entity.Sequence.Permutation.PermutationForm i)
instance GHC.Show.Show i => GHC.Show.Show (OAlg.Entity.Sequence.Permutation.PermutationForm i)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Data.Validable.Validable (OAlg.Entity.Sequence.Permutation.Permutation i)
instance GHC.Classes.Eq i => GHC.Classes.Eq (OAlg.Entity.Sequence.Permutation.Permutation i)
instance GHC.Show.Show i => GHC.Show.Show (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Sequence.Permutation.PermutableSequence (OAlg.Entity.Sequence.PSequence.PSequence i) i x
instance OAlg.Entity.Definition.Entity x => OAlg.Entity.Sequence.Permutation.PermutableSequence [] OAlg.Data.Number.N x
instance OAlg.Entity.Definition.Entity x => OAlg.Entity.Sequence.Permutation.PermutableSequence OAlg.Entity.Sequence.CSequence.CSequence OAlg.Data.Number.N x
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Sequence.Permutation.PermutableSequence OAlg.Entity.Sequence.Permutation.Permutation i i
instance OAlg.Data.Constructable.Exposable (OAlg.Entity.Sequence.Permutation.Permutation i)
instance GHC.Classes.Eq i => OAlg.Data.Constructable.Constructable (OAlg.Entity.Sequence.Permutation.Permutation i)
instance GHC.Classes.Ord i => OAlg.Entity.Sequence.Definition.Sequence OAlg.Entity.Sequence.Permutation.Permutation i i
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Sequence.Permutation.Permutation i)
instance OAlg.Structure.Oriented.Definition.Total (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Sequence.Permutation.Permutation i)
instance GHC.Classes.Ord i => OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation i) (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i, OAlg.Entity.Definition.Entity x) => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation i) (OAlg.Entity.Sequence.PSequence.PSequence i x)
instance OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation OAlg.Data.Number.N) [x]
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation OAlg.Data.Number.N) [x]
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation OAlg.Data.Number.N) (OAlg.Entity.Sequence.CSequence.CSequence x)
instance OAlg.Entity.Definition.Entity x => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation OAlg.Data.Number.N) (OAlg.Entity.Sequence.CSequence.CSequence x)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation i) (OAlg.Entity.Sequence.Permutation.Permutation i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation i) (OAlg.Entity.Sequence.Permutation.Permutation i)
instance GHC.Classes.Ord i => OAlg.Entity.Sequence.Definition.Sequence OAlg.Entity.Sequence.Permutation.PermutationForm i i
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Data.Validable.Validable (OAlg.Entity.Sequence.Permutation.PermutationForm i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sequence.Permutation.PermutationForm i)
instance (OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Sequence.Permutation.PermutationForm i)
instance GHC.Classes.Eq i => OAlg.Data.Reducible.Reducible (OAlg.Entity.Sequence.Permutation.PermutationForm i)
-- | Sequences of indexed items in a type x with an index
-- type i and there permutations. We consider two kinds
-- of sequences:
--
--
-- - Complete Sequences x 0,x 1,x 2,.. with an integral
-- index type i where there indices don't have
-- wholes and start at 0, e.g. [x] or
-- free products of symbols in x i.e.
-- ProductSymbol.
-- - Partial Sequences x i0,x i1,x i2,.. with a totally
-- ordered index type i where there indices allow
-- wholes, e.g. PSequence, Set, Graph.
--
--
-- Furthermore there are total right operations of Permutation
-- defined on them which permutes the corresponding indices to yield a
-- new sequence.
module OAlg.Entity.Sequence
-- | entries of matrices and viewing them as a column of rows respectively
-- as a row of columns.
module OAlg.Entity.Matrix.Entries
-- | two dimensional partial sequence.
newtype Entries i j x
Entries :: PSequence (i, j) x -> Entries i j x
-- | underlying list of indexed entries.
etsxs :: Entries i j x -> [(x, i, j)]
-- | the empty sequence of entries.
etsEmpty :: Entries i j x
-- | adding two entries.
--
-- Property Let zs = etsAdd xs ys, then holds:
--
--
-- - Pre For all (i,j) in (i,j)
-- where there exists an (x,i,j) in xs and a
-- (y,i,j) in ys holds: root x ==
-- root y.
-- - Post
--
--
--
-- - zs is valid.
-- - For all (i,j) in (i,j)
-- holds:
- If exists a (x,i,j) in xs but not
-- exists a (y,i,j) in ys then there exists a
-- (z,i,j) in zs with z ==
-- x.
- If exists a (y,i,j) in ys but not
-- exists a (x,i,j) in xs then there exists a
-- (z,i,j) in zs with z ==
-- y.
- If exists a (x,i,j) in xs and
-- (y,i,j) in ys then there exists a (z,i,j)
-- in zs with z == x + y.
--
etsAdd :: (Additive x, Ord i, Ord j) => Entries i j x -> Entries i j x -> Entries i j x
-- | multiplication.
etsMlt :: (Distributive x, Ord k) => Col i (Row k x) -> Row j (Col k x) -> Col i (Row j x)
-- | joining entries of entries.
--
-- Property Let xs' = etsJoin r c xs
--
--
-- - Pre For all (xij,i,j) in xs
-- holds:
- i < lengthN r and j
-- < lengthN c
- For all (_,i',j')
-- in xij holds: i' < ri and j'
-- < cj where ..ri.. = r, ..cj.. =
-- c.
-- - Post xs' is valid.
--
etsJoin :: (i ~ N, j ~ N) => ProductSymbol i -> ProductSymbol j -> Entries i j (Entries i j x) -> Entries i j x
-- | the underlying column of rows.
etscr :: Eq i => Entries i j x -> Col i (Row j x)
-- | the underlying row of columns.
etsrc :: (Ord i, Ord j) => Entries i j x -> Row j (Col i x)
-- | the entries given by a column of rows.
crets :: Col i (Row j x) -> Entries i j x
-- | the entries given by a row of columns.
rcets :: (Ord i, Ord j) => Row j (Col i x) -> Entries i j x
-- | elimination of zeros.
etsElimZeros :: Additive x => Entries i j x -> Entries i j x
-- | viewing a partial sequence as a row.
newtype Row j x
Row :: PSequence j x -> Row j x
-- | underlying list of indexed entries.
rowxs :: Row j x -> [(x, j)]
-- | the empty row.
rowEmpty :: Row j x
-- | check for being empty.
rowIsEmpty :: Row j x -> Bool
-- | head.
rowHead :: Row j x -> (x, j)
-- | tail.
rowTail :: Row j x -> Row j x
-- | filtering a row by the given predicate.
rowFilter :: (x -> Bool) -> Row j x -> Row j x
-- | mapping and shifting of a row.
rowMapShift :: Number j => j -> ((x, j) -> y) -> Row j x -> Row j y
-- | appending a row.
--
-- Property Let zs = rowAppend xs ys where
-- ..(x,l) = xs and (y,f).. = ys then holds:
--
--
-- - If l < f
-- - Then zs is valid.
--
rowAppend :: Row j x -> Row j x -> Row j x
-- | interlacing two rows.
rowInterlace :: Ord j => (x -> y -> z) -> (x -> z) -> (y -> z) -> Row j x -> Row j y -> Row j z
-- | elimination of zeros.
rowElimZeros :: Additive a => Row i a -> Row i a
-- | swapping two entries of a row.
--
-- Pre k < l.
rowSwap :: Ord j => j -> j -> Row j x -> Row j x
-- | adding two rows.
rowAdd :: (Additive a, Ord j) => Row j a -> Row j a -> Row j a
-- | multiplies each element of the row by the given factor from the left.
rowMltl :: Distributive a => a -> Row j a -> Row j a
-- | shears two entries of a row.
--
-- Property Let r' = rowShear (<*) (+) k l s t u v
-- r, then holds:
--
--
--
-- Note rowShear is like multiplying the given row
-- from the right with the matrix given by k l s t u v.
rowShear :: Ord j => (Maybe x -> s -> Maybe x) -> (Maybe x -> Maybe x -> Maybe x) -> j -> j -> s -> s -> s -> s -> Row j x -> Row j x
-- | scales the entry at the given position by the given factor.
rowScale :: Ord j => (x -> s -> Maybe x) -> j -> s -> Row j x -> Row j x
-- | viewing a partial sequence as a column.
newtype Col i x
Col :: PSequence i x -> Col i x
-- | underlying list of indexed entries.
colxs :: Col i x -> [(x, i)]
-- | the empty column.
colEmpty :: Col i x
-- | check for being empty.
colIsEmpty :: Col i x -> Bool
-- | head.
colHead :: Col i x -> (x, i)
-- | tail.
colTail :: Col i x -> Col i x
-- | filtering a column by the given predicate.
colFilter :: (x -> Bool) -> Col i x -> Col i x
-- | mapping and shifting of a column.
colMapShift :: Number i => i -> ((x, i) -> y) -> Col i x -> Col i y
-- | appending a column..
--
-- Property Let zs = colAppend xs ys where
-- ..(x,l) = xs and (y,f).. = ys then holds:
--
--
-- - If l < f
-- - Then zs is valid.
--
colAppend :: Col i x -> Col i x -> Col i x
-- | interlacing two columns.
colInterlace :: Ord i => (x -> y -> z) -> (x -> z) -> (y -> z) -> Col i x -> Col i y -> Col i z
-- | elimination of zeros.
colElimZeros :: Additive a => Col i a -> Col i a
-- | swapping two entries of a column.
--
-- Pre k < l.
colSwap :: Ord i => i -> i -> Col i x -> Col i x
-- | adding two columns.
colAdd :: (Additive a, Ord i) => Col i a -> Col i a -> Col i a
-- | multiplies each element of the column by the given factor from the
-- right.
colMltr :: Distributive a => Col i a -> a -> Col i a
-- | shears two entries of a column.
--
-- Property Let c' = colShear (<*) (+) k l s t u v
-- c, then holds:
--
--
--
-- Note colShear is like multiplying the given
-- column from the left with the matrix given by k l s t u v.
colShear :: Ord i => (s -> Maybe x -> Maybe x) -> (Maybe x -> Maybe x -> Maybe x) -> i -> i -> s -> s -> s -> s -> Col i x -> Col i x
-- | scales the entry at the given position by the given factor.
colScale :: Ord i => (s -> x -> Maybe x) -> i -> s -> Col i x -> Col i x
-- | get the head column at j.
--
-- Pre for all j' in rws holds: j
-- <= j'.
crHeadColAt :: Eq j => j -> Col i (Row j a) -> Col i a
-- | get the head row at i.
--
-- Pre for all i' in rws holdst: i
-- <= i'.
crHeadRowAt :: Eq i => i -> Col i (Row j a) -> Row j a
-- | to the dual of Entries, with inverse coEntriesInv.
coEntries :: (Ord i, Ord j) => Entries i j x -> Dual (Entries i j x)
-- | from the dual of Entries, with inverse coEntries.
coEntriesInv :: (Ord i, Ord j) => Dual (Entries i j x) -> Entries i j x
instance OAlg.Data.Number.LengthN (OAlg.Entity.Matrix.Entries.Row j x)
instance GHC.Base.Functor (OAlg.Entity.Matrix.Entries.Row j)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity j, GHC.Classes.Ord j) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Entries.Row j x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity j, GHC.Classes.Ord j) => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Entries.Row j x)
instance (GHC.Classes.Eq x, GHC.Classes.Eq j) => GHC.Classes.Eq (OAlg.Entity.Matrix.Entries.Row j x)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Matrix.Entries.Col i x)
instance GHC.Base.Functor (OAlg.Entity.Matrix.Entries.Col i)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Entries.Col i x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Entries.Col i x)
instance (GHC.Classes.Eq x, GHC.Classes.Eq i) => GHC.Classes.Eq (OAlg.Entity.Matrix.Entries.Col i x)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Matrix.Entries.Entries i j x)
instance GHC.Base.Functor (OAlg.Entity.Matrix.Entries.Entries i j)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, OAlg.Entity.Definition.Entity j, GHC.Classes.Ord i, GHC.Classes.Ord j) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Entries.Entries i j x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, OAlg.Entity.Definition.Entity j, GHC.Classes.Ord i, GHC.Classes.Ord j) => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Entries.Entries i j x)
instance (GHC.Classes.Ord x, GHC.Classes.Ord i, GHC.Classes.Ord j) => GHC.Classes.Ord (OAlg.Entity.Matrix.Entries.Entries i j x)
instance (GHC.Classes.Eq x, GHC.Classes.Eq i, GHC.Classes.Eq j) => GHC.Classes.Eq (OAlg.Entity.Matrix.Entries.Entries i j x)
instance (GHC.Show.Show x, GHC.Show.Show i, GHC.Show.Show j) => GHC.Show.Show (OAlg.Entity.Matrix.Entries.Entries i j x)
instance (OAlg.Data.Dualisable.Transposable x, GHC.Classes.Ord n) => OAlg.Data.Dualisable.Transposable (OAlg.Entity.Matrix.Entries.Entries n n x)
instance (GHC.Show.Show x, GHC.Show.Show i) => GHC.Show.Show (OAlg.Entity.Matrix.Entries.Col i x)
instance GHC.Classes.Ord i => OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Matrix.Entries.Col i) i x
instance GHC.Classes.Ord i => OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation i) (OAlg.Entity.Matrix.Entries.Col i x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation i) (OAlg.Entity.Matrix.Entries.Col i x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity i, GHC.Classes.Ord i) => OAlg.Entity.Sequence.Permutation.PermutableSequence (OAlg.Entity.Matrix.Entries.Col i) i x
instance (GHC.Show.Show x, GHC.Show.Show j) => GHC.Show.Show (OAlg.Entity.Matrix.Entries.Row j x)
instance GHC.Classes.Ord j => OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Matrix.Entries.Row j) j x
instance GHC.Classes.Ord j => OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation j) (OAlg.Entity.Matrix.Entries.Row j x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity j, GHC.Classes.Ord j) => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation j) (OAlg.Entity.Matrix.Entries.Row j x)
instance (OAlg.Entity.Definition.Entity x, OAlg.Entity.Definition.Entity j, GHC.Classes.Ord j) => OAlg.Entity.Sequence.Permutation.PermutableSequence (OAlg.Entity.Matrix.Entries.Row j) j x
-- | dimension for matrices of x as a complete sequence of
-- Point x.
module OAlg.Entity.Matrix.Dim
-- | dimension of x as a complete sequence of
-- Point x.
data Dim x p
[Dim] :: CSequence (Point x) -> Dim x (Point x)
-- | abbreviation for Dim x (Point x).
type Dim' x = Dim x (Point x)
-- | the underlying product.
fromDim :: Dim x p -> ProductSymbol p
-- | constructing a dimension form a point.
dim :: (Entity p, p ~ Point x) => p -> Dim x p
-- | constructing a dimension from a list of points.
productDim :: (Entity p, p ~ Point x) => [p] -> Dim x p
-- | the indexed listing of the points.
dimxs :: p ~ Point x => Dim x p -> [(p, N)]
-- | the underlying word.
dimwrd :: (Entity p, p ~ Point x) => Dim x p -> Word N p
-- | mapping a dimension.
dimMap :: (Entity q, q ~ Point y) => (p -> q) -> Dim x p -> Dim y q
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Classes.Eq (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, OAlg.Structure.Oriented.Definition.OrdPoint x) => GHC.Classes.Ord (OAlg.Entity.Matrix.Dim.Dim x p)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Matrix.Dim.Dim x p)
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Show.Show (OAlg.Entity.Matrix.Dim.Dim x p)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, Data.Typeable.Internal.Typeable p) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Dim.Dim x p)
instance OAlg.Entity.Sequence.Definition.Sequence (OAlg.Entity.Matrix.Dim.Dim x) OAlg.Data.Number.N p
instance OAlg.Entity.Definition.Entity p => OAlg.Structure.Operational.Opr (OAlg.Entity.Sequence.Permutation.Permutation OAlg.Data.Number.N) (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, OAlg.Entity.Definition.Entity p) => OAlg.Structure.Operational.TotalOpr (OAlg.Entity.Sequence.Permutation.Permutation OAlg.Data.Number.N) (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, OAlg.Entity.Definition.Entity p) => OAlg.Entity.Sequence.Permutation.PermutableSequence (OAlg.Entity.Matrix.Dim.Dim x) OAlg.Data.Number.N p
instance (OAlg.Structure.Oriented.Definition.Oriented x, Data.Typeable.Internal.Typeable p) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, Data.Typeable.Internal.Typeable p, p GHC.Types.~ OAlg.Structure.Oriented.Definition.Point x) => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Matrix.Dim.Dim x p)
instance OAlg.Structure.Oriented.Definition.Total (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, Data.Typeable.Internal.Typeable p, p GHC.Types.~ OAlg.Structure.Oriented.Definition.Point x) => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Matrix.Dim.Dim x p)
instance (OAlg.Structure.Oriented.Definition.Oriented x, () GHC.Types.~ OAlg.Structure.Oriented.Definition.Point x) => OAlg.Data.Validable.XStandard (OAlg.Entity.Matrix.Dim.Dim x ())
-- | definition of adjunctions between Multiplicative structures. We
-- relay on the terms and notation as used in nLab
module OAlg.Adjunction.Definition
-- | adjunction between two multiplicative structures d and
-- c according two given multiplicative homomorphisms
-- l :: h c d and r :: h
-- d c.
--
--
-- l
-- <-------
-- d c
-- -------->
-- r
--
--
-- Property Let Adjunction l r u v be in
-- Adjunction h d c where
-- h is a Mlt-homomorphism, then holds:
--
--
-- - Naturality of the right unit u:
- For all x
-- in Point c holds: orientation (u x)
-- == x :> pmap r (pmap l
-- x).
- For all f in c holds: u
-- (end f) * f == amap r (amap l) f
-- * u (start f).
-- - Naturality of the left unit v:
- For all y
-- in Point d holds: orientation (v y)
-- == pmap l (pmap r y) :>
-- y.
- For all g in d holds: g
-- * v (start g) == v (end g) *
-- amap l (amap r) g.
-- - Triangle identities:
- For all x in Point
-- c holds: one (pmap l x) == v
-- (pmap l x) * amap l (u x).
- For all
-- y in Point d holds: one
-- (pmap r y) == amap r (v y) * u (pmap r
-- y).
--
--
-- The following diagrams illustrate the above equations
--
-- naturality of the right unit u (Equations 1.1 and 1.2):
--
--
-- u a
-- a -------> pmap r (pmap l a)
-- | |
-- f | | amap r (amap l f)
-- v v
-- b -------> pmap r (pmap l b)
-- u b
--
--
-- naturality of the left unit v (Equations 2.1 and 2.2):
--
--
-- v a
-- a <------- pmap l (pmap r a)
-- | |
-- g | | amap l (ampa r g)
-- v v
-- b <------ pmap l (pmap r b)
-- v b
--
--
-- the left adjoint of the right unit u is one (Equation
-- 3.1, see adjl):
--
--
-- pmap l x x
-- / | |
-- / | |
-- / | |
-- amap l (u x) / | one ~ u x |
-- / | |
-- / | |
-- v v v
-- pmap l (pmap r (pmap l x)) ---> pmap l x pmap r (pmap l x)
-- v (pmap l x)
--
--
-- the right adjoint of the left unit v is one (Equation
-- 3.2, see adjr):
--
--
-- u (pmap r y)
-- pmap l (pmap r y) pmap r y ---> pmap r (pmap l (pmap r y))
-- | | /
-- | | /
-- | v y ~ one | / amap r (v y)
-- | | /
-- | | /
-- v v v
-- y pmap r y
--
data Adjunction h d c
[Adjunction] :: h c d -> h d c -> (Point c -> c) -> (Point d -> d) -> Adjunction h d c
-- | the unit on the right side.
unitr :: Adjunction h d c -> Point c -> c
-- | the unit on the left side.
unitl :: Adjunction h d c -> Point d -> d
-- | the left adjoint f' of a factor f in
-- c.
--
-- Property Let y be in d and f
-- in c with end f == pmap r
-- y then the left adjoint f' of f is given by
-- f' = v y * amap l f.
--
--
-- pmap l x x
-- / | |
-- / | |
-- / | |
-- amap l f / | f' ~ f |
-- / | |
-- / | |
-- v v v
-- pmap l (pmap r y) -----> y pmap r y
-- v y
--
adjl :: Hom Mlt h => Adjunction h d c -> Point d -> c -> d
-- | the right adjoint g' of a factor in g in
-- d
--
-- Property Let x be in c and g
-- in d with start g == pmap l
-- x then the right adjoint g' of g is given by
-- g' = amap r g * u x.
--
--
-- u x
-- pmap l x x -----> pmap r (pmap l x)
-- | | /
-- | | /
-- | | /
-- | g ~ g' | / amap r g
-- | | /
-- | | /
-- v v v
-- y pmap r y
--
adjr :: Hom Mlt h => Adjunction h d c -> Point c -> d -> c
-- | attest of being Multiplicative homomorphous.
adjHomMlt :: Hom Mlt h => Adjunction h d c -> Homomorphous Mlt d c
-- | the dual adjunction.
coAdjunction :: Hom Mlt h => Adjunction h d c -> Dual (Adjunction h d c)
-- | validity of an adjunction according to the properties of
-- Adjunction.
prpAdjunction :: Hom Mlt h => Adjunction h d c -> X (Point d) -> X d -> X (Point c) -> X c -> Statement
-- | validity of the unit on the right side.
prpAdjunctionRight :: Hom Mlt h => Adjunction h d c -> Point c -> c -> Statement
-- | validity of the unit on the left side.
prpAdjunctionLeft :: Hom Mlt h => Adjunction h d c -> Point d -> d -> Statement
instance (OAlg.Hom.Multiplicative.Definition.HomMultiplicative h, OAlg.Structure.Oriented.Definition.XStandardPoint d, OAlg.Data.Validable.XStandard d, OAlg.Structure.Oriented.Definition.XStandardPoint c, OAlg.Data.Validable.XStandard c) => OAlg.Data.Validable.Validable (OAlg.Adjunction.Definition.Adjunction h d c)
-- | definition of free Sums over Fibred symbols.
module OAlg.Entity.Sum.Definition
-- | free sum over Fibred symbols in a with scalars
-- in r.
--
-- Definition A Sum s is valid if and only
-- if its underlying SumForm s' is valid and
-- s' is reduced, i.e. s' == reduce s'.
data Sum r a
-- | the associated linear combination.
--
-- Note The associated linear combination of a sum is sorted
-- according to the second component!
smlc :: Semiring r => Sum r a -> LinearCombination r a
-- | joining a sum of sums.
smJoin :: (Semiring r, Commutative r, Fibred a, Ord a) => Sum r (Sum r a) -> Sum r a
-- | additive homomorphism for sums over N.
nSum :: (Hom Fbr h, Additive x) => h a x -> Sum N a -> x
-- | additive homomorphism for sums over Z.
zSum :: (Hom Fbr h, Abelian x) => h a x -> Sum Z a -> x
-- | additive homomorphism to a totally defined sum.
smMap :: (Singleton (Root y), Fibred y, Ord y, Semiring r, Commutative r) => (x -> y) -> Sum r x -> Sum r y
-- | form for a free sum over Fibred symbols in a
-- with scalars in r.
--
-- Definition Let r be a Commutative
-- Semiring and a a Fibred structure. A
-- SumForm a is valid if and only if all scalars
-- in a are valid and all symbols in a
-- are valid and have the same root.
data SumForm r a
Zero :: Root a -> SumForm r a
S :: a -> SumForm r a
(:!) :: r -> SumForm r a -> SumForm r a
(:+) :: SumForm r a -> SumForm r a -> SumForm r a
infixr 6 :+
infixr 9 :!
-- | the length of a sum form,
smfLength :: Number r => SumForm r a -> N
-- | transforming a sum form to its corresponding linear combination..
smflc :: Semiring r => SumForm r a -> LinearCombination r a
-- | transforming a word to its corresponding sum form.
lcsmf :: Semiring r => Root a -> LinearCombination r a -> SumForm r a
-- | mapping of sum forms.
smfMap :: Singleton (Root y) => (x -> y) -> SumForm r x -> SumForm r y
-- | joining a sum form of sum forms.
smfJoin :: SumForm r (SumForm r a) -> SumForm r a
-- | reducing a sum form to its canonical form,
smfReduce :: (Fibred a, Ord a, Semiring r, Commutative r) => SumForm r a -> SumForm r a
-- | list of symbols in a together with a scalar in
-- r.
--
-- Note valid linear combinations must not be sorted
-- according to the second component!
newtype LinearCombination r a
LinearCombination :: [(r, a)] -> LinearCombination r a
-- | the underlying list of symbols with their scalar.
lcs :: LinearCombination r a -> [(r, a)]
-- | aggregating linear combinations with same symbols.
lcAggr :: (Eq a, Semiring r) => LinearCombination r a -> LinearCombination r a
-- | sorting a linear combination according to its symbols.
lcSort :: Ord a => LinearCombination r a -> LinearCombination r a
-- | filtering a word according to the scalars.
lcSclFilter :: (r -> Bool) -> LinearCombination r a -> LinearCombination r a
instance (OAlg.Data.Validable.Validable r, OAlg.Data.Validable.Validable a) => OAlg.Data.Validable.Validable (OAlg.Entity.Sum.Definition.LinearCombination r a)
instance (GHC.Classes.Eq r, GHC.Classes.Eq a) => GHC.Classes.Eq (OAlg.Entity.Sum.Definition.LinearCombination r a)
instance (GHC.Show.Show r, GHC.Show.Show a) => GHC.Show.Show (OAlg.Entity.Sum.Definition.LinearCombination r a)
instance (OAlg.Structure.Distributive.Definition.Distributive r, OAlg.Structure.Oriented.Definition.Total r, OAlg.Structure.Multiplicative.Definition.Commutative r, OAlg.Structure.Fibred.Definition.Fibred a) => OAlg.Data.Validable.Validable (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Structure.Fibred.Definition.OrdRoot a, GHC.Classes.Ord r, GHC.Classes.Ord a, OAlg.Entity.Definition.Entity r) => GHC.Classes.Ord (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Entity.Definition.Entity r) => GHC.Classes.Eq (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Entity.Definition.Entity r) => GHC.Show.Show (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Entity.Definition.Entity r) => GHC.Show.Show (OAlg.Entity.Sum.Definition.SumForm r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Entity.Definition.Entity r) => GHC.Classes.Eq (OAlg.Entity.Sum.Definition.SumForm r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Entity.Definition.Entity r, OAlg.Structure.Fibred.Definition.OrdRoot a, GHC.Classes.Ord r, GHC.Classes.Ord a) => GHC.Classes.Ord (OAlg.Entity.Sum.Definition.SumForm r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sum.Definition.Sum r a)
instance OAlg.Data.Constructable.Exposable (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, GHC.Classes.Ord a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Data.Constructable.Constructable (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, GHC.Classes.Ord a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Additive.Definition.Additive (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, GHC.Classes.Ord a, OAlg.Structure.Ring.Definition.Ring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Additive.Definition.Abelian (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, GHC.Classes.Ord a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Entity.Sum.Definition.Sum r a)
instance (OAlg.Entity.Definition.Entity a, OAlg.Entity.Definition.Entity r) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sum.Definition.LinearCombination r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Data.Validable.Validable (OAlg.Entity.Sum.Definition.SumForm r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sum.Definition.SumForm r a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Sum.Definition.SumForm r a)
instance Data.Foldable.Foldable (OAlg.Entity.Sum.Definition.SumForm OAlg.Data.Number.N)
instance OAlg.Data.Number.LengthN (OAlg.Entity.Sum.Definition.SumForm OAlg.Data.Number.N a)
instance (OAlg.Structure.Fibred.Definition.Fibred a, GHC.Classes.Ord a, OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Data.Reducible.Reducible (OAlg.Entity.Sum.Definition.SumForm r a)
-- | free sums with symbols in a.
module OAlg.Entity.Sum.SumSymbol
-- | free sum with symbols in a.
newtype SumSymbol r a
SumSymbol :: Sum r (R a) -> SumSymbol r a
-- | the underlying partial sequence.
ssypsq :: Semiring r => SumSymbol r a -> PSequence a r
-- | the underlying linear combination.
ssylc :: Semiring r => SumSymbol r a -> LinearCombination r a
-- | the induced free sum given by a list of scalars and symbols.
sumSymbol :: (Semiring r, Commutative r, Entity a, Ord a) => [(r, a)] -> SumSymbol r a
-- | the induced free sum given by the symbol.
sy :: (Semiring r, Commutative r, Entity a, Ord a) => a -> SumSymbol r a
-- | mapping of free sums
ssyMap :: (Semiring r, Commutative r, Entity y, Ord y) => (x -> y) -> SumSymbol r x -> SumSymbol r y
-- | additive homomorphism given by a mapping of a symbol in
-- x to a linear combination of y.
ssySum :: (Semiring r, Commutative r, Entity y, Ord y) => (x -> LinearCombination r y) -> SumSymbol r x -> SumSymbol r y
-- | joining a free sum of free sums to a free sum.
ssyJoin :: (Semiring r, Commutative r, Entity x, Ord x) => SumSymbol r (SumSymbol r x) -> SumSymbol r x
-- | the projectin of a free sum according to the given set of symbols.
--
-- Definition Let x be in SumSymbol r
-- a and s a Set of symbols in
-- a, then x is called representable
-- according to s iff all symbols of ssylc
-- x are elements of s.
--
-- Property Let s be a set of symbols in
-- a and x be representable in
-- SumSymbol r a according to s,
-- then ssyprj x == x.
--
-- Examples
--
--
-- >>> ssyprj (Set [A,D,E]) (3!sy D) :: SumSymbol Z Symbol
-- SumSymbol[3!D]
--
--
--
-- >>> ssyprj (Set [A,D,E]) (2!sy B) :: SumSymbol Z Symbol
-- SumSymbol[]
--
--
--
-- >>> ssyprj (Set [A,D,E]) (3!sy D + sy A - 5!sy E) :: SumSymbol Z Symbol
-- SumSymbol[A+3!D+-5!E]
--
--
--
-- >>> ssyprj (Set [A,D,E]) (2!sy D + 7!sy B - sy E + sy F) :: SumSymbol Z Symbol
-- SumSymbol[2!D+-1!E]
--
ssyprj :: (Semiring r, Commutative r, Ord a, Entity a) => Set a -> SumSymbol r a -> SumSymbol r a
-- | adjoining the root ().
newtype R a
R :: a -> R a
instance OAlg.Data.Validable.Validable a => OAlg.Data.Validable.Validable (OAlg.Entity.Sum.SumSymbol.R a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (OAlg.Entity.Sum.SumSymbol.R a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (OAlg.Entity.Sum.SumSymbol.R a)
instance GHC.Show.Show a => GHC.Show.Show (OAlg.Entity.Sum.SumSymbol.R a)
instance (OAlg.Structure.Distributive.Definition.Distributive r, OAlg.Structure.Oriented.Definition.Total r, OAlg.Structure.Multiplicative.Definition.Commutative r, GHC.Classes.Ord a, OAlg.Structure.Additive.Definition.Abelian r, OAlg.Entity.Definition.Entity a) => OAlg.Structure.Additive.Definition.Abelian (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Distributive.Definition.Distributive r, OAlg.Structure.Oriented.Definition.Total r, OAlg.Structure.Multiplicative.Definition.Commutative r, GHC.Classes.Ord a, OAlg.Entity.Definition.Entity a) => OAlg.Structure.Additive.Definition.Additive (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Distributive.Definition.Distributive r, OAlg.Structure.Oriented.Definition.Total r, OAlg.Structure.Multiplicative.Definition.Commutative r, OAlg.Entity.Definition.Entity a) => OAlg.Data.Validable.Validable (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Entity.Definition.Entity a, OAlg.Entity.Definition.Entity r, GHC.Classes.Ord r, GHC.Classes.Ord a) => GHC.Classes.Ord (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Entity.Definition.Entity a, OAlg.Entity.Definition.Entity r) => GHC.Classes.Eq (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Ring.Definition.Semiring r, GHC.Show.Show a) => GHC.Show.Show (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r, OAlg.Entity.Definition.Entity a) => OAlg.Entity.Definition.Entity (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r, OAlg.Entity.Definition.Entity a) => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r, OAlg.Entity.Definition.Entity a, GHC.Classes.Ord a) => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r, OAlg.Entity.Definition.Entity a, GHC.Classes.Ord a) => OAlg.Structure.Vectorial.Definition.Euclidean (OAlg.Entity.Sum.SumSymbol.SumSymbol r a)
instance OAlg.Entity.Definition.Entity a => OAlg.Entity.Definition.Entity (OAlg.Entity.Sum.SumSymbol.R a)
instance OAlg.Entity.Definition.Entity a => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Sum.SumSymbol.R a)
instance OAlg.Structure.Fibred.Definition.OrdRoot (OAlg.Entity.Sum.SumSymbol.R a)
-- | free sums.
module OAlg.Entity.Sum
-- | defintion of matrices over Distributive structures.
module OAlg.Entity.Matrix.Definition
-- | matrix over Distributive structures.
--
-- Property Let Matrix rw cl xijs be in
-- Matrix a for a Distributive structure
-- a, then holds:
--
--
-- - rw and cl are valid.
-- - xijs is valid.
-- - For all (x,i,j) in xijs holds:
- x
-- is not zero.
- orientation x == (cl
-- ? j) :> (rw ? i).
--
data Matrix x
Matrix :: Dim' x -> Dim' x -> Entries N N x -> Matrix x
-- | row dimension.
rows :: Matrix x -> Dim' x
-- | column dimension.
cols :: Matrix x -> Dim' x
-- | the entries.
mtxxs :: Matrix x -> Entries N N x
-- | viewing as a row of columns.
mtxRowCol :: Matrix x -> Row N (Col N x)
-- | viewing as a column of rows.
mtxColRow :: Matrix x -> Col N (Row N x)
-- | mapping of a matrix.
mtxMap :: Hom Dst h => h x y -> Matrix x -> Matrix y
-- | groups the rows with same row dimensions into a matrix of matrices
-- with one column and n rows accordingly.
mtxGroupRow :: Distributive x => Matrix x -> Matrix (Matrix x)
-- | groups a formal product of points p 0 ^ r 0 * ..
-- * p n ^ r n into a formal product of dimensions
-- (dim [p 0] ^ r o) * .. * (dim
-- [p n] ^ r n).
mtxGroupDim :: Distributive x => Dim' x -> Dim' (Matrix x)
-- | joining block matrices, i.e. matrices of matrices.
mtxJoin :: Oriented x => Matrix (Matrix x) -> Matrix x
-- | joining the dimension of matrices over x.
mtxJoinDim :: Oriented x => Dim' (Matrix x) -> Dim' x
-- | matrix with the given row and column number and the given entries for
-- a Distributive structure.
--
-- Property Let m = matrix rw cl xis then holds
--
--
-- - Pre For all (x,i,j) in xijs holds:
-- start x == cl ? j and end x
-- == rw ? i.
-- - Post m is valid.
--
--
-- Note The given entries will be sorted, aggregated and
-- zeros eliminated.
matrix :: (Additive x, p ~ Point x) => Dim x p -> Dim x p -> [(x, N, N)] -> Matrix x
-- | matrix with the given row and column number and the given entries for
-- a Total Distributive structure.
--
-- Property Let m = matrixTtl rws cls xis then
-- holds
--
--
-- - Pre For all (_,i,j) in xijs holds: i
-- < rws and j < cls.
-- - Post m is valid.
--
--
-- Note The given entries will be sorted, aggregated and
-- zeros eliminated.
matrixTtl :: (Additive x, FibredOriented x, Total x) => N -> N -> [(x, N, N)] -> Matrix x
-- | block matrices as matrix of matrices.
matrixBlc :: (Additive x, FibredOriented x) => [Dim' x] -> [Dim' x] -> [(Matrix x, N, N)] -> Matrix (Matrix x)
-- | diagonal matrix with entries starting at the index 0 (see
-- diagonal').
diagonal :: Additive x => Dim' x -> Dim' x -> [x] -> Matrix x
-- | diagonal matrix with entries starting at the given index offset.
diagonal' :: Additive x => N -> Dim' x -> Dim' x -> [x] -> Matrix x
-- | the dual matrix, with inverse coMatrixInv.
coMatrix :: Entity (Point x) => Matrix x -> Dual (Matrix x)
-- | from the dual matrix, with inverse coMatrix.
coMatrixInv :: Entity (Point x) => Dual (Matrix x) -> Matrix x
-- | from the bidual.
mtxFromOpOp :: Entity (Point x) => Matrix (Op (Op x)) -> Matrix x
-- | the contravariant isomorphism from Matrix x to
-- Matrix (Op x).
isoCoMatrixDst :: Distributive x => IsoOpMap Matrix Dst (Op (Matrix x)) (Matrix (Op x))
-- | standard random variable for the orientations of matrices over
-- x.
class XStandardOrientationMatrix x
xStandardOrientationMatrix :: XStandardOrientationMatrix x => X (Orientation (Dim' x))
-- | random variable of matrices with the given maximal dimension and
-- density.
xMatrix :: Additive x => Q -> XOrtOrientation x -> X (Orientation (Point (Matrix x))) -> XOrtOrientation (Matrix x)
-- | random variable of matrices with the given maximal dimension and the
-- given density.
xMatrixTtl :: (Distributive x, Total x) => N -> Q -> X x -> XOrtOrientation (Matrix x)
-- | a random variable of Z-matrices.
xodZ :: XOrtOrientation (Matrix Z)
-- | a random variable of Z-bolck-matrices.
xodZZ :: XOrtOrientation (Matrix (Matrix Z))
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Show.Show (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Classes.Eq (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Oriented.Definition.Oriented x, GHC.Classes.Ord x, OAlg.Structure.Oriented.Definition.OrdPoint x) => GHC.Classes.Ord (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Entity.Matrix.Definition.XStandardOrientationMatrix OAlg.Data.Number.Z
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x, OAlg.Structure.Oriented.Definition.XStandardOrtOrientation x, OAlg.Entity.Matrix.Definition.XStandardOrientationMatrix x) => OAlg.Structure.Oriented.Definition.XStandardOrtOrientation (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Structure.Fibred.Definition.FibredOriented (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Additive x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Structure.Additive.Definition.Additive (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Additive.Definition.Abelian x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Structure.Additive.Definition.Abelian (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Vectorial.Definition.Vectorial x, OAlg.Structure.Fibred.Definition.FibredOriented x) => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Distributive.Definition.Distributive x => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Distributive.Definition.Distributive x => OAlg.Structure.Distributive.Definition.Distributive (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Algebraic.Definition.Algebraic x => OAlg.Structure.Algebraic.Definition.Algebraic (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Distributive.Definition.Distributive x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Data.Dualisable.Transposable (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Distributive.Definition.Distributive x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Structure.Oriented.Definition.TransposableOriented (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Distributive.Definition.Distributive x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative (OAlg.Entity.Matrix.Definition.Matrix x)
instance (OAlg.Structure.Distributive.Definition.Distributive x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Structure.Distributive.Definition.TransposableDistributive (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Hom.Distributive.HomDistributive h => OAlg.Category.Applicative.Applicative1 h OAlg.Entity.Matrix.Definition.Matrix
instance OAlg.Structure.Oriented.Definition.EntityPoint x => OAlg.Data.Dualisable.Dualisable (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Distributive.Definition.ForgetfulDst s => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibred (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Additive.HomAdditive (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Distributive.HomDistributive (OAlg.Hom.Oriented.Definition.OpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance OAlg.Structure.Distributive.Definition.ForgetfulDst s => OAlg.Category.Applicative.Applicative (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibred (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Fibred.HomFibredOriented (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Additive.HomAdditive (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Distributive.HomDistributive (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance OAlg.Structure.Distributive.Definition.ForgetfulDst s => OAlg.Category.Definition.Functorial (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance (OAlg.Structure.Definition.TransformableOp s, OAlg.Structure.Distributive.Definition.ForgetfulDst s, OAlg.Structure.Definition.ForgetfulTyp s, Data.Typeable.Internal.Typeable s) => OAlg.Hom.Oriented.Definition.FunctorialHomOriented (OAlg.Hom.Oriented.Definition.IsoOpMap OAlg.Entity.Matrix.Definition.Matrix s)
instance OAlg.Structure.Oriented.Definition.XStandardPoint (OAlg.Entity.Matrix.Definition.Matrix OAlg.Data.Number.Z)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From (OAlg.Entity.Matrix.Definition.Matrix OAlg.Data.Number.Z)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSiteFrom (OAlg.Entity.Matrix.Definition.Matrix OAlg.Data.Number.Z)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To (OAlg.Entity.Matrix.Definition.Matrix OAlg.Data.Number.Z)
-- | Vectors with coefficients, lying in a Semiring.
module OAlg.Entity.Matrix.Vector
-- | vector with coefficients lying in a Semiring, indexd by
-- N.
--
-- Definition Let v = Vector ris be in
-- Vector r with r be a
-- Semiring, then v is valid iff
--
--
-- - ris is valid
-- - For all (r,i) in ris holds: r is not
-- equal to rZero.
--
newtype Vector r
Vector :: PSequence N r -> Vector r
-- | the underlying partial sequence.
vecpsq :: Vector r -> PSequence N r
-- | the i-th coefficient of the given vector.
--
-- Example Let v = vector [(-3,2),(9,4)] ::
-- Vector Z
--
--
-- >>> map (cf v) [0..8]
-- [0,0,-3,0,9,0,0,0,0]
--
cf :: Semiring r => Vector r -> N -> r
-- | the associated free sum of symbols according to the given set of
-- symbols and coefficients.
--
-- Property Let s = s 0 < s 1 < .. be
-- in Set a and r be in Vector
-- r then holds: cfsssy s r == cf r
-- 0 ! sy (s 0) + cf r 1 ! sy
-- (s 1) + ...
cfsssy :: (Semiring r, Commutative r, Entity a, Ord a) => Set a -> Vector r -> SumSymbol r a
-- | the associated coefficients of a free sum of symbols according to the
-- given set of symbols.
--
-- Property Let s = s 0 < s 1 < .. be
-- in Set a and x in SumSymbol
-- r a then holds: ssyprj s x ==
-- cf r 0 ! sy (s 0) + cf r 1 !
-- sy (s 1) + .. where r = ssycfs s x,
ssycfs :: (Semiring r, Ord a) => Set a -> SumSymbol r a -> Vector r
-- | a vector as a row with one column at 0.
vecrc :: Vector r -> Row N (Col N r)
-- | applying a matrix from the left.
vecAppl :: Semiring r => Matrix r -> Vector r -> Vector r
data HomSymbol r x y
[HomSymbol] :: (Entity x, Ord x, Entity y, Ord y) => PSequence x (LinearCombination r y) -> HomSymbol r (SumSymbol r x) (SumSymbol r y)
[Cfs] :: (Entity x, Ord x) => Set x -> HomSymbol r (SumSymbol r x) (Vector r)
[Ssy] :: (Entity x, Ord x) => Set x -> HomSymbol r (Vector r) (SumSymbol r x)
[HomMatrix] :: Matrix r -> HomSymbol r (Vector r) (Vector r)
-- | the associated r-linear homomorphism.
mtxHomSymbol :: Matrix r -> HomSymbol r (SumSymbol r N) (SumSymbol r N)
-- | the associated representation matrix of the given
-- r-homomorphism and the two symbol set.
--
-- Property Let p = Representable h xs ys be in
-- Representable r h x y for
-- a Commutative Semiring r, then holds:
-- For all v in Vector r holds: Let
-- h' = HomMatrix (repMatrix p) in
--
--
-- - For all (_,i) in h' $ v holds: i
-- < lengthN ys.
-- - (Ssy ys $ h' $ v) == (h $
-- Ssy xs $ v).
--
repMatrix :: Representable r h x y -> Matrix r
-- | Predicate for a r-linear homomorphisms between the
-- free sums SumSymbol r x and
-- SumSymbol r y being representable
-- for the given symbol sets.
--
-- Definition Let l be in LinearCombination
-- r x and xs be a Set of symbols of
-- x, then l is called representable
-- in xs iff all symbols of lcs l are
-- elements of xs.
--
-- Property Let h be a r-linear
-- homomorphism between the free sums SumSymbol r
-- x and SumSymbol r y,
-- xs a Set of symbols in x and
-- ys a Set of symbols in y, then holds:
-- If for each symbol x in xs the associated
-- LinearCombination of h $ x is representable in
-- ys, then Representable h xs ys is
-- valid.
data Representable r h x y
[Representable] :: (Hom (Vec r) h, Entity x, Ord x, Entity y, Ord y) => h (SumSymbol r x) (SumSymbol r y) -> Set x -> Set y -> Representable r h (SumSymbol r x) (SumSymbol r y)
-- | the associated representation of a matrix.
mtxRepresentable :: (Semiring r, Commutative r) => Matrix r -> Representable r (HomSymbol r) (SumSymbol r N) (SumSymbol r N)
-- | validity of repMatrix for the given vector.
prpRepMatrix :: (Semiring r, Commutative r) => Representable r h x y -> Vector r -> Statement
-- | validity of repMatrix for Z-matrices with the given row
-- and column numbers.
prpRepMatrixZ :: N -> N -> Statement
-- | random variable of Vector r where all indices
-- are strict smaller then the given bound.
--
-- Property Let n be in N and xr be in
-- X r then holds: For all (_,i) in the
-- range of xVecN n xr holds: i < n.
xVecN :: Semiring r => N -> X r -> X (Vector r)
instance GHC.Classes.Ord r => GHC.Classes.Ord (OAlg.Entity.Matrix.Vector.Vector r)
instance GHC.Classes.Eq r => GHC.Classes.Eq (OAlg.Entity.Matrix.Vector.Vector r)
instance GHC.Show.Show r => GHC.Show.Show (OAlg.Entity.Matrix.Vector.Vector r)
instance OAlg.Structure.Ring.Definition.Semiring r => GHC.Show.Show (OAlg.Entity.Matrix.Vector.HomSymbol r x y)
instance OAlg.Structure.Ring.Definition.Semiring r => GHC.Classes.Eq (OAlg.Entity.Matrix.Vector.HomSymbol r x y)
instance GHC.Show.Show (OAlg.Entity.Matrix.Vector.Representable r h x y)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Vector.Representable r h x y)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Data.Show.Show2 (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Data.Equal.Eq2 (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Vector.HomSymbol r x y)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Data.Validable.Validable2 (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, Data.Typeable.Internal.Typeable x, Data.Typeable.Internal.Typeable y) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Vector.HomSymbol r x y)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Entity.Definition.Entity2 (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Applicative.Applicative (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Definition.Morphism (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Matrix.Vector.HomSymbol r) OAlg.Structure.Fibred.Definition.Fbr
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Matrix.Vector.HomSymbol r) OAlg.Structure.Definition.Typ
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Hom.Fibred.HomFibred (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Matrix.Vector.HomSymbol r) OAlg.Structure.Additive.Definition.Add
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Hom.Additive.HomAdditive (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Matrix.Vector.HomSymbol r) (OAlg.Structure.Vectorial.Definition.Vec r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Hom.Vectorial.HomVectorial r (OAlg.Entity.Matrix.Vector.HomSymbol r)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Vector.Vector r)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Vector.Vector r)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Matrix.Vector.Vector r)
instance OAlg.Structure.Ring.Definition.Semiring r => OAlg.Structure.Additive.Definition.Additive (OAlg.Entity.Matrix.Vector.Vector r)
instance OAlg.Structure.Ring.Definition.Ring r => OAlg.Structure.Additive.Definition.Abelian (OAlg.Entity.Matrix.Vector.Vector r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Entity.Matrix.Vector.Vector r)
instance (OAlg.Structure.Ring.Definition.Semiring r, OAlg.Structure.Multiplicative.Definition.Commutative r) => OAlg.Structure.Vectorial.Definition.Euclidean (OAlg.Entity.Matrix.Vector.Vector r)
-- | general linear group GL and elementary transformations over a
-- Galoisian structure.
module OAlg.Entity.Matrix.GeneralLinearGroup
-- | elementary linear transformation over a Distributive structure
-- x.
--
-- Property Let f be in Transformation
-- x then holds:
--
--
-- - If f matches Permute r c p then
-- holds:
- h <= It n where (_,h) =
-- span nProxy p and n = lengthN
-- c.
- r == c <* p.
-- - If f matches Scale d k s then
-- holds:
- k < lengthN
-- d.
- s is an endo at d ?
-- k.
- s is valid.
-- - If f matches Shear d k l g then
-- holds:
- k < lengthN d and l
-- < lengthN d.
- k <
-- l.
- g is valid.
--
--
-- Note Shear d k l (GL2 s t u v)
-- represents the square matrix m of dimension d where
-- m k k == s, m k l == t, m l k
-- == u, m l l == v and for all i, j
-- not in [k,l] holds: If i /= j then m i
-- j is zero else m i i is one.
data Transformation x
[Permute] :: Distributive x => Dim x (Point x) -> Dim x (Point x) -> Permutation N -> Transformation x
[Scale] :: Distributive x => Dim x (Point x) -> N -> Inv x -> Transformation x
[Shear] :: Galoisian x => Dim x (Point x) -> N -> N -> GL2 x -> Transformation x
-- | general linear groupoid of matrices.
type GL x = Inv (Matrix x)
-- | the general linear group of 2x2 matrices for a
-- Galoisian structure x.
--
-- Property Let GL2 s t u v be in GL2
-- x for a Galoisian structure x, then
-- holds: s*v - u*t is invertible.
--
-- Example Let g = GL2 3 5 4 7 :: GL2
-- Z:
--
--
-- >>> invert g
-- GL2 7 -5 -4 3
--
--
--
-- >>> g * invert g
-- GL2 1 0 0 1
--
--
-- which is the one in GL2 Z.
--
-- Note
--
-- GL2 (s t u v) represents the 2x2-matrix
--
--
-- [s t]
-- [u v]
--
--
-- and is obtained by GL2GL.
data GL2 x
GL2 :: x -> x -> x -> x -> GL2 x
-- | quotient groupoid of the free groupoid of Transformation (see
-- FTGLT) given by the relations:
--
--
--
-- Property Let g be in GLT, then holds:
--
--
-- - For all exponents z in form g holds:
-- 0 < z.
--
--
-- Example Let d = dim [()] ^ 10 :: Dim'
-- Z, a = permuteFT d d (swap 2 8),
-- b = permuteFT d d (swap 2 3) and c =
-- permuteFT d d (swap 2 3 * swap 2 8) then:
--
--
-- >>> a * b == c
-- False
--
--
-- but in GLT holds: let a' = amap FTGLT a,
-- b' = amap FTGLT b and c' = amap
-- FTGLT c in
--
--
-- >>> a' * b' == c'
-- True
--
--
-- and
--
--
-- >>> amap GLTGL (a' * b') == amap GLTGL a' * amap GLTGL b'
-- True
--
--
-- Note: As a consequence of the property (1.), GLT can be
-- canonically embedded via prj . form - in
-- to ProductForm N (Transformation x).
data GLT x
-- | permutation of the given dimensions.
--
-- Property Let r, c be in Dim'
-- x and p in Permutation N
-- for a Distributive structure x, then holds: If
-- Permute r c p is valid then permute
-- r c p is valid.
--
-- Example Let t = permute r c p with
-- Permute r c p is valid then its associated
-- matrix (see GLTGL) has the orientation c :>
-- r and the form
--
--
-- k l
-- [1 ]
-- [ . ]
-- [ . ]
-- [ 1 ]
-- [ 1 ] k
-- [ 1 ]
-- [ . ]
-- [ . ]
-- [ 1 ]
-- [ 1 ] l
-- [ 1 ]
-- [ . ]
-- [ . ]
-- [ 1]
--
--
-- Note r dose not have to be equal to c, but
-- from r == c <* p follows that both have the
-- same length.
permute :: Distributive x => Dim' x -> Dim' x -> Permutation N -> GLT x
-- | the induce element in the free groupoid of transformations.
permuteFT :: Distributive x => Dim' x -> Dim' x -> Permutation N -> FT x
-- | scaling.
--
-- Property Let d be in Dim' x,
-- k in N and s in Inv x,
-- then holds: If Scale d k s is valid then
-- scale d k s is valid.
--
-- Example Let t = scale d k s with
-- Scale d k s is valid then its associated matrix
-- (see GLTGL) is an endo with dimension d and has the
-- form
--
--
-- k
-- [1 ]
-- [ . ]
-- [ . ]
-- [ 1 ]
-- [ s' ] k
-- [ 1 ]
-- [ . ]
-- [ . ]
-- [ 1]
--
--
-- where s' = (inj :: Inv x -> x)
-- s.
scale :: Distributive x => Dim' x -> N -> Inv x -> GLT x
-- | shearing.
--
-- Property Let d be in Dim' x,
-- k, l in N and g in GL2
-- x then holds: If Shear d k l g is
-- valid then shear d k l g is valid.
--
-- Example Let t = shear d k l g where
-- Shear d k l g is valid then its associated
-- matrix (see GLTGL) is an endo with dimension d and has
-- the form
--
--
-- k l
-- [1 ]
-- [ . ]
-- [ . ]
-- [ 1 ]
-- [ s t ] k
-- [ 1 ]
-- [ . ]
-- [ . ]
-- [ 1 ]
-- [ u v ] l
-- [ 1 ]
-- [ . ]
-- [ . ]
-- [ 1]
--
shear :: Galoisian x => Dim' x -> N -> N -> GL2 x -> GLT x
-- | reduces a GLTForm x to its normal form.
--
-- Property Let f be in GLTForm x
-- for a Oriented structure x, then holds:
--
--
-- - rdcGLTForm (rdcGLTForm f) ==
-- rdcGLTForm f.
-- - For all exponents z in rdcGLTForm f
-- holds: 0 < z.
--
rdcGLTForm :: Oriented x => GLTForm x -> GLTForm x
-- | form of GLT.
type GLTForm x = ProductForm Z (Transformation x)
-- | transposition of a product of elementary transformation.
gltfTrsp :: TransposableDistributive r => GLTForm r -> GLTForm r
-- | the free groupoid of Transformations.
type FT x = Product Z (Transformation x)
-- | Oriented homomorphisms.
data TrApp x y
[TrFT] :: Oriented x => TrApp (Transformation x) (FT x)
[TrGL] :: Distributive x => TrApp (Transformation x) (GL x)
[TrGLT] :: Oriented x => TrApp (Transformation x) (GLT x)
-- | the induced element of the groupoid GLT.
trGLT :: Oriented x => Transformation x -> GLT x
-- | Multiplicative homomorphisms.
data GLApp x y
[FTGL] :: Distributive x => GLApp (FT x) (GL x)
[FTGLT] :: Oriented x => GLApp (FT x) (GLT x)
[GLTGL] :: Distributive x => GLApp (GLT x) (GL x)
[GL2GL] :: Galoisian x => GLApp (GL2 x) (GL x)
instance GHC.Classes.Ord x => GHC.Classes.Ord (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance GHC.Show.Show x => GHC.Show.Show (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Show.Show (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Classes.Eq (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance GHC.Classes.Eq (OAlg.Entity.Matrix.GeneralLinearGroup.Transformation x)
instance GHC.Show.Show (OAlg.Entity.Matrix.GeneralLinearGroup.Transformation x)
instance GHC.Show.Show (OAlg.Entity.Matrix.GeneralLinearGroup.TrApp x y)
instance GHC.Classes.Eq (OAlg.Entity.Matrix.GeneralLinearGroup.TrApp x y)
instance GHC.Show.Show (OAlg.Entity.Matrix.GeneralLinearGroup.GLApp x y)
instance GHC.Classes.Eq (OAlg.Entity.Matrix.GeneralLinearGroup.GLApp x y)
instance OAlg.Data.Show.Show2 OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Data.Equal.Eq2 OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.GeneralLinearGroup.GLApp x y)
instance OAlg.Data.Validable.Validable2 OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance (Data.Typeable.Internal.Typeable x, Data.Typeable.Internal.Typeable y) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.GeneralLinearGroup.GLApp x y)
instance OAlg.Entity.Definition.Entity2 OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Category.Definition.Morphism OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Category.Definition.EmbeddableMorphism OAlg.Entity.Matrix.GeneralLinearGroup.GLApp OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Category.Definition.EmbeddableMorphism OAlg.Entity.Matrix.GeneralLinearGroup.GLApp OAlg.Structure.Definition.Typ
instance OAlg.Category.Definition.EmbeddableMorphismTyp OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Category.Applicative.Applicative OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Hom.Oriented.Definition.HomOriented OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Category.Definition.EmbeddableMorphism OAlg.Entity.Matrix.GeneralLinearGroup.GLApp OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Hom.Multiplicative.Definition.HomMultiplicative OAlg.Entity.Matrix.GeneralLinearGroup.GLApp
instance OAlg.Data.Show.Show2 OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Data.Equal.Eq2 OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.GeneralLinearGroup.TrApp x y)
instance OAlg.Data.Validable.Validable2 OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance (Data.Typeable.Internal.Typeable x, Data.Typeable.Internal.Typeable y) => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.GeneralLinearGroup.TrApp x y)
instance OAlg.Entity.Definition.Entity2 OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Category.Definition.Morphism OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Category.Definition.EmbeddableMorphism OAlg.Entity.Matrix.GeneralLinearGroup.TrApp OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Category.Definition.EmbeddableMorphism OAlg.Entity.Matrix.GeneralLinearGroup.TrApp OAlg.Structure.Definition.Typ
instance OAlg.Category.Definition.EmbeddableMorphismTyp OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Category.Applicative.Applicative OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Hom.Oriented.Definition.HomOriented OAlg.Entity.Matrix.GeneralLinearGroup.TrApp
instance OAlg.Data.Constructable.Exposable (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Data.Constructable.Constructable (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Data.Canonical.Embeddable (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x) (OAlg.Entity.Product.Definition.ProductForm OAlg.Data.Number.N (OAlg.Entity.Matrix.GeneralLinearGroup.Transformation x))
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Entity.Matrix.GeneralLinearGroup.GLT x)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.GeneralLinearGroup.Transformation x)
instance Data.Typeable.Internal.Typeable x => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.GeneralLinearGroup.Transformation x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.GeneralLinearGroup.Transformation x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Structure.Oriented.Definition.Total (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance OAlg.Structure.Ring.Definition.Galoisian x => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance (OAlg.Structure.Ring.Definition.Galoisian x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Data.Dualisable.Transposable (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance (OAlg.Structure.Ring.Definition.Galoisian x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Structure.Oriented.Definition.TransposableOriented (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
instance (OAlg.Structure.Ring.Definition.Galoisian x, OAlg.Structure.Distributive.Definition.TransposableDistributive x) => OAlg.Structure.Multiplicative.Definition.TransposableMultiplicative (OAlg.Entity.Matrix.GeneralLinearGroup.GL2 x)
-- | elementary matrix transformations, i.e. operations of GLT on
-- Matrix.
module OAlg.Entity.Matrix.Transformation
-- | GLT as row transformations.
newtype RowTrafo a
RowTrafo :: GLT a -> RowTrafo a
-- | applying a transformation as a row transformation on a column of rows.
crTrafoRows :: Transformation x -> Col N (Row N x) -> Col N (Row N x)
-- | GLT as a column transformation.
newtype ColTrafo x
ColTrafo :: GLT x -> ColTrafo x
-- | applying a transformation as a column transformation on a column of
-- rows.
crTrafoCols :: Col N (Row N x) -> Transformation x -> Col N (Row N x)
-- | the result of transforming a matrix into a diagonal form.
--
-- Property Let DiagonalForm ds rt ct be in
-- DiagonalForm k, then holds:
--
--
-- - n <= lengthN (start rt) and n
-- <= lengthN (end ct) where n =
-- lengthN ds.
-- - For all d in ds holds: not
-- (isZero d).
--
data DiagonalForm k
DiagonalForm :: [k] -> RowTrafo k -> ColTrafo k -> DiagonalForm k
-- | the resulting matrix by applying on the diagonal matrix the inverse of
-- the given transformations.
dgfMatrix :: Distributive k => DiagonalForm k -> Matrix k
-- | predicate for diagonal forms with strict positive entries.
--
-- Property Let DiagonalFormStrictPositive
-- (DiagonalForm ds _ _) be in DiagonalForm
-- k, then holds: 0 < d for all d
-- in ds.
newtype DiagonalFormStrictPositive k
DiagonalFormStrictPositive :: DiagonalForm k -> DiagonalFormStrictPositive k
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Show.Show (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => GHC.Classes.Eq (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Structure.Multiplicative.Definition.Cayleyan (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Structure.Multiplicative.Definition.Invertible (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Classes.Eq (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented k => GHC.Show.Show (OAlg.Entity.Matrix.Transformation.DiagonalForm k)
instance OAlg.Structure.Oriented.Definition.Oriented k => GHC.Classes.Eq (OAlg.Entity.Matrix.Transformation.DiagonalForm k)
instance OAlg.Structure.Oriented.Definition.Oriented k => GHC.Classes.Eq (OAlg.Entity.Matrix.Transformation.DiagonalFormStrictPositive k)
instance OAlg.Structure.Oriented.Definition.Oriented k => GHC.Show.Show (OAlg.Entity.Matrix.Transformation.DiagonalFormStrictPositive k)
instance OAlg.Structure.Number.Definition.Number k => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Transformation.DiagonalFormStrictPositive k)
instance OAlg.Structure.Number.Definition.Number k => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Transformation.DiagonalFormStrictPositive k)
instance OAlg.Structure.Distributive.Definition.Distributive k => OAlg.Data.Validable.Validable (OAlg.Entity.Matrix.Transformation.DiagonalForm k)
instance OAlg.Structure.Distributive.Definition.Distributive k => OAlg.Entity.Definition.Entity (OAlg.Entity.Matrix.Transformation.DiagonalForm k)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Matrix.Transformation.RowTrafo a)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Operational.Opl (OAlg.Entity.Matrix.Transformation.RowTrafo x) (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Distributive.Definition.Distributive x => OAlg.Structure.Operational.OrientedOpl (OAlg.Entity.Matrix.Transformation.RowTrafo x) (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Exponential.Exponential (OAlg.Entity.Matrix.Transformation.ColTrafo x)
instance OAlg.Structure.Oriented.Definition.Oriented x => OAlg.Structure.Operational.Opr (OAlg.Entity.Matrix.Transformation.ColTrafo x) (OAlg.Entity.Matrix.Definition.Matrix x)
instance OAlg.Structure.Distributive.Definition.Distributive x => OAlg.Structure.Operational.OrientedOpr (OAlg.Entity.Matrix.Transformation.ColTrafo x) (OAlg.Entity.Matrix.Definition.Matrix x)
-- | natural transformations between Diagrams.
module OAlg.Entity.Diagram.Transformation
-- | natural transformations between two Diagrams.
--
-- Property Let Transformation a b t be in
-- Transformation t n m a for
-- a Multiplicative structure a, then holds
--
--
-- - dgQuiver a == dgQuiver b.
-- - For all 0 <= i < n holds:
-- orientation (t i) == p i :> q i where
-- p = dgPoints a and q = dgPoints
-- b.
-- - For all 0 <= j < m holds: t (e j)
-- * f j == g j * t (s j) where f =
-- dgArrows a, g = dgArrows b, s j
-- is the index of the start point of the j-th arrow and e
-- j is the index of the end point.
--
--
--
-- t (s j)
-- s j p (s j) --------> q (s j)
-- | | |
-- j | f j | | g j
-- | | |
-- v v v
-- e j p (e j) --------> q (e j)
-- t (e j)
--
data Transformation t n m a
Transformation :: Diagram t n m a -> Diagram t n m a -> FinList n a -> Transformation t n m a
-- | the underlying list of factors.
trfs :: Transformation t n m a -> FinList n a
-- | the dual transformation.
coTransformation :: Transformation t n m a -> Dual (Transformation t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Classes.Eq (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance OAlg.Structure.Multiplicative.Definition.Multiplicative a => OAlg.Data.Validable.Validable (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Entity.Definition.Entity (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Fibred.Definition.Fibred (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Fibred.Definition.FibredOriented (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Additive.Definition.Additive (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Distributive.Definition.Distributive (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Structure.Additive.Definition.Abelian a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Additive.Definition.Abelian (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Structure.Vectorial.Definition.Vectorial a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Vectorial.Definition.Vectorial (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
instance (OAlg.Structure.Algebraic.Definition.Algebraic a, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Algebraic.Definition.Algebraic (OAlg.Entity.Diagram.Transformation.Transformation t n m a)
-- | diagrams over Oriented structures.
module OAlg.Entity.Diagram
-- | definition of Cones over Diagrams.
module OAlg.Limes.Cone.Definition
-- | cone over a diagram.
--
-- Properties Let c be in Cone s
-- p t n m a then holds:
--
--
-- - If c matches ConeProjective d t cs for a
-- Multiplicative structure a then
-- holds:
- For all ci in cs holds:
-- start ci == t and end ci ==
-- pi where pi in dgPoints d.
- For
-- all aij in dgArrows d holds: aij *
-- ci == cj where ci, cj in
-- cs.
-- - If c matches ConeInjective d t cs for a
-- Multiplicative structure a then
-- holds:
- For all ci in cs holds: end
-- ci == t and start ci == pi where
-- pi in dgPoints d.
- For all
-- aij in dgArrows d holds: cj * aij
-- == ci where ci, cj in
-- cs.
-- - If c matches ConeKernel p k for a
-- Distributive structure a then
-- holds:
- end k == p0 where p0 in
-- dgPoints p
- For all a in
-- dgArrows p holds: a * k ==
-- zero (t :> p1) where t = start k
-- and p0, p1 in dgPoints
-- p.
-- - If c matches ConeCokernel p k for a
-- Distributive structure a then
-- holds:
- start k == p0 where p0
-- in cnPoints c
- For all a in
-- dgArrows p holds: k * a ==
-- zero (p1 :> t) where t = end k
-- and p0, p1 in dgPoints
-- p.
--
data Cone s p t n m a
[ConeProjective] :: Multiplicative a => Diagram t n m a -> Point a -> FinList n a -> Cone Mlt Projective t n m a
[ConeInjective] :: Multiplicative a => Diagram t n m a -> Point a -> FinList n a -> Cone Mlt Injective t n m a
[ConeKernel] :: Distributive a => Diagram (Parallel LeftToRight) N2 m a -> a -> Cone Dst Projective (Parallel LeftToRight) N2 m a
[ConeCokernel] :: Distributive a => Diagram (Parallel RightToLeft) N2 m a -> a -> Cone Dst Injective (Parallel RightToLeft) N2 m a
-- | concept of Projective and Injective.
data Perspective
Projective :: Perspective
Injective :: Perspective
-- | the underlying diagram.
cnDiagram :: Cone s p t n m a -> Diagram t n m a
-- | reflexivity of the underlying diagram type.
cnDiagramTypeRefl :: Cone s p t n m a -> Dual (Dual t) :~: t
-- | the tip of a cone.
--
-- Property Let c be in Cone s p
-- t n m a for a Oriented
-- structure then holds:
--
--
-- - If p is equal to Projective then
-- holds: start ci == tip c for all
-- ci in shell c.
-- - If p is equal to Injective then
-- holds: end ci == tip c for all
-- ci in shell c.
--
tip :: Cone s p t n m a -> Point a
-- | the shell of a cone.
--
-- Property Let c be in Cone s p
-- t n m a for a Oriented
-- structure then holds:
--
--
-- - If p is equal to Projective then
-- holds: fmap end (shell c) ==
-- cnPoints c.
-- - If p is equal to Injective then
-- holds: fmap start (shell c) ==
-- cnPoints c.
--
shell :: Cone s p t n m a -> FinList n a
-- | the arrows of the underlying diagram, i.e. dgArrows
-- . cnDiagram.
cnArrows :: Cone s p t n m a -> FinList m a
-- | the points of the underlying diagram, i.e. dgPoints
-- . cnDiagram.
cnPoints :: Oriented a => Cone s p t n m a -> FinList n (Point a)
-- | mapping of a cone.
cnMap :: Hom s h => h a b -> Cone s p t n m a -> Cone s p t n m b
-- | mapping of a cone under a Multiplicative homomorphism.
cnMapMlt :: Hom Mlt h => h a b -> Cone Mlt p t n m a -> Cone Mlt p t n m b
-- | mapping of a cone under a Distributive homomorphism.
cnMapDst :: Hom Dst h => h a b -> Cone Dst p t n m a -> Cone Dst p t n m b
-- | embedding of a cone in a distributive structure to its multiplicative
-- cone.
cnZeroHead :: Cone Dst p t n m a -> ConeZeroHead Mlt p t n (m + 1) a
-- | the kernel cone of a zero headed parallel cone, i.e. the inverse of
-- cnZeroHead.
cnKernel :: (Distributive a, p ~ Projective, t ~ Parallel LeftToRight) => ConeZeroHead Mlt p t n (m + 1) a -> Cone Dst p t n m a
-- | the cokernel cone of a zero headed parallel cone, i.e. the inverse of
-- cnZeroHead.
cnCokernel :: (Distributive a, p ~ Injective, t ~ Parallel RightToLeft) => ConeZeroHead Mlt p t n (m + 1) a -> Cone Dst p t n m a
-- | subtracts to every arrow of the underlying parallel diagram the first
-- arrow and adapts the shell accordingly.
cnDiffHead :: (Distributive a, Abelian a) => Cone Mlt p (Parallel d) n (m + 1) a -> ConeZeroHead Mlt p (Parallel d) n (m + 1) a
-- | predicate for cones where the first arrow of its underlying diagram is
-- equal to zero.
newtype ConeZeroHead s p t n m a
ConeZeroHead :: Cone s p t n m a -> ConeZeroHead s p t n m a
-- | to the dual, with its inverse coConeZeroHead.
coConeZeroHead :: ConeZeroHead s p t n m a -> Dual (ConeZeroHead s p t n m a)
-- | from the bidual.
czFromOpOp :: ConeStruct s a -> ConeZeroHead s p t n m (Op (Op a)) -> ConeZeroHead s p t n m a
-- | from the dual, with its inverse coConeZeroHead.
coConeZeroHeadInv :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Dual (ConeZeroHead s p t n m a) -> ConeZeroHead s p t n m a
-- | to g (Op a).
cnToOp :: ConeDuality s f g a -> f a -> g (Op a)
-- | from g (Op a).
cnFromOp :: ConeDuality s f g a -> g (Op a) -> f a
-- | Op-duality between cone types.
data ConeDuality s f g a
[ConeDuality] :: ConeStruct s a -> (f a :~: Cone s p t n m a) -> (g (Op a) :~: Dual (Cone s p t n m a)) -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> ConeDuality s f g a
-- | to the dual cone, with its inverse coConeInv.
coCone :: Cone s p t n m a -> Dual (Cone s p t n m a)
-- | from the dual cone, with its inverse coCone.
coConeInv :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Dual (Cone s p t n m a) -> Cone s p t n m a
-- | from Op . Op.
cnFromOpOp :: ConeStruct s a -> Cone s p t n m (Op (Op a)) -> Cone s p t n m a
-- | cone structures.
data ConeStruct s a
[ConeStructMlt] :: Multiplicative a => ConeStruct Mlt a
[ConeStructDst] :: Distributive a => ConeStruct Dst a
-- | the opposite cone structure.
cnStructOp :: ConeStruct s a -> ConeStruct s (Op a)
-- | the Multiplicative structure of a cone structure.
cnStructMlt :: ConeStruct s a -> Struct Mlt a
-- | the associated structure of a cone structure.
cnStruct :: ConeStruct s a -> Struct s a
-- | the projective cone on Orientation with the underlying given
-- diagram and tip with the given point.
cnPrjOrnt :: Entity p => p -> Diagram t n m (Orientation p) -> Cone Mlt Projective t n m (Orientation p)
-- | the injective cone on Orientation with the underlying given
-- diagram and tip with the given point.
cnInjOrnt :: Entity p => p -> Diagram t n m (Orientation p) -> Cone Mlt Injective t n m (Orientation p)
-- | the induced Projective cone with ending factor given by the
-- given FactorChain.
--
-- Property Let h = FactorChain f d be in
-- FactorChain To n a for a
-- Multiplicative structure a and
-- ConeProjective d' _
-- (_:|..:|c:|Nil) = cnPrjChainTo
-- h then holds: d' == d and c == f.
cnPrjChainTo :: Multiplicative a => FactorChain To n a -> Cone Mlt Projective (Chain To) (n + 1) n a
-- | the underlying factor chain of a projective chain to cone, i.e the
-- inverse of cnPrjChainToInv.
cnPrjChainToInv :: Cone Mlt Projective (Chain To) (n + 1) n a -> FactorChain To n a
-- | the induced Projective cone with starting factor given by the
-- given FactorChain.
--
-- Property Let h = FactorChain f d be in
-- FactorChain From n a for a
-- Multiplicative structure a and
-- ConeProjective d' _ (c:|_) = cnPrjChainFrom
-- h then holds: d' == d and c == f.
cnPrjChainFrom :: Multiplicative a => FactorChain From n a -> Cone Mlt Projective (Chain From) (n + 1) n a
-- | the underlying factor chain of a projective chain from cone, i.e. the
-- inverse of cnPrjChainFrom.
cnPrjChainFromInv :: Cone Mlt Projective (Chain From) (n + 1) n a -> FactorChain From n a
-- | predicate for a factor with end point at the starting point of
-- the given chain.
--
-- Property
--
--
-- - Let FactorChain f d be in FactorChain
-- To n a for a Multiplicative structure
-- a then holds: end f ==
-- chnToStart d.
-- - Let FactorChain f d be in FactorChain
-- From n a for a Multiplicative
-- structure a then holds: end f ==
-- chnFromStart d.
--
data FactorChain s n a
FactorChain :: a -> Diagram (Chain s) (n + 1) n a -> FactorChain s n a
instance GHC.Classes.Eq (OAlg.Limes.Cone.Definition.ConeZeroHead s p t n m a)
instance GHC.Show.Show (OAlg.Limes.Cone.Definition.ConeZeroHead s p t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Classes.Eq (OAlg.Limes.Cone.Definition.FactorChain s n a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Limes.Cone.Definition.FactorChain s n a)
instance GHC.Show.Show (OAlg.Limes.Cone.Definition.ConeStruct s a)
instance GHC.Classes.Eq (OAlg.Limes.Cone.Definition.ConeStruct s a)
instance GHC.Show.Show (OAlg.Limes.Cone.Definition.Cone s p t n m a)
instance GHC.Classes.Eq (OAlg.Limes.Cone.Definition.Cone s p t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Limes.Cone.Definition.FactorChain 'OAlg.Data.Dualisable.To n a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Limes.Cone.Definition.FactorChain 'OAlg.Data.Dualisable.From n a)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, Data.Typeable.Internal.Typeable n) => OAlg.Entity.Definition.Entity (OAlg.Limes.Cone.Definition.FactorChain 'OAlg.Data.Dualisable.To n a)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, Data.Typeable.Internal.Typeable n) => OAlg.Entity.Definition.Entity (OAlg.Limes.Cone.Definition.FactorChain 'OAlg.Data.Dualisable.From n a)
instance OAlg.Structure.Distributive.Definition.Distributive a => OAlg.Data.Validable.Validable (OAlg.Limes.Cone.Definition.ConeZeroHead s p d n ('OAlg.Entity.Natural.S m) a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Entity.Definition.Entity (OAlg.Limes.Cone.Definition.ConeZeroHead s p t n ('OAlg.Entity.Natural.S m) a)
instance OAlg.Hom.Multiplicative.Definition.HomMultiplicative h => OAlg.Category.Applicative.Applicative1 h (OAlg.Limes.Cone.Definition.Cone OAlg.Structure.Multiplicative.Definition.Mlt p t n m)
instance OAlg.Hom.Distributive.HomDistributive h => OAlg.Category.Applicative.Applicative1 h (OAlg.Limes.Cone.Definition.Cone OAlg.Structure.Distributive.Definition.Dst p t n m)
instance OAlg.Data.Validable.Validable (OAlg.Limes.Cone.Definition.Cone s p t n m a)
instance (Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m, Data.Typeable.Internal.Typeable a) => OAlg.Entity.Definition.Entity (OAlg.Limes.Cone.Definition.Cone s p t n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable d, Data.Typeable.Internal.Typeable m) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Limes.Cone.Definition.Cone s p ('OAlg.Entity.Diagram.Definition.Parallel d) OAlg.Entity.Natural.N2 m a)
instance (OAlg.Entity.Definition.Entity p, OAlg.Data.Validable.XStandard p, OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram t n m (OAlg.Structure.Oriented.Definition.Orientation p))) => OAlg.Data.Validable.XStandard (OAlg.Limes.Cone.Definition.Cone OAlg.Structure.Multiplicative.Definition.Mlt 'OAlg.Limes.Perspective.Projective t n m (OAlg.Structure.Oriented.Definition.Orientation p))
instance (OAlg.Entity.Definition.Entity p, t GHC.Types.~ 'OAlg.Entity.Diagram.Definition.Parallel 'OAlg.Data.Dualisable.LeftToRight, n GHC.Types.~ OAlg.Entity.Natural.N2, OAlg.Data.Validable.XStandard p, OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram t n m (OAlg.Structure.Oriented.Definition.Orientation p))) => OAlg.Data.Validable.XStandard (OAlg.Limes.Cone.Definition.Cone OAlg.Structure.Distributive.Definition.Dst 'OAlg.Limes.Perspective.Projective t n m (OAlg.Structure.Oriented.Definition.Orientation p))
instance (OAlg.Entity.Definition.Entity p, OAlg.Data.Validable.XStandard p, OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram t n m (OAlg.Structure.Oriented.Definition.Orientation p))) => OAlg.Data.Validable.XStandard (OAlg.Limes.Cone.Definition.Cone OAlg.Structure.Multiplicative.Definition.Mlt 'OAlg.Limes.Perspective.Injective t n m (OAlg.Structure.Oriented.Definition.Orientation p))
instance (OAlg.Entity.Definition.Entity p, t GHC.Types.~ 'OAlg.Entity.Diagram.Definition.Parallel 'OAlg.Data.Dualisable.RightToLeft, n GHC.Types.~ OAlg.Entity.Natural.N2, OAlg.Data.Validable.XStandard p, OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram t n m (OAlg.Structure.Oriented.Definition.Orientation p))) => OAlg.Data.Validable.XStandard (OAlg.Limes.Cone.Definition.Cone OAlg.Structure.Distributive.Definition.Dst 'OAlg.Limes.Perspective.Injective t n m (OAlg.Structure.Oriented.Definition.Orientation p))
-- | eligible factors between Cones.
module OAlg.Limes.Cone.EligibleFactor
-- | eligibility of a factor between two cones.
--
-- Property Let x be in a and f,
-- t in Cone s p t n
-- m a with cnDiagram f ==
-- cnDiagram t, then holds:
--
--
-- - If p is equal to Projective then
-- holds: cnEligibleFactor x f t is True if and
-- only if
- orientation x == tip f
-- :> tip t.
- ti * x ==
-- fi for all ti in shell t and fi
-- in shell f.
-- - If p is equal to Injective then
-- holds: cnEligibleFactor x f t is True if and
-- only if
- orientation x == tip f
-- :> tip t.
- x * ti ==
-- fi for all ti in shell t and fi
-- in shell f.
--
cnEligibleFactor :: a -> Cone s p t n m a -> Cone s p t n m a -> Bool
-- | predicate for eligible factors between cones.
--
-- Property Let e be in EligibleFactor
-- s p t n m a for a
-- Multiplicative structure a, then holds:
--
--
-- - If e matches EligibleFactorTo l x c then
-- holds: cnDiagram l == cnDiagram c and
-- cnEligibleFactor x c l.
-- - If e matches EligibleFactorFrom l x c
-- then holds: cnDiagram l == cnDiagram c
-- and cnEligibleFactor x l c.
--
data EligibleFactor s p t n m a
[EligibleFactorTo] :: Cone s Projective t n m a -> a -> Cone s Projective t n m a -> EligibleFactor s Projective t n m a
[EligibleFactorFrom] :: Cone s Injective t n m a -> a -> Cone s Injective t n m a -> EligibleFactor s Injective t n m a
-- | the underlying factor together with its cone.
elfFactorCone :: EligibleFactor s p t n m a -> (a, Cone s p t n m a)
-- | mapping of a eligible factor.
elfMap :: Hom s h => h a b -> EligibleFactor s p t n m a -> EligibleFactor s p t n m b
-- | to the dual, with its inverse coEligibleFactorInv.
coEligibleFactor :: EligibleFactor s p t n m a -> Dual (EligibleFactor s p t n m a)
-- | from the dual, with its inverse coEligibleFactor.
coEligibleFactorInv :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Dual (EligibleFactor s p t n m a) -> EligibleFactor s p t n m a
-- | from the bidual.
elfFromOpOp :: ConeStruct s a -> EligibleFactor s p t n m (Op (Op a)) -> EligibleFactor s p t n m a
-- | the induced random variable of eligible factors.
xopEligibleFactor :: ConeStruct s a -> XOrtPerspective p a -> Cone s p t n m a -> X (EligibleFactor s p t n m a)
-- | random variable given by a XOrtSite.
data XOrtPerspective p a
[XOrtProjective] :: XOrtSite To a -> XOrtPerspective Projective a
[XOrtInjective] :: XOrtSite From a -> XOrtPerspective Injective a
-- | standard random variable for XOrtPerspective.
class XStandardOrtPerspective p a
xStandardOrtPerspective :: XStandardOrtPerspective p a => XOrtPerspective p a
-- | the induced random variable of eligible factors.
xosEligibleFactorPrj :: XOrtSite To a -> Cone s Projective t n m a -> X (EligibleFactor s Projective t n m a)
-- | the induced random variable of eligible factors.
xosEligibleFactorInj :: ConeStruct s a -> (Dual (Dual t) :~: t) -> XOrtSite From a -> Cone s Injective t n m a -> X (EligibleFactor s Injective t n m a)
instance GHC.Show.Show a => GHC.Show.Show (OAlg.Limes.Cone.EligibleFactor.EligibleFactor s p t n m a)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSiteTo a => OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective 'OAlg.Limes.Perspective.Projective a
instance OAlg.Structure.Oriented.Definition.XStandardOrtSiteFrom a => OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective 'OAlg.Limes.Perspective.Injective a
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Limes.Cone.EligibleFactor.EligibleFactor s p t n m a)
-- | cones over diagrams.
module OAlg.Limes.Cone
-- | definition of a Limes of a Diagram.
module OAlg.Limes.Definition
-- | limes of a diagram, i.e. a distinguished cone over a given diagram
-- having the following universal property
--
-- Property Let a be a Multiplicative
-- structure and u in Limes s p
-- t n m a then holds: Let l =
-- universalCone u in
--
--
-- - l is valid.
-- - eligibleCone u l.
-- - eligibleFactor u l (one (tip
-- l)).
-- - For all c in Cone s p t
-- n m a with eligibleCone u c
-- holds: Let f = universalFactor u c
-- in
- f is
-- valid.
- eligibleFactor u c
-- f.
- For all x in a with
-- eligibleFactor u c x holds: x ==
-- f.
--
--
-- Note
--
--
-- - As the function universalFactor l for a given
-- limes l is uniquely determined by the underlying cone of
-- l, it is permissible to test equality of two limits just by
-- there underling cones. In every computation equal limits can be safely
-- replaced by each other.
-- - It is not required that the evaluation of universal factor on a
-- non eligible cone yield an exception! The implementation of the
-- general algorithms for limits do not check for eligibility.
--
data Limes s p t n m a
[LimesProjective] :: Cone s Projective t n m a -> (Cone s Projective t n m a -> a) -> Limes s Projective t n m a
[LimesInjective] :: Cone s Injective t n m a -> (Cone s Injective t n m a -> a) -> Limes s Injective t n m a
-- | the universal point of a limes, i.e. the tip of the universal cone.
universalPoint :: Limes s p t n m a -> Point a
-- | the underlying universal cone of a limes.
universalCone :: Limes s p t n m a -> Cone s p t n m a
-- | the shell of the universal cone.
universalShell :: Limes s p t n m a -> FinList n a
-- | the universal factor of a Limes l to a given eligible
-- cone.
--
-- Property Let l be in Limes s
-- p t n m a then holds: For all
-- c in Cone s p t n
-- m a with eligibleCone l c holds:
-- eligibleFactor l c (universalFactor l c).
universalFactor :: Limes s p t n m a -> Cone s p t n m a -> a
-- | the underlying diagram of a limes.
diagram :: Limes s p t n m a -> Diagram t n m a
-- | reflexivity of the underlying diagram type.
lmDiagramTypeRefl :: Limes s p t n m a -> Dual (Dual t) :~: t
-- | eligibility of a cone with respect to a limes.
--
-- Property Let u be in Limes s
-- p t n m a and c in
-- Cone s p t n m
-- a then holds: eligibleCone u c is true if
-- and only if diagram u == cnDiagram c is
-- true.
eligibleCone :: Oriented a => Limes s p t n m a -> Cone s p t n m a -> Bool
-- | eligibility of a factor with respect to a limes and a cone.
--
-- Property Let u be in Limes s
-- p t n m a, c in
-- Cone s p t n m
-- a with eligibleCone u c and x in
-- a then holds:
--
--
-- - If u matches LimesProjective l _ then
-- holds: eligibleFactor u c x is true if and only if
-- cnEligibleFactor x c l is true.
-- - If u matches LimesInjective l _ then
-- holds: eligibleFactor u c x is true if and only if
-- cnEligibleFactor x l c is true.
--
eligibleFactor :: Limes s p t n m a -> Cone s p t n m a -> a -> Bool
-- | mapping between limits.
lmMap :: IsoOrt s h => h a b -> Limes s p t n m a -> Limes s p t n m b
-- | to g (Op a).
lmToOp :: LimesDuality s f g a -> f a -> g (Op a)
-- | from g (Op a).
lmFromOp :: LimesDuality s f g a -> g (Op a) -> f a
-- | Op-duality between limes types.
data LimesDuality s f g a
[LimesDuality] :: ConeStruct s a -> (f a :~: Limes s p t n m a) -> (g (Op a) :~: Dual (Limes s p t n m a)) -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> LimesDuality s f g a
-- | the co limes with its inverse coLimesInv.
coLimes :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Limes s p t n m a -> Dual (Limes s p t n m a)
-- | the inverse of coLimes.
coLimesInv :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Dual (Limes s p t n m a) -> Limes s p t n m a
-- | from Op . Op.
lmFromOpOp :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Limes s p t n m (Op (Op a)) -> Limes s p t n m a
-- | projective limes on oriented structures.
lmToPrjOrnt :: (Entity p, a ~ Orientation p) => p -> Diagram t n m a -> Limes Mlt Projective t n m a
-- | injective limes on oriented structures.
lmFromInjOrnt :: (Entity p, a ~ Orientation p) => p -> Diagram t n m a -> Limes Mlt Injective t n m a
-- | validity of a Limes.
relLimes :: ConeStruct s a -> XOrtPerspective p a -> Limes s p t n m a -> Statement
-- | limes exceptions which are sub exceptions from
-- SomeOAlgException.
data LimesException
ConeNotEligible :: String -> LimesException
instance GHC.Show.Show OAlg.Limes.Definition.LimesException
instance GHC.Classes.Eq OAlg.Limes.Definition.LimesException
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Limes.Definition.Limes s p t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Classes.Eq (OAlg.Limes.Definition.Limes s p t n m a)
instance OAlg.Hom.Multiplicative.Definition.IsoMultiplicative h => OAlg.Category.Applicative.Applicative1 h (OAlg.Limes.Definition.Limes OAlg.Structure.Multiplicative.Definition.Mlt p t n m)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a) => OAlg.Data.Validable.Validable (OAlg.Limes.Definition.Limes OAlg.Structure.Multiplicative.Definition.Mlt p t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Data.Validable.Validable (OAlg.Limes.Definition.Limes OAlg.Structure.Distributive.Definition.Dst p t n m a)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Entity.Definition.Entity (OAlg.Limes.Definition.Limes OAlg.Structure.Multiplicative.Definition.Mlt p t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Entity.Definition.Entity (OAlg.Limes.Definition.Limes OAlg.Structure.Distributive.Definition.Dst p t n m a)
instance GHC.Exception.Type.Exception OAlg.Limes.Definition.LimesException
-- | Limits of Diagrams, i.e. assigning to each diagram a
-- Limes over the given diagram.
module OAlg.Limes.Limits
-- | limes of a diagram, i.e. assigning to each diagram a limes over the
-- given diagram.
--
-- Property Let lms be in Limits s
-- p t n m a and d in
-- Diagram t n m a then
-- holds: diagram (limes lms d) == d.
newtype Limits s p t n m a
Limits :: (Diagram t n m a -> Limes s p t n m a) -> Limits s p t n m a
-- | the limes over the given diagram.
limes :: Limits s p t n m a -> Diagram t n m a -> Limes s p t n m a
-- | mapping of limits.
lmsMap :: IsoOrt s h => h a b -> Limits s p t n m a -> Limits s p t n m b
-- | to g (Op a).
lmsToOp :: LimitsDuality s f g a -> f a -> g (Op a)
-- | from g (Op a).
lmsFromOp :: LimitsDuality s f g a -> g (Op a) -> f a
-- | Op-duality between limits types.
data LimitsDuality s f g a
[LimitsDuality] :: ConeStruct s a -> (f a :~: Limits s p t n m a) -> (g (Op a) :~: Dual (Limits s p t n m a)) -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> LimitsDuality s f g a
-- | the co limits wit its inverse coLimitsInv.
coLimits :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Limits s p t n m a -> Dual (Limits s p t n m a)
-- | from the co limits, with its inverse of coLimits.
coLimitsInv :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Dual (Limits s p t n m a) -> Limits s p t n m a
-- | from the bidual.
lmsFromOpOp :: ConeStruct s a -> (Dual (Dual p) :~: p) -> (Dual (Dual t) :~: t) -> Limits s p t n m (Op (Op a)) -> Limits s p t n m a
-- | projective limits for Orientation p.
lmsToPrjOrnt :: Entity p => p -> Limits Mlt Projective t n m (Orientation p)
-- | injective limits for Orientation p.
lmsFromInjOrnt :: Entity p => p -> Limits Mlt Injective t n m (Orientation p)
-- | validity according to Limits, relative to the given random
-- variable for Diagrams.
prpLimits :: ConeStruct s a -> Limits s p t n m a -> X (Diagram t n m a) -> XOrtPerspective p a -> Statement
-- | validity according to Limits.
prpLimitsDiagram :: ConeStruct s a -> XOrtPerspective p a -> Limits s p t n m a -> Diagram t n m a -> Statement
instance OAlg.Hom.Multiplicative.Definition.IsoMultiplicative h => OAlg.Category.Applicative.Applicative1 h (OAlg.Limes.Limits.Limits OAlg.Structure.Multiplicative.Definition.Mlt p t n m)
instance OAlg.Hom.Distributive.IsoDistributive h => OAlg.Category.Applicative.Applicative1 h (OAlg.Limes.Limits.Limits OAlg.Structure.Distributive.Definition.Dst p t n m)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative a, OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram t n m a), OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a) => OAlg.Data.Validable.Validable (OAlg.Limes.Limits.Limits OAlg.Structure.Multiplicative.Definition.Mlt p t n m a)
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Data.Validable.XStandard (OAlg.Entity.Diagram.Definition.Diagram t n m a), OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a) => OAlg.Data.Validable.Validable (OAlg.Limes.Limits.Limits OAlg.Structure.Distributive.Definition.Dst p t n m a)
-- | terminal and initial point within a Multiplicative structure,
-- i.e. limits of Diagram Empty.
module OAlg.Limes.TerminalAndInitialPoint
-- | terminal point within a Multiplicative structure.
type Terminals = Limits Mlt Projective 'Empty N0 N0
-- | terminal point as Limes.
type TerminalPoint = Limes Mlt Projective 'Empty N0 N0
-- | Cone for a terminal point.
type TerminalCone = Cone Mlt Projective 'Empty N0 N0
-- | Diagram for a terminal point.
type TerminalDiagram = Diagram 'Empty N0 N0
-- | the terminal diagram.
trmDiagram :: TerminalDiagram a
-- | the terminal cone of a given point.
trmCone :: Multiplicative a => Point a -> TerminalCone a
-- | the terminal limes of a given point p.
terminalPointOrnt :: Entity p => p -> TerminalPoint (Orientation p)
-- | terminals for Orientation.
trmsOrnt :: Entity p => p -> Terminals (Orientation p)
-- | initial point within a Multiplicative structure.
type Initials = Limits Mlt Injective 'Empty N0 N0
-- | initial point as Limes.
type InitialPoint = Limes Mlt Injective 'Empty N0 N0
-- | Cone for a initial point.
type InitialCone = Cone Mlt Injective 'Empty N0 N0
-- | Diagram for a initial point.
type InitialDiagram = Diagram 'Empty N0 N0
-- | the initial diagram.
intDiagram :: InitialDiagram a
-- | the initial cone of a given point.
intCone :: Multiplicative a => Point a -> InitialCone a
-- | initial point for Orientation.
initialPointOrnt :: Entity p => p -> InitialPoint (Orientation p)
-- | initials.
intsOrnt :: Entity p => p -> Initials (Orientation p)
-- | terminal Diagram duality.
trmDiagramDuality :: Oriented a => DiagramDuality TerminalDiagram InitialDiagram a
-- | terminal Cone duality.
trmConeDuality :: Multiplicative a => ConeDuality Mlt TerminalCone InitialCone a
-- | terminal Limes duality.
trmLimesDuality :: Multiplicative a => LimesDuality Mlt TerminalPoint InitialPoint a
-- | terminal Limits duality.
trmLimitsDuality :: Multiplicative a => LimitsDuality Mlt Terminals Initials a
-- | initial Diagram duality.
intDiagramDuality :: Oriented a => DiagramDuality InitialDiagram TerminalDiagram a
-- | initial Cone duality.
intConeDuality :: Multiplicative a => ConeDuality Mlt InitialCone TerminalCone a
-- | initial Limes duality.
intLimesDuality :: Multiplicative a => LimesDuality Mlt InitialPoint TerminalPoint a
-- | initial Limits duality.
intLimitsDuality :: Multiplicative a => LimitsDuality Mlt Initials Terminals a
-- | minima and maxima within a Multiplicative structure, i.e.
-- limits of Diagram (Chain t).
module OAlg.Limes.MinimaAndMaxima
-- | minima for a Multiplicative structure.
type Minima t n = Limits Mlt Projective (Chain t) (n + 1) n
-- | minimum as Limes.
type Minimum t n = Limes Mlt Projective (Chain t) (n + 1) n
-- | Cone for a minimum.
type MinimumCone t n = Cone Mlt Projective (Chain t) (n + 1) n
-- | Diagram for a minimum.
type MinimumDiagram t n = Diagram (Chain t) (n + 1) n
-- | minima according to Chain To.
minimaTo :: Multiplicative a => Minima To n a
-- | minima according to Chain From.
minimaFrom :: Multiplicative a => Minima From n a
-- | maxima for a Multiplicative structure.
type Maxima t n = Limits Mlt Injective (Chain t) (n + 1) n
-- | maximum as a Limes.
type Maximum t n = Limes Mlt Injective (Chain t) (n + 1) n
-- | Cone for a maximum.
type MaximumCone t n = Cone Mlt Injective (Chain t) (n + 1) n
-- | Diagram for a maximum.
type MaximumDiagram t n = Diagram (Chain t) (n + 1) n
-- | maxima according to Chain To.
maximaTo :: Multiplicative a => Maxima To n a
-- | maxima according to Chain To given by two proxy
-- types.
maximaTo' :: Multiplicative a => p n -> f a -> Maxima To n a
-- | maxima according to Chain From.
maximaFrom :: Multiplicative a => Maxima From n a
-- | maxima according to Chain From given by two
-- proxy types.
maximaFrom' :: Multiplicative a => p n -> f a -> Maxima From n a
-- | duality between Maxima To and Minima
-- From.
maxLimitsDualityTo :: Multiplicative a => LimitsDuality Mlt (Maxima To n) (Minima From n) a
-- | duality between Maxima From and
-- Minima To.
maxLimitsDualityFrom :: Multiplicative a => LimitsDuality Mlt (Maxima From n) (Minima To n) a
-- | products and sums, i.e. limits of Diagram
-- Discrete.
module OAlg.Limes.ProductsAndSums
-- | products for a Multiplicative structure.
type Products n = Limits Mlt Projective Discrete n N0
-- | product as a Limes.
type Product n = Limes Mlt Projective Discrete n N0
-- | Cone for a product.
type ProductCone n = Cone Mlt Projective Discrete n N0
-- | Diagram for a product.
type ProductDiagram n = Diagram Discrete n N0
-- | the underlying product diagram.
prdDiagram :: Oriented a => Diagram (Star From) (n + 1) n a -> ProductDiagram n a
-- | the product cone.
prdCone :: Multiplicative a => Diagram (Star From) (n + 1) n a -> ProductCone n a
-- | products of n points given by products of zero and two
-- points.
products :: Multiplicative a => Products N0 a -> Products N2 a -> Products n a
-- | products of zero points given by a terminal point.
products0 :: Multiplicative a => TerminalPoint a -> Products N0 a
-- | products of one point, i.e. Minima.
products1 :: Multiplicative a => Products N1 a
-- | products of at least two points given by products of two points.
products2 :: Multiplicative a => Products N2 a -> Products (n + 2) a
-- | product cone for Orientation.
prdConeOrnt :: Entity p => p -> FinList n p -> ProductCone n (Orientation p)
-- | product for Orientation.
productOrnt :: Entity p => p -> FinList n p -> Product n (Orientation p)
-- | products for Orientation.
productsOrnt :: Entity p => p -> Products n (Orientation p)
-- | sums for a Multiplicative structure.
type Sums n = Limits Mlt Injective Discrete n N0
-- | sum as a 'Limes.
type Sum n = Limes Mlt Injective Discrete n N0
-- | Cone for a sum.
type SumCone n = Cone Mlt Injective Discrete n N0
-- | Diagram for a sum.
type SumDiagram n = Diagram Discrete n N0
-- | duality between sums and products.
sumLimitsDuality :: Multiplicative a => LimitsDuality Mlt (Sums n) (Products n) a
-- | the underlying sum diagram given by a sink diagram.
sumDiagram :: Oriented a => Diagram (Star To) (n + 1) n a -> SumDiagram n a
-- | the sum cone given by a sink diagram.
sumCone :: Multiplicative a => Diagram (Star To) (n + 1) n a -> SumCone n a
-- | sums of n points given by sums of zero and two points.
sums :: Multiplicative a => Sums N0 a -> Sums N2 a -> Sums n a
-- | sums given by a proxy type for n.
sums' :: Multiplicative a => p n -> Sums N0 a -> Sums N2 a -> Sums n a
-- | sums of zero points given by a initial point.
sums0 :: Multiplicative a => InitialPoint a -> Sums N0 a
-- | sums of one point, i.e. Maxima.
sums1 :: Multiplicative a => Sums N1 a
-- | sums of at least two points given by sums of two points.
sums2 :: Multiplicative a => Sums N2 a -> Sums (n + 2) a
-- | sum cone for Orientation.
sumConeOrnt :: Entity p => p -> FinList n p -> SumCone n (Orientation p)
-- | sum for Orientation.
sumOrnt :: Entity p => p -> FinList n p -> Sum n (Orientation p)
-- | sums for Orientation.
sumsOrnt :: Entity p => p -> Sums n (Orientation p)
-- | equalizers and coequalizers, i.e. limits of Diagram
-- (Parallel d).
module OAlg.Limes.EqualizersAndCoequalizers
-- | equalizers for a Multiplicative structures.
type Equalizers n = Limits Mlt Projective (Parallel LeftToRight) N2 n
-- | equalizer as Limes.
type Equalizer n = Limes Mlt Projective (Parallel LeftToRight) N2 n
-- | Cone for a equalizer.
type EqualizerCone n = Cone Mlt Projective (Parallel LeftToRight) N2 n
-- | Diagram for a equalizer.
type EqualizerDiagram n = Diagram (Parallel LeftToRight) N2 n
-- | equalizers of n arrows given by products of two points and
-- equalizers of two arrows.
equalizers :: Multiplicative a => Products N2 a -> Equalizers N2 a -> Equalizers n a
-- | the induced equalizers of zero parallel arrows.
equalizers0 :: Multiplicative a => Products N2 a -> Equalizers N0 a
-- | equalizers of one parallel arrow, i.e. Minima.
equalizers1 :: Multiplicative a => Equalizers N1 a
-- | promoting equalizers.
--
equalizers2 :: Multiplicative a => Equalizers N2 a -> Equalizers (n + 2) a
-- | equalizers for Orientation
equalizersOrnt :: Entity p => p -> Equalizers n (Orientation p)
-- | coequalizers for a Multiplicative structure.
type Coequalizers n = Limits Mlt Injective (Parallel RightToLeft) N2 n
-- | coequalizer as 'Limes.
type Coequalizer n = Limes Mlt Injective (Parallel RightToLeft) N2 n
-- | Cone for a coequalizer.
type CoequalizerCone n = Cone Mlt Injective (Parallel RightToLeft) N2 n
-- | Diagram for a coequalizer.
type CoequalizerDiagram n = Diagram (Parallel RightToLeft) N2 n
-- | coequalizers of n arrows given by sums of two points and
-- coequalizers of two arrows.
coequalizers :: Multiplicative a => Sums N2 a -> Coequalizers N2 a -> Coequalizers n a
-- | coequalizers given by a proxy for n.
coequalizers' :: Multiplicative a => p n -> Sums N2 a -> Coequalizers N2 a -> Coequalizers n a
-- | coequalizers for Orientation.
coequalizersOrnt :: Entity p => p -> Coequalizers n (Orientation p)
-- | duality between coequalizers and equalizers.
coeqlLimitsDuality :: Multiplicative a => LimitsDuality Mlt (Coequalizers n) (Equalizers n) a
-- | pullbacks and pushouts, i.e. limits of Diagram (Star
-- d).
module OAlg.Limes.PullbacksAndPushouts
-- | pullbacks for Multiplicative structures.
type Pullbacks n = Limits Mlt Projective (Star To) (n + 1) n
-- | pullback as Limes.
type Pullback n = Limes Mlt Projective (Star To) (n + 1) n
-- | Cone for a pullback.
type PullbackCone n = Cone Mlt Projective (Star To) (n + 1) n
-- | Diagram for a pullback.
type PullbackDiagram n = Diagram (Star To) (n + 1) n
-- | promotion of pullbacks.
--
pullbacks :: Multiplicative a => Pullbacks N2 a -> Pullbacks n a
-- | pullbacks for zero arrows as Minima.
pullbacks0 :: Multiplicative a => Pullbacks N0 a
-- | pullbacks of one arrow, i.e. Minima.
pullbacks1 :: Multiplicative a => Pullbacks N1 a
-- | pullbacks given by products and equalizers.
plbPrdEql2 :: Multiplicative a => Products N2 a -> Equalizers N2 a -> Pullbacks N2 a
-- | pullbacks for Orientation.
pullbacksOrnt :: Entity p => p -> Pullbacks n (Orientation p)
-- | pushouts for a Multiplicative structures.
type Pushouts n = Limits Mlt Injective (Star From) (n + 1) n
-- | pushout as Limes.
type Pushout n = Limes Mlt Injective (Star From) (n + 1) n
-- | Cone for a pushout.
type PushoutCone n = Cone Mlt Injective (Star From) (n + 1) n
-- | Diagram for a pushout.
type PushoutDiagram n = Diagram (Star From) (n + 1) n
-- | promotion of pushouts.
pushouts :: Multiplicative a => Pushouts N2 a -> Pushouts n a
-- | pushouts given by a proxy for n.
pushouts' :: Multiplicative a => p n -> Pushouts N2 a -> Pushouts n a
-- | pushouts given by sums and coequalizers.
pshSumCoeql2 :: Multiplicative a => Sums N2 a -> Coequalizers N2 a -> Pushouts N2 a
-- | pushouts for Orientation.
pushoutsOrnt :: Entity p => p -> Pushouts n (Orientation p)
-- | duality between pushouts and pullbacks.
pshLimitsDuality :: Multiplicative a => LimitsDuality Mlt (Pushouts n) (Pullbacks n) a
-- | kernels and cokernels, i.e. limits in a Distributive structure
-- of Diagram (Parallel d) making all
-- arrows zero.
module OAlg.Limes.KernelsAndCokernels
-- | kernels for Distributive structures.
type Kernels n = Limits Dst Projective (Parallel LeftToRight) N2 n
-- | kernel as a Limes.
type Kernel n = Limes Dst Projective (Parallel LeftToRight) N2 n
-- | Cone for a kernel.
type KernelCone n = Cone Dst Projective (Parallel LeftToRight) N2 n
-- | Diagram for a kernel.
type KernelDiagram n = Diagram (Parallel LeftToRight) N2 n
-- | the factor of its shell.
kernelFactor :: KernelCone N1 c -> c
-- | the kernel diagram of a given factor.
kernelDiagram :: Oriented c => c -> KernelDiagram N1 c
-- | promoting kernels.
kernels :: Distributive a => Kernels N1 a -> Kernels n a
-- | kernels for zero arrows.
kernels0 :: Distributive a => Kernels N0 a
-- | promoting kernels.
kernels1 :: Distributive a => Kernels N1 a -> Kernels (n + 1) a
-- | the induced equalizers where its first arrow is zero.
krnEqls :: (Distributive a, Abelian a) => Kernels n a -> Equalizers (n + 1) a
-- | the induced kernels given by adjoining a zero arrow as first
-- arrow.
eqlKrns :: Distributive a => Equalizers (n + 1) a -> Kernels n a
-- | the kernel of the zero factor given by the orientation, i.e.
-- one
kernelZero :: Distributive c => p c -> Orientation (Point c) -> Kernel N1 c
-- | kernels for Orientation.
kernelsOrnt :: Entity p => p -> Kernels n (Orientation p)
-- | cokernels for Distributive structures.
type Cokernels n = Limits Dst Injective (Parallel RightToLeft) N2 n
-- | cokernel as Limes.
type Cokernel n = Limes Dst Injective (Parallel RightToLeft) N2 n
-- | Cone for a cokernel.
type CokernelCone n = Cone Dst Injective (Parallel RightToLeft) N2 n
-- | Diagram for a cokernel.
type CokernelDiagram n = Diagram (Parallel RightToLeft) N2 n
-- | the factor of its shell.
cokernelFactor :: CokernelCone N1 c -> c
-- | the cokernel diagram of a given factor.
cokernelDiagram :: Oriented c => c -> CokernelDiagram N1 c
-- | promoting cokernels.
cokernels :: Distributive a => Cokernels N1 a -> Cokernels n a
-- | cokernels given by an additional proxy for n.
cokernels' :: Distributive a => p n -> Cokernels N1 a -> Cokernels n a
-- | cokernels for Orientation.
cokernelsOrnt :: Entity p => p -> Cokernels n (Orientation p)
-- | duality from Kernel to Cokernel.
krnLimesDuality :: Distributive a => LimesDuality Dst (Kernel n) (Cokernel n) a
-- | duality between Cokernel to Kernel.
cokrnLimesDuality :: Distributive a => LimesDuality Dst (Cokernel n) (Kernel n) a
-- | checks if the arrows of the kernel diagram are equal to the given ones
-- and if its shell is equal to the given arrow.
--
-- Property Let LimesProjective ('ConeKerenl d k') _ =
-- ker be in Kernel n a, fs
-- in FinList n a and k be in
-- a, then the statement prpIsKernel ker fs
-- k holds if and only if
--
--
-- - fs == dgArrows d.
-- - k == k'.
--
prpIsKernel :: Distributive a => Kernel n a -> FinList n a -> a -> Statement
-- | checks if the arrows of the cokernel diagram are equal to the given
-- ones and if its shell is equal to the given arrow.
--
-- Property Let LimesInjective ('ConeCokerenl d k') _ =
-- coker be in Cokernel n a,
-- fs in FinList n a and
-- k be in a, then the statement
-- prpIsCokernel coker fs k holds if and only if
--
--
-- - fs == dgArrows d.
-- - k == k'.
--
prpIsCokernel :: Distributive a => Cokernel n a -> FinList n a -> a -> Statement
-- | propositions on Limits.
module OAlg.Limes.Proposition
-- | validity of Limits for Orientation
-- Symbol.
prpLimitsOrntSymbol :: Statement
-- | definition of slicing a Multiplicative structures according a
-- given indexed Point.
module OAlg.Entity.Slice.Definition
-- | slice over c by a given Site and indexed by
-- i.
data Slice s i c
[SliceFrom] :: i c -> c -> Slice From i c
[SliceTo] :: i c -> c -> Slice To i c
-- | the underlying slice.
slice :: Slice s i c -> c
-- | factor between two slices.
--
-- Property Let SliceFactor a b f be in
-- SliceFactor s i c for a
-- Multiplicative structure c constrained by
-- Sliced i c then holds:
--
--
-- - If a matches SliceFrom _ a' then holds:
-- Let SliceFrom _ b' = b
-- in
- orientation f == end a'
-- :> end b'.
- b' == f *
-- a'.
-- - If a matches SliceTo _ a' then holds: Let
-- SliceTo _ b' = b in
- orientation f
-- == start a' :> start
-- b'.
- a' == b' * f .
--
data SliceFactor s i c
SliceFactor :: Slice s i c -> Slice s i c -> c -> SliceFactor s i c
-- | the underlying factor.
slfDrop :: SliceFactor s i c -> c
-- | Slicing a Multiplicative structures at the Point given
-- by the type of the index i.
--
-- Note The constraint Singleton1 i ensures
-- that the distinguished point depends only on the type i
-- c.
class (Entity1 i, Singleton1 i) => Sliced i c
-- | the distingueished point of the given index type i.
slicePoint :: Sliced i c => i c -> Point c
-- | dropping a slice factor.
data SliceFactorDrop s x y
[SliceFactorFromDrop] :: (Multiplicative c, Sliced i c) => SliceFactorDrop From (SliceFactor From i c) c
[SliceFactorToDrop] :: (Multiplicative c, Sliced i c) => SliceFactorDrop To (SliceFactor To i c) c
-- | predicate for a Star t diagram with center
-- Point given by the index type i c.
--
-- Property Let DiagramSlicedCenter i d be in
-- DiagramSlicedCenter i t n m
-- c then holds: slicePoint i ==
-- dgCenter d.
data DiagramSlicedCenter i t n m c
[DiagramSlicedCenter] :: Sliced i c => i c -> Diagram (Star t) n m c -> DiagramSlicedCenter i t n m c
-- | predicate for a limes with a sliced tip of the universal cone.
--
-- Property Let LimesSlicedTip i l be in
-- LimesSlicedTip i s p t n
-- m c then holds: tip
-- (universalCone l) == slicePoint i.
data LimesSlicedTip i s p t n m c
[LimesSlicedTip] :: Sliced i c => i c -> Limes s p t n m c -> LimesSlicedTip i s p t n m c
-- | the underlying limes.
lstLimes :: LimesSlicedTip i s p t n m c -> Limes s p t n m c
-- | terminal point for factors sliced to a Point.
slfTerminalPoint :: (Multiplicative c, Sliced i c) => TerminalPoint (SliceFactor To i c)
-- | the induced pullback.
slfPullback :: Multiplicative c => Products n (SliceFactor To i c) -> DiagramSlicedCenter i To (n + 1) n c -> Pullback n c
-- | the induced Injective Limits.
slfLimitsInjective :: (Multiplicative c, Sliced i c) => Limits Mlt Injective t n m c -> Limits Mlt Injective t n m (SliceFactor To i c)
-- | the induced random variable.
xSliceTo :: Sliced i c => XOrtSite To c -> i c -> X (Slice To i c)
-- | the induced random variable.
xSliceFrom :: Sliced i c => XOrtSite From c -> i c -> X (Slice From i c)
-- | the induced random variable.
xosXOrtSiteToSliceFactorTo :: (Multiplicative c, Sliced i c) => XOrtSite To c -> i c -> XOrtSite To (SliceFactor To i c)
-- | the induced random variable.
xosXOrtSiteFromSliceFactorFrom :: (Multiplicative c, Sliced i c) => XOrtSite From c -> i c -> XOrtSite From (SliceFactor From i c)
instance (OAlg.Data.Equal.Eq1 i, GHC.Classes.Eq c) => GHC.Classes.Eq (OAlg.Entity.Slice.Definition.SliceFactor s i c)
instance (OAlg.Data.Show.Show1 i, GHC.Show.Show c) => GHC.Show.Show (OAlg.Entity.Slice.Definition.SliceFactor s i c)
instance GHC.Show.Show (OAlg.Entity.Slice.Definition.SliceFactorDrop s x y)
instance GHC.Classes.Eq (OAlg.Entity.Slice.Definition.SliceFactorDrop s x y)
instance OAlg.Data.Show.Show2 (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance OAlg.Data.Equal.Eq2 (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Definition.SliceFactorDrop s x y)
instance OAlg.Data.Validable.Validable2 (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance (Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable x, Data.Typeable.Internal.Typeable y) => OAlg.Entity.Definition.Entity (OAlg.Entity.Slice.Definition.SliceFactorDrop s x y)
instance Data.Typeable.Internal.Typeable s => OAlg.Entity.Definition.Entity2 (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance OAlg.Category.Definition.Morphism (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Slice.Definition.SliceFactorDrop s) OAlg.Structure.Definition.Typ
instance OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Slice.Definition.SliceFactorDrop s) OAlg.Structure.Oriented.Definition.Ort
instance OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Slice.Definition.SliceFactorDrop s) OAlg.Structure.Multiplicative.Definition.Mlt
instance OAlg.Category.Applicative.Applicative (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance Data.Typeable.Internal.Typeable s => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance Data.Typeable.Internal.Typeable s => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Entity.Slice.Definition.SliceFactorDrop s)
instance OAlg.Structure.Oriented.Definition.Oriented c => GHC.Show.Show (OAlg.Entity.Slice.Definition.LimesSlicedTip i s p t n m c)
instance (OAlg.Structure.Oriented.Definition.Oriented c, OAlg.Data.Validable.Validable (OAlg.Limes.Definition.Limes s p t n m c)) => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Definition.LimesSlicedTip i s p t n m c)
instance OAlg.Structure.Oriented.Definition.Oriented c => GHC.Show.Show (OAlg.Entity.Slice.Definition.DiagramSlicedCenter i t n m c)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Definition.DiagramSlicedCenter i t n m c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Definition.SliceFactor s i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, Data.Typeable.Internal.Typeable s) => OAlg.Entity.Definition.Entity (OAlg.Entity.Slice.Definition.SliceFactor s i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, Data.Typeable.Internal.Typeable s) => OAlg.Structure.Oriented.Definition.Oriented (OAlg.Entity.Slice.Definition.SliceFactor s i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, Data.Typeable.Internal.Typeable s) => OAlg.Structure.Multiplicative.Definition.Multiplicative (OAlg.Entity.Slice.Definition.SliceFactor s i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From c) => OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.From i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From c) => OAlg.Structure.Oriented.Definition.XStandardOrtSiteFrom (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.From i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From c) => OAlg.Data.Validable.XStandard (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.From i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From c) => OAlg.Data.Validable.XStandard (OAlg.Entity.Slice.Definition.Slice 'OAlg.Data.Dualisable.From i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From c) => OAlg.Structure.Oriented.Definition.XStandardPoint (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.From i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To c) => OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.To i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To c) => OAlg.Structure.Oriented.Definition.XStandardOrtSiteTo (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.To i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To c) => OAlg.Data.Validable.XStandard (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.To i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To c) => OAlg.Data.Validable.XStandard (OAlg.Entity.Slice.Definition.Slice 'OAlg.Data.Dualisable.To i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.To c) => OAlg.Structure.Oriented.Definition.XStandardPoint (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.To i c)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSite 'OAlg.Data.Dualisable.From (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.To Data.Proxy.Proxy OAlg.Structure.Oriented.Definition.OS)
instance OAlg.Structure.Oriented.Definition.XStandardOrtSiteFrom (OAlg.Entity.Slice.Definition.SliceFactor 'OAlg.Data.Dualisable.To Data.Proxy.Proxy OAlg.Structure.Oriented.Definition.OS)
instance (OAlg.Data.Show.Show1 i, GHC.Show.Show c) => GHC.Show.Show (OAlg.Entity.Slice.Definition.Slice s i c)
instance (OAlg.Data.Equal.Eq1 i, GHC.Classes.Eq c) => GHC.Classes.Eq (OAlg.Entity.Slice.Definition.Slice s i c)
instance (OAlg.Structure.Oriented.Definition.Oriented c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Definition.Slice s i c)
instance (OAlg.Structure.Oriented.Definition.Oriented c, OAlg.Entity.Slice.Definition.Sliced i c, Data.Typeable.Internal.Typeable s) => OAlg.Entity.Definition.Entity (OAlg.Entity.Slice.Definition.Slice s i c)
instance OAlg.Entity.Slice.Definition.Sliced i c => OAlg.Entity.Slice.Definition.Sliced i (OAlg.Data.Opposite.Op c)
instance OAlg.Entity.Slice.Definition.Sliced Data.Proxy.Proxy OAlg.Structure.Oriented.Definition.OS
-- | sliced structures with an assigned free Point of some
-- given dimension.
module OAlg.Entity.Slice.Free
-- | index for free points within a Multiplicative structure
-- c.
--
--
-- >>> lengthN (Free attest :: Free N3 c)
-- 3
--
newtype Free k c
Free :: Any k -> Free k c
-- | the underlying natural number.
freeN :: Free k c -> N
-- | casting between Free types.
castFree :: Free k x -> Free k y
-- | check for being a free point, i.e. if it is equal to
-- slicePoint.
--
-- Definition Let n be in Free n
-- c and p in Point c then we
-- call p of order n if and only if
-- slicePoint i == p.
isFree :: (Eq (Point c), Sliced (Free k) c) => Free k c -> Point c -> Bool
-- | some free attest.
data SomeFree c
[SomeFree] :: (Attestable k, Sliced (Free k) c) => Free k c -> SomeFree c
-- | some free point within a Multiplicative structure
-- c.
data SomeFreeSlice s c
[SomeFreeSlice] :: (Attestable k, Sliced (Free k) c) => Slice s (Free k) c -> SomeFreeSlice s c
-- | predicate for a limes with a free tip of its universal cone.
--
-- Property Let 'LimesFree k l be in LimesFree
-- s p t n m a and then
-- holds: slicePoint k == t where t =
-- tip (universalCone l).
data LimesFree s p t n m a
[LimesFree] :: (Attestable k, Sliced (Free k) a) => Free k a -> Limes s p t n m a -> LimesFree s p t n m a
-- | the underlying free limes.
limesFree :: LimesFree s p t n m a -> Limes s p t n m a
-- | predicate for diagrams with free points.
data DiagramFree t n m a
DiagramFree :: FinList n (SomeFree a) -> Diagram t n m a -> DiagramFree t n m a
-- | the underlying diagram.
dgfDiagram :: DiagramFree t n m a -> Diagram t n m a
-- | predicate for a kernel with a start point of its diagram given by the
-- slice index and a free universal tip.
--
-- Property Let KernelSliceFromSomeFreeTip k' i
-- ker be in KernelSliceFromSomeFreeTip n
-- c, then holds:
--
--
-- - slicePoint i == s where
-- DiagramParallelLR s _ _ = diagram ker.
-- - slicePoint k' == tip
-- (universalCone ker).
--
data KernelSliceFromSomeFreeTip n i c
[KernelSliceFromSomeFreeTip] :: (Attestable k', Sliced (Free k') c) => Free k' c -> i c -> Kernel n c -> KernelSliceFromSomeFreeTip n i c
-- | the underlying kernel.
ksfKernel :: KernelSliceFromSomeFreeTip n i c -> Kernel n c
-- | kernel of a diagram with free points.
type KernelFree = LimesFree Dst Projective (Parallel LeftToRight) N2
-- | kerne diagram with free points.
type KernelDiagramFree = DiagramFree (Parallel LeftToRight) N2
-- | cokernel diagrams with free points.
type CokernelDiagramFree = DiagramFree (Parallel RightToLeft) N2
-- | pullback of a diagram with free points.
type PullbackFree n c = LimesFree Mlt Projective (Star To) (n + 1) n c
-- | pullback diagram with free points.
type PullbackDiagramFree n c = DiagramFree (Star To) (n + 1) n c
instance (Data.Typeable.Internal.Typeable c, Data.Typeable.Internal.Typeable k) => OAlg.Entity.Definition.Entity (OAlg.Entity.Slice.Free.Free k c)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Free.Free k c)
instance GHC.Classes.Eq (OAlg.Entity.Slice.Free.Free k c)
instance GHC.Show.Show (OAlg.Entity.Slice.Free.Free k c)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Entity.Slice.Free.DiagramFree t n m a)
instance GHC.Show.Show (OAlg.Entity.Slice.Free.SomeFree c)
instance GHC.Show.Show c => GHC.Show.Show (OAlg.Entity.Slice.Free.SomeFreeSlice s c)
instance OAlg.Structure.Oriented.Definition.Oriented a => GHC.Show.Show (OAlg.Entity.Slice.Free.LimesFree s p t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented a => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Free.DiagramFree t n m a)
instance (OAlg.Structure.Oriented.Definition.Oriented c, OAlg.Entity.Slice.Definition.Sliced i c) => GHC.Show.Show (OAlg.Entity.Slice.Free.KernelSliceFromSomeFreeTip n i c)
instance (OAlg.Structure.Distributive.Definition.Distributive c, OAlg.Entity.Slice.Definition.Sliced i c, OAlg.Structure.Oriented.Definition.XStandardOrtSiteTo c, Data.Typeable.Internal.Typeable n) => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Free.KernelSliceFromSomeFreeTip n i c)
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Limes.Cone.EligibleFactor.XStandardOrtPerspective p a, Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable t, Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable m) => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Free.LimesFree OAlg.Structure.Distributive.Definition.Dst p t n m a)
instance OAlg.Structure.Oriented.Definition.Oriented c => OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Free.SomeFreeSlice s c)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Free.SomeFree c)
instance OAlg.Entity.Natural.Attestable k => OAlg.Data.Singleton.Singleton1 (OAlg.Entity.Slice.Free.Free k)
instance OAlg.Data.Show.Show1 (OAlg.Entity.Slice.Free.Free k)
instance OAlg.Data.Equal.Eq1 (OAlg.Entity.Slice.Free.Free k)
instance OAlg.Data.Validable.Validable1 (OAlg.Entity.Slice.Free.Free k)
instance Data.Typeable.Internal.Typeable k => OAlg.Entity.Definition.Entity1 (OAlg.Entity.Slice.Free.Free k)
-- | Products and Sums for matrices.
module OAlg.Entity.Matrix.ProductsAndSums
-- | products for matrices.
mtxProducts :: Distributive x => Products n (Matrix x)
-- | sums for matrices.
mtxSums :: Distributive x => Sums n (Matrix x)
-- | propositions on matrices.
module OAlg.Entity.Matrix.Proposition
-- | validity of the algebraic structure of matrices.
prpMatrix :: Distributive x => XOrtOrientation (Matrix x) -> XOrtSite From (Matrix x) -> XOrtSite To (Matrix x) -> Statement
-- | validity of the algebraic structure of block matrices of Z.
prpMatrixZ :: Statement
-- | matrices over Distributive structures
module OAlg.Entity.Matrix
-- | validation of this package.
module OAlg.Proposition
-- | Validation of the basic entities of the package oalg-base.
prpOAlgBase :: Statement
-- | mapping of Limits under Adjunctions.
module OAlg.Adjunction.Limes
-- | mapping a projective limes under an adjunction.
lmPrjMap :: Hom Mlt h => Adjunction h d c -> Limes Mlt Projective t n m d -> Limes Mlt Projective t n m c
-- | mapping a injective limes under an adjunction.
lmInjMap :: Hom Mlt h => Adjunction h d c -> Limes Mlt Injective t n m c -> Limes Mlt Injective t n m d
-- | mapping a projective limes under an adjunction.
lmPrjMapDst :: Hom Dst h => Adjunction h d c -> Limes Dst Projective t n m d -> Limes Dst Projective t n m c
-- | mapping a injective limes under an adjunction.
lmInjMapDst :: Hom Dst h => Adjunction h d c -> Limes Dst Injective t n m c -> Limes Dst Injective t n m d
-- | Adjunction between Multiplicative structures and the
-- Limes preserving property of adjoint structures.
module OAlg.Adjunction
-- | Cokernel-Kernel Adjunction for Sliced
-- structures.
module OAlg.Entity.Slice.Adjunction
-- | the cokernel-kenrel adjunction.
slcAdjunction :: (SliceCokernelTo i c, SliceKernelFrom i c) => i c -> Adjunction (SliceCokernelKernel i c) (SliceFactor From i c) (SliceFactor To i c)
-- | the left and right homomorphisms for the cokernel-kernel adjunction
-- slcAdjunction.
data SliceCokernelKernel i c x y
[SliceCokernel] :: SliceCokernelKernel i c (SliceFactor To i c) (SliceFactor From i c)
[SliceKernel] :: SliceCokernelKernel i c (SliceFactor From i c) (SliceFactor To i c)
-- | Distributive structures c having to each
-- Slice To i c a Cokernel.
--
-- Property Let h = SliceTo _ h' be in
-- Slice To i c for a
-- i sliced, Distributive structure
-- c, then holds:
--
-- diagram (universalCone coker) ==
-- cokernelDiagram h' where coker =
-- sliceCokernelTo h.
class (Distributive c, Sliced i c) => SliceCokernelTo i c
sliceCokernelTo :: SliceCokernelTo i c => Slice To i c -> Cokernel N1 c
-- | Distributive structures c having to each
-- Slice From i c a Kernel.
--
-- Property Let h = SliceFrom _ h' be in
-- Slice From i c for a
-- i sliced, Distributive structure
-- c, then holds:
--
-- diagram (universalCone ker) ==
-- kernelDiagram h' where coker = sliceKernelFrom
-- h.
class (Distributive c, Sliced i c) => SliceKernelFrom i c
sliceKernelFrom :: SliceKernelFrom i c => Slice From i c -> Kernel N1 c
-- | the right unit of the cokernel-kernel adjunction slcAdjunction.
slcCokerKer :: (SliceCokernelTo i c, SliceKernelFrom i c) => Slice To i c -> SliceFactor To i c
-- | the left unit of the cokernel-kenrel adjunction slcAdjunction.
slcKerCoker :: (SliceCokernelTo i c, SliceKernelFrom i c) => Slice From i c -> SliceFactor From i c
-- | random variable for SliceFactor To i
-- c.
xSliceFactorTo :: (Multiplicative c, Sliced i c) => XOrtSite To c -> i c -> X (SliceFactor To i c)
-- | random variable for SliceFactor From i
-- c.
xSliceFactorFrom :: (Multiplicative c, Sliced i c) => XOrtSite From c -> i c -> X (SliceFactor From i c)
-- | validity for the values of SliceCokernelKernel to be
-- HomMultiplicative.
prpHomMltSliceCokernelKernel :: (SliceCokernelTo i c, SliceKernelFrom i c) => XOrtSite To c -> XOrtSite From c -> i c -> Statement
instance GHC.Show.Show (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c x y)
instance GHC.Classes.Eq (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c x y)
instance (OAlg.Structure.Distributive.Definition.Distributive c, OAlg.Entity.Slice.Adjunction.SliceCokernelTo i c, OAlg.Entity.Slice.Adjunction.SliceKernelFrom i c) => OAlg.Category.Applicative.Applicative (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance (OAlg.Structure.Distributive.Definition.Distributive c, OAlg.Entity.Slice.Adjunction.SliceCokernelTo i c, OAlg.Entity.Slice.Adjunction.SliceKernelFrom i c) => OAlg.Hom.Oriented.Definition.HomOriented (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance (OAlg.Structure.Distributive.Definition.Distributive c, OAlg.Entity.Slice.Adjunction.SliceCokernelTo i c, OAlg.Entity.Slice.Adjunction.SliceKernelFrom i c) => OAlg.Hom.Multiplicative.Definition.HomMultiplicative (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance OAlg.Data.Show.Show2 (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance OAlg.Data.Equal.Eq2 (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance OAlg.Data.Validable.Validable (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c x y)
instance OAlg.Data.Validable.Validable2 (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance (Data.Typeable.Internal.Typeable i, Data.Typeable.Internal.Typeable c, Data.Typeable.Internal.Typeable x, Data.Typeable.Internal.Typeable y) => OAlg.Entity.Definition.Entity (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c x y)
instance (Data.Typeable.Internal.Typeable i, Data.Typeable.Internal.Typeable c) => OAlg.Entity.Definition.Entity2 (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Category.Definition.Morphism (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c) OAlg.Structure.Definition.Typ
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Category.Definition.EmbeddableMorphismTyp (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c)
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c) OAlg.Structure.Oriented.Definition.Ort
instance (OAlg.Structure.Multiplicative.Definition.Multiplicative c, OAlg.Entity.Slice.Definition.Sliced i c) => OAlg.Category.Definition.EmbeddableMorphism (OAlg.Entity.Slice.Adjunction.SliceCokernelKernel i c) OAlg.Structure.Multiplicative.Definition.Mlt
-- | slicing a Multiplicative structures by a given indexed
-- Point.
--
-- Note Unfortunately for Haskell it is in general not possible to
-- lift a value to the type level, as such we need to circumvent somehow
-- this restriction by using an index type where the associated
-- point depends only of that type (see Sliced).
module OAlg.Entity.Slice
-- | Generator for finitely generated Points within a
-- Distributive structure.
module OAlg.Data.Generator
-- | generator for finitely generated Points within a
-- Distributive structure.
--
-- Property Let Generator d k' k'' coker ker lft
-- be in Generator and let DiagramChainTo g
-- (p:|p':|Nil) = d
--
--
-- p p'
-- g <<------- g' <------< g''
--
--
-- then holds:
--
--
-- - coker is the cokernel of p' with p as
-- the shell of its universal cone.
-- - ker is the kernel of p with p' as the
-- shell of its universal cone.
-- - 'KenrelSliceFromSomeFreeTip k'' k' ker is
-- valid.
-- - For all h = SliceFrom _ h' in Slice
-- From (Free k) a with end h'
-- == g holds:
- lft h is
-- valid.
- orientation (lft h) ==
-- start h :> start p.
- p
-- * lft h == h'.
--
--
--
-- g'
-- ^ |
-- / |
-- lft h / | p
-- / |
-- / v
-- * ---> g
-- h'
--
data Generator s a
[GeneratorTo] :: (Attestable k', Sliced (Free k') a, Attestable k'', Sliced (Free k'') a) => Diagram (Chain To) N3 N2 a -> Free k' a -> Free k'' a -> Cokernel N1 a -> Kernel N1 a -> (forall (k :: N'). Slice From (Free k) a -> a) -> Generator To a
-- | random variable of factors in a having a free
-- start and as end-point the given one.
newtype XSomeFreeSliceFromLiftable a
XSomeFreeSliceFromLiftable :: (Point a -> X (SomeFreeSlice From a)) -> XSomeFreeSliceFromLiftable a
-- | the underlying random variable for some free slice.
xsfsfl :: XSomeFreeSliceFromLiftable a -> Point a -> X (SomeFreeSlice From a)
-- | random variable of lift-able free slice froms.
--
-- Property Let a be in instance of
-- XStandardSomeFreeSliceFromLiftable then holds: For all
-- p in Point a and
-- SomeFreeSlice (SliceFrom _ h) in the range of
-- xStandardSomeFreeSliceFromLiftable p holds:
-- end h == p.
class XStandardSomeFreeSliceFromLiftable a
xStandardSomeFreeSliceFromLiftable :: XStandardSomeFreeSliceFromLiftable a => XSomeFreeSliceFromLiftable a
instance (OAlg.Structure.Distributive.Definition.Distributive a, OAlg.Structure.Oriented.Definition.XStandardOrtSiteFrom a, OAlg.Structure.Oriented.Definition.XStandardOrtSiteTo a, OAlg.Data.Generator.XStandardSomeFreeSliceFromLiftable a) => OAlg.Data.Validable.Validable (OAlg.Data.Generator.Generator 'OAlg.Data.Dualisable.To a)
instance (OAlg.Structure.Oriented.Definition.Oriented a, OAlg.Structure.Oriented.Definition.XStandardPoint a) => OAlg.Data.Validable.Validable (OAlg.Data.Generator.XSomeFreeSliceFromLiftable a)