File size: 2,675 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
47
48
49
50
51
52
53
54
import OAI.Combinatorics.EditApproximation.Geometry.RankedMemoAddressWork
import OAI.Combinatorics.EditApproximation.Refinement.ComputedExecutionWork
import OAI.Combinatorics.EditApproximation.Geometry.HeightPowerWork
import OAI.Combinatorics.EditApproximation.Definitions


namespace OAI

namespace EditApproximation
open Filter



 theorem computedFamilyAddressWork_le (source target : List β„•) (N : β„•)
    (input : ComputedFamilyInput source target N) :
    computedFamilyAddressWork source target N input ≀
      2 * (7 * intervalTreeDepth (integerParameters N).M source.length + 60) *
        (computedFamilyResult source target N input).requests :=
  rankedMemoAddressWork_le _ _ _ _ _ _
    (computedFamilyMemoCodeWithWork_cost source target N (inputHeight N ^ 2)) _ _

private theorem address_factor_bound (H J : β„•) (hH : 100 ≀ H) (hJ : J ≀ H) :
    2 * (7 * J + 60) ≀ H ^ 2 := by nlinarith only [hH, hJ]

 theorem computedFamilyAddressWork_near_linear (epsilon : ℝ) (hepsilon : 0 < epsilon) :
    βˆ€αΆ  N in atTop, βˆ€ source target : List β„•, source.length + target.length ≀ N β†’
      βˆ€ input : ComputedFamilyInput source target N,
      (computedFamilyAddressWork source target N input : ℝ) ≀ (N + 2 : ℝ) ^ (1 + epsilon) := by
  have hh : 0 < epsilon / 2 := half_pos hepsilon
  filter_upwards [computedFamilyResult_requests_near_linear (epsilon / 2) hh,
    fixed_height_power_subpolynomial 2 (epsilon / 2) hh,
    eventually_ge_atTop 1, inputSmallLog_tendsto.eventually (eventually_ge_atTop 200)]
    with N hr hp hN hell
  intro source target hsize input
  have hdepth := computed_tree_depth_bound N source.length (by omega) (by omega) hell
  have hJ : intervalTreeDepth (integerParameters N).M source.length ≀ inputHeight N := by
    nlinarith only [hdepth, hell]
  have hH : 100 ≀ inputHeight N := (by omega : 100 ≀ inputSmallLog N).trans
    (computed_smallLog_le_height N)
  have hfactor := address_factor_bound (inputHeight N) _ hH hJ
  have ha := computedFamilyAddressWork_le source target N input
  have haR : (computedFamilyAddressWork source target N input : ℝ) ≀
      (inputHeight N : ℝ) ^ 2 * (computedFamilyResult source target N input).requests := by
    exact_mod_cast ha.trans (Nat.mul_le_mul_right _ hfactor)
  calc
    _ ≀ (inputHeight N : ℝ) ^ 2 * (computedFamilyResult source target N input).requests := haR
    _ ≀ (N + 2 : ℝ) ^ (epsilon / 2) * (N + 2 : ℝ) ^ (1 + epsilon / 2) :=
      mul_le_mul hp (hr source target hsize input) (Nat.cast_nonneg _) (Real.rpow_nonneg (by positivity) _)
    _ = _ := by rw [← Real.rpow_add (by positivity)]; congr 1; ring

end EditApproximation

end OAI