Rewriting Systems

Total Page:16

File Type:pdf, Size:1020Kb

Rewriting Systems Languages and Compilers. Languages and Compilers Continuation of the course in Programming Languages. • New computation paradigms: Course web page ) Marco Comini; • Logic: Prolog These slides available on my web page. • Functional logic: Curry • Formal description of declarative languages behavior: Exam: • functional programming: rewriting systems, lambda calculus, pattern matching • Similar to the exam for Programming Languages: • logic programming: unification, SLD-derivations • three small projects, one at the end of first semester, during the • functional logic programming : narrowing January-February exam period, (one month time window); • Compilers • group projects (1-3 persons), • parsing • attribute grammars • first project: ∼ 2 days for a group of 3 persons. • type checking • intermediate code generation 24 hours on first semester + 48 hours on the second. P. Di Gianantonio (Udine) Rewriting Systems 1 / 82 P. Di Gianantonio (Udine) Rewriting Systems 2 / 82 Rewriting systems Text book: TeReSe-Lite Freely available on line. The course only condisiders the material contained in the following Term rewriting systems sections: are the founding theory for: • 0.0 • functional programming, • 1.0, 1.1, 1.2 • logic programming, • 2.0, 2.1, 2.2, 2.3, 2.7.0, 2.7.1 • functional logic programming, • 3.1, 3.2.0, 3.3.2, • concurrent systems. • 4.1, 4.8.0 Here, n.0 indicates the first part of Chapter n, before Section n.1 starts. When subsections are indicated, as in 2.7.0, it is sufficient to read the material contained in the specified subsections, omitting the other parts of the section. P. Di Gianantonio (Udine) Rewriting Systems 3 / 82 P. Di Gianantonio (Udine) Rewriting Systems 4 / 82 Rewriting as computation Several form of computation can be formulated as rewriting systems: In evaluating an expression, e.g. (3 + 5 + 6) · (1 + 2) • Turing machine; • Post canonical systems; • One moves from one expression to the following one. • lambda calculus, functional programming; • An finite set of rules are applied. • logic programming; • Local rewriting. • ... • Non-determinism – confluence. indeed • Result as termination. • computation proceeds by steps, • each step of computation is local (modify just a local of the system). P. Di Gianantonio (Udine) Rewriting Systems 5 / 82 P. Di Gianantonio (Udine) Rewriting Systems 6 / 82 Abstract reduction system Abstract reduction system one abstracts on the nature of rewritten (reduced) objects. One just considers the graph of reductions. Definition (Abstract reduction system) The shape of the computation graph give information on the nature of computation. A := (A; !) • deterministic programs (non-deterministic); • reversible computing; • A set • termination, non-termination, • ! binary relation on A • confluence. • the set A represents the possible states of the computation; • the relation ! represents the single steps of reduction (rewriting, computation). P. Di Gianantonio (Udine) Rewriting Systems 7 / 82 P. Di Gianantonio (Udine) Rewriting Systems 8 / 82 Labeled reductions ARS, definitions: When a !α b one says that: • a reduces to b in a single step of (α-)reduction (computation), In some areas (e.g, concurrence), one considers a set of reduction • b is a (α-)reduct, in one step, of a , relations. • A := (A; f!αj α 2 Ig) a is an (α-)expansion, in one step, of b. These structures are also called labeled transition systems (LTS) Definition (Reduction sequence) is a, finite or infinite, sequence is the form: Motivations: ! ! ! ! • to distinguish among several kind of reduction rules, a0 a1 ::: an • the reduction generates side-effects that need to be specified. One says that; • a0 reduces to an (in several steps); • an is a reduct (by several steps) of a0. P. Di Gianantonio (Udine) Rewriting Systems 9 / 82 P. Di Gianantonio (Udine) Rewriting Systems 10 / 82 ARS, derived relations Property on ARS: Confluence Different reductions, starting from the same element, can re-converge to a One can look at an ARS as a directed graphs (possibly labeled). common element. Definition !+ is the transitive closure of ! An element a 2 A is called weakly confluent or weakly Church-Rosser a !∗ b iff a reduces to b in n steps with n > 0 (WCR) if as a graph: there exists a non-empty path from a to b, 8b; c. b a ! c we have that: 9d. b !∗ d ∗ c. !∗ is the reflexive and transitive closure of ! for every a, a !∗ a. An element a 2 A is called confluent or Church-Rosser (CR) if 8b; c. b ∗ a !∗ c we have that: 9d. b !∗ d ∗ c. a = b is the symmetric, reflexive and transitive closure of ! implicitly: if a ! b then a and b are taken as equal, An ARS is (weakly) Church-Rosser if every element is (weakly) as a graph: a and b belong to the same connected Church-Rosser. component. CR ensures that different computations can re-converge on a common Notation: The syntactic equality is denoted by ≡. state. WCR is easier to verify. WCR is a strictly weaker property that CR. Counterexample: . P. Di Gianantonio (Udine) Rewriting Systems 11 / 82 P. Di Gianantonio (Udine) Rewriting Systems 12 / 82 CR reduction system: examples an Several notion of confluence counterexamples There exists a plethora of different notions of confluence, in common they Examples: have the structure of the definitions, they differ for the used relations. • evaluation of arithmetic expressions ; Definition • pure functional languages; • • deterministic computation. Diamond property: 8b; c. b a ! c implies 9d. b ! d c, • !α weakly commutes with !β : 8b; c. b α a !β c implies 9d. Counterexamples: ∗ ∗ b !β d α c, • definitions by pattern matching, • ... • logic programming, The most meaningful notions remain CR and WCR. • concurrent systems. P. Di Gianantonio (Udine) Rewriting Systems 13 / 82 P. Di Gianantonio (Udine) Rewriting Systems 14 / 82 ARS properties: termination ARS properties: confluence on normal forms Assumption: the final results of computation are the elements that cannot be further reduced. Definition Definition • an ARS has the normal form property(NF) if ∗ • a is in normal form if @ b:a ! b. 8a; b . b normal form ^ a = b ) a ! b • • a is weakly normalizing(WN) if 9 b in normal form s.t . a !∗ b. an ARS has the unique normal form property(UN) it 8a; b . a; b, normal forms ^ a = b ) a ≡ b • a is strong normalizing(SN) if there is no infinite reduction starting from a. Theorem • an ARS is WN (SN) if every element in it is WN (SN). NF ) UN Show that the reverse implication does not hold. P. Di Gianantonio (Udine) Rewriting Systems 15 / 82 P. Di Gianantonio (Udine) Rewriting Systems 16 / 82 Logical implication among properties Term rewriting system (TRS) ARS defines an abstract notion. TRS special cases of ARS where: Theorem • the elements (computation objects) are first order terms on a given • ^ ) SN WCR CR algebra; • WN ^ UN ) CR • reduction given by a set of rules: • CR ) NF • defined parametrically (using variables and pattern matching) • rules applicable everywhere (in any context). The relation ! is called rewriting (instead of reduction). P. Di Gianantonio (Udine) Rewriting Systems 17 / 82 P. Di Gianantonio (Udine) Rewriting Systems 18 / 82 Motivating example Terms defined by a syntax Natural numbers arithmetic Signature Σ: list of constants and functions organized by arity. Terms generated signature: Example: h0 : 0; S : 1; add; mult : 2i. h0 : 0; S : 1; add; mult : 2i. Constants can be seen as functions with 0 arguments. The syntax may contain also an extra set of variables V. Rewriting rules: Definition • ! add(x; 0) x The set of terms on Σ, V is the set T(Σ; V) generated by the following • add(x; S(y)) ! S(add(x; y)) rules: • mult(x; 0) ! 0 • 8x 2 V x 2 T(Σ; V) • mult(x; S(y)) ! add(mult(x; y); x) • 8f 2 Σ; arity(f) = n; t1;::: tn 2 T(Σ; V) f(t1;::: tn) 2 T(Σ; V) Problems: • What are the (closed) terms in normal form. According to definition a constant c should be written as c(), but we use • Reduce mult(S(S(0)); S(S(0))). the usual writing. • Show that mult(S(S(0)); S(S(0))) e` CR. Only prefix notation, no infix notation. • Define the rewriting rules for subtraction. Exercise. Define the syntax for Boolean algebra. P. Di Gianantonio (Udine) Rewriting Systems 19 / 82 P. Di Gianantonio (Udine) Rewriting Systems 20 / 82 Alternative definition Counting Definition • Ground terms: closed, not containing variables, belonging to T(Σ; ;) The set of terms generated by the grammar: • Linear term: each variable occurs at most once. • Var(t) denotes the set of variable occurring in t: T := x j x j ::: 1 2 t ground , Var(t) = ;. c1() j c2() j ::: • The length of a term t, (denoted by jtj) is the number of functions and u (T) j u (T) j ::: 1 2 variable symbols appearing in t: f (T; T) j f (T; T) j ::: 1 2 • jxj = 1 g1(T; T; T) j g2(T; T; T) j ::: • jf(t1;:::; tn)j = 1 + jt1j + ::: + jtnj The depth of a term t in the maximal number of consecutive application: • depth(x) = 1 • depth(f(t1;:::; tn)) = 1 + max(depth(t1);:::; depth(tn)) P. Di Gianantonio (Udine) Rewriting Systems 21 / 82 P. Di Gianantonio (Udine) Rewriting Systems 22 / 82 Context Term tree Rewriting rules can be applied to subterms, that is terms inside a context. Context: what is remain of a terms having removed a subterm. Formally: It is useful to thought to terms as ordered trees. Definition • variables an constants are the leaves. A context Σ is a term generated by a signature Σ: h[]: 0i, • functions are internal nodes with having as children the arguments. Symbol [], called hole, represent a missing subterm. We just consider in one hole context. Notation.
Recommended publications
  • Arxiv:1804.04307V1 [Math.RA] 12 Apr 2018 Prtr.A Xml Fsc Lersi H Di the Di Is Algebras of Such of Example an Operators
    FREE OPERATED MONOIDS AND REWRITING SYSTEMS JIN ZHANG AND XING GAO ∗ Abstract. The construction of bases for quotients is an important problem. In this paper, applying the method of rewriting systems, we give a unified approach to construct sections—an alternative name for bases in semigroup theory—for quotients of free operated monoids. As applications, we capture sections of free ∗-monoids and free groups, respectively. Contents 1. Introduction 1 2. Rewrting systems and sections 2 2.1. Operated monoids and operated congruences 2 2.2. Relationshipbetweenrewritingsystemsandsections 6 3. Applications 8 3.1. Free ∗-monoids 9 3.2. Free groups 12 References 16 1. Introduction In 1960, A.G. Kurosh [23] first introduced the concept of algebras with one or more linear operators. An example of such algebras is the differential algebra led by the algebraic abstraction of differential operator in analysis. Differential algebra is from a purely algebraic viewpoint to study differentiation and nonlinear differential equations without using an underlying topology, and has been largely successful in many crucial areas, such as uncoupling of nonlinear systems, classification of singular components, and detection of hidden equations [22, 28]. Another im- portant example of such algebras is the Rota-Baxter algebra (first called Baxter algebra) which is the algebraic abstraction of integral operator in analysis [17]. Rota-Baxter algebra, originated from probability study [5], is related beautifully to the classical Yang-Baxter equation, as well as to operads, to combinatorics and, through the Hopf algebra framework of Connes and Kreimer, to the renormalization of quantum field theory [1, 3, 4, 11, 12, 19].
    [Show full text]
  • Lectures on Algebraic Rewriting
    Lectures on Algebraic Rewriting Philippe Malbos Institut Camille Jordan Université Claude Bernard Lyon 1 - December 2019 - PHILIPPE MALBOS Univ Lyon, Université Claude Bernard Lyon 1 [email protected] CNRS UMR 5208, Institut Camille Jordan 43 blvd. du 11 novembre 1918 F-69622 Villeurbanne cedex, France — December 6, 2019 - 17:47 — Contents 1 Abstract Rewriting 1 1.1 Abstract Rewriting Systems . .2 1.2 Confluence . .4 1.3 Normalisation . .6 1.4 From local to global confluence . 10 2 String Rewriting 13 2.1 Preliminaries: one and two-dimensional categories . 13 2.2 String rewriting systems . 21 2.3 The word problem . 25 2.4 Branchings . 26 2.5 Completion . 30 2.6 Existence of finite convergent presentations . 32 3 Coherent presentations and syzygies 35 3.1 Introduction . 35 3.2 Categorical preliminaries . 37 3.3 Coherent presentation of categories . 40 3.4 Finite derivation type . 42 3.5 Coherence from convergence . 44 4 Two-dimensional homological syzygies 51 4.1 Preliminaries on modules . 51 4.2 Monoids of finite homological type . 55 4.3 Squier’s homological theorem . 61 4.4 Homology of monoids with integral coefficients . 63 4.5 Historical notes . 65 iii CONTENTS 5 Linear rewriting 69 5.1 Linear 2-polygraphs . 70 5.2 Linear rewriting steps . 77 5.3 Termination for linear 2-polygraphs . 79 5.4 Monomial orders . 80 5.5 Confluence and convergence . 82 5.6 The Critical Branchings Theorem . 85 5.7 Coherent presentations of algebras . 90 6 Paradigms of linear rewriting 95 6.1 Composition Lemma . 96 6.2 Reduction operators .
    [Show full text]
  • Thue Systems As Rewriting Systems~
    J. Symbolic Computation (1987) 3, 39-68 Thue Systems as Rewriting Systems~ RONALD V. BOOK Department of Mathematics, University of California at Santa Barbara, Santa Barbara, California 93106, USA This paper is a survey of recent results on Thue systems, where the systems are viewed as rewriting systems on strings over a finite alphabet. The emphasis is on Thue systems with the Chureh-Rosser property, where the notion of reduction is based on length-decreasing rewriting rules. The main effort is expended in outlining the properties of such systems, paying close attention to the issue of the possible decidability of properties and to the issue of the computational complexity of decidable properties. Since Thue systems may also be considered as presentations of monoids, the language of monoids (and groups) is used to describe some of these properties. 1. Introduction Replacement systems arise in the study of formula manipulation systems such as theorem provers, program optimisers, and algebraic simplifiers. These replacement systems take such forms as term rewriting systems, tree manipulating systems, graph grammars, etc. The study of abstract data types is another area where such systems are useful. The principal problem in this context is the word problem: given a system and two objects, are the two objects equivalent? From a slightly different viewpoint the problem can be stated as follows: can one of these objects be transformed into the other by means of a finite number of applications of the rewriting rules in the given system? This leads naturally to the question of the decidability of the word problem for a given class of systems.
    [Show full text]
  • Strategy Independent Reduction Lengths in Rewriting and Binary Arithmetic
    Strategy Independent Reduction Lengths in Rewriting and Binary Arithmetic Hans Zantema University of Technology, Eindhoven, The Netherlands Radboud University, Nijmegen, The Netherlands [email protected] In this paper we give a criterion by which one can conclude that every reduction of a basic term to normal form has the same length. As a consequence, the number of steps to reach the normal form is independent of the chosen strategy. In particular this holds for TRSs computing addition and multiplication of natural numbers, both in unary and binary notation. 1 Introduction For many term rewriting systems (TRSs) the number of rewrite steps to reach a normal form strongly depends on the chosen strategy. For instance, in using the standard if-then-else-rules if(true;x;y) ! x if(false;x;y) ! y it is a good strategy to first rewrite the leftmost (boolean) argument of the symbol if until this argument is rewritten to false or true and then apply the corresponding rewrite rule for if. In this way redundant reductions in the third argument are avoided in case the condition rewrites to true, and redundant reduc- tions in the second argument are avoided in case the condition rewrites to false. More general, choosing a good reduction strategy is essential for doing efficient computation by rewriting. Roughly speaking, for erasing rules, that is, some variable in the left-hand side does not appear in the right-hand side, it seems a good strategy to postpone rewriting this possibly erasing argument, as is the case in the above if-then-else example.
    [Show full text]
  • Verifying the Unification Algorithm In
    Verifying the Uni¯cation Algorithm in LCF Lawrence C. Paulson Computer Laboratory Corn Exchange Street Cambridge CB2 3QG England August 1984 Abstract. Manna and Waldinger's theory of substitutions and uni¯ca- tion has been veri¯ed using the Cambridge LCF theorem prover. A proof of the monotonicity of substitution is presented in detail, as an exam- ple of interaction with LCF. Translating the theory into LCF's domain- theoretic logic is largely straightforward. Well-founded induction on a complex ordering is translated into nested structural inductions. Cor- rectness of uni¯cation is expressed using predicates for such properties as idempotence and most-generality. The veri¯cation is presented as a series of lemmas. The LCF proofs are compared with the original ones, and with other approaches. It appears di±cult to ¯nd a logic that is both simple and exible, especially for proving termination. Contents 1 Introduction 2 2 Overview of uni¯cation 2 3 Overview of LCF 4 3.1 The logic PPLAMBDA :::::::::::::::::::::::::: 4 3.2 The meta-language ML :::::::::::::::::::::::::: 5 3.3 Goal-directed proof :::::::::::::::::::::::::::: 6 3.4 Recursive data structures ::::::::::::::::::::::::: 7 4 Di®erences between the formal and informal theories 7 4.1 Logical framework :::::::::::::::::::::::::::: 8 4.2 Data structure for expressions :::::::::::::::::::::: 8 4.3 Sets and substitutions :::::::::::::::::::::::::: 9 4.4 The induction principle :::::::::::::::::::::::::: 10 5 Constructing theories in LCF 10 5.1 Expressions ::::::::::::::::::::::::::::::::
    [Show full text]
  • Unification: a Multidisciplinary Survey
    Unification: A Multidisciplinary Survey KEVIN KNIGHT Computer Science Department, Carnegie-Mellon University, Pittsburgh, Pennsylvania 15213-3890 The unification problem and several variants are presented. Various algorithms and data structures are discussed. Research on unification arising in several areas of computer science is surveyed, these areas include theorem proving, logic programming, and natural language processing. Sections of the paper include examples that highlight particular uses of unification and the special problems encountered. Other topics covered are resolution, higher order logic, the occur check, infinite terms, feature structures, equational theories, inheritance, parallel algorithms, generalization, lattices, and other applications of unification. The paper is intended for readers with a general computer science background-no specific knowledge of any of the above topics is assumed. Categories and Subject Descriptors: E.l [Data Structures]: Graphs; F.2.2 [Analysis of Algorithms and Problem Complexity]: Nonnumerical Algorithms and Problems- Computations on discrete structures, Pattern matching; Ll.3 [Algebraic Manipulation]: Languages and Systems; 1.2.3 [Artificial Intelligence]: Deduction and Theorem Proving; 1.2.7 [Artificial Intelligence]: Natural Language Processing General Terms: Algorithms Additional Key Words and Phrases: Artificial intelligence, computational complexity, equational theories, feature structures, generalization, higher order logic, inheritance, lattices, logic programming, natural language
    [Show full text]
  • Strategies for Linear Rewriting Systems: Link with Parallel Rewriting And
    Strategies for linear rewriting systems: link with parallel rewriting and involutive divisions Cyrille Chenavier∗ Maxime Lucas† Abstract We study rewriting systems whose underlying set of terms is equipped with a vector space structure over a given field. We introduce parallel rewriting relations, which are rewriting relations compatible with the vector space structure, as well as rewriting strategies, which consist in choosing one rewriting step for each reducible basis element of the vector space. Using these notions, we introduce the S-confluence property and show that it implies confluence. We deduce a proof of the diamond lemma, based on strategies. We illustrate our general framework with rewriting systems over rational Weyl algebras, that are vector spaces over a field of rational functions. In particular, we show that involutive divisions induce rewriting strategies over rational Weyl algebras, and using the S-confluence property, we show that involutive sets induce confluent rewriting systems over rational Weyl algebras. Keywords: confluence, parallel rewriting, rewriting strategies, involutive divisions. M.S.C 2010 - Primary: 13N10, 68Q42. Secondary: 12H05, 35A25. Contents 1 Introduction 1 2 Rewriting strategies over vector spaces 4 2.1 Confluence relative to a strategy . .......... 4 2.2 Strategies for traditional rewriting relations . .................. 7 3 Rewriting strategies over rational Weyl algebras 10 3.1 Rewriting systems over rational Weyl algebras . ............... 10 3.2 Involutive divisions and strategies . .............. 12 arXiv:2005.05764v2 [cs.LO] 7 Jul 2020 4 Conclusion and perspectives 15 1 Introduction Rewriting systems are computational models given by a set of syntactic expressions and transformation rules used to simplify expressions into equivalent ones.
    [Show full text]
  • Rewriting Via Coinserters
    Nordic Journal of Computing 10(2003), 290–312. REWRITING VIA COINSERTERS NEIL GHANI University of Leicester, Department of Mathematics and Computer Science University Road, Leicester LE1 7RH, United Kingdom [email protected] CHRISTOPH LUTH¨ Universitat¨ Bremen, FB 3 — Mathematik und Informatik P.O. Box 330 440, D-28334 Bremen, Germany [email protected] Abstract. This paper introduces a semantics for rewriting that is independent of the data being rewritten and which, nevertheless, models key concepts such as substitution which are central to rewriting algorithms. We demonstrate the naturalness of this construction by showing how it mirrors the usual treatment of algebraic theories as coequalizers of monads. We also demonstrate its naturalness by showing how it captures several canonical forms of rewriting. ACM CCS Categories and Subject Descriptors: F.4.m [Mathematical Logic and Formal Languages]: Miscellaneous – rewrite systems, term rewriting systems; F.4.1 [Mathematical Logic and Formal Languages]: Mathematical Logic – lambda calculus and related systems Key words: rewriting, monads, computation, category theory 1. Introduction Rewrite systems offer a flexible and general notion of computation that has ap- peared in various guises over the last hundred years. The first rewrite systems were used to study the word problem in group theory at the start of the twentieth century [Epstein 1992], and were subsequently further developed in the 1930s in the study of the λ-calculus and combinatory logic [Church 1940]. In the 1950s, Grobner¨ ba- sis were developed to solve the ideal membership problem for polynomials [Buch- berger and Winkler 1998]. In the 1970s, starting with Knuth-Bendix completion [Knuth and Bendix 1970], term rewriting systems (TRSs) have played a prominent roleˆ in the design and implementation of logical and functional programming lan- guages, the theory of abstract data types, and automated theorem proving [Baader and Nipkow 1998].
    [Show full text]
  • Finite Complete Rewriting Systems for Regular Semigroups
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Elsevier - Publisher Connector Theoretical Computer Science 412 (2011) 654–661 Contents lists available at ScienceDirect Theoretical Computer Science journal homepage: www.elsevier.com/locate/tcs Finite complete rewriting systems for regular semigroups R. Gray a,∗, A. Malheiro a,b a Centro de Álgebra da Universidade de Lisboa, Av. Prof. Gama Pinto, 2, 1649-003 Lisboa, Portugal b Departamento de Matemática, Faculdade de Ciências e Tecnologia, Universidade Nova de Lisboa, 2829-516 Caparica, Portugal article info a b s t r a c t Article history: It is proved that, given a (von Neumann) regular semigroup with finitely many left and right Received 11 May 2010 ideals, if every maximal subgroup is presentable by a finite complete rewriting system, then Received in revised form 4 October 2010 so is the semigroup. To achieve this, the following two results are proved: the property Accepted 19 October 2010 of being defined by a finite complete rewriting system is preserved when taking an ideal Communicated by Z. Esik extension by a semigroup defined by a finite complete rewriting system; a completely 0- simple semigroup with finitely many left and right ideals admits a presentation by a finite Keywords: complete rewriting system provided all of its maximal subgroups do. Rewriting systems Finitely presented groups and semigroups ' 2010 Elsevier B.V. All rights reserved. Finite complete rewriting systems Regular semigroups Ideal extensions Completely 0-simple semigroups 1. Introduction This paper is designed to answer a problem posed in [16, Remark and Open Problem 4.5].
    [Show full text]
  • Lecture 9: Recurrence Relations
    Lecture 9: Recurrence Relations Matthew Fricke Definition Examples Guess and Check Lecture 9: Recurrence Relations Binary Search Characteristic Equation Matthew Fricke Method The Fibonacci Sequence Golden Ratio July 15, 2013 Gambler's Ruin Lecture 9: Recurrence Relations This Lecture Matthew Fricke Definition 1 Definition Examples Guess and 2 Examples Check Binary Search 3 Guess and Check Characteristic Equation Method 4 Binary Search The Fibonacci Sequence Golden Ratio 5 Characteristic Equation Method Gambler's Ruin 6 The Fibonacci Sequence 7 Golden Ratio 8 Gambler's Ruin • Recurrence relations are closely tied to differential equations because they are both self referential. • A differential equation relates a function to its own derivative. • The discrete version of a differential equation is a difference equation. • Sometimes people call recurrence relations difference equations but really difference equations are just a type of recurrence relation. • Some of the techniques for solving recurrence relations are almost the same as those used to solve differential equations. Lecture 9: Recurrence Relations What are Recurrence Relations? Matthew Fricke • A recurrence relation is an equation that defines a value in Definition a sequence using previous values in the sequence. Examples Guess and Check Binary Search Characteristic Equation Method The Fibonacci Sequence Golden Ratio Gambler's Ruin • A differential equation relates a function to its own derivative. • The discrete version of a differential equation is a difference equation. • Sometimes people call recurrence relations difference equations but really difference equations are just a type of recurrence relation. • Some of the techniques for solving recurrence relations are almost the same as those used to solve differential equations.
    [Show full text]
  • EQUATIONS and REWRITE RULES a Survey
    Stanford Verification Group January 1980 Report No. 15 Computer Science Department Report No. STAN-CS-80-785 EQUATIONS AND REWRITE RULES A Survey bY Gerard Huet and Derek C. Oppen Research sponsored by National Science Foundation Air Force Office of Scientific Research COMPUTER SCIENCE DEPARTMENT Stanford University Stanford Verification Group ‘January 1980 Report No. 15 Computer Science Department Report No. STAN-CS-80-786 EQUATIONS AND REWRITE RULES A Survey Gerard Huet and Derek C. Oppen ABSTRACT Equations occur frequently in mathematics, logic and computer science. in this paper, we survey the main results concerning equations, and the methods avilable for reasoning about them and computing with them. The survey is self-contained and unified, using traditional abstract algebra. Reasoning about equations may involve deciding if an equation follows from a given set of equations (axioms), or if an equation is true in a given theory. When used in this manner, equations state properties that hold between objects. Equations may also be used as definitions; this use is well known in computer science: programs written in applicative languages, abstract interpreter definitions, and algebraic data type definitions are clearly of this nature. When these equations are regarded as oriented “rewrite rules”, we may actually use them to compute. In addition to covering these topics, we discuss the problem of “solving*’ equations (the “unification” problem), the problem of proving termination of sets of rewrite rules, and the decidability and complexity of word problems and of combinations of equat i onal theories. We restrict ourselves to first-order equations, and do not treat equations which define non-terminating computations or recent work on rewrite rules applied to equational congruence classes.
    [Show full text]
  • Rewriting Abstract Reduction Relations
    A Change in Notation From now on, when we write Γ j= ', 22c:295 Seminar in AI — Decision Procedures we will assume that all the free variables of ' and of each formula in Γ are universally quantified. Rewriting This is done for convenience, but note that it does change the Cesare Tinelli meaning of j= for non-closed formulas. [email protected] Example The University of Iowa Without implicit quantifiers: p(x) 6j= p(y). With the implicit quantifiers: p(x) j= p(y). Copyright 2004-05 — Cesare Tinelli and Clark Barrett. a a These notes were developed from a set of lecture notes originally written by Clark Barrett at New York University. These notes are copyrighted material and may not be used in other course settings outside of the University of Iowa in their current form or modified form without the express written permission of the copyright holders. Spring 04, 22c:295 Notes: Rewriting – p.1/25 Spring 04, 22c:295 Notes: Rewriting – p.3/25 Outline Rewriting • Rewriting Consider the general problem of establishing E j= s = t where E • Termination is a set of equations. • Completion Congruence closure handles the case when all equations are ground. (How?) Sources: There cannot be a simple procedure for the more general case Harrison, John. Introduction to Logic and Automated because first order logic with equality is, in general, undecidable. Theorem Proving. Unpublished manuscript. Used by permission. However, often the kind of equational reasoning needed is straightforward: equations are used in a predictable direction to simplify expressions. Using equations in a directional fashion is called rewriting, and there are indeed cases when this technique gives us a decision procedure.
    [Show full text]