| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Category.Enriched.Quantale
Description
Totally ordered, integral quantales, as far as computing closures of enriched profunctors
needs them: BOOL (relations, reachability) and
COST (metric spaces, shortest paths). Besides the structure
their classes already provide, the closure needs a handful of facts reflected to the value level,
collected in Quantale.
Synopsis
- class (Semicartesian v, Distributive v, Decidable v) => Quantale v where
- data MinIs (x :: v) (y :: v) where
- splitUnit :: forall {v} (x :: v) (y :: v). (Quantale v, Ob x, Ob y) => ((Unit :: v) ~> (x ** y)) -> ((Unit :: v) ~> x, (Unit :: v) ~> y)
- bottomTensor :: forall {v} (x :: v) (y :: v). (Quantale v, Ob x, Ob y) => ((InitialObject :: v) ** x) ~> y
- checkedArrow :: forall v (x :: v) (y :: v). (Decidable v, Ob x, Ob y) => x ~> y
Documentation
class (Semicartesian v, Distributive v, Decidable v) => Quantale v where Source Github #
As much of a quantale as a closure needs: a totally ordered, integral one. It is a
Semicartesian Distributive category, so the unit is the top element and the bottom absorbs,
the join of two objects is one of them (minIs), and the order is decidable. Totality makes a
single best walk exist. Infinite joins are not needed, since there are finitely many objects.
The methods reflect to the value level facts GHC cannot see through the type families: minIs
is totality, unitIsNotBottom says the order is nondegenerate, and unitIsTop is antisymmetry
at the unit (Semicartesian gives the arrow the other way).
Methods
minIs :: forall (x :: v) (y :: v). (Ob x, Ob y) => MinIs x y Source Github #
unitIsNotBottom :: ((Unit :: v) ~> (InitialObject :: v)) -> r Source Github #
unitIsTop :: forall (w :: v) r. Ob w => ((Unit :: v) ~> w) -> (w ~ (Unit :: v) => r) -> r Source Github #
Instances
| Quantale BOOL Source Github # | The walking arrow: the tensor is conjunction, the join disjunction. |
Defined in Proarrow.Category.Enriched.Quantale | |
| Quantale COST Source Github # | Costs: the tensor is addition, the join the minimum. Distances are compared with |
Defined in Proarrow.Category.Enriched.Quantale | |
splitUnit :: forall {v} (x :: v) (y :: v). (Quantale v, Ob x, Ob y) => ((Unit :: v) ~> (x ** y)) -> ((Unit :: v) ~> x, (Unit :: v) ~> y) Source Github #
In an integral quantale a tensor lies below each of its factors, since the other factor is at most the unit, so a unit into a tensor is a unit into each factor.
bottomTensor :: forall {v} (x :: v) (y :: v). (Quantale v, Ob x, Ob y) => ((InitialObject :: v) ** x) ~> y Source Github #
The bottom absorbs the tensor, and nothing lies below the bottom.
checkedArrow :: forall v (x :: v) (y :: v). (Decidable v, Ob x, Ob y) => x ~> y Source Github #
The arrow between two objects of a decidable order, when the caller knows it exists but its existence is not derived structurally (the triangle inequality for closures, for instance). As elsewhere in Proarrow.Category.Instance.Cost, it is checked at runtime.