Walking through infinite trees with mixed induction and coinduction - - PowerPoint PPT Presentation

walking through infinite trees with mixed induction and
SMART_READER_LITE
LIVE PREVIEW

Walking through infinite trees with mixed induction and coinduction - - PowerPoint PPT Presentation

Walking through infinite trees with mixed induction and coinduction Keiko Nakata and Tarmo Uustalu with Marc Bezem Institute of Cybernetics, Tallinn (many thanks to T. Altenkirch and H. Herbelin ) Theory Days, Nelijrve, 4 February 2011


slide-1
SLIDE 1

Walking through infinite trees with mixed induction and coinduction

Keiko Nakata and Tarmo Uustalu with Marc Bezem Institute of Cybernetics, Tallinn (many thanks to T. Altenkirch and H. Herbelin ) Theory Days, Nelijärve, 4 February 2011

slide-2
SLIDE 2

Constructive reasoning

Sensitive to the use of axioms, in particular to the principle of the Excluded Middle ∀P. P ∨ ¬P giving us a universal method of obtaining, for any P, either a proof of P or a proof of ¬P. E.g., Either my program terminates or diverges. We shall look at the word through refined eyes with the glasses

  • f constructive type theory.
slide-3
SLIDE 3

Modal properties about computations

A program will print “hello” infinitely often. A program will eventually terminate. A server is responsive, ie. any interactive query is eventually replied. A server is almost always busy.

slide-4
SLIDE 4

Infinite binary trees

R : color B : color c : color t0 : tree t1 : tree t0 c t1 : tree Extensional equality, aka bisimilarity, on trees defined by coinduction: t0 ≈ t′ t1 ≈ t′

1

t0 c t1 ≈ t′

0 c t′ 1

≈ is an equivalence. (NB: double horizontal line – coinduction, single – induction)

slide-5
SLIDE 5

Paths and sequences

A path p : path is an infinite sequence of directions, l (for left) and r (for right). l : dir r : dir d : dir p : path d p : path with bisimilarity defined coinductively p ≈ p′ d p ≈ d p′ We define infinite sequences s : seq of colors and bisimilarity

  • n them.

c : color s : seq c s : seq s ≈ s′ c s ≈ c s′

slide-6
SLIDE 6

Walking into a tree along a path

The function [|t|]p walks into the tree t : tree along the path p : path, building a sequence. It is defined by corecursion [|(t0 c t1)|](l p) = c [|t0|]p [|(t0 c t1)|](r p) = c [|t1|]p

slide-7
SLIDE 7

Almost always black tree

B

  • B
  • R
  • B
  • R
  • B
  • B
  • R
  • B
  • R
  • B
  • B
slide-8
SLIDE 8

Properties on trees

  • 1. A tree is always black.

Every path (of a tree) is always black

  • 2. A tree is eventually red.

Every path is eventually red.

  • 3. A tree is infinitely often red.

Every path is infinitely often red.

  • 4. A tree is eventually always black.

Every path is eventually always black.

  • 5. A tree is almost always black.

Every path of a tree is almost always black.

slide-9
SLIDE 9

Every path/tree is always black

A sequence s : seq is always black, Gblack s, where Gblack s Gblack (B s) Every path of a tree t : tree is always black, i.e., ∀p : path. Gblack [|t|]p A tree t : tree is always black, Gblack t Gblack t0 Gblack t1 Gblack (t0 B t1)

slide-10
SLIDE 10

Always black

A tree t : tree is always black, Gblack t, if and only if every path of a tree t : tree is always black, ∀p : path. Gblack [|t|]p.

slide-11
SLIDE 11

Every path/tree is eventually red

A sequence s : seq is eventually red, Fred s, where Fred (R s) Fred s Fred (c s) Every path of a tree t : tree is eventually red, i.e., ∀p : path. Fred [|t|]p A tree t : tree is eventually red, Fred t Fred (t0 R t1) Fred t0 Fred t1 Fred (t0 c t1)

slide-12
SLIDE 12

Eventually red

A tree t : tree is eventually red implies every path of t is eventually red constructively. Every path of t is eventually red implies with FAN t is eventually red. FAN says that a tree with only finite paths is finite.

slide-13
SLIDE 13

Every path/tree is eventually always black

A sequence s : seq is eventually always black, FGblack s, where Gblack s FGblack s FGblack s FGblack (c s) Every path of a tree t : tree is eventually always black, ∀p : path. FGblack [|t|]p A tree t : tree is eventually always black, FGblack t, where Gblack t FGblack t FGblack t0 FGblack t1 FGblack (t0 c t1)

slide-14
SLIDE 14

Eventually always black

A tree t : tree is eventually always black implies every path of t is eventually always black. Every path of t : tree is eventually always black implies with weak continuity and a variation of FAN t is eventually always black. Weak continuity says functions can only depend on finite information.

slide-15
SLIDE 15

Every path/tree is almost always black

A sequence s : seq is almost always black, pre s, where

  • nX s
  • nX (B s)

X s

  • nX (R s)

pre s pre (R s)

  • npre s

pre (B s) Every path of a tree t : tree is almost always black, ∀p : path. pre [|t|]p A tree t : tree is almost always black, FGblack t, where

  • nX t0
  • nX t1
  • nX (t0 B t1)

X t0 X t1

  • nX (t0 R t1)
  • npre t0
  • npre t1

pre (t0 B t1) pre t0 pre t1 pre (t0 R t1)

slide-16
SLIDE 16

Almost always black

A tree t : tree is almost always black implies every path of t is almost always black. Every path of t is almost always black implies with Bar induction t is almost always black.

slide-17
SLIDE 17

Almost always black tree

B

  • B
  • R
  • B
  • R
  • B
  • B
  • R
  • B
  • R
  • B
  • B