Let and be preorders. A feasibility relation for given is a Monotone Map
If we say can be obtained given . Monotonicity says: if and then — if can be obtained given , then anything less () can be obtained given anything more (). A feasibility relation is exactly a -Profunctor (7S Exercise 4.10), and Censi calls them monotone co-design problems.
Sources: 7 Sketches §4.2.1 (Definition 4.2, Exercises 4.4, 4.7, 4.10), §4.2.3, §4.3 (), Example 4.11 (bridges), 4.12; Kittenlab Lecture 14 (relations as -valued functions).
| -enriched notion | order-theoretic notion |
|---|---|
| -category | preorder |
| -functor | monotone map |
| -profunctor | feasibility relation |
Bridges (Example 4.11)
Think of the preorders as cities (Hasse diagrams: an arrow is a way to get from to ) and the profunctor as bridges between them. iff one can get from to using paths within the cities and the bridges: for the pictured with , and bridges , , …, but . The whole picture, boxed, is a new preorder — the Collage . The matrix of values is the feasibility matrix (7S Exercise 4.12), and composition of feasibility relations is -matrix multiplication.
Properties
- The preimage is an Upper Set of (7S Exercise 4.4: “my aunt can explain a category given this book, hence a monoid given this book, and a category given nothing”).
- Feasibility relations compose via — “the navigator searches for a way-point” — forming the category (Category of Profunctors), which is compact closed with and monoidal product the Product Preorder: is “provide both and given both and ” (7S Exercise 4.64).
- Every monotone map gives feasibility relations (companion) and (conjoint); e.g. for (Example 4.37).
- Interpretation of ‘s Quantale structure: composes bridges, searches way-points, and (with iff , 7S Exercise 4.7) is the hom-element. “It is the fact that is a quantale which makes everything in this chapter work.”
Docs: Kittenlab Lecture 14
# a feasibility relation between finite preorders as a Bool matrix, with the monotonicity check
struct Feas
X::Vector; leqX::Function # resources produced
Y::Vector; leqY::Function # resources required
Φ::Matrix{Bool} # Φ[i, j] = "X[i] can be obtained given Y[j]"
end
function is_feasibility(F::Feas)
all(!(F.leqX(F.X[i′], F.X[i]) && F.leqY(F.Y[j], F.Y[j′]) && F.Φ[i, j]) || F.Φ[i′, j′]
for i in eachindex(F.X), i′ in eachindex(F.X), j in eachindex(F.Y), j′ in eachindex(F.Y))
end
# movie example: T×E = (mean,boring) ≤ (mean,funny),(g/n,boring) ≤ (g/n,funny); $ = 100K ≤ 500K ≤ 1M
TE = [(:mean, :boring), (:mean, :funny), (:gn, :boring), (:gn, :funny)]
leqTE(a, b) = (a[1] == b[1] || a[1] == :mean) && (a[2] == b[2] || a[2] == :boring)
D = [100, 500, 1000]; leqD(a, b) = a <= b
Φ = Bool[1 1 1; 0 0 1; 0 1 1; 0 0 0] # (g/n, funny) is infeasible at any cost
is_feasibility(Feas(TE, leqTE, D, leqD, Φ)) # true-- a feasibility relation is a monotone map Xᵒᵈ × Y → Bool
def FeasRel (X Y : Type) [Preorder X] [Preorder Y] := (Xᵒᵈ × Y) →o Bool
-- unfolding: Φ x y = true → x' ≤ x → y ≤ y' → Φ x' y' = true-- a feasibility relation as a Bool-valued function, monotone contravariantly in x, covariantly in y
newtype Feas x y = Feas (x -> y -> Bool)
-- law: leq x' x && leq y y' && phi x y ==> phi x' y'
-- the companion of a monotone map: "F p is available given q"
companion :: Preorder y => (x -> y) -> Feas x y
companion f = Feas (\p q -> leq (f p) q)