File size: 5,774 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 116 117 118 119 | import OAI.MeasureTheory.Falconer.Estimates.ActualDirectBuffer
import OAI.MeasureTheory.Falconer.Recursion.ActualPolicyPayments
import OAI.MeasureTheory.Falconer.Recursion.InheritedPolicyState
namespace OAI
namespace PlanarFalconer
theorem remaining_descriptor_companion (A : β β β) {N q aβ tβ a : β}
(hq : 0 < q) {d : PolicyDescriptor}
(hd : d β remainingPolicyDescriptors A N q aβ tβ a) :
PolicyDescriptor.parallel (max a (descriptorAnchor d-descriptorLength d))
(descriptorAnchor d) β remainingPolicyDescriptors A N q aβ tβ a := by
classical
obtain β¨hd,hapβ© := Finset.mem_filter.mp hd
obtain β¨z,hz,hdβ© := Finset.mem_biUnion.mp hd
have hz' := Finset.mem_filter.mp hz
have huN : z.2 β€ N := Nat.le_of_lt_succ (Finset.mem_range.mp (Finset.mem_product.mp hz'.1).2)
have hp := originDescriptor_anchor A hd
have hl := originDescriptor_length A hq huN hz'.2.2.2 hd
have hLp := originDescriptor_length_le_anchor A hd
apply Finset.mem_filter.mpr
refine β¨Finset.mem_biUnion.mpr β¨z,hz,?_β©,hapβ©
apply Finset.mem_union_left
apply Finset.mem_image.mpr
refine β¨max a (descriptorAnchor d-descriptorLength d),Finset.mem_Ico.mpr β¨?_,?_β©,?_β©
Β· rw [β hp]
omega
Β· omega
Β· rw [hp]
structure DirectPolicyWitness (A : β β β) (N q aβ tβ a v : β) (sig : β)
(d : PolicyDescriptor) : Prop where
mem : d β remainingPolicyDescriptors A N q aβ tβ a
maximal : descriptorLength d = (remainingPolicyDescriptors A N q aβ tβ a).sup descriptorLength
buffer : sourceFarBuffer N (descriptorLength d) sig = descriptorLength d
direct_depth : v β€ a+2*descriptorLength d
anchor_gt : a < descriptorAnchor d
anchor_lt : descriptorAnchor d < v
width : descriptorAnchor d+10*q β€ v
companion : PolicyDescriptor.parallel (max a (descriptorAnchor d-descriptorLength d))
(descriptorAnchor d) β remainingPolicyDescriptors A N q aβ tβ a
g_lt : max a (descriptorAnchor d-descriptorLength d) < descriptorAnchor d
g_slack : ((max a (descriptorAnchor d-descriptorLength d):β):β)-a β€ sig*N
frequency_slack : 10*sig*N β€ (v:β)-descriptorAnchor d
depth_scale : ((descriptorAnchor d-a:β):β) β€ (v:β)-descriptorAnchor d+2*sig*N
length_scale : (descriptorLength d:β) β€ (v:β)-descriptorAnchor d+2*sig*N
midpoint : 2*descriptorAnchor d β€ a+v+2*q
shrinks : (remainingPolicyDescriptors A N q aβ tβ (descriptorAnchor d)).card <
(remainingPolicyDescriptors A N q aβ tβ a).card
payment : potential A a v (10*q)+height A a (descriptorAnchor d) β€
potential A (descriptorAnchor d) v (10*q)
theorem actual_direct_policy_witness (A : β β β) {N q aβ tβ a v : β} {sig : β}
(hsig : 0 β€ sig) (hq : 0 < q) (hceil : β10*sig*(N:β)ββ < q)
(hslack : sig*(N:β) β€ (q:β)) (hslack10 : 10*sig*(N:β) β€ (q:β))
(ht : (tβ:β) β€ (v:β)+sig*N) (hw : a+100*q < v)
(hdirect : v-2*sourceFarBuffer N
((remainingPolicyDescriptors A N q aβ tβ a).sup descriptorLength) sig β€ a) :
β d : PolicyDescriptor, DirectPolicyWitness A N q aβ tβ a v sig d := by
classical
let S := remainingPolicyDescriptors A N q aβ tβ a
have hb := direct_buffer_eq_length hceil hw hdirect
have hS : S.Nonempty := by
by_contra h
have he := Finset.not_nonempty_iff_eq_empty.mp h
have hz : S.sup descriptorLength = 0 := by rw [he]; rfl
exact (Nat.ne_of_gt hb.2.2) hz
obtain β¨d,hd,hmaxβ© := Finset.exists_mem_eq_sup S hS descriptorLength
dsimp only [S] at hmax
have hmax' := hmax.symm
have hdir : v β€ a+2*descriptorLength d := by simpa only [hmax] using hb.2.1
have hmem := Finset.mem_filter.mp hd
have hap : a < descriptorAnchor d := hmem.2
obtain β¨z,hz,hzdβ© := Finset.mem_biUnion.mp hmem.1
have hz' := Finset.mem_filter.mp hz
have huN : z.2 β€ N := Nat.le_of_lt_succ (Finset.mem_range.mp (Finset.mem_product.mp hz'.1).2)
have hl := originDescriptor_length A hq huN hz'.2.2.2 hzd
have hLp := originDescriptor_length_le_anchor A hzd
have hpt : descriptorAnchor d+descriptorLength d β€ tβ := hl.2.2.trans hz'.2.2.1
have hptR : (descriptorAnchor d:β)+(descriptorLength d:β) β€ (tβ:β) := by exact_mod_cast hpt
have hsigN : 0 β€ sig*(N:β) := mul_nonneg hsig (Nat.cast_nonneg _)
have hdirR : (v:β) β€ (a:β)+2*(descriptorLength d:β) := by exact_mod_cast hdir
have hmidR : 2*(descriptorAnchor d:β) β€ (a:β)+v+2*q := by linarith
have hmid : 2*descriptorAnchor d β€ a+v+2*q := by exact_mod_cast hmidR
have hwidth : descriptorAnchor d+10*q β€ v := by omega
have hwidthR : (descriptorAnchor d:β)+10*(q:β) β€ (v:β) := by exact_mod_cast hwidth
have hn : ((descriptorAnchor d-a:β):β) = (descriptorAnchor d:β)-a := Nat.cast_sub hap.le
have hgs : ((descriptorAnchor d-descriptorLength d:β):β) =
(descriptorAnchor d:β)-descriptorLength d := Nat.cast_sub hLp
refine β¨d, {
mem := hd
maximal := hmax'
buffer := ?_
direct_depth := hdir
anchor_gt := hap
anchor_lt := by omega
width := hwidth
companion := remaining_descriptor_companion A hq hd
g_lt := by omega
g_slack := ?_
frequency_slack := by linarith
depth_scale := ?_
length_scale := ?_
midpoint := hmid
shrinks := reached_anchor_strictly_reduces_list A N q aβ tβ hap.le hd le_rfl
payment := (actual_direct_policy_payment A hq hw hmem.1 hap hdir hmid).2 }β©
Β· simpa only [β hmax] using hb.1
Β· rw [Nat.cast_max,hgs,sub_le_iff_le_add]
apply max_le <;> linarith [show 0 β€ sig*(N:β) by positivity]
Β· rw [hn]
linarith
Β· have haR : (a:β) < (descriptorAnchor d:β) := Nat.cast_lt.mpr hap
linarith
end PlanarFalconer
end OAI
|