Can one affine recursive field type a whole caller family?

Yes. Let a required recursive field transform a public rational index tuple by any affine map \(f\). Give the constructor finitely many closed rational affine guards and specify a nonempty rational polyhedral family \(C\) of callers. It is decidable whether there is a rational polyhedron \(P\) with \[ C\subseteq P,\qquad f(P)\subseteq P,\qquad P\subseteq G, \] where \(G\) is the conjunction of the guards. Dimension, coefficients and the number of facets of the answer are unrestricted. An affirmative answer also permits synthesis. Enumerate rational polyhedra and check the three inclusions by rational linear programming until a witness appears. The faster scalar test below decides existence in either direction. Exact decision procedure and examples

The five-layer example supplies a stronger answer for its particular constructor. Its greatest type admits every typable caller simultaneously and can be recovered from a finite prefix of the fields. Here the caller is part of the question. Each safe caller can require a different type, and a safe caller can even lack any polyhedral type. The distinction matters already with a single field. General families of required affine fields make the same specified-caller question undecidable. Five-layer example · Branching undecidability with a fixed caller

What a guard sees along a word

Write a public point as \((x,1)\) and a recession direction as \((v,0)\). Homogenization gives a rational matrix \(F\) for the field and rows \(b_i\) for the guards, oriented so \(b_i(x,1)\ge0\). Generate the caller cone by finitely many rational columns \(v_j\). Use at least one base point and both signs for each lineality direction. This works for a caller with lines and no vertices by choosing base points modulo its lineality space. For every guard and generator consider its sequence of slacks \[ s^{ij}_n=b_iF^n v_j,\qquad n\ge0. \] A nonnegative rational realization of a sequence consists of a finite matrix \(A\), row \(a\), and column \(u\), all entrywise nonnegative and rational, with \(s_n=aA^nu\) for every \(n\).

Compatibility theorem. One common polyhedral typing exists exactly when every \(s^{ij}\) has a nonnegative rational realization. The same equivalence holds with multiple required fields. Then \(n\) becomes a word \(w\), \(F_w\) is the corresponding product of field matrices, and a scalar realization uses one nonnegative matrix per field for every word. The decision below uses the single-field case.

For necessity take the closed homogenization of a typing \(P\). It is generated by finitely many rational columns \(V\). Each field preserves the cone, so \(FV=VA\) for a nonnegative rational matrix \(A\), found column by column. Each caller generator satisfies \(v_j=Vu_j\) for some \(u_j\ge0\). For a caller ray, add the ray to a feasible caller base point and pass to the homogeneous limit. The rows \(a_i=b_iV\) are nonnegative. This one matrix already realizes every pair.

For sufficiency fix a pair \((i,j)\) with realization \((a,A,u)\). In the direct sum of public coordinates and realization coordinates form the rational subspace \[ S=\operatorname{span}\{(F^nv_j,A^nu):n\ge0\}. \] Successive span extension stops in finite dimension. The subspace is invariant under \(F\oplus A\). Throughout \(S\) the identity \(b_i x=a h\) holds by linearity. Intersect \(S\) with \(h\ge0\) and project to \(x\). The result is a rational polyhedral cone containing \(v_j\), preserved by \(F\), on which \(b_i x\ge0\). For each fixed \(v_j\) intersect the cones of all guards. Then sum these cones over the caller generators. Intersection keeps every constraint on that caller, and addition keeps the guards because they are homogeneous. Intersecting the sum with last coordinate one gives the promised type. For multiple fields take the span over all words and apply each field to the corresponding synchronized coordinates. There is no need to identify private states from different realizations.

Projection also handles existentially hidden rational linear indices with fresh child witnesses. Conversely a public polyhedron is already such a typing. Allowing a finite union of closed rational polyhedra in this rule yields the same existence question. The closed convex hull still satisfies every guard and every affine field maps it into itself. Shared witnesses and the closed-hull argument

Deciding whether a scalar realization exists

The generating function of \(s_n=bF^nv\) is rational. Soittola’s theorem, in its version for the subfield \(\mathbb Q\subset\mathbb R\), characterizes which rational series with nonnegative coefficients have a nonnegative rational realization. There must be a period \(p\) such that each residue sequence \(s_{pn+j}\) either has finite support or has a single distinct characteristic root of largest modulus. For an infinite nonnegative residue this root is real and positive. Its multiplicity can exceed one. The roots here are the active roots of the reduced scalar recurrence. An eigenvalue of \(F\) can disappear at the caller, at the guard, or after a residue split. Berstel and Reutenauer, Theorem 2.1 and Corollary 2.2 · Positive matrix realizations in linear systems

One computable period suffices. Take twice the least common multiple of the orders of all root-of-unity quotients of the nonzero active roots. This also clears the phase of any root whose argument is a rational multiple of \(\pi\), since its quotient by its conjugate occurs and the extra factor of two makes any real sign positive. For the square-free nonzero-root polynomial \(h\), the resultant of \(h(X)\) and \(h(ZX)\) contains every such quotient among its roots. Factor over \(\mathbb Q\) and retain the cyclotomic factors. For a cyclotomic factor of degree \(d\) it suffices to try orders at most \(2d^2\). Indeed \(\varphi(n)^2/n\) is the product of \(p^{e-2}(p-1)^2\) over \(p^e\Vert n\) and is at least \(1/2\).

After splitting, combine terms with identical exponential roots, remove zero coefficients, and recompute the active modes for each residue. The remaining distinct roots have no root-of-unity quotient. Taking a further subsequence therefore preserves every surviving mode and its polynomial degree, apart from a finite zero-root transient. If any period worked, the common multiple of that period and ours would work. Refinement preserves a unique positive dominant root, and after our split it can never remove competing modes or make an infinite-order phase positive. Thus a failed spectral test on one residue rules out a polyhedral type. The fact that the dominating polynomial has higher degree than any competing polynomial at the same modulus leaves those roots active.

Termwise nonnegativity on the surviving residues is decidable. A short termination proof uses two searches in parallel. One enumerates terms looking for a negative value. The other enumerates rational nonnegative matrices, initial columns and output rows looking for an exact realization. Equality of two scalar representations is decidable by checking a basis of their synchronized reachable span. For a spectrally qualifying nonnegative residue, Soittola guarantees that the second search succeeds. Finite-support residues need only their finite prefix.

The replay uses a faster exact tail test. If \(\rho>0\) is the unique dominant root of multiplicity \(h\), write \(s_n/\rho^n=P(n)+e_n\) with \(\deg P=h-1\). The companion matrix \(T\) of \(e\) has all roots strictly inside the unit disk, checked by the Schur recursion. Compute a power with \(\|T^k\|_\infty\le1\) and a common bound \(B\) on the intervening powers. Then every future error is at most \(B\) times the current error window’s maximum norm. Write \(P(n+j)\) in the binomial basis in \(j\). Once its coefficients are nonnegative and its constant covers that error bound, the whole future is nonnegative. A positive leading coefficient eventually passes this test, while a negative leading coefficient gives eventual violations. The code checks every prefix term up to certification and retains finite transients. All operations use rational or real algebraic numbers. Python replay

A safe caller with an increasing margin and no type

Rotate \((x,y)\) by \((3/5,4/5)\), send \(t\) to \(t+1\), and require \(x\le t\). At \((1,0,2)\) the slack is \(n+2-\cos(n\theta)\ge n+1\). The eigenvalues \(1,e^{i\theta},e^{-i\theta}\) nevertheless have the same modulus, and the last two survive every residue split. Their phase has infinite order because \(2\cos\theta=6/5\) is rational and is not an algebraic integer, whereas a root of unity plus its inverse is an algebraic integer. This caller is safe for every unfolding and has no rational polyhedral recursive typing. Halving the rotating coordinates at each step makes the same caller typable. Starting the original rotation at the origin removes it from the guard sequence entirely.

The test also distinguishes a nonnegative sequence from one whose first failure comes long after the recurrence order. \((n-99)^2\) and \((n-99)^2-1\) both have just the triple root one. The latter fails at step 99. This family measures what a bound on the size of the answer would cost. Public facets and fresh child witnesses

What InvarGenT now infers

InvarGenT now keeps a worklist of necessary guard rows for an unannotated recursive constructor. Pull each retained row back through each required field. Drop an entailed pullback. When the frontier is empty, all retained rows follow from actual words and their conjunction is inductive. This proves greatestness, even with multiple fields. A separate feasibility and one-step inclusion check replays the result within the arithmetic search budget. On the five-layer example, nine printed inequalities are equivalent to the ten literal word guards. The binding and its alias both admit \((1,-1,1,1)\) and reject \((-11,-5,-5,1)\). Native export and Z3 comparison

Sometimes a necessary row first appears in the limit. For a field pullback \(T\), suppose the written violation row \(g\le0\) has \((T-r)(T-a)g=0\) with rational \(r\ge a>0\). Then \(h=(T-a)g\le0\) is necessary. For \(r>a\), divide \(T^ng=a^ng+(r^n-a^n)h/(r-a)\) by \(r^n\) and take the limit. For \(r=a\), use \(T^ng=r^ng+nr^{n-1}h\). The compiler tests the row recurrence exactly, including its constant coordinate, and retries the frontier with the necessary sign.

For example, send \((x,y,t)\) to \((x+y,y,2t)\) and require \(x\le1+t\), \(y\le8t\). The second guard supplies \(t\ge0\) in the limit. The greatest type then has six rows. They are the sign, \(y\le8t\), and \(x+ky\le1+2^kt\) for \(0\le k\le3\). The fourth pullback follows from \(y\le8t\) and the third. Every finite prefix alone admits negative \(t\) if \(x,y\) are sufficiently negative. InvarGenT now accepts the whole zero-slack family \(x\le1, y\le0\) and excludes \((-7,6,1)\) at step three. The general positive-realization decision is implemented in the research replay. The compiler uses the bounded frontier and the two rational induction jumps described here and in the quadratic example. Quadratic induction jump