File size: 5,689 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 | import OAI.Combinatorics.EditApproximation.Numerics.RationalWideStep
namespace OAI
/-! Spatial bounds for a literal rational refinement update. -/
namespace EditApproximation
open Finset
theorem rationalMinimum_map_spatial {ΞΉ : Type*} (indices : List ΞΉ)
(fallback fallback' charge : β) (value value' : ΞΉ β β)
(hfallback : fallback β€ fallback' + charge)
(hvalue : β i β indices, value i β€ value' i + charge) :
rationalMinimum fallback (indices.map value) β€
rationalMinimum fallback' (indices.map value') + charge := by
induction indices with
| nil => exact hfallback
| cons i rest ih =>
change min (value i) (rationalMinimum fallback (rest.map value)) β€
min (value' i) (rationalMinimum fallback' (rest.map value')) + charge
rw [β min_add_add_right]
exact min_le_min (hvalue i (by simp)) (ih fun j hj => hvalue j (by simp [hj]))
theorem rationalActionValue_spatial {ny : β} {Child : Type*} {M : β}
(L : β) (hL : 0 β€ L) (child : Child β β)
(q q' : TargetInterval ny) (action : RationalBellmanAction (TargetInterval ny) Child M) :
rationalActionValue (fun q r => targetEndpointDistance q r) L child q action β€
rationalActionValue (fun q r => targetEndpointDistance q r) L child q' action +
L * targetEndpointDistance q q' := by
have htriangle : (targetEndpointDistance q action.center : β) β€
targetEndpointDistance q' action.center + targetEndpointDistance q q' := by
exact_mod_cast targetEndpointDistance_triangle q q' action.center
have h := mul_le_mul_of_nonneg_left htriangle hL
dsimp only [rationalActionValue]
linarith only [h]
theorem rationalBellman_spatial {ny : β} {Child : Type*} {M : β}
(initial : TargetInterval ny β β) (L : β) (hL : 0 β€ L)
(actions : List (RationalBellmanAction (TargetInterval ny) Child M)) (child : Child β β)
(q q' : TargetInterval ny)
(hinit : initial q β€ initial q' + L * targetEndpointDistance q q') :
rationalBellman initial (fun q r => targetEndpointDistance q r) L actions child q β€
rationalBellman initial (fun q r => targetEndpointDistance q r) L actions child q' +
L * targetEndpointDistance q q' := by
apply rationalMinimum_map_spatial _ _ _ _ _ _ hinit
intro action _
exact rationalActionValue_spatial L hL child q q' action
theorem rationalWideStepCone_spatial {nx ny M : β} (parent : TargetInterval nx)
(representatives : List (β Γ TargetInterval ny)) (P : β)
(initial : TargetInterval ny β β) (L : β) (hL : 0 β€ L)
(old current : Fin M Γ TargetInterval ny β β)
(groups : List (RationalBellmanAction (TargetInterval ny) (Fin M Γ TargetInterval ny) M))
(q q' : TargetInterval ny)
(hinit : initial q β€ initial q' + L * targetEndpointDistance q q') :
rationalWideStepCone parent representatives P initial L old current groups q β€
rationalWideStepCone parent representatives P initial L old current groups q' +
L * targetEndpointDistance q q' := by
apply rationalMinimum_map_spatial _ _ _ _ _ _
(rationalBellman_spatial initial L hL _ old q q' hinit)
intro action _
exact rationalActionValue_spatial L hL current q q' action
theorem rationalRefinementUpdate_le_cone (delta cone : β) (online : Option β) :
rationalRefinementUpdate delta cone online β€ cone := by
cases online with
| none => exact le_rfl
| some value => exact min_le_left _ _
theorem rationalRefinementUpdate_div_lower (delta cone : β) (online : Option β)
(hdelta : 0 β€ delta) (hcone : 0 β€ cone) :
cone / (1 + delta) β€ rationalRefinementUpdate delta cone online := by
have hdiv : cone / (1 + delta) β€ cone := div_le_self hcone (by linarith)
cases online with
| none => exact hdiv
| some value => exact le_min hdiv (le_max_left _ _)
theorem rationalWideStep_spatial {nx ny M : β} (parent : TargetInterval nx)
(representatives : List (β Γ TargetInterval ny)) (P : β)
(initial : TargetInterval ny β β) (L delta : β) (hL : 0 β€ L) (hdelta : 0 β€ delta)
(old current : Fin M Γ TargetInterval ny β β)
(groups : List (RationalBellmanAction (TargetInterval ny) (Fin M Γ TargetInterval ny) M))
(online : TargetInterval ny β List (RationalBellmanAction (TargetInterval ny) (Fin M Γ TargetInterval ny) M))
(q q' : TargetInterval ny)
(hinit : initial q β€ initial q' + L * targetEndpointDistance q q')
(hcone : 0 β€ rationalWideStepCone parent representatives P initial L old current groups q') :
rationalWideStep parent representatives P initial L delta old current groups (online q) q β€
(1 + delta) * rationalWideStep parent representatives P initial L delta old current groups (online q') q' +
L * targetEndpointDistance q q' := by
have hu := rationalRefinementUpdate_le_cone delta
(rationalWideStepCone parent representatives P initial L old current groups q)
(rationalOnlineMinimum ((online q).map (rationalActionValue (fun q r => targetEndpointDistance q r) L current q)))
have hs := rationalWideStepCone_spatial parent representatives P initial L hL old current groups q q' hinit
have hl := rationalRefinementUpdate_div_lower delta
(rationalWideStepCone parent representatives P initial L old current groups q')
(rationalOnlineMinimum ((online q').map (rationalActionValue (fun q r => targetEndpointDistance q r) L current q')))
hdelta hcone
have hd : (0 : β) < 1 + delta := by linarith
have hl' := (div_le_iffβ hd).mp hl
change _ β€ (1 + delta) * _ + _
dsimp only [rationalWideStep] at *
nlinarith only [hu, hs, hl']
end EditApproximation
end OAI
|