Lecture 9: Lazy PCF
Teacher: Thomas Ehrhard
Lecture 9
ehrhard at irif.fr www.irif.fr/~ehrhard
Connection between syntax and semantics:
- Programming language ⟶ a version of Plotkin’s PCF with lazy integers
- What is a model of linear logic?
- Scott model of LL
- Adequacy theorem
Denotational semantics
1969 - Dana Scott (Logician), Christopher Stratchey (Computer scientist) met in Oxford
Christopher Stratchey wondered what is the meaning of a program, independently on the programming language. He had equations on datatypes, but no solution in
When Dana Scott met him, he has the idea of interpreting types as complete lattices and programs as continuous functions
Logicians Curry-Howard: Programs ⟺ Proofs
Jean-Yves Girard: denotational interpretation of System F ⟶ Coherence Spaces
PCF (Programming language with Computable Functions): abstract programming language to study the relation between syntax and semantics.
- PCF:
-
- simply typed
-calculus - with a ground type for integers (booleans encoded as integers)
- basic functions (
, conditional) - fixpoint constructions ⟶ full recursion
- simply typed
NB: PCF is a Turing-complete language
LPCF (Lazy PCF)
Syntax
- Types:
-
- Terms:
-
Typing rules
Typing context
Typing judgement
Rules:
Example: define addition:
add(x, 0) = x
add(x, S(y)) = S(add(x,y))
i.e, for a given
add_x(0) = x
add_x(S(y)) = S(add_x(y))
-reduction
Rewriting relation on terms:
And then, it goes through context:
etc…
Why “lazy”?
Let
It’s a fully undefined term. But
is such that
Whereas in ordinary PCF, you have a term
So that:
And in ordinary PCF:
Whereas in LPCF,
Subject Reduction
Th (Subject reduction): If
and , then
Lemma (Substitution lemma): if
and , then
Notation: we denote by
Th (Confluence): If
and , then there exists s.t.
NB: Local confluence:
+ Strong normalization is enough (modulo Neumann’s lemma) to have confluence
But if you don’t have strong normalization, then local confluence is not enough, as shown by this example:
Th: If
But we don’t have the diamond property (cf. picture)
Parallel reductions: Tait/Martin-Löf’s method
Idea: Introduce a rewriting relation
(which implies:
which satisfies:
where
Ex:
Definition of
BUT NOT:
Lemma 1:
Lemma 2:
and , then
Proof: by induction on the derivation
Th: If
for , there exists such that for .
Proof: By induction on the max of the sizes of the deduction trees of
-
Assume
there are the following possibilities:
-
By IH, there is
such thatThen
-
(cf. picture)
-
Lemma: if
and then
Induction on the derivation of
cf. picture
LPCF
- Weak head reduction
: -
it’s a reduction strategy
Any term contains at most one redex for this reduction.
Rules for
Forbidden: reduce
,
Th (Completeness of
): Assume
Model of LL
What is a model of LL? A symmetric monoidal category
which is closed
such that
such that
commutes.
On top of that: we have a dualizing object
for all
:-
linear negation
We have a functor:
Moreover,
where
We have a functor:
such that
On top of that, we’d like to state that
So we introduce:
+ monoidality diagrams:
cf. pictures
Derived structures
Weakening and contraction
comes from the fact that
Leave a comment