home—info—lectures—exams—archive
lect02b
Re-do Example 2:
Show the absorption law, W/O using it itself.
The very first step is devious!:
a ^ (avb)
≡ (a v F) ^ (a v b) (by idempotence of ∨ over F)
≡ a v (F ^ b) (by distribution of v over ^, in reverse)
≡ a v F (by dominance of F over ^)
≡ a (by idempotence of ∨ over F)
Note: we've shown that the absorption law is actually redundant.
It makes you wonder: what is a *minimal* set of equivalencies?!
We ended last time with CNF:
Why do we care?
We compared it to algebra x^3-x vs x(x+1)(x-1);
the latter
Similarly:
I can take each clause of
(a v b v -c) ^ (a v -b v c) ^ (a v b v c)
and tell which rows of the truth table are false:
row FFT makes the 1st clause false, which makes the whole formula false;
row FTF makes the 2nd clause false, which makes the whole formula false;
row FFF makes the 3rd clause false, which makes the whole formula false.
Thus this formula is true for everything *except* abc = FFT, FTF, FFF.
Practice:
"if a song has cheesy synthesizers and weird instruments,
then it makes people smile."
- Write as a formula with three props.
- What is the converse?
- What is the contrapositive?
- From the original: use algebra to simplify it.
Translate the result back to English.
=======
Let "M(x)" mean "x is under 21 years"
What is ... M(Ian)? What is M(Penny-Kyle)?
Let "R(x)" mean "x is in the ITEC122 classroom".
Solve for x: R(x) ^ M(x)
R(x) v M(x)
Let Older(x,y) ...
What does "M(x) v R(x)" mean?
How about "R(x) -> M(x)"?
How about "R(x) -> ¬M(x)"?
How about "¬(R(x) -> M(x))"?
Note that each of the above were statements about x -- a free variable.
The english must involve “x”.
We don't know if the formula is T or F until we plug
in some particular value x.
Compare to code:
/* @param x A Person of interest.
* @return whether or not x is in the ITEC122 classroom.
*/
boolean R( Person x ) {
...
}
/* @param x One Person of interest.
* @return whether x is a minor (under 21yrs).
*/
boolean M( Person x ) {
...
}
|
Note that the javadoc *has* to talk about x.
Person amy = ...
Person bob = ...
R(amy) || M(amy) // Is it true that Amy is in this room, or a minor?
R(bob) -> M(bob) // Wait, how to write this in Java?
R(bob) -> M(amy)
|
So propositional logic was just boolean values/variables,
and learning how to combine them with &&, ||, !, ->.
Predicate logic is methods that take in an object
and return booleans.
We can combine the results of calling predicates with &&, || etc..
First-order logic is predicate logic augmented with quantifiers
(which, in essence, are a restricted type of loop).
Quantifiers:
Suppose our domain of interpretation is people in this class.
What do the following mean:
∀x.R(x) “forall x, R(x) holds”
∃x.R(x) “there exists some x, for which R(x) holds”
Note that there is *no* “x” in the English phrasing:
x is bound by the quantifer.
Compare to code:
/** Is R is true for all Persons in `domain`?
* @param domain The set of Persons of interest.
* @return whether R is true for every Person in `domain`.
*/
boolean forAllR( List<Person> domain )
boolean allSoFar = true;
for ( Person x : domain ) {
if (R(x)) { allSoFar = false; }
}
return allSoFar;
}
|
In the javadoc, there is no mention of `x` -- it's a local variable.
∀y.R(y)
∀y.¬R(y)
¬∀y.R(y)
Defer to summations:
Def'n of CNF using big-and notation.
[Recall: You won't need to know the def'n,
but you will need to be able to understand new def'ns,
and recognize standard notation (like subscripts).]
home—info—lectures—exams—archive