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

coalgebraic bar recursion and bar induction
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 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.

slide-3
SLIDE 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.

slide-4
SLIDE 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.

slide-5
SLIDE 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.)

slide-6
SLIDE 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.

slide-7
SLIDE 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

α

  • f
  • FA

Ff

  • C

FC

γ

slide-8
SLIDE 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 ntα U

α|j

  • ntα j
  • F U

Fj

  • A

α

F 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

  • ntα j
  • U

j

  • A

= ⇒ j is iso.

slide-9
SLIDE 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.

slide-10
SLIDE 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 end e : Pathα a α a = (s, h) p : P s π : Pathα (h p) p ≺ π : Pathα a

We define finiteness of a path inductively by

α a = (s, h) e : ¬P s end e ↓ α a = (s, h) p : P s π : Pathα (h p) π ↓ p ≺ π ↓

slide-11
SLIDE 11

Barred coalgebras (of container functors)

A barred coalgebra is a coalgebra (A, α) such that all its paths are finite: ∀a : A. ∀π : Pathα a. π ↓

slide-12
SLIDE 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.)

slide-13
SLIDE 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.

slide-14
SLIDE 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).

slide-15
SLIDE 15

Trees for tabulations

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

slide-16
SLIDE 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])

  • therwise

This coalgebra is barred! So by bar recursion we can define a function to h : A∗ → SFA,B. The tabulation of f is h [],