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 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 == 0

Failing 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