Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
41 views

ACSC191 Lecture 02 - 6p - Introduction To Mathematical Logic

Logic has many applications in computer science such as in algorithm design and verification, logic circuit design, process specification, and logic programming. Propositions are basic building blocks of logic that can be either true or false. Logical connectives like conjunction and disjunction combine propositions to form compound propositions. Truth tables display the relationships between the truth values of propositions and their logical combinations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

ACSC191 Lecture 02 - 6p - Introduction To Mathematical Logic

Logic has many applications in computer science such as in algorithm design and verification, logic circuit design, process specification, and logic programming. Propositions are basic building blocks of logic that can be either true or false. Logical connectives like conjunction and disjunction combine propositions to form compound propositions. Truth tables display the relationships between the truth values of propositions and their logical combinations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Applications of Logic

ACSC191: Discrete Mathematics • Logic has many applications in computer


science:
– In the design and verification of algorithms
– In the design of logic and switching circuits
Lecture 2: Introduction to
– In the specification of processes
Mathematical Logic
– In the programming methodology called Logic
Programming

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.

Propositions Truth Tables


• Consider the following statement: • The information defined in the previous
– “John is Mary’s father.” slide can be easily described using a truth
table.
• Can this statement only be true or false?
P ¬P
T F
F T
• Is it then a proposition?
• A truth table displays the relationships
between the truth values of propositions.

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

Conjunction ‘and’ Disjunction ‘or’


• Symbol: ∧ • Symbol: ∨
• Example: • Example:
– P: I’m going to town – P: I’m going to town
– Q: It is going to rain – Q: It is going to rain
– P ∧ Q: I’m going to town and it is going to rain – P ∨ Q: I’m going to town or it is going to rain
• P ∧ Q is called the conjunction of P and Q. • P ∨ Q is called the disjunction of P and Q.
• When is the last proposition true? • When is the last proposition true?

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)

Exclusive or ‘xor’ Implication ‘if…then...’


• Symbol: ⊕ • Symbol: →
• Example: • Example:
– P: I’m going to town – P: I’m going to town
– Q: It is going to rain – Q: It is going to rain
– P ⊕ Q: Either I’m going to town or it is going – P → Q: If I’m going to town then it is going
to rain to rain
• P ⊕ Q is called the exclusive or of P and Q. • P → Q is called the implication of P and Q.
• When is the last proposition true? • When is the last proposition true?

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.

Implication ‘if…then...’ Exercise


• P → Q can be expressed in many ways: • Write down the truth values of the following
– If P, then Q – If P, Q propositions:
– P implies Q – Q follows from P i. (14 > 6) → (4 exactly divides 5)
– Q if P – Q when P ii. (it is February) → (a week has 7 days)
– P is sufficient for Q iii. ¬(14 > 6) → (4 exactly divides 5)
iv. ¬(it is February) → (a week has 7 days)
• Terminology
v. (14 > 6) → ¬(4 exactly divides 5)
– P = hypothesis, or premise, or antecedent
– Q = conclusion, or consequence

Implication ‘if…then...’ Implication ‘if…then...’


• A useful way to understand the truth value • More terminology:
of an implication is to think of an obligation  Q → P is the converse of P → Q
or a contract.  ¬Q → ¬P is the contrapositive of P → Q
• “If you get 100% on the final, then you will  ¬P → ¬Q is the inverse of P → Q
get an A.” • The contrapositive, ¬Q → ¬P, of P → Q has
– This can only be violated if you get 100% on the same truth values as P → Q.
the final.
• When two propositions always have the
– If not, then this will be true not matter what same truth value, we call them equivalent.
mark you get.

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

Exercise Biconditional ‘if and only if’


• P ↔ Q can also be expressed in the
• Find the converse, the contrapositive and
following ways:
the inverse of the following implication:
– P is necessary and sufficient for Q
– R: I will not go to town if its raining.
– If P then Q, and conversely
– P iff Q
• The last way uses the abbreviation ‘iff’ for
‘if and only if’.
• P ↔ Q is equivalent to (P → Q) ∧ (Q → P).

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)

Translating English Sentences Constructing a Truth Table


• Breaking a sentence into component propositions 1. One column for each propositional variable.
– Look for the logical operators! 2. Consider all possible combinations of the values
• Example: they can take (2n values for n variables) these are
the rows of the table.
– “If I go to John’s or go to the country, I will not go
3. One column for each compound proposition that
shopping.”
is itself a component proposition (starting with
• P: I go to John’s those that just have one operator, then those that
• Q: I go to the country have two, and so on).
• R: I will go shopping 4. One column for the final compound proposition.
– If P or Q, then not R 5. Calculate the truth values of all the compound
– (P ∨ Q) → ¬R propositions (starting from the simplest one).

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)

You might also like