Programming Computable Functions

From HandWiki
Revision as of 21:27, 6 March 2023 by LinXED (talk | contribs) (correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: A typed functional language

In computer science, Programming Computable Functions (PCF) is a typed functional language introduced by Gordon Plotkin in 1977,[1] based on previous unpublished material by Dana Scott.[note 1] It can be considered to be an extended version of the typed lambda calculus or a simplified version of modern typed functional languages such as ML or Haskell.

A fully abstract model for PCF was first given by Robin Milner.[2] However, since Milner's model was essentially based on the syntax of PCF it was considered less than satisfactory.[3] The first two fully abstract models not employing syntax were formulated during the 1990s. These models are based on game semantics[4][5] and Kripke logical relations.[6] 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.[7]

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]\displaystyle{ \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]\displaystyle{ [\![ \textbf{nat} ]\!] := \mathbb{N}_{\bot} }[/math] (the natural numbers with a bottom element adjoined, with the flat ordering)
    • [math]\displaystyle{ [\![ \sigma \to \tau \, ]\!] }[/math] is interpreted as the domain of Scott-continuous functions from [math]\displaystyle{ [\![\sigma]\!] \, }[/math] to [math]\displaystyle{ [\![\tau]\!] \, }[/math], with the pointwise ordering.
  • A context [math]\displaystyle{ x_1 : \sigma_1, \; \dots, \; x_n : \sigma_n }[/math] is interpreted as the product [math]\displaystyle{ [\![\sigma_1]\!] \times \; \dots \; \times [\![\sigma_n]\!] }[/math]
  • Terms in context [math]\displaystyle{ \Gamma \; \vdash \; x \; : \; \sigma }[/math] are interpreted as continuous functions [math]\displaystyle{ [\![\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.[4]:293

Notes

  1. Cite error: Invalid <ref> tag; no text was provided for refs named {{{1}}}

References

  1. Plotkin, Gordon D. (1977). "LCF considered as a programming language". Theoretical Computer Science 5 (3): 223–255. doi:10.1016/0304-3975(77)90044-5. http://homepages.inf.ed.ac.uk/gdp/publications/LCF.pdf. 
  2. Milner, Robin (1977). "Fully abstract models of typed λ-calculi". Theoretical Computer Science 4: 1–22. doi:10.1016/0304-3975(77)90053-6. https://www.pure.ed.ac.uk/ws/files/15112912/1_s2.0_0304397577900536_main.pdf. 
  3. Ong, C.-H. L. (1995). "Correspondence between Operational and Denotational Semantics: The Full Abstraction Problem for PCF". in Abramsky, S.. Handbook of Logic in Computer Science. Oxford University Press. pp. 269–356. http://users.comlab.ox.ac.uk/luke.ong/publications/index.html. Retrieved 2006-01-19. 
  4. 4.0 4.1 Hyland, J. M. E.; Ong, C.-H. L. (2000). "On Full Abstraction for PCF". Information and Computation 163 (2): 285–408. doi:10.1006/inco.2000.2917. https://ora.ox.ac.uk/objects/uuid:63c54392-39f3-46f1-8a68-e6ff0ec90218. 
  5. Abramsky, S., Jagadeesan, R., and Malacaria, P. (2000). "Full Abstraction for PCF". Information and Computation 163 (2): 409–470. doi:10.1006/inco.2000.2930. http://qmro.qmul.ac.uk/xmlui/handle/123456789/13604. 
  6. O'Hearn, P. W.; Riecke, J. G (1995). "Kripke Logical Relations and PCF". Information and Computation 120 (1): 107–116. doi:10.1006/inco.1995.1103. https://surface.syr.edu/lcsmith_other/3. 
  7. Loader, R. (2001). "Finitary PCF is not decidable". Theoretical Computer Science 266 (1–2): 341–364. doi:10.1016/S0304-3975(00)00194-8. 

External links