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

The kinds of results on scheduling problems

Lax434175.Results · concepts/Lax434175/Results.lean · lax-434175

definition

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

    Definition

    A result on a scheduling problem is a statement about its decision version on words, about algorithms that output schedules, or about online play. Such statements depend on how instances and schedules are written, so they are made relative to a reading of the problem: which words encode which instance, which words write which schedule, and what an online scheduler sees at each time. A reading of a family gives one for every specification. The results of the literature are claims about the standard binary readings; here every result is a proposition about a given reading.

    Fix a reading and parameters κ\kappa: functions of the instance and the threshold into the naturals (most depend on the instance only; some, such as the pathwidth of time windows that end at the threshold, depend on both). The decision version on words: a word of an instance, then the sign and absolute value of an integral threshold DD, is a yes-instance if some feasible schedule has cost at most DD. Running times are those of the word RAM (lax-496464, lax-808846).

    Exact algorithms and hardness. In P: decided in time c (∣w∣+1)dc\,(|w|+1)^d in the bit size ∣w∣|w|. Pseudo-polynomial: in time c (M+1)e(∣w∣+1)dc\,(M+1)^e(|w|+1)^d, where MM is the largest number of the word. NP-hard: NPHardInNPHardIn of lax-496464; strongly NP-hard: NP-hard on the words whose numbers are at most c (length+1)dc\,(\text{length}+1)^d. In P (pseudo-polynomial) for every fixed value of κ\kappa; FPT, W[t]-hard (strongly: on such words), para-NP-hard: NP-hard for one fixed value.

    Running times. An algorithm can be stated with its exact running time, a function TT of the instance (of nn, mm, pmax⁡p_{\max}, the total weight, …): one program halts, writing the answer for the instance and the threshold, within c (T(x)+1)c\,(T(x)+1) instructions on the word of every instance xx, at every word length ℓ\ell with (∣w∣+M+2)c≤2ℓ(|w| + M + 2)^c \le 2^\ell, where ∣w∣|w| is the length of the word and MM its largest number — words of O(log⁡)O(\log) bits, as on the word RAM of the literature. Deciding, approximating, approximating with random bits and approximation schemes each have such a form; a submitted algorithm is a program with a proof of one of them. Deciding can also be stated without the constant: one program halts with the answer within exactly T(x,D)T(x, D) instructions, a function of the instance and the threshold, at the same word lengths.

    Randomized deciding. The program reads, after the word, at most c (T(x)+1)c\,(T(x)+1) random bits and halts within c (T(x)+1)c\,(T(x)+1) instructions on every choice of them. With bounded error its answer is right for at least two thirds of the choices. With one-sided error it never accepts a no-instance and accepts a yes-instance for at least half of the choices. With zero error (Las Vegas) it is always right and the bound c (T(x)+1)c\,(T(x)+1) holds for the number of instructions averaged over the choices. Repetition turns any of these into error 2−k2^{-k} at kk times the cost, so the constants 2/32/3 and 1/21/2 are not essential.

    Approximation. A ratio is a function ρ\rho of the instance into the reals. A ρ\rho-approximation is a polynomial-time program that on the word of an instance with a feasible schedule writes the word of a feasible schedule costing at most ρ\rho times every feasible schedule; for a maximization problem, whose cost is the negative of its value, the value is at least ρ\rho times every value. A randomized one reads polynomially many random bits; every choice gives a feasible schedule, the average cost is within the ratio, and the running time is polynomial in the worst case or, for an expected-time algorithm, on average over the bits. Approximations may be restricted to the instances of a set. PTAS, EPTAS and FPTAS are as usual; inapproximability below ρ\rho unless P = NP says that if P ≠ NP no ρ′\rho'-approximation exists for a constant ρ′<ρ\rho' < \rho. An *additive* δ\delta-approximation writes a feasible schedule costing at most every feasible cost plus δ\delta, a function of the instance; an additive scheme does so with ε δ\varepsilon\,\delta for every ε>0\varepsilon > 0, in polynomial time for each fixed ε\varepsilon. A parameterized approximation scheme for a parameter κ\kappa is one program that writes a (1+a/b)(1 + a/b)-approximate schedule from the word of an instance followed by a,ba, b, in time f(κ+b/a) (∣w∣+1)df(\kappa + b/a)\,(|w|+1)^d.

    Running times and word size. A running time, upper or lower, is stated with short words, ℓ≥clog⁡2(∣u∣+M+2)\ell \ge c \log_2(|u| + M + 2); the classes keep the long words of the registered notions and are reached from running times through the transfer theorems. A lower bound is stated for the time plus the length of the shortest word of the instance.

    Wide words. An algorithm whose running time TT exceeds every polynomial may need words that hold the address of every step, c (T(x)+1)≤2ℓc\,(T(x)+1) \le 2^\ell besides the short words above; this is the standard assumption for such algorithms, whose tables are as large as their running times. Deciding within O(T)O(T) with wide words asks the program to work only at those word lengths.

    Restrictions. A result may hold on the instances satisfying a predicate φ\varphi only: it is then a result on the problem restricted to them, read with the same words.

    Kept weight. A problem that minimizes the weight of the jobs it rejects (late, or not just in time) is read with the same instances, schedules and costs when a source maximizes the weight it keeps. The kept weight of a schedule is the total weight WW of the instance minus its cost. A ρ\rho-approximation of the kept weight, for ρ≤1\rho \le 1, writes a feasible schedule that keeps at least ρ\rho times the weight of every feasible schedule; schemes keep 1−a/b1 - a/b times it. An online algorithm is ρ\rho-competitive for the kept weight, ρ≥1\rho \ge 1, if every feasible schedule keeps at most ρ\rho times what the algorithm keeps plus a constant, the convention of the sources on throughput.

    Kernels. A kernelization for a parameter is a polynomial-time map on the words of instances that keeps the answer and whose output has size (bit length) and parameter at most g(κ)g(\kappa) for a computable gg; a polynomial kernel has gg polynomial.

    The exponential time hypothesis. A formula is written as the number nn of variables followed, for every clause, by its length and its literals, the literal of variable vv being 2v+12v+1 if positive and 2v2v if negative. ETH: for some q>0q > 0 no program decides the satisfiability of formulas whose clauses have three literals over variables below nn within c 2⌊n/q⌋(∣w∣+1)cc\,2^{\lfloor n/q \rfloor}(|w|+1)^c instructions, at the word lengths above. A function ff is o(g)o(g) if for every rational ε>0\varepsilon > 0, eventually f(k)≤ε g(k)f(k) \le \varepsilon\, g(k).

    Online. A deterministic algorithm is ρ\rho-competitive if it is non-anticipative for the revelation and, for some additive constant, its cost is at most ρ\rho times every feasible cost plus that constant; a randomized one is a finite distribution over non-anticipative algorithms. A lower bound ρ\rho says that no algorithm is ρ′\rho'-competitive for ρ′<ρ\rho' < \rho.

    Concept map
    25 concepts
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on ADescendants are omitted for concepts with more than 10 descendants.

    Lean source view on GitHub

    1import Lax434175.WordProblems
    2import Lax434175.Online
    3import Lax496464.WH_B4_Hierarchies
    4import Lax496464.WH_F3_NPHard
    5import Lax434930.PolynomialTime
    6import Lax434930.NondeterministicPolynomialTime
    7import Lax429075.CNF
    8import Mathlib.Analysis.SpecialFunctions.Log.Basic
    9import Mathlib.Analysis.SpecialFunctions.Pow.Real
    10
    11/-!
    12---
    13title: The kinds of results on scheduling problems
    14type: definition
    15---
    16A result on a scheduling problem is a statement about its decision version on
    17words, about algorithms that output schedules, or about online play. Such
    18statements depend on how instances and schedules are written, so they are made
    19relative to a reading of the problem: which words encode which instance, which
    20words write which schedule, and what an online scheduler sees at each time. A
    21reading of a family gives one for every specification. The results of the
    22literature are claims about the standard binary readings; here every result
    23is a proposition about a given reading.
    24
    25Fix a reading and parameters κ\kappa: functions of the instance and the
    26threshold into the naturals (most depend on the instance only; some, such as the
    27pathwidth of time windows that end at the threshold, depend on both). The decision version on words: a word of an instance, then the sign
    28and absolute value of an integral threshold DD, is a yes-instance if some
    29feasible schedule has cost at most DD. Running times are those of the word RAM
    30(lax-496464, lax-808846).
    31
    32**Exact algorithms and hardness.** *In P*: decided in time c (∣w∣+1)dc\,(|w|+1)^d in
    33the bit size ∣w∣|w|. *Pseudo-polynomial*: in time c (M+1)e(∣w∣+1)dc\,(M+1)^e(|w|+1)^d, where
    34MM is the largest number of the word. *NP-hard*: `NPHardIn` of lax-496464;
    35*strongly NP-hard*: NP-hard on the words whose numbers are at most
    36c (length+1)dc\,(\text{length}+1)^d. *In P (pseudo-polynomial) for every fixed value* of
    37κ\kappa; *FPT*, *W[t]-hard* (strongly: on such words), *para-NP-hard*: NP-hard
    38for one fixed value.
    39
    40**Running times.** An algorithm can be stated with its exact running time, a
    41function TT of the instance (of nn, mm, pmax⁡p_{\max}, the total weight, …): one
    42program halts, writing the answer for the instance and the threshold, within
    43c (T(x)+1)c\,(T(x)+1) instructions on the word of every instance xx, at every word length ℓ\ell with (∣w∣+M+2)c≤2ℓ(|w| + M + 2)^c \le 2^\ell, where ∣w∣|w| is
    44the length of the word and MM its largest number — words of O(log⁡)O(\log) bits, as
    45on the word RAM of the literature. Deciding, approximating, approximating with
    46random bits and approximation schemes each have such a form; a submitted
    47algorithm is a program with a proof of one of them. Deciding can also be stated
    48without the constant: one program halts with the answer within exactly T(x,D)T(x, D)
    49instructions, a function of the instance and the threshold, at the same word lengths.
    50
    51**Randomized deciding.** The program reads, after the word, at most c (T(x)+1)c\,(T(x)+1)
    52random bits and halts within c (T(x)+1)c\,(T(x)+1) instructions on every choice of them.
    53With *bounded error* its answer is right for at least two thirds of the choices.
    54With *one-sided error* it never accepts a no-instance and accepts a yes-instance
    55for at least half of the choices. With *zero error* (Las Vegas) it is always
    56right and the bound c (T(x)+1)c\,(T(x)+1) holds for the number of instructions averaged
    57over the choices. Repetition turns any of these into error 2−k2^{-k} at kk times
    58the cost, so the constants 2/32/3 and 1/21/2 are not essential.
    59
    60**Approximation.** A ratio is a function ρ\rho of the instance into the reals.
    61A ρ\rho-approximation is a polynomial-time program that on the word of an
    62instance with a feasible schedule writes the word of a feasible schedule
    63costing at most ρ\rho times every feasible schedule; for a maximization
    64problem, whose cost is the negative of its value, the value is at least ρ\rho
    65times every value. A randomized one reads polynomially many random bits; every
    66choice gives a feasible schedule, the average cost is within the ratio, and
    67the running time is polynomial in the worst case or, for an expected-time
    68algorithm, on average over the bits. Approximations may be restricted to the
    69instances of a set. PTAS, EPTAS and FPTAS are as usual; inapproximability below
    70ρ\rho unless P = NP says that if P ≠ NP no ρ′\rho'-approximation exists for a
    71constant ρ′<ρ\rho' < \rho. An *additive* δ\delta-approximation writes a feasible
    72schedule costing at most every feasible cost plus δ\delta, a function of the
    73instance; an additive scheme does so with ε δ\varepsilon\,\delta for every
    74ε>0\varepsilon > 0, in polynomial time for each fixed ε\varepsilon. A
    75*parameterized approximation scheme* for a parameter κ\kappa is one program that
    76writes a (1+a/b)(1 + a/b)-approximate schedule from the word of an instance followed
    77by a,ba, b, in time f(κ+b/a) (∣w∣+1)df(\kappa + b/a)\,(|w|+1)^d.
    78
    79**Running times and word size.** A running time, upper or lower, is stated with
    80short words, ℓ≥clog⁡2(∣u∣+M+2)\ell \ge c \log_2(|u| + M + 2); the classes keep the long words
    81of the registered notions and are reached from running times through the
    82transfer theorems. A lower bound is stated for the time plus the length of the
    83shortest word of the instance.
    84
    85**Wide words.** An algorithm whose running time TT exceeds every polynomial may
    86need words that hold the address of every step, c (T(x)+1)≤2ℓc\,(T(x)+1) \le 2^\ell besides
    87the short words above; this is the standard assumption for such algorithms, whose
    88tables are as large as their running times. Deciding within O(T)O(T) with wide words
    89asks the program to work only at those word lengths.
    90
    91**Restrictions.** A result may hold on the instances satisfying a predicate
    92φ\varphi only: it is then a result on the problem restricted to them, read with the
    93same words.
    94
    95**Kept weight.** A problem that minimizes the weight of the jobs it rejects
    96(late, or not just in time) is read with the same instances, schedules and
    97costs when a source maximizes the weight it keeps. The kept weight of a
    98schedule is the total weight WW of the instance minus its cost. A
    99ρ\rho-approximation of the kept weight, for ρ≤1\rho \le 1, writes a feasible
    100schedule that keeps at least ρ\rho times the weight of every feasible
    101schedule; schemes keep 1−a/b1 - a/b times it. An online algorithm is
    102ρ\rho-competitive for the kept weight, ρ≥1\rho \ge 1, if every feasible schedule
    103keeps at most ρ\rho times what the algorithm keeps plus a constant, the
    104convention of the sources on throughput.
    105
    106**Kernels.** A kernelization for a parameter is a polynomial-time map on the
    107words of instances that keeps the answer and whose output has size (bit length)
    108and parameter at most g(κ)g(\kappa) for a computable gg; a polynomial kernel has
    109gg polynomial.
    110
    111**The exponential time hypothesis.** A formula is written as the number nn of
    112variables followed, for every clause, by its length and its literals, the
    113literal of variable vv being 2v+12v+1 if positive and 2v2v if negative. ETH: for
    114some q>0q > 0 no program decides the satisfiability of formulas whose clauses have
    115three literals over variables below nn within c 2⌊n/q⌋(∣w∣+1)cc\,2^{\lfloor n/q \rfloor}(|w|+1)^c
    116instructions, at the word lengths above. A function ff is o(g)o(g) if for every
    117rational ε>0\varepsilon > 0, eventually f(k)≤ε g(k)f(k) \le \varepsilon\, g(k).
    118
    119**Online.** A deterministic algorithm is ρ\rho-competitive if it is
    120non-anticipative for the revelation and, for some additive constant, its cost is
    121at most ρ\rho times every feasible cost plus that constant; a randomized one is
    122a finite distribution over non-anticipative algorithms. A lower bound ρ\rho
    123says that no algorithm is ρ′\rho'-competitive for ρ′<ρ\rho' < \rho.
    124-/
    125
    126namespace Lax434175.Results
    127open Lax434175.Problems Lax434175.Kernels Lax434175.Assembly Lax434175.Parameters
    128open Lax434175.WordProblems Lax434175.Online
    129open Lax808846.Ram Lax759944.BinaryWordEncoding
    130open Lax496464.WH_A1_FptTime Lax496464.WH_A2_FptReductions Lax496464.WH_B4_Hierarchies
    131
    132/-- Parameterized problems on words. -/
    133abbrev WP := Lax888481.ParameterizedComplexity.Problem
    134
    135/-- A reading of a problem: words of instances, schedules from words, and what
    136an online scheduler sees. -/
    137structure PReading (P : Problem) where
    138 /-- The word encodes the instance. -/
    139 Encodes : List ℕ → P.Inst → Prop
    140 /-- The word writes the schedule of the instance. -/
    141 Decodes : (x : P.Inst) → List ℕ → P.Sched x → Prop
    142 /-- What is revealed over time. -/
    143 reveal : Revelation P
    144
    145/-- A reading of a family. -/
    146structure Reading {K : Kernel} (F : Family K) where
    147 /-- The word encodes the instance. -/
    148 Encodes : (s : Spec F) → List ℕ → Inst F s → Prop
    149 /-- The word writes the schedule of the instance. -/
    150 Decodes : (s : Spec F) → (x : Inst F s) → List ℕ → (problem F s).Sched x → Prop
    151 /-- What is revealed over time. -/
    152 reveal : (s : Spec F) → Revelation (problem F s)
    153
    154/-- The reading of the problem of one specification. -/
    155def Reading.at {K : Kernel} {F : Family K} (R : Reading F) (s : Spec F) :
    156 PReading (problem F s) :=
    157 ⟨R.Encodes s, R.Decodes s, R.reveal s⟩
    158
    159/-- The reading of a problem on the instances satisfying `φ`: the same words. -/
    160def PReading.restrict {P : Problem} (R : PReading P) (φ : P.Inst → Prop) :
    161 PReading (P.restrict φ) where
    162 Encodes w x := R.Encodes w x.1
    163 Decodes x w σ := R.Decodes x.1 w σ
    164 reveal := ⟨fun x y t => R.reveal.same x.1 y.1 t, fun x y σ τ t => R.reveal.agree x.1 y.1 σ τ t⟩
    165
    166/-- A parameter of the decision version: a function of the instance and the
    167threshold. -/
    168abbrev TParameter (P : Problem) := P.Inst → ℤ → ℕ
    169
    170/-- A parameter of the instance, ignoring the threshold. -/
    171def lift {P : Problem} (κ : Parameter P) : TParameter P := fun x _ => κ x
    172
    173/-- The sum of two parameters. -/
    174def tplus {P : Problem} (κ κ' : TParameter P) : TParameter P := fun x D => κ x D + κ' x D
    175
    176variable {P : Problem} (R : PReading P)
    177
    178-- Words
    179
    180/-- The largest number of a word. -/
    181def maxEntry (w : List ℕ) : ℕ := w.foldr max 0
    182
    183/-- The word presents the instance with the threshold. -/
    184def EncodesDecision (w : List ℕ) (x : P.Inst) (D : ℤ) : Prop :=
    185 ∃ y, w = y ++ [if D < 0 then 1 else 0, D.natAbs] ∧ R.Encodes y x
    186
    187open Classical in
    188/-- The decision version with a parameter, as a parameterized problem on words. -/
    189noncomputable def parameterized (κ : TParameter P) : WP where
    190 Domain := {w | ∃ x D, EncodesDecision R w x D}
    191 Yes w := ∃ x D, EncodesDecision R w x D ∧ P.Decides x D
    192 param w := if h : ∃ x D, EncodesDecision R w x D then κ h.choose h.choose_spec.choose else 0
    193
    194/-- The decision version on words. -/
    195noncomputable def decision : WP := parameterized R fun _ => 0
    196
    197open Classical in
    198/-- The answer of a word, `[1]` or `[0]`. -/
    199noncomputable def answer (Q : WP) (w : List ℕ) : List ℕ := if Q.Yes w then [1] else [0]
    200
    201/-- The problem on fewer words. -/
    202def restrict (Q : WP) (D : Set (List ℕ)) : WP where
    203 Domain := Q.Domain ∩ D
    204 Yes := Q.Yes
    205 param := Q.param
    206
    207/-- The words whose numbers are polynomial in their length. -/
    208def Small (c d : ℕ) : Set (List ℕ) := {w | ∀ v ∈ w, v ≤ c * (w.length + 1) ^ d}
    209
    210/-- The words of instances with parameter at most `k`. -/
    211def Upto (κ : TParameter P) (k : ℕ) : Set (List ℕ) :=
    212 {w | ∃ x D, EncodesDecision R w x D ∧ κ x D ≤ k}
    213
    214-- Exact algorithms and hardness
    215
    216/-- Decided in polynomial time. -/
    217def PolyDecides (Q : WP) : Prop := PolyTimeOn Q.Domain (answer Q)
    218
    219/-- Decided in pseudo-polynomial time. -/
    220def PseudoPolyDecides (Q : WP) : Prop :=
    221 ∃ (p : Program) (c e d : ℕ),
    222 ComputesInFptTime p Q.Domain maxEntry (answer Q) (fun k => c * (k + 1) ^ e) d
    223
    224/-- The problem is in P. -/
    225def InP : Prop := PolyDecides (decision R)
    226
    227/-- The problem is solvable in pseudo-polynomial time. -/
    228def PseudoPoly : Prop := PseudoPolyDecides (decision R)
    229
    230/-- The problem is NP-hard. -/
    231def NPHard : Prop := Lax496464.WH_F3_NPHard.NPHardIn (decision R)
    232
    233/-- The problem is strongly NP-hard. -/
    234def StronglyNPHard : Prop :=
    235 ∃ c d, Lax496464.WH_F3_NPHard.NPHardIn (restrict (decision R) (Small c d))
    236
    237/-- In P for every fixed value of the parameter. -/
    238def InPFixed (κ : TParameter P) : Prop :=
    239 ∀ k, PolyDecides (restrict (decision R) (Upto R κ k))
    240
    241/-- Pseudo-polynomial for every fixed value of the parameter. -/
    242def PseudoPolyFixed (κ : TParameter P) : Prop :=
    243 ∀ k, PseudoPolyDecides (restrict (decision R) (Upto R κ k))
    244
    245/-- Fixed-parameter tractable. -/
    246def IsFPT (κ : TParameter P) : Prop := parameterized R κ ∈ FPT
    247
    248/-- W[t]-hard. -/
    249def WHard (t : ℕ) (κ : TParameter P) : Prop := Hard (W t) (parameterized R κ)
    250
    251/-- Strongly W[t]-hard: W[t]-hard on the words whose numbers are polynomial in
    252their length. -/
    253def StronglyWHard (t : ℕ) (κ : TParameter P) : Prop :=
    254 ∃ c d, Hard (W t) (restrict (parameterized R κ) (Small c d))
    255
    256/-- Para-NP-hard: NP-hard for one fixed value of the parameter. -/
    257def ParaNPHard (κ : TParameter P) : Prop :=
    258 ∃ k, Lax496464.WH_F3_NPHard.NPHardIn (restrict (decision R) (Upto R κ k))
    259
    260/-- Strongly NP-hard for one fixed value of the parameter. -/
    261def StronglyParaNPHard (κ : TParameter P) : Prop :=
    262 ∃ k c d, Lax496464.WH_F3_NPHard.NPHardIn
    263 (restrict (decision R) (Upto R κ k ∩ Small c d))
    264
    265-- Approximation
    266
    267open Classical in
    268/-- The length of the shortest word of the instance, `0` if it has none. Lower
    269bounds on running times are stated for a time plus this length, so that they
    270cannot hold just because the input cannot be read. -/
    271noncomputable def inputSize (x : P.Inst) : ℕ := sInf {k | ∃ w, R.Encodes w x ∧ w.length = k}
    272
    273/-- The instance has a feasible schedule. -/
    274def Solvable (x : P.Inst) : Prop := ∃ τ, P.feasible x τ
    275
    276/-- `σ` is feasible and within the ratio of every feasible schedule. -/
    277def Within (ρ : ℝ) (x : P.Inst) (σ : P.Sched x) : Prop :=
    278 P.feasible x σ ∧ ∀ τ, P.feasible x τ → (P.cost x σ : ℝ) ≤ ρ * P.cost x τ
    279
    280/-- For a maximization problem: `σ` is feasible and its value is at least `ρ`
    281times every value. -/
    282def WithinMax (ρ : ℝ) (x : P.Inst) (σ : P.Sched x) : Prop :=
    283 P.feasible x σ ∧ ∀ τ, P.feasible x τ → ρ * (-(P.cost x τ : ℝ)) ≤ -(P.cost x σ : ℝ)
    284
    285/-- The output word, read on instance `x`, is a schedule within the ratio. -/
    286def Good (ρ : P.Inst → ℝ) (x : P.Inst) (out : List ℕ) : Prop :=
    287 ∃ σ, R.Decodes x out σ ∧ Within (ρ x) x σ
    288
    289/-- The same for a maximization problem. -/
    290def GoodMax (ρ : P.Inst → ℝ) (x : P.Inst) (out : List ℕ) : Prop :=
    291 ∃ σ, R.Decodes x out σ ∧ WithinMax (ρ x) x σ
    292
    293/-- All instances. -/
    294def univ : Set P.Inst := Set.univ
    295
    296/-- A constant ratio. -/
    297def const (ρ : ℝ) : P.Inst → ℝ := fun _ => ρ
    298
    299/-- A polynomial-time `ρ`-approximation on the instances of `S`. -/
    300def ApproxOn (S : Set P.Inst) (ρ : P.Inst → ℝ) : Prop :=
    301 ∃ A : List ℕ → List ℕ, PolyTimeOn {w | ∃ x ∈ S, R.Encodes w x} A ∧
    302 ∀ w x, R.Encodes w x → x ∈ S → Solvable x → Good R ρ x (A w)
    303
    304/-- A polynomial-time `ρ`-approximation. -/
    305def Approx (ρ : P.Inst → ℝ) : Prop := ApproxOn R univ ρ
    306
    307/-- A polynomial-time `ρ`-approximation for a maximization problem. -/
    308def ApproxMax (ρ : P.Inst → ℝ) : Prop :=
    309 ∃ A : List ℕ → List ℕ, PolyTimeOn {w | ∃ x, R.Encodes w x} A ∧
    310 ∀ w x, R.Encodes w x → Solvable x → GoodMax R ρ x (A w)
    311
    312/-- A polynomial-time `ρ`-approximation for every fixed value of the parameter. -/
    313def ApproxFixed (κ : Parameter P) (ρ : P.Inst → ℝ) : Prop :=
    314 ∀ k, ApproxOn R {x | κ x ≤ k} ρ
    315
    316/-- The random bits `r` as a word. -/
    317def bits {L : ℕ} (r : Fin L → Bool) : List ℕ := List.ofFn fun i => if r i then 1 else 0
    318
    319/-- Every choice of the random bits gives a feasible schedule, and the average
    320cost is within the ratio. -/
    321def GoodOnAverage {L : ℕ} (ρ : ℝ) (x : P.Inst) (out : (Fin L → Bool) → List ℕ) : Prop :=
    322 ∃ σ : (Fin L → Bool) → P.Sched x,
    323 (∀ r, R.Decodes x (out r) (σ r) ∧ P.feasible x (σ r)) ∧
    324 ∀ τ, P.feasible x τ → (∑ r, (P.cost x (σ r) : ℝ)) / 2 ^ L ≤ ρ * P.cost x τ
    325
    326/-- A randomized polynomial-time `ρ`-approximation: it reads `L(|w|)` random
    327bits, with `L` polynomial, and runs in polynomial time on every choice. -/
    328def RandomApprox (ρ : P.Inst → ℝ) : Prop :=
    329 ∃ (A : List ℕ → List ℕ) (L : ℕ → ℕ) (c e : ℕ), (∀ n, L n ≤ c * (n + 1) ^ e) ∧
    330 PolyTimeOn {u | ∃ w x, R.Encodes w x ∧ ∃ r : Fin (L (bitSize w)) → Bool, u = w ++ bits r} A ∧
    331 ∀ w x, R.Encodes w x → Solvable x →
    332 GoodOnAverage R (ρ x) x fun r : Fin (L (bitSize w)) → Bool => A (w ++ bits r)
    333
    334/-- The word lengths a program may use on input `u`: `c` times the logarithm of
    335the length plus the largest number. -/
    336def WordOk (c : ℕ) (u : List ℕ) (ℓ : ℕ) : Prop := (u.length + maxEntry u + 2) ^ c ≤ 2 ^ ℓ
    337
    338/-- A randomized `ρ`-approximation in expected polynomial time: averaged over
    339the random bits, the number of instructions is at most `c (|w|+1)^c`. -/
    340def RandomApproxExpected (ρ : P.Inst → ℝ) : Prop :=
    341 ∃ (p : Program) (c : ℕ) (L : ℕ → ℕ), (∀ n, L n ≤ c * (n + 1) ^ c) ∧
    342 ∀ w x, R.Encodes w x → Solvable x →
    343 ∃ out : (Fin (L w.length) → Bool) → List ℕ, GoodOnAverage R (ρ x) x out ∧
    344 ∀ ℓ, (∀ r : Fin (L w.length) → Bool, WordOk c (w ++ bits r) ℓ) →
    345 ∃ t : (Fin (L w.length) → Bool) → ℕ,
    346 (∀ r, RunsTo ℓ p ((w ++ bits r).length :: (w ++ bits r)) (out r) (t r)) ∧
    347 (∑ r, (t r : ℝ)) / 2 ^ L w.length ≤ c * (w.length + 1 : ℝ) ^ c
    348
    349/-- A polynomial-time approximation scheme. -/
    350def PTAS : Prop := ∀ ε : ℚ, 0 < ε → Approx R (const (1 + ε))
    351
    352/-- A PTAS for a maximization problem: value at least `1 - ε` times every
    353value. -/
    354def PTASMax : Prop := ∀ ε : ℚ, 0 < ε → ε < 1 → ApproxMax R (const (1 - ε))
    355
    356/-- A PTAS for every fixed value of the parameter. -/
    357def PTASFixed (κ : Parameter P) : Prop :=
    358 ∀ k (ε : ℚ), 0 < ε → ApproxOn R {x | κ x ≤ k} (const (1 + ε))
    359
    360/-- The words of instances followed by a precision `a / b`. -/
    361def WordsEps : Set (List ℕ) :=
    362 {u | ∃ w x, R.Encodes w x ∧ ∃ a b, 0 < a ∧ 0 < b ∧ u = w ++ [a, b]}
    363
    364/-- One program writes a `(1 + a / b)`-approximate schedule from the word of an
    365instance followed by `a, b`. -/
    366def Scheme (A : List ℕ → List ℕ) : Prop :=
    367 ∀ w x (a b : ℕ), R.Encodes w x → 0 < a → 0 < b → Solvable x →
    368 Good R (const (1 + (a : ℝ) / b)) x (A (w ++ [a, b]))
    369
    370/-- An efficient PTAS: time `f(b/a) · (|w|+1)^d`. -/
    371def EPTAS : Prop :=
    372 ∃ A, Scheme R A ∧ FptTimeOn (WordsEps R) (fun u => u.getLastD 0 / u.dropLast.getLastD 1 + 1) A
    373
    374/-- A fully polynomial-time approximation scheme: time polynomial in `|w|` and
    375`b/a`. -/
    376def FPTAS : Prop :=
    377 ∃ A, Scheme R A ∧ ∃ (p : Program) (c e d : ℕ), ComputesInFptTime p (WordsEps R)
    378 (fun u => u.getLastD 0 / u.dropLast.getLastD 1 + 1) A (fun k => c * (k + 1) ^ e) d
    379
    380/-- P ≠ NP. -/
    381def PneNP : Prop :=
    382 Lax434930.PolynomialTime.P ≠ Lax434930.NondeterministicPolynomialTime.NP
    383
    384/-- No `ρ'`-approximation for a constant `ρ' < ρ` on the instances of `S`,
    385unless P = NP. -/
    386def NoApproxBelowOn (S : Set P.Inst) (ρ : ℝ) : Prop :=
    387 PneNP → ∀ ρ' : ℝ, ρ' < ρ → ¬ ApproxOn R S (const ρ')
    388
    389/-- No `ρ'`-approximation for a constant `ρ' < ρ`, unless P = NP. -/
    390def NoApproxBelow (ρ : ℝ) : Prop := NoApproxBelowOn R univ ρ
    391
    392/-- No PTAS unless P = NP (the consequence of APX-hardness). -/
    393def NoPTAS : Prop := PneNP → ¬ PTAS R
    394
    395/-- `σ` is feasible and costs at most every feasible cost plus `δ`. -/
    396def WithinAdd (δ : ℝ) (x : P.Inst) (σ : P.Sched x) : Prop :=
    397 P.feasible x σ ∧ ∀ τ, P.feasible x τ → (P.cost x σ : ℝ) ≤ P.cost x τ + δ
    398
    399/-- The output word, read on instance `x`, is a schedule within the additive error. -/
    400def GoodAdd (δ : P.Inst → ℝ) (x : P.Inst) (out : List ℕ) : Prop :=
    401 ∃ σ, R.Decodes x out σ ∧ WithinAdd (δ x) x σ
    402
    403/-- A polynomial-time approximation with additive error `δ`. -/
    404def ApproxAdd (δ : P.Inst → ℝ) : Prop :=
    405 ∃ A : List ℕ → List ℕ, PolyTimeOn {w | ∃ x, R.Encodes w x} A ∧
    406 ∀ w x, R.Encodes w x → Solvable x → GoodAdd R δ x (A w)
    407
    408/-- An additive approximation scheme: additive error `ε δ` for every `ε > 0`, in polynomial
    409time for each fixed `ε`. -/
    410def AddScheme (δ : P.Inst → ℝ) : Prop := ∀ ε : ℚ, 0 < ε → ApproxAdd R fun x => (ε : ℝ) * δ x
    411
    412open Classical in
    413/-- The parameter of the instance a word followed by a precision writes, plus the inverse
    414precision `b / a`. -/
    415noncomputable def paramEps (κ : Parameter P) (u : List ℕ) : ℕ :=
    416 (if h : ∃ x, R.Encodes (u.dropLast.dropLast) x then κ h.choose else 0) +
    417 u.getLastD 0 / u.dropLast.getLastD 1 + 1
    418
    419/-- A parameterized approximation scheme: time `f(κ + b/a) · (|w|+1)^d`. -/
    420def ParamScheme (κ : Parameter P) : Prop :=
    421 ∃ A, Scheme R A ∧ FptTimeOn (WordsEps R) (paramEps R κ) A
    422
    423/-- A kernelization: a polynomial-time map on the words of instances with a threshold that
    424keeps the answer and the words, and whose output has size and parameter at most `g κ`. -/
    425def KernelWithin (κ : TParameter P) (g : ℕ → ℕ) : Prop :=
    426 ∃ K : List ℕ → List ℕ, PolyTimeOn (parameterized R κ).Domain K ∧
    427 ∀ w ∈ (parameterized R κ).Domain, K w ∈ (parameterized R κ).Domain ∧
    428 ((parameterized R κ).Yes w ↔ (parameterized R κ).Yes (K w)) ∧
    429 bitSize (K w) ≤ g ((parameterized R κ).param w) ∧
    430 (parameterized R κ).param (K w) ≤ g ((parameterized R κ).param w)
    431
    432/-- A kernel: a kernelization for a computable `g`. -/
    433def HasKernel (κ : TParameter P) : Prop := ∃ g, Computable g ∧ KernelWithin R κ g
    434
    435/-- A polynomial kernel: a kernelization with `g` polynomial. -/
    436def PolyKernel (κ : TParameter P) : Prop := ∃ c d : ℕ, KernelWithin R κ fun k => c * (k + 1) ^ d
    437
    438-- Kept weight
    439
    440/-- `σ` is feasible and keeps at least `ρ` times the weight every feasible
    441schedule keeps, the kept weight being the total weight minus the cost. -/
    442def WithinKept (total : Parameter P) (ρ : ℝ) (x : P.Inst) (σ : P.Sched x) : Prop :=
    443 P.feasible x σ ∧ ∀ τ, P.feasible x τ →
    444 ρ * ((total x : ℝ) - P.cost x τ) ≤ (total x : ℝ) - P.cost x σ
    445
    446/-- The output word, read on instance `x`, is a schedule within the ratio of
    447the kept weight. -/
    448def GoodKept (total : Parameter P) (ρ : P.Inst → ℝ) (x : P.Inst) (out : List ℕ) : Prop :=
    449 ∃ σ, R.Decodes x out σ ∧ WithinKept total (ρ x) x σ
    450
    451/-- A polynomial-time `ρ`-approximation of the kept weight, `ρ ≤ 1`. -/
    452def ApproxKept (total : Parameter P) (ρ : P.Inst → ℝ) : Prop :=
    453 ∃ A : List ℕ → List ℕ, PolyTimeOn {w | ∃ x, R.Encodes w x} A ∧
    454 ∀ w x, R.Encodes w x → Solvable x → GoodKept R total ρ x (A w)
    455
    456/-- One program keeps `1 - a / b` times the optimal kept weight, from the word
    457of an instance followed by `a, b` with `a < b`. -/
    458def SchemeKept (total : Parameter P) (A : List ℕ → List ℕ) : Prop :=
    459 ∀ w x (a b : ℕ), R.Encodes w x → 0 < a → a < b → Solvable x →
    460 GoodKept R total (const (1 - (a : ℝ) / b)) x (A (w ++ [a, b]))
    461
    462/-- A PTAS for the kept weight. -/
    463def PTASKept (total : Parameter P) : Prop :=
    464 ∀ ε : ℚ, 0 < ε → ε < 1 → ApproxKept R total (const (1 - ε))
    465
    466/-- An efficient PTAS for the kept weight: time `f(b/a) · (|w|+1)^d`. -/
    467def EPTASKept (total : Parameter P) : Prop :=
    468 ∃ A, SchemeKept R total A ∧
    469 FptTimeOn (WordsEps R) (fun u => u.getLastD 0 / u.dropLast.getLastD 1 + 1) A
    470
    471/-- An FPTAS for the kept weight: time polynomial in `|w|` and `b/a`. -/
    472def FPTASKept (total : Parameter P) : Prop :=
    473 ∃ A, SchemeKept R total A ∧ ∃ (p : Program) (c e d : ℕ), ComputesInFptTime p (WordsEps R)
    474 (fun u => u.getLastD 0 / u.dropLast.getLastD 1 + 1) A (fun k => c * (k + 1) ^ e) d
    475
    476/-- A parameterized approximation scheme for the kept weight. -/
    477def ParamSchemeKept (total : Parameter P) (κ : Parameter P) : Prop :=
    478 ∃ A, SchemeKept R total A ∧ FptTimeOn (WordsEps R) (paramEps R κ) A
    479
    480/-- No `ρ'`-approximation of the kept weight for a constant `ρ' > ρ`, unless
    481P = NP. -/
    482def NoApproxKeptAbove (total : Parameter P) (ρ : ℝ) : Prop :=
    483 PneNP → ∀ ρ' : ℝ, ρ < ρ' → ¬ ApproxKept R total (const ρ')
    484
    485-- Running times
    486
    487open Classical in
    488/-- The answer for an instance and a threshold: `[1]` if some feasible schedule
    489costs at most the threshold, `[0]` otherwise. -/
    490noncomputable def verdict (x : P.Inst) (D : ℤ) : List ℕ := if P.Decides x D then [1] else [0]
    491
    492/-- One program decides the decision version within `O(T(x))` instructions: on
    493every word of an instance `x` with a threshold `D` it writes the answer for `x`
    494and `D`. -/
    495def DecidesWithin (T : P.Inst → ℕ) : Prop :=
    496 ∃ (p : Program) (c : ℕ), ∀ u x D, EncodesDecision R u x D →
    497 ∀ ℓ, WordOk c u ℓ → ∃ t ≤ c * (T x + 1),
    498 RunsTo ℓ p (u.length :: u) (verdict x D) t
    499
    500/-- One program decides the decision version within `T x D` instructions, with no
    501hidden constant: on every word of an instance `x` with a threshold `D` it writes the
    502answer within `T x D` steps of the word RAM. -/
    503def DecidesExact (T : P.Inst → ℤ → ℕ) : Prop :=
    504 ∃ (p : Program) (c : ℕ), ∀ u x D, EncodesDecision R u x D →
    505 ∀ ℓ, WordOk c u ℓ → ∃ t ≤ T x D, RunsTo ℓ p (u.length :: u) (verdict x D) t
    506
    507/-- One program decides the decision version within `O(T(x))` instructions with wide
    508words: on every word of an instance `x` with a threshold `D`, at every word length `ℓ` with
    509`WordOk c u ℓ` and `c (T(x) + 1) ≤ 2 ^ ℓ`, it writes the answer for `x` and `D` within
    510`c (T(x) + 1)` instructions. This is the standard assumption for algorithms whose running
    511time exceeds a polynomial: a word holds the address of every step. -/
    512def DecidesWithinWide (T : P.Inst → ℕ) : Prop :=
    513 ∃ (p : Program) (c : ℕ), ∀ u x D, EncodesDecision R u x D →
    514 ∀ ℓ, WordOk c u ℓ → c * (T x + 1) ≤ 2 ^ ℓ → ∃ t ≤ c * (T x + 1),
    515 RunsTo ℓ p (u.length :: u) (verdict x D) t
    516
    517open Classical in
    518/-- The choices of `L` random bits for which `out` writes the answer for `x` and `D`. -/
    519noncomputable def rightChoices {L : ℕ} (x : P.Inst) (D : ℤ) (out : (Fin L → Bool) → List ℕ) : ℕ :=
    520 (Finset.univ.filter fun r => out r = verdict x D).card
    521
    522/-- A randomized program decides the decision version with bounded error within
    523`O(T(x))` instructions: on the word of an instance `x` with a threshold `D`
    524followed by at most `O(T(x))` random bits, it halts within `O(T(x))`
    525instructions on every choice, and writes the answer for at least two thirds of
    526the choices. -/
    527def RandomDecidesWithin (T : P.Inst → ℕ) : Prop :=
    528 ∃ (p : Program) (c : ℕ) (L : ℕ → ℕ), ∀ u x D, EncodesDecision R u x D →
    529 L u.length ≤ c * (T x + 1) ∧
    530 ∃ out : (Fin (L u.length) → Bool) → List ℕ,
    531 2 * 2 ^ L u.length ≤ 3 * rightChoices x D out ∧
    532 ∀ r ℓ, WordOk c (u ++ bits r) ℓ → ∃ t ≤ c * (T x + 1),
    533 RunsTo ℓ p ((u ++ bits r).length :: (u ++ bits r)) (out r) t
    534
    535/-- The same with one-sided error: a no-instance is never accepted, and a
    536yes-instance is accepted for at least half of the choices. -/
    537def OneSidedDecidesWithin (T : P.Inst → ℕ) : Prop :=
    538 ∃ (p : Program) (c : ℕ) (L : ℕ → ℕ), ∀ u x D, EncodesDecision R u x D →
    539 L u.length ≤ c * (T x + 1) ∧
    540 ∃ out : (Fin (L u.length) → Bool) → List ℕ,
    541 (∀ r, out r = verdict x D ∨ out r = [0]) ∧
    542 2 ^ L u.length ≤ 2 * rightChoices x D out ∧
    543 ∀ r ℓ, WordOk c (u ++ bits r) ℓ → ∃ t ≤ c * (T x + 1),
    544 RunsTo ℓ p ((u ++ bits r).length :: (u ++ bits r)) (out r) t
    545
    546/-- The same with zero error (Las Vegas): the answer is always right, and the
    547number of instructions, averaged over the choices, is `O(T(x))`. -/
    548def ZeroErrorDecidesWithin (T : P.Inst → ℕ) : Prop :=
    549 ∃ (p : Program) (c : ℕ) (L : ℕ → ℕ), ∀ u x D, EncodesDecision R u x D →
    550 L u.length ≤ c * (T x + 1) ∧
    551 ∀ ℓ, (∀ r : Fin (L u.length) → Bool, WordOk c (u ++ bits r) ℓ) →
    552 ∃ t : (Fin (L u.length) → Bool) → ℕ,
    553 (∀ r, RunsTo ℓ p ((u ++ bits r).length :: (u ++ bits r)) (verdict x D) (t r)) ∧
    554 (∑ r, (t r : ℝ)) / 2 ^ L u.length ≤ c * ((T x : ℝ) + 1)
    555
    556/-- A `ρ`-approximation running within `O(T(x))` instructions. -/
    557def ApproxWithin (ρ : P.Inst → ℝ) (T : P.Inst → ℕ) : Prop :=
    558 ∃ (p : Program) (c : ℕ), ∀ u x, R.Encodes u x → Solvable x →
    559 ∀ ℓ, WordOk c u ℓ → ∃ out, ∃ t ≤ c * (T x + 1),
    560 RunsTo ℓ p (u.length :: u) out t ∧ Good R ρ x out
    561
    562/-- A randomized `ρ`-approximation running within `O(T(x))` instructions on
    563every choice of random bits and reading at most that many. -/
    564def RandomApproxWithin (ρ : P.Inst → ℝ) (T : P.Inst → ℕ) : Prop :=
    565 ∃ (p : Program) (c : ℕ) (L : ℕ → ℕ), ∀ u x, R.Encodes u x → Solvable x →
    566 L u.length ≤ c * (T x + 1) ∧
    567 ∃ out : (Fin (L u.length) → Bool) → List ℕ, GoodOnAverage R (ρ x) x out ∧
    568 ∀ r ℓ, WordOk c (u ++ bits r) ℓ → ∃ t ≤ c * (T x + 1),
    569 RunsTo ℓ p ((u ++ bits r).length :: (u ++ bits r)) (out r) t
    570
    571/-- An approximation scheme: one program reads the word of an instance and `a, b`
    572and writes a `(1 + a/b)`-approximate schedule within `O(T(a/b, x))`
    573instructions. -/
    574def SchemeWithin (T : ℚ → P.Inst → ℕ) : Prop :=
    575 ∃ (p : Program) (c : ℕ), ∀ u x (a b : ℕ), R.Encodes u x → 0 < a → 0 < b →
    576 Solvable x → ∀ ℓ, WordOk c (u ++ [a, b]) ℓ → ∃ out, ∃ t ≤ c * (T ((a : ℚ) / b) x + 1),
    577 RunsTo ℓ p ((u ++ [a, b]).length :: (u ++ [a, b])) out t ∧
    578 Good R (const (1 + (a : ℝ) / b)) x out
    579
    580/-- The same for a maximization problem: value at least `1 - a/b` times every
    581value, for `a < b`. -/
    582def SchemeMaxWithin (T : ℚ → P.Inst → ℕ) : Prop :=
    583 ∃ (p : Program) (c : ℕ), ∀ u x (a b : ℕ), R.Encodes u x → 0 < a → a < b →
    584 Solvable x → ∀ ℓ, WordOk c (u ++ [a, b]) ℓ → ∃ out, ∃ t ≤ c * (T ((a : ℚ) / b) x + 1),
    585 RunsTo ℓ p ((u ++ [a, b]).length :: (u ++ [a, b])) out t ∧
    586 GoodMax R (const (1 - (a : ℝ) / b)) x out
    587
    588-- The exponential time hypothesis
    589
    590/-- The word of a formula on `n` variables. -/
    591def formulaWord (n : ℕ) (Φ : Lax429075.CNF.Formula) : List ℕ :=
    592 n :: Φ.flatMap fun C => C.length :: C.map fun l => 2 * l.index + if l.positive then 1 else 0
    593
    594open Classical in
    595/-- The exponential time hypothesis: for some `q > 0`, no program decides 3-SAT
    596on `n` variables within `c · 2^⌊n/q⌋ · (|w|+1)^c` instructions. -/
    597def ETH : Prop :=
    598 ∃ q : ℕ, 0 < q ∧ ∀ (p : Program) (c : ℕ), ¬ ∀ (n : ℕ) (Φ : Lax429075.CNF.Formula),
    599 (∀ C ∈ Φ, C.length = 3 ∧ ∀ l ∈ C, l.index < n) →
    600 ∀ ℓ, WordOk c (formulaWord n Φ) ℓ →
    601 ∃ t ≤ c * 2 ^ (n / q) * ((formulaWord n Φ).length + 1) ^ c,
    602 RunsTo ℓ p ((formulaWord n Φ).length :: formulaWord n Φ)
    603 (if Lax429075.CNF.Satisfiable Φ then [1] else [0]) t
    604
    605/-- `f` is `o(g)`. -/
    606def LittleO (f g : ℕ → ℕ) : Prop :=
    607 ∀ ε : ℚ, 0 < ε → ∃ N, ∀ k ≥ N, (f k : ℚ) ≤ ε * g k
    608
    609-- Online
    610
    611/-- A deterministic algorithm with ratio `ρ` and additive constant `α`, over the
    612reals. -/
    613def CompetitiveR (A : Algorithm P) (ρ : P.Inst → ℝ) (α : ℝ) : Prop :=
    614 ∀ x, P.feasible x (A x) ∧ ∀ τ, P.feasible x τ →
    615 (P.cost x (A x) : ℝ) ≤ ρ x * P.cost x τ + α
    616
    617/-- Some non-anticipative deterministic algorithm is `ρ`-competitive. -/
    618def DetCompetitive (ρ : P.Inst → ℝ) : Prop :=
    619 ∃ A α, NonAnticipative R.reveal A ∧ CompetitiveR A ρ α
    620
    621/-- A distribution over non-anticipative algorithms is `ρ`-competitive. -/
    622def RandCompetitive (ρ : P.Inst → ℝ) : Prop :=
    623 ∃ (μ : Randomized R.reveal) (α : ℝ), ∀ x,
    624 (∀ a ∈ μ.algorithms, P.feasible x (a.2 x)) ∧
    625 ∀ τ, P.feasible x τ → (μ.cost x : ℝ) ≤ ρ x * P.cost x τ + α
    626
    627/-- No deterministic algorithm is `ρ'`-competitive for a constant `ρ' < ρ`. -/
    628def DetLowerBound (ρ : ℝ) : Prop := ∀ ρ' < ρ, ¬ DetCompetitive R (const ρ')
    629
    630/-- No randomized algorithm is `ρ'`-competitive for a constant `ρ' < ρ`. -/
    631def RandLowerBound (ρ : ℝ) : Prop := ∀ ρ' < ρ, ¬ RandCompetitive R (const ρ')
    632
    633/-- For some `c > 0`, no deterministic algorithm is `c f`-competitive. -/
    634def DetLowerBoundFn (f : P.Inst → ℝ) : Prop :=
    635 ∃ c : ℝ, 0 < c ∧ ¬ DetCompetitive R fun x => c * f x
    636
    637/-- For some `c > 0`, no randomized algorithm is `c f`-competitive. -/
    638def RandLowerBoundFn (f : P.Inst → ℝ) : Prop :=
    639 ∃ c : ℝ, 0 < c ∧ ¬ RandCompetitive R fun x => c * f x
    640
    641-- Online, kept weight
    642
    643/-- A deterministic algorithm with ratio `ρ ≥ 1` and additive constant `α` for
    644the kept weight: every feasible schedule keeps at most `ρ` times what the
    645algorithm keeps, plus `α`. -/
    646def CompetitiveKeptR (total : Parameter P) (A : Algorithm P) (ρ : P.Inst → ℝ) (α : ℝ) : Prop :=
    647 ∀ x, P.feasible x (A x) ∧ ∀ τ, P.feasible x τ →
    648 (total x : ℝ) - P.cost x τ ≤ ρ x * ((total x : ℝ) - P.cost x (A x)) + α
    649
    650/-- Some non-anticipative deterministic algorithm is `ρ`-competitive for the
    651kept weight. -/
    652def DetCompetitiveKept (total : Parameter P) (ρ : P.Inst → ℝ) : Prop :=
    653 ∃ A α, NonAnticipative R.reveal A ∧ CompetitiveKeptR total A ρ α
    654
    655/-- A distribution over non-anticipative algorithms is `ρ`-competitive for the
    656kept weight, in expectation. -/
    657def RandCompetitiveKept (total : Parameter P) (ρ : P.Inst → ℝ) : Prop :=
    658 ∃ (μ : Randomized R.reveal) (α : ℝ), ∀ x,
    659 (∀ a ∈ μ.algorithms, P.feasible x (a.2 x)) ∧
    660 ∀ τ, P.feasible x τ → (total x : ℝ) - P.cost x τ ≤ ρ x * ((total x : ℝ) - μ.cost x) + α
    661
    662/-- No deterministic algorithm is `ρ'`-competitive for the kept weight, for a
    663constant `ρ' < ρ`. -/
    664def DetLowerBoundKept (total : Parameter P) (ρ : ℝ) : Prop :=
    665 ∀ ρ' < ρ, ¬ DetCompetitiveKept R total (const ρ')
    666
    667/-- No randomized algorithm is `ρ'`-competitive for the kept weight, for a
    668constant `ρ' < ρ`. -/
    669def RandLowerBoundKept (total : Parameter P) (ρ : ℝ) : Prop :=
    670 ∀ ρ' < ρ, ¬ RandCompetitiveKept R total (const ρ')
    671
    672/-- For some `c > 0`, no deterministic algorithm is `c f`-competitive for the
    673kept weight. -/
    674def DetLowerBoundFnKept (total : Parameter P) (f : P.Inst → ℝ) : Prop :=
    675 ∃ c : ℝ, 0 < c ∧ ¬ DetCompetitiveKept R total fun x => c * f x
    676
    677/-- For some `c > 0`, no randomized algorithm is `c f`-competitive for the kept
    678weight. -/
    679def RandLowerBoundFnKept (total : Parameter P) (f : P.Inst → ℝ) : Prop :=
    680 ∃ c : ℝ, 0 < c ∧ ¬ RandCompetitiveKept R total fun x => c * f x
    681
    682end Lax434175.Results
    683

    Discussion

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

    Loading discussion…