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 Monday 1/14/02 (Class 2)

Definition: An assertion or proposition is a statement that is either true or false. It can be evaluated. Examples:

"Today is Monday" ---is a proposition. It was true (during lecture).
"No way!" -- is not a proposition.
"x + 3 > 5" --- is not a proposition because we don't know whether it is true or false without knowing what x is.
Defintion:A primitive statement does not have logical connectors. You can make a compound statement by negative a primitive statement or by combining primitive statements with logical connectors. The logical connectors are:
"and" - usually written as upside down "V" - on these html files as an "&".
"or" - written as "V" (or sometimes "+")
"exclusive or" written as "V" with bar under it (in our book)
"->" -- "implies" or "if- then"
"<->" -- "biconditional" or "if and only if".
Here are the truth tables for these operators. It is assumed you are familiar with and, or, and exclusive or. Here is the truth table for all the operations:
  p     q   p & qp V qp xor qp->qp<->q
0 000011
0101110
1001100
1111011
 
For example, let "p = Today is Monday" and "q = CS 311 meets" then the statement p & q is "Today is Monday and CS 311 meets." Since $p$ is true and $q$ is true, by the truth table for "and" we know p & q is true. What about "->"?
p->q is "If today is Monday then CS311 meets.
Both p and q are true and by the truth table for ->, 1 -> 1 = 1. So the statement "If today is Monday then CS311 meets." is true. Consider the statement q ->p: "If CS311 meets then today is Monday." On Wednesday we can have a situation where the first part (CS311 meets) is true and the second part is false. From the truth table we see that 1 ->0 = 0 so this statement is false. Just because CS311 is meeting doesn't mean today is Monday. It could be Wednesday. Other examples:
"If I am a woman then I am a person." If Dr. Booth is making this statement, then it is "1 -> 1 = 1" and so it is true. If a man is making this statement, then it is "0->1 = 1" and is also true. Whenever the "if" part is false, the entire statement is defined to be true.
"If I am a dog then I am a person." This is true since it is "0->1 = 1".
Consider another example:
"If today is Monday or Wednesday then today CS311 meets." Let p = "Today is Monday." and let q = "Today is Wednesday." and let r = "CS311 meets today."
Then the statement is: (p V q) -> r.
This is a true statement (assuming no holidays and ignoring the fact that the semester ends.) Now consider the converse: r->(p V q). Is this true?
r->(p V q) is " IF CS311 meets today then today is Monday or Wedneday.". This is also true. When p -> q and q->p are both true we say p and q are equivalent: p <-> q. Another way to say it is "p is true if and only if q is true."
"If and only if" is often abbreviated "iff". The truth table for p <-> q shows this is true only when p and q are the same. Examples:
"Today is Monday iff tomorrow is Tuesday." is true.
"x > 5 iff x2 > 25" is false: could have x = -5.
"If x > 5 then x2 > 25." is true.
"If and only if" is a stronger statement than "if-then".
Fact: p <->q <=> (p->q) & (q->p). If p->q is true, then is q->p always true too? No. How do we know? Check out the truth table.  
  p     q  p->qq->p
0011
0110
1001
1111
 
Actually you can see from the truth table that p->q is equal to q->p only when p = q. Definition:q->p is called the converse of p->q.
Definition:¬ q -> & not p is called the contrapositive of p->q.
In words:
 
ConverseContrapositive
If p then q.If q then p.If not q then not p.
p->qq -> p¬ q -> ¬ p
 
The converse of a true statement is not necessarily true. The contrapositive of a true statement is always true. We can see that from the truth table.
Example: "If I work then I get paid."
Converse: "If I get paid then I work(ed)."
Contrapositive: "If I didn't get paid then I didn't work."
You can imagine situations when the converse is false. The contrapositive is true. If we know that pay always follows work (according to the original statement) then no pay must mean no work.
Definition: Statements s1 and s2 are equivalent if they have the same truth table for every possible assignment of logical values. We write "s1 <=> s2". Fact: p->q <=> (¬ p) V q Example: ¬ (p V q) <=> ¬ p & ¬ q
Definition: An expression is a tautology if it is true for all possible values of the logical variables. Definition: An expression is a contradiction if it is false for all possible values of the logical variables. Example: Consider the expression p V ¬ p. This is a tautology because if p = 1 then the statement is true. If p = 0 then ¬ p = 1 and the statement is true. We can verify this with a truth table. The statement p & ¬ p is not a tautology. In fact it is false for all possible variables so it is a contradiction.
 
  p    ¬ p  p V ¬ pp & ¬ p
0110
1010
 
Another definition for logically equivalent: Two expressions s1 and s2 are equivalent if and only if
   s1 <-> s2 is a tautology. Example: Consider p->q and ¬ p V q. They are supposed to be equivalent. By the definition above this means (p->q) <-> (&p V q) should be a tautology. See the table below:
 
  p    q   p -> qp¬ p V q(p->q) <-> (¬ p V q)
00111
01111
10001
11111
 
The table shows (p->q) <-> (&p V q) is a tautology. Therefore p->q <=> &p V q.
Note: Skip duality in the book.
Rules of Inference
Our goal is to use logic to prove things. In order to prove a statement we have to be able to make deductions from known facts. Example:
Given: "If today is Monday then CS311 meets today."
If today is Monday, can we deduce that CS311 meets today? Yes.
If CS311 meets today can we deduce that today is Monday? No.
In the former example we have this situation: (p->q) & p
In this situation we can deduce q. No matter what p and q are, if p->q is true and p is true then q must be true.
In the second example we have: (p->q) & q.
We cannot deduce p from this. If p is false and q is true then p->q is true and q is true, but p is not true. We can use a truth table to show that ((p->q)&p)->q is a tautology and that ((p->q) & q) ->p is not.
 
  p    q  (p ->q) & p((p->q)&p)->q(p->q)&q ((p->q)&q)->p
000101
010110
100101
111111
 
We have just derived our first "Rule of Inference" which is called "Modus Ponens": If we know (p->q) is true and p is true then we can infer that q is true. The rules of inference are listed in a chart on page 79 in the book. Here are some:
 
Modus Ponensp->qIf I am a dog then I am furry.
p I am a dog
Conclusion: q Therefore I am furry.
Modus Tollensp->qIf I am a dog then I am furry.
¬ q I am not furry.
Conclusion: ¬ p Therefore I am not a dog.
 
We can write "proofs" using the rules of inference as follows:
Example: Given: If I am a cat then I am not a dog.
      I am a cat.
Prove: I am not a dog.
Proof: Let p = "I am a cat."
Let q = "I am not a dog."
Given: p->q and p.
1) p->q given
2) p given
3) q (1) and (2) and Modus Ponens.
Another Example: Given: If 15 is divisible by 4 then it is divisible by 2.
      15 is not divisible by 2.
Therefore: 15 is not divisible by 4.
Proof:
Let p = "15 is divisible by 4."
Let q = "15 is divisible by 2."
Given: p->q and ¬ q
We wish to show ¬ p.
1) p->q given
2) ¬ q given
3) ¬ p (1) and (2) and Modus Tollens.