File size: 5,299 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | import OAI.Combinatorics.EditApproximation.Refinement.ComputedCoarseExecution
import OAI.Combinatorics.EditApproximation.Definitions
namespace OAI
/-! The coarse sampler execution and its returned seed share one probability space. -/
namespace EditApproximation
open MeasureTheory
instance computedExecutionLaw_probability (source target : List β) (N : β) :
IsProbabilityMeasure (computedExecutionLaw source target N) := by
unfold computedExecutionLaw
infer_instance
theorem computedExecutionProjection_measurable (source target : List β) (N : β) :
Measurable (computedExecutionProjection source target N) :=
physicalCoarseExecutionProjection_measurable source target N (integerParameters N).P
(inputHeight N) (integerParameters N).B (computedPhysicalCoarseDepth source target N)
theorem computedExecutionProjection_law (source target : List β) (N : β) :
(computedExecutionLaw source target N).map (computedExecutionProjection source target N) =
physicalFamilyRuntimeLaw (R := inputHeight N ^ 2) target N (integerParameters N).P
(inputHeight N) (physicalCoarseSeedLaw (M := (integerParameters N).M)
(J := intervalTreeDepth (integerParameters N).M source.length) source target N (integerParameters N).B
(computedPhysicalCoarseDepth source target N)) :=
physicalCoarseExecutionProjection_law source target N (integerParameters N).P
(inputHeight N) (integerParameters N).B (computedPhysicalCoarseDepth source target N)
instance computedFullOutcome_measurableSingleton (source target : List β) (N : β) :
MeasurableSingletonClass (ComputedFullOutcome source target N) := by
refine β¨fun outcome => ?_β©
exact measurableSet_sum_iff.mpr
β¨(Set.to_countable _).measurableSet, (Set.to_countable _).measurableSetβ©
instance computedFullLaw_probability (source target : List β) (N : β) (epsilon : BinaryFraction) :
IsProbabilityMeasure (computedFullLaw source target N epsilon) := by
classical
unfold computedFullLaw
split <;> infer_instance
noncomputable def computedFullProjection (source target : List β) (N : β) :
ComputedFullOutcome source target N β ComputedPhysicalOutcome source target N
| .inl _ => .inl ()
| .inr execution => .inr (computedExecutionProjection source target N execution)
theorem computedFullProjection_measurable (source target : List β) (N : β) :
Measurable (computedFullProjection source target N) := by
apply measurable_fun_sum
Β· exact measurable_const
Β· exact measurable_inr.comp (computedExecutionProjection_measurable source target N)
noncomputable def computedFullAnswer (source target : List β) (N : β)
(outcome : ComputedFullOutcome source target N) : β :=
computedPhysicalAnswer source target N (computedFullProjection source target N outcome)
theorem computedFullProjection_law (source target : List β) (N : β) (epsilon : BinaryFraction) :
(computedFullLaw source target N epsilon).map (computedFullProjection source target N) =
computedPhysicalLaw source target N epsilon := by
unfold computedFullLaw computedPhysicalLaw physicalUniformLaw
split_ifs with hlarge
Β· rw [Measure.map_map (computedFullProjection_measurable source target N) measurable_inr]
have heq : computedFullProjection source target N β Sum.inr =
Sum.inr β computedExecutionProjection source target N := rfl
rw [heq, β Measure.map_map measurable_inr (computedExecutionProjection_measurable source target N),
computedExecutionProjection_law]
Β· rw [Measure.map_dirac]
rfl
theorem computedFullAnswer_equal (source target : List β) (N : β) (heq : source = target)
(outcome : ComputedFullOutcome source target N) : computedFullAnswer source target N outcome = 0 :=
computedPhysicalAnswer_equal source target N heq _
theorem computed_full_conditional_accuracy (source target : List β) (N : β)
(epsilon : BinaryFraction) (hepsilon : 0 < epsilon.value)
(hsize : source.length + target.length β€ N)
(coarseBernstein : FiniteBernsteinInput (Measure.pi fun _ : Fin (integerParameters N).B =>
(PMF.uniformOfFintype (Fin (integerParameters N).B)).toMeasure))
(groupBernstein : β b : β, β h : Fin
(groupDyadicScales (integerParameters N).M b (inputSmallLog N)).length,
FiniteBernsteinInput (Measure.pi fun _ : Fin
(groupSampleCount (integerParameters N).M (inputSmallLog N ^ 80) b
(groupDyadicScaleAt (integerParameters N).M b (inputSmallLog N) h)) =>
(PMF.uniformOfFintype (Fin (integerParameters N).M)).toMeasure)) :
(2 / 3 : β) β€ (computedFullLaw source target N epsilon).real
{outcome | EditDistortion.edit source target β€ computedFullAnswer source target N outcome β§
(computedFullAnswer source target N outcome : β) β€
(1 + (epsilon.value : β)) * EditDistortion.edit source target} := by
have h := computed_physical_uniform_conditional_accuracy source target N epsilon hepsilon hsize
coarseBernstein groupBernstein
rw [β computedFullProjection_law source target N epsilon,
map_measureReal_apply (computedFullProjection_measurable source target N)
(Set.to_countable _).measurableSet] at h
exact h
end EditApproximation
end OAI
|