The Dynamic Program for Day-Independent Due Dates
Lax117284.Theorem12 · concepts/Lax117284/Theorem12.lean · lax-117284
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
Theorem 12. Let be an instance whose due dates are day-independent, so that client has one due date on every day. Order the clients by due date and process them in that order, carrying as state, for every day, the time at which that day's machine becomes free. Serving a client on a set of days requires that on each of those days the machine be free early enough for its job to be completed at its due date, and leaves the machine of each of those days free from that due date onwards. The instance admits a -fair schedule if and only if the program, started with every machine free from time and applied to the clients in due-date order, can serve every client on days.
Processing the clients in due-date order is what makes the state sufficient: a client considered later has a due date at least as large, so the only thing a decision about the earlier clients can leave behind that matters is how late each machine is occupied. For a constant number of days the number of reachable states is polynomial, and the program decides the problem in polynomial time.
Concept map
In the paper
- page 2 of this submission's paper
Lean source view on GitHub
| 1 | import Lax117284.Scheduling |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: The Dynamic Program for Day-Independent Due Dates |
| 6 | type: theorem |
| 7 | --- |
| 8 | **Theorem 12.** Let be an instance whose due dates are day-independent, so that client |
| 9 | has one due date on every day. Order the clients by due date and process them in |
| 10 | that order, carrying as state, for every day, the time at which that day's machine becomes |
| 11 | free. Serving a client on a set of days requires that on each of those days the machine be |
| 12 | free early enough for its job to be completed at its due date, and leaves the machine of |
| 13 | each of those days free from that due date onwards. The instance admits a -fair schedule |
| 14 | if and only if the program, started with every machine free from time and applied to |
| 15 | the clients in due-date order, can serve every client on days. |
| 16 | |
| 17 | Processing the clients in due-date order is what makes the state sufficient: a client |
| 18 | considered later has a due date at least as large, so the only thing a decision about the |
| 19 | earlier clients can leave behind that matters is how late each machine is occupied. For a |
| 20 | constant number of days the number of reachable states is polynomial, and the program |
| 21 | decides the problem in polynomial time. |
| 22 | |
| 23 | # Formalization Notes |
| 24 | |
| 25 | The program is a predicate: it holds of a list of clients and a state when the clients of |
| 26 | the list can each be served on days from that state onwards. It is recursive in the |
| 27 | list, and the recursion is the transition of the dynamic program rather than a table, which |
| 28 | is the form in which its correctness is stated and proved. A table filled in the order of |
| 29 | the list has the same reachable states. |
| 30 | |
| 31 | The list is required to contain every client exactly once and to be sorted by due date, |
| 32 | which is the precondition of the program rather than a property of the instance, so a |
| 33 | statement about it says what the algorithm must be given. |
| 34 | -/ |
| 35 | |
| 36 | namespace Lax117284.Theorem12 |
| 37 | |
| 38 | open Lax117284.Scheduling |
| 39 | |
| 40 | variable {I : Instance} |
| 41 | |
| 42 | /-- The dynamic program of Theorem 12: given the due dates `dd`, the fairness parameter |
| 43 | `k`, the clients still to be served, and for each day the time at which its machine is |
| 44 | free, can every remaining client be served on `k` days? -/ |
| 45 | def Program (dd : Fin I.clients → ℕ) (k : ℕ) : |
| 46 | List (Fin I.clients) → (Fin I.days → ℕ) → Prop |
| 47 | | [], _ => True |
| 48 | | j :: rest, free => ∃ S : Finset (Fin I.days), S.card = k ∧ |
| 49 | (∀ i ∈ S, I.p i j + free i ≤ dd j) ∧ |
| 50 | Program dd k rest fun i => if i ∈ S then dd j else free i |
| 51 | |
| 52 | /-- **Theorem 12.** With day-independent due dates, an instance admits a `k`-fair schedule |
| 53 | exactly when the dynamic program, applied to the clients in due-date order with every |
| 54 | machine free from time `0`, can serve every client on `k` days. -/ |
| 55 | axiom hasKFairSchedule_iff_program (hd : I.DayIndepD) (i₀ : Fin I.days) (k : ℕ) |
| 56 | {l : List (Fin I.clients)} (hnd : l.Nodup) (hall : ∀ j, j ∈ l) |
| 57 | (hsorted : l.Pairwise fun a b => I.d i₀ a ≤ I.d i₀ b) : |
| 58 | I.HasKFairSchedule k ↔ Program (I.d i₀) k l fun _ => 0 |
| 59 | |
| 60 | end Lax117284.Theorem12 |
| 61 |
Formalization Notes
The program is a predicate: it holds of a list of clients and a state when the clients of the list can each be served on days from that state onwards. It is recursive in the list, and the recursion is the transition of the dynamic program rather than a table, which is the form in which its correctness is stated and proved. A table filled in the order of the list has the same reachable states.
The list is required to contain every client exactly once and to be sorted by due date, which is the precondition of the program rather than a property of the instance, so a statement about it says what the algorithm must be given.
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments