Content deleted Content added
m Robot: Removing selflinks |
→Syntax: function type |
||
(68 intermediate revisions by 43 users not shown) | |||
Line 1:
{{Short description|A typed functional language}}
{{Infobox programming language
| name = Programming Computable Functions
| screenshot = <!-- Filename -->
| screenshot caption =
| sampleCode =
| paradigm = [[Functional programming|functional]]
| family =
| designers = [[Dana Scott]],<br/>[[Robin Milner]],<br/>[[Gordon Plotkin]]
| released = {{Start date and age|1977|12}}
| latest release version = Full Abstraction
| latest release date = {{Start date and age|2000|12|15|df=yes}}
| typing =
| memory management =
| scope =
| programming language =
| discontinued = Yes
| platform =
| operating system =
| license =
| file ext =
| file format = <!-- or: | file formats = -->
| website = <!-- {{URL|www.example.com}} -->
| implementations =
| dialects =
| influenced by =
| influenced =
}}
In [[computer science]], '''Programming Computable Functions''' ('''PCF'''), or '''Programming with Computable Functions''', or '''Programming language for Computable Functions''', is a [[programming language]] which is [[Type system|typed]] and based on [[functional programming]], introduced by [[Gordon Plotkin]] in 1977,<ref name="Plotkin 1977"/> based on prior unpublished material by [[Dana Scott]].{{Efn|"PCF is a programming language for computable functions, based on LCF, Scott’s logic of computable functions."{{r|name=Plotkin 1977}} ''Programming Computable Functions'' is used by {{harv|Mitchell|1996}}.}} It can be considered as an extended version of the [[typed lambda calculus]], or a simplified version of modern typed functional languages such as [[ML (programming language)|ML]] or [[Haskell]].
A [[fully abstract]] model for PCF was first given by [[Robin
==
The ''[[data type]]s'' of PCF are inductively defined as
* '''nat''' is a type
* For types ''σ'' and ''τ'', there is a function 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 '''[[Fixed-point combinator#Y combinator|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>
: ('''nat'''s will be interpreted as booleans here with a convention like zero denoting truth, and any other number denoting falsity)
==Semantics==
<!-- todo: operational semantics -->
===Denotational semantics===
A relatively straightforward semantics for the language is the '''Scott model'''. In this model,
* Types are interpreted as certain [[___domain theory|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>, with the pointwise ordering.
* 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.<ref name="Hyland 2000"/>{{rp|293}}
{{Notelist}}
== References ==
{{Reflist|refs=
<ref name="Plotkin 1977">{{cite journal
|last1=Plotkin
|first1=Gordon D.
|author1-link=Gordon Plotkin
|date=December 1977
|title=LCF considered as a programming language
|journal=Theoretical Computer Science
|volume=5
|issue=3
|pages=223–255
|doi=10.1016/0304-3975(77)90044-5
|url=http://homepages.inf.ed.ac.uk/gdp/publications/LCF.pdf
|doi-access=free
}}</ref>
<ref name="Milner 1977">{{cite journal
|last1=Milner
|first1=Robin
|author1-link=Robin Milner
|date=February 1977
|title=Fully abstract models of typed λ-calculi
|journal=Theoretical Computer Science
|volume=4
|issue=1
|pages=1–22
|doi=10.1016/0304-3975(77)90053-6 |url=https://www.pure.ed.ac.uk/ws/files/15112912/1_s2.0_0304397577900536_main.pdf
|hdl=20.500.11820/731c88c6-cdb1-4ea0-945e-f39d85de11f1
|hdl-access=free
}}</ref>
<ref name="Ong 1995">{{cite book
|last1=Ong |first1=C.-H. L.
|year=1995
|title=Handbook of Logic in Computer Science
|chapter=Correspondence between Operational and Denotational Semantics: The Full Abstraction Problem for PCF
|editor1-last=Abramsky |editor1-first=S.
|editor2-last=Gabbay |editor2-first=D.
|editor3-last=Maibau |editor3-first=T. S. E.
|pages=269–356
|publisher=Oxford University Press
|chapter-url=http://users.comlab.ox.ac.uk/luke.ong/publications/
|access-date=2006-01-19
|archive-url=https://web.archive.org/web/20060107195328/http://users.comlab.ox.ac.uk/luke.ong/publications/
|archive-date=2006-01-07
|url-status=dead
}}</ref>
<ref name="Hyland 2000">{{cite journal
|last1=Hyland |first1=J. M. E. |last2=Ong |first2=C.-H. L.
|date=15 December 2000
|title=On Full Abstraction for PCF
|journal=Information and Computation
|volume=163
|issue=2
|pages=285–408
|doi=10.1006/inco.2000.2917|url=https://ora.ox.ac.uk/objects/uuid:63c54392-39f3-46f1-8a68-e6ff0ec90218
|doi-access=free
}}</ref>
<ref name="Abramsky 2000">{{cite journal
|last1=Abramsky |first1=S. |last2=Jagadeesan |first2=R. |last3=Malacaria |first3=P.
|date=15 December 2000
|title=Full Abstraction for PCF
|journal=Information and Computation
|volume=163
|issue=2
|pages=409–470
|doi=10.1006/inco.2000.2930 |url=http://qmro.qmul.ac.uk/xmlui/handle/123456789/13604
|doi-access=free
}}</ref>
<ref name="O'Hearn 1995">{{cite journal
|last1=O'Hearn |first1=P. W. |last2=Riecke |first2=J. G.
|year=1995
|title=Kripke Logical Relations and PCF
|journal=Information and Computation
|volume=120
|issue=1
|pages=107–116
|doi=10.1006/inco.1995.1103 |url=https://surface.syr.edu/lcsmith_other/3
|doi-access=free
}}</ref>
<ref name="Loader 2001">{{cite journal
|last1=Loader |first1=R.
|year=2001
|title=Finitary PCF is not decidable
|journal=Theoretical Computer Science
|volume=266
|issue=1–2
|pages=341–364
|doi=10.1016/S0304-3975(00)00194-8 |doi-access=free
}}</ref>
}}
*{{cite journal
|last1=Scott
|first1=Dana S.
|author1-link=Dana Scott
|year=1969
|title=A type-theoretic alternative to CUCH, ISWIM, OWHY
|journal=Unpublished Manuscript
|url=https://www.cs.cmu.edu/~kw/scans/scott93tcs.pdf
}} Appeared as {{cite journal |last1=Scott |first1=Dana S. |author1-link=Dana Scott |year=1993 |title=A type-theoretic alternative to CUCH, ISWIM, OWHY |journal=[[Theoretical Computer Science (journal)|Theoretical Computer Science]] |volume=121 |pages=411–440 |doi=10.1016/0304-3975(93)90095-b |doi-access=free}}
*{{cite book
|last1=Mitchell
|first1=John C.
|author1-link=John C. Mitchell
|year=1996
|title=Foundations for Programming Languages
|isbn=9780262133210
|chapter=The Language PCF
|publisher=MIT Press
|chapter-url=https://theory.stanford.edu/~jcm/books/fpl-chap2.ps
}}
==External links==
* [http://www.cs.bham.ac.uk/~mhe/papers/RNC3.pdf Introduction to RealPCF]
* [https://web.archive.org/web/20071213234103/http://www.cs.pomona.edu/classes/cs131/Parsers/parsePCF.sml Lexer and Parser for PCF written in SML]
[[Category:Programming languages created in 1977]]
[[Category:Academic programming languages]]
[[Category:Educational programming languages]]
[[Category:Functional languages]]
[[Category:Programming language theory]]
<!-- Hidden categories below -->
[[Category:Articles with example code]]
|