Rating : ⭐⭐⭐⭐⭐
Price : \$10.99
Language:EN
Pages: 2

This defines the son the child and male child

http://www.cs.nps.navy.mil/people/faculty/rowe/book/chap4.html

Prolog rules have a left side and a right side, and the symbol :- in between (it is supposed to look like a backward arrow, but you need a good imagination). Read the symbol as "if". To its left side is a single predicate expression, usually with variables as arguments. To its right side is a query, with possibly multiple predicate expressions combined with the comma ("and"), semicolon ("or") and not symbols. For instance:

gray_enterprise :- part_of(enterprise,X), color(X,gray).

?- gray_enterprise.

the interpreter succeeds (answers yes) if it can succeed in querying the right side of the gray_enterprise rule. Otherwise the interpreter fails (answers no). It's like the right side of the rule is substituted for the left side whenever it occurs in a query. The variable X is a local variable in the rule, a variable whose value will be "thrown away" when the rule is done, and will not be printed out in any query answer. Any Prolog variable that appears only on the right side of a rule is called local to that rule.

C is a parameter variable of the rule, and a value for it will be "returned" as a result of executing the rule. So if we query

?- color_enterprise(C).

Here X and C are parameter variables, and Y is a local variable. So values for X and C only will be returned.

Figure 4-1 summarizes our terminology about rules. You can think of local variables as being
existentially quantified ("there exists some X such that something is true"), and parameter variables as universally quantified ("for every X something is true")--see Appendix A for more about quantification, an important concept in logic. Actually, the distinction of "local" from "parameter" variables is misleading, because the opposite of "local" is "global", and there aren't any true "global" variables in Prolog. Rules just give a shorthand for queries, and a variable X is one query is always different from a variable X in a separate query. The only way to get anything like a global variable in Prolog is to assert a fact.

http://www.cs.nps.navy.mil/people/faculty/rowe/book/chap4.html (2 of 29) [23/04/2002 17:38:42]

How It Works
Make payment
PageId: ELI2C9C864