Presentation is loading. Please wait.

Presentation is loading. Please wait.

رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill.

Similar presentations


Presentation on theme: "رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill."— Presentation transcript:

1 رياضيات متقطعة لعلوم الحاسب MATH 226

2 Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill

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

4 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

5 Chapter 1 1.1 Propositional Logic. 1 1.2 Applications of Propositional Logic 1.3 Propositional Equivalences..

6 Section 1.1

7 Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: a) riyad is the capital of Saudi Arabia b) the color of blood is green c) 1 + 0 = 1 d) 0 + 0 = 2 Examples that are not propositions. a) Sit down! b) What time is it? c) x + 1 = 2 d) x + y = z Propositions a and c are true, whereas b and d are false.

8 Propositional Logic Propositional Variables: We use letters to denote propositional variables that is, variables that represent propositions Propositional Variables: p, q, r, s, … E.g. Proposition p – “Today is Friday.” Truth values – T, F The 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

9 Compound Propositions Compound Propositions; constructed from logical connectives and other propositions Negation ¬ Conjunction ∧ Disjunction ∨ Implication → Biconditional ↔

10 Examples Find 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

11 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¬p TF FT

12 Examples Find 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

13 (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.” pqp ∧ q TTT TFF FTF FFF

14 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 the proposition 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

15 truth 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.” pqp ∨q TTT TFT FTT FFF

16 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 pqp →q TTT TFF FTT FFT 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.

17 Understanding Implication Example: 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

18 Converse, Contrapositive, and Inverse From 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.

19 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.” pqp ↔q TTT TFF FTF FFT

20 Truth Tables of Compound Propositions Example Truth Table Construct a truth table for pqr rr p  q p  q →  r TTTFTF TTFTTT TFTFTF TFFTTT FTTFTF FTFTTT FFTFFT FFFTFT

21 Equivalent Propositions Two 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: pq¬ p¬ qp →q¬q → ¬ p TTFFTT TFFTFF FTTFTT FFTTFT

22 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: pq¬ p¬ qp →q¬ p →¬ qq → p TTFFTTT TFFTFTT FTTFTFF FFTTFTT

23 Problem How many rows are there in a truth table with n propositional variables? Solution: 2 n We will see how to do this in Chapter 6. Note that this means that with n propositional variables, we can construct 2 n distinct (i.e., not equivalent) propositions.

24 Precedence of Logical Operators OperatorPrecedence  1     2323     4545 p  q   r is equivalent to (p  q)   r If the intended meaning is p  (q   r ) then parentheses must be used.

25 Section 1.2

26 Translating English Sentences Steps to convert an English sentence to a statement in propositional logic Identify 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’s q: I go to the country. r: I will go shopping. If p or q then not r.

27 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 )

28 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:

29 Section 1.3

30 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. pq¬p¬p¬p ∨ qp→ q TTFTT TFFFF FTTTT FFTTT

31 De Morgan’s Laws pq¬p¬p¬q¬q ( p∨q)¬ ( p∨q)¬p∧¬q TTFFTFF TFFTTFF FTTFTFF FFTTFTT This truth table shows that De Morgan’s Second Law holds. Augustus De Morgan 1806-1871

32 Key Logical Equivalences (cont) Commutative Laws:, Associative Laws: Distributive Laws: Absorption Laws:

33 Key Logical Equivalences Identity Laws:, Domination Laws:, Idempotent laws:, Double Negation Law: Negation Laws:,

34 More Logical Equivalences

35 Equivalence Proofs Example: Show that is logically equivalent to Solution:

36 Equivalence Proofs Example: Show that is a tautology. Solution:


Download ppt "رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill."

Similar presentations


Ads by Google