Skip to main content Accessibility help

Control-Flow Refinement by Partial Evaluation, and its Application to Termination and Cost Analysis



Control-flow refinement refers to program transformations whose purpose is to make implicit control-flow explicit, and is used in the context of program analysis to increase precision. Several techniques have been suggested for different programming models, typically tailored to improving precision for a particular analysis. In this paper we explore the use of partial evaluation of Horn clauses as a general-purpose technique for control-flow refinement for integer transitions systems. These are control-flow graphs where edges are annotated with linear constraints describing transitions between corresponding nodes, and they are used in many program analysis tools. Using partial evaluation for control-flow refinement has the clear advantage over other approaches in that soundness follows from the general properties of partial evaluation; in particular, properties such as termination and complexity are preserved. We use a partial evaluation algorithm incorporating property-based abstraction, and show how the right choice of properties allows us to prove termination and to infer complexity of challenging programs that cannot be handled by state-of-the-art tools. We report on the integration of the technique in a termination analyzer, and its use as a preprocessing step for several cost analyzers.



Hide All

This work was funded partially by the Spanish MICINN/FEDER, UE project RTI2018-094403-BC31, the MINECO project TIN2015-69175-C4-2-R, the CM project S2018/TCS-4314 and by the predoctoral UCM grant CT27/16-CT28/16.



Hide All
Albert, E., Arenas, P., Genaim, S., and Puebla, G. 2011. Closed-form upper bounds in static cost analysis. J. Autom. Reasoning 46, 2, 161203.
Alias, C., Darte, A., Feautrier, P., and Gonnord, L. 2010. Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In Static Analysis Symposium, SAS’10, Cousot, R. and Martel, M., Eds. LNCS, vol. 6337. Springer, 117133.
Bagnara, R., Hill, P. M., and Zaffanella, E. 2008. The Parma Polyhedra Library: Toward a complete set of numerical abstractions for the analysis and verification of hardware and software systems. Sci. Comput. Program. 72, 1-2, 321.
Bagnara, R., Mesnard, F., Pescetti, A., and Zaffanella, E. 2012. A new look at the automatic synthesis of linear ranking functions. Inf. Comput. 215, 4767.
Ben-Amram, A. M. and Genaim, S. 2014. Ranking functions for linear-constraint loops. Journal of the ACM 61, 4 (July), 26:126:55.
Ben-Amram, A. M. and Genaim, S. 2017. On multiphase-linear ranking functions. In Computer Aided Verification, CAV 2017, Majumdar, R. and Kuncak, V., Eds. LNCS, vol. 10427. Springer, 601620.
Borralleras, C., Brockschmidt, M., Larraz, D., Oliveras, A., Rodríguez-Carbonell, E., and Rubio, A. 2017. Proving termination through conditional termination. In Tools and Algorithms for the Construction and Analysis of Systems, TACAS’17, Legay, A. and Margaria, T., Eds. LNCS, vol. 10205. 99117.
Brockschmidt, M., Cook, B., Ishtiaq, S., Khlaaf, H., and Piterman, N. 2016. T2: temporal property verification. In Tools and Algorithms for the Construction and Analysis of Systems TACAS 2016, Chechik, M. and Raskin, J., Eds. LNCS, vol. 9636. Springer, 387393.
Brockschmidt, M., Emmes, F., Falke, S., Fuhs, C., and Giesl, J. 2016. Analyzing runtime and size complexity of integer programs. ACM Trans. Program. Lang. Syst. 38, 4, 13:113:50.
Cousot, P. and Halbwachs, N. 1978. Automatic discovery of linear restraints among variables of a program. In Fifth Annual ACM Symposium on Principles of Programming Languages, POPL’78, Aho, A. V., Zilles, S. N., and Szymanski, T. G., Eds. ACM Press, 8496.
De Angelis, E., Fioravanti, F., Pettorossi, A., and Proietti, M. 2012. Specialization with constrained generalization for software model checking. In LOPSTR 2012, Albert, E., Ed. LNCS, vol. 7844. Springer, 5170.
Doménech, J. J., Gallagher, J. P., and Genaim, S. 2019. Control-flow refinement by partial evaluation, and its application to termination and cost analysis. CoRR abs/1907.12345.
Fioravanti, F., Pettorossi, A., Proietti, M., and Senni, V. 2012. Improving reachability analysis of infinite state systems by specialization. Fundam. Inform. 119, 3-4, 281300.
Flores-Montoya, A. 2017. Cost analysis of programs based on the refinement of cost relations. Ph.D. thesis, Darmstadt University of Technology, Germany.
Flores-Montoya, A. and Hähnle, R. 2014. Resource analysis of complex programs with cost equations. In Asian Symposium on Programming Languages and Systems, APLAS 2014, Garrigue, J., Ed. LNCS, vol. 8858. Springer, 275–295.
Gallagher, J. P. 2019. Polyvariant program specialisation with property-based abstraction. In Pre-proceedings of Verification and Program Transformation, VPT’19, Lisitsa, A. and Nemytykh, A. P., Eds. Available at Accepted for EPTCS.
Gulwani, S., Jain, S., and Koskinen, E. 2009. Control-flow refinement and progress invariants for bound analysis. In Programming Language Design and Implementation, PLDI’09, Hind, M. and Diwan, A., Eds. ACM, 375–385.
iRank 2019. iRankFinder.
Kafle, B., Gallagher, J. P., Gange, G., Schachte, P., Søndergaard, H., and Stuckey, P. J. 2018. An iterative approach to precondition inference using constrained Horn clauses. TPLP 18, 3-4, 553570.
Leuschel, M. 2004. A framework for the integration of partial evaluation and abstract interpretation of logic programs. ACM Trans. Program. Lang. Syst. 26, 3, 413463.
Leuschel, M., Elphick, D., Varea, M., Craig, S., and Fontaine, M. 2006. The Ecce and Logen partial evaluators and their web interfaces. In PEPM 2006, Hatcliff, J. and Tip, F., Eds. ACM, 88–94.
Leuschel, M. and Massart, T. 2000. Infinite state model checking by abstract interpretation and program specialisation. In LOPSTR’99, Bossi, A., Ed. LNCS, vol. 1817. 63–82.
Podelski, A. and Rybalchenko, A. 2004. A complete method for the synthesis of linear ranking functions. In Verification, Model Checking, and Abstract Interpretation, VMCAI’04, Steffen, B. and Levi, G., Eds. LNCS, vol. 2937. Springer, 239251.
Puebla, G., Albert, E., and Hermenegildo, M. V. 2006. Abstract interpretation with specialized definitions. In SAS 2006, Yi, K., Ed. LNCS, vol. 4134. Springer, 107126.
Puebla, G., Hermenegildo, M., and Gallagher, J. P. 1999. An integration of partial evaluation in a generic abstract interpretation framework. In PEPM’99, Danvy, O., Ed. Technical report BRICS-NS-99-1. University of Aarhus, 7584.
Sharma, R., Dillig, I., Dillig, T., and Aiken, A. 2011. Simplifying loop invariant generation using splitter predicates. In Computer Aided Verification, CAV 2011, Gopalakrishnan, G. and Qadeer, S., Eds. LNCS, vol. 6806. Springer, 703719.


Related content

Powered by UNSILO

Control-Flow Refinement by Partial Evaluation, and its Application to Termination and Cost Analysis



Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.