Date post: | 11-Jan-2016 |
Category: |
Documents |
Upload: | helen-collins |
View: | 213 times |
Download: | 0 times |
www.company.com
Module Code MA1032N:Logic
Lecture Note Week 1
2013-2014 Autumn
www.company.com
Agenda• About this module:
– Your Module Leader– Your Lecturer and Tutor– Module syllabus and assessments
• Week 1 Lecture coverage:– Introduction to Logic– Operations on propositions – Truth Tables
www.company.com
Module Leaders’ Roles• Every module has two module leaders:
•Creates the main lecture/tutorial notes•Writes coursework and examinations•Moderates the coursework and examinations results•Serves as a lecturer for module (usually in London)
•Writes localised lecture/tutorial notes•Marks the coursework and examinations (lecturers/tutors might also be involved in marking)•Serves as a lecturer for that module
www.company.com
Your Lecturer
Email: [email protected]
Phone # 977 (1) 4420054
977(1) 4412929
Mr. Ashok Dhungana
(MSc IT, TU, Nepal)
www.company.com
Your Tutor is…
Mr. Ravi Jung Chettri BSc. IT London metropolitan University
www.company.com
Module Aims and Assessments
• Download the Module Specification from the LondonMet “Learning”
Web Portal or the Islington “CET” Web Portal
http://learning.londonmet.ac.uk/computing/IC_Link/
http://cet.islingtoncollege.edu.np
www.company.com
Module Syllabus Summary•Logic: Representation of simple verbal arguments; truth-tables; logical
equivalence, validity and consequence; resolution proof method;
logic circuits and Karnaugh maps. Predicate logic.
•Sets: Introduction to notation; set operations; Venn diagrams; universal,
empty and subsets; set identities (De Morgan etc); duality; power
sets, ordered pairs and Cartesian products.
•Relations: Representations of relations; equivalence relations;
partitions; partial orderings.
www.company.com
Module Syllabus Summary (Cont.)
•Functions: Ways of defining functions; composition; inverse functions.
•Proof methods: Proofs by contradiction and induction.
•Natural numbers: Number bases; two’s complement representation.
www.company.com
Module Assessment Summary
Assessments1. Workbooks: (50% of total module marks)
Homework's consisting of selected exercises.
2. Two Class tests: (50% of total module marks)Week 6(25%) and Week 11(25%)One hour 15 minutes closed book class test.
MUST “PASS” ALL THREE ASSESSMENTS TO PASS THE MODULE AND ACHIEVE AT LEAST 40% OF MARKS IN AGGREGATE.
www.company.com
Text books
1. P. Grossman, Discrete Mathematics for Computing (2nd edition), Macmillan, 2002.
2. A. Simpson, Discrete Mathematics by Examples, McGraw Hill, 2002.
www.company.com
Chapter 1 Logic and the Algebra of Proposition
• Logic- study of principles of reasoning.
Example:
Hari is a human.
All humans have brain.
Therefore, Hari has a brain.
Hence, logical reasoning concludes based on certain statements.
The fundamental objects in logic are propositions.
www.company.com
Proposition
Proposition
- is a statement that is either true or false.
- is a building block of logic.
For example:
1. Kathmandu is a city.
2. Java is a programming language.
3. Paper is made of glass.
www.company.com
A proposition is either true or false but not both.
Examples 1 and 2 are true but 3 is false.
• True(T) or False(F) is called the truth value of the proposition
Proposition (cont.)
www.company.com
Proposition (cont.)
• Sentences that are “Questions”, “Commands” and “Opinions” are not valid propositions because they will/may not have a true or false value.
• Examples:
• 1. How old are you?• 2. Go to School.• 3. He is tall.
www.company.com
Proposition (cont.)
Some examples of valid propositions
1. Kathmandu is the capital of Nepal.
2. There are 8 days in a week.
3. Isaac Newton was born in 1642.
4. 5 is greater than 7.
www.company.com
Proposition Notation
Proposition is represented by lower case letters for example: p, q, r, ……, to denote propositional variables.
Example:
p = Java is an object-oriented language.
Meaning
p represents the proposition “Java is an object-oriented language”
www.company.com
Primitive and compound propositions
p: Kathmandu is in either Nepal or UK.
This proposition is made up of two simpler propositions.
q: Kathmandu is in Nepal.
r: Kathmandu is in UK.
Joined together by the word “or”
www.company.com
Primitive and compound propositions (cont.)
Propositions q and r cannot themselves be broken down into simpler ones. Such propositions are called primitive.
In the above example “p” is combination of two propositions called compound proposition.
In the above example, compound proposition is connected by “or” which is called connective.
www.company.com
Operations on propositions
Three operations on prepositions are:
1. Conjunction/ AND
2. Disjunction/OR and
3. Negation/NOT/Complement
www.company.com
ConjunctionConjunction of two propositions:
Let p and q be given propositions.
The proposition “p and q” is called the conjunction of the given propositions. It is written p ∧ q and read as “p and q”.
p ∧ q is true if both propositions p and q are true, otherwise p ∧ q is false.
www.company.com
Conjunction (Cont.)
Example.
p: Kathmandu is the capital of Nepal.
q: Delhi is the capital of India.
p and q: Kathmandu is the capital of Nepal and Delhi is the capital of India.
p ∧ q is called the conjunction of two propositions.
The word “and” which links the two propositions is called a logical connective.
www.company.com
DisjunctionDisjunction of two Propositions
Let p and q be given propositions.
The proposition “p or q” is called the disjunction of the given propositions. It is written p ∨ q and read “p or q”.
p ∨ q is true if either p is true or q is true or both p and q are true, otherwise p ∨ q is false.
www.company.com
Disjunction (Cont.)
Example
p: Kathmandu is the capital of Nepal.
q: Delhi is the capital of China.
p or q: Kathmandu is the capital of Nepal or Delhi is the capital of China.
p ∨ q is called the disjunction of the two propositions
p and q.
www.company.com
Negation
Let p be any proposition.
The proposition “not p” or “it is not true that p” is called the negation of p.
It is written ¬ p and read “not p”.
www.company.com
Negation (Cont.)
Example
p: Kathmandu is the capital of Nepal.
¬ p: Kathmandu is not the capital of Nepal.
Here p is true but ¬ p is false
www.company.com
Notes on operators
1. Negation is a unary operator.
2. Conjunction is a binary operator.
3. Disjunction is also a binary operator.
www.company.com
Examples
Consider the following propositions
p is F, q is T, r is T and s is F. Using the definitions of , ∧ ∨ and ¬. Find the truth value for the following:1. p ∧ ¬q is
2. q V ¬r is
3. ¬s V q isAnswers:
1. F
2. T
3. T
www.company.com
Note “and”, “or” and “¬” are referred to as connectives. In formal logic, even if there is no relationship between the
primitive propositions, it will make up a compound proposition.
Example: if p : 3 + 6 = 5 and q : Delhi is the capital of Nepal then
p ∧ q : 3 + 6 = 5 and Delhi is the capital of Nepal
p V ¬ q : 3 + 6 = 5 or Delhi is not the capital of Nepal
are both valid propositions. They evaluate to “F” and “T” respectively.
www.company.com
Compound Propositions
A compound proposition is an expression P(p, q, r, ...), which consists of propositional variables p, q, r, ... joined together by the logical connectives ∧, V and ¬.
The propositional variables p, q, ... are sometimes called the arguments of P.
www.company.com
Use of Brackets
When there are more than one logical connectives, their operation can be determined by using braces.
For example:
(p ∨ q) ∧ r means first evaluate w = (p ∨ q) and then evaluate w ∧ r.
www.company.com
Examplep: Kathmandu is the capital of Nepal. T
q: Delhi is the capital of China. F
r: Tokyo is the capital of Pakistan. F
Then (p ∨ q) ∧ r is false but p ∨ (q ∧ r) is true.
www.company.com
Rules To minimize the number of brackets in expressions
we will adopt the following order of precedence in which connectives are applied.
1. Apply connectives within brackets first.
2. The ¬ connective next.
3. “and” and “or”. Using this convention ¬ p∧q will mean
(¬ p) ∧ q rather than ¬ (p ∧ q)
www.company.com
Truth Tables Truth Tables represents the truth or falsity of
logical statements.
Example:
The above is the truth table for negation.
p ¬ pT FF T
www.company.com
Truth Tables (cont.)
From the example, it is noted that
- all the possible values of p are listed in the left-hand column, and
- the results are displayed in the right column.
www.company.com
Truth Tables (cont.)
Similarly,
Truth table for conjunction:
p q p q∧T T TT F FF T FF F F
www.company.com
Truth Tables (cont.)
Similarly,
Truth table for disjunction:
p q p q∨T T TT F TF T TF F F
www.company.com
Truth Tables (cont.)
Note:
1. Truth table provides an equivalent definition for the propositions ¬ p, p q, and p q. ∧ ∨
2. The truth table for a proposition with n atomic propositions will have 2n rows.
www.company.com
Truth Tables (cont.)
Example: P(p,q,r)= p (q r)∧ ∨
p q r q r∨ p (q r)∧ ∨
T T T T T
T T F T T
T F T T T
T F F F F
F T T T F
F T F T F
F F T T F
F F F F F
Note:1. Column q r is not ∨part of Truth Table.
www.company.com
Exercise
1. Which of the following are propositions?a. How tall are you?
b. 2+8=11
c. X+3=4
d. Come here.
e. Mercury is the closest planet to earth.
f. x2 – 16 = 0 has two solutions.
g. It is sunny.
h. My name is Bicky.
www.company.com
Exercise
2. Assume that
p represents the statement “ Hari is happy” and q represents the statement “Ram is in pain”. Write natural language statements (English sentences) for each of the following propositions:
a. ¬ p b. p q c. p ¬ q d. p q ∧ ∨ ∨e. q ¬ p ∨
www.company.com
Exercise
3. Let p: Hari speaks Nepali. q: Hari speaks English. r: Ram speaks Nepali.
s: Ram speaks EnglishExpress the following English sentences as compound propositions using p, q, r and s and the operators , ∧
∨ and ¬.
a) Hari speaks Nepali and English.
b) Hari and Ram speak English.
c) Ram doesn‟t speak either Nepali or English.
d) Ram speaks Nepali but Hari doesn‟t.
www.company.com
Exercise
4. Express the proposition “Either my program runs and it contains no bugs, or my program contains bugs” in symbolic form.
5. Given that propositions p, q and r have truth values T, F, T respectively, find the truth values of a) p (q r) ∧ ∨b) (p q) r ∧ ∨c) ¬ p q ∧d) ¬(p q)∧
www.company.com
Exercise
6. What is the truth value of each of the following propositions?
a) 2 is even and 3 is even.
b) 2 is even or 3 is even.
c) 2 is even or 3 is odd.
d) 2 is not even or 3 is even.
e) (1<0) (2<1)∨f) (0<1) (2<1)∨g) p (false q)∧ ∧
www.company.com
Exercise
7. Write down the truth table for
a. p (¬q)∧b. (¬p) (¬q)∧c. ¬(p q)∧d. p (q r)∧ ∨e. (p q) r ∧ ∨f. ¬ p q∧g. p (false q)∧ ∧
www.company.com
Exercise
8. How many rows will the truth table for the proposition p (q r) have?∧ ∨