a kripke logical relation for linear functions
TRANSCRIPT
![Page 1: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/1.jpg)
A Kripke Logical Relation for Linear Functions:
The Story of a Free Theorem in the Presence of Non-termination
Phillip Mates & Amal AhmedNortheastern University
![Page 2: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/2.jpg)
2
Programmers shouldn't have to think about compilers
![Page 3: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/3.jpg)
3
Fully abstract compiler
Source Target
![Page 4: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/4.jpg)
4
Fully abstract compiler
Source Target
preserves equivalence
![Page 5: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/5.jpg)
5
Fully abstract compiler
Source Target
reflects equivalence
preserves equivalence
&
![Page 6: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/6.jpg)
6
Verifying a CPS translation fully abstract
Source
Target
![Page 7: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/7.jpg)
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
![Page 8: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/8.jpg)
8
Standard CPS isn't fully abstract
![Page 9: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/9.jpg)
9
Standard CPS isn't fully abstract
![Page 10: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/10.jpg)
10
Standard CPS isn't fully abstract
![Page 11: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/11.jpg)
11
Standard CPS isn't fully abstract
![Page 12: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/12.jpg)
12
Standard CPS isn't fully abstract
![Page 13: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/13.jpg)
13
Standard CPS isn't fully abstract
![Page 14: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/14.jpg)
14
Standard CPS isn't fully abstract
![Page 15: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/15.jpg)
15
Standard CPS isn't fully abstract
![Page 16: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/16.jpg)
16
How can we modify the standardCPS translation to be fully abstract?
![Page 17: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/17.jpg)
17
Standard CPS
Ahmed & Blume's polymorphic CPS
![Page 18: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/18.jpg)
18
What happens when we add non-termination?
Standard CPS
Ahmed & Blume's polymorphic CPS
![Page 19: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/19.jpg)
19
Linear + polymorphic CPS
Standard CPS
Ahmed & Blume's polymorphic CPS
![Page 20: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/20.jpg)
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
![Page 21: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/21.jpg)
21
Proving polymorphic CPS fully abstract
Ahmed + Blume's approach relies ona type isomorphism:
![Page 22: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/22.jpg)
22
Proving polymorphic CPS fully abstract
The type isomorphism relies ona parametric condition:
![Page 23: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/23.jpg)
23
Parametric condition fails in the presence of non-termination
![Page 24: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/24.jpg)
24
Parametric condition fails in the presence of non-termination
![Page 25: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/25.jpg)
25
Parametric condition fails in the presence of non-termination
![Page 26: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/26.jpg)
26
Parametric condition fails in the presence of non-termination
![Page 27: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/27.jpg)
27
A step back
Ahmed & Blume's polymorphic CPS
![Page 28: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/28.jpg)
28
A step back
Ahmed & Blume's polymorphic CPS
requires
![Page 29: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/29.jpg)
29
A step back
Ahmed & Blume's polymorphic CPS
requires
![Page 30: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/30.jpg)
30
A step back
Ahmed & Blume's polymorphic CPS
requires
Linear + polymorphic CPS
![Page 31: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/31.jpg)
31
A step back
Ahmed & Blume's polymorphic CPS
requires
Linear + polymorphic CPS
requires
![Page 32: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/32.jpg)
32
A step back
Ahmed & Blume's polymorphic CPS
requires
Linear + polymorphic CPS
requires linear
![Page 33: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/33.jpg)
33
A “linear” parametric conditionin presence of non-termination
linear
![Page 34: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/34.jpg)
34
How do you prove thisnew parametric condition,
which uses continuations linearly?
![Page 35: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/35.jpg)
35
Free theorem: use a logical relation
![Page 36: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/36.jpg)
36
Free theorem: use a logical relation
![Page 37: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/37.jpg)
37
Free theorem: use a logical relation
![Page 38: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/38.jpg)
38
Free theorem: use a logical relation
![Page 39: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/39.jpg)
39
Free theorem: use a logical relation
?
![Page 40: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/40.jpg)
40
Proving
![Page 41: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/41.jpg)
41
Proving
know
![Page 42: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/42.jpg)
42
Proving
know
![Page 43: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/43.jpg)
43
Proving
showknow
![Page 44: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/44.jpg)
44
Proving
know show
![Page 45: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/45.jpg)
45
Proving
know:
showknow
![Page 46: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/46.jpg)
46
Proving
know:
show:
showknow
![Page 47: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/47.jpg)
47
Proving
know:
show:
showknow
![Page 48: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/48.jpg)
48
Proving
![Page 49: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/49.jpg)
49
Proving
know
![Page 50: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/50.jpg)
50
Proving
know
know
![Page 51: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/51.jpg)
51
Proving
show
know
know
![Page 52: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/52.jpg)
52
show
know
Proving
know
behaviour?
![Page 53: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/53.jpg)
53
show
know
know
Proving
![Page 54: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/54.jpg)
54
show
know
Proving
know
![Page 55: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/55.jpg)
55
show
know
Proving
=know
![Page 56: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/56.jpg)
56
Outline
Finding a fully abstract CPS translation w/
Proving full-abstraction
Towards a semantic model for linearly-treated functions
![Page 57: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/57.jpg)
57
?
Function semantics: case 1
![Page 58: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/58.jpg)
58
for all possible inputs
Function semantics: case 1
unrestrictedusage
![Page 59: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/59.jpg)
59
Function semantics: case 2
for all possible inputs &treat inputs linearly
unrestrictedusage
![Page 60: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/60.jpg)
60
for particular inputs
Function semantics: case 3
linearly used
![Page 61: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/61.jpg)
61
Function semantics: case 4
for particular inputs &treat input linearly
linearly used
![Page 62: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/62.jpg)
62
Relating linearly-treated functions
![Page 63: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/63.jpg)
63
Relating linearly-treated functions
![Page 64: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/64.jpg)
64
Relating linearly-treated functions
![Page 65: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/65.jpg)
65
Relating linearly-treated functions
![Page 66: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/66.jpg)
66
Relating linearly-treated functions
where
![Page 67: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/67.jpg)
67
Linearity by default
![Page 68: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/68.jpg)
68
Kripke logical relation for linearity
![Page 69: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/69.jpg)
69
Kripke logical relation for linearity
![Page 70: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/70.jpg)
70
Kripke logical relation for linearity
![Page 71: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/71.jpg)
71
Kripke logical relation for linearity
![Page 72: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/72.jpg)
72
Kripke logical relation for linearity
![Page 73: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/73.jpg)
73
Kripke logical relation for linearity
![Page 74: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/74.jpg)
74
Kripke logical relation for linearity
![Page 75: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/75.jpg)
75
Kripke logical relation for linearity
![Page 76: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/76.jpg)
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.]
![Page 77: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/77.jpg)
77
Conclusion
Fully abstract CPS in a language with rec. types using operational proof techniques
requires
which requires
![Page 78: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/78.jpg)
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:
![Page 79: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/79.jpg)
79
![Page 80: A Kripke Logical Relation for Linear Functions](https://reader030.vdocument.in/reader030/viewer/2022012507/6182fa0250834f0edb08f26b/html5/thumbnails/80.jpg)
80
Why polymorphism:ST boundary semantics