720 likes | 912 Views
s tructu r e s. D isc r e t e. 2110200. 2007. The foundations C ounting theory N umber theory G raphs & trees. Evaluation. The foundations 15 % Counting theory 15 % Number theory 15 % Graphs & trees 15 % Final 40 %. Motivation. How fast can we do the computation ?. Motivation.
E N D
structures Discrete 2110200 2007 The foundations Counting theory Number theory Graphs & trees
Evaluation • The foundations 15 % • Counting theory 15 % • Number theory 15 % • Graphs & trees 15 % • Final 40 %
Motivation How fast can we do the computation ?
Motivation K = 0 FOR I1 = 0 TO M { FOR I2 = 0 TO I1 { FOR I3 = 0 TO I2 { … FOR In = 0 TO In-1 { K = K + 1 } … } } } Find the value of K
s s T T he Foundation Relational structures
The Foundations Logic and reasoning Set, relation and function Methods of proof
Historical SYLLOGISTIC REASONING Aristotle (384-322 B.C.) Euclid of Alexandria (325-265 B.C.) DEDUCTIVE REASONING Chrysippus of Soli (279-206 B.C.) MODAL LOGIC George Boole (1815-1864 A.D.) PROPOSITIONAL LOGIC Augustus De Morgan (1806-1871 A.D.) DE MORGAN’s LAWs
Propositional logic Definition A proposition is a declarative statement that is either true or false but not both.
Summary Theorem : Logical Equivalences, given any propositions p,q and r, a tautology T and a contradiction C, the following logical equivalences hold: • Commutative laws: pqqppqqp • Associative laws: (pq)rp(qr) • (pq)rp(qr) • Distributive laws: p(qr) (pq)(pr) • p(qr) (pq)(pr) • Identity laws: pTp pCp • Domination laws:(Universal bound laws) pTT pCC • Idempotent laws: ppp ppp • Negation laws: ppT ppC • Double negative laws: (p) p • De Morgan’s laws: (pq) pq • (pq) pq • Absorption laws: p(pq) pp(pq)p
Example Is the following assertion a proposition? This statement is false. No, since this statement is neither “true” nor “false”.
Example The nth statement in a list of 100 statements is What conclusion can you draw from these statements? Exactly n statements are false. At most one statement can be true, then 99 statements are false. That is only the 99th statement is true.
Example The nth statement in a list of 100 statements is What conclusion can you draw from these statements? Exactly n statements are false. At least n statements are false. 50 first statements are true. The others are false.
Example 99 The nth statement in a list of 100 statements is What conclusion can you draw from these statements? Exactly n statements are false. At least n statements are false. CONTRADICTION
Conditional statement p q Converse The converse of p q is q p. Inverse The inverse of p q is p q. Only if p only if q means If q then p.
Valid arguments Definition An argument is a sequence of statements. All statements excluded the final one are called “hypotheses”, the final statement is called “conclusion”. A argument is the form: p ; q ; r ; … f (read therefore) An argument is valid means that if all hypotheses are true, the conclusion is also true.
Valid arguments VALID Example Given an argumentp (q r); r ; p q TRUE ( p1 p2 p3 … pn) q
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P P Q
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q P
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q P Q
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q P Q
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q Q P
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q Q R P R
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q P Q
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q P R Q R
Rules of inference • Disjunctive addition • Conjunctive simplification • Conjunction addition • Modus ponens • Modus tollens • Hypothetical syllogism • Disjunctive syllogism • Resolution • Dilemma P Q P R Q R R
Example Given two logical operators, p | q means ( p q ) p q means ( p q ) Find a simple proposition for ( p q ) ( p q ). ( p q )
Example Given two logical operators, p | q means ( p q ) p q means ( p q ) Find a simple proposition for ( p q ) ( p q ). Find a proposition equivalent to pq using only . (( p p ) q ) (( p p ) q )
Problem Consider the following statements: All students go to school. John is a student. Diana is a student. …… Of course we can conclude that John goes to school. Diana goes to school. ……
Predicate logic The statement “All students go to school” has two parts: Variable students (denoted by variable x) “go to school” (the predicate) This statement can be denoted by P(x), where P denotes the predicate “go to school”. P(x) is said to be the value of the propositional function P at x. Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.
Quantifiers • Universal quantification • Existential quantification • Unique existential quantification ! Consider a statement x P(x) Q(x). Contraposition Its contrapositive is x Q(x) P(x). Inverse Its inverse is x P(x) Q(x).. Converse Its converse is x Q(x) P(x).
Universal Modus Ponens Consider a statement x P(x) Q(x). For a particular e, P(e) is true, therefore Q(e) is true.
Universal Modus Tollens Consider a statement x P(x) Q(x). For a particular e, Q(e) is true, therefore P(e) is true.
Rules of inferences Universal instantiation xP(x) P(c) if c U. Universal generalization P(c) for an arbitrary c U xP(x) Existential instantiation xP(x) P(c) for some element c U Existential generalization P(c) for some element c U xP(x)
The order of quantifiers Given a predicate P(x,y): x + y = 0 • x y P(x,y) • y x P(x,y)
Nested quantifiers • x P(x) y Q(y) • x y ( P(x) Q(y) ) • y x ( P(x) Q(y) ) • x P(x) x Q(x) • x y ( P(x) Q(y) ) Prenex normal form (PNF)
Example Express the following theorem using the first order predicate logic. Mathematical induction
Set George Cantor (1845-1918)
Set Definition A set is an unordered collection of objects. The objects are called the elements or membersof the set. The number of distinct elements in a set is the cardinality of the set. The Cartesian product of A and B, denoted by AB, is described by { (a,b) | a A b B }.
Defining sets • L1={ n| for n = 123 … } • L2={ n | for n = 1357 … } • L3={ n | for n = 14916 … } • L4={ n | for n =34822 … }. Membership problem
M Machine model { space of yes-input } MEMBERSHIP DECISION { space of input } input output { yes, no }
Example Let U be the universe described by U = { x | 1000 x 9999}. Let Ai be the set of all numbers in U such that the ith position is i. ? Find the cardinality of the union of A1 A2 A3 and A4
Example ? Let S be the set of all x that x does not contain x. S = { x | x x } Note that x is also a set. Does S contain S Russell’s paradox Bertrand Russell (1872-1970)
Set Operators Union Mutually disjoint Intersection Partition Different Disjoint Complement Power set
Set • Theorem Given sets A,B and C. • Commutative laws: AB = BA AB = BA • Associative laws:(AB)C = A(BC) • Distributive laws: A(BC) = (AB)(AC) • Idempotent laws: AU = A AU = U • De Morgan’s laws: (AB)c = Ac Bc (AB)c = Ac Bc • Alternative representation for set difference A-B = ABc • Absorption laws: A(AB) = A (AB)A = A
Example ? The symmetric difference of A and B, ( A B ), is the set containing those elements in either A or B, but not in both A and B. ( A ( B C ) )= ( ( A B ) C ) YES
Example ? The symmetric difference of A and B, ( A B ), is the set containing those elements in either A or B, but not in both A and B. ( A ( B C ) )= ( ( A B ) C ) Given A C = B C Must it be the case that A = B ? YES
Multisets Definition Multisets are unordered collections of elements where an element can occur as a member more than once. { m1.a1, m2.a2, m3.a3, …, mr.ar } mi are called the multiplicities of the elements ai. OPERATORS: UNION, INTERSECTION, DIFFERENCE, SUM
Multisets Fuzzy sets Definition Multisets are unordered collections of elements where an element can occur as a member more than once. { m1.a1, m2.a2, m3.a3, …, mr.ar } mi are called the multiplicities of the elements ai. 0 mi 1 Degree of membership OPERATORS: UNION, INTERSECTION, DIFFERENCE, SUM