Introduction To Computational Compelxity http://wisdom.weizmann.ac.il/~oded/teaching.html (please join the google group!) We will talk about P, NP, and completeness, what is an efficient algorithm? Search Problems – A binary relation: π ⊆ {0,1}∗ × {0,1}∗ ( β π₯ , π¦ β πππππππ π πππ’π‘πππ “Given instance π₯, find a π¦ such that (π₯, π¦) ∈ π Or say that none exist. Natural Restrictions – The solution is not too long. π is polynomially bounded. TODO: Missing text! Fill in from analog notebook! Topics that will be discussed 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Next lecture on 26/11 Join the Google group Recalling last lecture Poly-time Reductions Cook reductions Karp & Levin-reductions Self-reducibility NP-Completeness Self-Reducibility of NP-complete problems π ⊆ {0,1}∗ × {0,1} π (π) = {π¦: (π₯, π¦) ∈ π } ππ = {π₯: π (π₯) ≠ π} π = ππ ↔ ππΆ(πΉππ) ⊆ ππΉ(πΉπ) ππ ′ = {〈π₯, π¦ ′ 〉: ∃π¦ ′′ π . π‘. (π₯, π¦ ′ , π¦ ′′ ) ∈ π } )∈π Reduction of π΅ to π΄: Any procedure that performs an efficient algorithm that solves π΄ to an efficient algorithm that solves π΅. Cook Reductions A cook reduction from π΅ to π΄ –An efficient algorithm that solves π΅ using a black box for solving π΄. (Informal definition) An oracle machine π has oracle access to a function π. Denoted: π π . Formal definition: A polynomial time Turing machine π π΄ that solves π΅. Clique Clique= {〈〈πΊ, π〉, πΆ〉||πΆ| ≥ π, πΆ ππ π πππππ’π} Given a graph πΊ = (π, πΈ) a clique πΆ is a subset of π such that all vertices have edges between each other. INDEP-SET={〈〈πΊ, π〉, πΌ〉||πΌ| ≥ π, πΌ ππ ππ πππππππππππ‘ π ππ‘} An independent set, is a subset of vertices such that no pair have an edge between them. Karp Reductions Given two sets π1 , π2 ⊆ {0,1}∗, a Karp reduction of π1 to π2 is a polynomial time computable π: {0,1}∗ → {0,1}∗ s.t. ∀π₯: π₯ ∈ π1 ↔ π(π₯) ∈ π2 Levin Reductions Levin Reductio: π 1 , π 2 ⊆ {0,1}∗ × {0,1}∗. A levin rediction of π 1 to π 2 is π: {0,1}∗ → {0,1}∗ , π: {0,1}∗ × {0,1}∗. Such that π 1 (π₯) ≠ π ↔ π 2 (π(π₯)) ≠ π π(π₯, π¦) ∈ π 1 (π₯) ↔ π¦ ∈ π 2 (π(π₯)) Self Reducibility π ⊆ {0,1}∗ × {0,1}∗ is self reducible if π is cook reducible to the corresponding decision problem. Example – SAT π1 , … , ππ - Boolean variables β’,∧,∨ - operators SAT = {(π, π)|π(π) = π‘ππ’π} where a is an assignment for all variables. CNF formulas are formula’s of the form: πΆ1 ∧ πΆ2 , … ,∧ πΆπ πΆπ = (π1 ∨ π2 ∨ … ∨ ππ ) TODO: Write how to self-reduce SAT NP Hardness A decision problem π ⊂ {0,1}∗ is NP-Hard iff every π ′ ∈ ππ reduces to it. NP-Completeness: π is NP-Complete if it is both in NP and it is NP-Hard. Bounded-Halting π ∈ ππ ↔ ∃ππππ¦π‘πππ π and ππππ¦ππππππ π: β → β π = {π₯|∃π¦ ∈ {0,1}∗ , |π¦| ≤ π(|π₯|), π(π₯, π¦) ππππππ‘π } An instance of bounded halting could be a Turing machine π, a string π₯, and a string 1π‘ . Solution: π¦ π . π‘. π ππππππ‘π (π₯, π¦), |π¦| ≤ π‘, in ≤ π‘ steps. Reduction: π₯ → 〈ππ , π₯, 1π‘π (|π₯|+ππ(|π₯|)) 〉 Claim: ∀π π . π‘. ππ is NP-Complete, π is cook-reducible to ππ ′ . Proof: π cook reduces to ππ ′ , ππ ′ ∈ ππ → ππ ′ reduces to ππ . ----- end of lesson 2 Theorem: There exists NP-Complete problems. π π = {(π, π₯, 1π‘ ), π¦|π ππππππ‘π (π₯, π¦) ππ ππ‘ πππ π‘ π‘ π π‘πππ , |π¦| ≤ π‘} ∈ ππΆ π‘ < |(π, π₯, 1π‘ )| ππ’ = {(π, β π₯, 1π‘ ) |∃π¦ (π₯Μ , π¦) ∈ π π’ } ∈ ππ π₯Μ Let π ∈ ππΆ → ππ Let ππ - polynomially bound solution length ππ - Recognizing machine π‘π - Polynomially bounded number true of ππ β π₯ → ππ (π₯) = (ππ , π₯, 1π‘π (|π₯|←ππ (|π₯|)) We shall prove: ∀(π₯, π¦) ∈ π ⇔ (ππ (π₯), π¦) ∈ π π’ Proposition 1: CSAT is NP-Complete. β ∀π ∈ ππΆ ∃Levin Reduction of π to π πΆππ΄π = {(πΆ, π¦)|πΆ(π¦) = 1} Proposition 2: If π 1 is PC-Complete and π 1 Levin Reduces to π 2 ∈ ππΆ, then π 2 is NP-Complete. By the first part of the condition: ππΆ ∝ π 1 ∝ π 2 , ∀π ∈ ππΆ Proposition 3: (1) π ππ΄π is in PC (2) π πΆπ΄ππ ∝ π ππ΄π Proof of proposition 1: π ∈ ππΆ → ππ , ππ , π‘π π₯ → πΆπ₯ (πΆπ₯ , π¦) ∈ π πΆππ΄π ∀π₯, π¦ (π₯, π¦) ∈ π ⇔ β πΆπ₯ (π¦)=1 Just as a mental thought, consider the computation of ππ (π₯, π¦) up to π‘π (|π₯| + ππ (π₯)) steps TODO: draw drawing… β π ππ΄π = {(π, π)|π(π) = 1} π πΆππ΄π ∝ π ππ΄π Promise Problems Promise is easy to verify. Promise = set of instances. 1. Make invalid instances easy to solve by introducing a trivial solution. 2. Map it to an arbitrary valid instance β π ππ΄π = {(π, π)|π(π) = 1} π ∈ ππΆ, ππ Candid search problem of π : Promise: Instance π₯ ∈ ππ Task: Find π¦ ∈ π (π₯) ≠ 0 Theorem: For every π ∈ ππΆ, ∃polynomial π and an algorithm π΄0 that solves the candid search problem or π such that ∀ algorithm π΄ that solves the candid search problem of π ∀π₯ π‘π΄0 (π₯) = πΜ(π‘π΄ (π₯) + π(|π₯|)) For every π = 1 … For every π = 1, … , √2π π Enumerate the I’th machine for at most [2 ⁄(π + 1)2 ] Suppose π΄ solves the candid search problem in time π(π΄) β Let ππ΄ = πππππ₯ ππ π΄ ππ π‘βπ πππ’πππππ‘πππ ≈ 2|π΄| 1 (ππ΄ + 1)2 TheπΜ hides a constant that depends on π΄! And probably exponential of π΄. ----- End of lesson 3 Circuit Complexity ∗ ∗ Infinite family of circuits {πΆπ }∞ π=1 computes π: {0,1} → {0,1} If ∀π₯ it holds that πΆ|π₯| (π₯) = π(π₯) {πΆπ }∞ π=1 has size π(π) ⇔ ∀π. |πΆπ | ≤ π(π) We want to prove: ππ β π⁄ππππ¦ Prove that π⁄ππππ¦ can even solve undecidable problems. π ′ = {1π |π΅πππππ¦ ππ₯ππππ πππ ππ π ππ ππ π} {πΆπ }∞ π=1 Just build the infinite series that for every 1π in π returns one and otherwise returns 0. ∗ Turing machine π that takes advice {ππ }∞ π=1 ⊆ {0,1} computes π if ∀π₯ it holds that π(π₯, π|π₯| ) = π(π₯) Advice length π(π) if ∀π |ππ | ≤ π(π) π⁄ ππππ¦ – π that are decided by a circuit family of polynomial size. Claim: π⁄ππππ¦ that are decided by poly-time machines that take advice of polynomial length. π has poly-size family {πΆπ }π Advice {πΆπ }π And the machine would be: π(π₯, πΆ|π₯| ) = πΆ|π₯| (π₯) Suppose π has poly-time π that takes poly-length {ππ }π {π·π } π·π (π¦) = π(π¦) {πΆπ }π πΆπ (π₯) = π·(|π₯| +|π ) (π₯, π|π₯| ) |π₯| {πΆπ }∞ π=1 is uniform, if ∃π that on input π outputs ππ in time polynomial in the size of ππ . Describe π⁄π - a class of Turing machines that take advice of length π. ∀π ⊆ {0,1}∗ Denote π = {0,1}∗ \π ∀πΆ (complexity class), denote by πππΆ the class of complementary set: πππΆ = {πΜ |π ∈ πΆ} π ∈ Σ2 ⇔ ∃poly time π such that π = {π₯|∃π¦1 ∀π¦2 π£(π₯, π¦, π¦2 ) ππππππ‘π } π ∈ Π2 ⇔ ∃poly time π such that π = {π₯|∀π¦1 ∃π¦2 π£(π₯, π¦, π¦2 ) ππππππ‘π } π ∈ Σπ ⇔ ∃poly time π£ such that π = {π₯|∃π¦1 ∀π¦2 … ππ π¦π π£(π₯, π¦1 , … , π¦π )} π ∈ Ππ ⇔ ∃poly time π£ such that π = {π₯|∀π¦1 ∃π¦2 … ππ π¦π π£(π₯, π¦1 , … , π¦π )} π = Σ0 = Π0 ππ = Σ1 ππππ = Π1 Ππ = ππΣπ Conjecture: ∀π Σπ β Σπ+1 ∀π Ππ β Σπ+1 PH = ∪π Σπ =∪π Ππ Σπ -Complete Problem: Given ππ¦1 , … , π¦π Σπ − ππ΄π − ∃π¦1 ∀π¦2 … ππ π¦π π(π¦1 , … , π¦π ) = 1 π ∈ Σπ+1 ⇔ ∃π ′ ∈ Ππ π = {π₯|∃π¦(π₯, π¦) ∈ π} Σπ = Ππ ⇒ ∀π ′ ≥ πΣπ ′ = Σπ ′ +1 π ∈ πππ ∃poly time π£ ∃π ′ ∈ πΆ such that ′ π = {π₯|∃π¦π£ π (π₯, π¦) ππππππ‘π } Σπ+1 = ππΣπ = ππΠπ Karp-Lipton Theorem Under the assumption that Σ2 ≠ Π2 ⇒ ππ β π⁄ππππ¦ We will prove the other way: ππ ⊆ π⁄ππππ¦ ⇒ Σ2 = Π2 Suppose ππ ⊆ π⁄ππππ¦ Take Π2 − ππ΄π = {π|∀π¦1 ∃π¦2 π(π¦1 , π¦2 ) = 1} ∃π ′ Π2 − ππ΄π = {π|∃π¦1′ ∀π¦2′ π ′ (π, π¦1′ , π¦2′ )} π = {〈π, π¦1 〉|∃π¦2 π(π¦1 , π¦2 )} π ∈ ππ ⇒ π ∈ π⁄ππππ¦ ⇒ {πΆπ }∞ π−1 decides π. Π2 − ππ΄π = {π|∀π¦1 πΆπ (π, π¦1 ) = 1} A second attempt: Π2 − ππ΄π = {π|∃πΆ∀π¦1 πΆ(π, π¦1 ) = 1} But this is not true since can get any circuit. We know ππ΄π ∈ ππ ⇒ ππ΄π ∈ π⁄ππππ¦ ⇒ {π·π }π deciding ππ΄π. Denote {π·π′ } find satisfying assignments to ππ΄π or output ⊥(since ππ΄π is self reducible). So now: Π2 − ππ΄π = {π|∃π·′ ∀π¦, π· ′ (ππ1 =π¦1 ) = π¦2 ∧ π(π¦1 , π¦2 ) = 1} ⇔ π£ ′ (π, π· ′ , π¦1 ) = 1 Π2 − ππ΄π = {π|∃π·′ ∀π¦1 . π£ ′ (π, π· ′ , π¦1 ) ππππππ‘π } ---- end of lesson 4 π·ππππ(π‘) - Class of sets decidable in π‘ steps by a 2-tape TM Is π·ππππ(π) β π·ππππ(2π )? Is π·ππππ(π‘) β π·ππππ(2π‘ ) for ∀π‘: β → β? For a nice π‘ (nice will be defined soon): π·ππππ(π‘) β π·ππππ(π(π‘ log π‘)) A function π‘: β → β is time-constructible, if it can be computed in time π‘. For circuits all functions are nice. Time Hierarchy Theorem ∀ Time constructible π‘: β → β, π·ππππ(π‘) β π·ππππ(π‘ β log π‘) We will prove a weaker version: π·ππππ(π‘) β π·ππππ(π β π‘ β log π‘) Proof: Denote ππ - Description of π π = {ππ |π(ππ ) ππππππ‘π ππ t(|X M |) steps} Suppose π is decided by machine π in time π‘. What is the result of invoking π(ππ )? If π(ππ ) accepts ⇒ ππ ∉ π If π(ππ ) rejects ⇒ ππ ∈ π A general fact: The universal machine can simulate a machine M for π‘ steps in time π(ππ β π‘ β log π‘) Time Gap Theorem For every computable non-decreasing π: β → β there exists a computable non decreasing and non-time constructible π‘: β → β such that π·ππππ(π‘) = π·ππππ(π(π‘)) We can choose π to be π(π‘) = 2π‘ Fix π, Let π1 , π2 , … be all Turing Machines π‘π (π) - the time bound of ππ on inputs of length π. π‘(π) = max {π‘π (π), π‘(π − 1)} + 1 1≤i≤n,ti (n)≠∞ Let π ∈ π·ππππ(π(π‘)), so π is decided by some ππ in time π(π‘) ∀π ≥ π, it holds that π‘(π) > π‘π (π) So ∀(π ≥ π), π decides π in time π‘. ∃π that decides π in time π‘ for ∀n Oded steps in: There exists a problem π. ∀ algorithm that solves π, there exists an algorithm that solves π much faster πππ₯πΆππππ’π(πΊ, π) = is maximum clique size π? is maximum clique size ≥ π is ππ complete! Is maximum clique size ≤ π is ππ − ππ complete! Space Complexity Space complexity ~ the number of cells of work device visited during computation. But since you can increase the alphabeit, we usually multiply it by log 2|Σ| (and we denote it as binary space). We also add log 2|π| but this is just a constant… Focus: Log-Space Question: What’s the smallest amount of space that is more powerful then constant space? There is a set: π = {π€π |π ∈ β} π€π = 2π strings of length π π€1 = 0 ∗ 1 π€2 = 00 ∗ 01 ∗ 10 ∗ 11 The machine only needs log π to check the input is of the form. But π = log π. So the machine needs log log π. Also it checks whether the given string is of the right form and if not is uses only log log π space as well. Time VS Space In time, if you have a reduction, you can simply execute the reduction, then execute the second function on the reduction. However, when we’re talking about space, we need to store the damn thing somewhere. However, we can recycle space!! A non obvious ideal: TODO: A lot of drawings. Baaahhhh… A connection between space and time: π·πππππ(π ) ⊆ π·ππππ(π β 2π (π) ) Corollary: Define πΏ as what can be done in log space – πΏ ⊆ π Theorem: For any algorithm π΄ that halts on each input, it’s time complexity is at most π β 2π (π)+log π+log π (π) Proof: Fix π₯, What is needed to store for the configuration? π (π) + log π + log π (π) --- End of lesson 5 Theorem: CircuitEval is P-Complete. Proof: π ∈ π → ππ , π‘π Draw Pseudo Cook reduction for circuits ππ log π ππππ Reduct: π₯ → ππππ¦ π‘πππ {πΆπ }π∈β π → (πΆ|π₯| , π₯) πΆπ ∀π ∈ π ∃ Uniform family of poly-size circuits. NSpace VS NP π ∈ ππ ⇔ ∃polynomial π and ∃ poly-time algorithm π΄ such that ∀π₯ ∈ π ⇔ ∃π¦ ∈ {0,1}π(π₯) π΄(π₯, π¦) = 1 π΄ runs in time polynomial in |π₯| π ∈ ππππππ[π₯] Basic model is: Main input π₯, aux. input, or “witness”/”proof” π¦. Off-line model: free(read) access to π¦ or bidirectional access. Are these walks (free read access) helpful? They are very helpful at times. For instance, look at the following language: π = {π₯ ∗ π₯|π₯ ∈ {0,1}∗} On-line model: There is a unidirectional access to π¦. If we want it or not, this divides the world into two non-deterministic space groups: ππππππππΉπΉ (π ) and ππππππππ (π ) ππππππππ (π ) ⊆ ππππππππΉπΉ (π ) ∀π at least linear: ππππππππ (π ) = ππ ππππππΉπΉ (π(log π )) Theorem: ππππππππ (π ) ⊆ π·ππππ(2π β π β π) πππ ππΏ = ππππππππ (π(log π)) ⊆ π Directed Connectivity is ππΏ complete. Undirected Connectivity ∈ πΏ! π·πΆπππ ≈ ππΏ Input: Graph πΊ and pair or vertices π , π‘ Question: Is there a directed path between π and π‘? Theorem: π π‘ − ππππ is NL-Complete (under log space reductions) ππππ π ππππ ∀π ∈ ππΏ, π→ π on-line log space ππ − πΆπππ π₯ ∈ π ⇒ ∃ computation of π(π₯) that accepts. Theorem: ππΏ ⊆ π·πππππ(log 2 π) Will show ππ − πΆπππ ∈ π·πππππ(log 2 π) Input: Grah πΊ, vertices π , π‘ Question: Is there a directed path from π to π‘. Length of the path is always smaller of equal to the number of vertices in the graph. πππ ππΊ (π’, π£, πΏ) = ∃ a path of length < πΏ from π’ to π£. ππΊ (π’, π£2π) = β ππΊ (π’, π€, π) ∧ ππΊ (π€, π£, π) π€ For every π€ ∈ π π ← ππΊ (π’, π€, π) - a recursive call π ← π ∧ ππΊ (π€, π£, π) πππππ(2π) = log|π| + 1 + πππ΄πΆπΈ(π) So we get that we can do it in log 2 π The general statement is: ππππ΄πΆπΈ(π ) ⊆ ππππ΄πΆπΈ(π 2 ) ππΏ = ππππΏ – {{0,1}∗ \π|π ∈ ππΏ} Equivalent: Μ Μ Μ Μ Μ Μ Μ Μ Μ Μ Μ Μ Μ Μ Μ ππ − πΆπππ log space reduced to ππ − πΆπππ. Notion: Non-Deterministically computing a function. There exists an algorithm π΄ such that: ∀π₯: 1) ∀π¦ π΄(π₯, π¦) ∈ {π(π₯), ⊥} - ⊥∉ {0,1}∗ 2) ∃π¦ π΄(π₯, π¦) = π(π₯) Property: ππΏ = ππππΏ iff ∀π ∈ ππΏ such that ππ is non-deterministically computable in log space. Proof: (1) ππΏ = ππππΏ → π ∈ ππΏ → π , π₯ ∈ π πππ ∃π¦. (π₯, π¦) ∈ π πΜ ∈ ππΏ → π 0 π₯ ∉ π πππ ∃π¦ (π₯, π¦) ∈ π Algorithm (x,π, π)= if (π₯, π) ∈ π π then output π. Otherwise output ⊥. (3) π΄ non-deterministically computes ππ → π ∈ ππΏ ∩ ππππΏ Theorem: Log-Space is non-deterministically computing of πππ−πΆπππ Reachability: Input is a directed graph πΊ(π, πΈ) and a vertex π. Output = the number of vertices reachable from π in the graph πΊ. Log space reduction to counting the number of reachable vertices. Fix πΊ and π. Also denote π = |π|. π π = {π£|∃ ππππππ‘ππ πππ‘β ππ πππππ‘β π ππππ π π‘π π£} π 0 = {π} We want to know |π π | For π = 1 to π = |π| - Guess the size of π π , denote my guess by π. - Verify that |π π | ≥ π - Loop all vertices and check that it is reachable by π steps. - Verify that |π π | ≤ π ⇔ |π − π π | ≥ π − π - “enumerate π π−1 and for each π€ in π π−1 I verify the following – π’ ≠ π€ and that 〈π, π’〉 ∉ πΈ ππ ⊆ ππππ΄πΆπΈ, ππππ ⊆ ππππ΄πΆπΈ We also know ππ» ⊆ ππππ΄πΆπΈ π ∈ Σπ take the polytime V: π = {π₯: ∃π¦1 ∀π¦2 … ππ π¦π π(π₯, π¦1 , … , π¦π ) accepts} ππ΅πΉ − quantified Boolean formula. Input: π1 π₯1 π2 π₯2 … ππ π₯π π(π₯1 , … , π₯π ) Output: Yes ⇔ this is a true statement Theorem: ππ΅πΉis PSPACE-complete Let π ∈ ππππ΄πΆπΈ. Let π be the machine that decides π. Let π₯ ∈ {0,1}π πΊ = πΊπ,π - Configuration graph of π on π₯. ππΊ (π’, π£, π) – true ⇔ ∃ a path of length ≤ π from π’ to π£. πΏ = 2⌈log2 |ππ |⌉ π π ππΊ = ∃π€ ∈ ππΊ . π (π’, π€, ) ∧ ππΊ (π€, π£, ) 2 2 π π(π’, π£, π) = ∃π€ ∈ ππΊ ∀(π’′ , π£ ′ ) ∈ {(π’, π€), (π€, π£)}ππΊ (π’′ , π£ ′ , ) 2 π ∃π€ ∈ ππΊ ∀π ∈ {0,1}∃π’′ π£ ′ ∈ ππΊ ∧ ππΊ (π’′ , π£ ′ , ) π [(π = 0) ∧ (π’′ = π’) ∧ (π£ ′ = π€) ∨ (π = 1) ∧ (π’′ = π€) ∧ (π’′ = π£] Games ∃π₯1 ∀π₯2 … ππ ππ π(π₯1 , … , π₯π ) --- end of lesson Standard random variables take real numbers. We will allow ourselves to do whatever we want. ππ – The random variable that takes random strings of length π and is uniform. Δ(π1 , π2 ) = max{Pr[π1 ∈ π] − Pr[π2 ∈ π]} S π1 , π2 are independent iff ∀π1 , π2 Pr[π1 = π₯1 , π2 = π₯2 ] = Pr[π1 = π₯1 ] β Pr[π2 = π₯2 ] π1 , … , ππ are π-wise independent iff every π variables of this set are independent. If π1 , … , ππ are pair-wise independent, then π[π1 + β― + ππ ] = π[π1 ] + β― + π[π2 ] πΈ[π π ] is called the π’th moment of π. 1 1000 π€. π. 2 π={ 1: −1000 π€. π. 2 Markov Inequality: If π is non-negative, then: 1 Pr[π₯ > ππΈ[π₯]] < π Or πΈ[π] Pr[π > π] < π πΈ[π] = ∑ π₯ β Pr[π = π₯] > ∑ π β Pr[π = π₯] = π β Pr[π₯ > π] π₯ π₯>π Chebyshev Inequality Pr[|π − πΈ[π]| > π] ≤ π[π] π2 Proof: Pr[|π − πΈ[π]| > π] = Pr[(π − πΈ[π])2 > π 2 ] π΅π¦ ππππππ£ ≤ πΈ[(π−πΈ[π])2 ] π2 = π[π] π2 π1 , … , ππ all have expectations π and variance π 2 1 Pr [| ∑ ππ − π| > π] =? π π If π1 , … , ππ are pair-wise independent. Then: 1 π Pr [| ∑ ππ − π| > π] ≤ 2 π π βπ π 1 1 1 Proof: The variables are pair-wise independent. Thus, π [π ∑ ππ ] = π2 ∑π π[ππ ] = π2 β π β π 2 = Follows by chebyshev. π2 π Chernoff/Hoefding Inequality Let π1 , … , ππ totally independent all have expectation π and take values in the segment [π, π]. 2 2π 1 − βπ Pr [| ∑ ππ − π| > π] < 2π (π−π)2 π π Let π: {0,1}π → [0,1]. A (πΏ, π)-sampler π΄ is a random algorithm that has a black-box access to π and Pr[|π΄ π − πΈ[π(ππ )]| > π] < πΏ Sample Complexity – how many queries are made to π? How many random bits are used. Deterministic 2π samples, Randomness 0 samples. Totally independent: π = log 1 πΏ π2 ( ) Choose totally independent uniformly distributed π1 , … , ππ ∈ {0,1}π For π ≈ log 1 π π2 ( ) 1 and output π ∑π π(ππ ) 1 Just like before, but use pairwise independent samples: π = π2 βπΏ For the two-wise independent we will have 1 π 2 βπΏ but we will gain a lot in the randomness. Let π ∈ π, π ⊆ {0,1}π |π| βͺ 2π Hash table of 2π entries. Idenfity entries with {0,1}π Choose some function β: {0,1}π → {0,1}π Store π₯ ∈ π in entry π¦ = β(π₯) One way to do it is choose β to be a random function. 1 ∀π₯1 , π₯2 ∈ {0,1}π Pr[β(π₯1 ) = β(π₯2 )] = 2π Really want: Efficiently computable β that informally “behaves like a random function”. Pairwise independent hash functions. π π»π - A family of functions from {0,1}π to {0,1}π π π»π is pair-wise independent if it satisfies the following: ∀π₯1 , π₯2 ∈ {0,1}π , ∀π¦1 , π¦2 ∈ {0,1}π , Pr[β(π₯1 ) = π¦1 ∧ β(π₯2 ) = π¦2 ] = 1 (2π )2 π π Can construct π»π such that each function in the family β ∈ π»π can be represented using 2π bits and computed in time poly(n). |π| πΈ[#ππππππ ππππ ] = ( ) β 2−π 2 π ≈ log|π|2 Construction: Suffices to construct π»ππ Let πΉ2π the finite field of size 2π It’s elements can be identified with strings of length π. β = βπ,π ∀π₯ ∈ {0,1}π , βπ,π (π₯) = π β π₯ + π π, π ∈ πΉ2π Prove it is pairwise independent. π ⊆ {0,1}π , π¦ ∈ {0,1}π what is |β−1 (π₯) ∩ π| |π| If β was totally random, expect 2π π π On the other hand, if β ∈ π»π : Pr [|β−1 (π¦) ∩ π| ∈ [(1 − π) πΈ[ππ ] = 1 , 2π |π| 2π , (1 + π) |π| 2π 1 2π π[ππ ] = πΈ[ππ2 ] − (πΈ[ππ ]2 ) ≤ Let π = {π₯1 , … , π₯|π| } ππ - Random Variable that is 1 if β(π₯π ) = π¦ and 0 otherwise. 1 |π| |π| ∑ ππ 1 1 2π π 2 Pr [|∑ ππ − π | > π β π ] ≤ Pr [| − π| > π β π] ≤ π = 2 |π| 2 2 2 2 |π| π β |π| 2π β Mixing: ∀π ⊆ {0,1}π , π ⊆ {0,1}π Pr [|β−1 (π) ∩ π| ∈ [(1 − π) |π|β|π| 2π , (1 + π) 2π |π|β|π| 2π ]] ≥ 1 − π2 β|π|β|π| Another property: π 3 1 π Leftover hash lemma: ∀π ⊆ {0,1}π , β ∈ π»π , π = √2π ∀πΌ ∈ (0,1), Pr [Δ(β(ππ ), ππ ) ≤ 2βπ ]≥ 1−πΌ πΌ 2π ]] > 1 − π2 |π|