# Rejection is not always a no-op

This is a constructed transition model, not a workload benchmark, native-library
experiment or reproduction of published hit ratios.

## Reproduce
Files: [model.py](model.py), [test_model.py](test_model.py), [results.json](results.json).

Requires Python 3.10+ and the standard library. Put model.py, test_model.py and
results.json in the same directory.

```sh
python3 -B model.py --check
python3 -B -m unittest discover -s . -p test_model.py
python3 -B -O -m unittest discover -s . -p test_model.py
```

## Evidence
The first example starts with three unit-size residents, ordered A, B, C.
Their supplied estimates are 2, 8, 1. Candidate X needs two units and has estimate 5.

| Rule | X admitted | Removed residents | Final order | Free units |
| --- | --- | --- | --- | --- |
| IV | Yes | A, B | C, X | 0 |
| QV | No | A | C, B | 1 |
| AV | No | None | C, A, B | 0 |

The QV rejection leaves one unit empty. It does not mean that no resident changed.
These exact counts are from model.py, not observed misses in a running cache.

The second example starts with A, B, C, D, each size one; estimates are 6, 1, 1, 3.
X needs three units with estimate 5. Both AV variants reject X.
Early pruning examines A only and leaves B, C, D, A. Full gathering examines
A, B, C and leaves D, A, B, C. A subsequent Y of size one and estimate 2 is
admitted by the first variant and rejected by the second.

Early pruning used one frequency examination instead of three in this example.
This is an operation count, not elapsed time or a universal performance ratio.
The model's list operations are intentionally simple, not production-optimized.

## Source and interpretation
Einziger, Eytan, Friedman and Manes, *Lightweight Robust Size Aware Cache
Management*, arXiv:2105.08770v2 (23 May 2021), sections 4.1-4.3.1,
Algorithms 2-4 and the paragraph following Algorithm 4:
https://arxiv.org/pdf/2105.08770v2

IV tests one victim; QV tests and removes successive victims; AV compares a
gathered set's summed estimate. The paper explicitly notes that early pruning
can promote fewer objects. We use its pseudocode's greater-than-or-equal tie
rule, not the prose's strict comparison.

## Limits
Victim selection here is LRU, and promotions occur in examination order.
Estimates are supplied nonnegative integers, frozen within and across the two
illustrated decisions. They are not predictions of future requests. Actual
sketch aging, access updates, windows, sampling, concurrency and allocator
overhead are outside this model. The next-decision divergence is conditional
on these stated rules; no current Caffeine or Ristretto behavior is asserted.
A rejected AV candidate preserves payload membership, but not necessarily order.
Our free-space and oversized-input boundaries are explicit model choices.

The 6,804-case finite test compares one-step AV acceptance with an independently
expressed prefix-sum oracle, with pruning both on and off. It does not prove
full history equivalence; the two-step witness disproves that in this model.
No confidence intervals are appropriate for this exact, non-sampled calculation.

Original code and constructed inputs: CC0-1.0. Source paper rights are unchanged.
