# Mathematics and Clinical Concepts, Part III: Logic with Variables and Quantifiers

In the last post, I pointed out two limitations of propositional logic– namely, its inability to handle variables and quantifiers.  Let’s take a look at how these limitations affect one’s ability to use logic to solve specific types of problems.

Remember, propositional logic deals solely with declarative statements.

Atlanta is in Georgia.
Lassie is a dog.

Using declarative statements and implications, one can reason about facts.

IF Lassie is a dog, THEN Lassie is a mammal.
Lassie is a dog.
Therefore, Lassie is a mammal.

This is a classic example of modus ponens .  Note, however, that our deduction is only about Lassie. What if we have a flash of insight and decide that we want to be able to extend this line of reasoning to every dog?   Predicate logic extends propositional logic with the tools needed to make universal statements about every dog.

Statements can be made more flexible by adding variables.   This is done by separating subjects from predicates and allowing each to be manipulated independently.   Breaking down the sentence, ” Lassie is a dog,” we have “Lassie” as the subject and “is a dog” as the predicate.  We can now make the original statement more flexible by rendering it as the predicate where the subject has been replaced by the variable “x” (i.e., “x is a dog.”).

Here is the official definition of a predicate.

A predicate is a sentence that contains a finite number of variables and becomes a statement when specific values are substituted for the variables.  The domain of a predicate variable is the set of all values that may be substituted in place of the variable. (1)

Statements are declarative sentences that are either true or false.  When “x” is replaced with a name, it will make the sentence either true or false.    “Lassie” would make the sentence true.

Consider the set {Lassie, Spot, Rex, Garfield, Snowflake} that contains the names of pets in the neighborhood. Three of these names would make “x is a dog” a true statement.  “Garfield” and “Snowflake,” being cats, would make the statement false.

Given the above, we have: Predicate == x is a dog==P(x).    All of the names that may be substituted into P(x) constitute its Domain (D=={Lassie, Spot, Rex, Garfield, Snowflake }). The values of D that make P(x) true are called its truth set ({Lassie, Spot, Rex}).  Conversely, if the predicate under discussion were about cats, as in “x is a cat”, the domain, D, would be the same, but the truth set would be limited to {Garfield, Snowflake}.

A truth set is defined as:

If P(x) is a predicate and x has domain D, the truth set of P(x) is the set of all elements of D that make P(x) true when they are substituted for x.  (1)

Now that we have predicates with variables, it is possible to easily represent that all dogs are mammals.  Applying the universal quantifier, we have the following sentences that have the same meaning.

All dogs are mammals.
For all dogs x, x is a mammal.

Here D = set of all dogs.  The upside down “A” symbol can be read in many ways: all, for all, every, for any arbitrary, any.  The key is that it covers every single example of the objects under discussion.  This is not possible in propositional logic.

The next quantifier, referred to as existential, is restrictive in that it applies to at least one object (though it could be more, but never all, of course) in the domain under discussion.  Using our neighborhood pets example, we can see that while all are pets, only some are cats.  We can state this using the following sentences.

Some pets are cats.
There exists a pet x, such that x is a cat.

Here P=set of pets.  The backwards “E” may be read: there is, there exists, for some, etc.

Negation using quantifiers
Negations with quantifiers are different from those with simple propositions.  Since quantifiers apply to sets and not just a single entity as is the case with propositions, their negations must account for this difference.

In propositional logic, the negation of “Lassie is a dog” is ~(Lassie is a dog)  or “Lassie is NOT a dog.” However, a universal statement such as “All dogs are mammals” is making a claim about every single dog that exists.  In order to negate this, we simply look for an example (called a counterexample) that contradicts this statement.  The big deal is that we need only one example to disprove a universal statement.  Thus, the negation is: There is/there exists a dog that is NOT a mammal.   The negation of a universal statement is always an existential statement, and the negation of an existential statement is always a universal statement.

 Statement Negation All dogs are large. There exists a dog that is NOT large. All EHRs save time. There is an EHR that DOES NOT save time. There is an EHR that lowers costs. For all EHRs, none lowers costs. Some diseases are fatal. No diseases are fatal.

An existential statement claims that at least one example of some entity or situation exists.  Negating an existential statement requires proving that some never happens or never exists, which is far more difficult than finding a single counterexample to negate a universal statement.

Consider the difference in difficulty in negating “All EHRs save time” as compared to “Some EHRs save time” or “There exists an EHR that saves time.” To negate the former, we need find only one person who can demonstrate they are less efficient when using an EHR (very easy).   Other the other hand, negating the latter statements would require that we prove that no one ever saved time as a result of using an EHR, which is much harder.

Universal implications
Implications carry over from propositional logic to predicate logic quite easily.  They have the form:

For all x, IF x is a dog, THEN x is a mammal.  In symbols this is:

The negation of a universal implication is an existential statement with the form:

Negating  “For all x, IF x is a dog, THEN x is a mammal” would result in:

There exists a dog x, such that x is a dog AND  x is NOT a mammal (remember the negation of an implication is always a compound statement connected by AND).

Research findings and universal statements
Failure to appreciate how little evidence is required to negate  a universal statement or implication can lead to unnecessary arguments—especially when research findings are presented as universal rather than existential statements.

A good example of this problem is the statement “EHRs improve quality.”  This may be construed as a universal statement: “For all practices/in every practice an EHR will improve quality,” even though it may not be intended that way.  Of course, when it is construed as a universal statement, anyone hearing it could quickly point out at least one practice (a counterexample) where quality did not improve with an EHR, thereby negating the argument.  After that, cue the yelling!

The more sensible and accurate statement would be: “There exist practices in which EHRs have improved quality.”  This accomplishes two things.  First, it better reflects  the experimental data collected (i.e., the statement reflects the findings at the limited number of practices actually analyzed in the study). Second, it cannot be negated except by checking the actual data at the practices offered as evidence. In clinical care there are few universal truths.  Therefore, to avoid wasting time pointlessly arguing, it is best to avoid universal statements when presenting research findings unless that is what one specifically intends (see Universal Implications, External Validity, and Thomas Kuhn).

Predicates, quantifiers, and clinical systems
Clinical thinking relies heavily on deductive reasoning and the proper use of implications and negations, though I doubt many think about formal logic rules while seeing patients.

Understanding logic rules can help in designing systems that support decision making whether paper-based or electronic.   Earlier, I mentioned that the truth set of a predicate consists of all the values taken from its domain that make the predicate true.  In computer programming terms, we can write programs that evaluate predicates in order to generate a truth set (find all patients x, where the age of x is > 65). The returned truth set could then be passed to any function that required such a list.

Diagnostic rules and treatment options can be expressed using predicates.

For all patients x, IF has_Jaundice(x), THEN  obtain_transaminases (x).  (Transaminase levels should be checked for any patient with jaundice.)
There exists a drug x such that, anti-hypertensive(x)  ^  inexpensive (x).   Inexpensive antihypertensive drugs are available.

Rule-based decision trees can be readily expressed using predicates, which allows for their use in algorithms, with workflows being a good example.

For all x, IF registered(x), THEN obtain_vitals(x).   (Once patients are registered, obtain their vital signs.)

This is easily translated into a programming language.

IF status(patient)==registered
THEN
obtain_vitals (patient)
END IF

Predicate logic can be used to create complex decision systems. In fact, Prolog (Programming in Logic) is a programming language designed specifically to create software using logic.

The importance of sets
One thing that I have come to realize since I began studying discrete math is how important sets are to mathematics. Set theory is taught early on in math education, but beyond learning the basics (union, intersection, subsets, etc.), it often only receives passing mention–especially in subjects where the goal is finding a solution to a specific problem (e.g., a derivative, the standard deviation).  However, major topics in discrete math such as relations, functions, and graphs make heavy use of sets.   The next post will delve in to the world of sets, which as you will see, includes everything.  See you next time…

1. Epp SS. Discrete Mathematics with Application, Fourth Edition. Belmont, CA: Thomson-Brooks/Cole; 2010