0% found this document useful (0 votes)
56 views

Introduction Updated

This document introduces some key concepts in propositional logic, including: 1. Propositions are statements that can be either true or false, but not both. 2. Logical connectives like negation, conjunction, disjunction, conditional, and biconditional are used to combine simple propositions into more complex ones. 3. Each logical connective has a specific truth table that defines its meaning based on the truth values of the input propositions. Understanding these truth tables is important for determining the truth value of compound propositions.

Uploaded by

ankit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Introduction Updated

This document introduces some key concepts in propositional logic, including: 1. Propositions are statements that can be either true or false, but not both. 2. Logical connectives like negation, conjunction, disjunction, conditional, and biconditional are used to combine simple propositions into more complex ones. 3. Each logical connective has a specific truth table that defines its meaning based on the truth values of the input propositions. Understanding these truth tables is important for determining the truth value of compound propositions.

Uploaded by

ankit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 95

Unit I: Mathematical

Reasoning
Logic
• We intuitively know that Truth and Falsehood
are opposites, that statements describe the
world and can be true/false, that the world is
made up of objects and that objects can be
organized to form collections.
• It is the study of the logical relationships
between objects and forms the basis of all
mathematical reasoning and all automated
reasoning
False, True, Statements
Axiom: False is the opposite to Truth.
A statement is a description of something.
Examples of statements:
 I’m 31 years old.
 I have 3 children.
 I always tell the truth.
 I’m lying to you.
Q’s: Which statements are True? False? Both?
Neither?
False, True, Statements
True: I’m 31 years old.
False: I have 3 children.
I always tell the truth.
Both: IMPOSSIBLE, by our Axiom.
False, True, Statements
Neither: I’m lying to you. (If viewed on its own)
HUH? Well suppose that
S = “I’m lying to you.”
were true. In particular, I am actually lying, so
S is false. So it’s both true and false,
impossible by the Axiom.
Okay, so I guess S must be false. But then I
must not be lying to you. So the statement is
true. Again it’s both true and false.
In both cases we get the opposite of our
assumption, so S is neither true nor false.
Propositions
To avoid painful head-aches, we ban such
silly non-sense and avoid the most
general type of statements limiting
ourselves to statements with valid
truth-values instead:
DEF: A proposition is a statement that is
true or false, but not both.
We usually denote a proposition by a
letter: p, q, r, s, …
Propositions
Propositional Logic is a static discipline of
statements which lack semantic content.
E.G. p = “Clinton was the president.”
q = “The list of U.S. presidents includes
Clinton.”
r = “Lions like to sleep.”
All p and q are no more closely related than q
and r are, in propositional calculus. They are
both equally related as all three statements
are true. Semantically, however, p and q are
the same!
Propositions
So why waste time on such matters?
Propositional logic is the study of how simple
propositions can come together to make
more complicated propositions. If the simple
propositions were endowed with some
meaning –and they will be very soon– then
the complicated proposition would have
meaning as well, and then finding out the
truth value is actually important!
The value of a proposition is called its truth
value(True/False)
Propositions: Examples
The following are propositions
 Today is Monday M
 The grass is wet W
 It is raining R
The following are not propositions
 C++ is the best language Opinion
 When is the pretest? Interrogative
 Do your homework Imperative
Compound Propositions
In Propositional Logic, we assume a
collection of atomic propositions are
given: p, q, r, s, t, ….
Then we form compound propositions by
using logical connectives (logical
operators) to form propositional
“molecules”.
Logical Connectives
Operator Symbol Usage Java
Negation  not !
Conjunction  and &&
Disjunction  or ||
Exclusive or  xor (p||q)&&(!p||!q)

Conditional  if,then p?q:true


Biconditional  iff (p&&q)||(!p&&!q)
Compound Propositions:
Examples
p = “Cruise ships only go on big rivers.”
q = “Cruise ships go on the Hudson.”
r = “The Hudson is a big river.”
r = “The Hudson is not a big river.”
pq = “Cruise ships only go on big rivers and
go on the Hudson.”
(pq) r = “If cruise ships only go on big
rivers and go on the Hudson, then the
Hudson is a big river.”
Negation
This just turns a false proposition to true
and the opposite for a true proposition.
EG: p = “23 = 15 +7”
p happens to be false, so p is true.
In Java, “!” plays the same role:
!(23 == 15+7)
has the boolean value true whenever
evaluated.
Negation – truth table
Logical operators are defined by truth
tables –tables which give the output of
the operator in the right-most column.
Here is the truth table for negation:

p p
F T
T F
Conjunction
Conjunction is a binary operator in that it
operates on two propositions when
creating compound proposition. On the
other hand, negation is a unary
operator (the only non-trivial one
possible).
Conjunction
Conjunction is supposed to encapsulate
what happens when we use the word
“and” in English. I.e., for “p and q ” to
be true, it must be the case that BOTH
p is true, as well as q. If one of these
is false, than the compound statement
is false as well.
Conjunction
EG. p = “Clinton was the president.”
q = “Monica was the president.”
r = “The meaning of is is important.”
Assuming p and r are true, while q false.
Out of pq, pr, qr
only pr is true.
Java: x==3 && x!=3
Evaluates to false for any possible value of x.
Conjunction – truth table

p q pq
T T T
T F F
F T F
F F F
Disjunction – truth table
Conversely, disjunction is true when at
least one of the components is true:

p q p q
T T T
T F T
F T T
F F F
Disjunction – caveat
Note: English version of disjunction “or”
does not always satisfy the assumption
that one of p/q being true implies that
“p or q ” is true.
Q: Can someone come up with an
example?
Disjunction – caveat
A: The entrée is served with
soup or salad.
Most restaurants definitely don’t allow
you to get both soup and salad so that
the statement is false when both soup
and salad is served. To address this
situation, exclusive-or is introduced
next.
Exclusive-Or – truth table
p q p q
T T F
T F T
F T T
F F F

Note: in this course any usage of “or”


will connote the logical operator 
as opposed to the exclusive-or.
Conditional (Implication)
This one is probably the least intuitive.
It’s only partly akin to the English usage
of “if,then” or “implies”.
DEF: p  q is true if q is true, or if p is
false. In the final case (p is true while
q is false) p  q is false.
Semantics: “p implies q ” is true if one
can mathematically derive q from p.
Conditional -- truth table
p q p q
T T T
T F F
F T T
F F T
Conditional

Q: Does this makes sense? Let’s try


examples for each row of truth table:
1. If pigs like mud then pigs like mud.
2. If pigs like mud then pigs can fly.
3. If pigs can fly then pigs like mud.
4. If pigs can fly then pigs can fly.
Conditional
A:
1. If pigs like mud then pigs like mud.
True: nothing about this statement is false.
2. If pigs like mud then pigs can fly.
False: seems to assert falsehood
3. If pigs can fly then pigs like mud.
True: argument for –only care about end-result.
Argument against –counters common English
hyperbole.
4. If pigs can fly then pigs can fly.
True. WAIT! By first reasoning in 3, when “if” part is
false, should only care about “then” part!!!!!
On other hand, standard English hyperbole.
Conditional: why FF is True
Remember, all of these are mathematical
constructs, not attempts to mimic English.
Mathematically, p should imply q whenever it
is possible to derive q by from p by using
valid arguments. For example consider the
mathematical analog of no. 4:
If 0 = 1 then 3 = 9.
Q: Is this true mathematically?
Conditional: why FF is True
A: YES mathematically and YES by the
truth table.
Here’s a mathematical proof:
1. 0 = 1 (assumption)
2. 1 = 2 (added 1 to both sides)
3. 3 = 6 (multiplied both sides by 3)
4. 0 = 3 (multiplied no. 1 by 3)
5. 3 = 9 (added no. 3 and no. 4) QED
Conditional: why FF is True
As we want the conditional to make sense
in the semantic context of
mathematics, we better define it as
we have!
Other questionable rows of the truth table
can also be justified in a similar
manner.
Conditional: synonyms
There are many ways to express the conditional
statement p  q :
If p then q. p implies q. If p, q.
p only if q [p cannot be true when q is not true].
p is sufficient for q.
Some of the ways reverse the order of p and q
but have the same connotation:
q if p. q whenever p. q is necessary for p.
To aid in remembering these, I suggest
inserting “is true” after every variable:
EG: “p is true only if q is true”
Conditional: synonyms
The implication of pq can be also read as
 If p then q
 p implies q
 If p, q
 p only if q
 q if p
 q when p
 q whenever p
 q follows from p
 p is a sufficient condition for q (p is sufficient for
q)
 q is a necessary condition for p (q is necessary for
p)
Bi-Conditional -- truth table
For p  q to be true, p and q must have
the same truth value. Else, p  q is false:
p q pq
T T T
T F F
F T F
F F T
Q : Which operator is  the opposite of?
Bi-Conditional
A:  has exactly the opposite truth table
as .
This means that we could have defined the
bi-conditional in terms of other previously
defined symbols, so it is redundant. In fact,
only really need negation and disjunction to
define everything else.
Extra operators are for convenience.
Q: Could we define all other logical operations
using only negation and exclusive or?
Bi-Conditional
A: No. Notice that negation and
exclusive-or each maintain parity
between truth and false: No matter
what combination of these symbols,
impossible to get a truth table with four
output rows consisting of 3 T’s and 1 F
(such as implication and disjuction).
Biconditional
The biconditional pq can be equivalently
read as
 p if and only if q
 p is a necessary and sufficient condition for q
 if p then q, and conversely
 p iff q
Examples
 x>0 if and only if x3 is positive
 The alarm goes off iff a burglar breaks in
 You may have pudding iff you eat your meat
Converse, Inverse,
Contrapositive
Consider the proposition p  q
 Its converse is the proposition q  p
 Its inverse is the proposition p  q

 Its contrapositive is the proposition q 

p
Two compound propositions are equivalent if
they always have the same truth value
 The contrapositive is equivalent to the original
statement
 The converse is equivalent to the inverse
Precedence of Logical
Operators
Negation operator is applied before all
other logical operators
Conjunction operator takes precedence
over disjunction operator
Conditional and biconditional operators
have lower precedence
Parentheses are used whenever
necessary
Truth Tables
Truth tables are used to show/define the
relationships between the truth values of
 the individual propositions and
 the compound propositions based on them

p q pq pq pq pq pq

0 0 0 0 0 1 1
0 1 0 1 1 1 0
1 0 0 1 1 0 0
1 1 1 1 0 1 1
Constructing Truth Tables
Construct the truth table for the
following compound proposition
(( p  q ) q )
p q pq q (( p  q ) q )

0 0 0 1 1
0 1 0 0 0
1 0 0 1 1
1 1 1 0 1
Bit Strings
Electronic computers achieve their calculations
inside semiconducting materials. For
reliability, only two stable voltage states are
used and so the most fundamental operations
are carried out by switching voltages between
these two stable states.
In logic, only two truth values are allowed.
Thus propositional logic is ideal for modeling
computers. High voltage values are modeled
by True, which for brevity we call the number
1, while low voltage values are modeled by
False or 0.
Bit Strings
Thus voltage memory stored in a computer can
be represented by a sequence of 0’s and 1’s
such as
01 1011 0010 1001
Another portion of the memory might look like
10 0010 1111 1001
Each of the number in the sequence is called a
bit, and the whole sequence of bits is called
a bit string.
Bit Strings
It turns out that the analogs of the logical
operations can be carried out quite easily
inside the computer, one bit at a time. This
can then be transferred to whole bit strings.
For example, the exclusive-or of the previous
bit strings is:
01 1011 0010 1001
 10 0010 1111 1001
11 1001 1101 0000
Terminology: Tautology,
Contradictions, Contingencies
Definitions
 A compound proposition that is always true,
no matter what the truth values of the
propositions that occur in it is called a
tautology
 A compound proposition that is always false is
called a contradiction
 A proposition that is neither a tautology nor a
contradiction is a contingency
Examples
 A simple tautology is p  p
 A simple contradiction is p  p
Logical Equivalences:
Definition
Definition: Propositions p and q are
logically equivalent if p  q is a
tautology.
Informally, p and q are equivalent if
whenever p is true, q is true, and vice
versa
Notation: p  q (p is equivalent to q), p
 q, and p  q
Alert:  is not a logical connective
Logical Equivalences: Example 1
Are the propositions (p  q) and (p  q)
logically equivalent?
To find out, we construct the truth tables for
each: p q pq p pq
0 0
0 1
1 0
1 1

The two columns in the truth table are identical, thus we conclude that
(p  q)  (p  q)
TABLE 7 (1.2)
TABLE 8 (1.2)
Constructing New Logical Equivalence

How to show logical equivalence


 Use a truth table
 Use logical identities that we already know
Predicates and Quantifiers
Predicate logic
Predicate: a property that the subject of
the statement can have
 Ex: x>3
 x: variable
 >3: predicate
 P(x): x>3
 The value of the propositional function P at x
 P(x1,x2, …, xn): n-place predicate or n-ary
predicate
Quantifiers
Quantification
 Universal quantification: a predicate is true
for every element
 Existential quantification: there is one or
more element for which a predicate is true
The Universal Quantifier
Domain: domain of discourse (universe of
discourse)
Definition 1: The universal quantification of
P(x) is the statement “P(x) for all values of x
in the domain”, denoted by x P(x)
 “for all x P(x)” or “for every x P(x)”
 Counterexample: an element for which P(x) is false
 When all elements in the domain can be listed,
P(x1) P(x2) … P(xn)
The Existential Quantifier
Definition 2: The existential
quantification of P(x) is the proposition
“There exists an element x in the
domain such that P(x)”, denoted by x
P(x)
 “there is an x such that P(x)” or “for some
x P(x)”
 When all elements in the domain can be
listed, P(x1) P(x2) … P(xn)
Other Quantifiers
Uniqueness quantifier: !x P(x) or 1x
P(x)
 There exists a unique x such that P(x) is
true
Quantifiers with restricted domains
 x<0 (x2>0)
 Conditional: x(x<0  x2>0)
 z>0 (z2=2)
 Conjunction: z(z>0  z2=2)
Precedence of quantifiers
  and  have higher precedence than all
logical operators
 Ex: x P(x) Q(x)
 (x P(x)) Q(x)
Logical Equivalence involving Quantifiers

Definition 3: statements involving


predicates and quantifiers are logically
equivalent if and only if they have the
same truth value no matter which
predicates are substituted and which
domain is used
 E.g. x (P(x)  Q(x)) and x P(x)  x
Q(x)
Negating Quantified
Expressions
x P(x)  x P(x)
 Negation of the statement “Every student
in your class has taken a course in
Calculus”
 “There is a student in your class who has
not taken a course in Calculus”
x Q(x)  x Q(x)
Translating from English into Logical
Expressions

“Every student in this class has studied


calculus”
“Some student in this class has visited
Mexico”
“Every student in this class has visited
either Canada or Mexico”
Using Quantifiers in system
specifications
 “Every mail message larger than one
megabyte will be compressed”
 “If a user is active, at least one network
link will be available”
Examples from Lewis Carroll
 “All lions are fierce”
 “Some lions do not drink coffee”
 “Some fierce creatures do not drink coffee”
Logic Programming
Prolog
 Facts
 E.g.
 instructor(chan, math)
 instructor(patel, os)
 enrolled(kevin, math)
 enrolled(kevin, os)
 enrolled(juana, math)
 Rules
 E.g.
 teaches(P,S) :- instructor(P,C), enrolled(S,C)
 ?teaches(X, kevin)
Nested Quantifiers
Two quantifiers are nested if one is
within the scope of the other
 x y (x+y=0)
 x  y ((x>0)  (y<0)  (xy<0))
Thinking of quantification as loops
 xy P(x, y)
 x y P(x, y)
 xy P(x, y)
 x y P(x, y)
The order of quantifiers is important
unless all quantifiers are universal
quantifiers or all are existential
quantifiers
 xy P(x, y) vs. yx P(x, y)
 P(x,y): “x+y=y+x”
 x y Q(x, y) vs. yx Q(x, y)
 Q(x,y): “x+y=0”
Translating mathematical statements into
statements involving nested quantifiers

“The sum of two positive integers is


always positive”
“Every real number except zero has a
multiplicative inverse”
(a multiplicative inverse of a real
number x is a real number y such that
xy=1)
Translating from nested quantifiers into
English
x (C(x)  y (C(y)  F(x, y)))
 C(x): “x has a computer”
 F(x,y): “x and y are friends”
 Domain of x, y: “all students in your school”
xyz ((F(x, y) F(x, z)  (yz))  F(y, z))
 F(a, b): “a and b are friends”
 Domain of x, y, z: “all students in your school”
Translating from nested quantifiers into
English
x (C(x)  y (C(y)  F(x, y)))
 C(x): “x has a computer”
 F(x,y): “x and y are friends”
 Domain of x, y: “all students in your school”
 every student in your school has a computer
or has a friend who has a computer.
xyz ((F(x, y) F(x, z)  (yz))  F(y, z))
 F(a, b): “a and b are friends”
 Domain of x, y, z: “all students in your school”
 there is a student none of whose friends are
also friends with each other
Translating English sentences into
logical expressions
 “If a person is female and is a parent, then
this person is someone’s mother”
 “Everyone has exactly one best friend”
Negating nested quantifiers
 Negation of x y (xy=1)
 “There does not exist a woman who has
taken a flight on every airline in the world”
Rules of Inference
Proofs: valid arguments that establish
the truth of mathematical statements
 Argument: a sequence of statements that
end with a conclusion
 Valid: the conclusion must follow from the
preceding statements (premises) of the
argument
Valid Arguments in Propositional Logic

Ex:
 “If you have a current password, then you
can log onto the network”
 “You have a current password”
 Therefore, “You can log onto the network”
p q
p
q
Definition 1: argument: a sequence of
propositions
 Premises
 Conclusion: the final proposition
 Argument form: a sequence of compound
propositions involving propositional
variables
Rules of Inference fro Propositional Logic

Rules of inference
 Modus ponens (law of detachment)
 (p (p q))  q
TABLE 1 (1.5)
Example:
 “It it not sunny this afternoon and it is
colder than yesterday”
 “We will go swimming only if it is sunny”
 “If we do not go swimming, then we will
take a canoe trip”
 “If we take a canoe trip, then we will be
home by sunset”
 Conclusion: “We will be home by sunset”
Show that the premises “If you send
me an e-mail message, then I will finish
writing the program,” “If you do not
send me an e-mail message, then I will
go to sleep early,” and “If I go to sleep
early, then I will wake up feeling
refreshed” lead to the conclusion “If I
do not finish writing the program, then
I will wake up feeling refreshed.”
Fallacies
((p  q) q)  p is not a tautology
 Fallacy of affirming the conclusion
 Example:
 “If you do every problem in this book, then you
will learn discrete mathematics. You learned
discrete mathematics.
Therefore, you did every problem in this book.”
((p  q) p)  q is not a tautology
 Fallacy of denying the hypothesis
Example: It is possible that you learned discrete
mathematics even if you did not do every problem in
this book.
Rules of Inference for Quantified
Statements

Universal instantiation
 x P(x), P(c)
Universal generalization
 P(c) for any c, x P(x)
Existential instantiation
 x P(x), P(c) for some element c
Existential generalization
 P(c) for some element c,  x P(x)
TABLE 2 (1.5)
Show that the premises “Everyone in
this discrete mathematics class has
taken a course in computer science”
and “Marla is a student in this class”
imply the conclusion “Marla has taken a
course in computer science.”
Show that the premises “A student in
this class has not read the book,” and
“Everyone in this class passed the first
exam” imply the conclusion “Someone
who passed the first exam has not read
the book.”
Combining rules of inference for
propositions and quantified statements
 Universal modus ponens
 x (P(x)  Q(x))
P(a), where a is a particular element in the
domain
Q(a)
 Universal modus tollens
 x (P(x)  Q(x))
Q(a), where a is a particular element in the
domain
Introduction to Proofs
Some terminology
 Theorem: a statement that can be shown to be
true
 Axioms: statements assumed to be true
 A proof is a valid argument that establishes the truth of a
theorem
 Including axioms, premises of the theorem, and previously
proven theorems
 Lemma: less important theorems that is helpful in
the proof
 Corollary: a theorem that can be directly
established from a theorem that has been proved
 Conjecture: a statement that is being proposed to
be true
Direct Proofs
pq
 Assume that p is true
 Showing that q must also be true
Definition 1: The integer n is even if
there exists an integer k such that
n=2k, and n is odd if there exists an
integer k such that n=2k+1.
Ex.1: Prove that “if n is an odd integer,
then n2 is odd.”
Proof by Contraposition
pq
 q  p
 Take q as a hypothesis
 Then show that p must follow
Ex.3: prove that if n is an integer and 3n+2 is
odd, then n is odd.
Vacuous proof
 If we can show that p is false, then we have a
vacuous proof of p  q is true
Trivial proof
 If we know that the conclusion q is true, p  q
must also be true
A little proof strategy
First, evaluate whether a direct proof
looks promising
Otherwise, try the same thing with a
proof by contraposition
Definition 2: The real number r is
rational is there exist integers p and q
with q0 such that r=p/q. A real
number that is not rational is called
irrational.
Ex.7: Prove that the sum of two rational
numbers is rational.
Ex.8: Prove that if n is an integer and n2
is odd, then n is odd.
Proof by Contradiction
If we can show that p  (r  r) is
true for some proposition r, we can
prove that p is true
Ex.9: show that at least four of any 22
days must fall on the same day of the
week.
Ex.10: prove that 2 is irrational.
Proof of equivalence
 To prove that p  q , we show that p  q
and q  p are both true
Counterexamples
 To show that x P(x) is false, we need only
find a counterexample
Mistakes in proofs
 Fallacy of begging the question
 Circular reasoning
Proof Methods and Strategy
Proof by cases
 ((p1 p2  …  pn)  q)  (p1  q)  (p2
 q)  …  (pn  q)
Exhaustive proof
 A special type of proof by cases that
exhaust all possibilities (if there are
relatively small number of examples)
Without loss of generality (WLOG)
 By proving one case of a theorem, no
additional argument is required to prove
other specified cases
Existence Proofs
x P(x)
 Constructive: find an element a such that
P(a) is true
 Nonconstructive
 E.g.: proof by contradiction
Uniqueness Proofs
Existence: we show that an element x
with the desired property exists
Uniqueness: we show that if yx, then y
does not have the desired property
Proof strategies
Forward and backward reasoning
Adapting existing proofs
Looking for counterexamples

You might also like