notes

The glob matcher: how the proofs were made tractable, and what enumeration proves instead

Name: provisional.

An appendix to nifeos/nife:notes/glob.md, whose table lists the six Kani harnesses. This records why the domain is three bytes, what had to change to reach it, what it costs, the defect Kani found in a harness, and the host-test enumeration that carries the length-independent claims.

Three bytes, measured rather than chosen

The road to three bytes is the interesting part. Kani unrolls loops. So the match loop enters the formula once per possible iteration and the cost grows with the name length rather than staying flat. Four bytes each was tried and abandoned twice, at 3 GB and past ten minutes without finishing. What three bytes buys is every byte value: 2^48 pattern/name pairs per harness. That reaches a closed class, an escape, a trailing backslash, an unterminated bracket and two stars. What it does not buy is quantification over length.

Two things had to change to get there, and both are DECISIONS ยง46 (thin primitives or whole subsystems) rule 1 in practice: restructure the code, do not weaken the claim.

The cost

The honest cost is recorded, since a gate people skip is worse than none. The six harnesses take minutes of solver time, which makes this one of the larger entries in script/verify. Most of it is the two harnesses that quantify over a symbolic-length pattern and a symbolic-length name. The per-harness seconds are not recorded here, because they are facts about one host and one Kani version and drift between runs (the negated-class harness has measured from about one minute to over three). The lever that worked was cutting the dot rule's name bound from three bytes to two, which is sound because that rule is a predicate on the name's first byte. The lever that did not work, measured and recorded so nobody re-tries it, was restating a restriction as kani::assume instead of an early return: 181s became 186s, which is noise.

A defect Kani found in a harness

Kani found a real defect in a harness, which is worth recording because it was not in the code. The negation-complement property failed in 42 seconds with a counterexample, and the counterexample was right. With the class body fully symbolic, [!y] is not "the class of ! and y", it is already a negated class, so [!!y] is its complement rather than its double. The assumption that excludes ! and ^ at the head of the body is about what the two spellings are, not a weakening of the claim.

What enumeration proves instead

The length-independent claims are the host tests' job, and that is the network_time_protocol lesson applied (see ntp/what-is-proved.md). Two places that lesson decided the design here:

Both directions of the cross-check are pinned as non-vacuous. 15,956 of the 2,657,200 pairs match, asserted, because an agreement test between two matchers that both said "no" to everything would pass.

What each harness's shape costs

These are the measurements behind the shape of the harnesses in src/lib.rs of the repository partsfoundry/byte_glob, which link here.