FASILL documentation Source fasill_builtin

Built-in predicates

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/1

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/4

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/1

consult( +atom )

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

consult_sim/1

consult_sim( +atom )

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

unfold/1

unfold( +rule_id )

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

','/2

','( +callable_term, +callable_term )

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

';'/2

';'( +callable_term, +callable_term )

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

call/3

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/1

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/3

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.

top/0

top

True. top is always true with the maximum truth degree of the lattice.

bot/0

bot

Fail. bot is always true with the minimum truth degree of the lattice.

truth_degree/2

truth_degree( +callable_tem, ?term )

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

guards/1

guards( on )

Guards. Guards on control construct.

findall/3

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/4

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.

'~'/2

'~'( @term, @term )

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

'='/2

'='( @term, @term )

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

'\~'/2

'\~'( @term, @term )

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

'\='/2

'\='( @term, @term )

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

weakly_unify_with_occurs_check/2

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/2

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.

'=='/2

'=='( @term, @term )

Term identical. True if the compared terms are identical.

'\=='/2

'\=='( @term, @term )

Term not identical. True if the compared terms are not identical.

'@<'/2

'@<'( @term, @term )

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

'@>'/2

'@>'( @term, @term )

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

'@=<'/2

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

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

'@>='/2

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

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

'=..'/2

'=..'( +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.

'<'/2

'<'( @evaluable, @evaluable )

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

'>'/2

'>'( @evaluable, @evaluable )

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

'=:='/2

'=:='( @evaluable, @evaluable )

Arithmetic equal. True if both numbers are equal.

'=\\='/2

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

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

'=<'/2

'=<'( @evaluable, @evaluable )

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

'>='/2

'>='( @evaluable, @evaluable )

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

'is'/2

'is'( ?term, @evaluable )

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

atom/1

atom( @term )

Check if atom. atom(X) is true if and only if X is an atom.

compound/1

compound( @term )

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

var/1

var( @term )

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

nonvar/1

nonvar( @term )

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

number/1

number( @term )

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

float/1

float( @term )

Check if float. float(X) is true if and only if X is a float.

integer/1

integer( @term )

Check if integer. integer(X) is true if and only if X is an integer.

ground/1

ground( @term )

Check if ground term. ground(X) is true if and only if X is a ground term.

atom_length/2

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/3

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.