Lecture 1
Lecture 1
Lecture 1
Class Conducted by
Bibek Ropakheti
Associate Professor : Cosmos College of Management and Technology
Visiting Faculty : NCIT
May 2020
Chapter 1
Logic, Induction and Reasoning
Chapter Outline
• Proposition and Truth function • Proofs
• Propositional Logic • Informal Proofs
• Formal Proofs
• Expressing statements in Logic
Propositional Logic • Elementary Induction
• The predicate Logic • Complete Induction
• Validity • Methods of Tableaux
• Informal Deduction in Predicate • Consistency and Completeness
Logic of the System
• Rules of Inference
Today
• Logic and Proof
• Proposition and Truth function
• Propositional Logic
• Expressing statements in Logic Propositional Logic
Logic
• Study of reasoning
• Specify the meaning of mathematical statements
• Basis of all mathematical reasoning
• Basis of all automated reasoning
• Practical application to the design of computing machines
• To specification of systems, AI, Programming, Programming languages
and other areas of computer science as well as other fields
Logic
• Concerned with whether the reasoning is correct
• It focuses on the relationship among the statements as opposed to
the content of any particular statement
• Example:
• All Nepali love politics
• Anyone who loves politics is an politician
• Hence, all Nepali are politician
• Logic doesn’t help in determining if the statements are true
• However if the first two statements are true, logic helps to generalize
Proof
• What makes up a correct mathematical argument
• Once we prove a mathematical statement, its theorem
• Demonstration of theorem being true is also proof
• Used in computer programming to show the output of the given set
of inputs and execution of algorithm
• Automated reasoning systems have been created to allow computers
to construct their own proof
Proposition
• A sentence that is either true or false but not both is a proposition
• Let us examine if the given statements are proposition or not
1. The only positive integer that divide 2 are 1 and 2 itself.
2. Mahabir Pun won Magsaysay award in 2007.
3. The sum of 2 and 3 is 6.
4. Hetauda is the capital of Bagmati province.
5. What is your name?
6. The difference between x and y is z.
7. Raju, please go to the library.
8. Its warm day today 31st May 2020 at Kathmandu.
Propositions
• Building blocks of logic
• Declarative sentence
• Declares the fact
• Propositions are either true or false at any instance
• But not both
• In previous slide, statement 1-4 are propositions as 1, 2 and 4 are
always true and 3 is always false
• In previous slide, statement 5-7 are not propositions
Propositional Variables and Truth Value
• Letters are used to denote propositional variables
• A variable represent a proposition just as letters used to denote
numerical variables
• The truth value of a proposition is true, denoted by T, if the
proposition is true
• The truth value of a proposition is false, denoted by F, if the
proposition is false
• Conventional letters are used for propositional variables like p, q, r…
Propositional Calculus
• The area of logic
• Deals with proposition
• Also called Propositional Logic
Compound Proposition
• The law of thoughts discussed the methods for producing new
propositions from the existing ones
• Mathematical statements are constructed by combining one or more
propositions
• New propositions are called compound propositions
• Formed from existing propositions using logical operators
Logical Operators
• Negation
• Conjunction
• Disjunction
• Exclusive OR
• Conditional Statements
• Converse, Contrapositive and Inverse
• Biconditional Statements
Negation
• Let P be a proposition
• The negation of P denoted by ¬P(~P 0r |P) is the statement “It is not
the case that P”
• The proposition ¬P is read “not P”
• The truth value of ¬P is opposite of the truth value of P
• Example:
• P: Today is Sunday
• ¬P: Today is not Sunday
• ¬P will be true on all other days than Sunday
Negation – Truth Table
P ¬P
T F
F T
Conjunction
• Let P and Q be propositions
• The conjunction of P and Q is denoted by P∧Q
• P∧Q is the proposition “P and Q”
• The proposition P∧Q is true when both P and Q are true and false
otherwise
Conjunction – Example and Truth Table
P Q P∧Q • Let
• P: Today is Sunday
T T T •
•
Q: Today is Sunny
P∧Q: Today is Sunny and Sunday
T F F • P∧Q will be true on Sunny Sundays
and false on non Sundays or non
Sunny days
F T F
F F F
Disjunction
• Let P and Q be propositions
• The disjunction of P and Q is denoted by P∨Q
• P∨Q is the proposition “P or Q”
• The proposition P∨Q is true when either P or Q is true and false when
both P and Q are false
Disjunction – Example and Truth Table
P Q P∨Q • Let
• P: Today is Sunday
T T T •
•
Q: Today is Sunny
P∨Q : Today is Sunny or Sunday
T F T • P∨Q will be true on any Sunday or
any day that is Sunny
F T T
F F F
Exclusive OR
• Let P and Q be propositions
• The exclusive or of P and Q is denoted by P⊕Q
• P⊕Q is the proposition “P exclusive or Q”
• The proposition P⊕Q is true when exactly one of P and Q is true
otherwise false
Exclusive OR – Example and Truth Table
P Q P⊕Q • Let
• P: Today is Sunday
T T F • Q: Today is Sunny
• P⊕Q will be true on any Sunday
which is not sunny or any sunny
T F T day that is not Sunday
F T T
F F F
Conditional Statements
• Let P and Q be propositions
• The conditional statement PàQ is the proposition “if P then Q”
• The conditional statement PàQ is false when P is true and Q is false,
and is true otherwise
• In conditional statement PàQ, P is called hypothesis (premise or
antecedent) and Q is called conclusion or consequence
Conditional Statement - Example and Truth Table
• Let
P Q PàQ • P: You get 100% on the exam
• Q: You get an A
T T T • PàQ: If you get 100% on the
exam, then you will get an A
T F F • If you do not get 100%, you may
get an A Or you may not get an A,
which depends on other factors
F T T • There wont be problem if you get
100% and an A
F F T • If 100% is scored but you do not
get an A then you may feel
disappointed
Conditional Statements: Clauses
“if p, then q” “p implies q”
“if p, q” “p only if q”
“p is sufficient for q” “a sufficient condition for q is p”
“q if p” “q whenever p”
“q when p” “q is necessary for p”
“a necessary condition for p is q” “q follows from p”
“q unless ¬p”
PàQ
Converse, Contrapositive and Inverse
• For a proposition PàQ, its
• Converse is QàP,
• Contrapositive is ¬Qà ¬P, and
• Inverse is ¬Pà¬Q
P Q P↔Q • Let
• P: You can take the flight
T T T • Q: You buy a ]cket
• P↔Q : You can take the flight if
and only if you buy a ]cket
T F F
F T F
F F T
Biconditional Statements: Clauses
• “p is necessary and sufficient for q”
• “if p then q, and conversely”
• “p iff q”
• “p if and only if q”
Precedence of Logical Operators
1. ¬
2. ∧
3. ∨
4. à
5. ↔
Truth table of Compound Propositions
• Construct the truth table of compound proposition (P∨¬Q)à(P∧Q)
• Xà(Y∨Z)
• Q=(Y ∨Z)
• XàQ
Application
• Boolean Searches
• Logic Puzzles
• Logic Circuits
Practice
• Construct truth table for
• ¬(p∧q)∨(r∧¬p)
• (p∨¬r)∧¬((q∨r)∨¬(r∨p) )
• Translate into mathematical expression
• You can’t have voting right if you are mentally unfit and you are not over 18
years.
• Leaders will make correct decision only if you choose a good leader or you
raise your voice against incorrect decision
(p∨¬r)∧¬((q∨r)∨¬(r∨p) )
P Q R ¬R (p∨¬r) (q∨r) (r∨p) ¬(r∨p) (q∨r)∨¬(r∨p) ¬((q∨r)∨¬(r∨p) ) (p∨¬r)∧¬((q∨r)∨¬(r∨p) )
T T T F T T T F T F F
T T F T T T T F T F F
T F T F T T T F T F F
T F F T T F T F F T T
F T T F F T T F T F F
F T F T T T F T T F F
F F T F F T T F T F F
F F F T T F F T T F F
Answer
• Construct truth table for
• ¬(p∧q)∨(r∧¬p)
• (p∨¬r)∧¬((q∨r)∨¬(r∨p)
• Translate into mathematical expression
• You can’t have voting right if you are mentally unfit and you are not over 18 years.
• IF (you are mentally unfit and You are not over 18 years) then (you have no voting rights)
• A: You are mentally unfit
• B: You are over 18 years
• C: You can have voting right
• (A^~B)à~C
• Leaders will make correct decision only if you choose a good leader or you raise your
voice against incorrect decision
• P à (QVR)
Assignment 1
• Pg 12
• Q 1-11, 17-24, 27-35
Reference Books
• Keneth Rosen, Discrete Mathematical Structures with Applications to
Computer Science, WCB/ McGraw Hill
• G. Birkhoff, T.C. Bartee, Modern Applied Algebra, CBS Publishers.
• R. Johnsonbaugh, Discrete Mathematics, Prentice Hall Inc.
• G.Chartand, B.R.Oller Mann, Applied and Algorithmic Graph Theory,
McGraw Hill
• Joe L. Mott, Abrahan Kandel, and Theodore P. Baker, Discrete
Mathematics for Computer Scientists and Mathematicians, Prentice-
Hall of India
Let us Discuss
Any Issues?
Thank You