Jump to content

Programming Computable Functions: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
fix note
WP:LEADSENTENCE MOS:BOLDSYNonym: adds, clarify. Small WP:COPYEDITs WP:EoS: clarify, WP:TERSE. WP:LINKs: adds, needless WP:PIPEs > WP:NOPIPEs, update-standardizes, WP:RED delink until article exists. WP:REFerence WP:CITation parameters: respaces, cut whitespace characters to standardize, aid work via small screens, update-standardize-conform, reorders, adds, fills. Adds: MOS:COMMENT, WP:CATEGORY.
Line 1: Line 1:
{{Short description|A typed functional language}}
{{Short description|A typed functional language}}
In [[computer science]], '''Programming Computable Functions''' (PCF) is a [[type system|typed]] [[Functional programming|functional language]] introduced by [[Gordon Plotkin]] in 1977,<ref name="Plotkin 1977" /> based on previous 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 is also referred to as ''Programming with Computable Functions'' or ''Programming language for Computable Functions''.}} 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 programming language|ML]] or [[Haskell (programming language)|Haskell]].
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 Milner]].<ref name="Milner 1977" /> However, since Milner's model was essentially based on the syntax of PCF it was considered less than satisfactory.<ref name="Ong 1995" /> The first two fully abstract models not employing syntax were formulated during the 1990s. These models are based on [[game semantics]]<ref name="Hyland 2000" /><ref name="Abramsky 2000" /> and [[Kripke logical relations]].<ref name="O'Hearn 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.<ref name="Loader 2001" />
A [[fully abstract]] model for PCF was first given by [[Robin Milner]].<ref name="Milner 1977"/> However, since Milner's model was essentially based on the syntax of PCF it was considered less than satisfactory.<ref name="Ong 1995"/> The first two fully abstract models not employing syntax were formulated during the 1990s. These models are based on [[game semantics]]<ref name="Hyland 2000"/><ref name="Abramsky 2000"/> and Kripke logical relations.<ref name="O'Hearn 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.<ref name="Loader 2001"/>


==Syntax==
==Syntax==
Line 46: Line 46:
** '''Y''' is interpreted by taking the [[least fixed point]] of the argument
** '''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}}
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}}


== Notes ==
== Notes ==
{{notelist}}
{{Notelist}}


== References ==
== References ==
{{reflist|refs=
{{Reflist|refs=
<ref name="Plotkin 1977">{{cite journal
<ref name="Plotkin 1977">{{cite journal
|last1=Plotkin
| first = Gordon D.
|first1=Gordon D.
| last = Plotkin
| authorlink = Gordon Plotkin
|author1-link=Gordon Plotkin
|year=1977
| title = LCF considered as a programming language
|title=LCF considered as a programming language
| journal = Theoretical Computer Science
|journal=Theoretical Computer Science
| year = 1977
|volume=5
| pages = 223–255
|issue=3
| volume = 5
|pages=223–255
| issue = 3
| doi = 10.1016/0304-3975(77)90044-5
|doi=10.1016/0304-3975(77)90044-5
| url = http://homepages.inf.ed.ac.uk/gdp/publications/LCF.pdf
|url=http://homepages.inf.ed.ac.uk/gdp/publications/LCF.pdf
| doi-access = free
|doi-access=free
}}</ref>
}}</ref>
<ref name="Milner 1977">{{cite journal
<ref name="Milner 1977">{{cite journal
|last1=Milner
| first = Robin
|first1=Robin
| last = Milner
| authorlink = Robin Milner
|author1-link=Robin Milner
|year=1977
| title = Fully abstract models of typed λ-calculi
|title=Fully abstract models of typed λ-calculi
| journal = Theoretical Computer Science
|journal=Theoretical Computer Science
| year = 1977
|volume=4
| pages = 1–22
|pages=1–22
| volume = 4
| doi = 10.1016/0304-3975(77)90053-6| url = https://www.pure.ed.ac.uk/ws/files/15112912/1_s2.0_0304397577900536_main.pdf
|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=20.500.11820/731c88c6-cdb1-4ea0-945e-f39d85de11f1
| hdl-access = free
|hdl-access=free
}}</ref>
}}</ref>
<ref name="Ong 1995">{{cite book
<ref name="Ong 1995">{{cite book
|author = Ong, C.-H. L.
|last1=Ong |first1=C.-H. L.
|year = 1995
|year=1995
|title = Handbook of Logic in Computer Science
|title=Handbook of Logic in Computer Science
|chapter = Correspondence between Operational and Denotational Semantics: The Full Abstraction Problem for PCF
|chapter=Correspondence between Operational and Denotational Semantics: The Full Abstraction Problem for PCF
|editor = Abramsky, S.
|editor1-last=Abramsky |editor1-first=S.
|editor2 = Gabbay, D.
|editor2-last=Gabbay |editor2-first=D.
|editor3 = Maibau, T. S. E.
|editor3-last=Maibau |editor3-first=T. S. E.
|pages = 269–356
|pages=269–356
|publisher = Oxford University Press
|publisher=Oxford University Press
|chapter-url = http://users.comlab.ox.ac.uk/luke.ong/publications/index.html
|chapter-url=http://users.comlab.ox.ac.uk/luke.ong/publications/
|access-date = 2006-01-19
|access-date=2006-01-19
|archive-url = https://web.archive.org/web/20060107195328/http://users.comlab.ox.ac.uk/luke.ong/publications/index.html
|archive-url=https://web.archive.org/web/20060107195328/http://users.comlab.ox.ac.uk/luke.ong/publications/
|archive-date = 2006-01-07
|archive-date=2006-01-07
|url-status = dead
|url-status=dead
}}</ref>
}}</ref>
<ref name="Hyland 2000">{{cite journal
<ref name="Hyland 2000">{{cite journal
|author1=Hyland, J. M. E. |author2=Ong, C.-H. L.
|last1=Hyland |first1=J. M. E. |last2=Ong |first2=C.-H. L.
|year=2000
|name-list-style=amp | title = On Full Abstraction for PCF
|title=On Full Abstraction for PCF
| journal = Information and Computation
|journal=Information and Computation
| year= 2000
|volume=163
| pages = 285–408
|issue=2
| volume = 163
|pages=285–408
| issue = 2
| doi = 10.1006/inco.2000.2917|url=https://ora.ox.ac.uk/objects/uuid:63c54392-39f3-46f1-8a68-e6ff0ec90218
|doi=10.1006/inco.2000.2917|url=https://ora.ox.ac.uk/objects/uuid:63c54392-39f3-46f1-8a68-e6ff0ec90218
| doi-access = free
|doi-access=free
}}</ref>
}}</ref>
<ref name="Abramsky 2000">{{cite journal
<ref name="Abramsky 2000">{{cite journal
| author = Abramsky, S., Jagadeesan, R., and Malacaria, P.
|last1=Abramsky |first1=S. |last2=Jagadeesan |first2=R. |last3=Malacaria |first3=P.
|year=2000
| title = Full Abstraction for PCF
|title=Full Abstraction for PCF
| journal = Information and Computation
|journal=Information and Computation
| year= 2000
|volume=163
| pages = 409–470
|issue=2
| volume = 163
|pages=409–470
| issue = 2
| doi = 10.1006/inco.2000.2930| url = http://qmro.qmul.ac.uk/xmlui/handle/123456789/13604
|doi=10.1006/inco.2000.2930 |url=http://qmro.qmul.ac.uk/xmlui/handle/123456789/13604
| doi-access = free
|doi-access=free
}}</ref>
}}</ref>
<ref name="O'Hearn 1995">{{cite journal
<ref name="O'Hearn 1995">{{cite journal
|author1=O'Hearn, P. W. |author2=Riecke, J. G
|last1=O'Hearn |first1=P. W. |last2=Riecke |first2=J. G.
|year=1995
|name-list-style=amp | title = Kripke Logical Relations and PCF
|title=Kripke Logical Relations and PCF
| journal = Information and Computation
|journal=Information and Computation
| year = 1995
|volume=120
| pages = 107–116
|issue=1
| volume = 120
|pages=107–116
| issue = 1
| doi = 10.1006/inco.1995.1103|url=https://surface.syr.edu/lcsmith_other/3
|doi=10.1006/inco.1995.1103 |url=https://surface.syr.edu/lcsmith_other/3
| doi-access = free
|doi-access=free
}}</ref>
}}</ref>
<ref name="Loader 2001">{{cite journal
<ref name="Loader 2001">{{cite journal
| author = Loader, R.
|last1=Loader |first1=R.
|year=2001
| title = Finitary PCF is not decidable
|title=Finitary PCF is not decidable
| journal = Theoretical Computer Science
|journal=Theoretical Computer Science
| year= 2001
|volume=266
| pages = 341–364
|issue=1–2
| volume = 266
|pages=341–364
| issue = 1–2
| doi = 10.1016/S0304-3975(00)00194-8| doi-access = free
|doi=10.1016/S0304-3975(00)00194-8 |doi-access=free
}}</ref>
}}</ref>
}}
}}


*{{ cite journal
*{{cite journal
|last1=Scott
| first = Dana S.
|first1=Dana S.
| last = Scott
| authorlink = Dana Scott
|author1-link=Dana Scott
|year=1969
| title = A type-theoretic alternative to CUCH, ISWIM, OWHY
|title=A type-theoretic alternative to CUCH, ISWIM, OWHY
| journal = Unpublished Manuscript
|journal=Unpublished Manuscript
| url = https://www.cs.cmu.edu/~kw/scans/scott93tcs.pdf
|url=https://www.cs.cmu.edu/~kw/scans/scott93tcs.pdf
| year = 1969
}} Appeared as {{cite journal | first = Dana S. | last = Scott | authorlink = Dana Scott | title = A type-theoretic alternative to CUCH, ISWIM, OWHY| journal = [[Theoretical Computer Science (journal)|Theoretical Computer Science]] | volume=121 | pages = 411&ndash;440 | year = 1993 | doi=10.1016/0304-3975(93)90095-b | doi-access = free }}
}} 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
*{{cite book
|last1=Mitchell
| first = John C.
|first1=John C.
| last = Mitchell
| authorlink = John C. Mitchell
|author1-link=John C. Mitchell
|year=1996
| title = Foundations for Programming Languages
|title=Foundations for Programming Languages
| year = 1996
| isbn = 9780262133210
|isbn=9780262133210
| chapter = The Language PCF
|chapter=The Language PCF
| publisher = MIT Press
|publisher=MIT Press
| chapter-url = https://theory.stanford.edu/~jcm/books/fpl-chap2.ps
|chapter-url=https://theory.stanford.edu/~jcm/books/fpl-chap2.ps
}}
}}


==External links==
==External links==
Line 171: Line 171:
[[Category:Functional languages]]
[[Category:Functional languages]]
[[Category:Programming language theory]]
[[Category:Programming language theory]]
<!-- Hidden categories below -->
[[Category:Articles with example code]]

Revision as of 08:14, 21 April 2025

In computer science, Programming Computable Functions (PCF), or Programming with Computable Functions, or Programming language for Computable Functions, is a programming language which is typed and based on functional programming, introduced by Gordon Plotkin in 1977,[1] based on prior unpublished material by Dana Scott.[a] 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 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:
(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 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. ^ "PCF is a programming language for computable functions, based on LCF, Scott’s logic of computable functions."[1] Programming Computable Functions is used by (Mitchell 1996).

References

  1. ^ a b Plotkin, Gordon D. (1977). "LCF considered as a programming language" (PDF). Theoretical Computer Science. 5 (3): 223–255. doi:10.1016/0304-3975(77)90044-5.
  2. ^ Milner, Robin (1977). "Fully abstract models of typed λ-calculi" (PDF). Theoretical Computer Science. 4: 1–22. doi:10.1016/0304-3975(77)90053-6. hdl:20.500.11820/731c88c6-cdb1-4ea0-945e-f39d85de11f1.
  3. ^ Ong, C.-H. L. (1995). "Correspondence between Operational and Denotational Semantics: The Full Abstraction Problem for PCF". In Abramsky, S.; Gabbay, D.; Maibau, T. S. E. (eds.). Handbook of Logic in Computer Science. Oxford University Press. pp. 269–356. Archived from the original on 2006-01-07. Retrieved 2006-01-19.
  4. ^ a b 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.
  5. ^ Abramsky, S.; Jagadeesan, R.; Malacaria, P. (2000). "Full Abstraction for PCF". Information and Computation. 163 (2): 409–470. doi:10.1006/inco.2000.2930.
  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.
  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.