1.2. LOGARITHMS AND EXPONENTIALS
9
To Win, Prove the Relation
Lov es
(
b
0
; g
0
):
Once all the ob jects have b een provided, you
(the prover) must prove that the innermost relation is in fact true. If you can, then you
win. Otherwise, you lose.
Pro of Is a Strategy:
A pro of of the statement consists of a strategy such that you win the
game no matter how the adversary plays. For each p ossible move that the adversary takes,
such a strategy must specify what move you will counter with.
Negations in Front:
To prove a statement with a negation in the front of it, rst put the state-
ment into \standard" form with the negation moved to the right. Then prove the statement
in the same way.
Examples:
9
b
8
g Lov es
(
b; g
):
To prove that \There is a b oy that loves every girl", you must pro duce a
specic b oy
b
0
. Then the adversary, knowing your boy
b
0
, tries to prove that
8
g Lov es
(
b
0
; g
)
is false. He do es this by providing an arbitrary girl
g
0
that he hop es
b
0
does not love. You
must prove that \
b
0
loves
g
0
".
:
?
9
b
8
g Lov es
(
b; g
)
i
8
b
9
g
:
Lov es
(
b; g
):
With the negation moved to the right, the
rst quantier is universal. Hence, the adversary rst produces a boy
b
0
. Then, knowing
the adversary's b oy, you produce a girl
g
0
. Finally, you prove that
:
Lov es
(
b
0
; g
0
).
Your proof of the statement could b e viewed as a function
G
that takes as input the
boy
b
0
given by the adversary and outputs the girl
g
0
=
G
(
b
0
) countered by you. Here,
g
0
=
G
(
b
0
) is an example of a girl that b oy
b
0
does not love. The proof must prove that
8
b
:
Lov es
(
b; G
(
b
))
1.2 Logarithms and Exp onentials
Logarithms log
2
(
n
) and exp onentials 2
n
arise often in this course and should b e understo od.
Uses:
There are three main reasons for these to arise.
Divide Logarithmic Number of Times:
Many algorithms rep eatedly cut the input instance in
half. A classic example is binary search. If you take some thing of size
n
and you cut it in half;
then you cut one of these halves in half; and one of these in half; and so on. Even for a very large
initial ob ject, it does not take very long until you get a piece of size b elow 1. The numb er of times
that you need to cut it is denoted by log
2
(
n
). Here the base 2 is because you are cutting them in
half. If you were to cut them into thirds, then the number of times to cut is denoted by log
3
(
n
).
A Logarithmic Number of Digits:
Logarithms are also useful because writing down a given integer
value
n
requires
d
log
10
(
n
+ 1)
e
decimal digits. For example, supp ose that
n
= 1
;
000
;
000 = 10
6
.
You would have to divide this numb er by 10 six times to get to 1. Hence, by our previous denition,
log
10
(
n
) = 6. This, however, is the numb er of zeros, not the numb er of digits. We forgot the
leading digit 1. The formula
d
log
10
(
n
+ 1)
e
= 7 does the trick. For the value
n
= 6
;
372
;
845, the
numb er of digits is given by log
10
(6
;
372
;
846) = 6
:
804333, rounded up is 7. Being in computer
science, we store our values using bits. Similar arguments give that
d
log
2
(
n
+ 1)
e
is the number
of bits needed.
Exp onential Search:
Suppose a solution to your problem is represented by
n
digits. There are 10
n
such strings of
n
digits. One way to count them is by computing the number of choices needed
to choose one. There are 10 choices for the rst digit. For each of those, there are 10 choices for
the second. This gives 10
10 = 100
choices
. Then for each of these 100 choices, there are 10
choices for the third, and so on. Another way to count them is that there are 1
;
000
;
000 = 10
6
integers represented by 6 digits, namely 000
;
000 up to 999
;
9999. The diculty in there b eing so
many p otential solutions to your problem, is that doing a blind search through them all to nd
your favorite one will take ab out 10
n
time. For any reasonable
n
, this is a huge amount of time.
Rules:
There are lots of rules about logs and exponential that one might learn. Personally, I like to minimize
it to the following.