InformationTheory.Shannon.Huffman.ExpectedLength
Expected length of the Huffman code #
The multiset-level cost huffmanCost aggregates the expected codeword length of
huffmanLengthAux. Its merge-step recurrence and dependence only on the probability multiset are
the machinery used in the optimality proof; expectedLength_eq_huffmanCost ties it back to the
expected length of the published huffmanLength.
Main definitions #
huffmanCost— multiset-level expected length used in the cost-level optimality proof.
Main statements #
huffmanCost_step—huffmanCostdecreases by the merged-group probability at each step.huffmanCost_eq_of_prob_multiset—huffmanCostdepends only on the probability multiset.expectedLength_eq_huffmanCost— the expected length ofhuffmanLength PequalshuffmanCost (initMultiset P).
Cost-level recurrence for the optimality proof #
InformationTheory.Shannon.Huffman.huffmanCost
sourceMultiset-level expected length ∑_p p.2 * (∑_{a ∈ p.1} huffmanLengthAux s a) / p.1.card.
Since depth is constant on each group, this equals ∑_p p.2 * depth(p).
@audit:ok
Equations
- One or more equations did not get rendered due to their size.
Instances For
Used by
InformationTheory.Shannon.Huffman.huffmanCost_step
sourcehuffmanCost s = huffmanCost s'' + (x1.2 + x2.2) where s'' is the merged multiset.
@audit:ok
Used by
InformationTheory.Shannon.Huffman.huffmanCost_eq_zero_of_base
sourcehuffmanCost s = 0 when s.card ≤ 1.
@audit:ok
Used by
InformationTheory.Shannon.Huffman.huffmanCost_eq_of_prob_multiset
sourcehuffmanCost depends only on the probability multiset s.map Prod.snd.
@audit:ok
Used by
InformationTheory.Shannon.Huffman.expectedLength_eq_huffmanCost
sourceexpectedLength P (huffmanLength P) = huffmanCost (initMultiset P).
@audit:ok