automated termination analysis
play

Automated Termination Analysis J urgen Giesl LuFG Informatik 2, - PowerPoint PPT Presentation

Automated Termination Analysis J urgen Giesl LuFG Informatik 2, RWTH Aachen University, Germany VTSA 12, Saarbr ucken, Germany Overview I. Termination of Term Rewriting 1 Termination of Term Rewrite Systems 2 Non-Termination of Term


  1. p DP p R q , R q . Dependency Pair Framework Procedure p p P , R q q � tp P 1 , R 1 q , . . . , p P n , R n qu or “no” 1. Start with the initial DP problem p P i , R i q are finite, then p P , R q is finite 2. Transform a remaining DP problem by a sound processor. p P i , R i q is infinite or Proc pp P , R qq � p P , R q is infinite 3. If result is “no” and all processors were complete, return “no” . If there is no remaining DP problem, then return “yes” . Otherwise go to 2. p DP p R q , R q is finite. DP processor: Proc Proc is sound: if all “no” , Proc is complete: if some then Theorem A TRS terminates iff

  2. p DP p R q , R q . Dependency Pair Framework Procedure 1. Start with the initial DP problem 2. Transform a remaining DP problem by a sound processor. 3. If result is “no” and all processors were complete, return “no” . If there is no remaining DP problem, then return “yes” . Otherwise go to 2. Remaining Lecture on Dependency Pairs I. DP Processors for Proving Termination II. DP Processors for Proving Innermost Termination III. DP Processors from Other Termination Techniques

  3. p p P , R q q � tp P 1 , R q , . . . , p P n , R qu I. DP Processors for Proving Termination p p P , R q q � tp P 1 , R 1 qu Dependency Graph Processor Reduction Pair Processor Processors only modify P : Proc Rule Removal Processor Processor modifies P and R : Proc

  4. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , s p y q q � M p x, y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q p p P , R q q � t p P 1 , R q , . . . , p P n , R q u R : minus D p s p x q , s p y qq � D p minus p x, y q , s p y qq p P , R q -dependency graph div D p s p x q , s p y qq � M p x, y q div M p s p x q , s p y qq � M p x, y q Dependency Graph Processor (sound & complete) p P , R q -Dependency Graph Proc ❄ where P 1 , . . . , P n � t to v � w iff s � t, v � w is a p P , R q -chain are the SCCs of the ❄ ❄ ✻ directed graph whose nodes are the pairs of P arc from s

  5. P 1 : M p s p x q , s p y q q � M p x, y q p x, 0 q � x minus p s p x q , s p y q q � minus p x, y q P 2 : D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q p � , � q such that � r for all rules l � r in R � t for all dependency pairs s � t . p � , � q is a reduction pair iff R : minus � is stable and well founded � is stable and monotonic div � and � are compatible ( � � � � � � � � � � ) div Theorem A TRS R is terminating iff there is a reduction pair l s � � � � � s 2 σ � � s 3 σ � � . . . or Automation: t 1 , t 2 , t 3 , . . . s 1 s 2 s 3 s 1 σ q t 1 σ q t 2 σ q t 3 σ p p p

  6. P 1 : M p s p x q , s p y q q � M p x, y q p x, 0 q � x minus p s p x q , s p y q q � minus p x, y q P 2 : D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q p p P , R q q � t p P z P q u � , R R : minus � r for all rules l � r in R � R � � t or s � t for all s � t in P Y P � P div � � div p P 1 , R q : Reduction Pair Processor (sound & complete) P 1 : M p s p x q , s p y q q � q M p x, y q minus p x, 0 q � x p s p x q , s p y q q � minus p x, y q if Proc p s p t qq � 1 � P ol p t q P 2 : D p s p x q , s p y q q � D p s p y qq p 0 , s p y qq � 0 p f p t 1 , t 2 qq � P ol p t 1 q p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q l R s P Resulting Inequalities for R : p minus div P ol div P ol

  7. P 1 : M p s p x q , s p y q q � M p x, y q p x, 0 q � x minus p s p x q , s p y q q � minus p x, y q P 2 : D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q p p P , R q q � t p P z P q u if � , R R : minus � r for all rules l � r in R � R � � t or s � t for all s � t in P Y P � P div � � div p P 2 , R q : Reduction Pair Processor (sound & complete) P 2 : D p s p x q , s p y q q � q D p minus p x, y q , s p y q q minus p 0 , s p y qq � 0 p s p t qq � P ol p t q � 1 p s p x q , s p y q q � minus p x, y q Proc P 2 : D p s p x q , s p y q q � D p s p y qq p 0 , s p y qq � 0 p f p t 1 , t 2 qq � P ol p t 1 q p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q l R s P Resulting Inequalities for p minus P ol div P ol div

  8. P 1 : M p s p x q , s p y q q � M p x, y q p x, 0 q � x minus p s p x q , s p y q q � minus p x, y q P 2 : D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q p DP p R q , R q R : minus p P 1 , R q p P 2 , R q div div p ∅ , R q p ∅ , R q Dep. Graph � ������ � � � � � Termination is proved Red. Pair Red. Pair automatically! Dep. Graph Dep. Graph ∅ ∅

  9. P : M p s p x q , s p y q q � M p p p s p x q q , p p s p y q q q p s p x qq � x M p x, plus p y, z qq � M p minus p x, y q , z q p x, 0 q � x M p x, plus p y, z qq � M p x, y q minus p s p x q , s p y q q � minus p p p s p x q q , p p s p y q q q R : p minus DP problem for minus hard to solve automatically!

  10. P : M p s p x q , s p y q q � M p p p s p x q q , p p s p y q q q p s p x qq � x M p x, plus p y, z qq � M p minus p x, y q , z q p x, 0 q � x M p x, plus p y, z qq � M p x, y q minus p s p x q , s p y q q � minus p p p s p x q q , p p s p y q q q p p P , R q q � t p P z P z R q u � , R � � r or l � r for all l � r in R Y R � R R : p � � � t or s � t for all s � t in P Y P � P minus � � � is monotonic Rule Removal Processor (sound & complete) if Proc p f p t 1 , . . . , t n qq � 1 � P ol p t 1 q � . . . � P ol p t n q l R p f p t 1 , . . . , t n qq � 1 � P ol p t 1 q � . . . � P ol p t n q s P Automation count number of s -symbols try P ol or P ol

  11. P : M p s p x q , s p y q q � M p p p s p x q q , p p s p y q q q z R p s p x qq � x � : p M p x, plus p y, z qq � M p minus p x, y q , z q p x, 0 q � x M p x, plus p y, z qq � M p x, y q p s p x q , s p y q q � minus p p p s p x q q , p p s p y q q q p p P , R q q � t p P z P z R q u � , R � � r or l � r for all l � r in R Y R � R R � � � t or s � t for all s � t in P Y P � P minus � � � is monotonic minus Rule Removal Processor (sound & complete) p P , R z R q is transformed into ∅ by the Dep. Graph Processor if Proc � l R s P Termination is proved automatically!

  12. p P , R , e q with e P t t , i u for t ermination or i nnermost termination p g p x q , s p 0 q , y q � p y, y, g p x qq II. DP Processors for Proving Innermost Termination p s p x qq � p g p x qq p 0 q � Component for the evaluation strategy p gs0 , s0 , gs0 q � f p gs0 , gs0 , gs0 q � f p gs0 , sg0 , gs0 q f f � f p gs0 , s0 , gs0 q � . . . g s g 0 Infinite (non-innermost) reduction: f

  13. p P , R , e q p P , R , e q is finite iff p P , R , e q -chain Dependency Pair Framework p p P , R , e q q � tp P 1 , R 1 , e 1 q , . . . , p P n , R n , e n qu Basic Idea examine DP problems a DP problem there is no infinite p DP p R q , R , e q is finite. termination techniques should operate on DP problems: DP processor: Proc Theorem A TRS R terminates (innermost) iff

  14. F p g p x q , s p 0 q , y q � F p y, y, g p x qq p g p x q , s p 0 q , y q � p y, y, g p x qq F p g p x q , s p 0 q , y q � p x q p s p x qq � s p g p x qq p s p x qq � p x q p 0 q � p p P , R , e q q � t p P 1 , R , e q , . . . , p P n , R , e q u P : R : f f G g p g p x q , s p 0 q , y q � F p y, y, g p x qq G G g 0 p P , R , e q -dependency graph p g p x q , s p 0 q , y q � G p x q G p s p x q q � G p x q Dependency Graph Processor (sound & complete) Proc p P , R , e q -Dependency Graph where P 1 , . . . , P n F � t to v � w iff s � t, v � w is a p P , R , e q -chain are the SCCs of the F ❄ ✻ directed graph whose nodes are the pairs of P arc from s

  15. p s p x qq � p x q p g p x q , s p 0 q , y q � p y, y, g p x qq F p g p x q , s p 0 q , y q � p x q p s p x qq � s p g p x qq F p g p x q , s p 0 q , y q � F p y, y, g p x qq p 0 q � p p P , R , i q q � t p P , U p P , R q , i q u P : G G R : f f G g g 0 p P , R q � ∅ Usable Rule Processor (sound) Proc U

  16. p s p x qq � p x q p P , R q : p g p x q , s p 0 q , y q p y, y, g p x qq F p g p x q , s p 0 q , y q � p x q p p P , R , i q q � t p P , U p P , R q , i q u P : G G U f f G p s p x qq � G p x q Usable Rule Processor (sound) Proc example is trivial with Reduction Pair Processor: G Innermost termination is proved automatically! Completeness of processor can be achieved: sophisticated representation of the evaluation strategy, not just flag e

  17. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , s p y q q � M p x, y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q � i : � Proc often more powerful if e � i R : minus � prove innermost termination instead of termination, if possible div div Advantage of e p p P , R , t q q � t p P , R , i q u if innermost termination is easier to prove than termination Modular Non-Overlap Check Processor (sound & complete) Proc R has no critical pairs with P R is locally confluent

  18. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , s p y q q � M p x, y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , s p y q q � D p minus p x, y q , s p y q q p 0 , s p y qq � 0 p s p x q , s p y q q � s p div p minus p x, y q , s p y q q q p P , R , t q is replaced by p P , R , i q R : minus div div Example: p p P , R , t q q � t p P , R , i q u if it suffices to prove innermost termination Modular Non-Overlap Check Processor (sound & complete) Proc R has no critical pairs with P R is locally confluent

  19. p R q implies termination of R p R q III. DP Processors from Other Techniques Termination Technique " TT maps TRSs to TRSs p R q � TT is is sound: if termination of TT TT is complete: if termination of R implies termination of TT Termination techniques can be transformational or conventional : if termination of R can be proved ∅ , TT otherwise R ,

  20. III. DP Processors from Other Techniques Advantages different techniques can be used for different sub-problems combines benefits of different methods and of dependency pair p p P , R , e q q � t p DP p R q , R 1 , t q u 1 techniques � TT p P Y R q 1 termination techniques with restricted applicability can be used, even if they are not applicable to the whole TRS Termination Technique Processor (sound & complete) Proc where R

  21. p f q � 1 for all f p R q � R � t l � r | l � r P R u � 1 � 1 � 1 III. DP Processors from Other Techniques p b p b p x q q q � b p a p x qq � 1 : p b p a p x q q q � a p b p x qq � 1 : Example : String Reversal only applicable on string rewrite systems (SRS) arity p p P , R , e q q � t p DP p R q , R 1 , t q u (sound & complete) TT 1 � TT p P Y R q 1 R a R b Termination Technique Processor (sound & complete) Proc where R

  22. p s p 0 qq � p s p s p x q q q � p p p s p x q q q fact p 0 q � p 0 q fact p s p x qq � p s p x q , fact p p p s p x q q q q times p . . . q � plus p . . . q � Challenging Example p 0 p s s times . . . . . . Dependency Graph Processor: 4 DP problems for p , fact , times , plus DP problem for fact hard to solve automatically! String reversal not applicable: no SRS

  23. FACT p s p x qq � FACT p p p s p x q q q p s p 0 qq � p s p s p x q q q � s p p p s p x q q q fact p . . . q � p . . . q � p . . . q � P : R : p 0 p p P , R , t q q � t p P , R , i q u if p . . . times . . . plus . . . p P , R , t q is replaced by p P , R , i q Modular Non-Overlap Check Processor (sound & complete) Proc R has no critical pairs with P R is locally confluent it suffices to prove innermost termination

  24. FACT p s p x qq � FACT p p p s p x q q q p P , R q : p s p 0 qq � p s p s p x q q q � s p p p s p x q q q P : U p 0 p p P , R , i q q � t p P , U p P , R q , i q u p p P , R q � t p p s p 0 qq � 0 , p s p s p x q q q � s p p p s p x q q q u Usable Rule Processor (sound) Proc U p

  25. FACT p s p x qq � FACT p p p s p x q q q p s p 0 qq � p s p s p x q q q � s p p p s p x q q q P : R : p 0 p p P , R , e q q � t p P z P z R q u if p � , R � , e � r or l � r for all l � r in R Y R � R � � � t or s � t for all s � t in P Y P � P � � � is monotonic Rule Removal Processor (sound & complete) p f p t 1 , . . . , t n qq � P ol p t 1 q � . . . � P ol p t n q Proc p f p t 1 , . . . , t n qq � P ol p t 1 q � . . . � P ol p t n q � 1 l R s P Automation count number of s -symbols try P ol or P ol

  26. FACT p s p x qq � FACT p p p s p x q q q p s p s p x q q q � s p p p s p x q q q p s p s p x q q q s p p p s p x q q q P : R : p p p P , R , e q q � t p DP p R q , R 1 , t q u 1 p � P Y R 1 � 1 � 1 Termination Technique Processor (sound & complete) p f q � 1 for all f Proc where R String reversal applicable: arity

  27. p R q : S p FACT p x qq � S p p p FACT p x qqq 1 : s p FACT p x qq � s p p p FACT p x qqq p s p p p x q q q � S p p p s p x q q q s p s p p p x q q q � s p p p s p x q q q p s p p p x q q q � S p x q 1 DP R p p P , R , e q q � t p DP p R q , R 1 , t q u 1 S S � P Y R 1 � 1 � 1 s p FACT p x qq � s p p p FACT p x qqq s p s p p p x q q q � s p p p s p x q q q Termination Technique Processor (sound & complete) p s p s p x q q q s p p p s p x q q q Proc where R � 1 : � 1 : P R p

  28. p FACT p x qq � S p p p FACT p x qqq R : s p FACT p x qq � s p p p FACT p x qqq p s p p p x q q q � S p p p s p x q q q s p s p p p x q q q � s p p p s p x q q q p s p p p x q q q � S p x q P : S p p P , R , e q q � t p P 1 , R , e q , . . . , p P n , R , e q u S S p P , R , e q -dependency graph Dependency Graph Processor (sound & complete) Proc where P 1 , . . . , P n are the SCCs of the

  29. p DP p R q , R q p P , R , t q p P , R , i q p P , U p P , R q , i q p P , t p p s p s p x q q q � s p p p s p x q q q u , i q Dep. Graph � � � � ��������� � � � � � � � � � � � � � . . . � . . . . . . � � � p DP p R q , R 1 , t q Mod. NO Check pt S p s p p p x q q q � S p x qu , R 1 , t q Inn. Usable Rules p ∅ , R 1 , t q Termination is Rule Removal proved automatically! TT String Reversal 1 Dep. Graph Rule Removal Dep. Graph ∅

  30. p f p x qq � p g p f p x q q q � t 0 , 1 u � M Semantic Labeling p x q � 0 p x q � x � 1 R : f f � M Choose model for TRS R p f p f p x q q q � 0 � α p f p g p f p x q q q q carrier set M � is a model! for every n -ary symbol f choose interpretation f M : M n f M g M For every variable assignment α : V α

  31. p f p x qq � p g p f p x q q q � t 0 , 1 u � M Semantic Labeling p x q � 0 p x q � x � 1 R : f f Choose model for TRS R p f 0 p x qq � p g 0 p f 0 p x qqq p x q � 0 p f 1 p x qq � p g 0 p f 1 p x qqq p x q � 1 carrier set M for every n -ary symbol f choose interpretation f M : M n f M g M Label every symbol by interpretation of its argument(s) if α f 0 f 1 if α f 0 f 1 R terminates iff labeled TRS R terminates termination can be proved by LPO if f 0 has highest precedence

  32. p s 0 p 0 qq � p s n p s n p x qqq � p p n p s n p x qqq � 2 � 1 � 1 p 0 q � p 0 q p s n p x qq � p s n p x q , fact n p p n p s n p x qqq q � 1 � 1 p n � 1 ,n � 1 q Semantic Labeling � N � M p 1 0 p n s n fact 0 s 0 fact n times Choose model for TRS R carrier set M for every n -ary symbol f choose interpretation f M : M n

  33. p s 0 p 0 qq � p s n p s n p x qqq � p p n p s n p x qqq � 2 � 1 � 1 p 0 q � p 0 q p s n p x qq � p s n p x q , fact n p p n p s n p x qqq q � 1 � 1 p n � 1 ,n � 1 q Semantic Labeling p x q � p x q � � 1 " 0 , � 0 p 1 0 p x q � � 1 , � 0 p n s n p x q � � 1 fact 0 s 0 p x, y q � � 1 fact n times Choose model for TRS R 0 M 0 � fact n s M x � 1 if x p M if x x fact M x times M y Label every symbol by interpretation of its argument(s) R terminates iff labeled TRS R terminates termination can be proved by LPO if fact n

  34. p b p a p x q q q � p b p b p b p a p x q q q q q � minimum label of lhs p b 0 p a 0 p x qqq � p b 1 p b 1 p b 1 p a 1 p x qqq q q Match–Bounds for String Rewriting p b 1 p a 5 p x qqq � p b 1 p b 1 p b 1 p a 1 p x qqq q q p b 1 p a 5 p x qqq � p b 2 p b 2 p b 2 p a 2 p x qqq q q R : a a match( R ) label symbols of lhs by arbitrary natural numbers label all symbols of rhs by 1 a 0 a 1 a 0 a 1 a 3 a 2 . . .

  35. p b p a p x q q q � p b p b p b p a p x q q q q q � � n ( match-bound ), � match p R q s , the labels in s are Match–Bounds for String Rewriting � R Y t l 1 # � r | l � r P R , l � l 1 l 2 , l i � ε u R : a a Thm 1: If all symbols in t are labeled with 0 and for all t then t is terminating w.r.t. R . p b p a p x q q q � p b p b p b p a p x q q q q q Right-Forward Closures (Dershowitz, 81): p b p # p x q q q � p b p b p b p a p x q q q q q p # p x qq � p b p b p b p a p x q q q q q R # R # : a a a a a a

  36. p b p a p x q q q � p b p b p b p a p x q q q q q � � n ( match-bound ), � match p R q s , the labels in s are P N , Match–Bounds for String Rewriting R : a a � � n ( match-bound ), � Thm 1: If all symbols in t are labeled with 0 and p R # q s , labels in s are for all t t s | r # k � u then t is terminating w.r.t. R . � p R # q s p b p a p x q q q � p b p b p b p a p x q q q q q Thm 2: If r # k terminates w.r.t. R # for all rhs’s r and all k p b p # p x q q q � p b p b p b p a p x q q q q q then R is terminating. p # p x qq � p b p b p b p a p x q q q q q Thm 3: If all symbols in r # k are labeled with 0 and for all r # k match then R is terminating. Construct finite automaton accepting match R # : a a a a a a

  37. p R # q , 1 1 � � Match–Bounds for String Rewriting If there is path from q 1 to q 2 with lhs of match then check if there is path from q 1 to q 2 with corresponding rhs. e If rhs = a w and there is path from q 1 to q 2 with w , then add edge from q 1 to q 1 with a . t s | r # k � u � p R # q s Otherwise, add new path from q 1 to q 2 with a w . p b p a p x q q q � p b p b p b p a p x q q q q q p b p # p x q q q � p b p b p b p a p x q q q q q p # p x qq � p b p b p b p a p x q q q q q � � � � � � � � � � � � � a 0 b 0 b 0 b 0 a 0 � # 0 Construct finite automaton accepting match R # : a a a a a a

  38. p R # q , 1 1 � � � � � � � Match–Bounds for String Rewriting If there is path from q 1 to q 2 with lhs of match then check if there is path from q 1 to q 2 with corresponding rhs. e If rhs = a w and there is path from q 1 to q 2 with w , then add edge from q 1 to q 1 with a . t s | r # k � u � p R # q s Otherwise, add new path from q 1 to q 2 with a w . p b p a p x q q q � p b p b p b p a p x q q q q q p b p # p x q q q � p b p b p b p a p x q q q q q p # p x qq � p b p b p b p a p x q q q q q � � � � � � � � � � � � � � a 0 a 1 b 0 b 0 b 0 b 1 a 0 a 1 b 1 a 1 b 1 � � # 0 Construct finite automaton accepting match R # : a a a a a a

  39. p DP p R q , R q . Implementation Procedure 1. Start with the initial DP problem 2. Transform a remaining DP problem by a sound processor. 3. If result is “no” and all processors were complete, return “no” . If there is no remaining DP problem, then return “yes” . Otherwise go to 2. Strategy decide which DP processor to use in Step 2 use fast processors first only use slower more powerful processors on DP problems that cannot be solved by fast processors

  40. Strategy of AProVE t 0 , 1 u Use the first applicable processor from the following list: 1. Dependency Graph Processor t� 1 , 0 , 1 u 2. Modular Non-Overlap Check Processor 3. Usable Rule Processor t 0 , 1 u 4. A–Transformation Processor 5. Size–Change Processor 6. DP Transformation Processors (in “safe” cases) 7. Rule Removal Processor 8. Reduction Pair Processor: linear polynomials over 9. Termination Technique Processor: Match–Bounds 10. Reduction Pair Processor: LPO with strict precedence 11. DP Transformation Processors (up to a certain limit) 12. Reduction Pair Processor: linear polynomials over 13. Non-Termination Processor 14. Reduction Pair Processor: non-linear polynomials over 15. Reduction Pair Processor: LPO with non-strict precedence 16. Termination Technique Processor: String Reversal 17. Forward–Instantiation Processor 18. Termination Technique Processor: Semantic Labeling

  41. Termination of Term Rewriting DP Framework combines many different termination techniques termination techniques also help for disproving termination non-termination techniques also help for proving termination also possible for innermost termination Improvements development of new DP processors development of strategies how to apply DP processors more efficient algorithms (e.g., using SAT-solvers) AProVE : implements the DP framework winner of Internat. Termination Competition ’04 - ’12 both for termination and non-termination of TRSs http://aprove.informatik.rwth-aachen.de/

  42. Overview I. Termination of Term Rewriting 1 Termination of Term Rewrite Systems 2 Non-Termination of Term Rewrite Systems (FroCoS ’05, IJCAR ’12) 3 Complexity of Term Rewrite Systems 4 Termination of Integer Term Rewrite Systems II. Termination of Programs 1 Termination of Functional Programs (Haskell) 2 Termination of Logic Programs (Prolog) 3 Termination of Imperative Programs (Java)

  43. minus p x, 0 q � minus p s p x q , s p y q q � minus p x, y q p 0 , y q � p s p x q , y q � p div p minus p s p x q , y q , y q q DP Processors for Disproving Termination p s p x q , 0 q � R s p div p minus p s p x q , 0 q , 0 q q � R s p div p s p x q , 0 q q � R . . . x div 0 div s � r sµ s for some term s � R is looping : div Definition (Looping TRS) A TRS R is looping if s R C

  44. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , y q � M p s p x q , y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , y q � D p minus p s p x q , y q , y q p 0 , y q � 0 p s p x q , y q � s p div p minus p s p x q , y q , y q q p P , R q is looping if there is a chain s 1 � t 1 , s 2 � t 2 , . . . , s k � t k with � � � � � 1 � s k σ ) R : minus div div p DP p R q , R q is looping Definition (Looping DP Problem) t 1 σ R s 2 σ, t 2 σ R s 3 σ, . . . � r sµ s for some term s s 1 σ matches s k σ, ( s 1 σ µ k � Theorem A TRS R is looping iff Definition (Looping TRS) A TRS R is looping if s R C

  45. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , y q � M p s p x q , y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , y q � D p minus p s p x q , y q , y q p 0 , y q � 0 p s p x q , y q � s p div p minus p s p x q , y q , y q q p P , R q is looping if there is a chain s 1 � t 1 , s 2 � t 2 , . . . , s k � t k with � � � � � 1 � s k σ ) R : minus div div Definition (Looping DP Problem) D p s p x 1 q , s p y 1 qq � D p minus p s p x 1 q , y 1 q , s p y 1 qq , D p s p x 2 q , s p y 2 qq � . . . D p s p x 1 q , s p 0 qq � D p minus p s p x 1 q , 0 q , s p 0 q q , D p s p x 1 q , s p 0 qq � . . . � r y 1 { 0 , x 2 { x 1 , y 2 { 0 s , µ � identity t 1 σ R s 2 σ, t 2 σ R s 3 σ, . . . s 1 σ matches s k σ, ( s 1 σ µ k Example loops with σ

  46. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , y q � M p s p x q , y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , y q � D p minus p s p x q , y q , y q p 0 , y q � 0 p s p x q , y q � s p div p minus p s p x q , y q , y q q p P , R q is looping if there is a chain s 1 � t 1 , s 2 � t 2 , . . . , s k � t k with � � � � � 1 � s k σ ) R : minus div � Infiniteness div Definition (Looping DP Problem) t 1 σ R s 2 σ, t 2 σ R s 3 σ, . . . p p P , R q q � “no” p P , R q is looping s 1 σ matches s k σ, ( s 1 σ µ k Loopingness Non-Termination Processor (sound & complete) if Proc

  47. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , y q � M p s p x q , y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , y q � D p minus p s p x q , y q , y q p 0 , y q � 0 p s p x q , y q � s p div p minus p s p x q , y q , y q q p P , R q is looping if there is a chain s 1 � t 1 , s 2 � t 2 , . . . , s k � t k with � � � � � 1 � s k σ ) R : minus div div r . . . s Definition (Looping DP Problem) t 1 σ R s 2 σ, t 2 σ R s 3 σ, . . . s 1 σ matches s k σ, ( s 1 σ µ k Advantages of Loop Detection in DP Framework no need to search for context C other processors remove terminating parts: Termination techniques help for disproving termination

  48. P : M p s p x q , s p y q q � M p x, y q p x, 0 q � x D p s p x q , y q � M p s p x q , y q minus p s p x q , s p y q q � minus p x, y q D p s p x q , y q � D p minus p s p x q , y q , y q p 0 , y q � 0 p s p x q , y q � s p div p minus p s p x q , y q , y q q M p s p x q , s p y q q � M p x, y q R : minus div div p s p x q , y q � D p minus p s p x q , y q , y q Dependency Graph Processor results in P 1 : R : . . . easy to prove P 2 : D R : . . . potentially infinite Termination techniques help to identify non-terminating parts!

  49. P : D p s p x q , y q � D p minus p s p x q , y q , y q p x, 0 q � x minus p s p x q , s p y q q � minus p x, y q p 0 , y q � 0 p s p x q , y q � s p div p minus p s p x q , y q , y q q � t � t � � 1 R : minus 1 div div p s p x q , y q � D p minus p s p x q , y q , y q � σ p s p x q , 0 q Detect loops by narrowing: �r y { 0 s start with rhs t of a dependency pair s p s p x q , y q σ p s p x q , 0 q lo o o o o omo o o o o on narrow t repeatedly: s s σ D p s p x q , 0 q check whether matches sσ s D D matches D D

  50. p x, y q � G p x, y q p x, y q � g p x, y q p s p x q , y q � F p y, y q p s p x q , y q � f p y, y q � t � t � � 1 P : F R : f G g 1 p x, y q � G p x, y q � σ p y, y q Detect loops by narrowing: �r x { s p x q s start with rhs t of a dependency pair s p x, y q σ p y, y q lo o omo o on narrow t repeatedly: s s σ p s p x q ,y q check whether and semi-unify sσ s F F unifies with F F F

  51. p 0 , 1 , x q � F p x, x, x q p 0 , 1 , x q � f p x, x, x q p y, z q � y p y, z q � z � t � t � � 1 P : F R : f g 1 g p 0 , 1 , x q � F p x, x, x q Detect loops by narrowing: start with rhs t of a dependency pair s narrow t repeatedly: s s σ check whether and semi-unify sσ s cannot be narrowed! F

  52. p 0 , 1 , x q � F p x, x, x q p 0 , 1 , x q � f p x, x, x q p y, z q � y p y, z q � z p g p 0 , z q , g p y, 1 q , x q � p g p 0 , z q , 1 , x q � p 0 , 1 , x q � F p x, x, x q P : F R : f p g p 0 , z q , g p y, 1 q , x q p x, x, x q g g � t F F F � � t 1 � unifies with F F 1 Detect loops by backward narrowing: start with lhs s of a dependency pair s narrow s with reversed rules: t s σ check whether and tσ semi-unify t

  53. p P , R q in AProVE: Y R left-linear: backward narrowing Y R right-linear: forward narrowing Y R not left- or right-linear: backward narrowing into variables Heuristic for loop detection of If P If P If P To obtain finite search space: each rule may only applied n times for narrowing

  54. Looping vs. Non-Looping Non-Termination Most existing approaches detect loops R C [ C µ [ s µ 2 ] ] → n s → n R C [ s µ ] → n R . . . cannot capture non-periodic infinite rewrite sequences dbl( x ) → mul(s 2 (0) , x ) f(tt , x, y ) → f(gt( x, y ) , dbl( x ) , s( y )) gt(s( x ) , 0) → tt mul( x, 0) → 0 gt(0 , y ) → ff mul( x, s( y )) → plus(mul( x, y ) , x ) gt(s( x ) , s( y )) → gt( x, y ) plus( x, 0) → x plus( x, s( y )) → plus(s( x ) , y ) f(tt , s n (0) , s m (0)) → R f(gt(s n (0) , s m (0)) , dbl(s n (0)) , s m +1 (0)) → m +1 while (gt(x,y)) { R f(tt , dbl(s n (0)) , s m +1 (0)) → R x = dbl(x); m +1 (0)) f(tt , mul(s 2 (0) , s n (0)) , s → 4 · n y = y + 1; } R f(tt , s 2 · n (mul(s 2 (0) , 0)) , s m +1 (0)) → R f(tt , s 2 · n (0) , s m +1 (0)) → R . . . non-terminating, but not looping

  55. Looping vs. Non-Looping Non-Termination Most existing approaches detect loops R C [ C µ [ s µ 2 ] ] → n t → n R C [ s µ ] → n R . . . Method for Loop Detection Let S := R . 1 Check if some s → t ∈ S is a loop. If yes: stop with “non-termination”. 2 Modify some s → t ∈ S by narrowing to obtain s ′ → + R t ′ . 3 Let S := S ∪ { s ′ → t ′ } and go to Step 2. 4 Method for Non-Looping Non-Termination Let S be a set of pattern rules p ֒ → q corresponding to R . 1 Check if some p ֒ → q ∈ S is obviously non-terminating. 2 If yes: stop with “non-termination”. → q ∈ S by narrowing to obtain p ′ ֒ → q ′ . Modify some p ֒ 3 Let S := S ∪ { p ′ ֒ → q ′ } and go to Step 2. 4

  56. Pattern Terms and Pattern Rules Pattern Term n �→ t σ n µ Pattern term p : , t σ 2 µ , t σ 3 µ represents { t µ , t σ µ , ... } . ���� ���� � �� � � �� � p (0) p (1) p (2) p (3) base term t pumping substitution σ closing substitution µ

  57. Pattern Terms and Pattern Rules Pattern Term Pattern Rule t σ n µ Pattern term p : , t σ 2 µ , t σ 3 µ Pattern rule : p ֒ → q represents { t µ , t σ µ , ... } . ���� ���� � �� � � �� � where p, q are pattern terms p (0) p (1) p (2) p (3) base term t p ֒ → q is correct w.r.t. TRS R pumping substitution σ p ( n ) → + if ∀ n ∈ N : R q ( n ) closing substitution µ Example: p = gt(s( x ) , s( y )) [ x/ s( x ) , y/ s( y )] n [ x/ s( x ) , y/ 0] represents { gt(s 2 ( x ) , s(0)) , gt(s 3 ( x ) , s 2 (0)) , gt(s 4 ( x ) , s 3 (0)) , . . . } � �� � � �� � � �� � p (0) p (1) p (2) Example: gt(s( x ) , s( y )) [ x/ s( x ) , y/ s( y )] n [ x/ s( x ) , y/ 0] tt ∅ n ∅ ֒ → gt(s n +2 ( x ) , s n +1 (0)) → + correct, since ∀ n ∈ N : R tt

  58. Proving Non-Termination of TRSs Automatically Method for Non-Looping Non-Termination 1 Let S be a set of pattern rules corresponding to R . 2 Check if some p ֒ → q ∈ S is obviously non-terminating. If yes: stop with “non-termination”. → q ∈ S by narrowing to obtain p ′ ֒ 3 Modify some p ֒ → q ′ . 4 Let S := S ∪ { p ′ ֒ → q ′ } and go to Step 2. Contributions pattern rules p ֒ → q to represent sets of rewrite sequences { p ( n ) → + R q ( n ) | n ∈ N } inference rules to deduce new correct pattern rules criterion for obvious non-termination of pattern rules strategy to apply the inference rules and the non-termination criterion implementation and evaluation in AProVE

  59. Inference Rules p 1 ֒ → q 1 . . . p k ֒ → q k If p 1 ֒ → q 1 , . . . , p k ֒ → q k are correct w.r.t. R then p ֒ → q is also correct w.r.t. R p ֒ → q f(tt , x, y ) → f(gt( x, y ) , dbl( x ) , s( y )) gt(s( x ) , 0) → tt gt(0 , y ) → ff (1) Pattern Rule from TRS gt(s( x ) , s( y )) → gt( x, y ) dbl( x ) → mul(s 2 (0) , x ) if ℓ → r ∈ R mul( x, 0) → 0 ℓ ∅ n ∅ ֒ → r ∅ n ∅ mul( x, s( y )) → plus(mul( x, y ) , x ) plus( x, 0) → x plus( x, s( y )) → plus(s( x ) , y ) gt(s( x ) , s( y )) ∅ n ∅ gt( x, y ) ∅ n ∅ ֒ →

  60. Inference Rules (2) Pattern Creation θ and σ commute s ∅ n ∅ ֒ → t ∅ n ∅ if θ σ = σ θ if sθ = tσ , and s σ n ∅ ֒ → t θ n ∅ θ commutes with σ → + s σ n t σ n s θ σ n − 1 = = R s σ n − 1 θ t σ n − 1 θ s θ σ n − 2 θ → + = = R s σ n − 2 θ 2 t σ n − 2 θ 2 s θ σ n − 3 θ 2 → + → + R . . . → + t θ n = R R

  61. Inference Rules (2) Pattern Creation θ and σ commute s ∅ n ∅ ֒ → t ∅ n ∅ if θ σ = σ θ if sθ = tσ , and s σ n ∅ ֒ → t θ n ∅ θ commutes with σ ∅ n ∅ ∅ n ∅ gt(s( x ) , s( y )) ֒ → gt( x, y ) � �� � � �� � s t ⇓ gt(s( x ) , s( y )) [ x/ s( x ) , y/ s( y )] n ∅ gt( x, y ) ∅ n ∅ ֒ → since s ∅ = t [ x/ s( x ) , y/ s( y )] ���� � �� � θ σ

  62. Inference Rules (3) Equivalence p and p ′ are equivalent if p ֒ → q p ( n ) = p ′ ( n ) ∀ n ∈ N : if p is equivalent to p ′ p ′ ֒ and q is equivalent to q ′ → q ′ gt(s( x ) , s( y )) [ x/ s( x ) , y/ s( y )] n ∅ gt( x, y ) ∅ n ∅ narrow ֒ → Goal: ∅ n ∅ ∅ n with gt(s( x ) , 0) ֒ → tt ∅ Problem: rules have different pumping and closing substitutions Strategy: 1 Instantiate base terms. (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  63. Inference Rules Criteria for Equivalence (3) Equivalence renaming of domain variables p ֒ → q if p is equivalent to p ′ p ′ ֒ and q is equivalent to q ′ → q ′ [ x/ s( x ) , y/ s( y )] n gt(s( x ) , s( y )) ֒ → ∅ ∅ n gt( x, y ) ∅ ⇓ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ /x, y ′ /y ] ֒ → ∅ n gt( x, y ) ∅

  64. Inference Rules Criteria for Equivalence (3) Equivalence renaming of domain variables p ֒ → q if p is equivalent to p ′ modifying substitutions of p ′ ֒ and q is equivalent to q ′ → q ′ irrelevant variables [ x/ s( x ) , y/ s( y )] n gt(s( x ) , s( y )) ֒ → ∅ ∅ n gt( x, y ) ∅ ⇓ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ /x, y ′ /y ] ֒ → gt( x, y ) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ /x, y ′ /y ]

  65. Inference Rules (4) Instantiation σ ρ = [ x/sρ | x/s ∈ σ ] s δ n τ ֒ → t σ n µ = ( σ ρ ) | dom ( σ ) if V ( ρ ) ∩ ( dom ( δ ) ∪ dom ( τ ) ∪ ( s ρ ) δ n → ( t ρ ) σ n ρ τ ρ ֒ ρ µ ρ ρ = [ x/ s( x ) , y/ 0] dom ( σ ) ∪ dom ( µ )) = ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ /x, y ′ /y ] narrow ֒ → gt( x, y ) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ /x, y ′ /y ] ∅ n with gt(s( x ) , 0) ֒ → ∅ ∅ n tt ∅ 1 Instantiate base terms. Strategy: (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  66. Inference Rules (4) Instantiation σ ρ = [ x/sρ | x/s ∈ σ ] s δ n τ ֒ → t σ n µ = ( σ ρ ) | dom ( σ ) if V ( ρ ) ∩ ( dom ( δ ) ∪ dom ( τ ) ∪ ( s ρ ) δ n → ( t ρ ) σ n ρ τ ρ ֒ ρ µ ρ ρ = [ x/ s( x ) , y/ 0] dom ( σ ) ∪ dom ( µ )) = ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] narrow ֒ → gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] ∅ n with gt(s( x ) , 0) ֒ → ∅ ∅ n tt ∅ 1 Instantiate base terms. Strategy: (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  67. Inference Rules (4) Instantiation σ ρ = [ x/sρ | x/s ∈ σ ] s δ n τ ֒ → t σ n µ = ( σ ρ ) | dom ( σ ) if V ( ρ ) ∩ ( dom ( δ ) ∪ dom ( τ ) ∪ ( s ρ ) δ n → ( t ρ ) σ n ρ τ ρ ֒ ρ µ ρ ρ = [ x/ s( x ) , y/ 0] dom ( σ ) ∪ dom ( µ )) = ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] narrow ֒ → gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n with ֒ → ∅ tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n ∅ 1 Instantiate base terms. Strategy: (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  68. Inference Rules (4) Instantiation σ ρ = [ x/sρ | x/s ∈ σ ] s δ n τ ֒ → t σ n µ = ( σ ρ ) | dom ( σ ) if V ( ρ ) ∩ ( dom ( δ ) ∪ dom ( τ ) ∪ ( s ρ ) δ n → ( t ρ ) σ n ρ τ ρ ֒ ρ µ ρ ρ = [ x/ s( x ) , y/ 0] dom ( σ ) ∪ dom ( µ )) = ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] narrow ֒ → gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] 1 Instantiate base terms. Strategy: (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  69. Inference Rules (5) Narrowing s σ n µ ֒ → t σ n µ u σ n µ ֒ → v σ n µ if t | π = u s σ n µ ֒ → t [ v ] π σ n µ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] narrow ֒ → gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] gt(s( x ) , 0) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] ⇓ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0]

  70. Inference Rules σ ρ = [ x/sρ | x/s ∈ σ ] (4) Instantiation = ( σ ρ ) | dom ( σ ) s δ n τ ֒ → t σ n µ if V ( ρ ) ∩ ( dom ( δ ) ∪ dom ( τ ) ∪ ( s ρ ) δ n → ( t ρ ) σ n ρ τ ρ ֒ ρ µ ρ dom ( σ ) ∪ dom ( µ )) = ∅ ρ = [ x/ s( x ′ ) , y/ s( y ′ )] ∅ n narrow f(tt , x, y ) ∅ ֒ → ∅ n f(gt( x, y ) , dbl( x ) , s( y )) ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] Strategy: 1 Instantiate base terms. (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  71. Inference Rules σ ρ = [ x/sρ | x/s ∈ σ ] (4) Instantiation = ( σ ρ ) | dom ( σ ) s δ n τ ֒ → t σ n µ if V ( ρ ) ∩ ( dom ( δ ) ∪ dom ( τ ) ∪ ( s ρ ) δ n → ( t ρ ) σ n ρ τ ρ ֒ ρ µ ρ dom ( σ ) ∪ dom ( µ )) = ∅ ρ = [ x/ s( x ′ ) , y/ s( y ′ )] ∅ n f(tt , s( x ′ ) , s( y ′ )) narrow ∅ ֒ → f(gt(s( x ′ ) , s( y ′ )) , dbl(s( x ′ )) , s 2 ( y ′ )) ∅ n ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] Strategy: 1 Instantiate base terms. (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  72. Inference Rules (6) Instantiating σ s δ n τ ֒ → t σ n µ if ρ commutes with s ( δ ρ ) n τ ֒ → t ( σ ρ ) n µ δ , τ , σ , and µ ρ = [ x ′ / s( x ′ ) , y ′ / s( y ′ )] f(tt , s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n narrow ∅ ֒ → f(gt(s( x ′ ) , s( y ′ )) , dbl(s( x ′ )) , s 2 ( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n ∅ gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] Strategy: 1 Instantiate base terms. (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  73. Inference Rules (7) Instantiating µ s δ n τ ֒ → t σ n µ s δ n ( τ ρ ) ֒ → t σ n ( µ ρ ) ρ = [ x ′ / s( x ′ ) , y ′ / 0] f(tt , s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] narrow ֒ → f(gt(s( x ′ ) , s( y ′ )) , dbl(s( x ′ )) , s 2 ( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] Strategy: 1 Instantiate base terms. (Base term of 1st rhs should contain base term of 2nd lhs.) 2 Make all 4 pumping substitutions equal. 3 Make all 4 closing substitutions equal.

  74. Inference Rules (5) Narrowing s σ n µ ֒ → t σ n µ u σ n µ ֒ → v σ n µ if t | π = u s σ n µ ֒ → t [ v ] π σ n µ f(tt , s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] narrow ֒ → f(gt(s( x ′ ) , s( y ′ )) , dbl(s( x ′ )) , s 2 ( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] gt(s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] with ֒ → tt [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] ⇓ f(tt , s( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0] ֒ → f(tt , dbl(s( x ′ )) , s 2 ( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s( x ) , y ′ / 0]

  75. Proving Non-Termination of TRSs Automatically Method for Non-Looping Non-Termination 1 Let S be a set of pattern rules corresponding to R . 2 Check if some p ֒ → q ∈ S is obviously non-terminating. If yes: stop with “non-termination”. → q ∈ S by narrowing to obtain p ′ ֒ 3 Modify some p ֒ → q ′ . 4 Let S := S ∪ { p ′ ֒ → q ′ } and go to Step 2. Contributions pattern rules p ֒ → q to represent sets of rewrite sequences { p ( n ) → + R q ( n ) | n ∈ N } inference rules to deduce new correct pattern rules criterion for obvious non-termination of pattern rules strategy to apply the inference rules and the non-termination criterion implementation and evaluation in AProVE

  76. Non-Termination Criterion Criterion for Non-Termination of R s δ n τ ֒ → t σ n µ correct w.r.t. R s δ a = t | π for some a ∈ N σ = δ b δ ′ , for some δ ′ , τ ′ and some b ∈ N µ = τ τ ′ where δ ′ commutes with δ and τ → + δ n σ n s τ t µ R σ n t | π µ � δ a σ n = s µ ( δ b δ ′ ) n δ a ( τ τ ′ ) = s τ δ ′ n τ ′ δ a + b · n = s s δ n τ s δ a + b · n τ Thus: rewrites to an instance of

  77. Non-Termination Criterion Criterion for Non-Termination of R s δ n τ ֒ → t σ n µ correct w.r.t. R s δ a = t | π for some a ∈ N σ = δ b δ ′ , for some δ ′ , τ ′ and some b ∈ N µ = τ τ ′ where δ ′ commutes with δ and τ f(tt , s 2 ( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ y ′ / 0] ֒ → f(tt , s 3 ( x ′ ) , s 2 ( y ′ )) [ x ′ / s 2 ( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s(mul(s 2 (0) , x ′ )) , y ′ / 0] → + Thus: f(tt , s n +2 ( x ′ ) , s n +1 (0)) f(tt , s 2 · n +4 (mul(s 2 (0) , x ′ )) , s n +2 (0)) R

  78. Non-Termination Criterion Criterion for Non-Termination of R s δ n τ ֒ → t σ n µ correct w.r.t. R s δ a = t | π for some a ∈ N σ = δ b δ ′ , for some δ ′ , τ ′ and some b ∈ N µ = τ τ ′ where δ ′ commutes with δ and τ f(tt , s 2 ( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] n [ y ′ / 0] ֒ → f(tt , s 3 ( x ′ ) , s 2 ( y ′ )) [ x ′ / s 2 ( x ′ ) , y ′ / s( y ′ )] n [ x ′ / s(mul(s 2 (0) , x ′ )) , y ′ / 0] f(tt , s 2 ( x ′ ) , s( y ′ )) [ x ′ / s( x ′ ) , y ′ / s( y ′ )] = f(tt , s 3 ( x ′ ) , s 2 ( y ′ )) � �� � � �� � � �� � s δ t [ x ′ / s 2 ( x ′ ) , y ′ / s( y ′ )] = [ x ′ / s( x ′ ) , y ′ / s( y ′ )] [ x ′ / s( x ′ )] � �� � � �� � � �� � σ δ δ ′ [ x ′ / s(mul(s 2 (0) , x ′ )) , y ′ / 0] = [ y ′ / 0] [ x ′ / s(mul(s 2 (0) , x ′ ))] � �� � � �� � � �� � µ τ τ ′

  79. Proving Non-Termination of TRSs Automatically Method for Non-Looping Non-Termination 1 Let S be a set of pattern rules corresponding to R . 2 Check if some p ֒ → q ∈ S is obviously non-terminating. If yes: stop with “non-termination”. → q ∈ S by narrowing to obtain p ′ ֒ 3 Modify some p ֒ → q ′ . 4 Let S := S ∪ { p ′ ֒ → q ′ } and go to Step 2. Contributions pattern rules p ֒ → q to represent sets of rewrite sequences { p ( n ) → + R q ( n ) | n ∈ N } inference rules to deduce new correct pattern rules criterion for obvious non-termination of pattern rules strategy to apply the inference rules and the non-termination criterion implementation and evaluation in AProVE

  80. Proving Non-Termination of TRSs Automatically DP framework proves and disproves termination of TRSs approach detects also non-looping non-terminating TRSs by combining techniques for non-looping non-termination of TRSs techniques for non-looping non-termination of SRSs (Oppelt ’08) Contributions pattern rules p ֒ → q to represent sets of rewrite sequences { p ( n ) → + R q ( n ) | n ∈ N } inference rules to deduce new correct pattern rules criterion for obvious non-termination of pattern rules strategy to apply the inference rules and the non-termination criterion implementation and evaluation in AProVE (also as DP processor )

  81. Overview I. Termination of Term Rewriting 1 Termination of Term Rewrite Systems 2 Non-Termination of Term Rewrite Systems 3 Complexity of Term Rewrite Systems (CADE ’11) 4 Termination of Integer Term Rewrite Systems II. Termination of Programs 1 Termination of Functional Programs (Haskell) 2 Termination of Logic Programs (Prolog) 3 Termination of Imperative Programs (Java)

  82. Termination Analysis of TRSs useful for termination of programs (Java, Haskell, Prolog, . . . ) Dependency Pair Framework modular combination of different techniques automatable Complexity Analysis of TRSs should be useful for of programs ⇒ Innermost Runtime Complexity adapt Dependency Pair Framework Hirokawa & Moser (IJCAR ’08, LPAR ’08) first adaption of DPs for complexity not modular Zankl & Korp (RTA ’10) modular approach based on relative rewriting for Derivational Complexity (cannot exploit strength of DPs for innermost rewriting) new approach: direct adaption of DP framework modular combination of different techniques automated and more powerful than previous approaches

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