61
Ong & Tzevelekos Functional Reachability – 1 Functional Reachability Luke Ong Nikos Tzevelekos Oxford University Computing Laboratory 24th Symposium on Logic in Computer Science Los Angeles, August 2009.

Luke Ong Nikos Tzevelekos Oxford University Computing

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Luke Ong Nikos Tzevelekos Oxford University Computing

Ong & Tzevelekos Functional Reachability – 1

Functional Reachability

Luke Ong Nikos Tzevelekos

Oxford University Computing Laboratory

24th Symposium on Logic in Computer Science

Los Angeles, August 2009.

Page 2: Luke Ong Nikos Tzevelekos Oxford University Computing

The Problem

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 2

Reachability in functional computation.

■ Consider a term M of a higher-order functionalprogramming language.

■ Now consider a point p inside M .

� Is there a program context C such that thecomputation of C[M ] reaches p?

Page 3: Luke Ong Nikos Tzevelekos Oxford University Computing

The Problem

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 2

Reachability in functional computation.

■ Consider a term M of a higher-order functionalprogramming language.

■ Now consider a point p inside M .

� Is there a program context C such that thecomputation of C[M ] reaches p?

Page 4: Luke Ong Nikos Tzevelekos Oxford University Computing

The Problem

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 2

Reachability in functional computation.

■ Consider a term M of a higher-order functionalprogramming language.

■ Now consider a point p inside M .

� Is there a program context C such that thecomputation of C[M ] reaches p?

Surprisingly, (Contextual) Reachability per se hadnot been studied in HO functional languages.

Page 5: Luke Ong Nikos Tzevelekos Oxford University Computing

Relevant work

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 3

■ Control Flow Analysis: Approximate at compiletime the flow of control to happen at run time.

◆ In a HO-setting, the crucial element is that ofclosures.

◆ Reynolds (’70), Jones (’80), Shivers (’90), . . .Malacaria & Hankin (late 90’s).

◆ CFA > Reach: more general.Reach > CFA: open vs closed world approach.

■ Useless code detection, etc.

Page 6: Luke Ong Nikos Tzevelekos Oxford University Computing

The examined language: PCF

Ong & Tzevelekos Functional Reachability – 4

Types: A,B ::= o | A → B

Terms: M,N ::= x | λx.M | MN | t | f | if M N1 N2 | YA

Contexts: C ::= . . .

Page 7: Luke Ong Nikos Tzevelekos Oxford University Computing

The examined language: PCF

Ong & Tzevelekos Functional Reachability – 4

Types: A,B ::= o | A → B

Terms: M,N ::= x | λx.M | MN | t | f | if M N1 N2 | YA

Contexts: C ::= . . .

Reductions: (λx.M)N → M{N/x} if t → λxy.x

YM → M(YM) if f → λxy.y

M → N =⇒ E[M ] → E[N ]

Ev. Contexts: E ::= [−] | E M | if E

Page 8: Luke Ong Nikos Tzevelekos Oxford University Computing

The examined language: PCF

Ong & Tzevelekos Functional Reachability – 4

Types: A,B ::= o | A → B

Terms: M,N ::= x | λx.M | MN | t | f | if M N1 N2 | YA

Contexts: C ::= . . .

Reductions: Call-by-name λ-calculus + if + Y

■ Write (A1, . . . , An, o) for A1 → · · · → An → o.

■ Divergence definable, e.g. ⊥ := Yo(λx.x).

■ Finitary restrictions (i.e. no Y): fPCF, fPCF⊥.

Page 9: Luke Ong Nikos Tzevelekos Oxford University Computing

Reachability

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 5

■ Given a PCF-term M and a coloured subterm Lof M ,

� Is there a program context C such thatC[M ] ։ E[L′] with L′ coloured?

Page 10: Luke Ong Nikos Tzevelekos Oxford University Computing

Reachability

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 5

■ Given a PCF-term M and a coloured subterm Lof M ,

� Is there a program context C such thatC[M ] ։ E[L′] with L′ coloured?

Equivalently:

■ Given a closed PCF-term M : (A1, ..., An, o) anda coloured subterm L of M ,

� Are there closed PCF-terms N1, . . . , Nn such that

M ~N ։ E[L′]

with L′ coloured?

Page 11: Luke Ong Nikos Tzevelekos Oxford University Computing

PCF-with-error: PCF⋆

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 6

Take base type o = {t, f, ⋆} with ⋆ an error constant:

E[⋆] ։ ⋆

⋆-Reachability:

■ Given a closed PCF⋆-term M : (A1, ..., An, o) thathas exactly one occurrence of ⋆,

� are there closed PCF-terms N1, ..., Nn such thatM ~N ։ ⋆?

Page 12: Luke Ong Nikos Tzevelekos Oxford University Computing

PCF-with-error: PCF⋆

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 6

Take base type o = {t, f, ⋆} with ⋆ an error constant:

E[⋆] ։ ⋆

⋆-Reachability:

■ Given a closed PCF⋆-term M : (A1, ..., An, o) thathas exactly one occurrence of ⋆,

� are there closed PCF-terms N1, ..., Nn such thatM ~N ։ ⋆?

Lemma: Reachability ∼= ⋆-Reachability.

Page 13: Luke Ong Nikos Tzevelekos Oxford University Computing

Reach template

Ong & Tzevelekos Functional Reachability – 7

For v ∈ {t, f, ⋆} and L1,L2 ⊆ PCF⋆:

v-Reach [L1,L2]:Given a closed L1-term M : (A1, ..., An, o), are there closed

L2-terms N1, ..., Nn such that M ~N ։ v?

e.g. ⋆-Reachability = ⋆-Reach [PCF1⋆,PCF].

Page 14: Luke Ong Nikos Tzevelekos Oxford University Computing

Reach template

Ong & Tzevelekos Functional Reachability – 7

For v ∈ {t, f, ⋆} and L1,L2 ⊆ PCF⋆:

v-Reach [L1,L2]:Given a closed L1-term M : (A1, ..., An, o), are there closed

L2-terms N1, ..., Nn such that M ~N ։ v?

Three classes of problems:

Reachability

⋆-Reachability

⋆-Reach [PCF1⋆,PCF]

⋆-Reach [PCF1⋆, fPCF]

⋆-Reach [fPCF1⋆, fPCF]⋆-Reach [fPCF⋆, fPCF]. . .

⋆-Reach [fPCF1⋆⊥, fPCF]

⋆-Reach [fPCF⋆⊥, fPCF]

. . .

Page 15: Luke Ong Nikos Tzevelekos Oxford University Computing

An undecidability result

Ong & Tzevelekos Functional Reachability – 8

Lemma: ⋆-Reach [fPCF1⋆⊥, fPCF] is undecidable.

Proof: By reduction of solvability of systems of fPCF⊥-equations(proved undecidable by [Loader’01]).

Reachability

⋆-Reachability

⋆-Reach [PCF1⋆,PCF]

⋆-Reach [PCF1⋆, fPCF]

⋆-Reach [fPCF1⋆, fPCF]⋆-Reach [fPCF⋆, fPCF]. . .

⋆-Reach [fPCF1⋆⊥, fPCF]

⋆-Reach [fPCF⋆⊥, fPCF]

. . .

Page 16: Luke Ong Nikos Tzevelekos Oxford University Computing

Our approach

Ong & Tzevelekos Functional Reachability – 9

■ We focus on v-Reach [fPCF⋆, fPCF].

■ For fPCF⋆-term P : o,

Computations of P oo //Traversals over its compu-tation tree, λ(P )

88

xxqqqqqqqqqq

Runs of an Alternating TreeAutomaton (ATA) on λ(P )

Page 17: Luke Ong Nikos Tzevelekos Oxford University Computing

Our approach

Ong & Tzevelekos Functional Reachability – 9

■ We focus on v-Reach [fPCF⋆, fPCF].

■ For fPCF⋆-term P : o,

Computations of P oo //Traversals over its compu-tation tree, λ(P )

88

xxqqqqqqqqqq

Runs of an Alternating TreeAutomaton (ATA) on λ(P )

� P ։ v iff an ATA accepts λ(P ) on initial state with value v.

Page 18: Luke Ong Nikos Tzevelekos Oxford University Computing

Computation trees

Ong & Tzevelekos Functional Reachability – 10

Starting from a fPCF⋆-term M ,

■ take its η-long form,

■ add application symbols (@),

■ view the result as a tree, λ(M).

Page 19: Luke Ong Nikos Tzevelekos Oxford University Computing

Computation trees

Ong & Tzevelekos Functional Reachability – 10

Starting from a fPCF⋆-term M ,

■ take its η-long form,

■ add application symbols (@),

■ view the result as a tree, λ(M).

( λΦz.Φ(λy. ify ⋆ z)t ) (λϕx. ϕx) t 7−→

λ

@���� ??

?

OOOOOOOO

λΦz λϕx λ

Φ}}}

}??

??ϕ t

λy λ λ

if��� CC

CCt x

λ λ λ

y ⋆ z

Page 20: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

Page 21: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 22: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 23: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 24: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 25: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 26: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 27: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 28: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 29: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 30: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 31: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 32: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 33: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 34: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 35: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 36: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 37: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z

Page 38: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

λ

@

tttt

ttt

JJJJJJ

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

ssssss

ss

JJJJJJJJ ϕ t

λy λ λ

if

vvvvvvv

LLLLLLLL t x

λ λ λ

y ⋆ z⋆-complete traversal

Page 39: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversals

Ong & Tzevelekos Functional Reachability – 11

A traversal [Blum, Ong] over a computation tree,

■ follows the flow of control within it,

■ seen from the perspective of Game Semantics.

A traversal is v-complete if every question (red visit) has beenanswered (green visit), and the root question has been an-swered with v.

Theorem: For any P : o and value v, P ։ v iff there is acomplete v-traversal over λ(P ).

Page 40: Luke Ong Nikos Tzevelekos Oxford University Computing

Alternating Tree Automata

Ong & Tzevelekos Functional Reachability – 12

An ATA is a quadruple A = 〈Q,Σ, q0,∆〉 where:

■ Q is a finite set of states,

■ Σ is a finite ranked alphabet,

■ q0 ∈ Q is the initial state,

■ ∆ is a finite transition relation: qs→ (Q1, . . . , Qk).

s ∈ Σq ∈ Q

Q1, ... , Qk ⊆ Q

Page 41: Luke Ong Nikos Tzevelekos Oxford University Computing

Alternating Tree Automata

Ong & Tzevelekos Functional Reachability – 12

An ATA is a quadruple A = 〈Q,Σ, q0,∆〉 where:

■ Q is a finite set of states,

■ Σ is a finite ranked alphabet,

■ q0 ∈ Q is the initial state,

■ ∆ is a finite transition relation: qs→ (Q1, . . . , Qk).

s ∈ Σq ∈ Q

Q1, ... , Qk ⊆ Q

s

llllllllllllllll

yyyy

yyyy

OOOOOOOOOOOOOO

s1 s2 . . . sk

. . . . . . . . . . . .

Page 42: Luke Ong Nikos Tzevelekos Oxford University Computing

Alternating Tree Automata

Ong & Tzevelekos Functional Reachability – 12

An ATA is a quadruple A = 〈Q,Σ, q0,∆〉 where:

■ Q is a finite set of states,

■ Σ is a finite ranked alphabet,

■ q0 ∈ Q is the initial state,

■ ∆ is a finite transition relation: qs→ (Q1, . . . , Qk).

s ∈ Σq ∈ Q

Q1, ... , Qk ⊆ Q

s

llllllllllllllll

yyyy

yyyy

OOOOOOOOOOOOOO

s1 s2 . . . sk

. . . . . . . . . . . .

A(q)

Page 43: Luke Ong Nikos Tzevelekos Oxford University Computing

Alternating Tree Automata

Ong & Tzevelekos Functional Reachability – 12

An ATA is a quadruple A = 〈Q,Σ, q0,∆〉 where:

■ Q is a finite set of states,

■ Σ is a finite ranked alphabet,

■ q0 ∈ Q is the initial state,

■ ∆ is a finite transition relation: qs→ (Q1, . . . , Qk).

s ∈ Σq ∈ Q

Q1, ... , Qk ⊆ Q

s

llllllllllllllll

yyyy

yyyy

OOOOOOOOOOOOOO

s1 s2 . . . sk

. . . . . . . . . . . .

A(Q1) A(Q2) A(Qk)

Page 44: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversal-simulating ATA’s

Ong & Tzevelekos Functional Reachability – 13

λ

@

�����

....

.

;;;;

;;

λΦz λϕx λ

Φ

�����

....

. ϕ t

λy λ λ

if

���� 00

000 t x

λ λ λ

y ⋆ z

How can we simulate a complete traversal by an ATA?

Page 45: Luke Ong Nikos Tzevelekos Oxford University Computing

Traversal-simulating ATA’s

Ong & Tzevelekos Functional Reachability – 13

λ

@

�����

....

.

;;;;

;;

λΦz λϕx λ

Φ

�����

....

. ϕ t

λy λ λ

if

���� 00

000 t x

λ λ λ

y ⋆ z

How can we simulate a complete traversal by an ATA?

■ By guessing the number of visits of each node.

■ By guessing the profile of each variable per visit.

■ By verifying these guesses.

Page 46: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

■ Introduced by [Ong’06].

■ VP(A1, . . . , An, o) := Var × Val ×P(⋃n

i=1VP(Ai))

■ Notation: (x, v), (x, v | π1, . . . , πn)

Page 47: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Page 48: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Φ

ϕ x y

Page 49: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Φ

ϕ x yt

t

t

t

t

t ⋆

Page 50: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Φ

ϕ x y

t

t

⋆⋆

Page 51: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Φ

ϕ x y

⋆⋆

(x, t)

(y, t)

Page 52: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Φ

ϕ x y

(x, t)

(y, t)

(ϕ, ⋆ | (y, t))

Page 53: Luke Ong Nikos Tzevelekos Oxford University Computing

Variable profiles

Ong & Tzevelekos Functional Reachability – 14

λ

@

uuuuuuuII

IIII

I

TTTTTTTTTTTTTTTT

λΦz λϕx λ

Φ

tttttt

tt

IIIIIIII ϕ t

λy λ λ

if

wwwwwww

KKKKKKKK t x

λ λ λ

y ⋆ z

Φ

ϕ x y

(x, t)

(y, t)

(ϕ, ⋆ | (y, t))(Φ, ⋆ | (ϕ, ⋆ | (y, t)), (x, t))

Page 54: Luke Ong Nikos Tzevelekos Oxford University Computing

ATA correspondence

Ong & Tzevelekos Functional Reachability – 15

Given a finite fPCF⋆-alphabet Σ, the states of thetraveral-simulating ATA AΣ are:

Q := Val ×P(VPΣ) ×P(VPΣ)

Page 55: Luke Ong Nikos Tzevelekos Oxford University Computing

ATA correspondence

Ong & Tzevelekos Functional Reachability – 15

Given a finite fPCF⋆-alphabet Σ, the states of thetraveral-simulating ATA AΣ are:

Q := Val ×P(VPΣ) ×P(VPΣ)

■ M ~N ։ v iff AΣ accepts λ(M ~N) on initial state with value v.

■ Any tree accepted by AΣ is a closed fPCF-term.

Page 56: Luke Ong Nikos Tzevelekos Oxford University Computing

Results

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 16

Theorem: M ∈ v-Reach [fPCF⋆Σ, fPCFΣ] iff there is

an initial state q0 with value v such that:

■ AΣ(qo) accepts λ(M),

■ ∀i, the language accepted by AΣ(q0 ↾ Ai) isnon-empty.

Page 57: Luke Ong Nikos Tzevelekos Oxford University Computing

Results

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 16

Theorem: M ∈ v-Reach [fPCF⋆Σ, fPCFΣ] iff there is

an initial state q0 with value v such that:

■ AΣ(qo) accepts λ(M),

■ ∀i, the language accepted by AΣ(q0 ↾ Ai) isnon-empty.

Corollary: ⋆-Reach [fPCF⋆, fPCF(n)] is decidable.

Corollary: ⋆-Reach [fPCF⋆, fPCF] is decidable up toorder 3.

Page 58: Luke Ong Nikos Tzevelekos Oxford University Computing

Alternating Dependency Tree Automata

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 17

■ For the general case we can use AlternatingDependency Tree Automata [Stirling’09].

■ Corollary: Emptiness problem is undecidable forADTA’s.

Page 59: Luke Ong Nikos Tzevelekos Oxford University Computing

Conclusion and on

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 18

■ A new kind of Reachability problems.

■ Some undecidability results.

■ Some technology from game semantics.

■ Characterisation by ATA’s and ADTA’s.

■ Some (relativised) decidability results.

Page 60: Luke Ong Nikos Tzevelekos Oxford University Computing

Conclusion and on

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 18

■ A new kind of Reachability problems.

■ Some undecidability results.

■ Some technology from game semantics.

■ Characterisation by ATA’s and ADTA’s.

■ Some (relativised) decidability results.

� Revisit (semantic) CFA?

� Reachability through intersection types?

� Conjecture: ⋆-Reach [fPCF⋆, fPCF] ?

Page 61: Luke Ong Nikos Tzevelekos Oxford University Computing

Conclusion and on

The Problem

Relevant workThe examined

language: PCF

Reachability

PCF-with-error:

PCF⋆

Reach template

An undecidability

result

Our approach

Computation trees

TraversalsAlternating Tree

AutomataTraversal-simulating

ATA’s

Variable profiles

ATA correspondence

ResultsAlternating

Dependency Tree

Automata

Conclusion and on

Ong & Tzevelekos Functional Reachability – 18

■ A new kind of Reachability problems.

■ Some undecidability results.

■ Some technology from game semantics.

■ Characterisation by ATA’s and ADTA’s.

■ Some (relativised) decidability results.

� Revisit (semantic) CFA?

� Reachability through intersection types?

� Conjecture: ⋆-Reach [fPCF⋆, fPCF] ?

THANKS!