← Visual paper

HardnessBilevel/Hardness/SSI.lean

d1032f4c70da9b037605c2f444ce2450900e5a76 · GitHub

  1. import Mathlib
  2. /-!
  3. # The subset-sum interval problem (blueprint §4.I.1, paper Problem 3.1)
  4. An SSI instance consists of natural numbers `q₀, …, q_{k-1}`, `R` and `r`. It is a YES-instance iff
  5. there is an integer `S` with `R ≤ S < R + 2^r` (i.e. `R ≤ S ≤ R + 2^r - 1`) that is *not* a subset
  6. sum of the `q i`.
  7. Positivity of `q i`, `R`, `r` and `r ≤ k` are not used by the mathematics of Lemma 3.3 and are not
  8. part of the structure (a superset of the paper's instances; harmless for hardness, blueprint E-24).
  9. -/
  10. namespace Bilevel
  11. /-- An instance of the subset-sum interval problem (paper Problem 3.1). -/
  12. structure SSI where
  13. /-- number of items -/
  14. k : ℕ
  15. /-- the item sizes `q₀, …, q_{k-1}` -/
  16. q : Fin k → ℕ
  17. /-- left end of the target interval -/
  18. R : ℕ
  19. /-- the interval `[R, R + 2^r - 1]` has length `2^r` -/
  20. r : ℕ
  21. /-- `S` is a subset sum of the items of `I`. -/
  22. def SSI.subsetSum (I : SSI) (S : ℕ) : Prop := ∃ T : Finset (Fin I.k), ∑ i ∈ T, I.q i = S
  23. /-- YES-instance: some `S` with `R ≤ S ≤ R + 2^r - 1` is not a subset sum. -/
  24. def SSI.Yes (I : SSI) : Prop := ∃ S, I.R ≤ S ∧ S < I.R + 2 ^ I.r ∧ ¬ I.subsetSum S
  25. end Bilevel