Which rates must a recursive postcondition remember?
Two safe calls to the same function can disagree about what a child may return. In the crossing-cap program one call returns 16 at floor and cap parameter both zero. A different caller reaches those same child arguments but can consume at most 14. The existential result type must carry enough information to distinguish the two calls. There is an exact test for how much it can forget. Program · Lean proofs · Executable witnesses
No least choice of parameters
Take \(L=20\) and \(C(e)=\min(19,22-2e)\). The interval of possible upper-bound offsets for one mode is \([C(e),20-d]\).
| Floor rate \(e\) | Cap rate \(d\) | Interval |
|---|---|---|
| 3 | 4 | \([16,16]\) |
| 4 | 4 | \([14,16]\) |
| 4 | 6 | \([14,14]\) |
Keeping \(d\) lets the first and
second rows share a result predicate. Keeping \(e\) lets the second and third share one.
Both choices work on the full program. Any key that forgets at least as
much as both choices would identify all three rows by transitivity. The
first supplier and third caller violate the theorem since \(16+6>20\). Even among three modes there
is no least sufficient partition. On the infinite edge \(e=n+2\), \(d=2e-2\) for natural \(n\), every interval is a different
singleton. A finite set of tags cannot represent all these distinctions.
One captured numeric parameter still suffices. Proofs no_common_coarsening
and edge_key_injective
Restricting the input predicate cannot repair the first/third clash if it must admit just two particular calls. Take the first mode at \(p=m=0\) and the third mode at \(p=-4,m=-6\). The latter’s child has \(p=m=0\). The actual first call returns 16 at depth four. Feeding 16 to the latter’s primitive exceeds its limit of 14 and triggers its assertion. Each call executes successfully with its own children. The Lean proof derives incompatibility for every pair of input predicates admitting these calls and every common result relation, using only the primitive declarations. Two-client proof · OCaml witness
Exactly which affine keys suffice
On the full crossing-cap domain a scalar key \(z=ae+bd+c\) with rational coefficients suffices exactly when \((a,b)\) is nonzero and both coefficients are nonnegative or both are nonpositive. The constant \(c\) has no effect. To see sufficiency, write \(h(e)=20-C(e)=\max(1,2e-2)\). An incompatible pair would satisfy \(d_t>h(e_s)\). Since \(d_s\le h(e_s)\) and \(d_t\le h(e_t)\), both \(d\) and \(e\) strictly increase from \(s\) to \(t\). Every such nonzero same-sign key separates the two modes.
For opposite signs, clear denominators and reverse the sign if needed
to write the key as \(ve-ud\), with
positive integers \(u,v\). Take \(E=v+2u+3\) and \(D=2E-2-\max(0,v-2u)\). Both \((E,D)\) and \((E+u,D+v)\) are admissible. The key has the
same value on both, yet \(D+v>2E-2=h(E)\). The first and third
rows of the table rule out a constant key. Checked classification
scalar_interface_exact
Each sufficient key has a short certificate. Choose
the sign that makes the coefficients nonnegative, drop the additive
constant and write \(A=a+2b\).
Alongside \(p\le r\), take \[
r\le\max(p,m+19),\qquad Ar\le\max\bigl(Ap,Am+22a+40b-2z\bigr).
\] The second cap’s offset is the weighted average of the
supplier arm \(22-2e\) and the caller
arm \(20-d\), with weights \(a\) and \(2b\). Both arms bound the effective
supplier offset from above. If \(19\le20-d\), the first cap suffices for the
caller. Otherwise feasibility gives \(22-2e\le20-d\) and the weighted average
fits too. This supplies three result atoms for every sufficient affine
key, in addition to the four input atoms. For \(z=d\) the simpler result \(p\le r\le\max(p,m+20-d)\) already suffices.
General interpolation proof
weighted_cap_scheme · Six-atom scheme
Can one replace the two upper bounds by \(r\le\max(p,m+H(z))\) with a single affine offset \(H\)? On any mode with \(e\le d\), such an offset must lie in \([C(e),20-d]\). At large slack the supplier can fill its own cap, and a caller must accept the largest value allowed by \(H\). The modes \((0,1)\) and \((1,1)\) therefore both force \(H=19\). If \(a\ne0\) their key values are distinct, so an affine \(H\) would be constant. But \((3,4)\) forces \(H=16\). Thus among the sufficient scalar keys, exactly the nonzero multiples of \(d\) (up to an additive constant) permit this single affine cap over the full rational domain. Band bounds and affine obstruction
For \(z=e+d\) the weighted bound reads \(3r\le\max(3p,3m+62-2z)\). The supplied program takes \(z,d,p,m\) as inputs and exposes only \(z,p,m\) in its annotated result. InvarGenT checks it. Erasing the annotation also succeeds with the default pass budget. The inferred result in that run retains both rate coordinates. These two executions distinguish successful discovery of a valid type from discovery of a particular sufficient parameter set. Program · Inference and interface checks
Establishing witness equations during abduction
Revision 752520c failed on pass 1 even with the shorter
crossing-cap type written out. It also failed on pass 2 on the
unannotated double-rate program for every outer budget that got that
far. In a numeric branch \(P\Rightarrow E\land
D\), the equations \(E\)
identify witnesses used by an extremum in \(D\). Revision 29e5974 gives
numeric abduction two successive obligations, \[
P\Rightarrow E,\qquad P\land E\Rightarrow D.
\] Both uses of \(E\) have the
same candidate answer and the same witnesses. Pointwise the first
judgment supplies the premise needed by the second, so the
transformation commutes with the surrounding quantifiers. Branch
validation and liveness still use the original branches. The change
applies when a conclusion contains equations and an extremum. With it
the written type checks and the unannotated double-rate program infers
its six-atom scheme under the default settings. Logical equivalence · Historical and repaired runs · Written-type control
The original common-atom induction jump still gives a negative answer
to the general bounded-solution conjecture. On its two-inequality
program one whole pass restores the same stored state and regenerates
the same nonempty caller demand. Induction repeats the failed stopping
test at every later pass. That recurrence was repaired. At revision
e5cd09c the two-result moving-floor program still exhausts
outer budgets 11 and 80 despite its six-atom certificate. A proof that
it exhausts every budget would have to track the state of its
backtracking search. Original
recurrence · Two-result
certificate and remaining convergence question
A subsequent example gives an all-budget counterexample for one recursive definition using only type equality. The moving-floor example retains its separate open question. Packed payload and the pass-0 retry
Preserving the checked bound in the exported interface
The sum-key certificate exposed an independent error. When writing a min or max constraint, InvarGenT isolated a variable common to the two arms and silently dropped its coefficient. Even the function that returns the first of two arguments demonstrated the effect. Give it the result constraint \(3r\le\max(3i,3j)\). The old interface printed \(r\le\max(3i,3j)\). At \(i=j=-1\) a client reading the signature could conclude \(r\le-3\). That client passed typechecking and its assertion failed on the returned value \(-1\).
Revision e5cd09c prints the coefficient on the isolated
term. Reading the exported signature back now rejects the false client.
Equality and inequality round trips cover both directions of min and
max, including rational coefficients. The sum-key program also
round-trips a genuine non-unit bound. At \(p=m=-100\), \(z=7\), \(d=4\), the reimported signature proves
\(r\le-84\) and rejects \(r\le-252\). End-to-end signature tests
Lean 4.19.0 checked the proofs. Compile
thesis-review-8.lean and thesis-review-14.lean
in that order with lean -o, placing the matching
.olean files on LEAN_PATH, then run
lean thesis-review-15.lean. The OCaml 5.3 compatibility
suite passed 295 tests with 10 existing TODOs. All 141 previously
generated signatures matched byte for byte. The comparison driver takes
the InvarGenT executable and optionally --before-equations
with a binary from 752520c. Runnable checks