| 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, and a totally ordered, integral one at that: a
Semicartesian Distributive category, so that the unit is the top element and the bottom
absorbs, in which the join of two objects is one of them (minIs) and the order is decidable.
Totality is what makes a single best walk exist; in a quantale of, say, sets of paths, a join is
attained by no one summand. Infinite joins are not needed, since there are finitely many objects.
The methods reflect to the value level facts that GHC cannot see through the type families:
minIs is totality, and unitIsNotBottom and unitIsTop say the order is nondegenerate and
skeletal -- the latter is antisymmetry at the unit, since Semicartesian already 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.