Discrete Structures For Computing
Discrete Structures For Computing
------------------------------------------------------------------------
1.2 Propositional Equivalences
------------------------------------------------------------------------
Ex: p \/ ~p
Truth table:
p ~p p \/ ~p
----------------
T F T
F T T
Ex: p /\ ~p
Truth table:
p ~p p /\ ~p
----------------
T F F
F T F
Ex: p /\ p
Truth table:
p p /\ p
----------
T T
F F
LOGICALLY EQUIVALENT: the two propositions have the same truth value
in all possible cases.
p q p \/ q ~(p \/ q) ~p ~q ~p /\ ~q
--------------------------------------------------
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
Notice that the two relevant columns have the same values in them.
<<work it out>>
~(p -> q) <=> ~(~p \/ q) since p -> q <=> (~p \/ q) (done above)
<=> ~(~p) /\ ~q) by DeMorgan
<=> p /\ ~q by double negation (cf. Table 6)
------------------------------------------------------------------------
1.3 Predicates and Quantifiers
------------------------------------------------------------------------
Example: "x is greater than 3". x is the variable, "greater than 3"
is the predicate.
temp := x
x := y
y := temp
Use of the universal quantifier: For all x (in the domain), P(x).
Notation is AxP(x) (really A should be upside-down A).
Example: Suppose P(x) is "x + 1 > x" and the domain is the real numbers.
What is the truth value of AxP(x)?
Since x + 1 > x is true for all real numbers, AxP(x) is true.
Example: Suppose Q(x) is "x < 2" and the domain is the real numbers.
What is the truth value of AxQ(x)?
Since there exists a real number that is >= 2, AxQ(x) is false.
Use of the existential quantifier: There exists x (in the domain), P(x).
Notation is ExP(x) (really E should be backwards E).
Example: Suppose Q(x) is "x < 2" and the domain is the real numbers.
What is the truth value of ExQ(x)?
Since there exists a real number that is less than 2, ExQ(x) is true.
Example: Suppose R(x) is "x > x + 1" and the domain is the real numbers.
What is the truth value of ExR(x)?
Since there is *no* real number that is larger than 1 plus itself,
ExR(x) is false.
Example: Ex(x + y = 1)
x is bound, y is free.
Consider the statement "Every student in the class has taken Math 151."
What is the negation of this?
(a) "No student in the class has taken Math 151" or
(b) "There is a student in the class that has not taken Math 151" ?
In general,
AxP(x) : for all x, P(x) is true
When this is negated : it is not the case that for all x, P(x) is true.
I.e., there exists an x such that P(x) is not true.
I.e.,
Ex~P(x).
Similarly, consider the statment "At least one student in the class
has taken Math 152". What is the negation of this?
It is "No student in the class has taken Math 152".
In general,
ExP(x) : there exists an x such that P(x) is true
When this is negated : it is not the case that there exists an x
such that P(x) is true.
I.e., for all x, P(x) is false.
I.e.,
Ax~P(x).
DMATH RESEARCH – PAGE 5
A Prolog program is given a series of facts and some rules for reasoning
about those facts. Then it can answer queries relating to those facts.
For instance:
input facts:
instructor(chan,math273)
instructor(patel,ee222)
instructor(grossman,cs301)
enrolled(kevin,math273)
enrolled(juana,ee222)
enrolled(Juana,cs301)
enrolled(kiko,math273)
enrolled(kiko,cs301)
------------------------------------------------------------------------
1.4 Nested Quantifiers
------------------------------------------------------------------------
We can build even more complex logical statements by nesting
quantifiers. For the next few examples, assume the domain is the
real numbers.
Example: Ax Ey (x + y = 0)
For every x, there exists y such that x + y is zero.
(Namely, -x.)
Example: Ax Ay (x + y = y + x)
The commutative law of addition.
* Ax Ey P(x,y)
Means that for every x, there is a y for which P(x,y) is true
* Ex Ay P(x,y)
Means that there exists an x such that for every y, P(x,y) is true
I.e., swap the quantifier and negate what comes after it.
------------------------------------------------------------------------
1.5 Rules of Inference
------------------------------------------------------------------------
In order to prove mathematical statements, we have to give valid
arguments for them. I.e., we start with statements we already know
are true, and then deduce new true statements, until finally we reach
our desired conclusion. To deduce new true statements from statements
we already know are true, we use RULES OF INFERENCE.
Notation:
p
p -> q
------
.
. . q
* p implies p \/ q addition
* p /\ q implies p simplification
DMATH RESEARCH – PAGE 7
Example:
Hypotheses are:
(a) ~p /\ q
(b) r -> p
(c) ~r -> s
(d) s -> t
Step
1. ~p /\ q hypothesis (a)
2. ~p simplification using step 1
3. r -> p hypothesis (b)
4. ~r modus tollens using steps 2 and 3
5. ~r -> s hypothesis (c)
6. s modus ponens using steps 4 and 5
7. s -> t hypothesis (d)
8. t modus ponens using steps 6 and 7
Fallacies
---------
Watch out for making these mistakes:
(a) assuming that if p -> q is true and q is true, then p must be true.
This is not necessarily true.
Example: Suppose we know that "if it rains then the roof leaks"
and also we know that the roof is leaking. Do not assume that
it is raining!! It could be that the roof leaks all the time,
even when it is not raining.
Example: Suppose we know that "if it rains then the roof leaks"
and also we know that it is not raining. Do not assume that the
roof is not leaking! It could be that the roof leaks all the time,
even when it is not raining.
* If P(c) is true for an arbitrary c in the domain, then we can conclude that
AxP(x) is true.
*** WARNING! Cannot make any assumptions about c other than it is
in the domain! Making additional (unwarranted) assumptions about
c and then concluding AxP(x) is a common mistake in proofs.
For instance, suppose you prove something making use of the fact
that c is an even integer - you cannot conclude that the fact is
true of all integers.
Called Universal generalization.
* If ExP(x) is true, then we can conclude that P(c) is true for some
element c of the domain.
*** WARNING! Cannot make any assumptions about c other than that it is
in the domain! Another source of errors. For instance, if the
domain is the integers, and you need to do something with c,
you cannot assume that c is even.
Called Existential Instantiation.
These 4 rules can be combined with the previous rules for propositional
logic.
Assume that "For all positive integers n, if n > 4, then n^2 < 2^n"
is true. Then show that 100^2 < 2^100.