Introduction:
In the early 70's French language developed Alain Colmenuer Prolog also allows the development of applications in a declarative way.
PROLOG In general the automatic is a problem demonstrator, which uses a Knowledge Base in the form of deductive inference rules (Horn clauses), ie, its rules have resulted in a single action and the inferences obtained ned strictly logical (true or false), although it may seem a limitation, it does not is entirely fair, since PROLOG allows logic programming with probabilistic inference mechanisms, since it is searching trees with accumulation of evidence.
The PROLOG as a language of predicate calculus emerged, took the following ideas of logic for implementation.
1) A set of axioms or facts.
2) Rules of inference which are solved by resolution and unification.
3) The objective to demonstrate the conditions that will unify the rules. LISP
also took the treatment of the lists for the representation of the Prolog complejas.Aunque structures had their origin in mathematical logic was not an exact transposition, and is linked to the discussions that hold the key for years Artificial Intelligence researchers, which are divided into two groups, firstly Minsky who proposes to study the mechanisms of human thought and then simulate on the computer.
Minsky The most important are the concepts, that is the interpretation that can be given to each word depending on a given context.
The other group headed by Mac Carthy (author of LISP), states that mathematical logic is the characteristic feature for the representation of reasoning and its implementation in the computer, this group focuses on the formalization and structure of knowledge rather than the sense of them.
since ancient logic was conceived as a method of discovering the laws of thought, but these laws have always been restricted to scientific thought and especially the mathematician, leaving out common sense. This deficiency is supported by advocates logic, but they consider that logic is the only way possible to develop programs capable of showing intelligence.
Declarative programming Declarative programming
The main thing is not the instructions given in sequence (programming prescriptive), instead, the programmer focuses on describing the problem through rules and facts that operate independently and it is through a mechanism of inference rules are implemented.
declarative programming in the rules (knowledge base) is separated from the control program (inference machine).
declarative programming Example:
If
Where a serious fact: John is a student
The dog is white
Maria loves movies.
operational knowledge is procedural in nature. Conclusion If premises then
(There are also those who use: If conditions then Actions)
If P then C Where: P and C instructions would be in the presence of a procedural representation. P and C
facts or assertions would be in the presence of a declarative representation. Example
procedural representation
If A1 = B1 and A2> B2 then X: = A1 + A2
Where
A1 = B1 and A2> B2 are comparisons to take real ¨ value, "or" false ¨.
So we have:
If P1 and P2 then C
where P1 and P2 would be logical variables (true or false would)
Example
If
This in any language would be as follows:
X: = "John is a student"
Y: = "John has 7 years"
if X = "John is a student" and Y = "John has 7 years" Then Z
: = "John is in the primary"
Let's see how to formalize the facts or assertions
Example: John has 10 years of age
1)
2) relation (concept, a concept that uses Prolog's ,....)
age (John, 10) is also used
3)
We will concentrate on the first two performances.
Example 1: The lion is a mammal
is-a (lion, mammal)
Example 2: Mary likes movies.
1)
2) likes (maria, film)
Lets look at some examples where the facts are combined in the form of rules or clauses:
if
Now we formalize the facts:
1) if
(similar to Prolog)
2) lives (shark, in-water) if he (fish, in-water) and is-a (swordfish, shark)
prolog Note that the conclusion stands in front of the premises
representation in the form of rules: if premises
Conclusion What then would be interpreted as if
then
conclusion can be made by several facts or assertions.
Representation in Prolog: Conclusion
if
Premises and be interpreted as if
Where the conclusion is given by a single fact or assertion.
Exercise 1:
1. Mary likes tennis.
2. Tommy likes baseball.
3. José likes sports likes Thomas.
1.
2. S
3. If so
Similar to prolog:
1. likes (maria, tennis)
2. like (footage, baseball)
3. like (Jose, X) If you like (sockets, X)
Exercise 2:
Sophie wants a man who does not smoke.
if
Similar to prolog:
want (sofia, X) if man (X) and do not smoke (X)