math 213 a – discrete mathematics for computer science dr. (mr.) bancroft
TRANSCRIPT
MATH 213 A – Discrete Mathematics for Computer Science
Dr. (Mr.) Bancroft
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.
1.1 Logic
Logic-
Proposition-
• Notation:
• Negation:
Truth Tables
Conjunction of p and q:
Disjunction of p and q:
Exclusive or:
Implication/Conditional:
Biconditional:
Operations on Implications:
Converse:
Contrapositive:
Inverse:
More complicated truth tables
Logic and Bit Operators
1.2 Propositional Equivalences (Several Definitions):
Compound proposition-
Tautology-
Contradiction-
Contingency-
Logical Equivalence
Using Truth Tables to Demonstrate Logical Equivalence
Show that and are logically equivalent.
Some Commonly used Logical Equivalences
Other Commonly used Logical Equivalences
De Morgan’s Laws
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 QuantifierThe 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 QuantifierThe existential quantification of the predicate P(x) is the proposition which states that…
In symbols,
Example: (Let the universe of discourse be all people)
Looping to Determine the Truth of a Quantified Statement
Free and Bound Variables
“Scope” of a quantifier
Relationship with Conjunction and Disjunction
Negating a Quantified Statement
Translating into English Sentences
P(x) = “x likes to fly kites”Q(x,y) = “x knows y”
))(),(( xPxJoanQx
L(x,y) = “x likes y”
)),(),(( CalvinxLxSusieLx
Translating from English Sentences“All cats are gray”
“There are pigs which can fly”
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)
Section 1.4 – Nested Quantifiers
)(
))1(0(
yyxyx
xyyxx
Examples:
Order of quantification matters!Example: M(x,y) = “x is y’s mother”
),(
),(
yxyMx
yxxMy
Another Example
)),()((
)),()((
yxMySxy
yxxMySy
Translate each of these, where M is as above and S(x) = “x is a student” …
English to First-Order LogicLet L(x,y) = “x loves y”. Translate…
“Everybody loves somebody.”
“There are people who love everybody”
“All students love each other”