Lune

OOPSLA2023Top-tier venue

Solving Conditional Linear Recurrences for Program Verification: The Periodic Case

Chenglin Wang, Fangzhen Lin

Abstract

In program verification, one method for reasoning about loops is to convert them into sets of recurrences, and then try to solve these recurrences by computing their closed-form solutions. While there are solvers for computing closed-form solutions to these recurrences, their capabilities are limited when the recurrences have conditional expressions, which arise when the body of a loop contains conditional statements. In this paper, we take a step towards solving these recurrences. Specifically, we consider what we call conditional linear recurrences and show that given such a recurrence and an initial value, if the index sequence generated by the recurrence on the initial value is what we call ultimately periodic, then it has a closed-form solution. However, checking whether such a sequence is ultimately periodic is undecidable so we propose a heuristic "generate and verify" algorithm for checking the ultimate periodicity of the sequence and computing closed-form solutions at the same time. We implemented a solver based on this algorithm, and our experiments show that a straightforward program verifier based on our solver and using the SMT solver Z3 is effective in verifying properties of many benchmark programs that contain conditional statements in their loops, and compares favorably to other recurrence-based verification tools. Finally, we also consider extending our results to computing closed-form solutions of recurrences with unknown initial values.

Ask Lune

Know where this paper stands in minutes, not an afternoon.

Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

its abstract · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. CHLOE: Loop Transformation over Fully Homomorphic Encryption via Multi-Level Vectorization and Control-Path ReductionSong Bian, Zian Zhao, Ruiyu Shen, Zhou Zhang et al.S&P 2025

Related papers

  1. On Polynomial Expressions with C-Finite Recurrences in Loops with Nested Nondeterministic BranchesChenglin Wang, Fangzhen LinCAV 2024 · 3 citations
  2. Deciding ω-regular properties on linear recurrence sequencesShaull Almagor, Toghrul Karimov, Edon Kelmendi, Joël Ouaknine et al.POPL 2021 · 14 citations
  3. Data-driven Recurrent Set Learning For Non-termination AnalysisZhilei Han, Fei HeICSE 2023 · 1 citation
  4. Loop Invariant Inference through SMT Solving Enhanced Reinforcement LearningShiwen Yu, Ting Wang, Ji WangISSTA 2023 · 11 citations
  5. Solvable Polynomial Ideals: The Ideal Reflection for Program AnalysisJohn Cyphert, Zachary KincaidPOPL 2024 · 11 citations
Dusk over the sea between two cliffs drawn in fine vertical lines