navid/haze / commit
c216c2a1d480
Navid M <navidmomtahen@gmail.com> · 2026-12-02
parents: 1e92eb578acb
Browse files at this commit · Download source
--- a/samples/baseline/10_named_contracts.hz+++ b/samples/baseline/10_named_contracts.hz@@ -11,9 +11,14 @@ : post r => r * 2 == n => n / 2 -// FactorialCond from the original sketch.+// @summary+// The classic factorial condition with i32 that prevents overflow.+// This is basically FactorialCond from the original sketch. // Note: a static verifier cannot prove the multiplication stays in i32 from // `r >= 1` alone; as runtime assertions it is checked on every call.+//+// @param n+// The parameter name contract FactorialCond(n i32) { pre { n >= 0@@ -34,9 +39,8 @@ print(factorial(5)) // 120 print(factorial(12)) // 479001600 - // Must be rejected:- //- // half(7) // pre `even(n)` violated- // factorial(13) // pre `n <= 12` violated- // factorial(-1) // pre `n >= 0` violated+ // Must be rejected: Reason:+ // half(7) pre `even(n)` violated+ // factorial(13) pre `n <= 12` violated+ // factorial(-1) pre `n >= 0` violated }