Sublinear Algorithms L ECTURE 2 Last time • Introduction • Basic models for sublinear-time computation • Simple examples of sublinear algorithms Today • Properties of lists and functions. • Testing if a list is sorted/Lipschitz and if a function is monotone. 9/9/2020 Sofya Raskhodnikova;Boston University
Reminders HW1 is due Thursday at 10am It is posted on the course webpage: https://cs-people.bu.edu/sofya/sublinear-course/ Use Piazza for questions and discussions Office hours (on zoom): Wednesdays, 1:00PM-2:30PM 2
Testing if a List is Sorted Input: a list of n numbers x 1 , x 2 ,..., x n • Question: Is the list sorted? Requires reading entire list: (n) time • Approximate version: Is the list sorted or ² -far from sorted? (An ² fraction of x i ’s have to be changed to make it sorted.) [Ergün Kannan Kumar Rubinfeld Viswanathan 98, Fischer 01]: O((log n)/ ² ) time (log n) queries • Best known bounds: Θ (log ( 𝜁𝑜 )/ 𝜁) time [Belovs, Chakrabarty Dixit Jha Seshadhri 15] 3
Testing Sortedness: Attempts 1. Test : Pick a random 𝑗 and reject if 𝑦 𝑗 > 𝑦 𝑗+1 Fails on: 1 1 1 1 0 0 0 0 Ã 1/2-far from sorted 2. Test : Pick random 𝑗 < 𝑘 and reject if 𝑦 𝑗 > 𝑦 𝑘 Fails on: Ã 1/2-far from sorted 1 0 2 1 3 2 4 3 5 4 4
Is a list sorted or ² -far from sorted? Idea: Associate positions in the list with vertices of the directed line. … … 1 2 3 … n -1 n Construct a graph (2-spanner) ≤ n log n edges • by adding a few “shortcut” edges ( i, j ) for i < j • where each pair of vertices is connected by a path of length at most 2 5
Is a list sorted or ² -far from sorted? Test [Dodis Goldreich Lehman Raskhodnikova Ron Samorodnitsky 99] Pick a random edge ( x i ,x j ) from the 2-spanner and reject if x i > x j . 1 2 5 4 3 6 7 5 4 3 x k x i x j Analysis: • Call an edge ( x i ,x j ) violated if x i > x j , and good otherwise. • If x i is an endpoint of a violated edge, call it bad . Otherwise, call it good . Claim 1. All good numbers x i are sorted. Proof: Consider any two good numbers, x i and x j . They are connected by a path of (at most) two good edges ( x i ,x k ), ( x k ,x j ). ) x i ≤ x k and x k ≤ x j ) x i ≤ x j 6
Is a list sorted or ² -far from sorted? Test [Dodis Goldreich Lehman Raskhodnikova Ron Samorodnitsky 99] Pick a random edge ( x i ,x j ) from the 2-spanner and reject if x i > x j . 1 2 5 4 3 6 7 5 4 3 x k x i x j Analysis: • Call an edge ( x i ,x j ) violated if x i > x j , and good otherwise. • If x i is an endpoint of a bad edge, call it bad . Otherwise, call it good . Claim 1. All good numbers x i are sorted. Claim 2. An ² -far list violates ¸ ² /(2 log n) fraction of edges in 2-spanner. Proof: If a list is ² -far from sorted, it has ¸ ² n bad numbers. (Claim 1) • Each violated edge contributes 2 bad numbers. 2-spanner has ¸ ² n/2 violated edges out of · n log n. • 7
Is a list sorted or ² -far from sorted? Test [Dodis Goldreich Lehman Raskhodnikova Ron Samorodnitsky 99] Pick a random edge ( x i ,x j ) from the 2-spanner and reject if x i > x j . 1 2 5 4 3 6 7 5 4 3 x k x i x j Analysis: • Call an edge ( x i ,x j ) violated if x i > x j , and good otherwise. Claim 2. An ² -far list violates ¸ ² /(2 log n) fraction of edges in 2-spanner. By Witness Lemma, it suffices to sample (4 log n )/ ² edges from 2-spanner. Algorithm Sample (4 log n)/ ² edges ( x i ,x j ) from the 2-spanner and reject if x i > x j . Guarantee: All sorted lists are accepted. All lists that are ² -far from sorted are rejected with probability ¸ 2/3. Time: O((log n)/ ² ) 8
Generalization Observation: The same test/analysis apply to any edge-transitive property of a list of numbers that allows extension. • A property is edge-transitive if 1) it can be expressed in terms conditions on ordered pairs of numbers x y 2) it is transitive: whenever (𝑦, 𝑧) and (𝑧, 𝑨) satisfy (1), so does 𝑦, 𝑨 x y z • A property allows extension if 3) any function that satisfies (1) on a subset of the numbers can be extended to a function with the property 9
Testing if a Function is Lipschitz [Jha R] A function f : D R is Lipschitz if it has Lipschitz constant 1: that is, if for all x,y in D , distance R ( f(x),f(y) ) ≤ distance D ( x,y ). Consider f : {1,…, n } R : 1 2 2 3 3 4 5 nodes = points in the domain; edges = points at distance 1 node labels = values of the function The Lipschitz property is edge-transitive : a pair ( x,y ) is good if | f ( y )- f ( x ) | ≤ | y-x | 1. 2. ( x,y ) and ( y,z ) are good ) ( x,z ) is good It also allows extension for the range R . Testing if a function f : {1,…, n } R is Lipschitz takes O ((log n )/ ² ) time. Does the spanner-based test apply if the range is R 2 with Euclidean distances? Z 2 with Euclidean distances? 12
Properties of a List of n Numbers • Sorted or 𝜁 -far from sorted? • Lipschitz (does not change too drastically) or 𝜁 -far from satisfying the Lipschitz property? O(log n/ 𝜁) time This bound is tight (unless 𝜁 is really tiny w.r.t. n) [Chakrabarty Dixit Jha Seshadhri 15] 13
Basic Properties of Functions
Boolean Functions 𝒈 ∶ 𝟏, 𝟐 𝒐 → {𝟏, 𝟐} f(011) Graph representation: f(111) 𝑜 -dimensional hypercube f(010) f(110) f(001) f(101) f(000) f(100) 2 𝑜 vertices: bit strings of length 𝑜 • • 2 𝑜−1 𝑜 edges: (𝑦, 𝑧) is an edge if 𝑧 can be obtained from 𝑦 by increasing one bit from 0 to 1 𝑦 001001 𝑧 011001 • each vertex 𝑦 is labeled with 𝑔(𝑦) 15
Monotonicity of Functions 1 [Goldreich Goldwasser Lehman Ron Samorodnitsky, 0 Dodis Goldreich Lehman Raskhodnikova Ron Samorodnitsky 1 1 Fischer Lehman Newman Raskhodnikova Rubinfeld Samorodnitsky] • A function 𝑔 ∶ 0,1 𝑜 → {0,1} is monotone 1 0 0 if increasing a bit of 𝑦 does not decrease 𝑔(𝑦) . 0 monotone • Is 𝑔 monotone or 𝜁 -far from monotone 0 ( 𝑔 has to change on many points to become monontone)? 0 0 1 – Edge 𝑦 𝑧 is violated by 𝑔 if 𝑔 (𝑦) > 𝑔 (𝑧) . 1 0 1 Time: 1 1 – 𝑃(𝑜/𝜁) , logarithmic in the size of the input, 2 𝑜 2 -far from monotone – Ω( 𝑜/𝜁) for restricted class of tests 3 𝑜 – Advanced techniques: Θ( 𝑜/𝜁 2 ) for nonadaptive tests, Ω [Khot Minzer Safra 15, Chen De Servidio Tang 15, Chen Waingarten Xie 17] 16
Monotonicity Test [GGLRS, DGLRRS] Idea: Show that functions that are far from monotone violate many edges. EdgeTest ( 𝑔 , ε ) Pick 2 𝑜/𝜁 edges (𝑦, 𝑧) uniformly at random from the hypercube. 1. Reject if some 𝑦, 𝑧 is violated (i.e. 𝑔 𝑦 > 𝑔(𝑧)) . Otherwise, accept . 2. Analysis If 𝑔 is monotone, EdgeTest always accepts. • • If 𝑔 is 𝜁 -far from monotone, by Witness Lemma, it suffices to show that 𝜁 𝑜 ⋅ 2 𝑜−1 𝑜 = 𝜁2 𝑜−1 edges) are violated by 𝑔 . ≥ 𝜁/𝑜 fraction of edges (i.e., – Let 𝑊(𝑔) denote the number of edges violated by 𝑔 . Contrapositive: If 𝑊(𝑔) < 𝜁 2 𝑜−1 , 𝑔 can be made monotone by changing < 𝜁 2 𝑜 values. Repair Lemma 𝑔 can be made monotone by changing ≤ 2 ⋅ 𝑊(𝑔) values. 17
Repair Lemma: Proof Idea Repair Lemma 𝑔 can be made monotone by changing ≤ 2 ⋅ 𝑊(𝑔) values. Proof idea: Transform f into a monotone function by repairing edges in one dimension at a time. 18
Repairing Violated Edges in One Dimension Swap violated edges 1 0 in one dimension to 0 1 . 0 0 0 0 j 0 1 i 1 0 Swapping horizontal dimension 0 0 1 1 1 0 0 1 Let 𝑊 𝑘 = # of violated edges in dimension 𝑘 Claim. Swapping in dimension 𝑗 does not increase 𝑊 𝑘 for all dimensions 𝑘 ≠ 𝑗 Enough to prove the claim for squares 19
Proof of The Claim for Squares Claim. Swapping in dimension 𝑗 does not increase 𝑊 𝑘 for all dimensions 𝑘 ≠ 𝑗 j i Swapping horizontal dimension • If no horizontal edges are violated, no action is taken. 20
Proof of The Claim for Squares Claim. Swapping in dimension 𝑗 does not increase 𝑊 𝑘 for all dimensions 𝑘 ≠ 𝑗 j 1 0 0 1 i Swapping horizontal dimension 1 0 0 1 • If both horizontal edges are violated, both are swapped, so the number of vertical violated edges does not change. 21
Proof of The Claim for Squares Claim. Swapping in dimension 𝑗 does not increase 𝑊 𝑘 for all dimensions 𝑘 ≠ 𝑗 j 1 0 0 1 i Swapping horizontal dimension 𝒘 𝒘 𝒘 𝒘 • Suppose one (say, top) horizontal edge is violated. • If both bottom vertices have the same label, the vertical edges get swapped. 22
Proof of The Claim for Squares Claim. Swapping in dimension 𝑗 does not increase 𝑊 𝑘 for all dimensions 𝑘 ≠ 𝑗 j 1 0 0 1 i Swapping horizontal dimension 0 1 0 1 • Suppose one (say, top) horizontal edge is violated. • If both bottom vertices have the same label, the vertical edges get swapped. • Otherwise, the bottom vertices are labeled 0 1, and the vertical violation is repaired. 23
Recommend
More recommend