Graph reduction

Graph reduction

In computer science, graph reduction implements an efficient version of non-strict evaluation, an evaluation strategy where the arguments to a function are not immediately evaluated. This form of non-strict evaluation is also known as lazy evaluation and used in functional programming languages. The technique was first developed by Chris Wadsworth in 1971.

Contents

Motivation

A simple example of evaluating an arithmetic expression follows:


\begin{align}
& {} \qquad ((2+2)+(2+2))+(3+3) \\
& {} =((2+2)+(2+2))+(6) \\
& {} =((2+2)+ 4)+6 \\
& {} =(4+4)+6 \\
& {} =8+6 \\
& {} =14
\end{align}

The above reduction sequence employs a strategy known as outermost tree reduction. The same expression can be evaluated using innermost tree reduction, yielding the reduction sequence:


\begin{align}
& {} \qquad ((2+2)+(2+2))+(3+3) \\
& {} = ((2+2)+4)+(3+3) \\
& {} = (4+4)+(3+3) \\
& {} = (4+4)+6 \\
& {} = 8+6 \\
& {} = 14
\end{align}


Notice that the reduction order is made explicit by the addition of parentheses. This expression could also have been simply evaluated right to left, because addition is an associative operation.

Represented as a tree, the expression above looks like this:

Expression Tree.svg

This is where the term tree reduction comes from. When represented as a tree, we can think of innermost reduction as working from the bottom up, while outermost works from the top down.

The expression can also be represented as a graph, allowing sub-expressions to be shared:

Expression Graph.svg

As for trees, outermost and innermost reduction also applies to graphs. Hence we have graph reduction.

Now evaluation with outermost graph reduction can proceed as follows:

Expression Graph Reduction.svg


Notice that evaluation now only requires four steps. Outermost graph reduction is referred to as lazy evaluation and innermost graph reduction is referred to as eager evaluation.

Combinator graph reduction

Combinator graph reduction is a fundamental implementation technique for functional programming languages, in which a program is converted into a combinator representation which is mapped to a directed graph data structure in computer memory, and program execution then consists of rewriting parts of this graph ("reducing" it) so as to move towards useful results.

History

The concept of a graph reduction that allows evaluated values to be shared was first developed by Chris Wadsworth in his 1971 Ph.D. dissertation. [1]This dissertation was cited by Peter Henderson and James H. Morris Jr. in 1976 page, “A lazy evaluator” [1] that introduced the notion of lazy evaluation. In 1976 David Turner incorporated lazy evaluation into SASL using combinators. [2] SASL was an early functional programming language first developed by Turner in 1972.

See also

Notes

  1. ^ Hudak, Paul (September 1989). "Conception, evolution, and application of functional programming languages" (PDF (4.9 MB)). ACM Computing Surveys 21 (3): 359–411. doi:10.1145/72551.72554. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.83.6505&rep=rep1&type=pdf. 
  2. ^ Hudak, Paul; Hughes, John; Peyton Jones, Simon; Wadler, Philip. "A History of Haskell". History of Programming Languages Conference 2007. http://haskell.org/haskellwiki/History_of_Haskell. 

References

  • Bird, Richard (1998). Introduction to Functional Programming using Haskell. Prentice Hall. ISBN 0-13-484346-0. 

Further reading

  • Simon Peyton Jones, The Implementation of Functional Programming Languages, Prentice Hall, 1987. Full text online.[2]

Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Graph reduction machine — A graph reduction machine is a special purpose computer built to perform combinator calculations by graph reduction.Examples include the SKIM ( S K I machine ) computer, built at the University of Cambridge Computer Laboratory, and the… …   Wikipedia

  • Reduction — Reduction, reduced, or reduce may refer to:cienceChemistry*Reduction – chemical reaction in which atoms have their oxidation number (oxidation state) changed. **Reduced gas – a gas with a low oxidation number **Ore reduction: see… …   Wikipedia

  • réduction — [ redyksjɔ̃ ] n. f. • fin XIIIe « rapprochement »; lat. reductio, de reducere → réduire I ♦ (XIVe) Opération qui consiste à remettre en place (un os luxé, fracturé; un organe déplacé). Réduction d une articulation luxée. Par ext. Réduction d une… …   Encyclopédie Universelle

  • Graph coloring — A proper vertex coloring of the Petersen graph with 3 colors, the minimum number possible. In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called colors to elements of a graph… …   Wikipedia

  • Reduction system — In mathematics, a reduction system is a system where terms can be re written by using a finte list of rewriting rules.Examples of reduction systems include string rewriting systems, term rewriting systems, lambda calculus under lambda conversion …   Wikipedia

  • List of graph theory topics — This is a list of graph theory topics, by Wikipedia page. See glossary of graph theory for basic terminology Contents 1 Examples and types of graphs 2 Graph coloring 3 Paths and cycles 4 …   Wikipedia

  • Nonlinear dimensionality reduction — High dimensional data, meaning data that requires more than two or three dimensions to represent, can be difficult to interpret. One approach to simplification is to assume that the data of interest lies on an embedded non linear manifold within… …   Wikipedia

  • Transitive reduction — In mathematics, the transitive reduction of a binary relation R on a set X is a minimal relation R on X such that the transitive closure of R is the same as the transitive closure of R . If the transitive closure of R is antisymmetric and finite …   Wikipedia

  • Median graph — The median of three vertices in a median graph In mathematics, and more specifically graph theory, a median graph is an undirected graph in which any three vertices a, b, and c have a unique median: a vertex m(a,b,c) that belongs to shortest… …   Wikipedia

  • Directed acyclic graph — An example of a directed acyclic graph In mathematics and computer science, a directed acyclic graph (DAG i …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”