<s>
Lossless	B-Algorithm
compression	I-Algorithm
is	O
a	O
class	O
of	O
data	B-General_Concept
compression	I-General_Concept
that	O
allows	O
the	O
original	O
data	O
to	O
be	O
perfectly	O
reconstructed	O
from	O
the	O
compressed	B-General_Concept
data	I-General_Concept
with	O
no	O
loss	O
of	O
information	O
.	O
</s>
<s>
Lossless	B-Algorithm
compression	I-Algorithm
is	O
possible	O
because	O
most	O
real-world	O
data	O
exhibits	O
statistical	O
redundancy	B-General_Concept
.	O
</s>
<s>
By	O
contrast	O
,	O
lossy	B-Algorithm
compression	I-Algorithm
permits	O
reconstruction	O
only	O
of	O
an	O
approximation	O
of	O
the	O
original	O
data	O
,	O
though	O
usually	O
with	O
greatly	O
improved	O
compression	O
rates	O
(	O
and	O
therefore	O
reduced	O
media	O
sizes	O
)	O
.	O
</s>
<s>
By	O
operation	O
of	O
the	O
pigeonhole	O
principle	O
,	O
no	O
lossless	B-Algorithm
compression	I-Algorithm
algorithm	O
can	O
efficiently	O
compress	B-Device
all	O
possible	O
data	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
many	O
different	O
algorithms	O
exist	O
that	O
are	O
designed	O
either	O
with	O
a	O
specific	O
type	O
of	O
input	O
data	O
in	O
mind	O
or	O
with	O
specific	O
assumptions	O
about	O
what	O
kinds	O
of	O
redundancy	B-General_Concept
the	O
uncompressed	B-General_Concept
data	O
are	O
likely	O
to	O
contain	O
.	O
</s>
<s>
Lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
is	O
used	O
in	O
many	O
applications	O
.	O
</s>
<s>
For	O
example	O
,	O
it	O
is	O
used	O
in	O
the	O
ZIP	B-General_Concept
file	I-General_Concept
format	I-General_Concept
and	O
in	O
the	O
GNU	B-Operating_System
tool	O
gzip	B-Application
.	O
</s>
<s>
It	O
is	O
also	O
often	O
used	O
as	O
a	O
component	O
within	O
lossy	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
technologies	O
(	O
e.g.	O
</s>
<s>
lossless	B-Algorithm
mid/side	O
joint	O
stereo	O
preprocessing	O
by	O
MP3	B-Application
encoders	I-Application
and	O
other	O
lossy	B-Algorithm
audio	O
encoders	O
)	O
.	O
</s>
<s>
Lossless	B-Algorithm
compression	I-Algorithm
is	O
used	O
in	O
cases	O
where	O
it	O
is	O
important	O
that	O
the	O
original	O
and	O
the	O
decompressed	O
data	O
be	O
identical	O
,	O
or	O
where	O
deviations	O
from	O
the	O
original	O
data	O
would	O
be	O
unfavourable	O
.	O
</s>
<s>
Some	O
image	O
file	O
formats	O
,	O
like	O
PNG	O
or	O
GIF	O
,	O
use	O
only	O
lossless	B-Algorithm
compression	I-Algorithm
,	O
while	O
others	O
like	O
TIFF	O
and	O
MNG	O
may	O
use	O
either	O
lossless	B-Algorithm
or	O
lossy	B-Algorithm
methods	O
.	O
</s>
<s>
Lossless	B-Algorithm
audio	O
formats	O
are	O
most	O
often	O
used	O
for	O
archiving	O
or	O
production	O
purposes	O
,	O
while	O
smaller	O
lossy	B-Algorithm
audio	O
files	O
are	O
typically	O
used	O
on	O
portable	O
players	O
and	O
in	O
other	O
cases	O
where	O
storage	O
space	O
is	O
limited	O
or	O
exact	O
replication	O
of	O
the	O
audio	O
is	O
unnecessary	O
.	O
</s>
<s>
Most	O
lossless	B-Algorithm
compression	I-Algorithm
programs	O
do	O
two	O
things	O
in	O
sequence	O
:	O
the	O
first	O
step	O
generates	O
a	O
statistical	O
model	O
for	O
the	O
input	O
data	O
,	O
and	O
the	O
second	O
step	O
uses	O
this	O
model	O
to	O
map	O
input	O
data	O
to	O
bit	O
sequences	O
in	O
such	O
a	O
way	O
that	O
"	O
probable	O
"	O
(	O
i.e.	O
</s>
<s>
The	O
primary	O
encoding	O
algorithms	O
used	O
to	O
produce	O
bit	O
sequences	O
are	O
Huffman	B-General_Concept
coding	I-General_Concept
(	O
also	O
used	O
by	O
the	O
deflate	B-Algorithm
algorithm	I-Algorithm
)	O
and	O
arithmetic	B-Algorithm
coding	I-Algorithm
.	O
</s>
<s>
Arithmetic	B-Algorithm
coding	I-Algorithm
achieves	O
compression	O
rates	O
close	O
to	O
the	O
best	O
possible	O
for	O
a	O
particular	O
statistical	O
model	O
,	O
which	O
is	O
given	O
by	O
the	O
information	O
entropy	O
,	O
whereas	O
Huffman	B-General_Concept
compression	I-General_Concept
is	O
simpler	O
and	O
faster	O
but	O
produces	O
poor	O
results	O
for	O
models	O
that	O
deal	O
with	O
symbol	O
probabilities	O
close	O
to	O
1	O
.	O
</s>
<s>
There	O
are	O
two	O
primary	O
ways	O
of	O
constructing	O
statistical	O
models	O
:	O
in	O
a	O
static	O
model	O
,	O
the	O
data	O
is	O
analyzed	O
and	O
a	O
model	O
is	O
constructed	O
,	O
then	O
this	O
model	O
is	O
stored	O
with	O
the	O
compressed	B-General_Concept
data	I-General_Concept
.	O
</s>
<s>
Lossless	B-Algorithm
compression	I-Algorithm
methods	O
may	O
be	O
categorized	O
according	O
to	O
the	O
type	O
of	O
data	O
they	O
are	O
designed	O
to	O
compress	B-Device
.	O
</s>
<s>
While	O
,	O
in	O
principle	O
,	O
any	O
general-purpose	O
lossless	B-Algorithm
compression	I-Algorithm
algorithm	O
(	O
general-purpose	O
meaning	O
that	O
they	O
can	O
accept	O
any	O
bitstring	O
)	O
can	O
be	O
used	O
on	O
any	O
type	O
of	O
data	O
,	O
many	O
are	O
unable	O
to	O
achieve	O
significant	O
compression	O
on	O
data	O
that	O
are	O
not	O
of	O
the	O
form	O
for	O
which	O
they	O
were	O
designed	O
to	O
compress	B-Device
.	O
</s>
<s>
Many	O
of	O
the	O
lossless	B-Algorithm
compression	I-Algorithm
techniques	O
used	O
for	O
text	O
also	O
work	O
reasonably	O
well	O
for	O
indexed	B-Data_Structure
images	I-Data_Structure
.	O
</s>
<s>
This	O
is	O
often	O
also	O
applied	O
to	O
sound	O
files	O
,	O
and	O
can	O
compress	B-Device
files	O
that	O
contain	O
mostly	O
low	O
frequencies	O
and	O
low	O
volumes	O
.	O
</s>
<s>
This	O
is	O
called	O
discrete	O
wavelet	B-Algorithm
transform	I-Algorithm
.	O
</s>
<s>
In	O
the	O
wavelet	B-Algorithm
transformation	I-Algorithm
,	O
the	O
probabilities	O
are	O
also	O
passed	O
through	O
the	O
hierarchy	O
.	O
</s>
<s>
Many	O
of	O
these	O
methods	O
are	O
implemented	O
in	O
open-source	O
and	O
proprietary	O
tools	O
,	O
particularly	O
LZW	B-Algorithm
and	O
its	O
variants	O
.	O
</s>
<s>
Because	O
of	O
patents	O
on	O
certain	O
kinds	O
of	O
LZW	B-Algorithm
compression	I-Algorithm
,	O
and	O
in	O
particular	O
licensing	O
practices	O
by	O
patent	O
holder	O
Unisys	O
that	O
many	O
developers	O
considered	O
abusive	O
,	O
some	O
open	O
source	O
proponents	O
encouraged	O
people	O
to	O
avoid	O
using	O
the	O
Graphics	O
Interchange	O
Format	O
(	O
GIF	O
)	O
for	O
compressing	O
still	O
image	O
files	O
in	O
favor	O
of	O
Portable	O
Network	O
Graphics	O
(	O
PNG	O
)	O
,	O
which	O
combines	O
the	O
LZ77-based	O
deflate	B-Algorithm
algorithm	I-Algorithm
with	O
a	O
selection	O
of	O
domain-specific	O
prediction	O
filters	O
.	O
</s>
<s>
However	O
,	O
the	O
patents	O
on	O
LZW	B-Algorithm
expired	O
on	O
June	O
20	O
,	O
2003	O
.	O
</s>
<s>
Many	O
of	O
the	O
lossless	B-Algorithm
compression	I-Algorithm
techniques	O
used	O
for	O
text	O
also	O
work	O
reasonably	O
well	O
for	O
indexed	B-Data_Structure
images	I-Data_Structure
,	O
but	O
there	O
are	O
other	O
techniques	O
that	O
do	O
not	O
work	O
for	O
typical	O
text	O
that	O
are	O
useful	O
for	O
some	O
images	O
(	O
particularly	O
simple	O
bitmaps	O
)	O
,	O
and	O
other	O
techniques	O
that	O
take	O
advantage	O
of	O
the	O
specific	O
characteristics	O
of	O
images	O
(	O
such	O
as	O
the	O
common	O
phenomenon	O
of	O
contiguous	O
2-D	O
areas	O
of	O
similar	O
tones	O
,	O
and	O
the	O
fact	O
that	O
color	O
images	O
usually	O
have	O
a	O
preponderance	O
of	O
a	O
limited	O
range	O
of	O
colors	O
out	O
of	O
those	O
representable	O
in	O
the	O
color	O
space	O
)	O
.	O
</s>
<s>
As	O
mentioned	O
previously	O
,	O
lossless	B-Algorithm
sound	O
compression	O
is	O
a	O
somewhat	O
specialized	O
area	O
.	O
</s>
<s>
Lossless	B-Algorithm
sound	O
compression	B-General_Concept
algorithms	I-General_Concept
can	O
take	O
advantage	O
of	O
the	O
repeating	O
patterns	O
shown	O
by	O
the	O
wave-like	O
nature	O
of	O
the	O
data	O
–	O
essentially	O
using	O
autoregressive	B-Algorithm
models	I-Algorithm
to	O
predict	O
the	O
"	O
next	O
"	O
value	O
and	O
encoding	O
the	O
(	O
hopefully	O
small	O
)	O
difference	O
between	O
the	O
expected	O
value	O
and	O
the	O
actual	O
data	O
.	O
</s>
<s>
It	O
is	O
sometimes	O
beneficial	O
to	O
compress	B-Device
only	O
the	O
differences	O
between	O
two	O
versions	O
of	O
a	O
file	O
(	O
or	O
,	O
in	O
video	O
compression	O
,	O
of	O
successive	O
images	O
within	O
a	O
sequence	O
)	O
.	O
</s>
<s>
This	O
is	O
called	O
delta	B-Algorithm
encoding	I-Algorithm
(	O
from	O
the	O
Greek	O
letter	O
Δ	O
,	O
which	O
in	O
mathematics	O
,	O
denotes	O
a	O
difference	O
)	O
,	O
but	O
the	O
term	O
is	O
typically	O
only	O
used	O
if	O
both	O
versions	O
are	O
meaningful	O
outside	O
compression	O
and	O
decompression	O
.	O
</s>
<s>
For	O
example	O
,	O
while	O
the	O
process	O
of	O
compressing	O
the	O
error	O
in	O
the	O
above-mentioned	O
lossless	B-Algorithm
audio	O
compression	O
scheme	O
could	O
be	O
described	O
as	O
delta	B-Algorithm
encoding	I-Algorithm
from	O
the	O
approximated	O
sound	O
wave	O
to	O
the	O
original	O
sound	O
wave	O
,	O
the	O
approximated	O
version	O
of	O
the	O
sound	O
wave	O
is	O
not	O
meaningful	O
in	O
any	O
other	O
context	O
.	O
</s>
<s>
No	O
lossless	B-Algorithm
compression	I-Algorithm
algorithm	O
can	O
efficiently	O
compress	B-Device
all	O
possible	O
data	O
(	O
see	O
the	O
section	O
Limitations	O
below	O
for	O
details	O
)	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
many	O
different	O
algorithms	O
exist	O
that	O
are	O
designed	O
either	O
with	O
a	O
specific	O
type	O
of	O
input	O
data	O
in	O
mind	O
or	O
with	O
specific	O
assumptions	O
about	O
what	O
kinds	O
of	O
redundancy	B-General_Concept
the	O
uncompressed	B-General_Concept
data	O
are	O
likely	O
to	O
contain	O
.	O
</s>
<s>
Some	O
of	O
the	O
most	O
common	O
lossless	B-Algorithm
compression	I-Algorithm
algorithms	O
are	O
listed	O
below	O
.	O
</s>
<s>
Cryptosystems	B-General_Concept
often	O
compress	B-Device
data	O
(	O
the	O
"	O
plaintext	O
"	O
)	O
before	O
encryption	O
for	O
added	O
security	O
.	O
</s>
<s>
However	O
,	O
many	O
ordinary	O
lossless	B-Algorithm
compression	I-Algorithm
algorithms	O
produce	O
headers	O
,	O
wrappers	O
,	O
tables	O
,	O
or	O
other	O
predictable	O
output	O
that	O
might	O
instead	O
make	O
cryptanalysis	O
easier	O
.	O
</s>
<s>
Thus	O
,	O
cryptosystems	B-General_Concept
must	O
utilize	O
compression	B-General_Concept
algorithms	I-General_Concept
whose	O
output	O
does	O
not	O
contain	O
these	O
predictable	O
patterns	O
.	O
</s>
<s>
Genetics	O
compression	B-General_Concept
algorithms	I-General_Concept
(	O
not	O
to	O
be	O
confused	O
with	O
genetic	B-Algorithm
algorithms	I-Algorithm
)	O
are	O
the	O
latest	O
generation	O
of	O
lossless	B-Algorithm
algorithms	O
that	O
compress	B-Device
data	O
(	O
typically	O
sequences	O
of	O
nucleotides	O
)	O
using	O
both	O
conventional	O
compression	B-General_Concept
algorithms	I-General_Concept
and	O
specific	O
algorithms	O
adapted	O
to	O
genetic	O
data	O
.	O
</s>
<s>
In	O
2012	O
,	O
a	O
team	O
of	O
scientists	O
from	O
Johns	O
Hopkins	O
University	O
published	O
the	O
first	O
genetic	O
compression	B-General_Concept
algorithm	I-General_Concept
that	O
does	O
not	O
rely	O
on	O
external	O
genetic	O
databases	O
for	O
compression	O
.	O
</s>
<s>
HAPZIPPER	O
was	O
tailored	O
for	O
HapMap	O
data	O
and	O
achieves	O
over	O
20-fold	O
compression	O
(	O
95%	O
reduction	O
in	O
file	O
size	O
)	O
,	O
providing	O
2	O
-	O
to	O
4-fold	O
better	O
compression	O
much	O
faster	O
than	O
leading	O
general-purpose	O
compression	B-General_Concept
utilities	I-General_Concept
.	O
</s>
<s>
Genomic	O
sequence	O
compression	B-General_Concept
algorithms	I-General_Concept
,	O
also	O
known	O
as	O
DNA	O
sequence	O
compressors	O
,	O
explore	O
the	O
fact	O
that	O
DNA	O
sequences	O
have	O
characteristic	O
properties	O
,	O
such	O
as	O
inverted	O
repeats	O
.	O
</s>
<s>
This	O
type	O
of	O
compression	O
is	O
not	O
strictly	O
limited	O
to	O
binary	O
executables	O
,	O
but	O
can	O
also	O
be	O
applied	O
to	O
scripts	O
,	O
such	O
as	O
JavaScript	B-Language
.	O
</s>
<s>
Lossless	B-Algorithm
compression	I-Algorithm
algorithms	O
and	O
their	O
implementations	O
are	O
routinely	O
tested	O
in	O
head-to-head	O
benchmarks	O
.	O
</s>
<s>
Some	O
benchmarks	O
cover	O
only	O
the	O
data	B-General_Concept
compression	I-General_Concept
ratio	I-General_Concept
,	O
so	O
winners	O
in	O
these	O
benchmarks	O
may	O
be	O
unsuitable	O
for	O
everyday	O
use	O
due	O
to	O
the	O
slow	O
speed	O
of	O
the	O
top	O
performers	O
.	O
</s>
<s>
The	O
winners	O
on	O
these	O
benchmarks	O
often	O
come	O
from	O
the	O
class	O
of	O
context-mixing	B-General_Concept
compression	B-General_Concept
software	I-General_Concept
.	O
</s>
<s>
Matt	O
Mahoney	O
,	O
in	O
his	O
February	O
2010	O
edition	O
of	O
the	O
free	O
booklet	O
Data	B-General_Concept
Compression	I-General_Concept
Explained	O
,	O
additionally	O
lists	O
the	O
following	O
:	O
</s>
<s>
The	O
Calgary	B-General_Concept
Corpus	I-General_Concept
dating	O
back	O
to	O
1987	O
is	O
no	O
longer	O
widely	O
used	O
due	O
to	O
its	O
small	O
size	O
.	O
</s>
<s>
The	O
Large	O
Text	B-General_Concept
Compression	I-General_Concept
Benchmark	O
and	O
the	O
similar	O
Hutter	O
Prize	O
both	O
use	O
a	O
trimmed	O
Wikipedia	O
XML	B-Protocol
UTF-8	O
data	O
set	O
.	O
</s>
<s>
The	O
Generic	O
Compression	O
Benchmark	O
,	O
maintained	O
by	O
Matt	O
Mahoney	O
,	O
tests	O
compression	O
of	O
data	O
generated	O
by	O
random	O
Turing	B-Architecture
machines	I-Architecture
.	O
</s>
<s>
In	O
January	O
2010	O
,	O
the	O
top	O
program	O
was	O
NanoZip	O
followed	O
by	O
FreeArc	B-Application
,	O
CCM	O
,	O
flashzip	O
,	O
and	O
7-Zip	B-Language
.	O
</s>
<s>
The	O
Compression	O
Analysis	O
Tool	O
is	O
a	O
Windows	O
application	O
that	O
enables	O
end	O
users	O
to	O
benchmark	O
the	O
performance	O
characteristics	O
of	O
streaming	O
implementations	O
of	O
LZF4	O
,	O
Deflate	B-Algorithm
,	O
ZLIB	O
,	O
GZIP	B-Application
,	O
BZIP2	B-Application
and	O
LZMA	B-General_Concept
using	O
their	O
own	O
data	O
.	O
</s>
<s>
Lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
algorithms	O
(	O
that	O
do	O
not	O
attach	O
compression	O
id	O
labels	O
to	O
their	O
output	O
data	O
sets	O
)	O
cannot	O
guarantee	O
compression	O
for	O
all	O
input	O
data	O
sets	O
.	O
</s>
<s>
In	O
other	O
words	O
,	O
for	O
any	O
lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
algorithm	O
,	O
there	O
will	O
be	O
an	O
input	O
data	O
set	O
that	O
does	O
not	O
get	O
smaller	O
when	O
processed	O
by	O
the	O
algorithm	O
,	O
and	O
for	O
any	O
lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
algorithm	O
that	O
makes	O
at	O
least	O
one	O
file	O
smaller	O
,	O
there	O
will	O
be	O
at	O
least	O
one	O
file	O
that	O
it	O
makes	O
larger	O
.	O
</s>
<s>
Suppose	O
that	O
there	O
is	O
a	O
compression	B-General_Concept
algorithm	I-General_Concept
that	O
transforms	O
every	O
file	O
into	O
an	O
output	O
file	O
that	O
is	O
no	O
longer	O
than	O
the	O
original	O
file	O
,	O
and	O
that	O
at	O
least	O
one	O
file	O
will	O
be	O
compressed	O
into	O
an	O
output	O
file	O
that	O
is	O
shorter	O
than	O
the	O
original	O
file	O
.	O
</s>
<s>
Together	O
with	O
F	O
,	O
this	O
makes	O
2N+1	O
files	O
that	O
all	O
compress	B-Device
into	O
one	O
of	O
the	O
2N	O
files	O
of	O
length	O
N	O
.	O
</s>
<s>
)	O
,	O
which	O
contradicts	O
the	O
assumption	O
that	O
the	O
algorithm	O
was	O
lossless	B-Algorithm
.	O
</s>
<s>
Most	O
practical	O
compression	B-General_Concept
algorithms	I-General_Concept
provide	O
an	O
"	O
escape	O
"	O
facility	O
that	O
can	O
turn	O
off	O
the	O
normal	O
coding	O
for	O
files	O
that	O
would	O
become	O
longer	O
by	O
being	O
encoded	O
.	O
</s>
<s>
For	O
example	O
,	O
deflate	B-Algorithm
compressed	O
files	O
never	O
need	O
to	O
grow	O
by	O
more	O
than	O
5	O
bytes	O
per	O
65,535	O
bytes	O
of	O
input	O
.	O
</s>
<s>
In	O
fact	O
,	O
if	O
we	O
consider	O
files	O
of	O
length	O
N	O
,	O
if	O
all	O
files	O
were	O
equally	O
probable	O
,	O
then	O
for	O
any	O
lossless	B-Algorithm
compression	I-Algorithm
that	O
reduces	O
the	O
size	O
of	O
some	O
file	O
,	O
the	O
expected	O
length	O
of	O
a	O
compressed	O
file	O
(	O
averaged	O
over	O
all	O
possible	O
files	O
of	O
length	O
N	O
)	O
must	O
necessarily	O
be	O
greater	O
than	O
N	O
.	O
So	O
if	O
we	O
know	O
nothing	O
about	O
the	O
properties	O
of	O
the	O
data	O
we	O
are	O
compressing	O
,	O
we	O
might	O
as	O
well	O
not	O
compress	B-Device
it	O
at	O
all	O
.	O
</s>
<s>
A	O
lossless	B-Algorithm
compression	I-Algorithm
algorithm	O
is	O
useful	O
only	O
when	O
we	O
are	O
more	O
likely	O
to	O
compress	B-Device
certain	O
types	O
of	O
files	O
than	O
others	O
;	O
then	O
the	O
algorithm	O
could	O
be	O
designed	O
to	O
compress	B-Device
those	O
types	O
of	O
data	O
better	O
.	O
</s>
<s>
This	O
is	O
the	O
theoretical	O
reason	O
why	O
we	O
need	O
to	O
have	O
different	O
compression	B-General_Concept
algorithms	I-General_Concept
for	O
different	O
kinds	O
of	O
files	O
:	O
there	O
cannot	O
be	O
any	O
algorithm	O
that	O
is	O
good	O
for	O
all	O
kinds	O
of	O
data	O
.	O
</s>
<s>
The	O
"	O
trick	O
"	O
that	O
allows	O
lossless	B-Algorithm
compression	I-Algorithm
algorithms	O
,	O
used	O
on	O
the	O
type	O
of	O
data	O
they	O
were	O
designed	O
for	O
,	O
to	O
consistently	O
compress	B-Device
such	O
files	O
to	O
a	O
shorter	O
form	O
is	O
that	O
the	O
files	O
the	O
algorithms	O
are	O
designed	O
to	O
act	O
on	O
all	O
have	O
some	O
form	O
of	O
easily	O
modeled	O
redundancy	B-General_Concept
that	O
the	O
algorithm	O
is	O
designed	O
to	O
remove	O
,	O
and	O
thus	O
belong	O
to	O
the	O
subset	O
of	O
files	O
that	O
that	O
algorithm	O
can	O
make	O
shorter	O
,	O
whereas	O
other	O
files	O
would	O
not	O
get	O
compressed	O
or	O
even	O
get	O
bigger	O
.	O
</s>
<s>
Algorithms	O
are	O
generally	O
quite	O
specifically	O
tuned	O
to	O
a	O
particular	O
type	O
of	O
file	O
:	O
for	O
example	O
,	O
lossless	B-Algorithm
audio	O
compression	B-General_Concept
programs	I-General_Concept
do	O
not	O
work	O
well	O
on	O
text	O
files	O
,	O
and	O
vice	O
versa	O
.	O
</s>
<s>
In	O
particular	O
,	O
files	O
of	O
random	O
data	O
cannot	O
be	O
consistently	O
compressed	O
by	O
any	O
conceivable	O
lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
algorithm	O
;	O
indeed	O
,	O
this	O
result	O
is	O
used	O
to	O
define	O
the	O
concept	O
of	O
randomness	O
in	O
Kolmogorov	O
complexity	O
.	O
</s>
<s>
It	O
is	O
provably	O
impossible	O
to	O
create	O
an	O
algorithm	O
that	O
can	O
losslessly	B-Algorithm
compress	B-Device
any	O
data	O
.	O
</s>
<s>
Such	O
an	O
algorithm	O
contradicts	O
fundamental	O
laws	O
of	O
mathematics	O
because	O
,	O
if	O
it	O
existed	O
,	O
it	O
could	O
be	O
applied	O
repeatedly	O
to	O
losslessly	B-Algorithm
reduce	O
any	O
file	O
to	O
length	O
1	O
.	O
</s>
<s>
Abstractly	O
,	O
a	O
compression	B-General_Concept
algorithm	I-General_Concept
can	O
be	O
viewed	O
as	O
a	O
function	O
on	O
sequences	O
(	O
normally	O
of	O
octets	O
)	O
.	O
</s>
<s>
For	O
a	O
compression	B-General_Concept
algorithm	I-General_Concept
to	O
be	O
lossless	B-Algorithm
,	O
the	O
compression	O
map	O
must	O
form	O
an	O
injection	O
from	O
"	O
plain	O
"	O
to	O
"	O
compressed	O
"	O
bit	O
sequences	O
.	O
</s>
<s>
Therefore	O
,	O
it	O
is	O
not	O
possible	O
to	O
produce	O
a	O
lossless	B-Algorithm
algorithm	O
that	O
reduces	O
the	O
size	O
of	O
every	O
possible	O
input	O
sequence	O
.	O
</s>
<s>
Real	O
compression	B-General_Concept
algorithm	I-General_Concept
designers	O
accept	O
that	O
streams	O
of	O
high	O
information	O
entropy	O
cannot	O
be	O
compressed	O
,	O
and	O
accordingly	O
,	O
include	O
facilities	O
for	O
detecting	O
and	O
handling	O
this	O
condition	O
.	O
</s>
<s>
An	O
obvious	O
way	O
of	O
detection	O
is	O
applying	O
a	O
raw	O
compression	B-General_Concept
algorithm	I-General_Concept
and	O
testing	O
if	O
its	O
output	O
is	O
smaller	O
than	O
its	O
input	O
.	O
</s>
<s>
Sometimes	O
,	O
detection	O
is	O
made	O
by	O
heuristics	B-Algorithm
;	O
for	O
example	O
,	O
a	O
compression	O
application	O
may	O
consider	O
files	O
whose	O
names	O
end	O
in	O
"	O
.zip	B-General_Concept
"	O
,	O
"	O
.arj	O
"	O
or	O
"	O
.lha	O
"	O
uncompressible	O
without	O
any	O
more	O
sophisticated	O
detection	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
zip	B-General_Concept
data	O
format	O
specifies	O
the	O
'	O
compression	O
method	O
 '	O
of	O
'	O
Stored	O
 '	O
for	O
input	O
files	O
that	O
have	O
been	O
copied	O
into	O
the	O
archive	O
verbatim	O
.	O
</s>
<s>
Mark	O
Nelson	O
,	O
in	O
response	O
to	O
claims	O
of	O
"	O
magic	O
"	O
compression	B-General_Concept
algorithms	I-General_Concept
appearing	O
in	O
comp.compression	O
,	O
has	O
constructed	O
a	O
415,241	O
byte	O
binary	O
file	O
of	O
highly	O
entropic	O
content	O
,	O
and	O
issued	O
a	O
public	O
challenge	O
of	O
$100	O
to	O
anyone	O
to	O
write	O
a	O
program	O
that	O
,	O
together	O
with	O
its	O
input	O
,	O
would	O
be	O
smaller	O
than	O
his	O
provided	O
binary	O
data	O
yet	O
be	O
able	O
to	O
reconstitute	O
it	O
without	O
error	O
.	O
</s>
