Size-Change Termination as a Contract

by   Phuc C. Nguyen, et al.

Program termination is an undecidable, yet important, property relevant to program verification, optimization, debugging, partial evaluation, and dependently-typed programming, among many other topics. This has given rise to a large body of work on static methods for conservatively predicting or enforcing termination. A simple effective approach is the size-change termination (SCT) method, which operates in two-phases: (1) abstract programs into "size-change graphs," and (2) check these graphs for the size-change property: the existence of paths that lead to infinitely decreasing value sequences. This paper explores the termination problem starting from a different vantage point: we propose transposing the two phases of the SCT analysis by developing an operational semantics that accounts for the run time checking of the size-change property, postponing program abstraction or avoiding it entirely. This choice has two important consequences: SCT can be monitored and enforced at run-time and termination analysis can be rephrased as a traditional safety property and computed using existing abstract interpretation methods. We formulate this run-time size-change check as a contract. This contributes the first run-time mechanism for checking termination in a general-purporse programming language. The result nicely compliments existing contracts that enforce partial correctness to obtain the first contracts for total correctness. Our approach combines the robustness of SCT with precise information available at run-time. To obtain a sound and computable analysis, it is possible to apply existing abstract interpretation techniques directly to the operational semantics; there is no need for an abstraction tailored to size-change graphs. We apply higher-order symbolic execution to obtain a novel termination analysis that is competitive with existing, purpose-built termination analyzers.


page 1

page 2

page 3

page 4


Termination of λΠ modulo rewriting using the size-change principle (work in progress)

The Size-Change Termination principle was first introduced to study the ...

Multivariant Assertion-based Guidance in Abstract Interpretation

Approximations during program analysis are a necessary evil, as they ens...

Decoupling the ascending and descending phases in Abstract Interpretation

Abstract Interpretation approximates the semantics of a program by mimic...

The Size-Change Principle for Mixed Inductive and Coinductive types

This paper describes how to use Lee, Jones and Ben Amram's size-change p...

Modular termination verification with a higher-order concurrent separation logic (Intermediate report)

We report on intermediate results of our research on reasoning about liv...

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

Control-flow refinement refers to program transformations whose purpose ...

Specializing Scope Graph Resolution Queries: Extended Edition

To warrant programmer productivity, type checker results should be corre...

Please sign up or login with your details

Forgot password? Click here to reset