Exercise 3.26, continued (Scott 1981, PRG-19, §3) — the sum-valued conditional #
and which
This module completes Exercise 3.26 with the two follow-up operators Scott asks for:
the sum-valued conditional
condSum : T × D₀ × D₁ → D₀ + D₁, routingtrue → in₀,false → in₁,⊥ → ⊥. It is obtained for free by composition: feeding the two inputs through the injectionsin₀, in₁into the common domainS = D₀ + D₁and then applying the conditionalcond S : T × S × S → Sof Exercise 3.26. The three identities follow fromcond_true/false/bot.the discriminator
which : D₀ + D₁ → Treading the tag (0X ↦ true,1Y ↦ false,Λ ↦ ⊥), together with Scott's identitycond(which x, in₀(out₀ x), in₁(out₁ x)) = xfor allx ∈ |D₀ + D₁|.
The discriminator is built directly as a neighbourhood relation; its three guards
on the truth
component are mutually exclusive because the three forms of a sum-neighbourhood
(Λ-master, left
copy, right copy) are mutually exclusive (Exercise 3.18, using non-emptiness).
The embedding T × D₀ × D₁ → T × S × S (S = D₀ + D₁) that injects the two
value slots into
the sum via in₀ and in₁, leaving the truth slot fixed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exercise 3.26 (Scott 1981, PRG-19). The sum-valued conditional T × D₀ × D₁ → D₀ + D₁.
Equations
- Domain.Neighborhood.Exercise326.condSum V₀ V₁ h₀ h₁ = (Domain.Neighborhood.Exercise326.cond (Domain.Neighborhood.sum V₀ V₁ h₀ h₁)).comp (Domain.Neighborhood.Exercise326.condSumEmb V₀ V₁ h₀ h₁)
Instances For
Exercise 3.26. condSum(true, x, y) = in₀(x).
Exercise 3.26. condSum(false, x, y) = in₁(y).
Exercise 3.26. condSum(⊥, x, y) = ⊥.
Scott's guard for which: the truth output is true ({0}/Δ) on a left
copy 0X, false
({1}/Δ) on a right copy 1Y, and ⊥ (Δ) on the basepoint master.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exercise 3.26 (Scott 1981, PRG-19). The discriminator which : D₀ + D₁ → T.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Membership facts and the composite identity. #
∅ is never a sum-neighbourhood (every neighbourhood is non-empty).
which(x) selects true ({0} ∈ which x) exactly when x reaches into the
left copy.
which(x) selects false ({1} ∈ which x) exactly when x reaches into the
right copy.
On a "left" element (one reaching into the left copy), the round-trip in₀ ∘ out₀ is the
identity.
On a "right" element, the round-trip in₁ ∘ out₁ is the identity.
Trichotomy for a sum-element: it reaches the left copy, or the right copy, or
is ⊥.
Exercise 3.26 (Scott 1981, PRG-19). Scott's identity for the
discriminator:
cond(which x, in₀(out₀ x), in₁(out₁ x)) = x for every x ∈ |D₀ + D₁|.