HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, in the area of
lambda calculus In mathematical logic, the lambda calculus (also written as ''λ''-calculus) is a formal system for expressing computability, computation based on function Abstraction (computer science), abstraction and function application, application using var ...
and
computation A computation is any type of arithmetic or non-arithmetic calculation that is well-defined. Common examples of computation are mathematical equation solving and the execution of computer algorithms. Mechanical or electronic devices (or, hist ...
, directors or director strings are a mechanism for keeping track of the
free variable In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a variable may be said to be either free or bound. Some older books use the terms real variable and apparent variable for f ...
s in a term. Loosely speaking, they can be understood as a kind of
memoization In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls to pure functions and returning the cached result when the same inputs occur ag ...
for free variables; that is, as an
optimization Mathematical optimization (alternatively spelled ''optimisation'') or mathematical programming is the selection of a best element, with regard to some criteria, from some set of available alternatives. It is generally divided into two subfiel ...
technique for rapidly locating the free variables in a
term algebra Term may refer to: Language *Terminology, context-specific nouns or compound words **Technical term (or ''term of art''), used by specialists in a field ***Scientific terminology, used by scientists *Term (argumentation), part of an argument in d ...
or in a lambda expression. Director strings were introduced by Kennaway and Sleep in 1982 and further developed by Sinot, Fernández and MackieF.-R. Sinot, M. Fernández and I. Mackie. [ftp://nozdr.ru/biblio/kolxoz/Cs/CsLn/R/Rewriting%20Techniques%20and%20Applications,%2014%20conf.,%20RTA%202003(LNCS2706,%20Springer,%202003)(ISBN%203540402543)(526s)_CsLn_.pdf#page=57 Efficient Reductions with Director Strings]{{cbignore, bot=medic. In ''Proc. Rewriting Techniques and Applications''. Springer LNCS vol 2706, 2003 as a mechanism for understanding and controlling the
computational complexity In computer science, the computational complexity or simply complexity of an algorithm is the amount of resources required to run it. Particular focus is given to computation time (generally measured by the number of needed elementary operations ...
cost of
beta reduction In mathematical logic, the lambda calculus (also written as ''λ''-calculus) is a formal system for expressing computation based on function abstraction and application using variable Name binding, binding and Substitution (algebra), substitution ...
.


Motivation

In beta reduction, one defines the value of the expression on the left to be that on the right: :(\lambda x.E)y \equiv E := y, or (\lambda x.E)y \equiv E /x/math> (Replace all ''x'' in ''E''(body) by ''y'') While this is a conceptually simple operation, the
computational complexity In computer science, the computational complexity or simply complexity of an algorithm is the amount of resources required to run it. Particular focus is given to computation time (generally measured by the number of needed elementary operations ...
of the step can be non-trivial: a naive algorithm would scan the expression ''E'' for all occurrences of the free variable ''x''. Such an algorithm is clearly ''O''(''n'') in the length of the expression ''E''. Thus, one is motivated to somehow track the occurrences of the free variables in the expression. One may attempt to track the position of ''every'' free variable, wherever it may occur in the expression, but this can clearly become very costly in terms of storage; furthermore, it provides a level of detail that is not really needed. Director strings suggest that the correct model is to track free variables in a hierarchical fashion, by tracking their use in component terms.


Definition

Consider, for simplicity, a
term algebra Term may refer to: Language *Terminology, context-specific nouns or compound words **Technical term (or ''term of art''), used by specialists in a field ***Scientific terminology, used by scientists *Term (argumentation), part of an argument in d ...
, that is, a collection of free variables, constants, and operators which may be freely combined. Assume that a term ''t'' takes the form :t ::= f(t_1,t_2,\dots,t_n) where ''f'' is a function, of
arity In logic, mathematics, and computer science, arity () is the number of arguments or operands taken by a function, operation or relation. In mathematics, arity may also be called rank, but this word can have many other meanings. In logic and ...
''n'', with no
free variable In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a variable may be said to be either free or bound. Some older books use the terms real variable and apparent variable for f ...
s, and the t_i are terms that may or may not contain free variables. Let ''V'' denote the set of all free variables that may occur in the set of all terms. The director is then the map :\sigma_t: V\to P(\lbrace 1,2,\dots,n\rbrace) from the free variables to the
power set In mathematics, the power set (or powerset) of a set is the set of all subsets of , including the empty set and itself. In axiomatic set theory (as developed, for example, in the ZFC axioms), the existence of the power set of any set is po ...
P(X) of the set X=\lbrace 1,2,\dots,n\rbrace. The values taken by \sigma_t are simply a list of the indices of the t_i in which a given free variable occurs. Thus, for example, if a free variable x\in V occurs in t_3 and t_5 but in no other terms, then one has \sigma_t(x) = \lbrace 3,5\rbrace. Thus, for every term t\in T in the set of all terms ''T'', one maintains a function \sigma_t, and instead of working only with terms ''t'', one works with pairs (t,\sigma_t). Thus, the time complexity of finding the free variables in ''t'' is traded for the space complexity of maintaining a list of the terms in which a variable occurs.


General case

Although the above definition is formulated in terms of a
term algebra Term may refer to: Language *Terminology, context-specific nouns or compound words **Technical term (or ''term of art''), used by specialists in a field ***Scientific terminology, used by scientists *Term (argumentation), part of an argument in d ...
, the general concept applies more generally, and can be defined both for combinatory algebras and for
lambda calculus In mathematical logic, the lambda calculus (also written as ''λ''-calculus) is a formal system for expressing computability, computation based on function Abstraction (computer science), abstraction and function application, application using var ...
proper, specifically, within the framework of explicit substitution.


See also

* Term rewrite system * Explicit substitution *
Memoization In computing, memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls to pure functions and returning the cached result when the same inputs occur ag ...


References

* F.-R. Sinot.
Director Strings Revisited: A Generic Approach to the Efficient Representation of Free Variables in Higher-order Rewriting.
''Journal of Logic and Computation'' 15(2), pages 201-218, 2005. Lambda calculus Rewriting systems Software optimization