File size: 2,303 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
import OAI.Combinatorics.EditApproximation.Specification.RawBandConsumers
import OAI.Combinatorics.EditApproximation.Definitions

namespace OAI.EditApproximation.BinaryFraction

def dyadicSampledGroupActionReadWithWorkRaw {ny M : β„•}
    (b exponent Q : β„•) (F : BinaryFraction)
    (initial current : Fin M β†’ TargetInterval ny β†’ BinaryFraction Γ— β„•)
    (raw : List BinaryFraction) (hraw : raw.map value = groupDyadicScales M b F.value)
    (draw : βˆ€ t : Fin (groupDyadicScales M b F.value).length,
      Fin (groupSampleCount M Q b (groupDyadicScaleAt M b F.value t)) β†’ Fin M)
    (members : List (RawUnskippedBand M ny)) (hne : members β‰  []) :=
  sampledGroupActionReadWithWorkRaw b exponent Q initial current
    (indexedGroupScales raw M b F.value hraw)
    (fun t j => draw t (Fin.cast (congrArg (groupSampleCount M Q b)
      (indexedGroupScales_value raw M b F.value hraw t)) j)) members hne

def preparedCellGroupReadWithWorkRaw {Ξ± : Type*} (source target : List Ξ±) {M : β„•}
  (parent : TargetInterval source.length) (b P F exponent Q : β„•) (_hb : 0 < b) (_hP : 0 < P)
  (tau a : BinaryFraction)
  (parentInitial : TargetInterval target.length β†’ BinaryFraction Γ— β„•)
  (child initial current : Fin M β†’ TargetInterval target.length β†’ BinaryFraction Γ— β„•)
  (R C : β„•) (_hr : βˆ€ i q, (child i q).2 ≀ R) (_hi : βˆ€ i q, (initial i q).2 ≀ C)
  (raw : List BinaryFraction) (hraw : raw.map value = groupDyadicScales M b (nat F).value)
  (draw : βˆ€ t : Fin (groupDyadicScales M b (nat F).value).length,
    Fin (groupSampleCount M Q b (groupDyadicScaleAt M b (nat F).value t)) β†’ Fin M)


    (cell : β„• Γ— β„•) :
    Option (BinaryBellmanAction (TargetInterval target.length)
      (Fin M Γ— TargetInterval target.length) M) Γ— β„• :=
  let centers := cellCentersReadWithWork P F b a (inversePowerTwo exponent) parentInitial cell
  let members := filterMapWithWork
    (preparedUnskippedReadWithWorkRaw parent b P exponent tau (nat F) child initial) centers.1
  if h : members.1 = [] then (none, centers.2 + members.2 + 1) else
    let selected := dyadicSampledGroupActionReadWithWorkRaw b exponent Q (nat F) initial current raw hraw draw members.1 h
    (some selected.1, centers.2 + members.2 + selected.2 + 2)









end OAI.EditApproximation.BinaryFraction