math / data /lean /OAI /Combinatorics /EditApproximation /Queries /QueryFamilySourceCosts.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3 kB
import OAI.Combinatorics.EditApproximation.Queries.QueryFamilyScalarReads
import OAI.Combinatorics.EditApproximation.Queries.QueryPhysicalSourceCosts
namespace OAI
namespace EditApproximation
section Family
variable {Ξ± : Type*} {M J R : β„•} (target : List Ξ±)
(N P F exponent H Q passes copies pass copy : β„•)
theorem queryFamilyTagWithWork_cost (B : β„•)
(hp : Nat.size pass ≀ B) (hc : Nat.size copy ≀ B)
(hps : Nat.size (passes + 1) ≀ B) (hcs : Nat.size (copies + 1) ≀ B)
(scalar : PhysicalScalarKey M J N target.length exponent F Q R (localOnlineMassBound M P H)) :
(queryFamilyTagWithWork target N P F exponent H Q passes copies pass copy scalar).2 ≀
120 * (B + 1) ^ 2 + 5 * J + 55 := by
have h1 := queryFinOfNatWithWork_cost (passes + 1) pass B (Nat.succ_pos _) hps hp
have h2 := queryFinOfNatWithWork_cost (copies + 1) copy B (Nat.succ_pos _) hcs hc
have h3 := physicalFamilyCodeWithWork_cost target N P F exponent H Q passes copies
((queryFinOfNatWithWork (passes + 1) pass (Nat.succ_pos _)).1,
(queryFinOfNatWithWork (copies + 1) copy (Nat.succ_pos _)).1, scalar)
change (queryFinOfNatWithWork (passes + 1) pass (Nat.succ_pos _)).2 +
(queryFinOfNatWithWork (copies + 1) copy (Nat.succ_pos _)).2 + _ + 1 ≀ _
omega
variable
(oracle : PhysicalFamilyScalarKey (M := M) (J := J) (R := R)
target N P F exponent H Q passes copies β†’ BinaryFraction)
(readWork : PhysicalFamilyScalarKey (M := M) (J := J) (R := R)
target N P F exponent H Q passes copies β†’ β„•)
(K W : β„•)
(hK : βˆ€ scalar : PhysicalScalarKey M J N target.length exponent F Q R (localOnlineMassBound M P H),
(queryFamilyTagWithWork target N P F exponent H Q passes copies pass copy scalar).2 ≀ K)
(hW : βˆ€ key, readWork key ≀ W)
include hK hW in
theorem queryFamilyGroupRead_work (node : PhysicalInternalNode M J) (time : Fin R)
(key : GroupScalarKey M F Q) :
(queryFamilyGroupRead target N P F exponent H Q passes copies pass copy node time key).work
oracle readWork ≀ (queryScalePresentWithWork N key.1.1).2 +
(queryCellValidWithWork target.length exponent key.1.2).2 + 5 * J + 43 + (K + W) := by
unfold queryFamilyGroupRead
rw [BitQuery.mapKeysWithWork_work]
apply queryPhysicalScalarGroupRead_work
intro scalar
exact Nat.add_le_add (hK scalar) (hW _)
include hK hW in
theorem queryFamilyOnlineRead_work (node : PhysicalInternalNode M J) (time : Fin R)
(key : β„• Γ— TargetInterval target.length) (range : β„•) :
(queryFamilyOnlineRead target N P F exponent H Q passes copies pass copy node time key range).work
oracle readWork ≀ (queryScalePresentWithWork N key.1).2 +
(queryRangeValidWithWork (localOnlineMassBound M P H) range).2 + 5 * J + 43 + (K + W) := by
unfold queryFamilyOnlineRead
rw [BitQuery.mapKeysWithWork_work]
apply queryPhysicalScalarOnlineRead_work
intro scalar
exact Nat.add_le_add (hK scalar) (hW _)
end Family
end EditApproximation
end OAI