File size: 5,485 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | import OAI.Combinatorics.EditApproximation.Refinement.ComputedWidthEnvelope
import OAI.Combinatorics.EditApproximation.Refinement.ComputedPhysicalWork
namespace OAI
namespace EditApproximation
open Filter
open scoped Topology
def localKernelPowerExponent (M p D : β) : β := ((100 * M + 100000) * (p + 1)) * D
def computedLocalKernelBudget (D N : β) : β :=
inputHeight N ^ localKernelPowerExponent (integerParameters N).M
(coarseExponent (inputSmallLog N)) D
noncomputable def computedLocalKernelExponent (D N : β) : β :=
(D : β) * ((100 * Real.log 2) * ((integerParameters N).M : β) *
((coarseExponent (inputSmallLog N) : β) + 1) * inputSmallLog N +
100000 * ((coarseExponent (inputSmallLog N) : β) + 1) * Real.log (inputHeight N : β))
theorem computedLocalKernelExponent_tendsto (D : β) :
Tendsto (fun N => computedLocalKernelExponent D N / inputHeight N) atTop (π 0) := by
have h := ((local_enumeration_exponent_div_height_tendsto.const_mul (100 * Real.log 2)).add
(encoding_exponent_div_height_tendsto.const_mul 100000)).const_mul (D : β)
simp only [mul_zero, zero_add] at h
convert h using 1
ext N
unfold computedLocalKernelExponent
ring
private theorem localKernelBudget_exp_scalar (D H M p ell : β) (hH : 0 < H)
(hlog : Real.log (H : β) β€ (ell : β) * Real.log 2) :
((H ^ localKernelPowerExponent M p D : β) : β) β€
Real.exp ((D : β) * ((100 * Real.log 2) * (M : β) * ((p : β) + 1) * ell +
100000 * ((p : β) + 1) * Real.log (H : β))) := by
rw [Nat.cast_pow, nat_pow_eq_exp_log H _ hH]
apply Real.exp_le_exp.mpr
have hM : (0 : β) β€ (M : β) := Nat.cast_nonneg _
have hp : (0 : β) β€ (p : β) + 1 := by positivity
have hmul := mul_le_mul_of_nonneg_left hlog
(mul_nonneg (mul_nonneg (by norm_num : (0 : β) β€ 100) hM) hp)
have hD : (0 : β) β€ (D : β) := Nat.cast_nonneg _
unfold localKernelPowerExponent
push_cast
nlinarith only [mul_nonneg hD (sub_nonneg.mpr hmul)]
theorem computedLocalKernelBudget_exp_bound (D N : β) (hN : 0 < N) :
(computedLocalKernelBudget D N : β) β€ Real.exp (computedLocalKernelExponent D N) := by
have hlog : Real.log (inputHeight N : β) β€ (inputSmallLog N : β) * Real.log 2 := by
rw [inputHeight_real_log]
exact mul_le_mul_of_nonneg_right (by exact_mod_cast (inputSmallLog_bounds N hN).1)
(Real.log_nonneg (by norm_num))
exact localKernelBudget_exp_scalar D (inputHeight N) (integerParameters N).M
(coarseExponent (inputSmallLog N)) (inputSmallLog N) (Nat.two_pow_pos _) hlog
theorem computedLocalKernelBudget_subpolynomial (D : β) (epsilon : β) (hepsilon : 0 < epsilon) :
βαΆ N in atTop, (computedLocalKernelBudget D N : β) β€ (N + 2 : β) ^ epsilon := by
filter_upwards [subexponential_height_to_input (computedLocalKernelExponent D)
(computedLocalKernelExponent_tendsto D) epsilon hepsilon, eventually_ge_atTop 1] with N he hN
exact (computedLocalKernelBudget_exp_bound D N (by omega)).trans he
theorem computedLocalKernelBudget_envelope_near_linear (D : β) (epsilon : β) (hepsilon : 0 < epsilon) :
βαΆ N in atTop, computedWidthEnvelope N * computedLocalKernelBudget D N β€
(N + 2 : β) ^ (1 + epsilon) := by
filter_upwards [computedWidthEnvelope_mul_exp_near_linear (computedLocalKernelExponent D)
(computedLocalKernelExponent_tendsto D) epsilon hepsilon, eventually_ge_atTop 1] with N he hN
exact (mul_le_mul_of_nonneg_left (computedLocalKernelBudget_exp_bound D N (by omega))
(computedWidthEnvelope_nonneg N)).trans he
theorem computedLocalKernelBudget_widthWork_near_linear (D : β) (epsilon : β) (hepsilon : 0 < epsilon) :
βαΆ N in atTop, β n β€ N, β tree : DependencyExpansion,
tree.Valid ((integerParameters N).M * inputSmallLog N ^ 257)
(inputHeight N ^ (512 * (coarseExponent (inputSmallLog N) + 1))) β
tree.depth = intervalTreeDepth (integerParameters N).M n β
tree.rank β€ computedDependencyIndexCount N β
(tree.widthWork (integerParameters N).M n : β) * computedLocalKernelBudget D N β€
(N + 2 : β) ^ (1 + epsilon) := by
filter_upwards [computed_widthWork_subexponential (computedLocalKernelExponent D)
(computedLocalKernelExponent_tendsto D) epsilon hepsilon, eventually_ge_atTop 1] with N he hN
intro n hn tree hv hd hk
exact (mul_le_mul_of_nonneg_left (computedLocalKernelBudget_exp_bound D N (by omega))
(Nat.cast_nonneg _)).trans (he n hn tree hv hd hk)
theorem computedLocalKernelBudget_requests_near_linear (D : β) (epsilon : β) (hepsilon : 0 < epsilon) :
βαΆ N in atTop, β source target : List β, source.length + target.length β€ N β
β input : ComputedFamilyInput source target N,
((computedFamilyResult source target N input).requests : β) * computedLocalKernelBudget D N β€
(N + 2 : β) ^ (1 + epsilon) := by
have hh : 0 < epsilon / 2 := half_pos hepsilon
filter_upwards [computedFamilyResult_requests_near_linear (epsilon / 2) hh,
computedLocalKernelBudget_subpolynomial D (epsilon / 2) hh] with N hr hk
intro source target hsize input
calc
_ β€ (N + 2 : β) ^ (1 + epsilon / 2) * (N + 2 : β) ^ (epsilon / 2) :=
mul_le_mul (hr source target hsize input) hk (Nat.cast_nonneg _) (Real.rpow_nonneg (by positivity) _)
_ = _ := by rw [β Real.rpow_add (by positivity)]; congr 1; ring
end EditApproximation
end OAI
|