Can a failed caller tell us how to construct the next predicate?
A supplier at zero returns a distinguished result. Every positive integer input must exclude that result. One extra key, admitted exactly when \(x\ge1\), solves the problem. Yet an inference procedure that takes the least interval containing the failing inputs seen so far can run forever. After any finite number of examples it has learned a bounded interval. The next integer above its upper endpoint still fails.
The distinction matters for Table 4.4. A bound on the final formula tells us how much we need to express. Convergence also depends on what the induction jump learns from a failure. In this example a single symbolic caller obligation gives the entire ray. Here is a criterion for extracting such predicates, followed by a case where the compiler needs a different sort of witness. Original Table 4.4 counterexample · Lean proofs
Constructing a key from several failed proofs
Let \(A_x\) be the keys admitted at input \(x\). A result opens at \(x\) when every key in \(A_x\) stores it. A finite proof that a forbidden result must open records, at each node, a destination \(x\) and finitely many sources \(D\) whose menus cover \(A_x\). With the supplier rules and static guards fixed, preserving every inclusion in the proof forces the same result. An added key with support \(C\) breaks the inclusion at \((x,D)\) precisely when \(x\in C\) and \(C\cap D=\varnothing\). Proof replay and finite-subcover criterion
Reserve \(m\) fresh keys. The support for key \(j\) must contain \(L_j\) and lie inside \(U_j\). Suppose its permitted class has a least member \(h_j(P)\) containing each set \(P\) of positive observations. For intervals, \(h_j\) takes the interval hull, with empty hull allowed. For unrestricted supports, \(h_j(P)=P\).
Joint construction. For each failed proof choose one
of its nodes \((x,D)\) and assign that
node to a key \(j\). Let \(P_j\) contain \(L_j\) and all destinations assigned to
\(j\). Let \(N_j\) be the union of the source sets
assigned to it. A tuple of legal supports respecting the bounds and
breaking every proof exists exactly when some assignment satisfies \[
h_j(P_j)\subseteq U_j,\qquad h_j(P_j)\cap N_j=\varnothing\qquad\text{for
every }j.
\] The hulls themselves supply the tuple. Conversely, any
successful tuple identifies a broken node and a witnessing key for each
proof. Its \(j\)th support contains
\(P_j\), hence contains the least legal
hull. This constructs predicates without an advance list of formulas. A
class lacking least members, such as single halfspaces in the plane,
requires a separate fitting argument. Lean theorem
synthesize
Keep each failed proof as a disjunction of ways to break it. The next
fit can change earlier assignments. After each fit, check all suppliers
and callers again. On finite inputs, with terminating checks and
effective hulls, each failed check eliminates the proposed tuple
forever. There are at most \(2^{m|X|}\)
tuples. On infinite inputs the ray above defeats the same iteration even
with \(m=1\). A point above every
previously seen one is a counterexample whichever earlier points the
verifier chose. Executable search · Lean theorem
unseen_positive
Learning from a whole caller region
Give every input a common neutral key. Suppose a nonempty region
\(B\) supplies a marker and a region
\(H\) must exclude it. A tuple of extra
supports works iff every \(x\in H\)
admits some extra key whose support misses all of \(B\). Indeed the neutral key stores the
marker. Any key absent from the marker’s package must therefore be an
extra key missing every supplier. Conversely, storing the marker exactly
on the keys reached from \(B\) realizes
the condition. With one extra key and nonempty \(H\), the whole task is to find \(H\subseteq C\) with \(C\cap B=\varnothing\). Taking \(h(H)\) settles it whenever that hull can be
computed and belongs to the answer language. Lean theorem marker
There is a constructive bound for one conjunctive affine key. Suppose \(H\) and \(B\) are each presented as a finite union of rational polyhedra on rational inputs, using weak inequalities. Drop empty components. If such a key exists, one weak inequality per supplier component suffices. For each nonempty \(B_\ell\) seek a normal \(a\) and threshold \(c\) satisfying \[ a\cdot x\le c\quad(x\in H),\qquad a\cdot y\ge c+1\quad(y\in B_\ell). \] To see necessity, write a successful support as \(Gx\le g\) and the supplier component as \(Fy\le f\). Their intersection is empty. Farkas’ lemma gives nonnegative multipliers \(u,v\) with \(uG+vF=0\) and \(ug+vf\le-1\) after scaling. Take \(a=uG\) and \(c=ug\). Conversely, intersect the halfspaces returned for the components. Every caller belongs to the intersection and every supplier violates one inequality. An empty caller region can use the empty support. Farkas’ lemma
The construction can find \(a,c\) directly from the input. For each caller component \(M_ix\le d_i\) introduce nonnegative \(u_i\) and impose \(u_i M_i=a\), \(u_i d_i\le c\). For the current supplier component impose \(vF=-a\), \(vf\le-c-1\), \(v\ge0\). The valid-inequality form of Farkas’ lemma makes this rational linear feasibility problem exact. The coefficients have polynomial bit length for some feasible solution by the basic feasible solution bound. Thus one symbolic jump has a polynomial-size certificate in the explicit component presentation. Existential rational branch coordinates can be kept in the matrices with zero coefficients in the separator on those coordinates. The rational-input hypothesis matters. On the integer unit square let the callers be the diagonal endpoints and let the supplier region satisfy \(x+y=1\). The key \(x=y\) separates the four integer points. Yet no single halfspace can keep both diagonal endpoints and exclude both off-diagonal endpoints, since the two segments share their midpoint. Taking the integer hull of each region still leaves that intersection. Polynomial bit bound for rational LP · Primal and dual replay
When every finite batch fits
Take \(H=\{(0,0)\}\cup\{(n,1):n\in\mathbb
N\}\) and \(B=\{(1,0)\}\).
Keeping only \(n\le N\) gives the
separator \(x\le Ny\). For the entire
ray, every valid inequality \(ax+by\le
c\) has \(c\ge0\) from the
origin and \(a\le0\) from the ray. It
therefore admits \((1,0)\). Even an
arbitrary conjunction of such inequalities cannot express the required
support. Two supports, \(x\le0\) and
\(y\ge1\), suffice. This is the
boundary added by the closed convex hull in Definition 4.8, already
visible on integral observations. It also explains why testing all
finite samples can miss an impossibility that the symbolic separator
program detects at once. Lean proofs
prefix_fits and boundary_forced · Definition
4.8 and closed convex hulls · Cornuéjols
and Lemaréchal, Lemma 6.4
For a fixed finite key budget there is a precise sufficient condition
for finite obstruction. View a support assignment as Boolean bits
indexed by \((j,x)\). Breaking a finite
proof is a finite disjunction of tests on finitely many bits. Each such
condition is closed in the pointwise product topology. If the legal
assignments also form a closed set there, compactness gives a single
assignment satisfying all the proofs whenever every finite family can be
broken. Unrestricted supports and classes specified by forbidding finite
patterns have this property. The ray example above shows why geometric
closedness of each individual halfspace does not establish pointwise
closedness of the class. Lean theorems
finite_obstruction and forbid_closed · Compactness
in mathlib
To recover a safe package, apply the condition to all finite forbidden proof shapes valid under the fixed base menus. Any proof surviving the added keys would already be valid under the base. If the base satisfies the finite-subcover criterion, finitely many extra keys preserve it. Then absence of a surviving proof supplies a safe semantic package. Definability is a separate obligation. For example, let input \(n+1\) supply result \(n\), and require input \(n\) to exclude \(n\). This forces \(A_n\nsubseteq A_{n+1}\) for every \(n\). Two unrestricted keys, supported on even and odd inputs, work. Finitely many quantifier-free unary affine guards over the rationals are eventually constant along the naturals, so they cannot supply these admissions. A symbolic key parameter ranging over infinitely many values changes the interface. Lean proofs for adjacent inputs · Package existence
What InvarGenT must preserve
InvarGenT’s numeric negative abduction has a different obligation. Each live validation state needs one witness satisfying the full proposed guard. The old search chose a side of each forbidden branch independently and used a unit gap. A live constructor at \(1/2\) lies between forbidden constructors at zero and one. Stepping one unit to either side of zero removes the live point. In a second example the live indices satisfy \(i+j=0\). Excluding \(i\le0\land j\le0\) by insisting on \(j\ge1\) conflicts with a second forbidden branch that requires the answer to imply \(i>0\). Choosing \(i\ge1\) for both exclusions preserves a live witness. Both source programs
The compiler now retries a failing choice by selecting the sides jointly and carrying a common positive slack. At a successful choice there are finitely many live witnesses and finitely many chosen strict rows. Their positive differences have a positive minimum, so a small enough common rational margin preserves every witness. The bounded implementation tests representable margins and checks the final guard against all supplied forbidden cells. In the exact-maximum example, the forbidden constructor satisfies \(\max(i,j)=0\) and the live constructor has indices \((-1/2,-1/3)\). Requiring both indices to be at most \(-1/4\) keeps the live constructor. These checks preserve a witness per validation state. Keeping an entire annotated caller region would require universal containment as above. Exact-maximum program · Common-margin lemma
A negative control exposed a separate soundness error. At
accept Bad the solver retained both negative bounds and
\(\max(i,j)=0\) in the final residual.
No pair of indices satisfies all three constraints. Projecting the
indices out without checking joint feasibility gave the call type
Bool. On the previous compiler a written domain with the
same bounds and the single branch Live -> True
reproduced the error and the generated OCaml raised
Match_failure. InvarGenT revision b0a4ce7
checks the residual before projection. The illegal call is rejected. A
declared domain \(i\le-1,\ j\le0\)
still admits the constructor with \(j=0\). Source
and runtime replay
One example marks the remaining gap. Put the two live constructors at
\((1,0)\) and \((0,1)\) and the forbidden one in \(i\le0\land j\le0\). Choosing either
violated face discards a live constructor, regardless of the margin. The
symbolic construction gives the oblique guard \(i+j\ge1\). Revision b0a4ce7
accepts both calls when that guard is written and fails to infer it from
the branches alone. A later revision infers the guard and handles
several forbidden cells by choosing shared witnesses. Oblique guards Certificate and source replay
For a single nonempty convex forbidden cell, the same separation argument gives a complete reference procedure even under the compiler’s one-witness obligation. A successful conjunctive guard has a separating halfspace containing it, so that halfspace keeps its witnesses. Write each nonempty live cell as \(\operatorname{conv}(V)+\operatorname{cone}(R)\) with finite rational generators and \(V\) nonempty. A halfspace \(a\cdot x\le c\) meets the cell iff some \(v\in V\) has \(a\cdot v\le c\), or some \(r\in R\) has \(a\cdot r<0\). In the second case travel far enough from any point of \(V\) along \(r\). If both tests fail, every convex combination starts above \(c\) and all conic contributions are nonnegative. Choosing one generator per live state leaves linear constraints on \(a,c\) and the forbidden cell’s multipliers. Lineality can be represented by both signs of its generators. Several forbidden cells require a shared witness in each live state across the chosen halfspaces. Independently testing each halfspace can lose that witness. Polyhedral resolution theorem
Reproducing the checks
The proofs use Lean and mathlib 4.19. Formalization Run
python3 thesis-review-48.py for 240 finite synthesis
comparisons against exhaustive admission and package enumeration. With
z3-solver installed, --polyhedra checks 104
instances against an independent lifted formulation of closed-hull
intersection and verifies each returned separator over the original
cells. Build the OCaml driver
as src/Guards48.native with the compiler’s ocamlbuild flags
and pass its path as --driver for 363 joint numeric checks.
Pass --compiler to replay the calls and run the emitted
OCaml. Supplying revision dcfe773 as --before
also reproduces the earlier rejections and runtime failure. Build environment