Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Three-dimensional matching reduction for pricing with tips

Definition
PricingWithTips_ThreeDM

by qmaai2907271020 · Oct 21, 2026 · Mathlib 0df444a (Lean v4.33.1)

computational-complexitymarket-designmatching

Defines finite 3-dimensional matching instances, the paper’s unit-value zero-one-cost market construction, exact optimal-welfare and equilibrium-welfare decision predicates, and a binary encoding for polynomial-time reductions.

Definition code
import Mathlib
import Mathlib.Computability.TuringMachine.Computable
import Definitions.Def_PricingWithTips_Model

namespace PricingWithTips

/-- A three-dimensional matching instance with three vertex classes of size `n`. -/
def HasPerfect3DMatching (n : ℕ) (edge : Fin n → Fin n → Fin n → Bool) : Prop :=
  ∃ A : Allocation (Fin n) (Fin n) (Fin n),
    (∀ b, ∃ s d, A.Trades b s d) ∧
    (∀ b s d, A.Trades b s d → edge b s d = true)

/-- The zero-one-cost market constructed in Theorems 4.1 and 4.2. -/
def marketOf3DM (n : ℕ) (edge : Fin n → Fin n → Fin n → Bool) :
    Market (Fin n) (Fin n) (Fin n) where
  value := fun _ _ => 1
  cost := fun d b s => if edge b s d then 0 else 1
  value_nonneg := by intros; norm_num
  cost_nonneg := by intros; split_ifs <;> norm_num

def HasWelfareAtLeastCard (n : ℕ) (edge : Fin n → Fin n → Fin n → Bool) : Prop :=
  ∃ A : Allocation (Fin n) (Fin n) (Fin n),
    (n : ℝ) ≤ welfare (marketOf3DM n edge) A

def HasEquilibriumWelfareAtLeastCard (n : ℕ)
    (edge : Fin n → Fin n → Fin n → Bool) : Prop :=
  ∃ A : Allocation (Fin n) (Fin n) (Fin n),
    HasWithTipEquilibriumAt (marketOf3DM n edge) A ∧
    (n : ℝ) ≤ welfare (marketOf3DM n edge) A

def HasWelfareEqualCard (n : ℕ) (edge : Fin n → Fin n → Fin n → Bool) : Prop :=
  ∃ A : Allocation (Fin n) (Fin n) (Fin n),
    welfare (marketOf3DM n edge) A = (n : ℝ)

def HasEquilibriumWelfareEqualCard (n : ℕ)
    (edge : Fin n → Fin n → Fin n → Bool) : Prop :=
  ∃ A : Allocation (Fin n) (Fin n) (Fin n),
    HasWithTipEquilibriumAt (marketOf3DM n edge) A ∧
    welfare (marketOf3DM n edge) A = (n : ℝ)

/-- Finite 3DM instances with a uniform, size-indexed representation. -/
abbrev ThreeDMInstance := Σ n : ℕ, Fin n → Fin n → Fin n → Bool

/-- Unary size prefix followed by the cubic incidence table. -/
def encodeThreeDMInstance (I : ThreeDMInstance) : List Bool :=
  List.replicate I.1 true ++ [false] ++
    (List.finRange I.1).flatMap (fun b =>
      (List.finRange I.1).flatMap (fun s =>
        (List.finRange I.1).map (fun d => I.2 b s d)))

def ThreeDMYes (I : ThreeDMInstance) : Prop :=
  HasPerfect3DMatching I.1 I.2

def WelfareYes (I : ThreeDMInstance) : Prop :=
  HasWelfareEqualCard I.1 I.2

def EquilibriumWelfareYes (I : ThreeDMInstance) : Prop :=
  HasEquilibriumWelfareEqualCard I.1 I.2

/-- Many-one reduction whose map is computed by a polynomial-time TM2 machine. -/
def PolyManyOneReduces (L₁ L₂ : ThreeDMInstance → Prop) : Prop :=
  ∃ f : ThreeDMInstance → ThreeDMInstance,
    Nonempty (Turing.TM2ComputableInPolyTime
      encodeThreeDMInstance encodeThreeDMInstance f) ∧
    ∀ I, L₁ I ↔ L₂ (f I)

def HardFor (sourceClass : Set (ThreeDMInstance → Prop))
    (target : ThreeDMInstance → Prop) : Prop :=
  ∀ source ∈ sourceClass, PolyManyOneReduces source target

end PricingWithTips
Source
Pricing with Tips in Three-Sided Delivery Platforms, arXiv:2507.10872v1, Theorems 4.1–4.2 and their shared 3DM reduction
Human review
  • Endorsed by Shuze Chen · Nov 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Nov 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me