BPL version 3.6  (January, 3rd 2021)

The main contribution of this version is the incorporation of novel implementation techniques for improving the efficiency of the BPL system. With respect to former version 3.5, the present version 3.6 adds the following:


1) Syntax extended with DCG grammar rules.

2) Added t-norms drastic, nilpotent and hamacher.

3) Numbers are not weak unified anymore.

4) Indexing optimization: symbols which are not similar to any other under the current lambda-cut are not weak unified. This allows for taking advantage of the host Prolog system indexing (both multiargument and deep indexing). As a novelty, facts can result from BPL to TPL translations (when no weak unification is involved).

5) A new directive :-indexing(+Boolean) is provided for either enabling or disabling indexing optimization. By default, it is enabled (Boolean=true).

6) Tail recursion optimisation (TRO) is kept for translated BPL programs, which is possible by adding an accumulator argument for degree compositions.

7) A new directive :-degree_accumulator(+Boolean) is provided for either enabling or disabling degree accumulator translation. Enabling this translation implies not breaking TRO in BPL programs. By default, it is enabled (Boolean=true).

8) Included filenames can be specified without the .bpl extension.

9) New command ti for enabling or disabling time statistics for each input.

10) Improved parser can handle bigger BPL programs.

11) Added a message indicating the end of parsing to the command ld.


1) Under the new indexing optimization, it may be the case that logical view update is lost when retracting facts.

Fixed bugs:

1) Atoms were not quoted when needed upon displaying solutions.

2) Propositional predicates could not be asserted (non-termination).

3) Weighted rules below lambda-cut were not rejected when filtering was enabled. This might deal to answers below the lambda-cut for the Göedel t-norm (though worked for others).

4) The final lambda-cut test (over_lambdacut) in the expanded clauses was omitted when filtering was disabled for the Göedel t-norm. This might deal to answers below the lambda-cut for the Göedel t-norm.

5) Rules below the lambda cut were discarded when filtering was disabled.

6) Workaround for a possibly SWI-Prolog bug when changing the lambda cut and filtering enabled.


BPL version 3.5.1  (July, 23rd 2020)

With respect to former version 3.5, the present version 3.5.1 adds the following:


1) Checking for cycles in WordNet hierarchies to avoid non-termination.


BPL version 3.5  (January, 28th 2020)

With respect to former version 3.4, the present version 3.5 adds the following:


1) Graded rules. Fuzzy rules can be graded with an approximation degree with the following syntax:
Head :- Body with Degree.
where ‘:- true‘ can be omitted in the case of a rule with a true body (i.e., a fact). During a resolution step, Degree is composed with the resulting approximation degree obtained when weakly unifying Head and the current goal.

2) Closing the Windows application does no longer display a confirmation dialog box.

Fixed bugs:

1) The t-norm used when composing unification degrees was always min, instead of the selected one.
2) Upon file reloading, some predicates were incorrectly identified as built-ins.

BPL version 3.4  (July, 30th 2019)

With respect to former version 3.3, the present version 3.4 adds the following:


1) New explicit weak unification operator ~~. It enables expressing the weak unification of two terms, giving their approximation degree as an implicit result. Note that ~~ differs from the operator ~, which is a crisp one. For example, assuming the proximity equation a~b=0.5, the goal p(a)~p(b) succeeds with approximation degree 0.5. Note that the goal p(a)~p(b) is a syntactic sugaring for p(a)~p(b)>0, so that ~ cannot be used for explicit weak unification, and it returns an approximation degree of 1.0.

2) The compiled BPL file does not include the extension of sim/3 when either the algorithm A2 or A3 is selected. This reduces the size of the compilation of sim roughly to a half.

3) New command tm Input, which displays the execution time for Input by using the SWI-Prolog predicate time/1.

4) Optimized translation of rules:

      +   A goal degree_composition([],Degree) at the end of a clause is removed.

      +   A goal degree_composition([InDegree],OutDegree) at the end of a clause is replaced by the binding OutDegree <- InDegree.


1) Reflexivity of ~ is removed from the TPL file and it is made implicit in the BPL code.

2) Answers are more akin to SWI-Prolog:

      +  Instead of ‘Yes’, ‘true’ is displayed for goals solved with no bindings.

      +  When a goal cannot be proved for the first time, ‘false’ is displayed.

      +  If no more solutions are proved to exist, the user is not asked for an action.

      +  Bindings are separated by commas.

      +  A crisp result is not accompanied by “With approximation degree: 1” anymore.

      +  The last answer of a goal is not accompanied by “No answer” anymore.

Fixed bugs:

1) Predicate names were not taken into account for weak unification of a proximity relation. So, some goals might incorrectly succeed.
2) The default t-norm for ~ was not predefined before loading a program.

BPL version 3.3  (June, 13th 2019)

This release incorporates improvements in the operational mechanism and full access to WordNet through wide repertoire of built-in predicates.

More detailed, with respect to former version 3.2, the present version 3.3 adds the following:


1) Improved performance for the proximity-based unification algorithm (A3-C  —  i.e., A3 with external computation of extended proximity relation RB)

2) Reduced size of TPL file for A3 algorithm

3) Access to wn_connect public predicates from BPL programs and goals. For using them as (sub)goals in the top-level, use either ensure_loaded(wn(wn_connect)) or previously load a program with the :- wn_connect directive.

4)  New directives for controlling compilation warnings:

      +    :- filtering_warning(+Boolean).
If Boolean=true, then warn if an equation is filtered
during parsing; otherwise, do not.

+    :- ontology_warning(+Boolean).
If Boolean=true, then warn if the loaded program does
not contain rules; otherwise, do not.

5) Completed extended help on the ‘ts’ command.


1) Removed error messages from wn-connect public predicates. An error implies a failure now.

2) Slight changes in the system banner.

Fixed bugs:

1) Filtering was always made irrespective of the filtering command or directive.
2) Computations were pruned for a degree less **or equal** than the lambda-cut value.
3) In rules with only built-ins in the body, constraint stores were not correctly linked durint translation for A3 algorithm.
4) Algorithm A2 left extra choice-points.
5) Loading a file left extra choice-points.


BPL version 3.2  (April 2019)

With respect to former version 3.1.1, the present version 3.2 adds the following:


1) Modifiers on predicate symbols are allowed for flexible building of fuzzy relations.
2) Equations in both programs and ontologies can be filtered by lambda-cut. As well, those resulting from computing the closure are filtered by the lambda-cut. To change this behaviour, a new command ‘fl’ and a new directive ‘filtering’ to enable and disable filtering are added. Filtering may hugely prune the search space, reducing memory consumption and enhancing performance.
3) Fully automated tests (no need for user inputs).
4) Other minor enhancements are:

+ Void input (Intro) does no longer generate an error message.
+ An equation between two elements with a lower degree than an existing one is filtered in advance.

Fixed bugs:

1) When loading a program, previous sim equations were not cleared.
2) A comment at the last line without an ending new-line made the parsing to fail.
3) Incorrect error message for lambda_cut directive.
The transitivity directive might misbehave in specific situations.


BPL version 3.1.1  (March 2019)

With respect to former version 3.1, the present version 3.1.1 adds the following:

1) Fixes a bug for the external computation of block equations (they were not updated correctly after submitting a goal containing fuzzy sets).

2) A host safe mode for web deployment: it minimizes the risks of external attacks to a web-based interface to the BPL system.

3) A folder with examples and a paper explaining them.


BPL version 3.1  (January 2019)

With respect to former version 3.0, the present version 3.1 enables access to WordNet, with the following new features:

1) Following the tool WordNet::Similarity, three similarity measures based on path lengths between concepts (PATH, WUP and LCH), and three based on information content (RES, JCN and LIN) have been implemented in BPL.

2) New directives:
:- wn_connect.
This directive performs the necessary actions to connect Bousi~Prolog to the WordNet resources. It must occur before any other access to WordNet, and it assumes that the environment variable WNDB has been set to the OS directory in which the WordNet database is stored.
There is an alternative to this directive if the environment variable cannot be set or the user simply does not want to:

:- wn_connect(+Directory).
Where Directory is the directory in which the WordNet database is located (the symbol + indicates that this argument is required).

:- wn_gen_prox_equations(+Measure, +ListOfListsOfPatterns)
Where Measure is the similarity measure which can have any of the following constant values: path, wup, lch, res, jcn and lin. The second argument ListOfListsOfPatterns is a list for which each element is another list containing the patterns that must be related by proximity equations. The pattern can be either a word or the structure Word:Type:Sense, where Word is the word, Type is its type (either n for noun or v for verb), and Sense is the sense number in its synset. If the pattern is simply a word, then a sense number of 1 is assumed, and its type is made to match all other words in the same list.


BPL version 3.0  (May 2018)

This release incorporates an efficient proximity-based unification algorithm for the first time.

The present release ver. 3.0 incorporates new functionalities with respect to ver. 2.01:

1) Three different weak unification algorithms:

(a1) The similarity-based unification algorithm proposed by Maria Sessa [Ses2002], which is only adequate for similarity relations (i.e., transitive proximities). Note that Sessa’s weak unification algorithm turns incomplete when it works with proximity relations that do not fulfil the transitive property. Then, use it when you work exclusively with similarity relations.

(a2) The original proximity-based unification algorithm that was defined in our 2015 FSS paper [JR2015], which uses “proximity constraints”. This algorithm is inefficient, therefore we do not recommend to use it.

(a3) A new reformulation of the proximity-based unification algorithm, which uses the new concept of “block constraint” (see our 2018 FuzzIEEE paper [JS2018]). It can be executed efficiently and we recommend this option when you use proximity relations; otherwise, the system becomes unsound.
These algorithms can be activated by means of the directive:

:- weak_unification(Alg).

where the parameter Alg is one of the constants {a1,a2,a3}. By default, the weak unification algorithm a1 is activated.

2) The weak unification algorithm relies on the proximity blocks of a proximity relation, in order to weak the notion of syntactic equality. Two symbols are approximate (i.e., considered equals) if they belong to the same proximity block.

The BPL system may compute proximity blocks by means of two different types of predicates: a foreign predicate, named “ext_block_equs“, implemented in C to obtain greater efficiency, as well as an internal predicate implemented in Prolog.

Proximity blocks are computed at compile time. The directive:

:- ext_block_equs(Boolean).

specifies if the proximity blocks are computed either by means of the foreign predicate (when Boolean is “true”), or by means of the internal predicate (when Boolean is “false”).

3) Former versions of the BPL system propagated truth degrees in a derivation by compounding the approximation degrees obtained in each step using a minimum t-norm exclusively. In the present implementation, it is possible to choose other t-norms, different of minimum t-norm. The directive:

:- fuzzy_logic(TNorm).

where the parameter TNorm is one of the following constants: min, product, luka, drastic, nilpotent, and hamacher.

Note that this new functionality can be understood as the way the conjunction symbol (“,”) in the body of a rule or in a goal is interpreted. For instance, if we choose “hamacher” as the value of the parameter “TNorm”, the conjunction “,” will be interpreted as a Hamacher t-norm.


BPL version 2.0.1  (April 2018)

The present release ver. 2.01 does not incorporate new functionalities with regard to ver. 2.0, but it incorporates adaptations to permit the execution of Bousi~Prolog on the last version 7.6.4 of SWI-Prolog.


BPL version 2.0  (September, 2011)

This is the first BPL version where programs are not meta-interpreted. Instead, BPL programs are translated to standard Prolog code able to simulate the weak operational semantics. The weak unification process still relays on Sessa’s similarity-based unification algorithm.

The present release ver. 2.0 incorporates new features with respect to ver. 1.07:

1) A new lexical, syntactic and semantic analysis of BPL programs.

2) A compiler able of translating Bousi∼Prolog programs into intermediate structures that can be used later by a Prolog interpreter.

3) A renewed command processor that allows loading and executing BPL programs using the compiler and interpreter previously mentioned.

4) Support for fuzzy sets and linguistic variables:
The domain directive allows to declare and define the universe of discourse associated to a linguistic variable. We only deal with domains of the real interval. The concrete syntax of this directive is
where, Dom_Name is the name of the domain, n and m (with n < m) are the lower and upper bounds of the real subinterval [n, m], and Magnitude is the name of the unit wherein the domain elements are measured.
Example:    :-domain(age,0,100,years)

The fuzzy set directive allows to declare and define a list of fuzzy subsets (which are associated to the primary terms of a linguistic variable) on a predefined domain. The concrete syntax of this directive is:
     :-fuzzy_set(Dom_Name,[Set1(a1,b1,c1[,d1]), …, SetN(aN,bN,cN[,dN]]).
Fuzzy subsets are defined by indicating their name, Set_i, and membership function type. At this time, it is possible to define two types of membership functions: either a trapezoidal function (if four arguments are used for defining the fuzzy subset) or a triangular function (if three arguments are used).
:-fuzzy_set(age, [young(0,0,30,50), middle(20,40,60,80), old(50,80,100,100)]).

Operator # for the generation of composite terms (e.g. very#young, more_or_less#middle or extremely#old), domain points (e.g. age#22, about#age#22) and domain ranges (e.g. age#20#30, about#age#20#30).

5) Access to all repertory of standard SWI-Prolog predicates.


BPL version 1.07 (November, 2009)

BPL version 1.07 was the first publicly available BPL release based on a high level implementation.
The BPL system (versions 1 to 1.07) was a prototype, written on top of SWI-Prolog. The parser and translator module translated (compiled) rules and facts of the source BPL code into an intermediate Prolog code representation which was called “TPL code” (Translated BPL code). Then, following standard techniques, a meta-interpreter executed the TPL code according to the weak SLD resolution principle.

For that version BPL essentially provides:

1) An implementation of Sessa’s weak unification algorithm which operates on the basis of a similarity relation (a fuzzy binary relation holding the reflexive, symmetric and transitive properties) on a syntactic domain.

2) Automatic generation of a similarity relation starting from an ordinary fuzzy binary relation on a set of first order symbols of a BPL program. The arbitrary fuzzy binary relation R is represented by a set of proximity equations of the form
 symbol ~ symbol = degree
A proximity equation “a ~ b = degree” is representing the entry “R(a,b)=degree” of the relation R. The user supplies an initial subset of similarity equations and then, the system automatically generates a reflexive, symmetric, transitive closure to obtain a similarity relation. The transitivity/1 directive can alter this default behavior.

A foreign module, written in the C programming language, implemented the algorithm for the construction of the similarity relation.

3) BPL directives:
:- transitivity(<option>).
depending on the <option> (yes or no) it activates or deactivates the generation of the transitive closure of the fuzzy relation.

:- lambda_cut(<degree>).
imposes a <degree> limit to the expansion of the search space in a computation.

4) BPL operators: weak unification operator (∼∼) ; crisp negation as failure (\+) and weak negation as failure (not).

5) Access to the main repertory of standard Prolog predicates: arithmetic and comparison operators; syntactic unification; list manipulation; predicates for analysing and constructing terms and strings; Edinburgh-style I/O and control predicates.