implementation of a fast congruence closure algorithm
play

Implementation of a Fast Congruence Closure Algorithm Patrick Bahr - PowerPoint PPT Presentation

Introduction Congruence Closure and Decision Algorithm Conclusive Remarks Implementation of a Fast Congruence Closure Algorithm Patrick Bahr s0404888@inf.tu-dresden.de Technische Universitt Dresden December 17, 2007 Patrick Bahr


  1. Introduction Congruence Closure and Decision Algorithm Conclusive Remarks Implementation of a Fast Congruence Closure Algorithm Patrick Bahr s0404888@inf.tu-dresden.de Technische Universität Dresden December 17, 2007 Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  2. Introduction Congruence Closure and Decision Algorithm Conclusive Remarks Outline Introduction 1 Motivation Preliminaries Congruence Closure and Decision Algorithm 2 Congruence Closure Algorithm Decision Algorithm Conclusive Remarks 3 Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  3. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Outline Introduction 1 Motivation Preliminaries Congruence Closure and Decision Algorithm 2 Congruence Closure Algorithm Decision Algorithm Conclusive Remarks 3 Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  4. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Word Problem of Equational Logic Given: Finite set of equations E , and a single equation s ≈ t Question: E | = s ≈ t , i.e., follows s ≈ t from the equations in E ? Definition E | = s ≈ t , also written s ≈ E t , iff every model of E is a model of s ≈ t . That is, for all algebras A we have: A | A | = s ≈ t = E implies Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  5. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Solving the Word Problem: Rewriting Systems Idea: Read E as rewriting rules, i.e., equations in E are only “applied” from left to right. If the resulting rewriting system → E can be proven terminating and confluent s ≈ E t is decidable by checking s ↓ = t ↓ . If it’s not: Use Knuth-Bendix completion to create an equivalent rewriting system that can be proven terminating and confluent. Of course, this procedure does not always succeed! It does if all equations in E are ground! Hence, s ≈ E t is decidable if E is ground. Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  6. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Solving the Word Problem: Congruence Closure If E is ground, there is an alternative solution. Theorem Let Σ be a signature and E be a set of ground Σ -equations. ≈ E is the smallest congruence relation containing E. If we restrict ourselves to the subterms in E , s and t this congruence closure is computable. Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  7. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Congruence Definition Let Σ be a signature and ≡ an equivalence relation on T Σ . ≡ is called a congruence relation if the following condition holds: If for some k ≥ 0 we have t i ≡ s i for all 1 ≤ i ≤ k and f ∈ Σ ( k ) then also f ( t 1 , . . . , t k ) ≡ f ( s 1 , . . . , s k ) . Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  8. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Representing and Manipulating Equivalence Relations General idea: Represent the equivalence relation as its quotient set, i.e. the set of all equivalence classes. Operation find to get the equivalence class of a given element. Operation union to combine two equivalence classes. Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  9. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Representing and Manipulating Equivalence Relations General idea: Represent the equivalence relation as its quotient set, i.e. the set of all equivalence classes. Operation find to get the equivalence class of a given element. Operation union to combine two equivalence classes. Two different approaches: Represent the quotient set as a lookup table mapping from elements to equivalence class names. find: O ( 1 ) ; union: O ( n ) . � Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  10. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Representing and Manipulating Equivalence Relations General idea: Represent the equivalence relation as its quotient set, i.e. the set of all equivalence classes. Operation find to get the equivalence class of a given element. Operation union to combine two equivalence classes. Two different approaches: Represent the quotient set as a lookup table mapping from elements to equivalence class names. find: O ( 1 ) ; union: O ( n ) . � Represent the quotient set as a forest, where each tree represents an equivalence class. The root of a tree is the canonical representative of the class. find: O ( n ) ; union: O ( 1 ) . � Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  11. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Representing and Manipulating Equivalence Relations General idea: Represent the equivalence relation as its quotient set, i.e. the set of all equivalence classes. Operation find to get the equivalence class of a given element. Operation union to combine two equivalence classes. Two different approaches: Represent the quotient set as a lookup table mapping from elements to equivalence class names. find: O ( 1 ) ; union: O ( n ) . � Represent the quotient set as a forest, where each tree represents an equivalence class. The root of a tree is the canonical representative of the class. find: O ( n ) ; union: O ( 1 ) . � Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  12. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Equivalence Classes as Trees (1) Equivalence class c 1 = { v 0 , v 1 , v 2 , v 3 , v 4 } Equivalence class c 2 = { u 0 , u 1 , u 2 } c 1 : v 0 c 2 : u 0 v 1 v 2 u 1 u 2 v 3 v 4 operation find traverses up the tree until the root is reached. e.g. find ( R , v 4 ) = find ( R , v 2 ) = v 0 operation union takes two roots of some trees, and makes one of them child of the other. Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  13. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Equivalence Classes as Trees (2) E.g. union ( R , v 0 , u 0 ) produces the following: v 0 u 0 v 1 v 2 u 1 u 2 v 3 v 4 We now have only one class c = c 1 ∪ c 2 = { v 0 , v 1 , v 2 , v 3 , v 4 , u 0 , u 1 , u 2 } represented by the node v 0 Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  14. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Terms as Digraphs Terms will be interpreted as labelled graphs in the following. Definition Let Σ be a signature, t ∈ T Σ and E a set of ground Σ -equations. (i) The labelled digraph G t = ( V t , E t , l t ) , where V t = P os ( t ) , t | ∃ i ∈ ◆ . p ′ = pi } and l ( p ) = t ( p ) for all p ∈ V t , E t = { ( p , p ′ ) ∈ V 2 for each node p ∈ V t the set of successors of p is ordered by p 1 < · · · < pk , is called the graph of t . Note that G t is a tree. By v t ∈ V t we denote the root of this tree. s ≈ s ′ G s ⊎ G s ′ is called the graph of E . (ii) The graph G E = � Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  15. Introduction Motivation Congruence Closure and Decision Algorithm Preliminaries Conclusive Remarks Achieving Congruence Definition Let Σ be a signature, G = ( V , E , l : V → Σ) a labelled digraph, v a node in G , v 1 < · · · < v k its successors and R ∈ Eq G , C . The Σ , C -signature of v w.r.t. R is the ( k + 1 ) -tuple sig ( R , v ) = ( l ( v ) , find ( R , v 1 ) , . . . , find ( R , v k )) . Nodes having the same Σ , C -signature should be in the same equivalence class to achieve congruence! Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  16. Introduction Congruence Closure Algorithm Congruence Closure and Decision Algorithm Decision Algorithm Conclusive Remarks Outline Introduction 1 Motivation Preliminaries Congruence Closure and Decision Algorithm 2 Congruence Closure Algorithm Decision Algorithm Conclusive Remarks 3 Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  17. Introduction Congruence Closure Algorithm Congruence Closure and Decision Algorithm Decision Algorithm Conclusive Remarks The Idea of the Algorithm Every term of the equations is interpreted as a graph. Every node is put into a singleton class. Roots of terms that are equal are put in the same equivalence class using union. Until no further changes can be derived the following is repeated: Find nodes that have the same Σ , C -signature but are in different equivalence classes. Combine the equivalence classes of these two nodes. Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

  18. Introduction Congruence Closure Algorithm Congruence Closure and Decision Algorithm Decision Algorithm Conclusive Remarks An Example (1) Graph of the set { g ( f ( a ) , c ) ≈ g ( a , f ( a )) } g g f c a f a a Patrick Bahr Implementation of a Fast Congruence Closure Algorithm

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend