Content deleted Content added
m Open access bot: url-access updated in citation with #oabot. |
|||
(9 intermediate revisions by 7 users not shown) | |||
Line 2:
{{About|referential transparency in programming language theory|its use in linguistics and philosophy|Opaque context}}
In [[analytic philosophy]] and [[computer science]], '''referential transparency''' and '''referential opacity''' are properties of linguistic constructions
Referential transparency, in programming languages, depends on
The importance of
== History ==
The concept originated in [[Alfred North Whitehead]] and [[Bertrand Russell]]'s ''[[Principia Mathematica]]'' (1910–1913):<ref name="whitehead1927" />
<blockquote>
A proposition as the vehicle
Of course it is possible to make statements about the particular fact “Socrates is Greek.” We may say how many centimetres long it is; we may say it is black; and so on. But these are not the statements that a philosopher or logician is tempted to make.
Line 33:
== Formal definitions ==
There are three fundamental properties concerning substitutivity in formal languages: referential transparency, definiteness, and unfoldability.<ref name="sondergaard1990">{{cite journal |last1=Søndergaard |first1=Harald |last2=Sestoft |first2=Peter |date=1990 |title=Referential Transparency, Definiteness and Unfoldability |url=http://www.itu.dk/people/sestoft/papers/SondergaardSestoft1990.pdf |journal=Acta Informatica |volume=27 |issue=6 |pages=
Let’s denote syntactic equivalence with ≡ and semantic equivalence with =.
Line 40:
A ''position'' is defined by a sequence of natural numbers. The empty sequence is denoted by ε and the sequence constructor by ‘.’.
''Example.'' — Position 2.1 in the expression {{math|(+ (
Expression {{mvar|e}} ''with'' expression {{mvar|e′}} ''inserted at'' position {{mvar|p}} is denoted by {{math|''e''[''e′''/''p'']}} and defined by
: {{math|''e''[''e′''/ε] ≡ ''e′''}}
: {{math|''e''[''e′''/''i''.''p''] ≡ <
''Example.'' — If {{math|''e'' ≡ (+ (
Position {{mvar|p}} is ''purely referential'' in expression {{mvar|e}} is defined by
: {{math|1=''e''<sub>1</sub> = ''e''<sub>2</sub>}} implies {{math|1=''e''[''e''<sub>1</sub>/''p''] = ''e''[''e''<sub>2</sub>/''p'']}}, for all expressions {{
In other words, a position is purely referential in an expression if and only if it is subject to the substitutivity of equals. {{mvar|ε}} is purely referential in all expressions.
Operator {{
: {{mvar|p}} is purely referential in {{mvar|e<sub>''i''</sub>}} implies {{math|''i''.''p''}} is purely referential in {{math|''e'' ≡ <
Otherwise {{
An operator is ''referentially transparent'' is defined by it is referentially transparent in all places. Otherwise it is ''referentially opaque''.
Line 94:
* [[Liskov substitution principle]]
* [[Rewrite rule]]
==Notes==
{{notelist}}
== References ==
|