···66\p{This lecture is based on material from [[haskellhutt]], [[danascott]], [[jstoy]], [[cgunter]], and [[gwinskel]].}
77\transclude{dt-002K}
88\transclude{dt-002Z}
99-\subtree{
1010-\title{Sums}
1111-}
99+\transclude{dt-0030}
1210\subtree{
1311\title{Strict Constructions}
1412}
···11+\import{dt-macros}
22+\taxon{Construction}
33+\author{liamoc}
44+\title{Sum of [cpos](dt-001D)}
55+\p{
66+The \em{sum} construct on [cpo](dt-001D) #{A + B} denotes a disjoint union of two [cpos](dt-001D) with a new, dedicated [#{\bot} value](dt-000A):
77+##{
88+A + B = \{ (0, a) \mid a \in A \} \cup \{ (1, b) \mid b \in B \} \cup \{ \bot_{A+B} \}
99+}
1010+This construct is a [cpo](dt-001D) under the [ordering](dm-0000):
1111+##{
1212+x \sqsubseteq y\;\;\text{iff}\;\;\begin{cases} \text{true} & \text{if}\ x=\bot_{A+B}\\ a \sqsubseteq a' & \text{if}\ x = (0,a)\ \text{and}\ y = (0, a') \\ b \sqsubseteq b' & \text{if}\ x = (1,b)\ \text{and}\ y = (1, b') \\
1313+\text{false} & \text{otherwise} \end{cases}
1414+}
1515+Intuitively, this says that the [ordering](dm-0000) on #{A + B} is the same as #{A} and #{B} separately, except that #{\bot_{A+B}} is less than anything.}
1616+\p{ The only [directed sets](dt-0010) are those that do \em{not} contain a mixture of elements from both #{A} and from #{B}, so the [least upper bound](dt-0017) operator is essentially the same as the [least upper bounds](dt-0017) for #{A} and for #{B}. Formally:
1717+##{
1818+\bigsqcup X \;\; = \;\; \begin{cases}
1919+(0,\bigsqcup \Set{ a \mid (0,a) \in X }) & \text{if}\ \Set{ a \mid (0,a) \in X } \neq \emptyset \\
2020+(1,\bigsqcup \Set{ b \mid (1,b) \in X }) & \text{if}\ \Set{ b \mid (1,b) \in X } \neq \emptyset\\
2121+\bot_{A+B} & \text{otherwise}\\
2222+\end{cases}
2323+}
2424+2525+}
+13
trees/dt/dt-0032.tree
···11+\import{dt-macros}
22+\taxon{Definition}
33+\author{liamoc}
44+\title{Constructors for sums}
55+\p{For \em{constructing} sums, we use two primitive constructor functions, #{\mathit{inl}} and #{\mathit{inr}}:
66+##{
77+\begin{array}{l}
88+ \mathit{inl} : A \contto (A + B)\\
99+ \mathit{inl}(x) = (0,x)\\[1em]
1010+ \mathit{inr} : B \contto (A + B)\\
1111+ \mathit{inr}(y) = (1,y)
1212+\end{array}
1313+}}