File size: 4,225 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 | import OAI.Combinatorics.EditApproximation.Geometry.WideEarlierInputs
import OAI.Combinatorics.EditApproximation.Definitions
namespace OAI
/-! All wide-coordinate requests needed for one local query can be gathered
from bounded representative lists, including complete requested cells and
the rounded online center at every applicable scale. -/
namespace EditApproximation
open Finset
theorem queryEarlierRepresentatives_length {n : β} (N P F exponent : β) (a : β)
(initial : TargetInterval n β β) (q : TargetInterval n) (hP : β e : β, P = 2 ^ e)
(hF : 1 β€ F) (hw : 0 β€ initial q) :
(queryEarlierRepresentatives N P F exponent a initial q).length β€
(dyadicQueryWindow N (initial q) a F).length *
((64 * F * P + 2) ^ 2 +
((32 * F + 2) * 2 ^ exponent + 2) ^ 2 * (P + 1) ^ 2 + 1) := by
have hPpos : 0 < P := by obtain β¨e, rflβ© := hP; positivity
have hlocal := localRefinementRepresentatives_length N P F a initial q hPpos hF
have hcells := localGroupQueryKeys_length N F exponent a initial q hF hw
have hmembers : ((localGroupQueryKeys N F exponent a initial q).flatMap fun key =>
(cellRepresentativeStates n P F key.1 a initial ((2 : β) ^ (-(exponent : β€))) key.2).map
fun r => (key.1, r)).length β€
(localGroupQueryKeys N F exponent a initial q).length * (P + 1) ^ 2 := by
apply list_flatMap_length_le
intro key hkey
have hscale := localGroupQueryKeys_scale hkey
obtain β¨e, _, heqβ© := List.mem_map.mp hscale
simpa only [List.length_map] using cellRepresentativeStates_length_le a initial
((2 : β) ^ (-(exponent : β€))) key.2
β¨by positivity, zpow_le_one_of_nonposβ (by norm_num : (1 : β) β€ 2) (by omega)β©
β¨e, heq.symmβ© hP
unfold queryEarlierRepresentatives
simp only [List.length_append, List.length_map]
nlinarith only [hlocal, hmembers, Nat.mul_le_mul_right ((P + 1) ^ 2) hcells]
theorem queryEarlierRepresentatives_local {n : β} (N P F exponent : β) (a : β)
(initial : TargetInterval n β β) (q : TargetInterval n) (br : β Γ TargetInterval n)
(hbr : br β localRefinementRepresentatives N P F a initial q) :
br β queryEarlierRepresentatives N P F exponent a initial q := by
exact List.mem_append_left _ (List.mem_append_left _ hbr)
theorem queryEarlierRepresentatives_cell {n : β} (N P F exponent : β) (a : β)
(initial : TargetInterval n β β) (q : TargetInterval n) (key : β Γ (β Γ β))
(hkey : key β localGroupQueryKeys N F exponent a initial q) (r : TargetInterval n)
(hr : r β cellRepresentativeStates n P F key.1 a initial ((2 : β) ^ (-(exponent : β€))) key.2) :
(key.1, r) β queryEarlierRepresentatives N P F exponent a initial q := by
apply List.mem_append_left
apply List.mem_append_right
exact List.mem_flatMap.mpr β¨key, hkey, List.mem_map.mpr β¨r, hr, rflβ©β©
theorem queryEarlierRepresentatives_online {n : β} (N P F exponent : β) (a : β)
(initial : TargetInterval n β β) (q : TargetInterval n) (b : β)
(hb : b β dyadicQueryWindow N (initial q) a F) :
(b, roundInterval (seedGridSpacing b P) q) β
queryEarlierRepresentatives N P F exponent a initial q := by
exact List.mem_append_right _ (List.mem_map.mpr β¨b, hb, rflβ©)
theorem queryEarlierInputCover_card {nx ny M : β} (parent : TargetInterval nx)
(N P F exponent history : β) (a : β)
(initial : TargetInterval ny β β) (q : TargetInterval ny) (hP : β e : β, P = 2 ^ e)
(hF : 1 β€ F) (hw : 0 β€ initial q) :
(queryEarlierInputCover (M := M) parent N P F exponent history a initial q).card β€
(dyadicQueryWindow N (initial q) a F).length *
((64 * F * P + 2) ^ 2 +
((32 * F + 2) * 2 ^ exponent + 2) ^ 2 * (P + 1) ^ 2 + 1) *
M * history * (40 * P + 2) ^ 2 := by
have hPpos : 0 < P := by obtain β¨e, rflβ© := hP; positivity
apply (wideEarlierInputCover_card parent P history _ hPpos).trans
exact Nat.mul_le_mul_right ((40 * P + 2) ^ 2) (Nat.mul_le_mul_right history
(Nat.mul_le_mul_right M (queryEarlierRepresentatives_length N P F exponent a initial q hP hF hw)))
end EditApproximation
end OAI
|