ArticleslgStudy

science

Fril

Fril is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Fril rather than just read about it. In short: 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 micro-PROLOG of Logic Programming Associates and adds support for fuzzy sets, support logic, and metaprogramming.

Key takeaways

  • Fril belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Fril to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Fril from memory before moving on to harder problems.

Reference excerpt

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 micro-PROLOG 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 (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 has a syntax with a typical amount of punctuation, whereas Fril has an extremely simple syntax similar to that of Lisp. 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:

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, except that none of the facts can be removed (other than by killing 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. 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 [0, 1]. A continuous set (itype) lists real numbers 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). 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 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 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.). The Programming Language Fril Archived 2005-04-08 at the Wayback Machine. Retrieved October 18, 2005. Fril Systems Ltd (1999). Fril - Online Reference Manual - Preliminary Version (incomplete) Archived 2006-02-19 at the Wayback Machine. Retrieved October 20, 2005.

External links Fril - downloadable resources, the official download site for Fril [Logic Programming (Fril) and Artificial Intelligence Lab], Zengchang Qin

Worked examples

Example 1 — a first encounter with Fril

Start with the simplest possible case. Write down what Fril claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Fril before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Fril ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Fril

In research
Fril appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Fril in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Fril is common in secondary-school and first-year university syllabi. It links to neighbouring topics Logic programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for Fril outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Fril” →

How to study Fril in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Fril means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Fril out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Fril in simple terms?

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 micro-PROLOG of Logic Programming Associates and adds support for fuzzy sets, support logic, and metaprogramming.

Why does Fril matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Fril?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Fril.

Tags

  • Logic programming languages

Keep exploring