coalgebraic bar recursion and bar induction
play

Coalgebraic bar recursion and bar induction Tarmo Uustalu, Inst. of - PowerPoint PPT Presentation

Coalgebraic bar recursion and bar induction Tarmo Uustalu, Inst. of Cybernetics, Tallinn joint work with Venanzio Capretta, Nottingham Theory Days at K ao, 29-31 Jan. 2016 This talk Brouwers bar induction and Spectors bar recursion


  1. Coalgebraic bar recursion and bar induction Tarmo Uustalu, Inst. of Cybernetics, Tallinn joint work with Venanzio Capretta, Nottingham Theory Days at K¨ ao, 29-31 Jan. 2016

  2. This talk Brouwer’s bar induction and Spector’s bar recursion and bar induction are well-known semi-classical principles. We give a “modernized” coalgebraic account that both rationalizes the formulations and avoids unncessary rigidity. We argue that these are useful tools of an (open-minded) applied type theorist.

  3. Bar recursion: traditional formulation Bar recursion: Given a predicate Q on N ∗ that is decidable and suffix-closed. Assume that Q is a bar: every σ : N ω has a prefix ℓ : N ∗ satisfying Q . Suppose we have a set C , an element c : C and a function g : N → C → C . Then there is a unique function f : N ∗ → C such that f ℓ = c , if Q ℓ , and f ℓ = g ( λ n . f ( ℓ + +[ n ])), otherwise.

  4. Bar induction: traditional formulation Bar induction: Given a predicate Q on N ∗ that Q is decidable and suffix-closed. Assume that Q is a bar: every σ : N ω has a prefix ℓ : N ∗ satisfying Q . Given also a predicate R on N ∗ . Suppose that R is inductive: If ℓ satisfies Q , it also satisfies R , else if ℓ + +[ n ] satisfies R for any n : N , then ℓ satisfies R . Then any ℓ : N ∗ satisfies R . N can in principle be replaced with any set A , but one can also argue that only for countable A the principles are acceptable from the constructivist point of view.

  5. Coalgebraic versions: A preview These deal directly with arbitrary (countable) branching. They also remove the need to have the tree continue behind the bar. Coalgebraic bar recursion: If a coalgebra is barred, it is recursive. ( ≈ If all paths in a tree are finite, you can recurse on the tree.) Coalgebraic bar induction: If a coalgebra is barred, it is wellfounded. ( ≈ If all paths in a tree are finite, you can induct on the tree.)

  6. Leading idea We can represent branching types, incl base case detection, as set functors. E.g., F X = 1 + X + X × X . Then we can represent potentially non-wellfounded trees as pointed coalgebras, i.e., as a pair of a coalgebra and an element of the carrier. E.g., ( A , α, a ) = ( N , f : N → 1 + N + N × N , n : N ) where f 0 = inl ∗ f 1 = inr (inl 0)) f ( i + 2) = inr (inr ( i , i + 1)) and n is some fixed number.

  7. � � � � Recursive coalgebras A coalgebra ( A , α ) of an endofunctor F on a category C is said to be recursive , if, for every algebra ( C , γ ), there exists a unique map f : A → C (a coalgebra-to-algebra morphism) satisfying α A FA f Ff C FC γ

  8. � � � � � Wellfounded coalgebras Given a coalgebra ( A , α ) of a pullbacks along monos preserving endofunctor F on a category C with a pullbacks along monos. For any mono j : U ֒ → A , another mono nt α j : nt α U ֒ → A is defined by the pullback α | j nt α U F U nt α j Fj � F A α A The coalgebra ( A , α ) is called wellfounded if, for any mono j : U ֒ → A , if nt α U factors through U , then j is an isomorphism. I.e., nt α U = ⇒ j is iso. U � ��������� � � � � � � nt α j j � � A

  9. Containers, container functors A container is given by a set S of shapes and an S -indexed family of positions for every shape. It defines a set functor � S , P � by � S , P � X = Σ s : S . P s → X .

  10. Finite paths of a coalgebra For any a : A we define a set Path α a of (maximal) paths starting from it coinductively by α a = ( s , h ) e : ¬ P s α a = ( s , h ) p : P s π : Path α ( h p ) end e : Path α a p ≺ π : Path α a We define finiteness of a path inductively by α a = ( s , h ) e : ¬ P s α a = ( s , h ) p : P s π : Path α ( h p ) π ↓ end e ↓ p ≺ π ↓

  11. Barred coalgebras (of container functors) A barred coalgebra is a coalgebra ( A , α ) such that all its paths are finite: ∀ a : A . ∀ π : Path α a . π ↓

  12. Coalgebraic bar recursion and bar induction Coalgebraic bar recursion: If a coalgebra is barred, it is recursive. ( ≈ If all paths in a tree are finite, you can recurse on the tree.) Coalgebraic bar induction: If a coalgebra is barred, it is wellfounded. ( ≈ If all paths in a tree are finite, you can induct on the tree.)

  13. Example: Tabulating stably continuous stream functions Functions f : A ∞ → B can sometimes be tabulated in a tree. What is required is often formulated as stable continuity. But you need bar recursion to actually exploit it.

  14. Stably continuous stream functions A modulus of continuity for a function f : A ∞ → B is a function m : A ∞ → N such that ∀ σ, σ ′ : A ∞ . σ ′ = m σ σ → f σ ′ = f σ The modulus is stable if ∀ σ, σ ′ : A ∞ . σ ′ = m σ σ → m σ ′ = m σ (i.e., it is its own modulus of continuity).

  15. Trees for tabulations We want to represent stream functions f : A ∞ → B as some form of trees. The suitable tree type SF A , B is defined inductively by g : A → SF A , B b : B tell b : SF A , B ask g : SF A , B

  16. A recursive coalgebra from a stably continuous stream function Given a stream function f : A ∞ → B with a stable modulus m : A ∞ → N . We construct a coalgebra on the functor F X = B + ( A → X ) with A ∗ as the carrier: α : A ∗ → B + ( A → A ∗ ) � inl ( f ( ℓ + + σ 0 )) if m ( ℓ + + σ 0 ) ≤ len ℓ α ℓ = inr ( λ a . ℓ + +[ a ]) otherwise This coalgebra is barred! So by bar recursion we can define a function to h : A ∗ → SF A , B . The tabulation of f is h [],

Recommend


More recommend