0% found this document useful (0 votes)
40 views77 pages

Ch01-Lecture 1&2 (Week 1)

This document provides an overview of a discrete structures course, including topics like logic, sets, functions, and proofs. It details the grading breakdown and chapters to be covered, including an introduction to propositional logic and compound propositions using logical operators. Truth tables are presented as a way to determine the truth values of compound statements.

Uploaded by

o si
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)
40 views77 pages

Ch01-Lecture 1&2 (Week 1)

This document provides an overview of a discrete structures course, including topics like logic, sets, functions, and proofs. It details the grading breakdown and chapters to be covered, including an introduction to propositional logic and compound propositions using logical operators. Truth tables are presented as a way to determine the truth values of compound statements.

Uploaded by

o si
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/ 77

CS1101

Discrete Structures I
Chapter 01
The Foundations: Logic and Proofs

1
Course Information

• Grading:

– Participation: 10%
– Assignments and Quizzes : 20%
– Midterm Exam: 20%
– Final Exam: 50%

• Total score that can be achieved: 100

2
Lectures Reference

Textbook 2018

3
DM is a Gateway Course

Topics in discrete mathematics will be important in many


courses that you will take in the future:
• Computer Science: Computer Architecture, Data Structures,
Algorithms, Programming Languages, Compilers, Computer
Security, Databases, Artificial Intelligence, Networking,
Graphics, Game Design, Theory of Computation, ……
• Mathematics: Logic, Set Theory, Probability, Number
Theory, Abstract Algebra, Combinatorics, Graph Theory,
Game Theory, Network Optimization, …
• Other Disciplines: You may find concepts learned here
useful in courses in philosophy, economics, linguistics, and
other departments.
4
Course Syllabus
• The Foundations: Logic and Proofs.
• Basic Structures: Sets, Functions, Sequences, and Sums.
• Induction and Recursion.

5
Chapter 1: Logic
• Introduction to Propositional Logic.
• Compound Propositions.
• Applications of Propositional Logic.
• Propositional Equivalences.

6
Introduction to Propositional Logic (1/4)

What is Logic?
• Logic is the discipline that deals with the methods of
reasoning.
• On an elementary level, logic provides rules and
techniques for determining whether a given argument is
valid.
• Logical reasoning is used in mathematics to prove
theorems.

7
Introduction to Propositional Logic (2/4)

• The basic building blocks of logic is Proposition


• A proposition (or statement) is a declarative sentence
that is either true or false, but not both.
• The area of logic that deals with propositions is called
propositional logics.

8
Introduction to Propositional Logic (3/4)

Examples:
Propositions Truth value
2 + 3 =5 True
5 − 2 =1 False
Today is Friday False
𝑥+3 =7 , for 𝑥 = 4 True
Cairo is the capital of Egypt True

Sentences Is a Proposition
What time is it? Not propositions
Read this carefully. Not propositions
𝑥+3 =7 Not propositions

9
Introduction to Propositional Logic (4/4)

• We use letters to denote propositional variables


𝒑, 𝒒, 𝒓,𝒔, …
• The truth value of a proposition is true, denoted by T, if
it is a true proposition and false, denoted by F, if it is a
false proposition.

10
Compound Propositions (1/23)

Compound Proposition
• Compound Propositions are formed from existing
propositions using logical operators.

11
Compound Propositions (2/23)

Negation

Other notations you might see are

12
Compound Propositions (3/23)

Example
Find the negation of the proposition
𝑝: “Cairo is the capital of Egypt”

13
Compound Propositions (4/23)

Example: Solution
Find the negation of the proposition
𝑝: “Cairo is the capital of Egypt”
The negation is
¬𝑝: “It is not the case that Cairo is the capital of Egypt”
This negation can be more simply expressed as
¬𝑝: “Cairo is not the capital of Egypt”

14
Compound Propositions (5/23)

Truth Table
• Truth Table: is a table that gives the truth values of a compound
statement.

The Truth Table for the Negation of a Proposition

𝒑 ¬𝒑
Proposition
𝑇
Truth Values 𝐹

15
Compound Propositions (5/23)

Truth Table
• Truth Table: is a table that gives the truth values of a compound
statement.

The Truth Table for the Negation of a Proposition

𝒑 ¬𝒑
Proposition
𝑇 𝐹
Truth Values 𝐹 𝑇

16
Compound Propositions (6/23)

Negation

17
Compound Propositions (7/23)

Logical Connectives

Example

𝑝: Today is Friday.
𝑞: It is raining today.
𝑝 ∧ 𝑞: Today is Friday and it is
raining today.

18
Compound Propositions (8/23)

Logical Connectives

Example

𝑝: Today is Friday.
𝑞: It is raining today.
𝑝 ∨ 𝑞: Today is Friday or it
is raining today.

19
Compound Propositions (9/23)

Logical Connectives

Example

p : They are parents.


q : They are children.
p  q : They are parents or
children but not both.

20
Compound Propositions (10/23)

Logical Connectives

21
Compound Propositions (10/23)

Logical Connectives

22
Compound Propositions (11/23)

Logical Connectives
1

23
Compound Propositions (12/23)

Logical Connectives
2

24
Compound Propositions (12/23)

Logical Connectives
2

25
Compound Propositions (13/23)

Logical Connectives
3

26
Compound Propositions (13/23)

Logical Connectives
3

27
Compound Propositions (14/23)

Logical Connectives

28
Compound Propositions (15/23)

Truth Tables of Compound Propositions


1

29
Compound Propositions (16/23)

Truth Tables of Compound Propositions


1

30
Compound Propositions (16/23)

Truth Tables of Compound Propositions


1

31
Compound Propositions (16/23)

Truth Tables of Compound Propositions


1

32
Compound Propositions (16/23)

Truth Tables of Compound Propositions


1

33
Compound Propositions (16/23)

Truth Tables of Compound Propositions


1

34
Compound Propositions (17/23)

Precedence of Logical Operators

35
Compound Propositions (18/23)

Truth Tables of Compound Propositions


2

36
Compound Propositions (19/23)

Truth Tables of Compound Propositions


2

𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 →𝒓

37
Compound Propositions (19/23)

Truth Tables of Compound Propositions


2

𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 →𝒓

𝐓 𝐓 𝐓
𝐓 𝐓 𝐅
𝐓 𝐅 𝐓
𝐓 𝐅 𝐅
𝐅 𝐓 𝐓
𝐅 𝐓 𝐅
𝐅 𝐅 𝐓
𝐅 𝐅 𝐅

38
Compound Propositions (19/23)

Truth Tables of Compound Propositions


2

𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 →𝒓

𝐓 𝐓 𝐓 𝐅
𝐓 𝐓 𝐅 𝐅
𝐓 𝐅 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓
𝐅 𝐓 𝐓 𝐅
𝐅 𝐓 𝐅 𝐅
𝐅 𝐅 𝐓 𝐓
𝐅 𝐅 𝐅 𝐓

39
Compound Propositions (19/23)

Truth Tables of Compound Propositions


2

𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 →𝒓

𝐓 𝐓 𝐓 𝐅 𝐅
𝐓 𝐓 𝐅 𝐅 𝐅
𝐓 𝐅 𝐓 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓 𝐓
𝐅 𝐓 𝐓 𝐅 𝐅
𝐅 𝐓 𝐅 𝐅 𝐅
𝐅 𝐅 𝐓 𝐓 𝐅
𝐅 𝐅 𝐅 𝐓 𝐅

40
Compound Propositions (19/23)

Truth Tables of Compound Propositions


2

𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 →𝒓

𝐓 𝐓 𝐓 𝐅 𝐅 𝐓
𝐓 𝐓 𝐅 𝐅 𝐅 𝐓
𝐓 𝐅 𝐓 𝐓 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓 𝐓 𝐅
𝐅 𝐓 𝐓 𝐅 𝐅 𝐓
𝐅 𝐓 𝐅 𝐅 𝐅 𝐓
𝐅 𝐅 𝐓 𝐓 𝐅 𝐓
𝐅 𝐅 𝐅 𝐓 𝐅 𝐓

41
Compound Propositions (20/23)

Logic and Bit Operations


• Computers represent information using bits. A bit is a
symbol with two possible values, namely, 0 (zero) and 1
(one).

42
Compound Propositions (21/23)

Computer Bit Operations


• We will also use the notation OR, AND, and XOR for
the operators ∨, ∧, and ⊕ , as is done in various
programming languages.

43
Compound Propositions (22/23)

Bit Strings
• Information is often represented using bit strings, which
are lists of zeros and ones. When this is done, operations
on the bit strings can be used to manipulate this
information.

44
Compound Propositions (23/23)

Example
• Find the bitwise OR, bitwise AND, and bitwise XOR of
the bit strings 01 1011 0110 and 11 0001 1101

45
Applications of Propositional Logic (1/13)

1- Translating English Sentences.

2- System Specifications.

3- Boolean Searches.

4- Logic Puzzles.

5- Logic Circuits.

46
Applications of Propositional Logic (1/13)

1- Translating English Sentences.

2- System Specifications.

3- Boolean Searches.

4- Logic Puzzles.

5- Logic Circuits.

47
Applications of Propositional Logic (1/13)

Translating English Sentences


• There are many reasons to translate English sentences
into expressions involving propositional variables and
logical connectives. In particular, English (and every
other human language) is often ambiguous. Translating
sentences into compound statements (and other types of
logical expressions, which we will introduce later in this
chapter) removes the ambiguity.

48
Applications of Propositional Logic (3/13)

Example 1
You can access the Internet from campus only if you are a
computer science major or you are not a student.

49
Applications of Propositional Logic (4/13)

Example 1
You can access the Internet from campus only if you are a
computer science major or you are not a student.

Let 𝑝, 𝑞 and 𝑟 be the propositions:

𝑝: You can access the Internet from campus.


𝑞: You are a computer science major.
𝑟: You are a student.

50
Applications of Propositional Logic (4/13)

Example 1
(You can access the Internet from campus) only if (you are
a computer science major or you are not a student).

Let 𝑝, 𝑞 and 𝑟be the propositions: 𝑝 →𝑞

𝑝: You can access the Internet from campus.


𝑞: You are a computer science major.
𝑟: You are a student.

51
Applications of Propositional Logic (5/13)

Example 1
(You can access the Internet from campus) only if (you are
a computer science major or you are not a student).

Let 𝑝, 𝑞 and 𝑟be the propositions: 𝑝 →𝑞

𝑝: You can access the Internet from campus.


𝑞: You are a computer science major.
𝑟: You are a student.
The sentence can be represented by logic 𝑝 →(𝑞 ∨ ¬𝑟)
as
52
Applications of Propositional Logic (6/13)

Example 2
The automated reply cannot be sent when the file system is
full.

53
Applications of Propositional Logic (7/13)

Example 2
The automated reply cannot be sent when the file system is
full.

Let 𝑝 and 𝑞 be the propositions: 𝑝 →𝑞

𝑝: The automated reply can be sent .


𝑞: The file system is full.

54
Applications of Propositional Logic (8/13)

Example 2
(The automated reply cannot be sent) when (the file system
is full.)

Let 𝑝 and 𝑞 be the propositions: 𝑝 →𝑞

𝑝: The automated reply can be sent .


𝑞: The file system is full.

The sentence can be represented by logic 𝑞 →¬𝑝


as

55
Applications of Propositional Logic (9/13)

Logic Circuits
• A logic circuit (or digital circuit) receives input signals
𝑝1 , 𝑝2 , … , 𝑝𝑛 , each a bit [either 0 (off) or 1 (on)], and
produces output signals 𝑠1, 𝑠2, … , 𝑠𝑛, each a bit.
• In this course, we will restrict our attention to logic
circuits with a single output signal; in general, digital
circuits may have multiple outputs.

56
Applications of Propositional Logic (10/13)

Logic Circuits
• Complicated digital circuits can be constructed from
three basic circuits, called gates.

57
Applications of Propositional Logic (11/13)

Example 1
• Determine the output for the combinatorial circuit in the
following figure.

58
Applications of Propositional Logic (11/13)

Example 1
• Determine the output for the combinatorial circuit in the
following figure.

59
Applications of Propositional Logic (11/13)

Example 1
• Determine the output for the combinatorial circuit in the
following figure.

60
Applications of Propositional Logic (11/13)

Example 1
• Determine the output for the combinatorial circuit in the
following figure.

61
Applications of Propositional Logic (12/13)

Example 2
• Build a digital circuit that produces the output
(𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟))
when given input bits 𝑝, 𝑞, and 𝑟.

62
Applications of Propositional Logic (13/13)

Example 2
(𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟))

63
Applications of Propositional Logic (13/13)

Example 2
(𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟))

64
Applications of Propositional Logic (13/13)

Example 2
(𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟))

65
Compound Propositions Classification (1/2)

A compound proposition A compound proposition


A compound proposition
that is always true that is sometimes true
that is always false
and sometimes false

66
Compound Propositions Classification (2/2)

Example:
• Show that following conditional statement is a tautology
by using truth table
𝑝 ∧ 𝑞 →𝑝

𝒑 𝒒 𝒑 ∧𝒒 𝒑 ∧ 𝒒 →𝒑

67
Compound Propositions Classification (2/2)

Example:
• Show that following conditional statement is a tautology
by using truth table
𝑝 ∧ 𝑞 →𝑝

𝒑 𝒒 𝒑 ∧𝒒 𝒑 ∧ 𝒒 →𝒑

𝐓 𝐓 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓
𝐅 𝐓 𝐅 𝐓
𝐅 𝐅 𝐅 𝐓

68
Logical Equivalences (1/6)

Logically equivalent:

Compound propositions that have the same truth values in


all possible cases are called logically equivalent.


69
Logical Equivalences (2/6)

Example1:

70
Logical Equivalences (3/6)

Example1:

71
Logical Equivalences (3/6)

Example1:

72
Logical Equivalences (3/6)

Example1:

73
Logical Equivalences (3/6)

Example1:

74
Logical Equivalences (3/6)

Example1:

75
Logical Equivalences (3/6)

Example1:

76
Next class

•1.4 Predicates and Quantifiers


•1.5 Nested Quantifiers
•1.6 Rules of Inference

77

You might also like