Introduction to Logic

  1. Introduction.

    The tree analogy.
    Just as we don't have to know everything about the earth in order to appreciate or even plant a tree, we do not have to know everything about logic to appreciate a mathematical structure. However, a little knowledge is necessary, so we are going to give a flash course in symbolic logic. If anything in this paper is not clear, please consult one of the references (on closed reserve in the library.)
  2. Statements

    Mathematics deals with declarative sentences that are either true or false, but not both. In logic, we call such sentences "statements" to distinguish them from other sentences which do not have this property. The fundamental principle upon which (two valued) logic is based is that a statement must be either true or false, and not both. The truth or falsity of a statement is called its truth value.

    When studying logic, we presuppose that statements have a truth value, and we are basically interested in the truth value of compound statements, that is, statements whose truth value depends on the truth value of simpler statements.

    For examples and practice, see the exercises below.

  3. Negations

    The simplest compound statement is called the negation. We usually use the English word "not" to indicate a negation. By definition, the negation of a statement is a new statement with the property that, if the statement is true, then the negation is false, and vice versa. The negation of a statement p is denoted ~p, pronounced "not p".

    A common error is to write the negation of "x < 3" as "x > 3". To see this is incorrect, suppose x = 3. Then "x < 3" and "x > 3" are both false. The correct negation of "x < 3" is "x >= 3".

  4. Other Logical operators

    Besides negating a statement, we get a compound statement by joining two statements together using logical operators indicated in English by "and", "or", "if ... then..." etc. While there are many English words and phrases that are used as logical operators, each of these is equivalent to one of only 16 possibilities.

    In mathematics, the most commonly used logical operators are:

    1. The negation, denoted "~p" means "not p". The negation is true only when p is false.
    2. The conjunction, denoted "p /\ q" means "p and q". The conjunction is true only when p and q are both true.
    3. The disjunction, denoted "p \/ q" means "p or q". The disjunction is false only when p and q are both false. Note that the disjunction is true when p or q or both are true.
    4. The conditional, denoted "p -> q" means "if p then q". The conditional is false only when p is true and q is false.
    5. The biconditional, denoted "p <-> q" is true when p and q have the same truth value (either both true or both false), and it is equivalent to
      (p -> q) /\ (q -> p)
    Besides knowing and agreeing on these basic definitions so that you and I both know when a compound statement is true or false, what logical rules are important for us to know for this class?

    Here are the basics:

    1. The negation of "p and q" is "not p or not q"
    2. The negation of "p or q" is "not p and not q"
    3. The negation of "if p then q" is "p and not q"
    4. "If p then q" and "if not q then not p" are logically equivalent (they always have the same truth value).

    For examples and practice, see the exercises below.

  5. Conditionals

    The most often encountered logical errors occur when using conditional statements. Given a conditional "p -> q", there are 3 closely related conditional statements:
    1. The converse: "q -> p"
    2. The inverse: "~p -> ~q"
    3. The contrapositive: "~q -> ~p"
    The conditional and its contrapositive are logically equivalent, as are the converse and inverse, but the original conditional is not equivalent to either the converse or the inverse. To illustrate, consider the following conditional and its three relatives: Note that if x > 5 then all these conditionals are true. (Check it out!)
    If 0 < x <= 5 then the conditional and its contrapositive are true while the converse and inverse are false. (Check it out!)

    Clearly the first conditional is not logically equivalent to its converse or inverse.

    For examples and practice, see the exercises below.

  6. Quantifiers

    Many statements contain variables and therefore may be true for some values of the variable and false for others. For example, consider the following statements:
    1. x >= 0.
    2. If a triangle is equilateral, then it is isosceles.
    In (1) the variable is obviously x, which stands for any real number. In (2) the phrase "a triangle" and the word "it" refer to any conceivable triangle. We let p(x) denote a statement whose truth value depends on a variable x. Statement (1) is true if we are saying that there is at least one real number x >= 0. On the other hand, it is false if we are saying that every real number x >= 0. Hence we need a quantifier to tell us "how many" values of x there are for which p(x) is true. We distinguish two quantifiers.
    1. x, p(x) means p(x) is true for all x. This is the "universal quantifier."
    2. x, p(x) means p(x) is true for some (at least one) x. This is the "existential quantifier."
    When a statement with a variable is made and there is no quantifier specified, we usually assume the universal quantifier.

    To negate a statement with a quantifier, change the quantifier and negate the statement. In symbols, ~(x, p(x)) is equivalent to x, ~p(x). Also, ~(x, p(x)) is equivalent to x, ~p(x)

    For example. The negation of

    If |x| > 1 then x > 0 for all real numbers x
    is
    There exists a real number x with |x| > 1 and x <= 0

    For examples and practice, see the exercises below.

  7. Logical Relations

    Besides numbers, the statement 1+ 2 < 8 has the two familiar symbols "+" and "<". The first is an arithmetic operator. Its job is to operate on two numbers to give a third. The symbol "<" combines two expressions for numbers into a statement that has a truth value (in this case, the statement is true.) In logic, there are two relations of importance, namely implication and equivalence.
    OperatorDenotedMeaning
    p implies q p => q p -> q is always true.
    p is equivalent to qp <=> qp <-> q is always true.
    Consider the conditional:
    For all x, if x > 0 then x^2 > 0
    Let us check some cases. Clearly the conditional is always true, so that it is correct to say
    For all x, x > 0 implies x^2 > 0

    Consider the statement:

    For all non zero x and y, xy > 0 iff x and y have the same sign.
    This means that both of the following statements are true:
    If xy > 0 then x and y have the same sign
    and
    If x and y have the same sign, then xy > 0.

    For this reason, proving an equivalence usually requires two separate proofs.

  8. Tautologies and proofs

    We will see lots of meaningful proofs in the course of this semester, so I will not try to cover all the possible types of proofs abstractly at the beginning. Here it is sufficient to make the following observation. A tautology is a statement that is true for every assignment of truth values to its components. Tautologies play a key role in the construction of proofs for two reasons. The first is given in [SM, 27]
    In writing proofs, a working knowledge of tautologies is helpful for several reasons. One reason is that a sentence whose symbolic translation is a tautology may be used at any time in a proof. For example, if a proof involves a number x, one could at any time correctly assert "Either x = 0 or x ­ 0" since this is an instance of the tautology p \/ ~p.

    Furthermore, implications and equivalences are useful because one side may be substituted for the other in any argument (provided one follows the arrows), without affecting the validity of the argument.

    Some useful tautologies, along with their traditional names, are

    p \/ ~pExcluded middle
    p -> q <=> ~q -> ~pContrapositive
    p /\ (q \/ r) <=> (p /\ q) \/ (p /\ r)Distributivity
    p \/ (q /\ r) <=> (p /\ q) \/ (p /\ r)Distributivity
    p -> (q /\ ~q) <=> ~pContradiction
    (p -> q) /\ (q -> r) => (p -> r) Transitivity
    (p -> q) /\ p => qModus Ponens
    (p -> q) /\ ~q => ~pModus Tollens
    (p \/ q) /\ ~p => q

  9. Exercises and Practice


  • Bibliography

    1. Dinkines, Flora. Introduction to mathematical logic. Appleton, Century, Crofts. New York. 1964.

      This small pamphlet (120 pages with exercises) covers the basics of propositional and predicate calculus. The terminology "tf-statement" is used where we use "statement", but the prefix "tf-" is quickly dropped, and should cause no confusion.

    2. Smith, Douglas, Maurice Eggen, and Richard St. Andre. A transition to advanced mathematics. Ed. 3. Brooks/Cole. 1983. pp. 1-51.

      This treatment reserves the words "proposition" and "denial" where we use "statement" and "negation." They also use "=>" and "<=>" where we use "->" and "<->", respectively, for the logical connectives and do not introduce relations as a separate concept.


    To see that there are exactly 16 possible logical binary operations, let us count all the possible ways to combine two statements into one statement. Since each statement can only have two possible truth values, all the possibilities can be listed in a table.
    pqp*q
    TT?
    TF?
    FT?
    FF?
    There are 4 slots with question marks, each of which has two possible value, "T" or "F". Can you list all 16 possiblities?
    pq12345678910111213141516
    TTTTTTTTTTFFFFFFFF
    TFTTTTFFFFTTTTFFFF
    FTTTFFTTFFTTFFTTFF
    FFTFTFTFTFTFTFTFTF

    Fortunately, we do not use a different word for the operator implied by each possible column. It is possible to express each of the possibilities using only negation and 3 or 4 of the operators defined by these columns. All the rest are can be expressed as more or less complicated expressions involving these simple operators.

    Specifically, in column 8 we find our compound statement is true only when p and q are both true. This is the logical operator we always mean when we say the word "and". In column 2 we find that the compound statement is true whenever p or q is true. This is the logical operator we always mean when we say the word "or". Note that in English, we sometimes use "or" when we mean "p or q but not both p and q." Which column is this? (10). This is called the "exclusive or" since it excludes the case in which we have both p and q true. In mathematics, we are very careful to use the words "but not both" when we mean to exclude this case, or sometimes we use "p xor q".

    Column 6 is probably the most important logical operator to understand. This statement is only false when p is true and q is false. This is the conditional statement "if p then q." In common use, we sometimes use the same phrase to mean column 7. In mathematics, we use "p iff q" for column 7. It is important to realize that we must all agree to mean the same thing when we use words in mathematics, and there are many ways to justify this choice of the words "if ... then..." for column 6. Here is one which may at least convince you that this is the better choice.

    Mathematicians all agree that the statement "If x > 5, then x > 1" is true for all numbers x. Do you? Surely if "x>5" is true, then "x>1" must be true. If the compound statement is true for all values of x, then it is true when x = 3. In this case, the first statement is false and the second is true. Again, if the compound statement is true when x = 0 then it is true even when both component statements are false. This is why we need to use column 6 as the definition of "If...then..."

    Every column can be written in terms of "not", "and", "or", and "if...then...". For example, column 10 could be written "p xor q". It could also be written "p or q and not both p and q". Similarly, column 7 could be written "p iff q". It could also be written "if p then q and if q then p."

    Because it is difficult to use several different kinds of operators when making small computer components, it became important to try and find a single logical operator and write everything in terms of that operator. In fact it is possible to write every column using only one operator. First called the "Sheffer stroke", it is column 9, which computer scientists call "NAND" for not (p and q). Equivalently, one can use column 15 which is called "NOR" for not (p or q).

    Challenge: Write each of the 16 possible logical operators in terms of NAND only. Return



    Last Update: September 9, 1999
    Ronald K. Smith
    Graceland College
    Lamoni, IA 50140
    rsmith@graceland.edu