From Affine to Polynomial: Synthesizing Loops with Branches via Algebraic Geometry

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Bayarmagnai, Erdenebayar, Mohammadi, Fatemeh, Prébet, Rémi
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909814877061120
author Bayarmagnai, Erdenebayar
Mohammadi, Fatemeh
Prébet, Rémi
author_facet Bayarmagnai, Erdenebayar
Mohammadi, Fatemeh
Prébet, Rémi
contents Ensuring software correctness remains a fundamental challenge in formal program verification. One promising approach relies on finding polynomial invariants for loops. Polynomial invariants are properties of a program loop that hold before and after each iteration. Generating such invariants is a crucial task in loop analysis, but it is undecidable in the general case. Recently, an alternative approach to this problem has emerged, focusing on synthesizing loops from invariants. However, existing methods only synthesize affine loops without guard conditions from polynomial invariants. In this paper, we address a more general problem, allowing loops to have polynomial update maps with a given structure, inequations in the guard condition, and polynomial invariants of arbitrary form. We use algebraic geometry tools to design and implement an algorithm that computes a finite set of polynomial equations whose solutions correspond to all nondeterministic branching loops satisfying the given invariants. Furthermore, we introduce a new class of invariants for which we present a significantly more efficient algorithm. In other words, we reduce the problem of synthesizing loops to find solutions of multivariate polynomial systems with rational entries. This final step is handled in our software using an SMT solver.
format Preprint
id arxiv_https___arxiv_org_abs_2509_25114
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle From Affine to Polynomial: Synthesizing Loops with Branches via Algebraic Geometry
Bayarmagnai, Erdenebayar
Mohammadi, Fatemeh
Prébet, Rémi
Programming Languages
Symbolic Computation
Algebraic Geometry
Ensuring software correctness remains a fundamental challenge in formal program verification. One promising approach relies on finding polynomial invariants for loops. Polynomial invariants are properties of a program loop that hold before and after each iteration. Generating such invariants is a crucial task in loop analysis, but it is undecidable in the general case. Recently, an alternative approach to this problem has emerged, focusing on synthesizing loops from invariants. However, existing methods only synthesize affine loops without guard conditions from polynomial invariants. In this paper, we address a more general problem, allowing loops to have polynomial update maps with a given structure, inequations in the guard condition, and polynomial invariants of arbitrary form. We use algebraic geometry tools to design and implement an algorithm that computes a finite set of polynomial equations whose solutions correspond to all nondeterministic branching loops satisfying the given invariants. Furthermore, we introduce a new class of invariants for which we present a significantly more efficient algorithm. In other words, we reduce the problem of synthesizing loops to find solutions of multivariate polynomial systems with rational entries. This final step is handled in our software using an SMT solver.
title From Affine to Polynomial: Synthesizing Loops with Branches via Algebraic Geometry
topic Programming Languages
Symbolic Computation
Algebraic Geometry
url https://arxiv.org/abs/2509.25114