Documentation

Complexity.Crypto.Computational.OneWay.NP

One-way functions separate P from NP #

If one-way functions exist then P ≠ NP Goldreich, Chapter 2, Katz and Lindell, Exercise 8.11. For a function f computable in polynomial time, the preimage-prefix problem (Cslib.Crypto.preimagePrefix) asks, given n in unary, an image y and a word u, whether some input x of length n that starts with u satisfies f x = y. It is in NP, with the missing bits of x as certificate (Cslib.Crypto.preimagePrefix_mem_NP).

A decision procedure for it finds preimages bit by bit (Cslib.Crypto.preimageSearch): starting from the empty prefix, extend the prefix by false if a preimage of length n still starts with the extension, and by true otherwise. After n steps the prefix is itself a preimage of y whenever y has a preimage of length n (Cslib.Crypto.apply_preimageSearch), and the search runs in polynomial time when the decision procedure does. So if the problem is in P, a deterministic polynomial-time algorithm inverts f on every image (Cslib.Crypto.exists_inverse_of_preimagePrefix_mem_P), which a one-way function forbids (Cslib.Crypto.OneWay.preimagePrefix_notMem_P). By the Cook–Levin theorem, SAT is then not in P either (Cslib.Crypto.OneWay.SAT_notMem_P).

One-wayness is the uniform notion of Cslib.Crypto.OneWay: the inverter is uniform strict PPT and receives the unary length of the sampled input. The inverter built here is deterministic; the randomized version, for a decision procedure in BPP, is in Complexity.Crypto.Computational.OneWay.BPP.

Main definitions #

Main results #

References #

The preimage-prefix problem of f: the instances (n, y, u) such that some input x of length n that starts with u satisfies f x = y.

Instances For
    @[reducible, inline]

    The encoding of instances of the preimage-prefix problem: the length n in unary, then the image and the prefix.

    Instances For

      Membership in NP #

      The verifier of the preimage-prefix problem: the certificate supplies the bits after the prefix.

      Instances For

        The verifier accepts some certificate of the length of the encoded instance exactly for the members.

        Search to decision #

        One step of the search for a preimage of length q.1 of q.2: extend the prefix u by false when D says that a preimage starts with u ++ [false], and by true otherwise.

        Instances For

          The bit-by-bit search for a preimage of length q.1 of q.2, with the decision procedure D for the preimage-prefix problem: q.1 steps of preimageSearchStep.

          Instances For

            The search extends the prefix by one bit at each step.

            theorem Cslib.Crypto.preimageSearchStep_mem {f : List Bool → List Bool} {D : ℕ × List Bool × List Bool → Bool} (hD : ∀ (p : ℕ × List Bool × List Bool), p ∈ preimagePrefix f ↔ D p = true) {n : ℕ} {y u : List Bool} (hu : (n, y, u) ∈ preimagePrefix f) (hlen : u.length < n) :

            A correct step keeps the prefix extendable to a preimage.

            theorem Cslib.Crypto.apply_preimageSearch {f : List Bool → List Bool} {D : ℕ × List Bool × List Bool → Bool} (hD : ∀ (p : ℕ × List Bool × List Bool), p ∈ preimagePrefix f ↔ D p = true) (x : List Bool) :
            f (preimageSearch D (x.length, f x)) = f x

            Search to decision. With a decision procedure for the preimage-prefix problem, the search for a preimage of length x.length of f x finds a preimage of f x.

            The search with D' follows the search with D as long as D' answers the queries of the search with D as D does.

            A decision procedure that answers the queries of the search with D as D does finds the same word. Only these q.1 queries matter, not correctness on all instances.

            The search is polynomial-time when the decision procedure is, also for a decision procedure D x and a target q x that depend on the input x.

            Inversion from the preimage-prefix problem. If the preimage-prefix problem of f is in P, a deterministic polynomial-time algorithm, told the length of the input, finds a preimage of every image.

            One-way functions #

            Efficient inversion refutes one-wayness. A deterministic polynomial-time algorithm that, told the length of the input, finds a preimage of every image, inverts with probability one. This is Cslib.Crypto.not_oneWay_of_inverse for an inverter certified on the pair encoding.

            One-way functions have hard preimage-prefix problems: the preimage-prefix problem of a one-way function is not in P.

            One-way functions imply P ≠ NP, for instances of the preimage-prefix problem.

            One-way functions imply SAT ∉ P: by the Cook–Levin theorem, the preimage-prefix problem reduces to SAT.

            If SAT is in P, no function is one-way.