3 6-LogicProgramming
3 6-LogicProgramming
A Fact as well as a Query is a single Goal. A fact is ended with a Fact father(john,tom).
period `.´ A Goal is ended by a questionmark ´?´. Query father(X,tom)?
A rule has the form A:-B1,B2,....,BN where A is the Head and the
Rule grandfather(X,Y):-
Bi´s are the Body. The A and the Bi´s are Goals.
father(X,Z), parent(Z,Y).
parent(X,Y):-mother(X,Y).
parent(X,Y):-mother(X,Y).
ancestor(X,Y):-parent(X,Y).
ancestor(X,Y):-parent(X,Z),ancestor(Z,Y).
If the negated query can be refuted, it follows that the query, with the
appropriate variable bindings in place, is a logical consequence of
the program. In that case, all generated variable bindings are reported
to the user, and the query is said to have succeeded.
In that case, the system creates a choice-point, unifies the goal with
the clause head of the first alternative, and continues with the goals of
that first alternative.
If any goal fails in the course of executing the program, all variable
bindings that were made since the most recent choice-point was
created are undone, and execution continues with the next alternative
of that choice point. This execution strategy is called chronological
Learning for this Representation
Inductive Logic Programming is a subfield of machine learning where prolog
statements are induced from examples.