CSC 102 Midterm
CSC 102 Midterm
Discrete Structures 1
CSC 102 - Discrete Structures 1
OBJECTIVES
UNDERSTAND THE BASIC
KNOW THE BASIC CONCEPTS
PRINCIPLES OF SETS AND
OF SET & SUBSETS
OPERATIONS IN SETS
DESIGN & PRESENTS THE SETS
ELEMENTS VIA VENN PROVE BASIC SET EQUALITIES
DIAGRAMS
PERFORM COUNTING
PERFORM SETS OPERATIONS PRINCIPLES ON SETS
FOR SOLVING PROBLEMS
RELATED TO IT
TOPIC 1. SET THEORY
CSC 102 - Discrete Structures 1
SETS, ELEMENTS
& SUBSETS
SET THEORY
CSC 102 - Discrete Structures 1
SETS
A set is a collection of
objects. Example: The equation
• Objects are sometimes A = {1, 2, 3, 4} (1.1.1)
referred to as elements or Describes a Set A made up of the four elements
1, 2, 3, and 4.
members.
CSC 102 - Discrete Structures 1
SETS
CSC 102 - Discrete Structures 1
Example:
A set may contain any A = {4.5, Lady Gaga, 𝜋, 14}
kind of elements It consist of four elements:
whatsoever, and they the number 4.5, the
need not be of the person Lady Gaga, the
same “type”. number 𝜋(=3.1415…), and
the number 14.
SETS
CSC 102 - Discrete Structures 1
EXAMPLES
ROSTER/TABULATION METHOD RULE / DESCRIPTIVE METHOD
Read as A is equals to 3, 6, and 9. Read as B equals the set of all x such that x
is an odd positive integers.
The vertical line | is read as “such that”
and (,) as “and.” Note that the property
appears after the vertical line.
Joint Sets. Sets with at least Disjoint Sets. Sets that have no
one common element. common element.
EXAMPLE EXAMPLE
Let A = {1, 2, 3, 6} and Let C = {x | x is the set of even
B = {1, 3, 9}. numbers}
A and B are Joint Sets. and let D = {x | x is the set of odd
numbers}.
C and D are Disjoint Sets.
CSC 102 - Discrete Structures 1
OPERATIONS ON SETS
EXAMPLE
Disjoint Union
A∩B=∅
Recall that sets A and B are said
Supposed, S = A ∪ B
to be disjoint or
Then S is called the disjoint union
nonintersecting if they have no
of A and B
elements in common.
CSC 102 - Discrete Structures 1
OPERATIONS ON SETS
Complement of set A [denoted EXAMPLE
by A’, Ac]. The set of elements Let U = {a, b, c, d, e} and its
found in the universal set but subsets A={a, b, c, d} and B = {c,
not in set A. d, e}. Find, A’.
• In symbol:
A’ = {x | x ∈ U and x ∉ A} U = {a, b, c, d, e} A={a, b, c, d}
A’ = { e }
CSC 102 - Discrete Structures 1
OPERATIONS ON SETS
Difference of sets A and B EXAMPLE
[denoted by A-B, A\B]. The A = {a, b, c, d}, B = {c, d, e},
set whose elements are found find A-B.
in set A but not in set B.
• In symbol: A – B = { a, b }
A – B = A ∩ B’ = B–A={e}
{x : x ∈ A and x ∉ B}
CSC 102 - Discrete Structures 1
OPERATIONS ON SETS
Symmetric Difference EXAMPLE
The symmetric difference of A = {1, 2, 3, 4, 5} B = {2, 5}
sets A and B, denoted by A ⊕ B, Find A ⊕ B
consists of those elements
which belong to A or B but not A ⊕ B = { 1, 3, 4 }
to both
• In symbol:
A ⊕ B = (A ∪ B)\(A ∩ B) or
A ⊕ B = (A\B) ∪ (B\A)
CSC 102 - Discrete Structures 1
OPERATIONS ON SETS
Cartesian Product of two sets EXAMPLE
A and B, denoted by A×B. The Given A = {1, 2, 3} and B = {c, d}.
set of all ordered pairs (a, b) Find A × B and B × A.
where a ∈ A and b ∈ B.
• In rule form, A × B = {(1, c), (1, d), (2, c), (2, d), (3,
A × B = {(a, b) | a ∈ A and b ∈ B} c), (3, d)}
SETS
K. De Morgan’s laws for sets: (A ∪ B)’ = A’ ∩ B’ ,(A ∩ B)’ = A’ ∪ B’
CSC 102 - Discrete Structures 1
ASSOCIATIVE
A ∪ B = { 1, 2, 3, 4, 5 }
LAWS ∪ C = { 5, 6, 7 }
(A ∪ B) ∪ C = { 1, 2, 3, 4,
Associative Law for Union (∪):
5, 6, 7}
(A ∪ B) ∪ C = A ∪ (B ∪ C)
(B ∪ C) = { 3, 4, 5, 6, 7 }
EXAMPLE ∪ A = { 1, 2, 3 }
Set A = {1, 2, 3}
Set B = {3, 4, 5}
A ∪ (B ∪ C) = { 1, 2, 3, 4,
Set C = {5, 6, 7} 5, 6, 7 }
CSC 102 - Discrete Structures 1
ASSOCIATIVE
LAWS Associative Law for Intersection (∩):
(A ∩ B) ∩ C = A ∩ (B ∩ C)
EXAMPLE
Set A = {1, 2, 3} (A ∩ B) = { 3 } A ∩ = { 1, 2, 3}
Set B = {3, 4, 5} ∩ C = { 5, 6, 7 } (B ∩ C) = {5}
Set C = {5, 6, 7} (A ∩ B) ∩ C = {} A ∩ (B ∩ C) = {}
CSC 102 - Discrete Structures 1
COMMUTATIVE EXAMPLE
Set A = {1, 2, 3}
LAWS Set B = {3, 4, 5}
A∪B=B∪A B ∪ A = { 3, 4, 5, 1, 2 }
DISTRIBUTIVE
LAWS Distributive Law for Union (∪):
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
EXAMPLE (A ∪ B) = { 1, 2, 3, 4, 5}
(B ∩ C) = { 5 }
Set A = {1, 2, 3} (A ∪ C) = { 1, 2, 3, 5, 6, 7 }
A ∪ (B ∩ C) =
Set B = {3, 4, 5} (A ∪ B) ∩ (A ∪ C) =
Set C = {5, 6, 7} { 1, 2, 3, 5 }
{ 1, 2, 3, 5 }
CSC 102 - Discrete Structures 1
DISTRIBUTIVE
LAWS Distributive Law for Intersection (∩):
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
EXAMPLE (B ∪ C) = (A ∩ B) = { 3 }
Set A = {1, 2, 3} { 3, 4, 5, 6, 7 } (A ∩ C) = { }
Set B = {3, 4, 5}
A ∩ (B ∪ C) = { 3 } (A ∩ B) ∪ (A ∩ C)
Set C = {5, 6, 7}
={3}
CSC 102 - Discrete Structures 1
A∪∅=A A ∪ ∅ = { 1, 2, 3 }
EXAMPLE
Identity Law for Intersection (∩): Let U = { 1, 2, 3, 4,
5, 6, 7 }
A∩U=A Set A = {1, 2, 3}
A ∩ U = { 1, 2, 3 }
CSC 102 - Discrete Structures 1
LAWS A ∩ A’ = ∅
Complement Law for Union (∪):
EXAMPLE
A ∪ A’ = U Let U = { 1, 2, 3, 4,
5, 6, 7 }
EXAMPLE Set A = {1, 2, 3} A ∩ A’ = { }
Let U = { 1, 2, 3, 4, A’ = { 4, 5, 6, 7 }
5, 6, 7 } A ∪ A’ = { 1, 2, 3,
Set A = {1, 2, 3} 4, 5, 6, 7 }
CSC 102 - Discrete Structures 1
LAWS A∩A=A
EXAMPLE
Idempotent Law for Union (∪):
Set A = {1, 2, 3}
A∪A=A A ∩ A = { 1, 2, 3,}
EXAMPLE
Set A = {1, 2, 3}
A ∪ A = { 1, 2, 3,}
CSC 102 - Discrete Structures 1
BOUND LAWS
Bound Law for Union (∪): Bound Law for
Intersection (∩):
A∪U=U
EXAMPLE A∩∅=∅
Let U = { 1, 2, 3, 4,
EXAMPLE
5, 6, 7 }
Set A = {1, 2, 3}
Set A = {1, 2, 3}
A ∪ ∅ ={}
A ∪ U = { 1, 2, 3, 4, 5, 6, 7}
CSC 102 - Discrete Structures 1
ABSORPTION EXAMPLE
Set A = {1, 2, 3}
LAWS Set B = {3, 4, 5}
Absorption Law for
Absorption Law for Union (∪): Intersection (∩):
A ∪ (A ∩ B) = A A ∩ (A ∪ B) = A
A∩B={3} ( A ∪ B ) = { 1, 2, 3, 4, 5 }
A ∪ (A ∩ B) = { 1, 2, 3 } A ∩ ( A ∪ B ) = { 1, 2, 3 }
CSC 102 - Discrete Structures 1
A’ = { 4, 5, 6, 7 }
∅’ = { 1, 2, 3, 4,
(A’)’ = { x | x is not in { 4,
5, 6, 7 }
5, 6, 7 }}
U’ = {}
= { 1, 2, 3 }
CSC 102 - Discrete Structures 1
DE MORGAN’S EXAMPLE
Let U = { 1, 2, 3, 4, 5, 6, 7 }
LAWS FOR SETS Set A = {1, 2, 3} Set B = {3, 4, 5}
COUNTING PRINCIPLES,
CLASSES OF SETS
SET THEORY
CSC 102 - Discrete Structures 1
FINITE INFINITE
1. Empty Set Set B consists of even positive
2. Set A consists of the days of integers
the week.
COUNTING PRINCIPLES
CSC 102 - Discrete Structures 1
EXAMPLES:
COUNTING PRINCIPLES
CSC 102 - Discrete Structures 1
EXAMPLE
The population of Alaska is 830, of which 250 are adult females and 380 are
children.
LET:
U = residents of Alaska
A = adults A. |A| = |U| - |C| = 830 – 380 = 450
F = female adults B. |M| = |A| - |F| = 450 – 250 = 200
M = male adults C. |F ∪ C| = |F| + |C| - |F ∩ C| = 250 + 380 – 0 = 630
C = children
Classes of Sets
• Given a set S, we might wish to talk about some of its
subsets, we will speak of a class of sets or collection of
sets.
EXAMPLE
Let A be the class of subsets of S which contain
exactly three elements of S.
S = { 1, 2, 3, 4 }
A = [{1, 2, 3},{1, 2, 4},{1, 3, 4},{2, 3, 4}]
COUNTING PRINCIPLES
CSC 102 - Discrete Structures 1
PARTITIONS
• Let S a non-empty set.
EXAMPLE • A partition of S is a subdivision of
S = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } S into nonoverlapping, non-
Identify the partition of S: empty subsets.
• Precisely, a partition of S
1. [{1, 3, 5}, {2,6}, {4,8,9}] collection {𝐴𝑖 } of non empty set
2. [{1, 3, 5}, {2, 4, 6, 8}, {7,9}] subsets.
3. [{1, 3, 5}, {2, 4, 6, 8}, {5, 7, 9}]
SET THEORY
CSC 102 - Discrete Structures 1
OBJECTIVES
WRITE AN ARGUMENT USING LOGICAL NOTATION
AND DETERMINE IF THE ARGUMENT IS OR IS NOT
VALID.
PROPOSITIONS
A proposition is a
EXAMPLES
declarative sentence (that
All the following declarative sentences are
is, a sentence that declares propositions.
a fact) that is either true or 1. Washington, D.C., is the capital of the United
States of America.
false, but not both. 2. Toronto is the capital of Canada.
3. 1 + 1 = 2.
4. 2 + 2 = 3.
EXAMPLES
1. What time is it?
2. Read this carefully.
3. x + 1 = 2.
4. x + y = z.
PROPOSITIONS
CSC 102 - Discrete Structures 1
PROPOSITIONS
CSC 102 - Discrete Structures 1
DEFINITION 1
• Let p be a proposition. EXAMPLE
• The negation of p, denoted by ¬p Find the negation of the proposition:
“Michael’s PC runs Linux”
(also denoted by p), is the and express this in simple English.
statement “It is not the case that ANSWER: The negation is
p.” “It is not the case that Michael’s PC
runs Linux.”
• The proposition ¬p is read “not p.” This negation can be more simply
• The truth value of the negation of expressed as
“Michael’s PC does not run Linux.”
p, ¬p, is the opposite of the truth
value of p.
PROPOSITIONS
CSC 102 - Discrete Structures 1
DEFINITION 2
• Let p and q be propositions. Connectives – the
• The conjunction of p and q, logical operators
denoted by p ∧ q, is the that are used to form
proposition “p and q.” new propositions
from two or more
• The conjunction p ∧ q is true
existing propositions.
when both p and q are true and is
false otherwise.
EXAMPLE
Find the conjunction of the ANSWER:
propositions p and q, where p The conjunction of these propositions, p ∧ q, is the
proposition “Rebecca’s PC has more than 16 GB
is the proposition “Rebecca’s free hard disk space, and the processor in
PC has more than 16 GB free Rebecca’s PC runs faster than 1 GHz.”
hard disk space” and q is the This conjunction can be expressed more simply as “Rebecca’s
proposition “The processor in 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
Rebecca’s PC runs faster conditions given must be true. It is false, when one or both of
than 1 GHz.” these conditions are false.
DEFINITION 3 EXAMPLE
Find the disjunction of the
• Let p and q be propositions. propositions p and q, where
• The disjunction of p and q, p is the proposition
denoted by p ∨ q, is the “Rebecca’s PC has more
than 16 GB free hard disk
proposition “p or q.” space” and q is the
• The disjunction p ∨ q is false proposition “The processor
in Rebecca’s PC runs faster
when both p and q are false and than 1 GHz.”
is true otherwise.
ANSWER:
The disjunction of p and q, p ∨ q, is the proposition
“Rebecca’s PC has at least 16 GB free hard disk
space, or the processor in Rebecca’s PC runs faster
than 1 GHz.”
• This proposition is true when Rebecca’s PC has at least 16 GB free hard disk
space, when the PC’s processor runs faster than 1 GHz, and when both
conditions are true.
• It is false when both of these conditions are false, that is, when Rebecca’s PC
has less than 16 GB free hard disk space and the processor in her PC runs at 1
GHz or slower.
DEFINITION 4
• Let p and q be propositions.
• The conditional statement p → q is the proposition “if p,
then q.”
• 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).
CONDITIONAL STATEMENTS
CSC 102 - Discrete Structures 1
DEFINITION 4
EXAMPLE 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.
ANSWER:
“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.”
• “For Maria to get a good job, it is sufficient for her to learn discrete mathematics.” and
• “Maria will find a good job unless she does not learn discrete mathematics.”
CONDITIONAL STATEMENTS
CSC 102 - Discrete Structures 1
DEFINITION 4
CONDITIONAL STATEMENTS
CSC 102 - Discrete Structures 1
CONDITIONAL STATEMENTS
CSC 102 - Discrete Structures 1
EXAMPLE What are the contrapositive, the converse, and the inverse of the
conditional statement : “The home team wins whenever it is raining?”
DEFINITION 5
• 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.
BICONDITIONALS
CSC 102 - Discrete Structures 1
DEFINITION 5
EXAMPLE ANSWER: “You can take the flight if and
Let p be the only if you buy a ticket.”
• This statement is true if p and q are either both true or
statement “You
both false, that is, if you buy a ticket and can take the
can take the flight or if you do not buy a ticket and you cannot take
flight,” and let q the flight.
be the • It is false when p and q have opposite truth values,
statement “You that is, when you do not buy a ticket, but you can take
the flight (such as when you get a free trip) and when
buy a ticket.”
you buy a ticket but you cannot take the flight (such
Then p ↔ q is as when the airline bumps you).
the statement
BICONDITIONALS
CSC 102 - Discrete Structures 1
BICONDITIONALS
CSC 102 - Discrete Structures 1
EXAMPLE Construct the truth table of the compound proposition (p ∨ ¬q) → (p ∧ q).
COMPOUND PROPOITIONS
CSC 102 - Discrete Structures 1
EXAMPLE Construct the truth table of the compound proposition (p ∨ ¬q) → (p ∧ q).
Because this truth table involves two propositional variables p and q, there are four
rows in this truth table, one for each of the pairs of truth values TT, TF, FT, and FF.
• The first two columns are used for the truth values of p and q, respectively.
• In the third column we find the truth value of ¬q, needed to find the truth value of p ∨
¬q, found in the fourth column.
• The fifth column gives the truth value of p ∧ q. Finally, the truth value of (p ∨ ¬q) → (p
∧ q) is found in the last column.
The resulting truth table is shown in Table 7. COMPOUND PROPOITIONS
CSC 102 - Discrete Structures 1
CSC 102 - Discrete Structures 1
CSC 102 - Discrete Structures 1
BASIC LOGICAL
OPERATIONS
LOGIC PART 1
CSC 102 - Discrete Structures 1
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:
101010011 is a bit string of length nine
o We can extend bit operations to bit strings. Find the bitwise OR, bitwise AND, and
o We define the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 01 1011 0110
bitwise XOR of two strings of the same and 11 0001 1101.
length to be the strings that have as their
01 1011 0110
bits the OR, AND, and XOR of the
11 0001 1101
corresponding bits in the two strings, 11 1011 1111 bitwise OR
respectively. 01 0001 0100 bitwise AND
o We use the symbols ∨, ∧, and ⊕ to represent 10 1010 1011 bitwise XOR
the bitwise OR, bitwise AND, and bitwise XOR
operations, respectively.
Logic and Bit Operations
CSC 102 - Discrete Structures 1
TAUTOLOGIES &
CONTRADICTIONS
LOGIC PART 1
CSC 102 - Discrete Structures 1
Propositional Equivalences
o Methods that produce propositions with the same truth
value as a given compound proposition are used
extensively in the construction of mathematical
arguments.
o Note that we will use the term “compound proposition” to
refer to an expression formed from propositional
variables using logical operators, such as p ∧ q.
A compound proposition
that is always false. CONTRADICTION
A compound proposition that
CONTINGENCY is neither a tautology nor a
contradiction.
Propositional Equivalences
CSC 102 - Discrete Structures 1
Propositional Equivalences
CSC 102 - Discrete Structures 1
LOGICAL EQUIVALENCES
o Compound propositions that have the same truth values
in all possible cases are called logically equivalent.
o The compound propositions p and q are called logically
equivalent if p ↔ q is a tautology.
o The notation p ≡ q denotes that p and q are logically
equivalent. The symbol ≡ is not a logical connective, and
p ≡ q is not a compound proposition but rather is the
statement that p ↔ q is a tautology.
o The symbol ⇔ is sometimes used instead of ≡ to denote logical
equivalence.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
SOLUTION:
The truth tables for these
EXAMPLE 2
Show that ¬(p ∨ q) and ¬p ∧ ¬q are
compound propositions are logically equivalent.
displayed in Table 3.
Because the truth values of
the compound propositions
¬(p ∨ q) and ¬p ∧ ¬q agree
for all possible
combinations of the truth
values of p and q, it follows
that ¬(p ∨ q) ↔ (¬p ∧ ¬q)is a
tautology and that these
compound propositions are
logically equivalent.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
SOLUTION:
The truth tables for these
EXAMPLE 2
Show that ¬(p ∨ q) and ¬p ∧ ¬q are
compound propositions are logically equivalent.
displayed in Table 3.
Because the truth values of
the compound propositions
¬(p ∨ q) and ¬p ∧ ¬q agree
for all possible
combinations of the truth
values of p and q, it follows
that ¬(p ∨ q) ↔ (¬p ∧ ¬q)is a
tautology and that these
compound propositions are
logically equivalent.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
EXAMPLE 3
SOLUTION: Show that p → q and ¬p ∨ q are
We construct the truth logically equivalent.
table for these
compound
propositions in Table 4.
Because the truth
values of ¬p ∨ q and p
→ q agree, they are
logically equivalent.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
EXAMPLE 3
SOLUTION: Show that p → q and ¬p ∨ q are
We construct the truth logically equivalent.
table for these
compound
propositions in Table 4.
Because the truth
values of ¬p ∨ q and p
→ q agree, they are
logically equivalent.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
o Note that we need to double the number of rows in the truth tables we use to show that compound propositions are
equivalent for each additional propositional variable, so that 16 rows are needed to establish the logical equivalence of
two compound propositions involving four propositional variables, and so on.
o In general, 𝟐𝒏 rows are required if a compound proposition involves n propositional variables.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
EXAMPLE 4
Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are
logically equivalent. This is the distributive law of
disjunction over conjunction. SOLUTION: We construct the
truth table for these
compound propositions in
Table 5. Because the truth
values of p ∨ (q ∧ r) and (p
∨ q) ∧ (p ∨ r) agree, these
compound propositions are
logically equivalent.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
EXAMPLE 4
Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are
logically equivalent. This is the distributive law of
disjunction over conjunction. SOLUTION: We construct the
truth table for these
compound propositions in
Table 5. Because the truth
values of p ∨ (q ∧ r) and (p
∨ q) ∧ (p ∨ r) agree, these
compound propositions are
logically equivalent.
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
LOGICAL EQUIVALENCES
CSC 102 - Discrete Structures 1
APPLICATIONS OF
PROPOSITIONAL LOGIC
LOGIC PART 1
CSC 102 - Discrete Structures 1
SYSTEM
SPECIFICATIONS
Translating sentences in System and software engineers
natural language (such as take requirements in natural
English) into logical language and produce precise and
expressions is an essential part unambiguous specifications that
of specifying both hardware can be used as the basis for system
and software systems. development.
EXAMPLE
Express the specification “The automated reply cannot be sent when the file
system is full” using logical connectives.
EXAMPLE
Express the specification “The automated reply cannot be sent when the file
system is full” using logical connectives.
SOLUTION
o Let p denote “The automated reply can be sent” and q denote “The file
system is full.”
o Then ¬p represents “It is not the case that the automated reply can be
sent,” which can also be expressed as “The automated reply cannot be
sent.”
o Consequently, our specification can be represented by the conditional
statement q → ¬p.
System Specification
CSC 102 - Discrete Structures 1
EXAMPLE
Determine whether these system specifications are consistent:
o “The diagnostic message is stored in the buffer or it is retransmitted.”
o “The diagnostic message is not stored in the buffer.”
o “If the diagnostic message is stored in the buffer, then it is retransmitted.”
SOLUTION
o First express them using logical expressions. Let p denote “The diagnostic
message is stored in the buffer” and let q denote “The diagnostic
message is retransmitted.”
o The specifications can then be written as p ∨ q, ¬p, and p → q.
o An assignment of truth values that makes all three specifications true
must have p false to make ¬p true. Because we want p ∨ q to be true but
p must be false, q must be true. Because p → q is true when p is false
and q is true.
System Specification
CSC 102 - Discrete Structures 1
EXAMPLE
Determine whether these system specifications are consistent:
o “The diagnostic message is stored in the buffer or it is retransmitted.”
o “The diagnostic message is not stored in the buffer.”
o “If the diagnostic message is stored in the buffer, then it is retransmitted.”
Logic Circuits
o 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.
o In this section we will design some useful circuits, in Figure 1
we’ll see basic logic gates. Restrict our attention to logic
circuits with a single output signal; in general, digital circuits
may have multiple outputs.
Logic Circuits
CSC 102 - Discrete Structures 1
EXAMPLE #1:
Build a digital circuit that produces the output (p ∧ ¬q) ∨ ¬r when given input bits p, q, and r.
EXAMPLE #2:
Build a digital circuit that produces the output (p ∨ ¬r) ∧ (¬p ∨ (q ∨ ¬r)) when given input bits p,
q, and r.
ARGUMENTS
Consider the following sequence of • This process of drawing a conclusion
propositions: from a sequence of propositions is
called deductive reasoning.
o The bug is either in module 17 or in
• The given propositions, such as
module 81. (1.4.1), are called hypotheses or
o The bug is a numerical error. premises, and the proposition that
o Module 81 has no numerical error. (1.4.1) follows from the hypotheses, such as
(1.4.2), is called the conclusion.
Assuming that these statements are true, it • A (deductive) argument consists of
is reasonable to conclude: hypotheses together with a
The bug is in module 17. (1.4.2) conclusion.
If 𝑝1 , 𝑝2, 𝑎𝑛𝑑 … , 𝑝𝑛 , then 𝑞. (1.4.3)
o The symbol ∴
is read “therefore.”
o The propositions 𝑝1 , 𝑝2, 𝑎𝑛𝑑 … , 𝑝𝑛 are called the hypotheses (or premises), and
o the proposition q is called the conclusion.
o The argument is valid provided that if 𝑝1 , 𝑝2, 𝑎𝑛𝑑 … , 𝑝𝑛 are all true, then q must
also be true; otherwise, the argument is invalid (or a fallacy).
TOPIC 2. LOGIC PART 1
CSC 102 - Discrete Structures 1
RULES OF INFERENCE
o In a valid argument, we sometimes say that the conclusion follows
from the hypotheses.
o Notice that we are not saying that the conclusion is true; we are only
saying that if you grant the hypotheses, you must also grant the
conclusion.
o An argument is valid because of its form, not because of its content.
Each step of an extended argument involves drawing intermediate
conclusions.
o For the argument as a whole to be valid, each step of the argument
must result in a valid, intermediate conclusion.
o Rules of inference, brief, valid arguments, are used within a larger
argument.
TOPIC 2. LOGIC PART 1
CSC 102 - Discrete Structures 1
FIRST SOLUTION
o We construct a truth table
for all the propositions
involved.
o We observe that whenever
the hypotheses p → q and p
are true, the conclusion q is
also true; therefore, the
argument is valid.
RULES OF INFERENCE
CSC 102 - Discrete Structures 1
RULES OF INFERENCE
CSC 102 - Discrete Structures 1
EXAMPLE 1 SOLUTION
Which rule of inference is used in o Let p denote the proposition “the computer
the following argument? has one gigabyte of memory,”
o let q denote the proposition “the computer
If the computer has one can run ‘Blast ’em,’” and
o let r denote the proposition “the sonics will
gigabyte of memory, then it
be impressive.” The argument can be written
can run “Blast ’em.” If the symbolically as
computer can run “Blast
’em,” then the sonics will be
impressive. Therefore, if the
computer has one gigabyte
Therefore, the argument uses the hypothetical
of memory, then the sonics syllogism rule of inference.
will be impressive.
RULES OF INFERENCE
CSC 102 - Discrete Structures 1
VALID OR INVALID?
To test whether or not an argument is valid, we do the
following:
A. Identify the premises and the conclusion
B. Construct a truth table showing the truth values of the premises and
the conclusion
C. Look for all the rows where the premises are all true - we call such
rows critical rows.