Upload
norman-mathews
View
241
Download
0
Embed Size (px)
DESCRIPTION
Introduction What is discrete mathematics? Discrete mathematics is the part of mathematics devoted to ( the study of discrete objects.) (Here discrete means consisting of distinct or unconnected elements.)
Citation preview
Discrete Mathematicsالحاسب لعلوم متقطعة رياضيات
MATH 226
Text books:
(Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw-Hill
Introduction What is discrete mathematics? Discrete mathematics is the part of
mathematics devoted to ( the study of discrete objects.) (Here discrete means consisting of distinct or
unconnected elements.)
What is the main purpose for this course? - Give About Discrete Mathematics - Understand the principles of mathematical logic
(Logic), and methods of evidence - Identify Groups (Sets) and basic operations on
groups - Understand the different types of relationships and - Boolean algebra (Boolean Algebra), Paul functions
and logical circuits (Logical Circuits) - Graphs and trees
Lecture 1:The Foundations: Logic and Proofs
Chapter 11.1 Propositional Logic. 11.2 Applications of Propositional Logic1.3 Propositional Equivalences . .
Propositional LogicSection 1.1
PropositionsA proposition is a declarative sentence that is either true or
false.Examples of propositions:
a) riyad is the capital of Saudi Arabiab) the color of blood is greenc) 1 + 0 = 1d) 0 + 0 = 2
Examples that are not propositions.a) Sit down!b) What time is it?c) x + 1 = 2d) x + y = z Propositions a and c are true, whereas b and d are false.
Propositional LogicPropositional Variables:We use letters to denote propositional variables
that is, variables that represent propositionsPropositional Variables: p, q, r, s, …E.g. Proposition p – “Today is Friday.”
Truth values – T, FThe proposition that is always true is denoted by T
and the proposition that is always false is denoted by F.
Propositional Logic – the area of logic that deals with propositions
Compound PropositionsCompound Propositions; constructed from
logical connectives and other propositions Negation ¬ Conjunction ∧ Disjunction ∨ Implication → Biconditional ↔
ExamplesFind the negation of the proposition “Today is Friday.”
and express this in simple English.
Find the negation of the proposition ““Rana PC runs Linux”.” and express this in simple English.
DEFINITION 1
Let p be a proposition. The negation of p, denoted by ¬p, is the statement “It is not the case that p.”
The proposition ¬p is read “not p.”
Solution: The negation is “It is not the case that today is Friday.” In simple English, “Today is not Friday.” or “It is not Friday today.”
Solution: The negation is“It is not the case that Rana PC runs Linux.”This negation can be more simply expressed as“Rana PC does not run Linux.”.” 10
1.1 Compound Propositions: Negation
The truth value of the negation of p, ¬p is the opposite of the truth value of p. has this truth table:
Example: If p denotes “The earth is round.”, then ¬p denotes “It is not the case that the earth is round,” or more simply “The earth is not round.”
p ¬p T FF T
ExamplesFind the conjunction of the propositions p and q where p
is the proposition “Today is Friday.” and q is the proposition “It is raining today.”, and the truth value of the conjunction.
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.
Solution: The conjunction is the proposition “Today is Friday and it is raining today.” The proposition is true on rainy Fridays.
12
Conjunction
Conjunction(p ∧ q ) and has this truth table:
Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∧q denotes “I am at home and it is raining.”
p q p ∧ q T T TT F FF T FF F F
Note: inclusive or : The disjunction is true when at least one of
the two propositions is true.
E.g. “Students who have taken calculus or computer science can take this class.” – those who take one or both classes.
exclusive or : The disjunction is true only when one of theproposition is true. p ⊕ q E.g. “Students who have taken calculus or computer science,
but not both, can take this class.” – only those who take one of them.
Definition 3 uses inclusive or.
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 conjunction p ν q is false when both p and q are false and is true otherwise.
14
Disjunction
Disjunctiontruth table:
Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∨q denotes “I am at home or it is raining.”
p q p ∨qT T TT F TF T TF F F
Implication(conditional statement )
and has this truth table:
Example: If p denotes “I am at home.” and q denotes “It is raining.” then p →q denotes “If I am at home then it is raining.”
In p →q , p is the hypothesis and q is the conclusion
p q p →qT T TT F FF T TF F T
DEFINITION 5
Let p and q be propositions. The conditional statement p → q, is the proposition “if p, then q.” The conditional statement is false when p is true and q is false, and true otherwise.
Understanding ImplicationExample:
Let p be the statement “Marim learns discrete mathematics.” and q the statement “Marim will find a good job.” Express the statement p → q as a statement in English. Solution: Any of the following -
“If Marim learns discrete mathematics, then she will find a good job.
“Marim will find a good job when she learns discrete mathematics.”
“Marim will find a good job unless she does not learn discrete mathematics.”
17
Converse, Contrapositive, and InverseFrom p →q we can form new conditional statements .
q →p is the converse of p →q ¬q → ¬ p is the contrapositive of p →q¬ p → ¬ q is the inverse of p →q
Example: Find the converse, inverse, and contrapositive of “It raining is a sufficient condition for my not going to town.”
Solution: converse: If I do not go to town, then it is raining.inverse: If it is not raining, then I will go to town.
contrapositive: If I go to town, then it is not raining. NOTE :only the contrapositive always has the same truth
value as p → q.
Biconditional If p and q are propositions, then we can form the
biconditional proposition p ↔q , read as “p if and only if q .” The biconditional p ↔q denotes the proposition with this truth table:
If p denotes “I am at home.” and q denotes “It is raining.” then p ↔q denotes “I am at home if and only if it is raining.”
p q p ↔q T T TT F FF T FF F T
Truth Tables of Compound Propositions Example Truth TableConstruct a truth table for
p q r r p q p q → r
T T T F T FT T F T T TT F T F T FT F F T T TF T T F T FF T F T T TF F T F F TF F F T F T
Equivalent PropositionsTwo propositions are equivalent if they
always have the same truth value.Example: Show using a truth table that the
biconditional is equivalent to the contrapositive.
Solution: p q ¬ p ¬ q p →q ¬q → ¬ p T T F F T TT F F T F FF T T F T TF F T T F T
Using a Truth Table to Show Non-Equivalence Example: Show using truth tables that
neither the converse nor inverse of an implication are not equivalent to the implication.
Solution: p q ¬ p ¬ q p →q ¬ p →¬ q q → p
T T F F T T TT F F T F T TF T T F T F FF F T T F T T
ProblemHow many rows are there in a truth table
with n propositional variables?
Solution: 2n We will see how to do this in Chapter 6.Note that this means that with n
propositional variables, we can construct 2n distinct (i.e., not equivalent) propositions.
Precedence of Logical OperatorsOperator Precedence 1
23
45
p q r is equivalent to (p q) rIf the intended meaning is p (q r )then parentheses must be used.
Applications of Propositional Logic
Section 1.2
Translating English SentencesSteps to convert an English sentence to a
statement in propositional logicIdentify atomic propositions and represent
using propositional variables.Determine appropriate logical connectives
“If I go to Harry’s or to the country, I will not go shopping.”p: I go to Harry’sq: I go to the country.r: I will go shopping.
If p or q then not r.
Example Problem: Translate the following sentence
into propositional logic: “You can access the Internet from campus only
if you are a computer science major or you are not a freshman.”
One Solution: Let a, c, and f represent respectively “You can access the internet from campus,” “You are a computer science major,” and “You are a freshman.”
a→ (c ∨ ¬ f )
Logic Circuits (Studied in depth in Chapter 12) Electronic circuits; each input/output signal can be viewed as a 0 or 1.
0 represents False 1 represents True
Complicated circuits are constructed from three basic circuits called gates.
The inverter (NOT gate)takes an input bit and produces the negation of that bit. The OR gate takes two input bits and produces the value equivalent to the
disjunction of the two bits. The AND gate takes two input bits and produces the value equivalent to the
conjunction of the two bits. More complicated digital circuits can be constructed by combining these
basic circuits to produce the desired output given the input signals by building a circuit for each piece of the output expression and then combining them. For example:
Propositional Equivalences
Section 1.3
Logically Equivalent We write this as p⇔q or as p≡q where p and q are
compound propositions. Two compound propositions p and q are equivalent if and
only if the columns in a truth table giving their truth values agree.
This truth table show ¬p ∨ q is equivalent to p → q.p q ¬p ¬p ∨ q p→ qT T F T TT F F F FF T T T TF F T T T
De Morgan’s Laws
p q ¬p ¬q (p∨q) ¬(p∨q) ¬p∧¬qT T F F T F FT F F T T F FF T T F T F FF F T T F T T
This truth table shows that De Morgan’s Second Law holds.
Augustus De Morgan
1806-1871
Key Logical Equivalences (cont)Commutative Laws: ,
Associative Laws:
Distributive Laws:
Absorption Laws:
Key Logical EquivalencesIdentity Laws: ,
Domination Laws: ,
Idempotent laws: ,
Double Negation Law:
Negation Laws: ,
More Logical Equivalences
Equivalence ProofsExample: Show that is logically equivalent to Solution:
Equivalence ProofsExample: Show that is a tautology. Solution: