Top Banner
Outline Java JavaFun Semantical properties Type system Towards soundness proof Functional Java Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw Poland November 24, 2008 Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw Poland Functional Java
134

Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

May 16, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Functional Java

Aleksy Schubert and Jacek ChrząszczInstitute of InformaticsWarsaw Universityul. Banacha 202–097 WarsawPoland

November 24, 2008

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 2: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

JavaFunSyntax of JavaFunSemantics of JavaFun

Semantical propertiesImmutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Type system

Towards soundness proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 3: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:

I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:

I state changes done in a small fragment of the applicationI the rest of the application must be “functional”

— impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 4: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the program

I unpredictable state changesI frequent state inconsistencies

I

A

Solution:

I state changes done in a small fragment of the applicationI the rest of the application must be “functional”

— impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 5: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changes

I frequent state inconsistenciesI

A

Solution:

I state changes done in a small fragment of the applicationI the rest of the application must be “functional”

— impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 6: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:

I state changes done in a small fragment of the applicationI the rest of the application must be “functional”

— impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 7: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:

I state changes done in a small fragment of the applicationI the rest of the application must be “functional”

— impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 8: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:I state changes done in a small fragment of the application

I the rest of the application must be “functional”

— impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 9: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:I state changes done in a small fragment of the applicationI the rest of the application must be “functional”

— impracticalI but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 10: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:I state changes done in a small fragment of the applicationI the rest of the application must be “functional” — impractical

I but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 11: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:I state changes done in a small fragment of the applicationI the rest of the application must be “functional” — impracticalI but functional programs can internally use imperative features

— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 12: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I

A

Solution:I state changes done in a small fragment of the applicationI the rest of the application must be “functional” — impracticalI but functional programs can internally use imperative features— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 13: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I A Solution:I state changes done in a small fragment of the applicationI the rest of the application must be “functional” — impracticalI but functional programs can internally use imperative features— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 14: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Motivations

I Problems with applications in Java:I state scattered through the programI unpredictable state changesI frequent state inconsistencies

I A Solution:I state changes done in a small fragment of the applicationI the rest of the application must be “functional” — impracticalI but functional programs can internally use imperative features— practical

I We want to prove that these parts are “functional”

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 15: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial language

I Requires modellingI We model

I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 16: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling

I We model

I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 17: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 18: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritance

I protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 19: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritanceI protected fields

I named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 20: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritanceI protected fieldsI named public constructors

I named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 21: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritanceI protected fieldsI named public constructorsI named public methods

I control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 22: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)

I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 23: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modellingI We model

I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 24: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packagesI interfacesI visibility featuresI static membersI dynamic loadingI multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 25: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packages

I interfacesI visibility featuresI static membersI dynamic loadingI multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 26: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packagesI interfaces

I visibility featuresI static membersI dynamic loadingI multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 27: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packagesI interfacesI visibility features

I static membersI dynamic loadingI multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 28: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packagesI interfacesI visibility featuresI static members

I dynamic loadingI multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 29: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packagesI interfacesI visibility featuresI static membersI dynamic loading

I multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 30: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Java

I Huge industrial languageI Requires modelling of sublanguagesI We do not model

I packagesI interfacesI visibility featuresI static membersI dynamic loadingI multithreading

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 31: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - Goal

I We want a formal definition of “functional”

I of “local-state”I both syntactic — type system, and semantic — with heaps,locations and values

I and a proof that our type system yields “local-state” and“functional” methods

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 32: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - Goal

I We want a formal definition of “functional”I of “local-state”

I both syntactic — type system, and semantic — with heaps,locations and values

I and a proof that our type system yields “local-state” and“functional” methods

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 33: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - Goal

I We want a formal definition of “functional”I of “local-state”I both syntactic — type system, and semantic — with heaps,locations and values

I and a proof that our type system yields “local-state” and“functional” methods

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 34: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - Goal

I We want a formal definition of “functional”I of “local-state”I both syntactic — type system, and semantic — with heaps,locations and values

I and a proof that our type system yields “local-state” and“functional” methods

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 35: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)

I ad hoc syntactic rulesI a checker which enforced these rules in the build processI no proofsI Kotek project Comarch-UW-EU (SPO WKP)I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 36: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)I ad hoc syntactic rules

I a checker which enforced these rules in the build processI no proofsI Kotek project Comarch-UW-EU (SPO WKP)I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 37: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)I ad hoc syntactic rulesI a checker which enforced these rules in the build process

I no proofsI Kotek project Comarch-UW-EU (SPO WKP)I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 38: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)I ad hoc syntactic rulesI a checker which enforced these rules in the build processI no proofs

I Kotek project Comarch-UW-EU (SPO WKP)I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 39: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)I ad hoc syntactic rulesI a checker which enforced these rules in the build processI no proofsI Kotek project Comarch-UW-EU (SPO WKP)

I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 40: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)I ad hoc syntactic rulesI a checker which enforced these rules in the build processI no proofsI Kotek project Comarch-UW-EU (SPO WKP)I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 41: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun - a bit of “history”

I Genrap developed in Comarch R&D Center (AGS and friends)I ad hoc syntactic rulesI a checker which enforced these rules in the build processI no proofsI Kotek project Comarch-UW-EU (SPO WKP)I start of formalization (syntactic rules −→ a type system),semantics

I now: (beginning of) proof

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 42: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:

I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 43: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:I classes and inheritance

I protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 44: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:I classes and inheritanceI protected fields

I named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 45: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:I classes and inheritanceI protected fieldsI named public constructors

I named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 46: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:I classes and inheritanceI protected fieldsI named public constructorsI named public methods

I control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 47: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)

I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 48: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

JavaFun

I Fragment of Java, including:I classes and inheritanceI protected fieldsI named public constructorsI named public methodsI control flow (including recursion, but no loops)I exceptions

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 49: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

C ::= cdecl+

cdecl ::= class [cmod] C1 [ext C2] {F K M}cmod ::= immutable | funcmmod ::= lstate | funckmod ::= lstatefmod ::= repC ::= . . . class name . . .

F ::= [F ; ]∗

F ::= C [fmod] xK ::= [K ; ]∗

K ::= [kmod] k(args) [throws Exc] {E}args ::= ε | C x | C x , argsExc ::= C | C ,Exc

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 50: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

C ::= cdecl+

cdecl ::= class [cmod] C1 [ext C2] {F K M}

cmod ::= immutable | funcmmod ::= lstate | funckmod ::= lstatefmod ::= repC ::= . . . class name . . .

F ::= [F ; ]∗

F ::= C [fmod] xK ::= [K ; ]∗

K ::= [kmod] k(args) [throws Exc] {E}args ::= ε | C x | C x , argsExc ::= C | C ,Exc

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 51: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

C ::= cdecl+

cdecl ::= class [cmod] C1 [ext C2] {F K M}cmod ::= immutable | funcmmod ::= lstate | funckmod ::= lstatefmod ::= rep

C ::= . . . class name . . .

F ::= [F ; ]∗

F ::= C [fmod] xK ::= [K ; ]∗

K ::= [kmod] k(args) [throws Exc] {E}args ::= ε | C x | C x , argsExc ::= C | C ,Exc

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 52: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

C ::= cdecl+

cdecl ::= class [cmod] C1 [ext C2] {F K M}cmod ::= immutable | funcmmod ::= lstate | funckmod ::= lstatefmod ::= repC ::= . . . class name . . .

F ::= [F ; ]∗

F ::= C [fmod] xK ::= [K ; ]∗

K ::= [kmod] k(args) [throws Exc] {E}args ::= ε | C x | C x , argsExc ::= C | C ,Exc

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 53: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 54: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}

fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 55: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , x

E ::= new C .k(x) |let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 56: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 57: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |

if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 58: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |

x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 59: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |

fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 60: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |

varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 61: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |

throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 62: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |

try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 63: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |

null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 64: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Grammar of JavaFun

M ::= [M; ]∗

M ::= C [mmod] m(args) [throws Exc] {E}fieldref ::= x1.x2 | this.xvarref ::= x | this | fieldrefx ::= ε | x | x , xE ::= new C .k(x) |

let C x = E1 in E2 |if E1 then E2 else E3 |x .m(x) |fieldref = E |varref |throw x |try {E1} catch (C x) {E2} |null

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 65: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Objects

I Objects: (Ident⇀ Loc)× Cnamewhere

I Loc – abstract set of locations,I Ident – possible fields identifiers,

The set of all objects is Obj.

I o.f is π1(o)(f )I and typeof(o) is π2(o).

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 66: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Objects

I Objects: (Ident⇀ Loc)× Cnamewhere

I Loc – abstract set of locations,

I Ident – possible fields identifiers,

The set of all objects is Obj.

I o.f is π1(o)(f )I and typeof(o) is π2(o).

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 67: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Objects

I Objects: (Ident⇀ Loc)× Cnamewhere

I Loc – abstract set of locations,I Ident – possible fields identifiers,

The set of all objects is Obj.

I o.f is π1(o)(f )I and typeof(o) is π2(o).

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 68: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Objects

I Objects: (Ident⇀ Loc)× Cnamewhere

I Loc – abstract set of locations,I Ident – possible fields identifiers,

The set of all objects is Obj.

I o.f is π1(o)(f )I and typeof(o) is π2(o).

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 69: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Objects

I Objects: (Ident⇀ Loc)× Cnamewhere

I Loc – abstract set of locations,I Ident – possible fields identifiers,

The set of all objects is Obj.I o.f is π1(o)(f )

I and typeof(o) is π2(o).

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 70: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Objects

I Objects: (Ident⇀ Loc)× Cnamewhere

I Loc – abstract set of locations,I Ident – possible fields identifiers,

The set of all objects is Obj.I o.f is π1(o)(f )I and typeof(o) is π2(o).

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 71: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Heap

I Heap h : Loc⇀ Obj, which

I is undefined for nullI has finite domain

The set of all heaps is Heap.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 72: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Heap

I Heap h : Loc⇀ Obj, whichI is undefined for null

I has finite domain

The set of all heaps is Heap.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 73: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Heap

I Heap h : Loc⇀ Obj, whichI is undefined for nullI has finite domain

The set of all heaps is Heap.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 74: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

Heap

I Heap h : Loc⇀ Obj, whichI is undefined for nullI has finite domain

The set of all heaps is Heap.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 75: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The reduction relation — contexts

A ::= C | ∅ (labels)

C ::= J KlA | (contexts)new C .k(x1, C, x2) |new C .k(C) |let C x = C in E |if C then E1 else E2 |x .m(x1, C, x2) |x .m(C) |try {C} catch (C x) {E}

Context expressions:

C{JEKlA/J KlA} or C{Jl ′KlA/J KlA},

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 76: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The reduction relation — contexts

A ::= C | ∅ (labels)C ::= J KlA | (contexts)

new C .k(x1, C, x2) |new C .k(C) |let C x = C in E |if C then E1 else E2 |x .m(x1, C, x2) |x .m(C) |try {C} catch (C x) {E}

Context expressions:

C{JEKlA/J KlA} or C{Jl ′KlA/J KlA},

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 77: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The reduction relation — contexts

A ::= C | ∅ (labels)C ::= J KlA | (contexts)

new C .k(x1, C, x2) |new C .k(C) |let C x = C in E |if C then E1 else E2 |x .m(x1, C, x2) |x .m(C) |try {C} catch (C x) {E}

Context expressions:

C{JEKlA/J KlA} or C{Jl ′KlA/J KlA},

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 78: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The reduction relation — contexts

A ::= C | ∅ (labels)C ::= J KlA | (contexts)

new C .k(x1, C, x2) |new C .k(C) |let C x = C in E |if C then E1 else E2 |x .m(x1, C, x2) |x .m(C) |try {C} catch (C x) {E}

Context expressions:

C{JEKlA/J KlA} or C{Jl ′KlA/J KlA},

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 79: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The form of the reduction relation

C , h, C1JE1Kl1A1 :: · · · :: CnJEnKlnAn → h′, C′1JE1K

l ′1A′1:: · · · :: C′

mJEmKl′1A′1

I h — heapI C1JE1K :: · · · :: CnJEnK — frame stack

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 80: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The form of the reduction relation

C , h, C1JE1Kl1A1 :: · · · :: CnJEnKlnAn → h′, C′1JE1K

l ′1A′1:: · · · :: C′

mJEmKl′1A′1

I h — heap

I C1JE1K :: · · · :: CnJEnK — frame stack

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 81: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

The form of the reduction relation

C , h, C1JE1Kl1A1 :: · · · :: CnJEnKlnAn → h′, C′1JE1K

l ′1A′1:: · · · :: C′

mJEmKl′1A′1

I h — heapI C1JE1K :: · · · :: CnJEnK — frame stack

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 82: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

An example of a reduction rule

n ≥ 0 alloc(h) = (l0, h′′) E0 = body(C ,C , k)l1, . . . , ln ∈ Loc

params(C ,C , k) = (y1, . . . , yn) E = E0{l1/y1, . . . , ln/yn}

h′(l) =

{h′′(l) dla l 6= l0emptyC ,C dla l = l0

C , h, C :: CJnew C .k(l1, . . . , ln)Kl∅ →h′, C :: CJnew C .k(l1, . . . , ln)Kl∅ :: JEKl0∅

(newk)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 83: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Syntax of JavaFunSemantics of JavaFun

An example of a reduction rule — a more standard one

n ≥ 0 l ∈ LocC , h, C :: CJnew C .k(l1, . . . , ln)Kl∅ :: JlKl ′∅ → h, C :: CJlKl∅

(newret)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 84: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):

I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:

I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 85: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:

I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 86: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program C

I observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:

I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 87: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:

I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 88: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:

I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 89: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:I rep(l , h) = rep(l , h′) and

I for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 90: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 91: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 92: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Observable contexts

C is observable wrt. l in the heap h for C when:

I it returns from a constructor for l :C0 :: CJnew C .k(l)K∅ :: JlK∅

I it refers to a field of lI it assigns to a field of lI it calls a method on lI it returns from a method in l

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 93: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Observable contexts

C is observable wrt. l in the heap h for C when:I it returns from a constructor for l :C0 :: CJnew C .k(l)K∅ :: JlK∅

I it refers to a field of lI it assigns to a field of lI it calls a method on lI it returns from a method in l

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 94: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Observable contexts

C is observable wrt. l in the heap h for C when:I it returns from a constructor for l :C0 :: CJnew C .k(l)K∅ :: JlK∅

I it refers to a field of l

I it assigns to a field of lI it calls a method on lI it returns from a method in l

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 95: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Observable contexts

C is observable wrt. l in the heap h for C when:I it returns from a constructor for l :C0 :: CJnew C .k(l)K∅ :: JlK∅

I it refers to a field of lI it assigns to a field of l

I it calls a method on lI it returns from a method in l

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 96: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Observable contexts

C is observable wrt. l in the heap h for C when:I it returns from a constructor for l :C0 :: CJnew C .k(l)K∅ :: JlK∅

I it refers to a field of lI it assigns to a field of lI it calls a method on l

I it returns from a method in l

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 97: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Observable contexts

C is observable wrt. l in the heap h for C when:I it returns from a constructor for l :C0 :: CJnew C .k(l)K∅ :: JlK∅

I it refers to a field of lI it assigns to a field of lI it calls a method on lI it returns from a method in l

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 98: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 99: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Immutable objects

Immutability of h(l):I Ingredients:

I heap h, location l ∈ Dom(h), and program CI observable contexts C1, C2 such that

C , h, C1 →∗ h′, C2

I Conditions to be met:I rep(l , h) = rep(l , h′) andI for each l ′ ∈ rep(l , h′) the equality h(l ′) = h′(l ′) holds

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 100: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Representation

Representation of h(l) (denoted rep(l , h)) is a set of locations suchthat:

I l belongs to thatI we follow rep links

if l ′ ∈ rep(l , h) i C = typeof(h(l ′)) and C1 rep f occurs infields(C ,C ), then h(l ′)(f ) ∈ rep(l , h)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 101: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Representation

Representation of h(l) (denoted rep(l , h)) is a set of locations suchthat:

I l belongs to that

I we follow rep links

if l ′ ∈ rep(l , h) i C = typeof(h(l ′)) and C1 rep f occurs infields(C ,C ), then h(l ′)(f ) ∈ rep(l , h)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 102: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Representation

Representation of h(l) (denoted rep(l , h)) is a set of locations suchthat:

I l belongs to thatI we follow rep links

if l ′ ∈ rep(l , h) i C = typeof(h(l ′)) and C1 rep f occurs infields(C ,C ), then h(l ′)(f ) ∈ rep(l , h)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 103: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Equality of immutable objects

h1(l1) is equal to h2(l2) in Cwhen

I both are of the same immutable classI for each field x

I for non-rep fields: h1(l1)(x) = h2(l2)(x),I for rep fields h1(l1)(x)[h1] = h2(l2)(x)[h2]

Notation: l1[h1] =C l2[h2]

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 104: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Equality of immutable objects

h1(l1) is equal to h2(l2) in Cwhen

I both are of the same immutable class

I for each field xI for non-rep fields: h1(l1)(x) = h2(l2)(x),I for rep fields h1(l1)(x)[h1] = h2(l2)(x)[h2]

Notation: l1[h1] =C l2[h2]

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 105: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Equality of immutable objects

h1(l1) is equal to h2(l2) in Cwhen

I both are of the same immutable classI for each field x

I for non-rep fields: h1(l1)(x) = h2(l2)(x),I for rep fields h1(l1)(x)[h1] = h2(l2)(x)[h2]

Notation: l1[h1] =C l2[h2]

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 106: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Equality of immutable objects

h1(l1) is equal to h2(l2) in Cwhen

I both are of the same immutable classI for each field x

I for non-rep fields: h1(l1)(x) = h2(l2)(x),I for rep fields h1(l1)(x)[h1] = h2(l2)(x)[h2]

Notation: l1[h1] =C l2[h2]

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 107: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Functional method

A method is functional when it is

I pure andI extensional.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 108: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Functional method

A method is functional when it isI pure and

I extensional.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 109: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Functional method

A method is functional when it isI pure andI extensional.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 110: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Purity

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is pure, when

I for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 v∅ h2.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 111: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Purity

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is pure, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in h

I each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 v∅ h2.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 112: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Purity

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is pure, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 v∅ h2.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 113: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Purity

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is pure, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 v∅ h2.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 114: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Extensionality

The idea:

I each time a method is called with a given set of argumentsI it returns the same result

Immutability necessary to make comparison possible.Irritating exceptions we think of them as a component of a disjointunion.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 115: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Extensionality

The idea:I each time a method is called with a given set of arguments

I it returns the same result

Immutability necessary to make comparison possible.Irritating exceptions we think of them as a component of a disjointunion.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 116: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Extensionality

The idea:I each time a method is called with a given set of argumentsI it returns the same result

Immutability necessary to make comparison possible.Irritating exceptions we think of them as a component of a disjointunion.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 117: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Extensionality

The idea:I each time a method is called with a given set of argumentsI it returns the same result

Immutability necessary to make comparison possible.

Irritating exceptions we think of them as a component of a disjointunion.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 118: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Extensionality

The idea:I each time a method is called with a given set of argumentsI it returns the same result

Immutability necessary to make comparison possible.Irritating exceptions

we think of them as a component of a disjointunion.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 119: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Extensionality

The idea:I each time a method is called with a given set of argumentsI it returns the same result

Immutability necessary to make comparison possible.Irritating exceptions we think of them as a component of a disjointunion.

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 120: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Local-state

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is local-state, when

I for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 vR h2 whereR = Rep(h1, l , l1, . . . , ln)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 121: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Local-state

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is local-state, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in h

I each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 vR h2 whereR = Rep(h1, l , l1, . . . , ln)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 122: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Local-state

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is local-state, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 vR h2 whereR = Rep(h1, l , l1, . . . , ln)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 123: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Local-state

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is local-state, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 vR h2 where

R = Rep(h1, l , l1, . . . , ln)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 124: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Immutable objectsObservable contextsRepresentationFunctional methodLocal-state method

Local-state

Consider declaration of m in C :

Cn+1[mmod] m(C1 x1, . . . ,Cn xn) [throws Exc] {E},

m is local-state, whenI for all locations l , l1, . . . , ln, l ′ ∈ Loc of appropriate types in hI each sequence of contexts C :: CJK∅ such that

C , h1, C :: CJl .m(l1, . . . , ln)K∅ →(∗) h2, C :: CJl .m(l1, . . . , ln)K∅ :: Jl ′K,

we have h1 vR h2 whereR = Rep(h1, l , l1, . . . , ln)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 125: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Different kinds of rules

I cok rulesI mok rulesI type rules

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 126: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

An example of a typing rule: constructors

C1 ∈ C x : 〈D, τ, nthis〉 ∈ Locxi : 〈Di , τi , nthis〉 ∈ Loc dla i = 1, . . . , kC ; C : cmod; Ex ; Loc ` x .m(x1, . . . , xk) : C1C ; C : func; Ex ; Loc ` x .m(x1, . . . , xk) : cok

(methodfun cok)

C1 ∈ C cmod 6= funcC ; C : cmod; Ex ; Loc ` x .m(x1, . . . , xk) : C1C ; C : cmod; Ex ; Loc ` x .m(x1, . . . , xk) : cok

(methodnfun cok)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 127: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

An example of a typing rule: constructors

C1 ∈ C x : 〈D, τ, nthis〉 ∈ Locxi : 〈Di , τi , nthis〉 ∈ Loc dla i = 1, . . . , kC ; C : cmod; Ex ; Loc ` x .m(x1, . . . , xk) : C1C ; C : func; Ex ; Loc ` x .m(x1, . . . , xk) : cok

(methodfun cok)

C1 ∈ C cmod 6= funcC ; C : cmod; Ex ; Loc ` x .m(x1, . . . , xk) : C1C ; C : cmod; Ex ; Loc ` x .m(x1, . . . , xk) : cok

(methodnfun cok)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 128: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

An example of a typing rule: methods

modifier(C ,D, k) = lstate∀y ∈ x .Loc `local y : local

C ; C : cmod, k : ∅; Ex ; Loc ` new D.k(x) : D

C ; C : cmod,m : func; Ex ; Loc ` new D.k(x) : mok(funcnew mok)

C1,C2 ∈ C x : 〈C1, τ1, τ2〉 ∈ Locmodifier(C ,C1,m′) = func

C ; C : cmod,m : func; Ex ; Loc ` x .m′(x1, . . . , xk) : C2C ; C : cmod,m : func; Ex ; Loc ` x .m′(x1, . . . , xk) : mok

(funcmeth mok)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 129: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

An example of a typing rule: methods

modifier(C ,D, k) = lstate∀y ∈ x .Loc `local y : local

C ; C : cmod, k : ∅; Ex ; Loc ` new D.k(x) : D

C ; C : cmod,m : func; Ex ; Loc ` new D.k(x) : mok(funcnew mok)

C1,C2 ∈ C x : 〈C1, τ1, τ2〉 ∈ Locmodifier(C ,C1,m′) = func

C ; C : cmod,m : func; Ex ; Loc ` x .m′(x1, . . . , xk) : C2C ; C : cmod,m : func; Ex ; Loc ` x .m′(x1, . . . , xk) : mok

(funcmeth mok)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 130: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Soundness proof

I difficult because longI problems with formulation

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 131: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Related work

I “immutability” of objects (e.g. C. Haack, E. Poll, J. Schafer,A. Schubert, Immutable Objects for a Java-like Language,ESOP’2007. (ETAPS BEST PAPER AWARD!)

I “who can modify what” approach UTT (e.g. P. Muller,A. Poetzsch-Heffter Universes: A Type System for Alias andDependency Control, 2001

I “how to write a lambda in Java” (a few)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 132: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Related work

I “immutability” of objects (e.g. C. Haack, E. Poll, J. Schafer,A. Schubert, Immutable Objects for a Java-like Language,ESOP’2007. (ETAPS BEST PAPER AWARD!)

I “who can modify what” approach UTT (e.g. P. Muller,A. Poetzsch-Heffter Universes: A Type System for Alias andDependency Control, 2001

I “how to write a lambda in Java” (a few)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 133: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Related work

I “immutability” of objects (e.g. C. Haack, E. Poll, J. Schafer,A. Schubert, Immutable Objects for a Java-like Language,ESOP’2007. (ETAPS BEST PAPER AWARD!)

I “who can modify what” approach UTT (e.g. P. Muller,A. Poetzsch-Heffter Universes: A Type System for Alias andDependency Control, 2001

I “how to write a lambda in Java” (a few)

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java

Page 134: Functional Java - mimuw.edu.plczarnik/sliwowica/... · Outline Java JavaFun Semantical properties Type system Towards soundness proof Motivations I Problems with applications in Java:

OutlineJava

JavaFunSemantical properties

Type systemTowards soundness proof

Thank you!

Aleksy Schubert and Jacek Chrząszcz Institute of Informatics Warsaw University ul. Banacha 2 02–097 Warsaw PolandFunctional Java