Local resource profiles are mandatory at untrusted input boundaries. These counters are maintained by the receiver, never supplied as trusted claims by the sender. Termination proofs do not establish a practical resource bound.
Equations
- instReprResourceBudget = { reprPrec := reprResourceBudget✝ }
Streaming parser must enforce both limits while receiving/decompressing, not after allocating the entire object. Unknown sizes require bounded streaming.
Equations
- admitBytes budget wire expanded = (decide (wire ≤ budget.wireBytes) && decide (expanded ≤ budget.expandedBytes))
Instances For
def
boundedRegex
(run : ℕ → String → String → Option Bool)
(budget : ResourceBudget)
(pattern text : String)
:
A bounded regex backend returns none on exhaustion or unsupported syntax. The backend must enforce the supplied step budget (or an equivalent hard deadline).
Equations
- boundedRegex run budget pattern text = if pattern.utf8ByteSize + text.utf8ByteSize > budget.expandedBytes then false else run budget.regexSteps pattern text == some true