Logic and control

These predicates are simply derived from the control constructs and provide additional facilities for affecting the control flow during execution.

1. \+/1 (not provable)

'\+'(Term) is true iff call(Term) is false.

Templates and modes for the predicate are as follows:

'\+'(@callable_term)

Note that \+ is a predefined operator.

1.1 Example tests

Let's start with some simple tests verifying success or failure of single goals.

Goal Theory success(String goal,String theory)
'\+'((!, false)). null true
'\+'(4 = 5). null true
'\+'(X = f(X)). null true

Goal Theory success(String goal,String theory)
'\+'(true). null false
\+(!). null false
Goal Theory Variable Solution success(String goal,String theory,String variable,Strng solution)
(X=1; X=2), \+((!, fail)). null X 1 true
(X=1; X=2), \+((!, fail)). null X 2 true

Tests With Exception

Goal Theory success(String goal) Type Of Error
\+(3). null true
'\+'(X). null true

2. once/1

once(Term) is true iff call(Term) is true.

once(Term) behaves as call(Goal) but it is not re-executable.

Templates and modes for the predicate are as follows:

once(+callable_term)

1.1 Example tests

Let's start with some simple tests verifying success or failure of single goals.

Goal Theory success(String goal,String theory)
once(!). null true
once(repeat). null true

Goal Theory success(String goal,String theory)
once(fail). null false
once(X = f(X)). null false
Goal Theory Variable Solution success(String goal,String theory,String variable,Strng solution)
once(!), (X=1; X=2). null X 1 true
once(!), (X=1; X=2). null X 2 true

Note that there are no tests covering the cases when an error or exception is thrown by the engine while solving a query using this predicate.

3. repeat/0

repeat is true.

Templates and modes for the predicate are as follows:

repeat

Note that repeat is re-executable.

3.1 Example tests

Let's start with some simple tests verifying success or failure of single goals.

Goal Theory success(String goal,String theory)
repeat, !, fail. null false