An Informaticist Looks at Math Proofs, Part II: From English to Math and Back

Learning logic is not an esoteric endeavor, even if one is not interested in writing proofs. Reasoning logically is a requirement in any field. The rules of inference mentioned in the last post are used for deductive reasoning, which is an important skill. An additional plus for me has been the effect that studying logic has had on my programming activities. I find that, more often than not, I frame programming questions more clearly. At times, writing programming code feels a lot like writing a proof, and logic comes in handy.

Consider a situation in which a program must make a decision to fire an alert. In this case, say the alert is for a serum potassium (K+) level that is above the normal upper limit (NUL). Assuring the proper behavior requires a rule of the type:

IF K+ >NULTHEN
K+ is abnormal;END

Turning English into programming code, as I’ve learned, is very similar in approach and difficulty to turning English into mathematical statements. No doubt, this is one reason that requirements may not result in a system that works as expected—the proper translation is not always obvious.

From statements to predicates
The example above does not specify values for K+ or the NUL. As a result, the sentence K+ >NUL, cannot be determined to be either true or false,which is required in propositional logic (discussed in the last post). K+ and NUL are both variables that must be replaced with values in order to determine if the sentence is true, which is the definition of a predicate. Here is a formal definition from Epp:

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.

The values that make a predicate true are referred as its truth set. Assuming a NUL of 5.5 meq/DL, then any K+ value greater than 5.5 would be in the truth set for K+>NUL.

Using quantifiers
The next step in learning to turn English into math statements is the use of quantifiers. There are two: universal and existential. Using them, one can make general statements about sets of objects. For example, “All dogs are mammals,” is a statement about every single dog that exists, making it a universal statement. If one wants to make a statement about a subset of dogs, then an existential quantifier is used—“Some dogs are big.”

Since predicates have truth sets, we can use sets to help in translating from English to math. Below is the predicate version of “All dogs are mammals.”

The upside-down “A” is the universal quantifier sign. The letter “D” indicates the domain that values are taken from (i.e., dogs) to substitute into the predicate and, “Mammal (x),” is the predicate. Translating from symbols to English, this can be read formally as: “For x in D, x is a mammal.” Since, we know D is the set of all dogs, in everyday English, this could be stated, “All dogs are mammals.” The universal quantifier sign may be read: All, every, for all, given any, and in other ways.

Now, let’s look at the statement:”Some dogs are gray.” This is an existential statement because it refers to a subset of all dogs.

The backwards “E” is the existential quantification symbol; D means the same as before, and the predicate is “Gray (x).” Formally stated this reads, “There exists some x in D, such that x is gray.” The existential quantifier sign may be read: There is, there are, some, at least, etc.

Okay… so far, so good.

Universal implications
The implications discussed in the last week’s post were simple compound statements. They are great for working with specific values, but proofs make statements about sets of objects and require implications that have the requisite range. Thus, universal implications are a big deal in mathematics.

“All dogs are mammals” can be written as a universal implication in the form: “For all x, If x is a Dog, Then x is a Mammal.”

Once I learned about quantifiers, predicates, and universal implications, proofs made a little more sense. Certainly, the logic in my programming became more mathematically-sound. The potassium example is a universal implication: “For all K+ values x, If x > NUL, Then x is abnormal.” In everyday English this could be stated as “Any K+ value greater than NUL is abnormal.” However, translating English to mathematical statements still took extra effort because of nested quantifiers.

Nested quantifiers
In everyday English, statements may contain more than one quantifier and when they do, the order in which the quantifiers occur is critical. Nested quantifiers drove me up a wall (and still do more often than I like). The basic problem, of course, is that English is very loose while math is very strict. Consider the sentence, “Every town has a plumber.” How should this appear mathematically? As I have learned, the first–and most difficult–step is teasing predicates out of the English. The deconstruction process was (is) not obvious… at least not to me.

Here is my approach…
I see that the word “every” appears, so that means there is at least a universal. Next, the sentence seems to be saying that there is at least one plumber in every town. This allows for the following rewrite: For all towns T, there is a person P such that P lives in the town and P is a plumber. In symbols, this gives:

Here is another—Everybody loves somebody.

Now, see what happens when the order to the quantifiers are switched. What does this mean (answer at end of post)? **

What exactly is to be proven?
In order to write a proof, one must state, unequivocally, what is to be proven. Examples in math books help to some extent in teasing out a proof-worthy statement from an English sentence or phrase. However, like all textbook examples, the real-world is messier—a lesson learned the first month of internship and one I am learning again. Look at these statements.

Square any real number and the result will be non-negative.

There is a positive integer that is smaller than any other positive integer. ***

Each is making a statement that seems to be provable, but doing so requires restatement in a mathematical format to see what is actually being proposed.

Breaking down the first example, the word “any” could mean, “Pick any real number and the result would be the same,” which is the same as “every single one will give the same result” or “all of them will give the same result.” Using this info, I’m going with a universal, “For all real numbers.” So, from here I have, “For all real numbers x, x2 >= 0. Symbolically, this becomes:

The fun continues–negations with quantifiers
Negating a simple statement is straightforward. The negation of, “It is raining” is ~(“It is raining”) or “It is NOT raining.” In last week’s post, we saw that the negation of an implication is not another implication; rather, it is a compound statement connected by AND.

Implication: If it is raining, Then I wear boots ; p–> q
Negation: It is raining AND ~ (I wear boots.) p AND ~q

Universal quantified statements and existential quantified statements are different. The negation of a universal is an existential and the negation of an existential is a universal.

The negation of, “All dogs are mammals,” is “There is at least one dog that is NOT a mammal.” If we express “All dogs are mammals” as a universal implication–“For all x, If x is a Dog, Then x is a Mammal” — then the negation is: There is an x such that x is a dog AND x is NOT a mammal. The negation of the existential , “Some dogs are gray” is a universal:“No dogs are gray”—meaning that no dog anywhere is gray.

Notice that in order to negate a universal statement, one needs only a single example where the statement is not true. This is referred to as a counterexample, which is very helpful when doing proofs.

With practice, I have gotten better at reading proofs and translating English into math, but no mathematician has anything to worry about from me. Even better, I know now that no magic is involved! Next week, I will look at three common proof techniques.