Roadmap to Atsushi Ohori’s “ A Simple Semantics for ML Polymorphism ”

Post on 18-Mar-2016

20 views 0 download

Tags:

description

Roadmap to Atsushi Ohori’s “ A Simple Semantics for ML Polymorphism ”. Bill Harrison. ML polymorphism. Can apply polymorphic term for any type a. Know what it denotes at any instance…. …from the semantics of simply-typed - calculus. Ohori’s idea: simple semantics. - PowerPoint PPT Presentation

Transcript of Roadmap to Atsushi Ohori’s “ A Simple Semantics for ML Polymorphism ”

Roadmap to Atsushi Ohori’s“A Simple Semantics for ML Polymorphism”

Bill Harrison

ML polymorphism

Know what it denotes at any instance…

…from the semantics of simply-typed -calculus

Can apply polymorphic term for any type a

Ohori’s idea: simple semantics

…extend it to ML-like languages

Starting from the semantics of STLC:

from simply-typed -calculus semantics

Simple vs ? An alternative [DamasMilner82] is to model

type quantifiers with type abstraction as in System F [Girard,Reynolds]

However, this has drawbacks as the denotational semantics of System F is, well, hairy [GirardLafontTaylor]

Overview of Ohori’s approach

Semantics of Core-ML

Semantics ofGround Core-ML

SemanticsSimply-typed

T

…and define Core-ML in terms of T

Introduce two languages• Core-ML: polymorphic, implicitly-typed -calculus• T: simply & explicitly-typed -calculus with “textbook” denotational semantics

Today Core-ML: syntactic matters T: its syntax & semantics

In terms of frame models Relating Core-ML to T “Roadmap’’ handout contains the technical

minutiae of the paper Laid out in a more logical manner

Ohori’s paper is rich with material I won’t discuss today: Comparisons with [Milner78,DamasMilner82], full

abstraction, extensions to recursive terms & datatypes

Core-ML typesTypes & Type Schemes

Type assignments

Type assignment schemes

Substitutions

Core-ML terms

Raw terms

Typingsany ground judgment derivable in:

Core-ML terms are typing schemes

T terms

Preterms

Type system

Note the different “”

explicit

typing

Background: Frame Models

Denotational semantics of T

This is a completely conventional, “textbook” semantics

Relating Core-ML to T

Translation from Core-ML typings to T

* Consequence of Theorem 6, Section 3.2, of Ohori89

…with the following coherence property:

Just two more auxiliary definitions (I promise)

The set of admissible type assignments under is

The set of types associated with a term is:

N.b.,

E.g.,

Denotational Semantics of Core-ML

Terms:

Typings:

Relevance to Haskell98 (?!)

where

Conclusions Simple & intuitive: make a polymorphic

term denote the set of its ground instance denotations

Avoids the pitfalls of “backwards” explanations: ML polymorphism is simpler than System F, so its semantics should be simpler