While this submission is a draft, it cannot be used by other submissions.

The Fairness Parameter One Below the Number of Days

Lax117284.Theorem9 · concepts/Lax117284/Theorem9.lean · lax-117284

proven

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Theorem

    Theorem 9. The problem 1∣rep∣min⁡j∑iZi,j1 \mid \mathrm{rep} \mid \min_j \sum_i Z_{i,j} is solvable in polynomial time when k=m−1k = m - 1.

    Associate with every day ii and client jj a variable xi,jx_{i,j}, read as "client jj's job is executed on day ii". Two families of clauses express the two requirements. For every day ii and every two distinct clients j1,j2j_1, j_2 whose jobs conflict on that day, the conflict clause (¬xi,j1∨¬xi,j2)(\lnot x_{i,j_1} \lor \lnot x_{i,j_2}) forbids executing both. For every client jj and every two distinct days i1,i2i_1, i_2, the validation clause (xi1,j∨xi2,j)(x_{i_1,j} \lor x_{i_2,j}) forbids rejecting the client on both. A schedule satisfies the first family exactly when it is feasible and the second exactly when no client is rejected twice, which at k=m−1k = m-1 is fairness. The formula is a 2-CNF formula of mnmn variables and mn2+nm2mn^2 + nm^2 clauses, and 2-satisfiability is decidable in linear time.

    The parameter k=m−1k = m-1 is exactly the value at which two literals suffice: "jj is served on at least m−1m-1 days" says "of any two days, jj is served on one of them", a binary constraint.

    Concept map
    8 concepts
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    This concept declares 4 statements. Each proof establishes one of them relative to its assumptions.

    1 correct proven

    In the paper

    • page 2 of this submission's paper

    Lean source view on GitHub

    1import Lax117284.Problems
    2import Lax117284.TwoSatisfiability
    3
    4/-!
    5---
    6title: The Fairness Parameter One Below the Number of Days
    7type: theorem
    8---
    9**Theorem 9.** The problem 1∣rep∣min⁡j∑iZi,j1 \mid \mathrm{rep} \mid \min_j \sum_i Z_{i,j} is solvable in
    10polynomial time when k=m−1k = m - 1.
    11
    12Associate with every day ii and client jj a variable xi,jx_{i,j}, read as "client jj's job
    13is executed on day ii". Two families of clauses express the two requirements. For every day
    14ii and every two distinct clients j1,j2j_1, j_2 whose jobs conflict on that day, the
    15*conflict clause* (¬xi,j1∨¬xi,j2)(\lnot x_{i,j_1} \lor \lnot x_{i,j_2}) forbids executing both. For every
    16client jj and every two distinct days i1,i2i_1, i_2, the *validation clause*
    17(xi1,j∨xi2,j)(x_{i_1,j} \lor x_{i_2,j}) forbids rejecting the client on both. A schedule satisfies the
    18first family exactly when it is feasible and the second exactly when no client is rejected
    19twice, which at k=m−1k = m-1 is fairness. The formula is a 2-CNF formula of mnmn variables and
    20mn2+nm2mn^2 + nm^2 clauses, and 2-satisfiability is decidable in linear time.
    21
    22The parameter k=m−1k = m-1 is exactly the value at which two literals suffice: "jj is served
    23on at least m−1m-1 days" says "of any two days, jj is served on one of them", a binary
    24constraint.
    25
    26# Formalization Notes
    27
    28Clauses are numbered rather than enumerated: a slot is allocated for every day and ordered
    29pair of clients, and for every client and ordered pair of days, and a slot whose pair is
    30inadmissible — two equal clients, two non-conflicting jobs, two equal days — carries the
    31tautology (x∨¬x)(x \lor \lnot x) on the variable it names. A closed formula for the index of a
    32clause is what an algorithm can compute; enumerating only the admissible pairs would require
    33a search. Ordered pairs make each constraint appear twice, which is harmless.
    34
    35The variables are numbered in+ji n + j, with one further variable that no meaningful clause
    36names, so that the numbering is a total function of two numbers and needs no proof that its
    37arguments are in range.
    38-/
    39
    40namespace Lax117284.Theorem9
    41
    42open Lax117284.Scheduling Lax117284.Problems Lax117284.TwoSatisfiability
    43open Lax434930.PolynomialTime Lax429075.Reductions
    44
    45/-- The variable "client `j`'s job is executed on day `i`", numbered `i·n + j`. The one
    46further variable, which no meaningful clause names, is the value on indices out of
    47range. -/
    48def varIdx (I : Instance) (i j : ℕ) : Fin (I.days * I.clients + 1) :=
    49 ⟨min (i * I.clients + j) (I.days * I.clients), Nat.lt_succ_of_le (min_le_right _ _)⟩
    50
    51/-- The `α`-th literal of clause `c`: the conflict clauses come first, one slot for every
    52day and ordered pair of clients, then the validation clauses, one slot for every client and
    53ordered pair of days. An inadmissible slot carries a tautology. -/
    54def clauseLit (I : Instance) (c : ℕ) (α : Fin 2) : Fin (I.days * I.clients + 1) × Bool :=
    55 if c < I.days * I.clients * I.clients then
    56 let i := c / (I.clients * I.clients)
    57 let r := c % (I.clients * I.clients)
    58 let j₁ := r / I.clients
    59 let j₂ := r % I.clients
    60 if j₁ ≠ j₂ ∧ I.ConflictAt i j₁ j₂ then
    61 (varIdx I i (if α = 0 then j₁ else j₂), false)
    62 else (varIdx I i j₁, α = 0)
    63 else
    64 let c' := c - I.days * I.clients * I.clients
    65 let j := c' / (I.days * I.days)
    66 let r := c' % (I.days * I.days)
    67 let i₁ := r / I.days
    68 let i₂ := r % I.days
    69 if i₁ ≠ i₂ then (varIdx I (if α = 0 then i₁ else i₂) j, true)
    70 else (varIdx I i₁ j, α = 0)
    71
    72/-- **The 2-CNF formula of Theorem 9.** -/
    73def formula (I : Instance) : Formula where
    74 vars := I.days * I.clients + 1
    75 clauses := I.days * I.clients * I.clients + I.clients * I.days * I.days
    76 lit c α := clauseLit I c α
    77
    78/-- **The construction is correct**: at the fairness parameter `m - 1` an instance is a
    79yes-instance exactly when its formula is satisfiable. -/
    80axiom correct (I : Instance) (k : ℕ) (hk : k + 1 = I.days) :
    81 I.HasKFairSchedule k ↔ (formula I).Satisfiable
    82
    83open Classical in
    84/-- **The reduction**, as a map on words: a word encoding an instance with the fairness
    85parameter one below its number of days is sent to the encoding of its formula, and every
    86other word to the encoding of an unsatisfiable formula. -/
    87noncomputable def reduce (w : Word) : Word :=
    88 if h : ∃ (I : Instance) (k : ℕ), encodeUniform I k = w ∧ k + 1 = I.days then
    89 encodeFormula (formula h.choose)
    90 else encodeFormula unsatisfiable
    91
    92/-- **The reduction is correct.** -/
    93axiom reduce_correct (w : Word) :
    94 w ∈ Uniform (fun I k => k + 1 = I.days) ↔ reduce w ∈ TwoSat
    95
    96/-- **The reduction runs in polynomial time.** -/
    97axiom reduce_polyTime : Nonempty (Turing.TM2ComputableInPolyTime id id reduce)
    98
    99/-- **Theorem 9.** The problem at the fairness parameter one below the number of days
    100reduces in polynomial time to 2-SAT. -/
    101axiom manyOne_twoSat : ManyOne (Uniform fun I k => k + 1 = I.days) TwoSat
    102
    103end Lax117284.Theorem9
    104
    Show ProofShow ProofShow ProofShow Proof
    Formalization Notes

    Clauses are numbered rather than enumerated: a slot is allocated for every day and ordered pair of clients, and for every client and ordered pair of days, and a slot whose pair is inadmissible — two equal clients, two non-conflicting jobs, two equal days — carries the tautology (x∨¬x)(x \lor \lnot x) on the variable it names. A closed formula for the index of a clause is what an algorithm can compute; enumerating only the admissible pairs would require a search. Ordered pairs make each constraint appear twice, which is harmless.

    The variables are numbered in+ji n + j, with one further variable that no meaningful clause names, so that the numbering is a total function of two numbers and needs no proof that its arguments are in range.

    Builds on
    Used by

    none

    From Mathlib

    none

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…