You are on page 1of 62

Proposition:

Definition: A proposition (denoted p, q, r, …) is simply:


 a statement (i.e., a declarative sentence) with some definite meaning,

(not vague or ambiguous)


 having a truth value that’s either true (T) or false (F) it is never both,

neither, or somewhere “in between!” (or in terms of 1 and 0)

Examples:

• It is raining (In a given situation)


• Delhi is the capital of India. (T)
• 2 + 2 = 5. (F)
• 1 + 2 = 3. (T)
A fact-based declaration is a proposition, even if no one knows whether it is

true
 11213 is prime.

 There exists an odd perfect number.

Examples of Non-Proposition

The following are NOT propositions:


 Who’s there? (interrogative, question)

 Just do it! (imperative, command)

 La la la la la. (meaningless interjection)

 Yeah, I sorta, dunno, whatever... (vague)

 1 + 2 (expression with a non-true/false value)

 x + 2 = 5 (declaration about semantic tokens of non-constant value)


Truth Tables
 An operator or connective combines one or more operand expressions into a larger
expression.
 (e.g., “+” in numeric expressions.)

 Unary operators take one operand (e.g., −3);


Binary operators take two operands (e.g. 3 + 4).
 Propositional or Boolean operators operate on propositions instead of on
numbers.
 The Boolean domain is the set {T, F}. Either of its elements is called a Boolean
value.
An n-tuple (p1,…,pn) of Boolean values is called a Boolean n-tuple.
 An n-operand truth table is a table that assigns a Boolean value to the set of all
Boolean n-tuples.
Some Popular Boolean Operators

Formal Name Nickname Arity Symbol

Negation operator NOT Unary ¬

Conjunction operator AND Binary 


Disjunction operator OR Binary 
Exclusive-OR operator XOR Binary 
Implication operator IMPLIES Binary 
Biconditional operator IFF Binary ↔
The Negation Operator
 The unary negation operator “¬” (NOT) transforms a proposition into
its logical negation.
 E.g. If p = “I have brown hair.”
then ¬p = “It is not the case that I have brown hair” or “I do not
have brown hair.”
 The truth table for NOT:
p p
T F
F
T Result
Operand
column column
The Conjunction Operator
 The binary conjunction operator “” (AND) combines two
propositions to form their logical conjunction.

 E.g. If p = “I will have salad for lunch.” and


q = “I will have sweet for dinner.”
then, pq = “I will have salad for lunch and
I will have sweet for dinner.”
Conjunction Truth Table
Operand columns

p q pq
T T T
T F F
F T F
F F F
 Note that a conjunction p1  p2  …  pn of n
propositions will have 2n rows in its truth table
The Disjunction Operator

 The binary disjunction operator “” (OR) combines two propositions


to form their logical disjunction.

 E.g. If p = “My car has a bad engine.” and


q = “My car has a bad carburetor.”
then, pq = “My car has a bad engine, or
my car has a bad carburetor.”
Disjunction Truth Table
p q pq
T T T
T F T
F T
T
 Note that pqFmeans
F that
F p is true, or q is
true, or both are true!
 So, this operation is also called inclusive or,
because it includes the possibility that both
p and q are true.
The Exclusive-Or Operator

 The binary exclusive-or operator “” (XOR) combines two


propositions to form their logical “exclusive or”

E.g. If p = “I will earn an A in this course.” and


q = “I will drop this course.”, then
p  q = “I will either earn an A in this course,
or I will drop it (but not both!)”
Exclusive-Or Truth Table
p
q pq
T T F
T F T
F T
T
F F F
 Note that p  q means that p is true, or q is true, but not
both!
 This operation is called exclusive or, because it excludes the
possibility that both p and q are true.
The Implication Operator
 The conditional statement
p  q states that p implies q.
 I.e., If p is true, then q is true; but if p is not true, then q could be either
true or false.
 E.g., let p = “You study hard.”
q = “You will get a good grade.”
p  q = “If you study hard, then you will get a good grade.” (else, it
could go either way)
 p: hypothesis or antecedent or premise
 q: conclusion or consequence
Implication Truth Table

p q pq
T T T
T F F
F T
T
F F
 p  q is false only when p is true but q is not true.
T
English Phrases Meaning p  q

 “p implies q”  “p only if q”
 “if p, then q”  “p is sufficient for q”
 “if p, q”  “q is necessary for p”
 “when p, q”  “q follows from p”
 “whenever p, q”  “q is implied by p”
 “q if p”
 “q when p”
 “q whenever p”
Converse, Inverse, Contrapositive
 Some terminology, for an implication p  q:
 Its converse is: q  p.
 Its inverse is: ¬p  ¬q.
 Its contrapositive: ¬q  ¬p.
p q pq qp p q q p
T T T T T T
T F F
F T T T F
T
F F F F T
 One of these three
T has the same meaning (same truth table) as
p  q.Can you figure out which?
T T T
Examples
 p: Today is Easter
q: Tomorrow is Monday

 pq:
If today is Easter then tomorrow is Monday.
 qp

If tomorrow is Monday then today is easter


¬p  ¬q: today is not easter then tomorrow is not Monday
¬q ¬p : tomorrow is not Monday then today is not easter
The Biconditional Operator
 The biconditional statement p  q states that p if and only if
(iff) q.
 p = “It is below freezing.”
q = “It is snowing.”
p  q = “It is below freezing if and only if it is snowing.”
or
= “That it is below freezing is necessary and sufficient for it
to be snowing”
Biconditional Truth Table
p q pq • p is necessary
T T T and sufficient for q
T F F • If p then q,
F T F and
conversely
F F • p iff q
 T to (p  q)  (q  p).
p  q is equivalent
 p  q means that p and q have the same truth value.
 p  q does not imply that p and q are true.
 Note this truth table is the exact opposite of ’s! Thus, p  q means
¬(p  q).
1.2 Propositional Equivalence
 A tautology is a compound proposition that is true no matter what the
truth values of its atomic propositions are!
 e.g. p  p (“Today the sun will shine or today the sun will not
shine.”) [What is its truth table?]
 A contradiction is a compound proposition that is
false no matter what!
 e.g. p  p (“Today is Wednesday and today is not Wednesday.”)
[Truth table?]
 A contingency is a compound proposition that is neither a tautology
nor a contradiction.
 e.g. (p  q) → r
Logical Equivalence
 Compound proposition p is logically equivalent to
compound proposition q, written p  q or p  q, iff the
compound proposition p  q is a tautology.
 Compound propositions p and q are logically equivalent to each
other iff p and q contain the same truth values as each other in
all corresponding rows of their truth tables.
Proving Equivalence
via Truth Tables
 Prove that (p  q)  p  q. (De Morgan’s law)

p q pq p q p  q (p  q)
TT T F F F F
TF F F
F T T T T
F F F T
F T T
 Show that

F T T
(p  q)  p  q (De Morgan’s law)
 p → q  p  q T T
 p  (q  r)  (p  q)  (p  r) (distributive law)
0 1 – Bit values or Logical values or Boolean values
64 32 16 8 4 2 1
9 0 1 0 0 1 converting normal

45 0 1 0 1 1 0 1 numbers to bit strings

2 1 0
Examples: Find the values of bit and, or, Xor for 1. 24 and 36 2. 9
and 16 3. 58 and 67

What is the bit string value for 196 and 367.


Multiplication of
Bits

Rules for
Addition of Bits
Examples for Addition:

Step : 1 Step : 2 Step : 3


1. 34+56 2. 101101+01110 3. 24*13 4. 10110*01101
Examples of Multiplication:
2’s Complement of a Binary Number
There is a simple algorithm to convert a binary number into 2’s
complement. To get 2’s complement of a binary number, simply invert the
given number and add 1 to the least significant bit (LSB) of given result.

Example: Find 2’s complement of binary number 10101110.


Solution: Invert the given number i.e. 1’s compliment 01010001
• And add 1 that is 2’s compliment 01010001+1=01010010 this is the
answer.
Example: Find 2’s complement of binary number 10001.001.
Solution: 1’s compliment of given number and adding 1 is 2’s compliment
01110.110+1=01110.111
2’s Complementation in Signed Binary number Representation
Positive numbers are simply represented as simple Binary representation.
But if the number is negative then it is represented using 2’s
complement. First represent the number with positive sign and then take
2’s complement of that number.
Example − Let we are using 5 bits registers. The representation of -5 and
+5 will be as follows:
• +5 is represented as it is represented in sign magnitude method. -5 is
represented using the following steps:
• (i) +5 = 0 0101
• (ii) Take 2’s complement of 0 0101 and that is 1 1011. MSB is 1 which
indicates that number is negative.

0 0101
1 1010
+1
1 1011
Subtraction Rules

Example: Subtract 11012, and 10102.


Solution: 11012 – 10102 = 00112
1

1101

=0

1010

0 0 1 1
Numbers Systems:
• The decimal number system
• The binary number system
• The octal number system and
• The hexadecimal number system
Decimal to Binary
Binary to Decimal:

Example : Find the decimal value of the binary number (11001011)2 using the positional
notation method of binary to decimal conversion.
Decimal to Octal
Example : Convert Decimal number 2980 to octal
Octal to Decimal:

Example: Convert (2754)8 to Decimal


Logic Circuits:
A logic circuit (or digital circuit) receives input signals p1, p2,...,pn, each a bit [either
0 (off) or 1 (on)], and produces output signals s1, s2,...,sn, each a bit. Propositional
logic can be applied to the design of computer hardware. This was first observed in
1938 by Claude Shannon in his MIT master’s thesis.
Example: Build a digital circuit that produces the output (p ∨ ¬r) ∧ (¬p ∨
(q ∨ ¬r)) when given input bits p, q, and r.
Example:
Predicates and Quantifiers
Topic #3 – Predicate Logic
 In predicate logic, a predicate is modeled as a proposional function P(·)
from subjects to propositions.
• P(x): “x is a prime number” (x: any subject)
• P(3): “3 is a prime number.” (proposition!)
 Propositional functions of any number of arguments, each of which may
take any grammatical role that a noun can take
• P(x,y,z): “x gave y the grade z”
• P(Mike,Mary,A): “Mike gave Mary the grade A.”

Example: Let P (x) denote the statement “x > 3.” What are the truth values
of P (4) and P (2)?
Solution: We obtain the statement P (4) by setting x = 4 in the statement “x
> 3.” Hence, P (4), which is the statement “4 > 3,” is true. However, P (2),
which is the statement “2 > 3,” is false
Topic #3 – Predicate Logic
Example : Let A(x) denote the statement “Computer x is under attack by an
intruder.” Suppose that of the computers on campus, only CS2 and MATH1
are currently under attack by intruders. What are truth values of A(CS1),
A(CS2), and A(MATH1)?

Solution: We obtain the statement A(CS1) by setting x = CS1 in the


statement “Computer x is under attack by an intruder.”

• Because CS1 is not on the list of computers currently under attack, we


conclude that A(CS1) is false.

• Similarly, because CS2 and MATH1 are on the list of computers under
attack, we know that A(CS2) and A(MATH1) are true.
Topic #3 – Predicate Logic

Universe of Discourse (U.D.)


• The power of distinguishing subjects from predicates is that it
lets you state things about many objects at once.

Example: let P(x) = “x + 1 > x” We can then say, “For any number
x, P(x) is true” instead of (0+1 > 0) Λ (1+1>1) Λ (2+1>2) Λ……...
• The collection of values that a variable x can take is called x’s
universe of discourse or the domain of discourse (often just
referred to as the domain).
Topic #3 – Predicate Logic

Quantifier Expressions
Quantifiers provide a notation that allows us to quantify (count) how
many objects in the universe of discourse satisfy the given predicate.
• ∀ is the FOR ∀LL or universal quantifier
∀x P(x) means for all x in the domain, P(x).
• Ǝ is the Ǝxists or existential quantifier
Ǝx P(x) means there exists an x in the domain (that is, 1 or more)
such that P(x).
Example for Universal Quantifier
Example for Existential Quantifier:
Proofs
A Mathematical system consists of:
• Undefined terms
• Definitions
• Axioms

Definitions : A definition is a proposition constructed from undefined terms and


previously accepted concepts in order to create a new concept.

Example: In Euclidean geometry the following are definitions:


• Two triangles are congruent if their vertices can be paired so that the
corresponding sides are equal and so are the corresponding angles.
• Two angles are supplementary if the sum of their measures is 180 degrees.
Axioms:
An axiom is a proposition accepted as true without proof within the
mathematical system. There are many examples of axioms in mathematics:

Example: In Euclidean geometry the following are axioms


• Given two distinct points, there is exactly one line that contains them.
• Given a line and a point not on the line, there is exactly one line through
the point which is parallel to the line.
Theorems:
A theorem is a proposition of the form p q which must be shown to be true
by a sequence of logical steps that assume that p is true, and use
definitions, axioms and previously proven theorems.

Lemmas and corollaries:


• A lemma is a small theorem which is used to prove a bigger theorem.
• A corollary is a theorem that can be proven to be a logical
consequence of another theorem.
Example from Euclidean geometry: "If the three sides of a triangle
have equal length, then its angles also have equal measure. "
Types of proof :
A proof is a logical argument that consists of a series of steps
using propositions in such a way that the truth of theorem is
established.

• Direct proof: p  q
A direct method of attack that assumes the truth of proposition
p, axioms and proven theorems so that the truth of proposition
q is obtained.
Indirect proof :
The method of proof by contradiction of a theorem p  q consists of the
following steps:
1. Assume p is true and q is false
2. Show that ~p is also true.
3. Then we have that p ^ (~p) is true.
4. But this is impossible, since the statement p ^ (~p) is always false. There
is a contradiction!
5. So, q cannot be false and therefore it is true.

OR: show that the contrapositive (~q)  (~p) is true.


• Since (~q)  (~p) is logically equivalent to p  q, then theorem is
proved.
Valid arguments

• Deductive reasoning: the process of reaching a conclusion q from a


sequence of propositions p 1, p 2, …, pn.
• The propositions p 1, p 2, …, pn are called premises or hypothesis.
• The proposition q that is logically obtained through the process is
called the conclusion.
Rules of inference (1)

1. Law of detachment or modus ponens 2. Modus tollens


• Pq • Pq
• p • ~q
• Therefore, q • Therefore, ~p
Rules of inference (2)

3. Rule of Addition 4. Rule of Simplification


• P • P^q
• Therefore, p V q • Therefore, p

5. Rule of Conjunction
• P
• q
• Therefore, p ^ q
Rules of inference (3) :

6. Rule of hypothetical syllogism 7. Rule of disjunctive syllogism


• pq • pVq
• Qr • ~p
• Therefore, p  r • Therefore, q
Rules of inference for quantified statements

1. Universal Instantiation 2. Universal Generalization


• ∀ x ∈ D, P(x) • P(d) for any d ∈ D
• d∈D • Therefore, ∀x, P(x)
• Therefore, P(d)

3. Existential Instantiation 4. Existential Generalization


• ∃ x ∈ D, P(x) • P(d) for some d ∈ D
• Therefore, P(d) for some d ∈ D • Therefore, ∃ x, P(x)
Resolution proofs

• Due to J. A. Robinson (1965)


• A clause is a compound statement with terms separated by “or”, and
each term is a single variable or the negation of a single variable.
Example: 1. p v q v (~r) is a clause
2. (p ^ q) v r v (~s) is not a clause
• Hypothesis and conclusion are written as clauses
• Only one rule:
 pvq
 ~p v r
 Therefore, q v r

You might also like