math / data /lean /OAI /Combinatorics /EditApproximation /Refinement /ComputedChargedQueryBudget.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
7.25 kB
import OAI.Combinatorics.EditApproximation.Geometry.ChargedTerminalCost
import OAI.Combinatorics.EditApproximation.Refinement.ComputedRefinementReadBudget
import OAI.Combinatorics.EditApproximation.Refinement.ComputedWarmupReadBudget
namespace OAI
/-! Uniform edge budgets for the actual charged global interpreter.
The bounds hold for every initial seed and every draw, including failed
approximation events. -/
namespace EditApproximation
section Current
variable {Ξ± : Type*} [DecidableEq Ξ±] {M J R : β„•} [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 β†’ β„•)
variable (hN : 0 < N) (hell : 200 ≀ inputSmallLog N)
(hM : M = (integerParameters N).M)
(hAmax : βˆ€ pass, factor pass ≀ ((integerParameters N).initialFactor : β„š))
include hN hell hM hAmax in
theorem computed_chargedGlobalQuery_current_reads
(request : ChargedPhysicalRequest M J target.length passes copies T S) :
(chargedGlobalQuery 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 request).cost
(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)
(fun child => chargedSameWeight request child.val) ≀ 2 * M * inputSmallLog N ^ 256 := by
cases request with
| inl entry => exact Nat.zero_le _
| inr parent =>
by_cases hi : parent.val.index ≀ T
Β· unfold chargedGlobalQuery
dsimp only
rw [ite_eq_left hi, chargedWarmupQuery_same_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 chargedGlobalQuery
dsimp only
rw [ite_eq_right hi, ite_eq_left hb, ite_eq_left hs, chargedInitialQuery_same_cost_zero]
exact Nat.zero_le _
Β· rw [chargedGlobalQuery_current_cost 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 parent (by omega) hb hs]
apply computed_physicalRefinement_current_reads source target N P H hN hell hM
(factor parent.val.pass) tau eta kappa delta (hAmax _) parent.val.pass parent.val.copy
T S (parent.val.index - T) (by omega) parent.val.node hb
rw [localRequestValue_initial]
exact stageInitial_nonneg_all_seeds _ _ _ _ _ _ _ _
Β· unfold chargedGlobalQuery
dsimp only
rw [ite_eq_right hi, ite_eq_right hb, chargedInitialQuery_same_cost_zero]
exact Nat.zero_le _
variable (hP : P = (integerParameters N).P) (hT : T = (integerParameters N).T)
(hS : S = (integerParameters N).S) (hcopies : copies ≀ inputHeight N ^ 2)
(hAmin : βˆ€ pass, 1 ≀ factor pass)
include hN hell hM hAmax hP hT hS hcopies hAmin in
theorem computed_chargedGlobalQuery_earlier_reads
(request : ChargedPhysicalRequest M J target.length passes copies T S) :
(chargedGlobalQuery 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 request).cost
(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)
(fun child => chargedEarlierWeight request child.val) ≀
inputHeight N ^ (512 * (coarseExponent (inputSmallLog N) + 1)) := by
cases request with
| inl entry => exact Nat.zero_le _
| inr parent =>
let oracle := fun child : {child : ChargedPhysicalRequest M J target.length passes copies T S //
child.rank < ChargedPhysicalRequest.rank (Sum.inr parent)} =>
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
have hmono (program : FiniteQuery {child : ChargedPhysicalRequest M J target.length passes copies T S //
child.rank < ChargedPhysicalRequest.rank (Sum.inr parent)}) :
program.cost oracle (fun child => chargedEarlierWeight (Sum.inr parent) child.val) ≀
program.cost oracle (fun _ => 1) := by
apply FiniteQuery.cost_mono_weights
intro child
unfold chargedEarlierWeight
split_ifs <;> omega
by_cases hi : parent.val.index ≀ T
Β· unfold chargedGlobalQuery
dsimp only
rw [ite_eq_left hi]
exact (hmono _).trans (computed_chargedWarmupQuery_reads source target N P hN hell hM hP hcopies
factor multiplier parent oracle (hAmin _) (hAmax _))
Β· 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 chargedGlobalQuery
dsimp only
rw [ite_eq_right hi, ite_eq_left hb, ite_eq_left hs]
exact (hmono _).trans (computed_chargedInitialQuery_reads source target N P hN hell hM hP hcopies
factor multiplier parent oracle (hAmin _) (hAmax _))
Β· rw [chargedGlobalQuery_earlier_cost 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 parent (by omega) hb hs]
calc
_ ≀ inputHeight N ^ (257 * (coarseExponent (inputSmallLog N) + 1)) := by
apply computed_physicalRefinement_earlier_reads source target N P H hN hell hM hP
(factor parent.val.pass) tau eta kappa delta (hAmax _) parent.val.pass parent.val.copy
T S (parent.val.index - T) hT (by omega)
(by
have h := parent.property.2.2
have htime : parent.val.index - T ≀ S := by omega
exact htime.trans_eq hS) parent.val.node hb
rw [localRequestValue_initial]
exact stageInitial_nonneg_all_seeds _ _ _ _ _ _ _ _
_ ≀ _ := pow_le_pow_rightβ‚€ (Nat.one_le_two_pow) (by omega)
Β· unfold chargedGlobalQuery
dsimp only
rw [ite_eq_right hi, ite_eq_right hb]
exact (hmono _).trans (computed_chargedInitialQuery_reads source target N P hN hell hM hP hcopies
factor multiplier parent oracle (hAmin _) (hAmax _))
end Current
end EditApproximation
end OAI