Output Entry Table Materialization (buildOutEntries) #
Iterates sumDomainValues over all dom ^ outScopeLen mixed-radix assignments to materialize the
dense output FactorTable entry array on the append-only Word-RAM heap.
Main definitions #
Cslib.Algorithms.WordRAM.VariableElimination.buildOutEntries: output-entry table builder.
Arguments for materializing the output entry table of an eliminated bucket.
- dom : ℕ
Field
domofBuildOutArgs. - x : ℕ
Field
xofBuildOutArgs. - outPtr : ℕ
Field
outPtrofBuildOutArgs. - outLen : ℕ
Field
outLenofBuildOutArgs. - bucketPtr : ℕ
Field
bucketPtrofBuildOutArgs. - bucketLen : ℕ
Field
bucketLenofBuildOutArgs.
Instances For
@[instance_reducible]
Materialize the dom ^ outScopeLen-entry array for an eliminated bucket.
theorem Cslib.Algorithms.WordRAM.VariableElimination.buildOutEntries_spec {w : ℕ} {args : BuildOutArgs} {outScope : List ℕ} {bucket : List (Logic.PL.CSP.FactorTable ℕ ℕ)} {B maxScope : ℕ} {s : DataStructure.Memory.State} (hwf : DataStructure.Memory.WellFormed w s) (hs0 : 0 < s.frontier) (hout : WordRAM.Realization.HoldsIn args.outPtr outScope s) (hout_eq : outScope = Lean.CSP.bucketOutScope args.x bucket) (hout_len : outScope.length = args.outLen) (hb : HoldsFactorList args.bucketPtr bucket s) (hlen : bucket.length = args.bucketLen) (hmax : ∀ f ∈ bucket, f.scope.length ≤ maxScope) (hfit_fr : WordRAM.Fits w (s.frontier + max 1 args.dom ^ args.outLen)) (hcapB : max 1 args.dom * (List.map capFactor bucket).prod ≤ B) (hB : WordRAM.Fits w B) :
have res := (DataStructure.Memory.spec 0).clientResult s (buildOutEntries args);
have s' := (DataStructure.Memory.spec 0).clientState s (buildOutEntries args);
have newTab := Lean.CSP.elimBucketTable args.dom args.x bucket;
(DataStructure.Memory.spec w).ValidHistory s ((DataStructure.Memory.spec w).clientHistory s (buildOutEntries args)) ∧ WordRAM.Realization.PreservesBelow s.frontier s s' ∧ s'.frontier ≤ s.frontier + max 1 args.dom ^ args.outLen ∧ s.frontier ≤ res.1 ∧ res.2 = newTab.entries.size ∧ WordRAM.Realization.HoldsIn res.1 newTab.entries.toList s' ∧ WordRAM.Realization.memoryCost (buildOutEntries args) s ≤ 3 + args.outLen + max 1 args.dom ^ args.outLen * (3 + args.dom * (1 + args.bucketLen * (5 + maxScope * (args.outLen + 1))))
theorem Cslib.Algorithms.WordRAM.VariableElimination.buildOutEntries_realizes :
WordRAM.Realization.Realizes WordRAM.Basis.exact buildOutEntries WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (args : BuildOutArgs) (s : DataStructure.Memory.State) =>
WordRAM.Fits w 1 ∧ args.outPtr + args.outLen ≤ s.frontier ∧ WordRAM.Fits w (s.frontier + max 1 args.dom ^ args.outLen) ∧ ∃ (bucket : List (Logic.PL.CSP.FactorTable ℕ ℕ)) (B : ℕ) (maxScope : ℕ),
bucket.length = args.bucketLen ∧ HoldsFactorList args.bucketPtr bucket s ∧ (∀ f ∈ bucket, f.scope.length ≤ maxScope) ∧ WordRAM.Fits w (max 1 args.dom ^ maxScope) ∧ max 1 args.dom * (List.map capFactor bucket).prod ≤ B ∧ WordRAM.Fits w B)
fun (x : BuildOutArgs) (x_1 : DataStructure.Memory.State) => 0