0% found this document useful (0 votes)
30 views

Propositional Logic

Proposition notes

Uploaded by

rickylemar0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Propositional Logic

Proposition notes

Uploaded by

rickylemar0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

DISCRETE MATHEMATICS

By

Gershom Buri
Discrete vs Continuous
• Nature:
– Discrete Math: Deals with structures that are fundamentally discrete i.e.
separate e.g. when you role a dice, you can only get 1,2,3,4,5,6
– Continuous Math: Deals with structures that vary continuously e.g. when
you change the volume the radio or brightness of your phone, the value
could be anywhere between the max & min.
• Applications:
– Discrete Math: Widely used in computer science, cryptography, error
correction,
– Continuous Math: Essential in physics, engineering, biology (for modeling
continuous change or phenomenon)
• Why focus on Discrete Math in our case? Because at the core, computers are
binary systems, 0s and 1s.
Main Course Objective

• To learn how to make mathematical arguments.

• To learn various fundamental mathematical concepts


that are very useful to computer science
Chapter 1

Logic and Proofs


LOGIC
Introduction
• When we talk about logic, we are talking about logical
reasoning.
• Logical means correctly reasoned.
• In Mathematics this definition means that each step in an
argument must follow unambiguously from the preceding
steps, with no room for subjective judgment.
• In this way, we try to establish whether or not formal
statements are true, and to demonstrate interesting
consequences that follow.
Example of logical reasoning
• Premise 1: All humans are mortal
• Premise 2: Socrates is human
• Conclusion: Therefore, Socrates is mortal.
Vs (illogical)
• Premise 1: All humans are mortal
• Premise 2: Socrates is mortal
• Conclusion: Therefore, Socrates is human.
Other forms of reasoning
• illogical (most mosques use Luganda, therefore, all
Banganda are Muslims)
• emotional (my ex treated me badly, so all men are bad)
• intuitive (judging from how the sun moves across the
sky, the earth must be rotating around an axis)
• and magical thinking (if I wear this lucky bracelet I will
pass the exam).
1.1 Propositions
• A proposition is a declarative statement which is
either true or false
• It is our basic unit of mathematical “facts”.
• Examples of propositions
– a rat is a small cat
– Derrick is a pilot
– 102 = 99
– 37 is a prime number
• Examples of non-propositions (Why?)
– x > 10
– 1+2+ . . .+ 10
– This algorithm is fast
Propositions: Notation
• From the above we can see that the key feature of any
proposition is that it may either be true or false, but it is
not a matter of opinion.
• A proposition can be abbreviated by small letter.
• Example Derrick is a pilot can be denoted by p
• The truth value of a proposition is just a statement of
whether it is true or false.
• We write T for true and F for false.
Proposition cont’d
Quiz
• Classify the propositions below as true and false.
– Java was named after an island in Indonesia.
– The "U" in USB stands for Uganda.
– Moore's Law states that the speed of processors triples every
year.
– The domain suffix for Uganda is ".ug".
– Alan Turing, known as the father of computer science, was
born in the 20th century.
– Gen. Muhoozi will be the next president of Uganda
Proposition cont’d
Quiz
• Classify the propositions below as true and false.
– Java was named after an island in Indonesia. (T)
– The "U" in USB stands for Uganda. (F, universal serial bus)
– Moore's Law states that the speed of processors triples
every year. (F, that it doubles every year)
– The domain suffix for Uganda is ".ug". (T)
– Alan Turing, known as the father of computer science, was
born in the 20th century. (T, born in 1912)
– Gen. Muhoozi will be the next president of Uganda (A
proposition whose Truth value will be known in the future)
Proposition cont’d
Quiz
• State if the following statements are
propositions
1. Ice floats in water.
2. 2+2=4
3. Where are you going?
4. China is in Europe.
5. 2+2=5
6. Do your homework
7. x.0 = 0
Operations on Propositions
• Propositions by themselves are pretty boring.
• But we can build slightly more interesting propositions
by combining propositions together using various
logical operators (connectives), such as:
– Negation (NOT)
– OR
– AND
– exclusive or (XOR), etc.
Negation
• Negation is an opposite proposition.
• Consider an Example 1; if we let p stand for the
proposition ‘a rat is a small cat’.
• Then ‘a rat is not a small cat’ is a negation of
proposition p.
• To indicate the negation of a proposition p we
write not p; sometimes the symbols ~p or is
used.
Example 2
• If q is the proposition ‘there is life on Mars’
then the negation of q, ~q, is the proposition ‘
there is no life on Mars’
Conjunction and Disjunction
• “A rat is a small cat” and “Derrick is a pilot” is
called a conjunction of two propositions.
• The statement “A rat is a small cat” or “there is
life on Mars” is a disjunction of propositions.
• The conjunction of p and q is denoted by
p and q or
• The disjunction of p or q is denoted by p or q or
Rules for conjunction and disjunction
• For p and q to be true, both p must be true
and q must be true.

• For p or q to be true either p must be true or q


must be true, or both must be true.
Example
Let p be the proposition that ‘ the world has a
population of 8 billion people’ and q be the
proposition that ‘the population of the world
can fit onto the Kalangala Island’. Describe the
following propositions in English:
(a) p and q
(b) p or q
(c) not q
Connectives

• Connectives are symbols used to combine one


or more propositions into a compound
propositions. The main ones are the following
(as before p and q represent given
propositions):
Connectives Summary
Name Represented Meaning

Negation “not p”
Conjunction “p and q”
Disjunction “p or q or both”
Exclusive or “either p or q, but not
both”
Implication “if p then q”
Biconditional “p if and only if q”
Truth Tables
• The effect of logical operators can be
summarized using a truth table.
• Let p be a proposition and let us construct the
truth table for not p.
• Since p is a proposition, its possible truth
values are true (T) and false (F).
Truth Tables cont’d
• The truth table for not p has two rows to
correspond to the two possible truth values of
the proposition p:

p Not p
T F
F T
Truth Table for Compound Propositions

• Consider two propositions p and q.


• We shall give the truth tables for and and
for or.
• There are four possibilities for assigning
pairs of T or F to the pair of propositions p
and q.
Cont’d

p q p and q p q p or q
T T T T T T
T F F T F T
F T F F T T
F F F F F F

Example
Give the truth table for the compound proposition
(not p) or q
Solution
p q not p (not p) or q
T T F T
T F F F
F T T T
F T T T

Example
By using truth tables, show that
not (p and q) is equivalent to
(not p) or (not q)
Solution

p q p and q not (p and q) not p not q (not p) or (not q)


T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T

Since their corresponding columns are equal, not (p and


q) is equivalent to (not p) or (not q)
Exercise
• Generate the truth table for p XOR q
Tautologies
• Propositions like
– A student is either a woman or a man
– People either like rice or they don’t
• Are always true and are called tautologies.
Contradictions
• Propositions like
– Jackie is a girl and Jackie is a boy
– x is prime and x is an even integer greater than 6
• are always false, and are called contradictions.
Exercise
• Determine if the propositions below are a
tautology or a contradiction
– p or (not p)
– p and (not p)
Conditional Propositions (Implication)

• Are of the form if p then q such as


– If tomorrow is Saturday then today is Friday
– If x is a positive integer then x is greater than 0.
• A more concise mathematical notation is if p
then q or p implies q (p→q)
• The meaning of p → q is that q is true
whenever p is true
• it is the most important connective for proofs.
cont’d

• The proposition p → q is true provided


– p is false (in which case all bets are off), or
– q is true.

• Thus, p → q is always true except when p is


true and q is false
Introduction cont’d
• It might seem counterintuitive but it’s based on the idea that
a false statement does not provide us with any genuine info
about the truth of another statement e.g.
• Statement: "If it's raining, then the ground will be wet."
• If it's not raining (false statement), we don't have enough
information to say whether the ground is wet or not.
Someone might have watered the garden, or there could've
been a pipe leak.
Quiz
Which of the following propositions are true and which
are false?

i. “if 2 < 4 then Paris is in France”


ii. “if London is in Denmark then 2 < 4”
iii. “if 2 < 4 then London is in Denmark”
iv. “if 4 = 7 then London is in Denmark”
Truth Table for Conditional a proposition

p q
T T T
T F F
F T T
F F T
BICONDITIONAL PROPOSITION
● The proposition p ↔ q, read “If and only if” is
called biconditional.

● It is true precisely when p and q have the


same truth value i.e they are both true or both
false

11/6/2023 37
If and only if
• Suppose you say to one of your friends
– if I go to lectures then I will do well at discrete maths. (not
necessarily)
• whereas to another friend you say
– if I do well at discrete maths then I have gone to lectures. (a direct
effect, places more weight on importance of lecturers in relation to
achievement)
• When you put these 2 together, you are essentially saying
– I do well at discrete maths if and only if I go to lectures
• This is a bi-directional relationship: not only is attending
necessary, but if you excel, it is because of the attendance
• It is a stronger commitment than either of the individual
statements because it ties success and action together

11/6/2023 38
Example
Given the proposition ‘ I go to the
supermarket if and only if I have run out of
food.’
The above statement is the same as saying :
▪ ‘If I have run out of food then I go to the
supermarket, and if I go to the supermarket then I
have run out of food.’

11/6/2023 39
Soln
• The symbol for if and only if is
• The truth table for

p q
T T T
T F F
F T F
F F T

11/6/2023 40
Logical Equivalence
• When two compound propositions have the same truth values no matter
what truth value their constituent propositions have, they are
called logically equivalent.
• For instance and are logically equivalent (Quiz: Show it),
and we write it:

• Note that that two propositions A and B are logically equivalent

precisely when A ↔ B is a tautology.

11/6/2023 41
Exercise
Prove that p ↔ q is equivalent to p → q and q
→p

11/6/2023 42
Converse.

• The converse of a conditional proposition is the


proposition .
• As we have seen, the biconditional proposition is
equivalent to the conjunction of a conditional
proposition and its converse.

• So, for instance, saying that “John is married if and only if


he has a spouse” is the same as saying “if John is married
then he has a spouse” and “if he has a spouse then he is
married”.

11/6/2023 43
Contrapositive

• The contrapositive of a conditional proposition


is the proposition
• They are logically equivalent.
• For instance the contrapositive of “if Derrick is from
Nyamitanga then Derrick is from Mbarara” is “if Derrick
is not from Mbarara then Derrick is not from
Nyamitanga”.

11/6/2023 44

You might also like