Fact

 

Facts are statements that describe object properties or relations between objects. Let us imagine we want to encode that Ulysses, Penelope, Telemachus, Achilles, and others are characters of Homer’s ended with a period: 

From these examples, we understand that the general form of a Prolog fact is: relation(object1, object2, …, objectn) objects, such as normally strings of letters, digits, or underscores  letter. An atom can also be a string beginning with an uppercase letter or including white spaces, but it must be enclosed between quotes. Thus . Symbols or names representingulysses or penelope, are called atoms. Atoms are_”, and begin with a lowercase’Ulysses’ or ’Pallas Athena’ In logic, the name of the symbolic are legal atoms.relation is the predicate, the objects object1 and the number by its name and arity: , object2, . . . , objectn involved in the relation are the arguments,n of the arguments is the arity. Traditionally, a Prolog predicate is indicatedpredicate/arity, for example, character/2, king/3

Iliad and Odyssey. This translates into Prolog facts    character(priam, iliad). character(hecuba, iliad).

Advertisements

An Introduction to Prolog

Prolog was designed in the 1970s by Alain Colmerauer and a team of researchers with the idea – new at that time – that it was possible to use logic to represent knowledge and to write programs. More precisely, Prolog uses a subset of predicate logic and draws its structure from theoretical works of earlier logicians such as Herbrand (1930) and  robinson (1965) on the automation of theorem proving. Prolog was originally intended for the writing of natural language processing applications. Because of its conciseness and simplicity, it became popular well beyond this domain and now has adepts in areas such as:

• Formal logic and associated forms of programming

• Reasoning modeling

• Database programming

• Planning, and so on.