Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATH 213 A – Discrete Mathematics for Computer Science Dr. (Mr.) Bancroft.

Similar presentations


Presentation on theme: "MATH 213 A – Discrete Mathematics for Computer Science Dr. (Mr.) Bancroft."— Presentation transcript:

1 MATH 213 A – Discrete Mathematics for Computer Science Dr. (Mr.) Bancroft

2 The inhabitants of the island created by Smullyan are peculiar. They consist of knights and knaves. Knights always tell the truth and knaves always lie. You encounter two people A and B. Determine, if possible, what A and B are (either a knight or a knave) from the way they address you. A says “I am a knave or B is a knight.” B says nothing.

3 1.1 Logic Logic- Proposition- Notation: Negation:

4 Truth Tables

5 Conjunction of p and q: Disjunction of p and q:

6 Exclusive or: Implication/Conditional: Biconditional:

7

8 Operations on Implications: Converse: Contrapositive: Inverse:

9 More complicated truth tables

10 Logic and Bit Operators

11 1.2 Propositional Equivalences (Several Definitions): Compound proposition- Tautology- Contradiction- Contingency-

12 Logical Equivalence

13 Using Truth Tables to Demonstrate Logical Equivalence

14

15 Some Commonly used Logical Equivalences

16 Other Commonly used Logical Equivalences

17 De Morgan’s Laws

18 Let’s revisit the knight and knave problem: A says “I am a knave or B is a knight.” B says nothing.

19

20

21 Using a Computer to Find Tautologies Practical only with small numbers of propositional variables. How many rows does the truth table contain for a compound proposition containing 3 variables? 5 variables? 10 variables? 100 variables?

22 1.3 – Predicates and Quantifiers

23 Note that if x has no meaning, then P(x) is just a form. The domain of x is … There are two ways to give meaning to a predicate P(x):

24 The Universal Quantifier The universal quantification of the predicate P(x) is the proposition which states that… In symbols, Example: (Let the domain of discourse be all real numbers)

25 The Existential Quantifier The existential quantification of the predicate P(x) is the proposition which states that… In symbols, Example: (Let the universe of discourse be all people)

26 Looping to Determine the Truth of a Quantified Statement

27 Free and Bound Variables “Scope” of a quantifier

28 Relationship with Conjunction and Disjunction

29 Negating a Quantified Statement

30 Translating into English Sentences P(x) = “x likes to fly kites” Q(x,y) = “x knows y” L(x,y) = “x likes y”

31 Translating from English Sentences “All cats are gray” “There are pigs which can fly”

32 Logic Programming sibling(X,Y) :- parent(Z,X), parent(Z,Y), X \= Y. brother(X,Y) :- sibling(X,Y), male(X). sister(X,Y) :- sibling(X,Y), female(X). male(chris). male(mark). female(anne). female(erin). female(jessica). female(tracy). parent(chris,mark). parent(anne,mark). parent(chris,erin). parent(anne,erin). parent(chris,jessica). parent(anne,jessica). parent(chris,tracy). parent(anne,tracy). ?sibling(erin,jessica) ?sibling(mark,chris) ?parent(Z,tracy)

33 Section 1.4 – Nested Quantifiers Examples: Order of quantification matters! Example: M(x,y) = “x is y’s mother”

34 Another Example Translate each of these, where M is as above and S(x) = “x is a student” …

35 English to First-Order Logic Let L(x,y) = “x loves y”. Translate… “Everybody loves somebody.” “There are people who love everybody” “All students love each other”


Download ppt "MATH 213 A – Discrete Mathematics for Computer Science Dr. (Mr.) Bancroft."

Similar presentations


Ads by Google