| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Chu
Description
The Chu construction over a monoidal base category.
A Chu object is a polarity pair A⁺ and A⁻ together with a pairing
A⁺ ⊗ A⁻ → ⊥ into a dualising object. A Chu morphism is an adjoint pair
satisfying the equation
e_B (f⁺ a, d) = e_A (a, f⁻ d)
This is the only genuinely star-autonomous, non-compact structure in the
library: proper ⊗ vs ⅋, proper additives, a real negation, and an internal
hom that is not just A⊥ ⊗ B. Promoting it to a base arrow makes the
linear-logic distinctions measurable for the first time.
Synopsis
- class ChuSemiring r where
- newtype ChuObj (t :: k -> k1 -> k2) (r :: k3) (arr :: k2 -> k3 -> Type) (a :: k) (b :: k1) = ChuObj {
- chuPair :: arr (t a b) r
- data PointedChuObj (t :: Type -> Type -> k) (r :: k1) (arr :: k -> k1 -> Type) a b = PointedChuObj {
- pointedObj :: ChuObj t r arr a b
- pointedPos :: a
- pointedNeg :: b
- data ChuMorphism (t :: k) (r :: k1) (arr :: k2 -> k3 -> Type) (a :: k2) (b :: k3) (c :: k3) (d :: k2) = ChuMorphism {
- chuForward :: arr a c
- chuBackward :: arr d b
- newtype Chu (t :: Type -> Type -> Type) r (arr :: Type -> Type -> Type) a b where
- Chu :: forall (t :: Type -> Type -> Type) r (arr :: Type -> Type -> Type) a b. ChuMorphism t r arr (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b) -> Chu t r arr a b
- type family ChuPosType a where ...
- type family ChuNegType a where ...
- negateChu :: forall {k} (t :: k -> k -> k) (arr :: k -> k -> Type) (r :: k) (a :: k) (b :: k). Action t arr => ChuObj t r arr a b -> ChuObj t r arr b a
- idChu :: forall {k1} {k2} {k3} (arr :: k1 -> k1 -> Type) (t :: k2) (r :: k3) (a :: k1) (b :: k1). Category arr => ChuMorphism t r arr a b a b
- composeChu :: forall {k1} {k2} {k3} (arr :: k1 -> k1 -> Type) (t :: k2) (r :: k3) (c :: k1) (d :: k1) (e :: k1) (f :: k1) (a :: k1) (b :: k1). Category arr => ChuMorphism t r arr c d e f -> ChuMorphism t r arr a b c d -> ChuMorphism t r arr a b e f
- chuLaw :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuMorphism (,) r (->) a b c d -> a -> d -> Bool
- chuLawAt :: Eq s => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuMorphism (,) r (->) a b c d -> a -> d -> (r -> s) -> Bool
- deliversToSemiring :: (ChuSemiring r, Eq a) => [a] -> a -> r
- deliveryMatrix :: (ChuSemiring r, Eq col) => [col] -> [[col]] -> [[r]]
- data ChuTensorNeg a b c d = ChuTensorNeg {
- ctnForward :: a -> d
- ctnBackward :: c -> b
- data ChuParPos a b c d = ChuParPos {
- cppForward :: b -> c
- cppBackward :: d -> a
- tensorChuObj :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (a, c) (ChuTensorNeg a b c d)
- parChuObj :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (ChuParPos a b c d) (b, d)
- lolliChuObj :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (ChuParPos b a c d) (a, d)
- withChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (a, c) (Either b d)
- oplusChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (Either a c) (b, d)
- topChuObj :: ChuObj (,) r (->) () Void
- zeroChuObj :: ChuObj (,) r (->) Void ()
- proj1Chu :: forall {k} (r :: k) a c b d. ChuMorphism (,) r (->) (a, c) (Either b d) a b
- proj2Chu :: forall {k} (r :: k) a c b d. ChuMorphism (,) r (->) (a, c) (Either b d) c d
- inj1Chu :: forall {k} (r :: k) a b c d. ChuMorphism (,) r (->) a b (Either a c) (b, d)
- inj2Chu :: forall {k} (r :: k) c d a b. ChuMorphism (,) r (->) c d (Either a c) (b, d)
- unitTopChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b () Void
- unitZeroChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) Void () a b
- pairChu :: forall {k} (r :: k) c d a b e f. ChuMorphism (,) r (->) c d a b -> ChuMorphism (,) r (->) c d e f -> ChuMorphism (,) r (->) c d (a, e) (Either b f)
- copairChu :: forall {k} (r :: k) a b c d e f. ChuMorphism (,) r (->) a b c d -> ChuMorphism (,) r (->) e f c d -> ChuMorphism (,) r (->) (Either a e) (b, f) c d
- withTopLChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b ((), a) (Either Void b)
- withTopLInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) ((), a) (Either Void b) a b
- withTopRChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b (a, ()) (Either b Void)
- withTopRInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) (a, ()) (Either b Void) a b
- zeroPlusLChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b (Either Void a) ((), b)
- zeroPlusLInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) (Either Void a) ((), b) a b
- zeroPlusRChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b (Either a Void) (b, ())
- zeroPlusRInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) (Either a Void) (b, ()) a b
- evalChu :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuMorphism (,) r (->) (a, ChuParPos b a c d) (ChuTensorNeg a b (ChuParPos b a c d) (a, d)) c d
- tensorChu :: forall {k} (r :: k) a b c d e f g h. ChuMorphism (,) r (->) a b c d -> ChuMorphism (,) r (->) e f g h -> ChuMorphism (,) r (->) (a, e) (ChuTensorNeg a b e f) (c, g) (ChuTensorNeg c d g h)
- parChu :: forall {k} (r :: k) a b c d e f g h. ChuMorphism (,) r (->) a b c d -> ChuMorphism (,) r (->) e f g h -> ChuMorphism (,) r (->) (ChuParPos a b e f) (b, f) (ChuParPos c d g h) (d, h)
- chuUnitObj :: ChuObj (,) r (->) () r
- chuBottomObj :: ChuObj (,) r (->) r ()
- chuTensorNegs :: (Eq r, Eq (ChuPosType a), Eq (ChuPosType b), ChuObject r a, ChuObject r b) => Proxy a -> Proxy b -> [ChuTensorNeg (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b)]
- chuParPoss :: (Eq r, Eq (ChuNegType a), Eq (ChuNegType b), ChuObject r a, ChuObject r b) => Proxy a -> Proxy b -> [ChuParPos (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b)]
- chuSeparated :: (Eq r, Eq (ChuPosType a), ChuObject r a) => Proxy a -> Bool
- chuExtensional :: (Eq r, Eq (ChuNegType a), ChuObject r a) => Proxy a -> Bool
- leftUnitorChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) ((), a) (ChuTensorNeg () r a b) a b
- leftUnitorChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b ((), a) (ChuTensorNeg () r a b)
- rightUnitorChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) (a, ()) (ChuTensorNeg a b () r) a b
- rightUnitorChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (a, ()) (ChuTensorNeg a b () r)
- assocChu :: forall {k} (r :: k) a c e b d f. ChuMorphism (,) r (->) ((a, c), e) (ChuTensorNeg (a, c) (ChuTensorNeg a b c d) e f) (a, (c, e)) (ChuTensorNeg a b (c, e) (ChuTensorNeg c d e f))
- assocChuInv :: forall {k} (r :: k) a c e b d f. ChuMorphism (,) r (->) (a, (c, e)) (ChuTensorNeg a b (c, e) (ChuTensorNeg c d e f)) ((a, c), e) (ChuTensorNeg (a, c) (ChuTensorNeg a b c d) e f)
- slideChu :: forall {k} (r :: k) a c e b d f. ChuMorphism (,) r (->) (a, (c, e)) (ChuTensorNeg a b (c, e) (ChuTensorNeg c d e f)) (c, (a, e)) (ChuTensorNeg c d (a, e) (ChuTensorNeg a b e f))
- polesAsChu :: forall {k1} arr (a :: k1). Poles arr a a -> PointedChuObj (,) (arr a a) (->) (In arr a) (Out arr a)
- lawfulDimap :: forall {k1} arr (a :: k1). ChuMorphism (,) (arr a a) (->) (In arr a) (Out arr a) (In arr a) (Out arr a) -> Poles arr a a -> Poles arr a a
- class ChuObject r a where
- chuObject :: ChuObj (,) r (->) (ChuPosType a) (ChuNegType a)
- chuPosAll :: [ChuPosType a]
- chuNegAll :: [ChuNegType a]
- class ChuObject r a => ChuSeparated r a
- class ChuObject r a => ChuExtensional r a
- type family ChuPosNonEmpty a :: Bool where ...
- type family ChuNegNonEmpty a :: Bool where ...
- newtype OChu r a b = OChu {}
- type SepChu = OChu
- parOChu :: OChu r a b -> OChu r c d -> OChu r (ChuOTensor r a c) (ChuOTensor r b d)
- unitlOChu :: ChuObject r a => OChu r (ChuOTensor r (ChuOUnit r) a) a
- unitlOChu' :: ChuObject r a => OChu r a (ChuOTensor r (ChuOUnit r) a)
- unitrOChu :: ChuObject r a => OChu r (ChuOTensor r a (ChuOUnit r)) a
- unitrOChu' :: ChuObject r a => OChu r a (ChuOTensor r a (ChuOUnit r))
- swapOChu :: OChu r (ChuOTensor r a b) (ChuOTensor r b a)
- parPOChu :: OChu r a b -> OChu r c d -> OChu r (ChuOPar r a c) (ChuOPar r b d)
- unitlPOChu :: OChu r (ChuOPar r (Bot (ChuOPar r :: Type -> Type -> Type)) a) a
- unitlPOChu' :: ChuObject r a => OChu r a (ChuOPar r (Bot (ChuOPar r :: Type -> Type -> Type)) a)
- unitrPOChu :: OChu r (ChuOPar r a (Bot (ChuOPar r :: Type -> Type -> Type))) a
- unitrPOChu' :: ChuObject r a => OChu r a (ChuOPar r a (Bot (ChuOPar r :: Type -> Type -> Type)))
- evalOChu :: (ChuObject r a, ChuObject r b) => OChu r (ChuOTensor r a (ChuOLolli r a b)) b
- curryOChu :: OChu r (ChuOTensor r a b) c -> OChu r a (ChuOLolli r b c)
- uncurryOChu :: OChu r a (ChuOLolli r b c) -> OChu r (ChuOTensor r a b) c
- discardEOChu :: OChu r (ChuOBang r a) (ChuOUnit r)
- derelictOChu :: ChuObject r a => OChu r (ChuOBang r a) a
- introduceOChu :: ChuObject r a => OChu r a (ChuOWhyNot r a)
- mergeEOChu :: OChu r (ChuOPar r (ChuOWhyNot r a) (ChuOWhyNot r a)) (ChuOWhyNot r a)
- zeroEOChu :: OChu r (ChuONeg r (ChuOUnit r)) (ChuOWhyNot r a)
- copyTOChu :: OChu r (ChuOBang r a) (ChuOTensor r (ChuOBang r a) (ChuOBang r a))
- discardTOChu :: OChu r (ChuOBang r a) (ChuOUnit r)
- plusTOChu :: forall r a. Monoid (ChuPosType a) => OChu r (ChuOTensor r (ChuOBang r a) (ChuOBang r a)) (ChuOBang r a)
- zeroTOChu :: forall r a. Monoid (ChuPosType a) => OChu r (ChuOUnit r) (ChuOBang r a)
- data ChuOUnit r = ChuOUnit
- data ChuOTensor r (a :: k) (b :: k1) = ChuOTensor
- data ChuONeg r (a :: k) = ChuONeg
- data ChuOWith r (a :: k) (b :: k1) = ChuOWith
- data ChuOPlus r (a :: k) (b :: k1) = ChuOPlus
- data ChuOPar r (a :: k) (b :: k1) = ChuOPar
- data ChuOTop r = ChuOTop
- data ChuOZero r = ChuOZero
- data ChuTwo = ChuTwo
- data ChuThree = ChuThree
- data ChuDouble01 = ChuDouble01
- data ChuDelivery = ChuDelivery
- data ChuAny = ChuAny
- swapChu :: (ChuPosType (ChuOTensor r a b) ~ (ChuPosType a, ChuPosType b), ChuNegType (ChuOTensor r a b) ~ ChuTensorNeg (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b), ChuPosType (ChuOTensor r b a) ~ (ChuPosType b, ChuPosType a), ChuNegType (ChuOTensor r b a) ~ ChuTensorNeg (ChuPosType b) (ChuNegType b) (ChuPosType a) (ChuNegType a)) => ChuMorphism (,) r (->) (ChuPosType (ChuOTensor r a b)) (ChuNegType (ChuOTensor r a b)) (ChuPosType (ChuOTensor r b a)) (ChuNegType (ChuOTensor r b a))
- dnUnitChu :: OChu r a (ChuONeg r (ChuONeg r a))
- dnCounitChu :: OChu r (ChuONeg r (ChuONeg r a)) a
- data ChuOLolli r (a :: k) (b :: k1) = ChuOLolli
- curryChu :: forall {k} (r :: k) a c b d e f. ChuMorphism (,) r (->) (a, c) (ChuTensorNeg a b c d) e f -> ChuMorphism (,) r (->) a b (ChuParPos d c e f) (c, f)
- uncurryChu :: forall {k} (r :: k) a b d c e f. ChuMorphism (,) r (->) a b (ChuParPos d c e f) (c, f) -> ChuMorphism (,) r (->) (a, c) (ChuTensorNeg a b c d) e f
- chuFunctionals :: Eq a => [a] -> [r] -> [a -> r]
- bangChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) a (a -> r)
- whyNotChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) (b -> r) b
- copyBangChu :: ChuMorphism (,) r (->) a (a -> r) (a, a) (ChuTensorNeg a (a -> r) a (a -> r))
- discardBangChu :: ChuMorphism (,) r (->) a (a -> r) () r
- mergeBangChu :: Monoid a => ChuMorphism (,) r (->) (a, a) (ChuTensorNeg a (a -> r) a (a -> r)) a (a -> r)
- zeroBangChu :: Monoid a => ChuMorphism (,) r (->) () r a (a -> r)
- derelictChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a (a -> r) a b
- zeroWhyNotChu :: ChuSemiring r => ChuMorphism (,) r (->) () r (b -> r) b
- introduceChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (b -> r) b
- digChu :: ChuMorphism (,) r (->) a (a -> r) a (a -> r)
- promoteChu :: ChuMorphism (,) r (->) (a, c) (ChuTensorNeg a (a -> r) c (c -> r)) (a, c) ((a, c) -> r)
- mergeWhyNotParChu :: ChuMorphism (,) r (->) (ChuParPos (b -> r) b (b -> r) b) (b, b) (b -> r) b
- zeroWhyNotParChu :: ChuMorphism (,) r (->) r () (b -> r) b
- leftUnitorParChu :: ChuMorphism (,) r (->) (ChuParPos r () p n) ((), n) p n
- leftUnitorParChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (ChuParPos r () a b) ((), b)
- rightUnitorParChu :: ChuMorphism (,) r (->) (ChuParPos p n r ()) (n, ()) p n
- rightUnitorParChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (ChuParPos a b r ()) (b, ())
- assocParChu :: forall {k} (r :: k) a b c d e f. ChuMorphism (,) r (->) (ChuParPos (ChuParPos a b c d) (b, d) e f) ((b, d), f) (ChuParPos a b (ChuParPos c d e f) (d, f)) (b, (d, f))
- assocParChuInv :: forall {k} (r :: k) a b c d e f. ChuMorphism (,) r (->) (ChuParPos a b (ChuParPos c d e f) (d, f)) (b, (d, f)) (ChuParPos (ChuParPos a b c d) (b, d) e f) ((b, d), f)
- swapParChu :: forall {k} (r :: k) a b c d. ChuMorphism (,) r (->) (ChuParPos a b c d) (b, d) (ChuParPos c d a b) (d, b)
- data ChuOBang r (a :: k) = ChuOBang
- data ChuOWhyNot r (a :: k) = ChuOWhyNot
Dualising semiring
class ChuSemiring r where Source #
A semiring, kept local to this module so the delivery instance does not pull in an external numeric prelude.
Methods
Instances
Chu objects and morphisms
newtype ChuObj (t :: k -> k1 -> k2) (r :: k3) (arr :: k2 -> k3 -> Type) (a :: k) (b :: k1) Source #
An object of Chu(C, ⊥).
ais the positive carrier.bis the negative carrier.chuPairis the pairinga ⊗ b → rinto the dualising object.
data PointedChuObj (t :: Type -> Type -> k) (r :: k1) (arr :: k -> k1 -> Type) a b Source #
A pointed Chu object: a ChuObj together with a chosen point pair.
This is the separate wrapper used by polesAsChu to retain the positive
and negative points that witness a self-dual channel.
Constructors
| PointedChuObj | |
Fields
| |
data ChuMorphism (t :: k) (r :: k1) (arr :: k2 -> k3 -> Type) (a :: k2) (b :: k3) (c :: k3) (d :: k2) Source #
A Chu morphism A → B is a pair of base arrows:
chuForward :: arr a cruns forward fromA⁺toB⁺.chuBackward :: arr d bruns backward fromB⁻toA⁻.
Constructors
| ChuMorphism | |
Fields
| |
newtype Chu (t :: Type -> Type -> Type) r (arr :: Type -> Type -> Type) a b where Source #
Chu t r arr is the Chu construction as a base arrow. Objects are
ChuObjs; morphisms are adjoint pairs wrapped by the Chu constructor.
Constructors
| Chu :: forall (t :: Type -> Type -> Type) r (arr :: Type -> Type -> Type) a b. ChuMorphism t r arr (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b) -> Chu t r arr a b |
type family ChuPosType a where ... Source #
Closed type family giving the positive carrier of a Chu object tag.
Every object of Chu(C, ⊥) is ultimately a ChuObj; this family exposes
the positive carrier so that identity and composition can be typed
uniformly without a separate type class.
Equations
| ChuPosType (ChuObj t r arr p n) = p | |
| ChuPosType (ChuOUnit r) = () | |
| ChuPosType (ChuOTensor r a b) = (ChuPosType a, ChuPosType b) | |
| ChuPosType (ChuONeg r a) = ChuNegType a | |
| ChuPosType ChuTwo = Bool | |
| ChuPosType ChuThree = Maybe Bool | |
| ChuPosType ChuDouble01 = Bool | |
| ChuPosType ChuDelivery = Bool | |
| ChuPosType ChuAny = Any | |
| ChuPosType (ChuOLolli r a b) = ChuParPos (ChuNegType a) (ChuPosType a) (ChuPosType b) (ChuNegType b) | |
| ChuPosType (ChuOWith r a b) = (ChuPosType a, ChuPosType b) | |
| ChuPosType (ChuOPlus r a b) = Either (ChuPosType a) (ChuPosType b) | |
| ChuPosType (ChuOPar r a b) = ChuParPos (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b) | |
| ChuPosType (ChuOTop r) = () | |
| ChuPosType (ChuOZero r) = Void | |
| ChuPosType (ChuOBang r a) = ChuPosType a | |
| ChuPosType (ChuOWhyNot r a) = ChuNegType a -> r |
type family ChuNegType a where ... Source #
Closed type family giving the negative carrier of a Chu object tag.
See ChuPosType for motivation; this is the dual side.
Equations
| ChuNegType (ChuObj t r arr p n) = n | |
| ChuNegType (ChuOUnit r) = r | |
| ChuNegType (ChuOTensor r a b) = ChuTensorNeg (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b) | |
| ChuNegType (ChuONeg r a) = ChuPosType a | |
| ChuNegType ChuTwo = Bool | |
| ChuNegType ChuThree = Maybe Bool | |
| ChuNegType ChuDouble01 = Bool | |
| ChuNegType ChuDelivery = Bool | |
| ChuNegType ChuAny = Any | |
| ChuNegType (ChuOLolli r a b) = (ChuPosType a, ChuNegType b) | |
| ChuNegType (ChuOWith r a b) = Either (ChuNegType a) (ChuNegType b) | |
| ChuNegType (ChuOPlus r a b) = (ChuNegType a, ChuNegType b) | |
| ChuNegType (ChuOPar r a b) = (ChuNegType a, ChuNegType b) | |
| ChuNegType (ChuOTop r) = Void | |
| ChuNegType (ChuOZero r) = () | |
| ChuNegType (ChuOBang r a) = ChuPosType a -> r | |
| ChuNegType (ChuOWhyNot r a) = ChuNegType a |
negateChu :: forall {k} (t :: k -> k -> k) (arr :: k -> k -> Type) (r :: k) (a :: k) (b :: k). Action t arr => ChuObj t r arr a b -> ChuObj t r arr b a Source #
Negation swaps the carriers via the symmetric braiding.
Involution is definitional for a symmetric braiding:
braid . braid = id.
idChu :: forall {k1} {k2} {k3} (arr :: k1 -> k1 -> Type) (t :: k2) (r :: k3) (a :: k1) (b :: k1). Category arr => ChuMorphism t r arr a b a b Source #
Identity Chu morphism.
composeChu :: forall {k1} {k2} {k3} (arr :: k1 -> k1 -> Type) (t :: k2) (r :: k3) (c :: k1) (d :: k1) (e :: k1) (f :: k1) (a :: k1) (b :: k1). Category arr => ChuMorphism t r arr c d e f -> ChuMorphism t r arr a b c d -> ChuMorphism t r arr a b e f Source #
Sequential composition of Chu morphisms.
Forward components compose covariantly; backward components compose contravariantly.
Adjoint law
chuLaw :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuMorphism (,) r (->) a b c d -> a -> d -> Bool Source #
The adjoint law for arr = (->) and the cartesian tensor.
A pair (f⁺, f⁻) is a Chu morphism exactly when
e_B (f⁺ a, d) = e_A (a, f⁻ d) for all a and d.
chuLawAt :: Eq s => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuMorphism (,) r (->) a b c d -> a -> d -> (r -> s) -> Bool Source #
Delivery pairing
Arguments
| :: (ChuSemiring r, Eq a) | |
| => [a] | Recipients on the post. |
| -> a | Recipient name. |
| -> r |
Arguments
| :: (ChuSemiring r, Eq col) | |
| => [col] | Agents (column labels). |
| -> [[col]] | Recipient lists for each post (row labels are implicit). |
| -> [[r]] |
Delivery matrix for a fixed list of posts and a roster of agents.
Rows are posts (in the order given), columns are agents (in the order
given), and entry (p, a) is the delivery weight of post p to agent a.
Tensor and par over Set
data ChuTensorNeg a b c d Source #
Negative part of the Chu tensor A ⊗ B.
A value (f, g) lives here when e_A(a, g(b)) = e_B(b, f(a)) for all
a ∈ A⁺, b ∈ B⁺.
Constructors
| ChuTensorNeg | |
Fields
| |
data ChuParPos a b c d Source #
Positive part of the Chu par A ⅋ B.
A value (f, g) lives here when e_A(g(d), a) = e_B(f(a), d) for all
a ∈ A⁻, d ∈ B⁻.
Constructors
| ChuParPos | |
Fields
| |
tensorChuObj :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (a, c) (ChuTensorNeg a b c d) Source #
Tensor product of Chu objects over Set.
parChuObj :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (ChuParPos a b c d) (b, d) Source #
Par product of Chu objects over Set.
lolliChuObj :: Eq r => ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (ChuParPos b a c d) (a, d) Source #
Linear implication A ⊸ B = A⊥ ⅋ B over Set.
The positive carrier is the set of Chu morphisms A → B, packaged as
ChuParPos after negating A.
withChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (a, c) (Either b d) Source #
Additive conjunction A & B over Set.
Positive carrier is A⁺ × B⁺; negative carrier is the disjoint union
A⁻ + B⁻.
oplusChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuObj (,) r (->) (Either a c) (b, d) Source #
Additive disjunction A ⊕ B over Set.
Positive carrier is the disjoint union A⁺ + B⁺; negative carrier is
A⁻ × B⁻.
topChuObj :: ChuObj (,) r (->) () Void Source #
Additive unit ⊤ over Set.
Positive carrier is the terminal object 1; negative carrier is the
initial object 0.
zeroChuObj :: ChuObj (,) r (->) Void () Source #
Additive unit 0 over Set.
Positive carrier is the initial object 0; negative carrier is the
terminal object 1.
proj1Chu :: forall {k} (r :: k) a c b d. ChuMorphism (,) r (->) (a, c) (Either b d) a b Source #
First projection A & B → A.
proj2Chu :: forall {k} (r :: k) a c b d. ChuMorphism (,) r (->) (a, c) (Either b d) c d Source #
Second projection A & B → B.
inj1Chu :: forall {k} (r :: k) a b c d. ChuMorphism (,) r (->) a b (Either a c) (b, d) Source #
Left injection A → A ⊕ B.
inj2Chu :: forall {k} (r :: k) c d a b. ChuMorphism (,) r (->) c d (Either a c) (b, d) Source #
Right injection A → A ⊕ B.
unitTopChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b () Void Source #
Unique morphism A → ⊤.
unitZeroChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) Void () a b Source #
Unique morphism 0 → A.
pairChu :: forall {k} (r :: k) c d a b e f. ChuMorphism (,) r (->) c d a b -> ChuMorphism (,) r (->) c d e f -> ChuMorphism (,) r (->) c d (a, e) (Either b f) Source #
Pairing of morphisms into the additive conjunction.
Universal property of A & B: given f : C → A and g : C → B, produce
⟨f,g⟩ : C → A & B.
copairChu :: forall {k} (r :: k) a b c d e f. ChuMorphism (,) r (->) a b c d -> ChuMorphism (,) r (->) e f c d -> ChuMorphism (,) r (->) (Either a e) (b, f) c d Source #
Copairing of morphisms out of the additive disjunction.
Universal property of A ⊕ B: given f : A → C and g : B → C, produce
[f,g] : A ⊕ B → C.
withTopLChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b ((), a) (Either Void b) Source #
Left unit isomorphism A → ⊤ & A.
withTopLInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) ((), a) (Either Void b) a b Source #
Inverse of withTopLChu.
withTopRChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b (a, ()) (Either b Void) Source #
Right unit isomorphism A → A & ⊤.
withTopRInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) (a, ()) (Either b Void) a b Source #
Inverse of withTopRChu.
zeroPlusLChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b (Either Void a) ((), b) Source #
Left unit isomorphism A → 0 ⊕ A.
zeroPlusLInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) (Either Void a) ((), b) a b Source #
Inverse of zeroPlusLChu.
zeroPlusRChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) a b (Either a Void) (b, ()) Source #
Right unit isomorphism A → A ⊕ 0.
zeroPlusRInvChu :: forall {k} (r :: k) a b. ChuMorphism (,) r (->) (Either a Void) (b, ()) a b Source #
Inverse of zeroPlusRChu.
evalChu :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) c d -> ChuMorphism (,) r (->) (a, ChuParPos b a c d) (ChuTensorNeg a b (ChuParPos b a c d) (a, d)) c d Source #
Evaluation counit A ⊗ (A ⊸ B) → B over Set.
Forward applies the Chu morphism stored in the implication object. Backward pairs the argument with its own positive point, recovering the adjoint condition.
tensorChu :: forall {k} (r :: k) a b c d e f g h. ChuMorphism (,) r (->) a b c d -> ChuMorphism (,) r (->) e f g h -> ChuMorphism (,) r (->) (a, e) (ChuTensorNeg a b e f) (c, g) (ChuTensorNeg c d g h) Source #
Tensor of two Chu morphisms.
parChu :: forall {k} (r :: k) a b c d e f g h. ChuMorphism (,) r (->) a b c d -> ChuMorphism (,) r (->) e f g h -> ChuMorphism (,) r (->) (ChuParPos a b e f) (b, f) (ChuParPos c d g h) (d, h) Source #
Par of two Chu morphisms.
chuUnitObj :: ChuObj (,) r (->) () r Source #
Unit object I = (1, K) with pairing snd.
chuBottomObj :: ChuObj (,) r (->) r () Source #
Bottom object ⊥ = (K, 1), dual of the unit.
chuTensorNegs :: (Eq r, Eq (ChuPosType a), Eq (ChuPosType b), ChuObject r a, ChuObject r b) => Proxy a -> Proxy b -> [ChuTensorNeg (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b)] Source #
Enumerate all ChuTensorNeg values for finite carriers.
chuParPoss :: (Eq r, Eq (ChuNegType a), Eq (ChuNegType b), ChuObject r a, ChuObject r b) => Proxy a -> Proxy b -> [ChuParPos (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b)] Source #
Enumerate all ChuParPos values for finite carriers.
chuSeparated :: (Eq r, Eq (ChuPosType a), ChuObject r a) => Proxy a -> Bool Source #
A Chu object is separated when the pairing distinguishes every pair of
positive points. Equivalently, the transposed pairing A⁺ -> (A⁻ ⊸ ⊥) is
injective.
chuExtensional :: (Eq r, Eq (ChuNegType a), ChuObject r a) => Proxy a -> Bool Source #
A Chu object is extensional when the pairing distinguishes every pair of
negative points. Equivalently, the pairing A⁻ -> (A⁺ ⊸ ⊥) is injective.
leftUnitorChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) ((), a) (ChuTensorNeg () r a b) a b Source #
Left unitor λ_A : I ⊗ A → A over Set.
Forward drops the unit; backward maps a negative point b to the unique
Chu tensor negative with f() = b and g a = e(a, b).
leftUnitorChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b ((), a) (ChuTensorNeg () r a b) Source #
Inverse of the left unitor.
rightUnitorChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) (a, ()) (ChuTensorNeg a b () r) a b Source #
Right unitor ρ_A : A ⊗ I → A over Set.
rightUnitorChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (a, ()) (ChuTensorNeg a b () r) Source #
Inverse of the right unitor.
assocChu :: forall {k} (r :: k) a c e b d f. ChuMorphism (,) r (->) ((a, c), e) (ChuTensorNeg (a, c) (ChuTensorNeg a b c d) e f) (a, (c, e)) (ChuTensorNeg a b (c, e) (ChuTensorNeg c d e f)) Source #
Associator (A ⊗ B) ⊗ C → A ⊗ (B ⊗ C) over Set.
Positives reassociate as pairs. Negatives reassociate the adjoint
pairs: a negative of A ⊗ (B ⊗ C) is sent to a negative of
(A ⊗ B) ⊗ C by unpacking the inner ChuTensorNeg.
assocChuInv :: forall {k} (r :: k) a c e b d f. ChuMorphism (,) r (->) (a, (c, e)) (ChuTensorNeg a b (c, e) (ChuTensorNeg c d e f)) ((a, c), e) (ChuTensorNeg (a, c) (ChuTensorNeg a b c d) e f) Source #
Inverse associator A ⊗ (B ⊗ C) → (A ⊗ B) ⊗ C over Set.
slideChu :: forall {k} (r :: k) a c e b d f. ChuMorphism (,) r (->) (a, (c, e)) (ChuTensorNeg a b (c, e) (ChuTensorNeg c d e f)) (c, (a, e)) (ChuTensorNeg c d (a, e) (ChuTensorNeg a b e f)) Source #
Slide A ⊗ (B ⊗ C) → B ⊗ (A ⊗ C) over Set.
This is the Channel slide, derived as assoc . tensor braid id . assoc'
and written directly so the instance does not have to manufacture
intermediate object constraints.
Embedding from Poles
polesAsChu :: forall {k1} arr (a :: k1). Poles arr a a -> PointedChuObj (,) (arr a a) (->) (In arr a) (Out arr a) Source #
Embed a symmetric pole into a pointed Chu object.
A self-dual channel Poles arr a a has write pole In arr a and read pole
Out arr a. close is already the pairing
In ⊗ Out → arr a a, so the embedding is direct. The point pair
(conjoint e, companion e) is retained as the chosen point of the pointed
object.
lawfulDimap :: forall {k1} arr (a :: k1). ChuMorphism (,) (arr a a) (->) (In arr a) (Out arr a) (In arr a) (Out arr a) -> Poles arr a a -> Poles arr a a Source #
Apply a Chu endomorphism to a symmetric pole.
This is the lawful counterpart to the free dimap: the
forward and backward maps are an adjoint pair by construction of
ChuMorphism. The Chu law is discharged by the type, not just tested.
Object-indexed Chu category (SepChu / OChu)
class ChuObject r a where Source #
A type-level Chu object: a tag with a canonical ChuObj value and
finite carrier enumerations.
chuPosAll and chuNegAll are used by separation / extensionality oracles
and by enumeration of tensor / par negatives. They default to a runtime
error; only objects that actually participate in finite oracles need to
supply them.
Minimal complete definition
Methods
chuObject :: ChuObj (,) r (->) (ChuPosType a) (ChuNegType a) Source #
chuPosAll :: [ChuPosType a] Source #
chuNegAll :: [ChuNegType a] Source #
Instances
class ChuObject r a => ChuSeparated r a Source #
Marker: the pairing distinguishes positive points.
Runtime evidence is available through chuSeparated. Instances close the
constructors we admit (ChuTwo, ChuOUnit, tensor, negation).
Instances
class ChuObject r a => ChuExtensional r a Source #
Marker: the pairing distinguishes negative points.
Runtime evidence is available through chuExtensional. Negation swaps
this with ChuSeparated.
Instances
type family ChuPosNonEmpty a :: Bool where ... Source #
Type-level non-emptiness of an object's positive carrier.
Used to guard additive marker instances: A & B can only be extensional
when both A and B have at least one positive point, because the
negative carrier is the disjoint union and distinct injections must be
separated by a positive pair.
Equations
| ChuPosNonEmpty (ChuOUnit r) = 'True | |
| ChuPosNonEmpty (ChuOTop r) = 'True | |
| ChuPosNonEmpty (ChuOZero r) = 'False | |
| ChuPosNonEmpty (ChuOTensor r a b) = If (ChuPosNonEmpty a) (ChuPosNonEmpty b) 'False | |
| ChuPosNonEmpty (ChuOWith r a b) = If (ChuPosNonEmpty a) (ChuPosNonEmpty b) 'False | |
| ChuPosNonEmpty (ChuOPlus r a b) = If (ChuPosNonEmpty a) 'True (ChuPosNonEmpty b) | |
| ChuPosNonEmpty (ChuOPar r a b) = 'True | |
| ChuPosNonEmpty (ChuONeg r a) = ChuNegNonEmpty a | |
| ChuPosNonEmpty (ChuOLolli r a b) = 'True | |
| ChuPosNonEmpty (ChuOBang r a) = ChuPosNonEmpty a | |
| ChuPosNonEmpty (ChuOWhyNot r a) = 'True | |
| ChuPosNonEmpty ChuTwo = 'True | |
| ChuPosNonEmpty ChuThree = 'True | |
| ChuPosNonEmpty ChuDouble01 = 'True | |
| ChuPosNonEmpty ChuDelivery = 'True |
type family ChuNegNonEmpty a :: Bool where ... Source #
Type-level non-emptiness of an object's negative carrier.
Used to guard additive marker instances: A ⊕ B can only be separated
when both A and B have at least one negative point, because the
positive carrier is the disjoint union and distinct injections must be
separated by a negative pair.
Equations
| ChuNegNonEmpty (ChuOUnit r) = 'True | |
| ChuNegNonEmpty (ChuOTop r) = 'False | |
| ChuNegNonEmpty (ChuOZero r) = 'True | |
| ChuNegNonEmpty (ChuOTensor r a b) = 'True | |
| ChuNegNonEmpty (ChuOWith r a b) = If (ChuNegNonEmpty a) 'True (ChuNegNonEmpty b) | |
| ChuNegNonEmpty (ChuOPlus r a b) = If (ChuNegNonEmpty a) (ChuNegNonEmpty b) 'False | |
| ChuNegNonEmpty (ChuOPar r a b) = If (ChuNegNonEmpty a) (ChuNegNonEmpty b) 'False | |
| ChuNegNonEmpty (ChuONeg r a) = ChuPosNonEmpty a | |
| ChuNegNonEmpty (ChuOLolli r a b) = If (ChuPosNonEmpty a) (ChuNegNonEmpty b) 'False | |
| ChuNegNonEmpty (ChuOBang r a) = 'True | |
| ChuNegNonEmpty (ChuOWhyNot r a) = ChuNegNonEmpty a | |
| ChuNegNonEmpty ChuTwo = 'True | |
| ChuNegNonEmpty ChuThree = 'True | |
| ChuNegNonEmpty ChuDouble01 = 'True | |
| ChuNegNonEmpty ChuDelivery = 'True |
The object-indexed Chu construction as a base arrow.
Instances
| Category (OChu r :: Type -> Type -> Type) Source # | |
| Eq r => Channel (ChuOTensor r :: Type -> Type -> Type) (OChu r :: Type -> Type -> Type) Source # | Monoidal structure on the object-level Chu tensor.
|
Defined in Circuit.Chu Methods assoc :: OChu r (ChuOTensor r (ChuOTensor r a b) c) (ChuOTensor r a (ChuOTensor r b c)) # assoc' :: OChu r (ChuOTensor r a (ChuOTensor r b c)) (ChuOTensor r (ChuOTensor r a b) c) # slide :: OChu r (ChuOTensor r a (ChuOTensor r b c)) (ChuOTensor r b (ChuOTensor r a c)) # | |
OChu constrained combinators (evidence at use sites)
parOChu :: OChu r a b -> OChu r c d -> OChu r (ChuOTensor r a c) (ChuOTensor r b d) Source #
Parallel composition for OChu.
unitlOChu :: ChuObject r a => OChu r (ChuOTensor r (ChuOUnit r) a) a Source #
Left unitor I ⊗ A → A for OChu.
unitlOChu' :: ChuObject r a => OChu r a (ChuOTensor r (ChuOUnit r) a) Source #
Inverse left unitor A → I ⊗ A for OChu.
unitrOChu :: ChuObject r a => OChu r (ChuOTensor r a (ChuOUnit r)) a Source #
Right unitor A ⊗ I → A for OChu.
unitrOChu' :: ChuObject r a => OChu r a (ChuOTensor r a (ChuOUnit r)) Source #
Inverse right unitor A → A ⊗ I for OChu.
swapOChu :: OChu r (ChuOTensor r a b) (ChuOTensor r b a) Source #
Symmetric braiding A ⊗ B → B ⊗ A for OChu.
unitlPOChu :: OChu r (ChuOPar r (Bot (ChuOPar r :: Type -> Type -> Type)) a) a Source #
Left unitor ⊥ ⅋ A → A for OChu.
unitlPOChu' :: ChuObject r a => OChu r a (ChuOPar r (Bot (ChuOPar r :: Type -> Type -> Type)) a) Source #
Inverse left unitor A → ⊥ ⅋ A for OChu.
unitrPOChu :: OChu r (ChuOPar r a (Bot (ChuOPar r :: Type -> Type -> Type))) a Source #
Right unitor A ⅋ ⊥ → A for OChu.
unitrPOChu' :: ChuObject r a => OChu r a (ChuOPar r a (Bot (ChuOPar r :: Type -> Type -> Type))) Source #
Inverse right unitor A → A ⅋ ⊥ for OChu.
evalOChu :: (ChuObject r a, ChuObject r b) => OChu r (ChuOTensor r a (ChuOLolli r a b)) b Source #
Evaluation counit A ⊗ (A ⊸ B) → B for OChu.
curryOChu :: OChu r (ChuOTensor r a b) c -> OChu r a (ChuOLolli r b c) Source #
Curry (A ⊗ B → C) → (A → B ⊸ C) for OChu.
uncurryOChu :: OChu r a (ChuOLolli r b c) -> OChu r (ChuOTensor r a b) c Source #
Uncurry (A → B ⊸ C) → (A ⊗ B → C) for OChu.
introduceOChu :: ChuObject r a => OChu r a (ChuOWhyNot r a) Source #
Introduction A → ?A for OChu.
mergeEOChu :: OChu r (ChuOPar r (ChuOWhyNot r a) (ChuOWhyNot r a)) (ChuOWhyNot r a) Source #
Merge ?A ⅋ ?A → ?A for OChu.
copyTOChu :: OChu r (ChuOBang r a) (ChuOTensor r (ChuOBang r a) (ChuOBang r a)) Source #
Copy !A → !A ⊗ !A for OChu.
plusTOChu :: forall r a. Monoid (ChuPosType a) => OChu r (ChuOTensor r (ChuOBang r a) (ChuOBang r a)) (ChuOBang r a) Source #
Merge !A ⊗ !A → !A for OChu.
zeroTOChu :: forall r a. Monoid (ChuPosType a) => OChu r (ChuOUnit r) (ChuOBang r a) Source #
Zero I → !A for OChu.
Unit object type for OChu.
Constructors
| ChuOUnit |
Instances
| ChuExtensional r (ChuOUnit r) Source # | |
Defined in Circuit.Chu | |
| ChuObject r (ChuOUnit r) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOUnit r)) (ChuNegType (ChuOUnit r)) Source # chuPosAll :: [ChuPosType (ChuOUnit r)] Source # chuNegAll :: [ChuNegType (ChuOUnit r)] Source # | |
| ChuSeparated r (ChuOUnit r) Source # | |
Defined in Circuit.Chu | |
data ChuOTensor r (a :: k) (b :: k1) Source #
Tensor object type for OChu.
Constructors
| ChuOTensor |
Instances
data ChuONeg r (a :: k) Source #
Object-level negation A⊥.
Carriers swap; the pairing is negateChu of the underlying object.
Separation and extensionality swap: if A is separated then A⊥ is
extensional, and conversely.
Constructors
| ChuONeg |
Instances
| ChuSeparated r a => ChuExtensional r (ChuONeg r a) Source # | |
Defined in Circuit.Chu | |
| ChuObject r a => ChuObject r (ChuONeg r a) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuONeg r a)) (ChuNegType (ChuONeg r a)) Source # chuPosAll :: [ChuPosType (ChuONeg r a)] Source # chuNegAll :: [ChuNegType (ChuONeg r a)] Source # | |
| ChuExtensional r a => ChuSeparated r (ChuONeg r a) Source # | |
Defined in Circuit.Chu | |
data ChuOWith r (a :: k) (b :: k1) Source #
Object-level additive conjunction A & B.
ChuSeparated is available whenever both summands are separated.
ChuExtensional is guarded by ChuPosNonEmpty: when one summand has an
empty positive carrier (e.g. A & 0), distinct negative injections cannot
be separated, so the instance is not asserted.
Constructors
| ChuOWith |
Instances
| (ChuExtensional r a, ChuExtensional r b, ChuPosNonEmpty a ~ 'True, ChuPosNonEmpty b ~ 'True) => ChuExtensional r (ChuOWith r a b) Source # | |
Defined in Circuit.Chu | |
| (ChuObject r a, ChuObject r b) => ChuObject r (ChuOWith r a b) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOWith r a b)) (ChuNegType (ChuOWith r a b)) Source # chuPosAll :: [ChuPosType (ChuOWith r a b)] Source # chuNegAll :: [ChuNegType (ChuOWith r a b)] Source # | |
| (ChuSeparated r a, ChuSeparated r b) => ChuSeparated r (ChuOWith r a b) Source # | |
Defined in Circuit.Chu | |
data ChuOPlus r (a :: k) (b :: k1) Source #
Object-level additive disjunction A ⊕ B.
ChuExtensional is available whenever both summands are extensional.
ChuSeparated is guarded by ChuNegNonEmpty: when one summand has an
empty negative carrier (e.g. ⊤ ⊕ B), distinct positive injections cannot
be separated, so the instance is not asserted.
Constructors
| ChuOPlus |
Instances
| (ChuExtensional r a, ChuExtensional r b) => ChuExtensional r (ChuOPlus r a b) Source # | |
Defined in Circuit.Chu | |
| (ChuObject r a, ChuObject r b) => ChuObject r (ChuOPlus r a b) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOPlus r a b)) (ChuNegType (ChuOPlus r a b)) Source # chuPosAll :: [ChuPosType (ChuOPlus r a b)] Source # chuNegAll :: [ChuNegType (ChuOPlus r a b)] Source # | |
| (ChuSeparated r a, ChuSeparated r b, ChuNegNonEmpty a ~ 'True, ChuNegNonEmpty b ~ 'True) => ChuSeparated r (ChuOPlus r a b) Source # | |
Defined in Circuit.Chu | |
data ChuOPar r (a :: k) (b :: k1) Source #
Object-level multiplicative disjunction A ⅋ B.
Positive carrier is the set of ChuParPos witnesses; negative carrier is
the product A⁻ × B⁻. This is the real par, distinct from the additive
disjunction ChuOPlus.
Constructors
| ChuOPar |
Instances
| (Eq r, ChuExtensional r a, ChuExtensional r b) => ChuExtensional r (ChuOPar r a b) Source # | |
Defined in Circuit.Chu | |
| (Eq r, ChuObject r a, ChuObject r b) => ChuObject r (ChuOPar r a b) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOPar r a b)) (ChuNegType (ChuOPar r a b)) Source # chuPosAll :: [ChuPosType (ChuOPar r a b)] Source # chuNegAll :: [ChuNegType (ChuOPar r a b)] Source # | |
| (Eq r, ChuSeparated r a, ChuSeparated r b) => ChuSeparated r (ChuOPar r a b) Source # | |
Defined in Circuit.Chu | |
| type Bot (ChuOPar r :: Type -> Type -> Type) Source # | The par unit is the dual of the tensor unit: |
Object-level additive unit ⊤.
Constructors
| ChuOTop |
Instances
| ChuExtensional r (ChuOTop r) Source # | |
Defined in Circuit.Chu | |
| ChuObject r (ChuOTop r) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOTop r)) (ChuNegType (ChuOTop r)) Source # chuPosAll :: [ChuPosType (ChuOTop r)] Source # chuNegAll :: [ChuNegType (ChuOTop r)] Source # | |
| ChuSeparated r (ChuOTop r) Source # | |
Defined in Circuit.Chu | |
Object-level additive zero 0.
Constructors
| ChuOZero |
Instances
| ChuExtensional r (ChuOZero r) Source # | |
Defined in Circuit.Chu | |
| ChuObject r (ChuOZero r) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOZero r)) (ChuNegType (ChuOZero r)) Source # chuPosAll :: [ChuPosType (ChuOZero r)] Source # chuNegAll :: [ChuNegType (ChuOZero r)] Source # | |
| ChuSeparated r (ChuOZero r) Source # | |
Defined in Circuit.Chu | |
The self-dual two-point Chu object used in the oracles.
Constructors
| ChuTwo |
Instances
| ChuExtensional Bool ChuTwo Source # | |
Defined in Circuit.Chu | |
| ChuObject Bool ChuTwo Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) Bool (->) (ChuPosType ChuTwo) (ChuNegType ChuTwo) Source # chuPosAll :: [ChuPosType ChuTwo] Source # chuNegAll :: [ChuNegType ChuTwo] Source # | |
| ChuSeparated Bool ChuTwo Source # | |
Defined in Circuit.Chu | |
A non-self-dual three-point Chu object over Bool.
Both carriers are Maybe Bool, but the pairing is the non-symmetric
partial-order relation (Nothing <= Just False <= Just True), not equality.
This breaks the self-duality coincidence of ChuTwo while keeping the
object separated and extensional.
Constructors
| ChuThree |
Instances
| ChuExtensional Bool ChuThree Source # | |
Defined in Circuit.Chu | |
| ChuObject Bool ChuThree Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) Bool (->) (ChuPosType ChuThree) (ChuNegType ChuThree) Source # chuPosAll :: [ChuPosType ChuThree] Source # chuNegAll :: [ChuNegType ChuThree] Source # | |
| ChuSeparated Bool ChuThree Source # | |
Defined in Circuit.Chu | |
data ChuDouble01 Source #
A finite Double-semiring Chu object.
Carriers are the two-element type Bool, representing the subset
{0, 1} of Double. The full real line is replaced by this tiny
subset so the finite oracles remain runnable. The pairing lands in
Double via the existing ChuSemiring instance.
Constructors
| ChuDouble01 |
Instances
| ChuExtensional Double ChuDouble01 Source # | |
Defined in Circuit.Chu | |
| ChuObject Double ChuDouble01 Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) Double (->) (ChuPosType ChuDouble01) (ChuNegType ChuDouble01) Source # | |
| ChuSeparated Double ChuDouble01 Source # | |
Defined in Circuit.Chu | |
data ChuDelivery Source #
A concrete delivery-matrix Chu object: two posts and two agents.
The pairing is the boolean delivery matrix computed by deliveryMatrix
and deliversToSemiring. Posts and agents are indexed by Bool so the
carriers stay finite and the oracles remain runnable.
Constructors
| ChuDelivery |
Instances
| ChuExtensional Bool ChuDelivery Source # | |
Defined in Circuit.Chu | |
| ChuObject Bool ChuDelivery Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) Bool (->) (ChuPosType ChuDelivery) (ChuNegType ChuDelivery) Source # | |
| ChuSeparated Bool ChuDelivery Source # | |
Defined in Circuit.Chu | |
A tiny self-dual Chu object over Any (disjunction monoid) with equality
pairing. Used to test the bimonoid on !A from a Monoid on A⁺.
Constructors
| ChuAny |
Instances
| ChuExtensional Bool ChuAny Source # | |
Defined in Circuit.Chu | |
| ChuObject Bool ChuAny Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) Bool (->) (ChuPosType ChuAny) (ChuNegType ChuAny) Source # chuPosAll :: [ChuPosType ChuAny] Source # chuNegAll :: [ChuNegType ChuAny] Source # | |
| ChuSeparated Bool ChuAny Source # | |
Defined in Circuit.Chu | |
swapChu :: (ChuPosType (ChuOTensor r a b) ~ (ChuPosType a, ChuPosType b), ChuNegType (ChuOTensor r a b) ~ ChuTensorNeg (ChuPosType a) (ChuNegType a) (ChuPosType b) (ChuNegType b), ChuPosType (ChuOTensor r b a) ~ (ChuPosType b, ChuPosType a), ChuNegType (ChuOTensor r b a) ~ ChuTensorNeg (ChuPosType b) (ChuNegType b) (ChuPosType a) (ChuNegType a)) => ChuMorphism (,) r (->) (ChuPosType (ChuOTensor r a b)) (ChuNegType (ChuOTensor r a b)) (ChuPosType (ChuOTensor r b a)) (ChuNegType (ChuOTensor r b a)) Source #
Symmetric braiding for the Chu tensor over Set.
dnUnitChu :: OChu r a (ChuONeg r (ChuONeg r a)) Source #
Double-negation unit A → A⊥⊥.
On carriers this is the identity: two braids restore A⁺ and A⁻, and
the pairing is e . braid . braid = e. It is an isomorphism precisely
on separated-extensional objects.
data ChuOLolli r (a :: k) (b :: k1) Source #
Object-level linear implication A ⊸ B = A⊥ ⅋ B.
Constructors
| ChuOLolli |
Instances
| (Eq r, ChuExtensional r a, ChuExtensional r b) => ChuExtensional r (ChuOLolli r a b) Source # | |
Defined in Circuit.Chu | |
| (Eq r, ChuObject r a, ChuObject r b) => ChuObject r (ChuOLolli r a b) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOLolli r a b)) (ChuNegType (ChuOLolli r a b)) Source # chuPosAll :: [ChuPosType (ChuOLolli r a b)] Source # chuNegAll :: [ChuNegType (ChuOLolli r a b)] Source # | |
| (Eq r, ChuSeparated r a, ChuSeparated r b) => ChuSeparated r (ChuOLolli r a b) Source # | |
Defined in Circuit.Chu | |
curryChu :: forall {k} (r :: k) a c b d e f. ChuMorphism (,) r (->) (a, c) (ChuTensorNeg a b c d) e f -> ChuMorphism (,) r (->) a b (ChuParPos d c e f) (c, f) Source #
Curry (A ⊗ B → C) → (A → B ⊸ C) over Set.
uncurryChu :: forall {k} (r :: k) a b d c e f. ChuMorphism (,) r (->) a b (ChuParPos d c e f) (c, f) -> ChuMorphism (,) r (->) (a, c) (ChuTensorNeg a b c d) e f Source #
Uncurry (A → B ⊸ C) → (A ⊗ B → C) over Set.
chuFunctionals :: Eq a => [a] -> [r] -> [a -> r] Source #
All functions from a finite domain to a finite codomain.
bangChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) a (a -> r) Source #
Cofree cocommutative comonoid on a Set-based Chu object.
Positives are those of A; negatives are every functional A⁺ → r;
the pairing is evaluation. Original negatives embed by Yoneda
d ↦ \a -> e(a, d), and constants k ↦ const k supply discard.
whyNotChuObj :: ChuObj (,) r (->) a b -> ChuObj (,) r (->) (b -> r) b Source #
Free commutative monoid ?A = (!A⊥)⊥.
Positives are the functionals A⁻ → r; negatives are those of A.
copyBangChu :: ChuMorphism (,) r (->) a (a -> r) (a, a) (ChuTensorNeg a (a -> r) a (a -> r)) Source #
Copy !A → !A ⊗ !A: diagonal on points, contraction on functionals.
discardBangChu :: ChuMorphism (,) r (->) a (a -> r) () r Source #
Discard !A → I: the constant functionals.
mergeBangChu :: Monoid a => ChuMorphism (,) r (->) (a, a) (ChuTensorNeg a (a -> r) a (a -> r)) a (a -> r) Source #
Merge !A ⊗ !A → !A: the monoid operation on points, bilinearly
extended to functionals.
zeroBangChu :: Monoid a => ChuMorphism (,) r (->) () r a (a -> r) Source #
Zero I → !A: the monoid unit as a point of A⁺.
derelictChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a (a -> r) a b Source #
Dereliction !A → A: identity on points, Yoneda on negatives.
zeroWhyNotChu :: ChuSemiring r => ChuMorphism (,) r (->) () r (b -> r) b Source #
Zero I → ?A. The unit functional is constantly sZero.
This is not the ⅋-monoid unit (that is zeroWhyNotParChu : ⊥ → ?A).
introduceChu :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (b -> r) b Source #
Introduction A → ?A: Yoneda on positives, identity on negatives.
digChu :: ChuMorphism (,) r (->) a (a -> r) a (a -> r) Source #
Digging !A → !!A.
Over the Set-based ! of this module, !!A is the same object as !A
(positive carrier A⁺, negative carrier A⁺ → r), so digging is the
identity. This is an observable fact about the model, not a stub.
promoteChu :: ChuMorphism (,) r (->) (a, c) (ChuTensorNeg a (a -> r) c (c -> r)) (a, c) ((a, c) -> r) Source #
Promotion !A ⊗ !B → !(A & B).
Forward is the identity on the shared positive carrier (A⁺, B⁺).
Backward turns a bilinear element of !A ⊗ !B into a functional on
(A⁺, B⁺) using either leg of the bilinear condition.
mergeWhyNotParChu :: ChuMorphism (,) r (->) (ChuParPos (b -> r) b (b -> r) b) (b, b) (b -> r) b Source #
Merge ?A ⅋ ?A → ?A: the dual of copyBangChu.
A par-positive is a pair of functionals A⁻ → (A⁻ → r) satisfying
g y x = f x y. Merge contracts the diagonal \x -> g x x.
zeroWhyNotParChu :: ChuMorphism (,) r (->) r () (b -> r) b Source #
⅋-monoid unit ⊥ → ?A: constants, dual of discardBangChu.
leftUnitorParChu :: ChuMorphism (,) r (->) (ChuParPos r () p n) ((), n) p n Source #
Left unitor ⊥ ⅋ A → A over Set.
leftUnitorParChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (ChuParPos r () a b) ((), b) Source #
Inverse of the left par unitor: A → ⊥ ⅋ A over Set.
rightUnitorParChu :: ChuMorphism (,) r (->) (ChuParPos p n r ()) (n, ()) p n Source #
Right unitor A ⅋ ⊥ → A over Set.
rightUnitorParChuInv :: ChuObj (,) r (->) a b -> ChuMorphism (,) r (->) a b (ChuParPos a b r ()) (b, ()) Source #
Inverse of the right par unitor: A → A ⅋ ⊥ over Set.
assocParChu :: forall {k} (r :: k) a b c d e f. ChuMorphism (,) r (->) (ChuParPos (ChuParPos a b c d) (b, d) e f) ((b, d), f) (ChuParPos a b (ChuParPos c d e f) (d, f)) (b, (d, f)) Source #
Associator (A ⅋ B) ⅋ C → A ⅋ (B ⅋ C) over Set.
assocParChuInv :: forall {k} (r :: k) a b c d e f. ChuMorphism (,) r (->) (ChuParPos a b (ChuParPos c d e f) (d, f)) (b, (d, f)) (ChuParPos (ChuParPos a b c d) (b, d) e f) ((b, d), f) Source #
Inverse associator A ⅋ (B ⅋ C) → (A ⅋ B) ⅋ C over Set.
swapParChu :: forall {k} (r :: k) a b c d. ChuMorphism (,) r (->) (ChuParPos a b c d) (b, d) (ChuParPos c d a b) (d, b) Source #
Symmetric braiding A ⅋ B → B ⅋ A over Set.
data ChuOBang r (a :: k) Source #
Object-level !A.
Constructors
| ChuOBang |
Instances
| ChuObject r a => ChuExtensional r (ChuOBang r a) Source # | |
Defined in Circuit.Chu | |
| ChuObject r a => ChuObject r (ChuOBang r a) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOBang r a)) (ChuNegType (ChuOBang r a)) Source # chuPosAll :: [ChuPosType (ChuOBang r a)] Source # chuNegAll :: [ChuNegType (ChuOBang r a)] Source # | |
| ChuSeparated r a => ChuSeparated r (ChuOBang r a) Source # | |
Defined in Circuit.Chu | |
data ChuOWhyNot r (a :: k) Source #
Object-level ?A = (!A⊥)⊥.
Constructors
| ChuOWhyNot |
Instances
| ChuExtensional r a => ChuExtensional r (ChuOWhyNot r a) Source # | |
Defined in Circuit.Chu | |
| ChuObject r a => ChuObject r (ChuOWhyNot r a) Source # | |
Defined in Circuit.Chu Methods chuObject :: ChuObj (,) r (->) (ChuPosType (ChuOWhyNot r a)) (ChuNegType (ChuOWhyNot r a)) Source # chuPosAll :: [ChuPosType (ChuOWhyNot r a)] Source # chuNegAll :: [ChuNegType (ChuOWhyNot r a)] Source # | |
| ChuObject r a => ChuSeparated r (ChuOWhyNot r a) Source # | |
Defined in Circuit.Chu | |