0% found this document useful (0 votes)
20 views54 pages

Dis Crete Mathem Atic S: Presenter Yukun Wang Computer Science and Technology

Uploaded by

frogboynayeem
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)
20 views54 pages

Dis Crete Mathem Atic S: Presenter Yukun Wang Computer Science and Technology

Uploaded by

frogboynayeem
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/ 54

Discrete mathematics

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

Discrete mathematics - deals with discrete quantitative relationships and


discrete structures.

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

Coloring of plan Graph matching


About course-first section

Mathematical logic, is to introduce a set of symbolic system of methods, so


mathematical logic is also called symbolic logic
Major scientific events in curriculum formation
formal logic
Mid-17th century
G.W.Leibnitz.: Founded by German mathematician
G.Boole, British mathematician: Boolean algebra Symbolic system Rules
F.L.G.Frege, German mathematician: Quantifiers and
constraint arguments
mathematicl logic
K.Godel, American mathematician: The completeness theorem
G.Peano, Italian mathematician
A.Demoorgen:British mathematician de Morgan,
Russell (B.A.Russell).

Object: The formal system after symbolizing


the two intuitive concepts of proof and calculation.
Gottfried Wilhelm
Leibniz
About course-first section

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

•logical operators : negation/ conjunction/disjunction/conditional


statement/biconditional statement

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

•Besides the importance of logic in understanding mathematical reasoning, logic has


numerous applications to computer science. These rules are used in the design of
computer circuits,the construction of computer programs, and in many other ways.

•Our discussion begins with an introduction to the basic building blocks-


propositions.
Propositions
Propositions
• A proposition is a declarative sentence (that is, a sentence that declares a fact)
that is either true or false, but not both.

Example 1: All the following declarative sentences are propositions.


• 1. Washington, D.C., is the capital of the United States of America.
• 2. Toronto is the capital of Canada.
• 3. 1 + 1 = 2.
• 4. 2 + 2 = 3.

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

Proposition:, declarative sentence, can declare true or false


Determine whether the following sentences are propositions
(1) √2 is a rational number. 
(2) 2 + 5 = 7. 
(3) x + 5 > 3. 
(4) Are you going to the classroom? 
(5) What a big apple!  imperative sentence
(6) Please don't talk! 
(7) There is water on Mars. 
(8) Heavy snow on New Year's Day in 2050. 
(9) I'm telling a lie. 
Propositions
Some Concepts
•propositional variables(or sentential variables)
The conventional letters used for propositional variables are p, q, r, s, … .(lower
case letters)
•The truth value of a proposition.
denoted by T, if it is a true proposition,
denoted by F, if it is a false proposition.
•Atomic propositions (simple propositions):Propositions that cannot be expressed
in terms of simpler propositions .
•Compound propositions: are formed from existing propositions using logical
operators.
Propositions
 There are five logical operators.(connectives)

¬ 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

Example 4: Find the negation of the proposition“Vandana’s smartphone has at least


32 GB of memory” and express this in simple English.

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

The Truth Table for the Negation of a Proposition.

p ¬p

T F
F T
Propositions-logical operators

The negation of a proposition can also be considered the result of the


operation of the negation operator on a proposition.

The negation operator constructs a new proposition from a single


existing proposition
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.

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

The truth table

The Truth Table for the Conjunction of Two Propositions.

p q p∧q

T T T
T F F
F T F
F F F
Propositions

Example 5: Find the conjunction of the propositions p and q where


p is the proposition “Rebecca’s PC has more than 16 GB free hard disk space”
and q is the proposition “The processor in Rebecca’s PC runs faster than 1
GHz.”

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

The Truth Table for the Disjunction of Two Propositions.

p q p∨q

T T T
T F T
F T T
F F F
Propositions

A disjunction is true when at least one of the two propositions is true.


That is, p q is true when both p and q are true or when exactly one of p
and q is true.

The Truth Table for the Disjunction of Two Propositions.

p q p∨q

T T T
T F T
F T T
F F F
Propositions

Example 6: Translate the statement


“Students who have taken calculus or introductory computer science can take this
class”
in a statement in propositional logic using the propositions
p: “A student who has taken calculus can take this class” and
q: “A student who has taken introductory computer science can take this class.”

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

The Truth Table for the Exclusive Or of Two Propositions.

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)

thus, to simple the symbols in the compound propositions, in the futhure we


oftenl use this disjunction proposition to express exclusive or
2
Conditional Statements
Conditional Statements

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).

The Truth Table for the Conditional Statement p → q.

p q p→q

T T T
T F F
F T T
F F T
Expressions

The most of the following ways to express p → q:


•“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” “q provided that p”
Conditional Statements

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

Converse, Contrapositive, and Inverse


•The proposition q → p is called the converse of p → q.
•The contrapositive of p → q is the proposition ¬q → ¬p.
•The proposition ¬p → ¬q is called the inverse of p → q.
• These three conditional statements formed from p → q, only the contrapositive
always has the same truth value as p → q.
Conditional Statements

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

The Truth Table for the Biconditional p q.

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

The Truth Table for the Biconditional p q.

p q p→q

T T T
T F F
F T F
F F T
Implicit Use of Biconditionals

Biconditionals are not always explicit in natural language. In particular,


the “if and only if” construction used in biconditionals is rarely used in
common language.
Instead, biconditionals are often expressed using an “if, then” or an “only
if” construction.The other part of the “if and only if” is implicit.
Examples:
•“If you finish your meal, then you can have dessert.” What is really meant is “You
can have dessert if and only if you finish your meal.”
•This last statement is logically equivalent to the two statements “If you finish your
meal, then you can have dessert” and “You can have dessert only if you finish your
meal.”
Truth Tables of Compound Propositions

We can use truth tables to determine the truth values of compound
propositions,as Example 10 illustrates.
Truth Tables of Compound Propositions

Example 11: Construct the truth table of the compound proposition


(p ¬q) → (p q)

Solution:
The resulting truth table is shown in Table.

The Truth Table of (p ∨ ¬ q) → (p ∧ q).


p q ¬q p ∨ ¬q p∧q (p ∨ ¬q) → (p ∧ q)
T T F T T T
T F T T F F
F T F F F T
F F T T F F
3
Precedence of Logical Operators
Precedence of Logical Operators

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

 the negation operator is applied before all other logical operators.


Another general rule of precedence is that the conjunction operator takes
precedence over the disjunction operator.
The conditional and biconditional operators, → and ,have lower
precedence and .
Precedence of Logical Operators

Table displays the precedence levels of the logical operators, ¬, , , →,


and .

Precedence of Logical Operators


Operator Precedence
¬ 1
∧ 2
∨ 3
→ 4
5

•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

Computers represent information using bits. A bit is a symbol with two


possible values, namely, 0 (zero) and 1 (one).

 As is customarily done, we will use a 1 bit to represent true and a 0 bit


to represent false. That is, 1 represents T (true), 0 represents F (false). A
variable is called a Boolean variable if its value is either true or false.
Bit Operations

Computer bit operations correspond to the logical connectives. By


replacing true by a one and false by a zero in the truth tables for the
operators , , and , the columns in Table for the corresponding bit
operations are obtained.

We will also use the notation OR, AND, and XOR for the operators , ,
and , as is done in various programming languages.
Bit Operations

Table for the Bit Operators OR,AND,and XOR.


x y x∨y x∧y x⊕y
0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 0
Bit string

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

We can extend bit operations to bit strings.


We use the symbols , , and to represent the bitwise OR, bitwise
AND, and bitwise XOR operations, respectively.
We illustrate bitwise operations on bit strings with Example 11.
Bit 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

(2) The moon is made of green cheese

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy