Example |
---|
A = { If I am clever then I will pass, If I will pass then I am clever, Either I am clever or I will pass } C = I am clever and I will pass |
The conclusion that I am clever and I will pass is a logical consequence of the axioms. The example is written in English, but it is easily translated into propositional logic. There are two propositions in the example: I am clever and I will pass. In propositional logic, these propositions can be represented by their text. Using the Prolog convention of starting propositions with lowercase alphabetic, the axiom set and conclusion become :
A = { If i_am_clever then i_will_pass, If i_will_pass then i_am_clever, Either i_am_clever or i_will_pass } C = i_am_clever and i_will_passTo remove the if-then and other English words, connectives are used. The commonly used connectives of propositional logic are:
Denoting arbitary propositional formulae by uppercase variable letters, e.g., P, propositional formulae are defined recursively by:
Now the above example can be written in propositional logic as follows:
Example |
---|
A = { i_am_clever => i_will_pass, i_will_pass => i_am_clever, i_am_clever | i_will_pass } C = i_am_clever & i_will_pass |
Recall that an interpretation assigns world object to words and functions of statements, and truth values (TRUE and FALSE) to the statements. In propositional logic there are no "component parts", only statements in the form of propositional formulae, e.g., i_am_clever and i_am_clever => ~i_will_pass. For propositional logic, interpretation consists of assigning truth values to propositions and defining how truth values are combined by the connectives. The manner in which the connectives are interpreted is globally agreed on, as described later. The assignment of truth values to the propositions is determined by the user.
The number of possible assignments of truth values to N propositions, and thus the number of possible interpretations of N propositions, is 2N. All the interpretations can be captured in a truth table with 2N rows. For a language that contains three propositions, i_am_clever, i_will_pass, and i_will_fail, there are eight possible interpretations:
Example | |||
---|---|---|---|
i_am_clever | i_will_pass | i_will_fail | |
1 | T | T | T |
2 | T | T | F |
3 | T | F | T |
4 | T | F | F |
5 | F | T | T |
6 | F | T | F |
7 | F | F | T |
8 | F | F | F |
An alternative way of representing all the interpretations is as a semantic tree:
The following table defines how truth values are combined with connectives:
Truth table for connectives | |||||||
---|---|---|---|---|---|---|---|
P | Q | ~P | P & Q | P | Q | P => Q | P <=> Q | P <~> Q |
T | T | F | T | T | T | T | F |
T | F | F | F | T | F | F | T |
F | T | T | F | T | T | F | T |
F | F | T | F | F | T | T | F |
The definitions for negation, conjunction, and disjunction are common, and correspond directly to their English meanings. Equivalence is also quite straight forward. The definition for implication is less intuitive (to the English speaker). There's a simple example that helps to remember the definition: A politician says "If I am elected, then I will reduce taxes" (i_am_elected => i_will_reduce_taxes). If the politician is elected, and he does reduce taxes, then he didn't lie (TRUE => TRUE is TRUE). If he does not get elected, than it does not matter about his promise (FALSE => TRUE and FALSE => FALSE are both TRUE). Only if he is elected and he does not reduce taxes is the politician a liar (TRUE => FALSE is FALSE).
Given an interpretation, a truth table or semantic tree can be used to calculate the truth value of a propositional formula for all possible interpretations.
Example | ||||
---|---|---|---|---|
I = { i_am_clever => TRUE, i_will_pass => FALSE } F = (i_am_clever => i_will_pass) | ~i_am_clever | ||||
i_am_clever | i_will_pass | i_am_clever => i_will_pass | ~i_am_clever | (i_am_clever => i_will_pass) | ~i_am_clever |
T | T | T | F | T |
T | F | F | F | F |
F | T | T | T | T |
F | F | T | T | T |
Represented using a semantic tree: