{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Math.CartesianClosedCategory
(
    
    TwoBase(..),
    
    Tripod,
    
    twoCone,
    evalMap,
    internalDomainLeg,
    internalCodomainLeg,
    powerObjectLeg,
    internalDomain,
    internalCodomain,
    powerObject,
    universeCategoryTripod,
    
    tripod,
    unsafeTripod,
    
    CartesianClosedCategory(..),
    TwoProduct(..),
    Exponential(..),
    unexproject,
    Cartesian(..),
    
    
    isCandidateExponentialObject,
    CandidateExponentialObject(..),
    
    CandidateExponentialObjectMorphism,
    
    transpose,
    
    candidateExponentialObjectMorphism,
    unsafeCandidateExponentialObjectMorphism,
    
    CandidateExponentialObjectCategory(..),
    
    exponentialObjects,
)
where
    import              Data.WeakSet             (Set)
    import qualified    Data.WeakSet           as Set
    import              Data.WeakSet.Safe
    import              Data.WeakMap             (Map)
    import qualified    Data.WeakMap           as Map
    import              Data.WeakMap.Safe
    import              Data.List               (intercalate)
    import              Data.Simplifiable
    
    import              Math.Category
    import              Math.FiniteCategory
    import              Math.CompleteCategory
    import              Math.FiniteCategories.DiscreteTwo
    import              Math.FiniteCategories.ConeCategory
    import              Math.FiniteCategories.FunctorCategory
    import              Math.IO.PrettyPrint
    
    import              GHC.Generics
    
    
    
    
    
    
    type TwoBase c m o = Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoOb c m o
    
    
    
    
    data Tripod c m o = Tripod {
        forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone :: (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoOb c m o), 
        forall c m o. Tripod c m o -> m
evalMap :: m 
        } deriving (Tripod c m o -> Tripod c m o -> Bool
(Tripod c m o -> Tripod c m o -> Bool)
-> (Tripod c m o -> Tripod c m o -> Bool) -> Eq (Tripod c m o)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall c m o.
(Eq o, Eq c, Eq m) =>
Tripod c m o -> Tripod c m o -> Bool
$c== :: forall c m o.
(Eq o, Eq c, Eq m) =>
Tripod c m o -> Tripod c m o -> Bool
== :: Tripod c m o -> Tripod c m o -> Bool
$c/= :: forall c m o.
(Eq o, Eq c, Eq m) =>
Tripod c m o -> Tripod c m o -> Bool
/= :: Tripod c m o -> Tripod c m o -> Bool
Eq, Int -> Tripod c m o -> ShowS
[Tripod c m o] -> ShowS
Tripod c m o -> String
(Int -> Tripod c m o -> ShowS)
-> (Tripod c m o -> String)
-> ([Tripod c m o] -> ShowS)
-> Show (Tripod c m o)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall c m o.
(Show o, Show c, Show m) =>
Int -> Tripod c m o -> ShowS
forall c m o. (Show o, Show c, Show m) => [Tripod c m o] -> ShowS
forall c m o. (Show o, Show c, Show m) => Tripod c m o -> String
$cshowsPrec :: forall c m o.
(Show o, Show c, Show m) =>
Int -> Tripod c m o -> ShowS
showsPrec :: Int -> Tripod c m o -> ShowS
$cshow :: forall c m o. (Show o, Show c, Show m) => Tripod c m o -> String
show :: Tripod c m o -> String
$cshowList :: forall c m o. (Show o, Show c, Show m) => [Tripod c m o] -> ShowS
showList :: [Tripod c m o] -> ShowS
Show, (forall x. Tripod c m o -> Rep (Tripod c m o) x)
-> (forall x. Rep (Tripod c m o) x -> Tripod c m o)
-> Generic (Tripod c m o)
forall x. Rep (Tripod c m o) x -> Tripod c m o
forall x. Tripod c m o -> Rep (Tripod c m o) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall c m o x. Rep (Tripod c m o) x -> Tripod c m o
forall c m o x. Tripod c m o -> Rep (Tripod c m o) x
$cfrom :: forall c m o x. Tripod c m o -> Rep (Tripod c m o) x
from :: forall x. Tripod c m o -> Rep (Tripod c m o) x
$cto :: forall c m o x. Rep (Tripod c m o) x -> Tripod c m o
to :: forall x. Rep (Tripod c m o) x -> Tripod c m o
Generic, Tripod c m o -> Tripod c m o
(Tripod c m o -> Tripod c m o) -> Simplifiable (Tripod c m o)
forall a. (a -> a) -> Simplifiable a
forall c m o.
(Simplifiable o, Simplifiable c, Simplifiable m) =>
Tripod c m o -> Tripod c m o
$csimplify :: forall c m o.
(Simplifiable o, Simplifiable c, Simplifiable m) =>
Tripod c m o -> Tripod c m o
simplify :: Tripod c m o -> Tripod c m o
Simplifiable, Int -> Int -> String -> Tripod c m o -> String
Int -> Tripod c m o -> String
(Int -> Tripod c m o -> String)
-> (Int -> Int -> String -> Tripod c m o -> String)
-> (Int -> Tripod c m o -> String)
-> PrettyPrint (Tripod c m o)
forall a.
(Int -> a -> String)
-> (Int -> Int -> String -> a -> String)
-> (Int -> a -> String)
-> PrettyPrint a
forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> Int -> String -> Tripod c m o -> String
forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> Tripod c m o -> String
$cpprint :: forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> Tripod c m o -> String
pprint :: Int -> Tripod c m o -> String
$cpprintWithIndentations :: forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> Int -> String -> Tripod c m o -> String
pprintWithIndentations :: Int -> Int -> String -> Tripod c m o -> String
$cpprintIndent :: forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> Tripod c m o -> String
pprintIndent :: Int -> Tripod c m o -> String
PrettyPrint)
        
    
    tripod :: (Morphism m o, Eq o) => Cone DiscreteTwo DiscreteTwoAr DiscreteTwoOb c m o -> m -> Maybe (Tripod c m o)
    tripod :: forall m o c.
(Morphism m o, Eq o) =>
Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> m -> Maybe (Tripod c m o)
tripod Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
cone m
em
        | m -> o
forall m o. Morphism m o => m -> o
source m
em o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o -> o
forall c1 m1 o1 c2 m2 o2. Cone c1 m1 o1 c2 m2 o2 -> o2
apex Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
cone = Maybe (Tripod c m o)
forall a. Maybe a
Nothing
        | Bool
otherwise = Tripod c m o -> Maybe (Tripod c m o)
forall a. a -> Maybe a
Just Tripod{twoCone :: Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone = Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
cone, evalMap :: m
evalMap = m
em}
        
    
    unsafeTripod :: Cone DiscreteTwo DiscreteTwoAr DiscreteTwoOb c m o -> m -> Tripod c m o
    unsafeTripod :: forall c m o.
Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> m -> Tripod c m o
unsafeTripod Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
cone m
em = Tripod{twoCone :: Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone = Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
cone, evalMap :: m
evalMap = m
em}    
    
    
    internalDomainLeg :: (Morphism m o) => Tripod c m o -> m
    internalDomainLeg :: forall m o c. Morphism m o => Tripod c m o -> m
internalDomainLeg Tripod c m o
t = (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> NaturalTransformation
     DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c1 m1 o1 c2 m2 o2.
Cone c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2
legsCone (Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone Tripod c m o
t)) NaturalTransformation DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> DiscreteTwoAr -> m
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
NaturalTransformation c1 m1 o1 c2 m2 o2 -> o1 -> m2
=>$ DiscreteTwoAr
B
    
    
    internalDomain :: (Morphism m o) => Tripod c m o -> o
    internalDomain :: forall m o c. Morphism m o => Tripod c m o -> o
internalDomain = m -> o
forall m o. Morphism m o => m -> o
target(m -> o) -> (Tripod c m o -> m) -> Tripod c m o -> o
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Tripod c m o -> m
forall m o c. Morphism m o => Tripod c m o -> m
internalDomainLeg
    
    
    internalCodomainLeg :: (Morphism m o) => Tripod c m o -> m
    internalCodomainLeg :: forall m o c. Morphism m o => Tripod c m o -> m
internalCodomainLeg Tripod c m o
t = Tripod c m o -> m
forall c m o. Tripod c m o -> m
evalMap Tripod c m o
t
    
    
    internalCodomain :: (Morphism m o) => Tripod c m o -> o
    internalCodomain :: forall m o c. Morphism m o => Tripod c m o -> o
internalCodomain = m -> o
forall m o. Morphism m o => m -> o
target(m -> o) -> (Tripod c m o -> m) -> Tripod c m o -> o
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Tripod c m o -> m
forall m o c. Morphism m o => Tripod c m o -> m
internalCodomainLeg
    
    
    powerObjectLeg :: (Morphism m o) => Tripod c m o -> m
    powerObjectLeg :: forall m o c. Morphism m o => Tripod c m o -> m
powerObjectLeg Tripod c m o
t = (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> NaturalTransformation
     DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c1 m1 o1 c2 m2 o2.
Cone c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2
legsCone (Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone Tripod c m o
t)) NaturalTransformation DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> DiscreteTwoAr -> m
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
NaturalTransformation c1 m1 o1 c2 m2 o2 -> o1 -> m2
=>$ DiscreteTwoAr
A
    
    
    powerObject :: (Morphism m o) => Tripod c m o -> o
    powerObject :: forall m o c. Morphism m o => Tripod c m o -> o
powerObject = m -> o
forall m o. Morphism m o => m -> o
target(m -> o) -> (Tripod c m o -> m) -> Tripod c m o -> o
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Tripod c m o -> m
forall m o c. Morphism m o => Tripod c m o -> m
powerObjectLeg
    
    
    universeCategoryTripod :: (Category c m o, Morphism m o, Eq c, Eq m, Eq o) => 
        Tripod c m o -> c
    universeCategoryTripod :: forall c m o.
(Category c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> c
universeCategoryTripod = Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o -> c
forall c1 m1 o1 m2 o2 c2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
 Morphism m2 o2, Eq c2, Eq m2, Eq o2) =>
Cone c1 m1 o1 c2 m2 o2 -> c2
universeCategoryCone(Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o -> c)
-> (Tripod c m o
    -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
-> Tripod c m o
-> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone
    
    
    
    
    data Exponential t = Exprojection t 
                       | ExponentialElement (Map t t) 
        deriving (Exponential t -> Exponential t -> Bool
(Exponential t -> Exponential t -> Bool)
-> (Exponential t -> Exponential t -> Bool) -> Eq (Exponential t)
forall t. Eq t => Exponential t -> Exponential t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall t. Eq t => Exponential t -> Exponential t -> Bool
== :: Exponential t -> Exponential t -> Bool
$c/= :: forall t. Eq t => Exponential t -> Exponential t -> Bool
/= :: Exponential t -> Exponential t -> Bool
Eq, Int -> Exponential t -> ShowS
[Exponential t] -> ShowS
Exponential t -> String
(Int -> Exponential t -> ShowS)
-> (Exponential t -> String)
-> ([Exponential t] -> ShowS)
-> Show (Exponential t)
forall t. Show t => Int -> Exponential t -> ShowS
forall t. Show t => [Exponential t] -> ShowS
forall t. Show t => Exponential t -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall t. Show t => Int -> Exponential t -> ShowS
showsPrec :: Int -> Exponential t -> ShowS
$cshow :: forall t. Show t => Exponential t -> String
show :: Exponential t -> String
$cshowList :: forall t. Show t => [Exponential t] -> ShowS
showList :: [Exponential t] -> ShowS
Show, (forall x. Exponential t -> Rep (Exponential t) x)
-> (forall x. Rep (Exponential t) x -> Exponential t)
-> Generic (Exponential t)
forall x. Rep (Exponential t) x -> Exponential t
forall x. Exponential t -> Rep (Exponential t) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall t x. Rep (Exponential t) x -> Exponential t
forall t x. Exponential t -> Rep (Exponential t) x
$cfrom :: forall t x. Exponential t -> Rep (Exponential t) x
from :: forall x. Exponential t -> Rep (Exponential t) x
$cto :: forall t x. Rep (Exponential t) x -> Exponential t
to :: forall x. Rep (Exponential t) x -> Exponential t
Generic, Exponential t -> Exponential t
(Exponential t -> Exponential t) -> Simplifiable (Exponential t)
forall t. (Simplifiable t, Eq t) => Exponential t -> Exponential t
forall a. (a -> a) -> Simplifiable a
$csimplify :: forall t. (Simplifiable t, Eq t) => Exponential t -> Exponential t
simplify :: Exponential t -> Exponential t
Simplifiable, Int -> Int -> String -> Exponential t -> String
Int -> Exponential t -> String
(Int -> Exponential t -> String)
-> (Int -> Int -> String -> Exponential t -> String)
-> (Int -> Exponential t -> String)
-> PrettyPrint (Exponential t)
forall t.
(PrettyPrint t, Eq t) =>
Int -> Int -> String -> Exponential t -> String
forall t. (PrettyPrint t, Eq t) => Int -> Exponential t -> String
forall a.
(Int -> a -> String)
-> (Int -> Int -> String -> a -> String)
-> (Int -> a -> String)
-> PrettyPrint a
$cpprint :: forall t. (PrettyPrint t, Eq t) => Int -> Exponential t -> String
pprint :: Int -> Exponential t -> String
$cpprintWithIndentations :: forall t.
(PrettyPrint t, Eq t) =>
Int -> Int -> String -> Exponential t -> String
pprintWithIndentations :: Int -> Int -> String -> Exponential t -> String
$cpprintIndent :: forall t. (PrettyPrint t, Eq t) => Int -> Exponential t -> String
pprintIndent :: Int -> Exponential t -> String
PrettyPrint)
        
    
    unexproject :: Exponential t -> t
    unexproject :: forall t. Exponential t -> t
unexproject (Exprojection t
t) = t
t
    unexproject (ExponentialElement Map t t
_) = String -> t
forall a. HasCallStack => String -> a
error String
"Unexproject an exponential element."
        
    
    type TwoProduct t = Limit DiscreteTwoOb t
    
    
    type Cartesian t = TwoProduct (Exponential t)
    
    
    class CartesianClosedCategory c m o cLim mLim oLim cLimExp mLimExp oLimExp | 
        c -> m, m -> o, cLim -> mLim, mLim -> oLim, cLimExp -> mLimExp, mLimExp -> oLimExp, c m o -> cLimExp where
        
        internalHom :: (CompleteCategory c m o cLim mLim oLim DiscreteTwo DiscreteTwoAr DiscreteTwoOb) => TwoBase c m o -> Tripod cLimExp mLimExp oLimExp
    
    isCandidateExponentialObject :: (FiniteCategory c m o, Morphism m o, Eq c, Eq m, Eq o) => Tripod c m o -> Bool
    isCandidateExponentialObject :: forall c m o.
(FiniteCategory c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> Bool
isCandidateExponentialObject Tripod c m o
t = (Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone Tripod c m o
t) Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o) -> Bool
forall a. Eq a => a -> Set a -> Bool
`Set.elem` (Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
 FiniteCategory c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Set (Cone c1 m1 o1 c2 m2 o2)
limits(Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
 -> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o))
-> (Tripod c m o
    -> Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
-> Tripod c m o
-> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c1 m1 o1 m2 o2 c2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
 Morphism m2 o2) =>
Cone c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2
baseCone(Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
 -> Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
-> (Tripod c m o
    -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
-> Tripod c m o
-> Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall b c a. (b -> c) -> (a -> b) -> a -> c
.Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone (Tripod c m o
 -> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o))
-> Tripod c m o
-> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
forall a b. (a -> b) -> a -> b
$ Tripod c m o
t)
    
    
    type CandidateExponentialObject c m o = Tripod c m o
    
    
    data CandidateExponentialObjectMorphism c m o = CandidateExponentialObjectMorphism {
                                                        forall c m o.
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
sourceCandidateExponentialObject :: CandidateExponentialObject c m o,
                                                        forall c m o.
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
targetCandidateExponentialObject :: CandidateExponentialObject c m o,
                                                        forall c m o. CandidateExponentialObjectMorphism c m o -> m
transpose :: m
                                                    }
                                                    deriving (CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o -> Bool
(CandidateExponentialObjectMorphism c m o
 -> CandidateExponentialObjectMorphism c m o -> Bool)
-> (CandidateExponentialObjectMorphism c m o
    -> CandidateExponentialObjectMorphism c m o -> Bool)
-> Eq (CandidateExponentialObjectMorphism c m o)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall c m o.
(Eq o, Eq c, Eq m) =>
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o -> Bool
$c== :: forall c m o.
(Eq o, Eq c, Eq m) =>
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o -> Bool
== :: CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o -> Bool
$c/= :: forall c m o.
(Eq o, Eq c, Eq m) =>
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o -> Bool
/= :: CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o -> Bool
Eq, Int -> CandidateExponentialObjectMorphism c m o -> ShowS
[CandidateExponentialObjectMorphism c m o] -> ShowS
CandidateExponentialObjectMorphism c m o -> String
(Int -> CandidateExponentialObjectMorphism c m o -> ShowS)
-> (CandidateExponentialObjectMorphism c m o -> String)
-> ([CandidateExponentialObjectMorphism c m o] -> ShowS)
-> Show (CandidateExponentialObjectMorphism c m o)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall c m o.
(Show o, Show c, Show m) =>
Int -> CandidateExponentialObjectMorphism c m o -> ShowS
forall c m o.
(Show o, Show c, Show m) =>
[CandidateExponentialObjectMorphism c m o] -> ShowS
forall c m o.
(Show o, Show c, Show m) =>
CandidateExponentialObjectMorphism c m o -> String
$cshowsPrec :: forall c m o.
(Show o, Show c, Show m) =>
Int -> CandidateExponentialObjectMorphism c m o -> ShowS
showsPrec :: Int -> CandidateExponentialObjectMorphism c m o -> ShowS
$cshow :: forall c m o.
(Show o, Show c, Show m) =>
CandidateExponentialObjectMorphism c m o -> String
show :: CandidateExponentialObjectMorphism c m o -> String
$cshowList :: forall c m o.
(Show o, Show c, Show m) =>
[CandidateExponentialObjectMorphism c m o] -> ShowS
showList :: [CandidateExponentialObjectMorphism c m o] -> ShowS
Show, (forall x.
 CandidateExponentialObjectMorphism c m o
 -> Rep (CandidateExponentialObjectMorphism c m o) x)
-> (forall x.
    Rep (CandidateExponentialObjectMorphism c m o) x
    -> CandidateExponentialObjectMorphism c m o)
-> Generic (CandidateExponentialObjectMorphism c m o)
forall x.
Rep (CandidateExponentialObjectMorphism c m o) x
-> CandidateExponentialObjectMorphism c m o
forall x.
CandidateExponentialObjectMorphism c m o
-> Rep (CandidateExponentialObjectMorphism c m o) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall c m o x.
Rep (CandidateExponentialObjectMorphism c m o) x
-> CandidateExponentialObjectMorphism c m o
forall c m o x.
CandidateExponentialObjectMorphism c m o
-> Rep (CandidateExponentialObjectMorphism c m o) x
$cfrom :: forall c m o x.
CandidateExponentialObjectMorphism c m o
-> Rep (CandidateExponentialObjectMorphism c m o) x
from :: forall x.
CandidateExponentialObjectMorphism c m o
-> Rep (CandidateExponentialObjectMorphism c m o) x
$cto :: forall c m o x.
Rep (CandidateExponentialObjectMorphism c m o) x
-> CandidateExponentialObjectMorphism c m o
to :: forall x.
Rep (CandidateExponentialObjectMorphism c m o) x
-> CandidateExponentialObjectMorphism c m o
Generic, CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o
(CandidateExponentialObjectMorphism c m o
 -> CandidateExponentialObjectMorphism c m o)
-> Simplifiable (CandidateExponentialObjectMorphism c m o)
forall a. (a -> a) -> Simplifiable a
forall c m o.
(Simplifiable o, Simplifiable c, Simplifiable m) =>
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o
$csimplify :: forall c m o.
(Simplifiable o, Simplifiable c, Simplifiable m) =>
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o
simplify :: CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o
Simplifiable, Int
-> Int
-> String
-> CandidateExponentialObjectMorphism c m o
-> String
Int -> CandidateExponentialObjectMorphism c m o -> String
(Int -> CandidateExponentialObjectMorphism c m o -> String)
-> (Int
    -> Int
    -> String
    -> CandidateExponentialObjectMorphism c m o
    -> String)
-> (Int -> CandidateExponentialObjectMorphism c m o -> String)
-> PrettyPrint (CandidateExponentialObjectMorphism c m o)
forall a.
(Int -> a -> String)
-> (Int -> Int -> String -> a -> String)
-> (Int -> a -> String)
-> PrettyPrint a
forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int
-> Int
-> String
-> CandidateExponentialObjectMorphism c m o
-> String
forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> CandidateExponentialObjectMorphism c m o -> String
$cpprint :: forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> CandidateExponentialObjectMorphism c m o -> String
pprint :: Int -> CandidateExponentialObjectMorphism c m o -> String
$cpprintWithIndentations :: forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int
-> Int
-> String
-> CandidateExponentialObjectMorphism c m o
-> String
pprintWithIndentations :: Int
-> Int
-> String
-> CandidateExponentialObjectMorphism c m o
-> String
$cpprintIndent :: forall c m o.
(PrettyPrint o, PrettyPrint c, PrettyPrint m, Eq o, Eq m) =>
Int -> CandidateExponentialObjectMorphism c m o -> String
pprintIndent :: Int -> CandidateExponentialObjectMorphism c m o -> String
PrettyPrint)
    
    
    
    candidateExponentialObjectMorphism :: (Morphism m o, Eq m, Eq o) => CandidateExponentialObject c m o -> CandidateExponentialObject c m o -> m -> Maybe (CandidateExponentialObjectMorphism c m o)
    candidateExponentialObjectMorphism :: forall m o c.
(Morphism m o, Eq m, Eq o) =>
CandidateExponentialObject c m o
-> CandidateExponentialObject c m o
-> m
-> Maybe (CandidateExponentialObjectMorphism c m o)
candidateExponentialObjectMorphism CandidateExponentialObject c m o
s CandidateExponentialObject c m o
t m
transp
        | m -> o
forall m o. Morphism m o => m -> o
source m
transp o -> o -> Bool
forall a. Eq a => a -> a -> Bool
== m -> o
forall m o. Morphism m o => m -> o
target ((Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> NaturalTransformation
     DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c1 m1 o1 c2 m2 o2.
Cone c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2
legsCone (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
 -> NaturalTransformation
      DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
-> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> NaturalTransformation
     DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall a b. (a -> b) -> a -> b
$ CandidateExponentialObject c m o
-> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone CandidateExponentialObject c m o
s) NaturalTransformation DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> DiscreteTwoAr -> m
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
NaturalTransformation c1 m1 o1 c2 m2 o2 -> o1 -> m2
=>$ DiscreteTwoAr
A) Bool -> Bool -> Bool
&& m -> o
forall m o. Morphism m o => m -> o
target m
transp o -> o -> Bool
forall a. Eq a => a -> a -> Bool
== m -> o
forall m o. Morphism m o => m -> o
target ((Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> NaturalTransformation
     DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c1 m1 o1 c2 m2 o2.
Cone c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2
legsCone (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
 -> NaturalTransformation
      DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
-> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> NaturalTransformation
     DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall a b. (a -> b) -> a -> b
$ CandidateExponentialObject c m o
-> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
forall c m o.
Tripod c m o -> Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone CandidateExponentialObject c m o
t) NaturalTransformation DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
-> DiscreteTwoAr -> m
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
NaturalTransformation c1 m1 o1 c2 m2 o2 -> o1 -> m2
=>$ DiscreteTwoAr
A) = CandidateExponentialObjectMorphism c m o
-> Maybe (CandidateExponentialObjectMorphism c m o)
forall a. a -> Maybe a
Just CandidateExponentialObjectMorphism {sourceCandidateExponentialObject :: CandidateExponentialObject c m o
sourceCandidateExponentialObject = CandidateExponentialObject c m o
s, targetCandidateExponentialObject :: CandidateExponentialObject c m o
targetCandidateExponentialObject = CandidateExponentialObject c m o
t, transpose :: m
transpose = m
transp}
        | Bool
otherwise = Maybe (CandidateExponentialObjectMorphism c m o)
forall a. Maybe a
Nothing
        
    
    unsafeCandidateExponentialObjectMorphism :: CandidateExponentialObject c m o -> CandidateExponentialObject c m o -> m -> CandidateExponentialObjectMorphism c m o
    unsafeCandidateExponentialObjectMorphism :: forall c m o.
CandidateExponentialObject c m o
-> CandidateExponentialObject c m o
-> m
-> CandidateExponentialObjectMorphism c m o
unsafeCandidateExponentialObjectMorphism CandidateExponentialObject c m o
s CandidateExponentialObject c m o
t m
transp = CandidateExponentialObjectMorphism {sourceCandidateExponentialObject :: CandidateExponentialObject c m o
sourceCandidateExponentialObject = CandidateExponentialObject c m o
s, targetCandidateExponentialObject :: CandidateExponentialObject c m o
targetCandidateExponentialObject = CandidateExponentialObject c m o
t, transpose :: m
transpose = m
transp}
    
    instance (Morphism m o) => Morphism (CandidateExponentialObjectMorphism c m o) (CandidateExponentialObject c m o) where
        source :: CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
source = CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
forall c m o.
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
sourceCandidateExponentialObject
        target :: CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
target = CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
forall c m o.
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
targetCandidateExponentialObject
        CandidateExponentialObjectMorphism c m o
ceom2 @ :: CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObjectMorphism c m o
@ CandidateExponentialObjectMorphism c m o
ceom1 = CandidateExponentialObjectMorphism {sourceCandidateExponentialObject :: CandidateExponentialObject c m o
sourceCandidateExponentialObject = CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
forall c m o.
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
sourceCandidateExponentialObject CandidateExponentialObjectMorphism c m o
ceom1, targetCandidateExponentialObject :: CandidateExponentialObject c m o
targetCandidateExponentialObject = CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
forall c m o.
CandidateExponentialObjectMorphism c m o
-> CandidateExponentialObject c m o
targetCandidateExponentialObject CandidateExponentialObjectMorphism c m o
ceom2, transpose :: m
transpose = (CandidateExponentialObjectMorphism c m o -> m
forall c m o. CandidateExponentialObjectMorphism c m o -> m
transpose CandidateExponentialObjectMorphism c m o
ceom2) m -> m -> m
forall m o. Morphism m o => m -> m -> m
@ (CandidateExponentialObjectMorphism c m o -> m
forall c m o. CandidateExponentialObjectMorphism c m o -> m
transpose CandidateExponentialObjectMorphism c m o
ceom1)}
    
    data CandidateExponentialObjectCategory c m o = CandidateExponentialObjectCategory (TwoBase c m o)
        deriving (CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o -> Bool
(CandidateExponentialObjectCategory c m o
 -> CandidateExponentialObjectCategory c m o -> Bool)
-> (CandidateExponentialObjectCategory c m o
    -> CandidateExponentialObjectCategory c m o -> Bool)
-> Eq (CandidateExponentialObjectCategory c m o)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall c m o.
(Eq c, Eq m, Eq o) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o -> Bool
$c== :: forall c m o.
(Eq c, Eq m, Eq o) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o -> Bool
== :: CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o -> Bool
$c/= :: forall c m o.
(Eq c, Eq m, Eq o) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o -> Bool
/= :: CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o -> Bool
Eq, Int -> CandidateExponentialObjectCategory c m o -> ShowS
[CandidateExponentialObjectCategory c m o] -> ShowS
CandidateExponentialObjectCategory c m o -> String
(Int -> CandidateExponentialObjectCategory c m o -> ShowS)
-> (CandidateExponentialObjectCategory c m o -> String)
-> ([CandidateExponentialObjectCategory c m o] -> ShowS)
-> Show (CandidateExponentialObjectCategory c m o)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall c m o.
(Show c, Show o, Show m) =>
Int -> CandidateExponentialObjectCategory c m o -> ShowS
forall c m o.
(Show c, Show o, Show m) =>
[CandidateExponentialObjectCategory c m o] -> ShowS
forall c m o.
(Show c, Show o, Show m) =>
CandidateExponentialObjectCategory c m o -> String
$cshowsPrec :: forall c m o.
(Show c, Show o, Show m) =>
Int -> CandidateExponentialObjectCategory c m o -> ShowS
showsPrec :: Int -> CandidateExponentialObjectCategory c m o -> ShowS
$cshow :: forall c m o.
(Show c, Show o, Show m) =>
CandidateExponentialObjectCategory c m o -> String
show :: CandidateExponentialObjectCategory c m o -> String
$cshowList :: forall c m o.
(Show c, Show o, Show m) =>
[CandidateExponentialObjectCategory c m o] -> ShowS
showList :: [CandidateExponentialObjectCategory c m o] -> ShowS
Show, (forall x.
 CandidateExponentialObjectCategory c m o
 -> Rep (CandidateExponentialObjectCategory c m o) x)
-> (forall x.
    Rep (CandidateExponentialObjectCategory c m o) x
    -> CandidateExponentialObjectCategory c m o)
-> Generic (CandidateExponentialObjectCategory c m o)
forall x.
Rep (CandidateExponentialObjectCategory c m o) x
-> CandidateExponentialObjectCategory c m o
forall x.
CandidateExponentialObjectCategory c m o
-> Rep (CandidateExponentialObjectCategory c m o) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall c m o x.
Rep (CandidateExponentialObjectCategory c m o) x
-> CandidateExponentialObjectCategory c m o
forall c m o x.
CandidateExponentialObjectCategory c m o
-> Rep (CandidateExponentialObjectCategory c m o) x
$cfrom :: forall c m o x.
CandidateExponentialObjectCategory c m o
-> Rep (CandidateExponentialObjectCategory c m o) x
from :: forall x.
CandidateExponentialObjectCategory c m o
-> Rep (CandidateExponentialObjectCategory c m o) x
$cto :: forall c m o x.
Rep (CandidateExponentialObjectCategory c m o) x
-> CandidateExponentialObjectCategory c m o
to :: forall x.
Rep (CandidateExponentialObjectCategory c m o) x
-> CandidateExponentialObjectCategory c m o
Generic, CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o
(CandidateExponentialObjectCategory c m o
 -> CandidateExponentialObjectCategory c m o)
-> Simplifiable (CandidateExponentialObjectCategory c m o)
forall a. (a -> a) -> Simplifiable a
forall c m o.
(Simplifiable c, Simplifiable o, Simplifiable m) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o
$csimplify :: forall c m o.
(Simplifiable c, Simplifiable o, Simplifiable m) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o
simplify :: CandidateExponentialObjectCategory c m o
-> CandidateExponentialObjectCategory c m o
Simplifiable, Int
-> Int
-> String
-> CandidateExponentialObjectCategory c m o
-> String
Int -> CandidateExponentialObjectCategory c m o -> String
(Int -> CandidateExponentialObjectCategory c m o -> String)
-> (Int
    -> Int
    -> String
    -> CandidateExponentialObjectCategory c m o
    -> String)
-> (Int -> CandidateExponentialObjectCategory c m o -> String)
-> PrettyPrint (CandidateExponentialObjectCategory c m o)
forall a.
(Int -> a -> String)
-> (Int -> Int -> String -> a -> String)
-> (Int -> a -> String)
-> PrettyPrint a
forall c m o.
(PrettyPrint c, PrettyPrint o, PrettyPrint m, Eq o, Eq m) =>
Int
-> Int
-> String
-> CandidateExponentialObjectCategory c m o
-> String
forall c m o.
(PrettyPrint c, PrettyPrint o, PrettyPrint m, Eq o, Eq m) =>
Int -> CandidateExponentialObjectCategory c m o -> String
$cpprint :: forall c m o.
(PrettyPrint c, PrettyPrint o, PrettyPrint m, Eq o, Eq m) =>
Int -> CandidateExponentialObjectCategory c m o -> String
pprint :: Int -> CandidateExponentialObjectCategory c m o -> String
$cpprintWithIndentations :: forall c m o.
(PrettyPrint c, PrettyPrint o, PrettyPrint m, Eq o, Eq m) =>
Int
-> Int
-> String
-> CandidateExponentialObjectCategory c m o
-> String
pprintWithIndentations :: Int
-> Int
-> String
-> CandidateExponentialObjectCategory c m o
-> String
$cpprintIndent :: forall c m o.
(PrettyPrint c, PrettyPrint o, PrettyPrint m, Eq o, Eq m) =>
Int -> CandidateExponentialObjectCategory c m o -> String
pprintIndent :: Int -> CandidateExponentialObjectCategory c m o -> String
PrettyPrint)
        
    instance (Category c m o, Morphism m o, Eq c, Eq m ,Eq o) => Category (CandidateExponentialObjectCategory c m o) (CandidateExponentialObjectMorphism c m o) (CandidateExponentialObject c m o) where
        
        identity :: Morphism
  (CandidateExponentialObjectMorphism c m o)
  (CandidateExponentialObject c m o) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObject c m o
-> CandidateExponentialObjectMorphism c m o
identity (CandidateExponentialObjectCategory TwoBase c m o
base) CandidateExponentialObject c m o
tripod
            | Bool
differentInternalDomain = String -> CandidateExponentialObjectMorphism c m o
forall a. HasCallStack => String -> a
error String
"identity in a CandidateExponentialObjectCategory of a tripod with a different internal domain."
            | Bool
differentInternalCodomain = String -> CandidateExponentialObjectMorphism c m o
forall a. HasCallStack => String -> a
error String
"identity in a CandidateExponentialObjectCategory of a tripod with a different internal codomain."
            | Bool
differentUniverseCategory = String -> CandidateExponentialObjectMorphism c m o
forall a. HasCallStack => String -> a
error String
"identity in a CandidateExponentialObjectCategory of a tripod with a different universe category."
            | Bool
otherwise = CandidateExponentialObjectMorphism {sourceCandidateExponentialObject :: CandidateExponentialObject c m o
sourceCandidateExponentialObject = CandidateExponentialObject c m o
tripod, targetCandidateExponentialObject :: CandidateExponentialObject c m o
targetCandidateExponentialObject = CandidateExponentialObject c m o
tripod, transpose :: m
transpose = c -> o -> m
forall c m o. (Category c m o, Morphism m o) => c -> o -> m
identity (CandidateExponentialObject c m o -> c
forall c m o.
(Category c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> c
universeCategoryTripod CandidateExponentialObject c m o
tripod) (CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
powerObject CandidateExponentialObject c m o
tripod)}
            where
                differentInternalDomain :: Bool
differentInternalDomain = CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
internalDomain CandidateExponentialObject c m o
tripod o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
A
                differentInternalCodomain :: Bool
differentInternalCodomain = CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
internalCodomain CandidateExponentialObject c m o
tripod o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
B
                differentUniverseCategory :: Bool
differentUniverseCategory = CandidateExponentialObject c m o -> c
forall c m o.
(Category c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> c
universeCategoryTripod CandidateExponentialObject c m o
tripod c -> c -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o -> c
forall c1 m1 o1 c2 m2 o2. Diagram c1 m1 o1 c2 m2 o2 -> c2
tgt TwoBase c m o
base
            
        
        ar :: Morphism
  (CandidateExponentialObjectMorphism c m o)
  (CandidateExponentialObject c m o) =>
CandidateExponentialObjectCategory c m o
-> CandidateExponentialObject c m o
-> CandidateExponentialObject c m o
-> Set (CandidateExponentialObjectMorphism c m o)
ar (CandidateExponentialObjectCategory TwoBase c m o
base) CandidateExponentialObject c m o
tripod1 CandidateExponentialObject c m o
tripod2
            | Bool
differentInternalDomain1 = String -> Set (CandidateExponentialObjectMorphism c m o)
forall a. HasCallStack => String -> a
error String
"ar in a CandidateExponentialObjectCategory where the source has different internal domain."
            | Bool
differentInternalCodomain1 = String -> Set (CandidateExponentialObjectMorphism c m o)
forall a. HasCallStack => String -> a
error String
"ar in a CandidateExponentialObjectCategory where the source has different internal codomain."
            | Bool
differentUniverseCategory1 = String -> Set (CandidateExponentialObjectMorphism c m o)
forall a. HasCallStack => String -> a
error String
"ar in a CandidateExponentialObjectCategory where the source has different universe Category."
            | Bool
differentInternalDomain2 = String -> Set (CandidateExponentialObjectMorphism c m o)
forall a. HasCallStack => String -> a
error String
"ar in a CandidateExponentialObjectCategory where the target has different internal domain."
            | Bool
differentInternalCodomain2 = String -> Set (CandidateExponentialObjectMorphism c m o)
forall a. HasCallStack => String -> a
error String
"ar in a CandidateExponentialObjectCategory where the target has different internal codomain."
            | Bool
differentUniverseCategory2 = String -> Set (CandidateExponentialObjectMorphism c m o)
forall a. HasCallStack => String -> a
error String
"ar in a CandidateExponentialObjectCategory where the target has different universe Category."
            | Bool
otherwise = (\m
m -> CandidateExponentialObjectMorphism{sourceCandidateExponentialObject :: CandidateExponentialObject c m o
sourceCandidateExponentialObject = CandidateExponentialObject c m o
tripod1, targetCandidateExponentialObject :: CandidateExponentialObject c m o
targetCandidateExponentialObject = CandidateExponentialObject c m o
tripod2, transpose :: m
transpose = m
m}) (m -> CandidateExponentialObjectMorphism c m o)
-> Set m -> Set (CandidateExponentialObjectMorphism c m o)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> c -> o -> o -> Set m
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
ar (CandidateExponentialObject c m o -> c
forall c m o.
(Category c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> c
universeCategoryTripod CandidateExponentialObject c m o
tripod1) (CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
powerObject CandidateExponentialObject c m o
tripod1) (CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
powerObject CandidateExponentialObject c m o
tripod2)
            where
                differentInternalDomain1 :: Bool
differentInternalDomain1 = CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
internalDomain CandidateExponentialObject c m o
tripod1 o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
A
                differentInternalCodomain1 :: Bool
differentInternalCodomain1 = CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
internalCodomain CandidateExponentialObject c m o
tripod1 o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
B
                differentUniverseCategory1 :: Bool
differentUniverseCategory1 = CandidateExponentialObject c m o -> c
forall c m o.
(Category c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> c
universeCategoryTripod CandidateExponentialObject c m o
tripod1 c -> c -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o -> c
forall c1 m1 o1 c2 m2 o2. Diagram c1 m1 o1 c2 m2 o2 -> c2
tgt TwoBase c m o
base
                differentInternalDomain2 :: Bool
differentInternalDomain2 = CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
internalDomain CandidateExponentialObject c m o
tripod2 o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
A
                differentInternalCodomain2 :: Bool
differentInternalCodomain2 = CandidateExponentialObject c m o -> o
forall m o c. Morphism m o => Tripod c m o -> o
internalCodomain CandidateExponentialObject c m o
tripod2 o -> o -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
B
                differentUniverseCategory2 :: Bool
differentUniverseCategory2 = CandidateExponentialObject c m o -> c
forall c m o.
(Category c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> c
universeCategoryTripod CandidateExponentialObject c m o
tripod2 c -> c -> Bool
forall a. Eq a => a -> a -> Bool
/= TwoBase c m o -> c
forall c1 m1 o1 c2 m2 o2. Diagram c1 m1 o1 c2 m2 o2 -> c2
tgt TwoBase c m o
base
    
    instance (FiniteCategory c m o, Morphism m o, Eq c, Eq m ,Eq o) => FiniteCategory (CandidateExponentialObjectCategory c m o) (CandidateExponentialObjectMorphism c m o) (CandidateExponentialObject c m o) where
        
        ob :: CandidateExponentialObjectCategory c m o
-> Set (CandidateExponentialObject c m o)
ob (CandidateExponentialObjectCategory TwoBase c m o
base) = [Tripod{twoCone :: Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone = Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
c, evalMap :: m
evalMap = m
m} | o
powerObj <- c -> Set o
forall c m o. FiniteCategory c m o => c -> Set o
ob (TwoBase c m o -> c
forall c1 m1 o1 c2 m2 o2. Diagram c1 m1 o1 c2 m2 o2 -> c2
tgt TwoBase c m o
base), Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
c <- TwoBase c m o
-> Set (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o)
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
 FiniteCategory c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Set (Cone c1 m1 o1 c2 m2 o2)
limits (c -> o -> o -> TwoBase c m o
forall c m o.
(Category c m o, Morphism m o) =>
c
-> o -> o -> Diagram DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoDiagram (TwoBase c m o -> c
forall c1 m1 o1 c2 m2 o2. Diagram c1 m1 o1 c2 m2 o2 -> c2
tgt TwoBase c m o
base) o
powerObj (TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
A)), m
m <- c -> o -> o -> Set m
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
ar (TwoBase c m o -> c
forall c1 m1 o1 c2 m2 o2. Diagram c1 m1 o1 c2 m2 o2 -> c2
tgt TwoBase c m o
base) (Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o -> o
forall c1 m1 o1 c2 m2 o2. Cone c1 m1 o1 c2 m2 o2 -> o2
apex Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
c) (TwoBase c m o
base TwoBase c m o -> DiscreteTwoAr -> o
forall o1 c1 m1 c2 m2 o2.
Eq o1 =>
Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2
->$ DiscreteTwoAr
B), CandidateExponentialObject c m o -> Bool
forall c m o.
(FiniteCategory c m o, Morphism m o, Eq c, Eq m, Eq o) =>
Tripod c m o -> Bool
isCandidateExponentialObject Tripod{twoCone :: Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
twoCone = Cone DiscreteTwo DiscreteTwoAr DiscreteTwoAr c m o
c, evalMap :: m
evalMap = m
m}]
        
    
    exponentialObjects :: (FiniteCategory c m o, Morphism m o, Eq c, Eq m ,Eq o) => TwoBase c m o -> Set (CandidateExponentialObject c m o)
    exponentialObjects :: forall c m o.
(FiniteCategory c m o, Morphism m o, Eq c, Eq m, Eq o) =>
TwoBase c m o -> Set (CandidateExponentialObject c m o)
exponentialObjects TwoBase c m o
base = CandidateExponentialObjectCategory c m o
-> Set (CandidateExponentialObject c m o)
forall c m o.
(FiniteCategory c m o, Morphism m o, Eq m, Eq o) =>
c -> Set o
terminalObjects (TwoBase c m o -> CandidateExponentialObjectCategory c m o
forall c m o.
TwoBase c m o -> CandidateExponentialObjectCategory c m o
CandidateExponentialObjectCategory TwoBase c m o
base)