Dis Crete Mathem Atic S: Presenter Yukun Wang Computer Science and Technology
Dis Crete Mathem Atic S: Presenter Yukun Wang Computer Science and Technology
P r e s e n t e r : Yu k u n Wa n g
C o m p u t e r s c i e n c e a n d Te c h n o l o g y
About Me
Office: Main Building Block B-1515
Tel: 18810547223
Email: wykun06@gmail.com
About course
Textbook:
Discrete Mathematics and Its Applications, by Kenneth H.Rosen
离散数学及其应用(原书第8版), translated by: 徐六通 / 杨娟 /
吴斌
About curriculum
industral
computer Discrete
Discrete number relvolution
mathematics
Continuous mathematics
• Old and young (count; Logic)
• It was gradually established with the development of computers
• Formed in the early 1970s
• It is an important branch of modern mathematics and the theoretical basis of
computer science and technology
About course
Mathematical
Set thoery Logic • four major aspects
Set and its
Proposition Logic
operation • connection with each
Cardinal binary other
number predicate logic
relation
Function/mapping/
transformation algebraic
system
Graphy
thoery Group ring
Basic concept
Lattice and
Boolean algebra
Connectivity Euler and
Hamiltonian
Tree diagrams
Mathmaticl logic: Logic Calcus, Set Theory, Proof Theory, Model Theory, and
Recursive Theory.
Mathematical
Logic/Logic Calcus
Proposition Logic
predicate logic
1
Proposition Logic
Content
Introduction
Propositions
•atomic propositions/ compound propostions
Truth table
Precedence of logical operators
Logic and bit operators
Propositions
Introduction
• The rules of logic give precise meaning to mathematical statements. These rules
are used to distinguish between valid and invalid mathematical arguments.
Solution:
•Propositions 1 and 3 are true, whereas 2 and 4 are false.
•Some sentences that are not propositions are given in Example 2.
Propositions
Example 2: Consider the following sentences.
•1. What time is it?
•2. Read this carefully.
•3. x + 1 = 2.
•4. x + y = z.
Solution:
Sentences 1 and 2 are not propositions because they are not declarative sentences.
Sentences 3 and 4 are not propositions because they are neither true nor false. Note that
each of sentences 3 and 4 can be turned into a proposition if we assign values to the
variable x.
¬ negation
conjunction
disjunction
→ conditional statement
biconditional statement
Propositions-logical operators
Definition 1
• Let p be a proposition. The negation of p, denoted by ¬p (also denoted by ), is the
statement “It is not the case that p.”
•The proposition ¬p is read “not p.” The truth value of the negation of p, ¬p, is the
opposite of the truth value of p.
Propositions-logical operators
Example 3: Find the negation of the proposition “Michael’s PC runs Linux” and
express this in simple English.
Solution:
• The negation is “It is not the case that Michael’s PC runs Linux.”
• This negation can be more simply expressed as “Michael’s PC does not run
Linux.”
Propositions-logical operators
Solution:
• The negation is“It is not the case that Vandana’s smartphone has at least 32 GB
of memory.”
• This negation can also be expressed as “Vandana’s smartphone does not have at
least 32 GB of memory”
• Or even more simply as “Vandana’s smartphone has less than 32 GB of
memory.”
Propositions-logical operators
Table displays the truth table for the negation of a proposition p. This
table has a row for each of the two possible truth values of p. Each row
shows the truth value of ¬p corresponding to the truth value of p for this
row.
p ¬p
T F
F T
Propositions-logical operators
Note that in logic the word “but” sometimes is used instead of “and” in a
conjunction.
For example, the statement “The sun is shining, but it is raining” is another way of
saying “The sun is shining and it is raining.”
Propositions-logical operators
Definition 2
• Let p and q be propositions. The conjunction of p and q, denoted by p q, is the
proposition “p and q.” The conjunction p q is true when both p and q are true and
is false otherwise.
p q p∧q
T T T
T F F
F T F
F F F
Propositions
Solution:
The conjunction of these propositions, p q, is the proposition “Rebecca’s PC
has more than 16 GB free hard disk space, and the processor in Rebecca’s PC runs
faster than 1 GHz.”
This conjunction can be expressed more simply as “Rebecca’s PC has more than
16 GB free hard disk space, and its processor runs faster than 1 GHz.” For this
conjunction to be true, both conditions given must be true. It is false when one or
both of these conditions are false.
Propositions
Definition 3
• Let p and q be propositions. The disjunction of p and q, denoted by p q, is the
proposition “p or q.” The disjunction p q is false when both p and q are false and
is true otherwise.
Table displays the truth table for p q.
p q p∨q
T T T
T F T
F T T
F F F
Propositions
p q p∨q
T T T
T F T
F T T
F F F
Propositions
Solution:
This statement means that students who have taken both calculus and
introductory computer science can take the class, as well as the students who have
taken only one of the two subjects. Hence, this statement can be expressed as p q,
the inclusive or, or disjunction, of p and q.
Propositions
Definition 4
• Let p and q be propositions. The exclusive or of p and q, denoted by p q (or p
XORq ), is the proposition that is true when exactly one of p and q is true and is
false otherwise.Table displays the truth table for p q.
•The truth table for the exclusive or of two propositions is displayed.
p q p⊕q
T T F
T F T
F T T
F F F
Propositions
Example 7: Let p and q be the propositions that state “A student can have a salad
with dinner” and “A student can have soup with dinner,” respectively. What is p q,
the exclusive or of p and q?
Solution:
The exclusive or of p and q is the statement that is true when exactly one of p
and q is true. That is, p q is the statement “A student can have soup or salad, but
not both, with dinner.”
Note that this is often stated as “A student can have soup or a salad with dinner,”
without explicitly stating that taking both is not permitted.
Propositions
Example 7: Let p and q be the propositions that state “A student can have a salad
with dinner” and “A student can have soup with dinner,” respectively. What is p q,
the exclusive or of p and q?
Solution:
The exclusive or of p and q is the statement that is true when exactly one of p
and q is true. That is, p q is the statement “A student can have soup or salad, but
not both, with dinner.”
(p ¬q ) (q ¬p)
Definition 5
•Let p and q be propositions. The conditional statement p → q is the proposition “if p,
then q.” It asserts that q is true on the condition that p holds.A conditional statement
is also called an implication.
•The conditional statement p → q is false when p is true and q is false, and true
otherwise.
•In the conditional statement p → q, p is called the hypothesis (or antecedent or
premise) and q is called the conclusion (or consequence).
Implication
Assessment
•The truth table for the conditional statement p → q is shown in Table. Note that the
statement p → q is true when both p and q are true and when p is false (no matter
what truth value q has).
p q p→q
T T T
T F F
F T T
F F T
Expressions
Remark:
To remember that “p only if q” expresses the same thing as “if p, then
q,” note that “p only if q” says that p cannot be true when q is not true.
Conditional Statements
Example 8: Let p be the statement “Maria learns discrete mathematics” and q the
statement “Maria will find a good job.” Express the statement p → q as a statement in
English.
Solution:
When p is the statement “Maria learns discrete mathematics” and q is the
statement “Maria will find a good job,” p → q represents the statement:
“If Maria learns discrete mathematics, then she will find a good job.”
There are many other ways to express this conditional statement in English.
Among the most natural of these are:
“Maria will find a good job when she learns discrete mathematics.” and so on.
Converse, Contrapositive, and Inverse
Example 9: Find the contrapositive, the converse, and the inverse of the
conditional statement “The home team wins whenever it is raining.”
Solution:
Because “q whenever p” is one of the ways to express the conditional statement
p → q,the original statement can be rewritten as “If it is raining, then the home team
wins.”
•The contrapositive of this conditional statement is “If the home team does not win,
then it is not raining.”
•The converse is “If the home team wins, then it is raining.”
•The inverse is “If it is not raining, then the home team does not win.”
Biconditional statement
Definition 6
•Let p and q be propositions. The biconditional statement p q is the proposition
“p if and only if q.” The biconditional statement p q is true when p and q have
the same truth values, and is false otherwise. Biconditional statements are also
called bi-implications.
•The truth table for p q is shown in Table.
p q p→q
T T T
T F F
F T F
F F T
Biconditional statement
Example 10
•You can take the flight if and only if you buy a ticket
•Let p be the statement “you can take the flight”
• q to be proposition “you buy a ticket”.
The biconditional statement p q is the proposition “p if and only if q.”
p q p→q
T T T
T F F
F T F
F F T
Implicit Use of Biconditionals
We can use truth tables to determine the truth values of compound
propositions,as Example 10 illustrates.
Truth Tables of Compound Propositions
Solution:
The resulting truth table is shown in Table.
We will generally use parentheses to specify the order in which logical
operators in a compound proposition are to be applied.
•For instance, (p q) (¬r) is the conjunction of p q and ¬r.
•Because this rule may be difficult to remember, we will use parentheses so that the order of the
disjunction and conjunction operators is clear.
We will use parentheses when the order of the conditional operator and biconditional operator is at issue,
although the conditional operator has precedence over the biconditional operator.
4
Logic and Bit Operations
Logic and Bit Operations
We will also use the notation OR, AND, and XOR for the operators , ,
and , as is done in various programming languages.
Bit Operations
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.
Example 12: Find the bitwise OR, bitwise AND, and bitwise XOR of the bit
strings 01 1011 0110 and11 0001 1101. (Here, bit strings will be split into blocks of
four bits to make them easier to read.)
Solution:
The bitwise OR, bitwise AND, and bitwise XOR of these strings are obtained
by taking the OR, AND, and XOR of the corresponding bits, respectively. This
gives us
01 1011 0110
11 0001 1101
11 1011 1111 bitwise OR
01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR
5
Exercises
Exercises-Homwork 1
1. which of these are propositions?what are the truth values of these
propositions.
(1) Answer the question
(3) 5+7=10
(4) x+2=11
Exercises-Homwork 2
2. Symbolize the following propositions
(1) A red bean bun is made from flour and red beans.
(2) Apple trees and pear trees are both deciduous trees.
(3) Either Wang Xiaohong or Li Daming is a member of the physics group.
(4) Either Wang Xiaohong or Li Daming is a member of the physics group, but not
both.
(5) He was late due to traffic congestion.
(6) If there is no traffic congestion, he will not be late.
(7) He is not late, so there is no traffic congestion.
(8) He will not be late unless there is traffic congestion.
(9) He is late if and only if there is traffic congestion.