complexity theory of
play

Complexity Theory of Polynomial-Time Problems Lecture 7: 3SUM II - PowerPoint PPT Presentation

Complexity Theory of Polynomial-Time Problems Lecture 7: 3SUM II Sebastian Krinninger Reminder: 3SUM given sets , , of integers are there , , such that + + = 0 ?


  1. Complexity Theory of Polynomial-Time Problems Lecture 7: 3SUM II Sebastian Krinninger

  2. Reminder: 3SUM given sets ๐ต, ๐ถ, ๐ท of ๐‘œ integers are there ๐‘ โˆˆ ๐ต, ๐‘ โˆˆ ๐ถ, ๐‘‘ โˆˆ ๐ท such that ๐‘ + ๐‘ + ๐‘‘ = 0 ? well-known: ๐‘ƒ(๐‘œ 2 ) Conjecture: no ๐‘ƒ ๐‘œ 2โˆ’๐œ algorithm โ†’ 3SUM-Hardness Alternative algorithm: ๐‘ƒ( ๐ต โ‹… ๐ถ + |๐ท|) (store negated pairwise sums in hashmap) 2/19 June 16, 2016

  3. Reminder: Hashing Hash function โ„Ž: ๐‘‰ โ†’ [๐‘†] ๐‘ฆ โ„Ž(๐‘ฆ) 2 โ‹ฏ ๐‘† 1 Goal: Distribute uniformly, avoid collisions, etc. 3/19 June 16, 2016

  4. Magical hash functions Desired properties for family of hash functions from ๐‘‰ โ†’ ๐‘† (i.e., for every โ„Ž chosen from family) Uniform difference: Pr โ„Ž ๐‘ฆ โˆ’ โ„Ž(๐‘ง) = ๐‘— = 1/๐‘† (for any ๐‘ฆ, ๐‘ง โˆˆ ๐‘‰ s.t. ๐‘ฆ โ‰  ๐‘ง and ๐‘— โˆˆ ๐‘† ) ๐‘ฆ โˆˆ ๐‘‡ โˆถ โ„Ž ๐‘ฆ = ๐‘— โ‰ค 3๐‘œ/๐‘† Balanced: (for any set ๐‘‡ = ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘œ โŠ† ๐‘‰ and any ๐‘— โˆˆ ๐‘† ) โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘ฆ + ๐‘ง (mod ๐‘†) Linear: (for any ๐‘ฆ, ๐‘ง โˆˆ ๐‘‰ ) But: We do not know such a familyโ€ฆ 4/19 June 16, 2016

  5. 5/19 June 16, 2016

  6. Almost magical hash functions Desired properties for family of hash functions from ๐‘‰ โ†’ ๐‘† (i.e., for every โ„Ž chosen from family) Uniform difference: Pr โ„Ž ๐‘ฆ โˆ’ โ„Ž(๐‘ง) = ๐‘— = 1/๐‘† (for any ๐‘ฆ, ๐‘ง โˆˆ ๐‘‰ s.t. ๐‘ฆ โ‰  ๐‘ง and ๐‘— โˆˆ ๐‘† ) Almost balanced: Expected number of elements from S hashed to heavy values is ๐‘ƒ(๐‘†) , where value ๐‘— โˆˆ ๐‘† is heavy if ๐‘ฆ โˆˆ ๐‘‡ โˆถ โ„Ž ๐‘ฆ = ๐‘— > 3๐‘œ/๐‘† (for any set ๐‘‡ = ๐‘ฆ 1 , โ€ฆ , ๐‘ฆ ๐‘œ โŠ† ๐‘‰ and any ๐‘— โˆˆ ๐‘† ) โ„Ž ๐‘ฆ + โ„Ž ๐‘ง โˆˆ โ„Ž ๐‘ฆ + ๐‘ง + ๐‘‘ โ„Ž + 0,1 (mod ๐‘†) Almost linear: (for any ๐‘ฆ, ๐‘ง โˆˆ ๐‘‰ and some integer ๐‘‘ โ„Ž depending only on โ„Ž ) 6/19 June 16, 2016

  7. Definition of hash function Set ๐‘  = ๐‘™๐‘› for some ๐‘™ โ‰ฅ ๐‘‰/2 and ๐‘‰, ๐‘†, ๐‘  powers of 2 โ„‹ ๐‘‰,๐‘†,๐‘  = โ„Ž ๐‘,๐‘ : ๐‘‰ โ†’ ๐‘† โˆฃ ๐‘ โˆˆ ๐‘  odd integer and ๐‘ โˆˆ ๐‘  โ„Ž ๐‘,๐‘ ๐‘ฆ = ๐‘๐‘ฆ + ๐‘ mod ๐‘  div ๐‘ /๐‘† Thm: Family โ„‹ ๐‘‰,๐‘†,๐‘  is has the uniform difference property, is almost balanced and almost linear with ๐‘‘ โ„Ž ๐‘,๐‘ = (๐‘ โˆ’ 1 mod ๐‘ ) div ๐‘ /๐‘† . (Pairwise independence [Dietzfelbinger โ€™96] implies uniform difference (easy to check) and almost balanced [Baran et al. โ€˜08]. Almost linear: easy to check.) Rest of this lecture: โ„Ž picked randomly from this family 7/19 June 16, 2016

  8. Hashing down the universe Lem: If 3SUM on universe of size ๐‘ƒ(๐‘œ 3 ) solvable in exp. time ๐‘ƒ(๐‘œ 2โˆ’๐œ— ) , then 3SUM on arbitrary universe solvable in expect. time ๐‘ƒ(๐‘œ 2โˆ’๐œ— ) . Follows from [Baran et al. โ€˜08] Algorithm: Repeat until output: Pick hash function โ„Ž: 1 โ€ฆ ๐‘‰ โ†’ 1 โ€ฆ 6๐‘œ 3 at random โ€ข ๐ต โ€ฒ = ๐‘ โˆˆ ๐ต , ๐ถ โ€ฒ = {โ„Ž ๐‘ โˆฃ ๐‘ โˆˆ ๐ถ} , ๐ท โ€ฒ = โ„Ž ๐‘ โ„Ž ๐‘‘ + ๐‘‘ โ„Ž ๐‘‘ โˆˆ ๐ท โ€ข ๐ตโ€ฒ โ€ฒ = ๐‘ โˆˆ ๐ต , ๐ถโ€ฒ โ€ฒ = {โ„Ž ๐‘ โˆฃ ๐‘ โˆˆ ๐ถ} , ๐ทโ€ฒ โ€ฒ = โ„Ž ๐‘ โ„Ž ๐‘‘ + ๐‘‘ โ„Ž + 1 ๐‘‘ โˆˆ ๐ท โ€ข Solve two 3SUM instances ๐ต โ€ฒ , ๐ถ โ€ฒ , ๐ท โ€ฒ and ๐ตโ€ฒ โ€ฒ , ๐ถโ€ฒ โ€ฒ , ๐ทโ€ฒ โ€ฒ โ€ข โ€ข If algorithm reports no 3SUM witness: output โ€˜no 3SUMโ€™ Consider first reported 3SUM witness ๐‘ฆ โ€ฒ , ๐‘ง โ€ฒ , ๐‘จ โ€ฒ for ๐ต โ€ฒ , ๐ถ โ€ฒ , ๐ท โ€ฒ : โ€ข If โ„Ž โˆ’1 ๐‘ฆโ€ฒ , โ„Ž โˆ’1 ๐‘งโ€ฒ , โ„Ž โˆ’1 ๐‘จ โ€ฒ โˆ’ ๐‘‘ โ„Ž contains witness ๐‘ฆ, ๐‘ง, ๐‘จ : output โ€ข ๐‘ฆ, ๐‘ง, ๐‘จ Consider first reported 3SUM witness ๐‘ฆโ€ฒ โ€ฒ , ๐‘ง โ€ฒโ€ฒ , ๐‘จ โ€ฒโ€ฒ for ๐ต โ€ฒโ€ฒ , ๐ถ โ€ฒโ€ฒ , ๐ท โ€ฒโ€ฒ : โ€ข If โ„Ž โˆ’1 ๐‘ฆโ€ฒโ€ฒ , โ„Ž โˆ’1 ๐‘งโ€ฒโ€ฒ , โ„Ž โˆ’1 ๐‘จ โ€ฒโ€ฒ โˆ’ ๐‘‘ โ„Ž โˆ’ 1 contains witness ๐‘ฆ, ๐‘ง, ๐‘จ : โ€ข output ๐‘ฆ, ๐‘ง, ๐‘จ No false negatives: If ๐‘ฆ + ๐‘ง = ๐‘จ , then โ„Ž ๐‘ฆ + โ„Ž ๐‘ง โˆˆ โ„Ž ๐‘จ + ๐‘‘ โ„Ž + 0,1 8/19 June 16, 2016

  9. Running Time We need to bound: โ€ข Number of iterations ๐‘ƒ(1) Number of candidate witnesses ๐‘ƒ(1) โ€ข Then: number of calls to 3SUM algorithm: ๐‘ƒ(1) Number of iterations: Triple ๐‘ฆ, ๐‘ง, ๐‘จ gives false positive if ๐‘ฆ + ๐‘ง โ‰  ๐‘จ and one of โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘จ + ๐‘‘ โ„Ž or โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘จ + ๐‘‘ โ„Ž + 1 Linearity: โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘ฆ + ๐‘ง + ๐‘‘ โ„Ž or โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘ฆ + ๐‘ง + ๐‘‘ โ„Ž + 1 Thus, probability that fixed ๐‘ฆ, ๐‘ง, ๐‘จ (with ๐‘ฆ + ๐‘ง โ‰  ๐‘จ ) gives false positive is: 3 1 Pr โ„Ž ๐‘ฆ + ๐‘ง โˆ’ โ„Ž ๐‘จ โˆˆ {โˆ’1,0,1} โ‰ค 6๐‘œ 3 = (uniform difference) 2๐‘œ 3 Overall probability of false positive : โ‰ค ๐‘œ 3 โ‹… 2๐‘œ 3 = 1 1 2 In expectation: 2 iterations until no false positive (waiting time bound) (If no false positive, then algorithm certainly stops) 9/19 June 16, 2016

  10. Running Time We need to bound: โ€ข Number of iterations ๐‘ƒ(1) Number of candidate witnesses ๐‘ƒ(1) โ€ข Then: number of calls to 3SUM algorithm: ๐‘ƒ(1) Number of candidate witnesses: Fix 3SUM witness ๐‘ฆ โ€ฒ , ๐‘ง โ€ฒ , ๐‘จโ€ฒ of instance (๐ต โ€ฒ , ๐ถ โ€ฒ , ๐ท โ€ฒ ) Let ๐‘ฆ โˆ— โˆˆ โ„Ž โˆ’1 ๐‘ฆโ€ฒ 1 For every ๐‘ฆ โ‰  ๐‘ฆ โˆ— : Pr โ„Ž ๐‘ฆ = โ„Ž ๐‘ฆ โˆ— = (uniform difference) 6๐‘œ 3 ๐น โ„Ž โˆ’1 ๐‘ฆ โ€ฒ ๐‘œ โ‰ค 1 + 4๐‘œ 3 โ‰ค 2 Similarly: ๐น โ„Ž โˆ’1 ๐‘ง โ€ฒ โ‰ค 2 , ๐น โ„Ž โˆ’1 ๐‘จ โ€ฒ โ‰ค 2 ๐น โ„Ž โˆ’1 ๐‘ฆ โ€ฒ โˆช โ„Ž โˆ’1 ๐‘ง โ€ฒ โˆช โ„Ž โˆ’1 ๐‘จ โ€ฒ โ‰ค ๐‘ƒ(1) (linearity of expectation) In expectation, algorithm manually checks constant number of candidate witnesses per iteration 10/19 June 16, 2016

  11. Convolution 3SUM Given array ๐ต 1 โ€ฆ ๐‘œ of integers are there ๐‘—, ๐‘˜ such that ๐ต ๐‘— + ๐ต ๐‘˜ = ๐ต[๐‘— + ๐‘˜] ? ๐‘ฆ + ๐‘ง ๐‘ฆ ๐‘ง ๐‘— ๐‘˜ ๐‘— + ๐‘˜ trivial algorithm: ๐‘ƒ(๐‘œ 2 ) Thm: There is no ๐‘ƒ(๐‘œ 2โˆ’๐œ— ) algorithm for Convolution 3SUM unless the 3SUM Conjecture fails. [ Pฤƒtraศ™cu 2010] Stepping stone towards hardness of other โ€œstructuredโ€ problems 11/19 June 16, 2016

  12. Reduction from 3SUM Given set ๐‘Œ โŠ† [๐‘‰] of integers are there ๐‘ฆ, ๐‘ง, ๐‘จ โˆˆ ๐‘Œ such that ๐‘ฆ + ๐‘ง = ๐‘จ ? Preprocessing: Check if there is a solution 2๐‘ฆ = ๐‘จ ๐‘ƒ ๐‘œ log ๐‘œ Pick random hash function โ„Ž: ๐‘‰ โ†’ ๐‘† (almost linear, etc.) For this proof: assume โ„Ž is almost balanced and linear (magicallyโ€ฆ) 3๐‘œ/๐‘† โ‹ฎ 1 2 โ‹ฏ 1 ๐‘† In expectation: ๐‘ƒ ๐‘† elements in buckets with load > 3๐‘œ/๐‘† (almost bal.) For each such ๐‘ฆ : check for 3SUM triple involving ๐‘ฆ ๐‘ƒ ๐‘†๐‘œ (in exp.) 12/19 June 16, 2016

  13. Convolution 3SUM instance 3๐‘œ Number elements in each bucket from 0 to ๐‘† โˆ’ 1 Iterate over all triples ๐‘—, ๐‘˜, ๐‘™ โˆˆ 3๐‘œ/๐‘† ๐‘— ๐‘˜ ๐‘™ ๐‘ข โ‹ฏ ๐‘† 1 โ‹ฏ โ‹ฏ โ‹ฏ For every bucket ๐‘ข : Put ๐‘— -th element to ๐ต[8๐‘ข + 1] โ€ข Put ๐‘˜ -th element to ๐ต[8๐‘ข + 3] โ€ข โ€ข Put ๐‘™ -th element to ๐ต[8๐‘ข + 4] Set all other array entries to โˆž (sufficiently large number) 3 3๐‘œ instances of Convolution 3SUM ๐‘† 13/19 June 16, 2016

  14. Correctness Assume ๐‘ฆ + ๐‘ง = ๐‘จ Then โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘จ (mod ๐‘†) (linearity) If ๐‘ฆ = ๐‘ง , triple found in preprocessing If ๐‘ฆ , ๐‘ง , or ๐‘จ hashed to heavy bucket: triple found in second step Either โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘จ or โ„Ž ๐‘ฆ + โ„Ž ๐‘ง = โ„Ž ๐‘จ + ๐‘† Duplicate array for Convolution 3SUM instance ๐ต 8โ„Ž ๐‘ฆ + 1 + ๐ต 8โ„Ž ๐‘ง + 3 = ๐ต 8โ„Ž ๐‘จ + 4 or ๐ต 8โ„Ž ๐‘ฆ + 1 + ๐ต 8โ„Ž ๐‘ง + 3 = ๐ต 8(โ„Ž ๐‘จ + ๐‘†) + 4 Thus, no false negatives. Also no false positives: ๐ต ๐‘— + ๐ต ๐‘˜ = ๐ต ๐‘— + ๐‘˜ only if ๐‘— = 8๐‘ข 1 + 1 and ๐‘˜ = 8๐‘ข 2 + 3 Observation: ( ๐‘ฆ + ๐‘ง = ๐‘จ mod 8 has unique solution over 1,3,4 and ๐ต ๐‘— โ‰  ๐ต[๐‘˜] )

  15. Running Time Assumption: Convolution 3SUM in time ๐‘ƒ(๐‘œ 2โˆ’๐œ— ) 3 ๐‘œ ๐‘œ 2โˆ’๐œ— Total expected running time: ๐‘ƒ ๐‘œ log ๐‘œ + ๐‘œ๐‘† + ๐‘† Set ๐‘† = ๐‘œ 1โˆ’๐œ—/4 Total time: ๐‘ƒ ๐‘œ 2โˆ’๐œ—/4 Contradicts 3SUM Conjecture

  16. Set Disjointness Problem 1. Preprocess subsets ๐’, โ„ฌ โŠ† ๐‘‰ over universe ๐‘‰ 2. Answer queries : Given ๐ต โˆˆ ๐’, ๐ถ โˆˆ โ„ฌ , is ๐ต โˆฉ ๐ถ โ‰  โˆ… ? Repeated queries (Static) data structure Queries not known in advance Goal: Lower bound on preprocessing and query time Offline Set Disjointness: ๐‘Ÿ queries known in advance (part of input)

  17. Reduction to 3SUM [Kopelowitz et al] Thm: Let ๐‘” ๐‘œ be such that 3SUM requires expected time ฮฉ ๐‘œ 2 /๐‘”(๐‘œ) . For any constant 0 โ‰ค ๐›ฟ < 1 , let ALG be an algorithm for offline Set Disjointness where ๐’ = โ„ฌ = ฮ˜(๐‘œ log ๐‘œ) , ๐‘‰ = ฮ˜ ๐‘œ 2โˆ’2๐›ฟ , each set in ๐’ โˆช โ„ฌ has at most ๐‘ƒ(๐‘œ 1โˆ’๐›ฟ ) elements from ๐‘‰ , and ๐‘Ÿ = ฮ˜ ๐‘œ 1+๐›ฟ log ๐‘œ . Then ALG requires expected time ฮฉ ๐‘œ 2 /๐‘”(๐‘œ) . Assuming the 3SUM conjecture, for any 0 < ๐›ฟ < 1 , any data Cor: structure for Set Disjointness has 1+๐›ฟ 2 2โˆ’๐›ฟโˆ’๐‘(1) ๐‘ข ๐‘ž + ๐‘‚ 2โˆ’๐›ฟ ๐‘ข ๐‘Ÿ = ฮฉ ๐‘‚ where ๐‘‚ is the sum of the set sizes, ๐‘ข ๐‘ž is the preprocessing time, and ๐‘ข ๐‘Ÿ is the time per query. (From Thm: ๐‘‚ = ฮ˜ ๐‘œ 2โˆ’๐›ฟ log ๐‘œ ) Example: Data structures with constant query time Make ๐›ฟ tend to 1 , need ๐‘ข ๐‘ž = ฮฉ ๐‘‚ 2โˆ’๐‘(1) Evidence that trivial preprocessing algorithm is optimal (for constant query)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend