On special families of morphisms related to δ - matching and don ’ t care symbols

14
On special families of morp On special families of morp hisms related to hisms related to δ δ - - matching matching and don’t care symbols and don’t care symbols Information Processing Information Processing Letters (2003) Letters (2003) Richard Cole et al Richard Cole et al

description

On special families of morphisms related to δ - matching and don ’ t care symbols. Information Processing Letters (2003) Richard Cole et al. δ -matching problem. Σ is an interval of integers Pattern P, |P| = m Text T, |T| = n For a, b  Σ , a = δ b if |a-b|≤ δ - PowerPoint PPT Presentation

Transcript of On special families of morphisms related to δ - matching and don ’ t care symbols

Page 1: On special families of morphisms related to  δ - matching and don ’ t care symbols

On special families of morphisms reOn special families of morphisms related to lated to δδ--matching and don’t carmatching and don’t car

e symbolse symbols

Information Processing Letters Information Processing Letters (2003) (2003)

Richard Cole et alRichard Cole et al

Page 2: On special families of morphisms related to  δ - matching and don ’ t care symbols

δδ-matching problem-matching problem

ΣΣ is an interval of integers is an interval of integers Pattern P, |P| = mPattern P, |P| = m Text T, |T| = nText T, |T| = n For a, b For a, b ΣΣ, a =, a =δδ b if |a-b|≤b if |a-b|≤δδ A A δδ-matching occurs in position j when-matching occurs in position j when

|P[i] - T[i+j-1]| ≤|P[i] - T[i+j-1]| ≤δδ for 1≤i≤n for 1≤i≤n P =P =δδ T[j…j+m-1]T[j…j+m-1]

T 2 3 3 4 2 3 4 3 1P 1 4 3 2

Page 3: On special families of morphisms related to  δ - matching and don ’ t care symbols

Pattern-matching with don’t Pattern-matching with don’t care symbolscare symbols

ΣΣ* = * = Σ Σ {*} a≈b if a=b or a=* or b=*a≈b if a=b or a=* or b=* Two strings u, w with |u|=|w|, u≈w iff u[i]Two strings u, w with |u|=|w|, u≈w iff u[i]

≈w[i] for all I≈w[i] for all I Find all positions j such that P≈T[i…j+Find all positions j such that P≈T[i…j+

m-1]m-1]

T * 2 2 2 * 2 2 1 1

P 1 2 2 *

Page 4: On special families of morphisms related to  δ - matching and don ’ t care symbols

Lemma 1.Lemma 1. The problem of pattern-matc The problem of pattern-matching with don’t cares for a pattern P anhing with don’t cares for a pattern P and a text T of length n over an alphabet d a text T of length n over an alphabet ΣΣ can be solved in time O(log|can be solved in time O(log|ΣΣ| * IntMult(n))| * IntMult(n))

Page 5: On special families of morphisms related to  δ - matching and don ’ t care symbols

Relation between Relation between δδ-matching and -matching and pattern matching with don’t carpattern matching with don’t car

eses For small alphabet For small alphabet δδ-matching is at least as dif-matching is at least as dif

ficult as matching with don’t caresficult as matching with don’t cares Theorem 2.Theorem 2. String matching with don’t cares for bin String matching with don’t cares for bin

ary alphabets {a, b} is reducible to ary alphabets {a, b} is reducible to δδ-matching for th-matching for the alphabet e alphabet ΣΣ={1, 2, 3}={1, 2, 3} a ba b

**

a b ca b c

** ????

Page 6: On special families of morphisms related to  δ - matching and don ’ t care symbols

Reduction from Reduction from δδ-matching to pat-matching to pattern matching with don’t carestern matching with don’t cares

Given P, T, Given P, T, δδ, find k symbol-to-symbol encodings , find k symbol-to-symbol encodings hh11,…,h,…,hk k to reduce itto reduce it

T 2 3 3 4 2 3 4 3 1P 1 4 3 2

ΣΣ 11 22 33 44

h1h1 11 11 ** 22

h2h2 11 ** 22 22

T 1 * * 2 1 * 2 * 1P 1 2 * 1 P 1 2 * 1P 1 2 * 1P 1 2 * 1

T * 2 2 2 * 2 2 1 1P 1 2 2 *

Page 7: On special families of morphisms related to  δ - matching and don ’ t care symbols

δδ- distinguishing families of morphisms- distinguishing families of morphisms

H = {hH = {h11, h, h22, …, h, …, hkk}, h}, hii::ΣΣΣΣii {*} H is δ-distingushing iff a, b Σ [a

=δ b] ≡[(hH) h(a)≈h(b)] Mδ(P,T)={j | P=δT[j…j+m-1]} D(P,T)={j | P≈T[j…j+m-1]} Mδ(P,T)=D(h1(P),h1(T))∩…∩D(hk(P), hk(T))

Page 8: On special families of morphisms related to  δ - matching and don ’ t care symbols

δ-regular family

H is a H is a δ- regular family iff it satisfies P1 : each morphism is a form h=**…*11…1**…*22…2**…*33…**.. The internal blocks of *’s are exactly of length δ, the bou

ndary blocks of *’s are of length at most δ P2 : For p, q Σsuch that q – p > δ there exists hH su

ch that h(p)=i, h(q)=j > i, and h(r)=* for some p < r <qΣΣ 11 22 33 44

h1h1 11 11 ** 22

h2h2 11 ** 22 22

δ=1

Page 9: On special families of morphisms related to  δ - matching and don ’ t care symbols

Lemma 3.Lemma 3. If a family is If a family is δδ- regular then it is a - regular then it is a δδ-distinguishing family-distinguishing family

<proof idea><proof idea>δ-distingushing iff a, b Σ[a =δ b] ≡[(hH) h(a)≈h(b)] <proof>: consider p, q <proof>: consider p, q Σ and p < q case 1 : if p =δq case 2 : if p≠δq

Page 10: On special families of morphisms related to  δ - matching and don ’ t care symbols

δδ=3=3

Theorem 4. Theorem 4. The size of minimal The size of minimal δδ-distinguising fam-distinguising family of morphisms is at most 2ily of morphisms is at most 2δδ+1:+1:αα((δδ))≤≤22δδ+1+1 # * in each column is at most # * in each column is at most δδ if p-q>if p-q>δδ then for every i there is a symbol between p, q in h then for every i there is a symbol between p, q in h ii

Page 11: On special families of morphisms related to  δ - matching and don ’ t care symbols

Lemma 5.Lemma 5. The size of a minimal 3-disting The size of a minimal 3-distinguishing family of morphisms is at most 6:uishing family of morphisms is at most 6:αα(3)(3)≤≤66 F={{1,2,3},{1,2,4},{1,3,5},{1,4,6},{2,3,4},{2,3,6},F={{1,2,3},{1,2,4},{1,3,5},{1,4,6},{2,3,4},{2,3,6},

{2,4,5},{2,5,6},{3,4,5},{3,4,6}}{2,4,5},{2,5,6},{3,4,5},{3,4,6}}

Page 12: On special families of morphisms related to  δ - matching and don ’ t care symbols

Special caseSpecial case

Theorem 6.Theorem 6. If k is divisible by 3, then If k is divisible by 3, then αα((δδ))≤ 2≤ 2δδ αα(r *(r *δδ))≤≤ r * r *αα((δδ))

Expand hExpand hii to r times to r times Cyclically shift by j, 1≤j<rCyclically shift by j, 1≤j<r

By Lemma, By Lemma, αα(3*r)≤6r(3*r)≤6r

Page 13: On special families of morphisms related to  δ - matching and don ’ t care symbols

Lower boundLower bound

Theorem 7.Theorem 7. The size of a minimal The size of a minimal δδ-disti-distinguishing family of morphisms is at leasnguishing family of morphisms is at least t δδ+2:+2:αα((δδ) ) ≥δ≥δ+ 2+ 2

Page 14: On special families of morphisms related to  δ - matching and don ’ t care symbols

Claim.Claim. If there is a If there is a δδ-distinguishing famil-distinguishing family of size k, then there exists a y of size k, then there exists a δδ-regular f-regular family of k morphismsamily of k morphisms