···11+\title{Bifunctor}
22+\author{liamoc}
33+\taxon{Definition}
44+\p{
55+A binary [functor](dm-000J), or \em{bifunctor} from two [categories](dm-000G) #{\mathbf{A}} and #{\mathbf{B}} to a [category](dm-000G) #{\mathbf{C}} is a [functor](dm-000J) from the [product category](dm-000N) #{\mathbf{A} \times \mathbf{B}} to #{\mathbf{C}}. That is, a bifunctor #{F} consists of an \em{object mapping} #{F(a,b)} that maps an object #{a} of #{\mathbf{A}} and an object #{b} of #{\mathbf{B}} to an object of #{\mathbf{C}}, and a \em{morphism mapping} #{F(f,g)} that maps a morphism #{X_\textbf{A} \xrightarrow{f} Y_\textbf{A}} and a morphism #{X_\textbf{B} \xrightarrow{g} Y_\textbf{B}} to a morphism #{F(X_\textbf{A},X_\textbf{B}) \xrightarrow{F(f,g)} F(Y_\textbf{A},Y_\textbf{B}) } in #{\textbf{C}}, such that:
66+\ul{
77+\li{ For each object #{X} in #{\mathbf{A}} and #{Y} in #{\mathbf{B}}, the equation #{F(\mathsf{id}_X, \mathsf{id}_Y) = \mathsf{id}_{F(X,Y)}} holds in #{\mathbf{C}}. }
88+\li{ For a pair of morphisms #{X_\textbf{A} \xrightarrow{f_1} Y_\textbf{A} \xrightarrow{f_2} Z_\textbf{A}} in #{\mathbf{A}} and another pair #{X_\textbf{B} \xrightarrow{g_1} Y_\textbf{B} \xrightarrow{g_2} Z_\textbf{B}} in #{\mathbf{B}}, the equation #{F (f_2 \circ f_1, g_2 \circ g_1) = F(f_2,g_2) \circ F(f_1,g_1)} holds in #{\mathbf{C}}. }
99+}
1010+}
+6
trees/dm-000N.tree
···11+\title{Product category}
22+\author{liamoc}
33+\taxon{Definition}
44+\p{
55+ For two [categories](dt-002A) #{\textbf{A}} and #{\textbf{B}}, the \em{product category} #{\textbf{A} \times \textbf{B}} is the category whose objects are pairs consisting of an object of #{\textbf{A}} and an object of #{\textbf{B}}, and whose morphisms are similarly pairs of morphisms from #{\textbf{A}} and #{\textbf{B}}. Composition of morphisms is defined componentwise on the pairs using the composition from #{\textbf{A}} and #{\textbf{B}}.
66+}
+10
trees/dm-000O.tree
···11+\taxon{Definition}
22+\author{liamoc}
33+\title{Monoid}
44+\p{A \em{monoid} #{(S, \iota, \bullet)} consists of a set #{S}, an \em{identity} element #{\iota \in S}, and a binary operator #{(\bullet) : S \times S \rightarrow S} which satisfies, for all #{x,y,z \in S}:
55+\ul{
66+\li{ [associativity](dm-000F): #{x \bullet (y \bullet z) = (x \bullet y) \bullet z} }
77+\li{ left identity: #{\iota \bullet x = x}}
88+\li{ right identity: #{x \bullet \iota = x}}
99+}
1010+}
+5
trees/dm-000P.tree
···11+\taxon{Definition}
22+\author{liamoc}
33+\title{Commutative monoid}
44+\p{A \em{commutative monoid}is a [monoid](dm-000O) #{(S, \iota, \bullet)} where the binary operator #{(\bullet) : S \times S \rightarrow S} additionally satisfie [commutativity](dm-000E).
55+}
+4-4
trees/dt-001W.tree
···44\p{Show that if a function #{f : A \rightarrow B} on [cpos](dt-001D) #{A} and #{B} is [monotonic](dt-000J) and #{A} is finite, then #{f} is [continuous](dt-001J). }
55\p{\em{Hint}: Finite [directed](dt-0010) sets contain their [lub](dt-0017)}
66\scope{
77- \put\transclude/toc{false}
88- \put\transclude/numbered{false}
99- \put\transclude/expanded{false}
1010-\subtree{\taxon{Solution}
77+ \put\transclude/toc{false}
88+ \put\transclude/numbered{false}
99+ \put\transclude/expanded{false}
1010+ \subtree{\taxon{Solution}
1111\p{Because of \ref{dt-001O}, it suffices to show the second condition of [continuity](dt-001J), as #{f} is [monotonic](dt-000J). }
1212\p{Because #{A} is finite, any directed subset #{X \subseteq A} is also finite, and therefore #{\bigsqcup X \in X}. Because #{f} is [monotone](dt-000J), #{f(x) \sqsubseteq f (\bigsqcup X)} for all #{x \in X}. }
1313\p{The solution to \ref{dt-001N} shows that #{\Set{f(x) \mid x \in X}} is [directed](dt-0010) and therefore contains its upper bound #{c}. Because #{f} is monotone, #{f(\bigsqcup X)} must be #{c} (else it would contradict the above).}
+8-23
trees/dt-001Z.tree
···44\title{Constructions on [cpos](dt-001D) and PCF}
55\author{liamoc}
66\p{This lecture is based on material from [[haskellhutt]], [[danascott]], [[jstoy]], [[cgunter]], and [[gwinskel]].}
77+\transclude{dt-002K}
78\subtree{
88-\title{Products}
99-\p{Recall \ref{dt-000E}, which showed that the [product](dm-0005) of two [pointed posets](dt-000G) is itself a [pointed poset](dt-000G).
1010-1111-In \ref{dt-001X} you may also have shown that #{A \times B} is also a [cpo](dt-001D) if #{A} and #{B} are [cpos](dt-001D), with this definition for [lubs](dt-0017):
1212-##{
1313-\bigsqcup X \; = \; \left(\bigsqcup \{ x \mid \exists y.\ (x,y) \in X \}, \bigsqcup \{ y \mid \exists x.\ (x,y) \in X \}\right)
99+\title{Functions}
1410}
1515-This definition can be made a little more comprehensible by defining it in terms of the two projection operators for pairs:
1111+\subtree{
1212+\title{Sums}
1613}
1717-\transclude{dt-0020}
1818-\transclude{dt-0021}
1919-\transclude{dt-0022}
2020-\transclude{dt-0023}
2121-\transclude{dt-0024}
2222-\p{These building blocks can be used to make many functions on [products](dt-0021) (thereby ensuring [continuity](dt-001J)):
1414+\subtree{
1515+\title{Strict Constructions}
2316}
2424-\transclude{dt-0025}
2525-\transclude{dt-0026}
2626-\transclude{dt-0027}
2727-\transclude{dt-0028}
2828-\transclude{dt-0029}
2929-\transclude{dt-002A}
3030-\transclude{dt-002C}
1717+\subtree{
1818+\title{PCF}
3119}
3232-3333-3434-
+1
trees/dt-0022.tree
···11\taxon{Theorem}
22\author{liamoc}
33+\title{Continuity of projection operations}
34\p{The [projection functions](dt-0020) #{\pi_0} and #{\pi_1} are [continuous](dt-001J).}
+3-5
trees/dt-0024.tree
···11\import{dt-macros}
22\import{table-macros}
33\taxon{Theorem}
44+\title{Continuity of split}
45\author{liamoc}
56 \p{For [continuous functions](dt-001J) #{f} and #{g}, the [split function](dt-0023) #{\langle f, g \rangle} is [continuous](dt-001J).}
66- \scope{
77- \put\transclude/toc{false}
88- \put\transclude/numbered{false}
99- \subtree{\taxon{Proof}
77+ \proofblock{
108 \ul{
119 \li{ \em{#{\langle f, g \rangle} is [monotonic](dt-000J)}. Let #{x \sqsubseteq y \in A}. Then: ##{\begin{array}{lclr}
1210 \langle f , g \rangle\ x & = & (f(x), g(x)) & \text{(def)}\\
···2018 & = & \bigsqcup \{ \langle f , g \rangle\ x \mid x \in X \} & \text{(def)}
2119 \end{array}}
2220 }
2323-}}
2121+}
+2-2
trees/dt-0025.tree
···1414 \node[dot] at (ZZ.west.1) {};
1515 \node[dot] at (ZZ.west.2) {};
1616 \node at (-6.3cm,0) {\Large $=$};
1717- \end{tikzpicture} }
1717+ \end{tikzpicture} }}
1818 \td{
1919 \tex{\usepackage{string-diagrams}}{
2020 \begin{tikzpicture}
···3737 \draw[thick,-|] (f.west.1) -- ([xshift=0.4cm]f.west.1);
3838 \draw[thick] (g.west.1) -- (g.east.1);
3939 \draw[thick,-|] (g.west.2) -- ([xshift=0.4cm]g.west.2);
4040- \end{tikzpicture}}}
4040+ \end{tikzpicture}}
4141}\td{#{\begin{array}{l}\mathit{swap} : A \times B \rightarrow B \times A \\ \mathit{swap} = \langle \pi_1 , \pi_0 \rangle \end{array}}}
4242}}
+2-1
trees/dt-002C.tree
···11\title{Derived properties of [cpo products](dt-0021)}
22+\taxon{Corollary}
23\author{liamoc}
34\p{
45 The [universal property](dt-0029) is called such because \em{all} the familiar properties of [products](dt-0021) follow from it – thinking in pictures helps to see how (Indeed, the [universal property](dt-0029) \em{characterises} products up to isomorphism):}
···1112\li{ #{(f \circ g) \times (h \circ i) = (f \circ h) \times (g \circ i) \quad (**)}}
1213}
1314\p{
1414-These last two statements #{(*)} and #{(**)} show that #{\times} is a \em{bifunctor} on the [category #{\textbf{Cpo}}](dt-002B), i.e., a [functor](dm-000J) #{\textbf{Cpo} \times \textbf{Cpo} \rightarrow \textbf{Cpo}}.
1515+These last two statements #{(*)} and #{(**)} show that #{\times} is a [bifunctor](dm-000M) on the [category #{\textbf{Cpo}}](dt-002B), i.e., a [functor](dm-000J) #{\textbf{Cpo} \times \textbf{Cpo} \rightarrow \textbf{Cpo}}.
1516}
···11+\import{dt-macros}
22+\taxon{Definition}
33+\author{liamoc}
44+\title{[Cpo](dt-001D) isomorphism}
55+\p{An \em{isomorphism} between two [cpos](dt-001D) #{A} and #{B} is a [bijection](dm-000A) #{f} between #{A} and #{B} such that #{f} preserves the [cpo](dt-001D) structure, i.e., that #{f} and #{f^{-1}} are [continuous](dt-001J).
66+}
77+\p{We say two [cpos](dt-001D) #{A} and #{B} are \em{isomorphic}, written #{A \simeq B}, iff an \em{isomorphism} exists between them.}
+8
trees/dt-002F.tree
···11+\import{dt-macros}
22+\taxon{Definition}
33+\author{liamoc}
44+\title{The set of continuous functions}
55+\p{
66+Let #{A \contto B} denote just the [continuous functions](dt-001J) from [cpo](dt-001D) #{A} to [cpo](dt-001D) #{B}:
77+##{A \contto B\; \triangleq\; \Set{ f : A \rightarrow B \mid f\ \text{is continuous} }}
88+}
+11
trees/dt-002G.tree
···11+\taxon{Exercise}
22+\author{liamoc}
33+\p{Express the function #{\mathit{juggle} (a, (b,c)) = ((a,b),c)} using just our primitive combinators for [projection](dt-0020) and [split](dt-0023).}
44+\scope{
55+\put\transclude/toc{false}
66+\put\transclude/numbered{false}
77+\put\transclude/expanded{false}
88+\subtree{\taxon{Solution}
99+\p{##{\mathit{juggle} \triangleq \langle \langle \pi_0 , \pi_0 \circ \pi_1 \rangle , \pi_1 \circ \pi_1 \rangle}}
1010+}
1111+}
+13
trees/dt-002H.tree
···11+\import{dt-macros}
22+\taxon{Theorem}
33+\author{liamoc}
44+\title{Commutative monoid structure for [cpos](dt-001D)}
55+\p{[Cpos](dt-001D) form a [commutative monoid](dm-000P) "up to [isomorphism](dt-002E)" under #{\times} and #{\mathbf{1}} (the [cpo](dt-001D) consisting of only one element #{\bot}). That is, for all [cpos](dt-001D) #{A, B} and #{C}:
66+\ol{
77+\li{#{A \times \mathbf{1} \simeq A}}
88+\li{#{A \times (B \times C) \simeq (A \times B) \times C}}
99+\li{#{A \times B \simeq B \times A}}
1010+}
1111+\proofblock{
1212+\p{The [isomorphisms](dt-002E) required are the [projection](dt-0020) #{\pi_0}, the #{\mathit{juggle}} function from \ref{dt-002G}, and [the swap function](dt-0025).}
1313+}}
+15
trees/dt-002I.tree
···11+\import{dt-macros}
22+\taxon{Exercise}
33+\author{liamoc}
44+\p{Show using the [universal property](dt-0029) that #{\langle f, g \rangle \circ h = \langle f \circ h , g \circ h \rangle}}
55+\solnblock{
66+ Instantiating the [universal property](dt-0029) where #{h := \langle f, g \rangle \circ h}, #{f := f \circ h}, and #{g := g \circ h}:
77+ ##{\pi_0 \circ \langle f, g \rangle \circ h = f \circ h \land
88+ \pi_1 \circ \langle f, g \rangle \circ h = g \circ h\ \text{iff}\ \langle f, g \rangle \circ h = \langle f \circ h , g \circ h \rangle}
99+ Simplifying using the pictorial properties in \ref{dt-0027} (shown equivalent to the [universal property](dt-0029) in \ref{dt-0028}):
1010+ ##{f \circ h = f \circ h \land
1111+ g \circ h = g \circ h\ \text{iff}\ \langle f, g \rangle \circ h = \langle f \circ h , g \circ h \rangle}
1212+ By logical simplifications, we arrive at
1313+ ##{\langle f, g \rangle \circ h = \langle f \circ h , g \circ h \rangle}
1414+ as required.
1515+}
+8
trees/dt-002J.tree
···11+\import{dt-macros}
22+\taxon{Theorem}
33+\author{liamoc}
44+\p{There is an [isomorphism](dt-002E) between [pairs](dt-0021) of [continuous functions](dt-002F) and continuous functions that output pairs: ##{(A \contto B) \times (A \contto C)\; \simeq\; (A \contto (B \times C))}
55+\proofblock{
66+Proof follows from the [universal property](dt-0029) after setting up the [isomorphism](dt-002E) with functions #{f(g_0,g_1) = \langle g_0 , g_1 \rangle} and #{f^{-1}(h) = (\pi_0 \circ h, \pi_1 \circ h)}.}
77+}
88+%Because we have the \gls{functor} $\times$ on cpos that satisfies the properties of products described above, the \gls{category} \textbf{Cpo} therefore has binary products.
+38
trees/dt-002K.tree
···11+\import{dt-macros}
22+\author{liamoc}
33+\title{Products}
44+\p{Recall \ref{dt-000E}, which showed that the [product](dm-0005) of two [pointed posets](dt-000G) is itself a [pointed poset](dt-000G).
55+66+In \ref{dt-001X} you may also have shown that #{A \times B} is also a [cpo](dt-001D) if #{A} and #{B} are [cpos](dt-001D), with this definition for [lubs](dt-0017):
77+##{
88+\bigsqcup X \; = \; \left(\bigsqcup \{ x \mid \exists y.\ (x,y) \in X \}, \bigsqcup \{ y \mid \exists x.\ (x,y) \in X \}\right)
99+}
1010+This definition can be made a little more comprehensible by defining it in terms of the two projection operators for pairs:
1111+}
1212+\transclude{dt-0020}
1313+\transclude{dt-0021}
1414+\transclude{dt-0022}
1515+\transclude{dt-0023}
1616+\transclude{dt-0024}
1717+\p{These building blocks can be used to make many functions on [products](dt-0021) (thereby ensuring [continuity](dt-001J)):
1818+}
1919+\transclude{dt-0025}
2020+\transclude{dt-0026}
2121+\transclude{dt-002G}
2222+\transclude{dt-0027}
2323+\transclude{dt-0028}
2424+\transclude{dt-0029}
2525+\transclude{dt-002A}
2626+\transclude{dt-002C}
2727+\transclude{dt-002I}
2828+\transclude{dt-002D}
2929+\scope{
3030+\put\transclude/toc{false}
3131+\put\transclude/numbered{false}
3232+\subtree{
3333+\taxon{Upshot}
3434+\p{
3535+ Because we have the [functor](dm-000J) #{\times} on #{\textbf{Cpo}} that satisfies the properties of products described above, the [category #{\textbf{Cpo}}](dt-002B) therefore has \em{binary products}.}
3636+3737+}
3838+}