Linear loop synthesis: When d variables are not enough.
Linear loops (or linear dynamical systems) are an established computational model in our community. We typically understand under a linear loop a simple while loop with a single linear update as shown next.
Here, is a vector of rational-valued loop variables and the matrix denotes a linear transformation of . In the loop synthesis problem, a polynomial in variables is given. The goal is to generate a linear loop (that is, both the update matrix and the initialisation vector ) such that holds after -th iteration of the loop for all . It is natural to start investigations by assuming the same number of variables in the loop as in the desired polynomial invariant . However, as can be seen from the following example, linear loops with variables are more expressive.
This linear loop with variables satisfies a polynomial invariant . While doing so, the loop produces an infinite set of distinct values for . We refer to this as a linear loop in 3 variables for . Nevertheless, one can prove that no non-trivial linear loop with variables satisfying exists. Question: Let be an arbitrary polynomial in variables. Does there exist an upper bound such that if a non-trivial linear loop satisfying exists, then there exists a non-trivial linear loop with at most variables satisfying the same invariant? If such an upper bound exists and can be computed, a known template-based loop synthesis approach can be used to synthesise all loops satisfying an invariant, provided such loops exist. From the observation above, if exists, then . The challenge to improve the lower bound on is the lack of techniques to prove that no loop with fixed number of variables satisfies a given invariant. The techniques that we seek for may be rooted in the theory of C-finite sequences and their algebraic properties: allowing additional variables widens the class of C-finite sequences generated by the loop. Another way to see this is to consider loops with variables but affine updates of the form
Affine loops can be simulated by linear loops with an additional variable which is constantly set to 1. Polynomial invariants of an affine loop with variables are thus the invariants in terms of in a linear loop with variables . However, some of those invariants may not have a linear loop with only variables that satisfies them.
