next up previous
Next: Another Example Up: No Title Previous: PROLOG

Example

In predicate calculus
displaymath235

	green(fonzie)
	green(puff)
	green(martian)

	dragon(godzilla)
	dragon(puff)

The corresponding translation in Prolog will be :

fly(X) :-	
	green(X),
	dragon(X).

body tex2html_wrap_inline233 antecedents that must be true.

A Logical Deduction is called a Query

Find a fact to match the goal : Binding

Some Prolog Facts :

Find a fact to match the goal : Binding

So in the previous example, for instance, puff was found to be a valid answer. If more than one possible answers existed to the problem, then the first goal variable is unbound (i.e. its value discarded) and the next matching value bound to it.

Fundamental processes in the understanding of how Prolog works.



Omer F Rana
Mon Jan 27 17:05:43 GMT 1997