Programming language for Computable Functions

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search

The Programming language for Computable Functions, or PCF, is a typed functional language introduced by Gordon Plotkin in 1977. It is based on the Logic of Computable Functions (LCF) by Dana Scott. It can be considered as a simplified version of modern typed functional languages such as ML.

A fully abstract model for PCF was first given by Milner (1977). However, since Milner's model was essentially based on the syntax of PCF it was considered less than satisfactory (Ong, 1995). The first two fully abstract models not employing syntax were formulated during the 1990s. These models are based on game semantics (Hyland and Ong, 2000; Abramsky, Jagadeesan, and Malacaria, 2000) and Kripke logical relations (O'Hearn and Riecke, 1995). 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.

Contents

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:
<math>

\frac{ \Gamma \; \vdash \; t \; : \textbf{nat} , \quad \quad \Gamma \; \vdash \; s_0 \; : \sigma , \quad \quad \Gamma \; \vdash \; s_1 \; : \sigma } { \Gamma \; \vdash \; \textbf{if}(t,s_0,s_1) \; : \sigma } </math>

(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.
    • <math>[[ \textbf{nat} ]] := \mathbb{N}_{\bot}</math> (the natural numbers with a bottom element adjoined, with the flat ordering)
    • <math> \sigma \to \tau \, </math> is interpreted as the domain of Scott-continuous functions from <math>\sigma \,</math> to <math>\tau \,</math>
  • A context <math>x_1 : \sigma_1, \; \dots, \; x_n : \sigma_n</math> is interpreted as the product <math>\sigma_1 \times \; \dots \; \times \sigma_n</math>
  • Terms in context <math>\Gamma \; \vdash \; x \; : \; \sigma</math> are interpreted as continuous functions <math>\Gamma \; \to \; \sigma</math>
    • Variable terms are interpreted as projections
    • Lambda abstraction and application are interpreted by making use of the cartesian closed 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 (p. 293 in the Hyland and Ong 2000 reference below).


External links

Sources

Personal tools

Served in 0.285 secs.