Scattering object-owner map to output memory for Word-RAM auction #
Writes the length-prefixed assignment list [objectOf 0, …, objectOf (n - 1)] at ws.outBase
by scattering the inverse array owner[0..n). Preserves the unsigned cost matrix C at ws.bC
so sumScaledCostProg can read it afterward.
Main definitions #
Cslib.Algorithms.WordRAM.Auction.scatterProg,Cslib.Algorithms.WordRAM.Auction.ScatterProgSafe: output-scattering program and safety predicate.
Main results #
Cslib.Algorithms.WordRAM.Auction.scatterProg_realizes,Cslib.Algorithms.WordRAM.Auction.scatterProg_spec: Word-RAM realization and specification ofscatterProg.
Scatter the completed owner[0..n) array to the length-prefixed output list at ws.outBase.
def Cslib.Algorithms.WordRAM.Auction.ScatterProgSafe (w : ℕ) (ws : AuctionWS) (s : DataStructure.Memory.State) :
Word-width safety predicate for scatterProg.
realize certificate for scatterProg.
theorem Cslib.Algorithms.WordRAM.Auction.scatterProg_spec {w : ℕ} (ws : AuctionWS) {C : Fin ws.n × Fin ws.n → ℕ} {st : Lean.Assignment.AuctionState ws.n} (hinv : Lean.Assignment.AuctionInv (fun (e : Fin ws.n × Fin ws.n) => ↑(C e)) (↑ws.eps) st) (hfree : st.free = []) (s₀ : DataStructure.Memory.State) (hws : ValidWS ws s₀) (ham : AuctionMem ws C st s₀) (hfit1 : WordRAM.Fits w 1) (hfit_ws : WordRAM.Fits w (ws.outBase + ws.n + 1)) :
have s' := (DataStructure.Memory.spec 0).clientState s₀ (scatterProg ws);
ScatterProgSafe w ws s₀ ∧ (DataStructure.Memory.spec w).ValidHistory s₀ ((DataStructure.Memory.spec w).clientHistory s₀ (scatterProg ws)) ∧ WordRAM.Realization.memoryCost (scatterProg ws) s₀ ≤ 2 * ws.n + 1 ∧ s'.frontier = s₀.frontier ∧ (DataStructure.Memory.spec 0).clientResult s₀ (scatterProg ws) = ws.outBase ∧ (∀ (i j : Fin ws.n), s'.mem (ws.bC + (↑i * ws.n + ↑j)) = C (i, j)) ∧ WordRAM.outputList s'.mem ws.outBase = List.map (fun (i : Fin ws.n) => ↑(st.objectOf i)) (List.finRange ws.n)
Specification of scatterProg: preserves the unsigned cost matrix C at ws.bC and writes
[objectOf 0, …, objectOf (n - 1)] as a length-prefixed list at ws.outBase.