This library provides predicates for running built-in predicates.

FASILL has a large set of built-in predicates for arithmetic comparison, arithmetic evaluation, atom processing, control constructs, term comparison, term unification, type testing, list manipulation, etc.

is_builtin_predicate( ?Indicator )

This predicate succeeds when Indicator is the indicator of a builtin predicate of FASILL. An indicator is a term of the form Name/Arity, where Name is an atom and Arity is a non-negative integer.

eval_builtin_predicate( +Indicator, +State1, +Atom, ?State2 )

This predicate succeeds when Indicator is the indicator of a builtin predicate of FASILL, and State2 is the resulting state of performing a step over the state State1 with selected atom Atom whose indicator is Indicator.

consult( +atom )

Load program rules. consult(Path) is true if the file Path exists and is loaded into the environment.

consult_sim( +atom )

Load similarities. consult_sim(Path) is true if the file Path exists and is loaded into the environment.

unfold( +rule_id )

Unfolding transformation. unfold(Id) unfolds the rule with identifier Id.

','( +callable_term, +callable_term )

Conjunction. ','(First, Second) is true if and only if First is true and Second is true.

';'( +callable_term, +callable_term )

Disjunction. ';'(Either, Or) is true if and only if either Either or Or is true.

call( +callable_term[, @term, ...] )

Invoke a callable term as a goal. call(Goal, Arg1, ..., ArgN) is true if and only if Goal represents a goal which is true for the (optional) arguments Arg1, ..., ArgN.

throw( +term )

Raise an exception. throw(Exception) raise the Exception exception. The system looks for the innermost catch/3 ancestor for which Exception unifies with the Catcher argument of the catch/3 call.

catch( +callable_term, ?term, +callable_term )

Enable recovery from exceptions. catch(Goal, Catcher, Handler) behaves as call/1 if no exception is raised when executing Goal. If an exception is raised using throw/1 while Goal executes, and the Goal is the innermost goal for which Catcher unifies with the argument of throw/1, all choice points generated by Goal are cut, the system backtracks to the start of catch/3 while preserving the thrown exception term, and Handler is called as in call/1.

truth_degree( +callable_tem, ?term )

Truth degree. truth_degree(Goal, TD) is true if TD is the truth degree for the goal Goal.

findall( ?term, +callable_term, ?list )

Find all the values that would make a goal succeed. findall(Template, Goal, Instances) is true if and only if Instances is a list of values in the form Templates that would make the goal Goal succeed. Usually, Template and Goal share some variables, so Instances is filled with the values that make Goal succeed. If there is not a single value that make Goal unify, Instances will be an empty list.

findall( +term, ?term, +callable_term, ?list )

Find all the values that would make a goal succeed. findall(Connective, Template, Goal, Instances) is true if and only if Instances is a list of values in the form Templates that would make the goal Goal succeed. Usually, Template and Goal share some variables, so Instances is filled with the values that make Goal succeed. If there is not a single value that make Goal unify, Instances will be an empty list.

'~'( @term, @term )

Weak unification. X ~ Y is true if and only if X and Y are weakly unifiable. True if the weak unification succeeds.

'='( @term, @term )

Unification. X = Y is true if and only if X and Y are unifiable. True if the unification succeeds.

'\~'( @term, @term )

Not weak unification. X \~ Y is true if and only if X and Y are not weakly unifiable.

'\='( @term, @term )

Not unification. X \= Y is true if and only if X and Y are not unifiable.

weakly_unify_with_occurs_check( @term, @term )

Weak unification with occurs check. weakly_unify_with_occurs_check(X, Y) is true if and only if X and Y are weakly unifiable. True if the weak unification succeeds.

unify_with_occurs_check( @term, @term )

Unification with occurs check. unify_with_occurs_check(X, Y) is true if and only if X and Y are unifiable. True if the unification succeeds.

'@>'( @term, @term )

Term greater than. True if the first term is greater than the second one.

'@=<'( @term, @term )

Term less than or equal to. True if the first term is less than or equal to the second one.

'@>='( @term, @term )

Term greater than or equal to. True if the first term is greater than or equal to the second one.

'=..'( +nonvar, ?list )

'=..'( -nonvar, +list )

Check the descomposition of a term. Term =.. List is true if and only if (1) Term is an atomic term and List is a list consisted of just one element, Term, or (2) Term is a compound term and List is a list which has the functor name of Term as head and the arguments of that functor as tail.

'<'( @evaluable, @evaluable )

Arithmetic less than. True if the first number is less than the second one.

'>'( @evaluable, @evaluable )

Arithmetic greater than. True if the first number is greater than the second one.

'=\='( @evaluable, @evaluable )

Arithmetic not equal. True if the compared numbers are not equal.

'=<'( @evaluable, @evaluable )

Arithmetic less than or equal to. True if the first number is less than or equal to the second one.

'>='( @evaluable, @evaluable )

Arithmetic greater than or equal to. True if the first number is greater than or equal to the second one.

'is'( ?term, @evaluable )

Evaluate expression. Result is Expression is true if and only if evaluating Expression as an expression gives Result as a result.

compound( @term )

Check if compound. compound(X) is true if and only if X is a compound term (neither atomic nor a variable).

nonvar( @term )

Check if not variable. nonvar(X) is true if and only if X is not a variable.

number( @term )

Check if integer or float. number(X) is true if and only if X is either an integer or a float.

atom_length( +atom, ?integer )

Length of an atom. atom_length(Atom, Length) is true if and only if the number of characters in the name of Atom is equal to Length. If Length is not instantiated, atom_length will calculate the length of Atom's name.

atom_concat( ?atom, ?atom, +atom )

atom_concat( +atom, +atom, -atom )

Concatenate characters. atom_concat(Start, End, Whole) is true if and only if Whole is the atom obtained by adding the characters of End at the end of Start. If Whole is the only argument instantiated, atom_concat/3 will obtain all possible decompositions of it.