Which inputs must survive an induction jump?

A caller checks only the first component of a recursive result. One supplier can move an error from the third component to the second. Another can move it from the second to the first. Their composition makes the third input indispensable. For affine updates of this form, the caller and the suppliers determine the coarsest sufficient parameter interface. A variant exposes a separate failure after the compiler has already found every parameter. Its join loses the bound on the sum of three errors. InvarGenT example · Program with the shared bound

An exact test for changing the captured parameters

Fix a legal input domain \(U\subseteq\mathbb Q^d\) and a function \(h\) giving the parameters carried by the package. At input \(x\), the base supplier returns \(x\). There are finitely many successor suppliers. Supplier \(i\) opens a recursive result \(r\) at the same input and returns \(x+T_i(r-x)\), where \(T_i\) is a rational matrix. Every supplier is available at each legal input. The caller asks for one inequality \(cr\le cx\). A package relation \(R\) must satisfy the following obligations at each \(x\in U\). \[ R(h(x),x),\quad R(h(x),r)\Rightarrow R(h(x),x+T_i(r-x)),\quad R(h(x),r)\Rightarrow cr\le cx . \] These are base, successor and caller clauses for a binary postcondition in Table 4.4. Each input uses the single specified key \(h(x)\). The unknown relation sees only that key and the result. The statements below use rational arithmetic. The OCaml executions use small integers for which every operation is representable. Table 4.4 · Earlier fixed-interface theorem · Parameter counts with several admitted keys

For a word \(w\) of supplier choices let \(T_w\) be their product in execution order, with the identity for the empty word. The rows \(cT_w\) measure every error that can reach the caller.

Interface theorem. A package relation exists exactly when \[ x,y\in U,\quad h(x)=h(y)\quad\Longrightarrow\quad cT_w x=cT_w y\quad\text{for every }w . \] This holds for arbitrary \(h\). For necessity, a package at \(h(x)\) must admit the base result \(y\) whenever \(h(y)=h(x)\). Running the suppliers in \(w\) at \(x\) then forces it to admit \(x+T_w(y-x)\). The caller gives \(cT_w y\le cT_w x\). Exchanging \(x\) and \(y\) gives the reverse inequality. For sufficiency, require a result at key \(k\) to agree with every legal input at \(k\) on all rows \(cT_w\). The base passes by the displayed condition. Applying supplier \(i\) reduces the check for a word \(w\) to the check for the word that applies \(i\) first and then \(w\). The empty word gives the caller’s bound. In particular this relation remains inductive when separate package openings use different representatives of the same key. Proof in Lean

For an arbitrary key function the theorem gives a relation as a set. For semilinear \(U\) and an affine key \(h\), the same construction has a formula in rational linear arithmetic. Replace all the word observations by the finite row basis computed below and quantify over the legal inputs with the specified key. Eliminating those input variables can introduce disjunctions.

A finite bound on parameter discovery

Start with the span \(L_0\) of \(c\), then set \(L_{j+1}=L_j+\sum_i L_jT_i\). After \(j\) steps the rows span every observation for words of length at most \(j\). Equality on one step gives closure under all suppliers. Each strict step adds a dimension, so for \(c\ne0\) there are at most \(d-1\) strict steps followed by one check. Write \(O\) for a matrix whose rows are a basis at closure. The single-matrix case is the observability matrix of a linear dynamical system. Allowing several recursive suppliers requires closing under their mixed products. Boyd, observability and state estimation, slides 19–6 to 19–7 · Row closure checked against recursive unfolding

The interface \(h(x)=Ox\) suffices, with package \(Or=h(x)\). Every sufficient interface distinguishes any two legal inputs that \(O\) distinguishes. Over unrestricted inputs, an affine capture \(Mx+b\) therefore suffices exactly when \(\ker M\subseteq\ker O\), or equivalently when every row of \(O\) is a linear combination of rows of \(M\). The minimum number of independent affine parameters is \(\operatorname{rank}O\). On an affine domain \(u+V\), apply the same argument to the restrictions of the rows to \(V\). On an arbitrary rational semilinear domain, test whether two admitted inputs have the same \(h\) but different \(O\) values by rational linear arithmetic when \(h\) is affine.

This gives a terminating repair for this part of the table. Keep the existing capture rows \(M\). When a collision is found, append one row of \(O\) that distinguishes the two inputs. That row is independent of everything captured so far, since every linear combination of the old rows agrees on the pair. Starting from \(M_0\), there can be at most \[ \operatorname{rank}\begin{pmatrix}M_0\\O\end{pmatrix} -\operatorname{rank}M_0 \] such repairs, even if the input domain changes between checks. Narrowing the domain preserves an already sufficient interface. Expansion can expose another collision. This bound counts additions of capture rows for these suppliers. Each repair keeps the previous rows, and each added affine statistic must be available at the definition and its uses. InvarGenT selects parameters from the variables in scope. The full outer loop also changes the supplier summaries and caller demands. Closure and rank-increase lemmas

The construction can need all \(d\) coordinates for one caller inequality. Let \(c\) read coordinate one, and let a supplier shift an error left by one place, inserting zero at the end. A difference confined to coordinate \(d\) first affects the caller after \(d-1\) successors. On \(\mathbb Q^d\) every coordinate must be distinguished. For \(d=3\) use the two separate updates \(A(e)=(e_2,0,0)\) and \(B(e)=(0,e_3,0)\). Repetition of \(A\) sees the first two coordinates, repetition of \(B\) only the first. The word that applies \(B\) and then \(A\) sees the third.

The unannotated source exports the unrestricted triple \((x,y,z)\). A written unrestricted package keeping the first two coordinates and leaving the third free fails. With \(A\) alone that package checks. With \(B\) alone keeping the first coordinate checks. Both suppliers work on domain \(y=z\) with result \((x,y,y)\), so two inputs determine the entire interface there. The client \((3,5,7)\) is rejected under that restriction. Program · Scheme and execution checks

When all three inputs are captured and the iteration still restarts

Give the base a positive allowance \(s\) by returning \((x,y,z+s)\). Keep suppliers \(A,B\) above and let the caller demand \(e_1+e_2+e_3\le s\), with \(e=r-(x,y,z)\). Supply the three inputs through an opaque existential package, so inference must accept every triple. The exact reachable errors are \(s\) times the three unit vectors and zero. Starting with the third vector, \(B\) reaches the second, \(A B\) reaches the first, and \(A\) alone reaches zero. The smallest convex invariant is their simplex \[ e_1,e_2,e_3\ge0,\qquad e_1+e_2+e_3\le s . \] Each supplier moves at most one nonnegative component into the next error. Each point in the simplex has weights \(e_1/s,e_2/s,e_3/s\) on the three unit vertices scaled by \(s\), with the remaining weight on zero. A join keeping only nonnegativity and the three pairwise bounds \(e_i+e_j\le s\) admits \((s/2,s/2,s/2)\). For \(s=2\) that spurious result already has integral coordinates. Reachability, inductiveness and convex weights in Lean

For an exact convex join there is a separate convergence bound. Let \(C_0=\operatorname{conv}(B)\) for a base set of errors \(B\), and \(C_{n+1}=\operatorname{conv}(B\cup\bigcup_i T_i C_n)\). Linear maps preserve finite convex combinations. Induction gives \(C_n=\operatorname{conv}\bigcup_{|w|\le n}T_w B\). If every product of \(N\) supplier matrices sends \(B\) to zero, truncating any longer word after \(N\) steps leaves its output unchanged. The exact update stabilizes by \(N\), followed by one equality check. A convex caller condition containing every reachable error holds on each intermediate hull, so it asks for no strengthening. On the three-coordinate example the hull already contains all four vertices at depth two. Word-truncation proof

A finite reachable set gives another bound on this exact update. If \(P\) is the set of reachable errors, each strict hull enlargement contains a newly reachable error outside the old hull. Otherwise every new generator would already belong to that convex set. The initial hull contains \(B\), so at most \(|P|-|B|\) enlargements are possible. For integer base errors and integer matrices, a known bounded box containing the orbit gives an explicit bound by counting its lattice points. This argument also covers finite orbits that never reach zero.

A bound on the size of the invariant formula allows a different outcome. Over the rationals take \(B=\{1\}\) and successor \(e\mapsto e/2\). The exact hull at depth \(n\) is \([2^{-n},1]\). The two inequalities \(0\le e\le1\) are inductive, yet every finite exact update strictly enlarges the hull. The denominator of the moving endpoint doubles on every pass. Widening changes the operator in this calculation. The trace below records when InvarGenT actually widens. Strict enlargement in Lean

At revision e9e7c00 the written simplex passes. On the unannotated program with \(s=1\), the input predicate already carries all three parameters on pass 1. The following table gives the stored relations through budget 80. A fresh witness can acquire a different printed name on each restart.

Pass Numeric relation on the stored result
\(1,4,7,\ldots\) The base point \((0,0,1)\).
\(2,5,8,\ldots\) \(e_1=0\), \(e_2,e_3\ge0\), \(e_2+e_3\le1\).
\(3,6,9,\ldots\) Nonnegativity and all three pairwise bounds, plus a caller contribution \(e_j\le0\) for one coordinate.

The thesis attributes monotonicity of branch generalization to substitution of the previous answer. At a fixed interface, positive substitution preserves inclusion of supplier sets. An order-preserving generalization, such as the exact convex hull, then preserves inclusion of their summaries. Sound coverage alone imposes no such order on the choice of generalization. Moreover, the stored answer in (4.6) includes the caller contribution. On pass 3 that contribution is \(e_3\le0\). Pass 2 admits \((0,0,1)\) and excludes \((1,0,0)\). Pass 3 reverses both decisions. The two stored answers are incomparable even though the captured inputs have stayed fixed. Thesis discussion of monotonicity · Supplier and caller updates

The last row satisfies the sum bound by forcing one coordinate to zero. Each choice excludes a reachable unit vector. The attempted justification of the caller contribution fails and the solver restarts from the base. The numeric widening path is active on passes 9, 21 and 45. Later restarts postpone the next jump to 93. The trace verifies the three forms up to pass 80, with the strengthening coordinate read from each pass. The earlier capped climb had an infinite recurrence under its original jump. Here the schedule and fresh names also change, so the observed period alone leaves the unbounded run open. Pass diagnostic · Semantic checks for all 80 stored relations · Capped-climb recurrence

A supplier check for the missing sum

On its affine retry, InvarGenT now looks for an inequality involving one fresh result coordinate and captured parameters. A lone face fixes its orientation. If several qualify, prefer a face that is identically tight on more supplier polytopes than any rival. A tie leaves that coordinate out. Normalize the result coefficient to absolute value one and take the inward signed distance. For example, \(x\le r_1\) contributes \(r_1-x\). Sum the selected distances. To find its tight upper bound on a supplier polytope, introduce one scalar equal to the sum and eliminate all other coordinates first. A projected singleton gives its value directly. Otherwise the scalar’s upper endpoint gives the bound. An unbounded upper ray rules out a finite cap in that direction. For a finite union of bounded-above projections, the largest endpoint is the least constant cap in this direction. At least one projected supplier attains it. The solver checks the candidate on every supplier polytope and adds it only if it gives information beyond the current join. The final implication check covers all the branches, including any that can increase the total beyond its base value. The proof is the branch implication followed by disjunction elimination in (4.2). The calculation uses rational endpoints throughout. Thesis supplier update

A uniform change of units leaves the ordinary sum useful. Rescale the three coordinates separately and the supporting face can acquire different coefficients. For each inward distance \(d_i\), the same projection gives its maximum \(u_i\) on the supplier union. Finite positive maxima give a second candidate direction \(\sum_i d_i/u_i\). Project and verify its upper bound as before. If the reachable errors include zero and every axis endpoint \(u_i e_i\), and every supplier lies on those axis segments, their exact convex hull has nonnegative distances and \(\sum_i d_i/u_i\le1\). The normalized distances are the weights on the endpoints. The remaining weight belongs to zero. This calculation works in any dimension. Barycentric equivalence in Lean

Let \(A\) transfer twice the second error and \(B\) transfer three times the third. The unit base then gives axis lengths \(6,3,1\). On retry the compiler infers \(e_1+2e_2+6e_3\le6\). At \(A(B Z)\) the program prints six, and the client demanding five fails. The arithmetic replay also compares the returned linear hull with the exact simplex on 48 translated and independently rescaled triples of axis segments. It checks that shrinking the cap or leaving one axis unbounded defeats the proposed bound in every case. Join driver

For the example, the base gives sum one. The other suppliers can spend the same unit on different coordinates. Budget three exhausts the search. At budget four the retry infers the unrestricted input and the four simplex inequalities. The executable reaches total one. If the base instead supplies an error anywhere in \([0,s]\), the sum varies on every supplier and the same projection still recovers \(s\). Other controls take \(s=3/2\), put the base on a two-dimensional triangle, and remove its upper bound altogether. The same check recovers the exact signed simplex for all eight choices of error signs, at allowances one and two. A control duplicates the third error in two result components. Its call at \(B Z\) exceeds allowance one and is rejected. Allowing two accepts the control and prints two. Source · Rational equivalence of the exported packages and runtime checks

Keeping disjunctions after a witness is determined

Existential projection had a separate cost in the preceding guard checks. Let the private witness be \(m=\max(0,k)\). Add \(q\) public pairs \(u_i,v_i\) and require \(m+u_i\le0\lor v_i\le0\) for every pair. Each of the two arms defining \(m\) gives a public formula of size \(O(q)\) by substitution. The earlier projector continued splitting the \(q\) disjunctions. Revision e9e7c00 substitutes each arm’s solved equalities before deciding whether the next disjunction still contains a private variable. Once the variable is gone, the disjunction stays in that branch. For \(q=1\) through \(7\), the number of returned cells falls from \(2^{q+1}\) to two. Both unions agree with the original existential formula. Arithmetic replay · Projection driver

There is a real lower bound behind the difference in representation. At \(k=0\) choose \((u_i,v_i)=(0,2)\) or \((2,0)\) independently, giving \(2^q\) legal points. The midpoint of two distinct choices has some pair \((1,1)\) and violates its clause. One convex cell contained in the projection can cover at most one marked point. Any exact union of convex cells therefore needs at least \(2^q\) cells. The two cells returned by the new projector can each contain public disjunctions. On the earlier ternary-digit example it now leaves two legal keys in each cell at lengths two through five. Earlier projection bound

Reproducing the checks

InvarGenT revision a953fc1 adds the shared-bound calculation. Its interval-base example is part of the OCaml 5.3 compatibility suite. All 373 active cases passed, with ten recorded as TODO. The 191 earlier example signatures were byte-identical to those from e9e7c00.

Run Lean 4.19 with mathlib v4.19.0 on the proof. Run python3 thesis-review-42.py with z3-solver to compare the row calculation against recursively unfolded package openings. Build the join driver in the repaired InvarGenT source tree and pass its executable as --join. Add --compiler with the repaired executable and --before with e9e7c00 for the source comparisons. For --before-trace, apply the diagnostic to the earlier compiler. Build the projection driver on e9e7c00 and 581f479 and pass the executables as --projection and --before-projection, respectively. The revision with the projection repair also agrees with quantified Z3 on all 1,280 earlier projections. The digit check for that revision uses thesis-review-38.py --numeric-driver DRIVER --paired-digits. On the separate 480-case guard replay, 476 cases agreed at a two-second per-query limit. Retrying the four unfinished queries at twenty seconds settled case 426. Both the compiler and Z3 found it unsatisfiable for each sort. Cases 258, 282 and 359 remain unverified in this comparison. Stress replay and original limits