Fril


Fril is a programming language for first-order predicate calculus. It includes the semantics of Prolog as a subset, but takes its syntax from the of Logic Programming Associates and adds support for fuzzy sets, support logic, and metaprogramming.
Fril was originally developed by Trevor Martin and Jim Baldwin at the University of Bristol around 1980. In 1986, it was picked up and further developed by Equipu A.I. Research, which later became Fril Systems Ltd. The name Fril was originally an acronym for Fuzzy Relational Inference Language.

Prolog and Fril comparison

Aside from the uncertainty-management features of Fril, there are some minor differences in Fril's implementation of standard Prolog features.

Types

The basic types in Fril are similar to those in Prolog, with one important exception: Prolog's compound data type is the term, with lists defined as nested terms using the . functor; in Fril, the compound type is the list itself, which forms the basis for most constructs. Variables are distinguished by identifiers containing only uppercase letters and underscores. As in Prolog, the name _ is reserved to mean "any value", with multiple occurrences of _ replaced by distinct variables.

Syntax

has a syntax with a typical amount of punctuation, whereas Fril has an extremely simple syntax similar to that of Lisp. A clause is a list consisting of a predicate followed by its arguments. Among the types of top-level constructs are rules and direct-mode commands.

Rule

A rule is a list consisting of a conclusion followed by the hypotheses. The general forms look like this:


These are equivalent to the respective Prolog constructions:
fact.
conclusion :- goal_1,..., goal_n.
For example, consider the member predicate in Prolog:

member.
member :- member.

In Fril, this becomes:

)

Relation

Some data can be represented in the form of relations. A relation is equivalent to a set of facts with the same predicate name and of constant arity, except that none of the facts can be removed ; such a representation consumes less memory internally. A relation is written literally as a list consisting of the predicate name followed by one or more tuples of the relation. A predicate can also be declared a relation by calling the def_rel predicate; this only works if the proposed name does not already exist in the knowledge base. Once a predicate is a relation, anything that would ordinarily add a rule automatically adds a tuple to the relation instead.
Here is an example. The following set of facts:
)
)
)
can be rewritten as the relation:


)

Direct mode

A predicate may be called with exactly one argument using the syntax:
predicate argument
Queries are submitted using this syntax, with predicate being ?.

Fuzzy sets

Fril supports both continuous and discrete fuzzy sets, each with their own special syntaxes. A discrete set lists discrete values and their degrees of membership, with this syntax:
value is an atom or number, and dom is a value in the interval .
A continuous set lists real numbers and their degrees of membership; the degree-of-membership function is the linear interpolation over these mappings. The syntax is thus:

where the values must be given in non-decreasing order.
Each dtype and itype may be constrained to a universe. Fril has predicates for fuzzy set operations. It is even possible to combine dtypes and itypes through some operations, as long as the dtypes contain only real numbers.

Support pairs

Any rule may have a probability interval associated with it by appending : to it, where min and max are the minimum and maximum probabilities. Fril includes predicates that calculate the support for a given query.

Disjunction

While Prolog uses punctuation — namely ; — for disjunction within clauses, Fril instead has a built-in predicate orr.

Merits

There are advantages and disadvantages to this simpler syntax. On the positive side, it renders predicates such as Prolog's =.. unnecessary, as a clause is a list. On the other hand, it is more difficult to read.

Behavior

As a logic programming environment, Fril is very similar to Prolog. Here are some of the differences: