math / data /lean /OAI /Algorithms /SubexponentialSAT /SqrtLog /BucketProgramRank.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.72 kB
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