Glossary

Index

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 

P

Index


Parameter

Context

A term in Prolog and CG theory

Definition - CG theory

Either a formal parameter or an actual parameter of a lambda expression.

Definition - Prolog

Either a formal parameter or an actual parameter of a predicate.


Partial order

Definition

A partial order is a relation between elements of a set. That is, it defines relationships between all of the elements of a set, and these relationships obey three axioms (given below).

Example

For example, "≤" is a partial order over the natural numbers. For example:

  • 2 ≤ 3
  • 3 ≤ 4
  • 3 ≤ 6
  • 2 ≤ 2

Axioms

Thus a partial order over a set S defines relationships between all of the elements of S, and these relationships all obey the following three axioms or rules:

1. Reflexivity

For all elements A of S, it is true that:

   A ≤ A

For example:

  • 2 ≤ 2,
  • 3 ≤ 3,
  • 4 ≤ 4,
  • ... etc.

2. Transitivity

For all elements A, B, and C in S, this rule allows us to infer that:

if

   A ≤ B

and

   B ≤ C

then

   A ≤ C

For example, since

  • 2 ≤ 3, and
  • 3 ≤ 6,

it must also be true that

  • 2 ≤ 6.

3. Antisymmetry

For all elements A and B of S, it is true that:

if

   A ≤ B

and

   B ≤ A

then

   A = B

For example, since "2 ≤ 2" and "2 ≥ 2", it must be true that "2=2".


Predicate

Context

A term in Prolog.

Definition

A predicate is a collection of clauses with heads that match each other.

For example, a predicate can be made up of a collection of rules and facts that have the same functor and arity, and whose arguments are all variables.

Example

For example, consider the following program:

father(Terah, Abraham).
father(Abraham, Isaac).
father(Isaac, Jacob).
father(Jacob, Judah).

ancestor(A,D) :- father(A,D).
ancestor(A,D) :- father(F,D), ancestor(A,F).

This program contains two predicates: father/2 and ancestor/2. The father/2 predicate consists of four facts, while the ancestor/2 predicate consists of two rules.

A predicate can be a mix of facts and rules.


Primitive

Context

A term in programming.

Definition

A primitive is an action which you, as a programmer, is allowed to take without writing a whole lot of code.

Examples

For example, Prolog+CG has a number of built-in predicates, such as:

  • eq
  • eqv
  • not
  • fail

As another example, if you have the following two lines of code:

ancestor(A,D) :- father(A,D).
ancestor(A,D) :- father(F,D), ancestor(A,F).

then you have the primitive called ancestor/2. This is because you now have an easy way of finding out whether an entity is an ancestor of another entity. You don't need to write a lot to find out, and therefore it is a primitive.


Program database

Context

A term in Prolog.

Definition

The program database is the sequence of clauses making up the program.

Explanation

In Prolog, the data are usually written as facts. Since the data are incorporated into the program, we speak of the program database. This principle is known as "Program as data".


Prolog+CG data

Context

A term in Prolog+CG.

Definition

In Prolog+CG, the following kinds of data are available:

lists are discussed in Module 2.

Booleans are data with one of the following two values:

  • true
  • false


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z