decidability of rml via game semantics - cs.bham.ac.ukpbl/galop2016/murawskislides.pdf · m (m := n...
TRANSCRIPT
DECIDABILITY OF RMLVIA GAME SEMANTICS
Andrzej Murawski University of Warwick
reporting on joint work with C. Cotton-Barratt, D. Hopkins, L. Ong and N. Tzevelekos
IDEALIZED ALGOL
Contextual approximation and higher-order procedures 3
2 Idealized Algol
We consider a finitary version IA
f
of Idealized Algol with active expressions [1]. Itstypes are generated by the following grammar.
✓ ::= � | ✓ ! ✓ � ::= com | exp | var
IA
f
can be viewed as a simply-typed �-calculus over the base types com, exp, var (ofcommands, expressions and variables respectively) augmented with the constants listedbelow
skip : com i : exp (0 i max ) succ : exp ! exp pred : exp ! exp
ifzero� : exp ! � ! � ! � seq� : com ! � ! � deref : var ! exp
assign : var ! exp ! com cell� : (var ! �) ! �while : exp ! com ! com mkvar : (exp ! com) ! exp ! var
where � ranges over base types and exp = { 0, · · · ,max }. Other IAf
-terms are formedusing �-abstraction and application
� ` M : ✓ ! ✓0 � ` N : ✓
� ` MN : ✓0�, x : ✓ ` M : ✓0
� ` �x✓.M : ✓ ! ✓0
using the obvious rules for constants and free identifiers. Each of the constants corre-sponds to a different programming feature. For instance, the sequential composition ofM and N (typically denoted by M ;N ) is expressed as seq�MN , assignment of N toM (M :
=N ) is represented by assignMN and cell�(�x.M) amounts to creating alocal variable x visible in M (new x in M ). mkvar is the so-called bad-variable con-structor that makes it possible to construct terms of type var with prescribed read- andwrite-methods. whileMN corresponds to while M do N . We shall write ⌦� for thedivergent constant that can be defined using while 1 do skip.
The operational semantics of IAf
, based on call-by-name evaluation, can be foundin [1]; we will write M + if M reduces to skip. We study the induced contextualapproximation.
Definition 1. We say that � ` M1
: ✓ contextually approximates � ` M2
: ✓ if, for anycontext C[�] such that C[M
1
], C[M2
] are closed terms of type com, we have C[M1
]+implies C[M
2
]+. We then write � ` M1
@⇠ M2
.
Even though the base types are finite, IAf
contextual approximation is not decidable [11].To obtain decidability one has to restrict the order of types, defined by:
ord(�) = 0 ord(✓ ! ✓0) = max(ord(✓) + 1, ord(✓0)).
Definition 2. Let i � 0. The fragment IAi of IAf
consists of IAf
-terms x1
: ✓1
, · · · , xn : ✓n `M : ✓ such that ord(✓j) < i for any j = 1, · · · , n and ord(✓) i.
Contextual approximation is known to be decidable for IA1
, IA2
and IA
3
[13], but it isundecidable for IA
4
[11].
Definition 3. – The level of a �-redex (�x✓.M)N is the order of the type of �x✓.M .
Contextual approximation and higher-order procedures 3
2 Idealized Algol
We consider a finitary version IA
f
of Idealized Algol with active expressions [1]. Itstypes are generated by the following grammar.
✓ ::= � | ✓ ! ✓ � ::= com | exp | var
IA
f
can be viewed as a simply-typed �-calculus over the base types com, exp, var (ofcommands, expressions and variables respectively) augmented with the constants listedbelow
skip : com i : exp (0 i max ) succ : exp ! exp pred : exp ! exp
ifzero� : exp ! � ! � ! � seq� : com ! � ! � deref : var ! exp
assign : var ! exp ! com cell� : (var ! �) ! �while : exp ! com ! com mkvar : (exp ! com) ! exp ! var
where � ranges over base types and exp = { 0, · · · ,max }. Other IAf
-terms are formedusing �-abstraction and application
� ` M : ✓ ! ✓0 � ` N : ✓
� ` MN : ✓0�, x : ✓ ` M : ✓0
� ` �x✓.M : ✓ ! ✓0
using the obvious rules for constants and free identifiers. Each of the constants corre-sponds to a different programming feature. For instance, the sequential composition ofM and N (typically denoted by M ;N ) is expressed as seq�MN , assignment of N toM (M :
=N ) is represented by assignMN and cell�(�x.M) amounts to creating alocal variable x visible in M (new x in M ). mkvar is the so-called bad-variable con-structor that makes it possible to construct terms of type var with prescribed read- andwrite-methods. whileMN corresponds to while M do N . We shall write ⌦� for thedivergent constant that can be defined using while 1 do skip.
The operational semantics of IAf
, based on call-by-name evaluation, can be foundin [1]; we will write M + if M reduces to skip. We study the induced contextualapproximation.
Definition 1. We say that � ` M1
: ✓ contextually approximates � ` M2
: ✓ if, for anycontext C[�] such that C[M
1
], C[M2
] are closed terms of type com, we have C[M1
]+implies C[M
2
]+. We then write � ` M1
@⇠ M2
.
Even though the base types are finite, IAf
contextual approximation is not decidable [11].To obtain decidability one has to restrict the order of types, defined by:
ord(�) = 0 ord(✓ ! ✓0) = max(ord(✓) + 1, ord(✓0)).
Definition 2. Let i � 0. The fragment IAi of IAf
consists of IAf
-terms x1
: ✓1
, · · · , xn : ✓n `M : ✓ such that ord(✓j) < i for any j = 1, · · · , n and ord(✓) i.
Contextual approximation is known to be decidable for IA1
, IA2
and IA
3
[13], but it isundecidable for IA
4
[11].
Definition 3. – The level of a �-redex (�x✓.M)N is the order of the type of �x✓.M .
Contextual approximation and higher-order procedures 3
2 Idealized Algol
We consider a finitary version IA
f
of Idealized Algol with active expressions [1]. Itstypes are generated by the following grammar.
✓ ::= � | ✓ ! ✓ � ::= com | exp | var
IA
f
can be viewed as a simply-typed �-calculus over the base types com, exp, var (ofcommands, expressions and variables respectively) augmented with the constants listedbelow
skip : com i : exp (0 i max ) succ : exp ! exp pred : exp ! exp
ifzero� : exp ! � ! � ! � seq� : com ! � ! � deref : var ! exp
assign : var ! exp ! com cell� : (var ! �) ! �while : exp ! com ! com mkvar : (exp ! com) ! exp ! var
where � ranges over base types and exp = { 0, · · · ,max }. Other IAf
-terms are formedusing �-abstraction and application
� ` M : ✓ ! ✓0 � ` N : ✓
� ` MN : ✓0�, x : ✓ ` M : ✓0
� ` �x✓.M : ✓ ! ✓0
using the obvious rules for constants and free identifiers. Each of the constants corre-sponds to a different programming feature. For instance, the sequential composition ofM and N (typically denoted by M ;N ) is expressed as seq�MN , assignment of N toM (M :
=N ) is represented by assignMN and cell�(�x.M) amounts to creating alocal variable x visible in M (new x in M ). mkvar is the so-called bad-variable con-structor that makes it possible to construct terms of type var with prescribed read- andwrite-methods. whileMN corresponds to while M do N . We shall write ⌦� for thedivergent constant that can be defined using while 1 do skip.
The operational semantics of IAf
, based on call-by-name evaluation, can be foundin [1]; we will write M + if M reduces to skip. We study the induced contextualapproximation.
Definition 1. We say that � ` M1
: ✓ contextually approximates � ` M2
: ✓ if, for anycontext C[�] such that C[M
1
], C[M2
] are closed terms of type com, we have C[M1
]+implies C[M
2
]+. We then write � ` M1
@⇠ M2
.
Even though the base types are finite, IAf
contextual approximation is not decidable [11].To obtain decidability one has to restrict the order of types, defined by:
ord(�) = 0 ord(✓ ! ✓0) = max(ord(✓) + 1, ord(✓0)).
Definition 2. Let i � 0. The fragment IAi of IAf
consists of IAf
-terms x1
: ✓1
, · · · , xn : ✓n `M : ✓ such that ord(✓j) < i for any j = 1, · · · , n and ord(✓) i.
Contextual approximation is known to be decidable for IA1
, IA2
and IA
3
[13], but it isundecidable for IA
4
[11].
Definition 3. – The level of a �-redex (�x✓.M)N is the order of the type of �x✓.M .
TYPE ORDER
Let T be a TM using Exp(k − 1, n) space for any input of size n.
Lemma. Consider the languages L5,L6 ⊆ (Σ#T )∗ defined by
L5 = {cinit # cR1 #d1#⋯ c
RN #dN #f
R ∣ cj ∈ ConfigT , f ∈ AcceptT , ∀inext(ci) = di}
and
L6 = {c1#dR1 #⋯ cN #d
RN ∣ cj ∈ ConfigT , ∃inext(ci) ≠ di}.
Then T accepts w if and only if L5 /⊆ L6.
Simulation of (k − 1)-EXPSPACE in IAk1 is afforded by an IAk
2 -term nestn,k.
Lemma.
Let k ≥ 2. nestn,k belongs to IAk2 , has polynomial size in n and is β-reducible to fExp(k−1,n)x.
ord(β) = 0
ord(θ → θ′) = max(ord(θ) + 1,ord(θ′))
10
M1@⇠ M2
IAi
Let i � 0. The fragment IAi consists of terms
x1 : ✓1, · · · , xn : ✓n ` M : ✓
such that ord(✓j) < i for any j = 1, · · · , n and ord(✓) i.
1
M1!∼M2
IAi
Let i ≥ 0. The fragment IAi consists ofterms
x1 ∶ θ1,⋯, xn ∶ θn ⊢M ∶ θ
such that ord(θj) < i for any j = 1,⋯, nand ord(θ) ≤ i.
fragment status
IA0 "
IA1 "
IA2 "
IA3 "
IA4 #
Ghica, McCusker, M., Ong, Walukiewicz
fragment status
IA0 PSPACE-completeIA1 PSPACE-completeIA2 PSPACE-completeIA3 EXPTIME-completeIA4 #
M., Walukiewicz
1
DECIDABILITYM1
<∼ M2
IAi
Let i ≥ 0. The fragment IAi consists of terms
x1 ∶ ✓1,�, xn ∶ ✓n �M ∶ ✓such that ord(✓j) < i for any j = 1,�, n and ord(✓) ≤ i.
fragment statusIA0 ,IA1 ,IA2 ,IA3 ,IA4 /
Ghica, McCusker, M., Ong, Walukiewicz
fragment statusIA0 PSPACE-completeIA1 PSPACE-completeIA2 PSPACE-completeIA3 EXPTIME-completeIA4 /
M., Walukiewicz
1
M1!∼M2
IAi
Let i ≥ 0. The fragment IAi consists ofterms
x1 ∶ θ1,⋯, xn ∶ θn ⊢M ∶ θ
such that ord(θj) < i for any j = 1,⋯, nand ord(θ) ≤ i.
fragment status
IA0 "
IA1 "
IA2 "
IA3 "
IA4 #
Ghica, McCusker, M., Ong, Walukiewicz
fragment status
IA0 PSPACE-completeIA1 PSPACE-completeIA2 PSPACE-completeIA3 EXPTIME-completeIA4 #
M., Walukiewicz
1
O-POINTERS
M1 ≅M2
q0
q1
q2
q3
q4
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12
M1 ≅M2
q0
q1
q2
q3
q4
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12
M1 ≅M2
q0
q1
q2
q3
q4
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12
RML (O-STRICTNESS)
• O-strictunit→ unit !(unit→ unit)→ unit !(unit→ ⋯→ unit)→ unit !
• not O-strictunit→ unit→ unit ?
unit→ (unit→ unit)→ unit ?
((unit→ unit)→ unit) → unit "
[Hopkins, M., Ong; ICALP’11]
15
unit→ unit→ unit
q0 a0 q1 a1 q1 a1 q1 a1 q2 a2
O P O P O P O P O P
((com → com) → com)→ com
q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4 q3O P O P O P O P O P
16
M1 ≅M2
q0
q1
q2
q3
q4
q0
a0
q1
a1
q2
a2
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12
M1 ≅M2
q0
q1
q2
q3
q4
q0
a0
q1
a1
q2
a2
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12
POINTERS VIA INFINITE ALPHABET
q0 a0 q1 a1 q1 a1 q1 a1 q2 a2
O P O P O P O P O P
q0 a0 qn1
1 an1
1 qn2
1 an2
1 qn3
1 an3
1 qn2
2 an2
2
O P O P O P O P O P
17
RML (O-STRICTNESS)new results
• O-strictunit→ unit !(unit→ unit)→ unit !(unit→ ⋯→ unit)→ unit !
• not O-strictunit→ unit→ unit !unit→ unit→ unit→ unit !unit→ (unit→ unit)→ unit ?
((unit→ unit)→ unit) → unit "
[Cotton-Barratt, Hopkins, M., Ong; FOSSACS’15]
18
new results
• O-strictunit→ unit !(unit→ unit)→ unit !(unit→ ⋯→ unit)→ unit !
• not O-strictunit→ unit→ unit !unit→ unit→ unit→ unit !unit→ (unit→ unit)→ unit ?
((unit→ unit)→ unit) → unit "
[Cotton-Barratt, Hopkins, M., Ong; FOSSACS’15]
18
GROUND ML (CBV)Ground ML
θ ∶∶= β ∣ θ → θ β ∶∶= unit ∣ int ∣ ref(β)
19
Ground ML
θ ∶∶= β ∣ θ → θ β ∶∶= unit ∣ int ∣ ref(β)
ref (ref (int))
19
GROUND ML (O-STRICTNESS)Ground ML
• O-strictunit→ unit !(unit→ unit)→ unit !(unit→ ⋯→ unit)→ unit !
• not O-strictunit→ unit→ unit "unit→ (unit→ unit)→ unit "((unit→ unit)→ unit) → unit "
[M., Tzevelekos; ICALP’12]
20
unit→ unit→ unit
q0 a0 q1 a1 q1 a1 q1 a1 q2 a2
O P O P O P O P O P
((com → com) → com)→ com
q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4 q3O P O P O P O P O P
16
M1 ≅M2
q0
q1
q2
q3
q4
q0
a0
q1
a1
q2
a2
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12
M1 ≅M2
q0
q1
q2
q3
q4
q0
a0
q1
a1
q2
a2
Undecidability creeps in as soon as it is necessary
to represent pointers from O-moves.
• IA3q0 ⋯ q1 ⋯ q2O P O
• IA4q0 q1 q2 q3 q2 q3 q2 q3 ⋯ q4O P O P O P O P O
12