Propositional Logic
Introduction
Discrete Mathematics
Andrei Bulatov
Discrete Mathematics – Propositional Logic 2-2
What is Logic?
“Computer science is a mere continuation of logic by other means”
Georg Gottlob
“Contrariwise”, continued Tweedledee, “if it was so, it might be; and if it
were so, it would be; but as it isn’t, it ain’t. That’s logic”
Lewis Carroll, Through the Looking Glass
Discrete Mathematics – Propositional Logic 2-3
Use of Logic
In mathematics and rhetoric:
Give precise meaning to statements.
Distinguish between valid and invalid arguments.
Provide rules of `correct’ reasoning.
Natural language can be very ambiguous
`If you do your homework, then you’ll get to watch the game.’
≈
`If you don’t do your homework, then you will not get to watch ...’
`You do your homework, or you’ll fail the exam.’
=
`If you don’t do your homework, then you’ll fail the exam.’
Discrete Mathematics – Propositional Logic 2-4
Use of Logic (cntd)
In computing:
Derive new data / knowledge from existing facts
Design of computer circuits.
Construction of computer programs.
Verification of correctness of programs and circuit design.
Specification
What the customer How the Programmer What the customer
really needed understood it got
Discrete Mathematics – Propositional Logic 2-5
Propositions (Statements)
Propositional logic deals with propositions (statements) and their
truth values
A proposition (statement) is a declarative sentence that can be
true or false
Truth values are TRUTH (T or 1) and FALSE (F or 0).
Examples:
- 1 + 1 = 2 (proposition, T)
- The moon is made of cheese (proposition, F)
- Go home! (not proposition, imperative)
- What a beautiful garden! (not proposition, exclamation)
- y+1=2 (not proposition, uncertain)
- The God exists (proposition, ?)
Discrete Mathematics – Propositional Logic 2-6
Compound Propositions
Simplest propositions are called primitive propositions
We shall use propositional variables to denote primitive
propositions, p, q, r, …
We cannot decide the truth value of a primitive propositions. This
is not what logic does.
Instead we combine primitive propositions by means of logic
connectives into compound propositions or formulas and
look how the truth value of a compound proposition depends on the
truth values of the primitive propositions it includes.
We will denote compound propositions by Φ, Ψ, …
Discrete Mathematics – Propositional Logic 2-7
Logic Connectives
negation (not, ¬ ) `It is not true that at least one politician was
honest’
conjunction (and, ∧ ) `In this room there is a lady, and in the other
room there is a tiger’
disjunction (or, ∨ ) `Margaret Mitchell wrote `Gone with the Wind
or I am going home’
implication (if…, then…, → ) `If there is a tiger in this room, then
there is no lady there’
exclusive or (either …, or …, ⊕ ) `There is either a tiger in this
room, or a lady’
biconditional (equivalence) (if and only if, ↔ )
`There is a lady in this room if and only if
there is a tiger in the other room’
Discrete Mathematics – Propositional Logic 2-8
Truth Tables
Truth table is a way to specify the exact dependence of the truth value
of a compound proposition through the values of primitive propositions
involved truth values of primitive propositions
(propositional variables) truth value of compound propositions
(formulas)
p q Φ
0 0 0
0 1 1
… … …
Discrete Mathematics – Propositional Logic 2-9
Truth Tables of Connectives (Negation and Conjunction)
Negation p ¬p unary connective
F (0) T (1) `Today is Friday’
`Today is not Friday’
T (1) F (0)
Conjunction binary
p q p∧q
connective
0 0 0 `Today is Friday’
`It is raining’
0 1 0
1 0 0 `Today is Friday and it
is raining’
1 1 1
Discrete Mathematics – Propositional Logic 2-10
Truth Tables of Connectives (Disjunction)
Disjunction – inclusive `or’
`Students who have taken calculus
p q p∨q can take this course’
`Students who have taken computing
0 0 0 can take this course’
0 1 1 `Students who have taken calculus
or computing can take this course’
1 0 1
1 1 1
Be careful with `or’ constructions in natural languages!
`You do your homework, or you’ll fail the exam.’
`Today is Friday or Saturday’
Discrete Mathematics – Propositional Logic 2-11
Truth Tables of Connectives (Exclusive or)
Exclusive `or’
One of the propositions is true but not both
p q p⊕q
0 0 0
0 1 1
1 0 1
1 1 0
`You can follow the rules or be disqualified.’
`Natalie will arrive today or Natalie will not arrive at all.’
Discrete Mathematics – Propositional Logic 2-12
Truth Tables of Connectives (Implication)
Implication
p q p→q
0 0 1
0 1 1
1 0 0
1 1 1
Note that logical (material) implication does not assume any
causal connection.
`If black is white, then we live in Antarctic.’
‘If pigs fly, then Paris is in France.’
Discrete Mathematics – Propositional Logic 2-13
Implication as a Promise
Implication can be thought of as a promise, and it is true if the
promise is kept
`If I am elected, then I will lower taxes’
- He is not elected and taxes are not lowered promise kept!
- He is not elected and taxes are lowered promise kept!
- He is elected, but (=and) taxes are not lowered promise broken!
- He is elected and taxes are lowered promise kept!
Discrete Mathematics – Propositional Logic 2-14
Playing with Implication
Parts of implication
p → q
hypothesis conclusion
antecedent consequence
premise
`if p, then q’ `q unless ¬p’ `a sufficient con-
`if p, q’ `p implies q’ dition for q is p’
`p is sufficient for q’ `p only if q’ `a necessary con-
`q if p’ `q whenever p’ dition for p is q’
`q when p’ `q follows from p’
Discrete Mathematics – Propositional Logic 2-15
Playing with Implication (cntd)
Converse, contrapositive, and inverse
p → q `The home team wins whenever it is raining’
(`If it is raining then the home team wins’)
Converse q → p
`If the home team wins, then it is raining’
Contrapositive ¬q → ¬p
`If the home team does not win, then it is not raining’
Inverse ¬p → ¬q
`If it is not raining, then the home team does not win’
Discrete Mathematics – Propositional Logic 2-16
Truth Tables of Connectives (Biconditional)
Biconditional or Equivalence
One of the propositions is true if and only if the other is true
p q p↔q
0 0 1
0 1 0
1 0 0
1 1 1
`You can take the flight if and only if you buy a ticket.’
Discrete Mathematics – Propositional Logic 2-17
Example
`You can access the Internet from campus if you are a computer
science major or if you are not a freshman.’
p - `you can access the Internet from campus’
q - `you are a computer science major’
r - `you are a freshman’
Discrete Mathematics – Propositional Logic 2-18
Homework
Exercises from the Book:
No. 1 ,2, 13, 31(c), 32(b,d), 37(a) (page 13)