Скачать презентацию Discrete Mathematics and applications Autumn 2010 Tôi Скачать презентацию Discrete Mathematics and applications Autumn 2010 Tôi

b686d154af39e91bb2489a9cd42216c2.ppt

  • Количество слайдов: 41

Discrete Mathematics and applications Autumn 2010 • Tôi là • Moshe Rosenfeld • Tôi Discrete Mathematics and applications Autumn 2010 • Tôi là • Moshe Rosenfeld • Tôi sinh ra ở Israel • Tôi đã học toán học tại Đại học Hebrew ở Jerusalem • Tôi đến từ trường Đại học Washington • Tôi không biết nói tiếng Việt

What Is Mathematics? What Is Mathematics?

1 2 4 7 11 16 22 29 37 ? ? 37 + 9 1 2 4 7 11 16 22 29 37 ? ? 37 + 9 = 46

2 7 3 5 5 11 11 11 ? ? 11 2 7 3 5 5 11 11 11 ? ? 11

Both slides show numbers and patterns. Did you see the pattern? Can you tell Both slides show numbers and patterns. Did you see the pattern? Can you tell which number will be in location number 1000? 2, 000?

Mathematics is the Study of Numbers, Shapes and Patterns What is Discrete Mathematics? Mathematics is the Study of Numbers, Shapes and Patterns What is Discrete Mathematics?

Logic Logic

Propositions • • 1. 2. 3. 4. A statement which is either TRUE or Propositions • • 1. 2. 3. 4. A statement which is either TRUE or FALSE is called a Proposition. Examples: Today is Wednesday (T) Vietnam won the World Soccer title. (F) When is my birthday? The barber of Seville shaves all persons who do not shave themselves.

Propositions 1. 7 x = 28 2. Every even integer > 2 is the Propositions 1. 7 x = 28 2. Every even integer > 2 is the sum of two prime numbers. 3. Every even integer > 6 is the sum of two distinct prime numbers. 4. If today is Tuesday then tomorrow is Friday. 5. This statement is false!

Truth tables • We shall treat propositions as mathematical objects and introduce unary and Truth tables • We shall treat propositions as mathematical objects and introduce unary and binary operations on them. • We shall denote propositions by single letters like, p, q etc. • Every proposition can have one of two values: T(true) or F(alse).

Logical Operations • Negation (a unary operation). p p : p p T F Logical Operations • Negation (a unary operation). p p : p p T F F T p = “it is hot today” then p = “it is not hot today”

Binary Operations • Each binary operation is governed by a table: ” p q Binary Operations • Each binary operation is governed by a table: ” p q p op q TT TF “truth

Two common binary operations and their truth tables: • 1. p q (“and”) • Two common binary operations and their truth tables: • 1. p q (“and”) • 2. p q (“or”)

Other binary operations • There are 12 possible non-trivial truth tables for binary operations. Other binary operations • There are 12 possible non-trivial truth tables for binary operations. • p q (“implies”, false only when p = T and q = F). • p q (Biconditional; “if and only if” True only when both are equal). • p q (“xor”, exclusive or, True when exactly one proposition is True). • Most programming languages provide three logical operations: not, and, or

Equivalence • A compound proposition is formed from existing propositions using logical operators. • Equivalence • A compound proposition is formed from existing propositions using logical operators. • For example: (p h q v p) ( h p) is a compound proposition. • Truth tables can be used to evaluate the values of compound propositions. • Two propositions are equivalent if they have identical truth tables. • Notation: b a

Computation laws Computation laws

Example Example

 • A compound proposition of the form: (p v q v w v • A compound proposition of the form: (p v q v w v u …) is called a disjunction. • A compound proposition of the form: (p q w u…) is called a conjunction. • Theorem: every compound proposition is equivalent to a disjunction of conjunctions. • Theorem: every compound proposition is equivalent to a conjunction of disjunctions also known as CNF (conjunctive normal form).

Example: a detective puzzle • Trung, Hoa and Tuan had same Phở for lunch Example: a detective puzzle • Trung, Hoa and Tuan had same Phở for lunch at the same restaurant. They asked Ha to guess where they ate and what kind of Phở they had. To challenge Ha they decided that each will tell Ha two things and that at least one of the things they tell will be true. 1. Trung: “We ate Phở bò tái at Phở -24” 2. Hoa: “We ate Phở ga at Tranh Brothers. ” 3. Tuan: “We at Cha Ca but definitely not Phở bò tái “ What did they eat and where?

Answer • • • We introduce five propositions: A : ate Phở bò tái Answer • • • We introduce five propositions: A : ate Phở bò tái B: ate at Phở -24 C: ate Phở ga D: ate at Tranh brothers E: ate at Cha Ca.

 • This means that: (A v B) (C v D) ( A V • This means that: (A v B) (C v D) ( A V E) = T • OR: • AC( A ) v ACE v AD( A ) v ADE v BC( A ) v BCE v BD( A ) v BDE = T The only possible true statement is: BC( A )

A a logic problem: From K. Rosen's book. Five friends have access to a A a logic problem: From K. Rosen's book. Five friends have access to a chat room. Is it possible to determine who is chatting if the following information is known? 1. Either Kevin or Heather or both, are chatting. 2. Either Randy or Vijay, but not both are chatting. 3. If Abby is chatting, so is Randy. 4. Vijay and Kevin are either both chatting or neither are chatting. 5. If Heather is chatting, then so are Abby and Kevin.

Ans. Create five propositions: A : Abbey is chatting. H : Heather is chatting Ans. Create five propositions: A : Abbey is chatting. H : Heather is chatting R : Randy is chatting V : Vijay is chatting K : Kevin is chatting We can now build a compound statement based on the given data: (H or K) and (xor(R, V) and implies(A, R) and (not (xor(K, V)) and (implies(H, (A and K)) = T

Can we write a computer program to solve this puzzle? for H in [true, Can we write a computer program to solve this puzzle? for H in [true, false]: for K in [true, false]: for R in [true, false]: for V in [true, false]: for A in [true, false]: if ((H or K) and (xor(R, V) and implies(A, R) and (not (xor(K, V)) and (implies(H, (A and K)) == T): print(`Heather is chatting: `, H, `n. Abbey is chatting: `, A, `n. Kevin is chatting: `, K, `n. Randy is chatting: `, R, `n. Vijay is chatting: `, V ); Heather is chatting: false Abbey is chatting: false Kevin is chatting: true Randy is chatting: false Vijay is chatting: true

1. A compound proposition which is always TRUE is called a Tautology: Example: p 1. A compound proposition which is always TRUE is called a Tautology: Example: p p 2. A compound statement which is always FALSE is called a Contradiction Example: p p

Show that the implication [ p (p q)] q is a tautology. Ans. Need Show that the implication [ p (p q)] q is a tautology. Ans. Need to show that the compound statement is always TRUE.

(p q) p (p q) q p q T T T F T F (p q) p (p q) q p q T T T F T F T T F F T Show that: (p q) r and p (q r) are not equivalent.

Common terminology and notation It is common to refer to variables associated with propositions Common terminology and notation It is common to refer to variables associated with propositions as Boolean. It is also a common practice to use the “+” sign for “or”, the “. ” for “and” and the (over-strike) for “not” For example: (p q) (p r) will be written as: (p + q)

Rules of inference Truth tables can be used to check the validity of arguments. Rules of inference Truth tables can be used to check the validity of arguments. Mathematical proofs are a sequence of propositions: p 1 p 2. . . p 2 n | q Where each p 2 i is either a premise (given true proposition) or an inference and q is the conclusion. The rules are broken down as shown in the table:

Logic Gates We observed that every truth table can be constructed using only “not”, Logic Gates We observed that every truth table can be constructed using only “not”, “and”, and “or” operators. Definition: a set of operators that can construct every truth table is called functionally complete. “not”, “and”, and “or” is a functionally complete set. Claim: “not” and “and” are functionally complete.

Logic Gates The electronic building elements of the unary and binary logic operators are Logic Gates The electronic building elements of the unary and binary logic operators are called logic gates. Every truth table can be electronically implemented.

Logic gate symbols Theoretically and physically there are more gates. Logic gate symbols Theoretically and physically there are more gates.

Truth tables of logic gates Truth tables of logic gates

Logic Gates The NAND gate is the cheapest to build. Claim: The NAND gate Logic Gates The NAND gate is the cheapest to build. Claim: The NAND gate is functionally complete. Proof: Exercise (in class): prove that the NOR gate is functionally complete.

3 -INPUTS 3 -INPUTS

XOR gate XOR gate

Multiple gates Multiple gates

Logic Gates An example of combining multiple gates: Logic Gates An example of combining multiple gates:

Summary A fundamental problem in both mathematics and computer science is: Given a compound Summary A fundamental problem in both mathematics and computer science is: Given a compound proposition is there an efficient way to decide whether it is satisfiable? A “simpler” looking problem but actually equivalent is: Is there an efficient way to decide whether a given 3 -SAT instance is satisfiable?

Summary The logic gates were the bridge that enabled us to explore the many Summary The logic gates were the bridge that enabled us to explore the many applications provided by computers. Walther Bothe invented the first modern electronic AND gate. He received the Nobel prize in physics in 1954. Further interesting information can be found at: http: //en. wikipedia. org/wiki/Logic_gate#Sym bols