ACSC191 Lecture 02 - 6p - Introduction To Mathematical Logic
ACSC191 Lecture 02 - 6p - Introduction To Mathematical Logic
Logic Propositions
• Logic consists of a set of rules for drawing • Propositions form the basic building blocks of
logic.
inferences.
• A proposition is a statement which can either be
• We assume that certain statements, called true or false.
axioms, are true and we have a set of rules • For example:
for proving consequences of these axioms. – “ACSC101 is a computer science course at Frederic”
– “A comes before B in the English alphabet”
– “99 > 6”
are all propositions because they can only be true
or false.
Logic Propositions
• For example we could have the axioms: • A proposition which is true is said to have truth
Henry VIII was the father of Elizabeth I value true (or T, or 1).
• A false proposition is said to have truth value false
Mary Rose was the sister of Henry VIII (or F, of 0).
• And the rule: • All the propositions in the previous slide have
If (A was the father of B) and truth value true.
(C was the sister of A) then • Whereas the propositions
(C was the aunt of B). – “A does not come before B in the English alphabet”
– “4 exactly divides 26”
• Using these rules and axioms we can deduce that
both have truth value false.
Mary Rose was the aunt of Elizabeth I.
1
Propositions Exercise
• There are statements which are either true or false, • Write down the truth values of the following
but we don’t know which. propositions:
• For example: i. “5 is an even number”
– “There are life forms outside of earth’s solar system.” ii. “Yellow is a primary colour”
– “Next week it will be snowing in Nicosia.” iii. “Software systems can go wrong”
• These are both perfectly valid propositions. iv. “All lectures are interesting”
• We use logic to determine consequences of v. “5 is not an even number”
axioms. We do not prove that the axioms are true, vi. “Yellow is not a primary colour”
but if they are, then so are the consequences. vii. “Software systems can not go wrong”
viii.“Not all lectures are very interesting”
Propositions Negation
• Some sentences are not propositions because they • What do you notice from the propositions in the
are not declarative. For example: previous slide?
– “What time is it?” • Whenever a proposition is true, the opposite
– “I wish I were wise.” proposition is false, and whenever a proposition is
false, the opposite proposition is true.
• There are declarative sentences that are not
• Logic provides us with the operator ¬ called not,
propositions because they cannot have a truth
which can be used to denote the opposite, or
value. For example: negation, of any given proposition.
– “This sentence is false.”
• So for any proposition P, the truth value of ¬P is
• The above sentence is called a paradox. the opposite of the truth value of P.
2
Connectives Conjunction ‘and’
• We can join propositions together to get • P ∧ Q is true if both P and Q are true, and
new propositions, called compound false otherwise.
propositions.
P Q P∧Q
• For example:
– “Today is Monday and 5 > 3.”
T T T
is a compound proposition made up of two T F F
simple propositions glued together with the F T F
word ‘and’. F F F
Connectives Exercise
• There is a set of logical operators, called • Write down the truth values of the following
connectives, which can be used to construct propositions:
new propositions from existing ones. – (14 > 6) ∧ (4 exactly divides 5)
• The operations defined by these connectives – (it is February) and (a week has 7 days)
are called: – ¬(14 > 6) ∧ (4 exactly divides 5)
– conjunction – disjunction – ¬(it is February) ∧ (a week has 7 days)
– exclusive or – implication – (14 > 6) ∧ ¬(4 exactly divides 5)
– biconditional
3
Disjunction ‘or’ Exclusive or ‘xor’
• P ∨ Q is true if either P or Q is true, and • P ⊕ Q is true if only one of P and Q is true,
false otherwise. and false otherwise.
P Q P∨Q P Q P⊕Q
T T T T T F
T F T T F T
F T T F T T
F F F F F F
Exercise Exercise
• Write down the truth values of the following • Write down the truth values of the following
propositions: propositions:
– (14 > 6) ∨ (4 exactly divides 5) – (14 > 6) ⊕ (4 exactly divides 5)
– (it is February) or (a week has 7 days) – (it is February) xor (a week has 7 days)
– ¬(14 > 6) ∨ (4 exactly divides 5) – ¬(14 > 6) ⊕ (4 exactly divides 5)
– ¬(it is February) ∨ (a week has 7 days) – ¬(it is February) ⊕ (a week has 7 days)
– (14 > 6) ∨ ¬(4 exactly divides 5) – (14 > 6) ⊕ ¬(4 exactly divides 5)
4
Implication ‘if…then...’ Implication ‘if…then...’
• P → Q is false only when P is true and Q is • Our definition of implications:
false, and true in all other cases. – “If today is Friday, then 2 + 3 = 5.”
• True, since its conclusion is true.
P Q P→Q – “If today is Friday, then 2 + 3 = 6.”
• True, every day except Friday, even though
T T T 2 + 3 = 6 is false.
T F F • Implications used in natural language:
F T T – “If it is sunny, then we will go to the beach”
• Relationship between hypothesis and conclusion
F F T
• Our definition is more general.
5
Implication ‘if…then...’ Biconditional ‘if and only if’
• So an implication and its contrapositive are • P ↔ Q is true if both P and Q have the same
equivalent. truth value, and opposite otherwise.
• The converse, Q → P, and the inverse,
P Q P↔Q
¬P → ¬Q, of an implication P → Q are also
equivalent. T T T
• However, an implication, P → Q, is not T F F
equivalent to either its converse, Q → P, or F T F
its inverse, ¬P → ¬Q. F F T
Biconditional ‘if and only if’ Biconditional ‘if and only if’
• Symbol: ↔ • Our definition of biconditionals:
• Example: – “You can have desert if and only if you finish
– P: I’m going to town your meal”.
– Q: It is going to rain • Biconditionals in natural language:
– P ↔ Q: I’m going to town if and only if it is – “If you finish your meal, then you can have
going to rain desert”.
• P ↔ Q is called the biconditional of P and Q. – “You can have desert, only if you finish your
meal”.
• When is the last proposition true?
• Natural language is imprecise.
6
Exercise Exercise
• Write down the truth values of the following • Let P and Q be the propositions:
propositions: – P: I bought a lottery ticket this week
i. (14 > 6) ↔ (4 exactly divides 5) – Q: I won the million pound jackpot on Friday
ii. (it is February) ↔ (a week has 7 days)
Express each of these propositions as an
iii. ¬(14 > 6) ↔ (4 exactly divides 5) English sentence:
iv. ¬(it is February) ↔ (a week has 7 days)
–P∧Q –P∨Q –P→Q
v. (14 > 6) ↔ ¬(4 exactly divides 5)
–P↔Q – ¬P → ¬Q – ¬P ∧ ¬Q
– ¬P ∧ (P ∨ ¬Q)
Example: (P ∨ Q) → ¬R
Exercise
P Q R ¬R P∨Q (P ∨ Q) → ¬R
• Translate the following English sentences into
T T T F T F
mathematical propositions:
i. “It is either below freezing or it is snowing.” T T F T T T
ii. “If you have the flu, you will miss the final T F T F T F
examination and you will not pass the course.”
iii. “Getting an A on the final exam and doing every
T F F T T T
exercise in this book is sufficient for getting an A in F T T F T F
this class.”
iv. “You can see the wizard when it is raining or it is
F T F T T T
Thursday.” F F T F F T
F F F T F T
7
Exercise
• Construct truth tables for the following
propositions:
i. (P ∨ Q) ∧ (P → Q)
ii. (P ∧ ¬Q) ∨ (¬P ∧ Q)
iii. (P ∨ Q) ∨ (P ↔ R)
iv. ((P ∧ Q) ∨ ¬R) → P
Categories of Propositions
• A tautology is a proposition which is
always true.
– Classic example: P ∨ ¬P
• A contradiction is a proposition which is
always false.
– Classic example: P ∧ ¬P
• A contingency is a proposition which is
neither a tautology nor a contradiction.
– Example: (P ∨ Q) → ¬R
Exercise
• Using truth tables, decide whether each of
the following is a tautology, a
contradiction, or a contingency:
i. P
ii. P→P
iii. P → ¬P
iv. (P ∨ ¬R) ∧ ¬(P ∨ ¬R)
v. (P → Q) ↔ (¬P ∨ Q)