Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mt263f-11 Discrete Structures Li Tak Sing( 李德成 ) Room A0936 27686816.

Similar presentations


Presentation on theme: "Mt263f-11 Discrete Structures Li Tak Sing( 李德成 ) Room A0936 27686816."— Presentation transcript:

1 mt263f-11 Discrete Structures Li Tak Sing( 李德成 ) tsli@ouhk.edu.hk Room A0936 27686816

2 mt263f-12 Textbook:Discrete Structures, Logics, and Computability by James L. Hein (2nd Edition) On Fridays, the second hour will be tutorial and tutorial worksheets will be distributed. They will not be assessed. Test:Two Tests Examination:3 hr examination in late April to mid May Course result:Test(30%), Examination(70%) You must have at least 40 marks in both the total score.

3 mt263f-13 Syllabus Data types, functions, and data structures; Formal logic, recursion, proofs; Algorithms and analysis of algorithms; Formal languages, Turing machines.

4 mt263f-14 Web site You can find online materials at: http://plbpc001.ouhk.edu.hk/~comps263f http://plbpc001.ouhk.edu.hk/~comps263f

5 mt263f-15 Elementary Notions and Notations This is related to chapter one of the text book Logical Statements – statements that can either be true or false. For example, I am an OUHK student.

6 mt263f-16 Negation If S represents a logical statement, then negation of S represents the statement “not S”. If S is: I am a OUHK student, then “not S” is: I am not a OUHK student.

7 mt263f-17 Truth table A truth table list out all the possible values of different logical statements in different scenarios. So if we list S and “not S” in a true table, we would have: SNot S Truefalse Falsetrue

8 mt263f-18 Conjunction The conjunction of A and B is the statement “A and B” ABA and B True False TrueFalse

9 mt263f-19 Disjunction The disjunction of A and B is “A or B”. ABA or B True FalseTrue FalseTrue False

10 mt263f-110 Comparison of two logical statements Two logical statements are equal if and only if they have the same values as listed in a true table.

11 mt263f-111 “not (A and B)” and “(not A) or (not B)” ABA and BNot (A and B) TTTF TFFT FTFT FFFT ABNot ANot B(Not A) or (not B) TTFFF TFFTT FTTFT FFTTT This is also known as DeMorgan’s Thereom

12 mt263f-112 Other equivalent logical statements A and B = B and A (commutative) A or B = B or A (commutative) A and (B and C) = (A and B) and C (associative) A or (B or C) = (A or B) or C (associative) A and (B or C) = (A and B) or (A and C) (distributive)

13 mt263f-113 A or (B and C) = (A or B) and (A or C) (distributive) not (A and B) = (not A) or (not B) (DeMorgan’s theorem) not (A or B) = (not A) and (not B) (DeMorgan’s theorem) true and A = A false and A = false

14 mt263f-114 true or A = true false or A = A not (not A) = A A and (A or B) = A (absorption) A or (A and B) = A (absorption)

15 mt263f-115 Conditional statements If A then B.  If 3=3 then 2=2 (true)  If 3=3 then 2=1 (false)  If 3=2 then 2=2 (true)  If 3=2 then 2=1 (true) ABIf A then B True False True False True

16 mt263f-116 if and only if “A if and only if B” is actually “if A then B” and “if B then A”. “if and only if” is often written as iff ABif A then Bif B then AA iff B TTTTT TFFTF FTTFF FFTTT “A iff B” is true only if both A or B have the same value. A iff B if A is equivalent to B

17 mt263f-117 “If A then B” and “If not B then not A” ABNot ANot BIf not B then not A TTFFT TFFTF FTTFT FFTTT So we can see that “if A then B” and “if not B then not A” are equal logical statements.

18 mt263f-118 So the following statements are equivalent: If the room is available, then we can take it. If we cannot take the room, then it is not available.

19 mt263f-119 Other equivalent logical statements Not (A or B)(not A) and (not B) A and (B or C)(A and B) or (A and C) A or (B and C)(A or B) and (A or C) If A then B(not A) or B Not (if A then B)A and (not B)

20 mt263f-120 Proof techniques Proof by Exhaustive Checking  This means that you check every possible case to see that the statement is true.  This is only possible if the number of cases is finite.

21 mt263f-121 For example, we want to prove the statement: All integers between 10 and 15 exclusive are not square of another integer. Proof: The numbers between 10 and 15 exclusive are 11, 12, 13, 14. We can then check each of these numbers and find that Therefore, we have proved the statement

22 mt263f-122 Conditional Proof Many statements that we want to proof are in the form “if A then B”. We should start the argument from A and then we should arrive at B.

23 mt263f-123 Prove the statement: if n is an odd integer, then n 2 is also an odd integer. Proof: n is an odd integer. Let n=2k+1 where k is an integer. Therefore, n 2 =4k 2 +4k+1=2(k 2 +2k)+1 Now, 2(k 2 +2k) is an even number, therefore 2(k 2 +2)+1 is an odd number. Therefore n 2 is an odd number. There are more examples in the textbook.

24 mt263f-124 Set A set is a collection of things called its elements, members or objects. If S is a set and x is an element in S, then we write x  S If x is not an element in S, then we write x  S Every element in a set must be distinct. We are not interested in the order of its elements.

25 mt263f-125 Describing Sets List out the elements: A={a,b,c} B={0,1,....,100} C={0,1,1,2} : this is not a set as it has two elements that are equal to 1. Empty set: {}, 

26 mt263f-126 Equality of sets Two sets are equal if they have the same elements. {1,2,3}={3,2,1} A = B iff (x  A iff x  B) One consequence is that all empty sets are equal because they all contain no elements.

27 mt263f-127 Finite and infinite sets Finite sets are sets that contain finite number of elements. For example A={1,2,3} Infinite sets are sets with in infinite number of elements. For example: N={0,1,2,3,...}, Z={....-2,-1,0,1,2,3...}

28 mt263f-128 Describing sets by properties S={x| x has property P}  A={x| x is an even number}  R={x| x is a real number}

29 mt263f-129 Subsets If every element of A can be found in B, then A is a subset of B, and is written as: A  B If A is not a subset of B, we write: A  B Venn diagram is a graphical representation of sets. The following Venn diagram represents A  B.

30 mt263f-130 A B A

31 mt263f-131 Consequence: if A is a set, then A  A. Proof: if A is a set, then every element in A is in A, therefore A  A. Consequence: if A is a set, then  A. Proof: the condition of  A is that every element of  should be in A. The other way to put it is: you cannot find any element that is in  but not in A. Now, this statement is true because you cannot find any element in .

32 mt263f-132 Example  Prove that A  B where A={x|x>4}, B={x|x 2 >1}  For every x  A,  x>4  x 2 >16  x 2 >1  x  B  So every x in A is also in B, so A  B

33 mt263f-133 Power set A power set of S is the set that contains all the subsets of S. The power set is denoted as power(S). If S={a,b,c}, then power(S)={ ,{a},{b},{c},{a,b},{b,c},{c,a}, {a,b,c}} If S is a set with n elements, then power(S) is a set with 2 n elements.

34 mt263f-134 Equality of sets A=B means A  B and B  A

35 mt263f-135 Union The union of two sets A and B is the set of all the elements that are either in A or in B. It is denoted as A  B. A  B={x| x  A or x  B} The following figure represents A  B.

36 mt263f-136 A B

37 mt263f-137 Properties of Union A  =A A  B=B  A (commutative) A  (B  C)=(A  B)  C (associative) A  A=A A  B if and only if A  B=B.

38 Proof of A  =A Obviously, A  A  Now, we want to prove that A   A. For every x  A   x  A or x   x  A or false  x  A Therefore, A   A Therefore A  =A mt263f-138

39 Proof of A  B if and only if A  B=B If A  B, x  A  x  B Now, B  A  B, we want to prove that A  B  B. x  A  B  x  A or x  B  x  B or x  B (since x  A  x  B)  x  B Therefore A  B  B Therefore A  B=B mt263f-139

40 Proof of A  B if and only if A  B=B (Cont.) Assume A  B=B x  A  x  A or x  B  x  A  B  x  B (since A  B=B ) Therefore A  B mt263f-140

41 mt263f-141 Intersection of sets The intersection of two sets A and B is the set of all elements that are in both A and B. It is denoted as A  B. A  B={x| x  A and x  B} The following figure represents A  B.

42 mt263f-142 A B

43 mt263f-143 Properties of Intersection A  =  A  B=B  A (commutative) A  (B  C)=(A  B)  C (associative) A  A=A A  B if and only if A  B=A

44 Proof of A  =  Obviously,  A . Now, we just have to prove that A . x  A   x  A and x    x  A and false  false  x   Therefore, A   Therefore A  =  mt263f-144

45 Proof of A  B if and only if A  B=A Assume that A  B, we want to prove that A  B=A. Obviously, A  B  A x  A  x  A and x  B (since A  B)  x  A  B Therefore A  B=A mt263f-145

46 Proof of A  B if and only if A  B=A(cont.) Assume that A  B=A x  A  x  A  B (since A  B=A)  x  A and x  B  x  B Therefore A  B mt263f-146

47 mt263f-147 Difference of sets If A and B are sets, then the different A-B is the set of elements in A that are not in B. A-B={x| x  A and x  B}

48 mt263f-148 A B

49 mt263f-149 Symmetric Difference of Sets The symmetric difference of sets A and B is the set A  B of elements that are either in A or in B but not both. A  B={x| (x  A or x  B) and not (x  A and x  B) }

50 mt263f-150 A B

51 mt263f-151 Complement of a Set The complement of A is the set that contain all elements except those in A. A’={x| x  A}

52 mt263f-152 Combining properties A  (B  C)=(A  B)  (A  C) (distributive) A  (B  C)=(A  B)  (A  C) (distributive) A  (A  B)=A (absorption) A  (A  B)=A (absorption) (A’)’=A (A  B)’=A’  B’ (DeMorgan’s theorem)


Download ppt "Mt263f-11 Discrete Structures Li Tak Sing( 李德成 ) Room A0936 27686816."

Similar presentations


Ads by Google