Vous êtes sur la page 1sur 7

1.

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.

Given 2 propositions p and q,


A conjunction has the meaning of p and q. Symbolically, it can be written as pq.
A disjunction has the meaning of p or q. Symbolically, it can be written
as pq. There are some other disjunctions which we dont normally use, like the
exclusive or (pq), not and (nand, p | q) and nor (p q).
An Implication is a conditional statement, where p is the antecedent (hypothesis or
premise) while q is the consequence (or conclusion). It has the meaning if p,
then q. Symbolically, it can be written as pq. In English, there are many ways you
can interpret this other than if p, then q. Examples are
if p, q.
q unless not p.
p implies q.
p is sufficient for q.
p only if q.
q when / if p.
q whatever p.
a necessary condition of p is q.
a sufficient condition of q is p.
q is necessary for p.
q follows from p.
A bi-implication is a bi-conditional statement, which means that the implication and
its converse are equivalent. It has the meaning p if and only if q. Symbolically, it can
be written as pq. Other ways of saying it are
p is necessary and sufficient for q.
if p then q, and conversely.
p iff q.

Now using a conditional statement p q,

A converse of the statement is q p.


An inverse of the statement is ~p ~q.
A contraposition of the statement is ~q ~p.
To further elaborate the meanings of all the stuff above, Ill continue by
introducing truth tables.

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.

Situation 2: If they lost in the elections


Since they didnt promise anything about what they will do if they lost, whatever that
happens, be it the price of petrol increases, remains or reduces, doesnt make the
statement false, and so therefore, for either case, the statement is true.
Now well go on to see the truth tables for converse, inverse and contrapositive:

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.

You can check by looking at its truth table below:

Opposite to a tautology is a contradiction, a compound proposition that is always


false. Acontingency is neither a tautology or a contradiction.

Here are some common laws of logic and some notes identities that you should
memorize:
True-False Laws

Some laws for implications:

Some laws for bi-conditional statements:

PREDICATION & QUANTIFICATION


Sometimes, we can use predicates to represent a logic statement, which depends
on an unknown, or various unknowns. A predicate is normally denoted by P(x), or
any capital letter followed by a bracket with an unknown in it. For example, C(x) may
represent x is a comedian while F(x) may represent x is funny.
A quantifier is used to generalise or specialize a particular predicate, and is placed
in front of it. There are 2 kinds of quantifiers:
1. The universal quantifier, denoted by xP(x) which means for all x, P(x). It also
could mean for every, all of, for each, given any, for arbitrary or for any. In
terms of P(x), it can be represented by the logical statement

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

be represented by the logical statement

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:

This is quite straightforward.

A nested quantifier is formed when you use 2 or more quantifiers in 1 predicate.


Examples are like

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.

Vous aimerez peut-être aussi