Rules

A proposition is a sentence that is either true or false.

For example:

smith.age < 21

A rule has zero or more propositions called conditions, and a single proposition called its conclusion.

Semantically, the conclusion of a rule is true if all of its conditions are true.

For example:

 (smith.age < 21 && smith.gender == male) => smith.curfew < midnight

A knowledgebase is a collection of related rules.

Knowledge bases are also called ontologies.

Here's a Java declaration of an inference engine:

class InferenceEngine {
   KnowledgeBase kbase;
   // = true if query can be infered from kbase:
   boolean infer(Proposition query) { ... }
}

The infer implementation uses backtracking and pattern matching algorithms in an attempt to falsify the query. If it fails, it returns true, otherwise it returns false. It's also possible that it simply never returns.

Model Proposition, Rule, knowledge base, and inference engine with a UML class diagram.