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
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 ↗