math / data /lean /OAI /Combinatorics /EditApproximation /Geometry /ChargedQueryProgress.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
6.13 kB
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