Example
Using the "weather" sentences from above, let
KB = (((P ^ Q) => R) ^ (Q => P) ^ Q) corresponding to the three facts
we know about the weather: (1) "If it is hot and humid, then it
is raining," (2) "If it is humid, then it is hot," and
(3) "It is humid."
Now let's ask the query "Is it raining?" That is,
is the query sentence R entailed by KB?
Using the truth-table approach to answering this query we have:
P Q R | (P ^ Q) => R | Q => P | Q | KB | R | KB => R ----------------------------------------------------- T T T T T T T T T T T F F T T F F T T F T T T F F T T T F F T T F F F T F T T T F T F T T F T F T F T F F T F F T T T F F T T F F F T T F F F THence, in this problem there is only one model of KB, when P, Q, and R are all True. And in this case R is also True, so R is entailed by KB. Also, you can see that the last column is all True values, so the sentence KB => R is valid.
Instead of an exponential length proof by truth table construction, is there a faster way to implement the inference process? Yes, using a proof procedure that uses sound rules of inference to deduce (i.e., derive) new sentences that are true in all cases where the premises are true. For example, consider the following:
P Q | P P => Q | P ^ (P => Q) | Q | (P ^ (P => Q)) => Q
------|------------|--------------|-------------------------
F F | F T | F | F | T
F T | F T | F | T | T
T F | T F | F | F | T
T T | T T | T | T | T
Since whenever P and P => Q are both true (last row only), Q is
true too, Q is said to be derived from these two premise sentences.
This local pattern referencing only two of the M sentences in KB is
called the Modus Ponens inference rule. The truth table
shows that this inference rule is sound. It specifies
how to make one kind of step in deriving a conclusion sentence
from a KB.Therefore, given the sentences in KB, construct a proof that a given conclusion sentence can be derived from KB by applying a sequence of sound inferences using either sentences in KB or sentences derived earlier in the proof, until the conclusion sentence is derived. (Note: This step-by-step, local proof process also relies on the monotonicity property of PL and FOL. I.e., adding a new sentence to KB does not affect what can be entailed from the original KB and does not invalidate old sentences.)