File size: 4,090 Bytes
e63eb7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.Combinatorics.EditApproximation.Refinement.PhysicalRandomBoundedQuery
import OAI.Combinatorics.EditApproximation.Geometry.ChargedGlobalQuery
import OAI.Combinatorics.EditApproximation.Definitions


namespace OAI

/-! The coarse seed, recursive table values, and random scalar sources are
all requested through the memo program. Inactive refinement branches use
the existing explicit coarse/median seed queries. -/

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 → ℕ)



variable
  (group : ℕ → ℕ → PhysicalInternalNode M J → Fin R → CellGroupDraws M F Q)
  (integer : ℕ → ℕ → PhysicalInternalNode M J → Fin R → ℕ → TargetInterval target.length → ℕ)
  (sourceAnswer : σ → ℚ)

/-- Composition with the local source-provider correctness theorem. -/
 theorem chargedRandomGlobalQuery_value
    (hbody : ∀ parent,
      (physicalRandomBoundedQuery source target N P F exponent H Q T S passes copies factor multiplier
        tau eta kappa delta readGroup readInteger initial parent).value
        (Sum.elim sourceAnswer (fun child => localRequestValue source target N P F exponent H Q T S copies
          factor multiplier tau eta kappa delta group integer initial child.val.val)) =
      localRequestValue source target N P F exponent H Q T S copies factor multiplier
        tau eta kappa delta group integer initial parent.val)
    (request : ChargedPhysicalRequest M J target.length passes copies T S) :
    (chargedRandomGlobalQuery source target N P F exponent H Q T S passes copies factor multiplier
      tau eta kappa delta readGroup readInteger initial request).value
      (Sum.elim sourceAnswer (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)) =
    chargedRequestValue source target N P F exponent H Q T S passes copies factor multiplier
      tau eta kappa delta group integer initial request := by
  cases request with
  | inl entry => rfl
  | inr parent =>
    change _ = localRequestValue source target N P F exponent H Q T S copies factor multiplier
      tau eta kappa delta group integer initial parent.val
    unfold chargedRandomGlobalQuery
    dsimp only
    split_ifs with hi hd hw
    · rw [FiniteQuery.mapKeys_value]
      exact chargedWarmupQuery_value source target N P F exponent H Q T S passes copies
        factor multiplier tau eta kappa delta group integer initial parent hi
    · rw [FiniteQuery.mapKeys_value,
        localRequestValue_terminal source target N P F exponent H Q T S copies factor multiplier
          tau eta kappa delta group integer initial parent.val (Or.inr hw)]
      exact physicalInitialQuery_value_local source target N P F _ _ _ _ _ _
        (chargedSeedQuery_localValue source target N P F exponent H Q T S passes copies
          factor multiplier tau eta kappa delta group integer initial parent)
    · rw [FiniteQuery.mapKeys_value]
      refine Eq.trans ?_ (hbody parent)
      congr 1
      funext next
      cases next <;> rfl
    · rw [FiniteQuery.mapKeys_value,
        localRequestValue_terminal source target N P F exponent H Q T S copies factor multiplier
          tau eta kappa delta group integer initial parent.val (Or.inl hd)]
      exact physicalInitialQuery_value_local source target N P F _ _ _ _ _ _
        (chargedSeedQuery_localValue source target N P F exponent H Q T S passes copies
          factor multiplier tau eta kappa delta group integer initial parent)

end Global

end EditApproximation

end OAI