Live Factor-Descriptor Partitioning (partitionLive) #
Partitions the active array of 4-word factor descriptors into two freshly allocated descriptor
arrays: bucket (those whose scope contains x) and rest (all other live factors).
Main definitions #
Cslib.Algorithms.WordRAM.VariableElimination.partitionLive: bucket/rest descriptor splitter.
Arguments (x, livePtr, liveLen) for partitionLive.
- x : ℕ
Field
xofPartitionArgs. - livePtr : ℕ
Field
livePtrofPartitionArgs. - liveLen : ℕ
Field
liveLenofPartitionArgs.
Instances For
Product equivalence encoding PartitionArgs as words.
@[instance_reducible]
Return record holding pointer/length pairs for bucket and rest factors.
- bucketPtr : ℕ
Field
bucketPtrofPartitionRes. - bucketLen : ℕ
Field
bucketLenofPartitionRes. - newLiveBuf : ℕ
Field
newLiveBufofPartitionRes. - restLen : ℕ
Field
restLenofPartitionRes.
Instances For
Product equivalence encoding PartitionRes as words.
@[instance_reducible]
Split the live descriptor array into bucket (containing x) and rest.
theorem Cslib.Algorithms.WordRAM.VariableElimination.partitionLive_spec {w : ℕ} {args : PartitionArgs} {live : List (Logic.PL.CSP.FactorTable ℕ ℕ)} {maxScope : ℕ} {s : DataStructure.Memory.State} (hwf : DataStructure.Memory.WellFormed w s) (hlive : HoldsFactorList args.livePtr live s) (hlen : live.length = args.liveLen) (hmax : ∀ f ∈ live, f.scope.length ≤ maxScope) (hfit : WordRAM.Fits w (s.frontier + 4 + 8 * args.liveLen)) :
have res := (DataStructure.Memory.spec 0).clientResult s (partitionLive args);
have s' := (DataStructure.Memory.spec 0).clientState s (partitionLive args);
have bucket := List.filter (fun (f : Logic.PL.CSP.FactorTable ℕ ℕ) => decide (args.x ∈ f.scope)) live;
have rest := List.filter (fun (f : Logic.PL.CSP.FactorTable ℕ ℕ) => decide (args.x ∉ f.scope)) live;
(DataStructure.Memory.spec w).ValidHistory s ((DataStructure.Memory.spec w).clientHistory s (partitionLive args)) ∧ s'.frontier = s.frontier + 4 + 8 * args.liveLen ∧ WordRAM.Realization.PreservesBelow s.frontier s s' ∧ res.bucketPtr = s.frontier ∧ res.newLiveBuf = s.frontier + 4 * args.liveLen ∧ res.bucketLen = bucket.length ∧ res.restLen = rest.length ∧ HoldsFactorList res.bucketPtr bucket s' ∧ AllDataBelow s.frontier res.bucketPtr bucket s' ∧ HoldsFactorList (res.newLiveBuf + 4) rest s' ∧ AllDataBelow s.frontier (res.newLiveBuf + 4) rest s' ∧ WordRAM.Realization.memoryCost (partitionLive args) s ≤ 2 + args.liveLen * (8 + maxScope)
theorem Cslib.Algorithms.WordRAM.VariableElimination.partitionLive_realizes :
WordRAM.Realization.Realizes WordRAM.Basis.exact partitionLive WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (args : PartitionArgs) (s : DataStructure.Memory.State) =>
WordRAM.Fits w 1 ∧ WordRAM.Fits w (s.frontier + 4 + 8 * args.liveLen) ∧ ∃ (live : List (Logic.PL.CSP.FactorTable ℕ ℕ)),
live.length = args.liveLen ∧ HoldsFactorList args.livePtr live s)
fun (x : PartitionArgs) (x_1 : DataStructure.Memory.State) => 0