Polymorphism Dynamic Typing Favonia | Nick Benton | Bob Harper 1 - - PowerPoint PPT Presentation

polymorphism dynamic typing
SMART_READER_LITE
LIVE PREVIEW

Polymorphism Dynamic Typing Favonia | Nick Benton | Bob Harper 1 - - PowerPoint PPT Presentation

Polymorphism Dynamic Typing Favonia | Nick Benton | Bob Harper 1 Polymorphism T C E R R O C Dynamic Typing Favonia | Nick Benton | Bob Harper 1 Is this the shortest PLunch? Bob and I wanted to make homework 2 Is this the shortest


slide-1
SLIDE 1

1

Polymorphism

Favonia | Nick Benton | Bob Harper

Dynamic Typing

slide-2
SLIDE 2

1

Polymorphism

Favonia | Nick Benton | Bob Harper

Dynamic Typing

C O R R E C T

slide-3
SLIDE 3

2

Is this the shortest PLunch?

Bob and I wanted to make homework

slide-4
SLIDE 4

2

Is this the shortest PLunch?

Bob and I wanted to make homework and so we had a JFP Theoretical Pearl.

slide-5
SLIDE 5

3

source TARGET type var. “top” type

System F to PCF

slide-6
SLIDE 6

3

source TARGET type var. “top” type

System F to PCF

slide-7
SLIDE 7

3

source TARGET type var. “top” type But keep other types!

System F to PCF

slide-8
SLIDE 8

4

System F source

System F to PCF

slide-9
SLIDE 9

4

System F PCF with dyn

source TARGET

System F to PCF

slide-10
SLIDE 10

4

System F PCF with dyn

source TARGET

System F to PCF

slide-11
SLIDE 11

5

System F to PCF

Keep everything except variables

slide-12
SLIDE 12

5

System F to PCF

Keep everything except variables

slide-13
SLIDE 13

6

Type Application

type app

slide-14
SLIDE 14

6

Type Application

type app

slide-15
SLIDE 15

6

Type Application

type app ?

slide-16
SLIDE 16

6

Type Application

type app ?

slide-17
SLIDE 17

7

Type Application

type app ?

slide-18
SLIDE 18

7

Type Application

type app ?

slide-19
SLIDE 19

8

Embed and Project

slide-20
SLIDE 20

9

Type Application

type app

slide-21
SLIDE 21

9

Type Application

type app Idea: lift the projection to handle arbitrary type operators.

slide-22
SLIDE 22

9

Type Application

type app Idea: lift the projection to handle arbitrary type operators.

slide-23
SLIDE 23

9

Type Application

type app Idea: lift the projection to handle arbitrary type operators. *Mayer-Wand style

slide-24
SLIDE 24

10

Embed and Project 2.0

Find all the t!

slide-25
SLIDE 25

11

Embed and Project 2.0

slide-26
SLIDE 26

12

Problem Statement

slide-27
SLIDE 27

12

Problem Statement

(Intended) homework assignment: no run-time errors

slide-28
SLIDE 28

12

Problem Statement

(Intended) homework assignment: no run-time errors Igarashi, Pierce and Wadler [2001] showed correctness in a minimal core calculus for Java with generics, relying on the class table.

slide-29
SLIDE 29

12

Problem Statement

(Intended) homework assignment: no run-time errors Igarashi, Pierce and Wadler [2001] showed correctness in a minimal core calculus for Java with generics, relying on the class table.

Our difficulty: composition of types

slide-30
SLIDE 30

13

System F types System F terms PCF terms relations for type variables that respect obs. equiv.

slide-31
SLIDE 31

13

System F types System F terms PCF terms relations for type variables that respect obs. equiv. no J here!

slide-32
SLIDE 32

14

Logical Relation Recipe

weakening and exchange STEP 1 the relation itself respects obs. equiv. (and the properties you care) STEP 2 composition of types/relations STEP 3 fundamental lemma! STEP 4

slide-33
SLIDE 33

14

Logical Relation Recipe

weakening and exchange STEP 1 the relation itself respects obs. equiv. (and the properties you care) STEP 2 composition of types/relations STEP 3 fundamental lemma! STEP 4

?

slide-34
SLIDE 34

15

Compositionality

slide-35
SLIDE 35

15

Compositionality

slide-36
SLIDE 36

15

Compositionality

not so clear if it's “iff.”

slide-37
SLIDE 37

16

Compositionality

FAILED ATTEMPT

implies(?)

slide-38
SLIDE 38

16

Compositionality

Assume We want

FAILED ATTEMPT

implies(?)

slide-39
SLIDE 39

16

Compositionality

Assume We have We want

FAILED ATTEMPT

implies(?)

slide-40
SLIDE 40

16

Compositionality

Assume We have We want

FAILED ATTEMPT

implies(?)

slide-41
SLIDE 41

16

Compositionality

Assume We have We want

FAILED ATTEMPT

implies(?)

slide-42
SLIDE 42

17

Logical Relation Recipe

weakening and exchange STEP 1 the relation itself respects obs. equiv. (and the properties you care) STEP 2 quasi-composition of types/relations STEP 3 fundamental lemma! STEP 4

Thus, compiled programs give the same numbers!

(no run-time errors)

slide-43
SLIDE 43

18

Concluding Notes

slide-44
SLIDE 44

18

Concluding Notes

A nice trick to deal with embedding/projection!

slide-45
SLIDE 45

18

Concluding Notes

We used refinements to make but rejected by POPL. :-( A nice trick to deal with embedding/projection!

slide-46
SLIDE 46

18

Concluding Notes

We used refinements to make but rejected by POPL. :-( A nice trick to deal with embedding/projection! We have 3 different proofs with different setups.

slide-47
SLIDE 47

18

Concluding Notes

We used refinements to make but rejected by POPL. :-( Thunks to preserve values: A nice trick to deal with embedding/projection! We have 3 different proofs with different setups.

slide-48
SLIDE 48

18

Concluding Notes

We used refinements to make but rejected by POPL. :-( Thunks to preserve values: You can find open problems by TAing! A nice trick to deal with embedding/projection! We have 3 different proofs with different setups.