Brendan Hart 2019-2020 \begin{code} {-# OPTIONS --safe --without-K #-} open import MLTT.Spartan open import UF.FunExt open import UF.PropTrunc module DomainTheory.Basics.FunctionComposition (pt : propositional-truncations-exist) (fe : β {π€ π₯} β funext π€ π₯) (π₯ : Universe) where open import DomainTheory.Basics.Dcpo pt fe π₯ open import DomainTheory.Basics.Miscelanea pt fe π₯ open import DomainTheory.Basics.Pointed pt fe π₯ open import OrderedTypes.Poset fe open PosetAxioms [_,_,_]_βα΅αΆα΅α΅_ : (π : DCPO {π€} {π€'}) (π : DCPO {π£} {π£'}) (π : DCPO {π¦} {π¦'}) β DCPO[ π , π ] β DCPO[ π , π ] β DCPO[ π , π ] [ π , π , π ] g βα΅αΆα΅α΅ f = h , c where h : β¨ π β© β β¨ π β© h = prβ g β prβ f h-is-monotone : is-monotone π π h h-is-monotone x y p = Ξ³ where Ξ΄ : prβ f x ββ¨ π β© prβ f y Ξ΄ = monotone-if-continuous π π f x y p Ξ³ : h x ββ¨ π β© h y Ξ³ = monotone-if-continuous π π g (prβ f x) (prβ f y) Ξ΄ c : is-continuous π π h c I Ξ± Ξ΄ = u , v where u : is-upperbound (underlying-order π) (h (β π Ξ΄)) (Ξ» i β h (Ξ± i)) u i = h-is-monotone (Ξ± i) (β π Ξ΄) (β-is-upperbound π Ξ΄ i) v : (z : β¨ π β©) β ((i : I) β h (Ξ± i) ββ¨ π β© z) β h (β π Ξ΄) ββ¨ π β© z v z p = transport (Ξ» - β - ββ¨ π β© z) (e β»ΒΉ) q where isdirβ : is-Directed π (Ξ» i β prβ f (Ξ± i)) isdirβ = image-is-directed π π (monotone-if-continuous π π f) Ξ΄ isdirβ : is-Directed π (Ξ» i β (prβ g β prβ f) (Ξ± i)) isdirβ = image-is-directed π π (monotone-if-continuous π π g) isdirβ e : h (β π Ξ΄) οΌ β π isdirβ e = h (β π Ξ΄) οΌβ¨ ap (Ξ» - β prβ g -) (continuous-β-οΌ π π f Ξ΄) β© prβ g (β π isdirβ) οΌβ¨ continuous-β-οΌ π π g isdirβ β© β π isdirβ β q : β π isdirβ ββ¨ π β© z q = β-is-lowerbound-of-upperbounds π isdirβ z p [_,_,_]_βα΅αΆα΅α΅β₯_ : (π : DCPOβ₯ {π€} {π€'}) (π : DCPOβ₯ {π£} {π£'}) (π : DCPOβ₯ {π¦} {π¦'}) β DCPOβ₯[ π , π ] β DCPOβ₯[ π , π ] β DCPOβ₯[ π , π ] [ π , π , π ] g βα΅αΆα΅α΅β₯ f = [ (π β») , (π β») , (π β») ] g βα΅αΆα΅α΅ f \end{code}