CS311 -- Discrete Structures ----Spring 2002
Note: Lecture notes will not exactly follow the lecture. They may include more
material.
Note on notation: Because of the limitations of html (and my knowledge of it),
I will use the following notation in these notes:
- "V" for or
- "&" for and
- " ¬" for not
- "->" for implies
Lecture and Other Notes Wednesday 1/23/02 (Class 3)
In the homework there was a question in which the English statement was
written using an "only if" rather than "if - then". On page 48 in
the book are described several ways you can write "p->q" in English:
- "if p then q"
- "p only if q"
- "p is a sufficient condition for q"
- "q is a neccesary condition for p"
For example: "If x is divisible by 4 then x is divisible by 2."
is equivalent (logically) to "x is divisible by 4 only if x is divisible by 2."
Precedence
We haven't talked about the order of precedence of operations. Sometimes
there may be two ways to parenthesize a statement resulting in to different
logical values. For example, p & q -> r could be (p & q)->r or p & (q->r)
but it is generally accepted to mean: (p & q) -> r.
Other examples:
- ¬ p & q should be (¬ p) & q
- p & q V r should be (p & q) V r
- p -> q & r should be (p -> q) & r
Quantifiers
The logical expression we have discussed so far do not allow variables. We cannot
make a statement about all integers. We need quantifiers. Where we had
propositions before, now we will deal with predicates or open statements
which are logical statements that may be applied to a number of elements. For example
the statement: "x is even" is a predicate. It has no logical value until we choose a
value for x. The values for x come from a Universe, which is the set of possible
values for our predicates.
Definition: A predicate (or open statement) is a statement
that is a proposition (has a true/false value) when an element of the universe is substituted
for x.
Examples of predicates (universe = integers):
- -- If x is even then x is not odd.
- -- For all intgers x, if x is even then x is not odd.
There are two quantifiers used with predicates: "for-all" and "there-exists" (I
can't write the symbols here).
Definition:"for-all x [P(x)]" is true if and only if P(x) is true for all
elements x in the universe.
Definition:"there-exists x [P(x)]" is true if and only if P(x) is true for
at least one member of the universe.
Example:
U = {GarField, Odie, Lassie, Tweety} (this is the universe)
Note: Garfield and Odie are cats. Lassie is a dog. Tweety is a bird.
C(x) = "x is a cat" (this is a predicate)
C(GarField) = "GarField is a cat" True
C(Odie) = "Odie is a cat" False
C(tweety) = "Tweety is a cat" False
Let A(x) = "x is an animal"
A(GarField) = true
For every mumber x of the university, A(x) is true so "for-all x [A(x)]" is TRUE
-------
U = non negative integers
E(x) = "x is even"
"All integers are even". = "for-all x[E(x)]" This is false
--------------------------------
U = positive integers
Note: 0 is not positive or negative
Note: 0 is even
E(x) = "x is even"
O(x) = "x is odd"
For-all x [E(x)->¬ O(x)] = "For any positive integer x, if x is even, then x is not odd.
This is True
¬ for-all x [E(x) & O(x)] = "Not all integers are both even and odd." This is true.
¬ there-exists x [E(x) & O(x)] = "There is no integer that is both even and odd." This is True.
-----------------------------
U = animals
S(x) = "x is a snake"
y(x) = "x is yucky"
Consider the difference between: for-all x[S(x) & Y(x)] and for-all x[S(x)->Y(x)]
The first says "All animals are snakes and all animals are yucky."
The second says: "For all animals, if it is a snake, then it is yucky." or as it will usually
appear: "All snakes are yucky."
Consider some other statements:
¬ for-all x [S(x)] = TRUE === "Not all animals are snakes."
for-all x [ ¬ S(x)] = FALSE === "All animals are not snakes."
there-exists x [ S(x)] = TRUE == "There is some animal that is a snake."
¬ there-exists x [S(x)] = FALSE == "There are no snakes."
there-exists x [¬ S(x)] = TRUE == "There is some animal that is not a snake."
-------------------------------
U = integers
Evaluating quantified statements:
Table 2.21 on page 94 of the book shows when for-all and there-exist statements are
true and false. A similar table is below:
| for-all x[p(x)] true | p(x) true for every x |
| for-all x[p(x)] false | p(x) false for some x |
| there-exists x[p(x)] true | p(x) true for some x |
| there-exists x[p(x)] false | p(x) is false for all x |
| ¬ for-all x[p(x)] true | some p(x) is false |
| ¬ there-exists x [p(x)] true | all p(x) false |
You might notice from this table that:
¬ for-all x[P(x)] <=> there-exists x [¬ P(x)]
and ¬ there-exists x[P(x)] <=> for-all x [¬ P(x)]
When proving statements involving quantifiers, you need to know what you need to prove.
The table above is helpful. Proofs of "there-exist" statements are the easiest - you
need only show that whatever is claimed does exist.
For example:
Claim:There exists an integer divisible by 2,3,4,6
The universe is not specified (it usually is not) but it is the set of integers.
If you wanted to write this logically you could define: D(x) = " x is divisible by 2,3,4,6"
and write: there-exists x [D(x)]
Or, alternatively, define D(x,y) = "x is divisible by y".
Then the claim would be : there-exists x [D(x, 2) & D(x, 3) & D(x, 4) & D(x, 6)]
Proof: 12 is an integer. 12 is divisible by 2,3,4,6. Therefore the claim
is true. QED.