Why Can’t You Behave? Non-termination Analysis of Direct Recursive Rules with Constraints
This paper is concerned with rule-based programs that go wrong. The unwanted behavior of rule applications is non-termination or failure of a computation. We propose a static program analysis of the non-termination problem for recursion in the Constraint Handling Rules (CHR) language.
CHR is an advanced concurrent declarative language involving constraint reasoning. It has been closely related to many other rule-based approaches, so the results are of a more general interest. In such languages, non-termination is due to infinite applications of recursive rules. Failure is due to accumulation of contradicting constraints during the computation.
We give theorems with so-called misbehavior conditions for potential non-termination and failure (as well as definite termination) of linear direct recursive simplification rules. Logical relationships between the constraints in a recursive rule play a crucial role in this kind of program analysis. We think that our approach can be extended to other types of recursion and to a more general class of rules. Therefore this paper can serve as a basic reference and a starting point for further research.
KeywordsLogic Programming Operational Semantic Rule Application Constraint Logic Programming Recursive Rule
We thank the anonymous referees for their helpful suggestions on how to improve the paper.
- 3.Endrullis, J., Zantema, H.: Proving non-termination by finite automata. In: LIPIcs-Leibniz International Proceedings in Informatics, vol. 36. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2015)Google Scholar
- 6.Frühwirth, T.: A devil’s advocate against termination of direct recursion. In: Proceedings of the 17th International Symposium on Principles and Practice of Declarative Programming, pp. 103–113. ACM (2015)Google Scholar
- 7.Frühwirth, T.: The CHR Web Site. Ulm University (2016). www.constraint-handling-rules.org
- 9.Le, T.C., Qin, S., Chin, W.-N.: Termination and non-termination specification inference. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 489–498. ACM (2015)Google Scholar
- 13.Payet, É., Mesnard, F., Spoto, F.: Non-termination analysis of Java bytecode (2014). CoRR abs/1401.5292Google Scholar