File size: 7,370 Bytes
e63eb7f | 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import OAI.Combinatorics.EditApproximation.Refinement.ComputedExecutionWork
import OAI.Combinatorics.EditApproximation.Refinement.ComputedJointCoarseWork
import OAI.Combinatorics.EditApproximation.Refinement.ComputedAddressWork
import OAI.Combinatorics.EditApproximation.Definitions
namespace OAI
namespace EditApproximation
open Filter MeasureTheory
theorem computedExecutionRejectionWork_integrable (source target : List ℕ) (N : ℕ) :
Integrable (computedExecutionRejectionWork source target N) (computedExecutionLaw source target N) := by
let incoming := physicalCoarseSeedLaw (M := (integerParameters N).M)
(J := intervalTreeDepth (integerParameters N).M source.length) source target N
(integerParameters N).B (computedPhysicalCoarseDepth source target N)
have hi : Integrable (computedFamilyRejectionWork source target N)
(physicalFamilyRuntimeLaw (R := inputHeight N ^ 2) target N (integerParameters N).P
(inputHeight N) incoming) :=
finite_outer_integrable incoming _ (computedFamilyRejectionWork source target N)
(computedFamilyRejectionWork_integrable source target N)
have hj : Integrable (computedFamilyRejectionWork source target N)
((computedExecutionLaw source target N).map (computedExecutionProjection source target N)) := by
rw [computedExecutionProjection_law]
exact hi
exact hj.comp_measurable (computedExecutionProjection_measurable source target N)
theorem computedExecutionAccepted_measurable (source target : List ℕ) (N : ℕ) :
Measurable (computedExecutionAccepted source target N) := measurable_of_countable _
theorem computedExecutionAcceptedWork_integrable (source target : List ℕ) (N : ℕ)
(f : ComputedFamilyInput source target N → ℝ) :
Integrable (f ∘ computedExecutionAccepted source target N) (computedExecutionLaw source target N) := by
have hi : Integrable f ((computedExecutionLaw source target N).map
(computedExecutionAccepted source target N)) := Integrable.of_finite
exact hi.comp_measurable (computedExecutionAccepted_measurable source target N)
theorem computedExecutionDictionaryWork_integrable (source target : List ℕ) (N : ℕ) :
Integrable (computedExecutionDictionaryWork source target N) (computedExecutionLaw source target N) :=
computedExecutionAcceptedWork_integrable source target N
(fun input => (computedFamilyResult source target N input).dictionaryVisits)
theorem computedExecutionDictionaryWork_expected_near_linear (epsilon : ℝ) (hepsilon : 0 < epsilon) :
∀ᶠ N in atTop, ∀ source target : List ℕ, source.length + target.length ≤ N →
(∫ execution, computedExecutionDictionaryWork source target N execution
∂computedExecutionLaw source target N) ≤ (N + 2 : ℝ) ^ (1 + epsilon) := by
filter_upwards [computedFamilyResult_dictionary_near_linear epsilon hepsilon] with N hN
intro source target hsize
calc
_ ≤ ∫ _ : ComputedExecutionOutcome source target N, (N + 2 : ℝ) ^ (1 + epsilon)
∂computedExecutionLaw source target N :=
integral_mono (computedExecutionDictionaryWork_integrable source target N) (integrable_const _)
(fun execution => hN source target hsize _)
_ = _ := by simp
theorem computedExecutionAddressWork_integrable (source target : List ℕ) (N : ℕ) :
Integrable (computedExecutionAddressWork source target N) (computedExecutionLaw source target N) :=
computedExecutionAcceptedWork_integrable source target N
(fun input => (computedFamilyAddressWork source target N input : ℝ))
theorem computedExecutionAddressWork_expected_near_linear (epsilon : ℝ) (hepsilon : 0 < epsilon) :
∀ᶠ N in atTop, ∀ source target : List ℕ, source.length + target.length ≤ N →
(∫ execution, computedExecutionAddressWork source target N execution
∂computedExecutionLaw source target N) ≤ (N + 2 : ℝ) ^ (1 + epsilon) := by
filter_upwards [computedFamilyAddressWork_near_linear epsilon hepsilon] with N hN
intro source target hsize
calc
_ ≤ ∫ _ : ComputedExecutionOutcome source target N, (N + 2 : ℝ) ^ (1 + epsilon)
∂computedExecutionLaw source target N :=
integral_mono (computedExecutionAddressWork_integrable source target N) (integrable_const _)
(fun execution => hN source target hsize _)
_ = _ := by simp
/-- These are the actual coarse, rejection-bit, dictionary and address-construction counters.
The local arithmetic counter is kept separate until its kernel is composed. -/
theorem computedExecutionNonlocalWork_integrable (source target : List ℕ) (N : ℕ) :
Integrable (computedExecutionNonlocalWork source target N) (computedExecutionLaw source target N) :=
(((computedExecutionCoarseWork_integrable source target N).add
(computedExecutionRejectionWork_integrable source target N)).add
(computedExecutionDictionaryWork_integrable source target N)).add
(computedExecutionAddressWork_integrable source target N)
theorem constant_le_rpow_eventually (C epsilon : ℝ) (hepsilon : 0 < epsilon) :
∀ᶠ N : ℕ in atTop, C ≤ (N + 2 : ℝ) ^ epsilon := by
have ht : Tendsto (fun N : ℕ => (N : ℝ) + 2) atTop atTop :=
tendsto_atTop_add_const_right atTop 2 tendsto_natCast_atTop_atTop
exact ((tendsto_rpow_atTop hepsilon).comp ht).eventually (eventually_ge_atTop C)
theorem computedExecutionNonlocalWork_expected_near_linear (epsilon : ℝ) (hepsilon : 0 < epsilon) :
∀ᶠ N in atTop, ∀ source target : List ℕ, source.length + target.length ≤ N →
(∫ execution, computedExecutionNonlocalWork source target N execution
∂computedExecutionLaw source target N) ≤ (N + 2 : ℝ) ^ (1 + epsilon) := by
have hhalf : 0 < epsilon / 2 := half_pos hepsilon
filter_upwards [computedExecutionCoarseWork_expected_near_linear (epsilon / 2) hhalf,
computedExecutionRejectionWork_expected_near_linear (epsilon / 2) hhalf,
computedExecutionDictionaryWork_expected_near_linear (epsilon / 2) hhalf,
computedExecutionAddressWork_expected_near_linear (epsilon / 2) hhalf,
constant_le_rpow_eventually 4 (epsilon / 2) hhalf] with N hc hr hd ha hfour
intro source target hsize
have hiC := computedExecutionCoarseWork_integrable source target N
have hiR := computedExecutionRejectionWork_integrable source target N
have hiD := computedExecutionDictionaryWork_integrable source target N
have hiA := computedExecutionAddressWork_integrable source target N
change integral (computedExecutionLaw source target N)
(((computedExecutionCoarseWork source target N + computedExecutionRejectionWork source target N) +
computedExecutionDictionaryWork source target N) + computedExecutionAddressWork source target N) ≤ _
rw [integral_add' ((hiC.add hiR).add hiD) hiA, integral_add' (hiC.add hiR) hiD,
integral_add' hiC hiR]
calc
_ ≤ 4 * (N + 2 : ℝ) ^ (1 + epsilon / 2) := by
linarith only [hc source target hsize, hr source target hsize, hd source target hsize,
ha source target hsize]
_ ≤ (N + 2 : ℝ) ^ (epsilon / 2) * (N + 2 : ℝ) ^ (1 + epsilon / 2) :=
mul_le_mul_of_nonneg_right hfour (Real.rpow_nonneg (by positivity) _)
_ = _ := by rw [← Real.rpow_add (by positivity)]; congr 1; ring
end EditApproximation
end OAI
|