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

Binary encodings and the two languages

Lax391470.BinaryEncoding · concepts/Lax391470/BinaryEncoding.lean · lax-391470

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

    Scheduling instances and instances of the auxiliary problem as binary words, the representation against which classical complexity measures running time, and the two decision problems of this submission as languages of such words.

    A natural number is written as its binary digits preceded by their number in unary, which makes the code self-delimiting; an integer is a sign bit followed by its absolute value. A scheduling instance is the number of jobs followed by the release time, the deadline and the processing time of every job in turn. An instance of the auxiliary problem is the number of ordinary jobs, the number of connected pairs, then for every ordinary job its release time, its deadline and one bit telling whether it is long, then for every connected pair its four deadlines.

    For fixed job lengths pp and qq, the language of scheduling on the lengths {p,q}\{p, q\} consists of the encodings of the instances on those lengths that have a feasible schedule, and the language AUX(p,q)\mathrm{AUX}(p, q) consists of the encodings of the ordered instances of the auxiliary problem that have a solution at those lengths.

    Concept map
    4 concepts; 3 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Lax391470.AuxiliaryProblem
    2import Lax434930.PolynomialTime
    3import Mathlib.Data.List.FinRange
    4import Mathlib.Data.Nat.Bits
    5
    6/-!
    7---
    8title: Binary encodings and the two languages
    9type: definition
    10---
    11Scheduling instances and instances of the auxiliary problem as binary words, the
    12representation against which classical complexity measures running time, and the two
    13decision problems of this submission as languages of such words.
    14
    15A natural number is written as its binary digits preceded by their number in unary,
    16which makes the code self-delimiting; an integer is a sign bit followed by its absolute
    17value. A scheduling instance is the number of jobs followed by the release time, the
    18deadline and the processing time of every job in turn. An instance of the auxiliary
    19problem is the number of ordinary jobs, the number of connected pairs, then for every
    20ordinary job its release time, its deadline and one bit telling whether it is long, then
    21for every connected pair its four deadlines.
    22
    23For fixed job lengths pp and qq, the language of *scheduling on the lengths
    24{p,q}\{p, q\}* consists of the encodings of the instances on those lengths that have a
    25feasible schedule, and the language AUX(p,q)\mathrm{AUX}(p, q) consists of the encodings of the
    26ordered instances of the auxiliary problem that have a solution at those lengths.
    27
    28# Formalization notes
    29
    30Numbers are written in binary, the usual convention, under which NP-hardness is the
    31usual claim. Hardness under a unary encoding of the scheduling instance would be the
    32stronger claim, strong NP-hardness: the reduction would then have to produce numbers
    33bounded by a polynomial in its input, since a unary word must stay polynomially long. That
    34this reduction does produce such numbers, which is what the source's claim of strong
    35NP-completeness rests on, is recorded separately.
    36
    37The job lengths pp and qq are parameters of the language and not part of the input:
    38the theorem is about every fixed pair of lengths. A word that encodes no instance, or an
    39instance with a processing time outside {p,q}\{p, q\}, or an instance of the auxiliary
    40problem whose deadlines are not ordered, belongs to neither language.
    41-/
    42
    43namespace Lax391470.BinaryEncoding
    44
    45open Lax434930.PolynomialTime
    46
    47/-- A natural number as a binary word: its digits, least significant first, preceded by
    48their number in unary. -/
    49def encodeNat (n : ℕ) : Word :=
    50 List.replicate n.bits.length true ++ [false] ++ n.bits
    51
    52/-- An integer as a binary word: one bit for the sign, then the absolute value. -/
    53def encodeInt (z : ℤ) : Word := decide (z < 0) :: encodeNat z.natAbs
    54
    55/-- A scheduling instance as a binary word. -/
    56def encodeInstance (I : Scheduling.Instance) : Word :=
    57 encodeNat I.jobs ++
    58 (List.finRange I.jobs).flatMap fun j =>
    59 encodeInt (I.r j) ++ encodeInt (I.d j) ++ encodeNat (I.p j)
    60
    61/-- An instance of the auxiliary problem as a binary word. -/
    62def encodeAux (A : AuxiliaryProblem.Instance) : Word :=
    63 encodeNat A.ordinary ++ encodeNat A.pairs ++
    64 ((List.finRange A.ordinary).flatMap fun o =>
    65 encodeNat (A.r o) ++ encodeNat (A.d o) ++ [A.long o]) ++
    66 (List.finRange A.pairs).flatMap fun i =>
    67 encodeNat (A.longEarly i) ++ encodeNat (A.longDue i) ++
    68 encodeNat (A.shortEarly i) ++ encodeNat (A.shortDue i)
    69
    70/-- **Scheduling on the lengths `{p, q}`**, as a language. -/
    71def TwoLengths (p q : ℕ) : Language :=
    72 {w | ∃ I : Scheduling.Instance, encodeInstance I = w ∧ I.LengthsIn p q ∧ I.Schedulable}
    73
    74/-- **The auxiliary problem `AUX(p, q)`**, as a language. -/
    75def AUX (p q : ℕ) : Language :=
    76 {w | ∃ A : AuxiliaryProblem.Instance, encodeAux A = w ∧ A.Ordered ∧ A.Solvable p q}
    77
    78end Lax391470.BinaryEncoding
    79
    Formalization notes

    Numbers are written in binary, the usual convention, under which NP-hardness is the usual claim. Hardness under a unary encoding of the scheduling instance would be the stronger claim, strong NP-hardness: the reduction would then have to produce numbers bounded by a polynomial in its input, since a unary word must stay polynomially long. That this reduction does produce such numbers, which is what the source's claim of strong NP-completeness rests on, is recorded separately.

    The job lengths pp and qq are parameters of the language and not part of the input: the theorem is about every fixed pair of lengths. A word that encodes no instance, or an instance with a processing time outside {p,q}\{p, q\}, or an instance of the auxiliary problem whose deadlines are not ordered, belongs to neither language.

    Discussion

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

    Loading discussion…