THE FOLD / GLITCH / STACK OVERFLOW / THE MAXSTACK
THE MAXSTACK
the peak is already written in net
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The maxstack is the peak depth a stack ever reaches while a program runs — and you can read it without executing anything. Treat each instruction as a signed tick: a push (a bind) is +1, a pop (a kill) is −1. Track the running total net = binds − k. Then the maximum stack depth equals the largest value net reaches over the whole run — one integer pass, no interpreter, no stack ever built. The catch that names the idea: read that same conserved quantity only at the end and it is 0 for every balanced program, hiding the peak completely. A conserved quantity has no unstated scope — its maximum over its true scope is the answer, not its final value.
LIT verified live: over 20,000 random balanced programs, the max of the running net equals a real array-stack’s peak length every time (window.__maxstack), while the end value is 0 in 100% of them. FIG no framing; the no-execution integer readout and a materialised stack simulation both run in-browser and agree exactly.
LIT verified live: over 20,000 random balanced programs, the max of the running net equals a real array-stack’s peak length every time (window.__maxstack), while the end value is 0 in 100% of them. FIG no framing; the no-execution integer readout and a materialised stack simulation both run in-browser and agree exactly.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) found this as principle XXXII — “a conserved quantity has no unstated scope” — when his law net = binds − k reproduced Microsoft’s
Credit as content: the CLI
.maxstack field exactly, without executing the bytecode. Seated at stack-overflow: the overflow ceiling is knowable before a single instruction runs. AVAN (AI) built the instrument: materialise a real array stack, measure its peak length, and compare it to the max of the running net over thousands of programs.Credit as content: the CLI
.maxstack directive (ECMA-335) and David’s net = binds − k formulation. The weave: David names the conserved quantity and its scope; I show its maximum over the run is the peak, and its end value tells you nothing about how high it climbed.3 ONE DIMENSION
A program as +1/−1 ticks; the traced ridge is net; its highest point is the maxstack. The ridge returns to 0 at the end — the peak is lost if you read only the last value.
4 TWO DIMENSIONS · INTERACTIVE
A random program’s net profile (the ridge), its peak line (the ceiling), and a materialised array-stack sim — they agree.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the ceiling read straight off the net ridge, no execution.
AVAN’s addition (the inverse-companion): don’t run the program until it overflows — read the conserved quantity across its whole scope and take the maximum. The inverse of ‘execute to find the peak’ is ‘the peak is already written in net, if you read all of it.’ Magenta is the end value (0, under-reporting); green is the max over scope (the true ceiling). Scope is the whole story.
LIT Genuine result: peak stack depth = max prefix of net(=pushes−pops), the CLI .maxstack field (ECMA-335) reproduced without executing — David's principle XXXII (net = binds − k). Verified live: for 20,000 random balanced programs, max-of-running-net equals a materialised array-stack's peak length (window.__maxstack.formula), and the end net is 0 while the peak is >0 in 100% (window.__maxstack.endUnderReports).
FIG No framing: the integer net readout and a real push/pop array-stack both run in-browser and agree exactly. Honest scope: computing the peak from net is the point (you avoid building the stack), and the 'no unstated scope' claim is about reading net's maximum over the whole run rather than its final value. The AVAN inverse is honest — reading the conserved quantity across its whole scope and taking the maximum, rather than executing until overflow, is exactly the maxstack computation; magenta is the end value (0, under-reporting), green the max over scope (the true ceiling). Scope is the whole story.
FIG No framing: the integer net readout and a real push/pop array-stack both run in-browser and agree exactly. Honest scope: computing the peak from net is the point (you avoid building the stack), and the 'no unstated scope' claim is about reading net's maximum over the whole run rather than its final value. The AVAN inverse is honest — reading the conserved quantity across its whole scope and taking the maximum, rather than executing until overflow, is exactly the maxstack computation; magenta is the end value (0, under-reporting), green the max over scope (the true ceiling). Scope is the whole story.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of STACK OVERFLOW · David Lee Wise (ROOT0), with AVAN