Lean module · Foundations
BanditRLProof.LowerBounds.PrefixCodeConstruction
Generated source map for this Lean module.
Module map
Imports
BanditRLProof.LowerBounds.ShannonLengths
Imported by
BanditRLProof, BanditRLProof.LowerBounds.BlockEntropy, BanditRLProof.LowerBounds.PrefixCodeExchange
Declarations
Open an item to read its exact compact statement and source link. Detailed teaching notes are linked when registered.
def
BanditRLProof.LowerBounds.binaryWords
Compiled
All words at depth n in the full binary tree.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.binaryWordsReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
def binaryWords (n : ℕ) : Finset (List Bool)
theorem
BanditRLProof.LowerBounds.card_binaryWords
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.card_binaryWordsReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem card_binaryWords (n : ℕ) : (binaryWords n).card = 2 ^ n
theorem
BanditRLProof.LowerBounds.mem_binaryWords_iff
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.mem_binaryWords_iffReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem mem_binaryWords_iff (w : List Bool) (n : ℕ) : w ∈ binaryWords n ↔ w.length = n
def
BanditRLProof.LowerBounds.binaryExtensions
Compiled
The descendants of a prefix after n additional bits.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.binaryExtensionsReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
def binaryExtensions (w : List Bool) (n : ℕ) : Finset (List Bool)
theorem
BanditRLProof.LowerBounds.card_binaryExtensions
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.card_binaryExtensionsReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem card_binaryExtensions (w : List Bool) (n : ℕ) : (binaryExtensions w n).card = 2 ^ n
theorem
BanditRLProof.LowerBounds.mem_binaryExtensions_iff
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.mem_binaryExtensions_iffReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem mem_binaryExtensions_iff (w v : List Bool) (n : ℕ) : v ∈ binaryExtensions w n ↔ w <+: v ∧ v.length = w.length + n
theorem
BanditRLProof.LowerBounds.binaryExtensions_disjoint_of_incomparable
Compiled
Cylinders from incomparable prefixes are disjoint.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.binaryExtensions_disjoint_of_incomparableReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem binaryExtensions_disjoint_of_incomparable (u v : List Bool) (m n : ℕ) (huv : ¬ u <+: v) (hvu : ¬ v <+: u) : Disjoint (binaryExtensions u m) (binaryExtensions v n)
theorem
BanditRLProof.LowerBounds.exists_binaryWord_avoiding_prefixes
Compiled
A free word exists whenever previous prefixes occupy fewer than all level nodes.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_binaryWord_avoiding_prefixesReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_binaryWord_avoiding_prefixes (S : Finset (List Bool)) (n : ℕ) (hlen : ∀ w ∈ S, w.length ≤ n) (hbudget : (∑ w ∈ S, 2 ^ (n - w.length)) < 2 ^ n) : ∃ v : List Bool, v.length = n ∧ ∀ w ∈ S, ¬ w <+: v
theorem
BanditRLProof.LowerBounds.binary_level_mul_kraft_weight
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.binary_level_mul_kraft_weightReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem binary_level_mul_kraft_weight {k n : ℕ} (h : k ≤ n) : (2 : ℝ) ^ n * (1 / 2 : ℝ) ^ k = 2 ^ (n - k)
theorem
BanditRLProof.LowerBounds.exists_binaryWord_of_kraft_lt_one
Compiled
Real Kraft slack supplies the integer capacity needed to insert a word.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_binaryWord_of_kraft_lt_oneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_binaryWord_of_kraft_lt_one (S : Finset (List Bool)) (n : ℕ) (hlen : ∀ w ∈ S, w.length ≤ n) (hk : (∑ w ∈ S, (1 / 2 : ℝ) ^ w.length) < 1) : ∃ v : List Bool, v.length = n ∧ ∀ w ∈ S, ¬ w <+: v
theorem
BanditRLProof.LowerBounds.exists_prefixFree_insert_of_kraft_lt_one
Compiled
The greedy insertion preserves prefix freedom in both directions.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_prefixFree_insert_of_kraft_lt_oneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_prefixFree_insert_of_kraft_lt_one (S : Finset (List Bool)) (n : ℕ) (hfree : ∀ a ∈ S, ∀ b ∈ S, a <+: b → a = b) (hlen : ∀ w ∈ S, w.length ≤ n) (hk : (∑ w ∈ S, (1 / 2 : ℝ) ^ w.length) < 1) : ∃ v : List Bool, v.length = n ∧ v ∉ S ∧ ∀ a ∈ insert v S, ∀ b ∈ insert v S, a <+: b → a = b
theorem
BanditRLProof.LowerBounds.exists_prefix_encoding_of_kraft_le_one
Compiled
Finite Kraft converse, retaining each prescribed length, including equality.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_prefix_encoding_of_kraft_le_oneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_prefix_encoding_of_kraft_le_one {α : Type*} [DecidableEq α] (s : Finset α) (l : α → ℕ) (hk : (∑ i ∈ s, (1 / 2 : ℝ) ^ l i) ≤ 1) : ∃ c : α → List Bool, (∀ i ∈ s, (c i).length = l i) ∧ (∀ i ∈ s, ∀ j ∈ s, c i <+: c j → i = j)
theorem
BanditRLProof.LowerBounds.exists_prefix_encoding_of_kraft_lt_one
Compiled
Backwards-compatible strict version of the finite Kraft converse.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_prefix_encoding_of_kraft_lt_oneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_prefix_encoding_of_kraft_lt_one {α : Type*} [DecidableEq α] (s : Finset α) (l : α → ℕ) (hk : (∑ i ∈ s, (1 / 2 : ℝ) ^ l i) < 1) : ∃ c : α → List Bool, (∀ i ∈ s, (c i).length = l i) ∧ (∀ i ∈ s, ∀ j ∈ s, c i <+: c j → i = j)
theorem
BanditRLProof.LowerBounds.exists_binaryPrefixCode_of_kraft_le_one
Compiled
Non-strict Kraft converse packaged as an actual binary prefix code.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_binaryPrefixCode_of_kraft_le_oneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_binaryPrefixCode_of_kraft_le_one {α : Type*} [Fintype α] [DecidableEq α] (l : α → ℕ) (hl : ∀ i, 0 < l i) (hk : (∑ i, (1 / 2 : ℝ) ^ l i) ≤ 1) : ∃ code : BinaryPrefixCode α, ∀ i, (code.encode i).length = l i
theorem
BanditRLProof.LowerBounds.exists_binaryPrefixCode_of_kraft_lt_one
Compiled
Backwards-compatible strict Kraft packaging.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_binaryPrefixCode_of_kraft_lt_oneReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_binaryPrefixCode_of_kraft_lt_one {α : Type*} [Fintype α] [DecidableEq α] (l : α → ℕ) (hl : ∀ i, 0 < l i) (hk : (∑ i, (1 / 2 : ℝ) ^ l i) < 1) : ∃ code : BinaryPrefixCode α, ∀ i, (code.encode i).length = l i
theorem
BanditRLProof.LowerBounds.exists_prefixCode_of_uniquelyDecodable
Compiled
Every finite uniquely decodable encoder has a prefix code with exactly the same symbol lengths (the boxed assertion in Chapter 14, Section 14.1).
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret · Chapter 14: Foundations of Information Theory
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_prefixCode_of_uniquelyDecodableReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_prefixCode_of_uniquelyDecodable {α : Type*} [Fintype α] (c : α → List Bool) (hinj : Function.Injective c) (hud : InformationTheory.UniquelyDecodable (Set.range c)) : ∃ code : BinaryPrefixCode α, ∀ i, (code.encode i).length = (c i).length
theorem
BanditRLProof.LowerBounds.exists_binaryPrefixCode_entropy_sandwich
Compiled
A realizable finite prefix code attains the one-bit entropy sandwich. This proves existence, not Huffman's algorithm or optimality.
Used in these reading views: Bandit Book
1. Finite bandits, traces, and regret
Canonical node identity
declaration:BanditRLProof.LowerBounds.exists_binaryPrefixCode_entropy_sandwichReading membership is not a proof dependency. Exact assumptions remain in the Lean statement.
theorem exists_binaryPrefixCode_entropy_sandwich {α : Type*} [Fintype α] [DecidableEq α] (p : α → ℝ) (hp : ∀ i, 0 ≤ p i) (hs : ∑ i, p i = 1) : ∃ code : BinaryPrefixCode α, discreteEntropyBaseTwo Finset.univ p ≤ expectedCodeLength p code ∧ expectedCodeLength p code ≤ discreteEntropyBaseTwo Finset.univ p + 1