Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
A Kripke Logical Relation for Linear Functions:
The Story of a Free Theorem in the Presence of Non-termination
Phillip Mates & Amal AhmedNortheastern University
2
Programmers shouldn't have to think about compilers
3
Fully abstract compiler
Source Target
4
Fully abstract compiler
Source Target
preserves equivalence
5
Fully abstract compiler
Source Target
reflects equivalence
preserves equivalence
&
6
Verifying a CPS translation fully abstract
Source
Target
7
Outline
Finding a fully abstract CPS translation w/ • Standard CPS
• Polymorphic CPS ( only in a pure setting)
• Linear + polymorphic CPS
Proving full-abstraction
Towards a semantic model for linearly-treated functions
8
Standard CPS isn't fully abstract
9
Standard CPS isn't fully abstract
10
Standard CPS isn't fully abstract
11
Standard CPS isn't fully abstract
12
Standard CPS isn't fully abstract
13
Standard CPS isn't fully abstract
14
Standard CPS isn't fully abstract
15
Standard CPS isn't fully abstract
16
How can we modify the standardCPS translation to be fully abstract?
17
Standard CPS
Ahmed & Blume's polymorphic CPS
18
What happens when we add non-termination?
Standard CPS
Ahmed & Blume's polymorphic CPS
19
Linear + polymorphic CPS
Standard CPS
Ahmed & Blume's polymorphic CPS
20
Outline
Finding a fully abstract CPS translation w/
Proving full-abstraction• Polymorphic CPS proof
• Scaling to a non-terminating setting using linearity
Towards a semantic model for linearly-treated functions
21
Proving polymorphic CPS fully abstract
Ahmed + Blume's approach relies ona type isomorphism:
22
Proving polymorphic CPS fully abstract
The type isomorphism relies ona parametric condition:
23
Parametric condition fails in the presence of non-termination
24
Parametric condition fails in the presence of non-termination
25
Parametric condition fails in the presence of non-termination
26
Parametric condition fails in the presence of non-termination
27
A step back
Ahmed & Blume's polymorphic CPS
28
A step back
Ahmed & Blume's polymorphic CPS
requires
29
A step back
Ahmed & Blume's polymorphic CPS
requires
30
A step back
Ahmed & Blume's polymorphic CPS
requires
Linear + polymorphic CPS
31
A step back
Ahmed & Blume's polymorphic CPS
requires
Linear + polymorphic CPS
requires
32
A step back
Ahmed & Blume's polymorphic CPS
requires
Linear + polymorphic CPS
requires linear
33
A “linear” parametric conditionin presence of non-termination
linear
34
How do you prove thisnew parametric condition,
which uses continuations linearly?
35
Free theorem: use a logical relation
36
Free theorem: use a logical relation
37
Free theorem: use a logical relation
38
Free theorem: use a logical relation
39
Free theorem: use a logical relation
?
40
Proving
41
Proving
know
42
Proving
know
43
Proving
showknow
44
Proving
know show
45
Proving
know:
showknow
46
Proving
know:
show:
showknow
47
Proving
know:
show:
showknow
48
Proving
49
Proving
know
50
Proving
know
know
51
Proving
show
know
know
52
show
know
Proving
know
behaviour?
53
show
know
know
Proving
54
show
know
Proving
know
55
show
know
Proving
=know
56
Outline
Finding a fully abstract CPS translation w/
Proving full-abstraction
Towards a semantic model for linearly-treated functions
57
?
Function semantics: case 1
58
for all possible inputs
Function semantics: case 1
unrestrictedusage
59
Function semantics: case 2
for all possible inputs &treat inputs linearly
unrestrictedusage
60
for particular inputs
Function semantics: case 3
linearly used
61
Function semantics: case 4
for particular inputs &treat input linearly
linearly used
62
Relating linearly-treated functions
63
Relating linearly-treated functions
64
Relating linearly-treated functions
65
Relating linearly-treated functions
66
Relating linearly-treated functions
where
67
Linearity by default
68
Kripke logical relation for linearity
69
Kripke logical relation for linearity
70
Kripke logical relation for linearity
71
Kripke logical relation for linearity
72
Kripke logical relation for linearity
73
Kripke logical relation for linearity
74
Kripke logical relation for linearity
75
Kripke logical relation for linearity
76
Related Work
Fully abstract CPS for PCF [Laird]
• Uses game semantics proof
Logical relation for linear free theorems [Zhao et. al.]
• Open logical relation to ensure preservation of linear resources
TT logical relation for Lily [Bierman et. al.]
77
Conclusion
Fully abstract CPS in a language with rec. types using operational proof techniques
requires
which requires
78
Conclusion
Fully abstract CPS in a language with rec. types using operational proof techniques
requires
which requires
Kripke logical relation that can distinguishlinearly-treated: unrestricted:
79
80
Why polymorphism:ST boundary semantics
Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Slide 66Slide 67Slide 68Slide 69Slide 70Slide 71Slide 72Slide 73Slide 74Slide 75Slide 76Slide 77Slide 78Slide 79Slide 80