Home / Docs / Diagnostics
U2015: Invalid predicate body (impure, failing, recursive or outside RL for reflect)
Release v0.4.0
The body of a predicate is not valid for its kind of predicate.
Why Una rejects it
A predicate is a pure, total function that returns Bool (spec/03 §4).
- The body of a
reflectpredicate, which the verifier sees, is written in the refinement language. - An
opaquepredicate may use any pure expression, but cannot perform operations, fail, or call functions that do. - No predicate calls itself, directly or through other predicates and functions.
The repair at a glance
diff
module demo
- predicate reflect even(n: Int) -> Bool = n == 0 or even(n - 2)
+ predicate reflect even(n: Int) -> Bool = n mod 2 == 0Failing example
una
module demo
predicate reflect even(n: Int) -> Bool = n == 0 or even(n - 2)Fixed example
una
module demo
predicate reflect even(n: Int) -> Bool = n mod 2 == 0