File size: 4,090 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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