File size: 4,015 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 | import OAI.Combinatorics.EditApproximation.Geometry.ChargedRandomGlobalQuery
import OAI.Combinatorics.EditApproximation.Refinement.PhysicalRandomBoundedCost
import OAI.Combinatorics.EditApproximation.Geometry.ChargedQueryProgress
namespace OAI
/-! Actual mixed requests retain the charged physical depth/index progress.
This statement holds for every returned source and table value. -/
namespace EditApproximation
section Global
variable {Ο Ξ± : Type*} [DecidableEq Ξ±] {M J R : β} [NeZero M] [NeZero R]
(source target : List Ξ±) (N P F exponent H Q T S passes copies : β)
(factor : β β β) (multiplier : β β β) (tau eta kappa delta : β)
(readGroup : β β β β PhysicalInternalNode M J β Fin R β GroupScalarKey M F Q β FiniteQuery Ο)
(readInteger : β β β β PhysicalInternalNode M J β Fin R β
(β Γ TargetInterval target.length) β β β FiniteQuery Ο)
(initial : PhysicalEntry M J target.length β β)
(sourceAnswer : Ο β β)
(answer : ChargedPhysicalRequest M J target.length passes copies T S β β)
theorem chargedRandomGlobalQuery_keys_progress
(request : ChargedPhysicalRequest M J target.length passes copies T S) :
β key β (chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies
factor multiplier tau eta kappa delta readGroup readInteger initial request).keys
(Sum.elim sourceAnswer (fun child => answer child.val)),
match key with
| .inl _ => True
| .inr child => ChargedPhysicalRequest.DependencyProgress request child.val := by
cases request with
| inl entry =>
intro key hk
exact False.elim (List.not_mem_nil hk)
| inr parent =>
unfold chargedRandomGlobalQuery
dsimp only
split_ifs with hi hb hs
Β· apply FiniteQuery.keys_all_mapKeys
intro key hk
exact Or.inr (chargedWarmupQuery_keys_earlier source target N P F factor multiplier parent _ key hk)
Β· apply FiniteQuery.keys_all_mapKeys
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
let tableMap :
{child : {r : PhysicalTableRequest M J target.length // r.Bounded passes copies T S} //
child.val.combinedRank T S < parent.val.combinedRank T S} β
{child : ChargedPhysicalRequest M J target.length passes copies T S //
child.rank < ChargedPhysicalRequest.rank (.inr parent)} :=
fun child => β¨.inr child.val,
ChargedPhysicalRequest.table_rank_lt parent child.val child.propertyβ©
have horacle : (Sum.elim sourceAnswer (fun child => answer child.val)) β
Sum.map (id : Ο β Ο) tableMap =
Sum.elim sourceAnswer (fun child => answer (Sum.inr child.val)) := by
funext key
cases key <;> rfl
rw [horacle] at hc
have hp := physicalRandomBoundedQuery_progress source target N P F exponent H Q T S passes copies
factor multiplier tau eta kappa delta readGroup readInteger initial sourceAnswer
(fun r => if hr : r.Bounded passes copies T S then answer (.inr β¨r, hrβ©) else 0)
parent
cases child with
| inl key => trivial
| inr child =>
apply ChargedPhysicalRequest.table_progress
apply hp (.inr child)
convert hc using 1
congr 1
funext key
cases key with
| inl key => rfl
| inr key => simp only [Sum.elim_inr, dite_eq_left key.val.property]
Β· apply FiniteQuery.keys_all_mapKeys
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
|