Row scans for best and second-best reduced costs in Word-RAM auction #
Two independent read-only O(n) row scans over C[i₀, ·] + price[·]:
findBestProg: computesbestObject(argmin of reduced cost acrossj : Fin n).findSecondProg: computessecondBest(minimum reduced cost overj ≠ bestJ).
Both loop specs share the readout lemma AuctionMem.redCost_read from Auction.Workspace. The
single-step functions and their realize certificates remain private.
Main definitions #
Cslib.Algorithms.WordRAM.Auction.ScanRowArgs,Cslib.Algorithms.WordRAM.Auction.BestState,Cslib.Algorithms.WordRAM.Auction.findBestProg,Cslib.Algorithms.WordRAM.Auction.FindBestSafe: best-object row scan arguments, state, program, and safety predicate.Cslib.Algorithms.WordRAM.Auction.ScanSecondArgs,Cslib.Algorithms.WordRAM.Auction.SecondState,Cslib.Algorithms.WordRAM.Auction.findSecondProg,Cslib.Algorithms.WordRAM.Auction.FindSecondSafe: second-best row scan arguments, state, program, and safety predicate.
Main results #
Cslib.Algorithms.WordRAM.Auction.findBestProg_realizes,Cslib.Algorithms.WordRAM.Auction.findBest_spec: realization and specification of the argmin scan.Cslib.Algorithms.WordRAM.Auction.findSecondProg_realizes,Cslib.Algorithms.WordRAM.Auction.findSecond_spec: realization and specification of the second-best reduced-cost scan.
Faithful three-word encoding of ScanRowArgs.
Registered WordEncoding for ScanRowArgs.
Running state of the argmin row scan (findBestProg).
- idx : ℕ
Next object index to inspect.
- bestJ : ℕ
Best object index seen so far.
- bestVal : ℕ
Least reduced cost seen so far.
Instances For
Registered WordEncoding for BestState.
Faithful four-word encoding of ScanSecondArgs.
Registered WordEncoding for ScanSecondArgs.
Faithful three-word encoding of SecondState.
Registered WordEncoding for SecondState.
Row scan 1: best object (findBestProg) #
Scan a row of length d.n to find the object minimizing C[i₀, j] + price[j].
Word-width safety predicate for findBestProg.
realize certificate for findBestProg.
Specification of findBestProg: preserves memory, costs at most 2 * ws.n, and yields the
exact bestObject index and value matching the pure Auction model.
Row scan 2: second-best reduced cost (findSecondProg) #
Scan a row of length d.n skipping d.bestJ to compute the second-least reduced cost.
Word-width safety predicate for findSecondProg.
realize certificate for findSecondProg.
Specification of findSecondProg: preserves memory, costs at most 2 * ws.n, and matches
secondBest in the pure Auction model.