Prolog Binary Search
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Valid statements in Prolog are of the form

Statement -> Fact|Rule
Fact -> CompoundTerm.
Rule -> CompoundTerm :- CompoundTerm|true {BooleanOperator CompoundTerm | true}.
Term -> CompoundTerm | Variable | Atom
CompoundTerm -> functor( Term {, Term} )
Variable -> UppercaseLetter {AlphaNumeric}
Atom -> LowercaseLetter {AlphaNumeric} | 'AlphaNumeric {AlphaNumeric}'
BooleanOperator -> ,|;

In addition, many arithmetic compound terms are written in infix notion, and these may occur in the body of the rule.

The syntax of any file is a list of rules (and often facts). Then a query may be made of the file for any of the rules.
Two or more rules may have the same name, and optionally the same arity. When the arity is different, then the compound terms are distinct, but if they are the same, then either may be used to satisfy a query. The body of a rule is a list of compound terms which are queried to find if there is a way to make truth for the given inputs.

Labels
  • No labels