# CQF contract checks
Hesela, 2026-11-02. Harness and runner: CC0-1.0.
Author library: BSD-3-Clause, fetched separately and left unchanged.

## Replay
Use a little-endian x86-64 Linux environment with Python 3, Git and GCC.
No Python packages are required. From a directory containing check.c and replay.py:

```sh
git clone https://github.com/saltsystemslab/cqf.git cqf
git -C cqf checkout --detach 68939f587b0f33f8c45be4f0e2a18e12bffa9fa6
python3 replay.py cqf --output replay.json
```

The runner verifies the commit and clean tracked source, compiles three variants
(-O0, -O2, and -O2 -DNDEBUG), executes them, and requires identical observations.
Temporary executables are removed automatically. The observed.json receipt was
generated by this runner; compare its observations, not timestamps or machine paths.
This focused harness does not use OpenSSL; the upstream benchmark Makefile does.
The output path must be new and outside the upstream source tree. Existing files,
including the original receipt, are never overwritten. Use a new filename for
another run. The 2026-11-03 runner safety revision leaves check.c and the original
2026-11-02 observed.json unchanged; it is not a new native experiment.

## Method and result
One thread, value zero, seed zero, 10-bit default-hash output, initially 64 slots.
A deterministic scan selects a collision with raw uint64 key A=0. On the recorded
platform B=1044 collides and C=1 does not. B is selected, not randomly sampled.

A5 then B2 produces count 7 for either key. Resizing to 128 slots preserves the
10-bit hash width and the same answers. Removing five acknowledged A insertions
leaves two for B. Removing the two B insertions empties the fingerprint.
After reset, inserting A once and removing never-inserted B once removes A's
representation. This deliberately violates the application's deletion precondition,
not the claimed semantics for a valid history.
A noncolliding absent-delete control leaves A unchanged.

## Version-specific API discrepancies
At the pinned commit, qf_remove(key, value, 0, flags) leaves count 5 unchanged.
The README describes zero as deleting everything, but src/gqf.c returns early.
qf_delete_key_value removes all stored multiplicity in the tested fingerprint.
The absent noncolliding removal returns -1, not the header-documented
QF_DOESNT_EXIST (-3); source _remove confirms this branch.
Source inspection also shows that qf_delete_key_value obtains the approximate
count and removes that entire fingerprint/value count. In default-hash mode it
cannot isolate one original key from a colliding key. This is an inference from
src/gqf.c lines 1982-2053, not an additional native test. Use a decrement bounded
by known outstanding insertions for the intended key, not a whole-counter delete.
Check behavior and return values for the exact library revision you deploy.
These observations are not claims about every CQF implementation.

## Limits
No inference of FPR, latency, SSD I/O, capacity, persistence or concurrent safety.
No injected hash and no edits to upstream code. The selected tiny fingerprint is
for a visible counterexample, not a recommended production configuration.
The paper benchmarks were not reproduced. Our assertions check state transitions
only; they do not prove the entire library correct.

## Sources
- Bender et al., PVLDB 2012, section 3:
  https://www.vldb.org/pvldb/vol5/p1627_michaelabender_vldb2012.pdf
- Pandey et al., SIGMOD 2017, sections 3-4 and evaluation context in section 6:
  https://users.cs.utah.edu/~pandey/courses/cs6968/spring23/papers/cqf.pdf
- Source, include/gqf.h, src/gqf.c and README.md:
  https://github.com/saltsystemslab/cqf/tree/68939f587b0f33f8c45be4f0e2a18e12bffa9fa6
