Guarded Traced Categories for Recursion and Iteration Sergey Goncharov a oder a and Paul Blain Levy b ) (joint ongoing work with Lutz Schr¨ April 2, 2019, Reykjavik TCS Seminar a Friedrich-Alexander-Universit¨ at Erlangen-N¨ urnberg b University of Birmingham
Context • Recursion / iteration • order-theoretic / unguarded • process-theoretic / guarded • Generic categorical models: • Total: • Axiomatic/synthetic domain theory (Hyland, Fiore, Taylor et al.) • let-ccc’s with fixpoint objects (Crole/Pitts, Simpson) • Traced monoidal categories (Joyal/Street/Verity, Hasegawa) • Elgot monads/theories (Bloom/Esik, Ad´ amek, Milius et al.) • Partial: • Completely iterative monads/theories (Bloom/Esik, Ad´ amek, Milius et al.) • later-modality (Nakano, Appel, Melli` es, Benton, Birkedal et al.) • Partial traced categories (Heghverdi, Scott, Malherbe, Selinger) • Functorial dagger (Milius, Litak)
Context
Guarded Fixpoints: Overview guarded traced categories guarded iteration guarded 8 -dimensional recursion Hilbert spaces guarded topos of trees, Elgot monads total Conway recursion, complete metric spaces completely (complete) iterative monads Elgot monads process algebra domain-enriched examples examples
Guarded Fixpoints: Overview FoSSaCS17: G., Schr¨ oder, Rauch, Pir´ og, Unifying Guarded guarded traced and Unguarded Iteration categories guarded iteration guarded 8 -dimensional recursion Hilbert spaces guarded topos of trees, Elgot monads total Conway recursion, complete metric spaces : -congruent completely (complete) iterative monads Elgot monads retraction process algebra domain-enriched examples examples
Guarded Fixpoints: Overview FoSSaCS17: G., Schr¨ oder, Rauch, Pir´ og, Unifying Guarded guarded traced and Unguarded Iteration categories guarded iteration guarded 8 -dimensional recursion Hilbert spaces guarded topos of trees, Elgot monads total Conway recursion, complete metric spaces : -congruent completely (complete) iterative monads Elgot monads retraction FoSSaCS18: G., Schr¨ oder, Guarded process algebra domain-enriched Traced Categories examples examples
Unguarded Iteration on Monads
One Typical Scenario fac n “ if n ą 0 then n ˚ fac p n ´ 1 q else 1
One Typical Scenario fac n “ if n ą 0 then n ˚ fac p n ´ 1 q else 1 Factorial (Recursively) ´ ¯ fac : N á N “ p r , g q ÞÑ λ n . if n ą 0 then n ˚ g p n ´ 1 q else r : p 1 q where p - - q : is the least fixpoint of g ÞÑ f ˝ x id , g y . Alternatively, Factorial (Iteratively) ¯ : ´ fac n “ p k , i q ÞÑ if k ą 0 then inr p k ´ 1 , k ˚ i q else p inl i q p n , 1 q - q : is the least fixpoint of g ÞÑ r id , g s ˝ f where p -
Iteration v.s. Recursion Iteration is dual to (call by name) recursion: f : Y ˆ X á X f : X á Y ` X (rec) (iter) f : : X á Y f : : Y á X E.g. X á Y is the space of partial functions X Ñ Y K on Set More generally, X á Y is X Ñ TY where T is a monad
Another Typical Scenario Given an alphabet of actions A “ t a , b u , equations x 1 “ a . p x 2 ` x 3 q x 2 “ a . x 1 ` b . x 3 x 3 “ a . x 1 ` � specify processes x 1 , x 2 , x 3 of basic process algebra (BPA) We can think of them as a map X Ñ P ω pt � u ` Σ X q where X “ t x 1 , x 2 , x 3 u , Σ “ A ˆ p - - q , and solve them by finding the unique X Ñ T Σ t � u in the domain of possibly non-wellfounded trees T Σ t � u “ νγ. P ω pt � u ` A ˆ γ q (final coalgebra). The original system must be guarded. An unguarded specification, e.g. x “ x may have arbitrary solutions : Rutten and Turi 1994, Initial algebra and final coalgebra semantics for concurrency
Unguarded Iteration In order to solve an unguarded system like x 1 “ x 2 ` a . p x 2 ` x 1 q x 2 “ x 1 ` a . x 1 ` b . x 2 we first need to guard it to obtain x 1 “ a . p x 2 ` x 1 q x 2 “ a . x 1 ` b . x 2 and solve the result. Equations like x “ x must be replaced by x “ ∅ where ∅ is unproductive divergence This induces a notion of iteration which is neither least nor unique
Why Trees Can Not Be (Obviously) Ordered Convexity Issue: a partial order would identify processes a . a . ∅ ` ∅ and a . a . ∅ ` a . ∅ ` ∅ . For ⊑ : a . a . ∅ ` ∅ “ a . a . ∅ ` ∅ ` ∅ ⊑ a . a . ∅ ` a . ∅ ` ∅ (monotonicity of ` and idempotence of ` ) For ⊒ : ∅ ⊑ a . ∅ a . ∅ ⊑ a . a . ∅ p monot . a . ´q a . a . ∅ ⊑ a . a . ∅ ∅ ⊑ ∅ p monot . `q a . a . ∅ ` a . ∅ ` ∅ ⊑ a . a . ∅ ` a . a . ∅ ` ∅ p idemp . `q a . a . ∅ ` a . ∅ ` ∅ ⊑ a . a . ∅ ` ∅
Monads Definition (Monad) - ‹ q A monad over a category C is given by a Kleisli triple T “ p T , η, - where • T is an endomap on | C | • η is a family of morphisms η X : X Ñ TX , called monad unit - q ‹ assigns to each f : X Ñ TY a morphism f ‹ : TX Ñ TY • p - and the following laws hold: η ‹ “ id f ‹ ˝ η “ f p f ‹ ˝ g q ‹ “ f ‹ ˝ g ‹ This means that the hom-sets Hom p X , TY q form a category (Kleisli category) under Kleisli composition f ˛ g “ f ‹ ˝ g and η X P Hom p X , TX q
ω -Continuous Monads Definition ( ω -Continuous Monad) A monad T is ω -continuous if its Kleisli category is enriched over ω -complete partial orders with bottom K and (nonstrict) continuous maps, and f ˛ K “ K K ˝ h “ K For ω -continuous monads we can define iteration f : X Ñ T p Y ` X q f : : X Ñ TY and the lfp of g ÞÑ r η, g s ˛ f Examples TX “ X ` 1 (partiality), TX “ P X (nondeterminism), ξ : X Ñ r 0 , 1 s | ř ξ ď 1 � ( TX “ (sub-probability), etc.
Axioms for Iteration: Conway Operators - : satisfying fixpoint identity Let T be a monad with an iteration operator - f : “ r η, f : s ˛ f . It is called a Conway operator if it additionally satisfies Dinaturality: Y Y X Y X Y = g Y g h h g Z Z X X Z Codiagonal: Y Y X X g = g X X X X
Axioms for Iteration: Naturality and Uniformty Naturality is a form of coherence: Y Z Y Z g X g X = f f X X Uniformity is the only non-equation axiom: Y Y Z Z X “ g X h f h Z X ó Y Y Z X Z “ h f g X Z
Axioms for Iteration: Elgot Monads Definition A monad T is a Elgot monad if it is equipped with a Conway iteration operator, which is natural and uniform Theorem (´ Esik and Goncharov 2016) Dinaturality is derivable Theorem (Goncharov, Rauch, and Schr¨ oder 2015) ω -continuous monads are Elgot monads Theorem (Goncharov, Rauch, and Schr¨ oder 2015 ) Let T be a Elgot monad and Σ and endofunctor. Then final coalgebras T Σ X “ νγ. T p X ` Σ γ q defines a Elgot monad T Σ uniquely coherently extending T
Guared Iteration on Monads
Guarded v.s. Unguarded Using the fact that T is Elgot we can solve both guarded and unguarded definitions over T Σ . Generally, we have: Canonical fixpoints Unique fixpoints Partial fixpoint operators � � Total fixpoint operators — � If T is not Elgot (e.g. nonempty powerset) we can no longer compute solutions of unguarded definitions (think of x “ x ), but we still can compute solutions of guarded ones More generally, guardedness does not guarantee uniqueness, e.g. under infinite trace semantics x “ a . x ` 1 has both a ‹ and a ‹ ` a ω as solutions
Abstract Guardedness So, what means “guardedness” anyhow? f : X Ñ Y ` X f : X ˆ Y Ñ X f : : X Ñ Y f : : Y Ñ X Z Can we make sense of this intuition? : a X Y
Abstract Guardedness So, what means “guardedness” anyhow? f : X Ñ Y ` X f : X ˆ Y Ñ X f : : X Ñ Y f : : Y Ñ X Z Can we make sense of this intuition? : a X Pivotal Idea: Keep the notion Y of guardedness independent of fixpoint calculations
Abstract Guardedness for Monads Abstract guardedness is a relation connecting f : X Ñ TY with coproduct summands σ : Y 1 Y in judgements f : X Ñ σ TY , satisfying f : X Ñ Z (par ` ) f : X Ñ σ Z f : Y Ñ σ Z (vac ` ) inl f : X Ñ inr Z ` Y r f , g s : X ` Y Ñ σ Z (cmp ` ) f : X Ñ inr Y ` Z g : Y Ñ σ V h : Z Ñ V r g , h s ˝ f : X Ñ σ V For example, X Ñ 2 T Σ p Y ` Z q “ νγ. T pp Y ` Z q ` Σ γ q iff out f “ T p inl ` id q g : X Ñ T pp Y ` Z q ` Σ T Σ p Y ` Z qq for suitable g : X Ñ T p Y ` Σ T Σ p Y ` Z qq
Guarded Iteration Laws Iteration: Y Y Y “ X X f f f X X X Naturality: Y Z Y Z “ g X X g f f X X
Guarded Iteration Laws (Continued) Codiagonal: Y Y X “ X g g X X X X Uniformity: “ Y Y Z Z X g h f X h Z X
Some Results • Guarded and unguarded iteration are instances of abstract guardedness • Every monad is “vacuously guarded” • (Unique) guarded iteration propagates along T ÞÑ νγ. T p - - ` Σ γ q • Dinaturality and other laws are derivable • Guarded iteration is the exact dual of guarded recursion
Example: Guarded Recursion Consider the category CMS of inhabited complete metric spaces and non-expansive maps Let f : X ˆ Y Ñ Z be guarded in Y if for all x P X , f p x , - - q is contractive This makes CMS into a guarded traced monoidal category (fixpoints calculated via Banach’s fixpoint theorem)
Going Monoidal
Going Monoidal (We only consider symmetric monoidal categories, think of b “ ` , ˆ ) Identity id: Composition g ˝ f : Tensor g b f : Symmetry:
Trace Trace p f : U b A Ñ B b U q ÞÑ p tr U A , B f : A Ñ B q is the “generalized fixpoint operator”
Recommend
More recommend