Logic is the foundation of mathematics and, thus required for understanding the rest of the topics in this series of posts. The most approachable introduction to logic begins with propositions. A proposition is simply a statement, which is a declarative sentence that is either true or false.
|Statements||Today is Monday.
Atlanta is in Georgia.
HCTZ is a diuretic.
Statements can be combined to create compound statements. The symbols used for compound statements are AND (^), OR (v), and NOT (~).
Dogs are mammals ^ Cats are mammals == Dogs are mammals. AND Cats are Mammals.
Typically, statements are not written out and letters are substituted for statements.
p = HCTZ is a diuretic.
q = Penicillin is an antibiotic.
p ^ q == HCTZ is a diuretic. ^ Penicillin is an antibiotic.
All of this should be familiar to anyone who has done a MEDLINE search. For example, searching for all articles about coronary artery disease and diabetes mellitus, but not about peripheral arterial disease, could be written.
(coronary artery disease AND diabetes mellitus) NOT peripheral arterial disease
(CAD ^ DM) ~ PAD
(p ^ q) ~ r
The validity of compound statements, which may contain many more individual statements can be computed using a truth table. While truth tables are interesting and useful in programming, they are not what I want to emphasize for the purposes of this current series. (The link provided offers an excellent tutorial as do the books listed at the end of this post).
Propositional logic becomes much more interesting when conditional statements are considered. A conditional statement has the form “IF p, THEN q.”
p = HCTZ is a diuretic.
q = Penicillin is an antibiotic.
IF HCTZ is a diuretic, THEN Penicillin is an antibiotic.
“p” is called the hypothesis and “q” the conclusion. The symbol -> is used to connect the two statements.
p -> q == IF HCTZ is a diuretic, THEN Penicillin is an antibiotic.
Conditional statements are also referred to as implications, and p -> q may be read “p implies q.” One really great thing about studying logic is learning the rules for the correct use of implications. Since implications are used frequently in real life, as well as in mathematics, knowing the rules is very important.
Negating an implication
Ever get into a discussion and someone says something along the lines of, “if x is true, then y is true”? If so, he/she is using an implication to prove a point. Some forms of an implication are sound while others are not. Let’s start with negations. What do you suppose is the negation of the implication, “IF Bob lives in Atlanta, THEN Bob lives in Georgia”? If you said, “IF Bob DOESN’T live in Atlanta, THEN Bob DOESN’T live in Georgia,” you would be incorrect (this is actually the inverse). The negation of an implication is NEVER another implication; it is a compound statement connected by AND.
|Implication||IF Bob lives in Atlanta, THEN Bob lives in Georgia||(p -> q)|
|Negation||Bob lives in Atlanta AND NOT Bob lives in GeorgiaORBob lives in Atlanta AND Bob DOESN’T live in Georgia||(p ^ ~q)|
Logical equivalence is an important concept that is used frequently in proofs. Two things are considered to be logically-equivalent if they have the same truth table. I mention this concept because it can be used to illustrate an important point about using implications.
The above implication consists of two statements: p=Bob lives in Atlanta, q=Bob lives in Georgia. The statements in this implication can be rearranged to yield three versions of the original implication: the contrapositive, the inverse, and the converse. All are illustrated below.
|Original implication||IF Bob lives in Atlanta, THEN Bob lives in Georgia|
|Contrapositive||IF Bob DOESN’T live in Georgia , THEN Bob DOESN’T live in Atlanta|
|Inverse||IF Bob DOESN’T live in Atlanta, THEN Bob DOESN’T live in Georgia|
|Converse||IF Bob lives in Georgia, THEN Bob lives in Atlanta|
Here they are in symbolic form.
|Original implication||P -> q|
|Contrapositive||~ q -> ~p|
|Inverse||~p -> ~q|
|Converse||q -> p|
Consider the truthfulness of these variations of the original implication. Notice that the contrapostive is true. If you don’t live in Georgia, there is no way you can live in Atlanta; however, both the inverse and converse are false. One can live in Georgia without living in Atlanta
The contrapositive is logically equivalent to the original implication, but the converse and inverse are not. Importantly, if an implication is, in fact, true then its contrapositive MUST also be true. However, the inverse and converse may or may not be true. For this reason, avoid using them when advancing an argument as they are unreliable (don’t let anyone else get away with using them either.)
Practical uses of implications
Although it may not be obvious, implications and the logic rules that cover them ,are used quite often in clinical care. They show up as rules in the form of IF-THEN statements.
IF Mr. Doe has a high temperature,THEN…
IF the infecting microbe is Pseudomonas, THEN…
Rules of this type are everywhere. In workflows, they can guide sequence selection by allowing conditions to be used to select a path.
IF Mr. Doe is waiting for check-in, THEN Mr. Doe is interviewed by a staff person.
IF Mr. Doe is interviewed by a staff person, THEN Mr. Doe is registered.
IF Mr. Doe is registered, THEN Mr. Doe’s vital signs are recorded.
This sequence illustrates the transitive property of implications; namely, if p -> q, and q -> r, then p -> r. Applying the transitive property to the workflow sequence, we can see that, under normal circumstances, Mr. Doe will eventually have his vital signs recorded.
As it turns out, IF-THEN statements are one of the most common forms of control statements in computer programming languages. They also form the basis of rule-based expert systems.
There is much more to propositional logic than I have covered. However, this should be enough to demonstrate that propositional logic is useful for designing systems that rely on decision-making. Remember that the inverse and converse forms of implications can be unreliable –avoid them.
Universal statements and sets
Obviously, propositional logic is useful. However, it cannot be used to solve problems of this type:
All dogs are mammals
Lassie is a dog
Therefore, Lassie is a mammal.
This series of statements begins with a universal statement, All dogs are mammals. This is a different type of statement than, “IF Lassie is a dog, THEN Lassie is a mammal,” which is what propositional logic was designed to handle. There is no mechanism in propositional logic to manipulate universal statements to arrive at conclusions.
Here is another problem with propositional logic. Consider the statement, “It is a car.” Is this sentence true or false? Neither. The truthfulness of the sentence cannot be determined until the pronoun “it” is replaced by a specific name. Handling universals or statements in which substituting a specific name will make a statement either true or false, requires the use of predicates and quantifiers. Propositional logic cannot handle predicates or universals–for that you need predicate logic, which I’ll discuss in the next post.
Write the negation, contrapositive, inverse, and converse of each of these implications. Are the converse and inverse true?
- IF you work hard, THEN you earn a lot of money.
- IF today is Thanksgiving, THEN tomorrow is Friday
- IF you have pneumonia, THEN you have a lung infection