Documentation

CslibFrontier.Algorithms.WordRAM.Auction.Solve

End-to-end Word-RAM auction client drivers (epsMainProg, scaledSolveProg, scaledMainProg) #

Composes workspace allocation, magnitude scanning (ScanFill.scanMaxProg), matrix shifting/scaling (ScanFill.fillCProg), the core loop (Loop.auctionCoreProg), and output scattering (Scatter.scatterProg) into the uniform memory-client entry points backing exists_epsAuction_program, exists_scaledAuction_program, and exists_scaledMinCost_program.

The shared driver solveAuctionProg and its SolveArgs record remain private to this module.

Main definitions #

Main results #

@[reducible, inline]

Two-word encoding for a pair of natural numbers (n, eps).

Top-level unscaled ε-auction memory client returning the output list base address.

theorem Cslib.Algorithms.WordRAM.Auction.epsMainProg_spec {w C : ℕ} (inst : EpsInstance) (hε : 0 < inst.eps) (hC : ∀ (i j k : Fin inst.n), inst.cost (i, k) - inst.cost (i, j) ≤ ↑C) (hw : WordRAM.Fits w inst.wordBound) :
have s₀ := DataStructure.Memory.State.init inst.encode; have d := (inst.n, inst.eps); have outAddr := (DataStructure.Memory.spec 0).clientResult s₀ (epsMainProg d); have s' := (DataStructure.Memory.spec 0).clientState s₀ (epsMainProg d); EpsMainSafe w d s₀ ∧ (DataStructure.Memory.spec w).ValidHistory s₀ ((DataStructure.Memory.spec w).clientHistory s₀ (epsMainProg d)) ∧ WordRAM.Realization.memoryCost (epsMainProg d) s₀ ≤ (inst.n * (C + inst.eps) / inst.eps + 1) * (4 * inst.n + 6) + 3 * (inst.n * inst.n) + 5 * inst.n + 2 ∧ WordRAM.outputList s'.mem outAddr = inst.assignment ∧ WordRAM.Fits w (outAddr + inst.assignment.length)

Specification of epsMainProg: writes inst.assignment to output memory within the pseudo-polynomial step bound.

Exact (n + 1)-scaled auction solver returning the workspace descriptor AuctionWS.

Word-width safety predicate for scaledSolveProg and scaledMainProg.

theorem Cslib.Algorithms.WordRAM.Auction.scaledSolveProg_spec {w C : ℕ} (inst : Instance) (hC : ∀ (i j k : Fin inst.n), inst.cost (i, k) - inst.cost (i, j) ≤ ↑C) (hw : WordRAM.Fits w inst.wordBound) :
have s₀ := DataStructure.Memory.State.init inst.encode; have ws := (DataStructure.Memory.spec 0).clientResult s₀ (scaledSolveProg inst.n); have s' := (DataStructure.Memory.spec 0).clientState s₀ (scaledSolveProg inst.n); ScaledSolveSafe w inst.n s₀ ∧ (DataStructure.Memory.spec w).ValidHistory s₀ ((DataStructure.Memory.spec w).clientHistory s₀ (scaledSolveProg inst.n)) ∧ WordRAM.Realization.memoryCost (scaledSolveProg inst.n) s₀ ≤ (inst.n * ((inst.n + 1) * C + 1) + 1) * (4 * inst.n + 6) + 3 * (inst.n * inst.n) + 5 * inst.n + 2 ∧ ValidWS ws s' ∧ ws.n = inst.n ∧ ws.scale = inst.n + 1 ∧ ws.M ≤ inst.maxMag ∧ (∀ (i j : Fin inst.n), (inst.cost (i, j)).natAbs ≤ ws.M) ∧ (∀ (i j : Fin inst.n), s'.mem (ws.bC + (↑i * inst.n + ↑j)) = (inst.n + 1) * (inst.cost (i, j) + ↑ws.M).toNat) ∧ WordRAM.outputList s'.mem ws.outBase = inst.assignment ∧ WordRAM.Fits w (ws.outBase + ws.n + 1)

Specification of scaledSolveProg: returns a workspace storing the scaled shifted costs and the scattered optimal assignment inst.assignment.