In computer science, lambda calculi are said to have explicit substitutions if they pay special attention to the formalization of the process of substitution. This is in contrast to the standard lambda calculus where substitutions are performed by beta reductions in an implicit manner which is not expressed within the calculus; the "freshness" conditions in such implicit calculi are a notorious source of errors.[1] The concept has appeared in a large number of published papers in quite different fields, such as in abstract machines, predicate logic, and symbolic computation.

Overview

edit

A simple example of a lambda calculus with explicit substitution is "λx", which adds one new form of term to the lambda calculus, namely the form M⟨x:=N⟩, which reads "M where x will be substituted by N". (The meaning of the new term is the same as the common idiom let x:=N in M from many programming languages.) λx can be written with the following rewriting rules:

  1. (λx.M) N → M⟨x:=N⟩
  2. x⟨x:=N⟩ → N
  3. x⟨y:=N⟩ → x (x≠y)
  4. (M1M2) ⟨x:=N⟩ → (M1⟨x:=N⟩) (M2⟨x:=N⟩)
  5. (λx.M) ⟨y:=N⟩ → λx.(M⟨y:=N⟩) (x≠y and x not free in N)

While making substitution explicit, this formulation still retains the complexity of the lambda calculus "variable convention", requiring arbitrary renaming of variables during reduction to ensure that the "(x≠y and x not free in N)" condition on the last rule is always satisfied before applying the rule. Therefore many calculi of explicit substitution avoid variable names altogether by using a so-called "name-free" De Bruijn index notation.

History

edit

Explicit substitutions were sketched in the preface of Curry's book on Combinatory logic[2] and grew out of an ‘implementation trick’ used, for example, by AUTOMATH, and became a respectable syntactic theory in lambda calculus and rewriting theory. Though it actually originated with de Bruijn,[3] the idea of a specific calculus where substitutions are part of the object language, and not of the informal meta-theory, is traditionally credited to Abadi, Cardelli, Curien, and Lévy. Their seminal paper[4] on the λσ calculus explains that implementations of lambda calculus need to be very careful when dealing with substitutions. Without sophisticated mechanisms for structure-sharing, substitutions can cause a size explosion, and therefore, in practice, substitutions are delayed and explicitly recorded. This makes the correspondence between the theory and the implementation highly non-trivial and correctness of implementations can be hard to establish. One solution is to make the substitutions part of the calculus, that is, to have a calculus of explicit substitutions.

Once substitution has been made explicit, however, the basic properties of substitution change from being semantic to syntactic properties. One most important example is the "substitution lemma", which with the notation of λx becomes

  • (M⟨x:=N⟩)⟨y:=P⟩ = (M⟨y:=P⟩)⟨x:=(N⟨y:=P⟩)⟩ (where x≠y and x not free in P)

A surprising counterexample, due to Melliès,[5] shows that the way this rule is encoded in the original calculus of explicit substitutions is not strongly normalizing. Following this, a multitude of calculi were described trying to offer the best compromise between syntactic properties of explicit substitution calculi.[6][7][8]

See also

edit

References

edit
  1. ^ Clouston, Ranald; Bizjak, Aleš; Grathwohl, Hans; Birkedal, Lars (27 April 2017). "The Guarded Lambda-Calculus: Programming and Reasoning with Guarded Recursion for Coinductive Types". Logical Methods in Computer Science. 12 (3): 36. arXiv:1606.09455. doi:10.2168/LMCS-12(3:7)2016.
  2. ^ Curry, Haskell; Feys, Robert (1958). Combinatory Logic Volume I. Amsterdam: North-Holland Publishing Company.
  3. ^ N. G. de Bruijn: A namefree lambda calculus with facilities for internal definition of expressions and segments. Technological University Eindhoven, Netherlands, Department of Mathematics, (1978), (TH-Report), Number 78-WSK-03.
  4. ^ M. Abadi, L. Cardelli, P-L. Curien and J-J. Levy, Explicit Substitutions, Journal of Functional Programming 1, 4 (October 1991), 375–416.
  5. ^ P-A. Melliès: Typed lambda-calculi with explicit substitutions may not terminate. TLCA 1995: 328–334
  6. ^ P. Lescanne, From λσ to λυ: a journey through calculi of explicit substitutions, POPL 1994, pp. 60–69.
  7. ^ K. H. Rose, Explicit Substitution – Tutorial & Survey, BRICS LS-96-3, September 1996 (ps.gz).
  8. ^ Delia Kesner: A Theory of Explicit Substitutions with Safe and Full Composition. Logical Methods in Computer Science 5(3) (2009)

📚 Artikel Terkait di Wikipedia

Lambda calculus

evaluation of expressions in programming languages Explicit substitution – The theory of substitution, as used in β-reduction Harrop formula – A kind of

Automath

adopted and/or reinvented in areas such as typed lambda calculus and explicit substitution. Dependent types is one outstanding example. Automath was also the

Implicit function

y is restricted to nonnegative values. Some equations do not admit an explicit solution. The implicit function theorem provides conditions under which

Penal substitution

Penal substitution, also called penal substitutionary atonement and especially in older writings forensic theory, is a theory of the atonement within Protestant

Krivine machine

is Xavier Leroy's ZINC abstract machine, which underlies OCaml.) Explicit substitution Operational semantics SECD machine Semantics of programming languages

Hilbert system

system uses a substitution rule and uses modus ponens as an inference rule. The exact same system was given (with an explicit substitution rule) by Alonzo

Lambda calculus definition

during substitution, an operation called capture-avoiding substitution. In programming languages with static scope, capture-avoiding substitution can be

Director string

proper, specifically, within the framework of explicit substitution. Term rewrite system Explicit substitution Memoization Sinot, François-Régis; Fernández