File size: 2,521 Bytes
e320e82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import OAI.Combinatorics.EditDistance.DepthInversion
import OAI.Combinatorics.EditDistance.FiniteLower
import OAI.Combinatorics.EditDistance.DistortionMonotonicity

namespace OAI

/-!
# Binary witnesses for every sufficiently large length bound
-/

namespace EditLower

universe u

open EditDistortion EditParameters Filter

theorem eventually_length_witness : ∀ᶠ d : ℕ in atTop,
    ∃ n : ℕ, n ≤ d ∧ ∃ S : Set (List Bool), S.Finite ∧ S.Nonempty ∧ S.Nontrivial ∧
      (∀ w ∈ S, w.length = n) ∧
      exponentScale (1/1200) d ≤ leastDistortion (fun x y : S => (edit x.val y.val : ℝ)) := by
  obtain ⟨K,hK⟩ := eventually_atTop.mp eventually_depth_witness
  let J := max (max K (24^4)) 2
  have hlim : Tendsto (fun d : ℕ => Real.log (d : ℝ)) atTop atTop :=
    Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop
  have hchoose := hlim.eventually (EditDepth.eventually_choose_depth J)
  filter_upwards [hchoose,eventually_ge_atTop 1] with d hd hd1
  let k := EditDepth.depth (Real.log (d : ℝ))
  have hk : J ≤ k := hd.1
  have hkK : K ≤ k := (le_max_left K (24^4)).trans ((le_max_left _ _).trans hk)
  have hk24 : 24^4 ≤ k := (le_max_right K (24^4)).trans ((le_max_left _ _).trans hk)
  have hk2 : 2 ≤ k := (le_max_right _ _).trans hk
  have hk0 : 0 < k := by omega
  obtain ⟨S,hfin,hne,hnt,hlen,hD⟩ := hK k hkK
  have hn : encodedLength k ≤ d := by
    have hlog : Real.log (encodedLength k : ℝ) ≤ Real.log (d : ℝ) :=
      (log_length_bound hk2).trans hd.2.1
    have hnp : (0 : ℝ) < encodedLength k := by exact_mod_cast encodedLength_pos hk0
    have hdp : (0 : ℝ) < d := by exact_mod_cast hd1
    exact_mod_cast (Real.log_le_log_iff hnp hdp).mp hlog
  refine ⟨encodedLength k,hn,S,hfin,hne,hnt,hlen,?_⟩
  apply le_trans ?_ ((ratio_exponential hk24).trans hD)
  apply Real.exp_le_exp.mpr
  simpa only [div_eq_mul_inv,mul_comm,one_mul,k] using hd.2.2

theorem lower_main : ∃ c : ℝ, 0 < c ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d →
    (∀ (Alpha : Type u) [Fintype Alpha], 2 ≤ Fintype.card Alpha →
      exponentScale c d ≤ E Alpha d) ∧ BinaryWitness c d := by
  obtain ⟨d₀,hd₀⟩ := eventually_atTop.mp eventually_length_witness
  refine ⟨1/1200,by norm_num,d₀,?_⟩
  intro d hd
  obtain ⟨n,hn,S,hfin,hne,hnt,hlen,hD⟩ := hd₀ d hd
  constructor
  · intro Alpha inst hAlpha
    exact hD.trans (binary_subset_lower Alpha hAlpha hn S hfin hnt hlen)
  · exact ⟨n,hn,S,hfin,hne,hlen,hD⟩

end EditLower

end OAI