Compter et g´ en´ erer al´ eatoirement des egulier 1 permutations d´ ecrites par un langage r´ Nicolas Basset University of Oxford ee al´ Journ´ ea 2014 1 sera pr´ esent´ e ` a LATIN 2014 1/20
Signature of a permutation σ ( n ) 7 7 a scent One line notation: 6 6 σ = 6724512 Signature: d escent 5 5 sg ( σ ) = adaada a scent 4 4 a scent 3 d escent 3 a scent 2 2 1 1 n 0 0 1 2 3 4 5 6 7 2/20
Two problem statements Given a regular language L ⊆ { a , d } ∗ , we are interested in sg − 1 ( L ) = { σ | sg ( σ ) ∈ L } . Problem 1: Enumeration Design an algorithm that compute a closed form formula for the exponential generating function: z | σ | α n ( L ) z n � � F L ( z ) = | σ | ! = n ! n ≥ 1 σ, sg ( σ ) ∈ L where α n ( L ) = |{ σ ∈ S n | sg ( σ ) ∈ L }| Problem 2: Uniform sampling Construct a uniform random sampler for { σ ∈ S n | sg ( σ ) ∈ L } . 1 That is Prob ( output = σ ) = α n ( L ) . 3/20
Examples Examples of closed form formula for F L • Alternating permutations: F ( ad ) ∗ ( a + ǫ ) = tan( z ) + sec( z ) − 1 • No two consecutive descents: √ √ √ 3 cos( z 3 / 2)+ 3 sin( z 3 / 2)+1] e z / 2 − 1 3 / 2) F ( a + da ) ∗ ( d + ǫ ) ( z ) = √ √ [2 cos( z 3 / 2) − 1][2 cos( z • Up-up-down-down permutations : F ( aadd ) ∗ ( aa + ǫ ) = sinh z − sin z +sin( z ) cosh z +sinh( z ) cos z 1+cos( z ) cosh z • Even number of descents (homework). A permutation without 2 consecutive descents ( n = 100) [75 , 76 , 7 , 72 , 81 , 64 , 77 , 55 , 97 , 15 , 95 , 18 , 98 , 32 , 93 , 17 , 67 , 12 , 49 , 85 , 22 , 50 , 21 , 68 , 57 , 87 , 27 , 41 , 52 , 61 , 91 , 26 , 30 , 59 , 33 , 73 , 5 , 54 , 39 , 43 , 28 , 44 , 14 , 62 , 11 , 80 , 40 , 47 , 45 , 66 , 56 , 69 , 86 , 19 , 78 , 90 , 37 , 71 , 51 , 99 , 13 , 48 , 4 , 34 , 83 , 100 , 1 , 6 , 46 , 82 , 9 , 35 , 60 , 29 , 84 , 20 , 58 , 79 , 2 , 38 , 96 , 10 , 23 , 88 , 3 , 53 , 94 , 36 , 89 , 16 , 31 , 24 , 63 , 8 , 74 , 42 , 65 , 70 , 92 , 25] 4/20
Related work Descent pattern avoidance [Ehrenborg, Jung 2013] Finite set F of forbidden words → language of finite type X F = { w ∈ { a , d } ∗ | w i · · · w j �∈ F } Descent pattern avoidance: sg − 1 ( X F ) = { σ | σ avoids F } . Example X aa , dd : alternating permutations σ 1 < σ 2 > σ 3 < . . . . 5/20
Related work Descent pattern avoidance [Ehrenborg, Jung 2013] Finite set F of forbidden words → language of finite type X F = { w ∈ { a , d } ∗ | w i · · · w j �∈ F } Descent pattern avoidance: sg − 1 ( X F ) = { σ | σ avoids F } . Example X aa , dd : alternating permutations σ 1 < σ 2 > σ 3 < . . . . Recall: language of finite type cannot express all regular languages: e.g. even number of descents. 5/20
Related work Descent pattern avoidance [Ehrenborg, Jung 2013] Finite set F of forbidden words → language of finite type X F = { w ∈ { a , d } ∗ | w i · · · w j �∈ F } Descent pattern avoidance: sg − 1 ( X F ) = { σ | σ avoids F } . Example X aa , dd : alternating permutations σ 1 < σ 2 > σ 3 < . . . . Recall: language of finite type cannot express all regular languages: e.g. even number of descents. Prescribed descent set ([Marchal 2013]) Random sampling when L = w with w ∈ { a , d } ∗ . Generating function when L = Pref ( w ∗ ) with w ∈ { a , d } (i.e. for cyclic automata). 5/20
Methodology • Geometric interpretation of the two problems. • Reduction to volumetry of some timed language. • Solutions based on volume equations for timed language. 6/20
A geometric interpretation Order polytopes of permutation and words ν ∈ [0 , 1] n | ν i < ν j iff σ i < σ j for i � = j } . • O ( σ ) = { � • Remark [0 , 1] n = ∪ σ ∈ S n O ( σ ) and Vol O ( σ ) = 1 / n ! • O ( u ) = def ⊔ sg ( σ )= u O ( σ ) e.g. O ( daa ) = O (2134) ⊔ O (3124) ⊔ O (4123). • Vol ( O ( u )) = |{ σ | sg ( σ ) = u }| / n !. Volume Generating Function z | σ | � � Vol ( O ( u )) z | u | +1 . g L ( z ) = | σ | ! = σ | sg ( σ ) ∈ L u ∈ L 7/20
The straight-turn encoding y 7 7 a | S d | S 6 6 Turn d | T Straight a 5 5 d a | T 4 4 Turn 3 Turn 3 Turn 2 2 1 1 x 0 0 1 2 3 4 5 6 7 8/20
The straight-turn encoding y 7 Turn 7 a | S d | S 6 6 Turn d | T Straight Straight a 5 5 d a | T 4 4 Turn 3 Turn 3 Turn 2 2 1 1 x 0 0 1 2 3 4 5 6 7 8/20
Adding time and clocks to words. S T p q T • a word: SST ∈ { S , T } ∗ • a timed word (0 . 5 , S )(0 . 3 , S )(0 . 1 , T ) ∈ ([0 , 1] × { S , T } ) ∗ (0 . 5 , S ) (0 . 3 , S ) (0 . 1 , T ) • a clock word 0 − − − − → 0 . 5 − − − − → 0 . 8 − − − − → 0 . 1 The straight and turn timed transitions ( t , S ) Straight: − − − → x + t if x + t ≤ 1 x ( t , T ) Turn: x − − − → t if x + t ≤ 1 9/20
The timed semantic of a language ⊆ { S , T } ∗ (0 . 5 , S ) (0 . 3 , S ) (0 . 1 , T ) (0 . 5 , 0 . 3 , 0 . 1) SST 0 − − − − → 0 . 5 − − − − → 0 . 8 − − − − → 0 . 1 = 0 − − − − − − − − − → 0 . 1 Timed semantics of L ′′ ⊆ { S , T } ∗ • The timed polytope associated to w ∈ { S , T } ∗ is ( � t , w ) P w = { � t | 0 − − − → y for some y ∈ [0 , 1] } . e.g. (0 . 5 , 0 . 3 , 0 . 1) ∈ P SST . • The timed semantics L ′′ ⊆ { S , T } ∗ is L ′′ = { ( � t ∈ P w and w ∈ L ′′ } = ∪ w ∈ L P w × { w } . t , w ) | � 10/20
Volume generating function of L ′′ ⊆ { S , T } ∗ Two timed polytopes P TTT P SSS : t 1 + t 2 ≤ 1 and t 2 + t 3 ≤ 1 t 1 + t 2 + t 3 ≤ 1 • Recall L ′′ = ∪ w ∈ L P w × { w } . • Vol ( L ′′ n ) = def � n Vol ( P w ) w ∈ L ′′ • Volume Generating Function of L ′′ : n ) z n = � VGF ( L ′′ )( z ) = def n ≥ 0 Vol ( L ′′ w ∈ L ′′ Vol ( P w ) z | w | . � 11/20
The key lemma Two step bijection: prolongating and then encoding in { S , T } ∗ � L L ′′ = def h ( L ) → h : encoding of u a in { S , T } ∗ . u �→ w Remark: easy to compute when a DFA for L ′′ from a DFA for L . No two consecutive descents: L , La ∪ { ǫ } , L ′′ ∪ { ǫ } a a S d d T p q p q p q a a T Key lemma For every w = h ( u ) ∈ L ′′ , there is a volume preserving transformation φ w : L ′′ w → O ( u ) (computable in O ( | w | )). 12/20
Reducing the two problems Reduction for Problem 1 (exponential generating function) Vol ( O ( u )) z | u | +1 = w ) z | w | = VGF ( L ′′ )( z ) . � � Vol ( L ′′ F L ( z ) = u ∈ L w ∈ L ′′ (Recall: volume preserving transformation φ w : L ′′ w → O ( u ).) Reduction for Problem 2 (uniform sampling) 1. Choose uniformly an n -length timed word ( � t , w ) ∈ L ′′ n ; ν = φ w ( � 2. compute � t ) ∈ O n ( L ); 3. return σ such that � ν ∈ O ( σ ) (using a sort). 13/20
Reducing the two problems Reduction for Problem 1 (exponential generating function) Vol ( O ( u )) z | u | +1 = w ) z | w | = VGF ( L ′′ )( z ) . � � Vol ( L ′′ F L ( z ) = u ∈ L w ∈ L ′′ (Recall: volume preserving transformation φ w : L ′′ w → O ( u ).) Reduction for Problem 2 (uniform sampling) 1. Choose uniformly an n -length timed word ( � t , w ) ∈ L ′′ n ; ν = φ w ( � 2. compute � t ) ∈ O n ( L ); 3. return σ such that � ν ∈ O ( σ ) (using a sort). Now it suffices to solve the problems for timed automata. 13/20
Language and VGF equations No two consecutive descents S T p q T parametrized language equations L p ( x ) = ∪ t ≤ 1 − x ( t , S ) L p ( x + t ) ∪ ∪ t ≤ 1 − x ( t , T ) L q ( t ) ∪ ǫ L q ( x ) = ∪ t ≤ 1 − x ( t , T ) L p ( t ) parametrized VGF � � f p ( x , z ) = z t ≤ 1 − x f p ( x + t , z ) dt + t ≤ 1 − x f q ( t , z ) dt + 1 z � f q ( x , z ) = z t ≤ 1 − x f p ( t , z ) dt 14/20
The matrix notation � 1 � 1 − x � � � f ( t , z ) dt + � f ( x , z ) = zM S f ( s , z ) ds + zM T F x 0 No two consecutive descents S T p q T � 1 � 0 � 1 � � � 0 1 , � M S = , M T = F = . 0 0 1 0 0 15/20
Solving the equation � 1 � 1 − x � � � f ( t , z ) dt + � f ( x , z ) = zM S f ( s , z ) ds + zM T F x 0 � − M S � � � � � � � ∂ f ( x , z ) − M T f ( x , z ) = z � � M T M S ∂ x f (1 − x , z ) f (1 − x , z ) � − M S � � �� � � � � f (1 , z ) � − M T f (0 , z ) and � f (1 , z ) = � = exp z F � � M T M S f (0 , z ) f (1 , z ) An algorithm to compute F L ( z ) = f q 0 (0 , z ) � A 1 ( z ) � − M S � � �� A 2 ( z ) − M T 1. Compute = def exp ; z A 3 ( z ) A 4 ( z ) M T M S 2. return F L ( z ) the component of � f (0 , z ) = [ A 1 ( z )] − 1 [ I − A 2 ( z )] � F = [ I − A 3 ( z )] − 1 A 4 ( z ) � F corresponding to the initial state q 0 . 16/20
A classical example: the alternating permutations e.g. σ = 94738251 T Here � F = M T = (1), M S = (0). � − M S � 0 � cos z � − M T �� − z � − sin z � exp = exp = z M T M S z 0 sin z cos z (Recall F L ( z ) = [ A 1 ( z )] − 1 [ I − A 2 ( z )] � F = [ I − A 3 ( z )] − 1 A 4 ( z ) � F ) F L ( z ) = 1 + sin z cos z = cos z 1 − sin z 17/20
Recommend
More recommend