Fril is a
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
for
first-order predicate calculus
First-order logic—also known as predicate logic, quantificational logic, and first-order predicate calculus—is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantifie ...
. It includes the
semantics
Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy
Philosophy (f ...
of
Prolog
Prolog is a logic programming language associated with artificial intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
as a subset, but takes its
syntax
In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituency) ...
from the of
Logic Programming Associates
Logic Programming Associates (LPA) is a company specializing in logic programming and artificial intelligence software. LPA was founded in 1980 and is widely known for its range of Prolog compilers and more recently for VisiRule.
LPA was esta ...
and adds support for
fuzzy set
In mathematics, fuzzy sets (a.k.a. uncertain sets) are sets whose elements have degrees of membership. Fuzzy sets were introduced independently by Lotfi A. Zadeh in 1965 as an extension of the classical notion of set.
At the same time, defined a ...
s,
support logic, and
metaprogramming
Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
.
Fril was originally developed by Trevor Martin and Jim Baldwin at the
University of Bristol
, mottoeng = earningpromotes one's innate power (from Horace, ''Ode 4.4'')
, established = 1595 – Merchant Venturers School1876 – University College, Bristol1909 – received royal charter
, type ...
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
Term may refer to:
* Terminology, or term, a noun or compound word used in a specific context, in particular:
**Technical term, part of the specialized vocabulary of a particular field, specifically:
***Scientific terminology, terms used by scient ...
, 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
identifier
An identifier is a name that identifies (that is, labels the identity of) either a unique object or a unique ''class'' of objects, where the "object" or class may be an idea, physical countable object (or class thereof), or physical noncountable ...
s containing only
uppercase letter
Letter case is the distinction between the letters that are in larger uppercase or capitals (or more formally ''majuscule'') and smaller lowercase (or more formally ''minuscule'') in the written representation of certain languages. The writing ...
s and
underscore
An underscore, ; also called an underline, low line, or low dash; is a line drawn under a segment of text. In proofreading, underscoring is a convention that says "set this text in italic type", traditionally used on Manuscript (publishing), man ...
s (whereas Prolog only requires the first character to be uppercase). As in Prolog, the name
_
is reserved to mean "any value", with multiple occurrences of
_
replaced by distinct variables.
Syntax
Prolog
Prolog is a logic programming language associated with artificial intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
has a syntax with a typical amount of punctuation, whereas Fril has an extremely simple syntax similar to that of
Lisp
A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech.
Types
* A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
. A (propositional) clause is a list consisting of a predicate followed by its arguments (if any). 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 (goals). The general forms look like this:
(''fact'')
(''conclusion'' ''goal_1'' ... ''goal_n'')
These are equivalent to the respective Prolog constructions:
''fact''.
''conclusion'' :- ''goal_1'', ..., ''goal_n''.
For example, consider the
member
predicate in Prolog:
member(E, _.
member(E, T :- member(E, T).
In Fril, this becomes:
((member E (E, _)))
((member E (_, T)) (member E T))
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
Arity () is the number of arguments or operands taken by a function, operation or relation in logic, mathematics, and computer science. In mathematics, arity may also be named ''rank'', but this word can have many other meanings in mathematics. In ...
, except that none of the facts can be removed (other than by
kill
ing the relation); 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 (all of the arguments of the equivalent fact without the predicate name). 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
A knowledge base (KB) is a technology used to store complex structured and unstructured information used by a computer system. The initial use of the term was in connection with expert systems, which were the first knowledge-based systems.
Ori ...
. Once a predicate is a relation, anything that would ordinarily add a rule (and does not violate the restrictions of relations) automatically adds a tuple to the relation instead.
Here is an example. The following set of facts:
((my-less-than 2 3))
((my-less-than 8 23))
((my-less-than 42 69))
can be rewritten as the relation:
(my-less-than
(2 3)
(8 23)
(42 69))
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
?
(or one of the other query-related predicates).
Fuzzy sets
Fril supports both continuous and discrete fuzzy sets, each with their own special syntaxes. A discrete set (dtype) lists discrete values and their degrees of membership, with this syntax:
{''value'':''dom'' ''value'':''dom'' ... ''value'':''dom''}
''value'' is an atom or number, and ''dom'' is a value in the interval
, 1
The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
A continuous set (itype) lists
real number
In mathematics, a real number is a number that can be used to measure a ''continuous'' one-dimensional quantity such as a distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every real ...
s and their degrees of membership; the degree-of-membership function is the linear interpolation over these mappings. The syntax is thus:
'value'':''dom'' ''value'':''dom'' ... ''value'':''dom''where the values must be given in non-decreasing order.
Each dtype and itype may be constrained to a universe (a set of allowable values). Fril has predicates for fuzzy set operations (but does not directly support control through
fuzzy logic
Fuzzy logic is a form of many-valued logic in which the truth value of variables may be any real number between 0 and 1. It is employed to handle the concept of partial truth, where the truth value may range between completely true and completely ...
). 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 (called a support pair) associated with it by appending
:(''min'' ''max'')
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
=..
(which maps between lists and clauses) 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:
* Both Prolog and Fril have
shell
Shell may refer to:
Architecture and design
* Shell (structure), a thin structure
** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses
** Thin-shell structure
Science Biology
* Seashell, a hard ou ...
applications, which serve as the standard way of interacting with them. Prolog reads commands in two modes: in source file-reading mode, it accepts directives and clauses; in user interaction mode, it accepts only queries (although it is possible to tell Prolog to read directives and clauses from
standard input
In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
by using
consult(user).
). Fril makes no distinction: all types of commands can be given both from source files and on the command line.
* The Prolog shell automatically prints the values of all instantiated variables that appear in a query, along with a ''yes'' or ''no'' answer. The Fril shell only gives the answer; it is the user's responsibility to print variables if desired.
References
* Martin, T. P. (electronic mail to M. Kantrowitz, March 10, 1994).
Re: FRIL'. Retrieved October 18, 2005
Archived copy in November 27, 2014* Pilsworth, B. W. (n.d.).
'. Retrieved October 18, 2005.
* Fril Systems Ltd (1999).
'. Retrieved October 20, 2005.
External links
the official download site for Fril
*
ogic Programming (Fril) and Artificial Intelligence Lab Zengchang Qin
Logic programming languages