LZ77 against LZ78 #
Every LZ78 phrase is an earlier phrase followed by one symbol
(Cslib.Algorithms.Lean.LempelZiv.LZ78.isTreeStructured_parse), and an earlier phrase is a copy
from the text already written. So when the window covers the input, the LZ78 parse is an LZ77
history, and the optimality of the exhaustive history
(Cslib.Algorithms.Lean.LempelZiv.LZ77.length_parse_le_of_isHistory) gives
#LZ77 phrases ≤ #LZ78 phrases. With the distinct-parsing bound for LZ78
(Cslib.Algorithms.Lean.LempelZiv.LZ78.length_parse_le_div), the number of LZ77 phrases, and the
Lempel–Ziv complexity, of an input of length n ≥ 2 over an alphabet of size k ≥ 2 is at most
n / ((1 - ε_n) log_k n).
Main results #
Cslib.Algorithms.Lean.LempelZiv.LZ77.isHistory_of_isTreeStructured: a tree-structured phrase sequence is a history once the window covers the text.Cslib.Algorithms.Lean.LempelZiv.LZ77.length_parse_le_length_parse:#LZ77 ≤ #LZ78forW ≥ n.Cslib.Algorithms.Lean.LempelZiv.LZ77.length_parse_le_div,Cslib.Algorithms.Lean.LempelZiv.LZ77.complexity_le_div:c ≤ n / ((1 - ε_n) log_k n).
References #
A tree-structured phrase sequence (every phrase is [] or an earlier phrase, followed by one
symbol) whose dictionary entries occur in the text h is a history of h ++ ws.flatten from h,
as long as the window covers the whole text.
When the window covers the input, the LZ78 parse is an LZ77 history.
LZ77 needs no more phrases than LZ78 when the window covers the input.
The Lempel–Ziv complexity is at most the number of LZ78 phrases.
The distinct-parsing bound for LZ77: with a window covering the input, the number of phrases
c of an input of length n ≥ 2 over an alphabet of size k ≥ 2 satisfies
c ≤ n / ((1 - ε_n) log_k n) whenever ε_n < 1.
The Lempel–Ziv complexity of an input of length n ≥ 2 over an alphabet of size k ≥ 2 is
at most n / ((1 - ε_n) log_k n) whenever ε_n < 1.