File size: 2,720 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.Algorithms.SubexponentialSAT.LeanCompat
import OAI.Algorithms.SubexponentialSAT.SqrtLog.BucketProgramAttained
import OAI.Algorithms.SubexponentialSAT.SqrtLog.LayoutRankSignature

namespace OAI.Algorithms

/-! Rank bounds the number of actual stored buckets. The primitive machine
still processes all rows and its serialization costs use their full count. -/
namespace SubexponentialSAT.SqrtLog.BucketProgram

theorem attainedKeys_signed_length_le_rank {h d : β„•}
    (W : List Bool) (pairs : Fin d β†’ Fin h β†’ SignedWord) (A : Fin d β†’ Fin h β†’ β„€)
    {ys : List (List (List Bool))} (js : List β„•) (n H : β„•)
    (hy : List.Forallβ‚‚ (List.Forallβ‚‚ (shiftedWord W))
      (List.ofFn (fun j => List.ofFn (pairs j))) ys)
    (hN : βˆ€ j i,SubexponentialSAT.BinaryArithmetic.toNat (pairs j i).2 ≀ SubexponentialSAT.BinaryArithmetic.toNat W)
    (hA : βˆ€ j i,(SubexponentialSAT.BinaryArithmetic.toNat (pairs j i).1 : β„€)-
      (SubexponentialSAT.BinaryArithmetic.toNat (pairs j i).2 : β„€)=A j i)
    (hbound : βˆ€ j i,|A j i| ≀ (H:β„€)) :
    (attainedKeys (Label.labelled W ys js n (assignments h))).length ≀
      (2*h*H+1)^LayoutRank.rowRank A := by
  have hc := attainedKeys_signed_length_le_signature_range W pairs A js n hy hN hA
  have hr := LayoutSignatureBound.card_range_boolSignature_le_rank A H hbound
  exact hc.trans (by simpa using hr)

/-- This is the exact list passed to the stored bucket encoder by Controller:
all labelled assignments in forward order, with deduplicated keys obtained
from reverse record order. Its length obeys the rational rank bound. -/
theorem storedTable_length_le_rank {h d : β„•}
    (W : List Bool) (pairs : Fin d β†’ Fin h β†’ SignedWord) (A : Fin d β†’ Fin h β†’ β„€)
    {ys : List (List (List Bool))} (js : List β„•) (n H : β„•)
    (hy : List.Forallβ‚‚ (List.Forallβ‚‚ (shiftedWord W))
      (List.ofFn (fun j => List.ofFn (pairs j))) ys)
    (hN : βˆ€ j i,SubexponentialSAT.BinaryArithmetic.toNat (pairs j i).2 ≀ SubexponentialSAT.BinaryArithmetic.toNat W)
    (hA : βˆ€ j i,(SubexponentialSAT.BinaryArithmetic.toNat (pairs j i).1 : β„€)-
      (SubexponentialSAT.BinaryArithmetic.toNat (pairs j i).2 : β„€)=A j i)
    (hbound : βˆ€ j i,|A j i| ≀ (H:β„€)) :
    (SubexponentialSAT.Subexp.PackingBucketTable.table
      (Label.labelled W ys js n (assignments h))
      (attainedKeys (Label.labelled W ys js n (assignments h)).reverse)).length ≀
      (2*h*H+1)^LayoutRank.rowRank A := by
  simp only [SubexponentialSAT.Subexp.PackingBucketTable.table,List.length_map,attainedKeys_reverse_length]
  exact attainedKeys_signed_length_le_rank W pairs A js n H hy hN hA hbound

end SubexponentialSAT.SqrtLog.BucketProgram

end OAI.Algorithms