math / data /lean /OAI /Combinatorics /EditApproximation /Refinement /ComputedChargedRandomSourceCost.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.35 kB
import OAI.Combinatorics.EditApproximation.Refinement.ComputedGlobalSourceCost
import OAI.Combinatorics.EditApproximation.Geometry.ChargedRandomCost
import OAI.Combinatorics.EditApproximation.Geometry.ChargedTerminalCost
namespace OAI
namespace EditApproximation
section Cost
variable {Οƒ Ξ± : Type*} [DecidableEq Ξ±] {M J R : β„•} [NeZero M] [NeZero R]
(source target : List Ξ±) (N P H T S passes copies : β„•)
(factor : β„• β†’ β„š) (multiplier : β„• β†’ β„•) (tau eta kappa delta : β„š)
(group : β„• β†’ β„• β†’ PhysicalInternalNode M J β†’ Fin R β†’
CellGroupDraws M (inputSmallLog N) (inputSmallLog N ^ 80))
(integer : β„• β†’ β„• β†’ PhysicalInternalNode M J β†’ Fin R β†’ β„• β†’ TargetInterval target.length β†’ β„•)
(initial : PhysicalEntry M J target.length β†’ β„•)
(readGroup : β„• β†’ β„• β†’ PhysicalInternalNode M J β†’ Fin R β†’
GroupScalarKey M (inputSmallLog N) (inputSmallLog N ^ 80) β†’ FiniteQuery Οƒ)
(readInteger : β„• β†’ β„• β†’ PhysicalInternalNode M J β†’ Fin R β†’
(β„• Γ— TargetInterval target.length) β†’ β„• β†’ FiniteQuery Οƒ)
(sourceAnswer : Οƒ β†’ β„š) (weight : Οƒ β†’ β„•) (bound : β„•)
(hN : 0 < N) (hell : 200 ≀ inputSmallLog N) (hM : M = (integerParameters N).M)
(hA : βˆ€ pass, factor pass ≀ ((integerParameters N).initialFactor : β„š))
(hgroup : βˆ€ pass copy node time key, (readGroup pass copy node time key).cost sourceAnswer weight ≀ bound)
(honline : βˆ€ pass copy node time key range,
(readInteger pass copy node time key range).cost sourceAnswer weight ≀ bound)
local notation "tableValue" => localRequestValue source target N P (inputSmallLog N)
(40 * smallLogExponent N) H (inputSmallLog N ^ 80) T S copies factor multiplier
tau eta kappa delta group integer initial
include hN hell hM hA hgroup honline in
theorem computed_chargedRandomGlobalQuery_source_cost
(request : ChargedPhysicalRequest M J target.length passes copies T S) :
(chargedRandomGlobalQuery source target N P (inputSmallLog N) (40 * smallLogExponent N)
H (inputSmallLog N ^ 80) T S passes copies factor multiplier tau eta kappa delta
readGroup readInteger initial request).cost
(Sum.elim sourceAnswer (fun child => chargedRequestValue source target N P (inputSmallLog N)
(40 * smallLogExponent N) H (inputSmallLog N ^ 80) T S passes copies factor multiplier
tau eta kappa delta group integer initial child.val))
(Sum.elim weight (fun _ => 0)) ≀ inputHeight N ^ 91 * bound := by
cases request with
| inl entry => exact Nat.zero_le _
| inr parent =>
by_cases hi : parent.val.index ≀ T
Β· unfold chargedRandomGlobalQuery
dsimp only
rw [ite_eq_left hi, FiniteQuery.mapKeys_cost]
simp only [Function.comp_def, Sum.elim_inr]
rw [FiniteQuery.cost_zero]
exact Nat.zero_le _
Β· by_cases hb : parent.val.node.1.val < J
Β· by_cases hs : (physicalSourceInterval source.length parent.val.node).hi -
(physicalSourceInterval source.length parent.val.node).lo ≀ 1
Β· unfold chargedRandomGlobalQuery
dsimp only
rw [ite_eq_right hi, ite_eq_left hb, ite_eq_left hs, FiniteQuery.mapKeys_cost]
simp only [Function.comp_def, Sum.elim_inr]
rw [FiniteQuery.cost_zero]
exact Nat.zero_le _
Β· have hanswer : chargedRequestValue source target N P (inputSmallLog N)
(40 * smallLogExponent N) H (inputSmallLog N ^ 80) T S passes copies factor multiplier
tau eta kappa delta group integer initial =
Sum.elim (fun entry => (initial entry : β„š)) (fun r => tableValue r.val) := by
funext key
cases key <;> rfl
have hz : (fun _ : ChargedPhysicalRequest M J target.length passes copies T S => 0) =
chargedTableWeight 0 (fun _ => 0) := by
funext key
cases key <;> rfl
rw [hanswer]
have hcost := chargedRandomGlobalQuery_refinement_cost source target N P (inputSmallLog N)
(40 * smallLogExponent N) H (inputSmallLog N ^ 80) T S passes copies factor multiplier
tau eta kappa delta readGroup readInteger initial sourceAnswer tableValue weight 0 (fun _ => 0)
parent (by omega) hb hs
simp only [← hz] at hcost
rw [hcost]
rw [← physicalRandomGlobalQuery_refinement_cost source target N P (inputSmallLog N)
(40 * smallLogExponent N) H (inputSmallLog N ^ 80) T S copies factor multiplier
tau eta kappa delta readGroup readInteger initial sourceAnswer tableValue weight (fun _ => 0)
parent.val (by omega) hb hs]
apply computed_physicalRandomGlobalQuery_source_cost source target N P H T S copies
hN hell hM factor multiplier tau eta kappa delta hA readGroup readInteger initial
sourceAnswer tableValue weight bound hgroup honline
intro pass copy node q
rw [localRequestValue_initial]
exact stageInitial_nonneg_all_seeds _ _ _ _ _ _ _ _
Β· unfold chargedRandomGlobalQuery
dsimp only
rw [ite_eq_right hi, ite_eq_right hb, FiniteQuery.mapKeys_cost]
simp only [Function.comp_def, Sum.elim_inr]
rw [FiniteQuery.cost_zero]
exact Nat.zero_le _
end Cost
end EditApproximation
end OAI