SlideShare una empresa de Scribd logo
1 de 16
Descargar para leer sin conexión
Lecture by Prof. Dr. Nasir Tauheed
Department of Computer Science                  University of Karachi
BSCS - 411          --     Discrete Mathematics    --          Week 2
Predicates & Quantifiers
Statements involving variables, such as
“x > 3,” “x = y + 3,” and “x + y = z,” are often found in mathematical
assertions and in computer programs. These statements are neither true not
false when the values of the variables are not specified. In this section we will
discuss the ways that propositions can be produced from such statements.
The statement “x is greater than 3” has two parts:
   • The first part, the variable “x” is the subject of the statement.
   • The second part the – predicate, “is greater than 3” – refers to a
      property that the subject of the statement can have.
We can denote the statement “x is greater than 3” by P(x), where P denotes
the predicate “is greater than 3” and x is the variable. The statement P(x) is
also said to be the value of the proposition function P at x. Once a value has
been assigned to the variable x, the statement P(x) becomes a proposition and
has a truth value.
Example 1: Let P(x) denote the statement “x > 3”. Then
P(4) : 4 > 3 is true, but P(2) : 2 > 3 is false.
Replacing x by the value of 4 (or by 2) is a way to quantify the propositional function
P(x). Quantify means to make it true or false.

Predicates become propositions once every variable is bound- by assigning it
a value from the Universe of Discourse U or quantifying it. (The collection of
values that a variable x can take is called x’s Universe of Discourse.)
Example 2:
Let U = Z, the integers = {. . . -2, -1, 0 , 1, 2, 3, . . .}
P(x): x > 0 is the predicate. It has no truth value until the variable x is bound.
      Examples of propositions where x is assigned a value:
          P(-3) is false,
          P(0) is false,
          P(3) is true.
The collection of integers for which P(x) is true are the positive integers.
P(y) ∨ ¬P(0) is not a proposition. The variable y has not been bound.
However, P(3) ∨ ¬P(0) is a proposition which is true.
Week 2                                                                   Page 1
Predicate logic generalizes the grammatical notion of a predicate to also
include propositional functions of any number of arguments, each of which
may take any grammatical role that a noun can take.
Example 3:
Let P(x,y,z) = “x gave y the grade z”, then if
                  x=“Mike”, y=“Mary”, z=“A”, then
                 P(x,y,z) = “Mike gave Mary the grade A.”
Exercise 4:
Let R be the three-variable predicate R(x, y z): x + y = z
Find the truth values of
                        R(2, -1, 5), R(3, 4, 7), R(x, 3, z).
Quantifiers
      Let’s say you have a predicate like P(x) and you want to apply a
      statement for all possible values of x. You can use quantifiers to do this.
      The notation ∀ x P(x) shows the universal quantification of P(x), with
      the upside-down A as the universal qualifier.
         – It says, FOR ALL x P(x) or FOR EVERY x P(x)
Example 5:
Let the u.d. of x be parking spaces at DCS. Let P(x) be the predicate “x is
full.”
Then the universal quantification of P(x), ∀x P(x), is the proposition:
        – “All parking spaces at DCS are full.”
        – i.e., “Every parking space at DCS is full.”
        – i.e., “For each parking space at DCS, that space is full.”
The power of distinguishing objects from predicates is that it lets you state
things about many objects at once.
   • E.g., let P(x) = “x+1>x”. We can then say, “For any number x, P(x) is
     true” instead of
                       (0+1>0) ∧ (1+1>1) ∧ (2+1>2) ∧ ...
Existential Quantifier of a proposition: there exists an element x in the
universe of discourse such that P(x) is true
     – That is, there is AN x, or at least ONE x, such that P(x) is true
     – In this case, one would use the backwards E to denote this type
        quantifier rather than the all inclusive upside down A:
Week 2                                                                    Page 2
∃ x P(x)
              For example, if P(x) was the statement x > 89, and your data set
              included test scores of 65, 72, 85, 88, and 95 what would be the
              existential quantification of P(x)?
                  – TRUE!
Example 6: Let the u.d. of x be parking spaces at DCS. Let P(x) be the
predicate “x is full.”
Then the existential quantification of P(x), ∃x P(x), is the proposition:
     – “Some parking space at DCS is full.”
     – “There is a parking space at DCS that is full.”
     – “At least one parking space at DCS is full.”
                                  Quantifiers
Statement          When is it True?                 When is it False?
               P(x) is true for every x.      There is an x for which P(x) is
                                                           false.
            There is an x for which P(x) is     P(x) is false for every x.
                          true.
Practical use of Quantifiers:
   – In programming, at times you will create looping mechanisms to test
      every instance of your data (the scores for every student taking an exam,
      for instance)
   – You would inadvertently be using some aspect of universal or even
      existential quantification to test your data
   – Hence, this aspect of discrete math is a way of thinking about, or
      mapping out, what a programmer would have to construct to meet the
      needs of a customer.
Free and Bound Variables
  • An expression like P(x) is said to have a free variable x (meaning, x is
    undefined).
  • A quantifier (either ∀ or ∃) operates on an expression having one or
    more free variables, and binds one or more of those variables, to produce
    an expression having one or more bound variables.
Example of Binding
  • P(x,y) has 2 free variables, x and y.
  • ∃x P(x,y) has 1 free variable, and one bound variable. [Which is which?
    y is a free variable and x is bound (by the existential quantification ∃x).]
  • “P(x), where x=3” is another way to bind x.
Week 2                                                                 Page 3
• An expression with zero free variables is a bona-fide (actual)
     proposition.
  • An expression with one or more free variables is still only a predicate:
     ∀x P(x,y).
REMEMBER! A predicate is not a proposition until all variables have been
bound either by quantification or assignment of a value!
Equivalences involving the negation operator
                            ¬∀x P(x) ⇔ ∃x ¬P(x)
                            ¬∃x P(x) ⇔ ∀x ¬P(x)
Distributing a negation operator across a quantifier changes a universal to an
existential and vice versa.
      ¬∀x P(x) ⇔ ¬(P(x1) ∧ P(x2) ∧ … ∧ P(xn))
                 ⇔ ¬P(x1) ∨ ¬P(x2) ∨ ¬ … ∨ ¬ P(xn)
                 ⇔ ∃x ¬P(x)

Multiple Quantifiers: read left to right . . .

Nesting of Quantifiers
Example: Let the u.d. of x & y be people.
Let L(x,y) = “x likes y” (a predicate with 2 f.v.’s).
Then ∃y L(x,y) = “There is someone whom x likes.” (A predicate with 1 free
variable, x.)
Then ∀x (∃y L(x,y)) = “Everyone has someone whom they like.”
(A proposition with 0 free variables.)
Quantifier Exercise
If R(x,y)=“x relies upon y,” express the following in unambiguous English:
   ∀x(∃y R(x,y)) = Everyone has someone to rely on.
   ∃y(∀x R(x,y)) = There’s a poor overburdened soul whom everyone relies
   upon (including himself)!
   ∃x(∀y R(x,y)) = There’s some needy person who relies upon everybody
   (including himself).
   ∀y(∃x R(x,y)) = Everyone has someone who relies upon them.
   ∀x(∀y R(x,y)) = Everyone relies upon everybody, (including themselves)!
Example: Let U = R, the real numbers,

Week 2                                                               Page 4
P(x,y): xy= 0
                       ∀x ∀y P(x, y)
                       ∀x ∃y P(x, y)
                       ∃x ∀y P(x, y)
                       ∃x ∃y P(x, y)
            The only one that is false is the first one.
What’s about the case when P(x,y) is the predicate x/y=1?
Example: Let U = {1, 2, 3}. Find an expression equivalent to ∀x ∃y P(x, y)
where the variables are bound by substitution instead:
Expand from inside out or outside in.
     Outside in:
            ∃y P(1, y) ∧ ∃y P(2, y) ∧ ∃y P(3, y)
                              ⇔ [P(1,1) ∨ P(1,2) ∨ P(1,3)] ∧
                                  [P(2,1) ∨ P(2,2) ∨ P(2,3)] ∧
                                  [P(3,1) ∨ P(3,2) ∨ P(3,3)]
As you can see, with just these two quantifiers we can put together even more
complex statements. Many theorems, results, etc. in mathematics are typically
represented using quantifiers. For example, we know that all positive integers
have at least one prime factor that is less than or equal to the number itself.
Mathematically speaking, we can use our statement q(x,y) from before to
express this result.
q(x,y): x is a prime number that divides into y evenly AND is less than or
equal to y.
                                   ∀y∃x [q(x,y)]
Literally, this reads: “For all values y, there exists a value for x for which x is
a prime number that divides into y evenly AND is less than or equal to y.”
A very important distinction to make here is the order of the quantifiers. The
statement
                     ∃x∀y [q(x,y)] for example is NOT true.
This literally reads: “There exists a value of x for which for all values of y, x
is a prime number that divides into y evenly AND is less than or equal to y.”
The reason this is not true is because no matter what value you try to pick for
x, you can ALWAYS find a value for y such that x DOES NOT divide y.

Perhaps, some practice evaluating these statements might help. Consider these
simple open statements:
Week 2                                                               Page 5
p(x): x > 0
                             q(x): x2 – 2x – 3 = 0
                              r(x): x < 0
                              s(x): x2 > 0
Decide whether each of these assertions is true or not:
                            1) ∃x [p(x) ∧ q(x)]
                            2) ∀x [p(x) ∧ r(x) → s(x)]
                            3) ∀x [r(x) → ¬q(x)]
Now, take these assertions and put them into symbolic form:
1) For all values of x less than 0, x2 is greater than 0.
2) There exists a value of x for which if x2 – 2x – 3 = 0 then x is greater than
   0.
3) For all values of x such that x2 – 2x – 3 = 0, x < 0.
                     A little chart to keep all of this straight
    Statement                 When True                         When False
∃x p(x)              For at least one value a in the   For all values a in the
                     universe for x, p(a) is true.     universe for x, p(a) is false.
∀x p(x)              For all values a in the           For at least one value a in the
                     universe for x, p(a) is true.     universe for x, p(a) is false.
∃x [¬p(x)]           For at least one value a in the   For all values a in the
                     universe for x, p(a) is false.    universe for x, p(a) is true.
∀x [¬p(x)]           For all values a in the           For at least one value a in the
                     universe for x, p(a) is false.    universe for x, p(a) is true.
Given a statement ∀x [p(x) → q(x)], here are other related statements:
                        1) Contrapositive: ∀x [¬q(x) → ¬p(x)]
                        2) Converse: ∀x [q(x) → p(x)]
                        3) Inverse: ∀x [¬p(x) → ¬q(x)]
As we have mentioned before, if the given statement is true, then the
contrapositive MUST BE true. However, neither the converse nor the inverse
are necessarily true.
However, if both the given statement AND the converse are true, we have and
if and only if relationship. Similarly, if both the given statement and the
inverse are true, we also have and if and only if (i.e. equivalence) relationship.
A couple more rules that follow...
So now, consider each of these implications:
Week 2                                                                       Page 6
1) ∃x [p(x) ∧ q(x)]    [∃x p(x) ∧ ∃x q(x)]
                 2) ∃x [p(x) ∨ q(x)] ⇔ [∃x p(x) ∨ ∃x q(x)]
                 3) ∀x [p(x) ∧ q(x)] ⇔ [∀x p(x) ∧ ∀x q(x)]
                 4) [∀x p(x) ∨ ∀x q(x)]      ∀x [p(x) ∨ q(x)]
An important observation is that the first and fourth rules only go one way.
Can you think of some counter examples to these rules?
Here are a couple of mine:
For number 1, let statement
                 p(x) = “x is greater than 100.”
                 q(x) = “x is less than 0.”
Certainly, ∃x p(x), also we have ∃x q(x). This is because there exists an x
greater than 100, namely 101. But there also exists an x less than 0, namely –1.
BUT, it is NOT true that ∃x [p(x) ∧ q(x)]. If this were the case, then we could
find a single value of x for which BOTH p(x) AND q(x) hold. But, clearly
they are contradictory statements and this can not happen.
A counter example to the converse of rule number 4 is the following:
Let
                 p(x) = “x is an even integer.”
                 q(x) = “x is an odd integer.”
Clearly, for all integers x, we have either p(x) or q(x). BUT, it is not true that
∀x p(x) and it is also not true that ∀x q(x). The reason neither of these is true
is because all integers are not odd, and all integers are not even either.
Other practice problems
First translate these assertions into English. Then deduce, with proof, whether
they are valid or not. To show an assertion to be invalid, merely present a
counter example. To prove it, you must show that the statement holds for all
the values it says it will hold.
                        1. ∀y∃x [y = 2x ∧ x∈Z ∧ y∈Z]
                        2. ∃x∀y [y/x < |y| ∧ x∈Z ∧ y∈Z]
                        3. ∃x∃y [x/y = y/x ∧ x∈Z ∧ y∈Z]




Week 2                                                                   Page 7
Practical Applications
  • Basis for clearly expressed formal specifications for any complex
    system.
  • Basis for automatic theorem provers and many other Artificial
    Intelligence systems.
  • Supported by some of the more sophisticated database query engines
    and container class libraries (these are types of programming tools).

Methods of Proof

Introduction

In mathematics we make assertions about a system whether it be a number
system or something more abstract such as a group or linear space. An
assertion not known to be true or false is called a hypothesis or conjecture.
Prior to 1995, a famous conjecture was Fermat' Last Theorem. It stated that
                                                  s
for an integer n ≥ 3 there are no positive integer solutions to the equation xn +
yn = zn . The process of establishing the truth of an assertion is called a proof.
Once a conjecture has been shown to be a true statement we label it as a
lemma, theorem or corollary. We think of a lemma as a result which is used
primarily to prove a more important result (i.e. a theorem), and a corollary as
a special case or consequence of a theorem. For example in calculus, we could
think of Maclaurin' Theorem as a corollary to Taylor' Theorem.
                    s                                   s

In these notes we are concerned with techniques that may be used to prove a
result and provide a tonic to the student' malady on proofs namely ``I don'
                                         s                                   t
know where to start' It is probably impossible to teach how to prove
                       '.
something and the best one can offer is a catalog of types of proof along with
examples. By reading proofs, the student can often gain insight as to how to
prove their own particular result. Once they have gained some experience,
they might then be ready for more complicated proofs. What is certain is that
there is no cook book solution to obtaining a proof. We recommend that you
read the notes on logic before proceeding.

Rules of inference

     • Patterns of logically valid deductions from hypotheses to conclusions

For this part of the Logic we will follow the notes written by Stefan
Waner and Steven R. Costenoble.

Week 2                                                                   Page 8
Inference Rules - General Form

  • Inference Rule –
       – Pattern establishing that if we know that a set of antecedent
          statements of certain forms are all true, then a certain related
          consequent statement is true.

antecedent 1
antecedent 2 …
∴ consequent “∴” means “therefore”

Inference Rules & Implications

  • Each logical inference rule corresponds to an implication that is a
    tautology.
  • antecedent 1         Inference rule
     antecedent 2 …
    ∴ consequent
  • Corresponding tautology:

((antecedent 1) ∧ (antecedent 2) ∧ …) → consequent

Some Inference Rules

         p                          Rule of Addition
     ________

     ∴ p∨q

         p∧q                        Rule of Simplification
     ________

     ∴p

         p                          Rule of Conjunction
         q
     ________

     ∴ p∧q

Modus Ponens & Tollens


Week 2                                                            Page 9
p                                Rule of modus ponens
     p→q                               (a.k.a. law of detachment)
     ∴q                               (“the mode of affirming”)

      ¬q
     p→q                               Rule of modus tollens
     ∴¬p                              (“the mode of denying”)

Syllogism Inference Rules
     p→q                              Rule of hypothetical
     q→r                              syllogism
    ________

  ∴p→r

   p∨q                                Rule of disjunctive
   ¬p                                 syllogism
  ________

  ∴q

Formal Proofs

  • A formal proof of a conclusion C, given premises p1, p2,…,pn consists of
    a sequence of steps, each of which applies some inference rule to
    premises or to previously-proven statements (as antecedents) to yield a
    new true statement (the consequent).
  • A proof demonstrates that if the premises are true, then the conclusion is
    true.

Formal Proof Example

  • Suppose we have the following premises:
    “It is not sunny and it is cold.”
    “We will swim only if it is sunny.”
    “If we do not swim, then we will canoe.”
    “If we canoe, then we will be home early.”
  • Given these premises, prove the theorem
    “We will be home early” using inference rules.

  • Let us adopt the following abbreviations:

Week 2                                                               Page 10
• sunny = “It is sunny”; cold = “It is cold”;
          swim = “We will swim”; canoe = “We will canoe”; early = “We
          will be home early”.
   • Then, the premises can be written as:
     (1) ¬sunny ∧ cold (2) swim → sunny
     (3) ¬swim → canoe (4) canoe → early



Step                                 Proved by
1. ¬sunny ∧ cold                     Premise #1.
2. ¬sunny                            Simplification of 1.
3. swim→sunny                        Premise #2.
4. ¬swim                             Modus tollens on 2, 3.
5. ¬swim→canoe                       Premise #3.
6. canoe                             Modus ponens on 4, 5.
7. canoe→early                       Premise #4.
8. early                             Modus ponens on 6, 7.

Definitions and Theorems
In many math text books you will see definitions and theorems. The definitions are defining technical
words and give a name to a special subclass of objects. For example, when we study the integers we
have a special subset of positive integers greater than 1 which are called primes. In calculus we deal
mainly with continuous functions or differentiable functions which are special subsets of functions.
Quite often it is these definitions that lead to proofs of elementary results. In understanding
mathematics, it is important to have a solid grasp of these definitions. Without that, comprehending a
theorem is limited and attempting to prove a theorem is useless. Definitions have the form ``X is a blob
if and only if condition' This biconditional form is used in two ways. First, suppose we have an object
                         '
                         .
Y and want to know if it is a blob. We see if Y satisfies the condition. If it does then Y is a blob,
otherwise it is not. Secondly, suppose we have an object Y that is a blob. Then we know that Y does
satisfy the condition and may make use of this fact, in a proof say.

The majority of theorem statements have two forms. The first is a conditional statement ``If condition
then conclusion' This form is an implication and it means that the conclusion is true whenever the
                 '.
condition is true. If the condition is denoted by p and the conclusion by q then the statement of the
theorem is written as          . Consequently,           if and only if the logical statement         is a
tautology. Often you will see the phrase ``For all'in statements of theorems. A statement such as ``For
                                                   '
all x in X, conclusion'is really a conditional form ``If x is an element of X then conclusion' It happens
                       '                                                                      '
                                                                                              .
to be true no matter which element x we consider.

The second common form of a theorem statement is the biconditional. This has the form ``p if and only
if q'or symbollically
    '                      . It is equivalent to the two implications      and       . Indeed, this is
how many of these theorems are proved (by proving the two implications). Logically,       if and only
if        is a tautology.

Week 2                                                                                         Page 11
One important aspect of statements is that they do have equivalent forms. Often, it might be difficult to
prove a result as it is stated but it could be easier to prove an equivalent statement. The following table
gives a list of common equivalent forms.




We also list some of the English equivalents of the conditional.




Other phrases that appear in theorems are ``There exists'and ``unique' A theorem statement such as
                                                            '              '
                                                                           .
``There exists an x in X such that conclusion' is know as an existence theorem. It says that the
                                                  '
conclusion statement is satsfied by something (or the truth set is non empty). However, the conclusion
may be satisfied by many elements of the set. If there is precisely one element of the set that satisfies the
conclusion then the theorem statement would state ``There exists a unique x in X such that conclusion'      '
                                                                                                            .
Such theorems are referred to as uniqeness theorems. Our previous statement is an existence and
uniqeness theorem. It is possible to have a theorem which asserts uniqeness but not existence.

Disproving Statements
Some conjectures are false. Verifying that a conjecture is false is often easier than proving a conjecture
is true. Despite that, showing a conjecture is false may have its own challenges and usually requires a
deep knowledge of the subject.

Some statements are often shown to be false by a counter examples. Such statements have the form
``For all x in X conclusion' This is shown to be false by finding one element of X which does not satisfy
                            '
                            .
the conclusion. As an example, consider the statement ``For all prime numbers p, 2p+1 is prime' This  '
                                                                                                      .
statement is true for the primes 2, 3 and 5. It is also true for the primes 11 and 23. However, the
statement is an assertion for all primes. Clearly the statement is not true for the prime 7 (since 15 = 3 5)
and we have obtained a counter example to the statement.

For finite sets, statements of the form such as ``There exists an x such that conclusion'can be refuted by
                                                                                        '
example. By testing each element of the set and showing no element satisfies the conclusion we have
shown the statement is false through an exhaustive search. This would also refute the statement ``There
exists a unique x such that conclusion' However, a statement of this form might be false for another
                                         '.

Week 2                                                                                           Page 12
reason, namely that there are two or more elements of the set that satisfy the conclusion. Again, this
statement could be refuted through a counter example. For example consider the statement ``The
equation           has a unique solution' This statement is false in the integers since both 1 and -1 satisfy
                                        '
                                        .
the equation and we have disproved it using a counter example. Note that the statement is true in the
positive integers.

As we noted above, some statements remain conjectures for many years (or even centuries) due to the
fact that a proof cannot be constructed (or discovered) or that a counter example cannot be found. There
are many famous conjectures and famous theorems that were conjectures for many years (The 4 color
theorem and Fermat' Last Theorem, for example).
                     s

Types of Proof
We discuss some approaches to proofs in this section. We focus our attention on proof by mathematical
induction, direct proofs, and indirect proofs (by contrapositive, equivalence and proofs using
contradiction). We assume that the theorem statement is a conditional form (              ) since the
biconditional form is equivalent to two conditional implications.

    •   Direct Proofs
    •   Proof by Contradiction and Reductio ad Absurdum
    •   The Contrapositive and Equivalent Forms
    •   Existence Proofs
    •   Uniqueness Proofs
    •   Mathematical Induction

Direct Proofs

In a direct proof of the statement          we employ the transitive nature of implication. That is to say
that if        and         then it follows that         . To start off the proof we assume that p is a true
statement. From this we deduce an implied statement . From we deduce an implied statement and
so on until we obtain an implication              . Using the transitive property of implication we then
deduce the validity of the theorem statement. The idea is very simple but the problem is what are these
implied statements                   ? These are results in their own right and may be obtained from other
theorems, corollaries or lemmas. In other words, they are known true statements. Alternatively, they
may be obtained from definitions. Undoubtedly, then, we have to know some of the implications of the
statement . In other words, what does a given piece of information tell us. The bad news is that a given
statement might make us think of several consequences and only a few of those facts might be used in
the proof. The worst case is that a given statement means absolutely nothing. So the difficulty in a direct
proof is finding these connections between certain facts. For example, suppose we know that x is a
prime number. What does that tell us? Here are some possible connections.

    •   Only positive divisors are 1 and itself
    •   If x is not two then it is an odd integer
    •   If x is odd then it is of the form 4k+1 or 4k-1 for some integer k.

Essentially we need to build in our memory a list of facts and implications. This comes down to knowing as much
information as possible. One might compare a direct proof to crossing a river using stepping stones. Standing on the river
bank is knowing the statement p. Getting across the river is deducing the statement q. The stepping stones are the
intermediate statements each of which is a consequence of the other. From each stone, you may have a choice of several
stones to reach next and you have to decide which one is best for you. The worst scenario is to have no stones on which to
step!



Week 2                                                                                                       Page 13
The skill of knowing which implications to use gets better with practice and experience. However, one
cannot over emphasize the fact that it is necessary to have knowledge of other results.

There is one particular warning we should give here. In knowing the answer to a problem we were
unable to solve by ourselves, we sometimes work backwards to see how we could have derived that
answer. This often gives us more insight into the problem. In a direct proof of a conditional statement
        we do know the answer (namely q). This time, assuming the answer and working backwards
does not work and certainly is not a proof. In first attempts at proofs, students often assume q and derive
a true statement such as ``1 = 1'and conclude that q is true. This is incorrect from many points of view.
                                '
First of all, their ``proof' may never use the statement p. What they have proved is
                              '                                                                              .
Secondly, the statement ``1=1'is true (in fact a tautology) and so is true whenever q is true but is also
                                   '
true if q is false. Thirdly, at best the student has proved the converse statement which is not equivalent to
the original. Think about the statement ``If x is odd then 2x is even'and why 2x being even does not
                                                                          '
imply that x is odd.

Proof by Contradiction and Reductio ad Absurdum

A common method to establish               is through proof by contradiction. As in direct proofs, we assume
p is true but we also assume the negation of q is true. From these facts, we deduce that the negation of p
is also true (or that p is false and hence the contradiction). Our conclusion is that the original statement q

must be true. Logically we have                      is equivalent to        .

A similar technique is known as reductio ad absurdum. Again, we wish to establish              . Suppose
that we know r is a true statement. As with proof by contradiction we assume p and the negation of q to
be true. Suppose we can now show that these imply that the negation of r is true (or that r is false). We
now have that r is both true and false which is absurd. Our conclusion is that q is true.



The Contrapositive and Equivalent Forms

The contrapositive of the implication           is the implication              . These are equivalent forms.
Sometimes it is easier to prove a result in the contrapositive form rather than in the original conditional
form. Proving the contrapositive might also be done as a direct proof, by induction or by contradiction.
The only care that one need take is that the contrapositive is formed correctly. For example the
contrapositive of the statement ``If x is odd then 5x is odd'is the statement ``If 5x is not odd then x is not
                                                              '
odd'or better still, ``If 5x is even then x is even' Some statements become more difficult to put in the
    '                                               '.
contrapositive form when they involve several connectives. The contrapositive of the statement ``If x is
odd and y is even then xy is even'is ``If xy is odd then x is even or y is odd' From our table of
                                       '                                                 '
                                                                                         .
equivalents in section 2, we see this is equivalent to ``If xy is odd and x is odd then y is odd'
                                                                                                '
                                                                                                .

Let' realize that in a direct proof of this result, our assumed true statement would change depending on
    s
which form we chose. For the statement ``If x is odd and y is even then xy is even'we would assume
                                                                                         '
that x is and odd integer and y an even integer. For the statement ``If xy is odd then x is even or y is odd'
                                                                                                            '
we would assume that the product xy is an odd integer. Finally, for the statement ``If xy is odd and x is
odd then y is odd'we would assume that xy is odd and x is odd.
                   '

Whether it is better to prove a statement in the original form or to rewrite it to an equivalent form is
difficult to answer. Certainly when answering problems from a text, it would be prudent to keep to the


Week 2                                                                                            Page 14
original form of the statement in the majority of cases. However, if you get stuck on a proof it might be
beneficial to consider alternative phrasings.

Existence Proofs

Theorems which state ``There exists an x such that conclusion'are known as existence theorems. Many,
                                                               '
but not all, theorems of this type are proved using a constructive proof so named because one finds an
element x that does satisfy the conclusion. As a simple example consider the statement ``Let a be a real
number. There exists a real number x that is a solution to the equation 5x+3 = a' A proof of this
                                                                                       '
                                                                                       .
statement would construct such a real number x. Using the rules of arithmetic in the real number system,
we know that if a is a real number then so too is (a-3)/5. This is a value of x that is a solution to the
equation since 5x +3 = 5(a-3)/5 + 3 = a -3 +3 = a as required. Of course not all proofs are this simple
and to produce an element x that will work may require ingenuity.

Uniqueness Proofs

Theorem statements that involve the word ``unique'are known as uniqueness theorems. Typically the
                                                    '
proof of such a statement follows the idea that we assume there are two elements that satisfy the
conclusion of the statement and then show that these elements are identical. As an example, consider the
statement ``If the real number equation 5x+3 =a has a solution then it is unique' A proof would look
                                                                                   '
                                                                                   .
something like the following. Suppose that y and z are both solutions to the equation. Then 5y+3 =a and
5z+3 =a. Thus 5y +3 = 5z +3 from which we deduce that y = z. While this is a very simple example, the
skeleton of the proof is the same for many uniqueness theorems.

Mathematical Induction

A type of proof that deserves special attention is mathematical induction. Some of the statements of
theorems which can be proved using mathematical induction involve an integer variable. An example of
such a theorem is




Let p(n) denote the statement involving the integer variable n. The Principle of Mathematical Induction
states


         If p(1) is true and, for some integer        , p(k+1) is true whenever p(k) is true then p(n) is true for all       .

This principle is often compared to an infinite line of dominos. The inductive part of the principle (for some integer           ,
p(n+1) is true whenever p(n) is true) would say that the domino in the (n+1)st position falls whenever the nth domino falls.
However, at that stage we still don'know if the line of dominos has fallen or is still upright. The base step in the principle (If
                                      t
p(1) is true) is analogous to saying the first domino has fallen. We would now realize that the complete line of dominos will
fall. It is important to show that the base step and the inductive step in the principle are satisfied.

There are several variations in this principle. The first covers statements that are true for all integers

beyond a certain value (such as                   which is true for all              ).


         If         is true and, for some integer             , p(k+1) is true whenever p(k) is true then p(n) is true for all

                   .



Week 2                                                                                                                   Page 15
There is also a stronger form of mathematical induction which states the following:


         If p(1) is true and, for each integer        the statements                         imply the statement p(k+1) then

         p(n) is true for all     .
This principle of strong mathematical induction is used for example to prove the result that every positive integer is a prime
number, a power of a prime or a product of primes. As with the principle of mathematical induction, there is a variation on
this to cover those statements that are true for all integers beyond a certain value   .




Week 2                                                                                                           Page 16

Más contenido relacionado

La actualidad más candente

Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكروDiscrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكروDr. Khaled Bakro
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematicsRachana Pathak
 
Predicates and quantifiers
Predicates and quantifiersPredicates and quantifiers
Predicates and quantifiersIstiak Ahmed
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topicsR.h. Himel
 
Rules of inference
Rules of inferenceRules of inference
Rules of inferenceLakshmi R
 
Mathematical induction
Mathematical inductionMathematical induction
Mathematical inductionrey castro
 
Discrete Mathematics Lecture
Discrete Mathematics LectureDiscrete Mathematics Lecture
Discrete Mathematics LectureGenie Rose Santos
 
Counting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilityCounting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilitySURBHI SAROHA
 
#4 formal methods – predicate logic
#4 formal methods – predicate logic#4 formal methods – predicate logic
#4 formal methods – predicate logicSharif Omar Salem
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiersblaircomp2003
 
Pigeonhole Principle
Pigeonhole PrinciplePigeonhole Principle
Pigeonhole Principlenielsoli
 
Unit 1 quantifiers
Unit 1  quantifiersUnit 1  quantifiers
Unit 1 quantifiersraksharao
 

La actualidad más candente (20)

Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكروDiscrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematics
 
Predicates and quantifiers
Predicates and quantifiersPredicates and quantifiers
Predicates and quantifiers
 
Logic&proof
Logic&proofLogic&proof
Logic&proof
 
lattice
 lattice lattice
lattice
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topics
 
Rules of inference
Rules of inferenceRules of inference
Rules of inference
 
Pigeon hole principle
Pigeon hole principlePigeon hole principle
Pigeon hole principle
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Mathematical induction
Mathematical inductionMathematical induction
Mathematical induction
 
Discrete mathematics
Discrete mathematicsDiscrete mathematics
Discrete mathematics
 
Discrete Mathematics Lecture
Discrete Mathematics LectureDiscrete Mathematics Lecture
Discrete Mathematics Lecture
 
Counting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilityCounting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probability
 
Normal forms
Normal formsNormal forms
Normal forms
 
Hasse diagram
Hasse diagramHasse diagram
Hasse diagram
 
#4 formal methods – predicate logic
#4 formal methods – predicate logic#4 formal methods – predicate logic
#4 formal methods – predicate logic
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiers
 
Pigeonhole Principle
Pigeonhole PrinciplePigeonhole Principle
Pigeonhole Principle
 
Unit 1 quantifiers
Unit 1  quantifiersUnit 1  quantifiers
Unit 1 quantifiers
 
Quantifier
QuantifierQuantifier
Quantifier
 

Destacado

Quantifiers
QuantifiersQuantifiers
Quantifierscarme73
 
Predicates and Quantifiers
Predicates and Quantifiers Predicates and Quantifiers
Predicates and Quantifiers Istiak Ahmed
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logicgiki67
 
1997 AFTA Commendation
1997 AFTA Commendation1997 AFTA Commendation
1997 AFTA CommendationSUSANNE OLSEN
 
Nested quantifiers
Nested quantifiersNested quantifiers
Nested quantifiersAli Saleem
 
17 using rules of inference to build arguments
17   using rules of inference to build arguments17   using rules of inference to build arguments
17 using rules of inference to build argumentsAli Saleem
 
Predicate calculus
Predicate calculusPredicate calculus
Predicate calculusRajendran
 
#3 formal methods – propositional logic
#3 formal methods – propositional logic#3 formal methods – propositional logic
#3 formal methods – propositional logicSharif Omar Salem
 
Propositional logic sneha-mam
Propositional logic sneha-mam Propositional logic sneha-mam
Propositional logic sneha-mam nitesh9353
 
Propositional logic for Beginners
Propositional logic for BeginnersPropositional logic for Beginners
Propositional logic for Beginnerskianryan
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 

Destacado (20)

Quantifiers
QuantifiersQuantifiers
Quantifiers
 
Predicates and Quantifiers
Predicates and Quantifiers Predicates and Quantifiers
Predicates and Quantifiers
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logic
 
1997 AFTA Commendation
1997 AFTA Commendation1997 AFTA Commendation
1997 AFTA Commendation
 
Quantification
QuantificationQuantification
Quantification
 
Nested loop
Nested loopNested loop
Nested loop
 
15 predicate
15 predicate15 predicate
15 predicate
 
Nested quantifiers
Nested quantifiersNested quantifiers
Nested quantifiers
 
Graphs
GraphsGraphs
Graphs
 
17 using rules of inference to build arguments
17   using rules of inference to build arguments17   using rules of inference to build arguments
17 using rules of inference to build arguments
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Predicate calculus
Predicate calculusPredicate calculus
Predicate calculus
 
#3 formal methods – propositional logic
#3 formal methods – propositional logic#3 formal methods – propositional logic
#3 formal methods – propositional logic
 
Logic part1
Logic part1Logic part1
Logic part1
 
Propositional logic sneha-mam
Propositional logic sneha-mam Propositional logic sneha-mam
Propositional logic sneha-mam
 
Propositional logic for Beginners
Propositional logic for BeginnersPropositional logic for Beginners
Propositional logic for Beginners
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Syllogism
SyllogismSyllogism
Syllogism
 

Similar a Lecture 2 predicates quantifiers and rules of inference

Similar a Lecture 2 predicates quantifiers and rules of inference (20)

Discrete Structure Lecture #5 & 6.pdf
Discrete Structure Lecture #5 & 6.pdfDiscrete Structure Lecture #5 & 6.pdf
Discrete Structure Lecture #5 & 6.pdf
 
PredicateLogic (1).ppt
PredicateLogic (1).pptPredicateLogic (1).ppt
PredicateLogic (1).ppt
 
PredicateLogic.pptx
PredicateLogic.pptxPredicateLogic.pptx
PredicateLogic.pptx
 
Per3 logika
Per3 logikaPer3 logika
Per3 logika
 
Chapter 01 - p2.pdf
Chapter 01 - p2.pdfChapter 01 - p2.pdf
Chapter 01 - p2.pdf
 
Formal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and QuantifiersFormal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and Quantifiers
 
Predicate &amp; quantifier
Predicate &amp; quantifierPredicate &amp; quantifier
Predicate &amp; quantifier
 
X02PredCalculus.ppt
X02PredCalculus.pptX02PredCalculus.ppt
X02PredCalculus.ppt
 
Predicates Logic.pptx
Predicates Logic.pptxPredicates Logic.pptx
Predicates Logic.pptx
 
dma_ppt.pdf
dma_ppt.pdfdma_ppt.pdf
dma_ppt.pdf
 
Universal Quantification DM
Universal Quantification DMUniversal Quantification DM
Universal Quantification DM
 
Use of quantifiers
Use of quantifiersUse of quantifiers
Use of quantifiers
 
1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt1606751772-ds-lecture-6.ppt
1606751772-ds-lecture-6.ppt
 
Discreate structure presentation introduction
Discreate structure presentation introductionDiscreate structure presentation introduction
Discreate structure presentation introduction
 
SESSION-11 PPT.pptx
SESSION-11 PPT.pptxSESSION-11 PPT.pptx
SESSION-11 PPT.pptx
 
Math Assignment Help
Math Assignment HelpMath Assignment Help
Math Assignment Help
 
Quantifiers and its Types
Quantifiers and its TypesQuantifiers and its Types
Quantifiers and its Types
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 

Más de asimnawaz54

Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceasimnawaz54
 
Expert systems with applications
Expert systems with applicationsExpert systems with applications
Expert systems with applicationsasimnawaz54
 
Establishing knowledge base
Establishing knowledge baseEstablishing knowledge base
Establishing knowledge baseasimnawaz54
 
Designing the expert system
Designing the expert systemDesigning the expert system
Designing the expert systemasimnawaz54
 
1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-main1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-mainasimnawaz54
 
Packet switching
Packet switchingPacket switching
Packet switchingasimnawaz54
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switchingasimnawaz54
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switchingasimnawaz54
 
Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocolasimnawaz54
 
Address resolution protocol
Address resolution protocolAddress resolution protocol
Address resolution protocolasimnawaz54
 
Address resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocolAddress resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocolasimnawaz54
 
Requirements analysis
Requirements analysisRequirements analysis
Requirements analysisasimnawaz54
 
Advanced software engineering lab 2
Advanced software engineering lab 2Advanced software engineering lab 2
Advanced software engineering lab 2asimnawaz54
 
Object oriented analysis lab1
Object oriented analysis lab1Object oriented analysis lab1
Object oriented analysis lab1asimnawaz54
 
Ooad sequence diagram lecture
Ooad sequence diagram lectureOoad sequence diagram lecture
Ooad sequence diagram lectureasimnawaz54
 

Más de asimnawaz54 (17)

Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inference
 
Expert systems with applications
Expert systems with applicationsExpert systems with applications
Expert systems with applications
 
Establishing knowledge base
Establishing knowledge baseEstablishing knowledge base
Establishing knowledge base
 
Designing the expert system
Designing the expert systemDesigning the expert system
Designing the expert system
 
1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-main1 s2.0-s0957417410007244-main
1 s2.0-s0957417410007244-main
 
Packet switching
Packet switchingPacket switching
Packet switching
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switching
 
Network layer and circuit switching
Network layer and circuit switchingNetwork layer and circuit switching
Network layer and circuit switching
 
Ipv6up
Ipv6upIpv6up
Ipv6up
 
Ipv4
Ipv4Ipv4
Ipv4
 
Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocol
 
Address resolution protocol
Address resolution protocolAddress resolution protocol
Address resolution protocol
 
Address resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocolAddress resolution protocol and internet control message protocol
Address resolution protocol and internet control message protocol
 
Requirements analysis
Requirements analysisRequirements analysis
Requirements analysis
 
Advanced software engineering lab 2
Advanced software engineering lab 2Advanced software engineering lab 2
Advanced software engineering lab 2
 
Object oriented analysis lab1
Object oriented analysis lab1Object oriented analysis lab1
Object oriented analysis lab1
 
Ooad sequence diagram lecture
Ooad sequence diagram lectureOoad sequence diagram lecture
Ooad sequence diagram lecture
 

Lecture 2 predicates quantifiers and rules of inference

  • 1. Lecture by Prof. Dr. Nasir Tauheed Department of Computer Science University of Karachi BSCS - 411 -- Discrete Mathematics -- Week 2 Predicates & Quantifiers Statements involving variables, such as “x > 3,” “x = y + 3,” and “x + y = z,” are often found in mathematical assertions and in computer programs. These statements are neither true not false when the values of the variables are not specified. In this section we will discuss the ways that propositions can be produced from such statements. The statement “x is greater than 3” has two parts: • The first part, the variable “x” is the subject of the statement. • The second part the – predicate, “is greater than 3” – refers to a property that the subject of the statement can have. We can denote the statement “x is greater than 3” by P(x), where P denotes the predicate “is greater than 3” and x is the variable. The statement P(x) is also said to be the value of the proposition function P at x. Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value. Example 1: Let P(x) denote the statement “x > 3”. Then P(4) : 4 > 3 is true, but P(2) : 2 > 3 is false. Replacing x by the value of 4 (or by 2) is a way to quantify the propositional function P(x). Quantify means to make it true or false. Predicates become propositions once every variable is bound- by assigning it a value from the Universe of Discourse U or quantifying it. (The collection of values that a variable x can take is called x’s Universe of Discourse.) Example 2: Let U = Z, the integers = {. . . -2, -1, 0 , 1, 2, 3, . . .} P(x): x > 0 is the predicate. It has no truth value until the variable x is bound. Examples of propositions where x is assigned a value: P(-3) is false, P(0) is false, P(3) is true. The collection of integers for which P(x) is true are the positive integers. P(y) ∨ ¬P(0) is not a proposition. The variable y has not been bound. However, P(3) ∨ ¬P(0) is a proposition which is true. Week 2 Page 1
  • 2. Predicate logic generalizes the grammatical notion of a predicate to also include propositional functions of any number of arguments, each of which may take any grammatical role that a noun can take. Example 3: Let P(x,y,z) = “x gave y the grade z”, then if x=“Mike”, y=“Mary”, z=“A”, then P(x,y,z) = “Mike gave Mary the grade A.” Exercise 4: Let R be the three-variable predicate R(x, y z): x + y = z Find the truth values of R(2, -1, 5), R(3, 4, 7), R(x, 3, z). Quantifiers Let’s say you have a predicate like P(x) and you want to apply a statement for all possible values of x. You can use quantifiers to do this. The notation ∀ x P(x) shows the universal quantification of P(x), with the upside-down A as the universal qualifier. – It says, FOR ALL x P(x) or FOR EVERY x P(x) Example 5: Let the u.d. of x be parking spaces at DCS. Let P(x) be the predicate “x is full.” Then the universal quantification of P(x), ∀x P(x), is the proposition: – “All parking spaces at DCS are full.” – i.e., “Every parking space at DCS is full.” – i.e., “For each parking space at DCS, that space is full.” The power of distinguishing objects from predicates is that it lets you state things about many objects at once. • E.g., let P(x) = “x+1>x”. We can then say, “For any number x, P(x) is true” instead of (0+1>0) ∧ (1+1>1) ∧ (2+1>2) ∧ ... Existential Quantifier of a proposition: there exists an element x in the universe of discourse such that P(x) is true – That is, there is AN x, or at least ONE x, such that P(x) is true – In this case, one would use the backwards E to denote this type quantifier rather than the all inclusive upside down A: Week 2 Page 2
  • 3. ∃ x P(x) For example, if P(x) was the statement x > 89, and your data set included test scores of 65, 72, 85, 88, and 95 what would be the existential quantification of P(x)? – TRUE! Example 6: Let the u.d. of x be parking spaces at DCS. Let P(x) be the predicate “x is full.” Then the existential quantification of P(x), ∃x P(x), is the proposition: – “Some parking space at DCS is full.” – “There is a parking space at DCS that is full.” – “At least one parking space at DCS is full.” Quantifiers Statement When is it True? When is it False? P(x) is true for every x. There is an x for which P(x) is false. There is an x for which P(x) is P(x) is false for every x. true. Practical use of Quantifiers: – In programming, at times you will create looping mechanisms to test every instance of your data (the scores for every student taking an exam, for instance) – You would inadvertently be using some aspect of universal or even existential quantification to test your data – Hence, this aspect of discrete math is a way of thinking about, or mapping out, what a programmer would have to construct to meet the needs of a customer. Free and Bound Variables • An expression like P(x) is said to have a free variable x (meaning, x is undefined). • A quantifier (either ∀ or ∃) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression having one or more bound variables. Example of Binding • P(x,y) has 2 free variables, x and y. • ∃x P(x,y) has 1 free variable, and one bound variable. [Which is which? y is a free variable and x is bound (by the existential quantification ∃x).] • “P(x), where x=3” is another way to bind x. Week 2 Page 3
  • 4. • An expression with zero free variables is a bona-fide (actual) proposition. • An expression with one or more free variables is still only a predicate: ∀x P(x,y). REMEMBER! A predicate is not a proposition until all variables have been bound either by quantification or assignment of a value! Equivalences involving the negation operator ¬∀x P(x) ⇔ ∃x ¬P(x) ¬∃x P(x) ⇔ ∀x ¬P(x) Distributing a negation operator across a quantifier changes a universal to an existential and vice versa. ¬∀x P(x) ⇔ ¬(P(x1) ∧ P(x2) ∧ … ∧ P(xn)) ⇔ ¬P(x1) ∨ ¬P(x2) ∨ ¬ … ∨ ¬ P(xn) ⇔ ∃x ¬P(x) Multiple Quantifiers: read left to right . . . Nesting of Quantifiers Example: Let the u.d. of x & y be people. Let L(x,y) = “x likes y” (a predicate with 2 f.v.’s). Then ∃y L(x,y) = “There is someone whom x likes.” (A predicate with 1 free variable, x.) Then ∀x (∃y L(x,y)) = “Everyone has someone whom they like.” (A proposition with 0 free variables.) Quantifier Exercise If R(x,y)=“x relies upon y,” express the following in unambiguous English: ∀x(∃y R(x,y)) = Everyone has someone to rely on. ∃y(∀x R(x,y)) = There’s a poor overburdened soul whom everyone relies upon (including himself)! ∃x(∀y R(x,y)) = There’s some needy person who relies upon everybody (including himself). ∀y(∃x R(x,y)) = Everyone has someone who relies upon them. ∀x(∀y R(x,y)) = Everyone relies upon everybody, (including themselves)! Example: Let U = R, the real numbers, Week 2 Page 4
  • 5. P(x,y): xy= 0 ∀x ∀y P(x, y) ∀x ∃y P(x, y) ∃x ∀y P(x, y) ∃x ∃y P(x, y) The only one that is false is the first one. What’s about the case when P(x,y) is the predicate x/y=1? Example: Let U = {1, 2, 3}. Find an expression equivalent to ∀x ∃y P(x, y) where the variables are bound by substitution instead: Expand from inside out or outside in. Outside in: ∃y P(1, y) ∧ ∃y P(2, y) ∧ ∃y P(3, y) ⇔ [P(1,1) ∨ P(1,2) ∨ P(1,3)] ∧ [P(2,1) ∨ P(2,2) ∨ P(2,3)] ∧ [P(3,1) ∨ P(3,2) ∨ P(3,3)] As you can see, with just these two quantifiers we can put together even more complex statements. Many theorems, results, etc. in mathematics are typically represented using quantifiers. For example, we know that all positive integers have at least one prime factor that is less than or equal to the number itself. Mathematically speaking, we can use our statement q(x,y) from before to express this result. q(x,y): x is a prime number that divides into y evenly AND is less than or equal to y. ∀y∃x [q(x,y)] Literally, this reads: “For all values y, there exists a value for x for which x is a prime number that divides into y evenly AND is less than or equal to y.” A very important distinction to make here is the order of the quantifiers. The statement ∃x∀y [q(x,y)] for example is NOT true. This literally reads: “There exists a value of x for which for all values of y, x is a prime number that divides into y evenly AND is less than or equal to y.” The reason this is not true is because no matter what value you try to pick for x, you can ALWAYS find a value for y such that x DOES NOT divide y. Perhaps, some practice evaluating these statements might help. Consider these simple open statements: Week 2 Page 5
  • 6. p(x): x > 0 q(x): x2 – 2x – 3 = 0 r(x): x < 0 s(x): x2 > 0 Decide whether each of these assertions is true or not: 1) ∃x [p(x) ∧ q(x)] 2) ∀x [p(x) ∧ r(x) → s(x)] 3) ∀x [r(x) → ¬q(x)] Now, take these assertions and put them into symbolic form: 1) For all values of x less than 0, x2 is greater than 0. 2) There exists a value of x for which if x2 – 2x – 3 = 0 then x is greater than 0. 3) For all values of x such that x2 – 2x – 3 = 0, x < 0. A little chart to keep all of this straight Statement When True When False ∃x p(x) For at least one value a in the For all values a in the universe for x, p(a) is true. universe for x, p(a) is false. ∀x p(x) For all values a in the For at least one value a in the universe for x, p(a) is true. universe for x, p(a) is false. ∃x [¬p(x)] For at least one value a in the For all values a in the universe for x, p(a) is false. universe for x, p(a) is true. ∀x [¬p(x)] For all values a in the For at least one value a in the universe for x, p(a) is false. universe for x, p(a) is true. Given a statement ∀x [p(x) → q(x)], here are other related statements: 1) Contrapositive: ∀x [¬q(x) → ¬p(x)] 2) Converse: ∀x [q(x) → p(x)] 3) Inverse: ∀x [¬p(x) → ¬q(x)] As we have mentioned before, if the given statement is true, then the contrapositive MUST BE true. However, neither the converse nor the inverse are necessarily true. However, if both the given statement AND the converse are true, we have and if and only if relationship. Similarly, if both the given statement and the inverse are true, we also have and if and only if (i.e. equivalence) relationship. A couple more rules that follow... So now, consider each of these implications: Week 2 Page 6
  • 7. 1) ∃x [p(x) ∧ q(x)] [∃x p(x) ∧ ∃x q(x)] 2) ∃x [p(x) ∨ q(x)] ⇔ [∃x p(x) ∨ ∃x q(x)] 3) ∀x [p(x) ∧ q(x)] ⇔ [∀x p(x) ∧ ∀x q(x)] 4) [∀x p(x) ∨ ∀x q(x)] ∀x [p(x) ∨ q(x)] An important observation is that the first and fourth rules only go one way. Can you think of some counter examples to these rules? Here are a couple of mine: For number 1, let statement p(x) = “x is greater than 100.” q(x) = “x is less than 0.” Certainly, ∃x p(x), also we have ∃x q(x). This is because there exists an x greater than 100, namely 101. But there also exists an x less than 0, namely –1. BUT, it is NOT true that ∃x [p(x) ∧ q(x)]. If this were the case, then we could find a single value of x for which BOTH p(x) AND q(x) hold. But, clearly they are contradictory statements and this can not happen. A counter example to the converse of rule number 4 is the following: Let p(x) = “x is an even integer.” q(x) = “x is an odd integer.” Clearly, for all integers x, we have either p(x) or q(x). BUT, it is not true that ∀x p(x) and it is also not true that ∀x q(x). The reason neither of these is true is because all integers are not odd, and all integers are not even either. Other practice problems First translate these assertions into English. Then deduce, with proof, whether they are valid or not. To show an assertion to be invalid, merely present a counter example. To prove it, you must show that the statement holds for all the values it says it will hold. 1. ∀y∃x [y = 2x ∧ x∈Z ∧ y∈Z] 2. ∃x∀y [y/x < |y| ∧ x∈Z ∧ y∈Z] 3. ∃x∃y [x/y = y/x ∧ x∈Z ∧ y∈Z] Week 2 Page 7
  • 8. Practical Applications • Basis for clearly expressed formal specifications for any complex system. • Basis for automatic theorem provers and many other Artificial Intelligence systems. • Supported by some of the more sophisticated database query engines and container class libraries (these are types of programming tools). Methods of Proof Introduction In mathematics we make assertions about a system whether it be a number system or something more abstract such as a group or linear space. An assertion not known to be true or false is called a hypothesis or conjecture. Prior to 1995, a famous conjecture was Fermat' Last Theorem. It stated that s for an integer n ≥ 3 there are no positive integer solutions to the equation xn + yn = zn . The process of establishing the truth of an assertion is called a proof. Once a conjecture has been shown to be a true statement we label it as a lemma, theorem or corollary. We think of a lemma as a result which is used primarily to prove a more important result (i.e. a theorem), and a corollary as a special case or consequence of a theorem. For example in calculus, we could think of Maclaurin' Theorem as a corollary to Taylor' Theorem. s s In these notes we are concerned with techniques that may be used to prove a result and provide a tonic to the student' malady on proofs namely ``I don' s t know where to start' It is probably impossible to teach how to prove '. something and the best one can offer is a catalog of types of proof along with examples. By reading proofs, the student can often gain insight as to how to prove their own particular result. Once they have gained some experience, they might then be ready for more complicated proofs. What is certain is that there is no cook book solution to obtaining a proof. We recommend that you read the notes on logic before proceeding. Rules of inference • Patterns of logically valid deductions from hypotheses to conclusions For this part of the Logic we will follow the notes written by Stefan Waner and Steven R. Costenoble. Week 2 Page 8
  • 9. Inference Rules - General Form • Inference Rule – – Pattern establishing that if we know that a set of antecedent statements of certain forms are all true, then a certain related consequent statement is true. antecedent 1 antecedent 2 … ∴ consequent “∴” means “therefore” Inference Rules & Implications • Each logical inference rule corresponds to an implication that is a tautology. • antecedent 1 Inference rule antecedent 2 … ∴ consequent • Corresponding tautology: ((antecedent 1) ∧ (antecedent 2) ∧ …) → consequent Some Inference Rules p Rule of Addition ________ ∴ p∨q p∧q Rule of Simplification ________ ∴p p Rule of Conjunction q ________ ∴ p∧q Modus Ponens & Tollens Week 2 Page 9
  • 10. p Rule of modus ponens p→q (a.k.a. law of detachment) ∴q (“the mode of affirming”) ¬q p→q Rule of modus tollens ∴¬p (“the mode of denying”) Syllogism Inference Rules p→q Rule of hypothetical q→r syllogism ________ ∴p→r p∨q Rule of disjunctive ¬p syllogism ________ ∴q Formal Proofs • A formal proof of a conclusion C, given premises p1, p2,…,pn consists of a sequence of steps, each of which applies some inference rule to premises or to previously-proven statements (as antecedents) to yield a new true statement (the consequent). • A proof demonstrates that if the premises are true, then the conclusion is true. Formal Proof Example • Suppose we have the following premises: “It is not sunny and it is cold.” “We will swim only if it is sunny.” “If we do not swim, then we will canoe.” “If we canoe, then we will be home early.” • Given these premises, prove the theorem “We will be home early” using inference rules. • Let us adopt the following abbreviations: Week 2 Page 10
  • 11. • sunny = “It is sunny”; cold = “It is cold”; swim = “We will swim”; canoe = “We will canoe”; early = “We will be home early”. • Then, the premises can be written as: (1) ¬sunny ∧ cold (2) swim → sunny (3) ¬swim → canoe (4) canoe → early Step Proved by 1. ¬sunny ∧ cold Premise #1. 2. ¬sunny Simplification of 1. 3. swim→sunny Premise #2. 4. ¬swim Modus tollens on 2, 3. 5. ¬swim→canoe Premise #3. 6. canoe Modus ponens on 4, 5. 7. canoe→early Premise #4. 8. early Modus ponens on 6, 7. Definitions and Theorems In many math text books you will see definitions and theorems. The definitions are defining technical words and give a name to a special subclass of objects. For example, when we study the integers we have a special subset of positive integers greater than 1 which are called primes. In calculus we deal mainly with continuous functions or differentiable functions which are special subsets of functions. Quite often it is these definitions that lead to proofs of elementary results. In understanding mathematics, it is important to have a solid grasp of these definitions. Without that, comprehending a theorem is limited and attempting to prove a theorem is useless. Definitions have the form ``X is a blob if and only if condition' This biconditional form is used in two ways. First, suppose we have an object ' . Y and want to know if it is a blob. We see if Y satisfies the condition. If it does then Y is a blob, otherwise it is not. Secondly, suppose we have an object Y that is a blob. Then we know that Y does satisfy the condition and may make use of this fact, in a proof say. The majority of theorem statements have two forms. The first is a conditional statement ``If condition then conclusion' This form is an implication and it means that the conclusion is true whenever the '. condition is true. If the condition is denoted by p and the conclusion by q then the statement of the theorem is written as . Consequently, if and only if the logical statement is a tautology. Often you will see the phrase ``For all'in statements of theorems. A statement such as ``For ' all x in X, conclusion'is really a conditional form ``If x is an element of X then conclusion' It happens ' ' . to be true no matter which element x we consider. The second common form of a theorem statement is the biconditional. This has the form ``p if and only if q'or symbollically ' . It is equivalent to the two implications and . Indeed, this is how many of these theorems are proved (by proving the two implications). Logically, if and only if is a tautology. Week 2 Page 11
  • 12. One important aspect of statements is that they do have equivalent forms. Often, it might be difficult to prove a result as it is stated but it could be easier to prove an equivalent statement. The following table gives a list of common equivalent forms. We also list some of the English equivalents of the conditional. Other phrases that appear in theorems are ``There exists'and ``unique' A theorem statement such as ' ' . ``There exists an x in X such that conclusion' is know as an existence theorem. It says that the ' conclusion statement is satsfied by something (or the truth set is non empty). However, the conclusion may be satisfied by many elements of the set. If there is precisely one element of the set that satisfies the conclusion then the theorem statement would state ``There exists a unique x in X such that conclusion' ' . Such theorems are referred to as uniqeness theorems. Our previous statement is an existence and uniqeness theorem. It is possible to have a theorem which asserts uniqeness but not existence. Disproving Statements Some conjectures are false. Verifying that a conjecture is false is often easier than proving a conjecture is true. Despite that, showing a conjecture is false may have its own challenges and usually requires a deep knowledge of the subject. Some statements are often shown to be false by a counter examples. Such statements have the form ``For all x in X conclusion' This is shown to be false by finding one element of X which does not satisfy ' . the conclusion. As an example, consider the statement ``For all prime numbers p, 2p+1 is prime' This ' . statement is true for the primes 2, 3 and 5. It is also true for the primes 11 and 23. However, the statement is an assertion for all primes. Clearly the statement is not true for the prime 7 (since 15 = 3 5) and we have obtained a counter example to the statement. For finite sets, statements of the form such as ``There exists an x such that conclusion'can be refuted by ' example. By testing each element of the set and showing no element satisfies the conclusion we have shown the statement is false through an exhaustive search. This would also refute the statement ``There exists a unique x such that conclusion' However, a statement of this form might be false for another '. Week 2 Page 12
  • 13. reason, namely that there are two or more elements of the set that satisfy the conclusion. Again, this statement could be refuted through a counter example. For example consider the statement ``The equation has a unique solution' This statement is false in the integers since both 1 and -1 satisfy ' . the equation and we have disproved it using a counter example. Note that the statement is true in the positive integers. As we noted above, some statements remain conjectures for many years (or even centuries) due to the fact that a proof cannot be constructed (or discovered) or that a counter example cannot be found. There are many famous conjectures and famous theorems that were conjectures for many years (The 4 color theorem and Fermat' Last Theorem, for example). s Types of Proof We discuss some approaches to proofs in this section. We focus our attention on proof by mathematical induction, direct proofs, and indirect proofs (by contrapositive, equivalence and proofs using contradiction). We assume that the theorem statement is a conditional form ( ) since the biconditional form is equivalent to two conditional implications. • Direct Proofs • Proof by Contradiction and Reductio ad Absurdum • The Contrapositive and Equivalent Forms • Existence Proofs • Uniqueness Proofs • Mathematical Induction Direct Proofs In a direct proof of the statement we employ the transitive nature of implication. That is to say that if and then it follows that . To start off the proof we assume that p is a true statement. From this we deduce an implied statement . From we deduce an implied statement and so on until we obtain an implication . Using the transitive property of implication we then deduce the validity of the theorem statement. The idea is very simple but the problem is what are these implied statements ? These are results in their own right and may be obtained from other theorems, corollaries or lemmas. In other words, they are known true statements. Alternatively, they may be obtained from definitions. Undoubtedly, then, we have to know some of the implications of the statement . In other words, what does a given piece of information tell us. The bad news is that a given statement might make us think of several consequences and only a few of those facts might be used in the proof. The worst case is that a given statement means absolutely nothing. So the difficulty in a direct proof is finding these connections between certain facts. For example, suppose we know that x is a prime number. What does that tell us? Here are some possible connections. • Only positive divisors are 1 and itself • If x is not two then it is an odd integer • If x is odd then it is of the form 4k+1 or 4k-1 for some integer k. Essentially we need to build in our memory a list of facts and implications. This comes down to knowing as much information as possible. One might compare a direct proof to crossing a river using stepping stones. Standing on the river bank is knowing the statement p. Getting across the river is deducing the statement q. The stepping stones are the intermediate statements each of which is a consequence of the other. From each stone, you may have a choice of several stones to reach next and you have to decide which one is best for you. The worst scenario is to have no stones on which to step! Week 2 Page 13
  • 14. The skill of knowing which implications to use gets better with practice and experience. However, one cannot over emphasize the fact that it is necessary to have knowledge of other results. There is one particular warning we should give here. In knowing the answer to a problem we were unable to solve by ourselves, we sometimes work backwards to see how we could have derived that answer. This often gives us more insight into the problem. In a direct proof of a conditional statement we do know the answer (namely q). This time, assuming the answer and working backwards does not work and certainly is not a proof. In first attempts at proofs, students often assume q and derive a true statement such as ``1 = 1'and conclude that q is true. This is incorrect from many points of view. ' First of all, their ``proof' may never use the statement p. What they have proved is ' . Secondly, the statement ``1=1'is true (in fact a tautology) and so is true whenever q is true but is also ' true if q is false. Thirdly, at best the student has proved the converse statement which is not equivalent to the original. Think about the statement ``If x is odd then 2x is even'and why 2x being even does not ' imply that x is odd. Proof by Contradiction and Reductio ad Absurdum A common method to establish is through proof by contradiction. As in direct proofs, we assume p is true but we also assume the negation of q is true. From these facts, we deduce that the negation of p is also true (or that p is false and hence the contradiction). Our conclusion is that the original statement q must be true. Logically we have is equivalent to . A similar technique is known as reductio ad absurdum. Again, we wish to establish . Suppose that we know r is a true statement. As with proof by contradiction we assume p and the negation of q to be true. Suppose we can now show that these imply that the negation of r is true (or that r is false). We now have that r is both true and false which is absurd. Our conclusion is that q is true. The Contrapositive and Equivalent Forms The contrapositive of the implication is the implication . These are equivalent forms. Sometimes it is easier to prove a result in the contrapositive form rather than in the original conditional form. Proving the contrapositive might also be done as a direct proof, by induction or by contradiction. The only care that one need take is that the contrapositive is formed correctly. For example the contrapositive of the statement ``If x is odd then 5x is odd'is the statement ``If 5x is not odd then x is not ' odd'or better still, ``If 5x is even then x is even' Some statements become more difficult to put in the ' '. contrapositive form when they involve several connectives. The contrapositive of the statement ``If x is odd and y is even then xy is even'is ``If xy is odd then x is even or y is odd' From our table of ' ' . equivalents in section 2, we see this is equivalent to ``If xy is odd and x is odd then y is odd' ' . Let' realize that in a direct proof of this result, our assumed true statement would change depending on s which form we chose. For the statement ``If x is odd and y is even then xy is even'we would assume ' that x is and odd integer and y an even integer. For the statement ``If xy is odd then x is even or y is odd' ' we would assume that the product xy is an odd integer. Finally, for the statement ``If xy is odd and x is odd then y is odd'we would assume that xy is odd and x is odd. ' Whether it is better to prove a statement in the original form or to rewrite it to an equivalent form is difficult to answer. Certainly when answering problems from a text, it would be prudent to keep to the Week 2 Page 14
  • 15. original form of the statement in the majority of cases. However, if you get stuck on a proof it might be beneficial to consider alternative phrasings. Existence Proofs Theorems which state ``There exists an x such that conclusion'are known as existence theorems. Many, ' but not all, theorems of this type are proved using a constructive proof so named because one finds an element x that does satisfy the conclusion. As a simple example consider the statement ``Let a be a real number. There exists a real number x that is a solution to the equation 5x+3 = a' A proof of this ' . statement would construct such a real number x. Using the rules of arithmetic in the real number system, we know that if a is a real number then so too is (a-3)/5. This is a value of x that is a solution to the equation since 5x +3 = 5(a-3)/5 + 3 = a -3 +3 = a as required. Of course not all proofs are this simple and to produce an element x that will work may require ingenuity. Uniqueness Proofs Theorem statements that involve the word ``unique'are known as uniqueness theorems. Typically the ' proof of such a statement follows the idea that we assume there are two elements that satisfy the conclusion of the statement and then show that these elements are identical. As an example, consider the statement ``If the real number equation 5x+3 =a has a solution then it is unique' A proof would look ' . something like the following. Suppose that y and z are both solutions to the equation. Then 5y+3 =a and 5z+3 =a. Thus 5y +3 = 5z +3 from which we deduce that y = z. While this is a very simple example, the skeleton of the proof is the same for many uniqueness theorems. Mathematical Induction A type of proof that deserves special attention is mathematical induction. Some of the statements of theorems which can be proved using mathematical induction involve an integer variable. An example of such a theorem is Let p(n) denote the statement involving the integer variable n. The Principle of Mathematical Induction states If p(1) is true and, for some integer , p(k+1) is true whenever p(k) is true then p(n) is true for all . This principle is often compared to an infinite line of dominos. The inductive part of the principle (for some integer , p(n+1) is true whenever p(n) is true) would say that the domino in the (n+1)st position falls whenever the nth domino falls. However, at that stage we still don'know if the line of dominos has fallen or is still upright. The base step in the principle (If t p(1) is true) is analogous to saying the first domino has fallen. We would now realize that the complete line of dominos will fall. It is important to show that the base step and the inductive step in the principle are satisfied. There are several variations in this principle. The first covers statements that are true for all integers beyond a certain value (such as which is true for all ). If is true and, for some integer , p(k+1) is true whenever p(k) is true then p(n) is true for all . Week 2 Page 15
  • 16. There is also a stronger form of mathematical induction which states the following: If p(1) is true and, for each integer the statements imply the statement p(k+1) then p(n) is true for all . This principle of strong mathematical induction is used for example to prove the result that every positive integer is a prime number, a power of a prime or a product of primes. As with the principle of mathematical induction, there is a variation on this to cover those statements that are true for all integers beyond a certain value . Week 2 Page 16