350 likes | 509 Vues
MATH 213 A – Discrete Mathematics for Computer Science Dr. ( Mr.) Bancroft.
E N D
MATH 213 A – Discrete Mathematics for Computer Science Dr. (Mr.) Bancroft
The inhabitants of the island created by Smullyanare 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.
1.1 Logic • Logic- • Proposition- • Notation: • Negation:
Conjunction of p and q: Disjunction of p and q:
Exclusive or: Implication/Conditional: Biconditional:
Operations on Implications: Converse: Contrapositive: Inverse:
1.2 Propositional Equivalences (Several Definitions): Compound proposition- Tautology- Contradiction- Contingency-
Let’s revisit the knight and knave problem: A says “I am a knave or B is a knight.” B says nothing.
Arguments using logical equivalence “Chain” of equivalences (recall the way you proved trig identities) Examples: 1. Prove is a tautology.
2. Show that and are logically equivalent (again), this time using equivalences from the tables.
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?
1.3 – Predicates and Quantifiers Is “” a proposition? Predicates, or Propositional functions
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):
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)
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)
Free and Bound Variables “Scope” of a quantifier
Translating into English Sentences P(x) = “x likes to fly kites” Q(x,y) = “x knows y” L(x,y) = “x likes y”
Translating from English Sentences “All cats are gray” “There are pigs which can fly”
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) Logic Programming
Section 1.4 – Nested Quantifiers Examples: Order of quantification matters! Example: M(x,y) = “x is y’s mother”
Another Example Translate each of these, where M is as above and S(x) = “x is a student” …
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”