23
11/10/2020 Sublinear Algorithms LECTURE 19 Last time β€’ Testing linearity of Boolean functions [Blum Luby Rubinfeld] Today β€’ Testing linearity β€’ Tolerant testing and distance approximation Sofya Raskhodnikova; Boston University Thanks to Madhav Jha (Penn State) for help with creating these slides.

LECTURE 19 Last time - Boston University

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

11/10/2020

Sublinear Algorithms

LECTURE 19Last timeβ€’ Testing linearity of Boolean functions

[Blum Luby Rubinfeld]

Todayβ€’ Testing linearity

β€’ Tolerant testing and distance approximation

Sofya Raskhodnikova; Boston University

Thanks to Madhav Jha (Penn State) for help with creating these slides.

Testing If a Boolean Function Is Linear

2

Input: Boolean function 𝑓: 0,1 𝑛 β†’ {0,1}

Question:

Is the function linear or πœ€-far from linear

(β‰₯ πœ€2𝑛 values need to be changed to make it linear)?

Today: can answer in 𝑂1

πœ€time

Linearity Test [Blum Luby Rubinfeld 90]

3

1. Pick 𝒙 and π’š independently and uniformly at random from 0,1 𝑛.

2. Set 𝒛 = 𝒙 + π’š and query 𝑓on 𝒙, π’š, and 𝒛. Accept iff 𝑓 𝒛 = 𝑓 𝒙 + 𝑓 π’š .

Analysis

If 𝑓is linear, BLR always accepts.

If 𝑓 is πœ€-far from linear then > πœ€ fraction of pairs 𝒙 and π’š fail BLR test.

β€’ Then, by Witness Lemma (Lecture 1), 2/πœ€ iterations suffice.

BLR Test (Ξ΅, query access to 𝑓)

Correctness Theorem [Bellare Coppersmith Hastad Kiwi Sudan 95]

Analysis Technique: Fourier Expansion

Representing Functions as Vectors

Stack the 2𝑛 values of 𝑓(𝒙) and treat it as a vector in {0,1}2𝑛

.

𝑓 =

01101β‹…β‹…β‹…100

𝑓(0000)𝑓(0001)𝑓(0010)𝑓(0011)𝑓(0100)

β‹…β‹…β‹…

𝑓(1101)𝑓(1110)𝑓(1111)

5

Linear functions

There are 2𝑛 linear functions: one for each subset 𝑆 βŠ† [𝑛].

πœ’βˆ… =

00000β‹…β‹…β‹…000

, πœ’ 1 =

01010β‹…β‹…β‹…101

, β‹―β‹―, πœ’ 𝑛 =

01101β‹…β‹…β‹…100

6

Parity on the positions indexed by set 𝑆 is πœ’π‘† π‘₯1, … , π‘₯𝑛 =

π‘–βˆˆS

π‘₯𝑖

Great Notational Switch

Idea: Change notation, so that we work over reals instead of a finite field.

β€’ Vectors in 0,1 2𝑛 ⟢ Vectors in ℝ2𝑛.

β€’ 0/False ⟢ 1 1/True ⟢ -1.

β€’ Addition (mod 2) ⟢ Multiplication in ℝ.

β€’ Boolean function: 𝑓 ∢ βˆ’1, 1 𝑛 β†’ {βˆ’1,1}.

β€’ Linear function πœ’π‘†βˆΆ βˆ’1, 1 𝑛 β†’ {βˆ’1,1} is given by πœ’π‘† 𝒙 = Ο‚π‘–βˆˆπ‘† π‘₯𝑖.

7

Benefits of New Notation

𝑓, 𝑔 =1

2𝑛dot product of 𝑓 and 𝑔 as vectors

= avgπ’™βˆˆ βˆ’1,1 𝑛

𝑓 𝒙 𝑔 𝒙 = π”Όπ’™βˆˆ βˆ’1,1 𝑛

[ 𝑓 𝒙 𝑔 𝒙 ].

𝑓, 𝑔 = 1 βˆ’ 2 β‹… (fraction of disagreements between 𝑓 and 𝑔)

8

Inner product of functions 𝑓, 𝑔 ∢ βˆ’1, 1 𝑛 β†’ {βˆ’1, 1}

The functions πœ’π‘† π‘†βŠ† 𝑛 form an orthonormal basis for ℝ2𝑛.Claim.

Idea: Work in the basis πœ’π‘† π‘†βŠ† 𝑛 , so it is easy to see how close a specific

function 𝑓 is to each of the linear functions.

Every function 𝑓 ∢ βˆ’1, 1 𝑛 β†’ ℝ is uniquely expressible as a linear combination (over ℝ) of the 2𝑛 linear functions:

where αˆ˜π‘“ 𝑆 = 𝑓, πœ’π‘† is the Fourier Coefficient of 𝑓 on set 𝑆.

Fourier Expansion Theorem

9

Fourier Expansion Theorem

𝑓 =

π‘†βŠ† 𝑛

αˆ˜π‘“ 𝑆 πœ’π‘†,

Parseval Equality

10

Parseval Equality for Boolean Functions

Let 𝑓: βˆ’1, 1 𝑛 β†’ βˆ’1, 1 . Then

𝑓, 𝑓 =

π‘†βŠ† 𝑛

αˆ˜π‘“ 𝑆 2 = 1

Vector product notation: 𝒙 ∘ π’š = (π‘₯1𝑦1, π‘₯2𝑦2, … , π‘₯𝑛𝑦𝑛)

Proof: Indicator variable πŸ™π΅πΏπ‘… = α‰Š1 if BLR accepts0 otherwise

πŸ™π΅πΏπ‘… =1

2+

1

2𝑓 𝒙 𝑓 π’š 𝑓 𝒛 .

Pr𝒙,π’šβˆˆ βˆ’1,1 𝑛

BLR 𝑓 accepts = 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

πŸ™π΅πΏπ‘… =1

2+1

2𝔼

𝐱,𝐲∈ βˆ’1,1 𝑛𝑓 𝒙 𝑓 π’š 𝑓 𝒛

BLR Test in {-1,1} Notation

11

BLR Test (f, Ξ΅)

1. Pick 𝒙 and π’š independently and uniformly at random from βˆ’1,1 𝑛.

2. Set 𝒛 = 𝒙 ∘ π’š and query 𝑓 on 𝒙, π’š, and 𝒛. Accept iff 𝑓 𝒙 𝑓 π’š 𝑓 𝒛 = 1.

Pr𝐱,𝐲∈ βˆ’1,1 𝑛

BLR 𝑓 accepts =1

2+1

2

π‘†βŠ†[𝑛]

αˆ˜π‘“ 𝑆 3Sum-Of-Cubes Lemma.

By linearity of expectation

So far: Pr𝐱,𝐲∈ βˆ’1,1 𝑛

BLR 𝑓 accepts =1

2+

1

2E

𝐱,𝐲∈ βˆ’1,1 𝑛𝑓 𝒙 𝑓 π’š 𝑓 𝒛

Next:

Proof of Sum-Of-Cubes Lemma

12

=

𝑆,𝑇,π‘ˆβŠ†[𝑛]

αˆ˜π‘“ 𝑆 αˆ˜π‘“ 𝑇 αˆ˜π‘“ π‘ˆ 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

[πœ’π‘†(𝒙)πœ’π‘‡(π’š)πœ’π‘ˆ(𝒛)]

= 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

𝑆,𝑇,π‘ˆβŠ†[𝑛]

αˆ˜π‘“ 𝑆 αˆ˜π‘“ 𝑇 αˆ˜π‘“ π‘ˆ πœ’π‘†(𝒙)πœ’π‘‡(π’š)πœ’π‘ˆ(𝒛)

𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

𝑓 𝒙 𝑓 π’š 𝑓 𝒛

= 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

π‘†βŠ†[𝑛]

αˆ˜π‘“ 𝑆 πœ’π‘†(𝒙)

π‘‡βŠ†[𝑛]

αˆ˜π‘“ 𝑇 πœ’π‘‡(π’š)

π‘ˆβŠ†[𝑛]

αˆ˜π‘“ π‘ˆ πœ’π‘ˆ(𝒛)

By Fourier Expansion Theorem

Distributing out the product of sums

By linearity of expectation

Pr𝐱,𝐲∈ βˆ’1,1 𝑛

BLR 𝑓 accepts

β€’ Let 𝑆Δ𝑇denote symmetric difference of sets 𝑆 and 𝑇

Proof of Sum-Of-Cubes Lemma (Continued)

13

a= 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

Ο‚π‘–βˆˆπ‘† π‘₯π‘–Ο‚π‘–βˆˆπ‘‡ π‘¦π‘–Ο‚π‘–βˆˆπ‘ˆ π‘₯𝑖𝑦𝑖

a= 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

Ο‚π‘–βˆˆπ‘†Ξ”π‘ˆ π‘₯π‘–Ο‚π‘–βˆˆπ‘‡Ξ”π‘ˆ 𝑦𝑖

a= π”Όπ±βˆˆ βˆ’1,1 𝑛

Ο‚π‘–βˆˆπ‘†Ξ”π‘ˆ π‘₯𝑖 β‹… π”Όπ²βˆˆ βˆ’1,1 𝑛

Ο‚π‘–βˆˆπ‘†Ξ”π‘ˆ 𝑦𝑖

a= Ο‚π‘–βˆˆπ‘†Ξ”π‘ˆ π”Όπ±βˆˆ βˆ’1,1 𝑛

[π‘₯𝑖] β‹… Ο‚π‘–βˆˆπ‘‡Ξ”π‘ˆ π”Όπ²βˆˆ βˆ’1,1 𝑛

[𝑦𝑖]

a 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

[πœ’π‘†(𝒙)πœ’π‘‡(π’š)πœ’π‘ˆ(𝒛)]

= α‰Š1 when π‘†Ξ”π‘ˆ = βˆ… and π‘‡Ξ”π‘ˆ = βˆ… ⇔ 𝑆 = 𝑇 = π‘ˆ0 otherwise

a= 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

Ο‚π‘–βˆˆπ‘† π‘₯π‘–Ο‚π‘–βˆˆπ‘‡ π‘¦π‘–Ο‚π‘–βˆˆπ‘ˆ 𝑧𝑖

=1

2+1

2

𝑆,𝑇,π‘ˆβŠ†[𝑛]

𝑓 𝑆 𝑓 𝑇 𝑓 π‘ˆ 𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

[πœ’π‘†(𝒙)πœ’π‘‡(π’š)πœ’π‘ˆ(𝒛)]

Since π‘₯𝑖2 = 𝑦𝑖

2 = 1

Since 𝐱 and 𝐲 are independent

Since 𝐳 = 𝐱 ∘ 𝐲

Since 𝐱 and 𝐲′s coordinatesare independent

a= Ο‚π‘–βˆˆπ‘†Ξ”π‘ˆ 𝔼π‘₯π‘–βˆˆ{βˆ’1,1}

[π‘₯𝑖] β‹… Ο‚π‘–βˆˆπ‘‡Ξ”π‘ˆ π”Όπ‘¦π‘–βˆˆ{βˆ’1,1}

[𝑦𝑖]

𝔼𝐱,𝐲∈ βˆ’1,1 𝑛

[πœ’π‘†(𝒙)πœ’π‘‡(π’š)πœ’π‘ˆ(𝒛)] is 1 if 𝑆 = 𝑇 = π‘ˆ and 0 otherwise.Claim.

Proof of Sum-Of-Cubes Lemma (Done)

14

=1

2+1

2

π‘†βŠ†[𝑛]

αˆ˜π‘“ 𝑆 3

Pr𝐱,𝐲∈ βˆ’1,1 𝑛

BLR 𝑓 accepts =1

2+1

2

π‘†βŠ†[𝑛]

αˆ˜π‘“ 𝑆 3Sum-Of-Cubes Lemma.

Pr𝐱,𝐲∈ βˆ’1,1 𝑛

BLR 𝑓 accepts =1

2+1

2

𝑆,𝑇,π‘ˆβŠ†[𝑛]

𝑓 𝑆 𝑓 𝑇 𝑓 π‘ˆ E𝐱,𝐲∈ βˆ’1,1 𝑛

[πœ’π‘†(𝒙)πœ’π‘‡(π’š)πœ’π‘ˆ(𝒛)]

Proof of Correctness Theorem

Proof: Suppose to the contrary that

β€’ Then maxπ‘†βŠ† 𝑛

αˆ˜π‘“ 𝑆 > 1 βˆ’ 2πœ€. That is, αˆ˜π‘“ 𝑇 > 1 βˆ’ 2πœ€ for some 𝑇 βŠ† 𝑛 .

β€’ But αˆ˜π‘“ 𝑇 = 𝑓, πœ’π‘‡ = 1 βˆ’ 2 β‹… (fraction of disagreements between 𝑓 and πœ’π‘‡)

β€’ 𝑓 disagrees with a linear function πœ’π‘‡ on < πœ€ fraction of values.

15

By Sum-Of-Cubes Lemma

Since αˆ˜π‘“ 𝑆 2 β‰₯ 0

Parseval Equality

Correctness Theorem (restated)

If 𝑓 is Ξ΅-far from linear then Pr BLR 𝑓 accepts ≀ 1 βˆ’ πœ€.

=1

2+1

2

π‘†βŠ†[𝑛]

αˆ˜π‘“ 𝑆 3

≀1

2+1

2β‹… max

π‘†βŠ† π‘›αˆ˜π‘“ 𝑆 β‹…

π‘†βŠ† 𝑛

αˆ˜π‘“ 𝑆 2

=1

2+1

2β‹… max

π‘†βŠ† π‘›αˆ˜π‘“ 𝑆

1 βˆ’ πœ€ < Pr𝐱,𝐲∈ βˆ’1,1 𝑛

BLR 𝑓 accepts

⨳

Summary

BLR tests whether a function 𝑓: 0,1 𝑛 β†’ {0,1} is

linear or πœ€-far from linear

(β‰₯ πœ€2𝑛 values need to be changed to make it linear)

in 𝑂1

πœ€time.

16

17

Tolerant Property Tester

Far from

YES

YES

Reject with probability 2/3

Don’t care

Accept with probability β‰₯ 𝟐/πŸ‘

Tolerant Property Testing [Parnas Ron Rubinfeld]

Two objects are at distance πœ€ = they differ in an πœ€ fraction of places

Equivalent problem: approximating distance to the property with

additive error.

Property Tester

Close to YES

Far from

YES

YES

Reject with probability 2/3

Don’t care

Accept with probability β‰₯ 𝟐/πŸ‘

πœ€ πœ€1πœ€2

Distance Approximation to Property π“Ÿ

Input: Parameter πœ€ ∈ (0,1/2] and query access to an object 𝑓𝑑𝑖𝑠𝑑 𝑓,π“Ÿ = min

π‘”βˆˆπ“Ÿπ‘‘π‘–π‘ π‘‘ 𝑓, 𝑔

𝑑𝑖𝑠𝑑 𝑓, 𝑔 = fraction of representation on which 𝑓 and 𝑔 differ

Output: An estimate ΖΈπœ€ such that w.p. β‰₯2

3

ΖΈπœ€ βˆ’ 𝑑𝑖𝑠𝑑(𝑓,π“Ÿ) ≀ πœ€

18

Approximating Distance to Monotonicity for 0/1 Sequences

19

Input: Parameter πœ€ ∈ (0,1/2] and

a list of 𝑛 zeros and ones (equivalently, 𝑓: 𝑛 β†’ {0,1})

Question: How far is this list to being sorted?

(Equivalently, how far is 𝑓 from monotone?)

dist 𝑓,𝑀𝑂𝑁𝑂 =distance from 𝑓 to monotone

Dist 𝑓,𝑀𝑂𝑁𝑂 = 𝑛 β‹… dist 𝑓,𝑀𝑂𝑁𝑂

Note: Dist 𝑓,𝑀𝑂𝑁𝑂 = 𝑛 βˆ’ 𝐿𝐼𝑆 ,where LIS is the longest increasing subsequence

Output: An estimate ΖΈπœ€ such that w.p. β‰₯2

3

ΖΈπœ€ βˆ’ dist 𝑓,𝑀𝑂𝑁𝑂 ≀ πœ€

Today: can answer in 𝑂1

πœ€2time [Berman Raskhodnikova Yaroslavtsev]

Distance to Monotonicity over POset Domains

β€’ Let 𝑓 be a function over a partially ordered domain 𝐷.

β€’ Violated pair:

β€’ The violation graph 𝐺𝑓 is a directed graph with vertex set 𝐷 whose edge set

is the set of pairs (π‘₯, 𝑦) violated by 𝑓.

β€’ 𝑉𝐢𝑓 is a minimum vertex cover of 𝐺𝑓

β€’ 𝑀𝑀𝑓 is a maximum matching in 𝐺𝑓

20

Characterization of Dist 𝑓,Mono for 𝑓: 𝐷 β†’ 0,1 [FLNRRS 02]Dist 𝑓,Mono = MM𝑓 = |𝑉𝐢𝑓|

01

Distance to Monotonicity for 0/1 Sequences

β€’ Let 𝑓: 𝑛 β†’ 0,1

β€’ Great notation switch: 𝑔𝑖 = βˆ’1 𝑓(𝑖) for 𝑖 ∈ [𝑛]

β€’ Cumulative sums: 𝑠0 = 0 and 𝑠𝑖 = π‘ π‘–βˆ’1 + 𝑔𝑖 for 𝑖 ∈ [𝑛]

β€’ Final sum: 𝑠𝑓 = 𝑠𝑛

β€’ Maximum sum: π‘šπ‘“ = max𝑖=0𝑛 𝑠𝑖

Proof:

1. Construct a matching of that size

2. Construct a vertex cover of that size.

21

dist(𝑓,π‘€π‘œπ‘›π‘œ) for 𝑓: [𝑛] β†’ 0,1 [Berman Raskhodnikova Yaroslavtsev]

Dist 𝑓,Mono =𝑛 βˆ’ 2π‘šπ‘“ + 𝑠𝑓

2

Distance to Monotonicity for 0/1 Sequences

Proof: (1) Construct a matching that leaves 2π‘šπ‘“ βˆ’ 𝑠𝑓 nodes unmatched

22

Characterization dist(𝑓,π‘€π‘œπ‘›π‘œ) for 𝑓: [𝑛] β†’ 0,1

Dist 𝑓,Mono =𝑛 βˆ’ 2π‘šπ‘“ + 𝑠𝑓

2

Distance to Monotonicity for 0/1 Sequences

Proof: (2) Construct a vertex cover.

23

Characterization dist(𝑓,π‘€π‘œπ‘›π‘œ) for 𝑓: [𝑛] β†’ 0,1

Dist 𝑓,Mono =𝑛 βˆ’ 2π‘šπ‘“ + 𝑠𝑓

2