Académique Documents
Professionnel Documents
Culture Documents
1 Logic
A proposition is a declarative sentence that is either true or false, but not
both. Normally, we will use the letter p, q and r to represent a
proposition. The negation of a proposition is its opposite. For example, if p: 2 + 3 =
5, then its negation is 2 + 3 5. A negation of pcan be represented by ~p, pp or p. It
is recommended that you stick to one, so I will be using ~p throughout this post.
TRUTH TABLES
A truth table is a table which states the truth values of various statements. Here, T
means true, while F means false. So the truth table for negation is
which means that every time when p is true, pp is false and whenever p is false, pp is
true.
Lets go on for conjunctions, disjunctions, implications and bi-implications:
Did you notice something? p and q is true if both p and q are true. p or q is true if
either one of p or q is true. p q is true if both p and q are true, or both p and q are
false. p q is a little tricky. It is only false if p is true, and q is false. Ill illustrate this a
little:
Lets say, Pakatan Rakyat, the opposition party of Malaysia gives a conditional
statement:If we win the next elections, we will immediately reduce the price of
petrol by 20%. So according to their statement, there will be 2 situations.
Situation 1: If they won the elections
In the event that they really did reduce the petrol price, then the statement is true.
But if they break their promise and the petrol price isnt reduced, then the statement
is false.
Did you see something? You notice that the converse is equivalent to the inverse!
And besides, the statement itself is equivalent as its contrapositive. This is one very
important piece of information for you.
PRECEDENCE
In problem solving, you can combine all the logical operators to make a very
complicated statement. For example, you can have
[ (~r ~p) q ] [ q (~r ~p) ]
In order to understand the statement, you need to have a precedence of logical
operators, which means, which symbol comes first and which comes second and so
on. The precedence of logical operators, from first to last is as follows: ~,
,,,.
If 2 statements have the same truth values, we say that the statements are logically
equivalent. if p and q are logically equivalent, we write p q. Note that it is an equal
sign with 3 strokes instead of 2.
A tautology is a compound proposition that is always true, no matter what the truth
values of the propositions that occur in. For example, ~p (p q) is a tautology.
Here are some common laws of logic and some notes identities that you should
memorize:
True-False Laws
which means the conjunction of any variable in the predicate P. Using the example
above, if x means people, then xC(x) means everyone is a comedian.
2. The existential quantifier, denoted by xP(x) which means for some x, P(x). It
also could mean at least one, there is a or there exists. In terms of P(x), it can
which means that it is the disjunction of any variable in the predicate P. Again, using
the example above, xC(x) means some people are comedians. Sometimes, you
might also see the expression !xC(x). Instead of for some x, this means there is
exactly one x. We call it the uniqueness quantifier.
We use these quantifiers just the same way how we use those ps and qs earlier on,
you can add the negating sign (~) or the conditional arrows ( and ) to them. So
what are the truth values of these quantifiers?
The statement xP(x) is TRUE if P(x) is true for all x, in which x should belong to a
particular domain (people, animal, students or etc). It is FALSE if we could find
an x in which P(x) is false. Using the same example again, xC(x) is true if every
human being is a comedian, but is false if you could find one person (yes, you only
need one person) who isnt a comedian.
The statement xP(x) is TRUE if there exist one x which is true, and is FALSE if
every xis false for P(x). Using the same example, xC(x) is true if there is one
human being on earth is a comedian, but is false if you cant find a single human
being who is a comedian.
Simple? Let me give you some common rules for quantifiers:
This one tells you how you can bring the quantifier into the brackets. Beware though,
you cant bring a universal quantifier in if you use a disjunction, and the same applies
to the existential quantifier and conjunctions.
The negations of quantifiers:
Notice that both quantifiers mean different things. The first one says for all x, there
exist ay such that P(x,y) is true, while the second one says there exist an x such
that all y is true for P(x,y). Let me give you a detail example:
Let P(x,y) be the statement x has sent an SMS to y, where the domain
of x and y are students. We can see that
1. xyP(x,y) means There is some student who sent an SMS to some student.
2. xyP(x,y) means There is a student who sent an SMS to all other student.
3. xyP(x,y) means All students sent an SMS to at least one student.
4. yxP(x,y) means There is a student who receives an SMS from all students.
5. yxP(x,y) means Every student has been sent an SMS by at least a student
6. xyP(x,y) means All students have sent an SMS to all students.
Notice that xy and yx do mean the same thing, and this applies
to xy and yxtoo, but not the mixture of both. Now the problem is: how do you
know the truth values for nested quantifiers? Ill show you in a table below:
You can actually work it out yourself by using the negating rules stated above. Its
simple: a negation sign passes through a universal quantifier turns into an existential
quantifier, and vice versa. Another important remark is this:
"if xyP(x,y) is true, then yxP(x,y) is true, but not INVERSELY.