Basic elements of Prolog


Some of the basic elements of Prolog are:
  1. Term
  2. Fact statements
  3. Rule statements

1. Term:  A Prolog term is a constant, a variable, or a structure.
A constant is either an atom or an integer.

Atoms are the symbolic values of Prolog and are similar to their counterparts in LISP. In particular, an atom is either a string of letters, digits, and underscores that begins with a lowercase letter or a string of any printable ASCII characters delimited by apostrophes.

2. Fact statements: A fact statement is simply a proposition that is assumed to be true.
For example:  
  • female(khushi). , it states Khushi is a female.
  • mother(varsha, khushi). , it states Varsha is Mother of Khushi.
3. Rule Statements: Rule statements state rules of implication between propositions.
For example: ancestor(varsha, khushi) :- mother(varsha, khushi)., it states that if Varsh is the mother of Khushi, then Varsha is an ancestor of  Khushi.


Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.