Pud Field Guide

Formal methods in TypeScript

What holds for every input?

Give Pud a function and a rule. Its Lean adapter checks the rule across the input domain you declare.

Study the clamp
Wireframe of z = clamp(x, −b, b) with the lower, upper and interior regions labeled
The bounded clamp, with symmetrical limits.Plate I

Specimen / clamp.ts

Between two bounds.

The plate shows symmetric bounds. The proof goes further. Whenever two bigint bounds are in order, the result stays between them.

clamp.proof.ts

given(lower <= upper);
const result = clamp(value, lower, upper);
expect(result).to(
  pud.bigint().gte(lower).lte(upper)
);
Inspect the sidecar ↗