Theorem 1 - output inertness. The CLI wrapper writes the sanitizer's output straight to
your real terminal, so that output is the attack surface. The proof establishes that for
any program output whatsoever, in the strict display modes, every byte the sanitizer
emits is inert: printable ASCII plus tab, newline, and the two honored cursor controls
(backspace and carriage return) - and nothing else. No escape, control, bidi, invisible or
homoglyph byte can ever reach the outer terminal. This is checked on the real sanitizer
for all 1,114,112 Unicode code points, and the codepoint-badge arithmetic is proved
symbolically in Z3 for the entire codepoint range at once. This is the "output becomes input"
guarantee of the invariant harness above (item ii), lifted from a 387-sequence check to a proof
over all inputs. The richer "show" display mode, which by design lets a printable non-ASCII
glyph through, is separately proved to still never emit an invisible, bidi, or control
byte.
Theorem 2 - line containment. The line editor is proved, by induction in Z3 over its
state machine, to keep the cursor within the line currently being written for every possible
input - so program output can never move up into an earlier line or the scrollback, and a
completed line, once shown, is never rewritten. The abstract model Z3 reasons over is validated
against the real line editor on an exhaustive grid of states, so the proof binds to the actual
code rather than a hand model.
Theorem 3 - input and clipboard safety. The same technique proves the input side
over every input: a pasted string can never carry an escape, control, bidi or invisible character
to the shell and can never auto-execute - no trailing carriage return survives, so a single-line
paste waits for your Enter; nothing placed on the system clipboard carries a control, bidi or
invisible byte, and the ASCII clipboard drops every non-ASCII byte so a homoglyph cannot ride out;
a program-supplied window title is reduced to printable ASCII; and every full-screen (TUI) grid
cell is a single safe display unit, never an invisible or bidi character. The paste warning is
also proved to name a character the SAME class the on-screen colour does, so the two can never
disagree.
Theorem 4 - split escapes cannot leak. Output arrives one read at a time, and an escape
can be cut across a read boundary. The wrapper holds the fragment so its tail cannot render as
text - proved by bounded exhaustion: every short stream over the escape alphabet, under
every possible chunking, renders identically to the whole-stream case, together with a bound that
a never-terminated sequence stays constant in memory. Stated honestly, this one is bounded (short
streams) rather than the unbounded induction of Theorem 2; the pathological over-length path stays
fuzz-tested.