Simplify crossed dispatch and add SMT-derived cases

Drop the redundant begin.offset split in crossedCompleteOvershoot and
the rE > 0 guard in closedFormForwardSaturated; both are implied by
the call-site invariants.

Add an SMT-derived empty-interval case as the smt_cases CTest and as a
committed fuzz_readable seed.  run-fuzz.sh now loads the read-only seed
corpus alongside the writable one.

Rename exhaustive to sweep and document that it is exhaustive only
over its bounded family of instances.
This commit is contained in:
andrew committed 2026-11-18 13:03:55 -05:00
1 parent 7a41d1f647
commit a0b68d148b
9 files changed
+72 -50

No files matched your search

+12 -15
View File
@@ -703,17 +703,11 @@ struct Impl {
return c.r->end_.offset >= 2 && allBelowEnd(c);
}
bool zeroCrossOvershootComplete(const Ctx& c, const Obs& o) const {
return c.r->begin.offset == 0 && overshoot(c);
}
bool negCrossOvershoot(const Ctx& c, const Obs& o) const {
return c.r->begin.offset < 0 && overshoot(c);
}
bool crossedCompleteOvershoot(const Ctx& c, const Obs& o) const {
return zeroCrossOvershootComplete(c, o) || negCrossOvershoot(c, o);
}
// `closedFormCrossedComplete` is reached only from `closedFormCrossed`,
// which the entry point enters only when `begin.offset <= 0`; the
// `begin.offset >= 1` cases go to the positive subtree. So the mode does
// not need to be retested here.
bool crossedCompleteOvershoot(const Ctx& c) const { return overshoot(c); }
bool crossedCompleteEndLeOne(const Ctx& c) const {
if (c.r->end_.offset == 1 && bSlack(c) < c.below)
@@ -722,8 +716,8 @@ struct Impl {
!(c.below <= bSlack(c) && clampNonposBottom(c));
}
// The three `zeroCross*` predicates above cover every `begin.offset == 0`
// case of the complete-crossed subtree, so the mode alone decides here.
// The overshoot branch above already covered the offset-zero overshoot
// cases, so the mode alone decides here.
bool crossedCompleteBeginZero(const Ctx& c, const Obs& o) const {
return c.r->begin.offset == 0;
}
@@ -735,7 +729,7 @@ struct Impl {
}
ConflictRange closedFormCrossedComplete(const Ctx& c, const Obs& o) const {
if (crossedCompleteOvershoot(c, o))
if (crossedCompleteOvershoot(c))
return closedFormNegCrossTopUnified(c, o);
if (crossedCompleteEndLeOne(c))
return closedFormNegCrossNonclampUnified(c, o);
@@ -851,7 +845,10 @@ struct Impl {
}
bool closedFormForwardSaturated(const Ctx& c, const Obs& o) const {
if (!(rE(c) > 0 && oLtK(c.r->end_.key, o.firstK()))) return false;
// The caller has `end.offset > 0`. If `end.offset == 1` then `rE == 0`,
// and readability makes `end.key < firstKey` false, so the `rE > 0`
// guard adds nothing.
if (!oLtK(c.r->end_.key, o.firstK())) return false;
NatInf rhs = niAdd(cardOK(c.r->end_.key, o.firstK()),
NatInf::of(static_cast<std::uint64_t>(c.n)));
return niLt(NatInf::of(rE(c)), rhs);