File size: 6,132 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 120 121 122 123 124 125 126 127 128 129 | import OAI.Combinatorics.EditApproximation.Geometry.ChargedGlobalQuery
import OAI.Combinatorics.EditApproximation.Geometry.GlobalQueryProgress
import OAI.Combinatorics.EditApproximation.Queries.QueryDependencyExpansion
namespace OAI
/-! Every actual charged edge either descends at the current index or
uses a strictly earlier index without moving to an ancestor. Coarse
leaves retain their physical depth for source-width accounting. -/
namespace EditApproximation
namespace ChargedPhysicalRequest
def DependencyProgress {M J ny passes copies T S : β}
(parent child : ChargedPhysicalRequest M J ny passes copies T S) : Prop :=
(child.depth < parent.depth β§ child.index β€ parent.index) β¨
(child.depth β€ parent.depth β§ child.index < parent.index)
theorem table_progress {M J ny passes copies T S : β}
(parent child : {r : PhysicalTableRequest M J ny // r.Bounded passes copies T S})
(h : PhysicalTableRequest.DependencyProgress T S parent.val child.val) :
DependencyProgress (Sum.inr parent) (Sum.inr child) := by
rcases h with h | h
Β· exact Or.inl β¨h.1, Nat.add_le_add_right h.2 1β©
Β· exact Or.inr β¨h.1, Nat.add_lt_add_right h.2 1β©
end ChargedPhysicalRequest
theorem chargedSeedQuery_keys_earlier {M J ny passes copies T S : β}
(N : β) (multiplier : β β β)
(parent : {r : PhysicalTableRequest M J ny // r.Bounded passes copies T S})
(state : PhysicalEntry M J ny) (oracle) :
β key β (chargedSeedQuery N multiplier parent state).keys oracle,
key.val.depth β€ ChargedPhysicalRequest.depth (Sum.inr parent) β§
key.val.index < ChargedPhysicalRequest.index (Sum.inr parent) := by
unfold chargedSeedQuery
split_ifs with hn hp
Β· intro key hk
simp only [FiniteQuery.keys, List.mem_singleton] at hk
subst key
constructor
Β· change J - state.1.1.val β€ J - parent.val.node.1.val
rw [hn]
Β· change 0 < parent.val.rank T S + 1
omega
Β· apply FiniteQuery.keys_all_collect
Β· intro copy _ key hk
simp only [chargedPreviousRead, FiniteQuery.keys, List.mem_singleton] at hk
subst key
have h := previousPassRequest_progress T S copy.val parent.val (Nat.pos_of_ne_zero hp) state.2
exact β¨h.1.le, Nat.add_lt_add_right h.2 1β©
Β· intro values key hk
exact False.elim (List.not_mem_nil hk)
Β· intro key hk
exact False.elim (List.not_mem_nil hk)
theorem chargedWarmupQuery_keys_earlier {Ξ± : Type*} [DecidableEq Ξ±] {M J passes copies T S : β}
(source target : List Ξ±) (N P F : β) (factor : β β β) (multiplier : β β β)
(parent : {r : PhysicalTableRequest M J target.length // r.Bounded passes copies T S}) (oracle) :
β key β (chargedWarmupQuery source target N P F factor multiplier parent).keys oracle,
key.val.depth β€ ChargedPhysicalRequest.depth (Sum.inr parent) β§
key.val.index < ChargedPhysicalRequest.index (Sum.inr parent) := by
have hseed (q : TargetInterval target.length) :=
chargedSeedQuery_keys_earlier N multiplier parent (parent.val.node, q) oracle
unfold chargedWarmupQuery
split_ifs with hz hb hs
Β· exact physicalInitialQuery_keys_all source target N P F _ _ _ _ oracle _ hseed
Β· exact physicalInitialQuery_keys_all source target N P F _ _ _ _ oracle _ hseed
Β· unfold physicalWarmupStepQuery
apply localWarmupStepQuery_keys_all
Β· intro q
exact physicalInitialQuery_keys_all source target N P F _ _ _ _ oracle _ hseed
Β· intro input key hk
simp only [chargedWarmupChild, FiniteQuery.keys, List.mem_singleton] at hk
subst key
have h := PhysicalTableRequest.warmup_previous_child_progress parent.val.pass parent.val.copy T S
parent.val.index parent.val.node hb input.1 parent.val.state input.2 (Nat.pos_of_ne_zero hz)
exact β¨h.1.le, Nat.add_lt_add_right h.2 1β©
Β· exact physicalInitialQuery_keys_all source target N P F _ _ _ _ oracle _ hseed
section Global
variable {Ξ± : Type*} [DecidableEq Ξ±] {M J R : β} [NeZero R]
(source target : List Ξ±) (N P F exponent H Q T S passes copies : β)
(factor : β β β) (multiplier : β β β) (tau eta kappa delta : β)
(group : β β β β PhysicalInternalNode M J β Fin R β CellGroupDraws M F Q)
(integer : β β β β PhysicalInternalNode M J β Fin R β β β TargetInterval target.length β β)
(initial : PhysicalEntry M J target.length β β)
theorem chargedGlobalQuery_keys_progress (request : ChargedPhysicalRequest M J target.length passes copies T S) :
β key β (chargedGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta group integer initial request).keys
(fun child => chargedRequestValue source target N P F exponent H Q T S passes copies
factor multiplier tau eta kappa delta group integer initial child.val),
ChargedPhysicalRequest.DependencyProgress request key.val := by
cases request with
| inl entry =>
intro key hk
exact False.elim (List.not_mem_nil hk)
| inr parent =>
unfold chargedGlobalQuery
dsimp only
split_ifs with hi hb hs
Β· intro key hk
exact Or.inr (chargedWarmupQuery_keys_earlier source target N P F factor multiplier parent _ key hk)
Β· intro key hk
apply Or.inr
apply physicalInitialQuery_keys_all source target N P F _ _ _ _ _ _ _ key hk
intro q
exact chargedSeedQuery_keys_earlier N multiplier parent (parent.val.node, q) _
Β· rw [FiniteQuery.mapKeys_keys]
intro key hk
obtain β¨child, hc, rflβ© := List.mem_map.mp hk
exact ChargedPhysicalRequest.table_progress parent child.val
(physicalBoundedQuery_keys_progress source target N P F exponent H Q T S passes copies factor multiplier
tau eta kappa delta group integer initial parent child hc)
Β· intro key hk
apply Or.inr
apply physicalInitialQuery_keys_all source target N P F _ _ _ _ _ _ _ key hk
intro q
exact chargedSeedQuery_keys_earlier N multiplier parent (parent.val.node, q) _
end Global
end EditApproximation
end OAI
|