Scryer Prolog

Module testutils

:- use_module(library(numerics/testutils)).

Utility predicates for testing numerics

real(-X)

X = tan(U) for uniform U ~ U[-π,π).

posreal(-X)

X = 1/U for uniform U ~ U[0,1).

interval(+A, +B, -X)

X ~ U[A,B).

try_falsify(+IntExpr, ?G_1)

Make (N is IntExpr) attempts to falsify the partial goal G/1, reporting the first counterexample found.

call_free(?G, -V)

Call goal G, the single free variable of which is bound to V.

witness(+N, ?OhNo)

Make N attempts to satisfy the goal OhNo, reporting the first counterexample found.

odd_t(+F_2, +Any, ?T)

T is the truth-value from testing that function F2 is [odd](https://en.wikipedia.org/wiki/Evenandoddfunctions) at a value X obtained via call_free(Any, X).

δ_inverses_t(+Δ, +F_2, +Finv_2, +Any, ?T)

For given functions F2 and Finv2, T is the truth-value from testing that Finv2 ∘ F2 is within Δ of the identity at a value X obtained via call_free(Any, X).

int_realfact(+N, -FactN)

FactN is floating-point N!