Logic Programming

First-Order Logic (2)

The binding strength of the quantifiers For Allx and There Existsx, is that same as that of NOT. The rest of the connectives follow with the following decreasing binding strength AND OR IMPLIES IF AND ONLY IF. In Prolog, constant symbols conventionally begin with lower case letters, and variable symbols begin with upper case letters or an underscore.

In some texts, different symbols are used for the connectives:

Name Connective Alternative Example
Negation NOT ~ ¬a
Conjunction AND & aANDb
Disjunction OR or aORb
Conditional IMPLIES if aIMPLIESb
Biconditional IF AND ONLY IF iff aIF AND ONLY IFb

The first order language given by an alphabet consists of the set of all formulas constructable from the symbols of the alphabet. Here are some definitions of various pieces of informal grammar used in conjunction with an alphabet, when constructing first order predicate logic language:

  • A term is either a constant symbol, a variable symbol or an n-ary function symbol applied to a tuple of n terms.
    • e.g. a, X, f(b, f(b,Y,Z),Y)
  • An atomic formula is a predicate symbol applied to a tuple of terms.
    • e.g. likes(X,sim), borrows(book, sim)
  • A well-formed formula is either an atomic formula or else takes one of the following forms:
    • W, ¬W, W1 AND W2, W1 OR W2, W1 IMPLIES W2, W1 IF AND ONLY IF W2, For AllxW, There ExistsxW.
  • In a well formed formula, the scope of a quantifier is defined as W. We say that the quantifier (ie For Allx or There Existsx) quantifies every occurrence of x in W.
  • An occurrence of a variable symbol x in a well formed formula W is said to be bound if and only if it lies within the scope of or in some quantifier (For Allx or There Existsx) which occurs in W.
  • An occurrence of a variable symbol that is not bound is said to be unbound (or free).
  • A sentence (or closed formula) is a well-formed formula in which every occurrence of every variable symbol is bound.
    • e.g. For Allx (There Existsy child(x) IMPLIES father(y,x)) every child has a father.
  • A literal is either an atomic formula or a negated atomic formula.
    • e.g. likes(sim, books), ¬likes(sim, pain)
  • A ground term is a term containing no variable symbols.
  • A ground formula is a formula containing no variable symbols.
  • Atomic formulas are commonly called predicates.