Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2790449.2790518acmotherconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
research-article

A devil's advocate against termination of direct recursion

Published: 14 July 2015 Publication History

Abstract

A devil's advocate is one who argues against a claim, not as a committed opponent but in order to determine the validity of the claim. We are interested in a devil's advocate that argues against termination of a program. He does so by producing a maleficent program that can cause the non-termination of the original program. By inspecting and running the malicious program, one may gain insight into the potential reasons for non-termination and produce counterexamples for termination.
We introduce our method in the concurrent programming language Constraint Handling Rules (CHR). Like in other declarative languages, non-termination occurs through unbounded recursion. Given a self-recursive rule, we automatically generate one or more devil's rules from it. The construction of the devil's rules is straight-forward and involves no guessing. The devil's rules can be simple. For example, they are non-recursive for rules with single recursion.
We show that the devil's rules are maximally vicious in the following sense: For any program that contains the self-recursive rule and for any infinite computation through that rule in that program, there is a corresponding infinite computation with the recursive rule and the devil's rules alone. In that case, the malicious rules serve as a finite witness for non-termination. On the other hand, if the devil's rules do not exhibit an infinite computation, the recursive rule is unconditionally terminating. We also identify cases where the static analysis of the devil's rule decides termination or non-termination of the recursive rule.

References

[1]
S. Abdennadher and T. Frühwirth. On completion of Constraint Handling Rules. In M. J. Maher and J.-F. Puget, editors, CP '98, volume 1520 of LNCS, pages 25--39. Springer, Oct. 1998. ISBN 3-540-65224-8.
[2]
S. Abdennadher and T. Frühwirth. Operational equivalence of constraint handling rules. In 5th International Conference on Principles and Practice of Constraint Programming, CP99, LNCS 1713. Springer, 1999.
[3]
H. Betz, F. Raiser, and T. Frühwirth. A complete and terminating execution model for Constraint Handling Rules. volume 10(4-6) of TPLP, pages 597--610. Cambridge University Press, July 2010. .
[4]
M. Brockschmidt, T. Ströder, C. Otto, and J. Giesl. Automated detection of non-termination and nullpointerexceptions for Java bytecode. In Formal Verification of Object-Oriented Software, pages 123--141. Springer, 2012.
[5]
H.-Y. Chen, B. Cook, C. Fuhs, K. Nimkar, and P. OHearn. Proving nontermination via safety. In TACAS 2014 - Tools and Algorithms for the Construction and Analysis of Systems, pages 156--171. Springer, 2014.
[6]
B. Cook, A. Podelski, and A. Rybalchenko. Proving program termination. Communications of the ACM, 54(5):88--98, 2011.
[7]
T. Frühwirth. As time goes by II: More automatic complexity analysis of concurrent rule programs. In A. D. Pierro and H. Wiklicky, editors, QAPL '01: Proc. First Intl. Workshop on Quantitative Aspects of Programming Languages, volume 59(3) of ENTCS. Elsevier, 2002.
[8]
T. Frühwirth. As time goes by: Automatic complexity analysis of simplification rules. In D. Fensel, F. Giunchiglia, D. McGuinness, and M.-A. Williams, editors, KR '02: Proc. 8th Intl. Conf. Princ. Knowledge Representation and Reasoning, pages 547--557. Morgan Kaufmann, Apr. 2002.
[9]
T. Frühwirth. Constraint Handling Rules. Cambridge University Press, 2009. ISBN 9780521877763. URL http://www.constraint-handling-rules.org.
[10]
J. Giesl, R. Thiemann, and P. Schneider-Kamp. Proving and disproving termination of higher-order functions. Frontiers of Combining Systems, pages 216--231, 2005.
[11]
A. Gupta, T. A. Henzinger, R. Majumdar, A. Rybalchenko, and R.-G. Xu. Proving non-termination. ACM Sigplan Notices, 43(1):147--158, 2008.
[12]
S. Liang and M. Kifer. A practical analysis of non-termination in large logic programs. Theory and Practice of Logic Programming, 13(4-5): 705--719, 2013.
[13]
É. Payet. Loop detection in term rewriting using the eliminating unfoldings. Theoretical Computer Science, 403(2):307--327, 2008.
[14]
E. Payet and F. Mesnard. Nontermination inference of logic programs. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(2):256--289, 2006.
[15]
É. Payet and F. Mesnard. A non-termination criterion for binary constraint logic programs. Theory and Practice of Logic Programming, 9 (02):145--164, 2009.
[16]
É. Payet, F. Mesnard, and F. Spoto. Non-termination analysis of Java bytecode, CoRR abs/1401.5292, 2014.
[17]
P. Pilozzi and D. De Schreye. Termination analysis of CHR revisited. In Logic Programming, pages 501--515. Springer, 2008.
[18]
F. Raiser, H. Betz, and T. Frühwirth. Equivalence of CHR states revisited. In F. Raiser and J. Sneyers, editors, 6th International Workshop on Constraint Handling Rules (CHR), pages 34--48, 2009.
[19]
H. Velroyen and P. Rümmer. Non-termination checking for imperative programs. In Tests and Proofs, pages 154--170. Springer, 2008.
[20]
D. Voets and D. Schreye. A new approach to non-termination analysis of logic programs. In Proceedings of the 25th International Conference on Logic Programming, pages 220--234. Springer-Verlag, 2009.

Cited By

View all

Recommendations

Reviews

R. Clayton

A totally correct system terminates. Instead of establishing termination directly, this paper describes a technique based on non-termination. This technique is statically derivable from the program text and produces non-termination results that are informative relative to the system's failure to terminate. A logically adept reader may be feeling anxious: to show not non-terminating is not to show termination. The logically sophisticated reader may be anticipating restrictive table setting to support this technique. The technique is described relative to a rule-based constraint language. "Devil's rules," syntactically derived from a program's directly recursive rules, are added to the program, and are designed to drive the program into non-termination, called maximally vicious computations. The central theorem of the paper shows that non-terminating programs contains maximally vicious computations characterized by devil's rules. In the absence of devil's rules, a program terminates. Now for the fine print: a program with devil's rules may converge to failure, from which nothing can be concluded. In addition, the technique applies only to programs with rules satisfying various conditions needed by devil's-rule derivations. The technique is in its early days, however, and further work may broaden and strengthen the results it can achieve. The paper is a vigorous read, requiring knowledge of more advanced forms of logic programming as well as the usual first-order predicate logic. The simple even-predicate running example proved to be a surprisingly effective help when working through the paper carefully. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
PPDP '15: Proceedings of the 17th International Symposium on Principles and Practice of Declarative Programming
July 2015
263 pages
ISBN:9781450335164
DOI:10.1145/2790449
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 14 July 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. constraint handling rules
  2. constraint reasoning
  3. non-termination
  4. program transformation
  5. termination

Qualifiers

  • Research-article

Conference

PPDP '15

Acceptance Rates

Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 28 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2022)Optimal answer generation by equivalent transformation incorporating multi-objective genetic algorithmSoft Computing10.1007/s00500-022-06923-126:19(10535-10546)Online publication date: 17-Mar-2022
  • (2018)ServLogSemantic Web10.3233/SW-1702629:2(257-290)Online publication date: 1-Jan-2018
  • (2016)Why Can’t You Behave? Non-termination Analysis of Direct Recursive Rules with ConstraintsRule Technologies. Research, Tools, and Applications10.1007/978-3-319-42019-6_14(208-222)Online publication date: 28-Jun-2016
  • (2015)Constraint Handling Rules - What Else?Rule Technologies: Foundations, Tools, and Applications10.1007/978-3-319-21542-6_2(13-34)Online publication date: 12-Jul-2015

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media