previous up next
Go up to 2.3 Predicate Logic
Go forward to 2.3.2 Atomic Formulas
RISC-Linz logo

2.3.1 Terms

Definition 12 (Term) A  term (Term, Begriff) is a syntactic phrase whose meaning is a value (of the domain being considered). 

The meaning of a term therefore depends on the domain; changing the domain also changes the meaning of a term.

Operational Interpretation  In the Logic Evaluator, every term is an instance of a Java class that implements the following interface:

public interface Term
  Value eval() throws EvalException;

For every Term t, the evaluation of t.eval() returns the value denoted by t (or throws an exception if some error has occurred).

Definition 13 (Variable, Assignment) A  variable (Variable) is a name that may represent any value of the domain.

A variable  assignment (Zuweisung, Belegung) maps every variable to a value of the domain.

The value of a variable therefore depends on a given assignment, e.g. the assignment [x |-> "one", y |-> "two"] on the domain of natural numbers maps the variable y to the value "two".

Please note that variables may be only mapped to values, i.e., to  first order objects (Objekte erster Ordnung), not to relations or functions, i.e., to  higher order objects (Objekte höherer Ordnung). The version of predicate logic that imposes this restriction is called  first order predicate logic (Prädikatenlogik erster Stufe). As we will see in Chapter Sets, we can encode functions and relations as first order objects, such that this restriction does not limit the expressiveness of the language from the practical point of view.

Definition 14 (Function Constant) A  function constant (Funktionskonstante) is a name that may represent some function. The arity of the function constant determines the arity of the functions it may stand for.

We call a function constant of arity 0 an  object constant (Objektkonstante).

We use the notion  name for any combination of characters ("x_2") or symbols ("sqrt( )"). Since both variables and function constants are names, we apply in this document the syntactic convention that only names starting with the letters x, y, z denote variables (unless explicitly stated otherwise).

Example  The following are function constants:

Terms are then constructed as follows.

Proposition 12 (Syntax of Terms) 

Terms do not necessarily appear in the "standard form" denoted above but they may appear in various syntactic formats.

Example  The following are terms: A natural language term
the roof of the house of her father
can be written in prefix form as
with function constants "roof", "house", "father" and a variable "she".

Definition 15 (Semantics of Terms) The meaning of a term t under an assignment in some domain is defined as follows:
The value of a term therefore depends on the domain (determining the  interpretation of the constants as functions of the domain) as well as on the variable assignment (determining the values of the variables).

Example  Take the term
x + (y + 0).
In the domain "natural numbers" with object constant 0 interpreted as the number "zero", the function constant + interpreted as addition and under the variable assignment [x |-> 1, y |-> 2], the value of this term is the number "three". However, under the variable assignment [x |-> 1, y |-> 0], its meaning is "one".

In the domain "character strings" with object constant 0 interpreted as the empty string, the function constant + interpreted as string concatenation and under the variable assignment [x |-> "hi, ", y |-> "babe"], the value of the term is "hi, babe".

The Logic Evaluator has the domain "natural numbers" builtin with object constants 0, 1, ...and function constants + and *. Since terms must be entered always in prefix notation, terms can be evaluated as follows:

Operational Interpretation  Elementary terms are implemented by the following Java class:

public final class Application implements Term
  private String name;
  private Term[] arguments;

  public Application(String _name, Term[] _arguments)
    name = _name;
    arguments = _arguments;

  public Value eval() throws EvalException
    Function function = Model.getFunction(name, arguments.length);
    if (function == null)
      throw new EvalException("unknown function " + name + 
                              "/" + arguments.length);
    Value[] values = new Value[arguments.length];
    for (int i=0; i< values.length; i++)
      values[i] = arguments[i].eval();
    return function.apply(values);
The Java term new Application(f, args).eval() evaluates to the meaning of the term f(args) (where f is a function constant and args is the list of arguments). As one can see, first we determine the interpretation function of the function constant in the given domain (Model), then we evaluate the arguments and apply the function to the results.

The operational interpretation of variables will be explained in Section Quantified Formulas.

Author: Wolfgang Schreiner
Last Modification: October 4, 1999

previous up next