Documentation

EconCSLib.MechanismDesign.Auction.Knapsack

EconCSLib.MechanismDesign.Auction.Knapsack #

Knapsack auctions in the single-parameter setting.

This file specializes Auction.SingleParameterMechanism to a standard knapsack-auction environment:

Structure hierarchy #

MechanismWithTransfers I (fun _ => U) (I → U) U   -- scalar reports and allocations
  └─ SingleParameterMechanism I U                 -- single-parameter transfer layer
       └─ KnapsackAuction I U                       -- public weights + total capacity
            └─ welfareMaximizingMechanism hW      -- Myerson-payment implementation

Main definitions #

Main proofs #

structure KnapsackAuction (I : Type u_1) (U : Type u_2) extends SingleParameterMechanism I U :
Type (max u_1 u_2)

A knapsack auction with public weights w i and total capacity W.

The underlying strategic object is a SingleParameterMechanism I U, where the value type U is a linearly ordered field ([Field U] [LinearOrder U] [IsStrictOrderedRing U]; e.g. , ): each agent reports a single scalar value in U, receives an allocation level xᵢU, and makes a U-valued payment. The pointwise allocation bounds are inherited from SingleParameterMechanism.IsAllocFeasible; the knapsack constraint is recorded separately below.

  • allocationRule : (IU)IU
  • paymentRule : (IU)IU
  • weight : IU

    Public weight / size of agent i in the knapsack constraint.

  • totalCapacity : U

    Total knapsack capacity.

Instances For

    The allocation rule respects the knapsack capacity constraint.

    Equations
    Instances For
      def KnapsackAuction.IsFeasible {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [Fintype I] (A : KnapsackAuction I U) :

      Feasibility for a knapsack auction:

      • each agent's allocation lies in [0,1]
      • the weighted allocation satisfies the total capacity bound
      Equations
      Instances For
        @[reducible, inline]
        abbrev KnapsackAuction.size {I : Type u_1} {U : Type u_2} (A : KnapsackAuction I U) (i : I) :
        U

        Agent i's public weight.

        Equations
        Instances For
          @[reducible, inline]
          abbrev KnapsackAuction.capacity {I : Type u_1} {U : Type u_2} (A : KnapsackAuction I U) :
          U

          The total capacity bound.

          Equations
          Instances For

            Every public weight is nonnegative.

            Equations
            Instances For

              Every public weight is strictly positive.

              Equations
              Instances For

                The knapsack capacity is nonnegative.

                Equations
                Instances For
                  @[reducible, inline]

                  A discrete knapsack allocation profile: each agent is either selected or not.

                  Equations
                  Instances For
                    def KnapsackAuction.binaryToAllocation {I : Type u_1} {U : Type u_2} [Field U] (x : BinaryAllocation I) :
                    IU

                    The 0/1 allocation vector associated with a binary allocation profile.

                    Equations
                    Instances For
                      def KnapsackAuction.binaryLoad {I : Type u_1} {U : Type u_2} [Field U] [Fintype I] (A : KnapsackAuction I U) (x : BinaryAllocation I) :
                      U

                      The weighted load induced by a binary allocation profile.

                      Equations
                      Instances For

                        Capacity feasibility for a binary allocation profile.

                        Equations
                        Instances For

                          The finite list of binary allocations satisfying the knapsack constraint.

                          Equations
                          Instances For
                            def KnapsackAuction.binarySocialWelfare {I : Type u_1} {U : Type u_2} [Field U] [Fintype I] (b : IU) (x : BinaryAllocation I) :
                            U

                            Social welfare of a binary allocation profile at valuation profile b.

                            Equations
                            Instances For

                              A welfare-maximizing feasible binary allocation, chosen using List.argMaxOn on the finite space of feasible 0/1 allocations.

                              noncomputable def KnapsackAuction.welfareMaximizer {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [IsStrictOrderedRing U] [Fintype I] [DecidableEq I] (A : KnapsackAuction I U) (b : IU) (hW : 0 A.totalCapacity) :
                              Equations
                              Instances For
                                noncomputable def KnapsackAuction.maximalSocialWelfare {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [IsStrictOrderedRing U] [Fintype I] [DecidableEq I] (A : KnapsackAuction I U) (b : IU) (hW : 0 A.totalCapacity) :
                                U

                                The maximal social welfare over the feasible binary allocation space.

                                Equations
                                Instances For
                                  theorem KnapsackAuction.binarySocialWelfare_update {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [IsStrictOrderedRing U] [Fintype I] [DecidableEq I] (b : IU) (i : I) (θ : U) (x : BinaryAllocation I) :
                                  noncomputable def KnapsackAuction.welfareMaximizingAllocationRule {I : Type u_1} [Fintype I] [DecidableEq I] (A : KnapsackAuction I ) (hW : 0 A.totalCapacity) :
                                  (I)I

                                  The welfare-maximizing allocation rule for the knapsack auction, obtained by choosing a feasible binary allocation with maximal social welfare and then viewing it as an I allocation vector.

                                  Equations
                                  Instances For
                                    noncomputable def KnapsackAuction.welfareMaximizingPaymentRule {I : Type u_1} [Fintype I] [DecidableEq I] (A : KnapsackAuction I ) (hW : 0 A.totalCapacity) :
                                    (I)I

                                    The Myerson payment formula associated with the welfare-maximizing knapsack allocation rule.

                                    Equations
                                    Instances For

                                      The canonical welfare-maximizing single-parameter knapsack mechanism, with payments given by the Myerson formula.

                                      Equations
                                      Instances For
                                        def KnapsackAuction.fractionalSocialWelfare {I : Type u_1} {U : Type u_2} [Field U] [Fintype I] (b x : IU) :
                                        U

                                        Fractional social welfare for a U-valued allocation vector.

                                        Equations
                                        Instances For
                                          def KnapsackAuction.fractionalFeasible {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [Fintype I] (A : KnapsackAuction I U) (x : IU) :

                                          Feasibility of a fractional knapsack allocation: pointwise fractions lie in [0,1] and the weighted load respects capacity.

                                          Equations
                                          Instances For
                                            noncomputable def KnapsackAuction.ratio {I : Type u_1} {U : Type u_2} [Field U] (A : KnapsackAuction I U) (b : IU) (i : I) :
                                            U

                                            Value-to-weight ratio used by the fractional greedy rule.

                                            Equations
                                            Instances For
                                              noncomputable def KnapsackAuction.ratioTieKey {I : Type u_1} {U : Type u_2} [Field U] (A : KnapsackAuction I U) (b : IU) (i : I) :
                                              U × I

                                              Sorting key for the fractional greedy rule: higher ratio first, ties broken by the ambient linear order on I.

                                              Equations
                                              Instances For
                                                noncomputable def KnapsackAuction.sortedAgentsByRatio {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [Fintype I] [LinearOrder I] (A : KnapsackAuction I U) (b : IU) :

                                                Agents sorted by decreasing value-to-weight ratio, with lexicographic tie-breaking via the ambient order on I.

                                                Equations
                                                Instances For
                                                  @[irreducible]
                                                  noncomputable def KnapsackAuction.fractionalGreedyList {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [DecidableEq I] (A : KnapsackAuction I U) (b : IU) :
                                                  List IUIU

                                                  Greedy fractional allocation along a fixed list order. If the next item does not fully fit, the algorithm takes exactly the remaining fraction and halts.

                                                  Equations
                                                  Instances For
                                                    noncomputable def KnapsackAuction.fractionalGreedyAllocation {I : Type u_1} {U : Type u_2} [Field U] [LinearOrder U] [Fintype I] [DecidableEq I] [LinearOrder I] (A : KnapsackAuction I U) (b : IU) :
                                                    IU

                                                    The greedy fractional knapsack allocation obtained by sorting agents by value-to-weight ratio and then filling capacity in that order.

                                                    Equations
                                                    Instances For

                                                      If the ratio-sorted greedy fractional allocation is optimal for the fractional relaxation, then its welfare dominates the welfare of the optimal 0/1 knapsack allocation. This is the standard relaxation comparison: every feasible binary allocation is also a feasible fractional allocation.

                                                      Integer-valued welfare of a binary allocation profile.

                                                      Equations
                                                      Instances For
                                                        def KnapsackAuction.natBinaryLoad {I : Type u_1} [Fintype I] (w : I) (x : BinaryAllocation I) :

                                                        Integer-valued load of a binary allocation profile.

                                                        Equations
                                                        Instances For
                                                          def KnapsackAuction.supportedOn {I : Type u_1} (items : List I) (x : BinaryAllocation I) :

                                                          An allocation is supported on a list of agents if every selected agent appears in that list.

                                                          Equations
                                                          Instances For
                                                            theorem KnapsackAuction.eq_false_of_supportedOn_of_not_mem {I : Type u_1} {items : List I} {x : BinaryAllocation I} (hsupp : supportedOn items x) {i : I} (hi : iitems) :
                                                            x i = false
                                                            theorem KnapsackAuction.supportedOn_tail_of_eq_false {I : Type u_1} {i : I} {items : List I} {x : BinaryAllocation I} (hsupp : supportedOn (i :: items) x) (hxi : x i = false) :
                                                            supportedOn items x
                                                            theorem KnapsackAuction.supportedOn_update_false {I : Type u_1} [DecidableEq I] {i : I} {items : List I} {x : BinaryAllocation I} (hsupp : supportedOn (i :: items) x) :
                                                            theorem KnapsackAuction.natBinaryLoad_eq_add_of_true {I : Type u_1} [Fintype I] [DecidableEq I] (w : I) {x : BinaryAllocation I} {i : I} (hxi : x i = true) :
                                                            @[irreducible]
                                                            def KnapsackAuction.dpSolveList {I : Type u_1} [Fintype I] [DecidableEq I] (w b : I) :

                                                            A computable dynamic-programming solver for finite 0/1 knapsack instances.

                                                            The solver processes the agents in the given list order and uses the standard "skip or take" recursion on the remaining capacity. This is the algorithmic counterpart to the abstract welfare-maximizer above, specialized to natural weights, natural capacity, and natural reported values.

                                                            Equations
                                                            Instances For
                                                              theorem KnapsackAuction.dpSolveList_supportedOn {I : Type u_1} [Fintype I] [DecidableEq I] (w b : I) (items : List I) (capacity : ) :
                                                              supportedOn items (dpSolveList w b items capacity)
                                                              theorem KnapsackAuction.dpSolveList_feasible {I : Type u_1} [Fintype I] [DecidableEq I] (w b : I) (items : List I) :
                                                              items.Nodup∀ (capacity : ), natBinaryLoad w (dpSolveList w b items capacity) capacity
                                                              theorem KnapsackAuction.dpSolveList_optimal {I : Type u_1} [Fintype I] [DecidableEq I] (w b : I) (items : List I) :
                                                              items.Nodup∀ (capacity : ) {x : BinaryAllocation I}, supportedOn items xnatBinaryLoad w x capacitynatBinarySocialWelfare b x natBinarySocialWelfare b (dpSolveList w b items capacity)
                                                              noncomputable def KnapsackAuction.dynamicProgrammingOptimalAllocation {I : Type u_1} [Fintype I] [DecidableEq I] (w b : I) (capacity : ) :

                                                              The computable knapsack allocation obtained by running the dynamic program on the full finite agent list.

                                                              Equations
                                                              Instances For
                                                                noncomputable def KnapsackAuction.dynamicProgrammingOptimalValue {I : Type u_1} [Fintype I] [DecidableEq I] (w b : I) (capacity : ) :

                                                                The social welfare achieved by the dynamic-programming allocation.

                                                                Equations
                                                                Instances For

                                                                  The dynamic-programming allocation always satisfies the knapsack capacity constraint in the natural-number specialization.

                                                                  The dynamic-programming allocation maximizes integer social welfare among all feasible binary allocations.

                                                                  def KnapsackAuction.natAuctionData {I : Type u_1} (w : I) (capacity : ) :

                                                                  The knapsack-auction data obtained from natural-number weights and capacity, with dummy zero allocation/payment rules. This is only used to instantiate the fractional greedy construction.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    def KnapsackAuction.realBidOfNat {I : Type u_1} (b : I) :
                                                                    I

                                                                    Natural-number bids viewed as real-valued bids.

                                                                    Equations
                                                                    Instances For
                                                                      @[irreducible]

                                                                      The integral greedy prefix algorithm: process items in a fixed order, take each whole item if it fits, and halt when the first item fails to fit.

                                                                      Equations
                                                                      Instances For
                                                                        noncomputable def KnapsackAuction.integralGreedyAllocation {I : Type u_1} [Fintype I] [DecidableEq I] [LinearOrder I] (w b : I) (capacity : ) :

                                                                        The ratio-sorted integral greedy allocation.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          noncomputable def KnapsackAuction.integralGreedyValue {I : Type u_1} [Fintype I] [DecidableEq I] [LinearOrder I] (w b : I) (capacity : ) :

                                                                          Welfare of the ratio-sorted integral greedy allocation.

                                                                          Equations
                                                                          Instances For
                                                                            noncomputable def KnapsackAuction.highestBidValue {I : Type u_1} [Fintype I] [Nonempty I] (b : I) :

                                                                            Highest single-item value.

                                                                            Equations
                                                                            Instances For
                                                                              theorem KnapsackAuction.le_highestBidValue {I : Type u_1} [Fintype I] [Nonempty I] (b : I) (i : I) :
                                                                              @[irreducible]
                                                                              noncomputable def KnapsackAuction.natFractionalGreedyList {I : Type u_1} [DecidableEq I] (w : I) :
                                                                              List II

                                                                              Fractional greedy prefix algorithm on a natural-number remaining capacity: take each whole item if it fits, and otherwise take exactly the remaining fraction of the current item and halt.

                                                                              Equations
                                                                              Instances For
                                                                                noncomputable def KnapsackAuction.natFractionalGreedyAllocation {I : Type u_1} [Fintype I] [DecidableEq I] [LinearOrder I] (w b : I) (capacity : ) :
                                                                                I

                                                                                The ratio-sorted fractional greedy allocation on natural-number data.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For
                                                                                  noncomputable def KnapsackAuction.natFractionalGreedyValue {I : Type u_1} [Fintype I] [DecidableEq I] [LinearOrder I] (w b : I) (capacity : ) :

                                                                                  Welfare of the ratio-sorted fractional greedy allocation.

                                                                                  Equations
                                                                                  Instances For
                                                                                    def KnapsackAuction.fractionalSupportedOn {I : Type u_1} (items : List I) (x : I) :

                                                                                    A real-valued allocation is supported on a list if every nonzero coordinate appears in that list.

                                                                                    Equations
                                                                                    Instances For
                                                                                      theorem KnapsackAuction.eq_zero_of_fractionalSupportedOn_of_not_mem {I : Type u_1} {items : List I} {x : I} (hsupp : fractionalSupportedOn items x) {i : I} (hi : iitems) :
                                                                                      x i = 0
                                                                                      theorem KnapsackAuction.integralGreedyList_supportedOn {I : Type u_1} [DecidableEq I] (w : I) (items : List I) (remaining : ) :
                                                                                      supportedOn items (integralGreedyList w items remaining)
                                                                                      theorem KnapsackAuction.natFractionalGreedyList_supportedOn {I : Type u_1} [DecidableEq I] (w : I) (items : List I) (remaining : ) :
                                                                                      theorem KnapsackAuction.fractionalSocialWelfare_singleton {I : Type u_1} [Fintype I] [DecidableEq I] (b : I) (i : I) (α : ) :
                                                                                      (fractionalSocialWelfare b fun (j : I) => if j = i then α else 0) = b i * α
                                                                                      theorem KnapsackAuction.natFractionalGreedyList_le_integralGreedyList_plus_highest {I : Type u_1} [Fintype I] [DecidableEq I] [Nonempty I] (w b : I) (hwpos : ∀ (i : I), 0 < w i) {items : List I} :
                                                                                      items.Nodup∀ (remaining : ), fractionalSocialWelfare (realBidOfNat b) (natFractionalGreedyList w items remaining) (natBinarySocialWelfare b (integralGreedyList w items remaining)) + (highestBidValue b)
                                                                                      theorem KnapsackAuction.natFractionalGreedyValue_le_integralGreedyValue_plus_highest {I : Type u_1} [Fintype I] [DecidableEq I] [LinearOrder I] [Nonempty I] (w b : I) (capacity : ) (hwpos : ∀ (i : I), 0 < w i) :
                                                                                      natFractionalGreedyValue w b capacity (integralGreedyValue w b capacity) + (highestBidValue b)
                                                                                      theorem KnapsackAuction.integralGreedy_halfApprox_dpOptimal {I : Type u_1} [Fintype I] [DecidableEq I] [LinearOrder I] [Nonempty I] (w b : I) (capacity : ) (hwpos : ∀ (i : I), 0 < w i) (_hallfit : ∀ (i : I), w i capacity) (hfracOptimal : ∀ (x : I), (natAuctionData w capacity).fractionalFeasible xfractionalSocialWelfare (realBidOfNat b) x natFractionalGreedyValue w b capacity) :
                                                                                      (dynamicProgrammingOptimalValue w b capacity) / 2 (max (integralGreedyValue w b capacity) (highestBidValue b))

                                                                                      The ratio-sorted integral greedy algorithm, compared with the highest single-value item, achieves a 1/2-approximation to the DP-optimal 0/1 knapsack welfare, provided the fractional greedy allocation is optimal for the fractional relaxation and every item fits individually in the knapsack.