0% found this document useful (0 votes)
15 views63 pages

Chap01 - Logic and Proof

logic and proof lesson

Uploaded by

heo11296
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views63 pages

Chap01 - Logic and Proof

logic and proof lesson

Uploaded by

heo11296
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Course: Discrete Structures

(501215-3)

Chapter 1
The Foundations:
Logic and Proofs

1
1.1 Propositional Logic
1.2 Propositional Equivalences
1.3 Predicates and Quantifiers
1.4 Nested Quantifiers
1.6 Introduction to Proofs
1.7 Proof Methods and Strategy

2 P. 1
1.1 Propositional Logic

• Logic: to give precise meaning to


mathematical statements
• Proposition: a declarative sentence that is
either true or false, but not both
– 1+1=2
– Toronto is the capital of Canada
• Propositional variables: p, q, r, s
• Truth value: true (T) or false (F)

3
• Compound propositions: news
propositions formed from existing
propositions using logical operators
• Definition 1: Let p be a proposition. The
negation of p, denoted by p (orp), is the
statement “It is not the case that p.”
– “not p”

4
TABLE 1 (1.1)

5 P. 3
• Definition 2: Let p and q be propositions.
The conjunction of p and q, denoted by p 
q, is the proposition “p and q.”
• Definition 3: Let p and q be propositions.
The disjunction of p and q, denoted by p  q,
is the proposition “p or q.”

6
TABLE 2 (1.1)

7 P. 4
TABLE 3 (1.1)

8 P. 4
• Definition 4: Let p and q be propositions.
The exclusive or of p and q, denoted by p 
q, is the proposition that is true when
exactly one of p and q is true and is false
otherwise.

9
TABLE 4 (1.1)

10 P. 6
Conditional Statements

• Definition 5: Let p and q be propositions.


The conditional statement p  q is the
proposition “if p, then q.”
– p: hypothesis (or antecedent or premise)
– q: conclusion (or consequence)
– Implication
• “p implies q”
• Many ways to express this…

11
TABLE 5 (1.1)

12 P. 6
Converse, Contrapositive, and Inverse

• pq
• Converse: q  p
• Contrapositive:  q   p
• Inverse:  p   q
• 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

13
Example
• p is "I am in the University“, q is "It is
Tuesday"
"I am in Univ" → "It is If I am in Univ then it is
p→q
Tuesday" Tuesday
"It is Tuesday" → "I am If it is Tuesday then I
q→p
in Univ" am in Univ
"It is NOT Tuesday" → If it is NOT Tuesday
¬q → ¬p
"I am NOT in Univ" then I am NOT in Univ
"I am NOT in Univ" → If I am NOT in Univ
¬p → ¬q
"It is NOT Tuesday" then it is NOT Tuesday

14
Exercise

• Complete the truth table

p q ¬p ¬q p → q q→p ¬p → ¬q ¬q → ¬p
F F
F T
T F
T T

15
Biconditionals

• Definition 6: Let p and q be propositions.


The biconditional statement p  q is the
proposition “p if and only if q.”
– “bi-implications”
– “p is necessary and sufficient for q”
– “p iff q”

16
TABLE 6 (1.1)

17 P. 9
Implicit Use of Biconditionals

• Biconditionals are not always explicit in


natural language
– Imprecision in natural language
• “If you finish your meal, then you can have
dessert.”
• “You can have dessert if and only if you finish
your meal.”

18
TABLE 7 (1.1)

19 P. 10
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

20
Examples

1. ¬p → q ↔ p ^ q  r =

[((¬p) → q) ↔ ((p ^ q)  r)]

2. p ^ ¬q v p ↔ q → r ^ p

= ....

21 P. 11
Examples
p q pq p→q (p → q)  (p  q)

F F F T F

F T T T T

T F T F F

T T T T T

p q ¬p p→q (p → q) ^ ¬p

F F

F T

T F

T T
22
Translating English Sentences

• Example: “You can access the Internet


from campus only if you are a computer
science major or you are not a freshman.”
– let a = "You can access the Internet from
campus" c="You are a computer science
major" f="You are a freshman“. The sentence
can be represented as: a  (c  f).

23
Exercise

• Ex.13: “You cannot ride the roller coaster if you


are under 4 feet tall unless you are older than 16
years old.”
– ….

24
Exercise

• Translate the following English sentences


1. "The diagnostic message is stored in the buffer
or it is transmitted"
2. "The diagnostic message is not stored in the
buffer"
3. "If the diagnostic message is stored in the
buffer, then it is transmitted"

25
Solution

• p is "The diagnostic message is stored in the


buffer"
• q is "The diagnostic message is transmitted"
• p  q is "The diagnostic message is stored in
the buffer or it is transmitted"
• ¬p is "The diagnostic message is not stored
in the buffer"
• ……… is "If the diagnostic message is
stored in the buffer, then it is transmitted"
26
Examples

• Boolean Searches
– New AND Mexico AND universities
– (Mexico AND universities) NOT New
• Logic Puzzles
– Ex. 18:
• Knights always tell the truth, and knaves always lie
• A says “B is a knight”
• B says “The two of us are opposite types”
• What are A and B?
– Ex. 19

27
Logic and Bit Operations

• Bit: binary digit


• Boolean variable: either true or false
– Can be represented by a bit
• Definition 7: A bit string is a sequence of
zero or more bits. The length of this string
is the number of bits in the string.

28
TABLE 9 (1.1)

29 P. 15
1.2 Propositional Equivalences

• Definition 1:
– Tautology: a compound proposition that is
always true
– Contradiction: a compound proposition that is
always false
– Contingency: a compound proposition that is
neither a tautology nor a contradiction

30
TABLE 1 (1.2)

31 P. 22
Logical Equivalence

• Logical Equivalence are Compound


propositions that have the same truth
values in all possible cases
• Definition 2: Compound propositions p
and q are logically equivalent if p  q is a
tautology (denoted by p  q or p  q )
• De Morgan’s Law
–  (p  q)   p   q
–  (p  q)   p   q
32
TABLE 2 (1.2)

33 P. 22
TABLE 3 (1.2)

34 P. 22
Example
• p is "Ahmad has a cell phone" ,
q is "Ahmad has a laptop computer."
• p  q is "Ahmad has a cell phone." and "
Ahmad has a laptop computer."
• ¬(p  q) is "Ahmad does not have a cell phone
and a laptop computer."
• ¬p  ¬q is "Ahmad does not have a cell phone
or Ahmad does not have a laptop computer."
• ¬(p  q) ≡ ¬p  ¬q
35
TABLE 4 (1.2)
pq

36 P. 23
TABLE 5 (1.2)

37 P. 23
38 P. 24
TABLE 7 (1.2)

39 P. 25
TABLE 8 (1.2)

40 P. 25
Constructing New Logical Equivalence

• How to show logical equivalence


– Use a truth table (Example 2, 3, 4 in Tables 3, 4,
5)
– Use logical identities that we already know
• (Example 6, 7, 8)

41
Example
• Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧¬q
- ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧¬(¬p ∧ q) . 2sd De Morgan law
≡ ¬p ∧ [¬(¬p)∨¬q] by the first De Morgan law
≡ ¬p ∧ (p ∨¬q) by the double negation law
≡ (¬p ∧ p) ∨ (¬p ∧¬q) by the second distributive law
≡ F ∨ (¬p ∧¬q) because ¬p ∧ p ≡ F
≡ (¬p ∧¬q) ∨ F by the commutative law for disjunction
≡ ¬p ∧¬q by the identity law for F

42
Exercise

• Show that ¬(p → q) ≡ p ∧¬q


– ¬(p → q) ≡ ¬(¬p ∨ q) by previous example
….

• Show that (p ∧ q) → (p ∨ q) is a tautology


(p ∧ q) → (p ∨ q) ≡ ¬(p ∧ q) ∨ (p ∨ q)
….

43
1.3 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

44
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

45
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)

46
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)

47
TABLE 1 (1.3)

48 P. 34
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)

49
• Precedence of quantifiers
–  and  have higher precedence than all
logical operators
– Ex: x P(x) Q(x)
• (x P(x)) Q(x)

50
Logical Equivalence involving
Quantifiers

• Definition 3: two statements S and T


involving predicates and quantifiers are
logically equivalent, denoted by S  T, 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))  x P(x)  x Q(x)

51
Negating Quantified Expressions

• x P(x)  x P(x)


– Negation of the statement “Every student in
your class has taken a course in Preparatory Math
2”
– “There is a student in your class who has not
taken a course in Preparatory Math 2”
• x P(x)  x P(x)

52
TABLE 2 (1.3)

53 P. 41
Example

• What are the negations of the following


expressions: ∃x (x=2), ∀x (x2>x), ∃x (x2 =2)
• ¬∃x ( x = 2)  ∀x ¬(x=2)  ∀x (x ≠ 2 )
• ¬∀x (x2 > x)  ∃x ¬(x2> x )  ∃x (x2 ≤ x )
• ¬∃x (x2 = 2)  ∀x ¬(x2 = 2 )  ∀x (x2 ≠ 2)
• ¬∀x (x = x2)  …
• ¬∃x (x2 < 0)  …
• ∃x ¬(x2 > 0)  …
54
Translating from English into Logical
Expressions

• “Every student in this class has studied


Preparatory Math 2”
• “Some student in this class has visited
Madina”
• “Every student in this class has visited
either Makkah or Madina”

55
• Using Quantifiers in system specifications
– “Every mail message larger than one megabyte will be compressed”
• let S(m , y) ="Mail message m is larger than y megabytes," where
domain(x)={all mail messages}
• let y is a positive real number,
• let C (m )= "Mail message m will be compressed.“
• Specification: m (S(m , 1 )  C(m)).
– “If a user is active, at least one network link will be available”
• Let A(u) ="User u is active," where domain(u)={all users},
• let S(n , x) ="Network link n is in state x " ,domain(n) ={all network
links}, domain(x)={all possible states for a network link}
• Specification :  u A(u)   n S(n , available).
• Examples from Lewis Carroll: “All lions are fierce”, “Some lions do not
drink coffee”, Some fierce creatures do not drink coffee”
• Let P (x)="x is a lion," Q (x)="x is fierce," R (x)="x drinks coffee,"
respectively. Domain(x)={all creatures}
• x(P (x) Q (x)), x(P (x)  R (x)), x(Q (x)  R (x))

56
1.6 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

57
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.

58
Example

• Prove that “if n is an odd integer, then n2


is odd.”
• we assume that n is odd. The n = 2k + 1,
where k is some integer. n2 = (2k + 1)2 = 4k2
+ 4k + 1 = 2(2k2 + 2k) + 1. thus n2 is an odd
integer. Consequently, we have proved
that if n is an odd integer, then n2 is an
odd integer.

59
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

60
A little proof strategy

• First, evaluate whether a direct proof


looks promising
• Otherwise, try the same thing with a proof
by contraposition

61
• 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.

62
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.

63

You might also like