L1.1
Lecture Notes: Logic
Justification:
Precise and structured reasoning is needed in all sciences
including computer science. Logic is the basis of all reasoning. Computer
programs are similar to logical proofs.
Just as positive whole numbers are the fundamental units for arithmetic,
propsitions
are the fundamental units of logic.
Proposition:
A statement that is either true or false.
E.g. Today is Monday
Today is Tuesday
The square root of 4 is 2
The square root of 4 is 1
2 is even, and the square of two is even, and 3 is odd and the square of 3
is odd.
The Panthers can clinch a playoff berth with a win, plus a loss by the
Rams, a loss or tie by the Saints and Bears, a win by the
Seahawks and a tie between the Redskins and Cowboys. (Copied
verbatim from the sports page 12/26/2004.)
Propositions may be true or false and no preference is given one way or the
other. This is sometimes difficult to grasp as we have a “natural” preference
for true statements. But “snow is chartreuse” and “snow is white” are both
propositions of equal standing though one is true and the other false.
Nonpropositions:
What is today?
Is today Monday?
Questions are not propositions. You can’t judge whether the question itself is
true or false, even though the answer to the question may be true or false.
Show me some ID!
Similarly, imperative statements lack a truth value.
2x=4
x=y
Statements with undetermined variables do not have truth value
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Documentxy=yx
looks like a true proposition but
is it multiplication or
concatenation? If you don’t know, it’s not a proposition.
This sentence is false
(paradoxes are not propositions)
Propositions may be abbreviated by letters: p,q,r, etc. Thus logic may
sometimes be called
symbolic logic
because we use symbols like p or q to
stand for propositions. E.g., let p be the proposition “Today is Monday.”
Combining Propositions
.
Simple
or atomic
propositions may be combined
into compound propositions by use of
logical operators
.
Thus if p is a
proposition, then “it is not the case that p” is also a proposition and is
denoted as
¬
p (“not p”) and has the opposite truth value.
E.g. If “Today is Friday” = p then “Today is not Friday” is denoted by
¬
p.
Notp is a compound proposition. Clearly, if p is T, then
¬
p is F and if p is F
then
¬
p is T.
This may be expressed concisely in a TRUTH TABLE: A
truth table must take all
possibilities into account. Here there are two.
p
¬
p
T
F
F
T
This is similar to the negation operator in arithmetic or algebra, but logic is
much simpler. Its variables have only two possible value as opposed to the
infinitely many values of arithmetic.
Consider the statement:
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 WATKINS
 Computer Science, Logic, Logical connective, exclusive or

Click to edit the document details