You have 3 free guides left 😟
Unlock your guides
You have 3 free guides left 😟
Unlock your guides

5.1 Term Rewriting Systems

3 min readjuly 22, 2024

are powerful tools for manipulating symbolic expressions. They use , , and to transform complex expressions into simpler forms. Understanding these components is crucial for working with symbolic computation.

Applying rewrite rules simplifies expressions by matching and replacing subterms. This process continues until no more rules can be applied. Properties like , , and ensure the system behaves predictably and produces consistent results.

Term Rewriting Systems

Components of term rewriting systems

Top images from around the web for Components of term rewriting systems
Top images from around the web for Components of term rewriting systems
  • Terms are the basic building blocks of expressions in a term rewriting system
    • Constructed using variables (placeholders for values) and function symbols (represent operations)
    • f(x,g(y))f(x, g(y)) is a term with variables xx and yy, and function symbols ff and gg
  • Rewrite rules define how terms can be transformed from one form to another
    • Consist of a left-hand side (LHS) pattern and a right-hand side (RHS) replacement
    • f(x,y)g(x)f(x, y) \rightarrow g(x) is a rewrite rule that replaces occurrences of f(x,y)f(x, y) with g(x)g(x)
  • strategies specify the order in which rewrite rules are applied to terms
    • Determine which subterms are rewritten first and in what order the rules are applied
    • Common strategies include innermost (evaluate arguments first) and outermost (delay argument evaluation) rewriting

Application of rewrite rules

  • To simplify an expression using a term rewriting system, repeatedly apply the rewrite rules to the expression until no further reductions can be made
    • Match subterms of the expression to the LHS patterns of the rewrite rules
    • Replace the matched subterms with the corresponding RHS of the rewrite rules
    • Repeat this process until no more rules can be applied to the expression
  • Consider the expression f(g(a),h(b))f(g(a), h(b)) and the following rewrite rules:
    1. f(x,y)xf(x, y) \rightarrow x
    2. g(x)xg(x) \rightarrow x
    3. h(x)xh(x) \rightarrow x
    • Applying the rules yields the reduction sequence: f(g(a),h(b))f(a,h(b))f(a,b)af(g(a), h(b)) \rightarrow f(a, h(b)) \rightarrow f(a, b) \rightarrow a

Properties of term rewriting systems

  • Termination ensures that all rewrite sequences in a term rewriting system eventually end
    • No infinite reductions are possible in a terminating system
    • Proving termination guarantees that the rewriting process will always halt
  • Confluence guarantees that different rewrite sequences starting from the same term always lead to the same result
    • The order of rule application does not affect the final outcome
    • Confluent systems have unique normal forms (fully reduced terms) for each initial term
  • Normalization ensures that every term in a term rewriting system has a
    • Normal forms are terms to which no further rewrite rules can be applied
    • A normalizing system allows every term to be reduced to a simplified form

Strategies for term reduction

  • , also known as eager evaluation, rewrites the innermost subterms first
    • Arguments are evaluated before applying functions to them
    • May perform unnecessary computations but can be more efficient for terminating systems
  • , also known as lazy evaluation, rewrites the outermost subterms first
    • Evaluation of arguments is delayed until their values are needed
    • May avoid unnecessary computations but can be less efficient for terminating systems
  • The choice of reduction strategy affects the efficiency, termination behavior, and order of intermediate results in a term rewriting system
    • Innermost rewriting may be preferred for terminating systems or when arguments are known to be needed
    • Outermost rewriting may be preferred for non-terminating systems or when some arguments can be discarded
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.
Glossary
Glossary