Finite Fields and String Matching presentation

Post on 23-Oct-2015

6 views 1 download

description

See "Finite Fields and String Matching" document

Transcript of Finite Fields and String Matching presentation

Finite fields and string matching

Andrew MacFieMath 5900 X

String matching

• Input– Text: – Pattern:

• Objective – Find all occurrences of in as substring

Knuth-Morris-Pratt:

Approximate string matching

• What if matches don’t have to be exact?– Allow up to mismatches

• …and if the alphabet contains wildcards?

Clifford et al. approach: use finite field as alphabet

Algorithm

Encode input as finite field elementsSet up systems of equations for mismatch positionsFor to do

Compute Find roots of

End forEncode input as integersVerify that all mismatches are found for each position

Preliminary 1: Convolutions

Fourier Transform

Polynomial multiplication

Convolutions (𝑡⊗𝑝 ) [ 𝑖 ]≝∑𝑗=0

𝑚− 1

𝑝 𝑗 𝑡𝑖+ 𝑗

ℱ {𝑋 ∗𝑌 }=ℱ {𝑋 }⋅ℱ {𝑌 }

• takes time

Preliminary 2: trick

𝑝

𝑡

𝑡⊗𝑝

Compute each in time

Equations for the output

𝑟1 +¿𝑟 2 +¿⋯ +¿𝑟𝑘′ ¿ 𝑠0𝑟1 𝑥1 +¿𝑟2𝑥2 +¿⋯ +¿𝑟𝑘′ 𝑥𝑘′ ¿ 𝑠1𝑟1 𝑥1

2 +¿𝑟2𝑥22 +¿⋯ +¿𝑟𝑘′ 𝑥𝑘′

2 ¿ 𝑠2⋮ ¿ ¿ ¿ 𝑟1𝑥1

2𝑘 ¿

+¿⋯ ¿+¿𝑟𝑘′𝑥𝑘′2𝑘 ¿=¿ 𝑠2𝑘 ¿

𝑠𝑙=∑𝑗=0

𝑚−1

(𝑝 𝑗−𝑡 𝑖+ 𝑗 ) (𝑖+ 𝑗 )𝑙𝑝 𝑗′ 𝑡𝑖+ 𝑗

For each position :

has minimal polynomial

Berlekamp-Massey!

Equations for the output

𝑟1 +¿𝑟 2 +¿⋯ +¿𝑟𝑘′ ¿ 𝑠0𝑟1 𝑥1 +¿𝑟2𝑥2 +¿⋯ +¿𝑟𝑘′ 𝑥𝑘′ ¿ 𝑠1𝑟1 𝑥1

2 +¿𝑟2𝑥22 +¿⋯ +¿𝑟𝑘′ 𝑥𝑘′

2 ¿ 𝑠2⋮ ¿ ¿ ¿ 𝑟1𝑥1

2𝑘 ¿

+¿⋯ ¿+¿𝑟𝑘′𝑥𝑘′2𝑘 ¿=¿ 𝑠2𝑘 ¿

For each position :

Verification step

∑𝑗=0

𝑚−1

(𝑝 𝑗−𝑡 𝑖+ 𝑗 )2𝑝 𝑗

′ 𝑡𝑖+ 𝑗′ =∑

𝑗=1

𝑘′

(𝑝𝑥 𝑗−𝑖−𝑡𝑥 𝑗 )

2?

For each position :

Analysis

• Running time: • Optimal: