efficiently testing simon s congruence
play

Efficiently Testing Simons Congruence l Gawrychowski 1 Maria Kosche 2 - PowerPoint PPT Presentation

Efficiently Testing Simons Congruence l Gawrychowski 1 Maria Kosche 2 Tore Ko 2 Pawe Florin Manea 2 Stefan Siemer 2 1 University of Wroc law 2 G ottingen University September 16, 2020 Subsequences w b a c b a a b a d a


  1. Efficiently Testing Simon’s Congruence l Gawrychowski 1 Maria Kosche 2 Tore Koß 2 Pawe� Florin Manea 2 Stefan Siemer 2 1 University of Wroc� law 2 G¨ ottingen University September 16, 2020

  2. Subsequences w b a c b a a b a d a

  3. Subsequences ababa d bbb ba bc w b a c b a a b a d a baab bb a c aaaaa b

  4. Subsequences ababa d bbb abc ba bc w b a c b a a b a d a baab bb a c aaaaa b

  5. Subsequences ababa d bbb abc ba bc w b a c b a a b a d a baab bb a c aaaaa b

  6. Subsequences i 2 i 3 i k w i 1 · · · Subsequence We call w ′ a subsequence of length k of a word w , where | w | = n , if there exist positions 1 ≤ i 1 < i 2 < . . . < i k ≤ n , such that w ′ = w [ i 1 ] w [ i 2 ] · · · w [ i k ]. Set of Subsequences of length k Let SF ≤ k ( i , w ) denote the set of subsequences of length at most k of w [ i : n ]. Accordingly, the set of subsequences of length at most k of the entire word w will be denoted by SF ≤ k (1 , w ). Example: SF 2 (1 , abaca ) = { aa , ab , ac , ba , bc , ca } SF ≤ 2 (1 , abaca ) = { a , b , c , aa , ab , ac , ba , bc , ca }

  7. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ).

  8. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba

  9. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba SF 2 (1 , w ) = { aa , ab , ac , ba , bb , bc , ca , cb }

  10. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba SF 2 (1 , w ) = { aa , ab , ac , ba , bb , bc , ca , cb } SF 2 (1 , w ′ ) = { aa , ab , ac , ba , bb , bc , ca , cb }

  11. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba SF 2 (1 , w ) = { aa , ab , ac , ba , bb , bc , ca , cb } SF 2 (1 , w ′ ) = { aa , ab , ac , ba , bb , bc , ca , cb } SF 2 (1 , w ) = SF 2 (1 , w ′ ) ⇒ w ∼ 2 w ′

  12. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba

  13. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba ∈ SF 3 (1 , w ) , bbb ∈ SF 3 (1 , w ′ ) bbb /

  14. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba ∈ SF 3 (1 , w ) , bbb ∈ SF 3 (1 , w ′ ) bbb / SF 3 (1 , w ) � = SF 3 (1 , w ′ ) ⇒ w ≁ 3 w ′

  15. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). (ii) Let i , j ∈ w . We define i ∼ k j (w.r.t. w ) if w [ i : n ] ∼ k w [ j : n ], and we say that the positions i and j are k -equivalent. Example: w = abacab , w ′ = baacabba

  16. Simon’s Congruence Simon’s Congruence (i) Let w , w ′ ∈ Σ ∗ . We say that w and w ′ are equivalent under Simon’s congruence ∼ k if SF ≤ k (1 , w ) = SF ≤ k (1 , w ′ ). (ii) Let i , j ∈ w . We define i ∼ k j (w.r.t. w ) if w [ i : n ] ∼ k w [ j : n ], and we say that the positions i and j are k -equivalent. (iii) A word u of length k distinguishes w and w ′ w.r.t. ∼ k if u occurs in exactly one of the sets SF ≤ k (1 , w ) and SF ≤ k (1 , w ′ ). Example: w = abacab , w ′ = baacabba

  17. Problem Definition SimK Given two words s and t over an alphabet Σ, with | s | = n and | t | = n ′ , with n ≥ n ′ , and a natural number k , decide whether s ∼ k t . MaxSimK Given two words s and t over an alphabet Σ, with | s | = n and | t | = n ′ , with n ≥ n ′ , find the maximum k for which s ∼ k t .

  18. History ◮ Line of research originating in the PhD thesis of Imre Simon from 1972 ◮ Long history of algorithm designs and improvements for associated problems. State of the art: SimK optimal linear time [DLT 2020] MaxSimK O ( n log n ) time [DLT 2020]. ◮ Today: an optimal linear-time algorithm for the MaxSimK problem.

  19. Simon-tree Equivalence Classes w i j l SF k ( i, w ) ⊃ SF k ( l, w ) ⊃ SF k ( j, w ) ◮ Splitting a word suffixwise into blocks of equivalence classes w.r.t. ∼ k ◮ If i ∼ k j , then SF k ( i , w ) = SF k ( l , w ) = SF k ( j , w ) and we say that i , l , and j are in the same k-block ◮ ∼ k +1 is a refinement of ∼ k ◮ Index i is a ( k + 1) -splitting position if i ∼ k i + 1 but not i ∼ k +1 i + 1

  20. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions

  21. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions w b a c b a a b a d a

  22. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 1-blocks w b a c b a a b a d a

  23. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 2. Split a k -block into ( k + 1)-blocks by going from right to left through the block (without its last letter) and determine ( k + 1)-splitting positions exactly as for 1-splitting positions. 1-blocks w b a c b a a b a d a

  24. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 2. Split a k -block into ( k + 1)-blocks by going from right to left through the block (without its last letter) and determine ( k + 1)-splitting positions exactly as for 1-splitting positions. 1-blocks w b a c b a a b a d a

  25. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 2. Split a k -block into ( k + 1)-blocks by going from right to left through the block (without its last letter) and determine ( k + 1)-splitting positions exactly as for 1-splitting positions. w b a c b a a b a d a

  26. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 2. Split a k -block into ( k + 1)-blocks by going from right to left through the block (without its last letter) and determine ( k + 1)-splitting positions exactly as for 1-splitting positions. 2-blocks w b a c b a a b a d a

  27. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 2. Split a k -block into ( k + 1)-blocks by going from right to left through the block (without its last letter) and determine ( k + 1)-splitting positions exactly as for 1-splitting positions. 2-blocks w b a c b a a b a d a

  28. Equivalence Classes Use these properties to build a block structure for a word 1. i ∼ 1 j iff alph( w [ i : n ]) = alph( w [ j : n ]) for any i , j ∈ w → We can go from right to left through the word and determine 1-splitting positions 2. Split a k -block into ( k + 1)-blocks by going from right to left through the block (without its last letter) and determine ( k + 1)-splitting positions exactly as for 1-splitting positions. w b a c b a a b a d a

Recommend


More recommend