rewriting
play

Rewriting Part 5. Confluence of Term Rewriting Systems Temur Kutsia - PowerPoint PPT Presentation

Rewriting Part 5. Confluence of Term Rewriting Systems Temur Kutsia RISC, JKU Linz Confluence Is Undecidable The following problem is undecidable: Given: A finite TRS R . Question: Is R confluent or not? Confluence Is Undecidable The


  1. Rewriting Part 5. Confluence of Term Rewriting Systems Temur Kutsia RISC, JKU Linz

  2. Confluence Is Undecidable The following problem is undecidable: Given: A finite TRS R . Question: Is R confluent or not?

  3. Confluence Is Undecidable The following problem is undecidable: Given: A finite TRS R . Question: Is R confluent or not? Proof. Idea: ▸ Given a set of identities E such that V ar ( l ) ≈ V ar ( l ) for all l ≈ r ∈ E , l and r not being variables. ▸ Construct a TRS whose confluence problem is equivalent to the ground word problem for E . ▸ Undecidability of the ground word problem for E (see e.g. Example 4.1.4 from the book of Baader and Nipkow) will imply undecidability of the confluence problem.

  4. Confluence Is Undecidable The following problem is undecidable: Given: A finite TRS R . Question: Is R confluent or not? Proof. Construction of a TRS: 1. R ∶= E ∪ E − 1 is a confluent TRS. 2. R st ∶= R ∪ { a → s,a → t } , where s and t are given ground terms and a is a new constant. 3. R st is confluent iff s ≈ E t . Hence, the ground word problem for E reduces to the confluence problem for R s,t .

  5. A Decidable Subcase Theorem 5.1 For terminating TRSs, confluence is decidable. Proof idea: ▸ By Newman’s lemma, if a TRS is terminating and locally confluent, then it is confluent. ▸ To prove the theorem, we need to prove that local confluence is decidable for terminating TRSs.

  6. How to Test Local Confluence? Local confluence: y 1 x ∗ y 2 z ∗

  7. How to Test Local Confluence? To test for local confluence of → R , consider reductions: s l 1 → r 1 l 2 → r 2 t 1 t 2 That means, there are rules l 1 → r 1 ,l 2 → r 2 ∈ R , positions p 1 ,p 2 ∈ P os ( s ) , and substitutions σ 1 ,σ 2 such that ▸ s ∣ p 1 = σ 1 ( l 1 ) and t 1 = s [ σ 1 ( r 1 )] p 1 . ▸ s ∣ p 2 = σ 2 ( l 2 ) and t 2 = s [ σ 2 ( r 2 )] p 2 . Consider several cases, depending on the relative positions of p 1 and p 2 .

  8. How to Test Local Confluence? Case 1: p 1 and p 2 are parallel positions. Example: R ∶ = { f ( a,g ( x )) → f ( x,x ) , g ( b ) → c } Peak: f ( g ( b ) ,g ( b )) p 1 = 1 p 2 = 2 f ( c,g ( b )) f ( g ( b ) ,c )

  9. How to Test Local Confluence? Case 1: p 1 and p 2 are parallel positions. Outcome: The reducts are joinable.

  10. How to Test Local Confluence? Case 1: p 1 and p 2 are parallel positions. Outcome: The reducts are joinable. Example: R ∶ = { f ( a,g ( x )) → f ( x,x ) , g ( b ) → c } Peak: f ( g ( b ) ,g ( b )) p 1 = 1 p 2 = 2 f ( c,g ( b )) f ( g ( b ) ,c ) Joinability: f ( c,g ( b )) → f ( c,c ) f ( g ( b ) ,c ) → f ( c,c )

  11. How to Test Local Confluence? Case 2: One position is a prefix of another. Say, p 1 is a prefix of p 2 : p 2 = p 1 p for some p .

  12. How to Test Local Confluence? Case 2: One position is a prefix of another. Say, p 1 is a prefix of p 2 : p 2 = p 1 p for some p . We restrict our attention to σ 1 ( l 1 ) , because σ 1 ( l 1 ) σ 1 ( l 1 )[ σ 2 ( r 2 )] p σ 1 ( r 1 ) ∗ ∗ t ∗ ∗ implies s [ σ 1 ( r 1 )] p 1 � → s [ t ] ← � s [ σ 1 ( l 1 )[ σ 2 ( r 2 )] p ] p 1 = s [ σ 2 ( r 2 )] p 2 .

  13. How to Test Local Confluence? Case 2.1: The redex σ 2 ( l 2 ) does not overlap with l 1 itself, but is contained in σ 1 . p = q 1 q 2 such that q 1 is a variable position in l 1 . σ 1 ( l 1 ) has the form: Non-critical overlap.

  14. How to Test Local Confluence? Case 2.1: The redex σ 2 ( l 2 ) does not overlap with l 1 itself, but is contained in σ 1 . p = q 1 q 2 such that q 1 is a variable position in l 1 . Example: R ∶ = { f ( a,g ( x )) → f ( x,x ) , g ( b ) → c } Peak: f ( a,g ( g ( g ( b )))) p 1 = ǫ p 2 = 211 f ( g ( g ( b )) ,g ( g ( b ))) f ( a,g ( g ( c ))) l 1 = f ( a,g ( x )) , σ 1 = { x ↦ g ( g ( b ))} , l 2 = g ( b ) , σ 2 = ε . p = 211 , q 1 = 21 , q 2 = 1 .

  15. How to Test Local Confluence? Case 2.1: The redex σ 2 ( l 2 ) does not overlap with l 1 itself, but is contained in σ 1 . p = q 1 q 2 such that q 1 is a variable position in l 1 . Outcome: The reducts are joinable. The analysis is complicated by the fact that x = l 1 ∣ q 1 may occur repeatedly both in l 1 and r 1 .

  16. How to Test Local Confluence? Case 2.1: Instance: x appears three times in l 1 and twice in r 1 .

  17. How to Test Local Confluence? Case 2.1: The redex σ 2 ( l 2 ) does not overlap with l 1 itself, but is contained in σ 1 . p = q 1 q 2 such that q 1 is a variable position in l 1 . Example: R ∶ = { f ( a,g ( x )) → f ( x,x ) , g ( b ) → c } Peak: f ( a,g ( g ( g ( b )))) p 1 = ǫ p 2 = 211 f ( g ( g ( b )) ,g ( g ( b ))) f ( a,g ( g ( c ))) The reducts are joinable. 2 f ( g ( g ( b )) ,g ( g ( b )) � → f ( g ( c ) ,g ( c )) . f ( a,g ( g ( c ))) → f ( g ( c ) ,g ( c )) .

  18. How to Test Local Confluence? Case 2.2: Two left-hand sides l 1 and l 2 overlap. p ∈ P os ( l 1 ) , l 1 ∣ p is not a variable, and σ 1 ( l 1 ∣ p ) = σ 2 ( l 2 ) . σ 1 ( l 1 ) has the form: Critical overlap.

  19. How to Test Local Confluence? Case 2.2: Two left-hand sides l 1 and l 2 overlap. p ∈ P os ( l 1 ) , l 1 ∣ p is not a variable, and σ 1 ( l 1 ∣ p ) = σ 2 ( l 2 ) . In the case of critical overlap, local confluence need not hold. Example: R ∶ = { f ( a,g ( x )) → f ( x,x ) , g ( b ) → c } f ( a,g ( b )) p 1 = ǫ p 2 = 2 f ( b,b ) f ( a,c ) l 1 = f ( a,g ( x )) , σ 1 = { x ↦ b } , l 2 = g ( b ) , σ 2 = ε . p = 2 .

  20. How to Test Local Confluence? Case 2.2: Two left-hand sides l 1 and l 2 overlap. p ∈ P os ( l 1 ) , l 1 ∣ p is not a variable, and σ 1 ( l 1 ∣ p ) = σ 2 ( l 2 ) . Problem: Critical overlaps must be checked for local confluence. How to do that? Answer: It is enough to check finitely many critical pairs.

  21. How to Test Local Confluence? Definition 5.1 Let ▸ l 1 → r 1 and l 2 → r 2 be two rules which do not share variables, ▸ p ∈ P os ( l 1 ) be a position such that l 1 ∣ p is not a variable, and ▸ ϑ be an mgu of l 1 ∣ p and l 2 Then the pair ⟨ ϑ ( r 1 ) ,ϑ ( l 1 )[ ϑ ( r 2 )] p ⟩ is called a critical pair. ϑ ( l 1 ) ϑ ( r 1 ) ϑ ( l 1 )[ ϑ ( r 2 )] p

  22. How to Test Local Confluence? ▸ The critical pairs of a TRS R are the critical pairs between any of two of its renamed rules and are denoted by CP ( R ) . ▸ Includes overlaps of a rule with a renamed copy of itself.

  23. How to Test Local Confluence? Example 5.1 ▸ Let R ∶ = { f ( f ( x )) → g ( x )} . ▸ Take a critical pair between the rule and its renamed copy, f ( f ( x )) → g ( x ) and f ( f ( y )) → g ( y ) f ( f ( f ( x ))) g ( f ( x )) f ( g ( x )) ▸ The terms in the critical pair, g ( f ( x )) and f ( g ( x )) , are not joinable. ▸ R is not locally confluent.

  24. How to Test Local Confluence? ▸ Hence, local confluence test reduces to checking joinability of critical pairs. ▸ The analysis of the cases on the previous slides leads to the Critical Pair Lemma.

  25. How to Test Local Confluence? Lemma 5.1 (Critical Pair Lemma) If R is a TRS and s l 1 → r 1 ∈ R l 2 → r 2 ∈ R t 1 t 2 then t 1 ↓ R t 2 , or t 1 = s [ u 1 ] p 1 and t 2 = s [ u 2 ] p 2 for some p 1 ,p 2 , where ⟨ u 1 ,u 2 ⟩ or ⟨ u 2 ,u 1 ⟩ is an instance of a critical pair of R . Proof. ▸ When there is no overlap or a non-critical overlap, then t 1 ↓ R t 2 . ▸ When there is a critical overlap, then s ∣ p 1 = σ ( l 1 ) and σ ( l 1 ∣ p ) = σ ( l 2 ) .

  26. How to Test Local Confluence? Lemma 5.1 (Critical Pair Lemma) If R is a TRS and s l 1 → r 1 ∈ R l 2 → r 2 ∈ R t 1 t 2 then t 1 ↓ R t 2 , or t 1 = s [ u 1 ] p 1 and t 2 = s [ u 2 ] p 2 for some p 1 ,p 2 , where ⟨ u 1 ,u 2 ⟩ or ⟨ u 2 ,u 1 ⟩ is an instance of a critical pair of R . Proof (cont.) ▸ Hence, σ unifies l 1 ∣ p and l 2 and, therefore, is an instance of their mgu ϑ . ▸ Therefore, ⟨ σ ( r 1 ) ,σ ( l 1 )[ σ ( r 2 )] p ⟩ is an instance of the critical pair ⟨ ϑ ( r 1 ) ,ϑ ( l 1 )[ ϑ ( r 2 )] p ⟩

  27. How to Test Local Confluence? Lemma 5.1 (Critical Pair Lemma) If R is a TRS and s l 1 → r 1 ∈ R l 2 → r 2 ∈ R t 1 t 2 then t 1 ↓ R t 2 , or t 1 = s [ u 1 ] p 1 and t 2 = s [ u 2 ] p 2 for some p 1 ,p 2 , where ⟨ u 1 ,u 2 ⟩ or ⟨ u 2 ,u 1 ⟩ is an instance of a critical pair of R . Proof (cont.) ▸ t 1 = s [ σ ( r 1 )] p 1 , t 2 = s [ σ ( l 1 )[ σ ( r 2 )] p ] p 1 , p 2 = p 1 p .

  28. How to Test Local Confluence? Theorem 5.2 (Critical Pair Theorem) A TRS is locally confluent iff all its critical pairs are joinable. Proof. ( ⇐ ) Using the Critical Pair Lemma: Given t i = s [ u i ] p , i = 1 , 2 , where ⟨ u 1 ,u 2 ⟩ (wlog) is an instance of some critical pair ∗ ⟨ v 1 ,v 2 ⟩ under a substitution ϕ , then v i � → t for some term t ∗ ∗ implies u i � → ϕ ( t ) and, hence, t i � → s [ ϕ ( t )] p , i = 1 , 2 .

  29. How to Test Local Confluence? Theorem 5.2 (Critical Pair Theorem) A TRS is locally confluent iff all its critical pairs are joinable. Proof. ( ⇐ ) Using the Critical Pair Lemma: Given t i = s [ u i ] p , i = 1 , 2 , where ⟨ u 1 ,u 2 ⟩ (wlog) is an instance of some critical pair ∗ ⟨ v 1 ,v 2 ⟩ under a substitution ϕ , then v i � → t for some term t ∗ ∗ implies u i � → ϕ ( t ) and, hence, t i � → s [ ϕ ( t )] p , i = 1 , 2 . ( ⇒ ) Every critical pair is the product of a fork ϑ ( r 1 ) ← ϑ ( l 1 ) → ϑ ( l 1 )[ ϑ ( r 2 )] p . Joinability follows from local confluence.

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