13.6. Rules, Axioms, and Programs

A rule is a series of structures in which the truth of the first structure follows from the ability to prove the remaining structures. For example, in Logikus the following rule defines “high” cities:

highCity(Name, Alt) :- city(Name, Alt), >(Alt, 5000); 

This rule states that highCity(Name, Alt) is true for any known city whose altitude is greater than 5,000. A rule's first structure is its head; its other structure is its tail. Between its head and its tail a rule has the “if” (“:-) symbol. The head is true if the tail is provable.

An axiom is a model of truth, and in Logikus an axiom is either a fact or a rule. A Logikus program is a collection of axioms, and this means that a program is an extended model ...

Get Building Parsers with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.