rithm algo resentation rep · rithm algo compact resentation rep observations on ressed comp...

31

Upload: others

Post on 17-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationObservations On Compressed Pattern-Mat hingwith Ranked Variables in Zimin WordsRadosªaw Gªowi«ski, Woj ie h RytterFa ulty of Mathemati s and Computer S ien e, Ni olaus Coperni us University,Department of Math/Inf. Warsaw UniversityPrague, 29 August 2011

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 2: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationWe onsider words over a �nite alphabet A = {a, b, , ..., 0, 1, 2...},

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 3: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationWe onsider words over a �nite alphabet A = {a, b, , ..., 0, 1, 2...},and patterns over a �nite alphabet V = {α, β, γ, ...}.

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 4: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationWe onsider words over a �nite alphabet A = {a, b, , ..., 0, 1, 2...},and patterns over a �nite alphabet V = {α, β, γ, ...}.We are interested in o uren es of a pattern in a text, ie.α β αa ︷︸︸︷bba ︷︸︸︷ a ︷︸︸︷bba ab

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 5: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationWe onsider words over a �nite alphabet A = {a, b, , ..., 0, 1, 2...},and patterns over a �nite alphabet V = {α, β, γ, ...}.We are interested in o uren es of a pattern in a text, ie.α β αa ︷︸︸︷bba ︷︸︸︷ a ︷︸︸︷bba abDe�nitionPattern p is avoidable if there exist an in�nite word that doesn'ten ounter p.

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 6: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationWe onsider words over a �nite alphabet A = {a, b, , ..., 0, 1, 2...},and patterns over a �nite alphabet V = {α, β, γ, ...}.We are interested in o uren es of a pattern in a text, ie.α β αa ︷︸︸︷bba ︷︸︸︷ a ︷︸︸︷bba abDe�nitionPattern p is avoidable if there exist an in�nite word that doesn'ten ounter p.Example: pattern αα is avoidable, be ause there exist square-freein�nite word.Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 7: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationThere exists an exponential algorithm solving pattern avoidabilityproblem (Bean, Ehrenfeu ht, M Nulty 1979; Zimin 1982).

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 8: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationThere exists an exponential algorithm solving pattern avoidabilityproblem (Bean, Ehrenfeu ht, M Nulty 1979; Zimin 1982).De�nition (Zimin Words)µ : 1 → 121, i → i + 1 ∀ i > 1Z1 = 1Z2 = 1 2 1Z3 = 1 2 1 3 1 2 1Z4 = 121312141213121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 9: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationThere exists an exponential algorithm solving pattern avoidabilityproblem (Bean, Ehrenfeu ht, M Nulty 1979; Zimin 1982).De�nition (Zimin Words)µ : 1 → 121, i → i + 1 ∀ i > 1Z1 = 1Z2 = 1 2 1Z3 = 1 2 1 3 1 2 1Z4 = 121312141213121TheoremPattern p is unavoidable ⇔ p o urs in Z#alph(p).Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 10: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationDe�nitionRank of a variable is the highest number in Zimin subword to whi hthis variable morphs.α β γ β

︷︸︸︷1 ︷︸︸︷21 ︷︸︸︷31 ︷︸︸︷21 = Z3Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 11: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationProblemInput: given a pattern π with k variables and the ranking sequen e.

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 12: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationProblemInput: given a pattern π with k variables and the ranking sequen e.Output: an instan e of an o urren e of π in Zk with the givenranking fun tion, or information that there is no su h valuation.

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 13: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1δ α γ β λ γ α δ α γ β α

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 14: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 15: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1λ

︷︸︸︷121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 16: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 17: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δ λ δ︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 18: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δγ↓ λγ↓ δγ↓︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 19: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δγ↓ λγ↓ δγ↓︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

δ γ λ γ δ γ121 ︷︸︸︷3 ︷︸︸︷121 ︷︸︸︷4 ︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 20: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δγ↓ λγ↓ δγ↓︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

δ γ β↓ λ γ δ γβ↓121 ︷︸︸︷3 ︷︸︸︷121 ︷︸︸︷4 ︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 21: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δγ↓ λγ↓ δγ↓︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

δ γ β↓ λ γ δ γβ↓121 ︷︸︸︷3 ︷︸︸︷121 ︷︸︸︷4 ︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121δ γ β λ γ δ γ β1213 ︷︸︸︷1214 ︷︸︸︷1213 ︷︸︸︷121 ︷︸︸︷5 ︷︸︸︷1213 ︷︸︸︷1214 ︷︸︸︷1213 ︷︸︸︷121Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 22: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δγ↓ λγ↓ δγ↓︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

δ γ β↓ λ γ δ γβ↓121 ︷︸︸︷3 ︷︸︸︷121 ︷︸︸︷4 ︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121δ α↓ γ β λ γ α↓ δ α↓ γ βα↓1213 ︷︸︸︷1214 ︷︸︸︷1213 ︷︸︸︷121 ︷︸︸︷5 ︷︸︸︷1213 ︷︸︸︷1214 ︷︸︸︷1213 ︷︸︸︷121Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 23: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representation 4 1 3 2 5 3 1 4 1 3 2 1λ↓ δ α γ β λ γ α δ α γ β α︷︸︸︷1δ↓λδ↓︷︸︸︷121

δγ↓ λγ↓ δγ↓︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121

δ γ β↓ λ γ δ γβ↓121 ︷︸︸︷3 ︷︸︸︷121 ︷︸︸︷4 ︷︸︸︷121 ︷︸︸︷3 ︷︸︸︷121δ α↓ γ β λ γ α↓ δ α↓ γ βα↓1213 ︷︸︸︷1214 ︷︸︸︷1213 ︷︸︸︷121 ︷︸︸︷5 ︷︸︸︷1213 ︷︸︸︷1214 ︷︸︸︷1213 ︷︸︸︷121

δ α γ β λ γ α δ α γ β α12131 ︷︸︸︷214 ︷︸︸︷1 ︷︸︸︷213 ︷︸︸︷12 ︷︸︸︷151 ︷︸︸︷213 ︷︸︸︷1 ︷︸︸︷214 ︷︸︸︷1 ︷︸︸︷213 ︷︸︸︷12 ︷︸︸︷1Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 24: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationZ3 = 1213121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 25: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationZ3 = 1213121Appli ation of 2SAT - Example

β α γ β

(βlast ∨ α�rst) ∧ (¬βlast ∨ ¬α�rst) ∧ . . . ∧ α�rst ∧ αlastRadosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 26: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationZ3 = 1213121Appli ation of 2SAT - Example

β α γ β

(βlast ∨ α�rst) ∧ (¬βlast ∨ ¬α�rst) ∧ . . . ∧ α�rst ∧ αlastβ α γ δ β γ

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 27: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationDe�nitionFor a given Zimin subword we partition it into w1mw2, where m isthe highest number. Then we remove every element i of w1 (resp.w2) su h that there exists larger element to the left (resp. to theright). We all obtained sequen e ompa t representation.. . . α . . . . . . β . . .121312 ︷ ︸︸ ︷14121312151213121 41213121 1213121 ︷ ︸︸ ︷41213121

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 28: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationDe�nitionFor a given Zimin subword we partition it into w1mw2, where m isthe highest number. Then we remove every element i of w1 (resp.w2) su h that there exists larger element to the left (resp. to theright). We all obtained sequen e ompa t representation.. . . α . . . . . . β . . .121312 ︷ ︸︸ ︷14121312151213121 41213121 1213121 ︷ ︸︸ ︷41213121

α → 145321β → 4321

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 29: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationDe�nitionFor a given Zimin subword we partition it into w1mw2, where m isthe highest number. Then we remove every element i of w1 (resp.w2) su h that there exists larger element to the left (resp. to theright). We all obtained sequen e ompa t representation.. . . α . . . . . . β . . .121312 ︷ ︸︸ ︷14121312151213121 41213121 1213121 ︷ ︸︸ ︷41213121

α → 145321β → 4321Compa t representation of any subword of Zk has at most 2 ∗ k − 1letters. Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 30: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationTheoremThe ompressed ranked pattern mat hing in Zimin words an besolved in time O(n ∗ k) and (simultaneously) spa e O(n + k2),where n is the size of the pattern and k is the highest rank of avariable. A ompressed instan e of the pattern an be onstru tedwithin the same omplexities, if there is any solution.

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words

Page 31: rithm Algo resentation rep · rithm Algo Compact resentation rep Observations On ressed Comp attern-Matching P with ed Rank riables a V in Zimin rds o W w a Radosª wi«ski, o Gª

Introdu tionAlgorithmCompa t representationThank you for your attention!

Radosªaw Gªowi«ski, Woj ie h Rytter Observations On Compressed Pattern-Mat hing with Ranked Variables in Zimin Words