File size: 1,982 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import OAI.Combinatorics.BinaryEdit.CodeNumerics
import OAI.Combinatorics.BinaryEdit.SegmentCodeLCS

namespace OAI

/-! Closing the probabilistic segment-code construction at the exact source
parameters: block width MΒ² and cutoff ceil(120 logβ‚‚ M). -/

namespace TreeEdit.BinaryLower.Code

universe u

/-- A single binary codebook separates all long segments of unequal labels.
The alphabet can be arbitrary finite; its size is only bounded by M. -/
theorem exists_fixed_width_separated_code {M : β„•} (hM : 2 ≀ M)
    (Ξ“ : Type u) [Fintype Ξ“] (hΞ“ : Fintype.card Ξ“ ≀ M) :
    βˆƒ c : Ξ“ β†’ Word Bool (M ^ 2),
      βˆ€ (k l : Ξ“), k β‰  l β†’ βˆ€ (a i j : β„•), segmentThreshold M ≀ a β†’
        i + a ≀ M ^ 2 β†’ j + a ≀ M ^ 2 β†’
          100 * lcs (((c k).val.drop i).take a)
            (((c l).val.drop j).take a) ≀ 99 * a := by
  apply SegmentCode.exists_lcs_separated_code Ξ“ (M ^ 2) (segmentThreshold M)
  simpa only [Nat.cast_add, Nat.cast_pow, Nat.cast_one] using
    code_union_bound_for_alphabet hΞ“ hM

/-- There is an absolute threshold at which the actual codebook and the
short-pair error budget needed by the deterministic proof coexist. -/
theorem exists_binary_code_with_error_budget :
    βˆƒ Mβ‚€ : β„•, βˆ€ M : β„•, Mβ‚€ ≀ M β†’
      2 ≀ M ∧
      2 * (M : ℝ) * segmentThreshold M ≀ (M : ℝ) ^ 2 / 2 ∧
      βˆ€ (Ξ“ : Type u) [Fintype Ξ“], Fintype.card Ξ“ ≀ M β†’
        βˆƒ c : Ξ“ β†’ Word Bool (M ^ 2),
          βˆ€ (k l : Ξ“), k β‰  l β†’ βˆ€ (a i j : β„•), segmentThreshold M ≀ a β†’
            i + a ≀ M ^ 2 β†’ j + a ≀ M ^ 2 β†’
              100 * lcs (((c k).val.drop i).take a)
                (((c l).val.drop j).take a) ≀ 99 * a := by
  obtain ⟨Mβ‚€, hMβ‚€βŸ© := exists_code_numerical_threshold
  refine ⟨Mβ‚€, fun M hM => ?_⟩
  obtain ⟨hM2, herr, _⟩ := hMβ‚€ M hM
  exact ⟨hM2, herr, fun Ξ“ _ hΞ“ => exists_fixed_width_separated_code hM2 Ξ“ hΞ“βŸ©

end TreeEdit.BinaryLower.Code

end OAI