[Paper Review] Verifying Asymptotic Time Complexity of Imperative Programs in Isabelle
This paper presents a verified framework in Isabelle/HOL for proving the asymptotic time complexity of imperative programs by extending Imperative HOL with time credits and separation logic. It integrates automation via the auto2 prover to reason about runtime behavior, enabling formal verification of advanced techniques like the Akra–Bazzi theorem and amortized analysis, with case studies on algorithms including median of medians, Karatsuba’s algorithm, and splay trees.
We present a framework in Isabelle for verifying asymptotic time complexity of imperative programs. We build upon an extension of Imperative HOL and its separation logic to include running time. In addition to the basic arguments, our framework is able to handle advanced techniques for time complexity analysis, such as the use of the Akra-Bazzi theorem and amortized analysis. Various automation is built and incorporated into the auto2 prover to reason about separation logic with time credits, and to derive asymptotic behavior of functions. As case studies, we verify the asymptotic time complexity (in addition to functional correctness) of imperative algorithms and data structures such as median of medians selection, Karatsuba's algorithm, and splay trees.
Motivation & Objective
- To develop a formally verified framework in Isabelle/HOL for reasoning about the asymptotic time complexity of imperative programs.
- To extend Imperative HOL and its separation logic with time credits to support runtime reasoning.
- To provide automated reasoning support for asymptotic bounds using the auto2 prover and filters.
- To enable verification of advanced complexity techniques such as the Akra–Bazzi theorem and amortized analysis.
- To demonstrate modularity and reusability through case studies on complex algorithms and data structures.
Proposed method
- Extend the Imperative HOL monadic framework to include runtime as a first-class value in the type system, returning a natural number for computation steps.
- Introduce time credits as a component of partial heaps in separation logic, allowing reasoning about resource consumption.
- Define a separating conjunction that includes time credit decomposition to support modular reasoning about resource usage.
- Integrate filters and formalized Landau symbols to express asymptotic domination and derive Θ-bounds, including in two variables.
- Extend the auto2 prover with custom rules for handling time credit assertions and asymptotic reasoning in separation logic.
- Leverage existing formalizations of the Akra–Bazzi theorem and amortized complexity for functional programs to support imperative counterparts.
Experimental results
Research questions
- RQ1How can asymptotic time complexity be formally verified in a proof assistant like Isabelle/HOL for imperative programs?
- RQ2Can time credits be integrated into separation logic to support amortized resource analysis in a sound and modular way?
- RQ3To what extent can automation be achieved for deriving asymptotic bounds in separation logic with time credits?
- RQ4How can advanced complexity techniques like the Akra–Bazzi theorem be applied and verified within a formal framework?
- RQ5Can verified amortized analysis of functional programs be adapted and reused for imperative data structures?
Key findings
- The framework successfully verifies the asymptotic time complexity of the median of medians selection algorithm using the Akra–Bazzi theorem.
- Karatsuba’s algorithm is formally verified to have a time complexity of O(n^log₂3) using the Akra–Bazzi method.
- Splay trees and skew heaps are formally verified to have an amortized time complexity of O(log n) per operation.
- The framework supports two-variable asymptotic complexity analysis, demonstrated on the 0-1 Knapsack problem.
- The auto2 prover extension enables automated reasoning about asymptotic bounds in one and two variables, reducing manual proof effort.
- The modular design allows separation of functional correctness, runtime analysis, and separation logic reasoning, improving proof maintainability.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.