blob: 63b62d0231793ac3886474d31fff2c964e477d51 [file]
/-! A `def` contract, a `for … invariant` clause or an `assert` element used without the `Std`
metatheory reports a helpful error naming the missing import, rather than a downstream elaboration
failure. -/
set_option experimental.intrinsic true
/--
error: `given`/`requires`/`ensures`/`throws` contracts elaborate to a `vcgen`-proved specification theorem; add `import Std.WP` to use them.
-/
#guard_msgs in
def f (x : Nat) : Id Nat requires x > 0 ensures r => r ≥ x := pure x
/-- error: a loop annotation elaborates to a `vcgen` gadget; add `import Std.WP` to use it. -/
#guard_msgs in
def g (xs : List Nat) : Id Nat := do
let mut acc := 0
for x in xs invariant pref suff => 0 ≤ acc do
acc := acc + x
return acc
/-- error: the `assert` element elaborates to a `vcgen` gadget; add `import Std.WP` to use it. -/
#guard_msgs in
def h (n : Nat) : Id Nat := do
assert n > 0
return n