In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, Programming Computable Functions (PCF) is a
typed functional language
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
introduced by
Gordon Plotkin in 1977,
based on previous unpublished material by
Dana Scott. It can be considered to be an extended version of the
typed lambda calculus
A typed lambda calculus is a typed formalism (mathematics), formalism that uses the lambda-symbol (\lambda) to denote anonymous function abstraction. In this context, types are usually objects of a syntactic nature that are assigned to lambda term ...
or a simplified version of modern typed functional languages such as
ML or
Haskell.
A
fully abstract
In computer science, denotational semantics (initially known as mathematical semantics or Scott–Strachey semantics) is an approach of formalizing the meanings of programming languages by constructing mathematical objects (called ''denotations'' ...
model for PCF was first given by
Robin Milner.
However, since Milner's model was essentially based on the syntax of PCF it was considered less than satisfactory.
The first two fully abstract models not employing syntax were formulated during the 1990s. These models are based on
game semantics and
Kripke logical relations.
For a time it was felt that neither of these models was completely satisfactory, since they were not effectively presentable. However,
Ralph Loader demonstrated that no effectively presentable fully abstract model could exist, since the question of program equivalence in the finitary fragment of PCF is not decidable.
Syntax
The ''types'' of PCF are inductively defined as
* nat is a type
* For types ''σ'' and ''τ'', there is a type ''σ'' → ''τ''
A ''context'' is a list of pairs ''x : σ'', where ''x'' is a variable name and ''σ'' is a type, such that no variable name is duplicated. One then defines typing judgments of terms-in-context in the usual way for the following syntactical constructs:
* Variables (if ''x : σ'' is part of a context ''Γ'', then ''Γ'' ⊢ ''x'' : ''σ'')
* Application (of a term of type ''σ'' → ''τ'' to a term of type ''σ'')
*
λ-abstraction
* The
Y fixed point combinator (making terms of type ''σ'' out of terms of type ''σ'' → ''σ'')
* The successor (succ) and predecessor (pred) operations on nat and the constant 0
* The conditional if with the typing rule:
:
: (nats will be interpreted as booleans here with a convention like zero denoting truth, and any other number denoting falsity)
Semantics
Denotational semantics
A relatively straightforward semantics for the language is the Scott model. In this model,
* Types are interpreted as certain
domains.
**
(the natural numbers with a bottom element adjoined, with the flat ordering)
**
is interpreted as the domain of Scott-continuous functions from
to
, with the pointwise ordering.
* A context
is interpreted as the product
* Terms in context
are interpreted as continuous functions
** Variable terms are interpreted as projections
** Lambda abstraction and application are interpreted by making use of the
cartesian closed
In category theory, a category is Cartesian closed if, roughly speaking, any morphism defined on a product of two objects can be naturally identified with a morphism defined on one of the factors. These categories are particularly important in math ...
structure of the category of domains and continuous functions
** Y is interpreted by taking the
least fixed point of the argument
This model is not fully abstract for PCF; but it is fully abstract for the language obtained by adding a ''
parallel or'' operator to PCF.
Notes
References
* Appeared as
*{{cite book
, first = John C.
, last = Mitchell
, authorlink = John C. Mitchell
, title = Foundations for Programming Languages
, year = 1996
, isbn = 9780262133210
, chapter = The Language PCF
, chapter-url = https://theory.stanford.edu/~jcm/books/fpl-chap2.ps
External links
Introduction to RealPCFLexer and Parser for PCF written in SML
Programming languages created in 1977
Academic programming languages
Educational programming languages
Functional languages
Programming language theory